@bino-bi/bn-template-engine 1.0.0-next.49 → 1.0.0-next.51
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/bn-template-engine/bn-template-engine.esm.js +1 -1
- package/dist/bn-template-engine/p-0cad5598.entry.js +1 -0
- package/dist/bn-template-engine/{p-2de524d0.entry.js → p-150bdb68.entry.js} +1 -1
- package/dist/bn-template-engine/{p-Bxa4pX1M.js → p-Bvunba5p.js} +1 -1
- package/dist/bn-template-engine/p-NxJ6P79y.js +1 -0
- package/dist/bn-template-engine/{p-8fc90dc8.entry.js → p-b75a4b52.entry.js} +1 -1
- package/dist/bn-template-engine/{p-510d2ee6.entry.js → p-fdf42a77.entry.js} +1 -1
- package/dist/cjs/bn-annotation-layer_30.cjs.entry.js +1045 -63
- package/dist/cjs/bn-grid.cjs.entry.js +1 -1
- package/dist/cjs/bn-image.cjs.entry.js +1 -1
- package/dist/cjs/bn-template-engine.cjs.js +1 -1
- package/dist/cjs/bn-text.cjs.entry.js +2 -2
- package/dist/cjs/loader.cjs.js +1 -1
- package/dist/cjs/{withStyled-pkdctrK9.js → withStyled-BISQLGLe.js} +9 -0
- package/dist/cjs/{withTranslation-BIzTNYZM.js → withTranslation-B7T30EVU.js} +1 -1
- package/dist/collection/components/bn-annotation-layer/bn-annotation-layer.js +109 -11
- package/dist/collection/components/bn-annotation-layer/utils/marks.js +126 -4
- package/dist/collection/components/bn-annotation-layer/utils/matchPoint.js +2 -1
- package/dist/collection/components/bn-chart-structure/bn-chart-structure-renderer/bn-chart-structure-renderer.js +133 -0
- package/dist/collection/components/bn-chart-structure/bn-chart-structure.js +258 -2
- package/dist/collection/components/bn-chart-structure/utils/StructureChart.js +507 -27
- package/dist/collection/components/bn-chart-structure/utils/elements/Bar.js +3 -1
- package/dist/collection/components/bn-chart-structure/utils/elements/Label.js +12 -0
- package/dist/collection/components/bn-chart-structure/utils/elements/StackedBar.js +23 -8
- package/dist/collection/components/bn-chart-structure/utils/helper/ElementPositions.js +19 -3
- package/dist/collection/components/bn-chart-structure/utils/model/StructureChartComponentConfig.js +23 -0
- package/dist/collection/components/bn-context/bn-context.js +56 -1
- package/dist/collection/components/bn-layout-card/bn-layout-card.js +62 -2
- package/dist/collection/utils/formatter.js +13 -2
- package/dist/collection/utils/validate.js +9 -0
- package/dist/components/bn-annotation-layer.js +1 -1
- package/dist/components/bn-chart-bubble-renderer.js +1 -1
- package/dist/components/bn-chart-bubble.js +1 -1
- package/dist/components/bn-chart-bullet-renderer.js +1 -1
- package/dist/components/bn-chart-bullet.js +1 -1
- package/dist/components/bn-chart-scatter-renderer.js +1 -1
- package/dist/components/bn-chart-scatter.js +1 -1
- package/dist/components/bn-chart-structure-renderer.js +1 -1
- package/dist/components/bn-chart-structure.js +1 -1
- package/dist/components/bn-chart-time-renderer.js +1 -1
- package/dist/components/bn-chart-time.js +1 -1
- package/dist/components/bn-context.js +1 -1
- package/dist/components/bn-grid.js +1 -1
- package/dist/components/bn-image.js +1 -1
- package/dist/components/bn-layout-card.js +1 -1
- package/dist/components/bn-layout-page.js +1 -1
- package/dist/components/bn-page.js +1 -1
- package/dist/components/bn-table-renderer.js +1 -1
- package/dist/components/bn-table.js +1 -1
- package/dist/components/bn-text.js +1 -1
- package/dist/components/bn-title-renderer.js +1 -1
- package/dist/components/bn-title.js +1 -1
- package/dist/components/bn-tree.js +1 -1
- package/dist/components/p-BOwmXBm-.js +1 -0
- package/dist/components/p-Bs5V6Ibu.js +1 -0
- package/dist/components/{p-CVfmhtEW.js → p-CU9CdEBF.js} +1 -1
- package/dist/components/{p-Cc0gaLwp.js → p-CZSp0rSS.js} +1 -1
- package/dist/components/p-CcfvGlBq.js +1 -0
- package/dist/components/p-CiljAoC5.js +1 -0
- package/dist/components/p-D0v9GMIf.js +1 -0
- package/dist/components/{p-DBj1Yd3M.js → p-D65TnLS9.js} +1 -1
- package/dist/components/p-DKcw-1ot.js +1 -0
- package/dist/components/{p-k7heRDPP.js → p-DLmQ_mi7.js} +1 -1
- package/dist/components/p-DOKqRsAu.js +1 -0
- package/dist/components/p-Dpc8_R-Y.js +1 -0
- package/dist/components/p-LHIKI9Dp.js +1 -0
- package/dist/components/{p-Blre9f28.js → p-NdDdfez6.js} +1 -1
- package/dist/components/p-Zz3fAPcH.js +1 -0
- package/dist/components/{p-y12CmIFS.js → p-dSUX43yf.js} +1 -1
- package/dist/components/p-jEqo8YD5.js +1 -0
- package/dist/esm/bn-annotation-layer_30.entry.js +1045 -63
- package/dist/esm/bn-grid.entry.js +1 -1
- package/dist/esm/bn-image.entry.js +1 -1
- package/dist/esm/bn-template-engine.js +1 -1
- package/dist/esm/bn-text.entry.js +2 -2
- package/dist/esm/loader.js +1 -1
- package/dist/esm/{withStyled-B62R20Zx.js → withStyled-CrTxIZ0Q.js} +9 -0
- package/dist/esm/{withTranslation-BEseMLQ6.js → withTranslation-BtSJmx1J.js} +1 -1
- package/dist/schemas/stack.schema.json +42 -0
- package/dist/types/components/bn-annotation-layer/utils/marks.d.ts +53 -0
- package/dist/types/components/bn-annotation-layer/utils/matchPoint.d.ts +2 -0
- package/dist/types/components/bn-chart-structure/bn-chart-structure-renderer/bn-chart-structure-renderer.d.ts +11 -1
- package/dist/types/components/bn-chart-structure/bn-chart-structure.d.ts +49 -0
- package/dist/types/components/bn-chart-structure/utils/StructureChart.d.ts +45 -0
- package/dist/types/components/bn-chart-structure/utils/elements/Label.d.ts +4 -0
- package/dist/types/components/bn-chart-structure/utils/elements/StackedBar.d.ts +13 -1
- package/dist/types/components/bn-chart-structure/utils/helper/ElementPositions.d.ts +13 -1
- package/dist/types/components/bn-chart-structure/utils/model/StructureChartComponentConfig.d.ts +23 -0
- package/dist/types/components/bn-context/bn-context.d.ts +11 -0
- package/dist/types/components/bn-layout-card/bn-layout-card.d.ts +12 -0
- package/dist/types/components.d.ts +113 -2
- package/dist/types/schemas.d.ts +12 -0
- package/dist/types/utils/annotations.d.ts +1 -1
- package/dist/types/utils/formatter.d.ts +5 -0
- package/package.json +1 -1
- package/dist/bn-template-engine/p-BFl7OwcC.js +0 -1
- package/dist/bn-template-engine/p-c1d679af.entry.js +0 -1
- package/dist/components/p-B11cXOLy.js +0 -1
- package/dist/components/p-BVNOmHh4.js +0 -1
- package/dist/components/p-CHhxQoF9.js +0 -1
- package/dist/components/p-CO6bgquz.js +0 -1
- package/dist/components/p-CmvpJzLd.js +0 -1
- package/dist/components/p-CuUfiEu0.js +0 -1
- package/dist/components/p-DHloMyxV.js +0 -1
- package/dist/components/p-Dd1QOWDV.js +0 -1
- package/dist/components/p-HVN8BNWN.js +0 -1
- package/dist/components/p-x0W2_FAX.js +0 -1
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{p as t,H as i,h as s,d as h,t as e}from"./p-BnmylmXF.js";import{S as n,F as r,a as o,P as l}from"./p-CSJCkHEL.js";import{C as a,g as c,b as u,h as d,e as f,R as v}from"./p-DguYWLBj.js";import{C as p,r as w,F as m,V as b}from"./p-Zz3fAPcH.js";import{a as g,H as y,b as S,L as P,S as L}from"./p-DLmQ_mi7.js";import{S as x}from"./p-CeE4_3wQ.js";import{d as k,p as M,S as C}from"./p-DHX92KDP.js";import{N as A,r as O}from"./p-fCjsrD7I.js";import{I as N,S as T,D as $}from"./p-VtNvNyZK.js";import{a as _,I as D}from"./p-4q8nRcWC.js";import{D as E,w as R}from"./p-BrQCbmG0.js";import{d as j,g as Y}from"./p-6242qMx1.js";import{e as H,r as V}from"./p-ClruFZD_.js";import{D as F,b as I}from"./p-ja0FCkHB.js";import{s as W,c as B,a as z,b as G,l as X,d as U,M as K}from"./p-BTnRaHPb.js";import{I as q,a as Z,s as Q}from"./p-D0v9GMIf.js";import{D as J,b as tt}from"./p-keKnrAVS.js";import{A as it}from"./p-DsC0ew4j.js";import{S as st}from"./p-Do-IGHJk.js";import{S as ht}from"./p-CJ0-xdfZ.js";class et{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 nt{adapt(t){const i=new et;return a.isNumber(t.scenarioOffset)&&(i.scenarioOffset=t.scenarioOffset),a.isNumber(t.scenarioLabelToColumn)&&(i.scenarioLabelToColumn=t.scenarioLabelToColumn),a.isNumber(t.labelToColumn)&&(i.labelToColumn=t.labelToColumn),a.isNumber(t.labelToAxis)&&(i.labelToAxis=t.labelToAxis),a.isNumber(t.needleWidth)&&(i.needleWidth=t.needleWidth),a.isNumber(t.needleHeadWidth)&&(i.needleHeadWidth=t.needleHeadWidth),a.isNumber(t.columnWidth)&&(i.columnWidth=t.columnWidth),a.isNumber(t.varianceAxisLineWidth)&&(i.varianceAxisLineWidth=t.varianceAxisLineWidth),a.isNumber(t.axisLineWidth)&&(i.axisLineWidth=t.axisLineWidth),a.isNumber(t.auxiliaryLineWidth)&&(i.auxiliaryLineWidth=t.auxiliaryLineWidth),a.isNumber(t.scenarioLineWidth)&&(i.scenarioLineWidth=t.scenarioLineWidth),a.isNumber(t.markerWidth)&&(i.markerWidth=t.markerWidth),a.isNumber(t.markerOffset)&&(i.markerOffset=t.markerOffset),a.isNumber(t.categoryWidth)&&(i.categoryWidth=t.categoryWidth),a.isNumber(t.axisTickLength)&&(i.axisTickLength=t.axisTickLength),i}default(){return new et}}class rt{constructor(t,i,s,h,e,n,r){this.categoryPosition={x:0,y:0},this.spacings=new et,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*p("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 ot{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 lt{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 at{constructor(t){this.container=new n,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()}}class ct{constructor(t,i,s,h){this.percentClamp=ct.PERCENT_CLAMP,this.value=t,this.scenario=i,this.pixelPerUnit=s||1;const e="string"==typeof h?w(h,null,!0):h;this.variance="neg"===e||e===pt.NEG?pt.NEG:"pos"===e||e===pt.POS?pt.POS:pt.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>this.percentClamp?this.percentClamp*this.pixelPerUnit:this.value<-this.percentClamp?-this.percentClamp*this.pixelPerUnit:this.value*this.pixelPerUnit}getVarianceStyle(){return null==this.value||this.value>=0?this.variance:pt.NEU===this.variance?pt.NEU:pt.POS===this.variance?pt.NEG:pt.POS}isClipped(){return null!=this.value&&Math.abs(this.value)>this.percentClamp}getClippedValue(){return 145}getScenario(){var t;return null===(t=this.scenario)||void 0===t?void 0:t.slice(0,2)}}ct.PERCENT_CLAMP=1.45;class ut{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 dt{constructor(){}adapt(t){const i=new ut;return a.isString(t.date)&&(i.date=this.parseDateString(t.date)),a.isOperator(t.operation)&&(i.operation=t.operation),a.isNumber(t.rowGroupIndex)&&a.isString(t.rowGroup)&&i.addRowGroup(t.rowGroup,t.rowGroupIndex),a.isNumber(t.categoryIndex)&&a.isString(t.category)&&i.addCategory(t.category,t.categoryIndex),a.isNumber(t.subCategoryIndex)&&a.isString(t.subCategory)&&i.addSubCategory(t.subCategory,t.subCategoryIndex),a.isNumber(t.columnGroupIndex)&&a.isString(t.columnGroup)&&i.addColumnGroup(t.columnGroup,t.columnGroupIndex),a.isNumber(t.columnSubGroupIndex)&&a.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){if("string"!=typeof t)return;const i=E.fromISO(t,{zone:"utc"});if(i.isValid)return i;console.warn(`TimeChartDataRow: invalid date value '${t}' - skipping row`)}default(){return new ut}setActualValues(t,i){a.isNumber(t.ac1)&&(i.ac1=t.ac1),a.isNumber(t.ac2)&&(i.ac2=t.ac2),a.isNumber(t.ac3)&&(i.ac3=t.ac3),a.isNumber(t.ac4)&&(i.ac4=t.ac4)}setPlanValues(t,i){a.isNumber(t.pl1)&&(i.pl1=t.pl1),a.isNumber(t.pl2)&&(i.pl2=t.pl2),a.isNumber(t.pl3)&&(i.pl3=t.pl3),a.isNumber(t.pl4)&&(i.pl4=t.pl4)}setPreviousPeriodValues(t,i){a.isNumber(t.pp1)&&(i.pp1=t.pp1),a.isNumber(t.pp2)&&(i.pp2=t.pp2),a.isNumber(t.pp3)&&(i.pp3=t.pp3),a.isNumber(t.pp4)&&(i.pp4=t.pp4)}setForecastValues(t,i){a.isNumber(t.fc1)&&(i.fc1=t.fc1),a.isNumber(t.fc2)&&(i.fc2=t.fc2),a.isNumber(t.fc3)&&(i.fc3=t.fc3),a.isNumber(t.fc4)&&(i.fc4=t.fc4)}}class ft{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,this.stackColors=["#000000","#c0c0c0","#808080"],this.locale="de"}}class vt{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 ft(this.scaleFactorsStructureChartAdapter.default(),this.fontStyleAdapter.default(),this.svgStyleGroupAdapter.default(),this.svgStyleGroupAdapter.default(),this.svgVariancesStyleGroupAdapter.default(),this.paddingadapter.default());return a.isExisting(t)&&(a.isExisting(t.scaleFactors)&&(i.scaleFactors=this.scaleFactorsStructureChartAdapter.adapt(t.scaleFactors)),a.isExisting(t.fontStyles)&&(i.fontStyles=this.fontStyleAdapter.adapt(t.fontStyles)),a.isExisting(t.axisStyles)&&(i.axisStyles=this.svgStyleGroupAdapter.adapt(t.axisStyles)),a.isExisting(t.barStyles)&&(i.barStyles=this.svgStyleGroupAdapter.adapt(t.barStyles)),a.isExisting(t.varianceStyles)&&(i.varianceStyles=this.svgVariancesStyleGroupAdapter.adapt(t.varianceStyles)),a.isExisting(t.padding)&&(i.padding=this.paddingadapter.adapt(t.padding)),Array.isArray(t.stackColors)&&t.stackColors.length>0&&(i.stackColors=t.stackColors),i.pattern=new lt(i.fontStyles.size).createPatternMapForStructureBar()),i}default(){return new ft(this.scaleFactorsStructureChartAdapter.default(),this.fontStyleAdapter.default(),this.svgStyleGroupAdapter.default(),this.svgStyleGroupAdapter.default(),this.svgVariancesStyleGroupAdapter.default(),this.paddingadapter.default())}}var pt,wt;!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"}(pt||(pt={})),function(t){t.LIST="LIST",t.SUM="SUM",t.OPT="OPT"}(wt||(wt={}));class mt{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.titlePosition=t.titlePosition||"left",this.position=i,this.svgGroup=s.group().id(this.ID_AXIS)}drawAxisTitle(t,i){null==i&&(i=""),"right"!==this.titlePosition?t.text(i).addClass(this.CSS_AXIS_TITLE).attr("text-anchor","middle").move(this.position.getAxisTitlePositionX(t),this.position.getAxisTitlePositionY(!0,this.isRelative)):t.text(i).addClass(this.CSS_AXIS_TITLE).move(this.position.getAxisEndPositionX()+this.position.spacings.labelToColumn,this.position.getAxisTitlePositionY(!0,this.isRelative))}draw(){return this.labelText&&"none"!==this.titlePosition&&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 bt{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 x){var s,h,e,n;if(this.isEmpty())return this;const r=this.getScenarioStyle();let o=this.convertToSVGStyle(r,"stroke"),l=this.getFillStyle(r);if(this.isVarianceColumn&&"pl"===this.dataPoint.notation){const t=Number(null===(h=null===(s=this.columnBarStyles)||void 0===s?void 0:s.pl)||void 0===h?void 0:h.width);o={color:(null==r?void 0:r.fill)||this.FALLBACK_COLOUR,width:t>0?t:1},l=this.styles.fontStyles.background||"#ffffff"}this.scenarioGroup.attr(k(this.dataPoint.key)),null===(e=this.columnGroup)||void 0===e||e.attr(k(this.dataPoint.key,"element")),this.dataPoint.key&&Number.isFinite(this.dataPoint.value)&&(null===(n=this.columnGroup)||void 0===n||n.attr("data-bn-value",this.dataPoint.value)),null!=this.columnGroup&&(this.isOverflowing&&this.overflowConfig?this.drawOverdriveBar(l,o):this.columnGroup.rect(this.position.getColumnWidth(),this.dimensions.columnLength).fill(l).stroke(o).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=y.Bottom;null!=t.value&&t.value<0&&(i=y.Top);const s=this.isOverflowing?this.dimensions.labelYPos:this.position.getColumnDataLabelPositionY(this.dataPoint.getScaledUnit());return new g(this.scenarioGroup,this.position.getColumnCenterPositionX(this.index),s,this.ID_DATA_PREFIX,t.value,this.styles,i,y.Center).setPoint(t.key)}getScenarioLabel(t){return new g(this.scenarioGroup,-1,-1,this.ID_SCENARIO_PREFIX,t,this.styles,y.Center,this.isPrimaryColumn?y.Left:y.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 x){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 gt{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.pointKey=n.key,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.attr(k(this.pointKey)),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).attr(k(this.pointKey,"element")),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 g(this.markerGroup,-1,-1,this.ID_DATA_PREFIX,t,i,y.Center,s?y.Right:y.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 yt{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);const n=void 0===(null==s?void 0:s.value)&&null!=(null==s?void 0:s.scenario);(!0!==(null==s?void 0:s.isEmpty())||n)&&(this.hasData=!0,this.dimensions=this.createDimensions(t,s,h),this.dataLabel=new g(this.scenarioGroup,this.position.getColumnCenterPositionX(this.index),this.position.getNeedleDataLabelPositionY(this.dataPoint.getScaledPercentUnit()),this.ID_DATA_PREFIX,n?A:s.value,this.styles,y.Center,y.Center),this.dataLabel.setToRelativeVarianceLabel().setPoint(s.key))}updateLabelGroup(t){var i;return this.isEmpty()||null===(i=this.dataLabel)||void 0===i||i.updateGroup(t),this}draw(t={percent:2,decimal:1}){var i,s,h;if(void 0===(null===(i=this.dataPoint)||void 0===i?void 0:i.value))return null===(s=this.dataLabel)||void 0===s||s.draw(!0,t),this;if(this.isEmpty())return this;this.scenarioGroup.attr(k(this.dataPoint.key)),this.barGroup.attr(k(this.dataPoint.key,"element"));const e=this.styles.varianceStyles[this.dataPoint.getVarianceStyle()],n=this.convertToSVGStyle(e,"stroke");let r=this.convertToSVGStyle(e,"fill");const o=this.convertToSVGStyle(this.styles.varianceStyles.ac,"stroke"),l=this.convertToSVGStyle(this.styles.varianceStyles.ac,"fill"),a=this.barStyles[this.dataPoint.getScenario()];if(null!=a&&a.fillpattern){const t=this.styles.pattern.get(a.fillpattern);null!=t&&(r=t.pattern)}"pl"===this.dataPoint.notation&&(n.color=(null==e?void 0:e.fill)||n.color,n.width=Math.max(1,Number(n.width)||0),r=this.styles.fontStyles.background||"#ffffff"),this.dimensions.clipped?this.createClippedNeedleHead(r,n):this.createNeedleHead(o,l),this.barGroup.rect(this.position.getNeedleWidth(),this.dimensions.columnLength).cx(this.dimensions.xPos).y(this.dimensions.yPos).fill(r).stroke(n),null===(h=this.dataLabel)||void 0===h||h.draw(!0,t)}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}}class St{constructor(t,i,s,h,e,n,r,o,l=null,a){this.lineSlot=a,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 x){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 x){return 0===this.dataPoints.length||(this.drawScenarioLabel(),this.drawValueLabels(t,i)),this}getLineStyle(){var t,i,s;const h=null!==(t=this.lineSlot)&&void 0!==t?t:(null===(s=null===(i=this.scenarioName)||void 0===i?void 0:i.slice(0,2))||void 0===s?void 0:s.toLowerCase())||"ac";return N[h]||N.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;return 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){return 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;return 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;return 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();let r;switch(s){case 2:r=this.drawCircleMarker(i,e,n,t);break;case 3:r=this.drawTriangleMarker(i,e,n,t);break;case 4:r=this.drawDiamondMarker(i,e,n,t);break;default:r=this.drawSquareMarker(i,e,n,t)}r.attr(k(h.dataPoint.key,"element")).attr("data-bn-index",String(h.index))}}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?[S.Below,S.Left,S.Right,S.Above]:[S.Above,S.Left,S.Right,S.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=y.Bottom,c=y.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 g(this.labelGroup,o,l,this.ID_LABEL_PREFIX,e.dataPoint.value,this.styles,a,c).setPoint(e.dataPoint.key).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 g(this.labelGroup,i,s,"SCENARIO_LABEL",this.scenarioLabel,this.styles,y.Center,y.Left).forceStringTypeDraw()}}class Pt{constructor(t,i,s,h,e,n,r,o,l,a,c,u=!1,d=!1){this.notation=u,this.plainShares=d,this.hasData=!1,this.position=t,this.styles=i,this.dataPoint=s,this.index=h,this.segment=e,this.segmentIndex=r,this.stackMode=o,this.stack=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 x){var s,h;if(!this.hasData||!Number.isFinite(this.dataPoint.value))return;const e=this.dataPoint.value,n=this.dataPoint.pixelPerUnit,r=this.position.getColumnPositionY(),o=Math.abs(this.segment.end-this.segment.start)*n,l=r-Math.max(this.segment.start,this.segment.end)*n,a=this.position.getColumnCenterPositionX(this.index),u=this.position.getColumnWidth(),d=this.styles.stackColors;let f=d[this.segmentIndex%d.length],v={color:f},p={color:f,width:.5},w=!1;const b=_(null!==(s=this.dataPoint.scenario)&&void 0!==s?s:"");if(this.notation&&("fc"===b||"pl"===b)){const t=this.styles.barStyles.getSVGStyle(b);0===this.segmentIndex&&(f=t.fill),v={color:f},p={color:t.stroke,width:1},"hatched"===t.fillpattern&&(w=!0,v=null!==(h=this.hatchPattern(f,t.stroke))&&void 0!==h?h:v)}if(this.columnGroup.attr(k(this.dataPoint.key,"element")),this.columnGroup.attr("data-bn-value",e),this.columnGroup.rect(u,Math.max(o,.5)).fill(v).stroke(p).y(l).cx(a),o>=Math.min(18,1.15*(this.styles.fontStyles.size||18))){const s=l+o/2,h=t=>w?t:t.setSegmentFill(f);if(this.stackMode===c.RELATIVE||this.stackMode===c.ABSOLUTE_RELATIVE){const i=this.plainShares?m.number(100*this.segment.share,"decimal",t.percent,t.percent,1,this.styles.locale):m.number(this.segment.share,"percent",t.percent,t.percent,1,this.styles.locale);h(new g(this.group,a,s,"STACK_SEG",i,this.styles,y.Center,y.Center)).setPoint(this.dataPoint.key).forceStringTypeDraw()}else h(new g(this.group,a,s,"STACK_SEG",e,this.styles,y.Center,y.Center)).setPoint(this.dataPoint.key).draw(!0,t,i)}}hatchPattern(t,i){const s=this.group.root();if(!s)return null;const h=`pattern-stack-fc-${this.segmentIndex}`;return s.findOne(`#${h}`)||s.pattern(10,10,(s=>{s.rect(10,10).fill(t),s.line(0,5,5,0).stroke({width:1,color:i,linecap:"square"}),s.line(5,10,10,5).stroke({width:1,color:i,linecap:"square"})})).id(h)}drawTotalLabel(t={percent:2,decimal:1},i=new x,s){if(this.stackMode===c.RELATIVE)return;const h=this.stack.total<0,e=h?0-this.stack.negative:this.stack.positive,n=this.position.getColumnCenterPositionX(this.index),r=this.position.getColumnDataLabelPositionY(e*this.dataPoint.pixelPerUnit);new g(this.group,n,r,"STACK_TOTAL",this.stack.total,this.styles,h?y.Top:y.Bottom,y.Center).setPoint(s,"total").draw(!0,t,i)}}const Lt=[{fill:"#000000",opacity:.3},{fill:"#555555",opacity:.25},{fill:"#999999",opacity:.2},{fill:"#bbbbbb",opacity:.15},{fill:"#dddddd",opacity:.1}];class xt{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=T[s]||T.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=T[s]||T.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 kt{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 x){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=y.Bottom;return null!=t.value&&t.value<0&&(i=y.Top),new g(this.scenarioGroup,this.position.getColumnCenterPositionX(this.index),this.position.getColumnDataLabelPositionY(this.dataPoint.getScaledUnit()),this.ID_DATA_PREFIX,t.value,this.styles,i,y.Center)}getScenarioLabel(t){return new g(this.scenarioGroup,0,0,this.ID_SCENARIO_PREFIX,t,this.styles,y.Bottom,y.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 x){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 Mt{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 kt(this.position,this.styles,i,s,h,!1,e,r).updateLabelGroup(n)}createPrimaryBar(t,i,s=!0){const h=this.svgGroups.scenario1.group().id(""+i),e=this.svgGroups.scenario1Label.group().id(""+i);let n=null;return s&&this.isLastDataPoint(i)&&(n=`${this.i18n.get(t.scenario)||t.scenario}`),new bt(this.position,this.styles,t,i,!0,h,n,this.overflowConfig).updateLabelGroup(e)}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 bt(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 yt(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 bt(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 gt(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 gt(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,s){const h=this.svgGroups.parent.group().id("LineSeries_"+i),e=this.svgGroups.scenario1Label.group().id("LineSeries_Label_"+i),n=`${this.i18n.get(i)||i}`;return new St(this.position,this.styles,t,h,e,i,n,this.i18n,this.collisionManager,s)}}const Ct="bn-measurement-host";function At(t,i){const s=function(){if("undefined"==typeof document||!document.body)return null;let t=document.getElementById(Ct);return t||(t=document.createElement("div"),t.id=Ct,t.style.cssText="opacity:0;position:absolute;left:-100%;top:-100%;overflow:hidden",t.setAttribute("aria-hidden","true"),document.body.appendChild(t)),t}();if(s){s.appendChild(t.node);try{i()}finally{t.node.parentNode===s&&s.removeChild(t.node)}}else i()}var Ot,Nt;!function(t){t[t.UP_TO_DATE=0]="UP_TO_DATE",t[t.DIRTY=1]="DIRTY"}(Ot||(Ot={})),function(t){t.RELATIVE="dr",t.ABSOLUTE="d",t.NONE=""}(Nt||(Nt={}));class Tt{constructor(t,i,s,h,e,n=0){this.CSS_CATEGORIES="categories",this.dataModel=[],this.variancesDataModel=[],this.title="",this.configTitle="",this.configVariances=[],this.smallestDataPointValue=new ct(0,pt.AC1,1,pt.NEU),this.highestDataPointValue=new ct(0,pt.AC1,1,pt.NEU),this.smallestVarianceDataPointValue=new ct(0,pt.AC1,1,pt.NEU),this.highestVarianceDataPointValue=new ct(0,pt.AC1,1,pt.NEU),this.pixelPerUnit=1,this.pixelPerPercentage=1,this.hideAxisLabels=!1,this.axisScenario=pt.AC1,this.fromExpr="",this.rowCount=0,this.axisCategoryArea={width:0,height:0},this.scenariosArea={width:0,height:0},this.state=Ot.DIRTY,this.i18n=new Map,this.leftSideOffsetForHorizontalSync=-1,this.dateInterval=F.DAY,this.locale="de",this.axisLabelsMode=u.SMART,this.intervalSpanLimit=32,this.measureScale=new x,this.measureUnit="",this.dataFormatDigits={percent:2,decimal:1},this.showOverlayMedian=!1,this.showOverlayAvg=!1,this.chartMode=d.BAR,this.maxBars=28,this.stackConfig=null,this.scenarioPropOrder=[],this.lineFullWidth=!0,this.availableWidth=0,this.overflowConfig=null,this.lastScenarios=[],this.axisLabelsStep=1,this.scenarioSwitch=!1,this.axisTitlePosition="left",this.varianceOverlaps=0,this.db=i,this.tableName=s,this.ruleSet=t||new q,this.i18n=this.createI18n(new Map),this.styles=e,this.availableWidth=n,this.setConfig(h),this.position=this.createElementPosition(this.lastScenarios)}updatePosition(t){this.position=this.createElementPosition(t)}setStyles(t){this.styles=t}setRuleSet(t){this.ruleSet=t||new q}setAvailableWidth(t){this.availableWidth=t}setAvailableHeight(t){this.pixelPerUnit<=0||t<=0?this.overflowConfig=null:null==this.stackConfig&&this.determineEffectiveChartMode()===d.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+this.switchNamesHeight())-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,s,h,e;this.state=Ot.DIRTY,this.locale=t.locale,this.scenarioPropOrder=[...t.scenarios];const n=this.sortScenariosbyVisualisationRules(t.scenarios);if(this.setSource(t.filter),this.hideAxisLabels=t.hideAxisLabels||!1,this.pixelPerUnit=t.pixelPerUnit,this.pixelPerPercentage=t.pixelPerPercentage,this.axisLabelsMode=t.axisLabelsMode,this.intervalSpanLimit=t.intervalSpanLimit,this.axisLabelsStep=null!==(i=t.axisLabelsStep)&&void 0!==i?i:1,this.scenarioSwitch=null!==(s=t.scenarioSwitch)&&void 0!==s&&s,this.axisTitlePosition=null!==(h=t.axisTitlePosition)&&void 0!==h?h:"left",this.dateInterval=this.findDateInterval(t.dateInterval),this.stackConfig=t.stackConfig,this.dataModel=this.populateModel(n,this.dateInterval),this.variancesDataModel=this.populateVarianceModel(t.variances,this.dataModel),this.configTitle=t.title,this.configVariances=null!==(e=null==t?void 0:t.variances)&&void 0!==e?e:[],this.updateTitle(),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=n,null!=this.stackConfig){const t=[];for(const i of this.dataModel)t.push(...this.stackGroups(i).map((t=>t.layout)));const i=W(t),{scenario:s,variance:h}=this.highestDataPointValue;this.highestDataPointValue=new ct(i.positive,s,this.pixelPerUnit,h),this.smallestDataPointValue=new ct(0-i.negative,s,this.pixelPerUnit,h)}this.updatePosition(n)}getFooter(){return 1===this.measureScale.value&&""===this.measureUnit?" ":m.translateScenarioLabel("in",this.i18n)+" "+this.measureScale.prefix+this.measureUnit}sortScenariosbyVisualisationRules(t){const i=this;return[...t].sort(((t,s)=>i.ruleSet.getScenarioSorIndex(t)-i.ruleSet.getScenarioSorIndex(s))).reverse()}setI18n(t){this.i18n=this.createI18n(t),this.updateTitle()}updateTitle(){var t,i;const s=this.scenarioSwitch?null===(t=this.configVariances)||void 0===t?void 0:t[0]:null===(i=this.configVariances)||void 0===i?void 0:i.toString();this.title=this.configTitle||m.translateScenarioLabel(s,this.i18n)}setSource(t){var i,s;if(this.state=Ot.DIRTY,this.queryError=void 0,this.fromExpr=j(this.db,this.tableName,t),this.fromExpr)try{const t=this.db.exec(`SELECT COUNT(*) AS cnt FROM ${this.fromExpr}`);this.rowCount=null!==(s=null===(i=t[0])||void 0===i?void 0:i.cnt)&&void 0!==s?s:0}catch(t){this.rowCount=0,this.failQuery(t)}else this.rowCount=0}getQueryError(){return this.queryError}failQuery(t){var i;null!==(i=this.queryError)&&void 0!==i||(this.queryError=H(t))}getAllocatedCanvasWidth(){const t=this.position.getAxisEndPositionX(),i=3*this.styles.fontStyles.size,s=Math.max(this.axisCategoryArea.width,this.scenariosArea.width),h=s>0?s+this.position.leftSideLabelLength:0;let e=0;if("right"===this.axisTitlePosition&&this.title){const i=p(this.title,{font:this.styles.fontStyles.font,fontSize:this.styles.fontStyles.size+"px"}).width;e=t+this.position.spacings.labelToColumn+i+this.styles.padding.right}const n=this.legendWidth("right");return Math.max(t+i,h,e,n>0?t+this.position.spacings.labelToColumn+n+this.styles.padding.right: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===Nt.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)+this.switchNamesHeight()}switchNamesHeight(){return!this.hideAxisLabels&&this.contextRow().length>0?this.position.dataLabelHeight:0}parentPeriodLabel(t){if(this.axisLabelsMode!==u.TWO_ROW||null==t||!t.isValid)return"";switch(this.dateInterval){case F.MONTH:case F.QUARTER:return t.setLocale(this.locale).toFormat("yyyy");case F.WEEK:return t.setLocale(this.locale).toFormat("kkkk");case F.DAY:return t.setLocale(this.locale).toFormat("LLL yyyy");default:return""}}contextRow(){const t=this.switchRuns();if(this.axisLabelsMode!==u.TWO_ROW)return t.map((t=>({from:t.from,to:t.to,text:m.translateScenarioLabel(t.scenario,this.i18n),scenario:t.scenario})));if(!this.isVarianceChart()&&this.determineEffectiveChartMode()!==d.BAR)return[];const i=this.isVarianceChart()?this.variancesDataModel:this.dataModel,s=[];let h="";return i.forEach(((i,e)=>{var n;const r=t.find((t=>t.from===e)),o=this.parentPeriodLabel(i.date),l=[];""!==o&&o!==h&&l.push(o),h=o,r&&l.push(m.translateScenarioLabel(r.scenario,this.i18n)),l.length>0&&s.push({from:e,to:e,text:l.join(" "),scenario:null!==(n=null==r?void 0:r.scenario)&&void 0!==n?n:"parent"})})),s}static hasValue(t){return null!=t&&!t.isEmpty()&&null!=t.value&&!Number.isNaN(t.value)}followerSlots(){return!this.scenarioSwitch||null!=this.stackConfig&&this.stackConfig.by!==f.DIMENSIONS||this.determineEffectiveChartMode()!==d.BAR?[]:["scenario2","scenario3","scenario4"].filter((t=>{let i=0;for(const s of this.dataModel)if(Tt.hasValue(s[t])){if(Tt.hasValue(s.scenario1))return!1;i++}return i>0}))}visibleSlot(t,i){var s;return Tt.hasValue(t.scenario1)?"scenario1":null!==(s=i.find((i=>Tt.hasValue(t[i]))))&&void 0!==s?s:null}switchRuns(){if(!this.scenarioSwitch||null!=this.stackConfig&&this.stackConfig.by!==f.DIMENSIONS||this.determineEffectiveChartMode()!==d.BAR)return[];const t=this.followerSlots();if(0===t.length&&1!==this.scenarioPropOrder.length)return[];const i=[];return this.dataModel.forEach(((s,h)=>{const e=this.visibleSlot(s,t),n=e?s[e].scenario:null,r=i[i.length-1];null!=n&&(null==r?void 0:r.scenario)!==n?i.push({scenario:n,from:h,to:h}):r&&(r.to=h)})),i}getIgnoredSwitchScenarios(){var t;if(!this.scenarioSwitch||(null===(t=this.stackConfig)||void 0===t?void 0:t.by)!==f.DIMENSIONS||this.isVarianceChart())return[];const i=this.followerSlots();return["scenario2","scenario3","scenario4"].filter((t=>!i.includes(t)&&this.dataModel.some((i=>Tt.hasValue(i[t]))))).map((t=>{var i;return null===(i=this.dataModel.find((i=>{var s;return null!=(null===(s=i[t])||void 0===s?void 0:s.scenario)})))||void 0===i?void 0:i[t].scenario}))}getVarianceOverlaps(){return this.varianceOverlaps}fitRelativeVariances(t){const i=this.variancesDataModel.filter((t=>t.type===Nt.RELATIVE)).map((t=>t.scenario1));if(0===i.length||!i.some((t=>t.isClipped())))return;const s=t=>{i.forEach((i=>i.percentClamp=t)),this.updatePosition(this.lastScenarios)};s(Number.POSITIVE_INFINITY),this.layout(),t>0&&this.getAllocatedCanvasHeight()<=t||s(ct.PERCENT_CLAMP)}getUnitBarExtent(){var t,i;const s=this.isVarianceChart()&&this.variancesDataModel.some((t=>t.type===Nt.RELATIVE)),h=this.isVarianceChart(),e=h?this.highestVarianceDataPointValue:this.highestDataPointValue,n=h?this.smallestVarianceDataPointValue:this.smallestDataPointValue;return B({relativeVariance:s,maxPositive:null!==(t=null==e?void 0:e.value)&&void 0!==t?t:0,minNegative:this.isOnSameAxisSide()?0:null!==(i=null==n?void 0:n.value)&&void 0!==i?i:0})}getPercentBarExtent(){var t,i,s,h;const e=this.isVarianceChart()&&this.variancesDataModel.some((t=>t.type===Nt.RELATIVE));return z({relativeVariance:e,maxPositive:null!==(i=null===(t=this.highestVarianceDataPointValue)||void 0===t?void 0:t.value)&&void 0!==i?i:0,minNegative:this.isOnSameAxisSide()?0:null!==(h=null===(s=this.smallestVarianceDataPointValue)||void 0===s?void 0:s.value)&&void 0!==h?h:0})}layout(){const t=new n;At(t,(()=>this.draw(t)))}toString(){const t=new n;return At(t,(()=>this.draw(t))),t.id("drawCanvas"),t.width(this.getAllocatedCanvasWidth()),t.height(this.getAllocatedCanvasHeight()),t.attr("overflow","visible"),t.svg()}applyFontToContainer(t){t.attr({"font-size":this.styles.fontStyles.size,"font-family":this.styles.fontStyles.family})}draw(t){this.cleanSVGforRedraw(t),this.applyFontToContainer(t),this.state===Ot.DIRTY&&(this.state=Ot.UP_TO_DATE),this.isVarianceChart()?(this.drawVarianceScenario(this.variancesDataModel,t),this.drawAxisAndLabels(this.variancesDataModel,t)):null!=this.stackConfig?this.determineEffectiveChartMode()===d.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()===d.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===d.LINE||this.chartMode===d.AUTO&&this.dataModel.length>this.maxBars?d.LINE:d.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=Ot.DIRTY;const i=new Map([["SEPARATOR_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"," "],["thereof","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=p(t.filter(((t,i)=>1===i||2===i)).map((t=>m.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),i=Math.max(i,this.legendWidth("left")),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 ct(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===d.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 et;Object.assign(s,h),s.categoryWidth=i,r=s}}return new rt(new ot(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=p(i,{font:this.styles.fontStyles.font,fontSize:this.styles.fontStyles.size+"px"}).width;return s<t?t:s}scenarioStyles(){const t=Z(this.styles.barStyles,this.ruleSet);return t===this.styles.barStyles?this.styles:Object.assign(Object.create(Object.getPrototypeOf(this.styles)),this.styles,{barStyles:t})}setAxisScenario(t){let i=pt.AC1;if(null!=t&&t.length>0){const s=new b(t.toString());s.isValid&&(i=Q(this.ruleSet.getScenarioColorIndex(s.delta))+s.delta.slice(2))}return null===i&&(i=pt.AC1),i}populateModel(t,i){var s;if(0===this.rowCount||!this.fromExpr)return[];let h=this.queryDataSet(i,"","");this.detectNaNCells(t,h),h=this.leftOuterJoinDates(h,i);const e=this.createDataRows(h,t);return(null===(s=this.stackConfig)||void 0===s?void 0:s.by)===f.DIMENSIONS&&this.populateSeries(e,t,i),e}populateSeries(t,i,s){const h=this.queryDataSet(s,", [category]",", [category]");this.detectNaNCells(i,h);const e=t=>null==t.category?"":String(t.category),n=t=>{var i,s;return null!==(s=null===(i=null==t?void 0:t.toMillis)||void 0===i?void 0:i.call(t))&&void 0!==s?s:Number.NaN},r=[],o=new Map;for(const t of h){const i=e(t);r.includes(i)||r.push(i);const s=n(t.calcdate);o.has(s)||o.set(s,new Map),o.get(s).set(i,t)}try{const t=this.db.exec(`SELECT [category], MIN(categoryIndex) AS idx FROM ${this.fromExpr} GROUP BY [category]`),i=new Map(t.map((t=>[null==t.category?"":String(t.category),t.idx])));r.every((t=>Number.isFinite(i.get(t))))&&r.sort(((t,s)=>i.get(t)-i.get(s)))}catch(t){}const l=["scenario1","scenario2","scenario3","scenario4"];for(const s of t){const t=o.get(n(s.date));s.series=r.map((h=>{const e=null==t?void 0:t.get(h),n={};return l.forEach(((t,r)=>{const o=i[r];if(null==o)return;const l=null==e?void 0:e[o],a="number"==typeof l?l:Number.NaN,c=new ct(a,o,this.pixelPerUnit,pt.NEU);Number.isFinite(a)&&(c.key={date:Tt.pointDate(s.date),scenario:o,category:h}),n[t]=c})),{key:h,points:n}}))}}detectNaNCells(t,i){i.forEach((i=>(t.forEach((t=>{const s=new b(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){if(t!==F.AUTO)return t;const i=this.queryDates();if(0===i.length)return F.DAY;let s=i[0],h=i[0];for(const t of i)t<s&&(s=t),t>h&&(h=t);return(new I).calculateDistanceType(s,h,this.intervalSpanLimit)}queryDates(){if(0===this.rowCount)return[];let t;try{t=this.db.exec(`SELECT DISTINCT [date] FROM ${this.fromExpr}`)}catch(t){return this.failQuery(t),[]}return t.map((t=>Tt.coerceDateTime(t.date))).filter((t=>null!=t))}static coerceDateTime(t){if(null!=t){if("string"==typeof t){const i=E.fromISO(t,{zone:"utc"});return i.isValid?i:void 0}if("number"==typeof t){const i=E.fromMillis(t,{zone:"utc"});return i.isValid?i:void 0}return"boolean"==typeof t.isValid?t:void 0}}queryDataSet(t,i,s){const h=["ac1","ac2","ac3","ac4","pp1","pp2","pp3","pp4","fc1","fc2","fc3","fc4","pl1","pl2","pl3","pl4"],e=`normalizeDate([date], '${t}' , '${this.locale}') as calcdate`;let n;try{n=this.db.exec(`SELECT p.calcdate ${i},\n ${h.map((t=>`SUM(${t} * transformOperator(operation)) as ${t}, COUNT(ISNULL(${t})) as ${t}_cnt`)).join(",")}\n\n FROM (SELECT ${e} ${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 ${this.fromExpr}) as p\n GROUP BY calcdate ${s}\n ORDER BY calcdate asc`)}catch(t){return this.failQuery(t),[]}return n}createDataRows(t,i){var s;const h=[];t.forEach(((t,s)=>{h.push({id:s,category:t.category,type:Nt.NONE,date:t.calcdate,scenario1:new ct(t[i[0]],i[0],this.pixelPerUnit,pt.NEU),scenario2:new ct(t[i[1]],i[1],this.pixelPerUnit,pt.NEU),scenario3:new ct(t[i[2]],i[2],this.pixelPerUnit,pt.NEU),scenario4:new ct(t[i[3]],i[3],this.pixelPerUnit,pt.NEU)})}));for(const t of h)for(const i of[t.scenario1,t.scenario2,t.scenario3,t.scenario4])null==i.value||Number.isNaN(i.value)||(i.key={date:Tt.pointDate(t.date),scenario:null!==(s=i.scenario)&&void 0!==s?s:void 0});return h}static pointDate(t){var i;return M(null===(i=null==t?void 0:t.toISO)||void 0===i?void 0:i.call(t))}findSmallestDataPointValue(t){const i=this.isVarianceChart()?this.pixelPerPercentage:this.pixelPerUnit;let s=new ct(0,"default",i,pt.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 ct(0,"default",i,pt.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]),this.varianceOverlaps=0;const e=t.map((t=>new b(t)));if(this.scenarioSwitch&&e.filter((t=>t.isValid)).length>1)return this.populateSharedVarianceRow(t,e,i,h);for(const e in t){const n=new b(t[e]);if(n.isValid){const r=this.mapScenarios(n,h),o=n.direction,l="dr"===n.type?this.pixelPerPercentage:this.pixelPerUnit;for(const h in i){const a=new ct(this.calculateVariance(n,i[h],r),n.delta,l,o);null===a.value||Number.isNaN(a.value)||(a.key={date:Tt.pointDate(i[h].date),scenario:t[e]}),s.push({id:Number(h),category:i[h].category,type:"dr"===n.type?Nt.RELATIVE:Nt.ABSOLUTE,date:i[h].date,scenario1:a,scenario2:new ct(null,null,null,null),scenario3:new ct(null,null,null,null),scenario4:new ct(null,null,null,null)})}}}return s}populateSharedVarianceRow(t,i,s,h){const e=[],n=i.map(((i,s)=>({variance:i,name:t[s]}))).filter((t=>t.variance.isValid)),r="dr"===n[0].variance.type,o=r?this.pixelPerPercentage:this.pixelPerUnit;return s.forEach(((t,i)=>{let s=null,l=0;for(const{variance:i,name:e}of n){const n=this.calculateVariance(i,t,this.mapScenarios(i,h));null===n||Number.isNaN(n)||(l++,null==s&&(s=new ct(n,i.delta,o,i.direction),s.notation=i.base.slice(0,2),s.key={date:Tt.pointDate(t.date),scenario:e}))}l>1&&this.varianceOverlaps++,e.push({id:i,category:t.category,type:r?Nt.RELATIVE:Nt.ABSOLUTE,date:t.date,scenario1:null!=s?s:new ct(null,n[0].variance.delta,o,n[0].variance.direction),scenario2:new ct(null,null,null,null),scenario3:new ct(null,null,null,null),scenario4:new ct(null,null,null,null)})})),e}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===Nt.RELATIVE?O(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(){const t=new I;t.setLocale(this.locale);const i=this.i18n.get("date-format-short-year");return"string"==typeof i&&/y/.test(i)&&!i.includes("date-format")&&t.patchDateFormatShort({year:i}),t}dateLabelPlace(t){let i=t.scenario1.value<0,s=this.position.spacings.labelToAxis;if(null!=this.stackConfig&&!this.isVarianceChart()){const h=this.stackConfig.mode!==c.RELATIVE&&this.determineEffectiveChartMode()!==d.LINE?(this.position.spacings.labelToColumn+this.position.dataLabelHeight)/this.pixelPerUnit:0,e=this.stackGroups(t).filter((t=>t.hasValue)).map((t=>t.layout));let n=G(e,(()=>h));n.flipped&&h>0&&e.some((t=>t.total>=0))&&(n={flipped:!1,clearance:Math.max(...e.map((t=>t.negative+(t.total<0?h:0))))}),i=n.flipped,s+=n.clearance*this.pixelPerUnit}return i?{hookLocation:y.Bottom,offset:-s}:{hookLocation:y.Top,offset:s}}drawAxisAndLabels(t,i){const s=this.createDateFactory(),h=i.group().id("AxisAndDateLables");let e=!1;if(!1===this.hideAxisLabels)t.forEach(((t,i)=>{const{hookLocation:n,offset:r}=this.dateLabelPlace(t);t.type===Nt.RELATIVE&&(e=!0);const o=this.axisLabelsMode===u.SMART&&s.isSmartBoundary(t.date,this.dateInterval);if(i%this.axisLabelsStep!=0&&!o)return;let l=s.getDateString(t.date,this.dateInterval);this.axisLabelsMode===u.SMART?(l=s.getSmartDateString(t.date,this.dateInterval),0===i&&this.dateInterval!==F.YEAR&&(l=s.getShortDateString(t.date,this.dateInterval))):(this.axisLabelsMode===u.SHORT||this.axisLabelsMode===u.TWO_ROW&&this.dateInterval!==F.YEAR)&&(l=s.getShortDateString(t.date,this.dateInterval)),new g(h,this.position.getColumnCenterPositionX(i),this.position.getAxisPositionY(e)+r,"",l,this.styles,n,y.Center).forceStringTypeDraw()}));else{const i=null==t?void 0:t[0];i&&i.type===Nt.RELATIVE&&(e=!0)}new mt({scenarioType:this.axisScenario,labelText:this.title,isRelative:e,titlePosition:this.axisTitlePosition},this.position,h).draw();const n=h.bbox();this.axisCategoryArea={height:n.height,width:n.width},this.drawScenarioSwitch(i)}drawScenarioSwitch(t){const i=this.switchRuns(),s=this.contextRow();if(i.length<2&&0===s.length)return;const h=t.group().id("ScenarioSwitch"),e=this.switchNamesHeight(),n=this.getAllocatedCanvasHeight(),r=e>0?n-this.styles.padding.bottom:n,o=Math.max(1,this.position.spacings.auxiliaryLineWidth);if(i.slice(1).forEach((t=>{const i=(this.position.getColumnCenterPositionX(t.from-1)+this.position.getColumnCenterPositionX(t.from))/2;h.line(i,0,i,r).stroke({color:this.styles.fontStyles.color||"#000000",width:o}).addClass("scenario-switch")})),0===e)return;const l=this.axisLabelsMode===u.TWO_ROW;s.forEach((t=>{const i=l?this.position.getColumnCenterPositionX(t.from)-this.position.getColumnWidth()/2:(this.position.getColumnCenterPositionX(t.from)+this.position.getColumnCenterPositionX(t.to))/2;new g(h,i,r-e,"SWITCH_"+t.scenario+"_"+t.from,t.text,this.styles,y.Top,l?y.Left:y.Center).forceStringTypeDraw()}))}drawScenarios(t,i){const s=i.group().id("Scenarios"),h=new Mt(this.position,s,this.scenarioStyles(),t.length,this.i18n);h.setOverflowConfig(this.overflowConfig);let e=!1;const n=this.followerSlots();t.forEach(((t,i)=>{const s=n.length>0?this.visibleSlot(t,n):"scenario1";null!=s&&"scenario1"!==s?(h.createPrimaryBar(t[s],i,!1).draw(this.dataFormatDigits,this.measureScale),e=!0):h.createPrimaryBar(t.scenario1,i).draw(this.dataFormatDigits,this.measureScale),"scenario2"!==s&&h.createSecondaryBar(t.scenario2,i).draw(),"scenario3"!==s&&h.createPrimaryMarker(t.scenario3,i).draw(),"scenario4"!==s&&h.createSecondaryMarker(t.scenario4,i).draw(),!1===t.scenario1.isEmpty()&&(e=!0)}));let r=0;!1===e&&(r=this.isOnSameAxisSide()?this.position.dataLabelHeight:2*this.position.dataLabelHeight);const o=s.bbox();this.scenariosArea={height:o.height+this.styles.padding.top+this.styles.padding.bottom+r,width:o.width+this.position.spacings.columnWidth}}drawLineScenarios(t,i){var s,h;const e=i.group().id("LineScenarios"),n=new P,r=new Mt(this.position,e,this.scenarioStyles(),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)=>(L[i.scenarioType]||99)-(L[t.scenarioType]||99)));const c=[];for(const t of a){const i=r.createLineSeries(t.points,t.scenarioName,Q(this.ruleSet.getScenarioColorIndex(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)=>(L[t.scenarioType]||99)-(L[i.scenarioType]||99)));for(const t of u)t.series.drawLabels(this.dataFormatDigits,this.measureScale);const d=this.position.getColumnPositionY(),f=e.bbox();this.scenariosArea={height:Math.max(f.height+this.styles.padding.top,d)+this.styles.padding.bottom,width:f.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;const{hookLocation:o,offset:l}=this.dateLabelPlace(i);let a;this.lineFullWidth&&this.availableWidth>0?this.axisLabelsMode===u.SMART?(a=s.getSmartDateString(i.date,this.dateInterval),0===r&&this.dateInterval!==F.YEAR&&(a=s.getShortDateString(i.date,this.dateInterval))):a=this.axisLabelsMode===u.SHORT?s.getShortDateString(i.date,this.dateInterval):s.getDateString(i.date,this.dateInterval):a=s.getShortDateString(i.date,this.dateInterval),new g(h,this.position.getColumnCenterPositionX(r),this.position.getAxisPositionY(e)+l,"",a,this.styles,o,y.Center).forceStringTypeDraw(),r>0&&r<n&&this.isYearChange(t,r)&&this.drawYearSeparatorLine(h,r,e)})),new mt({scenarioType:this.axisScenario,labelText:this.title,isRelative:e},this.position,h).draw();const r=h.bbox();this.axisCategoryArea={height:r.height,width:r.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)&&(this.dateInterval===F.WEEK?e.weekYear!==n.weekYear: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:$}).attr("stroke-dasharray",$)}drawVarianceScenario(t,i){const s=i.group().id("Scenarios"),h=new Mt(this.position,s,this.scenarioStyles(),t.length,this.i18n);h.setOverflowConfig(this.overflowConfig),t.forEach(((t,i)=>{t.type===Nt.RELATIVE?h.createRelativeVarianceBar(t.scenario1,i).draw(this.dataFormatDigits):h.createVarianceBar(t.scenario1,i).draw(this.dataFormatDigits,this.measureScale)}));const e=s.bbox();return this.scenariosArea={height:e.height+this.styles.padding.top+this.styles.padding.bottom,width:e.width+this.position.spacings.columnWidth},s}sortSegmentsByPropOrder(t){if(0===this.scenarioPropOrder.length)return;const i=this.scenarioPropOrder;t.sort(((t,s)=>{const h=i.indexOf(t.scenario),e=i.indexOf(s.scenario);return(-1===h?i.length:h)-(-1===e?i.length:e)}))}stackGroups(t){var i;if(!this.stackConfig)return[];const s=this.stackConfig.by===f.SCENARIOS,h=this.determineEffectiveChartMode()===d.LINE,e=this.stackConfig.mode===c.RELATIVE?v:0,n=t=>Number.isFinite(t.value)?t.value:0,r=t=>{"asc"===this.stackConfig.order?t.sort(((t,i)=>n(t)-n(i))):"desc"===this.stackConfig.order&&t.sort(((t,i)=>n(i)-n(t)))};if(!s&&!h&&t.series){const s=null!==(i=this.visibleSlot(t,this.followerSlots()))&&void 0!==i?i:"scenario1",h=[];return t.series.forEach(((t,i)=>{const e=t.points[s];e&&h.push({value:e.value,scenario:e.scenario,dataPoint:e,colorIndex:i,label:t.key})})),h.some((t=>Number.isFinite(t.value)))?(r(h),[{prefix:"",segments:h,layout:X(h.map((t=>t.value)),e),hasValue:!0}]):[]}const o=[];for(const i of s?["scenario1","scenario2","scenario3","scenario4"]:["scenario1"]){const s=t[i];s&&!s.isEmpty()&&null!=s.value&&o.push({value:s.value,scenario:s.scenario,dataPoint:s})}if(0===o.length)return[];const l=(t,i)=>({prefix:t,segments:i,layout:X(i.map((t=>t.value)),e),hasValue:i.some((t=>Number.isFinite(t.value)))});if(s&&this.sortSegmentsByPropOrder(o),h)return[l("",o)];if(s){const t=new Map;for(const i of o){const s=_(i.scenario);t.has(s)||t.set(s,[]),t.get(s).push(i)}if(t.size>1){const i=[];for(const s of D)t.has(s)&&(i.push(l(s,t.get(s))),t.delete(s));for(const[s,h]of t)i.push(l(s,h));return i}}return r(o),[l("",o)]}drawStackedScenarios(t,i){if(!this.stackConfig)return;const s=i.group().id("StackedScenarios"),h=this.stackConfig.by===f.SCENARIOS;t.forEach(((t,i)=>{const e=this.stackGroups(t);e.forEach(((n,r)=>{let o=null;n.segments.forEach(((t,l)=>{var a;const c=new Pt(this.position,this.styles,t.dataPoint,i,n.layout.segments[l],t.scenario,e.length>1?e.length-1-r:null!==(a=t.colorIndex)&&void 0!==a?a:l,this.stackConfig.mode,n.layout,h,s,"scenario"===this.stackConfig.notation,this.hasPercentMark());c.draw(this.dataFormatDigits,this.measureScale),o=c})),o&&n.hasValue&&o.drawTotalLabel(this.dataFormatDigits,this.measureScale,{date:Tt.pointDate(t.date),scenario:e.length>1?n.prefix:void 0})}))}));const e=s.bbox();this.scenariosArea={height:e.height+this.styles.padding.top+this.styles.padding.bottom,width:e.width+this.position.spacings.columnWidth}}hasPercentMark(){var t;return(null===(t=this.stackConfig)||void 0===t?void 0:t.mode)===c.RELATIVE&&!0===this.stackConfig.percentMark}percentMarkSide(){var t;return"right"===(null===(t=this.stackConfig)||void 0===t?void 0:t.legend)?"right":"left"}seriesName(t){return this.i18n.get(t)||t}legendWidth(t){var i,s;if(!this.stackConfig||this.determineEffectiveChartMode()!==d.BAR)return 0;const h=null!==(i=this.stackConfig.legend)&&void 0!==i?i:"left",e=[];if(h===t||"both"===h){const i=null===(s=this.dataModel.find((t=>null!=t.series)))||void 0===s?void 0:s.series;i?e.push(...i.map((t=>this.seriesName(t.key)))):"right"===t&&this.stackConfig.by===f.SCENARIOS&&e.push(...this.lastScenarios.map((t=>this.i18n.get(t)||t)))}this.hasPercentMark()&&this.percentMarkSide()===t&&e.push("100%");let n=0;for(const t of e)n=Math.max(n,p(t,{font:this.styles.fontStyles.font,fontSize:this.styles.fontStyles.size+"px"}).width);return n}drawStackedHeaders(t,i){var s,h,e;if(!this.stackConfig||0===t.length)return;const n=this.stackConfig.by===f.SCENARIOS,r=t.some((t=>null!=t.series));if(!n&&!r)return;const o=i.group().id("StackedHeaders"),l=this.position.getColumnPositionY(),a=this.position.getColumnWidth()/2,c=this.position.spacings.labelToColumn,u=t.map(((t,i)=>this.stackGroups(t).length>0?i:-1)).filter((t=>t>=0)),d=r&&null!==(s=u[0])&&void 0!==s?s:0,v=null!==(h=u[u.length-1])&&void 0!==h?h:t.length-1,p=i=>{const s="left"===i?d:v,h=this.stackGroups(t[s]);if(0===h.length)return;const e=this.position.getColumnCenterPositionX(s),n="left"===i?e-a-c:e+a+c,r=(t,s)=>{new g(o,n,t,"STACK_HEADER",s,this.styles,y.Center,"left"===i?y.Right:y.Left).forceStringTypeDraw()};if(h.length>1)return void h.forEach(((t,i)=>{const{positive:s,negative:e,total:n}=t.layout;r(l-(i===h.length-1?(s-e)/2:n<0?0-e:s)*t.segments[0].dataPoint.pixelPerUnit,this.i18n.get(t.prefix+"1")||t.prefix.toUpperCase())}));const[u]=h;u.segments.forEach(((t,i)=>{if(null!=t.label&&!Number.isFinite(t.value))return;const{start:s,end:h}=u.layout.segments[i];r(l-(s+h)/2*t.dataPoint.pixelPerUnit,null!=t.label?this.seriesName(t.label):this.i18n.get(t.scenario)||t.scenario)}))},w=null!==(e=this.stackConfig.legend)&&void 0!==e?e:"left";"left"!==w&&"both"!==w||p("left"),"right"!==w&&"both"!==w||p("right"),this.hasPercentMark()&&u.length>0&&this.drawPercentMark(o,"left"===this.percentMarkSide()?d:v)}drawPercentMark(t,i){const s=this.percentMarkSide(),h="left"===s?-1:1,e=this.position.getColumnPositionY()-v*this.pixelPerUnit,n=this.position.getColumnCenterPositionX(i)+h*(this.position.getColumnWidth()/2),r=.45*this.styles.fontStyles.size,o=n+1*h,l=o+h*r;t.polygon([[o,e],[l,e-r/2],[l,e+r/2]]).fill(this.styles.fontStyles.color||"#000000").addClass("percent-mark"),new g(t,l,e-r/2,"STACK_PERCENT_MARK","100%",this.styles,y.Bottom,"left"===s?y.Right:y.Left).forceStringTypeDraw()}drawStackedAreaScenarios(t,i){if(!this.stackConfig)return;const s=i.group().id("StackedAreaScenarios"),h=this.stackConfig.by===f.SCENARIOS,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=[];for(const i of h?n:["scenario1"])t.some((t=>t[i]&&!t[i].isEmpty()))&&o.push(i);if(h&&this.scenarioPropOrder.length>0){const i=this.scenarioPropOrder;o.sort(((s,h)=>{var e,n,r,o;const l=i.indexOf(null!==(n=null===(e=t[0][s])||void 0===e?void 0:e.scenario)&&void 0!==n?n:""),a=i.indexOf(null!==(o=null===(r=t[0][h])||void 0===r?void 0:r.scenario)&&void 0!==o?o:"");return(-1===l?i.length:l)-(-1===a?i.length:a)}))}for(const i of o){const s=t[0][i];r.push((null==s?void 0:s.scenario)||"ac1")}const l=(t,i)=>{const s=t[i];return s&&!s.isEmpty()&&Number.isFinite(s.value)?s.value:0},a=o.map((i=>t.reduce(((t,s)=>t+l(s,i)),0)<0?-0:0)),u=e===c.RELATIVE?v:0,d=t.map((t=>X(o.map(((i,s)=>l(t,i)||a[s])),u))),p=this.position.getColumnPositionY(),w=this.pixelPerUnit,m=(t,i)=>d.map(((s,h)=>({x:this.position.getColumnCenterPositionX(h),y:p-s.segments[t][i]*w})));for(let t=0;t<o.length;t++){const i=m(t,"end"),e=m(t,"start"),n=h?Q(this.ruleSet.getScenarioColorIndex(r[t])):null,o=new xt(s,i,e,n,t,h);o.draw(),o.drawBoundaryLine()}const b=s.bbox();this.scenariosArea={height:b.height+this.styles.padding.top+this.styles.padding.bottom,width:b.width+this.position.spacings.columnWidth}}drawOverlayLayer(t,i){if(0===t.length)return;const s=i.group().id("Overlay"),h=new Mt(this.position,s,this.scenarioStyles(),t.length,this.i18n);if(!0===this.showOverlayAvg){let i=null;const s=function(t){const i=$t(t),s=i.length>0?i.reduce(((t,i)=>t+i),0)/i.length:NaN,h=Object.assign(Object.assign({},t[0]),{scenario1:new ct(s,t[0].scenario1.scenario,t[0].scenario1.pixelPerUnit,t[0].scenario1.variance)}),e=Object.assign(Object.assign({},t[t.length-1]),{scenario1:new ct(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 ct(s,t.scenario1.scenario,t.scenario1.pixelPerUnit,t.scenario1.variance)}))),e]}(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(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 ct(s,t[0].scenario1.scenario,t[0].scenario1.pixelPerUnit,t[0].scenario1.variance)}),e=Object.assign(Object.assign({},t[t.length-1]),{scenario1:new ct(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 ct(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=t.map((t=>t.calcdate)).filter((t=>null!=t&&"boolean"==typeof t.isValid&&t.isValid));if(0===s.length)return t;const h=E.max(...s),e=E.min(...s),n=new I;if(n.countBetween(e,h,i)>1e4)return t;const r=n.datesBetween(e,h,i),o=new Map;return r.forEach(((t,i)=>{o.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=o.get(i);s&&s.isEmpty&&o.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(o.values())}}function $t(t){return t.map((t=>{var i;return null===(i=t.scenario1)||void 0===i?void 0:i.value})).filter((t=>Number.isFinite(t)))}class _t{constructor(t,i){this.data=t,this.scenarios=i,this.variances=[],this.title="",this.hideAxisLabels=!1,this.pixelPerUnit=10,this.pixelPerPercentage=50,this.leftSideOffsetForHorizontalSync=-1,this.dateInterval=F.AUTO,this.axisLabelsMode=u.SMART,this.intervalSpanLimit=28,this.filter="",this.measureScale=new x,this.measureUnit="",this.showMeasureScale=!0,this.dataFormatDigits={decimal:1,percent:2},this.showOverlayMedian=!0,this.showOverlayAvg=!0,this.chartMode=d.BAR,this.maxBars=28,this.stackConfig=null,this.lineFullWidth=!0,this.axisLabelsStep=1,this.scenarioSwitch=!1,this.axisTitlePosition="left",this.locale="de"}}class Dt{constructor(t,i,s,h,e,n){this.dataRowAdapter=t,this.stringAdapter=i,this.dataFormatDigitsAdapter=s,this.db=h,this.fromExpr=e,this.onQueryError=n}adapt(t){const i=it.adaptArray(t.data,this.dataRowAdapter),s=it.adaptArray(t.scenarios,this.stringAdapter),h=new _t(i,s);return a.isArray(t.variances)&&(h.variances=it.adaptArray(t.variances,this.stringAdapter)),a.isString(t.title)&&(h.title=t.title),a.isBoolean(t.hideAxisLabels)&&(h.hideAxisLabels=t.hideAxisLabels),a.isNumber(t.pixelPerUnit)&&(h.pixelPerUnit=t.pixelPerUnit),a.isNumber(t.pixelPerPercentage)&&(h.pixelPerPercentage=t.pixelPerPercentage),a.isExisting(t.dateInterval)&&(h.dateInterval=t.dateInterval),a.isExisting(t.axisLabelsMode)&&(h.axisLabelsMode=t.axisLabelsMode),a.isNumber(t.leftSideOffsetForHorizontalSync)&&(h.leftSideOffsetForHorizontalSync=t.leftSideOffsetForHorizontalSync),a.isNumber(t.intervalSpanLimit)&&(h.intervalSpanLimit=t.intervalSpanLimit),a.isString(t.filter)&&(h.filter=t.filter),a.isExisting(t.measureScale)&&(h.measureScale=J.calculateMeasureScale(this.db,this.fromExpr,h.scenarios,t.measureScale,this.onQueryError)),a.isString(t.measureUnit)&&(h.measureUnit=t.measureUnit),a.isBoolean(t.showMeasureScale)&&(h.showMeasureScale=t.showMeasureScale),a.isExisting(t.dataFormatDigits)&&(h.dataFormatDigits=this.dataFormatDigitsAdapter.adapt(t.dataFormatDigits)),a.isBoolean(t.showOverlayAvg)&&(h.showOverlayAvg=t.showOverlayAvg),a.isBoolean(t.showOverlayMedian)&&(h.showOverlayMedian=t.showOverlayMedian),a.isExisting(t.chartMode)&&(h.chartMode=t.chartMode),a.isNumber(t.maxBars)&&(h.maxBars=t.maxBars),a.isExisting(t.stackConfig)&&(h.stackConfig=t.stackConfig),a.isBoolean(t.lineFullWidth)&&(h.lineFullWidth=t.lineFullWidth),a.isNumber(t.axisLabelsStep)&&t.axisLabelsStep>=1&&(h.axisLabelsStep=t.axisLabelsStep),a.isBoolean(t.scenarioSwitch)&&(h.scenarioSwitch=t.scenarioSwitch),a.isString(t.axisTitlePosition)&&(h.axisTitlePosition=t.axisTitlePosition),a.isString(t.locale)&&(h.locale=t.locale),h}default(){return new _t([],[])}}const Et=t(class extends i{disconnectedCallback(){var t;this.overlapErrId&&(null===(t=this.errors)||void 0===t||t.remove(this.overlapErrId),this.overlapErrId=void 0)}constructor(t){super(),!1!==t&&this.__registerHost(),this.__attachShadow(),this.tableName="",this.dataVersion=0,this.scenarios=[],this.variances=[],this.hideAxisLabels=!1,this.pixelPerUnit=2,this.pixelPerPercentage=50,this.leftSideOffsetForHorizontalSync=-1,this.i18n=new Map,this.dateInterval=F.AUTO,this.intervalSpanLimit=28,this.axisLabelsMode=u.SMART,this.filter="",this.measureScale="_",this.measureUnit="",this.showMeasureScale=!0,this.showOverlayMedian=!1,this.showOverlayAvg=!1,this.chartMode=d.BAR,this.maxBars=28,this.stackConfig=null,this.lineFullWidth=!0,this.containerWidth=0,this.dataFormatDigits={percent:2,decimal:1},this.axisLabelsStep=1,this.scenarioSwitch=!1,this.axisTitlePosition="left",this.parentDimensions={width:0,height:0},R(this)}getDb(){return this.stores||(this.stores=Y(this.element)),this.stores.db.db}render(){var t,i,e,n;if(void 0===this.chart||void 0!==this.queryError)return s(h,null);if(this.chart.hasNoData()){const i=null!==(t=this.i18n.get("no-data"))&&void 0!==t?t:"No Data";return s(h,{class:"no-data"},s("div",{class:"empty-state"},i))}return s(h,null,s("div",{innerHTML:null===(i=this.pattern)||void 0===i?void 0:i.toString(),class:"hidePatternContainer",style:{width:"0",height:"0",overflow:"hidden"}}),s("div",{class:this.showMeasureScale?"footer":"footer-hide"},null===(e=this.chart)||void 0===e?void 0:e.getFooter()),s("div",{innerHTML:null===(n=this.chart)||void 0===n?void 0:n.toString()}))}syncQueryError(){var t,i,s,h,e,n,r,o,l,a,c;if(this.queryError=null!==(t=this.measureScaleError)&&void 0!==t?t:null===(i=this.chart)||void 0===i?void 0:i.getQueryError(),V(this.errors,this.queryError),this.variances.every((t=>""===t))){const t=null!==(h=null===(s=this.chart)||void 0===s?void 0:s.getIgnoredSwitchScenarios())&&void 0!==h?h:[];t.length>0?null===(e=this.errors)||void 0===e||e.addOrReplace({id:"WARN_stack_switch_ignored",type:"warning",message:`stack by dimensions with scenarioSwitch: ${t.join(", ")} is not drawn. A scenario continues the first one only where the first one has no value, and only in bar mode.`}):null===(n=this.errors)||void 0===n||n.remove("WARN_stack_switch_ignored")}const u=`WARN_variances_overlap_${this.variances.join("_")}`,d=null!==(o=null===(r=this.chart)||void 0===r?void 0:r.getVarianceOverlaps())&&void 0!==o?o:0;this.overlapErrId&&this.overlapErrId!==u&&(null===(l=this.errors)||void 0===l||l.remove(this.overlapErrId)),this.overlapErrId=d>0?u:void 0,d>0?null===(a=this.errors)||void 0===a||a.addOrReplace({id:u,type:"warning",message:`scenarioSwitch: the variances ${this.variances.join(", ")} share a row, but ${d} period(s) have more than one value. The first variance wins there.`}):null===(c=this.errors)||void 0===c||c.remove(u)}async componentWillLoad(){var t,i;const s=this.prepareConfig(),h=this.prepareStyle(),e=this.containerWidth||0;this.chart=new Tt(new q(this.ruleSetConfig),this.getDb(),this.tableName,s,h,e),this.chart.setI18n(this.i18n);const n=s.pixelPerUnit<=0,r=s.pixelPerPercentage<=0;this.autoFitScaling(s,h),this.chart.setAvailableHeight(n?0:(null===(t=this.parentDimensions)||void 0===t?void 0:t.height)||0),r||this.chart.fitRelativeVariances((null===(i=this.parentDimensions)||void 0===i?void 0:i.height)||0),this.pattern=new at(this.chart.styles),this.chart.setPattern("hatched",this.pattern.getFCPolygonPattern()),this.syncQueryError()}async componentWillUpdate(){var t,i;if(null==this.chart)return;const s=this.prepareConfig(),h=this.prepareStyle();this.chart.setI18n(this.i18n),this.chart.setStyles(h),this.chart.setAvailableWidth(this.containerWidth||0),this.chart.setRuleSet(new q(this.ruleSetConfig)),this.chart.setConfig(s);const e=s.pixelPerUnit<=0,n=s.pixelPerPercentage<=0;this.autoFitScaling(s,h),this.chart.setAvailableHeight(e?0:(null===(t=this.parentDimensions)||void 0===t?void 0:t.height)||0),n||this.chart.fitRelativeVariances((null===(i=this.parentDimensions)||void 0===i?void 0:i.height)||0),this.pattern=new at(this.chart.styles),this.chart.setPattern("hatched",this.pattern.getFCPolygonPattern()),this.syncQueryError()}autoFitScaling(t,i){var s;const h=t.pixelPerUnit<=0,e=t.pixelPerPercentage<=0;if(!h&&!e)return;const n=()=>{var i;null===(i=this.reportAutoScaling)||void 0===i||i.call(this,{unit:h?t.pixelPerUnit:void 0,percentage:e?t.pixelPerPercentage:void 0})},r=null===(s=this.parentDimensions)||void 0===s?void 0:s.height,o=this.containerWidth||0,l=()=>{this.chart=new Tt(new q(this.ruleSetConfig),this.getDb(),this.tableName,t,i,o),this.chart.setI18n(this.i18n)},a=()=>(this.chart.layout(),this.chart.getAllocatedCanvasHeight());if(!r||r<=0)return h&&(t.pixelPerUnit=1),e&&(t.pixelPerPercentage=50),l(),void n();h&&(t.pixelPerUnit=1),e&&(t.pixelPerPercentage=1),l();let c=a();if(c<=0)return void n();const u=Math.max(K,.9*r/c);let d=!1,f=!1,v=null;for(let i=0;i<=3;i++){const i=U({target:r,measured:c,unitExtent:h?this.chart.getUnitBarExtent():0,pctExtent:e?this.chart.getPercentBarExtent():0,currentPpu:t.pixelPerUnit,currentPpp:t.pixelPerPercentage});if(void 0===i.ppu&&void 0===i.ppp)break;if(h&&void 0!==i.ppu&&(t.pixelPerUnit=i.ppu,d=!0),e&&void 0!==i.ppp&&(t.pixelPerPercentage=i.ppp,f=!0),l(),c=a(),c<=r+.5&&(v={ppu:t.pixelPerUnit,ppp:t.pixelPerPercentage},c>=.98*r))break}let p=!1;if(h&&!d&&(t.pixelPerUnit=u,p=!0),e&&!f&&(t.pixelPerPercentage=u,p=!0),c>r+.5){if(v)d&&(t.pixelPerUnit=v.ppu),f&&(t.pixelPerPercentage=v.ppp);else{const i=r/c;h&&(t.pixelPerUnit=Math.max(K,t.pixelPerUnit*i)),e&&(t.pixelPerPercentage=Math.max(K,t.pixelPerPercentage*i))}p=!0}p&&l(),n()}async componentWillRender(){}componentDidLoad(){}componentDidUpdate(){}prepareConfig(){var t,i,s;const h=this.getDb(),e=j(h,this.tableName,this.filter);return this.measureScaleError=void 0,new Dt(new dt,new st,new tt,h,e,(t=>{this.measureScaleError=H(t)})).adapt({scenarios:this.scenarios,variances:this.variances,title:this.chartTitle,hideAxisLabels:this.hideAxisLabels,pixelPerUnit:this.pixelPerUnit,pixelPerPercentage:this.pixelPerPercentage,dateInterval:this.dateInterval,axisLabelsMode:this.axisLabelsMode,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,axisLabelsStep:this.axisLabelsStep,scenarioSwitch:this.scenarioSwitch,axisTitlePosition:this.axisTitlePosition,locale:(null===(s=null===(i=null===(t=this.stores)||void 0===t?void 0:t.context)||void 0===i?void 0:i.state)||void 0===s?void 0:s.locale)||"de"})}prepareStyle(){var t,i;const s=new vt(new nt,new r,new o(new C),new ht(new C),new l).adapt(this.styles);return s.locale=(null===(i=null===(t=Y(this.element).context)||void 0===t?void 0:t.state)||void 0===i?void 0:i.locale)||"de",s}get element(){return this}static get style(){return':host(.no-data){display:block;box-sizing:border-box;width:100%;height:100%}:host(.no-data)>div{float:none;width:100%;height:100%}:host(.no-data) .no-data~.no-data{display:none}.empty-state{box-sizing:border-box;display:flex;align-items:center;justify-content:center;float:none;width:100%;height:100%;min-height:3em;margin:0;padding:0.5em;overflow:hidden;border:0.1em dashed #ddd;color:#808080;font-family:var(--bn-font-family, "Noto Sans", sans-serif);font-size:var(--bn-font-size, 13.3333px);font-style:normal;text-align:center}: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}.hide{opacity:0}.footer{margin:0.2em;font-size:0.6em}.footer-hide{display:none}svg#drawCanvas{display:block}'}},[1,"bn-chart-time-renderer",{tableName:[1,"table-name"],dataVersion:[2,"data-version"],chartTitle:[1,"chart-title"],scenarios:[16],variances:[16],hideAxisLabels:[4,"hide-axis-labels"],pixelPerUnit:[2,"pixel-per-unit"],pixelPerPercentage:[2,"pixel-per-percentage"],reportAutoScaling:[16],errors:[16],leftSideOffsetForHorizontalSync:[2,"left-side-offset-for-horizontal-sync"],styles:[1040],i18n:[1040],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],axisLabelsStep:[2,"axis-labels-step"],scenarioSwitch:[4,"scenario-switch"],axisTitlePosition:[1,"axis-title-position"],parentDimensions:[16],ruleSetConfig:[16]}]);function Rt(){"undefined"!=typeof customElements&&["bn-chart-time-renderer"].forEach((t=>{"bn-chart-time-renderer"===t&&(customElements.get(e(t))||customElements.define(e(t),Et))}))}export{Et as B,Rt as d}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{S as t}from"./p-BrQCbmG0.js";import{V as n}from"./p-Zz3fAPcH.js";import{m as r}from"./p-B2NXsfMz.js";const o=["ac","pp","fc","pl"],s={10:"ac",20:"pp",30:"fc",50:"pl"};function i(t){var n;return null!==(n=s[t])&&void 0!==n?n:"ac"}function e(t,n){const r=o.map((t=>i(n.getScenarioColorIndex(`${t}1`))));if(r.every(((t,n)=>t===o[n])))return t;const s=Object.assign(Object.create(Object.getPrototypeOf(t)),t);return o.forEach(((n,o)=>{s[n]=t[r[o]]})),s}function c(t){var n,r;const s=new Map;for(const i of o){const o=null===(r=null===(n=null==t?void 0:t.scenarios)||void 0===n?void 0:n[i])||void 0===r?void 0:r.name;if(o)for(const t of[1,2,3,4])s.set(`${i}${t}`,1===t?o:`${o}${t}`)}return s}class a{constructor(n){this._dateFormat={year:"YYYY",quarter:"Q[Q] YYYY",month:"MMM YYYY",locale:"[KW]WW YYYY",day:"DD.MM.YYYY"},this._dateLinkFormat={avg:"Ø[DATE]",interval:"[DATE]..[DATE]",start:".[DATE]",end:"[DATE].",ytd:"_[DATE]",ytg:"[DATE]_",cum:"[DATE]_[DATE]",mat:"~[DATE]",none:"[DATE]"},this._scenarioMap=new Map;const o=r([t,null!=n?n:{}]);Object.entries(o.scenarios).forEach((([t,n])=>{var r,o,s;this.createScenarioMapEntry(t,null!==(r=n.name)&&void 0!==r?r:t,null!==(o=n.colorIndex)&&void 0!==o?o:10,null!==(s=n.sortIndex)&&void 0!==s?s:0)})),this._fallBackScenario=o.fallback}createScenarioMapEntry(t,n,r,o){const s=n,i=r;[1,2,3,4].forEach((r=>{this._scenarioMap.set(t+r,{name:n+r,group:s,colorIndex:i,sortIndex:o+10*r})}))}getScenario(t){return this._scenarioMap.has(t)?this._scenarioMap.get(t):this._fallBackScenario}getScenarioGroup(t){return this._scenarioMap.has(t)?this._scenarioMap.get(t).name:this._fallBackScenario.name}getScenarioColorIndex(t){return this._scenarioMap.has(t)?this._scenarioMap.get(t).colorIndex:this._fallBackScenario.colorIndex}getScenarioSorIndex(t){const n=this.normalizeVarianceScenario(t);return this._scenarioMap.has(n)?this._scenarioMap.get(n).sortIndex:this._fallBackScenario.sortIndex}normalizeVarianceScenario(t){if(null==t)return"";const r=new n(t);return r.isValid?r.type+r.delta:t}}export{a as I,e as a,c as r,i as s}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{g as n,c as o,R as t}from"./p-6242qMx1.js";import{f as e,c as i}from"./p-BnmylmXF.js";import{r}from"./p-BrQCbmG0.js";import{i as s}from"./p-
|
|
1
|
+
import{g as n,c as o,R as t}from"./p-6242qMx1.js";import{f as e,c as i}from"./p-BnmylmXF.js";import{r}from"./p-BrQCbmG0.js";import{i as s}from"./p-CcfvGlBq.js";const l="inherited-page",u="bn-layout-page";function a(n){return"inherited-closest"===n||n===l}function c(n,o){const t=[];let e=n.parentNode;for(;e;){const n=e.nodeName.toLowerCase();if(n===u){t.push(e);break}if("bn-layout-card"===n&&o!==l&&t.push(e),e.parentNode)e=e.parentNode;else{if(!(e instanceof ShadowRoot))break;e=e.host}}return t}function d(n,o){var t;const e=n=>{const t=n.getAttribute(o),e=null==t?void 0:t.trim();return s(e)||a(e)?void 0:t};for(const i of n){if((null===(t=i.getAttribute(o))||void 0===t?void 0:t.trim())===l){const o=n.find((n=>n.nodeName.toLowerCase()===u)),t=o&&e(o);if(void 0!==t)return t;continue}const r=e(i);if(void 0!==r)return r}}const v=(n,o,t)=>{const s=new Map,u=new Map;let v=null;const f=()=>{var t;const r=i(n);s.clear(),u.clear(),v&&(v.disconnect(),v=null);const l=new Map;for(const e of o){const o=n[e.propName];if("string"!=typeof o||!a(o))continue;u.set(e.propName,o);const i=c(r,o),v=d(i,e.ancestorAttr);void 0!==v&&s.set(e.propName,v);for(const n of i)l.set(n,[...null!==(t=l.get(n))&&void 0!==t?t:[],e.ancestorAttr])}if(l.size>0){v=new MutationObserver((()=>{f(),e(n)}));for(const[n,o]of l)v.observe(n,{attributes:!0,attributeFilter:o})}},p=n.connectedCallback;n.connectedCallback=()=>{f(),r(p,n)};const m=n.disconnectedCallback;n.disconnectedCallback=()=>{v&&(v.disconnect(),v=null),s.clear(),u.clear(),r(m,n)};const b=n=>{var t;return null===(t=o.find((o=>o.propName===n)))||void 0===t?void 0:t.ancestorAttr.replace(/-(\w)/g,((n,o)=>o.toUpperCase()))};return(n,o,e)=>{const i=`WARN_inherited_${n}`,r=a(o);r&&u.get(n)!==o&&f();const c=r?s.get(n):void 0;return r&&void 0===c?(null==t||t.addOrReplace({id:i,type:"warning",message:`${n}: '${o}' could not be resolved, no surrounding ${o===l?"page":"card or page"} sets ${b(n)}`}),{value:e,inherited:!1,unresolved:!0}):(null==t||t.remove(i),{value:null!=c?c:o,inherited:void 0!==c,unresolved:!1})}},f=s=>{let l,u,a,c,d=null;const v=()=>{const n=i(s);if(d&&(d.disconnect(),d=null),a=s.i18nNamespace,u=a,null!=u)return;const o=function(n){let o=n.parentNode;for(;o;){if(o instanceof HTMLElement&&o.hasAttribute("i18n-namespace"))return o;if(o.parentNode)o=o.parentNode;else{if(!(o instanceof ShadowRoot))break;o=o.host}}}(n);o&&(u=o.getAttribute("i18n-namespace"),d=new MutationObserver((()=>{v(),e(s)})),d.observe(o,{attributes:!0,attributeFilter:["i18n-namespace"]}))},f=s.connectedCallback;s.connectedCallback=()=>{const o=i(s);c=n(o),v(),l=c.internationalization.on("set",(n=>{n!==u&&"_system"!==n||e(s)})),r(f,s)};const p=s.disconnectedCallback;return s.disconnectedCallback=()=>{d&&(d.disconnect(),d=null),r(l),o(i(s)),r(p,s)},{t:(n,o)=>{var e,r,l,d,f;void 0!==c&&s.i18nNamespace!==a&&v(),n.startsWith(".")&&(n=i(s).localName+n),Object.prototype.hasOwnProperty.call(t,n)&&(n=t[n]);const p=c.internationalization.state,m=c.context.state.locale,b=null!==(l=null===(r=null===(e=p[u])||void 0===e?void 0:e[m])||void 0===r?void 0:r[n])&&void 0!==l?l:null===(f=null===(d=p._system)||void 0===d?void 0:d[m])||void 0===f?void 0:f[n];return null==b?n:b.replace(/{{([\s\S]+?)}}/g,((n,t)=>{var e;return null!==(e=null==o?void 0:o[t.trim()])&&void 0!==e?e:""}))}}};export{v as a,c as f,a as i,d as r,f as w}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{p as t,H as i,h as s,d as e,t as h}from"./p-BnmylmXF.js";import{g as n,d as r}from"./p-6242qMx1.js";import{A as o,C as a}from"./p-DguYWLBj.js";import{s as l,I as d}from"./p-D0v9GMIf.js";import{w as u}from"./p-BrQCbmG0.js";import{S as c,F as m,a as p,P as f}from"./p-CSJCkHEL.js";import{d as g,l as v,S as b}from"./p-DHX92KDP.js";import{S as w}from"./p-CJ0-xdfZ.js";import{e as y,r as $}from"./p-ClruFZD_.js";import{C as M,F as S}from"./p-Zz3fAPcH.js";import{O as x}from"./p-BBdzTx8V.js";import{N as j}from"./p-BJmwHV0a.js";import{s as E}from"./p-Xb6Ilq8u.js";import{B as C}from"./p-JofGXz75.js";class N{constructor(t,i,s,e,h,n){this.ruleSet=t,this.config=e,this.styles=h,this.availableWidth=n,this.rows=[],this.warnings=[],this.i18nMap=new Map,this.populateModel(i,s),this.normalized="target"===this.config.normalize&&this.rows.some((t=>null!==t.fraction)),null!==this.config.target&&this.rows.length>0&&!this.rows.some((t=>null!==t.target))&&this.warnings.push({code:"bullet-target-none",data:{}})}populateModel(t,i){var s,e,h;if(""===i)return;const n=this.config.level,r=this.config.order,o=this.config.actual.measure,a=null!==(e=null===(s=this.config.target)||void 0===s?void 0:s.measure)&&void 0!==e?e:null,l="transformOperator(operation)",d=[o,...null!==a?[a]:[]].map((t=>`CASE WHEN MIN(${l}) = MAX(${l}) THEN SUM(${t}) ELSE SUM(${t} * ${l}) END as ${t}, SUM(ABS(${t})) as ${t}_gross, COUNT(ISNULL(${t})) as ${t}_cnt`)).join(", ");let u;try{u=t.exec(`SELECT ${this.createSelectString(n,r)}, ${d},\n MIN(transformOperator(operation)) as opMin, MAX(transformOperator(operation)) as opMax\n FROM ${i}\n GROUP BY ${this.createGroupByStr(n,r)}\n ORDER BY ${this.createOrderStr(n,r)}`)}catch(t){return void(this.queryError=y(t))}let c=null!=u?u:[];this.config.limit>0&&(c=c.slice(0,this.config.limit));let m=0,p=0,f=0,g=0;for(const t of c){const i="number"==typeof t.opMin?t.opMin:1,s="number"==typeof t.opMax?t.opMax:1;let e=-1===i&&-1===s?"-":"+";i!==s&&(e="+",m++);const n=this.readValue(t,o),r=null!==a?this.readValue(t,a):null;null!==n&&n<0&&g++;let l=null;"target"===this.config.normalize&&(null===r?null!==a&&p++:r<=0?f++:null!==n&&n>=0&&(l=n/r)),this.rows.push({category:String(null!==(h=t.category)&&void 0!==h?h:""),actual:n,target:r,operation:e,sentiment:this.sentiment(n,r,e),fraction:l})}m>0&&this.warnings.push({code:"bullet-mixed-operation",data:{count:String(m)}}),p>0&&this.warnings.push({code:"bullet-target-missing",data:{count:String(p)}}),f>0&&this.warnings.push({code:"bullet-target-invalid",data:{count:String(f)}}),g>0&&this.warnings.push({code:"bullet-actual-negative",data:{count:String(g)}})}readValue(t,i){if(0===t[`${i}_cnt`])return null;const s=t[i],e=t[`${i}_gross`];return"number"==typeof s&&"number"==typeof e&&Math.abs(s)<=1e-9*e?0:"number"==typeof s&&isFinite(s)?s:null}sentiment(t,i,s){return null===t||null===i||t===i?"neu":t>i!=("-"===s)?"pos":"neg"}createSelectString(t,i){return t===o.CATEGORY&&i.hierarchy.includes(x.CATEGORYINDEX)?`${x.CATEGORYINDEX}, ${o.CATEGORY} as category`:t===o.ROWGROUP&&i.hierarchy.includes(x.ROWGROUPINDEX)?`${x.ROWGROUPINDEX}, ${o.ROWGROUP} as category`:t===o.SUBCATEGORY&&i.hierarchy.includes(x.SUBCATEGORYINDEX)?`${x.SUBCATEGORYINDEX}, ${o.SUBCATEGORY} as category`:`${t.toString()} as category`}createGroupByStr(t,i){return t===o.CATEGORY&&i.hierarchy.includes(x.CATEGORYINDEX)?`${x.CATEGORYINDEX}, ${o.CATEGORY}`:t===o.ROWGROUP&&i.hierarchy.includes(x.ROWGROUPINDEX)?`${x.ROWGROUPINDEX}, ${o.ROWGROUP}`:t===o.SUBCATEGORY&&i.hierarchy.includes(x.SUBCATEGORYINDEX)?`${x.SUBCATEGORYINDEX}, ${o.SUBCATEGORY}`:`${t.toString()}`}createOrderStr(t,i){let s=`${t.toLowerCase()}`;return i.hierarchy.length>=1&&(s=i.hierarchy.map((t=>`${t} ${i.direction}`)).toString()),s}get em(){return this.styles.fontStyles.size}fontFamily(){return this.styles.fontStyles.font.replace(/^[\d.]+px\s*/,"")}textWidth(t,i=!1){const s=M(t,{font:this.styles.fontStyles.font,fontSize:this.styles.fontStyles.size+"px",fontWeight:i?"bold":"normal"}).width;return Number.isFinite(s)&&s>0?s:.6*t.length*this.em}drawText(t,i,s,e,h={}){var n,r,o;return t.text(i).font({size:null!==(n=h.size)&&void 0!==n?n:this.styles.fontStyles.size,weight:h.bold?"bold":"normal",anchor:null!==(r=h.anchor)&&void 0!==r?r:"start"}).fill(null!==(o=h.color)&&void 0!==o?o:this.styles.fontStyles.color).attr({x:s,y:e,"font-family":this.fontFamily()})}setI18n(t){this.i18nMap=t}hasNoData(){return 0===this.rows.length}getWarnings(){return this.warnings}getQueryError(){return this.queryError}getAllocatedCanvasWidth(){return this.availableWidth}getAllocatedCanvasHeight(){return this.styles.padding.top+this.titleHeight()+this.headerHeight()+this.rows.length*this.rowBlockHeight()+this.styles.padding.bottom}titleHeight(){return""!==this.config.chartTitle?1.6*this.em:0}headerHeight(){return this.rows.length>0?1.2*this.em:0}rowBlockHeight(){const t=this.em,i=this.styles.scaleFactors.rowHeight*t;return this.normalized?i:i+this.styles.scaleFactors.tickStripHeight*t}valueLabel(t){return null===t||"none"===this.config.labels.show?"":S.number(t,"decimal",this.config.labels.decimals,0,1,this.styles.locale)}targetFamily(){var t,i;const s=null!==(i=null===(t=this.config.target)||void 0===t?void 0:t.measure)&&void 0!==i?i:"pl1";return l(this.ruleSet.getScenarioColorIndex(s))}actualLabel(){var t;return null!==(t=this.config.actual.label)&&void 0!==t?t:S.translateScenarioLabel(this.config.actual.measure,this.i18nMap)}targetLabel(){return null===this.config.target?"":void 0!==this.config.target.label?this.config.target.label:this.normalized?this.i18nMap.get("target")||"Target":S.translateScenarioLabel(this.config.target.measure,this.i18nMap)}toString(){const t=new c;return this.draw(t),t.id("drawCanvas"),t.width(this.getAllocatedCanvasWidth()),t.height(this.getAllocatedCanvasHeight()),t.attr("overflow","visible"),t.svg()}draw(t){var i,s;const e=this.em,h=this.styles.scaleFactors,n=this.styles.padding,r=t.group();if(""!==this.config.chartTitle&&this.drawText(r,this.config.chartTitle,n.left,n.top+e,{bold:!0}),0===this.rows.length)return void t.group().addClass("annotations");const o=h.rowHeight*e,a=this.rowBlockHeight(),l=n.top+this.titleHeight()+this.headerHeight(),d=l+(this.rows.length-1)*a+o,u=Math.max(...this.rows.map((t=>this.textWidth(t.category,!0))),e),c=this.rows.map((t=>this.valueLabel(t.actual))),m="none"===this.config.labels.show?0:Math.max(...c.map((t=>this.textWidth(t))),0),p=n.left+u+h.labelToAxis*e,f=Math.max(10,this.availableWidth-p-n.right-m-(m>0?h.labelToBar*e:0)),g=null!==(i=this.config.actual.unit)&&void 0!==i?i:null===(s=this.config.target)||void 0===s?void 0:s.unit,v=this.i18nMap.get("axis.in")||"in",b=l-.35*e;void 0!==g&&""!==g&&this.drawText(r,`${v} ${g}`,n.left,b,{}),this.drawText(r,this.actualLabel(),p+.2*e,b,{}),this.normalized?this.drawNormalized(r,p,f,l,d,o,a,c):this.drawClassic(r,p,f,l,o,a,c),this.rows.forEach(((t,i)=>{this.drawText(r,t.category,p-h.labelToAxis*e,l+i*a+o/2+.35*e,{anchor:"end",bold:!0})})),r.line(p,l-.2*e,p,d+.2*e).stroke({color:this.styles.axisStyles.ac.stroke,width:E(h.axisLineWidth,this.em)}).attr(C,"axis"),t.group().addClass("annotations")}drawNormalized(t,i,s,e,h,n,r,o){const a=this.em,l=this.styles.scaleFactors,d=1.05*Math.max(1,...this.rows.map((t=>{var i;return null!==(i=t.fraction)&&void 0!==i?i:0}))),u=t=>i+t/d*s,c=u(1),m=this.styles.barStyles.getSVGStyle(this.targetFamily()),p=t.line(c,e-.3*a,c,h+.3*a).stroke({color:m.stroke,width:E(l.targetLineWidth,this.em)});void 0!==m.dasharray&&p.attr("stroke-dasharray",m.dasharray),this.drawText(t,this.targetLabel(),c,e-.35*a,{anchor:"middle",bold:!0}),this.rows.forEach(((s,h)=>{const d=e+h*r+n/2;if(null===s.fraction)return void this.drawValueText(t,o[h],i+l.labelToBar*a,d,s);const m=l.barHeight*a,p=u(s.fraction);if(t.rect(Math.max(0,p-i),m).move(i,d-m/2).fill(this.styles.barStyles.ac.fill).stroke({color:this.styles.barStyles.ac.stroke,width:this.styles.barStyles.ac.width}).attr(g(this.rowKey(s),"element")).attr("data-bn-index",String(h)),this.config.showVariances&&"neu"!==s.sentiment){const i=l.varianceHeight*a,e=this.styles.varianceStyles.getSVGStyle(s.sentiment);t.rect(Math.abs(p-c),i).move(Math.min(p,c),d-i/2).fill(e.fill).stroke({color:e.stroke,width:e.width})}this.drawValueText(t,o[h],Math.max(p,c)+l.labelToBar*a,d,s)}))}drawClassic(t,i,s,e,h,n,r){const o=this.em,a=this.styles.scaleFactors,l=a.barHeight*o,d=this.config.ranges.length>0;this.rows.forEach(((u,c)=>{var m,p;const f=e+c*n,v=f+h/2,b=d&&null!==u.target?this.config.ranges.map((t=>t*u.target)):[],w=Math.max(null!==(m=u.actual)&&void 0!==m?m:0,null!==(p=u.target)&&void 0!==p?p:0,...b);if(w<=0)return void this.drawValueText(t,r[c],i+a.labelToBar*o,v,u);const y=j.niceStep(w,4),$=Math.ceil(w/y-1e-9*y)*y,M=new j(0,$,i,i+s);let x=i;b.forEach(((i,s)=>{const e=.8*h;t.rect(Math.max(0,M.scale(i)-x),e).move(x,v-e/2).fill(this.styles.rangeColors[Math.min(s,this.styles.rangeColors.length-1)]).stroke("none"),x=M.scale(i)}));let C=i;if(null!==u.actual&&u.actual>0){const s=M.scale(u.actual);t.rect(s-i,l).move(i,v-l/2).fill(this.styles.barStyles.ac.fill).stroke({color:this.styles.barStyles.ac.stroke,width:this.styles.barStyles.ac.width}).attr(g(this.rowKey(u),"element")).attr("data-bn-index",String(c)),C=s}if(null!==u.target&&u.target>0){const i=M.scale(u.target),s=a.targetTickHeight*o,h=this.styles.barStyles.getSVGStyle(this.targetFamily()),n=t.line(i,v-s/2,i,v+s/2).stroke({color:h.stroke,width:E(a.targetLineWidth,this.em)});void 0!==h.dasharray&&n.attr("stroke-dasharray",h.dasharray),0===c&&this.drawText(t,this.targetLabel(),i,e-.35*o,{anchor:"middle"}),C=Math.max(C,i)}C=Math.max(C,x),this.drawValueText(t,r[c],C+a.labelToBar*o,v,u);const N=M.ticks(4),z=j.tickDecimals(N),B=f+h;for(const i of N){const s=M.scale(i);t.line(s,B,s,B+a.axisTickLength*o).stroke({color:this.styles.axisStyles.ac.stroke,width:E(a.axisLineWidth,this.em)}),this.drawText(t,S.number(i,"decimal",z,z,1,this.styles.locale),s,B+a.tickStripHeight*o-.2*o,{anchor:"middle"})}}))}drawValueText(t,i,s,e,h){""!==i&&this.drawText(t,i,s,e+.35*this.em,{}).attr(g(this.rowKey(h),"label"))}rowKey(t){return Object.assign(Object.assign({},v(this.config.level,t.category)),{scenario:this.config.actual.measure})}}class z{constructor(){this.rowHeight=1.9,this.barHeight=.66,this.varianceHeight=.4,this.targetTickHeight=1.1,this.targetLineWidth=.15,this.axisLineWidth=.075,this.labelToBar=.3,this.labelToAxis=.3,this.axisTickLength=.35,this.tickStripHeight=1.2}}class B{adapt(t){const i=new z;return a.isNumber(t.rowHeight)&&(i.rowHeight=t.rowHeight),a.isNumber(t.barHeight)&&(i.barHeight=t.barHeight),a.isNumber(t.varianceHeight)&&(i.varianceHeight=t.varianceHeight),a.isNumber(t.targetTickHeight)&&(i.targetTickHeight=t.targetTickHeight),a.isNumber(t.targetLineWidth)&&(i.targetLineWidth=t.targetLineWidth),a.isNumber(t.axisLineWidth)&&(i.axisLineWidth=t.axisLineWidth),a.isNumber(t.labelToBar)&&(i.labelToBar=t.labelToBar),a.isNumber(t.labelToAxis)&&(i.labelToAxis=t.labelToAxis),a.isNumber(t.axisTickLength)&&(i.axisTickLength=t.axisTickLength),a.isNumber(t.tickStripHeight)&&(i.tickStripHeight=t.tickStripHeight),i}default(){return new z}}class D{constructor(t,i,s,e,h,n){this.scaleFactors=t,this.fontStyles=i,this.axisStyles=s,this.barStyles=e,this.varianceStyles=h,this.padding=n,this.rangeColors=["#D9D9D9","#EFEFEF"],this.locale="de"}}class F{constructor(t,i,s,e,h){this.scaleFactorsBulletChartAdapter=t,this.fontStyleAdapter=i,this.svgStyleGroupAdapter=s,this.svgVariancesStyleGroupAdapter=e,this.paddingAdapter=h}adapt(t){const i=this.default();return a.isExisting(t)&&(a.isExisting(t.scaleFactors)&&(i.scaleFactors=this.scaleFactorsBulletChartAdapter.adapt(t.scaleFactors)),a.isExisting(t.fontStyles)&&(i.fontStyles=this.fontStyleAdapter.adapt(t.fontStyles)),a.isExisting(t.axisStyles)&&(i.axisStyles=this.svgStyleGroupAdapter.adapt(t.axisStyles)),a.isExisting(t.barStyles)&&(i.barStyles=this.svgStyleGroupAdapter.adapt(t.barStyles)),a.isExisting(t.varianceStyles)&&(i.varianceStyles=this.svgVariancesStyleGroupAdapter.adapt(t.varianceStyles)),a.isExisting(t.padding)&&(i.padding=this.paddingAdapter.adapt(t.padding)),Array.isArray(t.rangeColors)&&t.rangeColors.length>0&&(i.rangeColors=t.rangeColors)),i}default(){return new D(this.scaleFactorsBulletChartAdapter.default(),this.fontStyleAdapter.default(),this.svgStyleGroupAdapter.default(),this.svgStyleGroupAdapter.default(),this.svgVariancesStyleGroupAdapter.default(),this.paddingAdapter.default())}}const H=["bullet-target-missing","bullet-target-invalid","bullet-actual-negative","bullet-mixed-operation","bullet-target-none"],L=t(class extends i{constructor(t){super(),!1!==t&&this.__registerHost(),this.__attachShadow(),this.tableName="",this.dataVersion=0,this.chartTitle="",this.target=null,this.ranges=[],this.normalizeMode="target",this.showVariances=!0,this.level=o.CATEGORY,this.limit=0,this.filter="",this.i18n=new Map,this.containerWidth=0,this.svgMarkup="",u(this)}getDb(){return this.stores||(this.stores=n(this.element)),this.stores.db.db}componentWillLoad(){this.rebuild()}componentWillUpdate(){this.rebuild()}rebuild(){const t=this.prepareStyle(),i=r(this.getDb(),this.tableName,this.filter);this.chart=new N(new d(this.ruleSetConfig),this.getDb(),i,{chartTitle:this.chartTitle,actual:this.actual,target:this.target,ranges:this.ranges,normalize:this.normalizeMode,showVariances:this.showVariances,level:this.level,order:this.order,limit:this.limit,labels:this.labels},t,this.containerWidth||0),this.chart.setI18n(this.i18n),this.svgMarkup=this.chart.hasNoData()?"":this.chart.toString(),this.syncWarnings(this.chart.getWarnings()),$(this.errors,this.chart.getQueryError())}syncWarnings(t){if(void 0===this.errors)return;const i=new Map(t.map((t=>[t.code,t.data])));for(const t of H){const s=`WARN_${t.replace(/-/g,"_")}`;if(i.has(t)){const e=void 0!==this.translator?this.translator(`.${t}`,i.get(t)):t;this.errors.addOrReplace({id:s,type:"warning",message:e})}else this.errors.remove(s)}}prepareStyle(){var t,i;const s=new F(new B,new m,new p(new b),new w(new b),new f).adapt(this.styles);return s.locale=(null===(i=null===(t=n(this.element).context)||void 0===t?void 0:t.state)||void 0===i?void 0:i.locale)||"de",s}render(){var t;if(void 0===this.chart||void 0!==this.chart.getQueryError())return s(e,null);if(this.chart.hasNoData()){const i=null!==(t=this.i18n.get("no-data"))&&void 0!==t?t:"No Data";return s(e,{class:"no-data"},s("div",{class:"empty-state"},i))}return s(e,null,s("div",{innerHTML:this.svgMarkup}))}get element(){return this}static get style(){return':host(.no-data){display:block;box-sizing:border-box;width:100%;height:100%}:host(.no-data)>div{float:none;width:100%;height:100%}:host(.no-data) .no-data~.no-data{display:none}.empty-state{box-sizing:border-box;display:flex;align-items:center;justify-content:center;float:none;width:100%;height:100%;min-height:3em;margin:0;padding:0.5em;overflow:hidden;border:0.1em dashed #ddd;color:#808080;font-family:var(--bn-font-family, "Noto Sans", sans-serif);font-size:var(--bn-font-size, 13.3333px);font-style:normal;text-align:center}:host{position:relative;display:inline-block}'}},[1,"bn-chart-bullet-renderer",{tableName:[1,"table-name"],dataVersion:[2,"data-version"],chartTitle:[1,"chart-title"],actual:[16],target:[16],ranges:[16],normalizeMode:[1,"normalize-mode"],showVariances:[4,"show-variances"],level:[1],order:[16],limit:[2],labels:[16],filter:[1],styles:[16],i18n:[16],containerWidth:[2,"container-width"],ruleSetConfig:[16],errors:[16],translator:[16]}]);function O(){"undefined"!=typeof customElements&&["bn-chart-bullet-renderer"].forEach((t=>{"bn-chart-bullet-renderer"===t&&(customElements.get(h(t))||customElements.define(h(t),L))}))}export{L as B,O as d}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{S as t}from"./p-CeE4_3wQ.js";import{F as s}from"./p-
|
|
1
|
+
import{S as t}from"./p-CeE4_3wQ.js";import{F as s}from"./p-Zz3fAPcH.js";import"./p-DguYWLBj.js";import{g as i}from"./p-4q8nRcWC.js";import{d as e}from"./p-DHX92KDP.js";var r;!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"}(r||(r={}));class h{constructor(t,s,i,e,h,n,o,a){this.ID_SCENARIOLABEL="Label",this.CSS_CATEGORIES="categories",this.isRelativeLabel=!1,this.segmentFillColor=null,this.pointPart="label",this.x=s,this.y=i,this.value=h,this.group=t.group().id(this.createElementID(t.toString(),e)),this.styles=n,this.isVarianceLabel=!1,this.verticalHookLocation=o||r.Top,this.horizontalHookLocation=a||r.Left}setToVarianceLabel(){return this.isVarianceLabel=!0,this}setToRelativeVarianceLabel(){return this.isVarianceLabel=!0,this.isRelativeLabel=!0,this}setSegmentFill(t){return this.segmentFillColor=t,this}setPoint(t,s="label"){return this.pointKey=t,this.pointPart=s,this}updateGroup(t){return this.group=t,this}draw(i=!0,r={percent:2,decimal:1},h=new t){if(this.isEmpty())return this;const n=this.group;let o,a="";if(!1===Number.isNaN(Number(this.value))){let t="percent",i=r.percent,e=r.percent,n=1;!1===this.isRelativeLabel&&(i=r.decimal,e=r.decimal,n=h.value,t="decimal"),o=s.number(Number(this.value),t,i,e,n,this.styles.locale);const c=s.number(0,t,i,e,n,this.styles.locale);this.isVarianceLabel&&Number(this.value)>0&&o!==c&&(a="+")}else o=""+this.value;const c=this.drawLabel(n,a+o);return!1===i?(c.addClass("hide"),n.addClass("hide")):this.pointKey&&n.attr(e(this.pointKey,this.pointPart)),this}isEmpty(){return null==this.value||""===this.value}setPos(t,s){return this.x=t,this.y=s,this}forceStringTypeDraw(){const t=this.group;return this.drawLabel(t,""+this.value),this.pointKey&&t.attr(e(this.pointKey,this.pointPart)),this}drawLabel(t,s){const e=this.styles.fontStyles.background||"#ffffff";let h="start";const n=t.text(s);n.move(this.x,this.y);const o=n.bbox(),a=o.w,c=o.h;let l=0,u=0;const f=n.x();let p=n.y();return this.horizontalHookLocation===r.Left?(h="left",l=n.x()):this.horizontalHookLocation===r.Center?(h="middle",l=n.x()-(a+2)/2):this.horizontalHookLocation===r.Right&&(h="end",l=n.x()-a),this.verticalHookLocation===r.Center?(p=n.y()-1.2*c/2,u=p+.2*c):this.verticalHookLocation===r.Top?(p-=c/4,u=p+.2*c):this.verticalHookLocation===r.Bottom&&(p-=c,u=p+.2*c),n.move(f,p),n.font({anchor:h}),null!=this.segmentFillColor?n.fill(i(this.segmentFillColor)):t.rect(a+2,.8*c).stroke(e).fill(e).opacity(.9).move(this.horizontalHookLocation===r.Center?l:l-1,u).insertBefore(n),n}createElementID(t,s){return t+"_"+s+"_"+this.ID_SCENARIOLABEL}}const n={ac:1,pp:2,fc:3,pl:4};var o;!function(t){t[t.Above=0]="Above",t[t.Below=1]="Below",t[t.Left=2]="Left",t[t.Right=3]="Right"}(o||(o={}));class a{constructor(){this.labels=[],this.scenarioLabels=[]}clear(){this.labels=[],this.scenarioLabels=[]}register(t){this.labels.push(t)}hasCollision(t){return this.labels.some((s=>this.intersects(t,s)))}getOptimalPlacement(t,s,i,e,r,h,o,a){const c=n[o]||99,l=h/2;for(const h of a){const n=this.calculatePlacementForDirection(t,s,i,e,r,l,8,h);if(!this.hasCollision(n.bounds))return n}for(const h of a){const n=this.calculatePlacementForDirection(t,s,i,e,r,l,8,h);if(!this.collidesWithHigherPriority(n.bounds,c))return n}return null}calculatePlacementForDirection(t,s,i,e,h,n,a,c){let l,u,f,p,m,b;switch(c){case o.Above:l=t,u=s-n-a,f=r.Bottom,p=r.Center,m=t-i/2,b=s-n-a-e;break;case o.Below:l=t,u=s+n+a,f=r.Top,p=r.Center,m=t-i/2,b=s+n+a-e/4;break;case o.Left:l=t-n-a,u=s,f=r.Center,p=r.Right,m=t-n-a-i,b=s-.6*e;break;case o.Right:l=t+n+a,u=s,f=r.Center,p=r.Left,m=t+n+a,b=s-.6*e}return{labelX:l,labelY:u,verticalHook:f,horizontalHook:p,bounds:{x:m,y:b,width:i,height:e,pointIndex:h,preferredHook:f}}}collidesWithHigherPriority(t,s){return this.labels.some((i=>!!i.scenarioType&&((n[i.scenarioType]||99)<s&&this.intersects(t,i))))}shouldHideScenarioLabel(t,s,i,e=20){const r=n[i]||99;return!(r<=1)&&this.scenarioLabels.some((i=>{if((n[i.scenarioType]||99)>=r)return!1;const h=Math.abs(s-i.y),o=Math.abs(t-i.x);return h<e&&o<e}))}registerScenarioLabel(t,s,i){this.scenarioLabels.push({x:t,y:s,scenarioType:i})}intersects(t,s){return!(t.x+t.width<s.x||s.x+s.width<t.x||t.y+t.height<s.y||s.y+s.height<t.y)}getLabelCount(){return this.labels.length}}export{r as H,a as L,n as S,h as a,o as b}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{p as t,H as s,h as e,t as i}from"./p-BnmylmXF.js";import{I as n,C as r}from"./p-DguYWLBj.js";import{b as o,D as a,a as c}from"./p-ja0FCkHB.js";import{F as h}from"./p-Zz3fAPcH.js";import{A as l}from"./p-DsC0ew4j.js";import{I as p}from"./p-D0v9GMIf.js";import{D as u,w as f}from"./p-BrQCbmG0.js";import{a as m,c as d}from"./p-BBdzTx8V.js";import{S as b}from"./p-Do-IGHJk.js";import{s as w}from"./p-CyUmrWfW.js";class _{constructor(){}createMeasures(t,s,e){if(this.allMeasuresUseSameUnit(t)){const i=t.length;let r="",o="";for(let a=0;a<i;a++){let c="";a>0&&(c=s.get("SEPARATOR_WS")),i>1&&a===i-1&&(c=s.get("CONNECTOR_WS")),e===n.ALL?(r=(s.get(r)||r)+c+(s.get(t[a].name)||t[a].name),o=s.get(t[a].unit)||t[a].unit):(r=r+c+t[a].name,o=t[a].unit)}return[{name:r,unit:o}]}return t}createDimension(t,s,e,i,n,r="de"){let a="";if(void 0!==s){const t=new o;t.setLocale(r),a=t.getDateLinkString(s.start,s.end,s.link,s.format,n)}return a+t.map((t=>{let s="";return null!=e&&null!=e.hierarchy&&e.hierarchy.find((s=>s===t))&&(s=i.get("asc"===e.direction?"ORDER_asc":"ORDER_desc")),"".concat(" ",h.translateScenarioLabel(t,i),s)})).toString()}allMeasuresUseSameUnit(t){const s=new Map;return t.forEach((function(t){s.set(t.unit,!0)})),1===s.size}}class C{constructor(){this.businessunit="",this.measures=[],this.scenarios=[],this.i18nMode=n.ALL,this.intervalSpanLimit=32,this.locale="de"}}class v{constructor(t,s,e,i){this.measureEntryAdapter=t,this.timePeriodAdapter=s,this.orderAdapter=e,this.stringAdapter=i}adapt(t){const s=new C;return r.isString(t.businessunit)&&(s.businessunit=t.businessunit),r.isArray(t.measures)&&(s.measures=l.adaptArray(t.measures,this.measureEntryAdapter)),r.isArray(t.scenarios)&&(s.scenarios=l.adaptArray(t.scenarios,this.stringAdapter)),r.isExisting(t.timeperiod)&&(s.timeperiod=this.timePeriodAdapter.adapt(t.timeperiod)),r.isNumber(t.intervalSpanLimit)&&(s.intervalSpanLimit=t.intervalSpanLimit),r.isExisting(t.i18nMode)&&(s.i18nMode=t.i18nMode),r.isExisting(t.order)&&(s.order=this.orderAdapter.adapt(t.order)),r.isString(t.locale)&&(s.locale=t.locale),s}default(){return new C}}var R;!function(t){t[t.UP_TO_DATE=0]="UP_TO_DATE",t[t.DIRTY=1]="DIRTY"}(R||(R={}));class y{constructor(t){this.i18n=new Map,this.unit="",this.measures=[],this.dimension="",this.config=new C,this.state=R.DIRTY,this.ruleSet=t||new p,this.dataSetFactory=new _,this.state=R.DIRTY,this.setI18n(new Map)}setRuleSet(t){this.ruleSet=t||new p}setI18n(t){this.state=R.DIRTY;const s=new Map([["SEPARATOR_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"," "],["thereof","davon"],["part_of","in % von"],["ibcssymbol_delta_ac","Δ{%}"],["ibcssymbol_delta_generic","Δ({%})"],["ibcssymbol_delta_ac_relative","Δ{%}%"],["ibcssymbol_delta_generic_relative","Δ({%})%"],["SUM_TOTAL","❖"],["CONNECTOR_WS"," und "]]);this.i18n=new Map([...s,...t||new Map])}update(){return R.DIRTY===this.state&&(this.unit=this.config.businessunit,this.measures=this.dataSetFactory.createMeasures(this.config.measures,this.i18n,this.config.i18nMode),this.dimension=this.dataSetFactory.createDimension(this.config.scenarios,this.config.timeperiod,this.config.order,this.i18n,this.config.intervalSpanLimit,this.config.locale),this.state=R.UP_TO_DATE),this}setConfig(t){this.config=this.initConfig(t)}initConfig(t){this.state=R.DIRTY;const s=t,e=this;return t.scenarios.sort(((t,s)=>e.ruleSet.getScenarioSorIndex(t)-e.ruleSet.getScenarioSorIndex(s))),s}}class S{constructor(t="",s=""){this.name=t,this.unit=s}}class A{construnctor(){}adapt(t){const s=new S;return r.isString(t.name)&&(s.name=t.name),r.isString(t.unit)&&(s.unit=t.unit),s}default(){return new S("","")}}class E{constructor(t=u.now(),s=u.now(),e=a.AUTO,i=c.AUTO){this.start=t,this.end=s,this.format=e,this.link=i}}class M{construnctor(){}adapt(t){const s=new E;return r.isDate(t.start)&&(s.start=t.start),r.isDate(t.end)&&(s.end=t.end),r.isExisting(t.format)&&(s.format=t.format),r.isExisting(t.link)&&(s.link=t.link),s}default(){return new E}}const g=t(class extends s{constructor(t){super(),!1!==t&&this.__registerHost(),this.__attachShadow(),this.businessUnit="",this.scenarios=[],this.measures=[],this.intervalSpanLimit=28,this.order={hierarchy:[],direction:m.ASC},this.i18n=new Map,this.i18nMode=n.ALL,this.locale="de",this.title=new y(new p),f(this)}render(){return e("div",{key:"ecc33a660538732ceea3e4620afabfcb8ffbce95"},e("div",{key:"cb1c3b074817a4c0647419fdc0f2b94c113ebc09",innerHTML:w(this.title.unit)}),e("div",{key:"92b6ef66f67d33bd3bff6a760d1fc1bee605105d"},this.title.measures.map(((t,s)=>e("span",null,this.isFirstElement(s)?this.title.i18n.get("SEPARATOR_WS"):"",e("span",{class:"measure"},t.name)," ",t.unit?this.title.i18n.get("in"):""," ",t.unit)))),e("div",{key:"74cc33e0e63592e5422b3c0e5c7a52715210c486"},this.title.dimension))}componentWillLoad(){const t=this.prepareConfig();this.title=new y(new p(this.ruleSetConfig)),this.title.setI18n(this.i18n),this.title.setConfig(t)}componentWillUpdate(){const t=this.prepareConfig();this.title.setI18n(this.i18n),this.title.setRuleSet(new p(this.ruleSetConfig)),this.title.setConfig(t)}componentWillRender(){this.title.update()}isFirstElement(t){return 0!==t}prepareConfig(){return new v(new A,new M,new d(new b),new b).adapt({businessunit:this.businessUnit,measures:this.measures,scenarios:this.scenarios,timeperiod:this.timeperiod,intervalSpanLimit:this.intervalSpanLimit,i18nMode:this.i18nMode,order:this.order,locale:this.locale})}static get style(){return':host{display:block;font-family:var(--bn-font-family, "Noto Sans", sans-serif);font-size:var(--bn-font-size, 13.3333px);color:var(--bn-font-color, #000000)}.measure{font-weight:bold}div{background-color:var(--bn-font-background, white);color:var(--bn-font-color, black)}p{margin:0}'}},[1,"bn-title-renderer",{businessUnit:[1537,"business-unit"],scenarios:[16],measures:[16],timeperiod:[16],intervalSpanLimit:[2,"interval-span-limit"],order:[16],i18n:[1040],i18nMode:[1,"i18n-mode"],locale:[1],ruleSetConfig:[16]}]);function j(){"undefined"!=typeof customElements&&["bn-title-renderer"].forEach((t=>{"bn-title-renderer"===t&&(customElements.get(i(t))||customElements.define(i(t),g))}))}export{g as B,j as d}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{p as t,H as i,h as s,d as h,t as e}from"./p-BnmylmXF.js";import{S as n,F as r,a as o,P as a}from"./p-CSJCkHEL.js";import{C as l,A as c,g as u,e as d}from"./p-DguYWLBj.js";import{D as f,b as v}from"./p-keKnrAVS.js";import{c as p,O as m,a as b}from"./p-BBdzTx8V.js";import{S as g}from"./p-CeE4_3wQ.js";import{r as w,F as P,C as S,V as y}from"./p-Zz3fAPcH.js";import{g as x,a as L,I as M}from"./p-4q8nRcWC.js";import{d as k,l as T,S as N}from"./p-DHX92KDP.js";import{N as C,r as $}from"./p-fCjsrD7I.js";import{s as O,c as A,a as E,l as _,b as R,d as W,M as D}from"./p-BTnRaHPb.js";import{I as B,a as j,s as X}from"./p-D0v9GMIf.js";import{d as G,S as Y,g as V}from"./p-6242qMx1.js";import{e as z,r as H}from"./p-ClruFZD_.js";import{S as F}from"./p-Do-IGHJk.js";import{w as U}from"./p-BrQCbmG0.js";import{S as I}from"./p-CJ0-xdfZ.js";import{A as K}from"./p-DsC0ew4j.js";class Z{constructor(t,i,s,h,e,n,r,o,a=!1,l=null){this.categoryPosition={x:0,y:0},this.spacings={scenarioOffset:0,markerOffset:0,scenarioLabelToBar:0,labelToBar:0,labelToAxis:0,needleWidth:0,needleHeadWidth:0,barWidth:0,varianceAxisLineWidth:0,axisLineWidth:0,auxiliaryLineWidth:0,scenarioLineWidth:0,markerWidth:0,categoryWidth:0,axisTickLength:0},this.categoriesBoxOffset={width:0,height:0},this.padding=t,this.scaleFactors=i,this.fontSize=s,this.axisPosition={x:0,y:0},this.numberOfColumns=h,this.leftSideLengthSync=e,this.topSideLabelHeight=n>0?this.fontSize:0,this.hasStackedHeaders=a,this.rows=l,this.leftSideLabelLength=this.calculateSideLabelLength(n,r,o),this.calculateSpacings(),this.calculateCategoryPosition(),this.calculateAxisPosition()}getBarPositionX(){return this.axisPosition.x}getBarCenterPositionY(t){if(this.rows&&t<this.rows.start.length){const i=this.rows.start[t]+this.rows.weight[t]/2;return this.getAxisPositionY()+this.spacings.scenarioOffset+i*this.spacings.categoryWidth}return this.categoryPosition.y+this.spacings.scenarioOffset+t*this.spacings.categoryWidth}getRowTopPositionY(t){const i=this.rows&&t<this.rows.start.length?this.rows.start[t]:t;return this.getAxisPositionY()+this.spacings.scenarioOffset+i*this.spacings.categoryWidth}getBarWidthAt(t){return this.spacings.barWidth*(this.rows&&t<this.rows.weight.length?this.rows.weight[t]:1)}getBarPositionY(t,i){return i?this.getBarCenterPositionY(t):this.getBarCenterPositionY(t)-this.spacings.scenarioOffset}getCategoryPositionX(t){let i=this.spacings.labelToAxis;return t&&(i=-this.spacings.labelToAxis),this.getAxisPositionX()+i}getAxisTitlePositionX(){return this.axisPosition.x}getAxisTitlePositionY(){return this.axisPosition.y-this.spacings.labelToAxis-this.getTopLabelOverhang()}getStackedHeaderPositionY(){return this.getBarCenterPositionY(0)-.5*this.getBarWidthAt(0)-this.spacings.scenarioLabelToBar}getNeedleWidth(){return this.spacings.needleWidth}getAxisPositionX(){return this.leftSideLabelLength+this.padding.left+this.spacings.labelToAxis}getAxisPositionY(){return this.padding.top+this.getAxisTitleOffset()}loadCategoriesBox(t){this.categoriesBoxOffset=t,this.calculateAxisPosition()}addOffsetByNegativeDataPoints(t,i,s,h){null!=t&&null!=t.value&&t.value<0&&(s&&t.isClipped()?this.axisPosition.x+=Math.abs(t.getClippedValue()*t.pixelPerUnit):this.axisPosition.x+=Math.abs(t.value*t.pixelPerUnit),this.axisPosition.x+=i,this.axisPosition.x+=this.spacings.labelToBar),this.axisPosition.x<h/2&&(this.axisPosition.x=h/2+this.spacings.labelToBar)}getLabelPositionX(t){let i=this.spacings.labelToBar;return t<0&&(i*=-1),this.axisPosition.x+t+i}getLabelPositionY(t){return this.axisPosition.y+t+this.spacings.labelToBar}getCategoryToAxisSpaceing(){return this.spacings.labelToAxis}getCategoryToTopSpaceing(){return this.spacings.scenarioOffset}getCategoryToBottomSpaceing(){return this.spacings.scenarioOffset}getAxisEndPositionY(){const t=this.rows?this.rows.total:this.numberOfColumns;return this.getAxisPositionY()+(t+.5)*this.spacings.categoryWidth}getScenarioLabelPositionOffsetY(t){if(t){const t=.5*this.getBarWidth()+this.spacings.scenarioLabelToBar;return Math.max(t,this.spacings.categoryWidth-this.spacings.scenarioOffset+this.spacings.labelToAxis)}return-(.5*this.getBarWidth()+this.spacings.scenarioLabelToBar)}getBarWidth(){return this.spacings.barWidth}getMarkerPositionY(t,i){return i?this.getBarCenterPositionY(t)-this.spacings.markerOffset-.5*this.getBarWidth():this.getBarCenterPositionY(t)+this.spacings.markerOffset+.5*this.getBarWidth()}getMarkerPositionX(){return this.getBarPositionX()}getMarkerScenarioLabelPositionOffsetY(t){return t?-(.5*this.spacings.markerWidth+this.spacings.scenarioLabelToBar):this.spacings.scenarioLabelToBar+.5*this.spacings.markerWidth}getAxisEndPositionX(){return this.getAxisPositionX()}calculateSpacings(){this.spacings={scenarioOffset:this.fontSize*this.scaleFactors.scenarioOffset,markerOffset:this.fontSize*this.scaleFactors.markerOffset,scenarioLabelToBar:this.fontSize*this.scaleFactors.scenarioLabelToBar,labelToBar:this.fontSize*this.scaleFactors.labelToBar,labelToAxis:this.fontSize*this.scaleFactors.labelToAxis,needleWidth:this.fontSize*this.scaleFactors.needleWidth,needleHeadWidth:this.fontSize*this.scaleFactors.needleHeadWidth,barWidth:this.fontSize*this.scaleFactors.barWidth,varianceAxisLineWidth:this.fontSize*this.scaleFactors.varianceAxisLineWidth,axisLineWidth:this.fontSize*this.scaleFactors.axisLineWidth,auxiliaryLineWidth:this.fontSize*this.scaleFactors.auxiliaryLineWidth,scenarioLineWidth:this.fontSize*this.scaleFactors.scenarioLineWidth,markerWidth:this.fontSize*this.scaleFactors.markerWidth,categoryWidth:this.fontSize*this.scaleFactors.categoryWidth,axisTickLength:this.fontSize*this.scaleFactors.axisTickLength}}calculateCategoryPosition(){this.categoryPosition={x:this.padding.left,y:this.getAxisPositionY()+.5*this.spacings.categoryWidth}}calculateAxisPosition(){this.axisPosition={x:this.getAxisPositionX(),y:this.getAxisPositionY()}}recalculatePositions(){this.calculateCategoryPosition(),this.calculateAxisPosition()}getAxisTitleOffset(){return this.topSideLabelHeight+this.spacings.labelToAxis+this.getTopLabelOverhang()}getTopLabelOverhang(){return this.hasStackedHeaders?this.getStackedHeaderOverhang():this.getTopScenarioLabelOverhang()}getStackedHeaderOverhang(){return Math.max(0,this.fontSize+this.spacings.scenarioLabelToBar+.5*this.spacings.barWidth-(.5*this.spacings.categoryWidth+this.spacings.scenarioOffset))}getTopScenarioLabelOverhang(){return Math.max(0,this.fontSize+.5*this.spacings.barWidth+this.spacings.scenarioLabelToBar-.5*this.spacings.categoryWidth,this.fontSize+.5*this.spacings.markerWidth+this.spacings.scenarioLabelToBar+this.spacings.markerOffset+.5*this.spacings.barWidth-(.5*this.spacings.categoryWidth+this.spacings.scenarioOffset))}calculateSideLabelLength(t,i,s){if(this.leftSideLengthSync)return this.leftSideLengthSync;const h=t/2;let e=i;return h>e&&(e=h),s>e&&(e=s),e}}class Q{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 q{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"}}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}}createPatternMapForStructureBar(){const t=new Map;return t.set("marker-up",this.upMarkerPatternStrings()),t.set("marker-down",this.downMarkerPatternStrings()),t}}class J{constructor(t){this.container=new n,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-structure-fc")}getFCPolygonPattern(){return{background:"",foreground:"",bgOffset:0,pattern:this.pattern}}toString(){return this.container.svg()}}var tt,it,st,ht,et;!function(t){t[t.UP_TO_DATE=0]="UP_TO_DATE",t[t.DIRTY=1]="DIRTY"}(tt||(tt={})),function(t){t.RELATIVE="dr",t.ABSOLUTE="d",t.NONE=""}(it||(it={}));class nt{constructor(t,i){this.data=t,this.scenarios=i,this.variances=[],this.title="",this.hideCategories=!1,this.pixelPerUnit=10,this.pixelPerPercentage=50,this.limit=0,this.sortOrder=new p(new F).default(),this.level=c.CATEGORY,this.filter="",this.measureScale=new g,this.measureUnit="",this.showMeasureScale=!0,this.dataFormatDigits={decimal:1,percent:2},this.stackConfig=null,this.sums="none",this.sumTitle="",this.scenarioLabelTop=!1,this.referenceLine=null,this.italicCategories=[]}}class rt{constructor(t,i,s,h,e,n,r){this.dataRowAdapter=t,this.orderAdapter=i,this.stringAdapter=s,this.dataFormatDigitsAdapter=h,this.db=e,this.fromExpr=n,this.onQueryError=r}adapt(t){const i=K.adaptArray(t.data,this.dataRowAdapter),s=K.adaptArray(t.scenarios,this.stringAdapter),h=new nt(i,s);return l.isArray(t.variances)&&(h.variances=K.adaptArray(t.variances,this.stringAdapter)),l.isString(t.title)&&(h.title=t.title),l.isBoolean(t.hideCategories)&&(h.hideCategories=t.hideCategories),l.isNumber(t.pixelPerUnit)&&(h.pixelPerUnit=t.pixelPerUnit),l.isNumber(t.pixelPerPercentage)&&(h.pixelPerPercentage=t.pixelPerPercentage),l.isNumber(t.limit)&&(h.limit=t.limit),l.isExisting(t.sortOrder)&&(h.sortOrder=this.orderAdapter.adapt(t.sortOrder)),l.isExisting(t.level)&&(h.level=t.level),l.isString(t.filter)&&(h.filter=t.filter.trim()),l.isExisting(t.measureScale)&&(h.measureScale=f.calculateMeasureScale(this.db,this.fromExpr,h.scenarios,t.measureScale,this.onQueryError)),l.isString(t.measureUnit)&&(h.measureUnit=t.measureUnit),l.isBoolean(t.showMeasureScale)&&(h.showMeasureScale=t.showMeasureScale),l.isExisting(t.dataFormatDigits)&&(h.dataFormatDigits=this.dataFormatDigitsAdapter.adapt(t.dataFormatDigits)),l.isExisting(t.stackConfig)&&(h.stackConfig=t.stackConfig),l.isString(t.sums)&&["groups","total","all"].includes(t.sums)&&(h.sums=t.sums),l.isString(t.sumTitle)&&(h.sumTitle=t.sumTitle),l.isBoolean(t.scenarioLabelTop)&&(h.scenarioLabelTop=t.scenarioLabelTop),l.isExisting(t.referenceLine)&&(h.referenceLine=t.referenceLine),l.isArray(t.italicCategories)&&(h.italicCategories=K.adaptArray(t.italicCategories,this.stringAdapter)),h}default(){return new nt([],[])}}class ot{constructor(t,i,s,h){this.value=t,this.scenario=i,this.pixelPerUnit=s||1;const e="string"==typeof h?w(h,null,!0):h;this.variance="neg"===e||e===st.NEG?st.NEG:"pos"===e||e===st.POS?st.POS:st.NEU}isEmpty(){return null==this.value||null==this.scenario}getScaledUnit(){return null==this.value?0:this.value*this.pixelPerUnit}getScaledPercentUnit(){return null==this.value?0:Math.abs(this.value)>1.45?this.value>=0?1.45*this.pixelPerUnit:-1.45*this.pixelPerUnit:this.value*this.pixelPerUnit}getVarianceStyle(){return null==this.value||this.value>=0?this.variance:st.NEU===this.variance?st.NEU:st.POS===this.variance?st.NEG:st.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 at{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 lt{constructor(){}adapt(t){const i=new at;return l.isOperator(t.operation)&&(i.operation=t.operation),l.isNumber(t.rowGroupIndex)&&l.isString(t.rowGroup)&&i.addRowGroup(t.rowGroup,t.rowGroupIndex),l.isNumber(t.categoryIndex)&&l.isString(t.category)&&i.addCategory(t.category,t.categoryIndex),l.isNumber(t.subCategoryIndex)&&l.isString(t.subCategory)&&i.addSubCategory(t.subCategory,t.subCategoryIndex),l.isNumber(t.columnGroupIndex)&&l.isString(t.columnGroup)&&i.addColumnGroup(t.columnGroup,t.columnGroupIndex),l.isNumber(t.columnSubGroupIndex)&&l.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}default(){return new at}setActualValues(t,i){l.isNumber(t.ac1)&&(i.ac1=t.ac1),l.isNumber(t.ac2)&&(i.ac2=t.ac2),l.isNumber(t.ac3)&&(i.ac3=t.ac3),l.isNumber(t.ac4)&&(i.ac4=t.ac4)}setPlanValues(t,i){l.isNumber(t.pl1)&&(i.pl1=t.pl1),l.isNumber(t.pl2)&&(i.pl2=t.pl2),l.isNumber(t.pl3)&&(i.pl3=t.pl3),l.isNumber(t.pl4)&&(i.pl4=t.pl4)}setPreviousPeriodValues(t,i){l.isNumber(t.pp1)&&(i.pp1=t.pp1),l.isNumber(t.pp2)&&(i.pp2=t.pp2),l.isNumber(t.pp3)&&(i.pp3=t.pp3),l.isNumber(t.pp4)&&(i.pp4=t.pp4)}setForecastValues(t,i){l.isNumber(t.fc1)&&(i.fc1=t.fc1),l.isNumber(t.fc2)&&(i.fc2=t.fc2),l.isNumber(t.fc3)&&(i.fc3=t.fc3),l.isNumber(t.fc4)&&(i.fc4=t.fc4)}}class ct{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,this.stackColors=["#000000","#c0c0c0","#808080"],this.locale="de"}}class ut{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 ct(this.scaleFactorsStructureChartAdapter.default(),this.fontStyleAdapter.default(),this.svgStyleGroupAdapter.default(),this.svgStyleGroupAdapter.default(),this.svgVariancesStyleGroupAdapter.default(),this.paddingadapter.default());return l.isExisting(t)&&(l.isExisting(t.scaleFactors)&&(i.scaleFactors=this.scaleFactorsStructureChartAdapter.adapt(t.scaleFactors)),l.isExisting(t.fontStyles)&&(i.fontStyles=this.fontStyleAdapter.adapt(t.fontStyles)),l.isExisting(t.axisStyles)&&(i.axisStyles=this.svgStyleGroupAdapter.adapt(t.axisStyles)),l.isExisting(t.barStyles)&&(i.barStyles=this.svgStyleGroupAdapter.adapt(t.barStyles)),l.isExisting(t.varianceStyles)&&(i.varianceStyles=this.svgVariancesStyleGroupAdapter.adapt(t.varianceStyles)),l.isExisting(t.padding)&&(i.padding=this.paddingadapter.adapt(t.padding)),Array.isArray(t.stackColors)&&t.stackColors.length>0&&(i.stackColors=t.stackColors),i.pattern=new q(i.fontStyles.size).createPatternMapForStructureBar()),i}default(){return new ct(this.scaleFactorsStructureChartAdapter.default(),this.fontStyleAdapter.default(),this.svgStyleGroupAdapter.default(),this.svgStyleGroupAdapter.default(),this.svgVariancesStyleGroupAdapter.default(),this.paddingadapter.default())}}class dt{constructor(){this.scenarioOffset=.3,this.scenarioLabelToBar=.1,this.labelToBar=.3,this.labelToAxis=.3,this.needleWidth=.3,this.needleHeadWidth=.6,this.barWidth=1.2,this.varianceAxisLineWidth=.3,this.axisLineWidth=.1,this.auxiliaryLineWidth=.1,this.scenarioLineWidth=.2,this.markerWidth=.7,this.markerOffset=0,this.categoryWidth=1.9,this.axisTickLength=.3}}class ft{adapt(t){const i=new dt;return l.isNumber(t.scenarioOffset)&&(i.scenarioOffset=t.scenarioOffset),l.isNumber(t.scenarioLabelToBar)&&(i.scenarioLabelToBar=t.scenarioLabelToBar),l.isNumber(t.labelToBar)&&(i.labelToBar=t.labelToBar),l.isNumber(t.labelToAxis)&&(i.labelToAxis=t.labelToAxis),l.isNumber(t.needleWidth)&&(i.needleWidth=t.needleWidth),l.isNumber(t.needleHeadWidth)&&(i.needleHeadWidth=t.needleHeadWidth),l.isNumber(t.barWidth)&&(i.barWidth=t.barWidth),l.isNumber(t.varianceAxisLineWidth)&&(i.varianceAxisLineWidth=t.varianceAxisLineWidth),l.isNumber(t.axisLineWidth)&&(i.axisLineWidth=t.axisLineWidth),l.isNumber(t.auxiliaryLineWidth)&&(i.auxiliaryLineWidth=t.auxiliaryLineWidth),l.isNumber(t.scenarioLineWidth)&&(i.scenarioLineWidth=t.scenarioLineWidth),l.isNumber(t.markerWidth)&&(i.markerWidth=t.markerWidth),l.isNumber(t.markerOffset)&&(i.markerOffset=t.markerOffset),l.isNumber(t.categoryWidth)&&(i.categoryWidth=t.categoryWidth),l.isNumber(t.axisTickLength)&&(i.axisTickLength=t.axisTickLength),i}default(){return new dt}}!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"}(st||(st={})),function(t){t.LIST="LIST",t.SUM="SUM",t.OPT="OPT"}(ht||(ht={})),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"}(et||(et={}));class vt{constructor(t,i,s,h,e,n,r,o){this.group=null,this.segmentFillColor=null,this.maxWidth=null,this.bold=!1,this.italic=!1,this.ID_SCENARIOLABEL="Label",this.CSS_CATEGORIES="categories",this.pointPart="label",this.x=i,this.y=s,this.value=e,null!=t&&(this.group=t.group().id(this.createElementID(t.toString(),h))),this.styles=n,this.isVarianceLabel=!1,this.isRelativeLabel=!1,this.verticalHookLocation=r||et.Top,this.horizontalHookLocation=o||et.Left}setToVarianceLabel(){return this.isVarianceLabel=!0,this}setToRelativeVarianceLabel(){return this.isVarianceLabel=!0,this.isRelativeLabel=!0,this}setSegmentFill(t){return this.segmentFillColor=t,this}setEmphasis(t,i){return this.bold=t,this.italic=i,this}setMaxWidth(t){return this.maxWidth=t,this}setPoint(t,i="label"){return this.pointKey=t,this.pointPart=i,this}updateGroup(t){return this.group=t,this}createElementID(t,i){return t+"_"+i+"_"+this.ID_SCENARIOLABEL}draw(t={percent:2,decimal:1},i=new g){var s;if(this.isEmpty())return this;const h=this.group;let e;const n=this.styles.fontStyles.background||"#ffffff";let r="",o="start";if(!1===Number.isNaN(Number(this.value))){let s=t.percent,h=t.percent,n=1,a="percent";!1===this.isRelativeLabel&&(s=t.decimal,h=t.decimal,n=i.value,a="decimal"),e=P.number(Number(this.value),a,s,h,n,this.styles.locale),Number(this.value)<0&&(o="end");const l=P.number(0,a,s,h,n,this.styles.locale);this.isVarianceLabel&&Number(this.value)>0&&e!==l&&(r="+")}else e=""+this.value,o="start";const a=h.text(r+e);this.bold&&a.font({weight:"bold"}),this.italic&&a.font({style:"italic"}),a.move(this.x,this.y);const l=a.bbox(),c=l.w,u=l.h;return null!=this.maxWidth&&c>this.maxWidth?(null===(s=this.group)||void 0===s||s.remove(),this.group=null,this):(this.horizontalHookLocation===et.Right?(o="end",a.move(a.x()-a.length(),a.y())):this.horizontalHookLocation===et.Center&&(o="middle",a.move(a.x()-a.length()/2,a.y())),this.verticalHookLocation===et.Center?a.move(a.x(),a.y()-u/2):this.verticalHookLocation===et.Bottom&&a.move(a.x(),a.y()-u),a.font({anchor:o}),null!=this.segmentFillColor?a.fill(x(this.segmentFillColor)):null==h||h.rect(c,.9*u).stroke(n).fill(n).opacity(.7).move(a.x(),a.y()+.1*u).insertBefore(a),this.pointKey&&(null==h||h.attr(k(this.pointKey,this.pointPart))),this)}isEmpty(){return null==this.value||""===this.value}setPos(t,i){return this.x=t,this.y=i,this}}class pt{constructor(t,i,s,h){this.height=0,this.ID_AXIS="axis",this.ID_AXIS_TITLE="axis-title",this.CSS_AXIS_TITLE="categories",this.scenarioType=t.scenarioType,this.labelText=t.labelText||null,this.position=i,this.style=h,this.label=new vt(s,this.position.getAxisTitlePositionX(),this.position.getAxisTitlePositionY(),this.ID_AXIS_TITLE,this.labelText,this.style,et.Bottom,et.Center),this.svgGroup=s.group().id(this.ID_AXIS)}draw(){return this.labelText&&this.label.draw(),this.svgGroup.line(this.position.getAxisPositionX(),this.position.getAxisPositionY(),this.position.getAxisEndPositionX(),this.position.getAxisEndPositionY()).addClass(this.ID_AXIS+"-"+this.convertScenarioType()),this.height=this.svgGroup.height(),this}convertScenarioType(){return void 0===this.scenarioType||null==this.scenarioType?"default":`${this.scenarioType}`.slice(0,2)}}class mt{constructor(t,i,s,h,e,n,r,o=null){if(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.barGroup=null,this.isVarianceBar=!1,this.overflowConfig=null,this.isOverflowing=!1,this.overdriveWidth=0,this.dimensions={barLength:0,xPos:0,yPos:0,labelXPos:0,scenarioLabelXPos:0,scenarioLabelYPos:0,clipped:!1},this.hasData=!1,this.dataPoint=s,this.index=h,this.isPrimaryBar=e,this.position=t,this.barStyles=i.barStyles,this.overflowConfig=o,this.scenarioGroup=n,this.styles=i,null!=n&&(this.barGroup=n.group().id(n.toString()+"_"+this.ID_RECT)),!0!==(null==s?void 0:s.isEmpty())&&null!=s.value){this.hasData=!0;let i=et.Left;s.value<0&&(i=et.Right),this.dimensions=this.createDimensions(t,s,h,e),this.label=new vt(this.scenarioGroup,this.dimensions.labelXPos,this.dimensions.yPos,this.ID_DATA_PREFIX,s.value,this.styles,et.Center,i).setPoint(s.key),this.scenarioLabel=this.getScenarioLabel(r)}}setAsVariance(){var t;return this.isVarianceBar=!0,null===(t=this.label)||void 0===t||t.setToVarianceLabel(),this}isRelativeVariance(){var t;return this.isVarianceBar=!0,null===(t=this.label)||void 0===t||t.setToRelativeVarianceLabel(),this}updateLabelGroup(t){var i;return this.isEmpty()||null==t||null===(i=this.label)||void 0===i||i.updateGroup(t),this}draw(t={percent:2,decimal:1},i=new g){var s,h,e;if(this.isEmpty()||null==this.dataPoint.getScenario())return this;let n=this.barStyles.getSVGStyle(this.dataPoint.getScenario());this.isVarianceBar&&(n=this.styles.varianceStyles.getSVGStyle(this.dataPoint.getVarianceStyle()));const r=this.convertToSVGStyle(n,"stroke");let o=this.convertToSVGStyle(n,"fill");const a=this.barStyles.getSVGStyle(this.dataPoint.getScenario()).fillpattern;if(null!=a){const t=this.styles.pattern.get(a);null!=t&&(o=t.pattern)}null===(s=this.scenarioGroup)||void 0===s||s.attr(k(this.dataPoint.key)),null===(h=this.barGroup)||void 0===h||h.attr(k(this.dataPoint.key,"element")),this.isVarianceBar||null===(e=this.barGroup)||void 0===e||e.attr("data-bn-value",this.dataPoint.value),null!=this.barGroup&&(this.isOverflowing&&this.overflowConfig?this.drawOverdriveBar(o,r):this.barGroup.rect(this.dimensions.barLength,this.position.getBarWidth()).fill(o).stroke(r).cy(this.dimensions.yPos).x(this.dimensions.xPos)),this.drawBarDataLabel(t,i),this.drawScenarioLabel()}drawOverdriveBar(t,i){if(!this.barGroup||!this.overflowConfig)return;const s=this.position.getBarPositionX(),h=this.position.getBarWidth(),e=this.dimensions.barLength,{breakGap:n}=this.overflowConfig;this.dataPoint.getScaledUnit()<0?(this.barGroup.rect(e,h).fill(t).stroke(i).x(s-e).cy(this.dimensions.yPos),this.barGroup.rect(this.overdriveWidth,h).fill(t).stroke(i).x(s-e-n-this.overdriveWidth).cy(this.dimensions.yPos),this.drawBreakIndicator(s-e-n,n)):(this.barGroup.rect(e,h).fill(t).stroke(i).x(s).cy(this.dimensions.yPos),this.barGroup.rect(this.overdriveWidth,h).fill(t).stroke(i).x(s+e+n).cy(this.dimensions.yPos),this.drawBreakIndicator(s+e,n))}drawBreakIndicator(t,i){if(!this.barGroup)return;const s=this.position.getBarWidth(),h=this.dimensions.yPos-s/2,e=t+i/2,n=.35*i,r=s/3;let o=`M ${e-n} ${h}`;for(let t=0;t<3;t++)o+=` L ${e-n-.3*i} ${h+r*(t+.5)} L ${e-n} ${h+r*(t+1)}`;let a=`M ${e+n} ${h}`;for(let t=0;t<3;t++)a+=` L ${e+n+.3*i} ${h+r*(t+.5)} L ${e+n} ${h+r*(t+1)}`;this.barGroup.rect(i,s+2).fill("#ffffff").stroke("none").x(t).cy(this.dimensions.yPos),this.barGroup.path(o).fill("none").stroke({color:"#000000",width:1}),this.barGroup.path(a).fill("none").stroke({color:"#000000",width:1})}createDimensions(t,i,s,h){const e=i.getScaledUnit(),n=Math.abs(e);if(this.overflowConfig&&n>0){const r="ac"===i.getScenario()?this.overflowConfig.cutWidth:this.overflowConfig.cutWidth-this.overflowConfig.scenarioCutOffset;if(n>r){this.isOverflowing=!0;const{breakGap:i,overdriveZoneWidth:o,maxOverflow:a}=this.overflowConfig;this.overdriveWidth=a>0?(n-r)/a*o:0;const l=r+i+this.overdriveWidth;return e<0?{clipped:!1,barLength:r,xPos:t.getBarPositionX()-r,yPos:t.getBarPositionY(s,h),labelXPos:t.getLabelPositionX(-l),scenarioLabelXPos:t.getBarPositionX()-.5*r,scenarioLabelYPos:t.getBarPositionY(s,h)+t.getScenarioLabelPositionOffsetY(h)}:{clipped:!1,barLength:r,xPos:t.getBarPositionX(),yPos:t.getBarPositionY(s,h),labelXPos:t.getLabelPositionX(l),scenarioLabelXPos:t.getBarPositionX()+.5*r,scenarioLabelYPos:t.getBarPositionY(s,h)+t.getScenarioLabelPositionOffsetY(h)}}}return e<0?{clipped:!1,barLength:n,xPos:t.getBarPositionX()+e,yPos:t.getBarPositionY(s,h),labelXPos:this.position.getLabelPositionX(e),scenarioLabelXPos:this.position.getBarPositionX()-.5*n,scenarioLabelYPos:this.position.getBarPositionY(s,h)+this.position.getScenarioLabelPositionOffsetY(h)}:{clipped:!1,barLength:e,xPos:t.getBarPositionX(),yPos:t.getBarPositionY(s,h),labelXPos:this.position.getLabelPositionX(e),scenarioLabelXPos:this.position.getBarPositionX()+.5*n,scenarioLabelYPos:this.position.getBarPositionY(s,h)+this.position.getScenarioLabelPositionOffsetY(h)}}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.isVarianceBar||this.scenarioLabel.setPos(this.dimensions.scenarioLabelXPos,this.dimensions.scenarioLabelYPos).draw()}drawBarDataLabel(t,i=new g){var s;this.isPrimaryBar&&(null===(s=this.label)||void 0===s||s.draw(t,i))}isEmpty(){return!1===this.hasData||Number.isNaN(this.dataPoint.value)}getScenarioLabel(t){return new vt(this.scenarioGroup,-1,-1,this.ID_SCENARIO_PREFIX,t,this.styles,this.isPrimaryBar?et.Top:et.Bottom,et.Center)}}class bt{constructor(t,i,s,h,e,n,r,o,a){this.ID_DATA_PREFIX="DATA",this.ID_SCENARIO_PREFIX="SCENARIO",this.FALLBACK_COLOUR="#000000",this.scenarioLabel=null,this._defaultMarkerPattern=null,this.dimensions={barLength:0,xPos:0,yPos:0,labelXPos: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.pointKey=n.key,this.dimensions=this.createMarkerDimensions(n,r,a),this.scenarioLabel=this.getScenarioLabel(o,e,a))}createMarkerDimensions(t,i,s){return t.getScaledUnit()<0?{clipped:!1,labelXPos:0,barLength:Math.abs(t.getScaledUnit()),xPos:this.position.getMarkerPositionX()-Math.abs(t.getScaledUnit()),yPos:this.position.getMarkerPositionY(i,s),scenarioLabelXPos:this.position.getMarkerPositionX()-Math.abs(t.getScaledUnit()),scenarioLabelYPos:this.position.getMarkerPositionY(i,s)+this.position.getMarkerScenarioLabelPositionOffsetY(s)}:{clipped:!1,labelXPos:0,barLength:t.getScaledUnit(),xPos:this.position.getMarkerPositionX()+t.getScaledUnit(),yPos:this.position.getMarkerPositionY(i,s),scenarioLabelXPos:this.position.getMarkerPositionX()+t.getScaledUnit(),scenarioLabelYPos:this.position.getMarkerPositionY(i,s)+this.position.getMarkerScenarioLabelPositionOffsetY(s)}}getScenarioLabel(t,i,s){return null==this.markerGroup?null:new vt(this.markerGroup,-1,-1,this.ID_DATA_PREFIX,t,i,s?et.Bottom:et.Top,et.Center)}convertToSVGStyle(t,i){return null==t&&(t=[]),t.color=t[i]||this.FALLBACK_COLOUR,Object.assign({},t)}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.attr(k(this.pointKey)),this.markerGroup.polygon(this.markerPattern.background).fill("#ffffff").cy(this.dimensions.yPos).cx(this.dimensions.xPos),this.markerGroup.polygon(this.markerPattern.foreground).fill(i).stroke(t).cy(this.dimensions.yPos).cx(this.dimensions.xPos).attr(k(this.pointKey,"element")),null==this.scenarioLabel||this.scenarioLabel.isEmpty()||this.scenarioLabel.setPos(this.dimensions.scenarioLabelXPos,this.dimensions.scenarioLabelYPos).draw(),this}isEmpty(){return!1===this.hasData}getScenario(){var t;return null===(t=this.scenario)||void 0===t?void 0:t.slice(0,2)}}class gt{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.label=null,this.dimensions={barLength:0,xPos:0,yPos:0,labelXPos: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);const n=void 0===(null==s?void 0:s.value)&&null!=(null==s?void 0:s.scenario);if(!0!==(null==s?void 0:s.isEmpty())&&null!=s.value||n){this.hasData=!0,this.dimensions=this.createDimensions(t,s,h);let i=et.Left;s.value<0&&(i=et.Right),this.label=new vt(this.scenarioGroup,this.dimensions.labelXPos,this.dimensions.yPos,this.ID_DATA_PREFIX,n?C:s.value,this.styles,et.Center,i),this.label.setToRelativeVarianceLabel().setPoint(s.key)}}updateLabelGroup(t){var i;return this.isEmpty()||null==t||null===(i=this.label)||void 0===i||i.updateGroup(t),this}draw(t={percent:2,decimal:1}){var i,s,h;if(void 0===(null===(i=this.dataPoint)||void 0===i?void 0:i.value))return null===(s=this.label)||void 0===s||s.draw(t),this;if(this.isEmpty())return this;if(null==this.dimensions)return this;this.scenarioGroup.attr(k(this.dataPoint.key)),this.barGroup.attr(k(this.dataPoint.key,"element"));const e=this.styles.varianceStyles.getSVGStyle(this.dataPoint.getVarianceStyle()),n=e.stroke;let r=e.fill;const o=this.barStyles[this.dataPoint.getScenario()];if(null!=o&&o.fillpattern){const t=this.styles.pattern.get(o.fillpattern);null!=t&&null!=t.pattern&&(r=t.pattern)}this.drawNeedleHead(r,n),this.barGroup.rect(this.dimensions.barLength,this.position.getNeedleWidth()).fill(r).stroke(n).cy(this.dimensions.yPos).x(this.dimensions.xPos),null===(h=this.label)||void 0===h||h.draw(t)}createDimensions(t,i,s){return i.getScaledPercentUnit()<0?{barLength:Math.abs(i.getScaledPercentUnit()),xPos:t.getBarPositionX()+i.getScaledPercentUnit(),yPos:t.getBarCenterPositionY(s),labelXPos:this.position.getLabelPositionX(i.getScaledPercentUnit()-this.position.getNeedleWidth()),clipped:i.isClipped(),scenarioLabelXPos:0,scenarioLabelYPos:0}:{barLength:i.getScaledPercentUnit(),xPos:t.getBarPositionX(),yPos:t.getBarCenterPositionY(s),labelXPos:this.position.getLabelPositionX(i.getScaledPercentUnit()+this.position.getNeedleWidth()),clipped:i.isClipped(),scenarioLabelXPos:0,scenarioLabelYPos:0}}drawNeedleHead(t,i){if(null===this.dimensions)return;const s=this.styles.varianceStyles.needleHeadColour,h=this.styles.varianceStyles.needleHeadColour;if(this.dimensions.clipped){let s="13,0 4,-5 4,5 13,0 8,0 0,-5 0,5 8,0";null!=this.dataPoint.value&&this.dataPoint.value<0&&(s="0,0 9,-5 9,5 0,0 5,0 13,-5 13,5 5,0"),this.barGroup.polygon(s).fill(t).cx(this.getHeadXPosition()).cy(this.dimensions.yPos).fill(t).stroke(i)}else this.barGroup.rect(2*this.position.getNeedleWidth(),2*this.position.getNeedleWidth()).cx(this.getHeadXPosition()).cy(this.dimensions.yPos).fill(s).stroke(h)}isEmpty(){return!1===this.hasData||Number.isNaN(this.dataPoint.value)}getHeadXPosition(){let t=this.dimensions.xPos;return null!=this.dataPoint.value&&this.dataPoint.value>0&&(t+=this.dimensions.barLength),t}}class wt{constructor(t,i,s,h,e,n,r,o,a,l,c,u={}){this.hasData=!1,this.position=t,this.styles=i,this.dataPoint=s,this.index=h,this.segment=e,this.segmentIndex=r,this.stackMode=o,this.stack=a,this.options=u,this.group=c,this.barGroup=c.group().id(`stacked_bar_${h}_seg_${r}`),!0!==(null==s?void 0:s.isEmpty())&&null!=s.value&&(this.hasData=!0)}draw(t={percent:2,decimal:1},i=new g){var s;if(!this.hasData||!Number.isFinite(this.dataPoint.value))return;const h=this.dataPoint.value,e=this.dataPoint.pixelPerUnit,n=this.position.getBarPositionX(),r=this.position.getBarWidthAt(this.index),o=Math.abs(this.segment.end-this.segment.start)*e,a=n+Math.min(this.segment.start,this.segment.end)*e,l=this.position.getBarPositionY(this.index,!0),c=this.styles.stackColors,d=c[this.segmentIndex%c.length],f={color:d},v={color:d,width:.5};this.barGroup.attr(k(this.dataPoint.key,"element")),this.barGroup.attr("data-bn-value",h),this.barGroup.rect(Math.max(o,.5),r).fill(f).stroke(v).cy(l).x(a);const p=o-Math.min(6,.375*this.styles.fontStyles.size),{bold:m=!1,italic:b=!1}=this.options,w=this.stackMode===u.RELATIVE&&null!==(s=this.options.label)&&void 0!==s?s:"share";if(p>0){const s=a+o/2;if(this.stackMode!==u.RELATIVE&&this.stackMode!==u.ABSOLUTE_RELATIVE||"value"===w)new vt(this.group,s,l,"STACK_SEG",h,this.styles,et.Center,et.Center).setSegmentFill(d).setEmphasis(m,b).setMaxWidth(p).setPoint(this.dataPoint.key).draw(t,i);else{const i="plain-share"===w?P.number(100*this.segment.share,"decimal",t.percent,t.percent,1,this.styles.locale):P.number(this.segment.share,"percent",t.percent,t.percent,1,this.styles.locale);new vt(this.group,s,l,"STACK_SEG",i,this.styles,et.Center,et.Center).setSegmentFill(d).setEmphasis(m,b).setMaxWidth(p).setPoint(this.dataPoint.key).draw()}}}drawTotalLabel(t={percent:2,decimal:1},i=new g,s){var h,e;if(this.stackMode===u.RELATIVE&&!this.options.total)return;const n=this.stack.total<0,r=this.position.getLabelPositionX((n?0-this.stack.negative:this.stack.positive)*this.dataPoint.pixelPerUnit),o=this.position.getBarPositionY(this.index,!0);new vt(this.group,r,o,"STACK_TOTAL",this.stack.total,this.styles,et.Center,n?et.Right:et.Left).setEmphasis(null!==(h=this.options.bold)&&void 0!==h&&h,null!==(e=this.options.italic)&&void 0!==e&&e).setPoint(s,"total").draw(t,i)}}class Pt{constructor(t,i,s,h,e){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}isLastDataPoint(t){return this.elementCnt-1===t}isFirsttDataPoint(t){return 0===t}createPrimaryBar(t,i){var s,h,e,n;const r=null===(h=null===(s=this.svgGroups)||void 0===s?void 0:s.scenario1)||void 0===h?void 0:h.group().id(""+i),o=null===(n=null===(e=this.svgGroups)||void 0===e?void 0:e.scenario1Label)||void 0===n?void 0:n.group().id(""+i);let a=null;return this.isLastDataPoint(i)&&(a=`${this.i18n.get(t.scenario)||t.scenario}`),new mt(this.position,this.styles,t,i,!0,r,a,this.overflowConfig).updateLabelGroup(o)}createVarianceBar(t,i){var s,h,e,n;const r=null===(h=null===(s=this.svgGroups)||void 0===s?void 0:s.scenario1)||void 0===h?void 0:h.group().id(""+i),o=null===(n=null===(e=this.svgGroups)||void 0===e?void 0:e.scenario1Label)||void 0===n?void 0:n.group().id(""+i);let a=null;return this.isLastDataPoint(i)&&(a=`${this.i18n.get(t.scenario)||t.scenario}`),new mt(this.position,this.styles,t,i,!0,r,a,this.overflowConfig).updateLabelGroup(o).setAsVariance()}createRelativeVarianceBar(t,i){var s,h,e,n;const r=null===(h=null===(s=this.svgGroups)||void 0===s?void 0:s.scenario1)||void 0===h?void 0:h.group().id(""+i),o=null===(n=null===(e=this.svgGroups)||void 0===e?void 0:e.scenario1Label)||void 0===n?void 0:n.group().id(""+i);return new gt(this.position,this.styles,t,i,r).updateLabelGroup(o)}createSecondaryBar(t,i){var s,h;const e=null===(h=null===(s=this.svgGroups)||void 0===s?void 0:s.scenario2)||void 0===h?void 0:h.group().id(""+i);let n=null;return this.isFirsttDataPoint(i)&&(n=`${this.i18n.get(t.scenario)||t.scenario}`),new mt(this.position,this.styles,t,i,!1,e,n,this.overflowConfig)}createPrimaryMarker(t,i){var s,h;const e=null===(h=null===(s=this.svgGroups)||void 0===s?void 0:s.scenario3)||void 0===h?void 0:h.group().id(""+i),n=this.styles.pattern.get("marker-down")||{foreground:"0,0 1,0 1,1 0,1",background:"0,0 1,0 1,1 0,1",bgOffset:0};let r=null;return this.isFirstDataPoint(i)&&(r=`${this.i18n.get(t.scenario)||t.scenario}`),new bt(this.position,e,n,t.scenario,this.styles,t,i,r,!0)}createSecondaryMarker(t,i){var s,h;const e=null===(h=null===(s=this.svgGroups)||void 0===s?void 0:s.scenario4)||void 0===h?void 0:h.group().id(""+i),n=this.styles.pattern.get("marker-up")||{foreground:"0,0 1,0 1,1 0,1",background:"0,0 1,0 1,1 0,1",bgOffset:0};let r=null;return this.isLastDataPoint(i)&&(r=`${this.i18n.get(t.scenario)||t.scenario}`),new bt(this.position,e,n,t.scenario,this.styles,t,i,r,!1)}isFirstDataPoint(t){return 0===t}}class St{constructor(t,i,s,h,e){this.dataModel=[],this.variancesDataModel=[],this.title="",this.configTitle="",this.configVariances=[],this.smallestDataPointValue=new ot(0,st.AC1,1,st.NEU),this.highestDataPointValue=new ot(0,st.AC1,1,st.NEU),this.smallestVarianceDataPointValue=new ot(0,st.AC1,1,st.NEU),this.highestVarianceDataPointValue=new ot(0,st.AC1,1,st.NEU),this.pixelPerUnit=1,this.pixelPerPercentage=1,this.level=c.CATEGORY,this.hideCategories=!1,this.axisScenario=st.AC1,this.CSS_CATEGORIES="categories",this.state=tt.DIRTY,this.titleLength=0,this.leftSideOffsetForHorizontalSync=0,this.limit=0,this.measureScale=new g,this.measureUnit="",this.dataFormatDigits={percent:2,decimal:1},this.stackConfig=null,this.scenarioPropOrder=[],this.overflowConfig=null,this.stackSides=O([]),this.stackLabelClearance={left:0,right:0},this.fromExpr="",this.rowCount=0,this.sums="none",this.sumTitle="",this.scenarioLabelTop=!1,this.referenceLine=null,this.italicCategories=[],this.db=i,this.tableName=s,this.ruleSet=t||new B,this.i18n=this.createI18n(new Map),this.styles=e,this.setConfig(h),this.position=this.createElementPosition()}updatePosition(){this.position=this.createElementPosition()}createElementPosition(){this.titleLength=this.calculateTitleLength(0);let t=this.calculateLeftSideWidth(this.getVarianceType());const i=this.calculateCategoryWidth();return this.titleLength>t&&(t=this.titleLength),new Z(new Q(this.styles.padding),this.styles.scaleFactors,this.styles.fontStyles.size,this.dataModel.length,this.leftSideOffsetForHorizontalSync,this.titleLength,t,i,!!this.stackConfig&&0===this.variancesDataModel.length||this.scenarioLabelTop,this.rowLayout())}setStyles(t){this.styles=t}setRuleSet(t){this.ruleSet=t||new B}setConfig(t){var i,s;this.state=tt.DIRTY,this.scenarioPropOrder=[...t.scenarios];const h=this.sortScenariosbyVisualisationRules(t.scenarios);this.hideCategories=t.hideCategories||!1,this.limit=t.limit,this.pixelPerUnit=t.pixelPerUnit||1,this.pixelPerPercentage=t.pixelPerPercentage||100,this.setSource(t.filter),this.level=t.level,this.sums=t.sums,this.sumTitle=t.sumTitle,this.scenarioLabelTop=t.scenarioLabelTop,this.referenceLine=t.referenceLine,this.italicCategories=t.italicCategories,this.dataModel=this.populateModel(h,t.level,t.sortOrder),t.stackConfig&&t.stackConfig.by!==d.SCENARIOS&&this.populateDimensionStackSegments(h,t.stackConfig,t.level),this.addSumRows(h);for(const t of this.dataModel)for(const s of[t.scenario1,t.scenario2,t.scenario3,t.scenario4])null==s.value||Number.isNaN(s.value)||(s.key=Object.assign(Object.assign({},T(this.level,t.category)),{scenario:null!==(i=s.scenario)&&void 0!==i?i:void 0}));this.variancesDataModel=this.populateVarianceModel(t.variances,this.dataModel),this.configTitle=t.title,this.configVariances=null!==(s=null==t?void 0:t.variances)&&void 0!==s?s:[],this.updateTitle();const e=this.dataModel.filter((t=>!t.sum));this.smallestDataPointValue=this.findSmallestDataPointValue(e);const n=this.variancesDataModel.filter((t=>!t.sum));this.smallestVarianceDataPointValue=this.findSmallestDataPointValue(n),this.highestDataPointValue=this.findHighestDataPointValue(e),this.highestVarianceDataPointValue=this.findHighestDataPointValue(n),this.axisScenario=this.setAxisScenario(t.variances),this.measureScale=t.measureScale,this.measureUnit=t.measureUnit,this.dataFormatDigits=t.dataFormatDigits,this.stackConfig=t.stackConfig,this.measureStacks(),this.updatePosition()}sortScenariosbyVisualisationRules(t){const i=this;return[...t].sort(((t,s)=>i.ruleSet.getScenarioSorIndex(t)-i.ruleSet.getScenarioSorIndex(s))).reverse()}setI18n(t){this.i18n=this.createI18n(t),this.updateTitle()}updateTitle(){var t;this.title=this.configTitle||P.translateScenarioLabel(null===(t=this.configVariances)||void 0===t?void 0:t.toString(),this.i18n)}createI18n(t){this.state=tt.DIRTY;const i=new Map([["SEPARATOR_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"," "],["thereof","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])}setSource(t){var i,s;if(this.state=tt.DIRTY,this.queryError=void 0,this.fromExpr=G(this.db,this.tableName,t),this.fromExpr)try{const t=this.db.exec(`SELECT COUNT(*) AS cnt FROM ${this.fromExpr}`);this.rowCount=null!==(s=null===(i=t[0])||void 0===i?void 0:i.cnt)&&void 0!==s?s:0}catch(t){this.rowCount=0,this.failQuery(t)}else this.rowCount=0}getQueryError(){return this.queryError}failQuery(t){var i;null!==(i=this.queryError)&&void 0!==i||(this.queryError=z(t))}getUnitBarExtent(){var t,i,s,h;const e=this.isStacked(),n=this.getVarianceType(),r=n!==it.NONE,o=r?this.highestVarianceDataPointValue:this.highestDataPointValue,a=r?this.smallestVarianceDataPointValue:this.smallestDataPointValue;return A({fixedDomain:e?this.stackSides.positive+this.stackSides.negative:void 0,relativeVariance:n===it.RELATIVE,maxPositive:Math.max(null!==(t=null==o?void 0:o.value)&&void 0!==t?t:0,e||r?0:null!==(s=null===(i=this.referenceLine)||void 0===i?void 0:i.value)&&void 0!==s?s:0),minNegative:null!==(h=null==a?void 0:a.value)&&void 0!==h?h:0})}getPercentBarExtent(){var t,i,s,h;return E({relativeVariance:this.getVarianceType()===it.RELATIVE,maxPositive:null!==(i=null===(t=this.highestVarianceDataPointValue)||void 0===t?void 0:t.value)&&void 0!==i?i:0,minNegative:null!==(h=null===(s=this.smallestVarianceDataPointValue)||void 0===s?void 0:s.value)&&void 0!==h?h:0})}getAllocatedCanvasWidth(){const t=this.position.getAxisPositionX(),i=this.calculateRightSideWidth(this.getVarianceType());let s=t+i+ +this.styles.padding.left+this.styles.padding.right;return i<this.titleLength/2&&(s+=this.titleLength/2),t<this.titleLength/2&&(s+=this.titleLength/2),s}getAllocatedCanvasHeight(){return this.position.getAxisEndPositionY()+this.position.spacings.labelToAxis+this.position.fontSize+(this.hasPercentMark()?.8*this.position.fontSize:0)+this.styles.padding.bottom}patternToString(){return"<svg></svg>"}layout(){this.draw(new n)}toString(){const t=new n;return this.draw(t),t.id("drawCanvas"),t.width(this.getAllocatedCanvasWidth()),t.height(this.getAllocatedCanvasHeight()),t.svg()}applyFontToContainer(t){t.attr({"font-size":this.styles.fontStyles.size,"font-family":this.styles.fontStyles.family})}draw(t){this.cleanSVGforRedraw(t),this.applyFontToContainer(t),this.state===tt.DIRTY&&(this.state=tt.UP_TO_DATE),this.variancesDataModel&&this.variancesDataModel.length>0?(this.drawVarianceScenario(this.variancesDataModel,t),this.drawAxisAndLabels(this.variancesDataModel,t)):null!=this.stackConfig?(this.drawStackedScenarios(this.dataModel,t),this.drawStackedHeaders(this.dataModel,t),this.drawAxisAndLabels(this.dataModel,t,!0),this.drawPercentMark(t)):(this.drawScenarios(this.dataModel,t),this.drawAxisAndLabels(this.dataModel,t)),0===this.variancesDataModel.length&&this.drawReferenceLine(t)}setPattern(t,i){this.styles.pattern.set(t,i)}calculateTitleLength(t){const i=S(this.title.length>7?this.title:"_______",{font:this.styles.fontStyles.font,fontSize:this.styles.fontStyles.size+"px"}).width;return i<t?t:i/2}getFooter(){return 1===this.measureScale.value&&""===this.measureUnit?" ":P.translateScenarioLabel("in",this.i18n)+" "+this.measureScale.prefix+this.measureUnit}scenarioStyles(){const t=j(this.styles.barStyles,this.ruleSet);return t===this.styles.barStyles?this.styles:Object.assign(Object.create(Object.getPrototypeOf(this.styles)),this.styles,{barStyles:t})}setAxisScenario(t){let i=st.AC1;if(null!=t&&t.length>0){const s=new y(t.toString());s.isValid&&(i=X(this.ruleSet.getScenarioColorIndex(s.delta))+s.delta.slice(2))}return null===i&&(i=st.AC1),i}populateModel(t,i,s){if(0===this.rowCount||!this.fromExpr)return[];const h=[],e=this.createOrderStr(i,s),n=this.createSelectString(i,s),r=this.createGroupByStr(i,s);let o;try{o=this.db.exec(`SELECT ${n} ${t.length>0?","+t.map((t=>`SUM(${t} * transformOperator(operation)) as ${t}, COUNT(ISNULL(${t})) as ${t}_cnt`)).join(","):""}\n FROM ${this.fromExpr}\n GROUP BY ${r}\n ORDER BY ${e}`)}catch(t){return this.failQuery(t),[]}return this.detectNaNCells(t,o),this.createDataRows(this.limit>0?o.slice(0,this.limit):o,h,t),this.crateRESTRow(o,t,h),h}detectNaNCells(t,i){i.forEach((i=>(t.forEach((t=>{const s=new y(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)))}crateRESTRow(t,i,s){if(this.limit<=0||this.limit>=t.length)return;const h=[];this.createDataRows(t.slice(this.limit),h,i);const e=(t,i)=>Number.isFinite(i)?(Number.isFinite(t)?t:0)+i:t,n=h.reduce((function(t,s){return{id:t.id,category:t.category,type:t.type,scenario1:new ot(e(t.scenario1.value,s.scenario1.value),i[0],t.scenario1.pixelPerUnit,st.NEU),scenario2:new ot(e(t.scenario2.value,s.scenario2.value),i[1],t.scenario2.pixelPerUnit,st.NEU),scenario3:new ot(e(t.scenario3.value,s.scenario3.value),i[2],t.scenario3.pixelPerUnit,st.NEU),scenario4:new ot(e(t.scenario4.value,s.scenario4.value),i[3],t.scenario4.pixelPerUnit,st.NEU)}}),{id:9999,category:"REST",type:it.NONE,scenario1:new ot(NaN,i[0],this.pixelPerUnit,st.NEU),scenario2:new ot(NaN,i[1],this.pixelPerUnit,st.NEU),scenario3:new ot(NaN,i[2],this.pixelPerUnit,st.NEU),scenario4:new ot(NaN,i[3],this.pixelPerUnit,st.NEU)});s.push(n)}createDataRows(t,i,s){t.forEach(((t,h)=>{i.push({id:h,category:t.category,type:it.NONE,scenario1:new ot(t[s[0]],s[0],this.pixelPerUnit,st.NEU),scenario2:new ot(t[s[1]],s[1],this.pixelPerUnit,st.NEU),scenario3:new ot(t[s[2]],s[2],this.pixelPerUnit,st.NEU),scenario4:new ot(t[s[3]],s[3],this.pixelPerUnit,st.NEU)})}))}createOrderStr(t,i){let s=`${t.toLowerCase()}`;return i.hierarchy.length>=1&&(s=i.hierarchy.map((t=>`${t} ${i.direction}`)).toString()),s}createSelectString(t,i){return t===c.CATEGORY&&i.hierarchy.includes(m.CATEGORYINDEX)?`${m.CATEGORYINDEX}, ${c.CATEGORY} as category`:t===c.ROWGROUP&&i.hierarchy.includes(m.ROWGROUPINDEX)?`${m.ROWGROUPINDEX}, ${c.ROWGROUP} as category`:t===c.SUBCATEGORY&&i.hierarchy.includes(m.SUBCATEGORYINDEX)?`${m.SUBCATEGORYINDEX}, ${c.SUBCATEGORY} as category`:`${t.toString()} as category`}createGroupByStr(t,i){return t===c.CATEGORY&&i.hierarchy.includes(m.CATEGORYINDEX)?`${m.CATEGORYINDEX}, ${c.CATEGORY}`:t===c.ROWGROUP&&i.hierarchy.includes(m.ROWGROUPINDEX)?`${m.ROWGROUPINDEX}, ${c.ROWGROUP}`:t===c.SUBCATEGORY&&i.hierarchy.includes(m.SUBCATEGORYINDEX)?`${m.SUBCATEGORYINDEX}, ${c.SUBCATEGORY}`:`${t.toString()}`}calculateCategoryWidth(){if(this.hideCategories)return 5;let t=0;for(const i of this.dataModel){const s=S(i.category,{font:this.styles.fontStyles.font,fontSize:this.styles.fontStyles.size+"px"});s.width>t&&(t=s.width)}return 1.1125*t}findSmallestDataPointValue(t){let i=new ot(0,"default",this.pixelPerUnit,null);for(const s of t)for(const t of[s.scenario1,s.scenario2,s.scenario3,s.scenario4])null!=t&&null!=i.value&&t.value<i.value&&(i=t);return i}findHighestDataPointValue(t){let i=new ot(0,"default",this.pixelPerUnit,null);for(const s of t)for(const t of[s.scenario1,s.scenario2,s.scenario3,s.scenario4])null!=t&&null!=i.value&&t.value>i.value&&(i=t);return i}stackGroups(t){if(!this.stackConfig)return[];const i=this.stackConfig.by===d.SCENARIOS;let s=[];for(const h of i?["scenario1","scenario2","scenario3","scenario4"]:["scenario1"]){const i=t[h];i&&!i.isEmpty()&&null!=i.value&&s.push({value:i.value,scenario:i.scenario,dataPoint:i})}if(0===s.length)return[];const h=this.stackConfig.mode===u.RELATIVE?1:0,e=(t,i)=>({prefix:t,segments:i,layout:_(i.map((t=>t.value)),h),hasValue:i.some((t=>Number.isFinite(t.value)))});if(i){this.sortSegmentsByPropOrder(s);const t=new Map;for(const i of s){const s=L(i.scenario);t.has(s)||t.set(s,[]),t.get(s).push(i)}if(t.size>1){const i=[];for(const s of M)t.has(s)&&(i.push(e(s,t.get(s))),t.delete(s));for(const[s,h]of t)i.push(e(s,h));return i}}else t.stackSegments&&t.stackSegments.length>0&&(s=t.stackSegments.map((t=>({value:t.value,scenario:t.label,dataPoint:t.dataPoint}))));const n=t=>Number.isFinite(t.value)?t.value:0;return"asc"===this.stackConfig.order?s.sort(((t,i)=>n(t)-n(i))):"desc"===this.stackConfig.order&&s.sort(((t,i)=>n(i)-n(t))),[e("",s)]}measureStacks(){const t=[];this.stackLabelClearance={left:0,right:0};for(const i of this.dataModel){const{flipped:s,clearance:h}=this.stackLabelPlace(i),e=this.drawnStackLayouts(i),n=s?"right":"left";this.stackLabelClearance[n]=Math.max(this.stackLabelClearance[n],h),t.push(...e)}this.stackSides=O(t)}stackLabelPlace(t){const i=this.styles.fontStyles.size*this.styles.scaleFactors.labelToBar;return R(this.drawnStackLayouts(t),(t=>{var s;return(null===(s=this.stackConfig)||void 0===s?void 0:s.mode)===u.RELATIVE&&"value"!==this.stackConfig.labels?0:(i+this.calculateTotalLabelWidth(t.total))/this.pixelPerUnit}))}drawnStackLayouts(t){return this.isTextSum(t)?[]:this.stackGroups(t).filter((t=>t.hasValue)).map((t=>t.layout))}calculateTotalLabelWidth(t){const i=this.dataFormatDigits.decimal;return S(P.number(t,"decimal",i,i,this.measureScale.value,this.styles.locale),{font:this.styles.fontStyles.font,fontSize:this.styles.fontStyles.size+"px"}).width}isStacked(){return null!=this.stackConfig&&this.stackSides.positive+this.stackSides.negative>0}populateVarianceModel(t,i){const s=[];if(0===t.length)return s;let h=null;null!=i&&i.length>0&&(h=i[0]);for(const e in t){const n=new y(t[e]);if(n.isValid){const r=this.mapScenarios(n,h),o=n.direction;let a=this.pixelPerUnit;"dr"===n.type&&(a=this.pixelPerPercentage);for(const h in i){const l=new ot(this.calculateVariance(n,i[h],r),n.base,a,o);null===l.value||Number.isNaN(l.value)||(l.key=Object.assign(Object.assign({},T(this.level,i[h].category)),{scenario:t[e]})),s.push({id:Number(h),category:i[h].category,type:"dr"===n.type?it.RELATIVE:it.ABSOLUTE,scenario1:l,scenario2:new ot(null,null,null,null),scenario3:new ot(null,null,null,null),scenario4:new ot(null,null,null,null),sum:i[h].sum})}}}return s}calculateVariance(t,i,s){const h=s.get(t.base),e=s.get(t.delta);return null==h||null==e?null:t.type===it.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}calculateTextBoxWidth(t){return S(P.number(t,"decimal",1,0,1,this.styles.locale),{font:this.styles.fontStyles.font,fontSize:this.styles.fontStyles.size+"px"}).width}calculatePercentageTextBoxWidth(t){let i=0;const s=this.dataFormatDigits.percent,h=t=>P.number(t,"percent",s,s,1,this.styles.locale);return t>0&&h(t)!==h(0)&&(i+=S("+",{font:this.styles.fontStyles.font,fontSize:this.styles.fontStyles.size+"px"}).width),i+=S(" %",{font:this.styles.fontStyles.font,fontSize:this.styles.fontStyles.size+"px"}).width,S(P.number(t,"decimal",1,1,1,this.styles.locale),{font:this.styles.fontStyles.font,fontSize:this.styles.fontStyles.size+"px"}).width+i+i}cleanSVGforRedraw(t){t.clear()}drawAxisAndLabels(t,i,s=!1){const h=i.group().id("AxisAndDateLables");let e=!1;this.hideCategories||t.forEach(((t,i)=>{var n;t.type===it.RELATIVE&&(e=!0);let r=et.Right,o=!0,a=0;if(s){const i=this.stackLabelPlace(t);o=!i.flipped,a=i.clearance*this.pixelPerUnit*(i.flipped?1:-1)}else t.scenario1.value<0&&(o=!1);o||(r=et.Left),new vt(h,this.position.getCategoryPositionX(o)+a,this.position.getBarCenterPositionY(i),"",this.i18n.get(t.category)||t.category,this.styles,et.Center,r).setEmphasis(!!(null===(n=this.dataModel[i])||void 0===n?void 0:n.sum),this.isItalic(t.category)).draw()})),t.forEach(((t,i)=>{const s=this.dataModel[i];if(!(null==s?void 0:s.sum))return;const e=this.position.getBarCenterPositionY(i)-this.position.spacings.categoryWidth/2,n=this.hideCategories?this.position.getAxisPositionX():this.styles.padding.left;h.line(n,e,this.position.getAxisPositionX()+this.sumRowExtent(s),e).stroke({color:"#000000",width:Math.max(.5,this.position.spacings.axisLineWidth/2)}).addClass("sum-line")})),new pt({scenarioType:this.axisScenario,labelText:this.title,isRelative:e},this.position,h,this.styles).draw()}drawScenarios(t,i){const s=i.group().id("Scenarios");let h=-1;t.forEach(((t,i)=>{t.sum||(h=i)}));const e=new Pt(this.position,s,this.scenarioStyles(),this.scenarioLabelTop?0:h+1,this.i18n);e.setOverflowConfig(this.overflowConfig),t.forEach(((t,i)=>{t.sum?this.drawSumValue(t,i,s):(e.createPrimaryBar(t.scenario1,i).draw(this.dataFormatDigits,this.measureScale),e.createSecondaryBar(t.scenario2,i).draw(),e.createPrimaryMarker(t.scenario3,i).draw(),e.createSecondaryMarker(t.scenario4,i).draw())}));const n=t.find((t=>!t.sum));if(this.scenarioLabelTop&&n&&!n.scenario1.isEmpty()&&null!=n.scenario1.scenario){const t=n.scenario1.scenario;new vt(s,this.position.getBarPositionX()+this.position.spacings.labelToAxis,this.position.getStackedHeaderPositionY(),"SCENARIO_HEADER",this.i18n.get(t)||t,this.styles,et.Bottom,et.Left).draw()}}drawSumValue(t,i,s){const h=t.scenario1;if(h.isEmpty()||!Number.isFinite(h.value))return;const e=h.value<0,n=new vt(s,this.position.getLabelPositionX(e?-1e-6:0),this.position.getBarCenterPositionY(i),"SUM_"+i,h.value,this.styles,et.Center,e?et.Right:et.Left).setEmphasis(!0,!1).setPoint(h.key);t.type===it.RELATIVE?n.setToRelativeVarianceLabel():t.type===it.ABSOLUTE&&n.setToVarianceLabel(),n.draw(this.dataFormatDigits,this.measureScale)}drawVarianceScenario(t,i){const s=i.group().id("Scenarios"),h=new Pt(this.position,s,this.scenarioStyles(),t.length,this.i18n);return h.setOverflowConfig(this.overflowConfig),t.forEach(((t,i)=>{t.sum?this.drawSumValue(t,i,s):t.type===it.RELATIVE?h.createRelativeVarianceBar(t.scenario1,i).draw(this.dataFormatDigits):h.createVarianceBar(t.scenario1,i).draw(this.dataFormatDigits,this.measureScale)})),s}sortSegmentsByPropOrder(t){if(0===this.scenarioPropOrder.length)return;const i=this.scenarioPropOrder;t.sort(((t,s)=>{const h=i.indexOf(t.scenario),e=i.indexOf(s.scenario);return(-1===h?i.length:h)-(-1===e?i.length:e)}))}drawStackedScenarios(t,i){if(!this.stackConfig)return;const s=i.group().id("StackedScenarios"),h=this.stackConfig.by===d.SCENARIOS,e=this.stackConfig.mode===u.RELATIVE&&"value"===this.stackConfig.labels,n=e?"value":this.stackConfig.percentMark?"plain-share":"share";t.forEach(((t,i)=>{const r=this.stackGroups(t);if(this.isTextSum(t))return void this.drawSumText(t,i,s);const o={label:n,total:e,bold:!!t.sum,italic:this.isItalic(t.category)};r.forEach(((e,n)=>{let a=null;e.segments.forEach(((t,l)=>{const c=new wt(this.position,this.styles,t.dataPoint,i,e.layout.segments[l],t.scenario,r.length>1?r.length-1-n:l,this.stackConfig.mode,e.layout,h,s,o);c.draw(this.dataFormatDigits,this.measureScale),a=c})),a&&e.hasValue&&a.drawTotalLabel(this.dataFormatDigits,this.measureScale,Object.assign(Object.assign({},T(this.level,t.category)),{scenario:r.length>1?e.prefix:void 0}))}))}))}drawStackedHeaders(t,i){var s;if(!this.stackConfig||0===t.length)return;const h=null!==(s=t.find((t=>!this.isTextSum(t))))&&void 0!==s?s:t[0];if(this.stackConfig.by!==d.SCENARIOS&&(!h.stackSegments||0===h.stackSegments.length))return;const e=this.stackGroups(h);if(0===e.length)return;const n=i.group().id("StackedHeaders"),r=this.position.getBarPositionX(),o=this.position.getStackedHeaderPositionY(),a=(t,i)=>{new vt(n,t,o,"STACK_HEADER",i,this.styles,et.Bottom,et.Center).draw()};if(e.length>1)return void e.forEach((t=>{a(r+(t.layout.positive-t.layout.negative)/2*t.segments[0].dataPoint.pixelPerUnit,this.i18n.get(t.prefix+"1")||t.prefix.toUpperCase())}));const[l]=e;this.stackConfig.totalTitle&&(this.stackConfig.mode!==u.RELATIVE||"value"===this.stackConfig.labels)&&new vt(n,this.position.getLabelPositionX(l.layout.positive*this.pixelPerUnit),o,"STACK_TOTAL_HEADER",this.stackConfig.totalTitle,this.styles,et.Bottom,et.Left).draw(),l.segments.forEach(((t,i)=>{const{start:s,end:h}=l.layout.segments[i];a(r+(s+h)/2*t.dataPoint.pixelPerUnit,this.i18n.get(t.scenario)||t.scenario)}))}getVarianceType(){return this.variancesDataModel.length>0?this.variancesDataModel[0].type:it.NONE}calculateLeftSideWidth(t){var i,s,h;let e=0;const n=this.styles.fontStyles.size*this.styles.scaleFactors.labelToBar;if(it.NONE===t&&this.isStacked())this.stackSides.negative>0&&(e=this.stackSides.negative*this.pixelPerUnit,this.stackSides.minTotal<0&&(e+=n+this.calculateTotalLabelWidth(this.stackSides.minTotal))),this.stackLabelClearance.left>0&&(e=Math.max(e,this.stackLabelClearance.left*this.pixelPerUnit+this.calculateCategoryWidth()));else if(it.NONE===t&&null!=(null===(i=this.smallestDataPointValue)||void 0===i?void 0:i.value)&&this.smallestDataPointValue.value<0){const t=this.calculateTextBoxWidth(this.smallestDataPointValue.value);e=Math.abs(this.smallestDataPointValue.getScaledUnit())+n+t}else if(it.RELATIVE===t&&null!=(null===(s=this.smallestVarianceDataPointValue)||void 0===s?void 0:s.value)&&this.smallestVarianceDataPointValue.value<0){const t=this.calculatePercentageTextBoxWidth(this.smallestVarianceDataPointValue.value);e=Math.abs(this.smallestVarianceDataPointValue.getScaledPercentUnit())+n+t}else if(it.ABSOLUTE===t&&null!=(null===(h=this.smallestVarianceDataPointValue)||void 0===h?void 0:h.value)&&this.smallestVarianceDataPointValue.value<0){const t=this.calculateTextBoxWidth(this.smallestVarianceDataPointValue.value);e=Math.abs(this.smallestVarianceDataPointValue.getScaledUnit())+n+t}return e<=this.titleLength?this.titleLength:e}calculateRightSideWidth(t){var i,s,h,e,n,r;if(this.isStacked()){const t=this.styles.fontStyles.size*this.styles.scaleFactors.labelToBar,e=this.calculateTextBoxWidth(this.stackSides.maxTotal);let n=this.stackSides.positive*this.pixelPerUnit+t+e;if(this.stackSides.minTotal<0&&(n=Math.max(n,this.stackLabelClearance.right*this.pixelPerUnit+this.position.getCategoryToAxisSpaceing()+this.calculateCategoryWidth())),null===(i=this.stackConfig)||void 0===i?void 0:i.totalTitle){const i=S(this.stackConfig.totalTitle,{font:this.styles.fontStyles.font,fontSize:this.styles.fontStyles.size+"px"}).width;n=Math.max(n,this.stackSides.positive*this.pixelPerUnit+t+i)}return Math.max(n,this.titleLength,null!==(h=null===(s=this.sumColumns())||void 0===s?void 0:s.width)&&void 0!==h?h:0,this.referenceLineExtent())}let o=0;const a=this.styles.fontStyles.size*this.styles.scaleFactors.labelToBar;if(it.NONE===t&&null!=(null===(e=this.highestDataPointValue)||void 0===e?void 0:e.value)&&this.highestDataPointValue.value>=0){const t=this.calculateTextBoxWidth(this.highestDataPointValue.value);o=Math.abs(this.highestDataPointValue.getScaledUnit())+a+t}else if(it.RELATIVE===t&&null!=(null===(n=this.highestVarianceDataPointValue)||void 0===n?void 0:n.value)&&this.highestVarianceDataPointValue.value>=0){const t=this.calculatePercentageTextBoxWidth(this.highestVarianceDataPointValue.value);o=Math.abs(this.highestVarianceDataPointValue.getScaledPercentUnit())+a+t}else if(it.ABSOLUTE===t&&null!=(null===(r=this.highestVarianceDataPointValue)||void 0===r?void 0:r.value)&&this.highestVarianceDataPointValue.value>=0){const t=this.calculateTextBoxWidth(this.highestVarianceDataPointValue.value);o=Math.abs(this.highestVarianceDataPointValue.getScaledUnit())+a+t}o=Math.max(o,this.referenceLineExtent());for(const i of this.dataModel)i.sum&&it.NONE===t&&Number.isFinite(i.scenario1.value)&&(o=Math.max(o,this.sumRowExtent(i)));return o<=this.titleLength?this.titleLength:o}populateDimensionStackSegments(t,i,s){var h;if(0===this.rowCount||!this.fromExpr||0===t.length)return;const e={[c.ROWGROUP]:"category",[c.ROWGROUPINDEX]:"category",[c.CATEGORY]:"subCategory",[c.CATEGORYINDEX]:"subCategory"}[s];if(!e)return;const n=s.toString(),r=t[0];let o;try{o=this.db.exec(`SELECT [${n}] as displayGroup, [${e}] as stackLabel, MIN([${e}Index]) as stackIndex, SUM([${r}] * transformOperator(operation)) as stackValue FROM ${this.fromExpr} GROUP BY [${n}], [${e}]`)}catch(t){return void this.failQuery(t)}const a=new Map;for(const t of o){if(null==t.stackValue||null==t.stackLabel)continue;const i=t.stackLabel,s=Number.isFinite(Number(t.stackIndex))&&null!=t.stackIndex?Number(t.stackIndex):NaN,h=a.get(i);(void 0===h||Number.isNaN(h)&&!Number.isNaN(s)||s<h)&&a.set(i,s)}const l=[...a.keys()];[...a.values()].every((t=>!Number.isNaN(t)))&&l.sort(((t,i)=>a.get(t)-a.get(i)));const u=new Map;for(const t of o){const i=t.displayGroup;u.has(i)||u.set(i,new Map),null!=t.stackValue&&null!=t.stackLabel&&u.get(i).set(t.stackLabel,t.stackValue)}const d=new Set(this.dataModel.map((t=>t.category))),f=new Map;for(const[t,i]of u)if(!d.has(t))for(const[t,s]of i)f.set(t,(null!==(h=f.get(t))&&void 0!==h?h:0)+s);for(const t of this.dataModel){const i=9999!==t.id||u.has(t.category)?u.get(t.category):f,s=i&&i.size>0?l.map((t=>{var s;return{label:t,value:null!==(s=i.get(t))&&void 0!==s?s:NaN}})):void 0;t.stackSegments=s&&s.length>0?s.map((i=>{const s=new ot(i.value,r,this.pixelPerUnit,st.NEU);return s.key=Object.assign(Object.assign({},T(this.level,t.category)),{[e]:i.label,scenario:r}),{label:i.label,value:i.value,dataPoint:s}})):[]}}isTextSum(t){return!!t.sum&&!!this.stackConfig&&this.stackConfig.mode!==u.RELATIVE}isItalic(t){return this.italicCategories.includes(t)}hasPercentMark(){var t;return!!(null===(t=this.stackConfig)||void 0===t?void 0:t.percentMark)&&this.stackConfig.mode===u.RELATIVE&&0===this.variancesDataModel.length&&this.isStacked()}addSumRows(t){if("none"===this.sums||0===this.dataModel.length)return;const i=(t,i)=>Number.isFinite(i)?(Number.isFinite(t)?t:0)+i:t,s=(s,h,e)=>{var n,r;const o=(h,e)=>new ot(void 0===t[e]?void 0:s.reduce(((t,s)=>i(t,s[h].value)),NaN),t[e],this.pixelPerUnit,st.NEU),a={id:1e4+this.dataModel.length,category:h,type:it.NONE,scenario1:o("scenario1",0),scenario2:o("scenario2",1),scenario3:o("scenario3",2),scenario4:o("scenario4",3),sum:e};if(s.some((t=>t.stackSegments))){const h=new Map;for(const t of s)for(const s of null!==(n=t.stackSegments)&&void 0!==n?n:[])h.set(s.label,i(null!==(r=h.get(s.label))&&void 0!==r?r:NaN,s.value));a.stackSegments=[...h].map((([i,s])=>({label:i,value:s,dataPoint:new ot(s,t[0],this.pixelPerUnit,st.NEU)})))}return a},h=this.dataModel,e=[],n="total"===this.sums?new Map:this.rowGroups();if(n.size>0){const t=[...new Set([...n.values()].sort(((t,i)=>t.index-i.index)).map((t=>t.name)))];for(const i of t){const t=h.filter((t=>{var s;return(null===(s=n.get(t.category))||void 0===s?void 0:s.name)===i}));if(0===t.length)continue;const r=s(t,i,"group");r.gapAfter=!0,e.push(...t,r)}e.push(...h.filter((t=>!n.has(t.category))))}else e.push(...h);"total"!==this.sums&&"all"!==this.sums||e.push(s(h,this.sumTitle||"SUM_TOTAL","total")),this.dataModel=e}rowGroups(){const t=new Map;if(this.level!==c.CATEGORY&&this.level!==c.CATEGORYINDEX)return t;let i;try{i=this.db.exec(`SELECT [category] as category, [rowGroup] as rowGroup, MIN([rowGroupIndex]) as rowGroupIndex FROM ${this.fromExpr} GROUP BY [category], [rowGroup]`)}catch(i){return this.failQuery(i),t}const s=new Map;return i.forEach(((i,h)=>{var e;if(null==i.rowGroup||""===i.rowGroup)return;const n=String(i.rowGroup),r=Number(i.rowGroupIndex),o=null!=i.rowGroupIndex&&Number.isFinite(r)?r:null!==(e=s.get(n))&&void 0!==e?e:h;s.has(n)||s.set(n,o),t.set(String(i.category),{name:n,index:Math.min(o,s.get(n))})})),t}rowLayout(){var t;const i=this.dataModel,s="total"===(null===(t=this.stackConfig)||void 0===t?void 0:t.thickness),h=i.reduce(((t,i,s)=>i.sum?t:s),-1),e=!this.stackConfig&&!this.scenarioLabelTop&&h>=0&&h<i.length-1;if(!s&&!e&&!i.some((t=>t.gapAfter)))return null;const n=i.map((t=>{if(!s||t.sum)return null;const i=this.stackGroups(t),h=i[i.length-1];return h?Math.abs(h.layout.total):0})),r=this.rowWeights(n),o=[],a=[];let l=0;return i.forEach(((t,s)=>{const n=r[s];o.push(l),a.push(n),l+=n+(t.gapAfter&&s<i.length-1?.5:0)+(e&&s===h?.8:0)})),{start:o,weight:a,total:l}}rowWeights(t){const i=Math.min(1,1/this.styles.scaleFactors.categoryWidth),s=t.map((t=>null===t?1:0)),h=new Set(t.flatMap(((t,i)=>null===t?[]:[i])));let e=h.size;for(;;){const n=[...h].reduce(((i,s)=>i+t[s]),0);if(n<=0){h.forEach((t=>s[t]=e/h.size));break}const r=[...h].filter((s=>t[s]/n*e<i));if(0===r.length||r.length===h.size){h.forEach((i=>s[i]=t[i]/n*e));break}for(const t of r)s[t]=i,e-=i,h.delete(t)}return s}boldWidth(t){return S(t,{font:this.styles.fontStyles.font,fontSize:this.styles.fontStyles.size+"px",fontWeight:"bold"}).width}sumText(t){const i=this.dataFormatDigits.decimal;return P.number(t,"decimal",i,i,this.measureScale.value,this.styles.locale)}sumColumns(){const t=this.dataModel.filter((t=>this.isTextSum(t)));if(0===t.length)return null;const i=this.styles.fontStyles.size,s=.6*i,h=.3*i,e=1.4*i,n=[];let r=0;for(const i of t){const t=this.stackGroups(i),s=t[t.length-1];s&&(s.segments.forEach(((t,i)=>{var s;const h=Number.isFinite(t.value)?this.boldWidth(this.sumText(t.value)):0;n[i]=Math.max(null!==(s=n[i])&&void 0!==s?s:0,h)})),r=Math.max(r,this.boldWidth(this.sumText(s.layout.total))))}const o=[];let a=.3*i;for(const t of n.length>1?n:[])o.push(a),a+=s+h+t+e;return{x:o,totalX:a,width:a+r,key:s,keyGap:h}}drawSumText(t,i,s){const h=this.sumColumns(),e=this.stackGroups(t),n=e[e.length-1];if(!h||!n)return;const r=this.position.getBarPositionX(),o=this.position.getBarCenterPositionY(i),a=this.styles.stackColors,l=s.group().id(`stacked_sum_${i}`);n.segments.forEach(((t,i)=>{if(!Number.isFinite(t.value)||void 0===h.x[i])return;const s=r+h.x[i];l.rect(h.key,h.key).fill({color:a[i%a.length]}).cy(o).x(s),new vt(l,s+h.key+h.keyGap,o,`SUM_SEG_${i}`,t.value,this.styles,et.Center,et.Left).setEmphasis(!0,!1).setPoint(t.dataPoint.key).draw(this.dataFormatDigits,this.measureScale)})),new vt(l,r+h.totalX,o,"SUM_TOTAL",n.layout.total,this.styles,et.Center,et.Left).setEmphasis(!0,!1).setPoint(T(this.level,t.category),"total").draw(this.dataFormatDigits,this.measureScale)}sumRowExtent(t){var i,s,h;const e=this.styles.fontStyles.size*this.styles.scaleFactors.labelToBar;if(this.variancesDataModel.length>0)return 0;if(this.isTextSum(t))return null!==(s=null===(i=this.sumColumns())||void 0===i?void 0:i.width)&&void 0!==s?s:0;if(this.stackConfig){const i="value"===this.stackConfig.labels?e+this.boldWidth(this.sumText(null!==(h=t.scenario1.value)&&void 0!==h?h:0)):0;return this.stackSides.positive*this.pixelPerUnit+i}return Number.isFinite(t.scenario1.value)?e+this.boldWidth(this.sumText(t.scenario1.value)):0}referenceLineOffset(){var t;const i=this.referenceLine;return!i||!Number.isFinite(i.value)||this.variancesDataModel.length>0?null:((null===(t=this.stackConfig)||void 0===t?void 0:t.mode)===u.RELATIVE?i.value/100:i.value)*this.pixelPerUnit}referenceLineExtent(){var t;const i=this.referenceLineOffset();if(null===i||i<=0)return 0;const s=(null===(t=this.referenceLine)||void 0===t?void 0:t.label)?S(this.referenceLine.label,{font:this.styles.fontStyles.font,fontSize:this.styles.fontStyles.size+"px"}).width:0;return i+Math.max(s/2,.25*this.styles.fontStyles.size)}drawPercentMark(t){if(!this.hasPercentMark())return;const i=t.group().id("PercentMark"),s=this.styles.fontStyles.size,h=this.position.getBarPositionX()+this.stackSides.positive*this.pixelPerUnit,e=this.position.getAxisPositionY(),n=this.position.getAxisEndPositionY(),r=n+.15*s,o=r+.5*s;i.line(h,e,h,n).stroke({color:"#000000",width:this.position.spacings.axisLineWidth}),i.polygon(`${h},${r} ${h-.25*s},${o} ${h+.25*s},${o}`).fill("#000000"),new vt(i,h,o+.1*s,"PERCENT_MARK","100%",this.styles,et.Top,et.Center).setEmphasis(!0,!1).draw()}drawReferenceLine(t){const i=this.referenceLine,s=this.referenceLineOffset();if(!i||null===s||0===this.dataModel.length)return;const h=t.group().id("ReferenceLine"),e=this.styles.fontStyles.size,n=`var(--bn-annotation-color, ${Y["bn-annotation"].color})`,r=this.position.getBarPositionX()+s,o=this.position.getStackedHeaderPositionY()-(this.stackConfig||this.scenarioLabelTop?1.1*e:0),a=t=>{var s,h;if(t.sum)return!1;if(!this.stackConfig)return(null!==(s=t.scenario1.value)&&void 0!==s?s:0)>=i.value;const e=null===(h=this.stackGroups(t)[0])||void 0===h?void 0:h.layout.segments[0];return null!=e&&e.end*this.pixelPerUnit>=r-this.position.getBarPositionX()};let l=this.dataModel.findIndex((t=>!a(t)))-1;l<0&&(l=this.dataModel.reduce(((t,i,s)=>i.sum?t:s),0));const c=this.position.getBarCenterPositionY(l)+this.position.getBarWidthAt(l)/2;h.line(r,o,r,c).attr("style",`stroke: ${n}; stroke-width: ${Math.max(1,this.position.spacings.axisLineWidth)}px`),h.polygon(`${r},${o+.5*e} ${r-.25*e},${o} ${r+.25*e},${o}`).attr("style",`fill: ${n}`),i.label&&h.plain(i.label).attr({x:r,y:o-.3*e,"text-anchor":"middle"}).attr("style",`fill: ${n}`)}hasNoData(){return 0===this.dataModel.length}setAvailableWidth(t){if(this.pixelPerUnit<=0||t<=0)this.overflowConfig=null;else if(null==this.stackConfig){if(this.overflowConfig=this.calculateOverflowConfig(t),this.overflowConfig){const{cutWidth:t,overdriveZoneWidth:i,breakGap:s}=this.overflowConfig,h=t+i+s;this.variancesDataModel&&this.variancesDataModel.length>0?(this.highestVarianceDataPointValue.getScaledUnit()>t&&(this.highestVarianceDataPointValue=new ot(h,this.highestVarianceDataPointValue.scenario,1,this.highestVarianceDataPointValue.variance)),null!=this.smallestVarianceDataPointValue.value&&Math.abs(this.smallestVarianceDataPointValue.getScaledUnit())>t&&(this.smallestVarianceDataPointValue=new ot(-h,this.smallestVarianceDataPointValue.scenario,1,this.smallestVarianceDataPointValue.variance))):(this.highestDataPointValue.getScaledUnit()>t&&(this.highestDataPointValue=new ot(h,this.highestDataPointValue.scenario,1,this.highestDataPointValue.variance)),null!=this.smallestDataPointValue.value&&Math.abs(this.smallestDataPointValue.getScaledUnit())>t&&(this.smallestDataPointValue=new ot(-h,this.smallestDataPointValue.scenario,1,this.smallestDataPointValue.variance))),this.updatePosition()}}else this.overflowConfig=null}calculateOverflowConfig(t){const i=this.variancesDataModel&&this.variancesDataModel.length>0;if(this.getVarianceType()===it.RELATIVE)return null;const s=i?this.highestVarianceDataPointValue:this.highestDataPointValue,h=i?this.smallestVarianceDataPointValue:this.smallestDataPointValue,e=s.getScaledUnit(),n=null!=h.value?Math.abs(h.getScaledUnit()):0,r=Math.max(e,n);if(r<=0)return null;const o=this.styles.fontStyles.size,a=o*this.styles.scaleFactors.labelToBar,l=1.5*o,c=.3*o,u=.8*o,d=t-this.position.getAxisPositionX()-this.styles.padding.left-this.styles.padding.right-a-this.calculateTextBoxWidth(s.value||0)-l-c;if(d<=u)return null;const f=d-u;return r<=f?null:{cutWidth:d,overdriveZoneWidth:l,breakGap:c,maxOverflow:r-f,scenarioCutOffset:u}}}const yt=t(class extends i{constructor(t){super(),!1!==t&&this.__registerHost(),this.__attachShadow(),this.tableName="",this.dataVersion=0,this.chartTitle="",this.scenarios=[],this.variances=[],this.hideCategories=!1,this.pixelPerUnit=10,this.pixelPerPercentage=50,this.limit=0,this.i18n=new Map,this.order={hierarchy:[],direction:b.ASC},this.level=c.CATEGORY,this.filter="",this.measureScale="_",this.measureUnit="",this.showMeasureScale=!0,this.dataFormatDigits={percent:2,decimal:1},this.stackConfig=null,this.sums="none",this.sumTitle="",this.scenarioLabelTop=!1,this.referenceLine=null,this.italicCategories=[],this.parentDimensions={width:0,height:0},U(this)}getDb(){return this.stores||(this.stores=V(this.element)),this.stores.db.db}render(){var t,i,e,n;if(void 0===this.chart||void 0!==this.queryError)return s(h,null);if(this.chart.hasNoData()){const i=null!==(t=this.i18n.get("no-data"))&&void 0!==t?t:"No Data";return s(h,{class:"no-data"},s("div",{class:"empty-state"},i))}return s(h,null,s("div",{innerHTML:null===(i=this.pattern)||void 0===i?void 0:i.toString(),class:"hidePatternContainer",style:{width:"0",height:"0",overflow:"hidden"}}),s("div",{class:this.showMeasureScale?"footer":"footer-hide"},null===(e=this.chart)||void 0===e?void 0:e.getFooter()),s("div",{innerHTML:null===(n=this.chart)||void 0===n?void 0:n.toString()}))}syncQueryError(){var t,i;this.queryError=null!==(t=this.measureScaleError)&&void 0!==t?t:null===(i=this.chart)||void 0===i?void 0:i.getQueryError(),H(this.errors,this.queryError)}async componentWillLoad(){var t;const i=this.getDb(),s=this.prepareConfig(),h=this.prepareStyle();this.chart=new St(new B(this.ruleSetConfig),i,this.tableName,s,h),this.chart.setI18n(this.i18n);const e=s.pixelPerUnit<=0;this.autoFitScaling(s,h),this.chart.setAvailableWidth(e?0:(null===(t=this.parentDimensions)||void 0===t?void 0:t.width)||0),this.pattern=new J(this.chart.styles),this.chart.setPattern("hatched",this.pattern.getFCPolygonPattern()),this.syncQueryError()}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.setRuleSet(new B(this.ruleSetConfig)),this.chart.setConfig(i);const h=i.pixelPerUnit<=0;this.autoFitScaling(i,s),this.chart.setAvailableWidth(h?0:(null===(t=this.parentDimensions)||void 0===t?void 0:t.width)||0),this.pattern=new J(this.chart.styles),this.chart.setPattern("hatched",this.pattern.getFCPolygonPattern()),this.syncQueryError()}autoFitScaling(t,i){var s;const h=t.pixelPerUnit<=0,e=t.pixelPerPercentage<=0;if(!h&&!e)return;const n=()=>{var i;null===(i=this.reportAutoScaling)||void 0===i||i.call(this,{unit:h?t.pixelPerUnit:void 0,percentage:e?t.pixelPerPercentage:void 0})},r=null===(s=this.parentDimensions)||void 0===s?void 0:s.width,o=this.getDb(),a=()=>{this.chart=new St(new B(this.ruleSetConfig),o,this.tableName,t,i),this.chart.setI18n(this.i18n)},l=()=>(this.chart.layout(),this.chart.getAllocatedCanvasWidth());if(!r||r<=0)return h&&(t.pixelPerUnit=1),e&&(t.pixelPerPercentage=50),a(),void n();h&&(t.pixelPerUnit=1),e&&(t.pixelPerPercentage=1),a();let c=l();if(c<=0)return void n();const u=Math.max(D,.9*r/c);let d=!1,f=!1,v=null;for(let i=0;i<=3;i++){const i=W({target:r,measured:c,unitExtent:h?this.chart.getUnitBarExtent():0,pctExtent:e?this.chart.getPercentBarExtent():0,currentPpu:t.pixelPerUnit,currentPpp:t.pixelPerPercentage});if(void 0===i.ppu&&void 0===i.ppp)break;if(h&&void 0!==i.ppu&&(t.pixelPerUnit=i.ppu,d=!0),e&&void 0!==i.ppp&&(t.pixelPerPercentage=i.ppp,f=!0),a(),c=l(),c<=r+.5&&(v={ppu:t.pixelPerUnit,ppp:t.pixelPerPercentage},c>=.98*r))break}let p=!1;if(h&&!d&&(t.pixelPerUnit=u,p=!0),e&&!f&&(t.pixelPerPercentage=u,p=!0),c>r+.5){if(v)d&&(t.pixelPerUnit=v.ppu),f&&(t.pixelPerPercentage=v.ppp);else{const i=r/c;h&&(t.pixelPerUnit=Math.max(D,t.pixelPerUnit*i)),e&&(t.pixelPerPercentage=Math.max(D,t.pixelPerPercentage*i))}p=!0}p&&a(),n()}async componentWillRender(){}componentDidLoad(){}componentDidUpdate(){}prepareConfig(){const t=this.getDb(),i=G(t,this.tableName,this.filter);return this.measureScaleError=void 0,new rt(new lt,new p(new F),new F,new v,t,i,(t=>{this.measureScaleError=z(t)})).adapt({scenarios:this.scenarios,variances:this.variances,title:this.chartTitle,hideCategories:this.hideCategories,pixelPerUnit:this.pixelPerUnit,pixelPerPercentage:this.pixelPerPercentage,level:this.level,limit:this.limit,sortOrder:this.order,filter:this.filter,measureScale:this.measureScale,measureUnit:this.measureUnit,showMeasureScale:this.showMeasureScale,dataFormatDigits:this.dataFormatDigits,stackConfig:this.stackConfig,sums:this.sums,sumTitle:this.sumTitle,scenarioLabelTop:this.scenarioLabelTop,referenceLine:this.referenceLine,italicCategories:this.italicCategories})}prepareStyle(){var t,i;const s=new ut(new ft,new r,new o(new N),new I(new N),new a).adapt(this.styles);return s.locale=(null===(i=null===(t=V(this.element).context)||void 0===t?void 0:t.state)||void 0===i?void 0:i.locale)||"de",s}get element(){return this}static get style(){return':host(.no-data){display:block;box-sizing:border-box;width:100%;height:100%}:host(.no-data)>div{float:none;width:100%;height:100%}:host(.no-data) .no-data~.no-data{display:none}.empty-state{box-sizing:border-box;display:flex;align-items:center;justify-content:center;float:none;width:100%;height:100%;min-height:3em;margin:0;padding:0.5em;overflow:hidden;border:0.1em dashed #ddd;color:#808080;font-family:var(--bn-font-family, "Noto Sans", sans-serif);font-size:var(--bn-font-size, 13.3333px);font-style:normal;text-align:center}:host{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)}.container{display:flex;flex-direction:row}.background-image{display:flex;flex-wrap:wrap;justify-content:flex-end}.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-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}svg#drawCanvas{display:block}.footer{margin:0.2em;font-size:0.6em}.footer-hide{margin:0.2em;font-size:0.6em;opacity:0}'}},[1,"bn-chart-structure-renderer",{tableName:[1,"table-name"],dataVersion:[2,"data-version"],chartTitle:[1,"chart-title"],scenarios:[16],variances:[16],hideCategories:[4,"hide-categories"],pixelPerUnit:[2,"pixel-per-unit"],pixelPerPercentage:[2,"pixel-per-percentage"],reportAutoScaling:[16],errors:[16],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],sums:[1],sumTitle:[1,"sum-title"],scenarioLabelTop:[4,"scenario-label-top"],referenceLine:[16],italicCategories:[16],parentDimensions:[16],ruleSetConfig:[16]}]);function xt(){"undefined"!=typeof customElements&&["bn-chart-structure-renderer"].forEach((t=>{"bn-chart-structure-renderer"===t&&(customElements.get(e(t))||customElements.define(e(t),yt))}))}export{yt as B,xt as d}
|