@bino-bi/bn-template-engine 1.0.0-next.48 → 1.0.0-next.49

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (108) hide show
  1. package/dist/bn-template-engine/bn-template-engine.esm.js +1 -1
  2. package/dist/bn-template-engine/{p-b3f5eba0.entry.js → p-2de524d0.entry.js} +1 -1
  3. package/dist/bn-template-engine/{p-a6017fce.entry.js → p-510d2ee6.entry.js} +1 -1
  4. package/dist/bn-template-engine/{p-6ab684a9.entry.js → p-8fc90dc8.entry.js} +1 -1
  5. package/dist/bn-template-engine/p-BFl7OwcC.js +1 -0
  6. package/dist/bn-template-engine/{p-3ktFZb1x.js → p-Bxa4pX1M.js} +1 -1
  7. package/dist/bn-template-engine/p-c1d679af.entry.js +1 -0
  8. package/dist/cjs/bn-annotation-layer_30.cjs.entry.js +628 -108
  9. package/dist/cjs/bn-grid.cjs.entry.js +1 -1
  10. package/dist/cjs/bn-image.cjs.entry.js +1 -1
  11. package/dist/cjs/bn-text.cjs.entry.js +2 -2
  12. package/dist/cjs/{withStyled-DHKHBdRb.js → withStyled-pkdctrK9.js} +18 -1
  13. package/dist/cjs/{withTranslation-CLwC9a8V.js → withTranslation-BIzTNYZM.js} +1 -1
  14. package/dist/collection/components/bn-annotation-layer/bn-annotation-layer.css +19 -0
  15. package/dist/collection/components/bn-annotation-layer/bn-annotation-layer.js +65 -8
  16. package/dist/collection/components/bn-annotation-layer/utils/marks.js +85 -5
  17. package/dist/collection/components/bn-annotation-layer/utils/matchPoint.js +7 -1
  18. package/dist/collection/components/bn-chart-time/bn-chart-time-renderer/bn-chart-time-renderer.js +20 -6
  19. package/dist/collection/components/bn-chart-time/bn-chart-time.js +55 -23
  20. package/dist/collection/components/bn-chart-time/utils/TimeChart.js +329 -53
  21. package/dist/collection/components/bn-chart-time/utils/elements/Column.js +4 -1
  22. package/dist/collection/components/bn-chart-time/utils/elements/Label.js +2 -1
  23. package/dist/collection/components/bn-chart-time/utils/elements/StackedColumn.js +53 -11
  24. package/dist/collection/utils/annotations.js +1 -1
  25. package/dist/collection/utils/constants.js +2 -0
  26. package/dist/collection/utils/layoutState/svgChartElements.js +10 -0
  27. package/dist/collection/utils/validate.js +16 -1
  28. package/dist/components/bn-annotation-layer.js +1 -1
  29. package/dist/components/bn-annotation-list.js +1 -1
  30. package/dist/components/bn-chart-bubble-renderer.js +1 -1
  31. package/dist/components/bn-chart-bubble.js +1 -1
  32. package/dist/components/bn-chart-bullet-renderer.js +1 -1
  33. package/dist/components/bn-chart-bullet.js +1 -1
  34. package/dist/components/bn-chart-scatter-renderer.js +1 -1
  35. package/dist/components/bn-chart-scatter.js +1 -1
  36. package/dist/components/bn-chart-structure-renderer.js +1 -1
  37. package/dist/components/bn-chart-structure.js +1 -1
  38. package/dist/components/bn-chart-time-renderer.js +1 -1
  39. package/dist/components/bn-chart-time.js +1 -1
  40. package/dist/components/bn-grid.js +1 -1
  41. package/dist/components/bn-image.js +1 -1
  42. package/dist/components/bn-layout-card.js +1 -1
  43. package/dist/components/bn-layout-page.js +1 -1
  44. package/dist/components/bn-page.js +1 -1
  45. package/dist/components/bn-table-renderer.js +1 -1
  46. package/dist/components/bn-table.js +1 -1
  47. package/dist/components/bn-text.js +1 -1
  48. package/dist/components/bn-title-renderer.js +1 -1
  49. package/dist/components/bn-title.js +1 -1
  50. package/dist/components/bn-tree.js +1 -1
  51. package/dist/components/{p-CLjuZoiT.js → p-B11cXOLy.js} +1 -1
  52. package/dist/components/p-BBdzTx8V.js +1 -0
  53. package/dist/components/{p-B1_wkOLx.js → p-BVNOmHh4.js} +1 -1
  54. package/dist/components/p-BXP6aagM.js +1 -0
  55. package/dist/components/{p-CG-iY7pQ.js → p-Blre9f28.js} +1 -1
  56. package/dist/components/p-CHJ6WE0l.js +1 -0
  57. package/dist/components/{p-Do4GqlMV.js → p-CHhxQoF9.js} +1 -1
  58. package/dist/components/{p-C-3TOa6K.js → p-CJ0-xdfZ.js} +1 -1
  59. package/dist/components/{p-BFoRIqDi.js → p-CO6bgquz.js} +1 -1
  60. package/dist/components/{p-CytMTBFu.js → p-CSJCkHEL.js} +1 -1
  61. package/dist/components/p-CVfmhtEW.js +1 -0
  62. package/dist/components/{p-Zuxd3z0q.js → p-Cc0gaLwp.js} +1 -1
  63. package/dist/components/p-CuUfiEu0.js +1 -0
  64. package/dist/components/{p-DUZCLRVu.js → p-D362XOg2.js} +1 -1
  65. package/dist/components/p-DBj1Yd3M.js +1 -0
  66. package/dist/components/{p-BjgkgCAQ.js → p-DHX92KDP.js} +1 -1
  67. package/dist/components/p-DHloMyxV.js +1 -0
  68. package/dist/components/{p-Uc0zvXcQ.js → p-Dd1QOWDV.js} +1 -1
  69. package/dist/components/p-DguYWLBj.js +1 -0
  70. package/dist/components/p-Do-IGHJk.js +1 -0
  71. package/dist/components/{p-DDo-fu3v.js → p-DsC0ew4j.js} +1 -1
  72. package/dist/components/p-HVN8BNWN.js +1 -0
  73. package/dist/components/{p-Dyzb4ika.js → p-YSRTB0jS.js} +1 -1
  74. package/dist/components/{p-CrZ_O3DT.js → p-k7heRDPP.js} +1 -1
  75. package/dist/components/{p-dO0utE8m.js → p-keKnrAVS.js} +1 -1
  76. package/dist/components/p-x0W2_FAX.js +1 -0
  77. package/dist/components/p-y12CmIFS.js +1 -0
  78. package/dist/esm/bn-annotation-layer_30.entry.js +628 -108
  79. package/dist/esm/bn-grid.entry.js +1 -1
  80. package/dist/esm/bn-image.entry.js +1 -1
  81. package/dist/esm/bn-text.entry.js +2 -2
  82. package/dist/esm/{withStyled-CTZFjg4L.js → withStyled-B62R20Zx.js} +18 -1
  83. package/dist/esm/{withTranslation-BESW5BNq.js → withTranslation-BEseMLQ6.js} +1 -1
  84. package/dist/types/components/bn-annotation-layer/utils/marks.d.ts +48 -0
  85. package/dist/types/components/bn-annotation-layer/utils/matchPoint.d.ts +4 -0
  86. package/dist/types/components/bn-chart-time/bn-chart-time.d.ts +29 -6
  87. package/dist/types/components/bn-chart-time/utils/TimeChart.d.ts +51 -2
  88. package/dist/types/components/bn-chart-time/utils/elements/StackedColumn.d.ts +5 -1
  89. package/dist/types/components/bn-chart-time/utils/model/TimeChartComponentConfig.d.ts +6 -0
  90. package/dist/types/components.d.ts +6 -6
  91. package/dist/types/utils/annotations.d.ts +11 -1
  92. package/dist/types/utils/constants.d.ts +3 -1
  93. package/dist/types/utils/layoutState/types.d.ts +2 -0
  94. package/package.json +1 -1
  95. package/dist/bn-template-engine/p-203e7d6a.entry.js +0 -1
  96. package/dist/bn-template-engine/p-DXtYQE4s.js +0 -1
  97. package/dist/components/p-6gET6YXc.js +0 -1
  98. package/dist/components/p-BFWvVe7v.js +0 -1
  99. package/dist/components/p-C8rpOS5t.js +0 -1
  100. package/dist/components/p-CUoPUIej.js +0 -1
  101. package/dist/components/p-ChpAMqbN.js +0 -1
  102. package/dist/components/p-D3hr9wra.js +0 -1
  103. package/dist/components/p-DFybNETX.js +0 -1
  104. package/dist/components/p-DRmphEA0.js +0 -1
  105. package/dist/components/p-D_K7tYhY.js +0 -1
  106. package/dist/components/p-Dw3rv_Y9.js +0 -1
  107. package/dist/components/p-TNX3alPU.js +0 -1
  108. package/dist/components/p-j42D1yrQ.js +0 -1
@@ -1 +1 @@
1
- import{C as t}from"./p-DFybNETX.js";const n=[["rowGroup","data-bn-row-group"],["category","data-bn-category"],["subCategory","data-bn-sub-category"],["date","data-bn-date"],["scenario","data-bn-scenario"],["row","data-bn-row"]],r="data-bn-part";function e(t,e){const a={};if(!t)return a;for(const[r,e]of n){const n=t[r];null!=n&&""!==n&&(a[e]=String(n))}return e&&(a[r]=e),a}function a(t){const e=t.getAttribute(r);if(!e)return;const a={part:e};for(const[r,e]of n){const n=t.getAttribute(e);null!=n&&(a[r]=n)}return a}function o(t){if(!t)return;const n=/^(\d{4}-\d{2}-\d{2})T(\d{2}:\d{2}:\d{2})/.exec(t);return n?"00:00:00"===n[2]?n[1]:`${n[1]}T${n[2]}`:t}function u(t,n){return null==n?{}:t.startsWith("rowGroup")?{rowGroup:String(n)}:t.startsWith("subCategory")?{subCategory:String(n)}:{category:String(n)}}function f(t){return"fc"===t||"hatched"===t?"hatched":"solid"===t||"outlined"===t?t:void 0}class s{constructor(t="#000000",n="#000000",r=.1){this.stroke=t,this.fill=n,this.width=r}}class d{adapt(n){const r=new s(n.stroke,n.fill,n.width);return r.fillpattern=f(n.fillpattern),"outlined"===r.fillpattern&&(r.fill="transparent"),t.isString(n.dasharray)&&(r.dasharray=n.dasharray),r}default(){return new s("#000000","#000000",.3)}defaultAC(){return new s("#000000","#000000",.3)}defaultFC(){const t=new s("#000000","#000000",.3);return t.dasharray="10 5 5 5",t.fillpattern="hatched",t}defaultPP(){return new s("#999999","#999999",.3)}defaultPL(){return new s("#000000","#ffffff",.3)}defaultPos(){return new s("#00ff00","#00ff00",.3)}defaultNeg(){return new s("#ff0000","#ff0000",.3)}defaultNeu(){return new s("#999999","#999999",.3)}}export{d as S,e as d,u as l,f as n,o as p,a as r}
1
+ import{C as t}from"./p-DguYWLBj.js";const n=[["rowGroup","data-bn-row-group"],["category","data-bn-category"],["subCategory","data-bn-sub-category"],["date","data-bn-date"],["scenario","data-bn-scenario"],["row","data-bn-row"]],r="data-bn-part";function e(t,e){const a={};if(!t)return a;for(const[r,e]of n){const n=t[r];null!=n&&""!==n&&(a[e]=String(n))}return e&&(a[r]=e),a}function a(t){const e=t.getAttribute(r);if(!e)return;const a={part:e};for(const[r,e]of n){const n=t.getAttribute(e);null!=n&&(a[r]=n)}return a}function o(t){if(!t)return;const n=/^(\d{4}-\d{2}-\d{2})T(\d{2}:\d{2}:\d{2})/.exec(t);return n?"00:00:00"===n[2]?n[1]:`${n[1]}T${n[2]}`:t}function u(t,n){return null==n?{}:t.startsWith("rowGroup")?{rowGroup:String(n)}:t.startsWith("subCategory")?{subCategory:String(n)}:{category:String(n)}}function f(t){return"fc"===t||"hatched"===t?"hatched":"solid"===t||"outlined"===t?t:void 0}class s{constructor(t="#000000",n="#000000",r=.1){this.stroke=t,this.fill=n,this.width=r}}class d{adapt(n){const r=new s(n.stroke,n.fill,n.width);return r.fillpattern=f(n.fillpattern),"outlined"===r.fillpattern&&(r.fill="transparent"),t.isString(n.dasharray)&&(r.dasharray=n.dasharray),r}default(){return new s("#000000","#000000",.3)}defaultAC(){return new s("#000000","#000000",.3)}defaultFC(){const t=new s("#000000","#000000",.3);return t.dasharray="10 5 5 5",t.fillpattern="hatched",t}defaultPP(){return new s("#999999","#999999",.3)}defaultPL(){return new s("#000000","#ffffff",.3)}defaultPos(){return new s("#00ff00","#00ff00",.3)}defaultNeg(){return new s("#ff0000","#ff0000",.3)}defaultNeu(){return new s("#999999","#999999",.3)}}export{d as S,e as d,u as l,f as n,o as p,a as r}
@@ -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,a as w,F as m,I as b,b as g,V as y,s as S}from"./p-CmvpJzLd.js";import{a as P,H as L,b as k,L as x,S as M}from"./p-k7heRDPP.js";import{S as C}from"./p-CeE4_3wQ.js";import{d as A,p as O,S as N}from"./p-DHX92KDP.js";import{N as T,r as $}from"./p-fCjsrD7I.js";import{I as _,S as D,D as E}from"./p-VtNvNyZK.js";import{a as R,I as j}from"./p-4q8nRcWC.js";import{D as Y,w as V}from"./p-BrQCbmG0.js";import{d as H,g as F}from"./p-6242qMx1.js";import{e as I,r as W}from"./p-ClruFZD_.js";import{D as B,b as z}from"./p-ja0FCkHB.js";import{s as G,c as X,a as U,b as K,l as q,d as Z,M as J}from"./p-BTnRaHPb.js";import{D as Q,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=Y.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 C){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(A(this.dataPoint.key)),null===(e=this.columnGroup)||void 0===e||e.attr(A(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=L.Bottom;null!=t.value&&t.value<0&&(i=L.Top);const s=this.isOverflowing?this.dimensions.labelYPos:this.position.getColumnDataLabelPositionY(this.dataPoint.getScaledUnit());return new P(this.scenarioGroup,this.position.getColumnCenterPositionX(this.index),s,this.ID_DATA_PREFIX,t.value,this.styles,i,L.Center).setPoint(t.key)}getScenarioLabel(t){return new P(this.scenarioGroup,-1,-1,this.ID_SCENARIO_PREFIX,t,this.styles,L.Center,this.isPrimaryColumn?L.Left:L.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 C){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(A(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(A(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 P(this.markerGroup,-1,-1,this.ID_DATA_PREFIX,t,i,L.Center,s?L.Right:L.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 P(this.scenarioGroup,this.position.getColumnCenterPositionX(this.index),this.position.getNeedleDataLabelPositionY(this.dataPoint.getScaledPercentUnit()),this.ID_DATA_PREFIX,n?T:s.value,this.styles,L.Center,L.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(A(this.dataPoint.key)),this.barGroup.attr(A(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 C){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 C){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 _[h]||_.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(A(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?[k.Below,k.Left,k.Right,k.Above]:[k.Above,k.Left,k.Right,k.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=L.Bottom,c=L.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 P(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 P(this.labelGroup,i,s,"SCENARIO_LABEL",this.scenarioLabel,this.styles,L.Center,L.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 C){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=R(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(A(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 P(this.group,a,s,"STACK_SEG",i,this.styles,L.Center,L.Center)).setPoint(this.dataPoint.key).forceStringTypeDraw()}else h(new P(this.group,a,s,"STACK_SEG",e,this.styles,L.Center,L.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 C,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 P(this.group,n,r,"STACK_TOTAL",this.stack.total,this.styles,h?L.Top:L.Bottom,L.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 kt{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=D[s]||D.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=D[s]||D.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 xt{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 C){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=L.Bottom;return null!=t.value&&t.value<0&&(i=L.Top),new P(this.scenarioGroup,this.position.getColumnCenterPositionX(this.index),this.position.getColumnDataLabelPositionY(this.dataPoint.getScaledUnit()),this.ID_DATA_PREFIX,t.value,this.styles,i,L.Center)}getScenarioLabel(t){return new P(this.scenarioGroup,0,0,this.ID_SCENARIO_PREFIX,t,this.styles,L.Bottom,L.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 C){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 xt(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=B.DAY,this.locale="de",this.axisLabelsMode=u.SMART,this.intervalSpanLimit=32,this.measureScale=new C,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 b,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 b}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=G(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=H(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=I(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 B.MONTH:case B.QUARTER:return t.setLocale(this.locale).toFormat("yyyy");case B.WEEK:return t.setLocale(this.locale).toFormat("kkkk");case B.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 X({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 U({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=g(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 y(t.toString());s.isValid&&(i=S(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 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)))}findDateInterval(t){if(t!==B.AUTO)return t;const i=this.queryDates();if(0===i.length)return B.DAY;let s=i[0],h=i[0];for(const t of i)t<s&&(s=t),t>h&&(h=t);return(new z).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=Y.fromISO(t,{zone:"utc"});return i.isValid?i:void 0}if("number"==typeof t){const i=Y.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 O(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 y(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 y(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?$(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 z;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=K(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:L.Bottom,offset:-s}:{hookLocation:L.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!==B.YEAR&&(l=s.getShortDateString(t.date,this.dateInterval))):(this.axisLabelsMode===u.SHORT||this.axisLabelsMode===u.TWO_ROW&&this.dateInterval!==B.YEAR)&&(l=s.getShortDateString(t.date,this.dateInterval)),new P(h,this.position.getColumnCenterPositionX(i),this.position.getAxisPositionY(e)+r,"",l,this.styles,n,L.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 P(h,i,r-e,"SWITCH_"+t.scenario+"_"+t.from,t.text,this.styles,L.Top,l?L.Left:L.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 x,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)=>(M[i.scenarioType]||99)-(M[t.scenarioType]||99)));const c=[];for(const t of a){const i=r.createLineSeries(t.points,t.scenarioName,S(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)=>(M[t.scenarioType]||99)-(M[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!==B.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 P(h,this.position.getColumnCenterPositionX(r),this.position.getAxisPositionY(e)+l,"",a,this.styles,o,L.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===B.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:E}).attr("stroke-dasharray",E)}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:q(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:q(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=R(i.scenario);t.has(s)||t.set(s,[]),t.get(s).push(i)}if(t.size>1){const i=[];for(const s of j)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 P(o,n,t,"STACK_HEADER",s,this.styles,L.Center,"left"===i?L.Right:L.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 P(t,l,e-r/2,"STACK_PERCENT_MARK","100%",this.styles,L.Bottom,"left"===s?L.Right:L.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=>q(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?S(this.ruleSet.getScenarioColorIndex(r[t])):null,o=new kt(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=Y.max(...s),e=Y.min(...s),n=new z;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=B.AUTO,this.axisLabelsMode=u.SMART,this.intervalSpanLimit=28,this.filter="",this.measureScale=new C,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=Q.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=B.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},V(this)}getDb(){return this.stores||(this.stores=F(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(),W(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 b(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 b(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 b(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(J,.9*r/c);let d=!1,f=!1,v=null;for(let i=0;i<=3;i++){const i=Z({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(J,t.pixelPerUnit*i)),e&&(t.pixelPerPercentage=Math.max(J,t.pixelPerPercentage*i))}p=!0}p&&l(),n()}async componentWillRender(){}componentDidLoad(){}componentDidUpdate(){}prepareConfig(){var t,i,s;const h=this.getDb(),e=H(h,this.tableName,this.filter);return this.measureScaleError=void 0,new Dt(new dt,new st,new tt,h,e,(t=>{this.measureScaleError=I(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 N),new ht(new N),new l).adapt(this.styles);return s.locale=(null===(i=null===(t=F(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}
@@ -1 +1 @@
1
- import{p as t,H as i,h as s,d as e,t as h}from"./p-BnmylmXF.js";import{r as n,m as o,s as r,g as a,d as l}from"./p-6242qMx1.js";import{C as d,I as c}from"./p-CmvpJzLd.js";import{w as u}from"./p-BrQCbmG0.js";import{e as v,r as m}from"./p-ClruFZD_.js";import{S as f,F as b,a as p,P as w}from"./p-CytMTBFu.js";import{d as y,S as g}from"./p-BjgkgCAQ.js";import{X as x,r as M,a as $,x as z,f as C,b as L,P as S,c as j,F as k,d as P,S as F}from"./p-CG-iY7pQ.js";import{g as N}from"./p-4q8nRcWC.js";import{N as W}from"./p-BJmwHV0a.js";import{a as D,r as E,i as T}from"./p-Dyzb4ika.js";class A{constructor(t,i,s,e,h){this.mode=t,this.vMax=i,this.rMaxPx=s,this.rMinPx=e,this.areaPerUnitPx2=h}static local(t,i,s){return new A("local",t,i,s,0)}static grouped(t){return new A("grouped",0,0,0,t)}radius(t){return"grouped"===this.mode?t<=0?0:Math.sqrt(this.areaPerUnitPx2*t/Math.PI):this.vMax<=0||t<=0?this.rMinPx:Math.max(this.rMinPx,this.rMaxPx*Math.sqrt(t/this.vMax))}}class B{constructor(t,i,s,e,h,n){var o,r,a,l;this.ruleSet=t,this.config=e,this.styles=h,this.availableWidth=n,this.warnings=[],this.canvasHeight=0,this.i18nMap=new Map,this.hatchPatterns=new Set,this.scaleOverflowCount=0,this.svgRoot=null,this.config=Object.assign(Object.assign({},e),{x:D(e.x),y:D(e.y)});const d=new x;let c=[];try{""!==s&&(c=i.exec(`SELECT * FROM ${s}`))}catch(t){this.queryError=v(t)}const u=(null!=c?c:[]).map((t=>d.adapt(t)));this.data=M(u,{pointLevel:e.pointLevel,seriesLevel:e.seriesLevel,facetLevel:null!==e.facet?"rowgroup"===e.facet.level?"rowGroup":"category":null,measures:{x:null!==(o=E(e.x.measure))&&void 0!==o?o:{kind:"scenario",slot:"ac1"},y:null!==(r=E(e.y.measure))&&void 0!==r?r:{kind:"scenario",slot:"ac2"},size:null!==(a=E(e.size.measure))&&void 0!==a?a:{kind:"scenario",slot:"ac3"},share:null!==e.share&&null!==(l=E(e.share.measure))&&void 0!==l?l:void 0},compareFamily:e.compareFamily,domains:{x:{min:this.config.x.min,max:this.config.x.max},y:{min:this.config.y.min,max:this.config.y.max}},limit:e.limit,limitBy:"size"}),this.warnings.push(...this.data.warnings)}get em(){return this.styles.fontStyles.size}get xPercent(){return T(this.config.x.measure)}get yPercent(){return T(this.config.y.measure)}get sizePercent(){return T(this.config.size.measure)}fontFamily(){return this.styles.fontStyles.font.replace(/^[\d.]+px\s*/,"")}textWidth(t,i=!1){const s=d(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,o;return t.text(i).font({size:this.styles.fontStyles.size,weight:h.bold?"bold":"normal",anchor:null!==(n=h.anchor)&&void 0!==n?n:"start"}).fill(null!==(o=h.color)&&void 0!==o?o:this.styles.fontStyles.color).attr({x:s,y:e,"font-family":this.fontFamily()})}hasNoData(){return 0===this.data.totalPoints}getWarnings(){return this.warnings}getQueryError(){return this.queryError}getAllocatedCanvasWidth(){return this.availableWidth}getAllocatedCanvasHeight(){return this.canvasHeight}setI18n(t){this.i18nMap=t}addWarningOnce(t,i){this.warnings.some((i=>i.code===t))||this.warnings.push({code:t,data:i})}primaryColorIndex(){const t=E(this.config.size.measure);return null===t||"variance"===t.kind?10:this.ruleSet.getScenarioColorIndex(t.slot)}compareColorIndex(){return this.ruleSet.getScenarioColorIndex(`${this.config.compareFamily}1`)}seriesHue(t){const{color:i,overflowed:s}=n(t,this.styles.seriesColors);return s&&this.addWarningOnce("xy-series-overflow",{}),i}familyDisplayName(t){return this.ruleSet.getScenario(`${t}1`).group}legendModel(){var t,i;const s=[],e=null!==(i=null!==(t=this.config.size.label)&&void 0!==t?t:this.i18nMap.get("legend.size"))&&void 0!==i?i:"";""!==e&&(s.push(e),void 0!==this.config.size.unit&&""!==this.config.size.unit&&s.push(`${this.i18nMap.get("axis.in")||"in"} ${this.config.size.unit}`));const h=[];if(null!==this.config.compareFamily){const t=E(this.config.size.measure),i=null!==t&&"scenario"===t.kind?t.slot.replace(/\d+$/,""):"ac";h.push(this.legendEntry(this.familyDisplayName(this.config.compareFamily),this.compareColorIndex(),0)),h.push(this.legendEntry(this.familyDisplayName(i),this.primaryColorIndex(),0))}const n=this.data.series.map((t=>{var i;return this.legendEntry(""===t.key?null!==(i=this.ruleSet.getScenario("").name)&&void 0!==i?i:"Series":t.key,this.primaryColorIndex(),t.index)}));return{sizeCaption:s,title:this.i18nMap.get("legend.title")||null,compareEntries:h,entries:n}}legendEntry(t,i,s){const e=this.seriesHue(s),h=o(i,e,"bubble");return{label:t,treatment:h,fill:this.treatmentFill(h,s,e)}}toString(){const t=new f;return this.draw(t),t.id("drawCanvas"),t.width(this.getAllocatedCanvasWidth()),t.height(this.getAllocatedCanvasHeight()),t.attr("overflow","visible"),t.svg()}axisTitle(t,i){var s;const e=null!==(s=t.label)&&void 0!==s?s:"";return""===e?"":void 0===t.unit||""===t.unit?e:`${e} ${i} ${t.unit}`}draw(t){var i,s,e,h,n,o,r,a,l,d,c;this.warnings=this.data.warnings.slice(),this.hatchPatterns.clear(),this.scaleOverflowCount=0,this.svgRoot=t;const u=this.em,v=this.styles.padding,m=this.i18nMap.get("axis.in")||"in",f=t.group(),b=new $(this.styles),p=this.legendModel(),w=this.config.legend.show&&(p.entries.length>0||p.sizeCaption.length>0),y=w?b.measure(p,this.config.legend.position):{width:0,height:0},g="right"===this.config.legend.position&&w?y.width+u:0,x=""!==this.config.chartTitle?1.6*u:0,M=this.axisTitle(this.config.y,m),L=this.axisTitle(this.config.x,m),S=""!==M?1.4*u:.4*u,j=1.4*u+(""!==L?1.3*u:0);let P,F=3*u,N={x:0,y:0,width:0,height:0},D=[];const E=Math.max(1,this.data.facets.length),T=null===(i=this.config.facet)||void 0===i?void 0:i.columns,B=W.domain(null!==(e=null===(s=this.data.extents)||void 0===s?void 0:s.xMin)&&void 0!==e?e:0,null!==(n=null===(h=this.data.extents)||void 0===h?void 0:h.xMax)&&void 0!==n?n:1,{min:this.config.x.min,max:this.config.x.max}),H=W.domain(null!==(r=null===(o=this.data.extents)||void 0===o?void 0:o.yMin)&&void 0!==r?r:0,null!==(l=null===(a=this.data.extents)||void 0===a?void 0:a.yMax)&&void 0!==l?l:1,{min:this.config.y.min,max:this.config.y.max});for(let t=0;t<2;t++){const t=Math.max(10,this.availableWidth-v.left-v.right-F-g);N={x:v.left+F,y:v.top+x+S,width:t,height:t/this.config.aspect},P=new k(E,T,N,this.styles.scaleFactors.panelGap*u);const i=P.panelRect(0).height,s=Math.max(4,Math.min(8,Math.round(i/(4*u)))),e=new W(H[0],H[1],i,0);D=e.ticks(s);const h=z(D,this.yPercent);F=Math.max(...D.map((t=>this.textWidth(C(t,h,this.styles.locale,this.yPercent)))),u)+this.styles.scaleFactors.axisTickLength*u+.4*u}this.canvasHeight=N.y+N.height+j+("bottom"===this.config.legend.position&&w?y.height+u:0)+v.bottom,""!==this.config.chartTitle&&this.drawText(f,this.config.chartTitle,v.left,v.top+u,{bold:!0}),""!==M&&this.drawAxisTitleText(f,this.config.y,m,v.left,N.y-.6*u,"start");const I=this.buildPanels(P,B,H),O=I[0].xScale.ticks(Math.max(3,Math.min(8,Math.round(I[0].rect.width/(7*u))))),Q=z(O,this.xPercent),X=z(D,this.yPercent),G=this.config.sizeAreaPerUnit>0?A.grouped(this.config.sizeAreaPerUnit):A.local(null!==(c=null===(d=this.data.extents)||void 0===d?void 0:d.sizeMax)&&void 0!==c?c:0,this.styles.scaleFactors.bubbleMaxRadius*u,this.styles.scaleFactors.bubbleMinRadius*u);0===this.data.facets.length?this.drawPanel(f,I[0],{key:"",points:[]},G,O,D,Q,X,!0,!0):this.data.facets.forEach(((t,i)=>{this.drawPanel(f,I[i],t,G,O,D,Q,X,P.isOuterLeft(i),P.isOuterBottom(i),this.data.facets.length>1?t.key:"")})),""!==L&&this.drawAxisTitleText(f,this.config.x,m,N.x+N.width,N.y+N.height+2.6*u,"end"),w&&("right"===this.config.legend.position?b.draw(f,p,N.x+N.width+u,N.y,"right"):b.draw(f,p,N.x,N.y+N.height+j,"bottom")),this.scaleOverflowCount>0&&this.addWarningOnce("bubble-scale-overflow",{count:String(this.scaleOverflowCount)}),t.group().addClass("annotations")}drawAxisTitleText(t,i,s,e,h,n){var o;const r=null!==(o=i.label)&&void 0!==o?o:"",a=void 0!==i.unit&&""!==i.unit?`${s} ${i.unit}`:"",l=.3*this.em;"start"===n?(this.drawText(t,r,e,h,{bold:!0}),""!==a&&this.drawText(t,a,e+this.textWidth(r,!0)+l,h,{})):""!==a?(this.drawText(t,a,e,h,{anchor:"end"}),this.drawText(t,r,e-this.textWidth(a)-l,h,{anchor:"end",bold:!0})):this.drawText(t,r,e,h,{anchor:"end",bold:!0})}buildPanels(t,i,s){const e=[];for(let h=0;h<t.count;h++){const n=t.panelRect(h),o=new W(i[0],i[1],n.x,n.x+n.width),r=new W(s[0],s[1],n.y+n.height,n.y);e.push({rect:n,xScale:o,yScale:r,frame:new L(o,r,n,this.styles)})}return e}treatmentFill(t,i,s){return!0!==t.hatch?t.fill:(this.ensureHatchPattern(i,s),`url(#xy-fc-${i})`)}ensureHatchPattern(t,i){this.hatchPatterns.has(t)||null===this.svgRoot||(this.hatchPatterns.add(t),this.svgRoot.defs().pattern(10,10,(t=>{t.rect(10,10).fill("#ffffff"),t.line(0,10,10,0).stroke({color:i,width:2}),t.line(-2.5,2.5,2.5,-2.5).stroke({color:i,width:2}),t.line(7.5,12.5,12.5,7.5).stroke({color:i,width:2})})).id(`xy-fc-${t}`))}drawPanel(t,i,s,e,h,n,a,l,d,c,u=""){var v,m,f,b,p,w;const g=t.group(),x=this.em;i.frame.drawBands(g,this.config.x.highlight,this.config.y.highlight),i.frame.drawGrid(g,n,void 0===this.config.x.refLine&&void 0===this.config.y.refLine&&i.rect.width>30*x?h:void 0),i.frame.drawRefLines(g,this.config.x.refLine,this.config.y.refLine),i.frame.drawFrame(g);const M=g.group().id("compare"),$=g.group().id("primary"),z=new S(i.rect,this.styles.scaleFactors.labelToMark*x),C=[...s.points].sort(((t,i)=>{var s,e;return(null!==(s=i.size)&&void 0!==s?s:0)-(null!==(e=t.size)&&void 0!==e?e:0)})),L=[];for(const t of C){const h=null!==(m=null===(v=this.data.series.find((i=>i.key===t.seriesKey)))||void 0===v?void 0:v.index)&&void 0!==m?m:0,n=this.seriesHue(h),a=o(this.primaryColorIndex(),n,"bubble"),l=i.xScale.scale(t.x),d=i.yScale.scale(t.y),c=e.radius(null!==(f=t.size)&&void 0!==f?f:0);if(this.config.sizeAreaPerUnit>0&&this.bubbleExceedsPanel(i.rect,l,d,c)&&this.scaleOverflowCount++,null!=t.compare){const s=o(this.compareColorIndex(),n,"bubble"),r=i.xScale.scale(t.compare.x),a=i.yScale.scale(t.compare.y),l=e.radius(null!==(b=t.compare.size)&&void 0!==b?b:0);this.drawBubble(M,r,a,l,s,h,n),z.registerMark(r,a,l),this.config.labels.values&&void 0!==t.compare.size&&l>=1.2*x&&this.drawValueLabel(M,r,a,l,t.compare.size,s.fill)}const u=j(t,s.key,this.config);null===(p=this.drawBubble($,l,d,c,a,h,n))||void 0===p||p.attr(y(u,"element")),z.registerMark(l,d,c),void 0!==t.share&&c>0&&(null===(w=this.drawShareSlice($,l,d,c,t.share,r(n)))||void 0===w||w.attr(y(u))),this.config.labels.values&&void 0!==t.size&&this.drawValueLabel($,l,d,c,t.size,!0===a.hatch?"#ffffff":a.fill),L.push({point:t,cx:l,cy:d,r:c,seriesIndex:h,hue:n,treatment:a})}this.drawNameLabels(g,z,L,s.key),i.frame.drawTickLabels(g,{ticksX:h,ticksY:n,xDecimals:a,yDecimals:l,xPercent:this.xPercent,yPercent:this.yPercent,showXLabels:c,showYLabels:d}),""!==u&&i.frame.drawPanelTitle(g,u)}bubbleExceedsPanel(t,i,s,e){return i-e<t.x||i+e>t.x+t.width||s-e<t.y||s+e>t.y+t.height}drawBubble(t,i,s,e,h,n,o){if(!(e<=0))return t.circle(2*e).center(i,s).fill(this.treatmentFill(h,n,o)).stroke({color:h.stroke,width:h.strokeWidth})}drawShareSlice(t,i,s,e,h,n){if(h<=0)return;if(h>=1)return t.circle(2*e).center(i,s).fill(n);const o=2*h*Math.PI,r=i+e*Math.sin(o),a=s-e*Math.cos(o),l=o>Math.PI?1:0;return t.path(`M ${i} ${s} L ${i} ${s-e} A ${e} ${e} 0 ${l} 1 ${r} ${a} Z`).fill(n).stroke("none")}drawValueLabel(t,i,s,e,h,n){const o=C(h,this.valueDecimals(),this.styles.locale,this.sizePercent);this.textWidth(o)+.4*this.em>2*e||this.drawText(t,o,i,s+.35*this.em,{anchor:"middle",color:N(n)})}drawNameLabels(t,i,s,e){const h=[...s].sort(((t,i)=>{var s,e;return(null!==(s=i.point.size)&&void 0!==s?s:0)-(null!==(e=t.point.size)&&void 0!==e?e:0)})),{selected:n,unknownNames:o}=i.selectCandidates(h,this.config.labels.points,this.config.labels.max,(t=>t.point.name));o.length>0&&this.addWarningOnce("xy-label-unknown",{names:o.join(", ")});const r=new Map,a=n.map((t=>{const i={name:t.point.name,cx:t.cx,cy:t.cy,r:t.r,width:this.textWidth(t.point.name),height:1.1*this.em};return r.set(i,t.point),i}));for(const s of i.place(a))this.drawText(t,s.candidate.name,s.x,s.y+.9*s.candidate.height,{}).attr(y(j(r.get(s.candidate),e,this.config),"label"))}valueDecimals(){var t,i,s;let e=0;for(const h of this.data.facets)for(const n of h.points)e=Math.max(e,Math.abs(null!==(t=n.size)&&void 0!==t?t:0),Math.abs(null!==(s=null===(i=n.compare)||void 0===i?void 0:i.size)&&void 0!==s?s:0));return e>0&&Number.isFinite(e)?(this.sizePercent&&(e*=100),W.stepDecimals(Math.pow(10,Math.floor(Math.log10(e))-2))):1}}const H=["xy-duplicate-point","xy-point-clipped","xy-variance-nodata","xy-label-unknown","xy-series-overflow","xy-point-budget","bubble-size-negative","bubble-share-range","bubble-scale-overflow"],I=t(class extends i{constructor(t){super(),!1!==t&&this.__registerHost(),this.__attachShadow(),this.tableName="",this.dataVersion=0,this.chartTitle="",this.share=null,this.compareFamily=null,this.facet=null,this.pointLevel="category",this.seriesLevel=null,this.aspect=16/9,this.limit=0,this.filter="",this.sizeAreaPerUnit=0,this.i18n=new Map,this.containerWidth=0,this.svgMarkup="",u(this)}getDb(){return this.stores||(this.stores=a(this.element)),this.stores.db.db}componentWillLoad(){this.rebuild()}componentWillUpdate(){this.rebuild()}rebuild(){const t=this.prepareStyle(),i=l(this.getDb(),this.tableName,this.filter);this.chart=new B(new c(this.ruleSetConfig),this.getDb(),i,{chartTitle:this.chartTitle,x:this.x,y:this.y,size:this.size,share:this.share,compareFamily:this.compareFamily,labels:this.labels,legend:this.legend,facet:this.facet,pointLevel:this.pointLevel,seriesLevel:this.seriesLevel,aspect:this.aspect,limit:this.limit,sizeAreaPerUnit:this.sizeAreaPerUnit},t,this.containerWidth||0),this.chart.setI18n(this.i18n),this.svgMarkup=this.chart.hasNoData()?"":this.chart.toString(),this.syncWarnings(this.chart.getWarnings()),m(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 P(new F,new b,new p(new g),new w).adapt(this.styles);return s.locale=(null===(i=null===(t=a(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-bubble-renderer",{tableName:[1,"table-name"],dataVersion:[2,"data-version"],chartTitle:[1,"chart-title"],x:[16],y:[16],size:[16],share:[16],compareFamily:[1,"compare-family"],labels:[16],legend:[16],facet:[16],pointLevel:[1,"point-level"],seriesLevel:[1,"series-level"],aspect:[2],limit:[2],filter:[1],sizeAreaPerUnit:[2,"size-area-per-unit"],styles:[16],i18n:[16],containerWidth:[2,"container-width"],ruleSetConfig:[16],errors:[16],translator:[16]}]);function O(){"undefined"!=typeof customElements&&["bn-chart-bubble-renderer"].forEach((t=>{"bn-chart-bubble-renderer"===t&&(customElements.get(h(t))||customElements.define(h(t),I))}))}export{I as B,O as d}
1
+ import{p as t,H as i,h as s,d as e,t as h}from"./p-BnmylmXF.js";import{r as n,m as r,s as o,g as a,d as l}from"./p-6242qMx1.js";import{C as d,I as c}from"./p-CmvpJzLd.js";import{w as u}from"./p-BrQCbmG0.js";import{e as v,r as m}from"./p-ClruFZD_.js";import{S as f,F as b,a as p,P as w}from"./p-CSJCkHEL.js";import{d as y,S as g}from"./p-DHX92KDP.js";import{X as x,r as M,a as $,x as S,f as z,b as L,P as j,c as C,F as P,d as k,S as N}from"./p-Blre9f28.js";import{g as W}from"./p-4q8nRcWC.js";import{N as D}from"./p-BJmwHV0a.js";import{a as E,r as F,i as T}from"./p-YSRTB0jS.js";class B{constructor(t,i,s,e,h){this.mode=t,this.vMax=i,this.rMaxPx=s,this.rMinPx=e,this.areaPerUnitPx2=h}static local(t,i,s){return new B("local",t,i,s,0)}static grouped(t){return new B("grouped",0,0,0,t)}radius(t){return"grouped"===this.mode?t<=0?0:Math.sqrt(this.areaPerUnitPx2*t/Math.PI):this.vMax<=0||t<=0?this.rMinPx:Math.max(this.rMinPx,this.rMaxPx*Math.sqrt(t/this.vMax))}}class A{constructor(t,i,s,e,h,n){var r,o,a,l;this.ruleSet=t,this.config=e,this.styles=h,this.availableWidth=n,this.warnings=[],this.canvasHeight=0,this.i18nMap=new Map,this.hatchPatterns=new Set,this.scaleOverflowCount=0,this.svgRoot=null,this.config=Object.assign(Object.assign({},e),{x:E(e.x),y:E(e.y)});const d=new x;let c=[];try{""!==s&&(c=i.exec(`SELECT * FROM ${s}`))}catch(t){this.queryError=v(t)}const u=(null!=c?c:[]).map((t=>d.adapt(t)));this.data=M(u,{pointLevel:e.pointLevel,seriesLevel:e.seriesLevel,facetLevel:null!==e.facet?"rowgroup"===e.facet.level?"rowGroup":"category":null,measures:{x:null!==(r=F(e.x.measure))&&void 0!==r?r:{kind:"scenario",slot:"ac1"},y:null!==(o=F(e.y.measure))&&void 0!==o?o:{kind:"scenario",slot:"ac2"},size:null!==(a=F(e.size.measure))&&void 0!==a?a:{kind:"scenario",slot:"ac3"},share:null!==e.share&&null!==(l=F(e.share.measure))&&void 0!==l?l:void 0},compareFamily:e.compareFamily,domains:{x:{min:this.config.x.min,max:this.config.x.max},y:{min:this.config.y.min,max:this.config.y.max}},limit:e.limit,limitBy:"size"}),this.warnings.push(...this.data.warnings)}get em(){return this.styles.fontStyles.size}get xPercent(){return T(this.config.x.measure)}get yPercent(){return T(this.config.y.measure)}get sizePercent(){return T(this.config.size.measure)}fontFamily(){return this.styles.fontStyles.font.replace(/^[\d.]+px\s*/,"")}textWidth(t,i=!1){const s=d(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;return t.text(i).font({size:this.styles.fontStyles.size,weight:h.bold?"bold":"normal",anchor:null!==(n=h.anchor)&&void 0!==n?n:"start"}).fill(null!==(r=h.color)&&void 0!==r?r:this.styles.fontStyles.color).attr({x:s,y:e,"font-family":this.fontFamily()})}hasNoData(){return 0===this.data.totalPoints}getWarnings(){return this.warnings}getQueryError(){return this.queryError}getAllocatedCanvasWidth(){return this.availableWidth}getAllocatedCanvasHeight(){return this.canvasHeight}setI18n(t){this.i18nMap=t}addWarningOnce(t,i){this.warnings.some((i=>i.code===t))||this.warnings.push({code:t,data:i})}primaryColorIndex(){const t=F(this.config.size.measure);return null===t||"variance"===t.kind?10:this.ruleSet.getScenarioColorIndex(t.slot)}compareColorIndex(){return this.ruleSet.getScenarioColorIndex(`${this.config.compareFamily}1`)}seriesHue(t){const{color:i,overflowed:s}=n(t,this.styles.seriesColors);return s&&this.addWarningOnce("xy-series-overflow",{}),i}familyDisplayName(t){return this.ruleSet.getScenario(`${t}1`).group}legendModel(){var t,i;const s=[],e=null!==(i=null!==(t=this.config.size.label)&&void 0!==t?t:this.i18nMap.get("legend.size"))&&void 0!==i?i:"";""!==e&&(s.push(e),void 0!==this.config.size.unit&&""!==this.config.size.unit&&s.push(`${this.i18nMap.get("axis.in")||"in"} ${this.config.size.unit}`));const h=[];if(null!==this.config.compareFamily){const t=F(this.config.size.measure),i=null!==t&&"scenario"===t.kind?t.slot.replace(/\d+$/,""):"ac";h.push(this.legendEntry(this.familyDisplayName(this.config.compareFamily),this.compareColorIndex(),0)),h.push(this.legendEntry(this.familyDisplayName(i),this.primaryColorIndex(),0))}const n=this.data.series.map((t=>{var i;return this.legendEntry(""===t.key?null!==(i=this.ruleSet.getScenario("").name)&&void 0!==i?i:"Series":t.key,this.primaryColorIndex(),t.index)}));return{sizeCaption:s,title:this.i18nMap.get("legend.title")||null,compareEntries:h,entries:n}}legendEntry(t,i,s){const e=this.seriesHue(s),h=r(i,e,"bubble");return{label:t,treatment:h,fill:this.treatmentFill(h,s,e)}}toString(){const t=new f;return this.draw(t),t.id("drawCanvas"),t.width(this.getAllocatedCanvasWidth()),t.height(this.getAllocatedCanvasHeight()),t.attr("overflow","visible"),t.svg()}axisTitle(t,i){var s;const e=null!==(s=t.label)&&void 0!==s?s:"";return""===e?"":void 0===t.unit||""===t.unit?e:`${e} ${i} ${t.unit}`}draw(t){var i,s,e,h,n,r,o,a,l,d,c;this.warnings=this.data.warnings.slice(),this.hatchPatterns.clear(),this.scaleOverflowCount=0,this.svgRoot=t;const u=this.em,v=this.styles.padding,m=this.i18nMap.get("axis.in")||"in",f=t.group(),b=new $(this.styles),p=this.legendModel(),w=this.config.legend.show&&(p.entries.length>0||p.sizeCaption.length>0),y=w?b.measure(p,this.config.legend.position):{width:0,height:0},g="right"===this.config.legend.position&&w?y.width+u:0,x=""!==this.config.chartTitle?1.6*u:0,M=this.axisTitle(this.config.y,m),L=this.axisTitle(this.config.x,m),j=""!==M?1.4*u:.4*u,C=1.4*u+(""!==L?1.3*u:0);let k,N=3*u,W={x:0,y:0,width:0,height:0},E=[];const F=Math.max(1,this.data.facets.length),T=null===(i=this.config.facet)||void 0===i?void 0:i.columns,A=D.domain(null!==(e=null===(s=this.data.extents)||void 0===s?void 0:s.xMin)&&void 0!==e?e:0,null!==(n=null===(h=this.data.extents)||void 0===h?void 0:h.xMax)&&void 0!==n?n:1,{min:this.config.x.min,max:this.config.x.max}),H=D.domain(null!==(o=null===(r=this.data.extents)||void 0===r?void 0:r.yMin)&&void 0!==o?o:0,null!==(l=null===(a=this.data.extents)||void 0===a?void 0:a.yMax)&&void 0!==l?l:1,{min:this.config.y.min,max:this.config.y.max});for(let t=0;t<2;t++){const t=Math.max(10,this.availableWidth-v.left-v.right-N-g);W={x:v.left+N,y:v.top+x+j,width:t,height:t/this.config.aspect},k=new P(F,T,W,this.styles.scaleFactors.panelGap*u);const i=k.panelRect(0).height,s=Math.max(4,Math.min(8,Math.round(i/(4*u)))),e=new D(H[0],H[1],i,0);E=e.ticks(s);const h=S(E,this.yPercent);N=Math.max(...E.map((t=>this.textWidth(z(t,h,this.styles.locale,this.yPercent)))),u)+this.styles.scaleFactors.axisTickLength*u+.4*u}this.canvasHeight=W.y+W.height+C+("bottom"===this.config.legend.position&&w?y.height+u:0)+v.bottom,""!==this.config.chartTitle&&this.drawText(f,this.config.chartTitle,v.left,v.top+u,{bold:!0}),""!==M&&this.drawAxisTitleText(f,this.config.y,m,v.left,W.y-.6*u,"start");const I=this.buildPanels(k,A,H),X=I[0].xScale.ticks(Math.max(3,Math.min(8,Math.round(I[0].rect.width/(7*u))))),O=S(X,this.xPercent),R=S(E,this.yPercent),J=this.config.sizeAreaPerUnit>0?B.grouped(this.config.sizeAreaPerUnit):B.local(null!==(c=null===(d=this.data.extents)||void 0===d?void 0:d.sizeMax)&&void 0!==c?c:0,this.styles.scaleFactors.bubbleMaxRadius*u,this.styles.scaleFactors.bubbleMinRadius*u);0===this.data.facets.length?this.drawPanel(f,I[0],{key:"",points:[]},J,X,E,O,R,!0,!0):this.data.facets.forEach(((t,i)=>{this.drawPanel(f,I[i],t,J,X,E,O,R,k.isOuterLeft(i),k.isOuterBottom(i),this.data.facets.length>1?t.key:"")})),""!==L&&this.drawAxisTitleText(f,this.config.x,m,W.x+W.width,W.y+W.height+2.6*u,"end"),w&&("right"===this.config.legend.position?b.draw(f,p,W.x+W.width+u,W.y,"right"):b.draw(f,p,W.x,W.y+W.height+C,"bottom")),this.scaleOverflowCount>0&&this.addWarningOnce("bubble-scale-overflow",{count:String(this.scaleOverflowCount)}),t.group().addClass("annotations")}drawAxisTitleText(t,i,s,e,h,n){var r;const o=null!==(r=i.label)&&void 0!==r?r:"",a=void 0!==i.unit&&""!==i.unit?`${s} ${i.unit}`:"",l=.3*this.em;"start"===n?(this.drawText(t,o,e,h,{bold:!0}),""!==a&&this.drawText(t,a,e+this.textWidth(o,!0)+l,h,{})):""!==a?(this.drawText(t,a,e,h,{anchor:"end"}),this.drawText(t,o,e-this.textWidth(a)-l,h,{anchor:"end",bold:!0})):this.drawText(t,o,e,h,{anchor:"end",bold:!0})}buildPanels(t,i,s){const e=[];for(let h=0;h<t.count;h++){const n=t.panelRect(h),r=new D(i[0],i[1],n.x,n.x+n.width),o=new D(s[0],s[1],n.y+n.height,n.y);e.push({rect:n,xScale:r,yScale:o,frame:new L(r,o,n,this.styles)})}return e}treatmentFill(t,i,s){return!0!==t.hatch?t.fill:(this.ensureHatchPattern(i,s),`url(#xy-fc-${i})`)}ensureHatchPattern(t,i){this.hatchPatterns.has(t)||null===this.svgRoot||(this.hatchPatterns.add(t),this.svgRoot.defs().pattern(10,10,(t=>{t.rect(10,10).fill("#ffffff"),t.line(0,10,10,0).stroke({color:i,width:2}),t.line(-2.5,2.5,2.5,-2.5).stroke({color:i,width:2}),t.line(7.5,12.5,12.5,7.5).stroke({color:i,width:2})})).id(`xy-fc-${t}`))}drawPanel(t,i,s,e,h,n,a,l,d,c,u=""){var v,m,f,b,p,w;const g=t.group(),x=this.em;i.frame.drawBands(g,this.config.x.highlight,this.config.y.highlight),i.frame.drawGrid(g,n,void 0===this.config.x.refLine&&void 0===this.config.y.refLine&&i.rect.width>30*x?h:void 0),i.frame.drawRefLines(g,this.config.x.refLine,this.config.y.refLine),i.frame.drawFrame(g);const M=g.group().id("compare"),$=g.group().id("primary"),S=new j(i.rect,this.styles.scaleFactors.labelToMark*x),z=[...s.points].sort(((t,i)=>{var s,e;return(null!==(s=i.size)&&void 0!==s?s:0)-(null!==(e=t.size)&&void 0!==e?e:0)})),L=[];for(const t of z){const h=null!==(m=null===(v=this.data.series.find((i=>i.key===t.seriesKey)))||void 0===v?void 0:v.index)&&void 0!==m?m:0,n=this.seriesHue(h),a=r(this.primaryColorIndex(),n,"bubble"),l=i.xScale.scale(t.x),d=i.yScale.scale(t.y),c=e.radius(null!==(f=t.size)&&void 0!==f?f:0);if(this.config.sizeAreaPerUnit>0&&this.bubbleExceedsPanel(i.rect,l,d,c)&&this.scaleOverflowCount++,null!=t.compare){const s=r(this.compareColorIndex(),n,"bubble"),o=i.xScale.scale(t.compare.x),a=i.yScale.scale(t.compare.y),l=e.radius(null!==(b=t.compare.size)&&void 0!==b?b:0);this.drawBubble(M,o,a,l,s,h,n),S.registerMark(o,a,l),this.config.labels.values&&void 0!==t.compare.size&&l>=1.2*x&&this.drawValueLabel(M,o,a,l,t.compare.size,s.fill)}const u=C(t,s.key,this.config);null===(p=this.drawBubble($,l,d,c,a,h,n))||void 0===p||p.attr(y(u,"element")),S.registerMark(l,d,c),void 0!==t.share&&c>0&&(null===(w=this.drawShareSlice($,l,d,c,t.share,o(n)))||void 0===w||w.attr(y(u))),this.config.labels.values&&void 0!==t.size&&this.drawValueLabel($,l,d,c,t.size,!0===a.hatch?"#ffffff":a.fill),L.push({point:t,cx:l,cy:d,r:c,seriesIndex:h,hue:n,treatment:a})}this.drawNameLabels(g,S,L,s.key),i.frame.drawTickLabels(g,{ticksX:h,ticksY:n,xDecimals:a,yDecimals:l,xPercent:this.xPercent,yPercent:this.yPercent,showXLabels:c,showYLabels:d}),""!==u&&i.frame.drawPanelTitle(g,u)}bubbleExceedsPanel(t,i,s,e){return i-e<t.x||i+e>t.x+t.width||s-e<t.y||s+e>t.y+t.height}drawBubble(t,i,s,e,h,n,r){if(!(e<=0))return t.circle(2*e).center(i,s).fill(this.treatmentFill(h,n,r)).stroke({color:h.stroke,width:h.strokeWidth})}drawShareSlice(t,i,s,e,h,n){if(h<=0)return;if(h>=1)return t.circle(2*e).center(i,s).fill(n);const r=2*h*Math.PI,o=i+e*Math.sin(r),a=s-e*Math.cos(r),l=r>Math.PI?1:0;return t.path(`M ${i} ${s} L ${i} ${s-e} A ${e} ${e} 0 ${l} 1 ${o} ${a} Z`).fill(n).stroke("none")}drawValueLabel(t,i,s,e,h,n){const r=z(h,this.valueDecimals(),this.styles.locale,this.sizePercent);this.textWidth(r)+.4*this.em>2*e||this.drawText(t,r,i,s+.35*this.em,{anchor:"middle",color:W(n)})}drawNameLabels(t,i,s,e){const h=[...s].sort(((t,i)=>{var s,e;return(null!==(s=i.point.size)&&void 0!==s?s:0)-(null!==(e=t.point.size)&&void 0!==e?e:0)})),{selected:n,unknownNames:r}=i.selectCandidates(h,this.config.labels.points,this.config.labels.max,(t=>t.point.name));r.length>0&&this.addWarningOnce("xy-label-unknown",{names:r.join(", ")});const o=new Map,a=n.map((t=>{const i={name:t.point.name,cx:t.cx,cy:t.cy,r:t.r,width:this.textWidth(t.point.name),height:1.1*this.em};return o.set(i,t.point),i}));for(const s of i.place(a))this.drawText(t,s.candidate.name,s.x,s.y+.9*s.candidate.height,{}).attr(y(C(o.get(s.candidate),e,this.config),"label"))}valueDecimals(){var t,i,s;let e=0;for(const h of this.data.facets)for(const n of h.points)e=Math.max(e,Math.abs(null!==(t=n.size)&&void 0!==t?t:0),Math.abs(null!==(s=null===(i=n.compare)||void 0===i?void 0:i.size)&&void 0!==s?s:0));return e>0&&Number.isFinite(e)?(this.sizePercent&&(e*=100),D.stepDecimals(Math.pow(10,Math.floor(Math.log10(e))-2))):1}}const H=["xy-duplicate-point","xy-point-clipped","xy-variance-nodata","xy-label-unknown","xy-series-overflow","xy-point-budget","bubble-size-negative","bubble-share-range","bubble-scale-overflow"],I=t(class extends i{constructor(t){super(),!1!==t&&this.__registerHost(),this.__attachShadow(),this.tableName="",this.dataVersion=0,this.chartTitle="",this.share=null,this.compareFamily=null,this.facet=null,this.pointLevel="category",this.seriesLevel=null,this.aspect=16/9,this.limit=0,this.filter="",this.sizeAreaPerUnit=0,this.i18n=new Map,this.containerWidth=0,this.svgMarkup="",u(this)}getDb(){return this.stores||(this.stores=a(this.element)),this.stores.db.db}componentWillLoad(){this.rebuild()}componentWillUpdate(){this.rebuild()}rebuild(){const t=this.prepareStyle(),i=l(this.getDb(),this.tableName,this.filter);this.chart=new A(new c(this.ruleSetConfig),this.getDb(),i,{chartTitle:this.chartTitle,x:this.x,y:this.y,size:this.size,share:this.share,compareFamily:this.compareFamily,labels:this.labels,legend:this.legend,facet:this.facet,pointLevel:this.pointLevel,seriesLevel:this.seriesLevel,aspect:this.aspect,limit:this.limit,sizeAreaPerUnit:this.sizeAreaPerUnit},t,this.containerWidth||0),this.chart.setI18n(this.i18n),this.svgMarkup=this.chart.hasNoData()?"":this.chart.toString(),this.syncWarnings(this.chart.getWarnings()),m(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 k(new N,new b,new p(new g),new w).adapt(this.styles);return s.locale=(null===(i=null===(t=a(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-bubble-renderer",{tableName:[1,"table-name"],dataVersion:[2,"data-version"],chartTitle:[1,"chart-title"],x:[16],y:[16],size:[16],share:[16],compareFamily:[1,"compare-family"],labels:[16],legend:[16],facet:[16],pointLevel:[1,"point-level"],seriesLevel:[1,"series-level"],aspect:[2],limit:[2],filter:[1],sizeAreaPerUnit:[2,"size-area-per-unit"],styles:[16],i18n:[16],containerWidth:[2,"container-width"],ruleSetConfig:[16],errors:[16],translator:[16]}]);function X(){"undefined"!=typeof customElements&&["bn-chart-bubble-renderer"].forEach((t=>{"bn-chart-bubble-renderer"===t&&(customElements.get(h(t))||customElements.define(h(t),I))}))}export{I as B,X as d}
@@ -0,0 +1 @@
1
+ import{D as t}from"./p-BrQCbmG0.js";var n,a,o,s,r,e,c,i;!function(t){t.ALL="all",t.META="meta"}(n||(n={})),function(t){t.CURRENCY="currency",t.VOLUME="volume"}(a||(a={})),function(t){t.AC1="ac1",t.AC2="ac2",t.AC3="ac3",t.AC4="ac4",t.PP1="pp1",t.PP2="pp2",t.PP3="pp3",t.PP4="pp4",t.FC1="fc1",t.FC2="fc2",t.FC3="fc3",t.FC4="fc4",t.PL1="pl1",t.PL2="pl2",t.PL3="pl3",t.PL4="pl4"}(o||(o={})),function(t){t.POS="pos",t.NEG="neg",t.NEU="neu",t.OP="op",t.OPINV="opinv"}(s||(s={})),function(t){t.DECIMAL="decimal",t.PERCENT="percent"}(r||(r={})),function(t){t.LIST="list",t.SUM="sum",t.SUMNOTOTAL="sumnototal",t.OPT="opt",t.OPTNOTOTAL="optnototal"}(e||(e={})),function(t){t.INF="inf",t.W100="w100",t.W50="w50",t.W25="w25",t.W20="w20",t.W15="w15",t.W10="w10",t.W5="w5"}(c||(c={})),function(t){t.W5="w5",t.W10="w10",t.W15="w15",t.W20="w20",t.W25="w25",t.W30="w30",t.W40="w40",t.W60="w60",t.W80="w80",t.W100="w100"}(i||(i={}));const u={[i.W5]:5,[i.W10]:10,[i.W15]:15,[i.W20]:20,[i.W25]:25,[i.W30]:30,[i.W40]:40,[i.W60]:60,[i.W80]:80,[i.W100]:100};var f,l,p,w,m,b;!function(t){t.ROWGROUP="rowGroup",t.ROWGROUPINDEX="rowGroupIndex",t.CATEGORY="category",t.CATEGORYINDEX="categoryIndex",t.SUBCATEGORY="subCategory",t.SUBCATEGORYINDEX="subCategoryIndex"}(f||(f={})),function(t){t.SMART="smart",t.LONG="long",t.SHORT="short",t.TWO_ROW="two-row"}(l||(l={})),function(t){t.COLUMN="column",t.LINE="line",t.WATERFALL="waterfall"}(p||(p={})),function(t){t.BAR="bar",t.LINE="line",t.AUTO="auto"}(w||(w={})),function(t){t.SCENARIOS="scenarios",t.DIMENSIONS="dimensions"}(m||(m={})),function(t){t.ABSOLUTE="absolute",t.RELATIVE="relative",t.ABSOLUTE_RELATIVE="absolute-relative"}(b||(b={}));const y=100;var g;!function(t){t.ASC="asc",t.DESC="desc",t.DATASET="dataset"}(g||(g={}));class d{static isExisting(t){return null!=t}static isString(t){return"string"==typeof t}static isNumber(t){return"number"==typeof t&&!Number.isNaN(t)}static isBoolean(t){return"boolean"==typeof t}static isArray(t){return Array.isArray(t)}static isObject(t){return"object"==typeof t&&null!==t}static isOperator(t){return"+"===t||"-"===t}static isDate(n){return n instanceof t&&n.isValid}}export{f as A,u as B,d as C,r as D,n as I,a as M,y as R,o as S,i as T,s as a,l as b,e as c,c as d,m as e,g as f,b as g,w as h}
@@ -0,0 +1 @@
1
+ import{A as r}from"./p-DsC0ew4j.js";class a{adapt(a){return r.adaptDefaultString(a)}default(){return""}}export{a as S}
@@ -1 +1 @@
1
- import{C as t}from"./p-DFybNETX.js";class a{static adaptDefaultString(a){return t.isString(a)?a.trim():""}static adaptArray(a,r){const s=[];return t.isArray(a)&&a.forEach((t=>{s.push(r.adapt(t))})),s}}export{a as A}
1
+ import{C as t}from"./p-DguYWLBj.js";class a{static adaptDefaultString(a){return t.isString(a)?a.trim():""}static adaptArray(a,r){const s=[];return t.isArray(a)&&a.forEach((t=>{s.push(r.adapt(t))})),s}}export{a as A}
@@ -0,0 +1 @@
1
+ import{S as n,a as t,A as r,b as o,T as e,D as u,c as a,M as i,d as s}from"./p-DguYWLBj.js";import{T as c,i as l}from"./p-BZXiWkDS.js";import{D as f,a as d}from"./p-ja0FCkHB.js";import{O as v,a as m,p}from"./p-BBdzTx8V.js";import{r as b}from"./p-YSRTB0jS.js";function S(n){return null==n||""===n||"null"===n}function y(n){return"string"==typeof n&&"none"===n.trim().toLowerCase()}function N(t){return S(t)||"auto"===t.trim().toLowerCase()?[]:O((null==t?void 0:t.split(",").filter((t=>!(t.toUpperCase().trim()in n)))).toString())}function O(r){return S(r)?[]:r.replace(";",",").split(",").filter((r=>{var o,e,u;const a=r.split("_"),i=null===(o=a[0])||void 0===o?void 0:o.replace(/^dr|^d/,"").toUpperCase().trim(),s=null===(e=a[1])||void 0===e?void 0:e.toUpperCase().trim(),c=null===(u=a[2])||void 0===u?void 0:u.toUpperCase().trim();return 3!==a.length||!(i in n)||!(s in n)||!(c in t)}))}function J(t){return S(t)?[]:O(t.split(",").filter((t=>!(t.toUpperCase().trim()in n))).toString())}function k(n){return S(n)||"auto"===n.trim().toLowerCase()?[]:O(n.split(",").filter((n=>!(n.toUpperCase()in v))).toString())}function j(n){return S(n)||"auto"===n.trim().toLowerCase()?[]:n.split(",").filter((n=>void 0===p(n)))}function h(n){return!S(n)&&Number.isInteger(Number(n))}function g(n){return!S(n)&&!Number.isNaN(Number(n))}function A(n){return!S(n)&&(null==n?void 0:n.toUpperCase())in m}function T(n){return"auto"===(null==n?void 0:n.toLowerCase())||(null==n?void 0:n.toUpperCase())in r}function B(n){if(S(n))return[];try{const t=JSON.parse(n);if(t instanceof Array)return t.filter((n=>!(n.hasOwnProperty("name")&&n.hasOwnProperty("unit"))))}catch(n){console.error("validateMeasureList: failed to parse JSON",n)}return["Invalid JSON structure"]}function $(n){const t=Date.parse(n);return Number.isInteger(t)}function D(n){return(null==n?void 0:n.toUpperCase())in d}function G(n){return(null==n?void 0:n.toUpperCase())in f}function I(n){return(null==n?void 0:n.toUpperCase().replace("-","_"))in o}function M(n){return!S(n)&&(null==n?void 0:n.toUpperCase())in u}function C(n){return!S(n)&&(null==n?void 0:n.toUpperCase())in a}function E(n){return(null==n?void 0:n.toUpperCase())in c}function w(n){if(S(n))return[];try{const t=JSON.parse(n);if(t instanceof Array)return t.filter((n=>!(n.hasOwnProperty("rowGroup")&&n.hasOwnProperty("category")&&n.hasOwnProperty("subCategory"))))}catch(n){console.error("validateThereOfJsonStr: failed to parse JSON",n)}return["Invalid JSON structure"]}function x(n){if(S(n))return[];try{const t=JSON.parse(n);if(null!==t&&"object"==typeof t&&!(t instanceof Array))return Object.entries(t).filter((([,n])=>"string"!=typeof n||!l(n))).map((([n,t])=>`${n}: ${t}`))}catch(n){console.error("validateAttributesJsonStr: failed to parse JSON",n)}return["Invalid JSON structure"]}function z(n){if(S(n))return[];try{const t=JSON.parse(n);if(t instanceof Array)return t.filter((n=>!(n.hasOwnProperty("rowGroup")&&n.hasOwnProperty("category"))))}catch(n){console.error("validatePartOfJsonStr: failed to parse JSON",n)}return["Invalid JSON structure"]}function L(n){return(null==n?void 0:n.trim().toUpperCase())in i}function Y(n){return["_","k","M","G","T","P","E","Z","Y","m","my","μ","n","p","f","a","z","y"].includes(null==n?void 0:n.trim())||["GREATEST","LEAST"].includes(null==n?void 0:n.trim().toUpperCase())}function _(n){return(null==n?void 0:n.toUpperCase().trim())in s}function q(n){return(null==n?void 0:n.toUpperCase().trim())in e}function P(n){if(S(n))return[];try{return JSON.parse(n).filter((n=>!(n.hasOwnProperty("scenario")&&n.hasOwnProperty("name")&&n.hasOwnProperty("subGroups"))))}catch(n){console.error("validateColumnThereOfJsonStr: failed to parse JSON",n)}return["Invalid JSON structure"]}function R(n){if(S(n))return[];try{const t=JSON.parse(n);if("object"!=typeof t||null===t||Array.isArray(t))return["stack: must be a JSON object"];const r=[];if(t.hasOwnProperty("by")){const n=["scenarios","dimensions"];n.includes(t.by)||r.push(`stack: 'by' must be one of: ${n.join(", ")}`)}else r.push("stack: 'by' is required");if(t.hasOwnProperty("mode")){const n=["absolute","relative","absolute-relative"];n.includes(t.mode)||r.push(`stack: 'mode' must be one of: ${n.join(", ")}`)}if(t.hasOwnProperty("order")){const n=["asc","desc","dataset"];n.includes(t.order)||r.push(`stack: 'order' must be one of: ${n.join(", ")}`)}if(t.hasOwnProperty("notation")){const n=["none","scenario"];n.includes(t.notation)||r.push(`stack: 'notation' must be one of: ${n.join(", ")}`)}if(t.hasOwnProperty("legend")){const n=["left","right","both","none"];n.includes(t.legend)||r.push(`stack: 'legend' must be one of: ${n.join(", ")}`)}return t.hasOwnProperty("percentMark")&&"boolean"!=typeof t.percentMark&&r.push("stack: 'percentMark' must be true or false"),r}catch(n){return["stack: invalid JSON"]}}function W(n){return!S(n)&&null!==b(n)}export{_ as A,P as B,x as C,O as a,k as b,A as c,B as d,$ as e,G as f,D as g,h,S as i,W as j,y as k,T as l,Y as m,R as n,g as o,I as p,J as q,q as r,M as s,C as t,w as u,N as v,E as w,z as x,j as y,L as z}
@@ -1 +1 @@
1
- import{S as n}from"./p-DFybNETX.js";import{r}from"./p-fCjsrD7I.js";const t=/^(dr|d)((?:ac|pp|fc|pl)[1-4])_((?:ac|pp|fc|pl)[1-4])(?:_(pos|neg|neu|op|opinv))?$/;class o{constructor(n,r,t){this.type=n,this.base=r,this.delta=t}static parse(n){const r=t.exec(n);return null===r?null:new o(r[1],r[2],r[3])}compute(n,t){var o;return null==n||null==t?null:"dr"===this.type?0===t?null:null!==(o=r(n-t,t))&&void 0!==o?o:null:n-t}}function i(r){const t=r.trim();if(Object.values(n).includes(t))return{kind:"scenario",slot:t};const i=o.parse(t);return null!==i?{kind:"variance",measure:i}:null}function s(n){return n.replace(/\d+$/,"")}function u(n){return n.replace(/^[a-z]+/,"")}function l(n){var r;return"dr"===(null===(r=o.parse(n.trim()))||void 0===r?void 0:r.type)}function c(n){if(!l(n.measure))return n;const r=n=>void 0===n?void 0:n/100;return Object.assign(Object.assign({},n),{min:r(n.min),max:r(n.max),refLine:r(n.refLine),highlight:n.highlight&&{from:r(n.highlight.from),to:r(n.highlight.to)}})}export{c as a,u as b,l as i,i as r,s}
1
+ import{S as n}from"./p-DguYWLBj.js";import{r}from"./p-fCjsrD7I.js";const t=/^(dr|d)((?:ac|pp|fc|pl)[1-4])_((?:ac|pp|fc|pl)[1-4])(?:_(pos|neg|neu|op|opinv))?$/;class o{constructor(n,r,t){this.type=n,this.base=r,this.delta=t}static parse(n){const r=t.exec(n);return null===r?null:new o(r[1],r[2],r[3])}compute(n,t){var o;return null==n||null==t?null:"dr"===this.type?0===t?null:null!==(o=r(n-t,t))&&void 0!==o?o:null:n-t}}function u(r){const t=r.trim();if(Object.values(n).includes(t))return{kind:"scenario",slot:t};const u=o.parse(t);return null!==u?{kind:"variance",measure:u}:null}function i(n){return n.replace(/\d+$/,"")}function s(n){return n.replace(/^[a-z]+/,"")}function l(n){var r;return"dr"===(null===(r=o.parse(n.trim()))||void 0===r?void 0:r.type)}function c(n){if(!l(n.measure))return n;const r=n=>void 0===n?void 0:n/100;return Object.assign(Object.assign({},n),{min:r(n.min),max:r(n.max),refLine:r(n.refLine),highlight:n.highlight&&{from:r(n.highlight.from),to:r(n.highlight.to)}})}export{c as a,s as b,l as i,u as r,i as s}
@@ -1 +1 @@
1
- import{S as t}from"./p-CeE4_3wQ.js";import{F as s}from"./p-CmvpJzLd.js";import"./p-DFybNETX.js";import{g as i}from"./p-4q8nRcWC.js";import{d as e}from"./p-BjgkgCAQ.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 l=s.number(0,t,i,e,n,this.styles.locale);this.isVarianceLabel&&Number(this.value)>0&&o!==l&&(a="+")}else o=""+this.value;const l=this.drawLabel(n,a+o);return!1===i?(l.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,l=o.h;let c=0,u=0;const f=n.x();let p=n.y();return this.horizontalHookLocation===r.Left?(h="left",c=n.x()):this.horizontalHookLocation===r.Center?(h="middle",c=n.x()-(a+2)/2):this.horizontalHookLocation===r.Right&&(h="end",c=n.x()-a),this.verticalHookLocation===r.Center?(p=n.y()-1.2*l/2,u=p+.2*l):this.verticalHookLocation===r.Top?(p-=l/4,u=p+.2*l):this.verticalHookLocation===r.Bottom&&(p-=l,u=p+.2*l),n.move(f,p),n.font({anchor:h}),null!=this.segmentFillColor?n.fill(i(this.segmentFillColor)):t.rect(a+2,.8*l).stroke(e).fill(e).opacity(.9).move(c-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 l=n[o]||99,c=h/2;for(const h of a){const n=this.calculatePlacementForDirection(t,s,i,e,r,c,8,h);if(!this.hasCollision(n.bounds))return n}for(const h of a){const n=this.calculatePlacementForDirection(t,s,i,e,r,c,8,h);if(!this.collidesWithHigherPriority(n.bounds,l))return n}return null}calculatePlacementForDirection(t,s,i,e,h,n,a,l){let c,u,f,p,m,b;switch(l){case o.Above:c=t,u=s-n-a,f=r.Bottom,p=r.Center,m=t-i/2,b=s-n-a-e;break;case o.Below:c=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:c=t-n-a,u=s,f=r.Center,p=r.Right,m=t-n-a-i,b=s-.6*e;break;case o.Right:c=t+n+a,u=s,f=r.Center,p=r.Left,m=t+n+a,b=s-.6*e}return{labelX:c,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}
1
+ import{S as t}from"./p-CeE4_3wQ.js";import{F as s}from"./p-CmvpJzLd.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 l=s.number(0,t,i,e,n,this.styles.locale);this.isVarianceLabel&&Number(this.value)>0&&o!==l&&(a="+")}else o=""+this.value;const l=this.drawLabel(n,a+o);return!1===i?(l.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,l=o.h;let c=0,u=0;const f=n.x();let p=n.y();return this.horizontalHookLocation===r.Left?(h="left",c=n.x()):this.horizontalHookLocation===r.Center?(h="middle",c=n.x()-(a+2)/2):this.horizontalHookLocation===r.Right&&(h="end",c=n.x()-a),this.verticalHookLocation===r.Center?(p=n.y()-1.2*l/2,u=p+.2*l):this.verticalHookLocation===r.Top?(p-=l/4,u=p+.2*l):this.verticalHookLocation===r.Bottom&&(p-=l,u=p+.2*l),n.move(f,p),n.font({anchor:h}),null!=this.segmentFillColor?n.fill(i(this.segmentFillColor)):t.rect(a+2,.8*l).stroke(e).fill(e).opacity(.9).move(this.horizontalHookLocation===r.Center?c:c-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 l=n[o]||99,c=h/2;for(const h of a){const n=this.calculatePlacementForDirection(t,s,i,e,r,c,8,h);if(!this.hasCollision(n.bounds))return n}for(const h of a){const n=this.calculatePlacementForDirection(t,s,i,e,r,c,8,h);if(!this.collidesWithHigherPriority(n.bounds,l))return n}return null}calculatePlacementForDirection(t,s,i,e,h,n,a,l){let c,u,f,p,m,b;switch(l){case o.Above:c=t,u=s-n-a,f=r.Bottom,p=r.Center,m=t-i/2,b=s-n-a-e;break;case o.Below:c=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:c=t-n-a,u=s,f=r.Center,p=r.Right,m=t-n-a-i,b=s-.6*e;break;case o.Right:c=t+n+a,u=s,f=r.Center,p=r.Left,m=t+n+a,b=s-.6*e}return{labelX:c,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}
@@ -1 +1 @@
1
- import{S as e}from"./p-CeE4_3wQ.js";import{C as t}from"./p-DFybNETX.js";var r;!function(e){e[e.Y=1e24]="Y",e[e.Z=1e21]="Z",e[e.E=1e18]="E",e[e.P=1e15]="P",e[e.T=1e12]="T",e[e.G=1e9]="G",e[e.M=1e6]="M",e[e.k=1e3]="k",e[e.h=100]="h",e[e.da=10]="da",e[e.d=.1]="d",e[e.c=.01]="c",e[e.m=.001]="m",e[e.my=1e-6]="my",e[e.n=1e-9]="n",e[e.p=1e-12]="p",e[e.f=1e-15]="f",e[e.a=1e-18]="a",e[e.z=1e-21]="z",e[e.y=1e-24]="y"}(r||(r={}));class n{static calculateMeasureScale(t,r,n,a,s){var i,u;if("_"===a)return new e;if("μ"===a&&(a="my"),null!=a&&[...this.unitsLeast,...this.unitsGreat].includes(a))return this.lookupPrefix(a);const h=n.filter((e=>3===e.length));if(0===h.length||!r)return new e;const l=`SELECT MAX(GREATEST(${h.map((e=>"ABS("+e+")")).toString()})) as prefixvalue\n FROM ${r}`,c=`SELECT MIN(LEAST(${h.map((e=>"ABS("+e+")")).toString()})) as prefixvalue\n FROM ${r}`;let o,f=l;"LEAST"===(null==a?void 0:a.toUpperCase())&&(f=c);try{o=null!==(u=null===(i=t.exec(f)[0])||void 0===i?void 0:i.prefixvalue)&&void 0!==u?u:0}catch(t){return null==s||s(t),new e}return this.determinePrefix(Math.abs(o))}static determinePrefix(t){if(!Number.isFinite(t)||t<=0)return new e;if(t>=1e3){const r=Math.min(Math.floor(Math.log10(t)/3),this.unitsGreat.length)-1;return new e(this.unitsGreat[r],Math.pow(1e3,r+1))}if(t<=.001){const r=Math.min(-Math.floor(Math.log10(t)/3),this.unitsLeast.length)-1;return new e(this.unitsLeast[r],Math.pow(1e3,-(r+1)))}return new e}static lookupPrefix(t){return new e(t,r[t])}}n.unitsGreat=["k","M","G","T","P","E","Z","Y"],n.unitsLeast=["m","my","n","p","f","a","z","y"];class a{constructor(e=2,t=1){this.percent=e,this.decimal=t}}class s{adapt(e){const r=new a,n=e=>t.isNumber(e)&&Number.isInteger(e)&&e>=0&&e<=100;return n(e.percent)&&(r.percent=e.percent),n(e.decimal)&&(r.decimal=e.decimal),r}default(){return new a}}export{n as D,a,s as b}
1
+ import{S as e}from"./p-CeE4_3wQ.js";import{C as t}from"./p-DguYWLBj.js";var r;!function(e){e[e.Y=1e24]="Y",e[e.Z=1e21]="Z",e[e.E=1e18]="E",e[e.P=1e15]="P",e[e.T=1e12]="T",e[e.G=1e9]="G",e[e.M=1e6]="M",e[e.k=1e3]="k",e[e.h=100]="h",e[e.da=10]="da",e[e.d=.1]="d",e[e.c=.01]="c",e[e.m=.001]="m",e[e.my=1e-6]="my",e[e.n=1e-9]="n",e[e.p=1e-12]="p",e[e.f=1e-15]="f",e[e.a=1e-18]="a",e[e.z=1e-21]="z",e[e.y=1e-24]="y"}(r||(r={}));class n{static calculateMeasureScale(t,r,n,a,s){var i,u;if("_"===a)return new e;if("μ"===a&&(a="my"),null!=a&&[...this.unitsLeast,...this.unitsGreat].includes(a))return this.lookupPrefix(a);const h=n.filter((e=>3===e.length));if(0===h.length||!r)return new e;const l=`SELECT MAX(GREATEST(${h.map((e=>"ABS("+e+")")).toString()})) as prefixvalue\n FROM ${r}`,c=`SELECT MIN(LEAST(${h.map((e=>"ABS("+e+")")).toString()})) as prefixvalue\n FROM ${r}`;let o,f=l;"LEAST"===(null==a?void 0:a.toUpperCase())&&(f=c);try{o=null!==(u=null===(i=t.exec(f)[0])||void 0===i?void 0:i.prefixvalue)&&void 0!==u?u:0}catch(t){return null==s||s(t),new e}return this.determinePrefix(Math.abs(o))}static determinePrefix(t){if(!Number.isFinite(t)||t<=0)return new e;if(t>=1e3){const r=Math.min(Math.floor(Math.log10(t)/3),this.unitsGreat.length)-1;return new e(this.unitsGreat[r],Math.pow(1e3,r+1))}if(t<=.001){const r=Math.min(-Math.floor(Math.log10(t)/3),this.unitsLeast.length)-1;return new e(this.unitsLeast[r],Math.pow(1e3,-(r+1)))}return new e}static lookupPrefix(t){return new e(t,r[t])}}n.unitsGreat=["k","M","G","T","P","E","Z","Y"],n.unitsLeast=["m","my","n","p","f","a","z","y"];class a{constructor(e=2,t=1){this.percent=e,this.decimal=t}}class s{adapt(e){const r=new a,n=e=>t.isNumber(e)&&Number.isInteger(e)&&e>=0&&e<=100;return n(e.percent)&&(r.percent=e.percent),n(e.decimal)&&(r.decimal=e.decimal),r}default(){return new a}}export{n as D,a,s as b}
@@ -0,0 +1 @@
1
+ import{f as t,c as s}from"./p-BnmylmXF.js";import{g as r,c as e}from"./p-6242qMx1.js";import{r as o}from"./p-BrQCbmG0.js";import{i as l,f as a,r as u}from"./p-DBj1Yd3M.js";import{m as n}from"./p-B2NXsfMz.js";const i=i=>{let m,f,p,c,b,j=null;const M=()=>{const t=f.ruleSets.state;b=n([t._default||{},t[p]||{}]),c=n([t._system||{},b])},B=()=>{const r=s(i),e=r.getAttribute("ruleset");if(j&&(j.disconnect(),j=null),e&&l(e)){const s=a(r,e);if(p=u(s,"ruleset"),s.length>0){j=new MutationObserver((()=>{p=u(s,"ruleset"),M(),t(i)}));for(const t of s)j.observe(t,{attributes:!0,attributeFilter:["ruleset"]})}}else p=e},w=new MutationObserver((s=>{s.forEach((s=>{"ruleset"===s.attributeName&&(B(),M(),t(i))}))})),F=i.connectedCallback;i.connectedCallback=()=>{const e=s(i);f=r(e),c=f.ruleSets.state._system,w.observe(e,{attributes:!0,attributeFilter:["ruleset"]}),B(),M(),m=f.ruleSets.on("set",(r=>{r!==p&&"_default"!==r||(B(),M(),t(s(i)))})),o(F,i)};const d=i.disconnectedCallback;return i.disconnectedCallback=()=>{w.disconnect(),j&&(j.disconnect(),j=null),o(m),e(s(i)),o(d,i)},(t="all")=>"user"===t?b:c};export{i as w}
@@ -0,0 +1 @@
1
+ import{p as t,H as e,h as i,d as s,t as a}from"./p-BnmylmXF.js";import{v as r,a as n,b as o,c as d,d as l,e as h,i as u,f as v,g as p}from"./p-HVN8BNWN.js";import{w as m,D as c}from"./p-BrQCbmG0.js";import{w as f}from"./p-DBj1Yd3M.js";import{a as b,g}from"./p-6242qMx1.js";import{w as y}from"./p-CVfmhtEW.js";import{w as D}from"./p-JG4Sx1lE.js";import{r as S}from"./p-CmvpJzLd.js";import{w}from"./p-x0W2_FAX.js";import{w as N}from"./p-D32TsLzd.js";import{I as j}from"./p-DguYWLBj.js";import{a as k}from"./p-BBdzTx8V.js";import{a as E,D as W}from"./p-ja0FCkHB.js";import{d as x}from"./p-BVNOmHh4.js";const z=t(class extends e{constructor(t){super(),!1!==t&&this.__registerHost(),this.__attachShadow(),this.businessUnit="",this.order="category",this.orderDirection="asc",this.dateFormat="none",this.dateLink="none",y(this),m(this),this.t=f(this).t,this.errors=N(this),this.componentStyle=D(this),this.ruleSetConfig=w(this)}validateScenario(t){const e="WARN_scenarios",i=r(t);i.length>0?this.errors.addOrReplace({id:e,type:"warning",message:"scenarios: invalid value(s) '"+(null==i?void 0:i.toString())+"' are not supported."}):this.errors.remove(e)}validateVariances(t){const e="WARN_variances",i=n(t);i.length>0?this.errors.addOrReplace({id:e,type:"warning",message:"variances: invalid value(s) '"+(null==i?void 0:i.toString())+"' are not supported."}):this.errors.remove(e)}validateOrder(t){const e=o(t),i="WARN_order";e.length>0?this.errors.addOrReplace({id:i,type:"warning",message:"order: invalid value(s) '"+(null==e?void 0:e.toString())+"' are not supported."}):this.errors.remove(i)}validateOrderDirection(t){const e="WARN_orderDirection";d(t)?this.errors.remove(e):this.errors.addOrReplace({id:e,type:"warning",message:"orderDirection: invalid value '"+(null==t?void 0:t.toString())+"' is not supported."})}validateMeasures(t){const e="WARN_measures",i=l(t);i.length>0?this.errors.addOrReplace({id:e,type:"warning",message:"measures: invalid value(s) '"+(null==i?void 0:i.toString())+'\' are not supported. Valid format example: [{"name": "Bruttoumsatz", "unit": "mEUR"}]'}):this.errors.remove(e)}validateDateStart(t){const e="WARN_dateStart";h(t)||u(t)?this.errors.remove(e):this.errors.addOrReplace({id:e,type:"warning",message:"dateStart: invalid value '"+(null==t?void 0:t.toString())+"' is not supported."})}validateDateEnd(t){const e="WARN_dateEnd";h(t)||u(t)?this.errors.remove(e):this.errors.addOrReplace({id:e,type:"warning",message:"dateStart: invalid value '"+(null==t?void 0:t.toString())+"' is not supported."})}validateDateFormat(t){const e="WARN_dateFormat";v(t)||u(t)?this.errors.remove(e):this.errors.addOrReplace({id:e,type:"warning",message:"dateFormat: invalid value '"+(null==t?void 0:t.toString())+"' is not supported."})}validateDateLink(t){const e="WARN_dateLink";p(t)||u(t)?this.errors.remove(e):this.errors.addOrReplace({id:e,type:"warning",message:"dateLink: invalid value '"+(null==t?void 0:t.toString())+"' is not supported."})}componentWillLoad(){this.validateScenario(this.scenarios),this.validateVariances(this.variances),this.validateMeasures(this.measures),this.validateDateStart(this.dateStart),this.validateDateEnd(this.dateEnd),this.validateDateFormat(this.dateFormat),this.validateDateLink(this.dateLink),this.validateOrderDirection(this.orderDirection),this.validateOrder(this.order)}prepareI18n(){const t=b,e=new Map(["SEPARATOR_WS","in","CONNECTOR_WS"].map((t=>[t,this.t(".".concat(t))]))),i=new Map(t.map((t=>[t,this.t("global.".concat(t))])));return new Map([...i.entries(),...e.entries(),...S(this.ruleSetConfig("user"))])}prepareI18nMode(){return j.META}prepareLocale(){return g(this.element).context.state.locale||"de"}prepareTitleOrder(){var t;return u(this.order)||u(this.orderDirection)?null:{hierarchy:this.order.split(",").map((t=>t.trim())),direction:k[null===(t=this.orderDirection)||void 0===t?void 0:t.toUpperCase()]}}prepareTitleTimePeriod(){var t,e;return u(this.dateStart)&&u(this.dateEnd)||u(this.dateLink)?null:{start:c.fromISO(this.dateStart,{zone:"utc"}),end:c.fromISO(this.dateEnd,{zone:"utc"}),format:W[null===(t=this.dateFormat)||void 0===t?void 0:t.toUpperCase()],link:E[null===(e=this.dateLink)||void 0===e?void 0:e.toUpperCase()]}}prepareMeasures(){if(u(this.measures))return[];try{return JSON.parse(this.measures)}catch(t){return[]}}prepareScenarios(){var t,e,i,s;if(u(this.scenarios)&&u(this.variances))return[];let a=[];return(null===(t=this.scenarios)||void 0===t?void 0:t.trim().length)>0&&(a=a.concat(null===(e=this.scenarios)||void 0===e?void 0:e.split(","))),(null===(i=this.variances)||void 0===i?void 0:i.trim().length)>0&&(a=a.concat(null===(s=this.variances)||void 0===s?void 0:s.split(","))),a.map((t=>t.trim()))}prepareBusinessUnit(){return u(this.businessUnit)||"null"===this.businessUnit?null:this.businessUnit}getFontStyles(){return this.componentStyle((t=>{var e,i,s,a;return{"--bn-font-family":(null===(e=t.global)||void 0===e?void 0:e.fontFamily)||"'Noto Sans', sans-serif","--bn-font-size":`${this.titleFontSize>0?this.titleFontSize:(null===(i=t.global)||void 0===i?void 0:i.fontSizePx)||13.3333}px`,"--bn-font-color":(null===(s=t.global)||void 0===s?void 0:s.fontColor)||"#000000","--bn-font-background":(null===(a=t.global)||void 0===a?void 0:a.fontBackgroundColor)||"#ffffff"}}))}render(){const t=this.getFontStyles();return i(s,{key:"999f282ecc2901b62f051e0501da7dd41f44a30a",style:t},i("bn-title-renderer",{key:"2c58cbb472fc807a83503e7789babce4b17b1081",businessUnit:this.prepareBusinessUnit(),scenarios:this.prepareScenarios(),measures:this.prepareMeasures(),timeperiod:this.prepareTitleTimePeriod(),order:this.prepareTitleOrder(),i18n:this.prepareI18n(),"i18n-mode":this.prepareI18nMode(),locale:this.prepareLocale(),ruleSetConfig:this.ruleSetConfig()}))}get element(){return this}static get watchers(){return{scenarios:[{validateScenario:0}],variances:[{validateVariances:0}],order:[{validateOrder:0}],orderDirection:[{validateOrderDirection:0}],measures:[{validateMeasures:0}],dateStart:[{validateDateStart:0}],dateEnd:[{validateDateEnd:0}],dateFormat:[{validateDateFormat:0}],dateLink:[{validateDateLink:0}]}}static get style(){return':host{padding:0.5em;margin-bottom:0.5em;box-sizing:border-box;-webkit-box-sizing:border-box;width:100%;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)}'}},[1,"bn-title",{selectedStyle:[513,"selected-style"],i18nNamespace:[513,"i18n-namespace"],ruleset:[513],titleFontSize:[2,"title-font-size"],businessUnit:[1,"business-unit"],scenarios:[1],variances:[1],order:[1],orderDirection:[1,"order-direction"],measures:[1],dateStart:[1,"date-start"],dateEnd:[1,"date-end"],dateFormat:[1,"date-format"],dateLink:[1,"date-link"]},void 0,{scenarios:[{validateScenario:0}],variances:[{validateVariances:0}],order:[{validateOrder:0}],orderDirection:[{validateOrderDirection:0}],measures:[{validateMeasures:0}],dateStart:[{validateDateStart:0}],dateEnd:[{validateDateEnd:0}],dateFormat:[{validateDateFormat:0}],dateLink:[{validateDateLink:0}]}]);function F(){"undefined"!=typeof customElements&&["bn-title","bn-title-renderer"].forEach((t=>{switch(t){case"bn-title":customElements.get(a(t))||customElements.define(a(t),z);break;case"bn-title-renderer":customElements.get(a(t))||x()}}))}export{z as T,F as d}