@bino-bi/bn-template-engine 1.0.0-alpha.6 → 1.0.0-alpha.8
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-0d41c5d8.entry.js +1 -0
- package/dist/bn-template-engine/p-67538176.entry.js +1 -0
- package/dist/bn-template-engine/p-825a07a8.entry.js +1 -0
- package/dist/bn-template-engine/p-916296a5.entry.js +1 -0
- package/dist/bn-template-engine/{p-1164c0b0.entry.js → p-96006b06.entry.js} +1 -1
- package/dist/bn-template-engine/p-B4JfKvVT.js +1 -0
- package/dist/bn-template-engine/{p-JNHhIe7t.js → p-B_d-jp99.js} +1 -1
- package/dist/bn-template-engine/p-Ck-NYtot.js +1 -0
- package/dist/bn-template-engine/p-CnDq0oVa.js +1 -0
- package/dist/bn-template-engine/p-DSXNgKLa.js +1 -0
- package/dist/bn-template-engine/p-bc711fb0.entry.js +1 -0
- package/dist/bn-template-engine/p-e6f646b1.entry.js +1 -0
- package/dist/bn-template-engine/p-f41d9242.entry.js +1 -0
- package/dist/bn-template-engine/{p-B0lsgVuN.js → p-gFbbuhtl.js} +1 -1
- package/dist/cjs/{SVGVariancesStyleGroup-BqAdPYtL.js → bn-asset_20.cjs.entry.js} +21948 -6938
- package/dist/cjs/bn-grid.cjs.entry.js +6 -9
- package/dist/cjs/bn-image.cjs.entry.js +6 -9
- package/dist/cjs/bn-internationalization.cjs.entry.js +5 -6
- package/dist/cjs/bn-template-engine.cjs.js +2 -2
- package/dist/cjs/bn-template.cjs.entry.js +3 -4
- package/dist/cjs/bn-text.cjs.entry.js +7 -10
- package/dist/cjs/bn-tree.cjs.entry.js +6 -9
- package/dist/cjs/{context-protocol-DRQWrwsA.js → context-protocol-ohYzcb5F.js} +1 -1
- package/dist/cjs/editor-companion.cjs.entry.js +2 -2
- package/dist/cjs/{index-Cjw0q6gP.js → index-CDKG4xmO.js} +1 -0
- package/dist/cjs/loader.cjs.js +2 -2
- package/dist/cjs/{scaling-BidPsO53.js → scaling-CIAClQR5.js} +3 -3
- package/dist/cjs/{withBodyObserver-C6gLgq_e.js → withBodyObserver-D7BKWN2N.js} +2 -2
- package/dist/cjs/{withHasError-B8gHkfV2.js → withHasError-Cl2gTQzA.js} +106 -2
- package/dist/cjs/{Order-BGx39pS5.js → withStyled-qd94SSb4.js} +648 -6
- package/dist/collection/components/bn-chart-structure/bn-chart-structure.js +65 -13
- package/dist/collection/components/bn-chart-time/bn-chart-time.js +63 -11
- package/dist/collection/components/bn-layout-card/bn-layout-card.js +43 -6
- package/dist/collection/components/bn-layout-page/bn-layout-page.js +12 -7
- package/dist/collection/components/bn-table/bn-table.js +83 -19
- package/dist/collection/components/bn-table/ibcs-table.js +68 -3
- package/dist/collection/utils/withInheritedProps.js +152 -0
- package/dist/components/bn-chart-structure.js +1 -1
- package/dist/components/bn-chart-time.js +1 -1
- package/dist/components/bn-layout-card.js +1 -1
- package/dist/components/bn-layout-page.js +1 -1
- package/dist/components/bn-table.js +1 -1
- package/dist/components/ibcs-table2.js +1 -1
- package/dist/components/withInheritedProps.js +1 -0
- package/dist/esm/{SVGVariancesStyleGroup-DOIT-zvI.js → bn-asset_20.entry.js} +22048 -7042
- package/dist/esm/bn-grid.entry.js +4 -7
- package/dist/esm/bn-image.entry.js +4 -7
- package/dist/esm/bn-internationalization.entry.js +4 -5
- package/dist/esm/bn-template-engine.js +3 -3
- package/dist/esm/bn-template.entry.js +2 -3
- package/dist/esm/bn-text.entry.js +5 -8
- package/dist/esm/bn-tree.entry.js +4 -7
- package/dist/esm/{context-protocol-2peaD4y8.js → context-protocol-DdbSplvE.js} +2 -2
- package/dist/esm/editor-companion.entry.js +2 -2
- package/dist/esm/{index-JNHhIe7t.js → index-B_d-jp99.js} +1 -1
- package/dist/esm/loader.js +3 -3
- package/dist/esm/{scaling-BOcjT8M0.js → scaling-DGKKkuL9.js} +4 -4
- package/dist/esm/{withBodyObserver-DczL5ia8.js → withBodyObserver-AFk2wwHT.js} +2 -2
- package/dist/esm/{withHasError-B3QX2emi.js → withHasError-DW_vMDUp.js} +106 -2
- package/dist/esm/{Order-sRO-lj7X.js → withStyled-BIkqU2w4.js} +616 -1
- package/dist/types/components/bn-chart-structure/bn-chart-structure.d.ts +2 -0
- package/dist/types/components/bn-chart-time/bn-chart-time.d.ts +2 -0
- package/dist/types/components/bn-layout-card/bn-layout-card.d.ts +16 -2
- package/dist/types/components/bn-layout-page/bn-layout-page.d.ts +8 -3
- package/dist/types/components/bn-table/bn-table.d.ts +1 -0
- package/dist/types/components/bn-table/ibcs-table.d.ts +19 -0
- package/dist/types/components.d.ts +8 -8
- package/dist/types/utils/withInheritedProps.d.ts +38 -0
- package/package.json +1 -1
- package/dist/bn-template-engine/p-06946f44.entry.js +0 -1
- package/dist/bn-template-engine/p-0fabe296.entry.js +0 -1
- package/dist/bn-template-engine/p-355abdf0.entry.js +0 -1
- package/dist/bn-template-engine/p-79KuA4Ox.js +0 -1
- package/dist/bn-template-engine/p-859cc06d.entry.js +0 -1
- package/dist/bn-template-engine/p-8acec99e.entry.js +0 -1
- package/dist/bn-template-engine/p-8f490c45.entry.js +0 -1
- package/dist/bn-template-engine/p-98cf512f.entry.js +0 -1
- package/dist/bn-template-engine/p-9a564f8f.entry.js +0 -1
- package/dist/bn-template-engine/p-B7p8beYH.js +0 -1
- package/dist/bn-template-engine/p-BDh7GfC5.js +0 -1
- package/dist/bn-template-engine/p-BoMtoHJB.js +0 -1
- package/dist/bn-template-engine/p-Bs8BqBsb.js +0 -1
- package/dist/bn-template-engine/p-CYjZRKdI.js +0 -1
- package/dist/bn-template-engine/p-DG-1MR_T.js +0 -1
- package/dist/bn-template-engine/p-bdd2b243.entry.js +0 -1
- package/dist/bn-template-engine/p-e6b24f15.entry.js +0 -1
- package/dist/bn-template-engine/p-f27995c9.entry.js +0 -1
- package/dist/bn-template-engine/p-sRO-lj7X.js +0 -1
- package/dist/bn-template-engine/p-tzFCK9qn.js +0 -1
- package/dist/cjs/bn-asset_16.cjs.entry.js +0 -9018
- package/dist/cjs/bn-card.cjs.entry.js +0 -36
- package/dist/cjs/bn-chart-time.cjs.entry.js +0 -995
- package/dist/cjs/bn-layout-card.cjs.entry.js +0 -248
- package/dist/cjs/formatter-4XCS0d2B.js +0 -221
- package/dist/cjs/ibcs-chart-time.cjs.entry.js +0 -4137
- package/dist/cjs/withComponentStatus-_x4LQZ0N.js +0 -109
- package/dist/cjs/withComponentStyle-ClSJfCku.js +0 -128
- package/dist/cjs/withStyled-9tG024gQ.js +0 -522
- package/dist/esm/bn-asset_16.entry.js +0 -9001
- package/dist/esm/bn-card.entry.js +0 -34
- package/dist/esm/bn-chart-time.entry.js +0 -993
- package/dist/esm/bn-layout-card.entry.js +0 -246
- package/dist/esm/formatter-BDh7GfC5.js +0 -215
- package/dist/esm/ibcs-chart-time.entry.js +0 -4135
- package/dist/esm/withComponentStatus-DodoSXe-.js +0 -107
- package/dist/esm/withComponentStyle-D3VWOsto.js +0 -126
- package/dist/esm/withStyled-CE3_3taP.js +0 -495
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{g as n,r as e}from"./p-tzFCK9qn.js";var s,t;!function(n){n[n.RUNNING=0]="RUNNING",n[n.SUCCESSFUL=1]="SUCCESSFUL",n[n.ERROR=2]="ERROR"}(s||(s={})),function(n){let e;const t=new Map,o={running:0,successful:0,error:0},r=n=>{switch(n){case s.RUNNING:return"running";case s.SUCCESSFUL:return"successful";default:return"error"}};n.updateStatus=(s,c)=>{e&&clearTimeout(e);const u=t.get(s);void 0!==u&&o[r(u)]--,o[r(c)]++,t.set(s,c),e=setTimeout((()=>{window.componentRegisterIsRenderedResult=n.componentRegisterIsRendered(),console.log("componentRegisterIsRendered:",window.componentRegisterIsRenderedResult)}),500)},n.componentRegisterIsRendered=()=>0===o.running,n.componentRegisterStatus=()=>Object.assign({},o)}(t||(t={}));const o=o=>{const r=n(),c=o.connectedCallback;o.connectedCallback=()=>{t.updateStatus(r,s.RUNNING),e(c,o)};const u=o.componentWillRender;o.componentWillRender=()=>{t.updateStatus(r,s.RUNNING),e(u,o)};const i=o.componentDidRender;o.componentDidRender=()=>{t.updateStatus(r,s.SUCCESSFUL),e(i,o)}};export{o as w}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{g as t}from"./p-JNHhIe7t.js";import{r as s}from"./p-tzFCK9qn.js";const r=(r,o)=>{const a=new MutationObserver((t=>{t.forEach((t=>{o(t.target.textContent)}))})),e=r.connectedCallback;r.connectedCallback=()=>{const c=t(r);a.observe(c,{childList:!0,subtree:!0,characterData:!0}),o(c.textContent),s(e,r)};const c=r.disconnectedCallback;r.disconnectedCallback=()=>{a.disconnect(),s(c,r)}};export{r as w}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{r as t,h as s,H as i,g as r}from"./p-JNHhIe7t.js";import{w as o}from"./p-DG-1MR_T.js";import{a,f as n}from"./p-B0lsgVuN.js";import{w as e}from"./p-CYjZRKdI.js";import{w as h}from"./p-tzFCK9qn.js";const c=class{constructor(s){t(this,s),e(this),this.errors=h(this),o(this,(t=>{this.stores||(this.stores=a(this.element));try{const s=n(JSON.parse(t)),i=Object.assign({},this.stores.internationalization.get(this.namespace));i[this.code]=s,this.stores.internationalization.set(this.namespace,i)}catch(t){console.error(t)}}))}render(){return s(i,{key:"dd384ecf77e4fd5d46ed04b04c4395fba8bac4e1"})}get element(){return r(this)}};c.style="bn-internationalization{display:none}";export{c as bn_internationalization}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{r as t,h as i,H as s,g as e,d as n,F as r}from"./p-JNHhIe7t.js";import{w as a}from"./p-CYjZRKdI.js";import{a as o,g as h,b as l,c}from"./p-B0lsgVuN.js";import{w as d}from"./p-DG-1MR_T.js";import{w as u,r as p}from"./p-tzFCK9qn.js";import{w as f}from"./p-BoMtoHJB.js";import{v,a as m,i as g,c as b,d as w,e as y,b as S,j as R,k as O,g as $,w as x,l as E,m as _,n as M,o as k,p as T,q as P,r as L,s as C,t as U,u as N,x as A,y as D,f as G,z as W}from"./p-B7p8beYH.js";import{w as F,a as B,g as z,p as Y}from"./p-79KuA4Ox.js";import{f as H,O as I,a as V,S as j,b as X,c as J,g as K,I as Q,i as q,M as Z,B as tt,T as it,j as st,D as et,l as nt,n as rt,k as at,o as ot,m as ht}from"./p-sRO-lj7X.js";import{b as lt,S as ct,D as dt,e as ut,a as pt,g as ft,I as vt,c as mt,d as gt,f as bt,F as wt,h as yt,i as St,j as Rt,P as Ot,k as $t}from"./p-Bs8BqBsb.js";import{F as xt,C as Et,V as _t,Q as Mt}from"./p-BDh7GfC5.js";const kt=class{constructor(i){t(this,i),a(this),this.errors=u(this),d(this,(t=>{this.stores||(this.stores=o(this.element));try{const i=t.replace(/\s/g,"");this.stores.assets.set(this.name,i)}catch(i){console.error("Error parsing asset",i,t),this.stores.assets.set(this.name,void 0)}}))}render(){return i(s,{key:"dfec9f90136278bddab194479301aa3fa5bc1e72"})}get element(){return e(this)}};kt.style=":host{display:none}";const Tt=class{constructor(i){t(this,i),a(this),this.errors=u(this),this.componentStyle=f(this)}getFontStyles(){return this.componentStyle((t=>{var i,s,e,n;return{"--bn-font-family":(null===(i=t.global)||void 0===i?void 0:i.fontFamily)||"'Noto Sans', sans-serif","--bn-font-size":`${(null===(s=t.global)||void 0===s?void 0:s.fontSizePx)||13.3333}px`,"--bn-font-color":(null===(e=t.global)||void 0===e?void 0:e.fontColor)||"#000000","--bn-font-background":(null===(n=t.global)||void 0===n?void 0:n.fontBackgroundColor)||"#ffffff"}}))}render(){return i(s,{key:"f43978af1c6658c6fa165093c3ada6b5f3b5986d",style:this.getFontStyles()},i("slot",{key:"b9c97432089676fc373b1d5ee59573ef5681a5c5"}))}get element(){return e(this)}};Tt.style=':host{flex:1;position:relative;overflow:hidden;display:block;font-family:var(--bn-font-family, "Noto Sans", sans-serif);font-size:var(--bn-font-size, 13.3333px);color:var(--bn-font-color, #000000)}';const Pt=class{validateScenario(t){const i=v(t),s="ERR_scenarios";i.length>0?this.errors.addOrReplace({id:s,type:"warning",message:"scenarios: invalid value(s) '"+JSON.stringify(i)+"' are not supported."}):this.errors.remove(s)}validateVariances(t){const i="ERR_variances",s=m(t);s.length>0?this.errors.addOrReplace({id:i,type:"warning",message:"variances: invalid value(s) '"+JSON.stringify(s)+"' are not supported."}):this.errors.remove(i)}validateUnitScaling(t){const i="ERR_unitScaling";g(t)||this.pixelPerUnitGroupMap.has(t)?this.errors.remove(i):this.errors.addOrReplace({id:i,type:"warning",message:"unitScaling: invalid value(s) '"+t+"' are not supported."})}validatePercentageScaling(t){const i="ERR_percentageScaling";g(t)||this.pixelPerUnitGroupMap.has(t)?this.errors.remove(i):this.errors.addOrReplace({id:i,type:"warning",message:"percentageScaling: invalid value(s) '"+t+"' are not supported."})}validateLevel(t){const i="ERR_level";b(t)?this.errors.remove(i):this.errors.addOrReplace({id:i,type:"warning",message:"level: invalid value(s) '"+t+"' are not supported."})}validateOrderList(t){const i=w(t),s="ERR_order";i.length>0?this.errors.addOrReplace({id:s,type:"warning",message:"order: invalid value(s) '"+JSON.stringify(i)+"' are not supported."}):this.errors.remove(s)}validateOrderDirection(t){const i="ERR_orderDirection";y(t)?this.errors.remove(i):this.errors.addOrReplace({id:i,type:"warning",message:"orderDirection: invalid value '"+(null==t?void 0:t.toString())+"' is not supported."})}validateLimit(t){const i="ERR_limit";S(t)?this.errors.remove(i):this.errors.addOrReplace({id:i,type:"warning",message:"limit: invalid value '"+(null==t?void 0:t.toString())+"' is not supported."})}validateShowCategories(t){const i="ERR_showCategories";R(t)?this.errors.remove(i):this.errors.addOrReplace({id:i,type:"warning",message:"showCategories: invalid value(s) '"+(null==t?void 0:t.toString())+"' are not supported."})}validateMeasureScale(t){const i="ERR_measureScale";O(t)?this.errors.remove(i):this.errors.addOrReplace({id:i,type:"warning",message:"measureScale: invalid value '"+(null==t?void 0:t.toString())+"' is not supported."})}validateShowMeasureScale(t){const i="ERR_grouped";R(t)?this.errors.remove(i):this.errors.addOrReplace({id:i,type:"warning",message:"showMeasureScale: invalid value(s) '"+(null==t?void 0:t.toString())+"' are not supported."})}validateStack(t){const i="ERR_stack",s=$(t);s.length>0?this.errors.addOrReplace({id:i,type:"warning",message:s.join("; ")}):this.errors.remove(i)}validateScaling(t){if(null==t||""===t||"none"===t||"auto"===t)return void this.errors.remove("ERR_scale");const i=Number(t);isNaN(i)||i<=0?this.errors.addOrReplace({id:"ERR_scale",type:"warning",message:`Invalid scale value: "${t}". Use "none", "auto", or a positive number.`}):this.errors.remove("ERR_scale")}constructor(i){t(this,i),this.data=[],this.datasetMeta=null,this.appliedScaleFactor=1,this.chartTitle="",this.filter="",this.limit=0,this.showCategories="true",this.measureScale="greatest",this.showMeasureScale="false",this.measureUnit="",this.stack="",this.scenariosArray=[""],this.pixelPerUnitGroupMap=new Map,this._autoScaleGuard=!1,x(this),a(this),F(this,((t,i)=>{this.data=i||[]}),((t,i)=>{this.datasetMeta=i})),this.chartTemplate=this.chartTemplate.bind(this),this.errors=u(this),this.componentStyle=f(this),this.t=B(this).t}componentWillLoad(){this.validateScenario(this.scenarios),this.validateVariances(this.variances),this.validateUnitScaling(this.unitScaling),this.validateLevel(this.level),this.validateOrderDirection(this.orderDirection),this.validateOrderList(this.order),this.validateShowCategories(this.showCategories),this.validateMeasureScale(this.measureScale),this.validateShowMeasureScale(this.showMeasureScale),this.validateStack(this.stack),this.validateScaling(this.scale)}componentDidRender(){var t,i;const{mode:s}=Y(this.scale);if("auto"!==s&&"empty"!==s)return this._autoScaleGuard=!1,void this.checkWidthOverflow();if(this._autoScaleGuard)return this._autoScaleGuard=!1,void this.checkWidthOverflow();const e=this.element,{height:n}=z(e);if(n<=0)return void this.checkWidthOverflow();const r=this.componentStyle((t=>{var i;return(null===(i=t.global)||void 0===i?void 0:i.fontSizePx)||13.3333}));e.style.setProperty("--bn-font-size",`${r}px`);const a=null===(t=e.shadowRoot)||void 0===t?void 0:t.querySelector(".container"),o=null!==(i=null==a?void 0:a.scrollHeight)&&void 0!==i?i:e.scrollHeight;if(o<=n+1)return this.errors.remove("AUTO_scale"),1!==this.appliedScaleFactor&&(this._autoScaleGuard=!0,this.appliedScaleFactor=1),void this.checkWidthOverflow();const h=(n-1)/o;e.style.setProperty("--bn-font-size",r*h+"px"),"empty"===s?this.errors.addOrReplace({id:"AUTO_scale",type:"warning",message:`Auto-scaled chart by factor ${h.toFixed(3)}`}):this.errors.remove("AUTO_scale"),Math.abs(h-this.appliedScaleFactor)>.001&&(this._autoScaleGuard=!0,this.appliedScaleFactor=h),this.checkWidthOverflow()}checkWidthOverflow(){var t;const i="WARN_overflow",s=String(null!==(t=this.unitScaling)&&void 0!==t?t:"").trim().toLowerCase();if(""===s||"auto"===s)return void this.errors.remove(i);const e=z(this.element);e.width>0&&this.element.scrollWidth>e.width+1?this.errors.addOrReplace({id:i,type:"error",message:`Chart exceeds available width (${this.element.scrollWidth}px > ${Math.round(e.width)}px). Reduce unit-scaling or set to "auto".`}):this.errors.remove(i)}prepareDimension(){const t=z(this.element);return this.canvasWidthSegmented=t.width/this.scenariosArray.length,{width:this.canvasWidthSegmented,height:t.height}}prepareScenarios(){var t,i,s,e;const n="auto"===(null===(t=this.scenarios)||void 0===t?void 0:t.trim().toLowerCase());return E(this.scenarios)||n?(null===(s=null===(i=this.datasetMeta)||void 0===i?void 0:i.availableScenarios)||void 0===s?void 0:s.length)>0?(n?this.errors.remove("AUTO_scenarios"):this.errors.addOrReplace({id:"AUTO_scenarios",type:"warning",message:`scenarios: not set, auto-detected: ${this.datasetMeta.availableScenarios.join(",")}`}),this.datasetMeta.availableScenarios):[]:(this.errors.remove("AUTO_scenarios"),null===(e=this.scenarios)||void 0===e?void 0:e.split(",").map((t=>t.trim())))}prepareVariances(){var t;return E(this.variances)?[]:null===(t=this.variances)||void 0===t?void 0:t.split(",").map((t=>t.trim()))}prepareHideCategories(t){return t>=1||"true"!==this.showCategories}prepareI18n(){const t=h,i=new Map([].map((t=>[t,this.t(".".concat(t))]))),s=new Map(t.map((t=>[t,this.t("global.".concat(t))])));return new Map([...s.entries(),...i.entries()])}preparePixelPerUnit(){var t;if(this.pixelPerUnitGroupMap.has(this.unitScaling))return this.errors.remove("AUTO_unitScaling"),this.pixelPerUnitGroupMap.get(this.unitScaling);if("auto"===(null===(t=this.unitScaling)||void 0===t?void 0:t.toString().trim().toLowerCase()))return this.errors.remove("AUTO_unitScaling"),0;const i=Number(this.unitScaling);return!isNaN(i)&&i>0?(this.errors.remove("AUTO_unitScaling"),i):(this.errors.addOrReplace({id:"AUTO_unitScaling",type:"warning",message:"unit-scaling: not set, auto-calculated to fit available space."}),0)}preparePixelPerPercentage(){return this.pixelPerUnitGroupMap.has(this.percentageScaling)?this.pixelPerUnitGroupMap.get(this.percentageScaling):100*Number(this.percentageScaling)}prepareLevel(){var t,i,s;const e="auto"===(null===(t=this.level)||void 0===t?void 0:t.trim().toLowerCase());return E(this.level)||e?(null===(i=this.datasetMeta)||void 0===i?void 0:i.suggestedLevel)?(e?this.errors.remove("AUTO_level"):this.errors.addOrReplace({id:"AUTO_level",type:"warning",message:`level: not set, auto-detected: ${this.datasetMeta.suggestedLevel}`}),H[this.datasetMeta.suggestedLevel.toUpperCase()]):void 0:(this.errors.remove("AUTO_level"),H[null===(s=this.level)||void 0===s?void 0:s.toUpperCase()])}prepareOrder(){var t,i,s;const e="auto"===(null===(t=this.order)||void 0===t?void 0:t.trim().toLowerCase());let n;return E(this.order)||e?(null===(i=this.datasetMeta)||void 0===i?void 0:i.suggestedOrder)?(e?this.errors.remove("AUTO_order"):this.errors.addOrReplace({id:"AUTO_order",type:"warning",message:`order: not set, auto-detected: ${this.datasetMeta.suggestedOrder}`}),n=this.datasetMeta.suggestedOrder):n=this.order:(this.errors.remove("AUTO_order"),n=this.order),{hierarchy:null==n?void 0:n.split(",").map((t=>V[null==t?void 0:t.toUpperCase()])),direction:I[null===(s=this.orderDirection)||void 0===s?void 0:s.toUpperCase()]}}prepareStyle(){const t=this.getEffectiveScaleFactor();return this.componentStyle((i=>{const s=i.global.fontSizePx*t;return{scaleFactors:{scenarioOffset:i["bn-chart-structure"].scaleFactors.scenarioOffset,scenarioLabelToBar:i["bn-chart-structure"].scaleFactors.scenarioLabelToBar,labelToBar:i["bn-chart-structure"].scaleFactors.labelToBar,labelToAxis:i["bn-chart-structure"].scaleFactors.labelToAxis,needleWidth:i["bn-chart-structure"].scaleFactors.needleWidth,needleHeadWidth:i["bn-chart-structure"].scaleFactors.needleHeadWidth,barWidth:i["bn-chart-structure"].scaleFactors.barWidth,varianceAxisLineWidth:i["bn-chart-structure"].scaleFactors.varianceAxisLineWidth,axisLineWidth:i["bn-chart-structure"].scaleFactors.axisLineWidth,auxiliaryLineWidth:i["bn-chart-structure"].scaleFactors.auxiliaryLineWidth,scenarioLineWidth:i["bn-chart-structure"].scaleFactors.scenarioLineWidth,markerWidth:i["bn-chart-structure"].scaleFactors.markerWidth,markerOffset:i["bn-chart-structure"].scaleFactors.markerOffset,categoryWidth:i["bn-chart-structure"].scaleFactors.categoryWidth,axisTickLength:i["bn-chart-structure"].scaleFactors.axisTickLength},fontStyles:{font:`${s}px ${i.global.fontFamily}`,size:s,color:i.global.fontColor,background:i.global.fontBackgroundColor,leading:1.8},axisStyles:i["bn-chart-structure"].axisStyles,barStyles:i["bn-chart-structure"].barStyles,varianceStyles:i["bn-chart-structure"].varianceStyles,padding:i["bn-chart-structure"].padding,pattern:null}}))}prepareChartTitle(t){return t>=1?"":this.chartTitle}prepareStackConfig(){if(E(this.stack))return this.errors.remove("WARN_stack_dimensions_scenarios"),null;try{const t=JSON.parse(this.stack),i=t.by,s="WARN_stack_dimensions_scenarios";if(i===j.DIMENSIONS){const t=this.prepareScenarios();t.length>1?this.errors.addOrReplace({id:s,type:"warning",message:`stack by dimensions: only the first scenario "${t[0]}" is used, the rest (${t.slice(1).join(", ")}) are discarded.`}):this.errors.remove(s)}else this.errors.remove(s);return{by:i,mode:t.mode||J.ABSOLUTE,order:t.order||X.DATASET}}catch(t){return this.errors.remove("WARN_stack_dimensions_scenarios"),null}}prepareFilter(){return 0===this.filter.length?"":this.filter}prepareLimit(){return Math.floor(Number(this.limit)||0)}getDataStructure(){return{IStructureChartDataRow:{operation:{type:"string",isOptional:!1,description:""},rowGroup:{type:"string",isOptional:!1,description:""},rowGroupIndex:{type:"number",isOptional:!1,description:""},category:{type:"string",isOptional:!1,description:""},categoryIndex:{type:"number",isOptional:!1,description:""},subCategory:{type:"string",isOptional:!1,description:""},subCategoryIndex:{type:"number",isOptional:!1,description:""},columnGroup:{type:"string",isOptional:!1,description:""},columnGroupIndex:{type:"number",isOptional:!1,description:""},columnSubGroup:{type:"string",isOptional:!1,description:""},columnSubGroupIndex:{type:"number",isOptional:!1,description:""},ac1:{type:"number",isOptional:!1,description:""},ac2:{type:"number",isOptional:!1,description:""},ac3:{type:"number",isOptional:!1,description:""},ac4:{type:"number",isOptional:!1,description:""},pp1:{type:"number",isOptional:!1,description:""},pp2:{type:"number",isOptional:!1,description:""},pp3:{type:"number",isOptional:!1,description:""},pp4:{type:"number",isOptional:!1,description:""},fc1:{type:"number",isOptional:!1,description:""},fc2:{type:"number",isOptional:!1,description:""},fc3:{type:"number",isOptional:!1,description:""},fc4:{type:"number",isOptional:!1,description:""},pl1:{type:"number",isOptional:!1,description:""},pl2:{type:"number",isOptional:!1,description:""},pl3:{type:"number",isOptional:!1,description:""},pl4:{type:"number",isOptional:!1,description:""}}}}prepareMeasureScale(){return E(this.measureScale)?"GREATEST":["_","k","M","G","T","P","E","Z","Y","m","μ","n","p","P","f","a","z","y"].includes(this.measureScale.trim())||"LEAST"===this.measureScale.trim().toUpperCase()?this.measureScale.trim():"GREATEST"}prepareShowMeasureScale(t){return 0===t&&"true"===this.showMeasureScale}prepareMeasureUnit(){return""===this.measureUnit||null==this.measureUnit?"":this.measureUnit}chartTemplate(t,s){const e=this.getEffectiveScaleFactor(),n=this.preparePixelPerUnit(),r=this.preparePixelPerPercentage(),a=this.prepareStackConfig(),o=this.prepareScenarios(),h=(null==a?void 0:a.by)===j.DIMENSIONS?o.slice(0,1):o;return i("ibcs-chart-structure",{data:this.data,chartTitle:this.prepareChartTitle(s),scenarios:h,variances:[t],hideCategories:this.prepareHideCategories(s),pixelPerUnit:n>0?n*e:0,pixelPerPercentage:r>0?r*e:0,limit:this.prepareLimit(),styles:this.prepareStyle(),i18n:this.prepareI18n(),order:this.prepareOrder(),level:this.prepareLevel(),filter:this.prepareFilter(),"measure-scale":this.prepareMeasureScale(),"measure-unit":this.prepareMeasureUnit(),showMeasureScale:this.prepareShowMeasureScale(s),stackConfig:a,parentDimensions:this.prepareDimension()})}getEffectiveScaleFactor(){const{mode:t,factor:i}=Y(this.scale);return"factor"===t?i:"auto"===t||"empty"===t?this.appliedScaleFactor:1}getFontStyles(){const t=this.getEffectiveScaleFactor();return this.componentStyle((i=>{var s,e,n,r;const a=(null===(s=i.global)||void 0===s?void 0:s.fontSizePx)||13.3333;return{"--bn-font-family":(null===(e=i.global)||void 0===e?void 0:e.fontFamily)||"'Noto Sans', sans-serif","--bn-font-size":a*t+"px","--bn-font-color":(null===(n=i.global)||void 0===n?void 0:n.fontColor)||"#000000","--bn-font-background":(null===(r=i.global)||void 0===r?void 0:r.fontBackgroundColor)||"#ffffff"}}))}render(){let t=[""];const e=this.prepareVariances();e.length>0&&(t=[...t,...e]);const n=this.getFontStyles();return i(s,{key:"570fb741ddf481be0f3055d346314ad39a455361",style:n},i("div",{key:"e84cfe2e00dd2f960f038844e00449431efa6ce0",class:"container"},t.map(this.chartTemplate)))}get element(){return e(this)}static get watchers(){return{scenarios:[{validateScenario:0}],variances:[{validateVariances:0}],unitScaling:[{validateUnitScaling:0}],percentageScaling:[{validatePercentageScaling:0}],level:[{validateLevel:0}],order:[{validateOrderList:0}],orderDirection:[{validateOrderDirection:0}],limit:[{validateLimit:0}],showCategories:[{validateShowCategories:0}],measureScale:[{validateMeasureScale:0}],showMeasureScale:[{validateShowMeasureScale:0}],stack:[{validateStack:0}],scale:[{validateScaling:0}]}}};Pt.style=':host{display:inline-block;position:relative;overflow:hidden}.container{display:flex;flex-direction:row}.background-image{display:flex;flex-wrap:wrap;justify-content:flex-end}.categories{text-align:right;font-size:var(--bn-font-size, 1em);font-family:var(--bn-font-family, "Noto Sans", "Helvetica Neue", Helvetica, sans-serif);color:var(--bn-font-color, black)}.label-bg{fill:var(--bn-font-background, white);opacity:0.7}.label-text{text-align:right;font-size:var(--bn-font-size, 1em);font-family:var(--bn-font-family, "Noto Sans", "Helvetica Neue", Helvetica, sans-serif);color:var(--bn-font-color, black)}.axis-title{text-align:center;font-family:var(--bn-font-family, "Noto Sans", "Helvetica Neue", Helvetica, sans-serif);color:var(--bn-font-color, black)}.axis-ac{stroke:black;stroke-width:0.1em}.axis-pp{stroke:grey;stroke-width:0.1em}.axis-fc{stroke:black;stroke-dasharray:2;stroke-width:0.1em}.axis-pl{stroke:white;stroke-width:0.1em;outline-offset:0em;outline:0.1em solid black}canvas{image-rendering:-moz-crisp-edges;image-rendering:-webkit-crisp-edges;image-rendering:pixelated;image-rendering:crisp-edges}.measure{font-weight:bold}span{display:inline-block}.hidePatternContainer{height:0;width:0}div{float:left}.warning{font-size:0.8em;font-style:italic}.footer{margin:0.2em;font-size:0.6em}.footer-hide{margin:0.2em;font-size:0.6em;opacity:0}';const Lt=class{constructor(i){t(this,i),this.name="_default",a(this),this.errors=u(this),d(this,(t=>{this.stores||(this.stores=o(this.element));try{const i=JSON.parse(t);this.stores.componentStyles.set(this.name,i),this.errors.remove("JSON_PARSE")}catch(t){this.errors.addOrReplace({id:"JSON_PARSE",type:"error",message:`bn-component-style: Failed to parse JSON body — ${t.message}`}),console.error(t)}}))}render(){return i(s,{key:"e9298c6ce5b0b51260165e78dcf19efdef0646f9"})}get element(){return e(this)}};Lt.style="bn-component-style{display:none}";const Ct=class{constructor(i){t(this,i),this.currentPageUpdate=void 0,a(this),this.errors=u(this)}setLocale(t){this.stores.context.state.locale=t}connectedCallback(){this.stores=l(this.element),this.locale&&(this.stores.context.state.locale=this.locale),this.currentPageUpdate=setTimeout((()=>{this.element.querySelectorAll("bn-page, bn-layout-page").forEach(((t,i)=>{if("bn-layout-page"===t.localName)t.setAttribute("page-number",(i+1).toString());else{const s=t.querySelector("bn-footer");s&&s.setAttribute("page-number",(i+1).toString())}}))}),250)}disconnectedCallback(){this.currentPageUpdate&&clearTimeout(this.currentPageUpdate)}componentWillLoad(){}componentDidLoad(){}componentShouldUpdate(){}componentWillRender(){}componentDidRender(){}componentWillUpdate(){}componentDidUpdate(){}render(){return i(s,{key:"b92019b909e271225baca2cf740c8301e324164e"},i("slot",{key:"87bac4bb29bca32d961afe31355dc1bd48fff0f8"}))}get element(){return e(this)}static get watchers(){return{locale:[{setLocale:0}]}}};Ct.style=":host{display:block}";const Ut=["ac1","ac2","ac3","ac4","pp1","pp2","pp3","pp4","fc1","fc2","fc3","fc4","pl1","pl2","pl3","pl4"],Nt=["rowGroup","category","subCategory","columnGroup","columnSubGroup"];function At(t){return"number"==typeof t&&!isNaN(t)&&isFinite(t)}function Dt(t){const i=Array.from(t);return{distinctValues:i,count:i.length,hasData:i.length>0}}var Gt=Uint8Array,Wt=Uint16Array,Ft=Int32Array,Bt=new Gt([0,0,0,0,0,0,0,0,1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,0,0,0,0]),zt=new Gt([0,0,0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8,9,9,10,10,11,11,12,12,13,13,0,0]),Yt=new Gt([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),Ht=function(t,i){for(var s=new Wt(31),e=0;e<31;++e)s[e]=i+=1<<t[e-1];var n=new Ft(s[30]);for(e=1;e<30;++e)for(var r=s[e];r<s[e+1];++r)n[r]=r-s[e]<<5|e;return{b:s,r:n}},It=Ht(Bt,2),Vt=It.b,jt=It.r;Vt[28]=258,jt[258]=28;for(var Xt=Ht(zt,0).b,Jt=new Wt(32768),Kt=0;Kt<32768;++Kt){var Qt=(43690&Kt)>>1|(21845&Kt)<<1;Jt[Kt]=((65280&(Qt=(61680&(Qt=(52428&Qt)>>2|(13107&Qt)<<2))>>4|(3855&Qt)<<4))>>8|(255&Qt)<<8)>>1}var qt=function(t,i,s){for(var e=t.length,n=0,r=new Wt(i);n<e;++n)t[n]&&++r[t[n]-1];var a,o=new Wt(i);for(n=1;n<i;++n)o[n]=o[n-1]+r[n-1]<<1;if(s){a=new Wt(1<<i);var h=15-i;for(n=0;n<e;++n)if(t[n])for(var l=n<<4|t[n],c=i-t[n],d=o[t[n]-1]++<<c,u=d|(1<<c)-1;d<=u;++d)a[Jt[d]>>h]=l}else for(a=new Wt(e),n=0;n<e;++n)t[n]&&(a[n]=Jt[o[t[n]-1]++]>>15-t[n]);return a},Zt=new Gt(288);for(Kt=0;Kt<144;++Kt)Zt[Kt]=8;for(Kt=144;Kt<256;++Kt)Zt[Kt]=9;for(Kt=256;Kt<280;++Kt)Zt[Kt]=7;for(Kt=280;Kt<288;++Kt)Zt[Kt]=8;var ti=new Gt(32);for(Kt=0;Kt<32;++Kt)ti[Kt]=5;var ii=qt(Zt,9,1),si=qt(ti,5,1),ei=function(t){for(var i=t[0],s=1;s<t.length;++s)t[s]>i&&(i=t[s]);return i},ni=function(t,i,s){var e=i/8|0;return(t[e]|t[e+1]<<8)>>(7&i)&s},ri=function(t,i){var s=i/8|0;return(t[s]|t[s+1]<<8|t[s+2]<<16)>>(7&i)},ai=["unexpected EOF","invalid block type","invalid length/literal","invalid distance","stream finished","no stream handler",,"no callback","invalid UTF-8 data","extra field too long","date not in range 1980-2099","filename too long","stream finishing","invalid zip data"],oi=function(t,i,s){var e=new Error(i||ai[t]);if(e.code=t,Error.captureStackTrace&&Error.captureStackTrace(e,oi),!s)throw e;return e},hi=new Gt(0);function li(t,i){var s,e,n=function(t){31==t[0]&&139==t[1]&&8==t[2]||oi(6,"invalid gzip data");var i=t[3],s=10;4&i&&(s+=2+(t[10]|t[11]<<8));for(var e=(i>>3&1)+(i>>4&1);e>0;e-=!t[s++]);return s+(2&i)}(t);return n+8>t.length&&oi(6,"invalid gzip data"),function(t,i,s,e){var n=t.length;if(!n||i.f&&!i.l)return s||new Gt(0);var r=!s,a=r||2!=i.i;r&&(s=new Gt(3*n));var o,h,l=function(t){var i=s.length;if(t>i){var e=new Gt(Math.max(2*i,t));e.set(s),s=e}},c=i.f||0,d=i.p||0,u=i.b||0,p=i.l,f=i.d,v=i.m,m=i.n,g=8*n;do{if(!p){c=ni(t,d,1);var b=ni(t,d+1,3);if(d+=3,!b){var w=t[(T=4+((d+7)/8|0))-4]|t[T-3]<<8,y=T+w;if(y>n){oi(0);break}a&&l(u+w),s.set(t.subarray(T,y),u),i.b=u+=w,i.p=d=8*y,i.f=c;continue}if(1==b)p=ii,f=si,v=9,m=5;else if(2==b){var S=ni(t,d,31)+257,R=ni(t,d+10,15)+4,O=S+ni(t,d+5,31)+1;d+=14;for(var $=new Gt(O),x=new Gt(19),E=0;E<R;++E)x[Yt[E]]=ni(t,d+3*E,7);d+=3*R;var _=ei(x),M=(1<<_)-1,k=qt(x,_,1);for(E=0;E<O;){var T,P=k[ni(t,d,M)];if(d+=15&P,(T=P>>4)<16)$[E++]=T;else{var L=0,C=0;for(16==T?(C=3+ni(t,d,3),d+=2,L=$[E-1]):17==T?(C=3+ni(t,d,7),d+=3):18==T&&(C=11+ni(t,d,127),d+=7);C--;)$[E++]=L}}var U=$.subarray(0,S),N=$.subarray(S);v=ei(U),m=ei(N),p=qt(U,v,1),f=qt(N,m,1)}else oi(1);if(d>g){oi(0);break}}a&&l(u+131072);for(var A=(1<<v)-1,D=(1<<m)-1,G=d;;G=d){var W=(L=p[ri(t,d)&A])>>4;if((d+=15&L)>g){oi(0);break}if(L||oi(2),W<256)s[u++]=W;else{if(256==W){G=d,p=null;break}var F=W-254;W>264&&(F=ni(t,d,(1<<(Y=Bt[E=W-257]))-1)+Vt[E],d+=Y);var B=f[ri(t,d)&D],z=B>>4;if(B||oi(3),d+=15&B,N=Xt[z],z>3){var Y=zt[z];N+=ri(t,d)&(1<<Y)-1,d+=Y}if(d>g){oi(0);break}a&&l(u+131072);var H=u+F;if(u<N){var I=0-N,V=Math.min(N,H);for(I+u<0&&oi(3);u<V;++u)s[u]=e[I+u]}for(;u<H;++u)s[u]=s[u-N]}}i.l=p,i.p=G,i.b=u,i.f=c,p&&(c=1,i.m=v,i.d=f,i.n=m)}while(!c);return u!=s.length&&r?(o=s,(null==(h=u)||h>o.length)&&(h=o.length),new Gt(o.subarray(0,h))):s.subarray(0,u)}(t.subarray(n,-8),{i:2},new Gt(((s=t)[(e=s.length)-4]|s[e-3]<<8|s[e-2]<<16|s[e-1]<<24)>>>0),i)}var ci="undefined"!=typeof TextDecoder&&new TextDecoder;try{ci.decode(hi,{stream:!0})}catch(t){}function di(t){return _(t)}function ui(t){const i=t.indexOf(":");if(-1===i)throw new Error("Invalid compressed format: missing ':' separator");const s=t.slice(0,i),e=t.slice(i+1),n=atob(e),r=new Uint8Array(n.length);for(let t=0;t<n.length;t++)r[t]=n.charCodeAt(t);const a=li(r);return{hash:s,json:(new TextDecoder).decode(a)}}const pi=class{constructor(i){t(this,i),this.datasources="",this.static=!1,this.raw=!0,this.lastBodyHash=null,a(this),this.errors=u(this),this.database=new lt.Database,((t,i)=>{let s,n,r=[];const a=new MutationObserver((s=>{s.forEach((s=>{"datasources"===s.attributeName&&(r=(e(t).getAttribute("datasources")||"").split(","),r.forEach((t=>{i(t,n.datasources.get(t))})))}))})),h=t.connectedCallback;t.connectedCallback=()=>{const l=e(t);n=o(l),r=(l.getAttribute("datasources")||"").split(","),r.forEach((t=>{i(t,n.datasources.get(t))})),a.observe(l,{attributes:!0,attributeFilter:["datasources"]}),s=n.datasources.on("set",((t,s)=>{r.includes(t)&&i(t,s)})),p(h,t)};const l=t.disconnectedCallback;t.disconnectedCallback=()=>{a.disconnect(),p(s),c(e(t)),p(l,t)}})(this,((t,i)=>{this.database.tables[t]={data:i},this.executeQuery()})),d(this,(t=>{let i,s;if(!this.raw&&this.static)try{const e=ui(t);i=e.hash,s=e.json}catch(i){return void console.error("Error decoding compressed dataset",i,String(t).slice(0,200))}else i=di(t),s=t;i!==this.lastBodyHash&&(this.lastBodyHash=i,this.query=s,this.executeQuery())}))}executeQuery(){if(this.stores||(this.stores=o(this.element)),this.query&&this.name){let t;if(this.static)try{t=JSON.parse(this.query)}catch(i){console.error("Failed to parse static dataset",i),t=[]}else t=this.database.exec(this.query);this.latestResult!==t&&(this.latestResult=t,this.stores.datasets.set(this.name,t),this.stores.datasetsMeta.set(this.name,function(t){const i={};for(const t of Nt)i[t]=new Set;const s={};for(const t of Ut)s[t]={hasData:!1,min:null,max:null};const e=new Set;let n=null,r=null;const a=Array.isArray(t)?t:[];for(let t=0;t<a.length;t++){const o=a[t];if(null==o)continue;for(const t of Nt){const s=o[t];null!=s&&""!==s&&i[t].add(String(s))}for(const t of Ut){const i=o[t];if(At(i)){const e=s[t];e.hasData=!0,(null===e.min||i<e.min)&&(e.min=i),(null===e.max||i>e.max)&&(e.max=i)}}const h=o.date;if(null!=h&&""!==h){const t=String(h);e.add(t),(null===n||t<n)&&(n=t),(null===r||t>r)&&(r=t)}}const o=Ut.map((t=>({key:t,hasData:s[t].hasData,min:s[t].min,max:s[t].max}))),h=o.filter((t=>t.hasData)).map((t=>t.key)),l=Dt(i.rowGroup),c=Dt(i.category),d=Dt(i.subCategory),u=Dt(i.columnGroup),p=Dt(i.columnSubGroup),f={min:n,max:r,hasData:e.size>0,distinctCount:e.size};let v="category";return d.hasData?v="subCategory":c.hasData?v="category":l.hasData&&(v="rowGroup"),{rowCount:a.length,scenarios:o,availableScenarios:h,rowGroup:l,category:c,subCategory:d,columnGroup:u,columnSubGroup:p,dateRange:f,suggestedLevel:v,suggestedOrder:v,suggestedDateInterval:f.hasData?"auto":null,calculatedAt:Date.now()}}(t)))}}nameUpdated(){this.executeQuery()}render(){return i(s,{key:"3e8b6fbc52b5b5cbe0ae88d7aa1d259f86d63e1b"})}get element(){return e(this)}static get watchers(){return{name:[{nameUpdated:0}]}}};pi.style="bn-dataset{display:none}";const fi=class{constructor(i){t(this,i),this.raw=!0,this.lastHash=null,a(this),this.errors=u(this),d(this,(t=>{this.stores||(this.stores=o(this.element));try{let i,s;if(this.raw)i=di(t),s=t;else{const e=ui(t);i=e.hash,s=e.json}if(i===this.lastHash)return;this.lastHash=i;const e=JSON.parse(s);this.stores.datasources.set(this.name,e)}catch(i){console.error("Error parsing datasource",i,String(t).slice(0,200)),this.stores.datasources.set(this.name,[])}}))}render(){return i(s,{key:"43b691b07f63d12ad6c835dfb5d5bf6053b3bbf4"})}get element(){return e(this)}};fi.style="bn-datasource{display:none}";const vi=class{constructor(i){t(this,i),this.pageNumber=null,this.displayPageNumber=!0,a(this),this.errors=u(this),this.componentStyle=f(this)}getFontStyles(){return this.componentStyle((t=>{var i,s,e,n;return{"--bn-font-family":(null===(i=t.global)||void 0===i?void 0:i.fontFamily)||"'Noto Sans', sans-serif","--bn-font-size":`${(null===(s=t.global)||void 0===s?void 0:s.fontSizePx)||13.3333}px`,"--bn-font-color":(null===(e=t.global)||void 0===e?void 0:e.fontColor)||"#000000","--bn-font-background":(null===(n=t.global)||void 0===n?void 0:n.fontBackgroundColor)||"#ffffff"}}))}isValidHttpUrl(t){let i;try{i=new URL(t)}catch(t){return!1}return"http:"===i.protocol||"https:"===i.protocol}prepareAssetUrl(t){return this.isValidHttpUrl(t)?t:`./assets/${t}.png`}render(){return i(s,{key:"c445ca8c8abde56b46564932a6fcd079aa1e640d",id:this.displayPageNumber||this.text||this.code?"container-page-footer":"container",style:this.getFontStyles()},i("div",{key:"2e5829597d228c78acbbbf130bfc440092456cb4",id:"footer-text"},null!=this.text?i("span",{class:"note"},this.text):""),i("div",{key:"a2c98bf85fc41fa0aebc35fded0528cd8ba4948f",id:"code"},null!=this.code?i("img",{class:"image",src:n(`${this.prepareAssetUrl(this.code)}`)}):""),i("div",{key:"e879c6ed16996d8b505d64426e2253f3057863f5",id:"page-number"},this.displayPageNumber?i("span",{class:"page"},this.pageNumber):""))}static get assetsDirs(){return["assets"]}get element(){return e(this)}};vi.style=':host{padding:0.2em 0.5em;display:flex;flex-direction:row;justify-content:space-between;font-family:var(--bn-font-family, "Noto Sans", sans-serif);font-size:var(--bn-font-size, 13.3333px);color:var(--bn-font-color, #000000)}:host(#container-page-footer){box-sizing:border-box;-webkit-box-sizing:border-box;border-top:0.1em solid #ddd}div#footer-text{font-size:0.6em;display:inline}div#code{flex:1;display:inline;text-align:right;padding-right:1em}div#page-number{font-size:0.6em;display:inline}.image{z-index:2;background-color:transparent;border:transparent;height:1.2em;width:auto}';const mi=class{constructor(i){t(this,i),this.messageText="",this.messageImage="",this.titleBusinessUnit="",this.titleOrder="category",this.titleOrderDirection="asc",this.titleDateFormat="none",this.titleDateLink="none",this.titleNamespace="_system",this.footerDisplayPageNumber=!0,this.pageLayout="full",this.pageCustomTemplate='"a b" "c d"',this.pageGridGap="0",this.pageFitToContent=!0,this.templateMap=new Map([["split-vertical",'"a b"'],["split-horizontal",'"a" "b"'],["2x2",'"a b" "c d"'],["3x3",'"a b c" "d e f" "g h i"'],["4x4",'"a b c d" "e f g h" "i j k l" "m n o p"'],["1-over-2",'"a a" "b c"'],["2-over-1",'"a b" "c c"'],["1-over-3",'"a a a " "b c d"'],["3-over-1",'"a b c" "d d d"'],["custom-template",'"a b" "c c c"'],["gold3",'"a c" "b c"'],["gold4",'"a b c c" "d d c c"']]),this.errors=u(this)}getCommonStyles(){let t="100%";return!0===this.pageFitToContent&&(t="fit-content"),{display:"grid",height:t,width:"100%",gap:this.pageGridGap+"px"}}getGridTemplateRows(t){const i=this.getTemplateAreas(t).match(/"[\w\d\s.]+"/g),s=i?i.length:1;return this.pageFitToContent?Array(s).fill("auto").join(" "):Array(s).fill("1fr").join(" ")}getLayoutStyle(){return Object.assign(Object.assign({},this.getCommonStyles()),{"grid-template-areas":this.getTemplateAreas(this.pageLayout),"grid-template-columns":this.getGridTemplateColumns(this.pageLayout),"grid-template-rows":this.getGridTemplateRows(this.pageLayout)})}createDivAreaStyles(t){return t.map((t=>({width:"100%",overflow:"hidden","grid-area":t,height:"100%"})))}getSlots(t){const s=this.createDivAreaStyles(t);return i(r,null,s.map(((t,s)=>i("div",{style:t},i("slot",{name:"slot-"+s})))))}extractSlotNames(t){if(null==t)return[];const i=t.match(/\b\w+\b/g);return i?Array.from(new Set(i)):[]}getTemplateAreas(t){return!1===this.templateMap.has(t)&&"custom-template"!==t?'"a"':"custom-template"===t?this.pageCustomTemplate:this.templateMap.get(t)}calculatePercentages(t){const i=t.trim().split(/\s+/).length;if(0===i)return"100%";const s=(100/i).toFixed(0)+"%";return Array(i).fill(s).join(" ")}getGridTemplateColumns(t){if(!1===this.templateMap.has(t)&&"custom-template"!==t)return"100%";let i;i="custom-template"===t?this.pageCustomTemplate:this.templateMap.get(t);const s=i.match(/"[\w\d\s.]+"/g);return this.calculatePercentages(s[0])}async getNumberOfSlot(t){const i=this.getTemplateAreas(t);return this.extractSlotNames(i).length}componentDidUpdate(){const t=this.element.closest("bn-context").getAttribute("render-orientation");if(t&&t!==this.pageOrientation){const t=this.element.shadowRoot.querySelector("bn-page"),i=this.element.closest("bn-layout-page");i&&t&&(t.style.transform="rotate(-90deg) translate(-100%)",t.style.transformOrigin="top left",i.style.width=`${t.clientHeight}px`,i.style.height=`${t.clientWidth}px`)}}render(){const t=this.getLayoutStyle(),s=this.extractSlotNames(t["grid-template-areas"]);return i("bn-page",{key:"1c262428d9e69966f3089f5018b5a71e348c31b7",styles:this.styles,format:this.pageFormat,orientation:this.pageOrientation},i("bn-message",{key:"c687e6d660a7301202663644f2bce0e20d148420",text:this.messageText,image:this.messageImage}),i("bn-title",{key:"6e30d548765d8b32f7ab85c6203c1af2142d55c5",namespace:this.titleNamespace,"business-unit":this.titleBusinessUnit,scenarios:this.titleScenarios,variances:this.titleVariances,order:this.titleOrder,"order-direction":this.titleOrderDirection,measures:this.titleMeasures,"date-start":this.titleDateStart,"date-end":this.titleDateEnd,"date-format":this.titleDateFormat,"date-link":this.titleDateLink}),i("bn-body",{key:"a691c212bcf2ed7c95792de989be4a5c5d30aa5f"},i("div",{key:"150f9e5941e723f527166ef9071b721b194101fe",style:t},this.getSlots(s))),i("bn-footer",{key:"9868b2deab6302fc029b6d9f9780d84269245979",text:this.footerText,"page-number":this.pageNumber,"display-page-number":this.footerDisplayPageNumber}))}get element(){return e(this)}};mi.style=':host{background:var(--bn-font-background, white);color:var(--bn-font-color, black);font-family:var(--bn-font-family, "Noto Sans", sans-serif);font-size:var(--bn-font-size, 13.3333px);display:block;flex-direction:column;overflow:hidden;float:left;clear:left}';const gi=class{constructor(i){t(this,i),a(this),this.errors=u(this),this.componentStyle=f(this)}connectedCallback(){this.stores=o(this.element)}getFontStyles(){return this.componentStyle((t=>{var i,s,e,n;return{"--bn-font-family":(null===(i=t.global)||void 0===i?void 0:i.fontFamily)||"'Noto Sans', sans-serif","--bn-font-size":`${(null===(s=t.global)||void 0===s?void 0:s.fontSizePx)||13.3333}px`,"--bn-font-color":(null===(e=t.global)||void 0===e?void 0:e.fontColor)||"#000000","--bn-font-background":(null===(n=t.global)||void 0===n?void 0:n.fontBackgroundColor)||"#ffffff"}}))}prepareAssetUrl(t){if(null==t||""===t)return"";const i=this.stores.assets.state;return t.startsWith("asset:")?i[t.substring(6)]:i[t]||t}render(){return i(s,{key:"bbe7f6098aa6f3a5495b36557b218a82ec2ccbca",id:this.text||this.image?"container-page-message":"container",style:this.getFontStyles()},i("div",{key:"d89297da5605b0ee1cc757b1771b6a48525a24e5",id:"message-text"},null!=this.text&&""!==this.text?i("span",{class:"note"},this.text):""),i("div",{key:"70bc74b0a8a5a39fdd2931cf86faada294142a26",id:"page-image"},null!=this.image&&""!==this.image?i("img",{class:"image",src:this.prepareAssetUrl(this.image)}):""))}static get assetsDirs(){return["assets"]}get element(){return e(this)}};gi.style=':host{padding:0.2em 0.5em;display:flex;flex-direction:row;justify-content:space-between;font-family:var(--bn-font-family, "Noto Sans", sans-serif);font-size:var(--bn-font-size, 13.3333px);color:var(--bn-font-color, #000000)}:host(#container-page-message){height:4.55em;box-sizing:border-box;-webkit-box-sizing:border-box;border-bottom:0.1em solid #ddd}div#message-text{font-size:1.4em;overflow:clip;display:inline}.image{z-index:2;background-color:transparent;border:transparent;height:4em;width:auto;display:inline}';const bi=["xga","hd","full-hd","4k","4k2k","a4","a3","a2","a1","a0","letter","legal"],wi=["landscape","portrait"],yi=class{constructor(i){t(this,i),a(this),this.errors=u(this),this.componentStyle=f(this)}validateFormat(t){const i="ERR_format";E(t)||bi.includes(t)?this.errors.remove(i):this.errors.addOrReplace({id:i,type:"warning",message:`format: invalid value '${t}' is not supported. Valid values: ${bi.join(", ")}`})}validateOrientation(t){const i="ERR_orientation";E(t)||wi.includes(t)?this.errors.remove(i):this.errors.addOrReplace({id:i,type:"warning",message:`orientation: invalid value '${t}' is not supported. Valid values: ${wi.join(", ")}`})}render(){return i(s,{key:"b4d682a8f6e83f77c58236265eaf9d1327809c6f",format:this.format,orientation:this.orientation,style:this.prepareStyle()},i("slot",{key:"ef49c43c1f8926c4c968b752608627adbe330d6c"}))}prepareStyle(){return{"font-family":this.componentStyle((t=>t.global.fontFamily)),"font-size":`${this.componentStyle((t=>t.global.fontSizePx))}px`,"--bn-font-family":this.componentStyle((t=>t.global.fontFamily))||"'Noto Sans', sans-serif","--bn-font-size":`${this.componentStyle((t=>t.global.fontSizePx))||13.3333}px`,"--bn-font-color":this.componentStyle((t=>t.global.fontColor))||"#000000","--bn-font-background":this.componentStyle((t=>t.global.fontBackgroundColor))||"#ffffff"}}get element(){return e(this)}static get watchers(){return{format:[{validateFormat:0}],orientation:[{validateOrientation:0}]}}};var Si,Ri,Oi,$i,xi;yi.style=':host{background:var(--bn-font-background, white);color:var(--bn-font-color, black);font-family:var(--bn-font-family, "Noto Sans", sans-serif);font-size:var(--bn-font-size, 13.3333px);height:768px;width:1024px;display:flex;flex-direction:column;page-break-after:always;overflow:hidden}:host([format=xga]){height:768px;width:1024px}:host([format=xga][orientation=portrait]){height:1024px;width:768px}:host([format=xga][orientation=landscape]){height:768px;width:1024px}:host([format=hd]){height:720px;width:1280px}:host([format=hd][orientation=portrait]){height:1280px;width:720px}:host([format=hd][orientation=landscape]){height:720px;width:1280px}:host([format=full_hd]){height:1080px;width:1920px}:host([format=full_hd][orientation=portrait]){height:1920px;width:1080px}:host([format=full_hd][orientation=landscape]){height:1080px;width:1920px}:host([format="4k"]){height:2160px;width:3840px}:host([format="4k"][orientation=portrait]){height:3840px;width:2160px}:host([format="4k"][orientation=landscape]){height:2160px;width:3840px}:host([format="4k2k"]){height:2160px;width:4096px}:host([format="4k2k"][orientation=portrait]){height:4096px;width:2160px}:host([format="4k2k"][orientation=landscape]){height:2160px;width:4096px}:host([format=a6]){height:5.83in;width:4.13in}:host([format=a6][orientation=portrait]){height:5.83in;width:4.13in}:host([format=a6][orientation=landscape]){height:4.13in;width:5.83in}:host([format=a5]){height:8.27in;width:5.83in}:host([format=a5][orientation=portrait]){height:8.27in;width:5.83in}:host([format=a5][orientation=landscape]){height:5.83in;width:8.27in}:host([format=a4]){height:11.6in;width:8.17in}:host([format=a4][orientation=portrait]){height:11.6in;width:8.17in}:host([format=a4][orientation=landscape]){height:8.17in;width:11.6in}:host([format=a3]){height:16.54in;width:11.7in}:host([format=a3][orientation=portrait]){height:16.54in;width:11.7in}:host([format=a3][orientation=landscape]){height:11.7in;width:16.54in}:host([format=a2]){height:23.4in;width:16.54in}:host([format=a2][orientation=portrait]){height:23.4in;width:16.54in}:host([format=a2][orientation=landscape]){height:16.54in;width:23.4in}:host([format=a1]){height:33.1in;width:23.4in}:host([format=a1][orientation=portrait]){height:33.1in;width:23.4in}:host([format=a1][orientation=landscape]){height:23.4in;width:33.1in}:host([format=a0]){height:46.8in;width:33.1in}:host([format=a0][orientation=portrait]){height:46.8in;width:33.1in}:host([format=a0][orientation=landscape]){height:33.1in;width:46.8in}:host([format=letter]){height:11in;width:8.5in}:host([format=letter][orientation=portrait]){height:11in;width:8.5in}:host([format=letter][orientation=landscape]){height:8.5in;width:11in}:host([format=legal]){height:14in;width:8.5in}:host([format=legal][orientation=portrait]){height:14in;width:8.5in}:host([format=legal][orientation=landscape]){height:8.5in;width:14in}:host([format=tabloid]){height:17in;width:11in}:host([format=tabloid][orientation=portrait]){height:17in;width:11in}:host([format=tabloid][orientation=landscape]){height:11in;width:17in}:host([format=ledger]){height:11in;width:17in}:host([format=ledger][orientation=portrait]){height:17in;width:11in}:host([format=ledger][orientation=landscape]){height:11in;width:17in}',function(t){t[t.ALL=-1]="ALL"}(Si||(Si={})),function(t){t[t.UP_TO_DATE=0]="UP_TO_DATE",t[t.DIRTY=1]="DIRTY"}(Ri||(Ri={})),function(t){t.LIST="list",t.SUM="sum",t.SUMNOTOTAL="sumnototal",t.OPT="opt",t.OPTNOTOTAL="optnototal"}(Oi||(Oi={})),function(t){t.ASC="asc",t.DESC="desc"}($i||($i={})),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"}(xi||(xi={}));const Ei=class{validateScaling(t){if(null==t||""===t||"none"===t||"auto"===t)return void this.errors.remove("ERR_scale");const i=Number(t);isNaN(i)||i<=0?this.errors.addOrReplace({id:"ERR_scale",type:"warning",message:`Invalid scale value: "${t}". Use "none", "auto", or a positive number.`}):this.errors.remove("ERR_scale")}constructor(i){t(this,i),this.data=[],this.datasetMeta=null,this.appliedScaleFactor=1,this.tableTitle="",this.filter="",this.measureUnit="",this.barColumnWidth="w10",this.unitScaling=.01,this.percentageScaling=.5,this.pixelPerUnitGroupMap=new Map,this.dataFormat="decimal",this.grouped="false",this.showMeasureScale="false",this.showGroupTitle="true",this.type="list",this.limit=0,this.thereof="[]",this.partof="[]",this.order="category",this.orderDirection="asc",this.measureType="volume",this.measureScale="greatest",this.dataFormatDigitsDecimal=1,this.dataFormatDigitsPercent=2,this.categoryWidth="w15",this.columnthereof=null,this._autoScaleGuard=!1,x(this),a(this),this.errors=u(this),this.componentStyle=f(this),F(this,((t,i)=>{this.data=i||[]}),((t,i)=>{this.datasetMeta=i})),this.t=B(this).t}validateScenario(t){const i="ERR_scenarios",s=v(t);s.length>0?this.errors.addOrReplace({id:i,type:"warning",message:"scenarios: invalid value(s) '"+(null==s?void 0:s.toString())+"' are not supported."}):this.errors.remove(i)}validateVariances(t){const i="ERR_variances",s=m(t);s.length>0?this.errors.addOrReplace({id:i,type:"warning",message:"variances: invalid value(s) '"+JSON.stringify(s)+"' are not supported."}):this.errors.remove(i)}validateBarColumns(t){const i="ERR_barColumns";if(E(t))return void this.errors.remove(i);const s=m(t);s.length>0?this.errors.addOrReplace({id:i,type:"warning",message:"barColumns: invalid value(s) '"+JSON.stringify(s)+"' are not supported."}):this.errors.remove(i)}validateBarColumnWidth(t){const i="ERR_barColumnWidth";M(t)?this.errors.remove(i):this.errors.addOrReplace({id:i,type:"warning",message:"barColumnWidth: invalid value '"+t+"' is not supported."})}validateUnitScaling(t){const i="ERR_unitScaling";g(t)||this.pixelPerUnitGroupMap.has(t)?this.errors.remove(i):this.errors.addOrReplace({id:i,type:"warning",message:"unitScaling: invalid value '"+t+"' is not supported."})}validatePercentageScaling(t){const i="ERR_percentageScaling";g(t)||this.pixelPerUnitGroupMap.has(t)?this.errors.remove(i):this.errors.addOrReplace({id:i,type:"warning",message:"percentageScaling: invalid value '"+t+"' is not supported."})}validateDataFormat(t){const i="ERR_dataFormat";k(t)?this.errors.remove(i):this.errors.addOrReplace({id:i,type:"warning",message:"dataFormat: invalid value(s) '"+(null==t?void 0:t.toString())+"' are not supported."})}validateGrouped(t){const i="ERR_grouped";R(t)?this.errors.remove(i):this.errors.addOrReplace({id:i,type:"warning",message:"grouped: invalid value(s) '"+(null==t?void 0:t.toString())+"' are not supported."})}validateShowMeasureScale(t){const i="ERR_grouped";R(t)?this.errors.remove(i):this.errors.addOrReplace({id:i,type:"warning",message:"showMeasureScale: invalid value(s) '"+(null==t?void 0:t.toString())+"' are not supported."})}validateShowGroupTitle(t){const i="ERR_showGroupTitle";R(t)?this.errors.remove(i):this.errors.addOrReplace({id:i,type:"warning",message:"showGroupTitle: invalid value(s) '"+(null==t?void 0:t.toString())+"' are not supported."})}validateType(t){const i="ERR_type";T(t)?this.errors.remove(i):this.errors.addOrReplace({id:i,type:"warning",message:"type: invalid value(s) '"+(null==t?void 0:t.toString())+"' are not supported."})}validateLimit(t){const i="ERR_limit";S(t)?this.errors.remove(i):this.errors.addOrReplace({id:i,type:"warning",message:"order: invalid value '"+(null==t?void 0:t.toString())+"' is not supported."})}validateThereOf(t){const i="ERR_thereof",s=P(t);s.length>0?this.errors.addOrReplace({id:i,type:"warning",message:"ThereOf: invalid value(s) '"+JSON.stringify(s)+"' are not supported."}):this.errors.remove(i)}validatePartOf(t){const i="ERR_partof",s=L(t);s.length>0?this.errors.addOrReplace({id:i,type:"warning",message:"partof: invalid value(s) '"+JSON.stringify(s)+"' are not supported."}):this.errors.remove(i)}validateOrderList(t){const i="ERR_order",s=w(t);s.length>0?this.errors.addOrReplace({id:i,type:"warning",message:"order: invalid value(s) '"+JSON.stringify(s)+"' are not supported."}):this.errors.remove(i)}validateOrderDirection(t){const i="ERR_orderDirection";y(t)?this.errors.remove(i):this.errors.addOrReplace({id:i,type:"warning",message:"orderDirection: invalid value '"+(null==t?void 0:t.toString())+"' is not supported."})}validateMeasureType(t){const i="ERR_measureType";C(t)?this.errors.remove(i):this.errors.addOrReplace({id:i,type:"warning",message:"measureType: invalid value '"+(null==t?void 0:t.toString())+"' is not supported."})}validateMeasureScale(t){const i="ERR_measureScale";O(t)?this.errors.remove(i):this.errors.addOrReplace({id:i,type:"warning",message:"measureScale: invalid value '"+(null==t?void 0:t.toString())+"' is not supported."})}validateDataFormatDigitsDecimal(t){const i="ERR_dataFormatDigitsDecimal";S(t)?this.errors.remove(i):this.errors.addOrReplace({id:i,type:"warning",message:"dataFormatDigitsDecimal: invalid value(s) '"+t+"' are not supported."})}validateDateFormatDigitsPercent(t){const i="ERR_dataFormatDigitsPercent";S(t)?this.errors.remove(i):this.errors.addOrReplace({id:i,type:"warning",message:"dataFormatDigitsPercent: invalid value(s) '"+t+"' are not supported."})}validateCategoryWidth(t){const i="ERR_categoryWidth";U(t)?this.errors.remove(i):this.errors.addOrReplace({id:i,type:"warning",message:"categoryWidth: invalid value(s) '"+t+"' are not supported."})}validateColumnThereOf(t){const i=N(t),s="ERR_categorythereof";i.length>0?this.errors.addOrReplace({id:s,type:"warning",message:"columnthereof: invalid value(s) '"+JSON.stringify(i)+"' are not supported."}):this.errors.remove(s)}componentWillLoad(){this.validateScenario(this.scenarios),this.validateVariances(this.variances),this.validateDataFormat(this.dataFormat),this.validateGrouped(this.grouped),this.validateShowGroupTitle(this.showGroupTitle),this.validateType(this.type),this.validateLimit(this.limit),this.validateThereOf(this.thereof),this.validatePartOf(this.partof),this.validateOrderDirection(this.orderDirection),this.validateOrderList(this.order),this.validateDataFormatDigitsDecimal(this.dataFormatDigitsDecimal),this.validateDateFormatDigitsPercent(this.dataFormatDigitsPercent),this.validateCategoryWidth(this.categoryWidth),this.validateMeasureType(this.measureType),this.validateMeasureScale(this.measureScale),this.validateColumnThereOf(this.columnthereof),this.validateShowMeasureScale(this.showMeasureScale),this.validateBarColumns(this.barColumns),this.validateBarColumnWidth(this.barColumnWidth),this.validateUnitScaling(this.unitScaling),this.validatePercentageScaling(this.percentageScaling),this.validateScaling(this.scale)}disconnectedCallback(){this.unsubscribe()}componentDidRender(){const{mode:t}=Y(this.scale);if("auto"!==t&&"empty"!==t)return void(this._autoScaleGuard=!1);if(this._autoScaleGuard)return void(this._autoScaleGuard=!1);const i=this.element,{width:s}=z(i);if(s<=0)return;const e=this.componentStyle((t=>{var i;return(null===(i=t.global)||void 0===i?void 0:i.fontSizePx)||13.3333})),n=i.scrollWidth,r=this.appliedScaleFactor,a=r>0?n/r:n;if(a<=s+1)return this.errors.remove("AUTO_scale"),void(1!==this.appliedScaleFactor&&(i.style.setProperty("--bn-font-size",`${e}px`),this._autoScaleGuard=!0,this.appliedScaleFactor=1));const o=(s-1)/a;i.style.setProperty("--bn-font-size",e*o+"px"),"empty"===t?this.errors.addOrReplace({id:"AUTO_scale",type:"warning",message:`Auto-scaled table by factor ${o.toFixed(3)}`}):this.errors.remove("AUTO_scale"),Math.abs(o-this.appliedScaleFactor)>.001&&(this._autoScaleGuard=!0,this.appliedScaleFactor=o)}prepareDataFormat(){var t;return K[null===(t=this.dataFormat)||void 0===t?void 0:t.toUpperCase()]}prepareGrouped(){return"true"===this.grouped}prepareShowGroupTitle(){return"true"===this.showGroupTitle}prepareTableType(){var t;return Oi[null===(t=this.type)||void 0===t?void 0:t.toUpperCase()]}prepareLimit(){return Math.floor(Number(this.limit)||0)}prepareThereOf(){return null==this.thereof||""===this.thereof.trim()?[]:JSON.parse(this.thereof)}preparePartOf(){return null==this.partof||""===this.partof.trim()?[]:JSON.parse(this.partof)}prepareOrder(){var t,i,s;const e="auto"===(null===(t=this.order)||void 0===t?void 0:t.trim().toLowerCase());let n=this.order;return e&&(null===(i=this.datasetMeta)||void 0===i?void 0:i.suggestedOrder)&&(n=this.datasetMeta.suggestedOrder),{hierarchy:n.split(",").map((t=>V[null==t?void 0:t.toUpperCase()])),direction:I[null===(s=this.orderDirection)||void 0===s?void 0:s.toUpperCase()]}}prepareI18nMode(){return Q.META}prepareI18n(){const t=h,i=new Map(["in","category","operation","there_of","part_of","SUM_TOTAL"].map((t=>[t,this.t(".".concat(t))]))),s=new Map(t.map((t=>[t,this.t("global.".concat(t))])));return new Map([...s.entries(),...i.entries()])}prepareDataFormatDigits(){return{percent:this.dataFormatDigitsPercent,decimal:this.dataFormatDigitsDecimal}}prepareScenarios(){var t,i,s,e,n,r,a,o;const h="auto"===(null===(t=this.scenarios)||void 0===t?void 0:t.trim().toLowerCase());if((E(this.scenarios)||h)&&E(this.variances))return(null===(s=null===(i=this.datasetMeta)||void 0===i?void 0:i.availableScenarios)||void 0===s?void 0:s.length)>0?(h?this.errors.remove("AUTO_scenarios"):this.errors.addOrReplace({id:"AUTO_scenarios",type:"warning",message:`scenarios: not set, auto-detected: ${this.datasetMeta.availableScenarios.join(",")}`}),this.datasetMeta.availableScenarios):[];let l=[];return h||E(this.scenarios)?(null===(n=null===(e=this.datasetMeta)||void 0===e?void 0:e.availableScenarios)||void 0===n?void 0:n.length)>0&&(h?this.errors.remove("AUTO_scenarios"):this.errors.addOrReplace({id:"AUTO_scenarios",type:"warning",message:`scenarios: not set, auto-detected: ${this.datasetMeta.availableScenarios.join(",")}`}),l=l.concat(this.datasetMeta.availableScenarios)):(this.errors.remove("AUTO_scenarios"),l=l.concat(null===(r=this.scenarios)||void 0===r?void 0:r.split(","))),(null===(a=this.variances)||void 0===a?void 0:a.trim().length)>0&&(l=l.concat(null===(o=this.variances)||void 0===o?void 0:o.split(","))),l.map((t=>t.trim()))}prepareCategoryWidth(){var t;return E(this.categoryWidth)?q.INF:q[null===(t=this.categoryWidth)||void 0===t?void 0:t.toUpperCase()]}prepareMeasureScale(){return E(this.measureScale)?"GREATEST":["_","k","M","G","T","P","E","Z","Y","m","μ","n","p","P","f","a","z","y"].includes(this.measureScale.trim())||"LEAST"===this.measureScale.trim().toUpperCase()?this.measureScale.trim():"GREATEST"}prepareMeasureType(){var t;return E(this.measureType)?Z.VOLUME:Z[null===(t=this.measureType)||void 0===t?void 0:t.toUpperCase()]}prepareColumnThereOf(){if(null==this.columnthereof||""===this.columnthereof.trim())return new Map;const t=JSON.parse(this.columnthereof),i=new Map;for(const[s,e]of Object.entries(t))!1===i.has(e.scenario)&&i.set(e.scenario,[]),i.get(e.scenario).push(e);return i}prepareTableTitle(){return""===this.tableTitle||null==this.tableTitle?"SUM_TOTAL":this.tableTitle}prepareShowMeasureScale(){return"true"===this.showMeasureScale}prepareMeasureUnit(){return""===this.measureUnit||null==this.measureUnit?"":this.measureUnit}prepareFilter(){return 0===this.filter.length?"":this.filter}prepareBarColumnWidth(){var t;const i=null===(t=this.barColumnWidth)||void 0===t?void 0:t.toUpperCase(),s=it[i];return s?tt[s]:tt[it.W10]}prepareBarColumns(){return E(this.barColumns)?[]:this.barColumns.split(",").map((t=>t.trim()))}prepareUnitScaling(){return this.pixelPerUnitGroupMap.has(this.unitScaling)?this.pixelPerUnitGroupMap.get(this.unitScaling):Number(this.unitScaling)}preparePercentageScaling(){return this.pixelPerUnitGroupMap.has(this.percentageScaling)?this.pixelPerUnitGroupMap.get(this.percentageScaling):Number(this.percentageScaling)}getDataStructure(){return{ITableDataRow:{setName:{type:"string",isOptional:!1,description:""},date:{type:"string",isOptional:!1,description:""},operation:{type:"string",isOptional:!1,description:""},rowGroup:{type:"string",isOptional:!1,description:""},rowGroupIndex:{type:"number",isOptional:!1,description:""},category:{type:"string",isOptional:!1,description:""},categoryIndex:{type:"number",isOptional:!1,description:""},subCategory:{type:"string",isOptional:!1,description:""},subCategoryIndex:{type:"number",isOptional:!1,description:""},columnGroup:{type:"string",isOptional:!1,description:""},columnGroupIndex:{type:"number",isOptional:!1,description:""},columnSubGroup:{type:"string",isOptional:!1,description:""},columnSubGroupIndex:{type:"number",isOptional:!1,description:""},ac1:{type:"number",isOptional:!1,description:""},ac2:{type:"number",isOptional:!1,description:""},ac3:{type:"number",isOptional:!1,description:""},ac4:{type:"number",isOptional:!1,description:""},pp1:{type:"number",isOptional:!1,description:""},pp2:{type:"number",isOptional:!1,description:""},pp3:{type:"number",isOptional:!1,description:""},pp4:{type:"number",isOptional:!1,description:""},fc1:{type:"number",isOptional:!1,description:""},fc2:{type:"number",isOptional:!1,description:""},fc3:{type:"number",isOptional:!1,description:""},fc4:{type:"number",isOptional:!1,description:""},pl1:{type:"number",isOptional:!1,description:""},pl2:{type:"number",isOptional:!1,description:""},pl3:{type:"number",isOptional:!1,description:""},pl4:{type:"number",isOptional:!1,description:""}}}}getEffectiveScaleFactor(){const{mode:t,factor:i}=Y(this.scale);return"factor"===t?i:"auto"===t||"empty"===t?this.appliedScaleFactor:1}getFontStyles(){const t=this.getEffectiveScaleFactor();return this.componentStyle((i=>{var s,e,n,r;const a=(null===(s=i.global)||void 0===s?void 0:s.fontSizePx)||13.3333;return{"--bn-font-family":(null===(e=i.global)||void 0===e?void 0:e.fontFamily)||"'Noto Sans', sans-serif","--bn-font-size":a*t+"px","--bn-font-color":(null===(n=i.global)||void 0===n?void 0:n.fontColor)||"#000000","--bn-font-background":(null===(r=i.global)||void 0===r?void 0:r.fontBackgroundColor)||"#ffffff"}}))}render(){const t=this.getFontStyles(),e=this.getEffectiveScaleFactor();return i(s,{key:"3690ce4fee5e38012a2f956035110cc3e2500b39",style:t},i("div",{key:"e6481956a6873beefb15ea7369a7352d2662c1a2"},i("ibcs-table",{key:"3260517d31fa04294c8df293a6fefd88b129f7b6",data:this.data,"table-title":this.prepareTableTitle(),scenarios:this.prepareScenarios(),"scenarios-data-format":this.prepareDataFormat(),grouped:this.prepareGrouped(),limit:this.prepareLimit(),showGroupTitle:this.prepareShowGroupTitle(),thereof:this.prepareThereOf(),partof:this.preparePartOf(),order:this.prepareOrder(),categorythereof:this.prepareColumnThereOf(),type:this.prepareTableType(),"category-width":this.prepareCategoryWidth(),dataFormatDigits:this.prepareDataFormatDigits(),i18n:this.prepareI18n(),"i18n-mode":this.prepareI18nMode(),"measure-scale":this.prepareMeasureScale(),"measure-type":this.prepareMeasureType(),"measure-unit":this.prepareMeasureUnit(),showMeasureScale:this.prepareShowMeasureScale(),filter:this.prepareFilter(),barColumns:this.prepareBarColumns(),barColumnMaxWidth:this.prepareBarColumnWidth(),unitScaling:this.prepareUnitScaling(),percentageScaling:this.preparePercentageScaling(),scaleFactor:e})))}get element(){return e(this)}static get watchers(){return{scale:[{validateScaling:0}],scenarios:[{validateScenario:0}],variances:[{validateVariances:0}],barColumns:[{validateBarColumns:0}],barColumnWidth:[{validateBarColumnWidth:0}],unitScaling:[{validateUnitScaling:0}],percentageScaling:[{validatePercentageScaling:0}],dataFormat:[{validateDataFormat:0}],grouped:[{validateGrouped:0}],showMeasureScale:[{validateShowMeasureScale:0}],showGroupTitle:[{validateShowGroupTitle:0}],type:[{validateType:0}],limit:[{validateLimit:0}],thereof:[{validateThereOf:0}],partof:[{validatePartOf:0}],order:[{validateOrderList:0}],orderDirection:[{validateOrderDirection:0}],measureType:[{validateMeasureType:0}],measureScale:[{validateMeasureScale:0}],dataFormatDigitsDecimal:[{validateDataFormatDigitsDecimal:0}],dataFormatDigitsPercent:[{validateDateFormatDigitsPercent:0}],categoryWidth:[{validateCategoryWidth:0}],columnthereof:[{validateColumnThereOf:0}]}}};Ei.style=":host{display:inline-block;position:relative;overflow:hidden}";const _i=class{constructor(i){t(this,i),this.businessUnit="",this.order="category",this.orderDirection="asc",this.dateFormat="none",this.dateLink="none",x(this),a(this),this.t=B(this).t,this.errors=u(this),this.componentStyle=f(this)}validateScenario(t){const i="ERR_scenarios",s=v(t);s.length>0?this.errors.addOrReplace({id:i,type:"warning",message:"scenarios: invalid value(s) '"+(null==s?void 0:s.toString())+"' are not supported."}):this.errors.remove(i)}validateVariances(t){const i="ERR_variances",s=m(t);s.length>0?this.errors.addOrReplace({id:i,type:"warning",message:"variances: invalid value(s) '"+(null==s?void 0:s.toString())+"' are not supported."}):this.errors.remove(i)}validateOrder(t){const i=w(t),s="ERR_order";i.length>0?this.errors.addOrReplace({id:s,type:"warning",message:"order: invalid value(s) '"+(null==i?void 0:i.toString())+"' are not supported."}):this.errors.remove(s)}validateOrderDirection(t){const i="ERR_orderDirection";y(t)?this.errors.remove(i):this.errors.addOrReplace({id:i,type:"warning",message:"orderDirection: invalid value '"+(null==t?void 0:t.toString())+"' is not supported."})}validateMeasures(t){const i="ERR_measures",s=A(t);s.length>0?this.errors.addOrReplace({id:i,type:"warning",message:"measures: invalid value(s) '"+(null==s?void 0:s.toString())+'\' are not supported. Valid format example: [{"name": "Bruttoumsatz", "unit": "mEUR"}]'}):this.errors.remove(i)}validateDateStart(t){const i="ERR_dateStart";D(t)||E(t)?this.errors.remove(i):this.errors.addOrReplace({id:i,type:"warning",message:"dateStart: invalid value '"+(null==t?void 0:t.toString())+"' is not supported."})}validateDateEnd(t){const i="ERR_dateEnd";D(t)||E(t)?this.errors.remove(i):this.errors.addOrReplace({id:i,type:"warning",message:"dateStart: invalid value '"+(null==t?void 0:t.toString())+"' is not supported."})}validateDateFormat(t){const i="ERR_dateFormat";G(t)||E(t)?this.errors.remove(i):this.errors.addOrReplace({id:i,type:"warning",message:"dateFormat: invalid value '"+(null==t?void 0:t.toString())+"' is not supported."})}validateDateLink(t){const i="ERR_dateLink";W(t)||E(t)?this.errors.remove(i):this.errors.addOrReplace({id:i,type:"warning",message:"dateLink: invalid value '"+(null==t?void 0:t.toString())+"' is not supported."})}componentWillLoad(){this.validateScenario(this.scenarios),this.validateVariances(this.variances),this.validateMeasures(this.measures),this.validateDateStart(this.dateStart),this.validateDateEnd(this.dateEnd),this.validateDateFormat(this.dateFormat),this.validateDateLink(this.dateLink),this.validateOrderDirection(this.orderDirection),this.validateOrder(this.order)}prepareI18n(){const t=h,i=new Map(["SEPERATOR_WS","in","CONNECTOR_WS"].map((t=>[t,this.t(".".concat(t))]))),s=new Map(t.map((t=>[t,this.t("global.".concat(t))])));return new Map([...s.entries(),...i.entries()])}prepareI18nMode(){return Q.META}prepareTitleOrder(){var t;return E(this.order)||E(this.orderDirection)?null:{hierarchy:this.order.split(",").map((t=>t.trim())),direction:I[null===(t=this.orderDirection)||void 0===t?void 0:t.toUpperCase()]}}prepareTitleTimePeriod(){var t,i;return E(this.dateStart)&&E(this.dateEnd)||E(this.dateLink)?null:{start:nt.fromISO(this.dateStart),end:nt.fromISO(this.dateEnd),format:et[null===(t=this.dateFormat)||void 0===t?void 0:t.toUpperCase()],link:st[null===(i=this.dateLink)||void 0===i?void 0:i.toUpperCase()]}}prepareMeasures(){return E(this.measures)?[]:JSON.parse(this.measures)}prepareScenarios(){var t,i,s,e;if(E(this.scenarios)&&E(this.variances))return[];let n=[];return(null===(t=this.scenarios)||void 0===t?void 0:t.trim().length)>0&&(n=n.concat(null===(i=this.scenarios)||void 0===i?void 0:i.split(","))),(null===(s=this.variances)||void 0===s?void 0:s.trim().length)>0&&(n=n.concat(null===(e=this.variances)||void 0===e?void 0:e.split(","))),n.map((t=>t.trim()))}prepareBusinessUnit(){return E(this.businessUnit)||"null"===this.businessUnit?null:this.businessUnit}getFontStyles(){return this.componentStyle((t=>{var i,s,e,n;return{"--bn-font-family":(null===(i=t.global)||void 0===i?void 0:i.fontFamily)||"'Noto Sans', sans-serif","--bn-font-size":`${(null===(s=t.global)||void 0===s?void 0:s.fontSizePx)||13.3333}px`,"--bn-font-color":(null===(e=t.global)||void 0===e?void 0:e.fontColor)||"#000000","--bn-font-background":(null===(n=t.global)||void 0===n?void 0:n.fontBackgroundColor)||"#ffffff"}}))}render(){const t=this.getFontStyles();return i(s,{key:"029abd8096c5274f94123da2dc1c1e88e76be922",style:t},i("ibcs-title",{key:"c8b128a6ea36d44d8a0730898b35fa3f944e23ae",businessUnit:this.prepareBusinessUnit(),scenarios:this.prepareScenarios(),measures:this.prepareMeasures(),timeperiod:this.prepareTitleTimePeriod(),order:this.prepareTitleOrder(),i18n:this.prepareI18n(),"i18n-mode":this.prepareI18nMode()}))}get element(){return e(this)}static get watchers(){return{scenarios:[{validateScenario:0}],variances:[{validateVariances:0}],order:[{validateOrder:0}],orderDirection:[{validateOrderDirection:0}],measures:[{validateMeasures:0}],dateStart:[{validateDateStart:0}],dateEnd:[{validateDateEnd:0}],dateFormat:[{validateDateFormat:0}],dateLink:[{validateDateLink:0}]}}};_i.style=':host{padding:0.5em;margin-bottom:0.5em;box-sizing:border-box;-webkit-box-sizing:border-box;width:100%;display:block;font-family:var(--bn-font-family, "Noto Sans", sans-serif);font-size:var(--bn-font-size, 13.3333px);color:var(--bn-font-color, #000000)}';class Mi{constructor(t,i,s,e,n,r,a,o){this.categoryPosition={x:0,y:0},this.spacings={scenarioOffset:0,markerOffset:0,scenarioLabelToBar:0,labelToBar:0,labelToAxis:0,needleWidth:0,needleHeadWidth:0,barWidth:0,varianceAxisLineWidth:0,axisLineWidth:0,auxiliaryLineWidth:0,scenarioLineWidth:0,markerWidth:0,categoryWidth:0,axisTickLength:0},this.categoriesBoxOffset={width:0,height:0},this.padding=t,this.scaleFactors=i,this.fontSize=s,this.axisPosition={x:0,y:0},this.numberOfColumns=e,this.leftSideLengthSync=n,this.topSideLabelHeight=r>0?this.fontSize:0,this.leftSideLabelLength=this.calculateSideLabelLength(r,a,o),this.calculateSpacings(),this.calculateCategoryPosition(),this.calculateAxisPosition()}getBarPositionX(){return this.axisPosition.x}getBarCenterPositionY(t){return this.categoryPosition.y+this.spacings.scenarioOffset+t*this.spacings.categoryWidth}getBarPositionY(t,i){return i?this.getBarCenterPositionY(t):this.getBarCenterPositionY(t)-this.spacings.scenarioOffset}getCategoryPositionX(t){let i=this.spacings.labelToAxis;return t&&(i=-this.spacings.labelToAxis),this.getAxisPositionX()+i}getAxisTitlePositionX(){return this.axisPosition.x}getAxisTitlePositionY(){return this.axisPosition.y-this.spacings.labelToAxis}getNeedleWidth(){return this.spacings.needleWidth}getAxisPositionX(){return this.leftSideLabelLength+this.padding.left+this.spacings.labelToAxis}getAxisPositionY(){return this.padding.top+this.getAxisTitleOffset()}loadCategoriesBox(t){this.categoriesBoxOffset=t,this.calculateAxisPosition()}addOffsetByNegativeDataPoints(t,i,s,e){null!=t&&null!=t.value&&t.value<0&&(s&&t.isClipped()?this.axisPosition.x+=Math.abs(t.getClippedValue()*t.pixelPerUnit):this.axisPosition.x+=Math.abs(t.value*t.pixelPerUnit),this.axisPosition.x+=i,this.axisPosition.x+=this.spacings.labelToBar),this.axisPosition.x<e/2&&(this.axisPosition.x=e/2+this.spacings.labelToBar)}getLabelPositionX(t){let i=this.spacings.labelToBar;return t<0&&(i*=-1),this.axisPosition.x+t+i}getLabelPositionY(t){return this.axisPosition.y+t+this.spacings.labelToBar}getCategoryToAxisSpaceing(){return this.spacings.labelToAxis}getCategoryToTopSpaceing(){return this.spacings.scenarioOffset}getCategoryToBottomSpaceing(){return this.spacings.scenarioOffset}getAxisEndPositionY(){return this.getAxisPositionY()+(this.numberOfColumns+.5)*this.spacings.categoryWidth}getScenarioLabelPositionOffsetY(t){return t?.5*this.getBarWidth()+this.spacings.scenarioLabelToBar:-(.5*this.getBarWidth()+this.spacings.scenarioLabelToBar)}getBarWidth(){return this.spacings.barWidth}getMarkerPositionY(t,i){return i?this.getBarCenterPositionY(t)-this.spacings.markerOffset-.5*this.getBarWidth():this.getBarCenterPositionY(t)+this.spacings.markerOffset+.5*this.getBarWidth()}getMarkerPositionX(){return this.getBarPositionX()}getMarkerScenarioLabelPositionOffsetY(t){return t?-(.5*this.spacings.markerWidth+this.spacings.scenarioLabelToBar):this.spacings.scenarioLabelToBar+.5*this.spacings.markerWidth}getAxisEndPositionX(){return this.getAxisPositionX()}calculateSpacings(){this.spacings={scenarioOffset:this.fontSize*this.scaleFactors.scenarioOffset,markerOffset:this.fontSize*this.scaleFactors.markerOffset,scenarioLabelToBar:this.fontSize*this.scaleFactors.scenarioLabelToBar,labelToBar:this.fontSize*this.scaleFactors.labelToBar,labelToAxis:this.fontSize*this.scaleFactors.labelToAxis,needleWidth:this.fontSize*this.scaleFactors.needleWidth,needleHeadWidth:this.fontSize*this.scaleFactors.needleHeadWidth,barWidth:this.fontSize*this.scaleFactors.barWidth,varianceAxisLineWidth:this.fontSize*this.scaleFactors.varianceAxisLineWidth,axisLineWidth:this.fontSize*this.scaleFactors.axisLineWidth,auxiliaryLineWidth:this.fontSize*this.scaleFactors.auxiliaryLineWidth,scenarioLineWidth:this.fontSize*this.scaleFactors.scenarioLineWidth,markerWidth:this.fontSize*this.scaleFactors.markerWidth,categoryWidth:this.fontSize*this.scaleFactors.categoryWidth,axisTickLength:this.fontSize*this.scaleFactors.axisTickLength}}calculateCategoryPosition(){this.categoryPosition={x:this.padding.left,y:this.getAxisPositionY()+.5*this.spacings.categoryWidth}}calculateAxisPosition(){this.axisPosition={x:this.getAxisPositionX(),y:this.getAxisPositionY()}}recalculatePositions(){this.calculateCategoryPosition(),this.calculateAxisPosition()}getAxisTitleOffset(){return this.topSideLabelHeight}calculateSideLabelLength(t,i,s){if(this.leftSideLengthSync)return this.leftSideLengthSync;const e=t/2;let n=i;return e>n&&(n=e),s>n&&(n=s),n}}class ki{constructor(t){this.top=t.top,this.bottom=t.bottom,this.left=t.left,this.right=t.right}addBoxTopLeft(t){return this.top+=t.height|this.top,this.left+=t.width|this.top,this}}class Ti{constructor(t){const i=1*t,s=.7*t;this.bgOffset=(i-s)/2,this.markerUp={top:s/2+",0",left:"0,"+s,right:s+","+s},this.markerUpBackground={top:i/2+",0",left:"0,"+i,right:i+","+i},this.markerDown={bottom:s/2+","+s,left:"0,0",right:s+",0"},this.markerDownBackground={bottom:i/2+","+i,left:"0,0",right:i+",0"}}upMarkerPatternStrings(){return{background:this.markerUpBackground.left+" "+this.markerUpBackground.right+" "+this.markerUpBackground.top+" "+this.markerUpBackground.left,foreground:this.markerUp.left+" "+this.markerUp.right+" "+this.markerUp.top+" "+this.markerUp.left,bgOffset:this.bgOffset}}downMarkerPatternStrings(){return{background:this.markerDownBackground.left+" "+this.markerDownBackground.right+" "+this.markerDownBackground.bottom+" "+this.markerDownBackground.left,foreground:this.markerDown.left+" "+this.markerDown.right+" "+this.markerDown.bottom+" "+this.markerDown.left,bgOffset:this.bgOffset}}createPatternMapForStructureBar(){const t=new Map;return t.set("marker-up",this.upMarkerPatternStrings()),t.set("marker-down",this.downMarkerPatternStrings()),t}}class Pi{constructor(t){this.container=new ct,this.pattern=this.createFCPattern(this.container.group(),t),this.styles=t;let i=10;null!=t&&null!=t.fontStyles&&t.fontStyles.size&&(i=t.fontStyles.size),this.bgOffset=(1*i-.7*i)/2}createFCPattern(t,i){const s=i;return t.pattern(10,10,(function(t){t.rect(10,10).fill(s.barStyles.fc.fill),t.line(0,5,5,0).stroke({width:s.barStyles.fc.width,color:s.barStyles.fc.stroke,linecap:"square"}),t.line(5,10,10,5).stroke({width:s.barStyles.fc.width,color:s.barStyles.fc.stroke,linecap:"square"})})).id("pattern-structure-fc")}getFCPolygonPattern(){return{background:"",foreground:"",bgOffset:0,pattern:this.pattern}}toString(){return this.container.svg()}}var Li,Ci,Ui,Ni,Ai;!function(t){t[t.UP_TO_DATE=0]="UP_TO_DATE",t[t.DIRTY=1]="DIRTY"}(Li||(Li={})),function(t){t.RELATIVE="dr",t.ABSOLUTE="d",t.NONE=""}(Ci||(Ci={}));class Di{constructor(t,i){this.data=t,this.scenarios=i,this.variances=[],this.title="",this.hideCategories=!1,this.pixelPerUnit=10,this.pixelPerPercentage=50,this.limit=0,this.sortOrder=new ot(new ut).default(),this.level=H.CATEGORY,this.filter="",this.measureScale=new pt,this.measureUnit="",this.showMeasureScale=!0,this.dataFormatDigits={decimal:1,percent:2},this.stackConfig=null}}class Gi{constructor(t,i,s,e,n){this.dataRowAdapter=t,this.orderAdapter=i,this.stringAdapter=s,this.dataFormatDigitsAdapter=e,this.dataSet=n}adapt(t){const i=rt.adaptArray(t.data,this.dataRowAdapter),s=rt.adaptArray(t.scenarios,this.stringAdapter),e=new Di(i,s);return at.isArray(t.variances)&&(e.variances=rt.adaptArray(t.variances,this.stringAdapter)),at.isString(t.title)&&(e.title=t.title),at.isBoolean(t.hideCategories)&&(e.hideCategories=t.hideCategories),at.isNumber(t.pixelPerUnit)&&(e.pixelPerUnit=t.pixelPerUnit),at.isNumber(t.pixelPerPercentage)&&(e.pixelPerPercentage=t.pixelPerPercentage),at.isNumber(t.limit)&&(e.limit=t.limit),at.isExisting(t.sortOrder)&&(e.sortOrder=this.orderAdapter.adapt(t.sortOrder)),at.isExisting(t.level)&&(e.level=t.level),at.isString(t.filter)&&(e.filter=t.filter.trim()),at.isExisting(t.measureScale)&&(e.measureScale=dt.calculateMeasureScale(this.dataSet,e.scenarios,t.measureScale)),at.isString(t.measureUnit)&&(e.measureUnit=t.measureUnit),at.isBoolean(t.showMeasureScale)&&(e.showMeasureScale=t.showMeasureScale),at.isExisting(t.dataFormatDigits)&&(e.dataFormatDigits=this.dataFormatDigitsAdapter.adapt(t.dataFormatDigits)),at.isExisting(t.stackConfig)&&(e.stackConfig=t.stackConfig),e}default(){return new Di([],[])}}class Wi{constructor(t,i,s,e){this.value=t,this.scenario=i,this.pixelPerUnit=s||1,this.variance="neg"===e||e===Ui.NEG?Ui.NEG:"pos"===e||e===Ui.POS?Ui.POS:Ui.NEU}isEmpty(){return null==this.value||null==this.scenario}getScaledUnit(){return null==this.value?0:this.value*this.pixelPerUnit}getScaledPercentUnit(){return null==this.value?0:Math.abs(this.value)>1.45?this.value>=0?1.45*this.pixelPerUnit:-1.45*this.pixelPerUnit:this.value*this.pixelPerUnit}getVarianceStyle(){return null==this.value||this.value>=0?this.variance:Ui.NEU===this.variance?Ui.NEU:Ui.POS===this.variance?Ui.NEG:Ui.POS}isClipped(){return null!=this.value&&Math.abs(this.value)>1.45}getClippedValue(){return 145}getScenario(){var t;return null===(t=this.scenario)||void 0===t?void 0:t.slice(0,2)}}class Fi{constructor(){this.operation="+"}addRowGroup(t,i){this.rowGroup=t,this.rowGroupIndex=i}addCategory(t,i){this.category=t,this.categoryIndex=i}addSubCategory(t,i){this.subCategory=t,this.subCategoryIndex=i}addColumnGroup(t,i){this.columnGroup=t,this.columnGroupIndex=i}addSubColumnGroup(t,i){this.columnSubGroup=t,this.columnSubGroupIndex=i}}class Bi{constructor(){}adapt(t){const i=new Fi;return at.isOperator(t.operation)&&(i.operation=t.operation),at.isNumber(t.rowGroupIndex)&&at.isString(t.rowGroup)&&i.addRowGroup(t.rowGroup,t.rowGroupIndex),at.isNumber(t.categoryIndex)&&at.isString(t.category)&&i.addCategory(t.category,t.categoryIndex),at.isNumber(t.subCategoryIndex)&&at.isString(t.subCategory)&&i.addSubCategory(t.subCategory,t.subCategoryIndex),at.isNumber(t.columnGroupIndex)&&at.isString(t.columnGroup)&&i.addColumnGroup(t.columnGroup,t.columnGroupIndex),at.isNumber(t.columnSubGroupIndex)&&at.isString(t.columnSubGroup)&&i.addSubColumnGroup(t.columnSubGroup,t.columnSubGroupIndex),this.setActualValues(t,i),this.setPlanValues(t,i),this.setPreviousPeriodValues(t,i),this.setForecastValues(t,i),i}default(){return new Fi}setActualValues(t,i){at.isNumber(t.ac1)&&(i.ac1=t.ac1),at.isNumber(t.ac2)&&(i.ac2=t.ac2),at.isNumber(t.ac3)&&(i.ac3=t.ac3),at.isNumber(t.ac4)&&(i.ac4=t.ac4)}setPlanValues(t,i){at.isNumber(t.pl1)&&(i.pl1=t.pl1),at.isNumber(t.pl2)&&(i.pl2=t.pl2),at.isNumber(t.pl3)&&(i.pl3=t.pl3),at.isNumber(t.pl4)&&(i.pl4=t.pl4)}setPreviousPeriodValues(t,i){at.isNumber(t.pp1)&&(i.pp1=t.pp1),at.isNumber(t.pp2)&&(i.pp2=t.pp2),at.isNumber(t.pp3)&&(i.pp3=t.pp3),at.isNumber(t.pp4)&&(i.pp4=t.pp4)}setForecastValues(t,i){at.isNumber(t.fc1)&&(i.fc1=t.fc1),at.isNumber(t.fc2)&&(i.fc2=t.fc2),at.isNumber(t.fc3)&&(i.fc3=t.fc3),at.isNumber(t.fc4)&&(i.fc4=t.fc4)}}class zi{constructor(t,i,s,e,n,r){this.scaleFactors=t,this.fontStyles=i,this.axisStyles=s,this.barStyles=e,this.varianceStyles=n,this.padding=r,this.pattern=new Map,this.stackColors=["#000000","#c0c0c0","#808080"]}}class Yi{constructor(t,i,s,e,n){this.scaleFactorsStructureChartAdapter=t,this.fontStyleAdapter=i,this.svgStyleGroupAdapter=s,this.svgVariancesStyleGroupAdapter=e,this.paddingadapter=n}adapt(t){const i=new zi(this.scaleFactorsStructureChartAdapter.default(),this.fontStyleAdapter.default(),this.svgStyleGroupAdapter.default(),this.svgStyleGroupAdapter.default(),this.svgVariancesStyleGroupAdapter.default(),this.paddingadapter.default());return at.isExisting(t)&&(at.isExisting(t.scaleFactors)&&(i.scaleFactors=this.scaleFactorsStructureChartAdapter.adapt(t.scaleFactors)),at.isExisting(t.fontStyles)&&(i.fontStyles=this.fontStyleAdapter.adapt(t.fontStyles)),at.isExisting(t.axisStyles)&&(i.axisStyles=this.svgStyleGroupAdapter.adapt(t.axisStyles)),at.isExisting(t.barStyles)&&(i.barStyles=this.svgStyleGroupAdapter.adapt(t.barStyles)),at.isExisting(t.varianceStyles)&&(i.varianceStyles=this.svgVariancesStyleGroupAdapter.adapt(t.varianceStyles)),at.isExisting(t.padding)&&(i.padding=this.paddingadapter.adapt(t.padding)),Array.isArray(t.stackColors)&&t.stackColors.length>0&&(i.stackColors=t.stackColors),i.pattern=new Ti(i.fontStyles.size).createPatternMapForStructureBar()),i}default(){return new zi(this.scaleFactorsStructureChartAdapter.default(),this.fontStyleAdapter.default(),this.svgStyleGroupAdapter.default(),this.svgStyleGroupAdapter.default(),this.svgVariancesStyleGroupAdapter.default(),this.paddingadapter.default())}}class Hi{constructor(){this.scenarioOffset=.3,this.scenarioLabelToBar=.1,this.labelToBar=.3,this.labelToAxis=.3,this.needleWidth=.3,this.needleHeadWidth=.6,this.barWidth=1.2,this.varianceAxisLineWidth=.3,this.axisLineWidth=.1,this.auxiliaryLineWidth=.1,this.scenarioLineWidth=.2,this.markerWidth=.7,this.markerOffset=0,this.categoryWidth=1.9,this.axisTickLength=.3}}class Ii{adapt(t){const i=new Hi;return at.isNumber(t.scenarioOffset)&&(i.scenarioOffset=t.scenarioOffset),at.isNumber(t.scenarioLabelToBar)&&(i.scenarioLabelToBar=t.scenarioLabelToBar),at.isNumber(t.labelToBar)&&(i.labelToBar=t.labelToBar),at.isNumber(t.labelToAxis)&&(i.labelToAxis=t.labelToAxis),at.isNumber(t.needleWidth)&&(i.needleWidth=t.needleWidth),at.isNumber(t.needleHeadWidth)&&(i.needleHeadWidth=t.needleHeadWidth),at.isNumber(t.barWidth)&&(i.barWidth=t.barWidth),at.isNumber(t.varianceAxisLineWidth)&&(i.varianceAxisLineWidth=t.varianceAxisLineWidth),at.isNumber(t.axisLineWidth)&&(i.axisLineWidth=t.axisLineWidth),at.isNumber(t.auxiliaryLineWidth)&&(i.auxiliaryLineWidth=t.auxiliaryLineWidth),at.isNumber(t.scenarioLineWidth)&&(i.scenarioLineWidth=t.scenarioLineWidth),at.isNumber(t.markerWidth)&&(i.markerWidth=t.markerWidth),at.isNumber(t.markerOffset)&&(i.markerOffset=t.markerOffset),at.isNumber(t.categoryWidth)&&(i.categoryWidth=t.categoryWidth),at.isNumber(t.axisTickLength)&&(i.axisTickLength=t.axisTickLength),i}default(){return new Hi}}!function(t){t.AC1="ac1",t.PP1="pp1",t.FC1="fc1",t.PL1="pl1",t.AC2="ac2",t.PP2="pp2",t.FC2="fc2",t.PL2="pl2",t.AC3="ac3",t.PP3="pp3",t.FC3="fc3",t.PL3="pl3",t.AC4="ac4",t.PP4="pp4",t.FC4="fc4",t.PL4="pl4",t.POS="pos",t.NEG="neg",t.NEU="neu"}(Ui||(Ui={})),function(t){t.LIST="LIST",t.SUM="SUM",t.OPT="OPT"}(Ni||(Ni={})),function(t){t[t.Left=0]="Left",t[t.Center=1]="Center",t[t.Right=2]="Right",t[t.Top=3]="Top",t[t.Bottom=4]="Bottom"}(Ai||(Ai={}));class Vi{constructor(t,i,s,e,n,r,a,o){this.group=null,this.segmentFillColor=null,this.maxWidth=null,this.ID_SCENARIOLABEL="Label",this.CSS_CATEGORIES="categories",this.x=i,this.y=s,this.value=n,null!=t&&(this.group=t.group().id(this.createElementID(t.toString(),e))),this.styles=r,this.isVarianceLabel=!1,this.isRelativeLabel=!1,this.verticalHookLocation=a||Ai.Top,this.horizontalHookLocation=o||Ai.Left}setToVarianceLabel(){return this.isVarianceLabel=!0,this}setToRelativeVarianceLabel(){return this.isVarianceLabel=!0,this.isRelativeLabel=!0,this}setSegmentFill(t){return this.segmentFillColor=t,this}setMaxWidth(t){return this.maxWidth=t,this}updateGroup(t){return this.group=t,this}createElementID(t,i){return t+"_"+i+"_"+this.ID_SCENARIOLABEL}draw(t={percent:2,decimal:1},i=new pt){var s;if(this.isEmpty())return this;const e=this.group;let n;const r=this.styles.fontStyles.background||"#ffffff";let a="",o="start";if(!1===Number.isNaN(Number(this.value))){let s=t.percent,e=t.percent,r=1,h="percent";!1===this.isRelativeLabel&&(s=t.decimal,e=t.decimal,r=i.value,h="decimal"),n=xt.number(Number(this.value),h,s,e,r),Number(this.value)<0&&(o="end"),this.isVarianceLabel&&Number(this.value)>=0&&(a="+")}else n=""+this.value,o="start";const h=e.text(a+n);h.move(this.x,this.y);const l=h.bbox().w,c=h.bbox().h;return null!=this.maxWidth&&l>this.maxWidth?(null===(s=this.group)||void 0===s||s.remove(),this.group=null,this):(this.horizontalHookLocation===Ai.Right?(o="end",h.move(h.x()-h.length(),h.y())):this.horizontalHookLocation===Ai.Center&&(o="middle",h.move(h.x()-h.length()/2,h.y())),this.verticalHookLocation===Ai.Center?h.move(h.x(),h.y()-c/2):this.verticalHookLocation===Ai.Bottom&&h.move(h.x(),h.y()-c),h.font({anchor:o}),null!=this.segmentFillColor?h.fill(ft(this.segmentFillColor)):null==e||e.rect(l,.9*c).stroke(r).fill(r).opacity(.7).move(h.x(),h.y()+.1*c).insertBefore(h),this)}isEmpty(){return null==this.value||""===this.value}setPos(t,i){return this.x=t,this.y=i,this}}class ji{constructor(t,i,s,e){this.height=0,this.ID_AXIS="axis",this.ID_AXIS_TITLE="axis-title",this.CSS_AXIS_TITLE="categories",this.scenarioType=t.scenarioType,this.labelText=t.labelText||null,this.position=i,this.style=e,this.label=new Vi(s,this.position.getAxisTitlePositionX(),this.position.getAxisTitlePositionY(),this.ID_AXIS_TITLE,this.labelText,this.style,Ai.Bottom,Ai.Center),this.svgGroup=s.group().id(this.ID_AXIS)}draw(){return this.labelText&&this.label.draw(),this.svgGroup.line(this.position.getAxisPositionX(),this.position.getAxisPositionY(),this.position.getAxisEndPositionX(),this.position.getAxisEndPositionY()).addClass(this.ID_AXIS+"-"+this.convertScenarioType()),this.height=this.svgGroup.height(),this}convertScenarioType(){return void 0===this.scenarioType||null==this.scenarioType?"default":`${this.scenarioType}`.slice(0,2)}}class Xi{constructor(t,i,s,e,n,r,a,o=null){if(this.ID_DATA_PREFIX="DATA",this.ID_SCENARIO_PREFIX="SCENARIO",this.ID_RECT="RECT",this.FALLBACK_COLOUR="#000000",this.label=null,this.scenarioLabel=null,this.barGroup=null,this.isVarianceBar=!1,this.overflowConfig=null,this.isOverflowing=!1,this.overdriveWidth=0,this.dimensions={barLength:0,xPos:0,yPos:0,labelXPos:0,scenarioLabelXPos:0,scenarioLabelYPos:0,clipped:!1},this.hasData=!1,this.dataPoint=s,this.index=e,this.isPrimaryBar=n,this.position=t,this.barStyles=i.barStyles,this.overflowConfig=o,this.scenarioGroup=r,this.styles=i,null!=r&&(this.barGroup=r.group().id(r.toString()+"_"+this.ID_RECT)),!0!==(null==s?void 0:s.isEmpty())&&null!=s.value){this.hasData=!0;let i=Ai.Left;s.value<0&&(i=Ai.Right),this.dimensions=this.createDimensions(t,s,e,n),this.label=new Vi(this.scenarioGroup,this.dimensions.labelXPos,this.dimensions.yPos,this.ID_DATA_PREFIX,s.value,this.styles,Ai.Center,i),this.scenarioLabel=this.getScenarioLabel(a)}}setAsVariance(){var t;return this.isVarianceBar=!0,null===(t=this.label)||void 0===t||t.setToVarianceLabel(),this}isRelativeVariance(){var t;return this.isVarianceBar=!0,null===(t=this.label)||void 0===t||t.setToRelativeVarianceLabel(),this}updateLabelGroup(t){var i;return this.isEmpty()||null==t||null===(i=this.label)||void 0===i||i.updateGroup(t),this}draw(t={percent:2,decimal:1},i=new pt){if(this.isEmpty()||null==this.dataPoint.getScenario())return this;let s=this.barStyles.getSVGStyle(this.dataPoint.getScenario());this.isVarianceBar&&(s=this.styles.varianceStyles.getSVGStyle(this.dataPoint.getVarianceStyle()));const e=this.convertToSVGStyle(s,"stroke");let n=this.convertToSVGStyle(s,"fill");const r=this.barStyles.getSVGStyle(this.dataPoint.getScenario()).fillpattern;if(null!=r){const t=this.styles.pattern.get(r);null!=t&&(n=t.pattern)}null!=this.barGroup&&(this.isOverflowing&&this.overflowConfig?this.drawOverdriveBar(n,e):this.barGroup.rect(this.dimensions.barLength,this.position.getBarWidth()).fill(n).stroke(e).cy(this.dimensions.yPos).x(this.dimensions.xPos)),this.drawBarDataLabel(t,i),this.drawScenarioLabel()}drawOverdriveBar(t,i){if(!this.barGroup||!this.overflowConfig)return;const s=this.position.getBarPositionX(),e=this.position.getBarWidth(),n=this.dimensions.barLength,{breakGap:r}=this.overflowConfig;this.dataPoint.getScaledUnit()<0?(this.barGroup.rect(n,e).fill(t).stroke(i).x(s-n).cy(this.dimensions.yPos),this.barGroup.rect(this.overdriveWidth,e).fill(t).stroke(i).x(s-n-r-this.overdriveWidth).cy(this.dimensions.yPos),this.drawBreakIndicator(s-n-r,r)):(this.barGroup.rect(n,e).fill(t).stroke(i).x(s).cy(this.dimensions.yPos),this.barGroup.rect(this.overdriveWidth,e).fill(t).stroke(i).x(s+n+r).cy(this.dimensions.yPos),this.drawBreakIndicator(s+n,r))}drawBreakIndicator(t,i){if(!this.barGroup)return;const s=this.position.getBarWidth(),e=this.dimensions.yPos-s/2,n=t+i/2,r=.35*i,a=s/3;let o=`M ${n-r} ${e}`;for(let t=0;t<3;t++)o+=` L ${n-r-.3*i} ${e+a*(t+.5)} L ${n-r} ${e+a*(t+1)}`;let h=`M ${n+r} ${e}`;for(let t=0;t<3;t++)h+=` L ${n+r+.3*i} ${e+a*(t+.5)} L ${n+r} ${e+a*(t+1)}`;this.barGroup.rect(i,s+2).fill("#ffffff").stroke("none").x(t).cy(this.dimensions.yPos),this.barGroup.path(o).fill("none").stroke({color:"#000000",width:1}),this.barGroup.path(h).fill("none").stroke({color:"#000000",width:1})}createDimensions(t,i,s,e){const n=i.getScaledUnit(),r=Math.abs(n);if(this.overflowConfig&&r>0){const a="ac"===i.getScenario()?this.overflowConfig.cutWidth:this.overflowConfig.cutWidth-this.overflowConfig.scenarioCutOffset;if(r>a){this.isOverflowing=!0;const{breakGap:i,overdriveZoneWidth:o,maxOverflow:h}=this.overflowConfig;this.overdriveWidth=h>0?(r-a)/h*o:0;const l=a+i+this.overdriveWidth;return n<0?{clipped:!1,barLength:a,xPos:t.getBarPositionX()-a,yPos:t.getBarPositionY(s,e),labelXPos:t.getLabelPositionX(-l),scenarioLabelXPos:t.getBarPositionX()-.5*a,scenarioLabelYPos:t.getBarPositionY(s,e)+t.getScenarioLabelPositionOffsetY(e)}:{clipped:!1,barLength:a,xPos:t.getBarPositionX(),yPos:t.getBarPositionY(s,e),labelXPos:t.getLabelPositionX(l),scenarioLabelXPos:t.getBarPositionX()+.5*a,scenarioLabelYPos:t.getBarPositionY(s,e)+t.getScenarioLabelPositionOffsetY(e)}}}return n<0?{clipped:!1,barLength:r,xPos:t.getBarPositionX()+n,yPos:t.getBarPositionY(s,e),labelXPos:this.position.getLabelPositionX(n),scenarioLabelXPos:this.position.getBarPositionX()-.5*r,scenarioLabelYPos:this.position.getBarPositionY(s,e)+this.position.getScenarioLabelPositionOffsetY(e)}:{clipped:!1,barLength:n,xPos:t.getBarPositionX(),yPos:t.getBarPositionY(s,e),labelXPos:this.position.getLabelPositionX(n),scenarioLabelXPos:this.position.getBarPositionX()+.5*r,scenarioLabelYPos:this.position.getBarPositionY(s,e)+this.position.getScenarioLabelPositionOffsetY(e)}}convertToSVGStyle(t,i){return null==t&&(t=[]),t.color=t[i]||this.FALLBACK_COLOUR,Object.assign({},t)}drawScenarioLabel(){null==this.scenarioLabel||this.scenarioLabel.isEmpty()||this.isVarianceBar||this.scenarioLabel.setPos(this.dimensions.scenarioLabelXPos,this.dimensions.scenarioLabelYPos).draw()}drawBarDataLabel(t,i=new pt){var s;this.isPrimaryBar&&(null===(s=this.label)||void 0===s||s.draw(t,i))}isEmpty(){return!1===this.hasData||Number.isNaN(this.dataPoint.value)}getScenarioLabel(t){return new Vi(this.scenarioGroup,-1,-1,this.ID_SCENARIO_PREFIX,t,this.styles,this.isPrimaryBar?Ai.Top:Ai.Bottom,Ai.Center)}}class Ji{constructor(t,i,s,e,n,r,a,o,h){this.ID_DATA_PREFIX="DATA",this.ID_SCENARIO_PREFIX="SCENARIO",this.FALLBACK_COLOUR="#000000",this.scenarioLabel=null,this._defaultMarkerPattern=null,this.dimensions={barLength:0,xPos:0,yPos:0,labelXPos:0,scenarioLabelXPos:0,scenarioLabelYPos:0,clipped:!1},this.hasData=!1,this.position=t,this.markerGroup=i||null,this.markerPattern=s||this._defaultMarkerPattern,this.styles=n,this.barStyles=n?n.barStyles:null,this.scenario=e,!0!==(null==r?void 0:r.isEmpty())&&(this.hasData=!0,this.dimensions=this.createMarkerDimensions(r,a,h),this.scenarioLabel=this.getScenarioLabel(o,n,h))}createMarkerDimensions(t,i,s){return t.getScaledUnit()<0?{clipped:!1,labelXPos:0,barLength:Math.abs(t.getScaledUnit()),xPos:this.position.getMarkerPositionX()-Math.abs(t.getScaledUnit()),yPos:this.position.getMarkerPositionY(i,s),scenarioLabelXPos:this.position.getMarkerPositionX()-Math.abs(t.getScaledUnit()),scenarioLabelYPos:this.position.getMarkerPositionY(i,s)+this.position.getMarkerScenarioLabelPositionOffsetY(s)}:{clipped:!1,labelXPos:0,barLength:t.getScaledUnit(),xPos:this.position.getMarkerPositionX()+t.getScaledUnit(),yPos:this.position.getMarkerPositionY(i,s),scenarioLabelXPos:this.position.getMarkerPositionX()+t.getScaledUnit(),scenarioLabelYPos:this.position.getMarkerPositionY(i,s)+this.position.getMarkerScenarioLabelPositionOffsetY(s)}}getScenarioLabel(t,i,s){return null==this.markerGroup?null:new Vi(this.markerGroup,-1,-1,this.ID_DATA_PREFIX,t,i,s?Ai.Bottom:Ai.Top,Ai.Center)}convertToSVGStyle(t,i){return null==t&&(t=[]),t.color=t[i]||this.FALLBACK_COLOUR,Object.assign({},t)}draw(){if(this.isEmpty())return this;const t=this.convertToSVGStyle(this.barStyles[this.getScenario()],"stroke");let i=this.convertToSVGStyle(this.barStyles[this.getScenario()],"fill");const s=this.barStyles[this.getScenario()];if(null!=s&&s.fillpattern){const t=this.styles.pattern.get(s.fillpattern);null!=t&&(i=t.pattern)}return this.markerGroup.polygon(this.markerPattern.background).fill("#ffffff").cy(this.dimensions.yPos).cx(this.dimensions.xPos),this.markerGroup.polygon(this.markerPattern.foreground).fill(i).stroke(t).cy(this.dimensions.yPos).cx(this.dimensions.xPos),null==this.scenarioLabel||this.scenarioLabel.isEmpty()||this.scenarioLabel.setPos(this.dimensions.scenarioLabelXPos,this.dimensions.scenarioLabelYPos).draw(),this}isEmpty(){return!1===this.hasData}getScenario(){var t;return null===(t=this.scenario)||void 0===t?void 0:t.slice(0,2)}}class Ki{constructor(t,i,s,e,n){if(this.ID_DATA_PREFIX="DATA",this.ID_SCENARIO_PREFIX="SCENARIO",this.ID_RECT="RECT",this.FALLBACK_COLOUR="#000000",this.label=null,this.dimensions={barLength:0,xPos:0,yPos:0,labelXPos:0,scenarioLabelXPos:0,scenarioLabelYPos:0,clipped:!1},this.hasData=!1,this.dataPoint=s,this.index=e,this.position=t,this.barStyles=i.barStyles,this.scenarioGroup=n,this.styles=i,this.barGroup=n.group().id(n.toString()+"_"+this.ID_RECT),!0!==(null==s?void 0:s.isEmpty())&&null!=s.value){this.hasData=!0,this.dimensions=this.createDimensions(t,s,e);let i=Ai.Left;s.value<0&&(i=Ai.Right),this.label=new Vi(this.scenarioGroup,this.dimensions.labelXPos,this.dimensions.yPos,this.ID_DATA_PREFIX,s.value,this.styles,Ai.Center,i),this.label.setToRelativeVarianceLabel()}}updateLabelGroup(t){var i;return this.isEmpty()||null==t||null===(i=this.label)||void 0===i||i.updateGroup(t),this}draw(){var t;if(this.isEmpty())return this;if(null==this.dimensions)return this;const i=this.styles.varianceStyles.getSVGStyle(this.dataPoint.getVarianceStyle()),s=i.stroke;let e=i.fill;const n=this.barStyles[this.dataPoint.getScenario()];if(null!=n&&n.fillpattern){const t=this.styles.pattern.get(n.fillpattern);null!=t&&null!=t.pattern&&(e=t.pattern)}this.drawNeedleHead(e,s),this.barGroup.rect(this.dimensions.barLength,this.position.getNeedleWidth()).fill(e).stroke(s).cy(this.dimensions.yPos).x(this.dimensions.xPos),null===(t=this.label)||void 0===t||t.draw()}createDimensions(t,i,s){return i.getScaledPercentUnit()<0?{barLength:Math.abs(i.getScaledPercentUnit()),xPos:t.getBarPositionX()+i.getScaledPercentUnit(),yPos:t.getBarCenterPositionY(s),labelXPos:this.position.getLabelPositionX(i.getScaledPercentUnit()-this.position.getNeedleWidth()),clipped:i.isClipped(),scenarioLabelXPos:0,scenarioLabelYPos:0}:{barLength:i.getScaledPercentUnit(),xPos:t.getBarPositionX(),yPos:t.getBarCenterPositionY(s),labelXPos:this.position.getLabelPositionX(i.getScaledPercentUnit()+this.position.getNeedleWidth()),clipped:i.isClipped(),scenarioLabelXPos:0,scenarioLabelYPos:0}}drawNeedleHead(t,i){if(null===this.dimensions)return;const s=this.styles.varianceStyles.needleHeadColour,e=this.styles.varianceStyles.needleHeadColour;if(this.dimensions.clipped){let s="13,0 4,-5 4,5 13,0 8,0 0,-5 0,5 8,0";null!=this.dataPoint.value&&this.dataPoint.value<0&&(s="0,0 9,-5 9,5 0,0 5,0 13,-5 13,5 5,0"),this.barGroup.polygon(s).fill(t).cx(this.getHeadXPosition()).cy(this.dimensions.yPos).fill(t).stroke(i)}else this.barGroup.rect(2*this.position.getNeedleWidth(),2*this.position.getNeedleWidth()).cx(this.getHeadXPosition()).cy(this.dimensions.yPos).fill(s).stroke(e)}isEmpty(){return!1===this.hasData||Number.isNaN(this.dataPoint.value)}getHeadXPosition(){let t=this.dimensions.xPos;return null!=this.dataPoint.value&&this.dataPoint.value>0&&(t+=this.dimensions.barLength),t}}class Qi{constructor(t,i,s,e,n,r,a,o,h,l,c){this.hasData=!1,this.position=t,this.styles=i,this.dataPoint=s,this.index=e,this.baselineValue=n,this.segmentIndex=a,this.stackMode=o,this.totalValue=h,this.group=c,this.barGroup=c.group().id(`stacked_bar_${e}_seg_${a}`),!0!==(null==s?void 0:s.isEmpty())&&null!=s.value&&(this.hasData=!0)}draw(t={percent:2,decimal:1},i=new pt){if(!this.hasData||null==this.dataPoint.value)return;const s=this.dataPoint.value,e=this.dataPoint.pixelPerUnit,n=this.position.getBarPositionX(),r=this.position.getBarWidth();let a,o;if(this.stackMode===J.RELATIVE){const t=e;a=(0!==this.totalValue?Math.abs(s)/Math.abs(this.totalValue):0)*t,o=n+this.baselineValue/Math.abs(this.totalValue)*t}else a=Math.abs(s*e),o=n+this.baselineValue*e;const h=this.position.getBarPositionY(this.index,!0),l=this.styles.stackColors,c=l[this.segmentIndex%l.length],d={color:c},u={color:c,width:.5};this.barGroup.rect(Math.max(a,.5),r).fill(d).stroke(u).cy(h).x(o);const p=a-6;if(p>0){const e=o+a/2;if(this.stackMode===J.RELATIVE||this.stackMode===J.ABSOLUTE_RELATIVE){const i=(0!==this.totalValue?s/this.totalValue*100:0).toFixed(t.percent)+"%";new Vi(this.group,e,h,"STACK_SEG",i,this.styles,Ai.Center,Ai.Center).setSegmentFill(c).setMaxWidth(p).draw()}else new Vi(this.group,e,h,"STACK_SEG",s,this.styles,Ai.Center,Ai.Center).setSegmentFill(c).setMaxWidth(p).draw(t,i)}}drawTotalLabel(t={percent:2,decimal:1},i=new pt){if(this.stackMode===J.RELATIVE)return;const s=this.position.getBarPositionX()+this.totalValue*this.dataPoint.pixelPerUnit+this.position.spacings.labelToBar,e=this.position.getBarPositionY(this.index,!0);new Vi(this.group,s,e,"STACK_TOTAL",this.totalValue,this.styles,Ai.Center,Ai.Left).draw(t,i)}}class qi{constructor(t,i,s,e,n){this.overflowConfig=null,this.i18n=n;const r=i.group().id("Scenario1"),a=i.group().id("Scenario2").insertBefore(r);this.svgGroups={parent:i,scenario1:r,scenario2:a,scenario3:i.group().id("Scenario3"),scenario4:i.group().id("Scenario4"),scenario1Label:i.group().id("label")},this.styles=s,this.position=t,this.elementCnt=e}setOverflowConfig(t){this.overflowConfig=t}isLastDataPoint(t){return this.elementCnt-1===t}isFirsttDataPoint(t){return 0===t}createPrimaryBar(t,i){var s,e,n,r;const a=null===(e=null===(s=this.svgGroups)||void 0===s?void 0:s.scenario1)||void 0===e?void 0:e.group().id(""+i),o=null===(r=null===(n=this.svgGroups)||void 0===n?void 0:n.scenario1Label)||void 0===r?void 0:r.group().id(""+i);let h=null;return this.isLastDataPoint(i)&&(h=`${this.i18n.get(t.scenario)||t.scenario}`),new Xi(this.position,this.styles,t,i,!0,a,h,this.overflowConfig).updateLabelGroup(o)}createVarianceBar(t,i){var s,e,n,r;const a=null===(e=null===(s=this.svgGroups)||void 0===s?void 0:s.scenario1)||void 0===e?void 0:e.group().id(""+i),o=null===(r=null===(n=this.svgGroups)||void 0===n?void 0:n.scenario1Label)||void 0===r?void 0:r.group().id(""+i);let h=null;return this.isLastDataPoint(i)&&(h=`${this.i18n.get(t.scenario)||t.scenario}`),new Xi(this.position,this.styles,t,i,!0,a,h,this.overflowConfig).updateLabelGroup(o).setAsVariance()}createRelativeVarianceBar(t,i){var s,e,n,r;const a=null===(e=null===(s=this.svgGroups)||void 0===s?void 0:s.scenario1)||void 0===e?void 0:e.group().id(""+i),o=null===(r=null===(n=this.svgGroups)||void 0===n?void 0:n.scenario1Label)||void 0===r?void 0:r.group().id(""+i);return new Ki(this.position,this.styles,t,i,a).updateLabelGroup(o)}createSecondaryBar(t,i){var s,e;const n=null===(e=null===(s=this.svgGroups)||void 0===s?void 0:s.scenario2)||void 0===e?void 0:e.group().id(""+i);let r=null;return this.isFirsttDataPoint(i)&&(r=`${this.i18n.get(t.scenario)||t.scenario}`),new Xi(this.position,this.styles,t,i,!1,n,r,this.overflowConfig)}createPrimaryMarker(t,i){var s,e;const n=null===(e=null===(s=this.svgGroups)||void 0===s?void 0:s.scenario3)||void 0===e?void 0:e.group().id(""+i),r=this.styles.pattern.get("marker-down")||{foreground:"0,0 1,0 1,1 0,1",background:"0,0 1,0 1,1 0,1",bgOffset:0};let a=null;return this.isFirstDataPoint(i)&&(a=`${this.i18n.get(t.scenario)||t.scenario}`),new Ji(this.position,n,r,t.scenario,this.styles,t,i,a,!0)}createSecondaryMarker(t,i){var s,e;const n=null===(e=null===(s=this.svgGroups)||void 0===s?void 0:s.scenario4)||void 0===e?void 0:e.group().id(""+i),r=this.styles.pattern.get("marker-up")||{foreground:"0,0 1,0 1,1 0,1",background:"0,0 1,0 1,1 0,1",bgOffset:0};let a=null;return this.isLastDataPoint(i)&&(a=`${this.i18n.get(t.scenario)||t.scenario}`),new Ji(this.position,n,r,t.scenario,this.styles,t,i,a,!1)}isFirstDataPoint(t){return 0===t}}class Zi{constructor(t,i,s){this.dataModel=[],this.variancesDataModel=[],this.title="",this.smallestDataPointValue=new Wi(0,Ui.AC1,1,Ui.NEU),this.highestDataPointValue=new Wi(0,Ui.AC1,1,Ui.NEU),this.smallestVarianceDataPointValue=new Wi(0,Ui.AC1,1,Ui.NEU),this.highestVarianceDataPointValue=new Wi(0,Ui.AC1,1,Ui.NEU),this.pixelPerUnit=1,this.pixelPerPercentage=1,this.hideCategories=!1,this.axisScenario=Ui.AC1,this.CSS_CATEGORIES="categories",this.preparedDataSet=[],this.state=Li.DIRTY,this.titleLength=0,this.leftSideOffsetForHorizontalSync=0,this.limit=0,this.measureScale=new pt,this.measureUnit="",this.dataFormatDigits={percent:2,decimal:1},this.stackConfig=null,this.overflowConfig=null,this.highestStackedTotal=0,this.initSQLFunctions(),this.ruleSet=t||new vt,this.i18n=this.createI18n(new Map),this.styles=s,this.setConfig(i),this.position=this.createElementPosition()}updatePosition(){this.position=this.createElementPosition()}createElementPosition(){this.titleLength=this.calculateTitleLength(0);let t=this.calculateLeftSideWidth(this.getVarianceType());const i=this.calculateCategoryWidth();return this.titleLength>t&&(t=this.titleLength),new Mi(new ki(this.styles.padding),this.styles.scaleFactors,this.styles.fontStyles.size,this.dataModel.length,this.leftSideOffsetForHorizontalSync,this.titleLength,t,i)}initSQLFunctions(){lt.fn.transformOperator=function(t){return"-"===t?-1:1}}setStyles(t){this.styles=t}setConfig(t){var i;this.state=Li.DIRTY,this.sortScenariosbyVisualisationRules(t),this.hideCategories=t.hideCategories||!1,this.limit=t.limit,this.pixelPerUnit=t.pixelPerUnit||1,this.pixelPerPercentage=t.pixelPerPercentage||100,this.setData([...t.data],t.filter),this.dataModel=this.populateModel(t.scenarios,t.level,t.sortOrder),t.stackConfig&&t.stackConfig.by!==j.SCENARIOS&&this.populateDimensionStackSegments(t.scenarios,t.stackConfig,t.level),this.variancesDataModel=this.populateVarianceModel(t.variances,this.dataModel),this.title=t.title||xt.translateScenarioLabel(null===(i=null==t?void 0:t.variances)||void 0===i?void 0:i.toString(),this.i18n),this.smallestDataPointValue=this.findSmallestDataPointValue(this.dataModel),this.smallestVarianceDataPointValue=this.findSmallestDataPointValue(this.variancesDataModel),this.highestDataPointValue=this.findHighestDataPointValue(this.dataModel),this.highestVarianceDataPointValue=this.findHighestDataPointValue(this.variancesDataModel),this.axisScenario=this.setAxisScenario(t.variances),this.measureScale=t.measureScale,this.measureUnit=t.measureUnit,this.dataFormatDigits=t.dataFormatDigits,this.stackConfig=t.stackConfig,this.highestStackedTotal=this.findHighestStackedRowTotal(this.dataModel),this.updatePosition()}sortScenariosbyVisualisationRules(t){const i=this;t.scenarios.sort(((t,s)=>i.ruleSet.getScenarioSorIndex(t)-i.ruleSet.getScenarioSorIndex(s))).reverse()}setI18n(t){this.i18n=this.createI18n(t)}createI18n(t){this.state=Li.DIRTY;const i=new Map([["SEPERATOR_WS",", "],["in","in"],["ORDER_asc","↑"],["ORDER_desc","↓"],["ac1","AC"],["pp1","PY"],["fc1","FC"],["pl1","PL"],["ac2","AC2"],["pp2","PY2"],["fc2","FC2"],["pl2","PL2"],["ac3","AC3"],["pp3","PY3"],["fc3","FC3"],["pl3","PL3"],["ac4","AC4"],["pp4","PY4"],["fc4","FC4"],["pl4","PL4"],["category"," "],["operation"," "],["there_of","davon"],["part_of","in % von"],["ibcssymbol_delta_ac","Δ{%}"],["ibcssymbol_delta_generic","Δ({%})"],["ibcssymbol_delta_ac_relative","Δ{%}%"],["ibcssymbol_delta_generic_relative","Δ({%})%"],["SUM_TOTAL","❖"]]);return new Map([...i,...t])}setData(t,i){if(null!=t)if(this.state=Li.DIRTY,this.preparedDataSet.length=0,null!=i&&i.length>0)try{this.preparedDataSet=lt(`SELECT * FROM ? WHERE ${i}`,[t])}catch(s){console.error("StructureChart: filter query failed, using unfiltered data",i,s),this.preparedDataSet=t}else this.preparedDataSet=t}getMaxBarValue(){var t,i;if(null!=this.stackConfig&&this.highestStackedTotal>0)return this.stackConfig.mode===J.RELATIVE?1:this.highestStackedTotal;const s=this.getVarianceType();return s===Ci.NONE&&null!=(null===(t=this.highestDataPointValue)||void 0===t?void 0:t.value)?Math.abs(this.highestDataPointValue.value):s===Ci.ABSOLUTE&&null!=(null===(i=this.highestVarianceDataPointValue)||void 0===i?void 0:i.value)?Math.abs(this.highestVarianceDataPointValue.value):0}getAllocatedCanvasWidth(){const t=this.position.getAxisPositionX(),i=this.calculateRightSideWidth(this.getVarianceType());let s=t+i+ +this.styles.padding.left+this.styles.padding.right;return i<this.titleLength/2&&(s+=this.titleLength/2),t<this.titleLength/2&&(s+=this.titleLength/2),s}getAllocatedCanvasHeight(){return(this.dataModel.length+1)*this.position.spacings.categoryWidth+this.styles.padding.top+this.styles.padding.bottom}patternToString(){return"<svg></svg>"}toString(){const t=new ct;return this.draw(t),t.id("drawCanvas"),t.width(this.getAllocatedCanvasWidth()),t.height(this.getAllocatedCanvasHeight()),t.svg()}draw(t){this.cleanSVGforRedraw(t),this.state===Li.DIRTY&&(this.state=Li.UP_TO_DATE),this.variancesDataModel&&this.variancesDataModel.length>0?(this.drawVarianceScenario(this.variancesDataModel,t),this.drawAxisAndLabels(this.variancesDataModel,t)):null!=this.stackConfig?(this.drawStackedScenarios(this.dataModel,t),this.drawStackedHeaders(this.dataModel,t),this.drawAxisAndLabels(this.dataModel,t)):(this.drawScenarios(this.dataModel,t),this.drawAxisAndLabels(this.dataModel,t))}setPattern(t,i){this.styles.pattern.set(t,i)}calculateTitleLength(t){const i=Et(this.title.length>7?this.title:"_______",{font:this.styles.fontStyles.font,fontSize:this.styles.fontStyles.size+"px"}).width;return i<t?t:i/2}getFooter(){return 1===this.measureScale.value&&""===this.measureUnit?" ":xt.translateScenarioLabel("in",this.i18n)+" "+this.measureScale.prefix+this.measureUnit}setAxisScenario(t){let i=Ui.AC1;if(null!=t&&t.length>0){const s=new _t(t.toString());s.isValid&&(i=s.delta)}return null===i&&(i=Ui.AC1),i}populateModel(t,i,s){var e;if(0===(null===(e=this.preparedDataSet)||void 0===e?void 0:e.length))return[];const n=[],r=this.createOrderStr(i,s),a=this.createSelectString(i,s),o=this.createGroupByStr(i,s),h=lt(`SELECT ${a} ${t.length>0?","+t.map((t=>`SUM(${t} * transformOperator(operation)) as ${t}, COUNT(ISNULL(${t})) as ${t}_cnt`)).join(","):""} \n FROM ?\n GROUP BY ${o}\n ORDER BY ${r}`,[this.preparedDataSet]);return this.detectNaNCells(t,h),this.createDataRows(h,n,t),this.crateRESTRow(h,t,n),n}detectNaNCells(t,i){i.forEach((i=>(t.forEach((t=>{const s=new _t(t);!0===s.isValid?0!==i[s.base+"_cnt"]&&0!==i[s.delta+"_cnt"]||(i[t]=Number.NaN):0===i[t+"_cnt"]&&(i[t]=Number.NaN)})),i)))}crateRESTRow(t,i,s){if(0===this.limit||this.limit>t.length)return;const e=[],n=t.slice(this.limit,t.length);this.createDataRows(n,e,i);const r=e.reduce((function(t,s){return{id:t.id,category:t.category,type:t.type,scenario1:new Wi(t.scenario1.value+s.scenario1.value,i[0],t.scenario1.pixelPerUnit,Ui.NEU),scenario2:new Wi(t.scenario2.value+s.scenario2.value,i[1],t.scenario2.pixelPerUnit,Ui.NEU),scenario3:new Wi(t.scenario3.value+s.scenario3.value,i[2],t.scenario3.pixelPerUnit,Ui.NEU),scenario4:new Wi(t.scenario4.value+s.scenario4.value,i[3],t.scenario4.pixelPerUnit,Ui.NEU)}}),{id:9999,category:"REST",type:Ci.NONE,scenario1:new Wi(0,i[0],this.pixelPerUnit,Ui.NEU),scenario2:new Wi(0,i[1],this.pixelPerUnit,Ui.NEU),scenario3:new Wi(0,i[2],this.pixelPerUnit,Ui.NEU),scenario4:new Wi(0,i[3],this.pixelPerUnit,Ui.NEU)});s.push(r)}createDataRows(t,i,s){let e=t;this.limit>0&&(e=t.slice(0,this.limit)),e.forEach(((t,e)=>{i.push({id:e,category:t.category,type:Ci.NONE,scenario1:new Wi(t[s[0]],s[0],this.pixelPerUnit,Ui.NEU),scenario2:new Wi(t[s[1]],s[1],this.pixelPerUnit,Ui.NEU),scenario3:new Wi(t[s[2]],s[2],this.pixelPerUnit,Ui.NEU),scenario4:new Wi(t[s[3]],s[3],this.pixelPerUnit,Ui.NEU)})}))}createOrderStr(t,i){let s=`${t.toLowerCase()}`;return i.hierarchy.length>=1&&(s=`${i.hierarchy.toString()} ${null==i?void 0:i.direction}`),s}createSelectString(t,i){return t===H.CATEGORY&&i.hierarchy.includes(V.CATEGORYINDEX)?`${V.CATEGORYINDEX}, ${H.CATEGORY} as category`:t===H.ROWGROUP&&i.hierarchy.includes(V.ROWGROUPINDEX)?`${V.ROWGROUPINDEX}, ${H.ROWGROUP} as category`:t===H.SUBCATEGORY&&i.hierarchy.includes(V.SUBCATEGORYINDEX)?`${V.SUBCATEGORYINDEX}, ${H.SUBCATEGORY} as category`:`${t.toString()} as category`}createGroupByStr(t,i){return t===H.CATEGORY&&i.hierarchy.includes(V.CATEGORYINDEX)?`${V.CATEGORYINDEX}, ${H.CATEGORY}`:t===H.ROWGROUP&&i.hierarchy.includes(V.ROWGROUPINDEX)?`${V.ROWGROUPINDEX}, ${H.ROWGROUP}`:t===H.SUBCATEGORY&&i.hierarchy.includes(V.SUBCATEGORYINDEX)?`${V.SUBCATEGORYINDEX}, ${H.SUBCATEGORY}`:`${t.toString()}`}calculateCategoryWidth(){if(this.hideCategories)return 5;let t=0;for(const i of this.dataModel){const s=Et(i.category,{font:this.styles.fontStyles.font,fontSize:this.styles.fontStyles.size+"px"});s.width>t&&(t=s.width)}return 1.1125*t}findSmallestDataPointValue(t){let i=new Wi(0,"default",this.pixelPerUnit,null);for(const s of t)for(const t of[s.scenario1,s.scenario2,s.scenario3,s.scenario4])null!=t&&null!=i.value&&t.value<i.value&&(i=t);return i}findHighestDataPointValue(t){let i=new Wi(0,"default",this.pixelPerUnit,null);for(const s of t)for(const t of[s.scenario1,s.scenario2,s.scenario3,s.scenario4])null!=t&&null!=i.value&&t.value>i.value&&(i=t);return i}findHighestStackedRowTotal(t){if(!this.stackConfig||0===t.length)return 0;const i=this.stackConfig.by===j.SCENARIOS;let s=0;for(const e of t){let t=0;if(i){const i=["scenario1","scenario2","scenario3","scenario4"],s=[];for(const t of i){const i=e[t];i&&!i.isEmpty()&&null!=i.value&&s.push({value:i.value,scenario:i.scenario})}if(new Set(s.map((t=>mt(t.scenario)))).size>1){const i=new Map;for(const t of s){const s=mt(t.scenario);i.set(s,(i.get(s)||0)+Math.abs(t.value))}t=Math.max(...i.values())}else t=s.reduce(((t,i)=>t+Math.abs(i.value)),0)}else e.stackSegments&&e.stackSegments.length>0&&(t=e.stackSegments.reduce(((t,i)=>t+Math.abs(i.value)),0));t>s&&(s=t)}return s}populateVarianceModel(t,i){const s=[];if(0===t.length)return s;let e=null;null!=i&&i.length>0&&(e=i[0]);for(const n in t){const r=new _t(t[n]);if(r.isValid){const t=this.mapScenarios(r,e),n=r.direction;let a=this.pixelPerUnit;"dr"===r.type&&(a=this.pixelPerPercentage);for(const e in i)s.push({id:Number(e),category:i[e].category,type:"dr"===r.type?Ci.RELATIVE:Ci.ABSOLUTE,scenario1:new Wi(this.calculateVariance(r,i[e],t),r.base,a,n),scenario2:new Wi(null,null,null,null),scenario3:new Wi(null,null,null,null),scenario4:new Wi(null,null,null,null)})}}return s}calculateVariance(t,i,s){const e=s.get(t.base),n=s.get(t.delta);return null==e||null==n?null:t.type===Ci.RELATIVE?(i[e].value-i[n].value)/i[n].value:i[e].value-i[n].value}mapScenarios(t,i){const s=new Map;return null==i||["scenario1","scenario2","scenario3","scenario4"].forEach((e=>{i[e].scenario===t.delta?s.set(t.delta,e):i[e].scenario===t.base&&s.set(t.base,e)})),s}calculateTextBoxWidth(t){return Et(xt.number(t,"decimal",1,0),{font:this.styles.fontStyles.font,fontSize:this.styles.fontStyles.size+"px"}).width}calculatePercentageTextBoxWidth(t){let i=0;return t>=0&&(i+=Et("+",{font:this.styles.fontStyles.font,fontSize:this.styles.fontStyles.size+"px"}).width),i+=Et(" %",{font:this.styles.fontStyles.font,fontSize:this.styles.fontStyles.size+"px"}).width,Et(xt.number(t,"decimal",1,1),{font:this.styles.fontStyles.font,fontSize:this.styles.fontStyles.size+"px"}).width+i+i}cleanSVGforRedraw(t){t.clear()}drawAxisAndLabels(t,i){const s=i.group().id("AxisAndDateLables");let e=!1;this.hideCategories||t.forEach(((t,i)=>{t.type===Ci.RELATIVE&&(e=!0);let n=Ai.Right,r=!0;t.scenario1.value<0&&(n=Ai.Left,r=!1),new Vi(s,this.position.getCategoryPositionX(r),this.position.getBarCenterPositionY(i),"",t.category,this.styles,Ai.Center,n).draw()})),new ji({scenarioType:this.axisScenario,labelText:this.title,isRelative:e},this.position,s,this.styles).draw()}drawScenarios(t,i){const s=i.group().id("Scenarios"),e=new qi(this.position,s,this.styles,t.length,this.i18n);e.setOverflowConfig(this.overflowConfig),t.forEach(((t,i)=>{e.createPrimaryBar(t.scenario1,i).draw(this.dataFormatDigits,this.measureScale),e.createSecondaryBar(t.scenario2,i).draw(),e.createPrimaryMarker(t.scenario3,i).draw(),e.createSecondaryMarker(t.scenario4,i).draw()}))}drawVarianceScenario(t,i){const s=i.group().id("Scenarios"),e=new qi(this.position,s,this.styles,t.length,this.i18n);return e.setOverflowConfig(this.overflowConfig),t.forEach(((t,i)=>{t.type===Ci.RELATIVE?e.createRelativeVarianceBar(t.scenario1,i).draw():e.createVarianceBar(t.scenario1,i).draw(this.dataFormatDigits,this.measureScale)})),s}drawStackedScenarios(t,i){if(!this.stackConfig)return;const s=i.group().id("StackedScenarios"),e=this.stackConfig.by===j.SCENARIOS;t.forEach(((t,i)=>{const n=["scenario1","scenario2","scenario3","scenario4"],r=[];if(e)for(const i of n){const s=t[i];s&&!s.isEmpty()&&null!=s.value&&r.push({value:s.value,scenario:s.scenario,dataPoint:s})}else{const i=t.scenario1;i&&!i.isEmpty()&&null!=i.value&&r.push({value:i.value,scenario:i.scenario,dataPoint:i})}if(0!==r.length)if((e?new Set(r.map((t=>mt(t.scenario)))):new Set).size>1){const t=new Map;for(const i of r){const s=mt(i.scenario);t.has(s)||t.set(s,[]),t.get(s).push(i)}const e=[];for(const i of gt)t.has(i)&&(e.push({prefix:i,segments:t.get(i)}),t.delete(i));for(const[i,s]of t)e.push({prefix:i,segments:s});e.forEach(((t,n)=>{const r=t.segments.reduce(((t,i)=>t+Math.abs(i.value)),0),a=e.length-1-n;let o=0,h=null;t.segments.forEach((t=>{const e=new Qi(this.position,this.styles,t.dataPoint,i,o,t.scenario,a,this.stackConfig.mode,r,!0,s);e.draw(this.dataFormatDigits,this.measureScale),o+=Math.abs(t.value),h=e})),h&&h.drawTotalLabel(this.dataFormatDigits,this.measureScale)}))}else{let n=r;!e&&t.stackSegments&&t.stackSegments.length>0&&(n=t.stackSegments.map((t=>({value:t.value,scenario:t.label,dataPoint:t.dataPoint})))),"asc"===this.stackConfig.order?n.sort(((t,i)=>t.value-i.value)):"desc"===this.stackConfig.order&&n.sort(((t,i)=>i.value-t.value));const a=n.reduce(((t,i)=>t+Math.abs(i.value)),0);let o=0,h=null;n.forEach(((t,n)=>{const r=new Qi(this.position,this.styles,t.dataPoint,i,o,t.scenario,n,this.stackConfig.mode,a,e,s);r.draw(this.dataFormatDigits,this.measureScale),o+=Math.abs(t.value),h=r})),h&&h.drawTotalLabel(this.dataFormatDigits,this.measureScale)}}))}drawStackedHeaders(t,i){if(!this.stackConfig||0===t.length)return;const s=this.stackConfig.by===j.SCENARIOS,e=i.group().id("StackedHeaders"),n=t[0];if(!s){const t=n.stackSegments;if(!t||0===t.length)return;const i=[...t];"asc"===this.stackConfig.order?i.sort(((t,i)=>t.value-i.value)):"desc"===this.stackConfig.order&&i.sort(((t,i)=>i.value-t.value));const s=i.reduce(((t,i)=>t+Math.abs(i.value)),0),r=this.position.getBarPositionX(),a=this.position.getAxisTitlePositionY();let o=0;return void i.forEach((t=>{const i=t.dataPoint.pixelPerUnit;let n;n=this.stackConfig.mode===J.RELATIVE?(0!==s?Math.abs(t.value)/s:0)*i:Math.abs(t.value*i);const h=r+o+n/2,l=this.i18n.get(t.label)||t.label;new Vi(e,h,a,"STACK_HEADER",l,this.styles,Ai.Bottom,Ai.Center).draw(),o+=n}))}const r=["scenario1","scenario2","scenario3","scenario4"],a=[];for(const t of r){const i=n[t];i&&!i.isEmpty()&&null!=i.value&&a.push({value:i.value,scenario:i.scenario,dataPoint:i})}if(0===a.length)return;const o=new Set(a.map((t=>mt(t.scenario)))),h=this.position.getBarPositionX(),l=this.position.getAxisTitlePositionY();if(o.size>1){const t=new Map;for(const i of a){const s=mt(i.scenario);t.has(s)||t.set(s,[]),t.get(s).push(i)}const i=[];for(const s of gt)t.has(s)&&(i.push({prefix:s,segments:t.get(s)}),t.delete(s));for(const[s,e]of t)i.push({prefix:s,segments:e});i.forEach((t=>{const i=t.segments.reduce(((t,i)=>t+Math.abs(i.value)),0),s=t.segments[0].dataPoint.pixelPerUnit,n=h+(this.stackConfig.mode===J.RELATIVE?s:i*s)/2,r=this.i18n.get(t.prefix+"1")||t.prefix.toUpperCase();new Vi(e,n,l,"STACK_HEADER",r,this.styles,Ai.Bottom,Ai.Center).draw()}))}else{"asc"===this.stackConfig.order?a.sort(((t,i)=>t.value-i.value)):"desc"===this.stackConfig.order&&a.sort(((t,i)=>i.value-t.value));const t=a.reduce(((t,i)=>t+Math.abs(i.value)),0);let i=0;a.forEach((s=>{const n=s.dataPoint.pixelPerUnit;let r;r=this.stackConfig.mode===J.RELATIVE?(0!==t?Math.abs(s.value)/t:0)*n:Math.abs(s.value*n);const a=h+i+r/2,o=this.i18n.get(s.scenario)||s.scenario;new Vi(e,a,l,"STACK_HEADER",o,this.styles,Ai.Bottom,Ai.Center).draw(),i+=r}))}}getVarianceType(){return this.variancesDataModel.length>0?this.variancesDataModel[0].type:Ci.NONE}calculateLeftSideWidth(t){var i,s,e;let n=0;const r=this.styles.fontStyles.size*this.styles.scaleFactors.labelToBar;if(Ci.NONE===t&&null!=(null===(i=this.smallestDataPointValue)||void 0===i?void 0:i.value)&&this.smallestDataPointValue.value<0){const t=this.calculateTextBoxWidth(this.smallestDataPointValue.value);n=Math.abs(this.smallestDataPointValue.getScaledUnit())+r+t}else if(Ci.RELATIVE===t&&null!=(null===(s=this.smallestVarianceDataPointValue)||void 0===s?void 0:s.value)&&this.smallestVarianceDataPointValue.value<0){const t=this.calculatePercentageTextBoxWidth(this.smallestVarianceDataPointValue.value);n=Math.abs(this.smallestVarianceDataPointValue.getScaledPercentUnit())+r+t}else if(Ci.ABSOLUTE===t&&null!=(null===(e=this.smallestVarianceDataPointValue)||void 0===e?void 0:e.value)&&this.smallestVarianceDataPointValue.value<0){const t=this.calculateTextBoxWidth(this.smallestVarianceDataPointValue.value);n=Math.abs(this.smallestVarianceDataPointValue.getScaledUnit())+r+t}return n<=this.titleLength?this.titleLength:n}calculateRightSideWidth(t){var i,s,e;if(null!=this.stackConfig&&this.highestStackedTotal>0){const t=this.styles.fontStyles.size*this.styles.scaleFactors.labelToBar;let i;i=this.stackConfig.mode===J.RELATIVE?this.pixelPerUnit:this.highestStackedTotal*this.pixelPerUnit;const s=this.calculateTextBoxWidth(this.highestStackedTotal);return Math.max(i+t+s,this.titleLength)}let n=0;const r=this.styles.fontStyles.size*this.styles.scaleFactors.labelToBar;if(Ci.NONE===t&&null!=(null===(i=this.highestDataPointValue)||void 0===i?void 0:i.value)&&this.highestDataPointValue.value>=0){const t=this.calculateTextBoxWidth(this.highestDataPointValue.value);n=Math.abs(this.highestDataPointValue.getScaledUnit())+r+t}else if(Ci.RELATIVE===t&&null!=(null===(s=this.highestVarianceDataPointValue)||void 0===s?void 0:s.value)&&this.highestVarianceDataPointValue.value>=0){const t=this.calculatePercentageTextBoxWidth(this.highestVarianceDataPointValue.value);n=Math.abs(this.highestVarianceDataPointValue.getScaledPercentUnit())+r+t}else if(Ci.ABSOLUTE===t&&null!=(null===(e=this.highestVarianceDataPointValue)||void 0===e?void 0:e.value)&&this.highestVarianceDataPointValue.value>=0){const t=this.calculateTextBoxWidth(this.highestVarianceDataPointValue.value);n=Math.abs(this.highestVarianceDataPointValue.getScaledUnit())+r+t}return n<=this.titleLength?this.titleLength:n}populateDimensionStackSegments(t,i,s){var e;if(0===(null===(e=this.preparedDataSet)||void 0===e?void 0:e.length)||0===t.length)return;const n={[H.ROWGROUP]:"category",[H.ROWGROUPINDEX]:"category",[H.CATEGORY]:"subCategory",[H.CATEGORYINDEX]:"subCategory"}[s];if(!n)return;const r=s.toString(),a=t[0],o=lt(`SELECT [${r}] as displayGroup, [${n}] as stackLabel, SUM([${a}] * transformOperator(operation)) as stackValue FROM ? GROUP BY [${r}], [${n}]`,[this.preparedDataSet]),h=new Map;for(const t of o){const i=t.displayGroup;h.has(i)||h.set(i,[]),null!=t.stackValue&&null!=t.stackLabel&&h.get(i).push({label:t.stackLabel,value:t.stackValue})}for(const t of this.dataModel){const i=h.get(t.category);t.stackSegments=i&&i.length>0?i.map((t=>({label:t.label,value:t.value,dataPoint:new Wi(t.value,a,this.pixelPerUnit,Ui.NEU)}))):[]}}hasNoData(){return 0===this.dataModel.length}setAvailableWidth(t){if(this.pixelPerUnit<=0||t<=0)this.overflowConfig=null;else if(null==this.stackConfig){if(this.overflowConfig=this.calculateOverflowConfig(t),this.overflowConfig){const{cutWidth:t,overdriveZoneWidth:i,breakGap:s}=this.overflowConfig,e=t+i+s;this.variancesDataModel&&this.variancesDataModel.length>0?(this.highestVarianceDataPointValue.getScaledUnit()>t&&(this.highestVarianceDataPointValue=new Wi(e,this.highestVarianceDataPointValue.scenario,1,this.highestVarianceDataPointValue.variance)),null!=this.smallestVarianceDataPointValue.value&&Math.abs(this.smallestVarianceDataPointValue.getScaledUnit())>t&&(this.smallestVarianceDataPointValue=new Wi(-e,this.smallestVarianceDataPointValue.scenario,1,this.smallestVarianceDataPointValue.variance))):(this.highestDataPointValue.getScaledUnit()>t&&(this.highestDataPointValue=new Wi(e,this.highestDataPointValue.scenario,1,this.highestDataPointValue.variance)),null!=this.smallestDataPointValue.value&&Math.abs(this.smallestDataPointValue.getScaledUnit())>t&&(this.smallestDataPointValue=new Wi(-e,this.smallestDataPointValue.scenario,1,this.smallestDataPointValue.variance))),this.updatePosition()}}else this.overflowConfig=null}calculateOverflowConfig(t){const i=this.variancesDataModel&&this.variancesDataModel.length>0;if(this.getVarianceType()===Ci.RELATIVE)return null;const s=i?this.highestVarianceDataPointValue:this.highestDataPointValue,e=i?this.smallestVarianceDataPointValue:this.smallestDataPointValue,n=s.getScaledUnit(),r=null!=e.value?Math.abs(e.getScaledUnit()):0,a=Math.max(n,r);if(a<=0)return null;const o=this.styles.fontStyles.size,h=o*this.styles.scaleFactors.labelToBar,l=1.5*o,c=.3*o,d=.8*o,u=t-this.position.getAxisPositionX()-this.styles.padding.left-this.styles.padding.right-h-this.calculateTextBoxWidth(s.value||0)-l-c;if(u<=d)return null;const p=u-d;return a<=p?null:{cutWidth:u,overdriveZoneWidth:l,breakGap:c,maxOverflow:a-p,scenarioCutOffset:d}}}const ts=class{constructor(i){t(this,i),this.data=[],this.chartTitle="",this.scenarios=[],this.variances=[],this.hideCategories=!1,this.pixelPerUnit=10,this.pixelPerPercentage=50,this.limit=0,this.i18n=new Map,this.order={hierarchy:[],direction:I.ASC},this.level=H.CATEGORY,this.filter="",this.measureScale="_",this.measureUnit="",this.showMeasureScale=!0,this.dataFormatDigits={percent:2,decimal:1},this.stackConfig=null,this.parentDimensions={width:0,height:0}}render(){var t,e,n;if(void 0===this.chart)return i(s,null);if(this.chart.hasNoData()){const t=this.i18n.get("NO_DATA")||"==No Data==";return i(s,null,i("p",{class:"warning"},t))}return i(s,null,i("div",{innerHTML:null===(t=this.pattern)||void 0===t?void 0:t.toString(),class:"hidePatternContainer"}),i("div",{class:this.showMeasureScale?"footer":"footer-hide"},null===(e=this.chart)||void 0===e?void 0:e.getFooter()),i("div",{innerHTML:null===(n=this.chart)||void 0===n?void 0:n.toString()}))}async componentWillLoad(){var t;const i=this.prepareConfig(),s=this.prepareStyle();this.chart=new Zi(new vt,i,s),this.chart.setI18n(this.i18n),this.autoFitScaling(i,s),this.chart.setAvailableWidth((null===(t=this.parentDimensions)||void 0===t?void 0:t.width)||0),this.pattern=new Pi(this.chart.styles),this.chart.setPattern("fc",this.pattern.getFCPolygonPattern())}async componentWillUpdate(){var t;if(null==this.chart)return;const i=this.prepareConfig(),s=this.prepareStyle();this.chart.setI18n(this.i18n),this.chart.setStyles(s),this.chart.setConfig(i),this.autoFitScaling(i,s),this.chart.setAvailableWidth((null===(t=this.parentDimensions)||void 0===t?void 0:t.width)||0),this.pattern=new Pi(this.chart.styles),this.chart.setPattern("fc",this.pattern.getFCPolygonPattern())}autoFitScaling(t,i){var s;if(t.pixelPerUnit>0)return;const e=null===(s=this.parentDimensions)||void 0===s?void 0:s.width;if(!e||e<=0)return t.pixelPerUnit=1,this.chart=new Zi(new vt,t,i),void this.chart.setI18n(this.i18n);t.pixelPerUnit=1,this.chart=new Zi(new vt,t,i),this.chart.setI18n(this.i18n),this.chart.toString();const n=this.chart.getAllocatedCanvasWidth();if(n<=0)return;const r=this.chart.getMaxBarValue();t.pixelPerUnit=r>0?Math.max(.001,(e-(n-r))/r):.9*e/n,this.chart=new Zi(new vt,t,i),this.chart.setI18n(this.i18n)}async componentWillRender(){}componentDidLoad(){}componentDidUpdate(){}prepareConfig(){return new Gi(new Bi,new ot(new ut),new ut,new bt,this.data).adapt({data:this.data,scenarios:this.scenarios,variances:this.variances,title:this.chartTitle,hideCategories:this.hideCategories,pixelPerUnit:this.pixelPerUnit,pixelPerPercentage:this.pixelPerPercentage,level:this.level,limit:this.limit,sortOrder:this.order,filter:this.filter,measureScale:this.measureScale,measureUnit:this.measureUnit,showMeasureScale:this.showMeasureScale,dataFormatDigits:this.dataFormatDigits,stackConfig:this.stackConfig})}prepareStyle(){return new Yi(new Ii,new wt,new yt(new St),new Rt(new St),new Ot).adapt(this.styles)}get element(){return e(this)}};ts.style=':host{display:inline-block;position:relative;overflow:hidden}.container{display:flex;flex-direction:row}.background-image{display:flex;flex-wrap:wrap;justify-content:flex-end}.categories{text-align:right;font-size:var(--bn-font-size, 1em);font-family:var(--bn-font-family, "Noto Sans", "Helvetica Neue", Helvetica, sans-serif);color:var(--bn-font-color, black)}.label-bg{fill:var(--bn-font-background, white);opacity:0.7}.label-text{text-align:right;font-size:var(--bn-font-size, 1em);font-family:var(--bn-font-family, "Noto Sans", "Helvetica Neue", Helvetica, sans-serif);color:var(--bn-font-color, black)}.axis-title{text-align:center;font-family:var(--bn-font-family, "Noto Sans", "Helvetica Neue", Helvetica, sans-serif);color:var(--bn-font-color, black)}.axis-ac{stroke:black;stroke-width:0.1em}.axis-pp{stroke:grey;stroke-width:0.1em}.axis-fc{stroke:black;stroke-dasharray:2;stroke-width:0.1em}.axis-pl{stroke:white;stroke-width:0.1em;outline-offset:0em;outline:0.1em solid black}canvas{image-rendering:-moz-crisp-edges;image-rendering:-webkit-crisp-edges;image-rendering:pixelated;image-rendering:crisp-edges}.measure{font-weight:bold}span{display:inline-block}.hidePatternContainer{height:0;width:0}div{float:left}.warning{font-size:0.8em;font-style:italic}.footer{margin:0.2em;font-size:0.6em}.footer-hide{margin:0.2em;font-size:0.6em;opacity:0}';class is{constructor(t,i,s,e,n,r,a,o,h){this.prefixStyle="prefix",this.isBarChart=!1,this.key=t,this.index=i,this.value=s,this.prefix=r||"",this.cssStyle=e||"",this.prefixStyle=a||"prefix",this.type=n,this.mark=void 0,this.colSpan=o||1,this.measureScale=h||1}getAsHeaderList(){if(null==this.value)return[""];const t=[];for(const i of this.value.toString().split("<br/>"))t.push(i);return t}draw(t){let i=this.value;if("undefined"===i||void 0===i||null==i)return"";if(Number.isNaN(Number(i)))return i;if(""===this.type||void 0===this.type||null==this.type)return i;let s=t.percent,e=t.percent;return"decimal"===this.type&&(i=+i/this.measureScale,s=t.decimal,e=t.decimal),xt.number(Number(i),this.type,s,e)}drawPrefix(){return null==this.prefix?"":this.prefix}}class ss{constructor(t,i,s){this.index=t,this.groupindex=i,this.type=s,this.cssStyle=this.initCssStyle(),this.elements=[]}initCssStyle(){switch(this.type){case xi.HEADER:return"groupheader";case xi.SEPERATORLINE:return"";case xi.DRILLELEMENT:return"ofit";case xi.PARTELEMENT:return"partof";case xi.STANDARD:return"";case xi.SUM:return"sum";default:return""}}getCells(){return this.elements}createElement(t,i,s,e,n,r,a,o,h,l=!1,c){let d=r;"category"===i&&null!=o&&(d=`category-${o.toString()}`),this.type===xi.HEADER?d="headerlabel":this.type===xi.SEPERATORLINE&&(d=i),this.type===xi.PARTELEMENT&&("percent"===e&&(t="-"),"category"!==i&&"operation"!==i&&(e="percent",d="")),"-"===t&&(d="");let u="prefix-first";a&&(u="prefix-second"),s&&(d=`${d} ${s}`);const p=new is(i,this.elements.length,t,d,e,n,u,1,h);p.isBarChart=l,p.columnStats=c,this.elements.push(p)}}const es={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},ns="#666666";function rs(t,i){return`pattern-${t}-${i.replace("#","")}`}const as=({styles:t})=>{const s=t.scaleFactor,e=6*s,n=[{id:rs("pos",t.positive.stroke),stroke:t.positive.stroke,fill:t.positive.fill},{id:rs("neg",t.negative.stroke),stroke:t.negative.stroke,fill:t.negative.fill},{id:rs("neu",t.neutral.stroke),stroke:t.neutral.stroke,fill:t.neutral.fill}];return i("defs",null,n.map((t=>i("pattern",{id:t.id,patternUnits:"userSpaceOnUse",width:e,height:e},i("rect",{width:e,height:e,fill:"#ffffff"}),i("line",{x1:"0",y1:e,x2:e,y2:"0",stroke:t.stroke,"stroke-width":1.5*s})))))};function os(t,i,s=1){let e,n;const r=t>=0?"+":"";if(i)return e=100*t,r+Math.round(e).toString()+"%";{let i;return e=t/s,n=Math.abs(e),i=n>=1e9?(e/1e9).toFixed(n>=1e10?0:1)+"B":n>=1e6?(e/1e6).toFixed(n>=1e7?0:1)+"M":n>=1e3?(e/1e3).toFixed(n>=1e4?0:1)+"K":e.toFixed(n>=10?0:1),i=i.replace(/\.0([KMB]?)$/,"$1"),r+i}}function hs(t){const i=t.slice(0,2).toLowerCase();return["ac","pp","fc","pl"].includes(i)}function ls(t){const i=t.slice(0,2).toLowerCase();return"pp"===i?"pp":"fc"===i?"fc":"pl"===i?"pl":"ac"}function cs(t,i,s,e){return hs(t)?function(t,i){const s=ls(t);return i.scenarios[s]}(t,e):function(t,i,s){const e=t>=0;return i?e?s.positive:s.negative:e?s.negative:s.positive}(i,s,e)}const ds=t=>{const{value:s,scenario:e,columnStats:n,height:r,isPositiveGood:a,formattedValue:o,measureScale:h,maxBarWidth:l=10,styles:c=es}=t,d=c.scaleFactor,u=c.fontSize,p=38*d,f=l*u,v=4*d,m=.15*f,g=f-v-m,b=Math.abs(s)*c.unitScaling*u,w=b>g,y=Math.max(0,n.absMax*c.unitScaling*u-g),S=Math.max(0,b-g),R=y>0?S/y*m:0,O=n.min<0,$=n.max>0,x=O?f:0,E=(O?p:0)+(x+($?f:0))+($?p:0),_=2*d,M=r-2*_,k=(O?p:0)+x,T=_,P=s>=0,L=cs(e,s,a,c),C=function(t,i){const s=t.fillpattern;return"hatched"===s?`url(#${rs(i,t.stroke)})`:"outlined"===s?"transparent":t.fill}(L,hs(e)?ls(e):a?P?"pos":"neg":P?"neg":"pos"),{stroke:U,strokeWidth:N}="outlined"===(A=L).fillpattern?{stroke:A.stroke,strokeWidth:1.5}:{stroke:"none",strokeWidth:0};var A;const D=o||os(s,!1,h),G=w?g:b,W=w?g+v+R:b,F=P?k+W+4*d:k-W-4*d,B=P?"start":"end";return i("svg",{width:E,height:r,class:"cell-bar-chart absolute-variance",style:{overflow:"visible"}},i(as,{styles:c}),i("line",{x1:k,y1:0,x2:k,y2:r,stroke:ns,"stroke-width":1*d}),G>0&&i("rect",{x:P?k:k-G,y:T,width:G,height:M,fill:C,stroke:U,"stroke-width":N*d}),w&&R>0&&i("rect",{x:P?k+g+v:k-g-v-R,y:T,width:R,height:M,fill:C,stroke:U,"stroke-width":N*d}),w&&function(t,s,e,n,r){const a=t+s/2,o=.35*s,h=n/3,l=.3*s;let c=`M ${a-o} ${e}`;for(let t=0;t<3;t++)c+=` L ${a-o-l} ${e+h*(t+.5)} L ${a-o} ${e+h*(t+1)}`;let d=`M ${a+o} ${e}`;for(let t=0;t<3;t++)d+=` L ${a+o+l} ${e+h*(t+.5)} L ${a+o} ${e+h*(t+1)}`;return[i("rect",{x:t,y:e-1,width:s,height:n+2,fill:"#ffffff"}),i("path",{d:c,fill:"none",stroke:"#000000","stroke-width":1*r}),i("path",{d,fill:"none",stroke:"#000000","stroke-width":1*r})]}(P?k+g:k-g-v,v,T,M,d),i("text",{x:F,y:r/2,dy:"0.35em","text-anchor":B,fill:c.fontColor,"font-size":u,"font-family":c.fontFamily},D))},us=t=>{const{value:s,scenario:e,columnStats:n,height:r,isPositiveGood:a,formattedValue:o,measureScale:h,maxBarWidth:l=10,styles:c=es}=t,d=c.scaleFactor,u=c.fontSize,p=Math.round(.67*l*u),f=5*d,v=n.min<0?p+f:0,m=v+(n.max>0?p+f:0),g=m+45*d,b=v,w=r/2,y=100*Math.abs(s)*c.percentageScaling*u,S=y>p,R=Math.min(y,p),O=s>=0,$=O?b+R:b-R,x=cs(e,s,a,c),E=3*d,_=o||os(s,!0,h),M=m+4*d;return i("svg",{width:g,height:r,class:"cell-bar-chart relative-variance",style:{overflow:"visible"}},i("line",{x1:b,y1:0,x2:b,y2:r,stroke:ns,"stroke-width":1*d}),!S&&i("circle",{cx:$,cy:w,r:E,fill:c.fontColor}),i("line",{x1:b,y1:w,x2:$,y2:w,stroke:x.fill,"stroke-width":2*d}),S&&O&&i("polygon",{points:`${b+p},${w} ${b+p-6*d},${w-3*d} ${b+p-6*d},${w+3*d}`,fill:x.fill}),S&&!O&&i("polygon",{points:`${b-p},${w} ${b-p+6*d},${w-3*d} ${b-p+6*d},${w+3*d}`,fill:x.fill}),i("text",{x:M,y:r/2,dy:"0.35em","text-anchor":"start",fill:c.fontColor,"font-size":u,"font-style":"italic","font-family":c.fontFamily},_))},ps=t=>{const{value:s,columnStats:e,isRelative:n,styles:r=es}=t;return null==s||isNaN(s)||!e||0===e.absMax?i("span",{class:"bar-chart-empty",style:{color:r.fontColor,fontStyle:"italic"}},"-"):i(n?us:ds,Object.assign({},t))};class fs{constructor(t){lt.fn.transformOperator=function(t){return"-"===t?-1:1},this.groups=[Mt.CATEGORY,Mt.CATEGORYINDEX],Oi.OPT!==t.type&&Oi.OPTNOTOTAL!==t.type||this.groups.unshift(Mt.OPERATION),t.grouped&&(this.groups.push(Mt.ROWGROUP),this.groups.push(Mt.ROWGROUPINDEX))}toString(){return this.groups.map((t=>`${t}`)).toString()}noCategory(){return this.groups.filter((t=>t!==Mt.CATEGORY))}toArray(){return this.groups}}class vs{constructor(t,i){this.hasPartOf=!1,this.config=t,this.i18n=i}execute(t){if(0===t.length)return[];const i=[],s=[],e=[],n=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(),a=this.getRelativeScenarios(),o=new fs(this.config),h=this.config.grouped?[Mt.ROWGROUP,Mt.ROWGROUPINDEX]:[];let l=["",""];return this.config.sortOrder.hierarchy.length>0&&(l=this.createOrderString(this.config.sortOrder)),this.hasPartOf=this.checkConfigForPartOf(),lt(`SELECT COUNT(DISTINCT ${Mt.CATEGORY}) as ${Mt.TOTALROWCOUNT} ${h.length>0?","+h:""}\n FROM ? ${h.length>0?"GROUP BY "+h:""} \n ORDER BY ${l[0]}`,[t]).forEach((t=>{const e=t.rowGroup&&t.rowGroup.length>0?`WHERE ${Mt.ROWGROUP} = '${t.rowGroup}'`:"";let a="";this.config.limit&&(a=`LIMIT ${this.config.limit}`),this.createGroupHeaderRow(t,i),this.createDataRow(i,t,o,n,e,l,a),this.createRestRow(t,i,o,n,e,l),this.createGroupSumRow(i,s,t,r,l)})),this.createTotalSumRow(i,s,r),i.forEach((i=>{try{e.push(lt(i,[t]))}catch(t){console.error("DataQuery: SQL query execution failed",i,t)}})),this.detectNaNCells(this.config.scenarios,e),this.createThereOfDrillRows(n,l,t,e),this.createPartOfDrillRows(n,l,s,t,e),this.createThereOfDrillColumns(this.config.categoryThereOf,t,e),this.calculateColumnGroupRest(e,this.config.categoryThereOf),this.calculateRelativeVariances(e,a),e}detectNaNCells(t,i){i.forEach((i=>{i.map((i=>(t.forEach((t=>{const s=new _t(t);!0===s.isValid?0!==i[s.base+"_cnt"]&&0!==i[s.delta+"_cnt"]||(i[t]=Number.NaN):0===i[t+"_cnt"]&&(i[t]=Number.NaN)})),i)))}))}createPartOfDrillRows(t,i,s,e,n){if(null==this.config.partOf||0===this.config.partOf.length||this.config.type===Oi.LIST||null==e||0===e.length)return;const r=this.createPartOfQuery(t,i);let a=[];r.forEach((function(t){a.push(...lt(t,[e]))}));const o=this.exctractScenarioNames(t),h=[];s.forEach((function(t){h.push(...lt(t,[e]))}));const l=new Map;h.forEach((t=>l.set(t[Mt.ROWGROUP],t))),a=this.reduceResDrillByCategoryGroups(a,o),a.forEach((function(t){o.forEach((i=>{try{t[i]=t[i]/l.get(t[Mt.ROWGROUP])[i]}catch(s){console.error("DataQuery: partOf drill row calculation failed",i,s),t[i]=Number.NaN}}))})),this.injectDrillRowsToResultRows(a,n)}createRestRow(t,i,s,e,n,r){t.totalRowCnt-this.config.limit>0&&0!==this.config.limit&&i.push(`SELECT ${Mt.ROWNR}, 1 as ${Mt.ROWGROUPINDEX} , 'ENTRY' as ${Mt.TYPE}, 'NO_GROUP' as ${Mt.ROWGROUP}, 'REST' as ${Mt.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 ${Mt.ROWNR}, ${i.length} as ${Mt.ROWGROUPINDEX} , 'ENTRY' as ${Mt.TYPE}, '${t.rowGroup||"NO_GROUP"}' as ${Mt.ROWGROUP}, ${s} ${e.length>0?",".concat(e):""} FROM ? ${n} GROUP BY ${s} ORDER BY ${r[0]}) t WHERE t.rowNr > ${this.config.limit}`)}createDataRow(t,i,s,e,n,r,a){t.push(`SELECT ROWNUM() AS ${Mt.ROWNR},\n ${t.length} as ${Mt.ROWGROUPINDEX},\n 'ENTRY' as ${Mt.TYPE},\n '${i.rowGroup||"NO_GROUP"}' as ${Mt.ROWGROUP},\n '${Mt.CATEGORYINDEX}',\n ${s} ${e.length>0?",".concat(e):""}\n FROM ? ${n}\n GROUP BY ${s}\n ORDER BY ${r[0]} ${a}`)}createGroupHeaderRow(t,i){!0===this.config.grouped&&i.push(`SELECT ROWNUM() AS ${Mt.ROWNR},\n ${i.length} as ${Mt.ROWGROUPINDEX},\n 'GROUPHEAD' as ${Mt.TYPE},\n '${t.rowGroup}' as ${Mt.ROWGROUP} ${this.config.showGroupTitle?`,'${t.rowGroup}' as ${Mt.CATEGORY}`:""}\n FROM ?\n GROUP BY '1'`)}createGroupSumRow(t,i,s,e,n){!0!==this.config.grouped||Oi.SUM!==this.config.type&&Oi.SUMNOTOTAL!==this.config.type&&Oi.OPT!==this.config.type&&Oi.OPTNOTOTAL!==this.config.type||(t.push(`SELECT ${t.length} as ${Mt.ROWGROUPINDEX},\n '=' as ${Mt.OPERATION},\n '${s.rowGroup}' as ${Mt.ROWGROUP},\n ROWNUM() AS ${Mt.ROWNR},\n 'GROUP_SUM' as ${Mt.TYPE} ${e.length>0?",".concat(e):""}\n FROM ?\n WHERE ${Mt.ROWGROUP} = '${s.rowGroup}'\n ORDER BY ${n[0]} `),i.push(`SELECT ${t.length} as ${Mt.ROWGROUPINDEX},\n '=' as ${Mt.OPERATION},\n '${s.rowGroup}' as ${Mt.ROWGROUP},\n ROWNUM() AS ${Mt.ROWNR},\n 'GROUP_SUM' as ${Mt.TYPE} ${e.length>0?",".concat(e):""}\n FROM ?\n WHERE ${Mt.ROWGROUP} = '${s.rowGroup}'\n ORDER BY ${n[0]} `))}createTotalSumRow(t,i,s){if(Oi.SUM===this.config.type||Oi.OPT===this.config.type){const i=`${this.hasPartOf&&!1===this.config.grouped?`${this.i18n.get("SUM_TOTAL")||"SUM_TOTAL"} `:""}${this.config.title}`;t.push(`SELECT ${t.length} as ${Mt.ROWGROUPINDEX},\n '${i}' as ${Mt.ROWGROUP},\n '=' as ${Mt.OPERATION},\n 'SUM' as ${Mt.TYPE} ${s.length>0?",".concat(s):""}\n FROM ? `)}i.push(`SELECT ${t.length} as ${Mt.ROWGROUPINDEX},\n 'SUM_TOTAL' as ${Mt.ROWGROUP},\n '=' as ${Mt.OPERATION},\n 'SUM' as ${Mt.TYPE} ${s.length>0?",".concat(s):""}\n FROM ? `)}reduceResDrillByCategoryGroups(t,i){const s=new Map;return t.forEach((function(t){const e=t.rowNr+t.rowGroup+t.type+t.category;if(s.has(e)){const n=s.get(e);i.forEach((i=>{try{n[i]+=t[i]}catch(t){console.error("DataQuery: drill row aggregation failed",i,t)}}))}else s.set(e,t)})),[...s.values()]}injectDrillRowsToResultRows(t,i){const s=new Map;if(!0===this.config.grouped)t.forEach((function(t){i.forEach((function(i){const e=i.findIndex((i=>i.category===t.category&&i.rowGroup===t.rowGroup));if(e>=0){if(s.has(`${t.category}_${t.rowGroup}`)){const i=s.get(`${t.category}_${t.rowGroup}`)||0;s.set(`${t.category}_${t.rowGroup}`,i+1)}else s.set(`${t.category}_${t.rowGroup}`,1);t[Mt.ROWNR]=s.get(`${t.category}_${t.rowGroup}`),i.splice(e+t[Mt.ROWNR],0,t)}}))}));else{const e=this.findDuplicateSubCategories(t);t.forEach((function(t){i.forEach((function(i){const n=i.findIndex((i=>null!=i.category&&i.category===t.category));if(n>=0){if(s.has(`${t.category}`)){const i=s.get(`${t.category}`)||0;s.set(`${t.category}`,i+1)}else s.set(`${t.category}`,1);(1===t[Mt.ROWNR]||e.includes(t.subCategory))&&(t.subCategory=`${t.subCategory} (${t.rowGroup})`),i.splice(n+t[Mt.ROWNR],0,t)}}))}))}}createThereOfDrillRows(t,i,s,e){if(void 0===this.config.thereOf||0===this.config.thereOf.length)return;const n=[],r=[];this.config.thereOf.forEach((s=>{let e=!0,r="1 <> 1 OR ( ";null!=s.category&&0!==s.category.length&&s.category.trim()&&(r+=` ${Mt.CATEGORY} = '${s.category}'`,e=!1),null!=s.rowGroup&&0!==s.rowGroup.length&&s.rowGroup.trim()&&(r+=` ${e?"":"AND"} ${Mt.ROWGROUP} = '${s.rowGroup}'`,e=!1),null!=s.subCategory&&0!==s.subCategory.length&&s.subCategory.trim()&&(r+=` ${e?"":"AND"} ${Mt.SUBCATEGORY} = '${s.subCategory}'`),r+=")",n.push(`SELECT ROWNUM() AS ${Mt.ROWNR},\n null as operation,\n 'DRILLELEMENT' as ${Mt.TYPE},\n ${Mt.CATEGORY},\n ${Mt.SUBCATEGORY},\n ${Mt.ROWGROUP} as ${Mt.ROWGROUP},\n ${t}\n FROM ?\n WHERE ${r}\n GROUP BY ${Mt.ROWGROUP}, ${Mt.CATEGORY}, ${Mt.SUBCATEGORY}\n ORDER BY ${i[1]}`)})),n.forEach((function(t){r.push(...lt(t,[s]))})),this.injectDrillRowsToResultRows(r,e)}calculateRelativeVariances(t,i){t.forEach((t=>{t.forEach((t=>{"GROUPHEAD"!==t[Mt.TYPE]&&i.forEach(((i,s)=>{t[s]=t[s]/t[i]}))}))}))}calculateColumnGroupRest(t,i){if(null==i||0===i.size)return;const s=new Map,e=new Map;i.forEach(((t,i)=>{const n=t,r=[];for(const t of n)r.push(`${i}##${t.name}`);s.set(i,r),e.set(`${i}##REST`,!1)})),t.forEach((t=>{t.forEach((t=>{"GROUPHEAD"!==t[Mt.TYPE]&&s.forEach(((i,s)=>{let n=0;i.forEach((i=>{void 0!==t[i]&&(n+=t[i])})),t[`${s}##REST`]=t[s]-n,0!==t[`${s}##REST`]&&e.set(`${s}##REST`,!0)}))}))}));const n=Array.from(e.entries()).filter((([t,i])=>!i)).map((([t])=>t));t.forEach((t=>{t.forEach((t=>{for(const i of n)delete t[i]}))}))}getRelativeScenarios(){const t=new Map;return this.config.scenarios.forEach((i=>{const s=this.createRelativeScenario(i);null!=s&&t.set(s.key,s.value)})),t}translateScenarioSQL(t,i,s){const e=new _t(t);return Oi.OPT===s||Oi.OPTNOTOTAL===s?e.isValid?"dr"===e.type?`SUM(${e.base} - ${e.delta}) as ${t}, SUM(${e.delta}) as dr_${e.delta}`:`SUM(${e.base} - ${e.delta}) as ${t}`:i?`SUM(${t} * transformOperator(operation)) as ${t}, COUNT(ISNULL(${t})) as ${t}_cnt`:`SUM(${t}) as ${t}, COUNT(ISNULL(${t})) as ${t}_cnt`:e.isValid?"dr"===e.type?`SUM((${e.base} * transformOperator(operation)) - (${e.delta} * transformOperator(operation))) as ${t}, SUM(${e.delta} * transformOperator(operation)) as dr_${e.delta}`:`SUM((${e.base} * transformOperator(operation))- (${e.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()} ${$i.ASC===t.direction?$i.DESC:$i.ASC}`]}createRelativeScenario(t){const i=new _t(t);return i.isValid&&"dr"===i.type?{key:`${t}`,value:`dr_${i.delta}`}:null}exctractScenarioNames(t){const i=[];return t.split(",").forEach((t=>t.length>=2?i.push(t.split("as")[1].trim()):null)),i}findDuplicateSubCategories(t){const i=t.map((t=>({count:1,subCategory:t.subCategory}))).reduce(((t,i)=>(t[i.subCategory]=(t[i.subCategory]||0)+i.count,t)),{});return Object.keys(i).filter((t=>i[t]>1))}createPartOfQuery(t,i){var s;const e=[];let n="1 <> 1 ",r=` ${Mt.ROWGROUP}`,a="ROWNUM()";return null===(s=this.config.partOf)||void 0===s||s.forEach((t=>{n+=`OR (${Mt.CATEGORY} = '${t.category}'`,null!=t.rowGroup&&0!==t.rowGroup.length&&t.rowGroup.trim()&&(n+=`and ${Mt.ROWGROUP} = '${t.rowGroup}'`),!1===this.config.grouped&&(r=` 'SUM_TOTAL' as ${Mt.ROWGROUP} `,a="1"),n+=")"})),e.push(`SELECT ${a} AS ${Mt.ROWNR},\n 'PARTELEMENT' as ${Mt.TYPE},\n ${Mt.CATEGORY},\n ${r},\n ${t}\n FROM ?\n WHERE ${n}\n GROUP BY ${Mt.ROWGROUP}, ${Mt.CATEGORY}, ${Mt.TYPE}\n ORDER BY ${i[1]}`),e}checkConfigForPartOf(){return null!=this.config.partOf&&0!==this.config.partOf.length}createThereOfDrillColumns(t,i,s){if(null==t||0===t.size)return;const e=[],n=[];t.forEach(((t,i)=>{let s="1 <> 1 ";t.forEach((t=>{s+=` or columnGroup = '${t.name}' `})),e.push(`SELECT 'ENTRY' as rowlevel,\n 'COLUMNGROUP' as columnlevel,\n rowGroup,\n category,\n columnGroup,\n '${i}' as scenario,\n sum(${i} * transformOperator(operation)) as val\n FROM ?\n WHERE ${s}\n GROUP BY rowlevel, rowGroup, category, columnGroup, scenario`),e.push(`SELECT 'ENTRY' as rowlevel,\n 'SUBGROUP' as columnlevel,\n rowGroup,\n category,\n columnGroup,\n columnSubGroup,\n '${i}' as scenario,\n sum(${i} * transformOperator(operation)) as val\n FROM ?\n WHERE ${s}\n GROUP BY rowlevel, rowGroup, category, columnGroup, columnSubGroup, scenario`),e.push(`SELECT 'DRILLELEMENT' as rowlevel,\n 'COLUMNGROUP' as columnlevel,\n rowGroup,\n category,\n subCategory,\n columnGroup,\n '${i}' as scenario,\n sum(${i} * transformOperator(operation)) as val\n FROM ?\n WHERE ${s}\n GROUP BY rowlevel, rowGroup, category, subCategory, columnGroup, scenario`),e.push(`SELECT 'DRILLELEMENT' as rowlevel,\n 'SUBGROUP' as columnlevel,\n rowGroup,\n category,\n subCategory,\n columnGroup,\n columnSubGroup,\n '${i}' as scenario,\n sum(${i} * transformOperator(operation)) as val\n FROM ?\n WHERE ${s}\n GROUP BY rowlevel, rowGroup, category, subCategory, columnGroup, columnSubGroup, scenario`),e.push(`SELECT 'GROUP_SUM' as rowlevel,\n 'COLUMNGROUP' as columnlevel,\n rowGroup,\n columnGroup,\n '${i}' as scenario,\n sum(${i} * transformOperator(operation)) as val\n FROM ?\n WHERE ${s}\n GROUP BY rowlevel, rowGroup, columnGroup, scenario`),e.push(`SELECT 'GROUP_SUM' as rowlevel,\n 'SUBGROUP' as columnlevel,\n rowGroup,\n columnGroup,\n columnSubGroup,\n '${i}' as scenario,\n sum(${i} * transformOperator(operation)) as val\n FROM ?\n WHERE ${s}\n GROUP BY rowlevel, rowGroup, columnGroup, columnSubGroup, scenario`),e.push(`SELECT 'SUM' as rowlevel,\n 'COLUMNGROUP' as columnlevel,\n columnGroup,\n '${i}' as scenario,\n sum(${i} * transformOperator(operation)) as val\n FROM ?\n WHERE ${s}\n GROUP BY rowlevel, columnGroup, scenario`),e.push(`SELECT 'SUM' as rowlevel,\n 'SUBGROUP' as columnlevel,\n columnGroup,\n columnSubGroup,\n '${i}' as scenario,\n sum(${i} * transformOperator(operation)) as val\n FROM ?\n WHERE ${s}\n GROUP BY rowlevel, columnGroup, columnSubGroup, scenario`)}));for(const t of e)n.push(...lt(t,[i]));this.injectDrillColumnsToResultRows(n,s)}injectDrillColumnsToResultRows(t,i){const s="##";for(const e of t)for(const t of i)for(const i of t)i.type===e.rowlevel&&("ENTRY"===e.rowlevel?"COLUMNGROUP"===e.columnlevel&&i.category===e.category?i[e.scenario+s+e.columnGroup]=e.val:"SUBGROUP"===e.columnlevel&&i.category===e.category&&(i[e.scenario+s+e.columnGroup+s+e.columnSubGroup]=e.val):"DRILLELEMENT"===e.rowlevel?"COLUMNGROUP"===e.columnlevel&&i.category===e.category&&i.subCategory===e.subCategory?i[e.scenario+s+e.columnGroup]=e.val:"SUBGROUP"===e.columnlevel&&i.category===e.category&&i.subCategory===e.subCategory?i[e.scenario+s+e.columnGroup+s+e.columnSubGroup]=e.val:"COLUMNGROUP"===e.columnlevel&&i.category===e.category&&i.subCategory===`${e.subCategory} (${e.rowGroup})`?i[e.scenario+s+e.columnGroup]=e.val:"SUBGROUP"===e.columnlevel&&i.category===e.category&&i.subCategory===`${e.subCategory} (${e.rowGroup})`&&(i[e.scenario+s+e.columnGroup+s+e.columnSubGroup]=e.val):("SUM"===e.rowlevel||"GROUP_SUM"===e.rowlevel)&&("COLUMNGROUP"===e.columnlevel&&i.category===e.category&&i.subCategory===e.subCategory&&(i[e.scenario+s+e.columnGroup]=e.val),"SUBGROUP"===e.columnlevel&&i.category===e.category&&i.subCategory===e.subCategory&&(i[e.scenario+s+e.columnGroup+s+e.columnSubGroup]=e.val)))}}class ms{constructor(){this.normalizedHeader=[]}createHeader(t,i,s,e,n,r){const a=[];this.normalizedHeader=this.normalizeHeader(t,i);const o=new ss(0,0,xi.HEADER),h=new ss(1,0,xi.SEPERATORLINE);for(const t of this.normalizedHeader)o.createElement(xt.translateScenarioLabel(t.name,s),t.type,this.createColumnType(t),null,this.setHeaderPrefix(t,s,e,n,r),null,null,null,null),h.createElement(null,t.type,this.createColumnType(t),null,null,null,null,null,null);return a.push(o),a.push(h),a}setHeaderPrefix(t,i,s,e,n){let r="";return"category"===t.name&&n&&(0===s.prefix.length&&0===e.length||(r=xt.translateScenarioLabel("in",i)+" "+s.prefix+e)),t.order&&(r+=xt.translateScenarioLabel("ORDER_"+t.order,i)),r}normalizeHeader(t,i){let s=[{name:Mt.CATEGORY,group:Mt.CATEGORY,type:Mt.CATEGORY,order:void 0}];return Oi.OPT!==t&&Oi.OPTNOTOTAL!==t||(s=[{name:Mt.OPERATION,group:Mt.OPERATION,type:Mt.OPERATION,order:void 0},{name:Mt.CATEGORY,group:Mt.CATEGORY,type:Mt.CATEGORY,order:void 0}]),[...s,...i]}createBodyRows(t,i,s){const e=[];let n=-1;const r=new vs(t,i).execute(s),a=this.calculateColumnStatistics(r,t.barColumns);for(const s of r)n+=1,e.push(...this.createRow(t.i18n,i,t.scenariosUnitType,s,n,-1,t.categoryWidth,t.measureScale,t.barColumns,a));return e}calculateColumnStatistics(t,i){const s=new Map;if(!i||0===i.length)return s;const e=new Map;for(const t of i)s.set(t,{min:1/0,max:-1/0,absMax:0,median:0}),e.set(t,[]);for(const n of t)for(const t of n)for(const n of i){const i=this.extractColumnValue(t,n);if(null!==i&&!isNaN(i)){const t=s.get(n);t.min=Math.min(t.min,i),t.max=Math.max(t.max,i),e.get(n).push(Math.abs(i))}}for(const[t,i]of s){i.min!==1/0&&i.max!==-1/0||(i.min=0,i.max=0),i.absMax=Math.max(Math.abs(i.min),Math.abs(i.max));const n=e.get(t);if(n.length>0){n.sort(((t,i)=>t-i));const t=Math.floor(n.length/2);i.median=n.length%2==0?(n[t-1]+n[t])/2:n[t]}s.set(t,i)}return s}extractColumnValue(t,i){if(void 0!==t[i]){const s=Number(t[i]);return isNaN(s)?null:s}for(const s of Object.keys(t))if(s===i||s.endsWith("##"+i)||s===i+"##"+i){const i=Number(t[s]);if(!isNaN(i))return i}return null}createRow(t,i,s,e,n,r,a,o,h,l){var c;const d=[];for(const u of e){const p=u[Mt.ROWGROUP],f=u[Mt.SUBCATEGORY],v=u[Mt.TYPE],m=u[Mt.ROWNR]>=2,g=this.createDetailRow(v,r+=1,n,e.length);for(const e of this.normalizedHeader){const n=this.getRawDataRowElement(u,e),r=null!==(c=null==h?void 0:h.includes(e.type))&&void 0!==c&&c,d=r?null==l?void 0:l.get(e.type):void 0;g.createElement(this.translateSumCellLabel(t,i,n,p,f,v,e.type),e.type,this.createColumnType(e),this.setCellType(e.type,s),this.translateCellPrefix(i,v,e.type),this.translateScenarioCSS(e.type,n),m,a,null==o?void 0:o.value,r,d)}d.push(g)}return d}getRawDataRowElement(t,i){return i.name===i.group&&i.name===i.type?t[i.name]:i.name===i.group&&i.name!==i.type?t[i.type+"##"+i.name]:t[i.type+"##"+i.group+"##"+i.name]}createDetailRow(t,i,s,e){switch(t){case xi.GROUPHEAD:return new ss(i,s,xi.HEADER);case xi.SUM:case xi.GROUPSUM:return new ss(e+2,s,xi.SUM);case xi.DRILLELEMENT:return new ss(e+2,s,xi.DRILLELEMENT);case xi.PARTELEMENT:return new ss(e+2,s,xi.PARTELEMENT);default:return new ss(i,s,xi.STANDARD)}}translateSumCellLabel(t,i,s,e,n,r,a){return!1===Number.isNaN(Number(s))||this.isOperationColumn(a)?s:this.isGroupHeadCategory(r,a)||this.isEntryCategory(r,a)?t===Q.ALL?`${i.get(s)||s}`:s:this.isDrillElementCategory(r,a)?t===Q.ALL?`${i.get(n)||n}`:`${n}`:this.isPartElementCategory(r,a)?t===Q.ALL||"SUM_TOTAL"===e?`${i.get(e)||e}`:`${e}`:this.isSumElementCategory(r,a)?t===Q.ALL||"SUM_TOTAL"===e?`${i.get(e)||e}`:e:"GROUPHEAD"===r&&null==s?s:Number.isNaN(Number(s))?"-":Number(s)}isOperationColumn(t){return"operation"===t}translateScenarioCSS(t,i){const s=new _t(t);let e="pos";return i<0&&(e="neg"),s.isValid?e+"_"+s.direction+("dr"===s.type?" relative_variance":""):t}setCellType(t,i){if("category"===t)return"";let s;const e=new _t(t);return i===K.PERCENT?(s="percent",e.isValid&&"d"===e.type&&(s="decimal")):(s="decimal",e.isValid&&"dr"===e.type&&(s="percent")),s}isDrillElementCategory(t,i){return"DRILLELEMENT"===t&&"category"===i}isPartElementCategory(t,i){return"PARTELEMENT"===t&&"category"===i}isSumElementCategory(t,i){return("GROUP_SUM"===t||"SUM"===t)&&"category"===i}isEntryCategory(t,i){return"ENTRY"===t&&"category"===i}isGroupHeadCategory(t,i){return"GROUPHEAD"===t&&"category"===i}translateCellPrefix(t,i,s){return this.isOperationColumn(s)||this.isGroupHeadCategory(i,s)||this.isEntryCategory(i,s)?null:this.isDrillElementCategory(i,s)?`${t.get("there_of")} `:this.isPartElementCategory(i,s)?`${t.get("part_of")} `:null}createColumnType(t){return t.name===t.group&&t.name===t.type?"base":t.name===t.group?"columnGroup":"columnSubGroup"}}class gs{constructor(t,i,s){this.data=[],this.headerRows=[],this.bodyRows=[],this.ruleSet=t||new vt,this.dataSetFactory=new ms,this.config=this.initConfig(s),this.i18n=this.initI18n(new Map),this.setData(i,s.filter),this.state=Ri.DIRTY}setI18n(t){this.i18n=this.initI18n(t)}initI18n(t){const i=new Map([["",""],["SEPERATOR_WS",", "],["in","in"],["ORDER_asc","↑"],["ORDER_desc","↓"],["ac1","AC"],["pp1","PY"],["fc1","FC"],["pl1","PL"],["ac2","AC2"],["pp2","PY2"],["fc2","FC2"],["pl2","PL2"],["ac3","AC3"],["pp3","PY3"],["fc3","FC3"],["pl3","PL3"],["ac4","AC4"],["pp4","PY4"],["fc4","FC4"],["pl4","PL4"],["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=Ri.DIRTY,new Map([...i,...t||new Map])}initConfig(t){this.state=Ri.DIRTY;const i=t,s=this;return t.scenarios.sort(((t,i)=>s.ruleSet.getScenarioSorIndex(t)-s.ruleSet.getScenarioSorIndex(i))),i}setConfig(t){this.config=this.initConfig(t)}setData(t,i){if(null==t)return;if(null!=i&&i.length>0)try{this.data=lt(`SELECT * FROM ? WHERE ${i}`,[t])}catch(s){console.error("Table: filter query failed, using unfiltered data",i,s),this.data=t}else this.data=t;const s=this.normalizeScenarios(this.config.scenarios,this.config.categoryThereOf,this.config.sortOrder);this.headerRows=this.dataSetFactory.createHeader(this.config.type,s,this.i18n,this.config.measureScale,this.config.measureUnit,this.config.showMeasureScale),this.bodyRows=this.dataSetFactory.createBodyRows(this.config,this.i18n,this.data),this.state=Ri.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=Ri.UP_TO_DATE}getHeader(){return this.state===Ri.DIRTY&&this.update(),this.headerRows}getBody(){return this.state===Ri.DIRTY&&this.update(),this.bodyRows}normalizeScenarios(t,i,s){var e;const n=[];for(const r of t){if(null==i?void 0:i.has(r)){const t=i.get(r);for(const i of t){n.push({name:i.name,group:i.name,type:r,order:void 0});for(const t of i.subGroups)n.push({name:t,group:i.name,type:r,order:void 0})}n.push({name:"REST",group:"REST",type:r,order:void 0})}let t;(null===(e=null==s?void 0:s.hierarchy)||void 0===e?void 0:e.at(0))===r&&(t=s.direction),n.push({name:r,group:r,type:r,order:t})}return n}hasNoData(){return 0===this.data.length}}class bs{constructor(){this.title="",this.scenarios=[],this.scenariosUnitType=K.DECIMAL,this.grouped=!1,this.showGroupTitle=!0,this.thereOf=[],this.categoryThereOf=new Map,this.partOf=[],this.sortOrder=new ot(new ut).default(),this.type=Oi.LIST,this.limit=0,this.i18n=Q.ALL,this.categoryWidth=q.W25,this.measureScale=new pt,this.measureUnit="",this.measureType=Z.VOLUME,this.showMeasureScale=!0,this.filter="",this.barColumns=[]}}class ws{constructor(t,i,s,e){this.tableDrillGroupAdapter=t,this.stringAdapter=i,this.orderAdapter=s,this.dataSet=e}adapt(t){const i=new bs;return at.isString(t.title)&&(i.title=t.title),at.isArray(t.scenarios)&&(i.scenarios=rt.adaptArray(t.scenarios,this.stringAdapter)),at.isExisting(t.scenariosUnitType)&&(i.scenariosUnitType=t.scenariosUnitType),at.isBoolean(t.grouped)&&(i.grouped=t.grouped),at.isBoolean(t.showGroupTitle)&&(i.showGroupTitle=t.showGroupTitle),at.isBoolean(t.showMeasureScale)&&(i.showMeasureScale=t.showMeasureScale),at.isArray(t.thereOf)&&(i.thereOf=rt.adaptArray(t.thereOf,this.tableDrillGroupAdapter)),at.isExisting(t.categoryThereOf)&&(i.categoryThereOf=t.categoryThereOf),at.isArray(t.partOf)&&(i.partOf=rt.adaptArray(t.partOf,this.tableDrillGroupAdapter)),at.isExisting(t.order)&&(i.sortOrder=this.orderAdapter.adapt(t.order)),at.isExisting(t.type)&&(i.type=t.type),at.isNumber(t.limit)&&(i.limit=t.limit),at.isExisting(t.i18n)&&(i.i18n=t.i18n),at.isExisting(t.categoryWidth)&&(i.categoryWidth=t.categoryWidth),at.isExisting(t.measureScale)&&(i.measureScale=dt.calculateMeasureScale(this.dataSet,i.scenarios,t.measureScale)),at.isExisting(t.measureType)&&(i.measureType=t.measureType),at.isString(t.measureUnit)&&(i.measureUnit=t.measureUnit),at.isString(t.filter)&&(i.filter=t.filter.trim()),at.isArray(t.barColumns)&&(i.barColumns=t.barColumns),i}default(){return new bs}}class ys{constructor(){this.rowGroup="",this.category="",this.subCategory="",this.partOf=""}}class Ss{constructor(){}adapt(t){const i=new ys;return at.isString(t.rowGroup)&&(i.rowGroup=t.rowGroup),at.isString(t.category)&&(i.category=t.category),at.isString(t.subCategory)&&(i.subCategory=t.subCategory),at.isString(t.partOf)&&(i.partOf=t.partOf),i}default(){return new ys}}class Rs{constructor(){this.operation="+"}addRowGroup(t,i){this.rowGroup=t,this.rowGroupIndex=i}addCategory(t,i){this.category=t,this.categoryIndex=i}addSubCategory(t,i){this.subCategory=t,this.subCategoryIndex=i}addColumnGroup(t,i){this.columnGroup=t,this.columnGroupIndex=i}addSubColumnGroup(t,i){this.columnSubGroup=t,this.columnSubGroupIndex=i}}class Os{constructor(){}adapt(t){const i=new Rs;return at.isOperator(t.operation)&&(i.operation=t.operation),at.isNumber(t.rowGroupIndex)&&at.isString(t.rowGroup)&&i.addRowGroup(t.rowGroup,t.rowGroupIndex),at.isNumber(t.categoryIndex)&&at.isString(t.category)&&i.addCategory(t.category,t.categoryIndex),at.isNumber(t.subCategoryIndex)&&at.isString(t.subCategory)&&i.addSubCategory(t.subCategory,t.subCategoryIndex),at.isNumber(t.columnGroupIndex)&&at.isString(t.columnGroup)&&i.addColumnGroup(t.columnGroup,t.columnGroupIndex),at.isNumber(t.columnSubGroupIndex)&&at.isString(t.columnSubGroup)&&i.addSubColumnGroup(t.columnSubGroup,t.columnSubGroupIndex),this.setActualValues(t,i),this.setPlanValues(t,i),this.setPreviousPeriodValues(t,i),this.setForecastValues(t,i),i}default(){return new Rs}setActualValues(t,i){at.isNumber(t.ac1)&&(i.ac1=t.ac1),at.isNumber(t.ac2)&&(i.ac2=t.ac2),at.isNumber(t.ac3)&&(i.ac3=t.ac3),at.isNumber(t.ac4)&&(i.ac4=t.ac4)}setPlanValues(t,i){at.isNumber(t.pp1)&&(i.pp1=t.pp1),at.isNumber(t.pp2)&&(i.pp2=t.pp2),at.isNumber(t.pp3)&&(i.pp3=t.pp3),at.isNumber(t.pp4)&&(i.pp4=t.pp4)}setPreviousPeriodValues(t,i){at.isNumber(t.pl1)&&(i.pl1=t.pl1),at.isNumber(t.pl2)&&(i.pl2=t.pl2),at.isNumber(t.pl3)&&(i.pl3=t.pl3),at.isNumber(t.pl4)&&(i.pl4=t.pl4)}setForecastValues(t,i){at.isNumber(t.fc1)&&(i.fc1=t.fc1),at.isNumber(t.fc2)&&(i.fc2=t.fc2),at.isNumber(t.fc3)&&(i.fc3=t.fc3),at.isNumber(t.fc4)&&(i.fc4=t.fc4)}}const $s=class{constructor(i){t(this,i),this.data=[],this.tableTitle="SUM_TOTAL",this.scenarios=[],this.scenariosDataFormat=K.DECIMAL,this.grouped=!1,this.limit=0,this.showGroupTitle=!0,this.thereof=[],this.partof=[],this.order={hierarchy:[],direction:$i.ASC},this.categorythereof=new Map,this.type=Oi.LIST,this.categoryWidth=q.INF,this.dataFormatDigits={percent:2,decimal:1},this.i18n=new Map,this.i18nMode=Q.ALL,this.measureScale="_",this.measureUnit="",this.showMeasureScale=!0,this.measureType=Z.VOLUME,this.filter="",this.barColumns=[],this.barColumnMaxWidth=30,this.unitScaling=.01,this.percentageScaling=.5,this.scaleFactor=1,this.componentDataFormatDigits=new $t,this.componentStyle=f(this)}render(){return i(s,null,(()=>{if(void 0!==this.table){if(this.table.hasNoData()){const t=this.i18n.get("NO_DATA")||"==No Data==";return i("p",{class:"warning"},t)}return i("table",null,i("thead",null,this.table.getHeader().map((t=>i("tr",{class:t.cssStyle},t.getCells().map((t=>i("th",{colSpan:t.colSpan,class:t.cssStyle},t.getAsHeaderList().map(((s,e,n)=>i("span",null,e===n.length-1?i("span",{class:" "===s?"table-footer":""},s,t.drawPrefix()," "):i("span",null,s,t.drawPrefix(),i("br",null)))))))))))),i("tbody",null,this.table.getBody().map((t=>i("tr",{class:t.cssStyle},null==t?void 0:t.getCells().map((s=>i("td",{colSpan:s.colSpan,class:s.type?`${s.cssStyle} ${s.type}`:s.cssStyle},null!=s.prefix?i("span",{class:s.cssStyle+" "+s.prefixStyle},s.drawPrefix()):"",s.isBarChart&&s.columnStats&&t.type!==xi.SUM?i(ps,{value:s.value,scenario:s.key,columnStats:s.columnStats,height:18*this.scaleFactor,isRelative:s.key.startsWith("dr"),isPositiveGood:s.key.endsWith("_pos"),measureScale:s.measureScale,maxBarWidth:this.barColumnMaxWidth,styles:this.barChartStyles}):s.draw(this.componentDataFormatDigits)))))))))}})())}componentWillRender(){const t=this.prepareConfig(),i=this.prepareData();this.componentDataFormatDigits=(new bt).adapt(this.dataFormatDigits),this.barChartStyles=this.prepareBarChartStyles(),this.table=new gs(new vt,i,t),this.table.setI18n(this.i18n)}prepareConfig(){return new ws(new Ss,new ut,new ot(new ut),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 rt.adaptArray(this.data,new Os)}prepareBarChartStyles(){return this.componentStyle((t=>{var i,s,e,n,r,a,o,h,l,c,d,u,p,f,v,m,g,b,w,y,S,R,O,$,x,E;const _=null===(i=t["bn-chart-time"])||void 0===i?void 0:i.varianceStyles,M=null===(s=t["bn-chart-time"])||void 0===s?void 0:s.barStyles;return{positive:{stroke:(null===(e=null==_?void 0:_.pos)||void 0===e?void 0:e.stroke)||"#008f96",fill:(null===(n=null==_?void 0:_.pos)||void 0===n?void 0:n.fill)||"#008f96",fillpattern:(null===(r=null==_?void 0:_.pos)||void 0===r?void 0:r.fillpattern)||"solid"},negative:{stroke:(null===(a=null==_?void 0:_.neg)||void 0===a?void 0:a.stroke)||"#ff0000",fill:(null===(o=null==_?void 0:_.neg)||void 0===o?void 0:o.fill)||"#ff0000",fillpattern:(null===(h=null==_?void 0:_.neg)||void 0===h?void 0:h.fillpattern)||"solid"},neutral:{stroke:(null===(l=null==_?void 0:_.neu)||void 0===l?void 0:l.stroke)||"#808080",fill:(null===(c=null==_?void 0:_.neu)||void 0===c?void 0:c.fill)||"#808080",fillpattern:(null===(d=null==_?void 0:_.neu)||void 0===d?void 0:d.fillpattern)||"outlined"},scenarios:{ac:{stroke:(null===(u=null==M?void 0:M.ac)||void 0===u?void 0:u.stroke)||"#404040",fill:(null===(p=null==M?void 0:M.ac)||void 0===p?void 0:p.fill)||"#404040",fillpattern:(null===(f=null==M?void 0:M.ac)||void 0===f?void 0:f.fillpattern)||"solid"},pp:{stroke:(null===(v=null==M?void 0:M.pp)||void 0===v?void 0:v.stroke)||"#A6A6A6",fill:(null===(m=null==M?void 0:M.pp)||void 0===m?void 0:m.fill)||"#A6A6A6",fillpattern:(null===(g=null==M?void 0:M.pp)||void 0===g?void 0:g.fillpattern)||"solid"},fc:{stroke:(null===(b=null==M?void 0:M.fc)||void 0===b?void 0:b.stroke)||"#404040",fill:(null===(w=null==M?void 0:M.fc)||void 0===w?void 0:w.fill)||"#ffffff",fillpattern:(null===(y=null==M?void 0:M.fc)||void 0===y?void 0:y.fillpattern)||"hatched"},pl:{stroke:(null===(S=null==M?void 0:M.pl)||void 0===S?void 0:S.stroke)||"#404040",fill:(null===(R=null==M?void 0:M.pl)||void 0===R?void 0:R.fill)||"#ffffff",fillpattern:(null===(O=null==M?void 0:M.pl)||void 0===O?void 0:O.fillpattern)||"outlined"}},fontColor:(null===($=t.global)||void 0===$?void 0:$.fontColor)||"#000000",fontSize:.85*((null===(x=t.global)||void 0===x?void 0:x.fontSizePx)||13.3333)*this.scaleFactor,fontFamily:(null===(E=t.global)||void 0===E?void 0:E.fontFamily)||"'Noto Sans', sans-serif",unitScaling:this.unitScaling,percentageScaling:this.percentageScaling,scaleFactor:this.scaleFactor}}))}get element(){return e(this)}};$s.style=':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}';class xs{constructor(){}createMeasures(t,i,s){if(this.allMeasuresUseSameUnit(t)){const e=t.length;let n="",r="";for(let a=0;a<e;a++){let o="";a>0&&(o=i.get("SEPERATOR_WS")),e>1&&a===e-1&&(o=i.get("CONNECTOR_WS")),s===Q.ALL?(n=(i.get(n)||n)+o+(i.get(t[a].name)||t[a].name),r=i.get(t[a].unit)||t[a].unit):(n=n+o+t[a].name,r=t[a].unit)}return[{name:n,unit:r}]}return t}createDimension(t,i,s,e,n){let r="";void 0!==i&&(r=(new ht).getDateLinkString(i.start,i.end,i.link,i.format,n));const a=t.map((t=>{let i="";return null!=s&&null!=s.hierarchy&&s.hierarchy.find((i=>i===t))&&(i=e.get("asc"===s.direction?"ORDER_asc":"ORDER_desc")),"".concat(" ",xt.translateScenarioLabel(t,e),i)})).toString();return r+a}allMeasuresUseSameUnit(t){const i=new Map;return t.forEach((function(t){i.set(t.unit,!0)})),1===i.size}}class Es{constructor(){this.businessunit="",this.measures=[],this.scenarios=[],this.i18nMode=Q.ALL,this.intervalSpanLimit=32}}class _s{constructor(t,i,s,e){this.measureEntryAdapter=t,this.timePeriodAdapter=i,this.orderAdapter=s,this.stringAdapter=e}adapt(t){const i=new Es;return at.isString(t.businessunit)&&(i.businessunit=t.businessunit),at.isArray(t.measures)&&(i.measures=rt.adaptArray(t.measures,this.measureEntryAdapter)),at.isArray(t.scenarios)&&(i.scenarios=rt.adaptArray(t.scenarios,this.stringAdapter)),at.isExisting(t.timeperiod)&&(i.timeperiod=this.timePeriodAdapter.adapt(t.timeperiod)),at.isNumber(t.intervalSpanLimit)&&(i.intervalSpanLimit=t.intervalSpanLimit),at.isExisting(t.i18nMode)&&(i.i18nMode=t.i18nMode),at.isExisting(t.order)&&(i.order=this.orderAdapter.adapt(t.order)),i}default(){return new Es}}var Ms;!function(t){t[t.UP_TO_DATE=0]="UP_TO_DATE",t[t.DIRTY=1]="DIRTY"}(Ms||(Ms={}));class ks{constructor(t){this.i18n=new Map,this.unit="",this.measures=[],this.dimension="",this.config=new Es,this.state=Ms.DIRTY,this.ruleSet=t||new vt,this.dataSetFactory=new xs,this.state=Ms.DIRTY,this.setI18n(new Map)}setI18n(t){this.state=Ms.DIRTY;const i=new Map([["SEPERATOR_WS",", "],["in","in"],["ORDER_asc","↑"],["ORDER_desc","↓"],["ac1","AC"],["pp1","PY"],["fc1","FC"],["pl1","PL"],["ac2","AC2"],["pp2","PY2"],["fc2","FC2"],["pl2","PL2"],["ac3","AC3"],["pp3","PY3"],["fc3","FC3"],["pp3","PL3"],["ac4","AC4"],["py4","PY4"],["fc4","FC4"],["pp4","PL4"],["category"," "],["operation"," "],["there_of","davon"],["part_of","in % von"],["ibcssymbol_delta_ac","Δ{%}"],["ibcssymbol_delta_generic","Δ({%})"],["ibcssymbol_delta_ac_relative","Δ{%}%"],["ibcssymbol_delta_generic_relative","Δ({%})%"],["SUM_TOTAL","❖"],["CONNECTOR_WS"," und "]]);this.i18n=new Map([...i,...t||new Map])}update(){return Ms.DIRTY===this.state&&(this.unit=this.config.businessunit,this.measures=this.dataSetFactory.createMeasures(this.config.measures,this.i18n,this.config.i18nMode),this.dimension=this.dataSetFactory.createDimension(this.config.scenarios,this.config.timeperiod,this.config.order,this.i18n,this.config.intervalSpanLimit),this.state=Ms.UP_TO_DATE),this}setConfig(t){this.config=this.initConfig(t)}initConfig(t){this.state=Ms.DIRTY;const i=t,s=this;return t.scenarios.sort(((t,i)=>s.ruleSet.getScenarioSorIndex(t)-s.ruleSet.getScenarioSorIndex(i))),i}}class Ts{constructor(t="",i=""){this.name=t,this.unit=i}}class Ps{construnctor(){}adapt(t){const i=new Ts;return at.isString(t.name)&&(i.name=t.name),at.isString(t.unit)&&(i.unit=t.unit),i}default(){return new Ts("","")}}class Ls{constructor(t=nt.now(),i=nt.now(),s=et.AUTO,e=st.AUTO){this.start=t,this.end=i,this.format=s,this.link=e}}class Cs{construnctor(){}adapt(t){const i=new Ls;return at.isDate(t.start)&&(i.start=t.start),at.isDate(t.end)&&(i.end=t.end),at.isExisting(t.format)&&(i.format=t.format),at.isExisting(t.link)&&(i.link=t.link),i}default(){return new Ls}}const Us=class{constructor(i){t(this,i),this.businessUnit="",this.scenarios=[],this.measures=[],this.intervalSpanLimit=28,this.order={hierarchy:[],direction:I.ASC},this.i18n=new Map,this.i18nMode=Q.ALL,this.title=new ks(new vt)}async setBusinessUnit(t){this.businessUnit=t}async setProps(t){Object.keys(t).forEach((i=>{this[i]=t[i]}))}render(){return i("div",{key:"08439c867ae47a9ee17ef8280801896a823c8826"},i("div",{key:"bb5b7325de2ae2f2e0bdba8d7f7f36511835efa9"},this.title.unit),i("div",{key:"3edb730c95280ca0c47db70e32dd8e471747d989"},this.title.measures.map(((t,s)=>i("span",null,this.isFirstElement(s)?this.title.i18n.get("SEPERATOR_WS"):"",i("span",{class:"measure"},t.name)," ",t.unit?this.title.i18n.get("in"):""," ",t.unit)))),i("div",{key:"3bae51f2fddef6b2195d1c24915512b6255c9a75"},this.title.dimension))}componentWillLoad(){const t=this.prepareConfig();this.title=new ks(new vt),this.title.setI18n(this.i18n),this.title.setConfig(t)}componentWillUpdate(){const t=this.prepareConfig();this.title.setI18n(this.i18n),this.title.setConfig(t)}componentWillRender(){this.title.update()}isFirstElement(t){return 0!==t}prepareConfig(){return new _s(new Ps,new Cs,new ot(new ut),new ut).adapt({businessunit:this.businessUnit,measures:this.measures,scenarios:this.scenarios,timeperiod:this.timeperiod,intervalSpanLimit:this.intervalSpanLimit,i18nMode:this.i18nMode,order:this.order})}};Us.style=':host{display:block;font-family:var(--bn-font-family, "Noto Sans", sans-serif);font-size:var(--bn-font-size, 13.3333px);color:var(--bn-font-color, #000000)}.measure{font-weight:bold}div{background-color:var(--bn-font-background, white);color:var(--bn-font-color, black)}';export{kt as bn_asset,Tt as bn_body,Pt as bn_chart_structure,Lt as bn_component_style,Ct as bn_context,pi as bn_dataset,fi as bn_datasource,vi as bn_footer,mi as bn_layout_page,gi as bn_message,yi as bn_page,Ei as bn_table,_i as bn_title,ts as ibcs_chart_structure,$s as ibcs_table,Us as ibcs_title}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{r as t,h as e,H as s,g as r}from"./p-JNHhIe7t.js";import{w as o}from"./p-CYjZRKdI.js";import{w as a}from"./p-tzFCK9qn.js";const b=class{constructor(e){t(this,e),o(this),this.errors=a(this)}render(){return e(s,{key:"ef4bc925d3e711445f9533e0b1e59a8942700283"},e("slot",{key:"c338dd99289b256bab83240cf923b23fd62b4ef1"}))}get element(){return r(this)}};export{b as bn_template}
|