@bino-bi/bn-template-engine 1.0.0-alpha.8 → 1.0.0-next.19
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.
- package/LICENSE +203 -21
- package/dist/bn-template-engine/bn-template-engine.esm.js +1 -1
- package/dist/bn-template-engine/p-19bbac66.entry.js +1 -0
- package/dist/bn-template-engine/p-209351c9.entry.js +1 -0
- package/dist/bn-template-engine/p-22d0fb7a.entry.js +1 -0
- package/dist/bn-template-engine/p-2e6dc267.entry.js +1 -0
- package/dist/bn-template-engine/p-485d23d7.entry.js +1 -0
- package/dist/bn-template-engine/p-74c5a95d.entry.js +1 -0
- package/dist/bn-template-engine/p-7bdc0e28.entry.js +1 -0
- package/dist/bn-template-engine/p-83c71b16.entry.js +1 -0
- package/dist/bn-template-engine/p-90806e7a.entry.js +1 -0
- package/dist/bn-template-engine/p-9879c9b2.entry.js +1 -0
- package/dist/bn-template-engine/p-BA48JiHe.js +1 -0
- package/dist/bn-template-engine/p-BWKdb9ym.js +1 -0
- package/dist/bn-template-engine/p-BZV1b5VH.js +1 -0
- package/dist/bn-template-engine/p-Bdfxd_Ke.js +1 -0
- package/dist/bn-template-engine/p-BjBz5cSL.js +1 -0
- package/dist/bn-template-engine/p-BqhIhYr1.js +1 -0
- package/dist/bn-template-engine/p-C0Pwqx-O.js +1 -0
- package/dist/bn-template-engine/p-CiudZRQr.js +1 -0
- package/dist/bn-template-engine/p-DTuaq8Pj.js +1 -0
- package/dist/bn-template-engine/p-DY7YYmpa.js +1 -0
- package/dist/bn-template-engine/p-Dg9OcXAO.js +1 -0
- package/dist/bn-template-engine/p-DsTzlzxQ.js +1 -0
- package/dist/bn-template-engine/p-X6CxL6W-.js +1 -0
- package/dist/bn-template-engine/p-a8291de2.entry.js +1 -0
- package/dist/bn-template-engine/p-aakBGfzL.js +1 -0
- package/dist/bn-template-engine/p-b25455a7.entry.js +1 -0
- package/dist/bn-template-engine/p-e96da91f.entry.js +1 -0
- package/dist/bn-template-engine/p-eca8e2e2.entry.js +1 -0
- package/dist/bn-template-engine/p-f9dfd120.entry.js +1 -0
- package/dist/bn-template-engine/p-rdqTC0_5.js +1 -0
- package/dist/cjs/AxisConfig-VnVelfSV.js +233 -0
- package/dist/cjs/LabelCollisionManager-nfD5P__k.js +412 -0
- package/dist/cjs/NumericScale-BAyYXpKL.js +107 -0
- package/dist/cjs/Order-DobBozQC.js +87 -0
- package/dist/cjs/SVGStyle-BQOmGWLX.js +8209 -0
- package/dist/cjs/SVGVariancesStyleGroup-DCGfHrqh.js +50 -0
- package/dist/cjs/VarianceMeasure-NY9yhiNV.js +372 -0
- package/dist/cjs/XYChartDataRow-B7OKrAcC.js +829 -0
- package/dist/cjs/bn-asset_21.cjs.entry.js +16047 -0
- package/dist/cjs/bn-chart-bubble.cjs.entry.js +762 -0
- package/dist/cjs/bn-chart-bullet.cjs.entry.js +785 -0
- package/dist/cjs/bn-chart-scatter.cjs.entry.js +658 -0
- package/dist/cjs/bn-grid.cjs.entry.js +5 -3
- package/dist/cjs/bn-image.cjs.entry.js +5 -3
- package/dist/cjs/bn-internationalization.cjs.entry.js +10 -8
- package/dist/cjs/bn-ruleset.cjs.entry.js +41 -0
- package/dist/cjs/bn-template-engine.cjs.js +1 -1
- package/dist/cjs/bn-template.cjs.entry.js +1 -1
- package/dist/cjs/bn-text.cjs.entry.js +8 -79
- package/dist/cjs/bn-tree.cjs.entry.js +9 -3
- package/dist/cjs/context-protocol-BDrMkhc4.js +9499 -0
- package/dist/cjs/editor-companion.cjs.entry.js +13 -6
- package/dist/cjs/ibcs-chart-bubble.cjs.entry.js +624 -0
- package/dist/cjs/ibcs-chart-bullet.cjs.entry.js +673 -0
- package/dist/cjs/ibcs-chart-scatter.cjs.entry.js +667 -0
- package/dist/cjs/layoutObserver-o03YUfn_.js +199 -0
- package/dist/cjs/loader.cjs.js +1 -1
- package/dist/cjs/sanitizeHtml-LuZr1IMd.js +85 -0
- package/dist/cjs/scaling-DKZyjWj5.js +587 -0
- package/dist/cjs/{withBodyObserver-D7BKWN2N.js → withBodyObserver-BKUE_ypL.js} +12 -7
- package/dist/cjs/withScalingGroup-BmcRlWBs.js +73 -0
- package/dist/cjs/withStyled-CRiC9fzc.js +1137 -0
- package/dist/collection/collection-manifest.json +9 -1
- package/dist/collection/components/bn-body/bn-body.css +1 -0
- package/dist/collection/components/bn-card/bn-card.css +2 -0
- package/dist/collection/components/bn-chart-bubble/bn-chart-bubble.css +10 -0
- package/dist/collection/components/bn-chart-bubble/bn-chart-bubble.js +1110 -0
- package/dist/collection/components/bn-chart-bubble/ibcs-chart-bubble.css +9 -0
- package/dist/collection/components/bn-chart-bubble/ibcs-chart-bubble.js +653 -0
- package/dist/collection/components/bn-chart-bubble/utils/BubbleChart.js +472 -0
- package/dist/collection/components/bn-chart-bullet/bn-chart-bullet.css +10 -0
- package/dist/collection/components/bn-chart-bullet/bn-chart-bullet.js +1014 -0
- package/dist/collection/components/bn-chart-bullet/ibcs-chart-bullet.css +9 -0
- package/dist/collection/components/bn-chart-bullet/ibcs-chart-bullet.js +538 -0
- package/dist/collection/components/bn-chart-bullet/utils/BulletChart.js +440 -0
- package/dist/collection/components/bn-chart-bullet/utils/model/BulletChartStyle.js +132 -0
- package/dist/collection/components/bn-chart-bullet/utils/model/BulletConfig.js +89 -0
- package/dist/collection/components/bn-chart-bullet/utils/model/index.js +2 -0
- package/dist/collection/components/bn-chart-scatter/bn-chart-scatter.css +10 -0
- package/dist/collection/components/bn-chart-scatter/bn-chart-scatter.js +965 -0
- package/dist/collection/components/bn-chart-scatter/ibcs-chart-scatter.css +9 -0
- package/dist/collection/components/bn-chart-scatter/ibcs-chart-scatter.js +580 -0
- package/dist/collection/components/bn-chart-scatter/utils/ScatterChart.js +409 -0
- package/dist/collection/components/bn-chart-structure/bn-chart-structure.js +127 -41
- package/dist/collection/components/bn-chart-structure/ibcs-chart-structure.js +103 -36
- package/dist/collection/components/bn-chart-structure/utils/StructureChart.js +82 -58
- package/dist/collection/components/bn-chart-structure/utils/helper/ElementPositions.js +46 -4
- package/dist/collection/components/bn-chart-structure/utils/model/StructureChartComponentConfig.js +5 -4
- package/dist/collection/components/bn-chart-time/bn-chart-time.css +1 -1
- package/dist/collection/components/bn-chart-time/bn-chart-time.js +162 -42
- package/dist/collection/components/bn-chart-time/ibcs-chart-time.js +94 -31
- package/dist/collection/components/bn-chart-time/utils/TimeChart.js +132 -74
- package/dist/collection/components/bn-chart-time/utils/elements/StackedColumn.js +3 -3
- package/dist/collection/components/bn-chart-time/utils/model/TimeChartComponentConfig.js +5 -4
- package/dist/collection/components/bn-chart-time/utils/model/TimeChartDataRow.js +2 -0
- package/dist/collection/components/bn-component-style/bn-component-style.js +1 -1
- package/dist/collection/components/bn-context/bn-context.js +1 -1
- package/dist/collection/components/bn-dataset/bn-dataset.js +226 -23
- package/dist/collection/components/bn-datasource/bn-datasource.js +163 -12
- package/dist/collection/components/bn-footer/bn-footer.js +1 -1
- package/dist/collection/components/bn-grid/bn-grid.js +1 -1
- package/dist/collection/components/bn-image/bn-image.js +1 -1
- package/dist/collection/components/bn-internationalization/bn-internationalization.js +10 -7
- package/dist/collection/components/bn-layout-card/bn-layout-card.css +8 -3
- package/dist/collection/components/bn-layout-card/bn-layout-card.js +98 -35
- package/dist/collection/components/bn-layout-page/bn-layout-page.css +5 -3
- package/dist/collection/components/bn-layout-page/bn-layout-page.js +98 -25
- package/dist/collection/components/bn-message/bn-message.css +6 -2
- package/dist/collection/components/bn-message/bn-message.js +3 -2
- package/dist/collection/components/bn-page/bn-page.js +1 -1
- package/dist/collection/components/bn-ruleset/bn-ruleset.css +3 -0
- package/dist/collection/components/bn-ruleset/bn-ruleset.js +68 -0
- package/dist/collection/components/bn-scaling-group/bn-scaling-group.css +3 -0
- package/dist/collection/components/bn-scaling-group/bn-scaling-group.js +136 -0
- package/dist/collection/components/bn-table/bn-table.js +317 -61
- package/dist/collection/components/bn-table/ibcs-table.css +8 -0
- package/dist/collection/components/bn-table/ibcs-table.js +161 -32
- package/dist/collection/components/bn-table/utils/Table.js +72 -28
- package/dist/collection/components/bn-table/utils/elements/CellBarChart.js +13 -8
- package/dist/collection/components/bn-table/utils/elements/TableRow.js +3 -2
- package/dist/collection/components/bn-table/utils/elements/WaterfallBar.js +47 -0
- package/dist/collection/components/bn-table/utils/elements/index.js +1 -0
- package/dist/collection/components/bn-table/utils/factories/tableDataSetFactory.js +117 -22
- package/dist/collection/components/bn-table/utils/helper/DataQuery.js +380 -50
- package/dist/collection/components/bn-table/utils/helper/IntervalColumns.js +140 -0
- package/dist/collection/components/bn-table/utils/helper/QueryGroup.js +4 -9
- package/dist/collection/components/bn-table/utils/helper/WaterfallCalculator.js +166 -0
- package/dist/collection/components/bn-table/utils/helper/index.js +2 -0
- package/dist/collection/components/bn-table/utils/model/TableAttribute.js +46 -0
- package/dist/collection/components/bn-table/utils/model/TableComponentConfig.js +20 -4
- package/dist/collection/components/bn-template/bn-template.js +1 -1
- package/dist/collection/components/bn-text/bn-text.js +2 -75
- package/dist/collection/components/bn-title/bn-title.js +27 -3
- package/dist/collection/components/bn-title/ibcs-title/ibcs-title.css +4 -0
- package/dist/collection/components/bn-title/ibcs-title/ibcs-title.js +29 -6
- package/dist/collection/components/bn-title/ibcs-title/utils/Title.js +3 -0
- package/dist/collection/components/bn-tree/bn-tree.js +5 -1
- package/dist/collection/components/editor-companion/editor-companion.js +12 -5
- package/dist/collection/context/scopedDb.js +127 -0
- package/dist/collection/stores/componentStyles.js +67 -0
- package/dist/collection/stores/createScopedStores.js +11 -5
- package/dist/collection/stores/internationalization.js +68 -0
- package/dist/collection/stores/ruleSets.js +46 -0
- package/dist/collection/utils/constants.js +5 -0
- package/dist/collection/utils/dataAnalyzer.js +14 -8
- package/dist/collection/utils/ibcsRuleSet.js +14 -26
- package/dist/collection/utils/layoutObserver.js +88 -0
- package/dist/collection/utils/parentDimensions.js +71 -15
- package/dist/collection/utils/sanitizeHtml.js +81 -0
- package/dist/collection/utils/validate.js +47 -0
- package/dist/collection/utils/withBodyObserver.js +12 -7
- package/dist/collection/utils/withComponentStyle.js +3 -5
- package/dist/collection/utils/withDataset.js +43 -39
- package/dist/collection/utils/withDatasource.js +28 -18
- package/dist/collection/utils/withInheritedProps.js +26 -1
- package/dist/collection/utils/withRuleSet.js +105 -0
- package/dist/collection/utils/withScalingGroup.js +69 -0
- package/dist/collection/utils/withTranslation.js +50 -14
- package/dist/collection/utils/xy/FacetGrid.js +36 -0
- package/dist/collection/utils/xy/IsoCurves.js +156 -0
- package/dist/collection/utils/xy/NumericScale.js +103 -0
- package/dist/collection/utils/xy/PointLabeler.js +96 -0
- package/dist/collection/utils/xy/RadiusScale.js +42 -0
- package/dist/collection/utils/xy/SeriesPalette.js +80 -0
- package/dist/collection/utils/xy/VarianceMeasure.js +76 -0
- package/dist/collection/utils/xy/XYFrame.js +120 -0
- package/dist/collection/utils/xy/XYLegend.js +107 -0
- package/dist/collection/utils/xy/model/AxisConfig.js +221 -0
- package/dist/collection/utils/xy/model/ScaleFactorsXYChart.js +69 -0
- package/dist/collection/utils/xy/model/XYChartDataRow.js +0 -0
- package/dist/collection/utils/xy/model/XYChartStyle.js +52 -0
- package/dist/components/AxisConfig.js +1 -0
- package/dist/components/CompareUtil.js +1 -0
- package/dist/components/DataFormatDigits.js +1 -1
- package/dist/components/DateStringFactory.js +1 -1
- package/dist/components/LabelCollisionManager.js +1 -0
- package/dist/components/NumericScale.js +1 -0
- package/dist/components/Order.js +1 -1
- package/dist/components/SVGVariancesStyleGroup.js +1 -1
- package/dist/components/SiPrefix.js +1 -0
- package/dist/components/StringAdapter.js +1 -0
- package/dist/components/VarianceMeasure.js +1 -0
- package/dist/components/XYChartDataRow.js +1 -0
- package/dist/components/bn-body2.js +1 -1
- package/dist/components/bn-card2.js +1 -1
- package/dist/components/bn-chart-bubble.d.ts +11 -0
- package/dist/components/bn-chart-bubble.js +1 -0
- package/dist/components/bn-chart-bullet.d.ts +11 -0
- package/dist/components/bn-chart-bullet.js +1 -0
- package/dist/components/bn-chart-scatter.d.ts +11 -0
- package/dist/components/bn-chart-scatter.js +1 -0
- package/dist/components/bn-chart-structure.js +1 -1
- package/dist/components/bn-chart-time.js +1 -1
- package/dist/components/bn-component-style.js +1 -1
- package/dist/components/bn-context.js +1 -1
- package/dist/components/bn-dataset.js +1 -1
- package/dist/components/bn-datasource.js +1 -1
- package/dist/components/bn-footer2.js +1 -1
- package/dist/components/bn-grid.js +1 -1
- package/dist/components/bn-image.js +1 -1
- package/dist/components/bn-internationalization.js +1 -1
- package/dist/components/bn-layout-card.js +1 -1
- package/dist/components/bn-layout-page.js +1 -1
- package/dist/components/bn-message2.js +1 -1
- package/dist/components/bn-page2.js +1 -1
- package/dist/components/bn-ruleset.d.ts +11 -0
- package/dist/components/bn-ruleset.js +1 -0
- package/dist/components/bn-scaling-group.d.ts +11 -0
- package/dist/components/bn-scaling-group.js +1 -0
- package/dist/components/bn-table.js +1 -1
- package/dist/components/bn-template.js +1 -1
- package/dist/components/bn-text.js +1 -1
- package/dist/components/bn-title2.js +1 -1
- package/dist/components/bn-tree.js +1 -1
- package/dist/components/context-protocol.js +1 -1
- package/dist/components/editor-companion.js +1 -1
- package/dist/components/formatter.js +1 -0
- package/dist/components/ibcs-chart-bubble.d.ts +11 -0
- package/dist/components/ibcs-chart-bubble.js +1 -0
- package/dist/components/ibcs-chart-bubble2.js +1 -0
- package/dist/components/ibcs-chart-bullet.d.ts +11 -0
- package/dist/components/ibcs-chart-bullet.js +1 -0
- package/dist/components/ibcs-chart-bullet2.js +1 -0
- package/dist/components/ibcs-chart-scatter.d.ts +11 -0
- package/dist/components/ibcs-chart-scatter.js +1 -0
- package/dist/components/ibcs-chart-scatter2.js +1 -0
- package/dist/components/ibcs-chart-structure2.js +1 -1
- package/dist/components/ibcs-chart-time2.js +1 -1
- package/dist/components/ibcs-table2.js +1 -1
- package/dist/components/ibcs-title2.js +1 -1
- package/dist/components/layoutObserver.js +1 -0
- package/dist/components/luxon.js +1 -0
- package/dist/components/main.js +1 -0
- package/dist/components/merge.js +1 -0
- package/dist/components/sanitizeHtml.js +1 -0
- package/dist/components/stackColors.js +1 -0
- package/dist/components/validate.js +1 -1
- package/dist/components/withBodyObserver.js +1 -1
- package/dist/components/withComponentStyle.js +1 -1
- package/dist/components/withDataset.js +1 -0
- package/dist/components/withRuleSet.js +1 -0
- package/dist/components/withScalingGroup.js +1 -0
- package/dist/components/withStyled.js +1 -1
- package/dist/components/withTranslation.js +1 -1
- package/dist/esm/AxisConfig-C_zWCKlL.js +224 -0
- package/dist/esm/LabelCollisionManager-8swVQHKA.js +404 -0
- package/dist/esm/NumericScale-DsTzlzxQ.js +105 -0
- package/dist/esm/Order-BPeWfygb.js +83 -0
- package/dist/esm/SVGStyle-BxEDw9zh.js +8199 -0
- package/dist/esm/SVGVariancesStyleGroup-DRQYvSDD.js +48 -0
- package/dist/esm/VarianceMeasure-DnwNKspZ.js +364 -0
- package/dist/esm/XYChartDataRow-DeV4r-Wm.js +820 -0
- package/dist/esm/bn-asset_21.entry.js +16025 -0
- package/dist/esm/bn-chart-bubble.entry.js +760 -0
- package/dist/esm/bn-chart-bullet.entry.js +783 -0
- package/dist/esm/bn-chart-scatter.entry.js +656 -0
- package/dist/esm/bn-grid.entry.js +5 -3
- package/dist/esm/bn-image.entry.js +5 -3
- package/dist/esm/bn-internationalization.entry.js +10 -8
- package/dist/esm/bn-ruleset.entry.js +39 -0
- package/dist/esm/bn-template-engine.js +1 -1
- package/dist/esm/bn-template.entry.js +1 -1
- package/dist/esm/bn-text.entry.js +7 -78
- package/dist/esm/bn-tree.entry.js +9 -3
- package/dist/esm/context-protocol-1Yj1uKvh.js +9484 -0
- package/dist/esm/editor-companion.entry.js +13 -6
- package/dist/esm/ibcs-chart-bubble.entry.js +622 -0
- package/dist/esm/ibcs-chart-bullet.entry.js +671 -0
- package/dist/esm/ibcs-chart-scatter.entry.js +665 -0
- package/dist/esm/layoutObserver-BG5dOBYH.js +196 -0
- package/dist/esm/loader.js +1 -1
- package/dist/esm/sanitizeHtml-BA48JiHe.js +83 -0
- package/dist/esm/scaling-CeSRcRl1.js +579 -0
- package/dist/esm/{withBodyObserver-AFk2wwHT.js → withBodyObserver-IokS6fHD.js} +12 -7
- package/dist/esm/withScalingGroup-Br70pAv9.js +71 -0
- package/dist/esm/withStyled-Br2DGTPs.js +1104 -0
- package/dist/types/components/bn-chart-bubble/bn-chart-bubble.d.ts +193 -0
- package/dist/types/components/bn-chart-bubble/ibcs-chart-bubble.d.ts +58 -0
- package/dist/types/components/bn-chart-bubble/utils/BubbleChart.d.ts +91 -0
- package/dist/types/components/bn-chart-bullet/bn-chart-bullet.d.ts +172 -0
- package/dist/types/components/bn-chart-bullet/ibcs-chart-bullet.d.ts +52 -0
- package/dist/types/components/bn-chart-bullet/utils/BulletChart.d.ts +91 -0
- package/dist/types/components/bn-chart-bullet/utils/model/BulletChartStyle.d.ts +70 -0
- package/dist/types/components/bn-chart-bullet/utils/model/BulletConfig.d.ts +43 -0
- package/dist/types/components/bn-chart-bullet/utils/model/index.d.ts +2 -0
- package/dist/types/components/bn-chart-scatter/bn-chart-scatter.d.ts +172 -0
- package/dist/types/components/bn-chart-scatter/ibcs-chart-scatter.d.ts +53 -0
- package/dist/types/components/bn-chart-scatter/utils/ScatterChart.d.ts +66 -0
- package/dist/types/components/bn-chart-structure/bn-chart-structure.d.ts +19 -5
- package/dist/types/components/bn-chart-structure/ibcs-chart-structure.d.ts +13 -6
- package/dist/types/components/bn-chart-structure/utils/StructureChart.d.ts +16 -12
- package/dist/types/components/bn-chart-structure/utils/helper/ElementPositions.d.ts +16 -1
- package/dist/types/components/bn-chart-structure/utils/model/StructureChartComponentConfig.d.ts +5 -3
- package/dist/types/components/bn-chart-time/bn-chart-time.d.ts +53 -13
- package/dist/types/components/bn-chart-time/ibcs-chart-time.d.ts +13 -6
- package/dist/types/components/bn-chart-time/utils/TimeChart.d.ts +16 -12
- package/dist/types/components/bn-chart-time/utils/model/TimeChartComponentConfig.d.ts +5 -3
- package/dist/types/components/bn-dataset/bn-dataset.d.ts +47 -5
- package/dist/types/components/bn-datasource/bn-datasource.d.ts +53 -6
- package/dist/types/components/bn-layout-card/bn-layout-card.d.ts +35 -8
- package/dist/types/components/bn-layout-page/bn-layout-page.d.ts +32 -1
- package/dist/types/components/bn-message/bn-message.d.ts +5 -2
- package/dist/types/components/bn-ruleset/bn-ruleset.d.ts +8 -0
- package/dist/types/components/bn-scaling-group/bn-scaling-group.d.ts +37 -0
- package/dist/types/components/bn-table/bn-table.d.ts +74 -12
- package/dist/types/components/bn-table/ibcs-table.d.ts +27 -4
- package/dist/types/components/bn-table/utils/Table.d.ts +16 -6
- package/dist/types/components/bn-table/utils/elements/Cell.d.ts +2 -0
- package/dist/types/components/bn-table/utils/elements/CellBarChart.d.ts +33 -0
- package/dist/types/components/bn-table/utils/elements/TableRow.d.ts +2 -1
- package/dist/types/components/bn-table/utils/elements/WaterfallBar.d.ts +21 -0
- package/dist/types/components/bn-table/utils/elements/index.d.ts +1 -0
- package/dist/types/components/bn-table/utils/factories/tableDataSetFactory.d.ts +17 -9
- package/dist/types/components/bn-table/utils/helper/DataQuery.d.ts +35 -3
- package/dist/types/components/bn-table/utils/helper/IntervalColumns.d.ts +37 -0
- package/dist/types/components/bn-table/utils/helper/QueryGroup.d.ts +4 -5
- package/dist/types/components/bn-table/utils/helper/WaterfallCalculator.d.ts +55 -0
- package/dist/types/components/bn-table/utils/helper/index.d.ts +2 -0
- package/dist/types/components/bn-table/utils/model/TableAttribute.d.ts +22 -0
- package/dist/types/components/bn-table/utils/model/TableComponentConfig.d.ts +12 -3
- package/dist/types/components/bn-table/utils/model/index.d.ts +21 -0
- package/dist/types/components/bn-title/bn-title.d.ts +11 -1
- package/dist/types/components/bn-title/ibcs-title/ibcs-title.d.ts +2 -0
- package/dist/types/components/bn-title/ibcs-title/utils/Title.d.ts +1 -0
- package/dist/types/components/editor-companion/editor-companion.d.ts +2 -0
- package/dist/types/components.d.ts +1691 -120
- package/dist/types/context/context-protocol.d.ts +7 -3
- package/dist/types/context/scopedDb.d.ts +37 -0
- package/dist/types/stores/componentStyles.d.ts +41 -0
- package/dist/types/stores/createScopedStores.d.ts +4 -2
- package/dist/types/stores/ruleSets.d.ts +40 -0
- package/dist/types/utils/DateStringFactory.d.ts +1 -1
- package/dist/types/utils/constants.d.ts +5 -0
- package/dist/types/utils/dataAnalyzer.d.ts +2 -1
- package/dist/types/utils/ibcsRuleSet.d.ts +6 -1
- package/dist/types/utils/layoutObserver.d.ts +27 -0
- package/dist/types/utils/model/ChartStyles.d.ts +2 -1
- package/dist/types/utils/parentDimensions.d.ts +1 -1
- package/dist/types/utils/sanitizeHtml.d.ts +6 -0
- package/dist/types/utils/validate.d.ts +18 -0
- package/dist/types/utils/withDataset.d.ts +6 -2
- package/dist/types/utils/withDatasource.d.ts +3 -3
- package/dist/types/utils/withInheritedProps.d.ts +19 -0
- package/dist/types/utils/withRuleSet.d.ts +24 -0
- package/dist/types/utils/withScalingGroup.d.ts +14 -0
- package/dist/types/utils/withTranslation.d.ts +12 -4
- package/dist/types/utils/xy/FacetGrid.d.ts +27 -0
- package/dist/types/utils/xy/IsoCurves.d.ts +46 -0
- package/dist/types/utils/xy/NumericScale.d.ts +41 -0
- package/dist/types/utils/xy/PointLabeler.d.ts +58 -0
- package/dist/types/utils/xy/RadiusScale.d.ts +26 -0
- package/dist/types/utils/xy/SeriesPalette.d.ts +59 -0
- package/dist/types/utils/xy/VarianceMeasure.d.ts +37 -0
- package/dist/types/utils/xy/XYFrame.d.ts +44 -0
- package/dist/types/utils/xy/XYLegend.d.ts +43 -0
- package/dist/types/utils/xy/model/AxisConfig.d.ts +96 -0
- package/dist/types/utils/xy/model/ScaleFactorsXYChart.d.ts +36 -0
- package/dist/types/utils/xy/model/XYChartDataRow.d.ts +157 -0
- package/dist/types/utils/xy/model/XYChartStyle.d.ts +31 -0
- package/package.json +5 -4
- package/readme.md +9 -5
- package/dist/bn-template-engine/p-0d41c5d8.entry.js +0 -1
- package/dist/bn-template-engine/p-67538176.entry.js +0 -1
- package/dist/bn-template-engine/p-825a07a8.entry.js +0 -1
- package/dist/bn-template-engine/p-916296a5.entry.js +0 -1
- package/dist/bn-template-engine/p-96006b06.entry.js +0 -1
- package/dist/bn-template-engine/p-Ck-NYtot.js +0 -1
- package/dist/bn-template-engine/p-CnDq0oVa.js +0 -1
- package/dist/bn-template-engine/p-DSXNgKLa.js +0 -1
- package/dist/bn-template-engine/p-bc711fb0.entry.js +0 -1
- package/dist/bn-template-engine/p-e6f646b1.entry.js +0 -1
- package/dist/bn-template-engine/p-f41d9242.entry.js +0 -1
- package/dist/bn-template-engine/p-gFbbuhtl.js +0 -1
- package/dist/cjs/bn-asset_20.cjs.entry.js +0 -23541
- package/dist/cjs/context-protocol-ohYzcb5F.js +0 -663
- package/dist/cjs/scaling-CIAClQR5.js +0 -314
- package/dist/cjs/withStyled-qd94SSb4.js +0 -9535
- package/dist/collection/stores/datasets.js +0 -14
- package/dist/collection/stores/datasources.js +0 -14
- package/dist/components/_commonjsHelpers.js +0 -1
- package/dist/components/alasql.min.js +0 -1
- package/dist/components/ibcsRuleSet.js +0 -1
- package/dist/components/scaling.js +0 -1
- package/dist/components/withInheritedProps.js +0 -1
- package/dist/esm/bn-asset_20.entry.js +0 -23520
- package/dist/esm/context-protocol-DdbSplvE.js +0 -656
- package/dist/esm/scaling-DGKKkuL9.js +0 -309
- package/dist/esm/withStyled-BIkqU2w4.js +0 -9501
- package/dist/types/stores/datasets.d.ts +0 -14
- package/dist/types/stores/datasources.d.ts +0 -14
|
@@ -1 +1 @@
|
|
|
1
|
-
import{h as t,proxyCustomElement as e,HTMLElement as o,Host as s,transformTag as n}from"@stencil/core/internal/client";import{F as r,Q as i,V as a,I as l,S as c}from"./ibcsRuleSet.js";import{I as h,D as u,j as d,k as f,l as p,e as m,M as $}from"./Order.js";import{a as v}from"./alasql.min.js";import{D as g,S as R,a as w,b}from"./DataFormatDigits.js";import{w as S}from"./withComponentStyle.js";var E,O,y,M,U;!function(t){t[t.ALL=-1]="ALL"}(E||(E={})),function(t){t[t.UP_TO_DATE=0]="UP_TO_DATE",t[t.DIRTY=1]="DIRTY"}(O||(O={})),function(t){t.LIST="list",t.SUM="sum",t.SUMNOTOTAL="sumnototal",t.OPT="opt",t.OPTNOTOTAL="optnototal"}(y||(y={})),function(t){t.ASC="asc",t.DESC="desc"}(M||(M={})),function(t){t.HEADER="HEADER",t.GROUPHEAD="GROUPHEAD",t.SEPERATORLINE="SEPERATORLINE",t.SUM="SUM",t.GROUPSUM="GROUP_SUM",t.DRILLELEMENT="DRILLELEMENT",t.STANDARD="STANDARD",t.PARTELEMENT="PARTELEMENT",t.ENTRY="ENTRY"}(U||(U={}));class G{constructor(t,e,o,s,n,r,i,a,l){this.prefixStyle="prefix",this.isBarChart=!1,this.key=t,this.index=e,this.value=o,this.prefix=r||"",this.cssStyle=s||"",this.prefixStyle=i||"prefix",this.type=n,this.mark=void 0,this.colSpan=a||1,this.measureScale=l||1}getAsHeaderList(){if(null==this.value)return[""];const t=[];for(const e of this.value.toString().split("<br/>"))t.push(e);return t}draw(t){let e=this.value;if("undefined"===e||void 0===e||null==e)return"";if(Number.isNaN(Number(e)))return e;if(""===this.type||void 0===this.type||null==this.type)return e;let o=t.percent,s=t.percent;return"decimal"===this.type&&(e=+e/this.measureScale,o=t.decimal,s=t.decimal),r.number(Number(e),this.type,o,s)}drawPrefix(){return null==this.prefix?"":this.prefix}}class T{constructor(t,e,o){this.index=t,this.groupindex=e,this.type=o,this.cssStyle=this.initCssStyle(),this.elements=[]}initCssStyle(){switch(this.type){case U.HEADER:return"groupheader";case U.SEPERATORLINE:return"";case U.DRILLELEMENT:return"ofit";case U.PARTELEMENT:return"partof";case U.STANDARD:return"";case U.SUM:return"sum";default:return""}}getCells(){return this.elements}createElement(t,e,o,s,n,r,i,a,l,c=!1,h){let u=r;"category"===e&&null!=a&&(u=`category-${a.toString()}`),this.type===U.HEADER?u="headerlabel":this.type===U.SEPERATORLINE&&(u=e),this.type===U.PARTELEMENT&&("percent"===s&&(t="-"),"category"!==e&&"operation"!==e&&(s="percent",u="")),"-"===t&&(u="");let d="prefix-first";i&&(d="prefix-second"),o&&(u=`${u} ${o}`);const f=new G(e,this.elements.length,t,u,s,n,d,1,l);f.isBarChart=c,f.columnStats=h,this.elements.push(f)}}const _={positive:{stroke:"#008f96",fill:"#008f96",fillpattern:"solid"},negative:{stroke:"#ff0000",fill:"#ff0000",fillpattern:"solid"},neutral:{stroke:"#808080",fill:"#808080",fillpattern:"outlined"},scenarios:{ac:{stroke:"#404040",fill:"#404040",fillpattern:"solid"},pp:{stroke:"#A6A6A6",fill:"#A6A6A6",fillpattern:"solid"},fc:{stroke:"#404040",fill:"#ffffff",fillpattern:"hatched"},pl:{stroke:"#404040",fill:"#ffffff",fillpattern:"outlined"}},fontColor:"#000000",fontSize:11,fontFamily:"'Noto Sans', sans-serif",unitScaling:.01,percentageScaling:.5,scaleFactor:1},C="#666666";function L(t,e){return`pattern-${t}-${e.replace("#","")}`}const N=({styles:e})=>{const o=e.scaleFactor,s=6*o,n=[{id:L("pos",e.positive.stroke),stroke:e.positive.stroke,fill:e.positive.fill},{id:L("neg",e.negative.stroke),stroke:e.negative.stroke,fill:e.negative.fill},{id:L("neu",e.neutral.stroke),stroke:e.neutral.stroke,fill:e.neutral.fill}];return t("defs",null,n.map((e=>t("pattern",{id:e.id,patternUnits:"userSpaceOnUse",width:s,height:s},t("rect",{width:s,height:s,fill:"#ffffff"}),t("line",{x1:"0",y1:s,x2:s,y2:"0",stroke:e.stroke,"stroke-width":1.5*o})))))};function P(t,e,o=1){let s,n;const r=t>=0?"+":"";if(e)return s=100*t,r+Math.round(s).toString()+"%";{let e;return s=t/o,n=Math.abs(s),e=n>=1e9?(s/1e9).toFixed(n>=1e10?0:1)+"B":n>=1e6?(s/1e6).toFixed(n>=1e7?0:1)+"M":n>=1e3?(s/1e3).toFixed(n>=1e4?0:1)+"K":s.toFixed(n>=10?0:1),e=e.replace(/\.0([KMB]?)$/,"$1"),r+e}}function x(t){const e=t.slice(0,2).toLowerCase();return["ac","pp","fc","pl"].includes(e)}function k(t){const e=t.slice(0,2).toLowerCase();return"pp"===e?"pp":"fc"===e?"fc":"pl"===e?"pl":"ac"}function A(t,e,o,s){return x(t)?function(t,e){const o=k(t);return e.scenarios[o]}(t,s):function(t,e,o){const s=t>=0;return e?s?o.positive:o.negative:s?o.negative:o.positive}(e,o,s)}const D=e=>{const{value:o,scenario:s,columnStats:n,height:r,isPositiveGood:i,formattedValue:a,measureScale:l,maxBarWidth:c=10,styles:h=_}=e,u=h.scaleFactor,d=h.fontSize,f=38*u,p=c*d,m=4*u,$=.15*p,v=p-m-$,g=Math.abs(o)*h.unitScaling*d,R=g>v,w=Math.max(0,n.absMax*h.unitScaling*d-v),b=Math.max(0,g-v),S=w>0?b/w*$:0,E=n.min<0,O=n.max>0,y=E?p:0,M=(E?f:0)+(y+(O?p:0))+(O?f:0),U=2*u,G=r-2*U,T=(E?f:0)+y,D=U,B=o>=0,F=A(s,o,i,h),Y=function(t,e){const o=t.fillpattern;return"hatched"===o?`url(#${L(e,t.stroke)})`:"outlined"===o?"transparent":t.fill}(F,x(s)?k(s):i?B?"pos":"neg":B?"neg":"pos"),{stroke:W,strokeWidth:H}="outlined"===(I=F).fillpattern?{stroke:I.stroke,strokeWidth:1.5}:{stroke:"none",strokeWidth:0};var I;const z=a||P(o,!1,l),j=R?v:g,V=R?v+m+S:g,Q=B?T+V+4*u:T-V-4*u,q=B?"start":"end";return t("svg",{width:M,height:r,class:"cell-bar-chart absolute-variance",style:{overflow:"visible"}},t(N,{styles:h}),t("line",{x1:T,y1:0,x2:T,y2:r,stroke:C,"stroke-width":1*u}),j>0&&t("rect",{x:B?T:T-j,y:D,width:j,height:G,fill:Y,stroke:W,"stroke-width":H*u}),R&&S>0&&t("rect",{x:B?T+v+m:T-v-m-S,y:D,width:S,height:G,fill:Y,stroke:W,"stroke-width":H*u}),R&&function(e,o,s,n,r){const i=e+o/2,a=.35*o,l=n/3,c=.3*o;let h=`M ${i-a} ${s}`;for(let t=0;t<3;t++)h+=` L ${i-a-c} ${s+l*(t+.5)} L ${i-a} ${s+l*(t+1)}`;let u=`M ${i+a} ${s}`;for(let t=0;t<3;t++)u+=` L ${i+a+c} ${s+l*(t+.5)} L ${i+a} ${s+l*(t+1)}`;return[t("rect",{x:e,y:s-1,width:o,height:n+2,fill:"#ffffff"}),t("path",{d:h,fill:"none",stroke:"#000000","stroke-width":1*r}),t("path",{d:u,fill:"none",stroke:"#000000","stroke-width":1*r})]}(B?T+v:T-v-m,m,D,G,u),t("text",{x:Q,y:r/2,dy:"0.35em","text-anchor":q,fill:h.fontColor,"font-size":d,"font-family":h.fontFamily},z))},B=e=>{const{value:o,scenario:s,columnStats:n,height:r,isPositiveGood:i,formattedValue:a,measureScale:l,maxBarWidth:c=10,styles:h=_}=e,u=h.scaleFactor,d=h.fontSize,f=Math.round(.67*c*d),p=5*u,m=n.min<0?f+p:0,$=m+(n.max>0?f+p:0),v=$+45*u,g=m,R=r/2,w=100*Math.abs(o)*h.percentageScaling*d,b=w>f,S=Math.min(w,f),E=o>=0,O=E?g+S:g-S,y=A(s,o,i,h),M=3*u,U=a||P(o,!0,l),G=$+4*u;return t("svg",{width:v,height:r,class:"cell-bar-chart relative-variance",style:{overflow:"visible"}},t("line",{x1:g,y1:0,x2:g,y2:r,stroke:C,"stroke-width":1*u}),!b&&t("circle",{cx:O,cy:R,r:M,fill:h.fontColor}),t("line",{x1:g,y1:R,x2:O,y2:R,stroke:y.fill,"stroke-width":2*u}),b&&E&&t("polygon",{points:`${g+f},${R} ${g+f-6*u},${R-3*u} ${g+f-6*u},${R+3*u}`,fill:y.fill}),b&&!E&&t("polygon",{points:`${g-f},${R} ${g-f+6*u},${R-3*u} ${g-f+6*u},${R+3*u}`,fill:y.fill}),t("text",{x:G,y:r/2,dy:"0.35em","text-anchor":"start",fill:h.fontColor,"font-size":d,"font-style":"italic","font-family":h.fontFamily},U))},F=e=>{const{value:o,columnStats:s,isRelative:n,styles:r=_}=e;return null==o||isNaN(o)||!s||0===s.absMax?t("span",{class:"bar-chart-empty",style:{color:r.fontColor,fontStyle:"italic"}},"-"):t(n?B:D,Object.assign({},e))};class Y{constructor(t){v.fn.transformOperator=function(t){return"-"===t?-1:1},this.groups=[i.CATEGORY,i.CATEGORYINDEX],y.OPT!==t.type&&y.OPTNOTOTAL!==t.type||this.groups.unshift(i.OPERATION),t.grouped&&(this.groups.push(i.ROWGROUP),this.groups.push(i.ROWGROUPINDEX))}toString(){return this.groups.map((t=>`${t}`)).toString()}noCategory(){return this.groups.filter((t=>t!==i.CATEGORY))}toArray(){return this.groups}}class W{constructor(t,e){this.hasPartOf=!1,this.config=t,this.i18n=e}execute(t){if(0===t.length)return[];const e=[],o=[],s=[],n=this.config.scenarios.map((t=>this.translateScenarioSQL(t,!1,this.config.type))).toString(),r=this.config.scenarios.map((t=>this.translateScenarioSQL(t,!0,this.config.type))).toString(),a=this.getRelativeScenarios(),l=new Y(this.config),c=this.config.grouped?[i.ROWGROUP,i.ROWGROUPINDEX]:[];let h=["",""];return this.config.sortOrder.hierarchy.length>0&&(h=this.createOrderString(this.config.sortOrder)),this.hasPartOf=this.checkConfigForPartOf(),v(`SELECT COUNT(DISTINCT ${i.CATEGORY}) as ${i.TOTALROWCOUNT} ${c.length>0?","+c:""}\n FROM ? ${c.length>0?"GROUP BY "+c:""} \n ORDER BY ${h[0]}`,[t]).forEach((t=>{const s=t.rowGroup&&t.rowGroup.length>0?`WHERE ${i.ROWGROUP} = '${t.rowGroup}'`:"";let a="";this.config.limit&&(a=`LIMIT ${this.config.limit}`),this.createGroupHeaderRow(t,e),this.createDataRow(e,t,l,n,s,h,a),this.createRestRow(t,e,l,n,s,h),this.createGroupSumRow(e,o,t,r,h)})),this.createTotalSumRow(e,o,r),e.forEach((e=>{try{s.push(v(e,[t]))}catch(t){console.error("DataQuery: SQL query execution failed",e,t)}})),this.detectNaNCells(this.config.scenarios,s),this.createThereOfDrillRows(n,h,t,s),this.createPartOfDrillRows(n,h,o,t,s),this.createThereOfDrillColumns(this.config.categoryThereOf,t,s),this.calculateColumnGroupRest(s,this.config.categoryThereOf),this.calculateRelativeVariances(s,a),s}detectNaNCells(t,e){e.forEach((e=>{e.map((e=>(t.forEach((t=>{const o=new a(t);!0===o.isValid?0!==e[o.base+"_cnt"]&&0!==e[o.delta+"_cnt"]||(e[t]=Number.NaN):0===e[t+"_cnt"]&&(e[t]=Number.NaN)})),e)))}))}createPartOfDrillRows(t,e,o,s,n){if(null==this.config.partOf||0===this.config.partOf.length||this.config.type===y.LIST||null==s||0===s.length)return;const r=this.createPartOfQuery(t,e);let a=[];r.forEach((function(t){a.push(...v(t,[s]))}));const l=this.exctractScenarioNames(t),c=[];o.forEach((function(t){c.push(...v(t,[s]))}));const h=new Map;c.forEach((t=>h.set(t[i.ROWGROUP],t))),a=this.reduceResDrillByCategoryGroups(a,l),a.forEach((function(t){l.forEach((e=>{try{t[e]=t[e]/h.get(t[i.ROWGROUP])[e]}catch(o){console.error("DataQuery: partOf drill row calculation failed",e,o),t[e]=Number.NaN}}))})),this.injectDrillRowsToResultRows(a,n)}createRestRow(t,e,o,s,n,r){t.totalRowCnt-this.config.limit>0&&0!==this.config.limit&&e.push(`SELECT ${i.ROWNR}, 1 as ${i.ROWGROUPINDEX} , 'ENTRY' as ${i.TYPE}, 'NO_GROUP' as ${i.ROWGROUP}, 'REST' as ${i.CATEGORY} , SUM(ac1) as ac1, SUM(pp1) as pp1, SUM(dpp1_ac1_pos) as dpp1_ac1_pos, SUM(drpp1_ac1_pos) as drpp1_ac1_pos, SUM(dr_pp1) as dr_pp1 FROM (SELECT ROWNUM() AS ${i.ROWNR}, ${e.length} as ${i.ROWGROUPINDEX} , 'ENTRY' as ${i.TYPE}, '${t.rowGroup||"NO_GROUP"}' as ${i.ROWGROUP}, ${o} ${s.length>0?",".concat(s):""} FROM ? ${n} GROUP BY ${o} ORDER BY ${r[0]}) t WHERE t.rowNr > ${this.config.limit}`)}createDataRow(t,e,o,s,n,r,a){t.push(`SELECT ROWNUM() AS ${i.ROWNR},\n ${t.length} as ${i.ROWGROUPINDEX},\n 'ENTRY' as ${i.TYPE},\n '${e.rowGroup||"NO_GROUP"}' as ${i.ROWGROUP},\n '${i.CATEGORYINDEX}',\n ${o} ${s.length>0?",".concat(s):""}\n FROM ? ${n}\n GROUP BY ${o}\n ORDER BY ${r[0]} ${a}`)}createGroupHeaderRow(t,e){!0===this.config.grouped&&e.push(`SELECT ROWNUM() AS ${i.ROWNR},\n ${e.length} as ${i.ROWGROUPINDEX},\n 'GROUPHEAD' as ${i.TYPE},\n '${t.rowGroup}' as ${i.ROWGROUP} ${this.config.showGroupTitle?`,'${t.rowGroup}' as ${i.CATEGORY}`:""}\n FROM ?\n GROUP BY '1'`)}createGroupSumRow(t,e,o,s,n){!0!==this.config.grouped||y.SUM!==this.config.type&&y.SUMNOTOTAL!==this.config.type&&y.OPT!==this.config.type&&y.OPTNOTOTAL!==this.config.type||(t.push(`SELECT ${t.length} as ${i.ROWGROUPINDEX},\n '=' as ${i.OPERATION},\n '${o.rowGroup}' as ${i.ROWGROUP},\n ROWNUM() AS ${i.ROWNR},\n 'GROUP_SUM' as ${i.TYPE} ${s.length>0?",".concat(s):""}\n FROM ?\n WHERE ${i.ROWGROUP} = '${o.rowGroup}'\n ORDER BY ${n[0]} `),e.push(`SELECT ${t.length} as ${i.ROWGROUPINDEX},\n '=' as ${i.OPERATION},\n '${o.rowGroup}' as ${i.ROWGROUP},\n ROWNUM() AS ${i.ROWNR},\n 'GROUP_SUM' as ${i.TYPE} ${s.length>0?",".concat(s):""}\n FROM ?\n WHERE ${i.ROWGROUP} = '${o.rowGroup}'\n ORDER BY ${n[0]} `))}createTotalSumRow(t,e,o){if(y.SUM===this.config.type||y.OPT===this.config.type){const e=`${this.hasPartOf&&!1===this.config.grouped?`${this.i18n.get("SUM_TOTAL")||"SUM_TOTAL"} `:""}${this.config.title}`;t.push(`SELECT ${t.length} as ${i.ROWGROUPINDEX},\n '${e}' as ${i.ROWGROUP},\n '=' as ${i.OPERATION},\n 'SUM' as ${i.TYPE} ${o.length>0?",".concat(o):""}\n FROM ? `)}e.push(`SELECT ${t.length} as ${i.ROWGROUPINDEX},\n 'SUM_TOTAL' as ${i.ROWGROUP},\n '=' as ${i.OPERATION},\n 'SUM' as ${i.TYPE} ${o.length>0?",".concat(o):""}\n FROM ? `)}reduceResDrillByCategoryGroups(t,e){const o=new Map;return t.forEach((function(t){const s=t.rowNr+t.rowGroup+t.type+t.category;if(o.has(s)){const n=o.get(s);e.forEach((e=>{try{n[e]+=t[e]}catch(t){console.error("DataQuery: drill row aggregation failed",e,t)}}))}else o.set(s,t)})),[...o.values()]}injectDrillRowsToResultRows(t,e){const o=new Map;if(!0===this.config.grouped)t.forEach((function(t){e.forEach((function(e){const s=e.findIndex((e=>e.category===t.category&&e.rowGroup===t.rowGroup));if(s>=0){if(o.has(`${t.category}_${t.rowGroup}`)){const e=o.get(`${t.category}_${t.rowGroup}`)||0;o.set(`${t.category}_${t.rowGroup}`,e+1)}else o.set(`${t.category}_${t.rowGroup}`,1);t[i.ROWNR]=o.get(`${t.category}_${t.rowGroup}`),e.splice(s+t[i.ROWNR],0,t)}}))}));else{const s=this.findDuplicateSubCategories(t);t.forEach((function(t){e.forEach((function(e){const n=e.findIndex((e=>null!=e.category&&e.category===t.category));if(n>=0){if(o.has(`${t.category}`)){const e=o.get(`${t.category}`)||0;o.set(`${t.category}`,e+1)}else o.set(`${t.category}`,1);(1===t[i.ROWNR]||s.includes(t.subCategory))&&(t.subCategory=`${t.subCategory} (${t.rowGroup})`),e.splice(n+t[i.ROWNR],0,t)}}))}))}}createThereOfDrillRows(t,e,o,s){if(void 0===this.config.thereOf||0===this.config.thereOf.length)return;const n=[],r=[];this.config.thereOf.forEach((o=>{let s=!0,r="1 <> 1 OR ( ";null!=o.category&&0!==o.category.length&&o.category.trim()&&(r+=` ${i.CATEGORY} = '${o.category}'`,s=!1),null!=o.rowGroup&&0!==o.rowGroup.length&&o.rowGroup.trim()&&(r+=` ${s?"":"AND"} ${i.ROWGROUP} = '${o.rowGroup}'`,s=!1),null!=o.subCategory&&0!==o.subCategory.length&&o.subCategory.trim()&&(r+=` ${s?"":"AND"} ${i.SUBCATEGORY} = '${o.subCategory}'`),r+=")",n.push(`SELECT ROWNUM() AS ${i.ROWNR},\n null as operation,\n 'DRILLELEMENT' as ${i.TYPE},\n ${i.CATEGORY},\n ${i.SUBCATEGORY},\n ${i.ROWGROUP} as ${i.ROWGROUP},\n ${t}\n FROM ?\n WHERE ${r}\n GROUP BY ${i.ROWGROUP}, ${i.CATEGORY}, ${i.SUBCATEGORY}\n ORDER BY ${e[1]}`)})),n.forEach((function(t){r.push(...v(t,[o]))})),this.injectDrillRowsToResultRows(r,s)}calculateRelativeVariances(t,e){t.forEach((t=>{t.forEach((t=>{"GROUPHEAD"!==t[i.TYPE]&&e.forEach(((e,o)=>{t[o]=t[o]/t[e]}))}))}))}calculateColumnGroupRest(t,e){if(null==e||0===e.size)return;const o=new Map,s=new Map;e.forEach(((t,e)=>{const n=t,r=[];for(const t of n)r.push(`${e}##${t.name}`);o.set(e,r),s.set(`${e}##REST`,!1)})),t.forEach((t=>{t.forEach((t=>{"GROUPHEAD"!==t[i.TYPE]&&o.forEach(((e,o)=>{let n=0;e.forEach((e=>{void 0!==t[e]&&(n+=t[e])})),t[`${o}##REST`]=t[o]-n,0!==t[`${o}##REST`]&&s.set(`${o}##REST`,!0)}))}))}));const n=Array.from(s.entries()).filter((([t,e])=>!e)).map((([t])=>t));t.forEach((t=>{t.forEach((t=>{for(const e of n)delete t[e]}))}))}getRelativeScenarios(){const t=new Map;return this.config.scenarios.forEach((e=>{const o=this.createRelativeScenario(e);null!=o&&t.set(o.key,o.value)})),t}translateScenarioSQL(t,e,o){const s=new a(t);return y.OPT===o||y.OPTNOTOTAL===o?s.isValid?"dr"===s.type?`SUM(${s.base} - ${s.delta}) as ${t}, SUM(${s.delta}) as dr_${s.delta}`:`SUM(${s.base} - ${s.delta}) as ${t}`:e?`SUM(${t} * transformOperator(operation)) as ${t}, COUNT(ISNULL(${t})) as ${t}_cnt`:`SUM(${t}) as ${t}, COUNT(ISNULL(${t})) as ${t}_cnt`:s.isValid?"dr"===s.type?`SUM((${s.base} * transformOperator(operation)) - (${s.delta} * transformOperator(operation))) as ${t}, SUM(${s.delta} * transformOperator(operation)) as dr_${s.delta}`:`SUM((${s.base} * transformOperator(operation))- (${s.delta} * transformOperator(operation))) as ${t}`:`SUM(${t} * transformOperator(operation)) as ${t}, COUNT(ISNULL(${t})) as ${t}_cnt`}createOrderString(t){return[`${t.hierarchy.toString()} ${t.direction}`,`${t.hierarchy.toString()} ${M.ASC===t.direction?M.DESC:M.ASC}`]}createRelativeScenario(t){const e=new a(t);return e.isValid&&"dr"===e.type?{key:`${t}`,value:`dr_${e.delta}`}:null}exctractScenarioNames(t){const e=[];return t.split(",").forEach((t=>t.length>=2?e.push(t.split("as")[1].trim()):null)),e}findDuplicateSubCategories(t){const e=t.map((t=>({count:1,subCategory:t.subCategory}))).reduce(((t,e)=>(t[e.subCategory]=(t[e.subCategory]||0)+e.count,t)),{});return Object.keys(e).filter((t=>e[t]>1))}createPartOfQuery(t,e){var o;const s=[];let n="1 <> 1 ",r=` ${i.ROWGROUP}`,a="ROWNUM()";return null===(o=this.config.partOf)||void 0===o||o.forEach((t=>{n+=`OR (${i.CATEGORY} = '${t.category}'`,null!=t.rowGroup&&0!==t.rowGroup.length&&t.rowGroup.trim()&&(n+=`and ${i.ROWGROUP} = '${t.rowGroup}'`),!1===this.config.grouped&&(r=` 'SUM_TOTAL' as ${i.ROWGROUP} `,a="1"),n+=")"})),s.push(`SELECT ${a} AS ${i.ROWNR},\n 'PARTELEMENT' as ${i.TYPE},\n ${i.CATEGORY},\n ${r},\n ${t}\n FROM ?\n WHERE ${n}\n GROUP BY ${i.ROWGROUP}, ${i.CATEGORY}, ${i.TYPE}\n ORDER BY ${e[1]}`),s}checkConfigForPartOf(){return null!=this.config.partOf&&0!==this.config.partOf.length}createThereOfDrillColumns(t,e,o){if(null==t||0===t.size)return;const s=[],n=[];t.forEach(((t,e)=>{let o="1 <> 1 ";t.forEach((t=>{o+=` or columnGroup = '${t.name}' `})),s.push(`SELECT 'ENTRY' as rowlevel,\n 'COLUMNGROUP' as columnlevel,\n rowGroup,\n category,\n columnGroup,\n '${e}' as scenario,\n sum(${e} * transformOperator(operation)) as val\n FROM ?\n WHERE ${o}\n GROUP BY rowlevel, rowGroup, category, columnGroup, scenario`),s.push(`SELECT 'ENTRY' as rowlevel,\n 'SUBGROUP' as columnlevel,\n rowGroup,\n category,\n columnGroup,\n columnSubGroup,\n '${e}' as scenario,\n sum(${e} * transformOperator(operation)) as val\n FROM ?\n WHERE ${o}\n GROUP BY rowlevel, rowGroup, category, columnGroup, columnSubGroup, scenario`),s.push(`SELECT 'DRILLELEMENT' as rowlevel,\n 'COLUMNGROUP' as columnlevel,\n rowGroup,\n category,\n subCategory,\n columnGroup,\n '${e}' as scenario,\n sum(${e} * transformOperator(operation)) as val\n FROM ?\n WHERE ${o}\n GROUP BY rowlevel, rowGroup, category, subCategory, columnGroup, scenario`),s.push(`SELECT 'DRILLELEMENT' as rowlevel,\n 'SUBGROUP' as columnlevel,\n rowGroup,\n category,\n subCategory,\n columnGroup,\n columnSubGroup,\n '${e}' as scenario,\n sum(${e} * transformOperator(operation)) as val\n FROM ?\n WHERE ${o}\n GROUP BY rowlevel, rowGroup, category, subCategory, columnGroup, columnSubGroup, scenario`),s.push(`SELECT 'GROUP_SUM' as rowlevel,\n 'COLUMNGROUP' as columnlevel,\n rowGroup,\n columnGroup,\n '${e}' as scenario,\n sum(${e} * transformOperator(operation)) as val\n FROM ?\n WHERE ${o}\n GROUP BY rowlevel, rowGroup, columnGroup, scenario`),s.push(`SELECT 'GROUP_SUM' as rowlevel,\n 'SUBGROUP' as columnlevel,\n rowGroup,\n columnGroup,\n columnSubGroup,\n '${e}' as scenario,\n sum(${e} * transformOperator(operation)) as val\n FROM ?\n WHERE ${o}\n GROUP BY rowlevel, rowGroup, columnGroup, columnSubGroup, scenario`),s.push(`SELECT 'SUM' as rowlevel,\n 'COLUMNGROUP' as columnlevel,\n columnGroup,\n '${e}' as scenario,\n sum(${e} * transformOperator(operation)) as val\n FROM ?\n WHERE ${o}\n GROUP BY rowlevel, columnGroup, scenario`),s.push(`SELECT 'SUM' as rowlevel,\n 'SUBGROUP' as columnlevel,\n columnGroup,\n columnSubGroup,\n '${e}' as scenario,\n sum(${e} * transformOperator(operation)) as val\n FROM ?\n WHERE ${o}\n GROUP BY rowlevel, columnGroup, columnSubGroup, scenario`)}));for(const t of s)n.push(...v(t,[e]));this.injectDrillColumnsToResultRows(n,o)}injectDrillColumnsToResultRows(t,e){const o="##";for(const s of t)for(const t of e)for(const e of t)e.type===s.rowlevel&&("ENTRY"===s.rowlevel?"COLUMNGROUP"===s.columnlevel&&e.category===s.category?e[s.scenario+o+s.columnGroup]=s.val:"SUBGROUP"===s.columnlevel&&e.category===s.category&&(e[s.scenario+o+s.columnGroup+o+s.columnSubGroup]=s.val):"DRILLELEMENT"===s.rowlevel?"COLUMNGROUP"===s.columnlevel&&e.category===s.category&&e.subCategory===s.subCategory?e[s.scenario+o+s.columnGroup]=s.val:"SUBGROUP"===s.columnlevel&&e.category===s.category&&e.subCategory===s.subCategory?e[s.scenario+o+s.columnGroup+o+s.columnSubGroup]=s.val:"COLUMNGROUP"===s.columnlevel&&e.category===s.category&&e.subCategory===`${s.subCategory} (${s.rowGroup})`?e[s.scenario+o+s.columnGroup]=s.val:"SUBGROUP"===s.columnlevel&&e.category===s.category&&e.subCategory===`${s.subCategory} (${s.rowGroup})`&&(e[s.scenario+o+s.columnGroup+o+s.columnSubGroup]=s.val):("SUM"===s.rowlevel||"GROUP_SUM"===s.rowlevel)&&("COLUMNGROUP"===s.columnlevel&&e.category===s.category&&e.subCategory===s.subCategory&&(e[s.scenario+o+s.columnGroup]=s.val),"SUBGROUP"===s.columnlevel&&e.category===s.category&&e.subCategory===s.subCategory&&(e[s.scenario+o+s.columnGroup+o+s.columnSubGroup]=s.val)))}}class H{constructor(){this.normalizedHeader=[]}createHeader(t,e,o,s,n,i){const a=[];this.normalizedHeader=this.normalizeHeader(t,e);const l=new T(0,0,U.HEADER),c=new T(1,0,U.SEPERATORLINE);for(const t of this.normalizedHeader)l.createElement(r.translateScenarioLabel(t.name,o),t.type,this.createColumnType(t),null,this.setHeaderPrefix(t,o,s,n,i),null,null,null,null),c.createElement(null,t.type,this.createColumnType(t),null,null,null,null,null,null);return a.push(l),a.push(c),a}setHeaderPrefix(t,e,o,s,n){let i="";return"category"===t.name&&n&&(0===o.prefix.length&&0===s.length||(i=r.translateScenarioLabel("in",e)+" "+o.prefix+s)),t.order&&(i+=r.translateScenarioLabel("ORDER_"+t.order,e)),i}normalizeHeader(t,e){let o=[{name:i.CATEGORY,group:i.CATEGORY,type:i.CATEGORY,order:void 0}];return y.OPT!==t&&y.OPTNOTOTAL!==t||(o=[{name:i.OPERATION,group:i.OPERATION,type:i.OPERATION,order:void 0},{name:i.CATEGORY,group:i.CATEGORY,type:i.CATEGORY,order:void 0}]),[...o,...e]}createBodyRows(t,e,o){const s=[];let n=-1;const r=new W(t,e).execute(o),i=this.calculateColumnStatistics(r,t.barColumns);for(const o of r)n+=1,s.push(...this.createRow(t.i18n,e,t.scenariosUnitType,o,n,-1,t.categoryWidth,t.measureScale,t.barColumns,i));return s}calculateColumnStatistics(t,e){const o=new Map;if(!e||0===e.length)return o;const s=new Map;for(const t of e)o.set(t,{min:1/0,max:-1/0,absMax:0,median:0}),s.set(t,[]);for(const n of t)for(const t of n)for(const n of e){const e=this.extractColumnValue(t,n);if(null!==e&&!isNaN(e)){const t=o.get(n);t.min=Math.min(t.min,e),t.max=Math.max(t.max,e),s.get(n).push(Math.abs(e))}}for(const[t,e]of o){e.min!==1/0&&e.max!==-1/0||(e.min=0,e.max=0),e.absMax=Math.max(Math.abs(e.min),Math.abs(e.max));const n=s.get(t);if(n.length>0){n.sort(((t,e)=>t-e));const t=Math.floor(n.length/2);e.median=n.length%2==0?(n[t-1]+n[t])/2:n[t]}o.set(t,e)}return o}extractColumnValue(t,e){if(void 0!==t[e]){const o=Number(t[e]);return isNaN(o)?null:o}for(const o of Object.keys(t))if(o===e||o.endsWith("##"+e)||o===e+"##"+e){const e=Number(t[o]);if(!isNaN(e))return e}return null}createRow(t,e,o,s,n,r,a,l,c,h){var u;const d=[];for(const f of s){const p=f[i.ROWGROUP],m=f[i.SUBCATEGORY],$=f[i.TYPE],v=f[i.ROWNR]>=2,g=this.createDetailRow($,r+=1,n,s.length);for(const s of this.normalizedHeader){const n=this.getRawDataRowElement(f,s),r=null!==(u=null==c?void 0:c.includes(s.type))&&void 0!==u&&u,i=r?null==h?void 0:h.get(s.type):void 0;g.createElement(this.translateSumCellLabel(t,e,n,p,m,$,s.type),s.type,this.createColumnType(s),this.setCellType(s.type,o),this.translateCellPrefix(e,$,s.type),this.translateScenarioCSS(s.type,n),v,a,null==l?void 0:l.value,r,i)}d.push(g)}return d}getRawDataRowElement(t,e){return e.name===e.group&&e.name===e.type?t[e.name]:e.name===e.group&&e.name!==e.type?t[e.type+"##"+e.name]:t[e.type+"##"+e.group+"##"+e.name]}createDetailRow(t,e,o,s){switch(t){case U.GROUPHEAD:return new T(e,o,U.HEADER);case U.SUM:case U.GROUPSUM:return new T(s+2,o,U.SUM);case U.DRILLELEMENT:return new T(s+2,o,U.DRILLELEMENT);case U.PARTELEMENT:return new T(s+2,o,U.PARTELEMENT);default:return new T(e,o,U.STANDARD)}}translateSumCellLabel(t,e,o,s,n,r,i){return!1===Number.isNaN(Number(o))||this.isOperationColumn(i)?o:this.isGroupHeadCategory(r,i)||this.isEntryCategory(r,i)?t===h.ALL?`${e.get(o)||o}`:o:this.isDrillElementCategory(r,i)?t===h.ALL?`${e.get(n)||n}`:`${n}`:this.isPartElementCategory(r,i)?t===h.ALL||"SUM_TOTAL"===s?`${e.get(s)||s}`:`${s}`:this.isSumElementCategory(r,i)?t===h.ALL||"SUM_TOTAL"===s?`${e.get(s)||s}`:s:"GROUPHEAD"===r&&null==o?o:Number.isNaN(Number(o))?"-":Number(o)}isOperationColumn(t){return"operation"===t}translateScenarioCSS(t,e){const o=new a(t);let s="pos";return e<0&&(s="neg"),o.isValid?s+"_"+o.direction+("dr"===o.type?" relative_variance":""):t}setCellType(t,e){if("category"===t)return"";let o;const s=new a(t);return e===u.PERCENT?(o="percent",s.isValid&&"d"===s.type&&(o="decimal")):(o="decimal",s.isValid&&"dr"===s.type&&(o="percent")),o}isDrillElementCategory(t,e){return"DRILLELEMENT"===t&&"category"===e}isPartElementCategory(t,e){return"PARTELEMENT"===t&&"category"===e}isSumElementCategory(t,e){return("GROUP_SUM"===t||"SUM"===t)&&"category"===e}isEntryCategory(t,e){return"ENTRY"===t&&"category"===e}isGroupHeadCategory(t,e){return"GROUPHEAD"===t&&"category"===e}translateCellPrefix(t,e,o){return this.isOperationColumn(o)||this.isGroupHeadCategory(e,o)||this.isEntryCategory(e,o)?null:this.isDrillElementCategory(e,o)?`${t.get("there_of")} `:this.isPartElementCategory(e,o)?`${t.get("part_of")} `:null}createColumnType(t){return t.name===t.group&&t.name===t.type?"base":t.name===t.group?"columnGroup":"columnSubGroup"}}class I{constructor(t,e,o){this.data=[],this.headerRows=[],this.bodyRows=[],this.ruleSet=t||new l,this.dataSetFactory=new H,this.config=this.initConfig(o),this.i18n=this.initI18n(new Map),this.setData(e,o.filter),this.state=O.DIRTY}setI18n(t){this.i18n=this.initI18n(t)}initI18n(t){const e=new Map([["",""],["SEPERATOR_WS",", "],["in","in"],["ORDER_asc","↑"],["ORDER_desc","↓"],["ac1","AC"],["pp1","PY"],["fc1","FC"],["pl1","PL"],["ac2","AC2"],["pp2","PY2"],["fc2","FC2"],["pl2","PL2"],["ac3","AC3"],["pp3","PY3"],["fc3","FC3"],["pl3","PL3"],["ac4","AC4"],["pp4","PY4"],["fc4","FC4"],["pl4","PL4"],["in","in"],["category"," "],["operation"," "],["there_of","davon"],["part_of","in % von"],["ibcssymbol_delta_ac","Δ{%}"],["ibcssymbol_delta_generic","Δ({%})"],["ibcssymbol_delta_ac_relative","Δ{%}%"],["ibcssymbol_delta_generic_relative","Δ({%})%"],["SUM_TOTAL","❖"]]);return this.state=O.DIRTY,new Map([...e,...t||new Map])}initConfig(t){this.state=O.DIRTY;const e=t,o=this;return t.scenarios.sort(((t,e)=>o.ruleSet.getScenarioSorIndex(t)-o.ruleSet.getScenarioSorIndex(e))),e}setConfig(t){this.config=this.initConfig(t)}setData(t,e){if(null==t)return;if(null!=e&&e.length>0)try{this.data=v(`SELECT * FROM ? WHERE ${e}`,[t])}catch(o){console.error("Table: filter query failed, using unfiltered data",e,o),this.data=t}else this.data=t;const o=this.normalizeScenarios(this.config.scenarios,this.config.categoryThereOf,this.config.sortOrder);this.headerRows=this.dataSetFactory.createHeader(this.config.type,o,this.i18n,this.config.measureScale,this.config.measureUnit,this.config.showMeasureScale),this.bodyRows=this.dataSetFactory.createBodyRows(this.config,this.i18n,this.data),this.state=O.UP_TO_DATE}update(){const t=this.normalizeScenarios(this.config.scenarios,this.config.categoryThereOf,this.config.sortOrder);this.headerRows=this.dataSetFactory.createHeader(this.config.type,t,this.i18n,this.config.measureScale,this.config.measureUnit,this.config.showMeasureScale),this.bodyRows=this.dataSetFactory.createBodyRows(this.config,this.i18n,this.data),this.state=O.UP_TO_DATE}getHeader(){return this.state===O.DIRTY&&this.update(),this.headerRows}getBody(){return this.state===O.DIRTY&&this.update(),this.bodyRows}normalizeScenarios(t,e,o){var s;const n=[];for(const r of t){if(null==e?void 0:e.has(r)){const t=e.get(r);for(const e of t){n.push({name:e.name,group:e.name,type:r,order:void 0});for(const t of e.subGroups)n.push({name:t,group:e.name,type:r,order:void 0})}n.push({name:"REST",group:"REST",type:r,order:void 0})}let t;(null===(s=null==o?void 0:o.hierarchy)||void 0===s?void 0:s.at(0))===r&&(t=o.direction),n.push({name:r,group:r,type:r,order:t})}return n}hasNoData(){return 0===this.data.length}}class z{constructor(){this.title="",this.scenarios=[],this.scenariosUnitType=u.DECIMAL,this.grouped=!1,this.showGroupTitle=!0,this.thereOf=[],this.categoryThereOf=new Map,this.partOf=[],this.sortOrder=new p(new c).default(),this.type=y.LIST,this.limit=0,this.i18n=h.ALL,this.categoryWidth=m.W25,this.measureScale=new R,this.measureUnit="",this.measureType=$.VOLUME,this.showMeasureScale=!0,this.filter="",this.barColumns=[]}}class j{constructor(t,e,o,s){this.tableDrillGroupAdapter=t,this.stringAdapter=e,this.orderAdapter=o,this.dataSet=s}adapt(t){const e=new z;return d.isString(t.title)&&(e.title=t.title),d.isArray(t.scenarios)&&(e.scenarios=f.adaptArray(t.scenarios,this.stringAdapter)),d.isExisting(t.scenariosUnitType)&&(e.scenariosUnitType=t.scenariosUnitType),d.isBoolean(t.grouped)&&(e.grouped=t.grouped),d.isBoolean(t.showGroupTitle)&&(e.showGroupTitle=t.showGroupTitle),d.isBoolean(t.showMeasureScale)&&(e.showMeasureScale=t.showMeasureScale),d.isArray(t.thereOf)&&(e.thereOf=f.adaptArray(t.thereOf,this.tableDrillGroupAdapter)),d.isExisting(t.categoryThereOf)&&(e.categoryThereOf=t.categoryThereOf),d.isArray(t.partOf)&&(e.partOf=f.adaptArray(t.partOf,this.tableDrillGroupAdapter)),d.isExisting(t.order)&&(e.sortOrder=this.orderAdapter.adapt(t.order)),d.isExisting(t.type)&&(e.type=t.type),d.isNumber(t.limit)&&(e.limit=t.limit),d.isExisting(t.i18n)&&(e.i18n=t.i18n),d.isExisting(t.categoryWidth)&&(e.categoryWidth=t.categoryWidth),d.isExisting(t.measureScale)&&(e.measureScale=g.calculateMeasureScale(this.dataSet,e.scenarios,t.measureScale)),d.isExisting(t.measureType)&&(e.measureType=t.measureType),d.isString(t.measureUnit)&&(e.measureUnit=t.measureUnit),d.isString(t.filter)&&(e.filter=t.filter.trim()),d.isArray(t.barColumns)&&(e.barColumns=t.barColumns),e}default(){return new z}}class V{constructor(){this.rowGroup="",this.category="",this.subCategory="",this.partOf=""}}class Q{constructor(){}adapt(t){const e=new V;return d.isString(t.rowGroup)&&(e.rowGroup=t.rowGroup),d.isString(t.category)&&(e.category=t.category),d.isString(t.subCategory)&&(e.subCategory=t.subCategory),d.isString(t.partOf)&&(e.partOf=t.partOf),e}default(){return new V}}class q{constructor(){this.operation="+"}addRowGroup(t,e){this.rowGroup=t,this.rowGroupIndex=e}addCategory(t,e){this.category=t,this.categoryIndex=e}addSubCategory(t,e){this.subCategory=t,this.subCategoryIndex=e}addColumnGroup(t,e){this.columnGroup=t,this.columnGroupIndex=e}addSubColumnGroup(t,e){this.columnSubGroup=t,this.columnSubGroupIndex=e}}class K{constructor(){}adapt(t){const e=new q;return d.isOperator(t.operation)&&(e.operation=t.operation),d.isNumber(t.rowGroupIndex)&&d.isString(t.rowGroup)&&e.addRowGroup(t.rowGroup,t.rowGroupIndex),d.isNumber(t.categoryIndex)&&d.isString(t.category)&&e.addCategory(t.category,t.categoryIndex),d.isNumber(t.subCategoryIndex)&&d.isString(t.subCategory)&&e.addSubCategory(t.subCategory,t.subCategoryIndex),d.isNumber(t.columnGroupIndex)&&d.isString(t.columnGroup)&&e.addColumnGroup(t.columnGroup,t.columnGroupIndex),d.isNumber(t.columnSubGroupIndex)&&d.isString(t.columnSubGroup)&&e.addSubColumnGroup(t.columnSubGroup,t.columnSubGroupIndex),this.setActualValues(t,e),this.setPlanValues(t,e),this.setPreviousPeriodValues(t,e),this.setForecastValues(t,e),e}default(){return new q}setActualValues(t,e){d.isNumber(t.ac1)&&(e.ac1=t.ac1),d.isNumber(t.ac2)&&(e.ac2=t.ac2),d.isNumber(t.ac3)&&(e.ac3=t.ac3),d.isNumber(t.ac4)&&(e.ac4=t.ac4)}setPlanValues(t,e){d.isNumber(t.pp1)&&(e.pp1=t.pp1),d.isNumber(t.pp2)&&(e.pp2=t.pp2),d.isNumber(t.pp3)&&(e.pp3=t.pp3),d.isNumber(t.pp4)&&(e.pp4=t.pp4)}setPreviousPeriodValues(t,e){d.isNumber(t.pl1)&&(e.pl1=t.pl1),d.isNumber(t.pl2)&&(e.pl2=t.pl2),d.isNumber(t.pl3)&&(e.pl3=t.pl3),d.isNumber(t.pl4)&&(e.pl4=t.pl4)}setForecastValues(t,e){d.isNumber(t.fc1)&&(e.fc1=t.fc1),d.isNumber(t.fc2)&&(e.fc2=t.fc2),d.isNumber(t.fc3)&&(e.fc3=t.fc3),d.isNumber(t.fc4)&&(e.fc4=t.fc4)}}const J=e(class extends o{constructor(t){super(),!1!==t&&this.__registerHost(),this.__attachShadow(),this.data=[],this.tableTitle="SUM_TOTAL",this.scenarios=[],this.scenariosDataFormat=u.DECIMAL,this.grouped=!1,this.limit=0,this.showGroupTitle=!0,this.thereof=[],this.partof=[],this.order={hierarchy:[],direction:M.ASC},this.categorythereof=new Map,this.type=y.LIST,this.categoryWidth=m.INF,this.dataFormatDigits={percent:2,decimal:1},this.i18n=new Map,this.i18nMode=h.ALL,this.measureScale="_",this.measureUnit="",this.showMeasureScale=!0,this.measureType=$.VOLUME,this.filter="",this.barColumns=[],this.barColumnMaxWidth=30,this.unitScaling=.01,this.percentageScaling=.5,this.scaleFactor=1,this.componentDataFormatDigits=new w,this.componentStyle=S(this)}render(){return t(s,null,(()=>{if(void 0!==this.table){if(this.table.hasNoData()){const e=this.i18n.get("NO_DATA")||"==No Data==";return t("p",{class:"warning"},e)}return t("table",null,t("thead",null,this.table.getHeader().map((e=>t("tr",{class:e.cssStyle},e.getCells().map((e=>t("th",{colSpan:e.colSpan,class:e.cssStyle},e.getAsHeaderList().map(((o,s,n)=>t("span",null,s===n.length-1?t("span",{class:" "===o?"table-footer":""},o,e.drawPrefix()," "):t("span",null,o,e.drawPrefix(),t("br",null)))))))))))),t("tbody",null,this.table.getBody().map((e=>t("tr",{class:e.cssStyle},null==e?void 0:e.getCells().map((o=>t("td",{colSpan:o.colSpan,class:o.type?`${o.cssStyle} ${o.type}`:o.cssStyle},null!=o.prefix?t("span",{class:o.cssStyle+" "+o.prefixStyle},o.drawPrefix()):"",o.isBarChart&&o.columnStats&&e.type!==U.SUM?t(F,{value:o.value,scenario:o.key,columnStats:o.columnStats,height:18*this.scaleFactor,isRelative:o.key.startsWith("dr"),isPositiveGood:o.key.endsWith("_pos"),measureScale:o.measureScale,maxBarWidth:this.barColumnMaxWidth,styles:this.barChartStyles}):o.draw(this.componentDataFormatDigits)))))))))}})())}componentWillRender(){const t=this.prepareConfig(),e=this.prepareData();this.componentDataFormatDigits=(new b).adapt(this.dataFormatDigits),this.table=new I(new l,e,t),this.table.setI18n(this.i18n),this.barChartStyles=this.prepareBarChartStyles()}prepareConfig(){return new j(new Q,new c,new p(new c),this.data).adapt({title:this.tableTitle,scenarios:this.scenarios,scenariosUnitType:this.scenariosDataFormat,grouped:this.grouped,showGroupTitle:this.showGroupTitle,thereOf:this.thereof,partOf:this.partof,categoryThereOf:this.categorythereof,order:this.order,type:this.type,limit:this.limit,i18n:this.i18nMode,categoryWidth:this.categoryWidth,measureScale:this.measureScale,measureUnit:this.measureUnit,measureType:this.measureType,showMeasureScale:this.showMeasureScale,filter:this.filter,barColumns:this.barColumns})}prepareData(){return f.adaptArray(this.data,new K)}prepareBarChartStyles(){return this.componentStyle((t=>{var e,o,s,n,r,i,a,l,c,h,u,d,f,p,m,$,v,g,R,w,b,S,E,O,y,M;const U=null===(e=t["bn-chart-time"])||void 0===e?void 0:e.varianceStyles,G=null===(o=t["bn-chart-time"])||void 0===o?void 0:o.barStyles;return{positive:{stroke:(null===(s=null==U?void 0:U.pos)||void 0===s?void 0:s.stroke)||"#008f96",fill:(null===(n=null==U?void 0:U.pos)||void 0===n?void 0:n.fill)||"#008f96",fillpattern:(null===(r=null==U?void 0:U.pos)||void 0===r?void 0:r.fillpattern)||"solid"},negative:{stroke:(null===(i=null==U?void 0:U.neg)||void 0===i?void 0:i.stroke)||"#ff0000",fill:(null===(a=null==U?void 0:U.neg)||void 0===a?void 0:a.fill)||"#ff0000",fillpattern:(null===(l=null==U?void 0:U.neg)||void 0===l?void 0:l.fillpattern)||"solid"},neutral:{stroke:(null===(c=null==U?void 0:U.neu)||void 0===c?void 0:c.stroke)||"#808080",fill:(null===(h=null==U?void 0:U.neu)||void 0===h?void 0:h.fill)||"#808080",fillpattern:(null===(u=null==U?void 0:U.neu)||void 0===u?void 0:u.fillpattern)||"outlined"},scenarios:{ac:{stroke:(null===(d=null==G?void 0:G.ac)||void 0===d?void 0:d.stroke)||"#404040",fill:(null===(f=null==G?void 0:G.ac)||void 0===f?void 0:f.fill)||"#404040",fillpattern:(null===(p=null==G?void 0:G.ac)||void 0===p?void 0:p.fillpattern)||"solid"},pp:{stroke:(null===(m=null==G?void 0:G.pp)||void 0===m?void 0:m.stroke)||"#A6A6A6",fill:(null===($=null==G?void 0:G.pp)||void 0===$?void 0:$.fill)||"#A6A6A6",fillpattern:(null===(v=null==G?void 0:G.pp)||void 0===v?void 0:v.fillpattern)||"solid"},fc:{stroke:(null===(g=null==G?void 0:G.fc)||void 0===g?void 0:g.stroke)||"#404040",fill:(null===(R=null==G?void 0:G.fc)||void 0===R?void 0:R.fill)||"#ffffff",fillpattern:(null===(w=null==G?void 0:G.fc)||void 0===w?void 0:w.fillpattern)||"hatched"},pl:{stroke:(null===(b=null==G?void 0:G.pl)||void 0===b?void 0:b.stroke)||"#404040",fill:(null===(S=null==G?void 0:G.pl)||void 0===S?void 0:S.fill)||"#ffffff",fillpattern:(null===(E=null==G?void 0:G.pl)||void 0===E?void 0:E.fillpattern)||"outlined"}},fontColor:(null===(O=t.global)||void 0===O?void 0:O.fontColor)||"#000000",fontSize:.85*((null===(y=t.global)||void 0===y?void 0:y.fontSizePx)||13.3333)*this.scaleFactor,fontFamily:(null===(M=t.global)||void 0===M?void 0:M.fontFamily)||"'Noto Sans', sans-serif",unitScaling:this.unitScaling>0?this.unitScaling:this.autoUnitScaling(),percentageScaling:this.percentageScaling>0?this.percentageScaling:this.autoPercentageScaling(),scaleFactor:this.scaleFactor}}))}autoUnitScaling(){const t=this.componentStyle((t=>{var e;return.85*((null===(e=t.global)||void 0===e?void 0:e.fontSizePx)||13.3333)*this.scaleFactor})),e=this.barColumnMaxWidth*t*.8,o=this.getMaxAbsValue();return o<=0||t<=0?.01:e/(o*t)}autoPercentageScaling(){const t=this.componentStyle((t=>{var e;return.85*((null===(e=t.global)||void 0===e?void 0:e.fontSizePx)||13.3333)*this.scaleFactor})),e=.8*Math.round(.67*this.barColumnMaxWidth*t),o=this.getMaxRelativeValue();return o<=0||t<=0?.5:e/(o*t)}getMaxAbsValue(){if(!this.table)return 0;let t=0;for(const e of this.table.getBody())if(e.type!==U.SUM)for(const o of e.getCells())o.isBarChart&&o.columnStats&&!o.key.startsWith("dr")&&(t=Math.max(t,o.columnStats.absMax));return t}getMaxRelativeValue(){if(!this.table)return 0;let t=0;for(const e of this.table.getBody())if(e.type!==U.SUM)for(const o of e.getCells())o.isBarChart&&o.columnStats&&o.key.startsWith("dr")&&(t=Math.max(t,100*o.columnStats.absMax));return t}get element(){return this}static get style(){return':host{position:relative;display:inline-block}table{background-color:var(--bn-font-background, white);font-size:var(--bn-font-size, 1em);color:var(--bn-font-color, black);font-family:var(--bn-font-family, "Noto Sans", "Helvetica Neue", Helvetica, sans-serif);border-spacing:0.3em 0}thead{border-style:none}tr:first-child td{border-top:none;padding-top:0.5em}td.ac1,td.ac2,td.ac3,td.ac4,td.pp1,td.pp2,td.pp3,td.pp4,td.pl1,td.pl2,td.pl3,td.pl4,td.fc1,td.fc2,td.fc3,td.fc4,td.share,td.variance,td.pos_pos,td.pos_neg,td.neg_pos,td.neg_neg,td.pos_neutral,td.neg_neutral{text-align:right}.category-w100{min-width:100em;max-width:100em}.category-w50{min-width:50em;max-width:50em}.category-w25{min-width:25em;max-width:25em}.category-w20{min-width:20em;max-width:20em}.category-w15{min-width:15em;max-width:15em}.category-w10{min-width:10em;max-width:10em}.category-w5{min-width:5em;max-width:5em}.prefix-second{color:transparent;font-style:normal}.prefix-first{font-style:normal}th{border-bottom:0.1em solid black;text-align:right;font-weight:normal;vertical-align:text-top}td.columnGroup,th.columnGroup{font-size:0.6em}td.columnSubGroup,th.columnSubGroup{font-size:0.6em;border-spacing:0em 0;font-style:italic}td.base,th.base{font-style:normal}th.ofit,td.ofit,tr.ofit,th.partof,td.partof,tr.partof{font-size:0.6em;font-style:italic}td.ofit,td.partof{font-size:0.6em;font-style:italic}th.ofit td,tr.ofit td,th.partof td,tr.partof td{border-top:0em solid black;padding-left:1em}th.ofit share,th.partof share,tr.share td{border-top:0em solid black}th.share,tr.share,td.share{font-size:0.6em;font-style:italic}th.filler{border-bottom:0em solid black;text-align:right}td.filler{border-top:0em none !important;border-bottom:0em none;text-align:right}th.group{text-align:center;border-spacing:1em 0}th.headerlabel{border-bottom:0em none black;padding-bottom:0em}td.variance:after{content:"%"}td.relative_variance{font-style:italic}td.percent{font-style:italic;text-align:right}td.decimal{text-align:right}td.pos_pos{color:#008f96}td.neg_pos{color:#ff0000}td.pos_neg{color:#ff0000}td.neg_neg{color:#008f96}td.pos_pos:before{content:"+"}td.pos_neg:before{content:"+"}td.pos_neu:before{content:"+"}th.ac1,th.ac2,th.ac3,th.ac4{padding-top:0em;border-bottom:0.3em solid black}th.pp1,th.pp2,th.pp3,th.pp4{padding-top:0em;border-bottom:0.3em solid grey}th.pl1,th.pl2,th.pl3,th.pl4{padding-top:0em;border-bottom:0.3em double black}th.fc1,th.fc2,th.fc3,th.fc4{border-bottom:0.3em solid;border-image:repeating-linear-gradient(-45deg, white, white, black, white, white 0.3em) 2}td.colsum{font-weight:bold}th.colsum{padding-top:0em;font-weight:bold}tr.sum td{border-top:0.1em solid black;font-weight:bold;padding-bottom:0.5em}tr.groupheader td{border-top:0em dotted #ddd;padding-top:0.5em;font-weight:bold;font-style:italic}tr.begingroup td{border-top:0em dotted #ddd;padding-top:0.5em}th.begin-group{padding-left:0.75em}th.end-group{padding-left:0.75em}td{box-sizing:border-box;-webkit-box-sizing:border-box;border-top:0.1em dashed #ddd;padding-left:0.5em;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.table-footer{font-size:0.6em}.cell-bar-chart{display:inline-block;vertical-align:middle}.bar-chart-empty{color:#999}td:has(.cell-bar-chart){padding:0 0.25em;vertical-align:middle}td:has(.cell-bar-chart).pos_pos:before,td:has(.cell-bar-chart).pos_neg:before,td:has(.cell-bar-chart).pos_neu:before{content:none}td:has(.cell-bar-chart).variance:after{content:none}'}},[1,"ibcs-table",{data:[16],tableTitle:[1,"table-title"],scenarios:[16],scenariosDataFormat:[1,"scenarios-data-format"],grouped:[4],limit:[2],showGroupTitle:[4,"show-group-title"],thereof:[16],partof:[16],order:[16],categorythereof:[16],type:[1],categoryWidth:[1,"category-width"],dataFormatDigits:[16],i18n:[1040],i18nMode:[1,"i18n-mode"],measureScale:[1,"measure-scale"],measureUnit:[1,"measure-unit"],showMeasureScale:[4,"show-measure-scale"],measureType:[1,"measure-type"],filter:[1],barColumns:[16],barColumnMaxWidth:[2,"bar-column-max-width"],unitScaling:[2,"unit-scaling"],percentageScaling:[2,"percentage-scaling"],scaleFactor:[2,"scale-factor"]}]);function X(){"undefined"!=typeof customElements&&["ibcs-table"].forEach((t=>{"ibcs-table"===t&&(customElements.get(n(t))||customElements.define(n(t),J))}))}export{J as I,y as T,X as d}
|
|
1
|
+
import{h as t,proxyCustomElement as e,HTMLElement as o,Host as n,transformTag as s}from"@stencil/core/internal/client";import{F as i,Q as r,V as l,I as a}from"./formatter.js";import{S as c,I as h,D as u,C as f,d,M as p}from"./CompareUtil.js";import{D as $}from"./luxon.js";import{a as m,b as v}from"./DateStringFactory.js";import{d as g,g as R}from"./context-protocol.js";import{D as w,a as S,b as E}from"./DataFormatDigits.js";import{A as b,c as y}from"./Order.js";import{S as O}from"./StringAdapter.js";import{S as M}from"./SiPrefix.js";import{w as U}from"./withComponentStyle.js";var T,G,_,N,C;!function(t){t[t.ALL=-1]="ALL"}(T||(T={})),function(t){t[t.UP_TO_DATE=0]="UP_TO_DATE",t[t.DIRTY=1]="DIRTY"}(G||(G={})),function(t){t.LIST="list",t.SUM="sum",t.SUMNOTOTAL="sumnototal",t.OPT="opt",t.OPTNOTOTAL="optnototal"}(_||(_={})),function(t){t.ASC="asc",t.DESC="desc"}(N||(N={})),function(t){t.HEADER="HEADER",t.GROUPHEAD="GROUPHEAD",t.SEPERATORLINE="SEPERATORLINE",t.SUM="SUM",t.GROUPSUM="GROUP_SUM",t.DRILLELEMENT="DRILLELEMENT",t.STANDARD="STANDARD",t.PARTELEMENT="PARTELEMENT",t.ENTRY="ENTRY"}(C||(C={}));const L="none",x="setname";function k(t){return t===x?"COALESCE([setname],[setName])":`normalizeDate([date], '${t}')`}function P(t){if(null==t)return"";if("string"==typeof t)return t.trim();const e=A(t);return e?e.toISO():String(t)}function A(t){if(null!=t){if("string"==typeof t){const e=$.fromISO(t);return e.isValid?e:void 0}if("number"==typeof t){const e=$.fromMillis(t);return e.isValid?e:void 0}if("boolean"==typeof t.isValid)return t.isValid?t:void 0}}class D{constructor(t,e,o,n,s,i,r,l,a){this.prefixStyle="prefix",this.isBarChart=!1,this.key=t,this.index=e,this.value=o,this.prefix=i||"",this.cssStyle=n||"",this.prefixStyle=r||"prefix",this.type=s,this.mark=void 0,this.colSpan=l||1,this.measureScale=a||1}getAsHeaderList(){if(null==this.value)return[""];const t=[];for(const e of this.value.toString().split("<br/>"))t.push(e);return t}draw(t){let e=this.value;if("undefined"===e||void 0===e||null==e)return"";if(Number.isNaN(Number(e)))return e;if(""===this.type||void 0===this.type||null==this.type)return e;let o=t.percent,n=t.percent;return"decimal"===this.type&&(e=+e/this.measureScale,o=t.decimal,n=t.decimal),i.number(Number(e),this.type,o,n)}drawPrefix(){return null==this.prefix?"":this.prefix}}class B{constructor(t,e,o){this.index=t,this.groupindex=e,this.type=o,this.cssStyle=this.initCssStyle(),this.elements=[]}initCssStyle(){switch(this.type){case C.HEADER:return"groupheader";case C.SEPERATORLINE:return"";case C.DRILLELEMENT:return"ofit";case C.PARTELEMENT:return"partof";case C.STANDARD:return"";case C.SUM:return"sum";default:return""}}getCells(){return this.elements}createElement(t,e,o,n,s,i,r,l,a,c=!1,h,u=1,f){let d=i;"category"===e&&null!=l&&(d=`category-${l.toString()}`),this.type===C.HEADER?d="headerlabel":this.type===C.SEPERATORLINE&&(d=e),this.type===C.PARTELEMENT&&("percent"===n&&(t="-"),"category"!==e&&"operation"!==e&&(n="percent",d="")),"-"===t&&(d="");let p="prefix-first";r&&(p="prefix-second"),o&&(d=`${d} ${o}`);const $=new D(e,this.elements.length,t,d,n,s,p,u,a);$.isBarChart=c,$.columnStats=h,$.waterfall=f,this.elements.push($)}}const F={positive:{stroke:"#008f96",fill:"#008f96",fillpattern:"solid"},negative:{stroke:"#ff0000",fill:"#ff0000",fillpattern:"solid"},neutral:{stroke:"#808080",fill:"#808080",fillpattern:"outlined"},scenarios:{ac:{stroke:"#404040",fill:"#404040",fillpattern:"solid"},pp:{stroke:"#A6A6A6",fill:"#A6A6A6",fillpattern:"solid"},fc:{stroke:"#404040",fill:"#ffffff",fillpattern:"hatched"},pl:{stroke:"#404040",fill:"#ffffff",fillpattern:"outlined"}},fontColor:"#000000",fontSize:11,fontFamily:"'Noto Sans', sans-serif",unitScaling:.01,percentageScaling:.5,scaleFactor:1},Y="#666666";function W(t,e){return`pattern-${t}-${e.replace("#","")}`}const H=({styles:e})=>{const o=e.scaleFactor,n=6*o,s=[{id:W("pos",e.positive.stroke),stroke:e.positive.stroke,fill:e.positive.fill},{id:W("neg",e.negative.stroke),stroke:e.negative.stroke,fill:e.negative.fill},{id:W("neu",e.neutral.stroke),stroke:e.neutral.stroke,fill:e.neutral.fill},...["ac","pp","fc","pl"].map((t=>({id:W(t,e.scenarios[t].stroke),stroke:e.scenarios[t].stroke,fill:e.scenarios[t].fill})))];return t("defs",null,s.map((e=>t("pattern",{id:e.id,patternUnits:"userSpaceOnUse",width:n,height:n},t("rect",{width:n,height:n,fill:"#ffffff"}),t("line",{x1:"0",y1:n,x2:n,y2:"0",stroke:e.stroke,"stroke-width":1.5*o})))))};function I(t,e,o=1){let n,s;const i=t>=0?"+":"";if(e)return n=100*t,i+Math.round(n).toString()+"%";{let e;return n=t/o,s=Math.abs(n),e=s>=1e9?(n/1e9).toFixed(s>=1e10?0:1)+"B":s>=1e6?(n/1e6).toFixed(s>=1e7?0:1)+"M":s>=1e3?(n/1e3).toFixed(s>=1e4?0:1)+"K":n.toFixed(s>=10?0:1),e=e.replace(/\.0([KMB]?)$/,"$1"),i+e}}function j(t){const e=t.slice(0,2).toLowerCase();return["ac","pp","fc","pl"].includes(e)}function z(t){const e=t.slice(0,2).toLowerCase();return"pp"===e?"pp":"fc"===e?"fc":"pl"===e?"pl":"ac"}function V(t,e,o,n){return j(t)?function(t,e){const o=z(t);return e.scenarios[o]}(t,n):function(t,e,o){const n=t>=0;return e?n?o.positive:o.negative:n?o.negative:o.positive}(e,o,n)}function Q(t,e){const o=t.fillpattern;return"hatched"===o?`url(#${W(e,t.stroke)})`:"outlined"===o?"transparent":t.fill}function q(t){return"outlined"===t.fillpattern?{stroke:t.stroke,strokeWidth:1.5}:{stroke:"none",strokeWidth:0}}const K=e=>{const{value:o,scenario:n,columnStats:s,height:i,isPositiveGood:r,formattedValue:l,measureScale:a,maxBarWidth:c=10,styles:h=F}=e,u=h.scaleFactor,f=h.fontSize,d=38*u,p=c*f,$=4*u,m=.15*p,v=p-$-m,g=Math.abs(o)*h.unitScaling*f,R=g>v,w=Math.max(0,s.absMax*h.unitScaling*f-v),S=Math.max(0,g-v),E=w>0?S/w*m:0,b=s.min<0,y=s.max>0,O=b?p:0,M=(b?d:0)+(O+(y?p:0))+(y?d:0),U=2*u,T=i-2*U,G=(b?d:0)+O,_=U,N=o>=0,C=V(n,o,r,h),L=Q(C,j(n)?z(n):r?N?"pos":"neg":N?"neg":"pos"),{stroke:x,strokeWidth:k}=q(C),P=l||I(o,!1,a),A=R?v:g,D=R?v+$+E:g,B=N?G+D+4*u:G-D-4*u,W=N?"start":"end";return t("svg",{width:M,height:i,class:"cell-bar-chart absolute-variance",style:{overflow:"visible"}},t(H,{styles:h}),t("line",{x1:G,y1:0,x2:G,y2:i,stroke:Y,"stroke-width":1*u}),A>0&&t("rect",{x:N?G:G-A,y:_,width:A,height:T,fill:L,stroke:x,"stroke-width":k*u}),R&&E>0&&t("rect",{x:N?G+v+$:G-v-$-E,y:_,width:E,height:T,fill:L,stroke:x,"stroke-width":k*u}),R&&function(e,o,n,s,i){const r=e+o/2,l=.35*o,a=s/3,c=.3*o;let h=`M ${r-l} ${n}`;for(let t=0;t<3;t++)h+=` L ${r-l-c} ${n+a*(t+.5)} L ${r-l} ${n+a*(t+1)}`;let u=`M ${r+l} ${n}`;for(let t=0;t<3;t++)u+=` L ${r+l+c} ${n+a*(t+.5)} L ${r+l} ${n+a*(t+1)}`;return[t("rect",{x:e,y:n-1,width:o,height:s+2,fill:"#ffffff"}),t("path",{d:h,fill:"none",stroke:"#000000","stroke-width":1*i}),t("path",{d:u,fill:"none",stroke:"#000000","stroke-width":1*i})]}(N?G+v:G-v-$,$,_,T,u),t("text",{x:B,y:i/2,dy:"0.35em","text-anchor":W,fill:h.fontColor,"font-size":f,"font-family":h.fontFamily},P))},X=e=>{const{value:o,scenario:n,columnStats:s,height:i,isPositiveGood:r,formattedValue:l,measureScale:a,maxBarWidth:c=10,styles:h=F}=e,u=h.scaleFactor,f=h.fontSize,d=Math.round(.67*c*f),p=5*u,$=s.min<0?d+p:0,m=$+(s.max>0?d+p:0),v=m+45*u,g=$,R=i/2,w=100*Math.abs(o)*h.percentageScaling*f,S=w>d,E=Math.min(w,d),b=o>=0,y=b?g+E:g-E,O=V(n,o,r,h),M=3*u,U=l||I(o,!0,a),T=m+4*u;return t("svg",{width:v,height:i,class:"cell-bar-chart relative-variance",style:{overflow:"visible"}},t("line",{x1:g,y1:0,x2:g,y2:i,stroke:Y,"stroke-width":1*u}),!S&&t("circle",{cx:y,cy:R,r:M,fill:h.fontColor}),t("line",{x1:g,y1:R,x2:y,y2:R,stroke:O.fill,"stroke-width":2*u}),S&&b&&t("polygon",{points:`${g+d},${R} ${g+d-6*u},${R-3*u} ${g+d-6*u},${R+3*u}`,fill:O.fill}),S&&!b&&t("polygon",{points:`${g-d},${R} ${g-d+6*u},${R-3*u} ${g-d+6*u},${R+3*u}`,fill:O.fill}),t("text",{x:T,y:i/2,dy:"0.35em","text-anchor":"start",fill:h.fontColor,"font-size":f,"font-style":"italic","font-family":h.fontFamily},U))},J=e=>{const{value:o,columnStats:n,isRelative:s,styles:i=F}=e;return null==o||isNaN(o)||!n||0===n.absMax?t("span",{class:"bar-chart-empty",style:{color:i.fontColor,fontStyle:"italic"}},"-"):t(s?X:K,Object.assign({},e))},Z=e=>{const{value:o,scenario:n,height:s,measureScale:i,maxBarWidth:r=10,styles:l=F,waterfall:a}=e,c=l.scaleFactor,h=l.fontSize,u=a.max-a.min;if(null==o||isNaN(o)||u<=0)return t("span",{class:"bar-chart-empty",style:{color:l.fontColor,fontStyle:"italic"}},"-");const f=38*c,d=r*h,p=f+d+f,$=d/u,m=t=>f+(t-a.min)*$,v=2*c,g=s-2*v,R=v,w=m(0),S=m(a.start),E=m(a.end),b=Math.min(S,E),y=Math.abs(E-S),O=V(n,o,!1,l),M=Q(O,z(n)),{stroke:U,strokeWidth:T}=q(O),G=I(o,"partof"===a.kind,i).replace(/^\+/,""),_=E<S,N=_?b-4*c:b+y+4*c,C=_?"end":"start";return t("svg",{width:p,height:s,class:"cell-bar-chart waterfall-bar",style:{overflow:"visible"}},t(H,{styles:l}),t("line",{x1:w,y1:0,x2:w,y2:s,stroke:Y,"stroke-width":1*c}),void 0!==a.parentStart&&void 0!==a.parentEnd&&t("line",{x1:m(a.parentStart),y1:0,x2:m(a.parentStart),y2:s,stroke:Y,"stroke-width":1*c,"stroke-dasharray":`${2*c},${2*c}`}),void 0!==a.parentStart&&void 0!==a.parentEnd&&t("line",{x1:m(a.parentEnd),y1:0,x2:m(a.parentEnd),y2:s,stroke:Y,"stroke-width":1*c,"stroke-dasharray":`${2*c},${2*c}`}),y>0&&t("rect",{x:b,y:R,width:y,height:g,fill:M,stroke:U,"stroke-width":T*c}),t("text",{x:N,y:s/2,dy:"0.35em","text-anchor":C,fill:l.fontColor,"font-size":h,"font-family":l.fontFamily},G))};class tt{constructor(t){this.groups=[r.CATEGORY,r.CATEGORYINDEX],_.OPT!==t.type&&_.OPTNOTOTAL!==t.type||this.groups.unshift(r.OPERATION),t.grouped&&(this.groups.push(r.ROWGROUP),this.groups.push(r.ROWGROUPINDEX))}toString(){return this.groups.map((t=>`${t}`)).toString()}noCategory(){return this.groups.filter((t=>t!==r.CATEGORY))}toArray(){return this.groups}}class et{constructor(t,e){this.hasPartOf=!1,this.config=t,this.i18n=e}execute(t,e){var o;this.db=t,this.fromExpr=e;const n=[],s=[],i=[],l=this.config.scenarios.map((t=>this.translateScenarioSQL(t,!1,this.config.type))).toString(),a=this.config.scenarios.map((t=>this.translateScenarioSQL(t,!0,this.config.type))).toString(),c=this.getRelativeScenarios(),h=this.config.attributes.map((t=>this.translateAttributeSQL(t))).toString(),u=new tt(this.config),f=this.config.grouped?[r.ROWGROUP,r.ROWGROUPINDEX]:[];let d,p=["",""];this.config.sortOrder.hierarchy.length>0&&(p=this.createOrderString(this.config.sortOrder)),this.hasPartOf=this.checkConfigForPartOf();try{d=t.exec(`SELECT COUNT(DISTINCT ${r.CATEGORY}) as ${r.TOTALROWCOUNT} ${f.length>0?","+f:""}\n FROM ${e} ${f.length>0?"GROUP BY "+f:""}\n ORDER BY ${p[0]}`)}catch(t){return console.error("DataQuery: meta query failed",t),[]}return 0===d.length||1===d.length&&0===(null!==(o=d[0][r.TOTALROWCOUNT])&&void 0!==o?o:0)&&0===f.length?[]:(d.forEach((t=>{const e=t.rowGroup&&t.rowGroup.length>0?`WHERE ${r.ROWGROUP} = '${t.rowGroup}'`:"";let o="";this.config.limit&&(o=`LIMIT ${this.config.limit}`),this.createGroupHeaderRow(t,n),this.createDataRow(n,t,u,l,h,e,p,o),this.createRestRow(t,n,u,l,e,p),this.createGroupSumRow(n,s,t,a,p)})),this.createTotalSumRow(n,s,a),n.forEach((e=>{try{i.push(t.exec(e))}catch(t){console.error("DataQuery: SQL query execution failed",e,t)}})),this.detectNaNCells(this.config.scenarios,i),this.createThereOfDrillRows(l,h,p,i),this.createPartOfDrillRows(l,p,s,i),this.createIntervalColumns(i),this.createThereOfDrillColumns(this.config.categoryThereOf,i),this.calculateColumnGroupRest(i,this.config.categoryThereOf),this.calculateRelativeVariances(i,c),i)}detectNaNCells(t,e){e.forEach((e=>{e.map((e=>(t.forEach((t=>{const o=new l(t);!0===o.isValid?0!==e[o.base+"_cnt"]&&0!==e[o.delta+"_cnt"]||(e[t]=Number.NaN):0===e[t+"_cnt"]&&(e[t]=Number.NaN)})),e)))}))}createPartOfDrillRows(t,e,o,n){if(null==this.config.partOf||0===this.config.partOf.length||this.config.type===_.LIST)return;const s=this.createPartOfQuery(t,e);let i=[];const l=this.db;s.forEach((function(t){i.push(...l.exec(t))}));const a=this.exctractScenarioNames(t),c=[];o.forEach((function(t){c.push(...l.exec(t))}));const h=new Map;c.forEach((t=>h.set(t[r.ROWGROUP],t))),i=this.reduceResDrillByCategoryGroups(i,a),i.forEach((function(t){a.forEach((e=>{try{t[e]=t[e]/h.get(t[r.ROWGROUP])[e]}catch(o){console.error("DataQuery: partOf drill row calculation failed",e,o),t[e]=Number.NaN}}))})),this.injectDrillRowsToResultRows(i,n)}createRestRow(t,e,o,n,s,i){if(t.totalRowCnt-this.config.limit>0&&0!==this.config.limit){const l=this.exctractScenarioNames(n).map((t=>`SUM(${t}) as ${t}`)).join(", ");e.push(`SELECT ${r.ROWNR}, 1 as ${r.ROWGROUPINDEX} , 'ENTRY' as ${r.TYPE}, 'NO_GROUP' as ${r.ROWGROUP}, 'REST' as ${r.CATEGORY} ${l.length>0?", "+l:""} FROM (SELECT ROWNUM() AS ${r.ROWNR}, ${e.length} as ${r.ROWGROUPINDEX} , 'ENTRY' as ${r.TYPE}, '${t.rowGroup||"NO_GROUP"}' as ${r.ROWGROUP}, ${o} ${n.length>0?",".concat(n):""} FROM ${this.fromExpr} ${s} GROUP BY ${o} ORDER BY ${i[0]}) t WHERE t.rowNr > ${this.config.limit}`)}}createDataRow(t,e,o,n,s,i,l,a){t.push(`SELECT ROWNUM() AS ${r.ROWNR},\n ${t.length} as ${r.ROWGROUPINDEX},\n 'ENTRY' as ${r.TYPE},\n '${e.rowGroup||"NO_GROUP"}' as ${r.ROWGROUP},\n '${r.CATEGORYINDEX}',\n ${o} ${n.length>0?",".concat(n):""} ${s.length>0?",".concat(s):""}\n FROM ${this.fromExpr} ${i}\n GROUP BY ${o}\n ORDER BY ${l[0]} ${a}`)}createGroupHeaderRow(t,e){!0===this.config.grouped&&e.push(`SELECT ROWNUM() AS ${r.ROWNR},\n ${e.length} as ${r.ROWGROUPINDEX},\n 'GROUPHEAD' as ${r.TYPE},\n '${t.rowGroup}' as ${r.ROWGROUP} ${this.config.showGroupTitle?`,'${t.rowGroup}' as ${r.CATEGORY}`:""}\n FROM ${this.fromExpr}\n GROUP BY '1'`)}createGroupSumRow(t,e,o,n,s){!0!==this.config.grouped||_.SUM!==this.config.type&&_.SUMNOTOTAL!==this.config.type&&_.OPT!==this.config.type&&_.OPTNOTOTAL!==this.config.type||(t.push(`SELECT ${t.length} as ${r.ROWGROUPINDEX},\n '=' as ${r.OPERATION},\n '${o.rowGroup}' as ${r.ROWGROUP},\n ROWNUM() AS ${r.ROWNR},\n 'GROUP_SUM' as ${r.TYPE} ${n.length>0?",".concat(n):""}\n FROM ${this.fromExpr}\n WHERE ${r.ROWGROUP} = '${o.rowGroup}'\n ORDER BY ${s[0]} `),e.push(`SELECT ${t.length} as ${r.ROWGROUPINDEX},\n '=' as ${r.OPERATION},\n '${o.rowGroup}' as ${r.ROWGROUP},\n ROWNUM() AS ${r.ROWNR},\n 'GROUP_SUM' as ${r.TYPE} ${n.length>0?",".concat(n):""}\n FROM ${this.fromExpr}\n WHERE ${r.ROWGROUP} = '${o.rowGroup}'\n ORDER BY ${s[0]} `))}createTotalSumRow(t,e,o){var n;if(_.SUM===this.config.type||_.OPT===this.config.type){const e=(null===(n=this.config.title)||void 0===n?void 0:n.trim())||"SUM_TOTAL",s=this.hasPartOf&&!1===this.config.grouped&&"SUM_TOTAL"!==e?`${this.i18n.get("SUM_TOTAL")||"SUM_TOTAL"} ${e}`:e;t.push(`SELECT ${t.length} as ${r.ROWGROUPINDEX},\n '${s}' as ${r.ROWGROUP},\n '=' as ${r.OPERATION},\n 'SUM' as ${r.TYPE} ${o.length>0?",".concat(o):""}\n FROM ${this.fromExpr} `)}e.push(`SELECT ${t.length} as ${r.ROWGROUPINDEX},\n 'SUM_TOTAL' as ${r.ROWGROUP},\n '=' as ${r.OPERATION},\n 'SUM' as ${r.TYPE} ${o.length>0?",".concat(o):""}\n FROM ${this.fromExpr} `)}reduceResDrillByCategoryGroups(t,e){const o=new Map;return t.forEach((function(t){const n=t.rowNr+t.rowGroup+t.type+t.category;if(o.has(n)){const s=o.get(n);e.forEach((e=>{try{s[e]+=t[e]}catch(t){console.error("DataQuery: drill row aggregation failed",e,t)}}))}else o.set(n,t)})),[...o.values()]}injectDrillRowsToResultRows(t,e){const o=new Map;if(!0===this.config.grouped)t.forEach((function(t){e.forEach((function(e){const n=e.findIndex((e=>e.category===t.category&&e.rowGroup===t.rowGroup));if(n>=0){if(o.has(`${t.category}_${t.rowGroup}`)){const e=o.get(`${t.category}_${t.rowGroup}`)||0;o.set(`${t.category}_${t.rowGroup}`,e+1)}else o.set(`${t.category}_${t.rowGroup}`,1);t[r.ROWNR]=o.get(`${t.category}_${t.rowGroup}`),e.splice(n+t[r.ROWNR],0,t)}}))}));else{const n=this.findDuplicateSubCategories(t);t.forEach((function(t){e.forEach((function(e){const s=e.findIndex((e=>null!=e.category&&e.category===t.category));if(s>=0){if(o.has(`${t.category}`)){const e=o.get(`${t.category}`)||0;o.set(`${t.category}`,e+1)}else o.set(`${t.category}`,1);(1===t[r.ROWNR]||n.includes(t.subCategory))&&(t.subCategory=`${t.subCategory} (${t.rowGroup})`),e.splice(s+t[r.ROWNR],0,t)}}))}))}}createThereOfDrillRows(t,e,o,n){if(void 0===this.config.thereOf||0===this.config.thereOf.length)return;const s=[],i=[];this.config.thereOf.forEach((n=>{let i=!0,l="1 <> 1 OR ( ";null!=n.category&&0!==n.category.length&&n.category.trim()&&(l+=` ${r.CATEGORY} = '${n.category}'`,i=!1),null!=n.rowGroup&&0!==n.rowGroup.length&&n.rowGroup.trim()&&(l+=` ${i?"":"AND"} ${r.ROWGROUP} = '${n.rowGroup}'`,i=!1),null!=n.subCategory&&0!==n.subCategory.length&&n.subCategory.trim()&&(l+=` ${i?"":"AND"} ${r.SUBCATEGORY} = '${n.subCategory}'`),l+=")",s.push(`SELECT ROWNUM() AS ${r.ROWNR},\n null as operation,\n 'DRILLELEMENT' as ${r.TYPE},\n ${r.CATEGORY},\n ${r.SUBCATEGORY},\n ${r.ROWGROUP} as ${r.ROWGROUP},\n ${t} ${e.length>0?",".concat(e):""}\n FROM ${this.fromExpr}\n WHERE ${l}\n GROUP BY ${r.ROWGROUP}, ${r.CATEGORY}, ${r.SUBCATEGORY}\n ORDER BY ${o[1]}`)}));const l=this.db;s.forEach((function(t){i.push(...l.exec(t))})),this.injectDrillRowsToResultRows(i,n)}calculateRelativeVariances(t,e){t.forEach((t=>{t.forEach((t=>{"GROUPHEAD"!==t[r.TYPE]&&e.forEach(((e,o)=>{t[o]=t[o]/t[e]}))}))}))}calculateColumnGroupRest(t,e){if(null==e||0===e.size)return;const o=new Map,n=new Map;e.forEach(((t,e)=>{const s=t,i=[];for(const t of s)i.push(`${e}##${t.name}`);o.set(e,i),n.set(`${e}##REST`,!1)})),t.forEach((t=>{t.forEach((t=>{"GROUPHEAD"!==t[r.TYPE]&&o.forEach(((e,o)=>{let s=0;e.forEach((e=>{void 0!==t[e]&&(s+=t[e])})),t[`${o}##REST`]=t[o]-s,0!==t[`${o}##REST`]&&n.set(`${o}##REST`,!0)}))}))}));const s=Array.from(n.entries()).filter((([t,e])=>!e)).map((([t])=>t));t.forEach((t=>{t.forEach((t=>{for(const e of s)delete t[e]}))}))}createIntervalColumns(t){var e,o,n,s,i;if(this.config.interval===L||this.config.categoryThereOf.size>0||0===this.config.scenarios.length)return;const a="##",c=`(SELECT *, ${k(this.config.interval)} as __interval FROM ${this.fromExpr}) as p`,h=this.config.scenarios.map((t=>this.translateScenarioSQL(t,!1,this.config.type))).toString(),u=this.config.scenarios.map((t=>this.translateScenarioSQL(t,!0,this.config.type))).toString(),f=this.exctractScenarioNames(h),d=this.getRelativeScenarios(),p=new tt(this.config),$=_.OPT===this.config.type||_.OPTNOTOTAL===this.config.type,m=this.config.grouped&&(_.SUM===this.config.type||_.SUMNOTOTAL===this.config.type||_.OPT===this.config.type||_.OPTNOTOTAL===this.config.type),v=this.checkConfigForPartOf()&&this.config.type!==_.LIST,g=t=>{try{return this.db.exec(t)}catch(e){return console.error("DataQuery: interval query failed",t,e),[]}},R=t=>(this.config.scenarios.forEach((e=>{const o=new l(e);!0===o.isValid?0!==t[o.base+"_cnt"]&&0!==t[o.delta+"_cnt"]||(t[e]=Number.NaN):0===t[e+"_cnt"]&&(t[e]=Number.NaN)})),d.forEach(((e,o)=>{t[o]=t[o]/t[e]})),t),w=(t,e,o)=>{for(const n of this.config.scenarios)t[n+a+o]=e[n]},S=g(`SELECT ${p}, __interval ${h.length>0?",".concat(h):""}\n FROM ${c}\n GROUP BY ${p}, __interval`);if(this.config.limit>0)for(let n=0;n<t.length;n++){const s=t[n].find((t=>"ENTRY"===t.type&&"REST"===t.category));if(!s)continue;let i;for(let e=n-1;e>=0&&!i;e--){const o=t[e].filter((t=>"ENTRY"===t.type&&"REST"!==t.category));o.length>0&&(i=o)}if(!i)continue;const r=new Set(i.map((t=>t.category))),l=i[0].rowGroup,a=new Map;for(const t of S){if(this.config.grouped&&t.rowGroup!==l)continue;if(r.has(t.category))continue;const n=P(t.__interval);let s=a.get(n);s||(s={},a.set(n,s));for(const n of f)s[n]=(null!==(e=s[n])&&void 0!==e?e:0)+(null!==(o=t[n])&&void 0!==o?o:0)}a.forEach(((t,e)=>{w(s,R(t),e)}))}for(const e of S){const o=P(e.__interval);R(e);for(const n of t)for(const t of n)"ENTRY"===t.type&&"REST"!==t.category&&t.category===e.category&&(this.config.grouped&&t.rowGroup!==e.rowGroup||$&&t.operation!==e.operation||w(t,e,o))}const E=m||v&&this.config.grouped?g(`SELECT ${r.ROWGROUP}, __interval ${u.length>0?",".concat(u):""}\n FROM ${c}\n GROUP BY ${r.ROWGROUP}, __interval`):[],b=new Map;if(E.forEach((t=>b.set(`${t.rowGroup}${a}${P(t.__interval)}`,t))),m)for(const e of E){const o=P(e.__interval),n=R(Object.assign({},e));for(const s of t)for(const t of s)"GROUP_SUM"===t.type&&t.rowGroup===e.rowGroup&&w(t,n,o)}const y=_.SUM===this.config.type||_.OPT===this.config.type,O=y||v&&!this.config.grouped?g(`SELECT __interval ${u.length>0?",".concat(u):""}\n FROM ${c}\n GROUP BY __interval`):[],M=new Map;if(O.forEach((t=>M.set(P(t.__interval),t))),y)for(const e of O){const o=P(e.__interval),n=R(Object.assign({},e));for(const e of t)for(const t of e)"SUM"===t.type&&w(t,n,o)}if(null!=this.config.thereOf&&this.config.thereOf.length>0){const e=[];this.config.thereOf.forEach((t=>{e.push(...g(`SELECT ${r.ROWGROUP}, ${r.CATEGORY}, ${r.SUBCATEGORY}, __interval ${h.length>0?",".concat(h):""}\n FROM ${c}\n WHERE ${this.createThereOfWhereClause(t)}\n GROUP BY ${r.ROWGROUP}, ${r.CATEGORY}, ${r.SUBCATEGORY}, __interval`))}));for(const o of e){const e=P(o.__interval);R(o);for(const n of t)for(const t of n)"DRILLELEMENT"===t.type&&t.category===o.category&&(t.subCategory!==o.subCategory&&t.subCategory!==`${o.subCategory} (${o.rowGroup})`||w(t,o,e))}}if(v){let e="1 <> 1 ";null===(n=this.config.partOf)||void 0===n||n.forEach((t=>{e+=`OR (${r.CATEGORY} = '${t.category}'`,null!=t.rowGroup&&0!==t.rowGroup.length&&t.rowGroup.trim()&&(e+=`and ${r.ROWGROUP} = '${t.rowGroup}'`),e+=")"}));const o=g(`SELECT ${r.CATEGORY}, ${this.config.grouped?`${r.ROWGROUP}`:`'SUM_TOTAL' as ${r.ROWGROUP}`}, __interval ${h.length>0?",".concat(h):""}\n FROM ${c}\n WHERE ${e}\n GROUP BY ${r.ROWGROUP}, ${r.CATEGORY}, __interval`),l=new Map;for(const t of o){const e=`${t.rowGroup}${a}${t.category}${a}${P(t.__interval)}`,o=l.get(e);if(o)for(const e of f)o[e]=(null!==(s=o[e])&&void 0!==s?s:0)+(null!==(i=t[e])&&void 0!==i?i:0);else l.set(e,t)}l.forEach((e=>{const o=P(e.__interval),n=this.config.grouped?b.get(`${e.rowGroup}${a}${o}`):M.get(o);for(const t of f)e[t]=e[t]/(n?n[t]:Number.NaN);R(e);for(const n of t)for(const t of n)"PARTELEMENT"===t.type&&t.category===e.category&&t.rowGroup===e.rowGroup&&w(t,e,o)}))}}createThereOfWhereClause(t){let e=!0,o="1 <> 1 OR ( ";return null!=t.category&&0!==t.category.length&&t.category.trim()&&(o+=` ${r.CATEGORY} = '${t.category}'`,e=!1),null!=t.rowGroup&&0!==t.rowGroup.length&&t.rowGroup.trim()&&(o+=` ${e?"":"AND"} ${r.ROWGROUP} = '${t.rowGroup}'`,e=!1),null!=t.subCategory&&0!==t.subCategory.length&&t.subCategory.trim()&&(o+=` ${e?"":"AND"} ${r.SUBCATEGORY} = '${t.subCategory}'`),o+")"}getRelativeScenarios(){const t=new Map;return this.config.scenarios.forEach((e=>{const o=this.createRelativeScenario(e);null!=o&&t.set(o.key,o.value)})),t}translateScenarioSQL(t,e,o){const n=new l(t);return _.OPT===o||_.OPTNOTOTAL===o?n.isValid?"dr"===n.type?`SUM(${n.base} - ${n.delta}) as ${t}, SUM(${n.delta}) as dr_${n.delta}`:`SUM(${n.base} - ${n.delta}) as ${t}`:e?`SUM(${t} * transformOperator(operation)) as ${t}, COUNT(ISNULL(${t})) as ${t}_cnt`:`SUM(${t}) as ${t}, COUNT(ISNULL(${t})) as ${t}_cnt`:n.isValid?"dr"===n.type?`SUM((${n.base} * transformOperator(operation)) - (${n.delta} * transformOperator(operation))) as ${t}, SUM(${n.delta} * transformOperator(operation)) as dr_${n.delta}`:`SUM((${n.base} * transformOperator(operation))- (${n.delta} * transformOperator(operation))) as ${t}`:`SUM(${t} * transformOperator(operation)) as ${t}, COUNT(ISNULL(${t})) as ${t}_cnt`}translateAttributeSQL(t){const e=`[${t.arg}]`,o=/^(ac|pp|fc|pl)[1-4]$/.test(t.arg)&&this.config.type!==_.OPT&&this.config.type!==_.OPTNOTOTAL;switch(t.fn){case"set":return`SETAGG(${e}) as ${t.alias}`;case"first":return`FIRST(${e}) as ${t.alias}`;case"last":return`LAST(${e}) as ${t.alias}`;case"min":return`MIN(${e}) as ${t.alias}`;case"max":return`MAX(${e}) as ${t.alias}`;case"avg":return o?`AVG(${e} * transformOperator(operation)) as ${t.alias}`:`AVG(${e}) as ${t.alias}`;case"sum":return o?`SUM(${e} * transformOperator(operation)) as ${t.alias}`:`SUM(${e}) as ${t.alias}`;case"lit":return`${this.sqlLiteral(t.arg)} as ${t.alias}`}}sqlLiteral(t){return""===t||Number.isNaN(Number(t))?`'${t.replace(/'/g,"''")}'`:t}createOrderString(t){return[`${t.hierarchy.toString()} ${t.direction}`,`${t.hierarchy.toString()} ${N.ASC===t.direction?N.DESC:N.ASC}`]}createRelativeScenario(t){const e=new l(t);return e.isValid&&"dr"===e.type?{key:`${t}`,value:`dr_${e.delta}`}:null}exctractScenarioNames(t){const e=[];return t.split(",").forEach((t=>t.length>=2?e.push(t.split("as")[1].trim()):null)),e}findDuplicateSubCategories(t){const e=t.map((t=>({count:1,subCategory:t.subCategory}))).reduce(((t,e)=>(t[e.subCategory]=(t[e.subCategory]||0)+e.count,t)),{});return Object.keys(e).filter((t=>e[t]>1))}createPartOfQuery(t,e){var o;const n=[];let s="1 <> 1 ",i=` ${r.ROWGROUP}`,l="ROWNUM()";return null===(o=this.config.partOf)||void 0===o||o.forEach((t=>{s+=`OR (${r.CATEGORY} = '${t.category}'`,null!=t.rowGroup&&0!==t.rowGroup.length&&t.rowGroup.trim()&&(s+=`and ${r.ROWGROUP} = '${t.rowGroup}'`),!1===this.config.grouped&&(i=` 'SUM_TOTAL' as ${r.ROWGROUP} `,l="1"),s+=")"})),n.push(`SELECT ${l} AS ${r.ROWNR},\n 'PARTELEMENT' as ${r.TYPE},\n ${r.CATEGORY},\n ${i},\n ${t}\n FROM ${this.fromExpr}\n WHERE ${s}\n GROUP BY ${r.ROWGROUP}, ${r.CATEGORY}, ${r.TYPE}\n ORDER BY ${e[1]}`),n}checkConfigForPartOf(){return null!=this.config.partOf&&0!==this.config.partOf.length}createThereOfDrillColumns(t,e){if(null==t||0===t.size)return;const o=[],n=[],s=this.fromExpr;t.forEach(((t,e)=>{let n="1 <> 1 ";t.forEach((t=>{n+=` or columnGroup = '${t.name}' `})),o.push(`SELECT 'ENTRY' as rowlevel,\n 'COLUMNGROUP' as columnlevel,\n rowGroup,\n category,\n columnGroup,\n '${e}' as scenario,\n sum(${e} * transformOperator(operation)) as val\n FROM ${s}\n WHERE ${n}\n GROUP BY rowlevel, rowGroup, category, columnGroup, scenario`),o.push(`SELECT 'ENTRY' as rowlevel,\n 'SUBGROUP' as columnlevel,\n rowGroup,\n category,\n columnGroup,\n columnSubGroup,\n '${e}' as scenario,\n sum(${e} * transformOperator(operation)) as val\n FROM ${s}\n WHERE ${n}\n GROUP BY rowlevel, rowGroup, category, columnGroup, columnSubGroup, scenario`),o.push(`SELECT 'DRILLELEMENT' as rowlevel,\n 'COLUMNGROUP' as columnlevel,\n rowGroup,\n category,\n subCategory,\n columnGroup,\n '${e}' as scenario,\n sum(${e} * transformOperator(operation)) as val\n FROM ${s}\n WHERE ${n}\n GROUP BY rowlevel, rowGroup, category, subCategory, columnGroup, scenario`),o.push(`SELECT 'DRILLELEMENT' as rowlevel,\n 'SUBGROUP' as columnlevel,\n rowGroup,\n category,\n subCategory,\n columnGroup,\n columnSubGroup,\n '${e}' as scenario,\n sum(${e} * transformOperator(operation)) as val\n FROM ${s}\n WHERE ${n}\n GROUP BY rowlevel, rowGroup, category, subCategory, columnGroup, columnSubGroup, scenario`),o.push(`SELECT 'GROUP_SUM' as rowlevel,\n 'COLUMNGROUP' as columnlevel,\n rowGroup,\n columnGroup,\n '${e}' as scenario,\n sum(${e} * transformOperator(operation)) as val\n FROM ${s}\n WHERE ${n}\n GROUP BY rowlevel, rowGroup, columnGroup, scenario`),o.push(`SELECT 'GROUP_SUM' as rowlevel,\n 'SUBGROUP' as columnlevel,\n rowGroup,\n columnGroup,\n columnSubGroup,\n '${e}' as scenario,\n sum(${e} * transformOperator(operation)) as val\n FROM ${s}\n WHERE ${n}\n GROUP BY rowlevel, rowGroup, columnGroup, columnSubGroup, scenario`),o.push(`SELECT 'SUM' as rowlevel,\n 'COLUMNGROUP' as columnlevel,\n columnGroup,\n '${e}' as scenario,\n sum(${e} * transformOperator(operation)) as val\n FROM ${s}\n WHERE ${n}\n GROUP BY rowlevel, columnGroup, scenario`),o.push(`SELECT 'SUM' as rowlevel,\n 'SUBGROUP' as columnlevel,\n columnGroup,\n columnSubGroup,\n '${e}' as scenario,\n sum(${e} * transformOperator(operation)) as val\n FROM ${s}\n WHERE ${n}\n GROUP BY rowlevel, columnGroup, columnSubGroup, scenario`)}));for(const t of o)n.push(...this.db.exec(t));this.injectDrillColumnsToResultRows(n,e)}injectDrillColumnsToResultRows(t,e){const o="##";for(const n of t)for(const t of e)for(const e of t)e.type===n.rowlevel&&("ENTRY"===n.rowlevel?"COLUMNGROUP"===n.columnlevel&&e.category===n.category?e[n.scenario+o+n.columnGroup]=n.val:"SUBGROUP"===n.columnlevel&&e.category===n.category&&(e[n.scenario+o+n.columnGroup+o+n.columnSubGroup]=n.val):"DRILLELEMENT"===n.rowlevel?"COLUMNGROUP"===n.columnlevel&&e.category===n.category&&e.subCategory===n.subCategory?e[n.scenario+o+n.columnGroup]=n.val:"SUBGROUP"===n.columnlevel&&e.category===n.category&&e.subCategory===n.subCategory?e[n.scenario+o+n.columnGroup+o+n.columnSubGroup]=n.val:"COLUMNGROUP"===n.columnlevel&&e.category===n.category&&e.subCategory===`${n.subCategory} (${n.rowGroup})`?e[n.scenario+o+n.columnGroup]=n.val:"SUBGROUP"===n.columnlevel&&e.category===n.category&&e.subCategory===`${n.subCategory} (${n.rowGroup})`&&(e[n.scenario+o+n.columnGroup+o+n.columnSubGroup]=n.val):("SUM"===n.rowlevel||"GROUP_SUM"===n.rowlevel)&&("COLUMNGROUP"===n.columnlevel&&e.category===n.category&&e.subCategory===n.subCategory&&(e[n.scenario+o+n.columnGroup]=n.val),"SUBGROUP"===n.columnlevel&&e.category===n.category&&e.subCategory===n.subCategory&&(e[n.scenario+o+n.columnGroup+o+n.columnSubGroup]=n.val)))}}class ot{constructor(){this.geometry=new Map}set(t,e,o){let n=this.geometry.get(t);n||(n=new Map,this.geometry.set(t,n)),n.set(e,o)}get(t,e){var o;return null===(o=this.geometry.get(t))||void 0===o?void 0:o.get(e)}}function nt(t,e,o){const n=t[e];if(null==n)return null;const s=Number(n);return isNaN(s)?null:o!==_.OPT&&o!==_.OPTNOTOTAL||t[r.TYPE]!==C.ENTRY||"-"!==t[r.OPERATION]?s:-s}class st{constructor(){this.normalizedHeader=[],this.attributesByAlias=new Map}createHeader(t,e,o,n,s,r,l=[]){const a=[];this.attributesByAlias=new Map(l.map((t=>[t.alias,t]))),this.normalizedHeader=this.normalizeHeader(t,e,l);const c=this.normalizedHeader.some((t=>void 0!==t.bucket));c&&a.push(this.createIntervalBandRow());const h=new B(c?1:0,0,C.HEADER),u=new B(c?2:1,0,C.SEPERATORLINE);for(const t of this.normalizedHeader){const e=this.attributesByAlias.get(t.name);h.createElement(e?o.get(e.label)||e.label:i.translateScenarioLabel(t.name,o),t.type,this.createColumnType(t),null,this.setHeaderPrefix(t,o,n,s,r),null,null,null,null),u.createElement(null,t.type,this.createColumnType(t),null,null,null,null,null,null)}return a.push(h),a.push(u),a}createIntervalBandRow(){const t=new B(0,0,C.HEADER);let e=0;for(;e<this.normalizedHeader.length;){const o=this.normalizedHeader[e];if(void 0===o.bucket){t.createElement(null,o.type,"filler",null,null,null,null,null,null),e+=1;continue}let n=1;for(;e+n<this.normalizedHeader.length&&this.normalizedHeader[e+n].bucket===o.bucket;)n+=1;t.createElement(o.bucketLabel,o.type,"intervalGroup",null,null,null,null,null,null,!1,void 0,n),e+=n}return t}setHeaderPrefix(t,e,o,n,s){let r="";return"category"===t.name&&s&&(0===o.prefix.length&&0===n.length||(r=i.translateScenarioLabel("in",e)+" "+o.prefix+n)),t.order&&(r+=i.translateScenarioLabel("ORDER_"+t.order,e)),r}normalizeHeader(t,e,o){let n=[{name:r.CATEGORY,group:r.CATEGORY,type:r.CATEGORY,order:void 0}];_.OPT!==t&&_.OPTNOTOTAL!==t||(n=[{name:r.OPERATION,group:r.OPERATION,type:r.OPERATION,order:void 0},{name:r.CATEGORY,group:r.CATEGORY,type:r.CATEGORY,order:void 0}]);const s=o.map((t=>({name:t.alias,group:t.alias,type:t.alias,order:void 0})));return[...n,...s,...e]}createBodyRows(t,e,o,n){var s;const i=[];let l=-1;const a=new et(t,e).execute(o,n),h=this.calculateColumnStatistics(a,t.barColumns,t.interval!==L),u=(null!==(s=t.barColumns)&&void 0!==s?s:[]).filter((t=>t.toUpperCase().trim()in c)),f=u.length>0&&t.interval===L&&0===t.categoryThereOf.size&&function(t){for(const e of t)for(const t of e){const e=t[r.TYPE];if(e===C.SUM||e===C.GROUPSUM||e===C.DRILLELEMENT||e===C.PARTELEMENT)return!0}return!1}(a)?function(t,e,o){const n=new ot;for(const s of e){let e,i=0,l=0;const a=[],c=(t,e)=>{a.push(e),n.set(t,s,e)};for(const n of t)for(const t of n){const n=t[r.TYPE];if(n===C.GROUPHEAD){e=void 0;continue}const a=nt(t,s,o);if(n===C.ENTRY){if(null===a){e=void 0;continue}c(t,{start:i,end:i+a,min:0,max:0,kind:"cascade"}),e={start:i,end:i+a},l=e.start,i+=a}else if(n===C.SUM||n===C.GROUPSUM){if(null===a){e=void 0;continue}c(t,{start:0,end:a,min:0,max:0,kind:"anchor"}),e={start:0,end:a},l=0,i=a}else if(n===C.DRILLELEMENT){if(null===a||void 0===e)continue;const o=l+(Math.sign(e.end-e.start)||1)*Math.abs(a);c(t,{start:l,end:o,min:0,max:0,kind:"thereof",parentStart:e.start,parentEnd:e.end}),l=o}else if(n===C.PARTELEMENT){if(null===a||void 0===e)continue;const o=l+a*(e.end-e.start);c(t,{start:l,end:o,min:0,max:0,kind:"partof",parentStart:e.start,parentEnd:e.end}),l=o}}let h=0,u=0;for(const t of a)h=Math.min(h,t.start,t.end),u=Math.max(u,t.start,t.end);for(const t of a)t.min=h,t.max=u}return n}(a,u,t.type):void 0;for(const o of a)l+=1,i.push(...this.createRow(t.i18n,e,t.scenariosUnitType,o,l,-1,t.categoryWidth,t.measureScale,t.barColumns,h,f));return i}calculateColumnStatistics(t,e,o=!1){const n=new Map;if(!e||0===e.length)return n;const s=new Map;for(const t of e)n.set(t,{min:1/0,max:-1/0,absMax:0,median:0}),s.set(t,[]);for(const i of t)for(const t of i)for(const i of e){const e=o?this.extractIntervalColumnValues(t,i):[this.extractColumnValue(t,i)];for(const t of e)if(null!==t&&!isNaN(t)){const e=n.get(i);e.min=Math.min(e.min,t),e.max=Math.max(e.max,t),s.get(i).push(Math.abs(t))}}for(const[t,e]of n){e.min!==1/0&&e.max!==-1/0||(e.min=0,e.max=0),e.absMax=Math.max(Math.abs(e.min),Math.abs(e.max));const o=s.get(t);if(o.length>0){o.sort(((t,e)=>t-e));const t=Math.floor(o.length/2);e.median=o.length%2==0?(o[t-1]+o[t])/2:o[t]}n.set(t,e)}return n}extractIntervalColumnValues(t,e){const o=e+"##",n=[];for(const e of Object.keys(t))if(e.startsWith(o)){const o=Number(t[e]);n.push(isNaN(o)?null:o)}return n}extractColumnValue(t,e){if(void 0!==t[e]){const o=Number(t[e]);return isNaN(o)?null:o}for(const o of Object.keys(t))if(o===e||o.endsWith("##"+e)||o===e+"##"+e){const e=Number(t[o]);if(!isNaN(e))return e}return null}createRow(t,e,o,n,s,i,l,a,c,h,u){var f;const d=[];for(const p of n){const $=p[r.ROWGROUP],m=p[r.SUBCATEGORY],v=p[r.TYPE],g=p[r.ROWNR]>=2,R=this.createDetailRow(v,i+=1,s,n.length);for(const n of this.normalizedHeader){const s=this.getRawDataRowElement(p,n),i=null!==(f=null==c?void 0:c.includes(n.type))&&void 0!==f&&f,r=i?null==h?void 0:h.get(n.type):void 0,d=i&&void 0===n.bucket&&n.name===n.group&&n.name===n.type?null==u?void 0:u.get(p,n.type):void 0;R.createElement(this.translateSumCellLabel(t,e,s,$,m,v,n.type),n.type,this.createColumnType(n),this.setCellType(n.type,o),this.translateCellPrefix(e,v,n.type),this.translateScenarioCSS(n.type,s),g,l,null==a?void 0:a.value,i,r,1,d)}d.push(R)}return d}getRawDataRowElement(t,e){return void 0!==e.bucket?t[e.type+"##"+e.bucket]:e.name===e.group&&e.name===e.type?t[e.name]:e.name===e.group&&e.name!==e.type?t[e.type+"##"+e.name]:t[e.type+"##"+e.group+"##"+e.name]}createDetailRow(t,e,o,n){switch(t){case C.GROUPHEAD:return new B(e,o,C.HEADER);case C.SUM:case C.GROUPSUM:return new B(n+2,o,C.SUM);case C.DRILLELEMENT:return new B(n+2,o,C.DRILLELEMENT);case C.PARTELEMENT:return new B(n+2,o,C.PARTELEMENT);default:return new B(e,o,C.STANDARD)}}translateSumCellLabel(t,e,o,n,s,i,r){return this.attributesByAlias.has(r)||!1===Number.isNaN(Number(o))||this.isOperationColumn(r)?o:this.isGroupHeadCategory(i,r)||this.isEntryCategory(i,r)?t===h.ALL?`${e.get(o)||o}`:o:this.isDrillElementCategory(i,r)?t===h.ALL?`${e.get(s)||s}`:`${s}`:this.isPartElementCategory(i,r)?t===h.ALL||"SUM_TOTAL"===n?`${e.get(n)||n}`:`${n}`:this.isSumElementCategory(i,r)?t===h.ALL||"SUM_TOTAL"===n?`${e.get(n)||n}`:n:"GROUPHEAD"===i&&null==o?o:Number.isNaN(Number(o))?"-":Number(o)}isOperationColumn(t){return"operation"===t}translateScenarioCSS(t,e){if(this.attributesByAlias.has(t))return"attribute";const o=new l(t);let n="pos";return e<0&&(n="neg"),o.isValid?n+"_"+o.direction+("dr"===o.type?" relative_variance":""):t}setCellType(t,e){if("category"===t)return"";const o=this.attributesByAlias.get(t);if(o)return o.isNumeric?"decimal":"";let n;const s=new l(t);return e===u.PERCENT?(n="percent",s.isValid&&"d"===s.type&&(n="decimal")):(n="decimal",s.isValid&&"dr"===s.type&&(n="percent")),n}isDrillElementCategory(t,e){return"DRILLELEMENT"===t&&"category"===e}isPartElementCategory(t,e){return"PARTELEMENT"===t&&"category"===e}isSumElementCategory(t,e){return("GROUP_SUM"===t||"SUM"===t)&&"category"===e}isEntryCategory(t,e){return"ENTRY"===t&&"category"===e}isGroupHeadCategory(t,e){return"GROUPHEAD"===t&&"category"===e}translateCellPrefix(t,e,o){return this.isOperationColumn(o)||this.isGroupHeadCategory(e,o)||this.isEntryCategory(e,o)?null:this.isDrillElementCategory(e,o)?`${t.get("there_of")} `:this.isPartElementCategory(e,o)?`${t.get("part_of")} `:null}createColumnType(t){return t.name===t.group&&t.name===t.type?"base":t.name===t.group?"columnGroup":"columnSubGroup"}}class it{constructor(t,e,o,n){this.fromExpr="",this.rowCount=0,this.headerRows=[],this.bodyRows=[],this.intervalBuckets=[],this.ruleSet=t||new a,this.db=e,this.dataSetFactory=new st,this.config=this.initConfig(n),this.i18n=this.initI18n(new Map),this.setSource(o,n.filter),this.state=G.DIRTY}setI18n(t){this.i18n=this.initI18n(t)}initI18n(t){const e=new Map([["",""],["SEPERATOR_WS",", "],["in","in"],["ORDER_asc","↑"],["ORDER_desc","↓"],["ac1","AC"],["pp1","PY"],["fc1","FC"],["pl1","PL"],["ac2","AC2"],["pp2","PY2"],["fc2","FC2"],["pl2","PL2"],["ac3","AC3"],["pp3","PY3"],["fc3","FC3"],["pl3","PL3"],["ac4","AC4"],["pp4","PY4"],["fc4","FC4"],["pl4","PL4"],["in","in"],["category"," "],["operation"," "],["there_of","davon"],["part_of","in % von"],["ibcssymbol_delta_ac","Δ{%}"],["ibcssymbol_delta_generic","Δ({%})"],["ibcssymbol_delta_ac_relative","Δ{%}%"],["ibcssymbol_delta_generic_relative","Δ({%})%"],["SUM_TOTAL","❖"]]);return this.state=G.DIRTY,new Map([...e,...t||new Map])}initConfig(t){this.state=G.DIRTY;const e=t,o=this;return t.scenarios.sort(((t,e)=>o.ruleSet.getScenarioSorIndex(t)-o.ruleSet.getScenarioSorIndex(e))),e}setConfig(t){this.config=this.initConfig(t)}setSource(t,e){var o,n;if(!t)return this.fromExpr="",void(this.rowCount=0);this.fromExpr=g(t,e);try{const t=this.db.exec(`SELECT COUNT(*) AS cnt FROM ${this.fromExpr}`);this.rowCount=null!==(n=null===(o=t[0])||void 0===o?void 0:o.cnt)&&void 0!==n?n:0}catch(t){this.rowCount=0}this.prepareIntervalBuckets();const s=this.normalizeScenarios(this.config.scenarios,this.config.categoryThereOf,this.config.sortOrder,this.intervalBuckets);this.headerRows=this.dataSetFactory.createHeader(this.config.type,s,this.i18n,this.config.measureScale,this.config.measureUnit,this.config.showMeasureScale,this.config.attributes),this.bodyRows=0===this.rowCount?[]:this.dataSetFactory.createBodyRows(this.config,this.i18n,this.db,this.fromExpr),this.state=G.UP_TO_DATE}update(){this.prepareIntervalBuckets();const t=this.normalizeScenarios(this.config.scenarios,this.config.categoryThereOf,this.config.sortOrder,this.intervalBuckets);this.headerRows=this.dataSetFactory.createHeader(this.config.type,t,this.i18n,this.config.measureScale,this.config.measureUnit,this.config.showMeasureScale,this.config.attributes),this.bodyRows=0!==this.rowCount&&this.fromExpr?this.dataSetFactory.createBodyRows(this.config,this.i18n,this.db,this.fromExpr):[],this.state=G.UP_TO_DATE}getHeader(){return this.state===G.DIRTY&&this.update(),this.headerRows}getBody(){return this.state===G.DIRTY&&this.update(),this.bodyRows}prepareIntervalBuckets(){this.intervalBuckets=[],this.config.interval===L||!this.fromExpr||this.config.categoryThereOf.size>0?this.config.interval=L:(this.config.interval=function(t,e,o){var n;if(o!==m.AUTO)return o;let s,i,r;try{s=t.exec(`SELECT [date] as d FROM ${e}`)}catch(t){return console.error("IntervalColumns: date query failed",t),m.DAY}for(const t of s){const e=null===(n=A(t.d))||void 0===n?void 0:n.toMillis();void 0!==e&&(i=void 0===i?e:Math.min(i,e),r=void 0===r?e:Math.max(r,e))}return void 0===i||void 0===r?m.DAY:(new v).calculateDistanceType($.fromMillis(i),$.fromMillis(r))}(this.db,this.fromExpr,this.config.interval),this.intervalBuckets=function(t,e,o,n){let s;try{s=t.exec(`SELECT ${k(o)} as __interval FROM ${e}`)}catch(t){return console.error("IntervalColumns: bucket query failed",t),[]}if(o===x){const t=new Set,e=[];for(const o of s){const n=P(o.__interval);t.has(n)||(t.add(n),e.push({key:n,label:0===n.length?"—":n}))}return e}const i=new Set,r=[];for(const t of s){const e=A(t.__interval);if(!e)continue;const o=e.toISO();i.has(o)||(i.add(o),r.push(e))}r.sort(((t,e)=>t.toMillis()-e.toMillis()));const l=new v;return l.setLocale(n),r.map((t=>({key:t.toISO(),label:l.getDateString(t,o)})))}(this.db,this.fromExpr,this.config.interval,this.config.locale),0===this.intervalBuckets.length&&(this.config.interval=L))}normalizeScenarios(t,e,o,n=[]){var s,i;const r=[];if(n.length>0){for(const e of n)for(const n of t)r.push({name:n,group:n,type:n,order:(null===(s=null==o?void 0:o.hierarchy)||void 0===s?void 0:s.at(0))===n?o.direction:void 0,bucket:e.key,bucketLabel:e.label});return r}for(const n of t){if(null==e?void 0:e.has(n)){const t=e.get(n);for(const e of t){r.push({name:e.name,group:e.name,type:n,order:void 0});for(const t of e.subGroups)r.push({name:t,group:e.name,type:n,order:void 0})}r.push({name:"REST",group:"REST",type:n,order:void 0})}let t;(null===(i=null==o?void 0:o.hierarchy)||void 0===i?void 0:i.at(0))===n&&(t=o.direction),r.push({name:n,group:n,type:n,order:t})}return r}hasNoData(){return 0===this.rowCount}}class rt{constructor(){this.title="",this.scenarios=[],this.scenariosUnitType=u.DECIMAL,this.grouped=!1,this.showGroupTitle=!0,this.thereOf=[],this.categoryThereOf=new Map,this.partOf=[],this.attributes=[],this.sortOrder=new y(new O).default(),this.type=_.LIST,this.limit=0,this.i18n=h.ALL,this.categoryWidth=d.W25,this.measureScale=new M,this.measureUnit="",this.measureType=p.VOLUME,this.showMeasureScale=!0,this.filter="",this.barColumns=[],this.interval="none",this.locale="de"}}class lt{constructor(t,e,o,n,s){this.tableDrillGroupAdapter=t,this.stringAdapter=e,this.orderAdapter=o,this.db=n,this.fromExpr=s}adapt(t){const e=new rt;return f.isString(t.title)&&(e.title=t.title),f.isArray(t.scenarios)&&(e.scenarios=b.adaptArray(t.scenarios,this.stringAdapter)),f.isExisting(t.scenariosUnitType)&&(e.scenariosUnitType=t.scenariosUnitType),f.isBoolean(t.grouped)&&(e.grouped=t.grouped),f.isBoolean(t.showGroupTitle)&&(e.showGroupTitle=t.showGroupTitle),f.isBoolean(t.showMeasureScale)&&(e.showMeasureScale=t.showMeasureScale),f.isArray(t.thereOf)&&(e.thereOf=b.adaptArray(t.thereOf,this.tableDrillGroupAdapter)),f.isExisting(t.categoryThereOf)&&(e.categoryThereOf=t.categoryThereOf),f.isArray(t.partOf)&&(e.partOf=b.adaptArray(t.partOf,this.tableDrillGroupAdapter)),f.isArray(t.attributes)&&(e.attributes=t.attributes),f.isExisting(t.order)&&(e.sortOrder=this.orderAdapter.adapt(t.order)),f.isExisting(t.type)&&(e.type=t.type),f.isNumber(t.limit)&&(e.limit=t.limit),f.isExisting(t.i18n)&&(e.i18n=t.i18n),f.isExisting(t.categoryWidth)&&(e.categoryWidth=t.categoryWidth),f.isExisting(t.measureScale)&&(e.measureScale=w.calculateMeasureScale(this.db,this.fromExpr,e.scenarios,t.measureScale)),f.isExisting(t.measureType)&&(e.measureType=t.measureType),f.isString(t.measureUnit)&&(e.measureUnit=t.measureUnit),f.isString(t.filter)&&(e.filter=t.filter.trim()),f.isArray(t.barColumns)&&(e.barColumns=t.barColumns),f.isString(t.interval)&&(e.interval=t.interval),f.isString(t.locale)&&(e.locale=t.locale),e}default(){return new rt}}class at{constructor(){this.rowGroup="",this.category="",this.subCategory="",this.partOf=""}}class ct{constructor(){}adapt(t){const e=new at;return f.isString(t.rowGroup)&&(e.rowGroup=t.rowGroup),f.isString(t.category)&&(e.category=t.category),f.isString(t.subCategory)&&(e.subCategory=t.subCategory),f.isString(t.partOf)&&(e.partOf=t.partOf),e}default(){return new at}}const ht=e(class extends o{constructor(t){super(),!1!==t&&this.__registerHost(),this.__attachShadow(),this.tableName="",this.dataVersion=0,this.sumTitle="SUM_TOTAL",this.scenarios=[],this.scenariosDataFormat=u.DECIMAL,this.grouped=!1,this.limit=0,this.showGroupTitle=!0,this.thereof=[],this.partof=[],this.order={hierarchy:[],direction:N.ASC},this.categorythereof=new Map,this.attributeColumns=[],this.type=_.LIST,this.categoryWidth=d.INF,this.dataFormatDigits={percent:2,decimal:1},this.i18n=new Map,this.i18nMode=h.ALL,this.measureScale="_",this.measureUnit="",this.showMeasureScale=!0,this.measureType=p.VOLUME,this.filter="",this.barColumns=[],this.interval="none",this.barColumnMaxWidth=30,this.unitScaling=.01,this.percentageScaling=.5,this.scaleFactor=1,this.componentDataFormatDigits=new S,this.componentStyle=U(this)}render(){return t(n,null,(()=>{if(void 0!==this.table){if(this.table.hasNoData()){const e=this.i18n.get("NO_DATA")||"==No Data==";return t("p",{class:"warning"},e)}return t("table",null,t("thead",null,this.table.getHeader().map((e=>t("tr",{class:e.cssStyle},e.getCells().map((e=>t("th",{colSpan:e.colSpan,class:e.cssStyle},e.getAsHeaderList().map(((o,n,s)=>t("span",null,n===s.length-1?t("span",{class:" "===o?"table-footer":""},o,e.drawPrefix()," "):t("span",null,o,e.drawPrefix(),t("br",null)))))))))))),t("tbody",null,this.table.getBody().map((e=>t("tr",{class:e.cssStyle},null==e?void 0:e.getCells().map((o=>t("td",{colSpan:o.colSpan,class:o.type?`${o.cssStyle} ${o.type}`:o.cssStyle},null!=o.prefix?t("span",{class:o.cssStyle+" "+o.prefixStyle},o.drawPrefix()):"",o.isBarChart&&o.columnStats&&(void 0!==o.waterfall||e.type!==C.SUM)?void 0!==o.waterfall?t(Z,{value:o.value,scenario:o.key,columnStats:o.columnStats,height:18*this.scaleFactor,isRelative:!1,isPositiveGood:o.key.endsWith("_pos"),measureScale:o.measureScale,maxBarWidth:this.barColumnMaxWidth,styles:this.barChartStyles,waterfall:o.waterfall}):t(J,{value:o.value,scenario:o.key,columnStats:o.columnStats,height:18*this.scaleFactor,isRelative:o.key.startsWith("dr"),isPositiveGood:o.key.endsWith("_pos"),measureScale:o.measureScale,maxBarWidth:this.barColumnMaxWidth,styles:this.barChartStyles}):o.draw(this.componentDataFormatDigits)))))))))}})())}componentWillRender(){this.stores||(this.stores=R(this.element));const t=this.stores.db.db,e=this.prepareConfig(t);this.componentDataFormatDigits=(new E).adapt(this.dataFormatDigits),this.table=new it(new a(this.ruleSetConfig),t,this.tableName,e),this.table.setI18n(this.i18n),this.barChartStyles=this.prepareBarChartStyles()}prepareConfig(t){var e,o,n;const s=this.tableName?this.filter&&this.filter.length>0?`(SELECT * FROM \`${this.tableName}\` WHERE ${this.filter}) AS __src`:`\`${this.tableName}\``:"";return new lt(new ct,new O,new y(new O),t,s).adapt({title:this.sumTitle,scenarios:this.scenarios,scenariosUnitType:this.scenariosDataFormat,grouped:this.grouped,showGroupTitle:this.showGroupTitle,thereOf:this.thereof,partOf:this.partof,categoryThereOf:this.categorythereof,attributes:this.attributeColumns,order:this.order,type:this.type,limit:this.limit,i18n:this.i18nMode,categoryWidth:this.categoryWidth,measureScale:this.measureScale,measureUnit:this.measureUnit,measureType:this.measureType,showMeasureScale:this.showMeasureScale,filter:this.filter,barColumns:this.barColumns,interval:this.interval,locale:(null===(n=null===(o=null===(e=this.stores)||void 0===e?void 0:e.context)||void 0===o?void 0:o.state)||void 0===n?void 0:n.locale)||"de"})}prepareBarChartStyles(){return this.componentStyle((t=>{var e,o,n,s,i,r,l,a,c,h,u,f,d,p,$,m,v,g,R,w,S,E,b,y,O,M;const U=null===(e=t["bn-chart-time"])||void 0===e?void 0:e.varianceStyles,T=null===(o=t["bn-chart-time"])||void 0===o?void 0:o.barStyles;return{positive:{stroke:(null===(n=null==U?void 0:U.pos)||void 0===n?void 0:n.stroke)||"#008f96",fill:(null===(s=null==U?void 0:U.pos)||void 0===s?void 0:s.fill)||"#008f96",fillpattern:(null===(i=null==U?void 0:U.pos)||void 0===i?void 0:i.fillpattern)||"solid"},negative:{stroke:(null===(r=null==U?void 0:U.neg)||void 0===r?void 0:r.stroke)||"#ff0000",fill:(null===(l=null==U?void 0:U.neg)||void 0===l?void 0:l.fill)||"#ff0000",fillpattern:(null===(a=null==U?void 0:U.neg)||void 0===a?void 0:a.fillpattern)||"solid"},neutral:{stroke:(null===(c=null==U?void 0:U.neu)||void 0===c?void 0:c.stroke)||"#808080",fill:(null===(h=null==U?void 0:U.neu)||void 0===h?void 0:h.fill)||"#808080",fillpattern:(null===(u=null==U?void 0:U.neu)||void 0===u?void 0:u.fillpattern)||"outlined"},scenarios:{ac:{stroke:(null===(f=null==T?void 0:T.ac)||void 0===f?void 0:f.stroke)||"#404040",fill:(null===(d=null==T?void 0:T.ac)||void 0===d?void 0:d.fill)||"#404040",fillpattern:(null===(p=null==T?void 0:T.ac)||void 0===p?void 0:p.fillpattern)||"solid"},pp:{stroke:(null===($=null==T?void 0:T.pp)||void 0===$?void 0:$.stroke)||"#A6A6A6",fill:(null===(m=null==T?void 0:T.pp)||void 0===m?void 0:m.fill)||"#A6A6A6",fillpattern:(null===(v=null==T?void 0:T.pp)||void 0===v?void 0:v.fillpattern)||"solid"},fc:{stroke:(null===(g=null==T?void 0:T.fc)||void 0===g?void 0:g.stroke)||"#404040",fill:(null===(R=null==T?void 0:T.fc)||void 0===R?void 0:R.fill)||"#ffffff",fillpattern:(null===(w=null==T?void 0:T.fc)||void 0===w?void 0:w.fillpattern)||"hatched"},pl:{stroke:(null===(S=null==T?void 0:T.pl)||void 0===S?void 0:S.stroke)||"#404040",fill:(null===(E=null==T?void 0:T.pl)||void 0===E?void 0:E.fill)||"#ffffff",fillpattern:(null===(b=null==T?void 0:T.pl)||void 0===b?void 0:b.fillpattern)||"outlined"}},fontColor:(null===(y=t.global)||void 0===y?void 0:y.fontColor)||"#000000",fontSize:.85*((null===(O=t.global)||void 0===O?void 0:O.fontSizePx)||13.3333)*this.scaleFactor,fontFamily:(null===(M=t.global)||void 0===M?void 0:M.fontFamily)||"'Noto Sans', sans-serif",unitScaling:this.unitScaling>0?this.unitScaling:this.autoUnitScaling(),percentageScaling:this.percentageScaling>0?this.percentageScaling:this.autoPercentageScaling(),scaleFactor:this.scaleFactor}}))}autoUnitScaling(){const t=this.componentStyle((t=>{var e;return.85*((null===(e=t.global)||void 0===e?void 0:e.fontSizePx)||13.3333)*this.scaleFactor})),e=this.barColumnMaxWidth*t*.8,o=this.getMaxAbsValue();return o<=0||t<=0?.01:e/(o*t)}autoPercentageScaling(){const t=this.componentStyle((t=>{var e;return.85*((null===(e=t.global)||void 0===e?void 0:e.fontSizePx)||13.3333)*this.scaleFactor})),e=.8*Math.round(.67*this.barColumnMaxWidth*t),o=this.getMaxRelativeValue();return o<=0||t<=0?.5:e/(o*t)}getMaxAbsValue(){if(!this.table)return 0;let t=0;for(const e of this.table.getBody())if(e.type!==C.SUM)for(const o of e.getCells())o.isBarChart&&o.columnStats&&!o.key.startsWith("dr")&&!o.waterfall&&(t=Math.max(t,o.columnStats.absMax));return t}getMaxRelativeValue(){if(!this.table)return 0;let t=0;for(const e of this.table.getBody())if(e.type!==C.SUM)for(const o of e.getCells())o.isBarChart&&o.columnStats&&o.key.startsWith("dr")&&(t=Math.max(t,100*o.columnStats.absMax));return t}get element(){return this}static get style(){return':host{position:relative;display:inline-block}table{background-color:var(--bn-font-background, white);font-size:var(--bn-font-size, 1em);color:var(--bn-font-color, black);font-family:var(--bn-font-family, "Noto Sans", "Helvetica Neue", Helvetica, sans-serif);border-spacing:0.3em 0}thead{border-style:none}tr:first-child td{border-top:none;padding-top:0.5em}td.ac1,td.ac2,td.ac3,td.ac4,td.pp1,td.pp2,td.pp3,td.pp4,td.pl1,td.pl2,td.pl3,td.pl4,td.fc1,td.fc2,td.fc3,td.fc4,td.share,td.variance,td.pos_pos,td.pos_neg,td.neg_pos,td.neg_neg,td.pos_neutral,td.neg_neutral{text-align:right}.category-w100{min-width:100em;max-width:100em}.category-w50{min-width:50em;max-width:50em}.category-w25{min-width:25em;max-width:25em}.category-w20{min-width:20em;max-width:20em}.category-w15{min-width:15em;max-width:15em}.category-w10{min-width:10em;max-width:10em}.category-w5{min-width:5em;max-width:5em}.prefix-second{color:transparent;font-style:normal}.prefix-first{font-style:normal}th{border-bottom:0.1em solid black;text-align:right;font-weight:normal;vertical-align:text-top}td.columnGroup,th.columnGroup{font-size:0.6em}td.columnSubGroup,th.columnSubGroup{font-size:0.6em;border-spacing:0em 0;font-style:italic}td.base,th.base{font-style:normal}th.ofit,td.ofit,tr.ofit,th.partof,td.partof,tr.partof{font-size:0.6em;font-style:italic}td.ofit,td.partof{font-size:0.6em;font-style:italic}th.ofit td,tr.ofit td,th.partof td,tr.partof td{border-top:0em solid black;padding-left:1em}th.ofit share,th.partof share,tr.share td{border-top:0em solid black}th.share,tr.share,td.share{font-size:0.6em;font-style:italic}th.filler{border-bottom:0em solid black;text-align:right}td.filler{border-top:0em none !important;border-bottom:0em none;text-align:right}th.group{text-align:center;border-spacing:1em 0}th.headerlabel{border-bottom:0em none black;padding-bottom:0em}th.intervalGroup{border-bottom:0.1em solid black;text-align:center;font-weight:bold}td.variance:after{content:"%"}td.relative_variance{font-style:italic}td.percent{font-style:italic;text-align:right}td.decimal{text-align:right}td.pos_pos{color:#008f96}td.neg_pos{color:#ff0000}td.pos_neg{color:#ff0000}td.neg_neg{color:#008f96}td.pos_pos:before{content:"+"}td.pos_neg:before{content:"+"}td.pos_neu:before{content:"+"}th.ac1,th.ac2,th.ac3,th.ac4{padding-top:0em;border-bottom:0.3em solid black}th.pp1,th.pp2,th.pp3,th.pp4{padding-top:0em;border-bottom:0.3em solid grey}th.pl1,th.pl2,th.pl3,th.pl4{padding-top:0em;border-bottom:0.3em double black}th.fc1,th.fc2,th.fc3,th.fc4{border-bottom:0.3em solid;border-image:repeating-linear-gradient(-45deg, white, white, black, white, white 0.3em) 2}td.colsum{font-weight:bold}th.colsum{padding-top:0em;font-weight:bold}tr.sum td{border-top:0.1em solid black;font-weight:bold;padding-bottom:0.5em}tr.groupheader td{border-top:0em dotted #ddd;padding-top:0.5em;font-weight:bold;font-style:italic}tr.begingroup td{border-top:0em dotted #ddd;padding-top:0.5em}th.begin-group{padding-left:0.75em}th.end-group{padding-left:0.75em}td{box-sizing:border-box;-webkit-box-sizing:border-box;border-top:0.1em dashed #ddd;padding-left:0.5em;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.table-footer{font-size:0.6em}.cell-bar-chart{display:inline-block;vertical-align:middle}.bar-chart-empty{color:#999}td:has(.cell-bar-chart){padding:0 0.25em;vertical-align:middle}td:has(.cell-bar-chart).pos_pos:before,td:has(.cell-bar-chart).pos_neg:before,td:has(.cell-bar-chart).pos_neu:before{content:none}td:has(.cell-bar-chart).variance:after{content:none}'}},[1,"ibcs-table",{tableName:[1,"table-name"],dataVersion:[2,"data-version"],selectedStyle:[513,"selected-style"],sumTitle:[1,"sum-title"],scenarios:[16],scenariosDataFormat:[1,"scenarios-data-format"],grouped:[4],limit:[2],showGroupTitle:[4,"show-group-title"],thereof:[16],partof:[16],order:[16],categorythereof:[16],attributeColumns:[16],type:[1],categoryWidth:[1,"category-width"],dataFormatDigits:[16],ruleSetConfig:[16],i18n:[1040],i18nMode:[1,"i18n-mode"],measureScale:[1,"measure-scale"],measureUnit:[1,"measure-unit"],showMeasureScale:[4,"show-measure-scale"],measureType:[1,"measure-type"],filter:[1],barColumns:[16],interval:[1],barColumnMaxWidth:[2,"bar-column-max-width"],unitScaling:[2,"unit-scaling"],percentageScaling:[2,"percentage-scaling"],scaleFactor:[2,"scale-factor"]}]);function ut(){"undefined"!=typeof customElements&&["ibcs-table"].forEach((t=>{"ibcs-table"===t&&(customElements.get(s(t))||customElements.define(s(t),ht))}))}export{ht as I,_ as T,L as a,x as b,ut as d}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{proxyCustomElement as t,HTMLElement as s,h as i,transformTag as e}from"@stencil/core/internal/client";import{I as n,
|
|
1
|
+
import{proxyCustomElement as t,HTMLElement as s,h as i,transformTag as e}from"@stencil/core/internal/client";import{I as n,C as r}from"./CompareUtil.js";import{b as a,a as o,D as c}from"./DateStringFactory.js";import{F as h,I as l}from"./formatter.js";import{A as u,O as p,c as d}from"./Order.js";import{D as m}from"./luxon.js";import{S as f}from"./StringAdapter.js";import{s as b}from"./sanitizeHtml.js";class w{constructor(){}createMeasures(t,s,i){if(this.allMeasuresUseSameUnit(t)){const e=t.length;let r="",a="";for(let o=0;o<e;o++){let c="";o>0&&(c=s.get("SEPERATOR_WS")),e>1&&o===e-1&&(c=s.get("CONNECTOR_WS")),i===n.ALL?(r=(s.get(r)||r)+c+(s.get(t[o].name)||t[o].name),a=s.get(t[o].unit)||t[o].unit):(r=r+c+t[o].name,a=t[o].unit)}return[{name:r,unit:a}]}return t}createDimension(t,s,i,e,n){let r="";return void 0!==s&&(r=(new a).getDateLinkString(s.start,s.end,s.link,s.format,n)),r+t.map((t=>{let s="";return null!=i&&null!=i.hierarchy&&i.hierarchy.find((s=>s===t))&&(s=e.get("asc"===i.direction?"ORDER_asc":"ORDER_desc")),"".concat(" ",h.translateScenarioLabel(t,e),s)})).toString()}allMeasuresUseSameUnit(t){const s=new Map;return t.forEach((function(t){s.set(t.unit,!0)})),1===s.size}}class _{constructor(){this.businessunit="",this.measures=[],this.scenarios=[],this.i18nMode=n.ALL,this.intervalSpanLimit=32}}class v{constructor(t,s,i,e){this.measureEntryAdapter=t,this.timePeriodAdapter=s,this.orderAdapter=i,this.stringAdapter=e}adapt(t){const s=new _;return r.isString(t.businessunit)&&(s.businessunit=t.businessunit),r.isArray(t.measures)&&(s.measures=u.adaptArray(t.measures,this.measureEntryAdapter)),r.isArray(t.scenarios)&&(s.scenarios=u.adaptArray(t.scenarios,this.stringAdapter)),r.isExisting(t.timeperiod)&&(s.timeperiod=this.timePeriodAdapter.adapt(t.timeperiod)),r.isNumber(t.intervalSpanLimit)&&(s.intervalSpanLimit=t.intervalSpanLimit),r.isExisting(t.i18nMode)&&(s.i18nMode=t.i18nMode),r.isExisting(t.order)&&(s.order=this.orderAdapter.adapt(t.order)),s}default(){return new _}}var y;!function(t){t[t.UP_TO_DATE=0]="UP_TO_DATE",t[t.DIRTY=1]="DIRTY"}(y||(y={}));class R{constructor(t){this.i18n=new Map,this.unit="",this.measures=[],this.dimension="",this.config=new _,this.state=y.DIRTY,this.ruleSet=t||new l,this.dataSetFactory=new w,this.state=y.DIRTY,this.setI18n(new Map)}setRuleSet(t){this.ruleSet=t||new l}setI18n(t){this.state=y.DIRTY;const s=new Map([["SEPERATOR_WS",", "],["in","in"],["ORDER_asc","↑"],["ORDER_desc","↓"],["ac1","AC"],["pp1","PY"],["fc1","FC"],["pl1","PL"],["ac2","AC2"],["pp2","PY2"],["fc2","FC2"],["pl2","PL2"],["ac3","AC3"],["pp3","PY3"],["fc3","FC3"],["pp3","PL3"],["ac4","AC4"],["py4","PY4"],["fc4","FC4"],["pp4","PL4"],["category"," "],["operation"," "],["there_of","davon"],["part_of","in % von"],["ibcssymbol_delta_ac","Δ{%}"],["ibcssymbol_delta_generic","Δ({%})"],["ibcssymbol_delta_ac_relative","Δ{%}%"],["ibcssymbol_delta_generic_relative","Δ({%})%"],["SUM_TOTAL","❖"],["CONNECTOR_WS"," und "]]);this.i18n=new Map([...s,...t||new Map])}update(){return y.DIRTY===this.state&&(this.unit=this.config.businessunit,this.measures=this.dataSetFactory.createMeasures(this.config.measures,this.i18n,this.config.i18nMode),this.dimension=this.dataSetFactory.createDimension(this.config.scenarios,this.config.timeperiod,this.config.order,this.i18n,this.config.intervalSpanLimit),this.state=y.UP_TO_DATE),this}setConfig(t){this.config=this.initConfig(t)}initConfig(t){this.state=y.DIRTY;const s=t,i=this;return t.scenarios.sort(((t,s)=>i.ruleSet.getScenarioSorIndex(t)-i.ruleSet.getScenarioSorIndex(s))),s}}class C{constructor(t="",s=""){this.name=t,this.unit=s}}class S{construnctor(){}adapt(t){const s=new C;return r.isString(t.name)&&(s.name=t.name),r.isString(t.unit)&&(s.unit=t.unit),s}default(){return new C("","")}}class E{constructor(t=m.now(),s=m.now(),i=o.AUTO,e=c.AUTO){this.start=t,this.end=s,this.format=i,this.link=e}}class O{construnctor(){}adapt(t){const s=new E;return r.isDate(t.start)&&(s.start=t.start),r.isDate(t.end)&&(s.end=t.end),r.isExisting(t.format)&&(s.format=t.format),r.isExisting(t.link)&&(s.link=t.link),s}default(){return new E}}const g=t(class extends s{constructor(t){super(),!1!==t&&this.__registerHost(),this.__attachShadow(),this.businessUnit="",this.scenarios=[],this.measures=[],this.intervalSpanLimit=28,this.order={hierarchy:[],direction:p.ASC},this.i18n=new Map,this.i18nMode=n.ALL,this.title=new R(new l)}async setBusinessUnit(t){this.businessUnit=t}async setProps(t){Object.keys(t).forEach((s=>{this[s]=t[s]}))}render(){return i("div",{key:"7a95748a4576c654c9066efb2bfd7531238d2ed0"},i("div",{key:"6a34ba1043660dc75b57cd029f6438d1178c34e4",innerHTML:b(this.title.unit)}),i("div",{key:"6ec241e7cd6ac8a2061aab1b822973e77e2fb7cd"},this.title.measures.map(((t,s)=>i("span",null,this.isFirstElement(s)?this.title.i18n.get("SEPERATOR_WS"):"",i("span",{class:"measure"},t.name)," ",t.unit?this.title.i18n.get("in"):""," ",t.unit)))),i("div",{key:"d6bc97cd78ec8734d4d42b2537cf61dfcac28ae4"},this.title.dimension))}componentWillLoad(){const t=this.prepareConfig();this.title=new R(new l(this.ruleSetConfig)),this.title.setI18n(this.i18n),this.title.setConfig(t)}componentWillUpdate(){const t=this.prepareConfig();this.title.setI18n(this.i18n),this.title.setRuleSet(new l(this.ruleSetConfig)),this.title.setConfig(t)}componentWillRender(){this.title.update()}isFirstElement(t){return 0!==t}prepareConfig(){return new v(new S,new O,new d(new f),new f).adapt({businessunit:this.businessUnit,measures:this.measures,scenarios:this.scenarios,timeperiod:this.timeperiod,intervalSpanLimit:this.intervalSpanLimit,i18nMode:this.i18nMode,order:this.order})}static get style(){return':host{display:block;font-family:var(--bn-font-family, "Noto Sans", sans-serif);font-size:var(--bn-font-size, 13.3333px);color:var(--bn-font-color, #000000)}.measure{font-weight:bold}div{background-color:var(--bn-font-background, white);color:var(--bn-font-color, black)}p{margin:0}'}},[1,"ibcs-title",{businessUnit:[1537,"business-unit"],scenarios:[16],measures:[16],timeperiod:[16],intervalSpanLimit:[2,"interval-span-limit"],order:[16],i18n:[1040],i18nMode:[1,"i18n-mode"],ruleSetConfig:[16],setBusinessUnit:[64],setProps:[64]}]);function P(){"undefined"!=typeof customElements&&["ibcs-title"].forEach((t=>{"ibcs-title"===t&&(customElements.get(e(t))||customElements.define(e(t),g))}))}export{g as I,P as d}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
function n(n,e,t=80){let o=null,l=!1,i=-1,u=-1;const r=function(n){var e;const t=n.parentElement;return(null===(e=null==t?void 0:t.assignedSlot)||void 0===e?void 0:e.parentElement)?t.assignedSlot.parentElement:t}(n);if(!r)return{disconnect(){}};const c=new ResizeObserver((n=>{var c;if(l)return;let s,v;const d=n[0];if(null===(c=null==d?void 0:d.contentBoxSize)||void 0===c?void 0:c.length){const n=d.contentBoxSize[0];s=n.inlineSize,v=n.blockSize}else s=r.clientWidth,v=r.clientHeight;Math.abs(s-i)<=2&&Math.abs(v-u)<=2||(i=s,u=v,null!=o&&clearTimeout(o),o=setTimeout((()=>{l||e()}),t))}));return c.observe(r),{disconnect(){l=!0,null!=o&&clearTimeout(o),c.disconnect()}}}export{n as o}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
const t={scenarios:{ac:{name:"AC",colorIndex:10,sortIndex:400},fc:{name:"FC",colorIndex:30,sortIndex:300},pl:{name:"PL",colorIndex:50,sortIndex:200},bu:{name:"BU",colorIndex:50,sortIndex:200},pp:{name:"PP",colorIndex:20,sortIndex:100},py:{name:"PY",colorIndex:20,sortIndex:100},dac:{name:"dAC",colorIndex:10,sortIndex:1400},dfc:{name:"dFC",colorIndex:30,sortIndex:1300},dpl:{name:"dPL",colorIndex:50,sortIndex:1200},dbu:{name:"dBU",colorIndex:50,sortIndex:1200},dpp:{name:"dPP",colorIndex:20,sortIndex:1100},dpy:{name:"dPY",colorIndex:20,sortIndex:1100},drac:{name:"drAC",colorIndex:10,sortIndex:2400},drfc:{name:"drFC",colorIndex:30,sortIndex:2300},drpl:{name:"drPL",colorIndex:50,sortIndex:2200},drbu:{name:"drBU",colorIndex:50,sortIndex:2200},drpp:{name:"drPP",colorIndex:20,sortIndex:2100},drpy:{name:"drPY",colorIndex:20,sortIndex:2100}},fallback:{name:"Series",group:"Series",colorIndex:10,sortIndex:120}};var e="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{};function n(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}class r extends Error{}class s extends r{constructor(t){super(`Invalid DateTime: ${t.toMessage()}`)}}class i extends r{constructor(t){super(`Invalid Interval: ${t.toMessage()}`)}}class u extends r{constructor(t){super(`Invalid Duration: ${t.toMessage()}`)}}class o extends r{}class a extends r{constructor(t){super(`Invalid unit ${t}`)}}class c extends r{}class l extends r{constructor(){super("Zone is an abstract class")}}const h="numeric",d="short",m="long",f={year:h,month:h,day:h},y={year:h,month:d,day:h},g={year:h,month:d,day:h,weekday:d},w={year:h,month:m,day:h},p={year:h,month:m,day:h,weekday:m},S={hour:h,minute:h},M={hour:h,minute:h,second:h},k={hour:h,minute:h,second:h,timeZoneName:d},T={hour:h,minute:h,second:h,timeZoneName:m},b={hour:h,minute:h,hourCycle:"h23"},N={hour:h,minute:h,second:h,hourCycle:"h23"},I={hour:h,minute:h,second:h,hourCycle:"h23",timeZoneName:d},v={hour:h,minute:h,second:h,hourCycle:"h23",timeZoneName:m},E={year:h,month:h,day:h,hour:h,minute:h},O={year:h,month:h,day:h,hour:h,minute:h,second:h},D={year:h,month:d,day:h,hour:h,minute:h},$={year:h,month:d,day:h,hour:h,minute:h,second:h},x={year:h,month:d,day:h,weekday:d,hour:h,minute:h},F={year:h,month:m,day:h,hour:h,minute:h,timeZoneName:d},L={year:h,month:m,day:h,hour:h,minute:h,second:h,timeZoneName:d},Z={year:h,month:m,day:h,weekday:m,hour:h,minute:h,timeZoneName:m},W={year:h,month:m,day:h,weekday:m,hour:h,minute:h,second:h,timeZoneName:m};class C{get type(){throw new l}get name(){throw new l}get ianaName(){return this.name}get isUniversal(){throw new l}offsetName(t,e){throw new l}formatOffset(t,e){throw new l}offset(t){throw new l}equals(t){throw new l}get isValid(){throw new l}}let A=null;class _ extends C{static get instance(){return null===A&&(A=new _),A}get type(){return"system"}get name(){return(new Intl.DateTimeFormat).resolvedOptions().timeZone}get isUniversal(){return!1}offsetName(t,{format:e,locale:n}){return se(t,e,n)}formatOffset(t,e){return ae(this.offset(t),e)}offset(t){return-new Date(t).getTimezoneOffset()}equals(t){return"system"===t.type}get isValid(){return!0}}const j=new Map,q={year:0,month:1,day:2,era:3,hour:4,minute:5,second:6},H=new Map;class P extends C{static create(t){let e=H.get(t);return void 0===e&&H.set(t,e=new P(t)),e}static resetCache(){H.clear(),j.clear()}static isValidSpecifier(t){return this.isValidZone(t)}static isValidZone(t){if(!t)return!1;try{return new Intl.DateTimeFormat("en-US",{timeZone:t}).format(),!0}catch(t){return!1}}constructor(t){super(),this.zoneName=t,this.valid=P.isValidZone(t)}get type(){return"iana"}get name(){return this.zoneName}get isUniversal(){return!1}offsetName(t,{format:e,locale:n}){return se(t,e,n,this.name)}formatOffset(t,e){return ae(this.offset(t),e)}offset(t){if(!this.valid)return NaN;const e=new Date(t);if(isNaN(e))return NaN;const n=function(t){let e=j.get(t);return void 0===e&&(e=new Intl.DateTimeFormat("en-US",{hour12:!1,timeZone:t,year:"numeric",month:"2-digit",day:"2-digit",hour:"2-digit",minute:"2-digit",second:"2-digit",era:"short"}),j.set(t,e)),e}(this.name);let[r,s,i,u,o,a,c]=n.formatToParts?function(t,e){const n=t.formatToParts(e),r=[];for(let t=0;t<n.length;t++){const{type:e,value:s}=n[t],i=q[e];"era"===e?r[i]=s:At(i)||(r[i]=parseInt(s,10))}return r}(n,e):function(t,e){const n=t.format(e).replace(/\u200E/g,""),r=/(\d+)\/(\d+)\/(\d+) (AD|BC),? (\d+):(\d+):(\d+)/.exec(n),[,s,i,u,o,a,c,l]=r;return[u,s,i,o,a,c,l]}(n,e);"BC"===u&&(r=1-Math.abs(r));let l=+e;const h=l%1e3;return l-=h>=0?h:1e3+h,(te({year:r,month:s,day:i,hour:24===o?0:o,minute:a,second:c,millisecond:0})-l)/6e4}equals(t){return"iana"===t.type&&t.name===this.name}get isValid(){return this.valid}}let U={};const z=new Map;function R(t,e={}){const n=JSON.stringify([t,e]);let r=z.get(n);return void 0===r&&(r=new Intl.DateTimeFormat(t,e),z.set(n,r)),r}const J=new Map,Y=new Map;let G=null;const V=new Map;function B(t){let e=V.get(t);return void 0===e&&(e=new Intl.DateTimeFormat(t).resolvedOptions(),V.set(t,e)),e}const Q=new Map;function K(t,e,n,r){const s=t.listingMode();return"error"===s?null:"en"===s?n(e):r(e)}class X{constructor(t,e,n){this.padTo=n.padTo||0,this.floor=n.floor||!1;const{padTo:r,floor:s,...i}=n;if(!e||Object.keys(i).length>0){const e={useGrouping:!1,...n};n.padTo>0&&(e.minimumIntegerDigits=n.padTo),this.inf=function(t,e={}){const n=JSON.stringify([t,e]);let r=J.get(n);return void 0===r&&(r=new Intl.NumberFormat(t,e),J.set(n,r)),r}(t,e)}}format(t){if(this.inf){const e=this.floor?Math.floor(t):t;return this.inf.format(e)}return Jt(this.floor?Math.floor(t):Bt(t,3),this.padTo)}}class tt{constructor(t,e,n){let r;if(this.opts=n,this.originalZone=void 0,this.opts.timeZone)this.dt=t;else if("fixed"===t.zone.type){const e=t.offset/60*-1,n=e>=0?`Etc/GMT+${e}`:`Etc/GMT${e}`;0!==t.offset&&P.create(n).valid?(r=n,this.dt=t):(r="UTC",this.dt=0===t.offset?t:t.setZone("UTC").plus({minutes:t.offset}),this.originalZone=t.zone)}else"system"===t.zone.type?this.dt=t:"iana"===t.zone.type?(this.dt=t,r=t.zone.name):(r="UTC",this.dt=t.setZone("UTC").plus({minutes:t.offset}),this.originalZone=t.zone);const s={...this.opts};s.timeZone=s.timeZone||r,this.dtf=R(e,s)}format(){return this.originalZone?this.formatToParts().map((({value:t})=>t)).join(""):this.dtf.format(this.dt.toJSDate())}formatToParts(){const t=this.dtf.formatToParts(this.dt.toJSDate());return this.originalZone?t.map((t=>{if("timeZoneName"===t.type){const e=this.originalZone.offsetName(this.dt.ts,{locale:this.dt.locale,format:this.opts.timeZoneName});return{...t,value:e}}return t})):t}resolvedOptions(){return this.dtf.resolvedOptions()}}class et{constructor(t,e,n){this.opts={style:"long",...n},!e&&qt()&&(this.rtf=function(t,e={}){const{base:n,...r}=e,s=JSON.stringify([t,r]);let i=Y.get(s);return void 0===i&&(i=new Intl.RelativeTimeFormat(t,e),Y.set(s,i)),i}(t,n))}format(t,e){return this.rtf?this.rtf.format(t,e):function(t,e,n="always",r=!1){const s={years:["year","yr."],quarters:["quarter","qtr."],months:["month","mo."],weeks:["week","wk."],days:["day","day","days"],hours:["hour","hr."],minutes:["minute","min."],seconds:["second","sec."]},i=-1===["hours","minutes","seconds"].indexOf(t);if("auto"===n&&i){const n="days"===t;switch(e){case 1:return n?"tomorrow":`next ${s[t][0]}`;case-1:return n?"yesterday":`last ${s[t][0]}`;case 0:return n?"today":`this ${s[t][0]}`}}const u=Object.is(e,-0)||e<0,o=Math.abs(e),a=1===o,c=s[t],l=r?a?c[1]:c[2]||c[1]:a?s[t][0]:t;return u?`${o} ${l} ago`:`in ${o} ${l}`}(e,t,this.opts.numeric,"long"!==this.opts.style)}formatToParts(t,e){return this.rtf?this.rtf.formatToParts(t,e):[]}}const nt={firstDay:1,minimalDays:4,weekend:[6,7]};class rt{static fromOpts(t){return rt.create(t.locale,t.numberingSystem,t.outputCalendar,t.weekSettings,t.defaultToEN)}static create(t,e,n,r,s=!1){const i=t||kt.defaultLocale,u=i||(s?"en-US":G||(G=(new Intl.DateTimeFormat).resolvedOptions().locale,G)),o=e||kt.defaultNumberingSystem,a=n||kt.defaultOutputCalendar,c=zt(r)||kt.defaultWeekSettings;return new rt(u,o,a,c,i)}static resetCache(){G=null,z.clear(),J.clear(),Y.clear(),V.clear(),Q.clear()}static fromObject({locale:t,numberingSystem:e,outputCalendar:n,weekSettings:r}={}){return rt.create(t,e,n,r)}constructor(t,e,n,r,s){const[i,u,o]=function(t){const e=t.indexOf("-x-");-1!==e&&(t=t.substring(0,e));const n=t.indexOf("-u-");if(-1===n)return[t];{let e,r;try{e=R(t).resolvedOptions(),r=t}catch(s){const i=t.substring(0,n);e=R(i).resolvedOptions(),r=i}const{numberingSystem:s,calendar:i}=e;return[r,s,i]}}(t);this.locale=i,this.numberingSystem=e||u||null,this.outputCalendar=n||o||null,this.weekSettings=r,this.intl=function(t,e,n){return n||e?(t.includes("-u-")||(t+="-u"),n&&(t+=`-ca-${n}`),e&&(t+=`-nu-${e}`),t):t}(this.locale,this.numberingSystem,this.outputCalendar),this.weekdaysCache={format:{},standalone:{}},this.monthsCache={format:{},standalone:{}},this.meridiemCache=null,this.eraCache={},this.specifiedLocale=s,this.fastNumbersCached=null}get fastNumbers(){var t;return null==this.fastNumbersCached&&(this.fastNumbersCached=(!(t=this).numberingSystem||"latn"===t.numberingSystem)&&("latn"===t.numberingSystem||!t.locale||t.locale.startsWith("en")||"latn"===B(t.locale).numberingSystem)),this.fastNumbersCached}listingMode(){return this.isEnglish()&&!(null!==this.numberingSystem&&"latn"!==this.numberingSystem||null!==this.outputCalendar&&"gregory"!==this.outputCalendar)?"en":"intl"}clone(t){return t&&0!==Object.getOwnPropertyNames(t).length?rt.create(t.locale||this.specifiedLocale,t.numberingSystem||this.numberingSystem,t.outputCalendar||this.outputCalendar,zt(t.weekSettings)||this.weekSettings,t.defaultToEN||!1):this}redefaultToEN(t={}){return this.clone({...t,defaultToEN:!0})}redefaultToSystem(t={}){return this.clone({...t,defaultToEN:!1})}months(t,e=!1){return K(this,t,me,(()=>{const n="ja"===this.intl||this.intl.startsWith("ja-"),r=(e&=!n)?{month:t,day:"numeric"}:{month:t},s=e?"format":"standalone";return this.monthsCache[s][t]||(this.monthsCache[s][t]=function(t){const e=[];for(let n=1;n<=12;n++){const r=gr.utc(2009,n,1);e.push(t(r))}return e}(n?t=>this.dtFormatter(t,r).format():t=>this.extract(t,r,"month"))),this.monthsCache[s][t]}))}weekdays(t,e=!1){return K(this,t,we,(()=>{const n=e?{weekday:t,year:"numeric",month:"long",day:"numeric"}:{weekday:t},r=e?"format":"standalone";return this.weekdaysCache[r][t]||(this.weekdaysCache[r][t]=function(t){const e=[];for(let n=1;n<=7;n++){const r=gr.utc(2016,11,13+n);e.push(t(r))}return e}((t=>this.extract(t,n,"weekday")))),this.weekdaysCache[r][t]}))}meridiems(){return K(this,void 0,(()=>pe),(()=>{if(!this.meridiemCache){const t={hour:"numeric",hourCycle:"h12"};this.meridiemCache=[gr.utc(2016,11,13,9),gr.utc(2016,11,13,19)].map((e=>this.extract(e,t,"dayperiod")))}return this.meridiemCache}))}eras(t){return K(this,t,Te,(()=>{const e={era:t};return this.eraCache[t]||(this.eraCache[t]=[gr.utc(-40,1,1),gr.utc(2017,1,1)].map((t=>this.extract(t,e,"era")))),this.eraCache[t]}))}extract(t,e,n){const r=this.dtFormatter(t,e).formatToParts().find((t=>t.type.toLowerCase()===n));return r?r.value:null}numberFormatter(t={}){return new X(this.intl,t.forceSimple||this.fastNumbers,t)}dtFormatter(t,e={}){return new tt(t,this.intl,e)}relFormatter(t={}){return new et(this.intl,this.isEnglish(),t)}listFormatter(t={}){return function(t,e={}){const n=JSON.stringify([t,e]);let r=U[n];return r||(r=new Intl.ListFormat(t,e),U[n]=r),r}(this.intl,t)}isEnglish(){return"en"===this.locale||"en-us"===this.locale.toLowerCase()||B(this.intl).locale.startsWith("en-us")}getWeekSettings(){return this.weekSettings?this.weekSettings:Ht()?function(t){let e=Q.get(t);if(!e){const n=new Intl.Locale(t);e="getWeekInfo"in n?n.getWeekInfo():n.weekInfo,"minimalDays"in e||(e={...nt,...e}),Q.set(t,e)}return e}(this.locale):nt}getStartOfWeek(){return this.getWeekSettings().firstDay}getMinDaysInFirstWeek(){return this.getWeekSettings().minimalDays}getWeekendDays(){return this.getWeekSettings().weekend}equals(t){return this.locale===t.locale&&this.numberingSystem===t.numberingSystem&&this.outputCalendar===t.outputCalendar}toString(){return`Locale(${this.locale}, ${this.numberingSystem}, ${this.outputCalendar})`}}let st=null;class it extends C{static get utcInstance(){return null===st&&(st=new it(0)),st}static instance(t){return 0===t?it.utcInstance:new it(t)}static parseSpecifier(t){if(t){const e=t.match(/^utc(?:([+-]\d{1,2})(?::(\d{2}))?)?$/i);if(e)return new it(ie(e[1],e[2]))}return null}constructor(t){super(),this.fixed=t}get type(){return"fixed"}get name(){return 0===this.fixed?"UTC":`UTC${ae(this.fixed,"narrow")}`}get ianaName(){return 0===this.fixed?"Etc/UTC":`Etc/GMT${ae(-this.fixed,"narrow")}`}offsetName(){return this.name}formatOffset(t,e){return ae(this.fixed,e)}get isUniversal(){return!0}offset(){return this.fixed}equals(t){return"fixed"===t.type&&t.fixed===this.fixed}get isValid(){return!0}}class ut extends C{constructor(t){super(),this.zoneName=t}get type(){return"invalid"}get name(){return this.zoneName}get isUniversal(){return!1}offsetName(){return null}formatOffset(){return""}offset(){return NaN}equals(){return!1}get isValid(){return!1}}function ot(t,e){if(At(t)||null===t)return e;if(t instanceof C)return t;if("string"==typeof t){const n=t.toLowerCase();return"default"===n?e:"local"===n||"system"===n?_.instance:"utc"===n||"gmt"===n?it.utcInstance:it.parseSpecifier(n)||P.create(t)}return _t(t)?it.instance(t):"object"==typeof t&&"offset"in t&&"function"==typeof t.offset?t:new ut(t)}const at={arab:"[٠-٩]",arabext:"[۰-۹]",bali:"[᭐-᭙]",beng:"[০-৯]",deva:"[०-९]",fullwide:"[0-9]",gujr:"[૦-૯]",hanidec:"[〇|一|二|三|四|五|六|七|八|九]",khmr:"[០-៩]",knda:"[೦-೯]",laoo:"[໐-໙]",limb:"[᥆-᥏]",mlym:"[൦-൯]",mong:"[᠐-᠙]",mymr:"[၀-၉]",orya:"[୦-୯]",tamldec:"[௦-௯]",telu:"[౦-౯]",thai:"[๐-๙]",tibt:"[༠-༩]",latn:"\\d"},ct={arab:[1632,1641],arabext:[1776,1785],bali:[6992,7001],beng:[2534,2543],deva:[2406,2415],fullwide:[65296,65303],gujr:[2790,2799],khmr:[6112,6121],knda:[3302,3311],laoo:[3792,3801],limb:[6470,6479],mlym:[3430,3439],mong:[6160,6169],mymr:[4160,4169],orya:[2918,2927],tamldec:[3046,3055],telu:[3174,3183],thai:[3664,3673],tibt:[3872,3881]},lt=at.hanidec.replace(/[\[|\]]/g,"").split(""),ht=new Map;function dt({numberingSystem:t},e=""){const n=t||"latn";let r=ht.get(n);void 0===r&&(r=new Map,ht.set(n,r));let s=r.get(e);return void 0===s&&(s=new RegExp(`${at[n]}${e}`),r.set(e,s)),s}let mt,ft=()=>Date.now(),yt="system",gt=null,wt=null,pt=null,St=60,Mt=null;class kt{static get now(){return ft}static set now(t){ft=t}static set defaultZone(t){yt=t}static get defaultZone(){return ot(yt,_.instance)}static get defaultLocale(){return gt}static set defaultLocale(t){gt=t}static get defaultNumberingSystem(){return wt}static set defaultNumberingSystem(t){wt=t}static get defaultOutputCalendar(){return pt}static set defaultOutputCalendar(t){pt=t}static get defaultWeekSettings(){return Mt}static set defaultWeekSettings(t){Mt=zt(t)}static get twoDigitCutoffYear(){return St}static set twoDigitCutoffYear(t){St=t%100}static get throwOnInvalid(){return mt}static set throwOnInvalid(t){mt=t}static resetCaches(){rt.resetCache(),P.resetCache(),gr.resetCache(),ht.clear()}}class Tt{constructor(t,e){this.reason=t,this.explanation=e}toMessage(){return this.explanation?`${this.reason}: ${this.explanation}`:this.reason}}const bt=[0,31,59,90,120,151,181,212,243,273,304,334],Nt=[0,31,60,91,121,152,182,213,244,274,305,335];function It(t,e){return new Tt("unit out of range",`you specified ${e} (of type ${typeof e}) as a ${t}, which is invalid`)}function vt(t,e,n){const r=new Date(Date.UTC(t,e-1,n));t<100&&t>=0&&r.setUTCFullYear(r.getUTCFullYear()-1900);const s=r.getUTCDay();return 0===s?7:s}function Et(t,e,n){return n+(Qt(t)?Nt:bt)[e-1]}function Ot(t,e){const n=Qt(t)?Nt:bt,r=n.findIndex((t=>t<e));return{month:r+1,day:e-n[r]}}function Dt(t,e){return(t-e+7)%7+1}function $t(t,e=4,n=1){const{year:r,month:s,day:i}=t,u=Et(r,s,i),o=Dt(vt(r,s,i),n);let a,c=Math.floor((u-o+14-e)/7);return c<1?(a=r-1,c=ne(a,e,n)):c>ne(r,e,n)?(a=r+1,c=1):a=r,{weekYear:a,weekNumber:c,weekday:o,...ce(t)}}function xt(t,e=4,n=1){const{weekYear:r,weekNumber:s,weekday:i}=t,u=Dt(vt(r,1,e),n),o=Kt(r);let a,c=7*s+i-u-7+e;c<1?(a=r-1,c+=Kt(a)):c>o?(a=r+1,c-=Kt(r)):a=r;const{month:l,day:h}=Ot(a,c);return{year:a,month:l,day:h,...ce(t)}}function Ft(t){const{year:e,month:n,day:r}=t;return{year:e,ordinal:Et(e,n,r),...ce(t)}}function Lt(t){const{year:e,ordinal:n}=t,{month:r,day:s}=Ot(e,n);return{year:e,month:r,day:s,...ce(t)}}function Zt(t,e){if(!At(t.localWeekday)||!At(t.localWeekNumber)||!At(t.localWeekYear)){if(!At(t.weekday)||!At(t.weekNumber)||!At(t.weekYear))throw new o("Cannot mix locale-based week fields with ISO-based week fields");return At(t.localWeekday)||(t.weekday=t.localWeekday),At(t.localWeekNumber)||(t.weekNumber=t.localWeekNumber),At(t.localWeekYear)||(t.weekYear=t.localWeekYear),delete t.localWeekday,delete t.localWeekNumber,delete t.localWeekYear,{minDaysInFirstWeek:e.getMinDaysInFirstWeek(),startOfWeek:e.getStartOfWeek()}}return{minDaysInFirstWeek:4,startOfWeek:1}}function Wt(t){const e=jt(t.year),n=Rt(t.month,1,12),r=Rt(t.day,1,Xt(t.year,t.month));return e?n?!r&&It("day",t.day):It("month",t.month):It("year",t.year)}function Ct(t){const{hour:e,minute:n,second:r,millisecond:s}=t,i=Rt(e,0,23)||24===e&&0===n&&0===r&&0===s,u=Rt(n,0,59),o=Rt(r,0,59),a=Rt(s,0,999);return i?u?o?!a&&It("millisecond",s):It("second",r):It("minute",n):It("hour",e)}function At(t){return void 0===t}function _t(t){return"number"==typeof t}function jt(t){return"number"==typeof t&&t%1==0}function qt(){try{return"undefined"!=typeof Intl&&!!Intl.RelativeTimeFormat}catch(t){return!1}}function Ht(){try{return"undefined"!=typeof Intl&&!!Intl.Locale&&("weekInfo"in Intl.Locale.prototype||"getWeekInfo"in Intl.Locale.prototype)}catch(t){return!1}}function Pt(t,e,n){if(0!==t.length)return t.reduce(((t,r)=>{const s=[e(r),r];return t&&n(t[0],s[0])===t[0]?t:s}),null)[1]}function Ut(t,e){return Object.prototype.hasOwnProperty.call(t,e)}function zt(t){if(null==t)return null;if("object"!=typeof t)throw new c("Week settings must be an object");if(!Rt(t.firstDay,1,7)||!Rt(t.minimalDays,1,7)||!Array.isArray(t.weekend)||t.weekend.some((t=>!Rt(t,1,7))))throw new c("Invalid week settings");return{firstDay:t.firstDay,minimalDays:t.minimalDays,weekend:Array.from(t.weekend)}}function Rt(t,e,n){return jt(t)&&t>=e&&t<=n}function Jt(t,e=2){let n;return n=t<0?"-"+(""+-t).padStart(e,"0"):(""+t).padStart(e,"0"),n}function Yt(t){return At(t)||null===t||""===t?void 0:parseInt(t,10)}function Gt(t){return At(t)||null===t||""===t?void 0:parseFloat(t)}function Vt(t){if(!At(t)&&null!==t&&""!==t){const e=1e3*parseFloat("0."+t);return Math.floor(e)}}function Bt(t,e,n="round"){const r=10**e;switch(n){case"expand":return t>0?Math.ceil(t*r)/r:Math.floor(t*r)/r;case"trunc":return Math.trunc(t*r)/r;case"round":return Math.round(t*r)/r;case"floor":return Math.floor(t*r)/r;case"ceil":return Math.ceil(t*r)/r;default:throw new RangeError(`Value rounding ${n} is out of range`)}}function Qt(t){return t%4==0&&(t%100!=0||t%400==0)}function Kt(t){return Qt(t)?366:365}function Xt(t,e){const n=(r=e-1)-12*Math.floor(r/12)+1;var r;return 2===n?Qt(t+(e-n)/12)?29:28:[31,null,31,30,31,30,31,31,30,31,30,31][n-1]}function te(t){let e=Date.UTC(t.year,t.month-1,t.day,t.hour,t.minute,t.second,t.millisecond);return t.year<100&&t.year>=0&&(e=new Date(e),e.setUTCFullYear(t.year,t.month-1,t.day)),+e}function ee(t,e,n){return-Dt(vt(t,1,e),n)+e-1}function ne(t,e=4,n=1){const r=ee(t,e,n),s=ee(t+1,e,n);return(Kt(t)-r+s)/7}function re(t){return t>99?t:t>kt.twoDigitCutoffYear?1900+t:2e3+t}function se(t,e,n,r=null){const s=new Date(t),i={hourCycle:"h23",year:"numeric",month:"2-digit",day:"2-digit",hour:"2-digit",minute:"2-digit"};r&&(i.timeZone=r);const u={timeZoneName:e,...i},o=new Intl.DateTimeFormat(n,u).formatToParts(s).find((t=>"timezonename"===t.type.toLowerCase()));return o?o.value:null}function ie(t,e){let n=parseInt(t,10);Number.isNaN(n)&&(n=0);const r=parseInt(e,10)||0;return 60*n+(n<0||Object.is(n,-0)?-r:r)}function ue(t){const e=Number(t);if("boolean"==typeof t||""===t||!Number.isFinite(e))throw new c(`Invalid unit value ${t}`);return e}function oe(t,e){const n={};for(const r in t)if(Ut(t,r)){const s=t[r];if(null==s)continue;n[e(r)]=ue(s)}return n}function ae(t,e){const n=Math.trunc(Math.abs(t/60)),r=Math.trunc(Math.abs(t%60)),s=t>=0?"+":"-";switch(e){case"short":return`${s}${Jt(n,2)}:${Jt(r,2)}`;case"narrow":return`${s}${n}${r>0?`:${r}`:""}`;case"techie":return`${s}${Jt(n,2)}${Jt(r,2)}`;default:throw new RangeError(`Value format ${e} is out of range for property format`)}}function ce(t){return function(t){return["hour","minute","second","millisecond"].reduce(((e,n)=>(e[n]=t[n],e)),{})}(t)}const le=["January","February","March","April","May","June","July","August","September","October","November","December"],he=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],de=["J","F","M","A","M","J","J","A","S","O","N","D"];function me(t){switch(t){case"narrow":return[...de];case"short":return[...he];case"long":return[...le];case"numeric":return["1","2","3","4","5","6","7","8","9","10","11","12"];case"2-digit":return["01","02","03","04","05","06","07","08","09","10","11","12"];default:return null}}const fe=["Monday","Tuesday","Wednesday","Thursday","Friday","Saturday","Sunday"],ye=["Mon","Tue","Wed","Thu","Fri","Sat","Sun"],ge=["M","T","W","T","F","S","S"];function we(t){switch(t){case"narrow":return[...ge];case"short":return[...ye];case"long":return[...fe];case"numeric":return["1","2","3","4","5","6","7"];default:return null}}const pe=["AM","PM"],Se=["Before Christ","Anno Domini"],Me=["BC","AD"],ke=["B","A"];function Te(t){switch(t){case"narrow":return[...ke];case"short":return[...Me];case"long":return[...Se];default:return null}}function be(t,e){let n="";for(const r of t)n+=r.literal?r.val:e(r.val);return n}const Ne={D:f,DD:y,DDD:w,DDDD:p,t:S,tt:M,ttt:k,tttt:T,T:b,TT:N,TTT:I,TTTT:v,f:E,ff:D,fff:F,ffff:Z,F:O,FF:$,FFF:L,FFFF:W};class Ie{static create(t,e={}){return new Ie(t,e)}static parseFormat(t){let e=null,n="",r=!1;const s=[];for(let i=0;i<t.length;i++){const u=t.charAt(i);"'"===u?((n.length>0||r)&&s.push({literal:r||/^\s+$/.test(n),val:""===n?"'":n}),e=null,n="",r=!r):r||u===e?n+=u:(n.length>0&&s.push({literal:/^\s+$/.test(n),val:n}),n=u,e=u)}return n.length>0&&s.push({literal:r||/^\s+$/.test(n),val:n}),s}static macroTokenToFormatOpts(t){return Ne[t]}constructor(t,e){this.opts=e,this.loc=t,this.systemLoc=null}formatWithSystemDefault(t,e){return null===this.systemLoc&&(this.systemLoc=this.loc.redefaultToSystem()),this.systemLoc.dtFormatter(t,{...this.opts,...e}).format()}dtFormatter(t,e={}){return this.loc.dtFormatter(t,{...this.opts,...e})}formatDateTime(t,e){return this.dtFormatter(t,e).format()}formatDateTimeParts(t,e){return this.dtFormatter(t,e).formatToParts()}formatInterval(t,e){return this.dtFormatter(t.start,e).dtf.formatRange(t.start.toJSDate(),t.end.toJSDate())}resolvedOptions(t,e){return this.dtFormatter(t,e).resolvedOptions()}num(t,e=0,n){if(this.opts.forceSimple)return Jt(t,e);const r={...this.opts};return e>0&&(r.padTo=e),n&&(r.signDisplay=n),this.loc.numberFormatter(r).format(t)}formatDateTimeFromString(t,e){const n="en"===this.loc.listingMode(),r=this.loc.outputCalendar&&"gregory"!==this.loc.outputCalendar,s=(e,n)=>this.loc.extract(t,e,n),i=e=>t.isOffsetFixed&&0===t.offset&&e.allowZ?"Z":t.isValid?t.zone.formatOffset(t.ts,e.format):"",u=(e,r)=>n?function(t,e){return me(e)[t.month-1]}(t,e):s(r?{month:e}:{month:e,day:"numeric"},"month"),o=(e,r)=>n?function(t,e){return we(e)[t.weekday-1]}(t,e):s(r?{weekday:e}:{weekday:e,month:"long",day:"numeric"},"weekday"),a=e=>{const n=Ie.macroTokenToFormatOpts(e);return n?this.formatWithSystemDefault(t,n):e},c=e=>n?function(t,e){return Te(e)[t.year<0?0:1]}(t,e):s({era:e},"era");return be(Ie.parseFormat(e),(e=>{switch(e){case"S":return this.num(t.millisecond);case"u":case"SSS":return this.num(t.millisecond,3);case"s":return this.num(t.second);case"ss":return this.num(t.second,2);case"uu":return this.num(Math.floor(t.millisecond/10),2);case"uuu":return this.num(Math.floor(t.millisecond/100));case"m":return this.num(t.minute);case"mm":return this.num(t.minute,2);case"h":return this.num(t.hour%12==0?12:t.hour%12);case"hh":return this.num(t.hour%12==0?12:t.hour%12,2);case"H":return this.num(t.hour);case"HH":return this.num(t.hour,2);case"Z":return i({format:"narrow",allowZ:this.opts.allowZ});case"ZZ":return i({format:"short",allowZ:this.opts.allowZ});case"ZZZ":return i({format:"techie",allowZ:this.opts.allowZ});case"ZZZZ":return t.zone.offsetName(t.ts,{format:"short",locale:this.loc.locale});case"ZZZZZ":return t.zone.offsetName(t.ts,{format:"long",locale:this.loc.locale});case"z":return t.zoneName;case"a":return n?function(t){return pe[t.hour<12?0:1]}(t):s({hour:"numeric",hourCycle:"h12"},"dayperiod");case"d":return r?s({day:"numeric"},"day"):this.num(t.day);case"dd":return r?s({day:"2-digit"},"day"):this.num(t.day,2);case"c":case"E":return this.num(t.weekday);case"ccc":return o("short",!0);case"cccc":return o("long",!0);case"ccccc":return o("narrow",!0);case"EEE":return o("short",!1);case"EEEE":return o("long",!1);case"EEEEE":return o("narrow",!1);case"L":return r?s({month:"numeric",day:"numeric"},"month"):this.num(t.month);case"LL":return r?s({month:"2-digit",day:"numeric"},"month"):this.num(t.month,2);case"LLL":return u("short",!0);case"LLLL":return u("long",!0);case"LLLLL":return u("narrow",!0);case"M":return r?s({month:"numeric"},"month"):this.num(t.month);case"MM":return r?s({month:"2-digit"},"month"):this.num(t.month,2);case"MMM":return u("short",!1);case"MMMM":return u("long",!1);case"MMMMM":return u("narrow",!1);case"y":return r?s({year:"numeric"},"year"):this.num(t.year);case"yy":return r?s({year:"2-digit"},"year"):this.num(t.year.toString().slice(-2),2);case"yyyy":return r?s({year:"numeric"},"year"):this.num(t.year,4);case"yyyyyy":return r?s({year:"numeric"},"year"):this.num(t.year,6);case"G":return c("short");case"GG":return c("long");case"GGGGG":return c("narrow");case"kk":return this.num(t.weekYear.toString().slice(-2),2);case"kkkk":return this.num(t.weekYear,4);case"W":return this.num(t.weekNumber);case"WW":return this.num(t.weekNumber,2);case"n":return this.num(t.localWeekNumber);case"nn":return this.num(t.localWeekNumber,2);case"ii":return this.num(t.localWeekYear.toString().slice(-2),2);case"iiii":return this.num(t.localWeekYear,4);case"o":return this.num(t.ordinal);case"ooo":return this.num(t.ordinal,3);case"q":return this.num(t.quarter);case"qq":return this.num(t.quarter,2);case"X":return this.num(Math.floor(t.ts/1e3));case"x":return this.num(t.ts);default:return a(e)}}))}formatDurationFromString(t,e){const n="negativeLargestOnly"===this.opts.signMode?-1:1,r=t=>{switch(t[0]){case"S":return"milliseconds";case"s":return"seconds";case"m":return"minutes";case"h":return"hours";case"d":return"days";case"w":return"weeks";case"M":return"months";case"y":return"years";default:return null}},s=Ie.parseFormat(e),i=s.reduce(((t,{literal:e,val:n})=>e?t:t.concat(n)),[]),u=t.shiftTo(...i.map(r).filter((t=>t)));return be(s,((t,e)=>s=>{const i=r(s);if(i){const r=e.isNegativeDuration&&i!==e.largestUnit?n:1;let u;return u="negativeLargestOnly"===this.opts.signMode&&i!==e.largestUnit?"never":"all"===this.opts.signMode?"always":"auto",this.num(t.get(i)*r,s.length,u)}return s})(u,{isNegativeDuration:u<0,largestUnit:Object.keys(u.values)[0]}))}}const ve=/[A-Za-z_+-]{1,256}(?::?\/[A-Za-z0-9_+-]{1,256}(?:\/[A-Za-z0-9_+-]{1,256})?)?/;function Ee(...t){const e=t.reduce(((t,e)=>t+e.source),"");return RegExp(`^${e}$`)}function Oe(...t){return e=>t.reduce((([t,n,r],s)=>{const[i,u,o]=s(e,r);return[{...t,...i},u||n,o]}),[{},null,1]).slice(0,2)}function De(t,...e){if(null==t)return[null,null];for(const[n,r]of e){const e=n.exec(t);if(e)return r(e)}return[null,null]}function $e(...t){return(e,n)=>{const r={};let s;for(s=0;s<t.length;s++)r[t[s]]=Yt(e[n+s]);return[r,null,n+s]}}const xe=/(?:([Zz])|([+-]\d\d)(?::?(\d\d))?)/,Fe=/(\d\d)(?::?(\d\d)(?::?(\d\d)(?:[.,](\d{1,30}))?)?)?/,Le=RegExp(`${Fe.source}(?:${xe.source}?(?:\\[(${ve.source})\\])?)?`),Ze=RegExp(`(?:[Tt]${Le.source})?`),We=$e("weekYear","weekNumber","weekDay"),Ce=$e("year","ordinal"),Ae=RegExp(`${Fe.source} ?(?:${xe.source}|(${ve.source}))?`),_e=RegExp(`(?: ${Ae.source})?`);function je(t,e,n){const r=t[e];return At(r)?n:Yt(r)}function qe(t,e){return[{hours:je(t,e,0),minutes:je(t,e+1,0),seconds:je(t,e+2,0),milliseconds:Vt(t[e+3])},null,e+4]}function He(t,e){const n=!t[e]&&!t[e+1],r=ie(t[e+1],t[e+2]);return[{},n?null:it.instance(r),e+3]}function Pe(t,e){return[{},t[e]?P.create(t[e]):null,e+1]}const Ue=RegExp(`^T?${Fe.source}$`),ze=/^-?P(?:(?:(-?\d{1,20}(?:\.\d{1,20})?)Y)?(?:(-?\d{1,20}(?:\.\d{1,20})?)M)?(?:(-?\d{1,20}(?:\.\d{1,20})?)W)?(?:(-?\d{1,20}(?:\.\d{1,20})?)D)?(?:T(?:(-?\d{1,20}(?:\.\d{1,20})?)H)?(?:(-?\d{1,20}(?:\.\d{1,20})?)M)?(?:(-?\d{1,20})(?:[.,](-?\d{1,20}))?S)?)?)$/;function Re(t){const[e,n,r,s,i,u,o,a,c]=t,l="-"===e[0],h=a&&"-"===a[0],d=(t,e=!1)=>void 0!==t&&(e||t&&l)?-t:t;return[{years:d(Gt(n)),months:d(Gt(r)),weeks:d(Gt(s)),days:d(Gt(i)),hours:d(Gt(u)),minutes:d(Gt(o)),seconds:d(Gt(a),"-0"===a),milliseconds:d(Vt(c),h)}]}const Je={GMT:0,EDT:-240,EST:-300,CDT:-300,CST:-360,MDT:-360,MST:-420,PDT:-420,PST:-480};function Ye(t,e,n,r,s,i,u){const o={year:2===e.length?re(Yt(e)):Yt(e),month:he.indexOf(n)+1,day:Yt(r),hour:Yt(s),minute:Yt(i)};return u&&(o.second=Yt(u)),t&&(o.weekday=t.length>3?fe.indexOf(t)+1:ye.indexOf(t)+1),o}const Ge=/^(?:(Mon|Tue|Wed|Thu|Fri|Sat|Sun),\s)?(\d{1,2})\s(Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec)\s(\d{2,4})\s(\d\d):(\d\d)(?::(\d\d))?\s(?:(UT|GMT|[ECMP][SD]T)|([Zz])|(?:([+-]\d\d)(\d\d)))$/;function Ve(t){const[,e,n,r,s,i,u,o,a,c,l,h]=t,d=Ye(e,s,r,n,i,u,o);let m;return m=a?Je[a]:c?0:ie(l,h),[d,new it(m)]}const Be=/^(Mon|Tue|Wed|Thu|Fri|Sat|Sun), (\d\d) (Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec) (\d{4}) (\d\d):(\d\d):(\d\d) GMT$/,Qe=/^(Monday|Tuesday|Wednesday|Thursday|Friday|Saturday|Sunday), (\d\d)-(Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec)-(\d\d) (\d\d):(\d\d):(\d\d) GMT$/,Ke=/^(Mon|Tue|Wed|Thu|Fri|Sat|Sun) (Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec) ( \d|\d\d) (\d\d):(\d\d):(\d\d) (\d{4})$/;function Xe(t){const[,e,n,r,s,i,u,o]=t;return[Ye(e,s,r,n,i,u,o),it.utcInstance]}function tn(t){const[,e,n,r,s,i,u,o]=t;return[Ye(e,o,n,r,s,i,u),it.utcInstance]}const en=Ee(/([+-]\d{6}|\d{4})(?:-?(\d\d)(?:-?(\d\d))?)?/,Ze),nn=Ee(/(\d{4})-?W(\d\d)(?:-?(\d))?/,Ze),rn=Ee(/(\d{4})-?(\d{3})/,Ze),sn=Ee(Le),un=Oe((function(t,e){return[{year:je(t,e),month:je(t,e+1,1),day:je(t,e+2,1)},null,e+3]}),qe,He,Pe),on=Oe(We,qe,He,Pe),an=Oe(Ce,qe,He,Pe),cn=Oe(qe,He,Pe),ln=Oe(qe),hn=Ee(/(\d{4})-(\d\d)-(\d\d)/,_e),dn=Ee(Ae),mn=Oe(qe,He,Pe),fn="Invalid Duration",yn={weeks:{days:7,hours:168,minutes:10080,seconds:604800,milliseconds:6048e5},days:{hours:24,minutes:1440,seconds:86400,milliseconds:864e5},hours:{minutes:60,seconds:3600,milliseconds:36e5},minutes:{seconds:60,milliseconds:6e4},seconds:{milliseconds:1e3}},gn={years:{quarters:4,months:12,weeks:52,days:365,hours:8760,minutes:525600,seconds:31536e3,milliseconds:31536e6},quarters:{months:3,weeks:13,days:91,hours:2184,minutes:131040,seconds:7862400,milliseconds:78624e5},months:{weeks:4,days:30,hours:720,minutes:43200,seconds:2592e3,milliseconds:2592e6},...yn},wn={years:{quarters:4,months:12,weeks:52.1775,days:365.2425,hours:8765.82,minutes:525949.2,seconds:525949.2*60,milliseconds:525949.2*60*1e3},quarters:{months:3,weeks:13.044375,days:91.310625,hours:2191.455,minutes:131487.3,seconds:525949.2*60/4,milliseconds:7889237999.999999},months:{weeks:4.3481250000000005,days:30.436875,hours:730.485,minutes:43829.1,seconds:2629746,milliseconds:2629746e3},...yn},pn=["years","quarters","months","weeks","days","hours","minutes","seconds","milliseconds"],Sn=pn.slice(0).reverse();function Mn(t,e,n=!1){const r={values:n?e.values:{...t.values,...e.values||{}},loc:t.loc.clone(e.loc),conversionAccuracy:e.conversionAccuracy||t.conversionAccuracy,matrix:e.matrix||t.matrix};return new Nn(r)}function kn(t,e){let n=e.milliseconds??0;for(const r of Sn.slice(1))e[r]&&(n+=e[r]*t[r].milliseconds);return n}function Tn(t,e){const n=kn(t,e)<0?-1:1;pn.reduceRight(((r,s)=>{if(At(e[s]))return r;if(r){const i=t[s][r],u=Math.floor(e[r]*n/i);e[s]+=u*n,e[r]-=u*i*n}return s}),null),pn.reduce(((n,r)=>{if(At(e[r]))return n;if(n){const s=e[n]%1;e[n]-=s,e[r]+=s*t[n][r]}return r}),null)}function bn(t){const e={};for(const[n,r]of Object.entries(t))0!==r&&(e[n]=r);return e}class Nn{constructor(t){const e="longterm"===t.conversionAccuracy||!1;let n=e?wn:gn;t.matrix&&(n=t.matrix),this.values=t.values,this.loc=t.loc||rt.create(),this.conversionAccuracy=e?"longterm":"casual",this.invalid=t.invalid||null,this.matrix=n,this.isLuxonDuration=!0}static fromMillis(t,e){return Nn.fromObject({milliseconds:t},e)}static fromObject(t,e={}){if(null==t||"object"!=typeof t)throw new c("Duration.fromObject: argument expected to be an object, got "+(null===t?"null":typeof t));return new Nn({values:oe(t,Nn.normalizeUnit),loc:rt.fromObject(e),conversionAccuracy:e.conversionAccuracy,matrix:e.matrix})}static fromDurationLike(t){if(_t(t))return Nn.fromMillis(t);if(Nn.isDuration(t))return t;if("object"==typeof t)return Nn.fromObject(t);throw new c(`Unknown duration argument ${t} of type ${typeof t}`)}static fromISO(t,e){const[n]=function(t){return De(t,[ze,Re])}(t);return n?Nn.fromObject(n,e):Nn.invalid("unparsable",`the input "${t}" can't be parsed as ISO 8601`)}static fromISOTime(t,e){const[n]=function(t){return De(t,[Ue,ln])}(t);return n?Nn.fromObject(n,e):Nn.invalid("unparsable",`the input "${t}" can't be parsed as ISO 8601`)}static invalid(t,e=null){if(!t)throw new c("need to specify a reason the Duration is invalid");const n=t instanceof Tt?t:new Tt(t,e);if(kt.throwOnInvalid)throw new u(n);return new Nn({invalid:n})}static normalizeUnit(t){const e={year:"years",years:"years",quarter:"quarters",quarters:"quarters",month:"months",months:"months",week:"weeks",weeks:"weeks",day:"days",days:"days",hour:"hours",hours:"hours",minute:"minutes",minutes:"minutes",second:"seconds",seconds:"seconds",millisecond:"milliseconds",milliseconds:"milliseconds"}[t?t.toLowerCase():t];if(!e)throw new a(t);return e}static isDuration(t){return t&&t.isLuxonDuration||!1}get locale(){return this.isValid?this.loc.locale:null}get numberingSystem(){return this.isValid?this.loc.numberingSystem:null}toFormat(t,e={}){const n={...e,floor:!1!==e.round&&!1!==e.floor};return this.isValid?Ie.create(this.loc,n).formatDurationFromString(this,t):fn}toHuman(t={}){if(!this.isValid)return fn;const e=!1!==t.showZeros,n=pn.map((n=>{const r=this.values[n];return At(r)||0===r&&!e?null:this.loc.numberFormatter({style:"unit",unitDisplay:"long",...t,unit:n.slice(0,-1)}).format(r)})).filter((t=>t));return this.loc.listFormatter({type:"conjunction",style:t.listStyle||"narrow",...t}).format(n)}toObject(){return this.isValid?{...this.values}:{}}toISO(){if(!this.isValid)return null;let t="P";return 0!==this.years&&(t+=this.years+"Y"),0===this.months&&0===this.quarters||(t+=this.months+3*this.quarters+"M"),0!==this.weeks&&(t+=this.weeks+"W"),0!==this.days&&(t+=this.days+"D"),0===this.hours&&0===this.minutes&&0===this.seconds&&0===this.milliseconds||(t+="T"),0!==this.hours&&(t+=this.hours+"H"),0!==this.minutes&&(t+=this.minutes+"M"),0===this.seconds&&0===this.milliseconds||(t+=Bt(this.seconds+this.milliseconds/1e3,3)+"S"),"P"===t&&(t+="T0S"),t}toISOTime(t={}){if(!this.isValid)return null;const e=this.toMillis();return e<0||e>=864e5?null:(t={suppressMilliseconds:!1,suppressSeconds:!1,includePrefix:!1,format:"extended",...t,includeOffset:!1},gr.fromMillis(e,{zone:"UTC"}).toISOTime(t))}toJSON(){return this.toISO()}toString(){return this.toISO()}[Symbol.for("nodejs.util.inspect.custom")](){return this.isValid?`Duration { values: ${JSON.stringify(this.values)} }`:`Duration { Invalid, reason: ${this.invalidReason} }`}toMillis(){return this.isValid?kn(this.matrix,this.values):NaN}valueOf(){return this.toMillis()}plus(t){if(!this.isValid)return this;const e=Nn.fromDurationLike(t),n={};for(const t of pn)(Ut(e.values,t)||Ut(this.values,t))&&(n[t]=e.get(t)+this.get(t));return Mn(this,{values:n},!0)}minus(t){if(!this.isValid)return this;const e=Nn.fromDurationLike(t);return this.plus(e.negate())}mapUnits(t){if(!this.isValid)return this;const e={};for(const n of Object.keys(this.values))e[n]=ue(t(this.values[n],n));return Mn(this,{values:e},!0)}get(t){return this[Nn.normalizeUnit(t)]}set(t){return this.isValid?Mn(this,{values:{...this.values,...oe(t,Nn.normalizeUnit)}}):this}reconfigure({locale:t,numberingSystem:e,conversionAccuracy:n,matrix:r}={}){return Mn(this,{loc:this.loc.clone({locale:t,numberingSystem:e}),matrix:r,conversionAccuracy:n})}as(t){return this.isValid?this.shiftTo(t).get(t):NaN}normalize(){if(!this.isValid)return this;const t=this.toObject();return Tn(this.matrix,t),Mn(this,{values:t},!0)}rescale(){return this.isValid?Mn(this,{values:bn(this.normalize().shiftToAll().toObject())},!0):this}shiftTo(...t){if(!this.isValid)return this;if(0===t.length)return this;t=t.map((t=>Nn.normalizeUnit(t)));const e={},n={},r=this.toObject();let s;for(const i of pn)if(t.indexOf(i)>=0){s=i;let t=0;for(const e in n)t+=this.matrix[e][i]*n[e],n[e]=0;_t(r[i])&&(t+=r[i]);const u=Math.trunc(t);e[i]=u,n[i]=(1e3*t-1e3*u)/1e3}else _t(r[i])&&(n[i]=r[i]);for(const t in n)0!==n[t]&&(e[s]+=t===s?n[t]:n[t]/this.matrix[s][t]);return Tn(this.matrix,e),Mn(this,{values:e},!0)}shiftToAll(){return this.isValid?this.shiftTo("years","months","weeks","days","hours","minutes","seconds","milliseconds"):this}negate(){if(!this.isValid)return this;const t={};for(const e of Object.keys(this.values))t[e]=0===this.values[e]?0:-this.values[e];return Mn(this,{values:t},!0)}removeZeros(){return this.isValid?Mn(this,{values:bn(this.values)},!0):this}get years(){return this.isValid?this.values.years||0:NaN}get quarters(){return this.isValid?this.values.quarters||0:NaN}get months(){return this.isValid?this.values.months||0:NaN}get weeks(){return this.isValid?this.values.weeks||0:NaN}get days(){return this.isValid?this.values.days||0:NaN}get hours(){return this.isValid?this.values.hours||0:NaN}get minutes(){return this.isValid?this.values.minutes||0:NaN}get seconds(){return this.isValid?this.values.seconds||0:NaN}get milliseconds(){return this.isValid?this.values.milliseconds||0:NaN}get isValid(){return null===this.invalid}get invalidReason(){return this.invalid?this.invalid.reason:null}get invalidExplanation(){return this.invalid?this.invalid.explanation:null}equals(t){if(!this.isValid||!t.isValid)return!1;if(!this.loc.equals(t.loc))return!1;for(const r of pn)if(n=t.values[r],!(void 0===(e=this.values[r])||0===e?void 0===n||0===n:e===n))return!1;var e,n;return!0}}const In="Invalid Interval";class vn{constructor(t){this.s=t.start,this.e=t.end,this.invalid=t.invalid||null,this.isLuxonInterval=!0}static invalid(t,e=null){if(!t)throw new c("need to specify a reason the Interval is invalid");const n=t instanceof Tt?t:new Tt(t,e);if(kt.throwOnInvalid)throw new i(n);return new vn({invalid:n})}static fromDateTimes(t,e){const n=wr(t),r=wr(e),s=function(t,e){return t&&t.isValid?e&&e.isValid?e<t?vn.invalid("end before start",`The end of an interval must be after its start, but you had start=${t.toISO()} and end=${e.toISO()}`):null:vn.invalid("missing or invalid end"):vn.invalid("missing or invalid start")}(n,r);return null==s?new vn({start:n,end:r}):s}static after(t,e){const n=Nn.fromDurationLike(e),r=wr(t);return vn.fromDateTimes(r,r.plus(n))}static before(t,e){const n=Nn.fromDurationLike(e),r=wr(t);return vn.fromDateTimes(r.minus(n),r)}static fromISO(t,e){const[n,r]=(t||"").split("/",2);if(n&&r){let t,s,i,u;try{t=gr.fromISO(n,e),s=t.isValid}catch(r){s=!1}try{i=gr.fromISO(r,e),u=i.isValid}catch(r){u=!1}if(s&&u)return vn.fromDateTimes(t,i);if(s){const n=Nn.fromISO(r,e);if(n.isValid)return vn.after(t,n)}else if(u){const t=Nn.fromISO(n,e);if(t.isValid)return vn.before(i,t)}}return vn.invalid("unparsable",`the input "${t}" can't be parsed as ISO 8601`)}static isInterval(t){return t&&t.isLuxonInterval||!1}get start(){return this.isValid?this.s:null}get end(){return this.isValid?this.e:null}get lastDateTime(){return this.isValid&&this.e?this.e.minus(1):null}get isValid(){return null===this.invalidReason}get invalidReason(){return this.invalid?this.invalid.reason:null}get invalidExplanation(){return this.invalid?this.invalid.explanation:null}length(t="milliseconds"){return this.isValid?this.toDuration(t).get(t):NaN}count(t="milliseconds",e){if(!this.isValid)return NaN;const n=this.start.startOf(t,e);let r;return r=e?.useLocaleWeeks?this.end.reconfigure({locale:n.locale}):this.end,r=r.startOf(t,e),Math.floor(r.diff(n,t).get(t))+(r.valueOf()!==this.end.valueOf())}hasSame(t){return!!this.isValid&&(this.isEmpty()||this.e.minus(1).hasSame(this.s,t))}isEmpty(){return this.s.valueOf()===this.e.valueOf()}isAfter(t){return!!this.isValid&&this.s>t}isBefore(t){return!!this.isValid&&this.e<=t}contains(t){return!!this.isValid&&this.s<=t&&this.e>t}set({start:t,end:e}={}){return this.isValid?vn.fromDateTimes(t||this.s,e||this.e):this}splitAt(...t){if(!this.isValid)return[];const e=t.map(wr).filter((t=>this.contains(t))).sort(((t,e)=>t.toMillis()-e.toMillis())),n=[];let{s:r}=this,s=0;for(;r<this.e;){const t=e[s]||this.e,i=+t>+this.e?this.e:t;n.push(vn.fromDateTimes(r,i)),r=i,s+=1}return n}splitBy(t){const e=Nn.fromDurationLike(t);if(!this.isValid||!e.isValid||0===e.as("milliseconds"))return[];let n,{s:r}=this,s=1;const i=[];for(;r<this.e;){const t=this.start.plus(e.mapUnits((t=>t*s)));n=+t>+this.e?this.e:t,i.push(vn.fromDateTimes(r,n)),r=n,s+=1}return i}divideEqually(t){return this.isValid?this.splitBy(this.length()/t).slice(0,t):[]}overlaps(t){return this.e>t.s&&this.s<t.e}abutsStart(t){return!!this.isValid&&+this.e==+t.s}abutsEnd(t){return!!this.isValid&&+t.e==+this.s}engulfs(t){return!!this.isValid&&this.s<=t.s&&this.e>=t.e}equals(t){return!(!this.isValid||!t.isValid)&&this.s.equals(t.s)&&this.e.equals(t.e)}intersection(t){if(!this.isValid)return this;const e=this.s>t.s?this.s:t.s,n=this.e<t.e?this.e:t.e;return e>=n?null:vn.fromDateTimes(e,n)}union(t){return this.isValid?vn.fromDateTimes(this.s<t.s?this.s:t.s,this.e>t.e?this.e:t.e):this}static merge(t){const[e,n]=t.sort(((t,e)=>t.s-e.s)).reduce((([t,e],n)=>e?e.overlaps(n)||e.abutsStart(n)?[t,e.union(n)]:[t.concat([e]),n]:[t,n]),[[],null]);return n&&e.push(n),e}static xor(t){let e=null,n=0;const r=[],s=t.map((t=>[{time:t.s,type:"s"},{time:t.e,type:"e"}])),i=Array.prototype.concat(...s).sort(((t,e)=>t.time-e.time));for(const t of i)n+="s"===t.type?1:-1,1===n?e=t.time:(e&&+e!=+t.time&&r.push(vn.fromDateTimes(e,t.time)),e=null);return vn.merge(r)}difference(...t){return vn.xor([this].concat(t)).map((t=>this.intersection(t))).filter((t=>t&&!t.isEmpty()))}toString(){return this.isValid?`[${this.s.toISO()} – ${this.e.toISO()})`:In}[Symbol.for("nodejs.util.inspect.custom")](){return this.isValid?`Interval { start: ${this.s.toISO()}, end: ${this.e.toISO()} }`:`Interval { Invalid, reason: ${this.invalidReason} }`}toLocaleString(t=f,e={}){return this.isValid?Ie.create(this.s.loc.clone(e),t).formatInterval(this):In}toISO(t){return this.isValid?`${this.s.toISO(t)}/${this.e.toISO(t)}`:In}toISODate(){return this.isValid?`${this.s.toISODate()}/${this.e.toISODate()}`:In}toISOTime(t){return this.isValid?`${this.s.toISOTime(t)}/${this.e.toISOTime(t)}`:In}toFormat(t,{separator:e=" – "}={}){return this.isValid?`${this.s.toFormat(t)}${e}${this.e.toFormat(t)}`:In}toDuration(t,e){return this.isValid?this.e.diff(this.s,t,e):Nn.invalid(this.invalidReason)}mapEndpoints(t){return vn.fromDateTimes(t(this.s),t(this.e))}}class En{static hasDST(t=kt.defaultZone){const e=gr.now().setZone(t).set({month:12});return!t.isUniversal&&e.offset!==e.set({month:6}).offset}static isValidIANAZone(t){return P.isValidZone(t)}static normalizeZone(t){return ot(t,kt.defaultZone)}static getStartOfWeek({locale:t=null,locObj:e=null}={}){return(e||rt.create(t)).getStartOfWeek()}static getMinimumDaysInFirstWeek({locale:t=null,locObj:e=null}={}){return(e||rt.create(t)).getMinDaysInFirstWeek()}static getWeekendWeekdays({locale:t=null,locObj:e=null}={}){return(e||rt.create(t)).getWeekendDays().slice()}static months(t="long",{locale:e=null,numberingSystem:n=null,locObj:r=null,outputCalendar:s="gregory"}={}){return(r||rt.create(e,n,s)).months(t)}static monthsFormat(t="long",{locale:e=null,numberingSystem:n=null,locObj:r=null,outputCalendar:s="gregory"}={}){return(r||rt.create(e,n,s)).months(t,!0)}static weekdays(t="long",{locale:e=null,numberingSystem:n=null,locObj:r=null}={}){return(r||rt.create(e,n,null)).weekdays(t)}static weekdaysFormat(t="long",{locale:e=null,numberingSystem:n=null,locObj:r=null}={}){return(r||rt.create(e,n,null)).weekdays(t,!0)}static meridiems({locale:t=null}={}){return rt.create(t).meridiems()}static eras(t="short",{locale:e=null}={}){return rt.create(e,null,"gregory").eras(t)}static features(){return{relative:qt(),localeWeek:Ht()}}}function On(t,e){const n=t=>t.toUTC(0,{keepLocalTime:!0}).startOf("day").valueOf(),r=n(e)-n(t);return Math.floor(Nn.fromMillis(r).as("days"))}function Dn(t,e=t=>t){return{regex:t,deser:([t])=>e(function(t){let e=parseInt(t,10);if(isNaN(e)){e="";for(let n=0;n<t.length;n++){const r=t.charCodeAt(n);if(-1!==t[n].search(at.hanidec))e+=lt.indexOf(t[n]);else for(const t in ct){const[n,s]=ct[t];r>=n&&r<=s&&(e+=r-n)}}return parseInt(e,10)}return e}(t))}}const $n=`[ ${String.fromCharCode(160)}]`,xn=new RegExp($n,"g");function Fn(t){return t.replace(/\./g,"\\.?").replace(xn,$n)}function Ln(t){return t.replace(/\./g,"").replace(xn," ").toLowerCase()}function Zn(t,e){return null===t?null:{regex:RegExp(t.map(Fn).join("|")),deser:([n])=>t.findIndex((t=>Ln(n)===Ln(t)))+e}}function Wn(t,e){return{regex:t,deser:([,t,e])=>ie(t,e),groups:e}}function Cn(t){return{regex:t,deser:([t])=>t}}const An={year:{"2-digit":"yy",numeric:"yyyyy"},month:{numeric:"M","2-digit":"MM",short:"MMM",long:"MMMM"},day:{numeric:"d","2-digit":"dd"},weekday:{short:"EEE",long:"EEEE"},dayperiod:"a",dayPeriod:"a",hour12:{numeric:"h","2-digit":"hh"},hour24:{numeric:"H","2-digit":"HH"},minute:{numeric:"m","2-digit":"mm"},second:{numeric:"s","2-digit":"ss"},timeZoneName:{long:"ZZZZZ",short:"ZZZ"}};let _n=null;function jn(t,e){return Array.prototype.concat(...t.map((t=>function(t,e){if(t.literal)return t;const n=Pn(Ie.macroTokenToFormatOpts(t.val),e);return null==n||n.includes(void 0)?t:n}(t,e))))}class qn{constructor(t,e){if(this.locale=t,this.format=e,this.tokens=jn(Ie.parseFormat(e),t),this.units=this.tokens.map((e=>function(t,e){const n=dt(e),r=dt(e,"{2}"),s=dt(e,"{3}"),i=dt(e,"{4}"),u=dt(e,"{6}"),o=dt(e,"{1,2}"),a=dt(e,"{1,3}"),c=dt(e,"{1,6}"),l=dt(e,"{1,9}"),h=dt(e,"{2,4}"),d=dt(e,"{4,6}"),m=t=>{return{regex:RegExp((e=t.val,e.replace(/[\-\[\]{}()*+?.,\\\^$|#\s]/g,"\\$&"))),deser:([t])=>t,literal:!0};var e},f=(f=>{if(t.literal)return m(f);switch(f.val){case"G":return Zn(e.eras("short"),0);case"GG":return Zn(e.eras("long"),0);case"y":return Dn(c);case"yy":case"kk":return Dn(h,re);case"yyyy":case"kkkk":return Dn(i);case"yyyyy":return Dn(d);case"yyyyyy":return Dn(u);case"M":case"L":case"d":case"H":case"h":case"m":case"q":case"s":case"W":return Dn(o);case"MM":case"LL":case"dd":case"HH":case"hh":case"mm":case"qq":case"ss":case"WW":return Dn(r);case"MMM":return Zn(e.months("short",!0),1);case"MMMM":return Zn(e.months("long",!0),1);case"LLL":return Zn(e.months("short",!1),1);case"LLLL":return Zn(e.months("long",!1),1);case"o":case"S":return Dn(a);case"ooo":case"SSS":return Dn(s);case"u":return Cn(l);case"uu":return Cn(o);case"uuu":case"E":case"c":return Dn(n);case"a":return Zn(e.meridiems(),0);case"EEE":return Zn(e.weekdays("short",!1),1);case"EEEE":return Zn(e.weekdays("long",!1),1);case"ccc":return Zn(e.weekdays("short",!0),1);case"cccc":return Zn(e.weekdays("long",!0),1);case"Z":case"ZZ":return Wn(new RegExp(`([+-]${o.source})(?::(${r.source}))?`),2);case"ZZZ":return Wn(new RegExp(`([+-]${o.source})(${r.source})?`),2);case"z":return Cn(/[a-z_+-/]{1,256}?/i);case" ":return Cn(/[^\S\n\r]/);default:return m(f)}})(t)||{invalidReason:"missing Intl.DateTimeFormat.formatToParts support"};return f.token=t,f}(e,t))),this.disqualifyingUnit=this.units.find((t=>t.invalidReason)),!this.disqualifyingUnit){const[t,e]=[`^${(n=this.units).map((t=>t.regex)).reduce(((t,e)=>`${t}(${e.source})`),"")}$`,n];this.regex=RegExp(t,"i"),this.handlers=e}var n}explainFromTokens(t){if(this.isValid){const[e,n]=function(t,e,n){const r=t.match(e);if(r){const t={};let e=1;for(const s in n)if(Ut(n,s)){const i=n[s],u=i.groups?i.groups+1:1;!i.literal&&i.token&&(t[i.token.val[0]]=i.deser(r.slice(e,e+u))),e+=u}return[r,t]}return[r,{}]}(t,this.regex,this.handlers),[r,s,i]=n?function(t){let e,n=null;return At(t.z)||(n=P.create(t.z)),At(t.Z)||(n||(n=new it(t.Z)),e=t.Z),At(t.q)||(t.M=3*(t.q-1)+1),At(t.h)||(t.h<12&&1===t.a?t.h+=12:12===t.h&&0===t.a&&(t.h=0)),0===t.G&&t.y&&(t.y=-t.y),At(t.u)||(t.S=Vt(t.u)),[Object.keys(t).reduce(((e,n)=>{const r=(t=>{switch(t){case"S":return"millisecond";case"s":return"second";case"m":return"minute";case"h":case"H":return"hour";case"d":return"day";case"o":return"ordinal";case"L":case"M":return"month";case"y":return"year";case"E":case"c":return"weekday";case"W":return"weekNumber";case"k":return"weekYear";case"q":return"quarter";default:return null}})(n);return r&&(e[r]=t[n]),e}),{}),n,e]}(n):[null,null,void 0];if(Ut(n,"a")&&Ut(n,"H"))throw new o("Can't include meridiem when specifying 24-hour format");return{input:t,tokens:this.tokens,regex:this.regex,rawMatches:e,matches:n,result:r,zone:s,specificOffset:i}}return{input:t,tokens:this.tokens,invalidReason:this.invalidReason}}get isValid(){return!this.disqualifyingUnit}get invalidReason(){return this.disqualifyingUnit?this.disqualifyingUnit.invalidReason:null}}function Hn(t,e,n){return new qn(t,n).explainFromTokens(e)}function Pn(t,e){if(!t)return null;const n=Ie.create(e,t).dtFormatter((_n||(_n=gr.fromMillis(1555555555555)),_n)),r=n.formatToParts(),s=n.resolvedOptions();return r.map((e=>function(t,e,n){const{type:r,value:s}=t;if("literal"===r){const t=/^\s+$/.test(s);return{literal:!t,val:t?" ":s}}let i=r;"hour"===r&&(i=null!=e.hour12?e.hour12?"hour12":"hour24":null!=e.hourCycle?"h11"===e.hourCycle||"h12"===e.hourCycle?"hour12":"hour24":n.hour12?"hour12":"hour24");let u=An[i];if("object"==typeof u&&(u=u[e[r]]),u)return{literal:!1,val:u}}(e,t,s)))}const Un="Invalid DateTime",zn=864e13;function Rn(t){return new Tt("unsupported zone",`the zone "${t.name}" is not supported`)}function Jn(t){return null===t.weekData&&(t.weekData=$t(t.c)),t.weekData}function Yn(t){return null===t.localWeekData&&(t.localWeekData=$t(t.c,t.loc.getMinDaysInFirstWeek(),t.loc.getStartOfWeek())),t.localWeekData}function Gn(t,e){const n={ts:t.ts,zone:t.zone,c:t.c,o:t.o,loc:t.loc,invalid:t.invalid};return new gr({...n,...e,old:n})}function Vn(t,e,n){let r=t-60*e*1e3;const s=n.offset(r);if(e===s)return[r,e];r-=60*(s-e)*1e3;const i=n.offset(r);return s===i?[r,s]:[t-60*Math.min(s,i)*1e3,Math.max(s,i)]}function Bn(t,e){const n=new Date(t+=60*e*1e3);return{year:n.getUTCFullYear(),month:n.getUTCMonth()+1,day:n.getUTCDate(),hour:n.getUTCHours(),minute:n.getUTCMinutes(),second:n.getUTCSeconds(),millisecond:n.getUTCMilliseconds()}}function Qn(t,e,n){return Vn(te(t),e,n)}function Kn(t,e){const n=t.o,r=t.c.year+Math.trunc(e.years),s=t.c.month+Math.trunc(e.months)+3*Math.trunc(e.quarters),i={...t.c,year:r,month:s,day:Math.min(t.c.day,Xt(r,s))+Math.trunc(e.days)+7*Math.trunc(e.weeks)},u=Nn.fromObject({years:e.years-Math.trunc(e.years),quarters:e.quarters-Math.trunc(e.quarters),months:e.months-Math.trunc(e.months),weeks:e.weeks-Math.trunc(e.weeks),days:e.days-Math.trunc(e.days),hours:e.hours,minutes:e.minutes,seconds:e.seconds,milliseconds:e.milliseconds}).as("milliseconds"),o=te(i);let[a,c]=Vn(o,n,t.zone);return 0!==u&&(a+=u,c=t.zone.offset(a)),{ts:a,o:c}}function Xn(t,e,n,r,s,i){const{setZone:u,zone:o}=n;if(t&&0!==Object.keys(t).length||e){const r=e||o,s=gr.fromObject(t,{...n,zone:r,specificOffset:i});return u?s:s.setZone(o)}return gr.invalid(new Tt("unparsable",`the input "${s}" can't be parsed as ${r}`))}function tr(t,e,n=!0){return t.isValid?Ie.create(rt.create("en-US"),{allowZ:n,forceSimple:!0}).formatDateTimeFromString(t,e):null}function er(t,e,n){const r=t.c.year>9999||t.c.year<0;let s="";if(r&&t.c.year>=0&&(s+="+"),s+=Jt(t.c.year,r?6:4),"year"===n)return s;if(e){if(s+="-",s+=Jt(t.c.month),"month"===n)return s;s+="-"}else if(s+=Jt(t.c.month),"month"===n)return s;return s+=Jt(t.c.day),s}function nr(t,e,n,r,s,i,u){let o=!n||0!==t.c.millisecond||0!==t.c.second,a="";switch(u){case"day":case"month":case"year":break;default:if(a+=Jt(t.c.hour),"hour"===u)break;if(e){if(a+=":",a+=Jt(t.c.minute),"minute"===u)break;o&&(a+=":",a+=Jt(t.c.second))}else{if(a+=Jt(t.c.minute),"minute"===u)break;o&&(a+=Jt(t.c.second))}if("second"===u)break;!o||r&&0===t.c.millisecond||(a+=".",a+=Jt(t.c.millisecond,3))}return s&&(t.isOffsetFixed&&0===t.offset&&!i?a+="Z":t.o<0?(a+="-",a+=Jt(Math.trunc(-t.o/60)),a+=":",a+=Jt(Math.trunc(-t.o%60))):(a+="+",a+=Jt(Math.trunc(t.o/60)),a+=":",a+=Jt(Math.trunc(t.o%60)))),i&&(a+="["+t.zone.ianaName+"]"),a}const rr={month:1,day:1,hour:0,minute:0,second:0,millisecond:0},sr={weekNumber:1,weekday:1,hour:0,minute:0,second:0,millisecond:0},ir={ordinal:1,hour:0,minute:0,second:0,millisecond:0},ur=["year","month","day","hour","minute","second","millisecond"],or=["weekYear","weekNumber","weekday","hour","minute","second","millisecond"],ar=["year","ordinal","hour","minute","second","millisecond"];function cr(t){const e={year:"year",years:"year",month:"month",months:"month",day:"day",days:"day",hour:"hour",hours:"hour",minute:"minute",minutes:"minute",quarter:"quarter",quarters:"quarter",second:"second",seconds:"second",millisecond:"millisecond",milliseconds:"millisecond",weekday:"weekday",weekdays:"weekday",weeknumber:"weekNumber",weeksnumber:"weekNumber",weeknumbers:"weekNumber",weekyear:"weekYear",weekyears:"weekYear",ordinal:"ordinal"}[t.toLowerCase()];if(!e)throw new a(t);return e}function lr(t){switch(t.toLowerCase()){case"localweekday":case"localweekdays":return"localWeekday";case"localweeknumber":case"localweeknumbers":return"localWeekNumber";case"localweekyear":case"localweekyears":return"localWeekYear";default:return cr(t)}}function hr(t,e){const n=ot(e.zone,kt.defaultZone);if(!n.isValid)return gr.invalid(Rn(n));const r=rt.fromObject(e);let s,i;if(At(t.year))s=kt.now();else{for(const e of ur)At(t[e])&&(t[e]=rr[e]);const e=Wt(t)||Ct(t);if(e)return gr.invalid(e);const r=function(t){if(void 0===fr&&(fr=kt.now()),"iana"!==t.type)return t.offset(fr);const e=t.name;let n=yr.get(e);return void 0===n&&(n=t.offset(fr),yr.set(e,n)),n}(n);[s,i]=Qn(t,r,n)}return new gr({ts:s,zone:n,loc:r,o:i})}function dr(t,e,n){const r=!!At(n.round)||n.round,s=At(n.rounding)?"trunc":n.rounding,i=(t,i)=>(t=Bt(t,r||n.calendary?0:2,n.calendary?"round":s),e.loc.clone(n).relFormatter(n).format(t,i)),u=r=>n.calendary?e.hasSame(t,r)?0:e.startOf(r).diff(t.startOf(r),r).get(r):e.diff(t,r).get(r);if(n.unit)return i(u(n.unit),n.unit);for(const t of n.units){const e=u(t);if(Math.abs(e)>=1)return i(e,t)}return i(t>e?-0:0,n.units[n.units.length-1])}function mr(t){let e,n={};return t.length>0&&"object"==typeof t[t.length-1]?(n=t[t.length-1],e=Array.from(t).slice(0,t.length-1)):e=Array.from(t),[n,e]}let fr;const yr=new Map;class gr{constructor(t){const e=t.zone||kt.defaultZone;let n=t.invalid||(Number.isNaN(t.ts)?new Tt("invalid input"):null)||(e.isValid?null:Rn(e));this.ts=At(t.ts)?kt.now():t.ts;let r=null,s=null;if(!n)if(t.old&&t.old.ts===this.ts&&t.old.zone.equals(e))[r,s]=[t.old.c,t.old.o];else{const i=_t(t.o)&&!t.old?t.o:e.offset(this.ts);r=Bn(this.ts,i),n=Number.isNaN(r.year)?new Tt("invalid input"):null,r=n?null:r,s=n?null:i}this._zone=e,this.loc=t.loc||rt.create(),this.invalid=n,this.weekData=null,this.localWeekData=null,this.c=r,this.o=s,this.isLuxonDateTime=!0}static now(){return new gr({})}static local(){const[t,e]=mr(arguments),[n,r,s,i,u,o,a]=e;return hr({year:n,month:r,day:s,hour:i,minute:u,second:o,millisecond:a},t)}static utc(){const[t,e]=mr(arguments),[n,r,s,i,u,o,a]=e;return t.zone=it.utcInstance,hr({year:n,month:r,day:s,hour:i,minute:u,second:o,millisecond:a},t)}static fromJSDate(t,e={}){const n="[object Date]"===Object.prototype.toString.call(t)?t.valueOf():NaN;if(Number.isNaN(n))return gr.invalid("invalid input");const r=ot(e.zone,kt.defaultZone);return r.isValid?new gr({ts:n,zone:r,loc:rt.fromObject(e)}):gr.invalid(Rn(r))}static fromMillis(t,e={}){if(_t(t))return t<-zn||t>zn?gr.invalid("Timestamp out of range"):new gr({ts:t,zone:ot(e.zone,kt.defaultZone),loc:rt.fromObject(e)});throw new c(`fromMillis requires a numerical input, but received a ${typeof t} with value ${t}`)}static fromSeconds(t,e={}){if(_t(t))return new gr({ts:1e3*t,zone:ot(e.zone,kt.defaultZone),loc:rt.fromObject(e)});throw new c("fromSeconds requires a numerical input")}static fromObject(t,e={}){t=t||{};const n=ot(e.zone,kt.defaultZone);if(!n.isValid)return gr.invalid(Rn(n));const r=rt.fromObject(e),s=oe(t,lr),{minDaysInFirstWeek:i,startOfWeek:u}=Zt(s,r),a=kt.now(),c=At(e.specificOffset)?n.offset(a):e.specificOffset,l=!At(s.ordinal),h=!At(s.year),d=!At(s.month)||!At(s.day),m=h||d,f=s.weekYear||s.weekNumber;if((m||l)&&f)throw new o("Can't mix weekYear/weekNumber units with year/month/day or ordinals");if(d&&l)throw new o("Can't mix ordinal dates with month/day");const y=f||s.weekday&&!m;let g,w,p=Bn(a,c);y?(g=or,w=sr,p=$t(p,i,u)):l?(g=ar,w=ir,p=Ft(p)):(g=ur,w=rr);let S=!1;for(const t of g)At(s[t])?s[t]=S?w[t]:p[t]:S=!0;const M=y?function(t,e=4,n=1){const r=jt(t.weekYear),s=Rt(t.weekNumber,1,ne(t.weekYear,e,n)),i=Rt(t.weekday,1,7);return r?s?!i&&It("weekday",t.weekday):It("week",t.weekNumber):It("weekYear",t.weekYear)}(s,i,u):l?function(t){const e=jt(t.year),n=Rt(t.ordinal,1,Kt(t.year));return e?!n&&It("ordinal",t.ordinal):It("year",t.year)}(s):Wt(s),k=M||Ct(s);if(k)return gr.invalid(k);const T=y?xt(s,i,u):l?Lt(s):s,[b,N]=Qn(T,c,n),I=new gr({ts:b,zone:n,o:N,loc:r});return s.weekday&&m&&t.weekday!==I.weekday?gr.invalid("mismatched weekday",`you can't specify both a weekday of ${s.weekday} and a date of ${I.toISO()}`):I.isValid?I:gr.invalid(I.invalid)}static fromISO(t,e={}){const[n,r]=function(t){return De(t,[en,un],[nn,on],[rn,an],[sn,cn])}(t);return Xn(n,r,e,"ISO 8601",t)}static fromRFC2822(t,e={}){const[n,r]=function(t){return De(function(t){return t.replace(/\([^()]*\)|[\n\t]/g," ").replace(/(\s\s+)/g," ").trim()}(t),[Ge,Ve])}(t);return Xn(n,r,e,"RFC 2822",t)}static fromHTTP(t,e={}){const[n,r]=function(t){return De(t,[Be,Xe],[Qe,Xe],[Ke,tn])}(t);return Xn(n,r,e,"HTTP",e)}static fromFormat(t,e,n={}){if(At(t)||At(e))throw new c("fromFormat requires an input string and a format");const{locale:r=null,numberingSystem:s=null}=n,i=rt.fromOpts({locale:r,numberingSystem:s,defaultToEN:!0}),[u,o,a,l]=function(t,e,n){const{result:r,zone:s,specificOffset:i,invalidReason:u}=Hn(t,e,n);return[r,s,i,u]}(i,t,e);return l?gr.invalid(l):Xn(u,o,n,`format ${e}`,t,a)}static fromString(t,e,n={}){return gr.fromFormat(t,e,n)}static fromSQL(t,e={}){const[n,r]=function(t){return De(t,[hn,un],[dn,mn])}(t);return Xn(n,r,e,"SQL",t)}static invalid(t,e=null){if(!t)throw new c("need to specify a reason the DateTime is invalid");const n=t instanceof Tt?t:new Tt(t,e);if(kt.throwOnInvalid)throw new s(n);return new gr({invalid:n})}static isDateTime(t){return t&&t.isLuxonDateTime||!1}static parseFormatForOpts(t,e={}){const n=Pn(t,rt.fromObject(e));return n?n.map((t=>t?t.val:null)).join(""):null}static expandFormat(t,e={}){return jn(Ie.parseFormat(t),rt.fromObject(e)).map((t=>t.val)).join("")}static resetCache(){fr=void 0,yr.clear()}get(t){return this[t]}get isValid(){return null===this.invalid}get invalidReason(){return this.invalid?this.invalid.reason:null}get invalidExplanation(){return this.invalid?this.invalid.explanation:null}get locale(){return this.isValid?this.loc.locale:null}get numberingSystem(){return this.isValid?this.loc.numberingSystem:null}get outputCalendar(){return this.isValid?this.loc.outputCalendar:null}get zone(){return this._zone}get zoneName(){return this.isValid?this.zone.name:null}get year(){return this.isValid?this.c.year:NaN}get quarter(){return this.isValid?Math.ceil(this.c.month/3):NaN}get month(){return this.isValid?this.c.month:NaN}get day(){return this.isValid?this.c.day:NaN}get hour(){return this.isValid?this.c.hour:NaN}get minute(){return this.isValid?this.c.minute:NaN}get second(){return this.isValid?this.c.second:NaN}get millisecond(){return this.isValid?this.c.millisecond:NaN}get weekYear(){return this.isValid?Jn(this).weekYear:NaN}get weekNumber(){return this.isValid?Jn(this).weekNumber:NaN}get weekday(){return this.isValid?Jn(this).weekday:NaN}get isWeekend(){return this.isValid&&this.loc.getWeekendDays().includes(this.weekday)}get localWeekday(){return this.isValid?Yn(this).weekday:NaN}get localWeekNumber(){return this.isValid?Yn(this).weekNumber:NaN}get localWeekYear(){return this.isValid?Yn(this).weekYear:NaN}get ordinal(){return this.isValid?Ft(this.c).ordinal:NaN}get monthShort(){return this.isValid?En.months("short",{locObj:this.loc})[this.month-1]:null}get monthLong(){return this.isValid?En.months("long",{locObj:this.loc})[this.month-1]:null}get weekdayShort(){return this.isValid?En.weekdays("short",{locObj:this.loc})[this.weekday-1]:null}get weekdayLong(){return this.isValid?En.weekdays("long",{locObj:this.loc})[this.weekday-1]:null}get offset(){return this.isValid?+this.o:NaN}get offsetNameShort(){return this.isValid?this.zone.offsetName(this.ts,{format:"short",locale:this.locale}):null}get offsetNameLong(){return this.isValid?this.zone.offsetName(this.ts,{format:"long",locale:this.locale}):null}get isOffsetFixed(){return this.isValid?this.zone.isUniversal:null}get isInDST(){return!this.isOffsetFixed&&(this.offset>this.set({month:1,day:1}).offset||this.offset>this.set({month:5}).offset)}getPossibleOffsets(){if(!this.isValid||this.isOffsetFixed)return[this];const t=864e5,e=6e4,n=te(this.c),r=this.zone.offset(n-t),s=this.zone.offset(n+t),i=this.zone.offset(n-r*e),u=this.zone.offset(n-s*e);if(i===u)return[this];const o=n-i*e,a=n-u*e,c=Bn(o,i),l=Bn(a,u);return c.hour===l.hour&&c.minute===l.minute&&c.second===l.second&&c.millisecond===l.millisecond?[Gn(this,{ts:o}),Gn(this,{ts:a})]:[this]}get isInLeapYear(){return Qt(this.year)}get daysInMonth(){return Xt(this.year,this.month)}get daysInYear(){return this.isValid?Kt(this.year):NaN}get weeksInWeekYear(){return this.isValid?ne(this.weekYear):NaN}get weeksInLocalWeekYear(){return this.isValid?ne(this.localWeekYear,this.loc.getMinDaysInFirstWeek(),this.loc.getStartOfWeek()):NaN}resolvedLocaleOptions(t={}){const{locale:e,numberingSystem:n,calendar:r}=Ie.create(this.loc.clone(t),t).resolvedOptions(this);return{locale:e,numberingSystem:n,outputCalendar:r}}toUTC(t=0,e={}){return this.setZone(it.instance(t),e)}toLocal(){return this.setZone(kt.defaultZone)}setZone(t,{keepLocalTime:e=!1,keepCalendarTime:n=!1}={}){if((t=ot(t,kt.defaultZone)).equals(this.zone))return this;if(t.isValid){let r=this.ts;if(e||n){const e=t.offset(this.ts),n=this.toObject();[r]=Qn(n,e,t)}return Gn(this,{ts:r,zone:t})}return gr.invalid(Rn(t))}reconfigure({locale:t,numberingSystem:e,outputCalendar:n}={}){return Gn(this,{loc:this.loc.clone({locale:t,numberingSystem:e,outputCalendar:n})})}setLocale(t){return this.reconfigure({locale:t})}set(t){if(!this.isValid)return this;const e=oe(t,lr),{minDaysInFirstWeek:n,startOfWeek:r}=Zt(e,this.loc),s=!At(e.weekYear)||!At(e.weekNumber)||!At(e.weekday),i=!At(e.ordinal),u=!At(e.year),a=!At(e.month)||!At(e.day);if((u||a||i)&&(e.weekYear||e.weekNumber))throw new o("Can't mix weekYear/weekNumber units with year/month/day or ordinals");if(a&&i)throw new o("Can't mix ordinal dates with month/day");let c;s?c=xt({...$t(this.c,n,r),...e},n,r):At(e.ordinal)?(c={...this.toObject(),...e},At(e.day)&&(c.day=Math.min(Xt(c.year,c.month),c.day))):c=Lt({...Ft(this.c),...e});const[l,h]=Qn(c,this.o,this.zone);return Gn(this,{ts:l,o:h})}plus(t){return this.isValid?Gn(this,Kn(this,Nn.fromDurationLike(t))):this}minus(t){return this.isValid?Gn(this,Kn(this,Nn.fromDurationLike(t).negate())):this}startOf(t,{useLocaleWeeks:e=!1}={}){if(!this.isValid)return this;const n={},r=Nn.normalizeUnit(t);switch(r){case"years":n.month=1;case"quarters":case"months":n.day=1;case"weeks":case"days":n.hour=0;case"hours":n.minute=0;case"minutes":n.second=0;case"seconds":n.millisecond=0}if("weeks"===r)if(e){const t=this.loc.getStartOfWeek(),{weekday:e}=this;e<t&&(n.weekNumber=this.weekNumber-1),n.weekday=t}else n.weekday=1;if("quarters"===r){const t=Math.ceil(this.month/3);n.month=3*(t-1)+1}return this.set(n)}endOf(t,e){return this.isValid?this.plus({[t]:1}).startOf(t,e).minus(1):this}toFormat(t,e={}){return this.isValid?Ie.create(this.loc.redefaultToEN(e)).formatDateTimeFromString(this,t):Un}toLocaleString(t=f,e={}){return this.isValid?Ie.create(this.loc.clone(e),t).formatDateTime(this):Un}toLocaleParts(t={}){return this.isValid?Ie.create(this.loc.clone(t),t).formatDateTimeParts(this):[]}toISO({format:t="extended",suppressSeconds:e=!1,suppressMilliseconds:n=!1,includeOffset:r=!0,extendedZone:s=!1,precision:i="milliseconds"}={}){if(!this.isValid)return null;const u="extended"===t;let o=er(this,u,i=cr(i));return ur.indexOf(i)>=3&&(o+="T"),o+=nr(this,u,e,n,r,s,i),o}toISODate({format:t="extended",precision:e="day"}={}){return this.isValid?er(this,"extended"===t,cr(e)):null}toISOWeekDate(){return tr(this,"kkkk-'W'WW-c")}toISOTime({suppressMilliseconds:t=!1,suppressSeconds:e=!1,includeOffset:n=!0,includePrefix:r=!1,extendedZone:s=!1,format:i="extended",precision:u="milliseconds"}={}){return this.isValid?(u=cr(u),(r&&ur.indexOf(u)>=3?"T":"")+nr(this,"extended"===i,e,t,n,s,u)):null}toRFC2822(){return tr(this,"EEE, dd LLL yyyy HH:mm:ss ZZZ",!1)}toHTTP(){return tr(this.toUTC(),"EEE, dd LLL yyyy HH:mm:ss 'GMT'")}toSQLDate(){return this.isValid?er(this,!0):null}toSQLTime({includeOffset:t=!0,includeZone:e=!1,includeOffsetSpace:n=!0}={}){let r="HH:mm:ss.SSS";return(e||t)&&(n&&(r+=" "),e?r+="z":t&&(r+="ZZ")),tr(this,r,!0)}toSQL(t={}){return this.isValid?`${this.toSQLDate()} ${this.toSQLTime(t)}`:null}toString(){return this.isValid?this.toISO():Un}[Symbol.for("nodejs.util.inspect.custom")](){return this.isValid?`DateTime { ts: ${this.toISO()}, zone: ${this.zone.name}, locale: ${this.locale} }`:`DateTime { Invalid, reason: ${this.invalidReason} }`}valueOf(){return this.toMillis()}toMillis(){return this.isValid?this.ts:NaN}toSeconds(){return this.isValid?this.ts/1e3:NaN}toUnixInteger(){return this.isValid?Math.floor(this.ts/1e3):NaN}toJSON(){return this.toISO()}toBSON(){return this.toJSDate()}toObject(t={}){if(!this.isValid)return{};const e={...this.c};return t.includeConfig&&(e.outputCalendar=this.outputCalendar,e.numberingSystem=this.loc.numberingSystem,e.locale=this.loc.locale),e}toJSDate(){return new Date(this.isValid?this.ts:NaN)}diff(t,e="milliseconds",n={}){if(!this.isValid||!t.isValid)return Nn.invalid("created by diffing an invalid DateTime");const r={locale:this.locale,numberingSystem:this.numberingSystem,...n},s=(o=e,Array.isArray(o)?o:[o]).map(Nn.normalizeUnit),i=t.valueOf()>this.valueOf(),u=function(t,e,n,r){let[s,i,u,o]=function(t,e,n){const r=[["years",(t,e)=>e.year-t.year],["quarters",(t,e)=>e.quarter-t.quarter+4*(e.year-t.year)],["months",(t,e)=>e.month-t.month+12*(e.year-t.year)],["weeks",(t,e)=>{const n=On(t,e);return(n-n%7)/7}],["days",On]],s={},i=t;let u,o;for(const[a,c]of r)n.indexOf(a)>=0&&(u=a,s[a]=c(t,e),o=i.plus(s),o>e?(s[a]--,(t=i.plus(s))>e&&(o=t,s[a]--,t=i.plus(s))):t=o);return[t,s,o,u]}(t,e,n);const a=e-s,c=n.filter((t=>["hours","minutes","seconds","milliseconds"].indexOf(t)>=0));0===c.length&&(u<e&&(u=s.plus({[o]:1})),u!==s&&(i[o]=(i[o]||0)+a/(u-s)));const l=Nn.fromObject(i,r);return c.length>0?Nn.fromMillis(a,r).shiftTo(...c).plus(l):l}(i?this:t,i?t:this,s,r);var o;return i?u.negate():u}diffNow(t="milliseconds",e={}){return this.diff(gr.now(),t,e)}until(t){return this.isValid?vn.fromDateTimes(this,t):this}hasSame(t,e,n){if(!this.isValid)return!1;const r=t.valueOf(),s=this.setZone(t.zone,{keepLocalTime:!0});return s.startOf(e,n)<=r&&r<=s.endOf(e,n)}equals(t){return this.isValid&&t.isValid&&this.valueOf()===t.valueOf()&&this.zone.equals(t.zone)&&this.loc.equals(t.loc)}toRelative(t={}){if(!this.isValid)return null;const e=t.base||gr.fromObject({},{zone:this.zone}),n=t.padding?this<e?-t.padding:t.padding:0;let r=["years","months","days","hours","minutes","seconds"],s=t.unit;return Array.isArray(t.unit)&&(r=t.unit,s=void 0),dr(e,this.plus(n),{...t,numeric:"always",units:r,unit:s})}toRelativeCalendar(t={}){return this.isValid?dr(t.base||gr.fromObject({},{zone:this.zone}),this,{...t,numeric:"auto",units:["years","months","days"],calendary:!0}):null}static min(...t){if(!t.every(gr.isDateTime))throw new c("min requires all arguments be DateTimes");return Pt(t,(t=>t.valueOf()),Math.min)}static max(...t){if(!t.every(gr.isDateTime))throw new c("max requires all arguments be DateTimes");return Pt(t,(t=>t.valueOf()),Math.max)}static fromFormatExplain(t,e,n={}){const{locale:r=null,numberingSystem:s=null}=n;return Hn(rt.fromOpts({locale:r,numberingSystem:s,defaultToEN:!0}),t,e)}static fromStringExplain(t,e,n={}){return gr.fromFormatExplain(t,e,n)}static buildFormatParser(t,e={}){const{locale:n=null,numberingSystem:r=null}=e,s=rt.fromOpts({locale:n,numberingSystem:r,defaultToEN:!0});return new qn(s,t)}static fromFormatParser(t,e,n={}){if(At(t)||At(e))throw new c("fromFormatParser requires an input string and a format parser");const{locale:r=null,numberingSystem:s=null}=n,i=rt.fromOpts({locale:r,numberingSystem:s,defaultToEN:!0});if(!i.equals(e.locale))throw new c(`fromFormatParser called with a locale of ${i}, but the format parser was created for ${e.locale}`);const{result:u,zone:o,specificOffset:a,invalidReason:l}=e.explainFromTokens(t);return l?gr.invalid(l):Xn(u,o,n,`format ${e.format}`,t,a)}static get DATE_SHORT(){return f}static get DATE_MED(){return y}static get DATE_MED_WITH_WEEKDAY(){return g}static get DATE_FULL(){return w}static get DATE_HUGE(){return p}static get TIME_SIMPLE(){return S}static get TIME_WITH_SECONDS(){return M}static get TIME_WITH_SHORT_OFFSET(){return k}static get TIME_WITH_LONG_OFFSET(){return T}static get TIME_24_SIMPLE(){return b}static get TIME_24_WITH_SECONDS(){return N}static get TIME_24_WITH_SHORT_OFFSET(){return I}static get TIME_24_WITH_LONG_OFFSET(){return v}static get DATETIME_SHORT(){return E}static get DATETIME_SHORT_WITH_SECONDS(){return O}static get DATETIME_MED(){return D}static get DATETIME_MED_WITH_SECONDS(){return $}static get DATETIME_MED_WITH_WEEKDAY(){return x}static get DATETIME_FULL(){return F}static get DATETIME_FULL_WITH_SECONDS(){return L}static get DATETIME_HUGE(){return Z}static get DATETIME_HUGE_WITH_SECONDS(){return W}}function wr(t){if(gr.isDateTime(t))return t;if(t&&t.valueOf&&_t(t.valueOf()))return gr.fromJSDate(t);if(t&&"object"==typeof t)return gr.fromObject(t);throw new c(`Unknown datetime argument: ${t}, of type ${typeof t}`)}export{gr as D,t as S,e as c,n as g}
|