@bino-bi/bn-template-engine 1.0.0-alpha.4 → 1.0.0-alpha.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/bn-template-engine/bn-template-engine.esm.js +1 -1
- package/dist/bn-template-engine/p-06946f44.entry.js +1 -0
- package/dist/bn-template-engine/p-0fabe296.entry.js +1 -0
- package/dist/bn-template-engine/p-1164c0b0.entry.js +1 -0
- package/dist/bn-template-engine/p-355abdf0.entry.js +1 -0
- package/dist/bn-template-engine/p-79KuA4Ox.js +1 -0
- package/dist/bn-template-engine/p-859cc06d.entry.js +1 -0
- package/dist/bn-template-engine/p-8acec99e.entry.js +1 -0
- package/dist/bn-template-engine/p-8f490c45.entry.js +1 -0
- package/dist/bn-template-engine/p-98cf512f.entry.js +1 -0
- package/dist/bn-template-engine/p-9a564f8f.entry.js +1 -0
- package/dist/bn-template-engine/{p-CL1RYuNU.js → p-B0lsgVuN.js} +1 -1
- package/dist/bn-template-engine/p-B7p8beYH.js +1 -0
- package/dist/bn-template-engine/p-BDh7GfC5.js +1 -0
- package/dist/bn-template-engine/p-BoMtoHJB.js +1 -0
- package/dist/bn-template-engine/p-Bs8BqBsb.js +1 -0
- package/dist/bn-template-engine/p-CYjZRKdI.js +1 -0
- package/dist/bn-template-engine/{p-P7pGJBgc.js → p-DG-1MR_T.js} +1 -1
- package/dist/bn-template-engine/p-bdd2b243.entry.js +1 -0
- package/dist/bn-template-engine/p-e6b24f15.entry.js +1 -0
- package/dist/bn-template-engine/p-f27995c9.entry.js +1 -0
- package/dist/bn-template-engine/{p-Bnhh02CF.js → p-sRO-lj7X.js} +1 -1
- package/dist/bn-template-engine/p-tzFCK9qn.js +1 -0
- package/dist/cjs/{Order-iG11HI4R.js → Order-BGx39pS5.js} +448 -0
- package/dist/cjs/{alasql.min-C_nHTuEQ.js → SVGVariancesStyleGroup-BqAdPYtL.js} +8228 -3
- package/dist/cjs/bn-asset_16.cjs.entry.js +9018 -0
- package/dist/cjs/bn-card.cjs.entry.js +3 -4
- package/dist/cjs/bn-chart-time.cjs.entry.js +11 -16
- package/dist/cjs/bn-grid.cjs.entry.js +5 -8
- package/dist/cjs/bn-image.cjs.entry.js +5 -8
- package/dist/cjs/bn-internationalization.cjs.entry.js +3 -4
- package/dist/cjs/bn-layout-card.cjs.entry.js +125 -6
- package/dist/cjs/bn-template-engine.cjs.js +1 -1
- package/dist/cjs/bn-template.cjs.entry.js +2 -3
- package/dist/cjs/bn-text.cjs.entry.js +7 -11
- package/dist/cjs/bn-tree.cjs.entry.js +5 -8
- package/dist/cjs/{formatter-DIJL_crx.js → formatter-4XCS0d2B.js} +8 -2
- package/dist/cjs/ibcs-chart-time.cjs.entry.js +37 -42
- package/dist/cjs/loader.cjs.js +1 -1
- package/dist/cjs/{scaling-9Tz595RQ.js → scaling-BidPsO53.js} +115 -12
- package/dist/cjs/{withBodyObserver-CKpSD8UT.js → withBodyObserver-C6gLgq_e.js} +3 -3
- package/dist/cjs/{withComponentStatus-Bw70BhO0.js → withComponentStatus-_x4LQZ0N.js} +5 -5
- package/dist/cjs/{withComponentStyle-aIbTCtfj.js → withComponentStyle-ClSJfCku.js} +4 -4
- package/dist/cjs/{utils-CwHIVbbL.js → withHasError-B8gHkfV2.js} +69 -1
- package/dist/cjs/{withStyled-CS1Yp4sv.js → withStyled-9tG024gQ.js} +62 -9
- package/dist/collection/components/bn-chart-structure/utils/elements/Label.js +11 -0
- package/dist/collection/components/bn-chart-structure/utils/elements/StackedBar.js +5 -2
- package/dist/collection/components/bn-layout-card/bn-layout-card.css +1 -0
- package/dist/collection/components/bn-layout-card/bn-layout-card.js +162 -27
- package/dist/collection/components/bn-layout-page/bn-layout-page.css +1 -0
- package/dist/collection/components/bn-layout-page/bn-layout-page.js +151 -33
- package/dist/collection/components/bn-table/bn-table.js +12 -10
- package/dist/collection/components/bn-table/ibcs-table.js +2 -2
- package/dist/collection/utils/parentDimensions.js +38 -6
- package/dist/components/bn-layout-card.js +1 -1
- package/dist/components/bn-layout-page.js +1 -1
- package/dist/components/bn-table.js +1 -1
- package/dist/components/ibcs-chart-structure2.js +1 -1
- package/dist/components/ibcs-table2.js +1 -1
- package/dist/components/scaling.js +1 -1
- package/dist/esm/{Order-Bnhh02CF.js → Order-sRO-lj7X.js} +448 -1
- package/dist/esm/{alasql.min-CWu4NkIt.js → SVGVariancesStyleGroup-DOIT-zvI.js} +8212 -2
- package/dist/esm/bn-asset_16.entry.js +9001 -0
- package/dist/esm/bn-card.entry.js +4 -5
- package/dist/esm/bn-chart-time.entry.js +8 -13
- package/dist/esm/bn-grid.entry.js +6 -9
- package/dist/esm/bn-image.entry.js +6 -9
- package/dist/esm/bn-internationalization.entry.js +4 -5
- package/dist/esm/bn-layout-card.entry.js +126 -7
- package/dist/esm/bn-template-engine.js +1 -1
- package/dist/esm/bn-template.entry.js +2 -3
- package/dist/esm/bn-text.entry.js +7 -11
- package/dist/esm/bn-tree.entry.js +6 -9
- package/dist/esm/{context-protocol-BHnQsVsr.js → context-protocol-2peaD4y8.js} +1 -1
- package/dist/esm/editor-companion.entry.js +1 -1
- package/dist/esm/{formatter-DTMEZ6d8.js → formatter-BDh7GfC5.js} +6 -2
- package/dist/esm/ibcs-chart-time.entry.js +3 -8
- package/dist/esm/loader.js +1 -1
- package/dist/esm/{scaling-Cehc74IE.js → scaling-BOcjT8M0.js} +112 -10
- package/dist/esm/{withBodyObserver-FQ8NwCIz.js → withBodyObserver-DczL5ia8.js} +1 -1
- package/dist/esm/{withComponentStatus-DWjDYtZ7.js → withComponentStatus-DodoSXe-.js} +1 -1
- package/dist/esm/{withComponentStyle-9uP_hcDq.js → withComponentStyle-D3VWOsto.js} +2 -2
- package/dist/esm/{utils-DvvwfRQG.js → withHasError-B3QX2emi.js} +69 -1
- package/dist/esm/{withStyled--qQWquTH.js → withStyled-CE3_3taP.js} +57 -5
- package/dist/types/components/bn-chart-structure/utils/elements/Label.d.ts +2 -0
- package/dist/types/components/bn-layout-card/bn-layout-card.d.ts +139 -0
- package/dist/types/components/bn-layout-page/bn-layout-page.d.ts +154 -0
- package/dist/types/components/bn-table/bn-table.d.ts +7 -5
- package/dist/types/components.d.ts +170 -2
- package/dist/types/utils/parentDimensions.d.ts +6 -1
- package/package.json +1 -1
- package/dist/bn-template-engine/p-1265d8d3.entry.js +0 -1
- package/dist/bn-template-engine/p-15516dac.entry.js +0 -1
- package/dist/bn-template-engine/p-1c716641.entry.js +0 -1
- package/dist/bn-template-engine/p-1jFf17Vj.js +0 -1
- package/dist/bn-template-engine/p-27cc8dc0.entry.js +0 -1
- package/dist/bn-template-engine/p-4426d484.entry.js +0 -1
- package/dist/bn-template-engine/p-51f8dc9e.entry.js +0 -1
- package/dist/bn-template-engine/p-53d4e690.entry.js +0 -1
- package/dist/bn-template-engine/p-5KQYRQLK.js +0 -1
- package/dist/bn-template-engine/p-745f4596.entry.js +0 -1
- package/dist/bn-template-engine/p-75e97c87.entry.js +0 -1
- package/dist/bn-template-engine/p-7a560278.entry.js +0 -1
- package/dist/bn-template-engine/p-7ea7c325.entry.js +0 -1
- package/dist/bn-template-engine/p-945cc95d.entry.js +0 -1
- package/dist/bn-template-engine/p-BFTU3MAI.js +0 -1
- package/dist/bn-template-engine/p-BYBpC0EO.js +0 -1
- package/dist/bn-template-engine/p-BYmPQYxx.js +0 -1
- package/dist/bn-template-engine/p-BfXY5dsy.js +0 -1
- package/dist/bn-template-engine/p-BgnHJQ9Q.js +0 -1
- package/dist/bn-template-engine/p-Bhd_WSML.js +0 -1
- package/dist/bn-template-engine/p-Bka-Z6jo.js +0 -1
- package/dist/bn-template-engine/p-C7dQL8CS.js +0 -1
- package/dist/bn-template-engine/p-CYwd_ZNM.js +0 -1
- package/dist/bn-template-engine/p-ChlK-T9I.js +0 -1
- package/dist/bn-template-engine/p-DHezf8pZ.js +0 -1
- package/dist/bn-template-engine/p-DlppAFq9.js +0 -1
- package/dist/bn-template-engine/p-DvDDgmcV.js +0 -1
- package/dist/bn-template-engine/p-DvvwfRQG.js +0 -1
- package/dist/bn-template-engine/p-b34eaf86.entry.js +0 -1
- package/dist/bn-template-engine/p-bdb8b44c.entry.js +0 -1
- package/dist/bn-template-engine/p-c44fcb8e.entry.js +0 -1
- package/dist/bn-template-engine/p-c7e1a49b.entry.js +0 -1
- package/dist/bn-template-engine/p-d9003041.entry.js +0 -1
- package/dist/bn-template-engine/p-daa7ffa3.entry.js +0 -1
- package/dist/bn-template-engine/p-e084f50a.entry.js +0 -1
- package/dist/bn-template-engine/p-eaba6658.entry.js +0 -1
- package/dist/bn-template-engine/p-u8igQLRZ.js +0 -1
- package/dist/cjs/DataFormatDigits-DKcOeLNK.js +0 -142
- package/dist/cjs/DateStringFactory-CSKvbS8K.js +0 -452
- package/dist/cjs/SVGVariancesStyleGroup-K-Tw6lOD.js +0 -7960
- package/dist/cjs/_commonjsHelpers-BJu3ubxk.js +0 -10
- package/dist/cjs/bn-asset.cjs.entry.js +0 -42
- package/dist/cjs/bn-body_4.cjs.entry.js +0 -748
- package/dist/cjs/bn-chart-structure_5.cjs.entry.js +0 -3934
- package/dist/cjs/bn-component-style.cjs.entry.js +0 -44
- package/dist/cjs/bn-dataset.cjs.entry.js +0 -306
- package/dist/cjs/bn-layout-page.cjs.entry.js +0 -143
- package/dist/cjs/bn-message.cjs.entry.js +0 -52
- package/dist/cjs/bn-table.cjs.entry.js +0 -979
- package/dist/cjs/contentDecoder-JxOldq1e.js +0 -419
- package/dist/cjs/emotion-hash.esm-nbbEQ0Dn.js +0 -57
- package/dist/cjs/ibcs-table.cjs.entry.js +0 -2276
- package/dist/cjs/ibcsRuleSet-DgUoXOfd.js +0 -136
- package/dist/cjs/index-Dm85hG6t.js +0 -65
- package/dist/cjs/withHasError-D7ue5vAv.js +0 -72
- package/dist/cjs/withTranslation-rwgyITqe.js +0 -77
- package/dist/esm/DataFormatDigits-oSZ1hBKE.js +0 -137
- package/dist/esm/DateStringFactory-CSGz6TDk.js +0 -450
- package/dist/esm/SVGVariancesStyleGroup-CqTjrZYg.js +0 -7950
- package/dist/esm/_commonjsHelpers-BFTU3MAI.js +0 -7
- package/dist/esm/bn-asset.entry.js +0 -40
- package/dist/esm/bn-body_4.entry.js +0 -743
- package/dist/esm/bn-chart-structure_5.entry.js +0 -3928
- package/dist/esm/bn-component-style.entry.js +0 -42
- package/dist/esm/bn-dataset.entry.js +0 -304
- package/dist/esm/bn-layout-page.entry.js +0 -141
- package/dist/esm/bn-message.entry.js +0 -50
- package/dist/esm/bn-table.entry.js +0 -977
- package/dist/esm/contentDecoder-oMmxz6nJ.js +0 -416
- package/dist/esm/emotion-hash.esm-BYBpC0EO.js +0 -55
- package/dist/esm/ibcs-table.entry.js +0 -2274
- package/dist/esm/ibcsRuleSet-K4ytuA1f.js +0 -133
- package/dist/esm/index-DHezf8pZ.js +0 -65
- package/dist/esm/withHasError-FyY5mQ_3.js +0 -70
- package/dist/esm/withTranslation-BqD0Kp7b.js +0 -75
|
@@ -1 +1 @@
|
|
|
1
|
-
import{h as t,proxyCustomElement as e,HTMLElement as o,Host as n,transformTag as s}from"@stencil/core/internal/client";import{F as r,Q as i,V as l,I as a,S as c}from"./ibcsRuleSet.js";import{I as h,D as u,j as d,k as f,l as p,e as m,M as $}from"./Order.js";import{a as v}from"./alasql.min.js";import{D as g,S as R,a as w,b}from"./DataFormatDigits.js";import{w as S}from"./withComponentStyle.js";var E,O,y,M,U;!function(t){t[t.ALL=-1]="ALL"}(E||(E={})),function(t){t[t.UP_TO_DATE=0]="UP_TO_DATE",t[t.DIRTY=1]="DIRTY"}(O||(O={})),function(t){t.LIST="list",t.SUM="sum",t.SUMNOTOTAL="sumnototal",t.OPT="opt",t.OPTNOTOTAL="optnototal"}(y||(y={})),function(t){t.ASC="asc",t.DESC="desc"}(M||(M={})),function(t){t.HEADER="HEADER",t.GROUPHEAD="GROUPHEAD",t.SEPERATORLINE="SEPERATORLINE",t.SUM="SUM",t.GROUPSUM="GROUP_SUM",t.DRILLELEMENT="DRILLELEMENT",t.STANDARD="STANDARD",t.PARTELEMENT="PARTELEMENT",t.ENTRY="ENTRY"}(U||(U={}));class G{constructor(t,e,o,n,s,r,i,l,a){this.prefixStyle="prefix",this.isBarChart=!1,this.key=t,this.index=e,this.value=o,this.prefix=r||"",this.cssStyle=n||"",this.prefixStyle=i||"prefix",this.type=s,this.mark=void 0,this.colSpan=l||1,this.measureScale=a||1}getAsHeaderList(){if(null==this.value)return[""];const t=[];for(const e of this.value.toString().split("<br/>"))t.push(e);return t}draw(t){let e=this.value;if("undefined"===e||void 0===e||null==e)return"";if(Number.isNaN(Number(e)))return e;if(""===this.type||void 0===this.type||null==this.type)return e;let o=t.percent,n=t.percent;return"decimal"===this.type&&(e=+e/this.measureScale,o=t.decimal,n=t.decimal),r.number(Number(e),this.type,o,n)}drawPrefix(){return null==this.prefix?"":this.prefix}}class T{constructor(t,e,o){this.index=t,this.groupindex=e,this.type=o,this.cssStyle=this.initCssStyle(),this.elements=[]}initCssStyle(){switch(this.type){case U.HEADER:return"groupheader";case U.SEPERATORLINE:return"";case U.DRILLELEMENT:return"ofit";case U.PARTELEMENT:return"partof";case U.STANDARD:return"";case U.SUM:return"sum";default:return""}}getCells(){return this.elements}createElement(t,e,o,n,s,r,i,l,a,c=!1,h){let u=r;"category"===e&&null!=l&&(u=`category-${l.toString()}`),this.type===U.HEADER?u="headerlabel":this.type===U.SEPERATORLINE&&(u=e),this.type===U.PARTELEMENT&&("percent"===n&&(t="-"),"category"!==e&&"operation"!==e&&(n="percent",u="")),"-"===t&&(u="");let d="prefix-first";i&&(d="prefix-second"),o&&(u=`${u} ${o}`);const f=new G(e,this.elements.length,t,u,n,s,d,1,a);f.isBarChart=c,f.columnStats=h,this.elements.push(f)}}const _={positive:{stroke:"#008f96",fill:"#008f96",fillpattern:"solid"},negative:{stroke:"#ff0000",fill:"#ff0000",fillpattern:"solid"},neutral:{stroke:"#808080",fill:"#808080",fillpattern:"outlined"},scenarios:{ac:{stroke:"#404040",fill:"#404040",fillpattern:"solid"},pp:{stroke:"#A6A6A6",fill:"#A6A6A6",fillpattern:"solid"},fc:{stroke:"#404040",fill:"#ffffff",fillpattern:"hatched"},pl:{stroke:"#404040",fill:"#ffffff",fillpattern:"outlined"}},fontColor:"#000000",fontSize:11,fontFamily:"'Noto Sans', sans-serif",unitScaling:.01,percentageScaling:.5,scaleFactor:1},C="#666666";function L(t,e){return`pattern-${t}-${e.replace("#","")}`}const N=({styles:e})=>{const o=e.scaleFactor,n=6*o,s=[{id:L("pos",e.positive.stroke),stroke:e.positive.stroke,fill:e.positive.fill},{id:L("neg",e.negative.stroke),stroke:e.negative.stroke,fill:e.negative.fill},{id:L("neu",e.neutral.stroke),stroke:e.neutral.stroke,fill:e.neutral.fill}];return t("defs",null,s.map((e=>t("pattern",{id:e.id,patternUnits:"userSpaceOnUse",width:n,height:n},t("rect",{width:n,height:n,fill:"#ffffff"}),t("line",{x1:"0",y1:n,x2:n,y2:"0",stroke:e.stroke,"stroke-width":1.5*o})))))};function P(t,e,o=1){let n,s;const r=t>=0?"+":"";if(e)return n=100*t,r+Math.round(n).toString()+"%";{let e;return n=t/o,s=Math.abs(n),e=s>=1e9?(n/1e9).toFixed(s>=1e10?0:1)+"B":s>=1e6?(n/1e6).toFixed(s>=1e7?0:1)+"M":s>=1e3?(n/1e3).toFixed(s>=1e4?0:1)+"K":n.toFixed(s>=10?0:1),e=e.replace(/\.0([KMB]?)$/,"$1"),r+e}}function x(t){const e=t.slice(0,2).toLowerCase();return["ac","pp","fc","pl"].includes(e)}function k(t){const e=t.slice(0,2).toLowerCase();return"pp"===e?"pp":"fc"===e?"fc":"pl"===e?"pl":"ac"}function A(t,e,o,n){return x(t)?function(t,e){const o=k(t);return e.scenarios[o]}(t,n):function(t,e,o){const n=t>=0;return e?n?o.positive:o.negative:n?o.negative:o.positive}(e,o,n)}const D=e=>{const{value:o,scenario:n,columnStats:s,height:r,isPositiveGood:i,formattedValue:l,measureScale:a,maxBarWidth:c=10,styles:h=_}=e,u=h.scaleFactor,d=h.fontSize,f=38*u,p=c*d,m=4*u,$=.15*p,v=p-m-$,g=Math.abs(o)*h.unitScaling*d,R=g>v,w=Math.max(0,s.absMax*h.unitScaling*d-v),b=Math.max(0,g-v),S=w>0?b/w*$:0,E=s.min<0,O=s.max>0,y=E?p:0,M=(E?f:0)+(y+(O?p:0))+(O?f:0),U=2*u,G=r-2*U,T=(E?f:0)+y,D=U,B=o>=0,F=A(n,o,i,h),Y=function(t,e){const o=t.fillpattern;return"hatched"===o?`url(#${L(e,t.stroke)})`:"outlined"===o?"transparent":t.fill}(F,x(n)?k(n):i?B?"pos":"neg":B?"neg":"pos"),{stroke:W,strokeWidth:H}="outlined"===(I=F).fillpattern?{stroke:I.stroke,strokeWidth:1.5}:{stroke:"none",strokeWidth:0};var I;const z=l||P(o,!1,a),j=R?v:g,V=R?v+m+S:g,Q=B?T+V+4*u:T-V-4*u,q=B?"start":"end";return t("svg",{width:M,height:r,class:"cell-bar-chart absolute-variance",style:{overflow:"visible"}},t(N,{styles:h}),t("line",{x1:T,y1:0,x2:T,y2:r,stroke:C,"stroke-width":1*u}),j>0&&t("rect",{x:B?T:T-j,y:D,width:j,height:G,fill:Y,stroke:W,"stroke-width":H*u}),R&&S>0&&t("rect",{x:B?T+v+m:T-v-m-S,y:D,width:S,height:G,fill:Y,stroke:W,"stroke-width":H*u}),R&&function(e,o,n,s,r){const i=e+o/2,l=.35*o,a=s/3,c=.3*o;let h=`M ${i-l} ${n}`;for(let t=0;t<3;t++)h+=` L ${i-l-c} ${n+a*(t+.5)} L ${i-l} ${n+a*(t+1)}`;let u=`M ${i+l} ${n}`;for(let t=0;t<3;t++)u+=` L ${i+l+c} ${n+a*(t+.5)} L ${i+l} ${n+a*(t+1)}`;return[t("rect",{x:e,y:n-1,width:o,height:s+2,fill:"#ffffff"}),t("path",{d:h,fill:"none",stroke:"#000000","stroke-width":1*r}),t("path",{d:u,fill:"none",stroke:"#000000","stroke-width":1*r})]}(B?T+v:T-v-m,m,D,G,u),t("text",{x:Q,y:r/2,dy:"0.35em","text-anchor":q,fill:h.fontColor,"font-size":d,"font-family":h.fontFamily},z))},B=e=>{const{value:o,scenario:n,columnStats:s,height:r,isPositiveGood:i,formattedValue:l,measureScale:a,maxBarWidth:c=10,styles:h=_}=e,u=h.scaleFactor,d=h.fontSize,f=Math.round(.67*c*d),p=5*u,m=s.min<0?f+p:0,$=m+(s.max>0?f+p:0),v=$+45*u,g=m,R=r/2,w=100*Math.abs(o)*h.percentageScaling*d,b=w>f,S=Math.min(w,f),E=o>=0,O=E?g+S:g-S,y=A(n,o,i,h),M=3*u,U=l||P(o,!0,a),G=$+4*u;return t("svg",{width:v,height:r,class:"cell-bar-chart relative-variance",style:{overflow:"visible"}},t("line",{x1:g,y1:0,x2:g,y2:r,stroke:C,"stroke-width":1*u}),!b&&t("circle",{cx:O,cy:R,r:M,fill:h.fontColor}),t("line",{x1:g,y1:R,x2:O,y2:R,stroke:y.fill,"stroke-width":2*u}),b&&E&&t("polygon",{points:`${g+f},${R} ${g+f-6*u},${R-3*u} ${g+f-6*u},${R+3*u}`,fill:y.fill}),b&&!E&&t("polygon",{points:`${g-f},${R} ${g-f+6*u},${R-3*u} ${g-f+6*u},${R+3*u}`,fill:y.fill}),t("text",{x:G,y:r/2,dy:"0.35em","text-anchor":"start",fill:h.fontColor,"font-size":d,"font-style":"italic","font-family":h.fontFamily},U))},F=e=>{const{value:o,columnStats:n,isRelative:s,styles:r=_}=e;return null==o||isNaN(o)||!n||0===n.absMax?t("span",{class:"bar-chart-empty",style:{color:r.fontColor,fontStyle:"italic"}},"-"):t(s?B:D,Object.assign({},e))};class Y{constructor(t){v.fn.transformOperator=function(t){return"-"===t?-1:1},this.groups=[i.CATEGORY,i.CATEGORYINDEX],y.OPT!==t.type&&y.OPTNOTOTAL!==t.type||this.groups.unshift(i.OPERATION),t.grouped&&(this.groups.push(i.ROWGROUP),this.groups.push(i.ROWGROUPINDEX))}toString(){return this.groups.map((t=>`${t}`)).toString()}noCategory(){return this.groups.filter((t=>t!==i.CATEGORY))}toArray(){return this.groups}}class W{constructor(t,e){this.hasPartOf=!1,this.config=t,this.i18n=e}execute(t){if(0===t.length)return[];const e=[],o=[],n=[],s=this.config.scenarios.map((t=>this.translateScenarioSQL(t,!1,this.config.type))).toString(),r=this.config.scenarios.map((t=>this.translateScenarioSQL(t,!0,this.config.type))).toString(),l=this.getRelativeScenarios(),a=new Y(this.config),c=this.config.grouped?[i.ROWGROUP,i.ROWGROUPINDEX]:[];let h=["",""];return this.config.sortOrder.hierarchy.length>0&&(h=this.createOrderString(this.config.sortOrder)),this.hasPartOf=this.checkConfigForPartOf(),v(`SELECT COUNT(DISTINCT ${i.CATEGORY}) as ${i.TOTALROWCOUNT} ${c.length>0?","+c:""}\n FROM ? ${c.length>0?"GROUP BY "+c:""} \n ORDER BY ${h[0]}`,[t]).forEach((t=>{const n=t.rowGroup&&t.rowGroup.length>0?`WHERE ${i.ROWGROUP} = '${t.rowGroup}'`:"";let l="";this.config.limit&&(l=`LIMIT ${this.config.limit}`),this.createGroupHeaderRow(t,e),this.createDataRow(e,t,a,s,n,h,l),this.createRestRow(t,e,a,s,n,h),this.createGroupSumRow(e,o,t,r,h)})),this.createTotalSumRow(e,o,r),e.forEach((e=>{try{n.push(v(e,[t]))}catch(t){console.error("DataQuery: SQL query execution failed",e,t)}})),this.detectNaNCells(this.config.scenarios,n),this.createThereOfDrillRows(s,h,t,n),this.createPartOfDrillRows(s,h,o,t,n),this.createThereOfDrillColumns(this.config.categoryThereOf,t,n),this.calculateColumnGroupRest(n,this.config.categoryThereOf),this.calculateRelativeVariances(n,l),n}detectNaNCells(t,e){e.forEach((e=>{e.map((e=>(t.forEach((t=>{const o=new l(t);!0===o.isValid?0!==e[o.base+"_cnt"]&&0!==e[o.delta+"_cnt"]||(e[t]=Number.NaN):0===e[t+"_cnt"]&&(e[t]=Number.NaN)})),e)))}))}createPartOfDrillRows(t,e,o,n,s){if(null==this.config.partOf||0===this.config.partOf.length||this.config.type===y.LIST||null==n||0===n.length)return;const r=this.createPartOfQuery(t,e);let l=[];r.forEach((function(t){l.push(...v(t,[n]))}));const a=this.exctractScenarioNames(t),c=[];o.forEach((function(t){c.push(...v(t,[n]))}));const h=new Map;c.forEach((t=>h.set(t[i.ROWGROUP],t))),l=this.reduceResDrillByCategoryGroups(l,a),l.forEach((function(t){a.forEach((e=>{try{t[e]=t[e]/h.get(t[i.ROWGROUP])[e]}catch(o){console.error("DataQuery: partOf drill row calculation failed",e,o),t[e]=Number.NaN}}))})),this.injectDrillRowsToResultRows(l,s)}createRestRow(t,e,o,n,s,r){t.totalRowCnt-this.config.limit>0&&0!==this.config.limit&&e.push(`SELECT ${i.ROWNR}, 1 as ${i.ROWGROUPINDEX} , 'ENTRY' as ${i.TYPE}, 'NO_GROUP' as ${i.ROWGROUP}, 'REST' as ${i.CATEGORY} , SUM(ac1) as ac1, SUM(pp1) as pp1, SUM(dpp1_ac1_pos) as dpp1_ac1_pos, SUM(drpp1_ac1_pos) as drpp1_ac1_pos, SUM(dr_pp1) as dr_pp1 FROM (SELECT ROWNUM() AS ${i.ROWNR}, ${e.length} as ${i.ROWGROUPINDEX} , 'ENTRY' as ${i.TYPE}, '${t.rowGroup||"NO_GROUP"}' as ${i.ROWGROUP}, ${o} ${n.length>0?",".concat(n):""} FROM ? ${s} GROUP BY ${o} ORDER BY ${r[0]}) t WHERE t.rowNr > ${this.config.limit}`)}createDataRow(t,e,o,n,s,r,l){t.push(`SELECT ROWNUM() AS ${i.ROWNR},\n ${t.length} as ${i.ROWGROUPINDEX},\n 'ENTRY' as ${i.TYPE},\n '${e.rowGroup||"NO_GROUP"}' as ${i.ROWGROUP},\n '${i.CATEGORYINDEX}',\n ${o} ${n.length>0?",".concat(n):""}\n FROM ? ${s}\n GROUP BY ${o}\n ORDER BY ${r[0]} ${l}`)}createGroupHeaderRow(t,e){!0===this.config.grouped&&e.push(`SELECT ROWNUM() AS ${i.ROWNR},\n ${e.length} as ${i.ROWGROUPINDEX},\n 'GROUPHEAD' as ${i.TYPE},\n '${t.rowGroup}' as ${i.ROWGROUP} ${this.config.showGroupTitle?`,'${t.rowGroup}' as ${i.CATEGORY}`:""}\n FROM ?\n GROUP BY '1'`)}createGroupSumRow(t,e,o,n,s){!0!==this.config.grouped||y.SUM!==this.config.type&&y.SUMNOTOTAL!==this.config.type&&y.OPT!==this.config.type&&y.OPTNOTOTAL!==this.config.type||(t.push(`SELECT ${t.length} as ${i.ROWGROUPINDEX},\n '=' as ${i.OPERATION},\n '${o.rowGroup}' as ${i.ROWGROUP},\n ROWNUM() AS ${i.ROWNR},\n 'GROUP_SUM' as ${i.TYPE} ${n.length>0?",".concat(n):""}\n FROM ?\n WHERE ${i.ROWGROUP} = '${o.rowGroup}'\n ORDER BY ${s[0]} `),e.push(`SELECT ${t.length} as ${i.ROWGROUPINDEX},\n '=' as ${i.OPERATION},\n '${o.rowGroup}' as ${i.ROWGROUP},\n ROWNUM() AS ${i.ROWNR},\n 'GROUP_SUM' as ${i.TYPE} ${n.length>0?",".concat(n):""}\n FROM ?\n WHERE ${i.ROWGROUP} = '${o.rowGroup}'\n ORDER BY ${s[0]} `))}createTotalSumRow(t,e,o){if(y.SUM===this.config.type||y.OPT===this.config.type){const e=`${this.hasPartOf&&!1===this.config.grouped?`${this.i18n.get("SUM_TOTAL")||"SUM_TOTAL"} `:""}${this.config.title}`;t.push(`SELECT ${t.length} as ${i.ROWGROUPINDEX},\n '${e}' as ${i.ROWGROUP},\n '=' as ${i.OPERATION},\n 'SUM' as ${i.TYPE} ${o.length>0?",".concat(o):""}\n FROM ? `)}e.push(`SELECT ${t.length} as ${i.ROWGROUPINDEX},\n 'SUM_TOTAL' as ${i.ROWGROUP},\n '=' as ${i.OPERATION},\n 'SUM' as ${i.TYPE} ${o.length>0?",".concat(o):""}\n FROM ? `)}reduceResDrillByCategoryGroups(t,e){const o=new Map;return t.forEach((function(t){const n=t.rowNr+t.rowGroup+t.type+t.category;if(o.has(n)){const s=o.get(n);e.forEach((e=>{try{s[e]+=t[e]}catch(t){console.error("DataQuery: drill row aggregation failed",e,t)}}))}else o.set(n,t)})),[...o.values()]}injectDrillRowsToResultRows(t,e){const o=new Map;if(!0===this.config.grouped)t.forEach((function(t){e.forEach((function(e){const n=e.findIndex((e=>e.category===t.category&&e.rowGroup===t.rowGroup));if(n>=0){if(o.has(`${t.category}_${t.rowGroup}`)){const e=o.get(`${t.category}_${t.rowGroup}`)||0;o.set(`${t.category}_${t.rowGroup}`,e+1)}else o.set(`${t.category}_${t.rowGroup}`,1);t[i.ROWNR]=o.get(`${t.category}_${t.rowGroup}`),e.splice(n+t[i.ROWNR],0,t)}}))}));else{const n=this.findDuplicateSubCategories(t);t.forEach((function(t){e.forEach((function(e){const s=e.findIndex((e=>null!=e.category&&e.category===t.category));if(s>=0){if(o.has(`${t.category}`)){const e=o.get(`${t.category}`)||0;o.set(`${t.category}`,e+1)}else o.set(`${t.category}`,1);(1===t[i.ROWNR]||n.includes(t.subCategory))&&(t.subCategory=`${t.subCategory} (${t.rowGroup})`),e.splice(s+t[i.ROWNR],0,t)}}))}))}}createThereOfDrillRows(t,e,o,n){if(void 0===this.config.thereOf||0===this.config.thereOf.length)return;const s=[],r=[];this.config.thereOf.forEach((o=>{let n=!0,r="1 <> 1 OR ( ";null!=o.category&&0!==o.category.length&&o.category.trim()&&(r+=` ${i.CATEGORY} = '${o.category}'`,n=!1),null!=o.rowGroup&&0!==o.rowGroup.length&&o.rowGroup.trim()&&(r+=` ${n?"":"AND"} ${i.ROWGROUP} = '${o.rowGroup}'`,n=!1),null!=o.subCategory&&0!==o.subCategory.length&&o.subCategory.trim()&&(r+=` ${n?"":"AND"} ${i.SUBCATEGORY} = '${o.subCategory}'`),r+=")",s.push(`SELECT ROWNUM() AS ${i.ROWNR},\n null as operation,\n 'DRILLELEMENT' as ${i.TYPE},\n ${i.CATEGORY},\n ${i.SUBCATEGORY},\n ${i.ROWGROUP} as ${i.ROWGROUP},\n ${t}\n FROM ?\n WHERE ${r}\n GROUP BY ${i.ROWGROUP}, ${i.CATEGORY}, ${i.SUBCATEGORY}\n ORDER BY ${e[1]}`)})),s.forEach((function(t){r.push(...v(t,[o]))})),this.injectDrillRowsToResultRows(r,n)}calculateRelativeVariances(t,e){t.forEach((t=>{t.forEach((t=>{"GROUPHEAD"!==t[i.TYPE]&&e.forEach(((e,o)=>{t[o]=t[o]/t[e]}))}))}))}calculateColumnGroupRest(t,e){if(null==e||0===e.size)return;const o=new Map,n=new Map;e.forEach(((t,e)=>{const s=t,r=[];for(const t of s)r.push(`${e}##${t.name}`);o.set(e,r),n.set(`${e}##REST`,!1)})),t.forEach((t=>{t.forEach((t=>{"GROUPHEAD"!==t[i.TYPE]&&o.forEach(((e,o)=>{let s=0;e.forEach((e=>{void 0!==t[e]&&(s+=t[e])})),t[`${o}##REST`]=t[o]-s,0!==t[`${o}##REST`]&&n.set(`${o}##REST`,!0)}))}))}));const s=Array.from(n.entries()).filter((([t,e])=>!e)).map((([t])=>t));t.forEach((t=>{t.forEach((t=>{for(const e of s)delete t[e]}))}))}getRelativeScenarios(){const t=new Map;return this.config.scenarios.forEach((e=>{const o=this.createRelativeScenario(e);null!=o&&t.set(o.key,o.value)})),t}translateScenarioSQL(t,e,o){const n=new l(t);return y.OPT===o||y.OPTNOTOTAL===o?n.isValid?"dr"===n.type?`SUM(${n.base} - ${n.delta}) as ${t}, SUM(${n.delta}) as dr_${n.delta}`:`SUM(${n.base} - ${n.delta}) as ${t}`:e?`SUM(${t} * transformOperator(operation)) as ${t}, COUNT(ISNULL(${t})) as ${t}_cnt`:`SUM(${t}) as ${t}, COUNT(ISNULL(${t})) as ${t}_cnt`:n.isValid?"dr"===n.type?`SUM((${n.base} * transformOperator(operation)) - (${n.delta} * transformOperator(operation))) as ${t}, SUM(${n.delta} * transformOperator(operation)) as dr_${n.delta}`:`SUM((${n.base} * transformOperator(operation))- (${n.delta} * transformOperator(operation))) as ${t}`:`SUM(${t} * transformOperator(operation)) as ${t}, COUNT(ISNULL(${t})) as ${t}_cnt`}createOrderString(t){return[`${t.hierarchy.toString()} ${t.direction}`,`${t.hierarchy.toString()} ${M.ASC===t.direction?M.DESC:M.ASC}`]}createRelativeScenario(t){const e=new l(t);return e.isValid&&"dr"===e.type?{key:`${t}`,value:`dr_${e.delta}`}:null}exctractScenarioNames(t){const e=[];return t.split(",").forEach((t=>t.length>=2?e.push(t.split("as")[1].trim()):null)),e}findDuplicateSubCategories(t){const e=t.map((t=>({count:1,subCategory:t.subCategory}))).reduce(((t,e)=>(t[e.subCategory]=(t[e.subCategory]||0)+e.count,t)),{});return Object.keys(e).filter((t=>e[t]>1))}createPartOfQuery(t,e){var o;const n=[];let s="1 <> 1 ",r=` ${i.ROWGROUP}`,l="ROWNUM()";return null===(o=this.config.partOf)||void 0===o||o.forEach((t=>{s+=`OR (${i.CATEGORY} = '${t.category}'`,null!=t.rowGroup&&0!==t.rowGroup.length&&t.rowGroup.trim()&&(s+=`and ${i.ROWGROUP} = '${t.rowGroup}'`),!1===this.config.grouped&&(r=` 'SUM_TOTAL' as ${i.ROWGROUP} `,l="1"),s+=")"})),n.push(`SELECT ${l} AS ${i.ROWNR},\n 'PARTELEMENT' as ${i.TYPE},\n ${i.CATEGORY},\n ${r},\n ${t}\n FROM ?\n WHERE ${s}\n GROUP BY ${i.ROWGROUP}, ${i.CATEGORY}, ${i.TYPE}\n ORDER BY ${e[1]}`),n}checkConfigForPartOf(){return null!=this.config.partOf&&0!==this.config.partOf.length}createThereOfDrillColumns(t,e,o){if(null==t||0===t.size)return;const n=[],s=[];t.forEach(((t,e)=>{let o="1 <> 1 ";t.forEach((t=>{o+=` or columnGroup = '${t.name}' `})),n.push(`SELECT 'ENTRY' as rowlevel,\n 'COLUMNGROUP' as columnlevel,\n rowGroup,\n category,\n columnGroup,\n '${e}' as scenario,\n sum(${e} * transformOperator(operation)) as val\n FROM ?\n WHERE ${o}\n GROUP BY rowlevel, rowGroup, category, columnGroup, scenario`),n.push(`SELECT 'ENTRY' as rowlevel,\n 'SUBGROUP' as columnlevel,\n rowGroup,\n category,\n columnGroup,\n columnSubGroup,\n '${e}' as scenario,\n sum(${e} * transformOperator(operation)) as val\n FROM ?\n WHERE ${o}\n GROUP BY rowlevel, rowGroup, category, columnGroup, columnSubGroup, scenario`),n.push(`SELECT 'DRILLELEMENT' as rowlevel,\n 'COLUMNGROUP' as columnlevel,\n rowGroup,\n category,\n subCategory,\n columnGroup,\n '${e}' as scenario,\n sum(${e} * transformOperator(operation)) as val\n FROM ?\n WHERE ${o}\n GROUP BY rowlevel, rowGroup, category, subCategory, columnGroup, scenario`),n.push(`SELECT 'DRILLELEMENT' as rowlevel,\n 'SUBGROUP' as columnlevel,\n rowGroup,\n category,\n subCategory,\n columnGroup,\n columnSubGroup,\n '${e}' as scenario,\n sum(${e} * transformOperator(operation)) as val\n FROM ?\n WHERE ${o}\n GROUP BY rowlevel, rowGroup, category, subCategory, columnGroup, columnSubGroup, scenario`),n.push(`SELECT 'GROUP_SUM' as rowlevel,\n 'COLUMNGROUP' as columnlevel,\n rowGroup,\n columnGroup,\n '${e}' as scenario,\n sum(${e} * transformOperator(operation)) as val\n FROM ?\n WHERE ${o}\n GROUP BY rowlevel, rowGroup, columnGroup, scenario`),n.push(`SELECT 'GROUP_SUM' as rowlevel,\n 'SUBGROUP' as columnlevel,\n rowGroup,\n columnGroup,\n columnSubGroup,\n '${e}' as scenario,\n sum(${e} * transformOperator(operation)) as val\n FROM ?\n WHERE ${o}\n GROUP BY rowlevel, rowGroup, columnGroup, columnSubGroup, scenario`),n.push(`SELECT 'SUM' as rowlevel,\n 'COLUMNGROUP' as columnlevel,\n columnGroup,\n '${e}' as scenario,\n sum(${e} * transformOperator(operation)) as val\n FROM ?\n WHERE ${o}\n GROUP BY rowlevel, columnGroup, scenario`),n.push(`SELECT 'SUM' as rowlevel,\n 'SUBGROUP' as columnlevel,\n columnGroup,\n columnSubGroup,\n '${e}' as scenario,\n sum(${e} * transformOperator(operation)) as val\n FROM ?\n WHERE ${o}\n GROUP BY rowlevel, columnGroup, columnSubGroup, scenario`)}));for(const t of n)s.push(...v(t,[e]));this.injectDrillColumnsToResultRows(s,o)}injectDrillColumnsToResultRows(t,e){const o="##";for(const n of t)for(const t of e)for(const e of t)e.type===n.rowlevel&&("ENTRY"===n.rowlevel?"COLUMNGROUP"===n.columnlevel&&e.category===n.category?e[n.scenario+o+n.columnGroup]=n.val:"SUBGROUP"===n.columnlevel&&e.category===n.category&&(e[n.scenario+o+n.columnGroup+o+n.columnSubGroup]=n.val):"DRILLELEMENT"===n.rowlevel?"COLUMNGROUP"===n.columnlevel&&e.category===n.category&&e.subCategory===n.subCategory?e[n.scenario+o+n.columnGroup]=n.val:"SUBGROUP"===n.columnlevel&&e.category===n.category&&e.subCategory===n.subCategory?e[n.scenario+o+n.columnGroup+o+n.columnSubGroup]=n.val:"COLUMNGROUP"===n.columnlevel&&e.category===n.category&&e.subCategory===`${n.subCategory} (${n.rowGroup})`?e[n.scenario+o+n.columnGroup]=n.val:"SUBGROUP"===n.columnlevel&&e.category===n.category&&e.subCategory===`${n.subCategory} (${n.rowGroup})`&&(e[n.scenario+o+n.columnGroup+o+n.columnSubGroup]=n.val):("SUM"===n.rowlevel||"GROUP_SUM"===n.rowlevel)&&("COLUMNGROUP"===n.columnlevel&&e.category===n.category&&e.subCategory===n.subCategory&&(e[n.scenario+o+n.columnGroup]=n.val),"SUBGROUP"===n.columnlevel&&e.category===n.category&&e.subCategory===n.subCategory&&(e[n.scenario+o+n.columnGroup+o+n.columnSubGroup]=n.val)))}}class H{constructor(){this.normalizedHeader=[]}createHeader(t,e,o,n,s,i){const l=[];this.normalizedHeader=this.normalizeHeader(t,e);const a=new T(0,0,U.HEADER),c=new T(1,0,U.SEPERATORLINE);for(const t of this.normalizedHeader)a.createElement(r.translateScenarioLabel(t.name,o),t.type,this.createColumnType(t),null,this.setHeaderPrefix(t,o,n,s,i),null,null,null,null),c.createElement(null,t.type,this.createColumnType(t),null,null,null,null,null,null);return l.push(a),l.push(c),l}setHeaderPrefix(t,e,o,n,s){let i="";return"category"===t.name&&s&&(0===o.prefix.length&&0===n.length||(i=r.translateScenarioLabel("in",e)+" "+o.prefix+n)),t.order&&(i+=r.translateScenarioLabel("ORDER_"+t.order,e)),i}normalizeHeader(t,e){let o=[{name:i.CATEGORY,group:i.CATEGORY,type:i.CATEGORY,order:void 0}];return y.OPT!==t&&y.OPTNOTOTAL!==t||(o=[{name:i.OPERATION,group:i.OPERATION,type:i.OPERATION,order:void 0},{name:i.CATEGORY,group:i.CATEGORY,type:i.CATEGORY,order:void 0}]),[...o,...e]}createBodyRows(t,e,o){const n=[];let s=-1;const r=new W(t,e).execute(o),i=this.calculateColumnStatistics(r,t.barColumns);for(const o of r)s+=1,n.push(...this.createRow(t.i18n,e,t.scenariosUnitType,o,s,-1,t.categoryWidth,t.measureScale,t.barColumns,i));return n}calculateColumnStatistics(t,e){const o=new Map;if(!e||0===e.length)return o;const n=new Map;for(const t of e)o.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)for(const s of e){const e=this.extractColumnValue(t,s);if(null!==e&&!isNaN(e)){const t=o.get(s);t.min=Math.min(t.min,e),t.max=Math.max(t.max,e),n.get(s).push(Math.abs(e))}}for(const[t,e]of o){e.min!==1/0&&e.max!==-1/0||(e.min=0,e.max=0),e.absMax=Math.max(Math.abs(e.min),Math.abs(e.max));const s=n.get(t);if(s.length>0){s.sort(((t,e)=>t-e));const t=Math.floor(s.length/2);e.median=s.length%2==0?(s[t-1]+s[t])/2:s[t]}o.set(t,e)}return o}extractColumnValue(t,e){if(void 0!==t[e]){const o=Number(t[e]);return isNaN(o)?null:o}for(const o of Object.keys(t))if(o===e||o.endsWith("##"+e)||o===e+"##"+e){const e=Number(t[o]);if(!isNaN(e))return e}return null}createRow(t,e,o,n,s,r,l,a,c,h){var u;const d=[];for(const f of n){const p=f[i.ROWGROUP],m=f[i.SUBCATEGORY],$=f[i.TYPE],v=f[i.ROWNR]>=2,g=this.createDetailRow($,r+=1,s,n.length);for(const n of this.normalizedHeader){const s=this.getRawDataRowElement(f,n),r=null!==(u=null==c?void 0:c.includes(n.type))&&void 0!==u&&u,i=r?null==h?void 0:h.get(n.type):void 0;g.createElement(this.translateSumCellLabel(t,e,s,p,m,$,n.type),n.type,this.createColumnType(n),this.setCellType(n.type,o),this.translateCellPrefix(e,$,n.type),this.translateScenarioCSS(n.type,s),v,l,null==a?void 0:a.value,r,i)}d.push(g)}return d}getRawDataRowElement(t,e){return e.name===e.group&&e.name===e.type?t[e.name]:e.name===e.group&&e.name!==e.type?t[e.type+"##"+e.name]:t[e.type+"##"+e.group+"##"+e.name]}createDetailRow(t,e,o,n){switch(t){case U.GROUPHEAD:return new T(e,o,U.HEADER);case U.SUM:case U.GROUPSUM:return new T(n+2,o,U.SUM);case U.DRILLELEMENT:return new T(n+2,o,U.DRILLELEMENT);case U.PARTELEMENT:return new T(n+2,o,U.PARTELEMENT);default:return new T(e,o,U.STANDARD)}}translateSumCellLabel(t,e,o,n,s,r,i){return!1===Number.isNaN(Number(o))||this.isOperationColumn(i)?o:this.isGroupHeadCategory(r,i)||this.isEntryCategory(r,i)?t===h.ALL?`${e.get(o)||o}`:o:this.isDrillElementCategory(r,i)?t===h.ALL?`${e.get(s)||s}`:`${s}`:this.isPartElementCategory(r,i)?t===h.ALL||"SUM_TOTAL"===n?`${e.get(n)||n}`:`${n}`:this.isSumElementCategory(r,i)?t===h.ALL||"SUM_TOTAL"===n?`${e.get(n)||n}`:n:"GROUPHEAD"===r&&null==o?o:Number.isNaN(Number(o))?"-":Number(o)}isOperationColumn(t){return"operation"===t}translateScenarioCSS(t,e){const o=new l(t);let n="pos";return e<0&&(n="neg"),o.isValid?n+"_"+o.direction+("dr"===o.type?" relative_variance":""):t}setCellType(t,e){if("category"===t)return"";let o;const n=new l(t);return e===u.PERCENT?(o="percent",n.isValid&&"d"===n.type&&(o="decimal")):(o="decimal",n.isValid&&"dr"===n.type&&(o="percent")),o}isDrillElementCategory(t,e){return"DRILLELEMENT"===t&&"category"===e}isPartElementCategory(t,e){return"PARTELEMENT"===t&&"category"===e}isSumElementCategory(t,e){return("GROUP_SUM"===t||"SUM"===t)&&"category"===e}isEntryCategory(t,e){return"ENTRY"===t&&"category"===e}isGroupHeadCategory(t,e){return"GROUPHEAD"===t&&"category"===e}translateCellPrefix(t,e,o){return this.isOperationColumn(o)||this.isGroupHeadCategory(e,o)||this.isEntryCategory(e,o)?null:this.isDrillElementCategory(e,o)?`${t.get("there_of")} `:this.isPartElementCategory(e,o)?`${t.get("part_of")} `:null}createColumnType(t){return t.name===t.group&&t.name===t.type?"base":t.name===t.group?"columnGroup":"columnSubGroup"}}class I{constructor(t,e,o){this.data=[],this.headerRows=[],this.bodyRows=[],this.ruleSet=t||new a,this.dataSetFactory=new H,this.config=this.initConfig(o),this.i18n=this.initI18n(new Map),this.setData(e,o.filter),this.state=O.DIRTY}setI18n(t){this.i18n=this.initI18n(t)}initI18n(t){const e=new Map([["",""],["SEPERATOR_WS",", "],["in","in"],["ORDER_asc","↑"],["ORDER_desc","↓"],["ac1","AC"],["pp1","PY"],["fc1","FC"],["pl1","PL"],["ac2","AC2"],["pp2","PY2"],["fc2","FC2"],["pl2","PL2"],["ac3","AC3"],["pp3","PY3"],["fc3","FC3"],["pl3","PL3"],["ac4","AC4"],["pp4","PY4"],["fc4","FC4"],["pl4","PL4"],["in","in"],["category"," "],["operation"," "],["there_of","davon"],["part_of","in % von"],["ibcssymbol_delta_ac","Δ{%}"],["ibcssymbol_delta_generic","Δ({%})"],["ibcssymbol_delta_ac_relative","Δ{%}%"],["ibcssymbol_delta_generic_relative","Δ({%})%"],["SUM_TOTAL","❖"]]);return this.state=O.DIRTY,new Map([...e,...t||new Map])}initConfig(t){this.state=O.DIRTY;const e=t,o=this;return t.scenarios.sort(((t,e)=>o.ruleSet.getScenarioSorIndex(t)-o.ruleSet.getScenarioSorIndex(e))),e}setConfig(t){this.config=this.initConfig(t)}setData(t,e){if(null==t)return;if(null!=e&&e.length>0)try{this.data=v(`SELECT * FROM ? WHERE ${e}`,[t])}catch(o){console.error("Table: filter query failed, using unfiltered data",e,o),this.data=t}else this.data=t;const o=this.normalizeScenarios(this.config.scenarios,this.config.categoryThereOf,this.config.sortOrder);this.headerRows=this.dataSetFactory.createHeader(this.config.type,o,this.i18n,this.config.measureScale,this.config.measureUnit,this.config.showMeasureScale),this.bodyRows=this.dataSetFactory.createBodyRows(this.config,this.i18n,this.data),this.state=O.UP_TO_DATE}update(){const t=this.normalizeScenarios(this.config.scenarios,this.config.categoryThereOf,this.config.sortOrder);this.headerRows=this.dataSetFactory.createHeader(this.config.type,t,this.i18n,this.config.measureScale,this.config.measureUnit,this.config.showMeasureScale),this.bodyRows=this.dataSetFactory.createBodyRows(this.config,this.i18n,this.data),this.state=O.UP_TO_DATE}getHeader(){return this.state===O.DIRTY&&this.update(),this.headerRows}getBody(){return this.state===O.DIRTY&&this.update(),this.bodyRows}normalizeScenarios(t,e,o){var n;const s=[];for(const r of t){if(null==e?void 0:e.has(r)){const t=e.get(r);for(const e of t){s.push({name:e.name,group:e.name,type:r,order:void 0});for(const t of e.subGroups)s.push({name:t,group:e.name,type:r,order:void 0})}s.push({name:"REST",group:"REST",type:r,order:void 0})}let t;(null===(n=null==o?void 0:o.hierarchy)||void 0===n?void 0:n.at(0))===r&&(t=o.direction),s.push({name:r,group:r,type:r,order:t})}return s}hasNoData(){return 0===this.data.length}}class z{constructor(){this.title="",this.scenarios=[],this.scenariosUnitType=u.DECIMAL,this.grouped=!1,this.showGroupTitle=!0,this.thereOf=[],this.categoryThereOf=new Map,this.partOf=[],this.sortOrder=new p(new c).default(),this.type=y.LIST,this.limit=0,this.i18n=h.ALL,this.categoryWidth=m.W25,this.measureScale=new R,this.measureUnit="",this.measureType=$.VOLUME,this.showMeasureScale=!0,this.filter="",this.barColumns=[]}}class j{constructor(t,e,o,n){this.tableDrillGroupAdapter=t,this.stringAdapter=e,this.orderAdapter=o,this.dataSet=n}adapt(t){const e=new z;return d.isString(t.title)&&(e.title=t.title),d.isArray(t.scenarios)&&(e.scenarios=f.adaptArray(t.scenarios,this.stringAdapter)),d.isExisting(t.scenariosUnitType)&&(e.scenariosUnitType=t.scenariosUnitType),d.isBoolean(t.grouped)&&(e.grouped=t.grouped),d.isBoolean(t.showGroupTitle)&&(e.showGroupTitle=t.showGroupTitle),d.isBoolean(t.showMeasureScale)&&(e.showMeasureScale=t.showMeasureScale),d.isArray(t.thereOf)&&(e.thereOf=f.adaptArray(t.thereOf,this.tableDrillGroupAdapter)),d.isExisting(t.categoryThereOf)&&(e.categoryThereOf=t.categoryThereOf),d.isArray(t.partOf)&&(e.partOf=f.adaptArray(t.partOf,this.tableDrillGroupAdapter)),d.isExisting(t.order)&&(e.sortOrder=this.orderAdapter.adapt(t.order)),d.isExisting(t.type)&&(e.type=t.type),d.isNumber(t.limit)&&(e.limit=t.limit),d.isExisting(t.i18n)&&(e.i18n=t.i18n),d.isExisting(t.categoryWidth)&&(e.categoryWidth=t.categoryWidth),d.isExisting(t.measureScale)&&(e.measureScale=g.calculateMeasureScale(this.dataSet,e.scenarios,t.measureScale)),d.isExisting(t.measureType)&&(e.measureType=t.measureType),d.isString(t.measureUnit)&&(e.measureUnit=t.measureUnit),d.isString(t.filter)&&(e.filter=t.filter.trim()),d.isArray(t.barColumns)&&(e.barColumns=t.barColumns),e}default(){return new z}}class V{constructor(){this.rowGroup="",this.category="",this.subCategory="",this.partOf=""}}class Q{constructor(){}adapt(t){const e=new V;return d.isString(t.rowGroup)&&(e.rowGroup=t.rowGroup),d.isString(t.category)&&(e.category=t.category),d.isString(t.subCategory)&&(e.subCategory=t.subCategory),d.isString(t.partOf)&&(e.partOf=t.partOf),e}default(){return new V}}class q{constructor(){this.operation="+"}addRowGroup(t,e){this.rowGroup=t,this.rowGroupIndex=e}addCategory(t,e){this.category=t,this.categoryIndex=e}addSubCategory(t,e){this.subCategory=t,this.subCategoryIndex=e}addColumnGroup(t,e){this.columnGroup=t,this.columnGroupIndex=e}addSubColumnGroup(t,e){this.columnSubGroup=t,this.columnSubGroupIndex=e}}class K{constructor(){}adapt(t){const e=new q;return d.isOperator(t.operation)&&(e.operation=t.operation),d.isNumber(t.rowGroupIndex)&&d.isString(t.rowGroup)&&e.addRowGroup(t.rowGroup,t.rowGroupIndex),d.isNumber(t.categoryIndex)&&d.isString(t.category)&&e.addCategory(t.category,t.categoryIndex),d.isNumber(t.subCategoryIndex)&&d.isString(t.subCategory)&&e.addSubCategory(t.subCategory,t.subCategoryIndex),d.isNumber(t.columnGroupIndex)&&d.isString(t.columnGroup)&&e.addColumnGroup(t.columnGroup,t.columnGroupIndex),d.isNumber(t.columnSubGroupIndex)&&d.isString(t.columnSubGroup)&&e.addSubColumnGroup(t.columnSubGroup,t.columnSubGroupIndex),this.setActualValues(t,e),this.setPlanValues(t,e),this.setPreviousPeriodValues(t,e),this.setForecastValues(t,e),e}default(){return new q}setActualValues(t,e){d.isNumber(t.ac1)&&(e.ac1=t.ac1),d.isNumber(t.ac2)&&(e.ac2=t.ac2),d.isNumber(t.ac3)&&(e.ac3=t.ac3),d.isNumber(t.ac4)&&(e.ac4=t.ac4)}setPlanValues(t,e){d.isNumber(t.pp1)&&(e.pp1=t.pp1),d.isNumber(t.pp2)&&(e.pp2=t.pp2),d.isNumber(t.pp3)&&(e.pp3=t.pp3),d.isNumber(t.pp4)&&(e.pp4=t.pp4)}setPreviousPeriodValues(t,e){d.isNumber(t.pl1)&&(e.pl1=t.pl1),d.isNumber(t.pl2)&&(e.pl2=t.pl2),d.isNumber(t.pl3)&&(e.pl3=t.pl3),d.isNumber(t.pl4)&&(e.pl4=t.pl4)}setForecastValues(t,e){d.isNumber(t.fc1)&&(e.fc1=t.fc1),d.isNumber(t.fc2)&&(e.fc2=t.fc2),d.isNumber(t.fc3)&&(e.fc3=t.fc3),d.isNumber(t.fc4)&&(e.fc4=t.fc4)}}const J=e(class extends o{constructor(t){super(),!1!==t&&this.__registerHost(),this.__attachShadow(),this.data=[],this.tableTitle="SUM_TOTAL",this.scenarios=[],this.scenariosDataFormat=u.DECIMAL,this.grouped=!1,this.limit=0,this.showGroupTitle=!0,this.thereof=[],this.partof=[],this.order={hierarchy:[],direction:M.ASC},this.categorythereof=new Map,this.type=y.LIST,this.categoryWidth=m.INF,this.dataFormatDigits={percent:2,decimal:1},this.i18n=new Map,this.i18nMode=h.ALL,this.measureScale="_",this.measureUnit="",this.showMeasureScale=!0,this.measureType=$.VOLUME,this.filter="",this.barColumns=[],this.barColumnMaxWidth=30,this.unitScaling=.01,this.percentageScaling=.5,this.scaleFactor=1,this.componentDataFormatDigits=new w,this.componentStyle=S(this)}render(){return t(n,null,(()=>{if(void 0!==this.table){if(this.table.hasNoData()){const e=this.i18n.get("NO_DATA")||"==No Data==";return t("p",{class:"warning"},e)}return t("table",null,t("thead",null,this.table.getHeader().map((e=>t("tr",{class:e.cssStyle},e.getCells().map((e=>t("th",{colSpan:e.colSpan,class:e.cssStyle},e.getAsHeaderList().map(((o,n,s)=>t("span",null,n===s.length-1?t("span",{class:" "===o?"table-footer":""},o,e.drawPrefix()," "):t("span",null,o,e.drawPrefix(),t("br",null)))))))))))),t("tbody",null,this.table.getBody().map((e=>t("tr",{class:e.cssStyle},null==e?void 0:e.getCells().map((e=>t("td",{colSpan:e.colSpan,class:e.type?`${e.cssStyle} ${e.type}`:e.cssStyle},null!=e.prefix?t("span",{class:e.cssStyle+" "+e.prefixStyle},e.drawPrefix()):"",e.isBarChart&&e.columnStats?t(F,{value:e.value,scenario:e.key,columnStats:e.columnStats,height:18*this.scaleFactor,isRelative:e.key.startsWith("dr"),isPositiveGood:e.key.endsWith("_pos"),measureScale:e.measureScale,maxBarWidth:this.barColumnMaxWidth,styles:this.barChartStyles}):e.draw(this.componentDataFormatDigits)))))))))}})())}componentWillRender(){const t=this.prepareConfig(),e=this.prepareData();this.componentDataFormatDigits=(new b).adapt(this.dataFormatDigits),this.barChartStyles=this.prepareBarChartStyles(),this.table=new I(new a,e,t),this.table.setI18n(this.i18n)}prepareConfig(){return new j(new Q,new c,new p(new c),this.data).adapt({title:this.tableTitle,scenarios:this.scenarios,scenariosUnitType:this.scenariosDataFormat,grouped:this.grouped,showGroupTitle:this.showGroupTitle,thereOf:this.thereof,partOf:this.partof,categoryThereOf:this.categorythereof,order:this.order,type:this.type,limit:this.limit,i18n:this.i18nMode,categoryWidth:this.categoryWidth,measureScale:this.measureScale,measureUnit:this.measureUnit,measureType:this.measureType,showMeasureScale:this.showMeasureScale,filter:this.filter,barColumns:this.barColumns})}prepareData(){return f.adaptArray(this.data,new K)}prepareBarChartStyles(){return this.componentStyle((t=>{var e,o,n,s,r,i,l,a,c,h,u,d,f,p,m,$,v,g,R,w,b,S,E,O,y,M;const U=null===(e=t["bn-chart-time"])||void 0===e?void 0:e.varianceStyles,G=null===(o=t["bn-chart-time"])||void 0===o?void 0:o.barStyles;return{positive:{stroke:(null===(n=null==U?void 0:U.pos)||void 0===n?void 0:n.stroke)||"#008f96",fill:(null===(s=null==U?void 0:U.pos)||void 0===s?void 0:s.fill)||"#008f96",fillpattern:(null===(r=null==U?void 0:U.pos)||void 0===r?void 0:r.fillpattern)||"solid"},negative:{stroke:(null===(i=null==U?void 0:U.neg)||void 0===i?void 0:i.stroke)||"#ff0000",fill:(null===(l=null==U?void 0:U.neg)||void 0===l?void 0:l.fill)||"#ff0000",fillpattern:(null===(a=null==U?void 0:U.neg)||void 0===a?void 0:a.fillpattern)||"solid"},neutral:{stroke:(null===(c=null==U?void 0:U.neu)||void 0===c?void 0:c.stroke)||"#808080",fill:(null===(h=null==U?void 0:U.neu)||void 0===h?void 0:h.fill)||"#808080",fillpattern:(null===(u=null==U?void 0:U.neu)||void 0===u?void 0:u.fillpattern)||"outlined"},scenarios:{ac:{stroke:(null===(d=null==G?void 0:G.ac)||void 0===d?void 0:d.stroke)||"#404040",fill:(null===(f=null==G?void 0:G.ac)||void 0===f?void 0:f.fill)||"#404040",fillpattern:(null===(p=null==G?void 0:G.ac)||void 0===p?void 0:p.fillpattern)||"solid"},pp:{stroke:(null===(m=null==G?void 0:G.pp)||void 0===m?void 0:m.stroke)||"#A6A6A6",fill:(null===($=null==G?void 0:G.pp)||void 0===$?void 0:$.fill)||"#A6A6A6",fillpattern:(null===(v=null==G?void 0:G.pp)||void 0===v?void 0:v.fillpattern)||"solid"},fc:{stroke:(null===(g=null==G?void 0:G.fc)||void 0===g?void 0:g.stroke)||"#404040",fill:(null===(R=null==G?void 0:G.fc)||void 0===R?void 0:R.fill)||"#ffffff",fillpattern:(null===(w=null==G?void 0:G.fc)||void 0===w?void 0:w.fillpattern)||"hatched"},pl:{stroke:(null===(b=null==G?void 0:G.pl)||void 0===b?void 0:b.stroke)||"#404040",fill:(null===(S=null==G?void 0:G.pl)||void 0===S?void 0:S.fill)||"#ffffff",fillpattern:(null===(E=null==G?void 0:G.pl)||void 0===E?void 0:E.fillpattern)||"outlined"}},fontColor:(null===(O=t.global)||void 0===O?void 0:O.fontColor)||"#000000",fontSize:.85*((null===(y=t.global)||void 0===y?void 0:y.fontSizePx)||13.3333)*this.scaleFactor,fontFamily:(null===(M=t.global)||void 0===M?void 0:M.fontFamily)||"'Noto Sans', sans-serif",unitScaling:this.unitScaling,percentageScaling:this.percentageScaling,scaleFactor:this.scaleFactor}}))}get element(){return this}static get style(){return':host{position:relative;display:inline-block}table{background-color:var(--bn-font-background, white);font-size:var(--bn-font-size, 1em);color:var(--bn-font-color, black);font-family:var(--bn-font-family, "Noto Sans", "Helvetica Neue", Helvetica, sans-serif);border-spacing:0.3em 0}thead{border-style:none}tr:first-child td{border-top:none;padding-top:0.5em}td.ac1,td.ac2,td.ac3,td.ac4,td.pp1,td.pp2,td.pp3,td.pp4,td.pl1,td.pl2,td.pl3,td.pl4,td.fc1,td.fc2,td.fc3,td.fc4,td.share,td.variance,td.pos_pos,td.pos_neg,td.neg_pos,td.neg_neg,td.pos_neutral,td.neg_neutral{text-align:right}.category-w100{min-width:100em;max-width:100em}.category-w50{min-width:50em;max-width:50em}.category-w25{min-width:25em;max-width:25em}.category-w20{min-width:20em;max-width:20em}.category-w15{min-width:15em;max-width:15em}.category-w10{min-width:10em;max-width:10em}.category-w5{min-width:5em;max-width:5em}.prefix-second{color:transparent;font-style:normal}.prefix-first{font-style:normal}th{border-bottom:0.1em solid black;text-align:right;font-weight:normal;vertical-align:text-top}td.columnGroup,th.columnGroup{font-size:0.6em}td.columnSubGroup,th.columnSubGroup{font-size:0.6em;border-spacing:0em 0;font-style:italic}td.base,th.base{font-style:normal}th.ofit,td.ofit,tr.ofit,th.partof,td.partof,tr.partof{font-size:0.6em;font-style:italic}td.ofit,td.partof{font-size:0.6em;font-style:italic}th.ofit td,tr.ofit td,th.partof td,tr.partof td{border-top:0em solid black;padding-left:1em}th.ofit share,th.partof share,tr.share td{border-top:0em solid black}th.share,tr.share,td.share{font-size:0.6em;font-style:italic}th.filler{border-bottom:0em solid black;text-align:right}td.filler{border-top:0em none !important;border-bottom:0em none;text-align:right}th.group{text-align:center;border-spacing:1em 0}th.headerlabel{border-bottom:0em none black;padding-bottom:0em}td.variance:after{content:"%"}td.relative_variance{font-style:italic}td.percent{font-style:italic;text-align:right}td.decimal{text-align:right}td.pos_pos{color:#008f96}td.neg_pos{color:#ff0000}td.pos_neg{color:#ff0000}td.neg_neg{color:#008f96}td.pos_pos:before{content:"+"}td.pos_neg:before{content:"+"}td.pos_neu:before{content:"+"}th.ac1,th.ac2,th.ac3,th.ac4{padding-top:0em;border-bottom:0.3em solid black}th.pp1,th.pp2,th.pp3,th.pp4{padding-top:0em;border-bottom:0.3em solid grey}th.pl1,th.pl2,th.pl3,th.pl4{padding-top:0em;border-bottom:0.3em double black}th.fc1,th.fc2,th.fc3,th.fc4{border-bottom:0.3em solid;border-image:repeating-linear-gradient(-45deg, white, white, black, white, white 0.3em) 2}td.colsum{font-weight:bold}th.colsum{padding-top:0em;font-weight:bold}tr.sum td{border-top:0.1em solid black;font-weight:bold;padding-bottom:0.5em}tr.groupheader td{border-top:0em dotted #ddd;padding-top:0.5em;font-weight:bold;font-style:italic}tr.begingroup td{border-top:0em dotted #ddd;padding-top:0.5em}th.begin-group{padding-left:0.75em}th.end-group{padding-left:0.75em}td{box-sizing:border-box;-webkit-box-sizing:border-box;border-top:0.1em dashed #ddd;padding-left:0.5em;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.table-footer{font-size:0.6em}.cell-bar-chart{display:inline-block;vertical-align:middle}.bar-chart-empty{color:#999}td:has(.cell-bar-chart){padding:0 0.25em;vertical-align:middle}td:has(.cell-bar-chart).pos_pos:before,td:has(.cell-bar-chart).pos_neg:before,td:has(.cell-bar-chart).pos_neu:before{content:none}td:has(.cell-bar-chart).variance:after{content:none}'}},[1,"ibcs-table",{data:[16],tableTitle:[1,"table-title"],scenarios:[16],scenariosDataFormat:[1,"scenarios-data-format"],grouped:[4],limit:[2],showGroupTitle:[4,"show-group-title"],thereof:[16],partof:[16],order:[16],categorythereof:[16],type:[1],categoryWidth:[1,"category-width"],dataFormatDigits:[16],i18n:[1040],i18nMode:[1,"i18n-mode"],measureScale:[1,"measure-scale"],measureUnit:[1,"measure-unit"],showMeasureScale:[4,"show-measure-scale"],measureType:[1,"measure-type"],filter:[1],barColumns:[16],barColumnMaxWidth:[2,"bar-column-max-width"],unitScaling:[2,"unit-scaling"],percentageScaling:[2,"percentage-scaling"],scaleFactor:[2,"scale-factor"]}]);function X(){"undefined"!=typeof customElements&&["ibcs-table"].forEach((t=>{"ibcs-table"===t&&(customElements.get(s(t))||customElements.define(s(t),J))}))}export{J as I,y as T,X as d}
|
|
1
|
+
import{h as t,proxyCustomElement as e,HTMLElement as o,Host as n,transformTag as s}from"@stencil/core/internal/client";import{F as r,Q as i,V as l,I as a,S as c}from"./ibcsRuleSet.js";import{I as h,D as u,j as d,k as f,l as p,e as m,M as $}from"./Order.js";import{a as v}from"./alasql.min.js";import{D as g,S as R,a as w,b}from"./DataFormatDigits.js";import{w as S}from"./withComponentStyle.js";var E,O,y,M,U;!function(t){t[t.ALL=-1]="ALL"}(E||(E={})),function(t){t[t.UP_TO_DATE=0]="UP_TO_DATE",t[t.DIRTY=1]="DIRTY"}(O||(O={})),function(t){t.LIST="list",t.SUM="sum",t.SUMNOTOTAL="sumnototal",t.OPT="opt",t.OPTNOTOTAL="optnototal"}(y||(y={})),function(t){t.ASC="asc",t.DESC="desc"}(M||(M={})),function(t){t.HEADER="HEADER",t.GROUPHEAD="GROUPHEAD",t.SEPERATORLINE="SEPERATORLINE",t.SUM="SUM",t.GROUPSUM="GROUP_SUM",t.DRILLELEMENT="DRILLELEMENT",t.STANDARD="STANDARD",t.PARTELEMENT="PARTELEMENT",t.ENTRY="ENTRY"}(U||(U={}));class G{constructor(t,e,o,n,s,r,i,l,a){this.prefixStyle="prefix",this.isBarChart=!1,this.key=t,this.index=e,this.value=o,this.prefix=r||"",this.cssStyle=n||"",this.prefixStyle=i||"prefix",this.type=s,this.mark=void 0,this.colSpan=l||1,this.measureScale=a||1}getAsHeaderList(){if(null==this.value)return[""];const t=[];for(const e of this.value.toString().split("<br/>"))t.push(e);return t}draw(t){let e=this.value;if("undefined"===e||void 0===e||null==e)return"";if(Number.isNaN(Number(e)))return e;if(""===this.type||void 0===this.type||null==this.type)return e;let o=t.percent,n=t.percent;return"decimal"===this.type&&(e=+e/this.measureScale,o=t.decimal,n=t.decimal),r.number(Number(e),this.type,o,n)}drawPrefix(){return null==this.prefix?"":this.prefix}}class T{constructor(t,e,o){this.index=t,this.groupindex=e,this.type=o,this.cssStyle=this.initCssStyle(),this.elements=[]}initCssStyle(){switch(this.type){case U.HEADER:return"groupheader";case U.SEPERATORLINE:return"";case U.DRILLELEMENT:return"ofit";case U.PARTELEMENT:return"partof";case U.STANDARD:return"";case U.SUM:return"sum";default:return""}}getCells(){return this.elements}createElement(t,e,o,n,s,r,i,l,a,c=!1,h){let u=r;"category"===e&&null!=l&&(u=`category-${l.toString()}`),this.type===U.HEADER?u="headerlabel":this.type===U.SEPERATORLINE&&(u=e),this.type===U.PARTELEMENT&&("percent"===n&&(t="-"),"category"!==e&&"operation"!==e&&(n="percent",u="")),"-"===t&&(u="");let d="prefix-first";i&&(d="prefix-second"),o&&(u=`${u} ${o}`);const f=new G(e,this.elements.length,t,u,n,s,d,1,a);f.isBarChart=c,f.columnStats=h,this.elements.push(f)}}const _={positive:{stroke:"#008f96",fill:"#008f96",fillpattern:"solid"},negative:{stroke:"#ff0000",fill:"#ff0000",fillpattern:"solid"},neutral:{stroke:"#808080",fill:"#808080",fillpattern:"outlined"},scenarios:{ac:{stroke:"#404040",fill:"#404040",fillpattern:"solid"},pp:{stroke:"#A6A6A6",fill:"#A6A6A6",fillpattern:"solid"},fc:{stroke:"#404040",fill:"#ffffff",fillpattern:"hatched"},pl:{stroke:"#404040",fill:"#ffffff",fillpattern:"outlined"}},fontColor:"#000000",fontSize:11,fontFamily:"'Noto Sans', sans-serif",unitScaling:.01,percentageScaling:.5,scaleFactor:1},C="#666666";function L(t,e){return`pattern-${t}-${e.replace("#","")}`}const N=({styles:e})=>{const o=e.scaleFactor,n=6*o,s=[{id:L("pos",e.positive.stroke),stroke:e.positive.stroke,fill:e.positive.fill},{id:L("neg",e.negative.stroke),stroke:e.negative.stroke,fill:e.negative.fill},{id:L("neu",e.neutral.stroke),stroke:e.neutral.stroke,fill:e.neutral.fill}];return t("defs",null,s.map((e=>t("pattern",{id:e.id,patternUnits:"userSpaceOnUse",width:n,height:n},t("rect",{width:n,height:n,fill:"#ffffff"}),t("line",{x1:"0",y1:n,x2:n,y2:"0",stroke:e.stroke,"stroke-width":1.5*o})))))};function P(t,e,o=1){let n,s;const r=t>=0?"+":"";if(e)return n=100*t,r+Math.round(n).toString()+"%";{let e;return n=t/o,s=Math.abs(n),e=s>=1e9?(n/1e9).toFixed(s>=1e10?0:1)+"B":s>=1e6?(n/1e6).toFixed(s>=1e7?0:1)+"M":s>=1e3?(n/1e3).toFixed(s>=1e4?0:1)+"K":n.toFixed(s>=10?0:1),e=e.replace(/\.0([KMB]?)$/,"$1"),r+e}}function x(t){const e=t.slice(0,2).toLowerCase();return["ac","pp","fc","pl"].includes(e)}function k(t){const e=t.slice(0,2).toLowerCase();return"pp"===e?"pp":"fc"===e?"fc":"pl"===e?"pl":"ac"}function A(t,e,o,n){return x(t)?function(t,e){const o=k(t);return e.scenarios[o]}(t,n):function(t,e,o){const n=t>=0;return e?n?o.positive:o.negative:n?o.negative:o.positive}(e,o,n)}const D=e=>{const{value:o,scenario:n,columnStats:s,height:r,isPositiveGood:i,formattedValue:l,measureScale:a,maxBarWidth:c=10,styles:h=_}=e,u=h.scaleFactor,d=h.fontSize,f=38*u,p=c*d,m=4*u,$=.15*p,v=p-m-$,g=Math.abs(o)*h.unitScaling*d,R=g>v,w=Math.max(0,s.absMax*h.unitScaling*d-v),b=Math.max(0,g-v),S=w>0?b/w*$:0,E=s.min<0,O=s.max>0,y=E?p:0,M=(E?f:0)+(y+(O?p:0))+(O?f:0),U=2*u,G=r-2*U,T=(E?f:0)+y,D=U,B=o>=0,F=A(n,o,i,h),Y=function(t,e){const o=t.fillpattern;return"hatched"===o?`url(#${L(e,t.stroke)})`:"outlined"===o?"transparent":t.fill}(F,x(n)?k(n):i?B?"pos":"neg":B?"neg":"pos"),{stroke:W,strokeWidth:H}="outlined"===(I=F).fillpattern?{stroke:I.stroke,strokeWidth:1.5}:{stroke:"none",strokeWidth:0};var I;const z=l||P(o,!1,a),j=R?v:g,V=R?v+m+S:g,Q=B?T+V+4*u:T-V-4*u,q=B?"start":"end";return t("svg",{width:M,height:r,class:"cell-bar-chart absolute-variance",style:{overflow:"visible"}},t(N,{styles:h}),t("line",{x1:T,y1:0,x2:T,y2:r,stroke:C,"stroke-width":1*u}),j>0&&t("rect",{x:B?T:T-j,y:D,width:j,height:G,fill:Y,stroke:W,"stroke-width":H*u}),R&&S>0&&t("rect",{x:B?T+v+m:T-v-m-S,y:D,width:S,height:G,fill:Y,stroke:W,"stroke-width":H*u}),R&&function(e,o,n,s,r){const i=e+o/2,l=.35*o,a=s/3,c=.3*o;let h=`M ${i-l} ${n}`;for(let t=0;t<3;t++)h+=` L ${i-l-c} ${n+a*(t+.5)} L ${i-l} ${n+a*(t+1)}`;let u=`M ${i+l} ${n}`;for(let t=0;t<3;t++)u+=` L ${i+l+c} ${n+a*(t+.5)} L ${i+l} ${n+a*(t+1)}`;return[t("rect",{x:e,y:n-1,width:o,height:s+2,fill:"#ffffff"}),t("path",{d:h,fill:"none",stroke:"#000000","stroke-width":1*r}),t("path",{d:u,fill:"none",stroke:"#000000","stroke-width":1*r})]}(B?T+v:T-v-m,m,D,G,u),t("text",{x:Q,y:r/2,dy:"0.35em","text-anchor":q,fill:h.fontColor,"font-size":d,"font-family":h.fontFamily},z))},B=e=>{const{value:o,scenario:n,columnStats:s,height:r,isPositiveGood:i,formattedValue:l,measureScale:a,maxBarWidth:c=10,styles:h=_}=e,u=h.scaleFactor,d=h.fontSize,f=Math.round(.67*c*d),p=5*u,m=s.min<0?f+p:0,$=m+(s.max>0?f+p:0),v=$+45*u,g=m,R=r/2,w=100*Math.abs(o)*h.percentageScaling*d,b=w>f,S=Math.min(w,f),E=o>=0,O=E?g+S:g-S,y=A(n,o,i,h),M=3*u,U=l||P(o,!0,a),G=$+4*u;return t("svg",{width:v,height:r,class:"cell-bar-chart relative-variance",style:{overflow:"visible"}},t("line",{x1:g,y1:0,x2:g,y2:r,stroke:C,"stroke-width":1*u}),!b&&t("circle",{cx:O,cy:R,r:M,fill:h.fontColor}),t("line",{x1:g,y1:R,x2:O,y2:R,stroke:y.fill,"stroke-width":2*u}),b&&E&&t("polygon",{points:`${g+f},${R} ${g+f-6*u},${R-3*u} ${g+f-6*u},${R+3*u}`,fill:y.fill}),b&&!E&&t("polygon",{points:`${g-f},${R} ${g-f+6*u},${R-3*u} ${g-f+6*u},${R+3*u}`,fill:y.fill}),t("text",{x:G,y:r/2,dy:"0.35em","text-anchor":"start",fill:h.fontColor,"font-size":d,"font-style":"italic","font-family":h.fontFamily},U))},F=e=>{const{value:o,columnStats:n,isRelative:s,styles:r=_}=e;return null==o||isNaN(o)||!n||0===n.absMax?t("span",{class:"bar-chart-empty",style:{color:r.fontColor,fontStyle:"italic"}},"-"):t(s?B:D,Object.assign({},e))};class Y{constructor(t){v.fn.transformOperator=function(t){return"-"===t?-1:1},this.groups=[i.CATEGORY,i.CATEGORYINDEX],y.OPT!==t.type&&y.OPTNOTOTAL!==t.type||this.groups.unshift(i.OPERATION),t.grouped&&(this.groups.push(i.ROWGROUP),this.groups.push(i.ROWGROUPINDEX))}toString(){return this.groups.map((t=>`${t}`)).toString()}noCategory(){return this.groups.filter((t=>t!==i.CATEGORY))}toArray(){return this.groups}}class W{constructor(t,e){this.hasPartOf=!1,this.config=t,this.i18n=e}execute(t){if(0===t.length)return[];const e=[],o=[],n=[],s=this.config.scenarios.map((t=>this.translateScenarioSQL(t,!1,this.config.type))).toString(),r=this.config.scenarios.map((t=>this.translateScenarioSQL(t,!0,this.config.type))).toString(),l=this.getRelativeScenarios(),a=new Y(this.config),c=this.config.grouped?[i.ROWGROUP,i.ROWGROUPINDEX]:[];let h=["",""];return this.config.sortOrder.hierarchy.length>0&&(h=this.createOrderString(this.config.sortOrder)),this.hasPartOf=this.checkConfigForPartOf(),v(`SELECT COUNT(DISTINCT ${i.CATEGORY}) as ${i.TOTALROWCOUNT} ${c.length>0?","+c:""}\n FROM ? ${c.length>0?"GROUP BY "+c:""} \n ORDER BY ${h[0]}`,[t]).forEach((t=>{const n=t.rowGroup&&t.rowGroup.length>0?`WHERE ${i.ROWGROUP} = '${t.rowGroup}'`:"";let l="";this.config.limit&&(l=`LIMIT ${this.config.limit}`),this.createGroupHeaderRow(t,e),this.createDataRow(e,t,a,s,n,h,l),this.createRestRow(t,e,a,s,n,h),this.createGroupSumRow(e,o,t,r,h)})),this.createTotalSumRow(e,o,r),e.forEach((e=>{try{n.push(v(e,[t]))}catch(t){console.error("DataQuery: SQL query execution failed",e,t)}})),this.detectNaNCells(this.config.scenarios,n),this.createThereOfDrillRows(s,h,t,n),this.createPartOfDrillRows(s,h,o,t,n),this.createThereOfDrillColumns(this.config.categoryThereOf,t,n),this.calculateColumnGroupRest(n,this.config.categoryThereOf),this.calculateRelativeVariances(n,l),n}detectNaNCells(t,e){e.forEach((e=>{e.map((e=>(t.forEach((t=>{const o=new l(t);!0===o.isValid?0!==e[o.base+"_cnt"]&&0!==e[o.delta+"_cnt"]||(e[t]=Number.NaN):0===e[t+"_cnt"]&&(e[t]=Number.NaN)})),e)))}))}createPartOfDrillRows(t,e,o,n,s){if(null==this.config.partOf||0===this.config.partOf.length||this.config.type===y.LIST||null==n||0===n.length)return;const r=this.createPartOfQuery(t,e);let l=[];r.forEach((function(t){l.push(...v(t,[n]))}));const a=this.exctractScenarioNames(t),c=[];o.forEach((function(t){c.push(...v(t,[n]))}));const h=new Map;c.forEach((t=>h.set(t[i.ROWGROUP],t))),l=this.reduceResDrillByCategoryGroups(l,a),l.forEach((function(t){a.forEach((e=>{try{t[e]=t[e]/h.get(t[i.ROWGROUP])[e]}catch(o){console.error("DataQuery: partOf drill row calculation failed",e,o),t[e]=Number.NaN}}))})),this.injectDrillRowsToResultRows(l,s)}createRestRow(t,e,o,n,s,r){t.totalRowCnt-this.config.limit>0&&0!==this.config.limit&&e.push(`SELECT ${i.ROWNR}, 1 as ${i.ROWGROUPINDEX} , 'ENTRY' as ${i.TYPE}, 'NO_GROUP' as ${i.ROWGROUP}, 'REST' as ${i.CATEGORY} , SUM(ac1) as ac1, SUM(pp1) as pp1, SUM(dpp1_ac1_pos) as dpp1_ac1_pos, SUM(drpp1_ac1_pos) as drpp1_ac1_pos, SUM(dr_pp1) as dr_pp1 FROM (SELECT ROWNUM() AS ${i.ROWNR}, ${e.length} as ${i.ROWGROUPINDEX} , 'ENTRY' as ${i.TYPE}, '${t.rowGroup||"NO_GROUP"}' as ${i.ROWGROUP}, ${o} ${n.length>0?",".concat(n):""} FROM ? ${s} GROUP BY ${o} ORDER BY ${r[0]}) t WHERE t.rowNr > ${this.config.limit}`)}createDataRow(t,e,o,n,s,r,l){t.push(`SELECT ROWNUM() AS ${i.ROWNR},\n ${t.length} as ${i.ROWGROUPINDEX},\n 'ENTRY' as ${i.TYPE},\n '${e.rowGroup||"NO_GROUP"}' as ${i.ROWGROUP},\n '${i.CATEGORYINDEX}',\n ${o} ${n.length>0?",".concat(n):""}\n FROM ? ${s}\n GROUP BY ${o}\n ORDER BY ${r[0]} ${l}`)}createGroupHeaderRow(t,e){!0===this.config.grouped&&e.push(`SELECT ROWNUM() AS ${i.ROWNR},\n ${e.length} as ${i.ROWGROUPINDEX},\n 'GROUPHEAD' as ${i.TYPE},\n '${t.rowGroup}' as ${i.ROWGROUP} ${this.config.showGroupTitle?`,'${t.rowGroup}' as ${i.CATEGORY}`:""}\n FROM ?\n GROUP BY '1'`)}createGroupSumRow(t,e,o,n,s){!0!==this.config.grouped||y.SUM!==this.config.type&&y.SUMNOTOTAL!==this.config.type&&y.OPT!==this.config.type&&y.OPTNOTOTAL!==this.config.type||(t.push(`SELECT ${t.length} as ${i.ROWGROUPINDEX},\n '=' as ${i.OPERATION},\n '${o.rowGroup}' as ${i.ROWGROUP},\n ROWNUM() AS ${i.ROWNR},\n 'GROUP_SUM' as ${i.TYPE} ${n.length>0?",".concat(n):""}\n FROM ?\n WHERE ${i.ROWGROUP} = '${o.rowGroup}'\n ORDER BY ${s[0]} `),e.push(`SELECT ${t.length} as ${i.ROWGROUPINDEX},\n '=' as ${i.OPERATION},\n '${o.rowGroup}' as ${i.ROWGROUP},\n ROWNUM() AS ${i.ROWNR},\n 'GROUP_SUM' as ${i.TYPE} ${n.length>0?",".concat(n):""}\n FROM ?\n WHERE ${i.ROWGROUP} = '${o.rowGroup}'\n ORDER BY ${s[0]} `))}createTotalSumRow(t,e,o){if(y.SUM===this.config.type||y.OPT===this.config.type){const e=`${this.hasPartOf&&!1===this.config.grouped?`${this.i18n.get("SUM_TOTAL")||"SUM_TOTAL"} `:""}${this.config.title}`;t.push(`SELECT ${t.length} as ${i.ROWGROUPINDEX},\n '${e}' as ${i.ROWGROUP},\n '=' as ${i.OPERATION},\n 'SUM' as ${i.TYPE} ${o.length>0?",".concat(o):""}\n FROM ? `)}e.push(`SELECT ${t.length} as ${i.ROWGROUPINDEX},\n 'SUM_TOTAL' as ${i.ROWGROUP},\n '=' as ${i.OPERATION},\n 'SUM' as ${i.TYPE} ${o.length>0?",".concat(o):""}\n FROM ? `)}reduceResDrillByCategoryGroups(t,e){const o=new Map;return t.forEach((function(t){const n=t.rowNr+t.rowGroup+t.type+t.category;if(o.has(n)){const s=o.get(n);e.forEach((e=>{try{s[e]+=t[e]}catch(t){console.error("DataQuery: drill row aggregation failed",e,t)}}))}else o.set(n,t)})),[...o.values()]}injectDrillRowsToResultRows(t,e){const o=new Map;if(!0===this.config.grouped)t.forEach((function(t){e.forEach((function(e){const n=e.findIndex((e=>e.category===t.category&&e.rowGroup===t.rowGroup));if(n>=0){if(o.has(`${t.category}_${t.rowGroup}`)){const e=o.get(`${t.category}_${t.rowGroup}`)||0;o.set(`${t.category}_${t.rowGroup}`,e+1)}else o.set(`${t.category}_${t.rowGroup}`,1);t[i.ROWNR]=o.get(`${t.category}_${t.rowGroup}`),e.splice(n+t[i.ROWNR],0,t)}}))}));else{const n=this.findDuplicateSubCategories(t);t.forEach((function(t){e.forEach((function(e){const s=e.findIndex((e=>null!=e.category&&e.category===t.category));if(s>=0){if(o.has(`${t.category}`)){const e=o.get(`${t.category}`)||0;o.set(`${t.category}`,e+1)}else o.set(`${t.category}`,1);(1===t[i.ROWNR]||n.includes(t.subCategory))&&(t.subCategory=`${t.subCategory} (${t.rowGroup})`),e.splice(s+t[i.ROWNR],0,t)}}))}))}}createThereOfDrillRows(t,e,o,n){if(void 0===this.config.thereOf||0===this.config.thereOf.length)return;const s=[],r=[];this.config.thereOf.forEach((o=>{let n=!0,r="1 <> 1 OR ( ";null!=o.category&&0!==o.category.length&&o.category.trim()&&(r+=` ${i.CATEGORY} = '${o.category}'`,n=!1),null!=o.rowGroup&&0!==o.rowGroup.length&&o.rowGroup.trim()&&(r+=` ${n?"":"AND"} ${i.ROWGROUP} = '${o.rowGroup}'`,n=!1),null!=o.subCategory&&0!==o.subCategory.length&&o.subCategory.trim()&&(r+=` ${n?"":"AND"} ${i.SUBCATEGORY} = '${o.subCategory}'`),r+=")",s.push(`SELECT ROWNUM() AS ${i.ROWNR},\n null as operation,\n 'DRILLELEMENT' as ${i.TYPE},\n ${i.CATEGORY},\n ${i.SUBCATEGORY},\n ${i.ROWGROUP} as ${i.ROWGROUP},\n ${t}\n FROM ?\n WHERE ${r}\n GROUP BY ${i.ROWGROUP}, ${i.CATEGORY}, ${i.SUBCATEGORY}\n ORDER BY ${e[1]}`)})),s.forEach((function(t){r.push(...v(t,[o]))})),this.injectDrillRowsToResultRows(r,n)}calculateRelativeVariances(t,e){t.forEach((t=>{t.forEach((t=>{"GROUPHEAD"!==t[i.TYPE]&&e.forEach(((e,o)=>{t[o]=t[o]/t[e]}))}))}))}calculateColumnGroupRest(t,e){if(null==e||0===e.size)return;const o=new Map,n=new Map;e.forEach(((t,e)=>{const s=t,r=[];for(const t of s)r.push(`${e}##${t.name}`);o.set(e,r),n.set(`${e}##REST`,!1)})),t.forEach((t=>{t.forEach((t=>{"GROUPHEAD"!==t[i.TYPE]&&o.forEach(((e,o)=>{let s=0;e.forEach((e=>{void 0!==t[e]&&(s+=t[e])})),t[`${o}##REST`]=t[o]-s,0!==t[`${o}##REST`]&&n.set(`${o}##REST`,!0)}))}))}));const s=Array.from(n.entries()).filter((([t,e])=>!e)).map((([t])=>t));t.forEach((t=>{t.forEach((t=>{for(const e of s)delete t[e]}))}))}getRelativeScenarios(){const t=new Map;return this.config.scenarios.forEach((e=>{const o=this.createRelativeScenario(e);null!=o&&t.set(o.key,o.value)})),t}translateScenarioSQL(t,e,o){const n=new l(t);return y.OPT===o||y.OPTNOTOTAL===o?n.isValid?"dr"===n.type?`SUM(${n.base} - ${n.delta}) as ${t}, SUM(${n.delta}) as dr_${n.delta}`:`SUM(${n.base} - ${n.delta}) as ${t}`:e?`SUM(${t} * transformOperator(operation)) as ${t}, COUNT(ISNULL(${t})) as ${t}_cnt`:`SUM(${t}) as ${t}, COUNT(ISNULL(${t})) as ${t}_cnt`:n.isValid?"dr"===n.type?`SUM((${n.base} * transformOperator(operation)) - (${n.delta} * transformOperator(operation))) as ${t}, SUM(${n.delta} * transformOperator(operation)) as dr_${n.delta}`:`SUM((${n.base} * transformOperator(operation))- (${n.delta} * transformOperator(operation))) as ${t}`:`SUM(${t} * transformOperator(operation)) as ${t}, COUNT(ISNULL(${t})) as ${t}_cnt`}createOrderString(t){return[`${t.hierarchy.toString()} ${t.direction}`,`${t.hierarchy.toString()} ${M.ASC===t.direction?M.DESC:M.ASC}`]}createRelativeScenario(t){const e=new l(t);return e.isValid&&"dr"===e.type?{key:`${t}`,value:`dr_${e.delta}`}:null}exctractScenarioNames(t){const e=[];return t.split(",").forEach((t=>t.length>=2?e.push(t.split("as")[1].trim()):null)),e}findDuplicateSubCategories(t){const e=t.map((t=>({count:1,subCategory:t.subCategory}))).reduce(((t,e)=>(t[e.subCategory]=(t[e.subCategory]||0)+e.count,t)),{});return Object.keys(e).filter((t=>e[t]>1))}createPartOfQuery(t,e){var o;const n=[];let s="1 <> 1 ",r=` ${i.ROWGROUP}`,l="ROWNUM()";return null===(o=this.config.partOf)||void 0===o||o.forEach((t=>{s+=`OR (${i.CATEGORY} = '${t.category}'`,null!=t.rowGroup&&0!==t.rowGroup.length&&t.rowGroup.trim()&&(s+=`and ${i.ROWGROUP} = '${t.rowGroup}'`),!1===this.config.grouped&&(r=` 'SUM_TOTAL' as ${i.ROWGROUP} `,l="1"),s+=")"})),n.push(`SELECT ${l} AS ${i.ROWNR},\n 'PARTELEMENT' as ${i.TYPE},\n ${i.CATEGORY},\n ${r},\n ${t}\n FROM ?\n WHERE ${s}\n GROUP BY ${i.ROWGROUP}, ${i.CATEGORY}, ${i.TYPE}\n ORDER BY ${e[1]}`),n}checkConfigForPartOf(){return null!=this.config.partOf&&0!==this.config.partOf.length}createThereOfDrillColumns(t,e,o){if(null==t||0===t.size)return;const n=[],s=[];t.forEach(((t,e)=>{let o="1 <> 1 ";t.forEach((t=>{o+=` or columnGroup = '${t.name}' `})),n.push(`SELECT 'ENTRY' as rowlevel,\n 'COLUMNGROUP' as columnlevel,\n rowGroup,\n category,\n columnGroup,\n '${e}' as scenario,\n sum(${e} * transformOperator(operation)) as val\n FROM ?\n WHERE ${o}\n GROUP BY rowlevel, rowGroup, category, columnGroup, scenario`),n.push(`SELECT 'ENTRY' as rowlevel,\n 'SUBGROUP' as columnlevel,\n rowGroup,\n category,\n columnGroup,\n columnSubGroup,\n '${e}' as scenario,\n sum(${e} * transformOperator(operation)) as val\n FROM ?\n WHERE ${o}\n GROUP BY rowlevel, rowGroup, category, columnGroup, columnSubGroup, scenario`),n.push(`SELECT 'DRILLELEMENT' as rowlevel,\n 'COLUMNGROUP' as columnlevel,\n rowGroup,\n category,\n subCategory,\n columnGroup,\n '${e}' as scenario,\n sum(${e} * transformOperator(operation)) as val\n FROM ?\n WHERE ${o}\n GROUP BY rowlevel, rowGroup, category, subCategory, columnGroup, scenario`),n.push(`SELECT 'DRILLELEMENT' as rowlevel,\n 'SUBGROUP' as columnlevel,\n rowGroup,\n category,\n subCategory,\n columnGroup,\n columnSubGroup,\n '${e}' as scenario,\n sum(${e} * transformOperator(operation)) as val\n FROM ?\n WHERE ${o}\n GROUP BY rowlevel, rowGroup, category, subCategory, columnGroup, columnSubGroup, scenario`),n.push(`SELECT 'GROUP_SUM' as rowlevel,\n 'COLUMNGROUP' as columnlevel,\n rowGroup,\n columnGroup,\n '${e}' as scenario,\n sum(${e} * transformOperator(operation)) as val\n FROM ?\n WHERE ${o}\n GROUP BY rowlevel, rowGroup, columnGroup, scenario`),n.push(`SELECT 'GROUP_SUM' as rowlevel,\n 'SUBGROUP' as columnlevel,\n rowGroup,\n columnGroup,\n columnSubGroup,\n '${e}' as scenario,\n sum(${e} * transformOperator(operation)) as val\n FROM ?\n WHERE ${o}\n GROUP BY rowlevel, rowGroup, columnGroup, columnSubGroup, scenario`),n.push(`SELECT 'SUM' as rowlevel,\n 'COLUMNGROUP' as columnlevel,\n columnGroup,\n '${e}' as scenario,\n sum(${e} * transformOperator(operation)) as val\n FROM ?\n WHERE ${o}\n GROUP BY rowlevel, columnGroup, scenario`),n.push(`SELECT 'SUM' as rowlevel,\n 'SUBGROUP' as columnlevel,\n columnGroup,\n columnSubGroup,\n '${e}' as scenario,\n sum(${e} * transformOperator(operation)) as val\n FROM ?\n WHERE ${o}\n GROUP BY rowlevel, columnGroup, columnSubGroup, scenario`)}));for(const t of n)s.push(...v(t,[e]));this.injectDrillColumnsToResultRows(s,o)}injectDrillColumnsToResultRows(t,e){const o="##";for(const n of t)for(const t of e)for(const e of t)e.type===n.rowlevel&&("ENTRY"===n.rowlevel?"COLUMNGROUP"===n.columnlevel&&e.category===n.category?e[n.scenario+o+n.columnGroup]=n.val:"SUBGROUP"===n.columnlevel&&e.category===n.category&&(e[n.scenario+o+n.columnGroup+o+n.columnSubGroup]=n.val):"DRILLELEMENT"===n.rowlevel?"COLUMNGROUP"===n.columnlevel&&e.category===n.category&&e.subCategory===n.subCategory?e[n.scenario+o+n.columnGroup]=n.val:"SUBGROUP"===n.columnlevel&&e.category===n.category&&e.subCategory===n.subCategory?e[n.scenario+o+n.columnGroup+o+n.columnSubGroup]=n.val:"COLUMNGROUP"===n.columnlevel&&e.category===n.category&&e.subCategory===`${n.subCategory} (${n.rowGroup})`?e[n.scenario+o+n.columnGroup]=n.val:"SUBGROUP"===n.columnlevel&&e.category===n.category&&e.subCategory===`${n.subCategory} (${n.rowGroup})`&&(e[n.scenario+o+n.columnGroup+o+n.columnSubGroup]=n.val):("SUM"===n.rowlevel||"GROUP_SUM"===n.rowlevel)&&("COLUMNGROUP"===n.columnlevel&&e.category===n.category&&e.subCategory===n.subCategory&&(e[n.scenario+o+n.columnGroup]=n.val),"SUBGROUP"===n.columnlevel&&e.category===n.category&&e.subCategory===n.subCategory&&(e[n.scenario+o+n.columnGroup+o+n.columnSubGroup]=n.val)))}}class H{constructor(){this.normalizedHeader=[]}createHeader(t,e,o,n,s,i){const l=[];this.normalizedHeader=this.normalizeHeader(t,e);const a=new T(0,0,U.HEADER),c=new T(1,0,U.SEPERATORLINE);for(const t of this.normalizedHeader)a.createElement(r.translateScenarioLabel(t.name,o),t.type,this.createColumnType(t),null,this.setHeaderPrefix(t,o,n,s,i),null,null,null,null),c.createElement(null,t.type,this.createColumnType(t),null,null,null,null,null,null);return l.push(a),l.push(c),l}setHeaderPrefix(t,e,o,n,s){let i="";return"category"===t.name&&s&&(0===o.prefix.length&&0===n.length||(i=r.translateScenarioLabel("in",e)+" "+o.prefix+n)),t.order&&(i+=r.translateScenarioLabel("ORDER_"+t.order,e)),i}normalizeHeader(t,e){let o=[{name:i.CATEGORY,group:i.CATEGORY,type:i.CATEGORY,order:void 0}];return y.OPT!==t&&y.OPTNOTOTAL!==t||(o=[{name:i.OPERATION,group:i.OPERATION,type:i.OPERATION,order:void 0},{name:i.CATEGORY,group:i.CATEGORY,type:i.CATEGORY,order:void 0}]),[...o,...e]}createBodyRows(t,e,o){const n=[];let s=-1;const r=new W(t,e).execute(o),i=this.calculateColumnStatistics(r,t.barColumns);for(const o of r)s+=1,n.push(...this.createRow(t.i18n,e,t.scenariosUnitType,o,s,-1,t.categoryWidth,t.measureScale,t.barColumns,i));return n}calculateColumnStatistics(t,e){const o=new Map;if(!e||0===e.length)return o;const n=new Map;for(const t of e)o.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)for(const s of e){const e=this.extractColumnValue(t,s);if(null!==e&&!isNaN(e)){const t=o.get(s);t.min=Math.min(t.min,e),t.max=Math.max(t.max,e),n.get(s).push(Math.abs(e))}}for(const[t,e]of o){e.min!==1/0&&e.max!==-1/0||(e.min=0,e.max=0),e.absMax=Math.max(Math.abs(e.min),Math.abs(e.max));const s=n.get(t);if(s.length>0){s.sort(((t,e)=>t-e));const t=Math.floor(s.length/2);e.median=s.length%2==0?(s[t-1]+s[t])/2:s[t]}o.set(t,e)}return o}extractColumnValue(t,e){if(void 0!==t[e]){const o=Number(t[e]);return isNaN(o)?null:o}for(const o of Object.keys(t))if(o===e||o.endsWith("##"+e)||o===e+"##"+e){const e=Number(t[o]);if(!isNaN(e))return e}return null}createRow(t,e,o,n,s,r,l,a,c,h){var u;const d=[];for(const f of n){const p=f[i.ROWGROUP],m=f[i.SUBCATEGORY],$=f[i.TYPE],v=f[i.ROWNR]>=2,g=this.createDetailRow($,r+=1,s,n.length);for(const n of this.normalizedHeader){const s=this.getRawDataRowElement(f,n),r=null!==(u=null==c?void 0:c.includes(n.type))&&void 0!==u&&u,i=r?null==h?void 0:h.get(n.type):void 0;g.createElement(this.translateSumCellLabel(t,e,s,p,m,$,n.type),n.type,this.createColumnType(n),this.setCellType(n.type,o),this.translateCellPrefix(e,$,n.type),this.translateScenarioCSS(n.type,s),v,l,null==a?void 0:a.value,r,i)}d.push(g)}return d}getRawDataRowElement(t,e){return e.name===e.group&&e.name===e.type?t[e.name]:e.name===e.group&&e.name!==e.type?t[e.type+"##"+e.name]:t[e.type+"##"+e.group+"##"+e.name]}createDetailRow(t,e,o,n){switch(t){case U.GROUPHEAD:return new T(e,o,U.HEADER);case U.SUM:case U.GROUPSUM:return new T(n+2,o,U.SUM);case U.DRILLELEMENT:return new T(n+2,o,U.DRILLELEMENT);case U.PARTELEMENT:return new T(n+2,o,U.PARTELEMENT);default:return new T(e,o,U.STANDARD)}}translateSumCellLabel(t,e,o,n,s,r,i){return!1===Number.isNaN(Number(o))||this.isOperationColumn(i)?o:this.isGroupHeadCategory(r,i)||this.isEntryCategory(r,i)?t===h.ALL?`${e.get(o)||o}`:o:this.isDrillElementCategory(r,i)?t===h.ALL?`${e.get(s)||s}`:`${s}`:this.isPartElementCategory(r,i)?t===h.ALL||"SUM_TOTAL"===n?`${e.get(n)||n}`:`${n}`:this.isSumElementCategory(r,i)?t===h.ALL||"SUM_TOTAL"===n?`${e.get(n)||n}`:n:"GROUPHEAD"===r&&null==o?o:Number.isNaN(Number(o))?"-":Number(o)}isOperationColumn(t){return"operation"===t}translateScenarioCSS(t,e){const o=new l(t);let n="pos";return e<0&&(n="neg"),o.isValid?n+"_"+o.direction+("dr"===o.type?" relative_variance":""):t}setCellType(t,e){if("category"===t)return"";let o;const n=new l(t);return e===u.PERCENT?(o="percent",n.isValid&&"d"===n.type&&(o="decimal")):(o="decimal",n.isValid&&"dr"===n.type&&(o="percent")),o}isDrillElementCategory(t,e){return"DRILLELEMENT"===t&&"category"===e}isPartElementCategory(t,e){return"PARTELEMENT"===t&&"category"===e}isSumElementCategory(t,e){return("GROUP_SUM"===t||"SUM"===t)&&"category"===e}isEntryCategory(t,e){return"ENTRY"===t&&"category"===e}isGroupHeadCategory(t,e){return"GROUPHEAD"===t&&"category"===e}translateCellPrefix(t,e,o){return this.isOperationColumn(o)||this.isGroupHeadCategory(e,o)||this.isEntryCategory(e,o)?null:this.isDrillElementCategory(e,o)?`${t.get("there_of")} `:this.isPartElementCategory(e,o)?`${t.get("part_of")} `:null}createColumnType(t){return t.name===t.group&&t.name===t.type?"base":t.name===t.group?"columnGroup":"columnSubGroup"}}class I{constructor(t,e,o){this.data=[],this.headerRows=[],this.bodyRows=[],this.ruleSet=t||new a,this.dataSetFactory=new H,this.config=this.initConfig(o),this.i18n=this.initI18n(new Map),this.setData(e,o.filter),this.state=O.DIRTY}setI18n(t){this.i18n=this.initI18n(t)}initI18n(t){const e=new Map([["",""],["SEPERATOR_WS",", "],["in","in"],["ORDER_asc","↑"],["ORDER_desc","↓"],["ac1","AC"],["pp1","PY"],["fc1","FC"],["pl1","PL"],["ac2","AC2"],["pp2","PY2"],["fc2","FC2"],["pl2","PL2"],["ac3","AC3"],["pp3","PY3"],["fc3","FC3"],["pl3","PL3"],["ac4","AC4"],["pp4","PY4"],["fc4","FC4"],["pl4","PL4"],["in","in"],["category"," "],["operation"," "],["there_of","davon"],["part_of","in % von"],["ibcssymbol_delta_ac","Δ{%}"],["ibcssymbol_delta_generic","Δ({%})"],["ibcssymbol_delta_ac_relative","Δ{%}%"],["ibcssymbol_delta_generic_relative","Δ({%})%"],["SUM_TOTAL","❖"]]);return this.state=O.DIRTY,new Map([...e,...t||new Map])}initConfig(t){this.state=O.DIRTY;const e=t,o=this;return t.scenarios.sort(((t,e)=>o.ruleSet.getScenarioSorIndex(t)-o.ruleSet.getScenarioSorIndex(e))),e}setConfig(t){this.config=this.initConfig(t)}setData(t,e){if(null==t)return;if(null!=e&&e.length>0)try{this.data=v(`SELECT * FROM ? WHERE ${e}`,[t])}catch(o){console.error("Table: filter query failed, using unfiltered data",e,o),this.data=t}else this.data=t;const o=this.normalizeScenarios(this.config.scenarios,this.config.categoryThereOf,this.config.sortOrder);this.headerRows=this.dataSetFactory.createHeader(this.config.type,o,this.i18n,this.config.measureScale,this.config.measureUnit,this.config.showMeasureScale),this.bodyRows=this.dataSetFactory.createBodyRows(this.config,this.i18n,this.data),this.state=O.UP_TO_DATE}update(){const t=this.normalizeScenarios(this.config.scenarios,this.config.categoryThereOf,this.config.sortOrder);this.headerRows=this.dataSetFactory.createHeader(this.config.type,t,this.i18n,this.config.measureScale,this.config.measureUnit,this.config.showMeasureScale),this.bodyRows=this.dataSetFactory.createBodyRows(this.config,this.i18n,this.data),this.state=O.UP_TO_DATE}getHeader(){return this.state===O.DIRTY&&this.update(),this.headerRows}getBody(){return this.state===O.DIRTY&&this.update(),this.bodyRows}normalizeScenarios(t,e,o){var n;const s=[];for(const r of t){if(null==e?void 0:e.has(r)){const t=e.get(r);for(const e of t){s.push({name:e.name,group:e.name,type:r,order:void 0});for(const t of e.subGroups)s.push({name:t,group:e.name,type:r,order:void 0})}s.push({name:"REST",group:"REST",type:r,order:void 0})}let t;(null===(n=null==o?void 0:o.hierarchy)||void 0===n?void 0:n.at(0))===r&&(t=o.direction),s.push({name:r,group:r,type:r,order:t})}return s}hasNoData(){return 0===this.data.length}}class z{constructor(){this.title="",this.scenarios=[],this.scenariosUnitType=u.DECIMAL,this.grouped=!1,this.showGroupTitle=!0,this.thereOf=[],this.categoryThereOf=new Map,this.partOf=[],this.sortOrder=new p(new c).default(),this.type=y.LIST,this.limit=0,this.i18n=h.ALL,this.categoryWidth=m.W25,this.measureScale=new R,this.measureUnit="",this.measureType=$.VOLUME,this.showMeasureScale=!0,this.filter="",this.barColumns=[]}}class j{constructor(t,e,o,n){this.tableDrillGroupAdapter=t,this.stringAdapter=e,this.orderAdapter=o,this.dataSet=n}adapt(t){const e=new z;return d.isString(t.title)&&(e.title=t.title),d.isArray(t.scenarios)&&(e.scenarios=f.adaptArray(t.scenarios,this.stringAdapter)),d.isExisting(t.scenariosUnitType)&&(e.scenariosUnitType=t.scenariosUnitType),d.isBoolean(t.grouped)&&(e.grouped=t.grouped),d.isBoolean(t.showGroupTitle)&&(e.showGroupTitle=t.showGroupTitle),d.isBoolean(t.showMeasureScale)&&(e.showMeasureScale=t.showMeasureScale),d.isArray(t.thereOf)&&(e.thereOf=f.adaptArray(t.thereOf,this.tableDrillGroupAdapter)),d.isExisting(t.categoryThereOf)&&(e.categoryThereOf=t.categoryThereOf),d.isArray(t.partOf)&&(e.partOf=f.adaptArray(t.partOf,this.tableDrillGroupAdapter)),d.isExisting(t.order)&&(e.sortOrder=this.orderAdapter.adapt(t.order)),d.isExisting(t.type)&&(e.type=t.type),d.isNumber(t.limit)&&(e.limit=t.limit),d.isExisting(t.i18n)&&(e.i18n=t.i18n),d.isExisting(t.categoryWidth)&&(e.categoryWidth=t.categoryWidth),d.isExisting(t.measureScale)&&(e.measureScale=g.calculateMeasureScale(this.dataSet,e.scenarios,t.measureScale)),d.isExisting(t.measureType)&&(e.measureType=t.measureType),d.isString(t.measureUnit)&&(e.measureUnit=t.measureUnit),d.isString(t.filter)&&(e.filter=t.filter.trim()),d.isArray(t.barColumns)&&(e.barColumns=t.barColumns),e}default(){return new z}}class V{constructor(){this.rowGroup="",this.category="",this.subCategory="",this.partOf=""}}class Q{constructor(){}adapt(t){const e=new V;return d.isString(t.rowGroup)&&(e.rowGroup=t.rowGroup),d.isString(t.category)&&(e.category=t.category),d.isString(t.subCategory)&&(e.subCategory=t.subCategory),d.isString(t.partOf)&&(e.partOf=t.partOf),e}default(){return new V}}class q{constructor(){this.operation="+"}addRowGroup(t,e){this.rowGroup=t,this.rowGroupIndex=e}addCategory(t,e){this.category=t,this.categoryIndex=e}addSubCategory(t,e){this.subCategory=t,this.subCategoryIndex=e}addColumnGroup(t,e){this.columnGroup=t,this.columnGroupIndex=e}addSubColumnGroup(t,e){this.columnSubGroup=t,this.columnSubGroupIndex=e}}class K{constructor(){}adapt(t){const e=new q;return d.isOperator(t.operation)&&(e.operation=t.operation),d.isNumber(t.rowGroupIndex)&&d.isString(t.rowGroup)&&e.addRowGroup(t.rowGroup,t.rowGroupIndex),d.isNumber(t.categoryIndex)&&d.isString(t.category)&&e.addCategory(t.category,t.categoryIndex),d.isNumber(t.subCategoryIndex)&&d.isString(t.subCategory)&&e.addSubCategory(t.subCategory,t.subCategoryIndex),d.isNumber(t.columnGroupIndex)&&d.isString(t.columnGroup)&&e.addColumnGroup(t.columnGroup,t.columnGroupIndex),d.isNumber(t.columnSubGroupIndex)&&d.isString(t.columnSubGroup)&&e.addSubColumnGroup(t.columnSubGroup,t.columnSubGroupIndex),this.setActualValues(t,e),this.setPlanValues(t,e),this.setPreviousPeriodValues(t,e),this.setForecastValues(t,e),e}default(){return new q}setActualValues(t,e){d.isNumber(t.ac1)&&(e.ac1=t.ac1),d.isNumber(t.ac2)&&(e.ac2=t.ac2),d.isNumber(t.ac3)&&(e.ac3=t.ac3),d.isNumber(t.ac4)&&(e.ac4=t.ac4)}setPlanValues(t,e){d.isNumber(t.pp1)&&(e.pp1=t.pp1),d.isNumber(t.pp2)&&(e.pp2=t.pp2),d.isNumber(t.pp3)&&(e.pp3=t.pp3),d.isNumber(t.pp4)&&(e.pp4=t.pp4)}setPreviousPeriodValues(t,e){d.isNumber(t.pl1)&&(e.pl1=t.pl1),d.isNumber(t.pl2)&&(e.pl2=t.pl2),d.isNumber(t.pl3)&&(e.pl3=t.pl3),d.isNumber(t.pl4)&&(e.pl4=t.pl4)}setForecastValues(t,e){d.isNumber(t.fc1)&&(e.fc1=t.fc1),d.isNumber(t.fc2)&&(e.fc2=t.fc2),d.isNumber(t.fc3)&&(e.fc3=t.fc3),d.isNumber(t.fc4)&&(e.fc4=t.fc4)}}const J=e(class extends o{constructor(t){super(),!1!==t&&this.__registerHost(),this.__attachShadow(),this.data=[],this.tableTitle="SUM_TOTAL",this.scenarios=[],this.scenariosDataFormat=u.DECIMAL,this.grouped=!1,this.limit=0,this.showGroupTitle=!0,this.thereof=[],this.partof=[],this.order={hierarchy:[],direction:M.ASC},this.categorythereof=new Map,this.type=y.LIST,this.categoryWidth=m.INF,this.dataFormatDigits={percent:2,decimal:1},this.i18n=new Map,this.i18nMode=h.ALL,this.measureScale="_",this.measureUnit="",this.showMeasureScale=!0,this.measureType=$.VOLUME,this.filter="",this.barColumns=[],this.barColumnMaxWidth=30,this.unitScaling=.01,this.percentageScaling=.5,this.scaleFactor=1,this.componentDataFormatDigits=new w,this.componentStyle=S(this)}render(){return t(n,null,(()=>{if(void 0!==this.table){if(this.table.hasNoData()){const e=this.i18n.get("NO_DATA")||"==No Data==";return t("p",{class:"warning"},e)}return t("table",null,t("thead",null,this.table.getHeader().map((e=>t("tr",{class:e.cssStyle},e.getCells().map((e=>t("th",{colSpan:e.colSpan,class:e.cssStyle},e.getAsHeaderList().map(((o,n,s)=>t("span",null,n===s.length-1?t("span",{class:" "===o?"table-footer":""},o,e.drawPrefix()," "):t("span",null,o,e.drawPrefix(),t("br",null)))))))))))),t("tbody",null,this.table.getBody().map((e=>t("tr",{class:e.cssStyle},null==e?void 0:e.getCells().map((o=>t("td",{colSpan:o.colSpan,class:o.type?`${o.cssStyle} ${o.type}`:o.cssStyle},null!=o.prefix?t("span",{class:o.cssStyle+" "+o.prefixStyle},o.drawPrefix()):"",o.isBarChart&&o.columnStats&&e.type!==U.SUM?t(F,{value:o.value,scenario:o.key,columnStats:o.columnStats,height:18*this.scaleFactor,isRelative:o.key.startsWith("dr"),isPositiveGood:o.key.endsWith("_pos"),measureScale:o.measureScale,maxBarWidth:this.barColumnMaxWidth,styles:this.barChartStyles}):o.draw(this.componentDataFormatDigits)))))))))}})())}componentWillRender(){const t=this.prepareConfig(),e=this.prepareData();this.componentDataFormatDigits=(new b).adapt(this.dataFormatDigits),this.barChartStyles=this.prepareBarChartStyles(),this.table=new I(new a,e,t),this.table.setI18n(this.i18n)}prepareConfig(){return new j(new Q,new c,new p(new c),this.data).adapt({title:this.tableTitle,scenarios:this.scenarios,scenariosUnitType:this.scenariosDataFormat,grouped:this.grouped,showGroupTitle:this.showGroupTitle,thereOf:this.thereof,partOf:this.partof,categoryThereOf:this.categorythereof,order:this.order,type:this.type,limit:this.limit,i18n:this.i18nMode,categoryWidth:this.categoryWidth,measureScale:this.measureScale,measureUnit:this.measureUnit,measureType:this.measureType,showMeasureScale:this.showMeasureScale,filter:this.filter,barColumns:this.barColumns})}prepareData(){return f.adaptArray(this.data,new K)}prepareBarChartStyles(){return this.componentStyle((t=>{var e,o,n,s,r,i,l,a,c,h,u,d,f,p,m,$,v,g,R,w,b,S,E,O,y,M;const U=null===(e=t["bn-chart-time"])||void 0===e?void 0:e.varianceStyles,G=null===(o=t["bn-chart-time"])||void 0===o?void 0:o.barStyles;return{positive:{stroke:(null===(n=null==U?void 0:U.pos)||void 0===n?void 0:n.stroke)||"#008f96",fill:(null===(s=null==U?void 0:U.pos)||void 0===s?void 0:s.fill)||"#008f96",fillpattern:(null===(r=null==U?void 0:U.pos)||void 0===r?void 0:r.fillpattern)||"solid"},negative:{stroke:(null===(i=null==U?void 0:U.neg)||void 0===i?void 0:i.stroke)||"#ff0000",fill:(null===(l=null==U?void 0:U.neg)||void 0===l?void 0:l.fill)||"#ff0000",fillpattern:(null===(a=null==U?void 0:U.neg)||void 0===a?void 0:a.fillpattern)||"solid"},neutral:{stroke:(null===(c=null==U?void 0:U.neu)||void 0===c?void 0:c.stroke)||"#808080",fill:(null===(h=null==U?void 0:U.neu)||void 0===h?void 0:h.fill)||"#808080",fillpattern:(null===(u=null==U?void 0:U.neu)||void 0===u?void 0:u.fillpattern)||"outlined"},scenarios:{ac:{stroke:(null===(d=null==G?void 0:G.ac)||void 0===d?void 0:d.stroke)||"#404040",fill:(null===(f=null==G?void 0:G.ac)||void 0===f?void 0:f.fill)||"#404040",fillpattern:(null===(p=null==G?void 0:G.ac)||void 0===p?void 0:p.fillpattern)||"solid"},pp:{stroke:(null===(m=null==G?void 0:G.pp)||void 0===m?void 0:m.stroke)||"#A6A6A6",fill:(null===($=null==G?void 0:G.pp)||void 0===$?void 0:$.fill)||"#A6A6A6",fillpattern:(null===(v=null==G?void 0:G.pp)||void 0===v?void 0:v.fillpattern)||"solid"},fc:{stroke:(null===(g=null==G?void 0:G.fc)||void 0===g?void 0:g.stroke)||"#404040",fill:(null===(R=null==G?void 0:G.fc)||void 0===R?void 0:R.fill)||"#ffffff",fillpattern:(null===(w=null==G?void 0:G.fc)||void 0===w?void 0:w.fillpattern)||"hatched"},pl:{stroke:(null===(b=null==G?void 0:G.pl)||void 0===b?void 0:b.stroke)||"#404040",fill:(null===(S=null==G?void 0:G.pl)||void 0===S?void 0:S.fill)||"#ffffff",fillpattern:(null===(E=null==G?void 0:G.pl)||void 0===E?void 0:E.fillpattern)||"outlined"}},fontColor:(null===(O=t.global)||void 0===O?void 0:O.fontColor)||"#000000",fontSize:.85*((null===(y=t.global)||void 0===y?void 0:y.fontSizePx)||13.3333)*this.scaleFactor,fontFamily:(null===(M=t.global)||void 0===M?void 0:M.fontFamily)||"'Noto Sans', sans-serif",unitScaling:this.unitScaling,percentageScaling:this.percentageScaling,scaleFactor:this.scaleFactor}}))}get element(){return this}static get style(){return':host{position:relative;display:inline-block}table{background-color:var(--bn-font-background, white);font-size:var(--bn-font-size, 1em);color:var(--bn-font-color, black);font-family:var(--bn-font-family, "Noto Sans", "Helvetica Neue", Helvetica, sans-serif);border-spacing:0.3em 0}thead{border-style:none}tr:first-child td{border-top:none;padding-top:0.5em}td.ac1,td.ac2,td.ac3,td.ac4,td.pp1,td.pp2,td.pp3,td.pp4,td.pl1,td.pl2,td.pl3,td.pl4,td.fc1,td.fc2,td.fc3,td.fc4,td.share,td.variance,td.pos_pos,td.pos_neg,td.neg_pos,td.neg_neg,td.pos_neutral,td.neg_neutral{text-align:right}.category-w100{min-width:100em;max-width:100em}.category-w50{min-width:50em;max-width:50em}.category-w25{min-width:25em;max-width:25em}.category-w20{min-width:20em;max-width:20em}.category-w15{min-width:15em;max-width:15em}.category-w10{min-width:10em;max-width:10em}.category-w5{min-width:5em;max-width:5em}.prefix-second{color:transparent;font-style:normal}.prefix-first{font-style:normal}th{border-bottom:0.1em solid black;text-align:right;font-weight:normal;vertical-align:text-top}td.columnGroup,th.columnGroup{font-size:0.6em}td.columnSubGroup,th.columnSubGroup{font-size:0.6em;border-spacing:0em 0;font-style:italic}td.base,th.base{font-style:normal}th.ofit,td.ofit,tr.ofit,th.partof,td.partof,tr.partof{font-size:0.6em;font-style:italic}td.ofit,td.partof{font-size:0.6em;font-style:italic}th.ofit td,tr.ofit td,th.partof td,tr.partof td{border-top:0em solid black;padding-left:1em}th.ofit share,th.partof share,tr.share td{border-top:0em solid black}th.share,tr.share,td.share{font-size:0.6em;font-style:italic}th.filler{border-bottom:0em solid black;text-align:right}td.filler{border-top:0em none !important;border-bottom:0em none;text-align:right}th.group{text-align:center;border-spacing:1em 0}th.headerlabel{border-bottom:0em none black;padding-bottom:0em}td.variance:after{content:"%"}td.relative_variance{font-style:italic}td.percent{font-style:italic;text-align:right}td.decimal{text-align:right}td.pos_pos{color:#008f96}td.neg_pos{color:#ff0000}td.pos_neg{color:#ff0000}td.neg_neg{color:#008f96}td.pos_pos:before{content:"+"}td.pos_neg:before{content:"+"}td.pos_neu:before{content:"+"}th.ac1,th.ac2,th.ac3,th.ac4{padding-top:0em;border-bottom:0.3em solid black}th.pp1,th.pp2,th.pp3,th.pp4{padding-top:0em;border-bottom:0.3em solid grey}th.pl1,th.pl2,th.pl3,th.pl4{padding-top:0em;border-bottom:0.3em double black}th.fc1,th.fc2,th.fc3,th.fc4{border-bottom:0.3em solid;border-image:repeating-linear-gradient(-45deg, white, white, black, white, white 0.3em) 2}td.colsum{font-weight:bold}th.colsum{padding-top:0em;font-weight:bold}tr.sum td{border-top:0.1em solid black;font-weight:bold;padding-bottom:0.5em}tr.groupheader td{border-top:0em dotted #ddd;padding-top:0.5em;font-weight:bold;font-style:italic}tr.begingroup td{border-top:0em dotted #ddd;padding-top:0.5em}th.begin-group{padding-left:0.75em}th.end-group{padding-left:0.75em}td{box-sizing:border-box;-webkit-box-sizing:border-box;border-top:0.1em dashed #ddd;padding-left:0.5em;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.table-footer{font-size:0.6em}.cell-bar-chart{display:inline-block;vertical-align:middle}.bar-chart-empty{color:#999}td:has(.cell-bar-chart){padding:0 0.25em;vertical-align:middle}td:has(.cell-bar-chart).pos_pos:before,td:has(.cell-bar-chart).pos_neg:before,td:has(.cell-bar-chart).pos_neu:before{content:none}td:has(.cell-bar-chart).variance:after{content:none}'}},[1,"ibcs-table",{data:[16],tableTitle:[1,"table-title"],scenarios:[16],scenariosDataFormat:[1,"scenarios-data-format"],grouped:[4],limit:[2],showGroupTitle:[4,"show-group-title"],thereof:[16],partof:[16],order:[16],categorythereof:[16],type:[1],categoryWidth:[1,"category-width"],dataFormatDigits:[16],i18n:[1040],i18nMode:[1,"i18n-mode"],measureScale:[1,"measure-scale"],measureUnit:[1,"measure-unit"],showMeasureScale:[4,"show-measure-scale"],measureType:[1,"measure-type"],filter:[1],barColumns:[16],barColumnMaxWidth:[2,"bar-column-max-width"],unitScaling:[2,"unit-scaling"],percentageScaling:[2,"percentage-scaling"],scaleFactor:[2,"scale-factor"]}]);function X(){"undefined"!=typeof customElements&&["ibcs-table"].forEach((t=>{"ibcs-table"===t&&(customElements.get(s(t))||customElements.define(s(t),J))}))}export{J as I,y as T,X as d}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{g as t,c as e}from"./context-protocol.js";import{r as o}from"./utils.js";import{getElement as
|
|
1
|
+
import{g as t,c as e}from"./context-protocol.js";import{r as o}from"./utils.js";import{getElement as n}from"@stencil/core/internal/client";const r=(t,e)=>{const o=[],n=[];for(const r of e)(t(r)?o:n).push(r);return[o,n]},s="WARN_use_dataset",a=(t,e)=>{const o=t.errors;if(o)if(e.length>0){const t=e.map((t=>t.substring(1))).join(", ");o.addOrReplace({id:s,type:"warning",message:`Using datasource(s) "${t}" directly. Prefer using a dataset (bn-dataset) for query support and metadata.`})}else o.remove(s)},i=(s,i,u)=>{let d,c,l,f,p=[],m=[];const g=t=>{if(u){const e=f.datasetsMeta.get(t);e&&u(t,e)}},h=new MutationObserver((t=>{t.forEach((t=>{"datasets"===t.attributeName&&([m,p]=r((t=>t.startsWith("$")),n(s).getAttribute("datasets").split(",")),a(s,m),p.forEach((t=>{i(t,f.datasets.get(t)),g(t)})),m.forEach((t=>{i(t,f.datasources.get(t.substring(1)))})))}))})),w=s.connectedCallback;s.connectedCallback=()=>{const e=n(s);f=t(e),[m,p]=r((t=>t.startsWith("$")),(e.getAttribute("datasets")||"").split(",")),a(s,m),p.forEach((t=>{i(t,f.datasets.get(t)),g(t)})),m.forEach((t=>{i(t,f.datasources.get(t.substring(1)))})),h.observe(e,{attributes:!0,attributeFilter:["datasets"]}),d=f.datasets.on("set",((t,e)=>{p.includes(t)&&i(t,e)})),c=f.datasources.on("set",((t,e)=>{m.includes("$"+t)&&i("$"+t,e)})),u&&(l=f.datasetsMeta.on("set",((t,e)=>{p.includes(t)&&u(t,e)}))),o(w,s)};const v=s.disconnectedCallback;return s.disconnectedCallback=()=>{h.disconnect(),o(d),o(c),o(l),e(n(s)),o(v,s)},t=>{p=t,t.forEach((t=>{i(t,f.datasets.get(t)),g(t)}))}};function u(t){const e=d(t);if(!e)return{width:0,height:0};const o=getComputedStyle(e),n=e.clientWidth-parseFloat(o.paddingLeft)-parseFloat(o.paddingRight),r=function(t){let e=d(t);for(;e;){const t=getComputedStyle(e),o=t.overflowY;if("hidden"===o||"scroll"===o||"auto"===o)return e.clientHeight-parseFloat(t.paddingTop)-parseFloat(t.paddingBottom);if("none"!==t.maxHeight){const o=parseFloat(t.maxHeight);if(!isNaN(o)&&o>0)return Math.min(o,e.clientHeight-parseFloat(t.paddingTop)-parseFloat(t.paddingBottom))}e=c(e)}return"undefined"!=typeof window?window.innerHeight:0}(t);return{width:Math.max(0,n),height:Math.max(0,r)}}function d(t){var e;const o=t.parentElement;return(null===(e=null==o?void 0:o.assignedSlot)||void 0===e?void 0:e.parentElement)?o.assignedSlot.parentElement:o}function c(t){var e;return(null===(e=t.assignedSlot)||void 0===e?void 0:e.parentElement)?t.assignedSlot.parentElement:t.parentElement}function l(t){if(null==t||""===t)return{mode:"empty"};if("none"===t)return{mode:"none"};if("auto"===t)return{mode:"auto"};const e=Number(t);return!isNaN(e)&&e>0?{mode:"factor",factor:e}:{mode:"empty"}}export{u as g,l as p,i as w}
|