@bino-bi/bn-template-engine 1.0.0-next.21 → 1.0.0-next.22

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 (84) hide show
  1. package/dist/bn-template-engine/bn-template-engine.esm.js +1 -1
  2. package/dist/bn-template-engine/{p-99477a27.entry.js → p-445c76cd.entry.js} +1 -1
  3. package/dist/bn-template-engine/p-7d1083f6.entry.js +1 -0
  4. package/dist/bn-template-engine/{p-7e9dbc93.entry.js → p-91e5dddf.entry.js} +1 -1
  5. package/dist/bn-template-engine/{p-b9e94127.entry.js → p-93eaded3.entry.js} +1 -1
  6. package/dist/bn-template-engine/{p-BpWWgN6k.js → p-D1SJ10zl.js} +1 -1
  7. package/dist/bn-template-engine/p-D75i_YOP.js +1 -0
  8. package/dist/bn-template-engine/{p-A8xyE4b1.js → p-Da6p_F4J.js} +1 -1
  9. package/dist/bn-template-engine/{p-a1380d7c.entry.js → p-c3383557.entry.js} +1 -1
  10. package/dist/bn-template-engine/{p-ba912130.entry.js → p-cda4322a.entry.js} +1 -1
  11. package/dist/bn-template-engine/{p-6c7f0076.entry.js → p-e49f9170.entry.js} +1 -1
  12. package/dist/bn-template-engine/{p-6077155f.entry.js → p-f275b9fe.entry.js} +1 -1
  13. package/dist/cjs/bn-asset_21.cjs.entry.js +369 -122
  14. package/dist/cjs/bn-chart-bubble.cjs.entry.js +18 -8
  15. package/dist/cjs/bn-chart-bullet.cjs.entry.js +3 -3
  16. package/dist/cjs/bn-chart-scatter.cjs.entry.js +3 -3
  17. package/dist/cjs/bn-grid.cjs.entry.js +1 -1
  18. package/dist/cjs/bn-image.cjs.entry.js +1 -1
  19. package/dist/cjs/bn-template-engine.cjs.js +1 -1
  20. package/dist/cjs/bn-text.cjs.entry.js +2 -2
  21. package/dist/cjs/bn-tree.cjs.entry.js +1 -1
  22. package/dist/cjs/{layoutObserver-DUYYkDMQ.js → layoutObserver-D8leSb4j.js} +1 -1
  23. package/dist/cjs/loader.cjs.js +1 -1
  24. package/dist/cjs/{scaling-BIJQ2NV1.js → scaling-B6_M_HWH.js} +82 -0
  25. package/dist/cjs/{withStyled-Cm9dWQhu.js → withStyled-DuwvaDMp.js} +3 -3
  26. package/dist/collection/components/bn-chart-bubble/bn-chart-bubble.js +15 -5
  27. package/dist/collection/components/bn-chart-structure/bn-chart-structure.js +81 -39
  28. package/dist/collection/components/bn-chart-structure/ibcs-chart-structure.js +34 -0
  29. package/dist/collection/components/bn-chart-time/bn-chart-time.js +80 -35
  30. package/dist/collection/components/bn-chart-time/ibcs-chart-time.js +34 -0
  31. package/dist/collection/components/bn-scaling-group/bn-scaling-group.js +76 -19
  32. package/dist/collection/components/bn-table/bn-table.js +111 -45
  33. package/dist/collection/components/bn-table/ibcs-table.js +37 -2
  34. package/dist/collection/components/bn-table/utils/elements/CellBarChart.js +2 -2
  35. package/dist/collection/utils/dataAnalyzer.js +17 -8
  36. package/dist/collection/utils/scaling.js +79 -0
  37. package/dist/collection/utils/validate.js +3 -3
  38. package/dist/components/DataFormatDigits.js +1 -1
  39. package/dist/components/bn-chart-bubble.js +1 -1
  40. package/dist/components/bn-chart-bullet.js +1 -1
  41. package/dist/components/bn-chart-scatter.js +1 -1
  42. package/dist/components/bn-chart-structure.js +1 -1
  43. package/dist/components/bn-chart-time.js +1 -1
  44. package/dist/components/bn-grid.js +1 -1
  45. package/dist/components/bn-scaling-group.js +1 -1
  46. package/dist/components/bn-table.js +1 -1
  47. package/dist/components/bn-text.js +1 -1
  48. package/dist/components/bn-tree.js +1 -1
  49. package/dist/components/ibcs-chart-structure2.js +1 -1
  50. package/dist/components/ibcs-chart-time2.js +1 -1
  51. package/dist/components/ibcs-table2.js +1 -1
  52. package/dist/components/scaling.js +1 -0
  53. package/dist/components/validate.js +1 -1
  54. package/dist/components/withDataset.js +1 -1
  55. package/dist/components/withStyled.js +1 -1
  56. package/dist/esm/bn-asset_21.entry.js +369 -122
  57. package/dist/esm/bn-chart-bubble.entry.js +18 -8
  58. package/dist/esm/bn-chart-bullet.entry.js +3 -3
  59. package/dist/esm/bn-chart-scatter.entry.js +3 -3
  60. package/dist/esm/bn-grid.entry.js +1 -1
  61. package/dist/esm/bn-image.entry.js +1 -1
  62. package/dist/esm/bn-template-engine.js +1 -1
  63. package/dist/esm/bn-text.entry.js +2 -2
  64. package/dist/esm/bn-tree.entry.js +1 -1
  65. package/dist/esm/{layoutObserver-BJBEyhNf.js → layoutObserver-DtZb2vdM.js} +1 -1
  66. package/dist/esm/loader.js +1 -1
  67. package/dist/esm/{scaling-BGnpSN1j.js → scaling-Bw8XyrFq.js} +80 -1
  68. package/dist/esm/{withStyled-2l5Tx3cf.js → withStyled-41rsCSM1.js} +3 -3
  69. package/dist/types/components/bn-chart-bubble/bn-chart-bubble.d.ts +5 -2
  70. package/dist/types/components/bn-chart-structure/bn-chart-structure.d.ts +33 -16
  71. package/dist/types/components/bn-chart-structure/ibcs-chart-structure.d.ts +8 -0
  72. package/dist/types/components/bn-chart-time/bn-chart-time.d.ts +35 -18
  73. package/dist/types/components/bn-chart-time/ibcs-chart-time.d.ts +8 -0
  74. package/dist/types/components/bn-scaling-group/bn-scaling-group.d.ts +28 -8
  75. package/dist/types/components/bn-table/bn-table.d.ts +37 -17
  76. package/dist/types/components/bn-table/ibcs-table.d.ts +8 -0
  77. package/dist/types/components.d.ts +85 -51
  78. package/dist/types/utils/dataAnalyzer.d.ts +5 -1
  79. package/dist/types/utils/scaling.d.ts +63 -0
  80. package/dist/types/utils/validate.d.ts +2 -2
  81. package/package.json +1 -1
  82. package/readme.md +2 -0
  83. package/dist/bn-template-engine/p-C9i1Xsib.js +0 -1
  84. package/dist/bn-template-engine/p-b5274369.entry.js +0 -1
@@ -1 +1 @@
1
- import{r as t,d as i,f as e,h as s,H as a,g as r}from"./p-B_d-jp99.js";import{a as n}from"./p-BgIpdpfH.js";import{w as l,a as o,g as h,p as u}from"./p-C9i1Xsib.js";import{w as c,o as d}from"./p-A8xyE4b1.js";import{i as p,a as v,w as m,b as f,c as g}from"./p-BpWWgN6k.js";import{w as y,a as b}from"./p-B4JfKvVT.js";import{w as x}from"./p-C8Q0lsaU.js";import{r as _,s as w}from"./p-eEfqksk-.js";import{t as $,a as R,b as E,c as S,d as L,e as A,p as j}from"./p-6lOdN-fB.js";import"./p-C5uvAEKI.js";const C={rowGroup:0,category:1,subCategory:2},O=["ac","pp","fc","pl"],z=class{validateX(t){this.validateMeasureSpec("x",t,!0,(t=>$(t)))}validateY(t){this.validateMeasureSpec("y",t,!0,(t=>$(t)))}validateSize(t){this.validateMeasureSpec("size",t,!0,(t=>R(t))),this.validateSizeScaling()}validateShare(t){this.validateMeasureSpec("share",t,!1,(t=>E(t)))}validateCompareWith(t){const i="ERR_compareWith";p(t)||O.includes(t.trim().toLowerCase())?this.errors.remove(i):this.errors.addOrReplace({id:i,type:"warning",message:`compare-with: invalid value '${t}' — expected ${O.join("/")}; ignored.`})}validateLevel(t){const i="ERR_level",e=["auto","category","subcategory"];p(t)||e.includes(t.trim().toLowerCase())?this.errors.remove(i):this.errors.addOrReplace({id:i,type:"warning",message:`level: invalid value '${t}' — expected ${e.join("/")}; using 'auto'.`})}validateSeriesLevel(t){const i="ERR_seriesLevel",e=["auto","rowgroup","category","none"];p(t)||e.includes(t.trim().toLowerCase())?this.errors.remove(i):this.errors.addOrReplace({id:i,type:"warning",message:`series-level: invalid value '${t}' — expected ${e.join("/")}; using 'auto'.`})}validateFacet(t){this.validateObjectSpec("facet",t,(t=>S(t)))}validateLabels(t){this.validateObjectSpec("labels",t,(t=>L(t,this.labelDefaults())))}validateLegend(t){this.validateObjectSpec("legend",t,(t=>A(t)))}validateAspect(t){const i="ERR_aspect";p(t)||null!==this.parseAspect(t)?this.errors.remove(i):this.errors.addOrReplace({id:i,type:"warning",message:`aspect: invalid value '${t}' — expected "w:h" (e.g. "16:9"); using the default.`})}validateLimit(t){const i="ERR_limit";v(t)&&Number(t)>=0?this.errors.remove(i):this.errors.addOrReplace({id:i,type:"warning",message:`limit: invalid value '${t}' — expected a non-negative integer; using 0.`})}validateScale(t){const i="ERR_scale";if(p(t))return void this.errors.remove(i);const{mode:e,factor:s}=u(t);"factor"===e&&(void 0===s||s<=0)?this.errors.addOrReplace({id:i,type:"warning",message:`scale: invalid value '${t}' — expected none/auto or a positive number.`}):this.errors.remove(i)}constructor(i){t(this,i),this.datasetName="",this.dataVersion=0,this.datasetMeta=null,this.appliedScaleFactor=1,this.layoutObserver=null,this.activeErrors=new Set,this.pixelPerUnitGroupMap=new Map,this.chartTitle="",this.filter="",this.share="",this.compareWith="",this.level="auto",this.seriesLevel="auto",this.facet="",this.labels="",this.legend="",this.aspect="16:9",this.limit=0,this._autoScaleGuard=!1,this._lastObservedWidth=0,this.translateForInner=(t,i)=>this.t(t,i),m(this),y(this),l(this,(t=>{this.datasetName=(null==t?void 0:t.startsWith("$"))?t.substring(1):t||"",this.dataVersion=this.dataVersion+1}),((t,i)=>{this.datasetMeta=i})),this.errors=b(this),x(this),this.componentStyle=f(this),this.ruleSetConfig=c(this),this.t=o(this).t}componentWillLoad(){this.validateX(this.x),this.validateY(this.y),this.validateSize(this.size),this.validateShare(this.share),this.validateCompareWith(this.compareWith),this.validateLevel(this.level),this.validateSeriesLevel(this.seriesLevel),this.validateFacet(this.facet),this.validateLabels(this.labels),this.validateLegend(this.legend),this.validateAspect(this.aspect),this.validateLimit(this.limit),this.validateScale(this.scale)}componentDidRender(){const{mode:t}=u(this.scale);if("auto"!==t&&"empty"!==t){this._autoScaleGuard=!1;const t=h(this.element),i="WARN_overflow";return void(t.width>0&&this.element.scrollWidth>t.width+1?this.errors.addOrReplace({id:i,type:"warning",message:"Chart exceeds available space and will be cut off. Check the scale value."}):this.errors.remove(i))}if(this._autoScaleGuard)return void(this._autoScaleGuard=!1);const e=this.element,{width:s}=h(e);if(s<=0)return;this._lastObservedWidth=s;const a=this.componentStyle((t=>{var i;return(null===(i=t.global)||void 0===i?void 0:i.fontSizePx)||13.3333})),r=e.scrollWidth,n=this.appliedScaleFactor;if(!Number.isFinite(r)||r<=s+1)return void this.errors.remove("AUTO_scale");const l=Math.max(.3,n*(s-1)/r);Math.abs(l-n)<.01||(e.style.setProperty("--bn-font-size",a*l+"px"),"empty"===t?this.errors.addOrReplace({id:"AUTO_scale",type:"warning",message:`Auto-scaled chart by factor ${l.toFixed(3)}`}):this.errors.remove("AUTO_scale"),this._autoScaleGuard=!0,i((()=>{this.appliedScaleFactor=l})))}componentDidLoad(){this.layoutObserver=d(this.element,(()=>{if(this._autoScaleGuard)return;const{width:t}=h(this.element);t>0&&Math.abs(t-this._lastObservedWidth)>2&&(this._lastObservedWidth=t,e(this))})),requestAnimationFrame((()=>{requestAnimationFrame((()=>{if(this._autoScaleGuard)return;const{width:t}=h(this.element);this._lastObservedWidth=t,e(this)}))}))}disconnectedCallback(){var t;null===(t=this.layoutObserver)||void 0===t||t.disconnect(),this.layoutObserver=null}labelDefaults(){return{points:"all",values:!0,max:12}}setBlockingError(t,i){null===i?(this.errors.remove(t),this.activeErrors.delete(t)):(this.errors.addOrReplace({id:t,type:"error",message:i}),this.activeErrors.add(t))}hasBlockingErrors(){return this.activeErrors.size>0}validateSizeScaling(){var t;const i=null===(t=this.prepareSize())||void 0===t?void 0:t.group;this.setBlockingError("ERR_xy_scale_group",void 0===i||this.pixelPerUnitGroupMap.has(i)?null:this.t(".bubble-scale-group-unknown",{group:i}))}validateMeasureSpec(t,i,e,s){var a;const r=`ERR_xy_json_${t}`,n=`ERR_xy_measure_${t}`,l=`WARN_xy_fields_${t}`,{data:o,parseError:h}=j(i,"measure");if(h)return this.setBlockingError(r,this.t(".xy-prop-json",{prop:t})),this.setBlockingError(n,null),void this.errors.remove(l);if(this.setBlockingError(r,null),null===o)return this.setBlockingError(n,e?this.t(".xy-measure-invalid",{prop:t,measure:""}):null),void this.errors.remove(l);const u=null!==(a=o.measure)&&void 0!==a?a:"";g(u)?this.setBlockingError(n,null):this.setBlockingError(n,this.t(".xy-measure-invalid",{prop:t,measure:u})),this.reportSpecIssues(l,t,s(o))}validateObjectSpec(t,i,e){const s=`ERR_xy_json_${t}`,a=`WARN_xy_fields_${t}`,{data:r,parseError:n}=j(i,null);if(n)return this.setBlockingError(s,this.t(".xy-prop-json",{prop:t})),void this.errors.remove(a);this.setBlockingError(s,null),null!==r?this.reportSpecIssues(a,t,e(r)):this.errors.remove(a)}reportSpecIssues(t,i,e){const s=[];null!==e&&e.invalidFields.length>0&&s.push(`invalid: ${e.invalidFields.join(", ")}`),null!==e&&e.unknownKeys.length>0&&s.push(`unknown: ${e.unknownKeys.join(", ")}`),s.length>0?this.errors.addOrReplace({id:t,type:"warning",message:`${i}: ignored sub-fields (${s.join("; ")}).`}):this.errors.remove(t)}prepareAxis(t,i){const{data:e,parseError:s}=j(i,"measure");if(s||null===e)return null;const{config:a}=$(e);return null!==a&&g(a.measure)?(void 0!==a.min&&void 0!==a.max&&a.min>=a.max?(this.errors.addOrReplace({id:`WARN_xy_domain_${t}`,type:"warning",message:`${t}: min must be smaller than max; the override is ignored.`}),a.min=void 0,a.max=void 0):this.errors.remove(`WARN_xy_domain_${t}`),a):null}prepareSize(){const{data:t,parseError:i}=j(this.size,"measure");if(i||null===t)return null;const{config:e}=R(t);return null!==e&&g(e.measure)?e:null}prepareShare(){const{data:t,parseError:i}=j(this.share,"measure");if(i||null===t)return null;const{config:e}=E(t);return null!==e&&g(e.measure)?e:null}prepareCompareFamily(){var t;const i=null===(t=this.compareWith)||void 0===t?void 0:t.trim().toLowerCase();return O.includes(i)?i:null}prepareLabels(){const t=this.labelDefaults(),{data:i,parseError:e}=j(this.labels,null);return e||null===i?{points:t.points,values:t.values,max:t.max}:L(i,t).config}prepareLegend(){const{data:t,parseError:i}=j(this.legend,null);return i||null===t?{show:!0,position:"right"}:A(t).config}prepareFacet(){const{data:t,parseError:i}=j(this.facet,null);return i||null===t?null:S(t).config}preparePointLevel(){var t,i;const e=null===(t=this.level)||void 0===t?void 0:t.trim().toLowerCase();if("category"===e)return"category";if("subcategory"===e)return"subCategory";const s=null===(i=this.datasetMeta)||void 0===i?void 0:i.suggestedLevel;return"rowGroup"===s||"category"===s||"subCategory"===s?s:"category"}prepareSeriesLevel(t){var i;const e=null===(i=this.seriesLevel)||void 0===i?void 0:i.trim().toLowerCase();return"none"===e?null:"rowgroup"===e?"rowGroup":"category"===e||"subCategory"===t?"category":"category"===t?"rowGroup":null}validateCrossProp(t,i){const e=new Set;let s=!1;for(const i of t){if(void 0===i)continue;const t=_(i);null!==t&&("scenario"===t.kind?e.add(w(t.slot)):s=!0)}this.setBlockingError("ERR_xy_family",e.size>1?this.t(".xy-family-mixed",{families:[...e].join(", ")}):null);const a=this.prepareCompareFamily();this.setBlockingError("ERR_xy_compare_variance",null!==a&&s?this.t(".xy-compare-variance"):null),this.setBlockingError("ERR_xy_compare_family",null!==a&&1===e.size&&e.has(a)?`compare-with: '${a}' is already the primary scenario family.`:null);const r=this.preparePointLevel(),n=this.prepareSeriesLevel(r),l=null!==i?"rowgroup"===i.level?"rowGroup":"category":null;let o=null;if(null!==n&&C[n]>=C[r]&&(o=`series '${n}' vs point '${r}'`),null!==l){const t=null!=n?n:r;C[l]>=C[t]&&(o=`facet '${l}' vs '${t}'`)}this.setBlockingError("ERR_xy_level_order",null!==o?this.t(".xy-level-order",{detail:o}):null)}parseAspect(t){const i=/^\s*(\d+(?:\.\d+)?)\s*:\s*(\d+(?:\.\d+)?)\s*$/.exec(null!=t?t:"");if(null===i)return null;const e=Number(i[1]),s=Number(i[2]);return e<=0||s<=0?null:e/s}prepareAspect(){var t;return null!==(t=this.parseAspect(this.aspect))&&void 0!==t?t:16/9}prepareLimit(){const t=Math.floor(Number(this.limit)||0);return t>0?t:0}prepareSizeAreaPerUnit(){var t;const i=null===(t=this.prepareSize())||void 0===t?void 0:t.group;if(void 0===i||!this.pixelPerUnitGroupMap.has(i))return 0;const e=this.getEffectiveScaleFactor();return this.pixelPerUnitGroupMap.get(i)*e*e}i18nLocalKeys(){return["no-data","axis.in","legend.title","legend.size","legend.compare"]}prepareI18n(){const t=new Map(this.i18nLocalKeys().map((t=>[t,this.t(".".concat(t))]))),i=new Map(n.map((t=>[t,this.t("global.".concat(t))])));return new Map([...i.entries(),...t.entries()])}prepareStyle(){const t=this.getEffectiveScaleFactor();return this.componentStyle((i=>{const e=i.global.fontSizePx*t;return{scaleFactors:i["bn-chart-bubble"].scaleFactors,fontStyles:{font:`${e}px ${i.global.fontFamily}`,size:e,color:i.global.fontColor,background:i.global.fontBackgroundColor,leading:1.8},axisStyles:i["bn-chart-bubble"].axisStyles,seriesColors:i["bn-chart-bubble"].seriesColors,padding:i["bn-chart-bubble"].padding}}))}getEffectiveScaleFactor(){const{mode:t,factor:i}=u(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,a,r;const n=(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":n*t+"px","--bn-font-color":(null===(a=i.global)||void 0===a?void 0:a.fontColor)||"#000000","--bn-font-background":(null===(r=i.global)||void 0===r?void 0:r.fontBackgroundColor)||"#ffffff"}}))}getDataStructure(){const t={};for(const i of["ac","pp","fc","pl"])for(const e of[1,2,3,4])t[`${i}${e}`]={type:"number",isOptional:!0,description:""};const i={x:this.prepareAxis("x",this.x),y:this.prepareAxis("y",this.y),size:this.prepareSize(),share:this.prepareShare()};for(const[e,s]of Object.entries(i)){if(null===s)continue;const i=_(s.measure);null!==i&&("scenario"===i.kind?t[i.slot].description=`${e}: ${void 0!==s.label?s.label:s.measure}`:(t[i.measure.base].description=`${e}: ${s.measure} (base)`,t[i.measure.delta].description=`${e}: ${s.measure} (delta)`))}const e=this.prepareCompareFamily();if(null!==e)for(const[s,a]of Object.entries(i)){if(null===a||"share"===s)continue;const i=_(a.measure);if(null!==i&&"scenario"===i.kind){const a=e+i.slot.replace(/^[a-z]+/,"");""===t[a].description&&(t[a].description=`${s}: compareWith`)}}return{IBubbleChartDataRow:Object.assign({operation:{type:"string",isOptional:!1,description:""},rowGroup:{type:"string",isOptional:!0,description:""},rowGroupIndex:{type:"number",isOptional:!0,description:""},category:{type:"string",isOptional:!1,description:""},categoryIndex:{type:"number",isOptional:!1,description:""},subCategory:{type:"string",isOptional:!0,description:""},subCategoryIndex:{type:"number",isOptional:!0,description:""}},t)}}chartTemplate(){const t=this.prepareAxis("x",this.x),i=this.prepareAxis("y",this.y),e=this.prepareSize(),a=this.prepareShare(),r=this.prepareFacet();if(this.validateCrossProp([null==t?void 0:t.measure,null==i?void 0:i.measure,null==e?void 0:e.measure,null==a?void 0:a.measure],r),this.validateSizeScaling(),this.hasBlockingErrors()||null===t||null===i||null===e)return null;const n=this.preparePointLevel(),l=this.prepareI18n(),o=this.prepareStyle(),u=h(this.element).width;return s("ibcs-chart-bubble",{tableName:this.datasetName,dataVersion:this.dataVersion,chartTitle:this.chartTitle,x:t,y:i,size:e,share:a,compareFamily:this.prepareCompareFamily(),labels:this.prepareLabels(),legend:this.prepareLegend(),facet:r,pointLevel:n,seriesLevel:this.prepareSeriesLevel(n),aspect:this.prepareAspect(),limit:this.prepareLimit(),filter:this.filter,sizeAreaPerUnit:this.prepareSizeAreaPerUnit(),styles:o,i18n:l,containerWidth:u,ruleSetConfig:this.ruleSetConfig(),errors:this.errors,translate:this.translateForInner})}render(){return s(a,{key:"4191801f8d17e3241a9b681d9a7f0ab8a453bf64",style:this.getFontStyles()},s("div",{key:"a5284956b892a3647331532daae8d3251dbb6fad",class:"container"},this.chartTemplate()))}get element(){return r(this)}static get watchers(){return{x:[{validateX:0}],y:[{validateY:0}],size:[{validateSize:0}],share:[{validateShare:0}],compareWith:[{validateCompareWith:0}],level:[{validateLevel:0}],seriesLevel:[{validateSeriesLevel:0}],facet:[{validateFacet:0}],labels:[{validateLabels:0}],legend:[{validateLegend:0}],aspect:[{validateAspect:0}],limit:[{validateLimit:0}],scale:[{validateScale:0}]}}};z.style=":host{display:inline-block;position:relative;overflow:hidden}.container{display:flex;flex-direction:column}";export{z as bn_chart_bubble}
1
+ import{r as t,d as i,f as e,h as s,H as r,g as a}from"./p-B_d-jp99.js";import{a as n}from"./p-BgIpdpfH.js";import{w as l,a as o,g as h,p as u}from"./p-D75i_YOP.js";import{w as c,o as d}from"./p-Da6p_F4J.js";import{i as p,a as v,w as f,b as m,c as g}from"./p-D1SJ10zl.js";import{w as y,a as b}from"./p-B4JfKvVT.js";import{w as _}from"./p-C8Q0lsaU.js";import{r as x,s as w}from"./p-eEfqksk-.js";import{t as $,a as R,b as E,c as S,d as L,e as j,p as A}from"./p-6lOdN-fB.js";import"./p-C5uvAEKI.js";const C={rowGroup:0,category:1,subCategory:2},O=["ac","pp","fc","pl"],z=class{validateX(t){this.validateMeasureSpec("x",t,!0,(t=>$(t)))}validateY(t){this.validateMeasureSpec("y",t,!0,(t=>$(t)))}validateSize(t){this.validateMeasureSpec("size",t,!0,(t=>R(t))),this.validateSizeScaling()}validateShare(t){this.validateMeasureSpec("share",t,!1,(t=>E(t)))}validateCompareWith(t){const i="ERR_compareWith";p(t)||O.includes(t.trim().toLowerCase())?this.errors.remove(i):this.errors.addOrReplace({id:i,type:"warning",message:`compare-with: invalid value '${t}' — expected ${O.join("/")}; ignored.`})}validateLevel(t){const i="ERR_level",e=["auto","category","subcategory"];p(t)||e.includes(t.trim().toLowerCase())?this.errors.remove(i):this.errors.addOrReplace({id:i,type:"warning",message:`level: invalid value '${t}' — expected ${e.join("/")}; using 'auto'.`})}validateSeriesLevel(t){const i="ERR_seriesLevel",e=["auto","rowgroup","category","none"];p(t)||e.includes(t.trim().toLowerCase())?this.errors.remove(i):this.errors.addOrReplace({id:i,type:"warning",message:`series-level: invalid value '${t}' — expected ${e.join("/")}; using 'auto'.`})}validateFacet(t){this.validateObjectSpec("facet",t,(t=>S(t)))}validateLabels(t){this.validateObjectSpec("labels",t,(t=>L(t,this.labelDefaults())))}validateLegend(t){this.validateObjectSpec("legend",t,(t=>j(t)))}validateAspect(t){const i="ERR_aspect";p(t)||null!==this.parseAspect(t)?this.errors.remove(i):this.errors.addOrReplace({id:i,type:"warning",message:`aspect: invalid value '${t}' — expected "w:h" (e.g. "16:9"); using the default.`})}validateLimit(t){const i="ERR_limit";v(t)&&Number(t)>=0?this.errors.remove(i):this.errors.addOrReplace({id:i,type:"warning",message:`limit: invalid value '${t}' — expected a non-negative integer; using 0.`})}validateScale(t){const i="ERR_scale";if(p(t))return void this.errors.remove(i);const{mode:e,factor:s}=u(t);"factor"===e&&(void 0===s||s<=0)?this.errors.addOrReplace({id:i,type:"warning",message:`scale: invalid value '${t}' — expected none/auto or a positive number.`}):this.errors.remove(i)}constructor(i){t(this,i),this.datasetName="",this.dataVersion=0,this.datasetMeta=null,this.appliedScaleFactor=1,this.layoutObserver=null,this.activeErrors=new Set,this.pixelPerUnitGroupMap=new Map,this.chartTitle="",this.filter="",this.share="",this.compareWith="",this.level="auto",this.seriesLevel="auto",this.facet="",this.labels="",this.legend="",this.aspect="16:9",this.limit=0,this._autoScaleGuard=!1,this._lastObservedWidth=0,this.translateForInner=(t,i)=>this.t(t,i),f(this),y(this),l(this,(t=>{this.datasetName=(null==t?void 0:t.startsWith("$"))?t.substring(1):t||"",this.dataVersion=this.dataVersion+1}),((t,i)=>{this.datasetMeta=i})),this.errors=b(this),_(this),this.componentStyle=m(this),this.ruleSetConfig=c(this),this.t=o(this).t}componentWillLoad(){this.validateX(this.x),this.validateY(this.y),this.validateSize(this.size),this.validateShare(this.share),this.validateCompareWith(this.compareWith),this.validateLevel(this.level),this.validateSeriesLevel(this.seriesLevel),this.validateFacet(this.facet),this.validateLabels(this.labels),this.validateLegend(this.legend),this.validateAspect(this.aspect),this.validateLimit(this.limit),this.validateScale(this.scale)}componentDidRender(){const{mode:t}=u(this.scale);if("auto"!==t&&"empty"!==t){this._autoScaleGuard=!1;const t=h(this.element),i="WARN_overflow";return void(t.width>0&&this.element.scrollWidth>t.width+1?this.errors.addOrReplace({id:i,type:"warning",message:"Chart exceeds available space and will be cut off. Check the scale value."}):this.errors.remove(i))}if(this._autoScaleGuard)return void(this._autoScaleGuard=!1);const e=this.element,{width:s}=h(e);if(s<=0)return;this._lastObservedWidth=s;const r=this.componentStyle((t=>{var i;return(null===(i=t.global)||void 0===i?void 0:i.fontSizePx)||13.3333})),a=e.scrollWidth,n=this.appliedScaleFactor;if(!Number.isFinite(a)||a<=s+1)return void this.errors.remove("AUTO_scale");const l=Math.max(.3,n*(s-1)/a);Math.abs(l-n)<.01||(e.style.setProperty("--bn-font-size",r*l+"px"),"empty"===t?this.errors.addOrReplace({id:"AUTO_scale",type:"warning",message:`Auto-scaled chart by factor ${l.toFixed(3)}`}):this.errors.remove("AUTO_scale"),this._autoScaleGuard=!0,i((()=>{this.appliedScaleFactor=l})))}componentDidLoad(){this.layoutObserver=d(this.element,(()=>{if(this._autoScaleGuard)return;const{width:t}=h(this.element);t>0&&Math.abs(t-this._lastObservedWidth)>2&&(this._lastObservedWidth=t,e(this))})),requestAnimationFrame((()=>{requestAnimationFrame((()=>{if(this._autoScaleGuard)return;const{width:t}=h(this.element);this._lastObservedWidth=t,e(this)}))}))}disconnectedCallback(){var t;null===(t=this.layoutObserver)||void 0===t||t.disconnect(),this.layoutObserver=null}labelDefaults(){return{points:"all",values:!0,max:12}}setBlockingError(t,i){null===i?(this.errors.remove(t),this.activeErrors.delete(t)):(this.errors.addOrReplace({id:t,type:"error",message:i}),this.activeErrors.add(t))}hasBlockingErrors(){return this.activeErrors.size>0}validateSizeScaling(){var t;const i=null===(t=this.prepareSize())||void 0===t?void 0:t.group;this.setBlockingError("ERR_xy_scale_group",void 0===i||this.pixelPerUnitGroupMap.has(i)?null:this.t(".bubble-scale-group-unknown",{group:i}))}validateMeasureSpec(t,i,e,s){var r;const a=`ERR_xy_json_${t}`,n=`ERR_xy_measure_${t}`,l=`WARN_xy_fields_${t}`,{data:o,parseError:h}=A(i,"measure");if(h)return this.setBlockingError(a,this.t(".xy-prop-json",{prop:t})),this.setBlockingError(n,null),void this.errors.remove(l);if(this.setBlockingError(a,null),null===o)return this.setBlockingError(n,e?this.t(".xy-measure-invalid",{prop:t,measure:""}):null),void this.errors.remove(l);const u=null!==(r=o.measure)&&void 0!==r?r:"";g(u)?this.setBlockingError(n,null):this.setBlockingError(n,this.t(".xy-measure-invalid",{prop:t,measure:u})),this.reportSpecIssues(l,t,s(o))}validateObjectSpec(t,i,e){const s=`ERR_xy_json_${t}`,r=`WARN_xy_fields_${t}`,{data:a,parseError:n}=A(i,null);if(n)return this.setBlockingError(s,this.t(".xy-prop-json",{prop:t})),void this.errors.remove(r);this.setBlockingError(s,null),null!==a?this.reportSpecIssues(r,t,e(a)):this.errors.remove(r)}reportSpecIssues(t,i,e){const s=[];null!==e&&e.invalidFields.length>0&&s.push(`invalid: ${e.invalidFields.join(", ")}`),null!==e&&e.unknownKeys.length>0&&s.push(`unknown: ${e.unknownKeys.join(", ")}`),s.length>0?this.errors.addOrReplace({id:t,type:"warning",message:`${i}: ignored sub-fields (${s.join("; ")}).`}):this.errors.remove(t)}prepareAxis(t,i){const{data:e,parseError:s}=A(i,"measure");if(s||null===e)return null;const{config:r}=$(e);return null!==r&&g(r.measure)?(void 0!==r.min&&void 0!==r.max&&r.min>=r.max?(this.errors.addOrReplace({id:`WARN_xy_domain_${t}`,type:"warning",message:`${t}: min must be smaller than max; the override is ignored.`}),r.min=void 0,r.max=void 0):this.errors.remove(`WARN_xy_domain_${t}`),r):null}prepareSize(){const{data:t,parseError:i}=A(this.size,"measure");if(i||null===t)return null;const{config:e}=R(t);return null!==e&&g(e.measure)?e:null}prepareShare(){const{data:t,parseError:i}=A(this.share,"measure");if(i||null===t)return null;const{config:e}=E(t);return null!==e&&g(e.measure)?e:null}prepareCompareFamily(){var t;const i=null===(t=this.compareWith)||void 0===t?void 0:t.trim().toLowerCase();return O.includes(i)?i:null}prepareLabels(){const t=this.labelDefaults(),{data:i,parseError:e}=A(this.labels,null);return e||null===i?{points:t.points,values:t.values,max:t.max}:L(i,t).config}prepareLegend(){const{data:t,parseError:i}=A(this.legend,null);return i||null===t?{show:!0,position:"right"}:j(t).config}prepareFacet(){const{data:t,parseError:i}=A(this.facet,null);return i||null===t?null:S(t).config}preparePointLevel(){var t,i;const e=null===(t=this.level)||void 0===t?void 0:t.trim().toLowerCase();if("category"===e)return"category";if("subcategory"===e)return"subCategory";const s=null===(i=this.datasetMeta)||void 0===i?void 0:i.suggestedLevel;return"rowGroup"===s||"category"===s||"subCategory"===s?s:"category"}prepareSeriesLevel(t){var i;const e=null===(i=this.seriesLevel)||void 0===i?void 0:i.trim().toLowerCase();return"none"===e?null:"rowgroup"===e?"rowGroup":"category"===e||"subCategory"===t?"category":"category"===t?"rowGroup":null}validateCrossProp(t,i){const e=new Set;let s=!1;for(const i of t){if(void 0===i)continue;const t=x(i);null!==t&&("scenario"===t.kind?e.add(w(t.slot)):s=!0)}this.setBlockingError("ERR_xy_family",e.size>1?this.t(".xy-family-mixed",{families:[...e].join(", ")}):null);const r=this.prepareCompareFamily();this.setBlockingError("ERR_xy_compare_variance",null!==r&&s?this.t(".xy-compare-variance"):null),this.setBlockingError("ERR_xy_compare_family",null!==r&&1===e.size&&e.has(r)?`compare-with: '${r}' is already the primary scenario family.`:null);const a=this.preparePointLevel(),n=this.prepareSeriesLevel(a),l=null!==i?"rowgroup"===i.level?"rowGroup":"category":null;let o=null;if(null!==n&&C[n]>=C[a]&&(o=`series '${n}' vs point '${a}'`),null!==l){const t=null!=n?n:a;C[l]>=C[t]&&(o=`facet '${l}' vs '${t}'`)}this.setBlockingError("ERR_xy_level_order",null!==o?this.t(".xy-level-order",{detail:o}):null)}parseAspect(t){const i=/^\s*(\d+(?:\.\d+)?)\s*:\s*(\d+(?:\.\d+)?)\s*$/.exec(null!=t?t:"");if(null===i)return null;const e=Number(i[1]),s=Number(i[2]);return e<=0||s<=0?null:e/s}prepareAspect(){var t;return null!==(t=this.parseAspect(this.aspect))&&void 0!==t?t:16/9}prepareLimit(){const t=Math.floor(Number(this.limit)||0);return t>0?t:0}prepareSizeAreaPerUnit(){var t;const i=null===(t=this.prepareSize())||void 0===t?void 0:t.group;if(void 0===i||!this.pixelPerUnitGroupMap.has(i))return 0;const e=this.pixelPerUnitGroupMap.get(i);if(!(e>0))return 0;const s=this.getEffectiveFontPx();return s*s/e}i18nLocalKeys(){return["no-data","axis.in","legend.title","legend.size","legend.compare"]}prepareI18n(){const t=new Map(this.i18nLocalKeys().map((t=>[t,this.t(".".concat(t))]))),i=new Map(n.map((t=>[t,this.t("global.".concat(t))])));return new Map([...i.entries(),...t.entries()])}prepareStyle(){const t=this.getEffectiveScaleFactor();return this.componentStyle((i=>{const e=i.global.fontSizePx*t;return{scaleFactors:i["bn-chart-bubble"].scaleFactors,fontStyles:{font:`${e}px ${i.global.fontFamily}`,size:e,color:i.global.fontColor,background:i.global.fontBackgroundColor,leading:1.8},axisStyles:i["bn-chart-bubble"].axisStyles,seriesColors:i["bn-chart-bubble"].seriesColors,padding:i["bn-chart-bubble"].padding}}))}getEffectiveScaleFactor(){const{mode:t,factor:i}=u(this.scale);return"factor"===t?i:"auto"===t||"empty"===t?this.appliedScaleFactor:1}getEffectiveFontPx(){return this.componentStyle((t=>{var i;return(null===(i=t.global)||void 0===i?void 0:i.fontSizePx)||13.3333}))*this.getEffectiveScaleFactor()}getFontStyles(){const t=this.getEffectiveScaleFactor();return this.componentStyle((i=>{var e,s,r,a;const n=(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":n*t+"px","--bn-font-color":(null===(r=i.global)||void 0===r?void 0:r.fontColor)||"#000000","--bn-font-background":(null===(a=i.global)||void 0===a?void 0:a.fontBackgroundColor)||"#ffffff"}}))}getDataStructure(){const t={};for(const i of["ac","pp","fc","pl"])for(const e of[1,2,3,4])t[`${i}${e}`]={type:"number",isOptional:!0,description:""};const i={x:this.prepareAxis("x",this.x),y:this.prepareAxis("y",this.y),size:this.prepareSize(),share:this.prepareShare()};for(const[e,s]of Object.entries(i)){if(null===s)continue;const i=x(s.measure);null!==i&&("scenario"===i.kind?t[i.slot].description=`${e}: ${void 0!==s.label?s.label:s.measure}`:(t[i.measure.base].description=`${e}: ${s.measure} (base)`,t[i.measure.delta].description=`${e}: ${s.measure} (delta)`))}const e=this.prepareCompareFamily();if(null!==e)for(const[s,r]of Object.entries(i)){if(null===r||"share"===s)continue;const i=x(r.measure);if(null!==i&&"scenario"===i.kind){const r=e+i.slot.replace(/^[a-z]+/,"");""===t[r].description&&(t[r].description=`${s}: compareWith`)}}return{IBubbleChartDataRow:Object.assign({operation:{type:"string",isOptional:!1,description:""},rowGroup:{type:"string",isOptional:!0,description:""},rowGroupIndex:{type:"number",isOptional:!0,description:""},category:{type:"string",isOptional:!1,description:""},categoryIndex:{type:"number",isOptional:!1,description:""},subCategory:{type:"string",isOptional:!0,description:""},subCategoryIndex:{type:"number",isOptional:!0,description:""}},t)}}chartTemplate(){const t=this.prepareAxis("x",this.x),i=this.prepareAxis("y",this.y),e=this.prepareSize(),r=this.prepareShare(),a=this.prepareFacet();if(this.validateCrossProp([null==t?void 0:t.measure,null==i?void 0:i.measure,null==e?void 0:e.measure,null==r?void 0:r.measure],a),this.validateSizeScaling(),this.hasBlockingErrors()||null===t||null===i||null===e)return null;const n=this.preparePointLevel(),l=this.prepareI18n(),o=this.prepareStyle(),u=h(this.element).width;return s("ibcs-chart-bubble",{tableName:this.datasetName,dataVersion:this.dataVersion,chartTitle:this.chartTitle,x:t,y:i,size:e,share:r,compareFamily:this.prepareCompareFamily(),labels:this.prepareLabels(),legend:this.prepareLegend(),facet:a,pointLevel:n,seriesLevel:this.prepareSeriesLevel(n),aspect:this.prepareAspect(),limit:this.prepareLimit(),filter:this.filter,sizeAreaPerUnit:this.prepareSizeAreaPerUnit(),styles:o,i18n:l,containerWidth:u,ruleSetConfig:this.ruleSetConfig(),errors:this.errors,translate:this.translateForInner})}render(){return s(r,{key:"24a71177722409772ddf8e68df747d821173bd6d",style:this.getFontStyles()},s("div",{key:"8f36775425c700dc10e2901a964f6c1e23f524be",class:"container"},this.chartTemplate()))}get element(){return a(this)}static get watchers(){return{x:[{validateX:0}],y:[{validateY:0}],size:[{validateSize:0}],share:[{validateShare:0}],compareWith:[{validateCompareWith:0}],level:[{validateLevel:0}],seriesLevel:[{validateSeriesLevel:0}],facet:[{validateFacet:0}],labels:[{validateLabels:0}],legend:[{validateLegend:0}],aspect:[{validateAspect:0}],limit:[{validateLimit:0}],scale:[{validateScale:0}]}}};z.style=":host{display:inline-block;position:relative;overflow:hidden}.container{display:flex;flex-direction:column}";export{z as bn_chart_bubble}
@@ -1 +1 @@
1
- import{r as t,h as s,H as i,g as o}from"./p-B_d-jp99.js";import{w as r,b as e}from"./p-BpWWgN6k.js";import{w as n,a}from"./p-B4JfKvVT.js";import{g as l}from"./p-BgIpdpfH.js";import"./p-eEfqksk-.js";import"./p-C5uvAEKI.js";const f=class{constructor(s){t(this,s),r(this),n(this),this.errors=a(this),this.componentStyle=e(this)}connectedCallback(){this.stores=l(this.element)}getFontStyles(){return this.componentStyle((t=>{var s,i,o,r;return{"--bn-font-family":(null===(s=t.global)||void 0===s?void 0:s.fontFamily)||"'Noto Sans', sans-serif","--bn-font-size":`${(null===(i=t.global)||void 0===i?void 0:i.fontSizePx)||13.3333}px`,"--bn-font-color":(null===(o=t.global)||void 0===o?void 0:o.fontColor)||"#000000","--bn-font-background":(null===(r=t.global)||void 0===r?void 0:r.fontBackgroundColor)||"#ffffff"}}))}prepareAssetUrl(t){if(null==t||""===t)return"";const s=this.stores.assets.state;return t.startsWith("asset:")?s[t.substring(6)]:s[t]||t}render(){return s(i,{key:"cfa7e1b2978773f449f6596174edf51e4a61d4d7",style:this.getFontStyles()},null!=this.source&&""!==this.source?s("img",{src:this.prepareAssetUrl(this.source)}):"")}get element(){return o(this)}};f.style=":host{display:inline-block;position:relative;overflow:hidden}img{max-width:100%;height:auto}";export{f as bn_image}
1
+ import{r as t,h as s,H as i,g as o}from"./p-B_d-jp99.js";import{w as r,b as e}from"./p-D1SJ10zl.js";import{w as n,a}from"./p-B4JfKvVT.js";import{g as l}from"./p-BgIpdpfH.js";import"./p-eEfqksk-.js";import"./p-C5uvAEKI.js";const f=class{constructor(s){t(this,s),r(this),n(this),this.errors=a(this),this.componentStyle=e(this)}connectedCallback(){this.stores=l(this.element)}getFontStyles(){return this.componentStyle((t=>{var s,i,o,r;return{"--bn-font-family":(null===(s=t.global)||void 0===s?void 0:s.fontFamily)||"'Noto Sans', sans-serif","--bn-font-size":`${(null===(i=t.global)||void 0===i?void 0:i.fontSizePx)||13.3333}px`,"--bn-font-color":(null===(o=t.global)||void 0===o?void 0:o.fontColor)||"#000000","--bn-font-background":(null===(r=t.global)||void 0===r?void 0:r.fontBackgroundColor)||"#ffffff"}}))}prepareAssetUrl(t){if(null==t||""===t)return"";const s=this.stores.assets.state;return t.startsWith("asset:")?s[t.substring(6)]:s[t]||t}render(){return s(i,{key:"cfa7e1b2978773f449f6596174edf51e4a61d4d7",style:this.getFontStyles()},null!=this.source&&""!==this.source?s("img",{src:this.prepareAssetUrl(this.source)}):"")}get element(){return o(this)}};f.style=":host{display:inline-block;position:relative;overflow:hidden}img{max-width:100%;height:auto}";export{f as bn_image}
@@ -1 +1 @@
1
- import{g as t,f as e}from"./p-B_d-jp99.js";import{g as s,c as r,D as n}from"./p-BgIpdpfH.js";import{r as a}from"./p-B4JfKvVT.js";import{m as i,S as o,b as u,A as c,c as l,T as h,D as d,d as m,M as f,e as y,r as b}from"./p-eEfqksk-.js";import{b as N,O as g}from"./p-C5uvAEKI.js";const p=n=>{let o,u,c,l;const h=()=>{const t=u.componentStyles.state;l=i([t._system||{},t._default||{},t[c]||{}],{arrayMergeType:"overwrite"})},d=new MutationObserver((s=>{s.forEach((s=>{"selected-style"===s.attributeName&&(c=t(n).getAttribute("selected-style"),h(),e(n))}))})),m=n.connectedCallback;n.connectedCallback=()=>{const r=t(n);u=s(r),l=u.componentStyles.state._system,d.observe(r,{attributes:!0,attributeFilter:["selected-style"]}),c=t(n).getAttribute("selected-style"),h(),o=u.componentStyles.on("set",(s=>{s===c&&(c=t(n).getAttribute("selected-style"),h(),e(t(n)))})),a(m,n)};const f=n.disconnectedCallback;return n.disconnectedCallback=()=>{d.disconnect(),a(o),r(t(n)),a(f,n)},t=>t(l)},v=/^\s*(set|first|last|min|max|avg|sum|lit)\(\s*(.*?)\s*\)\s*$/,S=/^[A-Za-z_][A-Za-z0-9_]*$/,k=["min","max","avg","sum"];class D{constructor(t,e,s,r){this.label=t,this.alias=e,this.fn=s,this.arg=r}get isNumeric(){return k.includes(this.fn)}}function w(t){if("string"!=typeof t)return!1;const e=v.exec(t);if(!e)return!1;const[,s,r]=e;return"lit"===s?r.length>0:S.test(r)}function T(t,e,s){if(!w(s))return null;const[,r,n]=v.exec(s);return new D(t,e,r,n)}var O,A;!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"}(O||(O={})),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"}(A||(A={}));class M{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.dateFormatPinned=!1,this.dateFormatShortPinned=!1,this.dateFormat=this._dateFormat,this.dateLinkFormat=this._dateLinkFormat,this.dateFormatShort=this._dateFormatShort}setDateLinkFormat(t){this.dateLinkFormat=t}setDateFormat(t){this.dateFormat=t,this.dateFormatPinned=!0}setDateFormatShort(t){this.dateFormatShort=t,this.dateFormatShortPinned=!0}setLocale(t){this.locale=t,this.dateFormatPinned||(this.dateFormat=Object.assign(Object.assign({},this._dateFormat),M.LOCALE_DATE_FORMAT[t]||{})),this.dateFormatShortPinned||(this.dateFormatShort=Object.assign(Object.assign({},this._dateFormatShort),M.LOCALE_DATE_FORMAT_SHORT[t]||{}))}getDateString(t,e){return t.setLocale(this.locale).toFormat(this.dateFormat[e]||this.dateFormat.fallback)}getSmartDateString(t,e){switch(e){case O.DAY:return this.getFormatedDayDate(t);case O.MONTH:return this.getFormatedMonthDate(t);case O.QUARTER:return this.getFormatedQuarterDate(t);case O.WEEK:return this.getFormatedWeekDate(t);case O.HOUR:return this.getFormatedHourDate(t);case O.MINUTE:return this.getFormatedMinuteDate(t);case O.SECOND:return this.getFormatedSecondDate(t);case O.MILLISECOND:return this.getFormatedMilliSecondDate(t);default:return this.getDateString(t,e)}}calculateDistanceType(t,e,s=32){if(null==e)return O.DAY;const r="number"==typeof t?n.fromMillis(t):t,a="number"==typeof e?n.fromMillis(e):e;return 0===a.diff(r).as("milliseconds")?O.DAY:a.diff(r).as("milliseconds")<s?O.MILLISECOND:a.diff(r).as("seconds")<s?O.SECOND:a.diff(r).as("minutes")<s?O.MINUTE:a.diff(r).as("hours")<s?O.HOUR:a.diff(r).as("days")<s?O.DAY:a.diff(r).as("weeks")<s?O.WEEK:a.diff(r).as("months")<s?O.MONTH:a.diff(r).as("quarters")<s?O.QUARTER:O.YEAR}datesBetween(t,e,s,r){const n=this.convertDateDistanceToMomentunitOfTime(s),a=t.startOf(n),i=e.endOf(n);let o=i.diff(a).as(n);const u=[];o>=r&&(o=r);let c=a;do{u.push(c),c=c.plus(this.createDiratonLike(n,1))}while(c<=i&&u.length<o);return u}getDateLinkString(t,e,s,r,a){if(null==t&&null==e)return"";if(null==t&&s!==A.END&&s!==A.YTD)return"";if(null==e&&(A.INTERVAL===s||A.CUM===s||A.END===s||A.YTD===s))return"";const i=t||n.now(),o=e;r===O.AUTO&&(r=this.calculateDistanceType(i,o,a));let u=this.getDateString(i,r),c="",l=A.NONE;return null!=o&&(c=this.getDateString(o,r),l=A.INTERVAL,u===c&&s===A.INTERVAL&&(s=A.NONE),u===c&&s===A.AVG&&(l=A.NONE),A.END!==s&&A.YTD!==s||(u=c),(s===A.INTERVAL||s===A.CUM||A.AVG)&&(r===O.QUARTER?i.quarter===o.quarter&&i.year===o.year?c=c.replace(" "+o.year,""):i.year===o.year&&(u=u.replace(" "+i.year,"")):r===O.MONTH?i.month===o.month&&i.year===o.year?c=c.replace(" "+o.year,""):i.year===o.year&&(u=u.replace(" "+i.year,"")):r===O.WEEK&&(i.weekNumber===o.weekNumber&&i.year===o.year?c=c.replace(" "+o.year,""):i.year===o.year&&(u=u.replace(" "+i.year,""))))),this.dateLinkFormat[s].replace("[LINK]",this.dateLinkFormat[l]).replace("[DATE]",u).replace("[DATE2]",c)}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 e;switch(t){case O.YEAR:e="year";break;case O.MONTH:e="month";break;case O.QUARTER:e="quarter";break;case O.WEEK:e="week";break;case O.DAY:e="day";break;case O.HOUR:e="hour";break;case O.MINUTE:e="minute";break;case O.SECOND:e="second";break;case O.MILLISECOND:e="millisecond";break;default:e="day"}return e}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}}}}function J(t){return null==t||""===t||"null"===t}function F(t){return J(t)||"auto"===t.trim().toLowerCase()?[]:E((null==t?void 0:t.split(",").filter((t=>!(t.toUpperCase().trim()in o)))).toString())}function E(t){return J(t)?[]:t.replace(";",",").split(",").filter((t=>{var e,s,r;const n=t.split("_"),a=null===(e=n[0])||void 0===e?void 0:e.replace(/^dr|^d/,"").toUpperCase().trim(),i=null===(s=n[1])||void 0===s?void 0:s.toUpperCase().trim(),c=null===(r=n[2])||void 0===r?void 0:r.toUpperCase().trim();return 3!==n.length||!(a in o)||!(i in o)||!(c in u)}))}function j(t){return J(t)?[]:E(t.split(",").filter((t=>!(t.toUpperCase().trim()in o))).toString())}function L(t){return J(t)||"auto"===t.trim().toLowerCase()?[]:E(t.split(",").filter((t=>!(t.toUpperCase()in N))).toString())}function W(t){return!J(t)&&Number.isInteger(Number(t))}function $(t){return!J(t)&&!Number.isNaN(Number(t))}function q(t){return!J(t)&&(null==t?void 0:t.toUpperCase())in g}function I(t){return"auto"===(null==t?void 0:t.toLowerCase())||(null==t?void 0:t.toUpperCase())in c}function _(t){if(J(t))return[];try{const e=JSON.parse(t);if(e instanceof Array)return e.filter((t=>!(t.hasOwnProperty("name")&&t.hasOwnProperty("unit"))))}catch(t){console.error("validateMeasureList: failed to parse JSON",t)}return["Invalid JSON structure"]}function z(t){const e=Date.parse(t);return Number.isInteger(e)}function x(t){return(null==t?void 0:t.toUpperCase())in A}function G(t){return(null==t?void 0:t.toUpperCase())in O}function K(t){return(null==t?void 0:t.toUpperCase())in l}function B(t){return!J(t)&&(null==t?void 0:t.toUpperCase())in d}function C(t){return!J(t)&&["true","false",!0,!1].some((e=>e===t))}function H(t){return!J(t)&&(null==t?void 0:t.toUpperCase())in m}function Q(t){if(J(t))return[];try{const e=JSON.parse(t);if(e instanceof Array)return e.filter((t=>!(t.hasOwnProperty("rowGroup")&&t.hasOwnProperty("category")&&t.hasOwnProperty("subCategory"))))}catch(t){console.error("validateThereOfJsonStr: failed to parse JSON",t)}return["Invalid JSON structure"]}function P(t){if(J(t))return[];try{const e=JSON.parse(t);if(null!==e&&"object"==typeof e&&!(e instanceof Array))return Object.entries(e).filter((([,t])=>"string"!=typeof t||!w(t))).map((([t,e])=>`${t}: ${e}`))}catch(t){console.error("validateAttributesJsonStr: failed to parse JSON",t)}return["Invalid JSON structure"]}function Z(t){if(J(t))return[];try{const e=JSON.parse(t);if(e instanceof Array)return e.filter((t=>!(t.hasOwnProperty("rowGroup")&&t.hasOwnProperty("category"))))}catch(t){console.error("validatePartOfJsonStr: failed to parse JSON",t)}return["Invalid JSON structure"]}function R(t){return(null==t?void 0:t.trim().toUpperCase())in f}function V(t){return["_","k","M","G","T","P","E","Z","Y","m","μ","n","p","P","f","a","z","y"].includes(null==t?void 0:t.trim())||["GREATEST","LEAST"].includes(null==t?void 0:t.trim().toUpperCase())}function Y(t){return(null==t?void 0:t.toUpperCase().trim())in y}function U(t){return(null==t?void 0:t.toUpperCase().trim())in h}function X(t){if(J(t))return[];try{return JSON.parse(t).filter((t=>!(t.hasOwnProperty("scenario")&&t.hasOwnProperty("name")&&t.hasOwnProperty("subGroups"))))}catch(t){console.error("validateColumnThereOfJsonStr: failed to parse JSON",t)}return["Invalid JSON structure"]}function tt(t){if(J(t))return[];try{const e=JSON.parse(t);if("object"!=typeof e||null===e||Array.isArray(e))return["stack: must be a JSON object"];const s=[];if(e.hasOwnProperty("by")){const t=["scenarios","dimensions"];t.includes(e.by)||s.push(`stack: 'by' must be one of: ${t.join(", ")}`)}else s.push("stack: 'by' is required");if(e.hasOwnProperty("mode")){const t=["absolute","relative","absolute-relative"];t.includes(e.mode)||s.push(`stack: 'mode' must be one of: ${t.join(", ")}`)}if(e.hasOwnProperty("order")){const t=["asc","desc","dataset"];t.includes(e.order)||s.push(`stack: 'order' must be one of: ${t.join(", ")}`)}return s}catch(t){return["stack: invalid JSON"]}}function et(t){return!J(t)&&null!==b(t)}M.LOCALE_DATE_FORMAT={en:{week:"'W'WW yyyy",day:"MM/dd/yyyy",fallback:"MM/dd/yyyy"}},M.LOCALE_DATE_FORMAT_SHORT={en:{week:"'W'WW",fallback:"MM/dd/yyyy"}};class st{constructor(){this.cache=new Map,this.tag=st.makeStyleTag()}static makeStyleTag(){const t=document.createElement("style");return t.type="text/css",t.setAttribute("data-bn-computed-style",""),t.append(document.createTextNode("")),(document.head||document.querySelector("head")).append(t),t}apply(t){t.forEach((t=>this.cache.set(t.className,t.style))),this.tag.innerHTML=Array.from(this.cache.values()).map((t=>t)).join("\n")}}const rt=new st;function nt(t){for(var e,s=0,r=0,n=t.length;n>=4;++r,n-=4)e=1540483477*(65535&(e=255&t.charCodeAt(r)|(255&t.charCodeAt(++r))<<8|(255&t.charCodeAt(++r))<<16|(255&t.charCodeAt(++r))<<24))+(59797*(e>>>16)<<16),s=1540483477*(65535&(e^=e>>>24))+(59797*(e>>>16)<<16)^1540483477*(65535&s)+(59797*(s>>>16)<<16);switch(n){case 3:s^=(255&t.charCodeAt(r+2))<<16;case 2:s^=(255&t.charCodeAt(r+1))<<8;case 1:s=1540483477*(65535&(s^=255&t.charCodeAt(r)))+(59797*(s>>>16)<<16)}return(((s=1540483477*(65535&(s^=s>>>13))+(59797*(s>>>16)<<16))^s>>>15)>>>0).toString(36)}const at=t=>$(t)?`${t}px`:t,it={width:{className:"w",cssName:"width",attrName:"width",transform:at},height:{className:"h",cssName:"height",attrName:"height",transform:at},position:{className:"pst",cssName:"position",attrName:"position"},top:{className:"top",cssName:"top",attrName:"top",transform:at},right:{className:"rgt",cssName:"right",attrName:"right",transform:at},bottom:{className:"btm",cssName:"bottom",attrName:"bottom",transform:at},left:{className:"lft",cssName:"left",attrName:"left",transform:at},"font-size":{className:"fts",cssName:"font-size",attrName:"font-size",transform:at},"grid-column":{className:"gdc",cssName:"grid-column",attrName:"grid-column"},"grid-row":{className:"gdr",cssName:"grid-row",attrName:"grid-row"}},ot=Object.keys(it);function ut(t,e){const s=function(t,e){const s=nt(e);return`bn-c-${t.className}_${s}`}(t,e),r=function(t,e,s){return`.${e} {${t.cssName}: ${s};}`}(t,s,e);return{className:s,style:r}}const ct=t=>{const e=new Map;return ot.forEach((s=>{const r=t.getAttribute(s);r&&(["top","left","right","bottom"].includes(s)&&e.set("position",ut(it.position,"absolute")),e.set(s,ut(it[s],(it[s].transform||function(t){return t})(r))))})),e},lt=new MutationObserver((t=>{for(const s of t){const t=s.target,r=ct(t);rt.apply(r);const n=Array.from(r.values()).map((t=>t.className));t.className=t.className.split(" ").filter((t=>!t.startsWith("bn-c-"))).concat(...n).join(" "),e(t)}})),ht=e=>{const s=e.connectedCallback,r=e.disconnectedCallback;e.connectedCallback=()=>{const r=t(e);if(!r)throw new Error("Can't find element field in component undefined");(t=>{const e=ct(t);rt.apply(e);const s=Array.from(e.values()).map((t=>t.className));t.className=t.className.split(" ").filter((t=>!t.startsWith("bn-c-"))).concat(...s).join(" "),lt.observe(t,{attributes:!0,attributeFilter:ot,childList:!1,subtree:!1})})(r),a(s,e)},e.disconnectedCallback=()=>{a(r,e)}};export{X as A,P as B,T as C,O as D,_ as E,z as F,x as G,A as H,W as a,p as b,et as c,q as d,C as e,$ as f,F as g,E as h,J as i,I as j,V as k,tt as l,G as m,K as n,nt as o,M as p,j as q,U as r,B as s,H as t,Q as u,L as v,ht as w,Z as x,R as y,Y as z}
1
+ import{g as t,f as e}from"./p-B_d-jp99.js";import{g as s,c as r,D as n}from"./p-BgIpdpfH.js";import{r as a}from"./p-B4JfKvVT.js";import{m as i,S as o,b as u,A as c,c as l,T as h,D as d,d as m,M as f,e as y,r as b}from"./p-eEfqksk-.js";import{b as N,O as g}from"./p-C5uvAEKI.js";const p=n=>{let o,u,c,l;const h=()=>{const t=u.componentStyles.state;l=i([t._system||{},t._default||{},t[c]||{}],{arrayMergeType:"overwrite"})},d=new MutationObserver((s=>{s.forEach((s=>{"selected-style"===s.attributeName&&(c=t(n).getAttribute("selected-style"),h(),e(n))}))})),m=n.connectedCallback;n.connectedCallback=()=>{const r=t(n);u=s(r),l=u.componentStyles.state._system,d.observe(r,{attributes:!0,attributeFilter:["selected-style"]}),c=t(n).getAttribute("selected-style"),h(),o=u.componentStyles.on("set",(s=>{s===c&&(c=t(n).getAttribute("selected-style"),h(),e(t(n)))})),a(m,n)};const f=n.disconnectedCallback;return n.disconnectedCallback=()=>{d.disconnect(),a(o),r(t(n)),a(f,n)},t=>t(l)},v=/^\s*(set|first|last|min|max|avg|sum|lit)\(\s*(.*?)\s*\)\s*$/,S=/^[A-Za-z_][A-Za-z0-9_]*$/,k=["min","max","avg","sum"];class D{constructor(t,e,s,r){this.label=t,this.alias=e,this.fn=s,this.arg=r}get isNumeric(){return k.includes(this.fn)}}function w(t){if("string"!=typeof t)return!1;const e=v.exec(t);if(!e)return!1;const[,s,r]=e;return"lit"===s?r.length>0:S.test(r)}function T(t,e,s){if(!w(s))return null;const[,r,n]=v.exec(s);return new D(t,e,r,n)}var O,A;!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"}(O||(O={})),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"}(A||(A={}));class M{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.dateFormatPinned=!1,this.dateFormatShortPinned=!1,this.dateFormat=this._dateFormat,this.dateLinkFormat=this._dateLinkFormat,this.dateFormatShort=this._dateFormatShort}setDateLinkFormat(t){this.dateLinkFormat=t}setDateFormat(t){this.dateFormat=t,this.dateFormatPinned=!0}setDateFormatShort(t){this.dateFormatShort=t,this.dateFormatShortPinned=!0}setLocale(t){this.locale=t,this.dateFormatPinned||(this.dateFormat=Object.assign(Object.assign({},this._dateFormat),M.LOCALE_DATE_FORMAT[t]||{})),this.dateFormatShortPinned||(this.dateFormatShort=Object.assign(Object.assign({},this._dateFormatShort),M.LOCALE_DATE_FORMAT_SHORT[t]||{}))}getDateString(t,e){return t.setLocale(this.locale).toFormat(this.dateFormat[e]||this.dateFormat.fallback)}getSmartDateString(t,e){switch(e){case O.DAY:return this.getFormatedDayDate(t);case O.MONTH:return this.getFormatedMonthDate(t);case O.QUARTER:return this.getFormatedQuarterDate(t);case O.WEEK:return this.getFormatedWeekDate(t);case O.HOUR:return this.getFormatedHourDate(t);case O.MINUTE:return this.getFormatedMinuteDate(t);case O.SECOND:return this.getFormatedSecondDate(t);case O.MILLISECOND:return this.getFormatedMilliSecondDate(t);default:return this.getDateString(t,e)}}calculateDistanceType(t,e,s=32){if(null==e)return O.DAY;const r="number"==typeof t?n.fromMillis(t):t,a="number"==typeof e?n.fromMillis(e):e;return 0===a.diff(r).as("milliseconds")?O.DAY:a.diff(r).as("milliseconds")<s?O.MILLISECOND:a.diff(r).as("seconds")<s?O.SECOND:a.diff(r).as("minutes")<s?O.MINUTE:a.diff(r).as("hours")<s?O.HOUR:a.diff(r).as("days")<s?O.DAY:a.diff(r).as("weeks")<s?O.WEEK:a.diff(r).as("months")<s?O.MONTH:a.diff(r).as("quarters")<s?O.QUARTER:O.YEAR}datesBetween(t,e,s,r){const n=this.convertDateDistanceToMomentunitOfTime(s),a=t.startOf(n),i=e.endOf(n);let o=i.diff(a).as(n);const u=[];o>=r&&(o=r);let c=a;do{u.push(c),c=c.plus(this.createDiratonLike(n,1))}while(c<=i&&u.length<o);return u}getDateLinkString(t,e,s,r,a){if(null==t&&null==e)return"";if(null==t&&s!==A.END&&s!==A.YTD)return"";if(null==e&&(A.INTERVAL===s||A.CUM===s||A.END===s||A.YTD===s))return"";const i=t||n.now(),o=e;r===O.AUTO&&(r=this.calculateDistanceType(i,o,a));let u=this.getDateString(i,r),c="",l=A.NONE;return null!=o&&(c=this.getDateString(o,r),l=A.INTERVAL,u===c&&s===A.INTERVAL&&(s=A.NONE),u===c&&s===A.AVG&&(l=A.NONE),A.END!==s&&A.YTD!==s||(u=c),(s===A.INTERVAL||s===A.CUM||A.AVG)&&(r===O.QUARTER?i.quarter===o.quarter&&i.year===o.year?c=c.replace(" "+o.year,""):i.year===o.year&&(u=u.replace(" "+i.year,"")):r===O.MONTH?i.month===o.month&&i.year===o.year?c=c.replace(" "+o.year,""):i.year===o.year&&(u=u.replace(" "+i.year,"")):r===O.WEEK&&(i.weekNumber===o.weekNumber&&i.year===o.year?c=c.replace(" "+o.year,""):i.year===o.year&&(u=u.replace(" "+i.year,""))))),this.dateLinkFormat[s].replace("[LINK]",this.dateLinkFormat[l]).replace("[DATE]",u).replace("[DATE2]",c)}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 e;switch(t){case O.YEAR:e="year";break;case O.MONTH:e="month";break;case O.QUARTER:e="quarter";break;case O.WEEK:e="week";break;case O.DAY:e="day";break;case O.HOUR:e="hour";break;case O.MINUTE:e="minute";break;case O.SECOND:e="second";break;case O.MILLISECOND:e="millisecond";break;default:e="day"}return e}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}}}}function J(t){return null==t||""===t||"null"===t}function F(t){return J(t)||"auto"===t.trim().toLowerCase()?[]:E((null==t?void 0:t.split(",").filter((t=>!(t.toUpperCase().trim()in o)))).toString())}function E(t){return J(t)?[]:t.replace(";",",").split(",").filter((t=>{var e,s,r;const n=t.split("_"),a=null===(e=n[0])||void 0===e?void 0:e.replace(/^dr|^d/,"").toUpperCase().trim(),i=null===(s=n[1])||void 0===s?void 0:s.toUpperCase().trim(),c=null===(r=n[2])||void 0===r?void 0:r.toUpperCase().trim();return 3!==n.length||!(a in o)||!(i in o)||!(c in u)}))}function j(t){return J(t)?[]:E(t.split(",").filter((t=>!(t.toUpperCase().trim()in o))).toString())}function L(t){return J(t)||"auto"===t.trim().toLowerCase()?[]:E(t.split(",").filter((t=>!(t.toUpperCase()in N))).toString())}function W(t){return!J(t)&&Number.isInteger(Number(t))}function $(t){return!J(t)&&!Number.isNaN(Number(t))}function q(t){return!J(t)&&(null==t?void 0:t.toUpperCase())in g}function I(t){return"auto"===(null==t?void 0:t.toLowerCase())||(null==t?void 0:t.toUpperCase())in c}function _(t){if(J(t))return[];try{const e=JSON.parse(t);if(e instanceof Array)return e.filter((t=>!(t.hasOwnProperty("name")&&t.hasOwnProperty("unit"))))}catch(t){console.error("validateMeasureList: failed to parse JSON",t)}return["Invalid JSON structure"]}function z(t){const e=Date.parse(t);return Number.isInteger(e)}function x(t){return(null==t?void 0:t.toUpperCase())in A}function G(t){return(null==t?void 0:t.toUpperCase())in O}function K(t){return(null==t?void 0:t.toUpperCase())in l}function B(t){return!J(t)&&(null==t?void 0:t.toUpperCase())in d}function C(t){return!J(t)&&["true","false",!0,!1].some((e=>e===t))}function H(t){return!J(t)&&(null==t?void 0:t.toUpperCase())in m}function Q(t){if(J(t))return[];try{const e=JSON.parse(t);if(e instanceof Array)return e.filter((t=>!(t.hasOwnProperty("rowGroup")&&t.hasOwnProperty("category")&&t.hasOwnProperty("subCategory"))))}catch(t){console.error("validateThereOfJsonStr: failed to parse JSON",t)}return["Invalid JSON structure"]}function Z(t){if(J(t))return[];try{const e=JSON.parse(t);if(null!==e&&"object"==typeof e&&!(e instanceof Array))return Object.entries(e).filter((([,t])=>"string"!=typeof t||!w(t))).map((([t,e])=>`${t}: ${e}`))}catch(t){console.error("validateAttributesJsonStr: failed to parse JSON",t)}return["Invalid JSON structure"]}function P(t){if(J(t))return[];try{const e=JSON.parse(t);if(e instanceof Array)return e.filter((t=>!(t.hasOwnProperty("rowGroup")&&t.hasOwnProperty("category"))))}catch(t){console.error("validatePartOfJsonStr: failed to parse JSON",t)}return["Invalid JSON structure"]}function R(t){return(null==t?void 0:t.trim().toUpperCase())in f}function V(t){return["_","k","M","G","T","P","E","Z","Y","m","my","μ","n","p","f","a","z","y"].includes(null==t?void 0:t.trim())||["GREATEST","LEAST"].includes(null==t?void 0:t.trim().toUpperCase())}function Y(t){return(null==t?void 0:t.toUpperCase().trim())in y}function U(t){return(null==t?void 0:t.toUpperCase().trim())in h}function X(t){if(J(t))return[];try{return JSON.parse(t).filter((t=>!(t.hasOwnProperty("scenario")&&t.hasOwnProperty("name")&&t.hasOwnProperty("subGroups"))))}catch(t){console.error("validateColumnThereOfJsonStr: failed to parse JSON",t)}return["Invalid JSON structure"]}function tt(t){if(J(t))return[];try{const e=JSON.parse(t);if("object"!=typeof e||null===e||Array.isArray(e))return["stack: must be a JSON object"];const s=[];if(e.hasOwnProperty("by")){const t=["scenarios","dimensions"];t.includes(e.by)||s.push(`stack: 'by' must be one of: ${t.join(", ")}`)}else s.push("stack: 'by' is required");if(e.hasOwnProperty("mode")){const t=["absolute","relative","absolute-relative"];t.includes(e.mode)||s.push(`stack: 'mode' must be one of: ${t.join(", ")}`)}if(e.hasOwnProperty("order")){const t=["asc","desc","dataset"];t.includes(e.order)||s.push(`stack: 'order' must be one of: ${t.join(", ")}`)}return s}catch(t){return["stack: invalid JSON"]}}function et(t){return!J(t)&&null!==b(t)}M.LOCALE_DATE_FORMAT={en:{week:"'W'WW yyyy",day:"MM/dd/yyyy",fallback:"MM/dd/yyyy"}},M.LOCALE_DATE_FORMAT_SHORT={en:{week:"'W'WW",fallback:"MM/dd/yyyy"}};class st{constructor(){this.cache=new Map,this.tag=st.makeStyleTag()}static makeStyleTag(){const t=document.createElement("style");return t.type="text/css",t.setAttribute("data-bn-computed-style",""),t.append(document.createTextNode("")),(document.head||document.querySelector("head")).append(t),t}apply(t){t.forEach((t=>this.cache.set(t.className,t.style))),this.tag.innerHTML=Array.from(this.cache.values()).map((t=>t)).join("\n")}}const rt=new st;function nt(t){for(var e,s=0,r=0,n=t.length;n>=4;++r,n-=4)e=1540483477*(65535&(e=255&t.charCodeAt(r)|(255&t.charCodeAt(++r))<<8|(255&t.charCodeAt(++r))<<16|(255&t.charCodeAt(++r))<<24))+(59797*(e>>>16)<<16),s=1540483477*(65535&(e^=e>>>24))+(59797*(e>>>16)<<16)^1540483477*(65535&s)+(59797*(s>>>16)<<16);switch(n){case 3:s^=(255&t.charCodeAt(r+2))<<16;case 2:s^=(255&t.charCodeAt(r+1))<<8;case 1:s=1540483477*(65535&(s^=255&t.charCodeAt(r)))+(59797*(s>>>16)<<16)}return(((s=1540483477*(65535&(s^=s>>>13))+(59797*(s>>>16)<<16))^s>>>15)>>>0).toString(36)}const at=t=>$(t)?`${t}px`:t,it={width:{className:"w",cssName:"width",attrName:"width",transform:at},height:{className:"h",cssName:"height",attrName:"height",transform:at},position:{className:"pst",cssName:"position",attrName:"position"},top:{className:"top",cssName:"top",attrName:"top",transform:at},right:{className:"rgt",cssName:"right",attrName:"right",transform:at},bottom:{className:"btm",cssName:"bottom",attrName:"bottom",transform:at},left:{className:"lft",cssName:"left",attrName:"left",transform:at},"font-size":{className:"fts",cssName:"font-size",attrName:"font-size",transform:at},"grid-column":{className:"gdc",cssName:"grid-column",attrName:"grid-column"},"grid-row":{className:"gdr",cssName:"grid-row",attrName:"grid-row"}},ot=Object.keys(it);function ut(t,e){const s=function(t,e){const s=nt(e);return`bn-c-${t.className}_${s}`}(t,e),r=function(t,e,s){return`.${e} {${t.cssName}: ${s};}`}(t,s,e);return{className:s,style:r}}const ct=t=>{const e=new Map;return ot.forEach((s=>{const r=t.getAttribute(s);r&&(["top","left","right","bottom"].includes(s)&&e.set("position",ut(it.position,"absolute")),e.set(s,ut(it[s],(it[s].transform||function(t){return t})(r))))})),e},lt=new MutationObserver((t=>{for(const s of t){const t=s.target,r=ct(t);rt.apply(r);const n=Array.from(r.values()).map((t=>t.className));t.className=t.className.split(" ").filter((t=>!t.startsWith("bn-c-"))).concat(...n).join(" "),e(t)}})),ht=e=>{const s=e.connectedCallback,r=e.disconnectedCallback;e.connectedCallback=()=>{const r=t(e);if(!r)throw new Error("Can't find element field in component undefined");(t=>{const e=ct(t);rt.apply(e);const s=Array.from(e.values()).map((t=>t.className));t.className=t.className.split(" ").filter((t=>!t.startsWith("bn-c-"))).concat(...s).join(" "),lt.observe(t,{attributes:!0,attributeFilter:ot,childList:!1,subtree:!1})})(r),a(s,e)},e.disconnectedCallback=()=>{a(r,e)}};export{X as A,Z as B,T as C,O as D,_ as E,z as F,x as G,A as H,W as a,p as b,et as c,q as d,C as e,$ as f,F as g,E as h,J as i,I as j,V as k,tt as l,G as m,K as n,nt as o,M as p,j as q,U as r,B as s,H as t,Q as u,L as v,ht as w,P as x,R as y,Y as z}
@@ -0,0 +1 @@
1
+ import{g as t,c as n}from"./p-BgIpdpfH.js";import{r as e}from"./p-B4JfKvVT.js";import{g as o,f as r}from"./p-B_d-jp99.js";const i=(t,n)=>{const e=[],o=[];for(const r of n)(t(r)?e:o).push(r);return[e,o]},a="WARN_use_dataset",s=(t,n)=>{const e=t.errors;if(e)if(n.length>0){const t=n.map((t=>t.substring(1))).join(", ");e.addOrReplace({id:a,type:"warning",message:`Using datasource(s) "${t}" directly. Prefer using a dataset (bn-dataset) for query support and metadata.`})}else e.remove(a)},u=(r,a,u)=>{let l,c,f=[],d=[],p=[];const v=(t,n)=>{const e=n?t.substring(1):t;let o;try{o=c.db.db.exec(`SELECT * FROM \`${e}\``)}catch(t){o=[]}a(t,o)},m=()=>{f.forEach((t=>t())),f=[],d.forEach((t=>{t&&(f.push(c.db.subscribe(t,(()=>v(t,!1)))),v(t,!1),(t=>{if(u){const n=c.datasetsMeta.get(t);n&&u(t,n)}})(t))})),p.forEach((t=>{t&&(f.push(c.db.subscribe(t.substring(1),(()=>v(t,!0)))),v(t,!0))}))},b=new MutationObserver((t=>{t.forEach((t=>{"datasets"===t.attributeName&&([p,d]=i((t=>t.startsWith("$")),o(r).getAttribute("datasets").split(",")),s(r,p),m())}))})),h=r.connectedCallback;r.connectedCallback=()=>{const n=o(r);c=t(n),[p,d]=i((t=>t.startsWith("$")),(n.getAttribute("datasets")||"").split(",")),s(r,p),m(),b.observe(n,{attributes:!0,attributeFilter:["datasets"]}),u&&(l=c.datasetsMeta.on("set",((t,n)=>{d.includes(t)&&u(t,n)}))),e(h,r)};const g=r.disconnectedCallback;return r.disconnectedCallback=()=>{b.disconnect(),f.forEach((t=>t())),f=[],e(l),n(o(r)),e(g,r)},t=>{d=t,m()}},l="inherited-page",c="bn-layout-page";function f(t){return"inherited-closest"===t||t===l}function d(t,n){let e=t.parentNode;for(;e;){if(e instanceof HTMLElement){const t=e.nodeName.toLowerCase();if(n===l){if(t===c)return e}else if("bn-layout-card"===t||t===c)return e}if(e.parentNode)e=e.parentNode;else{if(!(e instanceof ShadowRoot))break;e=e.host}}}const p=(t,n)=>{const i=new Map;let a,s=null;const u=t.connectedCallback;t.connectedCallback=()=>{(()=>{const e=o(t);i.clear();const u=[];for(const o of n){const n=t[o.propName];if("string"!=typeof n||!f(n))continue;if(a||(a=d(e,n)),!a)continue;const r=a.getAttribute(o.ancestorAttr);null!=r&&i.set(o.propName,r),u.push(o.ancestorAttr)}a&&u.length>0&&(s=new MutationObserver((()=>{for(const e of n){if(!f(t[e.propName]))continue;const n=a.getAttribute(e.ancestorAttr);null!=n?i.set(e.propName,n):i.delete(e.propName)}r(t)})),s.observe(a,{attributes:!0,attributeFilter:u}))})(),e(u,t)};const l=t.disconnectedCallback;return t.disconnectedCallback=()=>{s&&(s.disconnect(),s=null),a=void 0,i.clear(),e(l,t)},(t,n)=>{if(f(n))return i.get(t)}},v=i=>{let a,s,u,l=null;const c=()=>{var t;const n=o(i);if(l&&(l.disconnect(),l=null),s=null!==(t=n.getAttribute("i18n-namespace"))&&void 0!==t?t:n.getAttribute("namespace"),null!=s)return;const e=function(t){let n=t.parentNode;for(;n;){if(n instanceof HTMLElement&&n.hasAttribute("i18n-namespace"))return n;if(n.parentNode)n=n.parentNode;else{if(!(n instanceof ShadowRoot))break;n=n.host}}}(n);e&&(s=e.getAttribute("i18n-namespace"),l=new MutationObserver((()=>{c(),r(i)})),l.observe(e,{attributes:!0,attributeFilter:["i18n-namespace"]}))},f=new MutationObserver((t=>{t.forEach((t=>{"i18n-namespace"!==t.attributeName&&"namespace"!==t.attributeName||(c(),r(i))}))})),d=i.connectedCallback;i.connectedCallback=()=>{const n=o(i);u=t(n),f.observe(n,{attributes:!0,attributeFilter:["i18n-namespace","namespace"]}),c(),a=u.internationalization.on("set",(t=>{t!==s&&"_system"!==t||r(i)})),e(d,i)};const p=i.disconnectedCallback;return i.disconnectedCallback=()=>{f.disconnect(),l&&(l.disconnect(),l=null),e(a),n(o(i)),e(p,i)},{t:(t,n)=>{var e,r,a,l,c;t.startsWith(".")&&(t=o(i).localName+t);const f=u.internationalization.state,d=u.context.state.locale,p=null!==(a=null===(r=null===(e=f[s])||void 0===e?void 0:e[d])||void 0===r?void 0:r[t])&&void 0!==a?a:null===(c=null===(l=f._system)||void 0===l?void 0:l[d])||void 0===c?void 0:c[t];return null==p?t:p.replace(/{{([\s\S]+?)}}/g,((t,e)=>{var o;return null!==(o=null==n?void 0:n[e.trim()])&&void 0!==o?o:""}))}}};function m(t,n=!1){const e=b(t);if(!e)return n&&console.log("[parentDims] no layout parent found for",t.tagName),{width:0,height:0};const o=getComputedStyle(e),r=e.clientWidth-parseFloat(o.paddingLeft)-parseFloat(o.paddingRight),i=function(t,n=!1){let e=b(t),o=0,r=null,i=1;for(;e;){if(e.hasAttribute("data-bn-fit-content")){n&&console.log(`[height:${o}]`,e.tagName,"fit-content region → discarding inner candidate"),r=null;const t=parseInt(e.getAttribute("data-bn-fit-content"),10);!isNaN(t)&&t>1&&(i*=t),e=h(e),o++;continue}const t=getComputedStyle(e),a=t.overflowY;if(n&&console.log(`[height:${o}]`,e.tagName,e.className||"(no class)",`overflow=${a} clientH=${e.clientHeight} h=${t.height}`),null===r)if("hidden"===a||"scroll"===a||"auto"===a)r=e.clientHeight-parseFloat(t.paddingTop)-parseFloat(t.paddingBottom),n&&console.log(`[height] candidate at depth ${o}: ${Math.round(r)}px`);else if("none"!==t.maxHeight){const n=parseFloat(t.maxHeight);!isNaN(n)&&n>0&&(r=Math.min(n,e.clientHeight-parseFloat(t.paddingTop)-parseFloat(t.paddingBottom)))}e=h(e),o++}return null!==r?r/i:(n&&console.log("[height] NO constrained ancestor → viewport fallback"),"undefined"!=typeof window?window.innerHeight/i:0)}(t,n);return n&&console.log("[parentDims]",t.tagName,"→ layoutParent:",e.tagName,e.className||"(no class)",`clientW=${e.clientWidth} → w=${Math.round(r)}, h=${Math.round(i)}`,"overflow:",o.overflow),{width:Math.max(0,r),height:Math.max(0,i)}}function b(t){var n;const e=t.parentElement;return(null===(n=null==e?void 0:e.assignedSlot)||void 0===n?void 0:n.parentElement)?e.assignedSlot.parentElement:e}function h(t){var n;if(null===(n=t.assignedSlot)||void 0===n?void 0:n.parentElement)return t.assignedSlot.parentElement;if(t.parentElement)return t.parentElement;const e=t.getRootNode();return e instanceof ShadowRoot?e.host:null}function g(t){if(null==t||""===t)return{mode:"empty"};if("none"===t)return{mode:"none"};if("auto"===t)return{mode:"auto"};const n=Number(t);return!isNaN(n)&&n>0?{mode:"factor",factor:n}:{mode:"empty"}}const w={k:1e3,K:1e3,M:1e6,G:1e9,T:1e12},y=/^(\d+(?:\.\d+)?|\.\d+)\s*([kKMGT])?$/;function M(t){var n;if("number"==typeof t)return Number.isFinite(t)&&t>0?{kind:"number",value:t}:{kind:"invalid",raw:String(t)};const e=null!==(n=null==t?void 0:t.toString().trim())&&void 0!==n?n:"";if("auto"===e.toLowerCase())return{kind:"auto"};const o=y.exec(e);if(o){const t=Number(o[1])*(o[2]?w[o[2]]:1);if(Number.isFinite(t)&&t>0)return{kind:"number",value:t}}return{kind:"invalid",raw:e}}function $(t,n){const e=M(t);if("auto"===e.kind)return{kind:"auto"};if("string"==typeof t){const e=t.trim();if(n.has(e))return{kind:"value",value:n.get(e)}}return"number"===e.kind?{kind:"value",value:e.value}:{kind:"invalid",raw:e.raw}}const k=[[1e12,"T"],[1e9,"G"],[1e6,"M"],[1e3,"k"]];function N(t){if(!Number.isFinite(t)||t<=0)return String(t);const n=t=>String(Number(t.toPrecision(3)));for(const[e,o]of k)if(t>=e)return`${n(t/e)}${o}`;return n(t)}export{v as a,N as b,p as c,M as d,d as f,m as g,f as i,g as p,$ as r,u as w}
@@ -1 +1 @@
1
- import{f as t,g as e}from"./p-B_d-jp99.js";import{g as s,c as r}from"./p-BgIpdpfH.js";import{r as n}from"./p-B4JfKvVT.js";import{i as o,f as l}from"./p-C9i1Xsib.js";import{m as i}from"./p-eEfqksk-.js";const u=u=>{let a,c,f,m,p=null;const v=()=>{const t=c.ruleSets.state;m=i([t._system||{},t._default||{},t[f]||{}])},d=()=>{const s=e(u),r=s.getAttribute("ruleset");if(p&&(p.disconnect(),p=null),r&&o(r)){const e=l(s,r);f=null==e?void 0:e.getAttribute("ruleset"),e&&(p=new MutationObserver((()=>{f=e.getAttribute("ruleset"),v(),t(u)})),p.observe(e,{attributes:!0,attributeFilter:["ruleset"]}))}else f=r},b=new MutationObserver((e=>{e.forEach((e=>{"ruleset"===e.attributeName&&(d(),v(),t(u))}))})),j=u.connectedCallback;u.connectedCallback=()=>{const r=e(u);c=s(r),m=c.ruleSets.state._system,b.observe(r,{attributes:!0,attributeFilter:["ruleset"]}),d(),v(),a=c.ruleSets.on("set",(s=>{s!==f&&"_default"!==s||(d(),v(),t(e(u)))})),n(j,u)};const w=u.disconnectedCallback;return u.disconnectedCallback=()=>{b.disconnect(),p&&(p.disconnect(),p=null),n(a),r(e(u)),n(w,u)},()=>m};function a(t,e,s=80){let r=null,n=!1,o=-1,l=-1;const i=function(t){var e;const s=t.parentElement;return(null===(e=null==s?void 0:s.assignedSlot)||void 0===e?void 0:e.parentElement)?s.assignedSlot.parentElement:s}(t);if(!i)return{disconnect(){}};const u=new ResizeObserver((t=>{var u;if(n)return;let a,c;const f=t[0];if(null===(u=null==f?void 0:f.contentBoxSize)||void 0===u?void 0:u.length){const t=f.contentBoxSize[0];a=t.inlineSize,c=t.blockSize}else a=i.clientWidth,c=i.clientHeight;Math.abs(a-o)<=2&&Math.abs(c-l)<=2||(o=a,l=c,null!=r&&clearTimeout(r),r=setTimeout((()=>{n||e()}),s))}));return u.observe(i),{disconnect(){n=!0,null!=r&&clearTimeout(r),u.disconnect()}}}export{a as o,u as w}
1
+ import{f as t,g as e}from"./p-B_d-jp99.js";import{g as s,c as r}from"./p-BgIpdpfH.js";import{r as n}from"./p-B4JfKvVT.js";import{i as o,f as l}from"./p-D75i_YOP.js";import{m as i}from"./p-eEfqksk-.js";const u=u=>{let a,c,f,m,p=null;const v=()=>{const t=c.ruleSets.state;m=i([t._system||{},t._default||{},t[f]||{}])},d=()=>{const s=e(u),r=s.getAttribute("ruleset");if(p&&(p.disconnect(),p=null),r&&o(r)){const e=l(s,r);f=null==e?void 0:e.getAttribute("ruleset"),e&&(p=new MutationObserver((()=>{f=e.getAttribute("ruleset"),v(),t(u)})),p.observe(e,{attributes:!0,attributeFilter:["ruleset"]}))}else f=r},b=new MutationObserver((e=>{e.forEach((e=>{"ruleset"===e.attributeName&&(d(),v(),t(u))}))})),j=u.connectedCallback;u.connectedCallback=()=>{const r=e(u);c=s(r),m=c.ruleSets.state._system,b.observe(r,{attributes:!0,attributeFilter:["ruleset"]}),d(),v(),a=c.ruleSets.on("set",(s=>{s!==f&&"_default"!==s||(d(),v(),t(e(u)))})),n(j,u)};const w=u.disconnectedCallback;return u.disconnectedCallback=()=>{b.disconnect(),p&&(p.disconnect(),p=null),n(a),r(e(u)),n(w,u)},()=>m};function a(t,e,s=80){let r=null,n=!1,o=-1,l=-1;const i=function(t){var e;const s=t.parentElement;return(null===(e=null==s?void 0:s.assignedSlot)||void 0===e?void 0:e.parentElement)?s.assignedSlot.parentElement:s}(t);if(!i)return{disconnect(){}};const u=new ResizeObserver((t=>{var u;if(n)return;let a,c;const f=t[0];if(null===(u=null==f?void 0:f.contentBoxSize)||void 0===u?void 0:u.length){const t=f.contentBoxSize[0];a=t.inlineSize,c=t.blockSize}else a=i.clientWidth,c=i.clientHeight;Math.abs(a-o)<=2&&Math.abs(c-l)<=2||(o=a,l=c,null!=r&&clearTimeout(r),r=setTimeout((()=>{n||e()}),s))}));return u.observe(i),{disconnect(){n=!0,null!=r&&clearTimeout(r),u.disconnect()}}}export{a as o,u as w}
@@ -1 +1 @@
1
- import{r as t,h as i,H as o,g as e}from"./p-B_d-jp99.js";import{a as n,w as s,g as a,p as l}from"./p-C9i1Xsib.js";import{w as r,a as d}from"./p-B4JfKvVT.js";import{w as f,b as v}from"./p-BpWWgN6k.js";import{s as c}from"./p-BA48JiHe.js";import"./p-BgIpdpfH.js";import"./p-eEfqksk-.js";import"./p-C5uvAEKI.js";const h=/\b(__proto__|globalThis)\b|\.constructor\b/,u=class{constructor(i){t(this,i),this.data={},f(this),r(this),this.errors=d(this),this.t=n(this).t,s(this,((t,i)=>{this.data=Object.assign(Object.assign({},this.data),{[t]:i})})),this.componentStyle=v(this)}validateValue(t){"string"!=typeof t||""===t?this.errors.addOrReplace({id:"no_value",type:"warning",message:"Empty value"}):this.errors.remove("no_value")}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")}componentWillLoad(){this.validateValue(this.value),this.validateScaling(this.scale)}evalTemplate(t){if(!t)return"";if(h.test(t))return this.errors.addOrReplace({id:"ERR_value_eval",type:"error",message:"Template contains forbidden pattern"}),"";try{const i=new Proxy({data:this.data,t:this.t},{has:()=>!0,get:(t,i)=>i===Symbol.unscopables?void 0:t[i],set:()=>!0}),o=new Function("sandbox","with(sandbox){try{return`"+t+'`}catch(e){return""}}').call(i,i);return this.errors.remove("ERR_value_eval"),null!=o?String(o):""}catch(t){return this.errors.addOrReplace({id:"ERR_value_eval",type:"error",message:`Template evaluation failed: ${t instanceof Error?t.message:String(t)}`}),""}}prepareStyle(){return this.componentStyle((t=>{var i,o,e,n,s,a,l,r,d,f,v,c,h,u,p,b,m,g,y,w,_,$;return{fontStyles:{font:`${null!==(n=null!==(o=null===(i=t["bn-text"])||void 0===i?void 0:i.fontSizePx)&&void 0!==o?o:null===(e=t.global)||void 0===e?void 0:e.fontSizePx)&&void 0!==n?n:13.3333}px ${null!==(r=null!==(a=null===(s=t["bn-text"])||void 0===s?void 0:s.fontFamily)&&void 0!==a?a:null===(l=t.global)||void 0===l?void 0:l.fontFamily)&&void 0!==r?r:"'Noto Sans', sans-serif"}`,size:null!==(c=null!==(f=null===(d=t["bn-text"])||void 0===d?void 0:d.fontSizePx)&&void 0!==f?f:null===(v=t.global)||void 0===v?void 0:v.fontSizePx)&&void 0!==c?c:13.3333,color:null!==(b=null!==(u=null===(h=t["bn-text"])||void 0===h?void 0:h.fontColor)&&void 0!==u?u:null===(p=t.global)||void 0===p?void 0:p.fontColor)&&void 0!==b?b:"#000000",background:null!==(w=null!==(g=null===(m=t["bn-text"])||void 0===m?void 0:m.fontBackgroundColor)&&void 0!==g?g:null===(y=t.global)||void 0===y?void 0:y.fontBackgroundColor)&&void 0!==w?w:"#ffffff",leading:null!==($=null===(_=t["bn-text"])||void 0===_?void 0:_.leading)&&void 0!==$?$:1.8}}}))}applyScaling(t){const i=this.element,{mode:o,factor:e}=l(this.scale),{width:n,height:s}=a(i),r=i.scrollHeight>i.clientHeight+1?i.clientHeight:s,d=n,f=d>0&&i.scrollWidth>d+1,v=r>0&&i.scrollHeight>r+1,c=f||v;if(d<=0&&r<=0)return;if("none"===o){if(c){const t=[];f&&t.push(`w:${i.scrollWidth}>${Math.round(d)}`),v&&t.push(`h:${i.scrollHeight}>${Math.round(r)}`),this.errors.addOrReplace({id:"WARN_overflow",type:"warning",message:`Content overflows container (${t.join(", ")})`})}else this.errors.remove("WARN_overflow");return}if("factor"===o){if(c){const t=[];f&&t.push(`w:${i.scrollWidth}>${Math.round(d)}`),v&&t.push(`h:${i.scrollHeight}>${Math.round(r)}`),this.errors.addOrReplace({id:"WARN_overflow",type:"warning",message:`Content overflows with factor ${e} (${t.join(", ")})`})}else this.errors.remove("WARN_overflow");return}i.style.setProperty("--bn-font-size",`${t}px`);const h=i.scrollWidth,u=i.scrollHeight,p=i.clientHeight,b=u>p+1?p:s,m=d<=0||h<=d+1,g=b<=0||u<=b+1;if(m&&g)return void this.errors.remove("AUTO_scale");const y=Math.min(1,!m&&d>0?d/h:1,!g&&b>0?b/u:1);i.style.setProperty("--bn-font-size",t*y+"px"),"empty"===o?this.errors.addOrReplace({id:"AUTO_scale",type:"warning",message:`Auto-scaled font by factor ${y.toFixed(3)}`}):this.errors.remove("AUTO_scale")}componentDidRender(){this.container.innerHTML=c(this.evalTemplate(this.value)),this.applyScaling(this.prepareStyle().fontStyles.size)}render(){const{fontStyles:t}=this.prepareStyle(),{mode:e,factor:n}=l(this.scale),s="factor"===e?t.size*n+"px":`${t.size}px`,a={"--bn-font-family":t.font.substring(t.font.indexOf("px ")+3),"--bn-font-size":s,"--bn-font-color":t.color,"--bn-font-background":t.background};return i(o,{key:"b5516777bb29ddddf3fb43ff518fdc383c86a812",style:a},i("div",{key:"dc325b0679f0a151ac60d32cae70f2a2f14ae205"},i("span",{key:"fcdc9c6cb9224428e7b47df3ac10336bcdffb260",class:"container",ref:t=>{this.container=t}})))}get element(){return e(this)}static get watchers(){return{value:[{validateValue:0}],scale:[{validateScaling:0}]}}};u.style=':host{padding:0.5em;display:inline-block;position:relative;overflow:hidden;font-family:var(--bn-font-family, "Noto Sans", sans-serif);font-size:var(--bn-font-size, 13.3333px);color:var(--bn-font-color, #000000);background-color:var(--bn-font-background, white)}span.container p{margin:0}';export{u as bn_text}
1
+ import{r as t,h as i,H as o,g as e}from"./p-B_d-jp99.js";import{a as n,w as s,g as a,p as l}from"./p-D75i_YOP.js";import{w as r,a as d}from"./p-B4JfKvVT.js";import{w as f,b as v}from"./p-D1SJ10zl.js";import{s as c}from"./p-BA48JiHe.js";import"./p-BgIpdpfH.js";import"./p-eEfqksk-.js";import"./p-C5uvAEKI.js";const h=/\b(__proto__|globalThis)\b|\.constructor\b/,u=class{constructor(i){t(this,i),this.data={},f(this),r(this),this.errors=d(this),this.t=n(this).t,s(this,((t,i)=>{this.data=Object.assign(Object.assign({},this.data),{[t]:i})})),this.componentStyle=v(this)}validateValue(t){"string"!=typeof t||""===t?this.errors.addOrReplace({id:"no_value",type:"warning",message:"Empty value"}):this.errors.remove("no_value")}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")}componentWillLoad(){this.validateValue(this.value),this.validateScaling(this.scale)}evalTemplate(t){if(!t)return"";if(h.test(t))return this.errors.addOrReplace({id:"ERR_value_eval",type:"error",message:"Template contains forbidden pattern"}),"";try{const i=new Proxy({data:this.data,t:this.t},{has:()=>!0,get:(t,i)=>i===Symbol.unscopables?void 0:t[i],set:()=>!0}),o=new Function("sandbox","with(sandbox){try{return`"+t+'`}catch(e){return""}}').call(i,i);return this.errors.remove("ERR_value_eval"),null!=o?String(o):""}catch(t){return this.errors.addOrReplace({id:"ERR_value_eval",type:"error",message:`Template evaluation failed: ${t instanceof Error?t.message:String(t)}`}),""}}prepareStyle(){return this.componentStyle((t=>{var i,o,e,n,s,a,l,r,d,f,v,c,h,u,p,b,m,g,y,_,w,$;return{fontStyles:{font:`${null!==(n=null!==(o=null===(i=t["bn-text"])||void 0===i?void 0:i.fontSizePx)&&void 0!==o?o:null===(e=t.global)||void 0===e?void 0:e.fontSizePx)&&void 0!==n?n:13.3333}px ${null!==(r=null!==(a=null===(s=t["bn-text"])||void 0===s?void 0:s.fontFamily)&&void 0!==a?a:null===(l=t.global)||void 0===l?void 0:l.fontFamily)&&void 0!==r?r:"'Noto Sans', sans-serif"}`,size:null!==(c=null!==(f=null===(d=t["bn-text"])||void 0===d?void 0:d.fontSizePx)&&void 0!==f?f:null===(v=t.global)||void 0===v?void 0:v.fontSizePx)&&void 0!==c?c:13.3333,color:null!==(b=null!==(u=null===(h=t["bn-text"])||void 0===h?void 0:h.fontColor)&&void 0!==u?u:null===(p=t.global)||void 0===p?void 0:p.fontColor)&&void 0!==b?b:"#000000",background:null!==(_=null!==(g=null===(m=t["bn-text"])||void 0===m?void 0:m.fontBackgroundColor)&&void 0!==g?g:null===(y=t.global)||void 0===y?void 0:y.fontBackgroundColor)&&void 0!==_?_:"#ffffff",leading:null!==($=null===(w=t["bn-text"])||void 0===w?void 0:w.leading)&&void 0!==$?$:1.8}}}))}applyScaling(t){const i=this.element,{mode:o,factor:e}=l(this.scale),{width:n,height:s}=a(i),r=i.scrollHeight>i.clientHeight+1?i.clientHeight:s,d=n,f=d>0&&i.scrollWidth>d+1,v=r>0&&i.scrollHeight>r+1,c=f||v;if(d<=0&&r<=0)return;if("none"===o){if(c){const t=[];f&&t.push(`w:${i.scrollWidth}>${Math.round(d)}`),v&&t.push(`h:${i.scrollHeight}>${Math.round(r)}`),this.errors.addOrReplace({id:"WARN_overflow",type:"warning",message:`Content overflows container (${t.join(", ")})`})}else this.errors.remove("WARN_overflow");return}if("factor"===o){if(c){const t=[];f&&t.push(`w:${i.scrollWidth}>${Math.round(d)}`),v&&t.push(`h:${i.scrollHeight}>${Math.round(r)}`),this.errors.addOrReplace({id:"WARN_overflow",type:"warning",message:`Content overflows with factor ${e} (${t.join(", ")})`})}else this.errors.remove("WARN_overflow");return}i.style.setProperty("--bn-font-size",`${t}px`);const h=i.scrollWidth,u=i.scrollHeight,p=i.clientHeight,b=u>p+1?p:s,m=d<=0||h<=d+1,g=b<=0||u<=b+1;if(m&&g)return void this.errors.remove("AUTO_scale");const y=Math.min(1,!m&&d>0?d/h:1,!g&&b>0?b/u:1);i.style.setProperty("--bn-font-size",t*y+"px"),"empty"===o?this.errors.addOrReplace({id:"AUTO_scale",type:"warning",message:`Auto-scaled font by factor ${y.toFixed(3)}`}):this.errors.remove("AUTO_scale")}componentDidRender(){this.container.innerHTML=c(this.evalTemplate(this.value)),this.applyScaling(this.prepareStyle().fontStyles.size)}render(){const{fontStyles:t}=this.prepareStyle(),{mode:e,factor:n}=l(this.scale),s="factor"===e?t.size*n+"px":`${t.size}px`,a={"--bn-font-family":t.font.substring(t.font.indexOf("px ")+3),"--bn-font-size":s,"--bn-font-color":t.color,"--bn-font-background":t.background};return i(o,{key:"b5516777bb29ddddf3fb43ff518fdc383c86a812",style:a},i("div",{key:"dc325b0679f0a151ac60d32cae70f2a2f14ae205"},i("span",{key:"fcdc9c6cb9224428e7b47df3ac10336bcdffb260",class:"container",ref:t=>{this.container=t}})))}get element(){return e(this)}static get watchers(){return{value:[{validateValue:0}],scale:[{validateScaling:0}]}}};u.style=':host{padding:0.5em;display:inline-block;position:relative;overflow:hidden;font-family:var(--bn-font-family, "Noto Sans", sans-serif);font-size:var(--bn-font-size, 13.3333px);color:var(--bn-font-color, #000000);background-color:var(--bn-font-background, white)}span.container p{margin:0}';export{u as bn_text}
@@ -1 +1 @@
1
- import{r as t,h as e,H as s,g as r}from"./p-B_d-jp99.js";import{e as i,w as o,b as n}from"./p-BpWWgN6k.js";import{w as d,a}from"./p-B4JfKvVT.js";import"./p-BgIpdpfH.js";import"./p-eEfqksk-.js";import"./p-C5uvAEKI.js";function l(t){if(!t||""===t.trim()||"[]"===t)return[];try{const e=JSON.parse(t);return Array.isArray(e)?e.map(((t,e)=>{var s,r,i;return"string"==typeof t?{label:t,id:String(e)}:"object"==typeof t&&null!==t?{label:null!==(r=null!==(s=t.label)&&void 0!==s?s:t.name)&&void 0!==r?r:String(e),id:null!==(i=t.id)&&void 0!==i?i:String(e)}:{label:String(t),id:String(e)}})):[]}catch(t){return console.error("parseHeaders: failed to parse JSON",t),[]}}function h(t){if(!t||""===t.trim()||"[]"===t)return[];try{const e=JSON.parse(t);if(!Array.isArray(e))return["Headers must be an array"];const s=[],r=new Set;return e.forEach(((t,e)=>{"object"==typeof t&&null!==t&&void 0!==t.id&&("string"!=typeof t.id?s.push(`Header[${e}]: 'id' must be a string`):r.has(t.id)?s.push(`Header[${e}]: duplicate id '${t.id}'`):r.add(t.id),void 0!==t.label&&"string"!=typeof t.label&&s.push(`Header[${e}]: 'label' must be a string`))})),s}catch(t){return console.error("validateHeadersJson: failed to parse JSON",t),["Invalid JSON structure"]}}const u=class{validateRowHeaders(t){const e="ERR_rowHeaders",s=h(t);s.length>0?this.errors.addOrReplace({id:e,type:"error",message:`row-headers: ${s.join("; ")}`}):this.errors.remove(e),this.updateGridConfig()}validateColumnHeaders(t){const e="ERR_columnHeaders",s=h(t);s.length>0?this.errors.addOrReplace({id:e,type:"error",message:`column-headers: ${s.join("; ")}`}):this.errors.remove(e),this.updateGridConfig()}validateShowRowHeaders(t){const e="ERR_showRowHeaders";i(t)?this.errors.remove(e):this.errors.addOrReplace({id:e,type:"warning",message:`show-row-headers: invalid value '${t}', must be 'true' or 'false'`})}validateShowColumnHeaders(t){const e="ERR_showColumnHeaders";i(t)?this.errors.remove(e):this.errors.addOrReplace({id:e,type:"warning",message:`show-column-headers: invalid value '${t}', must be 'true' or 'false'`})}validateShowBorders(t){const e="ERR_showBorders";i(t)?this.errors.remove(e):this.errors.addOrReplace({id:e,type:"warning",message:`show-borders: invalid value '${t}', must be 'true' or 'false'`})}constructor(e){t(this,e),this.gridConfig={rows:[],columns:[]},this.chartTitle="",this.rowHeaders="[]",this.columnHeaders="[]",this.showRowHeaders="true",this.showColumnHeaders="true",this.showBorders="true",this.rowHeaderWidth="auto",this.cellGap="0px",o(this),d(this),this.errors=a(this),this.componentStyle=n(this)}getGridStyle(){return this.componentStyle((t=>t["bn-grid"]))}componentWillLoad(){this.validateRowHeaders(this.rowHeaders),this.validateColumnHeaders(this.columnHeaders),this.validateShowRowHeaders(this.showRowHeaders),this.validateShowColumnHeaders(this.showColumnHeaders),this.validateShowBorders(this.showBorders)}updateGridConfig(){var t;this.gridConfig=(t=this.columnHeaders,{rows:l(this.rowHeaders),columns:l(t)})}shouldShowRowHeaders(){return"true"===this.showRowHeaders&&this.gridConfig.rows.length>0}shouldShowColumnHeaders(){return"true"===this.showColumnHeaders&&this.gridConfig.columns.length>0}shouldShowBorders(){return"true"===this.showBorders}getGridTemplateColumns(){const t=[];this.shouldShowRowHeaders()&&t.push(this.rowHeaderWidth);const e=this.gridConfig.columns.length||1;for(let s=0;s<e;s++)t.push("auto");return t.join(" ")}getGridTemplateRows(){const t=[];this.chartTitle&&t.push("auto"),this.shouldShowColumnHeaders()&&t.push("auto");const e=this.gridConfig.rows.length||1;for(let s=0;s<e;s++)t.push("auto");return t.join(" ")}renderTitle(){if(!this.chartTitle)return null;const t=(this.shouldShowRowHeaders()?1:0)+this.gridConfig.columns.length;return e("div",{class:"grid-title",style:{"grid-column":`1 / span ${t}`,"grid-row":"1"}},this.chartTitle)}renderColumnHeaders(){if(!this.shouldShowColumnHeaders())return null;const t=this.getGridStyle(),s=this.shouldShowBorders()?`${t.borderWidth}px solid ${t.borderColor}`:"none",r=this.shouldShowRowHeaders()?2:1,i=this.chartTitle?2:1;return this.gridConfig.columns.map(((o,n)=>{const d=n>0;return e("div",{key:`col-header-${o.id}`,class:"grid-header grid-header-col",style:{"grid-column":String(r+n),"grid-row":String(i),"border-left":d?s:"none",padding:`${t.cellPadding}px`,"padding-left":d?`${t.cellPadding+4}px`:`${t.cellPadding}px`}},o.label)}))}renderDataCells(){const t=this.getGridStyle(),s=this.shouldShowBorders()?`${t.borderWidth}px solid ${t.borderColor}`:"none",r=this.shouldShowRowHeaders()?2:1,i=(this.chartTitle?1:0)+(this.shouldShowColumnHeaders()?1:0)+1,o=[];return this.gridConfig.rows.length>0&&this.gridConfig.columns.length>0&&this.gridConfig.rows.forEach(((n,d)=>{if(this.shouldShowRowHeaders()){const r=d>0;o.push(e("div",{key:`row-header-${n.id}`,class:"grid-header grid-header-row",style:{"grid-column":"1","grid-row":String(i+d),"border-top":r?s:"none",padding:`${t.cellPadding}px`,"padding-top":r?`${t.cellPadding+4}px`:`${t.cellPadding}px`}},n.label))}this.gridConfig.columns.forEach(((a,l)=>{const h=function(t,e){return`${t.id}-${e.id}`}(n,a),u=l>0,c=d>0;o.push(e("div",{key:`cell-${h}`,class:"grid-cell",style:{"grid-column":String(r+l),"grid-row":String(i+d),"border-left":u?s:"none","border-top":c?s:"none","padding-left":u?`${t.cellPadding+4}px`:"0","padding-top":c?`${t.cellPadding+4}px`:"0"}},e("slot",{name:h})))}))})),o}getFontStyles(){return this.componentStyle((t=>{var e,s,r,i;return{"--bn-font-family":(null===(e=t.global)||void 0===e?void 0:e.fontFamily)||"'Noto Sans', sans-serif","--bn-font-size":`${(null===(s=t.global)||void 0===s?void 0:s.fontSizePx)||13.3333}px`,"--bn-font-color":(null===(r=t.global)||void 0===r?void 0:r.fontColor)||"#000000","--bn-font-background":(null===(i=t.global)||void 0===i?void 0:i.fontBackgroundColor)||"#ffffff"}}))}render(){const t={display:"inline-grid","grid-template-columns":this.getGridTemplateColumns(),"grid-template-rows":this.getGridTemplateRows(),gap:this.cellGap};return e(s,{key:"9522911b83a725994d62b657469bfcdbcae4a795",style:this.getFontStyles()},e("div",{key:"c3d4fe8e552c31b0e10ca930a784867e1f711d01",class:"grid-container",style:t},this.renderTitle(),this.renderColumnHeaders(),this.renderDataCells()),e("slot",{key:"9772d659471df1d3588a1372fedd09d6b3bb459d"}))}get element(){return r(this)}static get watchers(){return{rowHeaders:[{validateRowHeaders:0}],columnHeaders:[{validateColumnHeaders:0}],showRowHeaders:[{validateShowRowHeaders:0}],showColumnHeaders:[{validateShowColumnHeaders:0}],showBorders:[{validateShowBorders:0}]}}};u.style=':host{display:inline-block;font-family:var(--bn-font-family, "Noto Sans", sans-serif);font-size:var(--bn-font-size, 13.3333px);color:var(--bn-font-color, #000000)}.grid-container{display:inline-grid;box-sizing:border-box}.grid-title{font-weight:normal;padding-bottom:8px}.grid-header{display:flex;align-items:flex-end;box-sizing:border-box}.grid-header-row{justify-content:flex-end;padding-right:8px}.grid-header-col{white-space:nowrap;justify-content:flex-start}.grid-cell{position:relative;box-sizing:border-box}';export{u as bn_grid}
1
+ import{r as t,h as e,H as s,g as r}from"./p-B_d-jp99.js";import{e as i,w as o,b as n}from"./p-D1SJ10zl.js";import{w as d,a}from"./p-B4JfKvVT.js";import"./p-BgIpdpfH.js";import"./p-eEfqksk-.js";import"./p-C5uvAEKI.js";function l(t){if(!t||""===t.trim()||"[]"===t)return[];try{const e=JSON.parse(t);return Array.isArray(e)?e.map(((t,e)=>{var s,r,i;return"string"==typeof t?{label:t,id:String(e)}:"object"==typeof t&&null!==t?{label:null!==(r=null!==(s=t.label)&&void 0!==s?s:t.name)&&void 0!==r?r:String(e),id:null!==(i=t.id)&&void 0!==i?i:String(e)}:{label:String(t),id:String(e)}})):[]}catch(t){return console.error("parseHeaders: failed to parse JSON",t),[]}}function h(t){if(!t||""===t.trim()||"[]"===t)return[];try{const e=JSON.parse(t);if(!Array.isArray(e))return["Headers must be an array"];const s=[],r=new Set;return e.forEach(((t,e)=>{"object"==typeof t&&null!==t&&void 0!==t.id&&("string"!=typeof t.id?s.push(`Header[${e}]: 'id' must be a string`):r.has(t.id)?s.push(`Header[${e}]: duplicate id '${t.id}'`):r.add(t.id),void 0!==t.label&&"string"!=typeof t.label&&s.push(`Header[${e}]: 'label' must be a string`))})),s}catch(t){return console.error("validateHeadersJson: failed to parse JSON",t),["Invalid JSON structure"]}}const u=class{validateRowHeaders(t){const e="ERR_rowHeaders",s=h(t);s.length>0?this.errors.addOrReplace({id:e,type:"error",message:`row-headers: ${s.join("; ")}`}):this.errors.remove(e),this.updateGridConfig()}validateColumnHeaders(t){const e="ERR_columnHeaders",s=h(t);s.length>0?this.errors.addOrReplace({id:e,type:"error",message:`column-headers: ${s.join("; ")}`}):this.errors.remove(e),this.updateGridConfig()}validateShowRowHeaders(t){const e="ERR_showRowHeaders";i(t)?this.errors.remove(e):this.errors.addOrReplace({id:e,type:"warning",message:`show-row-headers: invalid value '${t}', must be 'true' or 'false'`})}validateShowColumnHeaders(t){const e="ERR_showColumnHeaders";i(t)?this.errors.remove(e):this.errors.addOrReplace({id:e,type:"warning",message:`show-column-headers: invalid value '${t}', must be 'true' or 'false'`})}validateShowBorders(t){const e="ERR_showBorders";i(t)?this.errors.remove(e):this.errors.addOrReplace({id:e,type:"warning",message:`show-borders: invalid value '${t}', must be 'true' or 'false'`})}constructor(e){t(this,e),this.gridConfig={rows:[],columns:[]},this.chartTitle="",this.rowHeaders="[]",this.columnHeaders="[]",this.showRowHeaders="true",this.showColumnHeaders="true",this.showBorders="true",this.rowHeaderWidth="auto",this.cellGap="0px",o(this),d(this),this.errors=a(this),this.componentStyle=n(this)}getGridStyle(){return this.componentStyle((t=>t["bn-grid"]))}componentWillLoad(){this.validateRowHeaders(this.rowHeaders),this.validateColumnHeaders(this.columnHeaders),this.validateShowRowHeaders(this.showRowHeaders),this.validateShowColumnHeaders(this.showColumnHeaders),this.validateShowBorders(this.showBorders)}updateGridConfig(){var t;this.gridConfig=(t=this.columnHeaders,{rows:l(this.rowHeaders),columns:l(t)})}shouldShowRowHeaders(){return"true"===this.showRowHeaders&&this.gridConfig.rows.length>0}shouldShowColumnHeaders(){return"true"===this.showColumnHeaders&&this.gridConfig.columns.length>0}shouldShowBorders(){return"true"===this.showBorders}getGridTemplateColumns(){const t=[];this.shouldShowRowHeaders()&&t.push(this.rowHeaderWidth);const e=this.gridConfig.columns.length||1;for(let s=0;s<e;s++)t.push("auto");return t.join(" ")}getGridTemplateRows(){const t=[];this.chartTitle&&t.push("auto"),this.shouldShowColumnHeaders()&&t.push("auto");const e=this.gridConfig.rows.length||1;for(let s=0;s<e;s++)t.push("auto");return t.join(" ")}renderTitle(){if(!this.chartTitle)return null;const t=(this.shouldShowRowHeaders()?1:0)+this.gridConfig.columns.length;return e("div",{class:"grid-title",style:{"grid-column":`1 / span ${t}`,"grid-row":"1"}},this.chartTitle)}renderColumnHeaders(){if(!this.shouldShowColumnHeaders())return null;const t=this.getGridStyle(),s=this.shouldShowBorders()?`${t.borderWidth}px solid ${t.borderColor}`:"none",r=this.shouldShowRowHeaders()?2:1,i=this.chartTitle?2:1;return this.gridConfig.columns.map(((o,n)=>{const d=n>0;return e("div",{key:`col-header-${o.id}`,class:"grid-header grid-header-col",style:{"grid-column":String(r+n),"grid-row":String(i),"border-left":d?s:"none",padding:`${t.cellPadding}px`,"padding-left":d?`${t.cellPadding+4}px`:`${t.cellPadding}px`}},o.label)}))}renderDataCells(){const t=this.getGridStyle(),s=this.shouldShowBorders()?`${t.borderWidth}px solid ${t.borderColor}`:"none",r=this.shouldShowRowHeaders()?2:1,i=(this.chartTitle?1:0)+(this.shouldShowColumnHeaders()?1:0)+1,o=[];return this.gridConfig.rows.length>0&&this.gridConfig.columns.length>0&&this.gridConfig.rows.forEach(((n,d)=>{if(this.shouldShowRowHeaders()){const r=d>0;o.push(e("div",{key:`row-header-${n.id}`,class:"grid-header grid-header-row",style:{"grid-column":"1","grid-row":String(i+d),"border-top":r?s:"none",padding:`${t.cellPadding}px`,"padding-top":r?`${t.cellPadding+4}px`:`${t.cellPadding}px`}},n.label))}this.gridConfig.columns.forEach(((a,l)=>{const h=function(t,e){return`${t.id}-${e.id}`}(n,a),u=l>0,c=d>0;o.push(e("div",{key:`cell-${h}`,class:"grid-cell",style:{"grid-column":String(r+l),"grid-row":String(i+d),"border-left":u?s:"none","border-top":c?s:"none","padding-left":u?`${t.cellPadding+4}px`:"0","padding-top":c?`${t.cellPadding+4}px`:"0"}},e("slot",{name:h})))}))})),o}getFontStyles(){return this.componentStyle((t=>{var e,s,r,i;return{"--bn-font-family":(null===(e=t.global)||void 0===e?void 0:e.fontFamily)||"'Noto Sans', sans-serif","--bn-font-size":`${(null===(s=t.global)||void 0===s?void 0:s.fontSizePx)||13.3333}px`,"--bn-font-color":(null===(r=t.global)||void 0===r?void 0:r.fontColor)||"#000000","--bn-font-background":(null===(i=t.global)||void 0===i?void 0:i.fontBackgroundColor)||"#ffffff"}}))}render(){const t={display:"inline-grid","grid-template-columns":this.getGridTemplateColumns(),"grid-template-rows":this.getGridTemplateRows(),gap:this.cellGap};return e(s,{key:"9522911b83a725994d62b657469bfcdbcae4a795",style:this.getFontStyles()},e("div",{key:"c3d4fe8e552c31b0e10ca930a784867e1f711d01",class:"grid-container",style:t},this.renderTitle(),this.renderColumnHeaders(),this.renderDataCells()),e("slot",{key:"9772d659471df1d3588a1372fedd09d6b3bb459d"}))}get element(){return r(this)}static get watchers(){return{rowHeaders:[{validateRowHeaders:0}],columnHeaders:[{validateColumnHeaders:0}],showRowHeaders:[{validateShowRowHeaders:0}],showColumnHeaders:[{validateShowColumnHeaders:0}],showBorders:[{validateShowBorders:0}]}}};u.style=':host{display:inline-block;font-family:var(--bn-font-family, "Noto Sans", sans-serif);font-size:var(--bn-font-size, 13.3333px);color:var(--bn-font-color, #000000)}.grid-container{display:inline-grid;box-sizing:border-box}.grid-title{font-weight:normal;padding-bottom:8px}.grid-header{display:flex;align-items:flex-end;box-sizing:border-box}.grid-header-row{justify-content:flex-end;padding-right:8px}.grid-header-col{white-space:nowrap;justify-content:flex-start}.grid-cell{position:relative;box-sizing:border-box}';export{u as bn_grid}
@@ -1 +1 @@
1
- import{r as t,h as e,H as n,g as s}from"./p-B_d-jp99.js";import{f as r,e as i,w as o,b as a}from"./p-BpWWgN6k.js";import{w as l,a as c}from"./p-B4JfKvVT.js";import"./p-BgIpdpfH.js";import"./p-eEfqksk-.js";import"./p-C5uvAEKI.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 v(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 y(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),l(this),this.errors=c(this),this.componentStyle=a(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(),requestAnimationFrame((()=>{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=v(r,!0,this.direction),l=i.get(t.to)||[];let c;if(l.length>1){const e=l.indexOf(t.from);c=y(o,this.direction,e,l.length)}else c=v(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),v=b(o,f,p,this.direction);r.push(e("g",{key:`operator-${s}-${l}`,class:"operator-group"},e("circle",{cx:v.x,cy:v.y,r:n.operatorCircleRadius,fill:"white",stroke:n.edgeColor,"stroke-width":n.edgeWidth}),e("text",{x:v.x,y:v.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-B_d-jp99.js";import{f as r,e as i,w as o,b as a}from"./p-D1SJ10zl.js";import{w as l,a as c}from"./p-B4JfKvVT.js";import"./p-BgIpdpfH.js";import"./p-eEfqksk-.js";import"./p-C5uvAEKI.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 v(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 y(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),l(this),this.errors=c(this),this.componentStyle=a(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(),requestAnimationFrame((()=>{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=v(r,!0,this.direction),l=i.get(t.to)||[];let c;if(l.length>1){const e=l.indexOf(t.from);c=y(o,this.direction,e,l.length)}else c=v(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),v=b(o,f,p,this.direction);r.push(e("g",{key:`operator-${s}-${l}`,class:"operator-group"},e("circle",{cx:v.x,cy:v.y,r:n.operatorCircleRadius,fill:"white",stroke:n.edgeColor,"stroke-width":n.edgeWidth}),e("text",{x:v.x,y:v.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{r as t,d as i,f as e,h as s,H as r,g as a}from"./p-B_d-jp99.js";import{a as n}from"./p-BgIpdpfH.js";import{C as l,r as o,A as u}from"./p-eEfqksk-.js";import{w as h,o as d}from"./p-A8xyE4b1.js";import{O as c,a as p,b as v}from"./p-C5uvAEKI.js";import{w as g,a as m,g as f,p as b}from"./p-C9i1Xsib.js";import{v as _,i as y,d as w,a as O,w as R,b as A}from"./p-BpWWgN6k.js";import{w as E,a as $}from"./p-B4JfKvVT.js";import{p as j}from"./p-6lOdN-fB.js";const T=["measure","label","unit"];function N(t){const i=[],e=W(t,"measure",i);if(void 0===e||""===e.trim())return i.push("measure"),{config:null,unknownKeys:U(t,T),invalidFields:i};const s={measure:e.trim()};return s.label=W(t,"label",i),s.unit=W(t,"unit",i),{config:s,unknownKeys:U(t,T),invalidFields:i}}const S=["show","decimals"];function k(t,i){const e=[],s={show:i.show,decimals:i.decimals};return l.isExisting(t.show)&&("auto"===t.show||"none"===t.show?s.show=t.show:e.push("show")),l.isExisting(t.decimals)&&(l.isNumber(t.decimals)&&t.decimals>=0&&t.decimals<=4?s.decimals=Math.floor(t.decimals):e.push("decimals")),{config:s,unknownKeys:U(t,S),invalidFields:e}}function x(t){var i;const e=null!==(i=null==t?void 0:t.trim())&&void 0!==i?i:"";if(""===e||"null"===e)return{ranges:[],parseError:!1,issues:[]};let s;try{s=JSON.parse(e)}catch(t){return{ranges:[],parseError:!0,issues:[]}}if(!Array.isArray(s)||0===s.length)return{ranges:[],parseError:!0,issues:[]};if(!s.every((t=>l.isNumber(t)&&isFinite(t)&&t>0)))return{ranges:[],parseError:!0,issues:[]};const r=[];let a=s;const n=[...a].sort(((t,i)=>t-i));return n.some(((t,i)=>t!==a[i]))&&r.push("not ascending, sorted"),a=n,a.length>2&&(r.push(`${a.length} entries, first 2 kept`),a=a.slice(0,2)),{ranges:a,parseError:!1,issues:r}}function U(t,i){return Object.keys(t).filter((t=>!i.includes(t)))}function W(t,i,e){if(l.isExisting(t[i]))return l.isString(t[i])?t[i]:void e.push(i)}const L=["pl1","pp1","fc1"],z=class{validateActual(t){this.validateMeasureSpec("actual",t)}validateTarget(t){this.validateMeasureSpec("target",t)}validateRanges(t){const i="ERR_bullet_json_ranges",e="WARN_bullet_ranges",s=x(t);if(s.parseError)return this.setBlockingError(i,this.t(".bullet-prop-json",{prop:"ranges"})),void this.errors.remove(e);this.setBlockingError(i,null),s.issues.length>0?this.errors.addOrReplace({id:e,type:"warning",message:this.t(".bullet-ranges-invalid",{detail:s.issues.join("; ")})}):this.errors.remove(e)}validateNormalize(t){this.validateEnum("normalize","ERR_normalize",t,["target","none"],"target")}validateVariances(t){this.validateEnum("variances","ERR_variances",t,["auto","none"],"auto")}validateLevel(t){this.validateEnum("level","ERR_level",t,["auto","rowgroup","category","subcategory"],"auto")}validateOrder(t){const i="ERR_order",e=_(t).filter((t=>""!==t));0===e.length?this.errors.remove(i):this.errors.addOrReplace({id:i,type:"warning",message:`order: invalid value(s) '${e.join(", ")}'; using the dataset order.`})}validateOrderDirection(t){const i="ERR_orderDirection";y(t)||w(t)?this.errors.remove(i):this.errors.addOrReplace({id:i,type:"warning",message:`order-direction: invalid value '${t}' — expected asc/desc; using asc.`})}validateLimit(t){const i="ERR_limit";O(t)&&Number(t)>=0?this.errors.remove(i):this.errors.addOrReplace({id:i,type:"warning",message:`limit: invalid value '${t}' — expected a non-negative integer; using 0.`})}validateLabels(t){const i="ERR_bullet_json_labels",e="WARN_bullet_fields_labels",{data:s,parseError:r}=j(t,null);if(r)return this.setBlockingError(i,this.t(".bullet-prop-json",{prop:"labels"})),void this.errors.remove(e);this.setBlockingError(i,null),null!==s?this.reportSpecIssues(e,"labels",k(s,this.labelDefaults())):this.errors.remove(e)}validateScale(t){const i="ERR_scale";if(y(t))return void this.errors.remove(i);const{mode:e,factor:s}=b(t);"factor"===e&&(void 0===s||s<=0)?this.errors.addOrReplace({id:i,type:"warning",message:`scale: invalid value '${t}' — expected none/auto or a positive number.`}):this.errors.remove(i)}constructor(i){t(this,i),this.datasetName="",this.dataVersion=0,this.datasetMeta=null,this.appliedScaleFactor=1,this.layoutObserver=null,this.activeErrors=new Set,this.chartTitle="",this.filter="",this.actual="",this.target="",this.ranges="",this.normalize="target",this.variances="auto",this.level="auto",this.order="",this.orderDirection="",this.limit=0,this.labels="",this._autoScaleGuard=!1,this._lastScaledParentHeight=0,this.translateForInner=(t,i)=>this.t(t,i),R(this),E(this),g(this,(t=>{this.datasetName=(null==t?void 0:t.startsWith("$"))?t.substring(1):t||"",this.dataVersion=this.dataVersion+1}),((t,i)=>{this.datasetMeta=i})),this.errors=$(this),this.componentStyle=A(this),this.ruleSetConfig=h(this),this.t=m(this).t}componentWillLoad(){this.validateActual(this.actual),this.validateTarget(this.target),this.validateRanges(this.ranges),this.validateNormalize(this.normalize),this.validateVariances(this.variances),this.validateLevel(this.level),this.validateOrder(this.order),this.validateOrderDirection(this.orderDirection),this.validateLimit(this.limit),this.validateLabels(this.labels),this.validateScale(this.scale)}componentDidRender(){const{mode:t}=b(this.scale);if("auto"!==t&&"empty"!==t)return void(this._autoScaleGuard=!1);if(this._autoScaleGuard)return void(this._autoScaleGuard=!1);const e=this.element,{height:s}=f(e);if(s<=0)return;this._lastScaledParentHeight=s;const r=this.componentStyle((t=>{var i;return(null===(i=t.global)||void 0===i?void 0:i.fontSizePx)||13.3333})),a=e.scrollHeight,n=this.appliedScaleFactor;if(a<=s+1)return void this.errors.remove("AUTO_scale");const l=Math.max(.3,n*(s-1)/a);Math.abs(l-n)<.01||(e.style.setProperty("--bn-font-size",r*l+"px"),"empty"===t?this.errors.addOrReplace({id:"AUTO_scale",type:"warning",message:`Auto-scaled chart by factor ${l.toFixed(3)}`}):this.errors.remove("AUTO_scale"),this._autoScaleGuard=!0,i((()=>{this.appliedScaleFactor=l})))}componentDidLoad(){this.layoutObserver=d(this.element,(()=>{if(this._autoScaleGuard)return;const{height:t}=f(this.element);t>0&&Math.abs(t-this._lastScaledParentHeight)>2&&(this._lastScaledParentHeight=t,e(this))})),requestAnimationFrame((()=>{requestAnimationFrame((()=>{if(this._autoScaleGuard)return;const{height:t}=f(this.element);this._lastScaledParentHeight=t,e(this)}))}))}disconnectedCallback(){var t;null===(t=this.layoutObserver)||void 0===t||t.disconnect(),this.layoutObserver=null}labelDefaults(){return{show:"auto",decimals:1}}setBlockingError(t,i){null===i?(this.errors.remove(t),this.activeErrors.delete(t)):(this.errors.addOrReplace({id:t,type:"error",message:i}),this.activeErrors.add(t))}hasBlockingErrors(){return this.activeErrors.size>0}validateMeasureSpec(t,i){var e;const s=`ERR_bullet_json_${t}`,r=`ERR_bullet_measure_${t}`,a=`WARN_bullet_fields_${t}`,{data:n,parseError:l}=j(i,"measure");if(l)return this.setBlockingError(s,this.t(".bullet-prop-json",{prop:t})),this.setBlockingError(r,null),void this.errors.remove(a);if(this.setBlockingError(s,null),null===n)return this.setBlockingError(r,null),void this.errors.remove(a);const u=(null!==(e=n.measure)&&void 0!==e?e:"").trim(),h=o(u);"auto"===u.toLowerCase()||null!==h&&"scenario"===h.kind?this.setBlockingError(r,null):this.setBlockingError(r,this.t(".bullet-measure-invalid",{prop:t,measure:u})),this.reportSpecIssues(a,t,N(n))}validateEnum(t,i,e,s,r){y(e)||s.includes(e.trim().toLowerCase())?this.errors.remove(i):this.errors.addOrReplace({id:i,type:"warning",message:`${t}: invalid value '${e}' — expected ${s.join("/")}; using '${r}'.`})}reportSpecIssues(t,i,e){const s=[];null!==e&&e.invalidFields.length>0&&s.push(`invalid: ${e.invalidFields.join(", ")}`),null!==e&&e.unknownKeys.length>0&&s.push(`unknown: ${e.unknownKeys.join(", ")}`),s.length>0?this.errors.addOrReplace({id:t,type:"warning",message:`${i}: ignored sub-fields (${s.join("; ")}).`}):this.errors.remove(t)}prepareActual(){var t,i,e,s,r;const{data:a,parseError:n}=j(this.actual,"measure");if(n)return null;const l=null!==a?N(a).config:null;if(null===l||"auto"===l.measure.toLowerCase()){const r=null!==l,a=null!==(i=null===(t=this.datasetMeta)||void 0===t?void 0:t.availableScenarios)&&void 0!==i?i:[],n=null!==(s=a.includes("ac1")?"ac1":null!==(e=a.find((t=>t.startsWith("ac"))))&&void 0!==e?e:a[0])&&void 0!==s?s:"ac1";return r||null===this.datasetMeta?this.errors.remove("AUTO_actual"):this.errors.addOrReplace({id:"AUTO_actual",type:"warning",message:`actual: not set, auto-detected: ${n}`}),null===l?{measure:n}:Object.assign(Object.assign({},l),{measure:n})}return this.errors.remove("AUTO_actual"),"scenario"===(null===(r=o(l.measure))||void 0===r?void 0:r.kind)?l:null}prepareTarget(){var t,i,e;const{data:s,parseError:r}=j(this.target,"measure");if(r)return null;const a=null!==s?N(s).config:null;if(null===a||"auto"===a.measure.toLowerCase()){const e=null!==a,s=null!==(i=null===(t=this.datasetMeta)||void 0===t?void 0:t.availableScenarios)&&void 0!==i?i:[],r=L.find((t=>s.includes(t)));return void 0===r?(this.errors.remove("AUTO_target"),null!==this.datasetMeta?this.errors.addOrReplace({id:"WARN_bullet_target_unavailable",type:"warning",message:this.t(".bullet-target-none")}):this.errors.remove("WARN_bullet_target_unavailable"),null):(this.errors.remove("WARN_bullet_target_unavailable"),e||null===this.datasetMeta?this.errors.remove("AUTO_target"):this.errors.addOrReplace({id:"AUTO_target",type:"warning",message:`target: not set, auto-detected: ${r}`}),null===a?{measure:r}:Object.assign(Object.assign({},a),{measure:r}))}return this.errors.remove("AUTO_target"),this.errors.remove("WARN_bullet_target_unavailable"),"scenario"===(null===(e=o(a.measure))||void 0===e?void 0:e.kind)?a:null}prepareNormalize(){var t;return"none"===(null===(t=this.normalize)||void 0===t?void 0:t.trim().toLowerCase())?"none":"target"}prepareShowVariances(){var t;return"none"!==(null===(t=this.variances)||void 0===t?void 0:t.trim().toLowerCase())}prepareLevel(){var t,i;const e=null===(t=this.level)||void 0===t?void 0:t.trim().toLowerCase();if("rowgroup"===e)return u.ROWGROUP;if("category"===e)return u.CATEGORY;if("subcategory"===e)return u.SUBCATEGORY;const s=null===(i=this.datasetMeta)||void 0===i?void 0:i.suggestedLevel;if(void 0!==s&&""!==s){const t=u[s.toUpperCase()];if(void 0!==t)return t}return u.CATEGORY}prepareOrder(){var t,i,e,s;const r="auto"===(null===(t=this.order)||void 0===t?void 0:t.trim().toLowerCase());let a;y(this.order)||r?(null===(i=this.datasetMeta)||void 0===i?void 0:i.suggestedOrder)?(r?this.errors.remove("AUTO_order"):this.errors.addOrReplace({id:"AUTO_order",type:"warning",message:`order: not set, auto-detected: ${this.datasetMeta.suggestedOrder}`}),a=this.datasetMeta.suggestedOrder):(this.errors.remove("AUTO_order"),a=""):(this.errors.remove("AUTO_order"),a=this.order);const n=null!==(s=c[null===(e=this.orderDirection)||void 0===e?void 0:e.toUpperCase()])&&void 0!==s?s:c.ASC;if(y(a))return new p([v.CATEGORYINDEX],n);const l=a.split(",").map((t=>v[t.trim().toUpperCase()])).filter((t=>void 0!==t));return new p(l.length>0?l:[v.CATEGORYINDEX],n)}prepareLabels(){const t=this.labelDefaults(),{data:i,parseError:e}=j(this.labels,null);return e||null===i?{show:t.show,decimals:t.decimals}:k(i,t).config}prepareLimit(){const t=Math.floor(Number(this.limit)||0);return t>0?t:0}i18nLocalKeys(){return["no-data","target","axis.in"]}prepareI18n(){const t=new Map(this.i18nLocalKeys().map((t=>[t,this.t(".".concat(t))]))),i=new Map(n.map((t=>[t,this.t("global.".concat(t))])));return new Map([...i.entries(),...t.entries()])}prepareStyle(){const t=this.getEffectiveScaleFactor();return this.componentStyle((i=>{const e=i.global.fontSizePx*t;return{scaleFactors:i["bn-chart-bullet"].scaleFactors,fontStyles:{font:`${e}px ${i.global.fontFamily}`,size:e,color:i.global.fontColor,background:i.global.fontBackgroundColor,leading:1.8},axisStyles:i["bn-chart-bullet"].axisStyles,barStyles:i["bn-chart-bullet"].barStyles,varianceStyles:i["bn-chart-bullet"].varianceStyles,rangeColors:i["bn-chart-bullet"].rangeColors,padding:i["bn-chart-bullet"].padding}}))}getEffectiveScaleFactor(){const{mode:t,factor:i}=b(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,r,a;const n=(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":n*t+"px","--bn-font-color":(null===(r=i.global)||void 0===r?void 0:r.fontColor)||"#000000","--bn-font-background":(null===(a=i.global)||void 0===a?void 0:a.fontBackgroundColor)||"#ffffff"}}))}getDataStructure(){const t={};for(const i of["ac","pp","fc","pl"])for(const e of[1,2,3,4])t[`${i}${e}`]={type:"number",isOptional:!0,description:""};const i={actual:this.prepareActual(),target:this.prepareTarget()};for(const[e,s]of Object.entries(i))null!==s&&void 0!==t[s.measure]&&(t[s.measure].description=`${e}: ${void 0!==s.label?s.label:s.measure}`);return{IBulletChartDataRow:Object.assign({operation:{type:"string",isOptional:!1,description:""},rowGroup:{type:"string",isOptional:!0,description:""},rowGroupIndex:{type:"number",isOptional:!0,description:""},category:{type:"string",isOptional:!1,description:""},categoryIndex:{type:"number",isOptional:!1,description:""},subCategory:{type:"string",isOptional:!0,description:""},subCategoryIndex:{type:"number",isOptional:!0,description:""}},t)}}chartTemplate(){const t=this.prepareActual(),i=this.prepareTarget(),e=x(this.ranges).ranges,r=this.prepareNormalize();return this.setBlockingError("ERR_bullet_measure_same",null!==t&&null!==i&&t.measure===i.measure?this.t(".bullet-measure-same",{measure:t.measure}):null),e.length>0&&"target"===r?this.errors.addOrReplace({id:"WARN_bullet_ranges_ignored",type:"warning",message:this.t(".bullet-ranges-ignored")}):this.errors.remove("WARN_bullet_ranges_ignored"),this.hasBlockingErrors()||null===t?null:s("ibcs-chart-bullet",{tableName:this.datasetName,dataVersion:this.dataVersion,chartTitle:this.chartTitle,actual:t,target:i,ranges:e,normalize:r,showVariances:this.prepareShowVariances(),level:this.prepareLevel(),order:this.prepareOrder(),limit:this.prepareLimit(),labels:this.prepareLabels(),filter:this.filter,styles:this.prepareStyle(),i18n:this.prepareI18n(),containerWidth:f(this.element).width,ruleSetConfig:this.ruleSetConfig(),errors:this.errors,translate:this.translateForInner})}render(){return s(r,{key:"9fd8c656471de9582652769edf49b80756575830",style:this.getFontStyles()},s("div",{key:"a6fe8d33dde8912a77a86244db092bb364c1aeaa",class:"container"},this.chartTemplate()))}get element(){return a(this)}static get watchers(){return{actual:[{validateActual:0}],target:[{validateTarget:0}],ranges:[{validateRanges:0}],normalize:[{validateNormalize:0}],variances:[{validateVariances:0}],level:[{validateLevel:0}],order:[{validateOrder:0}],orderDirection:[{validateOrderDirection:0}],limit:[{validateLimit:0}],labels:[{validateLabels:0}],scale:[{validateScale:0}]}}};z.style=":host{display:inline-block;position:relative;overflow:hidden}.container{display:flex;flex-direction:column}";export{z as bn_chart_bullet}
1
+ import{r as t,d as i,f as e,h as s,H as r,g as a}from"./p-B_d-jp99.js";import{a as n}from"./p-BgIpdpfH.js";import{C as l,r as o,A as u}from"./p-eEfqksk-.js";import{w as h,o as d}from"./p-Da6p_F4J.js";import{O as c,a as p,b as v}from"./p-C5uvAEKI.js";import{w as g,a as m,g as f,p as b}from"./p-D75i_YOP.js";import{v as _,i as y,d as w,a as O,w as R,b as A}from"./p-D1SJ10zl.js";import{w as E,a as $}from"./p-B4JfKvVT.js";import{p as j}from"./p-6lOdN-fB.js";const T=["measure","label","unit"];function N(t){const i=[],e=D(t,"measure",i);if(void 0===e||""===e.trim())return i.push("measure"),{config:null,unknownKeys:U(t,T),invalidFields:i};const s={measure:e.trim()};return s.label=D(t,"label",i),s.unit=D(t,"unit",i),{config:s,unknownKeys:U(t,T),invalidFields:i}}const S=["show","decimals"];function k(t,i){const e=[],s={show:i.show,decimals:i.decimals};return l.isExisting(t.show)&&("auto"===t.show||"none"===t.show?s.show=t.show:e.push("show")),l.isExisting(t.decimals)&&(l.isNumber(t.decimals)&&t.decimals>=0&&t.decimals<=4?s.decimals=Math.floor(t.decimals):e.push("decimals")),{config:s,unknownKeys:U(t,S),invalidFields:e}}function x(t){var i;const e=null!==(i=null==t?void 0:t.trim())&&void 0!==i?i:"";if(""===e||"null"===e)return{ranges:[],parseError:!1,issues:[]};let s;try{s=JSON.parse(e)}catch(t){return{ranges:[],parseError:!0,issues:[]}}if(!Array.isArray(s)||0===s.length)return{ranges:[],parseError:!0,issues:[]};if(!s.every((t=>l.isNumber(t)&&isFinite(t)&&t>0)))return{ranges:[],parseError:!0,issues:[]};const r=[];let a=s;const n=[...a].sort(((t,i)=>t-i));return n.some(((t,i)=>t!==a[i]))&&r.push("not ascending, sorted"),a=n,a.length>2&&(r.push(`${a.length} entries, first 2 kept`),a=a.slice(0,2)),{ranges:a,parseError:!1,issues:r}}function U(t,i){return Object.keys(t).filter((t=>!i.includes(t)))}function D(t,i,e){if(l.isExisting(t[i]))return l.isString(t[i])?t[i]:void e.push(i)}const L=["pl1","pp1","fc1"],z=class{validateActual(t){this.validateMeasureSpec("actual",t)}validateTarget(t){this.validateMeasureSpec("target",t)}validateRanges(t){const i="ERR_bullet_json_ranges",e="WARN_bullet_ranges",s=x(t);if(s.parseError)return this.setBlockingError(i,this.t(".bullet-prop-json",{prop:"ranges"})),void this.errors.remove(e);this.setBlockingError(i,null),s.issues.length>0?this.errors.addOrReplace({id:e,type:"warning",message:this.t(".bullet-ranges-invalid",{detail:s.issues.join("; ")})}):this.errors.remove(e)}validateNormalize(t){this.validateEnum("normalize","ERR_normalize",t,["target","none"],"target")}validateVariances(t){this.validateEnum("variances","ERR_variances",t,["auto","none"],"auto")}validateLevel(t){this.validateEnum("level","ERR_level",t,["auto","rowgroup","category","subcategory"],"auto")}validateOrder(t){const i="ERR_order",e=_(t).filter((t=>""!==t));0===e.length?this.errors.remove(i):this.errors.addOrReplace({id:i,type:"warning",message:`order: invalid value(s) '${e.join(", ")}'; using the dataset order.`})}validateOrderDirection(t){const i="ERR_orderDirection";y(t)||w(t)?this.errors.remove(i):this.errors.addOrReplace({id:i,type:"warning",message:`order-direction: invalid value '${t}' — expected asc/desc; using asc.`})}validateLimit(t){const i="ERR_limit";O(t)&&Number(t)>=0?this.errors.remove(i):this.errors.addOrReplace({id:i,type:"warning",message:`limit: invalid value '${t}' — expected a non-negative integer; using 0.`})}validateLabels(t){const i="ERR_bullet_json_labels",e="WARN_bullet_fields_labels",{data:s,parseError:r}=j(t,null);if(r)return this.setBlockingError(i,this.t(".bullet-prop-json",{prop:"labels"})),void this.errors.remove(e);this.setBlockingError(i,null),null!==s?this.reportSpecIssues(e,"labels",k(s,this.labelDefaults())):this.errors.remove(e)}validateScale(t){const i="ERR_scale";if(y(t))return void this.errors.remove(i);const{mode:e,factor:s}=b(t);"factor"===e&&(void 0===s||s<=0)?this.errors.addOrReplace({id:i,type:"warning",message:`scale: invalid value '${t}' — expected none/auto or a positive number.`}):this.errors.remove(i)}constructor(i){t(this,i),this.datasetName="",this.dataVersion=0,this.datasetMeta=null,this.appliedScaleFactor=1,this.layoutObserver=null,this.activeErrors=new Set,this.chartTitle="",this.filter="",this.actual="",this.target="",this.ranges="",this.normalize="target",this.variances="auto",this.level="auto",this.order="",this.orderDirection="",this.limit=0,this.labels="",this._autoScaleGuard=!1,this._lastScaledParentHeight=0,this.translateForInner=(t,i)=>this.t(t,i),R(this),E(this),g(this,(t=>{this.datasetName=(null==t?void 0:t.startsWith("$"))?t.substring(1):t||"",this.dataVersion=this.dataVersion+1}),((t,i)=>{this.datasetMeta=i})),this.errors=$(this),this.componentStyle=A(this),this.ruleSetConfig=h(this),this.t=m(this).t}componentWillLoad(){this.validateActual(this.actual),this.validateTarget(this.target),this.validateRanges(this.ranges),this.validateNormalize(this.normalize),this.validateVariances(this.variances),this.validateLevel(this.level),this.validateOrder(this.order),this.validateOrderDirection(this.orderDirection),this.validateLimit(this.limit),this.validateLabels(this.labels),this.validateScale(this.scale)}componentDidRender(){const{mode:t}=b(this.scale);if("auto"!==t&&"empty"!==t)return void(this._autoScaleGuard=!1);if(this._autoScaleGuard)return void(this._autoScaleGuard=!1);const e=this.element,{height:s}=f(e);if(s<=0)return;this._lastScaledParentHeight=s;const r=this.componentStyle((t=>{var i;return(null===(i=t.global)||void 0===i?void 0:i.fontSizePx)||13.3333})),a=e.scrollHeight,n=this.appliedScaleFactor;if(a<=s+1)return void this.errors.remove("AUTO_scale");const l=Math.max(.3,n*(s-1)/a);Math.abs(l-n)<.01||(e.style.setProperty("--bn-font-size",r*l+"px"),"empty"===t?this.errors.addOrReplace({id:"AUTO_scale",type:"warning",message:`Auto-scaled chart by factor ${l.toFixed(3)}`}):this.errors.remove("AUTO_scale"),this._autoScaleGuard=!0,i((()=>{this.appliedScaleFactor=l})))}componentDidLoad(){this.layoutObserver=d(this.element,(()=>{if(this._autoScaleGuard)return;const{height:t}=f(this.element);t>0&&Math.abs(t-this._lastScaledParentHeight)>2&&(this._lastScaledParentHeight=t,e(this))})),requestAnimationFrame((()=>{requestAnimationFrame((()=>{if(this._autoScaleGuard)return;const{height:t}=f(this.element);this._lastScaledParentHeight=t,e(this)}))}))}disconnectedCallback(){var t;null===(t=this.layoutObserver)||void 0===t||t.disconnect(),this.layoutObserver=null}labelDefaults(){return{show:"auto",decimals:1}}setBlockingError(t,i){null===i?(this.errors.remove(t),this.activeErrors.delete(t)):(this.errors.addOrReplace({id:t,type:"error",message:i}),this.activeErrors.add(t))}hasBlockingErrors(){return this.activeErrors.size>0}validateMeasureSpec(t,i){var e;const s=`ERR_bullet_json_${t}`,r=`ERR_bullet_measure_${t}`,a=`WARN_bullet_fields_${t}`,{data:n,parseError:l}=j(i,"measure");if(l)return this.setBlockingError(s,this.t(".bullet-prop-json",{prop:t})),this.setBlockingError(r,null),void this.errors.remove(a);if(this.setBlockingError(s,null),null===n)return this.setBlockingError(r,null),void this.errors.remove(a);const u=(null!==(e=n.measure)&&void 0!==e?e:"").trim(),h=o(u);"auto"===u.toLowerCase()||null!==h&&"scenario"===h.kind?this.setBlockingError(r,null):this.setBlockingError(r,this.t(".bullet-measure-invalid",{prop:t,measure:u})),this.reportSpecIssues(a,t,N(n))}validateEnum(t,i,e,s,r){y(e)||s.includes(e.trim().toLowerCase())?this.errors.remove(i):this.errors.addOrReplace({id:i,type:"warning",message:`${t}: invalid value '${e}' — expected ${s.join("/")}; using '${r}'.`})}reportSpecIssues(t,i,e){const s=[];null!==e&&e.invalidFields.length>0&&s.push(`invalid: ${e.invalidFields.join(", ")}`),null!==e&&e.unknownKeys.length>0&&s.push(`unknown: ${e.unknownKeys.join(", ")}`),s.length>0?this.errors.addOrReplace({id:t,type:"warning",message:`${i}: ignored sub-fields (${s.join("; ")}).`}):this.errors.remove(t)}prepareActual(){var t,i,e,s,r;const{data:a,parseError:n}=j(this.actual,"measure");if(n)return null;const l=null!==a?N(a).config:null;if(null===l||"auto"===l.measure.toLowerCase()){const r=null!==l,a=null!==(i=null===(t=this.datasetMeta)||void 0===t?void 0:t.availableScenarios)&&void 0!==i?i:[],n=null!==(s=a.includes("ac1")?"ac1":null!==(e=a.find((t=>t.startsWith("ac"))))&&void 0!==e?e:a[0])&&void 0!==s?s:"ac1";return r||null===this.datasetMeta?this.errors.remove("AUTO_actual"):this.errors.addOrReplace({id:"AUTO_actual",type:"warning",message:`actual: not set, auto-detected: ${n}`}),null===l?{measure:n}:Object.assign(Object.assign({},l),{measure:n})}return this.errors.remove("AUTO_actual"),"scenario"===(null===(r=o(l.measure))||void 0===r?void 0:r.kind)?l:null}prepareTarget(){var t,i,e;const{data:s,parseError:r}=j(this.target,"measure");if(r)return null;const a=null!==s?N(s).config:null;if(null===a||"auto"===a.measure.toLowerCase()){const e=null!==a,s=null!==(i=null===(t=this.datasetMeta)||void 0===t?void 0:t.availableScenarios)&&void 0!==i?i:[],r=L.find((t=>s.includes(t)));return void 0===r?(this.errors.remove("AUTO_target"),null!==this.datasetMeta?this.errors.addOrReplace({id:"WARN_bullet_target_unavailable",type:"warning",message:this.t(".bullet-target-none")}):this.errors.remove("WARN_bullet_target_unavailable"),null):(this.errors.remove("WARN_bullet_target_unavailable"),e||null===this.datasetMeta?this.errors.remove("AUTO_target"):this.errors.addOrReplace({id:"AUTO_target",type:"warning",message:`target: not set, auto-detected: ${r}`}),null===a?{measure:r}:Object.assign(Object.assign({},a),{measure:r}))}return this.errors.remove("AUTO_target"),this.errors.remove("WARN_bullet_target_unavailable"),"scenario"===(null===(e=o(a.measure))||void 0===e?void 0:e.kind)?a:null}prepareNormalize(){var t;return"none"===(null===(t=this.normalize)||void 0===t?void 0:t.trim().toLowerCase())?"none":"target"}prepareShowVariances(){var t;return"none"!==(null===(t=this.variances)||void 0===t?void 0:t.trim().toLowerCase())}prepareLevel(){var t,i;const e=null===(t=this.level)||void 0===t?void 0:t.trim().toLowerCase();if("rowgroup"===e)return u.ROWGROUP;if("category"===e)return u.CATEGORY;if("subcategory"===e)return u.SUBCATEGORY;const s=null===(i=this.datasetMeta)||void 0===i?void 0:i.suggestedLevel;if(void 0!==s&&""!==s){const t=u[s.toUpperCase()];if(void 0!==t)return t}return u.CATEGORY}prepareOrder(){var t,i,e,s;const r="auto"===(null===(t=this.order)||void 0===t?void 0:t.trim().toLowerCase());let a;y(this.order)||r?(null===(i=this.datasetMeta)||void 0===i?void 0:i.suggestedOrder)?(r?this.errors.remove("AUTO_order"):this.errors.addOrReplace({id:"AUTO_order",type:"warning",message:`order: not set, auto-detected: ${this.datasetMeta.suggestedOrder}`}),a=this.datasetMeta.suggestedOrder):(this.errors.remove("AUTO_order"),a=""):(this.errors.remove("AUTO_order"),a=this.order);const n=null!==(s=c[null===(e=this.orderDirection)||void 0===e?void 0:e.toUpperCase()])&&void 0!==s?s:c.ASC;if(y(a))return new p([v.CATEGORYINDEX],n);const l=a.split(",").map((t=>v[t.trim().toUpperCase()])).filter((t=>void 0!==t));return new p(l.length>0?l:[v.CATEGORYINDEX],n)}prepareLabels(){const t=this.labelDefaults(),{data:i,parseError:e}=j(this.labels,null);return e||null===i?{show:t.show,decimals:t.decimals}:k(i,t).config}prepareLimit(){const t=Math.floor(Number(this.limit)||0);return t>0?t:0}i18nLocalKeys(){return["no-data","target","axis.in"]}prepareI18n(){const t=new Map(this.i18nLocalKeys().map((t=>[t,this.t(".".concat(t))]))),i=new Map(n.map((t=>[t,this.t("global.".concat(t))])));return new Map([...i.entries(),...t.entries()])}prepareStyle(){const t=this.getEffectiveScaleFactor();return this.componentStyle((i=>{const e=i.global.fontSizePx*t;return{scaleFactors:i["bn-chart-bullet"].scaleFactors,fontStyles:{font:`${e}px ${i.global.fontFamily}`,size:e,color:i.global.fontColor,background:i.global.fontBackgroundColor,leading:1.8},axisStyles:i["bn-chart-bullet"].axisStyles,barStyles:i["bn-chart-bullet"].barStyles,varianceStyles:i["bn-chart-bullet"].varianceStyles,rangeColors:i["bn-chart-bullet"].rangeColors,padding:i["bn-chart-bullet"].padding}}))}getEffectiveScaleFactor(){const{mode:t,factor:i}=b(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,r,a;const n=(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":n*t+"px","--bn-font-color":(null===(r=i.global)||void 0===r?void 0:r.fontColor)||"#000000","--bn-font-background":(null===(a=i.global)||void 0===a?void 0:a.fontBackgroundColor)||"#ffffff"}}))}getDataStructure(){const t={};for(const i of["ac","pp","fc","pl"])for(const e of[1,2,3,4])t[`${i}${e}`]={type:"number",isOptional:!0,description:""};const i={actual:this.prepareActual(),target:this.prepareTarget()};for(const[e,s]of Object.entries(i))null!==s&&void 0!==t[s.measure]&&(t[s.measure].description=`${e}: ${void 0!==s.label?s.label:s.measure}`);return{IBulletChartDataRow:Object.assign({operation:{type:"string",isOptional:!1,description:""},rowGroup:{type:"string",isOptional:!0,description:""},rowGroupIndex:{type:"number",isOptional:!0,description:""},category:{type:"string",isOptional:!1,description:""},categoryIndex:{type:"number",isOptional:!1,description:""},subCategory:{type:"string",isOptional:!0,description:""},subCategoryIndex:{type:"number",isOptional:!0,description:""}},t)}}chartTemplate(){const t=this.prepareActual(),i=this.prepareTarget(),e=x(this.ranges).ranges,r=this.prepareNormalize();return this.setBlockingError("ERR_bullet_measure_same",null!==t&&null!==i&&t.measure===i.measure?this.t(".bullet-measure-same",{measure:t.measure}):null),e.length>0&&"target"===r?this.errors.addOrReplace({id:"WARN_bullet_ranges_ignored",type:"warning",message:this.t(".bullet-ranges-ignored")}):this.errors.remove("WARN_bullet_ranges_ignored"),this.hasBlockingErrors()||null===t?null:s("ibcs-chart-bullet",{tableName:this.datasetName,dataVersion:this.dataVersion,chartTitle:this.chartTitle,actual:t,target:i,ranges:e,normalize:r,showVariances:this.prepareShowVariances(),level:this.prepareLevel(),order:this.prepareOrder(),limit:this.prepareLimit(),labels:this.prepareLabels(),filter:this.filter,styles:this.prepareStyle(),i18n:this.prepareI18n(),containerWidth:f(this.element).width,ruleSetConfig:this.ruleSetConfig(),errors:this.errors,translate:this.translateForInner})}render(){return s(r,{key:"9fd8c656471de9582652769edf49b80756575830",style:this.getFontStyles()},s("div",{key:"a6fe8d33dde8912a77a86244db092bb364c1aeaa",class:"container"},this.chartTemplate()))}get element(){return a(this)}static get watchers(){return{actual:[{validateActual:0}],target:[{validateTarget:0}],ranges:[{validateRanges:0}],normalize:[{validateNormalize:0}],variances:[{validateVariances:0}],level:[{validateLevel:0}],order:[{validateOrder:0}],orderDirection:[{validateOrderDirection:0}],limit:[{validateLimit:0}],labels:[{validateLabels:0}],scale:[{validateScale:0}]}}};z.style=":host{display:inline-block;position:relative;overflow:hidden}.container{display:flex;flex-direction:column}";export{z as bn_chart_bullet}