react-semaphor 0.1.514 → 0.1.516

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 (228) hide show
  1. package/dist/analytics-protocol/index.cjs +1 -1
  2. package/dist/analytics-protocol/index.js +226 -225
  3. package/dist/brand-studio/index.cjs +1 -1
  4. package/dist/brand-studio/index.js +4 -4
  5. package/dist/briefings/index.cjs +1 -1
  6. package/dist/briefings/index.js +8 -8
  7. package/dist/chunks/{calculated-field-identity-BiTGmnST.cjs → calculated-field-identity-5bg9oHTw.cjs} +1 -1
  8. package/dist/chunks/{calculated-field-identity-DnRd4YIY.js → calculated-field-identity-DzJBs2J8.js} +4 -4
  9. package/dist/chunks/{card-config-utils-B2cDWQqB.js → card-config-utils-Cxnq2R6z.js} +14 -14
  10. package/dist/chunks/{card-config-utils-CMO4_zVs.cjs → card-config-utils-z86y6tSq.cjs} +1 -1
  11. package/dist/chunks/column-bands-CU0byntA.cjs +1 -0
  12. package/dist/chunks/column-bands-RdM-kjDe.js +47 -0
  13. package/dist/chunks/{dashboard-briefing-launcher-e3s3MuSs.js → dashboard-briefing-launcher-BCEHJ_eD.js} +15 -12
  14. package/dist/chunks/{dashboard-briefing-launcher-BzPD50QD.cjs → dashboard-briefing-launcher-CjZ4aE34.cjs} +2 -2
  15. package/dist/chunks/{dashboard-controls-DAOABnks.js → dashboard-controls-DFfit5KH.js} +12 -12
  16. package/dist/chunks/{dashboard-controls-DQBfOqmC.cjs → dashboard-controls-f9aJ70Zu.cjs} +1 -1
  17. package/dist/chunks/{dashboard-date-comparison-definition-D7Bl-YAl.js → dashboard-date-comparison-definition-BqNhECUr.js} +6 -6
  18. package/dist/chunks/{dashboard-date-comparison-definition-C_w-GO_5.cjs → dashboard-date-comparison-definition-Y6JZwpcr.cjs} +1 -1
  19. package/dist/chunks/{dashboard-json-S5Eq2GAg.js → dashboard-json-DVtcA02f.js} +7 -7
  20. package/dist/chunks/{dashboard-json-1jZycd5h.cjs → dashboard-json-deqQC-UR.cjs} +1 -1
  21. package/dist/chunks/edit-dashboard-visual-DK6lSC_p.cjs +172 -0
  22. package/dist/chunks/{edit-dashboard-visual-Bkm0ciHG.js → edit-dashboard-visual-lJ6rDH3w.js} +4553 -4542
  23. package/dist/chunks/{editor-action-buttons-Bvv16QA-.js → editor-action-buttons-Bnxxa439.js} +7 -7
  24. package/dist/chunks/{editor-action-buttons-B2NCSsDw.cjs → editor-action-buttons-CmDaQbPN.cjs} +1 -1
  25. package/dist/chunks/{field-aggregations-CzuQKtqx.js → field-aggregations-Dl2A3rbV.js} +461 -358
  26. package/dist/chunks/field-aggregations-pH_3kymD.cjs +1 -0
  27. package/dist/chunks/{field-dependencies-DIab72rQ.cjs → field-dependencies-EB485TdB.cjs} +1 -1
  28. package/dist/chunks/{field-dependencies-DXW4jtvJ.js → field-dependencies-v-lJNzC7.js} +1 -1
  29. package/dist/chunks/{index-nhUr9xBz.js → index-BVVl2JDK.js} +57955 -54696
  30. package/dist/chunks/{index-CACdoqu3.js → index-C8w91oj4.js} +61 -51
  31. package/dist/chunks/index-Cw2ypaFl.cjs +1 -0
  32. package/dist/chunks/index-DfqMtR9S.cjs +4 -0
  33. package/dist/chunks/index-UNKSfi7s.cjs +1434 -0
  34. package/dist/chunks/{index-CnGVjyF8.js → index-ylOpKRDu.js} +877 -849
  35. package/dist/chunks/{matrix-analytical-definition-Ct5Tu8np.cjs → matrix-analytical-definition-BWd159lN.cjs} +1 -1
  36. package/dist/chunks/{matrix-analytical-definition-BDAK2aEi.js → matrix-analytical-definition-BimC4XIV.js} +1 -1
  37. package/dist/chunks/{matrix-card-U4c72doZ.cjs → matrix-card-C2RjEYZ8.cjs} +1 -1
  38. package/dist/chunks/{matrix-card-DOIeTmjh.js → matrix-card-CIlz0Dnp.js} +2 -2
  39. package/dist/chunks/{matrix-control-sources-FjxGIbqk.cjs → matrix-control-sources-BvEJF7d3.cjs} +1 -1
  40. package/dist/chunks/{matrix-control-sources-BxKH2yu2.js → matrix-control-sources-KbZe1gj_.js} +51 -51
  41. package/dist/chunks/{matrix-definition-CBJW_4ii.cjs → matrix-definition-DanUT11P.cjs} +1 -1
  42. package/dist/chunks/{matrix-definition-I9rHB9zN.js → matrix-definition-E5gXXSTZ.js} +1 -1
  43. package/dist/chunks/matrix-formatter-BJTO8ky9.cjs +1 -0
  44. package/dist/chunks/matrix-formatter-CCXNRt3s.js +341 -0
  45. package/dist/chunks/{matrix-member-presentation-DO1VSqfh.js → matrix-member-presentation-Bw7-JCrr.js} +64 -64
  46. package/dist/chunks/matrix-member-presentation-DvXDEo0U.cjs +1 -0
  47. package/dist/chunks/{matrix-operation-contract-DoiWTUbT.cjs → matrix-operation-contract-0RxoU_M3.cjs} +1 -1
  48. package/dist/chunks/{matrix-operation-contract-D0HfzwZg.js → matrix-operation-contract-D32U2CSw.js} +19 -19
  49. package/dist/chunks/{metric-comparison-Dqc7_tnW.js → metric-comparison-BphoJ9bq.js} +1 -1
  50. package/dist/chunks/{metric-comparison-DBQ3EJTz.cjs → metric-comparison-CUmltzpz.cjs} +1 -1
  51. package/dist/chunks/pivot-header-presentation-BSZhB1g-.js +661 -0
  52. package/dist/chunks/pivot-header-presentation-EoUS5ze5.cjs +5 -0
  53. package/dist/chunks/{pivot-result-identity-8M-bZrw9.js → pivot-result-identity-BzUQiCEV.js} +4 -4
  54. package/dist/chunks/{pivot-result-identity-uTiylUNr.cjs → pivot-result-identity-gquWljbd.cjs} +1 -1
  55. package/dist/chunks/pivot-result-lifecycle-gl9cBfB-.cjs +1 -0
  56. package/dist/chunks/{pivot-result-lifecycle-BeOpjAhg.js → pivot-result-lifecycle-kRhiJkzg.js} +208 -149
  57. package/dist/chunks/{raw-temporal-DrmCX9Wq.js → raw-temporal-BqOfk-xN.js} +471 -361
  58. package/dist/chunks/{raw-temporal-contract-CFLGwTiI.js → raw-temporal-contract-BQZIJ1fn.js} +1 -1
  59. package/dist/chunks/{raw-temporal-contract-DECbTuzA.cjs → raw-temporal-contract-CklMVG_1.cjs} +1 -1
  60. package/dist/chunks/raw-temporal-eJXecCyJ.cjs +1 -0
  61. package/dist/chunks/{report-preferences-dialog-B2fzQH1T.js → report-preferences-dialog-CHXPEl7v.js} +6 -6
  62. package/dist/chunks/{report-preferences-dialog-DcLkVqni.cjs → report-preferences-dialog-Cto0vDwI.cjs} +1 -1
  63. package/dist/chunks/{report-runtime-context-Cs65Mrxj.js → report-runtime-context-CxIoGyNM.js} +1 -1
  64. package/dist/chunks/{report-runtime-context-DzvHBPxl.cjs → report-runtime-context-CzSrCBsu.cjs} +1 -1
  65. package/dist/chunks/{selection-reducer-BIiQXbGM.js → selection-reducer-CvCBQbl2.js} +1 -1
  66. package/dist/chunks/{selection-reducer-CGKKsaPa.cjs → selection-reducer-Kl22OzIk.cjs} +1 -1
  67. package/dist/chunks/{semantic-format-BZxJLKvw.js → semantic-format-DwqGYx4V.js} +25 -31
  68. package/dist/chunks/semantic-format-mVI32OJH.cjs +1 -0
  69. package/dist/chunks/{source-entity-resolution-D7vnmDwm.js → source-entity-resolution-Bzefiive.js} +7 -7
  70. package/dist/chunks/{source-entity-resolution-CjbgnwyX.cjs → source-entity-resolution-R46X34SE.cjs} +1 -1
  71. package/dist/chunks/switch-DNbWXEOP.cjs +134 -0
  72. package/dist/chunks/{switch-QfKb0Iwe.js → switch-DNv-hVmt.js} +8260 -7659
  73. package/dist/chunks/{temporal-bucket-B9hMwemw.js → temporal-bucket-DlFuhCnT.js} +6 -6
  74. package/dist/chunks/{temporal-bucket-contract-IWDgyTMw.js → temporal-bucket-contract-DTLDRzgV.js} +1 -1
  75. package/dist/chunks/{temporal-bucket-contract-ZctiyXYk.cjs → temporal-bucket-contract-nTv6gvX5.cjs} +1 -1
  76. package/dist/chunks/{token-types-Dl0hcKBX.js → token-types-BC6RcUY8.js} +1 -1
  77. package/dist/chunks/{token-types-Ahh5u4iT.cjs → token-types-aWrzwonf.cjs} +1 -1
  78. package/dist/chunks/{update-policy-COjFudhl.cjs → update-policy-DRDLWe7Y.cjs} +1 -1
  79. package/dist/chunks/{update-policy-BeQqjupC.js → update-policy-DhAUtiC8.js} +2 -2
  80. package/dist/chunks/{validators-CkHsAvwB.js → validators-CsdOtZI6.js} +411 -397
  81. package/dist/chunks/validators-DFeDcdpA.cjs +1 -0
  82. package/dist/dashboard/index.cjs +1 -1
  83. package/dist/dashboard/index.js +1 -1
  84. package/dist/dashboard-authoring/index.cjs +3 -3
  85. package/dist/dashboard-authoring/index.js +233 -227
  86. package/dist/data-app-builder/index.cjs +1 -1
  87. package/dist/data-app-builder/index.js +3 -3
  88. package/dist/data-app-codegen/index.cjs +1 -1
  89. package/dist/data-app-codegen/index.js +2 -2
  90. package/dist/data-app-codegen-node/index.cjs +1 -1
  91. package/dist/data-app-codegen-node/index.js +3 -3
  92. package/dist/data-app-sdk/index.cjs +1 -1
  93. package/dist/data-app-sdk/index.js +5 -5
  94. package/dist/data-app-sdk-adapters/index.cjs +1 -1
  95. package/dist/data-app-sdk-adapters/index.js +2 -2
  96. package/dist/data-app-sdk-validation/index.cjs +1 -1
  97. package/dist/data-app-sdk-validation/index.js +5 -5
  98. package/dist/format-utils/index.cjs +3 -3
  99. package/dist/format-utils/index.js +291 -397
  100. package/dist/index.cjs +1 -1
  101. package/dist/index.js +15 -15
  102. package/dist/pdf-table-layout/index.cjs +1 -0
  103. package/dist/pdf-table-layout/index.js +993 -0
  104. package/dist/report-runtime-context/index.cjs +1 -1
  105. package/dist/report-runtime-context/index.js +2 -2
  106. package/dist/style.css +1 -1
  107. package/dist/surfboard/index.cjs +1 -1
  108. package/dist/surfboard/index.js +2 -2
  109. package/dist/types/briefings/index.d.ts +1 -1
  110. package/dist/types/components/document-sheet/document-input-bar.d.ts +1 -3
  111. package/dist/types/components/document-sheet/document-insert-picker.d.ts +37 -0
  112. package/dist/types/components/document-sheet/document-kpi-section.d.ts +17 -0
  113. package/dist/types/components/document-sheet/document-matrix-layout-context.d.ts +10 -0
  114. package/dist/types/components/document-sheet/document-matrix-section.d.ts +27 -0
  115. package/dist/types/components/document-sheet/document-measure-layer.d.ts +45 -0
  116. package/dist/types/components/document-sheet/document-outline.d.ts +7 -1
  117. package/dist/types/components/document-sheet/document-page-navigation.d.ts +22 -0
  118. package/dist/types/components/document-sheet/document-page.d.ts +9 -5
  119. package/dist/types/components/document-sheet/document-panel/document-side-panel.d.ts +36 -0
  120. package/dist/types/components/document-sheet/document-panel/inputs-panel.d.ts +9 -0
  121. package/dist/types/components/document-sheet/document-panel/page-panel.d.ts +5 -0
  122. package/dist/types/components/document-sheet/document-panel/panel-controls.d.ts +14 -0
  123. package/dist/types/components/document-sheet/document-panel/region-panels.d.ts +11 -0
  124. package/dist/types/components/document-sheet/document-panel/section-panel.d.ts +25 -0
  125. package/dist/types/components/document-sheet/document-section-print-boundary.d.ts +9 -0
  126. package/dist/types/components/document-sheet/document-table-chrome.d.ts +22 -0
  127. package/dist/types/components/document-sheet/document-table-section.d.ts +3 -7
  128. package/dist/types/components/document-sheet/document-text-preview-context.d.ts +8 -0
  129. package/dist/types/components/document-sheet/use-first-fitting-variant.d.ts +18 -0
  130. package/dist/types/components/editor/editor-main/dashboard-variable-node.d.ts +12 -2
  131. package/dist/types/components/explorer/chart-configuration/matrix-authoring-controls.d.ts +7 -2
  132. package/dist/types/components/text-variables/variable-chip-plugin.d.ts +23 -0
  133. package/dist/types/components/text-variables/variable-chip.d.ts +18 -0
  134. package/dist/types/components/text-variables/variable-picker.d.ts +27 -0
  135. package/dist/types/components/visual/aggregated-table/utils/metric-format-resolver.d.ts +3 -3
  136. package/dist/types/components/visual/data-table/types/data-table.d.ts +4 -1
  137. package/dist/types/components/visual/pivot-table/utils/pivot-metric-formatting.d.ts +2 -2
  138. package/dist/types/components/visual/settings/table-presentation-settings.d.ts +27 -1
  139. package/dist/types/index.cjs +1 -1
  140. package/dist/types/index.js +5 -5
  141. package/dist/types/lib/dashboard-inputs/text-variable-options.d.ts +15 -0
  142. package/dist/types/lib/document/document-canvas-actions.d.ts +22 -0
  143. package/dist/types/lib/document/document-edits.d.ts +119 -0
  144. package/dist/types/lib/document/document-kpi-figure.d.ts +27 -0
  145. package/dist/types/lib/document/document-kpi-layout.d.ts +29 -0
  146. package/dist/types/lib/document/document-kpi-section-edits.d.ts +15 -0
  147. package/dist/types/lib/document/document-matrix-bands.d.ts +66 -0
  148. package/dist/types/lib/document/document-matrix-print.d.ts +11 -0
  149. package/dist/types/lib/document/document-pagination.d.ts +56 -3
  150. package/dist/types/lib/document/document-panel-target.d.ts +19 -0
  151. package/dist/types/lib/document/document-section-editor.d.ts +8 -7
  152. package/dist/types/lib/document/document-section-kinds.d.ts +49 -0
  153. package/dist/types/lib/document/document-section-query-options.d.ts +25 -0
  154. package/dist/types/lib/document/document-section-render-state.d.ts +26 -0
  155. package/dist/types/lib/document/document-section-utils.d.ts +11 -4
  156. package/dist/types/lib/document/document-table-dom.d.ts +4 -6
  157. package/dist/types/lib/document/document-table-pagination-model.d.ts +0 -5
  158. package/dist/types/lib/document/document-table-print-model.d.ts +4 -3
  159. package/dist/types/lib/document/document-table-style.d.ts +15 -4
  160. package/dist/types/lib/document/document-table-surface.d.ts +15 -0
  161. package/dist/types/lib/document/document-variables.d.ts +40 -6
  162. package/dist/types/lib/document/use-document-section-data.d.ts +39 -0
  163. package/dist/types/lib/document/use-measured-document-table-layout.d.ts +50 -0
  164. package/dist/types/lib/formatters/kpi-result-values.d.ts +20 -0
  165. package/dist/types/lib/formatters/metric-formatting.d.ts +3 -3
  166. package/dist/types/lib/hooks/query-context/use-dashboard-card-execution-snapshot.d.ts +8 -2
  167. package/dist/types/lib/hooks/use-dashboard-frame-query.d.ts +6 -0
  168. package/dist/types/lib/hooks/use-dashboard-kpi-actions.d.ts +1 -1
  169. package/dist/types/lib/hooks/use-document-section-editor.d.ts +2 -2
  170. package/dist/types/lib/hooks/use-document-section-session.d.ts +36 -0
  171. package/dist/types/lib/hooks/use-editor-preview.d.ts +17 -0
  172. package/dist/types/lib/hooks/use-is-editing-card.d.ts +7 -0
  173. package/dist/types/lib/matrix-table/matrix-card-adapter.d.ts +2 -0
  174. package/dist/types/lib/matrix-table/matrix-card-draft.d.ts +2 -0
  175. package/dist/types/lib/matrix-table/matrix-delivery.d.ts +4 -0
  176. package/dist/types/lib/matrix-table/matrix-layout-read.d.ts +68 -0
  177. package/dist/types/lib/query-context/build-dashboard-execution-snapshot.d.ts +8 -1
  178. package/dist/types/lib/query-context/build-dashboard-frame-base-query-contexts.d.ts +4 -2
  179. package/dist/types/lib/query-context/card-execution.d.ts +30 -0
  180. package/dist/types/lib/query-context/document-section-card-query.d.ts +37 -0
  181. package/dist/types/lib/stores/dashboard-store.d.ts +12 -8
  182. package/dist/types/lib/stores/editor-store.d.ts +2 -0
  183. package/dist/types/lib/table-formatting/table-presentation-fields.d.ts +1 -0
  184. package/dist/types/lib/text-variables/text-variable-types.d.ts +39 -0
  185. package/dist/types/lib/types/common-types.d.ts +34 -1
  186. package/dist/types/lib/utils/card-definition.d.ts +2 -0
  187. package/dist/types/lib/utils/card-utils.d.ts +13 -6
  188. package/dist/types/lib/utils/date-timezone-utils.d.ts +26 -4
  189. package/dist/types/pdf-table-layout.d.ts +2 -0
  190. package/dist/types/shared/analytics-protocol/index.d.ts +1 -1
  191. package/dist/types/shared/analytics-protocol/matrix-definition-contract.d.ts +45 -0
  192. package/dist/types/shared/analytics-protocol/matrix-member-presentation.d.ts +4 -0
  193. package/dist/types/shared/dashboard-authoring/document-section-cards.d.ts +56 -0
  194. package/dist/types/shared/dashboard-authoring/index.d.ts +1 -0
  195. package/dist/types/shared/dashboard-authoring/matrix-delivery.d.ts +36 -1
  196. package/dist/types/shared/format-utils/formatters/duration-formatter.d.ts +4 -1
  197. package/dist/types/shared/format-utils/formatters/index.d.ts +2 -2
  198. package/dist/types/shared/format-utils/formatters/matrix-formatter.d.ts +5 -0
  199. package/dist/types/shared/format-utils/formatters/number-formatter.d.ts +8 -2
  200. package/dist/types/shared/format-utils/index.d.ts +1 -0
  201. package/dist/types/shared/format-utils/matrix-export-presentation.d.ts +690 -1
  202. package/dist/types/shared/format-utils/matrix-print.d.ts +38 -0
  203. package/dist/types/shared/format-utils/pdf-table-layout/column-bands.d.ts +55 -0
  204. package/dist/types/shared/format-utils/pdf-table-layout/index.d.ts +6 -0
  205. package/dist/types/shared/format-utils/pdf-table-layout/page-size.d.ts +7 -0
  206. package/dist/types/shared/format-utils/pdf-table-layout/table-column-semantics.d.ts +106 -0
  207. package/dist/types/shared/format-utils/pdf-table-layout/table-column-widths.d.ts +13 -0
  208. package/dist/types/shared/format-utils/pdf-table-layout/table-page-geometry.d.ts +19 -0
  209. package/dist/types/shared/format-utils/pdf-table-layout/wide-table-layout.d.ts +46 -0
  210. package/dist/types/shared/format-utils/presentation-execution.d.ts +17 -2
  211. package/dist/types/shared/format-utils/table-structure.d.ts +9 -0
  212. package/dist/types/shared/format-utils/types/format-types.d.ts +16 -1
  213. package/package.json +6 -1
  214. package/dist/chunks/edit-dashboard-visual-BwJ2Eljw.cjs +0 -172
  215. package/dist/chunks/field-aggregations-jSi77h9Z.cjs +0 -1
  216. package/dist/chunks/index-DhlVxvyI.cjs +0 -4
  217. package/dist/chunks/index-DrOFJOCq.cjs +0 -1424
  218. package/dist/chunks/index-F25jnH0p.cjs +0 -1
  219. package/dist/chunks/matrix-formatter-BLunke3R.js +0 -424
  220. package/dist/chunks/matrix-formatter-CveLJo6S.cjs +0 -1
  221. package/dist/chunks/matrix-member-presentation-CFHjdrxT.cjs +0 -1
  222. package/dist/chunks/pivot-header-presentation-Cxz8-06f.cjs +0 -5
  223. package/dist/chunks/pivot-header-presentation-Dm9dUQsl.js +0 -415
  224. package/dist/chunks/pivot-result-lifecycle-BiERyXnS.cjs +0 -1
  225. package/dist/chunks/raw-temporal-BUeTpG76.cjs +0 -1
  226. package/dist/chunks/semantic-format-BzH69TRq.cjs +0 -1
  227. package/dist/chunks/switch--Re1K566.cjs +0 -134
  228. package/dist/chunks/validators-DVYAnnX0.cjs +0 -1
@@ -0,0 +1,993 @@
1
+ import { PDF_SAFETY_LIMIT_EXCEEDED as me } from "../pdf-export-policy/index.js";
2
+ import { p as he, c as fe } from "../chunks/column-bands-RdM-kjDe.js";
3
+ const pe = {
4
+ letter: "Letter",
5
+ legal: "Legal",
6
+ tabloid: "Tabloid",
7
+ ledger: "Ledger",
8
+ a0: "A0",
9
+ a1: "A1",
10
+ a2: "A2",
11
+ a3: "A3",
12
+ a4: "A4",
13
+ a5: "A5",
14
+ a6: "A6"
15
+ };
16
+ function J(e) {
17
+ if (!e) return "Letter";
18
+ const t = pe[e.toLowerCase()];
19
+ return t || (console.warn(`Unknown page size "${e}", defaulting to Letter`), "Letter");
20
+ }
21
+ const ge = 96, xe = 25.4, R = Object.freeze({
22
+ marginsMm: Object.freeze({
23
+ top: 8,
24
+ right: 10,
25
+ bottom: 12,
26
+ left: 10
27
+ }),
28
+ printBodyPaddingMm: 0
29
+ });
30
+ function _(e) {
31
+ return e === 0 ? "0" : `${e}mm`;
32
+ }
33
+ function st() {
34
+ const { top: e, right: t, bottom: n, left: i } = R.marginsMm;
35
+ return {
36
+ top: _(e),
37
+ right: _(t),
38
+ bottom: _(n),
39
+ left: _(i)
40
+ };
41
+ }
42
+ function ot() {
43
+ return _(R.printBodyPaddingMm);
44
+ }
45
+ function be() {
46
+ const { left: e, right: t } = R.marginsMm;
47
+ return (e + t + R.printBodyPaddingMm * 2) / xe * ge;
48
+ }
49
+ const re = Object.freeze({
50
+ boolean: Object.freeze({ min: 52, max: 80 }),
51
+ numeric: Object.freeze({ min: 56, max: 184 }),
52
+ datetime: Object.freeze({ min: 82, max: 184 }),
53
+ id: Object.freeze({ min: 72, max: 224 }),
54
+ text: Object.freeze({ min: 76, max: 280 })
55
+ }), H = Object.freeze({
56
+ averageGlyphPx: 7.4,
57
+ // 11pt tabular numerals, including semibold subtotal rows. Proportional
58
+ // text metrics (especially the narrow '1') underestimate printed totals.
59
+ tabularNumericGlyphPx: 9,
60
+ horizontalPaddingPx: 18,
61
+ measuredWidthHeadroom: 1.2,
62
+ representativePercentile: 0.9
63
+ });
64
+ function D(e) {
65
+ return e == null ? "" : String(e).replace(/\s+/g, " ").trim();
66
+ }
67
+ function ye(e, t = !1) {
68
+ return Array.from(D(e)).reduce((n, i) => t && i >= "0" && i <= "9" ? n + 1 : /[ilI1.,'|]/.test(i) ? n + 0.5 : /[MW@%&#]/.test(i) ? n + 1.25 : /\s/.test(i) ? n + 0.55 : n + 1, 0);
69
+ }
70
+ function U(e, t = !1) {
71
+ return ye(e, t) * (t ? H.tabularNumericGlyphPx : H.averageGlyphPx) + H.horizontalPaddingPx;
72
+ }
73
+ function Pe(e) {
74
+ const t = D(e);
75
+ if (!t) return 0;
76
+ const i = t.split(/\s+/).filter(Boolean).reduce(
77
+ (a, u) => Math.max(a, U(u)),
78
+ 0
79
+ ), s = U(t) * 0.72;
80
+ return Math.max(i, s);
81
+ }
82
+ function we(e, t) {
83
+ if (e.length === 0) return 0;
84
+ const n = [...e].sort((s, a) => s - a), i = Math.max(0, Math.ceil(t * n.length) - 1);
85
+ return n[Math.min(i, n.length - 1)];
86
+ }
87
+ function Ce(e, t) {
88
+ const n = t.map(D).filter(Boolean).map((i) => U(i, e === "numeric"));
89
+ return n.length === 0 ? 0 : e === "numeric" || e === "boolean" ? Math.max(...n) : we(n, H.representativePercentile);
90
+ }
91
+ function F(e) {
92
+ return re[e] || re.text;
93
+ }
94
+ function Ne({
95
+ type: e = "text",
96
+ label: t = "",
97
+ sampleValues: n = [],
98
+ grandTotalValue: i = "",
99
+ measuredWidthPx: s = null,
100
+ declaredNumeric: a = !1
101
+ } = {}) {
102
+ const u = F(e), r = [...n, i], l = Ce(e, r), o = Math.max(
103
+ u.min,
104
+ Pe(t),
105
+ l
106
+ ), c = Number(s), d = r.some((h) => D(h)), y = Number.isFinite(c) && c > 0 ? d ? Math.min(c, o * H.measuredWidthHeadroom) : c : 0, g = Math.max(o, y), m = Math.min(u.max, Math.max(u.min, g));
107
+ return a ? Math.max(l, m) : m;
108
+ }
109
+ function W(e) {
110
+ return e == null ? "" : String(e);
111
+ }
112
+ function X(e = {}) {
113
+ return {
114
+ text: W(e.text),
115
+ colspan: 1,
116
+ rowspan: 1,
117
+ className: e.className || "",
118
+ columnId: e.columnId || null,
119
+ isHeader: !!e.isHeader,
120
+ ...typeof e.isNumeric == "boolean" ? { isNumeric: e.isNumeric } : {},
121
+ ...typeof e.pdfIsNumeric == "boolean" ? { pdfIsNumeric: e.pdfIsNumeric } : {},
122
+ measuredWidthPx: Number(e.measuredWidthPx) || null
123
+ };
124
+ }
125
+ function Ie(e = []) {
126
+ return Array.isArray(e) ? e.map((t) => Array.isArray(t) ? t : Array.isArray(t == null ? void 0 : t.cells) ? t.cells : []) : [];
127
+ }
128
+ function Ae(e, t) {
129
+ const n = String(e || "").split(/\s+/).map((i) => i.trim()).filter(Boolean);
130
+ return n.includes(t) || n.push(t), n.join(" ");
131
+ }
132
+ function Se(e) {
133
+ return String(e || "").split(/\s+/).map((t) => t.trim()).filter(
134
+ (t) => t && t !== "numeric" && t !== "text-right" && t !== "text-end"
135
+ ).join(" ");
136
+ }
137
+ function We(e = []) {
138
+ return new Map(
139
+ e.map((t, n) => [t == null ? void 0 : t.columnId, n]).filter(([t]) => t)
140
+ );
141
+ }
142
+ function K(e = {}, t = null) {
143
+ if (typeof e.pdfIsNumeric == "boolean")
144
+ return e.pdfIsNumeric;
145
+ if (typeof (t == null ? void 0 : t.isNumeric) == "boolean")
146
+ return t.isNumeric;
147
+ if (typeof e.isNumeric == "boolean")
148
+ return e.isNumeric;
149
+ }
150
+ function T(e = {}, t = null) {
151
+ const n = !!(t != null && t.isNumeric), i = Se(e.className);
152
+ return {
153
+ ...e,
154
+ className: n ? Ae(i, "numeric") : i,
155
+ isNumeric: n
156
+ };
157
+ }
158
+ function ie(e = null, t = null) {
159
+ return T(
160
+ {
161
+ text: "",
162
+ colspan: 1,
163
+ rowspan: 1,
164
+ className: (t == null ? void 0 : t.className) || "",
165
+ columnId: (e == null ? void 0 : e.columnId) || null,
166
+ isHeader: !!(t != null && t.isHeader)
167
+ },
168
+ e
169
+ );
170
+ }
171
+ function ve(e = [], t = []) {
172
+ const n = Array.from(
173
+ { length: t.length },
174
+ () => null
175
+ ), i = We(t);
176
+ return e.map((s = {}) => {
177
+ const a = n.map((o) => !!(o != null && o.remaining)), u = [];
178
+ let r = 0;
179
+ const l = (o) => {
180
+ for (; r < o && r < t.length; )
181
+ u.push(
182
+ ie(t[r], n[r])
183
+ ), r += 1;
184
+ };
185
+ return (s.cells || []).forEach((o = {}) => {
186
+ for (; r < t.length && a[r]; )
187
+ u.push(
188
+ ie(t[r], n[r])
189
+ ), r += 1;
190
+ const c = o.columnId ? i.get(o.columnId) : void 0, d = Math.max(r, c ?? r);
191
+ l(d);
192
+ const y = Math.max(1, Number(o.colspan || 1)), g = Math.max(1, Number(o.rowspan || 1)), m = {
193
+ ...o,
194
+ colspan: y,
195
+ rowspan: 1
196
+ };
197
+ if (u.push(
198
+ y > 1 || !t[d] ? T(m, { isNumeric: !1 }) : T(
199
+ m,
200
+ t[d]
201
+ )
202
+ ), g > 1)
203
+ for (let h = 0; h < y; h += 1) {
204
+ const f = d + h;
205
+ f < n.length && (n[f] = {
206
+ remaining: g - 1,
207
+ className: o.className || "",
208
+ isHeader: !!o.isHeader
209
+ });
210
+ }
211
+ r = d + y;
212
+ }), l(t.length), n.forEach((o, c) => {
213
+ !a[c] || !(o != null && o.remaining) || (o.remaining -= 1, o.remaining <= 0 && (n[c] = null));
214
+ }), {
215
+ ...s,
216
+ cells: u
217
+ };
218
+ });
219
+ }
220
+ function Le(e = []) {
221
+ const t = Ie(e);
222
+ if (t.length === 0)
223
+ return {
224
+ headerRows: [],
225
+ rowSources: [],
226
+ matrix: [],
227
+ placements: [],
228
+ leafCells: []
229
+ };
230
+ const n = t.length, i = e.map(
231
+ (o) => Array.isArray(o) ? {} : o || {}
232
+ ), s = Array.from(
233
+ { length: n },
234
+ () => []
235
+ ), a = [];
236
+ t.forEach((o, c) => {
237
+ let d = 0;
238
+ o.forEach((y = {}, g) => {
239
+ for (; s[c][d] !== void 0; )
240
+ d += 1;
241
+ const m = Math.max(1, Number(y.colspan || 1)), h = Math.max(1, Number(y.rowspan || 1)), f = {
242
+ id: `${c}:${g}`,
243
+ rowIndex: c,
244
+ startCol: d,
245
+ endCol: d + m - 1,
246
+ colspan: m,
247
+ rowspan: h,
248
+ cell: X(y),
249
+ hasChildHeaders: !1
250
+ };
251
+ a.push(f);
252
+ for (let S = 0; S < h; S += 1) {
253
+ const C = c + S;
254
+ if (C >= n) break;
255
+ for (let b = 0; b < m; b += 1) {
256
+ const P = d + b;
257
+ s[C][P] === void 0 && (s[C][P] = f);
258
+ }
259
+ }
260
+ d += m;
261
+ });
262
+ }), a.forEach((o) => {
263
+ o.hasChildHeaders = a.some(
264
+ (c) => c.rowIndex > o.rowIndex && c.startCol <= o.endCol && c.endCol >= o.startCol
265
+ );
266
+ });
267
+ const u = n - 1, r = s.reduce((o, c) => Math.max(o, c.length), 0), l = Array.from({ length: r }, (o, c) => {
268
+ let d = null;
269
+ for (let f = u; f >= 0; f -= 1)
270
+ if (s[f][c]) {
271
+ d = s[f][c];
272
+ break;
273
+ }
274
+ if (!d) return X();
275
+ const y = c - d.startCol, g = d.colspan === 1 || !d.hasChildHeaders, m = d.cell, h = g && Number.isFinite(m.measuredWidthPx) && m.measuredWidthPx > 0 ? m.measuredWidthPx / d.colspan : null;
276
+ return {
277
+ text: m.text,
278
+ colspan: 1,
279
+ rowspan: 1,
280
+ className: m.className,
281
+ columnId: g && y === 0 ? m.columnId : null,
282
+ isHeader: m.isHeader,
283
+ ...g && typeof m.isNumeric == "boolean" ? { isNumeric: m.isNumeric } : {},
284
+ ...g && typeof m.pdfIsNumeric == "boolean" ? { pdfIsNumeric: m.pdfIsNumeric } : {},
285
+ measuredWidthPx: h
286
+ };
287
+ });
288
+ return { headerRows: t, rowSources: i, matrix: s, placements: a, leafCells: l };
289
+ }
290
+ function O() {
291
+ return {
292
+ text: "",
293
+ colspan: 1,
294
+ rowspan: 1,
295
+ className: "",
296
+ columnId: null,
297
+ isHeader: !1,
298
+ measuredWidthPx: null
299
+ };
300
+ }
301
+ function G(e = {}, t = {}) {
302
+ return {
303
+ text: W(e.text),
304
+ colspan: 1,
305
+ rowspan: 1,
306
+ className: e.className || "",
307
+ columnId: e.columnId || null,
308
+ isHeader: !!e.isHeader,
309
+ ...typeof e.isNumeric == "boolean" ? { isNumeric: e.isNumeric } : {},
310
+ ...typeof e.pdfIsNumeric == "boolean" ? { pdfIsNumeric: e.pdfIsNumeric } : {},
311
+ measuredWidthPx: Number(e.measuredWidthPx) || null,
312
+ ...t
313
+ };
314
+ }
315
+ function se(e = []) {
316
+ return e.reduce(
317
+ (t, n) => t + Math.max(1, Number((n == null ? void 0 : n.colspan) || 1)),
318
+ 0
319
+ );
320
+ }
321
+ function Te(e = [], t = 0) {
322
+ const n = Array.from({ length: t }, () => 0);
323
+ return e.map((i = {}) => {
324
+ const s = Array.from(
325
+ { length: t },
326
+ () => null
327
+ );
328
+ let a = 0;
329
+ const u = () => {
330
+ for (; a < t && n[a] > 0; )
331
+ s[a] = O(), n[a] -= 1, a += 1;
332
+ };
333
+ for (u(), (i.cells || []).forEach((r = {}) => {
334
+ if (u(), a >= t) return;
335
+ const l = Math.max(1, Number(r.colspan || 1)), o = Math.max(1, Number(r.rowspan || 1));
336
+ for (let c = 0; c < l; c += 1) {
337
+ const d = a + c;
338
+ if (d >= t) break;
339
+ s[d] = c === 0 ? G(r) : G(r, {
340
+ text: "",
341
+ columnId: null,
342
+ measuredWidthPx: null
343
+ }), o > 1 && (n[d] = Math.max(
344
+ n[d],
345
+ o - 1
346
+ ));
347
+ }
348
+ a += l;
349
+ }); a < t; )
350
+ n[a] > 0 && (n[a] -= 1), s[a] = s[a] || O(), a += 1;
351
+ return s.map((r) => r || O());
352
+ });
353
+ }
354
+ function Be(e = null, t = 0) {
355
+ if (!e) return null;
356
+ const n = [];
357
+ for ((e.cells || []).forEach((i = {}) => {
358
+ const s = Math.max(1, Number(i.colspan || 1));
359
+ n.push(G(i));
360
+ for (let a = 1; a < s; a += 1)
361
+ n.push(
362
+ G(i, {
363
+ text: "",
364
+ columnId: null,
365
+ measuredWidthPx: null
366
+ })
367
+ );
368
+ }); n.length < t; ) n.push(O());
369
+ return n.slice(0, t);
370
+ }
371
+ function Me(e) {
372
+ const t = W(e).trim().toLowerCase();
373
+ return t ? ["-", "—", "–", "n/a", "na", "null", "none"].includes(t) : !0;
374
+ }
375
+ function ze(e) {
376
+ const t = W(e).trim().toLowerCase();
377
+ return ["true", "false", "yes", "no", "y", "n", "on", "off"].includes(
378
+ t
379
+ );
380
+ }
381
+ function Ee(e) {
382
+ const t = W(e).trim();
383
+ return t ? /^\d{4}-\d{2}-\d{2}/.test(t) || /^\d{1,2}\/\d{1,2}\/\d{2,4}/.test(t) || /^\d{4}-\d{2}-\d{2}\s+\d{2}:\d{2}/.test(t) : !1;
384
+ }
385
+ function _e(e) {
386
+ const t = W(e).trim();
387
+ return !!(t && !t.includes(" ") && /^[a-z0-9_.:-]{8,}$/i.test(t));
388
+ }
389
+ function He(e) {
390
+ if (typeof e == "number") return !0;
391
+ const t = W(e).trim().replace(/^\((.*)\)$/, "-$1").replace(/[$,%\s]/g, "").replace(/,/g, "");
392
+ return !!(t && /^-?\d+(\.\d+)?$/.test(t));
393
+ }
394
+ function ke(e) {
395
+ const t = W(e).trim().replace(/^\((.*)\)$/, "-$1").replace(/[$%\s]/g, "");
396
+ return !!(t && /^-?(?:\d{1,3}(?:,\d{3})+|\d+)(?:\.\d+)?$/.test(t));
397
+ }
398
+ function je(e) {
399
+ const t = W(e).trim();
400
+ if (!t.includes(",")) return !1;
401
+ const n = t.split(",").map((i) => i.trim()).filter(Boolean);
402
+ return n.length < 2 || !n.every((i) => /^[a-z0-9_.:/-]+$/i.test(i)) ? !1 : /,\s+/.test(t) ? !0 : ke(t) ? !1 : n.some((i) => !/^\d+$/.test(i));
403
+ }
404
+ function $e(e, t, n) {
405
+ return Array.isArray(e) && (e.find(
406
+ (s) => (s == null ? void 0 : s.columnId) && s.columnId === t
407
+ ) || e[n]) || null;
408
+ }
409
+ function Oe(e, t, n) {
410
+ const i = K(e, t);
411
+ if (typeof i == "boolean")
412
+ return i ? "numeric" : "text";
413
+ const s = n.filter((a) => !Me(a));
414
+ return s.length === 0 || s.some((a) => je(a)) ? "text" : s.filter(He).length / s.length >= 0.8 ? "numeric" : s.filter(ze).length / s.length >= 0.8 ? "boolean" : s.filter(Ee).length / s.length >= 0.7 ? "datetime" : s.filter(_e).length / s.length >= 0.7 ? "id" : "text";
415
+ }
416
+ function oe(e) {
417
+ return W(e == null ? void 0 : e.text).trim().length > 0;
418
+ }
419
+ function Re(e = []) {
420
+ return [
421
+ {
422
+ cells: e.map(
423
+ (t) => T(
424
+ {
425
+ text: t.label,
426
+ colspan: 1,
427
+ rowspan: 1,
428
+ className: "",
429
+ columnId: t.columnId,
430
+ isHeader: !0
431
+ },
432
+ t
433
+ )
434
+ )
435
+ }
436
+ ];
437
+ }
438
+ function Fe(e, t, n) {
439
+ if (!e.headerRows.length || !t.length) return null;
440
+ const i = new Map(
441
+ t.map((r, l) => [r, l])
442
+ ), s = new Map(
443
+ n.map((r) => [r.sourceIndex, r])
444
+ );
445
+ if (!t.every(
446
+ (r) => e.matrix.every((l) => !!l[r])
447
+ )) return null;
448
+ const u = e.rowSources.map((r, l) => ({
449
+ ...r,
450
+ cells: [],
451
+ __rowIndex: l
452
+ }));
453
+ for (const r of e.placements) {
454
+ const l = t.filter(
455
+ (h) => h >= r.startCol && h <= r.endCol
456
+ ).map((h) => i.get(h));
457
+ if (l.length === 0) continue;
458
+ for (let h = 1; h < l.length; h += 1)
459
+ if (l[h] !== l[h - 1] + 1) return null;
460
+ const o = t.filter(
461
+ (h) => h >= r.startCol && h <= r.endCol
462
+ ).map((h) => s.get(h)).filter((h) => !!h), c = r.colspan === 1 && !r.hasChildHeaders && o.length === 1, y = r.colspan > 1 && !r.hasChildHeaders && o.length > 0 && o.every(
463
+ (h) => h.isNumeric === o[0].isNumeric
464
+ ), g = r.cell, m = {
465
+ text: g.text,
466
+ colspan: l.length,
467
+ rowspan: r.rowspan,
468
+ className: g.className,
469
+ columnId: c ? g.columnId : null,
470
+ isHeader: !0,
471
+ measuredWidthPx: null,
472
+ __sortIndex: l[0]
473
+ };
474
+ u[r.rowIndex].cells.push(
475
+ c || y ? T(m, o[0]) : T(m, { isNumeric: !1 })
476
+ );
477
+ }
478
+ return u.map(({ __rowIndex: r, ...l }) => ({
479
+ ...l,
480
+ cells: l.cells.sort((o, c) => o.__sortIndex - c.__sortIndex).map(({ __sortIndex: o, ...c }) => c)
481
+ }));
482
+ }
483
+ function ae(e = {}) {
484
+ return {
485
+ text: W(e.text),
486
+ colspan: 1,
487
+ rowspan: 1,
488
+ className: e.className || "",
489
+ columnId: e.columnId || null,
490
+ isHeader: !!e.isHeader,
491
+ ...typeof e.isNumeric == "boolean" ? { isNumeric: e.isNumeric } : {}
492
+ };
493
+ }
494
+ function ce(e = {}) {
495
+ return String(e.tableType || "").toLowerCase() === "pivot" || e.pivotLevels !== void 0 || e.rowLevels !== void 0;
496
+ }
497
+ function Ge(e) {
498
+ const t = Number(e);
499
+ return Number.isFinite(t) ? Math.max(0, Math.trunc(t)) : 0;
500
+ }
501
+ function De(e, t, n, i) {
502
+ if (!ce(e)) return 0;
503
+ const s = Ge(e.rowLevels);
504
+ if (s > 0) return Math.min(s, i.length);
505
+ const a = t.find(
506
+ (l) => String((l == null ? void 0 : l.type) || "data").toLowerCase() === "data" && Array.isArray(l == null ? void 0 : l.cells)
507
+ );
508
+ if (a) {
509
+ const l = a.cells, o = l.some(
510
+ (d) => !!(d != null && d.isHeader)
511
+ );
512
+ let c = 0;
513
+ for (const d of l) {
514
+ if (!(d != null && d.isHeader)) break;
515
+ c += Math.max(1, Number(d.colspan || 1));
516
+ }
517
+ if (c > 0 || o)
518
+ return Math.min(c, i.length);
519
+ }
520
+ const u = n.placements.filter((l) => l.rowIndex === 0).sort((l, o) => l.startCol - o.startCol);
521
+ let r = 0;
522
+ for (const l of u) {
523
+ if (l.startCol !== r) break;
524
+ const o = /^rowLevel\d+$/i.test(
525
+ String(l.cell.columnId || "")
526
+ ), d = n.headerRows.length > 1 && l.rowspan >= n.headerRows.length && i.slice(l.startCol, l.endCol + 1).every((y) => !(y != null && y.isNumeric));
527
+ if (!o && !d) break;
528
+ r += l.colspan;
529
+ }
530
+ if (r === 0 && u.length > 0) {
531
+ const l = u[0];
532
+ if (l.colspan > 1 && l.rowspan < Math.max(1, n.headerRows.length) && n.leafCells.slice(l.startCol, l.endCol + 1).every((c) => K(c) !== !0))
533
+ return Math.min(l.colspan, i.length);
534
+ }
535
+ return Math.min(r, i.length);
536
+ }
537
+ function Ve(e = {}, t = {}) {
538
+ const n = Array.isArray(e.headers) ? e.headers : [], i = Array.isArray(e.rows) ? e.rows : [], s = e.metadata || {}, a = Le(n), u = Math.max(
539
+ a.leafCells.length,
540
+ Number(s.totalColumns || 0),
541
+ ...i.map((p) => se((p == null ? void 0 : p.cells) || [])),
542
+ e.grandTotal ? se(e.grandTotal.cells || []) : 0
543
+ ), r = Te(i, u), l = r.filter(
544
+ (p, x) => {
545
+ var N;
546
+ return x < 50 || ((N = i[x]) == null ? void 0 : N.type) === "subtotal";
547
+ }
548
+ ), o = Be(
549
+ e.grandTotal,
550
+ u
551
+ ), c = Array.isArray(s.columns) ? s.columns : [], d = Array.from(
552
+ { length: u },
553
+ (p, x) => {
554
+ var te, ne;
555
+ const N = a.leafCells[x] || X(), A = (te = r.find((E) => {
556
+ var B;
557
+ return (B = E[x]) == null ? void 0 : B.columnId;
558
+ })) == null ? void 0 : te[x], I = $e(
559
+ c,
560
+ N.columnId || (A == null ? void 0 : A.columnId),
561
+ x
562
+ ), V = N.columnId || (I == null ? void 0 : I.columnId) || (A == null ? void 0 : A.columnId) || `col_${x + 1}`, k = W(N.text) || W(I == null ? void 0 : I.label) || `Column ${x + 1}`, j = l.map(
563
+ (E) => {
564
+ var B;
565
+ return ((B = E[x]) == null ? void 0 : B.text) ?? "";
566
+ }
567
+ ), v = ((ne = o == null ? void 0 : o[x]) == null ? void 0 : ne.text) ?? "", M = Oe(N, I, [
568
+ ...j,
569
+ v
570
+ ]), z = K(N, I) === !0, $ = F(M).min, de = Number.isFinite(I == null ? void 0 : I.measuredWidthPx) ? Number(I == null ? void 0 : I.measuredWidthPx) : Number.isFinite(N.measuredWidthPx) ? Number(N.measuredWidthPx) : null, ee = Ne({
571
+ type: M,
572
+ label: k,
573
+ sampleValues: z ? r.map((E) => {
574
+ var B;
575
+ return ((B = E[x]) == null ? void 0 : B.text) ?? "";
576
+ }) : j,
577
+ grandTotalValue: v,
578
+ measuredWidthPx: de,
579
+ declaredNumeric: z
580
+ });
581
+ return {
582
+ index: x,
583
+ sourceIndex: x,
584
+ columnId: V,
585
+ label: k,
586
+ type: M,
587
+ minWidthPx: M === "numeric" ? ee : $,
588
+ widthPx: ee,
589
+ isNumeric: M === "numeric",
590
+ declaredNumeric: z
591
+ };
592
+ }
593
+ ), y = ce(s), g = De(
594
+ s,
595
+ i,
596
+ a,
597
+ d
598
+ ), h = t.suppressEmptyColumns !== !1 && String(s.tableType || "").toLowerCase() === "data" && (r.length > 0 || o) ? d.filter((p) => {
599
+ const x = p.sourceIndex;
600
+ return r.some((N) => oe(N[x])) || oe(o == null ? void 0 : o[x]);
601
+ }).map((p) => p.sourceIndex) : d.map((p) => p.sourceIndex);
602
+ h.length === 0 && d.length > 0 && h.push(d[0].sourceIndex);
603
+ const f = new Set(h), S = d.filter((p) => !f.has(p.sourceIndex)).map((p) => ({ columnId: p.columnId, label: p.label })), C = h.map((p, x) => ({
604
+ ...d[p],
605
+ index: x
606
+ })), b = C.map((p) => p.index), P = S.length === 0;
607
+ return {
608
+ columns: C,
609
+ hiddenEmptyColumns: S,
610
+ isPivotTable: y,
611
+ pivotAnchorCount: g,
612
+ project: (p = b, { preserveHeaderHierarchy: x = !0, preserveBodySpans: N = !1 } = {}) => {
613
+ const A = p.map((v) => C[v]).filter(Boolean), I = A.map((v) => v.sourceIndex), V = x ? Fe(a, I, A) : null, k = N && P && A.length === C.length ? ve(i, d) : i.map((v, M) => ({
614
+ ...v,
615
+ cells: A.map(
616
+ (z) => {
617
+ var $;
618
+ return T(
619
+ ae(($ = r[M]) == null ? void 0 : $[z.sourceIndex]),
620
+ z
621
+ );
622
+ }
623
+ )
624
+ })), j = o ? {
625
+ ...e.grandTotal || {},
626
+ cells: A.map(
627
+ (v) => T(
628
+ ae(o[v.sourceIndex]),
629
+ v
630
+ )
631
+ )
632
+ } : null;
633
+ return {
634
+ headers: V || Re(A),
635
+ rows: k,
636
+ grandTotal: j,
637
+ columns: A
638
+ };
639
+ }
640
+ };
641
+ }
642
+ function Y() {
643
+ const e = new Error(
644
+ "Numeric values cannot fit this PDF layout without clipping. Use horizontal pagination, narrow the export or use CSV."
645
+ );
646
+ return e.code = me, e.deliveryBlocking = !0, e;
647
+ }
648
+ const w = 96, le = {
649
+ Letter: { width: 8.5 * w, height: 11 * w },
650
+ Legal: { width: 8.5 * w, height: 14 * w },
651
+ Tabloid: { width: 11 * w, height: 17 * w },
652
+ Ledger: { width: 17 * w, height: 11 * w },
653
+ A0: { width: 841 / 25.4 * w, height: 1189 / 25.4 * w },
654
+ A1: { width: 594 / 25.4 * w, height: 841 / 25.4 * w },
655
+ A2: { width: 420 / 25.4 * w, height: 594 / 25.4 * w },
656
+ A3: { width: 297 / 25.4 * w, height: 420 / 25.4 * w },
657
+ A4: { width: 210 / 25.4 * w, height: 297 / 25.4 * w },
658
+ A5: { width: 148 / 25.4 * w, height: 210 / 25.4 * w },
659
+ A6: { width: 105 / 25.4 * w, height: 148 / 25.4 * w }
660
+ }, q = ["Letter", "Legal", "A3", "Tabloid"], qe = /* @__PURE__ */ new Set([
661
+ "auto",
662
+ "fit",
663
+ "horizontal_paginate"
664
+ ]);
665
+ function Q(e) {
666
+ return String(e || "portrait").toLowerCase() === "landscape" ? "landscape" : "portrait";
667
+ }
668
+ function Ue(e, t) {
669
+ const n = J(e || "Letter"), i = le[n] || le.Letter, s = Q(t);
670
+ return s === "landscape" ? {
671
+ pageSize: n,
672
+ orientation: s,
673
+ width: i.height,
674
+ height: i.width
675
+ } : {
676
+ pageSize: n,
677
+ orientation: s,
678
+ width: i.width,
679
+ height: i.height
680
+ };
681
+ }
682
+ function Xe(e, t) {
683
+ const n = Ue(e, t);
684
+ return Math.max(200, n.width - be() - 8);
685
+ }
686
+ function Ye(e, t) {
687
+ const n = J(e || "Letter"), i = Q(t), s = [], a = (r, l) => {
688
+ s.find(
689
+ (c) => c.pageSize === r && c.orientation === l
690
+ ) || s.push({
691
+ pageSize: r,
692
+ orientation: l,
693
+ printableWidthPx: Xe(r, l)
694
+ });
695
+ };
696
+ a(n, i), a(
697
+ n,
698
+ i === "portrait" ? "landscape" : "portrait"
699
+ );
700
+ const u = Math.max(0, q.indexOf(n));
701
+ for (let r = u; r < q.length; r += 1)
702
+ a(q[r], "landscape");
703
+ return s;
704
+ }
705
+ function ue(e = []) {
706
+ return !Array.isArray(e) || e.length === 0 ? null : e.reduce((t, n) => t ? n.printableWidthPx > t.printableWidthPx ? n : t : n, null);
707
+ }
708
+ function Z(e, t = "widthPx") {
709
+ return e.reduce(
710
+ (n, i) => n + (Number(i == null ? void 0 : i[t]) || 0),
711
+ 0
712
+ );
713
+ }
714
+ function Ze(e, t) {
715
+ const n = Z(e);
716
+ if (n <= t)
717
+ return e.map((u) => u.widthPx);
718
+ const i = Z(e, "minWidthPx");
719
+ if (i >= t)
720
+ return e.map((u) => u.minWidthPx);
721
+ const s = n - t, a = n - i;
722
+ return e.map((u) => {
723
+ const r = Math.max(0, u.widthPx - u.minWidthPx), l = s * (r / a);
724
+ return Math.max(u.minWidthPx, u.widthPx - l);
725
+ });
726
+ }
727
+ function Je(e, t) {
728
+ const n = t * 0.35, i = [];
729
+ let s = 0;
730
+ for (const a of e) {
731
+ if (i.length >= 2) break;
732
+ a.isNumeric || s + a.widthPx > n && i.length > 0 || (i.push(a.index), s += a.widthPx);
733
+ }
734
+ return i.length === 0 && e.length > 0 && i.push(e[0].index), i;
735
+ }
736
+ function Ke(e, t, n = 0) {
737
+ if (e.some(
738
+ (f) => f.declaredNumeric && f.widthPx > t
739
+ ))
740
+ throw Y();
741
+ const i = F("text").min, s = n > 0, a = s ? e.slice(0, n).map((f) => f.index) : [];
742
+ let u = s ? [...a] : Je(e, t);
743
+ const r = (f) => f.reduce((S, C) => {
744
+ var b;
745
+ return S + (((b = e[C]) == null ? void 0 : b.widthPx) || 0);
746
+ }, 0), l = () => e.map((f) => f.index).filter((f) => !(u.includes(f) || s && a.includes(f)));
747
+ let o = l();
748
+ if (o.length > 0) {
749
+ let f = r(u);
750
+ if (s)
751
+ for (; u.length > 1 && t - f < i; )
752
+ u = u.slice(0, -1), f = r(u);
753
+ for (; !s && u.length > 0 && t - f < i; )
754
+ u = u.slice(0, -1), f = r(u);
755
+ o = l();
756
+ }
757
+ const c = r(u), d = Math.max(40, t - c), y = {}, g = [];
758
+ let m = [], h = 0;
759
+ return o.forEach((f) => {
760
+ var b, P;
761
+ const S = ((b = e[f]) == null ? void 0 : b.widthPx) || F("text").min;
762
+ if ((P = e[f]) != null && P.declaredNumeric && S > d)
763
+ throw Y();
764
+ const C = Math.min(S, d);
765
+ if (y[f] = C, m.length > 0 && h + C > d) {
766
+ g.push(m), m = [f], h = C;
767
+ return;
768
+ }
769
+ m.push(f), h += C;
770
+ }), m.length > 0 && g.push(m), g.length === 0 && g.push([]), {
771
+ anchorIndices: u,
772
+ bands: g,
773
+ dynamicWidthByIndex: y
774
+ };
775
+ }
776
+ function Qe(e, t, n) {
777
+ const { columnGroups: i, groupLabels: s, groupLevelLabel: a } = e.metadata ?? {};
778
+ if (!Array.isArray(i) || !Array.isArray(s) || typeof a != "string")
779
+ return null;
780
+ const u = (o) => {
781
+ const c = i[o.sourceIndex];
782
+ return typeof c == "number" ? c : null;
783
+ }, r = he({
784
+ columns: t.map((o) => ({
785
+ widthPx: o.widthPx,
786
+ group: u(o)
787
+ })),
788
+ printableWidthPx: n,
789
+ maxBands: Number.POSITIVE_INFINITY
790
+ });
791
+ if (r.kind === "too_wide") return null;
792
+ const l = t.filter((o) => u(o) === null).map((o) => o.index);
793
+ return r.kind === "fits" ? {
794
+ anchorIndices: l,
795
+ bands: [{ columns: t.map((o) => o.index), caption: null }]
796
+ } : {
797
+ anchorIndices: l,
798
+ bands: r.bands.map((o) => ({
799
+ columns: o.columns,
800
+ caption: fe({
801
+ groupLevelLabel: a,
802
+ groupLabels: s.map(String),
803
+ firstGroup: o.firstGroup,
804
+ lastGroup: o.lastGroup
805
+ })
806
+ }))
807
+ };
808
+ }
809
+ function et(e = [], t = 0) {
810
+ const n = [...new Set(e)].filter((u) => Number.isInteger(u) && u >= 0).sort((u, r) => u - r);
811
+ if (n.length === 0) {
812
+ const u = Math.max(1, Number(t) || 1);
813
+ return `Columns 1-${u} of ${u}`;
814
+ }
815
+ const i = [];
816
+ let s = n[0], a = n[0];
817
+ for (let u = 1; u < n.length; u += 1) {
818
+ const r = n[u];
819
+ if (r === a + 1) {
820
+ a = r;
821
+ continue;
822
+ }
823
+ i.push(
824
+ s === a ? `${s + 1}` : `${s + 1}-${a + 1}`
825
+ ), s = r, a = r;
826
+ }
827
+ return i.push(
828
+ s === a ? `${s + 1}` : `${s + 1}-${a + 1}`
829
+ ), `Columns ${i.join(", ")} of ${Math.max(1, Number(t) || 1)}`;
830
+ }
831
+ function tt(e, t, n = {}) {
832
+ return t.map((i) => {
833
+ const s = e[i], a = Number(n[i]), u = Number.isFinite(a) && a > 0 ? a : s.widthPx;
834
+ return {
835
+ columnId: s.columnId,
836
+ label: s.label,
837
+ widthPx: u,
838
+ isNumeric: s.isNumeric
839
+ };
840
+ });
841
+ }
842
+ function at(e, t = {}) {
843
+ const n = J(t.pageSize || "Letter"), i = Q(
844
+ t.orientation || "portrait"
845
+ ), s = String(t.wideTableStrategy || "auto"), a = qe.has(s) ? s : "auto", u = Ve(e, t), { columns: r, hiddenEmptyColumns: l, isPivotTable: o, pivotAnchorCount: c } = u, d = Z(r, "minWidthPx"), y = Ye(
846
+ n,
847
+ i
848
+ );
849
+ let g = y.find(
850
+ (b) => d <= b.printableWidthPx
851
+ );
852
+ if (a === "fit" && !g && (g = ue(y), r.some(
853
+ (b) => b.declaredNumeric && b.widthPx > g.printableWidthPx
854
+ )))
855
+ throw Y();
856
+ if (g && a !== "horizontal_paginate") {
857
+ const b = Ze(r, g.printableWidthPx), P = r.map((x) => x.index), L = l.length > 0, p = u.project(P, {
858
+ preserveHeaderHierarchy: !L,
859
+ preserveBodySpans: !L
860
+ });
861
+ return {
862
+ sections: [
863
+ {
864
+ headers: p.headers,
865
+ rows: p.rows,
866
+ grandTotal: p.grandTotal,
867
+ bandLabel: null,
868
+ columns: r.map((x, N) => ({
869
+ columnId: x.columnId,
870
+ label: x.label,
871
+ widthPx: b[N],
872
+ isNumeric: x.isNumeric
873
+ }))
874
+ }
875
+ ],
876
+ layoutApplied: {
877
+ requestedPageSize: n,
878
+ requestedOrientation: i,
879
+ effectivePageSize: g.pageSize,
880
+ effectiveOrientation: g.orientation,
881
+ usedBanding: !1,
882
+ bandCount: 1,
883
+ totalColumns: r.length,
884
+ anchorColumns: [],
885
+ autoAdjustedLayout: g.pageSize !== n || g.orientation !== i,
886
+ strategyApplied: "fit",
887
+ hiddenEmptyColumnCount: l.length,
888
+ hiddenEmptyColumns: l.map((x) => x.label)
889
+ }
890
+ };
891
+ }
892
+ const m = g || ue(y), h = Qe(
893
+ e,
894
+ r,
895
+ m.printableWidthPx
896
+ );
897
+ if (h) {
898
+ const b = h.bands.map((P) => {
899
+ const L = u.project(P.columns, {
900
+ preserveHeaderHierarchy: o,
901
+ preserveBodySpans: !1
902
+ });
903
+ return {
904
+ headers: L.headers,
905
+ rows: L.rows,
906
+ grandTotal: L.grandTotal,
907
+ bandLabel: P.caption,
908
+ columns: P.columns.map((p) => ({
909
+ columnId: r[p].columnId,
910
+ label: r[p].label,
911
+ widthPx: r[p].widthPx,
912
+ isNumeric: r[p].isNumeric
913
+ }))
914
+ };
915
+ });
916
+ return {
917
+ sections: b,
918
+ layoutApplied: {
919
+ requestedPageSize: n,
920
+ requestedOrientation: i,
921
+ effectivePageSize: m.pageSize,
922
+ effectiveOrientation: m.orientation,
923
+ usedBanding: b.length > 1,
924
+ bandCount: b.length,
925
+ totalColumns: r.length,
926
+ anchorColumns: h.anchorIndices.map(
927
+ (P) => r[P].label
928
+ ),
929
+ autoAdjustedLayout: m.pageSize !== n || m.orientation !== i,
930
+ strategyApplied: "horizontal_paginate",
931
+ hiddenEmptyColumnCount: l.length,
932
+ hiddenEmptyColumns: l.map((P) => P.label)
933
+ }
934
+ };
935
+ }
936
+ const f = Ke(
937
+ r,
938
+ m.printableWidthPx,
939
+ c
940
+ ), S = f.anchorIndices.map((b) => {
941
+ var P;
942
+ return (P = r[b]) == null ? void 0 : P.label;
943
+ }).filter(Boolean), C = f.bands.map((b) => {
944
+ const P = [...f.anchorIndices, ...b], L = tt(
945
+ r,
946
+ P,
947
+ f.dynamicWidthByIndex
948
+ ), p = u.project(P, {
949
+ preserveHeaderHierarchy: o,
950
+ preserveBodySpans: !1
951
+ }), x = et(
952
+ P,
953
+ r.length
954
+ );
955
+ return {
956
+ headers: p.headers,
957
+ rows: p.rows,
958
+ grandTotal: p.grandTotal,
959
+ bandLabel: x,
960
+ columns: L
961
+ };
962
+ });
963
+ return {
964
+ sections: C,
965
+ layoutApplied: {
966
+ requestedPageSize: n,
967
+ requestedOrientation: i,
968
+ effectivePageSize: m.pageSize,
969
+ effectiveOrientation: m.orientation,
970
+ usedBanding: !0,
971
+ bandCount: C.length,
972
+ totalColumns: r.length,
973
+ anchorColumns: S,
974
+ autoAdjustedLayout: m.pageSize !== n || m.orientation !== i,
975
+ strategyApplied: "horizontal_paginate",
976
+ hiddenEmptyColumnCount: l.length,
977
+ hiddenEmptyColumns: l.map((b) => b.label)
978
+ }
979
+ };
980
+ }
981
+ export {
982
+ R as TABLE_PAGE_GEOMETRY,
983
+ Ve as buildPdfTableModel,
984
+ at as buildWideTableLayout,
985
+ fe as columnBandCaption,
986
+ Ne as estimateColumnWidthPx,
987
+ F as getColumnWidthBounds,
988
+ be as getTableHorizontalInsetPx,
989
+ st as getTablePdfMargins,
990
+ ot as getTablePrintBodyPaddingCss,
991
+ J as normalizePageSize,
992
+ he as planColumnBands
993
+ };