@bino-bi/bn-template-engine 1.0.0-alpha.2 → 1.0.0-alpha.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (88) hide show
  1. package/dist/bn-template-engine/bn-template-engine.esm.js +1 -1
  2. package/dist/bn-template-engine/{p-a95ccc16.entry.js → p-1970906d.entry.js} +1 -1
  3. package/dist/bn-template-engine/{p-0ca8dc17.entry.js → p-1dbd339c.entry.js} +1 -1
  4. package/dist/bn-template-engine/p-2e68cf09.entry.js +1 -0
  5. package/dist/bn-template-engine/{p-bc59ea5c.entry.js → p-31cc6a2d.entry.js} +1 -1
  6. package/dist/bn-template-engine/{p--PSoPbDM.js → p-8tsCnxIz.js} +1 -1
  7. package/dist/bn-template-engine/{p-dd9dd407.entry.js → p-997b2fe4.entry.js} +1 -1
  8. package/dist/bn-template-engine/{p-DgfL-ffj.js → p-B4ySv9KQ.js} +1 -1
  9. package/dist/bn-template-engine/{p-DVo6aZUE.js → p-BL8gyUwE.js} +1 -1
  10. package/dist/bn-template-engine/{p-CvXqez4D.js → p-C0yAPzJz.js} +1 -1
  11. package/dist/bn-template-engine/p-DtdQCMzj.js +1 -0
  12. package/dist/bn-template-engine/{p-e102a490.entry.js → p-a90f1cbe.entry.js} +1 -1
  13. package/dist/bn-template-engine/{p-35638ad0.entry.js → p-d7f0cbaf.entry.js} +1 -1
  14. package/dist/bn-template-engine/{p-1d9a3be9.entry.js → p-dfb61aa5.entry.js} +1 -1
  15. package/dist/bn-template-engine/{p-f89e55c6.entry.js → p-ece17f84.entry.js} +1 -1
  16. package/dist/bn-template-engine/p-fd427179.entry.js +1 -0
  17. package/dist/bn-template-engine/p-sqjrku2z.js +1 -0
  18. package/dist/cjs/{DataFormatDigits-CbIVfGEH.js → DataFormatDigits-DAmZzqbD.js} +1 -1
  19. package/dist/cjs/{DateStringFactory-CfkXYAMN.js → DateStringFactory-CcluhpGI.js} +1 -1
  20. package/dist/cjs/{Order-DtpbD8mQ.js → Order-BKoDS21t.js} +28 -0
  21. package/dist/cjs/{SVGVariancesStyleGroup-D-rTWlDo.js → SVGVariancesStyleGroup-DYYAU-81.js} +1 -1
  22. package/dist/cjs/{StringAdapter-ByCHdlDO.js → StringAdapter-Bneo8T4k.js} +1 -1
  23. package/dist/cjs/bn-body_4.cjs.entry.js +4 -4
  24. package/dist/cjs/bn-chart-structure.cjs.entry.js +3 -3
  25. package/dist/cjs/bn-chart-time.cjs.entry.js +3 -3
  26. package/dist/cjs/bn-context_5.cjs.entry.js +115 -44
  27. package/dist/cjs/bn-grid.cjs.entry.js +3 -3
  28. package/dist/cjs/bn-image.cjs.entry.js +3 -3
  29. package/dist/cjs/bn-template-engine.cjs.js +1 -1
  30. package/dist/cjs/bn-text.cjs.entry.js +3 -3
  31. package/dist/cjs/bn-tree.cjs.entry.js +3 -3
  32. package/dist/cjs/ibcs-chart-structure.cjs.entry.js +4 -4
  33. package/dist/cjs/ibcs-chart-time.cjs.entry.js +5 -5
  34. package/dist/cjs/loader.cjs.js +1 -1
  35. package/dist/cjs/{withStyled-BBtMesx3.js → withStyled-CW30Bh6c.js} +6 -2
  36. package/dist/collection/components/bn-table/bn-table.js +63 -12
  37. package/dist/collection/components/bn-table/ibcs-table.css +7 -5
  38. package/dist/collection/components/bn-table/ibcs-table.js +22 -1
  39. package/dist/collection/components/bn-table/utils/elements/CellBarChart.js +56 -25
  40. package/dist/collection/components/bn-table/utils/elements/TableRow.js +3 -1
  41. package/dist/collection/components/bn-table/utils/factories/tableDataSetFactory.js +12 -3
  42. package/dist/collection/components/bn-table/utils/helper/ColumnStatistics.js +9 -1
  43. package/dist/collection/utils/constants.js +27 -0
  44. package/dist/collection/utils/validate.js +4 -1
  45. package/dist/components/DataFormatDigits.js +1 -1
  46. package/dist/components/DateStringFactory.js +1 -1
  47. package/dist/components/Order.js +1 -1
  48. package/dist/components/SVGVariancesStyleGroup.js +1 -1
  49. package/dist/components/bn-chart-structure.js +1 -1
  50. package/dist/components/bn-chart-time.js +1 -1
  51. package/dist/components/bn-table.js +1 -1
  52. package/dist/components/bn-title2.js +1 -1
  53. package/dist/components/ibcs-chart-structure2.js +1 -1
  54. package/dist/components/ibcs-chart-time2.js +1 -1
  55. package/dist/components/ibcs-table2.js +1 -1
  56. package/dist/components/ibcs-title2.js +1 -1
  57. package/dist/components/ibcsRuleSet.js +1 -1
  58. package/dist/components/validate.js +1 -1
  59. package/dist/esm/{DataFormatDigits-DYdbRX-1.js → DataFormatDigits--qIbKvXa.js} +1 -1
  60. package/dist/esm/{DateStringFactory-DRcbojUT.js → DateStringFactory-XWdUjsn8.js} +1 -1
  61. package/dist/esm/{Order-DdexOqTs.js → Order-sqjrku2z.js} +28 -1
  62. package/dist/esm/{SVGVariancesStyleGroup-D0Cwprv1.js → SVGVariancesStyleGroup-ibg3sLjM.js} +1 -1
  63. package/dist/esm/{StringAdapter-CTL-Dvzp.js → StringAdapter-BCLJpQQ8.js} +1 -1
  64. package/dist/esm/bn-body_4.entry.js +4 -4
  65. package/dist/esm/bn-chart-structure.entry.js +3 -3
  66. package/dist/esm/bn-chart-time.entry.js +3 -3
  67. package/dist/esm/bn-context_5.entry.js +115 -44
  68. package/dist/esm/bn-grid.entry.js +3 -3
  69. package/dist/esm/bn-image.entry.js +3 -3
  70. package/dist/esm/bn-template-engine.js +1 -1
  71. package/dist/esm/bn-text.entry.js +3 -3
  72. package/dist/esm/bn-tree.entry.js +3 -3
  73. package/dist/esm/ibcs-chart-structure.entry.js +4 -4
  74. package/dist/esm/ibcs-chart-time.entry.js +5 -5
  75. package/dist/esm/loader.js +1 -1
  76. package/dist/esm/{withStyled-DCipbf2O.js → withStyled-D1fAWJ3g.js} +6 -3
  77. package/dist/types/components/bn-table/bn-table.d.ts +11 -7
  78. package/dist/types/components/bn-table/ibcs-table.d.ts +1 -0
  79. package/dist/types/components/bn-table/utils/elements/Cell.d.ts +1 -0
  80. package/dist/types/components/bn-table/utils/elements/CellBarChart.d.ts +3 -0
  81. package/dist/types/components.d.ts +22 -2
  82. package/dist/types/utils/constants.d.ts +15 -0
  83. package/dist/types/utils/validate.d.ts +1 -0
  84. package/package.json +1 -1
  85. package/dist/bn-template-engine/p-60a7fc59.entry.js +0 -1
  86. package/dist/bn-template-engine/p-DdexOqTs.js +0 -1
  87. package/dist/bn-template-engine/p-DyRaC0MB.js +0 -1
  88. package/dist/bn-template-engine/p-d279b578.entry.js +0 -1
@@ -1 +1 @@
1
- import{p as e,B as a,c as t,w as i,N as r,a as l,b as n}from"./p-JNHhIe7t.js";export{s as setNonce}from"./p-JNHhIe7t.js";import{g as o}from"./p-DQuL1Twl.js";var d=e=>{const a=e.cloneNode;e.cloneNode=function(e){if("TEMPLATE"===this.nodeName)return a.call(this,e);const t=a.call(this,!1),i=this.childNodes;if(e)for(let e=0;e<i.length;e++)2!==i[e].nodeType&&t.appendChild(i[e].cloneNode(!0));return t}};(()=>{a.isDev&&!a.isTesting&&t("Running in development mode."),a.cloneNodeFix&&d(l.prototype);const s=a.scriptDataOpts?i.document&&Array.from(i.document.querySelectorAll("script")).find((e=>new RegExp(`/${r}(\\.esm)?\\.js($|\\?|#)`).test(e.src)||e.getAttribute("data-stencil-namespace")===r)):null,n=import.meta.url,o=a.scriptDataOpts&&(s||{})["data-opts"]||{};return""!==n&&(o.resourcesUrl=new URL(".",n).href),e(o)})().then((async e=>(await o(),n(JSON.parse('[["p-3b894997",[[257,"bn-layout-page",{"styles":[1],"messageText":[1,"message-text"],"messageImage":[1,"message-image"],"titleBusinessUnit":[1,"title-business-unit"],"titleScenarios":[1,"title-scenarios"],"titleVariances":[1,"title-variances"],"titleOrder":[1,"title-order"],"titleOrderDirection":[1,"title-order-direction"],"titleMeasures":[1,"title-measures"],"titleDateStart":[1,"title-date-start"],"titleDateEnd":[1,"title-date-end"],"titleDateFormat":[1,"title-date-format"],"titleDateLink":[1,"title-date-link"],"titleNamespace":[1,"title-namespace"],"pageFormat":[1,"page-format"],"pageOrientation":[1,"page-orientation"],"pageNumber":[1,"page-number"],"footerText":[1,"footer-text"],"footerDisplayPageNumber":[4,"footer-display-page-number"],"pageLayout":[1,"page-layout"],"pageCustomTemplate":[1,"page-custom-template"],"pageGridGap":[1,"page-grid-gap"],"pageFitToContent":[4,"page-fit-to-content"],"getNumberOfSlot":[64]}]]],["p-6c7c0455",[[257,"bn-layout-card",{"styles":[1],"titleImage":[1,"title-image"],"titleBusinessUnit":[1,"title-business-unit"],"titleScenarios":[1,"title-scenarios"],"titleVariances":[1,"title-variances"],"titleOrder":[1,"title-order"],"titleOrderDirection":[1,"title-order-direction"],"titleMeasures":[1,"title-measures"],"titleDateStart":[1,"title-date-start"],"titleDateEnd":[1,"title-date-end"],"titleDateFormat":[1,"title-date-format"],"titleDateLink":[1,"title-date-link"],"titleNamespace":[1,"title-namespace"],"footerText":[1,"footer-text"],"cardLayout":[1,"card-layout"],"cardCustomTemplate":[1,"card-custom-template"],"cardGridGap":[1,"card-grid-gap"],"cardFitToContent":[4,"card-fit-to-content"],"cardShowBorder":[4,"card-show-border"],"getNumberOfSlot":[64]}]]],["p-e102a490",[[1,"bn-chart-structure",{"chartTitle":[1,"chart-title"],"filter":[1],"scenarios":[1],"variances":[1],"unitScaling":[8,"unit-scaling"],"percentageScaling":[8,"percentage-scaling"],"level":[1],"order":[1],"orderDirection":[1,"order-direction"],"limit":[2],"showCategories":[1,"show-categories"],"measureScale":[1,"measure-scale"],"showMeasureScale":[1,"show-measure-scale"],"measureUnit":[1,"measure-unit"],"stack":[1],"scale":[1],"data":[32],"datasetMeta":[32],"appliedScaleFactor":[32]},null,{"scenarios":[{"validateScenario":0}],"variances":[{"validateVariances":0}],"unitScaling":[{"validateUnitScaling":0}],"percentageScaling":[{"validatePercentageScaling":0}],"level":[{"validateLevel":0}],"order":[{"validateOrderList":0}],"orderDirection":[{"validateOrderDirection":0}],"limit":[{"validateLimit":0}],"showCategories":[{"validateShowCategories":0}],"measureScale":[{"validateMeasureScale":0}],"showMeasureScale":[{"validateShowMeasureScale":0}],"stack":[{"validateStack":0}],"scale":[{"validateScaling":0}]}]]],["p-dd9dd407",[[1,"bn-chart-time",{"chartTitle":[1,"chart-title"],"filter":[1],"scenarios":[1],"variances":[1],"syncSpaceLeft":[2,"sync-space-left"],"limit":[2],"unitScaling":[8,"unit-scaling"],"percentageScaling":[8,"percentage-scaling"],"level":[1],"order":[1],"orderDirection":[1,"order-direction"],"dateInterval":[1,"date-interval"],"chartMode":[1,"chart-mode"],"maxBars":[2,"max-bars"],"stack":[1],"scale":[1],"intervalSpanLimit":[2,"interval-span-limit"],"axisLabelsMode":[1,"axis-labels-mode"],"lineFullWidth":[1,"line-full-width"],"showCategories":[1,"show-categories"],"measureScale":[1,"measure-scale"],"showMeasureScale":[1,"show-measure-scale"],"showOverlayAvg":[1,"show-overlay-avg"],"showOverlayMedian":[1,"show-overlay-median"],"measureUnit":[1,"measure-unit"],"data":[32],"datasetMeta":[32],"appliedScaleFactor":[32]},null,{"scenarios":[{"validateScenario":0}],"variances":[{"validateVariances":0}],"syncSpaceLeft":[{"validateLeftSync":0}],"limit":[{"validateLimit":0}],"unitScaling":[{"validateUnitScaling":0}],"percentageScaling":[{"validatePercentageScaling":0}],"level":[{"validateLevel":0}],"order":[{"validateOrderList":0}],"orderDirection":[{"validateOrderDirection":0}],"dateInterval":[{"validateDateInterval":0}],"chartMode":[{"validateChartMode":0}],"maxBars":[{"validateMaxBars":0}],"stack":[{"validateStack":0}],"scale":[{"validateScaling":0}],"axisLabelsMode":[{"validateAxisLabelsMode":0}],"lineFullWidth":[{"validateLineFullWidth":0}],"showCategories":[{"validateShowCategories":0}],"measureScale":[{"validateMeasureScale":0}],"showMeasureScale":[{"validateShowMeasureScale":0}],"showOverlayAvg":[{"validateShowOverlayAvg":0}],"showOverlayMedian":[{"validateShowOverlayMedian":0}]}]]],["p-701e1578",[[1,"bn-asset",{"name":[1]}]]],["p-37881d05",[[0,"bn-component-style",{"name":[1]}]]],["p-b7bec050",[[0,"bn-dataset",{"name":[1],"datasources":[1],"static":[4]},null,{"name":[{"nameUpdated":0}]}]]],["p-35638ad0",[[257,"bn-grid",{"chartTitle":[1,"chart-title"],"rowHeaders":[1,"row-headers"],"columnHeaders":[1,"column-headers"],"showRowHeaders":[1,"show-row-headers"],"showColumnHeaders":[1,"show-column-headers"],"showBorders":[1,"show-borders"],"rowHeaderWidth":[1,"row-header-width"],"cellGap":[1,"cell-gap"],"gridConfig":[32]},null,{"rowHeaders":[{"validateRowHeaders":0}],"columnHeaders":[{"validateColumnHeaders":0}],"showRowHeaders":[{"validateShowRowHeaders":0}],"showColumnHeaders":[{"validateShowColumnHeaders":0}],"showBorders":[{"validateShowBorders":0}]}]]],["p-f89e55c6",[[1,"bn-image",{"source":[1]}]]],["p-05a82a77",[[0,"bn-internationalization",{"code":[1],"namespace":[1]}]]],["p-f27995c9",[[257,"bn-template",{"templateId":[1,"template-id"]}]]],["p-0ca8dc17",[[1,"bn-text",{"value":[1],"scale":[1],"data":[32]},null,{"value":[{"validateValue":0}],"scale":[{"validateScaling":0}]}]]],["p-bc59ea5c",[[257,"bn-tree",{"edges":[1],"direction":[1],"levelSpacing":[2,"level-spacing"],"nodeSpacing":[2,"node-spacing"],"edgeStyle":[1,"edge-style"],"showOperators":[1,"show-operators"],"treeConfig":[32],"layout":[32],"nodeRects":[32],"svgWidth":[32],"svgHeight":[32]},null,{"edges":[{"validateEdgesProp":0}],"direction":[{"validateDirection":0}],"levelSpacing":[{"validateLevelSpacing":0}],"nodeSpacing":[{"validateNodeSpacing":0}],"edgeStyle":[{"validateEdgeStyle":0}],"showOperators":[{"validateShowOperators":0}]}]]],["p-0f1504f3",[[0,"editor-companion",{"internationalizationKeys":[64],"getDistinctFromDataSource":[64],"getDistinctFromDataset":[64]}]]],["p-50e49732",[[257,"bn-card"]]],["p-6da93eae",[[1,"bn-message",{"text":[1025],"image":[1]}]]],["p-1d9a3be9",[[1,"ibcs-chart-structure",{"data":[16],"chartTitle":[1,"chart-title"],"scenarios":[16],"variances":[16],"hideCategories":[4,"hide-categories"],"pixelPerUnit":[2,"pixel-per-unit"],"pixelPerPercentage":[2,"pixel-per-percentage"],"limit":[2],"styles":[1040],"i18n":[1040],"order":[16],"level":[1],"filter":[1],"measureScale":[1,"measure-scale"],"measureUnit":[1,"measure-unit"],"showMeasureScale":[4,"show-measure-scale"],"dataFormatDigits":[16],"stackConfig":[16],"parentDimensions":[16]}]]],["p-a95ccc16",[[1,"ibcs-chart-time",{"data":[16],"chartTitle":[1,"chart-title"],"scenarios":[16],"variances":[16],"hideAxisLabels":[4,"hide-axis-labels"],"pixelPerUnit":[2,"pixel-per-unit"],"pixelPerPercentage":[2,"pixel-per-percentage"],"limit":[2],"leftSideOffsetForHorizontalSync":[2,"left-side-offset-for-horizontal-sync"],"styles":[1040],"i18n":[1040],"order":[16],"level":[1],"dateInterval":[1,"date-interval"],"intervalSpanLimit":[2,"interval-span-limit"],"axisLabelsMode":[1,"axis-labels-mode"],"filter":[1],"measureScale":[1,"measure-scale"],"measureUnit":[1,"measure-unit"],"showMeasureScale":[4,"show-measure-scale"],"showOverlayMedian":[4,"show-overlay-median"],"showOverlayAvg":[4,"show-overlay-avg"],"chartMode":[1,"chart-mode"],"maxBars":[2,"max-bars"],"stackConfig":[16],"lineFullWidth":[4,"line-full-width"],"containerWidth":[2,"container-width"],"dataFormatDigits":[16],"parentDimensions":[16]}]]],["p-60a7fc59",[[1,"bn-table",{"scale":[1],"tableTitle":[1,"table-title"],"filter":[1],"measureUnit":[1,"measure-unit"],"scenarios":[1],"variances":[1],"barColumns":[1,"bar-columns"],"unitScaling":[8,"unit-scaling"],"percentageScaling":[8,"percentage-scaling"],"dataFormat":[1,"data-format"],"grouped":[1],"showMeasureScale":[1,"show-measure-scale"],"showGroupTitle":[1,"show-group-title"],"type":[1],"limit":[2],"thereof":[1],"partof":[1],"order":[1],"orderDirection":[1,"order-direction"],"measureType":[1,"measure-type"],"measureScale":[1,"measure-scale"],"dataFormatDigitsDecimal":[2,"data-format-digits-decimal"],"dataFormatDigitsPercent":[2,"data-format-digits-percent"],"categoryWidth":[1,"category-width"],"columnthereof":[1],"data":[32],"datasetMeta":[32],"appliedScaleFactor":[32]},null,{"scale":[{"validateScaling":0}],"scenarios":[{"validateScenario":0}],"variances":[{"validateVariances":0}],"barColumns":[{"validateBarColumns":0}],"unitScaling":[{"validateUnitScaling":0}],"percentageScaling":[{"validatePercentageScaling":0}],"dataFormat":[{"validateDataFormat":0}],"grouped":[{"validateGrouped":0}],"showMeasureScale":[{"validateShowMeasureScale":0}],"showGroupTitle":[{"validateShowGroupTitle":0}],"type":[{"validateType":0}],"limit":[{"validateLimit":0}],"thereof":[{"validateThereOf":0}],"partof":[{"validatePartOf":0}],"order":[{"validateOrderList":0}],"orderDirection":[{"validateOrderDirection":0}],"measureType":[{"validateMeasureType":0}],"measureScale":[{"validateMeasureScale":0}],"dataFormatDigitsDecimal":[{"validateDataFormatDigitsDecimal":0}],"dataFormatDigitsPercent":[{"validateDateFormatDigitsPercent":0}],"categoryWidth":[{"validateCategoryWidth":0}],"columnthereof":[{"validateColumnThereOf":0}]}],[257,"bn-context",{"locale":[1]},null,{"locale":[{"setLocale":0}]}],[0,"bn-datasource",{"name":[1]}],[257,"bn-page",{"format":[1],"orientation":[1]},null,{"format":[{"validateFormat":0}],"orientation":[{"validateOrientation":0}]}],[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],"unitScaling":[2,"unit-scaling"],"percentageScaling":[2,"percentage-scaling"],"scaleFactor":[2,"scale-factor"]}]]],["p-d279b578",[[1,"bn-title",{"businessUnit":[1,"business-unit"],"scenarios":[1],"variances":[1],"order":[1],"orderDirection":[1,"order-direction"],"measures":[1],"dateStart":[1,"date-start"],"dateEnd":[1,"date-end"],"dateFormat":[1,"date-format"],"dateLink":[1,"date-link"]},null,{"scenarios":[{"validateScenario":0}],"variances":[{"validateVariances":0}],"order":[{"validateOrder":0}],"orderDirection":[{"validateOrderDirection":0}],"measures":[{"validateMeasures":0}],"dateStart":[{"validateDateStart":0}],"dateEnd":[{"validateDateEnd":0}],"dateFormat":[{"validateDateFormat":0}],"dateLink":[{"validateDateLink":0}]}],[257,"bn-body"],[1,"bn-footer",{"pageNumber":[1026,"page-number"],"text":[1025],"code":[1025],"displayPageNumber":[4,"display-page-number"]}],[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"],"setBusinessUnit":[64],"setProps":[64]}]]]]'),e))));
1
+ import{p as e,B as a,c as t,w as i,N as r,a as l,b as n}from"./p-JNHhIe7t.js";export{s as setNonce}from"./p-JNHhIe7t.js";import{g as o}from"./p-DQuL1Twl.js";var d=e=>{const a=e.cloneNode;e.cloneNode=function(e){if("TEMPLATE"===this.nodeName)return a.call(this,e);const t=a.call(this,!1),i=this.childNodes;if(e)for(let e=0;e<i.length;e++)2!==i[e].nodeType&&t.appendChild(i[e].cloneNode(!0));return t}};(()=>{a.isDev&&!a.isTesting&&t("Running in development mode."),a.cloneNodeFix&&d(l.prototype);const s=a.scriptDataOpts?i.document&&Array.from(i.document.querySelectorAll("script")).find((e=>new RegExp(`/${r}(\\.esm)?\\.js($|\\?|#)`).test(e.src)||e.getAttribute("data-stencil-namespace")===r)):null,n=import.meta.url,o=a.scriptDataOpts&&(s||{})["data-opts"]||{};return""!==n&&(o.resourcesUrl=new URL(".",n).href),e(o)})().then((async e=>(await o(),n(JSON.parse('[["p-3b894997",[[257,"bn-layout-page",{"styles":[1],"messageText":[1,"message-text"],"messageImage":[1,"message-image"],"titleBusinessUnit":[1,"title-business-unit"],"titleScenarios":[1,"title-scenarios"],"titleVariances":[1,"title-variances"],"titleOrder":[1,"title-order"],"titleOrderDirection":[1,"title-order-direction"],"titleMeasures":[1,"title-measures"],"titleDateStart":[1,"title-date-start"],"titleDateEnd":[1,"title-date-end"],"titleDateFormat":[1,"title-date-format"],"titleDateLink":[1,"title-date-link"],"titleNamespace":[1,"title-namespace"],"pageFormat":[1,"page-format"],"pageOrientation":[1,"page-orientation"],"pageNumber":[1,"page-number"],"footerText":[1,"footer-text"],"footerDisplayPageNumber":[4,"footer-display-page-number"],"pageLayout":[1,"page-layout"],"pageCustomTemplate":[1,"page-custom-template"],"pageGridGap":[1,"page-grid-gap"],"pageFitToContent":[4,"page-fit-to-content"],"getNumberOfSlot":[64]}]]],["p-6c7c0455",[[257,"bn-layout-card",{"styles":[1],"titleImage":[1,"title-image"],"titleBusinessUnit":[1,"title-business-unit"],"titleScenarios":[1,"title-scenarios"],"titleVariances":[1,"title-variances"],"titleOrder":[1,"title-order"],"titleOrderDirection":[1,"title-order-direction"],"titleMeasures":[1,"title-measures"],"titleDateStart":[1,"title-date-start"],"titleDateEnd":[1,"title-date-end"],"titleDateFormat":[1,"title-date-format"],"titleDateLink":[1,"title-date-link"],"titleNamespace":[1,"title-namespace"],"footerText":[1,"footer-text"],"cardLayout":[1,"card-layout"],"cardCustomTemplate":[1,"card-custom-template"],"cardGridGap":[1,"card-grid-gap"],"cardFitToContent":[4,"card-fit-to-content"],"cardShowBorder":[4,"card-show-border"],"getNumberOfSlot":[64]}]]],["p-a90f1cbe",[[1,"bn-chart-structure",{"chartTitle":[1,"chart-title"],"filter":[1],"scenarios":[1],"variances":[1],"unitScaling":[8,"unit-scaling"],"percentageScaling":[8,"percentage-scaling"],"level":[1],"order":[1],"orderDirection":[1,"order-direction"],"limit":[2],"showCategories":[1,"show-categories"],"measureScale":[1,"measure-scale"],"showMeasureScale":[1,"show-measure-scale"],"measureUnit":[1,"measure-unit"],"stack":[1],"scale":[1],"data":[32],"datasetMeta":[32],"appliedScaleFactor":[32]},null,{"scenarios":[{"validateScenario":0}],"variances":[{"validateVariances":0}],"unitScaling":[{"validateUnitScaling":0}],"percentageScaling":[{"validatePercentageScaling":0}],"level":[{"validateLevel":0}],"order":[{"validateOrderList":0}],"orderDirection":[{"validateOrderDirection":0}],"limit":[{"validateLimit":0}],"showCategories":[{"validateShowCategories":0}],"measureScale":[{"validateMeasureScale":0}],"showMeasureScale":[{"validateShowMeasureScale":0}],"stack":[{"validateStack":0}],"scale":[{"validateScaling":0}]}]]],["p-997b2fe4",[[1,"bn-chart-time",{"chartTitle":[1,"chart-title"],"filter":[1],"scenarios":[1],"variances":[1],"syncSpaceLeft":[2,"sync-space-left"],"limit":[2],"unitScaling":[8,"unit-scaling"],"percentageScaling":[8,"percentage-scaling"],"level":[1],"order":[1],"orderDirection":[1,"order-direction"],"dateInterval":[1,"date-interval"],"chartMode":[1,"chart-mode"],"maxBars":[2,"max-bars"],"stack":[1],"scale":[1],"intervalSpanLimit":[2,"interval-span-limit"],"axisLabelsMode":[1,"axis-labels-mode"],"lineFullWidth":[1,"line-full-width"],"showCategories":[1,"show-categories"],"measureScale":[1,"measure-scale"],"showMeasureScale":[1,"show-measure-scale"],"showOverlayAvg":[1,"show-overlay-avg"],"showOverlayMedian":[1,"show-overlay-median"],"measureUnit":[1,"measure-unit"],"data":[32],"datasetMeta":[32],"appliedScaleFactor":[32]},null,{"scenarios":[{"validateScenario":0}],"variances":[{"validateVariances":0}],"syncSpaceLeft":[{"validateLeftSync":0}],"limit":[{"validateLimit":0}],"unitScaling":[{"validateUnitScaling":0}],"percentageScaling":[{"validatePercentageScaling":0}],"level":[{"validateLevel":0}],"order":[{"validateOrderList":0}],"orderDirection":[{"validateOrderDirection":0}],"dateInterval":[{"validateDateInterval":0}],"chartMode":[{"validateChartMode":0}],"maxBars":[{"validateMaxBars":0}],"stack":[{"validateStack":0}],"scale":[{"validateScaling":0}],"axisLabelsMode":[{"validateAxisLabelsMode":0}],"lineFullWidth":[{"validateLineFullWidth":0}],"showCategories":[{"validateShowCategories":0}],"measureScale":[{"validateMeasureScale":0}],"showMeasureScale":[{"validateShowMeasureScale":0}],"showOverlayAvg":[{"validateShowOverlayAvg":0}],"showOverlayMedian":[{"validateShowOverlayMedian":0}]}]]],["p-701e1578",[[1,"bn-asset",{"name":[1]}]]],["p-37881d05",[[0,"bn-component-style",{"name":[1]}]]],["p-b7bec050",[[0,"bn-dataset",{"name":[1],"datasources":[1],"static":[4]},null,{"name":[{"nameUpdated":0}]}]]],["p-d7f0cbaf",[[257,"bn-grid",{"chartTitle":[1,"chart-title"],"rowHeaders":[1,"row-headers"],"columnHeaders":[1,"column-headers"],"showRowHeaders":[1,"show-row-headers"],"showColumnHeaders":[1,"show-column-headers"],"showBorders":[1,"show-borders"],"rowHeaderWidth":[1,"row-header-width"],"cellGap":[1,"cell-gap"],"gridConfig":[32]},null,{"rowHeaders":[{"validateRowHeaders":0}],"columnHeaders":[{"validateColumnHeaders":0}],"showRowHeaders":[{"validateShowRowHeaders":0}],"showColumnHeaders":[{"validateShowColumnHeaders":0}],"showBorders":[{"validateShowBorders":0}]}]]],["p-ece17f84",[[1,"bn-image",{"source":[1]}]]],["p-05a82a77",[[0,"bn-internationalization",{"code":[1],"namespace":[1]}]]],["p-f27995c9",[[257,"bn-template",{"templateId":[1,"template-id"]}]]],["p-1dbd339c",[[1,"bn-text",{"value":[1],"scale":[1],"data":[32]},null,{"value":[{"validateValue":0}],"scale":[{"validateScaling":0}]}]]],["p-31cc6a2d",[[257,"bn-tree",{"edges":[1],"direction":[1],"levelSpacing":[2,"level-spacing"],"nodeSpacing":[2,"node-spacing"],"edgeStyle":[1,"edge-style"],"showOperators":[1,"show-operators"],"treeConfig":[32],"layout":[32],"nodeRects":[32],"svgWidth":[32],"svgHeight":[32]},null,{"edges":[{"validateEdgesProp":0}],"direction":[{"validateDirection":0}],"levelSpacing":[{"validateLevelSpacing":0}],"nodeSpacing":[{"validateNodeSpacing":0}],"edgeStyle":[{"validateEdgeStyle":0}],"showOperators":[{"validateShowOperators":0}]}]]],["p-0f1504f3",[[0,"editor-companion",{"internationalizationKeys":[64],"getDistinctFromDataSource":[64],"getDistinctFromDataset":[64]}]]],["p-50e49732",[[257,"bn-card"]]],["p-6da93eae",[[1,"bn-message",{"text":[1025],"image":[1]}]]],["p-dfb61aa5",[[1,"ibcs-chart-structure",{"data":[16],"chartTitle":[1,"chart-title"],"scenarios":[16],"variances":[16],"hideCategories":[4,"hide-categories"],"pixelPerUnit":[2,"pixel-per-unit"],"pixelPerPercentage":[2,"pixel-per-percentage"],"limit":[2],"styles":[1040],"i18n":[1040],"order":[16],"level":[1],"filter":[1],"measureScale":[1,"measure-scale"],"measureUnit":[1,"measure-unit"],"showMeasureScale":[4,"show-measure-scale"],"dataFormatDigits":[16],"stackConfig":[16],"parentDimensions":[16]}]]],["p-1970906d",[[1,"ibcs-chart-time",{"data":[16],"chartTitle":[1,"chart-title"],"scenarios":[16],"variances":[16],"hideAxisLabels":[4,"hide-axis-labels"],"pixelPerUnit":[2,"pixel-per-unit"],"pixelPerPercentage":[2,"pixel-per-percentage"],"limit":[2],"leftSideOffsetForHorizontalSync":[2,"left-side-offset-for-horizontal-sync"],"styles":[1040],"i18n":[1040],"order":[16],"level":[1],"dateInterval":[1,"date-interval"],"intervalSpanLimit":[2,"interval-span-limit"],"axisLabelsMode":[1,"axis-labels-mode"],"filter":[1],"measureScale":[1,"measure-scale"],"measureUnit":[1,"measure-unit"],"showMeasureScale":[4,"show-measure-scale"],"showOverlayMedian":[4,"show-overlay-median"],"showOverlayAvg":[4,"show-overlay-avg"],"chartMode":[1,"chart-mode"],"maxBars":[2,"max-bars"],"stackConfig":[16],"lineFullWidth":[4,"line-full-width"],"containerWidth":[2,"container-width"],"dataFormatDigits":[16],"parentDimensions":[16]}]]],["p-2e68cf09",[[1,"bn-table",{"scale":[1],"tableTitle":[1,"table-title"],"filter":[1],"measureUnit":[1,"measure-unit"],"scenarios":[1],"variances":[1],"barColumns":[1,"bar-columns"],"barColumnWidth":[1,"bar-column-width"],"unitScaling":[8,"unit-scaling"],"percentageScaling":[8,"percentage-scaling"],"dataFormat":[1,"data-format"],"grouped":[1],"showMeasureScale":[1,"show-measure-scale"],"showGroupTitle":[1,"show-group-title"],"type":[1],"limit":[2],"thereof":[1],"partof":[1],"order":[1],"orderDirection":[1,"order-direction"],"measureType":[1,"measure-type"],"measureScale":[1,"measure-scale"],"dataFormatDigitsDecimal":[2,"data-format-digits-decimal"],"dataFormatDigitsPercent":[2,"data-format-digits-percent"],"categoryWidth":[1,"category-width"],"columnthereof":[1],"data":[32],"datasetMeta":[32],"appliedScaleFactor":[32]},null,{"scale":[{"validateScaling":0}],"scenarios":[{"validateScenario":0}],"variances":[{"validateVariances":0}],"barColumns":[{"validateBarColumns":0}],"barColumnWidth":[{"validateBarColumnWidth":0}],"unitScaling":[{"validateUnitScaling":0}],"percentageScaling":[{"validatePercentageScaling":0}],"dataFormat":[{"validateDataFormat":0}],"grouped":[{"validateGrouped":0}],"showMeasureScale":[{"validateShowMeasureScale":0}],"showGroupTitle":[{"validateShowGroupTitle":0}],"type":[{"validateType":0}],"limit":[{"validateLimit":0}],"thereof":[{"validateThereOf":0}],"partof":[{"validatePartOf":0}],"order":[{"validateOrderList":0}],"orderDirection":[{"validateOrderDirection":0}],"measureType":[{"validateMeasureType":0}],"measureScale":[{"validateMeasureScale":0}],"dataFormatDigitsDecimal":[{"validateDataFormatDigitsDecimal":0}],"dataFormatDigitsPercent":[{"validateDateFormatDigitsPercent":0}],"categoryWidth":[{"validateCategoryWidth":0}],"columnthereof":[{"validateColumnThereOf":0}]}],[257,"bn-context",{"locale":[1]},null,{"locale":[{"setLocale":0}]}],[0,"bn-datasource",{"name":[1]}],[257,"bn-page",{"format":[1],"orientation":[1]},null,{"format":[{"validateFormat":0}],"orientation":[{"validateOrientation":0}]}],[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"]}]]],["p-fd427179",[[1,"bn-title",{"businessUnit":[1,"business-unit"],"scenarios":[1],"variances":[1],"order":[1],"orderDirection":[1,"order-direction"],"measures":[1],"dateStart":[1,"date-start"],"dateEnd":[1,"date-end"],"dateFormat":[1,"date-format"],"dateLink":[1,"date-link"]},null,{"scenarios":[{"validateScenario":0}],"variances":[{"validateVariances":0}],"order":[{"validateOrder":0}],"orderDirection":[{"validateOrderDirection":0}],"measures":[{"validateMeasures":0}],"dateStart":[{"validateDateStart":0}],"dateEnd":[{"validateDateEnd":0}],"dateFormat":[{"validateDateFormat":0}],"dateLink":[{"validateDateLink":0}]}],[257,"bn-body"],[1,"bn-footer",{"pageNumber":[1026,"page-number"],"text":[1025],"code":[1025],"displayPageNumber":[4,"display-page-number"]}],[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"],"setBusinessUnit":[64],"setProps":[64]}]]]]'),e))));
@@ -1 +1 @@
1
- import{r as t,h as i,H as s,g as h}from"./p-JNHhIe7t.js";import{S as e,g as n,a as r,b as o,c as l,I as a,F as c,d as u,e as d,f,P as p}from"./p-CvXqez4D.js";import{e as w,D as v,b,c as g,C as m,k as L,d as P,j as S,A as y,O as k}from"./p-DdexOqTs.js";import{C as M,F as C,V as x}from"./p-1jFf17Vj.js";import{S as A,D as O,b as T}from"./p-DVo6aZUE.js";import{a as D}from"./p-BYmPQYxx.js";import{D as $,b as _}from"./p-DgfL-ffj.js";import{I as E,S as Y}from"./p--PSoPbDM.js";import"./p-BFTU3MAI.js";class N{constructor(){this.scenarioOffset=.3,this.scenarioLabelToColumn=.3,this.labelToColumn=.3,this.labelToAxis=.3,this.needleWidth=.3,this.needleHeadWidth=.6,this.columnWidth=2,this.varianceAxisLineWidth=.3,this.axisLineWidth=.1,this.auxiliaryLineWidth=.1,this.scenarioLineWidth=.2,this.markerWidth=.7,this.markerOffset=0,this.categoryWidth=3,this.axisTickLength=.3}}class R{adapt(t){const i=new N;return w.isNumber(t.scenarioOffset)&&(i.scenarioOffset=t.scenarioOffset),w.isNumber(t.scenarioLabelToColumn)&&(i.scenarioLabelToColumn=t.scenarioLabelToColumn),w.isNumber(t.labelToColumn)&&(i.labelToColumn=t.labelToColumn),w.isNumber(t.labelToAxis)&&(i.labelToAxis=t.labelToAxis),w.isNumber(t.needleWidth)&&(i.needleWidth=t.needleWidth),w.isNumber(t.needleHeadWidth)&&(i.needleHeadWidth=t.needleHeadWidth),w.isNumber(t.columnWidth)&&(i.columnWidth=t.columnWidth),w.isNumber(t.varianceAxisLineWidth)&&(i.varianceAxisLineWidth=t.varianceAxisLineWidth),w.isNumber(t.axisLineWidth)&&(i.axisLineWidth=t.axisLineWidth),w.isNumber(t.auxiliaryLineWidth)&&(i.auxiliaryLineWidth=t.auxiliaryLineWidth),w.isNumber(t.scenarioLineWidth)&&(i.scenarioLineWidth=t.scenarioLineWidth),w.isNumber(t.markerWidth)&&(i.markerWidth=t.markerWidth),w.isNumber(t.markerOffset)&&(i.markerOffset=t.markerOffset),w.isNumber(t.categoryWidth)&&(i.categoryWidth=t.categoryWidth),w.isNumber(t.axisTickLength)&&(i.axisTickLength=t.axisTickLength),i}default(){return new N}}class H{constructor(t,i,s,h,e,n,r){this.categoryPosition={x:0,y:0},this.spacings=new N,this.categoriesBoxOffset={width:0,height:0},this.padding=t,this.scaleFactors=i,this.fontStlye=s,this.dataLabelHeight=this.caluculateDataLabelHeight(),this.axisPosition={x:0,y:0},this.columnValue={min:h,max:e},this.numberOfColumns=n,this.leftSideLabelLength=r,this.calculateSpacings(),this.calculateCategoryPosition(),this.calculateAxisPosition()}caluculateDataLabelHeight(){return 1.1*M("123456789",{font:this.fontStlye.font,fontSize:this.fontStlye.size+"px"}).height}getColumnCenterPositionX(t){return this.categoryPosition.y+this.spacings.scenarioOffset+t*this.spacings.categoryWidth+this.leftSideLabelLength+.5*this.spacings.columnWidth}getAxisPositionY(t){let i=this.columnValue.max.getScaledUnit();return t&&(i=this.columnValue.max.getScaledPercentUnit()+this.getNeedleWidth()),i+this.dataLabelHeight+this.spacings.labelToAxis+this.padding.top}getAxisPositionX(){return this.padding.left+this.leftSideLabelLength}getColumnPositionX(t,i){return i?this.getColumnCenterPositionX(t):this.getColumnCenterPositionX(t)-this.spacings.scenarioOffset}getColumnPositionY(){return this.columnValue.max.getScaledUnit()+this.dataLabelHeight+this.spacings.labelToColumn+this.padding.top}getNeedlePositionY(){return this.columnValue.max.getScaledPercentUnit()+this.dataLabelHeight+this.spacings.labelToColumn+this.getNeedleWidth()+this.padding.top}getMarkerPositionX(t,i){return i?this.getColumnCenterPositionX(t)-this.spacings.markerOffset-.5*this.getColumnWidth():this.getColumnCenterPositionX(t)+this.spacings.markerOffset+.5*this.getColumnWidth()}getMarkerPositionY(){return this.getColumnPositionY()}getAxisTitlePositionX(t){const i=t.width();return this.axisPosition.x-i}getAxisTitlePositionY(t,i){let s=this.columnValue.max.getScaledUnit();return i&&(s=this.columnValue.max.getScaledPercentUnit()),t?s+this.dataLabelHeight+this.spacings.labelToAxis:s}getColumnDataLabelPositionY(t){const i=this.spacings.labelToColumn;return t<0?this.getColumnPositionY()+Math.abs(t)+i:this.getColumnPositionY()-t-i}getNeedleDataLabelPositionY(t){const i=this.spacings.labelToColumn;return t<0?this.getNeedlePositionY()+Math.abs(t)+i+2*this.getNeedleWidth():this.getNeedlePositionY()-t-i-2*this.getNeedleWidth()}getAxisEndPositionX(){return this.getAxisPositionX()+(this.numberOfColumns+.5)*this.spacings.categoryWidth}getColumnWidth(){return this.spacings.columnWidth}getNeedleWidth(){return this.spacings.needleWidth}getNeedleHeadWidth(){return this.spacings.needleHeadWidth}getScenarioLabelPositionOffsetX(t){return t?.5*this.getColumnWidth()+this.spacings.scenarioLabelToColumn:-(.5*this.getColumnWidth()+this.spacings.scenarioLabelToColumn)}calculateSpacings(){this.spacings={scenarioOffset:this.fontStlye.size*this.scaleFactors.scenarioOffset,scenarioLabelToColumn:this.fontStlye.size*this.scaleFactors.scenarioLabelToColumn,markerOffset:this.fontStlye.size*this.scaleFactors.markerOffset,labelToColumn:this.fontStlye.size*this.scaleFactors.labelToColumn,labelToAxis:this.fontStlye.size*this.scaleFactors.labelToAxis,needleWidth:this.fontStlye.size*this.scaleFactors.needleWidth,needleHeadWidth:this.fontStlye.size*this.scaleFactors.needleHeadWidth,columnWidth:this.fontStlye.size*this.scaleFactors.columnWidth,varianceAxisLineWidth:this.fontStlye.size*this.scaleFactors.varianceAxisLineWidth,axisLineWidth:this.fontStlye.size*this.scaleFactors.axisLineWidth,auxiliaryLineWidth:this.fontStlye.size*this.scaleFactors.auxiliaryLineWidth,scenarioLineWidth:this.fontStlye.size*this.scaleFactors.scenarioLineWidth,markerWidth:this.fontStlye.size*this.scaleFactors.markerWidth,categoryWidth:this.fontStlye.size*this.scaleFactors.categoryWidth,axisTickLength:this.fontStlye.size*this.scaleFactors.axisTickLength}}calculateCategoryPosition(){this.categoryPosition={x:this.padding.left+.5*this.spacings.columnWidth,y:this.padding.top}}calculateAxisPosition(){this.axisPosition={x:this.getAxisPositionX(),y:this.getAxisPositionY(!1)}}getMarkerScenarioLabelPositionOffsetX(t){return t?this.spacings.labelToColumn-this.fontStlye.size:this.spacings.labelToColumn+.5*this.spacings.markerWidth}}class F{constructor(t){this.top=t.top,this.bottom=t.bottom,this.left=t.left,this.right=t.right}addBoxTopLeft(t){return this.top+=t.height|this.top,this.left+=t.width|this.top,this}}class j{constructor(t){const i=1*t,s=.7*t;this.bgOffset=(i-s)/2,this.markerUp={top:s/2+",0",left:"0,"+s,right:s+","+s},this.markerUpBackground={top:i/2+",0",left:"0,"+i,right:i+","+i},this.markerDown={bottom:s/2+","+s,left:"0,0",right:s+",0"},this.markerDownBackground={bottom:i/2+","+i,left:"0,0",right:i+",0"},this.markerRight={bottom:"0,"+s,top:"0,0",right:s+","+s/2},this.markerRightBackground={bottom:"0,"+i,top:"0,0",right:i+","+i/2},this.markerLeft={bottom:s+","+s,top:s+",0",left:"0,"+s/2},this.markerLeftBackground={bottom:i+","+i,top:i+",0",Left:"0,"+i/2}}upMarkerPatternStrings(){return{background:this.markerUpBackground.left+" "+this.markerUpBackground.right+" "+this.markerUpBackground.top+" "+this.markerUpBackground.left,foreground:this.markerUp.left+" "+this.markerUp.right+" "+this.markerUp.top+" "+this.markerUp.left,bgOffset:this.bgOffset}}downMarkerPatternStrings(){return{background:this.markerDownBackground.left+" "+this.markerDownBackground.right+" "+this.markerDownBackground.bottom+" "+this.markerDownBackground.left,foreground:this.markerDown.left+" "+this.markerDown.right+" "+this.markerDown.bottom+" "+this.markerDown.left,bgOffset:this.bgOffset}}rightMarkerPatternStrings(){return{background:this.markerRightBackground.top+" "+this.markerRightBackground.right+" "+this.markerRightBackground.bottom+" "+this.markerRightBackground.top,foreground:this.markerRight.top+" "+this.markerRight.right+" "+this.markerRight.bottom+" "+this.markerRight.top,bgOffset:this.bgOffset}}leftMarkerPatternStrings(){return{background:this.markerLeftBackground.top+" "+this.markerLeftBackground.Left+" "+this.markerLeftBackground.bottom+" "+this.markerLeftBackground.top,foreground:this.markerLeft.top+" "+this.markerLeft.left+" "+this.markerLeft.bottom+" "+this.markerLeft.top,bgOffset:this.bgOffset}}createPatternMapForStructureBar(){const t=new Map;return t.set("marker-up",this.upMarkerPatternStrings()),t.set("marker-down",this.downMarkerPatternStrings()),t.set("marker-right",this.rightMarkerPatternStrings()),t.set("marker-left",this.leftMarkerPatternStrings()),t}}class V{constructor(t){this.container=new e,this.pattern=this.createFCPattern(this.container.group(),t),this.styles=t;let i=10;null!=t&&null!=t.fontStyles&&t.fontStyles.size&&(i=t.fontStyles.size),this.bgOffset=(1*i-.7*i)/2}createFCPattern(t,i){const s=i;return t.pattern(10,10,(function(t){t.rect(10,10).fill(s.barStyles.fc.fill),t.line(0,5,5,0).stroke({width:s.barStyles.fc.width,color:s.barStyles.fc.stroke,linecap:"square"}),t.line(5,10,10,5).stroke({width:s.barStyles.fc.width,color:s.barStyles.fc.stroke,linecap:"square"})})).id("pattern-time-fc")}getFCPolygonPattern(){return{background:"",foreground:"",bgOffset:0,pattern:this.pattern}}toString(){return this.container.svg()}}var X;!function(t){t[t.Left=0]="Left",t[t.Center=1]="Center",t[t.Right=2]="Right",t[t.Top=3]="Top",t[t.Bottom=4]="Bottom"}(X||(X={}));class I{constructor(t,i,s,h,e,n,r,o){this.ID_SCENARIOLABEL="Label",this.CSS_CATEGORIES="categories",this.isRelativeLabel=!1,this.segmentFillColor=null,this.x=i,this.y=s,this.value=e,this.group=t.group().id(this.createElementID(t.toString(),h)),this.styles=n,this.isVarianceLabel=!1,this.verticalHookLocation=r||X.Top,this.horizontalHookLocation=o||X.Left}setToVarianceLabel(){return this.isVarianceLabel=!0,this}setToRelativeVarianceLabel(){return this.isVarianceLabel=!0,this.isRelativeLabel=!0,this}setSegmentFill(t){return this.segmentFillColor=t,this}updateGroup(t){return this.group=t,this}draw(t=!0,i={percent:2,decimal:1},s=new A){if(this.isEmpty())return this;const h=this.group;let e,n="";if(!1===Number.isNaN(Number(this.value))){let t="percent",h=i.percent,r=i.percent,o=1;!1===this.isRelativeLabel&&(h=i.decimal,r=i.decimal,o=s.value,t="decimal"),e=C.number(Number(this.value),t,h,r,o),this.isVarianceLabel&&Number(this.value)>=0&&(n="+")}else e=""+this.value;const r=this.drawLabel(h,n+e);return!1===t&&(r.addClass("hide"),h.addClass("hide")),this}isEmpty(){return null==this.value||""===this.value}setPos(t,i){return this.x=t,this.y=i,this}forceStringTypeDraw(){return this.drawLabel(this.group,""+this.value),this}drawLabel(t,i){const s=this.styles.fontStyles.background||"#ffffff";let h="start";const e=t.text(i);e.move(this.x,this.y);const r=e.bbox().w,o=e.bbox().h;let l=0,a=0;const c=e.x();let u=e.y();return this.horizontalHookLocation===X.Left?(h="left",l=e.x()):this.horizontalHookLocation===X.Center?(h="middle",l=e.x()-(r+2)/2):this.horizontalHookLocation===X.Right&&(h="end",l=e.x()-r),this.verticalHookLocation===X.Center?(u=e.y()-1.2*o/2,a=u+.2*o):this.verticalHookLocation===X.Top?(u-=o/4,a=u+.2*o):this.verticalHookLocation===X.Bottom&&(u-=o,a=u+.2*o),e.move(c,u),e.font({anchor:h}),null!=this.segmentFillColor?e.fill(n(this.segmentFillColor)):t.rect(r+2,.8*o).stroke(s).fill(s).opacity(.9).move(l-1,a).insertBefore(e),e}createElementID(t,i){return t+"_"+i+"_"+this.ID_SCENARIOLABEL}}const W={ac:1,pp:2,fc:3,pl:4};var G,B,U;!function(t){t[t.Above=0]="Above",t[t.Below=1]="Below",t[t.Left=2]="Left",t[t.Right=3]="Right"}(G||(G={}));class z{constructor(){this.labels=[],this.scenarioLabels=[]}clear(){this.labels=[],this.scenarioLabels=[]}register(t){this.labels.push(t)}hasCollision(t){return this.labels.some((i=>this.intersects(t,i)))}getOptimalPlacement(t,i,s,h,e,n,r,o){const l=W[r]||99,a=n/2;for(const n of o){const r=this.calculatePlacementForDirection(t,i,s,h,e,a,8,n);if(!this.hasCollision(r.bounds))return r}for(const n of o){const r=this.calculatePlacementForDirection(t,i,s,h,e,a,8,n);if(!this.collidesWithHigherPriority(r.bounds,l))return r}return null}calculatePlacementForDirection(t,i,s,h,e,n,r,o){let l,a,c,u,d,f;switch(o){case G.Above:l=t,a=i-n-r,c=X.Bottom,u=X.Center,d=t-s/2,f=i-n-r-h;break;case G.Below:l=t,a=i+n+r,c=X.Top,u=X.Center,d=t-s/2,f=i+n+r-h/4;break;case G.Left:l=t-n-r,a=i,c=X.Center,u=X.Right,d=t-n-r-s,f=i-.6*h;break;case G.Right:l=t+n+r,a=i,c=X.Center,u=X.Left,d=t+n+r,f=i-.6*h}return{labelX:l,labelY:a,verticalHook:c,horizontalHook:u,bounds:{x:d,y:f,width:s,height:h,pointIndex:e,preferredHook:c}}}collidesWithHigherPriority(t,i){return this.labels.some((s=>!!s.scenarioType&&((W[s.scenarioType]||99)<i&&this.intersects(t,s))))}shouldHideScenarioLabel(t,i,s,h=20){const e=W[s]||99;return!(e<=1)&&this.scenarioLabels.some((s=>{if((W[s.scenarioType]||99)>=e)return!1;const n=Math.abs(i-s.y),r=Math.abs(t-s.x);return n<h&&r<h}))}registerScenarioLabel(t,i,s){this.scenarioLabels.push({x:t,y:i,scenarioType:s})}intersects(t,i){return!(t.x+t.width<i.x||i.x+i.width<t.x||t.y+t.height<i.y||i.y+i.height<t.y)}getLabelCount(){return this.labels.length}}class q{constructor(t,i,s,h){this.value=t,this.scenario=i,this.pixelPerUnit=s||1,this.variance="neg"===h||h===B.NEG?B.NEG:"pos"===h||h===B.POS?B.POS:B.NEU}isEmpty(){return void 0===this.value||null==this.scenario}getScaledUnit(){return null==this.value?0:this.value*this.pixelPerUnit}getScaledPercentUnit(){return null==this.value?0:this.value>1.45?1.45*this.pixelPerUnit:this.value<-1.45?-1.45*this.pixelPerUnit:this.value*this.pixelPerUnit}getVarianceStyle(){return null==this.value||this.value>=0?this.variance:B.NEU===this.variance?B.NEU:B.POS===this.variance?B.NEG:B.POS}isClipped(){return null!=this.value&&Math.abs(this.value)>1.45}getClippedValue(){return 145}getScenario(){var t;return null===(t=this.scenario)||void 0===t?void 0:t.slice(0,2)}}class K{constructor(){this.operation="+"}addRowGroup(t,i){this.rowGroup=t,this.rowGroupIndex=i}addCategory(t,i){this.category=t,this.categoryIndex=i}addSubCategory(t,i){this.subCategory=t,this.subCategoryIndex=i}addColumnGroup(t,i){this.columnGroup=t,this.columnGroupIndex=i}addSubColumnGroup(t,i){this.columnSubGroup=t,this.columnSubGroupIndex=i}}class Z{constructor(){}adapt(t){const i=new K;return w.isString(t.date)&&(i.date=this.parseDateString(t.date)),w.isOperator(t.operation)&&(i.operation=t.operation),w.isNumber(t.rowGroupIndex)&&w.isString(t.rowGroup)&&i.addRowGroup(t.rowGroup,t.rowGroupIndex),w.isNumber(t.categoryIndex)&&w.isString(t.category)&&i.addCategory(t.category,t.categoryIndex),w.isNumber(t.subCategoryIndex)&&w.isString(t.subCategory)&&i.addSubCategory(t.subCategory,t.subCategoryIndex),w.isNumber(t.columnGroupIndex)&&w.isString(t.columnGroup)&&i.addColumnGroup(t.columnGroup,t.columnGroupIndex),w.isNumber(t.columnSubGroupIndex)&&w.isString(t.columnSubGroup)&&i.addSubColumnGroup(t.columnSubGroup,t.columnSubGroupIndex),this.setActualValues(t,i),this.setPlanValues(t,i),this.setPreviousPeriodValues(t,i),this.setForecastValues(t,i),i}parseDateString(t){const i=v.fromISO(t);if(i.isValid)return i;console.warn(`TimeChartDataRow: invalid date value '${t}' — skipping row`)}default(){return new K}setActualValues(t,i){w.isNumber(t.ac1)&&(i.ac1=t.ac1),w.isNumber(t.ac2)&&(i.ac2=t.ac2),w.isNumber(t.ac3)&&(i.ac3=t.ac3),w.isNumber(t.ac4)&&(i.ac4=t.ac4)}setPlanValues(t,i){w.isNumber(t.pl1)&&(i.pl1=t.pl1),w.isNumber(t.pl2)&&(i.pl2=t.pl2),w.isNumber(t.pl3)&&(i.pl3=t.pl3),w.isNumber(t.pl4)&&(i.pl4=t.pl4)}setPreviousPeriodValues(t,i){w.isNumber(t.pp1)&&(i.pp1=t.pp1),w.isNumber(t.pp2)&&(i.pp2=t.pp2),w.isNumber(t.pp3)&&(i.pp3=t.pp3),w.isNumber(t.pp4)&&(i.pp4=t.pp4)}setForecastValues(t,i){w.isNumber(t.fc1)&&(i.fc1=t.fc1),w.isNumber(t.fc2)&&(i.fc2=t.fc2),w.isNumber(t.fc3)&&(i.fc3=t.fc3),w.isNumber(t.fc4)&&(i.fc4=t.fc4)}}class J{constructor(t,i,s,h,e,n){this.scaleFactors=t,this.fontStyles=i,this.axisStyles=s,this.barStyles=h,this.varianceStyles=e,this.padding=n,this.pattern=new Map}}class Q{constructor(t,i,s,h,e){this.scaleFactorsStructureChartAdapter=t,this.fontStyleAdapter=i,this.svgStyleGroupAdapter=s,this.svgVariancesStyleGroupAdapter=h,this.paddingadapter=e}adapt(t){const i=new J(this.scaleFactorsStructureChartAdapter.default(),this.fontStyleAdapter.default(),this.svgStyleGroupAdapter.default(),this.svgStyleGroupAdapter.default(),this.svgVariancesStyleGroupAdapter.default(),this.paddingadapter.default());return w.isExisting(t)&&(w.isExisting(t.scaleFactors)&&(i.scaleFactors=this.scaleFactorsStructureChartAdapter.adapt(t.scaleFactors)),w.isExisting(t.fontStyles)&&(i.fontStyles=this.fontStyleAdapter.adapt(t.fontStyles)),w.isExisting(t.axisStyles)&&(i.axisStyles=this.svgStyleGroupAdapter.adapt(t.axisStyles)),w.isExisting(t.barStyles)&&(i.barStyles=this.svgStyleGroupAdapter.adapt(t.barStyles)),w.isExisting(t.varianceStyles)&&(i.varianceStyles=this.svgVariancesStyleGroupAdapter.adapt(t.varianceStyles)),w.isExisting(t.padding)&&(i.padding=this.paddingadapter.adapt(t.padding)),i.pattern=new j(i.fontStyles.size).createPatternMapForStructureBar()),i}default(){return new J(this.scaleFactorsStructureChartAdapter.default(),this.fontStyleAdapter.default(),this.svgStyleGroupAdapter.default(),this.svgStyleGroupAdapter.default(),this.svgVariancesStyleGroupAdapter.default(),this.paddingadapter.default())}}!function(t){t.AC1="ac1",t.PP1="pp1",t.FC1="fc1",t.PL1="pl1",t.AC2="ac2",t.PP2="pp2",t.FC2="fc2",t.PL2="pl2",t.AC3="ac3",t.PP3="pp3",t.FC3="fc3",t.PL3="pl3",t.AC4="ac4",t.PP4="pp4",t.FC4="fc4",t.PL4="pl4",t.POS="pos",t.NEG="neg",t.NEU="neu"}(B||(B={})),function(t){t.LIST="LIST",t.SUM="SUM",t.OPT="OPT"}(U||(U={}));class tt{constructor(t,i,s){this.ID_AXIS="axis",this.CSS_AXIS_TITLE="categories",this.scenarioType=t.scenarioType,this.labelText=t.labelText||null,this.isRelative=t.isRelative||!1,this.position=i,this.svgGroup=s.group().id(this.ID_AXIS)}drawAxisTitle(t,i){null==i&&(i=""),t.text(i).addClass(this.CSS_AXIS_TITLE).attr("text-anchor","middle").move(this.position.getAxisTitlePositionX(t),this.position.getAxisTitlePositionY(!0,this.isRelative))}draw(){return this.labelText&&this.drawAxisTitle(this.svgGroup,this.labelText),this.svgGroup.line(this.position.getAxisPositionX(),this.position.getAxisPositionY(this.isRelative),this.position.getAxisEndPositionX(),this.position.getAxisPositionY(this.isRelative)).addClass(this.ID_AXIS+"-"+this.convertScenarioType()),this}convertScenarioType(){return void 0===this.scenarioType||null==this.scenarioType?"default":`${this.scenarioType}`.slice(0,2)}}class it{constructor(t,i,s,h,e,n,r,o=null){this.ID_DATA_PREFIX="DATA",this.ID_SCENARIO_PREFIX="SCENARIO",this.ID_RECT="RECT",this.FALLBACK_COLOUR="#000000",this.label=null,this.scenarioLabel=null,this.isVarianceColumn=!1,this.overflowConfig=null,this.isOverflowing=!1,this.overdriveHeight=0,this.dimensions={columnLength:0,xPos:0,yPos:0,labelYPos:0,scenarioLabelXPos:0,scenarioLabelYPos:0,clipped:!1},this.hasData=!1,this.dataPoint=s,this.index=h,this.isPrimaryColumn=e,this.position=t,this.columnBarStyles=i.barStyles,this.overflowConfig=o,this.scenarioGroup=n,this.styles=i,this.columnGroup=n.group().id(n.toString()+"_"+this.ID_RECT),!0!==(null==s?void 0:s.isEmpty())&&(this.hasData=!0,this.dimensions=this.createDimensions(s,h,e),this.label=this.getDataLabel(s),this.scenarioLabel=this.getScenarioLabel(r))}setAsVariance(){var t;return this.isVarianceColumn=!0,null===(t=this.label)||void 0===t||t.setToVarianceLabel(),this}updateLabelGroup(t){var i;return this.isEmpty()||null===(i=this.label)||void 0===i||i.updateGroup(t),this}draw(t={percent:2,decimal:1},i=new A){if(this.isEmpty())return this;const s=this.getScenarioStyle(),h=this.convertToSVGStyle(s,"stroke"),e=this.getFillStyle(s);null!=this.columnGroup&&(this.isOverflowing&&this.overflowConfig?this.drawOverdriveBar(e,h):this.columnGroup.rect(this.position.getColumnWidth(),this.dimensions.columnLength).fill(e).stroke(h).y(this.dimensions.yPos).cx(this.dimensions.xPos)),this.drawColumnDataLabel(t,i),this.drawScenarioLabel()}drawOverdriveBar(t,i){if(!this.columnGroup||!this.overflowConfig)return;const s=this.position.getColumnPositionY(),h=this.position.getColumnWidth(),e=this.dimensions.columnLength,{breakGap:n}=this.overflowConfig,r=s-e;this.columnGroup.rect(h,e).fill(t).stroke(i).y(r).cx(this.dimensions.xPos);const o=r-n-this.overdriveHeight;this.columnGroup.rect(h,this.overdriveHeight).fill(t).stroke(i).y(o).cx(this.dimensions.xPos),this.drawBreakIndicator(r,n)}drawBreakIndicator(t,i){if(!this.columnGroup)return;const s=this.position.getColumnWidth(),h=this.dimensions.xPos-s/2,e=t-i/2,n=.35*i,r=s/3;let o=`M ${h} ${e-n}`;for(let t=0;t<3;t++)o+=` L ${h+r*(t+.5)} ${e-n-.3*i} L ${h+r*(t+1)} ${e-n}`;let l=`M ${h} ${e+n}`;for(let t=0;t<3;t++)l+=` L ${h+r*(t+.5)} ${e+n+.3*i} L ${h+r*(t+1)} ${e+n}`;this.columnGroup.rect(s+2,i).fill("#ffffff").stroke("none").y(t-i).cx(this.dimensions.xPos),this.columnGroup.path(o).fill("none").stroke({color:"#000000",width:1}),this.columnGroup.path(l).fill("none").stroke({color:"#000000",width:1})}createDimensions(t,i,s){const h=t.getScaledUnit();if(this.overflowConfig&&h>0){const e="ac"===t.getScenario()?this.overflowConfig.cutHeight:this.overflowConfig.cutHeight-this.overflowConfig.scenarioCutOffset;if(h>e){this.isOverflowing=!0;const{breakGap:t,overdriveZoneHeight:n,maxOverflow:r}=this.overflowConfig;this.overdriveHeight=r>0?(h-e)/r*n:0;const o=e+t+this.overdriveHeight,l=this.position.getColumnPositionY();return{clipped:!1,columnLength:e,xPos:this.position.getColumnPositionX(i,s),yPos:l-e,labelYPos:l-o-this.position.spacings.labelToColumn,scenarioLabelXPos:this.position.getColumnPositionX(i,s)+this.position.getScenarioLabelPositionOffsetX(s),scenarioLabelYPos:l-.5*e}}}return h<0?{clipped:!1,columnLength:Math.abs(h),xPos:this.position.getColumnPositionX(i,s),yPos:this.position.getColumnPositionY(),labelYPos:this.position.getColumnDataLabelPositionY(h),scenarioLabelXPos:this.position.getColumnPositionX(i,s)+this.position.getScenarioLabelPositionOffsetX(s),scenarioLabelYPos:this.position.getColumnPositionY()+.5*Math.abs(h)}:{clipped:!1,columnLength:h,xPos:this.position.getColumnPositionX(i,s),yPos:this.position.getColumnPositionY()-h,labelYPos:this.position.getColumnDataLabelPositionY(h),scenarioLabelXPos:this.position.getColumnPositionX(i,s)+this.position.getScenarioLabelPositionOffsetX(s),scenarioLabelYPos:this.position.getColumnPositionY()-.5*Math.abs(h)}}getDataLabel(t){let i=X.Bottom;null!=t.value&&t.value<0&&(i=X.Top);const s=this.isOverflowing?this.dimensions.labelYPos:this.position.getColumnDataLabelPositionY(this.dataPoint.getScaledUnit());return new I(this.scenarioGroup,this.position.getColumnCenterPositionX(this.index),s,this.ID_DATA_PREFIX,t.value,this.styles,i,X.Center)}getScenarioLabel(t){return new I(this.scenarioGroup,-1,-1,this.ID_SCENARIO_PREFIX,t,this.styles,X.Center,this.isPrimaryColumn?X.Left:X.Right)}convertToSVGStyle(t,i){return null==t&&(t=[]),t.color=t[i]||this.FALLBACK_COLOUR,Object.assign({},t)}drawScenarioLabel(){null==this.scenarioLabel||this.scenarioLabel.isEmpty()||this.isVarianceColumn||this.scenarioLabel.setPos(this.dimensions.scenarioLabelXPos,this.dimensions.scenarioLabelYPos).draw(!0)}drawColumnDataLabel(t,i=new A){var s;null===(s=this.label)||void 0===s||s.draw(this.isPrimaryColumn,t,i)}getFillStyle(t){var i,s,h,e;const n=this.columnBarStyles[this.dataPoint.getScenario()];return(null==n?void 0:n.fillpattern)&&(null===(i=this.styles.pattern.get(n.fillpattern))||void 0===i?void 0:i.pattern)?null===(e=null===(h=null===(s=this.styles)||void 0===s?void 0:s.pattern)||void 0===h?void 0:h.get(n.fillpattern))||void 0===e?void 0:e.pattern:this.convertToSVGStyle(t,"fill")}getScenarioStyle(){var t;return this.isVarianceColumn?null===(t=this.styles)||void 0===t?void 0:t.varianceStyles.getSVGStyle(this.dataPoint.getVarianceStyle()):this.columnBarStyles[this.dataPoint.getScenario()]}isEmpty(){return!1===this.hasData||Number.isNaN(this.dataPoint.value)}}class st{constructor(t,i,s,h,e,n,r,o,l){this.ID_DATA_PREFIX="DATA",this.ID_SCENARIO_PREFIX="SCENARIO",this.FALLBACK_COLOUR="#000000",this.scenarioLabel=null,this._defaultMarkerPattern=null,this.dimensions={columnLength:0,xPos:0,yPos:0,labelYPos:0,scenarioLabelXPos:0,scenarioLabelYPos:0,clipped:!1},this.hasData=!1,this.position=t,this.markerGroup=i||null,this.markerPattern=s||this._defaultMarkerPattern,this.styles=e,this.barStyles=e?e.barStyles:null,this.scenario=h,!0!==(null==n?void 0:n.isEmpty())&&(this.hasData=!0,this.dimensions=this.createMarkerDimensions(n,r,l),this.scenarioLabel=this.getScenarioLabel(o,e,l))}draw(){if(this.isEmpty())return this;const t=this.convertToSVGStyle(this.barStyles[this.getScenario()],"stroke");let i=this.convertToSVGStyle(this.barStyles[this.getScenario()],"fill");const s=this.barStyles[this.getScenario()];if(null!=s&&s.fillpattern){const t=this.styles.pattern.get(s.fillpattern);null!=t&&(i=t.pattern)}return this.markerGroup.polygon(this.markerPattern.background).fill("#ffffff").cy(this.dimensions.yPos-this.dimensions.columnLength).cx(this.dimensions.xPos),this.markerGroup.polygon(this.markerPattern.foreground).fill(i).stroke(t).cy(this.dimensions.yPos-this.dimensions.columnLength).cx(this.dimensions.xPos),null==this.scenarioLabel||this.scenarioLabel.isEmpty()||this.scenarioLabel.setPos(this.dimensions.scenarioLabelXPos,this.dimensions.scenarioLabelYPos).draw(),this}createMarkerDimensions(t,i,s){return t.getScaledUnit()<0?{clipped:!1,labelYPos:0,columnLength:t.getScaledUnit(),xPos:this.position.getMarkerPositionX(i,s),yPos:this.position.getMarkerPositionY(),scenarioLabelXPos:this.position.getMarkerPositionX(i,s)+this.position.getMarkerScenarioLabelPositionOffsetX(s),scenarioLabelYPos:this.position.getMarkerPositionY()+Math.abs(t.getScaledUnit())}:{clipped:!1,labelYPos:0,columnLength:t.getScaledUnit(),xPos:this.position.getMarkerPositionX(i,s),yPos:this.position.getMarkerPositionY(),scenarioLabelXPos:this.position.getMarkerPositionX(i,s)+this.position.getMarkerScenarioLabelPositionOffsetX(s),scenarioLabelYPos:this.position.getMarkerPositionY()-Math.abs(t.getScaledUnit())}}getScenarioLabel(t,i,s){return null==this.markerGroup?null:new I(this.markerGroup,-1,-1,this.ID_DATA_PREFIX,t,i,X.Center,s?X.Right:X.Left)}convertToSVGStyle(t,i){return null==t&&(t=[]),t.color=t[i]||this.FALLBACK_COLOUR,Object.assign({},t)}isEmpty(){return!1===this.hasData}getScenario(){var t;return null===(t=this.scenario)||void 0===t?void 0:t.slice(0,2)}}class ht{constructor(t,i,s,h,e){this.ID_DATA_PREFIX="DATA",this.ID_SCENARIO_PREFIX="SCENARIO",this.ID_RECT="RECT",this.FALLBACK_COLOUR="#000000",this.dataLabel=null,this.dimensions={columnLength:0,xPos:0,yPos:0,labelYPos:0,scenarioLabelXPos:0,scenarioLabelYPos:0,clipped:!1},this.hasData=!1,this.dataPoint=s,this.index=h,this.position=t,this.barStyles=i.barStyles,this.scenarioGroup=e,this.styles=i,this.barGroup=e.group().id(e.toString()+"_"+this.ID_RECT),!0!==(null==s?void 0:s.isEmpty())&&(this.hasData=!0,this.dimensions=this.createDimensions(t,s,h),this.dataLabel=new I(this.scenarioGroup,this.position.getColumnCenterPositionX(this.index),this.position.getNeedleDataLabelPositionY(this.dataPoint.getScaledPercentUnit()),this.ID_DATA_PREFIX,s.value,this.styles,X.Center,X.Center),this.dataLabel.setToRelativeVarianceLabel())}updateLabelGroup(t){var i;return this.isEmpty()||null===(i=this.dataLabel)||void 0===i||i.updateGroup(t),this}draw(){var t;if(this.isEmpty())return this;const i=this.styles.varianceStyles[this.dataPoint.getVarianceStyle()],s=this.convertToSVGStyle(i,"stroke");let h=this.convertToSVGStyle(i,"fill");const e=this.convertToSVGStyle(this.styles.varianceStyles.ac,"stroke"),n=this.convertToSVGStyle(this.styles.varianceStyles.ac,"fill"),r=this.barStyles[this.dataPoint.getScenario()];if(null!=r&&r.fillpattern){const t=this.styles.pattern.get(r.fillpattern);null!=t&&(h=t.pattern)}this.dimensions.clipped?this.createClippedNeedleHead(h,s):this.createNeedleHead(e,n),this.barGroup.rect(this.position.getNeedleWidth(),this.dimensions.columnLength).cx(this.dimensions.xPos).y(this.dimensions.yPos).fill(h).stroke(s),null===(t=this.dataLabel)||void 0===t||t.draw()}createDimensions(t,i,s){return i.getScaledPercentUnit()<0?{labelYPos:0,scenarioLabelXPos:0,scenarioLabelYPos:0,columnLength:Math.abs(i.getScaledPercentUnit()),xPos:t.getColumnCenterPositionX(s),yPos:t.getNeedlePositionY(),clipped:i.isClipped()}:{columnLength:i.getScaledPercentUnit(),xPos:t.getColumnCenterPositionX(s),yPos:t.getNeedlePositionY()-i.getScaledPercentUnit(),labelYPos:0,scenarioLabelXPos:0,scenarioLabelYPos:0,clipped:i.isClipped()}}convertToSVGStyle(t,i){return null==t&&(t=[]),t.color=t[i]||this.FALLBACK_COLOUR,Object.assign({},t)}createClippedNeedleHead(t,i){const s=this.barGroup.polygon("0,0 5,9 -5,9 0,0 0,5 5,13 -5,13 0,5").fill(t).cx(this.dimensions.xPos).cy(this.getHeadYPosition()).fill(t).stroke(i);null!=this.dataPoint.value&&this.dataPoint.value<0&&s.flip("y")}createNeedleHead(t,i){this.barGroup.rect(2*this.position.getNeedleWidth(),this.position.getNeedleHeadWidth()).cx(this.dimensions.xPos).cy(this.getHeadYPosition()).fill(t).stroke(i)}isEmpty(){return!1===this.hasData||Number.isNaN(this.dataPoint.value)}getHeadYPosition(){let t=this.dimensions.yPos;return null!=this.dataPoint.value&&this.dataPoint.value<0&&(t+=this.dimensions.columnLength),t}}const et={ac:{markerFill:"#000000",markerStroke:"#000000",lineColor:"#000000"},pp:{markerFill:"#999999",markerStroke:"#999999",lineColor:"#999999"},fc:{markerFill:"#ffffff",markerStroke:"#000000",lineColor:"#000000",lineDashArray:"4,4"},pl:{markerFill:"#ffffff",markerStroke:"#000000",lineColor:"#000000"}};class nt{constructor(t,i,s,h,e,n,r,o,l=null){this.MARKER_SIZE=8,this.LINE_WIDTH=2,this.ID_LINE_PREFIX="LINE",this.ID_MARKER_PREFIX="MARKER",this.ID_LABEL_PREFIX="LABEL",this.ESTIMATED_LABEL_WIDTH=56,this.ESTIMATED_LABEL_HEIGHT=24,this.position=t,this.styles=i,this.dataPoints=s,this.scenarioGroup=h,this.labelGroup=e,this.scenarioName=n,this.scenarioLabel=r,this.collisionManager=l}draw(t={percent:2,decimal:1},i=new A){return this.drawGeometry(),this.drawLabels(t,i),this}drawGeometry(){if(0===this.dataPoints.length)return this;const t=this.getLineStyle();return this.drawLines(t),this.drawMarkers(t),this}drawLabels(t={percent:2,decimal:1},i=new A){return 0===this.dataPoints.length||(this.drawScenarioLabel(),this.drawValueLabels(t,i)),this}getLineStyle(){var t,i;const s=(null===(i=null===(t=this.scenarioName)||void 0===t?void 0:t.slice(0,2))||void 0===i?void 0:i.toLowerCase())||"ac";return et[s]||et.ac}getScenarioVariant(){var t;const i=parseInt((null===(t=this.scenarioName)||void 0===t?void 0:t.slice(-1))||"1",10);return isNaN(i)?1:Math.min(Math.max(i,1),4)}drawSquareMarker(t,i,s,h){const e=this.MARKER_SIZE/2;t.rect(this.MARKER_SIZE,this.MARKER_SIZE).fill(h.markerFill).stroke({color:h.markerStroke,width:1}).move(i-e,s-e)}drawCircleMarker(t,i,s,h){t.circle(this.MARKER_SIZE).fill(h.markerFill).stroke({color:h.markerStroke,width:1}).center(i,s)}drawTriangleMarker(t,i,s,h){const e=this.MARKER_SIZE/2;t.polygon(`${i},${s-e} ${i-e},${s+e} ${i+e},${s+e}`).fill(h.markerFill).stroke({color:h.markerStroke,width:1})}drawDiamondMarker(t,i,s,h){const e=this.MARKER_SIZE/2;t.polygon(`${i},${s-e} ${i+e},${s} ${i},${s+e} ${i-e},${s}`).fill(h.markerFill).stroke({color:h.markerStroke,width:1})}drawLines(t){const i=this.scenarioGroup.group().id(this.ID_LINE_PREFIX);for(let s=1;s<this.dataPoints.length;s++){const h=this.dataPoints[s-1],e=this.dataPoints[s];if(h.dataPoint.isEmpty()||e.dataPoint.isEmpty())continue;const n=this.position.getColumnCenterPositionX(h.index),r=this.position.getColumnPositionY()-h.dataPoint.getScaledUnit(),o=this.position.getColumnCenterPositionX(e.index),l=this.position.getColumnPositionY()-e.dataPoint.getScaledUnit(),a=i.line([[n,r],[o,l]]).stroke({color:t.lineColor,width:this.LINE_WIDTH,linecap:"round"}).fill("none");t.lineDashArray&&a.attr("stroke-dasharray",t.lineDashArray)}}drawMarkers(t){const i=this.scenarioGroup.group().id(this.ID_MARKER_PREFIX),s=this.getScenarioVariant();for(const h of this.dataPoints){if(h.dataPoint.isEmpty())continue;const e=this.position.getColumnCenterPositionX(h.index),n=this.position.getColumnPositionY()-h.dataPoint.getScaledUnit();switch(s){case 2:this.drawCircleMarker(i,e,n,t);break;case 3:this.drawTriangleMarker(i,e,n,t);break;case 4:this.drawDiamondMarker(i,e,n,t);break;default:this.drawSquareMarker(i,e,n,t)}}}getLabelPositionPriority(t){const i=this.dataPoints[t];let s=null;for(let i=t+1;i<this.dataPoints.length;i++)if(!this.dataPoints[i].dataPoint.isEmpty()){s=this.dataPoints[i];break}let h=null;for(let i=t-1;i>=0;i--)if(!this.dataPoints[i].dataPoint.isEmpty()){h=this.dataPoints[i];break}const e=i.dataPoint.getScaledUnit();return h&&s&&h.dataPoint.getScaledUnit()>e&&s.dataPoint.getScaledUnit()>e?[G.Below,G.Left,G.Right,G.Above]:[G.Above,G.Left,G.Right,G.Below]}getScenarioType(){var t,i;return(null===(i=null===(t=this.scenarioName)||void 0===t?void 0:t.slice(0,2))||void 0===i?void 0:i.toLowerCase())||"ac"}drawValueLabels(t,i){const s=this.getScenarioType();for(let h=0;h<this.dataPoints.length;h++){const e=this.dataPoints[h];if(e.dataPoint.isEmpty()||null===e.dataPoint.value)continue;const n=this.position.getColumnCenterPositionX(e.index),r=this.position.getColumnPositionY()-e.dataPoint.getScaledUnit();let o=n,l=r-this.MARKER_SIZE/2-2,a=X.Bottom,c=X.Center;if(this.collisionManager){const t=this.getLabelPositionPriority(h),i=this.collisionManager.getOptimalPlacement(n,r,this.ESTIMATED_LABEL_WIDTH,this.ESTIMATED_LABEL_HEIGHT,e.index,this.MARKER_SIZE,s,t);if(null===i)continue;o=i.labelX,l=i.labelY,a=i.verticalHook,c=i.horizontalHook;const u=Object.assign(Object.assign({},i.bounds),{scenarioType:s});this.collisionManager.register(u)}new I(this.labelGroup,o,l,this.ID_LABEL_PREFIX,e.dataPoint.value,this.styles,a,c).draw(!0,t,i)}}drawScenarioLabel(){if(!this.scenarioLabel)return;let t=null;for(let i=this.dataPoints.length-1;i>=0;i--)if(!this.dataPoints[i].dataPoint.isEmpty()){t=this.dataPoints[i];break}if(!t)return;const i=this.position.getColumnCenterPositionX(t.index)+this.MARKER_SIZE+4,s=this.position.getColumnPositionY()-t.dataPoint.getScaledUnit(),h=this.getScenarioType();if(this.collisionManager){if(this.collisionManager.shouldHideScenarioLabel(i,s,h))return;this.collisionManager.registerScenarioLabel(i,s,h)}new I(this.labelGroup,i,s,"SCENARIO_LABEL",this.scenarioLabel,this.styles,X.Center,X.Left).forceStringTypeDraw()}}class rt{constructor(t,i,s,h,e,n,r,o,l,a,c){this.hasData=!1,this.position=t,this.styles=i,this.dataPoint=s,this.index=h,this.baselineValue=e,this.segmentIndex=r,this.stackMode=o,this.totalValue=l,this.group=c,this.columnGroup=c.group().id(`stacked_col_${h}_seg_${r}`),!0!==(null==s?void 0:s.isEmpty())&&null!=s.value&&(this.hasData=!0)}draw(t={percent:2,decimal:1},i=new A){if(!this.hasData||null==this.dataPoint.value)return;const s=this.dataPoint.value,h=this.dataPoint.pixelPerUnit;let e,n;const l=this.position.getColumnPositionY();if(this.stackMode===b.RELATIVE){const t=h;e=(0!==this.totalValue?Math.abs(s)/Math.abs(this.totalValue):0)*t,n=l-this.baselineValue/Math.abs(this.totalValue)*t-e}else e=Math.abs(s*h),n=l-this.baselineValue*h-e;const a=this.position.getColumnCenterPositionX(this.index),c=this.position.getColumnWidth(),u=r(this.segmentIndex),d={color:u},f={color:o(this.segmentIndex),width:.5};if(this.columnGroup.rect(c,Math.max(e,.5)).fill(d).stroke(f).y(n).cx(a),e>=18){const h=n+e/2;if(this.stackMode===b.RELATIVE||this.stackMode===b.ABSOLUTE_RELATIVE){const i=(0!==this.totalValue?s/this.totalValue*100:0).toFixed(t.percent)+"%";new I(this.group,a,h,"STACK_SEG",i,this.styles,X.Center,X.Center).setSegmentFill(u).forceStringTypeDraw()}else new I(this.group,a,h,"STACK_SEG",s,this.styles,X.Center,X.Center).setSegmentFill(u).draw(!0,t,i)}}drawTotalLabel(t={percent:2,decimal:1},i=new A){if(this.stackMode===b.RELATIVE)return;const s=this.position.getColumnCenterPositionX(this.index),h=this.position.getColumnPositionY();new I(this.group,s,h-this.totalValue*this.dataPoint.pixelPerUnit-this.position.spacings.labelToColumn,"STACK_TOTAL",this.totalValue,this.styles,X.Bottom,X.Center).draw(!0,t,i)}}const ot={ac:{fill:"#000000",opacity:.3,lineColor:"#000000"},pp:{fill:"#999999",opacity:.3,lineColor:"#999999"},fc:{fill:"#000000",opacity:.2,lineColor:"#000000",dashArray:"4,4"},pl:{fill:"#000000",opacity:.1,lineColor:"#000000"}},lt=[{fill:"#000000",opacity:.3},{fill:"#555555",opacity:.25},{fill:"#999999",opacity:.2},{fill:"#bbbbbb",opacity:.15},{fill:"#dddddd",opacity:.1}];class at{constructor(t,i,s,h,e,n){this.group=t.group().id(`area_fill_${e}`),this.upperPoints=i,this.lowerPoints=s,this.scenarioType=h,this.segmentIndex=e,this.isScenarioStack=n}draw(){if(this.upperPoints.length<2||this.lowerPoints.length<2)return;let t,i,s=`M ${this.upperPoints[0].x},${this.upperPoints[0].y}`;for(let t=1;t<this.upperPoints.length;t++)s+=` L ${this.upperPoints[t].x},${this.upperPoints[t].y}`;for(let t=this.lowerPoints.length-1;t>=0;t--)s+=` L ${this.lowerPoints[t].x},${this.lowerPoints[t].y}`;if(s+=" Z",this.isScenarioStack&&this.scenarioType){const s=this.scenarioType.slice(0,2).toLowerCase(),h=ot[s]||ot.ac;t=h.fill,i=h.opacity}else{const s=Math.min(this.segmentIndex,lt.length-1);t=lt[s].fill,i=lt[s].opacity}this.group.path(s).fill(t).opacity(i).stroke("none")}drawBoundaryLine(){if(this.upperPoints.length<2)return;let t,i="#000000";if(this.isScenarioStack&&this.scenarioType){const s=this.scenarioType.slice(0,2).toLowerCase(),h=ot[s]||ot.ac;i=h.lineColor,t=h.dashArray}const s=this.group.polyline(this.upperPoints.map((t=>[t.x,t.y]))).fill("none").stroke({color:i,width:1.5});t&&s.attr("stroke-dasharray",t)}}class ct{constructor(t,i,s,h,e,n,r,o){this.ID_DATA_PREFIX="DATA",this.ID_SCENARIO_PREFIX="SCENARIO",this.ID_RECT="RECT",this.FALLBACK_COLOUR="#000000",this.label=null,this.scenarioLabel=null,this.isVarianceLine=!1,this.dimensions={columnLength:0,xPos:0,yPos:0,labelYPos:0,scenarioLabelXPos:0,scenarioLabelYPos:0,clipped:!1},this.previousDimensions={columnLength:0,xPos:0,yPos:0,labelYPos:0,scenarioLabelXPos:0,scenarioLabelYPos:0,clipped:!1},this.hasData=!1,this.dataPoint=s,this.index=e,this.isPrimaryLine=n,this.position=t,this.LineBarStyles=i.barStyles,this.scenarioGroup=r,this.styles=i,this.LineGroup=r.group().id(r.toString()+"_"+this.ID_RECT),!0!==(null==s?void 0:s.isEmpty())&&(this.hasData=!0,this.dimensions=this.createDimensions(s,e,n),this.label=this.getDataLabel(s),this.scenarioLabel=this.getScenarioLabel(o)),this.previousDimensions=this.createDimensions(h,e-1,n)}setAsVariance(){var t;return this.isVarianceLine=!0,null===(t=this.label)||void 0===t||t.setToVarianceLabel(),this}updateLabelGroup(t){var i;return this.isEmpty()||null===(i=this.label)||void 0===i||i.updateGroup(t),this}draw(t={percent:2,decimal:1},i=new A){if(this.isEmpty())return this;const s=this.getScenarioStyle(),h=this.getFillStyle(s);null!=this.LineGroup&&this.LineGroup.line([[this.previousDimensions.xPos,this.previousDimensions.yPos],[this.dimensions.xPos,this.dimensions.yPos]]).fill(h).stroke({color:"#f06",width:3,linecap:"round"}),this.drawLineDataLabel(t,i),this.drawScenarioLabel()}createDimensions(t,i,s){return{clipped:!1,columnLength:t.getScaledUnit(),xPos:this.position.getColumnPositionX(i,s),yPos:this.position.getColumnPositionY()-t.getScaledUnit(),labelYPos:this.position.getColumnDataLabelPositionY(t.getScaledUnit()),scenarioLabelXPos:this.position.getColumnPositionX(i,s)+this.position.getScenarioLabelPositionOffsetX(s),scenarioLabelYPos:this.position.getColumnPositionY()-t.getScaledUnit()}}getDataLabel(t){let i=X.Bottom;return null!=t.value&&t.value<0&&(i=X.Top),new I(this.scenarioGroup,this.position.getColumnCenterPositionX(this.index),this.position.getColumnDataLabelPositionY(this.dataPoint.getScaledUnit()),this.ID_DATA_PREFIX,t.value,this.styles,i,X.Center)}getScenarioLabel(t){return new I(this.scenarioGroup,0,0,this.ID_SCENARIO_PREFIX,t,this.styles,X.Bottom,X.Left)}convertToSVGStyle(t,i){return null==t&&(t=[]),t.color=t[i]||this.FALLBACK_COLOUR,Object.assign({},t)}drawScenarioLabel(){null==this.scenarioLabel||this.scenarioLabel.isEmpty()||this.isVarianceLine||this.scenarioLabel.setPos(this.dimensions.scenarioLabelXPos,this.dimensions.scenarioLabelYPos).draw(!0)}drawLineDataLabel(t,i=new A){var s;null===(s=this.label)||void 0===s||s.draw(this.isPrimaryLine,t,i)}getFillStyle(t){var i,s,h,e;const n=this.LineBarStyles[this.dataPoint.getScenario()];return(null==n?void 0:n.fillpattern)&&(null===(i=this.styles.pattern.get(n.fillpattern))||void 0===i?void 0:i.pattern)?null===(e=null===(h=null===(s=this.styles)||void 0===s?void 0:s.pattern)||void 0===h?void 0:h.get(n.fillpattern))||void 0===e?void 0:e.pattern:this.convertToSVGStyle(t,"fill")}getScenarioStyle(){var t;return this.isVarianceLine?null===(t=this.styles)||void 0===t?void 0:t.varianceStyles.getSVGStyle(this.dataPoint.getVarianceStyle()):this.LineBarStyles[this.dataPoint.getScenario()]}isEmpty(){return!1===this.hasData||Number.isNaN(this.dataPoint.value)}}class ut{constructor(t,i,s,h,e){this.pixelPerUnit=1,this.collisionManager=null,this.overflowConfig=null,this.i18n=e;const n=i.group().id("Scenario1"),r=i.group().id("Scenario2").insertBefore(n);this.svgGroups={parent:i,scenario1:n,scenario2:r,scenario3:i.group().id("Scenario3"),scenario4:i.group().id("Scenario4"),scenario1Label:i.group().id("label")},this.styles=s,this.position=t,this.elementCnt=h}setOverflowConfig(t){this.overflowConfig=t}createLine(t,i,s,h){const e=this.svgGroups.scenario1.group().id(""+h),n=this.svgGroups.scenario1Label.group().id(""+h);let r=null;return this.isLastDataPoint(h-1)&&(r=t),new ct(this.position,this.styles,i,s,h,!1,e,r).updateLabelGroup(n)}createPrimaryBar(t,i){const s=this.svgGroups.scenario1.group().id(""+i),h=this.svgGroups.scenario1Label.group().id(""+i);let e=null;return this.isLastDataPoint(i)&&(e=`${this.i18n.get(t.scenario)||t.scenario}`),new it(this.position,this.styles,t,i,!0,s,e,this.overflowConfig).updateLabelGroup(h)}createVarianceBar(t,i){const s=this.svgGroups.scenario1.group().id(""+i),h=this.svgGroups.scenario1Label.group().id(""+i);let e=null;return this.isLastDataPoint(i)&&(e=`${this.i18n.get(t.scenario)||t.scenario}`),new it(this.position,this.styles,t,i,!0,s,e,this.overflowConfig).updateLabelGroup(h).setAsVariance()}createRelativeVarianceBar(t,i){const s=this.svgGroups.scenario1.group().id(""+i),h=this.svgGroups.scenario1Label.group().id(""+i);return new ht(this.position,this.styles,t,i,s).updateLabelGroup(h)}createSecondaryBar(t,i){const s=this.svgGroups.scenario2.group().id(""+i);let h=null;return this.isFirstDataPoint(i)&&(h=`${this.i18n.get(t.scenario)||t.scenario}`),new it(this.position,this.styles,t,i,!1,s,h,this.overflowConfig)}createPrimaryMarker(t,i){const s=this.svgGroups.scenario3.group().id(""+i),h=this.styles.pattern.get("marker-right")||{foreground:"#000000",background:"#ffffff",bgOffset:0};let e=null;return this.isFirstDataPoint(i)&&(e=`${this.i18n.get(t.scenario)||t.scenario}`),new st(this.position,s,h,t.scenario,this.styles,t,i,e,!0)}createSecondaryMarker(t,i){const s=this.svgGroups.scenario4.group().id(""+i),h=this.styles.pattern.get("marker-left")||{foreground:"#000000",background:"#ffffff",bgOffset:0};let e=null;return this.isLastDataPoint(i)&&(e=`${this.i18n.get(t.scenario)||t.scenario}`),new st(this.position,s,h,t.scenario,this.styles,t,i,e,!1)}isLastDataPoint(t){return this.elementCnt-1===t}isFirstDataPoint(t){return 0===t}setCollisionManager(t){this.collisionManager=t}moveLabelsToFront(){this.svgGroups.scenario1Label.front()}createLineSeries(t,i){const s=this.svgGroups.parent.group().id("LineSeries_"+i),h=this.svgGroups.scenario1Label.group().id("LineSeries_Label_"+i),e=`${this.i18n.get(i)||i}`;return new nt(this.position,this.styles,t,s,h,i,e,this.i18n,this.collisionManager)}}var dt,ft;!function(t){t[t.UP_TO_DATE=0]="UP_TO_DATE",t[t.DIRTY=1]="DIRTY"}(dt||(dt={})),function(t){t.RELATIVE="dr",t.ABSOLUTE="d",t.NONE=""}(ft||(ft={}));class pt{constructor(t,i,s,h=0){this.CSS_CATEGORIES="categories",this.dataModel=[],this.variancesDataModel=[],this.title="",this.smallestDataPointValue=new q(0,B.AC1,1,B.NEU),this.highestDataPointValue=new q(0,B.AC1,1,B.NEU),this.smallestVarianceDataPointValue=new q(0,B.AC1,1,B.NEU),this.highestVarianceDataPointValue=new q(0,B.AC1,1,B.NEU),this.pixelPerUnit=1,this.pixelPerPercentage=1,this.hideAxisLabels=!1,this.axisScenario=B.AC1,this.preparedDataSet=[],this.axisCategoryArea={width:0,height:0},this.scenariosArea={width:0,height:0},this.state=dt.DIRTY,this.i18n=new Map,this.leftSideOffsetForHorizontalSync=-1,this.dateInterval=$.DAY,this.locale="de",this.axisLabelsMode=g.SMART,this.intervalSpanLimit=32,this.measureScale=new A,this.measureUnit="",this.dataFormatDigits={percent:2,decimal:1},this.showOverlayMedian=!1,this.showOverlayAvg=!1,this.chartMode=m.BAR,this.maxBars=28,this.stackConfig=null,this.lineFullWidth=!0,this.availableWidth=0,this.overflowConfig=null,this.lastScenarios=[],this.initSQLFunctions(),this.ruleSet=t||new E,this.i18n=this.createI18n(new Map),this.styles=s,this.availableWidth=h,this.setConfig(i),this.position=this.createElementPosition(i.scenarios)}updatePosition(t){this.position=this.createElementPosition(t)}initSQLFunctions(){D.fn.transformOperator=function(t){return"-"===t?-1:1},D.fn.normalizeDate=function(t,i){if(void 0!==t&&t.isValid)return t.startOf(i)}}setStyles(t){this.styles=t}setAvailableWidth(t){this.availableWidth=t}setAvailableHeight(t){this.pixelPerUnit<=0||t<=0?this.overflowConfig=null:null==this.stackConfig&&this.determineEffectiveChartMode()===m.BAR?(this.overflowConfig=this.calculateOverflowConfig(t),this.overflowConfig&&this.updatePosition(this.lastScenarios)):this.overflowConfig=null}calculateOverflowConfig(t){const i=(this.isVarianceChart()?this.highestVarianceDataPointValue:this.highestDataPointValue).getScaledUnit();if(i<=0)return null;const s=this.styles.fontStyles.size,h=1.5*s,e=.3*s,n=t-(this.position.dataLabelHeight+this.position.spacings.labelToColumn+this.position.padding.top+this.position.padding.bottom+this.position.spacings.labelToAxis+s)-h-e,r=.8*s;if(n<=r)return null;const o=n-r;return i<=o?null:{cutHeight:n,overdriveZoneHeight:h,breakGap:e,maxOverflow:i-o,scenarioCutOffset:r}}setConfig(t){var i;this.state=dt.DIRTY,this.sortScenariosbyVisualisationRules(t),this.setData([...t.data],t.filter),this.hideAxisLabels=t.hideAxisLabels||!1,this.pixelPerUnit=t.pixelPerUnit,this.pixelPerPercentage=t.pixelPerPercentage,this.axisLabelsMode=t.axisLabelsMode,this.intervalSpanLimit=t.intervalSpanLimit,this.dateInterval=this.findDateInterval(t.dateInterval),this.dataModel=this.populateModel(t.scenarios,this.dateInterval,t.level,t.sortOrder),this.variancesDataModel=this.populateVarianceModel(t.variances,this.dataModel),this.title=t.title||C.translateScenarioLabel(null===(i=null==t?void 0:t.variances)||void 0===i?void 0:i.toString(),this.i18n),this.smallestDataPointValue=this.findSmallestDataPointValue(this.dataModel),this.smallestVarianceDataPointValue=this.findSmallestDataPointValue(this.variancesDataModel),this.highestDataPointValue=this.findHighestDataPointValue(this.dataModel),this.highestVarianceDataPointValue=this.findHighestDataPointValue(this.variancesDataModel),this.axisScenario=this.setAxisScenario(t.variances),this.leftSideOffsetForHorizontalSync=t.leftSideOffsetForHorizontalSync,this.measureScale=t.measureScale,this.measureUnit=t.measureUnit,this.dataFormatDigits=t.dataFormatDigits,this.showOverlayMedian=t.showOverlayMedian,this.showOverlayAvg=t.showOverlayAvg,this.chartMode=t.chartMode,this.maxBars=t.maxBars,this.stackConfig=t.stackConfig,this.lineFullWidth=t.lineFullWidth,this.lastScenarios=t.scenarios,this.updatePosition(t.scenarios)}getFooter(){return 1===this.measureScale.value&&""===this.measureUnit?" ":C.translateScenarioLabel("in",this.i18n)+" "+this.measureScale.prefix+this.measureUnit}sortScenariosbyVisualisationRules(t){const i=this;t.scenarios.sort(((t,s)=>i.ruleSet.getScenarioSorIndex(t)-i.ruleSet.getScenarioSorIndex(s))).reverse()}setI18n(t){this.i18n=this.createI18n(t)}setData(t,i){if(null!=t)if(this.state=dt.DIRTY,this.preparedDataSet.length=0,null!=i&&i.length>0)try{this.preparedDataSet=D(`SELECT * FROM ? WHERE ${i}`,[t])}catch(s){console.error("TimeChart: filter query failed, using unfiltered data",i,s),this.preparedDataSet=t}else this.preparedDataSet=t}getAllocatedCanvasWidth(){const t=this.position.getAxisEndPositionX(),i=3*this.styles.fontStyles.size,s=Math.max(this.axisCategoryArea.width,this.scenariosArea.width);return Math.max(t+i,s>0?s+this.position.leftSideLabelLength:0)}getAllocatedCanvasHeight(){if(null==this.smallestVarianceDataPointValue.value||null==this.highestVarianceDataPointValue.value||null==this.smallestDataPointValue.value||null==this.highestDataPointValue.value)return 0;const t=this.isVarianceChart()&&this.variancesDataModel.some((t=>t.type===ft.RELATIVE)),i=this.position.getAxisPositionY(t),s=this.position.spacings.labelToAxis+this.position.dataLabelHeight+this.styles.padding.bottom;let h;if(this.isOnSameAxisSide())h=i+s;else{const t=this.isVarianceChart()?this.smallestVarianceDataPointValue:this.smallestDataPointValue;h=i+Math.abs(t.getScaledUnit())+this.position.spacings.labelToColumn+this.position.dataLabelHeight+s}const e=this.isOnSameAxisSide();return Math.max(h,e?this.axisCategoryArea.height+this.scenariosArea.height:this.scenariosArea.height)}toString(){const t=new e;return this.draw(t),t.id("drawCanvas"),t.width(this.getAllocatedCanvasWidth()),t.height(this.getAllocatedCanvasHeight()),t.attr("overflow","visible"),t.svg()}draw(t){this.cleanSVGforRedraw(t),this.state===dt.DIRTY&&(this.state=dt.UP_TO_DATE),this.isVarianceChart()?(this.drawVarianceScenario(this.variancesDataModel,t),this.drawAxisAndLabels(this.variancesDataModel,t)):null!=this.stackConfig?this.determineEffectiveChartMode()===m.LINE?(this.drawStackedAreaScenarios(this.dataModel,t),this.drawAxisAndLabelsForLineChart(this.dataModel,t)):(this.drawStackedScenarios(this.dataModel,t),this.drawStackedHeaders(this.dataModel,t),this.drawAxisAndLabels(this.dataModel,t)):this.determineEffectiveChartMode()===m.LINE?(this.drawLineScenarios(this.dataModel,t),this.drawAxisAndLabelsForLineChart(this.dataModel,t)):(this.drawScenarios(this.dataModel,t),this.drawOverlayLayer(this.dataModel,t),this.drawAxisAndLabels(this.dataModel,t))}determineEffectiveChartMode(){return this.chartMode===m.LINE||this.chartMode===m.AUTO&&this.dataModel.length>this.maxBars?m.LINE:m.BAR}setPattern(t,i){this.styles.pattern.set(t,i)}hasNoData(){return 0===this.dataModel.length}isOnSameAxisSide(){return null!=this.smallestVarianceDataPointValue.value&&null!=this.highestVarianceDataPointValue.value&&null!=this.smallestDataPointValue.value&&null!=this.highestDataPointValue.value&&(this.isVarianceChart()?Math.sign(this.smallestVarianceDataPointValue.value)===Math.sign(this.highestVarianceDataPointValue.value)||0===this.smallestDataPointValue.value&&1===Math.sign(this.highestDataPointValue.value):Math.sign(this.smallestDataPointValue.value)===Math.sign(this.highestDataPointValue.value)||0===this.smallestDataPointValue.value&&1===Math.sign(this.highestDataPointValue.value))}createI18n(t){this.state=dt.DIRTY;const i=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"],["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 new Map([...i,...t])}createElementPosition(t){let i;const s=M(t.filter(((t,i)=>1===i||2===i)).map((t=>C.translateScenarioLabel(t,this.i18n))).reduce(((t,i)=>t.length<i.length?i:t),""),{font:this.styles.fontStyles.font,fontSize:this.styles.fontStyles.size+"px"}).width,h=this.calculateTitleLength(this.leftSideOffsetForHorizontalSync);let e,n;if(i=s>h?s:h,null!=this.position&&(i+=this.position.spacings.labelToColumn),this.leftSideOffsetForHorizontalSync>-1&&(i=this.leftSideOffsetForHorizontalSync),this.isVarianceChart()?(e=this.smallestVarianceDataPointValue,n=this.highestVarianceDataPointValue):(e=this.smallestDataPointValue,n=this.highestDataPointValue),this.overflowConfig){const{cutHeight:t,overdriveZoneHeight:i,breakGap:s}=this.overflowConfig;n=new q(t+i+s,n.scenario,1,n.variance)}let r=this.styles.scaleFactors;const o=this.determineEffectiveChartMode();if(this.lineFullWidth&&this.availableWidth>0&&this.dataModel.length>0&&!this.isVarianceChart()&&o===m.LINE){const t=this.styles.fontStyles.size,s=this.styles.padding,h=this.styles.scaleFactors,e=this.availableWidth-(s.left+s.right+t*h.scenarioOffset+i+t*h.columnWidth);if(e>0){const i=Math.max(e/this.dataModel.length/t,1.2*h.columnWidth),s=new N;Object.assign(s,h),s.categoryWidth=i,r=s}}return new H(new F(this.styles.padding),r,this.styles.fontStyles,e,n,this.dataModel.length,i)}calculateTitleLength(t){let i="_______";i.length<this.title.length&&(i=this.title);const s=M(i,{font:this.styles.fontStyles.font,fontSize:this.styles.fontStyles.size+"px"}).width;return s<t?t:s}setAxisScenario(t){let i=B.AC1;if(null!=t&&t.length>0){const s=new x(t.toString());s.isValid&&(i=s.delta)}return null===i&&(i=B.AC1),i}populateModel(t,i,s,h){var e;if(0===(null===(e=this.preparedDataSet)||void 0===e?void 0:e.length))return[];let n=this.queryDataSet(i,"","");return this.detectNaNCells(t,n),n=this.leftOuterJoinDates(n,i),this.createDataRows(n,t)}detectNaNCells(t,i){i.forEach((i=>(t.forEach((t=>{const s=new x(t);!0===s.isValid?0!==i[s.base+"_cnt"]&&0!==i[s.delta+"_cnt"]||(i[t]=Number.NaN):0===i[t+"_cnt"]&&(i[t]=Number.NaN)})),i)))}findDateInterval(t){var i,s,h;if(t!==$.AUTO)return t;const e=this.queryMinMaxDates();let n=$.DAY;return null!=(null===(i=e[0])||void 0===i?void 0:i.mindate)&&(n=(new _).calculateDistanceType(null===(s=e[0])||void 0===s?void 0:s.mindate,null===(h=e[0])||void 0===h?void 0:h.maxdate,this.intervalSpanLimit)),n}queryMinMaxDates(){var t,i,s,h;const e=D("SELECT MAX(date) as maxdate, MIN(date) as mindate FROM ?",[this.preparedDataSet]);return null!=(null===(t=e[0])||void 0===t?void 0:t.mindate)&&(e[0].mindate=v.fromMillis(null===(i=e[0])||void 0===i?void 0:i.mindate)),null!=(null===(s=e[0])||void 0===s?void 0:s.maxdate)&&(e[0].maxdate=v.fromMillis(null===(h=e[0])||void 0===h?void 0:h.maxdate)),e}queryDataSet(t,i,s){const h=`normalizeDate([date], '${t}' , '${this.locale}') as calcdate`;return D(`SELECT p.calcdate ${i},\n ${["ac1","ac2","ac3","ac4","pp1","pp2","pp3","pp4","fc1","fc2","fc3","fc4","pl1","pl2","pl3","pl4"].map((t=>`SUM(${t} * transformOperator(operation)) as ${t}, COUNT(ISNULL(${t})) as ${t}_cnt`)).join(",")} \n \n FROM (SELECT ${h} ${i},\n ac1,\n ac2,\n ac3,\n ac4,\n pp1,\n pp2,\n pp3,\n pp4,\n fc1,\n fc2,\n fc3,\n fc4,\n pl1,\n pl2,\n pl3,\n pl4\n FROM ?) as p\n GROUP BY calcdate ${s}\n ORDER BY calcdate asc`,[this.preparedDataSet])}createDataRows(t,i){const s=[];return t.forEach(((t,h)=>{s.push({id:h,category:t.category,type:ft.NONE,date:t.calcdate,scenario1:new q(t[i[0]],i[0],this.pixelPerUnit,B.NEU),scenario2:new q(t[i[1]],i[1],this.pixelPerUnit,B.NEU),scenario3:new q(t[i[2]],i[2],this.pixelPerUnit,B.NEU),scenario4:new q(t[i[3]],i[3],this.pixelPerUnit,B.NEU)})})),s}findSmallestDataPointValue(t){const i=this.isVarianceChart()?this.pixelPerPercentage:this.pixelPerUnit;let s=new q(0,"default",i,B.NEU);for(const i of t)for(const t of[i.scenario1,i.scenario2,i.scenario3,i.scenario4])t&&null!=t.value&&t.value<Number(s.value)&&(s=t);return s}findHighestDataPointValue(t){const i=this.isVarianceChart()?this.pixelPerPercentage:this.pixelPerUnit;let s=new q(0,"default",i,B.NEU);for(const i of t)for(const t of[i.scenario1,i.scenario2,i.scenario3,i.scenario4])null!=t&&t.value>Number(s.value)&&(s=t);return s}populateVarianceModel(t,i){const s=[];if(null==t||0===t.length)return s;let h=null;null!=i&&i.length>0&&(h=i[0]);for(const e in t){const n=new x(t[e]);if(n.isValid){const t=this.mapScenarios(n,h),e=n.direction,r="dr"===n.type?this.pixelPerPercentage:this.pixelPerUnit;for(const h in i)s.push({id:Number(h),category:i[h].category,type:"dr"===n.type?ft.RELATIVE:ft.ABSOLUTE,date:i[h].date,scenario1:new q(this.calculateVariance(n,i[h],t),n.delta,r,e),scenario2:new q(null,null,null,null),scenario3:new q(null,null,null,null),scenario4:new q(null,null,null,null)})}}return s}calculateVariance(t,i,s){const h=s.get(t.base),e=s.get(t.delta);return null==h||null==e||null==i[h].value||null==i[e].value?null:t.type===ft.RELATIVE?(i[h].value-i[e].value)/i[e].value:i[h].value-i[e].value}mapScenarios(t,i){const s=new Map;return null==i||["scenario1","scenario2","scenario3","scenario4"].forEach((h=>{i[h].scenario===t.delta?s.set(t.delta,h):i[h].scenario===t.base&&s.set(t.base,h)})),s}cleanSVGforRedraw(t){t.clear()}isVarianceChart(){return this.variancesDataModel&&this.variancesDataModel.length>0}createDateFactory(){return new _}drawAxisAndLabels(t,i){const s=this.createDateFactory(),h=i.group().id("AxisAndDateLables");let e=!1;if(!1===this.hideAxisLabels)t.forEach(((t,i)=>{let n=X.Top,r=this.position.spacings.labelToAxis;t.scenario1.value<0&&(n=X.Bottom,r*=-1),t.type===ft.RELATIVE&&(e=!0);let o=s.getDateString(t.date,this.dateInterval);this.axisLabelsMode===g.SMART?(o=s.getSmartDateString(t.date,this.dateInterval),0===i&&this.dateInterval!==$.YEAR&&(o=s.getShortDateString(t.date,this.dateInterval))):this.axisLabelsMode===g.SHORT&&(o=s.getShortDateString(t.date,this.dateInterval)),new I(h,this.position.getColumnCenterPositionX(i),this.position.getAxisPositionY(e)+r,"",o,this.styles,n,X.Center).forceStringTypeDraw()}));else{const i=null==t?void 0:t[0];i&&i.type===ft.RELATIVE&&(e=!0)}new tt({scenarioType:this.axisScenario,labelText:this.title,isRelative:e},this.position,h).draw(),this.axisCategoryArea={height:h.height(),width:h.width()}}drawScenarios(t,i){const s=i.group().id("Scenarios"),h=new ut(this.position,s,this.styles,t.length,this.i18n);h.setOverflowConfig(this.overflowConfig);let e=!1;t.forEach(((t,i)=>{h.createPrimaryBar(t.scenario1,i).draw(this.dataFormatDigits,this.measureScale),h.createSecondaryBar(t.scenario2,i).draw(),h.createPrimaryMarker(t.scenario3,i).draw(),h.createSecondaryMarker(t.scenario4,i).draw(),!1===t.scenario1.isEmpty()&&(e=!0)}));let n=0;!1===e&&(n=this.isOnSameAxisSide()?this.position.dataLabelHeight:2*this.position.dataLabelHeight),this.scenariosArea={height:s.height()+this.styles.padding.top+this.styles.padding.bottom+n,width:s.width()+this.position.spacings.columnWidth}}drawLineScenarios(t,i){var s,h;const e=i.group().id("LineScenarios"),n=new z,r=new ut(this.position,e,this.styles,t.length,this.i18n);r.setCollisionManager(n);const o=["ac1","pp1","fc1","pl1"],l=[[],[],[],[]];t.forEach(((t,i)=>{["scenario1","scenario2","scenario3","scenario4"].forEach(((s,h)=>{t[s]&&l[h].push({dataPoint:t[s],index:i})}))}));const a=[];for(let t=0;t<l.length;t++){const i=l[t];if(i.length>0&&i.some((t=>!t.dataPoint.isEmpty()))){const e=(null===(h=null===(s=i[0])||void 0===s?void 0:s.dataPoint)||void 0===h?void 0:h.scenario)||o[t],n=e.slice(0,2).toLowerCase();a.push({points:i,scenarioName:e,scenarioType:n})}}a.sort(((t,i)=>(W[i.scenarioType]||99)-(W[t.scenarioType]||99)));const c=[];for(const t of a){const i=r.createLineSeries(t.points,t.scenarioName);c.push({series:i,scenarioType:t.scenarioType})}for(const t of c)t.series.drawGeometry();r.moveLabelsToFront();const u=[...c].sort(((t,i)=>(W[t.scenarioType]||99)-(W[i.scenarioType]||99)));for(const t of u)t.series.drawLabels(this.dataFormatDigits,this.measureScale);const d=this.position.getColumnPositionY();this.scenariosArea={height:Math.max(e.height()+this.styles.padding.top,d)+this.styles.padding.bottom,width:e.width()+this.position.spacings.columnWidth}}drawAxisAndLabelsForLineChart(t,i){const s=this.createDateFactory(),h=i.group().id("AxisAndDateLabelsLine"),e=!1,n=t.length-1;!1===this.hideAxisLabels&&t.forEach(((i,r)=>{if(!this.shouldShowLineChartAxisLabel(t,r))return;let o,l=X.Top,a=this.position.spacings.labelToAxis;i.scenario1.value<0&&(l=X.Bottom,a*=-1),this.lineFullWidth&&this.availableWidth>0?this.axisLabelsMode===g.SMART?(o=s.getSmartDateString(i.date,this.dateInterval),0===r&&this.dateInterval!==$.YEAR&&(o=s.getShortDateString(i.date,this.dateInterval))):o=this.axisLabelsMode===g.SHORT?s.getShortDateString(i.date,this.dateInterval):s.getDateString(i.date,this.dateInterval):o=s.getShortDateString(i.date,this.dateInterval),new I(h,this.position.getColumnCenterPositionX(r),this.position.getAxisPositionY(e)+a,"",o,this.styles,l,X.Center).forceStringTypeDraw(),r>0&&r<n&&this.isYearChange(t,r)&&this.drawYearSeparatorLine(h,r,e)})),new tt({scenarioType:this.axisScenario,labelText:this.title,isRelative:e},this.position,h).draw(),this.axisCategoryArea={height:h.height(),width:h.width()}}shouldShowLineChartAxisLabel(t,i){return!!(this.lineFullWidth&&this.availableWidth>0)||(0===i||i===t.length-1||this.isYearChange(t,i))}isYearChange(t,i){var s,h;if(0===i)return!1;const e=null===(s=t[i])||void 0===s?void 0:s.date,n=null===(h=t[i-1])||void 0===h?void 0:h.date;return!(!e||!n)&&e.year!==n.year}drawYearSeparatorLine(t,i,s){const h=this.position.getColumnCenterPositionX(i)-this.position.spacings.columnWidth/2,e=this.position.columnValue.max.getScaledUnit()+this.position.dataLabelHeight,n=this.position.getAxisPositionY(s)-e,r=this.position.getAxisPositionY(s);t.line([[h,n],[h,r]]).stroke({color:"#999999",width:1,dasharray:"4,4"}).attr("stroke-dasharray","4,4")}drawVarianceScenario(t,i){const s=i.group().id("Scenarios"),h=new ut(this.position,s,this.styles,t.length,this.i18n);return h.setOverflowConfig(this.overflowConfig),t.forEach(((t,i)=>{t.type===ft.RELATIVE?h.createRelativeVarianceBar(t.scenario1,i).draw():h.createVarianceBar(t.scenario1,i).draw(this.dataFormatDigits,this.measureScale)})),this.scenariosArea={height:s.height()+this.styles.padding.top+this.styles.padding.bottom,width:s.width()+this.position.spacings.columnWidth},s}drawStackedScenarios(t,i){if(!this.stackConfig)return;const s=i.group().id("StackedScenarios"),h=this.stackConfig.by===L.SCENARIO;t.forEach(((t,i)=>{const e=["scenario1","scenario2","scenario3","scenario4"],n=[];if(h)for(const i of e){const s=t[i];s&&!s.isEmpty()&&null!=s.value&&n.push({value:s.value,scenario:s.scenario,dataPoint:s})}else{const i=t.scenario1;i&&!i.isEmpty()&&null!=i.value&&n.push({value:i.value,scenario:i.scenario,dataPoint:i})}if(0!==n.length)if((h?new Set(n.map((t=>l(t.scenario)))):new Set).size>1){const t=new Map;for(const i of n){const s=l(i.scenario);t.has(s)||t.set(s,[]),t.get(s).push(i)}const h=[];for(const i of a)t.has(i)&&(h.push({prefix:i,segments:t.get(i)}),t.delete(i));for(const[i,s]of t)h.push({prefix:i,segments:s});h.forEach(((t,e)=>{const n=t.segments.reduce(((t,i)=>t+Math.abs(i.value)),0),r=h.length-1-e;let o=0,l=null;t.segments.forEach((t=>{const h=new rt(this.position,this.styles,t.dataPoint,i,o,t.scenario,r,this.stackConfig.mode,n,!0,s);h.draw(this.dataFormatDigits,this.measureScale),o+=Math.abs(t.value),l=h})),l&&l.drawTotalLabel(this.dataFormatDigits,this.measureScale)}))}else{"asc"===this.stackConfig.order?n.sort(((t,i)=>t.value-i.value)):"desc"===this.stackConfig.order&&n.sort(((t,i)=>i.value-t.value));const t=n.reduce(((t,i)=>t+Math.abs(i.value)),0);let e=0,r=null;n.forEach(((n,o)=>{const l=new rt(this.position,this.styles,n.dataPoint,i,e,n.scenario,o,this.stackConfig.mode,t,h,s);l.draw(this.dataFormatDigits,this.measureScale),e+=Math.abs(n.value),r=l})),r&&r.drawTotalLabel(this.dataFormatDigits,this.measureScale)}})),this.scenariosArea={height:s.height()+this.styles.padding.top+this.styles.padding.bottom,width:s.width()+this.position.spacings.columnWidth}}drawStackedHeaders(t,i){if(!this.stackConfig||0===t.length)return;if(this.stackConfig.by!==L.SCENARIO)return;const s=i.group().id("StackedHeaders"),h=t[0],e=["scenario1","scenario2","scenario3","scenario4"],n=[];for(const t of e){const i=h[t];i&&!i.isEmpty()&&null!=i.value&&n.push({value:i.value,scenario:i.scenario,dataPoint:i})}if(0===n.length)return;const r=new Set(n.map((t=>l(t.scenario)))),o=this.position.getColumnPositionY(),c=this.position.getColumnCenterPositionX(0)-this.position.getColumnWidth()/2-this.position.spacings.labelToColumn;if(r.size>1){const t=new Map;for(const i of n){const s=l(i.scenario);t.has(s)||t.set(s,[]),t.get(s).push(i)}const i=[];for(const s of a)t.has(s)&&(i.push({prefix:s,segments:t.get(s)}),t.delete(s));for(const[s,h]of t)i.push({prefix:s,segments:h});i.forEach((t=>{const i=t.segments.reduce(((t,i)=>t+Math.abs(i.value)),0),h=t.segments[0].dataPoint.pixelPerUnit,e=o-(this.stackConfig.mode===b.RELATIVE?h:i*h)/2,n=this.i18n.get(t.prefix+"1")||t.prefix.toUpperCase();new I(s,c,e,"STACK_HEADER",n,this.styles,X.Center,X.Right).forceStringTypeDraw()}))}else{"asc"===this.stackConfig.order?n.sort(((t,i)=>t.value-i.value)):"desc"===this.stackConfig.order&&n.sort(((t,i)=>i.value-t.value));const t=n.reduce(((t,i)=>t+Math.abs(i.value)),0),i=n[0].dataPoint.pixelPerUnit;let h=0;n.forEach((e=>{let n;n=this.stackConfig.mode===b.RELATIVE?(0!==t?Math.abs(e.value)/t:0)*i:Math.abs(e.value*i);const r=o-h-n/2,l=this.i18n.get(e.scenario)||e.scenario;new I(s,c,r,"STACK_HEADER",l,this.styles,X.Center,X.Right).forceStringTypeDraw(),h+=n}))}}drawStackedAreaScenarios(t,i){if(!this.stackConfig)return;const s=i.group().id("StackedAreaScenarios"),h=this.stackConfig.by===L.SCENARIO,e=this.stackConfig.mode,n=["scenario1","scenario2","scenario3","scenario4"];if(0===(h?n.filter((i=>t.some((t=>t[i]&&!t[i].isEmpty())))).length:1))return;const r=[],o=[],l=[];for(const i of n)t.some((t=>t[i]&&!t[i].isEmpty()))&&l.push(i);for(let i=0;i<l.length;i++){const s=l[i],h=[];for(let n=0;n<t.length;n++){const o=t[n][s],a=o&&!o.isEmpty()&&null!=o.value?o.value:0,c=i>0?r[i-1][n]:0;if(e===b.RELATIVE){const i=l.reduce(((i,s)=>{const h=t[n][s];return i+(h&&!h.isEmpty()&&null!=h.value?Math.abs(h.value):0)}),0),s=0!==i?Math.abs(a)/i:0;h.push(c+s)}else h.push(c+a)}r.push(h);const n=t[0][s];o.push((null==n?void 0:n.scenario)||"ac1")}const a=this.position.getColumnPositionY(),c=this.pixelPerUnit,u=t=>t.map(((t,i)=>({x:this.position.getColumnCenterPositionX(i),y:a-t*c}))),d=t.map(((t,i)=>({x:this.position.getColumnCenterPositionX(i),y:a})));for(let t=0;t<r.length;t++){const i=u(r[t]),e=0===t?d:u(r[t-1]),n=new at(s,i,e,h?o[t]:null,t,h);n.draw(),n.drawBoundaryLine()}this.scenariosArea={height:s.height()+this.styles.padding.top+this.styles.padding.bottom,width:s.width()+this.position.spacings.columnWidth}}drawOverlayLayer(t,i){const s=i.group().id("Overlay"),h=new ut(this.position,s,this.styles,t.length,this.i18n);if(!0===this.showOverlayAvg){let i=null;const s=function(t){const i=t.reduce(((t,i)=>{var s;return t+((null===(s=i.scenario1)||void 0===s?void 0:s.value)||0)}),0),s=t.filter((t=>{var i;return void 0!==(null===(i=t.scenario1)||void 0===i?void 0:i.value)})).length,h=s>0?i/s:0,e=Object.assign(Object.assign({},t[0]),{scenario1:new q(h,t[0].scenario1.scenario,t[0].scenario1.pixelPerUnit,t[0].scenario1.variance)}),n=Object.assign(Object.assign({},t[t.length-1]),{scenario1:new q(h,t[t.length-1].scenario1.scenario,t[t.length-1].scenario1.pixelPerUnit,t[t.length-1].scenario1.variance)});return[e,...t.map((t=>Object.assign(Object.assign({},t),{scenario1:new q(h,t.scenario1.scenario,t.scenario1.pixelPerUnit,t.scenario1.variance)}))),n]}(t);s.forEach(((t,s)=>{null!=i&&h.createLine(`Ø ${this.i18n.get(t.scenario1.scenario)||t.scenario1.scenario}`,t.scenario1,i,s-1).draw(this.dataFormatDigits,this.measureScale),i=t.scenario1}))}if(!0===this.showOverlayMedian){let i=null;const s=function(t){const i=t.map((t=>{var i;return null===(i=t.scenario1)||void 0===i?void 0:i.value})).filter((t=>void 0!==t)).sort(((t,i)=>t-i)),s=i.length%2==0?(i[i.length/2-1]+i[i.length/2])/2:i[Math.floor(i.length/2)],h=Object.assign(Object.assign({},t[0]),{scenario1:new q(s,t[0].scenario1.scenario,t[0].scenario1.pixelPerUnit,t[0].scenario1.variance)}),e=Object.assign(Object.assign({},t[t.length-1]),{scenario1:new q(s,t[t.length-1].scenario1.scenario,t[t.length-1].scenario1.pixelPerUnit,t[t.length-1].scenario1.variance)});return[h,...t.map((t=>Object.assign(Object.assign({},t),{scenario1:new q(s,t.scenario1.scenario,t.scenario1.pixelPerUnit,t.scenario1.variance)}))),e]}(t);s.forEach(((t,s)=>{null!=i&&h.createLine(`Mdn ${this.i18n.get(t.scenario1.scenario)||t.scenario1.scenario}`,t.scenario1,i,s-1).draw(this.dataFormatDigits,this.measureScale),i=t.scenario1}))}}leftOuterJoinDates(t,i){const s=v.max(...t.map((function(t){return t.calcdate}))),h=v.min(...t.map((function(t){return t.calcdate}))),e=(new _).datesBetween(h,s,i,this.intervalSpanLimit),n=new Map;return e.forEach(((t,i)=>{n.set(t.toISO(),{id:i,calcdate:t,category:null,ac1:null,ac2:null,ac3:null,ac4:null,pp1:null,pp2:null,pp3:null,pp4:null,fc1:null,fc2:null,fc3:null,fc4:null,pl1:null,pl2:null,pl3:null,pl4:null,isEmpty:!0})})),t.forEach((t=>{const i=t.calcdate.toISO(),s=n.get(i);s&&s.isEmpty&&n.set(i,{id:s.id,calcdate:t.calcdate,category:t.category,ac1:t.ac1,ac2:t.ac2,ac3:t.ac3,ac4:t.ac4,pp1:t.pp1,pp2:t.pp2,pp3:t.pp3,pp4:t.pp4,fc1:t.fc1,fc2:t.fc2,fc3:t.fc3,fc4:t.fc4,pl1:t.pl1,pl2:t.pl2,pl3:t.pl3,pl4:t.pl4,isEmpty:!1})})),Array.from(n.values())}}class wt{constructor(t,i){this.data=t,this.scenarios=i,this.variances=[],this.title="",this.hideAxisLabels=!1,this.pixelPerUnit=10,this.pixelPerPercentage=50,this.limit=0,this.sortOrder=new S(new Y).default(),this.level=y.CATEGORY,this.leftSideOffsetForHorizontalSync=-1,this.dateInterval=$.AUTO,this.axisLabelsMode=g.SMART,this.intervalSpanLimit=28,this.filter="",this.measureScale=new A,this.measureUnit="",this.showMeasureScale=!0,this.dataFormatDigits={decimal:1,percent:2},this.showOverlayMedian=!0,this.showOverlayAvg=!0,this.chartMode=m.BAR,this.maxBars=28,this.stackConfig=null,this.lineFullWidth=!0}}class vt{constructor(t,i,s,h,e){this.dataRowAdapter=t,this.orderAdapter=i,this.stringAdapter=s,this.dataFormatDigitsAdapter=h,this.dataSet=e}adapt(t){const i=P.adaptArray(t.data,this.dataRowAdapter),s=P.adaptArray(t.scenarios,this.stringAdapter),h=new wt(i,s);return w.isArray(t.variances)&&(h.variances=P.adaptArray(t.variances,this.stringAdapter)),w.isString(t.title)&&(h.title=t.title),w.isBoolean(t.hideAxisLabels)&&(h.hideAxisLabels=t.hideAxisLabels),w.isNumber(t.pixelPerUnit)&&(h.pixelPerUnit=t.pixelPerUnit),w.isNumber(t.pixelPerPercentage)&&(h.pixelPerPercentage=t.pixelPerPercentage),w.isNumber(t.limit)&&(h.limit=t.limit),w.isExisting(t.sortOrder)&&(h.sortOrder=this.orderAdapter.adapt(t.sortOrder)),w.isExisting(t.level)&&(h.level=t.level),w.isExisting(t.dateInterval)&&(h.dateInterval=t.dateInterval),w.isExisting(t.axisLabelsMode)&&(h.axisLabelsMode=t.axisLabelsMode),w.isNumber(t.leftSideOffsetForHorizontalSync)&&(h.leftSideOffsetForHorizontalSync=t.leftSideOffsetForHorizontalSync),w.isNumber(t.intervalSpanLimit)&&(h.intervalSpanLimit=t.intervalSpanLimit),w.isString(t.filter)&&(h.filter=t.filter),w.isExisting(t.measureScale)&&(h.measureScale=O.calculateMeasureScale(this.dataSet,h.scenarios,t.measureScale)),w.isString(t.measureUnit)&&(h.measureUnit=t.measureUnit),w.isBoolean(t.showMeasureScale)&&(h.showMeasureScale=t.showMeasureScale),w.isExisting(t.dataFormatDigits)&&(h.dataFormatDigits=this.dataFormatDigitsAdapter.adapt(t.dataFormatDigits)),w.isBoolean(t.showOverlayAvg)&&(h.showOverlayAvg=t.showOverlayAvg),w.isBoolean(t.showOverlayMedian)&&(h.showOverlayMedian=t.showOverlayMedian),w.isExisting(t.chartMode)&&(h.chartMode=t.chartMode),w.isNumber(t.maxBars)&&(h.maxBars=t.maxBars),w.isExisting(t.stackConfig)&&(h.stackConfig=t.stackConfig),w.isBoolean(t.lineFullWidth)&&(h.lineFullWidth=t.lineFullWidth),h}default(){return new wt([],[])}}const bt=class{constructor(i){t(this,i),this.data=[],this.scenarios=[],this.variances=[],this.hideAxisLabels=!1,this.pixelPerUnit=2,this.pixelPerPercentage=50,this.limit=0,this.leftSideOffsetForHorizontalSync=-1,this.i18n=new Map,this.order={hierarchy:[],direction:k.ASC},this.level=y.CATEGORY,this.dateInterval=$.AUTO,this.intervalSpanLimit=28,this.axisLabelsMode=g.SMART,this.filter="",this.measureScale="_",this.measureUnit="",this.showMeasureScale=!0,this.showOverlayMedian=!1,this.showOverlayAvg=!1,this.chartMode=m.BAR,this.maxBars=28,this.stackConfig=null,this.lineFullWidth=!0,this.containerWidth=0,this.dataFormatDigits={percent:2,decimal:1},this.parentDimensions={width:0,height:0}}render(){var t,h,e;if(void 0===this.chart)return i(s,null);if(this.chart.hasNoData()){const t=this.i18n.get("NO_DATA")||"==No Data==";return i(s,null,i("p",{class:"warning"},t))}return i(s,null,i("div",{innerHTML:null===(t=this.pattern)||void 0===t?void 0:t.toString(),class:"hidePatternContainer"}),i("div",{class:this.showMeasureScale?"footer":"footer-hide"},null===(h=this.chart)||void 0===h?void 0:h.getFooter()),i("div",{innerHTML:null===(e=this.chart)||void 0===e?void 0:e.toString()}))}async componentWillLoad(){var t;const i=this.prepareConfig(),s=this.prepareStyle(),h=this.containerWidth||0;this.chart=new pt(new E,i,s,h),this.chart.setI18n(this.i18n),this.autoFitScaling(i,s),this.chart.setAvailableHeight((null===(t=this.parentDimensions)||void 0===t?void 0:t.height)||0),this.pattern=new V(this.chart.styles),this.chart.setPattern("fc",this.pattern.getFCPolygonPattern())}async componentWillUpdate(){var t;if(null==this.chart)return;const i=this.prepareConfig(),s=this.prepareStyle();this.chart.setI18n(this.i18n),this.chart.setStyles(s),this.chart.setAvailableWidth(this.containerWidth||0),this.chart.setConfig(i),this.autoFitScaling(i,s),this.chart.setAvailableHeight((null===(t=this.parentDimensions)||void 0===t?void 0:t.height)||0),this.pattern=new V(this.chart.styles),this.chart.setPattern("fc",this.pattern.getFCPolygonPattern())}autoFitScaling(t,i){var s;if(t.pixelPerUnit>0)return;const h=null===(s=this.parentDimensions)||void 0===s?void 0:s.height,e=this.containerWidth||0;if(!h||h<=0)return t.pixelPerUnit=1,this.chart=new pt(new E,t,i,e),void this.chart.setI18n(this.i18n);t.pixelPerUnit=1,this.chart=new pt(new E,t,i,e),this.chart.setI18n(this.i18n),this.chart.toString();const n=this.chart.getAllocatedCanvasHeight();n<=0||(t.pixelPerUnit=.9*h/n,this.chart=new pt(new E,t,i,e),this.chart.setI18n(this.i18n))}async componentWillRender(){}componentDidLoad(){}componentDidUpdate(){}prepareConfig(){return new vt(new Z,new S(new Y),new Y,new T,this.data).adapt({data:this.data,scenarios:this.scenarios,variances:this.variances,title:this.chartTitle,hideAxisLabels:this.hideAxisLabels,pixelPerUnit:this.pixelPerUnit,pixelPerPercentage:this.pixelPerPercentage,level:this.level,dateInterval:this.dateInterval,axisLabelsMode:this.axisLabelsMode,limit:this.limit,sortOrder:this.order,leftSideOffsetForHorizontalSync:this.leftSideOffsetForHorizontalSync,intervalSpanLimit:this.intervalSpanLimit,filter:this.filter,measureScale:this.measureScale,measureUnit:this.measureUnit,showMeasureScale:this.showMeasureScale,dataFormatDigits:this.dataFormatDigits,showOverlayMedian:this.showOverlayMedian,showOverlayAvg:this.showOverlayAvg,chartMode:this.chartMode,maxBars:this.maxBars,stackConfig:this.stackConfig,lineFullWidth:this.lineFullWidth})}prepareStyle(){return new Q(new R,new c,new u(new d),new f(new d),new p).adapt(this.styles)}get element(){return h(this)}};bt.style=':host{position:relative;display:inline-block}.categories{text-align:right;font-size:var(--bn-font-size, 1em);font-family:var(--bn-font-family, "Noto Sans", "Helvetica Neue", Helvetica, sans-serif);color:var(--bn-font-color, black)}.label-bg{fill:var(--bn-font-background, white);opacity:0.7}.label-text{text-align:right;font-size:var(--bn-font-size, 1em);font-family:var(--bn-font-family, "Noto Sans", "Helvetica Neue", Helvetica, sans-serif);color:var(--bn-font-color, black)}.axis-title{text-align:center;font-family:var(--bn-font-family, "Noto Sans", "Helvetica Neue", Helvetica, sans-serif);color:var(--bn-font-color, black)}.axis-default{stroke:black;stroke-width:0.1em}.axis-ac{stroke:black;stroke-width:0.1em}.axis-pp{stroke:grey;stroke-width:0.1em}.axis-fc{stroke:black;stroke-dasharray:2;stroke-width:0.1em}.axis-pl{stroke:white;stroke-width:0.1em;outline-offset:0em;outline:0.1em solid black}canvas{image-rendering:-moz-crisp-edges;image-rendering:-webkit-crisp-edges;image-rendering:pixelated;image-rendering:crisp-edges}.measure{font-weight:bold}span{display:inline-block}.hidePatternContainer{height:0;width:0}div{float:left}.hide{opacity:0}.footer{margin:0.2em;font-size:0.6em}.footer-hide{margin:0.2em;font-size:0.6em;opacity:0}';export{bt as ibcs_chart_time}
1
+ import{r as t,h as i,H as s,g as h}from"./p-JNHhIe7t.js";import{S as e,g as n,a as r,b as o,c as l,I as a,F as c,d as u,e as d,f,P as p}from"./p-C0yAPzJz.js";import{e as w,D as v,b,c as g,C as m,l as L,d as P,k as S,A as y,O as k}from"./p-sqjrku2z.js";import{C as M,F as C,V as x}from"./p-1jFf17Vj.js";import{S as A,D as O,b as T}from"./p-BL8gyUwE.js";import{a as $}from"./p-BYmPQYxx.js";import{D as _,b as D}from"./p-B4ySv9KQ.js";import{I as E,S as Y}from"./p-8tsCnxIz.js";import"./p-BFTU3MAI.js";class N{constructor(){this.scenarioOffset=.3,this.scenarioLabelToColumn=.3,this.labelToColumn=.3,this.labelToAxis=.3,this.needleWidth=.3,this.needleHeadWidth=.6,this.columnWidth=2,this.varianceAxisLineWidth=.3,this.axisLineWidth=.1,this.auxiliaryLineWidth=.1,this.scenarioLineWidth=.2,this.markerWidth=.7,this.markerOffset=0,this.categoryWidth=3,this.axisTickLength=.3}}class R{adapt(t){const i=new N;return w.isNumber(t.scenarioOffset)&&(i.scenarioOffset=t.scenarioOffset),w.isNumber(t.scenarioLabelToColumn)&&(i.scenarioLabelToColumn=t.scenarioLabelToColumn),w.isNumber(t.labelToColumn)&&(i.labelToColumn=t.labelToColumn),w.isNumber(t.labelToAxis)&&(i.labelToAxis=t.labelToAxis),w.isNumber(t.needleWidth)&&(i.needleWidth=t.needleWidth),w.isNumber(t.needleHeadWidth)&&(i.needleHeadWidth=t.needleHeadWidth),w.isNumber(t.columnWidth)&&(i.columnWidth=t.columnWidth),w.isNumber(t.varianceAxisLineWidth)&&(i.varianceAxisLineWidth=t.varianceAxisLineWidth),w.isNumber(t.axisLineWidth)&&(i.axisLineWidth=t.axisLineWidth),w.isNumber(t.auxiliaryLineWidth)&&(i.auxiliaryLineWidth=t.auxiliaryLineWidth),w.isNumber(t.scenarioLineWidth)&&(i.scenarioLineWidth=t.scenarioLineWidth),w.isNumber(t.markerWidth)&&(i.markerWidth=t.markerWidth),w.isNumber(t.markerOffset)&&(i.markerOffset=t.markerOffset),w.isNumber(t.categoryWidth)&&(i.categoryWidth=t.categoryWidth),w.isNumber(t.axisTickLength)&&(i.axisTickLength=t.axisTickLength),i}default(){return new N}}class H{constructor(t,i,s,h,e,n,r){this.categoryPosition={x:0,y:0},this.spacings=new N,this.categoriesBoxOffset={width:0,height:0},this.padding=t,this.scaleFactors=i,this.fontStlye=s,this.dataLabelHeight=this.caluculateDataLabelHeight(),this.axisPosition={x:0,y:0},this.columnValue={min:h,max:e},this.numberOfColumns=n,this.leftSideLabelLength=r,this.calculateSpacings(),this.calculateCategoryPosition(),this.calculateAxisPosition()}caluculateDataLabelHeight(){return 1.1*M("123456789",{font:this.fontStlye.font,fontSize:this.fontStlye.size+"px"}).height}getColumnCenterPositionX(t){return this.categoryPosition.y+this.spacings.scenarioOffset+t*this.spacings.categoryWidth+this.leftSideLabelLength+.5*this.spacings.columnWidth}getAxisPositionY(t){let i=this.columnValue.max.getScaledUnit();return t&&(i=this.columnValue.max.getScaledPercentUnit()+this.getNeedleWidth()),i+this.dataLabelHeight+this.spacings.labelToAxis+this.padding.top}getAxisPositionX(){return this.padding.left+this.leftSideLabelLength}getColumnPositionX(t,i){return i?this.getColumnCenterPositionX(t):this.getColumnCenterPositionX(t)-this.spacings.scenarioOffset}getColumnPositionY(){return this.columnValue.max.getScaledUnit()+this.dataLabelHeight+this.spacings.labelToColumn+this.padding.top}getNeedlePositionY(){return this.columnValue.max.getScaledPercentUnit()+this.dataLabelHeight+this.spacings.labelToColumn+this.getNeedleWidth()+this.padding.top}getMarkerPositionX(t,i){return i?this.getColumnCenterPositionX(t)-this.spacings.markerOffset-.5*this.getColumnWidth():this.getColumnCenterPositionX(t)+this.spacings.markerOffset+.5*this.getColumnWidth()}getMarkerPositionY(){return this.getColumnPositionY()}getAxisTitlePositionX(t){const i=t.width();return this.axisPosition.x-i}getAxisTitlePositionY(t,i){let s=this.columnValue.max.getScaledUnit();return i&&(s=this.columnValue.max.getScaledPercentUnit()),t?s+this.dataLabelHeight+this.spacings.labelToAxis:s}getColumnDataLabelPositionY(t){const i=this.spacings.labelToColumn;return t<0?this.getColumnPositionY()+Math.abs(t)+i:this.getColumnPositionY()-t-i}getNeedleDataLabelPositionY(t){const i=this.spacings.labelToColumn;return t<0?this.getNeedlePositionY()+Math.abs(t)+i+2*this.getNeedleWidth():this.getNeedlePositionY()-t-i-2*this.getNeedleWidth()}getAxisEndPositionX(){return this.getAxisPositionX()+(this.numberOfColumns+.5)*this.spacings.categoryWidth}getColumnWidth(){return this.spacings.columnWidth}getNeedleWidth(){return this.spacings.needleWidth}getNeedleHeadWidth(){return this.spacings.needleHeadWidth}getScenarioLabelPositionOffsetX(t){return t?.5*this.getColumnWidth()+this.spacings.scenarioLabelToColumn:-(.5*this.getColumnWidth()+this.spacings.scenarioLabelToColumn)}calculateSpacings(){this.spacings={scenarioOffset:this.fontStlye.size*this.scaleFactors.scenarioOffset,scenarioLabelToColumn:this.fontStlye.size*this.scaleFactors.scenarioLabelToColumn,markerOffset:this.fontStlye.size*this.scaleFactors.markerOffset,labelToColumn:this.fontStlye.size*this.scaleFactors.labelToColumn,labelToAxis:this.fontStlye.size*this.scaleFactors.labelToAxis,needleWidth:this.fontStlye.size*this.scaleFactors.needleWidth,needleHeadWidth:this.fontStlye.size*this.scaleFactors.needleHeadWidth,columnWidth:this.fontStlye.size*this.scaleFactors.columnWidth,varianceAxisLineWidth:this.fontStlye.size*this.scaleFactors.varianceAxisLineWidth,axisLineWidth:this.fontStlye.size*this.scaleFactors.axisLineWidth,auxiliaryLineWidth:this.fontStlye.size*this.scaleFactors.auxiliaryLineWidth,scenarioLineWidth:this.fontStlye.size*this.scaleFactors.scenarioLineWidth,markerWidth:this.fontStlye.size*this.scaleFactors.markerWidth,categoryWidth:this.fontStlye.size*this.scaleFactors.categoryWidth,axisTickLength:this.fontStlye.size*this.scaleFactors.axisTickLength}}calculateCategoryPosition(){this.categoryPosition={x:this.padding.left+.5*this.spacings.columnWidth,y:this.padding.top}}calculateAxisPosition(){this.axisPosition={x:this.getAxisPositionX(),y:this.getAxisPositionY(!1)}}getMarkerScenarioLabelPositionOffsetX(t){return t?this.spacings.labelToColumn-this.fontStlye.size:this.spacings.labelToColumn+.5*this.spacings.markerWidth}}class F{constructor(t){this.top=t.top,this.bottom=t.bottom,this.left=t.left,this.right=t.right}addBoxTopLeft(t){return this.top+=t.height|this.top,this.left+=t.width|this.top,this}}class j{constructor(t){const i=1*t,s=.7*t;this.bgOffset=(i-s)/2,this.markerUp={top:s/2+",0",left:"0,"+s,right:s+","+s},this.markerUpBackground={top:i/2+",0",left:"0,"+i,right:i+","+i},this.markerDown={bottom:s/2+","+s,left:"0,0",right:s+",0"},this.markerDownBackground={bottom:i/2+","+i,left:"0,0",right:i+",0"},this.markerRight={bottom:"0,"+s,top:"0,0",right:s+","+s/2},this.markerRightBackground={bottom:"0,"+i,top:"0,0",right:i+","+i/2},this.markerLeft={bottom:s+","+s,top:s+",0",left:"0,"+s/2},this.markerLeftBackground={bottom:i+","+i,top:i+",0",Left:"0,"+i/2}}upMarkerPatternStrings(){return{background:this.markerUpBackground.left+" "+this.markerUpBackground.right+" "+this.markerUpBackground.top+" "+this.markerUpBackground.left,foreground:this.markerUp.left+" "+this.markerUp.right+" "+this.markerUp.top+" "+this.markerUp.left,bgOffset:this.bgOffset}}downMarkerPatternStrings(){return{background:this.markerDownBackground.left+" "+this.markerDownBackground.right+" "+this.markerDownBackground.bottom+" "+this.markerDownBackground.left,foreground:this.markerDown.left+" "+this.markerDown.right+" "+this.markerDown.bottom+" "+this.markerDown.left,bgOffset:this.bgOffset}}rightMarkerPatternStrings(){return{background:this.markerRightBackground.top+" "+this.markerRightBackground.right+" "+this.markerRightBackground.bottom+" "+this.markerRightBackground.top,foreground:this.markerRight.top+" "+this.markerRight.right+" "+this.markerRight.bottom+" "+this.markerRight.top,bgOffset:this.bgOffset}}leftMarkerPatternStrings(){return{background:this.markerLeftBackground.top+" "+this.markerLeftBackground.Left+" "+this.markerLeftBackground.bottom+" "+this.markerLeftBackground.top,foreground:this.markerLeft.top+" "+this.markerLeft.left+" "+this.markerLeft.bottom+" "+this.markerLeft.top,bgOffset:this.bgOffset}}createPatternMapForStructureBar(){const t=new Map;return t.set("marker-up",this.upMarkerPatternStrings()),t.set("marker-down",this.downMarkerPatternStrings()),t.set("marker-right",this.rightMarkerPatternStrings()),t.set("marker-left",this.leftMarkerPatternStrings()),t}}class V{constructor(t){this.container=new e,this.pattern=this.createFCPattern(this.container.group(),t),this.styles=t;let i=10;null!=t&&null!=t.fontStyles&&t.fontStyles.size&&(i=t.fontStyles.size),this.bgOffset=(1*i-.7*i)/2}createFCPattern(t,i){const s=i;return t.pattern(10,10,(function(t){t.rect(10,10).fill(s.barStyles.fc.fill),t.line(0,5,5,0).stroke({width:s.barStyles.fc.width,color:s.barStyles.fc.stroke,linecap:"square"}),t.line(5,10,10,5).stroke({width:s.barStyles.fc.width,color:s.barStyles.fc.stroke,linecap:"square"})})).id("pattern-time-fc")}getFCPolygonPattern(){return{background:"",foreground:"",bgOffset:0,pattern:this.pattern}}toString(){return this.container.svg()}}var I;!function(t){t[t.Left=0]="Left",t[t.Center=1]="Center",t[t.Right=2]="Right",t[t.Top=3]="Top",t[t.Bottom=4]="Bottom"}(I||(I={}));class X{constructor(t,i,s,h,e,n,r,o){this.ID_SCENARIOLABEL="Label",this.CSS_CATEGORIES="categories",this.isRelativeLabel=!1,this.segmentFillColor=null,this.x=i,this.y=s,this.value=e,this.group=t.group().id(this.createElementID(t.toString(),h)),this.styles=n,this.isVarianceLabel=!1,this.verticalHookLocation=r||I.Top,this.horizontalHookLocation=o||I.Left}setToVarianceLabel(){return this.isVarianceLabel=!0,this}setToRelativeVarianceLabel(){return this.isVarianceLabel=!0,this.isRelativeLabel=!0,this}setSegmentFill(t){return this.segmentFillColor=t,this}updateGroup(t){return this.group=t,this}draw(t=!0,i={percent:2,decimal:1},s=new A){if(this.isEmpty())return this;const h=this.group;let e,n="";if(!1===Number.isNaN(Number(this.value))){let t="percent",h=i.percent,r=i.percent,o=1;!1===this.isRelativeLabel&&(h=i.decimal,r=i.decimal,o=s.value,t="decimal"),e=C.number(Number(this.value),t,h,r,o),this.isVarianceLabel&&Number(this.value)>=0&&(n="+")}else e=""+this.value;const r=this.drawLabel(h,n+e);return!1===t&&(r.addClass("hide"),h.addClass("hide")),this}isEmpty(){return null==this.value||""===this.value}setPos(t,i){return this.x=t,this.y=i,this}forceStringTypeDraw(){return this.drawLabel(this.group,""+this.value),this}drawLabel(t,i){const s=this.styles.fontStyles.background||"#ffffff";let h="start";const e=t.text(i);e.move(this.x,this.y);const r=e.bbox().w,o=e.bbox().h;let l=0,a=0;const c=e.x();let u=e.y();return this.horizontalHookLocation===I.Left?(h="left",l=e.x()):this.horizontalHookLocation===I.Center?(h="middle",l=e.x()-(r+2)/2):this.horizontalHookLocation===I.Right&&(h="end",l=e.x()-r),this.verticalHookLocation===I.Center?(u=e.y()-1.2*o/2,a=u+.2*o):this.verticalHookLocation===I.Top?(u-=o/4,a=u+.2*o):this.verticalHookLocation===I.Bottom&&(u-=o,a=u+.2*o),e.move(c,u),e.font({anchor:h}),null!=this.segmentFillColor?e.fill(n(this.segmentFillColor)):t.rect(r+2,.8*o).stroke(s).fill(s).opacity(.9).move(l-1,a).insertBefore(e),e}createElementID(t,i){return t+"_"+i+"_"+this.ID_SCENARIOLABEL}}const W={ac:1,pp:2,fc:3,pl:4};var B,G,z;!function(t){t[t.Above=0]="Above",t[t.Below=1]="Below",t[t.Left=2]="Left",t[t.Right=3]="Right"}(B||(B={}));class U{constructor(){this.labels=[],this.scenarioLabels=[]}clear(){this.labels=[],this.scenarioLabels=[]}register(t){this.labels.push(t)}hasCollision(t){return this.labels.some((i=>this.intersects(t,i)))}getOptimalPlacement(t,i,s,h,e,n,r,o){const l=W[r]||99,a=n/2;for(const n of o){const r=this.calculatePlacementForDirection(t,i,s,h,e,a,8,n);if(!this.hasCollision(r.bounds))return r}for(const n of o){const r=this.calculatePlacementForDirection(t,i,s,h,e,a,8,n);if(!this.collidesWithHigherPriority(r.bounds,l))return r}return null}calculatePlacementForDirection(t,i,s,h,e,n,r,o){let l,a,c,u,d,f;switch(o){case B.Above:l=t,a=i-n-r,c=I.Bottom,u=I.Center,d=t-s/2,f=i-n-r-h;break;case B.Below:l=t,a=i+n+r,c=I.Top,u=I.Center,d=t-s/2,f=i+n+r-h/4;break;case B.Left:l=t-n-r,a=i,c=I.Center,u=I.Right,d=t-n-r-s,f=i-.6*h;break;case B.Right:l=t+n+r,a=i,c=I.Center,u=I.Left,d=t+n+r,f=i-.6*h}return{labelX:l,labelY:a,verticalHook:c,horizontalHook:u,bounds:{x:d,y:f,width:s,height:h,pointIndex:e,preferredHook:c}}}collidesWithHigherPriority(t,i){return this.labels.some((s=>!!s.scenarioType&&((W[s.scenarioType]||99)<i&&this.intersects(t,s))))}shouldHideScenarioLabel(t,i,s,h=20){const e=W[s]||99;return!(e<=1)&&this.scenarioLabels.some((s=>{if((W[s.scenarioType]||99)>=e)return!1;const n=Math.abs(i-s.y),r=Math.abs(t-s.x);return n<h&&r<h}))}registerScenarioLabel(t,i,s){this.scenarioLabels.push({x:t,y:i,scenarioType:s})}intersects(t,i){return!(t.x+t.width<i.x||i.x+i.width<t.x||t.y+t.height<i.y||i.y+i.height<t.y)}getLabelCount(){return this.labels.length}}class q{constructor(t,i,s,h){this.value=t,this.scenario=i,this.pixelPerUnit=s||1,this.variance="neg"===h||h===G.NEG?G.NEG:"pos"===h||h===G.POS?G.POS:G.NEU}isEmpty(){return void 0===this.value||null==this.scenario}getScaledUnit(){return null==this.value?0:this.value*this.pixelPerUnit}getScaledPercentUnit(){return null==this.value?0:this.value>1.45?1.45*this.pixelPerUnit:this.value<-1.45?-1.45*this.pixelPerUnit:this.value*this.pixelPerUnit}getVarianceStyle(){return null==this.value||this.value>=0?this.variance:G.NEU===this.variance?G.NEU:G.POS===this.variance?G.NEG:G.POS}isClipped(){return null!=this.value&&Math.abs(this.value)>1.45}getClippedValue(){return 145}getScenario(){var t;return null===(t=this.scenario)||void 0===t?void 0:t.slice(0,2)}}class K{constructor(){this.operation="+"}addRowGroup(t,i){this.rowGroup=t,this.rowGroupIndex=i}addCategory(t,i){this.category=t,this.categoryIndex=i}addSubCategory(t,i){this.subCategory=t,this.subCategoryIndex=i}addColumnGroup(t,i){this.columnGroup=t,this.columnGroupIndex=i}addSubColumnGroup(t,i){this.columnSubGroup=t,this.columnSubGroupIndex=i}}class Z{constructor(){}adapt(t){const i=new K;return w.isString(t.date)&&(i.date=this.parseDateString(t.date)),w.isOperator(t.operation)&&(i.operation=t.operation),w.isNumber(t.rowGroupIndex)&&w.isString(t.rowGroup)&&i.addRowGroup(t.rowGroup,t.rowGroupIndex),w.isNumber(t.categoryIndex)&&w.isString(t.category)&&i.addCategory(t.category,t.categoryIndex),w.isNumber(t.subCategoryIndex)&&w.isString(t.subCategory)&&i.addSubCategory(t.subCategory,t.subCategoryIndex),w.isNumber(t.columnGroupIndex)&&w.isString(t.columnGroup)&&i.addColumnGroup(t.columnGroup,t.columnGroupIndex),w.isNumber(t.columnSubGroupIndex)&&w.isString(t.columnSubGroup)&&i.addSubColumnGroup(t.columnSubGroup,t.columnSubGroupIndex),this.setActualValues(t,i),this.setPlanValues(t,i),this.setPreviousPeriodValues(t,i),this.setForecastValues(t,i),i}parseDateString(t){const i=v.fromISO(t);if(i.isValid)return i;console.warn(`TimeChartDataRow: invalid date value '${t}' — skipping row`)}default(){return new K}setActualValues(t,i){w.isNumber(t.ac1)&&(i.ac1=t.ac1),w.isNumber(t.ac2)&&(i.ac2=t.ac2),w.isNumber(t.ac3)&&(i.ac3=t.ac3),w.isNumber(t.ac4)&&(i.ac4=t.ac4)}setPlanValues(t,i){w.isNumber(t.pl1)&&(i.pl1=t.pl1),w.isNumber(t.pl2)&&(i.pl2=t.pl2),w.isNumber(t.pl3)&&(i.pl3=t.pl3),w.isNumber(t.pl4)&&(i.pl4=t.pl4)}setPreviousPeriodValues(t,i){w.isNumber(t.pp1)&&(i.pp1=t.pp1),w.isNumber(t.pp2)&&(i.pp2=t.pp2),w.isNumber(t.pp3)&&(i.pp3=t.pp3),w.isNumber(t.pp4)&&(i.pp4=t.pp4)}setForecastValues(t,i){w.isNumber(t.fc1)&&(i.fc1=t.fc1),w.isNumber(t.fc2)&&(i.fc2=t.fc2),w.isNumber(t.fc3)&&(i.fc3=t.fc3),w.isNumber(t.fc4)&&(i.fc4=t.fc4)}}class J{constructor(t,i,s,h,e,n){this.scaleFactors=t,this.fontStyles=i,this.axisStyles=s,this.barStyles=h,this.varianceStyles=e,this.padding=n,this.pattern=new Map}}class Q{constructor(t,i,s,h,e){this.scaleFactorsStructureChartAdapter=t,this.fontStyleAdapter=i,this.svgStyleGroupAdapter=s,this.svgVariancesStyleGroupAdapter=h,this.paddingadapter=e}adapt(t){const i=new J(this.scaleFactorsStructureChartAdapter.default(),this.fontStyleAdapter.default(),this.svgStyleGroupAdapter.default(),this.svgStyleGroupAdapter.default(),this.svgVariancesStyleGroupAdapter.default(),this.paddingadapter.default());return w.isExisting(t)&&(w.isExisting(t.scaleFactors)&&(i.scaleFactors=this.scaleFactorsStructureChartAdapter.adapt(t.scaleFactors)),w.isExisting(t.fontStyles)&&(i.fontStyles=this.fontStyleAdapter.adapt(t.fontStyles)),w.isExisting(t.axisStyles)&&(i.axisStyles=this.svgStyleGroupAdapter.adapt(t.axisStyles)),w.isExisting(t.barStyles)&&(i.barStyles=this.svgStyleGroupAdapter.adapt(t.barStyles)),w.isExisting(t.varianceStyles)&&(i.varianceStyles=this.svgVariancesStyleGroupAdapter.adapt(t.varianceStyles)),w.isExisting(t.padding)&&(i.padding=this.paddingadapter.adapt(t.padding)),i.pattern=new j(i.fontStyles.size).createPatternMapForStructureBar()),i}default(){return new J(this.scaleFactorsStructureChartAdapter.default(),this.fontStyleAdapter.default(),this.svgStyleGroupAdapter.default(),this.svgStyleGroupAdapter.default(),this.svgVariancesStyleGroupAdapter.default(),this.paddingadapter.default())}}!function(t){t.AC1="ac1",t.PP1="pp1",t.FC1="fc1",t.PL1="pl1",t.AC2="ac2",t.PP2="pp2",t.FC2="fc2",t.PL2="pl2",t.AC3="ac3",t.PP3="pp3",t.FC3="fc3",t.PL3="pl3",t.AC4="ac4",t.PP4="pp4",t.FC4="fc4",t.PL4="pl4",t.POS="pos",t.NEG="neg",t.NEU="neu"}(G||(G={})),function(t){t.LIST="LIST",t.SUM="SUM",t.OPT="OPT"}(z||(z={}));class tt{constructor(t,i,s){this.ID_AXIS="axis",this.CSS_AXIS_TITLE="categories",this.scenarioType=t.scenarioType,this.labelText=t.labelText||null,this.isRelative=t.isRelative||!1,this.position=i,this.svgGroup=s.group().id(this.ID_AXIS)}drawAxisTitle(t,i){null==i&&(i=""),t.text(i).addClass(this.CSS_AXIS_TITLE).attr("text-anchor","middle").move(this.position.getAxisTitlePositionX(t),this.position.getAxisTitlePositionY(!0,this.isRelative))}draw(){return this.labelText&&this.drawAxisTitle(this.svgGroup,this.labelText),this.svgGroup.line(this.position.getAxisPositionX(),this.position.getAxisPositionY(this.isRelative),this.position.getAxisEndPositionX(),this.position.getAxisPositionY(this.isRelative)).addClass(this.ID_AXIS+"-"+this.convertScenarioType()),this}convertScenarioType(){return void 0===this.scenarioType||null==this.scenarioType?"default":`${this.scenarioType}`.slice(0,2)}}class it{constructor(t,i,s,h,e,n,r,o=null){this.ID_DATA_PREFIX="DATA",this.ID_SCENARIO_PREFIX="SCENARIO",this.ID_RECT="RECT",this.FALLBACK_COLOUR="#000000",this.label=null,this.scenarioLabel=null,this.isVarianceColumn=!1,this.overflowConfig=null,this.isOverflowing=!1,this.overdriveHeight=0,this.dimensions={columnLength:0,xPos:0,yPos:0,labelYPos:0,scenarioLabelXPos:0,scenarioLabelYPos:0,clipped:!1},this.hasData=!1,this.dataPoint=s,this.index=h,this.isPrimaryColumn=e,this.position=t,this.columnBarStyles=i.barStyles,this.overflowConfig=o,this.scenarioGroup=n,this.styles=i,this.columnGroup=n.group().id(n.toString()+"_"+this.ID_RECT),!0!==(null==s?void 0:s.isEmpty())&&(this.hasData=!0,this.dimensions=this.createDimensions(s,h,e),this.label=this.getDataLabel(s),this.scenarioLabel=this.getScenarioLabel(r))}setAsVariance(){var t;return this.isVarianceColumn=!0,null===(t=this.label)||void 0===t||t.setToVarianceLabel(),this}updateLabelGroup(t){var i;return this.isEmpty()||null===(i=this.label)||void 0===i||i.updateGroup(t),this}draw(t={percent:2,decimal:1},i=new A){if(this.isEmpty())return this;const s=this.getScenarioStyle(),h=this.convertToSVGStyle(s,"stroke"),e=this.getFillStyle(s);null!=this.columnGroup&&(this.isOverflowing&&this.overflowConfig?this.drawOverdriveBar(e,h):this.columnGroup.rect(this.position.getColumnWidth(),this.dimensions.columnLength).fill(e).stroke(h).y(this.dimensions.yPos).cx(this.dimensions.xPos)),this.drawColumnDataLabel(t,i),this.drawScenarioLabel()}drawOverdriveBar(t,i){if(!this.columnGroup||!this.overflowConfig)return;const s=this.position.getColumnPositionY(),h=this.position.getColumnWidth(),e=this.dimensions.columnLength,{breakGap:n}=this.overflowConfig,r=s-e;this.columnGroup.rect(h,e).fill(t).stroke(i).y(r).cx(this.dimensions.xPos);const o=r-n-this.overdriveHeight;this.columnGroup.rect(h,this.overdriveHeight).fill(t).stroke(i).y(o).cx(this.dimensions.xPos),this.drawBreakIndicator(r,n)}drawBreakIndicator(t,i){if(!this.columnGroup)return;const s=this.position.getColumnWidth(),h=this.dimensions.xPos-s/2,e=t-i/2,n=.35*i,r=s/3;let o=`M ${h} ${e-n}`;for(let t=0;t<3;t++)o+=` L ${h+r*(t+.5)} ${e-n-.3*i} L ${h+r*(t+1)} ${e-n}`;let l=`M ${h} ${e+n}`;for(let t=0;t<3;t++)l+=` L ${h+r*(t+.5)} ${e+n+.3*i} L ${h+r*(t+1)} ${e+n}`;this.columnGroup.rect(s+2,i).fill("#ffffff").stroke("none").y(t-i).cx(this.dimensions.xPos),this.columnGroup.path(o).fill("none").stroke({color:"#000000",width:1}),this.columnGroup.path(l).fill("none").stroke({color:"#000000",width:1})}createDimensions(t,i,s){const h=t.getScaledUnit();if(this.overflowConfig&&h>0){const e="ac"===t.getScenario()?this.overflowConfig.cutHeight:this.overflowConfig.cutHeight-this.overflowConfig.scenarioCutOffset;if(h>e){this.isOverflowing=!0;const{breakGap:t,overdriveZoneHeight:n,maxOverflow:r}=this.overflowConfig;this.overdriveHeight=r>0?(h-e)/r*n:0;const o=e+t+this.overdriveHeight,l=this.position.getColumnPositionY();return{clipped:!1,columnLength:e,xPos:this.position.getColumnPositionX(i,s),yPos:l-e,labelYPos:l-o-this.position.spacings.labelToColumn,scenarioLabelXPos:this.position.getColumnPositionX(i,s)+this.position.getScenarioLabelPositionOffsetX(s),scenarioLabelYPos:l-.5*e}}}return h<0?{clipped:!1,columnLength:Math.abs(h),xPos:this.position.getColumnPositionX(i,s),yPos:this.position.getColumnPositionY(),labelYPos:this.position.getColumnDataLabelPositionY(h),scenarioLabelXPos:this.position.getColumnPositionX(i,s)+this.position.getScenarioLabelPositionOffsetX(s),scenarioLabelYPos:this.position.getColumnPositionY()+.5*Math.abs(h)}:{clipped:!1,columnLength:h,xPos:this.position.getColumnPositionX(i,s),yPos:this.position.getColumnPositionY()-h,labelYPos:this.position.getColumnDataLabelPositionY(h),scenarioLabelXPos:this.position.getColumnPositionX(i,s)+this.position.getScenarioLabelPositionOffsetX(s),scenarioLabelYPos:this.position.getColumnPositionY()-.5*Math.abs(h)}}getDataLabel(t){let i=I.Bottom;null!=t.value&&t.value<0&&(i=I.Top);const s=this.isOverflowing?this.dimensions.labelYPos:this.position.getColumnDataLabelPositionY(this.dataPoint.getScaledUnit());return new X(this.scenarioGroup,this.position.getColumnCenterPositionX(this.index),s,this.ID_DATA_PREFIX,t.value,this.styles,i,I.Center)}getScenarioLabel(t){return new X(this.scenarioGroup,-1,-1,this.ID_SCENARIO_PREFIX,t,this.styles,I.Center,this.isPrimaryColumn?I.Left:I.Right)}convertToSVGStyle(t,i){return null==t&&(t=[]),t.color=t[i]||this.FALLBACK_COLOUR,Object.assign({},t)}drawScenarioLabel(){null==this.scenarioLabel||this.scenarioLabel.isEmpty()||this.isVarianceColumn||this.scenarioLabel.setPos(this.dimensions.scenarioLabelXPos,this.dimensions.scenarioLabelYPos).draw(!0)}drawColumnDataLabel(t,i=new A){var s;null===(s=this.label)||void 0===s||s.draw(this.isPrimaryColumn,t,i)}getFillStyle(t){var i,s,h,e;const n=this.columnBarStyles[this.dataPoint.getScenario()];return(null==n?void 0:n.fillpattern)&&(null===(i=this.styles.pattern.get(n.fillpattern))||void 0===i?void 0:i.pattern)?null===(e=null===(h=null===(s=this.styles)||void 0===s?void 0:s.pattern)||void 0===h?void 0:h.get(n.fillpattern))||void 0===e?void 0:e.pattern:this.convertToSVGStyle(t,"fill")}getScenarioStyle(){var t;return this.isVarianceColumn?null===(t=this.styles)||void 0===t?void 0:t.varianceStyles.getSVGStyle(this.dataPoint.getVarianceStyle()):this.columnBarStyles[this.dataPoint.getScenario()]}isEmpty(){return!1===this.hasData||Number.isNaN(this.dataPoint.value)}}class st{constructor(t,i,s,h,e,n,r,o,l){this.ID_DATA_PREFIX="DATA",this.ID_SCENARIO_PREFIX="SCENARIO",this.FALLBACK_COLOUR="#000000",this.scenarioLabel=null,this._defaultMarkerPattern=null,this.dimensions={columnLength:0,xPos:0,yPos:0,labelYPos:0,scenarioLabelXPos:0,scenarioLabelYPos:0,clipped:!1},this.hasData=!1,this.position=t,this.markerGroup=i||null,this.markerPattern=s||this._defaultMarkerPattern,this.styles=e,this.barStyles=e?e.barStyles:null,this.scenario=h,!0!==(null==n?void 0:n.isEmpty())&&(this.hasData=!0,this.dimensions=this.createMarkerDimensions(n,r,l),this.scenarioLabel=this.getScenarioLabel(o,e,l))}draw(){if(this.isEmpty())return this;const t=this.convertToSVGStyle(this.barStyles[this.getScenario()],"stroke");let i=this.convertToSVGStyle(this.barStyles[this.getScenario()],"fill");const s=this.barStyles[this.getScenario()];if(null!=s&&s.fillpattern){const t=this.styles.pattern.get(s.fillpattern);null!=t&&(i=t.pattern)}return this.markerGroup.polygon(this.markerPattern.background).fill("#ffffff").cy(this.dimensions.yPos-this.dimensions.columnLength).cx(this.dimensions.xPos),this.markerGroup.polygon(this.markerPattern.foreground).fill(i).stroke(t).cy(this.dimensions.yPos-this.dimensions.columnLength).cx(this.dimensions.xPos),null==this.scenarioLabel||this.scenarioLabel.isEmpty()||this.scenarioLabel.setPos(this.dimensions.scenarioLabelXPos,this.dimensions.scenarioLabelYPos).draw(),this}createMarkerDimensions(t,i,s){return t.getScaledUnit()<0?{clipped:!1,labelYPos:0,columnLength:t.getScaledUnit(),xPos:this.position.getMarkerPositionX(i,s),yPos:this.position.getMarkerPositionY(),scenarioLabelXPos:this.position.getMarkerPositionX(i,s)+this.position.getMarkerScenarioLabelPositionOffsetX(s),scenarioLabelYPos:this.position.getMarkerPositionY()+Math.abs(t.getScaledUnit())}:{clipped:!1,labelYPos:0,columnLength:t.getScaledUnit(),xPos:this.position.getMarkerPositionX(i,s),yPos:this.position.getMarkerPositionY(),scenarioLabelXPos:this.position.getMarkerPositionX(i,s)+this.position.getMarkerScenarioLabelPositionOffsetX(s),scenarioLabelYPos:this.position.getMarkerPositionY()-Math.abs(t.getScaledUnit())}}getScenarioLabel(t,i,s){return null==this.markerGroup?null:new X(this.markerGroup,-1,-1,this.ID_DATA_PREFIX,t,i,I.Center,s?I.Right:I.Left)}convertToSVGStyle(t,i){return null==t&&(t=[]),t.color=t[i]||this.FALLBACK_COLOUR,Object.assign({},t)}isEmpty(){return!1===this.hasData}getScenario(){var t;return null===(t=this.scenario)||void 0===t?void 0:t.slice(0,2)}}class ht{constructor(t,i,s,h,e){this.ID_DATA_PREFIX="DATA",this.ID_SCENARIO_PREFIX="SCENARIO",this.ID_RECT="RECT",this.FALLBACK_COLOUR="#000000",this.dataLabel=null,this.dimensions={columnLength:0,xPos:0,yPos:0,labelYPos:0,scenarioLabelXPos:0,scenarioLabelYPos:0,clipped:!1},this.hasData=!1,this.dataPoint=s,this.index=h,this.position=t,this.barStyles=i.barStyles,this.scenarioGroup=e,this.styles=i,this.barGroup=e.group().id(e.toString()+"_"+this.ID_RECT),!0!==(null==s?void 0:s.isEmpty())&&(this.hasData=!0,this.dimensions=this.createDimensions(t,s,h),this.dataLabel=new X(this.scenarioGroup,this.position.getColumnCenterPositionX(this.index),this.position.getNeedleDataLabelPositionY(this.dataPoint.getScaledPercentUnit()),this.ID_DATA_PREFIX,s.value,this.styles,I.Center,I.Center),this.dataLabel.setToRelativeVarianceLabel())}updateLabelGroup(t){var i;return this.isEmpty()||null===(i=this.dataLabel)||void 0===i||i.updateGroup(t),this}draw(){var t;if(this.isEmpty())return this;const i=this.styles.varianceStyles[this.dataPoint.getVarianceStyle()],s=this.convertToSVGStyle(i,"stroke");let h=this.convertToSVGStyle(i,"fill");const e=this.convertToSVGStyle(this.styles.varianceStyles.ac,"stroke"),n=this.convertToSVGStyle(this.styles.varianceStyles.ac,"fill"),r=this.barStyles[this.dataPoint.getScenario()];if(null!=r&&r.fillpattern){const t=this.styles.pattern.get(r.fillpattern);null!=t&&(h=t.pattern)}this.dimensions.clipped?this.createClippedNeedleHead(h,s):this.createNeedleHead(e,n),this.barGroup.rect(this.position.getNeedleWidth(),this.dimensions.columnLength).cx(this.dimensions.xPos).y(this.dimensions.yPos).fill(h).stroke(s),null===(t=this.dataLabel)||void 0===t||t.draw()}createDimensions(t,i,s){return i.getScaledPercentUnit()<0?{labelYPos:0,scenarioLabelXPos:0,scenarioLabelYPos:0,columnLength:Math.abs(i.getScaledPercentUnit()),xPos:t.getColumnCenterPositionX(s),yPos:t.getNeedlePositionY(),clipped:i.isClipped()}:{columnLength:i.getScaledPercentUnit(),xPos:t.getColumnCenterPositionX(s),yPos:t.getNeedlePositionY()-i.getScaledPercentUnit(),labelYPos:0,scenarioLabelXPos:0,scenarioLabelYPos:0,clipped:i.isClipped()}}convertToSVGStyle(t,i){return null==t&&(t=[]),t.color=t[i]||this.FALLBACK_COLOUR,Object.assign({},t)}createClippedNeedleHead(t,i){const s=this.barGroup.polygon("0,0 5,9 -5,9 0,0 0,5 5,13 -5,13 0,5").fill(t).cx(this.dimensions.xPos).cy(this.getHeadYPosition()).fill(t).stroke(i);null!=this.dataPoint.value&&this.dataPoint.value<0&&s.flip("y")}createNeedleHead(t,i){this.barGroup.rect(2*this.position.getNeedleWidth(),this.position.getNeedleHeadWidth()).cx(this.dimensions.xPos).cy(this.getHeadYPosition()).fill(t).stroke(i)}isEmpty(){return!1===this.hasData||Number.isNaN(this.dataPoint.value)}getHeadYPosition(){let t=this.dimensions.yPos;return null!=this.dataPoint.value&&this.dataPoint.value<0&&(t+=this.dimensions.columnLength),t}}const et={ac:{markerFill:"#000000",markerStroke:"#000000",lineColor:"#000000"},pp:{markerFill:"#999999",markerStroke:"#999999",lineColor:"#999999"},fc:{markerFill:"#ffffff",markerStroke:"#000000",lineColor:"#000000",lineDashArray:"4,4"},pl:{markerFill:"#ffffff",markerStroke:"#000000",lineColor:"#000000"}};class nt{constructor(t,i,s,h,e,n,r,o,l=null){this.MARKER_SIZE=8,this.LINE_WIDTH=2,this.ID_LINE_PREFIX="LINE",this.ID_MARKER_PREFIX="MARKER",this.ID_LABEL_PREFIX="LABEL",this.ESTIMATED_LABEL_WIDTH=56,this.ESTIMATED_LABEL_HEIGHT=24,this.position=t,this.styles=i,this.dataPoints=s,this.scenarioGroup=h,this.labelGroup=e,this.scenarioName=n,this.scenarioLabel=r,this.collisionManager=l}draw(t={percent:2,decimal:1},i=new A){return this.drawGeometry(),this.drawLabels(t,i),this}drawGeometry(){if(0===this.dataPoints.length)return this;const t=this.getLineStyle();return this.drawLines(t),this.drawMarkers(t),this}drawLabels(t={percent:2,decimal:1},i=new A){return 0===this.dataPoints.length||(this.drawScenarioLabel(),this.drawValueLabels(t,i)),this}getLineStyle(){var t,i;const s=(null===(i=null===(t=this.scenarioName)||void 0===t?void 0:t.slice(0,2))||void 0===i?void 0:i.toLowerCase())||"ac";return et[s]||et.ac}getScenarioVariant(){var t;const i=parseInt((null===(t=this.scenarioName)||void 0===t?void 0:t.slice(-1))||"1",10);return isNaN(i)?1:Math.min(Math.max(i,1),4)}drawSquareMarker(t,i,s,h){const e=this.MARKER_SIZE/2;t.rect(this.MARKER_SIZE,this.MARKER_SIZE).fill(h.markerFill).stroke({color:h.markerStroke,width:1}).move(i-e,s-e)}drawCircleMarker(t,i,s,h){t.circle(this.MARKER_SIZE).fill(h.markerFill).stroke({color:h.markerStroke,width:1}).center(i,s)}drawTriangleMarker(t,i,s,h){const e=this.MARKER_SIZE/2;t.polygon(`${i},${s-e} ${i-e},${s+e} ${i+e},${s+e}`).fill(h.markerFill).stroke({color:h.markerStroke,width:1})}drawDiamondMarker(t,i,s,h){const e=this.MARKER_SIZE/2;t.polygon(`${i},${s-e} ${i+e},${s} ${i},${s+e} ${i-e},${s}`).fill(h.markerFill).stroke({color:h.markerStroke,width:1})}drawLines(t){const i=this.scenarioGroup.group().id(this.ID_LINE_PREFIX);for(let s=1;s<this.dataPoints.length;s++){const h=this.dataPoints[s-1],e=this.dataPoints[s];if(h.dataPoint.isEmpty()||e.dataPoint.isEmpty())continue;const n=this.position.getColumnCenterPositionX(h.index),r=this.position.getColumnPositionY()-h.dataPoint.getScaledUnit(),o=this.position.getColumnCenterPositionX(e.index),l=this.position.getColumnPositionY()-e.dataPoint.getScaledUnit(),a=i.line([[n,r],[o,l]]).stroke({color:t.lineColor,width:this.LINE_WIDTH,linecap:"round"}).fill("none");t.lineDashArray&&a.attr("stroke-dasharray",t.lineDashArray)}}drawMarkers(t){const i=this.scenarioGroup.group().id(this.ID_MARKER_PREFIX),s=this.getScenarioVariant();for(const h of this.dataPoints){if(h.dataPoint.isEmpty())continue;const e=this.position.getColumnCenterPositionX(h.index),n=this.position.getColumnPositionY()-h.dataPoint.getScaledUnit();switch(s){case 2:this.drawCircleMarker(i,e,n,t);break;case 3:this.drawTriangleMarker(i,e,n,t);break;case 4:this.drawDiamondMarker(i,e,n,t);break;default:this.drawSquareMarker(i,e,n,t)}}}getLabelPositionPriority(t){const i=this.dataPoints[t];let s=null;for(let i=t+1;i<this.dataPoints.length;i++)if(!this.dataPoints[i].dataPoint.isEmpty()){s=this.dataPoints[i];break}let h=null;for(let i=t-1;i>=0;i--)if(!this.dataPoints[i].dataPoint.isEmpty()){h=this.dataPoints[i];break}const e=i.dataPoint.getScaledUnit();return h&&s&&h.dataPoint.getScaledUnit()>e&&s.dataPoint.getScaledUnit()>e?[B.Below,B.Left,B.Right,B.Above]:[B.Above,B.Left,B.Right,B.Below]}getScenarioType(){var t,i;return(null===(i=null===(t=this.scenarioName)||void 0===t?void 0:t.slice(0,2))||void 0===i?void 0:i.toLowerCase())||"ac"}drawValueLabels(t,i){const s=this.getScenarioType();for(let h=0;h<this.dataPoints.length;h++){const e=this.dataPoints[h];if(e.dataPoint.isEmpty()||null===e.dataPoint.value)continue;const n=this.position.getColumnCenterPositionX(e.index),r=this.position.getColumnPositionY()-e.dataPoint.getScaledUnit();let o=n,l=r-this.MARKER_SIZE/2-2,a=I.Bottom,c=I.Center;if(this.collisionManager){const t=this.getLabelPositionPriority(h),i=this.collisionManager.getOptimalPlacement(n,r,this.ESTIMATED_LABEL_WIDTH,this.ESTIMATED_LABEL_HEIGHT,e.index,this.MARKER_SIZE,s,t);if(null===i)continue;o=i.labelX,l=i.labelY,a=i.verticalHook,c=i.horizontalHook;const u=Object.assign(Object.assign({},i.bounds),{scenarioType:s});this.collisionManager.register(u)}new X(this.labelGroup,o,l,this.ID_LABEL_PREFIX,e.dataPoint.value,this.styles,a,c).draw(!0,t,i)}}drawScenarioLabel(){if(!this.scenarioLabel)return;let t=null;for(let i=this.dataPoints.length-1;i>=0;i--)if(!this.dataPoints[i].dataPoint.isEmpty()){t=this.dataPoints[i];break}if(!t)return;const i=this.position.getColumnCenterPositionX(t.index)+this.MARKER_SIZE+4,s=this.position.getColumnPositionY()-t.dataPoint.getScaledUnit(),h=this.getScenarioType();if(this.collisionManager){if(this.collisionManager.shouldHideScenarioLabel(i,s,h))return;this.collisionManager.registerScenarioLabel(i,s,h)}new X(this.labelGroup,i,s,"SCENARIO_LABEL",this.scenarioLabel,this.styles,I.Center,I.Left).forceStringTypeDraw()}}class rt{constructor(t,i,s,h,e,n,r,o,l,a,c){this.hasData=!1,this.position=t,this.styles=i,this.dataPoint=s,this.index=h,this.baselineValue=e,this.segmentIndex=r,this.stackMode=o,this.totalValue=l,this.group=c,this.columnGroup=c.group().id(`stacked_col_${h}_seg_${r}`),!0!==(null==s?void 0:s.isEmpty())&&null!=s.value&&(this.hasData=!0)}draw(t={percent:2,decimal:1},i=new A){if(!this.hasData||null==this.dataPoint.value)return;const s=this.dataPoint.value,h=this.dataPoint.pixelPerUnit;let e,n;const l=this.position.getColumnPositionY();if(this.stackMode===b.RELATIVE){const t=h;e=(0!==this.totalValue?Math.abs(s)/Math.abs(this.totalValue):0)*t,n=l-this.baselineValue/Math.abs(this.totalValue)*t-e}else e=Math.abs(s*h),n=l-this.baselineValue*h-e;const a=this.position.getColumnCenterPositionX(this.index),c=this.position.getColumnWidth(),u=r(this.segmentIndex),d={color:u},f={color:o(this.segmentIndex),width:.5};if(this.columnGroup.rect(c,Math.max(e,.5)).fill(d).stroke(f).y(n).cx(a),e>=18){const h=n+e/2;if(this.stackMode===b.RELATIVE||this.stackMode===b.ABSOLUTE_RELATIVE){const i=(0!==this.totalValue?s/this.totalValue*100:0).toFixed(t.percent)+"%";new X(this.group,a,h,"STACK_SEG",i,this.styles,I.Center,I.Center).setSegmentFill(u).forceStringTypeDraw()}else new X(this.group,a,h,"STACK_SEG",s,this.styles,I.Center,I.Center).setSegmentFill(u).draw(!0,t,i)}}drawTotalLabel(t={percent:2,decimal:1},i=new A){if(this.stackMode===b.RELATIVE)return;const s=this.position.getColumnCenterPositionX(this.index),h=this.position.getColumnPositionY();new X(this.group,s,h-this.totalValue*this.dataPoint.pixelPerUnit-this.position.spacings.labelToColumn,"STACK_TOTAL",this.totalValue,this.styles,I.Bottom,I.Center).draw(!0,t,i)}}const ot={ac:{fill:"#000000",opacity:.3,lineColor:"#000000"},pp:{fill:"#999999",opacity:.3,lineColor:"#999999"},fc:{fill:"#000000",opacity:.2,lineColor:"#000000",dashArray:"4,4"},pl:{fill:"#000000",opacity:.1,lineColor:"#000000"}},lt=[{fill:"#000000",opacity:.3},{fill:"#555555",opacity:.25},{fill:"#999999",opacity:.2},{fill:"#bbbbbb",opacity:.15},{fill:"#dddddd",opacity:.1}];class at{constructor(t,i,s,h,e,n){this.group=t.group().id(`area_fill_${e}`),this.upperPoints=i,this.lowerPoints=s,this.scenarioType=h,this.segmentIndex=e,this.isScenarioStack=n}draw(){if(this.upperPoints.length<2||this.lowerPoints.length<2)return;let t,i,s=`M ${this.upperPoints[0].x},${this.upperPoints[0].y}`;for(let t=1;t<this.upperPoints.length;t++)s+=` L ${this.upperPoints[t].x},${this.upperPoints[t].y}`;for(let t=this.lowerPoints.length-1;t>=0;t--)s+=` L ${this.lowerPoints[t].x},${this.lowerPoints[t].y}`;if(s+=" Z",this.isScenarioStack&&this.scenarioType){const s=this.scenarioType.slice(0,2).toLowerCase(),h=ot[s]||ot.ac;t=h.fill,i=h.opacity}else{const s=Math.min(this.segmentIndex,lt.length-1);t=lt[s].fill,i=lt[s].opacity}this.group.path(s).fill(t).opacity(i).stroke("none")}drawBoundaryLine(){if(this.upperPoints.length<2)return;let t,i="#000000";if(this.isScenarioStack&&this.scenarioType){const s=this.scenarioType.slice(0,2).toLowerCase(),h=ot[s]||ot.ac;i=h.lineColor,t=h.dashArray}const s=this.group.polyline(this.upperPoints.map((t=>[t.x,t.y]))).fill("none").stroke({color:i,width:1.5});t&&s.attr("stroke-dasharray",t)}}class ct{constructor(t,i,s,h,e,n,r,o){this.ID_DATA_PREFIX="DATA",this.ID_SCENARIO_PREFIX="SCENARIO",this.ID_RECT="RECT",this.FALLBACK_COLOUR="#000000",this.label=null,this.scenarioLabel=null,this.isVarianceLine=!1,this.dimensions={columnLength:0,xPos:0,yPos:0,labelYPos:0,scenarioLabelXPos:0,scenarioLabelYPos:0,clipped:!1},this.previousDimensions={columnLength:0,xPos:0,yPos:0,labelYPos:0,scenarioLabelXPos:0,scenarioLabelYPos:0,clipped:!1},this.hasData=!1,this.dataPoint=s,this.index=e,this.isPrimaryLine=n,this.position=t,this.LineBarStyles=i.barStyles,this.scenarioGroup=r,this.styles=i,this.LineGroup=r.group().id(r.toString()+"_"+this.ID_RECT),!0!==(null==s?void 0:s.isEmpty())&&(this.hasData=!0,this.dimensions=this.createDimensions(s,e,n),this.label=this.getDataLabel(s),this.scenarioLabel=this.getScenarioLabel(o)),this.previousDimensions=this.createDimensions(h,e-1,n)}setAsVariance(){var t;return this.isVarianceLine=!0,null===(t=this.label)||void 0===t||t.setToVarianceLabel(),this}updateLabelGroup(t){var i;return this.isEmpty()||null===(i=this.label)||void 0===i||i.updateGroup(t),this}draw(t={percent:2,decimal:1},i=new A){if(this.isEmpty())return this;const s=this.getScenarioStyle(),h=this.getFillStyle(s);null!=this.LineGroup&&this.LineGroup.line([[this.previousDimensions.xPos,this.previousDimensions.yPos],[this.dimensions.xPos,this.dimensions.yPos]]).fill(h).stroke({color:"#f06",width:3,linecap:"round"}),this.drawLineDataLabel(t,i),this.drawScenarioLabel()}createDimensions(t,i,s){return{clipped:!1,columnLength:t.getScaledUnit(),xPos:this.position.getColumnPositionX(i,s),yPos:this.position.getColumnPositionY()-t.getScaledUnit(),labelYPos:this.position.getColumnDataLabelPositionY(t.getScaledUnit()),scenarioLabelXPos:this.position.getColumnPositionX(i,s)+this.position.getScenarioLabelPositionOffsetX(s),scenarioLabelYPos:this.position.getColumnPositionY()-t.getScaledUnit()}}getDataLabel(t){let i=I.Bottom;return null!=t.value&&t.value<0&&(i=I.Top),new X(this.scenarioGroup,this.position.getColumnCenterPositionX(this.index),this.position.getColumnDataLabelPositionY(this.dataPoint.getScaledUnit()),this.ID_DATA_PREFIX,t.value,this.styles,i,I.Center)}getScenarioLabel(t){return new X(this.scenarioGroup,0,0,this.ID_SCENARIO_PREFIX,t,this.styles,I.Bottom,I.Left)}convertToSVGStyle(t,i){return null==t&&(t=[]),t.color=t[i]||this.FALLBACK_COLOUR,Object.assign({},t)}drawScenarioLabel(){null==this.scenarioLabel||this.scenarioLabel.isEmpty()||this.isVarianceLine||this.scenarioLabel.setPos(this.dimensions.scenarioLabelXPos,this.dimensions.scenarioLabelYPos).draw(!0)}drawLineDataLabel(t,i=new A){var s;null===(s=this.label)||void 0===s||s.draw(this.isPrimaryLine,t,i)}getFillStyle(t){var i,s,h,e;const n=this.LineBarStyles[this.dataPoint.getScenario()];return(null==n?void 0:n.fillpattern)&&(null===(i=this.styles.pattern.get(n.fillpattern))||void 0===i?void 0:i.pattern)?null===(e=null===(h=null===(s=this.styles)||void 0===s?void 0:s.pattern)||void 0===h?void 0:h.get(n.fillpattern))||void 0===e?void 0:e.pattern:this.convertToSVGStyle(t,"fill")}getScenarioStyle(){var t;return this.isVarianceLine?null===(t=this.styles)||void 0===t?void 0:t.varianceStyles.getSVGStyle(this.dataPoint.getVarianceStyle()):this.LineBarStyles[this.dataPoint.getScenario()]}isEmpty(){return!1===this.hasData||Number.isNaN(this.dataPoint.value)}}class ut{constructor(t,i,s,h,e){this.pixelPerUnit=1,this.collisionManager=null,this.overflowConfig=null,this.i18n=e;const n=i.group().id("Scenario1"),r=i.group().id("Scenario2").insertBefore(n);this.svgGroups={parent:i,scenario1:n,scenario2:r,scenario3:i.group().id("Scenario3"),scenario4:i.group().id("Scenario4"),scenario1Label:i.group().id("label")},this.styles=s,this.position=t,this.elementCnt=h}setOverflowConfig(t){this.overflowConfig=t}createLine(t,i,s,h){const e=this.svgGroups.scenario1.group().id(""+h),n=this.svgGroups.scenario1Label.group().id(""+h);let r=null;return this.isLastDataPoint(h-1)&&(r=t),new ct(this.position,this.styles,i,s,h,!1,e,r).updateLabelGroup(n)}createPrimaryBar(t,i){const s=this.svgGroups.scenario1.group().id(""+i),h=this.svgGroups.scenario1Label.group().id(""+i);let e=null;return this.isLastDataPoint(i)&&(e=`${this.i18n.get(t.scenario)||t.scenario}`),new it(this.position,this.styles,t,i,!0,s,e,this.overflowConfig).updateLabelGroup(h)}createVarianceBar(t,i){const s=this.svgGroups.scenario1.group().id(""+i),h=this.svgGroups.scenario1Label.group().id(""+i);let e=null;return this.isLastDataPoint(i)&&(e=`${this.i18n.get(t.scenario)||t.scenario}`),new it(this.position,this.styles,t,i,!0,s,e,this.overflowConfig).updateLabelGroup(h).setAsVariance()}createRelativeVarianceBar(t,i){const s=this.svgGroups.scenario1.group().id(""+i),h=this.svgGroups.scenario1Label.group().id(""+i);return new ht(this.position,this.styles,t,i,s).updateLabelGroup(h)}createSecondaryBar(t,i){const s=this.svgGroups.scenario2.group().id(""+i);let h=null;return this.isFirstDataPoint(i)&&(h=`${this.i18n.get(t.scenario)||t.scenario}`),new it(this.position,this.styles,t,i,!1,s,h,this.overflowConfig)}createPrimaryMarker(t,i){const s=this.svgGroups.scenario3.group().id(""+i),h=this.styles.pattern.get("marker-right")||{foreground:"#000000",background:"#ffffff",bgOffset:0};let e=null;return this.isFirstDataPoint(i)&&(e=`${this.i18n.get(t.scenario)||t.scenario}`),new st(this.position,s,h,t.scenario,this.styles,t,i,e,!0)}createSecondaryMarker(t,i){const s=this.svgGroups.scenario4.group().id(""+i),h=this.styles.pattern.get("marker-left")||{foreground:"#000000",background:"#ffffff",bgOffset:0};let e=null;return this.isLastDataPoint(i)&&(e=`${this.i18n.get(t.scenario)||t.scenario}`),new st(this.position,s,h,t.scenario,this.styles,t,i,e,!1)}isLastDataPoint(t){return this.elementCnt-1===t}isFirstDataPoint(t){return 0===t}setCollisionManager(t){this.collisionManager=t}moveLabelsToFront(){this.svgGroups.scenario1Label.front()}createLineSeries(t,i){const s=this.svgGroups.parent.group().id("LineSeries_"+i),h=this.svgGroups.scenario1Label.group().id("LineSeries_Label_"+i),e=`${this.i18n.get(i)||i}`;return new nt(this.position,this.styles,t,s,h,i,e,this.i18n,this.collisionManager)}}var dt,ft;!function(t){t[t.UP_TO_DATE=0]="UP_TO_DATE",t[t.DIRTY=1]="DIRTY"}(dt||(dt={})),function(t){t.RELATIVE="dr",t.ABSOLUTE="d",t.NONE=""}(ft||(ft={}));class pt{constructor(t,i,s,h=0){this.CSS_CATEGORIES="categories",this.dataModel=[],this.variancesDataModel=[],this.title="",this.smallestDataPointValue=new q(0,G.AC1,1,G.NEU),this.highestDataPointValue=new q(0,G.AC1,1,G.NEU),this.smallestVarianceDataPointValue=new q(0,G.AC1,1,G.NEU),this.highestVarianceDataPointValue=new q(0,G.AC1,1,G.NEU),this.pixelPerUnit=1,this.pixelPerPercentage=1,this.hideAxisLabels=!1,this.axisScenario=G.AC1,this.preparedDataSet=[],this.axisCategoryArea={width:0,height:0},this.scenariosArea={width:0,height:0},this.state=dt.DIRTY,this.i18n=new Map,this.leftSideOffsetForHorizontalSync=-1,this.dateInterval=_.DAY,this.locale="de",this.axisLabelsMode=g.SMART,this.intervalSpanLimit=32,this.measureScale=new A,this.measureUnit="",this.dataFormatDigits={percent:2,decimal:1},this.showOverlayMedian=!1,this.showOverlayAvg=!1,this.chartMode=m.BAR,this.maxBars=28,this.stackConfig=null,this.lineFullWidth=!0,this.availableWidth=0,this.overflowConfig=null,this.lastScenarios=[],this.initSQLFunctions(),this.ruleSet=t||new E,this.i18n=this.createI18n(new Map),this.styles=s,this.availableWidth=h,this.setConfig(i),this.position=this.createElementPosition(i.scenarios)}updatePosition(t){this.position=this.createElementPosition(t)}initSQLFunctions(){$.fn.transformOperator=function(t){return"-"===t?-1:1},$.fn.normalizeDate=function(t,i){if(void 0!==t&&t.isValid)return t.startOf(i)}}setStyles(t){this.styles=t}setAvailableWidth(t){this.availableWidth=t}setAvailableHeight(t){this.pixelPerUnit<=0||t<=0?this.overflowConfig=null:null==this.stackConfig&&this.determineEffectiveChartMode()===m.BAR?(this.overflowConfig=this.calculateOverflowConfig(t),this.overflowConfig&&this.updatePosition(this.lastScenarios)):this.overflowConfig=null}calculateOverflowConfig(t){const i=(this.isVarianceChart()?this.highestVarianceDataPointValue:this.highestDataPointValue).getScaledUnit();if(i<=0)return null;const s=this.styles.fontStyles.size,h=1.5*s,e=.3*s,n=t-(this.position.dataLabelHeight+this.position.spacings.labelToColumn+this.position.padding.top+this.position.padding.bottom+this.position.spacings.labelToAxis+s)-h-e,r=.8*s;if(n<=r)return null;const o=n-r;return i<=o?null:{cutHeight:n,overdriveZoneHeight:h,breakGap:e,maxOverflow:i-o,scenarioCutOffset:r}}setConfig(t){var i;this.state=dt.DIRTY,this.sortScenariosbyVisualisationRules(t),this.setData([...t.data],t.filter),this.hideAxisLabels=t.hideAxisLabels||!1,this.pixelPerUnit=t.pixelPerUnit,this.pixelPerPercentage=t.pixelPerPercentage,this.axisLabelsMode=t.axisLabelsMode,this.intervalSpanLimit=t.intervalSpanLimit,this.dateInterval=this.findDateInterval(t.dateInterval),this.dataModel=this.populateModel(t.scenarios,this.dateInterval,t.level,t.sortOrder),this.variancesDataModel=this.populateVarianceModel(t.variances,this.dataModel),this.title=t.title||C.translateScenarioLabel(null===(i=null==t?void 0:t.variances)||void 0===i?void 0:i.toString(),this.i18n),this.smallestDataPointValue=this.findSmallestDataPointValue(this.dataModel),this.smallestVarianceDataPointValue=this.findSmallestDataPointValue(this.variancesDataModel),this.highestDataPointValue=this.findHighestDataPointValue(this.dataModel),this.highestVarianceDataPointValue=this.findHighestDataPointValue(this.variancesDataModel),this.axisScenario=this.setAxisScenario(t.variances),this.leftSideOffsetForHorizontalSync=t.leftSideOffsetForHorizontalSync,this.measureScale=t.measureScale,this.measureUnit=t.measureUnit,this.dataFormatDigits=t.dataFormatDigits,this.showOverlayMedian=t.showOverlayMedian,this.showOverlayAvg=t.showOverlayAvg,this.chartMode=t.chartMode,this.maxBars=t.maxBars,this.stackConfig=t.stackConfig,this.lineFullWidth=t.lineFullWidth,this.lastScenarios=t.scenarios,this.updatePosition(t.scenarios)}getFooter(){return 1===this.measureScale.value&&""===this.measureUnit?" ":C.translateScenarioLabel("in",this.i18n)+" "+this.measureScale.prefix+this.measureUnit}sortScenariosbyVisualisationRules(t){const i=this;t.scenarios.sort(((t,s)=>i.ruleSet.getScenarioSorIndex(t)-i.ruleSet.getScenarioSorIndex(s))).reverse()}setI18n(t){this.i18n=this.createI18n(t)}setData(t,i){if(null!=t)if(this.state=dt.DIRTY,this.preparedDataSet.length=0,null!=i&&i.length>0)try{this.preparedDataSet=$(`SELECT * FROM ? WHERE ${i}`,[t])}catch(s){console.error("TimeChart: filter query failed, using unfiltered data",i,s),this.preparedDataSet=t}else this.preparedDataSet=t}getAllocatedCanvasWidth(){const t=this.position.getAxisEndPositionX(),i=3*this.styles.fontStyles.size,s=Math.max(this.axisCategoryArea.width,this.scenariosArea.width);return Math.max(t+i,s>0?s+this.position.leftSideLabelLength:0)}getAllocatedCanvasHeight(){if(null==this.smallestVarianceDataPointValue.value||null==this.highestVarianceDataPointValue.value||null==this.smallestDataPointValue.value||null==this.highestDataPointValue.value)return 0;const t=this.isVarianceChart()&&this.variancesDataModel.some((t=>t.type===ft.RELATIVE)),i=this.position.getAxisPositionY(t),s=this.position.spacings.labelToAxis+this.position.dataLabelHeight+this.styles.padding.bottom;let h;if(this.isOnSameAxisSide())h=i+s;else{const t=this.isVarianceChart()?this.smallestVarianceDataPointValue:this.smallestDataPointValue;h=i+Math.abs(t.getScaledUnit())+this.position.spacings.labelToColumn+this.position.dataLabelHeight+s}const e=this.isOnSameAxisSide();return Math.max(h,e?this.axisCategoryArea.height+this.scenariosArea.height:this.scenariosArea.height)}toString(){const t=new e;return this.draw(t),t.id("drawCanvas"),t.width(this.getAllocatedCanvasWidth()),t.height(this.getAllocatedCanvasHeight()),t.attr("overflow","visible"),t.svg()}draw(t){this.cleanSVGforRedraw(t),this.state===dt.DIRTY&&(this.state=dt.UP_TO_DATE),this.isVarianceChart()?(this.drawVarianceScenario(this.variancesDataModel,t),this.drawAxisAndLabels(this.variancesDataModel,t)):null!=this.stackConfig?this.determineEffectiveChartMode()===m.LINE?(this.drawStackedAreaScenarios(this.dataModel,t),this.drawAxisAndLabelsForLineChart(this.dataModel,t)):(this.drawStackedScenarios(this.dataModel,t),this.drawStackedHeaders(this.dataModel,t),this.drawAxisAndLabels(this.dataModel,t)):this.determineEffectiveChartMode()===m.LINE?(this.drawLineScenarios(this.dataModel,t),this.drawAxisAndLabelsForLineChart(this.dataModel,t)):(this.drawScenarios(this.dataModel,t),this.drawOverlayLayer(this.dataModel,t),this.drawAxisAndLabels(this.dataModel,t))}determineEffectiveChartMode(){return this.chartMode===m.LINE||this.chartMode===m.AUTO&&this.dataModel.length>this.maxBars?m.LINE:m.BAR}setPattern(t,i){this.styles.pattern.set(t,i)}hasNoData(){return 0===this.dataModel.length}isOnSameAxisSide(){return null!=this.smallestVarianceDataPointValue.value&&null!=this.highestVarianceDataPointValue.value&&null!=this.smallestDataPointValue.value&&null!=this.highestDataPointValue.value&&(this.isVarianceChart()?Math.sign(this.smallestVarianceDataPointValue.value)===Math.sign(this.highestVarianceDataPointValue.value)||0===this.smallestDataPointValue.value&&1===Math.sign(this.highestDataPointValue.value):Math.sign(this.smallestDataPointValue.value)===Math.sign(this.highestDataPointValue.value)||0===this.smallestDataPointValue.value&&1===Math.sign(this.highestDataPointValue.value))}createI18n(t){this.state=dt.DIRTY;const i=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"],["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 new Map([...i,...t])}createElementPosition(t){let i;const s=M(t.filter(((t,i)=>1===i||2===i)).map((t=>C.translateScenarioLabel(t,this.i18n))).reduce(((t,i)=>t.length<i.length?i:t),""),{font:this.styles.fontStyles.font,fontSize:this.styles.fontStyles.size+"px"}).width,h=this.calculateTitleLength(this.leftSideOffsetForHorizontalSync);let e,n;if(i=s>h?s:h,null!=this.position&&(i+=this.position.spacings.labelToColumn),this.leftSideOffsetForHorizontalSync>-1&&(i=this.leftSideOffsetForHorizontalSync),this.isVarianceChart()?(e=this.smallestVarianceDataPointValue,n=this.highestVarianceDataPointValue):(e=this.smallestDataPointValue,n=this.highestDataPointValue),this.overflowConfig){const{cutHeight:t,overdriveZoneHeight:i,breakGap:s}=this.overflowConfig;n=new q(t+i+s,n.scenario,1,n.variance)}let r=this.styles.scaleFactors;const o=this.determineEffectiveChartMode();if(this.lineFullWidth&&this.availableWidth>0&&this.dataModel.length>0&&!this.isVarianceChart()&&o===m.LINE){const t=this.styles.fontStyles.size,s=this.styles.padding,h=this.styles.scaleFactors,e=this.availableWidth-(s.left+s.right+t*h.scenarioOffset+i+t*h.columnWidth);if(e>0){const i=Math.max(e/this.dataModel.length/t,1.2*h.columnWidth),s=new N;Object.assign(s,h),s.categoryWidth=i,r=s}}return new H(new F(this.styles.padding),r,this.styles.fontStyles,e,n,this.dataModel.length,i)}calculateTitleLength(t){let i="_______";i.length<this.title.length&&(i=this.title);const s=M(i,{font:this.styles.fontStyles.font,fontSize:this.styles.fontStyles.size+"px"}).width;return s<t?t:s}setAxisScenario(t){let i=G.AC1;if(null!=t&&t.length>0){const s=new x(t.toString());s.isValid&&(i=s.delta)}return null===i&&(i=G.AC1),i}populateModel(t,i,s,h){var e;if(0===(null===(e=this.preparedDataSet)||void 0===e?void 0:e.length))return[];let n=this.queryDataSet(i,"","");return this.detectNaNCells(t,n),n=this.leftOuterJoinDates(n,i),this.createDataRows(n,t)}detectNaNCells(t,i){i.forEach((i=>(t.forEach((t=>{const s=new x(t);!0===s.isValid?0!==i[s.base+"_cnt"]&&0!==i[s.delta+"_cnt"]||(i[t]=Number.NaN):0===i[t+"_cnt"]&&(i[t]=Number.NaN)})),i)))}findDateInterval(t){var i,s,h;if(t!==_.AUTO)return t;const e=this.queryMinMaxDates();let n=_.DAY;return null!=(null===(i=e[0])||void 0===i?void 0:i.mindate)&&(n=(new D).calculateDistanceType(null===(s=e[0])||void 0===s?void 0:s.mindate,null===(h=e[0])||void 0===h?void 0:h.maxdate,this.intervalSpanLimit)),n}queryMinMaxDates(){var t,i,s,h;const e=$("SELECT MAX(date) as maxdate, MIN(date) as mindate FROM ?",[this.preparedDataSet]);return null!=(null===(t=e[0])||void 0===t?void 0:t.mindate)&&(e[0].mindate=v.fromMillis(null===(i=e[0])||void 0===i?void 0:i.mindate)),null!=(null===(s=e[0])||void 0===s?void 0:s.maxdate)&&(e[0].maxdate=v.fromMillis(null===(h=e[0])||void 0===h?void 0:h.maxdate)),e}queryDataSet(t,i,s){const h=`normalizeDate([date], '${t}' , '${this.locale}') as calcdate`;return $(`SELECT p.calcdate ${i},\n ${["ac1","ac2","ac3","ac4","pp1","pp2","pp3","pp4","fc1","fc2","fc3","fc4","pl1","pl2","pl3","pl4"].map((t=>`SUM(${t} * transformOperator(operation)) as ${t}, COUNT(ISNULL(${t})) as ${t}_cnt`)).join(",")} \n \n FROM (SELECT ${h} ${i},\n ac1,\n ac2,\n ac3,\n ac4,\n pp1,\n pp2,\n pp3,\n pp4,\n fc1,\n fc2,\n fc3,\n fc4,\n pl1,\n pl2,\n pl3,\n pl4\n FROM ?) as p\n GROUP BY calcdate ${s}\n ORDER BY calcdate asc`,[this.preparedDataSet])}createDataRows(t,i){const s=[];return t.forEach(((t,h)=>{s.push({id:h,category:t.category,type:ft.NONE,date:t.calcdate,scenario1:new q(t[i[0]],i[0],this.pixelPerUnit,G.NEU),scenario2:new q(t[i[1]],i[1],this.pixelPerUnit,G.NEU),scenario3:new q(t[i[2]],i[2],this.pixelPerUnit,G.NEU),scenario4:new q(t[i[3]],i[3],this.pixelPerUnit,G.NEU)})})),s}findSmallestDataPointValue(t){const i=this.isVarianceChart()?this.pixelPerPercentage:this.pixelPerUnit;let s=new q(0,"default",i,G.NEU);for(const i of t)for(const t of[i.scenario1,i.scenario2,i.scenario3,i.scenario4])t&&null!=t.value&&t.value<Number(s.value)&&(s=t);return s}findHighestDataPointValue(t){const i=this.isVarianceChart()?this.pixelPerPercentage:this.pixelPerUnit;let s=new q(0,"default",i,G.NEU);for(const i of t)for(const t of[i.scenario1,i.scenario2,i.scenario3,i.scenario4])null!=t&&t.value>Number(s.value)&&(s=t);return s}populateVarianceModel(t,i){const s=[];if(null==t||0===t.length)return s;let h=null;null!=i&&i.length>0&&(h=i[0]);for(const e in t){const n=new x(t[e]);if(n.isValid){const t=this.mapScenarios(n,h),e=n.direction,r="dr"===n.type?this.pixelPerPercentage:this.pixelPerUnit;for(const h in i)s.push({id:Number(h),category:i[h].category,type:"dr"===n.type?ft.RELATIVE:ft.ABSOLUTE,date:i[h].date,scenario1:new q(this.calculateVariance(n,i[h],t),n.delta,r,e),scenario2:new q(null,null,null,null),scenario3:new q(null,null,null,null),scenario4:new q(null,null,null,null)})}}return s}calculateVariance(t,i,s){const h=s.get(t.base),e=s.get(t.delta);return null==h||null==e||null==i[h].value||null==i[e].value?null:t.type===ft.RELATIVE?(i[h].value-i[e].value)/i[e].value:i[h].value-i[e].value}mapScenarios(t,i){const s=new Map;return null==i||["scenario1","scenario2","scenario3","scenario4"].forEach((h=>{i[h].scenario===t.delta?s.set(t.delta,h):i[h].scenario===t.base&&s.set(t.base,h)})),s}cleanSVGforRedraw(t){t.clear()}isVarianceChart(){return this.variancesDataModel&&this.variancesDataModel.length>0}createDateFactory(){return new D}drawAxisAndLabels(t,i){const s=this.createDateFactory(),h=i.group().id("AxisAndDateLables");let e=!1;if(!1===this.hideAxisLabels)t.forEach(((t,i)=>{let n=I.Top,r=this.position.spacings.labelToAxis;t.scenario1.value<0&&(n=I.Bottom,r*=-1),t.type===ft.RELATIVE&&(e=!0);let o=s.getDateString(t.date,this.dateInterval);this.axisLabelsMode===g.SMART?(o=s.getSmartDateString(t.date,this.dateInterval),0===i&&this.dateInterval!==_.YEAR&&(o=s.getShortDateString(t.date,this.dateInterval))):this.axisLabelsMode===g.SHORT&&(o=s.getShortDateString(t.date,this.dateInterval)),new X(h,this.position.getColumnCenterPositionX(i),this.position.getAxisPositionY(e)+r,"",o,this.styles,n,I.Center).forceStringTypeDraw()}));else{const i=null==t?void 0:t[0];i&&i.type===ft.RELATIVE&&(e=!0)}new tt({scenarioType:this.axisScenario,labelText:this.title,isRelative:e},this.position,h).draw(),this.axisCategoryArea={height:h.height(),width:h.width()}}drawScenarios(t,i){const s=i.group().id("Scenarios"),h=new ut(this.position,s,this.styles,t.length,this.i18n);h.setOverflowConfig(this.overflowConfig);let e=!1;t.forEach(((t,i)=>{h.createPrimaryBar(t.scenario1,i).draw(this.dataFormatDigits,this.measureScale),h.createSecondaryBar(t.scenario2,i).draw(),h.createPrimaryMarker(t.scenario3,i).draw(),h.createSecondaryMarker(t.scenario4,i).draw(),!1===t.scenario1.isEmpty()&&(e=!0)}));let n=0;!1===e&&(n=this.isOnSameAxisSide()?this.position.dataLabelHeight:2*this.position.dataLabelHeight),this.scenariosArea={height:s.height()+this.styles.padding.top+this.styles.padding.bottom+n,width:s.width()+this.position.spacings.columnWidth}}drawLineScenarios(t,i){var s,h;const e=i.group().id("LineScenarios"),n=new U,r=new ut(this.position,e,this.styles,t.length,this.i18n);r.setCollisionManager(n);const o=["ac1","pp1","fc1","pl1"],l=[[],[],[],[]];t.forEach(((t,i)=>{["scenario1","scenario2","scenario3","scenario4"].forEach(((s,h)=>{t[s]&&l[h].push({dataPoint:t[s],index:i})}))}));const a=[];for(let t=0;t<l.length;t++){const i=l[t];if(i.length>0&&i.some((t=>!t.dataPoint.isEmpty()))){const e=(null===(h=null===(s=i[0])||void 0===s?void 0:s.dataPoint)||void 0===h?void 0:h.scenario)||o[t],n=e.slice(0,2).toLowerCase();a.push({points:i,scenarioName:e,scenarioType:n})}}a.sort(((t,i)=>(W[i.scenarioType]||99)-(W[t.scenarioType]||99)));const c=[];for(const t of a){const i=r.createLineSeries(t.points,t.scenarioName);c.push({series:i,scenarioType:t.scenarioType})}for(const t of c)t.series.drawGeometry();r.moveLabelsToFront();const u=[...c].sort(((t,i)=>(W[t.scenarioType]||99)-(W[i.scenarioType]||99)));for(const t of u)t.series.drawLabels(this.dataFormatDigits,this.measureScale);const d=this.position.getColumnPositionY();this.scenariosArea={height:Math.max(e.height()+this.styles.padding.top,d)+this.styles.padding.bottom,width:e.width()+this.position.spacings.columnWidth}}drawAxisAndLabelsForLineChart(t,i){const s=this.createDateFactory(),h=i.group().id("AxisAndDateLabelsLine"),e=!1,n=t.length-1;!1===this.hideAxisLabels&&t.forEach(((i,r)=>{if(!this.shouldShowLineChartAxisLabel(t,r))return;let o,l=I.Top,a=this.position.spacings.labelToAxis;i.scenario1.value<0&&(l=I.Bottom,a*=-1),this.lineFullWidth&&this.availableWidth>0?this.axisLabelsMode===g.SMART?(o=s.getSmartDateString(i.date,this.dateInterval),0===r&&this.dateInterval!==_.YEAR&&(o=s.getShortDateString(i.date,this.dateInterval))):o=this.axisLabelsMode===g.SHORT?s.getShortDateString(i.date,this.dateInterval):s.getDateString(i.date,this.dateInterval):o=s.getShortDateString(i.date,this.dateInterval),new X(h,this.position.getColumnCenterPositionX(r),this.position.getAxisPositionY(e)+a,"",o,this.styles,l,I.Center).forceStringTypeDraw(),r>0&&r<n&&this.isYearChange(t,r)&&this.drawYearSeparatorLine(h,r,e)})),new tt({scenarioType:this.axisScenario,labelText:this.title,isRelative:e},this.position,h).draw(),this.axisCategoryArea={height:h.height(),width:h.width()}}shouldShowLineChartAxisLabel(t,i){return!!(this.lineFullWidth&&this.availableWidth>0)||(0===i||i===t.length-1||this.isYearChange(t,i))}isYearChange(t,i){var s,h;if(0===i)return!1;const e=null===(s=t[i])||void 0===s?void 0:s.date,n=null===(h=t[i-1])||void 0===h?void 0:h.date;return!(!e||!n)&&e.year!==n.year}drawYearSeparatorLine(t,i,s){const h=this.position.getColumnCenterPositionX(i)-this.position.spacings.columnWidth/2,e=this.position.columnValue.max.getScaledUnit()+this.position.dataLabelHeight,n=this.position.getAxisPositionY(s)-e,r=this.position.getAxisPositionY(s);t.line([[h,n],[h,r]]).stroke({color:"#999999",width:1,dasharray:"4,4"}).attr("stroke-dasharray","4,4")}drawVarianceScenario(t,i){const s=i.group().id("Scenarios"),h=new ut(this.position,s,this.styles,t.length,this.i18n);return h.setOverflowConfig(this.overflowConfig),t.forEach(((t,i)=>{t.type===ft.RELATIVE?h.createRelativeVarianceBar(t.scenario1,i).draw():h.createVarianceBar(t.scenario1,i).draw(this.dataFormatDigits,this.measureScale)})),this.scenariosArea={height:s.height()+this.styles.padding.top+this.styles.padding.bottom,width:s.width()+this.position.spacings.columnWidth},s}drawStackedScenarios(t,i){if(!this.stackConfig)return;const s=i.group().id("StackedScenarios"),h=this.stackConfig.by===L.SCENARIO;t.forEach(((t,i)=>{const e=["scenario1","scenario2","scenario3","scenario4"],n=[];if(h)for(const i of e){const s=t[i];s&&!s.isEmpty()&&null!=s.value&&n.push({value:s.value,scenario:s.scenario,dataPoint:s})}else{const i=t.scenario1;i&&!i.isEmpty()&&null!=i.value&&n.push({value:i.value,scenario:i.scenario,dataPoint:i})}if(0!==n.length)if((h?new Set(n.map((t=>l(t.scenario)))):new Set).size>1){const t=new Map;for(const i of n){const s=l(i.scenario);t.has(s)||t.set(s,[]),t.get(s).push(i)}const h=[];for(const i of a)t.has(i)&&(h.push({prefix:i,segments:t.get(i)}),t.delete(i));for(const[i,s]of t)h.push({prefix:i,segments:s});h.forEach(((t,e)=>{const n=t.segments.reduce(((t,i)=>t+Math.abs(i.value)),0),r=h.length-1-e;let o=0,l=null;t.segments.forEach((t=>{const h=new rt(this.position,this.styles,t.dataPoint,i,o,t.scenario,r,this.stackConfig.mode,n,!0,s);h.draw(this.dataFormatDigits,this.measureScale),o+=Math.abs(t.value),l=h})),l&&l.drawTotalLabel(this.dataFormatDigits,this.measureScale)}))}else{"asc"===this.stackConfig.order?n.sort(((t,i)=>t.value-i.value)):"desc"===this.stackConfig.order&&n.sort(((t,i)=>i.value-t.value));const t=n.reduce(((t,i)=>t+Math.abs(i.value)),0);let e=0,r=null;n.forEach(((n,o)=>{const l=new rt(this.position,this.styles,n.dataPoint,i,e,n.scenario,o,this.stackConfig.mode,t,h,s);l.draw(this.dataFormatDigits,this.measureScale),e+=Math.abs(n.value),r=l})),r&&r.drawTotalLabel(this.dataFormatDigits,this.measureScale)}})),this.scenariosArea={height:s.height()+this.styles.padding.top+this.styles.padding.bottom,width:s.width()+this.position.spacings.columnWidth}}drawStackedHeaders(t,i){if(!this.stackConfig||0===t.length)return;if(this.stackConfig.by!==L.SCENARIO)return;const s=i.group().id("StackedHeaders"),h=t[0],e=["scenario1","scenario2","scenario3","scenario4"],n=[];for(const t of e){const i=h[t];i&&!i.isEmpty()&&null!=i.value&&n.push({value:i.value,scenario:i.scenario,dataPoint:i})}if(0===n.length)return;const r=new Set(n.map((t=>l(t.scenario)))),o=this.position.getColumnPositionY(),c=this.position.getColumnCenterPositionX(0)-this.position.getColumnWidth()/2-this.position.spacings.labelToColumn;if(r.size>1){const t=new Map;for(const i of n){const s=l(i.scenario);t.has(s)||t.set(s,[]),t.get(s).push(i)}const i=[];for(const s of a)t.has(s)&&(i.push({prefix:s,segments:t.get(s)}),t.delete(s));for(const[s,h]of t)i.push({prefix:s,segments:h});i.forEach((t=>{const i=t.segments.reduce(((t,i)=>t+Math.abs(i.value)),0),h=t.segments[0].dataPoint.pixelPerUnit,e=o-(this.stackConfig.mode===b.RELATIVE?h:i*h)/2,n=this.i18n.get(t.prefix+"1")||t.prefix.toUpperCase();new X(s,c,e,"STACK_HEADER",n,this.styles,I.Center,I.Right).forceStringTypeDraw()}))}else{"asc"===this.stackConfig.order?n.sort(((t,i)=>t.value-i.value)):"desc"===this.stackConfig.order&&n.sort(((t,i)=>i.value-t.value));const t=n.reduce(((t,i)=>t+Math.abs(i.value)),0),i=n[0].dataPoint.pixelPerUnit;let h=0;n.forEach((e=>{let n;n=this.stackConfig.mode===b.RELATIVE?(0!==t?Math.abs(e.value)/t:0)*i:Math.abs(e.value*i);const r=o-h-n/2,l=this.i18n.get(e.scenario)||e.scenario;new X(s,c,r,"STACK_HEADER",l,this.styles,I.Center,I.Right).forceStringTypeDraw(),h+=n}))}}drawStackedAreaScenarios(t,i){if(!this.stackConfig)return;const s=i.group().id("StackedAreaScenarios"),h=this.stackConfig.by===L.SCENARIO,e=this.stackConfig.mode,n=["scenario1","scenario2","scenario3","scenario4"];if(0===(h?n.filter((i=>t.some((t=>t[i]&&!t[i].isEmpty())))).length:1))return;const r=[],o=[],l=[];for(const i of n)t.some((t=>t[i]&&!t[i].isEmpty()))&&l.push(i);for(let i=0;i<l.length;i++){const s=l[i],h=[];for(let n=0;n<t.length;n++){const o=t[n][s],a=o&&!o.isEmpty()&&null!=o.value?o.value:0,c=i>0?r[i-1][n]:0;if(e===b.RELATIVE){const i=l.reduce(((i,s)=>{const h=t[n][s];return i+(h&&!h.isEmpty()&&null!=h.value?Math.abs(h.value):0)}),0),s=0!==i?Math.abs(a)/i:0;h.push(c+s)}else h.push(c+a)}r.push(h);const n=t[0][s];o.push((null==n?void 0:n.scenario)||"ac1")}const a=this.position.getColumnPositionY(),c=this.pixelPerUnit,u=t=>t.map(((t,i)=>({x:this.position.getColumnCenterPositionX(i),y:a-t*c}))),d=t.map(((t,i)=>({x:this.position.getColumnCenterPositionX(i),y:a})));for(let t=0;t<r.length;t++){const i=u(r[t]),e=0===t?d:u(r[t-1]),n=new at(s,i,e,h?o[t]:null,t,h);n.draw(),n.drawBoundaryLine()}this.scenariosArea={height:s.height()+this.styles.padding.top+this.styles.padding.bottom,width:s.width()+this.position.spacings.columnWidth}}drawOverlayLayer(t,i){const s=i.group().id("Overlay"),h=new ut(this.position,s,this.styles,t.length,this.i18n);if(!0===this.showOverlayAvg){let i=null;const s=function(t){const i=t.reduce(((t,i)=>{var s;return t+((null===(s=i.scenario1)||void 0===s?void 0:s.value)||0)}),0),s=t.filter((t=>{var i;return void 0!==(null===(i=t.scenario1)||void 0===i?void 0:i.value)})).length,h=s>0?i/s:0,e=Object.assign(Object.assign({},t[0]),{scenario1:new q(h,t[0].scenario1.scenario,t[0].scenario1.pixelPerUnit,t[0].scenario1.variance)}),n=Object.assign(Object.assign({},t[t.length-1]),{scenario1:new q(h,t[t.length-1].scenario1.scenario,t[t.length-1].scenario1.pixelPerUnit,t[t.length-1].scenario1.variance)});return[e,...t.map((t=>Object.assign(Object.assign({},t),{scenario1:new q(h,t.scenario1.scenario,t.scenario1.pixelPerUnit,t.scenario1.variance)}))),n]}(t);s.forEach(((t,s)=>{null!=i&&h.createLine(`Ø ${this.i18n.get(t.scenario1.scenario)||t.scenario1.scenario}`,t.scenario1,i,s-1).draw(this.dataFormatDigits,this.measureScale),i=t.scenario1}))}if(!0===this.showOverlayMedian){let i=null;const s=function(t){const i=t.map((t=>{var i;return null===(i=t.scenario1)||void 0===i?void 0:i.value})).filter((t=>void 0!==t)).sort(((t,i)=>t-i)),s=i.length%2==0?(i[i.length/2-1]+i[i.length/2])/2:i[Math.floor(i.length/2)],h=Object.assign(Object.assign({},t[0]),{scenario1:new q(s,t[0].scenario1.scenario,t[0].scenario1.pixelPerUnit,t[0].scenario1.variance)}),e=Object.assign(Object.assign({},t[t.length-1]),{scenario1:new q(s,t[t.length-1].scenario1.scenario,t[t.length-1].scenario1.pixelPerUnit,t[t.length-1].scenario1.variance)});return[h,...t.map((t=>Object.assign(Object.assign({},t),{scenario1:new q(s,t.scenario1.scenario,t.scenario1.pixelPerUnit,t.scenario1.variance)}))),e]}(t);s.forEach(((t,s)=>{null!=i&&h.createLine(`Mdn ${this.i18n.get(t.scenario1.scenario)||t.scenario1.scenario}`,t.scenario1,i,s-1).draw(this.dataFormatDigits,this.measureScale),i=t.scenario1}))}}leftOuterJoinDates(t,i){const s=v.max(...t.map((function(t){return t.calcdate}))),h=v.min(...t.map((function(t){return t.calcdate}))),e=(new D).datesBetween(h,s,i,this.intervalSpanLimit),n=new Map;return e.forEach(((t,i)=>{n.set(t.toISO(),{id:i,calcdate:t,category:null,ac1:null,ac2:null,ac3:null,ac4:null,pp1:null,pp2:null,pp3:null,pp4:null,fc1:null,fc2:null,fc3:null,fc4:null,pl1:null,pl2:null,pl3:null,pl4:null,isEmpty:!0})})),t.forEach((t=>{const i=t.calcdate.toISO(),s=n.get(i);s&&s.isEmpty&&n.set(i,{id:s.id,calcdate:t.calcdate,category:t.category,ac1:t.ac1,ac2:t.ac2,ac3:t.ac3,ac4:t.ac4,pp1:t.pp1,pp2:t.pp2,pp3:t.pp3,pp4:t.pp4,fc1:t.fc1,fc2:t.fc2,fc3:t.fc3,fc4:t.fc4,pl1:t.pl1,pl2:t.pl2,pl3:t.pl3,pl4:t.pl4,isEmpty:!1})})),Array.from(n.values())}}class wt{constructor(t,i){this.data=t,this.scenarios=i,this.variances=[],this.title="",this.hideAxisLabels=!1,this.pixelPerUnit=10,this.pixelPerPercentage=50,this.limit=0,this.sortOrder=new S(new Y).default(),this.level=y.CATEGORY,this.leftSideOffsetForHorizontalSync=-1,this.dateInterval=_.AUTO,this.axisLabelsMode=g.SMART,this.intervalSpanLimit=28,this.filter="",this.measureScale=new A,this.measureUnit="",this.showMeasureScale=!0,this.dataFormatDigits={decimal:1,percent:2},this.showOverlayMedian=!0,this.showOverlayAvg=!0,this.chartMode=m.BAR,this.maxBars=28,this.stackConfig=null,this.lineFullWidth=!0}}class vt{constructor(t,i,s,h,e){this.dataRowAdapter=t,this.orderAdapter=i,this.stringAdapter=s,this.dataFormatDigitsAdapter=h,this.dataSet=e}adapt(t){const i=P.adaptArray(t.data,this.dataRowAdapter),s=P.adaptArray(t.scenarios,this.stringAdapter),h=new wt(i,s);return w.isArray(t.variances)&&(h.variances=P.adaptArray(t.variances,this.stringAdapter)),w.isString(t.title)&&(h.title=t.title),w.isBoolean(t.hideAxisLabels)&&(h.hideAxisLabels=t.hideAxisLabels),w.isNumber(t.pixelPerUnit)&&(h.pixelPerUnit=t.pixelPerUnit),w.isNumber(t.pixelPerPercentage)&&(h.pixelPerPercentage=t.pixelPerPercentage),w.isNumber(t.limit)&&(h.limit=t.limit),w.isExisting(t.sortOrder)&&(h.sortOrder=this.orderAdapter.adapt(t.sortOrder)),w.isExisting(t.level)&&(h.level=t.level),w.isExisting(t.dateInterval)&&(h.dateInterval=t.dateInterval),w.isExisting(t.axisLabelsMode)&&(h.axisLabelsMode=t.axisLabelsMode),w.isNumber(t.leftSideOffsetForHorizontalSync)&&(h.leftSideOffsetForHorizontalSync=t.leftSideOffsetForHorizontalSync),w.isNumber(t.intervalSpanLimit)&&(h.intervalSpanLimit=t.intervalSpanLimit),w.isString(t.filter)&&(h.filter=t.filter),w.isExisting(t.measureScale)&&(h.measureScale=O.calculateMeasureScale(this.dataSet,h.scenarios,t.measureScale)),w.isString(t.measureUnit)&&(h.measureUnit=t.measureUnit),w.isBoolean(t.showMeasureScale)&&(h.showMeasureScale=t.showMeasureScale),w.isExisting(t.dataFormatDigits)&&(h.dataFormatDigits=this.dataFormatDigitsAdapter.adapt(t.dataFormatDigits)),w.isBoolean(t.showOverlayAvg)&&(h.showOverlayAvg=t.showOverlayAvg),w.isBoolean(t.showOverlayMedian)&&(h.showOverlayMedian=t.showOverlayMedian),w.isExisting(t.chartMode)&&(h.chartMode=t.chartMode),w.isNumber(t.maxBars)&&(h.maxBars=t.maxBars),w.isExisting(t.stackConfig)&&(h.stackConfig=t.stackConfig),w.isBoolean(t.lineFullWidth)&&(h.lineFullWidth=t.lineFullWidth),h}default(){return new wt([],[])}}const bt=class{constructor(i){t(this,i),this.data=[],this.scenarios=[],this.variances=[],this.hideAxisLabels=!1,this.pixelPerUnit=2,this.pixelPerPercentage=50,this.limit=0,this.leftSideOffsetForHorizontalSync=-1,this.i18n=new Map,this.order={hierarchy:[],direction:k.ASC},this.level=y.CATEGORY,this.dateInterval=_.AUTO,this.intervalSpanLimit=28,this.axisLabelsMode=g.SMART,this.filter="",this.measureScale="_",this.measureUnit="",this.showMeasureScale=!0,this.showOverlayMedian=!1,this.showOverlayAvg=!1,this.chartMode=m.BAR,this.maxBars=28,this.stackConfig=null,this.lineFullWidth=!0,this.containerWidth=0,this.dataFormatDigits={percent:2,decimal:1},this.parentDimensions={width:0,height:0}}render(){var t,h,e;if(void 0===this.chart)return i(s,null);if(this.chart.hasNoData()){const t=this.i18n.get("NO_DATA")||"==No Data==";return i(s,null,i("p",{class:"warning"},t))}return i(s,null,i("div",{innerHTML:null===(t=this.pattern)||void 0===t?void 0:t.toString(),class:"hidePatternContainer"}),i("div",{class:this.showMeasureScale?"footer":"footer-hide"},null===(h=this.chart)||void 0===h?void 0:h.getFooter()),i("div",{innerHTML:null===(e=this.chart)||void 0===e?void 0:e.toString()}))}async componentWillLoad(){var t;const i=this.prepareConfig(),s=this.prepareStyle(),h=this.containerWidth||0;this.chart=new pt(new E,i,s,h),this.chart.setI18n(this.i18n),this.autoFitScaling(i,s),this.chart.setAvailableHeight((null===(t=this.parentDimensions)||void 0===t?void 0:t.height)||0),this.pattern=new V(this.chart.styles),this.chart.setPattern("fc",this.pattern.getFCPolygonPattern())}async componentWillUpdate(){var t;if(null==this.chart)return;const i=this.prepareConfig(),s=this.prepareStyle();this.chart.setI18n(this.i18n),this.chart.setStyles(s),this.chart.setAvailableWidth(this.containerWidth||0),this.chart.setConfig(i),this.autoFitScaling(i,s),this.chart.setAvailableHeight((null===(t=this.parentDimensions)||void 0===t?void 0:t.height)||0),this.pattern=new V(this.chart.styles),this.chart.setPattern("fc",this.pattern.getFCPolygonPattern())}autoFitScaling(t,i){var s;if(t.pixelPerUnit>0)return;const h=null===(s=this.parentDimensions)||void 0===s?void 0:s.height,e=this.containerWidth||0;if(!h||h<=0)return t.pixelPerUnit=1,this.chart=new pt(new E,t,i,e),void this.chart.setI18n(this.i18n);t.pixelPerUnit=1,this.chart=new pt(new E,t,i,e),this.chart.setI18n(this.i18n),this.chart.toString();const n=this.chart.getAllocatedCanvasHeight();n<=0||(t.pixelPerUnit=.9*h/n,this.chart=new pt(new E,t,i,e),this.chart.setI18n(this.i18n))}async componentWillRender(){}componentDidLoad(){}componentDidUpdate(){}prepareConfig(){return new vt(new Z,new S(new Y),new Y,new T,this.data).adapt({data:this.data,scenarios:this.scenarios,variances:this.variances,title:this.chartTitle,hideAxisLabels:this.hideAxisLabels,pixelPerUnit:this.pixelPerUnit,pixelPerPercentage:this.pixelPerPercentage,level:this.level,dateInterval:this.dateInterval,axisLabelsMode:this.axisLabelsMode,limit:this.limit,sortOrder:this.order,leftSideOffsetForHorizontalSync:this.leftSideOffsetForHorizontalSync,intervalSpanLimit:this.intervalSpanLimit,filter:this.filter,measureScale:this.measureScale,measureUnit:this.measureUnit,showMeasureScale:this.showMeasureScale,dataFormatDigits:this.dataFormatDigits,showOverlayMedian:this.showOverlayMedian,showOverlayAvg:this.showOverlayAvg,chartMode:this.chartMode,maxBars:this.maxBars,stackConfig:this.stackConfig,lineFullWidth:this.lineFullWidth})}prepareStyle(){return new Q(new R,new c,new u(new d),new f(new d),new p).adapt(this.styles)}get element(){return h(this)}};bt.style=':host{position:relative;display:inline-block}.categories{text-align:right;font-size:var(--bn-font-size, 1em);font-family:var(--bn-font-family, "Noto Sans", "Helvetica Neue", Helvetica, sans-serif);color:var(--bn-font-color, black)}.label-bg{fill:var(--bn-font-background, white);opacity:0.7}.label-text{text-align:right;font-size:var(--bn-font-size, 1em);font-family:var(--bn-font-family, "Noto Sans", "Helvetica Neue", Helvetica, sans-serif);color:var(--bn-font-color, black)}.axis-title{text-align:center;font-family:var(--bn-font-family, "Noto Sans", "Helvetica Neue", Helvetica, sans-serif);color:var(--bn-font-color, black)}.axis-default{stroke:black;stroke-width:0.1em}.axis-ac{stroke:black;stroke-width:0.1em}.axis-pp{stroke:grey;stroke-width:0.1em}.axis-fc{stroke:black;stroke-dasharray:2;stroke-width:0.1em}.axis-pl{stroke:white;stroke-width:0.1em;outline-offset:0em;outline:0.1em solid black}canvas{image-rendering:-moz-crisp-edges;image-rendering:-webkit-crisp-edges;image-rendering:pixelated;image-rendering:crisp-edges}.measure{font-weight:bold}span{display:inline-block}.hidePatternContainer{height:0;width:0}div{float:left}.hide{opacity:0}.footer{margin:0.2em;font-size:0.6em}.footer-hide{margin:0.2em;font-size:0.6em;opacity:0}';export{bt as ibcs_chart_time}
@@ -1 +1 @@
1
- import{r as t,h as o,H as i,g as e}from"./p-JNHhIe7t.js";import{w as n,g as s,p as a}from"./p-DVMu6dEy.js";import{w as r}from"./p-CRLgp9-v.js";import{w as l}from"./p-CYjZRKdI.js";import{w as d}from"./p-DyRaC0MB.js";import{w as c}from"./p-BSfqOkN_.js";import{w as f}from"./p-tzFCK9qn.js";import"./p-DRikHQE-.js";import"./p-DdexOqTs.js";import"./p-DgfL-ffj.js";const h=new Set(["br","b","i","strong","em","span","p","div","table","tr","td","th","thead","tbody","tfoot","ul","ol","li","h1","h2","h3","h4","h5","h6","sub","sup","small","hr","a","img"]),v=new Set(["class","style","colspan","rowspan","href","title","src","alt","width","height"]),u=/\b(__proto__|globalThis)\b|\.constructor\b/;function p(t){const o=document.createElement("div");return o.innerHTML=t,m(o),o.innerHTML}function m(t){for(const o of Array.from(t.childNodes)){if(o.nodeType!==Node.ELEMENT_NODE)continue;const i=o;if(h.has(i.tagName.toLowerCase())){for(const t of Array.from(i.attributes)){const o=t.name.toLowerCase();o.startsWith("on")||!v.has(o)?i.removeAttribute(t.name):"href"!==o&&"src"!==o||!/^\s*javascript:/i.test(t.value)?"style"===o&&/expression|javascript/i.test(t.value)&&i.removeAttribute(t.name):i.removeAttribute(t.name)}m(i)}else t.replaceChild(document.createTextNode(i.textContent||""),i)}}const b=class{constructor(o){t(this,o),this.data={},d(this),l(this),this.errors=f(this),this.t=r(this).t,n(this,((t,o)=>{this.data=Object.assign(Object.assign({},this.data),{[t]:o})})),this.componentStyle=c(this)}validateValue(t){"string"!=typeof t||""===t?this.errors.addOrReplace({id:"no_value",type:"warning",message:"Empty value"}):this.errors.remove("no_value")}validateScaling(t){if(null==t||""===t||"none"===t||"auto"===t)return void this.errors.remove("ERR_scale");const o=Number(t);isNaN(o)||o<=0?this.errors.addOrReplace({id:"ERR_scale",type:"warning",message:`Invalid scale value: "${t}". Use "none", "auto", or a positive number.`}):this.errors.remove("ERR_scale")}componentWillLoad(){this.validateValue(this.value),this.validateScaling(this.scale)}evalTemplate(t){if(!t)return"";if(u.test(t))return this.errors.addOrReplace({id:"ERR_value_eval",type:"error",message:"Template contains forbidden pattern"}),"";try{const o=new Proxy({data:this.data,t:this.t},{has:()=>!0,get:(t,o)=>o===Symbol.unscopables?void 0:t[o],set:()=>!0}),i=new Function("sandbox","with(sandbox){try{return`"+t+'`}catch(e){return""}}').call(o,o);return this.errors.remove("ERR_value_eval"),null!=i?String(i):""}catch(t){return this.errors.addOrReplace({id:"ERR_value_eval",type:"error",message:`Template evaluation failed: ${t instanceof Error?t.message:String(t)}`}),""}}prepareStyle(){return this.componentStyle((t=>{var o,i,e,n,s,a,r,l,d,c,f,h,v,u,p,m,b,g,y,w,_,R;return{fontStyles:{font:`${null!==(n=null!==(i=null===(o=t["bn-text"])||void 0===o?void 0:o.fontSizePx)&&void 0!==i?i:null===(e=t.global)||void 0===e?void 0:e.fontSizePx)&&void 0!==n?n:13.3333}px ${null!==(l=null!==(a=null===(s=t["bn-text"])||void 0===s?void 0:s.fontFamily)&&void 0!==a?a:null===(r=t.global)||void 0===r?void 0:r.fontFamily)&&void 0!==l?l:"'Noto Sans', sans-serif"}`,size:null!==(h=null!==(c=null===(d=t["bn-text"])||void 0===d?void 0:d.fontSizePx)&&void 0!==c?c:null===(f=t.global)||void 0===f?void 0:f.fontSizePx)&&void 0!==h?h:13.3333,color:null!==(m=null!==(u=null===(v=t["bn-text"])||void 0===v?void 0:v.fontColor)&&void 0!==u?u:null===(p=t.global)||void 0===p?void 0:p.fontColor)&&void 0!==m?m:"#000000",background:null!==(w=null!==(g=null===(b=t["bn-text"])||void 0===b?void 0:b.fontBackgroundColor)&&void 0!==g?g:null===(y=t.global)||void 0===y?void 0:y.fontBackgroundColor)&&void 0!==w?w:"#ffffff",leading:null!==(R=null===(_=t["bn-text"])||void 0===_?void 0:_.leading)&&void 0!==R?R:1.8}}}))}applyScaling(t){const o=this.element,{mode:i,factor:e}=a(this.scale),{width:n,height:r}=s(o),l=o.scrollHeight>o.clientHeight+1?o.clientHeight:r,d=n,c=d>0&&o.scrollWidth>d+1,f=l>0&&o.scrollHeight>l+1,h=c||f;if(d<=0&&l<=0)return;if("none"===i){if(h){const t=[];c&&t.push(`w:${o.scrollWidth}>${Math.round(d)}`),f&&t.push(`h:${o.scrollHeight}>${Math.round(l)}`),this.errors.addOrReplace({id:"WARN_overflow",type:"warning",message:`Content overflows container (${t.join(", ")})`})}else this.errors.remove("WARN_overflow");return}if("factor"===i){if(h){const t=[];c&&t.push(`w:${o.scrollWidth}>${Math.round(d)}`),f&&t.push(`h:${o.scrollHeight}>${Math.round(l)}`),this.errors.addOrReplace({id:"WARN_overflow",type:"warning",message:`Content overflows with factor ${e} (${t.join(", ")})`})}else this.errors.remove("WARN_overflow");return}o.style.setProperty("--bn-font-size",`${t}px`);const v=o.scrollWidth,u=o.scrollHeight,p=o.clientHeight,m=u>p+1?p:r,b=d<=0||v<=d+1,g=m<=0||u<=m+1;if(b&&g)return void this.errors.remove("AUTO_scale");const y=Math.min(1,!b&&d>0?d/v:1,!g&&m>0?m/u:1);o.style.setProperty("--bn-font-size",t*y+"px"),"empty"===i?this.errors.addOrReplace({id:"AUTO_scale",type:"warning",message:`Auto-scaled font by factor ${y.toFixed(3)}`}):this.errors.remove("AUTO_scale")}componentDidRender(){this.container.innerHTML=p(this.evalTemplate(this.value)),this.applyScaling(this.prepareStyle().fontStyles.size)}render(){const{fontStyles:t}=this.prepareStyle(),{mode:e,factor:n}=a(this.scale),s="factor"===e?t.size*n+"px":`${t.size}px`,r={"--bn-font-family":t.font.substring(t.font.indexOf("px ")+3),"--bn-font-size":s,"--bn-font-color":t.color,"--bn-font-background":t.background};return o(i,{key:"49a4060ebb36623a64a41efbdefcdcc9060457c3",style:r},o("div",{key:"19f66b3d17d38d3c8119f9cb6b046e0d18c0f022"},o("span",{key:"3b8cf9f75aeb668cb0c32a7a3540e0ed8f336050",class:"container",ref:t=>{this.container=t}})))}get element(){return e(this)}static get watchers(){return{value:[{validateValue:0}],scale:[{validateScaling:0}]}}};b.style=':host{padding:0.5em;display:inline-block;position:relative;overflow:hidden;font-family:var(--bn-font-family, "Noto Sans", sans-serif);font-size:var(--bn-font-size, 13.3333px);color:var(--bn-font-color, #000000);background-color:var(--bn-font-background, white)}span.container p{margin:0}';export{b as bn_text}
1
+ import{r as t,h as o,H as i,g as e}from"./p-JNHhIe7t.js";import{w as n,g as s,p as a}from"./p-DVMu6dEy.js";import{w as r}from"./p-CRLgp9-v.js";import{w as l}from"./p-CYjZRKdI.js";import{w as d}from"./p-DtdQCMzj.js";import{w as c}from"./p-BSfqOkN_.js";import{w as f}from"./p-tzFCK9qn.js";import"./p-DRikHQE-.js";import"./p-sqjrku2z.js";import"./p-B4ySv9KQ.js";const h=new Set(["br","b","i","strong","em","span","p","div","table","tr","td","th","thead","tbody","tfoot","ul","ol","li","h1","h2","h3","h4","h5","h6","sub","sup","small","hr","a","img"]),v=new Set(["class","style","colspan","rowspan","href","title","src","alt","width","height"]),u=/\b(__proto__|globalThis)\b|\.constructor\b/;function p(t){const o=document.createElement("div");return o.innerHTML=t,m(o),o.innerHTML}function m(t){for(const o of Array.from(t.childNodes)){if(o.nodeType!==Node.ELEMENT_NODE)continue;const i=o;if(h.has(i.tagName.toLowerCase())){for(const t of Array.from(i.attributes)){const o=t.name.toLowerCase();o.startsWith("on")||!v.has(o)?i.removeAttribute(t.name):"href"!==o&&"src"!==o||!/^\s*javascript:/i.test(t.value)?"style"===o&&/expression|javascript/i.test(t.value)&&i.removeAttribute(t.name):i.removeAttribute(t.name)}m(i)}else t.replaceChild(document.createTextNode(i.textContent||""),i)}}const b=class{constructor(o){t(this,o),this.data={},d(this),l(this),this.errors=f(this),this.t=r(this).t,n(this,((t,o)=>{this.data=Object.assign(Object.assign({},this.data),{[t]:o})})),this.componentStyle=c(this)}validateValue(t){"string"!=typeof t||""===t?this.errors.addOrReplace({id:"no_value",type:"warning",message:"Empty value"}):this.errors.remove("no_value")}validateScaling(t){if(null==t||""===t||"none"===t||"auto"===t)return void this.errors.remove("ERR_scale");const o=Number(t);isNaN(o)||o<=0?this.errors.addOrReplace({id:"ERR_scale",type:"warning",message:`Invalid scale value: "${t}". Use "none", "auto", or a positive number.`}):this.errors.remove("ERR_scale")}componentWillLoad(){this.validateValue(this.value),this.validateScaling(this.scale)}evalTemplate(t){if(!t)return"";if(u.test(t))return this.errors.addOrReplace({id:"ERR_value_eval",type:"error",message:"Template contains forbidden pattern"}),"";try{const o=new Proxy({data:this.data,t:this.t},{has:()=>!0,get:(t,o)=>o===Symbol.unscopables?void 0:t[o],set:()=>!0}),i=new Function("sandbox","with(sandbox){try{return`"+t+'`}catch(e){return""}}').call(o,o);return this.errors.remove("ERR_value_eval"),null!=i?String(i):""}catch(t){return this.errors.addOrReplace({id:"ERR_value_eval",type:"error",message:`Template evaluation failed: ${t instanceof Error?t.message:String(t)}`}),""}}prepareStyle(){return this.componentStyle((t=>{var o,i,e,n,s,a,r,l,d,c,f,h,v,u,p,m,b,g,y,w,_,R;return{fontStyles:{font:`${null!==(n=null!==(i=null===(o=t["bn-text"])||void 0===o?void 0:o.fontSizePx)&&void 0!==i?i:null===(e=t.global)||void 0===e?void 0:e.fontSizePx)&&void 0!==n?n:13.3333}px ${null!==(l=null!==(a=null===(s=t["bn-text"])||void 0===s?void 0:s.fontFamily)&&void 0!==a?a:null===(r=t.global)||void 0===r?void 0:r.fontFamily)&&void 0!==l?l:"'Noto Sans', sans-serif"}`,size:null!==(h=null!==(c=null===(d=t["bn-text"])||void 0===d?void 0:d.fontSizePx)&&void 0!==c?c:null===(f=t.global)||void 0===f?void 0:f.fontSizePx)&&void 0!==h?h:13.3333,color:null!==(m=null!==(u=null===(v=t["bn-text"])||void 0===v?void 0:v.fontColor)&&void 0!==u?u:null===(p=t.global)||void 0===p?void 0:p.fontColor)&&void 0!==m?m:"#000000",background:null!==(w=null!==(g=null===(b=t["bn-text"])||void 0===b?void 0:b.fontBackgroundColor)&&void 0!==g?g:null===(y=t.global)||void 0===y?void 0:y.fontBackgroundColor)&&void 0!==w?w:"#ffffff",leading:null!==(R=null===(_=t["bn-text"])||void 0===_?void 0:_.leading)&&void 0!==R?R:1.8}}}))}applyScaling(t){const o=this.element,{mode:i,factor:e}=a(this.scale),{width:n,height:r}=s(o),l=o.scrollHeight>o.clientHeight+1?o.clientHeight:r,d=n,c=d>0&&o.scrollWidth>d+1,f=l>0&&o.scrollHeight>l+1,h=c||f;if(d<=0&&l<=0)return;if("none"===i){if(h){const t=[];c&&t.push(`w:${o.scrollWidth}>${Math.round(d)}`),f&&t.push(`h:${o.scrollHeight}>${Math.round(l)}`),this.errors.addOrReplace({id:"WARN_overflow",type:"warning",message:`Content overflows container (${t.join(", ")})`})}else this.errors.remove("WARN_overflow");return}if("factor"===i){if(h){const t=[];c&&t.push(`w:${o.scrollWidth}>${Math.round(d)}`),f&&t.push(`h:${o.scrollHeight}>${Math.round(l)}`),this.errors.addOrReplace({id:"WARN_overflow",type:"warning",message:`Content overflows with factor ${e} (${t.join(", ")})`})}else this.errors.remove("WARN_overflow");return}o.style.setProperty("--bn-font-size",`${t}px`);const v=o.scrollWidth,u=o.scrollHeight,p=o.clientHeight,m=u>p+1?p:r,b=d<=0||v<=d+1,g=m<=0||u<=m+1;if(b&&g)return void this.errors.remove("AUTO_scale");const y=Math.min(1,!b&&d>0?d/v:1,!g&&m>0?m/u:1);o.style.setProperty("--bn-font-size",t*y+"px"),"empty"===i?this.errors.addOrReplace({id:"AUTO_scale",type:"warning",message:`Auto-scaled font by factor ${y.toFixed(3)}`}):this.errors.remove("AUTO_scale")}componentDidRender(){this.container.innerHTML=p(this.evalTemplate(this.value)),this.applyScaling(this.prepareStyle().fontStyles.size)}render(){const{fontStyles:t}=this.prepareStyle(),{mode:e,factor:n}=a(this.scale),s="factor"===e?t.size*n+"px":`${t.size}px`,r={"--bn-font-family":t.font.substring(t.font.indexOf("px ")+3),"--bn-font-size":s,"--bn-font-color":t.color,"--bn-font-background":t.background};return o(i,{key:"49a4060ebb36623a64a41efbdefcdcc9060457c3",style:r},o("div",{key:"19f66b3d17d38d3c8119f9cb6b046e0d18c0f022"},o("span",{key:"3b8cf9f75aeb668cb0c32a7a3540e0ed8f336050",class:"container",ref:t=>{this.container=t}})))}get element(){return e(this)}static get watchers(){return{value:[{validateValue:0}],scale:[{validateScaling:0}]}}};b.style=':host{padding:0.5em;display:inline-block;position:relative;overflow:hidden;font-family:var(--bn-font-family, "Noto Sans", sans-serif);font-size:var(--bn-font-size, 13.3333px);color:var(--bn-font-color, #000000);background-color:var(--bn-font-background, white)}span.container p{margin:0}';export{b as bn_text}