jupiter-dynamic-forms 1.7.3 β†’ 1.8.0

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.
@@ -28,6 +28,12 @@ export declare class JupiterFormSection extends LitElement {
28
28
  private _handleFieldChange;
29
29
  private _flattenConcepts;
30
30
  private _expandedConcepts;
31
+ private _allTreeExpanded;
32
+ private _getAllConceptIds;
33
+ private _expandAllTrees;
34
+ private _collapseAllTrees;
35
+ private _toggleAllTrees;
36
+ private _handleTreeCheckboxChange;
31
37
  private _handleConceptExpand;
32
38
  private _getTypedMemberHeaderValue;
33
39
  private _handleTypedMemberHeaderChange;
@@ -1 +1 @@
1
- {"version":3,"file":"form-section.d.ts","sourceRoot":"","sources":["../../src/core/form-section.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAa,MAAM,KAAK,CAAC;AAE5C,OAAO,EAAE,WAAW,EAAE,UAAU,EAAe,MAAM,iBAAiB,CAAC;AACvE,OAAO,gBAAgB,CAAC;AACxB,OAAO,qBAAqB,CAAC;AAC7B,OAAO,EAAoB,kBAAkB,EAAE,MAAM,qBAAqB,CAAC;AAE3E,qBACa,kBAAmB,SAAQ,UAAU;IACpB,OAAO,EAAG,WAAW,CAAC;IACvB,OAAO,EAAE,UAAU,EAAE,CAAM;IAC1B,QAAQ,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAM;IACnC,eAAe,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC,CAAM;IAC5D,QAAQ,UAAS;IACjB,WAAW,UAAQ;IACpB,MAAM,SAAW;IAClB,mBAAmB,EAAE,kBAAkB,EAAE,CAAM;IAEjE,OAAO,CAAC,SAAS,CAAQ;IACzB,OAAO,CAAC,oBAAoB,CAAS;IACrC,OAAO,CAAC,kBAAkB,CAAgD;IAEnF,MAAM,CAAC,MAAM,0BA6NX;IAEF,iBAAiB;IAMjB,OAAO,CAAC,oBAAoB;IAwC5B,OAAO,CAAC,0BAA0B;IAelC,OAAO,CAAC,eAAe;IAcvB,OAAO,CAAC,mBAAmB;IAU3B,OAAO,CAAC,gBAAgB;IASxB,OAAO,CAAC,0BAA0B;IA2BlC,OAAO,CAAC,sBAAsB;IAkB9B,OAAO,CAAC,mBAAmB;IAI3B,OAAO,CAAC,gBAAgB;IAcxB,OAAO,CAAC,kBAAkB;IAQ1B,OAAO,CAAC,gBAAgB;IAgBf,OAAO,CAAC,iBAAiB,CAAqB;IAEvD,OAAO,CAAC,oBAAoB;IAmB5B,OAAO,CAAC,0BAA0B;IAKlC,OAAO,CAAC,8BAA8B;IAiBtC,MAAM;CA0HP"}
1
+ {"version":3,"file":"form-section.d.ts","sourceRoot":"","sources":["../../src/core/form-section.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAa,MAAM,KAAK,CAAC;AAE5C,OAAO,EAAE,WAAW,EAAE,UAAU,EAAe,MAAM,iBAAiB,CAAC;AACvE,OAAO,gBAAgB,CAAC;AACxB,OAAO,qBAAqB,CAAC;AAC7B,OAAO,EAAoB,kBAAkB,EAAE,MAAM,qBAAqB,CAAC;AAE3E,qBACa,kBAAmB,SAAQ,UAAU;IACpB,OAAO,EAAG,WAAW,CAAC;IACvB,OAAO,EAAE,UAAU,EAAE,CAAM;IAC1B,QAAQ,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAM;IACnC,eAAe,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC,CAAM;IAC5D,QAAQ,UAAS;IACjB,WAAW,UAAQ;IACpB,MAAM,SAAW;IAClB,mBAAmB,EAAE,kBAAkB,EAAE,CAAM;IAEjE,OAAO,CAAC,SAAS,CAAQ;IACzB,OAAO,CAAC,oBAAoB,CAAS;IACrC,OAAO,CAAC,kBAAkB,CAAgD;IAEnF,MAAM,CAAC,MAAM,0BAkQX;IAEF,iBAAiB;IAMjB,OAAO,CAAC,oBAAoB;IAwC5B,OAAO,CAAC,0BAA0B;IAelC,OAAO,CAAC,eAAe;IAcvB,OAAO,CAAC,mBAAmB;IAU3B,OAAO,CAAC,gBAAgB;IASxB,OAAO,CAAC,0BAA0B;IA2BlC,OAAO,CAAC,sBAAsB;IAkB9B,OAAO,CAAC,mBAAmB;IAI3B,OAAO,CAAC,gBAAgB;IAcxB,OAAO,CAAC,kBAAkB;IAQ1B,OAAO,CAAC,gBAAgB;IAgBf,OAAO,CAAC,iBAAiB,CAAqB;IAC9C,OAAO,CAAC,gBAAgB,CAAS;IAE1C,OAAO,CAAC,iBAAiB;IAazB,OAAO,CAAC,eAAe;IAOvB,OAAO,CAAC,iBAAiB;IAMzB,OAAO,CAAC,eAAe;IAevB,OAAO,CAAC,yBAAyB;IAgBjC,OAAO,CAAC,oBAAoB;IAuB5B,OAAO,CAAC,0BAA0B;IAKlC,OAAO,CAAC,8BAA8B;IAiBtC,MAAM;CAuIP"}
package/dist/index.js CHANGED
@@ -14,12 +14,12 @@
14
14
  * Copyright 2017 Google LLC
15
15
  * SPDX-License-Identifier: BSD-3-Clause
16
16
  */
17
- const D={attribute:!0,type:String,converter:v,reflect:!1,hasChanged:x},I=(e=D,t,i)=>{const{kind:o,metadata:r}=i;let s=globalThis.litPropertyMetadata.get(r);if(void 0===s&&globalThis.litPropertyMetadata.set(r,s=new Map),"setter"===o&&((e=Object.create(e)).wrapped=!0),s.set(i.name,e),"accessor"===o){const{name:o}=i;return{set(i){const r=t.get.call(this);t.set.call(this,i),this.requestUpdate(o,r,e)},init(t){return void 0!==t&&this.C(o,void 0,e,t),t}}}if("setter"===o){const{name:o}=i;return function(i){const r=this[o];t.call(this,i),this.requestUpdate(o,r,e)}}throw Error("Unsupported decorator location: "+o)};function w(e){return(t,i)=>"object"==typeof i?I(e,t,i):((e,t,i)=>{const o=t.hasOwnProperty(i);return t.constructor.createProperty(i,e),o?Object.getOwnPropertyDescriptor(t,i):void 0})(e,t,i)}
17
+ const I={attribute:!0,type:String,converter:v,reflect:!1,hasChanged:x},D=(e=I,t,i)=>{const{kind:o,metadata:r}=i;let s=globalThis.litPropertyMetadata.get(r);if(void 0===s&&globalThis.litPropertyMetadata.set(r,s=new Map),"setter"===o&&((e=Object.create(e)).wrapped=!0),s.set(i.name,e),"accessor"===o){const{name:o}=i;return{set(i){const r=t.get.call(this);t.set.call(this,i),this.requestUpdate(o,r,e)},init(t){return void 0!==t&&this.C(o,void 0,e,t),t}}}if("setter"===o){const{name:o}=i;return function(i){const r=this[o];t.call(this,i),this.requestUpdate(o,r,e)}}throw Error("Unsupported decorator location: "+o)};function w(e){return(t,i)=>"object"==typeof i?D(e,t,i):((e,t,i)=>{const o=t.hasOwnProperty(i);return t.constructor.createProperty(i,e),o?Object.getOwnPropertyDescriptor(t,i):void 0})(e,t,i)}
18
18
  /**
19
19
  * @license
20
20
  * Copyright 2017 Google LLC
21
21
  * SPDX-License-Identifier: BSD-3-Clause
22
- */function C(e){return w({...e,state:!0,attribute:!1})}class S{static validateField(e,t,i,o,r,s=[]){const n=[];for(const a of s){const s=this.validateRule(e,t,i,o,r,a);s&&n.push(s)}return n}static validateRule(e,t,i,o,r,s){const n=null==o||""===o;switch(s.type){case"required":if(n)return this.createError(e,t,i,s);break;case"min":if(!n&&"number"==typeof o&&o<s.value)return this.createError(e,t,i,s);break;case"max":if(!n&&"number"==typeof o&&o>s.value)return this.createError(e,t,i,s);break;case"minLength":if(!n&&"string"==typeof o&&o.length<s.value)return this.createError(e,t,i,s);break;case"maxLength":if(!n&&"string"==typeof o&&o.length>s.value)return this.createError(e,t,i,s);break;case"pattern":if(!n&&"string"==typeof o){if(!new RegExp(s.value).test(o))return this.createError(e,t,i,s)}break;case"email":if(!n&&"string"==typeof o){if(!/^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(o))return this.createError(e,t,i,s)}break;case"url":if(!n&&"string"==typeof o)try{new URL(o)}catch{return this.createError(e,t,i,s)}break;case"custom":break;default:console.warn(`Unknown validation rule type: ${s.type}`)}return null}static createError(e,t,i,o){return{fieldId:e,conceptId:t,columnId:i,message:o.message,severity:o.severity||"error",rule:o}}static validateDataType(e,t){if(null==e||""===e)return{valid:!0,convertedValue:e};switch(t){case"number":case"decimal":case"currency":case"percentage":{const t=Number(e);return isNaN(t)?{valid:!1,error:"Invalid number format"}:{valid:!0,convertedValue:t}}case"date":{const t=new Date(e);return isNaN(t.getTime())?{valid:!1,error:"Invalid date format"}:{valid:!0,convertedValue:t.toISOString().split("T")[0]}}case"datetime":{const t=new Date(e);return isNaN(t.getTime())?{valid:!1,error:"Invalid datetime format"}:{valid:!0,convertedValue:t.toISOString()}}case"boolean":if("boolean"==typeof e)return{valid:!0,convertedValue:e};if("string"==typeof e){const t=e.toLowerCase();if("true"===t||"1"===t)return{valid:!0,convertedValue:!0};if("false"===t||"0"===t)return{valid:!0,convertedValue:!1}}return{valid:!1,error:"Invalid boolean format"};case"text":case"textarea":case"email":case"url":case"tel":return{valid:!0,convertedValue:String(e)};default:return{valid:!0,convertedValue:e}}}static formatValue(e,t,i="en-US"){if(null==e)return"";switch(t){case"number":return new Intl.NumberFormat(i).format(Number(e));case"decimal":return new Intl.NumberFormat(i,{minimumFractionDigits:2,maximumFractionDigits:2}).format(Number(e));case"currency":return new Intl.NumberFormat(i,{style:"currency",currency:"USD"}).format(Number(e));case"percentage":return new Intl.NumberFormat(i,{style:"percent",minimumFractionDigits:2}).format(Number(e)/100);case"date":return new Date(e).toLocaleDateString(i);case"datetime":return new Date(e).toLocaleString(i);default:return String(e)}}}class F{static createUniqueConceptId(e,t){let i=e.id;if(e.preferredLabel&&""!==e.preferredLabel.trim()){const t=e.preferredLabel.match(/\/([^\/]+)$/),o=t?t[1]:e.preferredLabel.replace(/[^a-zA-Z0-9]/g,"_");i=`${e.id}_${o}`}if(t){return`${i}__${this.createSectionHash(t)}`}return i}static createSectionHash(e){let t=0;for(let i=0;i<e.length;i++){t=(t<<5)-t+e.charCodeAt(i),t&=t}return Math.abs(t).toString(36).substr(0,6)}static buildFormSchema(e,t,i){var o;if(!e.presentation||0===e.presentation.length)throw new Error("XBRL presentation data is required");const r=e.presentation[0],s=null==(o=e.hypercubes)?void 0:o[0],n=[];return r.roles.forEach(e=>{const o=this.buildSectionFromRole(e,t,i,s);this.assignFieldColumnIds(o),n.push(o)}),{formId:`xbrl-form-${Date.now()}`,title:`XBRL Form - ${this.extractEntityName(r.entrypoint)}`,description:"Dynamic form generated from XBRL taxonomy data",version:"1.0.0",sections:n}}static buildSectionFromRole(e,t,i,o){var r;const s=this.extractRoleTitle(e.role),n=this.getAllNonAbstractConcepts(e),a=new Set(n.filter(e=>e.periodType).map(e=>e.periodType)),l=null==o?void 0:o.roles.find(t=>t.roleId===e.id);l?console.log(`🏷️ Found matching hypercube role "${e.id}"`):console.log(`❌ No hypercube role found for "${e.id}"`);const d=this.generateDefaultColumnsForRole(e,t||"2025-01-01",i||"2025-12-31",l,n,a),c=d.map(e=>e.id);console.log(`πŸ“‹ Available column IDs for role "${e.id}":`,c),c.some(e=>e.includes("multi_"))&&(console.log(`πŸ” [DEBUG] Multi-dimensional role "${e.role}" - Total columns generated: ${d.length}`),d.forEach((e,t)=>{console.log(` Column ${t}: id=${e.id}, title=${e.title}, type=${e.type}`)}));const p={periodTypes:a,availableColumnIds:c},m=[];return(null==(r=e.presentationLinkbase)?void 0:r.concepts)&&e.presentationLinkbase.concepts.forEach(o=>{const r=this.buildConceptTree(o,0,t,i,p,e.id);r&&m.push(r)}),{id:e.id,title:s,description:e.description||`Section for ${s}`,concepts:m,columns:d,expanded:!1,metadata:{roleURI:e.roleURI,originalRole:e.role}}}static buildConceptTree(e,t,i,o,r,s){const n=this.getPreferredLabel(e.labels),a=[];if(!e.elementAbstract){let t=[];(null==r?void 0:r.availableColumnIds)&&r.availableColumnIds.length>0?(t=r.availableColumnIds.filter(t=>"instant"===e.periodType?t.includes("instant")||"instant"===t:"duration"!==e.periodType||(t.includes("duration")||"duration"===t)),0===t.length&&(t=r.availableColumnIds)):t=(null==r?void 0:r.periodTypes)&&0!==r.periodTypes.size?1===r.periodTypes.size&&r.periodTypes.has("instant")?["instant"]:1===r.periodTypes.size&&r.periodTypes.has("duration")?["duration"]:"instant"===e.periodType?["instant"]:"duration"===e.periodType?["duration"]:["duration","instant"]:["default"],t.forEach(t=>{const r=this.createFieldFromConcept(e,i,o,t);r&&a.push(r)})}const l=[];e.children&&e.children.length>0&&e.children.forEach(e=>{const n=this.buildConceptTree(e,t+1,i,o,r,s);n&&l.push(n)});return a.length>0||l.length>0?{id:this.createUniqueConceptId(e,s),originalConceptId:e.id,name:e.conceptName,label:n,description:`${e.conceptName} (${e.type})`,level:t,children:l,fields:a,collapsed:t>0,abstract:e.elementAbstract,periodType:e.periodType}:null}static createFieldFromConcept(e,t,i,o){const r=this.mapXBRLTypeToFieldType(e.type),s=this.getPreferredLabel(e.labels);let n;n=o||("instant"===e.periodType?"instant":"duration"===e.periodType?"duration":"default");const a={id:`${e.id}_${n}_field`,conceptId:e.id,columnId:n,type:r,label:s,placeholder:`Enter ${s.toLowerCase()}`,required:!1,disabled:e.elementAbstract,defaultValue:null};return"duration"!==e.periodType&&"instant"!==e.periodType||(a.periodStartDate=t||"2025-01-01",a.periodEndDate=i||"2025-12-31"),a}static mapXBRLTypeToFieldType(e){return{"xbrli:stringItemType":"text","xbrli:monetaryItemType":"currency","xbrli:integerItemType":"number","xbrli:decimalItemType":"decimal","xbrli:percentItemType":"percentage","xbrli:dateItemType":"date","xbrli:booleanItemType":"boolean","dtr-types:domainItemType":"select","bw2-titel9:chamberOfCommerceRegistrationNumberItemType":"text"}[e]||"text"}static getPreferredLabel(e){if(!e||0===e.length)return"Unnamed Concept";const t=e.find(e=>e.preferredLabel);if(t)return t.label;const i=e.find(e=>"http://www.xbrl.org/2003/role/label"===e.role);if(i)return i.label;const o=e.find(e=>"http://www.xbrl.org/2003/role/terseLabel"===e.role);return o?o.label:e[0].label}static assignFieldColumnIds(e){if(!e.columns||0===e.columns.length)return;const t=e.columns.map(e=>e.id);e.concepts.forEach(e=>{this.assignColumnIdsToConceptFields(e,t)})}static assignColumnIdsToConceptFields(e,t){e.fields=e.fields.filter(e=>t.includes(e.columnId)),e.children&&e.children.forEach(e=>{this.assignColumnIdsToConceptFields(e,t)})}static countFieldsInTree(e){let t=e.fields.length;return e.children&&e.children.forEach(e=>{t+=this.countFieldsInTree(e)}),t}static getAllNonAbstractConcepts(e){var t;const i=[];return(null==(t=e.presentationLinkbase)?void 0:t.concepts)&&e.presentationLinkbase.concepts.forEach(e=>{this.collectNonAbstractConcepts(e,i)}),i}static collectNonAbstractConcepts(e,t){e.elementAbstract||t.push(e),e.children&&e.children.length>0&&e.children.forEach(e=>{this.collectNonAbstractConcepts(e,t)})}static generateDefaultColumnsForRole(e,t,i,o,r,s){var n,a,l;const d=r||this.getAllNonAbstractConcepts(e),c=s||new Set(d.filter(e=>e.periodType).map(e=>e.periodType));if(console.log(`πŸ“Š Analyzing role "${e.role}" with ${d.length} non-abstract concepts`),0===d.length)return console.log("πŸ“Š No non-abstract concepts found, using default column"),[{id:"default",title:"Value",description:"Default value column",type:"base",order:0,removable:!1}];let p=[];if(1===(null==(n=null==o?void 0:o.items)?void 0:n.length)){const r=o.items[0];console.log(`πŸ” Processing hypercube item for role "${e.role}":`,{itemId:r.id,conceptIds:(null==(a=r.conceptIds)?void 0:a.length)||0,dimensions:r.dimensions.length}),1===r.dimensions.length?p=this.generateSingleDimensionColumns(r.dimensions[0],t,i,c):r.dimensions.length>1&&(p=this.generateMultiDimensionColumns(r.dimensions,t,i,c))}else(null==(l=null==o?void 0:o.items)?void 0:l.length)&&o.items.length>1&&console.log(`⚠️ Multiple items found (${o.items.length}), skipping for now`);console.log(`πŸ“… Found period types: ${Array.from(c).join(", ")}`);const m=[];return p.length>0?m.push(...p):0===c.size?(console.log("πŸ“… No period types found, using default column"),m.push({id:"default",title:"Value",description:"Default value column",type:"base",order:0,removable:!1})):1===c.size&&c.has("instant")?(console.log("πŸ“… All concepts are instant type, creating single column"),m.push({id:"instant",title:"Current",description:`Values as of ${t}`,type:"base",order:0,removable:!1})):1===c.size&&c.has("duration")?(console.log("πŸ“… All concepts are duration type, creating single column with period range"),m.push({id:"duration",title:"Current Period",description:`Period: ${t} to ${i}`,type:"base",order:0,removable:!1})):(console.log("πŸ“… Mixed period types found, creating both duration and instant columns"),m.push({id:"duration",title:"Current Period",description:`Period: ${t} to ${i}`,type:"base",order:0,removable:!1}),m.push({id:"instant",title:"Current",description:`Values as of ${t}`,type:"base",order:1,removable:!1})),console.log(`πŸ“Š Generated ${m.length} columns for role "${e.role}":`,m.map(e=>e.title)),m}static generateSingleDimensionColumns(e,t,i,o){var r,s,n,a,l;if(console.log("πŸ“Š Processing single dimension:",{id:e.id,conceptName:e.conceptName,hasMembers:!(!e.members||!Array.isArray(e.members)),membersCount:(null==(r=e.members)?void 0:r.length)||0,hasTypedMember:!!e.typedMember,typedMemberId:null==(s=e.typedMember)?void 0:s.id}),e.typedMember&&(!e.members||0===e.members.length)){console.log(`πŸ”€ Processing typed dimension: ${e.id} with typed member: ${e.typedMember.id}`);const r=(null==(n=e.labels.find(e=>"http://www.xbrl.org/2003/role/label"===e.role))?void 0:n.label)||e.conceptName,s={axisId:e.id,axisLabel:r,typedMemberId:e.typedMember.id,dimensionKey:`${r} | [Typed Input]`,dimensionIdKey:`${e.id}|[typed]`};console.log("πŸ”€ Generated typed dimension info:",s);const a=[];return 0===o.size?a.push({id:"typed-default",title:r,description:"Typed dimension input column",type:"dimension",dimensionData:{dimensionId:"typed-default",axisId:s.axisId,memberId:"[typed]",memberValue:"Typed Input",memberLabel:"Typed Input",axis:s.axisLabel,axisLabel:s.axisLabel,memberKey:s.dimensionKey,dimensionIdKey:s.dimensionIdKey,hasTypedMembers:!0,typedMemberId:s.typedMemberId,typedMembers:[{axisId:s.axisId,axisLabel:s.axisLabel,typedMemberId:s.typedMemberId,memberLabel:s.axisLabel}]},order:0,removable:!1}):1===o.size&&o.has("instant")?a.push({id:"typed-instant",title:`${r} [Typed Input Available]`,description:`Typed values as of ${t}`,type:"dimension",dimensionData:{dimensionId:"typed-instant",axisId:s.axisId,memberId:"[typed]",memberValue:"Typed Input",memberLabel:"Typed Input",axis:s.axisLabel,axisLabel:s.axisLabel,memberKey:s.dimensionKey,dimensionIdKey:s.dimensionIdKey,hasTypedMembers:!0,typedMemberId:s.typedMemberId,typedMembers:[{axisId:s.axisId,axisLabel:s.axisLabel,typedMemberId:s.typedMemberId,memberLabel:s.axisLabel}]},order:0,removable:!1}):1===o.size&&o.has("duration")?a.push({id:"typed-duration",title:`${r} [Typed Input Available]`,description:`Typed values for period ${t} to ${i}`,type:"dimension",dimensionData:{dimensionId:"typed-duration",axisId:s.axisId,memberId:"[typed]",memberValue:"Typed Input",memberLabel:"Typed Input",axis:s.axisLabel,axisLabel:s.axisLabel,memberKey:s.dimensionKey,dimensionIdKey:s.dimensionIdKey,hasTypedMembers:!0,typedMemberId:s.typedMemberId,typedMembers:[{axisId:s.axisId,axisLabel:s.axisLabel,typedMemberId:s.typedMemberId,memberLabel:s.axisLabel}]},order:0,removable:!1}):(a.push({id:"typed-duration",title:`${r} [Typed Input Available]`,description:`Typed values for period ${t} to ${i}`,type:"dimension",dimensionData:{dimensionId:"typed-duration",axisId:s.axisId,memberId:"[typed]",memberValue:"Typed Input",memberLabel:"Typed Input",axis:s.axisLabel,axisLabel:s.axisLabel,memberKey:s.dimensionKey,dimensionIdKey:s.dimensionIdKey,hasTypedMembers:!0,typedMemberId:s.typedMemberId,typedMembers:[{axisId:s.axisId,axisLabel:s.axisLabel,typedMemberId:s.typedMemberId,memberLabel:s.axisLabel}]},order:0,removable:!1}),a.push({id:"typed-instant",title:`${r} [Typed Input Available]`,description:`Typed values as of ${t}`,type:"dimension",dimensionData:{dimensionId:"typed-instant",axisId:s.axisId,memberId:"[typed]",memberValue:"Typed Input",memberLabel:"Typed Input",axis:s.axisLabel,axisLabel:s.axisLabel,memberKey:s.dimensionKey,dimensionIdKey:s.dimensionIdKey,hasTypedMembers:!0,typedMemberId:s.typedMemberId,typedMembers:[{axisId:s.axisId,axisLabel:s.axisLabel,typedMemberId:s.typedMemberId,memberLabel:s.axisLabel}]},order:1,removable:!1})),console.log(`πŸ”€ Generated ${a.length} typed dimension columns`),a}if(!e.members||!Array.isArray(e.members))return console.log(`⚠️ Dimension ${e.id} has no members defined and no typed member, skipping column generation`),[];if(console.log("πŸ“Š Found single dimension:",{id:e.id,conceptName:e.conceptName,membersCount:e.members.length}),0===e.members.length)return[];const d=(null==(a=e.labels.find(e=>"http://www.xbrl.org/2003/role/label"===e.role))?void 0:a.label)||e.conceptName,c=e.members[0],p=(null==(l=c.labels.find(e=>"http://www.xbrl.org/2003/role/label"===e.role))?void 0:l.label)||c.conceptName,m={axisId:e.id,axisLabel:d,memberId:c.id,memberLabel:p,dimensionKey:`${d} | ${p}`,dimensionIdKey:`${e.id} | ${c.id}`};console.log("πŸ“Š Generated dimension info:",m);const h=[];return 0===o.size?h.push({id:"default",title:m.memberLabel,description:"Default value column",type:"dimension",dimensionData:{dimensionId:"default",axisId:m.axisId,memberId:m.memberId,memberValue:m.memberLabel,memberLabel:m.memberLabel,axis:m.axisLabel,axisLabel:m.axisLabel,memberKey:m.dimensionKey,dimensionIdKey:m.dimensionIdKey},order:0,removable:!1}):1===o.size&&o.has("instant")?h.push({id:"instant",title:`${m.memberLabel}`,description:`Values as of ${t}`,type:"dimension",dimensionData:{dimensionId:"instant",axisId:m.axisId,memberId:m.memberId,memberValue:m.memberLabel,memberLabel:m.memberLabel,axis:m.axisLabel,axisLabel:m.axisLabel,memberKey:m.dimensionKey,dimensionIdKey:m.dimensionIdKey},order:0,removable:!1}):1===o.size&&o.has("duration")?h.push({id:"duration",title:`${m.memberLabel}`,description:`Period: ${t} to ${i}`,type:"dimension",dimensionData:{dimensionId:"duration",axisId:m.axisId,memberId:m.memberId,memberValue:m.memberLabel,memberLabel:m.memberLabel,axis:m.axisLabel,axisLabel:m.axisLabel,memberKey:m.dimensionKey,dimensionIdKey:m.dimensionIdKey},order:0,removable:!1}):(h.push({id:"duration",title:`${m.memberLabel}`,description:`Period: ${t} to ${i}`,type:"dimension",dimensionData:{dimensionId:"duration",axisId:m.axisId,memberId:m.memberId,memberValue:m.memberLabel,memberLabel:m.memberLabel,axis:m.axisLabel,axisLabel:m.axisLabel,memberKey:m.dimensionKey,dimensionIdKey:m.dimensionIdKey},order:0,removable:!1}),h.push({id:"instant",title:`${m.memberLabel}`,description:`Values as of ${t}`,type:"dimension",dimensionData:{dimensionId:"instant",axisId:m.axisId,memberId:m.memberId,memberValue:m.memberLabel,memberLabel:m.memberLabel,axis:m.axisLabel,axisLabel:m.axisLabel,memberKey:m.dimensionKey,dimensionIdKey:m.dimensionIdKey},order:1,removable:!1})),h}static generateMultiDimensionColumns(e,t,i,o){console.log(`πŸ“Š Processing ${e.length} dimensions for multi-dimensional columns`),console.log("πŸ” [DEBUG] Input dimensions:",e.map(e=>{var t,i,o;return{id:e.id,label:null==(i=null==(t=e.labels)?void 0:t.find(e=>"http://www.xbrl.org/2003/role/label"===e.role))?void 0:i.label,membersCount:(null==(o=e.members)?void 0:o.length)||0,hasTypedMember:!!e.typedMember}}));e.some(e=>e.typedMember)&&console.log("πŸ”€ Found typed members in dimensions - will indicate in column headers");const r=e.filter(e=>e.typedMember?(console.log(`πŸ”€ Keeping typed dimension: ${e.id} with typed member: ${e.typedMember.id}`),!0):e.members&&Array.isArray(e.members)&&e.members.length>0?(console.log(`πŸ“‚ Keeping domain dimension: ${e.id} with ${e.members.length} members`),!0):(console.log(`⚠️ Skipping dimension ${e.id} - no members or typed member defined`),!1));if(0===r.length)return console.log("⚠️ No valid dimensions with members found, skipping multi-dimensional column generation"),[];const s=r.map(e=>{var t;const i=(null==(t=e.labels.find(e=>"http://www.xbrl.org/2003/role/label"===e.role))?void 0:t.label)||e.conceptName;if(e.typedMember)return{id:e.id,axisLabel:i,isTyped:!0,typedMemberId:e.typedMember.id,members:[{id:"[typed]",label:`${i} [Typed Input Available]`}]};const o=this.getAllDimensionMembers(e.members);return{id:e.id,axisLabel:i,isTyped:!1,members:o.map(e=>{var t;return{id:e.id,label:(null==(t=e.labels.find(e=>"http://www.xbrl.org/2003/role/label"===e.role))?void 0:t.label)||e.conceptName}})}}),n=this.generateDimensionCombinations(s);console.log(`πŸ“Š Generated ${n.length} dimension combinations`),console.log("πŸ” [DEBUG] Generated combinations:",n.map(e=>({memberLabels:e.map(e=>e.memberLabel),axisIds:e.map(e=>e.axisId),memberIds:e.map(e=>e.memberId)})));const a=[];return n.forEach((e,r)=>{var s,n;const l=e.map(e=>e.memberLabel).join(" | "),d=e.filter(e=>e.isTyped),c=e.filter(e=>!e.isTyped);console.log(`πŸ” [Column ${r}] Combination analysis:`,{totalMembers:e.length,typedMembers:d.length,domainMembers:c.length,hasTypedMembers:d.length>0,columnTitle:l,memberLabels:e.map(e=>e.memberLabel),memberIds:e.map(e=>e.memberId)});const p={dimensionId:`multi_${r}`,memberValue:l,memberLabel:l,combinations:c.map(e=>({axisId:e.axisId,axisLabel:e.axisLabel,memberId:e.memberId,memberLabel:e.memberLabel})),typedMembers:d.map(e=>({axisId:e.axisId,axisLabel:e.axisLabel,typedMemberId:e.typedMemberId,memberLabel:e.memberLabel})),hasTypedMembers:d.length>0,memberKey:l,dimensionIdKey:[...c.map(e=>`${e.axisId}|${e.memberId}`),...d.map(e=>`${e.axisId}|[typed]`)].join("::")};console.log(`πŸ” [Column ${r}] Final dimension data:`,{dimensionId:p.dimensionId,memberLabel:p.memberLabel,dimensionIdKey:p.dimensionIdKey,combinationsCount:null==(s=p.combinations)?void 0:s.length,typedMembersCount:null==(n=p.typedMembers)?void 0:n.length}),0===o.size||1===o.size&&o.has("duration")?a.push({id:`duration_${r}`,title:`${l}`,description:`Period: ${t} to ${i}`,type:"dimension",dimensionData:{...p,dimensionId:`duration_${r}`},order:2*r,removable:!1}):1===o.size&&o.has("instant")?a.push({id:`instant_${r}`,title:`${l}`,description:`Values as of ${t}`,type:"dimension",dimensionData:{...p,dimensionId:`instant_${r}`},order:2*r,removable:!1}):(a.push({id:`duration_${r}`,title:`${l}`,description:`Period: ${t} to ${i}`,type:"dimension",dimensionData:{...p,dimensionId:`duration_${r}`},order:2*r,removable:!1}),a.push({id:`instant_${r}`,title:`${l}`,description:`Values as of ${t}`,type:"dimension",dimensionData:{...p,dimensionId:`instant_${r}`},order:2*r+1,removable:!1}))}),console.log(`πŸ“Š Generated ${a.length} multi-dimensional columns`),a}static getAllDimensionMembers(e){if(!e||!Array.isArray(e))return[];const t=[];return e.forEach(e=>{t.push(e),e.children&&e.children.length>0&&t.push(...this.getAllDimensionMembers(e.children))}),t}static generateDimensionCombinations(e){if(0===e.length)return[];if(1===e.length)return e[0].members.map(t=>[{axisId:e[0].id,axisLabel:e[0].axisLabel,memberId:t.id,memberLabel:t.label,isTyped:e[0].isTyped||!1,typedMemberId:e[0].typedMemberId}]);const[t,...i]=e,o=this.generateDimensionCombinations(i),r=[];return t.members.forEach(e=>{0===o.length?r.push([{axisId:t.id,axisLabel:t.axisLabel,memberId:e.id,memberLabel:e.label,isTyped:t.isTyped||!1,typedMemberId:t.typedMemberId}]):o.forEach(i=>{r.push([{axisId:t.id,axisLabel:t.axisLabel,memberId:e.id,memberLabel:e.label,isTyped:t.isTyped||!1,typedMemberId:t.typedMemberId},...i])})}),r}static formatDateForDisplay(e){try{return new Date(e).toLocaleDateString("en-US",{year:"numeric",month:"short",day:"numeric"})}catch{return e}}static extractEntityName(e){try{const t=new URL(e).pathname.split("/");return t[t.length-1].replace(".xsd","").replace(/[^a-zA-Z0-9]/g," ").trim()||"Entity"}catch{return"Entity"}}static extractRoleTitle(e){const t=e.match(/^\[[\d]+\]\s*(.+)$/);return t?t[1].trim():e}static extractRoleOrder(e){const t=e.match(/^\[([\d]+)\]/);return t?parseInt(t[1],10):0}static buildColumnsFromHypercubes(){return[{id:"default",label:"Values",type:"data"}]}}var T=Object.defineProperty,E=Object.getOwnPropertyDescriptor,k=(e,t,i,o)=>{for(var r,s=o>1?void 0:o?E(t,i):t,n=e.length-1;n>=0;n--)(r=e[n])&&(s=(o?r(t,i,s):r(s))||s);return o&&s&&T(t,i,s),s};exports.JupiterFormField=class extends e.LitElement{constructor(){super(...arguments),this.value=null,this.disabled=!1,this.locale="en-US",this.hideLabel=!1,this._errors=[],this._touched=!1}willUpdate(e){(e.has("value")||e.has("field"))&&this._validateField()}_validateField(){var e;(null==(e=this.field)?void 0:e.validation)&&(this._errors=S.validateField(this.field.id,this.conceptId,this.columnId,this.value,this.field.type,this.field.validation))}_handleInput(e){const t=e.target;let i=t.value;"number"===this.field.type||"decimal"===this.field.type?i=""===i?null:Number(i):"boolean"===this.field.type&&(i=t.checked),this.value=i,this._touched=!0,this.dispatchEvent(new CustomEvent("field-change",{detail:{fieldId:this.field.id,conceptId:this.conceptId,columnId:this.columnId,value:i,oldValue:this.value},bubbles:!0}))}_handleFocus(){this.dispatchEvent(new CustomEvent("field-focus",{detail:{fieldId:this.field.id,conceptId:this.conceptId,columnId:this.columnId},bubbles:!0}))}_handleBlur(){this._touched=!0,this.dispatchEvent(new CustomEvent("field-blur",{detail:{fieldId:this.field.id,conceptId:this.conceptId,columnId:this.columnId},bubbles:!0}))}_renderInput(){var t;const i=this._errors.some(e=>"error"===e.severity),o=this._errors.some(e=>"warning"===e.severity),r="field-input "+(i?"error":o?"warning":""),s=`${this.conceptId}__${this.columnId}`,n=`data[${this.conceptId}][${this.columnId}]`;switch(this.field.type){case"textarea":return e.html`
22
+ */function C(e){return w({...e,state:!0,attribute:!1})}class S{static validateField(e,t,i,o,r,s=[]){const n=[];for(const a of s){const s=this.validateRule(e,t,i,o,r,a);s&&n.push(s)}return n}static validateRule(e,t,i,o,r,s){const n=null==o||""===o;switch(s.type){case"required":if(n)return this.createError(e,t,i,s);break;case"min":if(!n&&"number"==typeof o&&o<s.value)return this.createError(e,t,i,s);break;case"max":if(!n&&"number"==typeof o&&o>s.value)return this.createError(e,t,i,s);break;case"minLength":if(!n&&"string"==typeof o&&o.length<s.value)return this.createError(e,t,i,s);break;case"maxLength":if(!n&&"string"==typeof o&&o.length>s.value)return this.createError(e,t,i,s);break;case"pattern":if(!n&&"string"==typeof o){if(!new RegExp(s.value).test(o))return this.createError(e,t,i,s)}break;case"email":if(!n&&"string"==typeof o){if(!/^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(o))return this.createError(e,t,i,s)}break;case"url":if(!n&&"string"==typeof o)try{new URL(o)}catch{return this.createError(e,t,i,s)}break;case"custom":break;default:console.warn(`Unknown validation rule type: ${s.type}`)}return null}static createError(e,t,i,o){return{fieldId:e,conceptId:t,columnId:i,message:o.message,severity:o.severity||"error",rule:o}}static validateDataType(e,t){if(null==e||""===e)return{valid:!0,convertedValue:e};switch(t){case"number":case"decimal":case"currency":case"percentage":{const t=Number(e);return isNaN(t)?{valid:!1,error:"Invalid number format"}:{valid:!0,convertedValue:t}}case"date":{const t=new Date(e);return isNaN(t.getTime())?{valid:!1,error:"Invalid date format"}:{valid:!0,convertedValue:t.toISOString().split("T")[0]}}case"datetime":{const t=new Date(e);return isNaN(t.getTime())?{valid:!1,error:"Invalid datetime format"}:{valid:!0,convertedValue:t.toISOString()}}case"boolean":if("boolean"==typeof e)return{valid:!0,convertedValue:e};if("string"==typeof e){const t=e.toLowerCase();if("true"===t||"1"===t)return{valid:!0,convertedValue:!0};if("false"===t||"0"===t)return{valid:!0,convertedValue:!1}}return{valid:!1,error:"Invalid boolean format"};case"text":case"textarea":case"email":case"url":case"tel":return{valid:!0,convertedValue:String(e)};default:return{valid:!0,convertedValue:e}}}static formatValue(e,t,i="en-US"){if(null==e)return"";switch(t){case"number":return new Intl.NumberFormat(i).format(Number(e));case"decimal":return new Intl.NumberFormat(i,{minimumFractionDigits:2,maximumFractionDigits:2}).format(Number(e));case"currency":return new Intl.NumberFormat(i,{style:"currency",currency:"USD"}).format(Number(e));case"percentage":return new Intl.NumberFormat(i,{style:"percent",minimumFractionDigits:2}).format(Number(e)/100);case"date":return new Date(e).toLocaleDateString(i);case"datetime":return new Date(e).toLocaleString(i);default:return String(e)}}}class T{static createUniqueConceptId(e,t){let i=e.id;if(e.preferredLabel&&""!==e.preferredLabel.trim()){const t=e.preferredLabel.match(/\/([^\/]+)$/),o=t?t[1]:e.preferredLabel.replace(/[^a-zA-Z0-9]/g,"_");i=`${e.id}_${o}`}if(t){return`${i}__${this.createSectionHash(t)}`}return i}static createSectionHash(e){let t=0;for(let i=0;i<e.length;i++){t=(t<<5)-t+e.charCodeAt(i),t&=t}return Math.abs(t).toString(36).substr(0,6)}static buildFormSchema(e,t,i){var o;if(!e.presentation||0===e.presentation.length)throw new Error("XBRL presentation data is required");const r=e.presentation[0],s=null==(o=e.hypercubes)?void 0:o[0],n=[];return r.roles.forEach(e=>{const o=this.buildSectionFromRole(e,t,i,s);this.assignFieldColumnIds(o),n.push(o)}),{formId:`xbrl-form-${Date.now()}`,title:`XBRL Form - ${this.extractEntityName(r.entrypoint)}`,description:"Dynamic form generated from XBRL taxonomy data",version:"1.0.0",sections:n}}static buildSectionFromRole(e,t,i,o){var r;const s=this.extractRoleTitle(e.role),n=this.getAllNonAbstractConcepts(e),a=new Set(n.filter(e=>e.periodType).map(e=>e.periodType)),l=null==o?void 0:o.roles.find(t=>t.roleId===e.id);l?console.log(`🏷️ Found matching hypercube role "${e.id}"`):console.log(`❌ No hypercube role found for "${e.id}"`);const d=this.generateDefaultColumnsForRole(e,t||"2025-01-01",i||"2025-12-31",l,n,a),c=d.map(e=>e.id);console.log(`πŸ“‹ Available column IDs for role "${e.id}":`,c),c.some(e=>e.includes("multi_"))&&(console.log(`πŸ” [DEBUG] Multi-dimensional role "${e.role}" - Total columns generated: ${d.length}`),d.forEach((e,t)=>{console.log(` Column ${t}: id=${e.id}, title=${e.title}, type=${e.type}`)}));const p={periodTypes:a,availableColumnIds:c},m=[];return(null==(r=e.presentationLinkbase)?void 0:r.concepts)&&e.presentationLinkbase.concepts.forEach(o=>{const r=this.buildConceptTree(o,0,t,i,p,e.id);r&&m.push(r)}),{id:e.id,title:s,description:e.description||`Section for ${s}`,concepts:m,columns:d,expanded:!1,metadata:{roleURI:e.roleURI,originalRole:e.role}}}static buildConceptTree(e,t,i,o,r,s){const n=this.getPreferredLabel(e.labels),a=[];if(!e.elementAbstract){let t=[];(null==r?void 0:r.availableColumnIds)&&r.availableColumnIds.length>0?(t=r.availableColumnIds.filter(t=>"instant"===e.periodType?t.includes("instant")||"instant"===t:"duration"!==e.periodType||(t.includes("duration")||"duration"===t)),0===t.length&&(t=r.availableColumnIds)):t=(null==r?void 0:r.periodTypes)&&0!==r.periodTypes.size?1===r.periodTypes.size&&r.periodTypes.has("instant")?["instant"]:1===r.periodTypes.size&&r.periodTypes.has("duration")?["duration"]:"instant"===e.periodType?["instant"]:"duration"===e.periodType?["duration"]:["duration","instant"]:["default"],t.forEach(t=>{const r=this.createFieldFromConcept(e,i,o,t);r&&a.push(r)})}const l=[];e.children&&e.children.length>0&&e.children.forEach(e=>{const n=this.buildConceptTree(e,t+1,i,o,r,s);n&&l.push(n)});return a.length>0||l.length>0?{id:this.createUniqueConceptId(e,s),originalConceptId:e.id,name:e.conceptName,label:n,description:`${e.conceptName} (${e.type})`,level:t,children:l,fields:a,collapsed:t>0,abstract:e.elementAbstract,periodType:e.periodType}:null}static createFieldFromConcept(e,t,i,o){const r=this.mapXBRLTypeToFieldType(e.type),s=this.getPreferredLabel(e.labels);let n;n=o||("instant"===e.periodType?"instant":"duration"===e.periodType?"duration":"default");const a={id:`${e.id}_${n}_field`,conceptId:e.id,columnId:n,type:r,label:s,placeholder:`Enter ${s.toLowerCase()}`,required:!1,disabled:e.elementAbstract,defaultValue:null};return"duration"!==e.periodType&&"instant"!==e.periodType||(a.periodStartDate=t||"2025-01-01",a.periodEndDate=i||"2025-12-31"),a}static mapXBRLTypeToFieldType(e){return{"xbrli:stringItemType":"text","xbrli:monetaryItemType":"currency","xbrli:integerItemType":"number","xbrli:decimalItemType":"decimal","xbrli:percentItemType":"percentage","xbrli:dateItemType":"date","xbrli:booleanItemType":"boolean","dtr-types:domainItemType":"select","bw2-titel9:chamberOfCommerceRegistrationNumberItemType":"text"}[e]||"text"}static getPreferredLabel(e){if(!e||0===e.length)return"Unnamed Concept";const t=e.find(e=>e.preferredLabel);if(t)return t.label;const i=e.find(e=>"http://www.xbrl.org/2003/role/label"===e.role);if(i)return i.label;const o=e.find(e=>"http://www.xbrl.org/2003/role/terseLabel"===e.role);return o?o.label:e[0].label}static assignFieldColumnIds(e){if(!e.columns||0===e.columns.length)return;const t=e.columns.map(e=>e.id);e.concepts.forEach(e=>{this.assignColumnIdsToConceptFields(e,t)})}static assignColumnIdsToConceptFields(e,t){e.fields=e.fields.filter(e=>t.includes(e.columnId)),e.children&&e.children.forEach(e=>{this.assignColumnIdsToConceptFields(e,t)})}static countFieldsInTree(e){let t=e.fields.length;return e.children&&e.children.forEach(e=>{t+=this.countFieldsInTree(e)}),t}static getAllNonAbstractConcepts(e){var t;const i=[];return(null==(t=e.presentationLinkbase)?void 0:t.concepts)&&e.presentationLinkbase.concepts.forEach(e=>{this.collectNonAbstractConcepts(e,i)}),i}static collectNonAbstractConcepts(e,t){e.elementAbstract||t.push(e),e.children&&e.children.length>0&&e.children.forEach(e=>{this.collectNonAbstractConcepts(e,t)})}static generateDefaultColumnsForRole(e,t,i,o,r,s){var n,a,l;const d=r||this.getAllNonAbstractConcepts(e),c=s||new Set(d.filter(e=>e.periodType).map(e=>e.periodType));if(console.log(`πŸ“Š Analyzing role "${e.role}" with ${d.length} non-abstract concepts`),0===d.length)return console.log("πŸ“Š No non-abstract concepts found, using default column"),[{id:"default",title:"Value",description:"Default value column",type:"base",order:0,removable:!1}];let p=[];if(1===(null==(n=null==o?void 0:o.items)?void 0:n.length)){const r=o.items[0];console.log(`πŸ” Processing hypercube item for role "${e.role}":`,{itemId:r.id,conceptIds:(null==(a=r.conceptIds)?void 0:a.length)||0,dimensions:r.dimensions.length}),1===r.dimensions.length?p=this.generateSingleDimensionColumns(r.dimensions[0],t,i,c):r.dimensions.length>1&&(p=this.generateMultiDimensionColumns(r.dimensions,t,i,c))}else(null==(l=null==o?void 0:o.items)?void 0:l.length)&&o.items.length>1&&console.log(`⚠️ Multiple items found (${o.items.length}), skipping for now`);console.log(`πŸ“… Found period types: ${Array.from(c).join(", ")}`);const m=[];return p.length>0?m.push(...p):0===c.size?(console.log("πŸ“… No period types found, using default column"),m.push({id:"default",title:"Value",description:"Default value column",type:"base",order:0,removable:!1})):1===c.size&&c.has("instant")?(console.log("πŸ“… All concepts are instant type, creating single column"),m.push({id:"instant",title:"Current",description:`Values as of ${t}`,type:"base",order:0,removable:!1})):1===c.size&&c.has("duration")?(console.log("πŸ“… All concepts are duration type, creating single column with period range"),m.push({id:"duration",title:"Current Period",description:`Period: ${t} to ${i}`,type:"base",order:0,removable:!1})):(console.log("πŸ“… Mixed period types found, creating both duration and instant columns"),m.push({id:"duration",title:"Current Period",description:`Period: ${t} to ${i}`,type:"base",order:0,removable:!1}),m.push({id:"instant",title:"Current",description:`Values as of ${t}`,type:"base",order:1,removable:!1})),console.log(`πŸ“Š Generated ${m.length} columns for role "${e.role}":`,m.map(e=>e.title)),m}static generateSingleDimensionColumns(e,t,i,o){var r,s,n,a,l;if(console.log("πŸ“Š Processing single dimension:",{id:e.id,conceptName:e.conceptName,hasMembers:!(!e.members||!Array.isArray(e.members)),membersCount:(null==(r=e.members)?void 0:r.length)||0,hasTypedMember:!!e.typedMember,typedMemberId:null==(s=e.typedMember)?void 0:s.id}),e.typedMember&&(!e.members||0===e.members.length)){console.log(`πŸ”€ Processing typed dimension: ${e.id} with typed member: ${e.typedMember.id}`);const r=(null==(n=e.labels.find(e=>"http://www.xbrl.org/2003/role/label"===e.role))?void 0:n.label)||e.conceptName,s={axisId:e.id,axisLabel:r,typedMemberId:e.typedMember.id,dimensionKey:`${r} | [Typed Input]`,dimensionIdKey:`${e.id}|[typed]`};console.log("πŸ”€ Generated typed dimension info:",s);const a=[];return 0===o.size?a.push({id:"typed-default",title:r,description:"Typed dimension input column",type:"dimension",dimensionData:{dimensionId:"typed-default",axisId:s.axisId,memberId:"[typed]",memberValue:"Typed Input",memberLabel:"Typed Input",axis:s.axisLabel,axisLabel:s.axisLabel,memberKey:s.dimensionKey,dimensionIdKey:s.dimensionIdKey,hasTypedMembers:!0,typedMemberId:s.typedMemberId,typedMembers:[{axisId:s.axisId,axisLabel:s.axisLabel,typedMemberId:s.typedMemberId,memberLabel:s.axisLabel}]},order:0,removable:!1}):1===o.size&&o.has("instant")?a.push({id:"typed-instant",title:`${r} [Typed Input Available]`,description:`Typed values as of ${t}`,type:"dimension",dimensionData:{dimensionId:"typed-instant",axisId:s.axisId,memberId:"[typed]",memberValue:"Typed Input",memberLabel:"Typed Input",axis:s.axisLabel,axisLabel:s.axisLabel,memberKey:s.dimensionKey,dimensionIdKey:s.dimensionIdKey,hasTypedMembers:!0,typedMemberId:s.typedMemberId,typedMembers:[{axisId:s.axisId,axisLabel:s.axisLabel,typedMemberId:s.typedMemberId,memberLabel:s.axisLabel}]},order:0,removable:!1}):1===o.size&&o.has("duration")?a.push({id:"typed-duration",title:`${r} [Typed Input Available]`,description:`Typed values for period ${t} to ${i}`,type:"dimension",dimensionData:{dimensionId:"typed-duration",axisId:s.axisId,memberId:"[typed]",memberValue:"Typed Input",memberLabel:"Typed Input",axis:s.axisLabel,axisLabel:s.axisLabel,memberKey:s.dimensionKey,dimensionIdKey:s.dimensionIdKey,hasTypedMembers:!0,typedMemberId:s.typedMemberId,typedMembers:[{axisId:s.axisId,axisLabel:s.axisLabel,typedMemberId:s.typedMemberId,memberLabel:s.axisLabel}]},order:0,removable:!1}):(a.push({id:"typed-duration",title:`${r} [Typed Input Available]`,description:`Typed values for period ${t} to ${i}`,type:"dimension",dimensionData:{dimensionId:"typed-duration",axisId:s.axisId,memberId:"[typed]",memberValue:"Typed Input",memberLabel:"Typed Input",axis:s.axisLabel,axisLabel:s.axisLabel,memberKey:s.dimensionKey,dimensionIdKey:s.dimensionIdKey,hasTypedMembers:!0,typedMemberId:s.typedMemberId,typedMembers:[{axisId:s.axisId,axisLabel:s.axisLabel,typedMemberId:s.typedMemberId,memberLabel:s.axisLabel}]},order:0,removable:!1}),a.push({id:"typed-instant",title:`${r} [Typed Input Available]`,description:`Typed values as of ${t}`,type:"dimension",dimensionData:{dimensionId:"typed-instant",axisId:s.axisId,memberId:"[typed]",memberValue:"Typed Input",memberLabel:"Typed Input",axis:s.axisLabel,axisLabel:s.axisLabel,memberKey:s.dimensionKey,dimensionIdKey:s.dimensionIdKey,hasTypedMembers:!0,typedMemberId:s.typedMemberId,typedMembers:[{axisId:s.axisId,axisLabel:s.axisLabel,typedMemberId:s.typedMemberId,memberLabel:s.axisLabel}]},order:1,removable:!1})),console.log(`πŸ”€ Generated ${a.length} typed dimension columns`),a}if(!e.members||!Array.isArray(e.members))return console.log(`⚠️ Dimension ${e.id} has no members defined and no typed member, skipping column generation`),[];if(console.log("πŸ“Š Found single dimension:",{id:e.id,conceptName:e.conceptName,membersCount:e.members.length}),0===e.members.length)return[];const d=(null==(a=e.labels.find(e=>"http://www.xbrl.org/2003/role/label"===e.role))?void 0:a.label)||e.conceptName,c=e.members[0],p=(null==(l=c.labels.find(e=>"http://www.xbrl.org/2003/role/label"===e.role))?void 0:l.label)||c.conceptName,m={axisId:e.id,axisLabel:d,memberId:c.id,memberLabel:p,dimensionKey:`${d} | ${p}`,dimensionIdKey:`${e.id} | ${c.id}`};console.log("πŸ“Š Generated dimension info:",m);const h=[];return 0===o.size?h.push({id:"default",title:m.memberLabel,description:"Default value column",type:"dimension",dimensionData:{dimensionId:"default",axisId:m.axisId,memberId:m.memberId,memberValue:m.memberLabel,memberLabel:m.memberLabel,axis:m.axisLabel,axisLabel:m.axisLabel,memberKey:m.dimensionKey,dimensionIdKey:m.dimensionIdKey},order:0,removable:!1}):1===o.size&&o.has("instant")?h.push({id:"instant",title:`${m.memberLabel}`,description:`Values as of ${t}`,type:"dimension",dimensionData:{dimensionId:"instant",axisId:m.axisId,memberId:m.memberId,memberValue:m.memberLabel,memberLabel:m.memberLabel,axis:m.axisLabel,axisLabel:m.axisLabel,memberKey:m.dimensionKey,dimensionIdKey:m.dimensionIdKey},order:0,removable:!1}):1===o.size&&o.has("duration")?h.push({id:"duration",title:`${m.memberLabel}`,description:`Period: ${t} to ${i}`,type:"dimension",dimensionData:{dimensionId:"duration",axisId:m.axisId,memberId:m.memberId,memberValue:m.memberLabel,memberLabel:m.memberLabel,axis:m.axisLabel,axisLabel:m.axisLabel,memberKey:m.dimensionKey,dimensionIdKey:m.dimensionIdKey},order:0,removable:!1}):(h.push({id:"duration",title:`${m.memberLabel}`,description:`Period: ${t} to ${i}`,type:"dimension",dimensionData:{dimensionId:"duration",axisId:m.axisId,memberId:m.memberId,memberValue:m.memberLabel,memberLabel:m.memberLabel,axis:m.axisLabel,axisLabel:m.axisLabel,memberKey:m.dimensionKey,dimensionIdKey:m.dimensionIdKey},order:0,removable:!1}),h.push({id:"instant",title:`${m.memberLabel}`,description:`Values as of ${t}`,type:"dimension",dimensionData:{dimensionId:"instant",axisId:m.axisId,memberId:m.memberId,memberValue:m.memberLabel,memberLabel:m.memberLabel,axis:m.axisLabel,axisLabel:m.axisLabel,memberKey:m.dimensionKey,dimensionIdKey:m.dimensionIdKey},order:1,removable:!1})),h}static generateMultiDimensionColumns(e,t,i,o){console.log(`πŸ“Š Processing ${e.length} dimensions for multi-dimensional columns`),console.log("πŸ” [DEBUG] Input dimensions:",e.map(e=>{var t,i,o;return{id:e.id,label:null==(i=null==(t=e.labels)?void 0:t.find(e=>"http://www.xbrl.org/2003/role/label"===e.role))?void 0:i.label,membersCount:(null==(o=e.members)?void 0:o.length)||0,hasTypedMember:!!e.typedMember}}));e.some(e=>e.typedMember)&&console.log("πŸ”€ Found typed members in dimensions - will indicate in column headers");const r=e.filter(e=>e.typedMember?(console.log(`πŸ”€ Keeping typed dimension: ${e.id} with typed member: ${e.typedMember.id}`),!0):e.members&&Array.isArray(e.members)&&e.members.length>0?(console.log(`πŸ“‚ Keeping domain dimension: ${e.id} with ${e.members.length} members`),!0):(console.log(`⚠️ Skipping dimension ${e.id} - no members or typed member defined`),!1));if(0===r.length)return console.log("⚠️ No valid dimensions with members found, skipping multi-dimensional column generation"),[];const s=r.map(e=>{var t;const i=(null==(t=e.labels.find(e=>"http://www.xbrl.org/2003/role/label"===e.role))?void 0:t.label)||e.conceptName;if(e.typedMember)return{id:e.id,axisLabel:i,isTyped:!0,typedMemberId:e.typedMember.id,members:[{id:"[typed]",label:`${i} [Typed Input Available]`}]};const o=this.getAllDimensionMembers(e.members);return{id:e.id,axisLabel:i,isTyped:!1,members:o.map(e=>{var t;return{id:e.id,label:(null==(t=e.labels.find(e=>"http://www.xbrl.org/2003/role/label"===e.role))?void 0:t.label)||e.conceptName}})}}),n=this.generateDimensionCombinations(s);console.log(`πŸ“Š Generated ${n.length} dimension combinations`),console.log("πŸ” [DEBUG] Generated combinations:",n.map(e=>({memberLabels:e.map(e=>e.memberLabel),axisIds:e.map(e=>e.axisId),memberIds:e.map(e=>e.memberId)})));const a=[];return n.forEach((e,r)=>{var s,n;const l=e.map(e=>e.memberLabel).join(" | "),d=e.filter(e=>e.isTyped),c=e.filter(e=>!e.isTyped);console.log(`πŸ” [Column ${r}] Combination analysis:`,{totalMembers:e.length,typedMembers:d.length,domainMembers:c.length,hasTypedMembers:d.length>0,columnTitle:l,memberLabels:e.map(e=>e.memberLabel),memberIds:e.map(e=>e.memberId)});const p={dimensionId:`multi_${r}`,memberValue:l,memberLabel:l,combinations:c.map(e=>({axisId:e.axisId,axisLabel:e.axisLabel,memberId:e.memberId,memberLabel:e.memberLabel})),typedMembers:d.map(e=>({axisId:e.axisId,axisLabel:e.axisLabel,typedMemberId:e.typedMemberId,memberLabel:e.memberLabel})),hasTypedMembers:d.length>0,memberKey:l,dimensionIdKey:[...c.map(e=>`${e.axisId}|${e.memberId}`),...d.map(e=>`${e.axisId}|[typed]`)].join("::")};console.log(`πŸ” [Column ${r}] Final dimension data:`,{dimensionId:p.dimensionId,memberLabel:p.memberLabel,dimensionIdKey:p.dimensionIdKey,combinationsCount:null==(s=p.combinations)?void 0:s.length,typedMembersCount:null==(n=p.typedMembers)?void 0:n.length}),0===o.size||1===o.size&&o.has("duration")?a.push({id:`duration_${r}`,title:`${l}`,description:`Period: ${t} to ${i}`,type:"dimension",dimensionData:{...p,dimensionId:`duration_${r}`},order:2*r,removable:!1}):1===o.size&&o.has("instant")?a.push({id:`instant_${r}`,title:`${l}`,description:`Values as of ${t}`,type:"dimension",dimensionData:{...p,dimensionId:`instant_${r}`},order:2*r,removable:!1}):(a.push({id:`duration_${r}`,title:`${l}`,description:`Period: ${t} to ${i}`,type:"dimension",dimensionData:{...p,dimensionId:`duration_${r}`},order:2*r,removable:!1}),a.push({id:`instant_${r}`,title:`${l}`,description:`Values as of ${t}`,type:"dimension",dimensionData:{...p,dimensionId:`instant_${r}`},order:2*r+1,removable:!1}))}),console.log(`πŸ“Š Generated ${a.length} multi-dimensional columns`),a}static getAllDimensionMembers(e){if(!e||!Array.isArray(e))return[];const t=[];return e.forEach(e=>{t.push(e),e.children&&e.children.length>0&&t.push(...this.getAllDimensionMembers(e.children))}),t}static generateDimensionCombinations(e){if(0===e.length)return[];if(1===e.length)return e[0].members.map(t=>[{axisId:e[0].id,axisLabel:e[0].axisLabel,memberId:t.id,memberLabel:t.label,isTyped:e[0].isTyped||!1,typedMemberId:e[0].typedMemberId}]);const[t,...i]=e,o=this.generateDimensionCombinations(i),r=[];return t.members.forEach(e=>{0===o.length?r.push([{axisId:t.id,axisLabel:t.axisLabel,memberId:e.id,memberLabel:e.label,isTyped:t.isTyped||!1,typedMemberId:t.typedMemberId}]):o.forEach(i=>{r.push([{axisId:t.id,axisLabel:t.axisLabel,memberId:e.id,memberLabel:e.label,isTyped:t.isTyped||!1,typedMemberId:t.typedMemberId},...i])})}),r}static formatDateForDisplay(e){try{return new Date(e).toLocaleDateString("en-US",{year:"numeric",month:"short",day:"numeric"})}catch{return e}}static extractEntityName(e){try{const t=new URL(e).pathname.split("/");return t[t.length-1].replace(".xsd","").replace(/[^a-zA-Z0-9]/g," ").trim()||"Entity"}catch{return"Entity"}}static extractRoleTitle(e){const t=e.match(/^\[[\d]+\]\s*(.+)$/);return t?t[1].trim():e}static extractRoleOrder(e){const t=e.match(/^\[([\d]+)\]/);return t?parseInt(t[1],10):0}static buildColumnsFromHypercubes(){return[{id:"default",label:"Values",type:"data"}]}}var F=Object.defineProperty,E=Object.getOwnPropertyDescriptor,k=(e,t,i,o)=>{for(var r,s=o>1?void 0:o?E(t,i):t,n=e.length-1;n>=0;n--)(r=e[n])&&(s=(o?r(t,i,s):r(s))||s);return o&&s&&F(t,i,s),s};exports.JupiterFormField=class extends e.LitElement{constructor(){super(...arguments),this.value=null,this.disabled=!1,this.locale="en-US",this.hideLabel=!1,this._errors=[],this._touched=!1}willUpdate(e){(e.has("value")||e.has("field"))&&this._validateField()}_validateField(){var e;(null==(e=this.field)?void 0:e.validation)&&(this._errors=S.validateField(this.field.id,this.conceptId,this.columnId,this.value,this.field.type,this.field.validation))}_handleInput(e){const t=e.target;let i=t.value;"number"===this.field.type||"decimal"===this.field.type?i=""===i?null:Number(i):"boolean"===this.field.type&&(i=t.checked),this.value=i,this._touched=!0,this.dispatchEvent(new CustomEvent("field-change",{detail:{fieldId:this.field.id,conceptId:this.conceptId,columnId:this.columnId,value:i,oldValue:this.value},bubbles:!0}))}_handleFocus(){this.dispatchEvent(new CustomEvent("field-focus",{detail:{fieldId:this.field.id,conceptId:this.conceptId,columnId:this.columnId},bubbles:!0}))}_handleBlur(){this._touched=!0,this.dispatchEvent(new CustomEvent("field-blur",{detail:{fieldId:this.field.id,conceptId:this.conceptId,columnId:this.columnId},bubbles:!0}))}_renderInput(){var t;const i=this._errors.some(e=>"error"===e.severity),o=this._errors.some(e=>"warning"===e.severity),r="field-input "+(i?"error":o?"warning":""),s=`${this.conceptId}__${this.columnId}`,n=`data[${this.conceptId}][${this.columnId}]`;switch(this.field.type){case"textarea":return e.html`
23
23
  <textarea
24
24
  id="${s}"
25
25
  name="${n}"
@@ -206,7 +206,7 @@ const D={attribute:!0,type:String,converter:v,reflect:!1,hasChanged:x},I=(e=D,t,
206
206
  margin: 0;
207
207
  width: auto;
208
208
  }
209
- `,k([w({type:Object})],exports.JupiterFormField.prototype,"field",2),k([w({type:String})],exports.JupiterFormField.prototype,"conceptId",2),k([w({type:String})],exports.JupiterFormField.prototype,"columnId",2),k([w()],exports.JupiterFormField.prototype,"value",2),k([w({type:Boolean})],exports.JupiterFormField.prototype,"disabled",2),k([w({type:String})],exports.JupiterFormField.prototype,"locale",2),k([w({type:Boolean})],exports.JupiterFormField.prototype,"hideLabel",2),k([C()],exports.JupiterFormField.prototype,"_errors",2),k([C()],exports.JupiterFormField.prototype,"_touched",2),exports.JupiterFormField=k([t("jupiter-form-field")],exports.JupiterFormField);var j=Object.defineProperty,L=Object.getOwnPropertyDescriptor,M=(e,t,i,o)=>{for(var r,s=o>1?void 0:o?L(t,i):t,n=e.length-1;n>=0;n--)(r=e[n])&&(s=(o?r(t,i,s):r(s))||s);return o&&s&&j(t,i,s),s};exports.JupiterConceptTree=class extends e.LitElement{constructor(){super(...arguments),this.columns=[],this.formData={},this.disabled=!1,this.locale="en-US",this.expandedConcepts=new Set,this._expanded=!0}connectedCallback(){super.connectedCallback(),this._expanded=this.expandedConcepts.has(this.concept.id)}willUpdate(e){super.willUpdate(e),e.has("expandedConcepts")&&(this._expanded=this.expandedConcepts.has(this.concept.id))}_toggleExpanded(){this._expanded=!this._expanded,this.dispatchEvent(new CustomEvent("concept-expand",{detail:{conceptId:this.concept.id,expanded:this._expanded},bubbles:!0}))}_getFieldForColumn(e){var t;return null==(t=this.concept.fields)?void 0:t.find(t=>t.columnId===e)}_getFieldValue(e){var t;return null==(t=this.formData[this.concept.id])?void 0:t[e.columnId]}_handleFieldChange(e){e.stopPropagation(),this.dispatchEvent(new CustomEvent("field-change",{detail:e.detail,bubbles:!0}))}render(){const t=this.concept.children&&this.concept.children.length>0,i=this.concept.level||0,o=this.concept.abstract||!1;return e.html`
209
+ `,k([w({type:Object})],exports.JupiterFormField.prototype,"field",2),k([w({type:String})],exports.JupiterFormField.prototype,"conceptId",2),k([w({type:String})],exports.JupiterFormField.prototype,"columnId",2),k([w()],exports.JupiterFormField.prototype,"value",2),k([w({type:Boolean})],exports.JupiterFormField.prototype,"disabled",2),k([w({type:String})],exports.JupiterFormField.prototype,"locale",2),k([w({type:Boolean})],exports.JupiterFormField.prototype,"hideLabel",2),k([C()],exports.JupiterFormField.prototype,"_errors",2),k([C()],exports.JupiterFormField.prototype,"_touched",2),exports.JupiterFormField=k([t("jupiter-form-field")],exports.JupiterFormField);var j=Object.defineProperty,L=Object.getOwnPropertyDescriptor,A=(e,t,i,o)=>{for(var r,s=o>1?void 0:o?L(t,i):t,n=e.length-1;n>=0;n--)(r=e[n])&&(s=(o?r(t,i,s):r(s))||s);return o&&s&&j(t,i,s),s};exports.JupiterConceptTree=class extends e.LitElement{constructor(){super(...arguments),this.columns=[],this.formData={},this.disabled=!1,this.locale="en-US",this.expandedConcepts=new Set,this._expanded=!0}connectedCallback(){super.connectedCallback(),this._expanded=this.expandedConcepts.has(this.concept.id)}willUpdate(e){super.willUpdate(e),e.has("expandedConcepts")&&(this._expanded=this.expandedConcepts.has(this.concept.id))}_toggleExpanded(){this._expanded=!this._expanded,this.dispatchEvent(new CustomEvent("concept-expand",{detail:{conceptId:this.concept.id,expanded:this._expanded},bubbles:!0}))}_getFieldForColumn(e){var t;return null==(t=this.concept.fields)?void 0:t.find(t=>t.columnId===e)}_getFieldValue(e){var t;return null==(t=this.formData[this.concept.id])?void 0:t[e.columnId]}_handleFieldChange(e){e.stopPropagation(),this.dispatchEvent(new CustomEvent("field-change",{detail:e.detail,bubbles:!0}))}render(){const t=this.concept.children&&this.concept.children.length>0,i=this.concept.level||0,o=this.concept.abstract||!1;return e.html`
210
210
  <!-- Concept Name Cell (Left Column) -->
211
211
  <td class="concept-name-cell ${o?"abstract":t?"":"leaf"}">
212
212
  <div class="concept-content" style="--level: ${i}">
@@ -342,7 +342,7 @@ const D={attribute:!0,type:String,converter:v,reflect:!1,hasChanged:x},I=(e=D,t,
342
342
  }
343
343
 
344
344
 
345
- `,M([w({type:Object})],exports.JupiterConceptTree.prototype,"concept",2),M([w({type:Array})],exports.JupiterConceptTree.prototype,"columns",2),M([w({type:Object})],exports.JupiterConceptTree.prototype,"formData",2),M([w({type:Boolean})],exports.JupiterConceptTree.prototype,"disabled",2),M([w({type:String})],exports.JupiterConceptTree.prototype,"locale",2),M([w({type:Set})],exports.JupiterConceptTree.prototype,"expandedConcepts",2),M([C()],exports.JupiterConceptTree.prototype,"_expanded",2),exports.JupiterConceptTree=M([t("jupiter-concept-tree")],exports.JupiterConceptTree);var A=Object.defineProperty,R=Object.getOwnPropertyDescriptor,P=(e,t,i,o)=>{for(var r,s=o>1?void 0:o?R(t,i):t,n=e.length-1;n>=0;n--)(r=e[n])&&(s=(o?r(t,i,s):r(s))||s);return o&&s&&A(t,i,s),s};exports.JupiterAddColumnDialog=class extends e.LitElement{constructor(){super(...arguments),this.periodType="duration",this.open=!1,this.availableDimensions=[],this._startDate="",this._endDate="",this._instantDate="",this._selectedType="duration",this._selectedDimensions=new Map}updated(e){e.has("open")&&this.open&&this._resetForm(),e.has("availableDimensions")&&console.log(`🎯 Add Column Dialog received ${this.availableDimensions.length} dimensions:`,this.availableDimensions.map(e=>e.axisLabel))}connectedCallback(){super.connectedCallback(),this._resetForm()}willUpdate(e){super.willUpdate(e),e.has("open")&&this.open&&this._resetForm()}_handleCancel(){this.open=!1,this.dispatchEvent(new CustomEvent("dialog-cancel",{bubbles:!0}))}_handleConfirm(){if(!this._isFormValid())return;const e={periodType:"mixed"===this.periodType?this._selectedType:this.periodType};"instant"===this.periodType||"mixed"===this.periodType&&"instant"===this._selectedType?e.instantDate=this._instantDate:(e.startDate=this._startDate,e.endDate=this._endDate),this._selectedDimensions.size>0&&(e.selectedDimensions=Array.from(this._selectedDimensions.values())),this.dispatchEvent(new CustomEvent("column-add",{detail:e,bubbles:!0}))}_isFormValid(){return"mixed"===this.periodType?"instant"===this._selectedType?!!this._instantDate:!!this._startDate&&!!this._endDate&&this._startDate<=this._endDate:"duration"===this.periodType?!!this._startDate&&!!this._endDate&&this._startDate<=this._endDate:"instant"===this.periodType&&!!this._instantDate}_handleStartDateChange(e){this._startDate=e.target.value}_handleEndDateChange(e){this._endDate=e.target.value}_handleSelectedTypeChange(e){this._selectedType=e.target.value}_handleInstantDateChange(e){this._instantDate=e.target.value}_handleDimensionToggle(e,t){if(t.target.checked){const t=this.availableDimensions.find(t=>t.id===e);if(t){const i={axisId:t.id,axisLabel:t.axisLabel,isTyped:!(!t.typedMember||t.members&&0!==t.members.length)};this._selectedDimensions.set(e,i)}}else this._selectedDimensions.delete(e);this.requestUpdate()}_handleMemberSelection(e,t,i){const o=this._selectedDimensions.get(e);o&&(o.memberId=t,o.memberLabel=i,this._selectedDimensions.set(e,o),this.requestUpdate())}_handleTypedValueChange(e,t){const i=t.target,o=this._selectedDimensions.get(e);o&&(o.typedValue=i.value,this._selectedDimensions.set(e,o))}_resetForm(){const e=(new Date).toISOString().split("T")[0];this._startDate=e,this._endDate=e,this._instantDate=e,this._selectedType="instant"===this.periodType?"instant":"duration",this._selectedDimensions.clear(),this._autoSelectSingleMemberDimensions(),this.requestUpdate()}_autoSelectSingleMemberDimensions(){this.availableDimensions.forEach(e=>{if(e.members&&1===e.members.length){const t=e.members[0],i={axisId:e.id,axisLabel:e.axisLabel,memberId:t.id,memberLabel:t.label,isTyped:!1};this._selectedDimensions.set(e.id,i),console.log(`🎯 Auto-selected single member: ${e.axisLabel} -> ${t.label}`)}else if(e.typedMember&&(!e.members||0===e.members.length)){const t={axisId:e.id,axisLabel:e.axisLabel,isTyped:!0};this._selectedDimensions.set(e.id,t),console.log(`🎯 Auto-selected typed dimension: ${e.axisLabel} (value will be entered in column header)`)}})}render(){if(!this.open)return e.html``;const t=this._isFormValid();return e.html`
345
+ `,A([w({type:Object})],exports.JupiterConceptTree.prototype,"concept",2),A([w({type:Array})],exports.JupiterConceptTree.prototype,"columns",2),A([w({type:Object})],exports.JupiterConceptTree.prototype,"formData",2),A([w({type:Boolean})],exports.JupiterConceptTree.prototype,"disabled",2),A([w({type:String})],exports.JupiterConceptTree.prototype,"locale",2),A([w({type:Set})],exports.JupiterConceptTree.prototype,"expandedConcepts",2),A([C()],exports.JupiterConceptTree.prototype,"_expanded",2),exports.JupiterConceptTree=A([t("jupiter-concept-tree")],exports.JupiterConceptTree);var M=Object.defineProperty,R=Object.getOwnPropertyDescriptor,P=(e,t,i,o)=>{for(var r,s=o>1?void 0:o?R(t,i):t,n=e.length-1;n>=0;n--)(r=e[n])&&(s=(o?r(t,i,s):r(s))||s);return o&&s&&M(t,i,s),s};exports.JupiterAddColumnDialog=class extends e.LitElement{constructor(){super(...arguments),this.periodType="duration",this.open=!1,this.availableDimensions=[],this._startDate="",this._endDate="",this._instantDate="",this._selectedType="duration",this._selectedDimensions=new Map}updated(e){e.has("open")&&this.open&&this._resetForm(),e.has("availableDimensions")&&console.log(`🎯 Add Column Dialog received ${this.availableDimensions.length} dimensions:`,this.availableDimensions.map(e=>e.axisLabel))}connectedCallback(){super.connectedCallback(),this._resetForm()}willUpdate(e){super.willUpdate(e),e.has("open")&&this.open&&this._resetForm()}_handleCancel(){this.open=!1,this.dispatchEvent(new CustomEvent("dialog-cancel",{bubbles:!0}))}_handleConfirm(){if(!this._isFormValid())return;const e={periodType:"mixed"===this.periodType?this._selectedType:this.periodType};"instant"===this.periodType||"mixed"===this.periodType&&"instant"===this._selectedType?e.instantDate=this._instantDate:(e.startDate=this._startDate,e.endDate=this._endDate),this._selectedDimensions.size>0&&(e.selectedDimensions=Array.from(this._selectedDimensions.values())),this.dispatchEvent(new CustomEvent("column-add",{detail:e,bubbles:!0}))}_isFormValid(){return"mixed"===this.periodType?"instant"===this._selectedType?!!this._instantDate:!!this._startDate&&!!this._endDate&&this._startDate<=this._endDate:"duration"===this.periodType?!!this._startDate&&!!this._endDate&&this._startDate<=this._endDate:"instant"===this.periodType&&!!this._instantDate}_handleStartDateChange(e){this._startDate=e.target.value}_handleEndDateChange(e){this._endDate=e.target.value}_handleSelectedTypeChange(e){this._selectedType=e.target.value}_handleInstantDateChange(e){this._instantDate=e.target.value}_handleDimensionToggle(e,t){if(t.target.checked){const t=this.availableDimensions.find(t=>t.id===e);if(t){const i={axisId:t.id,axisLabel:t.axisLabel,isTyped:!(!t.typedMember||t.members&&0!==t.members.length)};this._selectedDimensions.set(e,i)}}else this._selectedDimensions.delete(e);this.requestUpdate()}_handleMemberSelection(e,t,i){const o=this._selectedDimensions.get(e);o&&(o.memberId=t,o.memberLabel=i,this._selectedDimensions.set(e,o),this.requestUpdate())}_handleTypedValueChange(e,t){const i=t.target,o=this._selectedDimensions.get(e);o&&(o.typedValue=i.value,this._selectedDimensions.set(e,o))}_resetForm(){const e=(new Date).toISOString().split("T")[0];this._startDate=e,this._endDate=e,this._instantDate=e,this._selectedType="instant"===this.periodType?"instant":"duration",this._selectedDimensions.clear(),this._autoSelectSingleMemberDimensions(),this.requestUpdate()}_autoSelectSingleMemberDimensions(){this.availableDimensions.forEach(e=>{if(e.members&&1===e.members.length){const t=e.members[0],i={axisId:e.id,axisLabel:e.axisLabel,memberId:t.id,memberLabel:t.label,isTyped:!1};this._selectedDimensions.set(e.id,i),console.log(`🎯 Auto-selected single member: ${e.axisLabel} -> ${t.label}`)}else if(e.typedMember&&(!e.members||0===e.members.length)){const t={axisId:e.id,axisLabel:e.axisLabel,isTyped:!0};this._selectedDimensions.set(e.id,t),console.log(`🎯 Auto-selected typed dimension: ${e.axisLabel} (value will be entered in column header)`)}})}render(){if(!this.open)return e.html``;const t=this._isFormValid();return e.html`
346
346
  <div class="dialog" @click="${e=>e.stopPropagation()}">
347
347
  <div class="dialog-header">
348
348
  <h2 class="dialog-title">Add Column</h2>
@@ -740,7 +740,7 @@ const D={attribute:!0,type:String,converter:v,reflect:!1,hasChanged:x},I=(e=D,t,
740
740
  margin: 0 0 12px 0;
741
741
  line-height: 1.4;
742
742
  }
743
- `,P([w({type:String})],exports.JupiterAddColumnDialog.prototype,"periodType",2),P([w({type:Boolean})],exports.JupiterAddColumnDialog.prototype,"open",2),P([w({type:Array})],exports.JupiterAddColumnDialog.prototype,"availableDimensions",2),P([C()],exports.JupiterAddColumnDialog.prototype,"_startDate",2),P([C()],exports.JupiterAddColumnDialog.prototype,"_endDate",2),P([C()],exports.JupiterAddColumnDialog.prototype,"_instantDate",2),P([C()],exports.JupiterAddColumnDialog.prototype,"_selectedType",2),P([C()],exports.JupiterAddColumnDialog.prototype,"_selectedDimensions",2),exports.JupiterAddColumnDialog=P([t("jupiter-add-column-dialog")],exports.JupiterAddColumnDialog);var z=Object.defineProperty,U=Object.getOwnPropertyDescriptor,J=(e,t,i,o)=>{for(var r,s=o>1?void 0:o?U(t,i):t,n=e.length-1;n>=0;n--)(r=e[n])&&(s=(o?r(t,i,s):r(s))||s);return o&&s&&z(t,i,s),s};exports.JupiterFormSection=class extends e.LitElement{constructor(){super(...arguments),this.columns=[],this.formData={},this.typedMemberData={},this.disabled=!1,this.collapsible=!0,this.locale="en-US",this.availableDimensions=[],this._expanded=!0,this._showAddColumnDialog=!1,this._sectionPeriodType="duration",this._expandedConcepts=new Set}connectedCallback(){super.connectedCallback(),this._expanded=!1!==this.section.expanded,this._determinePeriodType()}_determinePeriodType(){const e=this._getAllNonAbstractConcepts(this.section.concepts);if(console.log(`πŸ” Section ${this.section.id} (${this.section.title}): Found ${e.length} non-abstract concepts`),console.log("πŸ“ All concepts in section:",this.section.concepts.map(e=>({name:e.name,abstract:e.abstract,periodType:e.periodType}))),0===e.length)return this._sectionPeriodType="duration",void console.log(`πŸ“Š Section ${this.section.id}: No concepts, defaulting to duration`);const t=new Set(e.map(e=>e.periodType).filter(Boolean));if(console.log(`🏷️ Section ${this.section.id}: Found period types:`,Array.from(t)),console.log(`πŸ“ Section ${this.section.id}: Non-abstract concepts and their period types:`,e.map(e=>({name:e.name,periodType:e.periodType,abstract:e.abstract}))),0===t.size)this._sectionPeriodType="duration",console.log(`πŸ“Š Section ${this.section.id}: No period types defined, defaulting to duration`);else if(1===t.size){const e=Array.from(t)[0];this._sectionPeriodType="instant"===e?"instant":"duration",console.log(`πŸ“Š Section ${this.section.id}: Single period type '${e}', setting to '${this._sectionPeriodType}'`)}else this._sectionPeriodType="mixed",console.log(`πŸ“Š Section ${this.section.id}: Mixed period types, setting to 'mixed'`);console.log(`βœ… Section ${this.section.id}: Final period type: ${this._sectionPeriodType}`)}_getAllNonAbstractConcepts(e){const t=[];for(const i of e)i.abstract||t.push(i),i.children&&t.push(...this._getAllNonAbstractConcepts(i.children));return t}_toggleExpanded(){this.collapsible&&(this._expanded=!this._expanded,this.dispatchEvent(new CustomEvent("section-expand",{detail:{sectionId:this.section.id,expanded:this._expanded},bubbles:!0})))}_handleRemoveColumn(e){this.dispatchEvent(new CustomEvent("column-remove",{detail:{columnId:e,sectionId:this.section.id},bubbles:!0}))}_handleAddColumn(){const e=this._determineButtonPeriodType();this._sectionPeriodType=e,this._showAddColumnDialog=!0}_determineButtonPeriodType(){const e=this._getAllNonAbstractConcepts(this.section.concepts);if(0===e.length)return"duration";const t=new Set(e.map(e=>e.periodType).filter(e=>null!=e));if(0===t.size)return"duration";if(1===t.size){return"instant"===Array.from(t)[0]?"instant":"duration"}return"mixed"}_getConceptsWithFields(e){const t=[];for(const i of e)!i.abstract&&i.fields&&i.fields.length>0&&t.push(i),i.children&&t.push(...this._getConceptsWithFields(i.children));return t}_handleDialogCancel(){this._showAddColumnDialog=!1}_handleColumnAdd(e){e.stopPropagation(),this._showAddColumnDialog=!1,this.dispatchEvent(new CustomEvent("column-add-request",{detail:{sectionId:this.section.id,columnRequest:e.detail},bubbles:!0}))}_handleFieldChange(e){e.stopPropagation(),this.dispatchEvent(new CustomEvent("field-change",{detail:e.detail,bubbles:!0}))}_flattenConcepts(e,t=new Set){const i=[];for(const o of e)if(i.push(o),o.children&&o.children.length>0&&t.has(o.id)){const e=this._flattenConcepts(o.children,t);i.push(...e)}return i}_handleConceptExpand(e){e.stopPropagation();const{conceptId:t,expanded:i}=e.detail;i?this._expandedConcepts.add(t):this._expandedConcepts.delete(t),this.requestUpdate(),this.dispatchEvent(new CustomEvent("concept-expand",{detail:e.detail,bubbles:!0}))}_getTypedMemberHeaderValue(e,t){var i;return(null==(i=this.typedMemberData[e])?void 0:i[t])||""}_handleTypedMemberHeaderChange(e,t,i){const o=e.target.value;console.log(`πŸ” [FormSection] Typed member header change: columnId=${t}, axisId=${i}, value=${o}`),this.dispatchEvent(new CustomEvent("typed-member-change",{detail:{columnId:t,axisId:i,value:o},bubbles:!0}))}render(){return this.section.concepts&&0!==this.section.concepts.length?e.html`
743
+ `,P([w({type:String})],exports.JupiterAddColumnDialog.prototype,"periodType",2),P([w({type:Boolean})],exports.JupiterAddColumnDialog.prototype,"open",2),P([w({type:Array})],exports.JupiterAddColumnDialog.prototype,"availableDimensions",2),P([C()],exports.JupiterAddColumnDialog.prototype,"_startDate",2),P([C()],exports.JupiterAddColumnDialog.prototype,"_endDate",2),P([C()],exports.JupiterAddColumnDialog.prototype,"_instantDate",2),P([C()],exports.JupiterAddColumnDialog.prototype,"_selectedType",2),P([C()],exports.JupiterAddColumnDialog.prototype,"_selectedDimensions",2),exports.JupiterAddColumnDialog=P([t("jupiter-add-column-dialog")],exports.JupiterAddColumnDialog);var z=Object.defineProperty,U=Object.getOwnPropertyDescriptor,J=(e,t,i,o)=>{for(var r,s=o>1?void 0:o?U(t,i):t,n=e.length-1;n>=0;n--)(r=e[n])&&(s=(o?r(t,i,s):r(s))||s);return o&&s&&z(t,i,s),s};exports.JupiterFormSection=class extends e.LitElement{constructor(){super(...arguments),this.columns=[],this.formData={},this.typedMemberData={},this.disabled=!1,this.collapsible=!0,this.locale="en-US",this.availableDimensions=[],this._expanded=!0,this._showAddColumnDialog=!1,this._sectionPeriodType="duration",this._expandedConcepts=new Set,this._allTreeExpanded=!1}connectedCallback(){super.connectedCallback(),this._expanded=!1!==this.section.expanded,this._determinePeriodType()}_determinePeriodType(){const e=this._getAllNonAbstractConcepts(this.section.concepts);if(console.log(`πŸ” Section ${this.section.id} (${this.section.title}): Found ${e.length} non-abstract concepts`),console.log("πŸ“ All concepts in section:",this.section.concepts.map(e=>({name:e.name,abstract:e.abstract,periodType:e.periodType}))),0===e.length)return this._sectionPeriodType="duration",void console.log(`πŸ“Š Section ${this.section.id}: No concepts, defaulting to duration`);const t=new Set(e.map(e=>e.periodType).filter(Boolean));if(console.log(`🏷️ Section ${this.section.id}: Found period types:`,Array.from(t)),console.log(`πŸ“ Section ${this.section.id}: Non-abstract concepts and their period types:`,e.map(e=>({name:e.name,periodType:e.periodType,abstract:e.abstract}))),0===t.size)this._sectionPeriodType="duration",console.log(`πŸ“Š Section ${this.section.id}: No period types defined, defaulting to duration`);else if(1===t.size){const e=Array.from(t)[0];this._sectionPeriodType="instant"===e?"instant":"duration",console.log(`πŸ“Š Section ${this.section.id}: Single period type '${e}', setting to '${this._sectionPeriodType}'`)}else this._sectionPeriodType="mixed",console.log(`πŸ“Š Section ${this.section.id}: Mixed period types, setting to 'mixed'`);console.log(`βœ… Section ${this.section.id}: Final period type: ${this._sectionPeriodType}`)}_getAllNonAbstractConcepts(e){const t=[];for(const i of e)i.abstract||t.push(i),i.children&&t.push(...this._getAllNonAbstractConcepts(i.children));return t}_toggleExpanded(){this.collapsible&&(this._expanded=!this._expanded,this.dispatchEvent(new CustomEvent("section-expand",{detail:{sectionId:this.section.id,expanded:this._expanded},bubbles:!0})))}_handleRemoveColumn(e){this.dispatchEvent(new CustomEvent("column-remove",{detail:{columnId:e,sectionId:this.section.id},bubbles:!0}))}_handleAddColumn(){const e=this._determineButtonPeriodType();this._sectionPeriodType=e,this._showAddColumnDialog=!0}_determineButtonPeriodType(){const e=this._getAllNonAbstractConcepts(this.section.concepts);if(0===e.length)return"duration";const t=new Set(e.map(e=>e.periodType).filter(e=>null!=e));if(0===t.size)return"duration";if(1===t.size){return"instant"===Array.from(t)[0]?"instant":"duration"}return"mixed"}_getConceptsWithFields(e){const t=[];for(const i of e)!i.abstract&&i.fields&&i.fields.length>0&&t.push(i),i.children&&t.push(...this._getConceptsWithFields(i.children));return t}_handleDialogCancel(){this._showAddColumnDialog=!1}_handleColumnAdd(e){e.stopPropagation(),this._showAddColumnDialog=!1,this.dispatchEvent(new CustomEvent("column-add-request",{detail:{sectionId:this.section.id,columnRequest:e.detail},bubbles:!0}))}_handleFieldChange(e){e.stopPropagation(),this.dispatchEvent(new CustomEvent("field-change",{detail:e.detail,bubbles:!0}))}_flattenConcepts(e,t=new Set){const i=[];for(const o of e)if(i.push(o),o.children&&o.children.length>0&&t.has(o.id)){const e=this._flattenConcepts(o.children,t);i.push(...e)}return i}_getAllConceptIds(e){const t=[];for(const i of e)i.children&&i.children.length>0&&(t.push(i.id),t.push(...this._getAllConceptIds(i.children)));return t}_expandAllTrees(){this._getAllConceptIds(this.section.concepts||[]).forEach(e=>this._expandedConcepts.add(e)),this._allTreeExpanded=!0,this.requestUpdate()}_collapseAllTrees(){this._expandedConcepts.clear(),this._allTreeExpanded=!1,this.requestUpdate()}_toggleAllTrees(e){e.stopPropagation(),this._expanded||(this._expanded=!0),this._allTreeExpanded?this._collapseAllTrees():this._expandAllTrees()}_handleTreeCheckboxChange(e){e.stopPropagation();const t=e.target;this._expanded||(this._expanded=!0),t.checked?this._expandAllTrees():this._collapseAllTrees()}_handleConceptExpand(e){e.stopPropagation();const{conceptId:t,expanded:i}=e.detail;i?this._expandedConcepts.add(t):this._expandedConcepts.delete(t);const o=this._getAllConceptIds(this.section.concepts||[]);this._allTreeExpanded=o.length>0&&o.every(e=>this._expandedConcepts.has(e)),this.requestUpdate(),this.dispatchEvent(new CustomEvent("concept-expand",{detail:e.detail,bubbles:!0}))}_getTypedMemberHeaderValue(e,t){var i;return(null==(i=this.typedMemberData[e])?void 0:i[t])||""}_handleTypedMemberHeaderChange(e,t,i){const o=e.target.value;console.log(`πŸ” [FormSection] Typed member header change: columnId=${t}, axisId=${i}, value=${o}`),this.dispatchEvent(new CustomEvent("typed-member-change",{detail:{columnId:t,axisId:i,value:o},bubbles:!0}))}render(){return this.section.concepts&&0!==this.section.concepts.length?e.html`
744
744
  <div class="section-header ${this.collapsible?"":"not-collapsible"}"
745
745
  @click="${this._toggleExpanded}">
746
746
  <div>
@@ -749,8 +749,19 @@ const D={attribute:!0,type:String,converter:v,reflect:!1,hasChanged:x},I=(e=D,t,
749
749
  <p class="section-description">${this.section.description}</p>
750
750
  `:""}
751
751
  </div>
752
- <div class="section-toggle ${this.collapsible?this._expanded?"expanded":"":"hidden"}">
753
- ${this.collapsible?"β–Ά":""}
752
+ <div class="section-header-controls">
753
+ <div class="tree-control">
754
+ <input
755
+ type="checkbox"
756
+ class="tree-control-checkbox"
757
+ .checked="${this._allTreeExpanded}"
758
+ @change="${this._handleTreeCheckboxChange}"
759
+ />
760
+ <span class="tree-control-label" @click="${this._toggleAllTrees}">${this._allTreeExpanded?"Collapse Tree":"Expand Tree"}</span>
761
+ </div>
762
+ <div class="section-toggle ${this.collapsible?this._expanded?"expanded":"":"hidden"}">
763
+ ${this.collapsible?"β–Ά":""}
764
+ </div>
754
765
  </div>
755
766
  </div>
756
767
 
@@ -839,8 +850,10 @@ const D={attribute:!0,type:String,converter:v,reflect:!1,hasChanged:x},I=(e=D,t,
839
850
  <p class="section-description">${this.section.description}</p>
840
851
  `:""}
841
852
  </div>
842
- <div class="section-toggle ${this.collapsible?this._expanded?"expanded":"":"hidden"}">
843
- ${this.collapsible?"β–Ά":""}
853
+ <div class="section-header-controls">
854
+ <div class="section-toggle ${this.collapsible?this._expanded?"expanded":"":"hidden"}">
855
+ ${this.collapsible?"β–Ά":""}
856
+ </div>
844
857
  </div>
845
858
  </div>
846
859
 
@@ -913,6 +926,43 @@ const D={attribute:!0,type:String,converter:v,reflect:!1,hasChanged:x},I=(e=D,t,
913
926
  visibility: hidden;
914
927
  }
915
928
 
929
+ .section-header-controls {
930
+ display: flex;
931
+ align-items: center;
932
+ gap: 12px;
933
+ }
934
+
935
+ .tree-control {
936
+ display: flex;
937
+ align-items: center;
938
+ gap: 6px;
939
+ font-size: 12px;
940
+ color: var(--jupiter-text-secondary, #666);
941
+ background: var(--jupiter-button-background, #fff);
942
+ border: 1px solid var(--jupiter-border-color, #ddd);
943
+ border-radius: 4px;
944
+ padding: 4px 8px;
945
+ cursor: pointer;
946
+ transition: all 0.2s ease;
947
+ }
948
+
949
+ .tree-control:hover {
950
+ background: var(--jupiter-button-hover-background, #f5f5f5);
951
+ border-color: var(--jupiter-primary-color, #007bff);
952
+ }
953
+
954
+ .tree-control-checkbox {
955
+ width: 14px;
956
+ height: 14px;
957
+ cursor: pointer;
958
+ }
959
+
960
+ .tree-control-label {
961
+ cursor: pointer;
962
+ font-weight: 500;
963
+ white-space: nowrap;
964
+ }
965
+
916
966
  .section-content {
917
967
  display: block;
918
968
  transition: max-height 0.3s ease;
@@ -1070,7 +1120,7 @@ const D={attribute:!0,type:String,converter:v,reflect:!1,hasChanged:x},I=(e=D,t,
1070
1120
  color: var(--jupiter-text-secondary, #666);
1071
1121
  font-style: italic;
1072
1122
  }
1073
- `,J([w({type:Object})],exports.JupiterFormSection.prototype,"section",2),J([w({type:Array})],exports.JupiterFormSection.prototype,"columns",2),J([w({type:Object})],exports.JupiterFormSection.prototype,"formData",2),J([w({type:Object})],exports.JupiterFormSection.prototype,"typedMemberData",2),J([w({type:Boolean})],exports.JupiterFormSection.prototype,"disabled",2),J([w({type:Boolean})],exports.JupiterFormSection.prototype,"collapsible",2),J([w({type:String})],exports.JupiterFormSection.prototype,"locale",2),J([w({type:Array})],exports.JupiterFormSection.prototype,"availableDimensions",2),J([C()],exports.JupiterFormSection.prototype,"_expanded",2),J([C()],exports.JupiterFormSection.prototype,"_showAddColumnDialog",2),J([C()],exports.JupiterFormSection.prototype,"_sectionPeriodType",2),J([C()],exports.JupiterFormSection.prototype,"_expandedConcepts",2),exports.JupiterFormSection=J([t("jupiter-form-section")],exports.JupiterFormSection);var N=Object.defineProperty,O=Object.getOwnPropertyDescriptor,V=(e,t,i,o)=>{for(var r,s=o>1?void 0:o?O(t,i):t,n=e.length-1;n>=0;n--)(r=e[n])&&(s=(o?r(t,i,s):r(s))||s);return o&&s&&N(t,i,s),s};exports.JupiterFilterRolesDialog=class extends e.LitElement{constructor(){super(...arguments),this.open=!1,this.availableRoles=[],this.selectedRoleIds=[],this._tempSelectedRoles=new Set,this._searchQuery="",this._filteredRoles=[]}connectedCallback(){super.connectedCallback(),this._initializeTempSelection()}updated(e){(e.has("selectedRoleIds")||e.has("open"))&&this._initializeTempSelection(),(e.has("availableRoles")||e.has("_searchQuery"))&&this._updateFilteredRoles()}_updateFilteredRoles(){if(!this._searchQuery.trim())return void(this._filteredRoles=[...this.availableRoles]);const e=this._searchQuery.toLowerCase().trim();this._filteredRoles=this.availableRoles.filter(t=>{var i;const o=t.title.toLowerCase().includes(e),r=t.id.toLowerCase().includes(e),s=(null==(i=t.description)?void 0:i.toLowerCase().includes(e))||!1,n=this._searchInRoleURI(t,e);return o||r||s||n})}_searchInRoleURI(e,t){var i;if(null==(i=e.metadata)?void 0:i.roleURI)return e.metadata.roleURI.toLowerCase().includes(t);const o=/https?:\/\/[^\s]+/i,r=o.test(e.title),s=o.test(e.id);return r||s?e.title.toLowerCase().includes(t)||e.id.toLowerCase().includes(t):!!(e.id.includes(".")||e.id.includes("/")||e.id.includes(":"))&&e.id.toLowerCase().includes(t)}_handleSearchInput(e){const t=e.target;this._searchQuery=t.value}_clearSearch(){var e;this._searchQuery="";const t=null==(e=this.shadowRoot)?void 0:e.querySelector(".search-input");t&&(t.value="",t.focus())}_highlightSearchTerm(e){if(!this._searchQuery.trim())return e;const t=this._searchQuery.trim(),i=new RegExp(`(${t.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")})`,"gi");return e.replace(i,"<mark>$1</mark>")}_renderHighlightedText(e){return e}_getSelectedFilteredCount(){return this._filteredRoles.filter(e=>this._tempSelectedRoles.has(e.id)).length}_initializeTempSelection(){this._tempSelectedRoles=new Set(this.selectedRoleIds)}_handleCheckboxChange(e,t){const i=e.target,o=new Set(this._tempSelectedRoles);i.checked?o.add(t):o.delete(t),this._tempSelectedRoles=o,this.requestUpdate()}_selectAll(){const e=new Set(this._tempSelectedRoles);this._filteredRoles.forEach(t=>e.add(t.id)),this._tempSelectedRoles=e,this.requestUpdate()}_selectNone(){const e=new Set(this._tempSelectedRoles);this._filteredRoles.forEach(t=>e.delete(t.id)),this._tempSelectedRoles=e,this.requestUpdate()}_selectAllGlobal(){this._tempSelectedRoles=new Set(this.availableRoles.map(e=>e.id)),this.requestUpdate()}_selectNoneGlobal(){this._tempSelectedRoles=new Set,this.requestUpdate()}_resetToOriginal(){this._tempSelectedRoles=new Set(this.selectedRoleIds),this.requestUpdate()}_handleCancel(){this._initializeTempSelection(),this.dispatchEvent(new CustomEvent("dialog-cancel",{bubbles:!0}))}_handleApply(){const e=Array.from(this._tempSelectedRoles);this.dispatchEvent(new CustomEvent("roles-filter-apply",{detail:{selectedRoleIds:e},bubbles:!0}))}_handleBackdropClick(e){e.target===this&&this._handleCancel()}render(){const t=this._tempSelectedRoles.size,i=this.availableRoles.length,o=this._filteredRoles.length,r=this._searchQuery.trim().length>0;return e.html`
1123
+ `,J([w({type:Object})],exports.JupiterFormSection.prototype,"section",2),J([w({type:Array})],exports.JupiterFormSection.prototype,"columns",2),J([w({type:Object})],exports.JupiterFormSection.prototype,"formData",2),J([w({type:Object})],exports.JupiterFormSection.prototype,"typedMemberData",2),J([w({type:Boolean})],exports.JupiterFormSection.prototype,"disabled",2),J([w({type:Boolean})],exports.JupiterFormSection.prototype,"collapsible",2),J([w({type:String})],exports.JupiterFormSection.prototype,"locale",2),J([w({type:Array})],exports.JupiterFormSection.prototype,"availableDimensions",2),J([C()],exports.JupiterFormSection.prototype,"_expanded",2),J([C()],exports.JupiterFormSection.prototype,"_showAddColumnDialog",2),J([C()],exports.JupiterFormSection.prototype,"_sectionPeriodType",2),J([C()],exports.JupiterFormSection.prototype,"_expandedConcepts",2),J([C()],exports.JupiterFormSection.prototype,"_allTreeExpanded",2),exports.JupiterFormSection=J([t("jupiter-form-section")],exports.JupiterFormSection);var N=Object.defineProperty,O=Object.getOwnPropertyDescriptor,V=(e,t,i,o)=>{for(var r,s=o>1?void 0:o?O(t,i):t,n=e.length-1;n>=0;n--)(r=e[n])&&(s=(o?r(t,i,s):r(s))||s);return o&&s&&N(t,i,s),s};exports.JupiterFilterRolesDialog=class extends e.LitElement{constructor(){super(...arguments),this.open=!1,this.availableRoles=[],this.selectedRoleIds=[],this._tempSelectedRoles=new Set,this._searchQuery="",this._filteredRoles=[]}connectedCallback(){super.connectedCallback(),this._initializeTempSelection()}updated(e){(e.has("selectedRoleIds")||e.has("open"))&&this._initializeTempSelection(),(e.has("availableRoles")||e.has("_searchQuery"))&&this._updateFilteredRoles()}_updateFilteredRoles(){if(!this._searchQuery.trim())return void(this._filteredRoles=[...this.availableRoles]);const e=this._searchQuery.toLowerCase().trim();this._filteredRoles=this.availableRoles.filter(t=>{var i;const o=t.title.toLowerCase().includes(e),r=t.id.toLowerCase().includes(e),s=(null==(i=t.description)?void 0:i.toLowerCase().includes(e))||!1,n=this._searchInRoleURI(t,e);return o||r||s||n})}_searchInRoleURI(e,t){var i;if(null==(i=e.metadata)?void 0:i.roleURI)return e.metadata.roleURI.toLowerCase().includes(t);const o=/https?:\/\/[^\s]+/i,r=o.test(e.title),s=o.test(e.id);return r||s?e.title.toLowerCase().includes(t)||e.id.toLowerCase().includes(t):!!(e.id.includes(".")||e.id.includes("/")||e.id.includes(":"))&&e.id.toLowerCase().includes(t)}_handleSearchInput(e){const t=e.target;this._searchQuery=t.value}_clearSearch(){var e;this._searchQuery="";const t=null==(e=this.shadowRoot)?void 0:e.querySelector(".search-input");t&&(t.value="",t.focus())}_highlightSearchTerm(e){if(!this._searchQuery.trim())return e;const t=this._searchQuery.trim(),i=new RegExp(`(${t.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")})`,"gi");return e.replace(i,"<mark>$1</mark>")}_renderHighlightedText(e){return e}_getSelectedFilteredCount(){return this._filteredRoles.filter(e=>this._tempSelectedRoles.has(e.id)).length}_initializeTempSelection(){this._tempSelectedRoles=new Set(this.selectedRoleIds)}_handleCheckboxChange(e,t){const i=e.target,o=new Set(this._tempSelectedRoles);i.checked?o.add(t):o.delete(t),this._tempSelectedRoles=o,this.requestUpdate()}_selectAll(){const e=new Set(this._tempSelectedRoles);this._filteredRoles.forEach(t=>e.add(t.id)),this._tempSelectedRoles=e,this.requestUpdate()}_selectNone(){const e=new Set(this._tempSelectedRoles);this._filteredRoles.forEach(t=>e.delete(t.id)),this._tempSelectedRoles=e,this.requestUpdate()}_selectAllGlobal(){this._tempSelectedRoles=new Set(this.availableRoles.map(e=>e.id)),this.requestUpdate()}_selectNoneGlobal(){this._tempSelectedRoles=new Set,this.requestUpdate()}_resetToOriginal(){this._tempSelectedRoles=new Set(this.selectedRoleIds),this.requestUpdate()}_handleCancel(){this._initializeTempSelection(),this.dispatchEvent(new CustomEvent("dialog-cancel",{bubbles:!0}))}_handleApply(){const e=Array.from(this._tempSelectedRoles);this.dispatchEvent(new CustomEvent("roles-filter-apply",{detail:{selectedRoleIds:e},bubbles:!0}))}_handleBackdropClick(e){e.target===this&&this._handleCancel()}render(){const t=this._tempSelectedRoles.size,i=this.availableRoles.length,o=this._filteredRoles.length,r=this._searchQuery.trim().length>0;return e.html`
1074
1124
  <div class="dialog" @click="${e=>e.stopPropagation()}">
1075
1125
  <!-- Dialog Header -->
1076
1126
  <div class="dialog-header">
@@ -1490,7 +1540,7 @@ const D={attribute:!0,type:String,converter:v,reflect:!1,hasChanged:x},I=(e=D,t,
1490
1540
  opacity: 0.6;
1491
1541
  cursor: not-allowed;
1492
1542
  }
1493
- `,V([w({type:Boolean,reflect:!0})],exports.JupiterFilterRolesDialog.prototype,"open",2),V([w({type:Array})],exports.JupiterFilterRolesDialog.prototype,"availableRoles",2),V([w({type:Array})],exports.JupiterFilterRolesDialog.prototype,"selectedRoleIds",2),V([C()],exports.JupiterFilterRolesDialog.prototype,"_tempSelectedRoles",2),V([C()],exports.JupiterFilterRolesDialog.prototype,"_searchQuery",2),V([C()],exports.JupiterFilterRolesDialog.prototype,"_filteredRoles",2),exports.JupiterFilterRolesDialog=V([t("jupiter-filter-roles-dialog")],exports.JupiterFilterRolesDialog);var K=Object.defineProperty,q=Object.getOwnPropertyDescriptor,B=(e,t,i,o)=>{for(var r,s=o>1?void 0:o?q(t,i):t,n=e.length-1;n>=0;n--)(r=e[n])&&(s=(o?r(t,i,s):r(s))||s);return o&&s&&K(t,i,s),s};exports.JupiterDynamicForm=class extends e.LitElement{constructor(){super(...arguments),this.config={},this.initialData={},this.disabled=!1,this.readonly=!1,this.periodStartDate="2025-01-01",this.periodEndDate="2025-12-31",this._formData={},this._preservedFormData={},this._typedMemberData={},this._preservedTypedMemberData={},this._columns=[],this._errors=[],this._touched=new Set,this._dirty=!1,this._valid=!0,this._submitted=!1,this._allSections=[],this._selectedRoleIds=[],this._showFilterDialog=!1}connectedCallback(){super.connectedCallback(),this._initializeForm()}updated(e){(e.has("xbrlInput")||e.has("schema"))&&this._initializeForm()}_initializeForm(){var e;if(this.xbrlInput)try{console.log("πŸ”„ Initializing form from XBRL input:",this.xbrlInput),console.log("πŸ“… Using period dates:",this.periodStartDate,"to",this.periodEndDate),this._currentSchema=F.buildFormSchema(this.xbrlInput,this.periodStartDate,this.periodEndDate),console.log("βœ… Generated schema with sections:",this._currentSchema.sections.length),this._allSections=[...this._currentSchema.sections],this._allSections.length>10&&0===this._selectedRoleIds.length?this._selectedRoleIds=this._allSections.slice(0,10).map(e=>e.id):0===this._selectedRoleIds.length&&(this._selectedRoleIds=this._allSections.map(e=>e.id)),this._applyRoleFilter(),this._columns=[{id:"base",title:"Value",description:"Base values for concepts",type:"base",order:0,removable:!1}]}catch(t){console.error("❌ Error building form from XBRL input:",t),this._currentSchema=this._getDefaultSchema(),this._allSections=[],this._selectedRoleIds=[],this._columns=this._getDefaultColumns()}else this.schema?(this._currentSchema=this.schema,this._allSections=[...this.schema.sections],this._selectedRoleIds=this._allSections.map(e=>e.id),this._columns=this._getDefaultColumns()):(this._currentSchema=this._getDefaultSchema(),this._allSections=[],this._selectedRoleIds=[],this._columns=this._getDefaultColumns());this._formData={...this.initialData},(null==(e=this.xbrlInput)?void 0:e.initialData)&&(this._formData={...this._formData,...this.xbrlInput.initialData}),this._validateForm()}_getDefaultSchema(){return{version:"1.0",formId:"default-form",title:"Dynamic Form",description:"Please provide form schema or XBRL input data",sections:[]}}_getDefaultColumns(){return[{id:"base",title:"Value",description:"Base values for concepts",type:"base",order:0,removable:!1}]}_applyRoleFilter(){if(!this._currentSchema||!this._allSections.length)return;this._preserveDataForHiddenSections();const e=this._allSections.filter(e=>this._selectedRoleIds.includes(e.id));this._restoreDataForVisibleSections(e),this._currentSchema={...this._currentSchema,sections:e}}_preserveDataForHiddenSections(){var e;const t=((null==(e=this._currentSchema)?void 0:e.sections.map(e=>e.id))||[]).filter(e=>!this._selectedRoleIds.includes(e));t.forEach(e=>{const t=this._allSections.find(t=>t.id===e);t&&this._preserveSectionData(t)}),console.log(`πŸ“¦ Preserved data for ${t.length} hidden sections:`,t)}_restoreDataForVisibleSections(e){e.forEach(e=>{this._restoreSectionData(e)}),console.log(`πŸ”„ Restored data for ${e.length} visible sections`)}_preserveSectionData(e){e.concepts.forEach(e=>{this._preserveConceptData(e)})}_preserveConceptData(e){this._formData[e.id]&&(this._preservedFormData[e.id]={...this._formData[e.id]},console.log(`πŸ’Ύ Preserved form data for concept: ${e.id}`)),e.fields.forEach(e=>{this._typedMemberData[e.columnId]&&(this._preservedTypedMemberData[e.columnId]={...this._typedMemberData[e.columnId]},console.log(`πŸ’Ύ Preserved typed data for column: ${e.columnId}`))}),e.children&&e.children.forEach(e=>{this._preserveConceptData(e)})}_restoreSectionData(e){e.concepts.forEach(e=>{this._restoreConceptData(e)})}_restoreConceptData(e){this._preservedFormData[e.id]&&(this._formData[e.id]={...this._preservedFormData[e.id]},console.log(`πŸ”„ Restored form data for concept: ${e.id}`)),e.fields.forEach(e=>{this._preservedTypedMemberData[e.columnId]&&(this._typedMemberData[e.columnId]={...this._preservedTypedMemberData[e.columnId]},console.log(`πŸ”„ Restored typed data for column: ${e.columnId}`))}),e.children&&e.children.forEach(e=>{this._restoreConceptData(e)})}_shouldShowFilterButton(){return this._allSections.length>10}_handleFilterRolesClick(){this._showFilterDialog=!0}_handleFilterDialogCancel(){this._showFilterDialog=!1}_handleRoleFilterApply(e){const{selectedRoleIds:t}=e.detail;this._selectedRoleIds=t,this._applyRoleFilter(),this._showFilterDialog=!1,this.dispatchEvent(new CustomEvent("roles-filter-changed",{detail:{selectedRoleIds:t,totalRoles:this._allSections.length,visibleRoles:t.length},bubbles:!0}))}_validateForm(){var e;const t=[],i=this._currentSchema;if(i){for(const o of i.sections)for(const i of o.concepts)for(const o of i.fields){const r=null==(e=this._formData[i.id])?void 0:e[o.columnId],s=S.validateField(o.id,i.id,o.columnId,r,o.type,o.validation||[]);t.push(...s)}this._errors=t,this._valid=0===t.filter(e=>"error"===e.severity).length}}_handleFieldChange(e){const{fieldId:t,conceptId:i,columnId:o,value:r}=e.detail,s={...this._formData};s[i]||(s[i]={});const n=s[i][o];s[i]={...s[i],[o]:r},this._formData=s,this._touched.add(`${i}-${o}`),this._dirty=!0,this._validateForm(),this.requestUpdate(),this.dispatchEvent(new CustomEvent("field-change",{detail:{fieldId:t,conceptId:i,columnId:o,value:r,oldValue:n},bubbles:!0}))}_generateUniqueConceptKey(e,t){return`${e}::${t}`}_extractOriginalConceptId(e){const t=e.split("::");return t.length>1?t[1]:e}_handleTypedMemberChange(e){const{columnId:t,axisId:i,value:o}=e.detail;console.log(`πŸ” [DynamicForm] Typed member change: columnId=${t}, axisId=${i}, value=${o}`);const r={...this._typedMemberData};r[t]||(r[t]={}),r[t]={...r[t],[i]:o},this._typedMemberData=r,this._dirty=!0,this.requestUpdate(),this.dispatchEvent(new CustomEvent("typed-member-change",{detail:{columnId:t,axisId:i,value:o},bubbles:!0}))}_handleSectionExpand(e){this.dispatchEvent(new CustomEvent("section-expand",{detail:e.detail,bubbles:!0}))}_handleConceptExpand(e){this.dispatchEvent(new CustomEvent("concept-expand",{detail:e.detail,bubbles:!0}))}_handleColumnRemove(e){const{columnId:t,sectionId:i}=e.detail;if(this._currentSchema&&i){const e=this._currentSchema.sections.find(e=>e.id===i);e&&e.columns&&(e.columns=e.columns.filter(e=>e.id!==t))}else this._columns=this._columns.filter(e=>e.id!==t),this._currentSchema&&this._currentSchema.sections.forEach(e=>{e.columns&&(e.columns=e.columns.filter(e=>e.id!==t))});this._removeColumnData(t,i),this._dirty=!0,this._validateForm(),this.requestUpdate(),this.dispatchEvent(new CustomEvent("column-remove",{detail:{columnId:t,sectionId:i},bubbles:!0}))}_handleColumnAddRequest(e){const{sectionId:t,columnRequest:i}=e.detail;this._addColumnFromRequest(i,t)}_getAvailableDimensionsForSection(e){var t,i,o;if(console.log(`πŸ” Getting dimensions for section: ${e}`),!(null==(i=null==(t=this.xbrlInput)?void 0:t.hypercubes)?void 0:i[0]))return console.log("❌ No hypercubes data available"),[];console.log("πŸ“Š Available hypercube roles:",this.xbrlInput.hypercubes[0].roles.map(e=>e.roleId));const r=this.xbrlInput.hypercubes[0].roles.find(t=>t.roleId===e);if(!(null==(o=null==r?void 0:r.items)?void 0:o.length))return console.log(`❌ No hypercube items found for role: ${e}`),[];console.log(`βœ… Found hypercube role with ${r.items.length} items`);const s=[];return r.items.forEach(e=>{e.dimensions&&e.dimensions.length>0&&e.dimensions.forEach(e=>{var t;if(!s.find(t=>t.id===e.id)){const i=(null==(t=e.labels.find(e=>"http://www.xbrl.org/2003/role/label"===e.role))?void 0:t.label)||e.conceptName,o={id:e.id,conceptName:e.conceptName,axisLabel:i};e.members&&e.members.length>0&&(o.members=e.members.map(e=>{var t,i;return{id:e.id,label:(null==(i=null==(t=e.labels)?void 0:t.find(e=>"http://www.xbrl.org/2003/role/label"===e.role))?void 0:i.label)||e.conceptName||e.id}})),e.typedMember&&(o.typedMember={id:e.typedMember.id,dataType:"string"}),s.push(o)}})}),console.log(`πŸ“ˆ Found ${s.length} dimensions for section ${e}:`,s.map(e=>e.axisLabel)),s}_addColumnFromRequest(e,t){var i,o,r,s,n;const a=`col-${Date.now()}`;let l="",d="";"instant"===e.periodType?(l="Current",d=`Values as of ${e.instantDate}`):"duration"!==e.periodType&&"mixed"!==e.periodType||(l="Current Period",d=`Period: ${e.startDate} to ${e.endDate}`);let c={dimensionId:"period",memberValue:"instant"===e.periodType?`instant-${e.instantDate}`:`duration-${e.startDate}-${e.endDate}`,memberLabel:l};if(e.selectedDimensions&&e.selectedDimensions.length>0){const t=[],i=[];for(const r of e.selectedDimensions)r.isTyped&&r.typedValue?(t.push(`${r.axisLabel}: ${r.typedValue}`),i.push(`${r.axisId}|${r.typedValue}`)):r.memberId&&r.memberLabel&&(t.push(r.memberLabel),i.push(`${r.axisId}|${r.memberId}`));const o="instant"===e.periodType?`(${e.instantDate})`:`(${e.startDate} / ${e.endDate})`;t.length>0&&(l=`${t.join(" | ")} ${o}`,c={dimensionId:a,memberValue:t.join(" | "),memberLabel:t.join(" | "),memberKey:t.join(" | "),dimensionIdKey:i.join("::"),selectedDimensions:e.selectedDimensions},console.log(`πŸ“Š Applied selected dimensions to new column: ${c.memberKey}`))}else if(null==(o=null==(i=this.xbrlInput)?void 0:i.hypercubes)?void 0:o[0]){const i=this.xbrlInput.hypercubes[0].roles.find(e=>e.roleId===t);if(1===(null==(r=null==i?void 0:i.items)?void 0:r.length)){const t=i.items[0];if(1===t.dimensions.length){const i=t.dimensions[0];if(i.members&&i.members.length>0){const t=(null==(s=i.labels.find(e=>"http://www.xbrl.org/2003/role/label"===e.role))?void 0:s.label)||i.conceptName,o=i.members[0],r=(null==(n=o.labels.find(e=>"http://www.xbrl.org/2003/role/label"===e.role))?void 0:n.label)||o.conceptName;l=`${r} ${"instant"===e.periodType?`(${e.instantDate})`:`(${e.startDate} / ${e.endDate})`}`,c={dimensionId:a,axisId:i.id,memberId:o.id,memberValue:r,memberLabel:r,axis:t,axisLabel:t,memberKey:`${t} | ${r}`,dimensionIdKey:`${i.id} | ${o.id}`},console.log(`πŸ“Š Applied hypercube dimension to new column: ${c.memberKey}`)}}}}const p={id:a,title:l,description:d,type:(c.memberKey,"dimension"),order:this._columns.length,removable:!0,dimensionData:c};if(e.selectedDimensions&&e.selectedDimensions.length>0){const t={};let i=!1;for(const o of e.selectedDimensions)o.isTyped&&(t[o.axisId]=o.typedValue||"",i=!0,console.log(`πŸ’Ύ Initializing typed member data: ${o.axisLabel} = "${o.typedValue||"(empty - will be entered in column header)"}"`));i&&(this._typedMemberData[a]=t,p.dimensionData&&(p.dimensionData.hasTypedMembers=!0,p.dimensionData.typedMembers=e.selectedDimensions.filter(e=>e.isTyped).map(e=>({axisId:e.axisId,axisLabel:e.axisLabel,typedMemberId:e.axisId,memberLabel:e.axisLabel})),console.log("οΏ½ Added typed members to column dimension data:",p.dimensionData.typedMembers)),console.log(`οΏ½ Initialized typed member data for column ${a}:`,t))}if(this._currentSchema){const e=this._currentSchema.sections.find(e=>e.id===t);e&&(e.columns||(e.columns=[...this._columns]),e.columns=[...e.columns,p])}this._replicateFieldsForNewColumn(a,e,t),this._dirty=!0,this.requestUpdate(),this.dispatchEvent(new CustomEvent("column-add",{detail:{column:p},bubbles:!0}))}_removeColumnData(e,t){if(this._currentSchema)if(t){const i=this._currentSchema.sections.find(e=>e.id===t);i&&this._removeColumnDataFromConcepts(i.concepts,e)}else for(const i in this._formData)void 0!==this._formData[i][e]&&delete this._formData[i][e]}_removeColumnDataFromConcepts(e,t){e.forEach(e=>{this._formData[e.id]&&void 0!==this._formData[e.id][t]&&delete this._formData[e.id][t],e.fields&&(e.fields=e.fields.filter(e=>e.columnId!==t)),e.children&&this._removeColumnDataFromConcepts(e.children,t)})}_shouldCreateFieldForConcept(e,t){if(e.abstract)return!1;if(e.periodType){if("instant"===t.periodType&&"instant"!==e.periodType)return!1;if("duration"===t.periodType&&"duration"!==e.periodType)return!1}return!0}_replicateFieldsForNewColumn(e,t,i){if(!this._currentSchema)return;const o=new F,r=this._currentSchema.sections.find(e=>e.id===i);r&&this._replicateFieldsForSection(r.concepts,e,t,o)}_replicateFieldsForSection(e,t,i,o){e.forEach(e=>{var r;if(this._shouldCreateFieldForConcept(e,i)){const o=null==(r=e.fields)?void 0:r[0];let s;s=o?{id:`${e.id}_${t}`,conceptId:e.id,columnId:t,type:o.type,label:o.label,placeholder:o.placeholder,required:o.required,disabled:o.disabled,validation:o.validation,defaultValue:o.defaultValue,periodStartDate:"instant"===i.periodType?i.instantDate:i.startDate,periodEndDate:"instant"===i.periodType?i.instantDate:i.endDate}:{id:`${e.id}_${t}`,conceptId:e.id,columnId:t,type:"text",label:e.label||e.name,placeholder:`Enter ${e.name}`,required:!1,disabled:!1,validation:[],defaultValue:"",periodStartDate:"instant"===i.periodType?i.instantDate:i.startDate,periodEndDate:"instant"===i.periodType?i.instantDate:i.endDate},e.fields||(e.fields=[]),e.fields.push(s)}e.children&&this._replicateFieldsForSection(e.children,t,i,o)})}_addColumn(){const e={id:`dim-${Date.now()}`,title:`Dimension ${this._columns.length}`,description:"Additional dimension column",type:"dimension",order:this._columns.length,removable:!0,dimensionData:{dimensionId:"custom",memberValue:"default",memberLabel:"Default Member"}};this._columns=[...this._columns,e],this.requestUpdate(),this.dispatchEvent(new CustomEvent("column-add",{detail:{column:e},bubbles:!0}))}_handleSubmit(){console.log("πŸ“ Form submission started..."),this._submitted=!0,this._validateForm();const e=this._generateSubmissionData();console.log("πŸ“Š Generated submission data:",{formData:this._formData,submissionData:e,submissionDataCount:e.length,valid:this._valid,errors:this._errors}),e.forEach((e,t)=>{console.log(`πŸ“‹ Submission Entry ${t+1}:`,{conceptId:e.conceptId,value:e.value,period:e.period,dimension:e.dimension,typedMembers:e.typedMembers,hasTypedMembers:!!(e.typedMembers&&Object.keys(e.typedMembers).length>0)})}),this.dispatchEvent(new CustomEvent("form-submit",{detail:{data:this._formData,submissionData:e,valid:this._valid,errors:this._errors},bubbles:!0})),console.log("βœ… Form submit event dispatched")}_handleSaveDraft(){const e=this._generateSubmissionData();this.dispatchEvent(new CustomEvent("form-save-draft",{detail:{data:this._formData,draftData:e,valid:this._valid,errors:this._errors},bubbles:!0}))}_generateSubmissionData(){const e=[];if(!this._currentSchema)return e;this._currentSchema.sections.forEach(t=>{this._processConceptsForSubmission(t.concepts,e,t)}),this._includePreservedDataInSubmission(e);return this._removeDuplicateSubmissions(e)}_includePreservedDataInSubmission(e){Object.keys(this._preservedFormData).forEach(t=>{const i=this._preservedFormData[t];i&&Object.keys(i).forEach(o=>{const r=i[o];if(null!=r&&""!==r){const i=this._findConceptInAllSections(t);if(i){const s=this._findSectionForConcept(t);this._addConceptDataToSubmission(i,o,r,e,s||void 0)}}})}),console.log(`πŸ“€ Included preserved data in submission. Total entries: ${e.length}`)}_findConceptInAllSections(e){for(const t of this._allSections){const i=this._findConceptInSection(t.concepts,e);if(i)return i}return null}_findConceptInSection(e,t){for(const i of e){if(i.id===t)return i;if(i.children){const e=this._findConceptInSection(i.children,t);if(e)return e}}return null}_findSectionForConcept(e){for(const t of this._allSections){if(this._findConceptInSection(t.concepts,e))return t}return null}_addConceptDataToSubmission(e,t,i,o,r){var s;const n=e.fields.find(e=>e.columnId===t);if(!n)return;const a="instant"===e.periodType,l={conceptId:e.originalConceptId||e.id,value:i,period:{type:e.periodType||"duration",...a?{date:n.periodStartDate||this.periodStartDate}:{startDate:n.periodStartDate||this.periodStartDate,endDate:n.periodEndDate||this.periodEndDate}}},d=this._findColumnByIdInAllSections(t);(null==(s=null==d?void 0:d.dimensionData)?void 0:s.memberLabel)&&(l.dimension=d.dimensionData.memberLabel),o.push(l)}_findColumnByIdInAllSections(e){for(const t of this._allSections)if(t.columns){const i=t.columns.find(t=>t.id===e);if(i)return i}}_removeDuplicateSubmissions(e){const t=new Map;return e.forEach(e=>{const i=`${e.conceptId}_${e.value}_${e.dimension||"no-dimension"}`;t.has(i)||t.set(i,e)}),Array.from(t.values())}_findColumnById(e){if(this._currentSchema)for(const t of this._currentSchema.sections)if(t.columns){const i=t.columns.find(t=>t.id===e);if(i)return i}}_findColumnByIdInSection(e,t){if(null==t?void 0:t.columns)return t.columns.find(t=>t.id===e)}_getTypedMemberNameForAxis(e,t){var i,o,r,s;if(!(null==(o=null==(i=this.xbrlInput)?void 0:i.hypercubes)?void 0:o[0]))return null;const n=null==t?void 0:t.id;if(!n)return null;const a=null==(r=this.xbrlInput.hypercubes[0].roles)?void 0:r.find(e=>e.roleId===n);if(!(null==a?void 0:a.items))return null;for(const l of a.items)if(l.dimensions){const t=l.dimensions.find(t=>t.id===e);if(null==(s=null==t?void 0:t.typedMember)?void 0:s.id)return t.typedMember.id}return null}_doesConceptApplyToTypedDimension(e,t,i){var o,r,s;if(!(null==(r=null==(o=this.xbrlInput)?void 0:o.hypercubes)?void 0:r[0]))return!1;const n=null==t?void 0:t.id;if(!n)return!1;const a=this.xbrlInput.hypercubes[0].roles.find(e=>e.roleId===n);if(!(null==(s=null==a?void 0:a.items)?void 0:s.length))return!1;for(const l of a.items){const t=e.originalConceptId||e.id;if(l.conceptIds&&l.conceptIds.includes(t)){const e=l.dimensions.some(e=>e.typedMember);return console.log(`πŸ” [DynamicForm] Concept ${t} found in hypercube item. Has typed dimensions:`,e),e}}return console.log(`πŸ” [DynamicForm] Concept ${e.originalConceptId||e.id} not found in any hypercube items for role ${n}`),!1}_getApplicableTypedDimensions(e,t){var i,o,r;if(!(null==(o=null==(i=this.xbrlInput)?void 0:i.hypercubes)?void 0:o[0])||!(null==t?void 0:t.id))return[];const s=this.xbrlInput.hypercubes[0].roles.find(e=>e.roleId===t.id);if(!(null==(r=null==s?void 0:s.items)?void 0:r.length))return[];const n=e.originalConceptId||e.id;for(const a of s.items)if(a.conceptIds&&a.conceptIds.includes(n)){const e=a.dimensions.filter(e=>e.typedMember).map(e=>e.id);return console.log(`πŸ” [DynamicForm] Found applicable typed dimensions for concept ${n}:`,e),e}return[]}_processConceptsForSubmission(e,t,i){const o="Toelichting op de geconsolideerde jaarrekening - FinanciΓ«le vaste activa: Deelnemingen: Volledig geconsolideerd: Specificatie",r=(null==i?void 0:i.title)||"Unknown";e.forEach(e=>{r===o&&(console.warn(`[DUPLICATE DEBUG] Processing concept ${e.originalConceptId||e.id} in target role`),e.fields&&(console.warn(`[DUPLICATE DEBUG] Concept has ${e.fields.length} fields`),e.fields.forEach((t,i)=>{var o;console.warn(`[DUPLICATE DEBUG] Field ${i}: columnId=${t.columnId}, current value=${null==(o=this._formData[e.id])?void 0:o[t.columnId]}`)}))),e.fields&&e.fields.length>1&&(console.log(`πŸ” [DEBUG] Processing concept ${e.originalConceptId}, fields count: ${e.fields.length}`),e.fields.forEach((t,i)=>{var o;console.log(` Field ${i}: columnId=${t.columnId}, value=${null==(o=this._formData[e.id])?void 0:o[t.columnId]}`)})),e.fields&&e.fields.length>0&&e.fields.forEach(s=>{var n,a;const l=this._formData[e.id],d=null==l?void 0:l[s.columnId];if(null!=d&&""!==d){r===o&&console.warn(`[DUPLICATE DEBUG] Creating submission entry for concept ${e.originalConceptId||e.id}, field columnId=${s.columnId}, value=${d}`);const l=this._findColumnByIdInSection(s.columnId,i);console.log(`πŸ” [DynamicForm] Processing field for concept ${e.originalConceptId||e.id}, field columnId: ${s.columnId}, found column in section ${null==i?void 0:i.id}: ${!!l}, column title: ${null==l?void 0:l.title}`);const c={conceptId:e.id,value:d,period:{type:e.periodType||"duration"}};if("instant"===e.periodType?c.period.date=s.periodStartDate||this.periodStartDate:(c.period.startDate=s.periodStartDate||this.periodStartDate,c.period.endDate=s.periodEndDate||this.periodEndDate),"dimension"===(null==l?void 0:l.type)&&(null==(n=l.dimensionData)?void 0:n.dimensionIdKey)?(c.dimension=l.dimensionData.dimensionIdKey,console.log(`πŸ” [DynamicForm] Using dimension key from field's column (${s.columnId}):`,l.dimensionData.dimensionIdKey)):console.log(`πŸ” [DynamicForm] No dimension data found for field column ${s.columnId}. Column type: ${null==l?void 0:l.type}, has dimensionData: ${!!(null==l?void 0:l.dimensionData)}`),this._typedMemberData[s.columnId]){const t=this._getApplicableTypedDimensions(e,i);if(console.log(`πŸ” [DynamicForm] Concept ${e.id} applicable typed dimensions:`,t),t.length>0){const e={},o=this._typedMemberData[s.columnId];t.forEach(t=>{if(o[t]){const r=this._getTypedMemberNameForAxis(t,i);e[t]={value:o[t],memberName:r||"Unknown"}}}),Object.keys(e).length>0?(c.typedMembers=e,console.log("πŸ” [DynamicForm] Adding filtered typed members to submission:",e)):console.log("πŸ” [DynamicForm] No typed member values found for applicable dimensions:",t)}else console.log(`πŸ” [DynamicForm] Skipping typed members for concept ${e.id} - not applicable to this hypercube`)}else console.log(`πŸ” [DynamicForm] No typed member data found for column ${s.columnId}. Available columns:`,Object.keys(this._typedMemberData)),l&&console.log("πŸ” [DynamicForm] Column details:",{id:l.id,type:l.type,hasTypedMembers:null==(a=l.dimensionData)?void 0:a.hasTypedMembers,dimensionData:l.dimensionData});r===o&&console.warn("[DUPLICATE DEBUG] Final submission entry:",c),t.push(c)}}),e.children&&this._processConceptsForSubmission(e.children,t,i)})}_handleReset(){this._formData={...this.initialData},this._touched.clear(),this._dirty=!1,this._submitted=!1,this._preservedFormData={},this._preservedTypedMemberData={},console.log("πŸ”„ Form reset - all data and preserved data cleared"),this._validateForm(),this.requestUpdate(),this.dispatchEvent(new CustomEvent("form-reset",{detail:{},bubbles:!0}))}_getFormState(){return{data:this._formData,errors:this._errors,touched:this._touched,dirty:this._dirty,valid:this._valid,submitted:this._submitted}}getData(){return{...this._formData}}setData(e){this._formData={...e},this._dirty=!0,this._validateForm(),this.requestUpdate()}validate(){return this._validateForm(),this._valid}reset(){this._handleReset()}getState(){return this._getFormState()}render(){const t=this._errors.filter(e=>"error"===e.severity).length,i=this.config||{},o=!1!==i.showValidationSummary&&t>0&&this._submitted,r=this._currentSchema;return r?e.html`
1543
+ `,V([w({type:Boolean,reflect:!0})],exports.JupiterFilterRolesDialog.prototype,"open",2),V([w({type:Array})],exports.JupiterFilterRolesDialog.prototype,"availableRoles",2),V([w({type:Array})],exports.JupiterFilterRolesDialog.prototype,"selectedRoleIds",2),V([C()],exports.JupiterFilterRolesDialog.prototype,"_tempSelectedRoles",2),V([C()],exports.JupiterFilterRolesDialog.prototype,"_searchQuery",2),V([C()],exports.JupiterFilterRolesDialog.prototype,"_filteredRoles",2),exports.JupiterFilterRolesDialog=V([t("jupiter-filter-roles-dialog")],exports.JupiterFilterRolesDialog);var K=Object.defineProperty,q=Object.getOwnPropertyDescriptor,B=(e,t,i,o)=>{for(var r,s=o>1?void 0:o?q(t,i):t,n=e.length-1;n>=0;n--)(r=e[n])&&(s=(o?r(t,i,s):r(s))||s);return o&&s&&K(t,i,s),s};exports.JupiterDynamicForm=class extends e.LitElement{constructor(){super(...arguments),this.config={},this.initialData={},this.disabled=!1,this.readonly=!1,this.periodStartDate="2025-01-01",this.periodEndDate="2025-12-31",this._formData={},this._preservedFormData={},this._typedMemberData={},this._preservedTypedMemberData={},this._columns=[],this._errors=[],this._touched=new Set,this._dirty=!1,this._valid=!0,this._submitted=!1,this._allSections=[],this._selectedRoleIds=[],this._showFilterDialog=!1}connectedCallback(){super.connectedCallback(),this._initializeForm()}updated(e){(e.has("xbrlInput")||e.has("schema"))&&this._initializeForm()}_initializeForm(){var e;if(this.xbrlInput)try{console.log("πŸ”„ Initializing form from XBRL input:",this.xbrlInput),console.log("πŸ“… Using period dates:",this.periodStartDate,"to",this.periodEndDate),this._currentSchema=T.buildFormSchema(this.xbrlInput,this.periodStartDate,this.periodEndDate),console.log("βœ… Generated schema with sections:",this._currentSchema.sections.length),this._allSections=[...this._currentSchema.sections],this._allSections.length>10&&0===this._selectedRoleIds.length?this._selectedRoleIds=this._allSections.slice(0,10).map(e=>e.id):0===this._selectedRoleIds.length&&(this._selectedRoleIds=this._allSections.map(e=>e.id)),this._applyRoleFilter(),this._columns=[{id:"base",title:"Value",description:"Base values for concepts",type:"base",order:0,removable:!1}]}catch(t){console.error("❌ Error building form from XBRL input:",t),this._currentSchema=this._getDefaultSchema(),this._allSections=[],this._selectedRoleIds=[],this._columns=this._getDefaultColumns()}else this.schema?(this._currentSchema=this.schema,this._allSections=[...this.schema.sections],this._selectedRoleIds=this._allSections.map(e=>e.id),this._columns=this._getDefaultColumns()):(this._currentSchema=this._getDefaultSchema(),this._allSections=[],this._selectedRoleIds=[],this._columns=this._getDefaultColumns());this._formData={...this.initialData},(null==(e=this.xbrlInput)?void 0:e.initialData)&&(this._formData={...this._formData,...this.xbrlInput.initialData}),this._validateForm()}_getDefaultSchema(){return{version:"1.0",formId:"default-form",title:"Dynamic Form",description:"Please provide form schema or XBRL input data",sections:[]}}_getDefaultColumns(){return[{id:"base",title:"Value",description:"Base values for concepts",type:"base",order:0,removable:!1}]}_applyRoleFilter(){if(!this._currentSchema||!this._allSections.length)return;this._preserveDataForHiddenSections();const e=this._allSections.filter(e=>this._selectedRoleIds.includes(e.id));this._restoreDataForVisibleSections(e),this._currentSchema={...this._currentSchema,sections:e}}_preserveDataForHiddenSections(){var e;const t=((null==(e=this._currentSchema)?void 0:e.sections.map(e=>e.id))||[]).filter(e=>!this._selectedRoleIds.includes(e));t.forEach(e=>{const t=this._allSections.find(t=>t.id===e);t&&this._preserveSectionData(t)}),console.log(`πŸ“¦ Preserved data for ${t.length} hidden sections:`,t)}_restoreDataForVisibleSections(e){e.forEach(e=>{this._restoreSectionData(e)}),console.log(`πŸ”„ Restored data for ${e.length} visible sections`)}_preserveSectionData(e){e.concepts.forEach(e=>{this._preserveConceptData(e)})}_preserveConceptData(e){this._formData[e.id]&&(this._preservedFormData[e.id]={...this._formData[e.id]},console.log(`πŸ’Ύ Preserved form data for concept: ${e.id}`)),e.fields.forEach(e=>{this._typedMemberData[e.columnId]&&(this._preservedTypedMemberData[e.columnId]={...this._typedMemberData[e.columnId]},console.log(`πŸ’Ύ Preserved typed data for column: ${e.columnId}`))}),e.children&&e.children.forEach(e=>{this._preserveConceptData(e)})}_restoreSectionData(e){e.concepts.forEach(e=>{this._restoreConceptData(e)})}_restoreConceptData(e){this._preservedFormData[e.id]&&(this._formData[e.id]={...this._preservedFormData[e.id]},console.log(`πŸ”„ Restored form data for concept: ${e.id}`)),e.fields.forEach(e=>{this._preservedTypedMemberData[e.columnId]&&(this._typedMemberData[e.columnId]={...this._preservedTypedMemberData[e.columnId]},console.log(`πŸ”„ Restored typed data for column: ${e.columnId}`))}),e.children&&e.children.forEach(e=>{this._restoreConceptData(e)})}_shouldShowFilterButton(){return this._allSections.length>10}_handleFilterRolesClick(){this._showFilterDialog=!0}_handleFilterDialogCancel(){this._showFilterDialog=!1}_handleRoleFilterApply(e){const{selectedRoleIds:t}=e.detail;this._selectedRoleIds=t,this._applyRoleFilter(),this._showFilterDialog=!1,this.dispatchEvent(new CustomEvent("roles-filter-changed",{detail:{selectedRoleIds:t,totalRoles:this._allSections.length,visibleRoles:t.length},bubbles:!0}))}_validateForm(){var e;const t=[],i=this._currentSchema;if(i){for(const o of i.sections)for(const i of o.concepts)for(const o of i.fields){const r=null==(e=this._formData[i.id])?void 0:e[o.columnId],s=S.validateField(o.id,i.id,o.columnId,r,o.type,o.validation||[]);t.push(...s)}this._errors=t,this._valid=0===t.filter(e=>"error"===e.severity).length}}_handleFieldChange(e){const{fieldId:t,conceptId:i,columnId:o,value:r}=e.detail,s={...this._formData};s[i]||(s[i]={});const n=s[i][o];s[i]={...s[i],[o]:r},this._formData=s,this._touched.add(`${i}-${o}`),this._dirty=!0,this._validateForm(),this.requestUpdate(),this.dispatchEvent(new CustomEvent("field-change",{detail:{fieldId:t,conceptId:i,columnId:o,value:r,oldValue:n},bubbles:!0}))}_generateUniqueConceptKey(e,t){return`${e}::${t}`}_extractOriginalConceptId(e){const t=e.split("::");return t.length>1?t[1]:e}_handleTypedMemberChange(e){const{columnId:t,axisId:i,value:o}=e.detail;console.log(`πŸ” [DynamicForm] Typed member change: columnId=${t}, axisId=${i}, value=${o}`);const r={...this._typedMemberData};r[t]||(r[t]={}),r[t]={...r[t],[i]:o},this._typedMemberData=r,this._dirty=!0,this.requestUpdate(),this.dispatchEvent(new CustomEvent("typed-member-change",{detail:{columnId:t,axisId:i,value:o},bubbles:!0}))}_handleSectionExpand(e){this.dispatchEvent(new CustomEvent("section-expand",{detail:e.detail,bubbles:!0}))}_handleConceptExpand(e){this.dispatchEvent(new CustomEvent("concept-expand",{detail:e.detail,bubbles:!0}))}_handleColumnRemove(e){const{columnId:t,sectionId:i}=e.detail;if(this._currentSchema&&i){const e=this._currentSchema.sections.find(e=>e.id===i);e&&e.columns&&(e.columns=e.columns.filter(e=>e.id!==t))}else this._columns=this._columns.filter(e=>e.id!==t),this._currentSchema&&this._currentSchema.sections.forEach(e=>{e.columns&&(e.columns=e.columns.filter(e=>e.id!==t))});this._removeColumnData(t,i),this._dirty=!0,this._validateForm(),this.requestUpdate(),this.dispatchEvent(new CustomEvent("column-remove",{detail:{columnId:t,sectionId:i},bubbles:!0}))}_handleColumnAddRequest(e){const{sectionId:t,columnRequest:i}=e.detail;this._addColumnFromRequest(i,t)}_getAvailableDimensionsForSection(e){var t,i,o;if(console.log(`πŸ” Getting dimensions for section: ${e}`),!(null==(i=null==(t=this.xbrlInput)?void 0:t.hypercubes)?void 0:i[0]))return console.log("❌ No hypercubes data available"),[];console.log("πŸ“Š Available hypercube roles:",this.xbrlInput.hypercubes[0].roles.map(e=>e.roleId));const r=this.xbrlInput.hypercubes[0].roles.find(t=>t.roleId===e);if(!(null==(o=null==r?void 0:r.items)?void 0:o.length))return console.log(`❌ No hypercube items found for role: ${e}`),[];console.log(`βœ… Found hypercube role with ${r.items.length} items`);const s=[];return r.items.forEach(e=>{e.dimensions&&e.dimensions.length>0&&e.dimensions.forEach(e=>{var t;if(!s.find(t=>t.id===e.id)){const i=(null==(t=e.labels.find(e=>"http://www.xbrl.org/2003/role/label"===e.role))?void 0:t.label)||e.conceptName,o={id:e.id,conceptName:e.conceptName,axisLabel:i};e.members&&e.members.length>0&&(o.members=e.members.map(e=>{var t,i;return{id:e.id,label:(null==(i=null==(t=e.labels)?void 0:t.find(e=>"http://www.xbrl.org/2003/role/label"===e.role))?void 0:i.label)||e.conceptName||e.id}})),e.typedMember&&(o.typedMember={id:e.typedMember.id,dataType:"string"}),s.push(o)}})}),console.log(`πŸ“ˆ Found ${s.length} dimensions for section ${e}:`,s.map(e=>e.axisLabel)),s}_addColumnFromRequest(e,t){var i,o,r,s,n;const a=`col-${Date.now()}`;let l="",d="";"instant"===e.periodType?(l="Current",d=`Values as of ${e.instantDate}`):"duration"!==e.periodType&&"mixed"!==e.periodType||(l="Current Period",d=`Period: ${e.startDate} to ${e.endDate}`);let c={dimensionId:"period",memberValue:"instant"===e.periodType?`instant-${e.instantDate}`:`duration-${e.startDate}-${e.endDate}`,memberLabel:l};if(e.selectedDimensions&&e.selectedDimensions.length>0){const t=[],i=[];for(const r of e.selectedDimensions)r.isTyped&&r.typedValue?(t.push(`${r.axisLabel}: ${r.typedValue}`),i.push(`${r.axisId}|${r.typedValue}`)):r.memberId&&r.memberLabel&&(t.push(r.memberLabel),i.push(`${r.axisId}|${r.memberId}`));const o="instant"===e.periodType?`(${e.instantDate})`:`(${e.startDate} / ${e.endDate})`;t.length>0&&(l=`${t.join(" | ")} ${o}`,c={dimensionId:a,memberValue:t.join(" | "),memberLabel:t.join(" | "),memberKey:t.join(" | "),dimensionIdKey:i.join("::"),selectedDimensions:e.selectedDimensions},console.log(`πŸ“Š Applied selected dimensions to new column: ${c.memberKey}`))}else if(null==(o=null==(i=this.xbrlInput)?void 0:i.hypercubes)?void 0:o[0]){const i=this.xbrlInput.hypercubes[0].roles.find(e=>e.roleId===t);if(1===(null==(r=null==i?void 0:i.items)?void 0:r.length)){const t=i.items[0];if(1===t.dimensions.length){const i=t.dimensions[0];if(i.members&&i.members.length>0){const t=(null==(s=i.labels.find(e=>"http://www.xbrl.org/2003/role/label"===e.role))?void 0:s.label)||i.conceptName,o=i.members[0],r=(null==(n=o.labels.find(e=>"http://www.xbrl.org/2003/role/label"===e.role))?void 0:n.label)||o.conceptName;l=`${r} ${"instant"===e.periodType?`(${e.instantDate})`:`(${e.startDate} / ${e.endDate})`}`,c={dimensionId:a,axisId:i.id,memberId:o.id,memberValue:r,memberLabel:r,axis:t,axisLabel:t,memberKey:`${t} | ${r}`,dimensionIdKey:`${i.id} | ${o.id}`},console.log(`πŸ“Š Applied hypercube dimension to new column: ${c.memberKey}`)}}}}const p={id:a,title:l,description:d,type:(c.memberKey,"dimension"),order:this._columns.length,removable:!0,dimensionData:c};if(e.selectedDimensions&&e.selectedDimensions.length>0){const t={};let i=!1;for(const o of e.selectedDimensions)o.isTyped&&(t[o.axisId]=o.typedValue||"",i=!0,console.log(`πŸ’Ύ Initializing typed member data: ${o.axisLabel} = "${o.typedValue||"(empty - will be entered in column header)"}"`));i&&(this._typedMemberData[a]=t,p.dimensionData&&(p.dimensionData.hasTypedMembers=!0,p.dimensionData.typedMembers=e.selectedDimensions.filter(e=>e.isTyped).map(e=>({axisId:e.axisId,axisLabel:e.axisLabel,typedMemberId:e.axisId,memberLabel:e.axisLabel})),console.log("οΏ½ Added typed members to column dimension data:",p.dimensionData.typedMembers)),console.log(`οΏ½ Initialized typed member data for column ${a}:`,t))}if(this._currentSchema){const e=this._currentSchema.sections.find(e=>e.id===t);e&&(e.columns||(e.columns=[...this._columns]),e.columns=[...e.columns,p])}this._replicateFieldsForNewColumn(a,e,t),this._dirty=!0,this.requestUpdate(),this.dispatchEvent(new CustomEvent("column-add",{detail:{column:p},bubbles:!0}))}_removeColumnData(e,t){if(this._currentSchema)if(t){const i=this._currentSchema.sections.find(e=>e.id===t);i&&this._removeColumnDataFromConcepts(i.concepts,e)}else for(const i in this._formData)void 0!==this._formData[i][e]&&delete this._formData[i][e]}_removeColumnDataFromConcepts(e,t){e.forEach(e=>{this._formData[e.id]&&void 0!==this._formData[e.id][t]&&delete this._formData[e.id][t],e.fields&&(e.fields=e.fields.filter(e=>e.columnId!==t)),e.children&&this._removeColumnDataFromConcepts(e.children,t)})}_shouldCreateFieldForConcept(e,t){if(e.abstract)return!1;if(e.periodType){if("instant"===t.periodType&&"instant"!==e.periodType)return!1;if("duration"===t.periodType&&"duration"!==e.periodType)return!1}return!0}_replicateFieldsForNewColumn(e,t,i){if(!this._currentSchema)return;const o=new T,r=this._currentSchema.sections.find(e=>e.id===i);r&&this._replicateFieldsForSection(r.concepts,e,t,o)}_replicateFieldsForSection(e,t,i,o){e.forEach(e=>{var r;if(this._shouldCreateFieldForConcept(e,i)){const o=null==(r=e.fields)?void 0:r[0];let s;s=o?{id:`${e.id}_${t}`,conceptId:e.id,columnId:t,type:o.type,label:o.label,placeholder:o.placeholder,required:o.required,disabled:o.disabled,validation:o.validation,defaultValue:o.defaultValue,periodStartDate:"instant"===i.periodType?i.instantDate:i.startDate,periodEndDate:"instant"===i.periodType?i.instantDate:i.endDate}:{id:`${e.id}_${t}`,conceptId:e.id,columnId:t,type:"text",label:e.label||e.name,placeholder:`Enter ${e.name}`,required:!1,disabled:!1,validation:[],defaultValue:"",periodStartDate:"instant"===i.periodType?i.instantDate:i.startDate,periodEndDate:"instant"===i.periodType?i.instantDate:i.endDate},e.fields||(e.fields=[]),e.fields.push(s)}e.children&&this._replicateFieldsForSection(e.children,t,i,o)})}_addColumn(){const e={id:`dim-${Date.now()}`,title:`Dimension ${this._columns.length}`,description:"Additional dimension column",type:"dimension",order:this._columns.length,removable:!0,dimensionData:{dimensionId:"custom",memberValue:"default",memberLabel:"Default Member"}};this._columns=[...this._columns,e],this.requestUpdate(),this.dispatchEvent(new CustomEvent("column-add",{detail:{column:e},bubbles:!0}))}_handleSubmit(){console.log("πŸ“ Form submission started..."),this._submitted=!0,this._validateForm();const e=this._generateSubmissionData();console.log("πŸ“Š Generated submission data:",{formData:this._formData,submissionData:e,submissionDataCount:e.length,valid:this._valid,errors:this._errors}),e.forEach((e,t)=>{console.log(`πŸ“‹ Submission Entry ${t+1}:`,{conceptId:e.conceptId,value:e.value,period:e.period,dimension:e.dimension,typedMembers:e.typedMembers,hasTypedMembers:!!(e.typedMembers&&Object.keys(e.typedMembers).length>0)})}),this.dispatchEvent(new CustomEvent("form-submit",{detail:{data:this._formData,submissionData:e,valid:this._valid,errors:this._errors},bubbles:!0})),console.log("βœ… Form submit event dispatched")}_handleSaveDraft(){const e=this._generateSubmissionData();this.dispatchEvent(new CustomEvent("form-save-draft",{detail:{data:this._formData,draftData:e,valid:this._valid,errors:this._errors},bubbles:!0}))}_generateSubmissionData(){const e=[];if(!this._currentSchema)return e;this._currentSchema.sections.forEach(t=>{this._processConceptsForSubmission(t.concepts,e,t)}),this._includePreservedDataInSubmission(e);return this._removeDuplicateSubmissions(e)}_includePreservedDataInSubmission(e){Object.keys(this._preservedFormData).forEach(t=>{const i=this._preservedFormData[t];i&&Object.keys(i).forEach(o=>{const r=i[o];if(null!=r&&""!==r){const i=this._findConceptInAllSections(t);if(i){const s=this._findSectionForConcept(t);this._addConceptDataToSubmission(i,o,r,e,s||void 0)}}})}),console.log(`πŸ“€ Included preserved data in submission. Total entries: ${e.length}`)}_findConceptInAllSections(e){for(const t of this._allSections){const i=this._findConceptInSection(t.concepts,e);if(i)return i}return null}_findConceptInSection(e,t){for(const i of e){if(i.id===t)return i;if(i.children){const e=this._findConceptInSection(i.children,t);if(e)return e}}return null}_findSectionForConcept(e){for(const t of this._allSections){if(this._findConceptInSection(t.concepts,e))return t}return null}_addConceptDataToSubmission(e,t,i,o,r){var s;const n=e.fields.find(e=>e.columnId===t);if(!n)return;const a="instant"===e.periodType,l={conceptId:e.originalConceptId||e.id,value:i,period:{type:e.periodType||"duration",...a?{date:n.periodStartDate||this.periodStartDate}:{startDate:n.periodStartDate||this.periodStartDate,endDate:n.periodEndDate||this.periodEndDate}}},d=this._findColumnByIdInAllSections(t);(null==(s=null==d?void 0:d.dimensionData)?void 0:s.memberLabel)&&(l.dimension=d.dimensionData.memberLabel),o.push(l)}_findColumnByIdInAllSections(e){for(const t of this._allSections)if(t.columns){const i=t.columns.find(t=>t.id===e);if(i)return i}}_removeDuplicateSubmissions(e){const t=new Map;return e.forEach(e=>{const i=`${e.conceptId}_${e.value}_${e.dimension||"no-dimension"}`;t.has(i)||t.set(i,e)}),Array.from(t.values())}_findColumnById(e){if(this._currentSchema)for(const t of this._currentSchema.sections)if(t.columns){const i=t.columns.find(t=>t.id===e);if(i)return i}}_findColumnByIdInSection(e,t){if(null==t?void 0:t.columns)return t.columns.find(t=>t.id===e)}_getTypedMemberNameForAxis(e,t){var i,o,r,s;if(!(null==(o=null==(i=this.xbrlInput)?void 0:i.hypercubes)?void 0:o[0]))return null;const n=null==t?void 0:t.id;if(!n)return null;const a=null==(r=this.xbrlInput.hypercubes[0].roles)?void 0:r.find(e=>e.roleId===n);if(!(null==a?void 0:a.items))return null;for(const l of a.items)if(l.dimensions){const t=l.dimensions.find(t=>t.id===e);if(null==(s=null==t?void 0:t.typedMember)?void 0:s.id)return t.typedMember.id}return null}_doesConceptApplyToTypedDimension(e,t,i){var o,r,s;if(!(null==(r=null==(o=this.xbrlInput)?void 0:o.hypercubes)?void 0:r[0]))return!1;const n=null==t?void 0:t.id;if(!n)return!1;const a=this.xbrlInput.hypercubes[0].roles.find(e=>e.roleId===n);if(!(null==(s=null==a?void 0:a.items)?void 0:s.length))return!1;for(const l of a.items){const t=e.originalConceptId||e.id;if(l.conceptIds&&l.conceptIds.includes(t)){const e=l.dimensions.some(e=>e.typedMember);return console.log(`πŸ” [DynamicForm] Concept ${t} found in hypercube item. Has typed dimensions:`,e),e}}return console.log(`πŸ” [DynamicForm] Concept ${e.originalConceptId||e.id} not found in any hypercube items for role ${n}`),!1}_getApplicableTypedDimensions(e,t){var i,o,r;if(!(null==(o=null==(i=this.xbrlInput)?void 0:i.hypercubes)?void 0:o[0])||!(null==t?void 0:t.id))return[];const s=this.xbrlInput.hypercubes[0].roles.find(e=>e.roleId===t.id);if(!(null==(r=null==s?void 0:s.items)?void 0:r.length))return[];const n=e.originalConceptId||e.id;for(const a of s.items)if(a.conceptIds&&a.conceptIds.includes(n)){const e=a.dimensions.filter(e=>e.typedMember).map(e=>e.id);return console.log(`πŸ” [DynamicForm] Found applicable typed dimensions for concept ${n}:`,e),e}return[]}_processConceptsForSubmission(e,t,i){const o="Toelichting op de geconsolideerde jaarrekening - FinanciΓ«le vaste activa: Deelnemingen: Volledig geconsolideerd: Specificatie",r=(null==i?void 0:i.title)||"Unknown";e.forEach(e=>{r===o&&(console.warn(`[DUPLICATE DEBUG] Processing concept ${e.originalConceptId||e.id} in target role`),e.fields&&(console.warn(`[DUPLICATE DEBUG] Concept has ${e.fields.length} fields`),e.fields.forEach((t,i)=>{var o;console.warn(`[DUPLICATE DEBUG] Field ${i}: columnId=${t.columnId}, current value=${null==(o=this._formData[e.id])?void 0:o[t.columnId]}`)}))),e.fields&&e.fields.length>1&&(console.log(`πŸ” [DEBUG] Processing concept ${e.originalConceptId}, fields count: ${e.fields.length}`),e.fields.forEach((t,i)=>{var o;console.log(` Field ${i}: columnId=${t.columnId}, value=${null==(o=this._formData[e.id])?void 0:o[t.columnId]}`)})),e.fields&&e.fields.length>0&&e.fields.forEach(s=>{var n,a;const l=this._formData[e.id],d=null==l?void 0:l[s.columnId];if(null!=d&&""!==d){r===o&&console.warn(`[DUPLICATE DEBUG] Creating submission entry for concept ${e.originalConceptId||e.id}, field columnId=${s.columnId}, value=${d}`);const l=this._findColumnByIdInSection(s.columnId,i);console.log(`πŸ” [DynamicForm] Processing field for concept ${e.originalConceptId||e.id}, field columnId: ${s.columnId}, found column in section ${null==i?void 0:i.id}: ${!!l}, column title: ${null==l?void 0:l.title}`);const c={conceptId:e.id,value:d,period:{type:e.periodType||"duration"}};if("instant"===e.periodType?c.period.date=s.periodStartDate||this.periodStartDate:(c.period.startDate=s.periodStartDate||this.periodStartDate,c.period.endDate=s.periodEndDate||this.periodEndDate),"dimension"===(null==l?void 0:l.type)&&(null==(n=l.dimensionData)?void 0:n.dimensionIdKey)?(c.dimension=l.dimensionData.dimensionIdKey,console.log(`πŸ” [DynamicForm] Using dimension key from field's column (${s.columnId}):`,l.dimensionData.dimensionIdKey)):console.log(`πŸ” [DynamicForm] No dimension data found for field column ${s.columnId}. Column type: ${null==l?void 0:l.type}, has dimensionData: ${!!(null==l?void 0:l.dimensionData)}`),this._typedMemberData[s.columnId]){const t=this._getApplicableTypedDimensions(e,i);if(console.log(`πŸ” [DynamicForm] Concept ${e.id} applicable typed dimensions:`,t),t.length>0){const e={},o=this._typedMemberData[s.columnId];t.forEach(t=>{if(o[t]){const r=this._getTypedMemberNameForAxis(t,i);e[t]={value:o[t],memberName:r||"Unknown"}}}),Object.keys(e).length>0?(c.typedMembers=e,console.log("πŸ” [DynamicForm] Adding filtered typed members to submission:",e)):console.log("πŸ” [DynamicForm] No typed member values found for applicable dimensions:",t)}else console.log(`πŸ” [DynamicForm] Skipping typed members for concept ${e.id} - not applicable to this hypercube`)}else console.log(`πŸ” [DynamicForm] No typed member data found for column ${s.columnId}. Available columns:`,Object.keys(this._typedMemberData)),l&&console.log("πŸ” [DynamicForm] Column details:",{id:l.id,type:l.type,hasTypedMembers:null==(a=l.dimensionData)?void 0:a.hasTypedMembers,dimensionData:l.dimensionData});r===o&&console.warn("[DUPLICATE DEBUG] Final submission entry:",c),t.push(c)}}),e.children&&this._processConceptsForSubmission(e.children,t,i)})}_handleReset(){this._formData={...this.initialData},this._touched.clear(),this._dirty=!1,this._submitted=!1,this._preservedFormData={},this._preservedTypedMemberData={},console.log("πŸ”„ Form reset - all data and preserved data cleared"),this._validateForm(),this.requestUpdate(),this.dispatchEvent(new CustomEvent("form-reset",{detail:{},bubbles:!0}))}_getFormState(){return{data:this._formData,errors:this._errors,touched:this._touched,dirty:this._dirty,valid:this._valid,submitted:this._submitted}}getData(){return{...this._formData}}setData(e){this._formData={...e},this._dirty=!0,this._validateForm(),this.requestUpdate()}validate(){return this._validateForm(),this._valid}reset(){this._handleReset()}getState(){return this._getFormState()}render(){const t=this._errors.filter(e=>"error"===e.severity).length,i=this.config||{},o=!1!==i.showValidationSummary&&t>0&&this._submitted,r=this._currentSchema;return r?e.html`
1494
1544
  <div class="form-container">
1495
1545
  <!-- Form Header -->
1496
1546
  <div class="form-header">