@luzmo/analytics-components-kit 1.0.9-beta.3 → 1.0.9-beta.4

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.
@@ -1,439 +0,0 @@
1
-
2
- import{_ as e,a as t,b as n,c as r,d as i,g as a,h as o,i as s,l as c,m as l,n as u,p as d,s as f,t as ee,u as p,v as m,y as h}from"./load-formula-codemirror-Cyqo4LoE.js";import{n as g,t as _}from"./localized-mixin-BEfBwOPN.js";import{n as v}from"./lit-localize-CIGP-NUw.js";import{t as y}from"./localized-decorator-Buib6Rq1.js";import{t as te}from"./luzmoTrashOutline-DXZpJx7f.js";import{i as ne,r as re,t as ie}from"./calculate-data-field-icon-CrEVAfzJ.js";import{t as ae}from"./luzmoPlus-Dyrrz0v8.js";import{t as b}from"./luzmo-icon-markup-GqF25og5.js";import{n as x,r as S,t as oe}from"./base-DOKoeL4P.js";import{t as C}from"./task-C3c3OWyi.js";import{n as w,s as se}from"./type-check-CC6bgirK.js";import{t as ce}from"./formatter-LzhH-XSQ.js";import{t as le}from"./default-local-formats-CES1ItiK.js";import{t as T}from"./localize-BXHWaHdZ.js";import{t as E}from"./period-over-period-condition.const-AC_onvUf.js";import{t as D}from"./data-broker-CbKNAOhf.js";import{t as ue}from"./load-data-fields-for-datasets-_VJWUFPO.js";import{AsyncDirective as de,directive as fe,guard as pe,html as O,ifDefined as k,nothing as A,property as j,query as me,queryAll as he,state as M,unsafeCSS as N}from"https://cdn.jsdelivr.net/npm/@luzmo/lucero@2.3.0-beta.0/standalone/lit.js";import"https://cdn.jsdelivr.net/npm/@luzmo/lucero@2.3.0-beta.0/standalone/action-button.js";import"https://cdn.jsdelivr.net/npm/@luzmo/lucero@2.3.0-beta.0/standalone/field-label.js";import"https://cdn.jsdelivr.net/npm/@luzmo/lucero@2.3.0-beta.0/standalone/icon.js";import"https://cdn.jsdelivr.net/npm/@luzmo/lucero@2.3.0-beta.0/standalone/overlay.js";import"https://cdn.jsdelivr.net/npm/@luzmo/lucero@2.3.0-beta.0/standalone/progress-circle.js";import"https://cdn.jsdelivr.net/npm/@luzmo/lucero@2.3.0-beta.0/standalone/tooltip.js";import"https://cdn.jsdelivr.net/npm/@luzmo/lucero@2.3.0-beta.0/standalone/select.js";import"https://cdn.jsdelivr.net/npm/@luzmo/lucero@2.3.0-beta.0/standalone/divider.js";import"https://cdn.jsdelivr.net/npm/@luzmo/lucero@2.3.0-beta.0/standalone/text-field.js";import"https://cdn.jsdelivr.net/npm/@luzmo/lucero@2.3.0-beta.0/standalone/multi-language-field.js";var ge={"area-chart":()=>import(`./area-chart-slots.config-Bxvau_Ii.js`),"bar-chart":()=>import(`./bar-chart-slots.config-BWQoKCYJ.js`),"box-plot":()=>import(`./box-plot-slots.config-4hmeA6nr.js`),"bubble-chart":()=>import(`./bubble-chart-slots.config-CqTUMwvW.js`),"bullet-chart":()=>import(`./bullet-chart-slots.config-BiFMJsgN.js`),"choropleth-map":()=>import(`./choropleth-map-slots.config-CRF7J3QP.js`),"circle-pack-chart":()=>import(`./circle-pack-chart-slots.config-Deq7IUoK.js`),"circular-gauge":()=>import(`./circular-gauge-slots.config-C7yUFfFJ.js`),"column-chart":()=>import(`./column-chart-slots.config-ZBLvqhEb.js`),"combination-chart":()=>import(`./combination-chart-slots.config-BNVJfRB2.js`),"conditional-number":()=>import(`./conditional-number-slots.config-B4kqODqw.js`),"date-comparison-filter":()=>import(`./date-comparison-filter-slots.config-DfHq9lB8.js`),"date-filter":()=>import(`./date-filter-slots.config-DHaOkULx.js`),"donut-chart":()=>import(`./donut-chart-slots.config-7pDpzNBG.js`),"dropdown-filter":()=>import(`./dropdown-filter-slots.config-DkqLjilE.js`),"evolution-number":()=>import(`./evolution-number-slots.config-IqPfnCrw.js`),"funnel-chart":()=>import(`./funnel-chart-slots.config-DfeuNGEL.js`),"heat-map":()=>import(`./heat-map-slots.config-BVBzVjJJ.js`),"heat-table":()=>import(`./heat-table-slots.config-CcOl-PCp.js`),"hexbin-map":()=>import(`./hexbin-map-slots.config-D6qVm4nj.js`),image:()=>import(`./image-slots.config-CdWEUY0l.js`),"line-chart":()=>import(`./line-chart-slots.config-CavGuJXK.js`),"marker-map":()=>import(`./marker-map-slots.config-CtzpU-rK.js`),"ohlc-chart":()=>import(`./ohlc-chart-slots.config-xYpPbmg2.js`),"parallel-coordinates-plot":()=>import(`./parallel-coordinates-plot-slots.config-DvJljfr8.js`),"pivot-table":()=>import(`./pivot-table-slots.config-DZOE04Ea.js`),"pyramid-chart":()=>import(`./pyramid-chart-slots.config-DKBFy-TL.js`),"radar-chart":()=>import(`./radar-chart-slots.config-CHauNDhi.js`),"regular-table":()=>import(`./regular-table-slots.config-BqEJgzhG.js`),"route-map":()=>import(`./route-map-slots.config-B5G4JVnI.js`),"sankey-diagram":()=>import(`./sankey-diagram-slots.config-jyKqjUsV.js`),"scatter-plot":()=>import(`./scatter-plot-slots.config-CF2Ii2Ez.js`),"search-filter":()=>import(`./search-filter-slots.config-BcTF-DAh.js`),"slicer-filter":()=>import(`./slicer-filter-slots.config-DL3Q0Zbm.js`),"slider-filter":()=>import(`./slider-filter-slots.config-52Bs7zu3.js`),"speedometer-chart":()=>import(`./speedometer-chart-slots.config-Cfsna_2O.js`),"spike-map":()=>import(`./spike-map-slots.config-FfXNX2O3.js`),"strip-plot":()=>import(`./strip-plot-slots.config-DQrrby2Y.js`),"sunburst-chart":()=>import(`./sunburst-chart-slots.config-DqW1e0nf.js`),"symbol-map":()=>import(`./symbol-map-slots.config-B_UtYexb.js`),text:()=>import(`./text-slots.config-D33nu0FP.js`),"treemap-chart":()=>import(`./treemap-chart-slots.config-CaearczZ.js`),"venn-diagram":()=>import(`./venn-diagram-slots.config-GnP5AAAL.js`),video:()=>import(`./video-slots.config-ufoVcXKL.js`),"wordcloud-chart":()=>import(`./wordcloud-chart-slots.config-g7QwS2dG.js`)},_e=e=>`${e.replaceAll(/-([a-z])/g,(e,t)=>t.toUpperCase())}SlotsConfig`,ve=async e=>{try{let t=ge[e];return t?(await t())[_e(e)]??null:null}catch{return null}},ye=e=>e?ve(e):Promise.resolve(null),be={icon:[24,24,`m6 6 16 16M3.3 4.7l7.3 7.3-7.3 7.3c-1 1 .5 2.3 1.4 1.4l7.3-7.3 7.3 7.3c1 1 2.3-.5 1.4-1.4L13.4 12l7.3-7.3c1-1-.5-2.3-1.4-1.4L12 10.6 4.7 3.3c-.9-1-2.3.5-1.4 1.4Z`],name:`close-12`},xe={icon:[30,32,`m14.3 2.3-4 4c-1 1 .5 2.3 1.4 1.4L14 5.4V16H3.4l2.3-2.3a1 1 0 0 0-1.4-1.4l-4 4a1 1 0 0 0 0 1.4l4 4a1 1 0 0 0 1.4-1.4L3.4 18H14v10.6l-2.3-2.3c-1-1-2.3.5-1.4 1.4l4 4c.4.4 1 .4 1.4 0l4-4c1-1-.5-2.3-1.4-1.4L16 28.6V18h10.6l-2.3 2.3c-1 1 .5 2.3 1.4 1.4l4-4c.4-.4.4-1 0-1.4l-4-4c-1-1-2.3.5-1.4 1.4l2.3 2.3H16V5.4l2.3 2.3c1 1 2.3-.5 1.4-1.4l-4-4a1 1 0 0 0-1.4 0z`],name:`arrows`},Se={icon:[32,32,`m16 8c-4.41 0-8 3.59-8 8 0 4.41 3.59 8 8 8 4.41 0 8-3.59 8-8 0-4.41-3.59-8-8-8zm0 2c3.33 0 6 2.67 6 6 0 3.33-2.67 6-6 6-3.33 0-6-2.67-6-6 0-3.33 2.67-6 6-6zm4.72-9.96c-0.39-0.11-0.82 0.02-1.07 0.35 0 0 0 0 0 0-0.15 0.21-0.28 0.36-0.41 0.48 0 0 0 0 0 0-0.86 0.87-2 1.34-3.23 1.34-1.22 0-2.36-0.47-3.23-1.34 0 0 0 0 0 0C12.64 0.75 12.51 0.6 12.36 0.4c0 0 0 0 0 0-0.25-0.33-0.67-0.47-1.07-0.35 0 0 0 0 0 0C10.16 0.38 9.07 0.83 8.06 1.38 7.69 1.58 7.49 1.98 7.54 2.39c0 0 0 0 0 0.01 0.04 0.25 0.05 0.45 0.05 0.64 0 2.52-2.04 4.57-4.57 4.57-0.18 0-0.39-0.01-0.63-0.05 0 0-0.01 0-0.01 0C1.98 7.49 1.57 7.69 1.38 8.06 0.83 9.07 0.38 10.16 0.04 11.28c0 0 0 0 0 0-0.11 0.39 0.03 0.82 0.35 1.07 0 0 0 0 0 0 0.21 0.15 0.35 0.28 0.48 0.41 0 0 0 0 0 0 1.79 1.78 1.79 4.68 0 6.46 0 0 0 0 0 0-0.13 0.13-0.28 0.26-0.48 0.42-0.33 0.25-0.47 0.67-0.35 1.07 0 0 0 0 0 0 0.34 1.12 0.78 2.21 1.34 3.22 0.19 0.37 0.6 0.57 1.01 0.51 0 0 0 0 0 0 0.25-0.04 0.45-0.05 0.63-0.05 2.52 0 4.57 2.04 4.57 4.57 0 0.18-0.01 0.38-0.05 0.63 0 0 0 0 0 0.01-0.05 0.41 0.15 0.81 0.51 1.01 1.01 0.55 2.1 1 3.23 1.33 0.4 0.12 0.82-0.02 1.07-0.35 0.15-0.2 0.28-0.36 0.42-0.49 0 0 0 0 0 0 0.87-0.86 2-1.34 3.23-1.34 1.23 0 2.37 0.47 3.23 1.34 0 0 0 0 0 0 0.13 0.13 0.26 0.28 0.42 0.49 0.19 0.25 0.49 0.39 0.79 0.39 0.09 0 0.18-0.01 0.28-0.04l0.01 0c1.13-0.33 2.21-0.78 3.22-1.33 0.36-0.2 0.57-0.6 0.51-1.01 0 0 0 0 0-0.01-0.04-0.25-0.05-0.45-0.05-0.63 0-2.53 2.04-4.57 4.57-4.57 0.18 0 0.39 0.01 0.64 0.05 0 0 0 0 0 0 0.41 0.05 0.81-0.15 1-0.51 0.55-1.01 1-2.1 1.34-3.23 0 0 0 0 0 0 0.11-0.39-0.02-0.82-0.35-1.07l0 0c-0.21-0.15-0.36-0.28-0.48-0.41 0 0 0 0 0-0.01-0.86-0.86-1.34-2.01-1.34-3.23 0-1.22 0.48-2.36 1.34-3.23 0 0 0 0 0 0 0.13-0.13 0.28-0.26 0.49-0.42 0 0 0 0 0 0 0.33-0.25 0.46-0.68 0.35-1.07 0 0 0 0 0 0C31.63 10.15 31.18 9.07 30.62 8.06 30.43 7.69 30.03 7.49 29.62 7.54c0 0 0 0-0.01 0-0.25 0.04-0.45 0.05-0.64 0.05-2.52 0-4.57-2.04-4.57-4.56 0-0.19 0.01-0.39 0.05-0.64 0 0 0 0 0 0 0.05-0.41-0.15-0.81-0.51-1.01-1.02-0.55-2.1-1.01-3.23-1.34 0 0 0 0 0 0zM11.24 2.15c0.04 0.05 0.09 0.1 0.13 0.14 1.24 1.24 2.89 1.92 4.63 1.92 1.75 0 3.4-0.68 4.63-1.92 0 0 0 0 0 0 0.04-0.04 0.08-0.09 0.13-0.14 0.57 0.2 1.13 0.43 1.66 0.69 0 0.06 0 0.13 0 0.19 0 3.61 2.94 6.55 6.55 6.55 0.06 0 0.13 0 0.19 0 0.26 0.53 0.49 1.09 0.69 1.66-0.05 0.05-0.1 0.09-0.14 0.13-1.24 1.24-1.92 2.88-1.92 4.63 0 1.75 0.68 3.4 1.92 4.64 0 0 0 0 0 0 0.04 0.04 0.09 0.09 0.14 0.13-0.2 0.57-0.43 1.13-0.69 1.66-0.06 0-0.13 0-0.19 0-3.61 0-6.55 2.94-6.55 6.55 0 0.06 0 0.12 0 0.18-0.54 0.26-1.09 0.5-1.66 0.69-0.04-0.05-0.08-0.1-0.13-0.14-1.24-1.24-2.89-1.92-4.63-1.92-1.75 0-3.39 0.68-4.63 1.92-0.05 0.05-0.09 0.1-0.13 0.14-0.57-0.19-1.13-0.43-1.66-0.69 0-0.06 0-0.12 0-0.18 0-3.61-2.94-6.55-6.55-6.55-0.06 0-0.13 0-0.19 0C2.58 21.9 2.35 21.34 2.15 20.77c0.05-0.04 0.1-0.09 0.14-0.13 0 0 0 0 0 0 2.55-2.55 2.55-6.71 0-9.27-0.04-0.04-0.09-0.09-0.14-0.13 0.2-0.57 0.43-1.13 0.69-1.66 0.06 0 0.13 0 0.19 0 3.61 0 6.55-2.94 6.55-6.55 0-0.06 0-0.13 0-0.19 0.53-0.26 1.09-0.49 1.66-0.69z`],name:`cog`},Ce={icon:[32,32,`M16 0a16 16 0 1 0 0 32 16 16 0 0 0 0-32Zm0 2a14 14 0 0 1 14 14 14 14 0 0 1-14 14A14 14 0 0 1 2 16 14 14 0 0 1 16 2Zm0 5.5a1.5 1.5 0 1 0 0 3 1.5 1.5 0 0 0 0-3ZM15 15v9c0 1.3 2 1.3 2 0v-9c0-1.3-2-1.3-2 0z`],name:`info-circle-outline`},we=/^(?:[0-9a-f]{8}-[0-9a-f]{4}-[1-8][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$/i;function Te(e){return typeof e==`string`&&we.test(e)}var Ee=new Set([`x-axis`,`y-axis`,`category`,`name`,`row`,`levels`]),De=new Set([`legend`,`color`,`column`]),Oe=new Set([`measure`]),ke={dimension:`mainGroupBy`,time:`mainGroupBy`,identifier:`mainGroupBy`,evolution:`mainGroupBy`,source:`mainGroupBy`,destination:`secondaryGroupBy`,open:`measure`,high:`measure`,low:`measure`,close:`measure`,target:`measure`,slidermetric:`measure`,geo:`other`,coordinates:`other`};function Ae(e){return e.type===`numeric`||e.type===`array[numeric]`?`numeric`:`dimension`}function je(e){return ke[e.slotName]||(Oe.has(e.slotName)?`measure`:De.has(e.slotName)?`secondaryGroupBy`:Ee.has(e.slotName)?`mainGroupBy`:e.slotType===`numeric`?`measure`:e.slotType===`categorical`?`mainGroupBy`:e.slotType===`mixed`?e.contentKind===`numeric`?`measure`:`mainGroupBy`:`other`)}var Me={Category:()=>v(`Category`,{desc:`Category slot label`}),Measure:()=>v(`Measure`,{desc:`Measure slot label`}),Measures:()=>v(`Measures`,{desc:`Measures slot label`}),Legend:()=>v(`Legend`,{desc:`Legend slot label`}),"Group by":()=>v(`Group by`,{desc:`Group by slot label`}),"Y-Axis":()=>v(`Y-Axis`,{desc:`Y-Axis slot label`}),"X-Axis":()=>v(`X-Axis`,{desc:`X-Axis slot label`}),Dimension:()=>v(`Dimension`,{desc:`Dimension slot label`}),Datetime:()=>v(`Datetime`,{desc:`Datetime slot label`}),"Slider metric":()=>v(`Slider metric`,{desc:`Slider metric slot label`}),Bins:()=>v(`Bins`,{desc:`Bins slot label`}),Circles:()=>v(`Circles`,{desc:`Circles slot label`}),Close:()=>v(`Close`,{desc:`Close slot label`}),Color:()=>v(`Color`,{desc:`Color slot label`}),Columns:()=>v(`Columns`,{desc:`Columns slot label`}),Coordinates:()=>v(`Coordinates`,{desc:`Coordinates slot label`}),Destination:()=>v(`Destination`,{desc:`Destination slot label`}),Evolution:()=>v(`Evolution`,{desc:`Evolution slot label`}),Geography:()=>v(`Geography`,{desc:`Geography slot label`}),High:()=>v(`High`,{desc:`High slot label`}),Identifier:()=>v(`Identifier`,{desc:`Identifier slot label`}),Levels:()=>v(`Levels`,{desc:`Levels slot label`}),Low:()=>v(`Low`,{desc:`Low slot label`}),Name:()=>v(`Name`,{id:`slot-label-name`,desc:`Name slot label`}),Open:()=>v(`Open`,{desc:`Open slot label`}),Order:()=>v(`Order`,{desc:`Order slot label`}),Route:()=>v(`Route`,{desc:`Route slot label`}),Rows:()=>v(`Rows`,{desc:`Rows slot label`}),Size:()=>v(`Size`,{desc:`Size slot label`}),Source:()=>v(`Source`,{desc:`Source slot label`}),Target:()=>v(`Target`,{desc:`Target slot label`}),Time:()=>v(`Time`,{id:`slot-label-time`,desc:`Time slot label`})},Ne=class extends Event{constructor(e,t,n,r){super(`context-request`,{bubbles:!0,composed:!0}),this.context=e,this.contextTarget=t,this.callback=n,this.subscribe=r??!1}};function Pe(e){return e}var Fe=class{constructor(e,t,n,r){if(this.subscribe=!1,this.provided=!1,this.value=void 0,this.t=(e,t)=>{this.unsubscribe&&(this.unsubscribe!==t&&(this.provided=!1,this.unsubscribe()),this.subscribe||this.unsubscribe()),this.value=e,this.host.requestUpdate(),this.provided&&!this.subscribe||(this.provided=!0,this.callback&&this.callback(e,t)),this.unsubscribe=t},this.host=e,t.context!==void 0){let e=t;this.context=e.context,this.callback=e.callback,this.subscribe=e.subscribe??!1}else this.context=t,this.callback=n,this.subscribe=r??!1;this.host.addController(this)}hostConnected(){this.dispatchRequest()}hostDisconnected(){this.unsubscribe&&=(this.unsubscribe(),void 0)}dispatchRequest(){this.host.dispatchEvent(new Ne(this.context,this.host,this.t,this.subscribe))}},Ie=class{get value(){return this.o}set value(e){this.setValue(e)}setValue(e,t=!1){let n=t||!Object.is(e,this.o);this.o=e,n&&this.updateObservers()}constructor(e){this.subscriptions=new Map,this.updateObservers=()=>{for(let[e,{disposer:t}]of this.subscriptions)e(this.o,t)},e!==void 0&&(this.value=e)}addCallback(e,t,n){if(!n)return void e(this.value);this.subscriptions.has(e)||this.subscriptions.set(e,{disposer:()=>{this.subscriptions.delete(e)},consumerHost:t});let{disposer:r}=this.subscriptions.get(e);e(this.value,r)}clearCallbacks(){this.subscriptions.clear()}},Le=class extends Event{constructor(e,t){super(`context-provider`,{bubbles:!0,composed:!0}),this.context=e,this.contextTarget=t}},Re=class extends Ie{constructor(e,t,n){super(t.context===void 0?n:t.initialValue),this.onContextRequest=e=>{if(e.context!==this.context)return;let t=e.contextTarget??e.composedPath()[0];t!==this.host&&(e.stopPropagation(),this.addCallback(e.callback,t,e.subscribe))},this.onProviderRequest=e=>{if(e.context!==this.context||(e.contextTarget??e.composedPath()[0])===this.host)return;let t=new Set;for(let[e,{consumerHost:n}]of this.subscriptions)t.has(e)||(t.add(e),n.dispatchEvent(new Ne(this.context,n,e,!0)));e.stopPropagation()},this.host=e,t.context===void 0?this.context=t:this.context=t.context,this.attachListeners(),this.host.addController?.(this)}attachListeners(){this.host.addEventListener(`context-request`,this.onContextRequest),this.host.addEventListener(`context-provider`,this.onProviderRequest)}hostConnected(){this.host.dispatchEvent(new Le(this.context,this.host))}};function ze({context:e,subscribe:t}){return(n,r)=>{typeof r==`object`?r.addInitializer((function(){new Fe(this,{context:e,callback:e=>{n.set.call(this,e)},subscribe:t})})):n.constructor.addInitializer((n=>{new Fe(n,{context:e,callback:e=>{n[r]=e},subscribe:t})}))}}var Be=[`datetime`,`hierarchy`,`numeric`,`spatial`,`array[datetime]`,`array[numeric]`,`array[hierarchy]`,`array[spatial]`],P=Pe(Symbol(`slot-store-context`)),Ve=Object.defineProperty,He=(e,t,n)=>t in e?Ve(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,Ue=(e,t,n)=>(He(e,typeof t==`symbol`?t:t+``,n),n),We=(e,t,n)=>{if(!t.has(e))throw TypeError(`Cannot `+n)},Ge=(e,t)=>{if(Object(t)!==t)throw TypeError(`Cannot use the "in" operator on this value`);return e.has(t)},F=(e,t,n)=>{if(t.has(e))throw TypeError(`Cannot add the same private member more than once`);t instanceof WeakSet?t.add(e):t.set(e,n)},Ke=(e,t,n)=>(We(e,t,`access private method`),n);function qe(e,t){return Object.is(e,t)}var I=null,L=!1,R=1,z=Symbol(`SIGNAL`);function B(e){let t=I;return I=e,t}function Je(){return I}function Ye(){return L}var Xe={version:0,lastCleanEpoch:0,dirty:!1,producerNode:void 0,producerLastReadVersion:void 0,producerIndexOfThis:void 0,nextProducerIndex:0,liveConsumerNode:void 0,liveConsumerIndexOfThis:void 0,consumerAllowSignalWrites:!1,consumerIsAlwaysLive:!1,producerMustRecompute:()=>!1,producerRecomputeValue:()=>{},consumerMarkedDirty:()=>{},consumerOnSignalRead:()=>{}};function Ze(e){if(L)throw Error(typeof ngDevMode<`u`&&ngDevMode?`Assertion error: signal read during notification phase`:``);if(I===null)return;I.consumerOnSignalRead(e);let t=I.nextProducerIndex++;if(H(I),t<I.producerNode.length&&I.producerNode[t]!==e&&st(I)){let e=I.producerNode[t];V(e,I.producerIndexOfThis[t])}I.producerNode[t]!==e&&(I.producerNode[t]=e,I.producerIndexOfThis[t]=st(I)?ot(e,I,t):0),I.producerLastReadVersion[t]=e.version}function Qe(){R++}function $e(e){if(!(!e.dirty&&e.lastCleanEpoch===R)){if(!e.producerMustRecompute(e)&&!at(e)){e.dirty=!1,e.lastCleanEpoch=R;return}e.producerRecomputeValue(e),e.dirty=!1,e.lastCleanEpoch=R}}function et(e){if(e.liveConsumerNode===void 0)return;let t=L;L=!0;try{for(let t of e.liveConsumerNode)t.dirty||nt(t)}finally{L=t}}function tt(){return I?.consumerAllowSignalWrites!==!1}function nt(e){var t;e.dirty=!0,et(e),(t=e.consumerMarkedDirty)==null||t.call(e.wrapper??e)}function rt(e){return e&&(e.nextProducerIndex=0),B(e)}function it(e,t){if(B(t),!(!e||e.producerNode===void 0||e.producerIndexOfThis===void 0||e.producerLastReadVersion===void 0)){if(st(e))for(let t=e.nextProducerIndex;t<e.producerNode.length;t++)V(e.producerNode[t],e.producerIndexOfThis[t]);for(;e.producerNode.length>e.nextProducerIndex;)e.producerNode.pop(),e.producerLastReadVersion.pop(),e.producerIndexOfThis.pop()}}function at(e){H(e);for(let t=0;t<e.producerNode.length;t++){let n=e.producerNode[t],r=e.producerLastReadVersion[t];if(r!==n.version||($e(n),r!==n.version))return!0}return!1}function ot(e,t,n){var r;if(ct(e),H(e),e.liveConsumerNode.length===0){(r=e.watched)==null||r.call(e.wrapper);for(let t=0;t<e.producerNode.length;t++)e.producerIndexOfThis[t]=ot(e.producerNode[t],e,t)}return e.liveConsumerIndexOfThis.push(n),e.liveConsumerNode.push(t)-1}function V(e,t){var n;if(ct(e),H(e),typeof ngDevMode<`u`&&ngDevMode&&t>=e.liveConsumerNode.length)throw Error(`Assertion error: active consumer index ${t} is out of bounds of ${e.liveConsumerNode.length} consumers)`);if(e.liveConsumerNode.length===1){(n=e.unwatched)==null||n.call(e.wrapper);for(let t=0;t<e.producerNode.length;t++)V(e.producerNode[t],e.producerIndexOfThis[t])}let r=e.liveConsumerNode.length-1;if(e.liveConsumerNode[t]=e.liveConsumerNode[r],e.liveConsumerIndexOfThis[t]=e.liveConsumerIndexOfThis[r],e.liveConsumerNode.length--,e.liveConsumerIndexOfThis.length--,t<e.liveConsumerNode.length){let n=e.liveConsumerIndexOfThis[t],r=e.liveConsumerNode[t];H(r),r.producerIndexOfThis[n]=t}}function st(e){return e.consumerIsAlwaysLive||(e?.liveConsumerNode?.length??0)>0}function H(e){e.producerNode??=[],e.producerIndexOfThis??=[],e.producerLastReadVersion??=[]}function ct(e){e.liveConsumerNode??=[],e.liveConsumerIndexOfThis??=[]}function lt(e){if($e(e),Ze(e),e.value===pt)throw e.error;return e.value}function ut(e){let t=Object.create(mt);t.computation=e;let n=()=>lt(t);return n[z]=t,n}var dt=Symbol(`UNSET`),ft=Symbol(`COMPUTING`),pt=Symbol(`ERRORED`),mt={...Xe,value:dt,dirty:!0,error:null,equal:qe,producerMustRecompute(e){return e.value===dt||e.value===ft},producerRecomputeValue(e){if(e.value===ft)throw Error(`Detected cycle in computations.`);let t=e.value;e.value=ft;let n=rt(e),r,i=!1;try{r=e.computation.call(e.wrapper),i=t!==dt&&t!==pt&&e.equal.call(e.wrapper,t,r)}catch(t){r=pt,e.error=t}finally{it(e,n)}if(i){e.value=t;return}e.value=r,e.version++}};function ht(){throw Error()}var gt=ht;function _t(){gt()}function vt(e){let t=Object.create(xt);t.value=e;let n=()=>(Ze(t),t.value);return n[z]=t,n}function yt(){return Ze(this),this.value}function bt(e,t){tt()||_t(),e.equal.call(e.wrapper,e.value,t)||(e.value=t,St(e))}var xt={...Xe,equal:qe,value:void 0};function St(e){e.version++,Qe(),et(e)}var U=Symbol(`node`),W;(e=>{var t,n,r,i;class a{constructor(r,i={}){F(this,n),Ue(this,t);let a=vt(r)[z];if(this[U]=a,a.wrapper=this,i){let t=i.equals;t&&(a.equal=t),a.watched=i[e.subtle.watched],a.unwatched=i[e.subtle.unwatched]}}get(){if(!(0,e.isState)(this))throw TypeError(`Wrong receiver type for Signal.State.prototype.get`);return yt.call(this[U])}set(t){if(!(0,e.isState)(this))throw TypeError(`Wrong receiver type for Signal.State.prototype.set`);if(Ye())throw Error(`Writes to signals not permitted during Watcher callback`);let n=this[U];bt(n,t)}}t=U,n=new WeakSet,e.isState=e=>typeof e==`object`&&Ge(n,e),e.State=a;class o{constructor(t,n){F(this,i),Ue(this,r);let a=ut(t)[z];if(a.consumerAllowSignalWrites=!0,this[U]=a,a.wrapper=this,n){let t=n.equals;t&&(a.equal=t),a.watched=n[e.subtle.watched],a.unwatched=n[e.subtle.unwatched]}}get(){if(!(0,e.isComputed)(this))throw TypeError(`Wrong receiver type for Signal.Computed.prototype.get`);return lt(this[U])}}r=U,i=new WeakSet,e.isComputed=e=>typeof e==`object`&&Ge(i,e),e.Computed=o,(t=>{var n,r,i,a;function o(e){let t,n=null;try{n=B(null),t=e()}finally{B(n)}return t}t.untrack=o;function s(t){if(!(0,e.isComputed)(t)&&!(0,e.isWatcher)(t))throw TypeError(`Called introspectSources without a Computed or Watcher argument`);return t[U].producerNode?.map(e=>e.wrapper)??[]}t.introspectSources=s;function c(t){if(!(0,e.isComputed)(t)&&!(0,e.isState)(t))throw TypeError(`Called introspectSinks without a Signal argument`);return t[U].liveConsumerNode?.map(e=>e.wrapper)??[]}t.introspectSinks=c;function l(t){if(!(0,e.isComputed)(t)&&!(0,e.isState)(t))throw TypeError(`Called hasSinks without a Signal argument`);let n=t[U].liveConsumerNode;return n?n.length>0:!1}t.hasSinks=l;function u(t){if(!(0,e.isComputed)(t)&&!(0,e.isWatcher)(t))throw TypeError(`Called hasSources without a Computed or Watcher argument`);let n=t[U].producerNode;return n?n.length>0:!1}t.hasSources=u;class d{constructor(e){F(this,r),F(this,i),Ue(this,n);let t=Object.create(Xe);t.wrapper=this,t.consumerMarkedDirty=e,t.consumerIsAlwaysLive=!0,t.consumerAllowSignalWrites=!1,t.producerNode=[],this[U]=t}watch(...t){if(!(0,e.isWatcher)(this))throw TypeError(`Called unwatch without Watcher receiver`);Ke(this,i,a).call(this,t);let n=this[U];n.dirty=!1;let r=B(n);for(let e of t)Ze(e[U]);B(r)}unwatch(...t){if(!(0,e.isWatcher)(this))throw TypeError(`Called unwatch without Watcher receiver`);Ke(this,i,a).call(this,t);let n=this[U];H(n);for(let e=n.producerNode.length-1;e>=0;e--)if(t.includes(n.producerNode[e].wrapper)){V(n.producerNode[e],n.producerIndexOfThis[e]);let t=n.producerNode.length-1;if(n.producerNode[e]=n.producerNode[t],n.producerIndexOfThis[e]=n.producerIndexOfThis[t],n.producerNode.length--,n.producerIndexOfThis.length--,n.nextProducerIndex--,e<n.producerNode.length){let t=n.producerIndexOfThis[e],r=n.producerNode[e];ct(r),r.liveConsumerIndexOfThis[t]=e}}}getPending(){if(!(0,e.isWatcher)(this))throw TypeError(`Called getPending without Watcher receiver`);return this[U].producerNode.filter(e=>e.dirty).map(e=>e.wrapper)}}n=U,r=new WeakSet,i=new WeakSet,a=function(t){for(let n of t)if(!(0,e.isComputed)(n)&&!(0,e.isState)(n))throw TypeError(`Called watch/unwatch without a Computed or State argument`)},e.isWatcher=e=>Ge(r,e),t.Watcher=d;function f(){return Je()?.wrapper}t.currentComputed=f,t.watched=Symbol(`watched`),t.unwatched=Symbol(`unwatched`)})(e.subtle||={})})(W||={});var Ct=Symbol(`SignalWatcherBrand`),wt=new FinalizationRegistry((({watcher:e,signal:t})=>{e.unwatch(t)})),Tt=new WeakMap;function Et(e){return!0===e[Ct]?(console.warn(`SignalWatcher should not be applied to the same class more than once.`),e):class extends e{constructor(){super(...arguments),this._$St=new W.State(0),this._$Si=!1,this._$So=!0,this._$Sh=new Set}_$Sl(){if(this._$Su!==void 0)return;this._$Sv=new W.Computed((()=>{this._$St.get(),super.performUpdate()}));let e=this._$Su=new W.subtle.Watcher((function(){let e=Tt.get(this);e!==void 0&&(!1===e._$Si&&e.requestUpdate(),this.watch())}));Tt.set(e,this),wt.register(this,{watcher:e,signal:this._$Sv}),e.watch(this._$Sv)}_$Sp(){this._$Su!==void 0&&(this._$Su.unwatch(this._$Sv),this._$Sv=void 0,this._$Su=void 0)}performUpdate(){this.isUpdatePending&&(this._$Sl(),this._$Si=!0,this._$St.set(this._$St.get()+1),this._$Si=!1,this._$Sv.get())}update(e){try{this._$So?(this._$So=!1,super.update(e)):this._$Sh.forEach((e=>e.commit()))}finally{this.isUpdatePending=!1,this._$Sh.clear()}}requestUpdate(e,t,n){this._$So=!0,super.requestUpdate(e,t,n)}connectedCallback(){super.connectedCallback(),this.requestUpdate()}disconnectedCallback(){super.disconnectedCallback(),queueMicrotask((()=>{!1===this.isConnected&&this._$Sp()}))}_(e){this._$Sh.add(e);let t=this._$So;this.requestUpdate(),this._$So=t}m(e){this._$Sh.delete(e)}}}fe(class extends de{_$Sl(){if(this._$Su!==void 0)return;this._$SW=new W.Computed((()=>this._$Sj?.get()));let e=this._$Su=new W.subtle.Watcher((()=>{var t;(t=this._$SO)==null||t._(this),e.watch()}));e.watch(this._$SW)}_$Sp(){var e;this._$Su!==void 0&&(this._$Su.unwatch(this._$SW),this._$SW=void 0,this._$Su=void 0,(e=this._$SO)==null||e.m(this))}commit(){this.setValue(W.subtle.untrack((()=>this._$SW?.get())))}render(e){return W.subtle.untrack((()=>e.get()))}update(e,[t]){return this._$SO??=e.options?.host,t!==this._$Sj&&this._$Sj!==void 0&&this._$Sp(),this._$Sj=t,this._$Sl(),W.subtle.untrack((()=>this._$SW.get()))}disconnected(){this._$Sp()}reconnected(){this._$Sl()}}),W.State,W.Computed;var G=(e,t)=>new W.State(e,t),Dt=(e,t)=>new W.Computed(e,t),Ot=class{constructor(){this.slotContents=G([]),this.slotsContents=G([]),this.periodOverPeriodUiType=G(null),this.periodOverPeriodAllowsPeriodsWithoutDatetimeColumn=G(!1),this.periodOverPeriodHidesPastValue=G(!1),this.linkedDataset=G([]),this._popEnabledChartTypes=[`area-chart`,`bar-chart`,`combination-chart`,`column-chart`,`line-chart`],this._popPeriodsWithoutDatetimeColumnItemTypes=[`kpi`],this._popWithoutPastValueItemTypes=[`kpi`],this.activeSlotContents=Dt(()=>this.slotContents.get()[this.activeIndex.get()]),this.activeIndex=G(0)}isArrayColumnType(e){return e.startsWith(`array[`)}setPeriodOverPeriodCondition(e,t){if(this.periodOverPeriodAllowsPeriodsWithoutDatetimeColumn.set(this._popPeriodsWithoutDatetimeColumnItemTypes.includes(e)),this.periodOverPeriodHidesPastValue.set(this._popWithoutPastValueItemTypes.includes(e)),!t?.periodOverPeriod?.newUi){this.periodOverPeriodUiType.set(this.oldConditionalLogic(e));return}this.periodOverPeriodUiType.set(this.getUiConditionToApply(t))}getUiConditionToApply(e){let t=this.hasDatetimeColumnOnCategoryOrXAxis(),n=e?.periodOverPeriod?.hasConnectedComparisonFilter,r=this.linkedDataset.get().some(({columns:e})=>e?.some(e=>e.type===`datetime`));return!t&&!n&&!r?null:t&&n?E.HasDatetimeColumnAndComparisonFilters:t&&!n?E.HasDatetimeColumnAndNoComparisonFilters:!t&&n?E.NoDatetimeColumnButComparisonFilters:E.NoDatetimeColumnAndNoComparisonFilters}oldConditionalLogic(e){let t=this.slotsContents.get()??[],n=(t.find(e=>[`y-axis`,`x-axis`,`row`].includes(e.name))?.content??[])?.[0]??null,r=t.find(e=>e.name===`measure`)?.content??[];return n&&this._popEnabledChartTypes.includes(e)&&n.type===`datetime`&&!this.isArrayColumnType(n.type)&&(!n.datetimeDisplayMode||n.datetimeDisplayMode==="default")&&n.level!==4&&r.length>0?E.OldImplementation:null}hasDatetimeColumnOnCategoryOrXAxis(){let e=((this.slotsContents.get()??[]).find(e=>[`y-axis`,`x-axis`].includes(e.name))?.content??[])?.[0]??null;return!!(e&&e.type===`datetime`&&!this.isArrayColumnType(e.type))}setContents(e,t){if(this.slotContents.set(e),this.activeIndex.get()>=e.length&&this.activeIndex.set(e.length>0?e.length-1:0),t){let n=structuredClone(this.slotsContents.get())??[],r=n.find(e=>e.name===t);r&&(r.content=e),this.setFullContents(n)}}setFullContents(e){this.slotsContents.set(e)}updateActive(e){e>=0&&e<this.slotContents.get().length&&this.activeIndex.set(e)}updateContent(e,t=this.activeIndex.get()){if(t<0||t>=this.slotContents.get().length)return;let n=[...this.slotContents.get()];n[t]=structuredClone(e),this.slotContents.set(n)}removeContent(e){if(e<0||e>=this.slotContents.get().length)return;let t=this.slotContents.get().filter((t,n)=>n!==e);this.slotContents.set(t),this.activeIndex.get()>=t.length&&this.activeIndex.set(t.length>0?t.length-1:0)}},kt=e=>typeof e==`string`&&e.trim().length>0,At=e=>!!(e&&kt(e.formula)&&!e.formulaId&&!se(e.formula)),jt=e=>!!(e&&kt(e.expression)&&!e.columnId&&!e.column&&!e.formulaId&&!e.formula),Mt=e=>jt(e)?e?.expression:At(e)?e?.formula:void 0,Nt=e=>e?.columnId??e?.formulaId??e?.column??e?.formula??e?.expression,K=(e,t)=>jt(e)?!0:!e||!At(e)?!1:je({slotName:String(t.name??``),slotType:t.type,contentKind:Ae(e)})===`measure`,Pt=e=>{let t=At(e);return O`<span class="calculation-label">
3
- <span class="calculation-label-icon" aria-hidden="true">${b(t?re:ne)}</span>
4
- <span>${t?v(`Formula`,{desc:`Label for the formula type`}):v(`Expression`,{desc:`Label for the expression type`})}</span>
5
- </span>`},Ft=(e,t)=>{let n={type:e.type,datasetId:e.datasetId,set:e.datasetId};`columnId`in e&&!w(e.columnId)&&e.columnId!==``?(n.columnId=e.columnId,n.column=e.columnId):`formulaId`in e&&!w(e.formulaId)&&e.formulaId!==``?(n.formulaId=e.formulaId,n.formula=e.formulaId):`formula`in e&&typeof e.formula==`string`&&e.formula!==``&&(n.formula=e.formula);let r=e.type===`datetime`||e.type===`array[datetime]`,i={...e.name??{en:`Untitled`}},a=e.level;if(r&&(a=a??e.lowestLevel??9,t)){let e=le.shortLevels?.filter(e=>e!==`All`)??[],t=e[Math.max(0,Math.min(e.length-1,(a??1)-1))];if(t){let e=`(${t})`,n=Object.keys(i);for(let t of n)i[t]=`${i[t]} ${e}`}}return n.label=i,w(e.subtype)||(n.subtype=e.subtype),`lowestLevel`in e&&!w(e.lowestLevel)&&(n.lowestLevel=e.lowestLevel),w(e.format)||(n.format=e.format),w(a)||(n.level=a),w(e.lowestLevel)||(n.lowestLevel=e.lowestLevel),e.type===`numeric`&&e.subtype===`currency`&&e.currency?.symbol&&(n.currency=e.currency.symbol),Array.isArray(e.duration_levels)&&e.duration_format&&(n.duration={levels:e.duration_levels,format:e.duration_format}),n};function It(){return typeof crypto<`u`&&typeof crypto.randomUUID==`function`?crypto.randomUUID():`xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx`.replace(/[xy]/g,e=>{let t=Math.random()*16|0;return(e===`x`?t:t&3|8).toString(16)})}function Lt(e){return`##AGGR-${e}##`}function Rt(e,n){let{aggregationFunction:r,content:i,grouping:a,includedColumns:o,excludedColumns:s}=e??{},c=`${r}(${n[r]?.arity>0?i:``})`;switch(a){case t.GROUPFULL:return`GROUPFULL(${c})`;case t.GROUPINEX:return`GROUPINEX(${c}, [${o?.map(e=>`{${e}}`).join(`, `)||``}], [${s?.map(e=>`{${e}}`).join(`, `)||``}])`;default:return c}}function zt(e){let t=e.split(``),n=null;for(let e=0;e<t.length;e++){let r=t[e];n?r===n?n=null:t[e]=` `:(r===`'`||r===`"`)&&(n=r)}return t.join(``)}function Bt(e,t=0){let n=0,r=-1,i=null;for(let a=t,o=e.length;a<o;a++){let t=e[a];if(i){t===i&&(i=null);continue}if(t===`'`||t===`"`)i=t;else if(t===`(`)n++;else if(t===`)`){if(n===0){r=a;break}n--}}return r}function Vt(e){let t=e.match(p),n=t?.[0],r=t?.[1];return{includedColumns:n?.match(i)?.map(e=>e.slice(1,-1))??[],excludedColumns:r?.match(i)?.map(e=>e.slice(1,-1))??[]}}function Ht(e=`light`){return!e||e===`light`?[`#0E89E0`,`#F45000`,`#15BF49`,`#685AC2`,`#636363`]:[`#BDDCF9`,`#FFCFA1`,`#C1F3B7`,`#D7D7EF`,`#D7D7EF`]}function Ut(e){let t=Ht(`light`),n=e.length>1;return e.map((e,r)=>{let i=[];return`dataFields`in e&&Array.isArray(e.dataFields)&&e.dataFields.length>0?i=e.dataFields.filter(e=>!!e.columnId):`columns`in e&&Array.isArray(e.columns)&&(i=e.columns.map(t=>{let n=`columnId`in t&&typeof t.columnId==`string`?t.columnId:`id`in t&&typeof t.id==`string`?t.id:void 0;if(n)return{...t,columnId:n,datasetId:e.id}}).filter(e=>!!e)),{id:e.id,name:e.name,description:`description`in e?e.description:void 0,color:n?t[r%t.length]:void 0,columns:i}})}var q=class extends _(x(S,{validSizes:[`s`,`m`,`l`,`xl`]})){constructor(){super(),this.expression=``,this.datasetsDataFields=[],this.datasetIds=[],this.apiUrl=`https://api.luzmo.com`,this.showAggregations=!0,this.contentLanguage=`en`,this.multiStageAggregation=!0,this.nestedAggregation=!0,this._datasets=[],this._codeMirrorLoaded=u(),this._rootContent=``,this._lastEmittedExpression=null,this._applyingExternalExpression=!1,this._handleWidgetsChanged=()=>{this._recomputeExpression()},this._store=this._createStore()}connectedCallback(){super.connectedCallback(),this._store.addEventListener(`widgets-changed`,this._handleWidgetsChanged)}disconnectedCallback(){super.disconnectedCallback(),this._store.removeEventListener(`widgets-changed`,this._handleWidgetsChanged),this._emitTimer&&clearTimeout(this._emitTimer)}firstUpdated(e){super.firstUpdated(e),this._pushRootContent()}updated(e){super.updated(e),e.has(`_codeMirrorLoaded`)&&this._codeMirrorLoaded&&this._pushRootContent()}_pushRootContent(){this._rootContent&&this._codeMirrorElement?.setContent(this._rootContent)}get _codeMirrorElement(){return this.renderRoot?.querySelector(`luzmo-formula-codemirror`)}async _ensureCodeMirrorLoaded(){this._codeMirrorLoaded||=(await ee(),!0)}willUpdate(e){super.willUpdate(e),this._shouldLoadInput()&&this._ensureCodeMirrorLoaded(),(e.has(`multiStageAggregation`)||e.has(`nestedAggregation`)||e.has(`contentLanguage`)||e.has(`size`))&&(this._store.multiStageAggregation=this.multiStageAggregation,this._store.nestedAggregation=this.nestedAggregation,this._store.contentLanguage=this.contentLanguage,this._store.size=this.size),(e.has(`datasetsDataFields`)||e.has(`datasetIds`)||e.has(`apiUrl`)||e.has(`authKey`)||e.has(`authToken`))&&this._loadDatasets(),e.has(`showAggregations`)&&this._rebuildAutoCompletion(),e.has(`expression`)&&this._applyExternalExpression()}async _loadDatasets(){if(this.datasetsDataFields.length===0&&this.datasetIds.length===0){this._datasets=[],this._store.datasets=[],this._store.refreshDecorations(),this._setLoading(!1),this._rebuildAutoCompletion();return}if(this.datasetsDataFields.length>0){this._datasets=Ut(this.datasetsDataFields),this._store.datasets=this._datasets,this._store.refreshDecorations(),this._setLoading(!1),this._rebuildAutoCompletion();return}if(this.datasetIds.length>0){this._setLoading(!0);try{let e=await ue(this.datasetIds,{dataBrokerConfig:{apiUrl:this.apiUrl,authKey:this.authKey,authToken:this.authToken}});this._datasets=Ut(e),this._store.datasets=this._datasets,this._store.refreshDecorations(),this._rebuildAutoCompletion()}catch(e){console.warn(`[${this.localName}] Failed to load datasets:`,e),this.dispatchEvent(new CustomEvent(`luzmo-datasets-error`,{bubbles:!0,composed:!0,detail:{error:e}}))}finally{this._setLoading(!1)}}}_rebuildAutoCompletion(){}_syncExpressionToStore(){return this.expression===this._lastEmittedExpression?null:(this._store.clearWidgets(),this._rootContent=this.multiStageAggregation?this._store.transformToAggregationWidgetSyntax(this.expression):this.expression,this._rootContent)}_applyExternalExpression(){this._applyingExternalExpression=!0;try{this._syncExpressionToStore()}finally{this._applyingExternalExpression=!1}}_recomputeExpression(){if(this._applyingExternalExpression||!this._canEmitExpression())return;let e=this.multiStageAggregation?this._store.transformToAggregationFunctionSyntax(this._rootContent):this._rootContent;this._emitTimer&&clearTimeout(this._emitTimer),this._emitTimer=setTimeout(()=>this._onExpressionComputed(e),this._emitDebounceMs)}_emitExpressionChanged(e){this._lastEmittedExpression=e,this.dispatchEvent(new CustomEvent(`luzmo-expression-changed`,{bubbles:!0,composed:!0,detail:{expression:e}}))}_shouldLoadInput(){return!0}_canEmitExpression(){return!0}get _emitDebounceMs(){return 300}_onExpressionComputed(e){e!==this._lastEmittedExpression&&this._emitExpressionChanged(e)}_setLoading(e){}};g([j({type:String})],q.prototype,`expression`,void 0),g([j({attribute:!1})],q.prototype,`datasetsDataFields`,void 0),g([j({type:Array,attribute:`dataset-ids`})],q.prototype,`datasetIds`,void 0),g([j({type:String,attribute:`api-url`})],q.prototype,`apiUrl`,void 0),g([j({type:String,attribute:`auth-key`})],q.prototype,`authKey`,void 0),g([j({type:String,attribute:`auth-token`})],q.prototype,`authToken`,void 0),g([j({type:Boolean,attribute:`show-aggregations`,reflect:!0})],q.prototype,`showAggregations`,void 0),g([j({type:String,attribute:`content-language`,reflect:!0})],q.prototype,`contentLanguage`,void 0),g([j({type:Boolean,attribute:`multi-stage-aggregation`})],q.prototype,`multiStageAggregation`,void 0),g([j({type:Boolean,attribute:`nested-aggregation`})],q.prototype,`nestedAggregation`,void 0),g([M()],q.prototype,`_datasets`,void 0),g([M()],q.prototype,`_codeMirrorLoaded`,void 0);function Wt(){let e=2026;return{"+":{type:`infix`,arity:2,label:()=>v(`Addition`,{desc:`Formula function label for addition`}),description:()=>v(`Adds two numeric values.`,{desc:`Formula function description for addition operator`}),example:()=>`42.0 + ⟨numeric⟩ Average burrito price`,exampleHasIcons:!0},"-":{type:`infix`,arity:2,label:()=>v(`Difference`,{desc:`Formula function label for subtraction`}),description:()=>v(`Subtracts the second value from the first value.`,{desc:`Formula function description for subtraction operator`}),example:()=>`⟨numeric⟩ Burrito weight - 42`,exampleHasIcons:!0},"*":{type:`infix`,arity:2,label:()=>v(`Multiplication`,{desc:`Formula function label for multiplication`}),description:()=>v(`Multiplies two numeric values.`,{desc:`Formula function description for multiplication operator`}),example:()=>`⟨numeric⟩ Number of burritos * 2`,exampleHasIcons:!0},"/":{type:`infix`,arity:2,label:()=>v(`Division`,{desc:`Formula function label for division`}),description:()=>v(`Divides the first numeric value by the second numeric value.`,{desc:`Formula function description for division operator`}),example:()=>`⟨numeric⟩ Number of burritos / 2`,exampleHasIcons:!0},"%":{type:`infix`,arity:2,label:()=>v(`Modulo`,{desc:`Formula function label for modulo`}),description:()=>v(`Returns the remainder after dividing the first value by the second value.`,{desc:`Formula function description for modulo operator`}),example:()=>`5 % 2`},">":{type:`infix`,arity:2,label:()=>v(`Greater than`,{desc:`Formula function label for greater than comparison`}),description:()=>v(`Checks whether the first value is greater than the second value.`,{desc:`Formula function description for greater than operator`}),example:()=>`⟨numeric⟩ Burrito weight > 50`,exampleHasIcons:!0},"<":{type:`infix`,arity:2,label:()=>v(`Less than`,{desc:`Formula function label for less than comparison`}),description:()=>v(`Checks whether the first value is less than the second value.`,{desc:`Formula function description for less than operator`}),example:()=>`⟨numeric⟩ Burrito weight < 50`,exampleHasIcons:!0},">=":{type:`infix`,arity:2,label:()=>v(`Greater than or equal`,{desc:`Formula function label for greater than or equal comparison`}),description:()=>v(`Checks whether the first value is greater than or equal to the second value.`,{desc:`Formula function description for greater than or equal operator`}),example:()=>`⟨numeric⟩ Burrito weight >= 50`,exampleHasIcons:!0},"<=":{type:`infix`,arity:2,label:()=>v(`Less than or equal`,{desc:`Formula function label for less than or equal comparison`}),description:()=>v(`Checks whether the first value is less than or equal to the second value.`,{desc:`Formula function description for less than or equal operator`}),example:()=>`⟨numeric⟩ Burrito weight <= 50`,exampleHasIcons:!0},"=":{type:`infix`,arity:2,label:()=>v(`Equal`,{desc:`Formula function label for equality comparison`}),description:()=>v(`Checks whether both values are equal.`,{desc:`Formula function description for equality operator`}),example:()=>`⟨hierarchy⟩ Burrito type = 'Savoury'`,exampleHasIcons:!0},"<>":{type:`infix`,arity:2,label:()=>v(`Not equal`,{desc:`Formula function label for inequality comparison`}),description:()=>v(`Checks whether two values are different.`,{desc:`Formula function description for inequality operator`}),example:()=>`⟨hierarchy⟩ Burrito type <> 'Sweet'`,exampleHasIcons:!0},ABS:{type:`prefix`,arity:1,label:()=>v(`Absolute value`,{desc:`Formula function label for ABS`}),description:()=>v(`Returns the absolute value of a number.`,{desc:`Formula function description for ABS`}),example:()=>`ABS(-5.0)`},CEIL:{type:`prefix`,arity:1,label:()=>v(`Round up`,{desc:`Formula function label for CEIL`}),description:()=>v(`Rounds a number up to the nearest integer.`,{desc:`Formula function description for CEIL`}),example:()=>`CEIL(11.3)`},E:{type:`prefix`,arity:0,label:()=>v(`Euler's number`,{desc:`Formula function label for E`}),description:()=>v(`Returns Euler's constant e.`,{desc:`Formula function description for E`}),example:()=>`E()`},EXP:{type:`prefix`,arity:1,label:()=>v(`Exponential`,{desc:`Formula function label for EXP`}),description:()=>v(`Returns e raised to the specified power.`,{desc:`Formula function description for EXP`}),example:()=>`EXP(11.3)`},FLOOR:{type:`prefix`,arity:1,label:()=>v(`Round down`,{desc:`Formula function label for FLOOR`}),description:()=>v(`Rounds a number down to the nearest integer.`,{desc:`Formula function description for FLOOR`}),example:()=>`FLOOR(11.7)`},LN:{type:`prefix`,arity:1,label:()=>v(`Natural logarithm`,{desc:`Formula function label for LN`}),description:()=>v(`Returns the natural logarithm of a number.`,{desc:`Formula function description for LN`}),example:()=>`LN(11.7)`},LOG:{type:`prefix`,arity:2,label:()=>v(`Logarithm`,{desc:`Formula function label for LOG`}),description:()=>v(`Returns the logarithm of a number for a specific base.`,{desc:`Formula function description for LOG`}),example:()=>`LOG(3.6, 10)`},PI:{type:`prefix`,arity:0,label:()=>v(`Pi`,{desc:`Formula function label for PI`}),description:()=>v(`Returns the mathematical constant pi.`,{desc:`Formula function description for PI`}),example:()=>`PI()`},POW:{type:`prefix`,arity:2,label:()=>v(`Power`,{desc:`Formula function label for POW`}),description:()=>v(`Raises a number to a given power.`,{desc:`Formula function description for POW`}),example:()=>`POW(2.35, 2)`},RAND:{type:`prefix`,arity:0,label:()=>v(`Random number`,{desc:`Formula function label for RAND`}),description:()=>v(`Returns a random number between 0 and 1.`,{desc:`Formula function description for RAND`}),example:()=>`RAND()`},ROUND:{type:`prefix`,arity:2,label:()=>v(`Round`,{desc:`Formula function label for ROUND`}),description:()=>v(`Rounds a number to a specified number of decimal places.`,{desc:`Formula function description for ROUND`}),example:()=>`ROUND(4.567, 1)`},SQRT:{type:`prefix`,arity:1,label:()=>v(`Square root`,{desc:`Formula function label for SQRT`}),description:()=>v(`Returns the square root of a number.`,{desc:`Formula function description for SQRT`}),example:()=>`SQRT(4)`},CAST:{type:`prefix`,arity:2,label:()=>v(`Convert value`,{desc:`Formula function label for CAST`}),description:()=>v(`Converts the first argument to the type given by the second argument. Possible types are 'hierarchy', 'numeric', 'datetime' and 'boolean'.`,{desc:`Formula function description for CAST`}),example:()=>`CAST(⟨numeric⟩ Burrito weight, hierarchy)`,exampleHasIcons:!0},IF:{type:`prefix`,arity:3,label:()=>v(`If`,{desc:`Formula function label for IF`}),description:()=>v(`Returns one value when a condition is true and another value when false.`,{desc:`Formula function description for IF`}),example:()=>`IF(⟨numeric⟩ Burrito weight < 200,'Small','Large')`,exampleHasIcons:!0},COALESCE:{type:`prefix`,arity:2,label:()=>v(`Is empty`,{desc:`Formula function label for COALESCE`}),description:()=>v(`Returns the first non-null value from the provided arguments.`,{desc:`Formula function description for COALESCE`}),example:()=>`COALESCE(⟨hierarchy⟩ Burrito type, 'Unknown type')`,exampleHasIcons:!0},AND:{type:`infix`,arity:2,label:()=>v(`Logical and`,{desc:`Formula function label for AND`}),description:()=>v(`Returns true when both conditions are true.`,{desc:`Formula function description for AND`}),example:()=>`Burrito weight > 50 AND Burrito weight < 75`},OR:{type:`infix`,arity:2,label:()=>v(`Logical or`,{desc:`Formula function label for OR`}),description:()=>v(`Returns true when at least one condition is true.`,{desc:`Formula function description for OR`}),example:()=>`Burrito price > 10.1 OR Burrito weight >= 50`},NOT:{type:`prefix_op`,arity:1,label:()=>v(`Logical not`,{desc:`Formula function label for NOT`}),description:()=>v(`Negates a boolean condition.`,{desc:`Formula function description for NOT`}),example:()=>`NOT (Burrito type = 'Salty')`},SIN:{type:`prefix`,arity:1,label:()=>v(`Sine`,{desc:`Formula function label for SIN`}),description:()=>v(`Returns the sine of an angle in radians.`,{desc:`Formula function description for SIN`}),example:()=>`SIN(3.14)`},COS:{type:`prefix`,arity:1,label:()=>v(`Cosine`,{desc:`Formula function label for COS`}),description:()=>v(`Returns the cosine of an angle in radians.`,{desc:`Formula function description for COS`}),example:()=>`COS(3.14)`},TAN:{type:`prefix`,arity:1,label:()=>v(`Tangent`,{desc:`Formula function label for TAN`}),description:()=>v(`Returns the tangent of an angle in radians.`,{desc:`Formula function description for TAN`}),example:()=>`TAN(3.14)`},ASIN:{type:`prefix`,arity:1,label:()=>v(`Arcsine`,{desc:`Formula function label for ASIN`}),description:()=>v(`Returns the arcsine of a number.`,{desc:`Formula function description for ASIN`}),example:()=>`ASIN(3.14)`},ACOS:{type:`prefix`,arity:1,label:()=>v(`Arccosine`,{desc:`Formula function label for ACOS`}),description:()=>v(`Returns the arccosine of a number.`,{desc:`Formula function description for ACOS`}),example:()=>`ACOS(3.14)`},ATAN:{type:`prefix`,arity:1,label:()=>v(`Arctangent`,{desc:`Formula function label for ATAN`}),description:()=>v(`Returns the arctangent of a number.`,{desc:`Formula function description for ATAN`}),example:()=>`ATAN(3.14)`},SINH:{type:`prefix`,arity:1,label:()=>v(`Hyperbolic sine`,{desc:`Formula function label for SINH`}),description:()=>v(`Returns the hyperbolic sine of a number.`,{desc:`Formula function description for SINH`}),example:()=>`SINH(3.14)`},COSH:{type:`prefix`,arity:1,label:()=>v(`Hyperbolic cosine`,{desc:`Formula function label for COSH`}),description:()=>v(`Returns the hyperbolic cosine of a number.`,{desc:`Formula function description for COSH`}),example:()=>`COSH(3.14)`},TANH:{type:`prefix`,arity:1,label:()=>v(`Hyperbolic tangent`,{desc:`Formula function label for TANH`}),description:()=>v(`Returns the hyperbolic tangent of a number.`,{desc:`Formula function description for TANH`}),example:()=>`TANH(3.14)`},MEAN:{type:`prefix`,arity:1,label:()=>v(`Mean`,{desc:`Formula function label for MEAN`}),description:()=>v(`Returns the arithmetic mean of all values in a numeric column. The value is calculated over the entire dataset and does not change when filtering.`,{desc:`Formula function description for MEAN`}),example:()=>`MEAN(⟨numeric⟩ Burrito weight)`,exampleHasIcons:!0},STDDEV:{type:`prefix`,arity:1,label:()=>v(`Standard deviation`,{desc:`Aggregation label`}),description:()=>v(`Returns the sample standard deviation over all values in a numeric column. The value is calculated over the entire dataset and does not change when filtering.`,{desc:`Formula function description for STDDEV`}),example:()=>`STDDEV(⟨numeric⟩ Burrito weight)`,exampleHasIcons:!0},"||":{type:`infix`,arity:2,label:()=>v(`Concatenate`,{desc:`Formula function label for concatenate operator`}),description:()=>v(`Concatenates two strings.`,{desc:`Formula function description for concatenate operator`}),example:()=>`'Tasty' || ' burrito'`},LENGTH:{type:`prefix`,arity:1,label:()=>v(`String length`,{desc:`Formula function label for LENGTH`}),description:()=>v(`Returns the number of characters in a string.`,{desc:`Formula function description for LENGTH`}),example:()=>`LENGTH('Burrito')`},LOWER:{type:`prefix`,arity:1,label:()=>v(`Lowercase`,{desc:`Formula function label for LOWER`}),description:()=>v(`Converts a string to lowercase.`,{desc:`Formula function description for LOWER`}),example:()=>`LOWER('BURRITO')`},UPPER:{type:`prefix`,arity:1,label:()=>v(`Uppercase`,{desc:`Formula function label for UPPER`}),description:()=>v(`Converts a string to uppercase.`,{desc:`Formula function description for UPPER`}),example:()=>`UPPER('burrito')`},LTRIM:{type:`prefix`,arity:1,label:()=>v(`Trim left`,{desc:`Formula function label for LTRIM`}),description:()=>v(`Removes leading spaces from a string.`,{desc:`Formula function description for LTRIM`}),example:()=>`LTRIM(' Burrito')`},RTRIM:{type:`prefix`,arity:1,label:()=>v(`Trim right`,{desc:`Formula function label for RTRIM`}),description:()=>v(`Removes trailing spaces from a string.`,{desc:`Formula function description for RTRIM`}),example:()=>`RTRIM('Burrito ')`},TRIM:{type:`prefix`,arity:1,label:()=>v(`Trim`,{desc:`Formula function label for TRIM`}),description:()=>v(`Removes leading and trailing spaces from a string.`,{desc:`Formula function description for TRIM`}),example:()=>`TRIM('Burrito ')`},REPLACE:{type:`prefix`,arity:3,label:()=>v(`Replace text`,{desc:`Formula function label for REPLACE`}),description:()=>v(`Replaces occurrences of a substring with another substring.`,{desc:`Formula function description for REPLACE`}),example:()=>`REPLACE('Sweet burrito','Sweet', 'Savoury')`},STRPOS:{type:`prefix`,arity:2,label:()=>v(`Find substring`,{desc:`Formula function label for STRPOS`}),description:()=>v(`Returns the position of a substring in a string.`,{desc:`Formula function description for STRPOS`}),example:()=>`STRPOS('Sweet burrito','burrito')`},SUBSTR:{type:`prefix`,arity:3,label:()=>v(`Take substring`,{desc:`Formula function label for SUBSTR`}),description:()=>v(`Extracts part of a string. The first argument is the text, the second the starting position (the first character is 1; a negative position counts from the end), and the third the length.`,{desc:`Formula function description for SUBSTR`}),example:()=>`SUBSTR('Sweet burrito',7,3)`},SPLIT_PART:{type:`prefix`,arity:3,label:()=>v(`Split part`,{desc:`Formula function label for SPLIT_PART`}),description:()=>v(`Splits a string into parts using a delimiter. The first argument is the text to split, the second the delimiter, and the third the position of the part to return (starting from 1).`,{desc:`Formula function description for SPLIT_PART`}),example:()=>`SPLIT_PART('Sweet burrito', ' ', 2)`},NOW:{type:`prefix`,arity:0,label:()=>v(`Current date and time`,{desc:`Formula function label for NOW`}),description:()=>v(`Returns the current date and time.`,{desc:`Formula function description for NOW`}),example:()=>`NOW()`},YEAR:{type:`prefix`,arity:1,label:()=>v(`Year`,{desc:`Time unit`}),description:()=>v(`Extracts the year from a date value.`,{desc:`Formula function description for YEAR`}),example:()=>`YEAR('${e}-02-17')`},YEAR_UTC:{type:`prefix`,arity:1,label:()=>v(`Year (UTC)`,{desc:`Formula function label for YEAR_UTC`}),description:()=>v(`Extracts the year from a date value in UTC.`,{desc:`Formula function description for YEAR_UTC`}),example:()=>`YEAR_UTC('${e}-02-17')`},QUARTER:{type:`prefix`,arity:1,label:()=>v(`Quarter`,{desc:`Time unit`}),description:()=>v(`Extracts the quarter from a date value.`,{desc:`Formula function description for QUARTER`}),example:()=>`QUARTER('${e}-02-17')`},QUARTER_UTC:{type:`prefix`,arity:1,label:()=>v(`Quarter (UTC)`,{desc:`Formula function label for QUARTER_UTC`}),description:()=>v(`Extracts the quarter from a date value in UTC.`,{desc:`Formula function description for QUARTER_UTC`}),example:()=>`QUARTER_UTC('${e}-02-17')`},MONTH:{type:`prefix`,arity:1,label:()=>v(`Month`,{desc:`Time unit`}),description:()=>v(`Extracts the month from a date or datetime value.`,{desc:`Formula function description for MONTH`}),example:()=>`MONTH('${e}-02-17 15:36:59')`},MONTH_UTC:{type:`prefix`,arity:1,label:()=>v(`Month (UTC)`,{desc:`Formula function label for MONTH_UTC`}),description:()=>v(`Extracts the month from a date or datetime value in UTC.`,{desc:`Formula function description for MONTH_UTC`}),example:()=>`MONTH_UTC('${e}-02-17 15:36:59')`},WEEK:{type:`prefix`,arity:1,label:()=>v(`Week`,{desc:`Time unit`}),description:()=>v(`Extracts the ISO 8601 week number (1-53) from a date or datetime value.`,{desc:`Formula function description for WEEK`}),example:()=>`WEEK('${e}-02-17 15:36:59')`},WEEK_UTC:{type:`prefix`,arity:1,label:()=>v(`Week (UTC)`,{desc:`Formula function label for WEEK_UTC`}),description:()=>v(`Extracts the ISO 8601 week number (1-53) from a date or datetime value in UTC.`,{desc:`Formula function description for WEEK_UTC`}),example:()=>`WEEK_UTC('${e}-02-17 15:36:59')`},DAY:{type:`prefix`,arity:1,label:()=>v(`Day of month`,{desc:`Formula function label for DAY`}),description:()=>v(`Extracts the day of month from a date or datetime value.`,{desc:`Formula function description for DAY`}),example:()=>`DAY('${e}-02-17 15:36:59')`},DAY_UTC:{type:`prefix`,arity:1,label:()=>v(`Day of month (UTC)`,{desc:`Formula function label for DAY_UTC`}),description:()=>v(`Extracts the day of month from a date or datetime value in UTC.`,{desc:`Formula function description for DAY_UTC`}),example:()=>`DAY_UTC('${e}-02-17 15:36:59')`},DAY_OF_WEEK:{type:`prefix`,arity:1,label:()=>v(`Day of week`,{desc:`Formula function label for DAY_OF_WEEK`}),description:()=>v(`Extracts the day of week (1-7, where 1 is Monday) from a date or datetime value.`,{desc:`Formula function description for DAY_OF_WEEK`}),example:()=>`DAY_OF_WEEK('${e}-02-17 15:36:59')`},DAY_OF_WEEK_UTC:{type:`prefix`,arity:1,label:()=>v(`Day of week (UTC)`,{desc:`Formula function label for DAY_OF_WEEK_UTC`}),description:()=>v(`Extracts the day of week (1-7, where 1 is Monday) from a date or datetime value in UTC.`,{desc:`Formula function description for DAY_OF_WEEK_UTC`}),example:()=>`DAY_OF_WEEK_UTC('${e}-02-17 15:36:59')`},DAY_OF_YEAR:{type:`prefix`,arity:1,label:()=>v(`Day of year`,{desc:`Formula function label for DAY_OF_YEAR`}),description:()=>v(`Extracts the day of year from a date or datetime value.`,{desc:`Formula function description for DAY_OF_YEAR`}),example:()=>`DAY_OF_YEAR('${e}-02-17 15:36:59')`},DAY_OF_YEAR_UTC:{type:`prefix`,arity:1,label:()=>v(`Day of year (UTC)`,{desc:`Formula function label for DAY_OF_YEAR_UTC`}),description:()=>v(`Extracts the day of year from a date or datetime value in UTC.`,{desc:`Formula function description for DAY_OF_YEAR_UTC`}),example:()=>`DAY_OF_YEAR_UTC('${e}-02-17 15:36:59')`},YEAR_OF_WEEK:{type:`prefix`,arity:1,label:()=>v(`Year of ISO week`,{desc:`Formula function label for YEAR_OF_WEEK`}),description:()=>v(`Extracts the ISO week-numbering year from a date or datetime value.`,{desc:`Formula function description for YEAR_OF_WEEK`}),example:()=>`YEAR_OF_WEEK('${e}-02-17 15:36:59')`},YEAR_OF_WEEK_UTC:{type:`prefix`,arity:1,label:()=>v(`Year of ISO week (UTC)`,{desc:`Formula function label for YEAR_OF_WEEK_UTC`}),description:()=>v(`Extracts the ISO week-numbering year from a date or datetime value in UTC.`,{desc:`Formula function description for YEAR_OF_WEEK_UTC`}),example:()=>`YEAR_OF_WEEK_UTC('${e}-02-17 15:36:59')`},HOUR:{type:`prefix`,arity:1,label:()=>v(`Hour`,{desc:`Time unit`}),description:()=>v(`Extracts the hour from a datetime value.`,{desc:`Formula function description for HOUR`}),example:()=>`HOUR('${e}-02-17 15:36:59')`},HOUR_UTC:{type:`prefix`,arity:1,label:()=>v(`Hour (UTC)`,{desc:`Formula function label for HOUR_UTC`}),description:()=>v(`Extracts the hour from a datetime value in UTC.`,{desc:`Formula function description for HOUR_UTC`}),example:()=>`HOUR_UTC('${e}-02-17 15:36:59')`},MINUTE:{type:`prefix`,arity:1,label:()=>v(`Minute`,{desc:`Time unit`}),description:()=>v(`Extracts the minute from a datetime value.`,{desc:`Formula function description for MINUTE`}),example:()=>`MINUTE('${e}-02-17 15:36:59')`},MINUTE_UTC:{type:`prefix`,arity:1,label:()=>v(`Minute (UTC)`,{desc:`Formula function label for MINUTE_UTC`}),description:()=>v(`Extracts the minute from a datetime value in UTC.`,{desc:`Formula function description for MINUTE_UTC`}),example:()=>`MINUTE_UTC('${e}-02-17 15:36:59')`},SECOND:{type:`prefix`,arity:1,label:()=>v(`Second`,{desc:`Time unit`}),description:()=>v(`Extracts the second from a datetime value.`,{desc:`Formula function description for SECOND`}),example:()=>`SECOND('${e}-02-17 15:36:59')`},SECOND_UTC:{type:`prefix`,arity:1,label:()=>v(`Second (UTC)`,{desc:`Formula function label for SECOND_UTC`}),description:()=>v(`Extracts the second from a datetime value in UTC.`,{desc:`Formula function description for SECOND_UTC`}),example:()=>`SECOND_UTC('${e}-02-17 15:36:59')`},DATE_ADD:{type:`prefix`,arity:3,label:()=>v(`Add/subtract duration`,{desc:`Formula function label for DATE_ADD`}),description:()=>v(`Adds a duration to (or subtracts it from) a date or datetime value. The first argument is the unit ('millisecond', 'second', 'minute', 'hour', 'day', 'week', 'month', 'quarter' or 'year'), the second the number of units to add (negative to subtract), and the third the date or datetime to start from.`,{desc:`Formula function description for DATE_ADD`}),example:()=>`DATE_ADD('hour', 2, ⟨datetime⟩ Arrival time)`,exampleHasIcons:!0},DATE_DIFF:{type:`prefix`,arity:3,label:()=>v(`Difference between dates`,{desc:`Formula function label for DATE_DIFF`}),description:()=>v(`Returns the difference between two dates or datetimes in the selected unit. The first argument is the unit ('millisecond', 'second', 'minute', 'hour', 'day', 'week', 'month', 'quarter' or 'year'); the difference is calculated from the second date towards the third date.`,{desc:`Formula function description for DATE_DIFF`}),example:()=>`DATE_DIFF('day', ⟨datetime⟩ Arrival date, '${e}-02-17 15:36:59')`,exampleHasIcons:!0},COORDS:{type:`prefix`,arity:3,label:()=>v(`Coordinates`,{id:`formula-function-label-coords`,desc:`Formula function label for COORDS`}),description:()=>v(`Builds a geography value from latitude, longitude, and spatial reference.`,{desc:`Formula function description for COORDS`}),example:()=>`COORDS(⟨numeric⟩ Latitude, ⟨numeric⟩ Longitude, 'wgs84')`,exampleHasIcons:!0}}}var Gt=class extends EventTarget{constructor(...e){super(...e),this.functionDataMap=Wt(),this.aggregationFunctionDataMap=f(),this.multiStageAggregation=!0,this.nestedAggregation=!0,this.readonly=!1,this.contentLanguage=`en`,this.size=`m`,this.datasets=[],this.loading=!1,this.lastFocusedAggregationWidgetId=null,this.lastFocusedEmptyArgumentId=null,this.pendingFocusAggregationWidgetId=null,this._aggregationWidgets=[]}get aggregationWidgets(){return this._aggregationWidgets}addWidgets(e){!e||e.length===0||(this._aggregationWidgets=[...this._aggregationWidgets,...e],this._notifyWidgetsChanged())}removeWidgets(e){this._aggregationWidgets=this._aggregationWidgets.filter(({widgetId:t})=>!e.includes(t)),this._notifyWidgetsChanged()}updateWidget(e){this._aggregationWidgets=this._aggregationWidgets.map(t=>t.widgetId===e.widgetId?e:t),this._notifyWidgetsChanged()}getWidget(e){return this._aggregationWidgets.find(t=>t.widgetId===e)}clearWidgets(){this._aggregationWidgets.length!==0&&(this._aggregationWidgets=[],this._notifyWidgetsChanged())}_notifyWidgetsChanged(){this.dispatchEvent(new CustomEvent(`widgets-changed`))}setReadonly(e){this.readonly!==e&&(this.readonly=e,this.dispatchEvent(new CustomEvent(`widgets-changed`)))}setLoading(e){this.loading!==e&&(this.loading=e,this.refreshDecorations())}refreshDecorations(){this.dispatchEvent(new CustomEvent(`refresh-decorations`))}_markAggregationForFocus(e){let t=e[0];t&&(this.aggregationFunctionDataMap[t.aggregationFunction]?.arity??0)>0&&(this.pendingFocusAggregationWidgetId=t.widgetId)}transformToAggregationWidgetSyntax(e){let n=zt(e).match(r);if(!n)return e;let i=!!n[1],a=n.index??0,o=Bt(e,a+(i?n[1].length:n[0].length)-1+1),s=Bt(e,a+n[0].length);if(o===-1)return e;let c=e.slice(a+n[0].length,s),l=this.transformToAggregationWidgetSyntax(c),u={widgetId:It(),grouping:n[2]??t.GROUP,aggregationFunction:n[3],content:l};if(u.grouping===t.GROUPINEX){let{includedColumns:t,excludedColumns:n}=Vt(e.slice(s+1,o));u.includedColumns=t,u.excludedColumns=n}let d=Lt(u.widgetId),f=`${e.slice(0,a)}${d}${e.slice(o+1)}`;return this.addWidgets([u]),this.transformToAggregationWidgetSyntax(f)}transformToAggregationFunctionSyntax(e){let t=e.match(c);if(!t)return e;let n=t.index??0,r=n+t[0].length-1,i=t[1],a=this.getWidget(i),o=a?this.transformToAggregationFunctionSyntax(Rt(a,this.aggregationFunctionDataMap)):``,s=`${e.slice(0,n)}${o}${e.slice(r+1)}`;return this.transformToAggregationFunctionSyntax(s)}},Kt=`:host{box-sizing:border-box;font-family:var(--luzmo-font-family);color:var(--luzmo-font-color);display:inline-block}.formula-text{font-size:var(--luzmo-formula-font-size,var(--luzmo-font-size));white-space:pre-wrap;word-break:break-word;line-height:1.5}.formula-text-column{white-space:nowrap}.formula-text-column-icon{margin-inline-end:var(--luzmo-spacing-1)}.formula-pills{align-items:center;gap:var(--luzmo-spacing-1) 0;font-size:var(--luzmo-formula-font-size,var(--luzmo-font-size));flex-wrap:wrap;line-height:1.5;display:inline-flex}.formula-operator{white-space:pre-wrap}.column-pill-wrapper{vertical-align:middle;padding-inline-end:var(--luzmo-formula-column-pill-trailing-space,var(--luzmo-spacing-1));display:inline-flex}.column-pill{justify-content:center;align-items:center;gap:var(--luzmo-spacing-2);box-sizing:border-box;max-width:16rem;min-height:var(--luzmo-formula-control-height,1.375rem);padding:0 var(--luzmo-formula-column-pill-padding-inline,calc(var(--luzmo-spacing-2) + var(--luzmo-spacing-1)));border-radius:var(--luzmo-border-radius-s);background-color:var(--luzmo-formula-column-pill-background,var(--luzmo-background-color-highlight));color:var(--luzmo-font-color);white-space:nowrap;font-size:.85em;line-height:1.2;display:inline-flex}.column-pill-icon{flex:none;display:inline-flex}.column-pill-label{text-overflow:ellipsis;overflow:hidden}.column-pill-loading{--luzmo-progress-circle-size:1em;align-items:center;display:inline-flex}.agg-pill{padding-block:var(--luzmo-spacing-1);border-radius:var(--luzmo-border-radius);background-color:var(--agg-accent,var(--luzmo-primary));color:var(--luzmo-primary-inverse-color);font-size:var(--luzmo-formula-font-size,var(--luzmo-font-size));vertical-align:middle;padding-inline:0;display:inline-flex}.agg-pill-row{align-items:center;gap:var(--luzmo-spacing-1);min-height:var(--luzmo-formula-control-height,1.375rem);display:inline-flex}.agg-fn{text-transform:uppercase;padding-inline-start:var(--luzmo-spacing-3);padding-inline-end:var(--luzmo-spacing-3);font-size:.85em}.agg-value{min-height:var(--luzmo-formula-control-height,1.375rem);padding:0 var(--luzmo-spacing-2);border-radius:var(--luzmo-border-radius-s);background-color:var(--luzmo-background-color);color:var(--luzmo-font-color);--luzmo-formula-column-pill-background:transparent;--luzmo-formula-column-pill-padding-inline:0px;align-items:center;line-height:1;display:inline-flex}.agg-grouping{align-items:center;gap:var(--luzmo-spacing-1);padding-inline:var(--luzmo-spacing-2) var(--luzmo-spacing-3);font-size:var(--luzmo-formula-grouping-icon-size,var(--luzmo-icon-size-m));display:inline-flex}.agg-grouping--no-value{padding-inline-start:0}.agg-grouping-count{border-radius:var(--luzmo-border-radius-full,999rem);background:var(--luzmo-primary-inverse-color);min-width:1.25em;color:var(--agg-accent,var(--luzmo-primary));font-size:.6875rem;font-weight:var(--luzmo-font-weight-bold);justify-content:center;align-items:center;padding:0 .25em;line-height:1.4;display:inline-flex}:host{--luzmo-formula-font-size:var(--luzmo-font-size);--luzmo-formula-grouping-icon-size:var(--luzmo-icon-size-m);--luzmo-formula-control-height:calc(var(--luzmo-component-height) - 2 * var(--luzmo-spacing-1))}:host([size=s]){--luzmo-formula-font-size:var(--luzmo-font-size-s);--luzmo-formula-grouping-icon-size:var(--luzmo-icon-size-s);--luzmo-formula-control-height:calc(var(--luzmo-component-height-s) - 2 * var(--luzmo-spacing-1))}:host([size=l]){--luzmo-formula-font-size:var(--luzmo-font-size-l);--luzmo-formula-grouping-icon-size:var(--luzmo-icon-size-l);--luzmo-formula-control-height:calc(var(--luzmo-component-height-l) - 2 * var(--luzmo-spacing-1))}:host([size=xl]){--luzmo-formula-font-size:var(--luzmo-font-size-xl);--luzmo-formula-grouping-icon-size:var(--luzmo-icon-size-xl);--luzmo-formula-control-height:calc(var(--luzmo-component-height-xl) - 2 * var(--luzmo-spacing-1))}`,qt=class extends q{constructor(...e){super(...e),this.display=`rich`,this._groupingDataMap=s()}static{this.styles=N(Kt)}_createStore(){return new Gt}_shouldLoadInput(){return!1}_canEmitExpression(){return!1}_applyExternalExpression(){if(this.display===`text`){this._rootContent=``;return}this._store.clearWidgets(),this._rootContent=this._store.transformToAggregationWidgetSyntax(this.expression??``)}willUpdate(e){super.willUpdate(e),e.has(`display`)&&!e.has(`expression`)&&this._applyExternalExpression()}render(){return this.display===`text`?this._renderTextFormula():this._renderPillFormula()}_renderPillFormula(){return O`<span class="formula-pills" part="formula">${this._renderPillNodes(this._rootContent)}</span>`}_renderPillNodes(e){let t=[],n=new RegExp(d.source,`gm`),r=0,i;for(;(i=n.exec(e))!==null;){i.index>r&&t.push(this._renderOperatorText(e.slice(r,i.index)));let a=i[2],o=i[3];a?t.push(this._renderColumnPill(a)):o&&t.push(this._renderAggregationPill(o)),r=n.lastIndex}return r<e.length&&t.push(this._renderOperatorText(e.slice(r))),t}_renderOperatorText(e){return O`<span class="formula-operator">${e}</span>`}_renderColumnPill(e){let[t,n]=e.split(`:`),r=this._datasets.find(e=>e.id===t)?.columns.find(e=>e.columnId===n);if(this._store.loading&&!r){let e=v(`Loading column`,{desc:`Accessible label for a column pill whose label is still loading`});return O`<span class="column-pill-wrapper"
6
- ><span class="column-pill" title=${e}
7
- ><span class="column-pill-loading">
8
- <luzmo-progress-circle indeterminate size="s" .label=${e}></luzmo-progress-circle></span
9
- ></span
10
- ></span>`}let{icon:i,label:a}=l(r,this.contentLanguage,n);return O`<span class="column-pill-wrapper"
11
- ><span class="column-pill" title=${a}
12
- ><span class="column-pill-icon">${b(i)}</span
13
- ><span class="column-pill-label">${a}</span></span
14
- ></span>`}_renderAggregationPill(e){let n=this._store.getWidget(e);if(!n)return O`${A}`;let r=this._groupingDataMap[n.grouping],i=r?.color??``,a=this._store.aggregationFunctionDataMap[n.aggregationFunction]?.arity??0,o=r?.label()??``,s=n.grouping===t.GROUPINEX?(n.includedColumns?.length??0)+(n.excludedColumns?.length??0):0;return O`<span class="agg-pill" style=${i?`--agg-accent: ${i}`:``}>
15
- <span class="agg-pill-row">
16
- <span class="agg-fn">${n.aggregationFunction}</span>
17
- ${a>0?O`<span class="agg-value">${this._renderPillNodes(n.content)}</span>`:A}
18
- <span
19
- class="agg-grouping${a>0?``:` agg-grouping--no-value`}"
20
- title=${o}
21
- aria-label=${o}
22
- >
23
- ${r?.icon?b(r.icon):A}
24
- ${s>0?O`<span class="agg-grouping-count">${s}</span>`:A}
25
- </span>
26
- </span>
27
- </span>`}_renderTextFormula(){let e=this.expression??``,t=[],n=new RegExp(i.source,`g`),r=0,a;for(;(a=n.exec(e))!==null;){a.index>r&&t.push(e.slice(r,a.index));let[i,o]=a[1].split(`:`);t.push(this._renderColumnReference(i,o)),r=n.lastIndex}return r<e.length&&t.push(e.slice(r)),O`<span class="formula-text" part="formula-text">${t}</span>`}_renderColumnReference(e,t){let n=this._datasets.find(t=>t.id===e),r=n?.columns.find(e=>e.columnId===t),i=r?T(r.name,this.contentLanguage):t,a=n?T(n.name,this.contentLanguage):``;return O`<span class="formula-text-column" part="formula-text-column" title=${a?`${a} · ${i}`:i}>
28
- <span class="formula-text-column-icon">${b(ie({type:r?.type??`hierarchy`},`s`))}</span>
29
- <span class="formula-text-column-name">${i}</span>
30
- </span>`}};g([j({type:String,reflect:!0})],qt.prototype,`display`,void 0),qt=g([y()],qt),customElements.get(`luzmo-formula`)||customElements.define(`luzmo-formula`,qt);var Jt=`:host{font-family:var(--luzmo-display-settings-font-family,var(--luzmo-font-family));font-size:var(--luzmo-display-settings-font-size,var(--display-settings-font-size));color:var(--luzmo-display-settings-font-color,var(--luzmo-font-color))}.settings-container{gap:var(--luzmo-display-settings-vertical-gap,var(--luzmo-spacing-2));flex-direction:column;display:flex}.settings-row{justify-content:flex-start;align-items:center;gap:var(--luzmo-display-settings-gap,var(--display-settings-gap));display:flex}.label-container{align-items:center;gap:var(--luzmo-display-settings-gap,var(--display-settings-gap));min-width:0;display:flex}.calculation-preview{align-items:flex-start}.calculation-preview luzmo-field-label{--luzmo-field-label-side-aligned-height:auto;--luzmo-field-label-min-height:auto;--luzmo-field-label-padding-block:0;--luzmo-field-label-line-height:1.5}.calculation-preview luzmo-formula{max-block-size:6em;max-inline-size:var(--luzmo-display-settings-calculation-max-width,var(--display-settings-calculation-max-width));overflow-wrap:anywhere;align-items:flex-start;min-width:0;display:inline-flex;overflow-y:auto}.calculation-preview luzmo-formula::-webkit-scrollbar{width:var(--luzmo-scrollbar-size)}.calculation-preview luzmo-formula::-webkit-scrollbar-track{background:var(--luzmo-scrollbar-track-background);border-radius:var(--luzmo-scrollbar-track-border-radius)}.calculation-preview luzmo-formula::-webkit-scrollbar-thumb{background:var(--luzmo-scrollbar-thumb-background);border-radius:var(--luzmo-scrollbar-thumb-border-radius)}.calculation-preview luzmo-formula::-webkit-scrollbar-thumb:hover{background:var(--luzmo-scrollbar-thumb-hover-background)}.calculation-preview luzmo-formula{scrollbar-width:var(--luzmo-scrollbar-width,thin);scrollbar-color:var(--luzmo-scrollbar-thumb-background) var(--luzmo-scrollbar-track-background)}luzmo-divider{margin:var(--luzmo-display-settings-ids-container-vertical-margin,var(--display-settings-ids-container-vertical-margin)) 0}luzmo-tooltip{--tooltip-font-size:var(--luzmo-display-settings-tooltip-font-size,var(--tooltip-font-size))}.setting{align-items:center;display:flex}.label-action-container{justify-content:space-between;align-items:center;gap:var(--luzmo-display-settings-info-to-remove-icon-gap,var(--display-settings-info-to-remove-icon-gap));display:flex}.label-action-container luzmo-action-button{margin-inline-start:var(--luzmo-spacing-2)}.ids-container{gap:var(--luzmo-display-settings-ids-container-gap,var(--luzmo-spacing-2));border-radius:50%;flex-direction:column;display:flex}.id-label{text-transform:var(--luzmo-display-settings-id-label-text-transform,var(--display-settings-id-label-text-transform));font-size:var(--luzmo-display-settings-id-label-font-size,var(--display-settings-id-label-font-size));color:var(--luzmo-display-settings-id-label-color,var(--display-settings-id-label-color))}.id-value{-webkit-user-select:text;user-select:text;cursor:text}.example-container{line-height:var(--luzmo-display-settings-example-height,var(--display-settings-example-height));font-size:var(--luzmo-display-settings-example-font-size,var(--display-settings-example-font-size));color:var(--luzmo-display-settings-example-color,var(--display-settings-example-color))}.example-container .example-label{font-weight:var(--luzmo-display-settings-example-label-font-weight,var(--display-settings-example-label-font-weight));color:var(--luzmo-display-settings-example-label-color,var(--display-settings-example-label-color))}.example-container .example-language{text-transform:uppercase;color:var(--luzmo-display-settings-example-language-color,var(--display-settings-example-language-color))}.example-container{gap:var(--luzmo-display-settings-example-container-gap,var(--luzmo-spacing-2))}:host{--display-settings-font-family:var(--luzmo-font-family);--display-settings-id-label-text-transform:uppercase;--display-settings-id-label-color:var(--luzmo-primary);--display-settings-font-size:var(--luzmo-font-size);--display-settings-id-label-font-size:var(--luzmo-font-size-s);--display-settings-gap:var(--luzmo-spacing-3);--display-settings-ids-container-vertical-margin:var(--luzmo-spacing-4);--display-settings-info-to-remove-icon-gap:var(--luzmo-spacing-5);--display-settings-calculation-max-width:20rem}:host([size=s]){--display-settings-id-label-font-size:var(--luzmo-font-size-s);--display-settings-font-size:var(--luzmo-font-size-s);--display-settings-gap:var(--luzmo-spacing-3);--display-settings-ids-container-vertical-margin:var(--luzmo-spacing-3);--display-settings-info-to-remove-icon-gap:var(--luzmo-spacing-4);--display-settings-calculation-max-width:16rem}:host([size=l]){--display-settings-id-label-font-size:var(--luzmo-font-size);--display-settings-font-size:var(--luzmo-font-size-l);--display-settings-gap:var(--luzmo-spacing-4);--display-settings-ids-container-vertical-margin:var(--luzmo-spacing-5);--display-settings-info-to-remove-icon-gap:calc(var(--luzmo-spacing-5) + var(--luzmo-spacing-1));--display-settings-calculation-max-width:24rem}:host([size=xl]){--display-settings-id-label-font-size:var(--luzmo-font-size-l);--display-settings-font-size:var(--luzmo-font-size-xl);--display-settings-gap:var(--luzmo-spacing-5);--display-settings-ids-container-vertical-margin:calc(var(--luzmo-spacing-5) + var(--luzmo-spacing-1));--display-settings-info-to-remove-icon-gap:calc(var(--luzmo-spacing-5) + var(--luzmo-spacing-2));--display-settings-calculation-max-width:28rem}:host{--display-settings-example-font-size:var(--luzmo-font-size);--display-settings-example-color:var(--luzmo-font-color);--display-settings-example-label-font-weight:bold;--display-settings-example-label-color:var(--luzmo-primary);--display-settings-example-language-color:var(--luzmo-primary);--display-settings-example-height:var(--luzmo-component-height)}:host([size=s]){--display-settings-example-height:var(--luzmo-component-height-s);--display-settings-example-font-size:var(--luzmo-font-size-s)}:host([size=l]){--display-settings-example-height:var(--luzmo-component-height-l);--display-settings-example-font-size:var(--luzmo-font-size)}:host([size=xl]){--display-settings-example-height:var(--luzmo-component-height-xl);--display-settings-example-font-size:var(--luzmo-font-size-l)}`,J=class extends Et(x(S,{validSizes:Object.values(oe)})){constructor(...e){super(...e),this._loadDisplaySettings=new C(this,{task:async([e,t,n,r,i,a])=>{let o=[];a&&o.push(`grandTotals`),n&&o.push(`periodOverPeriod`),(e===`numeric`||e===`mixed`&&this._currentSlotContent?.type===`numeric`)&&o.push(`numeric`),e!==`numeric`&&this._currentSlotContent?.type===`datetime`&&o.push(`datetime`),![`numeric`,`mixed`].includes(e??``)&&this._currentSlotContent?.type===`numeric`&&!r&&o.push(`binning`),n&&!this._settingsTypeLoaded.periodOverPeriod&&(await import(`./display-settings-period-over-period-Bwjoji3a.js`),this._settingsTypeLoaded.periodOverPeriod=!0),o.length>0&&!t&&(o.includes(`numeric`)&&!this._settingsTypeLoaded.numeric?(await import(`./display-settings-numeric-D04OO7n9.js`),this._settingsTypeLoaded.numeric=!0):o.includes(`datetime`)&&!this._settingsTypeLoaded.datetime&&i?(await import(`./display-settings-datetime-CdxMI-9Q.js`),this._settingsTypeLoaded.datetime=!0):o.includes(`binning`)&&!this._settingsTypeLoaded.binning?(await import(`./display-settings-binning-CTWsdo0F.js`),this._settingsTypeLoaded.binning=!0):o.includes(`grandTotals`)&&!this._settingsTypeLoaded.grandTotals&&(await import(`./display-settings-grand-totals-BCW8hefp.js`),this._settingsTypeLoaded.grandTotals=!0))},args:()=>[this.slotType,this.hideDisplaySettings,this._store?.periodOverPeriodUiType.get(),this.isBinningDisabled,this.areDatetimeOptionsEnabled,this.areGrandTotalsEnabled,this.slotContent]}),this.language=`en`,this.contentLanguage=`en`,this.slotType=`numeric`,this.slotName=`measure`,this.slotContent={},this.datasetsDataFields=[],this.apiUrl=`https://api.luzmo.com`,this.authKey=``,this.authToken=``,this._showIds=!1,this.measureColumns=[],this._settingsTypeLoaded={binning:!1,datetime:!1,numeric:!1,grandTotals:!1,periodOverPeriod:!1,hierarchy:!0},this._currentSlotContent={}}static get styles(){return[N(Jt)]}_datasetDatetimeColumns(){return this._store?.linkedDataset.get().flatMap(e=>e.columns?.filter(e=>e.type===`datetime`).map(t=>({...t,datasetId:e.id})))}willUpdate(e){let t=this._store?.activeSlotContents.get(),n=this._store?.periodOverPeriodUiType.get();if(this.periodOverPeriodUiType!==n&&(this.periodOverPeriodUiType=n),this._store){t!==this._lastStoreContent&&(this._lastStoreContent=t,this._currentSlotContent=t?structuredClone(t):{});return}if(e.has(`slotContent`)||Object.keys(this._currentSlotContent).length===0){let e=this.slotContent;e&&(this._currentSlotContent=structuredClone(e))}}get datasetId(){return this._currentSlotContent.datasetId??this._currentSlotContent.set}get formulaOrColumnId(){return this._currentSlotContent.formulaId??this._currentSlotContent.expression??this._currentSlotContent.formula??this._currentSlotContent.columnId??this._currentSlotContent.column}resetInfoVisibility(e){this._showIds&&this._toggleIds(e)}_onSlotContentChange(e){e.stopPropagation(),e.preventDefault(),this._currentSlotContent=structuredClone(e.detail.slotContent),this._sendEvent(),this.requestUpdate()}_onLabelChange(){this._currentSlotContent=structuredClone(this._currentSlotContent),this._currentSlotContent.label=this._multiLanguageFieldElement.value||{},this._sendEvent(),this.requestUpdate()}_sendEvent(){this.dispatchEvent(new CustomEvent(`luzmo-slot-content-changed`,{bubbles:!0,composed:!0,cancelable:!0,detail:{slotContent:{...this._currentSlotContent}}})),this._store&&(this._store.updateContent({...this._currentSlotContent}),this._lastStoreContent=this._store.activeSlotContents.get())}_removeEvent(){this.dispatchEvent(new CustomEvent(`luzmo-remove-slot-content`,{bubbles:!0,composed:!0,cancelable:!0,detail:{slotContent:this._currentSlotContent}}))}_toggleIds(e=!0){this._showIds=!this._showIds,e&&this.dispatchEvent(new CustomEvent(`luzmo-info-visibility-changed`,{detail:{isVisible:this._showIds,slotContent:{...this._currentSlotContent}}}))}_renderExampleRow(){let e=this.slotType===`numeric`||this.slotType===`mixed`&&this._currentSlotContent.type===`numeric`,t=this.slotType!==`datetime`&&this._currentSlotContent.type===`datetime`&&this.areDatetimeOptionsEnabled;if(!(e||t))return A;let n=!this._currentSlotContent.datetimeDisplayMode||this._currentSlotContent.datetimeDisplayMode==="default",r=e?1234.56:n?new Date:1,i=ce({...this._currentSlotContent,type:e?`numeric`:`datetime`},{locale:this.contentLanguage,level:this._currentSlotContent.level})(r);return O`<div class="settings-row example-container">
31
- <span class="example-label"
32
- >${v(`Example`,{desc:`Label for example`})}:</span
33
- >
34
- <span class="example">${i}</span>
35
- </div>`}_renderDisplaySettings(){let e={name:this.slotName,type:this.slotType},t=K(this._currentSlotContent,e)?Mt(this._currentSlotContent):void 0,n=At(this._currentSlotContent)?v(`Formula`,{desc:`Label for the formula type`}):v(`Expression`,{desc:`Label for the expression type`}),r=this._currentSlotContent.datasetId??this._currentSlotContent.set;return O`<div class="settings-container">
36
- <div class="settings-row">
37
- <div class="setting">
38
- <div class="label-container">
39
- <luzmo-field-label side-aligned="start" .size=${this.size}
40
- >Label:</luzmo-field-label
41
- >
42
- <luzmo-multi-language-field
43
- label="Label"
44
- .language=${this.contentLanguage}
45
- .value=${this._currentSlotContent.label??{}}
46
- .size=${this.size}
47
- debounce="200"
48
- @change=${this._onLabelChange}
49
- ></luzmo-multi-language-field>
50
- </div>
51
- <div class="label-action-container">
52
- <luzmo-action-button quiet .size=${this.size} .label=${v(`Show dataset and column IDs`,{desc:`Show IDs button label`})} aria-expanded=${this._showIds} @click=${this._toggleIds}>
53
- ${b(Ce)}
54
- <luzmo-tooltip self-managed placement="top" size=${this.size}>
55
- ${v(`Show dataset and column IDs`,{desc:`Show IDs button label`})}
56
- </luzmo-tooltip>
57
- </luzmo-action-button>
58
- ${this.showRemoveButton?O`<luzmo-action-button quiet .size=${this.size} .label=${v(`Remove`,{desc:`Remove button label`})} @click=${this._removeEvent}>
59
- ${b(te)}
60
- <luzmo-tooltip
61
- self-managed
62
- placement="top"
63
- size=${this.size}
64
- >
65
- ${v(`Remove`,{desc:`Remove button label`})}
66
- </luzmo-tooltip>
67
- </luzmo-action-button>`:``}
68
- </div>
69
- </div>
70
- </div>
71
- ${t?O`<div class="settings-row">
72
- <div class="setting">
73
- <div class="label-container calculation-preview">
74
- <luzmo-field-label side-aligned="start" .size=${this.size}
75
- >${n}:</luzmo-field-label
76
- >
77
- <luzmo-formula
78
- display="text"
79
- .expression=${t}
80
- .datasetsDataFields=${this.datasetsDataFields}
81
- .datasetIds=${r?[r]:[]}
82
- .apiUrl=${this.apiUrl}
83
- .authKey=${this.authKey}
84
- .authToken=${this.authToken}
85
- .contentLanguage=${this.contentLanguage}
86
- .size=${this.size}
87
- ></luzmo-formula>
88
- </div>
89
- </div>
90
- </div>`:``}
91
- ${this.areGrandTotalsEnabled?O`<luzmo-display-settings-grand-totals
92
- .language=${this.language}
93
- .slotContent=${this._currentSlotContent}
94
- .size=${this.size}
95
- @luzmo-slot-content-changed=${this._onSlotContentChange}
96
- ></luzmo-display-settings-grand-totals>`:``}
97
- ${this.slotType===`numeric`||this.slotType===`mixed`&&this._currentSlotContent.type===`numeric`?O`<luzmo-display-settings-numeric
98
- .language=${this.language}
99
- .slotContent=${this._currentSlotContent}
100
- .size=${this.size}
101
- .measureColumns=${this.measureColumns}
102
- .isAggregationDisabled=${this.isAggregationDisabled}
103
- .isCumulativeSumEnabled=${this.isCumulativeSumEnabled}
104
- @luzmo-slot-content-changed=${this._onSlotContentChange}
105
- ></luzmo-display-settings-numeric>`:``}
106
- ${this.slotType!==`numeric`&&this._currentSlotContent.type===`datetime`&&this.areDatetimeOptionsEnabled?O`<luzmo-display-settings-datetime
107
- .language=${this.language}
108
- .contentLanguage=${this.contentLanguage}
109
- .slotContent=${this._currentSlotContent}
110
- .size=${this.size}
111
- @luzmo-slot-content-changed=${this._onSlotContentChange}
112
- ></luzmo-display-settings-datetime>`:``}
113
- ${![`numeric`,`mixed`].includes(this.slotType??``)&&this._currentSlotContent.type===`numeric`&&!this.isBinningDisabled?O`<luzmo-display-settings-binning
114
- .language=${this.language}
115
- .slotContent=${this._currentSlotContent}
116
- .size=${this.size}
117
- @luzmo-slot-content-changed=${this._onSlotContentChange}
118
- ></luzmo-display-settings-binning>`:``}
119
- ${this.periodOverPeriodUiType?O`<luzmo-display-settings-period-over-period
120
- .language=${this.language}
121
- .slotContent=${this._currentSlotContent}
122
- .size=${this.size}
123
- .periodOverPeriodUiType=${this.periodOverPeriodUiType}
124
- .allowPeriodsWithoutDatetimeColumn=${this._store?.periodOverPeriodAllowsPeriodsWithoutDatetimeColumn.get()??!1}
125
- .hidePastValue=${this._store?.periodOverPeriodHidesPastValue.get()??!1}
126
- .linkedDatasetDatetimeColumns=${this._datasetDatetimeColumns()}
127
- @luzmo-slot-content-changed=${this._onSlotContentChange}
128
- ></luzmo-display-settings-period-over-period>`:``}
129
- ${this._renderExampleRow()}
130
- </div>
131
- ${this._showIds?O` <luzmo-divider></luzmo-divider>
132
- <div class="ids-container">
133
- <div>
134
- <span class="id-label"
135
- >${this._currentSlotContent.formula||this._currentSlotContent.formulaId||this._currentSlotContent.expression?v(`Formula`,{desc:`Label for the formula type`}):v(`Column`,{desc:`Label for column type`})}:
136
- </span>
137
- <span class="id-value">
138
- ${this.formulaOrColumnId}
139
- </span>
140
- </div>
141
- <div>
142
- <span class="id-label">Dataset: </span>
143
- <span class="id-value">
144
- ${this.datasetId}
145
- </span>
146
- </div>
147
- <div></div>
148
- </div>`:``}`}render(){return this._loadDisplaySettings.render({pending:()=>O`<luzmo-progress-circle
149
- indeterminate
150
- .label=${v(`Loading`,{desc:`Loading spinner label`})}
151
- .size=${this.size}
152
- ></luzmo-progress-circle>`,complete:()=>this._renderDisplaySettings(),error:()=>this._renderDisplaySettings()})}disconnectedCallback(){super.disconnectedCallback?.(),this._loadDisplaySettings.abort?.()}};g([j({type:String})],J.prototype,`language`,void 0),g([j({type:String,attribute:`content-language`})],J.prototype,`contentLanguage`,void 0),g([j({type:Boolean,attribute:`hide-display-settings`})],J.prototype,`hideDisplaySettings`,void 0),g([j({type:Boolean})],J.prototype,`isBinningDisabled`,void 0),g([j({type:Boolean})],J.prototype,`areDatetimeOptionsEnabled`,void 0),g([j({type:Boolean})],J.prototype,`areGrandTotalsEnabled`,void 0),g([j({type:Boolean})],J.prototype,`isAggregationDisabled`,void 0),g([j({type:Boolean})],J.prototype,`isCumulativeSumEnabled`,void 0),g([j({type:String})],J.prototype,`periodOverPeriodUiType`,void 0),g([j({type:Boolean,attribute:`show-remove-button`})],J.prototype,`showRemoveButton`,void 0),g([j({type:String,attribute:`slot-type`})],J.prototype,`slotType`,void 0),g([j({type:String,attribute:`slot-name`})],J.prototype,`slotName`,void 0),g([j({type:Object,attribute:!1})],J.prototype,`slotContent`,void 0),g([j({attribute:!1})],J.prototype,`datasetsDataFields`,void 0),g([j({type:String,attribute:`api-url`,reflect:!0})],J.prototype,`apiUrl`,void 0),g([j({type:String,attribute:`auth-key`,reflect:!0})],J.prototype,`authKey`,void 0),g([j({type:String,attribute:`auth-token`,reflect:!0})],J.prototype,`authToken`,void 0),g([M()],J.prototype,`_showIds`,void 0),g([j({type:Array,reflect:!1})],J.prototype,`measureColumns`,void 0),g([me(`luzmo-multi-language-field`)],J.prototype,`_multiLanguageFieldElement`,void 0),g([ze({context:P,subscribe:!0})],J.prototype,`_store`,void 0),customElements.get(`luzmo-display-settings`)||customElements.define(`luzmo-display-settings`,J);function Yt({element:e,handle:t,boundary:n=document.documentElement,onDragStart:r,onDragEnd:i}){if(!e||!t)throw Error(`makeDraggable: element and handle are required`);let a=e.ownerDocument??document,o=-1,s=0,c=0,l=0,u=0,d=0,f=0,ee=0,p=0,m=t=>{if(t.pointerId!==o)return;let r=t.clientX-s,i=t.clientY-c,a=(n??document.documentElement).getBoundingClientRect(),m=l+r,h=u+i;m=Math.min(Math.max(m,a.left),a.right-d),h=Math.min(Math.max(h,a.top),a.bottom-f);let g=m-l,_=h-u,v=ee+g,y=p+_;e.style.transform=`translate3d(${v}px, ${y}px, 0)`},h=e=>{e.pointerId===o&&(a.removeEventListener(`pointermove`,m),a.removeEventListener(`pointerup`,h),o=-1,i?.())},g=n=>{if(n.button!==0)return;o=n.pointerId;let i=e.getBoundingClientRect();l=i.left,u=i.top,d=i.width,f=i.height,s=n.clientX,c=n.clientY;try{let t=a.defaultView?.getComputedStyle(e);if(t){let e=new DOMMatrixReadOnly(t.transform);ee=e.m41,p=e.m42}}catch{ee=0,p=0}t.setPointerCapture(o),a.addEventListener(`pointermove`,m),a.addEventListener(`pointerup`,h),r?.()};return t.addEventListener(`pointerdown`,g),()=>{t.removeEventListener(`pointerdown`,g),a.removeEventListener(`pointermove`,m),a.removeEventListener(`pointerup`,h)}}var Y={none:0,small:100,medium:350,large:700},Xt=.5;Y.none,Y.small*Xt,Y.medium*Xt,Y.large*Xt;function Zt(e){e.animate([{backgroundColor:`var(--ds-background-selected, #E9F2FF)`},{}],{duration:Y.large,easing:`cubic-bezier(0.25, 0.1, 0.25, 1.0)`,iterations:1})}function Qt(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function $t(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]==null?{}:arguments[t];t%2?Qt(Object(r),!0).forEach(function(t){n(e,t,r[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):Qt(Object(r)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))})}return e}var en={top:function(e,t){return Math.abs(t.y-e.top)},right:function(e,t){return Math.abs(e.right-t.x)},bottom:function(e,t){return Math.abs(e.bottom-t.y)},left:function(e,t){return Math.abs(t.x-e.left)}},tn=Symbol(`closestEdge`);function nn(e,t){var r=t.element,i=t.input,a=t.allowedEdges,o={x:i.clientX,y:i.clientY},s=r.getBoundingClientRect(),c=a.map(function(e){return{edge:e,value:en[e](s,o)}}).sort(function(e,t){return e.value-t.value})[0]?.edge??null;return $t($t({},e),{},n({},tn,c))}function rn(e){return e[tn]??null}function an(){return{x:0,y:0}}function on(t){var n=t.render,r=t.nativeSetDragImage,i=t.getOffset,a=i===void 0?an:i,o=document.createElement(`div`);Object.assign(o.style,{position:`fixed`,top:0,left:0,zIndex:h,pointerEvents:`none`}),document.body.append(o);var s=n({container:o});queueMicrotask(function(){var e=a({container:o});if(m()){var t=o.getBoundingClientRect();if(t.width===0)return;o.style.left=`-${t.width-1e-4}px`}r?.(o,e.x,e.y)});function c(){l(),s?.(),document.body.removeChild(o)}var l=e({onDragStart:c,onDrop:c})}var sn=(e,t)=>{let n=getComputedStyle(e).getPropertyValue(t);for(;!n&&e.parentElement;)e=e.parentElement,n=getComputedStyle(e).getPropertyValue(t);return n.trim()},cn=`:host{font-family:var(--luzmo-slot-menu-list-font-family,var(--luzmo-font-family));font-size:var(--luzmo-slot-menu-list-font-size,var(--slot-menu-list-font-size));color:var(--luzmo-slot-menu-list-font-color,var(--luzmo-font-color))}ul{margin:0;padding:0;list-style:none}:host{max-height:var(--luzmo-slot-menu-list-max-height,var(--slot-menu-list-max-height));margin:0;padding:0;list-style:none;overflow-y:auto}:host::-webkit-scrollbar{width:var(--luzmo-slot-menu-list-scrollbar-width,var(--slot-menu-list-scrollbar-width))}:host::-webkit-scrollbar-track{background:var(--luzmo-slot-menu-list-scrollbar-track-background,var(--slot-menu-list-scrollbar-track-background));border-radius:var(--luzmo-slot-menu-list-scrollbar-track-border-radius,var(--slot-menu-list-scrollbar-track-border-radius))}:host::-webkit-scrollbar-thumb{background:var(--luzmo-slot-menu-list-scrollbar-thumb-background,var(--slot-menu-list-scrollbar-thumb-background));border-radius:var(--luzmo-slot-menu-list-scrollbar-thumb-border-radius,var(--slot-menu-list-scrollbar-thumb-border-radius))}:host::-webkit-scrollbar-thumb:hover{background:var(--luzmo-slot-menu-list-scrollbar-thumb-hover-background,var(--slot-menu-list-scrollbar-thumb-hover-background))}:host{scrollbar-width:var(--luzmo-scrollbar-width,thin);scrollbar-color:var(--luzmo-slot-menu-list-scrollbar-thumb-background,var(--slot-menu-list-scrollbar-thumb-background)) var(--luzmo-slot-menu-list-scrollbar-track-background,var(--slot-menu-list-scrollbar-track-background));border-right:var(--luzmo-slot-menu-list-border-right-width,var(--luzmo-border-width)) solid var(--luzmo-slot-menu-list-border-right-color,var(--luzmo-border-color))}:host li{cursor:pointer;position:relative}:host li:hover{background-color:var(--luzmo-slot-menu-list-background-color-hover,var(--slot-menu-list-background-color-hover))}:host li{border-bottom:var(--luzmo-slot-menu-list-border-bottom-width,var(--slot-menu-list-border-bottom-width)) solid var(--luzmo-slot-menu-list-border-bottom-color,var(--slot-menu-list-border-bottom-color))}:host .active{background-color:var(--luzmo-slot-menu-list-active-background-color,var(--slot-menu-list-active-background-color));color:var(--luzmo-slot-menu-list-active-color,var(--slot-menu-list-active-color))}:host .active:hover{background-color:var(--luzmo-slot-menu-list-active-background-color-hover,var(--slot-menu-list-active-background-color-hover))}:host .active .draggable-slot-content:focus-visible{background-color:var(--luzmo-slot-menu-list-active-background-color-hover,var(--slot-menu-list-active-background-color-hover));outline:none}:host .active .draggable-slot-content-remove:focus-visible{outline-color:var(--luzmo-slot-menu-list-active-color,var(--slot-menu-list-active-color));background-color:var(--luzmo-slot-menu-list-active-background-color-hover,var(--slot-menu-list-active-background-color-hover))}.calculation-label{align-items:center;gap:var(--luzmo-spacing-3);display:inline-flex}.calculation-label-icon{flex:none;display:inline-flex}.drop-indicator{height:var(--luzmo-slot-menu-list-drop-indicator-height,var(--slot-menu-list-drop-indicator-height));background-color:var(--luzmo-slot-menu-list-drop-indicator-color,var(--slot-menu-list-drop-indicator-color));position:absolute;left:0;right:0}.drop-indicator:before{content:"";border:var(--luzmo-slot-menu-list-drop-indicator-height,var(--slot-menu-list-drop-indicator-height)) solid var(--luzmo-slot-menu-list-drop-indicator-color,var(--slot-menu-list-drop-indicator-color));background:var(--luzmo-slot-menu-list-drop-indicator-background,var(--luzmo-background-color));width:100%;left:calc(-.5 * (var(--luzmo-slot-menu-list-drop-indicator-circle-size,var(--slot-menu-list-drop-indicator-circle-size)) + var(--luzmo-slot-menu-list-drop-indicator-height,var(--slot-menu-list-drop-indicator-height))));top:calc(-.5 * (var(--luzmo-slot-menu-list-drop-indicator-circle-size,var(--slot-menu-list-drop-indicator-circle-size)) + var(--luzmo-slot-menu-list-drop-indicator-height,var(--slot-menu-list-drop-indicator-height))));height:var(--luzmo-slot-menu-list-drop-indicator-circle-size,var(--slot-menu-list-drop-indicator-circle-size));width:var(--luzmo-slot-menu-list-drop-indicator-circle-size,var(--slot-menu-list-drop-indicator-circle-size));border-radius:50%;display:block;position:absolute}.drop-indicator[data-edge=top]{top:calc(-.5 * var(--luzmo-slot-menu-list-drop-indicator-height,var(--slot-menu-list-drop-indicator-height)))}.drop-indicator[data-edge=bottom]{bottom:calc(-.5 * var(--luzmo-slot-menu-list-drop-indicator-height,var(--slot-menu-list-drop-indicator-height)))}.draggable-slot-content{justify-content:space-between;gap:var(--luzmo-slot-menu-label-to-icon-gap,var(--slot-menu-label-to-icon-gap));touch-action:none;cursor:pointer;align-items:center;display:flex}.draggable-slot-content:focus-visible{background-color:color-mix(in srgb, var(--luzmo-primary) 20%, transparent);outline:none}.draggable-slot-content .draggable-slot-content-label{padding-block:var(--luzmo-slot-menu-list-item-vertical-padding,var(--slot-menu-list-item-vertical-padding));text-overflow:ellipsis;white-space:nowrap;font:inherit;color:inherit;cursor:inherit;text-align:start;background:0 0;border:none;flex:auto;padding-inline-start:var(--luzmo-slot-menu-list-item-horizontal-padding,var(--slot-menu-list-item-horizontal-padding));overflow:hidden}.draggable-slot-content .draggable-slot-content-remove{padding:var(--luzmo-spacing-1);font:inherit;color:inherit;cursor:inherit;border-radius:var(--luzmo-border-radius);background:0 0;border:none;flex:none;justify-content:center;align-items:center;margin-inline-end:var(--luzmo-slot-menu-list-item-horizontal-padding,var(--slot-menu-list-item-horizontal-padding));display:flex}.draggable-slot-content .draggable-slot-content-remove:focus-visible{outline:var(--luzmo-indicator-width) solid var(--luzmo-indicator-color);outline-offset:1px}:host{--slot-menu-list-active-background-color:var(--luzmo-primary);--slot-menu-list-active-background-color-hover:var(--luzmo-primary-hover);--slot-menu-list-active-color:var(--luzmo-primary-inverse-color);--slot-menu-list-background-color-hover:var(--luzmo-background-color-hover);--slot-menu-list-drop-indicator-color:var(--luzmo-font-color-down);--slot-menu-list-drop-indicator-height:2px;--slot-menu-list-drop-indicator-circle-size:4px;--slot-menu-list-border-bottom-width:0px;--slot-menu-list-border-bottom-color:transparent;--slot-menu-list-max-height:calc(var(--luzmo-component-height) * 4);--slot-menu-list-scrollbar-width:var(--luzmo-scrollbar-size);--slot-menu-list-scrollbar-track-background:var(--luzmo-scrollbar-track-background);--slot-menu-list-scrollbar-track-border-radius:var(--luzmo-scrollbar-track-border-radius);--slot-menu-list-scrollbar-thumb-background:var(--luzmo-scrollbar-thumb-background);--slot-menu-list-scrollbar-thumb-border-radius:var(--luzmo-scrollbar-thumb-border-radius);--slot-menu-list-scrollbar-thumb-hover-background:var(--luzmo-scrollbar-thumb-hover-background);--slot-menu-display-settings-min-width:19rem;--slot-menu-min-height:calc(var(--luzmo-component-height) * 2);--slot-menu-font-size:var(--luzmo-font-size);--slot-menu-list-item-horizontal-padding:var(--luzmo-spacing-4);--slot-menu-list-item-vertical-padding:var(--luzmo-spacing-3);--slot-menu-label-to-icon-gap:var(--luzmo-spacing-3)}:host([size=s]){--slot-menu-display-settings-min-width:16rem;--slot-menu-min-height:calc(var(--luzmo-component-height-s) * 2);--slot-menu-font-size:var(--luzmo-font-size-s);--slot-menu-list-item-horizontal-padding:var(--luzmo-spacing-3);--slot-menu-list-item-vertical-padding:var(--luzmo-spacing-3);--slot-menu-label-to-icon-gap:var(--luzmo-spacing-2)}:host([size=l]){--slot-menu-display-settings-min-width:23rem;--slot-menu-min-height:calc(var(--luzmo-component-height-l) * 2);--slot-menu-font-size:var(--luzmo-font-size-l);--slot-menu-list-item-horizontal-padding:var(--luzmo-spacing-5);--slot-menu-list-item-vertical-padding:var(--luzmo-spacing-3);--slot-menu-label-to-icon-gap:var(--luzmo-spacing-4)}:host([size=xl]){--slot-menu-display-settings-min-width:26rem;--slot-menu-min-height:calc(var(--luzmo-component-height-xl) * 2);--slot-menu-font-size:var(--luzmo-font-size-xl);--slot-menu-list-item-horizontal-padding:var(--luzmo-spacing-5);--slot-menu-list-item-vertical-padding:var(--luzmo-spacing-4);--slot-menu-label-to-icon-gap:var(--luzmo-spacing-5)}`,X=class extends x(S,{validSizes:Object.values(oe)}){constructor(...e){super(...e),this.language=`en`,this.contentLanguage=`en`,this.slotContents=[],this.slotName=`measure`,this.slotType=`numeric`,this.activeIndex=0,this._sendChangeEvent=()=>{this.dispatchEvent(new CustomEvent(`luzmo-slot-list-changed`,{bubbles:!0,composed:!0,cancelable:!0,detail:{slotContents:structuredClone(this.slotContents),activeIndex:this.activeIndex}}))},this._cleanupFns=[],this._attachAll=()=>{[...this._draggableSlotContentElements].forEach(e=>{let t=this._sendChangeEvent.bind(this),n=this,r=o({element:e,onGenerateDragPreview({nativeSetDragImage:t}){on({nativeSetDragImage:t,render({container:t}){let n=document.createElement(`div`);n.classList.add(`drag-preview`);let r={};[[`borderColor`,`--luzmo-slot-menu-list-border-color`,`--luzmo-border-color`],[`backgroundColor`,`--luzmo-slot-menu-list-background-color`,`--luzmo-background-color`],[`color`,`--luzmo-slot-menu-list-font-color`,`--slot-menu-list-font-color`],[`fontSize`,`--luzmo-slot-menu-list-font-size`,`--slot-menu-list-font-size`],[`horizontalPadding`,`--luzmo-slot-menu-list-item-horizontal-padding`,`--slot-menu-list-item-horizontal-padding`],[`verticalPadding`,`--luzmo-slot-menu-list-item-vertical-padding`,`--slot-menu-list-item-vertical-padding`],[`borderRadius`,`--luzmo-slot-menu-list-border-radius`,`--luzmo-border-radius`],[`fontFamily`,`--luzmo-slot-menu-list-font-family`,`--luzmo-font-family`]].forEach(([t,n,i])=>{let a=sn(e,n)||sn(e,i);r[t]=a}),n.textContent=e.querySelector(`[data-task-content]`)?.textContent||e.dataset.taskLabel||e.textContent,Object.assign(n.style,{border:`1px solid ${r.borderColor}`,backgroundColor:r.backgroundColor,borderRadius:r.borderRadius,fontFamily:r.fontFamily,fontSize:r.fontSize,color:r.color,paddingInline:`${r.horizontalPadding}`,paddingBlock:`${r.verticalPadding}`}),t.append(n)}})},getInitialData(){let t=e.parentElement,n=0;return t&&(n=[...t.parentElement?.children??[]].indexOf(t)),{index:n}},onDragStart(){e.style.opacity=`0.5`},onDrop(){e.style.opacity=`1`}});this._cleanupFns.push(r);let i=a({element:e,canDrop({source:t}){return t.element!==e&&t?.element?.classList.contains(`draggable-slot-content`)},getData(t){return nn({},{element:e,input:t.input,allowedEdges:[`top`,`bottom`]})},getIsSticky(){return!0},onDragEnter({self:t}){let n=rn(t.data);if(!n)return;let r=document.createElement(`div`);r.classList.add(`drop-indicator`),r.dataset.edge=n,e.after(r)},onDrag({self:t}){let n=rn(t.data);if(!n){e.nextElementSibling?.remove();return}if(e.nextElementSibling?.getAttribute(`data-edge`)===n)return;e.nextElementSibling?.remove();let r=document.createElement(`div`);r.classList.add(`drop-indicator`),r.dataset.edge=n,e.after(r)},onDragLeave(){e.nextElementSibling?.remove()},onDrop({self:r,source:i}){e.nextElementSibling?.remove();let a=rn(r.data),o=r.element.parentElement;if(typeof i.data.index==`number`&&o){let e=[...o.parentElement?.children??[]].indexOf(o);a===`bottom`&&i.data.index>=e&&e<(o?.parentElement?.children?.length??0)-1?e+=1:a===`top`&&e>i.data.index&&--e;let t=n.activeIndex,r=i.data.index,s=e,c=n.slotContents[r];n.slotContents.splice(r,1),n.slotContents.splice(s,0,c),r===t?n.activeIndex=s:r<t&&s>=t?n.activeIndex=t-1:r>t&&s<=t&&(n.activeIndex=t+1)}a&&(Zt(i.element),n.requestUpdate(),t())}});this._cleanupFns.push(i)})},this._detachAll=()=>{this._cleanupFns.forEach(e=>e()),this._cleanupFns=[]}}static get styles(){return[N(cn)]}willUpdate(){this._detachAll()}updated(){this._attachAll()}disconnectedCallback(){super.disconnectedCallback(),this._detachAll()}setActiveIndex(e){this.activeIndex=e,this._sendChangeEvent()}removeSlotContent(e){this.slotContents=this.slotContents.filter((t,n)=>n!==e),this.activeIndex=this.slotContents.length===0?0:Math.min(this.activeIndex,this.slotContents.length-1),this._sendChangeEvent()}_moveItem(e,t){let n=this.slotContents[e],r=[...this.slotContents];r.splice(e,1),r.splice(t,0,n),this.slotContents=r,this.activeIndex===e?this.activeIndex=t:e<this.activeIndex&&t>=this.activeIndex?--this.activeIndex:e>this.activeIndex&&t<=this.activeIndex&&(this.activeIndex+=1),this._sendChangeEvent(),this.updateComplete.then(()=>this._draggableSlotContentElements[t]?.focus())}_handleContentKeydown(e,t){switch(t.key){case` `:case`Enter`:t.preventDefault(),this.setActiveIndex(e);break;case`ArrowUp`:t.preventDefault(),t.altKey&&e>0?this._moveItem(e,e-1):!t.altKey&&e>0&&this._draggableSlotContentElements[e-1]?.focus();break;case`ArrowDown`:t.preventDefault(),t.altKey&&e<this.slotContents.length-1?this._moveItem(e,e+1):!t.altKey&&e<this.slotContents.length-1&&this._draggableSlotContentElements[e+1]?.focus();break}}_handleTrashClick(e,t){t.stopPropagation(),this.removeSlotContent(e)}_handleTrashKeydown(e){(e.key===` `||e.key===`Enter`)&&e.stopPropagation()}render(){let e={name:this.slotName,type:this.slotType},t=this.slotContents.map((t,n)=>{let r=T(t.label??{},this.contentLanguage)??v(`Untitled`,{desc:`Fallback label for a slot content without a name`}),i=K(t,e)?Mt(t):void 0,a=n===this.activeIndex;return O`<li class=${a?`active`:``}>
153
- <div class="draggable-slot-content"
154
- data-task-label=${i??r}
155
- tabindex="0"
156
- role="option"
157
- aria-selected=${a?`true`:`false`}
158
- @click=${this.setActiveIndex.bind(this,n)}
159
- @keydown=${this._handleContentKeydown.bind(this,n)}
160
- >
161
- <span class="draggable-slot-content-label" data-task-content>
162
- ${i?Pt(t):r}
163
- </span>
164
- <button
165
- class="draggable-slot-content-remove"
166
- aria-label=${v(`Remove`,{desc:`Remove button label`})}
167
- @click=${this._handleTrashClick.bind(this,n)}
168
- @keydown=${this._handleTrashKeydown}
169
- >
170
- ${b(te)}
171
- </button>
172
- </div>
173
- </li>`});return O`<ul role="listbox" aria-label=${v(`Slot contents`,{desc:`Accessible label for slot menu content list`})}>${t}</ul>`}};g([j({type:String,reflect:!0})],X.prototype,`language`,void 0),g([j({type:String,attribute:`content-language`,reflect:!0})],X.prototype,`contentLanguage`,void 0),g([he(`.draggable-slot-content`)],X.prototype,`_draggableSlotContentElements`,void 0),g([j({type:Array})],X.prototype,`slotContents`,void 0),g([j({type:String,attribute:`slot-name`,reflect:!0})],X.prototype,`slotName`,void 0),g([j({type:String,attribute:`slot-type`,reflect:!0})],X.prototype,`slotType`,void 0),g([j({type:Number})],X.prototype,`activeIndex`,void 0),customElements.get(`luzmo-slot-menu-list`)||customElements.define(`luzmo-slot-menu-list`,X);var ln=`:host{font-family:var(--luzmo-slot-menu-font-family,var(--luzmo-font-family));font-size:var(--luzmo-slot-menu-font-size,var(--slot-menu-font-size));color:var(--luzmo-slot-menu-font-color,var(--luzmo-font-color));width:fit-content;display:block}luzmo-slot-menu-list{min-width:var(--luzmo-slot-menu-list-min-width,var(--slot-menu-list-min-width));max-width:var(--luzmo-slot-menu-list-max-width,var(--slot-menu-list-max-width));background-color:var(--luzmo-slot-menu-list-background-color,var(--slot-menu-list-background-color));border-bottom-left-radius:var(--luzmo-slot-menu-list-border-radius,var(--slot-menu-list-border-radius))}.slot-contents-container{border:var(--luzmo-slot-menu-border-width,var(--luzmo-border-width)) solid var(--luzmo-slot-menu-border-color,var(--luzmo-border-color));border-radius:var(--luzmo-slot-menu-border-radius,var(--luzmo-border-radius));background:var(--luzmo-slot-menu-background-color,var(--luzmo-background-color));--slot-menu-popup-filter:drop-shadow(var(--luzmo-slot-menu-popup-shadow-horizontal,var(--slot-menu-popup-shadow-horizontal)) var(--luzmo-slot-menu-popup-shadow-vertical,var(--slot-menu-popup-shadow-vertical)) var(--luzmo-slot-menu-popup-shadow-blur,var(--slot-menu-popup-shadow-blur)) var(--luzmo-slot-menu-popup-shadow-color,var(--slot-menu-popup-shadow-color)));filter:var(--luzmo-slot-menu-popup-filter,var(--slot-menu-popup-filter));border-top-left-radius:0;position:relative}.slot-contents-container .inner-container{align-items:stretch;display:flex}.slot-contents-container .inner-container luzmo-display-settings{min-width:var(--luzmo-slot-menu-display-settings-min-width,var(--slot-menu-display-settings-min-width));padding:var(--luzmo-slot-menu-display-settings-vertical-padding,var(--slot-menu-display-settings-vertical-padding)) var(--luzmo-slot-menu-display-settings-horizontal-padding,var(--slot-menu-display-settings-horizontal-padding))}.slot-contents-container:has(>.close) .inner-container luzmo-display-settings{padding-block-start:var(--luzmo-slot-menu-close-button-clearance,var(--slot-menu-close-button-clearance))}:host([variant=popup]) .slot-contents-container{border-top-left-radius:var(--luzmo-slot-menu-border-radius,var(--luzmo-border-radius));overflow:hidden}.slot-menu-top-menu{border-radius:var(--luzmo-slot-menu-border-radius,var(--luzmo-border-radius));z-index:1;width:fit-content;margin-bottom:calc(-1 * var(--luzmo-slot-menu-border-width,var(--luzmo-border-width)));border-bottom-right-radius:0;border-bottom-left-radius:0;align-items:center;display:flex;position:relative;overflow:hidden}.drag-handle{background-color:var(--luzmo-slot-menu-drag-handle-background-color,var(--luzmo-background-color-highlight));cursor:move;border:var(--luzmo-slot-menu-drag-handle-border-width,var(--slot-menu-drag-handle-border-width)) solid var(--luzmo-slot-menu-border-color,var(--luzmo-background-color-highlight));width:fit-content;font-size:var(--luzmo-slot-menu-drag-handle-size,var(--slot-menu-drag-handle-size));padding:var(--luzmo-slot-menu-drag-handle-vertical-padding,var(--slot-menu-drag-handle-vertical-padding)) var(--luzmo-slot-menu-drag-handle-horizontal-padding,var(--slot-menu-drag-handle-horizontal-padding));border-bottom:none}.drag-handle:hover{background-color:var(--luzmo-slot-menu-drag-handle-background-color-hover,var(--luzmo-background-color-highlight-hover))}.drag-handle:focus-visible{box-shadow:0 0 0 var(--luzmo-indicator-width) var(--luzmo-indicator-color)}.slot-content-action{max-width:var(--luzmo-slot-menu-top-menu-label-max-width,var(--slot-menu-top-menu-label-max-width));gap:var(--luzmo-slot-menu-label-to-icon-gap,var(--slot-menu-label-to-icon-gap));background-color:var(--luzmo-slot-menu-content-label-background-color,var(--luzmo-primary));color:var(--luzmo-slot-menu-content-label-color,var(--luzmo-primary-inverse-color));border:var(--luzmo-slot-menu-border-width,var(--luzmo-border-width)) solid var(--luzmo-slot-menu-content-label-border-color,var(--luzmo-primary));padding:var(--luzmo-slot-menu-drag-handle-vertical-padding,var(--slot-menu-drag-handle-vertical-padding)) var(--luzmo-slot-menu-drag-handle-horizontal-padding,var(--slot-menu-drag-handle-horizontal-padding));border-bottom:none;flex:0 auto;display:flex}.slot-content-action:hover{background-color:var(--luzmo-slot-menu-content-label-background-color-hover,var(--luzmo-primary-hover))}.slot-content-action:focus{background-color:var(--luzmo-slot-menu-content-label-background-color-focus,var(--luzmo-primary-focus))}.slot-content-action .slot-content-label{white-space:nowrap;text-overflow:ellipsis;flex:auto;overflow:hidden}.slot-content-action .slot-content-remove{cursor:pointer;border-radius:var(--luzmo-slot-menu-border-radius,var(--luzmo-border-radius));font:inherit;color:inherit;background:0 0;border:none;flex:none;padding:0}.slot-content-action .slot-content-remove:focus-visible{background-color:var(--luzmo-slot-menu-content-label-background-color-focus,var(--luzmo-primary-focus));box-shadow:0 0 0 var(--luzmo-indicator-width) var(--luzmo-slot-menu-content-label-color,var(--luzmo-primary-inverse-color));outline:none}.calculation-label{align-items:center;gap:var(--luzmo-spacing-3);display:inline-flex}.calculation-label-icon{flex:none;display:inline-flex}.close{font:inherit;color:inherit;right:var(--luzmo-slot-menu-close-icon-right,var(--slot-menu-close-icon-right));cursor:pointer;top:calc(-2 * var(--luzmo-slot-menu-border-width,var(--luzmo-border-width)));background:0 0;background-color:var(--luzmo-slot-menu-close-button-background-color,var(--luzmo-background-color-highlight));font-size:var(--luzmo-slot-menu-close-button-size,var(--slot-menu-close-button-size));border:none;border:var(--luzmo-slot-menu-border-width,var(--luzmo-border-width)) solid var(--luzmo-slot-menu-border-color,var(--luzmo-border-color));border-radius:var(--luzmo-slot-menu-border-radius,var(--luzmo-border-radius));padding:0;padding:var(--luzmo-slot-menu-close-button-vertical-padding,var(--slot-menu-close-button-vertical-padding)) var(--luzmo-slot-menu-close-button-horizontal-padding,var(--slot-menu-close-button-horizontal-padding));border-top-left-radius:0;border-top-right-radius:0;position:absolute}.close:hover{background-color:var(--luzmo-slot-menu-close-button-background-color-hover,var(--luzmo-background-color-highlight-hover))}.close:focus-visible{border-color:var(--luzmo-indicator-color);outline:none}:host{--slot-menu-display-settings-min-width:19rem;--slot-menu-min-height:calc(var(--luzmo-component-height) * 2);--slot-menu-font-size:var(--luzmo-font-size);--slot-menu-display-settings-horizontal-padding:var(--luzmo-spacing-5);--slot-menu-display-settings-vertical-padding:var(--luzmo-spacing-4);--slot-menu-top-menu-label-max-width:12rem;--slot-menu-list-min-width:8rem;--slot-menu-list-max-width:12rem;--slot-menu-label-to-icon-gap:var(--luzmo-spacing-3);--slot-menu-drag-handle-size:var(--luzmo-font-size);--slot-menu-drag-handle-vertical-padding:var(--luzmo-spacing-2);--slot-menu-drag-handle-horizontal-padding:var(--luzmo-spacing-3);--slot-menu-drag-handle-border-width:var(--luzmo-border-width);--slot-menu-close-button-size:var(--luzmo-font-size-s);--slot-menu-close-button-vertical-padding:var(--luzmo-spacing-2);--slot-menu-close-button-horizontal-padding:calc(var(--luzmo-spacing-2) + var(--luzmo-spacing-1));--slot-menu-close-button-clearance:calc(var(--luzmo-slot-menu-close-button-size,var(--slot-menu-close-button-size)) + 2 * var(--luzmo-slot-menu-close-button-vertical-padding,var(--slot-menu-close-button-vertical-padding)) + 2 * var(--luzmo-slot-menu-border-width,var(--luzmo-border-width)) + var(--luzmo-spacing-2));--slot-menu-popup-shadow-horizontal:0;--slot-menu-popup-shadow-vertical:1px;--slot-menu-popup-shadow-blur:4px;--slot-menu-popup-shadow-color:var(--luzmo-border-color);--slot-menu-popup-box-shadow:var(--slot-menu-popup-shadow-horizontal) var(--slot-menu-popup-shadow-vertical) var(--slot-menu-popup-shadow-blur) var(--slot-menu-popup-shadow-color);--slot-menu-close-icon-right:1rem;--slot-menu-list-border-radius:var(--luzmo-border-radius)}:host([size=s]){--slot-menu-display-settings-min-width:16rem;--slot-menu-min-height:calc(var(--luzmo-component-height-s) * 2);--slot-menu-font-size:var(--luzmo-font-size-s);--slot-menu-display-settings-horizontal-padding:var(--luzmo-spacing-4);--slot-menu-display-settings-vertical-padding:var(--luzmo-spacing-3);--slot-menu-top-menu-label-max-width:10rem;--slot-menu-list-min-width:6rem;--slot-menu-list-max-width:10rem;--slot-menu-label-to-icon-gap:var(--luzmo-spacing-2);--slot-menu-drag-handle-size:var(--luzmo-font-size-s);--slot-menu-drag-handle-vertical-padding:var(--luzmo-spacing-2);--slot-menu-drag-handle-horizontal-padding:var(--luzmo-spacing-3);--slot-menu-close-button-size:var(--luzmo-font-size-xs);--slot-menu-close-button-vertical-padding:var(--luzmo-spacing-2);--slot-menu-close-button-horizontal-padding:calc(var(--luzmo-spacing-2) + var(--luzmo-spacing-1))}:host([size=l]){--slot-menu-display-settings-min-width:23rem;--slot-menu-min-height:calc(var(--luzmo-component-height-l) * 2);--slot-menu-font-size:var(--luzmo-font-size-l);--slot-menu-display-settings-horizontal-padding:calc(var(--luzmo-spacing-5) + var(--luzmo-spacing-1));--slot-menu-display-settings-vertical-padding:var(--luzmo-spacing-5);--slot-menu-top-menu-label-max-width:14rem;--slot-menu-list-min-width:9rem;--slot-menu-list-max-width:14rem;--slot-menu-label-to-icon-gap:var(--luzmo-spacing-4);--slot-menu-drag-handle-size:var(--luzmo-font-size-l);--slot-menu-drag-handle-vertical-padding:var(--luzmo-spacing-3);--slot-menu-drag-handle-horizontal-padding:var(--luzmo-spacing-3);--slot-menu-close-button-size:var(--luzmo-font-size);--slot-menu-close-button-vertical-padding:calc(var(--luzmo-spacing-2) + var(--luzmo-spacing-1));--slot-menu-close-button-horizontal-padding:var(--luzmo-spacing-3)}:host([size=xl]){--slot-menu-display-settings-min-width:26rem;--slot-menu-min-height:calc(var(--luzmo-component-height-xl) * 2);--slot-menu-font-size:var(--luzmo-font-size-xl);--slot-menu-display-settings-horizontal-padding:calc(var(--luzmo-spacing-5) + var(--luzmo-spacing-2));--slot-menu-display-settings-vertical-padding:var(--luzmo-spacing-5);--slot-menu-top-menu-label-max-width:16rem;--slot-menu-list-min-width:10rem;--slot-menu-list-max-width:16rem;--slot-menu-label-to-icon-gap:var(--luzmo-spacing-5);--slot-menu-drag-handle-size:var(--luzmo-font-size-xl);--slot-menu-drag-handle-vertical-padding:var(--luzmo-spacing-3);--slot-menu-drag-handle-horizontal-padding:var(--luzmo-spacing-4);--slot-menu-close-button-size:var(--luzmo-font-size-l);--slot-menu-close-button-vertical-padding:var(--luzmo-spacing-3);--slot-menu-close-button-horizontal-padding:var(--luzmo-spacing-3)}`,Z=class extends Et(x(S,{validSizes:Object.values(oe)})){constructor(...e){super(...e),this.language=`en`,this.contentLanguage=`en`,this.slotType=`numeric`,this.variant=`draggable`,this._periodOverPeriodUiType=null,this.measureColumns=[],this.apiUrl=`https://api.luzmo.com`,this.authKey=``,this.authToken=``,this.datasetsDataFields=[],this._slotContents=[],this._activeIndex=this.slotIndex??0,this._linkedDatasetsIds=[]}static get styles(){return[N(ln)]}get _store(){return this._consumedStore?this._consumedStore:(this._ownStore||(this._ownStore=new Ot,new Re(this,{context:P,initialValue:this._ownStore})),this._ownStore)}get _currentSlotContent(){return this._slotContents[this.slotIndex??this._activeIndex]??{}}get _currentLabel(){return T(this._currentSlotContent.label,this.contentLanguage)??`Untitled`}_renderCurrentLabel(){let e={name:this.slotName,type:this.slotType};return K(this._currentSlotContent,e)?Pt(this._currentSlotContent):this._currentLabel}connectedCallback(){let e={};this.apiUrl&&(e.apiUrl=this.apiUrl),this.authKey&&this.authToken&&(e.authKey=this.authKey,e.authToken=this.authToken),D.configure(e),super.connectedCallback(),this._attachDragHandle()}disconnectedCallback(){super.disconnectedCallback(),this._cleanupDrag&&=(this._cleanupDrag(),void 0),this._panelResizeObserver?.disconnect(),this._panelResizeObserver=void 0}_syncListMaxHeight(){let e=this.displaySettingsElement,t=this.slotMenuListElement;if(!e||!t)return;let n=e.offsetHeight;n>0&&t.style.setProperty(`--luzmo-slot-menu-list-max-height`,`${n}px`)}_observePanelResize(){let e=this.displaySettingsElement;e&&(this._panelResizeObserver||=new ResizeObserver(()=>this._syncListMaxHeight()),this._panelResizeObserver.disconnect(),this._panelResizeObserver.observe(e),this._syncListMaxHeight())}_attachDragHandle(){if(this._cleanupDrag||this.variant!==`draggable`||this.noDrag)return;let e=this.renderRoot.querySelector(`.drag-handle`);if(!e)return;let t=this.dragBoundary?document.querySelector(this.dragBoundary):document.documentElement;this._cleanupDrag=Yt({element:this,handle:e,boundary:t})}_sendChangeEvent(){let e=this._store.slotContents.get();this.dispatchEvent(new CustomEvent(`luzmo-slot-contents-changed`,{bubbles:!0,composed:!0,cancelable:!0,detail:{slotContents:structuredClone(e),linkedDatasetsIds:[...this._linkedDatasetsIds]}}))}resetInfoVisibility(){this.displaySettingsElement?.resetInfoVisibility&&this.displaySettingsElement.resetInfoVisibility(!1)}_sendCloseEvent(){this.dispatchEvent(new CustomEvent(`luzmo-close`,{bubbles:!0,composed:!0,cancelable:!0}))}isArrayColumnType(e){return e.startsWith(`array[`)}async willUpdate(e){let t=this._store,n=t.slotContents.get(),r=e.has(`slotContents`);Array.isArray(this.slotContents)&&(n.length===0||r)&&t.setContents(structuredClone(this.slotContents),this.slotName);let i=t.slotContents.get();if(i!==this._slotContents){this._slotContents=i;let{set:e,column:n}=this._currentSlotContent;if(e&&Te(e)&&e!==this._lastFetchedDatasetId){if(this._lastFetchedDatasetId=e,await D.fetchDatasetsRecursive([e]),!this.isConnected)return;this._linkedDatasetsIds=D.getLinkedDatasetsIds(e)}let r=D.getAvailableDatasets();this.measureColumns=r.map(e=>({datasetId:e.id,datasetName:e.name,columns:e.columns?.filter(e=>e.type===`numeric`&&e.id!==n)})),t.activeIndex.get()!==this._activeIndex&&t.updateActive(this._activeIndex);let a=this.itemType===`kpi`?`comparison-measure`:`measure`;if(this.slotName===a){t.linkedDataset.set(r.filter(t=>t.id===e)),t.setPeriodOverPeriodCondition(this.itemType,this._currentSlotContent);let n=this._currentSlotContent.subtype===`duration`&&this.isArrayColumnType(this._currentSlotContent.type);this._periodOverPeriodUiType=n?null:t.periodOverPeriodUiType.get()}}}updated(){this.displaySettingsElement&&(this.displaySettingsElement.periodOverPeriodUiType=this._periodOverPeriodUiType,this.displaySettingsElement.measureColumns=this.measureColumns,this.displaySettingsElement.showRemoveButton=this.variant===`popup`&&(typeof this.slotIndex==`number`||this._slotContents?.length===1)),this._observePanelResize()}_handleSlotListChange(e){let t=this._store,n=structuredClone(e.detail.slotContents),r=e.detail.activeIndex;r!==this._activeIndex&&(this._activeIndex=r,t.updateActive(r)),t.setContents(n,this.slotName),this._slotContents=t.slotContents.get();let i=this._slotContents[this._activeIndex],a=i?.column??i?.columnId,o=i?.set??i?.datasetId,s=i?.formulaId??(se(i?.formula)?i.formula:void 0);(a||s)&&o&&(this.dispatchEvent(new CustomEvent(`luzmo-slot-menu-active`,{bubbles:!0,composed:!0,detail:{datasetId:o}})),setTimeout(()=>{this.dispatchEvent(new CustomEvent(`luzmo-slot-menu-highlight`,{bubbles:!0,composed:!0,detail:{datasetId:o,level:i?.level??0,...a&&{columnId:a},...s&&{formulaId:s}}}))})),this._slotContents.length<=1&&this.requestUpdate(),this._sendChangeEvent()}_handleSlotContentChange(e){let t=this._store,n=this.slotIndex??this._activeIndex;t.updateContent(structuredClone(e.detail.slotContent),n),this._slotContents=t.slotContents.get(),this.slotMenuListElement&&(this.slotMenuListElement.slotContents=this._slotContents),this._sendChangeEvent()}removeSlotContent(e){let t=this._store;t.removeContent(e),this._slotContents=t.slotContents.get(),this._slotContents.length===0&&this.dispatchEvent(new CustomEvent(`luzmo-slot-menu-inactive`,{bubbles:!0,composed:!0})),this._sendChangeEvent(),this.close(),this.requestUpdate()}close(){this._sendCloseEvent(),this.resetInfoVisibility()}_removeActiveSlotContent(){this.removeSlotContent(this.slotIndex??this._activeIndex)}_handleInfoVisibilityChanged(e){this.dispatchEvent(new CustomEvent(`luzmo-info-visibility-changed`,{detail:e.detail}))}render(){let e=`${this.slotType}-${this._currentSlotContent?.type??``}`;return O`<div class="slot-menu-top-menu" role="region" aria-label=${v(`Slot menu`,{desc:`Accessible label for slot menu region`})}>
174
- ${this.variant===`draggable`?O`<div class="drag-handle">${b(xe)}</div>`:``}
175
- ${this._slotContents&&this._slotContents.length===1&&this.variant!==`popup`?O` <div class="slot-content-action">
176
- <div class="slot-content-label">${this._renderCurrentLabel()}</div>
177
- <button
178
- class="slot-content-remove"
179
- aria-label=${v(`Remove`,{desc:`Remove button label`})}
180
- @click=${this.removeSlotContent.bind(this,0)}
181
- >
182
- ${b(te)}
183
- </button>
184
- </div>`:``}
185
- </div>
186
- <div
187
- class="slot-contents-container ${this._slotContents?.length>1?`multiple`:``}"
188
- >
189
- ${this.variant===`popup`?``:O`<button class="close" aria-label=${v(`Close`,{id:`close-action`,desc:`Close button label`})} @click=${this.close}>
190
- ${b(be)}
191
- </button>`}
192
- <div class="inner-container">
193
- ${this._slotContents?.length>1&&typeof this.slotIndex!=`number`?O`<luzmo-slot-menu-list
194
- .slotContents=${this._slotContents}
195
- .contentLanguage=${this.contentLanguage}
196
- .slotName=${this.slotName}
197
- .slotType=${this.slotType}
198
- .activeIndex=${this.slotIndex??this._activeIndex}
199
- @luzmo-slot-list-changed=${this._handleSlotListChange}
200
- ></luzmo-slot-menu-list>`:``}
201
- ${pe([this.variant,this.language,this.contentLanguage,this._periodOverPeriodUiType,this._activeIndex,this.size,e,this.slotName,this.datasetsDataFields,this.apiUrl,this.authKey,this.authToken],()=>O`<luzmo-display-settings
202
- .size=${this.size}
203
- .language=${this.language}
204
- .contentLanguage=${this.contentLanguage}
205
- .slotName=${this.slotName}
206
- .slotType=${this.slotType}
207
- .measureColumns=${this.measureColumns}
208
- .showRemoveButton=${this.variant===`popup`&&(typeof this.slotIndex==`number`||this._slotContents?.length===1)}
209
- .slotContent=${this._currentSlotContent}
210
- .datasetsDataFields=${this.datasetsDataFields}
211
- api-url=${k(this.apiUrl)}
212
- auth-key=${k(this.authKey)}
213
- auth-token=${k(this.authToken)}
214
- .areGrandTotalsEnabled=${this.areGrandTotalsEnabled}
215
- .areDatetimeOptionsEnabled=${this.areDatetimeOptionsEnabled}
216
- .isBinningDisabled=${this.isBinningDisabled}
217
- .isAggregationDisabled=${this.isAggregationDisabled}
218
- .isCumulativeSumEnabled=${this.isCumulativeSumEnabled}
219
- @luzmo-slot-content-changed=${this._handleSlotContentChange}
220
- @luzmo-remove-slot-content=${this._removeActiveSlotContent}
221
- @luzmo-info-visibility-changed=${this._handleInfoVisibilityChanged}
222
- ></luzmo-display-settings>`)}
223
- </div>
224
- </div>`}firstUpdated(){this._attachDragHandle(),this._observePanelResize()}resetPosition(){this.style.transform=``}};g([j({type:String,reflect:!0})],Z.prototype,`language`,void 0),g([j({type:String,attribute:`content-language`,reflect:!0})],Z.prototype,`contentLanguage`,void 0),g([j({type:String,attribute:`slot-type`,reflect:!0})],Z.prototype,`slotType`,void 0),g([j({type:String,attribute:`slot-name`,reflect:!0})],Z.prototype,`slotName`,void 0),g([j({type:String,attribute:`item-type`,reflect:!0})],Z.prototype,`itemType`,void 0),g([j({type:Boolean,attribute:`no-drag`,reflect:!0})],Z.prototype,`noDrag`,void 0),g([j({type:Boolean,attribute:`no-close`,reflect:!0})],Z.prototype,`noClose`,void 0),g([j({type:String,reflect:!0})],Z.prototype,`variant`,void 0),g([j({type:Boolean,attribute:`no-top-menu-label`,reflect:!0})],Z.prototype,`noTopMenuLabel`,void 0),g([ze({context:P,subscribe:!0})],Z.prototype,`_consumedStore`,void 0),g([j({type:String,attribute:`drag-boundary`,reflect:!1})],Z.prototype,`dragBoundary`,void 0),g([j({type:Boolean})],Z.prototype,`areGrandTotalsEnabled`,void 0),g([j({type:Boolean})],Z.prototype,`areDatetimeOptionsEnabled`,void 0),g([j({type:Boolean})],Z.prototype,`isBinningDisabled`,void 0),g([j({type:Boolean})],Z.prototype,`isAggregationDisabled`,void 0),g([j({type:Boolean})],Z.prototype,`isCumulativeSumEnabled`,void 0),g([j({type:Array,reflect:!1,attribute:`slot-contents`})],Z.prototype,`slotContents`,void 0),g([M()],Z.prototype,`_periodOverPeriodUiType`,void 0),g([M()],Z.prototype,`measureColumns`,void 0),g([j({type:Number,reflect:!1,attribute:`slot-index`})],Z.prototype,`slotIndex`,void 0),g([me(`luzmo-display-settings`)],Z.prototype,`displaySettingsElement`,void 0),g([me(`luzmo-slot-menu-list`)],Z.prototype,`slotMenuListElement`,void 0),g([j({type:String,attribute:`api-url`,reflect:!0})],Z.prototype,`apiUrl`,void 0),g([j({type:String,attribute:`auth-key`,reflect:!0})],Z.prototype,`authKey`,void 0),g([j({type:String,attribute:`auth-token`,reflect:!0})],Z.prototype,`authToken`,void 0),g([j({attribute:!1})],Z.prototype,`datasetsDataFields`,void 0),g([M()],Z.prototype,`_slotContents`,void 0),customElements.get(`luzmo-slot-menu`)||customElements.define(`luzmo-slot-menu`,Z);var un=`:host{--luzmo-select-inline-size:100%;font-family:var(--luzmo-item-slot-picker-font-family,var(--luzmo-font-family))}.container{gap:var(--luzmo-item-slot-picker-gap,var(--item-slot-picker-gap,var(--luzmo-spacing-5)));flex-direction:column;width:fit-content;display:flex}.select-container{flex-direction:column;display:flex}.select-container .select-controls{align-items:center;gap:var(--luzmo-item-slot-picker-controls-gap,var(--item-slot-picker-controls-gap));flex-direction:row;flex:auto;display:flex}luzmo-data-fields-select{flex-grow:var(--luzmo-item-slot-picker-data-fields-select-flex-grow,var(--item-slot-picker-data-fields-select-flex-grow))}.calculation-control{align-items:center;gap:var(--luzmo-item-slot-picker-controls-gap,var(--item-slot-picker-controls-gap));flex:auto;min-width:0;display:flex}.calculation-label{align-items:center;gap:var(--luzmo-spacing-3);flex:auto;min-width:0;display:inline-flex}.calculation-label-icon{flex:none;display:inline-flex}.calculations-list{gap:var(--luzmo-item-slot-picker-gap,var(--item-slot-picker-gap,var(--luzmo-spacing-5)));flex-direction:column;flex:auto;min-width:0;display:flex}:host([grows]){--item-slot-picker-data-fields-select-flex-grow:1}:host([grows]) .container{width:100%}:host([grows]) .select-container{flex:auto}.extra-data-field-button-container{justify-content:center;align-items:center;display:flex}.item-slot-picker-label{font-size:var(--luzmo-item-slot-picker-label-font-size,var(--item-slot-picker-label-font-size));margin-right:var(--luzmo-item-slot-picker-text-to-controls,var(--item-slot-picker-text-to-controls));text-overflow:ellipsis;white-space:nowrap;flex-grow:1;overflow:hidden}.controls{align-items:center;gap:var(--luzmo-item-slot-picker-controls-gap,var(--item-slot-picker-controls-gap));background-color:var(--luzmo-item-slot-picker-controls-background-color,var(--item-slot-picker-controls-background-color));height:100%;color:var(--luzmo-item-slot-picker-controls-color,var(--item-slot-picker-controls-color));margin-right:var(--luzmo-item-slot-picker-controls-to-edge,var(--item-slot-picker-controls-to-edge));padding:0 var(--luzmo-item-slot-picker-controls-horizontal-padding,var(--item-slot-picker-controls-horizontal-padding));display:flex}.controls div{cursor:pointer;height:100%;padding:0 var(--luzmo-item-slot-picker-controls-control-horizontal-padding,var(--item-slot-picker-controls-control-horizontal-padding));align-items:center;display:flex}luzmo-slot-menu[placement=bottom],luzmo-slot-menu[placement=top],luzmo-slot-menu[placement=bottom-start],luzmo-slot-menu[placement=top-start],luzmo-slot-menu[placement=bottom-end],luzmo-slot-menu[placement=top-end]{margin:var(--luzmo-item-slot-picker-overlay-vertical-gap,var(--item-slot-picker-overlay-vertical-gap)) 0}luzmo-slot-menu[placement=left],luzmo-slot-menu[placement=right],luzmo-slot-menu[placement=left-start],luzmo-slot-menu[placement=right-start],luzmo-slot-menu[placement=left-end],luzmo-slot-menu[placement=right-end]{margin:0 var(--luzmo-item-slot-picker-overlay-horizontal-gap,var(--item-slot-picker-overlay-horizontal-gap))}:host{--item-slot-picker-border-width:var(--luzmo-border-width);--item-slot-picker-border-style:dashed;--item-slot-picker-border-color:var(--luzmo-border-color);--item-slot-picker-accept-drag-controls-background-color:transparent;--item-slot-picker-font-color:var(--luzmo-font-color);--item-slot-picker-controls-background-color:transparent;--item-slot-picker-text-to-controls:var(--luzmo-spacing-3);--item-slot-picker-controls-to-edge:0;--item-slot-picker-controls-gap:var(--luzmo-spacing-2);--item-slot-picker-controls-horizontal-padding:var(--luzmo-spacing-2);--item-slot-picker-controls-control-horizontal-padding:var(--luzmo-spacing-3);--item-slot-picker-label-font-size:var(--luzmo-font-size);--item-slot-picker-horizontal-padding:var(--luzmo-spacing-4);--item-slot-picker-overlay-horizontal-gap:var(--luzmo-spacing-4);--item-slot-picker-overlay-vertical-gap:var(--luzmo-spacing-4)}:host([size=s]){--item-slot-picker-horizontal-padding:var(--luzmo-spacing-4);--item-slot-picker-overlay-horizontal-gap:var(--luzmo-spacing-4);--item-slot-picker-overlay-vertical-gap:var(--luzmo-spacing-4)}:host([size=l]),:host([size=xl]){--item-slot-picker-horizontal-padding:var(--luzmo-spacing-5);--item-slot-picker-overlay-horizontal-gap:var(--luzmo-spacing-5);--item-slot-picker-overlay-vertical-gap:var(--luzmo-spacing-5)}:host{box-sizing:border-box}`,dn=e=>{if(`columnId`in e&&e.columnId)return e.columnId;if(`formulaId`in e&&e.formulaId)return e.formulaId;if(`formula`in e&&e.formula)return e.formula},fn=e=>Nt(e),pn=`::level::`,mn=(e,t)=>`${e}${pn}${t}`,Q=class extends _(x(S,{validSizes:[`s`,`m`,`l`,`xl`],noDefaultSize:!0})){static{this.styles=N(un)}_isAdHocFormula(e){return`formula`in e&&typeof e.formula==`string`}constructor(){super(),this._loadSlotsConfig=new C(this,{task:async([e])=>{if(!e)return this._slotsConfig;if(e!==this._itemTypeLoaded){this._itemTypeLoaded=e;let t=await ye(e);return this._slotsConfig=t??[],this._slotsConfig}return this._slotsConfig},args:()=>[this.itemType,this.language]}),this._slotsConfig=[],this.slotConfiguration={},this.slotContents=[],this.contentLanguage=`en`,this.disabled=!1,this.grows=!1,this.menu=`default`,this.hasLabel=!1,this.selects=`multiple`,this.search=`auto`,this.icons=`menu-only`,this.datasetsDataFields=[],this.placement=`bottom-start`,this.slotMenuPlacement=`bottom-end`,this.hideClear=!1,this._hasExtraEmptySelects=!1,this._currentSlotContents=[],this._store=new Ot,this._changedSlotContents=(e,t=[])=>{let n=new CustomEvent(`luzmo-slot-contents-changed`,{bubbles:!0,composed:!0,cancelable:!0,detail:{slotContents:e,linkedDatasetsIds:t}});return this.dispatchEvent(n),n},new Re(this,{context:P,initialValue:this._store})}willUpdate(e){super.willUpdate(e),e.has(`slotContents`)&&(this._currentSlotContents=structuredClone(this.slotContents??[]),this._store?.setContents(this._currentSlotContents??[],this.slotName))}_onSlotMenuChanges(e){e.preventDefault(),e.stopPropagation(),(this.slotContents?.length??0)===(e.detail.slotContents?.length??0)?(this._currentSlotContents=structuredClone(e.detail.slotContents??[]),this.slotContents=structuredClone(e.detail.slotContents??[]),this._store?.setContents(this._currentSlotContents??[],this.slotName),this._changedSlotContents(this._currentSlotContents,e.detail.linkedDatasetsIds??[])):(this.slotContents=e.detail.slotContents??[],this._store?.setContents(this.slotContents??[],this.slotName),this._changedSlotContents(this.slotContents,e.detail.linkedDatasetsIds??[]))}_setSlotContentAtIndex(e,t){let n=e.detail?.dataFields??[],r=n.length===0;t>=this._currentSlotContents.length&&this._removeEmptySelect();for(let e=this._currentSlotContents.length;e<=t;e++)this._currentSlotContents[e]||this._currentSlotContents.push({});if(n.length>0){let e=n[0],r=dn(e),i=this._currentSlotContents[t],a=fn(i),o=i?.level,s=e.level;if(r&&(r!==a||o!==s)){let n=typeof e.level==`number`;this._currentSlotContents[t]=Ft(e,n)}}else r&&this._currentSlotContents.splice(t,1);this.slotContents=structuredClone(this._currentSlotContents.filter(e=>!!fn(e))),this._changedSlotContents(this.slotContents)}_setSlotContents(e){let t=e.detail.dataFields??[],n=this._currentSlotContents.filter(e=>K(e,this.slotConfiguration));this.slotConfiguration?.canAcceptMultipleDataFields&&t.length>1||(t=t.slice(0,1));let r=this._getFilteredDatasetsDataFields(),i=t.map(e=>{let t=Ft(e,typeof e.level==`number`),n=this._getSelectValueForSlotContent(t,r);if(n)return{selectionValue:n,slotContent:t}}).filter(e=>!!e),a=new Set(i.map(e=>e.selectionValue));this._currentSlotContents=this._currentSlotContents?.filter(e=>!K(e,this.slotConfiguration)).filter(e=>{let t=this._getSelectValueForSlotContent(e,r);return t?a.has(t):!1})??[],i.forEach(({selectionValue:e,slotContent:t})=>{let n=this._currentSlotContents.findIndex(t=>this._getSelectValueForSlotContent(t,r)===e);if(n!==-1){this._currentSlotContents[n]=t;return}this._currentSlotContents.push(t)}),this._currentSlotContents=[...n,...this._currentSlotContents],this.slotContents=structuredClone(this._currentSlotContents),this._changedSlotContents(this._currentSlotContents)}_renderFieldLabel(){return O`<luzmo-field-label for="data-fields" size=${this.size}
225
- >${this.label??v(`Select...`)}
226
- </luzmo-field-label>`}_removeEmptySelect(){this._hasExtraEmptySelects=!1}_getAcceptableDataFields(){let e=[],t=this.slotConfiguration?.acceptableDataFieldTypes?.length?this.slotConfiguration.acceptableDataFieldTypes:Be;return this.datasetsDataFields.forEach(n=>{(n.columns?.filter(e=>t.includes(e.type??``))??[]).forEach(t=>{e.push({datasetId:n.id,type:t.type,name:t.name,columnId:t.id,description:t.description,subtype:t.subtype,format:t.format,lowestLevel:t.lowestLevel,duration_levels:t.duration_levels,duration_format:t.duration_format,expression:t.expression,hierarchyLevels:t.hierarchyLevels,currency:t.currency})}),this.slotConfiguration?.canAcceptFormula&&(n.formulas??[]).forEach(t=>{t.type&&(this._isAdHocFormula(t)?e.push({datasetId:n.id,type:t.type,name:t.label??{en:`Ad-hoc formula`},formula:t.formula,subtype:t.subtype??void 0,format:t.format}):e.push({datasetId:n.id,type:t.type,name:t.name,formulaId:t.id,description:t.description,subtype:t.subtype,format:t.format,lowestLevel:t.lowestLevel,duration_levels:t.duration_levels,duration_format:t.duration_format,expression:t.expression,currency:t.currency}))})}),e}_getFirstAvailableDataField(){let e=this._getAcceptableDataFields(),t=new Set(this._currentSlotContents.map(e=>e.columnId??e.formulaId??e.column??e.formula));return e.find(e=>{let n=dn(e);return n?!t.has(n):!1})}_hasAvailableDataFields(){return!!this._getFirstAvailableDataField()}_addDataField(){let e=this._getFirstAvailableDataField();if(e){let t=Ft(e,!1);this._currentSlotContents.push(t),this.slotContents=structuredClone(this._currentSlotContents),this._changedSlotContents(this.slotContents)}else this._hasExtraEmptySelects=!0}_renderExtraDataFieldButton(){return this._hasAvailableDataFields()?O`<div class="extra-data-field-button-container">
227
- <luzmo-action-button
228
- size="xs"
229
- .label=${v(`Add data field`,{desc:`Aria label for add data field button`})}
230
- @click=${this._addDataField}
231
- ?disabled=${this._hasExtraEmptySelects||this.disabled}
232
- >
233
- ${b(ae)}
234
- </luzmo-action-button>
235
- <luzmo-tooltip self-managed placement="top" size=${this.size}>
236
- Add data field
237
- </luzmo-tooltip>
238
- </div>`:O`
239
-
240
- `}_renderSingleSelect(){let e=this._renderFieldLabel(),t=this._currentSlotContents.length>0;if(!t&&!this._hasExtraEmptySelects)return O`<div class="select-container">
241
- ${this.hasLabel?e:``} ${this._renderSelectMenu(0)}
242
- </div>`;let n=this._currentSlotContents.map((t,n)=>O` <div class="select-container">
243
- ${this.hasLabel&&n===0?e:``}
244
- <div class="select-controls">
245
- ${this._renderSelectMenu(n)}
246
- ${this.slotContents?.length>0&&!this.hideConfiguration?O`<div class="controls">
247
- <luzmo-action-button
248
- .size=${this.size}
249
- quiet
250
- id=${`trigger-${n}`}
251
- .label=${v(`Edit`,{desc:`Edit action label`})}
252
- ?disabled=${this.disabled}
253
- >
254
- ${b(Se)}
255
- <luzmo-tooltip
256
- self-managed
257
- placement="top"
258
- size=${this.size}
259
- >
260
- edit
261
- </luzmo-tooltip>
262
- </luzmo-action-button>
263
- </div>`:``}
264
- ${this.slotContents?.length>0?O`<luzmo-overlay
265
- trigger=${`trigger-${n}@click`}
266
- .placement=${this.slotMenuPlacement}
267
- >
268
- <luzmo-slot-menu
269
- language=${this.language}
270
- content-language=${this.contentLanguage}
271
- slot-type=${this.slotConfiguration?.type}
272
- slot-name=${k(this.slotName)}
273
- item-type=${k(this.itemType)}
274
- api-url=${k(this.apiUrl)}
275
- auth-key=${k(this.authKey)}
276
- auth-token=${k(this.authToken)}
277
- .datasetsDataFields=${this.datasetsDataFields}
278
- .areGrandTotalsEnabled=${this.slotConfiguration?.options?.areGrandTotalsEnabled}
279
- .areDatetimeOptionsEnabled=${this.slotConfiguration?.options?.areDatetimeOptionsEnabled}
280
- .isBinningDisabled=${this.slotConfiguration?.options?.isBinningDisabled}
281
- .isAggregationDisabled=${this.slotConfiguration?.options?.isAggregationDisabled}
282
- .isCumulativeSumEnabled=${this.slotConfiguration?.options?.isCumulativeSumEnabled}
283
- .slotIndex=${n}
284
- variant="popup"
285
- .size=${this.size}
286
- @luzmo-slot-contents-changed=${this._onSlotMenuChanges}
287
- ></luzmo-slot-menu>
288
- </luzmo-overlay>`:``}
289
- </div>
290
- </div>`);return this._hasExtraEmptySelects&&n.push(O`<div class="select-container">
291
- ${this._renderSelectMenu(this._currentSlotContents.length)}
292
- </div>`),t&&this.slotConfiguration?.canAcceptMultipleDataFields&&n.push(this._renderExtraDataFieldButton()),n}_renderMultipleSelect(){let e=this._renderFieldLabel();return O`<div class="select-container">
293
- ${this.hasLabel?e:``}
294
-
295
- <div class="select-controls">
296
- ${this._renderMultipleSelectionControl()}
297
- ${this.slotContents?.length>0&&!this.hideConfiguration?O`<div class="controls">
298
- <luzmo-action-button
299
- .size=${this.size}
300
- quiet
301
- id="trigger"
302
- .label=${v(`Edit`,{desc:`Edit action label`})}
303
- ?disabled=${this.disabled}
304
- >
305
- ${b(Se)}
306
- <luzmo-tooltip self-managed placement="top" size=${this.size}>
307
- edit
308
- </luzmo-tooltip>
309
- </luzmo-action-button>
310
- </div>`:``}
311
- ${this.slotContents?.length>0?O`<luzmo-overlay
312
- trigger="trigger@click"
313
- .placement=${this.slotMenuPlacement}
314
- >
315
- <luzmo-slot-menu
316
- language=${this.language}
317
- content-language=${this.contentLanguage}
318
- slot-type=${this.slotConfiguration?.type}
319
- slot-name=${k(this.slotName)}
320
- item-type=${k(this.itemType)}
321
- api-url=${k(this.apiUrl)}
322
- auth-key=${k(this.authKey)}
323
- auth-token=${k(this.authToken)}
324
- .datasetsDataFields=${this.datasetsDataFields}
325
- .areGrandTotalsEnabled=${this.slotConfiguration?.options?.areGrandTotalsEnabled}
326
- .areDatetimeOptionsEnabled=${this.slotConfiguration?.options?.areDatetimeOptionsEnabled}
327
- .isBinningDisabled=${this.slotConfiguration?.options?.isBinningDisabled}
328
- .isAggregationDisabled=${this.slotConfiguration?.options?.isAggregationDisabled}
329
- .isCumulativeSumEnabled=${this.slotConfiguration?.options?.isCumulativeSumEnabled}
330
- variant="popup"
331
- .size=${this.size}
332
- @luzmo-slot-contents-changed=${this._onSlotMenuChanges}
333
- ></luzmo-slot-menu>
334
- </luzmo-overlay>`:``}
335
- </div>
336
- </div>`}_renderMultipleSelectionControl(){let e=this._currentSlotContents.map((e,t)=>({content:e,index:t})).filter(({content:e})=>K(e,this.slotConfiguration));return e.length===0?this._renderSelectMenu():O`<div class="calculations-list">
337
- ${e.map(({content:e,index:t})=>this._renderCalculation(e,t))}
338
- </div>
339
- ${e.length<this._currentSlotContents.length?this._renderSelectMenu(void 0,!0):``}`}_getSelectValueForSlotContent(e,t){let n=fn(e);if(!n)return;let r=e.columnId,i=e.level;if(!r||typeof i!=`number`||Number.isNaN(i))return n;let a;for(let e of t)if(a=e.columns?.find(e=>e.id===r),a)break;return a&&(Array.isArray(a.hierarchyLevels)&&a.hierarchyLevels.length>2&&a.hierarchy_enabled===!0&&i>=1||(a.type===`datetime`||a.type===`array[datetime]`)&&typeof a.lowestLevel==`number`&&i!==a.lowestLevel)?mn(r,i):n}_getFilteredDatasetsDataFields(){let e=this.slotConfiguration?.acceptableDataFieldTypes?.length?this.slotConfiguration.acceptableDataFieldTypes:Be;return this.datasetsDataFields.map(t=>({...t,columns:t.columns?.filter(t=>e.includes(t.type??``))??[],formulas:this.slotConfiguration?.canAcceptFormula?t.formulas??[]:[]}))}_clearCalculation(e){this._currentSlotContents.splice(e,1),this.slotContents=structuredClone(this._currentSlotContents),this._store?.setContents(this.slotContents,this.slotName),this._changedSlotContents(this.slotContents)}_renderCalculation(e,t){return O`<div class="calculation-control">
340
- ${Pt(e)}
341
- ${this.hideClear?``:O`<luzmo-action-button
342
- quiet
343
- .size=${this.size}
344
- .label=${v(`Clear calculation`,{desc:`Clear an ad-hoc slot calculation and return to column selection`})}
345
- ?disabled=${this.disabled}
346
- @click=${()=>this._clearCalculation(t)}
347
- >
348
- ${b(be)}
349
- </luzmo-action-button>`}
350
- </div>`}_renderSelectMenu(e,t=!1){let n=e??0,r=this._currentSlotContents[n];if(!t&&r&&(e!==void 0||this._currentSlotContents.length===1)&&K(r,this.slotConfiguration))return this._renderCalculation(r,n);let i=[],a=this._getFilteredDatasetsDataFields();if(e!==void 0&&e>=this._currentSlotContents.length)i=[];else if(i=this._currentSlotContents.filter(e=>!t||!K(e,this.slotConfiguration)).map(e=>this._getSelectValueForSlotContent(e,a)).filter(e=>typeof e==`string`&&e.length>0),this.selects===`single`&&i?.length>0){let t=i[e??0];i=t?[t]:[]}return O`<luzmo-data-fields-select
351
- .language=${this.language}
352
- .contentLanguage=${this.contentLanguage}
353
- .size=${this.size}
354
- .icons=${this.icons}
355
- .placeholder=${this.placeholder??v(`Select...`)}
356
- .placement=${this.placement}
357
- .search=${this.search}
358
- ?disabled=${this.disabled}
359
- allow-empty
360
- .datasetsDataFields=${a}
361
- .value=${i}
362
- ?clearable=${!this.hideClear}
363
- .selects=${this.selects===`multiple`&&this.slotConfiguration?.canAcceptMultipleDataFields?`multiple`:`single`}
364
- data-index=${e??0}
365
- @luzmo-data-fields-selected=${this._handleSelectChange}
366
- >
367
- </luzmo-data-fields-select>`}_handleSelectChange(e){if(this.selects===`single`){let t=e.currentTarget?.dataset?.index,n=t?Number.parseInt(t,10):0;this._setSlotContentAtIndex(e,Number.isNaN(n)?0:n)}else this._setSlotContents(e)}_itemSlotPickerMarkup(){return O`
368
- <div class="container">
369
- ${this.selects===`multiple`?this._renderMultipleSelect():this._renderSingleSelect()}
370
- </div>
371
- `}render(){return this._loadSlotsConfig.render({pending:()=>O`
372
- <p>Loading...</p>
373
- `,complete:e=>{if(this.slotName&&this.itemType&&e){let t=e.find(e=>e.name===this.slotName);t&&(this.slotConfiguration=t)}return this._itemSlotPickerMarkup()},error:e=>O`
374
- <div>
375
- Could not load item-slot-picker: '${this.slotName}' of chart
376
- '${this.itemType}': ${e}.
377
- </div>
378
- `})}};g([j({type:String,attribute:`api-url`,reflect:!0})],Q.prototype,`apiUrl`,void 0),g([j({type:String,attribute:`auth-key`,reflect:!0})],Q.prototype,`authKey`,void 0),g([j({type:String,attribute:`auth-token`,reflect:!0})],Q.prototype,`authToken`,void 0),g([j({type:String,reflect:!0,attribute:`item-type`})],Q.prototype,`itemType`,void 0),g([j({type:String,reflect:!0,attribute:`slot-name`})],Q.prototype,`slotName`,void 0),g([j({type:Object})],Q.prototype,`slotConfiguration`,void 0),g([j({type:Array})],Q.prototype,`slotContents`,void 0),g([j({type:String,attribute:`content-language`,reflect:!0})],Q.prototype,`contentLanguage`,void 0),g([j({type:Boolean,attribute:`disabled`,reflect:!0})],Q.prototype,`disabled`,void 0),g([j({type:Boolean,attribute:`grows`,reflect:!0})],Q.prototype,`grows`,void 0),g([j({type:String,reflect:!0})],Q.prototype,`menu`,void 0),g([j({type:Boolean,attribute:`has-label`,reflect:!0})],Q.prototype,`hasLabel`,void 0),g([j({type:String,reflect:!0})],Q.prototype,`label`,void 0),g([j({type:String,reflect:!0})],Q.prototype,`selects`,void 0),g([j({type:String,reflect:!0})],Q.prototype,`search`,void 0),g([j({type:String,reflect:!0})],Q.prototype,`icons`,void 0),g([j({type:String,attribute:`placeholder`,reflect:!0})],Q.prototype,`placeholder`,void 0),g([j({type:Array,reflect:!1})],Q.prototype,`datasetsDataFields`,void 0),g([j({type:String,reflect:!0})],Q.prototype,`placement`,void 0),g([j({type:String,reflect:!0,attribute:`slot-menu-placement`})],Q.prototype,`slotMenuPlacement`,void 0),g([j({type:Boolean,reflect:!0,attribute:`hide-configuration`})],Q.prototype,`hideConfiguration`,void 0),g([j({type:Boolean,reflect:!0,attribute:`hide-clear`})],Q.prototype,`hideClear`,void 0),g([M()],Q.prototype,`_hasExtraEmptySelects`,void 0),Q=g([y()],Q),customElements.get(`luzmo-item-slot-picker`)||customElements.define(`luzmo-item-slot-picker`,Q);var hn=`:host{font-size:var(--luzmo-item-slot-picker-panel-font-size,var(--luzmo-font-size));font-family:var(--luzmo-font-family,sans-serif);color:var(--luzmo-font-color,inherit);display:block}:host([size=s]){font-size:var(--luzmo-item-slot-picker-panel-font-size-s,var(--luzmo-font-size-s))}:host([size=l]){font-size:var(--luzmo-item-slot-picker-panel-font-size-l,var(--luzmo-font-size-l))}:host([size=xl]){font-size:var(--luzmo-item-slot-picker-panel-font-size-xl,var(--luzmo-font-size-xl))}.container{flex-direction:column;align-items:flex-start;display:flex}.dataset-picker{align-self:stretch;align-items:flex-start;gap:var(--luzmo-item-slot-picker-panel-dataset-picker-gap,var(--luzmo-spacing-2));border-bottom-style:solid;border-bottom-width:var(--luzmo-item-slot-picker-panel-dataset-picker-border-width,1px);border-bottom-color:var(--luzmo-item-slot-picker-panel-dataset-picker-border-color,var(--luzmo-border-color));flex-direction:column;flex-shrink:0;margin-block-end:var(--luzmo-item-slot-picker-panel-dataset-picker-margin-block-end,var(--luzmo-spacing-4));padding-block-end:var(--luzmo-item-slot-picker-panel-dataset-picker-padding-block-end,var(--luzmo-spacing-4));display:flex}.slots-panel{gap:var(--luzmo-item-slot-picker-panel-gap,var(--luzmo-spacing-4));flex-direction:column;display:flex}.slot-container{gap:var(--luzmo-item-slot-picker-panel-slot-gap,var(--luzmo-spacing-2));flex-direction:column;display:flex}luzmo-field-label{margin:0}luzmo-item-slot-picker{display:block}:host([grows]) .container{align-items:stretch;width:100%}:host([grows]) .dataset-picker{align-items:stretch}:host([grows]) .dataset-picker luzmo-select{width:100%}`,gn=50,$=class extends _(x(S,{validSizes:[`s`,`m`,`l`,`xl`],noDefaultSize:!0})){constructor(...e){super(...e),this._loadSlotsConfig=new C(this,{task:async([e])=>{if(e&&e!==this._itemTypeLoaded){this._itemTypeLoaded=e;let t=await ye(e);return this._slotsConfig=t??[],this._slotsConfig}return this._slotsConfig},args:()=>[this.itemType,this.language]}),this._slotsConfig=[],this._datasetListItems=[],this._datasetListRetrieving=!1,this._datasetListPending=!1,this._datasetNamesFetchAttempted=!1,this._hasMoreDatasets=!0,this._fetchedDatasetsDataFields=[],this._failedDatasetIds=new Set,this._loadDataFieldsTask=new C(this,{args:()=>[this._currentDatasetId,this.apiUrl,this.authKey,this.authToken,this.datasetsDataFields.length],task:async([e,t,n,r,i])=>{if(i>0||!e)return null;if(!se(e))return console.warn(`[LuzmoItemSlotPickerPanel] Invalid dataset ID provided (not a valid UUID): ${e}`),this._failedDatasetIds.add(e),null;if(this._failedDatasetIds.has(e))return null;let a=this._fetchedDatasetsDataFields.find(t=>t.id===e);if(a&&a.columns&&a.columns.length>0)return a;try{let t=await D.fetchDatasetsWithColumnsAndFormulas([e]);if(t.length===0)return this._failedDatasetIds.add(e),null;let n=t[0],r=this._fetchedDatasetsDataFields.findIndex(t=>t.id===e);return r===-1?this._fetchedDatasetsDataFields=[...this._fetchedDatasetsDataFields,n]:this._fetchedDatasetsDataFields[r]=n,n}catch(t){return console.warn(`Failed to fetch dataset data fields:`,t),this._failedDatasetIds.add(e),null}}}),this.contentLanguage=`en`,this.slotsContents=[],this.selects=`multiple`,this.dataFieldsSearch=`auto`,this.datasetSearch=`auto`,this.icons=`menu-only`,this.datasetsDataFields=[],this.datasetIds=[],this.datasetPicker=!1,this.apiUrl=`https://api.luzmo.com`,this.placement=`bottom-start`,this.slotMenuPlacement=`bottom-end`,this.constraintMode=`auto`,this.grows=!1,this._currentSlotsContents=[],this._createSlotChangeHandler=e=>t=>{t.preventDefault(),t.stopPropagation();let n=t.detail.slotContents??[],r=this._applySlotConstraints(e,n);r!==null&&(this._currentSlotsContents=r,this.slotsContents=structuredClone(r),this.dispatchEvent(new CustomEvent(`luzmo-slots-contents-changed`,{bubbles:!0,composed:!0,cancelable:!0,detail:{slotsContents:r}})))}}static{this.styles=N(hn)}get _availableDatasets(){return this.datasetsDataFields.length>0?this.datasetsDataFields:this.datasetIds.length>0?this.datasetIds.map(e=>{let t=this._datasetListItems.find(t=>t.id===e);return t?{id:t.id,name:t.name,description:t.description}:{id:e,name:{en:e}}}):this._datasetListItems.length>0?this._datasetListItems.map(e=>({id:e.id,name:e.name,description:e.description})):[]}get _currentDatasetsDataFields(){if(this.datasetsDataFields.length>0){if(!this._currentDatasetId)return this.datasetsDataFields;let e=this.datasetsDataFields.find(e=>e.id===this._currentDatasetId);return e?[e]:this.datasetsDataFields}let e=this._loadDataFieldsTask.value;if(e)return[{id:e.id,name:e.name,description:e.description,columns:e.columns??[],formulas:e.formulas??[]}];if(this._fetchedDatasetsDataFields.length>0&&this._currentDatasetId){let e=this._fetchedDatasetsDataFields.find(e=>e.id===this._currentDatasetId);if(e)return[{id:e.id,name:e.name,description:e.description,columns:e.columns??[],formulas:e.formulas??[]}]}return[]}get _shouldFetchDatasetList(){return this.datasetPicker&&this.datasetsDataFields.length===0}_areDatasetsLinked(e,t){return e===t}_getUsedDatasetIds(){let e=new Set;for(let t of this._currentSlotsContents)for(let n of t.content)n.datasetId&&e.add(n.datasetId);return[...e]}willUpdate(e){super.willUpdate(e),e.has(`slotsContents`)&&(this._currentSlotsContents=structuredClone(this.slotsContents??[]));let t=e.has(`selectedDatasetId`),n=e.has(`datasetsDataFields`),r=e.has(`datasetIds`),i=e.has(`datasetPicker`),a=e.has(`authKey`),o=e.has(`authToken`),s=e.has(`apiUrl`);(r||a||o||s)&&(this._datasetListItems=[],this._hasMoreDatasets=!0,this._datasetNamesFetchAttempted=!1,this._fetchedDatasetsDataFields=[],this._failedDatasetIds.clear(),D.configure({apiUrl:this.apiUrl,authKey:this.authKey??``,authToken:this.authToken??``})),n&&this.datasetsDataFields.length>0&&(this._datasetListItems=[],this._hasMoreDatasets=!0,this._fetchedDatasetsDataFields=[],this._failedDatasetIds.clear()),(t||n||r)&&this._updateCurrentDatasetId(),(r||a||o||s||i)&&this.datasetIds.length>0&&this.datasetPicker&&this.datasetsDataFields.length===0&&this._datasetListItems.length===0&&this._fetchDatasetNamesForPicker()}_updateCurrentDatasetId(){let e=this._availableDatasets;if(this.selectedDatasetId&&e.some(e=>e.id===this.selectedDatasetId)){this._currentDatasetId=this.selectedDatasetId;return}if(this.selectedDatasetId&&this.datasetIds.includes(this.selectedDatasetId)){this._currentDatasetId=this.selectedDatasetId;return}this._currentDatasetId=e.length>0?e[0].id:void 0}async _fetchDatasetNamesForPicker(){if(this.datasetIds.length!==0){this._datasetListPending=!0;try{let e=await D.fetchDatasetNames(this.datasetIds);this._datasetListItems=e}catch(e){console.warn(`Failed to fetch dataset names:`,e)}finally{this._datasetListPending=!1,this._datasetNamesFetchAttempted=!0}}}async _loadMoreDatasets(e){if(!(this._datasetListRetrieving||!this._hasMoreDatasets)){this._datasetListRetrieving=!0,e&&(e.retrieving=!0);try{let e=this._datasetListItems.length,t=await D.fetchAllDatasets({offset:e,limit:gn});this._datasetListItems=[...this._datasetListItems,...t.data],this._hasMoreDatasets=e+gn<(t.pagination?.total??0),!this._currentDatasetId&&this._datasetListItems.length>0&&this._updateCurrentDatasetId()}catch(e){console.warn(`Failed to load dataset list:`,e),this._hasMoreDatasets=!1}finally{this._datasetListRetrieving=!1,e&&(e.retrieving=!1)}}}_handlePickerScrolled(e){if(this.datasetIds.length>0)return;let t=e.target,{last:n}=e.detail;n>=this._datasetListItems.length-10&&this._hasMoreDatasets&&this._loadMoreDatasets(t)}async _handlePickerOpened(e){let t=e.target;if(this._datasetListItems.length===0&&this._shouldFetchDatasetList&&this.datasetIds.length===0&&this._hasMoreDatasets){t.pending=!0;try{await this._loadMoreDatasets(t)}finally{t.pending=!1}}}_handleDatasetChange(e){let t=e.detail?.value?.[0];if(!t||t===this._currentDatasetId)return;let n=this._getUsedDatasetIds(),r=this._currentSlotsContents.some(e=>e.content.length>0),i=n.every(e=>this._areDatasetsLinked(e,t));if(r&&!i){if(this.constraintMode===`event-only`){this.dispatchEvent(new CustomEvent(`luzmo-dataset-constraint-triggered`,{bubbles:!0,composed:!0,detail:{previousDatasetId:this._currentDatasetId,newDatasetId:t,currentSlotsContents:structuredClone(this._currentSlotsContents),wouldClearSlots:!0}}));return}this._currentSlotsContents=[],this.slotsContents=[],this.dispatchEvent(new CustomEvent(`luzmo-slots-contents-changed`,{bubbles:!0,composed:!0,cancelable:!0,detail:{slotsContents:[]}}))}this._currentDatasetId=t,this.dispatchEvent(new CustomEvent(`luzmo-dataset-changed`,{bubbles:!0,composed:!0,detail:{datasetId:t}}))}_getSlotContents(e){return this._currentSlotsContents?.find(t=>t.name===e)?.content??[]}_applySlotConstraints(e,t){let n=this.slotsConfiguration??this._slotsConfig,r=structuredClone(this._currentSlotsContents),i=structuredClone(this._currentSlotsContents),a=i.findIndex(t=>t.name===e);a===-1?i.push({name:e,content:t}):i[a].content=t;let o=[];for(let r of n){if(r.keepOnlyFirstWhenOtherSlotFilled?.includes(e)&&t.length>0){let t=i.findIndex(e=>e.name===r.name);t!==-1&&i[t].content.length>1&&(o.push({type:`keepOnlyFirstWhenOtherSlotFilled`,affectedSlotName:r.name,triggeredBySlotName:e}),i[t].content=[i[t].content[0]])}if(r.clearWhenOtherSlotHasMultipleItems?.includes(e)&&t.length>1){let t=i.findIndex(e=>e.name===r.name);t!==-1&&i[t].content.length>0&&(o.push({type:`clearWhenOtherSlotHasMultipleItems`,affectedSlotName:r.name,triggeredBySlotName:e}),i[t].content=[])}}if(this.constraintMode===`event-only`&&o.length>0){let n={triggerSlotName:e,proposedTriggerContents:t,originalSlotsContents:r,proposedSlotsContents:i,constraints:o};return this.dispatchEvent(new CustomEvent(`luzmo-slot-constraint-triggered`,{detail:n,bubbles:!0,composed:!0})),null}return i}_getTranslatedLabel(e){let t=(typeof e.label==`string`?e.label:e.label?T(e.label,this.language):void 0)??e.name;return Me[t]?Me[t]():t}_renderDatasetPicker(){if(!this.datasetPicker)return A;let e=this._availableDatasets,t=e.length>1,n=this.datasetIds.length>0,r=this._shouldFetchDatasetList;if(!t&&!n&&!r)return A;let i=this._datasetListPending||this.datasetIds.length>0&&this._datasetListItems.length===0&&this.datasetsDataFields.length===0&&!this._datasetNamesFetchAttempted,a=i?[]:e.map(e=>({value:e.id,label:T(e.name,this.contentLanguage)||e.id})),o=i?[]:this._currentDatasetId?[this._currentDatasetId]:[],s=v(i?`Loading datasets...`:`Select dataset...`);return O`
379
- <div class="dataset-picker" part="dataset-picker">
380
- <luzmo-field-label part="dataset-field-label" size=${this.size}>
381
- ${this.datasetPickerLabel??v(`Dataset`)}
382
- </luzmo-field-label>
383
- <luzmo-select
384
- selects="single"
385
- variant="highlight"
386
- search=${k(this.datasetSearch)}
387
- placement=${this.placement}
388
- .size=${this.size}
389
- .options=${a}
390
- .value=${o}
391
- .label=${s}
392
- ?pending=${i}
393
- @change=${this._handleDatasetChange}
394
- @luzmo-opened=${this._handlePickerOpened}
395
- @luzmo-scrolled=${this._handlePickerScrolled}
396
- ></luzmo-select>
397
- </div>
398
- `}_renderSlot(e){let t=this._getSlotContents(e.name),n=this._createSlotChangeHandler(e.name),r=this._getTranslatedLabel(e);return O`
399
- <div class="slot-container" part="slot-container">
400
- <luzmo-field-label part="field-label" size=${this.size}>
401
- ${r}${e.isRequired?` *`:``}
402
- </luzmo-field-label>
403
- <luzmo-item-slot-picker
404
- part="item-slot-picker"
405
- item-type=${k(this.itemType)}
406
- slot-name=${e.name}
407
- language=${this.language}
408
- content-language=${this.contentLanguage}
409
- api-url=${k(this.apiUrl)}
410
- auth-key=${k(this.authKey)}
411
- auth-token=${k(this.authToken)}
412
- size=${this.size}
413
- selects=${this.selects}
414
- search=${k(this.dataFieldsSearch)}
415
- icons=${k(this.icons)}
416
- placement=${this.placement}
417
- slot-menu-placement=${this.slotMenuPlacement}
418
- ?grows=${this.grows}
419
- aria-required=${e.isRequired?`true`:A}
420
- .slotConfiguration=${e}
421
- .slotContents=${t}
422
- .datasetsDataFields=${this._currentDatasetsDataFields}
423
- @luzmo-slot-contents-changed=${n}
424
- ></luzmo-item-slot-picker>
425
- </div>
426
- `}_renderSlots(e){return O`
427
- <div class="slots-panel" part="slots-panel">
428
- ${e.map(e=>this._renderSlot(e))}
429
- </div>
430
- `}_renderContent(e){return O`
431
- <div class="container" part="container">
432
- ${this._renderDatasetPicker()}
433
- ${this._renderSlots(e)}
434
- </div>
435
- `}render(){return this.slotsConfiguration&&this.slotsConfiguration.length>0?this._renderContent(this.slotsConfiguration):this._loadSlotsConfig.render({pending:()=>O`
436
- <p role="status">Loading...</p>
437
- `,complete:e=>!e||e.length===0?O`<p>No slots configuration found for ${this.itemType}</p>`:this._renderContent(e),error:e=>O`
438
- <div role="alert">Could not load slots configuration for '${this.itemType}': ${e}.</div>
439
- `})}};g([M()],$.prototype,`_datasetListItems`,void 0),g([M()],$.prototype,`_datasetListRetrieving`,void 0),g([M()],$.prototype,`_datasetListPending`,void 0),g([M()],$.prototype,`_currentDatasetId`,void 0),g([M()],$.prototype,`_fetchedDatasetsDataFields`,void 0),g([j({type:String,reflect:!0,attribute:`item-type`})],$.prototype,`itemType`,void 0),g([j({type:String,attribute:`content-language`,reflect:!0})],$.prototype,`contentLanguage`,void 0),g([j({type:Array})],$.prototype,`slotsConfiguration`,void 0),g([j({type:Array})],$.prototype,`slotsContents`,void 0),g([j({type:String,reflect:!0})],$.prototype,`selects`,void 0),g([j({type:String,reflect:!0,attribute:`data-fields-search`})],$.prototype,`dataFieldsSearch`,void 0),g([j({type:String,reflect:!0,attribute:`dataset-search`})],$.prototype,`datasetSearch`,void 0),g([j({type:String,reflect:!0})],$.prototype,`icons`,void 0),g([j({type:Array,reflect:!1})],$.prototype,`datasetsDataFields`,void 0),g([j({type:Array,attribute:`dataset-ids`})],$.prototype,`datasetIds`,void 0),g([j({type:String,attribute:`selected-dataset-id`,reflect:!0})],$.prototype,`selectedDatasetId`,void 0),g([j({type:Boolean,attribute:`dataset-picker`,reflect:!0})],$.prototype,`datasetPicker`,void 0),g([j({type:String,attribute:`dataset-picker-label`})],$.prototype,`datasetPickerLabel`,void 0),g([j({type:String,attribute:`api-url`})],$.prototype,`apiUrl`,void 0),g([j({type:String,attribute:`auth-key`})],$.prototype,`authKey`,void 0),g([j({type:String,attribute:`auth-token`})],$.prototype,`authToken`,void 0),g([j({type:String,reflect:!0})],$.prototype,`placement`,void 0),g([j({type:String,reflect:!0,attribute:`slot-menu-placement`})],$.prototype,`slotMenuPlacement`,void 0),g([j({type:String,reflect:!0,attribute:`constraint-mode`})],$.prototype,`constraintMode`,void 0),g([j({type:Boolean,reflect:!0})],$.prototype,`grows`,void 0),g([M()],$.prototype,`_currentSlotsContents`,void 0),$=g([y()],$),customElements.get(`luzmo-item-slot-picker-panel`)||customElements.define(`luzmo-item-slot-picker-panel`,$);export{$ as LuzmoItemSlotPickerPanel};