jupiter-dynamic-forms 1.5.0 → 1.6.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.mjs CHANGED
@@ -4,7 +4,7 @@ import { LitElement, html, css } from "lit";
4
4
  * Copyright 2017 Google LLC
5
5
  * SPDX-License-Identifier: BSD-3-Clause
6
6
  */
7
- const t$1 = (t2) => (e2, o2) => {
7
+ const t$3 = (t2) => (e2, o2) => {
8
8
  void 0 !== o2 ? o2.addInitializer(() => {
9
9
  customElements.define(t2, e2);
10
10
  }) : customElements.define(t2, e2);
@@ -14,19 +14,19 @@ const t$1 = (t2) => (e2, o2) => {
14
14
  * Copyright 2019 Google LLC
15
15
  * SPDX-License-Identifier: BSD-3-Clause
16
16
  */
17
- const t = globalThis, e$1 = t.ShadowRoot && (void 0 === t.ShadyCSS || t.ShadyCSS.nativeShadow) && "adoptedStyleSheets" in Document.prototype && "replace" in CSSStyleSheet.prototype, s = Symbol(), o$2 = /* @__PURE__ */ new WeakMap();
18
- let n$2 = class n {
17
+ const t$2 = globalThis, e$4 = t$2.ShadowRoot && (void 0 === t$2.ShadyCSS || t$2.ShadyCSS.nativeShadow) && "adoptedStyleSheets" in Document.prototype && "replace" in CSSStyleSheet.prototype, s$1 = Symbol(), o$4 = /* @__PURE__ */ new WeakMap();
18
+ let n$3 = class n {
19
19
  constructor(t2, e2, o2) {
20
- if (this._$cssResult$ = true, o2 !== s)
20
+ if (this._$cssResult$ = true, o2 !== s$1)
21
21
  throw Error("CSSResult is not constructable. Use `unsafeCSS` or `css` instead.");
22
22
  this.cssText = t2, this.t = e2;
23
23
  }
24
24
  get styleSheet() {
25
25
  let t2 = this.o;
26
26
  const s2 = this.t;
27
- if (e$1 && void 0 === t2) {
27
+ if (e$4 && void 0 === t2) {
28
28
  const e2 = void 0 !== s2 && 1 === s2.length;
29
- e2 && (t2 = o$2.get(s2)), void 0 === t2 && ((this.o = t2 = new CSSStyleSheet()).replaceSync(this.cssText), e2 && o$2.set(s2, t2));
29
+ e2 && (t2 = o$4.get(s2)), void 0 === t2 && ((this.o = t2 = new CSSStyleSheet()).replaceSync(this.cssText), e2 && o$4.set(s2, t2));
30
30
  }
31
31
  return t2;
32
32
  }
@@ -34,29 +34,29 @@ let n$2 = class n {
34
34
  return this.cssText;
35
35
  }
36
36
  };
37
- const r$3 = (t2) => new n$2("string" == typeof t2 ? t2 : t2 + "", void 0, s), S = (s2, o2) => {
38
- if (e$1)
37
+ const r$4 = (t2) => new n$3("string" == typeof t2 ? t2 : t2 + "", void 0, s$1), S$1 = (s2, o2) => {
38
+ if (e$4)
39
39
  s2.adoptedStyleSheets = o2.map((t2) => t2 instanceof CSSStyleSheet ? t2 : t2.styleSheet);
40
40
  else
41
41
  for (const e2 of o2) {
42
- const o3 = document.createElement("style"), n3 = t.litNonce;
42
+ const o3 = document.createElement("style"), n3 = t$2.litNonce;
43
43
  void 0 !== n3 && o3.setAttribute("nonce", n3), o3.textContent = e2.cssText, s2.appendChild(o3);
44
44
  }
45
- }, c$1 = e$1 ? (t2) => t2 : (t2) => t2 instanceof CSSStyleSheet ? ((t3) => {
45
+ }, c$2 = e$4 ? (t2) => t2 : (t2) => t2 instanceof CSSStyleSheet ? ((t3) => {
46
46
  let e2 = "";
47
47
  for (const s2 of t3.cssRules)
48
48
  e2 += s2.cssText;
49
- return r$3(e2);
49
+ return r$4(e2);
50
50
  })(t2) : t2;
51
51
  /**
52
52
  * @license
53
53
  * Copyright 2017 Google LLC
54
54
  * SPDX-License-Identifier: BSD-3-Clause
55
55
  */
56
- const { is: i, defineProperty: e, getOwnPropertyDescriptor: h, getOwnPropertyNames: r$2, getOwnPropertySymbols: o$1, getPrototypeOf: n$1 } = Object, a = globalThis, c = a.trustedTypes, l = c ? c.emptyScript : "", p = a.reactiveElementPolyfillSupport, d = (t2, s2) => t2, u = { toAttribute(t2, s2) {
56
+ const { is: i$2, defineProperty: e$3, getOwnPropertyDescriptor: h$1, getOwnPropertyNames: r$3, getOwnPropertySymbols: o$3, getPrototypeOf: n$2 } = Object, a$1 = globalThis, c$1 = a$1.trustedTypes, l$1 = c$1 ? c$1.emptyScript : "", p$1 = a$1.reactiveElementPolyfillSupport, d$1 = (t2, s2) => t2, u$1 = { toAttribute(t2, s2) {
57
57
  switch (s2) {
58
58
  case Boolean:
59
- t2 = t2 ? l : null;
59
+ t2 = t2 ? l$1 : null;
60
60
  break;
61
61
  case Object:
62
62
  case Array:
@@ -81,8 +81,8 @@ const { is: i, defineProperty: e, getOwnPropertyDescriptor: h, getOwnPropertyNam
81
81
  }
82
82
  }
83
83
  return i2;
84
- } }, f = (t2, s2) => !i(t2, s2), b = { attribute: true, type: String, converter: u, reflect: false, useDefault: false, hasChanged: f };
85
- Symbol.metadata ?? (Symbol.metadata = Symbol("metadata")), a.litPropertyMetadata ?? (a.litPropertyMetadata = /* @__PURE__ */ new WeakMap());
84
+ } }, f$1 = (t2, s2) => !i$2(t2, s2), b = { attribute: true, type: String, converter: u$1, reflect: false, useDefault: false, hasChanged: f$1 };
85
+ Symbol.metadata ?? (Symbol.metadata = Symbol("metadata")), a$1.litPropertyMetadata ?? (a$1.litPropertyMetadata = /* @__PURE__ */ new WeakMap());
86
86
  class y extends HTMLElement {
87
87
  static addInitializer(t2) {
88
88
  this._$Ei(), (this.l ?? (this.l = [])).push(t2);
@@ -93,11 +93,11 @@ class y extends HTMLElement {
93
93
  static createProperty(t2, s2 = b) {
94
94
  if (s2.state && (s2.attribute = false), this._$Ei(), this.prototype.hasOwnProperty(t2) && ((s2 = Object.create(s2)).wrapped = true), this.elementProperties.set(t2, s2), !s2.noAccessor) {
95
95
  const i2 = Symbol(), h2 = this.getPropertyDescriptor(t2, i2, s2);
96
- void 0 !== h2 && e(this.prototype, t2, h2);
96
+ void 0 !== h2 && e$3(this.prototype, t2, h2);
97
97
  }
98
98
  }
99
99
  static getPropertyDescriptor(t2, s2, i2) {
100
- const { get: e2, set: r2 } = h(this.prototype, t2) ?? { get() {
100
+ const { get: e2, set: r2 } = h$1(this.prototype, t2) ?? { get() {
101
101
  return this[s2];
102
102
  }, set(t3) {
103
103
  this[s2] = t3;
@@ -111,16 +111,16 @@ class y extends HTMLElement {
111
111
  return this.elementProperties.get(t2) ?? b;
112
112
  }
113
113
  static _$Ei() {
114
- if (this.hasOwnProperty(d("elementProperties")))
114
+ if (this.hasOwnProperty(d$1("elementProperties")))
115
115
  return;
116
- const t2 = n$1(this);
116
+ const t2 = n$2(this);
117
117
  t2.finalize(), void 0 !== t2.l && (this.l = [...t2.l]), this.elementProperties = new Map(t2.elementProperties);
118
118
  }
119
119
  static finalize() {
120
- if (this.hasOwnProperty(d("finalized")))
120
+ if (this.hasOwnProperty(d$1("finalized")))
121
121
  return;
122
- if (this.finalized = true, this._$Ei(), this.hasOwnProperty(d("properties"))) {
123
- const t3 = this.properties, s2 = [...r$2(t3), ...o$1(t3)];
122
+ if (this.finalized = true, this._$Ei(), this.hasOwnProperty(d$1("properties"))) {
123
+ const t3 = this.properties, s2 = [...r$3(t3), ...o$3(t3)];
124
124
  for (const i2 of s2)
125
125
  this.createProperty(i2, t3[i2]);
126
126
  }
@@ -143,9 +143,9 @@ class y extends HTMLElement {
143
143
  if (Array.isArray(s2)) {
144
144
  const e2 = new Set(s2.flat(1 / 0).reverse());
145
145
  for (const s3 of e2)
146
- i2.unshift(c$1(s3));
146
+ i2.unshift(c$2(s3));
147
147
  } else
148
- void 0 !== s2 && i2.push(c$1(s2));
148
+ void 0 !== s2 && i2.push(c$2(s2));
149
149
  return i2;
150
150
  }
151
151
  static _$Eu(t2, s2) {
@@ -175,7 +175,7 @@ class y extends HTMLElement {
175
175
  }
176
176
  createRenderRoot() {
177
177
  const t2 = this.shadowRoot ?? this.attachShadow(this.constructor.shadowRootOptions);
178
- return S(t2, this.constructor.elementStyles), t2;
178
+ return S$1(t2, this.constructor.elementStyles), t2;
179
179
  }
180
180
  connectedCallback() {
181
181
  var _a;
@@ -200,7 +200,7 @@ class y extends HTMLElement {
200
200
  var _a;
201
201
  const i2 = this.constructor.elementProperties.get(t2), e2 = this.constructor._$Eu(t2, i2);
202
202
  if (void 0 !== e2 && true === i2.reflect) {
203
- const h2 = (void 0 !== ((_a = i2.converter) == null ? void 0 : _a.toAttribute) ? i2.converter : u).toAttribute(s2, i2.type);
203
+ const h2 = (void 0 !== ((_a = i2.converter) == null ? void 0 : _a.toAttribute) ? i2.converter : u$1).toAttribute(s2, i2.type);
204
204
  this._$Em = t2, null == h2 ? this.removeAttribute(e2) : this.setAttribute(e2, h2), this._$Em = null;
205
205
  }
206
206
  }
@@ -208,7 +208,7 @@ class y extends HTMLElement {
208
208
  var _a, _b;
209
209
  const i2 = this.constructor, e2 = i2._$Eh.get(t2);
210
210
  if (void 0 !== e2 && this._$Em !== e2) {
211
- const t3 = i2.getPropertyOptions(e2), h2 = "function" == typeof t3.converter ? { fromAttribute: t3.converter } : void 0 !== ((_a = t3.converter) == null ? void 0 : _a.fromAttribute) ? t3.converter : u;
211
+ const t3 = i2.getPropertyOptions(e2), h2 = "function" == typeof t3.converter ? { fromAttribute: t3.converter } : void 0 !== ((_a = t3.converter) == null ? void 0 : _a.fromAttribute) ? t3.converter : u$1;
212
212
  this._$Em = e2;
213
213
  const r2 = h2.fromAttribute(s2, t3.type);
214
214
  this[e2] = r2 ?? ((_b = this._$Ej) == null ? void 0 : _b.get(e2)) ?? r2, this._$Em = null;
@@ -218,7 +218,7 @@ class y extends HTMLElement {
218
218
  var _a;
219
219
  if (void 0 !== t2) {
220
220
  const e2 = this.constructor, h2 = this[t2];
221
- if (i2 ?? (i2 = e2.getPropertyOptions(t2)), !((i2.hasChanged ?? f)(h2, s2) || i2.useDefault && i2.reflect && h2 === ((_a = this._$Ej) == null ? void 0 : _a.get(t2)) && !this.hasAttribute(e2._$Eu(t2, i2))))
221
+ if (i2 ?? (i2 = e2.getPropertyOptions(t2)), !((i2.hasChanged ?? f$1)(h2, s2) || i2.useDefault && i2.reflect && h2 === ((_a = this._$Ej) == null ? void 0 : _a.get(t2)) && !this.hasAttribute(e2._$Eu(t2, i2))))
222
222
  return;
223
223
  this.C(t2, s2, i2);
224
224
  }
@@ -298,13 +298,13 @@ class y extends HTMLElement {
298
298
  firstUpdated(t2) {
299
299
  }
300
300
  }
301
- y.elementStyles = [], y.shadowRootOptions = { mode: "open" }, y[d("elementProperties")] = /* @__PURE__ */ new Map(), y[d("finalized")] = /* @__PURE__ */ new Map(), p == null ? void 0 : p({ ReactiveElement: y }), (a.reactiveElementVersions ?? (a.reactiveElementVersions = [])).push("2.1.1");
301
+ y.elementStyles = [], y.shadowRootOptions = { mode: "open" }, y[d$1("elementProperties")] = /* @__PURE__ */ new Map(), y[d$1("finalized")] = /* @__PURE__ */ new Map(), p$1 == null ? void 0 : p$1({ ReactiveElement: y }), (a$1.reactiveElementVersions ?? (a$1.reactiveElementVersions = [])).push("2.1.1");
302
302
  /**
303
303
  * @license
304
304
  * Copyright 2017 Google LLC
305
305
  * SPDX-License-Identifier: BSD-3-Clause
306
306
  */
307
- const o = { attribute: true, type: String, converter: u, reflect: false, hasChanged: f }, r$1 = (t2 = o, e2, r2) => {
307
+ const o$2 = { attribute: true, type: String, converter: u$1, reflect: false, hasChanged: f$1 }, r$2 = (t2 = o$2, e2, r2) => {
308
308
  const { kind: n3, metadata: i2 } = r2;
309
309
  let s2 = globalThis.litPropertyMetadata.get(i2);
310
310
  if (void 0 === s2 && globalThis.litPropertyMetadata.set(i2, s2 = /* @__PURE__ */ new Map()), "setter" === n3 && ((t2 = Object.create(t2)).wrapped = true), s2.set(r2.name, t2), "accessor" === n3) {
@@ -325,8 +325,8 @@ const o = { attribute: true, type: String, converter: u, reflect: false, hasChan
325
325
  }
326
326
  throw Error("Unsupported decorator location: " + n3);
327
327
  };
328
- function n2(t2) {
329
- return (e2, o2) => "object" == typeof o2 ? r$1(t2, e2, o2) : ((t3, e3, o3) => {
328
+ function n$1(t2) {
329
+ return (e2, o2) => "object" == typeof o2 ? r$2(t2, e2, o2) : ((t3, e3, o3) => {
330
330
  const r2 = e3.hasOwnProperty(o3);
331
331
  return e3.constructor.createProperty(o3, t3), r2 ? Object.getOwnPropertyDescriptor(e3, o3) : void 0;
332
332
  })(t2, e2, o2);
@@ -336,8 +336,8 @@ function n2(t2) {
336
336
  * Copyright 2017 Google LLC
337
337
  * SPDX-License-Identifier: BSD-3-Clause
338
338
  */
339
- function r(r2) {
340
- return n2({ ...r2, state: true, attribute: false });
339
+ function r$1(r2) {
340
+ return n$1({ ...r2, state: true, attribute: false });
341
341
  }
342
342
  class FormValidator {
343
343
  /**
@@ -527,13 +527,30 @@ class XBRLFormBuilder {
527
527
  * Create unique concept ID by combining original ID with preferred label suffix
528
528
  * This handles cases where the same concept appears multiple times with different labels
529
529
  */
530
- static createUniqueConceptId(concept) {
530
+ static createUniqueConceptId(concept, sectionId) {
531
+ let baseId = concept.id;
531
532
  if (concept.preferredLabel && concept.preferredLabel.trim() !== "") {
532
533
  const roleMatch = concept.preferredLabel.match(/\/([^\/]+)$/);
533
534
  const roleSuffix = roleMatch ? roleMatch[1] : concept.preferredLabel.replace(/[^a-zA-Z0-9]/g, "_");
534
- return `${concept.id}_${roleSuffix}`;
535
+ baseId = `${concept.id}_${roleSuffix}`;
535
536
  }
536
- return concept.id;
537
+ if (sectionId) {
538
+ const sectionHash = this.createSectionHash(sectionId);
539
+ return `${baseId}__${sectionHash}`;
540
+ }
541
+ return baseId;
542
+ }
543
+ /**
544
+ * Create a short hash from section ID for concept uniqueness
545
+ */
546
+ static createSectionHash(sectionId) {
547
+ let hash = 0;
548
+ for (let i2 = 0; i2 < sectionId.length; i2++) {
549
+ const char = sectionId.charCodeAt(i2);
550
+ hash = (hash << 5) - hash + char;
551
+ hash = hash & hash;
552
+ }
553
+ return Math.abs(hash).toString(36).substr(0, 6);
537
554
  }
538
555
  /**
539
556
  * Build form schema from XBRL input data
@@ -579,11 +596,17 @@ class XBRLFormBuilder {
579
596
  const columns = this.generateDefaultColumnsForRole(role, periodStartDate || "2025-01-01", periodEndDate || "2025-12-31", hypercubeRole, nonAbstractConcepts, periodTypes);
580
597
  const availableColumnIds = columns.map((col) => col.id);
581
598
  console.log(`📋 Available column IDs for role "${role.id}":`, availableColumnIds);
599
+ if (availableColumnIds.some((id) => id.includes("multi_"))) {
600
+ console.log(`🔍 [DEBUG] Multi-dimensional role "${role.role}" - Total columns generated: ${columns.length}`);
601
+ columns.forEach((col, index) => {
602
+ console.log(` Column ${index}: id=${col.id}, title=${col.title}, type=${col.type}`);
603
+ });
604
+ }
582
605
  const roleInfo = { periodTypes, availableColumnIds };
583
606
  const conceptTrees = [];
584
607
  if ((_a = role.presentationLinkbase) == null ? void 0 : _a.concepts) {
585
608
  role.presentationLinkbase.concepts.forEach((concept) => {
586
- const conceptTree = this.buildConceptTree(concept, 0, periodStartDate, periodEndDate, roleInfo);
609
+ const conceptTree = this.buildConceptTree(concept, 0, periodStartDate, periodEndDate, roleInfo, role.id);
587
610
  if (conceptTree) {
588
611
  conceptTrees.push(conceptTree);
589
612
  }
@@ -592,16 +615,20 @@ class XBRLFormBuilder {
592
615
  return {
593
616
  id: role.id,
594
617
  title,
595
- description: `Section for ${title}`,
618
+ description: role.description || `Section for ${title}`,
596
619
  concepts: conceptTrees,
597
620
  columns,
598
- expanded: false
621
+ expanded: false,
622
+ metadata: {
623
+ roleURI: role.roleURI,
624
+ originalRole: role.role
625
+ }
599
626
  };
600
627
  }
601
628
  /**
602
629
  * Build concept tree from XBRL presentation concept
603
630
  */
604
- static buildConceptTree(concept, level, periodStartDate, periodEndDate, roleInfo) {
631
+ static buildConceptTree(concept, level, periodStartDate, periodEndDate, roleInfo, sectionId) {
605
632
  const label = this.getPreferredLabel(concept.labels);
606
633
  const fields = [];
607
634
  if (!concept.elementAbstract) {
@@ -645,7 +672,7 @@ class XBRLFormBuilder {
645
672
  const children = [];
646
673
  if (concept.children && concept.children.length > 0) {
647
674
  concept.children.forEach((child) => {
648
- const childTree = this.buildConceptTree(child, level + 1, periodStartDate, periodEndDate, roleInfo);
675
+ const childTree = this.buildConceptTree(child, level + 1, periodStartDate, periodEndDate, roleInfo, sectionId);
649
676
  if (childTree) {
650
677
  children.push(childTree);
651
678
  }
@@ -656,7 +683,7 @@ class XBRLFormBuilder {
656
683
  return null;
657
684
  }
658
685
  return {
659
- id: this.createUniqueConceptId(concept),
686
+ id: this.createUniqueConceptId(concept, sectionId),
660
687
  // Use unique ID for form management
661
688
  originalConceptId: concept.id,
662
689
  // Store original for submission data
@@ -861,7 +888,7 @@ class XBRLFormBuilder {
861
888
  console.log("📅 All concepts are instant type, creating single column");
862
889
  columns.push({
863
890
  id: "instant",
864
- title: `As of ${this.formatDateForDisplay(periodStartDate)}`,
891
+ title: `Current`,
865
892
  description: `Values as of ${periodStartDate}`,
866
893
  type: "base",
867
894
  order: 0,
@@ -871,7 +898,7 @@ class XBRLFormBuilder {
871
898
  console.log("📅 All concepts are duration type, creating single column with period range");
872
899
  columns.push({
873
900
  id: "duration",
874
- title: `${this.formatDateForDisplay(periodStartDate)} / ${this.formatDateForDisplay(periodEndDate)}`,
901
+ title: `Current Period`,
875
902
  description: `Period: ${periodStartDate} to ${periodEndDate}`,
876
903
  type: "base",
877
904
  order: 0,
@@ -881,7 +908,7 @@ class XBRLFormBuilder {
881
908
  console.log("📅 Mixed period types found, creating both duration and instant columns");
882
909
  columns.push({
883
910
  id: "duration",
884
- title: `${this.formatDateForDisplay(periodStartDate)} / ${this.formatDateForDisplay(periodEndDate)}`,
911
+ title: `Current Period`,
885
912
  description: `Period: ${periodStartDate} to ${periodEndDate}`,
886
913
  type: "base",
887
914
  order: 0,
@@ -889,7 +916,7 @@ class XBRLFormBuilder {
889
916
  });
890
917
  columns.push({
891
918
  id: "instant",
892
- title: `As of ${this.formatDateForDisplay(periodStartDate)}`,
919
+ title: `Current`,
893
920
  description: `Values as of ${periodStartDate}`,
894
921
  type: "base",
895
922
  order: 1,
@@ -904,7 +931,174 @@ class XBRLFormBuilder {
904
931
  * Generate columns for single dimension scenarios
905
932
  */
906
933
  static generateSingleDimensionColumns(dimension, periodStartDate, periodEndDate, periodTypes) {
907
- var _a, _b;
934
+ var _a, _b, _c, _d, _e;
935
+ console.log(`📊 Processing single dimension:`, {
936
+ id: dimension.id,
937
+ conceptName: dimension.conceptName,
938
+ hasMembers: !!(dimension.members && Array.isArray(dimension.members)),
939
+ membersCount: ((_a = dimension.members) == null ? void 0 : _a.length) || 0,
940
+ hasTypedMember: !!dimension.typedMember,
941
+ typedMemberId: (_b = dimension.typedMember) == null ? void 0 : _b.id
942
+ });
943
+ if (dimension.typedMember && (!dimension.members || dimension.members.length === 0)) {
944
+ console.log(`🔤 Processing typed dimension: ${dimension.id} with typed member: ${dimension.typedMember.id}`);
945
+ const axisLabel2 = ((_c = dimension.labels.find((l2) => l2.role === "http://www.xbrl.org/2003/role/label")) == null ? void 0 : _c.label) || dimension.conceptName;
946
+ const dimensionInfo2 = {
947
+ axisId: dimension.id,
948
+ axisLabel: axisLabel2,
949
+ typedMemberId: dimension.typedMember.id,
950
+ dimensionKey: `${axisLabel2} | [Typed Input]`,
951
+ dimensionIdKey: `${dimension.id}|[typed]`
952
+ };
953
+ console.log(`🔤 Generated typed dimension info:`, dimensionInfo2);
954
+ const columns2 = [];
955
+ if (periodTypes.size === 0) {
956
+ columns2.push({
957
+ id: "typed-default",
958
+ title: axisLabel2,
959
+ description: "Typed dimension input column",
960
+ type: "dimension",
961
+ dimensionData: {
962
+ dimensionId: "typed-default",
963
+ axisId: dimensionInfo2.axisId,
964
+ memberId: "[typed]",
965
+ memberValue: "Typed Input",
966
+ memberLabel: "Typed Input",
967
+ axis: dimensionInfo2.axisLabel,
968
+ axisLabel: dimensionInfo2.axisLabel,
969
+ memberKey: dimensionInfo2.dimensionKey,
970
+ dimensionIdKey: dimensionInfo2.dimensionIdKey,
971
+ hasTypedMembers: true,
972
+ typedMemberId: dimensionInfo2.typedMemberId,
973
+ typedMembers: [{
974
+ axisId: dimensionInfo2.axisId,
975
+ axisLabel: dimensionInfo2.axisLabel,
976
+ typedMemberId: dimensionInfo2.typedMemberId,
977
+ memberLabel: dimensionInfo2.axisLabel
978
+ }]
979
+ },
980
+ order: 0,
981
+ removable: false
982
+ });
983
+ } else if (periodTypes.size === 1 && periodTypes.has("instant")) {
984
+ columns2.push({
985
+ id: "typed-instant",
986
+ title: `${axisLabel2} [Typed Input Available]`,
987
+ description: `Typed values as of ${periodStartDate}`,
988
+ type: "dimension",
989
+ dimensionData: {
990
+ dimensionId: "typed-instant",
991
+ axisId: dimensionInfo2.axisId,
992
+ memberId: "[typed]",
993
+ memberValue: "Typed Input",
994
+ memberLabel: "Typed Input",
995
+ axis: dimensionInfo2.axisLabel,
996
+ axisLabel: dimensionInfo2.axisLabel,
997
+ memberKey: dimensionInfo2.dimensionKey,
998
+ dimensionIdKey: dimensionInfo2.dimensionIdKey,
999
+ hasTypedMembers: true,
1000
+ typedMemberId: dimensionInfo2.typedMemberId,
1001
+ typedMembers: [{
1002
+ axisId: dimensionInfo2.axisId,
1003
+ axisLabel: dimensionInfo2.axisLabel,
1004
+ typedMemberId: dimensionInfo2.typedMemberId,
1005
+ memberLabel: dimensionInfo2.axisLabel
1006
+ }]
1007
+ },
1008
+ order: 0,
1009
+ removable: false
1010
+ });
1011
+ } else if (periodTypes.size === 1 && periodTypes.has("duration")) {
1012
+ columns2.push({
1013
+ id: "typed-duration",
1014
+ title: `${axisLabel2} [Typed Input Available]`,
1015
+ description: `Typed values for period ${periodStartDate} to ${periodEndDate}`,
1016
+ type: "dimension",
1017
+ dimensionData: {
1018
+ dimensionId: "typed-duration",
1019
+ axisId: dimensionInfo2.axisId,
1020
+ memberId: "[typed]",
1021
+ memberValue: "Typed Input",
1022
+ memberLabel: "Typed Input",
1023
+ axis: dimensionInfo2.axisLabel,
1024
+ axisLabel: dimensionInfo2.axisLabel,
1025
+ memberKey: dimensionInfo2.dimensionKey,
1026
+ dimensionIdKey: dimensionInfo2.dimensionIdKey,
1027
+ hasTypedMembers: true,
1028
+ typedMemberId: dimensionInfo2.typedMemberId,
1029
+ typedMembers: [{
1030
+ axisId: dimensionInfo2.axisId,
1031
+ axisLabel: dimensionInfo2.axisLabel,
1032
+ typedMemberId: dimensionInfo2.typedMemberId,
1033
+ memberLabel: dimensionInfo2.axisLabel
1034
+ }]
1035
+ },
1036
+ order: 0,
1037
+ removable: false
1038
+ });
1039
+ } else {
1040
+ columns2.push({
1041
+ id: "typed-duration",
1042
+ title: `${axisLabel2} [Typed Input Available]`,
1043
+ description: `Typed values for period ${periodStartDate} to ${periodEndDate}`,
1044
+ type: "dimension",
1045
+ dimensionData: {
1046
+ dimensionId: "typed-duration",
1047
+ axisId: dimensionInfo2.axisId,
1048
+ memberId: "[typed]",
1049
+ memberValue: "Typed Input",
1050
+ memberLabel: "Typed Input",
1051
+ axis: dimensionInfo2.axisLabel,
1052
+ axisLabel: dimensionInfo2.axisLabel,
1053
+ memberKey: dimensionInfo2.dimensionKey,
1054
+ dimensionIdKey: dimensionInfo2.dimensionIdKey,
1055
+ hasTypedMembers: true,
1056
+ typedMemberId: dimensionInfo2.typedMemberId,
1057
+ typedMembers: [{
1058
+ axisId: dimensionInfo2.axisId,
1059
+ axisLabel: dimensionInfo2.axisLabel,
1060
+ typedMemberId: dimensionInfo2.typedMemberId,
1061
+ memberLabel: dimensionInfo2.axisLabel
1062
+ }]
1063
+ },
1064
+ order: 0,
1065
+ removable: false
1066
+ });
1067
+ columns2.push({
1068
+ id: "typed-instant",
1069
+ title: `${axisLabel2} [Typed Input Available]`,
1070
+ description: `Typed values as of ${periodStartDate}`,
1071
+ type: "dimension",
1072
+ dimensionData: {
1073
+ dimensionId: "typed-instant",
1074
+ axisId: dimensionInfo2.axisId,
1075
+ memberId: "[typed]",
1076
+ memberValue: "Typed Input",
1077
+ memberLabel: "Typed Input",
1078
+ axis: dimensionInfo2.axisLabel,
1079
+ axisLabel: dimensionInfo2.axisLabel,
1080
+ memberKey: dimensionInfo2.dimensionKey,
1081
+ dimensionIdKey: dimensionInfo2.dimensionIdKey,
1082
+ hasTypedMembers: true,
1083
+ typedMemberId: dimensionInfo2.typedMemberId,
1084
+ typedMembers: [{
1085
+ axisId: dimensionInfo2.axisId,
1086
+ axisLabel: dimensionInfo2.axisLabel,
1087
+ typedMemberId: dimensionInfo2.typedMemberId,
1088
+ memberLabel: dimensionInfo2.axisLabel
1089
+ }]
1090
+ },
1091
+ order: 1,
1092
+ removable: false
1093
+ });
1094
+ }
1095
+ console.log(`🔤 Generated ${columns2.length} typed dimension columns`);
1096
+ return columns2;
1097
+ }
1098
+ if (!dimension.members || !Array.isArray(dimension.members)) {
1099
+ console.log(`⚠️ Dimension ${dimension.id} has no members defined and no typed member, skipping column generation`);
1100
+ return [];
1101
+ }
908
1102
  console.log(`📊 Found single dimension:`, {
909
1103
  id: dimension.id,
910
1104
  conceptName: dimension.conceptName,
@@ -913,9 +1107,9 @@ class XBRLFormBuilder {
913
1107
  if (dimension.members.length === 0) {
914
1108
  return [];
915
1109
  }
916
- const axisLabel = ((_a = dimension.labels.find((l2) => l2.role === "http://www.xbrl.org/2003/role/label")) == null ? void 0 : _a.label) || dimension.conceptName;
1110
+ const axisLabel = ((_d = dimension.labels.find((l2) => l2.role === "http://www.xbrl.org/2003/role/label")) == null ? void 0 : _d.label) || dimension.conceptName;
917
1111
  const firstMember = dimension.members[0];
918
- const memberLabel = ((_b = firstMember.labels.find((l2) => l2.role === "http://www.xbrl.org/2003/role/label")) == null ? void 0 : _b.label) || firstMember.conceptName;
1112
+ const memberLabel = ((_e = firstMember.labels.find((l2) => l2.role === "http://www.xbrl.org/2003/role/label")) == null ? void 0 : _e.label) || firstMember.conceptName;
919
1113
  const dimensionInfo = {
920
1114
  axisId: dimension.id,
921
1115
  axisLabel,
@@ -949,7 +1143,7 @@ class XBRLFormBuilder {
949
1143
  } else if (periodTypes.size === 1 && periodTypes.has("instant")) {
950
1144
  columns.push({
951
1145
  id: "instant",
952
- title: `${dimensionInfo.memberLabel} (${this.formatDateForDisplay(periodStartDate)})`,
1146
+ title: `${dimensionInfo.memberLabel}`,
953
1147
  description: `Values as of ${periodStartDate}`,
954
1148
  type: "dimension",
955
1149
  dimensionData: {
@@ -969,7 +1163,7 @@ class XBRLFormBuilder {
969
1163
  } else if (periodTypes.size === 1 && periodTypes.has("duration")) {
970
1164
  columns.push({
971
1165
  id: "duration",
972
- title: `${dimensionInfo.memberLabel} (${this.formatDateForDisplay(periodStartDate)} / ${this.formatDateForDisplay(periodEndDate)})`,
1166
+ title: `${dimensionInfo.memberLabel}`,
973
1167
  description: `Period: ${periodStartDate} to ${periodEndDate}`,
974
1168
  type: "dimension",
975
1169
  dimensionData: {
@@ -989,7 +1183,7 @@ class XBRLFormBuilder {
989
1183
  } else {
990
1184
  columns.push({
991
1185
  id: "duration",
992
- title: `${dimensionInfo.memberLabel} (${this.formatDateForDisplay(periodStartDate)} / ${this.formatDateForDisplay(periodEndDate)})`,
1186
+ title: `${dimensionInfo.memberLabel}`,
993
1187
  description: `Period: ${periodStartDate} to ${periodEndDate}`,
994
1188
  type: "dimension",
995
1189
  dimensionData: {
@@ -1008,7 +1202,7 @@ class XBRLFormBuilder {
1008
1202
  });
1009
1203
  columns.push({
1010
1204
  id: "instant",
1011
- title: `${dimensionInfo.memberLabel} (${this.formatDateForDisplay(periodStartDate)})`,
1205
+ title: `${dimensionInfo.memberLabel}`,
1012
1206
  description: `Values as of ${periodStartDate}`,
1013
1207
  type: "dimension",
1014
1208
  dimensionData: {
@@ -1033,13 +1227,55 @@ class XBRLFormBuilder {
1033
1227
  */
1034
1228
  static generateMultiDimensionColumns(dimensions, periodStartDate, periodEndDate, periodTypes) {
1035
1229
  console.log(`📊 Processing ${dimensions.length} dimensions for multi-dimensional columns`);
1036
- const dimensionInfos = dimensions.map((dimension) => {
1230
+ console.log(`🔍 [DEBUG] Input dimensions:`, dimensions.map((d2) => {
1231
+ var _a, _b, _c;
1232
+ return {
1233
+ id: d2.id,
1234
+ label: (_b = (_a = d2.labels) == null ? void 0 : _a.find((l2) => l2.role === "http://www.xbrl.org/2003/role/label")) == null ? void 0 : _b.label,
1235
+ membersCount: ((_c = d2.members) == null ? void 0 : _c.length) || 0,
1236
+ hasTypedMember: !!d2.typedMember
1237
+ };
1238
+ }));
1239
+ const hasTypedMembers = dimensions.some((dimension) => dimension.typedMember);
1240
+ if (hasTypedMembers) {
1241
+ console.log(`🔤 Found typed members in dimensions - will indicate in column headers`);
1242
+ }
1243
+ const validDimensions = dimensions.filter((dimension) => {
1244
+ if (dimension.typedMember) {
1245
+ console.log(`🔤 Keeping typed dimension: ${dimension.id} with typed member: ${dimension.typedMember.id}`);
1246
+ return true;
1247
+ }
1248
+ if (dimension.members && Array.isArray(dimension.members) && dimension.members.length > 0) {
1249
+ console.log(`📂 Keeping domain dimension: ${dimension.id} with ${dimension.members.length} members`);
1250
+ return true;
1251
+ }
1252
+ console.log(`⚠️ Skipping dimension ${dimension.id} - no members or typed member defined`);
1253
+ return false;
1254
+ });
1255
+ if (validDimensions.length === 0) {
1256
+ console.log(`⚠️ No valid dimensions with members found, skipping multi-dimensional column generation`);
1257
+ return [];
1258
+ }
1259
+ const dimensionInfos = validDimensions.map((dimension) => {
1037
1260
  var _a;
1038
1261
  const axisLabel = ((_a = dimension.labels.find((l2) => l2.role === "http://www.xbrl.org/2003/role/label")) == null ? void 0 : _a.label) || dimension.conceptName;
1262
+ if (dimension.typedMember) {
1263
+ return {
1264
+ id: dimension.id,
1265
+ axisLabel,
1266
+ isTyped: true,
1267
+ typedMemberId: dimension.typedMember.id,
1268
+ members: [{
1269
+ id: "[typed]",
1270
+ label: `${axisLabel} [Typed Input Available]`
1271
+ }]
1272
+ };
1273
+ }
1039
1274
  const allMembers = this.getAllDimensionMembers(dimension.members);
1040
1275
  return {
1041
1276
  id: dimension.id,
1042
1277
  axisLabel,
1278
+ isTyped: false,
1043
1279
  members: allMembers.map((member) => {
1044
1280
  var _a2;
1045
1281
  return {
@@ -1051,28 +1287,63 @@ class XBRLFormBuilder {
1051
1287
  });
1052
1288
  const combinations = this.generateDimensionCombinations(dimensionInfos);
1053
1289
  console.log(`📊 Generated ${combinations.length} dimension combinations`);
1290
+ console.log(`🔍 [DEBUG] Generated combinations:`, combinations.map((combo) => ({
1291
+ memberLabels: combo.map((c2) => c2.memberLabel),
1292
+ axisIds: combo.map((c2) => c2.axisId),
1293
+ memberIds: combo.map((c2) => c2.memberId)
1294
+ })));
1054
1295
  const columns = [];
1055
1296
  combinations.forEach((combination, index) => {
1297
+ var _a, _b;
1056
1298
  const columnTitle = combination.map((c2) => c2.memberLabel).join(" | ");
1299
+ const typedMembers = combination.filter((c2) => c2.isTyped);
1300
+ const domainMembers = combination.filter((c2) => !c2.isTyped);
1301
+ console.log(`🔍 [Column ${index}] Combination analysis:`, {
1302
+ totalMembers: combination.length,
1303
+ typedMembers: typedMembers.length,
1304
+ domainMembers: domainMembers.length,
1305
+ hasTypedMembers: typedMembers.length > 0,
1306
+ columnTitle,
1307
+ memberLabels: combination.map((c2) => c2.memberLabel),
1308
+ memberIds: combination.map((c2) => c2.memberId)
1309
+ });
1057
1310
  const dimensionData = {
1058
1311
  dimensionId: `multi_${index}`,
1059
1312
  memberValue: columnTitle,
1060
1313
  // Required field
1061
1314
  memberLabel: columnTitle,
1062
1315
  // Required field
1063
- combinations: combination.map((c2) => ({
1316
+ combinations: domainMembers.map((c2) => ({
1064
1317
  axisId: c2.axisId,
1065
1318
  axisLabel: c2.axisLabel,
1066
1319
  memberId: c2.memberId,
1067
1320
  memberLabel: c2.memberLabel
1068
1321
  })),
1322
+ // Add typed member information for form fields
1323
+ typedMembers: typedMembers.map((c2) => ({
1324
+ axisId: c2.axisId,
1325
+ axisLabel: c2.axisLabel,
1326
+ typedMemberId: c2.typedMemberId,
1327
+ memberLabel: c2.memberLabel
1328
+ })),
1329
+ hasTypedMembers: typedMembers.length > 0,
1069
1330
  memberKey: columnTitle,
1070
- dimensionIdKey: combination.map((c2) => `${c2.axisId}|${c2.memberId}`).join("::")
1331
+ dimensionIdKey: [
1332
+ ...domainMembers.map((c2) => `${c2.axisId}|${c2.memberId}`),
1333
+ ...typedMembers.map((c2) => `${c2.axisId}|[typed]`)
1334
+ ].join("::")
1071
1335
  };
1336
+ console.log(`🔍 [Column ${index}] Final dimension data:`, {
1337
+ dimensionId: dimensionData.dimensionId,
1338
+ memberLabel: dimensionData.memberLabel,
1339
+ dimensionIdKey: dimensionData.dimensionIdKey,
1340
+ combinationsCount: (_a = dimensionData.combinations) == null ? void 0 : _a.length,
1341
+ typedMembersCount: (_b = dimensionData.typedMembers) == null ? void 0 : _b.length
1342
+ });
1072
1343
  if (periodTypes.size === 0 || periodTypes.size === 1 && periodTypes.has("duration")) {
1073
1344
  columns.push({
1074
1345
  id: `duration_${index}`,
1075
- title: `${columnTitle} (${this.formatDateForDisplay(periodStartDate)} / ${this.formatDateForDisplay(periodEndDate)})`,
1346
+ title: `${columnTitle}`,
1076
1347
  description: `Period: ${periodStartDate} to ${periodEndDate}`,
1077
1348
  type: "dimension",
1078
1349
  dimensionData: {
@@ -1085,7 +1356,7 @@ class XBRLFormBuilder {
1085
1356
  } else if (periodTypes.size === 1 && periodTypes.has("instant")) {
1086
1357
  columns.push({
1087
1358
  id: `instant_${index}`,
1088
- title: `${columnTitle} (${this.formatDateForDisplay(periodStartDate)})`,
1359
+ title: `${columnTitle}`,
1089
1360
  description: `Values as of ${periodStartDate}`,
1090
1361
  type: "dimension",
1091
1362
  dimensionData: {
@@ -1098,7 +1369,7 @@ class XBRLFormBuilder {
1098
1369
  } else {
1099
1370
  columns.push({
1100
1371
  id: `duration_${index}`,
1101
- title: `${columnTitle} (${this.formatDateForDisplay(periodStartDate)} / ${this.formatDateForDisplay(periodEndDate)})`,
1372
+ title: `${columnTitle}`,
1102
1373
  description: `Period: ${periodStartDate} to ${periodEndDate}`,
1103
1374
  type: "dimension",
1104
1375
  dimensionData: {
@@ -1110,7 +1381,7 @@ class XBRLFormBuilder {
1110
1381
  });
1111
1382
  columns.push({
1112
1383
  id: `instant_${index}`,
1113
- title: `${columnTitle} (${this.formatDateForDisplay(periodStartDate)})`,
1384
+ title: `${columnTitle}`,
1114
1385
  description: `Values as of ${periodStartDate}`,
1115
1386
  type: "dimension",
1116
1387
  dimensionData: {
@@ -1129,6 +1400,9 @@ class XBRLFormBuilder {
1129
1400
  * Get all members including children recursively
1130
1401
  */
1131
1402
  static getAllDimensionMembers(members) {
1403
+ if (!members || !Array.isArray(members)) {
1404
+ return [];
1405
+ }
1132
1406
  const allMembers = [];
1133
1407
  members.forEach((member) => {
1134
1408
  allMembers.push(member);
@@ -1149,7 +1423,9 @@ class XBRLFormBuilder {
1149
1423
  axisId: dimensionInfos[0].id,
1150
1424
  axisLabel: dimensionInfos[0].axisLabel,
1151
1425
  memberId: member.id,
1152
- memberLabel: member.label
1426
+ memberLabel: member.label,
1427
+ isTyped: dimensionInfos[0].isTyped || false,
1428
+ typedMemberId: dimensionInfos[0].typedMemberId
1153
1429
  }]);
1154
1430
  }
1155
1431
  const [firstDimension, ...restDimensions] = dimensionInfos;
@@ -1161,7 +1437,9 @@ class XBRLFormBuilder {
1161
1437
  axisId: firstDimension.id,
1162
1438
  axisLabel: firstDimension.axisLabel,
1163
1439
  memberId: member.id,
1164
- memberLabel: member.label
1440
+ memberLabel: member.label,
1441
+ isTyped: firstDimension.isTyped || false,
1442
+ typedMemberId: firstDimension.typedMemberId
1165
1443
  }]);
1166
1444
  } else {
1167
1445
  restCombinations.forEach((restCombination) => {
@@ -1170,7 +1448,9 @@ class XBRLFormBuilder {
1170
1448
  axisId: firstDimension.id,
1171
1449
  axisLabel: firstDimension.axisLabel,
1172
1450
  memberId: member.id,
1173
- memberLabel: member.label
1451
+ memberLabel: member.label,
1452
+ isTyped: firstDimension.isTyped || false,
1453
+ typedMemberId: firstDimension.typedMemberId
1174
1454
  },
1175
1455
  ...restCombination
1176
1456
  ]);
@@ -1232,15 +1512,15 @@ class XBRLFormBuilder {
1232
1512
  }];
1233
1513
  }
1234
1514
  }
1235
- var __defProp$4 = Object.defineProperty;
1236
- var __getOwnPropDesc$4 = Object.getOwnPropertyDescriptor;
1237
- var __decorateClass$4 = (decorators, target, key, kind) => {
1238
- var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$4(target, key) : target;
1515
+ var __defProp$5 = Object.defineProperty;
1516
+ var __getOwnPropDesc$5 = Object.getOwnPropertyDescriptor;
1517
+ var __decorateClass$5 = (decorators, target, key, kind) => {
1518
+ var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$5(target, key) : target;
1239
1519
  for (var i2 = decorators.length - 1, decorator; i2 >= 0; i2--)
1240
1520
  if (decorator = decorators[i2])
1241
1521
  result = (kind ? decorator(target, key, result) : decorator(result)) || result;
1242
1522
  if (kind && result)
1243
- __defProp$4(target, key, result);
1523
+ __defProp$5(target, key, result);
1244
1524
  return result;
1245
1525
  };
1246
1526
  let JupiterFormField = class extends LitElement {
@@ -1545,45 +1825,45 @@ JupiterFormField.styles = css`
1545
1825
  width: auto;
1546
1826
  }
1547
1827
  `;
1548
- __decorateClass$4([
1549
- n2({ type: Object })
1828
+ __decorateClass$5([
1829
+ n$1({ type: Object })
1550
1830
  ], JupiterFormField.prototype, "field", 2);
1551
- __decorateClass$4([
1552
- n2({ type: String })
1831
+ __decorateClass$5([
1832
+ n$1({ type: String })
1553
1833
  ], JupiterFormField.prototype, "conceptId", 2);
1554
- __decorateClass$4([
1555
- n2({ type: String })
1834
+ __decorateClass$5([
1835
+ n$1({ type: String })
1556
1836
  ], JupiterFormField.prototype, "columnId", 2);
1557
- __decorateClass$4([
1558
- n2()
1837
+ __decorateClass$5([
1838
+ n$1()
1559
1839
  ], JupiterFormField.prototype, "value", 2);
1560
- __decorateClass$4([
1561
- n2({ type: Boolean })
1840
+ __decorateClass$5([
1841
+ n$1({ type: Boolean })
1562
1842
  ], JupiterFormField.prototype, "disabled", 2);
1563
- __decorateClass$4([
1564
- n2({ type: String })
1843
+ __decorateClass$5([
1844
+ n$1({ type: String })
1565
1845
  ], JupiterFormField.prototype, "locale", 2);
1566
- __decorateClass$4([
1567
- n2({ type: Boolean })
1846
+ __decorateClass$5([
1847
+ n$1({ type: Boolean })
1568
1848
  ], JupiterFormField.prototype, "hideLabel", 2);
1569
- __decorateClass$4([
1570
- r()
1849
+ __decorateClass$5([
1850
+ r$1()
1571
1851
  ], JupiterFormField.prototype, "_errors", 2);
1572
- __decorateClass$4([
1573
- r()
1852
+ __decorateClass$5([
1853
+ r$1()
1574
1854
  ], JupiterFormField.prototype, "_touched", 2);
1575
- JupiterFormField = __decorateClass$4([
1576
- t$1("jupiter-form-field")
1855
+ JupiterFormField = __decorateClass$5([
1856
+ t$3("jupiter-form-field")
1577
1857
  ], JupiterFormField);
1578
- var __defProp$3 = Object.defineProperty;
1579
- var __getOwnPropDesc$3 = Object.getOwnPropertyDescriptor;
1580
- var __decorateClass$3 = (decorators, target, key, kind) => {
1581
- var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$3(target, key) : target;
1858
+ var __defProp$4 = Object.defineProperty;
1859
+ var __getOwnPropDesc$4 = Object.getOwnPropertyDescriptor;
1860
+ var __decorateClass$4 = (decorators, target, key, kind) => {
1861
+ var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$4(target, key) : target;
1582
1862
  for (var i2 = decorators.length - 1, decorator; i2 >= 0; i2--)
1583
1863
  if (decorator = decorators[i2])
1584
1864
  result = (kind ? decorator(target, key, result) : decorator(result)) || result;
1585
1865
  if (kind && result)
1586
- __defProp$3(target, key, result);
1866
+ __defProp$4(target, key, result);
1587
1867
  return result;
1588
1868
  };
1589
1869
  let JupiterConceptTree = class extends LitElement {
@@ -1776,40 +2056,42 @@ JupiterConceptTree.styles = css`
1776
2056
  .children-wrapper {
1777
2057
  display: none;
1778
2058
  }
2059
+
2060
+
1779
2061
  `;
1780
- __decorateClass$3([
1781
- n2({ type: Object })
2062
+ __decorateClass$4([
2063
+ n$1({ type: Object })
1782
2064
  ], JupiterConceptTree.prototype, "concept", 2);
1783
- __decorateClass$3([
1784
- n2({ type: Array })
2065
+ __decorateClass$4([
2066
+ n$1({ type: Array })
1785
2067
  ], JupiterConceptTree.prototype, "columns", 2);
1786
- __decorateClass$3([
1787
- n2({ type: Object })
2068
+ __decorateClass$4([
2069
+ n$1({ type: Object })
1788
2070
  ], JupiterConceptTree.prototype, "formData", 2);
1789
- __decorateClass$3([
1790
- n2({ type: Boolean })
2071
+ __decorateClass$4([
2072
+ n$1({ type: Boolean })
1791
2073
  ], JupiterConceptTree.prototype, "disabled", 2);
1792
- __decorateClass$3([
1793
- n2({ type: String })
2074
+ __decorateClass$4([
2075
+ n$1({ type: String })
1794
2076
  ], JupiterConceptTree.prototype, "locale", 2);
1795
- __decorateClass$3([
1796
- n2({ type: Set })
2077
+ __decorateClass$4([
2078
+ n$1({ type: Set })
1797
2079
  ], JupiterConceptTree.prototype, "expandedConcepts", 2);
1798
- __decorateClass$3([
1799
- r()
2080
+ __decorateClass$4([
2081
+ r$1()
1800
2082
  ], JupiterConceptTree.prototype, "_expanded", 2);
1801
- JupiterConceptTree = __decorateClass$3([
1802
- t$1("jupiter-concept-tree")
2083
+ JupiterConceptTree = __decorateClass$4([
2084
+ t$3("jupiter-concept-tree")
1803
2085
  ], JupiterConceptTree);
1804
- var __defProp$2 = Object.defineProperty;
1805
- var __getOwnPropDesc$2 = Object.getOwnPropertyDescriptor;
1806
- var __decorateClass$2 = (decorators, target, key, kind) => {
1807
- var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$2(target, key) : target;
2086
+ var __defProp$3 = Object.defineProperty;
2087
+ var __getOwnPropDesc$3 = Object.getOwnPropertyDescriptor;
2088
+ var __decorateClass$3 = (decorators, target, key, kind) => {
2089
+ var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$3(target, key) : target;
1808
2090
  for (var i2 = decorators.length - 1, decorator; i2 >= 0; i2--)
1809
2091
  if (decorator = decorators[i2])
1810
2092
  result = (kind ? decorator(target, key, result) : decorator(result)) || result;
1811
2093
  if (kind && result)
1812
- __defProp$2(target, key, result);
2094
+ __defProp$3(target, key, result);
1813
2095
  return result;
1814
2096
  };
1815
2097
  let JupiterAddColumnDialog = class extends LitElement {
@@ -2107,36 +2389,36 @@ JupiterAddColumnDialog.styles = css`
2107
2389
  cursor: not-allowed;
2108
2390
  }
2109
2391
  `;
2110
- __decorateClass$2([
2111
- n2({ type: String })
2392
+ __decorateClass$3([
2393
+ n$1({ type: String })
2112
2394
  ], JupiterAddColumnDialog.prototype, "periodType", 2);
2113
- __decorateClass$2([
2114
- n2({ type: Boolean })
2395
+ __decorateClass$3([
2396
+ n$1({ type: Boolean })
2115
2397
  ], JupiterAddColumnDialog.prototype, "open", 2);
2116
- __decorateClass$2([
2117
- r()
2398
+ __decorateClass$3([
2399
+ r$1()
2118
2400
  ], JupiterAddColumnDialog.prototype, "_startDate", 2);
2119
- __decorateClass$2([
2120
- r()
2401
+ __decorateClass$3([
2402
+ r$1()
2121
2403
  ], JupiterAddColumnDialog.prototype, "_endDate", 2);
2122
- __decorateClass$2([
2123
- r()
2404
+ __decorateClass$3([
2405
+ r$1()
2124
2406
  ], JupiterAddColumnDialog.prototype, "_instantDate", 2);
2125
- __decorateClass$2([
2126
- r()
2407
+ __decorateClass$3([
2408
+ r$1()
2127
2409
  ], JupiterAddColumnDialog.prototype, "_selectedType", 2);
2128
- JupiterAddColumnDialog = __decorateClass$2([
2129
- t$1("jupiter-add-column-dialog")
2410
+ JupiterAddColumnDialog = __decorateClass$3([
2411
+ t$3("jupiter-add-column-dialog")
2130
2412
  ], JupiterAddColumnDialog);
2131
- var __defProp$1 = Object.defineProperty;
2132
- var __getOwnPropDesc$1 = Object.getOwnPropertyDescriptor;
2133
- var __decorateClass$1 = (decorators, target, key, kind) => {
2134
- var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$1(target, key) : target;
2413
+ var __defProp$2 = Object.defineProperty;
2414
+ var __getOwnPropDesc$2 = Object.getOwnPropertyDescriptor;
2415
+ var __decorateClass$2 = (decorators, target, key, kind) => {
2416
+ var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$2(target, key) : target;
2135
2417
  for (var i2 = decorators.length - 1, decorator; i2 >= 0; i2--)
2136
2418
  if (decorator = decorators[i2])
2137
2419
  result = (kind ? decorator(target, key, result) : decorator(result)) || result;
2138
2420
  if (kind && result)
2139
- __defProp$1(target, key, result);
2421
+ __defProp$2(target, key, result);
2140
2422
  return result;
2141
2423
  };
2142
2424
  let JupiterFormSection = class extends LitElement {
@@ -2144,6 +2426,7 @@ let JupiterFormSection = class extends LitElement {
2144
2426
  super(...arguments);
2145
2427
  this.columns = [];
2146
2428
  this.formData = {};
2429
+ this.typedMemberData = {};
2147
2430
  this.disabled = false;
2148
2431
  this.collapsible = true;
2149
2432
  this.locale = "en-US";
@@ -2302,6 +2585,23 @@ let JupiterFormSection = class extends LitElement {
2302
2585
  bubbles: true
2303
2586
  }));
2304
2587
  }
2588
+ _getTypedMemberHeaderValue(columnId, axisId) {
2589
+ var _a;
2590
+ return ((_a = this.typedMemberData[columnId]) == null ? void 0 : _a[axisId]) || "";
2591
+ }
2592
+ _handleTypedMemberHeaderChange(event, columnId, axisId) {
2593
+ const target = event.target;
2594
+ const value = target.value;
2595
+ console.log(`🔍 [FormSection] Typed member header change: columnId=${columnId}, axisId=${axisId}, value=${value}`);
2596
+ this.dispatchEvent(new CustomEvent("typed-member-change", {
2597
+ detail: {
2598
+ columnId,
2599
+ axisId,
2600
+ value
2601
+ },
2602
+ bubbles: true
2603
+ }));
2604
+ }
2305
2605
  render() {
2306
2606
  if (!this.section.concepts || this.section.concepts.length === 0) {
2307
2607
  return html`
@@ -2345,22 +2645,47 @@ let JupiterFormSection = class extends LitElement {
2345
2645
  <thead class="table-header">
2346
2646
  <tr class="header-row">
2347
2647
  <th class="header-cell concept-column">Concept</th>
2348
- ${this.columns.map((column) => html`
2648
+ ${this.columns.map((column) => {
2649
+ var _a, _b, _c;
2650
+ return html`
2349
2651
  <th class="header-cell ${column.removable ? "removable" : ""}">
2350
- ${column.title}
2351
- ${column.description ? html`<div style="font-weight: normal; font-size: 12px; color: var(--jupiter-text-secondary, #666);">${column.description}</div>` : ""}
2352
- ${column.removable ? html`
2353
- <button
2354
- class="remove-column-btn"
2355
- @click="${(e2) => {
2356
- e2.stopPropagation();
2357
- this._handleRemoveColumn(column.id);
2358
- }}"
2359
- title="Remove column"
2360
- >×</button>
2361
- ` : ""}
2652
+ <div class="column-header-content">
2653
+ <div class="column-title">
2654
+ ${column.title}
2655
+ ${column.description ? html`<div style="font-weight: normal; font-size: 12px; color: var(--jupiter-text-secondary, #666);">${column.description}</div>` : ""}
2656
+ </div>
2657
+
2658
+ <!-- Typed member input fields in column header -->
2659
+ ${((_a = column.dimensionData) == null ? void 0 : _a.hasTypedMembers) ? html`
2660
+ <div class="typed-members-header">
2661
+ ${(_c = (_b = column.dimensionData) == null ? void 0 : _b.typedMembers) == null ? void 0 : _c.map((typedMember) => html`
2662
+ <div class="typed-member-header-input">
2663
+ <input
2664
+ type="text"
2665
+ class="typed-member-header-field"
2666
+ placeholder="Enter ${typedMember.axisLabel}"
2667
+ .value="${this._getTypedMemberHeaderValue(column.id, typedMember.axisId)}"
2668
+ @input="${(e2) => this._handleTypedMemberHeaderChange(e2, column.id, typedMember.axisId)}"
2669
+ />
2670
+ </div>
2671
+ `)}
2672
+ </div>
2673
+ ` : ""}
2674
+
2675
+ ${column.removable ? html`
2676
+ <button
2677
+ class="remove-column-btn"
2678
+ @click="${(e2) => {
2679
+ e2.stopPropagation();
2680
+ this._handleRemoveColumn(column.id);
2681
+ }}"
2682
+ title="Remove column"
2683
+ >×</button>
2684
+ ` : ""}
2685
+ </div>
2362
2686
  </th>
2363
- `)}
2687
+ `;
2688
+ })}
2364
2689
  <th class="header-cell">
2365
2690
  <button class="add-column-btn" @click="${(e2) => {
2366
2691
  e2.stopPropagation();
@@ -2559,6 +2884,63 @@ JupiterFormSection.styles = css`
2559
2884
  background: var(--jupiter-primary-color-dark, #5a6fd8);
2560
2885
  }
2561
2886
 
2887
+ /* Column header content styling */
2888
+ .column-header-content {
2889
+ display: flex;
2890
+ flex-direction: column;
2891
+ gap: 8px;
2892
+ align-items: center;
2893
+ }
2894
+
2895
+ .column-title {
2896
+ text-align: center;
2897
+ }
2898
+
2899
+ /* Typed member header input styles */
2900
+ .typed-members-header {
2901
+ display: flex;
2902
+ flex-direction: column;
2903
+ gap: 4px;
2904
+ width: 100%;
2905
+ padding: 8px;
2906
+ background: var(--jupiter-typed-member-header-background, #f8f9fa);
2907
+ border-radius: 4px;
2908
+ border: 1px solid var(--jupiter-border-color, #e0e0e0);
2909
+ }
2910
+
2911
+ .typed-member-header-input {
2912
+ display: flex;
2913
+ flex-direction: column;
2914
+ gap: 2px;
2915
+ }
2916
+
2917
+ .typed-member-header-label {
2918
+ font-size: 11px;
2919
+ font-weight: 500;
2920
+ color: var(--jupiter-text-secondary, #666);
2921
+ text-align: left;
2922
+ }
2923
+
2924
+ .typed-member-header-field {
2925
+ width: 100%;
2926
+ padding: 4px 6px;
2927
+ border: 1px solid var(--jupiter-border-color, #ddd);
2928
+ border-radius: 3px;
2929
+ font-size: 12px;
2930
+ background: var(--jupiter-input-background, #fff);
2931
+ }
2932
+
2933
+ .typed-member-header-field:focus {
2934
+ outline: none;
2935
+ border-color: var(--jupiter-primary-color, #1976d2);
2936
+ box-shadow: 0 0 0 1px var(--jupiter-primary-color, #1976d2);
2937
+ }
2938
+
2939
+ .typed-member-header-field::placeholder {
2940
+ color: var(--jupiter-text-placeholder, #999);
2941
+ font-size: 11px;
2942
+ }
2943
+
2562
2944
  .empty-section {
2563
2945
  padding: 24px;
2564
2946
  text-align: center;
@@ -2566,74 +2948,971 @@ JupiterFormSection.styles = css`
2566
2948
  font-style: italic;
2567
2949
  }
2568
2950
  `;
2569
- __decorateClass$1([
2570
- n2({ type: Object })
2951
+ __decorateClass$2([
2952
+ n$1({ type: Object })
2571
2953
  ], JupiterFormSection.prototype, "section", 2);
2572
- __decorateClass$1([
2573
- n2({ type: Array })
2954
+ __decorateClass$2([
2955
+ n$1({ type: Array })
2574
2956
  ], JupiterFormSection.prototype, "columns", 2);
2575
- __decorateClass$1([
2576
- n2({ type: Object })
2957
+ __decorateClass$2([
2958
+ n$1({ type: Object })
2577
2959
  ], JupiterFormSection.prototype, "formData", 2);
2578
- __decorateClass$1([
2579
- n2({ type: Boolean })
2960
+ __decorateClass$2([
2961
+ n$1({ type: Object })
2962
+ ], JupiterFormSection.prototype, "typedMemberData", 2);
2963
+ __decorateClass$2([
2964
+ n$1({ type: Boolean })
2580
2965
  ], JupiterFormSection.prototype, "disabled", 2);
2581
- __decorateClass$1([
2582
- n2({ type: Boolean })
2966
+ __decorateClass$2([
2967
+ n$1({ type: Boolean })
2583
2968
  ], JupiterFormSection.prototype, "collapsible", 2);
2584
- __decorateClass$1([
2585
- n2({ type: String })
2969
+ __decorateClass$2([
2970
+ n$1({ type: String })
2586
2971
  ], JupiterFormSection.prototype, "locale", 2);
2587
- __decorateClass$1([
2588
- r()
2972
+ __decorateClass$2([
2973
+ r$1()
2589
2974
  ], JupiterFormSection.prototype, "_expanded", 2);
2590
- __decorateClass$1([
2591
- r()
2975
+ __decorateClass$2([
2976
+ r$1()
2592
2977
  ], JupiterFormSection.prototype, "_showAddColumnDialog", 2);
2593
- __decorateClass$1([
2594
- r()
2978
+ __decorateClass$2([
2979
+ r$1()
2595
2980
  ], JupiterFormSection.prototype, "_sectionPeriodType", 2);
2596
- __decorateClass$1([
2597
- r()
2981
+ __decorateClass$2([
2982
+ r$1()
2598
2983
  ], JupiterFormSection.prototype, "_expandedConcepts", 2);
2599
- JupiterFormSection = __decorateClass$1([
2600
- t$1("jupiter-form-section")
2984
+ JupiterFormSection = __decorateClass$2([
2985
+ t$3("jupiter-form-section")
2601
2986
  ], JupiterFormSection);
2602
- var __defProp = Object.defineProperty;
2603
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
2604
- var __decorateClass = (decorators, target, key, kind) => {
2605
- var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc(target, key) : target;
2606
- for (var i2 = decorators.length - 1, decorator; i2 >= 0; i2--)
2607
- if (decorator = decorators[i2])
2608
- result = (kind ? decorator(target, key, result) : decorator(result)) || result;
2609
- if (kind && result)
2610
- __defProp(target, key, result);
2611
- return result;
2987
+ /**
2988
+ * @license
2989
+ * Copyright 2017 Google LLC
2990
+ * SPDX-License-Identifier: BSD-3-Clause
2991
+ */
2992
+ const t$1 = globalThis, i$1 = t$1.trustedTypes, s = i$1 ? i$1.createPolicy("lit-html", { createHTML: (t2) => t2 }) : void 0, e$2 = "$lit$", h = `lit$${Math.random().toFixed(9).slice(2)}$`, o$1 = "?" + h, n2 = `<${o$1}>`, r = document, l = () => r.createComment(""), c = (t2) => null === t2 || "object" != typeof t2 && "function" != typeof t2, a = Array.isArray, u = (t2) => a(t2) || "function" == typeof (t2 == null ? void 0 : t2[Symbol.iterator]), d = "[ \n\f\r]", f = /<(?:(!--|\/[^a-zA-Z])|(\/?[a-zA-Z][^>\s]*)|(\/?$))/g, v = /-->/g, _ = />/g, m = RegExp(`>|${d}(?:([^\\s"'>=/]+)(${d}*=${d}*(?:[^
2993
+ \f\r"'\`<>=]|("|')|))|$)`, "g"), p = /'/g, g = /"/g, $ = /^(?:script|style|textarea|title)$/i, T = Symbol.for("lit-noChange"), E = Symbol.for("lit-nothing"), A = /* @__PURE__ */ new WeakMap(), C = r.createTreeWalker(r, 129);
2994
+ function P(t2, i2) {
2995
+ if (!a(t2) || !t2.hasOwnProperty("raw"))
2996
+ throw Error("invalid template strings array");
2997
+ return void 0 !== s ? s.createHTML(i2) : i2;
2998
+ }
2999
+ const V = (t2, i2) => {
3000
+ const s2 = t2.length - 1, o2 = [];
3001
+ let r2, l2 = 2 === i2 ? "<svg>" : 3 === i2 ? "<math>" : "", c2 = f;
3002
+ for (let i3 = 0; i3 < s2; i3++) {
3003
+ const s3 = t2[i3];
3004
+ let a2, u2, d2 = -1, y2 = 0;
3005
+ for (; y2 < s3.length && (c2.lastIndex = y2, u2 = c2.exec(s3), null !== u2); )
3006
+ y2 = c2.lastIndex, c2 === f ? "!--" === u2[1] ? c2 = v : void 0 !== u2[1] ? c2 = _ : void 0 !== u2[2] ? ($.test(u2[2]) && (r2 = RegExp("</" + u2[2], "g")), c2 = m) : void 0 !== u2[3] && (c2 = m) : c2 === m ? ">" === u2[0] ? (c2 = r2 ?? f, d2 = -1) : void 0 === u2[1] ? d2 = -2 : (d2 = c2.lastIndex - u2[2].length, a2 = u2[1], c2 = void 0 === u2[3] ? m : '"' === u2[3] ? g : p) : c2 === g || c2 === p ? c2 = m : c2 === v || c2 === _ ? c2 = f : (c2 = m, r2 = void 0);
3007
+ const x = c2 === m && t2[i3 + 1].startsWith("/>") ? " " : "";
3008
+ l2 += c2 === f ? s3 + n2 : d2 >= 0 ? (o2.push(a2), s3.slice(0, d2) + e$2 + s3.slice(d2) + h + x) : s3 + h + (-2 === d2 ? i3 : x);
3009
+ }
3010
+ return [P(t2, l2 + (t2[s2] || "<?>") + (2 === i2 ? "</svg>" : 3 === i2 ? "</math>" : "")), o2];
2612
3011
  };
2613
- let JupiterDynamicForm = class extends LitElement {
2614
- constructor() {
2615
- super(...arguments);
2616
- this.config = {};
2617
- this.initialData = {};
2618
- this.disabled = false;
2619
- this.readonly = false;
2620
- this.periodStartDate = "2025-01-01";
2621
- this.periodEndDate = "2025-12-31";
2622
- this._formData = {};
2623
- this._columns = [];
2624
- this._errors = [];
2625
- this._touched = /* @__PURE__ */ new Set();
2626
- this._dirty = false;
2627
- this._valid = true;
2628
- this._submitted = false;
3012
+ class N {
3013
+ constructor({ strings: t2, _$litType$: s2 }, n3) {
3014
+ let r2;
3015
+ this.parts = [];
3016
+ let c2 = 0, a2 = 0;
3017
+ const u2 = t2.length - 1, d2 = this.parts, [f2, v2] = V(t2, s2);
3018
+ if (this.el = N.createElement(f2, n3), C.currentNode = this.el.content, 2 === s2 || 3 === s2) {
3019
+ const t3 = this.el.content.firstChild;
3020
+ t3.replaceWith(...t3.childNodes);
3021
+ }
3022
+ for (; null !== (r2 = C.nextNode()) && d2.length < u2; ) {
3023
+ if (1 === r2.nodeType) {
3024
+ if (r2.hasAttributes())
3025
+ for (const t3 of r2.getAttributeNames())
3026
+ if (t3.endsWith(e$2)) {
3027
+ const i2 = v2[a2++], s3 = r2.getAttribute(t3).split(h), e2 = /([.?@])?(.*)/.exec(i2);
3028
+ d2.push({ type: 1, index: c2, name: e2[2], strings: s3, ctor: "." === e2[1] ? H : "?" === e2[1] ? I : "@" === e2[1] ? L : k }), r2.removeAttribute(t3);
3029
+ } else
3030
+ t3.startsWith(h) && (d2.push({ type: 6, index: c2 }), r2.removeAttribute(t3));
3031
+ if ($.test(r2.tagName)) {
3032
+ const t3 = r2.textContent.split(h), s3 = t3.length - 1;
3033
+ if (s3 > 0) {
3034
+ r2.textContent = i$1 ? i$1.emptyScript : "";
3035
+ for (let i2 = 0; i2 < s3; i2++)
3036
+ r2.append(t3[i2], l()), C.nextNode(), d2.push({ type: 2, index: ++c2 });
3037
+ r2.append(t3[s3], l());
3038
+ }
3039
+ }
3040
+ } else if (8 === r2.nodeType)
3041
+ if (r2.data === o$1)
3042
+ d2.push({ type: 2, index: c2 });
3043
+ else {
3044
+ let t3 = -1;
3045
+ for (; -1 !== (t3 = r2.data.indexOf(h, t3 + 1)); )
3046
+ d2.push({ type: 7, index: c2 }), t3 += h.length - 1;
3047
+ }
3048
+ c2++;
3049
+ }
2629
3050
  }
2630
- connectedCallback() {
2631
- super.connectedCallback();
2632
- this._initializeForm();
3051
+ static createElement(t2, i2) {
3052
+ const s2 = r.createElement("template");
3053
+ return s2.innerHTML = t2, s2;
2633
3054
  }
2634
- updated(changedProperties) {
2635
- if (changedProperties.has("xbrlInput") || changedProperties.has("schema")) {
2636
- this._initializeForm();
3055
+ }
3056
+ function S(t2, i2, s2 = t2, e2) {
3057
+ var _a, _b;
3058
+ if (i2 === T)
3059
+ return i2;
3060
+ let h2 = void 0 !== e2 ? (_a = s2._$Co) == null ? void 0 : _a[e2] : s2._$Cl;
3061
+ const o2 = c(i2) ? void 0 : i2._$litDirective$;
3062
+ return (h2 == null ? void 0 : h2.constructor) !== o2 && ((_b = h2 == null ? void 0 : h2._$AO) == null ? void 0 : _b.call(h2, false), void 0 === o2 ? h2 = void 0 : (h2 = new o2(t2), h2._$AT(t2, s2, e2)), void 0 !== e2 ? (s2._$Co ?? (s2._$Co = []))[e2] = h2 : s2._$Cl = h2), void 0 !== h2 && (i2 = S(t2, h2._$AS(t2, i2.values), h2, e2)), i2;
3063
+ }
3064
+ class M {
3065
+ constructor(t2, i2) {
3066
+ this._$AV = [], this._$AN = void 0, this._$AD = t2, this._$AM = i2;
3067
+ }
3068
+ get parentNode() {
3069
+ return this._$AM.parentNode;
3070
+ }
3071
+ get _$AU() {
3072
+ return this._$AM._$AU;
3073
+ }
3074
+ u(t2) {
3075
+ const { el: { content: i2 }, parts: s2 } = this._$AD, e2 = ((t2 == null ? void 0 : t2.creationScope) ?? r).importNode(i2, true);
3076
+ C.currentNode = e2;
3077
+ let h2 = C.nextNode(), o2 = 0, n3 = 0, l2 = s2[0];
3078
+ for (; void 0 !== l2; ) {
3079
+ if (o2 === l2.index) {
3080
+ let i3;
3081
+ 2 === l2.type ? i3 = new R(h2, h2.nextSibling, this, t2) : 1 === l2.type ? i3 = new l2.ctor(h2, l2.name, l2.strings, this, t2) : 6 === l2.type && (i3 = new z(h2, this, t2)), this._$AV.push(i3), l2 = s2[++n3];
3082
+ }
3083
+ o2 !== (l2 == null ? void 0 : l2.index) && (h2 = C.nextNode(), o2++);
3084
+ }
3085
+ return C.currentNode = r, e2;
3086
+ }
3087
+ p(t2) {
3088
+ let i2 = 0;
3089
+ for (const s2 of this._$AV)
3090
+ void 0 !== s2 && (void 0 !== s2.strings ? (s2._$AI(t2, s2, i2), i2 += s2.strings.length - 2) : s2._$AI(t2[i2])), i2++;
3091
+ }
3092
+ }
3093
+ class R {
3094
+ get _$AU() {
3095
+ var _a;
3096
+ return ((_a = this._$AM) == null ? void 0 : _a._$AU) ?? this._$Cv;
3097
+ }
3098
+ constructor(t2, i2, s2, e2) {
3099
+ this.type = 2, this._$AH = E, this._$AN = void 0, this._$AA = t2, this._$AB = i2, this._$AM = s2, this.options = e2, this._$Cv = (e2 == null ? void 0 : e2.isConnected) ?? true;
3100
+ }
3101
+ get parentNode() {
3102
+ let t2 = this._$AA.parentNode;
3103
+ const i2 = this._$AM;
3104
+ return void 0 !== i2 && 11 === (t2 == null ? void 0 : t2.nodeType) && (t2 = i2.parentNode), t2;
3105
+ }
3106
+ get startNode() {
3107
+ return this._$AA;
3108
+ }
3109
+ get endNode() {
3110
+ return this._$AB;
3111
+ }
3112
+ _$AI(t2, i2 = this) {
3113
+ t2 = S(this, t2, i2), c(t2) ? t2 === E || null == t2 || "" === t2 ? (this._$AH !== E && this._$AR(), this._$AH = E) : t2 !== this._$AH && t2 !== T && this._(t2) : void 0 !== t2._$litType$ ? this.$(t2) : void 0 !== t2.nodeType ? this.T(t2) : u(t2) ? this.k(t2) : this._(t2);
3114
+ }
3115
+ O(t2) {
3116
+ return this._$AA.parentNode.insertBefore(t2, this._$AB);
3117
+ }
3118
+ T(t2) {
3119
+ this._$AH !== t2 && (this._$AR(), this._$AH = this.O(t2));
3120
+ }
3121
+ _(t2) {
3122
+ this._$AH !== E && c(this._$AH) ? this._$AA.nextSibling.data = t2 : this.T(r.createTextNode(t2)), this._$AH = t2;
3123
+ }
3124
+ $(t2) {
3125
+ var _a;
3126
+ const { values: i2, _$litType$: s2 } = t2, e2 = "number" == typeof s2 ? this._$AC(t2) : (void 0 === s2.el && (s2.el = N.createElement(P(s2.h, s2.h[0]), this.options)), s2);
3127
+ if (((_a = this._$AH) == null ? void 0 : _a._$AD) === e2)
3128
+ this._$AH.p(i2);
3129
+ else {
3130
+ const t3 = new M(e2, this), s3 = t3.u(this.options);
3131
+ t3.p(i2), this.T(s3), this._$AH = t3;
3132
+ }
3133
+ }
3134
+ _$AC(t2) {
3135
+ let i2 = A.get(t2.strings);
3136
+ return void 0 === i2 && A.set(t2.strings, i2 = new N(t2)), i2;
3137
+ }
3138
+ k(t2) {
3139
+ a(this._$AH) || (this._$AH = [], this._$AR());
3140
+ const i2 = this._$AH;
3141
+ let s2, e2 = 0;
3142
+ for (const h2 of t2)
3143
+ e2 === i2.length ? i2.push(s2 = new R(this.O(l()), this.O(l()), this, this.options)) : s2 = i2[e2], s2._$AI(h2), e2++;
3144
+ e2 < i2.length && (this._$AR(s2 && s2._$AB.nextSibling, e2), i2.length = e2);
3145
+ }
3146
+ _$AR(t2 = this._$AA.nextSibling, i2) {
3147
+ var _a;
3148
+ for ((_a = this._$AP) == null ? void 0 : _a.call(this, false, true, i2); t2 !== this._$AB; ) {
3149
+ const i3 = t2.nextSibling;
3150
+ t2.remove(), t2 = i3;
3151
+ }
3152
+ }
3153
+ setConnected(t2) {
3154
+ var _a;
3155
+ void 0 === this._$AM && (this._$Cv = t2, (_a = this._$AP) == null ? void 0 : _a.call(this, t2));
3156
+ }
3157
+ }
3158
+ class k {
3159
+ get tagName() {
3160
+ return this.element.tagName;
3161
+ }
3162
+ get _$AU() {
3163
+ return this._$AM._$AU;
3164
+ }
3165
+ constructor(t2, i2, s2, e2, h2) {
3166
+ this.type = 1, this._$AH = E, this._$AN = void 0, this.element = t2, this.name = i2, this._$AM = e2, this.options = h2, s2.length > 2 || "" !== s2[0] || "" !== s2[1] ? (this._$AH = Array(s2.length - 1).fill(new String()), this.strings = s2) : this._$AH = E;
3167
+ }
3168
+ _$AI(t2, i2 = this, s2, e2) {
3169
+ const h2 = this.strings;
3170
+ let o2 = false;
3171
+ if (void 0 === h2)
3172
+ t2 = S(this, t2, i2, 0), o2 = !c(t2) || t2 !== this._$AH && t2 !== T, o2 && (this._$AH = t2);
3173
+ else {
3174
+ const e3 = t2;
3175
+ let n3, r2;
3176
+ for (t2 = h2[0], n3 = 0; n3 < h2.length - 1; n3++)
3177
+ r2 = S(this, e3[s2 + n3], i2, n3), r2 === T && (r2 = this._$AH[n3]), o2 || (o2 = !c(r2) || r2 !== this._$AH[n3]), r2 === E ? t2 = E : t2 !== E && (t2 += (r2 ?? "") + h2[n3 + 1]), this._$AH[n3] = r2;
3178
+ }
3179
+ o2 && !e2 && this.j(t2);
3180
+ }
3181
+ j(t2) {
3182
+ t2 === E ? this.element.removeAttribute(this.name) : this.element.setAttribute(this.name, t2 ?? "");
3183
+ }
3184
+ }
3185
+ class H extends k {
3186
+ constructor() {
3187
+ super(...arguments), this.type = 3;
3188
+ }
3189
+ j(t2) {
3190
+ this.element[this.name] = t2 === E ? void 0 : t2;
3191
+ }
3192
+ }
3193
+ class I extends k {
3194
+ constructor() {
3195
+ super(...arguments), this.type = 4;
3196
+ }
3197
+ j(t2) {
3198
+ this.element.toggleAttribute(this.name, !!t2 && t2 !== E);
3199
+ }
3200
+ }
3201
+ class L extends k {
3202
+ constructor(t2, i2, s2, e2, h2) {
3203
+ super(t2, i2, s2, e2, h2), this.type = 5;
3204
+ }
3205
+ _$AI(t2, i2 = this) {
3206
+ if ((t2 = S(this, t2, i2, 0) ?? E) === T)
3207
+ return;
3208
+ const s2 = this._$AH, e2 = t2 === E && s2 !== E || t2.capture !== s2.capture || t2.once !== s2.once || t2.passive !== s2.passive, h2 = t2 !== E && (s2 === E || e2);
3209
+ e2 && this.element.removeEventListener(this.name, this, s2), h2 && this.element.addEventListener(this.name, this, t2), this._$AH = t2;
3210
+ }
3211
+ handleEvent(t2) {
3212
+ var _a;
3213
+ "function" == typeof this._$AH ? this._$AH.call(((_a = this.options) == null ? void 0 : _a.host) ?? this.element, t2) : this._$AH.handleEvent(t2);
3214
+ }
3215
+ }
3216
+ class z {
3217
+ constructor(t2, i2, s2) {
3218
+ this.element = t2, this.type = 6, this._$AN = void 0, this._$AM = i2, this.options = s2;
3219
+ }
3220
+ get _$AU() {
3221
+ return this._$AM._$AU;
3222
+ }
3223
+ _$AI(t2) {
3224
+ S(this, t2);
3225
+ }
3226
+ }
3227
+ const j = t$1.litHtmlPolyfillSupport;
3228
+ j == null ? void 0 : j(N, R), (t$1.litHtmlVersions ?? (t$1.litHtmlVersions = [])).push("3.3.1");
3229
+ /**
3230
+ * @license
3231
+ * Copyright 2017 Google LLC
3232
+ * SPDX-License-Identifier: BSD-3-Clause
3233
+ */
3234
+ const t = { ATTRIBUTE: 1, CHILD: 2, PROPERTY: 3, BOOLEAN_ATTRIBUTE: 4, EVENT: 5, ELEMENT: 6 }, e$1 = (t2) => (...e2) => ({ _$litDirective$: t2, values: e2 });
3235
+ class i {
3236
+ constructor(t2) {
3237
+ }
3238
+ get _$AU() {
3239
+ return this._$AM._$AU;
3240
+ }
3241
+ _$AT(t2, e2, i2) {
3242
+ this._$Ct = t2, this._$AM = e2, this._$Ci = i2;
3243
+ }
3244
+ _$AS(t2, e2) {
3245
+ return this.update(t2, e2);
3246
+ }
3247
+ update(t2, e2) {
3248
+ return this.render(...e2);
3249
+ }
3250
+ }
3251
+ /**
3252
+ * @license
3253
+ * Copyright 2017 Google LLC
3254
+ * SPDX-License-Identifier: BSD-3-Clause
3255
+ */
3256
+ class e extends i {
3257
+ constructor(i2) {
3258
+ if (super(i2), this.it = E, i2.type !== t.CHILD)
3259
+ throw Error(this.constructor.directiveName + "() can only be used in child bindings");
3260
+ }
3261
+ render(r2) {
3262
+ if (r2 === E || null == r2)
3263
+ return this._t = void 0, this.it = r2;
3264
+ if (r2 === T)
3265
+ return r2;
3266
+ if ("string" != typeof r2)
3267
+ throw Error(this.constructor.directiveName + "() called with a non-string value");
3268
+ if (r2 === this.it)
3269
+ return this._t;
3270
+ this.it = r2;
3271
+ const s2 = [r2];
3272
+ return s2.raw = s2, this._t = { _$litType$: this.constructor.resultType, strings: s2, values: [] };
3273
+ }
3274
+ }
3275
+ e.directiveName = "unsafeHTML", e.resultType = 1;
3276
+ const o = e$1(e);
3277
+ var __defProp$1 = Object.defineProperty;
3278
+ var __getOwnPropDesc$1 = Object.getOwnPropertyDescriptor;
3279
+ var __decorateClass$1 = (decorators, target, key, kind) => {
3280
+ var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$1(target, key) : target;
3281
+ for (var i2 = decorators.length - 1, decorator; i2 >= 0; i2--)
3282
+ if (decorator = decorators[i2])
3283
+ result = (kind ? decorator(target, key, result) : decorator(result)) || result;
3284
+ if (kind && result)
3285
+ __defProp$1(target, key, result);
3286
+ return result;
3287
+ };
3288
+ let JupiterFilterRolesDialog = class extends LitElement {
3289
+ constructor() {
3290
+ super(...arguments);
3291
+ this.open = false;
3292
+ this.availableRoles = [];
3293
+ this.selectedRoleIds = [];
3294
+ this._tempSelectedRoles = /* @__PURE__ */ new Set();
3295
+ this._searchQuery = "";
3296
+ this._filteredRoles = [];
3297
+ }
3298
+ connectedCallback() {
3299
+ super.connectedCallback();
3300
+ this._initializeTempSelection();
3301
+ }
3302
+ updated(changedProperties) {
3303
+ if (changedProperties.has("selectedRoleIds") || changedProperties.has("open")) {
3304
+ this._initializeTempSelection();
3305
+ }
3306
+ if (changedProperties.has("availableRoles") || changedProperties.has("_searchQuery")) {
3307
+ this._updateFilteredRoles();
3308
+ }
3309
+ }
3310
+ _updateFilteredRoles() {
3311
+ if (!this._searchQuery.trim()) {
3312
+ this._filteredRoles = [...this.availableRoles];
3313
+ return;
3314
+ }
3315
+ const query = this._searchQuery.toLowerCase().trim();
3316
+ this._filteredRoles = this.availableRoles.filter((role) => {
3317
+ var _a;
3318
+ const titleMatch = role.title.toLowerCase().includes(query);
3319
+ const idMatch = role.id.toLowerCase().includes(query);
3320
+ const descriptionMatch = ((_a = role.description) == null ? void 0 : _a.toLowerCase().includes(query)) || false;
3321
+ const uriMatch = this._searchInRoleURI(role, query);
3322
+ return titleMatch || idMatch || descriptionMatch || uriMatch;
3323
+ });
3324
+ }
3325
+ _searchInRoleURI(role, query) {
3326
+ var _a;
3327
+ if ((_a = role.metadata) == null ? void 0 : _a.roleURI) {
3328
+ return role.metadata.roleURI.toLowerCase().includes(query);
3329
+ }
3330
+ const uriPattern = /https?:\/\/[^\s]+/i;
3331
+ const titleHasURI = uriPattern.test(role.title);
3332
+ const idHasURI = uriPattern.test(role.id);
3333
+ if (titleHasURI || idHasURI) {
3334
+ return role.title.toLowerCase().includes(query) || role.id.toLowerCase().includes(query);
3335
+ }
3336
+ if (role.id.includes(".") || role.id.includes("/") || role.id.includes(":")) {
3337
+ return role.id.toLowerCase().includes(query);
3338
+ }
3339
+ return false;
3340
+ }
3341
+ _handleSearchInput(event) {
3342
+ const input = event.target;
3343
+ this._searchQuery = input.value;
3344
+ }
3345
+ _clearSearch() {
3346
+ var _a;
3347
+ this._searchQuery = "";
3348
+ const searchInput = (_a = this.shadowRoot) == null ? void 0 : _a.querySelector(".search-input");
3349
+ if (searchInput) {
3350
+ searchInput.value = "";
3351
+ searchInput.focus();
3352
+ }
3353
+ }
3354
+ _highlightSearchTerm(text) {
3355
+ if (!this._searchQuery.trim()) {
3356
+ return text;
3357
+ }
3358
+ const query = this._searchQuery.trim();
3359
+ const regex = new RegExp(`(${query.replace(/[.*+?^${}()|[\]\\]/g, "\\$&")})`, "gi");
3360
+ return text.replace(regex, "<mark>$1</mark>");
3361
+ }
3362
+ _getSelectedFilteredCount() {
3363
+ return this._filteredRoles.filter((role) => this._tempSelectedRoles.has(role.id)).length;
3364
+ }
3365
+ _initializeTempSelection() {
3366
+ this._tempSelectedRoles = new Set(this.selectedRoleIds);
3367
+ }
3368
+ _handleCheckboxChange(event, roleId) {
3369
+ const checkbox = event.target;
3370
+ const newSelection = new Set(this._tempSelectedRoles);
3371
+ if (checkbox.checked) {
3372
+ newSelection.add(roleId);
3373
+ } else {
3374
+ newSelection.delete(roleId);
3375
+ }
3376
+ this._tempSelectedRoles = newSelection;
3377
+ this.requestUpdate();
3378
+ }
3379
+ _selectAll() {
3380
+ const newSelection = new Set(this._tempSelectedRoles);
3381
+ this._filteredRoles.forEach((role) => newSelection.add(role.id));
3382
+ this._tempSelectedRoles = newSelection;
3383
+ this.requestUpdate();
3384
+ }
3385
+ _selectNone() {
3386
+ const newSelection = new Set(this._tempSelectedRoles);
3387
+ this._filteredRoles.forEach((role) => newSelection.delete(role.id));
3388
+ this._tempSelectedRoles = newSelection;
3389
+ this.requestUpdate();
3390
+ }
3391
+ _selectAllGlobal() {
3392
+ this._tempSelectedRoles = new Set(this.availableRoles.map((role) => role.id));
3393
+ this.requestUpdate();
3394
+ }
3395
+ _selectNoneGlobal() {
3396
+ this._tempSelectedRoles = /* @__PURE__ */ new Set();
3397
+ this.requestUpdate();
3398
+ }
3399
+ _resetToOriginal() {
3400
+ this._tempSelectedRoles = new Set(this.selectedRoleIds);
3401
+ this.requestUpdate();
3402
+ }
3403
+ _handleCancel() {
3404
+ this._initializeTempSelection();
3405
+ this.dispatchEvent(new CustomEvent("dialog-cancel", {
3406
+ bubbles: true
3407
+ }));
3408
+ }
3409
+ _handleApply() {
3410
+ const selectedRoles = Array.from(this._tempSelectedRoles);
3411
+ this.dispatchEvent(new CustomEvent("roles-filter-apply", {
3412
+ detail: { selectedRoleIds: selectedRoles },
3413
+ bubbles: true
3414
+ }));
3415
+ }
3416
+ _handleBackdropClick(event) {
3417
+ if (event.target === this) {
3418
+ this._handleCancel();
3419
+ }
3420
+ }
3421
+ render() {
3422
+ const selectedCount = this._tempSelectedRoles.size;
3423
+ const totalCount = this.availableRoles.length;
3424
+ const filteredCount = this._filteredRoles.length;
3425
+ const hasSearchQuery = this._searchQuery.trim().length > 0;
3426
+ return html`
3427
+ <div class="dialog" @click="${(e2) => e2.stopPropagation()}">
3428
+ <!-- Dialog Header -->
3429
+ <div class="dialog-header">
3430
+ <svg class="filter-icon" viewBox="0 0 24 24">
3431
+ <path d="M10 18h4v-2h-4v2zM3 6v2h18V6H3zm3 7h12v-2H6v2z"/>
3432
+ </svg>
3433
+ <h2 class="dialog-title">Filter Roles</h2>
3434
+ <button class="close-button" @click="${this._handleCancel}">×</button>
3435
+ </div>
3436
+
3437
+ <!-- Dialog Content -->
3438
+ <div class="dialog-content">
3439
+ <p class="description">
3440
+ Select the roles you want to display in the form. You can search and choose specific roles
3441
+ to focus on or manage all ${totalCount} available roles.
3442
+ </p>
3443
+
3444
+ <!-- Search Input -->
3445
+ <div class="search-container">
3446
+ <input
3447
+ type="text"
3448
+ class="search-input"
3449
+ placeholder="Search roles by name, ID, or URI..."
3450
+ .value="${this._searchQuery}"
3451
+ @input="${this._handleSearchInput}"
3452
+ />
3453
+ ${this._searchQuery ? html`
3454
+ <button class="clear-search" @click="${this._clearSearch}" title="Clear search">
3455
+ ×
3456
+ </button>
3457
+ ` : html`
3458
+ <svg class="search-icon" viewBox="0 0 24 24">
3459
+ <path d="M15.5 14h-.79l-.28-.27A6.471 6.471 0 0 0 16 9.5 6.5 6.5 0 1 0 9.5 16c1.61 0 3.09-.59 4.23-1.57l.27.28v.79l5 4.99L20.49 19l-4.99-5zm-6 0C7.01 14 5 11.99 5 9.5S7.01 5 9.5 5 14 7.01 14 9.5 11.99 14 9.5 14z"/>
3460
+ </svg>
3461
+ `}
3462
+ </div>
3463
+
3464
+ <!-- Search Results Info -->
3465
+ ${hasSearchQuery ? html`
3466
+ <div class="search-results-info">
3467
+ Showing ${filteredCount} of ${totalCount} roles
3468
+ ${filteredCount !== totalCount ? html`matching "${this._searchQuery}"` : ""}
3469
+ </div>
3470
+ ` : ""}
3471
+
3472
+ <!-- Selection Controls -->
3473
+ <div class="selection-controls">
3474
+ ${hasSearchQuery ? html`
3475
+ <button class="selection-control" @click="${this._selectAll}">
3476
+ Select Filtered (${filteredCount})
3477
+ </button>
3478
+ <button class="selection-control" @click="${this._selectNone}">
3479
+ Deselect Filtered
3480
+ </button>
3481
+ <button class="selection-control" @click="${this._selectAllGlobal}">
3482
+ Select All (${totalCount})
3483
+ </button>
3484
+ <button class="selection-control" @click="${this._selectNoneGlobal}">
3485
+ Deselect All
3486
+ </button>
3487
+ ` : html`
3488
+ <button class="selection-control" @click="${this._selectAll}">
3489
+ Select All
3490
+ </button>
3491
+ <button class="selection-control" @click="${this._selectNone}">
3492
+ Select None
3493
+ </button>
3494
+ `}
3495
+ <button class="selection-control" @click="${this._resetToOriginal}">
3496
+ Reset
3497
+ </button>
3498
+ </div>
3499
+
3500
+ <!-- Roles List -->
3501
+ <div class="roles-list">
3502
+ ${this._filteredRoles.length === 0 ? html`
3503
+ <div class="no-results">
3504
+ ${hasSearchQuery ? html`
3505
+ No roles found matching "${this._searchQuery}".<br>
3506
+ Try a different search term or clear the search.
3507
+ ` : html`
3508
+ No roles available.
3509
+ `}
3510
+ </div>
3511
+ ` : html`
3512
+ ${this._filteredRoles.map((role) => {
3513
+ var _a;
3514
+ const isSelected = this._tempSelectedRoles.has(role.id);
3515
+ return html`
3516
+ <div class="role-item">
3517
+ <input
3518
+ type="checkbox"
3519
+ class="role-checkbox"
3520
+ .checked="${isSelected}"
3521
+ @change="${(e2) => this._handleCheckboxChange(e2, role.id)}"
3522
+ />
3523
+ <div class="role-info">
3524
+ <h4 class="role-title">${o(this._highlightSearchTerm(role.title))}</h4>
3525
+ ${role.description ? html`
3526
+ <p class="role-description">${o(this._highlightSearchTerm(role.description))}</p>
3527
+ ` : ""}
3528
+ ${role.id !== role.title ? html`
3529
+ <p class="role-description">ID: ${o(this._highlightSearchTerm(role.id))}</p>
3530
+ ` : ""}
3531
+ ${((_a = role.metadata) == null ? void 0 : _a.roleURI) ? html`
3532
+ <p class="role-description">URI: ${o(this._highlightSearchTerm(role.metadata.roleURI))}</p>
3533
+ ` : ""}
3534
+ </div>
3535
+ </div>
3536
+ `;
3537
+ })}
3538
+ `}
3539
+ </div>
3540
+
3541
+ <div class="selected-count">
3542
+ ${selectedCount} of ${totalCount} roles selected
3543
+ ${hasSearchQuery && filteredCount !== totalCount ? html`
3544
+ <br><small>(${this._getSelectedFilteredCount()} of ${filteredCount} filtered roles selected)</small>
3545
+ ` : ""}
3546
+ </div>
3547
+ </div>
3548
+
3549
+ <!-- Dialog Actions -->
3550
+ <div class="dialog-actions">
3551
+ <button class="btn-secondary" @click="${this._handleCancel}">
3552
+ Cancel
3553
+ </button>
3554
+ <button
3555
+ class="btn-primary"
3556
+ @click="${this._handleApply}"
3557
+ ?disabled="${selectedCount === 0}"
3558
+ >
3559
+ Apply Filter (${selectedCount})
3560
+ </button>
3561
+ </div>
3562
+ </div>
3563
+ `;
3564
+ }
3565
+ };
3566
+ JupiterFilterRolesDialog.styles = css`
3567
+ :host {
3568
+ position: fixed;
3569
+ top: 0;
3570
+ left: 0;
3571
+ right: 0;
3572
+ bottom: 0;
3573
+ z-index: 10000;
3574
+ display: none;
3575
+ align-items: center;
3576
+ justify-content: center;
3577
+ background: rgba(0, 0, 0, 0.5);
3578
+ font-family: var(--jupiter-font-family, system-ui, -apple-system, sans-serif);
3579
+ }
3580
+
3581
+ :host([open]) {
3582
+ display: flex;
3583
+ }
3584
+
3585
+ .dialog {
3586
+ background: var(--jupiter-background, #fff);
3587
+ border-radius: 8px;
3588
+ box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
3589
+
3590
+ width: 90vw;
3591
+ max-height: 80vh;
3592
+ display: flex;
3593
+ flex-direction: column;
3594
+ overflow: hidden;
3595
+ }
3596
+
3597
+ .dialog-header {
3598
+ padding: 20px 24px 16px;
3599
+ border-bottom: 1px solid var(--jupiter-border-color, #ddd);
3600
+ display: flex;
3601
+ align-items: center;
3602
+ gap: 12px;
3603
+ }
3604
+
3605
+ .dialog-title {
3606
+ font-size: 18px;
3607
+ font-weight: 600;
3608
+ margin: 0;
3609
+ color: var(--jupiter-text-primary, #333);
3610
+ flex: 1;
3611
+ }
3612
+
3613
+ .filter-icon {
3614
+ width: 20px;
3615
+ height: 20px;
3616
+ fill: var(--jupiter-primary-color, #1976d2);
3617
+ }
3618
+
3619
+ .close-button {
3620
+ background: none;
3621
+ border: none;
3622
+ font-size: 24px;
3623
+ cursor: pointer;
3624
+ padding: 4px;
3625
+ color: var(--jupiter-text-secondary, #666);
3626
+ border-radius: 4px;
3627
+ transition: background-color 0.2s ease;
3628
+ }
3629
+
3630
+ .close-button:hover {
3631
+ background: var(--jupiter-hover-background, #f5f5f5);
3632
+ }
3633
+
3634
+ .dialog-content {
3635
+ flex: 1;
3636
+ overflow-y: auto;
3637
+ padding: 20px 24px;
3638
+ }
3639
+
3640
+ .description {
3641
+ color: var(--jupiter-text-secondary, #666);
3642
+ font-size: 14px;
3643
+ margin: 0 0 20px 0;
3644
+ line-height: 1.5;
3645
+ }
3646
+
3647
+ .selection-controls {
3648
+ display: flex;
3649
+ gap: 12px;
3650
+ margin-bottom: 20px;
3651
+ flex-wrap: wrap;
3652
+ }
3653
+
3654
+ .search-container {
3655
+ margin-bottom: 16px;
3656
+ position: relative;
3657
+ }
3658
+
3659
+ .search-input {
3660
+ width: 100%;
3661
+ padding: 10px 40px 10px 12px;
3662
+ border: 1px solid var(--jupiter-border-color, #ddd);
3663
+ border-radius: 4px;
3664
+ font-size: 14px;
3665
+ font-family: inherit;
3666
+ background: var(--jupiter-background, #fff);
3667
+ color: var(--jupiter-text-primary, #333);
3668
+ transition: border-color 0.2s ease;
3669
+ }
3670
+
3671
+ .search-input:focus {
3672
+ outline: none;
3673
+ border-color: var(--jupiter-primary-color, #1976d2);
3674
+ box-shadow: 0 0 0 2px rgba(25, 118, 210, 0.1);
3675
+ }
3676
+
3677
+ .search-input::placeholder {
3678
+ color: var(--jupiter-text-secondary, #666);
3679
+ }
3680
+
3681
+ .search-icon {
3682
+ position: absolute;
3683
+ right: 12px;
3684
+ top: 50%;
3685
+ transform: translateY(-50%);
3686
+ width: 16px;
3687
+ height: 16px;
3688
+ fill: var(--jupiter-text-secondary, #666);
3689
+ pointer-events: none;
3690
+ }
3691
+
3692
+ .clear-search {
3693
+ position: absolute;
3694
+ right: 12px;
3695
+ top: 50%;
3696
+ transform: translateY(-50%);
3697
+ background: none;
3698
+ border: none;
3699
+ cursor: pointer;
3700
+ padding: 2px;
3701
+ border-radius: 2px;
3702
+ color: var(--jupiter-text-secondary, #666);
3703
+ font-size: 16px;
3704
+ line-height: 1;
3705
+ transition: color 0.2s ease;
3706
+ }
3707
+
3708
+ .clear-search:hover {
3709
+ color: var(--jupiter-text-primary, #333);
3710
+ }
3711
+
3712
+ .search-results-info {
3713
+ font-size: 12px;
3714
+ color: var(--jupiter-text-secondary, #666);
3715
+ margin-bottom: 8px;
3716
+ text-align: center;
3717
+ }
3718
+
3719
+ .no-results {
3720
+ text-align: center;
3721
+ padding: 40px 20px;
3722
+ color: var(--jupiter-text-secondary, #666);
3723
+ font-style: italic;
3724
+ }
3725
+
3726
+ mark {
3727
+ background: var(--jupiter-primary-color, #1976d2);
3728
+ color: white;
3729
+ padding: 1px 2px;
3730
+ border-radius: 2px;
3731
+ font-weight: 500;
3732
+ }
3733
+
3734
+ .selection-control {
3735
+ background: none;
3736
+ border: 1px solid var(--jupiter-primary-color, #1976d2);
3737
+ color: var(--jupiter-primary-color, #1976d2);
3738
+ padding: 6px 12px;
3739
+ border-radius: 4px;
3740
+ font-size: 12px;
3741
+ cursor: pointer;
3742
+ transition: all 0.2s ease;
3743
+ }
3744
+
3745
+ .selection-control:hover {
3746
+ background: var(--jupiter-primary-color, #1976d2);
3747
+ color: white;
3748
+ }
3749
+
3750
+ .roles-list {
3751
+ display: flex;
3752
+ flex-direction: column;
3753
+ gap: 8px;
3754
+ max-height: 300px;
3755
+ overflow-y: auto;
3756
+ border: 1px solid var(--jupiter-border-color, #ddd);
3757
+ border-radius: 4px;
3758
+ padding: 12px;
3759
+ }
3760
+
3761
+ .role-item {
3762
+ display: flex;
3763
+ align-items: flex-start;
3764
+ gap: 12px;
3765
+ padding: 8px;
3766
+ border-radius: 4px;
3767
+ transition: background-color 0.2s ease;
3768
+ }
3769
+
3770
+ .role-item:hover {
3771
+ background: var(--jupiter-hover-background, #f5f5f5);
3772
+ }
3773
+
3774
+ .role-checkbox {
3775
+ margin-top: 2px;
3776
+ cursor: pointer;
3777
+ }
3778
+
3779
+ .role-info {
3780
+ flex: 1;
3781
+ min-width: 0;
3782
+ }
3783
+
3784
+ .role-title {
3785
+ font-weight: 500;
3786
+ color: var(--jupiter-text-primary, #333);
3787
+ margin: 0 0 4px 0;
3788
+ word-wrap: break-word;
3789
+ line-height: 1.3;
3790
+ }
3791
+
3792
+ .role-description {
3793
+ font-size: 13px;
3794
+ color: var(--jupiter-text-secondary, #666);
3795
+ margin: 0;
3796
+ line-height: 1.4;
3797
+ word-break: break-all; /* Allow URI breaking */
3798
+ }
3799
+
3800
+ .role-description:last-child {
3801
+ margin-bottom: 4px;
3802
+ }
3803
+
3804
+ .selected-count {
3805
+ font-size: 13px;
3806
+ color: var(--jupiter-text-secondary, #666);
3807
+ margin-top: 16px;
3808
+ text-align: center;
3809
+ }
3810
+
3811
+ .dialog-actions {
3812
+ padding: 16px 24px;
3813
+ border-top: 1px solid var(--jupiter-border-color, #ddd);
3814
+ display: flex;
3815
+ gap: 12px;
3816
+ justify-content: flex-end;
3817
+ background: var(--jupiter-form-actions-background, #f8f9fa);
3818
+ }
3819
+
3820
+ .dialog-actions button {
3821
+ padding: 10px 20px;
3822
+ border: none;
3823
+ border-radius: 4px;
3824
+ font-size: 14px;
3825
+ font-weight: 500;
3826
+ cursor: pointer;
3827
+ transition: background-color 0.2s ease;
3828
+ }
3829
+
3830
+ .btn-primary {
3831
+ background: var(--jupiter-primary-color, #1976d2);
3832
+ color: white;
3833
+ }
3834
+
3835
+ .btn-primary:hover:not(:disabled) {
3836
+ background: var(--jupiter-primary-color-dark, #1565c0);
3837
+ }
3838
+
3839
+ .btn-secondary {
3840
+ background: transparent;
3841
+ color: var(--jupiter-text-secondary, #666);
3842
+ border: 1px solid var(--jupiter-border-color, #ddd);
3843
+ }
3844
+
3845
+ .btn-secondary:hover:not(:disabled) {
3846
+ background: var(--jupiter-hover-background, #f5f5f5);
3847
+ }
3848
+
3849
+ button:disabled {
3850
+ opacity: 0.6;
3851
+ cursor: not-allowed;
3852
+ }
3853
+ `;
3854
+ __decorateClass$1([
3855
+ n$1({ type: Boolean, reflect: true })
3856
+ ], JupiterFilterRolesDialog.prototype, "open", 2);
3857
+ __decorateClass$1([
3858
+ n$1({ type: Array })
3859
+ ], JupiterFilterRolesDialog.prototype, "availableRoles", 2);
3860
+ __decorateClass$1([
3861
+ n$1({ type: Array })
3862
+ ], JupiterFilterRolesDialog.prototype, "selectedRoleIds", 2);
3863
+ __decorateClass$1([
3864
+ r$1()
3865
+ ], JupiterFilterRolesDialog.prototype, "_tempSelectedRoles", 2);
3866
+ __decorateClass$1([
3867
+ r$1()
3868
+ ], JupiterFilterRolesDialog.prototype, "_searchQuery", 2);
3869
+ __decorateClass$1([
3870
+ r$1()
3871
+ ], JupiterFilterRolesDialog.prototype, "_filteredRoles", 2);
3872
+ JupiterFilterRolesDialog = __decorateClass$1([
3873
+ t$3("jupiter-filter-roles-dialog")
3874
+ ], JupiterFilterRolesDialog);
3875
+ var __defProp = Object.defineProperty;
3876
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
3877
+ var __decorateClass = (decorators, target, key, kind) => {
3878
+ var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc(target, key) : target;
3879
+ for (var i2 = decorators.length - 1, decorator; i2 >= 0; i2--)
3880
+ if (decorator = decorators[i2])
3881
+ result = (kind ? decorator(target, key, result) : decorator(result)) || result;
3882
+ if (kind && result)
3883
+ __defProp(target, key, result);
3884
+ return result;
3885
+ };
3886
+ let JupiterDynamicForm = class extends LitElement {
3887
+ constructor() {
3888
+ super(...arguments);
3889
+ this.config = {};
3890
+ this.initialData = {};
3891
+ this.disabled = false;
3892
+ this.readonly = false;
3893
+ this.periodStartDate = "2025-01-01";
3894
+ this.periodEndDate = "2025-12-31";
3895
+ this._formData = {};
3896
+ this._preservedFormData = {};
3897
+ this._typedMemberData = {};
3898
+ this._preservedTypedMemberData = {};
3899
+ this._columns = [];
3900
+ this._errors = [];
3901
+ this._touched = /* @__PURE__ */ new Set();
3902
+ this._dirty = false;
3903
+ this._valid = true;
3904
+ this._submitted = false;
3905
+ this._allSections = [];
3906
+ this._selectedRoleIds = [];
3907
+ this._showFilterDialog = false;
3908
+ }
3909
+ connectedCallback() {
3910
+ super.connectedCallback();
3911
+ this._initializeForm();
3912
+ }
3913
+ updated(changedProperties) {
3914
+ if (changedProperties.has("xbrlInput") || changedProperties.has("schema")) {
3915
+ this._initializeForm();
2637
3916
  }
2638
3917
  }
2639
3918
  _initializeForm() {
@@ -2648,6 +3927,13 @@ let JupiterDynamicForm = class extends LitElement {
2648
3927
  this.periodEndDate
2649
3928
  );
2650
3929
  console.log("✅ Generated schema with sections:", this._currentSchema.sections.length);
3930
+ this._allSections = [...this._currentSchema.sections];
3931
+ if (this._allSections.length > 10 && this._selectedRoleIds.length === 0) {
3932
+ this._selectedRoleIds = this._allSections.slice(0, 10).map((section) => section.id);
3933
+ } else if (this._selectedRoleIds.length === 0) {
3934
+ this._selectedRoleIds = this._allSections.map((section) => section.id);
3935
+ }
3936
+ this._applyRoleFilter();
2651
3937
  this._columns = [
2652
3938
  {
2653
3939
  id: "base",
@@ -2661,13 +3947,19 @@ let JupiterDynamicForm = class extends LitElement {
2661
3947
  } catch (error) {
2662
3948
  console.error("❌ Error building form from XBRL input:", error);
2663
3949
  this._currentSchema = this._getDefaultSchema();
3950
+ this._allSections = [];
3951
+ this._selectedRoleIds = [];
2664
3952
  this._columns = this._getDefaultColumns();
2665
3953
  }
2666
3954
  } else if (this.schema) {
2667
3955
  this._currentSchema = this.schema;
3956
+ this._allSections = [...this.schema.sections];
3957
+ this._selectedRoleIds = this._allSections.map((section) => section.id);
2668
3958
  this._columns = this._getDefaultColumns();
2669
3959
  } else {
2670
3960
  this._currentSchema = this._getDefaultSchema();
3961
+ this._allSections = [];
3962
+ this._selectedRoleIds = [];
2671
3963
  this._columns = this._getDefaultColumns();
2672
3964
  }
2673
3965
  this._formData = { ...this.initialData };
@@ -2697,6 +3989,106 @@ let JupiterDynamicForm = class extends LitElement {
2697
3989
  }
2698
3990
  ];
2699
3991
  }
3992
+ _applyRoleFilter() {
3993
+ if (!this._currentSchema || !this._allSections.length)
3994
+ return;
3995
+ this._preserveDataForHiddenSections();
3996
+ const filteredSections = this._allSections.filter(
3997
+ (section) => this._selectedRoleIds.includes(section.id)
3998
+ );
3999
+ this._restoreDataForVisibleSections(filteredSections);
4000
+ this._currentSchema = {
4001
+ ...this._currentSchema,
4002
+ sections: filteredSections
4003
+ };
4004
+ }
4005
+ _preserveDataForHiddenSections() {
4006
+ var _a;
4007
+ const currentlyVisibleSectionIds = ((_a = this._currentSchema) == null ? void 0 : _a.sections.map((s2) => s2.id)) || [];
4008
+ const sectionsThatWillBeHidden = currentlyVisibleSectionIds.filter(
4009
+ (sectionId) => !this._selectedRoleIds.includes(sectionId)
4010
+ );
4011
+ sectionsThatWillBeHidden.forEach((sectionId) => {
4012
+ const section = this._allSections.find((s2) => s2.id === sectionId);
4013
+ if (section) {
4014
+ this._preserveSectionData(section);
4015
+ }
4016
+ });
4017
+ console.log(`📦 Preserved data for ${sectionsThatWillBeHidden.length} hidden sections:`, sectionsThatWillBeHidden);
4018
+ }
4019
+ _restoreDataForVisibleSections(visibleSections) {
4020
+ visibleSections.forEach((section) => {
4021
+ this._restoreSectionData(section);
4022
+ });
4023
+ console.log(`🔄 Restored data for ${visibleSections.length} visible sections`);
4024
+ }
4025
+ _preserveSectionData(section) {
4026
+ section.concepts.forEach((concept) => {
4027
+ this._preserveConceptData(concept);
4028
+ });
4029
+ }
4030
+ _preserveConceptData(concept) {
4031
+ if (this._formData[concept.id]) {
4032
+ this._preservedFormData[concept.id] = { ...this._formData[concept.id] };
4033
+ console.log(`💾 Preserved form data for concept: ${concept.id}`);
4034
+ }
4035
+ concept.fields.forEach((field) => {
4036
+ if (this._typedMemberData[field.columnId]) {
4037
+ this._preservedTypedMemberData[field.columnId] = { ...this._typedMemberData[field.columnId] };
4038
+ console.log(`💾 Preserved typed data for column: ${field.columnId}`);
4039
+ }
4040
+ });
4041
+ if (concept.children) {
4042
+ concept.children.forEach((child) => {
4043
+ this._preserveConceptData(child);
4044
+ });
4045
+ }
4046
+ }
4047
+ _restoreSectionData(section) {
4048
+ section.concepts.forEach((concept) => {
4049
+ this._restoreConceptData(concept);
4050
+ });
4051
+ }
4052
+ _restoreConceptData(concept) {
4053
+ if (this._preservedFormData[concept.id]) {
4054
+ this._formData[concept.id] = { ...this._preservedFormData[concept.id] };
4055
+ console.log(`🔄 Restored form data for concept: ${concept.id}`);
4056
+ }
4057
+ concept.fields.forEach((field) => {
4058
+ if (this._preservedTypedMemberData[field.columnId]) {
4059
+ this._typedMemberData[field.columnId] = { ...this._preservedTypedMemberData[field.columnId] };
4060
+ console.log(`🔄 Restored typed data for column: ${field.columnId}`);
4061
+ }
4062
+ });
4063
+ if (concept.children) {
4064
+ concept.children.forEach((child) => {
4065
+ this._restoreConceptData(child);
4066
+ });
4067
+ }
4068
+ }
4069
+ _shouldShowFilterButton() {
4070
+ return this._allSections.length > 10;
4071
+ }
4072
+ _handleFilterRolesClick() {
4073
+ this._showFilterDialog = true;
4074
+ }
4075
+ _handleFilterDialogCancel() {
4076
+ this._showFilterDialog = false;
4077
+ }
4078
+ _handleRoleFilterApply(event) {
4079
+ const { selectedRoleIds } = event.detail;
4080
+ this._selectedRoleIds = selectedRoleIds;
4081
+ this._applyRoleFilter();
4082
+ this._showFilterDialog = false;
4083
+ this.dispatchEvent(new CustomEvent("roles-filter-changed", {
4084
+ detail: {
4085
+ selectedRoleIds,
4086
+ totalRoles: this._allSections.length,
4087
+ visibleRoles: selectedRoleIds.length
4088
+ },
4089
+ bubbles: true
4090
+ }));
4091
+ }
2700
4092
  _validateForm() {
2701
4093
  var _a;
2702
4094
  const errors = [];
@@ -2724,11 +4116,13 @@ let JupiterDynamicForm = class extends LitElement {
2724
4116
  }
2725
4117
  _handleFieldChange(event) {
2726
4118
  const { fieldId, conceptId, columnId, value } = event.detail;
2727
- if (!this._formData[conceptId]) {
2728
- this._formData[conceptId] = {};
4119
+ const updatedFormData = { ...this._formData };
4120
+ if (!updatedFormData[conceptId]) {
4121
+ updatedFormData[conceptId] = {};
2729
4122
  }
2730
- const oldValue = this._formData[conceptId][columnId];
2731
- this._formData[conceptId][columnId] = value;
4123
+ const oldValue = updatedFormData[conceptId][columnId];
4124
+ updatedFormData[conceptId] = { ...updatedFormData[conceptId], [columnId]: value };
4125
+ this._formData = updatedFormData;
2732
4126
  this._touched.add(`${conceptId}-${columnId}`);
2733
4127
  this._dirty = true;
2734
4128
  this._validateForm();
@@ -2738,6 +4132,35 @@ let JupiterDynamicForm = class extends LitElement {
2738
4132
  bubbles: true
2739
4133
  }));
2740
4134
  }
4135
+ /**
4136
+ * Generate a unique concept key that includes section context
4137
+ */
4138
+ _generateUniqueConceptKey(sectionId, conceptId) {
4139
+ return `${sectionId}::${conceptId}`;
4140
+ }
4141
+ /**
4142
+ * Extract the original concept ID from a unique concept key
4143
+ */
4144
+ _extractOriginalConceptId(uniqueConceptKey) {
4145
+ const parts = uniqueConceptKey.split("::");
4146
+ return parts.length > 1 ? parts[1] : uniqueConceptKey;
4147
+ }
4148
+ _handleTypedMemberChange(event) {
4149
+ const { columnId, axisId, value } = event.detail;
4150
+ console.log(`🔍 [DynamicForm] Typed member change: columnId=${columnId}, axisId=${axisId}, value=${value}`);
4151
+ const updatedTypedMemberData = { ...this._typedMemberData };
4152
+ if (!updatedTypedMemberData[columnId]) {
4153
+ updatedTypedMemberData[columnId] = {};
4154
+ }
4155
+ updatedTypedMemberData[columnId] = { ...updatedTypedMemberData[columnId], [axisId]: value };
4156
+ this._typedMemberData = updatedTypedMemberData;
4157
+ this._dirty = true;
4158
+ this.requestUpdate();
4159
+ this.dispatchEvent(new CustomEvent("typed-member-change", {
4160
+ detail: { columnId, axisId, value },
4161
+ bubbles: true
4162
+ }));
4163
+ }
2741
4164
  _handleSectionExpand(event) {
2742
4165
  this.dispatchEvent(new CustomEvent("section-expand", {
2743
4166
  detail: event.detail,
@@ -2787,11 +4210,11 @@ let JupiterDynamicForm = class extends LitElement {
2787
4210
  let title = "";
2788
4211
  let description = "";
2789
4212
  if (request.periodType === "instant") {
2790
- title = request.instantDate || "Instant Date";
2791
- description = `Instant period: ${request.instantDate}`;
4213
+ title = "Current";
4214
+ description = `Values as of ${request.instantDate}`;
2792
4215
  } else if (request.periodType === "duration" || request.periodType === "mixed") {
2793
- title = `${request.startDate} / ${request.endDate}`;
2794
- description = `Duration period: ${request.startDate} to ${request.endDate}`;
4216
+ title = "Current Period";
4217
+ description = `Period: ${request.startDate} to ${request.endDate}`;
2795
4218
  }
2796
4219
  let dimensionData = {
2797
4220
  dimensionId: "period",
@@ -2804,7 +4227,7 @@ let JupiterDynamicForm = class extends LitElement {
2804
4227
  const item = hypercubeRole.items[0];
2805
4228
  if (item.dimensions.length === 1) {
2806
4229
  const dimension = item.dimensions[0];
2807
- if (dimension.members.length > 0) {
4230
+ if (dimension.members && dimension.members.length > 0) {
2808
4231
  const axisLabel = ((_d = dimension.labels.find((l2) => l2.role === "http://www.xbrl.org/2003/role/label")) == null ? void 0 : _d.label) || dimension.conceptName;
2809
4232
  const firstMember = dimension.members[0];
2810
4233
  const memberLabel = ((_e = firstMember.labels.find((l2) => l2.role === "http://www.xbrl.org/2003/role/label")) == null ? void 0 : _e.label) || firstMember.conceptName;
@@ -3009,7 +4432,103 @@ let JupiterDynamicForm = class extends LitElement {
3009
4432
  this._currentSchema.sections.forEach((section) => {
3010
4433
  this._processConceptsForSubmission(section.concepts, submissionData, section);
3011
4434
  });
3012
- return submissionData;
4435
+ this._includePreservedDataInSubmission(submissionData);
4436
+ const uniqueSubmissionData = this._removeDuplicateSubmissions(submissionData);
4437
+ return uniqueSubmissionData;
4438
+ }
4439
+ _includePreservedDataInSubmission(submissionData) {
4440
+ Object.keys(this._preservedFormData).forEach((conceptId) => {
4441
+ const conceptData = this._preservedFormData[conceptId];
4442
+ if (conceptData) {
4443
+ Object.keys(conceptData).forEach((columnId) => {
4444
+ const value = conceptData[columnId];
4445
+ if (value !== void 0 && value !== null && value !== "") {
4446
+ const originalConcept = this._findConceptInAllSections(conceptId);
4447
+ if (originalConcept) {
4448
+ const originalSection = this._findSectionForConcept(conceptId);
4449
+ this._addConceptDataToSubmission(originalConcept, columnId, value, submissionData, originalSection || void 0);
4450
+ }
4451
+ }
4452
+ });
4453
+ }
4454
+ });
4455
+ console.log(`📤 Included preserved data in submission. Total entries: ${submissionData.length}`);
4456
+ }
4457
+ _findConceptInAllSections(conceptId) {
4458
+ for (const section of this._allSections) {
4459
+ const concept = this._findConceptInSection(section.concepts, conceptId);
4460
+ if (concept) {
4461
+ return concept;
4462
+ }
4463
+ }
4464
+ return null;
4465
+ }
4466
+ _findConceptInSection(concepts, conceptId) {
4467
+ for (const concept of concepts) {
4468
+ if (concept.id === conceptId) {
4469
+ return concept;
4470
+ }
4471
+ if (concept.children) {
4472
+ const found = this._findConceptInSection(concept.children, conceptId);
4473
+ if (found) {
4474
+ return found;
4475
+ }
4476
+ }
4477
+ }
4478
+ return null;
4479
+ }
4480
+ _findSectionForConcept(conceptId) {
4481
+ for (const section of this._allSections) {
4482
+ const concept = this._findConceptInSection(section.concepts, conceptId);
4483
+ if (concept) {
4484
+ return section;
4485
+ }
4486
+ }
4487
+ return null;
4488
+ }
4489
+ _addConceptDataToSubmission(concept, columnId, value, submissionData, section) {
4490
+ var _a;
4491
+ const field = concept.fields.find((f2) => f2.columnId === columnId);
4492
+ if (!field)
4493
+ return;
4494
+ const isInstant = concept.periodType === "instant";
4495
+ const entry = {
4496
+ conceptId: concept.originalConceptId || concept.id,
4497
+ value,
4498
+ period: {
4499
+ type: concept.periodType || "duration",
4500
+ ...isInstant ? { date: field.periodStartDate || this.periodStartDate } : {
4501
+ startDate: field.periodStartDate || this.periodStartDate,
4502
+ endDate: field.periodEndDate || this.periodEndDate
4503
+ }
4504
+ }
4505
+ };
4506
+ const column = this._findColumnByIdInAllSections(columnId);
4507
+ if ((_a = column == null ? void 0 : column.dimensionData) == null ? void 0 : _a.memberLabel) {
4508
+ entry.dimension = column.dimensionData.memberLabel;
4509
+ }
4510
+ submissionData.push(entry);
4511
+ }
4512
+ _findColumnByIdInAllSections(columnId) {
4513
+ for (const section of this._allSections) {
4514
+ if (section.columns) {
4515
+ const column = section.columns.find((col) => col.id === columnId);
4516
+ if (column) {
4517
+ return column;
4518
+ }
4519
+ }
4520
+ }
4521
+ return void 0;
4522
+ }
4523
+ _removeDuplicateSubmissions(submissionData) {
4524
+ const uniqueEntries = /* @__PURE__ */ new Map();
4525
+ submissionData.forEach((entry) => {
4526
+ const key = `${entry.conceptId}_${entry.value}_${entry.dimension || "no-dimension"}`;
4527
+ if (!uniqueEntries.has(key)) {
4528
+ uniqueEntries.set(key, entry);
4529
+ }
4530
+ });
4531
+ return Array.from(uniqueEntries.values());
3013
4532
  }
3014
4533
  _findColumnById(columnId) {
3015
4534
  if (!this._currentSchema) {
@@ -3025,15 +4544,114 @@ let JupiterDynamicForm = class extends LitElement {
3025
4544
  }
3026
4545
  return void 0;
3027
4546
  }
4547
+ _findColumnByIdInSection(columnId, section) {
4548
+ if (!(section == null ? void 0 : section.columns)) {
4549
+ return void 0;
4550
+ }
4551
+ return section.columns.find((col) => col.id === columnId);
4552
+ }
4553
+ _getTypedMemberNameForAxis(axisId, section) {
4554
+ var _a, _b, _c, _d;
4555
+ if (!((_b = (_a = this.xbrlInput) == null ? void 0 : _a.hypercubes) == null ? void 0 : _b[0])) {
4556
+ return null;
4557
+ }
4558
+ const sectionRoleId = section == null ? void 0 : section.id;
4559
+ if (!sectionRoleId) {
4560
+ return null;
4561
+ }
4562
+ const hypercube = this.xbrlInput.hypercubes[0];
4563
+ const role = (_c = hypercube.roles) == null ? void 0 : _c.find((r2) => r2.roleId === sectionRoleId);
4564
+ if (!(role == null ? void 0 : role.items)) {
4565
+ return null;
4566
+ }
4567
+ for (const item of role.items) {
4568
+ if (item.dimensions) {
4569
+ const dimension = item.dimensions.find((d2) => d2.id === axisId);
4570
+ if ((_d = dimension == null ? void 0 : dimension.typedMember) == null ? void 0 : _d.id) {
4571
+ return dimension.typedMember.id;
4572
+ }
4573
+ }
4574
+ }
4575
+ return null;
4576
+ }
4577
+ _doesConceptApplyToTypedDimension(concept, section, columnId) {
4578
+ var _a, _b, _c;
4579
+ if (!((_b = (_a = this.xbrlInput) == null ? void 0 : _a.hypercubes) == null ? void 0 : _b[0])) {
4580
+ return false;
4581
+ }
4582
+ const sectionRoleId = section == null ? void 0 : section.id;
4583
+ if (!sectionRoleId) {
4584
+ return false;
4585
+ }
4586
+ const hypercubeRole = this.xbrlInput.hypercubes[0].roles.find((hr) => hr.roleId === sectionRoleId);
4587
+ if (!((_c = hypercubeRole == null ? void 0 : hypercubeRole.items) == null ? void 0 : _c.length)) {
4588
+ return false;
4589
+ }
4590
+ for (const item of hypercubeRole.items) {
4591
+ const conceptIdToCheck = concept.originalConceptId || concept.id;
4592
+ if (item.conceptIds && item.conceptIds.includes(conceptIdToCheck)) {
4593
+ const hasTypedDimensions = item.dimensions.some((dim) => dim.typedMember);
4594
+ console.log(`🔍 [DynamicForm] Concept ${conceptIdToCheck} found in hypercube item. Has typed dimensions:`, hasTypedDimensions);
4595
+ return hasTypedDimensions;
4596
+ }
4597
+ }
4598
+ console.log(`🔍 [DynamicForm] Concept ${concept.originalConceptId || concept.id} not found in any hypercube items for role ${sectionRoleId}`);
4599
+ return false;
4600
+ }
4601
+ /**
4602
+ * Get the specific typed dimensions that apply to a concept in its role
4603
+ */
4604
+ _getApplicableTypedDimensions(concept, section) {
4605
+ var _a, _b, _c;
4606
+ if (!((_b = (_a = this.xbrlInput) == null ? void 0 : _a.hypercubes) == null ? void 0 : _b[0]) || !(section == null ? void 0 : section.id)) {
4607
+ return [];
4608
+ }
4609
+ const hypercubeRole = this.xbrlInput.hypercubes[0].roles.find((hr) => hr.roleId === section.id);
4610
+ if (!((_c = hypercubeRole == null ? void 0 : hypercubeRole.items) == null ? void 0 : _c.length)) {
4611
+ return [];
4612
+ }
4613
+ const conceptIdToCheck = concept.originalConceptId || concept.id;
4614
+ for (const item of hypercubeRole.items) {
4615
+ if (item.conceptIds && item.conceptIds.includes(conceptIdToCheck)) {
4616
+ const typedDimensions = item.dimensions.filter((dim) => dim.typedMember).map((dim) => dim.id);
4617
+ console.log(`🔍 [DynamicForm] Found applicable typed dimensions for concept ${conceptIdToCheck}:`, typedDimensions);
4618
+ return typedDimensions;
4619
+ }
4620
+ }
4621
+ return [];
4622
+ }
3028
4623
  _processConceptsForSubmission(concepts, submissionData, section) {
4624
+ const targetRole = "Toelichting op de geconsolideerde jaarrekening - Financiële vaste activa: Deelnemingen: Volledig geconsolideerd: Specificatie";
4625
+ const sectionTitle = (section == null ? void 0 : section.title) || "Unknown";
3029
4626
  concepts.forEach((concept) => {
4627
+ if (sectionTitle === targetRole) {
4628
+ console.warn(`[DUPLICATE DEBUG] Processing concept ${concept.originalConceptId || concept.id} in target role`);
4629
+ if (concept.fields) {
4630
+ console.warn(`[DUPLICATE DEBUG] Concept has ${concept.fields.length} fields`);
4631
+ concept.fields.forEach((field, index) => {
4632
+ var _a;
4633
+ console.warn(`[DUPLICATE DEBUG] Field ${index}: columnId=${field.columnId}, current value=${(_a = this._formData[concept.id]) == null ? void 0 : _a[field.columnId]}`);
4634
+ });
4635
+ }
4636
+ }
4637
+ if (concept.fields && concept.fields.length > 1) {
4638
+ console.log(`🔍 [DEBUG] Processing concept ${concept.originalConceptId}, fields count: ${concept.fields.length}`);
4639
+ concept.fields.forEach((field, index) => {
4640
+ var _a;
4641
+ console.log(` Field ${index}: columnId=${field.columnId}, value=${(_a = this._formData[concept.id]) == null ? void 0 : _a[field.columnId]}`);
4642
+ });
4643
+ }
3030
4644
  if (concept.fields && concept.fields.length > 0) {
3031
4645
  concept.fields.forEach((field) => {
3032
- var _a, _b, _c;
4646
+ var _a, _b;
3033
4647
  const conceptData = this._formData[concept.id];
3034
4648
  const fieldValue = conceptData == null ? void 0 : conceptData[field.columnId];
3035
4649
  if (fieldValue !== void 0 && fieldValue !== null && fieldValue !== "") {
3036
- const column = this._findColumnById(field.columnId);
4650
+ if (sectionTitle === targetRole) {
4651
+ console.warn(`[DUPLICATE DEBUG] Creating submission entry for concept ${concept.originalConceptId || concept.id}, field columnId=${field.columnId}, value=${fieldValue}`);
4652
+ }
4653
+ const column = this._findColumnByIdInSection(field.columnId, section);
4654
+ console.log(`🔍 [DynamicForm] Processing field for concept ${concept.originalConceptId || concept.id}, field columnId: ${field.columnId}, found column in section ${section == null ? void 0 : section.id}: ${!!column}, column title: ${column == null ? void 0 : column.title}`);
3037
4655
  const submissionEntry = {
3038
4656
  conceptId: concept.id,
3039
4657
  value: fieldValue,
@@ -3049,15 +4667,48 @@ let JupiterDynamicForm = class extends LitElement {
3049
4667
  }
3050
4668
  if ((column == null ? void 0 : column.type) === "dimension" && ((_a = column.dimensionData) == null ? void 0 : _a.dimensionIdKey)) {
3051
4669
  submissionEntry.dimension = column.dimensionData.dimensionIdKey;
3052
- } else if ((_b = section == null ? void 0 : section.columns) == null ? void 0 : _b.length) {
3053
- const sectionDimensionColumn = section.columns.find((col) => {
3054
- var _a2;
3055
- return col.type === "dimension" && ((_a2 = col.dimensionData) == null ? void 0 : _a2.dimensionIdKey);
3056
- });
3057
- if ((_c = sectionDimensionColumn == null ? void 0 : sectionDimensionColumn.dimensionData) == null ? void 0 : _c.dimensionIdKey) {
3058
- submissionEntry.dimension = sectionDimensionColumn.dimensionData.dimensionIdKey;
4670
+ console.log(`🔍 [DynamicForm] Using dimension key from field's column (${field.columnId}):`, column.dimensionData.dimensionIdKey);
4671
+ } else {
4672
+ console.log(`🔍 [DynamicForm] No dimension data found for field column ${field.columnId}. Column type: ${column == null ? void 0 : column.type}, has dimensionData: ${!!(column == null ? void 0 : column.dimensionData)}`);
4673
+ }
4674
+ if (this._typedMemberData[field.columnId]) {
4675
+ const applicableTypedDimensions = this._getApplicableTypedDimensions(concept, section);
4676
+ console.log(`🔍 [DynamicForm] Concept ${concept.id} applicable typed dimensions:`, applicableTypedDimensions);
4677
+ if (applicableTypedDimensions.length > 0) {
4678
+ const filteredTypedMembers = {};
4679
+ const allTypedMemberData = this._typedMemberData[field.columnId];
4680
+ applicableTypedDimensions.forEach((dimensionId) => {
4681
+ if (allTypedMemberData[dimensionId]) {
4682
+ const memberName = this._getTypedMemberNameForAxis(dimensionId, section);
4683
+ filteredTypedMembers[dimensionId] = {
4684
+ value: allTypedMemberData[dimensionId],
4685
+ memberName: memberName || "Unknown"
4686
+ };
4687
+ }
4688
+ });
4689
+ if (Object.keys(filteredTypedMembers).length > 0) {
4690
+ submissionEntry.typedMembers = filteredTypedMembers;
4691
+ console.log(`🔍 [DynamicForm] Adding filtered typed members to submission:`, filteredTypedMembers);
4692
+ } else {
4693
+ console.log(`🔍 [DynamicForm] No typed member values found for applicable dimensions:`, applicableTypedDimensions);
4694
+ }
4695
+ } else {
4696
+ console.log(`🔍 [DynamicForm] Skipping typed members for concept ${concept.id} - not applicable to this hypercube`);
4697
+ }
4698
+ } else {
4699
+ console.log(`🔍 [DynamicForm] No typed member data found for column ${field.columnId}. Available columns:`, Object.keys(this._typedMemberData));
4700
+ if (column) {
4701
+ console.log(`🔍 [DynamicForm] Column details:`, {
4702
+ id: column.id,
4703
+ type: column.type,
4704
+ hasTypedMembers: (_b = column.dimensionData) == null ? void 0 : _b.hasTypedMembers,
4705
+ dimensionData: column.dimensionData
4706
+ });
3059
4707
  }
3060
4708
  }
4709
+ if (sectionTitle === targetRole) {
4710
+ console.warn(`[DUPLICATE DEBUG] Final submission entry:`, submissionEntry);
4711
+ }
3061
4712
  submissionData.push(submissionEntry);
3062
4713
  }
3063
4714
  });
@@ -3072,6 +4723,9 @@ let JupiterDynamicForm = class extends LitElement {
3072
4723
  this._touched.clear();
3073
4724
  this._dirty = false;
3074
4725
  this._submitted = false;
4726
+ this._preservedFormData = {};
4727
+ this._preservedTypedMemberData = {};
4728
+ console.log("🔄 Form reset - all data and preserved data cleared");
3075
4729
  this._validateForm();
3076
4730
  this.requestUpdate();
3077
4731
  this.dispatchEvent(new CustomEvent("form-reset", {
@@ -3147,10 +4801,12 @@ let JupiterDynamicForm = class extends LitElement {
3147
4801
  .section="${section}"
3148
4802
  .columns="${section.columns || this._columns}"
3149
4803
  .formData="${this._formData}"
4804
+ .typedMemberData="${this._typedMemberData}"
3150
4805
  .disabled="${this.disabled || this.readonly}"
3151
4806
  .collapsible="${config.collapsibleSections !== false}"
3152
4807
  .locale="${config.locale || "en-US"}"
3153
4808
  @field-change="${this._handleFieldChange}"
4809
+ @typed-member-change="${this._handleTypedMemberChange}"
3154
4810
  @section-expand="${this._handleSectionExpand}"
3155
4811
  @concept-expand="${this._handleConceptExpand}"
3156
4812
  @column-remove="${this._handleColumnRemove}"
@@ -3161,6 +4817,21 @@ let JupiterDynamicForm = class extends LitElement {
3161
4817
 
3162
4818
  <!-- Form Actions - Fixed Footer -->
3163
4819
  <div class="form-actions">
4820
+ <!-- Filter Roles Button (shown when more than 10 roles) -->
4821
+ ${this._shouldShowFilterButton() ? html`
4822
+ <button
4823
+ class="filter-roles-button"
4824
+ @click="${this._handleFilterRolesClick}"
4825
+ ?disabled="${this.disabled || this.readonly}"
4826
+ >
4827
+ <svg class="filter-icon" viewBox="0 0 24 24">
4828
+ <path d="M10 18h4v-2h-4v2zM3 6v2h18V6H3zm3 7h12v-2H6v2z"/>
4829
+ </svg>
4830
+ Filter Roles
4831
+ <span class="roles-count">${this._selectedRoleIds.length}/${this._allSections.length}</span>
4832
+ </button>
4833
+ ` : ""}
4834
+
3164
4835
  <button
3165
4836
  class="btn-secondary"
3166
4837
  @click="${this._handleSaveDraft}"
@@ -3183,6 +4854,18 @@ let JupiterDynamicForm = class extends LitElement {
3183
4854
  <span>Valid: ${this._valid ? "Yes" : "No"}</span>
3184
4855
  </div>
3185
4856
  </div>
4857
+
4858
+ <!-- Filter Roles Dialog -->
4859
+ ${this._showFilterDialog ? html`
4860
+ <jupiter-filter-roles-dialog
4861
+ ?open="${this._showFilterDialog}"
4862
+ .availableRoles="${this._allSections}"
4863
+ .selectedRoleIds="${this._selectedRoleIds}"
4864
+ @dialog-cancel="${this._handleFilterDialogCancel}"
4865
+ @roles-filter-apply="${this._handleRoleFilterApply}"
4866
+ @click="${this._handleFilterDialogCancel}"
4867
+ ></jupiter-filter-roles-dialog>
4868
+ ` : ""}
3186
4869
  </div>
3187
4870
  `;
3188
4871
  }
@@ -3317,64 +5000,124 @@ JupiterDynamicForm.styles = css`
3317
5000
  color: var(--jupiter-text-secondary, #666);
3318
5001
  margin-left: auto;
3319
5002
  }
5003
+
5004
+ .filter-roles-button {
5005
+ display: flex;
5006
+ align-items: center;
5007
+ gap: 8px;
5008
+ padding: 8px 16px;
5009
+ background: transparent;
5010
+ border: 1px solid var(--jupiter-primary-color, #1976d2);
5011
+ color: var(--jupiter-primary-color, #1976d2);
5012
+ border-radius: 4px;
5013
+ font-size: 13px;
5014
+ font-weight: 500;
5015
+ cursor: pointer;
5016
+ transition: all 0.2s ease;
5017
+ margin-right: auto;
5018
+ }
5019
+
5020
+ .filter-roles-button:hover:not(:disabled) {
5021
+ background: var(--jupiter-primary-color, #1976d2);
5022
+ color: white;
5023
+ }
5024
+
5025
+ .filter-roles-button .filter-icon {
5026
+ width: 16px;
5027
+ height: 16px;
5028
+ fill: currentColor;
5029
+ }
5030
+
5031
+ .roles-count {
5032
+ display: inline-flex;
5033
+ align-items: center;
5034
+ background: var(--jupiter-primary-color, #1976d2);
5035
+ color: white;
5036
+ border-radius: 10px;
5037
+ font-size: 11px;
5038
+ font-weight: 600;
5039
+ padding: 2px 6px;
5040
+ margin-left: 4px;
5041
+ min-width: 18px;
5042
+ justify-content: center;
5043
+ }
3320
5044
  `;
3321
5045
  __decorateClass([
3322
- n2({ type: Object })
5046
+ n$1({ type: Object })
3323
5047
  ], JupiterDynamicForm.prototype, "schema", 2);
3324
5048
  __decorateClass([
3325
- n2({ type: Object })
5049
+ n$1({ type: Object })
3326
5050
  ], JupiterDynamicForm.prototype, "xbrlInput", 2);
3327
5051
  __decorateClass([
3328
- n2({ type: Object })
5052
+ n$1({ type: Object })
3329
5053
  ], JupiterDynamicForm.prototype, "config", 2);
3330
5054
  __decorateClass([
3331
- n2({ type: Object })
5055
+ n$1({ type: Object })
3332
5056
  ], JupiterDynamicForm.prototype, "initialData", 2);
3333
5057
  __decorateClass([
3334
- n2({ type: Boolean })
5058
+ n$1({ type: Boolean })
3335
5059
  ], JupiterDynamicForm.prototype, "disabled", 2);
3336
5060
  __decorateClass([
3337
- n2({ type: Boolean })
5061
+ n$1({ type: Boolean })
3338
5062
  ], JupiterDynamicForm.prototype, "readonly", 2);
3339
5063
  __decorateClass([
3340
- n2({ type: String })
5064
+ n$1({ type: String })
3341
5065
  ], JupiterDynamicForm.prototype, "periodStartDate", 2);
3342
5066
  __decorateClass([
3343
- n2({ type: String })
5067
+ n$1({ type: String })
3344
5068
  ], JupiterDynamicForm.prototype, "periodEndDate", 2);
3345
5069
  __decorateClass([
3346
- r()
5070
+ r$1()
3347
5071
  ], JupiterDynamicForm.prototype, "_formData", 2);
3348
5072
  __decorateClass([
3349
- r()
5073
+ r$1()
5074
+ ], JupiterDynamicForm.prototype, "_preservedFormData", 2);
5075
+ __decorateClass([
5076
+ r$1()
5077
+ ], JupiterDynamicForm.prototype, "_typedMemberData", 2);
5078
+ __decorateClass([
5079
+ r$1()
5080
+ ], JupiterDynamicForm.prototype, "_preservedTypedMemberData", 2);
5081
+ __decorateClass([
5082
+ r$1()
3350
5083
  ], JupiterDynamicForm.prototype, "_columns", 2);
3351
5084
  __decorateClass([
3352
- r()
5085
+ r$1()
3353
5086
  ], JupiterDynamicForm.prototype, "_errors", 2);
3354
5087
  __decorateClass([
3355
- r()
5088
+ r$1()
3356
5089
  ], JupiterDynamicForm.prototype, "_touched", 2);
3357
5090
  __decorateClass([
3358
- r()
5091
+ r$1()
3359
5092
  ], JupiterDynamicForm.prototype, "_dirty", 2);
3360
5093
  __decorateClass([
3361
- r()
5094
+ r$1()
3362
5095
  ], JupiterDynamicForm.prototype, "_valid", 2);
3363
5096
  __decorateClass([
3364
- r()
5097
+ r$1()
3365
5098
  ], JupiterDynamicForm.prototype, "_submitted", 2);
3366
5099
  __decorateClass([
3367
- r()
5100
+ r$1()
3368
5101
  ], JupiterDynamicForm.prototype, "_currentSchema", 2);
5102
+ __decorateClass([
5103
+ r$1()
5104
+ ], JupiterDynamicForm.prototype, "_allSections", 2);
5105
+ __decorateClass([
5106
+ r$1()
5107
+ ], JupiterDynamicForm.prototype, "_selectedRoleIds", 2);
5108
+ __decorateClass([
5109
+ r$1()
5110
+ ], JupiterDynamicForm.prototype, "_showFilterDialog", 2);
3369
5111
  JupiterDynamicForm = __decorateClass([
3370
- t$1("jupiter-dynamic-form")
5112
+ t$3("jupiter-dynamic-form")
3371
5113
  ], JupiterDynamicForm);
3372
- const version = "1.0.0";
5114
+ const version = "1.5.0";
3373
5115
  export {
3374
5116
  FormValidator,
3375
5117
  JupiterAddColumnDialog,
3376
5118
  JupiterConceptTree,
3377
5119
  JupiterDynamicForm,
5120
+ JupiterFilterRolesDialog,
3378
5121
  JupiterFormField,
3379
5122
  JupiterFormSection,
3380
5123
  version