@bino-bi/bn-template-engine 1.0.0-next.35 → 1.0.0-next.37

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.
@@ -128,8 +128,12 @@ export declare class BnTableRenderer {
128
128
  private table;
129
129
  private componentDataFormatDigits;
130
130
  private barChartStyles;
131
+ private barColumnLayouts;
131
132
  private stores;
132
133
  constructor();
134
+ private readonly relayout;
135
+ connectedCallback(): void;
136
+ disconnectedCallback(): void;
133
137
  /**
134
138
  * Collects the table's layout-state contribution: header/body regions,
135
139
  * counts, and - with `detail: "full"` - per-cell geometry paired with the
@@ -148,28 +152,25 @@ export declare class BnTableRenderer {
148
152
  * Scenario styles (ac, pp, fc, pl) use barStyles for IBCS-compliant grayscale coloring.
149
153
  */
150
154
  private prepareBarChartStyles;
155
+ /** Font family of the bar and pin labels, also used to measure them. */
156
+ private labelFontFamily;
151
157
  /** The table's true em in px - the unit `.category-wN` and the bar columns share. */
152
158
  private emPx;
153
159
  /**
154
160
  * Auto-calculate unitScaling so the largest absolute variance bar
155
161
  * fills ~80% of its side of the bar area, without tripping the overdrive break.
162
+ * One scaling for all columns, so it is the smallest that fits every column.
156
163
  */
157
164
  private autoUnitScaling;
158
165
  /**
159
- * Auto-calculate percentageScaling so the largest relative variance pin
160
- * fills ~80% of the pin area.
166
+ * Auto-calculate percentageScaling so the longest relative variance pin, its head and
167
+ * its label exactly fill the column. One scaling for all columns, the smallest that fits.
161
168
  */
162
169
  private autoPercentageScaling;
163
170
  /**
164
- * Maximum value and sign coverage across all absolute variance columns (d_*) in the table body.
165
- * Sign coverage decides how much of the column the bar area gets (see barColumnGeometry.ts);
166
- * OR-ing it across columns keeps the single shared scaling inside the narrowest bar area.
171
+ * Largest value and widest label per side of every bar and pin column, from the cells
172
+ * that draw one: total rows and n/a draw none. Interval buckets share the column key,
173
+ * so they share the layout and the axis.
167
174
  */
168
- private getAbsBarColumnStats;
169
- /**
170
- * Same for the relative variance columns (dr_*). Values are stored as decimals
171
- * (e.g. 0.2 = 20%), returned as percentage (20).
172
- */
173
- private getRelativeBarColumnStats;
174
- private collectBarColumnStats;
175
+ private collectBarColumnLayouts;
175
176
  }
@@ -1,6 +1,7 @@
1
1
  import { FunctionalComponent } from "../../../../stencil-public-runtime";
2
2
  import { ColumnStats } from "./Cell";
3
3
  import { FillPattern } from "../../../../utils/model/styles/SVGStyle";
4
+ import { SideLabels } from "../helper/barColumnGeometry";
4
5
  export interface VarianceStyle {
5
6
  stroke: string;
6
7
  fill: string;
@@ -42,8 +43,14 @@ export interface CellBarChartProps {
42
43
  measureScale?: number;
43
44
  locale?: string;
44
45
  percentDigits?: number;
46
+ /** False drops the % of a relative label, for a column too narrow for it. */
47
+ percentSign?: boolean;
45
48
  /** Total column width in table em - see barColumnGeometry.ts. */
46
49
  columnWidthEm?: number;
50
+ /** Widest label per side over the drawn cells of the column; without it only this cell's label counts. */
51
+ labelWidths?: SideLabels;
52
+ /** Largest absolute drawn value per side over the column; without it the column statistics count. */
53
+ sideMax?: SideLabels;
47
54
  styles?: CellBarChartStyles;
48
55
  }
49
56
  export declare const DEFAULT_STYLES: CellBarChartStyles;
@@ -57,11 +64,13 @@ export declare const PatternDefs: FunctionalComponent<{
57
64
  /**
58
65
  * Formats a number for display with appropriate SI prefix.
59
66
  */
60
- export declare function formatValue(value: number, isRelative: boolean, measureScale?: number, locale?: string, percentDigits?: number): string;
67
+ export declare function formatValue(value: number, isRelative: boolean, measureScale?: number, locale?: string, percentDigits?: number, percentSign?: boolean): string;
61
68
  /**
62
69
  * Gets the scenario type from the column name (ac, pp, fc, pl).
63
70
  */
64
71
  export declare function getScenarioType(scenario: string): "ac" | "pp" | "fc" | "pl";
72
+ /** A zero value is drawn on the positive side, unless the column only has negative values. */
73
+ export declare function zeroOnPositiveSide(labels: SideLabels): boolean;
65
74
  /**
66
75
  * Gets the appropriate style for a bar based on column type.
67
76
  * Scenarios (ac, pp, fc, pl) use scenario styles.
@@ -14,11 +14,27 @@
14
14
  * unitScaling / percentageScaling math, so changing it rescales every user-set value.
15
15
  */
16
16
  export declare const BAR_LABEL_FONT_RATIO = 0.85;
17
+ /** Width of the axis of a variance bar or pin, in em: near the 0.3em scenario marker in the header. */
18
+ export declare const VARIANCE_AXIS_EM = 0.25;
19
+ /** Side of the square pin head, in px before scaleFactor. */
20
+ export declare const PIN_HEAD_SIZE = 10;
21
+ /** Estimated rendered width of a value label in px, with a margin for wider fonts. */
22
+ export declare function estimateLabelWidth(text: string, fontSize: number): number;
23
+ /**
24
+ * Rendered width of a value label in px, measured with the font the SVG text uses. Falls
25
+ * back to estimateLabelWidth where no canvas can measure.
26
+ */
27
+ export declare function labelWidth(text: string, fontSize: number, fontFamily: string, italic: boolean): number;
28
+ /** Widest value label in px per side of the axis; a side without drawn values is undefined. */
29
+ export interface SideLabels {
30
+ neg?: number;
31
+ pos?: number;
32
+ }
33
+ /** True when the labels fit beside pins of at least the minimum extent; else the caller drops digits. */
34
+ export declare function pinLabelsFit(widthEm: number, emPx: number, labels: SideLabels, headSize: number): boolean;
17
35
  export interface AbsoluteBarGeometry {
18
36
  /** SVG width - the cell's content box. */
19
37
  totalWidth: number;
20
- /** Width of one value-label gutter; one is drawn per side in use. */
21
- labelAreaWidth: number;
22
38
  /** Max bar extent on one side of the axis. */
23
39
  maxBarWidth: number;
24
40
  axisX: number;
@@ -29,19 +45,25 @@ export interface AbsoluteBarGeometry {
29
45
  /** Gap between the bar end and its value label. */
30
46
  labelGap: number;
31
47
  }
32
- export declare function absoluteBarGeometry(widthEm: number, emPx: number, hasNeg: boolean, hasPos: boolean): AbsoluteBarGeometry;
48
+ export declare function absoluteBarGeometry(widthEm: number, emPx: number, labels: SideLabels): AbsoluteBarGeometry;
33
49
  export interface RelativePinGeometry {
34
50
  totalWidth: number;
35
- /** Width of one value-label gutter; one is drawn per side in use. */
36
- labelAreaWidth: number;
37
- /** Max pin extent on one side of the axis. */
51
+ /** Max pin extent of the longer side, to the centre of the head or the base of the arrow tip. */
38
52
  maxPinLength: number;
39
- pinPadding: number;
53
+ /** Max pin extent per side; a longer pin is cut and ends in an arrow. */
54
+ negPinLength: number;
55
+ posPinLength: number;
40
56
  axisX: number;
41
57
  /** Gap between the pin head and its value label. */
42
58
  labelGap: number;
43
59
  }
44
- export declare function relativePinGeometry(widthEm: number, emPx: number, hasNeg: boolean, hasPos: boolean): RelativePinGeometry;
60
+ /**
61
+ * `reach` is the length in px the longest pin of each side wants at the column's scale.
62
+ * With it, the pin room is split by what each side needs, so a side with shorter pins
63
+ * gives its room to the other; room left after both is shared equally. Without it, both
64
+ * sides get the same extent.
65
+ */
66
+ export declare function relativePinGeometry(widthEm: number, emPx: number, labels: SideLabels, headSize: number, reach?: SideLabels): RelativePinGeometry;
45
67
  export interface WaterfallGeometry {
46
68
  totalWidth: number;
47
69
  /** One gutter on each side; a waterfall always spans its full range. */
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bino-bi/bn-template-engine",
3
- "version": "1.0.0-next.35",
3
+ "version": "1.0.0-next.37",
4
4
  "description": "IBCS-compliant web components for business intelligence tables and charts",
5
5
  "main": "dist/index.cjs.js",
6
6
  "module": "dist/index.js",
@@ -1 +0,0 @@
1
- import{h as t,p as e,H as o,a as i,t as n}from"./p-D6YGOYV1.js";import{m as s,a as r,b as a}from"./p-DaOm9YwQ.js";import{p as l,n as h,r as c,d as u}from"./p-BzjGUtYh.js";import{F as d,V as f,Q as p,s as $,a as m,I as v,b as g}from"./p-CniN8ALm.js";import{S as b,I as w,D as E,C as S,d as R,M as y}from"./p-B5tixDPM.js";import{N as O,r as M}from"./p-fCjsrD7I.js";import{D as N,w as U}from"./p-Dq9dG0Kr.js";import{D as G,b as T}from"./p-sLbQ7yZ1.js";import{F as _}from"./p-DCPLGEs_.js";import{p as L,c as k}from"./p-16rjcQ0t.js";import{d as C,g as x}from"./p-DDvWTgk1.js";import{D as A,a as P,b as D}from"./p-7ieJFBUk.js";import{A as W}from"./p-BXg3v5AO.js";import{S as B}from"./p-BPGLOHUe.js";import{S as F}from"./p-CeE4_3wQ.js";import{w as Y}from"./p-DjPWZfry.js";var H,j,I,z,Q;!function(t){t[t.ALL=-1]="ALL"}(H||(H={})),function(t){t[t.UP_TO_DATE=0]="UP_TO_DATE",t[t.DIRTY=1]="DIRTY"}(j||(j={})),function(t){t.LIST="list",t.SUM="sum",t.SUMNOTOTAL="sumnototal",t.OPT="opt",t.OPTNOTOTAL="optnototal"}(I||(I={})),function(t){t.ASC="asc",t.DESC="desc"}(z||(z={})),function(t){t.HEADER="HEADER",t.GROUPHEAD="GROUPHEAD",t.SEPERATORLINE="SEPERATORLINE",t.SUM="SUM",t.GROUPSUM="GROUP_SUM",t.DRILLELEMENT="DRILLELEMENT",t.STANDARD="STANDARD",t.PARTELEMENT="PARTELEMENT",t.ENTRY="ENTRY"}(Q||(Q={}));const V="none",X="setname";function q(t){return t===X?"COALESCE([setname],[setName])":`normalizeDate([date], '${t}')`}function K(t){if(null==t)return"";if("string"==typeof t)return t.trim();const e=Z(t);return e?e.toISO():String(t)}function Z(t){if(null!=t){if("string"==typeof t){const e=N.fromISO(t,{zone:"utc"});return e.isValid?e:void 0}if("number"==typeof t){const e=N.fromMillis(t,{zone:"utc"});return e.isValid?e:void 0}if("boolean"==typeof t.isValid)return t.isValid?t:void 0}}const J=/[\s\u200e\u200f\u061c]*[%\u066a][\s\u200e\u200f\u061c]*/;class tt{constructor(t,e,o,i,n,s,r,a,l){this.prefixStyle="prefix",this.isBarChart=!1,this.key=t,this.index=e,this.value=o,this.prefix=s||"",this.cssStyle=i||"",this.prefixStyle=r||"prefix",this.type=n,this.mark=void 0,this.colSpan=a||1,this.measureScale=l||1}getAsHeaderList(){if(null==this.value)return[""];const t=[];for(const e of this.value.toString().split("<br/>"))t.push(e);return t}draw(t,e){let o=this.value;if("undefined"===o||void 0===o||null==o)return"";if(Number.isNaN(Number(o)))return o;if(""===this.type||void 0===this.type||null==this.type)return o;let i=t.percent,n=t.percent;return"percentpoint"===this.type?d.number(Number(o),"percent",i,n,1,e).replace(J,""):("decimal"===this.type&&(o=+o/this.measureScale,i=t.decimal,n=t.decimal),d.number(Number(o),this.type,i,n,1,e))}drawPrefix(){return null==this.prefix?"":this.prefix}}class et{constructor(t,e,o){this.index=t,this.groupindex=e,this.type=o,this.cssStyle=this.initCssStyle(),this.elements=[]}initCssStyle(){switch(this.type){case Q.HEADER:return"groupheader";case Q.SEPERATORLINE:return"";case Q.DRILLELEMENT:return"ofit";case Q.PARTELEMENT:return"partof";case Q.STANDARD:return"";case Q.SUM:return"sum";default:return""}}getCells(){return this.elements}createElement(t,e,o,i,n,s,r,a,l,h=!1,c,u=1,d){let f=s;"category"===e&&null!=a&&(f=`category-${a.toString()}`),this.type===Q.HEADER?f="headerlabel":this.type===Q.SEPERATORLINE&&(f=null!=s?s:e),this.type===Q.PARTELEMENT&&("percent"===i&&(t="-"),"category"!==e&&"operation"!==e&&(i="percent",f="")),("-"===t||t===O&&"percent"===i)&&(f="");let p="prefix-first";r&&(p="prefix-second"),o&&(f=`${f} ${o}`);const $=new tt(e,this.elements.length,t,f,i,n,p,u,l);$.isBarChart=h,$.columnStats=c,$.waterfall=d,this.elements.push($)}}const ot=.85;function it(t,e){return Math.max(0,(t-.5)*e)}function nt(t,e){return Math.max(1,(t?1:0)+(e?1:0))}function st(t,e,o,i){const n=it(t,e),s=nt(o,i),r=Math.min(2.85*e,n/(2*s)),a=(n-r*s)/s,l=Math.min(.3*e,.2*a),h=.15*a;return{totalWidth:n,labelAreaWidth:r,maxBarWidth:a,axisX:o?r+a:0,breakGap:l,overdriveZoneWidth:h,cutWidth:Math.max(0,a-l-h),labelGap:.3*e}}function rt(t,e,o,i){const n=it(t,e),s=nt(o,i),r=Math.min(3.375*e,n/(2*s)),a=(n-r*s)/s,l=Math.min(.375*e,.2*a);return{totalWidth:n,labelAreaWidth:r,maxPinLength:Math.max(0,a-l),pinPadding:l,axisX:o?r+a:0,labelGap:.3*e}}const at={positive:{stroke:"#008f96",fill:"#008f96",fillpattern:"solid"},negative:{stroke:"#ff0000",fill:"#ff0000",fillpattern:"solid"},neutral:{stroke:"#808080",fill:"#808080",fillpattern:"outlined"},scenarios:{ac:{stroke:"#404040",fill:"#404040",fillpattern:"solid"},pp:{stroke:"#A6A6A6",fill:"#A6A6A6",fillpattern:"solid"},fc:{stroke:"#404040",fill:"#ffffff",fillpattern:"hatched"},pl:{stroke:"#404040",fill:"#ffffff",fillpattern:"outlined"}},fontColor:"#000000",fontSize:11.333305,emPx:13.3333,fontFamily:"'Noto Sans', sans-serif",unitScaling:.01,percentageScaling:.5,scaleFactor:1},lt="#666666";function ht(t,e){return`pattern-${t}-${e.replace("#","")}`}const ct=({styles:e})=>{const o=e.scaleFactor,i=6*o,n=[{id:ht("pos",e.positive.stroke),stroke:e.positive.stroke,fill:e.positive.fill},{id:ht("neg",e.negative.stroke),stroke:e.negative.stroke,fill:e.negative.fill},{id:ht("neu",e.neutral.stroke),stroke:e.neutral.stroke,fill:e.neutral.fill},...["ac","pp","fc","pl"].map((t=>({id:ht(t,e.scenarios[t].stroke),stroke:e.scenarios[t].stroke,fill:e.scenarios[t].fill})))];return t("defs",null,n.map((e=>t("pattern",{id:e.id,patternUnits:"userSpaceOnUse",width:i,height:i},t("rect",{width:i,height:i,fill:"#ffffff"}),t("line",{x1:"0",y1:i,x2:i,y2:"0",stroke:e.stroke,"stroke-width":1.5*o})))))};function ut(t,e,o=1,i,n=0){const s=t>=0?"+":"";if(e){const e=e=>s+d.number(t,"percent",e,e,1,i);let o=Math.min(20,Math.max(0,Math.trunc(n)||0));for(;o>0&&e(o).length>7;)o--;return e(o)}const r=t/o,a=Math.abs(r);let l=1,h="";return a>=9995e5?(l=1e9,h="B"):a>=999500?(l=1e6,h="M"):a>=999.5&&(l=1e3,h="K"),s+d.number(r/l,"decimal",a>=10*l?0:1,0,1,i)+h}function dt(t){const e=t.slice(0,2).toLowerCase();return["ac","pp","fc","pl"].includes(e)}function ft(t){const e=t.slice(0,2).toLowerCase();return"pp"===e?"pp":"fc"===e?"fc":"pl"===e?"pl":"ac"}function pt(t,e){if(dt(t))return null;const o=new f(t);if(!o.isValid)return null;const i=ft(o.base),n=ft(o.delta);return{minuend:e.scenarios[i],minuendSlot:i,reference:e.scenarios[n],referenceSlot:n}}const $t=({x:e,height:o,look:i,styles:n})=>{const s=n.scaleFactor,r=.25*n.emPx,{reference:a,referenceSlot:l}=i;let h;if("outlined"===a.fillpattern){const i=r/2-.5*s;h=[e-i,e+i].map((e=>t("line",{x1:e,y1:0,x2:e,y2:o,stroke:a.stroke,"stroke-width":1*s})))}else h=t("line","hatched"===a.fillpattern?{x1:e,y1:0,x2:e,y2:o,stroke:a.stroke,"stroke-width":r,"stroke-dasharray":""+2*s}:{x1:e,y1:0,x2:e,y2:o,stroke:a.fill,"stroke-width":r});return t("g",{class:`variance-axis axis-${l}`},h)};function mt(t,e,o,i){return dt(t)?function(t,e){const o=ft(t);return e.scenarios[o]}(t,i):function(t,e,o){const i=t>=0;return e?i?o.positive:o.negative:i?o.negative:o.positive}(e,o,i)}function vt(t,e){const o=t.fillpattern;return"hatched"===o?`url(#${ht(e,t.stroke)})`:"outlined"===o?"transparent":t.fill}function gt(t){return"outlined"===t.fillpattern?{stroke:t.stroke,strokeWidth:1.5}:{stroke:"none",strokeWidth:0}}const bt=e=>{const{value:o,scenario:i,columnStats:n,height:s,isPositiveGood:r,formattedValue:a,measureScale:l,locale:h,columnWidthEm:c=10,styles:u=at}=e,d=u.scaleFactor,f=u.fontSize,p=n.min<0,$=n.max>0,{totalWidth:m,axisX:v,breakGap:g,overdriveZoneWidth:b,cutWidth:w,labelGap:E}=st(c,u.emPx,p,$),S=Math.abs(o)*u.unitScaling*f,R=S-w>1e-6,y=Math.max(0,n.absMax*u.unitScaling*f-w),O=Math.max(0,S-w),M=y>0?O/y*b:0,N=2*d,U=s-2*N,G=N,T=o>=0,_=pt(i,u),L=mt(i,o,r,u),k=null==_?void 0:_.minuend.fillpattern,C="hatched"===k||"outlined"===k?Object.assign(Object.assign({},L),{fillpattern:k}):L,x=vt(C,dt(i)?ft(i):r?T?"pos":"neg":T?"neg":"pos"),{stroke:A,strokeWidth:P}=_&&"hatched"===C.fillpattern?{stroke:C.stroke,strokeWidth:1}:gt(C),D=a||ut(o,!1,l,h),W=_?.25*u.emPx/2:0,B=T?v+W:v-W,F=R?w:S,Y=R?w+g+M:S,H=T?B+Y+E:B-Y-E,j=T?"start":"end";return t("svg",{width:m,height:s,class:"cell-bar-chart absolute-variance",style:{overflow:"visible"}},t(ct,{styles:u}),!_&&t("line",{x1:v,y1:0,x2:v,y2:s,stroke:lt,"stroke-width":1*d}),F>0&&t("rect",{x:T?B:B-F,y:G,width:F,height:U,fill:x,stroke:A,"stroke-width":P*d}),R&&M>0&&t("rect",{x:T?B+w+g:B-w-g-M,y:G,width:M,height:U,fill:x,stroke:A,"stroke-width":P*d}),R&&function(e,o,i,n,s){const r=e+o/2,a=.35*o,l=n/3,h=.3*o;let c=`M ${r-a} ${i}`;for(let t=0;t<3;t++)c+=` L ${r-a-h} ${i+l*(t+.5)} L ${r-a} ${i+l*(t+1)}`;let u=`M ${r+a} ${i}`;for(let t=0;t<3;t++)u+=` L ${r+a+h} ${i+l*(t+.5)} L ${r+a} ${i+l*(t+1)}`;return[t("rect",{x:e,y:i-1,width:o,height:n+2,fill:"#ffffff"}),t("path",{d:c,fill:"none",stroke:"#000000","stroke-width":1*s}),t("path",{d:u,fill:"none",stroke:"#000000","stroke-width":1*s})]}(T?B+w:B-w-g,g,G,U,d),_&&t($t,{x:v,height:s,look:_,styles:u}),t("text",{x:H,y:s/2,dy:"0.35em","text-anchor":j,fill:u.fontColor,"font-size":f,"font-family":u.fontFamily},D))},wt=e=>{var o,i;const{value:n,scenario:s,columnStats:r,height:a,isPositiveGood:l,formattedValue:h,measureScale:c,locale:u,percentDigits:d,columnWidthEm:f=10,styles:p=at}=e,$=p.scaleFactor,m=p.fontSize,v=r.min<0,g=r.max>0,{totalWidth:b,maxPinLength:w,axisX:E,labelGap:S}=rt(f,p.emPx,v,g),R=a/2,y=100*Math.abs(n)*p.percentageScaling*m,O=y>w,M=n>0||0===n&&(g||!v),N=M?1:-1,U=E+N*Math.min(y,w),G=mt(s,n,l,p),T=pt(s,p),_=null!==(o=null==T?void 0:T.minuend)&&void 0!==o?o:p.scenarios.ac,L=10*$,k=h||ut(n,!0,c,u,d),C=E+N*(w+L/2),x=C-N*L,A=O&&w-L/2-S>=.6*k.length*m;let P=U+N*(L/2+S);O&&(P=A?x-N*S:C+N*S);const D=M!==A;return t("svg",{width:b,height:a,class:"cell-bar-chart relative-variance",style:{overflow:"visible"}},t(ct,{styles:p}),T?t($t,{x:E,height:a,look:T,styles:p}):t("line",{x1:E,y1:0,x2:E,y2:a,stroke:lt,"stroke-width":1*$}),t("line",{x1:E,y1:R,x2:O?x:U,y2:R,stroke:G.fill,"stroke-width":3*$}),O?t("polygon",{points:`${C},${R} ${x},${R-L/2} ${x},${R+L/2}`,fill:G.fill}):t("rect",{x:U-L/2,y:R-L/2,width:L,height:L,fill:"outlined"===_.fillpattern?"#ffffff":vt(_,null!==(i=null==T?void 0:T.minuendSlot)&&void 0!==i?i:"ac"),stroke:_.stroke,"stroke-width":1*$}),t("text",Object.assign({x:P,y:a/2,dy:"0.35em","text-anchor":D?"start":"end",fill:p.fontColor,"font-size":m,"font-style":"italic","font-family":p.fontFamily},A?{stroke:"#ffffff","stroke-width":3*$,"paint-order":"stroke"}:{}),k))},Et=e=>{const{value:o,columnStats:i,isRelative:n,styles:s=at}=e;return null==o||isNaN(o)||!i||0===i.absMax?t("span",{class:"bar-chart-empty",style:{color:s.fontColor,fontStyle:"italic"}},"-"):t(n?wt:bt,Object.assign({},e))},St=e=>{const{value:o,scenario:i,height:n,measureScale:s,locale:r,columnWidthEm:a=10,styles:l=at,waterfall:h}=e,c=l.scaleFactor,u=l.fontSize,d=h.max-h.min;if(null==o||isNaN(o)||d<=0)return t("span",{class:"bar-chart-empty",style:{color:l.fontColor,fontStyle:"italic"}},"-");const{totalWidth:f,labelAreaWidth:p,barAreaWidth:$,labelGap:m}=function(t,e){const o=it(t,e),i=Math.min(2.85*e,o/4);return{totalWidth:o,labelAreaWidth:i,barAreaWidth:o-2*i,labelGap:.3*e}}(a,l.emPx),v=$/d,g=t=>p+(t-h.min)*v,b=2*c,w=n-2*b,E=b,S=g(0),R=g(h.start),y=g(h.end),O=Math.min(R,y),M=Math.abs(y-R),N=mt(i,o,!1,l),U=vt(N,ft(i)),{stroke:G,strokeWidth:T}=gt(N),_=ut(o,"partof"===h.kind,s,r).replace(/^\+/,""),L=y<R,k=L?O-m:O+M+m,C=L?"end":"start";return t("svg",{width:f,height:n,class:"cell-bar-chart waterfall-bar",style:{overflow:"visible"}},t(ct,{styles:l}),t("line",{x1:S,y1:0,x2:S,y2:n,stroke:lt,"stroke-width":1*c}),void 0!==h.parentStart&&void 0!==h.parentEnd&&t("line",{x1:g(h.parentStart),y1:0,x2:g(h.parentStart),y2:n,stroke:lt,"stroke-width":1*c,"stroke-dasharray":`${2*c},${2*c}`}),void 0!==h.parentStart&&void 0!==h.parentEnd&&t("line",{x1:g(h.parentEnd),y1:0,x2:g(h.parentEnd),y2:n,stroke:lt,"stroke-width":1*c,"stroke-dasharray":`${2*c},${2*c}`}),M>0&&t("rect",{x:O,y:E,width:M,height:w,fill:U,stroke:G,"stroke-width":T*c}),t("text",{x:k,y:n/2,dy:"0.35em","text-anchor":C,fill:l.fontColor,"font-size":u,"font-family":l.fontFamily},_))},Rt=`IFNULL(${p.ROWGROUP}, '')`;class yt{constructor(t){this.groups=[p.CATEGORY,p.CATEGORYINDEX],I.OPT!==t.type&&I.OPTNOTOTAL!==t.type||this.groups.unshift(p.OPERATION),t.grouped&&(this.groups.push(p.ROWGROUP),this.groups.push(p.ROWGROUPINDEX))}toString(){return this.groups.map((t=>t===p.ROWGROUP?Rt:t)).toString()}select(){return this.groups.map((t=>t===p.ROWGROUP?`${Rt} as ${t}`:t)).toString()}noCategory(){return this.groups.filter((t=>t!==p.CATEGORY))}toArray(){return this.groups}}class Ot{constructor(t,e){this.hasPartOf=!1,this.params=[],this.sortSelect="",this.hasBlankRowGroup=!1,this.config=t,this.i18n=e}execute(t,e){var o;this.db=t,this.fromExpr=e;for(const t of[...this.config.scenarios,...this.config.categoryThereOf.keys()])if(!_.test(t))throw new Error(`invalid identifier "${t}"`);const i=[],n=[],s=[],r=this.config.scenarios.map((t=>this.translateScenarioSQL(t,!1,this.config.type))).toString(),a=this.config.scenarios.map((t=>this.translateScenarioSQL(t,!0,this.config.type))).toString(),l=this.getRelativeScenarios(),h=this.config.attributes.map((t=>this.translateAttributeSQL(t))).toString(),c=new yt(this.config),u=this.config.interval===X?this.config.sortOrder:{hierarchy:this.config.sortOrder.hierarchy.map((t=>{var e,o;return null!==(o=null===(e=L(t))||void 0===e?void 0:e.column)&&void 0!==o?o:t})),direction:this.config.sortOrder.direction};let d=["",""];u.hierarchy.length>0&&(d=this.createOrderString(u)),this.hasPartOf=this.checkConfigForPartOf();const{hierarchy:f,direction:$}=u,m=f.filter((t=>t===p.ROWGROUP||t===p.ROWGROUPINDEX||t.toUpperCase()in b)),v=m.filter((t=>t.toUpperCase()in b)).map((t=>`, SUM(${t} * transformOperator(operation)) as ${t}`)).join(""),g=m.length>0?m.map((t=>`${t} ${$}`)).toString():`${p.ROWGROUPINDEX} asc`,w=t.exec(`SELECT COUNT(DISTINCT ${p.CATEGORY}) as ${p.TOTALROWCOUNT} ${this.config.grouped?`, ${Rt} as ${p.ROWGROUP}, FIRST(${p.ROWGROUPINDEX}) as ${p.ROWGROUPINDEX}${v}`:""}\n FROM ${e} ${this.config.grouped?`GROUP BY ${Rt} ORDER BY ${g}`:""}`);return 0===w.length||1===w.length&&0===(null!==(o=w[0][p.TOTALROWCOUNT])&&void 0!==o?o:0)&&!this.config.grouped?[]:(this.hasBlankRowGroup=this.config.grouped&&w.some((t=>""===t.rowGroup)),w.forEach((t=>{const e=this.config.grouped?""===t.rowGroup?`WHERE (${p.ROWGROUP} IS NULL OR ${p.ROWGROUP} = '')`:`WHERE ${p.ROWGROUP} = ${this.bind(t.rowGroup)}`:"";let o="";this.config.limit&&(o=`LIMIT ${this.config.limit}`),this.createGroupHeaderRow(t,i),this.createDataRow(i,t,c,r,h,e,d,o),this.createRestRow(t,i,c,r,e,d),this.createGroupSumRow(i,n,t,a,e,d)})),this.createTotalSumRow(i,n,a),i.forEach((t=>s.push(this.exec(t)))),this.detectNaNCells(this.config.scenarios,s),this.createThereOfDrillRows(r,h,d,s),this.createPartOfDrillRows(r,d,n,s),this.createIntervalColumns(s),this.createThereOfDrillColumns(this.config.categoryThereOf,s),this.calculateColumnGroupRest(s,this.config.categoryThereOf),this.calculateRelativeVariances(s,l),s)}detectNaNCells(t,e){e.forEach((e=>{e.map((e=>(t.forEach((t=>{const o=new f(t);!0===o.isValid?0!==e[o.base+"_cnt"]&&0!==e[o.delta+"_cnt"]||(e[t]=Number.NaN):0===e[t+"_cnt"]&&(e[t]=Number.NaN)})),e)))}))}createPartOfDrillRows(t,e,o,i){if(null==this.config.partOf||0===this.config.partOf.length||this.config.type===I.LIST)return;const n=this.createPartOfQuery(t,e);let s=[];const r=this.db,a=this.params;n.forEach((t=>{s.push(...this.exec(t))}));const l=this.exctractScenarioNames(t),h=[];o.forEach((function(t){h.push(...r.exec(t,a))}));const c=new Map;h.forEach((t=>c.set(t[p.ROWGROUP],t))),s=this.reduceResDrillByCategoryGroups(s,l),s.forEach((function(t){l.forEach((e=>{try{t[e]=t[e]/c.get(t[p.ROWGROUP])[e]}catch(o){console.error("DataQuery: partOf drill row calculation failed",e,o),t[e]=Number.NaN}}))})),this.injectDrillRowsToResultRows(s,i)}createRestRow(t,e,o,i,n,s){var r;if(t.totalRowCnt-this.config.limit>0&&0!==this.config.limit){const a=this.exctractScenarioNames(i).map((t=>`SUM(${t}) as ${t}`)).join(", "),l=I.OPT===this.config.type||I.OPTNOTOTAL===this.config.type?", CASE WHEN MAX(transformOperator(operation)) = -1 THEN '-' ELSE '+' END as restOperation":"";e.push(`SELECT ${p.ROWNR}, 1 as ${p.ROWGROUPINDEX} , 'ENTRY' as ${p.TYPE}, 'NO_GROUP' as ${p.ROWGROUP}, ${this.bind(String(null!==(r=t.rowGroup)&&void 0!==r?r:""))} as restRowGroup, 'REST' as ${p.CATEGORY}${l} ${a.length>0?", "+a:""} FROM (SELECT ROWNUM() AS ${p.ROWNR}, ${e.length} as ${p.ROWGROUPINDEX} , 'ENTRY' as ${p.TYPE}, ${this.bind(String(t.rowGroup||"NO_GROUP"))} as ${p.ROWGROUP}, ${o.select()} ${i.length>0?",".concat(i):""}${this.sortSelect} FROM ${this.fromExpr} ${n} GROUP BY ${o} ORDER BY ${s[0]}) t WHERE t.rowNr > ${this.config.limit}`)}}createDataRow(t,e,o,i,n,s,r,a){t.push(`SELECT ROWNUM() AS ${p.ROWNR},\n ${t.length} as ${p.ROWGROUPINDEX},\n 'ENTRY' as ${p.TYPE},\n ${this.bind(String(e.rowGroup||"NO_GROUP"))} as ${p.ROWGROUP},\n '${p.CATEGORYINDEX}',\n ${o.select()} ${i.length>0?",".concat(i):""} ${n.length>0?",".concat(n):""}${this.sortSelect}\n FROM ${this.fromExpr} ${s}\n GROUP BY ${o}\n ORDER BY ${r[0]} ${a}`)}createGroupHeaderRow(t,e){if(!0===this.config.grouped){const o=this.bind(String(t.rowGroup)),i=""===t.rowGroup?this.bind("-"):o;e.push(`SELECT ROWNUM() AS ${p.ROWNR},\n ${e.length} as ${p.ROWGROUPINDEX},\n 'GROUPHEAD' as ${p.TYPE},\n ${o} as ${p.ROWGROUP} ${this.config.showGroupTitle?`,${i} as ${p.CATEGORY}`:""}\n FROM ${this.fromExpr}\n GROUP BY '1'`)}}createGroupSumRow(t,e,o,i,n,s){if(!0===this.config.grouped&&(I.SUM===this.config.type||I.SUMNOTOTAL===this.config.type||I.OPT===this.config.type||I.OPTNOTOTAL===this.config.type)){const r=this.bind(String(o.rowGroup));t.push(`SELECT ${t.length} as ${p.ROWGROUPINDEX},\n '=' as ${p.OPERATION},\n ${r} as ${p.ROWGROUP},\n ROWNUM() AS ${p.ROWNR},\n 'GROUP_SUM' as ${p.TYPE} ${i.length>0?",".concat(i):""}\n FROM ${this.fromExpr} ${n}\n ORDER BY ${s[0]} `),e.push(`SELECT ${t.length} as ${p.ROWGROUPINDEX},\n '=' as ${p.OPERATION},\n ${r} as ${p.ROWGROUP},\n ROWNUM() AS ${p.ROWNR},\n 'GROUP_SUM' as ${p.TYPE} ${i.length>0?",".concat(i):""}\n FROM ${this.fromExpr} ${n}\n ORDER BY ${s[0]} `)}}createTotalSumRow(t,e,o){var i;if(I.SUM===this.config.type||I.OPT===this.config.type){const e=(null===(i=this.config.title)||void 0===i?void 0:i.trim())||"SUM_TOTAL",n=this.hasPartOf&&!1===this.config.grouped&&"SUM_TOTAL"!==e?`${this.i18n.get("SUM_TOTAL")||"SUM_TOTAL"} ${e}`:e;t.push(`SELECT ${t.length} as ${p.ROWGROUPINDEX},\n ${this.bind(n)} as ${p.ROWGROUP},\n '=' as ${p.OPERATION},\n 'SUM' as ${p.TYPE} ${o.length>0?",".concat(o):""}\n FROM ${this.fromExpr} `)}e.push(`SELECT ${t.length} as ${p.ROWGROUPINDEX},\n 'SUM_TOTAL' as ${p.ROWGROUP},\n '=' as ${p.OPERATION},\n 'SUM' as ${p.TYPE} ${o.length>0?",".concat(o):""}\n FROM ${this.fromExpr} `)}reduceResDrillByCategoryGroups(t,e){const o=new Map;return t.forEach((function(t){const i=t.rowNr+t.rowGroup+t.type+t.category;if(o.has(i)){const n=o.get(i);e.forEach((e=>{try{n[e]+=t[e]}catch(t){console.error("DataQuery: drill row aggregation failed",e,t)}}))}else o.set(i,t)})),[...o.values()]}injectDrillRowsToResultRows(t,e){const o=new Map;if(!0===this.config.grouped)t.forEach((function(t){e.forEach((function(e){const i=e.findIndex((e=>e.category===t.category&&e.rowGroup===t.rowGroup));if(i>=0){if(o.has(`${t.category}_${t.rowGroup}`)){const e=o.get(`${t.category}_${t.rowGroup}`)||0;o.set(`${t.category}_${t.rowGroup}`,e+1)}else o.set(`${t.category}_${t.rowGroup}`,1);t[p.ROWNR]=o.get(`${t.category}_${t.rowGroup}`),e.splice(i+t[p.ROWNR],0,t)}}))}));else{const i=this.findDuplicateSubCategories(t);t.forEach((function(t){e.forEach((function(e){const n=e.findIndex((e=>null!=e.category&&e.category===t.category));if(n>=0){if(o.has(`${t.category}`)){const e=o.get(`${t.category}`)||0;o.set(`${t.category}`,e+1)}else o.set(`${t.category}`,1);null!=t.rowGroup&&""!==t.rowGroup&&i.includes(`${t.category}##${t.subCategory}`)&&(t.rawSubCategory=t.subCategory,t.subCategory=`${t.subCategory} (${t.rowGroup})`),e.splice(n+t[p.ROWNR],0,t)}}))}))}}createThereOfDrillRows(t,e,o,i){if(void 0===this.config.thereOf||0===this.config.thereOf.length)return;const n=[],s=[];this.config.thereOf.forEach((i=>{let s=!0,r="1 <> 1 OR ( ";null!=i.category&&0!==i.category.length&&i.category.trim()&&(r+=` ${p.CATEGORY} = ${this.bind(i.category)}`,s=!1),null!=i.rowGroup&&0!==i.rowGroup.length&&i.rowGroup.trim()&&(r+=` ${s?"":"AND"} ${p.ROWGROUP} = ${this.bind(i.rowGroup)}`,s=!1),null!=i.subCategory&&0!==i.subCategory.length&&i.subCategory.trim()&&(r+=` ${s?"":"AND"} ${p.SUBCATEGORY} = ${this.bind(i.subCategory)}`),r+=")",n.push(`SELECT ROWNUM() AS ${p.ROWNR},\n null as operation,\n 'DRILLELEMENT' as ${p.TYPE},\n ${p.CATEGORY},\n ${p.SUBCATEGORY},\n ${this.drillRowGroup} as ${p.ROWGROUP},\n ${t} ${e.length>0?",".concat(e):""}${this.sortSelect}\n FROM ${this.fromExpr}\n WHERE ${r}\n GROUP BY ${this.drillRowGroup}, ${p.CATEGORY}, ${p.SUBCATEGORY}\n ORDER BY ${o[1]}`)})),n.forEach((t=>{s.push(...this.exec(t))})),this.injectDrillRowsToResultRows(s,i)}calculateRelativeVariances(t,e){t.forEach((t=>{t.forEach((t=>{"GROUPHEAD"!==t[p.TYPE]&&e.forEach(((e,o)=>{var i;t[o]=null!==(i=M(t[o],t[e]))&&void 0!==i?i:O}))}))}))}calculateColumnGroupRest(t,e){if(null==e||0===e.size)return;const o=new Map,i=new Map;e.forEach(((t,e)=>{const n=t,s=[];for(const t of n)s.push(`${e}##${t.name}`);o.set(e,s),i.set(`${e}##REST`,!1)})),t.forEach((t=>{t.forEach((t=>{"GROUPHEAD"!==t[p.TYPE]&&o.forEach(((e,o)=>{let n=0;e.forEach((e=>{void 0!==t[e]&&(n+=t[e])})),t[`${o}##REST`]=t[o]-n,0!==t[`${o}##REST`]&&i.set(`${o}##REST`,!0)}))}))}));const n=Array.from(i.entries()).filter((([t,e])=>!e)).map((([t])=>t));t.forEach((t=>{t.forEach((t=>{for(const e of n)delete t[e]}))}))}createIntervalColumns(t){var e,o,i,n,s;if(this.config.interval===V||this.config.categoryThereOf.size>0||0===this.config.scenarios.length)return;const r="##",a=`(SELECT *, ${q(this.config.interval)} as __interval FROM ${this.fromExpr}) as p`,l=this.config.scenarios.map((t=>this.translateScenarioSQL(t,!1,this.config.type))).toString(),h=this.config.scenarios.map((t=>this.translateScenarioSQL(t,!0,this.config.type))).toString(),c=[...new Set(this.exctractScenarioNames(l))],u=this.getRelativeScenarios(),d=new yt(this.config),$=I.OPT===this.config.type||I.OPTNOTOTAL===this.config.type,m=this.config.grouped&&(I.SUM===this.config.type||I.SUMNOTOTAL===this.config.type||I.OPT===this.config.type||I.OPTNOTOTAL===this.config.type),v=this.checkConfigForPartOf()&&this.config.type!==I.LIST,g=t=>this.exec(t),b=t=>(this.config.scenarios.forEach((e=>{const o=new f(e);!0===o.isValid?0!==t[o.base+"_cnt"]&&0!==t[o.delta+"_cnt"]||(t[e]=Number.NaN):0===t[e+"_cnt"]&&(t[e]=Number.NaN)})),u.forEach(((e,o)=>{var i;t[o]=null!==(i=M(t[o],t[e]))&&void 0!==i?i:O})),t),w=(t,e,o)=>{for(const i of this.config.scenarios)t[i+r+o]=e[i]},E=g(`SELECT ${d.select()}, __interval ${l.length>0?",".concat(l):""}\n FROM ${a}\n GROUP BY ${d}, __interval`);if(this.config.limit>0)for(let i=0;i<t.length;i++){const n=t[i].find((t=>"ENTRY"===t.type&&"REST"===t.category));if(!n)continue;let s;for(let e=i-1;e>=0&&!s;e--){const o=t[e].filter((t=>"ENTRY"===t.type&&"REST"!==t.category));o.length>0&&(s=o)}if(!s)continue;const r=new Set(s.map((t=>t.category))),a=s[0].rowGroup,l=new Map;for(const t of E){if(this.config.grouped&&t.rowGroup!==a)continue;if(r.has(t.category))continue;const i=K(t.__interval);let n=l.get(i);n||(n={},l.set(i,n));for(const i of c)n[i]=(null!==(e=n[i])&&void 0!==e?e:0)+(null!==(o=t[i])&&void 0!==o?o:0)}l.forEach(((t,e)=>{w(n,b(t),e)}))}for(const e of E){const o=K(e.__interval);b(e);for(const i of t)for(const t of i)"ENTRY"===t.type&&"REST"!==t.category&&t.category===e.category&&(this.config.grouped&&t.rowGroup!==e.rowGroup||$&&t.operation!==e.operation||w(t,e,o))}const S=m||v&&this.config.grouped?g(`SELECT ${Rt} as ${p.ROWGROUP}, __interval ${h.length>0?",".concat(h):""}\n FROM ${a}\n GROUP BY ${Rt}, __interval`):[],R=new Map;if(S.forEach((t=>R.set(`${t.rowGroup}${r}${K(t.__interval)}`,t))),m)for(const e of S){const o=K(e.__interval),i=b(Object.assign({},e));for(const n of t)for(const t of n)"GROUP_SUM"===t.type&&t.rowGroup===e.rowGroup&&w(t,i,o)}const y=I.SUM===this.config.type||I.OPT===this.config.type,N=y||v&&!this.config.grouped?g(`SELECT __interval ${h.length>0?",".concat(h):""}\n FROM ${a}\n GROUP BY __interval`):[],U=new Map;if(N.forEach((t=>U.set(K(t.__interval),t))),y)for(const e of N){const o=K(e.__interval),i=b(Object.assign({},e));for(const e of t)for(const t of e)"SUM"===t.type&&w(t,i,o)}if(null!=this.config.thereOf&&this.config.thereOf.length>0){const e=[];this.config.thereOf.forEach((t=>{e.push(...g(`SELECT ${this.drillRowGroup} as ${p.ROWGROUP}, ${p.CATEGORY}, ${p.SUBCATEGORY}, __interval ${l.length>0?",".concat(l):""}\n FROM ${a}\n WHERE ${this.createThereOfWhereClause(t)}\n GROUP BY ${this.drillRowGroup}, ${p.CATEGORY}, ${p.SUBCATEGORY}, __interval`))}));for(const o of e){const e=K(o.__interval);b(o);for(const i of t)for(const t of i)"DRILLELEMENT"===t.type&&t.category===o.category&&t.rowGroup===o.rowGroup&&(t.subCategory!==o.subCategory&&t.subCategory!==`${o.subCategory} (${o.rowGroup})`||w(t,o,e))}}if(v){let e="1 <> 1 ";null===(i=this.config.partOf)||void 0===i||i.forEach((t=>{e+=`OR (${p.CATEGORY} = ${this.bind(t.category)}`,null!=t.rowGroup&&0!==t.rowGroup.length&&t.rowGroup.trim()&&(e+=`and ${p.ROWGROUP} = ${this.bind(t.rowGroup)}`),e+=")"}));const o=g(`SELECT ${p.CATEGORY}, ${this.config.grouped?`${p.ROWGROUP}`:`'SUM_TOTAL' as ${p.ROWGROUP}`}, __interval ${l.length>0?",".concat(l):""}\n FROM ${a}\n WHERE ${e}\n GROUP BY ${p.ROWGROUP}, ${p.CATEGORY}, __interval`),h=new Map;for(const t of o){const e=`${t.rowGroup}${r}${t.category}${r}${K(t.__interval)}`,o=h.get(e);if(o)for(const e of c)o[e]=(null!==(n=o[e])&&void 0!==n?n:0)+(null!==(s=t[e])&&void 0!==s?s:0);else h.set(e,t)}h.forEach((e=>{const o=K(e.__interval),i=this.config.grouped?R.get(`${e.rowGroup}${r}${o}`):U.get(o);for(const t of c)e[t]=e[t]/(i?i[t]:Number.NaN);b(e);for(const i of t)for(const t of i)"PARTELEMENT"===t.type&&t.category===e.category&&t.rowGroup===e.rowGroup&&w(t,e,o)}))}}createThereOfWhereClause(t){let e=!0,o="1 <> 1 OR ( ";return null!=t.category&&0!==t.category.length&&t.category.trim()&&(o+=` ${p.CATEGORY} = ${this.bind(t.category)}`,e=!1),null!=t.rowGroup&&0!==t.rowGroup.length&&t.rowGroup.trim()&&(o+=` ${e?"":"AND"} ${p.ROWGROUP} = ${this.bind(t.rowGroup)}`,e=!1),null!=t.subCategory&&0!==t.subCategory.length&&t.subCategory.trim()&&(o+=` ${e?"":"AND"} ${p.SUBCATEGORY} = ${this.bind(t.subCategory)}`),o+")"}getRelativeScenarios(){const t=new Map;return this.config.scenarios.forEach((e=>{const o=this.createRelativeScenario(e);null!=o&&t.set(o.key,o.value)})),t}translateScenarioSQL(t,e,o){const i=new f(t);if(I.OPT===o||I.OPTNOTOTAL===o){if(i.isValid){const o=e?" * transformOperator(operation)":"",n=e?`SUM((${i.base} - ${i.delta})${o}) as ${t}`:`SUM(${i.base} - ${i.delta}) as ${t}`;return"dr"===i.type?`${n}, SUM(${i.delta}${o}) as dr_${i.delta}`:n}return e?`SUM(${t} * transformOperator(operation)) as ${t}, COUNT(ISNULL(${t})) as ${t}_cnt`:`SUM(${t}) as ${t}, COUNT(ISNULL(${t})) as ${t}_cnt`}return i.isValid?"dr"===i.type?`SUM((${i.base} * transformOperator(operation)) - (${i.delta} * transformOperator(operation))) as ${t}, SUM(${i.delta} * transformOperator(operation)) as dr_${i.delta}`:`SUM((${i.base} * transformOperator(operation))- (${i.delta} * transformOperator(operation))) as ${t}`:`SUM(${t} * transformOperator(operation)) as ${t}, COUNT(ISNULL(${t})) as ${t}_cnt`}translateAttributeSQL(t){const e=`[${t.arg}]`,o=/^(ac|pp|fc|pl)[1-4]$/.test(t.arg)&&this.config.type!==I.OPT&&this.config.type!==I.OPTNOTOTAL;switch(t.fn){case"set":return`SETAGG(${e}) as ${t.alias}`;case"first":return`FIRST(${e}) as ${t.alias}`;case"last":return`LAST(${e}) as ${t.alias}`;case"min":return`MIN(${e}) as ${t.alias}`;case"max":return`MAX(${e}) as ${t.alias}`;case"avg":return o?`AVG(${e} * transformOperator(operation)) as ${t.alias}`:`AVG(${e}) as ${t.alias}`;case"sum":return o?`SUM(${e} * transformOperator(operation)) as ${t.alias}`:`SUM(${e}) as ${t.alias}`;case"lit":{const e=t.arg;return`${this.bind(""===e||Number.isNaN(Number(e))?e:Number(e))} as ${t.alias}`}}}get drillRowGroup(){return this.config.grouped?Rt:p.ROWGROUP}exec(t){const e=this.db.exec(t,this.params);return this.config.grouped&&e.forEach((t=>t.rowGroup=null==t.rowGroup?"":String(t.rowGroup))),e}bind(t){return`$${this.params.push(t)-1} `}createOrderString(t){const e=z.ASC===t.direction?z.DESC:z.ASC,o=new Map;t.hierarchy.forEach(((t,e)=>{const i=L(t),n=null==i?void 0:i.bucket;("variance"===(null==i?void 0:i.kind)||"scenario"===(null==i?void 0:i.kind)&&void 0!==n)&&o.set(e,this.translateSortKeySQL(i,n,e))})),this.sortSelect=[...o.values()].map((t=>`, ${t}`)).join("");const i=(t,e,i)=>o.has(e)?`__sortnull${e} asc, __sort${e} ${i}`:`${t} ${i}`;return[t.hierarchy.map(((e,o)=>i(e,o,t.direction))).toString(),t.hierarchy.map(((t,o)=>i(t,o,e))).toString()]}translateSortKeySQL(t,e,o){const i=I.OPT===this.config.type||I.OPTNOTOTAL===this.config.type?"":" * transformOperator(operation)",n=void 0===e?"":`TRIM(CAST(${q(X)} AS STRING)) = ${this.bind(e)}`,s=t=>`SUM(${n?`(CASE WHEN ${n} THEN ${t} ELSE 0 END)`:t}${i})`,r=t=>`SUM(CASE WHEN ${n?`${n} AND `:""}${t} IS NOT NULL THEN 1 ELSE 0 END) = 0`;if("scenario"===t.kind)return`${s(t.column)} as __sort${o}, CASE WHEN ${r(t.column)} THEN 1 ELSE 0 END as __sortnull${o}`;const a=`(${s(t.base)} - ${s(t.delta)})`;let l=a,h=`${r(t.base)} OR ${r(t.delta)}`;if("dr"===t.type){const e=s(t.delta),o=`ABS(${e}) <= ABS(${a}) * 0.000000001`;l=`CASE WHEN ${o} THEN 0 ELSE ${a} / ABS(${e}) END`,h+=` OR ${o}`}return`${l} as __sort${o}, CASE WHEN ${h} THEN 1 ELSE 0 END as __sortnull${o}`}createRelativeScenario(t){const e=new f(t);return e.isValid&&"dr"===e.type?{key:`${t}`,value:`dr_${e.delta}`}:null}exctractScenarioNames(t){const e=[];return t.split(",").forEach((t=>t.length>=2?e.push(t.split("as")[1].trim()):null)),e}findDuplicateSubCategories(t){const e=t.map((t=>({count:1,subCategory:`${t.category}##${t.subCategory}`}))).reduce(((t,e)=>(t[e.subCategory]=(t[e.subCategory]||0)+e.count,t)),{});return Object.keys(e).filter((t=>e[t]>1))}createPartOfQuery(t,e){var o;const i=[];let n="1 <> 1 ",s=` ${this.drillRowGroup} as ${p.ROWGROUP}`,r="ROWNUM()";return null===(o=this.config.partOf)||void 0===o||o.forEach((t=>{n+=`OR (${p.CATEGORY} = ${this.bind(t.category)}`,null!=t.rowGroup&&0!==t.rowGroup.length&&t.rowGroup.trim()&&(n+=`and ${p.ROWGROUP} = ${this.bind(t.rowGroup)}`),!1===this.config.grouped&&(s=` 'SUM_TOTAL' as ${p.ROWGROUP} `,r="1"),n+=")"})),i.push(`SELECT ${r} AS ${p.ROWNR},\n 'PARTELEMENT' as ${p.TYPE},\n ${p.CATEGORY},\n ${s},\n ${t}${this.sortSelect}\n FROM ${this.fromExpr}\n WHERE ${n}\n GROUP BY ${this.drillRowGroup}, ${p.CATEGORY}, ${p.TYPE}\n ORDER BY ${e[1]}`),i}checkConfigForPartOf(){return null!=this.config.partOf&&0!==this.config.partOf.length}createThereOfDrillColumns(t,e){if(null==t||0===t.size)return;const o=[],i=[],n=this.fromExpr;t.forEach(((t,e)=>{let i="1 <> 1 ";t.forEach((t=>{i+=` or columnGroup = ${this.bind(String(t.name))} `})),o.push(`SELECT 'ENTRY' as rowlevel,\n 'COLUMNGROUP' as columnlevel,\n rowGroup,\n category,\n columnGroup,\n '${e}' as scenario,\n sum(${e} * transformOperator(operation)) as val\n FROM ${n}\n WHERE ${i}\n GROUP BY rowlevel, rowGroup, category, columnGroup, scenario`),o.push(`SELECT 'ENTRY' as rowlevel,\n 'SUBGROUP' as columnlevel,\n rowGroup,\n category,\n columnGroup,\n columnSubGroup,\n '${e}' as scenario,\n sum(${e} * transformOperator(operation)) as val\n FROM ${n}\n WHERE ${i}\n GROUP BY rowlevel, rowGroup, category, columnGroup, columnSubGroup, scenario`),o.push(`SELECT 'DRILLELEMENT' as rowlevel,\n 'COLUMNGROUP' as columnlevel,\n rowGroup,\n category,\n subCategory,\n columnGroup,\n '${e}' as scenario,\n sum(${e} * transformOperator(operation)) as val\n FROM ${n}\n WHERE ${i}\n GROUP BY rowlevel, rowGroup, category, subCategory, columnGroup, scenario`),o.push(`SELECT 'DRILLELEMENT' as rowlevel,\n 'SUBGROUP' as columnlevel,\n rowGroup,\n category,\n subCategory,\n columnGroup,\n columnSubGroup,\n '${e}' as scenario,\n sum(${e} * transformOperator(operation)) as val\n FROM ${n}\n WHERE ${i}\n GROUP BY rowlevel, rowGroup, category, subCategory, columnGroup, columnSubGroup, scenario`),o.push(`SELECT 'GROUP_SUM' as rowlevel,\n 'COLUMNGROUP' as columnlevel,\n rowGroup,\n columnGroup,\n '${e}' as scenario,\n sum(${e} * transformOperator(operation)) as val\n FROM ${n}\n WHERE ${i}\n GROUP BY rowlevel, rowGroup, columnGroup, scenario`),o.push(`SELECT 'GROUP_SUM' as rowlevel,\n 'SUBGROUP' as columnlevel,\n rowGroup,\n columnGroup,\n columnSubGroup,\n '${e}' as scenario,\n sum(${e} * transformOperator(operation)) as val\n FROM ${n}\n WHERE ${i}\n GROUP BY rowlevel, rowGroup, columnGroup, columnSubGroup, scenario`),o.push(`SELECT 'SUM' as rowlevel,\n 'COLUMNGROUP' as columnlevel,\n columnGroup,\n '${e}' as scenario,\n sum(${e} * transformOperator(operation)) as val\n FROM ${n}\n WHERE ${i}\n GROUP BY rowlevel, columnGroup, scenario`),o.push(`SELECT 'SUM' as rowlevel,\n 'SUBGROUP' as columnlevel,\n columnGroup,\n columnSubGroup,\n '${e}' as scenario,\n sum(${e} * transformOperator(operation)) as val\n FROM ${n}\n WHERE ${i}\n GROUP BY rowlevel, columnGroup, columnSubGroup, scenario`)}));for(const t of o)i.push(...this.db.exec(t,this.params));this.injectDrillColumnsToResultRows(i,e)}injectDrillColumnsToResultRows(t,e){const o="##";for(const i of t)for(const t of e)for(const e of t)if(e.type===i.rowlevel)if("ENTRY"===i.rowlevel)"COLUMNGROUP"===i.columnlevel&&e.category===i.category?e[i.scenario+o+i.columnGroup]=i.val:"SUBGROUP"===i.columnlevel&&e.category===i.category&&(e[i.scenario+o+i.columnGroup+o+i.columnSubGroup]=i.val);else if("DRILLELEMENT"===i.rowlevel){if(!this.config.grouped&&e.rowGroup!==i.rowGroup)continue;"COLUMNGROUP"===i.columnlevel&&e.category===i.category&&e.subCategory===i.subCategory?e[i.scenario+o+i.columnGroup]=i.val:"SUBGROUP"===i.columnlevel&&e.category===i.category&&e.subCategory===i.subCategory?e[i.scenario+o+i.columnGroup+o+i.columnSubGroup]=i.val:"COLUMNGROUP"===i.columnlevel&&e.category===i.category&&e.subCategory===`${i.subCategory} (${i.rowGroup})`?e[i.scenario+o+i.columnGroup]=i.val:"SUBGROUP"===i.columnlevel&&e.category===i.category&&e.subCategory===`${i.subCategory} (${i.rowGroup})`&&(e[i.scenario+o+i.columnGroup+o+i.columnSubGroup]=i.val)}else("SUM"===i.rowlevel||"GROUP_SUM"===i.rowlevel)&&("COLUMNGROUP"===i.columnlevel&&e.category===i.category&&e.subCategory===i.subCategory&&(e[i.scenario+o+i.columnGroup]=i.val),"SUBGROUP"===i.columnlevel&&e.category===i.category&&e.subCategory===i.subCategory&&(e[i.scenario+o+i.columnGroup+o+i.columnSubGroup]=i.val))}}class Mt{constructor(){this.geometry=new Map}set(t,e,o){let i=this.geometry.get(t);i||(i=new Map,this.geometry.set(t,i)),i.set(e,o)}get(t,e){var o;return null===(o=this.geometry.get(t))||void 0===o?void 0:o.get(e)}}function Nt(t,e,o){const i=t[e];if(null==i)return null;const n=Number(i);return isNaN(n)?null:o!==I.OPT&&o!==I.OPTNOTOTAL||t[p.TYPE]!==Q.ENTRY||"-"!==t[p.OPERATION]?n:-n}class Ut{constructor(t){this.ruleSet=t,this.normalizedHeader=[],this.attributesByAlias=new Map,this.hasBlankRowGroup=!1,this.dateBuckets=!1,this.unsignedEntries=!1}underlineClass(t){return this.ruleSet&&/^(ac|pp|fc|pl)[1-4]$/.test(t)?$(this.ruleSet.getScenarioColorIndex(t))+t.slice(2):null}getNormalizedHeader(){return this.normalizedHeader}createHeader(t,e,o,i,n,s,r=[]){const a=[];this.attributesByAlias=new Map(r.map((t=>[t.alias,t]))),this.normalizedHeader=this.normalizeHeader(t,e,r);const l=this.normalizedHeader.some((t=>void 0!==t.bucket));l&&a.push(this.createIntervalBandRow());const h=new et(l?1:0,0,Q.HEADER),c=new et(l?2:1,0,Q.SEPERATORLINE);for(const t of this.normalizedHeader){const e=this.attributesByAlias.get(t.name);h.createElement(e?o.get(e.label)||e.label:d.translateScenarioLabel(t.name,o),t.type,this.createColumnType(t),null,this.setHeaderPrefix(t,o,i,n,s),null,null,null,null),c.createElement(null,t.type,this.createColumnType(t),null,null,this.underlineClass(t.type),null,null,null)}return a.push(h),a.push(c),a}createIntervalBandRow(){const t=new et(0,0,Q.HEADER);let e=0;for(;e<this.normalizedHeader.length;){const o=this.normalizedHeader[e];if(void 0===o.bucket){t.createElement(null,o.type,"filler",null,null,null,null,null,null),e+=1;continue}let i=1;for(;e+i<this.normalizedHeader.length&&this.normalizedHeader[e+i].bucket===o.bucket;)i+=1;t.createElement(o.bucketLabel,o.type,"intervalGroup",null,null,null,null,null,null,!1,void 0,i),e+=i}return t}setHeaderPrefix(t,e,o,i,n){let s="";return"category"===t.name&&n&&(0===o.prefix.length&&0===i.length||(s=d.translateScenarioLabel("in",e)+" "+o.prefix+i)),t.order&&(s+=d.translateScenarioLabel("ORDER_"+t.order,e)),s}normalizeHeader(t,e,o){let i=[{name:p.CATEGORY,group:p.CATEGORY,type:p.CATEGORY,order:void 0}];I.OPT!==t&&I.OPTNOTOTAL!==t||(i=[{name:p.OPERATION,group:p.OPERATION,type:p.OPERATION,order:void 0},{name:p.CATEGORY,group:p.CATEGORY,type:p.CATEGORY,order:void 0}]);const n=o.map((t=>({name:t.alias,group:t.alias,type:t.alias,order:void 0})));return[...i,...n,...e]}createBodyRows(t,e,o,i){var n;const s=[];let r=-1;const a=new Ot(t,e);var l;this.dateBuckets=(l=t.interval)!==V&&l!==X,this.unsignedEntries=I.OPT===t.type||I.OPTNOTOTAL===t.type;const h=a.execute(o,i);this.hasBlankRowGroup=a.hasBlankRowGroup;const c=this.calculateColumnStatistics(h,t.barColumns,t.interval!==V),u=(null!==(n=t.barColumns)&&void 0!==n?n:[]).filter((t=>t.toUpperCase().trim()in b)),d=u.length>0&&t.interval===V&&0===t.categoryThereOf.size&&function(t){for(const e of t)for(const t of e){const e=t[p.TYPE];if(e===Q.SUM||e===Q.GROUPSUM||e===Q.DRILLELEMENT||e===Q.PARTELEMENT)return!0}return!1}(h)?function(t,e,o){const i=new Mt;for(const n of e){let e,s=0,r=0;const a=[],l=(t,e)=>{a.push(e),i.set(t,n,e)};for(const i of t)for(const t of i){const i=t[p.TYPE];if(i===Q.GROUPHEAD){e=void 0;continue}const a=Nt(t,n,o);if(i===Q.ENTRY){if(null===a){e=void 0;continue}l(t,{start:s,end:s+a,min:0,max:0,kind:"cascade"}),e={start:s,end:s+a},r=e.start,s+=a}else if(i===Q.SUM||i===Q.GROUPSUM){if(null===a){e=void 0;continue}l(t,{start:0,end:a,min:0,max:0,kind:"anchor"}),e={start:0,end:a},r=0,s=a}else if(i===Q.DRILLELEMENT){if(null===a||void 0===e)continue;const o=r+(Math.sign(e.end-e.start)||1)*Math.abs(a);l(t,{start:r,end:o,min:0,max:0,kind:"thereof",parentStart:e.start,parentEnd:e.end}),r=o}else if(i===Q.PARTELEMENT){if(null===a||void 0===e)continue;const o=r+a*(e.end-e.start);l(t,{start:r,end:o,min:0,max:0,kind:"partof",parentStart:e.start,parentEnd:e.end}),r=o}}let h=0,c=0;for(const t of a)h=Math.min(h,t.start,t.end),c=Math.max(c,t.start,t.end);for(const t of a)t.min=h,t.max=c}return i}(h,u,t.type):void 0;for(const o of h)r+=1,s.push(...this.createRow(t.i18n,e,t.scenariosUnitType,o,r,-1,t.categoryWidth,t.measureScale,t.barColumns,c,d));return s}calculateColumnStatistics(t,e,o=!1){const i=new Map;if(!e||0===e.length)return i;const n=new Map;for(const t of e)i.set(t,{min:1/0,max:-1/0,absMax:0,median:0}),n.set(t,[]);for(const s of t)for(const t of s){const s=t[p.TYPE];if(s!==Q.SUM&&s!==Q.GROUPSUM)for(const s of e){const e=o?this.extractIntervalColumnValues(t,s):[this.extractColumnValue(t,s)];for(const t of e)if(null!==t&&!isNaN(t)){const e=i.get(s);e.min=Math.min(e.min,t),e.max=Math.max(e.max,t),n.get(s).push(Math.abs(t))}}}for(const[t,e]of i){e.min!==1/0&&e.max!==-1/0||(e.min=0,e.max=0),e.absMax=Math.max(Math.abs(e.min),Math.abs(e.max));const o=n.get(t);if(o.length>0){o.sort(((t,e)=>t-e));const t=Math.floor(o.length/2);e.median=o.length%2==0?(o[t-1]+o[t])/2:o[t]}i.set(t,e)}return i}extractIntervalColumnValues(t,e){const o=e+"##",i=[];for(const e of Object.keys(t))if(e.startsWith(o)){const o=Number(t[e]);i.push(isNaN(o)?null:o)}return i}extractColumnValue(t,e){if(void 0!==t[e]){const o=Number(t[e]);return isNaN(o)?null:o}for(const o of Object.keys(t))if(o===e||o.endsWith("##"+e)||o===e+"##"+e){const e=Number(t[o]);if(!isNaN(e))return e}return null}createRow(t,e,o,i,n,s,r,a,h,c,u){var d,$,m;const v=[];let g;for(const b of i){const w=b[p.ROWGROUP],E=""===w?"-":w,S=b[p.SUBCATEGORY],R=b[p.TYPE],y=b[p.ROWNR]>=2;g=null!==($=null!==(d=b.operation)&&void 0!==d?d:b.restOperation)&&void 0!==$?$:g;const O=this.createDetailRow(R,s+=1,n,i.length);O.key=this.rowKey(b);for(const i of this.normalizedHeader){const n=this.getRawDataRowElement(b,i),s=null!==(m=null==h?void 0:h.includes(i.type))&&void 0!==m&&m,d=s?null==c?void 0:c.get(i.type):void 0,p=s&&void 0===i.bucket&&i.name===i.group&&i.name===i.type?null==u?void 0:u.get(b,i.type):void 0;O.createElement(this.translateSumCellLabel(t,e,n,E,S,R,i.type),i.type,this.createColumnType(i),this.setCellType(i.type,o),this.translateCellPrefix(e,R,i.type),this.translateScenarioCSS(i.type,n,g),y,r,null==a?void 0:a.value,s,d,1,p);const $=O.elements[O.elements.length-1];this.dateBuckets&&void 0!==i.bucket&&($.date=l(i.bucket));const v=new f(i.type);v.isValid&&($.direction=this.resolveDirection(v,g))}v.push(O)}return v}rowKey(t){var e;const o=null!=t.restRowGroup?t.restRowGroup:"NO_GROUP"===t.rowGroup?void 0:t.rowGroup;switch(t.type){case Q.ENTRY:return{rowGroup:o,category:t.category,subCategory:t.subCategory};case Q.DRILLELEMENT:return{rowGroup:o,category:t.category,subCategory:null!==(e=t.rawSubCategory)&&void 0!==e?e:t.subCategory};case Q.GROUPSUM:return{rowGroup:o,row:"subtotal"};case Q.SUM:return{row:"total"};default:return}}getRawDataRowElement(t,e){return void 0!==e.bucket?t[e.type+"##"+e.bucket]:e.name===e.group&&e.name===e.type?t[e.name]:e.name===e.group&&e.name!==e.type?t[e.type+"##"+e.name]:t[e.type+"##"+e.group+"##"+e.name]}createDetailRow(t,e,o,i){switch(t){case Q.GROUPHEAD:return new et(e,o,Q.HEADER);case Q.SUM:case Q.GROUPSUM:return new et(i+2,o,Q.SUM);case Q.DRILLELEMENT:return new et(i+2,o,Q.DRILLELEMENT);case Q.PARTELEMENT:return new et(i+2,o,Q.PARTELEMENT);default:return new et(e,o,Q.STANDARD)}}translateSumCellLabel(t,e,o,i,n,s,r){return this.attributesByAlias.has(r)||!1===Number.isNaN(Number(o))||this.isOperationColumn(r)?o:this.isGroupHeadCategory(s,r)?t===w.ALL?`${e.get(o)||o}`:o:this.isEntryCategory(s,r)?t===w.ALL||"REST"===o?`${e.get(o)||o}`:o:this.isDrillElementCategory(s,r)?t===w.ALL?`${e.get(n)||n}`:`${n}`:this.isPartElementCategory(s,r)?t===w.ALL||"SUM_TOTAL"===i?`${e.get(i)||i}`:`${i}`:this.isSumElementCategory(s,r)?t===w.ALL||"SUM_TOTAL"===i?`${e.get(i)||i}`:i:"GROUPHEAD"===s&&null==o||o===O?o:Number.isNaN(Number(o))?"-":Number(o)}isOperationColumn(t){return"operation"===t}translateScenarioCSS(t,e,o){if(this.attributesByAlias.has(t))return"attribute";const i=new f(t);let n="pos";return e<0&&(n="neg"),i.isValid?n+"_"+this.resolveDirection(i,o)+("dr"===i.type?" relative_variance":""):t}resolveDirection(t,e){return m(t.direction,e,!this.unsignedEntries)}setCellType(t,e){if("category"===t)return"";const o=this.attributesByAlias.get(t);if(o)return o.isNumeric?"decimal":"";let i;const n=new f(t);return e===E.PERCENT?(i="percent",n.isValid&&"d"===n.type&&(i="percentpoint")):(i="decimal",n.isValid&&"dr"===n.type&&(i="percent")),i}isDrillElementCategory(t,e){return"DRILLELEMENT"===t&&"category"===e}isPartElementCategory(t,e){return"PARTELEMENT"===t&&"category"===e}isSumElementCategory(t,e){return("GROUP_SUM"===t||"SUM"===t)&&"category"===e}isEntryCategory(t,e){return"ENTRY"===t&&"category"===e}isGroupHeadCategory(t,e){return"GROUPHEAD"===t&&"category"===e}translateCellPrefix(t,e,o){return this.isOperationColumn(o)||this.isGroupHeadCategory(e,o)||this.isEntryCategory(e,o)?null:this.isDrillElementCategory(e,o)?`${t.get("thereof")} `:this.isPartElementCategory(e,o)?`${t.get("part_of")} `:null}createColumnType(t){return t.name===t.group&&t.name===t.type?"base":t.name===t.group?"columnGroup":"columnSubGroup"}}class Gt{constructor(t,e,o,i){this.fromExpr="",this.rowCount=0,this.headerRows=[],this.bodyRows=[],this.intervalBuckets=[],this.ruleSet=t||new v,this.db=e,this.dataSetFactory=new Ut(this.ruleSet),this.config=this.initConfig(i),this.i18n=this.initI18n(new Map),this.setSource(o,i.filter)}setI18n(t){this.i18n=this.initI18n(t)}initI18n(t){const e=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 this.state=j.DIRTY,new Map([...e,...t||new Map])}initConfig(t){this.state=j.DIRTY;const e=t,o=this;return t.scenarios.sort(((t,e)=>o.ruleSet.getScenarioSorIndex(t)-o.ruleSet.getScenarioSorIndex(e))),e}setConfig(t){this.config=this.initConfig(t)}setSource(t,e){var o,i;if(this.state=j.DIRTY,this.fromExpr=C(this.db,t,e),!this.fromExpr)return void(this.rowCount=0);const n=this.db.exec(`SELECT COUNT(*) AS cnt FROM ${this.fromExpr}`);this.rowCount=null!==(i=null===(o=n[0])||void 0===o?void 0:o.cnt)&&void 0!==i?i:0}update(){this.prepareIntervalBuckets();const t=this.normalizeScenarios(this.config.scenarios,this.config.categoryThereOf,this.config.sortOrder,this.intervalBuckets);this.headerRows=this.dataSetFactory.createHeader(this.config.type,t,this.i18n,this.config.measureScale,this.config.measureUnit,this.config.showMeasureScale,this.config.attributes),this.bodyRows=0!==this.rowCount&&this.fromExpr?this.dataSetFactory.createBodyRows(this.config,this.i18n,this.db,this.fromExpr):[],this.state=j.UP_TO_DATE}getHeader(){return this.state===j.DIRTY&&this.update(),this.headerRows}getBody(){return this.state===j.DIRTY&&this.update(),this.bodyRows}getColumns(){return this.state===j.DIRTY&&this.update(),this.dataSetFactory.getNormalizedHeader()}prepareIntervalBuckets(){this.intervalBuckets=[],this.config.interval===V||!this.fromExpr||this.config.categoryThereOf.size>0?this.config.interval=V:(this.config.interval=function(t,e,o){var i;if(o!==G.AUTO)return o;const n=t.exec(`SELECT [date] as d FROM ${e}`);let s,r;for(const t of n){const e=null===(i=Z(t.d))||void 0===i?void 0:i.toMillis();void 0!==e&&(s=void 0===s?e:Math.min(s,e),r=void 0===r?e:Math.max(r,e))}return void 0===s||void 0===r?G.DAY:(new T).calculateDistanceType(N.fromMillis(s),N.fromMillis(r))}(this.db,this.fromExpr,this.config.interval),this.intervalBuckets=function(t,e,o,i){const n=t.exec(`SELECT ${q(o)} as __interval FROM ${e}`);if(o===X){const t=new Set,e=[];for(const o of n){const i=K(o.__interval);t.has(i)||(t.add(i),e.push({key:i,label:0===i.length?"-":i}))}return e}const s=new Set,r=[];for(const t of n){const e=Z(t.__interval);if(!e)continue;const o=e.toISO();s.has(o)||(s.add(o),r.push(e))}r.sort(((t,e)=>t.toMillis()-e.toMillis()));const a=new T;return a.setLocale(i),r.map((t=>({key:t.toISO(),label:a.getDateString(t,o)})))}(this.db,this.fromExpr,this.config.interval,this.config.locale),0===this.intervalBuckets.length&&(this.config.interval=V))}normalizeScenarios(t,e,o,i=[]){var n;const s=[],r=null===(n=null==o?void 0:o.hierarchy)||void 0===n?void 0:n.map((t=>L(t))).find((t=>"dim"!==(null==t?void 0:t.kind))),a=this.config.interval===X?null==r?void 0:r.bucket:void 0,l=(t,e)=>{var i;return null==r||(null===(i=L(t))||void 0===i?void 0:i.column)!==r.column||void 0!==a&&a!==e?void 0:o.direction};if(i.length>0){for(const e of i)for(const o of t)s.push({name:o,group:o,type:o,order:l(o,e.key),bucket:e.key,bucketLabel:e.label});return s}for(const o of t){if(null==e?void 0:e.has(o)){const t=e.get(o);for(const e of t){s.push({name:e.name,group:e.name,type:o,order:void 0});for(const t of e.subGroups)s.push({name:t,group:e.name,type:o,order:void 0})}s.push({name:"REST",group:"REST",type:o,order:void 0})}s.push({name:o,group:o,type:o,order:l(o)})}return s}hasNoData(){return 0===this.rowCount}orderBucketWarning(){var t,e;if(this.hasNoData()||this.state!==j.UP_TO_DATE)return;const o=(null!==(e=null===(t=this.config.sortOrder)||void 0===t?void 0:t.hierarchy)&&void 0!==e?e:[]).map((t=>{var e;return null===(e=L(t))||void 0===e?void 0:e.bucket})).filter((t=>void 0!==t));if(0===o.length)return;if(this.config.interval!==X)return`order: '@${o[0]}' needs interval setname, the bucket is ignored.`;const i=o.find((t=>!this.intervalBuckets.some((e=>e.key===t))));return void 0===i?void 0:`order: setname '${i}' not found, the rows are not sorted by it.`}hasBlankRowGroup(){return this.dataSetFactory.hasBlankRowGroup}}class Tt{constructor(){this.title="",this.scenarios=[],this.scenariosUnitType=E.DECIMAL,this.grouped=!1,this.showGroupTitle=!0,this.thereOf=[],this.categoryThereOf=new Map,this.partOf=[],this.attributes=[],this.sortOrder=new k(new B).default(),this.type=I.LIST,this.limit=0,this.i18n=w.ALL,this.categoryWidth=R.W25,this.measureScale=new F,this.measureUnit="",this.measureType=y.VOLUME,this.showMeasureScale=!0,this.filter="",this.barColumns=[],this.interval="none",this.locale="de"}}class _t{constructor(t,e,o,i,n,s){this.tableDrillGroupAdapter=t,this.stringAdapter=e,this.orderAdapter=o,this.db=i,this.fromExpr=n,this.onQueryError=s}adapt(t){const e=new Tt;return S.isString(t.title)&&(e.title=t.title),S.isArray(t.scenarios)&&(e.scenarios=W.adaptArray(t.scenarios,this.stringAdapter)),S.isExisting(t.scenariosUnitType)&&(e.scenariosUnitType=t.scenariosUnitType),S.isBoolean(t.grouped)&&(e.grouped=t.grouped),S.isBoolean(t.showGroupTitle)&&(e.showGroupTitle=t.showGroupTitle),S.isBoolean(t.showMeasureScale)&&(e.showMeasureScale=t.showMeasureScale),S.isArray(t.thereOf)&&(e.thereOf=W.adaptArray(t.thereOf,this.tableDrillGroupAdapter)),S.isExisting(t.categoryThereOf)&&(e.categoryThereOf=t.categoryThereOf),S.isArray(t.partOf)&&(e.partOf=W.adaptArray(t.partOf,this.tableDrillGroupAdapter)),S.isArray(t.attributes)&&(e.attributes=t.attributes),S.isExisting(t.order)&&(e.sortOrder=this.orderAdapter.adapt(t.order)),S.isExisting(t.type)&&(e.type=t.type),S.isNumber(t.limit)&&(e.limit=t.limit),S.isExisting(t.i18n)&&(e.i18n=t.i18n),S.isExisting(t.categoryWidth)&&(e.categoryWidth=t.categoryWidth),S.isExisting(t.measureScale)&&(e.measureScale=A.calculateMeasureScale(this.db,this.fromExpr,e.scenarios,t.measureScale,this.onQueryError)),S.isExisting(t.measureType)&&(e.measureType=t.measureType),S.isString(t.measureUnit)&&(e.measureUnit=t.measureUnit),S.isString(t.filter)&&(e.filter=t.filter.trim()),S.isArray(t.barColumns)&&(e.barColumns=t.barColumns),S.isString(t.interval)&&(e.interval=t.interval),S.isString(t.locale)&&(e.locale=t.locale),e}default(){return new Tt}}class Lt{constructor(){this.rowGroup="",this.category="",this.subCategory="",this.partOf=""}}class kt{constructor(){}adapt(t){const e=new Lt;return S.isString(t.rowGroup)&&(e.rowGroup=t.rowGroup),S.isString(t.category)&&(e.category=t.category),S.isString(t.subCategory)&&(e.subCategory=t.subCategory),S.isString(t.partOf)&&(e.partOf=t.partOf),e}default(){return new Lt}}const Ct=e(class extends o{constructor(t){super(),!1!==t&&this.__registerHost(),this.__attachShadow(),this.tableName="",this.dataVersion=0,this.sumTitle="SUM_TOTAL",this.scenarios=[],this.scenariosDataFormat=E.DECIMAL,this.grouped=!1,this.limit=0,this.showGroupTitle=!0,this.thereof=[],this.partof=[],this.order={hierarchy:[],direction:z.ASC},this.categorythereof=new Map,this.attributeColumns=[],this.type=I.LIST,this.categoryWidth=R.INF,this.dataFormatDigits={percent:2,decimal:1},this.i18n=new Map,this.i18nMode=w.ALL,this.measureScale="_",this.measureUnit="",this.showMeasureScale=!0,this.measureType=y.VOLUME,this.filter="",this.barColumns=[],this.interval="none",this.barColumnMaxWidth=30,this.unitScaling=.01,this.percentageScaling=.5,this.scaleFactor=1,this.componentDataFormatDigits=new P,U(this),this.componentStyle=Y(this)}async getLayoutDetail(t,e){var o,i,n;const l={regions:[],metadata:{},diagnostics:[]},h=null===(o=this.element.shadowRoot)||void 0===o?void 0:o.querySelector("table");if(l.metadata.hasNoData=null===(n=null===(i=this.table)||void 0===i?void 0:i.hasNoData())||void 0===n||n,!this.table||!h)return l;const u=h.querySelector("thead"),d=h.querySelector("tbody");u&&l.regions.push({id:"header",rect:s(u,t)}),d&&l.regions.push({id:"body",rect:s(d,t)});const f=this.table.getHeader(),p=this.table.getBody(),$=this.table.getColumns();if(l.metadata.headerRowCount=f.length,l.metadata.rowCount=p.length,l.metadata.columnCount=$.length,l.metadata.cellCount=p.reduce(((t,e)=>t+e.getCells().length),0),"full"!==e)return l;const m=[],v=[],g=(e,o,i)=>{const n=i?Array.from(i.children).filter((t=>"tr"===t.localName)):[];o.forEach(((o,i)=>{const h=n[i];if(!h)return;m.push({section:e,index:i,type:o.type,rect:s(h,t),point:c(h)});const u=o.getCells(),d=Array.from(h.children);u.length===d.length?u.forEach(((o,n)=>{var l,h;const u=d[n],f={kind:"header"===e?"headerCell":"cell",row:i,column:o.index,key:o.key||void 0,colSpan:o.colSpan,value:null!==(l=o.value)&&void 0!==l?l:void 0,text:(null===(h=u.textContent)||void 0===h?void 0:h.trim())||void 0,type:o.type||void 0,rect:s(u,t),point:c(u)};f.point&&(f.content=r(u,t),f.contentSign=a(u)||void 0);const p=u.querySelector("svg.cell-bar-chart");p&&(f.bar={variant:p.classList.contains("waterfall-bar")?"waterfall":p.classList.contains("relative-variance")?"relative":"absolute",rect:s(p,t)}),v.push(f)})):l.diagnostics.push({id:`WARN_layout_cell_pairing_${e}_${i}`,type:"warning",message:`layout-state: model/DOM cell count mismatch in ${e} row ${i} (${u.length} vs ${d.length}); cell details skipped for this row.`})}))};return g("header",f,u),g("body",p,d),l.elements=v,l.table={rows:m,columns:$.map(((t,e)=>({index:e,key:t.name,group:t.group,type:t.type,bucket:t.bucket})))},l}render(){var e;return t(i,{class:{"no-data":!0===(null===(e=this.table)||void 0===e?void 0:e.hasNoData())}},(()=>{var e,o,i,n;if(void 0===this.table)return;if(this.table.hasNoData()){const o=null!==(e=this.i18n.get("no-data"))&&void 0!==e?e:"No Data";return t("div",{class:"empty-state"},o)}const s=null===(n=null===(i=null===(o=this.stores)||void 0===o?void 0:o.context)||void 0===i?void 0:i.state)||void 0===n?void 0:n.locale;return t("table",null,t("thead",null,this.table.getHeader().map((e=>t("tr",{class:e.cssStyle},e.getCells().map((e=>t("th",{colSpan:e.colSpan,class:e.cssStyle},e.getAsHeaderList().map(((o,i,n)=>t("span",null,i===n.length-1?t("span",{class:" "===o?"table-footer":""},o,e.drawPrefix()," "):t("span",null,o,e.drawPrefix(),t("br",null)))))))))))),t("tbody",null,this.table.getBody().map((e=>t("tr",Object.assign({class:e.cssStyle},u(e.key,"element")),null==e?void 0:e.getCells().map((o=>t("td",Object.assign({colSpan:o.colSpan,class:o.type?`${o.cssStyle} ${o.type}`:o.cssStyle},e.key&&null!=o.value&&""!==o.value&&"-"!==o.value?u(Object.assign(Object.assign({},e.key),{date:o.date,scenario:o.key}),"element"):{}),null!=o.prefix?t("span",{class:o.cssStyle+" "+o.prefixStyle},o.drawPrefix()):"",o.isBarChart&&o.columnStats&&o.value!==O&&(void 0!==o.waterfall||e.type!==Q.SUM)?void 0!==o.waterfall?t(St,{value:o.value,scenario:o.key,columnStats:o.columnStats,height:18*this.scaleFactor,isRelative:!1,isPositiveGood:"pos"===o.direction,measureScale:o.measureScale,locale:s,columnWidthEm:this.barColumnMaxWidth,styles:this.barChartStyles,waterfall:o.waterfall}):t(Et,{value:o.value,scenario:o.key,columnStats:o.columnStats,height:18*this.scaleFactor,isRelative:o.key.startsWith("dr"),isPositiveGood:"pos"===o.direction,measureScale:"percentpoint"===o.type?.01:o.measureScale,locale:s,percentDigits:this.componentDataFormatDigits.percent,columnWidthEm:this.barColumnMaxWidth,styles:this.barChartStyles}):o.draw(this.componentDataFormatDigits,s)))))))))})())}componentWillRender(){var t,e,o,i,n,s,r,a;this.stores||(this.stores=x(this.element));const l=this.stores.db.db;this.componentDataFormatDigits=(new D).adapt(this.dataFormatDigits);try{const e=this.prepareConfig(l);this.table=new Gt(new v(this.ruleSetConfig),l,this.tableName,e),this.table.setI18n(this.i18n),this.table.hasNoData()||this.table.getBody(),null===(t=this.errors)||void 0===t||t.remove("ERR_sql")}catch(t){console.error("bn-table-renderer: query failed",t),this.table=void 0,null===(e=this.errors)||void 0===e||e.addOrReplace({id:"ERR_sql",type:"error",message:`Query failed: ${t instanceof Error?t.message:t}`})}(null===(o=this.table)||void 0===o?void 0:o.hasBlankRowGroup())?null===(i=this.errors)||void 0===i||i.addOrReplace({id:"WARN_blankRowGroup",type:"warning",message:"grouped: rows with blank rowGroup found, they are grouped under '-'."}):null===(n=this.errors)||void 0===n||n.remove("WARN_blankRowGroup");const h=null===(s=this.table)||void 0===s?void 0:s.orderBucketWarning();h?null===(r=this.errors)||void 0===r||r.addOrReplace({id:"WARN_orderBucket",type:"warning",message:h}):null===(a=this.errors)||void 0===a||a.remove("WARN_orderBucket"),this.barChartStyles=this.prepareBarChartStyles()}prepareConfig(t){var e,o,i;const n=C(t,this.tableName,this.filter);return new _t(new kt,new B,new k(new B,!0),t,n,(t=>{throw t})).adapt({title:this.sumTitle,scenarios:this.scenarios,scenariosUnitType:this.scenariosDataFormat,grouped:this.grouped,showGroupTitle:this.showGroupTitle,thereOf:this.thereof,partOf:this.partof,categoryThereOf:this.categorythereof,attributes:this.attributeColumns,order:this.order,type:this.type,limit:this.limit,i18n:this.i18nMode,categoryWidth:this.categoryWidth,measureScale:this.measureScale,measureUnit:this.measureUnit,measureType:this.measureType,showMeasureScale:this.showMeasureScale,filter:this.filter,barColumns:this.barColumns,interval:this.interval,locale:(null===(i=null===(o=null===(e=this.stores)||void 0===e?void 0:e.context)||void 0===o?void 0:o.state)||void 0===i?void 0:i.locale)||"de"})}prepareBarChartStyles(){var t;const e=!(this.unitScaling>0),o=!(this.percentageScaling>0),i=e?this.autoUnitScaling():this.unitScaling,n=o?this.autoPercentageScaling():this.percentageScaling;return(e||o)&&(null===(t=this.reportAutoScaling)||void 0===t||t.call(this,{unit:e?i:void 0,percentage:o?n:void 0})),this.componentStyle((t=>{var e,o,s,r,a,l,c,u,d,f,p,$,m,b,w,E,S,R,y,O,M,N,U,G,T,_,L;const k=null===(e=t["bn-chart-time"])||void 0===e?void 0:e.varianceStyles,C=null===(o=t["bn-chart-time"])||void 0===o?void 0:o.barStyles;return{positive:{stroke:(null===(s=null==k?void 0:k.pos)||void 0===s?void 0:s.stroke)||"#008f96",fill:(null===(r=null==k?void 0:k.pos)||void 0===r?void 0:r.fill)||"#008f96",fillpattern:h(null===(a=null==k?void 0:k.pos)||void 0===a?void 0:a.fillpattern)||"solid"},negative:{stroke:(null===(l=null==k?void 0:k.neg)||void 0===l?void 0:l.stroke)||"#ff0000",fill:(null===(c=null==k?void 0:k.neg)||void 0===c?void 0:c.fill)||"#ff0000",fillpattern:h(null===(u=null==k?void 0:k.neg)||void 0===u?void 0:u.fillpattern)||"solid"},neutral:{stroke:(null===(d=null==k?void 0:k.neu)||void 0===d?void 0:d.stroke)||"#808080",fill:(null===(f=null==k?void 0:k.neu)||void 0===f?void 0:f.fill)||"#808080",fillpattern:h(null===(p=null==k?void 0:k.neu)||void 0===p?void 0:p.fillpattern)||"outlined"},scenarios:g({ac:{stroke:(null===($=null==C?void 0:C.ac)||void 0===$?void 0:$.stroke)||"#404040",fill:(null===(m=null==C?void 0:C.ac)||void 0===m?void 0:m.fill)||"#404040",fillpattern:h(null===(b=null==C?void 0:C.ac)||void 0===b?void 0:b.fillpattern)||"solid"},pp:{stroke:(null===(w=null==C?void 0:C.pp)||void 0===w?void 0:w.stroke)||"#A6A6A6",fill:(null===(E=null==C?void 0:C.pp)||void 0===E?void 0:E.fill)||"#A6A6A6",fillpattern:h(null===(S=null==C?void 0:C.pp)||void 0===S?void 0:S.fillpattern)||"solid"},fc:{stroke:(null===(R=null==C?void 0:C.fc)||void 0===R?void 0:R.stroke)||"#404040",fill:(null===(y=null==C?void 0:C.fc)||void 0===y?void 0:y.fill)||"#ffffff",fillpattern:h(null===(O=null==C?void 0:C.fc)||void 0===O?void 0:O.fillpattern)||"hatched"},pl:{stroke:(null===(M=null==C?void 0:C.pl)||void 0===M?void 0:M.stroke)||"#404040",fill:(null===(N=null==C?void 0:C.pl)||void 0===N?void 0:N.fill)||"#ffffff",fillpattern:h(null===(U=null==C?void 0:C.pl)||void 0===U?void 0:U.fillpattern)||"outlined"}},new v(this.ruleSetConfig)),fontColor:(null===(G=t.global)||void 0===G?void 0:G.fontColor)||"#000000",fontSize:((null===(T=t.global)||void 0===T?void 0:T.fontSizePx)||13.3333)*ot*this.scaleFactor,emPx:((null===(_=t.global)||void 0===_?void 0:_.fontSizePx)||13.3333)*this.scaleFactor,fontFamily:(null===(L=t.global)||void 0===L?void 0:L.fontFamily)||"'Noto Sans', sans-serif",unitScaling:i,percentageScaling:n,scaleFactor:this.scaleFactor}}))}emPx(){return this.componentStyle((t=>{var e;return(null===(e=t.global)||void 0===e?void 0:e.fontSizePx)||13.3333}))*this.scaleFactor}autoUnitScaling(){const t=this.emPx(),e=t*ot,{absMax:o,hasNeg:i,hasPos:n}=this.getAbsBarColumnStats();if(o<=0||e<=0)return.01;const{maxBarWidth:s,cutWidth:r}=st(this.barColumnMaxWidth,t,i,n);return Math.min(.8*s,r)/(o*e)}autoPercentageScaling(){const t=this.emPx(),e=t*ot,{absMax:o,hasNeg:i,hasPos:n}=this.getRelativeBarColumnStats();if(o<=0||e<=0)return.5;const{maxPinLength:s}=rt(this.barColumnMaxWidth,t,i,n);return.8*s/(o*e)}getAbsBarColumnStats(){return this.collectBarColumnStats((t=>!t.key.startsWith("dr")&&!t.waterfall),1)}getRelativeBarColumnStats(){return this.collectBarColumnStats((t=>t.key.startsWith("dr")),100)}collectBarColumnStats(t,e){const o={absMax:0,hasNeg:!1,hasPos:!1};if(!this.table)return o;for(const i of this.table.getBody())if(i.type!==Q.SUM)for(const n of i.getCells())n.isBarChart&&n.columnStats&&t(n)&&(o.absMax=Math.max(o.absMax,n.columnStats.absMax*e),o.hasNeg=o.hasNeg||n.columnStats.min<0,o.hasPos=o.hasPos||n.columnStats.max>0);return o}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}table{background-color:var(--bn-font-background, white);font-size:var(--bn-font-size, 1em);color:var(--bn-font-color, black);font-family:var(--bn-font-family, "Noto Sans", "Helvetica Neue", Helvetica, sans-serif);border-spacing:0.3em 0}thead{border-style:none}tr:first-child td{border-top:none;padding-top:0.5em}td.ac1,td.ac2,td.ac3,td.ac4,td.pp1,td.pp2,td.pp3,td.pp4,td.pl1,td.pl2,td.pl3,td.pl4,td.fc1,td.fc2,td.fc3,td.fc4,td.share,td.variance,td.pos_pos,td.pos_neg,td.neg_pos,td.neg_neg,td.pos_neutral,td.neg_neutral{text-align:right}.category-w100{min-width:100em;max-width:100em}.category-w50{min-width:50em;max-width:50em}.category-w25{min-width:25em;max-width:25em}.category-w20{min-width:20em;max-width:20em}.category-w15{min-width:15em;max-width:15em}.category-w10{min-width:10em;max-width:10em}.category-w5{min-width:5em;max-width:5em}.prefix-second{color:transparent;font-style:normal}.prefix-first{font-style:normal}th{border-bottom:0.1em solid black;text-align:right;font-weight:normal;vertical-align:text-top}td.columnGroup,th.columnGroup{font-size:0.6em}td.columnSubGroup,th.columnSubGroup{font-size:0.6em;border-spacing:0em 0;font-style:italic}td.base,th.base{font-style:normal}th.ofit,td.ofit,tr.ofit,th.partof,td.partof,tr.partof{font-size:0.6em;font-style:italic}td.ofit,td.partof{font-size:0.6em;font-style:italic}th.ofit td,tr.ofit td,th.partof td,tr.partof td{border-top:0em solid black;padding-left:1em}th.ofit share,th.partof share,tr.share td{border-top:0em solid black}th.share,tr.share,td.share{font-size:0.6em;font-style:italic}th.filler{border-bottom:0em solid black;text-align:right}td.filler{border-top:0em none !important;border-bottom:0em none;text-align:right}th.group{text-align:center;border-spacing:1em 0}th.headerlabel{border-bottom:0em none black;padding-bottom:0em}th.intervalGroup{border-bottom:0.1em solid black;text-align:center;font-weight:bold}td.variance:after{content:"%"}td.relative_variance{font-style:italic}td.percent{font-style:italic;text-align:right}td.decimal,td.percentpoint{text-align:right}td.pos_pos{color:#008f96}td.neg_pos{color:#ff0000}td.pos_neg{color:#ff0000}td.neg_neg{color:#008f96}td.pos_pos:before{content:"+"}td.pos_neg:before{content:"+"}td.pos_neu:before{content:"+"}th.ac1,th.ac2,th.ac3,th.ac4{padding-top:0em;border-bottom:0.3em solid black}th.pp1,th.pp2,th.pp3,th.pp4{padding-top:0em;border-bottom:0.3em solid grey}th.pl1,th.pl2,th.pl3,th.pl4{padding-top:0em;border-bottom:0.3em double black}th.fc1,th.fc2,th.fc3,th.fc4{border-bottom:0.3em solid;border-image:repeating-linear-gradient(-45deg, white, white, black, white, white 0.3em) 2}td.colsum{font-weight:bold}th.colsum{padding-top:0em;font-weight:bold}tr.sum td{border-top:0.1em solid black;font-weight:bold;padding-bottom:0.5em}tr.groupheader td{border-top:0em dotted #ddd;padding-top:0.5em;font-weight:bold;font-style:italic}tr.begingroup td{border-top:0em dotted #ddd;padding-top:0.5em}th.begin-group{padding-left:0.75em}th.end-group{padding-left:0.75em}td{box-sizing:border-box;-webkit-box-sizing:border-box;border-top:0.1em dashed #ddd;padding-left:0.5em;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.table-footer{font-size:0.6em}.cell-bar-chart{display:inline-block;vertical-align:middle}.bar-chart-empty{color:#999}td:has(.cell-bar-chart){padding:0 0.25em;vertical-align:middle}td:has(.cell-bar-chart).pos_pos:before,td:has(.cell-bar-chart).pos_neg:before,td:has(.cell-bar-chart).pos_neu:before{content:none}td:has(.cell-bar-chart).variance:after{content:none}'}},[1,"bn-table-renderer",{tableName:[1,"table-name"],dataVersion:[2,"data-version"],selectedStyle:[513,"selected-style"],sumTitle:[1,"sum-title"],scenarios:[16],scenariosDataFormat:[1,"scenarios-data-format"],grouped:[4],limit:[2],showGroupTitle:[4,"show-group-title"],thereof:[16],partof:[16],order:[16],categorythereof:[16],attributeColumns:[16],type:[1],categoryWidth:[1,"category-width"],dataFormatDigits:[16],ruleSetConfig:[16],i18n:[1040],i18nMode:[1,"i18n-mode"],measureScale:[1,"measure-scale"],measureUnit:[1,"measure-unit"],showMeasureScale:[4,"show-measure-scale"],measureType:[1,"measure-type"],filter:[1],barColumns:[16],interval:[1],barColumnMaxWidth:[2,"bar-column-max-width"],unitScaling:[2,"unit-scaling"],percentageScaling:[2,"percentage-scaling"],reportAutoScaling:[16],errors:[16],scaleFactor:[2,"scale-factor"],getLayoutDetail:[64]}]);function xt(){"undefined"!=typeof customElements&&["bn-table-renderer"].forEach((t=>{"bn-table-renderer"===t&&(customElements.get(n(t))||customElements.define(n(t),Ct))}))}export{Ct as B,V as I,I as T,X as a,xt as d}