@bino-bi/bn-template-engine 1.0.0-alpha.2 → 1.0.0-alpha.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (88) hide show
  1. package/dist/bn-template-engine/bn-template-engine.esm.js +1 -1
  2. package/dist/bn-template-engine/{p-a95ccc16.entry.js → p-1970906d.entry.js} +1 -1
  3. package/dist/bn-template-engine/{p-0ca8dc17.entry.js → p-1dbd339c.entry.js} +1 -1
  4. package/dist/bn-template-engine/p-2e68cf09.entry.js +1 -0
  5. package/dist/bn-template-engine/{p-bc59ea5c.entry.js → p-31cc6a2d.entry.js} +1 -1
  6. package/dist/bn-template-engine/{p--PSoPbDM.js → p-8tsCnxIz.js} +1 -1
  7. package/dist/bn-template-engine/{p-dd9dd407.entry.js → p-997b2fe4.entry.js} +1 -1
  8. package/dist/bn-template-engine/{p-DgfL-ffj.js → p-B4ySv9KQ.js} +1 -1
  9. package/dist/bn-template-engine/{p-DVo6aZUE.js → p-BL8gyUwE.js} +1 -1
  10. package/dist/bn-template-engine/{p-CvXqez4D.js → p-C0yAPzJz.js} +1 -1
  11. package/dist/bn-template-engine/p-DtdQCMzj.js +1 -0
  12. package/dist/bn-template-engine/{p-e102a490.entry.js → p-a90f1cbe.entry.js} +1 -1
  13. package/dist/bn-template-engine/{p-35638ad0.entry.js → p-d7f0cbaf.entry.js} +1 -1
  14. package/dist/bn-template-engine/{p-1d9a3be9.entry.js → p-dfb61aa5.entry.js} +1 -1
  15. package/dist/bn-template-engine/{p-f89e55c6.entry.js → p-ece17f84.entry.js} +1 -1
  16. package/dist/bn-template-engine/p-fd427179.entry.js +1 -0
  17. package/dist/bn-template-engine/p-sqjrku2z.js +1 -0
  18. package/dist/cjs/{DataFormatDigits-CbIVfGEH.js → DataFormatDigits-DAmZzqbD.js} +1 -1
  19. package/dist/cjs/{DateStringFactory-CfkXYAMN.js → DateStringFactory-CcluhpGI.js} +1 -1
  20. package/dist/cjs/{Order-DtpbD8mQ.js → Order-BKoDS21t.js} +28 -0
  21. package/dist/cjs/{SVGVariancesStyleGroup-D-rTWlDo.js → SVGVariancesStyleGroup-DYYAU-81.js} +1 -1
  22. package/dist/cjs/{StringAdapter-ByCHdlDO.js → StringAdapter-Bneo8T4k.js} +1 -1
  23. package/dist/cjs/bn-body_4.cjs.entry.js +4 -4
  24. package/dist/cjs/bn-chart-structure.cjs.entry.js +3 -3
  25. package/dist/cjs/bn-chart-time.cjs.entry.js +3 -3
  26. package/dist/cjs/bn-context_5.cjs.entry.js +115 -44
  27. package/dist/cjs/bn-grid.cjs.entry.js +3 -3
  28. package/dist/cjs/bn-image.cjs.entry.js +3 -3
  29. package/dist/cjs/bn-template-engine.cjs.js +1 -1
  30. package/dist/cjs/bn-text.cjs.entry.js +3 -3
  31. package/dist/cjs/bn-tree.cjs.entry.js +3 -3
  32. package/dist/cjs/ibcs-chart-structure.cjs.entry.js +4 -4
  33. package/dist/cjs/ibcs-chart-time.cjs.entry.js +5 -5
  34. package/dist/cjs/loader.cjs.js +1 -1
  35. package/dist/cjs/{withStyled-BBtMesx3.js → withStyled-CW30Bh6c.js} +6 -2
  36. package/dist/collection/components/bn-table/bn-table.js +63 -12
  37. package/dist/collection/components/bn-table/ibcs-table.css +7 -5
  38. package/dist/collection/components/bn-table/ibcs-table.js +22 -1
  39. package/dist/collection/components/bn-table/utils/elements/CellBarChart.js +56 -25
  40. package/dist/collection/components/bn-table/utils/elements/TableRow.js +3 -1
  41. package/dist/collection/components/bn-table/utils/factories/tableDataSetFactory.js +12 -3
  42. package/dist/collection/components/bn-table/utils/helper/ColumnStatistics.js +9 -1
  43. package/dist/collection/utils/constants.js +27 -0
  44. package/dist/collection/utils/validate.js +4 -1
  45. package/dist/components/DataFormatDigits.js +1 -1
  46. package/dist/components/DateStringFactory.js +1 -1
  47. package/dist/components/Order.js +1 -1
  48. package/dist/components/SVGVariancesStyleGroup.js +1 -1
  49. package/dist/components/bn-chart-structure.js +1 -1
  50. package/dist/components/bn-chart-time.js +1 -1
  51. package/dist/components/bn-table.js +1 -1
  52. package/dist/components/bn-title2.js +1 -1
  53. package/dist/components/ibcs-chart-structure2.js +1 -1
  54. package/dist/components/ibcs-chart-time2.js +1 -1
  55. package/dist/components/ibcs-table2.js +1 -1
  56. package/dist/components/ibcs-title2.js +1 -1
  57. package/dist/components/ibcsRuleSet.js +1 -1
  58. package/dist/components/validate.js +1 -1
  59. package/dist/esm/{DataFormatDigits-DYdbRX-1.js → DataFormatDigits--qIbKvXa.js} +1 -1
  60. package/dist/esm/{DateStringFactory-DRcbojUT.js → DateStringFactory-XWdUjsn8.js} +1 -1
  61. package/dist/esm/{Order-DdexOqTs.js → Order-sqjrku2z.js} +28 -1
  62. package/dist/esm/{SVGVariancesStyleGroup-D0Cwprv1.js → SVGVariancesStyleGroup-ibg3sLjM.js} +1 -1
  63. package/dist/esm/{StringAdapter-CTL-Dvzp.js → StringAdapter-BCLJpQQ8.js} +1 -1
  64. package/dist/esm/bn-body_4.entry.js +4 -4
  65. package/dist/esm/bn-chart-structure.entry.js +3 -3
  66. package/dist/esm/bn-chart-time.entry.js +3 -3
  67. package/dist/esm/bn-context_5.entry.js +115 -44
  68. package/dist/esm/bn-grid.entry.js +3 -3
  69. package/dist/esm/bn-image.entry.js +3 -3
  70. package/dist/esm/bn-template-engine.js +1 -1
  71. package/dist/esm/bn-text.entry.js +3 -3
  72. package/dist/esm/bn-tree.entry.js +3 -3
  73. package/dist/esm/ibcs-chart-structure.entry.js +4 -4
  74. package/dist/esm/ibcs-chart-time.entry.js +5 -5
  75. package/dist/esm/loader.js +1 -1
  76. package/dist/esm/{withStyled-DCipbf2O.js → withStyled-D1fAWJ3g.js} +6 -3
  77. package/dist/types/components/bn-table/bn-table.d.ts +11 -7
  78. package/dist/types/components/bn-table/ibcs-table.d.ts +1 -0
  79. package/dist/types/components/bn-table/utils/elements/Cell.d.ts +1 -0
  80. package/dist/types/components/bn-table/utils/elements/CellBarChart.d.ts +3 -0
  81. package/dist/types/components.d.ts +22 -2
  82. package/dist/types/utils/constants.d.ts +15 -0
  83. package/dist/types/utils/validate.d.ts +1 -0
  84. package/package.json +1 -1
  85. package/dist/bn-template-engine/p-60a7fc59.entry.js +0 -1
  86. package/dist/bn-template-engine/p-DdexOqTs.js +0 -1
  87. package/dist/bn-template-engine/p-DyRaC0MB.js +0 -1
  88. package/dist/bn-template-engine/p-d279b578.entry.js +0 -1
@@ -0,0 +1 @@
1
+ import{r as t,h as i,H as e,g as s}from"./p-JNHhIe7t.js";import{b as o,g as n,a as r}from"./p-DRikHQE-.js";import{w as a}from"./p-CYjZRKdI.js";import{w as l}from"./p-tzFCK9qn.js";import{w as h}from"./p-DG-1MR_T.js";import{j as d,w as c,v as u,a as p,p as f,i as m,q as v,f as g,r as w,e as $,s as b,t as y,c as R,d as O,u as S,g as E,x as M,y as T}from"./p-DtdQCMzj.js";import{w as U}from"./p-BSfqOkN_.js";import{w as _,g as G,p as x}from"./p-DVMu6dEy.js";import{w as C}from"./p-CRLgp9-v.js";import{h as N,O as D,a as L,I as P,j as k,M as A,B as F,T as B,e as W,d as Y,k as H}from"./p-sqjrku2z.js";import{F as I,Q as j,V as z}from"./p-1jFf17Vj.js";import{a as V}from"./p-BYmPQYxx.js";import{I as J,S as Q}from"./p-8tsCnxIz.js";import{D as q,S as K,a as Z,b as X}from"./p-BL8gyUwE.js";import"./p-B4ySv9KQ.js";import"./p-BFTU3MAI.js";const tt=class{constructor(i){t(this,i),this.currentPageUpdate=void 0,a(this),this.errors=l(this)}setLocale(t){this.stores.context.state.locale=t}connectedCallback(){this.stores=o(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 e=t.querySelector("bn-footer");e&&e.setAttribute("page-number",(i+1).toString())}}))}),250)}disconnectedCallback(){this.currentPageUpdate&&clearTimeout(this.currentPageUpdate)}componentWillLoad(){}componentDidLoad(){}componentShouldUpdate(){}componentWillRender(){}componentDidRender(){}componentWillUpdate(){}componentDidUpdate(){}render(){return i(e,{key:"b92019b909e271225baca2cf740c8301e324164e"},i("slot",{key:"87bac4bb29bca32d961afe31355dc1bd48fff0f8"}))}get element(){return s(this)}static get watchers(){return{locale:[{setLocale:0}]}}};tt.style=":host{display:block}";const it=class{constructor(i){t(this,i),a(this),this.errors=l(this),h(this,(t=>{this.stores||(this.stores=n(this.element));try{const i=JSON.parse(t);this.stores.datasources.set(this.name,i)}catch(i){console.error("Error parsing datasource",i,t),this.stores.datasources.set(this.name,[])}}))}render(){return i(e,{key:"e47e62c941bb7954cabe331cb500a7d2fdd7c487"})}get element(){return s(this)}};it.style="bn-datasource{display:none}";const et=["xga","hd","full-hd","4k","4k2k","a4","a3","a2","a1","a0","letter","legal"],st=["landscape","portrait"],ot=class{constructor(i){t(this,i),a(this),this.errors=l(this),this.componentStyle=U(this)}validateFormat(t){const i="ERR_format";d(t)||et.includes(t)?this.errors.remove(i):this.errors.addOrReplace({id:i,type:"warning",message:`format: invalid value '${t}' is not supported. Valid values: ${et.join(", ")}`})}validateOrientation(t){const i="ERR_orientation";d(t)||st.includes(t)?this.errors.remove(i):this.errors.addOrReplace({id:i,type:"warning",message:`orientation: invalid value '${t}' is not supported. Valid values: ${st.join(", ")}`})}render(){return i(e,{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 s(this)}static get watchers(){return{format:[{validateFormat:0}],orientation:[{validateOrientation:0}]}}};var nt,rt,at,lt,ht;ot.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"}(nt||(nt={})),function(t){t[t.UP_TO_DATE=0]="UP_TO_DATE",t[t.DIRTY=1]="DIRTY"}(rt||(rt={})),function(t){t.LIST="list",t.SUM="sum",t.SUMNOTOTAL="sumnototal",t.OPT="opt",t.OPTNOTOTAL="optnototal"}(at||(at={})),function(t){t.ASC="asc",t.DESC="desc"}(lt||(lt={})),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"}(ht||(ht={}));const dt=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="w30",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,c(this),a(this),this.errors=l(this),this.componentStyle=U(this),_(this,((t,i)=>{this.data=i||[]}),((t,i)=>{this.datasetMeta=i})),this.t=C(this).t}validateScenario(t){const i="ERR_scenarios",e=u(t);e.length>0?this.errors.addOrReplace({id:i,type:"warning",message:"scenarios: invalid value(s) '"+(null==e?void 0:e.toString())+"' are not supported."}):this.errors.remove(i)}validateVariances(t){const i="ERR_variances",e=p(t);e.length>0?this.errors.addOrReplace({id:i,type:"warning",message:"variances: invalid value(s) '"+JSON.stringify(e)+"' are not supported."}):this.errors.remove(i)}validateBarColumns(t){const i="ERR_barColumns";if(d(t))return void this.errors.remove(i);const e=p(t);e.length>0?this.errors.addOrReplace({id:i,type:"warning",message:"barColumns: invalid value(s) '"+JSON.stringify(e)+"' are not supported."}):this.errors.remove(i)}validateBarColumnWidth(t){const i="ERR_barColumnWidth";f(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";m(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";m(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";v(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";g(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";g(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";g(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";w(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";$(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",e=b(t);e.length>0?this.errors.addOrReplace({id:i,type:"warning",message:"ThereOf: invalid value(s) '"+JSON.stringify(e)+"' are not supported."}):this.errors.remove(i)}validatePartOf(t){const i="ERR_partof",e=y(t);e.length>0?this.errors.addOrReplace({id:i,type:"warning",message:"partof: invalid value(s) '"+JSON.stringify(e)+"' are not supported."}):this.errors.remove(i)}validateOrderList(t){const i="ERR_order",e=R(t);e.length>0?this.errors.addOrReplace({id:i,type:"warning",message:"order: invalid value(s) '"+JSON.stringify(e)+"' are not supported."}):this.errors.remove(i)}validateOrderDirection(t){const i="ERR_orderDirection";O(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";S(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";E(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";$(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";$(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";M(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=T(t),e="ERR_categorythereof";i.length>0?this.errors.addOrReplace({id:e,type:"warning",message:"columnthereof: invalid value(s) '"+JSON.stringify(i)+"' are not supported."}):this.errors.remove(e)}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(){var t,i;const{mode:e}=x(this.scale);if("auto"!==e&&"empty"!==e)return void(this._autoScaleGuard=!1);if(this._autoScaleGuard)return void(this._autoScaleGuard=!1);const s=this.element,{width:o}=G(s);if(o<=0)return;const n=this.componentStyle((t=>{var i;return(null===(i=t.global)||void 0===i?void 0:i.fontSizePx)||13.3333}));s.style.setProperty("--bn-font-size",`${n}px`);const r=null===(t=s.shadowRoot)||void 0===t?void 0:t.querySelector("div"),a=null!==(i=null==r?void 0:r.scrollWidth)&&void 0!==i?i:s.scrollWidth;if(a<=o+1)return this.errors.remove("AUTO_scale"),void(1!==this.appliedScaleFactor&&(this._autoScaleGuard=!0,this.appliedScaleFactor=1));const l=(o-1)/a;s.style.setProperty("--bn-font-size",n*l+"px"),"empty"===e?this.errors.addOrReplace({id:"AUTO_scale",type:"warning",message:`Auto-scaled table by factor ${l.toFixed(3)}`}):this.errors.remove("AUTO_scale"),Math.abs(l-this.appliedScaleFactor)>.001&&(this._autoScaleGuard=!0,this.appliedScaleFactor=l)}prepareDataFormat(){var t;return N[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 at[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,e;const s="auto"===(null===(t=this.order)||void 0===t?void 0:t.trim().toLowerCase());let o=this.order;return s&&(null===(i=this.datasetMeta)||void 0===i?void 0:i.suggestedOrder)&&(o=this.datasetMeta.suggestedOrder),{hierarchy:o.split(",").map((t=>L[null==t?void 0:t.toUpperCase()])),direction:D[null===(e=this.orderDirection)||void 0===e?void 0:e.toUpperCase()]}}prepareI18nMode(){return P.META}prepareI18n(){const t=r,i=new Map(["in","category","operation","there_of","part_of","SUM_TOTAL"].map((t=>[t,this.t(".".concat(t))]))),e=new Map(t.map((t=>[t,this.t("global.".concat(t))])));return new Map([...e.entries(),...i.entries()])}prepareDataFormatDigits(){return{percent:this.dataFormatDigitsPercent,decimal:this.dataFormatDigitsDecimal}}prepareScenarios(){var t,i,e,s,o,n,r,a;const l="auto"===(null===(t=this.scenarios)||void 0===t?void 0:t.trim().toLowerCase());if((d(this.scenarios)||l)&&d(this.variances))return(null===(e=null===(i=this.datasetMeta)||void 0===i?void 0:i.availableScenarios)||void 0===e?void 0:e.length)>0?(l?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 h=[];return l||d(this.scenarios)?(null===(o=null===(s=this.datasetMeta)||void 0===s?void 0:s.availableScenarios)||void 0===o?void 0:o.length)>0&&(l?this.errors.remove("AUTO_scenarios"):this.errors.addOrReplace({id:"AUTO_scenarios",type:"warning",message:`scenarios: not set, auto-detected: ${this.datasetMeta.availableScenarios.join(",")}`}),h=h.concat(this.datasetMeta.availableScenarios)):(this.errors.remove("AUTO_scenarios"),h=h.concat(null===(n=this.scenarios)||void 0===n?void 0:n.split(","))),(null===(r=this.variances)||void 0===r?void 0:r.trim().length)>0&&(h=h.concat(null===(a=this.variances)||void 0===a?void 0:a.split(","))),h.map((t=>t.trim()))}prepareCategoryWidth(){var t;return d(this.categoryWidth)?k.INF:k[null===(t=this.categoryWidth)||void 0===t?void 0:t.toUpperCase()]}prepareMeasureScale(){return d(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 d(this.measureType)?A.VOLUME:A[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[e,s]of Object.entries(t))!1===i.has(s.scenario)&&i.set(s.scenario,[]),i.get(s.scenario).push(s);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(),e=B[i];return e?F[e]:F[B.W30]}prepareBarColumns(){return d(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}=x(this.scale);return"factor"===t?i:"auto"===t||"empty"===t?this.appliedScaleFactor:1}getFontStyles(){const t=this.getEffectiveScaleFactor();return this.componentStyle((i=>{var e,s,o,n;const r=(null===(e=i.global)||void 0===e?void 0:e.fontSizePx)||13.3333;return{"--bn-font-family":(null===(s=i.global)||void 0===s?void 0:s.fontFamily)||"'Noto Sans', sans-serif","--bn-font-size":r*t+"px","--bn-font-color":(null===(o=i.global)||void 0===o?void 0:o.fontColor)||"#000000","--bn-font-background":(null===(n=i.global)||void 0===n?void 0:n.fontBackgroundColor)||"#ffffff"}}))}render(){const t=this.getFontStyles(),s=this.getEffectiveScaleFactor();return i(e,{key:"b379c18d4d92805e91404917ffb096e582b9bec2",style:t},i("div",{key:"a45679a84d85b856f0e01615952c0ccfe05108f9"},i("ibcs-table",{key:"0b375fca9ab9422bc61a4d0ba75eaf30eedfa77d",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:s})))}get element(){return s(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}]}}};dt.style=":host{display:inline-block;position:relative;overflow:hidden}";class ct{constructor(t,i,e,s,o,n,r,a,l){this.prefixStyle="prefix",this.isBarChart=!1,this.key=t,this.index=i,this.value=e,this.prefix=n||"",this.cssStyle=s||"",this.prefixStyle=r||"prefix",this.type=o,this.mark=void 0,this.colSpan=a||1,this.measureScale=l||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 e=t.percent,s=t.percent;return"decimal"===this.type&&(i=+i/this.measureScale,e=t.decimal,s=t.decimal),I.number(Number(i),this.type,e,s)}drawPrefix(){return null==this.prefix?"":this.prefix}}class ut{constructor(t,i,e){this.index=t,this.groupindex=i,this.type=e,this.cssStyle=this.initCssStyle(),this.elements=[]}initCssStyle(){switch(this.type){case ht.HEADER:return"groupheader";case ht.SEPERATORLINE:return"";case ht.DRILLELEMENT:return"ofit";case ht.PARTELEMENT:return"partof";case ht.STANDARD:return"";case ht.SUM:return"sum";default:return""}}getCells(){return this.elements}createElement(t,i,e,s,o,n,r,a,l,h=!1,d){let c=n;"category"===i&&null!=a&&(c=`category-${a.toString()}`),this.type===ht.HEADER?c="headerlabel":this.type===ht.SEPERATORLINE&&(c=i),this.type===ht.PARTELEMENT&&("percent"===s&&(t="-"),"category"!==i&&"operation"!==i&&(s="percent",c="")),"-"===t&&(c="");let u="prefix-first";r&&(u="prefix-second"),e&&(c=`${c} ${e}`);const p=new ct(i,this.elements.length,t,c,s,o,u,1,l);p.isBarChart=h,p.columnStats=d,this.elements.push(p)}}const pt={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},ft="#666666";function mt(t,i){return`pattern-${t}-${i.replace("#","")}`}const vt=({styles:t})=>{const e=t.scaleFactor,s=6*e,o=[{id:mt("pos",t.positive.stroke),stroke:t.positive.stroke,fill:t.positive.fill},{id:mt("neg",t.negative.stroke),stroke:t.negative.stroke,fill:t.negative.fill},{id:mt("neu",t.neutral.stroke),stroke:t.neutral.stroke,fill:t.neutral.fill}];return i("defs",null,o.map((t=>i("pattern",{id:t.id,patternUnits:"userSpaceOnUse",width:s,height:s},i("rect",{width:s,height:s,fill:"#ffffff"}),i("line",{x1:"0",y1:s,x2:s,y2:"0",stroke:t.stroke,"stroke-width":1.5*e})))))};function gt(t,i,e=1){let s,o;const n=t>=0?"+":"";if(i)return s=100*t,n+Math.round(s).toString()+"%";{let i;return s=t/e,o=Math.abs(s),i=o>=1e9?(s/1e9).toFixed(o>=1e10?0:1)+"B":o>=1e6?(s/1e6).toFixed(o>=1e7?0:1)+"M":o>=1e3?(s/1e3).toFixed(o>=1e4?0:1)+"K":s.toFixed(o>=10?0:1),i=i.replace(/\.0([KMB]?)$/,"$1"),n+i}}function wt(t){const i=t.slice(0,2).toLowerCase();return["ac","pp","fc","pl"].includes(i)}function $t(t){const i=t.slice(0,2).toLowerCase();return"pp"===i?"pp":"fc"===i?"fc":"pl"===i?"pl":"ac"}function bt(t,i,e,s){return wt(t)?function(t,i){const e=$t(t);return i.scenarios[e]}(t,s):function(t,i,e){const s=t>=0;return i?s?e.positive:e.negative:s?e.negative:e.positive}(i,e,s)}function yt(t){return t.median<=0?t.absMax:Math.min(3*t.median,t.absMax)}const Rt=t=>{const{value:e,scenario:s,columnStats:o,height:n,isPositiveGood:r,formattedValue:a,measureScale:l,maxBarWidth:h=3,styles:d=pt}=t,c=d.scaleFactor,u=38*c,p=h*d.fontSize*c,f=o.min<0,m=o.max>0,v=f?p:0,g=(f?u:0)+(v+(m?p:0))+(m?u:0),w=2*c,$=n-2*w,b=(f?u:0)+v,y=yt(o),R=Math.abs(e),O=R>y,S=Math.min(y>0?R/y:0,1)*p,E=e>=0,M=E?b:b-S,T=w,U=bt(s,e,r,d),_=function(t,i){const e=t.fillpattern;return"hatched"===e?`url(#${mt(i,t.stroke)})`:"outlined"===e?"transparent":t.fill}(U,wt(s)?$t(s):r?E?"pos":"neg":E?"neg":"pos"),{stroke:G,strokeWidth:x}="outlined"===(C=U).fillpattern?{stroke:C.stroke,strokeWidth:1.5}:{stroke:"none",strokeWidth:0};var C;const N=a||gt(e,!1,l),D=E?b+S+4*c:b-S-4*c,L=E?"start":"end",P=n/2;return i("svg",{width:g,height:n,class:"cell-bar-chart absolute-variance",style:{overflow:"visible"}},i(vt,{styles:d}),i("line",{x1:b,y1:0,x2:b,y2:n,stroke:ft,"stroke-width":1*c}),S>0&&i("rect",{x:M,y:T,width:S,height:$,fill:_,stroke:G,"stroke-width":x*c}),O&&E&&i("polygon",{points:`${b+p},${P} ${b+p-6*c},${P-3*c} ${b+p-6*c},${P+3*c}`,fill:"transparent"===U.fill?U.stroke:U.fill}),O&&!E&&i("polygon",{points:`${b-p},${P} ${b-p+6*c},${P-3*c} ${b-p+6*c},${P+3*c}`,fill:"transparent"===U.fill?U.stroke:U.fill}),i("text",{x:D,y:n/2,dy:"0.35em","text-anchor":L,fill:d.fontColor,"font-size":d.fontSize,"font-family":d.fontFamily},N))},Ot=t=>{const{value:e,scenario:s,columnStats:o,height:n,isPositiveGood:r,formattedValue:a,measureScale:l,maxBarWidth:h=3,styles:d=pt}=t,c=d.scaleFactor,u=Math.round(.67*h*d.fontSize)*c,p=5*c,f=o.min<0?u+p:0,m=f+(o.max>0?u+p:0),v=m+45*c,g=f,w=n/2,$=yt(o),b=Math.abs(e),y=b>$,R=Math.min($>0?b/$:0,1)*u,O=e>=0,S=O?g+R:g-R,E=bt(s,e,r,d),M=3*c,T=a||gt(e,!0,l),U=m+4*c;return i("svg",{width:v,height:n,class:"cell-bar-chart relative-variance",style:{overflow:"visible"}},i("line",{x1:g,y1:0,x2:g,y2:n,stroke:ft,"stroke-width":1*c}),!y&&i("circle",{cx:S,cy:w,r:M,fill:d.fontColor}),i("line",{x1:g,y1:w,x2:S,y2:w,stroke:E.fill,"stroke-width":2*c}),y&&O&&i("polygon",{points:`${g+u},${w} ${g+u-6*c},${w-3*c} ${g+u-6*c},${w+3*c}`,fill:E.fill}),y&&!O&&i("polygon",{points:`${g-u},${w} ${g-u+6*c},${w-3*c} ${g-u+6*c},${w+3*c}`,fill:E.fill}),i("text",{x:U,y:n/2,dy:"0.35em","text-anchor":"start",fill:d.fontColor,"font-size":d.fontSize,"font-style":"italic","font-family":d.fontFamily},T))},St=t=>{const{value:e,columnStats:s,isRelative:o,styles:n=pt}=t;return null==e||isNaN(e)||!s||0===s.absMax?i("span",{class:"bar-chart-empty",style:{color:n.fontColor,fontStyle:"italic"}},"-"):i(o?Ot:Rt,Object.assign({},t))};class Et{constructor(t){V.fn.transformOperator=function(t){return"-"===t?-1:1},this.groups=[j.CATEGORY,j.CATEGORYINDEX],at.OPT!==t.type&&at.OPTNOTOTAL!==t.type||this.groups.unshift(j.OPERATION),t.grouped&&(this.groups.push(j.ROWGROUP),this.groups.push(j.ROWGROUPINDEX))}toString(){return this.groups.map((t=>`${t}`)).toString()}noCategory(){return this.groups.filter((t=>t!==j.CATEGORY))}toArray(){return this.groups}}class Mt{constructor(t,i){this.hasPartOf=!1,this.config=t,this.i18n=i}execute(t){if(0===t.length)return[];const i=[],e=[],s=[],o=this.config.scenarios.map((t=>this.translateScenarioSQL(t,!1,this.config.type))).toString(),n=this.config.scenarios.map((t=>this.translateScenarioSQL(t,!0,this.config.type))).toString(),r=this.getRelativeScenarios(),a=new Et(this.config),l=this.config.grouped?[j.ROWGROUP,j.ROWGROUPINDEX]:[];let h=["",""];return this.config.sortOrder.hierarchy.length>0&&(h=this.createOrderString(this.config.sortOrder)),this.hasPartOf=this.checkConfigForPartOf(),V(`SELECT COUNT(DISTINCT ${j.CATEGORY}) as ${j.TOTALROWCOUNT} ${l.length>0?","+l:""}\n FROM ? ${l.length>0?"GROUP BY "+l:""} \n ORDER BY ${h[0]}`,[t]).forEach((t=>{const s=t.rowGroup&&t.rowGroup.length>0?`WHERE ${j.ROWGROUP} = '${t.rowGroup}'`:"";let r="";this.config.limit&&(r=`LIMIT ${this.config.limit}`),this.createGroupHeaderRow(t,i),this.createDataRow(i,t,a,o,s,h,r),this.createRestRow(t,i,a,o,s,h),this.createGroupSumRow(i,e,t,n,h)})),this.createTotalSumRow(i,e,n),i.forEach((i=>{try{s.push(V(i,[t]))}catch(t){console.error("DataQuery: SQL query execution failed",i,t)}})),this.detectNaNCells(this.config.scenarios,s),this.createThereOfDrillRows(o,h,t,s),this.createPartOfDrillRows(o,h,e,t,s),this.createThereOfDrillColumns(this.config.categoryThereOf,t,s),this.calculateColumnGroupRest(s,this.config.categoryThereOf),this.calculateRelativeVariances(s,r),s}detectNaNCells(t,i){i.forEach((i=>{i.map((i=>(t.forEach((t=>{const e=new z(t);!0===e.isValid?0!==i[e.base+"_cnt"]&&0!==i[e.delta+"_cnt"]||(i[t]=Number.NaN):0===i[t+"_cnt"]&&(i[t]=Number.NaN)})),i)))}))}createPartOfDrillRows(t,i,e,s,o){if(null==this.config.partOf||0===this.config.partOf.length||this.config.type===at.LIST||null==s||0===s.length)return;const n=this.createPartOfQuery(t,i);let r=[];n.forEach((function(t){r.push(...V(t,[s]))}));const a=this.exctractScenarioNames(t),l=[];e.forEach((function(t){l.push(...V(t,[s]))}));const h=new Map;l.forEach((t=>h.set(t[j.ROWGROUP],t))),r=this.reduceResDrillByCategoryGroups(r,a),r.forEach((function(t){a.forEach((i=>{try{t[i]=t[i]/h.get(t[j.ROWGROUP])[i]}catch(e){console.error("DataQuery: partOf drill row calculation failed",i,e),t[i]=Number.NaN}}))})),this.injectDrillRowsToResultRows(r,o)}createRestRow(t,i,e,s,o,n){t.totalRowCnt-this.config.limit>0&&0!==this.config.limit&&i.push(`SELECT ${j.ROWNR}, 1 as ${j.ROWGROUPINDEX} , 'ENTRY' as ${j.TYPE}, 'NO_GROUP' as ${j.ROWGROUP}, 'REST' as ${j.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 ${j.ROWNR}, ${i.length} as ${j.ROWGROUPINDEX} , 'ENTRY' as ${j.TYPE}, '${t.rowGroup||"NO_GROUP"}' as ${j.ROWGROUP}, ${e} ${s.length>0?",".concat(s):""} FROM ? ${o} GROUP BY ${e} ORDER BY ${n[0]}) t WHERE t.rowNr > ${this.config.limit}`)}createDataRow(t,i,e,s,o,n,r){t.push(`SELECT ROWNUM() AS ${j.ROWNR},\n ${t.length} as ${j.ROWGROUPINDEX},\n 'ENTRY' as ${j.TYPE},\n '${i.rowGroup||"NO_GROUP"}' as ${j.ROWGROUP},\n '${j.CATEGORYINDEX}',\n ${e} ${s.length>0?",".concat(s):""}\n FROM ? ${o}\n GROUP BY ${e}\n ORDER BY ${n[0]} ${r}`)}createGroupHeaderRow(t,i){!0===this.config.grouped&&i.push(`SELECT ROWNUM() AS ${j.ROWNR},\n ${i.length} as ${j.ROWGROUPINDEX},\n 'GROUPHEAD' as ${j.TYPE},\n '${t.rowGroup}' as ${j.ROWGROUP} ${this.config.showGroupTitle?`,'${t.rowGroup}' as ${j.CATEGORY}`:""}\n FROM ?\n GROUP BY '1'`)}createGroupSumRow(t,i,e,s,o){!0!==this.config.grouped||at.SUM!==this.config.type&&at.SUMNOTOTAL!==this.config.type&&at.OPT!==this.config.type&&at.OPTNOTOTAL!==this.config.type||(t.push(`SELECT ${t.length} as ${j.ROWGROUPINDEX},\n '=' as ${j.OPERATION},\n '${e.rowGroup}' as ${j.ROWGROUP},\n ROWNUM() AS ${j.ROWNR},\n 'GROUP_SUM' as ${j.TYPE} ${s.length>0?",".concat(s):""}\n FROM ?\n WHERE ${j.ROWGROUP} = '${e.rowGroup}'\n ORDER BY ${o[0]} `),i.push(`SELECT ${t.length} as ${j.ROWGROUPINDEX},\n '=' as ${j.OPERATION},\n '${e.rowGroup}' as ${j.ROWGROUP},\n ROWNUM() AS ${j.ROWNR},\n 'GROUP_SUM' as ${j.TYPE} ${s.length>0?",".concat(s):""}\n FROM ?\n WHERE ${j.ROWGROUP} = '${e.rowGroup}'\n ORDER BY ${o[0]} `))}createTotalSumRow(t,i,e){if(at.SUM===this.config.type||at.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 ${j.ROWGROUPINDEX},\n '${i}' as ${j.ROWGROUP},\n '=' as ${j.OPERATION},\n 'SUM' as ${j.TYPE} ${e.length>0?",".concat(e):""}\n FROM ? `)}i.push(`SELECT ${t.length} as ${j.ROWGROUPINDEX},\n 'SUM_TOTAL' as ${j.ROWGROUP},\n '=' as ${j.OPERATION},\n 'SUM' as ${j.TYPE} ${e.length>0?",".concat(e):""}\n FROM ? `)}reduceResDrillByCategoryGroups(t,i){const e=new Map;return t.forEach((function(t){const s=t.rowNr+t.rowGroup+t.type+t.category;if(e.has(s)){const o=e.get(s);i.forEach((i=>{try{o[i]+=t[i]}catch(t){console.error("DataQuery: drill row aggregation failed",i,t)}}))}else e.set(s,t)})),[...e.values()]}injectDrillRowsToResultRows(t,i){const e=new Map;if(!0===this.config.grouped)t.forEach((function(t){i.forEach((function(i){const s=i.findIndex((i=>i.category===t.category&&i.rowGroup===t.rowGroup));if(s>=0){if(e.has(`${t.category}_${t.rowGroup}`)){const i=e.get(`${t.category}_${t.rowGroup}`)||0;e.set(`${t.category}_${t.rowGroup}`,i+1)}else e.set(`${t.category}_${t.rowGroup}`,1);t[j.ROWNR]=e.get(`${t.category}_${t.rowGroup}`),i.splice(s+t[j.ROWNR],0,t)}}))}));else{const s=this.findDuplicateSubCategories(t);t.forEach((function(t){i.forEach((function(i){const o=i.findIndex((i=>null!=i.category&&i.category===t.category));if(o>=0){if(e.has(`${t.category}`)){const i=e.get(`${t.category}`)||0;e.set(`${t.category}`,i+1)}else e.set(`${t.category}`,1);(1===t[j.ROWNR]||s.includes(t.subCategory))&&(t.subCategory=`${t.subCategory} (${t.rowGroup})`),i.splice(o+t[j.ROWNR],0,t)}}))}))}}createThereOfDrillRows(t,i,e,s){if(void 0===this.config.thereOf||0===this.config.thereOf.length)return;const o=[],n=[];this.config.thereOf.forEach((e=>{let s=!0,n="1 <> 1 OR ( ";null!=e.category&&0!==e.category.length&&e.category.trim()&&(n+=` ${j.CATEGORY} = '${e.category}'`,s=!1),null!=e.rowGroup&&0!==e.rowGroup.length&&e.rowGroup.trim()&&(n+=` ${s?"":"AND"} ${j.ROWGROUP} = '${e.rowGroup}'`,s=!1),null!=e.subCategory&&0!==e.subCategory.length&&e.subCategory.trim()&&(n+=` ${s?"":"AND"} ${j.SUBCATEGORY} = '${e.subCategory}'`),n+=")",o.push(`SELECT ROWNUM() AS ${j.ROWNR},\n null as operation,\n 'DRILLELEMENT' as ${j.TYPE},\n ${j.CATEGORY},\n ${j.SUBCATEGORY},\n ${j.ROWGROUP} as ${j.ROWGROUP},\n ${t}\n FROM ?\n WHERE ${n}\n GROUP BY ${j.ROWGROUP}, ${j.CATEGORY}, ${j.SUBCATEGORY}\n ORDER BY ${i[1]}`)})),o.forEach((function(t){n.push(...V(t,[e]))})),this.injectDrillRowsToResultRows(n,s)}calculateRelativeVariances(t,i){t.forEach((t=>{t.forEach((t=>{"GROUPHEAD"!==t[j.TYPE]&&i.forEach(((i,e)=>{t[e]=t[e]/t[i]}))}))}))}calculateColumnGroupRest(t,i){if(null==i||0===i.size)return;const e=new Map,s=new Map;i.forEach(((t,i)=>{const o=t,n=[];for(const t of o)n.push(`${i}##${t.name}`);e.set(i,n),s.set(`${i}##REST`,!1)})),t.forEach((t=>{t.forEach((t=>{"GROUPHEAD"!==t[j.TYPE]&&e.forEach(((i,e)=>{let o=0;i.forEach((i=>{void 0!==t[i]&&(o+=t[i])})),t[`${e}##REST`]=t[e]-o,0!==t[`${e}##REST`]&&s.set(`${e}##REST`,!0)}))}))}));const o=Array.from(s.entries()).filter((([t,i])=>!i)).map((([t])=>t));t.forEach((t=>{t.forEach((t=>{for(const i of o)delete t[i]}))}))}getRelativeScenarios(){const t=new Map;return this.config.scenarios.forEach((i=>{const e=this.createRelativeScenario(i);null!=e&&t.set(e.key,e.value)})),t}translateScenarioSQL(t,i,e){const s=new z(t);return at.OPT===e||at.OPTNOTOTAL===e?s.isValid?"dr"===s.type?`SUM(${s.base} - ${s.delta}) as ${t}, SUM(${s.delta}) as dr_${s.delta}`:`SUM(${s.base} - ${s.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`:s.isValid?"dr"===s.type?`SUM((${s.base} * transformOperator(operation)) - (${s.delta} * transformOperator(operation))) as ${t}, SUM(${s.delta} * transformOperator(operation)) as dr_${s.delta}`:`SUM((${s.base} * transformOperator(operation))- (${s.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()} ${lt.ASC===t.direction?lt.DESC:lt.ASC}`]}createRelativeScenario(t){const i=new z(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 e;const s=[];let o="1 <> 1 ",n=` ${j.ROWGROUP}`,r="ROWNUM()";return null===(e=this.config.partOf)||void 0===e||e.forEach((t=>{o+=`OR (${j.CATEGORY} = '${t.category}'`,null!=t.rowGroup&&0!==t.rowGroup.length&&t.rowGroup.trim()&&(o+=`and ${j.ROWGROUP} = '${t.rowGroup}'`),!1===this.config.grouped&&(n=` 'SUM_TOTAL' as ${j.ROWGROUP} `,r="1"),o+=")"})),s.push(`SELECT ${r} AS ${j.ROWNR},\n 'PARTELEMENT' as ${j.TYPE},\n ${j.CATEGORY},\n ${n},\n ${t}\n FROM ?\n WHERE ${o}\n GROUP BY ${j.ROWGROUP}, ${j.CATEGORY}, ${j.TYPE}\n ORDER BY ${i[1]}`),s}checkConfigForPartOf(){return null!=this.config.partOf&&0!==this.config.partOf.length}createThereOfDrillColumns(t,i,e){if(null==t||0===t.size)return;const s=[],o=[];t.forEach(((t,i)=>{let e="1 <> 1 ";t.forEach((t=>{e+=` or columnGroup = '${t.name}' `})),s.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 ${e}\n GROUP BY rowlevel, rowGroup, category, columnGroup, scenario`),s.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 ${e}\n GROUP BY rowlevel, rowGroup, category, columnGroup, columnSubGroup, scenario`),s.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 ${e}\n GROUP BY rowlevel, rowGroup, category, subCategory, columnGroup, scenario`),s.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 ${e}\n GROUP BY rowlevel, rowGroup, category, subCategory, columnGroup, columnSubGroup, scenario`),s.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 ${e}\n GROUP BY rowlevel, rowGroup, columnGroup, scenario`),s.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 ${e}\n GROUP BY rowlevel, rowGroup, columnGroup, columnSubGroup, scenario`),s.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 ${e}\n GROUP BY rowlevel, columnGroup, scenario`),s.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 ${e}\n GROUP BY rowlevel, columnGroup, columnSubGroup, scenario`)}));for(const t of s)o.push(...V(t,[i]));this.injectDrillColumnsToResultRows(o,e)}injectDrillColumnsToResultRows(t,i){const e="##";for(const s of t)for(const t of i)for(const i of t)i.type===s.rowlevel&&("ENTRY"===s.rowlevel?"COLUMNGROUP"===s.columnlevel&&i.category===s.category?i[s.scenario+e+s.columnGroup]=s.val:"SUBGROUP"===s.columnlevel&&i.category===s.category&&(i[s.scenario+e+s.columnGroup+e+s.columnSubGroup]=s.val):"DRILLELEMENT"===s.rowlevel?"COLUMNGROUP"===s.columnlevel&&i.category===s.category&&i.subCategory===s.subCategory?i[s.scenario+e+s.columnGroup]=s.val:"SUBGROUP"===s.columnlevel&&i.category===s.category&&i.subCategory===s.subCategory?i[s.scenario+e+s.columnGroup+e+s.columnSubGroup]=s.val:"COLUMNGROUP"===s.columnlevel&&i.category===s.category&&i.subCategory===`${s.subCategory} (${s.rowGroup})`?i[s.scenario+e+s.columnGroup]=s.val:"SUBGROUP"===s.columnlevel&&i.category===s.category&&i.subCategory===`${s.subCategory} (${s.rowGroup})`&&(i[s.scenario+e+s.columnGroup+e+s.columnSubGroup]=s.val):("SUM"===s.rowlevel||"GROUP_SUM"===s.rowlevel)&&("COLUMNGROUP"===s.columnlevel&&i.category===s.category&&i.subCategory===s.subCategory&&(i[s.scenario+e+s.columnGroup]=s.val),"SUBGROUP"===s.columnlevel&&i.category===s.category&&i.subCategory===s.subCategory&&(i[s.scenario+e+s.columnGroup+e+s.columnSubGroup]=s.val)))}}class Tt{constructor(){this.normalizedHeader=[]}createHeader(t,i,e,s,o,n){const r=[];this.normalizedHeader=this.normalizeHeader(t,i);const a=new ut(0,0,ht.HEADER),l=new ut(1,0,ht.SEPERATORLINE);for(const t of this.normalizedHeader)a.createElement(I.translateScenarioLabel(t.name,e),t.type,this.createColumnType(t),null,this.setHeaderPrefix(t,e,s,o,n),null,null,null,null),l.createElement(null,t.type,this.createColumnType(t),null,null,null,null,null,null);return r.push(a),r.push(l),r}setHeaderPrefix(t,i,e,s,o){let n="";return"category"===t.name&&o&&(0===e.prefix.length&&0===s.length||(n=I.translateScenarioLabel("in",i)+" "+e.prefix+s)),t.order&&(n+=I.translateScenarioLabel("ORDER_"+t.order,i)),n}normalizeHeader(t,i){let e=[{name:j.CATEGORY,group:j.CATEGORY,type:j.CATEGORY,order:void 0}];return at.OPT!==t&&at.OPTNOTOTAL!==t||(e=[{name:j.OPERATION,group:j.OPERATION,type:j.OPERATION,order:void 0},{name:j.CATEGORY,group:j.CATEGORY,type:j.CATEGORY,order:void 0}]),[...e,...i]}createBodyRows(t,i,e){const s=[];let o=-1;const n=new Mt(t,i).execute(e),r=this.calculateColumnStatistics(n,t.barColumns);for(const e of n)o+=1,s.push(...this.createRow(t.i18n,i,t.scenariosUnitType,e,o,-1,t.categoryWidth,t.measureScale,t.barColumns,r));return s}calculateColumnStatistics(t,i){const e=new Map;if(!i||0===i.length)return e;const s=new Map;for(const t of i)e.set(t,{min:1/0,max:-1/0,absMax:0,median:0}),s.set(t,[]);for(const o of t)for(const t of o)for(const o of i){const i=this.extractColumnValue(t,o);if(null!==i&&!isNaN(i)){const t=e.get(o);t.min=Math.min(t.min,i),t.max=Math.max(t.max,i),s.get(o).push(Math.abs(i))}}for(const[t,i]of e){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 o=s.get(t);if(o.length>0){o.sort(((t,i)=>t-i));const t=Math.floor(o.length/2);i.median=o.length%2==0?(o[t-1]+o[t])/2:o[t]}e.set(t,i)}return e}extractColumnValue(t,i){if(void 0!==t[i]){const e=Number(t[i]);return isNaN(e)?null:e}for(const e of Object.keys(t))if(e===i||e.endsWith("##"+i)||e===i+"##"+i){const i=Number(t[e]);if(!isNaN(i))return i}return null}createRow(t,i,e,s,o,n,r,a,l,h){var d;const c=[];for(const u of s){const p=u[j.ROWGROUP],f=u[j.SUBCATEGORY],m=u[j.TYPE],v=u[j.ROWNR]>=2,g=this.createDetailRow(m,n+=1,o,s.length);for(const s of this.normalizedHeader){const o=this.getRawDataRowElement(u,s),n=null!==(d=null==l?void 0:l.includes(s.type))&&void 0!==d&&d,c=n?null==h?void 0:h.get(s.type):void 0;g.createElement(this.translateSumCellLabel(t,i,o,p,f,m,s.type),s.type,this.createColumnType(s),this.setCellType(s.type,e),this.translateCellPrefix(i,m,s.type),this.translateScenarioCSS(s.type,o),v,r,null==a?void 0:a.value,n,c)}c.push(g)}return c}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,e,s){switch(t){case ht.GROUPHEAD:return new ut(i,e,ht.HEADER);case ht.SUM:case ht.GROUPSUM:return new ut(s+2,e,ht.SUM);case ht.DRILLELEMENT:return new ut(s+2,e,ht.DRILLELEMENT);case ht.PARTELEMENT:return new ut(s+2,e,ht.PARTELEMENT);default:return new ut(i,e,ht.STANDARD)}}translateSumCellLabel(t,i,e,s,o,n,r){return!1===Number.isNaN(Number(e))||this.isOperationColumn(r)?e:this.isGroupHeadCategory(n,r)||this.isEntryCategory(n,r)?t===P.ALL?`${i.get(e)||e}`:e:this.isDrillElementCategory(n,r)?t===P.ALL?`${i.get(o)||o}`:`${o}`:this.isPartElementCategory(n,r)?t===P.ALL||"SUM_TOTAL"===s?`${i.get(s)||s}`:`${s}`:this.isSumElementCategory(n,r)?t===P.ALL||"SUM_TOTAL"===s?`${i.get(s)||s}`:s:"GROUPHEAD"===n&&null==e?e:Number.isNaN(Number(e))?"-":Number(e)}isOperationColumn(t){return"operation"===t}translateScenarioCSS(t,i){const e=new z(t);let s="pos";return i<0&&(s="neg"),e.isValid?s+"_"+e.direction+("dr"===e.type?" relative_variance":""):t}setCellType(t,i){if("category"===t)return"";let e;const s=new z(t);return i===N.PERCENT?(e="percent",s.isValid&&"d"===s.type&&(e="decimal")):(e="decimal",s.isValid&&"dr"===s.type&&(e="percent")),e}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,e){return this.isOperationColumn(e)||this.isGroupHeadCategory(i,e)||this.isEntryCategory(i,e)?null:this.isDrillElementCategory(i,e)?`${t.get("there_of")} `:this.isPartElementCategory(i,e)?`${t.get("part_of")} `:null}createColumnType(t){return t.name===t.group&&t.name===t.type?"base":t.name===t.group?"columnGroup":"columnSubGroup"}}class Ut{constructor(t,i,e){this.data=[],this.headerRows=[],this.bodyRows=[],this.ruleSet=t||new J,this.dataSetFactory=new Tt,this.config=this.initConfig(e),this.i18n=this.initI18n(new Map),this.setData(i,e.filter),this.state=rt.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=rt.DIRTY,new Map([...i,...t||new Map])}initConfig(t){this.state=rt.DIRTY;const i=t,e=this;return t.scenarios.sort(((t,i)=>e.ruleSet.getScenarioSorIndex(t)-e.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=V(`SELECT * FROM ? WHERE ${i}`,[t])}catch(e){console.error("Table: filter query failed, using unfiltered data",i,e),this.data=t}else this.data=t;const e=this.normalizeScenarios(this.config.scenarios,this.config.categoryThereOf,this.config.sortOrder);this.headerRows=this.dataSetFactory.createHeader(this.config.type,e,this.i18n,this.config.measureScale,this.config.measureUnit,this.config.showMeasureScale),this.bodyRows=this.dataSetFactory.createBodyRows(this.config,this.i18n,this.data),this.state=rt.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=rt.UP_TO_DATE}getHeader(){return this.state===rt.DIRTY&&this.update(),this.headerRows}getBody(){return this.state===rt.DIRTY&&this.update(),this.bodyRows}normalizeScenarios(t,i,e){var s;const o=[];for(const n of t){if(null==i?void 0:i.has(n)){const t=i.get(n);for(const i of t){o.push({name:i.name,group:i.name,type:n,order:void 0});for(const t of i.subGroups)o.push({name:t,group:i.name,type:n,order:void 0})}o.push({name:"REST",group:"REST",type:n,order:void 0})}let t;(null===(s=null==e?void 0:e.hierarchy)||void 0===s?void 0:s.at(0))===n&&(t=e.direction),o.push({name:n,group:n,type:n,order:t})}return o}hasNoData(){return 0===this.data.length}}class _t{constructor(){this.title="",this.scenarios=[],this.scenariosUnitType=N.DECIMAL,this.grouped=!1,this.showGroupTitle=!0,this.thereOf=[],this.categoryThereOf=new Map,this.partOf=[],this.sortOrder=new H(new Q).default(),this.type=at.LIST,this.limit=0,this.i18n=P.ALL,this.categoryWidth=k.W25,this.measureScale=new K,this.measureUnit="",this.measureType=A.VOLUME,this.showMeasureScale=!0,this.filter="",this.barColumns=[]}}class Gt{constructor(t,i,e,s){this.tableDrillGroupAdapter=t,this.stringAdapter=i,this.orderAdapter=e,this.dataSet=s}adapt(t){const i=new _t;return W.isString(t.title)&&(i.title=t.title),W.isArray(t.scenarios)&&(i.scenarios=Y.adaptArray(t.scenarios,this.stringAdapter)),W.isExisting(t.scenariosUnitType)&&(i.scenariosUnitType=t.scenariosUnitType),W.isBoolean(t.grouped)&&(i.grouped=t.grouped),W.isBoolean(t.showGroupTitle)&&(i.showGroupTitle=t.showGroupTitle),W.isBoolean(t.showMeasureScale)&&(i.showMeasureScale=t.showMeasureScale),W.isArray(t.thereOf)&&(i.thereOf=Y.adaptArray(t.thereOf,this.tableDrillGroupAdapter)),W.isExisting(t.categoryThereOf)&&(i.categoryThereOf=t.categoryThereOf),W.isArray(t.partOf)&&(i.partOf=Y.adaptArray(t.partOf,this.tableDrillGroupAdapter)),W.isExisting(t.order)&&(i.sortOrder=this.orderAdapter.adapt(t.order)),W.isExisting(t.type)&&(i.type=t.type),W.isNumber(t.limit)&&(i.limit=t.limit),W.isExisting(t.i18n)&&(i.i18n=t.i18n),W.isExisting(t.categoryWidth)&&(i.categoryWidth=t.categoryWidth),W.isExisting(t.measureScale)&&(i.measureScale=q.calculateMeasureScale(this.dataSet,i.scenarios,t.measureScale)),W.isExisting(t.measureType)&&(i.measureType=t.measureType),W.isString(t.measureUnit)&&(i.measureUnit=t.measureUnit),W.isString(t.filter)&&(i.filter=t.filter.trim()),W.isArray(t.barColumns)&&(i.barColumns=t.barColumns),i}default(){return new _t}}class xt{constructor(){this.rowGroup="",this.category="",this.subCategory="",this.partOf=""}}class Ct{constructor(){}adapt(t){const i=new xt;return W.isString(t.rowGroup)&&(i.rowGroup=t.rowGroup),W.isString(t.category)&&(i.category=t.category),W.isString(t.subCategory)&&(i.subCategory=t.subCategory),W.isString(t.partOf)&&(i.partOf=t.partOf),i}default(){return new xt}}class Nt{constructor(){this.operation="+"}addRowGroup(t,i){this.rowGroup=t,this.rowGroupIndex=i}addCategory(t,i){this.category=t,this.categoryIndex=i}addSubCategory(t,i){this.subCategory=t,this.subCategoryIndex=i}addColumnGroup(t,i){this.columnGroup=t,this.columnGroupIndex=i}addSubColumnGroup(t,i){this.columnSubGroup=t,this.columnSubGroupIndex=i}}class Dt{constructor(){}adapt(t){const i=new Nt;return W.isOperator(t.operation)&&(i.operation=t.operation),W.isNumber(t.rowGroupIndex)&&W.isString(t.rowGroup)&&i.addRowGroup(t.rowGroup,t.rowGroupIndex),W.isNumber(t.categoryIndex)&&W.isString(t.category)&&i.addCategory(t.category,t.categoryIndex),W.isNumber(t.subCategoryIndex)&&W.isString(t.subCategory)&&i.addSubCategory(t.subCategory,t.subCategoryIndex),W.isNumber(t.columnGroupIndex)&&W.isString(t.columnGroup)&&i.addColumnGroup(t.columnGroup,t.columnGroupIndex),W.isNumber(t.columnSubGroupIndex)&&W.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 Nt}setActualValues(t,i){W.isNumber(t.ac1)&&(i.ac1=t.ac1),W.isNumber(t.ac2)&&(i.ac2=t.ac2),W.isNumber(t.ac3)&&(i.ac3=t.ac3),W.isNumber(t.ac4)&&(i.ac4=t.ac4)}setPlanValues(t,i){W.isNumber(t.pp1)&&(i.pp1=t.pp1),W.isNumber(t.pp2)&&(i.pp2=t.pp2),W.isNumber(t.pp3)&&(i.pp3=t.pp3),W.isNumber(t.pp4)&&(i.pp4=t.pp4)}setPreviousPeriodValues(t,i){W.isNumber(t.pl1)&&(i.pl1=t.pl1),W.isNumber(t.pl2)&&(i.pl2=t.pl2),W.isNumber(t.pl3)&&(i.pl3=t.pl3),W.isNumber(t.pl4)&&(i.pl4=t.pl4)}setForecastValues(t,i){W.isNumber(t.fc1)&&(i.fc1=t.fc1),W.isNumber(t.fc2)&&(i.fc2=t.fc2),W.isNumber(t.fc3)&&(i.fc3=t.fc3),W.isNumber(t.fc4)&&(i.fc4=t.fc4)}}const Lt=class{constructor(i){t(this,i),this.data=[],this.tableTitle="SUM_TOTAL",this.scenarios=[],this.scenariosDataFormat=N.DECIMAL,this.grouped=!1,this.limit=0,this.showGroupTitle=!0,this.thereof=[],this.partof=[],this.order={hierarchy:[],direction:lt.ASC},this.categorythereof=new Map,this.type=at.LIST,this.categoryWidth=k.INF,this.dataFormatDigits={percent:2,decimal:1},this.i18n=new Map,this.i18nMode=P.ALL,this.measureScale="_",this.measureUnit="",this.showMeasureScale=!0,this.measureType=A.VOLUME,this.filter="",this.barColumns=[],this.barColumnMaxWidth=30,this.unitScaling=.01,this.percentageScaling=.5,this.scaleFactor=1,this.componentDataFormatDigits=new Z,this.componentStyle=U(this)}render(){return i(e,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(((e,s,o)=>i("span",null,s===o.length-1?i("span",{class:" "===e?"table-footer":""},e,t.drawPrefix()," "):i("span",null,e,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((t=>i("td",{colSpan:t.colSpan,class:t.type?`${t.cssStyle} ${t.type}`:t.cssStyle},null!=t.prefix?i("span",{class:t.cssStyle+" "+t.prefixStyle},t.drawPrefix()):"",t.isBarChart&&t.columnStats?i(St,{value:t.value,scenario:t.key,columnStats:t.columnStats,height:18*this.scaleFactor,isRelative:t.key.startsWith("dr"),isPositiveGood:t.key.endsWith("_pos"),measureScale:t.measureScale,maxBarWidth:this.barColumnMaxWidth,styles:this.barChartStyles}):t.draw(this.componentDataFormatDigits)))))))))}})())}componentWillRender(){const t=this.prepareConfig(),i=this.prepareData();this.componentDataFormatDigits=(new X).adapt(this.dataFormatDigits),this.barChartStyles=this.prepareBarChartStyles(),this.table=new Ut(new J,i,t),this.table.setI18n(this.i18n)}prepareConfig(){return new Gt(new Ct,new Q,new H(new Q),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 Y.adaptArray(this.data,new Dt)}prepareBarChartStyles(){return this.componentStyle((t=>{var i,e,s,o,n,r,a,l,h,d,c,u,p,f,m,v,g,w,$,b,y,R,O,S,E,M;const T=null===(i=t["bn-chart-time"])||void 0===i?void 0:i.varianceStyles,U=null===(e=t["bn-chart-time"])||void 0===e?void 0:e.barStyles;return{positive:{stroke:(null===(s=null==T?void 0:T.pos)||void 0===s?void 0:s.stroke)||"#008f96",fill:(null===(o=null==T?void 0:T.pos)||void 0===o?void 0:o.fill)||"#008f96",fillpattern:(null===(n=null==T?void 0:T.pos)||void 0===n?void 0:n.fillpattern)||"solid"},negative:{stroke:(null===(r=null==T?void 0:T.neg)||void 0===r?void 0:r.stroke)||"#ff0000",fill:(null===(a=null==T?void 0:T.neg)||void 0===a?void 0:a.fill)||"#ff0000",fillpattern:(null===(l=null==T?void 0:T.neg)||void 0===l?void 0:l.fillpattern)||"solid"},neutral:{stroke:(null===(h=null==T?void 0:T.neu)||void 0===h?void 0:h.stroke)||"#808080",fill:(null===(d=null==T?void 0:T.neu)||void 0===d?void 0:d.fill)||"#808080",fillpattern:(null===(c=null==T?void 0:T.neu)||void 0===c?void 0:c.fillpattern)||"outlined"},scenarios:{ac:{stroke:(null===(u=null==U?void 0:U.ac)||void 0===u?void 0:u.stroke)||"#404040",fill:(null===(p=null==U?void 0:U.ac)||void 0===p?void 0:p.fill)||"#404040",fillpattern:(null===(f=null==U?void 0:U.ac)||void 0===f?void 0:f.fillpattern)||"solid"},pp:{stroke:(null===(m=null==U?void 0:U.pp)||void 0===m?void 0:m.stroke)||"#A6A6A6",fill:(null===(v=null==U?void 0:U.pp)||void 0===v?void 0:v.fill)||"#A6A6A6",fillpattern:(null===(g=null==U?void 0:U.pp)||void 0===g?void 0:g.fillpattern)||"solid"},fc:{stroke:(null===(w=null==U?void 0:U.fc)||void 0===w?void 0:w.stroke)||"#404040",fill:(null===($=null==U?void 0:U.fc)||void 0===$?void 0:$.fill)||"#ffffff",fillpattern:(null===(b=null==U?void 0:U.fc)||void 0===b?void 0:b.fillpattern)||"hatched"},pl:{stroke:(null===(y=null==U?void 0:U.pl)||void 0===y?void 0:y.stroke)||"#404040",fill:(null===(R=null==U?void 0:U.pl)||void 0===R?void 0:R.fill)||"#ffffff",fillpattern:(null===(O=null==U?void 0:U.pl)||void 0===O?void 0:O.fillpattern)||"outlined"}},fontColor:(null===(S=t.global)||void 0===S?void 0:S.fontColor)||"#000000",fontSize:.85*((null===(E=t.global)||void 0===E?void 0:E.fontSizePx)||13.3333)*this.scaleFactor,fontFamily:(null===(M=t.global)||void 0===M?void 0:M.fontFamily)||"'Noto Sans', sans-serif",unitScaling:this.unitScaling,percentageScaling:this.percentageScaling,scaleFactor:this.scaleFactor}}))}get element(){return s(this)}};Lt.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}';export{tt as bn_context,it as bn_datasource,ot as bn_page,dt as bn_table,Lt as ibcs_table}
@@ -1 +1 @@
1
- import{r as t,h as e,H as n,g as s}from"./p-JNHhIe7t.js";import{i as r,f as i,w as o}from"./p-DyRaC0MB.js";import{w as a}from"./p-CYjZRKdI.js";import{w as l}from"./p-BSfqOkN_.js";import{w as c}from"./p-tzFCK9qn.js";import"./p-DdexOqTs.js";import"./p-DgfL-ffj.js";import"./p-DRikHQE-.js";const d=["*","/","+","-","x","÷","none"];function u(t){switch(t){case"*":case"x":return"×";case"/":case"÷":return"÷";case"+":return"+";case"-":return"−";default:return""}}function h(t,e,n){return t.find((t=>t.from===e&&t.to===n))}function f(t){return 2*(t-1)+1}function p(t){return 2*(t-1)+1}function g(t,e){const n=t.getBoundingClientRect(),s=n.left-e.left,r=n.top-e.top;return{left:s,top:r,width:n.width,height:n.height,centerX:s+n.width/2,centerY:r+n.height/2}}function y(t,e,n){switch(n){case"ltr":return e?{x:t.left+t.width,y:t.centerY}:{x:t.left,y:t.centerY};case"rtl":return e?{x:t.left,y:t.centerY}:{x:t.left+t.width,y:t.centerY};case"ttb":return e?{x:t.centerX,y:t.top+t.height}:{x:t.centerX,y:t.top};case"btt":return e?{x:t.centerX,y:t.top}:{x:t.centerX,y:t.top+t.height}}}function v(t,e,n,s,r=8){const i=-(s-1)*r/2+n*r;switch(e){case"ltr":return{x:t.left,y:t.centerY+i};case"rtl":return{x:t.left+t.width,y:t.centerY+i};case"ttb":return{x:t.centerX+i,y:t.top};case"btt":return{x:t.centerX+i,y:t.top+t.height}}}function m(t,e,n,s){switch(n){case"straight":return function(t,e){return{path:`M ${t.x} ${t.y} L ${e.x} ${e.y}`,midpoint:{x:(t.x+e.x)/2,y:(t.y+e.y)/2}}}(t,e);case"curved":return function(t,e,n){let s,r;if("ltr"===n||"rtl"===n){const n=(t.x+e.x)/2;s={x:n,y:t.y},r={x:n,y:e.y}}else{const n=(t.y+e.y)/2;s={x:t.x,y:n},r={x:e.x,y:n}}return{path:`M ${t.x} ${t.y} C ${s.x} ${s.y}, ${r.x} ${r.y}, ${e.x} ${e.y}`,midpoint:{x:.125*t.x+.375*s.x+.375*r.x+.125*e.x,y:.125*t.y+.375*s.y+.375*r.y+.125*e.y}}}(t,e,s);default:return function(t,e,n){let s,r;if("ltr"===n||"rtl"===n){const n=t.x+.7*(e.x-t.x);s=`M ${t.x} ${t.y} L ${n} ${t.y} L ${n} ${e.y} L ${e.x} ${e.y}`,r={x:n,y:(t.y+e.y)/2}}else{const n=t.y+.7*(e.y-t.y);s=`M ${t.x} ${t.y} L ${t.x} ${n} L ${e.x} ${n} L ${e.x} ${e.y}`,r={x:(t.x+e.x)/2,y:n}}return{path:s,midpoint:r}}(t,e,s)}}function b(t,e,n,s){const r=.7;switch(s){case"ltr":{const s=t.left+t.width;return{x:s+(Math.min(e.left,n.left)-s)*r,y:t.centerY}}case"rtl":{const s=t.left,i=Math.max(e.left+e.width,n.left+n.width);return{x:i+(s-i)*r,y:t.centerY}}case"ttb":{const s=t.top+t.height,i=Math.min(e.top,n.top);return{x:t.centerX,y:s+(i-s)*r}}case"btt":{const s=t.top,i=Math.max(e.top+e.height,n.top+n.height);return{x:t.centerX,y:i+(s-i)*r}}}}function $(t,e,n){var s,r;return Object.assign({stroke:null!==(s=null==n?void 0:n.color)&&void 0!==s?s:t,strokeWidth:null!==(r=null==n?void 0:n.width)&&void 0!==r?r:e},(null==n?void 0:n.dasharray)?{strokeDasharray:n.dasharray}:{})}const x=class{validateEdgesProp(t){const e="ERR_edges",n=function(t){const e=[];if(!t||""===t.trim())return e.push("edges: value is required"),e;let n;try{n=JSON.parse(t)}catch(t){return e.push("edges: invalid JSON structure"),e}if(!Array.isArray(n))return e.push("edges: must be an array"),e;if(0===n.length)return e.push("edges: array must not be empty"),e;const s=new Set,r=new Set;n.forEach(((t,n)=>{if("object"!=typeof t||null===t)return void e.push(`edges[${n}]: must be an object`);const i=t;if("string"!=typeof i.from||""===i.from.trim()?e.push(`edges[${n}]: 'from' is required and must be a non-empty string`):s.add(i.from),"string"!=typeof i.to||""===i.to.trim()?e.push(`edges[${n}]: 'to' is required and must be a non-empty string`):(s.add(i.to),r.add(i.to)),void 0!==i.operator&&("string"==typeof i.operator&&d.includes(i.operator)||e.push(`edges[${n}]: 'operator' must be one of: ${d.join(", ")}`)),void 0!==i.label&&"string"!=typeof i.label&&e.push(`edges[${n}]: 'label' must be a string`),void 0!==i.style)if("object"!=typeof i.style||null===i.style)e.push(`edges[${n}]: 'style' must be an object`);else{const t=i.style;void 0!==t.color&&"string"!=typeof t.color&&e.push(`edges[${n}]: 'style.color' must be a string`),void 0!==t.width&&"number"!=typeof t.width&&e.push(`edges[${n}]: 'style.width' must be a number`),void 0!==t.dasharray&&"string"!=typeof t.dasharray&&e.push(`edges[${n}]: 'style.dasharray' must be a string`)}}));const i=Array.from(s).filter((t=>!r.has(t)));return 0===i.length?e.push("edges: tree has no root node (circular reference detected)"):i.length>1&&e.push(`edges: tree has multiple root nodes: ${i.join(", ")}`),e}(t);n.length>0?(this.errors.addOrReplace({id:e,type:"error",message:`edges: ${n.join("; ")}`}),this.treeConfig=null):(this.errors.remove(e),this.treeConfig=function(t){if(!t||""===t.trim())return null;try{const e=JSON.parse(t);if(!Array.isArray(e))return null;const n=e,s=function(t){const e=new Map;for(const n of t){const t=e.get(n.from)||[];t.push(n.to),e.set(n.from,t)}return e}(n),r=function(t){const e=new Set;for(const n of t)e.add(n.from),e.add(n.to);return e}(n),i=function(t,e){const n=new Set;for(const e of t)n.add(e.to);const s=Array.from(e).filter((t=>!n.has(t)));return 1===s.length?s[0]:null}(n,r);return{edges:n,adjacencyList:s,rootNode:i,allNodes:r}}catch(t){return console.error("parseTreeConfig: failed to parse tree configuration",t),null}}(t)),this.recalculateLayout()}validateDirection(t){const e="ERR_direction",n=["ltr","rtl","ttb","btt"];n.includes(t)?this.errors.remove(e):this.errors.addOrReplace({id:e,type:"warning",message:`direction: invalid value '${t}', must be one of: ${n.join(", ")}`}),this.recalculateLayout()}validateLevelSpacing(t){const e="ERR_levelSpacing";!r(t)||t<0?this.errors.addOrReplace({id:e,type:"warning",message:`level-spacing: invalid value '${t}', must be a non-negative number`}):this.errors.remove(e),this.recalculateLayout()}validateNodeSpacing(t){const e="ERR_nodeSpacing";!r(t)||t<0?this.errors.addOrReplace({id:e,type:"warning",message:`node-spacing: invalid value '${t}', must be a non-negative number`}):this.errors.remove(e),this.recalculateLayout()}validateEdgeStyle(t){const e="ERR_edgeStyle",n=["straight","orthogonal","curved"];n.includes(t)?this.errors.remove(e):this.errors.addOrReplace({id:e,type:"warning",message:`edge-style: invalid value '${t}', must be one of: ${n.join(", ")}`})}validateShowOperators(t){const e="ERR_showOperators";i(t)?this.errors.remove(e):this.errors.addOrReplace({id:e,type:"warning",message:`show-operators: invalid value '${t}', must be 'true' or 'false'`})}constructor(e){t(this,e),this.treeConfig=null,this.layout=null,this.nodeRects=new Map,this.svgWidth=0,this.svgHeight=0,this.resizeObserver=null,this.gridContainer=null,this.direction="ltr",this.levelSpacing=60,this.nodeSpacing=20,this.edgeStyle="orthogonal",this.showOperators="true",o(this),a(this),this.errors=c(this),this.componentStyle=l(this)}getTreeStyle(){return this.componentStyle((t=>({edgeColor:t["bn-tree"].edgeColor,edgeWidth:t["bn-tree"].edgeWidth,operatorCircleRadius:t["bn-tree"].operatorCircleRadius,operatorFontSize:t.global.fontSizePx*t["bn-tree"].operatorFontSizeScale,operatorColor:t["bn-tree"].operatorColor})))}componentWillLoad(){this.validateEdgesProp(this.edges),this.validateDirection(this.direction),this.validateLevelSpacing(this.levelSpacing),this.validateNodeSpacing(this.nodeSpacing),this.validateEdgeStyle(this.edgeStyle),this.validateShowOperators(this.showOperators)}componentDidLoad(){this.setupResizeObserver(),this.updateNodeRects()}disconnectedCallback(){this.resizeObserver&&(this.resizeObserver.disconnect(),this.resizeObserver=null)}setupResizeObserver(){var t;this.gridContainer=null===(t=this.element.shadowRoot)||void 0===t?void 0:t.querySelector(".tree-grid"),this.gridContainer&&(this.resizeObserver=new ResizeObserver((()=>{this.updateNodeRects()})),this.resizeObserver.observe(this.gridContainer),this.element.querySelectorAll("[slot]").forEach((t=>{this.resizeObserver.observe(t)})))}recalculateLayout(){this.layout=this.treeConfig?function(t,e,n,s){if(!t.rootNode)return{positions:new Map,gridTemplateColumns:"",gridTemplateRows:"",maxLevel:0,maxIndex:0};const r=function(t){const e=new Map;if(!t.rootNode)return e;const n=[{node:t.rootNode,level:0}],s=new Set;for(;n.length>0;){const{node:r,level:i}=n.shift();if(s.has(r))continue;s.add(r),e.set(r,i);const o=t.adjacencyList.get(r)||[];for(const t of o)s.has(t)||n.push({node:t,level:i+1})}return e}(t),i=function(t){const e=new Map;if(!t.rootNode)return e;let n=0;return function s(r){const i=e.get(r);if(i)return i;const o=t.adjacencyList.get(r)||[];if(0===o.length){const t={startIndex:n,endIndex:n};return e.set(r,t),n++,t}let a=1/0,l=-1/0;for(const t of o){const e=s(t);a=Math.min(a,e.startIndex),l=Math.max(l,e.endIndex)}const c={startIndex:a,endIndex:l};return e.set(r,c),c}(t.rootNode),e}(t),o=function(t,e,n,s){var r,i;const o=new Map,a=Math.max(...Array.from(e.values()));for(const l of t.allNodes){const t=null!==(r=e.get(l))&&void 0!==r?r:0,c=null!==(i=n.get(l))&&void 0!==i?i:{startIndex:0,endIndex:0};let d,u,h;switch(s){case"ltr":d=t+1,u=c.startIndex+1,h=c.endIndex-c.startIndex+1;break;case"rtl":d=a-t+1,u=c.startIndex+1,h=c.endIndex-c.startIndex+1;break;case"ttb":u=t+1,d=c.startIndex+1,h=1;break;case"btt":u=a-t+1,d=c.startIndex+1,h=1}o.set(l,{nodeId:l,level:t,index:c.startIndex,gridColumn:d,gridRow:u,gridRowSpan:h})}return o}(t,r,i,e),a=Math.max(...Array.from(r.values())),l=Math.max(...Array.from(i.values()).map((t=>t.endIndex))),{gridTemplateColumns:c,gridTemplateRows:d}=function(t,e,n,s,r){const i=t+1,o=e+1;if("ltr"===n||"rtl"===n){const t=[];for(let e=0;e<i;e++)t.push("auto"),e<i-1&&t.push(`${s}px`);const e=[];for(let t=0;t<o;t++)e.push("auto"),t<o-1&&e.push(`${r}px`);return{gridTemplateColumns:t.join(" "),gridTemplateRows:e.join(" ")}}{const t=[];for(let e=0;e<i;e++)t.push("auto"),e<i-1&&t.push(`${s}px`);const e=[];for(let t=0;t<o;t++)e.push("auto"),t<o-1&&e.push(`${r}px`);return{gridTemplateColumns:e.join(" "),gridTemplateRows:t.join(" ")}}}(a,l,e,n,s);return{positions:o,gridTemplateColumns:c,gridTemplateRows:d,maxLevel:a,maxIndex:l}}(this.treeConfig,this.direction,this.levelSpacing,this.nodeSpacing):null}updateNodeRects(){if(!this.treeConfig||!this.gridContainer)return;const t=this.gridContainer.getBoundingClientRect(),e=new Map;for(const n of this.treeConfig.allNodes){const s=this.element.querySelector(`[slot="${n}"]`);s&&e.set(n,g(s,t))}this.nodeRects=e,this.svgWidth=t.width,this.svgHeight=t.height}getSlotStyle(t){if(!this.layout)return{};const e=this.layout.positions.get(t);return e?"ltr"===this.direction||"rtl"===this.direction?{"grid-column":String(f(e.gridColumn)),"grid-row":`${p(e.gridRow)} / span ${n=e.gridRowSpan,n<=1?1:2*(n-1)+1}`,"align-self":"center"}:{"grid-row":String(p(e.gridRow)),"grid-column":String(f(e.gridColumn)),"justify-self":"center"}:{};var n}renderEdges(){var t;if(!this.treeConfig||0===this.nodeRects.size)return null;const n=this.getTreeStyle(),s=[],r=[],i=new Map;for(const t of this.treeConfig.edges){const e=i.get(t.to)||[];e.push(t.from),i.set(t.to,e)}for(const t of this.treeConfig.edges){const r=this.nodeRects.get(t.from),o=this.nodeRects.get(t.to);if(!r||!o)continue;const a=y(r,!0,this.direction),l=i.get(t.to)||[];let c;if(l.length>1){const e=l.indexOf(t.from);c=v(o,this.direction,e,l.length)}else c=y(o,!1,this.direction);const{path:d}=m(a,c,this.edgeStyle,this.direction),u=$(n.edgeColor,n.edgeWidth,t.style);s.push(e("path",{key:`edge-${t.from}-${t.to}`,d,fill:"none",stroke:u.stroke,"stroke-width":u.strokeWidth,"stroke-dasharray":u.strokeDasharray}))}if("true"===this.showOperators)for(const[s,i]of this.treeConfig.adjacencyList.entries()){const o=this.nodeRects.get(s);if(o)for(let a=0;a<i.length-1;a++){const l=i[a],c=i[a+1],d=h(this.treeConfig.edges,s,l);if(!(null==d?void 0:d.operator)||"none"===d.operator)continue;const f=this.nodeRects.get(l),p=this.nodeRects.get(c);if(!f||!p)continue;const g=null!==(t=d.label)&&void 0!==t?t:u(d.operator),y=b(o,f,p,this.direction);r.push(e("g",{key:`operator-${s}-${l}`,class:"operator-group"},e("circle",{cx:y.x,cy:y.y,r:n.operatorCircleRadius,fill:"white",stroke:n.edgeColor,"stroke-width":n.edgeWidth}),e("text",{x:y.x,y:y.y,"text-anchor":"middle","dominant-baseline":"central",style:{fontSize:`${n.operatorFontSize}px`,fill:n.operatorColor,fontWeight:"bold"}},g)))}}return e("svg",{class:"edge-layer",width:this.svgWidth,height:this.svgHeight,style:{position:"absolute",top:"0",left:"0",pointerEvents:"none"}},s,r)}renderSlots(){return this.treeConfig&&this.layout?Array.from(this.treeConfig.allNodes).map((t=>e("div",{key:t,class:"tree-node",style:this.getSlotStyle(t)},e("slot",{name:t})))):null}getFontStyles(){return this.componentStyle((t=>{var e,n,s,r;return{"--bn-font-family":(null===(e=t.global)||void 0===e?void 0:e.fontFamily)||"'Noto Sans', sans-serif","--bn-font-size":`${(null===(n=t.global)||void 0===n?void 0:n.fontSizePx)||13.3333}px`,"--bn-font-color":(null===(s=t.global)||void 0===s?void 0:s.fontColor)||"#000000","--bn-font-background":(null===(r=t.global)||void 0===r?void 0:r.fontBackgroundColor)||"#ffffff"}}))}render(){const t=this.getFontStyles();return e(n,{style:t},this.treeConfig&&this.layout?e("div",{class:"tree-container"},e("div",{class:"tree-grid",style:{display:"grid","grid-template-columns":this.layout.gridTemplateColumns,"grid-template-rows":this.layout.gridTemplateRows,position:"relative"}},this.renderEdges(),this.renderSlots())):e("div",{class:"tree-container tree-error"},e("slot",null)))}get element(){return s(this)}static get watchers(){return{edges:[{validateEdgesProp:0}],direction:[{validateDirection:0}],levelSpacing:[{validateLevelSpacing:0}],nodeSpacing:[{validateNodeSpacing:0}],edgeStyle:[{validateEdgeStyle:0}],showOperators:[{validateShowOperators:0}]}}};x.style=':host{display:inline-block;position:relative;font-family:var(--bn-font-family, "Noto Sans", sans-serif);font-size:var(--bn-font-size, 13.3333px);color:var(--bn-font-color, #000000)}.tree-container{position:relative;display:inline-block}.tree-grid{position:relative;display:grid;align-items:center}.tree-node{position:relative;z-index:1;border:1px solid #404040;background:var(--bn-font-background, white)}.edge-layer{position:absolute;top:0;left:0;z-index:0;pointer-events:none;overflow:visible}.tree-error{display:flex;flex-wrap:wrap;gap:20px}';export{x as bn_tree}
1
+ import{r as t,h as e,H as n,g as s}from"./p-JNHhIe7t.js";import{i as r,f as i,w as o}from"./p-DtdQCMzj.js";import{w as a}from"./p-CYjZRKdI.js";import{w as l}from"./p-BSfqOkN_.js";import{w as c}from"./p-tzFCK9qn.js";import"./p-sqjrku2z.js";import"./p-B4ySv9KQ.js";import"./p-DRikHQE-.js";const d=["*","/","+","-","x","÷","none"];function u(t){switch(t){case"*":case"x":return"×";case"/":case"÷":return"÷";case"+":return"+";case"-":return"−";default:return""}}function h(t,e,n){return t.find((t=>t.from===e&&t.to===n))}function f(t){return 2*(t-1)+1}function p(t){return 2*(t-1)+1}function g(t,e){const n=t.getBoundingClientRect(),s=n.left-e.left,r=n.top-e.top;return{left:s,top:r,width:n.width,height:n.height,centerX:s+n.width/2,centerY:r+n.height/2}}function y(t,e,n){switch(n){case"ltr":return e?{x:t.left+t.width,y:t.centerY}:{x:t.left,y:t.centerY};case"rtl":return e?{x:t.left,y:t.centerY}:{x:t.left+t.width,y:t.centerY};case"ttb":return e?{x:t.centerX,y:t.top+t.height}:{x:t.centerX,y:t.top};case"btt":return e?{x:t.centerX,y:t.top}:{x:t.centerX,y:t.top+t.height}}}function v(t,e,n,s,r=8){const i=-(s-1)*r/2+n*r;switch(e){case"ltr":return{x:t.left,y:t.centerY+i};case"rtl":return{x:t.left+t.width,y:t.centerY+i};case"ttb":return{x:t.centerX+i,y:t.top};case"btt":return{x:t.centerX+i,y:t.top+t.height}}}function m(t,e,n,s){switch(n){case"straight":return function(t,e){return{path:`M ${t.x} ${t.y} L ${e.x} ${e.y}`,midpoint:{x:(t.x+e.x)/2,y:(t.y+e.y)/2}}}(t,e);case"curved":return function(t,e,n){let s,r;if("ltr"===n||"rtl"===n){const n=(t.x+e.x)/2;s={x:n,y:t.y},r={x:n,y:e.y}}else{const n=(t.y+e.y)/2;s={x:t.x,y:n},r={x:e.x,y:n}}return{path:`M ${t.x} ${t.y} C ${s.x} ${s.y}, ${r.x} ${r.y}, ${e.x} ${e.y}`,midpoint:{x:.125*t.x+.375*s.x+.375*r.x+.125*e.x,y:.125*t.y+.375*s.y+.375*r.y+.125*e.y}}}(t,e,s);default:return function(t,e,n){let s,r;if("ltr"===n||"rtl"===n){const n=t.x+.7*(e.x-t.x);s=`M ${t.x} ${t.y} L ${n} ${t.y} L ${n} ${e.y} L ${e.x} ${e.y}`,r={x:n,y:(t.y+e.y)/2}}else{const n=t.y+.7*(e.y-t.y);s=`M ${t.x} ${t.y} L ${t.x} ${n} L ${e.x} ${n} L ${e.x} ${e.y}`,r={x:(t.x+e.x)/2,y:n}}return{path:s,midpoint:r}}(t,e,s)}}function b(t,e,n,s){const r=.7;switch(s){case"ltr":{const s=t.left+t.width;return{x:s+(Math.min(e.left,n.left)-s)*r,y:t.centerY}}case"rtl":{const s=t.left,i=Math.max(e.left+e.width,n.left+n.width);return{x:i+(s-i)*r,y:t.centerY}}case"ttb":{const s=t.top+t.height,i=Math.min(e.top,n.top);return{x:t.centerX,y:s+(i-s)*r}}case"btt":{const s=t.top,i=Math.max(e.top+e.height,n.top+n.height);return{x:t.centerX,y:i+(s-i)*r}}}}function $(t,e,n){var s,r;return Object.assign({stroke:null!==(s=null==n?void 0:n.color)&&void 0!==s?s:t,strokeWidth:null!==(r=null==n?void 0:n.width)&&void 0!==r?r:e},(null==n?void 0:n.dasharray)?{strokeDasharray:n.dasharray}:{})}const x=class{validateEdgesProp(t){const e="ERR_edges",n=function(t){const e=[];if(!t||""===t.trim())return e.push("edges: value is required"),e;let n;try{n=JSON.parse(t)}catch(t){return e.push("edges: invalid JSON structure"),e}if(!Array.isArray(n))return e.push("edges: must be an array"),e;if(0===n.length)return e.push("edges: array must not be empty"),e;const s=new Set,r=new Set;n.forEach(((t,n)=>{if("object"!=typeof t||null===t)return void e.push(`edges[${n}]: must be an object`);const i=t;if("string"!=typeof i.from||""===i.from.trim()?e.push(`edges[${n}]: 'from' is required and must be a non-empty string`):s.add(i.from),"string"!=typeof i.to||""===i.to.trim()?e.push(`edges[${n}]: 'to' is required and must be a non-empty string`):(s.add(i.to),r.add(i.to)),void 0!==i.operator&&("string"==typeof i.operator&&d.includes(i.operator)||e.push(`edges[${n}]: 'operator' must be one of: ${d.join(", ")}`)),void 0!==i.label&&"string"!=typeof i.label&&e.push(`edges[${n}]: 'label' must be a string`),void 0!==i.style)if("object"!=typeof i.style||null===i.style)e.push(`edges[${n}]: 'style' must be an object`);else{const t=i.style;void 0!==t.color&&"string"!=typeof t.color&&e.push(`edges[${n}]: 'style.color' must be a string`),void 0!==t.width&&"number"!=typeof t.width&&e.push(`edges[${n}]: 'style.width' must be a number`),void 0!==t.dasharray&&"string"!=typeof t.dasharray&&e.push(`edges[${n}]: 'style.dasharray' must be a string`)}}));const i=Array.from(s).filter((t=>!r.has(t)));return 0===i.length?e.push("edges: tree has no root node (circular reference detected)"):i.length>1&&e.push(`edges: tree has multiple root nodes: ${i.join(", ")}`),e}(t);n.length>0?(this.errors.addOrReplace({id:e,type:"error",message:`edges: ${n.join("; ")}`}),this.treeConfig=null):(this.errors.remove(e),this.treeConfig=function(t){if(!t||""===t.trim())return null;try{const e=JSON.parse(t);if(!Array.isArray(e))return null;const n=e,s=function(t){const e=new Map;for(const n of t){const t=e.get(n.from)||[];t.push(n.to),e.set(n.from,t)}return e}(n),r=function(t){const e=new Set;for(const n of t)e.add(n.from),e.add(n.to);return e}(n),i=function(t,e){const n=new Set;for(const e of t)n.add(e.to);const s=Array.from(e).filter((t=>!n.has(t)));return 1===s.length?s[0]:null}(n,r);return{edges:n,adjacencyList:s,rootNode:i,allNodes:r}}catch(t){return console.error("parseTreeConfig: failed to parse tree configuration",t),null}}(t)),this.recalculateLayout()}validateDirection(t){const e="ERR_direction",n=["ltr","rtl","ttb","btt"];n.includes(t)?this.errors.remove(e):this.errors.addOrReplace({id:e,type:"warning",message:`direction: invalid value '${t}', must be one of: ${n.join(", ")}`}),this.recalculateLayout()}validateLevelSpacing(t){const e="ERR_levelSpacing";!r(t)||t<0?this.errors.addOrReplace({id:e,type:"warning",message:`level-spacing: invalid value '${t}', must be a non-negative number`}):this.errors.remove(e),this.recalculateLayout()}validateNodeSpacing(t){const e="ERR_nodeSpacing";!r(t)||t<0?this.errors.addOrReplace({id:e,type:"warning",message:`node-spacing: invalid value '${t}', must be a non-negative number`}):this.errors.remove(e),this.recalculateLayout()}validateEdgeStyle(t){const e="ERR_edgeStyle",n=["straight","orthogonal","curved"];n.includes(t)?this.errors.remove(e):this.errors.addOrReplace({id:e,type:"warning",message:`edge-style: invalid value '${t}', must be one of: ${n.join(", ")}`})}validateShowOperators(t){const e="ERR_showOperators";i(t)?this.errors.remove(e):this.errors.addOrReplace({id:e,type:"warning",message:`show-operators: invalid value '${t}', must be 'true' or 'false'`})}constructor(e){t(this,e),this.treeConfig=null,this.layout=null,this.nodeRects=new Map,this.svgWidth=0,this.svgHeight=0,this.resizeObserver=null,this.gridContainer=null,this.direction="ltr",this.levelSpacing=60,this.nodeSpacing=20,this.edgeStyle="orthogonal",this.showOperators="true",o(this),a(this),this.errors=c(this),this.componentStyle=l(this)}getTreeStyle(){return this.componentStyle((t=>({edgeColor:t["bn-tree"].edgeColor,edgeWidth:t["bn-tree"].edgeWidth,operatorCircleRadius:t["bn-tree"].operatorCircleRadius,operatorFontSize:t.global.fontSizePx*t["bn-tree"].operatorFontSizeScale,operatorColor:t["bn-tree"].operatorColor})))}componentWillLoad(){this.validateEdgesProp(this.edges),this.validateDirection(this.direction),this.validateLevelSpacing(this.levelSpacing),this.validateNodeSpacing(this.nodeSpacing),this.validateEdgeStyle(this.edgeStyle),this.validateShowOperators(this.showOperators)}componentDidLoad(){this.setupResizeObserver(),this.updateNodeRects()}disconnectedCallback(){this.resizeObserver&&(this.resizeObserver.disconnect(),this.resizeObserver=null)}setupResizeObserver(){var t;this.gridContainer=null===(t=this.element.shadowRoot)||void 0===t?void 0:t.querySelector(".tree-grid"),this.gridContainer&&(this.resizeObserver=new ResizeObserver((()=>{this.updateNodeRects()})),this.resizeObserver.observe(this.gridContainer),this.element.querySelectorAll("[slot]").forEach((t=>{this.resizeObserver.observe(t)})))}recalculateLayout(){this.layout=this.treeConfig?function(t,e,n,s){if(!t.rootNode)return{positions:new Map,gridTemplateColumns:"",gridTemplateRows:"",maxLevel:0,maxIndex:0};const r=function(t){const e=new Map;if(!t.rootNode)return e;const n=[{node:t.rootNode,level:0}],s=new Set;for(;n.length>0;){const{node:r,level:i}=n.shift();if(s.has(r))continue;s.add(r),e.set(r,i);const o=t.adjacencyList.get(r)||[];for(const t of o)s.has(t)||n.push({node:t,level:i+1})}return e}(t),i=function(t){const e=new Map;if(!t.rootNode)return e;let n=0;return function s(r){const i=e.get(r);if(i)return i;const o=t.adjacencyList.get(r)||[];if(0===o.length){const t={startIndex:n,endIndex:n};return e.set(r,t),n++,t}let a=1/0,l=-1/0;for(const t of o){const e=s(t);a=Math.min(a,e.startIndex),l=Math.max(l,e.endIndex)}const c={startIndex:a,endIndex:l};return e.set(r,c),c}(t.rootNode),e}(t),o=function(t,e,n,s){var r,i;const o=new Map,a=Math.max(...Array.from(e.values()));for(const l of t.allNodes){const t=null!==(r=e.get(l))&&void 0!==r?r:0,c=null!==(i=n.get(l))&&void 0!==i?i:{startIndex:0,endIndex:0};let d,u,h;switch(s){case"ltr":d=t+1,u=c.startIndex+1,h=c.endIndex-c.startIndex+1;break;case"rtl":d=a-t+1,u=c.startIndex+1,h=c.endIndex-c.startIndex+1;break;case"ttb":u=t+1,d=c.startIndex+1,h=1;break;case"btt":u=a-t+1,d=c.startIndex+1,h=1}o.set(l,{nodeId:l,level:t,index:c.startIndex,gridColumn:d,gridRow:u,gridRowSpan:h})}return o}(t,r,i,e),a=Math.max(...Array.from(r.values())),l=Math.max(...Array.from(i.values()).map((t=>t.endIndex))),{gridTemplateColumns:c,gridTemplateRows:d}=function(t,e,n,s,r){const i=t+1,o=e+1;if("ltr"===n||"rtl"===n){const t=[];for(let e=0;e<i;e++)t.push("auto"),e<i-1&&t.push(`${s}px`);const e=[];for(let t=0;t<o;t++)e.push("auto"),t<o-1&&e.push(`${r}px`);return{gridTemplateColumns:t.join(" "),gridTemplateRows:e.join(" ")}}{const t=[];for(let e=0;e<i;e++)t.push("auto"),e<i-1&&t.push(`${s}px`);const e=[];for(let t=0;t<o;t++)e.push("auto"),t<o-1&&e.push(`${r}px`);return{gridTemplateColumns:e.join(" "),gridTemplateRows:t.join(" ")}}}(a,l,e,n,s);return{positions:o,gridTemplateColumns:c,gridTemplateRows:d,maxLevel:a,maxIndex:l}}(this.treeConfig,this.direction,this.levelSpacing,this.nodeSpacing):null}updateNodeRects(){if(!this.treeConfig||!this.gridContainer)return;const t=this.gridContainer.getBoundingClientRect(),e=new Map;for(const n of this.treeConfig.allNodes){const s=this.element.querySelector(`[slot="${n}"]`);s&&e.set(n,g(s,t))}this.nodeRects=e,this.svgWidth=t.width,this.svgHeight=t.height}getSlotStyle(t){if(!this.layout)return{};const e=this.layout.positions.get(t);return e?"ltr"===this.direction||"rtl"===this.direction?{"grid-column":String(f(e.gridColumn)),"grid-row":`${p(e.gridRow)} / span ${n=e.gridRowSpan,n<=1?1:2*(n-1)+1}`,"align-self":"center"}:{"grid-row":String(p(e.gridRow)),"grid-column":String(f(e.gridColumn)),"justify-self":"center"}:{};var n}renderEdges(){var t;if(!this.treeConfig||0===this.nodeRects.size)return null;const n=this.getTreeStyle(),s=[],r=[],i=new Map;for(const t of this.treeConfig.edges){const e=i.get(t.to)||[];e.push(t.from),i.set(t.to,e)}for(const t of this.treeConfig.edges){const r=this.nodeRects.get(t.from),o=this.nodeRects.get(t.to);if(!r||!o)continue;const a=y(r,!0,this.direction),l=i.get(t.to)||[];let c;if(l.length>1){const e=l.indexOf(t.from);c=v(o,this.direction,e,l.length)}else c=y(o,!1,this.direction);const{path:d}=m(a,c,this.edgeStyle,this.direction),u=$(n.edgeColor,n.edgeWidth,t.style);s.push(e("path",{key:`edge-${t.from}-${t.to}`,d,fill:"none",stroke:u.stroke,"stroke-width":u.strokeWidth,"stroke-dasharray":u.strokeDasharray}))}if("true"===this.showOperators)for(const[s,i]of this.treeConfig.adjacencyList.entries()){const o=this.nodeRects.get(s);if(o)for(let a=0;a<i.length-1;a++){const l=i[a],c=i[a+1],d=h(this.treeConfig.edges,s,l);if(!(null==d?void 0:d.operator)||"none"===d.operator)continue;const f=this.nodeRects.get(l),p=this.nodeRects.get(c);if(!f||!p)continue;const g=null!==(t=d.label)&&void 0!==t?t:u(d.operator),y=b(o,f,p,this.direction);r.push(e("g",{key:`operator-${s}-${l}`,class:"operator-group"},e("circle",{cx:y.x,cy:y.y,r:n.operatorCircleRadius,fill:"white",stroke:n.edgeColor,"stroke-width":n.edgeWidth}),e("text",{x:y.x,y:y.y,"text-anchor":"middle","dominant-baseline":"central",style:{fontSize:`${n.operatorFontSize}px`,fill:n.operatorColor,fontWeight:"bold"}},g)))}}return e("svg",{class:"edge-layer",width:this.svgWidth,height:this.svgHeight,style:{position:"absolute",top:"0",left:"0",pointerEvents:"none"}},s,r)}renderSlots(){return this.treeConfig&&this.layout?Array.from(this.treeConfig.allNodes).map((t=>e("div",{key:t,class:"tree-node",style:this.getSlotStyle(t)},e("slot",{name:t})))):null}getFontStyles(){return this.componentStyle((t=>{var e,n,s,r;return{"--bn-font-family":(null===(e=t.global)||void 0===e?void 0:e.fontFamily)||"'Noto Sans', sans-serif","--bn-font-size":`${(null===(n=t.global)||void 0===n?void 0:n.fontSizePx)||13.3333}px`,"--bn-font-color":(null===(s=t.global)||void 0===s?void 0:s.fontColor)||"#000000","--bn-font-background":(null===(r=t.global)||void 0===r?void 0:r.fontBackgroundColor)||"#ffffff"}}))}render(){const t=this.getFontStyles();return e(n,{style:t},this.treeConfig&&this.layout?e("div",{class:"tree-container"},e("div",{class:"tree-grid",style:{display:"grid","grid-template-columns":this.layout.gridTemplateColumns,"grid-template-rows":this.layout.gridTemplateRows,position:"relative"}},this.renderEdges(),this.renderSlots())):e("div",{class:"tree-container tree-error"},e("slot",null)))}get element(){return s(this)}static get watchers(){return{edges:[{validateEdgesProp:0}],direction:[{validateDirection:0}],levelSpacing:[{validateLevelSpacing:0}],nodeSpacing:[{validateNodeSpacing:0}],edgeStyle:[{validateEdgeStyle:0}],showOperators:[{validateShowOperators:0}]}}};x.style=':host{display:inline-block;position:relative;font-family:var(--bn-font-family, "Noto Sans", sans-serif);font-size:var(--bn-font-size, 13.3333px);color:var(--bn-font-color, #000000)}.tree-container{position:relative;display:inline-block}.tree-grid{position:relative;display:grid;align-items:center}.tree-node{position:relative;z-index:1;border:1px solid #404040;background:var(--bn-font-background, white)}.edge-layer{position:absolute;top:0;left:0;z-index:0;pointer-events:none;overflow:visible}.tree-error{display:flex;flex-wrap:wrap;gap:20px}';export{x as bn_tree}
@@ -1 +1 @@
1
- import{V as t}from"./p-1jFf17Vj.js";import{d as r}from"./p-DdexOqTs.js";class s{constructor(){this._dateFormat={year:"YYYY",quarter:"Q[Q] YYYY",month:"MMM YYYY",locale:"[KW]WW YYYY",day:"DD.MM.YYYY"},this._dateLinkFormat={avg:"Ø[DATE]",interval:"[DATE]..[DATE]",start:".[DATE]",end:"[DATE].",ytd:"_[DATE]",ytg:"[DATE]_",cum:"[DATE]_[DATE]",mat:"~[DATE]",none:"[DATE]"},this._scenarioMap=new Map,this._fallBackScenario={name:"Series",group:"Series",colorIndex:10,sortIndex:120},this.createScenarioMapEntry("ac","AC",10,400),this.createScenarioMapEntry("fc","FC",30,300),this.createScenarioMapEntry("pl","PL",50,200),this.createScenarioMapEntry("bu","BU",50,200),this.createScenarioMapEntry("pp","PP",20,100),this.createScenarioMapEntry("py","PY",20,100),this.createScenarioMapEntry("dac","dAC",10,1400),this.createScenarioMapEntry("dfc","dFC",30,1300),this.createScenarioMapEntry("dpl","dPL",50,1200),this.createScenarioMapEntry("dbu","dBU",50,1200),this.createScenarioMapEntry("dpp","dPP",20,1100),this.createScenarioMapEntry("dpy","dPY",20,1100),this.createScenarioMapEntry("drac","drAC",10,2400),this.createScenarioMapEntry("drfc","drFC",30,2300),this.createScenarioMapEntry("drpl","drPL",50,2200),this.createScenarioMapEntry("drbu","drBU",50,2200),this.createScenarioMapEntry("drpp","drPP",20,2100),this.createScenarioMapEntry("drpy","drPY",20,2100)}createScenarioMapEntry(t,r,s,i){const e=r,d=s;[1,2,3,4].forEach((s=>{this._scenarioMap.set(t+s,{name:r+s,group:e,colorIndex:d,sortIndex:i+10*s})}))}getScenario(t){return this._scenarioMap.has(t)?this._scenarioMap.get(t):this._fallBackScenario}getScenarioGroup(t){return this._scenarioMap.has(t)?this._scenarioMap.get(t).name:this._fallBackScenario.name}getScenarioColorIndex(t){return this._scenarioMap.has(t)?this._scenarioMap.get(t).colorIndex:this._fallBackScenario.colorIndex}getScenarioSorIndex(t){const r=this.normalizeVarianceScenario(t);return this._scenarioMap.has(r)?this._scenarioMap.get(r).sortIndex:this._fallBackScenario.sortIndex}normalizeVarianceScenario(r){if(null==r)return"";const s=new t(r);return s.isValid?s.type+s.delta:r}}class i{adapt(t){return r.adaptDefaultString(t)}default(){return""}}export{s as I,i as S}
1
+ import{V as t}from"./p-1jFf17Vj.js";import{d as r}from"./p-sqjrku2z.js";class s{constructor(){this._dateFormat={year:"YYYY",quarter:"Q[Q] YYYY",month:"MMM YYYY",locale:"[KW]WW YYYY",day:"DD.MM.YYYY"},this._dateLinkFormat={avg:"Ø[DATE]",interval:"[DATE]..[DATE]",start:".[DATE]",end:"[DATE].",ytd:"_[DATE]",ytg:"[DATE]_",cum:"[DATE]_[DATE]",mat:"~[DATE]",none:"[DATE]"},this._scenarioMap=new Map,this._fallBackScenario={name:"Series",group:"Series",colorIndex:10,sortIndex:120},this.createScenarioMapEntry("ac","AC",10,400),this.createScenarioMapEntry("fc","FC",30,300),this.createScenarioMapEntry("pl","PL",50,200),this.createScenarioMapEntry("bu","BU",50,200),this.createScenarioMapEntry("pp","PP",20,100),this.createScenarioMapEntry("py","PY",20,100),this.createScenarioMapEntry("dac","dAC",10,1400),this.createScenarioMapEntry("dfc","dFC",30,1300),this.createScenarioMapEntry("dpl","dPL",50,1200),this.createScenarioMapEntry("dbu","dBU",50,1200),this.createScenarioMapEntry("dpp","dPP",20,1100),this.createScenarioMapEntry("dpy","dPY",20,1100),this.createScenarioMapEntry("drac","drAC",10,2400),this.createScenarioMapEntry("drfc","drFC",30,2300),this.createScenarioMapEntry("drpl","drPL",50,2200),this.createScenarioMapEntry("drbu","drBU",50,2200),this.createScenarioMapEntry("drpp","drPP",20,2100),this.createScenarioMapEntry("drpy","drPY",20,2100)}createScenarioMapEntry(t,r,s,i){const e=r,h=s;[1,2,3,4].forEach((s=>{this._scenarioMap.set(t+s,{name:r+s,group:e,colorIndex:h,sortIndex:i+10*s})}))}getScenario(t){return this._scenarioMap.has(t)?this._scenarioMap.get(t):this._fallBackScenario}getScenarioGroup(t){return this._scenarioMap.has(t)?this._scenarioMap.get(t).name:this._fallBackScenario.name}getScenarioColorIndex(t){return this._scenarioMap.has(t)?this._scenarioMap.get(t).colorIndex:this._fallBackScenario.colorIndex}getScenarioSorIndex(t){const r=this.normalizeVarianceScenario(t);return this._scenarioMap.has(r)?this._scenarioMap.get(r).sortIndex:this._fallBackScenario.sortIndex}normalizeVarianceScenario(r){if(null==r)return"";const s=new t(r);return s.isValid?s.type+s.delta:r}}class i{adapt(t){return r.adaptDefaultString(t)}default(){return""}}export{s as I,i as S}
@@ -1 +1 @@
1
- import{r as i,h as t,H as e,g as s}from"./p-JNHhIe7t.js";import{v as a,a as n,i as r,e as o,b as l,c as d,d as h,k as p,h as u,l as c,f as v,g,w as m,j as y}from"./p-DyRaC0MB.js";import{w as f,g as b,p as O}from"./p-DVMu6dEy.js";import{w as S}from"./p-CYjZRKdI.js";import{w}from"./p-CRLgp9-v.js";import{a as R}from"./p-DRikHQE-.js";import{w as x}from"./p-BSfqOkN_.js";import{w as _}from"./p-tzFCK9qn.js";import{O as M,a as A,c as L,S as T,b as E,C as I}from"./p-DdexOqTs.js";import{F as C}from"./p-1jFf17Vj.js";import{D as U}from"./p-DgfL-ffj.js";import"./p-BFTU3MAI.js";var k;!function(i){i.ROWGROUP="rowGroup",i.ROWGROUPINDEX="rowGroupIndex",i.CATEGORY="category",i.CATEGORYINDEX="categoryIndex",i.SUBCATEGORY="subCategory",i.SUBCATEGORYINDEX="subCategoryIndex"}(k||(k={}));const D=class{validateScenario(i){const t=a(i),e="ERR_scenarios";t.length>0?this.errors.addOrReplace({id:e,type:"warning",message:"scenarios: invalid value(s) '"+JSON.stringify(t)+"' are not supported."}):this.errors.remove(e)}validateVariances(i){const t="ERR_variances",e=n(i);e.length>0?this.errors.addOrReplace({id:t,type:"warning",message:"variances: invalid value(s) '"+JSON.stringify(e)+"' are not supported."}):this.errors.remove(t)}validateLeftSync(i){const t="ERR_syncSpaceLeft";r(i)?this.errors.remove(t):this.errors.addOrReplace({id:t,type:"warning",message:"syncSpaceLeft: invalid value(s) '"+i+"' are not supported."})}validateLimit(i){const t="ERR_limit";o(i)?this.errors.remove(t):this.errors.addOrReplace({id:t,type:"warning",message:"limit: invalid value '"+(null==i?void 0:i.toString())+"' is not supported."})}validateUnitScaling(i){const t="ERR_unitScaling";r(i)||this.pixelPerUnitGroupMap.has(i)?this.errors.remove(t):this.errors.addOrReplace({id:t,type:"warning",message:"unitScaling: invalid value(s) '"+i+"' are not supported."})}validatePercentageScaling(i){const t="ERR_percentageScaling";r(i)||this.pixelPerUnitGroupMap.has(i)?this.errors.remove(t):this.errors.addOrReplace({id:t,type:"warning",message:"percentageScaling: invalid value(s) '"+i+"' are not supported."})}validateLevel(i){const t="ERR_level";l(i)?this.errors.remove(t):this.errors.addOrReplace({id:t,type:"warning",message:"level: invalid value(s) '"+i+"' are not supported."})}validateOrderList(i){const t="ERR_order",e=d(i);e.length>0?this.errors.addOrReplace({id:t,type:"warning",message:"order: invalid value(s) '"+JSON.stringify(e)+"' are not supported."}):this.errors.remove(t)}validateOrderDirection(i){const t="ERR_orderDirection";h(i)?this.errors.remove(t):this.errors.addOrReplace({id:t,type:"warning",message:"orderDirection: invalid value '"+(null==i?void 0:i.toString())+"' is not supported."})}validateDateInterval(i){const t="ERR_dateInterval";p(i)?this.errors.remove(t):this.errors.addOrReplace({id:t,type:"warning",message:"dateInterval: invalid value '"+(null==i?void 0:i.toString())+"' is not supported."})}validateChartMode(i){const t="ERR_chartMode";["bar","line","auto"].includes(null==i?void 0:i.toLowerCase())?this.errors.remove(t):this.errors.addOrReplace({id:t,type:"warning",message:"chartMode: invalid value '"+(null==i?void 0:i.toString())+"' is not supported. Valid values are: bar, line, auto."})}validateMaxBars(i){const t="ERR_maxBars";!o(i)||i<1?this.errors.addOrReplace({id:t,type:"warning",message:"maxBars: invalid value '"+(null==i?void 0:i.toString())+"' is not supported. Must be a positive integer."}):this.errors.remove(t)}validateStack(i){const t="ERR_stack",e=u(i);e.length>0?this.errors.addOrReplace({id:t,type:"warning",message:e.join("; ")}):this.errors.remove(t)}validateScaling(i){if(null==i||""===i||"none"===i||"auto"===i)return void this.errors.remove("ERR_scale");const t=Number(i);isNaN(t)||t<=0?this.errors.addOrReplace({id:"ERR_scale",type:"warning",message:`Invalid scale value: "${i}". Use "none", "auto", or a positive number.`}):this.errors.remove("ERR_scale")}validateAxisLabelsMode(i){const t="ERR_axisLabelsMode";c(i)?this.errors.remove(t):this.errors.addOrReplace({id:t,type:"warning",message:"axisLabelsMode: invalid value '"+(null==i?void 0:i.toString())+"' is not supported."})}validateLineFullWidth(i){const t="ERR_lineFullWidth";v(i)?this.errors.remove(t):this.errors.addOrReplace({id:t,type:"warning",message:"lineFullWidth: invalid value(s) '"+(null==i?void 0:i.toString())+"' are not supported."})}validateShowCategories(i){const t="ERR_showCategories";v(i)?this.errors.remove(t):this.errors.addOrReplace({id:t,type:"warning",message:"showCategories: invalid value(s) '"+(null==i?void 0:i.toString())+"' are not supported."})}validateMeasureScale(i){const t="ERR_measureScale";g(i)?this.errors.remove(t):this.errors.addOrReplace({id:t,type:"warning",message:"measureScale: invalid value '"+(null==i?void 0:i.toString())+"' is not supported."})}validateShowMeasureScale(i){const t="ERR_grouped";v(i)?this.errors.remove(t):this.errors.addOrReplace({id:t,type:"warning",message:"showMeasureScale: invalid value(s) '"+(null==i?void 0:i.toString())+"' are not supported."})}validateShowOverlayAvg(i){const t="ERR_grouped";v(i)?this.errors.remove(t):this.errors.addOrReplace({id:t,type:"warning",message:"showOverlayAvg: invalid value(s) '"+(null==i?void 0:i.toString())+"' are not supported."})}validateShowOverlayMedian(i){const t="ERR_grouped";v(i)?this.errors.remove(t):this.errors.addOrReplace({id:t,type:"warning",message:"showOverlayMedian: invalid value(s) '"+(null==i?void 0:i.toString())+"' are not supported."})}constructor(t){i(this,t),this.data=[],this.datasetMeta=null,this.appliedScaleFactor=1,this.chartTitle="",this.filter="",this.syncSpaceLeft=-1,this.limit=0,this.chartMode="bar",this.maxBars=28,this.stack="",this.intervalSpanLimit=28,this.lineFullWidth="true",this.showCategories="true",this.measureScale="greatest",this.showMeasureScale="false",this.showOverlayAvg="true",this.showOverlayMedian="false",this.measureUnit="",this.pixelPerUnitGroupMap=new Map,this._autoScaleGuard=!1,m(this),S(this),f(this,((i,t)=>{this.data=t||[]}),((i,t)=>{this.datasetMeta=t})),this.chartTemplate=this.chartTemplate.bind(this),this.errors=_(this),this.componentStyle=x(this),this.t=w(this).t}componentWillLoad(){this.validateScenario(this.scenarios),this.validateVariances(this.variances),this.validateUnitScaling(this.unitScaling),this.validateLimit(this.limit),this.validateLevel(this.level),this.validateOrderDirection(this.orderDirection),this.validateOrderList(this.order),this.validateLeftSync(this.syncSpaceLeft),this.validateDateInterval(this.dateInterval),this.validateAxisLabelsMode(this.axisLabelsMode),this.validateLineFullWidth(this.lineFullWidth),this.validateShowCategories(this.showCategories),this.validateMeasureScale(this.measureScale),this.validateShowMeasureScale(this.showMeasureScale),this.validateShowOverlayAvg(this.showOverlayAvg),this.validateShowOverlayMedian(this.showOverlayMedian),this.validateChartMode(this.chartMode),this.validateMaxBars(this.maxBars),this.validateStack(this.stack),this.validateScaling(this.scale)}componentDidRender(){var i,t;const{mode:e}=O(this.scale);if("auto"!==e&&"empty"!==e){this._autoScaleGuard=!1;const i=b(this.element),t="WARN_overflow";return void(i.width>0&&this.element.scrollWidth>i.width+1?this.errors.addOrReplace({id:t,type:"warning",message:"Chart exceeds available space and will be cut off. Check unit-scaling value."}):this.errors.remove(t))}if(this._autoScaleGuard)return void(this._autoScaleGuard=!1);const s=this.element,{width:a}=b(s);if(a<=0)return;const n=this.componentStyle((i=>{var t;return(null===(t=i.global)||void 0===t?void 0:t.fontSizePx)||13.3333}));s.style.setProperty("--bn-font-size",`${n}px`);const r=null===(i=s.shadowRoot)||void 0===i?void 0:i.querySelector(".container"),o=null!==(t=null==r?void 0:r.scrollWidth)&&void 0!==t?t:s.scrollWidth;if(o<=a+1)return this.errors.remove("AUTO_scale"),void(1!==this.appliedScaleFactor&&(this._autoScaleGuard=!0,this.appliedScaleFactor=1));const l=(a-1)/o;s.style.setProperty("--bn-font-size",n*l+"px"),"empty"===e?this.errors.addOrReplace({id:"AUTO_scale",type:"warning",message:`Auto-scaled chart by factor ${l.toFixed(3)}`}):this.errors.remove("AUTO_scale"),Math.abs(l-this.appliedScaleFactor)>.001&&(this._autoScaleGuard=!0,this.appliedScaleFactor=l)}prepareDimension(){const i=b(this.element),t=this.prepareScenarios(),e=this.prepareVariances();return this.canvasWidthSegmented=i.width/(t.length+e.length||1),{width:this.canvasWidthSegmented,height:i.height}}prepareScenarios(){var i,t,e,s;const a="auto"===(null===(i=this.scenarios)||void 0===i?void 0:i.trim().toLowerCase());return y(this.scenarios)||a?(null===(e=null===(t=this.datasetMeta)||void 0===t?void 0:t.availableScenarios)||void 0===e?void 0:e.length)>0?(a?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===(s=this.scenarios)||void 0===s?void 0:s.split(",").map((i=>i.trim())))}prepareAvg(){return"true"===this.showOverlayAvg}prepareMedian(){return"true"===this.showOverlayMedian}prepareVariances(){var i;return y(this.variances)?[]:null===(i=this.variances)||void 0===i?void 0:i.split(",").map((i=>i.trim()))}prepareHideAxisLabels(i){return i>=1||"true"!==this.showCategories}prepareI18n(){const i=R,t=new Map([].map((i=>[i,this.t(".".concat(i))]))),e=new Map(i.map((i=>[i,this.t("global.".concat(i))])));return new Map([...e.entries(),...t.entries()])}preparePixelPerUnit(){var i;if(this.pixelPerUnitGroupMap.has(this.unitScaling))return this.errors.remove("AUTO_unitScaling"),this.pixelPerUnitGroupMap.get(this.unitScaling);if("auto"===(null===(i=this.unitScaling)||void 0===i?void 0:i.toString().trim().toLowerCase()))return this.errors.remove("AUTO_unitScaling"),0;const t=Number(this.unitScaling);return!isNaN(t)&&t>0?(this.errors.remove("AUTO_unitScaling"),t):(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 i,t,e;const s="auto"===(null===(i=this.level)||void 0===i?void 0:i.trim().toLowerCase());return y(this.level)||s?(null===(t=this.datasetMeta)||void 0===t?void 0:t.suggestedLevel)?(s?this.errors.remove("AUTO_level"):this.errors.addOrReplace({id:"AUTO_level",type:"warning",message:`level: not set, auto-detected: ${this.datasetMeta.suggestedLevel}`}),k[this.datasetMeta.suggestedLevel.toUpperCase()]):void 0:(this.errors.remove("AUTO_level"),k[null===(e=this.level)||void 0===e?void 0:e.toUpperCase()])}prepareOrder(){var i,t,e,s,a,n;let r=(y(this.level)||"auto"===(null===(i=this.level)||void 0===i?void 0:i.trim().toLowerCase()))&&(null===(t=this.datasetMeta)||void 0===t?void 0:t.suggestedLevel)?this.datasetMeta.suggestedLevel:this.level;const o="auto"===(null===(e=this.order)||void 0===e?void 0:e.trim().toLowerCase());return y(this.order)||o?(null===(s=this.datasetMeta)||void 0===s?void 0:s.suggestedLevel)&&(o?this.errors.remove("AUTO_order"):this.errors.addOrReplace({id:"AUTO_order",type:"warning",message:`order: not set, auto-detected: ${r}`})):(this.errors.remove("AUTO_order"),"levelindex"===(null===(a=this.order)||void 0===a?void 0:a.toLocaleLowerCase())&&(r+="Index")),{hierarchy:[A[null==r?void 0:r.toUpperCase()]],direction:M[null===(n=this.orderDirection)||void 0===n?void 0:n.toUpperCase()]}}prepareStyle(){const i=this.getEffectiveScaleFactor();return this.componentStyle((t=>{const e=t.global.fontSizePx*i;return{scaleFactors:{scenarioOffset:t["bn-chart-time"].scaleFactors.scenarioOffset,scenarioLabelToColumn:t["bn-chart-time"].scaleFactors.scenarioLabelToColumn,labelToColumn:.3,labelToColum:t["bn-chart-time"].scaleFactors.labelToColum,labelToAxis:t["bn-chart-time"].scaleFactors.labelToAxis,needleWidth:t["bn-chart-time"].scaleFactors.needleWidth,needleHeadWidth:t["bn-chart-time"].scaleFactors.needleHeadWidth,columnWidth:t["bn-chart-time"].scaleFactors.columnWidth,varianceAxisLineWidth:t["bn-chart-time"].scaleFactors.varianceAxisLineWidth,axisLineWidth:t["bn-chart-time"].scaleFactors.axisLineWidth,auxiliaryLineWidth:t["bn-chart-time"].scaleFactors.auxiliaryLineWidth,scenarioLineWidth:t["bn-chart-time"].scaleFactors.scenarioLineWidth,markerWidth:t["bn-chart-time"].scaleFactors.markerWidth,markerOffset:t["bn-chart-time"].scaleFactors.markerOffset,categoryWidth:t["bn-chart-time"].scaleFactors.categoryWidth,axisTickLength:t["bn-chart-time"].scaleFactors.axisTickLength},fontStyles:{font:`${e}px ${t.global.fontFamily}`,size:e,color:t.global.fontColor,background:t.global.fontBackgroundColor,leading:1.8},axisStyles:t["bn-chart-time"].axisStyles,barStyles:t["bn-chart-time"].barStyles,varianceStyles:t["bn-chart-time"].varianceStyles,padding:t["bn-chart-time"].padding,pattern:null}}))}prepareLeftSideOffset(i,t){return this.syncSpaceLeft>-1?this.syncSpaceLeft:C.getMaxWidthOfArrayItems([...this.prepareVariances(),...this.prepareScenarios(),this.chartTitle],i,t)}prepareChartTitle(i){return i>=1?"":this.chartTitle}prepareLimit(){return Math.floor(Number(this.limit)||0)}prepareDateInterval(){var i,t,e;const s="auto"===(null===(i=this.dateInterval)||void 0===i?void 0:i.trim().toLowerCase());return y(this.dateInterval)||s?(null===(t=this.datasetMeta)||void 0===t?void 0:t.suggestedDateInterval)?(s?this.errors.remove("AUTO_dateInterval"):this.errors.addOrReplace({id:"AUTO_dateInterval",type:"warning",message:`dateInterval: not set, auto-detected: ${this.datasetMeta.suggestedDateInterval}`}),U[this.datasetMeta.suggestedDateInterval.toUpperCase()]):s?U.AUTO:void 0:(this.errors.remove("AUTO_dateInterval"),U[null===(e=this.dateInterval)||void 0===e?void 0:e.toUpperCase()])}prepareIntervalSpanLimit(){return this.intervalSpanLimit}prepareAxisLabelsMode(){var i;return L[null===(i=this.axisLabelsMode)||void 0===i?void 0:i.toUpperCase()]}prepareFilter(){return 0===this.filter.length?"":this.filter}getDataStructure(){return{ITimeChartDataRow:{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:""}}}}prepareMeasureScale(){return y(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(i){return 0===i&&"true"===this.showMeasureScale}prepareMeasureUnit(){return""===this.measureUnit||null==this.measureUnit?"":this.measureUnit}prepareStackConfig(){if(y(this.stack))return null;try{const i=JSON.parse(this.stack);return{by:i.by,mode:i.mode||E.ABSOLUTE,order:i.order||T.DATASET}}catch(i){return null}}prepareLineFullWidth(){return"true"===this.lineFullWidth}prepareChartMode(){var i;const t=null===(i=this.chartMode)||void 0===i?void 0:i.toLowerCase();return"line"===t?I.LINE:"auto"===t?I.AUTO:I.BAR}prepareMaxBars(){return Math.floor(Number(this.maxBars)||28)}chartTemplate(i,e){const s=this.prepareI18n(),a=this.prepareStyle(),n=b(this.element).width,r=this.getEffectiveScaleFactor(),o=this.preparePixelPerUnit(),l=this.preparePixelPerPercentage();return t("ibcs-chart-time",{data:this.data,chartTitle:this.prepareChartTitle(e),scenarios:this.prepareScenarios(),variances:[i],hideAxisLabels:this.prepareHideAxisLabels(e),pixelPerUnit:o>0?o*r:0,pixelPerPercentage:l>0?l*r:0,limit:this.prepareLimit(),leftSideOffsetForHorizontalSync:this.prepareLeftSideOffset(s,a),styles:a,i18n:s,order:this.prepareOrder(),level:this.prepareLevel(),dateInterval:this.prepareDateInterval(),intervalSpanLimit:this.prepareIntervalSpanLimit(),axisLabelsMode:this.prepareAxisLabelsMode(),filter:this.prepareFilter(),"measure-scale":this.prepareMeasureScale(),"measure-unit":this.prepareMeasureUnit(),showOverlayAvg:this.prepareAvg(),showOverlayMedian:this.prepareMedian(),showMeasureScale:this.prepareShowMeasureScale(e),chartMode:this.prepareChartMode(),maxBars:this.prepareMaxBars(),stackConfig:this.prepareStackConfig(),lineFullWidth:this.prepareLineFullWidth(),containerWidth:n,parentDimensions:this.prepareDimension()})}getEffectiveScaleFactor(){const{mode:i,factor:t}=O(this.scale);return"factor"===i?t:"auto"===i||"empty"===i?this.appliedScaleFactor:1}getFontStyles(){const i=this.getEffectiveScaleFactor();return this.componentStyle((t=>{var e,s,a,n;const r=(null===(e=t.global)||void 0===e?void 0:e.fontSizePx)||13.3333;return{"--bn-font-family":(null===(s=t.global)||void 0===s?void 0:s.fontFamily)||"'Noto Sans', sans-serif","--bn-font-size":r*i+"px","--bn-font-color":(null===(a=t.global)||void 0===a?void 0:a.fontColor)||"#000000","--bn-font-background":(null===(n=t.global)||void 0===n?void 0:n.fontBackgroundColor)||"#ffffff"}}))}render(){let i=[""];const s=this.prepareVariances();s.length>0&&(i=[...i,...s]);const a=this.getFontStyles();return t(e,{key:"ed9bf10764443d9b4be0bf05dbbcd858d271993a",style:a},t("div",{key:"c2bda702b470a4ddba2da84d81908d96ce893c8e",class:"container"},i.map(this.chartTemplate)))}get element(){return s(this)}static get watchers(){return{scenarios:[{validateScenario:0}],variances:[{validateVariances:0}],syncSpaceLeft:[{validateLeftSync:0}],limit:[{validateLimit:0}],unitScaling:[{validateUnitScaling:0}],percentageScaling:[{validatePercentageScaling:0}],level:[{validateLevel:0}],order:[{validateOrderList:0}],orderDirection:[{validateOrderDirection:0}],dateInterval:[{validateDateInterval:0}],chartMode:[{validateChartMode:0}],maxBars:[{validateMaxBars:0}],stack:[{validateStack:0}],scale:[{validateScaling:0}],axisLabelsMode:[{validateAxisLabelsMode:0}],lineFullWidth:[{validateLineFullWidth:0}],showCategories:[{validateShowCategories:0}],measureScale:[{validateMeasureScale:0}],showMeasureScale:[{validateShowMeasureScale:0}],showOverlayAvg:[{validateShowOverlayAvg:0}],showOverlayMedian:[{validateShowOverlayMedian:0}]}}};D.style=":host{display:inline-block;position:relative;overflow:visible;}.container{display:flex;flex-direction:column-reverse}.background-image{display:flex;flex-wrap:wrap;justify-content:flex-end}";export{D as bn_chart_time}
1
+ import{r as i,h as t,H as e,g as s}from"./p-JNHhIe7t.js";import{v as a,a as n,i as r,e as o,b as l,c as d,d as h,k as p,h as u,l as c,f as v,g,w as m,j as y}from"./p-DtdQCMzj.js";import{w as f,g as b,p as S}from"./p-DVMu6dEy.js";import{w as O}from"./p-CYjZRKdI.js";import{w}from"./p-CRLgp9-v.js";import{a as R}from"./p-DRikHQE-.js";import{w as x}from"./p-BSfqOkN_.js";import{w as _}from"./p-tzFCK9qn.js";import{O as M,a as A,c as L,S as T,b as E,C as I}from"./p-sqjrku2z.js";import{F as C}from"./p-1jFf17Vj.js";import{D as U}from"./p-B4ySv9KQ.js";import"./p-BFTU3MAI.js";var k;!function(i){i.ROWGROUP="rowGroup",i.ROWGROUPINDEX="rowGroupIndex",i.CATEGORY="category",i.CATEGORYINDEX="categoryIndex",i.SUBCATEGORY="subCategory",i.SUBCATEGORYINDEX="subCategoryIndex"}(k||(k={}));const j=class{validateScenario(i){const t=a(i),e="ERR_scenarios";t.length>0?this.errors.addOrReplace({id:e,type:"warning",message:"scenarios: invalid value(s) '"+JSON.stringify(t)+"' are not supported."}):this.errors.remove(e)}validateVariances(i){const t="ERR_variances",e=n(i);e.length>0?this.errors.addOrReplace({id:t,type:"warning",message:"variances: invalid value(s) '"+JSON.stringify(e)+"' are not supported."}):this.errors.remove(t)}validateLeftSync(i){const t="ERR_syncSpaceLeft";r(i)?this.errors.remove(t):this.errors.addOrReplace({id:t,type:"warning",message:"syncSpaceLeft: invalid value(s) '"+i+"' are not supported."})}validateLimit(i){const t="ERR_limit";o(i)?this.errors.remove(t):this.errors.addOrReplace({id:t,type:"warning",message:"limit: invalid value '"+(null==i?void 0:i.toString())+"' is not supported."})}validateUnitScaling(i){const t="ERR_unitScaling";r(i)||this.pixelPerUnitGroupMap.has(i)?this.errors.remove(t):this.errors.addOrReplace({id:t,type:"warning",message:"unitScaling: invalid value(s) '"+i+"' are not supported."})}validatePercentageScaling(i){const t="ERR_percentageScaling";r(i)||this.pixelPerUnitGroupMap.has(i)?this.errors.remove(t):this.errors.addOrReplace({id:t,type:"warning",message:"percentageScaling: invalid value(s) '"+i+"' are not supported."})}validateLevel(i){const t="ERR_level";l(i)?this.errors.remove(t):this.errors.addOrReplace({id:t,type:"warning",message:"level: invalid value(s) '"+i+"' are not supported."})}validateOrderList(i){const t="ERR_order",e=d(i);e.length>0?this.errors.addOrReplace({id:t,type:"warning",message:"order: invalid value(s) '"+JSON.stringify(e)+"' are not supported."}):this.errors.remove(t)}validateOrderDirection(i){const t="ERR_orderDirection";h(i)?this.errors.remove(t):this.errors.addOrReplace({id:t,type:"warning",message:"orderDirection: invalid value '"+(null==i?void 0:i.toString())+"' is not supported."})}validateDateInterval(i){const t="ERR_dateInterval";p(i)?this.errors.remove(t):this.errors.addOrReplace({id:t,type:"warning",message:"dateInterval: invalid value '"+(null==i?void 0:i.toString())+"' is not supported."})}validateChartMode(i){const t="ERR_chartMode";["bar","line","auto"].includes(null==i?void 0:i.toLowerCase())?this.errors.remove(t):this.errors.addOrReplace({id:t,type:"warning",message:"chartMode: invalid value '"+(null==i?void 0:i.toString())+"' is not supported. Valid values are: bar, line, auto."})}validateMaxBars(i){const t="ERR_maxBars";!o(i)||i<1?this.errors.addOrReplace({id:t,type:"warning",message:"maxBars: invalid value '"+(null==i?void 0:i.toString())+"' is not supported. Must be a positive integer."}):this.errors.remove(t)}validateStack(i){const t="ERR_stack",e=u(i);e.length>0?this.errors.addOrReplace({id:t,type:"warning",message:e.join("; ")}):this.errors.remove(t)}validateScaling(i){if(null==i||""===i||"none"===i||"auto"===i)return void this.errors.remove("ERR_scale");const t=Number(i);isNaN(t)||t<=0?this.errors.addOrReplace({id:"ERR_scale",type:"warning",message:`Invalid scale value: "${i}". Use "none", "auto", or a positive number.`}):this.errors.remove("ERR_scale")}validateAxisLabelsMode(i){const t="ERR_axisLabelsMode";c(i)?this.errors.remove(t):this.errors.addOrReplace({id:t,type:"warning",message:"axisLabelsMode: invalid value '"+(null==i?void 0:i.toString())+"' is not supported."})}validateLineFullWidth(i){const t="ERR_lineFullWidth";v(i)?this.errors.remove(t):this.errors.addOrReplace({id:t,type:"warning",message:"lineFullWidth: invalid value(s) '"+(null==i?void 0:i.toString())+"' are not supported."})}validateShowCategories(i){const t="ERR_showCategories";v(i)?this.errors.remove(t):this.errors.addOrReplace({id:t,type:"warning",message:"showCategories: invalid value(s) '"+(null==i?void 0:i.toString())+"' are not supported."})}validateMeasureScale(i){const t="ERR_measureScale";g(i)?this.errors.remove(t):this.errors.addOrReplace({id:t,type:"warning",message:"measureScale: invalid value '"+(null==i?void 0:i.toString())+"' is not supported."})}validateShowMeasureScale(i){const t="ERR_grouped";v(i)?this.errors.remove(t):this.errors.addOrReplace({id:t,type:"warning",message:"showMeasureScale: invalid value(s) '"+(null==i?void 0:i.toString())+"' are not supported."})}validateShowOverlayAvg(i){const t="ERR_grouped";v(i)?this.errors.remove(t):this.errors.addOrReplace({id:t,type:"warning",message:"showOverlayAvg: invalid value(s) '"+(null==i?void 0:i.toString())+"' are not supported."})}validateShowOverlayMedian(i){const t="ERR_grouped";v(i)?this.errors.remove(t):this.errors.addOrReplace({id:t,type:"warning",message:"showOverlayMedian: invalid value(s) '"+(null==i?void 0:i.toString())+"' are not supported."})}constructor(t){i(this,t),this.data=[],this.datasetMeta=null,this.appliedScaleFactor=1,this.chartTitle="",this.filter="",this.syncSpaceLeft=-1,this.limit=0,this.chartMode="bar",this.maxBars=28,this.stack="",this.intervalSpanLimit=28,this.lineFullWidth="true",this.showCategories="true",this.measureScale="greatest",this.showMeasureScale="false",this.showOverlayAvg="true",this.showOverlayMedian="false",this.measureUnit="",this.pixelPerUnitGroupMap=new Map,this._autoScaleGuard=!1,m(this),O(this),f(this,((i,t)=>{this.data=t||[]}),((i,t)=>{this.datasetMeta=t})),this.chartTemplate=this.chartTemplate.bind(this),this.errors=_(this),this.componentStyle=x(this),this.t=w(this).t}componentWillLoad(){this.validateScenario(this.scenarios),this.validateVariances(this.variances),this.validateUnitScaling(this.unitScaling),this.validateLimit(this.limit),this.validateLevel(this.level),this.validateOrderDirection(this.orderDirection),this.validateOrderList(this.order),this.validateLeftSync(this.syncSpaceLeft),this.validateDateInterval(this.dateInterval),this.validateAxisLabelsMode(this.axisLabelsMode),this.validateLineFullWidth(this.lineFullWidth),this.validateShowCategories(this.showCategories),this.validateMeasureScale(this.measureScale),this.validateShowMeasureScale(this.showMeasureScale),this.validateShowOverlayAvg(this.showOverlayAvg),this.validateShowOverlayMedian(this.showOverlayMedian),this.validateChartMode(this.chartMode),this.validateMaxBars(this.maxBars),this.validateStack(this.stack),this.validateScaling(this.scale)}componentDidRender(){var i,t;const{mode:e}=S(this.scale);if("auto"!==e&&"empty"!==e){this._autoScaleGuard=!1;const i=b(this.element),t="WARN_overflow";return void(i.width>0&&this.element.scrollWidth>i.width+1?this.errors.addOrReplace({id:t,type:"warning",message:"Chart exceeds available space and will be cut off. Check unit-scaling value."}):this.errors.remove(t))}if(this._autoScaleGuard)return void(this._autoScaleGuard=!1);const s=this.element,{width:a}=b(s);if(a<=0)return;const n=this.componentStyle((i=>{var t;return(null===(t=i.global)||void 0===t?void 0:t.fontSizePx)||13.3333}));s.style.setProperty("--bn-font-size",`${n}px`);const r=null===(i=s.shadowRoot)||void 0===i?void 0:i.querySelector(".container"),o=null!==(t=null==r?void 0:r.scrollWidth)&&void 0!==t?t:s.scrollWidth;if(o<=a+1)return this.errors.remove("AUTO_scale"),void(1!==this.appliedScaleFactor&&(this._autoScaleGuard=!0,this.appliedScaleFactor=1));const l=(a-1)/o;s.style.setProperty("--bn-font-size",n*l+"px"),"empty"===e?this.errors.addOrReplace({id:"AUTO_scale",type:"warning",message:`Auto-scaled chart by factor ${l.toFixed(3)}`}):this.errors.remove("AUTO_scale"),Math.abs(l-this.appliedScaleFactor)>.001&&(this._autoScaleGuard=!0,this.appliedScaleFactor=l)}prepareDimension(){const i=b(this.element),t=this.prepareScenarios(),e=this.prepareVariances();return this.canvasWidthSegmented=i.width/(t.length+e.length||1),{width:this.canvasWidthSegmented,height:i.height}}prepareScenarios(){var i,t,e,s;const a="auto"===(null===(i=this.scenarios)||void 0===i?void 0:i.trim().toLowerCase());return y(this.scenarios)||a?(null===(e=null===(t=this.datasetMeta)||void 0===t?void 0:t.availableScenarios)||void 0===e?void 0:e.length)>0?(a?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===(s=this.scenarios)||void 0===s?void 0:s.split(",").map((i=>i.trim())))}prepareAvg(){return"true"===this.showOverlayAvg}prepareMedian(){return"true"===this.showOverlayMedian}prepareVariances(){var i;return y(this.variances)?[]:null===(i=this.variances)||void 0===i?void 0:i.split(",").map((i=>i.trim()))}prepareHideAxisLabels(i){return i>=1||"true"!==this.showCategories}prepareI18n(){const i=R,t=new Map([].map((i=>[i,this.t(".".concat(i))]))),e=new Map(i.map((i=>[i,this.t("global.".concat(i))])));return new Map([...e.entries(),...t.entries()])}preparePixelPerUnit(){var i;if(this.pixelPerUnitGroupMap.has(this.unitScaling))return this.errors.remove("AUTO_unitScaling"),this.pixelPerUnitGroupMap.get(this.unitScaling);if("auto"===(null===(i=this.unitScaling)||void 0===i?void 0:i.toString().trim().toLowerCase()))return this.errors.remove("AUTO_unitScaling"),0;const t=Number(this.unitScaling);return!isNaN(t)&&t>0?(this.errors.remove("AUTO_unitScaling"),t):(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 i,t,e;const s="auto"===(null===(i=this.level)||void 0===i?void 0:i.trim().toLowerCase());return y(this.level)||s?(null===(t=this.datasetMeta)||void 0===t?void 0:t.suggestedLevel)?(s?this.errors.remove("AUTO_level"):this.errors.addOrReplace({id:"AUTO_level",type:"warning",message:`level: not set, auto-detected: ${this.datasetMeta.suggestedLevel}`}),k[this.datasetMeta.suggestedLevel.toUpperCase()]):void 0:(this.errors.remove("AUTO_level"),k[null===(e=this.level)||void 0===e?void 0:e.toUpperCase()])}prepareOrder(){var i,t,e,s,a,n;let r=(y(this.level)||"auto"===(null===(i=this.level)||void 0===i?void 0:i.trim().toLowerCase()))&&(null===(t=this.datasetMeta)||void 0===t?void 0:t.suggestedLevel)?this.datasetMeta.suggestedLevel:this.level;const o="auto"===(null===(e=this.order)||void 0===e?void 0:e.trim().toLowerCase());return y(this.order)||o?(null===(s=this.datasetMeta)||void 0===s?void 0:s.suggestedLevel)&&(o?this.errors.remove("AUTO_order"):this.errors.addOrReplace({id:"AUTO_order",type:"warning",message:`order: not set, auto-detected: ${r}`})):(this.errors.remove("AUTO_order"),"levelindex"===(null===(a=this.order)||void 0===a?void 0:a.toLocaleLowerCase())&&(r+="Index")),{hierarchy:[A[null==r?void 0:r.toUpperCase()]],direction:M[null===(n=this.orderDirection)||void 0===n?void 0:n.toUpperCase()]}}prepareStyle(){const i=this.getEffectiveScaleFactor();return this.componentStyle((t=>{const e=t.global.fontSizePx*i;return{scaleFactors:{scenarioOffset:t["bn-chart-time"].scaleFactors.scenarioOffset,scenarioLabelToColumn:t["bn-chart-time"].scaleFactors.scenarioLabelToColumn,labelToColumn:.3,labelToColum:t["bn-chart-time"].scaleFactors.labelToColum,labelToAxis:t["bn-chart-time"].scaleFactors.labelToAxis,needleWidth:t["bn-chart-time"].scaleFactors.needleWidth,needleHeadWidth:t["bn-chart-time"].scaleFactors.needleHeadWidth,columnWidth:t["bn-chart-time"].scaleFactors.columnWidth,varianceAxisLineWidth:t["bn-chart-time"].scaleFactors.varianceAxisLineWidth,axisLineWidth:t["bn-chart-time"].scaleFactors.axisLineWidth,auxiliaryLineWidth:t["bn-chart-time"].scaleFactors.auxiliaryLineWidth,scenarioLineWidth:t["bn-chart-time"].scaleFactors.scenarioLineWidth,markerWidth:t["bn-chart-time"].scaleFactors.markerWidth,markerOffset:t["bn-chart-time"].scaleFactors.markerOffset,categoryWidth:t["bn-chart-time"].scaleFactors.categoryWidth,axisTickLength:t["bn-chart-time"].scaleFactors.axisTickLength},fontStyles:{font:`${e}px ${t.global.fontFamily}`,size:e,color:t.global.fontColor,background:t.global.fontBackgroundColor,leading:1.8},axisStyles:t["bn-chart-time"].axisStyles,barStyles:t["bn-chart-time"].barStyles,varianceStyles:t["bn-chart-time"].varianceStyles,padding:t["bn-chart-time"].padding,pattern:null}}))}prepareLeftSideOffset(i,t){return this.syncSpaceLeft>-1?this.syncSpaceLeft:C.getMaxWidthOfArrayItems([...this.prepareVariances(),...this.prepareScenarios(),this.chartTitle],i,t)}prepareChartTitle(i){return i>=1?"":this.chartTitle}prepareLimit(){return Math.floor(Number(this.limit)||0)}prepareDateInterval(){var i,t,e;const s="auto"===(null===(i=this.dateInterval)||void 0===i?void 0:i.trim().toLowerCase());return y(this.dateInterval)||s?(null===(t=this.datasetMeta)||void 0===t?void 0:t.suggestedDateInterval)?(s?this.errors.remove("AUTO_dateInterval"):this.errors.addOrReplace({id:"AUTO_dateInterval",type:"warning",message:`dateInterval: not set, auto-detected: ${this.datasetMeta.suggestedDateInterval}`}),U[this.datasetMeta.suggestedDateInterval.toUpperCase()]):s?U.AUTO:void 0:(this.errors.remove("AUTO_dateInterval"),U[null===(e=this.dateInterval)||void 0===e?void 0:e.toUpperCase()])}prepareIntervalSpanLimit(){return this.intervalSpanLimit}prepareAxisLabelsMode(){var i;return L[null===(i=this.axisLabelsMode)||void 0===i?void 0:i.toUpperCase()]}prepareFilter(){return 0===this.filter.length?"":this.filter}getDataStructure(){return{ITimeChartDataRow:{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:""}}}}prepareMeasureScale(){return y(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(i){return 0===i&&"true"===this.showMeasureScale}prepareMeasureUnit(){return""===this.measureUnit||null==this.measureUnit?"":this.measureUnit}prepareStackConfig(){if(y(this.stack))return null;try{const i=JSON.parse(this.stack);return{by:i.by,mode:i.mode||E.ABSOLUTE,order:i.order||T.DATASET}}catch(i){return null}}prepareLineFullWidth(){return"true"===this.lineFullWidth}prepareChartMode(){var i;const t=null===(i=this.chartMode)||void 0===i?void 0:i.toLowerCase();return"line"===t?I.LINE:"auto"===t?I.AUTO:I.BAR}prepareMaxBars(){return Math.floor(Number(this.maxBars)||28)}chartTemplate(i,e){const s=this.prepareI18n(),a=this.prepareStyle(),n=b(this.element).width,r=this.getEffectiveScaleFactor(),o=this.preparePixelPerUnit(),l=this.preparePixelPerPercentage();return t("ibcs-chart-time",{data:this.data,chartTitle:this.prepareChartTitle(e),scenarios:this.prepareScenarios(),variances:[i],hideAxisLabels:this.prepareHideAxisLabels(e),pixelPerUnit:o>0?o*r:0,pixelPerPercentage:l>0?l*r:0,limit:this.prepareLimit(),leftSideOffsetForHorizontalSync:this.prepareLeftSideOffset(s,a),styles:a,i18n:s,order:this.prepareOrder(),level:this.prepareLevel(),dateInterval:this.prepareDateInterval(),intervalSpanLimit:this.prepareIntervalSpanLimit(),axisLabelsMode:this.prepareAxisLabelsMode(),filter:this.prepareFilter(),"measure-scale":this.prepareMeasureScale(),"measure-unit":this.prepareMeasureUnit(),showOverlayAvg:this.prepareAvg(),showOverlayMedian:this.prepareMedian(),showMeasureScale:this.prepareShowMeasureScale(e),chartMode:this.prepareChartMode(),maxBars:this.prepareMaxBars(),stackConfig:this.prepareStackConfig(),lineFullWidth:this.prepareLineFullWidth(),containerWidth:n,parentDimensions:this.prepareDimension()})}getEffectiveScaleFactor(){const{mode:i,factor:t}=S(this.scale);return"factor"===i?t:"auto"===i||"empty"===i?this.appliedScaleFactor:1}getFontStyles(){const i=this.getEffectiveScaleFactor();return this.componentStyle((t=>{var e,s,a,n;const r=(null===(e=t.global)||void 0===e?void 0:e.fontSizePx)||13.3333;return{"--bn-font-family":(null===(s=t.global)||void 0===s?void 0:s.fontFamily)||"'Noto Sans', sans-serif","--bn-font-size":r*i+"px","--bn-font-color":(null===(a=t.global)||void 0===a?void 0:a.fontColor)||"#000000","--bn-font-background":(null===(n=t.global)||void 0===n?void 0:n.fontBackgroundColor)||"#ffffff"}}))}render(){let i=[""];const s=this.prepareVariances();s.length>0&&(i=[...i,...s]);const a=this.getFontStyles();return t(e,{key:"ed9bf10764443d9b4be0bf05dbbcd858d271993a",style:a},t("div",{key:"c2bda702b470a4ddba2da84d81908d96ce893c8e",class:"container"},i.map(this.chartTemplate)))}get element(){return s(this)}static get watchers(){return{scenarios:[{validateScenario:0}],variances:[{validateVariances:0}],syncSpaceLeft:[{validateLeftSync:0}],limit:[{validateLimit:0}],unitScaling:[{validateUnitScaling:0}],percentageScaling:[{validatePercentageScaling:0}],level:[{validateLevel:0}],order:[{validateOrderList:0}],orderDirection:[{validateOrderDirection:0}],dateInterval:[{validateDateInterval:0}],chartMode:[{validateChartMode:0}],maxBars:[{validateMaxBars:0}],stack:[{validateStack:0}],scale:[{validateScaling:0}],axisLabelsMode:[{validateAxisLabelsMode:0}],lineFullWidth:[{validateLineFullWidth:0}],showCategories:[{validateShowCategories:0}],measureScale:[{validateMeasureScale:0}],showMeasureScale:[{validateShowMeasureScale:0}],showOverlayAvg:[{validateShowOverlayAvg:0}],showOverlayMedian:[{validateShowOverlayMedian:0}]}}};j.style=":host{display:inline-block;position:relative;overflow:visible;}.container{display:flex;flex-direction:column-reverse}.background-image{display:flex;flex-wrap:wrap;justify-content:flex-end}";export{j as bn_chart_time}
@@ -1 +1 @@
1
- import{D as t}from"./p-DdexOqTs.js";var e,s;!function(t){t.YEAR="year",t.QUARTER="quarter",t.MONTH="month",t.WEEK="week",t.DAY="day",t.HOUR="hour",t.MINUTE="minute",t.SECOND="second",t.MILLISECOND="millisecond",t.NONE="fallback",t.AUTO="auto"}(e||(e={})),function(t){t.AVG="avg",t.INTERVAL="interval",t.START="start",t.END="end",t.YTD="ytd",t.YTG="ytg",t.CUM="cum",t.MAT="mat",t.NONE="none",t.AUTO="auto"}(s||(s={}));class r{constructor(){this._dateFormat={year:"yyyy",quarter:"q'Q' yyyy",month:"LLL yyyy",week:"'KW'WW yyyy",day:"dd.MM.yyyy",hour:"TT",minute:"TT",second:"TT",millisecond:"TT:SSS",fallback:"dd.MM.yyyy"},this._dateFormatShort={year:"yy",quarter:"q'Q'",month:"LLL",week:"'KW'WW",day:"dd",hour:"hh'h'",minute:"mm'm'",second:"ss's'",millisecond:"SSS'ms'",fallback:"dd.MM.yyyy"},this._dateLinkFormat={avg:"Ø[LINK]",interval:"[DATE]..[DATE2]",start:".[DATE]",end:"[DATE].",ytd:"_[DATE]",ytg:"[DATE]_",cum:"[DATE]_[DATE2]",mat:"~[DATE]",none:"[DATE]"},this.locale="de",this.dateFormat=this._dateFormat,this.dateLinkFormat=this._dateLinkFormat,this.dateFormatShort=this._dateFormatShort}setDateLinkFormat(t){this.dateLinkFormat=t}setDateFormat(t){this.dateFormat=t}setDateFormatShort(t){this.dateFormatShort=t}setLocale(t){this.locale=t}getDateString(t,e){return t.setLocale(this.locale).toFormat(this.dateFormat[e]||this.dateFormat.fallback)}getSmartDateString(t,s){switch(s){case e.DAY:return this.getFormatedDayDate(t);case e.MONTH:return this.getFormatedMonthDate(t);case e.QUARTER:return this.getFormatedQuarterDate(t);case e.WEEK:return this.getFormatedWeekDate(t);case e.HOUR:return this.getFormatedHourDate(t);case e.MINUTE:return this.getFormatedMinuteDate(t);case e.SECOND:return this.getFormatedSecondDate(t);case e.MILLISECOND:return this.getFormatedMilliSecondDate(t);default:return this.getDateString(t,s)}}calculateDistanceType(s,r,i=32){if(null==r)return e.DAY;const a="number"==typeof s?t.fromMillis(s):s,n="number"==typeof r?t.fromMillis(r):r;return 0===n.diff(a).as("milliseconds")?e.DAY:n.diff(a).as("milliseconds")<i?e.MILLISECOND:n.diff(a).as("seconds")<i?e.SECOND:n.diff(a).as("minutes")<i?e.MINUTE:n.diff(a).as("hours")<i?e.HOUR:n.diff(a).as("days")<i?e.DAY:n.diff(a).as("weeks")<i?e.WEEK:n.diff(a).as("months")<i?e.MONTH:n.diff(a).as("quarters")<i?e.QUARTER:e.YEAR}datesBetween(t,e,s,r){const i=this.convertDateDistanceToMomentunitOfTime(s),a=t.startOf(i),n=e.endOf(i);let h=n.diff(a).as(i);const u=[];h>=r&&(h=r);let o=a;do{u.push(o),o=o.plus(this.createDiratonLike(i,1))}while(o<=n&&u.length<h);return u}getDateLinkString(r,i,a,n,h){if(null==r&&null==i)return"";if(null==r&&a!==s.END&&a!==s.YTD)return"";if(null==i&&(s.INTERVAL===a||s.CUM===a||s.END===a||s.YTD===a))return"";const u=r||t.now(),o=i;n===e.AUTO&&(n=this.calculateDistanceType(u,o,h));let c=this.getDateString(u,n),l="",d=s.NONE;return null!=o&&(l=this.getDateString(o,n),d=s.INTERVAL,c===l&&a===s.INTERVAL&&(a=s.NONE),c===l&&a===s.AVG&&(d=s.NONE),s.END!==a&&s.YTD!==a||(c=l),(a===s.INTERVAL||a===s.CUM||s.AVG)&&(n===e.QUARTER?u.quarter===o.quarter&&u.year===o.year?l=l.replace(" "+o.year,""):u.year===o.year&&(c=c.replace(" "+u.year,"")):n===e.MONTH?u.month===o.month&&u.year===o.year?l=l.replace(" "+o.year,""):u.year===o.year&&(c=c.replace(" "+u.year,"")):n===e.WEEK&&(u.weekNumber===o.weekNumber&&u.year===o.year?l=l.replace(" "+o.year,""):u.year===o.year&&(c=c.replace(" "+u.year,""))))),this.dateLinkFormat[a].replace("[LINK]",this.dateLinkFormat[d]).replace("[DATE]",c).replace("[DATE2]",l)}getShortDateString(t,e){return t.setLocale(this.locale).toFormat(this.dateFormatShort[e]||this.dateFormatShort.fallback)}getFormatedDayDate(t){let e=this.dateFormatShort.day;return this.isFirstInMonth(t)&&(e+=" "+this.dateFormatShort.month),this.isJanuary(t)&&(e+=" "+this.dateFormatShort.year),t.setLocale(this.locale).toFormat(e)}getFormatedMonthDate(t){let e=this.dateFormatShort.month;return this.isJanuary(t)&&(e+=" "+this.dateFormatShort.year),t.setLocale(this.locale).toFormat(e)}getFormatedQuarterDate(t){let e=this.dateFormatShort.quarter;return this.isFirstQuarter(t)&&(e+=" "+this.dateFormatShort.year),t.setLocale(this.locale).toFormat(e)}getFormatedWeekDate(t){let e=this.dateFormatShort.week;return this.isFirstWeek(t)&&(e+=" "+this.dateFormatShort.year),t.setLocale(this.locale).toFormat(e)}getFormatedHourDate(t){let e=this.dateFormatShort.hour;return this.isFirstHour(t)&&(e+=" "+this.dateFormatShort.day),t.setLocale(this.locale).toFormat(e)}getFormatedMinuteDate(t){let e=this.dateFormatShort.minute;return this.isFirstMinute(t)&&(e=this.dateFormatShort.hour+":"+e),t.setLocale(this.locale).toFormat(e)}getFormatedSecondDate(t){let e=this.dateFormatShort.second;return this.isFirstSecond(t)&&(e=this.dateFormatShort.minute+":"+e),t.setLocale(this.locale).toFormat(e)}getFormatedMilliSecondDate(t){let e=this.dateFormatShort.millisecond;return this.isFirstMilliSecond(t)&&(e=this.dateFormatShort.second+":"+e),t.setLocale(this.locale).toFormat(e)}isFirstInMonth(t){return 1===t.day}isJanuary(t){return 1===t.month}isFirstQuarter(t){return 1===t.quarter}isFirstWeek(t){return 1===t.weekNumber}isFirstHour(t){return 0===t.hour}isFirstMinute(t){return 0===t.minute}isFirstSecond(t){return 0===t.second}isFirstMilliSecond(t){return 0===t.millisecond}convertDateDistanceToMomentunitOfTime(t){let s;switch(t){case e.YEAR:s="year";break;case e.MONTH:s="month";break;case e.QUARTER:s="quarter";break;case e.WEEK:s="week";break;case e.DAY:s="day";break;case e.HOUR:s="hour";break;case e.MINUTE:s="minute";break;case e.SECOND:s="second";break;case e.MILLISECOND:s="millisecond";break;default:s="day"}return s}createDiratonLike(t,e){switch(t){case"year":return{years:e};case"month":return{months:e};case"quarter":return{quarters:e};case"week":return{weeks:e};case"day":default:return{days:e};case"hour":return{hours:e};case"minute":return{minutes:e};case"second":return{seconds:e};case"millisecond":return{milliseconds:e}}}}export{e as D,s as a,r as b}
1
+ import{D as t}from"./p-sqjrku2z.js";var e,s;!function(t){t.YEAR="year",t.QUARTER="quarter",t.MONTH="month",t.WEEK="week",t.DAY="day",t.HOUR="hour",t.MINUTE="minute",t.SECOND="second",t.MILLISECOND="millisecond",t.NONE="fallback",t.AUTO="auto"}(e||(e={})),function(t){t.AVG="avg",t.INTERVAL="interval",t.START="start",t.END="end",t.YTD="ytd",t.YTG="ytg",t.CUM="cum",t.MAT="mat",t.NONE="none",t.AUTO="auto"}(s||(s={}));class r{constructor(){this._dateFormat={year:"yyyy",quarter:"q'Q' yyyy",month:"LLL yyyy",week:"'KW'WW yyyy",day:"dd.MM.yyyy",hour:"TT",minute:"TT",second:"TT",millisecond:"TT:SSS",fallback:"dd.MM.yyyy"},this._dateFormatShort={year:"yy",quarter:"q'Q'",month:"LLL",week:"'KW'WW",day:"dd",hour:"hh'h'",minute:"mm'm'",second:"ss's'",millisecond:"SSS'ms'",fallback:"dd.MM.yyyy"},this._dateLinkFormat={avg:"Ø[LINK]",interval:"[DATE]..[DATE2]",start:".[DATE]",end:"[DATE].",ytd:"_[DATE]",ytg:"[DATE]_",cum:"[DATE]_[DATE2]",mat:"~[DATE]",none:"[DATE]"},this.locale="de",this.dateFormat=this._dateFormat,this.dateLinkFormat=this._dateLinkFormat,this.dateFormatShort=this._dateFormatShort}setDateLinkFormat(t){this.dateLinkFormat=t}setDateFormat(t){this.dateFormat=t}setDateFormatShort(t){this.dateFormatShort=t}setLocale(t){this.locale=t}getDateString(t,e){return t.setLocale(this.locale).toFormat(this.dateFormat[e]||this.dateFormat.fallback)}getSmartDateString(t,s){switch(s){case e.DAY:return this.getFormatedDayDate(t);case e.MONTH:return this.getFormatedMonthDate(t);case e.QUARTER:return this.getFormatedQuarterDate(t);case e.WEEK:return this.getFormatedWeekDate(t);case e.HOUR:return this.getFormatedHourDate(t);case e.MINUTE:return this.getFormatedMinuteDate(t);case e.SECOND:return this.getFormatedSecondDate(t);case e.MILLISECOND:return this.getFormatedMilliSecondDate(t);default:return this.getDateString(t,s)}}calculateDistanceType(s,r,i=32){if(null==r)return e.DAY;const a="number"==typeof s?t.fromMillis(s):s,n="number"==typeof r?t.fromMillis(r):r;return 0===n.diff(a).as("milliseconds")?e.DAY:n.diff(a).as("milliseconds")<i?e.MILLISECOND:n.diff(a).as("seconds")<i?e.SECOND:n.diff(a).as("minutes")<i?e.MINUTE:n.diff(a).as("hours")<i?e.HOUR:n.diff(a).as("days")<i?e.DAY:n.diff(a).as("weeks")<i?e.WEEK:n.diff(a).as("months")<i?e.MONTH:n.diff(a).as("quarters")<i?e.QUARTER:e.YEAR}datesBetween(t,e,s,r){const i=this.convertDateDistanceToMomentunitOfTime(s),a=t.startOf(i),n=e.endOf(i);let h=n.diff(a).as(i);const u=[];h>=r&&(h=r);let o=a;do{u.push(o),o=o.plus(this.createDiratonLike(i,1))}while(o<=n&&u.length<h);return u}getDateLinkString(r,i,a,n,h){if(null==r&&null==i)return"";if(null==r&&a!==s.END&&a!==s.YTD)return"";if(null==i&&(s.INTERVAL===a||s.CUM===a||s.END===a||s.YTD===a))return"";const u=r||t.now(),o=i;n===e.AUTO&&(n=this.calculateDistanceType(u,o,h));let c=this.getDateString(u,n),l="",d=s.NONE;return null!=o&&(l=this.getDateString(o,n),d=s.INTERVAL,c===l&&a===s.INTERVAL&&(a=s.NONE),c===l&&a===s.AVG&&(d=s.NONE),s.END!==a&&s.YTD!==a||(c=l),(a===s.INTERVAL||a===s.CUM||s.AVG)&&(n===e.QUARTER?u.quarter===o.quarter&&u.year===o.year?l=l.replace(" "+o.year,""):u.year===o.year&&(c=c.replace(" "+u.year,"")):n===e.MONTH?u.month===o.month&&u.year===o.year?l=l.replace(" "+o.year,""):u.year===o.year&&(c=c.replace(" "+u.year,"")):n===e.WEEK&&(u.weekNumber===o.weekNumber&&u.year===o.year?l=l.replace(" "+o.year,""):u.year===o.year&&(c=c.replace(" "+u.year,""))))),this.dateLinkFormat[a].replace("[LINK]",this.dateLinkFormat[d]).replace("[DATE]",c).replace("[DATE2]",l)}getShortDateString(t,e){return t.setLocale(this.locale).toFormat(this.dateFormatShort[e]||this.dateFormatShort.fallback)}getFormatedDayDate(t){let e=this.dateFormatShort.day;return this.isFirstInMonth(t)&&(e+=" "+this.dateFormatShort.month),this.isJanuary(t)&&(e+=" "+this.dateFormatShort.year),t.setLocale(this.locale).toFormat(e)}getFormatedMonthDate(t){let e=this.dateFormatShort.month;return this.isJanuary(t)&&(e+=" "+this.dateFormatShort.year),t.setLocale(this.locale).toFormat(e)}getFormatedQuarterDate(t){let e=this.dateFormatShort.quarter;return this.isFirstQuarter(t)&&(e+=" "+this.dateFormatShort.year),t.setLocale(this.locale).toFormat(e)}getFormatedWeekDate(t){let e=this.dateFormatShort.week;return this.isFirstWeek(t)&&(e+=" "+this.dateFormatShort.year),t.setLocale(this.locale).toFormat(e)}getFormatedHourDate(t){let e=this.dateFormatShort.hour;return this.isFirstHour(t)&&(e+=" "+this.dateFormatShort.day),t.setLocale(this.locale).toFormat(e)}getFormatedMinuteDate(t){let e=this.dateFormatShort.minute;return this.isFirstMinute(t)&&(e=this.dateFormatShort.hour+":"+e),t.setLocale(this.locale).toFormat(e)}getFormatedSecondDate(t){let e=this.dateFormatShort.second;return this.isFirstSecond(t)&&(e=this.dateFormatShort.minute+":"+e),t.setLocale(this.locale).toFormat(e)}getFormatedMilliSecondDate(t){let e=this.dateFormatShort.millisecond;return this.isFirstMilliSecond(t)&&(e=this.dateFormatShort.second+":"+e),t.setLocale(this.locale).toFormat(e)}isFirstInMonth(t){return 1===t.day}isJanuary(t){return 1===t.month}isFirstQuarter(t){return 1===t.quarter}isFirstWeek(t){return 1===t.weekNumber}isFirstHour(t){return 0===t.hour}isFirstMinute(t){return 0===t.minute}isFirstSecond(t){return 0===t.second}isFirstMilliSecond(t){return 0===t.millisecond}convertDateDistanceToMomentunitOfTime(t){let s;switch(t){case e.YEAR:s="year";break;case e.MONTH:s="month";break;case e.QUARTER:s="quarter";break;case e.WEEK:s="week";break;case e.DAY:s="day";break;case e.HOUR:s="hour";break;case e.MINUTE:s="minute";break;case e.SECOND:s="second";break;case e.MILLISECOND:s="millisecond";break;default:s="day"}return s}createDiratonLike(t,e){switch(t){case"year":return{years:e};case"month":return{months:e};case"quarter":return{quarters:e};case"week":return{weeks:e};case"day":default:return{days:e};case"hour":return{hours:e};case"minute":return{minutes:e};case"second":return{seconds:e};case"millisecond":return{milliseconds:e}}}}export{e as D,s as a,r as b}
@@ -1 +1 @@
1
- import{a as e}from"./p-BYmPQYxx.js";import{e as t}from"./p-DdexOqTs.js";class s{constructor(e="",t=1){this.prefix=e,this.value=t}}var a;!function(e){e[e.Y=1e24]="Y",e[e.Z=1e21]="Z",e[e.E=1e18]="E",e[e.P=1e15]="P",e[e.T=1e12]="T",e[e.G=1e9]="G",e[e.M=1e6]="M",e[e.k=1e3]="k",e[e.h=100]="h",e[e.da=10]="da",e[e.d=.1]="d",e[e.c=.01]="c",e[e.m=.001]="m",e[e.my=1e-6]="my",e[e.n=1e-9]="n",e[e.p=1e-12]="p",e[e.f=1e-15]="f",e[e.a=1e-18]="a",e[e.z=1e-21]="z",e[e.y=1e-24]="y"}(a||(a={}));class r{static calculateMeasureScale(t,a,r){var n;if("_"===r)return new s;if(null!=r&&[...this.unitsLeast,...this.unitsGreat].includes(r))return this.lookupPrefix(r);if(0===a.length)return new s;const i=`SELECT MAX(GREATEST(${a.filter((e=>3===e.length)).map((e=>"ABS("+e+")")).toString()})) as prefixvalue\n FROM ?`,u=`SELECT MIN(LEAST(${a.filter((e=>3===e.length)).map((e=>"ABS("+e+")")).toString()})) as prefixvalue\n FROM ?`;let c=i;"LEAST"===(null==r?void 0:r.toUpperCase())&&(c=u);const o=null===(n=e(c,[t])[0])||void 0===n?void 0:n.prefixvalue;return this.determinePrefix(Math.abs(o))}static determinePrefix(e){if(e>=1e3){const t=Math.floor(Math.floor(Math.abs(e)).toString().length/3),a=+Math.pow(1e3,t);return new s(this.unitsGreat[t-1],a)}if(e<=.001){const t=Math.floor(Math.abs(e).toString().length/3),a=1/Math.pow(1e3,t);return new s(this.unitsLeast[t-1],a)}return new s}static lookupPrefix(e){return new s(e,a[e])}}r.unitsGreat=["k","M","G","T","P","E","Z","Y"],r.unitsLeast=["m","my","n","p","P","f","a","z","y"];class n{constructor(e=2,t=1){this.percent=e,this.decimal=t}}class i{adapt(e){const s=new n;return t.isNumber(e.percent)&&(s.percent=e.percent),t.isNumber(e.decimal)&&(s.decimal=e.decimal),s}default(){return new n}}export{r as D,s as S,n as a,i as b}
1
+ import{a as e}from"./p-BYmPQYxx.js";import{e as t}from"./p-sqjrku2z.js";class s{constructor(e="",t=1){this.prefix=e,this.value=t}}var a;!function(e){e[e.Y=1e24]="Y",e[e.Z=1e21]="Z",e[e.E=1e18]="E",e[e.P=1e15]="P",e[e.T=1e12]="T",e[e.G=1e9]="G",e[e.M=1e6]="M",e[e.k=1e3]="k",e[e.h=100]="h",e[e.da=10]="da",e[e.d=.1]="d",e[e.c=.01]="c",e[e.m=.001]="m",e[e.my=1e-6]="my",e[e.n=1e-9]="n",e[e.p=1e-12]="p",e[e.f=1e-15]="f",e[e.a=1e-18]="a",e[e.z=1e-21]="z",e[e.y=1e-24]="y"}(a||(a={}));class r{static calculateMeasureScale(t,a,r){var n;if("_"===r)return new s;if(null!=r&&[...this.unitsLeast,...this.unitsGreat].includes(r))return this.lookupPrefix(r);if(0===a.length)return new s;const i=`SELECT MAX(GREATEST(${a.filter((e=>3===e.length)).map((e=>"ABS("+e+")")).toString()})) as prefixvalue\n FROM ?`,u=`SELECT MIN(LEAST(${a.filter((e=>3===e.length)).map((e=>"ABS("+e+")")).toString()})) as prefixvalue\n FROM ?`;let c=i;"LEAST"===(null==r?void 0:r.toUpperCase())&&(c=u);const o=null===(n=e(c,[t])[0])||void 0===n?void 0:n.prefixvalue;return this.determinePrefix(Math.abs(o))}static determinePrefix(e){if(e>=1e3){const t=Math.floor(Math.floor(Math.abs(e)).toString().length/3),a=+Math.pow(1e3,t);return new s(this.unitsGreat[t-1],a)}if(e<=.001){const t=Math.floor(Math.abs(e).toString().length/3),a=1/Math.pow(1e3,t);return new s(this.unitsLeast[t-1],a)}return new s}static lookupPrefix(e){return new s(e,a[e])}}r.unitsGreat=["k","M","G","T","P","E","Z","Y"],r.unitsLeast=["m","my","n","p","P","f","a","z","y"];class n{constructor(e=2,t=1){this.percent=e,this.decimal=t}}class i{adapt(e){const s=new n;return t.isNumber(e.percent)&&(s.percent=e.percent),t.isNumber(e.decimal)&&(s.decimal=e.decimal),s}default(){return new n}}export{r as D,s as S,n as a,i as b}