jupiter-dynamic-forms 1.16.3 → 1.16.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/core/add-column-dialog.d.ts.map +1 -1
- package/dist/core/concept-tree.d.ts +5 -0
- package/dist/core/concept-tree.d.ts.map +1 -1
- package/dist/core/dynamic-form.d.ts +3 -0
- package/dist/core/dynamic-form.d.ts.map +1 -1
- package/dist/core/filter-roles-dialog.d.ts.map +1 -1
- package/dist/core/form-field.d.ts +2 -0
- package/dist/core/form-field.d.ts.map +1 -1
- package/dist/core/form-section.d.ts +7 -0
- package/dist/core/form-section.d.ts.map +1 -1
- package/dist/index.js +369 -230
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +625 -168
- package/dist/index.mjs.map +1 -1
- package/dist/schema/types.d.ts +7 -0
- package/dist/schema/types.d.ts.map +1 -1
- package/dist/schema/xbrl-types.d.ts +1 -0
- package/dist/schema/xbrl-types.d.ts.map +1 -1
- package/dist/utils/xbrl-form-builder.d.ts +14 -1
- package/dist/utils/xbrl-form-builder.d.ts.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -3,23 +3,23 @@
|
|
|
3
3
|
* @license
|
|
4
4
|
* Copyright 2017 Google LLC
|
|
5
5
|
* SPDX-License-Identifier: BSD-3-Clause
|
|
6
|
-
*/let s=class{constructor(e,t,i){if(this._$cssResult$=!0,i!==r)throw Error("CSSResult is not constructable. Use `unsafeCSS` or `css` instead.");this.cssText=e,this.t=t}get styleSheet(){let e=this.o;const t=this.t;if(o&&void 0===e){const i=void 0!==t&&1===t.length;i&&(e=n.get(t)),void 0===e&&((this.o=e=new CSSStyleSheet).replaceSync(this.cssText),i&&n.set(t,e))}return e}toString(){return this.cssText}};const l=o?e=>e:e=>e instanceof CSSStyleSheet?(e=>{let t="";for(const i of e.cssRules)t+=i.cssText;return(e=>new s("string"==typeof e?e:e+"",void 0,r))(t)})(e):e,{is:a,defineProperty:d,getOwnPropertyDescriptor:c,getOwnPropertyNames:p,getOwnPropertySymbols:u,getPrototypeOf:h}=Object,m=globalThis,
|
|
6
|
+
*/let s=class{constructor(e,t,i){if(this._$cssResult$=!0,i!==r)throw Error("CSSResult is not constructable. Use `unsafeCSS` or `css` instead.");this.cssText=e,this.t=t}get styleSheet(){let e=this.o;const t=this.t;if(o&&void 0===e){const i=void 0!==t&&1===t.length;i&&(e=n.get(t)),void 0===e&&((this.o=e=new CSSStyleSheet).replaceSync(this.cssText),i&&n.set(t,e))}return e}toString(){return this.cssText}};const l=o?e=>e:e=>e instanceof CSSStyleSheet?(e=>{let t="";for(const i of e.cssRules)t+=i.cssText;return(e=>new s("string"==typeof e?e:e+"",void 0,r))(t)})(e):e,{is:a,defineProperty:d,getOwnPropertyDescriptor:c,getOwnPropertyNames:p,getOwnPropertySymbols:u,getPrototypeOf:h}=Object,m=globalThis,b=m.trustedTypes,f=b?b.emptyScript:"",g=m.reactiveElementPolyfillSupport,v=(e,t)=>e,y={toAttribute(e,t){switch(t){case Boolean:e=e?f:null;break;case Object:case Array:e=null==e?e:JSON.stringify(e)}return e},fromAttribute(e,t){let i=e;switch(t){case Boolean:i=null!==e;break;case Number:i=null===e?null:Number(e);break;case Object:case Array:try{i=JSON.parse(e)}catch(o){i=null}}return i}},x=(e,t)=>!a(e,t),_={attribute:!0,type:String,converter:y,reflect:!1,useDefault:!1,hasChanged:x};
|
|
7
7
|
/**
|
|
8
8
|
* @license
|
|
9
9
|
* Copyright 2017 Google LLC
|
|
10
10
|
* SPDX-License-Identifier: BSD-3-Clause
|
|
11
|
-
*/Symbol.metadata??(Symbol.metadata=Symbol("metadata")),m.litPropertyMetadata??(m.litPropertyMetadata=new WeakMap);class D extends HTMLElement{static addInitializer(e){this._$Ei(),(this.l??(this.l=[])).push(e)}static get observedAttributes(){return this.finalize(),this._$Eh&&[...this._$Eh.keys()]}static createProperty(e,t=_){if(t.state&&(t.attribute=!1),this._$Ei(),this.prototype.hasOwnProperty(e)&&((t=Object.create(t)).wrapped=!0),this.elementProperties.set(e,t),!t.noAccessor){const i=Symbol(),o=this.getPropertyDescriptor(e,i,t);void 0!==o&&d(this.prototype,e,o)}}static getPropertyDescriptor(e,t,i){const{get:o,set:r}=c(this.prototype,e)??{get(){return this[t]},set(e){this[t]=e}};return{get:o,set(t){const n=null==o?void 0:o.call(this);null==r||r.call(this,t),this.requestUpdate(e,n,i)},configurable:!0,enumerable:!0}}static getPropertyOptions(e){return this.elementProperties.get(e)??_}static _$Ei(){if(this.hasOwnProperty(
|
|
11
|
+
*/Symbol.metadata??(Symbol.metadata=Symbol("metadata")),m.litPropertyMetadata??(m.litPropertyMetadata=new WeakMap);class D extends HTMLElement{static addInitializer(e){this._$Ei(),(this.l??(this.l=[])).push(e)}static get observedAttributes(){return this.finalize(),this._$Eh&&[...this._$Eh.keys()]}static createProperty(e,t=_){if(t.state&&(t.attribute=!1),this._$Ei(),this.prototype.hasOwnProperty(e)&&((t=Object.create(t)).wrapped=!0),this.elementProperties.set(e,t),!t.noAccessor){const i=Symbol(),o=this.getPropertyDescriptor(e,i,t);void 0!==o&&d(this.prototype,e,o)}}static getPropertyDescriptor(e,t,i){const{get:o,set:r}=c(this.prototype,e)??{get(){return this[t]},set(e){this[t]=e}};return{get:o,set(t){const n=null==o?void 0:o.call(this);null==r||r.call(this,t),this.requestUpdate(e,n,i)},configurable:!0,enumerable:!0}}static getPropertyOptions(e){return this.elementProperties.get(e)??_}static _$Ei(){if(this.hasOwnProperty(v("elementProperties")))return;const e=h(this);e.finalize(),void 0!==e.l&&(this.l=[...e.l]),this.elementProperties=new Map(e.elementProperties)}static finalize(){if(this.hasOwnProperty(v("finalized")))return;if(this.finalized=!0,this._$Ei(),this.hasOwnProperty(v("properties"))){const e=this.properties,t=[...p(e),...u(e)];for(const i of t)this.createProperty(i,e[i])}const e=this[Symbol.metadata];if(null!==e){const t=litPropertyMetadata.get(e);if(void 0!==t)for(const[e,i]of t)this.elementProperties.set(e,i)}this._$Eh=new Map;for(const[t,i]of this.elementProperties){const e=this._$Eu(t,i);void 0!==e&&this._$Eh.set(e,t)}this.elementStyles=this.finalizeStyles(this.styles)}static finalizeStyles(e){const t=[];if(Array.isArray(e)){const i=new Set(e.flat(1/0).reverse());for(const e of i)t.unshift(l(e))}else void 0!==e&&t.push(l(e));return t}static _$Eu(e,t){const i=t.attribute;return!1===i?void 0:"string"==typeof i?i:"string"==typeof e?e.toLowerCase():void 0}constructor(){super(),this._$Ep=void 0,this.isUpdatePending=!1,this.hasUpdated=!1,this._$Em=null,this._$Ev()}_$Ev(){var e;this._$ES=new Promise(e=>this.enableUpdating=e),this._$AL=new Map,this._$E_(),this.requestUpdate(),null==(e=this.constructor.l)||e.forEach(e=>e(this))}addController(e){var t;(this._$EO??(this._$EO=new Set)).add(e),void 0!==this.renderRoot&&this.isConnected&&(null==(t=e.hostConnected)||t.call(e))}removeController(e){var t;null==(t=this._$EO)||t.delete(e)}_$E_(){const e=new Map,t=this.constructor.elementProperties;for(const i of t.keys())this.hasOwnProperty(i)&&(e.set(i,this[i]),delete this[i]);e.size>0&&(this._$Ep=e)}createRenderRoot(){const e=this.shadowRoot??this.attachShadow(this.constructor.shadowRootOptions);return((e,t)=>{if(o)e.adoptedStyleSheets=t.map(e=>e instanceof CSSStyleSheet?e:e.styleSheet);else for(const o of t){const t=document.createElement("style"),r=i.litNonce;void 0!==r&&t.setAttribute("nonce",r),t.textContent=o.cssText,e.appendChild(t)}})(e,this.constructor.elementStyles),e}connectedCallback(){var e;this.renderRoot??(this.renderRoot=this.createRenderRoot()),this.enableUpdating(!0),null==(e=this._$EO)||e.forEach(e=>{var t;return null==(t=e.hostConnected)?void 0:t.call(e)})}enableUpdating(e){}disconnectedCallback(){var e;null==(e=this._$EO)||e.forEach(e=>{var t;return null==(t=e.hostDisconnected)?void 0:t.call(e)})}attributeChangedCallback(e,t,i){this._$AK(e,i)}_$ET(e,t){var i;const o=this.constructor.elementProperties.get(e),r=this.constructor._$Eu(e,o);if(void 0!==r&&!0===o.reflect){const n=(void 0!==(null==(i=o.converter)?void 0:i.toAttribute)?o.converter:y).toAttribute(t,o.type);this._$Em=e,null==n?this.removeAttribute(r):this.setAttribute(r,n),this._$Em=null}}_$AK(e,t){var i,o;const r=this.constructor,n=r._$Eh.get(e);if(void 0!==n&&this._$Em!==n){const e=r.getPropertyOptions(n),s="function"==typeof e.converter?{fromAttribute:e.converter}:void 0!==(null==(i=e.converter)?void 0:i.fromAttribute)?e.converter:y;this._$Em=n;const l=s.fromAttribute(t,e.type);this[n]=l??(null==(o=this._$Ej)?void 0:o.get(n))??l,this._$Em=null}}requestUpdate(e,t,i){var o;if(void 0!==e){const r=this.constructor,n=this[e];if(i??(i=r.getPropertyOptions(e)),!((i.hasChanged??x)(n,t)||i.useDefault&&i.reflect&&n===(null==(o=this._$Ej)?void 0:o.get(e))&&!this.hasAttribute(r._$Eu(e,i))))return;this.C(e,t,i)}!1===this.isUpdatePending&&(this._$ES=this._$EP())}C(e,t,{useDefault:i,reflect:o,wrapped:r},n){i&&!(this._$Ej??(this._$Ej=new Map)).has(e)&&(this._$Ej.set(e,n??t??this[e]),!0!==r||void 0!==n)||(this._$AL.has(e)||(this.hasUpdated||i||(t=void 0),this._$AL.set(e,t)),!0===o&&this._$Em!==e&&(this._$Eq??(this._$Eq=new Set)).add(e))}async _$EP(){this.isUpdatePending=!0;try{await this._$ES}catch(t){Promise.reject(t)}const e=this.scheduleUpdate();return null!=e&&await e,!this.isUpdatePending}scheduleUpdate(){return this.performUpdate()}performUpdate(){var e;if(!this.isUpdatePending)return;if(!this.hasUpdated){if(this.renderRoot??(this.renderRoot=this.createRenderRoot()),this._$Ep){for(const[e,t]of this._$Ep)this[e]=t;this._$Ep=void 0}const e=this.constructor.elementProperties;if(e.size>0)for(const[t,i]of e){const{wrapped:e}=i,o=this[t];!0!==e||this._$AL.has(t)||void 0===o||this.C(t,void 0,i,o)}}let t=!1;const i=this._$AL;try{t=this.shouldUpdate(i),t?(this.willUpdate(i),null==(e=this._$EO)||e.forEach(e=>{var t;return null==(t=e.hostUpdate)?void 0:t.call(e)}),this.update(i)):this._$EM()}catch(o){throw t=!1,this._$EM(),o}t&&this._$AE(i)}willUpdate(e){}_$AE(e){var t;null==(t=this._$EO)||t.forEach(e=>{var t;return null==(t=e.hostUpdated)?void 0:t.call(e)}),this.hasUpdated||(this.hasUpdated=!0,this.firstUpdated(e)),this.updated(e)}_$EM(){this._$AL=new Map,this.isUpdatePending=!1}get updateComplete(){return this.getUpdateComplete()}getUpdateComplete(){return this._$ES}shouldUpdate(e){return!0}update(e){this._$Eq&&(this._$Eq=this._$Eq.forEach(e=>this._$ET(e,this[e]))),this._$EM()}updated(e){}firstUpdated(e){}}D.elementStyles=[],D.shadowRootOptions={mode:"open"},D[v("elementProperties")]=new Map,D[v("finalized")]=new Map,null==g||g({ReactiveElement:D}),(m.reactiveElementVersions??(m.reactiveElementVersions=[])).push("2.1.1");
|
|
12
12
|
/**
|
|
13
13
|
* @license
|
|
14
14
|
* Copyright 2017 Google LLC
|
|
15
15
|
* SPDX-License-Identifier: BSD-3-Clause
|
|
16
16
|
*/
|
|
17
|
-
const $={attribute:!0,type:String,converter:
|
|
17
|
+
const $={attribute:!0,type:String,converter:y,reflect:!1,hasChanged:x},I=(e=$,t,i)=>{const{kind:o,metadata:r}=i;let n=globalThis.litPropertyMetadata.get(r);if(void 0===n&&globalThis.litPropertyMetadata.set(r,n=new Map),"setter"===o&&((e=Object.create(e)).wrapped=!0),n.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 S(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)}
|
|
18
18
|
/**
|
|
19
19
|
* @license
|
|
20
20
|
* Copyright 2017 Google LLC
|
|
21
21
|
* SPDX-License-Identifier: BSD-3-Clause
|
|
22
|
-
*/function w(e){return S({...e,state:!0,attribute:!1})}class C{static validateField(e,t,i,o,r,n=[]){const s=[];for(const l of n){const n=this.validateRule(e,t,i,o,r,l);n&&s.push(n)}return s}static validateRule(e,t,i,o,r,n){const s=null==o||""===o;switch(n.type){case"required":if(s)return this.createError(e,t,i,n);break;case"min":if(!s&&"number"==typeof o&&o<n.value)return this.createError(e,t,i,n);break;case"max":if(!s&&"number"==typeof o&&o>n.value)return this.createError(e,t,i,n);break;case"minLength":if(!s&&"string"==typeof o&&o.length<n.value)return this.createError(e,t,i,n);break;case"maxLength":if(!s&&"string"==typeof o&&o.length>n.value)return this.createError(e,t,i,n);break;case"pattern":if(!s&&"string"==typeof o){if(!new RegExp(n.value).test(o))return this.createError(e,t,i,n)}break;case"email":if(!s&&"string"==typeof o){if(!/^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(o))return this.createError(e,t,i,n)}break;case"url":if(!s&&"string"==typeof o)try{new URL(o)}catch{return this.createError(e,t,i,n)}break;case"custom":break;default:console.warn(`Unknown validation rule type: ${n.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 formatPeriodDisplay(e,t){if(!e||!t)return`${e} / ${t}`;const i=e.substring(0,4);return i===t.substring(0,4)?i:`${e} / ${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,o="en",r){var n,s;if(!e.presentation||0===e.presentation.length)throw new Error("XBRL presentation data is required");const l=e.presentation[0],a=null==(n=e.hypercubes)?void 0:n[0],d=Array.isArray(e.datatypes)?e.datatypes:(null==(s=e.datatypes)?void 0:s.concepts)||[],c=[];return l.roles.forEach(e=>{const n=this.buildSectionFromRole(e,t,i,a,o,r);d&&d.length>0?(n.datatypes=d,console.log(`✅ [buildFormSchema] Attached ${d.length} datatypes to section ${n.id}`)):console.warn(`⚠️ [buildFormSchema] No datatypes available for section ${n.id}`),this.assignFieldColumnIds(n),c.push(n)}),{formId:`xbrl-form-${Date.now()}`,title:`XBRL Form - ${this.extractEntityName(l.entrypoint)}`,description:"Dynamic form generated from XBRL taxonomy data",version:"1.0.0",sections:c}}static buildSectionFromRole(e,t,i,o,r="en",n){var s;const l=this.extractRoleTitle(e.role),a=this.getAllNonAbstractConcepts(e),d=new Set(a.filter(e=>e.periodType).map(e=>e.periodType));let c=null==o?void 0:o.roles.find(t=>t.roleId===e.id);const p=null==n?void 0:n[e.id];c&&(null==p?void 0:p.dimensionSelections)&&p.dimensionSelections.length>0&&(console.log(`🔍 Filtering dimensions for role ${e.id} based on user selections`),c=this.filterHypercubeDimensionsBySelection(c,p.dimensionSelections));const u=this.generateDefaultColumnsForRole(e,t||"2025-01-01",i||"2025-12-31",c,a,d,p),h={periodTypes:d,availableColumnIds:u.map(e=>e.id),availableColumns:u},m=[];return(null==(s=e.presentationLinkbase)?void 0:s.concepts)&&e.presentationLinkbase.concepts.forEach(o=>{const n=this.buildConceptTree(o,0,t,i,h,e.id,r);n&&m.push(n)}),{id:e.id,title:l,description:e.description||`Section for ${l}`,concepts:m,columns:u,expanded:!1,metadata:{roleURI:e.roleURI,originalRole:e.role},showPeriodControl:d.size>1,showPreviousYear:!0===e.showPreviousYear,instant:!0===e.instant,duration:!0===e.duration}}static buildConceptTree(e,t,i,o,r,n,s="en"){const l=this.getPreferredLabel(e.labels,s),a=[];if(!e.elementAbstract){let t=[];t=(null==r?void 0:r.availableColumnIds)&&r.availableColumnIds.length>0?r.availableColumnIds:["duration"],t.forEach(t=>{var n;const s=null==(n=null==r?void 0:r.availableColumns)?void 0:n.find(e=>e.id===t),l=(null==s?void 0:s.periodStartDate)||i,d=(null==s?void 0:s.periodEndDate)||o,c=this.createFieldFromConcept(e,l,d,t);c&&a.push(c)})}const d=[];e.children&&e.children.length>0&&e.children.forEach(e=>{const l=this.buildConceptTree(e,t+1,i,o,r,n,s);l&&d.push(l)});return a.length>0||d.length>0?{id:this.createUniqueConceptId(e,n),originalConceptId:e.id,name:e.conceptName,label:l,description:`${e.conceptName} (${e.type})`,type:e.type,level:t,children:d,fields:a,facts:e.facts||[],collapsed:t>0,abstract:e.elementAbstract,periodType:e.periodType}:null}static createFieldFromConcept(e,t,i,o){const r=this.mapXBRLTypeToFieldType(e.type),n=this.getPreferredLabel(e.labels);let s;s=o||"duration";const l={id:`${e.id}_${s}_field`,conceptId:e.id,columnId:s,type:r,label:n,placeholder:`Enter ${n.toLowerCase()}`,required:!1,disabled:e.elementAbstract,defaultValue:null,periodType:"instant"===e.periodType||"duration"===e.periodType?e.periodType:void 0,periodStartDate:t||"2025-01-01",periodEndDate:i||"2025-12-31",periodInstantDate:"instant"===e.periodType?i||t||"2025-01-01":void 0};return"nl-cd_DescriptionLocationNL__a64trl"===e.id&&console.log(`🏗️ [Field Creation] Concept: ${e.id}, periodType from concept: ${e.periodType}, Field periodType: ${l.periodType}, ColumnId: ${s}`),l}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,t="en"){if(!e||0===e.length)return"Unnamed Concept";const i=e.filter(e=>e.lang===t),o=i.length>0?i:e,r=o.find(e=>e.preferredLabel);if(r)return r.label;const n=o.find(e=>"http://www.xbrl.org/2003/role/label"===e.role);if(n)return n.label;const s=o.find(e=>"http://www.xbrl.org/2003/role/terseLabel"===e.role);return s?s.label:o.length>0?o[0].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 filterHypercubeDimensionsBySelection(e,t){const i=JSON.parse(JSON.stringify(e));return i.items&&0!==i.items.length?(i.items.forEach(e=>{e.dimensions&&(e.dimensions=e.dimensions.map(e=>{var i,o;const r=t.find(t=>t.dimensionId===e.id);if(!r||!r.selectedMemberIds||0===r.selectedMemberIds.length)return e;const n={...e};return n.members=this.filterMembersBySelection(e.members,r.selectedMemberIds),console.log(` ✅ Filtered dimension ${e.id}: ${(null==(i=e.members)?void 0:i.length)||0} → ${(null==(o=n.members)?void 0:o.length)||0} members`),n}))}),i):i}static filterMembersBySelection(e,t){if(!e||!Array.isArray(e))return[];const i=[];return e.forEach(e=>{if(t.includes(e.id)&&i.push({...e,children:[]}),e.children&&e.children.length>0){const o=this.filterMembersBySelection(e.children,t);i.push(...o)}}),i}static generateDefaultColumnsForRole(e,t,i,o,r,n,s){var l,a;const d=r||this.getAllNonAbstractConcepts(e),c=n||new Set(d.filter(e=>e.periodType).map(e=>e.periodType));if(0===d.length)return[{id:"default",title:"Value",description:"Default value column",type:"base",order:0,removable:!1}];let p=[];if(1===(null==(l=null==o?void 0:o.items)?void 0:l.length)){const e=o.items[0];1===e.dimensions.length?p=this.generateSingleDimensionColumns(e.dimensions[0],t,i,c):e.dimensions.length>1&&(p=this.generateMultiDimensionColumns(e.dimensions,t,i,c)),s&&(p=this.filterColumnsByPeriodPreferences(p,s))}else(null==(a=null==o?void 0:o.items)?void 0:a.length)&&o.items.length;const u=[];p.length>0?u.push(...p):0===c.size?u.push({id:"default",title:this.formatPeriodDisplay(t,i),description:"",type:"base",order:0,removable:!1,periodStartDate:t,periodEndDate:i}):u.push({id:"duration",title:this.formatPeriodDisplay(t,i),description:"",type:"base",order:0,removable:!1,periodStartDate:t,periodEndDate:i});let h=u;if(s&&(h=this.filterColumnsByPeriodPreferences(u,s)),null==s?void 0:s.showPreviousYear){const e=this.generatePreviousYearColumns(h,t,i);h=[...h,...e]}return h}static getPreviousYearDate(e){try{const t=new Date(e);return t.setFullYear(t.getFullYear()-1),t.toISOString().split("T")[0]}catch(t){return console.error(`Error calculating previous year for date ${e}:`,t),e}}static generatePreviousYearColumns(e,t,i){const o=[],r=this.getPreviousYearDate(t),n=this.getPreviousYearDate(i);return e.forEach((e,t)=>{let i=e.title,s="",l="";e.dimensionData?(i=e.title,s=this.formatPeriodDisplay(r,n),l=`${e.id}_prev`):(i=this.formatPeriodDisplay(r,n),s="",l=`duration_prev_${t}`),o.push({...e,id:l,title:i,description:s,order:e.order+100,removable:!1,periodStartDate:r,periodEndDate:n,dimensionData:e.dimensionData?{...e.dimensionData,dimensionId:`${e.dimensionData.dimensionId}_prev`}:void 0})}),o}static filterColumnsByPeriodPreferences(e,t){return e.filter(e=>{var i,o,r,n;const s=e.id.includes("duration")||(null==(o=null==(i=e.dimensionData)?void 0:i.dimensionId)?void 0:o.includes("duration")),l=e.id.includes("instant")||(null==(n=null==(r=e.dimensionData)?void 0:r.dimensionId)?void 0:n.includes("instant"));return!s&&!l||!(s&&!t.showDuration)&&!(l&&!t.showInstant)})}static generateSingleDimensionColumns(e,t,i,o){var r,n,s;if(e.typedMember&&(!e.members||0===e.members.length)){const n=(null==(r=e.labels.find(e=>"http://www.xbrl.org/2003/role/label"===e.role))?void 0:r.label)||e.conceptName,s={axisId:e.id,axisLabel:n,typedMemberId:e.typedMember.id,dimensionKey:`${n} | [Typed Input]`,dimensionIdKey:`${e.id}|[typed]`},l=[];return 0===o.size?l.push({id:"typed-default",title:n,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,periodStartDate:t,periodEndDate:i}):1===o.size&&o.has("instant")?l.push({id:"typed-instant",title:`${n} `,description:i,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,periodStartDate:i,periodEndDate:i}):(1===o.size&&o.has("duration"),l.push({id:"typed-duration",title:`${n} `,description:this.formatPeriodDisplay(t,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,periodStartDate:t,periodEndDate:i})),l}if(!e.members||!Array.isArray(e.members))return[];if(0===e.members.length)return[];const l=(null==(n=e.labels.find(e=>"http://www.xbrl.org/2003/role/label"===e.role))?void 0:n.label)||e.conceptName,a=e.members[0],d=(null==(s=a.labels.find(e=>"http://www.xbrl.org/2003/role/label"===e.role))?void 0:s.label)||a.conceptName,c={axisId:e.id,axisLabel:l,memberId:a.id,memberLabel:d,dimensionKey:`${l} | ${d}`,dimensionIdKey:`${e.id} | ${a.id}`},p=[];return 0===o.size?p.push({id:"default",title:c.memberLabel,description:"Default value column",type:"dimension",dimensionData:{dimensionId:"default",axisId:c.axisId,memberId:c.memberId,memberValue:c.memberLabel,memberLabel:c.memberLabel,axis:c.axisLabel,axisLabel:c.axisLabel,memberKey:c.dimensionKey,dimensionIdKey:c.dimensionIdKey},order:0,removable:!1,periodStartDate:t,periodEndDate:i}):1===o.size&&o.has("instant")?p.push({id:"instant",title:`${c.memberLabel}`,description:i,type:"dimension",dimensionData:{dimensionId:"instant",axisId:c.axisId,memberId:c.memberId,memberValue:c.memberLabel,memberLabel:c.memberLabel,axis:c.axisLabel,axisLabel:c.axisLabel,memberKey:c.dimensionKey,dimensionIdKey:c.dimensionIdKey},order:0,removable:!1,periodStartDate:i,periodEndDate:i}):1===o.size&&o.has("duration")?p.push({id:"duration",title:`${c.memberLabel}`,description:`${t} / ${i}`,type:"dimension",dimensionData:{dimensionId:"duration",axisId:c.axisId,memberId:c.memberId,memberValue:c.memberLabel,memberLabel:c.memberLabel,axis:c.axisLabel,axisLabel:c.axisLabel,memberKey:c.dimensionKey,dimensionIdKey:c.dimensionIdKey},order:0,removable:!1,periodStartDate:t,periodEndDate:i}):p.push({id:"duration",title:`${c.memberLabel}`,description:this.formatPeriodDisplay(t,i),type:"dimension",dimensionData:{dimensionId:"duration",axisId:c.axisId,memberId:c.memberId,memberValue:c.memberLabel,memberLabel:c.memberLabel,axis:c.axisLabel,axisLabel:c.axisLabel,memberKey:c.dimensionKey,dimensionIdKey:c.dimensionIdKey},order:0,removable:!1,periodStartDate:t,periodEndDate:i}),p}static generateMultiDimensionColumns(e,t,i,o){e.some(e=>e.typedMember);const r=e.filter(e=>!!e.typedMember||!!(e.members&&Array.isArray(e.members)&&e.members.length>0));if(0===r.length)return[];const n=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}`}]};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}})}}),s=this.generateDimensionCombinations(n),l=[];return s.forEach((e,o)=>{const r=e.map(e=>e.memberLabel).join(" | "),n=e.filter(e=>e.isTyped),s=e.filter(e=>!e.isTyped),a={dimensionId:`multi_${o}`,memberValue:r,memberLabel:r,combinations:s.map(e=>({axisId:e.axisId,axisLabel:e.axisLabel,memberId:e.memberId,memberLabel:e.memberLabel})),typedMembers:n.map(e=>({axisId:e.axisId,axisLabel:e.axisLabel,typedMemberId:e.typedMemberId,memberLabel:e.memberLabel})),hasTypedMembers:n.length>0,memberKey:r,dimensionIdKey:[...s.map(e=>`${e.axisId}|${e.memberId}`),...n.map(e=>`${e.axisId}|[typed]`)].join("::")};l.push({id:`duration_${o}`,title:`${r}`,description:this.formatPeriodDisplay(t,i),type:"dimension",dimensionData:{...a,dimensionId:`duration_${o}`},order:o,removable:!1,periodStartDate:t,periodEndDate:i})}),l}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"}]}}const R={en:{form:{loading:"Loading form...",submit:"Validate",save:"Save",saveDraft:"Save Draft",savingDraft:"Saving draft",errors:"Errors",modified:"Modified",valid:"Valid",yes:"Yes",no:"No",noRoleSelected:"No Role Selected",pleaseSelectRole:"Please select a role from the list on the left.",expandPanel:"Expand side panel",collapsePanel:"Collapse side panel",validate:"Validate",preview:"Preview",cancelValidation:"Cancel Validation",lastValidationResults:"Last Validation Results",validationInProgress:"Validation In Progress"},filter:{selectRoles:"Select Roles",filterRoles:"Filter Roles",title:"Filter Roles",description:"Select the roles you want to display in the form. You can search and choose specific roles to focus on or manage all available roles.",searchPlaceholder:"Search..",clearSearch:"Clear search",showingResults:"Showing",of:"of",roles:"roles",matching:"matching",selectAll:"Select All",selectNone:"Select None",selectFiltered:"Select Filtered",deselectFiltered:"Deselect Filtered",deselectAll:"Deselect All",reset:"Reset",noRolesFound:"No roles found matching",tryDifferentSearch:"Try a different search term or clear the search.",noRolesAvailable:"No roles available.",cancel:"Cancel",applyFilter:"Apply Filter",showPeriodColumn:"Show Period Column:",additionalOptions:"Additional Options:",showPreviousYear:"Show previous year",duration:"Duration",instant:"Instant",uri:"URI",dimensionMemberSelection:"Dimension Member Selection",selectAllMembers:"Select All",clearMembers:"Clear",availableRoles:"Available Roles",chosenRoles:"Chosen Roles",roleCount:"role(s)",rolesSelected:"role(s) selected",addSelectedRole:"Add selected role",addAllRoles:"Add all roles",removeSelectedRole:"Remove selected role",removeAllRoles:"Remove all roles"},column:{addColumn:"Add Column",columnOptions:"Column Options",columnType:"Column Type",instantSingleDate:"Instant (single date)",durationDates:"Duration (start and end dates)",instantDate:"Instant Date",startPeriodDate:"Start Period Date",endPeriodDate:"End Period Date",availableDimensions:"Available Dimensions",dimensionsDescription:"Select dimensions to include in the column. Domain members can be selected here, while typed dimension values will be entered directly in the column header.",enterValue:"Enter value for",enterValuePlaceholder:"Enter value...",selectMember:"Select member:",noMembersAvailable:"No members available for this dimension",cancel:"Cancel",removeColumn:"Remove column",required:"required"},section:{enterPlaceholder:"Enter"},field:{selectOption:"Select an option...",select:"Select...",enterDetailedExplanation:"Enter detailed explanation...",enterAmountNoDecimals:"Enter amount (no decimals)",enterCurrency:"0.00",enterText:"Enter text",enterWholeNumber:"Enter whole number",enterPositiveNumber:"Enter positive number",enterDecimalValue:"Enter decimal value",enterNumberOfShares:"Enter number of shares",yearFormat:"YYYY",enterPercentage:"Enter percentage",emailPlaceholder:"email@example.com",urlPlaceholder:"https://example.com",phonePlaceholder:"+1 (555) 000-0000",enterValue:"Enter value",enterDetailedInformation:"Enter detailed information..."},admin:{title:"Configure Roles",description:"Select which roles should display the 'Show Previous Year' checkbox and configure period type columns."},validation:{summary:"Please fix the following errors before submitting:",errorsFound:"errors found",unitRequired:"Unit is required. Please select a unit via the period icon."},xbrlValidation:{patternMismatch:"Value does not match required pattern: {{pattern}}",invalidPattern:"Invalid pattern configuration: {{pattern}}",exactLength:"Value must be exactly {{required}} characters (current: {{current}})",minLength:"Value must be at least {{required}} characters (current: {{current}})",maxLength:"Value must not exceed {{required}} characters (current: {{current}})",totalDigits:"Value must not exceed {{required}} total digits (current: {{current}})",ruleSummaryPattern:"Must match pattern: {{pattern}}",ruleSummaryExactLength:"Must be exactly {{required}} characters",ruleSummaryMinLength:"Minimum {{required}} characters",ruleSummaryMaxLength:"Maximum {{required}} characters",ruleSummaryTotalDigits:"Maximum {{required}} total digits"},error:{popup:{title:"Validation Errors",message:"Please fix the following validation errors before saving:",field:"Field:",value:"Value:",errors:"Errors:",clickToFocus:"Click to focus this field",ok:"OK"}}},nl:{form:{loading:"Formulier laden...",submit:"Valideren",save:"Opslaan",saveDraft:"Concept opslaan",savingDraft:"Concept opslaan...",errors:"Fouten",modified:"Gewijzigd",valid:"Geldig",yes:"Ja",no:"Nee",noRoleSelected:"Geen rol geselecteerd",pleaseSelectRole:"Selecteer een rol uit de lijst aan de linkerkant.",expandPanel:"Zijpaneel uitvouwen",collapsePanel:"Zijpaneel inklappen",validate:"Valideren",preview:"Voorbeeld",cancelValidation:"Validatie annuleren",lastValidationResults:"Laatste validatieresultaten",validationInProgress:"Validatie bezig"},filter:{selectRoles:"Rollen selecteren",filterRoles:"Rollen filteren",title:"Rollen filteren",description:"Selecteer de rollen die u in het formulier wilt weergeven. U kunt zoeken en specifieke rollen kiezen om op te focussen of alle beschikbare rollen beheren.",searchPlaceholder:"Zoek rollen op naam, ID of URI...",clearSearch:"Zoekopdracht wissen",showingResults:"Weergeven",of:"van",roles:"rollen",matching:"overeenkomend met",selectAll:"Alles selecteren",selectNone:"Niets selecteren",selectFiltered:"Gefilterd selecteren",deselectFiltered:"Gefilterd deselecteren",deselectAll:"Alles deselecteren",reset:"Resetten",noRolesFound:"Geen rollen gevonden die overeenkomen met",tryDifferentSearch:"Probeer een andere zoekterm of wis de zoekopdracht.",noRolesAvailable:"Geen rollen beschikbaar.",cancel:"Annuleren",applyFilter:"Filter toepassen",showPeriodColumn:"Periodekolom weergeven:",additionalOptions:"Aanvullende opties:",showPreviousYear:"Vorig jaar weergeven",duration:"Duur",instant:"Moment",uri:"URI",dimensionMemberSelection:"Dimensieleden selectie",selectAllMembers:"Alles selecteren",clearMembers:"Wissen",availableRoles:"Beschikbare rollen",chosenRoles:"Gekozen rollen",roleCount:"rol(len)",rolesSelected:"rol(len) geselecteerd",addSelectedRole:"Geselecteerde rol toevoegen",addAllRoles:"Alle rollen toevoegen",removeSelectedRole:"Geselecteerde rol verwijderen",removeAllRoles:"Alle rollen verwijderen"},column:{addColumn:"Kolom toevoegen",columnOptions:"Kolomopties",columnType:"Kolomtype",instantSingleDate:"Moment (enkele datum)",durationDates:"Duur (begin- en einddatum)",instantDate:"Momentdatum",startPeriodDate:"Startdatum periode",endPeriodDate:"Einddatum periode",availableDimensions:"Beschikbare dimensies",dimensionsDescription:"Selecteer dimensies om in de kolom op te nemen. Domeinleden kunnen hier worden geselecteerd, terwijl getypte dimensiewaarden direct in de kolomkop worden ingevoerd.",enterValue:"Voer waarde in voor",enterValuePlaceholder:"Voer waarde in...",selectMember:"Selecteer lid:",noMembersAvailable:"Geen leden beschikbaar voor deze dimensie",cancel:"Annuleren",removeColumn:"Kolom verwijderen",required:"verplicht"},section:{enterPlaceholder:"Invoeren"},field:{selectOption:"Selecteer een optie...",select:"Selecteer...",enterDetailedExplanation:"Voer gedetailleerde uitleg in...",enterAmountNoDecimals:"Voer bedrag in (geen decimalen)",enterCurrency:"0,00",enterText:"Voer tekst in",enterWholeNumber:"Voer geheel getal in",enterPositiveNumber:"Voer positief getal in",enterDecimalValue:"Voer decimale waarde in",enterNumberOfShares:"Voer aantal aandelen in",yearFormat:"JJJJ",enterPercentage:"Voer percentage in",emailPlaceholder:"email@voorbeeld.nl",urlPlaceholder:"https://voorbeeld.nl",phonePlaceholder:"+31 (0)20 123 4567",enterValue:"Voer waarde in",enterDetailedInformation:"Voer gedetailleerde informatie in..."},admin:{title:"Rollen configureren",description:"Selecteer welke rollen het selectievakje 'Vorig jaar weergeven' moeten weergeven en configureer periodetype kolommen."},validation:{summary:"Corrigeer de volgende fouten voordat u indient:",errorsFound:"fouten gevonden",unitRequired:"Eenheid is verplicht. Selecteer een eenheid via het periodeicoon."},xbrlValidation:{patternMismatch:"Waarde voldoet niet aan het vereiste patroon: {{pattern}}",invalidPattern:"Ongeldige patternconfiguratie: {{pattern}}",exactLength:"Waarde moet exact {{required}} tekens bevatten (huidig: {{current}})",minLength:"Waarde moet minimaal {{required}} tekens bevatten (huidig: {{current}})",maxLength:"Waarde mag niet meer dan {{required}} tekens bevatten (huidig: {{current}})",totalDigits:"Waarde mag niet meer dan {{required}} cijfers bevatten (huidig: {{current}})",ruleSummaryPattern:"Moet overeenkomen met patroon: {{pattern}}",ruleSummaryExactLength:"Moet exact {{required}} tekens bevatten",ruleSummaryMinLength:"Minimaal {{required}} tekens",ruleSummaryMaxLength:"Maximaal {{required}} tekens",ruleSummaryTotalDigits:"Maximaal {{required}} cijfers"},error:{popup:{title:"Validatiefouten",message:"Corrigeer de volgende validatiefouten voordat u opslaat:",field:"Veld:",value:"Waarde:",errors:"Fouten:",clickToFocus:"Klik om dit veld te focussen",ok:"OK"}}}};class E{static setLanguage(e){R[e]?this.currentLanguage=e:(console.warn(`Language '${e}' not supported, falling back to 'en'`),this.currentLanguage="en")}static getLanguage(){return this.currentLanguage}static t(e,t){const i=e.split(".");let o=R[this.currentLanguage];for(const r of i){if(!o||"object"!=typeof o||!(r in o))return console.warn(`Translation key '${e}' not found for language '${this.currentLanguage}'`),e;o=o[r]}return t&&"string"==typeof o?this.interpolate(o,t):o}static interpolate(e,t){return e.replace(/\{\{(\w+)\}\}/g,(e,i)=>i in t?String(t[i]):e)}static has(e){const t=e.split(".");let i=R[this.currentLanguage];for(const o of t){if(!i||"object"!=typeof i||!(o in i))return!1;i=i[o]}return void 0!==i}static getAvailableLanguages(){return Object.keys(R)}}E.currentLanguage="en";class T{constructor(e=!1){this.DRAFT_DATA_KEY="jupiter-form-draft-data",this.DRAFT_METADATA_KEY="jupiter-form-draft-metadata",this.STORAGE_VERSION="1.0",this._storage=e?sessionStorage:localStorage,console.log(`💾 DraftStorageService initialized (using ${e?"sessionStorage":"localStorage"})`)}saveDraft(e,t){try{const i={formData:e,metadata:{...t,savedAt:(new Date).toISOString()},version:this.STORAGE_VERSION};return this._storage.setItem(this.DRAFT_DATA_KEY,JSON.stringify(i.formData)),this._storage.setItem(this.DRAFT_METADATA_KEY,JSON.stringify(i.metadata)),console.log("✅ Draft saved successfully",{entries:e.length,timestamp:i.metadata.savedAt,roles:t.selectedRoleIds.length,customColumns:t.customColumns.length}),!0}catch(i){return console.error("❌ Failed to save draft:",i),!1}}loadDraft(){try{const e=this._storage.getItem(this.DRAFT_DATA_KEY),t=this._storage.getItem(this.DRAFT_METADATA_KEY);if(!e||!t)return console.log("ℹ️ No saved draft found"),null;const i=JSON.parse(e),o=JSON.parse(t);return console.log("✅ Draft loaded successfully",{entries:i.length,savedAt:o.savedAt,roles:o.selectedRoleIds.length,customColumns:o.customColumns.length}),{formData:i,metadata:o,version:this.STORAGE_VERSION}}catch(e){return console.error("❌ Failed to load draft:",e),null}}hasDraft(){return null!==this._storage.getItem(this.DRAFT_DATA_KEY)&&null!==this._storage.getItem(this.DRAFT_METADATA_KEY)}getDraftMetadata(){try{const e=this._storage.getItem(this.DRAFT_METADATA_KEY);return e?JSON.parse(e):null}catch(e){return console.error("❌ Failed to load draft metadata:",e),null}}clearDraft(){try{return this._storage.removeItem(this.DRAFT_DATA_KEY),this._storage.removeItem(this.DRAFT_METADATA_KEY),console.log("🗑️ Draft cleared successfully"),!0}catch(e){return console.error("❌ Failed to clear draft:",e),!1}}getDraftAge(){const e=this.getDraftMetadata();if(!e)return null;const t=new Date(e.savedAt);return(new Date).getTime()-t.getTime()}isDraftStale(e){const t=this.getDraftAge();return null!==t&&t>e}extractCustomColumns(e){const t=[];return e.forEach(e=>{e.columns&&Array.isArray(e.columns)&&e.columns.forEach(i=>{t.push({sectionId:e.id,columnId:i.id,label:i.title,description:i.description,periodType:this._inferPeriodTypeFromColumn(i),date:i.periodStartDate,startDate:i.periodStartDate,endDate:i.periodEndDate,dimensionData:i.dimensionData})})}),t}_inferPeriodTypeFromColumn(e){return e.periodStartDate&&e.periodEndDate?"duration":"instant"}createMetadataSnapshot(e,t,i,o,r,n,s,l,a,d="en"){return{periodStartDate:e,periodEndDate:t,language:i,reportingLanguage:d,selectedRoleIds:o,customColumns:this.extractCustomColumns(r),typedMemberData:n,periodPreferences:s,periodData:l,unitData:a,schemaVersion:this.STORAGE_VERSION}}validateDraftCompatibility(e,t,i){const o=[];e.metadata.periodStartDate!==t&&o.push(`Draft period start (${e.metadata.periodStartDate}) differs from current (${t})`),e.metadata.periodEndDate!==i&&o.push(`Draft period end (${e.metadata.periodEndDate}) differs from current (${i})`);const r=this.getDraftAge();r&&r>6048e5&&o.push(`Draft is ${Math.floor(r/864e5)} days old`);return{compatible:0===o.length,warnings:o}}}class k{static findMatchingFact(e,t){if(!e||0===e.length)return null;const i=e.filter(e=>this.matchesPeriod(e,t));if(0===i.length)return null;const o=i.filter(e=>this.matchesDimensions(e,t));if(0===o.length)return null;if(o.length>1&&t.unit){const e=o.find(e=>this.matchesUnit(e,t));if(e)return e}return o[0]}static matchesPeriod(e,t){const i=this.parsePeriod(e.period);return"instant"===t.periodType&&t.periodInstantDate?i.isInstant&&i.instantDate===t.periodInstantDate:"duration"===t.periodType&&t.periodStartDate&&t.periodEndDate?!i.isInstant&&i.startDate===t.periodStartDate&&i.endDate===t.periodEndDate:t.periodInstantDate?i.isInstant&&i.instantDate===t.periodInstantDate:!t.periodStartDate||!t.periodEndDate||!i.isInstant&&i.startDate===t.periodStartDate&&i.endDate===t.periodEndDate}static matchesDimensions(e,t){const i=e.dimensions||[],o=this.extractDimensionsFromContext(t);if(0===o.length)return 0===i.length;if(0===i.length&&o.length>0)return!1;if(i.length!==o.length)return!1;return o.every(e=>i.some(t=>{if(!(this.normalizeAxisId(t.dimension)===this.normalizeAxisId(e.axisId)))return!1;if("explicit"===t.dimensionType&&e.memberId){return this.normalizeMemberId(t.member||"")===this.normalizeMemberId(e.memberId)}return!("typed"!==t.dimensionType||!e.isTyped)}))}static matchesUnit(e,t){if(!t.unit||!e.unitMeasure)return!0;return this.normalizeUnit(e.unitMeasure)===this.normalizeUnit(t.unit)}static parsePeriod(e){if(e.includes(" / ")){const[t,i]=e.split(" / ").map(e=>e.trim());return{isInstant:!1,startDate:t,endDate:i}}return{isInstant:!0,instantDate:e.trim()}}static extractDimensionsFromContext(e){if(!e.dimensionData)return[];const t=[];return e.dimensionData.combinations&&e.dimensionData.combinations.length>0&&e.dimensionData.combinations.forEach(e=>{t.push({axisId:e.axisId,memberId:e.memberId})}),e.dimensionData.typedMembers&&e.dimensionData.typedMembers.length>0&&e.dimensionData.typedMembers.forEach(e=>{t.push({axisId:e.axisId,memberId:"[typed]",isTyped:!0})}),t}static normalizeAxisId(e){if(!e)return"";if(e.includes(":")){const t=e.split(":");return t[1]||t[0]}if(e.includes("_")){e.split("_");const t=e.lastIndexOf("_");if(t>0)return e.substring(t+1)}return e}static normalizeMemberId(e){if(!e)return"";if(e.includes(":")){const t=e.split(":");return t[1]||t[0]}if(e.includes("_")){const t=e.lastIndexOf("_");if(t>0)return e.substring(t+1)}return e}static normalizeUnit(e){if(!e)return"";const t=e.split(":");return t.length>1?t[1]:t[0]}static extractTypedValues(e,t){const i={};if(!e||0===e.length)return i;return e.filter(e=>this.matchesPeriod(e,t)&&this.matchesDimensions(e,t)).forEach(e=>{e.dimensions&&e.dimensions.forEach(e=>{if("typed"===e.dimensionType&&e.typedMemberValue){const t=this.normalizeAxisId(e.dimension);i[t]=e.typedMemberValue}})}),i}static debugMatch(e,t){console.log("🔍 [FactMatcher] Debug Match"),console.log(" Context:",{conceptId:t.conceptId,columnId:t.columnId,period:"instant"===t.periodType?t.periodInstantDate:`${t.periodStartDate} / ${t.periodEndDate}`,dimensions:this.extractDimensionsFromContext(t)}),console.log(" Facts:",e.map(e=>{var t;return{value:e.value,period:e.period,dimensions:null==(t=e.dimensions)?void 0:t.map(e=>`${e.dimension}:${e.member}`)}}));const i=this.findMatchingFact(e,t);console.log(" Match Result:",i?i.value:"No match")}}class A{static validateConceptValue(e,t,i){const o=[];if(null==t||""===t)return{valid:!0,errors:[]};if(!e||!i||0===i.length)return{valid:!0,errors:[]};const r=this.findDatatype(e,i);if(!r||!r.validation)return{valid:!0,errors:[]};const n=r.validation,s=String(t);if(n.pattern){const e=this.validatePattern(s,n.pattern);e&&o.push(e)}if(void 0!==n.length){const e=this.validateExactLength(s,n.length);e&&o.push(e)}if(void 0!==n.minLength){const e=this.validateMinLength(s,n.minLength);e&&o.push(e)}if(void 0!==n.maxLength){const e=this.validateMaxLength(s,n.maxLength);e&&o.push(e)}if(void 0!==n.totalDigits){const e=this.validateTotalDigits(s,n.totalDigits);e&&o.push(e)}return{valid:0===o.length,errors:o}}static findDatatype(e,t){let i=t.find(t=>t.type===e);if(i)return i;const o=new Set;let r=e;for(;r&&!o.has(r)&&(o.add(r),i=t.find(e=>e.type===r),i);){if(i.validation)return i;r=i.basetype}}static validatePattern(e,t){try{if(!new RegExp(`^${t}$`).test(e))return{type:"pattern",message:E.t("xbrlValidation.patternMismatch",{pattern:t}),expectedValue:t,actualValue:e}}catch(i){return console.error(`Invalid regex pattern: ${t}`,i),{type:"pattern",message:E.t("xbrlValidation.invalidPattern",{pattern:t}),expectedValue:t,actualValue:e}}return null}static validateExactLength(e,t){return e.length!==t?{type:"length",message:E.t("xbrlValidation.exactLength",{required:t,current:e.length}),expectedValue:t,actualValue:e.length}:null}static validateMinLength(e,t){return e.length<t?{type:"minLength",message:E.t("xbrlValidation.minLength",{required:t,current:e.length}),expectedValue:t,actualValue:e.length}:null}static validateMaxLength(e,t){return e.length>t?{type:"maxLength",message:E.t("xbrlValidation.maxLength",{required:t,current:e.length}),expectedValue:t,actualValue:e.length}:null}static validateTotalDigits(e,t){const i=e.replace(/[^\d]/g,"");return i.length>t?{type:"totalDigits",message:E.t("xbrlValidation.totalDigits",{required:t,current:i.length}),expectedValue:t,actualValue:i.length}:null}static getValidationRulesSummary(e,t){if(!e||!t)return[];const i=this.findDatatype(e,t);if(!i||!i.validation)return[];const o=i.validation,r=[];return o.pattern&&r.push(E.t("xbrlValidation.ruleSummaryPattern",{pattern:o.pattern})),void 0!==o.length&&r.push(E.t("xbrlValidation.ruleSummaryExactLength",{required:o.length})),void 0!==o.minLength&&r.push(E.t("xbrlValidation.ruleSummaryMinLength",{required:o.minLength})),void 0!==o.maxLength&&r.push(E.t("xbrlValidation.ruleSummaryMaxLength",{required:o.maxLength})),void 0!==o.totalDigits&&r.push(E.t("xbrlValidation.ruleSummaryTotalDigits",{required:o.totalDigits})),r}}const P={"nl-types:formattedExplanationItemType":{fieldType:"textarea",placeholder:E.t("field.enterDetailedExplanation")},"nl-types:monetaryNoDecimals20ItemType":{fieldType:"number",htmlInputType:"number",allowDecimals:!1,step:1,placeholder:E.t("field.enterAmountNoDecimals")},"xbrli:monetaryItemType":{fieldType:"currency",htmlInputType:"number",allowDecimals:!0,step:.01,placeholder:E.t("field.enterCurrency")},"xbrli:stringItemType":{fieldType:"text",htmlInputType:"text",placeholder:E.t("field.enterText")},"xbrli:dateItemType":{fieldType:"date",htmlInputType:"date"},"xbrli:dateTimeItemType":{fieldType:"datetime",htmlInputType:"datetime-local"},"xbrli:integerItemType":{fieldType:"integer",htmlInputType:"number",allowDecimals:!1,step:1,placeholder:E.t("field.enterWholeNumber")},"xbrli:nonNegativeIntegerItemType":{fieldType:"integer",htmlInputType:"number",allowDecimals:!1,min:0,step:1,placeholder:E.t("field.enterPositiveNumber")},"xbrli:positiveIntegerItemType":{fieldType:"integer",htmlInputType:"number",allowDecimals:!1,min:1,step:1,placeholder:E.t("field.enterPositiveNumber")},"xbrli:decimalItemType":{fieldType:"decimal",htmlInputType:"number",allowDecimals:!0,step:"any",placeholder:E.t("field.enterDecimalValue")},"xbrli:sharesItemType":{fieldType:"number",htmlInputType:"number",allowDecimals:!0,min:0,step:.01,placeholder:E.t("field.enterNumberOfShares")},"xbrli:shares":{fieldType:"number",htmlInputType:"number",allowDecimals:!0,min:0,step:.01,placeholder:E.t("field.enterNumberOfShares")},"xbrli:gYearItemType":{fieldType:"number",htmlInputType:"number",allowDecimals:!1,min:1900,max:2100,step:1,placeholder:E.t("field.yearFormat")},"xbrli:booleanItemType":{fieldType:"boolean"},"xbrli:pureItemType":{fieldType:"percentage",htmlInputType:"number",allowDecimals:!0,step:.01,placeholder:E.t("field.enterPercentage")},"xbrli:percentItemType":{fieldType:"percentage",htmlInputType:"number",allowDecimals:!0,step:.01,placeholder:E.t("field.enterPercentage")},"xbrli:emailItemType":{fieldType:"email",htmlInputType:"email",placeholder:E.t("field.emailPlaceholder")},"xbrli:urlItemType":{fieldType:"url",htmlInputType:"url",placeholder:E.t("field.urlPlaceholder")},"xbrli:telephoneItemType":{fieldType:"tel",htmlInputType:"tel",placeholder:E.t("field.phonePlaceholder")}};function M(e,t){if(!e)return{fieldType:"text",htmlInputType:"text",placeholder:E.t("field.enterValue")};if(t&&t.length>0){const i=O(e,t);if(i.length>0){const o=z(i,t);return console.log(`🔍 [Type Resolution] ${e} → Chain:`,i,"→ Type:",o.fieldType,o.enumerations?`(${o.enumerations.length} options)`:""),o}}if(console.log(`⚠️ [Type Resolution Fallback] Using pattern matching for: ${e}`),P[e])return P[e];const i=e.toLowerCase();if(i.includes("monetary"))return i.includes("nodecimals")||i.includes("no-decimals")?{fieldType:"number",htmlInputType:"number",allowDecimals:!1,step:1,placeholder:E.t("field.enterAmountNoDecimals")}:{fieldType:"currency",htmlInputType:"number",allowDecimals:!0,step:.01,placeholder:E.t("field.enterCurrency")};if(i.includes("explanation")||i.includes("description")||i.includes("notes")||i.includes("formatted"))return{fieldType:"textarea",placeholder:E.t("field.enterDetailedInformation")};if(i.includes("date"))return i.includes("time")?{fieldType:"datetime",htmlInputType:"datetime-local"}:{fieldType:"date",htmlInputType:"date"};if(i.includes("boolean")||i.includes("bool"))return{fieldType:"boolean"};if(i.includes("integer")||i.includes("int")){const e=i.includes("nonnegative")||i.includes("non-negative");return{fieldType:"integer",htmlInputType:"number",allowDecimals:!1,min:i.includes("positive")?1:e?0:void 0,step:1,placeholder:E.t("field.enterWholeNumber")}}return i.includes("decimal")||i.includes("numeric")||i.includes("number")?{fieldType:"decimal",htmlInputType:"number",allowDecimals:!0,step:"any",placeholder:E.t("field.enterDecimalValue")}:i.includes("percent")||i.includes("pure")?{fieldType:"percentage",htmlInputType:"number",allowDecimals:!0,step:.01,placeholder:E.t("field.enterPercentage")}:{fieldType:"text",htmlInputType:"text",placeholder:E.t("field.enterValue")}}function j(e){return"textarea"===e}function L(e){return"boolean"===e}function U(e){return["number","decimal","integer","currency","percentage"].includes(e)}function O(e,t){const i=[];if(!e)return i;if(!t||0===t.length)return i.push(e),i;let o=e;const r=new Set;for(;o;){if(i.push(o),r.has(o)){console.warn(`Circular reference detected in datatype hierarchy for type: ${o}`);break}r.add(o);const e=t.find(e=>e.type===o);if(!e||!e.basetype||""===e.basetype.trim())break;o=e.basetype}return i}function N(e,t){if(e&&0!==e.length&&t&&0!==t.length)for(const i of e){const e=t.find(e=>e.type===i);if(e&&e.enumerations&&e.enumerations.length>0)return e.enumerations.map(e=>({id:e.id||e.value,value:e.value,label:e.value}))}}function z(e,t){if(!e||0===e.length)return{fieldType:"text",htmlInputType:"text",placeholder:E.t("field.enterValue")};if(t&&t.length>0){const i=N(e,t);if(i&&i.length>0)return{fieldType:"select",enumerations:i,placeholder:E.t("field.selectOption")}}const i=e.map(e=>e.toLowerCase()),o=i.join("|");if(e.some(e=>"nl-types:formattedExplanationItemType"===e)||o.includes("formattedexplanation")||o.includes("formatted")&&o.includes("explanation"))return{fieldType:"textarea",placeholder:E.t("field.enterDetailedExplanation")};if(i.some(e=>e.includes("date")))return o.includes("datetime")||o.includes("time")?{fieldType:"datetime",htmlInputType:"datetime-local"}:{fieldType:"date",htmlInputType:"date"};if(i.some(e=>e.includes("boolean")||e.includes("bool")))return{fieldType:"boolean"};if(i.some(e=>e.includes("integer")||"integer"===e)){const e=o.includes("nonnegative")||o.includes("non-negative");return{fieldType:"integer",htmlInputType:"number",allowDecimals:!1,min:o.includes("positive")?1:e?0:void 0,step:1,placeholder:E.t("field.enterWholeNumber")}}return i.some(e=>e.includes("decimal")||"decimal"===e)?o.includes("monetary")||o.includes("currency")?o.includes("nodecimals")||o.includes("no-decimals")||o.includes("nodecimals20")?{fieldType:"number",htmlInputType:"number",allowDecimals:!1,step:1,placeholder:E.t("field.enterAmountNoDecimals")}:{fieldType:"currency",htmlInputType:"number",allowDecimals:!0,step:.01,placeholder:E.t("field.enterCurrency")}:{fieldType:"decimal",htmlInputType:"number",allowDecimals:!0,step:"any",placeholder:E.t("field.enterDecimalValue")}:e.some(e=>"xbrli:stringItemType"===e)||i.some(e=>"string"===e||e.includes("stringitem"))?{fieldType:"text",htmlInputType:"text",placeholder:E.t("field.enterText")}:{fieldType:"text",htmlInputType:"text",placeholder:E.t("field.enterValue")}}var J=Object.defineProperty,V=Object.getOwnPropertyDescriptor,q=(e,t,i,o)=>{for(var r,n=o>1?void 0:o?V(t,i):t,s=e.length-1;s>=0;s--)(r=e[s])&&(n=(o?r(t,i,n):r(n))||n);return o&&n&&J(t,i,n),n};exports.JupiterFormField=class extends e.LitElement{constructor(){super(...arguments),this.defaultUnits=[],this.value=null,this.disabled=!1,this.locale="en-US",this.hideLabel=!1,this.mode="inputForm",this._errors=[],this._xbrlErrors=[],this._touched=!1,this._showPeriodPopup=!1,this._availableUnits=[]}willUpdate(e){var t;(e.has("value")||e.has("field"))&&this._validateField(),e.has("unit")&&this.unit&&(console.log(`🏷️ [FormField willUpdate] Unit property changed to: ${this.unit}, conceptId: ${this.conceptId}, columnId: ${this.columnId}`),this.dispatchEvent(new CustomEvent("unit-change",{detail:{fieldId:null==(t=this.field)?void 0:t.id,conceptId:this.conceptId,columnId:this.columnId,unit:this.unit},bubbles:!0,composed:!0}))),e.has("field")&&this.field&&(this.conceptId.includes("DescriptionLocationNL")||this.columnId.startsWith("col-"))&&console.log(`📅 [FormField willUpdate] Concept ${this.conceptId}, Column ${this.columnId}: field.periodType=${this.field.periodType}, field.periodStartDate=${this.field.periodStartDate}, field.periodEndDate=${this.field.periodEndDate}, field.periodInstantDate=${this.field.periodInstantDate}`)}_validateField(){var e;(null==(e=this.field)?void 0:e.validation)&&(this._errors=C.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._validateXBRLDatatype(),this._validateUnitSelection(),console.log(`🟦 [FormField] Blur event - fieldId: ${this.field.id}, conceptId: ${this.conceptId}, columnId: ${this.columnId}`),console.log("🟦 [FormField] Current _xbrlErrors:",this._xbrlErrors),console.log("🟦 [FormField] Current value:",this.value),this.dispatchEvent(new CustomEvent("field-blur",{detail:{fieldId:this.field.id,conceptId:this.conceptId,columnId:this.columnId,xbrlValidationErrors:this._xbrlErrors},bubbles:!0,composed:!0})),console.log(`🟦 [FormField] Dispatched field-blur event with ${this._xbrlErrors.length} errors`)}_isMonetaryType(){if(!this.conceptType||!this.datatypes)return!1;if(this.conceptType.includes("monetary")||this.conceptType.includes("Monetary"))return!0;return O(this.conceptType,this.datatypes).some(e=>e.includes("monetary")||e.includes("Monetary"))}_handleKeyDown(e){const t=e.target;if("number"!==t.type)return;["Backspace","Delete","Tab","Escape","Enter","ArrowLeft","ArrowRight","ArrowUp","ArrowDown","Home","End"].includes(e.key)||e.ctrlKey||e.metaKey||("-"!==e.key||0!==t.selectionStart||t.value.includes("-"))&&("."!==e.key||t.value.includes("."))&&(e.key>="0"&&e.key<="9"||e.preventDefault())}_validateXBRLDatatype(){if(this._xbrlErrors=[],null===this.value||void 0===this.value||""===this.value)return;if(!this.conceptType||!this.datatypes||0===this.datatypes.length)return;const e=A.validateConceptValue(this.conceptType,this.value,this.datatypes);e.valid?console.log(`✅ [FormField] XBRL Validation passed for ${this.conceptId}`):(this._xbrlErrors=e.errors,console.log(`❌ [FormField] XBRL Validation failed for ${this.conceptId}:`,{conceptType:this.conceptType,value:this.value,errors:this._xbrlErrors}))}_validateUnitSelection(){if(null===this.value||void 0===this.value||""===this.value)return;const e=this._collectUnitsForConceptType();if(0===e.length)return;if(this.unit)return;const t=e.find(e=>!0===e.isDefault)??(1===e.length?e[0]:null);if(t)return this.unit=t.id,this.dispatchEvent(new CustomEvent("unit-change",{detail:{fieldId:this.field.id,conceptId:this.conceptId,columnId:this.columnId,unit:this.unit},bubbles:!0,composed:!0})),void console.log(`🎯 [FormField] Auto-selected default unit on blur: ${this.unit} for ${this.conceptId}`);this._xbrlErrors=[...this._xbrlErrors,{type:"unit",message:E.t("validation.unitRequired"),expectedValue:e.map(e=>e.label).join(", "),actualValue:""}],console.log(`❌ [FormField] Unit validation failed for ${this.conceptId}: unit is required but not selected`)}_handlePeriodIconClick(){if(this._availableUnits=this._collectUnitsForConceptType(),console.log(`📊 [FormField] Collected ${this._availableUnits.length} units for concept ${this.conceptId}:`,this._availableUnits),console.log(`📊 [FormField] Current unit value: ${this.unit}`),console.log(`📊 [FormField] ConceptId: ${this.conceptId}, ColumnId: ${this.columnId}`),!this.unit&&this._availableUnits.length>0){let e=null;const t=this._availableUnits.find(e=>!0===e.isDefault);t?(e=t.id,console.log(`🎯 [FormField] Auto-selecting default unit: ${t.id} (${t.label})`)):1===this._availableUnits.length&&(e=this._availableUnits[0].id,console.log(`🎯 [FormField] Auto-selecting single available unit: ${e}`)),e&&(this.unit=e,this.dispatchEvent(new CustomEvent("unit-change",{detail:{fieldId:this.field.id,conceptId:this.conceptId,columnId:this.columnId,unit:this.unit},bubbles:!0,composed:!0})))}else this.unit&&(console.log(`📊 [FormField] Unit already set, dispatching unit-change to ensure parent stores it: ${this.unit}`),this.dispatchEvent(new CustomEvent("unit-change",{detail:{fieldId:this.field.id,conceptId:this.conceptId,columnId:this.columnId,unit:this.unit},bubbles:!0,composed:!0})));this._showPeriodPopup=!0}_collectUnitsForConceptType(){if(!this.conceptType||!this.datatypes)return[];const e=O(this.conceptType,this.datatypes);console.log(`🔍 [Unit Resolution] Concept: ${this.conceptId}, Type: ${this.conceptType}, BaseType Chain:`,e);for(const t of e){const e=this.datatypes.find(e=>e.type===t);if(e&&e.units&&Array.isArray(e.units)&&e.units.length>0)return console.log(`✅ [Unit Resolution] Found ${e.units.length} units in type: ${t}`),e.units}return console.log(`ℹ️ [Unit Resolution] No units found for concept ${this.conceptId}`),[]}_closePeriodPopup(){this._showPeriodPopup=!1}_handleUnitChange(e){const t=e.target.value;console.log(`🏷️ [FormField] Unit change detected: value=${t}, conceptId=${this.conceptId}, columnId=${this.columnId}`),console.log(`🏷️ [FormField] Previous unit value: ${this.unit}`),this.unit=t,console.log(`🏷️ [FormField] Updated unit value to: ${this.unit}`);const i={fieldId:this.field.id,conceptId:this.conceptId,columnId:this.columnId,unit:this.unit};console.log("🏷️ [FormField] Dispatching unit-change event with detail:",i),this.dispatchEvent(new CustomEvent("unit-change",{detail:i,bubbles:!0,composed:!0})),console.log("🏷️ [FormField] unit-change event dispatched")}_handlePopupOverlayClick(e){e.target===e.currentTarget&&this._closePeriodPopup()}_handlePeriodChange(e,t){const i=e.target.value;console.log(`📅 [FormField] Period change detected: type=${t}, value=${i}, conceptId=${this.conceptId}, columnId=${this.columnId}`),"instant"===t?this.periodInstantDate=i:"start"===t?this.periodStartDate=i:"end"===t&&(this.periodEndDate=i),console.log(`📅 [FormField] Updated local period values: startDate=${this.periodStartDate}, endDate=${this.periodEndDate}, instantDate=${this.periodInstantDate}`),this.dispatchEvent(new CustomEvent("period-change",{detail:{fieldId:this.field.id,conceptId:this.conceptId,columnId:this.columnId,periodType:this.field.periodType,periodStartDate:this.periodStartDate,periodEndDate:this.periodEndDate,periodInstantDate:this.periodInstantDate,unit:this.unit},bubbles:!0,composed:!0})),console.log("🚀 [FormField] Dispatched period-change event with detail:",{conceptId:this.conceptId,columnId:this.columnId,periodType:this.field.periodType})}_renderReadonlyValue(t){const i=M(this.conceptType,this.datatypes),o=i.fieldType||this.field.type||"text";let r;if("boolean"===o||L(o))r=t?E.t("form.yes"):E.t("form.no");else if("select"===o||"select"===this.field.type){const e=(i.enumerations||this.field.options||[]).find(e=>e.value===t);r=e?e.label||e.value:t??""}else r=null!=t?String(t):"";const n=""===r||null==r,s=this._isMonetaryType();return e.html`<span class="readonly-value ${n?"empty":""} ${s?"monetary":""}">${n?"—":r}</span>`}_renderInput(t=this.value,i=this.disabled){if("readonly"===this.mode)return this._renderReadonlyValue(t);const o=this._errors.some(e=>"error"===e.severity),r=this._errors.some(e=>"warning"===e.severity),n=`field-input ${o?"error":r?"warning":""} ${this._isMonetaryType()?"monetary":""}`,s=`${this.conceptId}__${this.columnId}`,l=`data[${this.conceptId}][${this.columnId}]`,a=M(this.conceptType,this.datatypes);this.conceptType;const d=a.fieldType||this.field.type||"text";if("textarea"===d||j(d))return e.html`
|
|
22
|
+
*/function w(e){return S({...e,state:!0,attribute:!1})}class C{static validateField(e,t,i,o,r,n=[]){const s=[];for(const l of n){const n=this.validateRule(e,t,i,o,r,l);n&&s.push(n)}return s}static validateRule(e,t,i,o,r,n){const s=null==o||""===o;switch(n.type){case"required":if(s)return this.createError(e,t,i,n);break;case"min":if(!s&&"number"==typeof o&&o<n.value)return this.createError(e,t,i,n);break;case"max":if(!s&&"number"==typeof o&&o>n.value)return this.createError(e,t,i,n);break;case"minLength":if(!s&&"string"==typeof o&&o.length<n.value)return this.createError(e,t,i,n);break;case"maxLength":if(!s&&"string"==typeof o&&o.length>n.value)return this.createError(e,t,i,n);break;case"pattern":if(!s&&"string"==typeof o){if(!new RegExp(n.value).test(o))return this.createError(e,t,i,n)}break;case"email":if(!s&&"string"==typeof o){if(!/^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(o))return this.createError(e,t,i,n)}break;case"url":if(!s&&"string"==typeof o)try{new URL(o)}catch{return this.createError(e,t,i,n)}break;case"custom":break;default:console.warn(`Unknown validation rule type: ${n.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 formatPeriodDisplay(e,t){if(!e||!t)return`${e} / ${t}`;const i=e.substring(0,4);return i===t.substring(0,4)?i:`${e} / ${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,o="en",r){var n,s;if(!e.presentation||0===e.presentation.length)throw new Error("XBRL presentation data is required");const l=e.presentation[0],a=null==(n=e.hypercubes)?void 0:n[0],d=Array.isArray(e.datatypes)?e.datatypes:(null==(s=e.datatypes)?void 0:s.concepts)||[],c=[];return l.roles.forEach(e=>{const n=this.buildSectionFromRole(e,t,i,a,o,r);d&&d.length>0?(n.datatypes=d,console.log(`✅ [buildFormSchema] Attached ${d.length} datatypes to section ${n.id}`)):console.warn(`⚠️ [buildFormSchema] No datatypes available for section ${n.id}`),this.assignFieldColumnIds(n),c.push(n)}),{formId:`xbrl-form-${Date.now()}`,title:`XBRL Form - ${this.extractEntityName(l.entrypoint)}`,description:"Dynamic form generated from XBRL taxonomy data",version:"1.0.0",sections:c}}static buildSectionFromRole(e,t,i,o,r="en",n){var s,l;const a=this.extractRoleTitle(e.role||e.id||"Unknown Role"),d=this.getAllNonAbstractConcepts(e),c=new Set(d.filter(e=>e.periodType).map(e=>e.periodType));let p=null==o?void 0:o.roles.find(t=>t.roleId===e.id);const u=null==n?void 0:n[e.id];p&&(null==u?void 0:u.dimensionSelections)&&u.dimensionSelections.length>0&&(console.log(`🔍 Filtering dimensions for role ${e.id} based on user selections`),p=this.filterHypercubeDimensionsBySelection(p,u.dimensionSelections));const h=this.generateDefaultColumnsForRole(e,t||"2025-01-01",i||"2025-12-31",p,d,c,u),m={periodTypes:c,availableColumnIds:h.map(e=>e.id),availableColumns:h},b=[];return(null==(s=e.presentationLinkbase)?void 0:s.concepts)&&e.presentationLinkbase.concepts.forEach(o=>{const n=this.buildConceptTree(o,0,t,i,m,e.id,r);n&&b.push(n)}),p&&(null==(l=p.items)?void 0:l.length)||!o||b.forEach(t=>this.applyCrossRoleDimensions(t,e.id,o,r)),{id:e.id,title:a,description:e.description||`Section for ${a}`,concepts:b,columns:h,expanded:!1,metadata:{roleURI:e.roleURI,originalRole:e.role},showPeriodControl:c.size>1,showPreviousYear:!0===e.showPreviousYear,instant:!0===e.instant,duration:!0===e.duration}}static buildConceptTree(e,t,i,o,r,n,s="en"){const l=this.getPreferredLabel(e.labels,s),a=[];if(!e.elementAbstract){let t=[];t=(null==r?void 0:r.availableColumnIds)&&r.availableColumnIds.length>0?r.availableColumnIds:["duration"],t.forEach(t=>{var n;const s=null==(n=null==r?void 0:r.availableColumns)?void 0:n.find(e=>e.id===t),l=(null==s?void 0:s.periodStartDate)||i,d=(null==s?void 0:s.periodEndDate)||o,c=this.createFieldFromConcept(e,l,d,t);c&&a.push(c)})}const d=[];e.children&&e.children.length>0&&e.children.forEach(e=>{const l=this.buildConceptTree(e,t+1,i,o,r,n,s);l&&d.push(l)});return a.length>0||d.length>0?{id:this.createUniqueConceptId(e,n),originalConceptId:e.id,name:e.conceptName,label:l,description:`${e.conceptName} (${e.type})`,type:e.type,level:t,children:d,fields:a,facts:e.facts||[],collapsed:t>0,abstract:e.elementAbstract,periodType:e.periodType,balance:e.balance}:null}static createFieldFromConcept(e,t,i,o){const r=this.mapXBRLTypeToFieldType(e.type),n=this.getPreferredLabel(e.labels);let s;s=o||"duration";const l={id:`${e.id}_${s}_field`,conceptId:e.id,columnId:s,type:r,label:n,placeholder:`Enter ${n.toLowerCase()}`,required:!1,disabled:e.elementAbstract,defaultValue:null,periodType:"instant"===e.periodType||"duration"===e.periodType?e.periodType:void 0,periodStartDate:t||"2025-01-01",periodEndDate:i||"2025-12-31",periodInstantDate:"instant"===e.periodType?i||t||"2025-01-01":void 0};return"nl-cd_DescriptionLocationNL__a64trl"===e.id&&console.log(`🏗️ [Field Creation] Concept: ${e.id}, periodType from concept: ${e.periodType}, Field periodType: ${l.periodType}, ColumnId: ${s}`),l}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,t="en"){if(!e||0===e.length)return"Unnamed Concept";const i=e.filter(e=>e.lang===t),o=i.length>0?i:e,r=o.find(e=>e.preferredLabel);if(r)return r.label;const n=o.find(e=>"http://www.xbrl.org/2003/role/label"===e.role);if(n)return n.label;const s=o.find(e=>"http://www.xbrl.org/2003/role/terseLabel"===e.role);return s?s.label:o.length>0?o[0].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 filterHypercubeDimensionsBySelection(e,t){const i=JSON.parse(JSON.stringify(e));return i.items&&0!==i.items.length?(i.items.forEach(e=>{e.dimensions&&(e.dimensions=e.dimensions.map(e=>{var i,o;const r=t.find(t=>t.dimensionId===e.id);if(!r||!r.selectedMemberIds||0===r.selectedMemberIds.length)return e;const n={...e};return n.members=this.filterMembersBySelection(e.members,r.selectedMemberIds),console.log(` ✅ Filtered dimension ${e.id}: ${(null==(i=e.members)?void 0:i.length)||0} → ${(null==(o=n.members)?void 0:o.length)||0} members`),n}))}),i):i}static filterMembersBySelection(e,t){if(!e||!Array.isArray(e))return[];const i=[];return e.forEach(e=>{if(t.includes(e.id)&&i.push({...e,children:[]}),e.children&&e.children.length>0){const o=this.filterMembersBySelection(e.children,t);i.push(...o)}}),i}static findCrossRoleDimensions(e,t,i,o="en"){var r,n;const s=[];for(const d of i.roles)if(d.roleId!==t)for(const t of d.items)if((null==(r=t.conceptIds)?void 0:r.includes(e))&&(null==(n=t.dimensions)?void 0:n.some(e=>e.typedMember))){s.push(d);break}if(1!==s.length)return null;const l=s[0].items.find(t=>{var i;return null==(i=t.conceptIds)?void 0:i.includes(e)});if(!l)return null;const a=[];for(const d of l.dimensions){if(!d.typedMember)continue;const e=d.labels.find(e=>e.lang===o)||d.labels.find(e=>"en"===e.lang)||d.labels[0],t=(null==e?void 0:e.label)||d.id;a.push({axisId:d.id,axisLabel:t,typedMemberId:d.typedMember.id,memberLabel:t})}return a.length>0?a:null}static applyCrossRoleDimensions(e,t,i,o){var r;if(!e.abstract&&e.fields&&e.fields.length>0){const r=this.findCrossRoleDimensions(e.originalConceptId,t,i,o);r&&e.fields.forEach(e=>{e.crossRoleTypedMembers=r})}null==(r=e.children)||r.forEach(e=>this.applyCrossRoleDimensions(e,t,i,o))}static generateDefaultColumnsForRole(e,t,i,o,r,n,s){var l,a;const d=r||this.getAllNonAbstractConcepts(e),c=n||new Set(d.filter(e=>e.periodType).map(e=>e.periodType));if(0===d.length)return[{id:"default",title:"Value",description:"Default value column",type:"base",order:0,removable:!1}];let p=[];if(1===(null==(l=null==o?void 0:o.items)?void 0:l.length)){const e=o.items[0];1===e.dimensions.length?p=this.generateSingleDimensionColumns(e.dimensions[0],t,i,c):e.dimensions.length>1&&(p=this.generateMultiDimensionColumns(e.dimensions,t,i,c)),s&&(p=this.filterColumnsByPeriodPreferences(p,s))}else(null==(a=null==o?void 0:o.items)?void 0:a.length)&&o.items.length;const u=[];p.length>0?u.push(...p):0===c.size?u.push({id:"default",title:this.formatPeriodDisplay(t,i),description:"",type:"base",order:0,removable:!1,periodStartDate:t,periodEndDate:i}):u.push({id:"duration",title:this.formatPeriodDisplay(t,i),description:"",type:"base",order:0,removable:!1,periodStartDate:t,periodEndDate:i});let h=u;if(s&&(h=this.filterColumnsByPeriodPreferences(u,s)),null==s?void 0:s.showPreviousYear){const e=this.generatePreviousYearColumns(h,t,i);h=[...h,...e]}return h}static getPreviousYearDate(e){try{const t=new Date(e);return t.setFullYear(t.getFullYear()-1),t.toISOString().split("T")[0]}catch(t){return console.error(`Error calculating previous year for date ${e}:`,t),e}}static generatePreviousYearColumns(e,t,i){const o=[],r=this.getPreviousYearDate(t),n=this.getPreviousYearDate(i);return e.forEach((e,t)=>{let i=e.title,s="",l="";e.dimensionData?(i=e.title,s=this.formatPeriodDisplay(r,n),l=`${e.id}_prev`):(i=this.formatPeriodDisplay(r,n),s="",l=`duration_prev_${t}`),o.push({...e,id:l,title:i,description:s,order:e.order+100,removable:!1,periodStartDate:r,periodEndDate:n,dimensionData:e.dimensionData?{...e.dimensionData,dimensionId:`${e.dimensionData.dimensionId}_prev`}:void 0})}),o}static filterColumnsByPeriodPreferences(e,t){return e.filter(e=>{var i,o,r,n;const s=e.id.includes("duration")||(null==(o=null==(i=e.dimensionData)?void 0:i.dimensionId)?void 0:o.includes("duration")),l=e.id.includes("instant")||(null==(n=null==(r=e.dimensionData)?void 0:r.dimensionId)?void 0:n.includes("instant"));return!s&&!l||!(s&&!t.showDuration)&&!(l&&!t.showInstant)})}static generateSingleDimensionColumns(e,t,i,o){var r,n,s;if(e.typedMember&&(!e.members||0===e.members.length)){const n=(null==(r=e.labels.find(e=>"http://www.xbrl.org/2003/role/label"===e.role))?void 0:r.label)||e.conceptName,s={axisId:e.id,axisLabel:n,typedMemberId:e.typedMember.id,dimensionKey:`${n} | [Typed Input]`,dimensionIdKey:`${e.id}|[typed]`},l=[];return 0===o.size?l.push({id:"typed-default",title:n,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,periodStartDate:t,periodEndDate:i}):1===o.size&&o.has("instant")?l.push({id:"typed-instant",title:`${n} `,description:i,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,periodStartDate:i,periodEndDate:i}):(1===o.size&&o.has("duration"),l.push({id:"typed-duration",title:`${n} `,description:this.formatPeriodDisplay(t,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,periodStartDate:t,periodEndDate:i})),l}if(!e.members||!Array.isArray(e.members))return[];if(0===e.members.length)return[];const l=(null==(n=e.labels.find(e=>"http://www.xbrl.org/2003/role/label"===e.role))?void 0:n.label)||e.conceptName,a=e.members[0],d=(null==(s=a.labels.find(e=>"http://www.xbrl.org/2003/role/label"===e.role))?void 0:s.label)||a.conceptName,c={axisId:e.id,axisLabel:l,memberId:a.id,memberLabel:d,dimensionKey:`${l} | ${d}`,dimensionIdKey:`${e.id} | ${a.id}`},p=[];return 0===o.size?p.push({id:"default",title:c.memberLabel,description:"Default value column",type:"dimension",dimensionData:{dimensionId:"default",axisId:c.axisId,memberId:c.memberId,memberValue:c.memberLabel,memberLabel:c.memberLabel,axis:c.axisLabel,axisLabel:c.axisLabel,memberKey:c.dimensionKey,dimensionIdKey:c.dimensionIdKey},order:0,removable:!1,periodStartDate:t,periodEndDate:i}):1===o.size&&o.has("instant")?p.push({id:"instant",title:`${c.memberLabel}`,description:i,type:"dimension",dimensionData:{dimensionId:"instant",axisId:c.axisId,memberId:c.memberId,memberValue:c.memberLabel,memberLabel:c.memberLabel,axis:c.axisLabel,axisLabel:c.axisLabel,memberKey:c.dimensionKey,dimensionIdKey:c.dimensionIdKey},order:0,removable:!1,periodStartDate:i,periodEndDate:i}):1===o.size&&o.has("duration")?p.push({id:"duration",title:`${c.memberLabel}`,description:`${t} / ${i}`,type:"dimension",dimensionData:{dimensionId:"duration",axisId:c.axisId,memberId:c.memberId,memberValue:c.memberLabel,memberLabel:c.memberLabel,axis:c.axisLabel,axisLabel:c.axisLabel,memberKey:c.dimensionKey,dimensionIdKey:c.dimensionIdKey},order:0,removable:!1,periodStartDate:t,periodEndDate:i}):p.push({id:"duration",title:`${c.memberLabel}`,description:this.formatPeriodDisplay(t,i),type:"dimension",dimensionData:{dimensionId:"duration",axisId:c.axisId,memberId:c.memberId,memberValue:c.memberLabel,memberLabel:c.memberLabel,axis:c.axisLabel,axisLabel:c.axisLabel,memberKey:c.dimensionKey,dimensionIdKey:c.dimensionIdKey},order:0,removable:!1,periodStartDate:t,periodEndDate:i}),p}static generateMultiDimensionColumns(e,t,i,o){e.some(e=>e.typedMember);const r=e.filter(e=>!!e.typedMember||!!(e.members&&Array.isArray(e.members)&&e.members.length>0));if(0===r.length)return[];const n=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}`}]};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}})}}),s=this.generateDimensionCombinations(n),l=[];return s.forEach((e,o)=>{const r=e.map(e=>e.memberLabel).join(" | "),n=e.filter(e=>e.isTyped),s=e.filter(e=>!e.isTyped),a={dimensionId:`multi_${o}`,memberValue:r,memberLabel:r,combinations:s.map(e=>({axisId:e.axisId,axisLabel:e.axisLabel,memberId:e.memberId,memberLabel:e.memberLabel})),typedMembers:n.map(e=>({axisId:e.axisId,axisLabel:e.axisLabel,typedMemberId:e.typedMemberId,memberLabel:e.memberLabel})),hasTypedMembers:n.length>0,memberKey:r,dimensionIdKey:[...s.map(e=>`${e.axisId}|${e.memberId}`),...n.map(e=>`${e.axisId}|[typed]`)].join("::")};l.push({id:`duration_${o}`,title:`${r}`,description:this.formatPeriodDisplay(t,i),type:"dimension",dimensionData:{...a,dimensionId:`duration_${o}`},order:o,removable:!1,periodStartDate:t,periodEndDate:i})}),l}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){if(!e)return"Unnamed Section";const t=e.match(/^\[[\d]+\]\s*(.+)$/);if(t)return t[1].trim();if(e.match(/^[a-z]+:[^:]*$/i)||e.match(/^urn:[^:]+:[^:]+/i)){const t=e.split(/[:\-]/);return t[t.length-1].replace(/[_\-]/g," ").replace(/\b\w/g,e=>e.toUpperCase())}return e.trim()||"Unnamed Section"}static extractRoleOrder(e){const t=e.match(/^\[([\d]+)\]/);return t?parseInt(t[1],10):0}static buildColumnsFromHypercubes(){return[{id:"default",label:"Values",type:"data"}]}}const R={en:{form:{loading:"Loading form...",submit:"Validate",save:"Save",saveDraft:"Save Draft",savingDraft:"Saving draft",errors:"Errors",modified:"Modified",valid:"Valid",yes:"Yes",no:"No",noRoleSelected:"No Role Selected",pleaseSelectRole:"Please select a role from the list on the left.",expandPanel:"Expand side panel",collapsePanel:"Collapse side panel",validate:"Validate",preview:"Preview",cancelValidation:"Cancel Validation",lastValidationResults:"Last Validation Results",validationInProgress:"Validation In Progress"},filter:{selectRoles:"Select Roles",filterRoles:"Filter Roles",title:"Filter Roles",description:"Select the roles you want to display in the form. You can search and choose specific roles to focus on or manage all available roles.",searchPlaceholder:"Search..",clearSearch:"Clear search",showingResults:"Showing",of:"of",roles:"roles",matching:"matching",selectAll:"Select All",selectNone:"Select None",selectFiltered:"Select Filtered",deselectFiltered:"Deselect Filtered",deselectAll:"Deselect All",reset:"Reset",noRolesFound:"No roles found matching",tryDifferentSearch:"Try a different search term or clear the search.",noRolesAvailable:"No roles available.",cancel:"Cancel",applyFilter:"Apply Filter",showPeriodColumn:"Show Period Column:",additionalOptions:"Additional Options:",showPreviousYear:"Show previous year",duration:"Duration",instant:"Instant",uri:"URI",dimensionMemberSelection:"Dimension Member Selection",selectAllMembers:"Select All",clearMembers:"Clear",availableRoles:"Available Roles",chosenRoles:"Chosen Roles",roleCount:"role(s)",rolesSelected:"role(s) selected",addSelectedRole:"Add selected role",addAllRoles:"Add all roles",removeSelectedRole:"Remove selected role",removeAllRoles:"Remove all roles"},column:{addColumn:"Add Column",columnOptions:"Column Options",columnType:"Column Type",instantSingleDate:"Instant (single date)",durationDates:"Duration (start and end dates)",instantDate:"Instant Date",startPeriodDate:"Start Period Date",endPeriodDate:"End Period Date",availableDimensions:"Available Dimensions",dimensionsDescription:"Select dimensions to include in the column. Domain members can be selected here, while typed dimension values will be entered directly in the column header.",enterValue:"Enter value for",enterValuePlaceholder:"Enter value...",selectMember:"Select member:",noMembersAvailable:"No members available for this dimension",cancel:"Cancel",removeColumn:"Remove column",required:"required"},section:{enterPlaceholder:"Enter"},field:{selectOption:"Select an option...",select:"Select...",enterDetailedExplanation:"Enter detailed explanation...",enterAmountNoDecimals:"Enter amount (no decimals)",enterCurrency:"0.00",enterText:"Enter text",enterWholeNumber:"Enter whole number",enterPositiveNumber:"Enter positive number",enterDecimalValue:"Enter decimal value",enterNumberOfShares:"Enter number of shares",yearFormat:"YYYY",enterPercentage:"Enter percentage",emailPlaceholder:"email@example.com",urlPlaceholder:"https://example.com",phonePlaceholder:"+1 (555) 000-0000",enterValue:"Enter value",enterDetailedInformation:"Enter detailed information..."},admin:{title:"Configure Roles",description:"Select which roles should display the 'Show Previous Year' checkbox and configure period type columns."},validation:{summary:"Please fix the following errors before submitting:",errorsFound:"errors found",unitRequired:"Unit is required. Please select a unit via the period icon."},xbrlValidation:{patternMismatch:"Value does not match required pattern: {{pattern}}",invalidPattern:"Invalid pattern configuration: {{pattern}}",exactLength:"Value must be exactly {{required}} characters (current: {{current}})",minLength:"Value must be at least {{required}} characters (current: {{current}})",maxLength:"Value must not exceed {{required}} characters (current: {{current}})",totalDigits:"Value must not exceed {{required}} total digits (current: {{current}})",ruleSummaryPattern:"Must match pattern: {{pattern}}",ruleSummaryExactLength:"Must be exactly {{required}} characters",ruleSummaryMinLength:"Minimum {{required}} characters",ruleSummaryMaxLength:"Maximum {{required}} characters",ruleSummaryTotalDigits:"Maximum {{required}} total digits"},error:{popup:{title:"Validation Errors",message:"Please fix the following validation errors before saving:",field:"Field:",value:"Value:",errors:"Errors:",clickToFocus:"Click to focus this field",ok:"OK"}}},nl:{form:{loading:"Formulier laden...",submit:"Valideren",save:"Opslaan",saveDraft:"Concept opslaan",savingDraft:"Concept opslaan...",errors:"Fouten",modified:"Gewijzigd",valid:"Geldig",yes:"Ja",no:"Nee",noRoleSelected:"Geen rol geselecteerd",pleaseSelectRole:"Selecteer een rol uit de lijst aan de linkerkant.",expandPanel:"Zijpaneel uitvouwen",collapsePanel:"Zijpaneel inklappen",validate:"Valideren",preview:"Voorbeeld",cancelValidation:"Validatie annuleren",lastValidationResults:"Laatste validatieresultaten",validationInProgress:"Validatie bezig"},filter:{selectRoles:"Rollen selecteren",filterRoles:"Rollen filteren",title:"Rollen filteren",description:"Selecteer de rollen die u in het formulier wilt weergeven. U kunt zoeken en specifieke rollen kiezen om op te focussen of alle beschikbare rollen beheren.",searchPlaceholder:"Zoek rollen op naam, ID of URI...",clearSearch:"Zoekopdracht wissen",showingResults:"Weergeven",of:"van",roles:"rollen",matching:"overeenkomend met",selectAll:"Alles selecteren",selectNone:"Niets selecteren",selectFiltered:"Gefilterd selecteren",deselectFiltered:"Gefilterd deselecteren",deselectAll:"Alles deselecteren",reset:"Resetten",noRolesFound:"Geen rollen gevonden die overeenkomen met",tryDifferentSearch:"Probeer een andere zoekterm of wis de zoekopdracht.",noRolesAvailable:"Geen rollen beschikbaar.",cancel:"Annuleren",applyFilter:"Filter toepassen",showPeriodColumn:"Periodekolom weergeven:",additionalOptions:"Aanvullende opties:",showPreviousYear:"Vorig jaar weergeven",duration:"Duur",instant:"Moment",uri:"URI",dimensionMemberSelection:"Dimensieleden selectie",selectAllMembers:"Alles selecteren",clearMembers:"Wissen",availableRoles:"Beschikbare rollen",chosenRoles:"Gekozen rollen",roleCount:"rol(len)",rolesSelected:"rol(len) geselecteerd",addSelectedRole:"Geselecteerde rol toevoegen",addAllRoles:"Alle rollen toevoegen",removeSelectedRole:"Geselecteerde rol verwijderen",removeAllRoles:"Alle rollen verwijderen"},column:{addColumn:"Kolom toevoegen",columnOptions:"Kolomopties",columnType:"Kolomtype",instantSingleDate:"Moment (enkele datum)",durationDates:"Duur (begin- en einddatum)",instantDate:"Momentdatum",startPeriodDate:"Startdatum periode",endPeriodDate:"Einddatum periode",availableDimensions:"Beschikbare dimensies",dimensionsDescription:"Selecteer dimensies om in de kolom op te nemen. Domeinleden kunnen hier worden geselecteerd, terwijl getypte dimensiewaarden direct in de kolomkop worden ingevoerd.",enterValue:"Voer waarde in voor",enterValuePlaceholder:"Voer waarde in...",selectMember:"Selecteer lid:",noMembersAvailable:"Geen leden beschikbaar voor deze dimensie",cancel:"Annuleren",removeColumn:"Kolom verwijderen",required:"verplicht"},section:{enterPlaceholder:"Invoeren"},field:{selectOption:"Selecteer een optie...",select:"Selecteer...",enterDetailedExplanation:"Voer gedetailleerde uitleg in...",enterAmountNoDecimals:"Voer bedrag in (geen decimalen)",enterCurrency:"0,00",enterText:"Voer tekst in",enterWholeNumber:"Voer geheel getal in",enterPositiveNumber:"Voer positief getal in",enterDecimalValue:"Voer decimale waarde in",enterNumberOfShares:"Voer aantal aandelen in",yearFormat:"JJJJ",enterPercentage:"Voer percentage in",emailPlaceholder:"email@voorbeeld.nl",urlPlaceholder:"https://voorbeeld.nl",phonePlaceholder:"+31 (0)20 123 4567",enterValue:"Voer waarde in",enterDetailedInformation:"Voer gedetailleerde informatie in..."},admin:{title:"Rollen configureren",description:"Selecteer welke rollen het selectievakje 'Vorig jaar weergeven' moeten weergeven en configureer periodetype kolommen."},validation:{summary:"Corrigeer de volgende fouten voordat u indient:",errorsFound:"fouten gevonden",unitRequired:"Eenheid is verplicht. Selecteer een eenheid via het periodeicoon."},xbrlValidation:{patternMismatch:"Waarde voldoet niet aan het vereiste patroon: {{pattern}}",invalidPattern:"Ongeldige patternconfiguratie: {{pattern}}",exactLength:"Waarde moet exact {{required}} tekens bevatten (huidig: {{current}})",minLength:"Waarde moet minimaal {{required}} tekens bevatten (huidig: {{current}})",maxLength:"Waarde mag niet meer dan {{required}} tekens bevatten (huidig: {{current}})",totalDigits:"Waarde mag niet meer dan {{required}} cijfers bevatten (huidig: {{current}})",ruleSummaryPattern:"Moet overeenkomen met patroon: {{pattern}}",ruleSummaryExactLength:"Moet exact {{required}} tekens bevatten",ruleSummaryMinLength:"Minimaal {{required}} tekens",ruleSummaryMaxLength:"Maximaal {{required}} tekens",ruleSummaryTotalDigits:"Maximaal {{required}} cijfers"},error:{popup:{title:"Validatiefouten",message:"Corrigeer de volgende validatiefouten voordat u opslaat:",field:"Veld:",value:"Waarde:",errors:"Fouten:",clickToFocus:"Klik om dit veld te focussen",ok:"OK"}}}};class T{static setLanguage(e){R[e]?this.currentLanguage=e:(console.warn(`Language '${e}' not supported, falling back to 'en'`),this.currentLanguage="en")}static getLanguage(){return this.currentLanguage}static t(e,t){const i=e.split(".");let o=R[this.currentLanguage];for(const r of i){if(!o||"object"!=typeof o||!(r in o))return console.warn(`Translation key '${e}' not found for language '${this.currentLanguage}'`),e;o=o[r]}return t&&"string"==typeof o?this.interpolate(o,t):o}static interpolate(e,t){return e.replace(/\{\{(\w+)\}\}/g,(e,i)=>i in t?String(t[i]):e)}static has(e){const t=e.split(".");let i=R[this.currentLanguage];for(const o of t){if(!i||"object"!=typeof i||!(o in i))return!1;i=i[o]}return void 0!==i}static getAvailableLanguages(){return Object.keys(R)}}T.currentLanguage="en";class E{constructor(e=!1){this.DRAFT_DATA_KEY="jupiter-form-draft-data",this.DRAFT_METADATA_KEY="jupiter-form-draft-metadata",this.STORAGE_VERSION="1.0",this._storage=e?sessionStorage:localStorage,console.log(`💾 DraftStorageService initialized (using ${e?"sessionStorage":"localStorage"})`)}saveDraft(e,t){try{const i={formData:e,metadata:{...t,savedAt:(new Date).toISOString()},version:this.STORAGE_VERSION};return this._storage.setItem(this.DRAFT_DATA_KEY,JSON.stringify(i.formData)),this._storage.setItem(this.DRAFT_METADATA_KEY,JSON.stringify(i.metadata)),console.log("✅ Draft saved successfully",{entries:e.length,timestamp:i.metadata.savedAt,roles:t.selectedRoleIds.length,customColumns:t.customColumns.length}),!0}catch(i){return console.error("❌ Failed to save draft:",i),!1}}loadDraft(){try{const e=this._storage.getItem(this.DRAFT_DATA_KEY),t=this._storage.getItem(this.DRAFT_METADATA_KEY);if(!e||!t)return console.log("ℹ️ No saved draft found"),null;const i=JSON.parse(e),o=JSON.parse(t);return console.log("✅ Draft loaded successfully",{entries:i.length,savedAt:o.savedAt,roles:o.selectedRoleIds.length,customColumns:o.customColumns.length}),{formData:i,metadata:o,version:this.STORAGE_VERSION}}catch(e){return console.error("❌ Failed to load draft:",e),null}}hasDraft(){return null!==this._storage.getItem(this.DRAFT_DATA_KEY)&&null!==this._storage.getItem(this.DRAFT_METADATA_KEY)}getDraftMetadata(){try{const e=this._storage.getItem(this.DRAFT_METADATA_KEY);return e?JSON.parse(e):null}catch(e){return console.error("❌ Failed to load draft metadata:",e),null}}clearDraft(){try{return this._storage.removeItem(this.DRAFT_DATA_KEY),this._storage.removeItem(this.DRAFT_METADATA_KEY),console.log("🗑️ Draft cleared successfully"),!0}catch(e){return console.error("❌ Failed to clear draft:",e),!1}}getDraftAge(){const e=this.getDraftMetadata();if(!e)return null;const t=new Date(e.savedAt);return(new Date).getTime()-t.getTime()}isDraftStale(e){const t=this.getDraftAge();return null!==t&&t>e}extractCustomColumns(e){const t=[];return e.forEach(e=>{e.columns&&Array.isArray(e.columns)&&e.columns.forEach(i=>{t.push({sectionId:e.id,columnId:i.id,label:i.title,description:i.description,periodType:this._inferPeriodTypeFromColumn(i),date:i.periodStartDate,startDate:i.periodStartDate,endDate:i.periodEndDate,dimensionData:i.dimensionData})})}),t}_inferPeriodTypeFromColumn(e){return e.periodStartDate&&e.periodEndDate?"duration":"instant"}createMetadataSnapshot(e,t,i,o,r,n,s,l,a,d="en",c){return{periodStartDate:e,periodEndDate:t,language:i,reportingLanguage:d,selectedRoleIds:o,customColumns:this.extractCustomColumns(r),typedMemberData:n,periodPreferences:s,periodData:l,unitData:a,repeatCounts:c,schemaVersion:this.STORAGE_VERSION}}validateDraftCompatibility(e,t,i){const o=[];e.metadata.periodStartDate!==t&&o.push(`Draft period start (${e.metadata.periodStartDate}) differs from current (${t})`),e.metadata.periodEndDate!==i&&o.push(`Draft period end (${e.metadata.periodEndDate}) differs from current (${i})`);const r=this.getDraftAge();r&&r>6048e5&&o.push(`Draft is ${Math.floor(r/864e5)} days old`);return{compatible:0===o.length,warnings:o}}}class k{static findMatchingFact(e,t){if(!e||0===e.length)return null;const i=e.filter(e=>this.matchesPeriod(e,t));if(0===i.length)return null;const o=i.filter(e=>this.matchesDimensions(e,t));if(0===o.length)return null;if(o.length>1&&t.unit){const e=o.find(e=>this.matchesUnit(e,t));if(e)return e}return o[0]}static matchesPeriod(e,t){const i=this.parsePeriod(e.period);return"instant"===t.periodType&&t.periodInstantDate?i.isInstant&&i.instantDate===t.periodInstantDate:"duration"===t.periodType&&t.periodStartDate&&t.periodEndDate?!i.isInstant&&i.startDate===t.periodStartDate&&i.endDate===t.periodEndDate:t.periodInstantDate?i.isInstant&&i.instantDate===t.periodInstantDate:!t.periodStartDate||!t.periodEndDate||!i.isInstant&&i.startDate===t.periodStartDate&&i.endDate===t.periodEndDate}static matchesDimensions(e,t){const i=e.dimensions||[],o=this.extractDimensionsFromContext(t);if(0===o.length)return 0===i.length;if(0===i.length&&o.length>0)return!1;if(i.length!==o.length)return!1;return o.every(e=>i.some(t=>{if(!(this.normalizeAxisId(t.dimension)===this.normalizeAxisId(e.axisId)))return!1;if("explicit"===t.dimensionType&&e.memberId){return this.normalizeMemberId(t.member||"")===this.normalizeMemberId(e.memberId)}return!("typed"!==t.dimensionType||!e.isTyped)}))}static matchesUnit(e,t){if(!t.unit||!e.unitMeasure)return!0;return this.normalizeUnit(e.unitMeasure)===this.normalizeUnit(t.unit)}static parsePeriod(e){if(e.includes(" / ")){const[t,i]=e.split(" / ").map(e=>e.trim());return{isInstant:!1,startDate:t,endDate:i}}return{isInstant:!0,instantDate:e.trim()}}static extractDimensionsFromContext(e){if(!e.dimensionData)return[];const t=[];return e.dimensionData.combinations&&e.dimensionData.combinations.length>0&&e.dimensionData.combinations.forEach(e=>{t.push({axisId:e.axisId,memberId:e.memberId})}),e.dimensionData.typedMembers&&e.dimensionData.typedMembers.length>0&&e.dimensionData.typedMembers.forEach(e=>{t.push({axisId:e.axisId,memberId:"[typed]",isTyped:!0})}),t}static normalizeAxisId(e){if(!e)return"";if(e.includes(":")){const t=e.split(":");return t[1]||t[0]}if(e.includes("_")){e.split("_");const t=e.lastIndexOf("_");if(t>0)return e.substring(t+1)}return e}static normalizeMemberId(e){if(!e)return"";if(e.includes(":")){const t=e.split(":");return t[1]||t[0]}if(e.includes("_")){const t=e.lastIndexOf("_");if(t>0)return e.substring(t+1)}return e}static normalizeUnit(e){if(!e)return"";const t=e.split(":");return t.length>1?t[1]:t[0]}static extractTypedValues(e,t){const i={};if(!e||0===e.length)return i;return e.filter(e=>this.matchesPeriod(e,t)&&this.matchesDimensions(e,t)).forEach(e=>{e.dimensions&&e.dimensions.forEach(e=>{if("typed"===e.dimensionType&&e.typedMemberValue){const t=this.normalizeAxisId(e.dimension);i[t]=e.typedMemberValue}})}),i}static debugMatch(e,t){console.log("🔍 [FactMatcher] Debug Match"),console.log(" Context:",{conceptId:t.conceptId,columnId:t.columnId,period:"instant"===t.periodType?t.periodInstantDate:`${t.periodStartDate} / ${t.periodEndDate}`,dimensions:this.extractDimensionsFromContext(t)}),console.log(" Facts:",e.map(e=>{var t;return{value:e.value,period:e.period,dimensions:null==(t=e.dimensions)?void 0:t.map(e=>`${e.dimension}:${e.member}`)}}));const i=this.findMatchingFact(e,t);console.log(" Match Result:",i?i.value:"No match")}}class A{static validateConceptValue(e,t,i){const o=[];if(null==t||""===t)return{valid:!0,errors:[]};if(!e||!i||0===i.length)return{valid:!0,errors:[]};const r=this.findDatatype(e,i);if(!r||!r.validation)return{valid:!0,errors:[]};const n=r.validation,s=String(t);if(n.pattern){const e=this.validatePattern(s,n.pattern);e&&o.push(e)}if(void 0!==n.length){const e=this.validateExactLength(s,n.length);e&&o.push(e)}if(void 0!==n.minLength){const e=this.validateMinLength(s,n.minLength);e&&o.push(e)}if(void 0!==n.maxLength){const e=this.validateMaxLength(s,n.maxLength);e&&o.push(e)}if(void 0!==n.totalDigits){const e=this.validateTotalDigits(s,n.totalDigits);e&&o.push(e)}return{valid:0===o.length,errors:o}}static findDatatype(e,t){let i=t.find(t=>t.type===e);if(i)return i;const o=new Set;let r=e;for(;r&&!o.has(r)&&(o.add(r),i=t.find(e=>e.type===r),i);){if(i.validation)return i;r=i.basetype}}static validatePattern(e,t){try{if(!new RegExp(`^${t}$`).test(e))return{type:"pattern",message:T.t("xbrlValidation.patternMismatch",{pattern:t}),expectedValue:t,actualValue:e}}catch(i){return console.error(`Invalid regex pattern: ${t}`,i),{type:"pattern",message:T.t("xbrlValidation.invalidPattern",{pattern:t}),expectedValue:t,actualValue:e}}return null}static validateExactLength(e,t){return e.length!==t?{type:"length",message:T.t("xbrlValidation.exactLength",{required:t,current:e.length}),expectedValue:t,actualValue:e.length}:null}static validateMinLength(e,t){return e.length<t?{type:"minLength",message:T.t("xbrlValidation.minLength",{required:t,current:e.length}),expectedValue:t,actualValue:e.length}:null}static validateMaxLength(e,t){return e.length>t?{type:"maxLength",message:T.t("xbrlValidation.maxLength",{required:t,current:e.length}),expectedValue:t,actualValue:e.length}:null}static validateTotalDigits(e,t){const i=e.replace(/[^\d]/g,"");return i.length>t?{type:"totalDigits",message:T.t("xbrlValidation.totalDigits",{required:t,current:i.length}),expectedValue:t,actualValue:i.length}:null}static getValidationRulesSummary(e,t){if(!e||!t)return[];const i=this.findDatatype(e,t);if(!i||!i.validation)return[];const o=i.validation,r=[];return o.pattern&&r.push(T.t("xbrlValidation.ruleSummaryPattern",{pattern:o.pattern})),void 0!==o.length&&r.push(T.t("xbrlValidation.ruleSummaryExactLength",{required:o.length})),void 0!==o.minLength&&r.push(T.t("xbrlValidation.ruleSummaryMinLength",{required:o.minLength})),void 0!==o.maxLength&&r.push(T.t("xbrlValidation.ruleSummaryMaxLength",{required:o.maxLength})),void 0!==o.totalDigits&&r.push(T.t("xbrlValidation.ruleSummaryTotalDigits",{required:o.totalDigits})),r}}const P={"nl-types:formattedExplanationItemType":{fieldType:"textarea",placeholder:T.t("field.enterDetailedExplanation")},"nl-types:monetaryNoDecimals20ItemType":{fieldType:"number",htmlInputType:"number",allowDecimals:!1,step:1,placeholder:T.t("field.enterAmountNoDecimals")},"xbrli:monetaryItemType":{fieldType:"currency",htmlInputType:"number",allowDecimals:!0,step:.01,placeholder:T.t("field.enterCurrency")},"xbrli:stringItemType":{fieldType:"text",htmlInputType:"text",placeholder:T.t("field.enterText")},"xbrli:dateItemType":{fieldType:"date",htmlInputType:"date"},"xbrli:dateTimeItemType":{fieldType:"datetime",htmlInputType:"datetime-local"},"xbrli:integerItemType":{fieldType:"integer",htmlInputType:"number",allowDecimals:!1,step:1,placeholder:T.t("field.enterWholeNumber")},"xbrli:nonNegativeIntegerItemType":{fieldType:"integer",htmlInputType:"number",allowDecimals:!1,min:0,step:1,placeholder:T.t("field.enterPositiveNumber")},"xbrli:positiveIntegerItemType":{fieldType:"integer",htmlInputType:"number",allowDecimals:!1,min:1,step:1,placeholder:T.t("field.enterPositiveNumber")},"xbrli:decimalItemType":{fieldType:"decimal",htmlInputType:"number",allowDecimals:!0,step:"any",placeholder:T.t("field.enterDecimalValue")},"xbrli:sharesItemType":{fieldType:"number",htmlInputType:"number",allowDecimals:!0,min:0,step:.01,placeholder:T.t("field.enterNumberOfShares")},"xbrli:shares":{fieldType:"number",htmlInputType:"number",allowDecimals:!0,min:0,step:.01,placeholder:T.t("field.enterNumberOfShares")},"xbrli:gYearItemType":{fieldType:"number",htmlInputType:"number",allowDecimals:!1,min:1900,max:2100,step:1,placeholder:T.t("field.yearFormat")},"xbrli:booleanItemType":{fieldType:"boolean"},"xbrli:pureItemType":{fieldType:"percentage",htmlInputType:"number",allowDecimals:!0,step:.01,placeholder:T.t("field.enterPercentage")},"xbrli:percentItemType":{fieldType:"percentage",htmlInputType:"number",allowDecimals:!0,step:.01,placeholder:T.t("field.enterPercentage")},"xbrli:emailItemType":{fieldType:"email",htmlInputType:"email",placeholder:T.t("field.emailPlaceholder")},"xbrli:urlItemType":{fieldType:"url",htmlInputType:"url",placeholder:T.t("field.urlPlaceholder")},"xbrli:telephoneItemType":{fieldType:"tel",htmlInputType:"tel",placeholder:T.t("field.phonePlaceholder")}};function M(e,t){if(!e)return{fieldType:"text",htmlInputType:"text",placeholder:T.t("field.enterValue")};if(t&&t.length>0){const i=O(e,t);if(i.length>0){return J(i,t)}}if(console.log(`⚠️ [Type Resolution Fallback] Using pattern matching for: ${e}`),P[e])return P[e];const i=e.toLowerCase();if(i.includes("monetary"))return i.includes("nodecimals")||i.includes("no-decimals")?{fieldType:"number",htmlInputType:"number",allowDecimals:!1,step:1,placeholder:T.t("field.enterAmountNoDecimals")}:{fieldType:"currency",htmlInputType:"number",allowDecimals:!0,step:.01,placeholder:T.t("field.enterCurrency")};if(i.includes("explanation")||i.includes("description")||i.includes("notes")||i.includes("formatted"))return{fieldType:"textarea",placeholder:T.t("field.enterDetailedInformation")};if(i.includes("date"))return i.includes("time")?{fieldType:"datetime",htmlInputType:"datetime-local"}:{fieldType:"date",htmlInputType:"date"};if(i.includes("boolean")||i.includes("bool"))return{fieldType:"boolean"};if(i.includes("integer")||i.includes("int")){const e=i.includes("nonnegative")||i.includes("non-negative");return{fieldType:"integer",htmlInputType:"number",allowDecimals:!1,min:i.includes("positive")?1:e?0:void 0,step:1,placeholder:T.t("field.enterWholeNumber")}}return i.includes("decimal")||i.includes("numeric")||i.includes("number")?{fieldType:"decimal",htmlInputType:"number",allowDecimals:!0,step:"any",placeholder:T.t("field.enterDecimalValue")}:i.includes("percent")||i.includes("pure")?{fieldType:"percentage",htmlInputType:"number",allowDecimals:!0,step:.01,placeholder:T.t("field.enterPercentage")}:{fieldType:"text",htmlInputType:"text",placeholder:T.t("field.enterValue")}}function j(e){return"textarea"===e}function L(e){return"boolean"===e}function U(e){return["number","decimal","integer","currency","percentage"].includes(e)}function O(e,t){const i=[];if(!e)return i;if(!t||0===t.length)return i.push(e),i;let o=e;const r=new Set;for(;o;){if(i.push(o),r.has(o)){console.warn(`Circular reference detected in datatype hierarchy for type: ${o}`);break}r.add(o);const e=t.find(e=>e.type===o);if(!e||!e.basetype||""===e.basetype.trim())break;o=e.basetype}return i}function z(e,t){if(e&&0!==e.length&&t&&0!==t.length)for(const i of e){const e=t.find(e=>e.type===i);if(e&&e.enumerations&&e.enumerations.length>0)return e.enumerations.map(e=>({id:e.id||e.value,value:e.value,label:e.value}))}}function J(e,t){if(!e||0===e.length)return{fieldType:"text",htmlInputType:"text",placeholder:T.t("field.enterValue")};if(t&&t.length>0){const i=z(e,t);if(i&&i.length>0)return{fieldType:"select",enumerations:i,placeholder:T.t("field.selectOption")}}const i=e.map(e=>e.toLowerCase()),o=i.join("|");if(e.some(e=>"nl-types:formattedExplanationItemType"===e)||o.includes("formattedexplanation")||o.includes("formatted")&&o.includes("explanation"))return{fieldType:"textarea",placeholder:T.t("field.enterDetailedExplanation")};if(i.some(e=>e.includes("date")))return o.includes("datetime")||o.includes("time")?{fieldType:"datetime",htmlInputType:"datetime-local"}:{fieldType:"date",htmlInputType:"date"};if(i.some(e=>e.includes("boolean")||e.includes("bool")))return{fieldType:"boolean"};if(i.some(e=>e.includes("integer")||"integer"===e)){const e=o.includes("nonnegative")||o.includes("non-negative");return{fieldType:"integer",htmlInputType:"number",allowDecimals:!1,min:o.includes("positive")?1:e?0:void 0,step:1,placeholder:T.t("field.enterWholeNumber")}}return i.some(e=>e.includes("decimal")||"decimal"===e)?o.includes("monetary")||o.includes("currency")?o.includes("nodecimals")||o.includes("no-decimals")||o.includes("nodecimals20")?{fieldType:"number",htmlInputType:"number",allowDecimals:!1,step:1,placeholder:T.t("field.enterAmountNoDecimals")}:{fieldType:"currency",htmlInputType:"number",allowDecimals:!0,step:.01,placeholder:T.t("field.enterCurrency")}:{fieldType:"decimal",htmlInputType:"number",allowDecimals:!0,step:"any",placeholder:T.t("field.enterDecimalValue")}:e.some(e=>"xbrli:stringItemType"===e)||i.some(e=>"string"===e||e.includes("stringitem"))?{fieldType:"text",htmlInputType:"text",placeholder:T.t("field.enterText")}:{fieldType:"text",htmlInputType:"text",placeholder:T.t("field.enterValue")}}var N=Object.defineProperty,V=Object.getOwnPropertyDescriptor,q=(e,t,i,o)=>{for(var r,n=o>1?void 0:o?V(t,i):t,s=e.length-1;s>=0;s--)(r=e[s])&&(n=(o?r(t,i,n):r(n))||n);return o&&n&&N(t,i,n),n};exports.JupiterFormField=class extends e.LitElement{constructor(){super(...arguments),this.defaultUnits=[],this.value=null,this.disabled=!1,this.locale="en-US",this.hideLabel=!1,this.mode="inputForm",this.typedMemberValues={},this._errors=[],this._xbrlErrors=[],this._touched=!1,this._showPeriodPopup=!1,this._availableUnits=[]}willUpdate(e){var t;(e.has("value")||e.has("field"))&&this._validateField(),e.has("unit")&&this.unit&&(console.log(`🏷️ [FormField willUpdate] Unit property changed to: ${this.unit}, conceptId: ${this.conceptId}, columnId: ${this.columnId}`),this.dispatchEvent(new CustomEvent("unit-change",{detail:{fieldId:null==(t=this.field)?void 0:t.id,conceptId:this.conceptId,columnId:this.columnId,unit:this.unit},bubbles:!0,composed:!0}))),e.has("field")&&this.field&&(this.conceptId.includes("DescriptionLocationNL")||this.columnId.startsWith("col-"))&&console.log(`📅 [FormField willUpdate] Concept ${this.conceptId}, Column ${this.columnId}: field.periodType=${this.field.periodType}, field.periodStartDate=${this.field.periodStartDate}, field.periodEndDate=${this.field.periodEndDate}, field.periodInstantDate=${this.field.periodInstantDate}`)}_validateField(){var e;(null==(e=this.field)?void 0:e.validation)&&(this._errors=C.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._validateXBRLDatatype(),this._validateUnitSelection(),console.log(`🟦 [FormField] Blur event - fieldId: ${this.field.id}, conceptId: ${this.conceptId}, columnId: ${this.columnId}`),console.log("🟦 [FormField] Current _xbrlErrors:",this._xbrlErrors),console.log("🟦 [FormField] Current value:",this.value),this.dispatchEvent(new CustomEvent("field-blur",{detail:{fieldId:this.field.id,conceptId:this.conceptId,columnId:this.columnId,xbrlValidationErrors:this._xbrlErrors},bubbles:!0,composed:!0})),console.log(`🟦 [FormField] Dispatched field-blur event with ${this._xbrlErrors.length} errors`)}_isMonetaryType(){if(!this.conceptType||!this.datatypes)return!1;if(this.conceptType.includes("monetary")||this.conceptType.includes("Monetary"))return!0;return O(this.conceptType,this.datatypes).some(e=>e.includes("monetary")||e.includes("Monetary"))}_handleKeyDown(e){const t=e.target;if("number"!==t.type)return;["Backspace","Delete","Tab","Escape","Enter","ArrowLeft","ArrowRight","ArrowUp","ArrowDown","Home","End"].includes(e.key)||e.ctrlKey||e.metaKey||("-"!==e.key||0!==t.selectionStart||t.value.includes("-"))&&("."!==e.key||t.value.includes("."))&&(e.key>="0"&&e.key<="9"||e.preventDefault())}_validateXBRLDatatype(){if(this._xbrlErrors=[],null===this.value||void 0===this.value||""===this.value)return;if(!this.conceptType||!this.datatypes||0===this.datatypes.length)return;const e=A.validateConceptValue(this.conceptType,this.value,this.datatypes);e.valid?console.log(`✅ [FormField] XBRL Validation passed for ${this.conceptId}`):(this._xbrlErrors=e.errors,console.log(`❌ [FormField] XBRL Validation failed for ${this.conceptId}:`,{conceptType:this.conceptType,value:this.value,errors:this._xbrlErrors}))}_validateUnitSelection(){if(null===this.value||void 0===this.value||""===this.value)return;const e=this._collectUnitsForConceptType();if(0===e.length)return;if(this.unit)return;const t=e.find(e=>!0===e.isDefault)??(1===e.length?e[0]:null);if(t)return this.unit=t.id,this.dispatchEvent(new CustomEvent("unit-change",{detail:{fieldId:this.field.id,conceptId:this.conceptId,columnId:this.columnId,unit:this.unit},bubbles:!0,composed:!0})),void console.log(`🎯 [FormField] Auto-selected default unit on blur: ${this.unit} for ${this.conceptId}`);this._xbrlErrors=[...this._xbrlErrors,{type:"unit",message:T.t("validation.unitRequired"),expectedValue:e.map(e=>e.label).join(", "),actualValue:""}],console.log(`❌ [FormField] Unit validation failed for ${this.conceptId}: unit is required but not selected`)}_handlePeriodIconClick(){if(this._availableUnits=this._collectUnitsForConceptType(),console.log(`📊 [FormField] Collected ${this._availableUnits.length} units for concept ${this.conceptId}:`,this._availableUnits),console.log(`📊 [FormField] Current unit value: ${this.unit}`),console.log(`📊 [FormField] ConceptId: ${this.conceptId}, ColumnId: ${this.columnId}`),!this.unit&&this._availableUnits.length>0){let e=null;const t=this._availableUnits.find(e=>!0===e.isDefault);t?(e=t.id,console.log(`🎯 [FormField] Auto-selecting default unit: ${t.id} (${t.label})`)):1===this._availableUnits.length&&(e=this._availableUnits[0].id,console.log(`🎯 [FormField] Auto-selecting single available unit: ${e}`)),e&&(this.unit=e,this.dispatchEvent(new CustomEvent("unit-change",{detail:{fieldId:this.field.id,conceptId:this.conceptId,columnId:this.columnId,unit:this.unit},bubbles:!0,composed:!0})))}else this.unit&&(console.log(`📊 [FormField] Unit already set, dispatching unit-change to ensure parent stores it: ${this.unit}`),this.dispatchEvent(new CustomEvent("unit-change",{detail:{fieldId:this.field.id,conceptId:this.conceptId,columnId:this.columnId,unit:this.unit},bubbles:!0,composed:!0})));this._showPeriodPopup=!0}_collectUnitsForConceptType(){if(!this.conceptType||!this.datatypes)return[];const e=O(this.conceptType,this.datatypes);console.log(`🔍 [Unit Resolution] Concept: ${this.conceptId}, Type: ${this.conceptType}, BaseType Chain:`,e);for(const t of e){const e=this.datatypes.find(e=>e.type===t);if(e&&e.units&&Array.isArray(e.units)&&e.units.length>0)return console.log(`✅ [Unit Resolution] Found ${e.units.length} units in type: ${t}`),e.units}return console.log(`ℹ️ [Unit Resolution] No units found for concept ${this.conceptId}`),[]}_closePeriodPopup(){this._showPeriodPopup=!1}_handleUnitChange(e){const t=e.target.value;console.log(`🏷️ [FormField] Unit change detected: value=${t}, conceptId=${this.conceptId}, columnId=${this.columnId}`),console.log(`🏷️ [FormField] Previous unit value: ${this.unit}`),this.unit=t,console.log(`🏷️ [FormField] Updated unit value to: ${this.unit}`);const i={fieldId:this.field.id,conceptId:this.conceptId,columnId:this.columnId,unit:this.unit};console.log("🏷️ [FormField] Dispatching unit-change event with detail:",i),this.dispatchEvent(new CustomEvent("unit-change",{detail:i,bubbles:!0,composed:!0})),console.log("🏷️ [FormField] unit-change event dispatched")}_handlePopupOverlayClick(e){e.target===e.currentTarget&&this._closePeriodPopup()}_handlePeriodChange(e,t){const i=e.target.value;console.log(`📅 [FormField] Period change detected: type=${t}, value=${i}, conceptId=${this.conceptId}, columnId=${this.columnId}`),"instant"===t?this.periodInstantDate=i:"start"===t?this.periodStartDate=i:"end"===t&&(this.periodEndDate=i),console.log(`📅 [FormField] Updated local period values: startDate=${this.periodStartDate}, endDate=${this.periodEndDate}, instantDate=${this.periodInstantDate}`),this.dispatchEvent(new CustomEvent("period-change",{detail:{fieldId:this.field.id,conceptId:this.conceptId,columnId:this.columnId,periodType:this.field.periodType,periodStartDate:this.periodStartDate,periodEndDate:this.periodEndDate,periodInstantDate:this.periodInstantDate,unit:this.unit},bubbles:!0,composed:!0})),console.log("🚀 [FormField] Dispatched period-change event with detail:",{conceptId:this.conceptId,columnId:this.columnId,periodType:this.field.periodType})}_handleCrossRoleTypedMemberChange(e,t){const i=e.target.value;this.typedMemberValues={...this.typedMemberValues,[t]:i},this.dispatchEvent(new CustomEvent("typed-member-change",{detail:{columnId:this.columnId,conceptId:this.conceptId,axisId:t,value:i},bubbles:!0,composed:!0}))}_renderReadonlyValue(t){const i=M(this.conceptType,this.datatypes),o=i.fieldType||this.field.type||"text";let r;if("boolean"===o||L(o))r=t?T.t("form.yes"):T.t("form.no");else if("select"===o||"select"===this.field.type){const e=(i.enumerations||this.field.options||[]).find(e=>e.value===t);r=e?e.label||e.value:t??""}else r=null!=t?String(t):"";const n=""===r||null==r,s=this._isMonetaryType();return e.html`<span class="readonly-value ${n?"empty":""} ${s?"monetary":""}">${n?"—":r}</span>`}_renderInput(t=this.value,i=this.disabled){if("readonly"===this.mode)return this._renderReadonlyValue(t);const o=this._errors.some(e=>"error"===e.severity),r=this._errors.some(e=>"warning"===e.severity),n=`field-input ${o?"error":r?"warning":""} ${this._isMonetaryType()?"monetary":""}`,s=`${this.conceptId}__${this.columnId}`,l=`data[${this.conceptId}][${this.columnId}]`,a=M(this.conceptType,this.datatypes);this.conceptType;const d=a.fieldType||this.field.type||"text";if("textarea"===d||j(d))return e.html`
|
|
23
23
|
<textarea
|
|
24
24
|
id="${s}"
|
|
25
25
|
name="${l}"
|
|
@@ -42,7 +42,7 @@ const $={attribute:!0,type:String,converter:v,reflect:!1,hasChanged:x},I=(e=$,t,
|
|
|
42
42
|
@focus="${this._handleFocus}"
|
|
43
43
|
@blur="${this._handleBlur}"
|
|
44
44
|
>
|
|
45
|
-
<option value="">${a.placeholder||
|
|
45
|
+
<option value="">${a.placeholder||T.t("field.select")}</option>
|
|
46
46
|
${o.map(i=>{const o=i.value,r=i.label||i.value,n=i.disabled||!1;return e.html`
|
|
47
47
|
<option
|
|
48
48
|
value="${o}"
|
|
@@ -172,6 +172,21 @@ const $={attribute:!0,type:String,converter:v,reflect:!1,hasChanged:x},I=(e=$,t,
|
|
|
172
172
|
</select>
|
|
173
173
|
</div>
|
|
174
174
|
`:""}
|
|
175
|
+
|
|
176
|
+
${this.field.crossRoleTypedMembers&&this.field.crossRoleTypedMembers.length>0?e.html`
|
|
177
|
+
${this.field.crossRoleTypedMembers.map(t=>e.html`
|
|
178
|
+
<div class="period-controls">
|
|
179
|
+
<label>${t.axisLabel}:</label>
|
|
180
|
+
<input
|
|
181
|
+
type="text"
|
|
182
|
+
class="typed-member-input"
|
|
183
|
+
.value="${this.typedMemberValues[t.axisId]||""}"
|
|
184
|
+
@input="${e=>this._handleCrossRoleTypedMemberChange(e,t.axisId)}"
|
|
185
|
+
?disabled="${this.disabled}"
|
|
186
|
+
/>
|
|
187
|
+
</div>
|
|
188
|
+
`)}
|
|
189
|
+
`:""}
|
|
175
190
|
</div>
|
|
176
191
|
</div>
|
|
177
192
|
</div>
|
|
@@ -290,7 +305,7 @@ const $={attribute:!0,type:String,converter:v,reflect:!1,hasChanged:x},I=(e=$,t,
|
|
|
290
305
|
border-radius: 8px;
|
|
291
306
|
padding: 24px;
|
|
292
307
|
box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
|
|
293
|
-
max-width:
|
|
308
|
+
max-width: 800px;
|
|
294
309
|
width: 90%;
|
|
295
310
|
}
|
|
296
311
|
|
|
@@ -334,7 +349,7 @@ const $={attribute:!0,type:String,converter:v,reflect:!1,hasChanged:x},I=(e=$,t,
|
|
|
334
349
|
|
|
335
350
|
.period-popup-content .period-controls {
|
|
336
351
|
display: grid;
|
|
337
|
-
grid-template-columns:
|
|
352
|
+
grid-template-columns: 200px 1fr;
|
|
338
353
|
gap: 12px;
|
|
339
354
|
align-items: center;
|
|
340
355
|
margin-top: 0;
|
|
@@ -345,6 +360,8 @@ const $={attribute:!0,type:String,converter:v,reflect:!1,hasChanged:x},I=(e=$,t,
|
|
|
345
360
|
font-weight: 500;
|
|
346
361
|
color: var(--jupiter-text-primary, #333);
|
|
347
362
|
text-align: right;
|
|
363
|
+
white-space: normal;
|
|
364
|
+
word-break: break-word;
|
|
348
365
|
}
|
|
349
366
|
|
|
350
367
|
.period-popup-content .period-controls input[type="date"] {
|
|
@@ -382,22 +399,44 @@ const $={attribute:!0,type:String,converter:v,reflect:!1,hasChanged:x},I=(e=$,t,
|
|
|
382
399
|
cursor: not-allowed;
|
|
383
400
|
}
|
|
384
401
|
|
|
402
|
+
.period-popup-content .period-controls .typed-member-input {
|
|
403
|
+
flex: 1;
|
|
404
|
+
padding: 6px 8px;
|
|
405
|
+
border: 1px solid var(--jupiter-border-color, #ddd);
|
|
406
|
+
border-radius: 4px;
|
|
407
|
+
font-size: 13px;
|
|
408
|
+
font-family: inherit;
|
|
409
|
+
background: var(--jupiter-input-background, #fff);
|
|
410
|
+
}
|
|
411
|
+
|
|
412
|
+
.period-popup-content .period-controls .typed-member-input:focus {
|
|
413
|
+
outline: none;
|
|
414
|
+
border-color: var(--jupiter-primary-color, #1976d2);
|
|
415
|
+
box-shadow: 0 0 0 2px var(--jupiter-primary-color-light, rgba(25, 118, 210, 0.2));
|
|
416
|
+
}
|
|
417
|
+
|
|
418
|
+
.period-popup-content .period-controls .typed-member-input:disabled {
|
|
419
|
+
background: var(--jupiter-disabled-background, #f5f5f5);
|
|
420
|
+
color: var(--jupiter-disabled-text, #999);
|
|
421
|
+
cursor: not-allowed;
|
|
422
|
+
}
|
|
423
|
+
|
|
385
424
|
.field-input {
|
|
386
425
|
width: 100%;
|
|
387
426
|
padding: 6px 8px; /* Reduced padding for table cells */
|
|
388
|
-
border: 1px solid var(--jupiter-border-color, #ddd);
|
|
427
|
+
border: 1px solid var(--primaryTextColor, var(--jupiter-border-color, #ddd));
|
|
389
428
|
border-radius: 4px;
|
|
390
429
|
font-size: 13px; /* Slightly smaller font for table */
|
|
391
430
|
font-family: inherit;
|
|
392
|
-
background:
|
|
393
|
-
color: var(--jupiter-text-primary, #333);
|
|
431
|
+
background: transparent !important;
|
|
432
|
+
color: var(--primaryTextColor, var(--jupiter-text-primary, #333));
|
|
394
433
|
box-sizing: border-box;
|
|
395
434
|
}
|
|
396
435
|
|
|
397
436
|
.field-input:focus {
|
|
398
437
|
outline: none;
|
|
399
|
-
border-color: var(--jupiter-primary-color, #1976d2);
|
|
400
|
-
box-shadow: 0 0 0 2px var(--jupiter-primary-color-light, rgba(25, 118, 210, 0.2));
|
|
438
|
+
border-color: var(--primaryTextColor, var(--jupiter-primary-color, #1976d2));
|
|
439
|
+
box-shadow: 0 0 0 2px var(--boxShadowColor, var(--jupiter-primary-color-light, rgba(25, 118, 210, 0.2)));
|
|
401
440
|
}
|
|
402
441
|
|
|
403
442
|
.field-input:disabled {
|
|
@@ -513,7 +552,7 @@ const $={attribute:!0,type:String,converter:v,reflect:!1,hasChanged:x},I=(e=$,t,
|
|
|
513
552
|
outline: none;
|
|
514
553
|
border-color: var(--jupiter-primary-color, #1976d2);
|
|
515
554
|
}
|
|
516
|
-
`,q([S({type:Object})],exports.JupiterFormField.prototype,"field",2),q([S({type:String})],exports.JupiterFormField.prototype,"conceptId",2),q([S({type:String})],exports.JupiterFormField.prototype,"conceptType",2),q([S({type:Array})],exports.JupiterFormField.prototype,"datatypes",2),q([S({type:Array})],exports.JupiterFormField.prototype,"defaultUnits",2),q([S({type:String})],exports.JupiterFormField.prototype,"columnId",2),q([S()],exports.JupiterFormField.prototype,"value",2),q([S({type:Boolean})],exports.JupiterFormField.prototype,"disabled",2),q([S({type:String})],exports.JupiterFormField.prototype,"locale",2),q([S({type:Boolean})],exports.JupiterFormField.prototype,"hideLabel",2),q([S({type:String})],exports.JupiterFormField.prototype,"mode",2),q([S({type:Object})],exports.JupiterFormField.prototype,"masterData",2),q([S({type:Array})],exports.JupiterFormField.prototype,"facts",2),q([S({type:Object})],exports.JupiterFormField.prototype,"column",2),q([S({type:String})],exports.JupiterFormField.prototype,"periodStartDate",2),q([S({type:String})],exports.JupiterFormField.prototype,"periodEndDate",2),q([S({type:String})],exports.JupiterFormField.prototype,"periodInstantDate",2),q([S({type:String})],exports.JupiterFormField.prototype,"unit",2),q([w()],exports.JupiterFormField.prototype,"_errors",2),q([w()],exports.JupiterFormField.prototype,"_xbrlErrors",2),q([w()],exports.JupiterFormField.prototype,"_touched",2),q([w()],exports.JupiterFormField.prototype,"_showPeriodPopup",2),q([w()],exports.JupiterFormField.prototype,"_availableUnits",2),exports.JupiterFormField=q([t("jupiter-form-field")],exports.JupiterFormField);var B=Object.defineProperty,Y=Object.getOwnPropertyDescriptor,K=(e,t,i,o)=>{for(var r,n=o>1?void 0:o?Y(t,i):t,s=e.length-1;s>=0;s--)(r=e[s])&&(n=(o?r(t,i,n):r(n))||n);return o&&n&&B(t,i,n),n};exports.JupiterConceptTree=class extends e.LitElement{constructor(){super(...arguments),this.columns=[],this.formData={},this.periodData={},this.unitData={},this.defaultUnits=[],this.disabled=!1,this.locale="en-US",this.expandedConcepts=new Set,this.mode="inputForm",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}))}_handlePeriodChange(e){console.log("🌲 [ConceptTree] Received period-change event:",e.detail),e.stopPropagation(),this.dispatchEvent(new CustomEvent("period-change",{detail:e.detail,bubbles:!0,composed:!0})),console.log("🌲 [ConceptTree] Forwarded period-change event to form-section")}render(){const t=this.concept.children&&this.concept.children.length>0,i=this.concept.level||0,o=this.concept.abstract||!1;return e.html`
|
|
555
|
+
`,q([S({type:Object})],exports.JupiterFormField.prototype,"field",2),q([S({type:String})],exports.JupiterFormField.prototype,"conceptId",2),q([S({type:String})],exports.JupiterFormField.prototype,"conceptType",2),q([S({type:Array})],exports.JupiterFormField.prototype,"datatypes",2),q([S({type:Array})],exports.JupiterFormField.prototype,"defaultUnits",2),q([S({type:String})],exports.JupiterFormField.prototype,"columnId",2),q([S()],exports.JupiterFormField.prototype,"value",2),q([S({type:Boolean})],exports.JupiterFormField.prototype,"disabled",2),q([S({type:String})],exports.JupiterFormField.prototype,"locale",2),q([S({type:Boolean})],exports.JupiterFormField.prototype,"hideLabel",2),q([S({type:String})],exports.JupiterFormField.prototype,"mode",2),q([S({type:Object})],exports.JupiterFormField.prototype,"masterData",2),q([S({type:Array})],exports.JupiterFormField.prototype,"facts",2),q([S({type:Object})],exports.JupiterFormField.prototype,"column",2),q([S({type:String})],exports.JupiterFormField.prototype,"periodStartDate",2),q([S({type:String})],exports.JupiterFormField.prototype,"periodEndDate",2),q([S({type:String})],exports.JupiterFormField.prototype,"periodInstantDate",2),q([S({type:String})],exports.JupiterFormField.prototype,"unit",2),q([S({type:Object})],exports.JupiterFormField.prototype,"typedMemberValues",2),q([w()],exports.JupiterFormField.prototype,"_errors",2),q([w()],exports.JupiterFormField.prototype,"_xbrlErrors",2),q([w()],exports.JupiterFormField.prototype,"_touched",2),q([w()],exports.JupiterFormField.prototype,"_showPeriodPopup",2),q([w()],exports.JupiterFormField.prototype,"_availableUnits",2),exports.JupiterFormField=q([t("jupiter-form-field")],exports.JupiterFormField);var B=Object.defineProperty,Y=Object.getOwnPropertyDescriptor,K=(e,t,i,o)=>{for(var r,n=o>1?void 0:o?Y(t,i):t,s=e.length-1;s>=0;s--)(r=e[s])&&(n=(o?r(t,i,n):r(n))||n);return o&&n&&B(t,i,n),n};exports.JupiterConceptTree=class extends e.LitElement{constructor(){super(...arguments),this.columns=[],this.formData={},this.periodData={},this.unitData={},this.defaultUnits=[],this.disabled=!1,this.locale="en-US",this.expandedConcepts=new Set,this.mode="inputForm",this.typedMemberData={},this.showAddButton=!1,this.showRemoveButton=!1,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}))}_handleAddRepeat(){this.dispatchEvent(new CustomEvent("add-concept-repeat",{detail:{conceptId:this.concept.id},bubbles:!0,composed:!0}))}_handleRemoveRepeat(){this.dispatchEvent(new CustomEvent("remove-concept-repeat",{detail:{conceptId:this.concept.id},bubbles:!0,composed:!0}))}_handlePeriodChange(e){console.log("🌲 [ConceptTree] Received period-change event:",e.detail),e.stopPropagation(),this.dispatchEvent(new CustomEvent("period-change",{detail:e.detail,bubbles:!0,composed:!0})),console.log("🌲 [ConceptTree] Forwarded period-change event to form-section")}render(){const t=this.concept.children&&this.concept.children.length>0,i=this.concept.level||0,o=this.concept.abstract||!1;return e.html`
|
|
517
556
|
<!-- Concept Name Cell (Left Column) -->
|
|
518
557
|
<td class="concept-name-cell ${o?"abstract":t?"":"leaf"}">
|
|
519
558
|
<div class="concept-content" style="--level: ${i}">
|
|
@@ -522,11 +561,22 @@ const $={attribute:!0,type:String,converter:v,reflect:!1,hasChanged:x},I=(e=$,t,
|
|
|
522
561
|
@click="${this._toggleExpanded}">
|
|
523
562
|
${t?"▶":""}
|
|
524
563
|
</div>
|
|
525
|
-
<div class="concept-label"
|
|
564
|
+
<div class="concept-label"
|
|
526
565
|
@click="${this._toggleExpanded}"
|
|
527
566
|
title="${this.concept.id}${this.concept.description?" - "+this.concept.description:""}">
|
|
528
567
|
${this.concept.label}
|
|
529
568
|
</div>
|
|
569
|
+
${this.concept.balance?e.html`
|
|
570
|
+
<div class="concept-balance ${this.concept.balance}">${this.concept.balance}</div>
|
|
571
|
+
`:""}
|
|
572
|
+
${this.showAddButton?e.html`
|
|
573
|
+
<button class="repeat-btn" type="button" title="Add row"
|
|
574
|
+
@click="${this._handleAddRepeat}">+</button>
|
|
575
|
+
`:""}
|
|
576
|
+
${this.showRemoveButton?e.html`
|
|
577
|
+
<button class="repeat-btn remove" type="button" title="Remove row"
|
|
578
|
+
@click="${this._handleRemoveRepeat}">−</button>
|
|
579
|
+
`:""}
|
|
530
580
|
</div>
|
|
531
581
|
</td>
|
|
532
582
|
|
|
@@ -553,6 +603,7 @@ const $={attribute:!0,type:String,converter:v,reflect:!1,hasChanged:x},I=(e=$,t,
|
|
|
553
603
|
.masterData="${this.masterData}"
|
|
554
604
|
.facts="${this.facts}"
|
|
555
605
|
.column="${t}"
|
|
606
|
+
.typedMemberValues="${this.typedMemberData[`${this.concept.id}__${t.id}`]||{}}"
|
|
556
607
|
@field-change="${this._handleFieldChange}"
|
|
557
608
|
@period-change="${this._handlePeriodChange}"
|
|
558
609
|
></jupiter-form-field>
|
|
@@ -568,7 +619,7 @@ const $={attribute:!0,type:String,converter:v,reflect:!1,hasChanged:x},I=(e=$,t,
|
|
|
568
619
|
.concept-name-cell {
|
|
569
620
|
vertical-align: top;
|
|
570
621
|
padding: 2px 4px;
|
|
571
|
-
border: 1px solid var(--jupiter-border-color, #ddd);
|
|
622
|
+
border: 1px solid var(--primaryTextColor, var(--jupiter-border-color, #ddd));
|
|
572
623
|
border-bottom: none;
|
|
573
624
|
background: var(--jupiter-concept-background, #f8f9fa);
|
|
574
625
|
position: sticky;
|
|
@@ -580,12 +631,13 @@ const $={attribute:!0,type:String,converter:v,reflect:!1,hasChanged:x},I=(e=$,t,
|
|
|
580
631
|
}
|
|
581
632
|
|
|
582
633
|
.concept-name-cell.abstract {
|
|
583
|
-
background: var(--jupiter-abstract-background, #f0f2f5);
|
|
634
|
+
background: var(--bg-color-1, var(--jupiter-abstract-background, #f0f2f5));
|
|
584
635
|
font-weight: 600;
|
|
636
|
+
color: var(--primaryTextColor, var(--jupiter-text-primary, #333));
|
|
585
637
|
}
|
|
586
638
|
|
|
587
639
|
.concept-name-cell.leaf {
|
|
588
|
-
background: var(--jupiter-leaf-background, #fff);
|
|
640
|
+
background: var(--bg-color-2, var(--jupiter-leaf-background, #fff));
|
|
589
641
|
font-weight: 400;
|
|
590
642
|
}
|
|
591
643
|
|
|
@@ -626,7 +678,7 @@ const $={attribute:!0,type:String,converter:v,reflect:!1,hasChanged:x},I=(e=$,t,
|
|
|
626
678
|
|
|
627
679
|
.concept-label {
|
|
628
680
|
flex: 1;
|
|
629
|
-
color: var(--jupiter-text-primary, #333);
|
|
681
|
+
color: var(--primaryTextColor, var(--jupiter-text-primary, #333));
|
|
630
682
|
cursor: pointer;
|
|
631
683
|
word-wrap: break-word;
|
|
632
684
|
overflow-wrap: break-word;
|
|
@@ -635,12 +687,35 @@ const $={attribute:!0,type:String,converter:v,reflect:!1,hasChanged:x},I=(e=$,t,
|
|
|
635
687
|
min-width: 0; /* Allows flex item to shrink below content size */
|
|
636
688
|
}
|
|
637
689
|
|
|
690
|
+
.concept-balance {
|
|
691
|
+
margin-left: 8px;
|
|
692
|
+
font-size: 11px;
|
|
693
|
+
font-weight: 600;
|
|
694
|
+
padding: 2px 6px;
|
|
695
|
+
border-radius: 3px;
|
|
696
|
+
text-transform: uppercase;
|
|
697
|
+
letter-spacing: 0.5px;
|
|
698
|
+
flex-shrink: 0;
|
|
699
|
+
}
|
|
700
|
+
|
|
701
|
+
.concept-balance.debit {
|
|
702
|
+
color: #d32f2f;
|
|
703
|
+
background: rgba(211, 47, 47, 0.1);
|
|
704
|
+
border: 1px solid rgba(211, 47, 47, 0.3);
|
|
705
|
+
}
|
|
706
|
+
|
|
707
|
+
.concept-balance.credit {
|
|
708
|
+
color: #388e3c;
|
|
709
|
+
background: rgba(56, 142, 60, 0.1);
|
|
710
|
+
border: 1px solid rgba(56, 142, 60, 0.3);
|
|
711
|
+
}
|
|
712
|
+
|
|
638
713
|
.field-cell {
|
|
639
714
|
vertical-align: middle;
|
|
640
715
|
padding: 2px 6px;
|
|
641
|
-
border: 1px solid var(--jupiter-border-color, #ddd);
|
|
716
|
+
border: 1px solid var(--primaryTextColor, var(--jupiter-border-color, #ddd));
|
|
642
717
|
border-bottom: none;
|
|
643
|
-
background: var(--jupiter-cell-background, #fff);
|
|
718
|
+
background: var(--bg-color-2, var(--jupiter-cell-background, #fff));
|
|
644
719
|
min-height: 28px;
|
|
645
720
|
text-align: center;
|
|
646
721
|
min-width: 180px;
|
|
@@ -648,11 +723,11 @@ const $={attribute:!0,type:String,converter:v,reflect:!1,hasChanged:x},I=(e=$,t,
|
|
|
648
723
|
}
|
|
649
724
|
|
|
650
725
|
.field-cell.empty {
|
|
651
|
-
background: var(--jupiter-empty-cell-background, #f8f9fa);
|
|
726
|
+
background: var(--bg-color-2, var(--jupiter-empty-cell-background, #f8f9fa));
|
|
652
727
|
}
|
|
653
728
|
|
|
654
729
|
.field-cell.abstract-row {
|
|
655
|
-
background: var(--jupiter-abstract-cell-background, #f0f2f5);
|
|
730
|
+
background: var(--bg-color-2, var(--jupiter-abstract-cell-background, #f0f2f5));
|
|
656
731
|
}
|
|
657
732
|
|
|
658
733
|
/* Children are rendered as separate table rows, not nested */
|
|
@@ -660,18 +735,50 @@ const $={attribute:!0,type:String,converter:v,reflect:!1,hasChanged:x},I=(e=$,t,
|
|
|
660
735
|
display: none;
|
|
661
736
|
}
|
|
662
737
|
|
|
738
|
+
.repeat-btn {
|
|
739
|
+
flex-shrink: 0;
|
|
740
|
+
margin-left: 4px;
|
|
741
|
+
width: 20px;
|
|
742
|
+
height: 20px;
|
|
743
|
+
padding: 0;
|
|
744
|
+
border-radius: 3px;
|
|
745
|
+
border: 1px solid var(--jupiter-primary-color, #1976d2);
|
|
746
|
+
color: var(--jupiter-primary-color, #1976d2);
|
|
747
|
+
background: transparent;
|
|
748
|
+
cursor: pointer;
|
|
749
|
+
font-size: 14px;
|
|
750
|
+
line-height: 1;
|
|
751
|
+
display: flex;
|
|
752
|
+
align-items: center;
|
|
753
|
+
justify-content: center;
|
|
754
|
+
}
|
|
663
755
|
|
|
664
|
-
|
|
756
|
+
.repeat-btn:hover {
|
|
757
|
+
background: var(--jupiter-primary-color, #1976d2);
|
|
758
|
+
color: #fff;
|
|
759
|
+
}
|
|
760
|
+
|
|
761
|
+
.repeat-btn.remove {
|
|
762
|
+
border-color: var(--jupiter-error-color, #d32f2f);
|
|
763
|
+
color: var(--jupiter-error-color, #d32f2f);
|
|
764
|
+
}
|
|
765
|
+
|
|
766
|
+
.repeat-btn.remove:hover {
|
|
767
|
+
background: var(--jupiter-error-color, #d32f2f);
|
|
768
|
+
color: #fff;
|
|
769
|
+
}
|
|
770
|
+
|
|
771
|
+
`,K([S({type:Object})],exports.JupiterConceptTree.prototype,"concept",2),K([S({type:Array})],exports.JupiterConceptTree.prototype,"columns",2),K([S({type:Object})],exports.JupiterConceptTree.prototype,"formData",2),K([S({type:Object})],exports.JupiterConceptTree.prototype,"periodData",2),K([S({type:Object})],exports.JupiterConceptTree.prototype,"unitData",2),K([S({type:Array})],exports.JupiterConceptTree.prototype,"defaultUnits",2),K([S({type:Boolean})],exports.JupiterConceptTree.prototype,"disabled",2),K([S({type:String})],exports.JupiterConceptTree.prototype,"locale",2),K([S({type:Set})],exports.JupiterConceptTree.prototype,"expandedConcepts",2),K([S({type:Array})],exports.JupiterConceptTree.prototype,"datatypes",2),K([S({type:String})],exports.JupiterConceptTree.prototype,"mode",2),K([S({type:Object})],exports.JupiterConceptTree.prototype,"masterData",2),K([S({type:Array})],exports.JupiterConceptTree.prototype,"facts",2),K([S({type:Object})],exports.JupiterConceptTree.prototype,"typedMemberData",2),K([S({type:Boolean})],exports.JupiterConceptTree.prototype,"showAddButton",2),K([S({type:Boolean})],exports.JupiterConceptTree.prototype,"showRemoveButton",2),K([w()],exports.JupiterConceptTree.prototype,"_expanded",2),exports.JupiterConceptTree=K([t("jupiter-concept-tree")],exports.JupiterConceptTree);var H=Object.defineProperty,Q=Object.getOwnPropertyDescriptor,W=(e,t,i,o)=>{for(var r,n=o>1?void 0:o?Q(t,i):t,s=e.length-1;s>=0;s--)(r=e[s])&&(n=(o?r(t,i,n):r(n))||n);return o&&n&&H(t,i,n),n};exports.JupiterAddColumnDialog=class extends e.LitElement{constructor(){super(...arguments),this.periodType="duration",this.open=!1,this.availableDimensions=[],this.periodStartDate="",this.periodEndDate="",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")}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?"duration":this.periodType};"instant"===this.periodType?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||"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(){this._startDate=this.periodStartDate||"",this._endDate=this.periodEndDate||"",this._instantDate=this.periodEndDate||this.periodStartDate||"",this._selectedType="instant"===this.periodType?"instant":"duration",this._selectedDimensions.clear(),this._autoSelectSingleMemberDimensions(),this.requestUpdate()}_autoSelectSingleMemberDimensions(){this.availableDimensions.forEach(e=>{if(e.members&&e.members.length>0){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 default 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`
|
|
665
772
|
<div class="dialog" @click="${e=>e.stopPropagation()}">
|
|
666
773
|
<div class="dialog-header">
|
|
667
|
-
<h2 class="dialog-title">${
|
|
774
|
+
<h2 class="dialog-title">${T.t("column.addColumn")}</h2>
|
|
668
775
|
|
|
669
776
|
</div>
|
|
670
777
|
|
|
671
778
|
<div class="dialog-content">
|
|
672
779
|
${"instant"===this.periodType?e.html`
|
|
673
780
|
<div class="form-group">
|
|
674
|
-
<label class="form-label required">${
|
|
781
|
+
<label class="form-label required">${T.t("column.instantDate")}</label>
|
|
675
782
|
<input
|
|
676
783
|
type="date"
|
|
677
784
|
class="form-input"
|
|
@@ -683,7 +790,7 @@ const $={attribute:!0,type:String,converter:v,reflect:!1,hasChanged:x},I=(e=$,t,
|
|
|
683
790
|
`:e.html`
|
|
684
791
|
<div class="form-group date-row">
|
|
685
792
|
<div class="date-field">
|
|
686
|
-
<label class="form-label required">${
|
|
793
|
+
<label class="form-label required">${T.t("column.startPeriodDate")}</label>
|
|
687
794
|
<input
|
|
688
795
|
type="date"
|
|
689
796
|
class="form-input"
|
|
@@ -693,7 +800,7 @@ const $={attribute:!0,type:String,converter:v,reflect:!1,hasChanged:x},I=(e=$,t,
|
|
|
693
800
|
/>
|
|
694
801
|
</div>
|
|
695
802
|
<div class="date-field">
|
|
696
|
-
<label class="form-label required">${
|
|
803
|
+
<label class="form-label required">${T.t("column.endPeriodDate")}</label>
|
|
697
804
|
<input
|
|
698
805
|
type="date"
|
|
699
806
|
class="form-input"
|
|
@@ -708,8 +815,8 @@ const $={attribute:!0,type:String,converter:v,reflect:!1,hasChanged:x},I=(e=$,t,
|
|
|
708
815
|
<!-- Dimensions Section -->
|
|
709
816
|
${this.availableDimensions.length>0?e.html`
|
|
710
817
|
<div class="dimensions-section">
|
|
711
|
-
<h3>${
|
|
712
|
-
<p class="form-description">${
|
|
818
|
+
<h3>${T.t("column.availableDimensions")}</h3>
|
|
819
|
+
<p class="form-description">${T.t("column.dimensionsDescription")}</p>
|
|
713
820
|
|
|
714
821
|
${this.availableDimensions.map(t=>{const i=this._selectedDimensions.has(t.id),o=this._selectedDimensions.get(t.id),r=!(!t.typedMember||t.members&&0!==t.members.length);return e.html`
|
|
715
822
|
<div class="dimension-item">
|
|
@@ -731,20 +838,20 @@ const $={attribute:!0,type:String,converter:v,reflect:!1,hasChanged:x},I=(e=$,t,
|
|
|
731
838
|
${r?e.html`
|
|
732
839
|
<!-- Typed Dimension Input -->
|
|
733
840
|
<div class="member-selection">
|
|
734
|
-
<label>${
|
|
841
|
+
<label>${T.t("column.enterValue")} ${t.conceptName}:</label>
|
|
735
842
|
<input
|
|
736
843
|
type="text"
|
|
737
844
|
class="typed-input"
|
|
738
845
|
.value="${(null==o?void 0:o.typedValue)||""}"
|
|
739
846
|
@input="${e=>this._handleTypedValueChange(t.id,e)}"
|
|
740
|
-
placeholder="${
|
|
847
|
+
placeholder="${T.t("column.enterValuePlaceholder")}"
|
|
741
848
|
/>
|
|
742
849
|
</div>
|
|
743
850
|
`:e.html`
|
|
744
851
|
<!-- Domain Members Selection -->
|
|
745
852
|
${t.members&&t.members.length>0?e.html`
|
|
746
853
|
<div class="member-selection">
|
|
747
|
-
<label>${
|
|
854
|
+
<label>${T.t("column.selectMember")}</label>
|
|
748
855
|
<div class="member-list">
|
|
749
856
|
${t.members.map(i=>e.html`
|
|
750
857
|
<div class="member-option">
|
|
@@ -763,7 +870,7 @@ const $={attribute:!0,type:String,converter:v,reflect:!1,hasChanged:x},I=(e=$,t,
|
|
|
763
870
|
</div>
|
|
764
871
|
</div>
|
|
765
872
|
`:e.html`
|
|
766
|
-
<p class="form-description">${
|
|
873
|
+
<p class="form-description">${T.t("column.noMembersAvailable")}</p>
|
|
767
874
|
`}
|
|
768
875
|
`}
|
|
769
876
|
</div>
|
|
@@ -776,14 +883,14 @@ const $={attribute:!0,type:String,converter:v,reflect:!1,hasChanged:x},I=(e=$,t,
|
|
|
776
883
|
|
|
777
884
|
<div class="dialog-actions">
|
|
778
885
|
<button class="btn btn-cancel" @click="${this._handleCancel}">
|
|
779
|
-
${
|
|
886
|
+
${T.t("column.cancel")}
|
|
780
887
|
</button>
|
|
781
888
|
<button
|
|
782
889
|
class="btn btn-primary"
|
|
783
890
|
?disabled="${!t}"
|
|
784
891
|
@click="${this._handleConfirm}"
|
|
785
892
|
>
|
|
786
|
-
${
|
|
893
|
+
${T.t("column.addColumn")}
|
|
787
894
|
</button>
|
|
788
895
|
</div>
|
|
789
896
|
</div>
|
|
@@ -810,7 +917,7 @@ const $={attribute:!0,type:String,converter:v,reflect:!1,hasChanged:x},I=(e=$,t,
|
|
|
810
917
|
}
|
|
811
918
|
|
|
812
919
|
.dialog {
|
|
813
|
-
background:
|
|
920
|
+
background: var(--bg-color-2, var(--jupiter-card-background, #fff));
|
|
814
921
|
border-radius: 8px;
|
|
815
922
|
padding: 24px;
|
|
816
923
|
min-width: 400px;
|
|
@@ -835,7 +942,7 @@ const $={attribute:!0,type:String,converter:v,reflect:!1,hasChanged:x},I=(e=$,t,
|
|
|
835
942
|
.dialog-title {
|
|
836
943
|
font-size: 20px;
|
|
837
944
|
font-weight: 600;
|
|
838
|
-
color: var(--jupiter-text-primary, #333);
|
|
945
|
+
color: var(--primaryTextColor, var(--jupiter-text-primary, #333));
|
|
839
946
|
margin: 0 0 8px 0;
|
|
840
947
|
}
|
|
841
948
|
|
|
@@ -869,7 +976,7 @@ const $={attribute:!0,type:String,converter:v,reflect:!1,hasChanged:x},I=(e=$,t,
|
|
|
869
976
|
display: block;
|
|
870
977
|
font-weight: 500;
|
|
871
978
|
margin-bottom: 6px;
|
|
872
|
-
color: var(--jupiter-text-primary, #333);
|
|
979
|
+
color: var(--primaryTextColor, var(--jupiter-text-primary, #333));
|
|
873
980
|
font-size: 14px;
|
|
874
981
|
}
|
|
875
982
|
|
|
@@ -882,18 +989,20 @@ const $={attribute:!0,type:String,converter:v,reflect:!1,hasChanged:x},I=(e=$,t,
|
|
|
882
989
|
width: 100%;
|
|
883
990
|
box-sizing: border-box;
|
|
884
991
|
padding: 10px 12px;
|
|
885
|
-
border: 1px solid var(--jupiter-border-color, #ddd);
|
|
992
|
+
border: 1px solid var(--primaryTextColor, var(--jupiter-border-color, #ddd));
|
|
886
993
|
border-radius: 4px;
|
|
887
994
|
font-size: 14px;
|
|
888
995
|
font-family: inherit;
|
|
889
996
|
transition: border-color 0.2s ease;
|
|
997
|
+
background-color: transparent;
|
|
998
|
+
color: var(--primaryTextColor, var(--jupiter-text-primary, #333));
|
|
890
999
|
}
|
|
891
1000
|
|
|
892
|
-
.form-input:focus {
|
|
893
|
-
|
|
894
|
-
|
|
895
|
-
|
|
896
|
-
}
|
|
1001
|
+
// .form-input:focus {
|
|
1002
|
+
// outline: none;
|
|
1003
|
+
// border-color: var(--jupiter-primary-color, #007bff);
|
|
1004
|
+
// box-shadow: 0 0 0 2px rgba(0, 123, 255, 0.25);
|
|
1005
|
+
// }
|
|
897
1006
|
|
|
898
1007
|
select.form-input {
|
|
899
1008
|
cursor: pointer;
|
|
@@ -921,27 +1030,28 @@ const $={attribute:!0,type:String,converter:v,reflect:!1,hasChanged:x},I=(e=$,t,
|
|
|
921
1030
|
}
|
|
922
1031
|
|
|
923
1032
|
.btn-cancel {
|
|
924
|
-
|
|
925
|
-
|
|
1033
|
+
color: var(--buttonBgColor, var(--jupiter-primary-color, #1976d2));
|
|
1034
|
+
border: 1px solid var(--buttonBgColor, var(--jupiter-primary-color, #1976d2)) !important;
|
|
1035
|
+
background: transparent;
|
|
926
1036
|
}
|
|
927
1037
|
|
|
928
|
-
.btn-cancel:hover {
|
|
929
|
-
|
|
930
|
-
}
|
|
1038
|
+
// .btn-cancel:hover {
|
|
1039
|
+
// background: var(--jupiter-neutral-background-hover, #e0e0e0);
|
|
1040
|
+
// }
|
|
931
1041
|
|
|
932
1042
|
.btn-primary {
|
|
933
|
-
background: var(--jupiter-primary-color, #
|
|
934
|
-
color: white;
|
|
1043
|
+
background: var(--buttonBgColor, var(--jupiter-primary-color, #1976d2));
|
|
1044
|
+
color: var(--buttonTextColor, white);
|
|
935
1045
|
}
|
|
936
1046
|
|
|
937
|
-
.btn-primary:hover {
|
|
938
|
-
|
|
939
|
-
}
|
|
1047
|
+
// .btn-primary:hover {
|
|
1048
|
+
// background: var(--jupiter-primary-color-dark, #5a6fd8);
|
|
1049
|
+
// }
|
|
940
1050
|
|
|
941
|
-
.btn-primary:disabled {
|
|
942
|
-
|
|
943
|
-
|
|
944
|
-
}
|
|
1051
|
+
// .btn-primary:disabled {
|
|
1052
|
+
// background: var(--jupiter-disabled-background, #ccc);
|
|
1053
|
+
// cursor: not-allowed;
|
|
1054
|
+
// }
|
|
945
1055
|
|
|
946
1056
|
/* Dimension Selection Styles */
|
|
947
1057
|
.dimensions-section {
|
|
@@ -1044,7 +1154,35 @@ const $={attribute:!0,type:String,converter:v,reflect:!1,hasChanged:x},I=(e=$,t,
|
|
|
1044
1154
|
margin: 0 0 12px 0;
|
|
1045
1155
|
line-height: 1.4;
|
|
1046
1156
|
}
|
|
1047
|
-
`,
|
|
1157
|
+
`,W([S({type:String})],exports.JupiterAddColumnDialog.prototype,"periodType",2),W([S({type:Boolean})],exports.JupiterAddColumnDialog.prototype,"open",2),W([S({type:Array})],exports.JupiterAddColumnDialog.prototype,"availableDimensions",2),W([S({type:String})],exports.JupiterAddColumnDialog.prototype,"periodStartDate",2),W([S({type:String})],exports.JupiterAddColumnDialog.prototype,"periodEndDate",2),W([w()],exports.JupiterAddColumnDialog.prototype,"_startDate",2),W([w()],exports.JupiterAddColumnDialog.prototype,"_endDate",2),W([w()],exports.JupiterAddColumnDialog.prototype,"_instantDate",2),W([w()],exports.JupiterAddColumnDialog.prototype,"_selectedType",2),W([w()],exports.JupiterAddColumnDialog.prototype,"_selectedDimensions",2),exports.JupiterAddColumnDialog=W([t("jupiter-add-column-dialog")],exports.JupiterAddColumnDialog);var G=Object.defineProperty,X=Object.getOwnPropertyDescriptor,Z=(e,t,i,o)=>{for(var r,n=o>1?void 0:o?X(t,i):t,s=e.length-1;s>=0;s--)(r=e[s])&&(n=(o?r(t,i,n):r(n))||n);return o&&n&&G(t,i,n),n};exports.JupiterFormSection=class extends e.LitElement{constructor(){super(...arguments),this.columns=[],this.formData={},this.periodData={},this.unitData={},this.typedMemberData={},this.repeatCounts={},this.defaultUnits=[],this.disabled=!1,this.collapsible=!0,this.locale="en-US",this.isFirstSection=!1,this.availableDimensions=[],this.hideHeader=!1,this.mode="inputForm",this.periodStartDate="",this.periodEndDate="",this._expanded=!0,this._showAddColumnDialog=!1,this._sectionPeriodType="duration",this._openMenuColumnId=null,this._insertAfterColumnId=null,this._expandedConcepts=new Set,this._allTreeExpanded=!1}connectedCallback(){super.connectedCallback(),this._expanded=!1!==this.section.expanded,this._determinePeriodType(),this._checkAndExpandFirstSection(),document.addEventListener("click",()=>this._closeColumnMenu())}disconnectedCallback(){super.disconnectedCallback(),document.removeEventListener("click",()=>this._closeColumnMenu())}updated(e){super.updated(e),(e.has("isFirstSection")||e.has("section"))&&this._checkAndExpandFirstSection()}_checkAndExpandFirstSection(){this.isFirstSection&&this.section&&this.section.concepts&&(this._expanded=!0,setTimeout(()=>{this._expandAllTrees(),console.log("🎯 First section detected - expanded section and tree by default")},0))}_determinePeriodType(){const e=this._getAllNonAbstractConcepts(this.section.concepts);if(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(0===t.size)this._sectionPeriodType="duration";else if(1===t.size){const e=Array.from(t)[0];this._sectionPeriodType="instant"===e?"instant":"duration"}else this._sectionPeriodType="mixed"}_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._expanded&&this._expandAllTrees(),this.dispatchEvent(new CustomEvent("section-expand",{detail:{sectionId:this.section.id,expanded:this._expanded},bubbles:!0})))}_handleRemoveColumn(e){this._openMenuColumnId=null,this.dispatchEvent(new CustomEvent("column-remove",{detail:{columnId:e,sectionId:this.section.id},bubbles:!0}))}_toggleColumnMenu(e,t){t.stopPropagation(),this._openMenuColumnId=this._openMenuColumnId===e?null:e}_closeColumnMenu(){this._openMenuColumnId=null}_handleAddColumnFromMenu(e,t){t.stopPropagation(),this._openMenuColumnId=null,this._insertAfterColumnId=e,this._handleAddColumn()}_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,insertAfterColumnId:this._insertAfterColumnId},bubbles:!0})),this._insertAfterColumnId=null}_handleFieldChange(e){e.stopPropagation(),this.dispatchEvent(new CustomEvent("field-change",{detail:e.detail,bubbles:!0,composed:!0}))}_handlePeriodChange(e){console.log("📋 [FormSection] Received period-change event:",e.detail),e.stopPropagation(),this.dispatchEvent(new CustomEvent("period-change",{detail:e.detail,bubbles:!0,composed:!0})),console.log("📋 [FormSection] Forwarded period-change event to dynamic-form")}_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}_isConceptRowBlank(e){var t;for(const i of this.columns){const o=null==(t=this.formData[e.id])?void 0:t[i.id];if(null!=o&&""!==o)return!1}return!0}_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()}_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}))}_handleAddRepeat(e){e.stopPropagation(),this.dispatchEvent(new CustomEvent("add-concept-repeat",{detail:e.detail,bubbles:!0}))}_handleRemoveRepeat(e){e.stopPropagation(),this.dispatchEvent(new CustomEvent("remove-concept-repeat",{detail:e.detail,bubbles:!0}))}_renderConceptRows(t){var i;const o="readonly"!==this.mode&&!t.abstract&&(null==(i=t.fields)?void 0:i.some(e=>{var t;return(null==(t=e.crossRoleTypedMembers)?void 0:t.length)>0})),r=o&&this.repeatCounts[t.id]||0,n=(t,i)=>e.html`
|
|
1158
|
+
<jupiter-concept-tree
|
|
1159
|
+
.concept="${t}"
|
|
1160
|
+
.columns="${this.columns}"
|
|
1161
|
+
.datatypes="${this.datatypes}"
|
|
1162
|
+
.formData="${this.formData}"
|
|
1163
|
+
.periodData="${this.periodData}"
|
|
1164
|
+
.unitData="${this.unitData}"
|
|
1165
|
+
.defaultUnits="${this.defaultUnits}"
|
|
1166
|
+
.disabled="${this.disabled}"
|
|
1167
|
+
.locale="${this.locale}"
|
|
1168
|
+
.expandedConcepts="${this._expandedConcepts}"
|
|
1169
|
+
.mode="${this.mode}"
|
|
1170
|
+
.masterData="${this.masterData}"
|
|
1171
|
+
.facts="${t.facts}"
|
|
1172
|
+
.typedMemberData="${this.typedMemberData}"
|
|
1173
|
+
.showAddButton="${i.showAdd||!1}"
|
|
1174
|
+
.showRemoveButton="${i.showRemove||!1}"
|
|
1175
|
+
@field-change="${this._handleFieldChange}"
|
|
1176
|
+
@period-change="${this._handlePeriodChange}"
|
|
1177
|
+
@concept-expand="${this._handleConceptExpand}"
|
|
1178
|
+
@add-concept-repeat="${this._handleAddRepeat}"
|
|
1179
|
+
@remove-concept-repeat="${this._handleRemoveRepeat}"
|
|
1180
|
+
></jupiter-concept-tree>
|
|
1181
|
+
`,s=[e.html`
|
|
1182
|
+
<tr>${n(t,{showAdd:o})}</tr>
|
|
1183
|
+
`];for(let l=1;l<=r;l++){const i={...t,id:`${t.id}__repeat_${l}`,label:"",children:[],abstract:!1};s.push(e.html`
|
|
1184
|
+
<tr>${n(i,{showRemove:!0})}</tr>
|
|
1185
|
+
`)}return s}render(){return this.section.concepts&&0!==this.section.concepts.length?e.html`
|
|
1048
1186
|
${this.hideHeader?"":e.html`
|
|
1049
1187
|
<div class="section-header ${this.collapsible?"":"not-collapsible"}"
|
|
1050
1188
|
@click="${this._toggleExpanded}">
|
|
@@ -1089,7 +1227,7 @@ const $={attribute:!0,type:String,converter:v,reflect:!1,hasChanged:x},I=(e=$,t,
|
|
|
1089
1227
|
<input
|
|
1090
1228
|
type="text"
|
|
1091
1229
|
class="typed-member-header-field"
|
|
1092
|
-
placeholder="${
|
|
1230
|
+
placeholder="${T.t("section.enterPlaceholder")} ${i.axisLabel}"
|
|
1093
1231
|
.value="${this._getTypedMemberHeaderValue(t.id,i.axisId)}"
|
|
1094
1232
|
@input="${e=>this._handleTypedMemberHeaderChange(e,t.id,i.axisId)}"
|
|
1095
1233
|
/>
|
|
@@ -1105,7 +1243,7 @@ const $={attribute:!0,type:String,converter:v,reflect:!1,hasChanged:x},I=(e=$,t,
|
|
|
1105
1243
|
<div
|
|
1106
1244
|
class="column-menu-icon"
|
|
1107
1245
|
@click="${e=>this._toggleColumnMenu(t.id,e)}"
|
|
1108
|
-
title="${
|
|
1246
|
+
title="${T.t("column.columnOptions")}"
|
|
1109
1247
|
>⋮</div>
|
|
1110
1248
|
|
|
1111
1249
|
<!-- Context menu -->
|
|
@@ -1115,14 +1253,14 @@ const $={attribute:!0,type:String,converter:v,reflect:!1,hasChanged:x},I=(e=$,t,
|
|
|
1115
1253
|
class="column-context-menu-item"
|
|
1116
1254
|
@click="${e=>this._handleAddColumnFromMenu(t.id,e)}"
|
|
1117
1255
|
>
|
|
1118
|
-
${
|
|
1256
|
+
${T.t("column.addColumn")}
|
|
1119
1257
|
</button>
|
|
1120
1258
|
${t.removable?e.html`
|
|
1121
1259
|
<button
|
|
1122
1260
|
class="column-context-menu-item remove"
|
|
1123
1261
|
@click="${e=>{e.stopPropagation(),this._handleRemoveColumn(t.id)}}"
|
|
1124
1262
|
>
|
|
1125
|
-
${
|
|
1263
|
+
${T.t("column.removeColumn")}
|
|
1126
1264
|
</button>
|
|
1127
1265
|
`:""}
|
|
1128
1266
|
</div>
|
|
@@ -1133,28 +1271,7 @@ const $={attribute:!0,type:String,converter:v,reflect:!1,hasChanged:x},I=(e=$,t,
|
|
|
1133
1271
|
</tr>
|
|
1134
1272
|
</thead>
|
|
1135
1273
|
<tbody class="table-body">
|
|
1136
|
-
${this._flattenConcepts(this.section.concepts,this._expandedConcepts).filter(e=>"readonly"!==this.mode||!this._isConceptRowBlank(e)).
|
|
1137
|
-
<tr>
|
|
1138
|
-
<jupiter-concept-tree
|
|
1139
|
-
.concept="${t}"
|
|
1140
|
-
.columns="${this.columns}"
|
|
1141
|
-
.datatypes="${this.datatypes}"
|
|
1142
|
-
.formData="${this.formData}"
|
|
1143
|
-
.periodData="${this.periodData}"
|
|
1144
|
-
.unitData="${this.unitData}"
|
|
1145
|
-
.defaultUnits="${this.defaultUnits}"
|
|
1146
|
-
.disabled="${this.disabled}"
|
|
1147
|
-
.locale="${this.locale}"
|
|
1148
|
-
.expandedConcepts="${this._expandedConcepts}"
|
|
1149
|
-
.mode="${this.mode}"
|
|
1150
|
-
.masterData="${this.masterData}"
|
|
1151
|
-
.facts="${t.facts}"
|
|
1152
|
-
@field-change="${this._handleFieldChange}"
|
|
1153
|
-
@period-change="${this._handlePeriodChange}"
|
|
1154
|
-
@concept-expand="${this._handleConceptExpand}"
|
|
1155
|
-
></jupiter-concept-tree>
|
|
1156
|
-
</tr>
|
|
1157
|
-
`)}
|
|
1274
|
+
${this._flattenConcepts(this.section.concepts,this._expandedConcepts).filter(e=>"readonly"!==this.mode||!this._isConceptRowBlank(e)).flatMap(e=>this._renderConceptRows(e))}
|
|
1158
1275
|
</tbody>
|
|
1159
1276
|
</table>
|
|
1160
1277
|
</div>
|
|
@@ -1293,13 +1410,20 @@ const $={attribute:!0,type:String,converter:v,reflect:!1,hasChanged:x},I=(e=$,t,
|
|
|
1293
1410
|
/* Table row - no special display needed */
|
|
1294
1411
|
}
|
|
1295
1412
|
|
|
1413
|
+
.header-cell:first-child {
|
|
1414
|
+
border-radius: 6px 0 0 0;
|
|
1415
|
+
}
|
|
1416
|
+
.header-cell:last-child {
|
|
1417
|
+
border-radius: 0 6px 0 0;
|
|
1418
|
+
}
|
|
1419
|
+
|
|
1296
1420
|
.header-cell {
|
|
1297
1421
|
padding: 8px 12px;
|
|
1298
1422
|
text-align: left;
|
|
1299
1423
|
font-weight: 600;
|
|
1300
|
-
color: var(--jupiter-text-primary, #333);
|
|
1301
|
-
border: 1px solid var(--jupiter-border-color, #ddd);
|
|
1302
|
-
background: var(--jupiter-header-background, #f8f9fa);
|
|
1424
|
+
color: var(--primaryTextColor, var(--jupiter-text-primary, #333));
|
|
1425
|
+
border: 1px solid var(--primaryTextColor, var(--jupiter-border-color, #ddd));
|
|
1426
|
+
background: var(--bg-color-1, var(--jupiter-header-background, #f8f9fa));
|
|
1303
1427
|
min-width: 180px;
|
|
1304
1428
|
width: 180px;
|
|
1305
1429
|
font-size: 14px;
|
|
@@ -1449,14 +1573,14 @@ const $={attribute:!0,type:String,converter:v,reflect:!1,hasChanged:x},I=(e=$,t,
|
|
|
1449
1573
|
color: var(--jupiter-text-secondary, #666);
|
|
1450
1574
|
font-style: italic;
|
|
1451
1575
|
}
|
|
1452
|
-
`,Z([S({type:Object})],exports.JupiterFormSection.prototype,"section",2),Z([S({type:Array})],exports.JupiterFormSection.prototype,"columns",2),Z([S({type:Array})],exports.JupiterFormSection.prototype,"datatypes",2),Z([S({type:Object})],exports.JupiterFormSection.prototype,"formData",2),Z([S({type:Object})],exports.JupiterFormSection.prototype,"periodData",2),Z([S({type:Object})],exports.JupiterFormSection.prototype,"unitData",2),Z([S({type:Object})],exports.JupiterFormSection.prototype,"typedMemberData",2),Z([S({type:Array})],exports.JupiterFormSection.prototype,"defaultUnits",2),Z([S({type:Boolean})],exports.JupiterFormSection.prototype,"disabled",2),Z([S({type:Boolean})],exports.JupiterFormSection.prototype,"collapsible",2),Z([S({type:String})],exports.JupiterFormSection.prototype,"locale",2),Z([S({type:Boolean})],exports.JupiterFormSection.prototype,"isFirstSection",2),Z([S({type:Array})],exports.JupiterFormSection.prototype,"availableDimensions",2),Z([S({type:Boolean})],exports.JupiterFormSection.prototype,"hideHeader",2),Z([S({type:String})],exports.JupiterFormSection.prototype,"mode",2),Z([S({type:Object})],exports.JupiterFormSection.prototype,"masterData",2),Z([S({type:String})],exports.JupiterFormSection.prototype,"periodStartDate",2),Z([S({type:String})],exports.JupiterFormSection.prototype,"periodEndDate",2),Z([w()],exports.JupiterFormSection.prototype,"_expanded",2),Z([w()],exports.JupiterFormSection.prototype,"_showAddColumnDialog",2),Z([w()],exports.JupiterFormSection.prototype,"_sectionPeriodType",2),Z([w()],exports.JupiterFormSection.prototype,"_openMenuColumnId",2),Z([w()],exports.JupiterFormSection.prototype,"_insertAfterColumnId",2),Z([w()],exports.JupiterFormSection.prototype,"_expandedConcepts",2),Z([w()],exports.JupiterFormSection.prototype,"_allTreeExpanded",2),exports.JupiterFormSection=Z([t("jupiter-form-section")],exports.JupiterFormSection);var ee=Object.defineProperty,te=Object.getOwnPropertyDescriptor,ie=(e,t,i,o)=>{for(var r,n=o>1?void 0:o?te(t,i):t,s=e.length-1;s>=0;s--)(r=e[s])&&(n=(o?r(t,i,n):r(n))||n);return o&&n&&ee(t,i,n),n};exports.JupiterFilterRolesDialog=class extends e.LitElement{constructor(){super(...arguments),this.open=!1,this.availableRoles=[],this.selectedRoleIds=[],this.periodPreferences={},this.mode="user",this.hypercubeData=null,this._tempSelectedRoles=new Set,this._searchQuery="",this._filteredRoles=[],this._tempPeriodPreferences={},this._selectedAvailableRole=null,this._selectedChosenRole=null,this._chosenSearchQuery="",this._draggedRoleId=null,this._dragOverRoleId=null,this._chosenRoleOrder=[]}connectedCallback(){super.connectedCallback(),this._initializeTempSelection(),this._initializePeriodPreferences()}updated(e){(e.has("selectedRoleIds")||e.has("open"))&&this._initializeTempSelection(),(e.has("availableRoles")||e.has("_searchQuery"))&&this._updateFilteredRoles(),(e.has("availableRoles")||e.has("periodPreferences")||e.has("open"))&&this._initializePeriodPreferences()}_updateFilteredRoles(){if(!this._searchQuery.trim())return void(this._filteredRoles=[...this.availableRoles]);const e=this._searchQuery.toLowerCase().trim(),t=this.availableRoles.filter(t=>{var i;const o=t.title.toLowerCase().includes(e),r=t.id.toLowerCase().includes(e),n=(null==(i=t.description)?void 0:i.toLowerCase().includes(e))||!1,s=this._searchInRoleURI(t,e);return o||r||n||s});this._filteredRoles=t}_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),n=o.test(e.id);return r||n?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())}_handleChosenSearchInput(e){const t=e.target;this._chosenSearchQuery=t.value}_clearChosenSearch(){var e;this._chosenSearchQuery="";const t=null==(e=this.shadowRoot)?void 0:e.querySelector(".chosen-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),this._chosenRoleOrder=[...this.selectedRoleIds]}_initializePeriodPreferences(){const e={};this.availableRoles.forEach(t=>{const i=this.periodPreferences[t.id];if(i)e[t.id]={...i};else{const i=!0===t.showPeriodControl;let o,r;void 0!==t.duration||void 0!==t.instant?(o=!0===t.duration,r=!0===t.instant):(o=i||this._hasConceptsWithPeriodType(t,"duration"),r=i||this._hasConceptsWithPeriodType(t,"instant")),e[t.id]={showDuration:o,showInstant:r,showPreviousYear:!0===t.showPreviousYear}}const o=this._getDimensionsForRole(t.id);o.length>0&&!(null==i?void 0:i.dimensionSelections)&&(e[t.id].dimensionSelections||(e[t.id].dimensionSelections=[]),o.forEach(i=>{var o,r;const n=this._getAllDimensionMembers(i.members);if(n.length>0){const s=(null==(r=null==(o=i.labels)?void 0:o.find(e=>"http://www.xbrl.org/2003/role/label"===e.role))?void 0:r.label)||i.conceptName,l=n.map(e=>e.id),a={dimensionId:i.id,dimensionLabel:s,selectedMemberIds:l};e[t.id].dimensionSelections.push(a),console.log(`✅ Auto-selected all ${l.length} members for dimension: ${s}`)}}))}),this._tempPeriodPreferences=e}_hasConceptsWithPeriodType(e,t){const i=e=>e.some(e=>!e.abstract&&e.periodType===t||!!e.children&&i(e.children));return i(e.concepts)}_handlePeriodCheckboxChange(e,t,i){e.stopPropagation();const o=e.target,r={...this._tempPeriodPreferences};r[t]||(r[t]={showDuration:!0,showInstant:!0,showPreviousYear:!1}),"duration"===i?r[t].showDuration=o.checked:"instant"===i?r[t].showInstant=o.checked:"previousYear"===i&&(r[t].showPreviousYear=o.checked),this._tempPeriodPreferences=r,this.requestUpdate()}_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=this._chosenRoleOrder.filter(e=>this._tempSelectedRoles.has(e)),t=Array.from(this._tempSelectedRoles).filter(e=>!this._chosenRoleOrder.includes(e));this._chosenRoleOrder=[...e,...t];const i=this._chosenRoleOrder.map((e,t)=>{var i;const o=this.availableRoles.find(t=>t.id===e);return{roleId:e,roleURI:(null==(i=null==o?void 0:o.metadata)?void 0:i.roleURI)||"",order:t}});console.log("✅ Apply Filter - Enhanced structure being emitted:",i),console.log("📋 Order array:",this._chosenRoleOrder),console.log("📊 Dimension preferences being emitted:",this._tempPeriodPreferences),this.dispatchEvent(new CustomEvent("roles-filter-apply",{detail:{selectedRoleIds:i,periodPreferences:this._tempPeriodPreferences},bubbles:!0}))}_getDimensionsForRole(e){var t,i;if(console.log("🔍 [getDimensionsForRole] Called with roleId:",e),console.log("🔍 [getDimensionsForRole] hypercubeData exists:",!!this.hypercubeData),console.log("🔍 [getDimensionsForRole] hypercubeData type:",typeof this.hypercubeData),console.log("🔍 [getDimensionsForRole] hypercubeData value:",this.hypercubeData),!this.hypercubeData)return console.error("❌ [getDimensionsForRole] CRITICAL: hypercubeData is null/undefined/false"),console.error("❌ Parent component must pass hypercubeData property to filter dialog!"),console.error('❌ Example: <jupiter-filter-roles-dialog .hypercubeData="${hypercubeData}">'),[];let o=this.hypercubeData;if(Array.isArray(this.hypercubeData)&&this.hypercubeData.length>0&&(console.log("📦 [getDimensionsForRole] Detected array-wrapped format, unwrapping..."),o=this.hypercubeData[0]),console.log("🔍 [getDimensionsForRole] hypercubeDataObj.roles exists:",!!(null==o?void 0:o.roles)),!(null==o?void 0:o.roles))return console.warn("⚠️ [getDimensionsForRole] No roles found in hypercube data structure"),console.warn("⚠️ Expected structure: { roles: [...] } or [{ roles: [...] }]"),[];console.log("🔍 [getDimensionsForRole] Available hypercube roles:",o.roles.map(e=>e.roleId));const r=o.roles.find(t=>t.roleId===e);if(console.log("🔍 [getDimensionsForRole] Found hypercube role:",!!r),!(null==(t=null==r?void 0:r.items)?void 0:t.length))return console.warn("⚠️ [getDimensionsForRole] No items found in hypercube role for:",e),[];console.log("🔍 [getDimensionsForRole] Items count:",r.items.length);const n=(null==(i=r.items[0])?void 0:i.dimensions)||[];console.log("🔍 [getDimensionsForRole] Total dimensions found:",n.length),console.log("🔍 [getDimensionsForRole] Dimension details:",n.map(e=>{var t;return{id:e.id,type:e.dimensionType,hasMembers:!!(e.members&&e.members.length>0),membersCount:(null==(t=e.members)?void 0:t.length)||0}}));const s=n.filter(e=>"explicit"===e.dimensionType&&e.members&&Array.isArray(e.members)&&e.members.length>0);return console.log("✅ [getDimensionsForRole] Filtered dimensions count:",s.length),console.log("✅ [getDimensionsForRole] Filtered dimension IDs:",s.map(e=>e.id)),s}_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}_isSingleMemberDimension(e){return 1===this._getAllDimensionMembers(e.members).length}_handleDimensionMemberChange(e,t,i,o){var r,n;e.stopPropagation();const s=e.target,l={...this._tempPeriodPreferences};l[t]||(l[t]={showDuration:!0,showInstant:!0,showPreviousYear:!1,dimensionSelections:[]}),l[t].dimensionSelections||(l[t].dimensionSelections=[]);let a=l[t].dimensionSelections.find(e=>e.dimensionId===i);if(!a){const e=this._getDimensionsForRole(t).find(e=>e.id===i),o=(null==(n=null==(r=null==e?void 0:e.labels)?void 0:r.find(e=>"http://www.xbrl.org/2003/role/label"===e.role))?void 0:n.label)||i;a={dimensionId:i,dimensionLabel:o,selectedMemberIds:[]},l[t].dimensionSelections.push(a)}s.checked?a.selectedMemberIds.includes(o)||a.selectedMemberIds.push(o):a.selectedMemberIds=a.selectedMemberIds.filter(e=>e!==o),this._tempPeriodPreferences=l,console.log("📊 Updated dimension selections:",l[t].dimensionSelections),this.requestUpdate()}_isDimensionMemberSelected(e,t,i){const o=this._tempPeriodPreferences[e];if(!(null==o?void 0:o.dimensionSelections))return!1;const r=o.dimensionSelections.find(e=>e.dimensionId===t);return(null==r?void 0:r.selectedMemberIds.includes(i))||!1}_selectAllDimensionMembers(e,t){var i,o;const r=this._getDimensionsForRole(e).find(e=>e.id===t);if(!r)return;const n=this._getAllDimensionMembers(r.members).map(e=>e.id),s={...this._tempPeriodPreferences};s[e]||(s[e]={showDuration:!0,showInstant:!0,showPreviousYear:!1,dimensionSelections:[]}),s[e].dimensionSelections||(s[e].dimensionSelections=[]);let l=s[e].dimensionSelections.find(e=>e.dimensionId===t);if(!l){const n=(null==(o=null==(i=r.labels)?void 0:i.find(e=>"http://www.xbrl.org/2003/role/label"===e.role))?void 0:o.label)||t;l={dimensionId:t,dimensionLabel:n,selectedMemberIds:[]},s[e].dimensionSelections.push(l)}l.selectedMemberIds=n,this._tempPeriodPreferences=s,this.requestUpdate()}_deselectAllDimensionMembers(e,t){var i;const o={...this._tempPeriodPreferences};if(!(null==(i=o[e])?void 0:i.dimensionSelections))return;const r=o[e].dimensionSelections.find(e=>e.dimensionId===t);r&&(r.selectedMemberIds=[]),this._tempPeriodPreferences=o,this.requestUpdate()}_handleBackdropClick(e){e.target===this&&this._handleCancel()}_handleAvailableRoleClick(e){this._selectedAvailableRole=e,this._selectedChosenRole=null,this.requestUpdate()}_handleChosenRoleClick(e){this._selectedChosenRole=e,this._selectedAvailableRole=null,this.requestUpdate()}_moveToChosen(){if(!this._selectedAvailableRole)return;const e=new Set(this._tempSelectedRoles);e.add(this._selectedAvailableRole),this._tempSelectedRoles=e,this._chosenRoleOrder.includes(this._selectedAvailableRole)||(this._chosenRoleOrder=[...this._chosenRoleOrder,this._selectedAvailableRole]),this._selectedAvailableRole=null,this.requestUpdate()}_moveToAvailable(){if(!this._selectedChosenRole)return;const e=new Set(this._tempSelectedRoles);e.delete(this._selectedChosenRole),this._tempSelectedRoles=e,this._chosenRoleOrder=this._chosenRoleOrder.filter(e=>e!==this._selectedChosenRole),this._selectedChosenRole=null,this.requestUpdate()}_moveAllToChosen(){const e=new Set(this._tempSelectedRoles);this._filteredRoles.forEach(t=>{e.add(t.id),this._chosenRoleOrder.includes(t.id)||this._chosenRoleOrder.push(t.id)}),this._tempSelectedRoles=e,this._selectedAvailableRole=null,this.requestUpdate()}_moveAllToAvailable(){this._tempSelectedRoles=new Set,this._chosenRoleOrder=[],this._selectedChosenRole=null,this.requestUpdate()}_getAvailableRoles(){return this._filteredRoles.filter(e=>!this._tempSelectedRoles.has(e.id))}_getChosenRoles(){const e=this.availableRoles.filter(e=>this._tempSelectedRoles.has(e.id)),t=[...this._chosenRoleOrder.map(t=>e.find(e=>e.id===t)).filter(e=>void 0!==e),...e.filter(e=>!this._chosenRoleOrder.includes(e.id))];if(!this._chosenSearchQuery.trim())return t;const i=this._chosenSearchQuery.toLowerCase().trim();return t.filter(e=>{var t;const o=e.title.toLowerCase().includes(i),r=e.id.toLowerCase().includes(i),n=(null==(t=e.description)?void 0:t.toLowerCase().includes(i))||!1,s=this._searchInRoleURI(e,i);return o||r||n||s})}_handleDragStart(e,t){this._draggedRoleId=t,e.dataTransfer&&(e.dataTransfer.effectAllowed="move",e.dataTransfer.setData("text/plain",t)),this.requestUpdate()}_handleDragOver(e,t){e.preventDefault(),e.dataTransfer&&(e.dataTransfer.dropEffect="move"),this._draggedRoleId&&this._draggedRoleId!==t&&(this._dragOverRoleId=t,this.requestUpdate())}_handleDragLeave(e){this._dragOverRoleId=null,this.requestUpdate()}_handleDrop(e,t){if(e.preventDefault(),!this._draggedRoleId||this._draggedRoleId===t)return this._draggedRoleId=null,this._dragOverRoleId=null,void this.requestUpdate();const i=[...this._chosenRoleOrder],o=i.indexOf(this._draggedRoleId),r=i.indexOf(t);if(-1!==o&&-1!==r){i.splice(o,1);const e=o<r?r-1:r;i.splice(e,0,this._draggedRoleId),this._chosenRoleOrder=i,console.log("🔄 Reordered roles:",this._chosenRoleOrder)}this._draggedRoleId=null,this._dragOverRoleId=null,this.requestUpdate()}_handleDragEnd(e){this._draggedRoleId=null,this._dragOverRoleId=null,this.requestUpdate()}render(){const t=this._tempSelectedRoles.size,i=this.availableRoles.length,o=this._filteredRoles.length,r=this._searchQuery.trim().length>0;return e.html`
|
|
1576
|
+
`,Z([S({type:Object})],exports.JupiterFormSection.prototype,"section",2),Z([S({type:Array})],exports.JupiterFormSection.prototype,"columns",2),Z([S({type:Array})],exports.JupiterFormSection.prototype,"datatypes",2),Z([S({type:Object})],exports.JupiterFormSection.prototype,"formData",2),Z([S({type:Object})],exports.JupiterFormSection.prototype,"periodData",2),Z([S({type:Object})],exports.JupiterFormSection.prototype,"unitData",2),Z([S({type:Object})],exports.JupiterFormSection.prototype,"typedMemberData",2),Z([S({type:Object})],exports.JupiterFormSection.prototype,"repeatCounts",2),Z([S({type:Array})],exports.JupiterFormSection.prototype,"defaultUnits",2),Z([S({type:Boolean})],exports.JupiterFormSection.prototype,"disabled",2),Z([S({type:Boolean})],exports.JupiterFormSection.prototype,"collapsible",2),Z([S({type:String})],exports.JupiterFormSection.prototype,"locale",2),Z([S({type:Boolean})],exports.JupiterFormSection.prototype,"isFirstSection",2),Z([S({type:Array})],exports.JupiterFormSection.prototype,"availableDimensions",2),Z([S({type:Boolean})],exports.JupiterFormSection.prototype,"hideHeader",2),Z([S({type:String})],exports.JupiterFormSection.prototype,"mode",2),Z([S({type:Object})],exports.JupiterFormSection.prototype,"masterData",2),Z([S({type:String})],exports.JupiterFormSection.prototype,"periodStartDate",2),Z([S({type:String})],exports.JupiterFormSection.prototype,"periodEndDate",2),Z([w()],exports.JupiterFormSection.prototype,"_expanded",2),Z([w()],exports.JupiterFormSection.prototype,"_showAddColumnDialog",2),Z([w()],exports.JupiterFormSection.prototype,"_sectionPeriodType",2),Z([w()],exports.JupiterFormSection.prototype,"_openMenuColumnId",2),Z([w()],exports.JupiterFormSection.prototype,"_insertAfterColumnId",2),Z([w()],exports.JupiterFormSection.prototype,"_expandedConcepts",2),Z([w()],exports.JupiterFormSection.prototype,"_allTreeExpanded",2),exports.JupiterFormSection=Z([t("jupiter-form-section")],exports.JupiterFormSection);var ee=Object.defineProperty,te=Object.getOwnPropertyDescriptor,ie=(e,t,i,o)=>{for(var r,n=o>1?void 0:o?te(t,i):t,s=e.length-1;s>=0;s--)(r=e[s])&&(n=(o?r(t,i,n):r(n))||n);return o&&n&&ee(t,i,n),n};exports.JupiterFilterRolesDialog=class extends e.LitElement{constructor(){super(...arguments),this.open=!1,this.availableRoles=[],this.selectedRoleIds=[],this.periodPreferences={},this.mode="user",this.hypercubeData=null,this._tempSelectedRoles=new Set,this._searchQuery="",this._filteredRoles=[],this._tempPeriodPreferences={},this._selectedAvailableRole=null,this._selectedChosenRole=null,this._chosenSearchQuery="",this._draggedRoleId=null,this._dragOverRoleId=null,this._chosenRoleOrder=[]}connectedCallback(){super.connectedCallback(),this._initializeTempSelection(),this._initializePeriodPreferences()}updated(e){(e.has("selectedRoleIds")||e.has("open"))&&this._initializeTempSelection(),(e.has("availableRoles")||e.has("_searchQuery"))&&this._updateFilteredRoles(),(e.has("availableRoles")||e.has("periodPreferences")||e.has("open"))&&this._initializePeriodPreferences()}_updateFilteredRoles(){if(!this._searchQuery.trim())return void(this._filteredRoles=[...this.availableRoles]);const e=this._searchQuery.toLowerCase().trim(),t=this.availableRoles.filter(t=>{var i;const o=t.title.toLowerCase().includes(e),r=t.id.toLowerCase().includes(e),n=(null==(i=t.description)?void 0:i.toLowerCase().includes(e))||!1,s=this._searchInRoleURI(t,e);return o||r||n||s});this._filteredRoles=t}_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),n=o.test(e.id);return r||n?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())}_handleChosenSearchInput(e){const t=e.target;this._chosenSearchQuery=t.value}_clearChosenSearch(){var e;this._chosenSearchQuery="";const t=null==(e=this.shadowRoot)?void 0:e.querySelector(".chosen-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),this._chosenRoleOrder=[...this.selectedRoleIds]}_initializePeriodPreferences(){const e={};this.availableRoles.forEach(t=>{const i=this.periodPreferences[t.id];if(i)e[t.id]={...i};else{const i=!0===t.showPeriodControl;let o,r;void 0!==t.duration||void 0!==t.instant?(o=!0===t.duration,r=!0===t.instant):(o=i||this._hasConceptsWithPeriodType(t,"duration"),r=i||this._hasConceptsWithPeriodType(t,"instant")),e[t.id]={showDuration:o,showInstant:r,showPreviousYear:!0===t.showPreviousYear}}const o=this._getDimensionsForRole(t.id);o.length>0&&!(null==i?void 0:i.dimensionSelections)&&(e[t.id].dimensionSelections||(e[t.id].dimensionSelections=[]),o.forEach(i=>{var o,r;const n=this._getAllDimensionMembers(i.members);if(n.length>0){const s=(null==(r=null==(o=i.labels)?void 0:o.find(e=>"http://www.xbrl.org/2003/role/label"===e.role))?void 0:r.label)||i.conceptName,l=n.map(e=>e.id),a={dimensionId:i.id,dimensionLabel:s,selectedMemberIds:l};e[t.id].dimensionSelections.push(a),console.log(`✅ Auto-selected all ${l.length} members for dimension: ${s}`)}}))}),this._tempPeriodPreferences=e}_hasConceptsWithPeriodType(e,t){const i=e=>e.some(e=>!e.abstract&&e.periodType===t||!!e.children&&i(e.children));return i(e.concepts)}_handlePeriodCheckboxChange(e,t,i){e.stopPropagation();const o=e.target,r={...this._tempPeriodPreferences};r[t]||(r[t]={showDuration:!0,showInstant:!0,showPreviousYear:!1}),"duration"===i?r[t].showDuration=o.checked:"instant"===i?r[t].showInstant=o.checked:"previousYear"===i&&(r[t].showPreviousYear=o.checked),this._tempPeriodPreferences=r,this.requestUpdate()}_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=this._chosenRoleOrder.filter(e=>this._tempSelectedRoles.has(e)),t=Array.from(this._tempSelectedRoles).filter(e=>!this._chosenRoleOrder.includes(e));this._chosenRoleOrder=[...e,...t];const i=this._chosenRoleOrder.map((e,t)=>{var i;const o=this.availableRoles.find(t=>t.id===e);return{roleId:e,roleURI:(null==(i=null==o?void 0:o.metadata)?void 0:i.roleURI)||"",order:t}});console.log("✅ Apply Filter - Enhanced structure being emitted:",i),console.log("📋 Order array:",this._chosenRoleOrder),console.log("📊 Dimension preferences being emitted:",this._tempPeriodPreferences),this.dispatchEvent(new CustomEvent("roles-filter-apply",{detail:{selectedRoleIds:i,periodPreferences:this._tempPeriodPreferences},bubbles:!0}))}_getDimensionsForRole(e){var t,i;if(console.log("🔍 [getDimensionsForRole] Called with roleId:",e),console.log("🔍 [getDimensionsForRole] hypercubeData exists:",!!this.hypercubeData),console.log("🔍 [getDimensionsForRole] hypercubeData type:",typeof this.hypercubeData),console.log("🔍 [getDimensionsForRole] hypercubeData value:",this.hypercubeData),!this.hypercubeData)return console.error("❌ [getDimensionsForRole] CRITICAL: hypercubeData is null/undefined/false"),console.error("❌ Parent component must pass hypercubeData property to filter dialog!"),console.error('❌ Example: <jupiter-filter-roles-dialog .hypercubeData="${hypercubeData}">'),[];let o=this.hypercubeData;if(Array.isArray(this.hypercubeData)&&this.hypercubeData.length>0&&(console.log("📦 [getDimensionsForRole] Detected array-wrapped format, unwrapping..."),o=this.hypercubeData[0]),console.log("🔍 [getDimensionsForRole] hypercubeDataObj.roles exists:",!!(null==o?void 0:o.roles)),!(null==o?void 0:o.roles))return console.warn("⚠️ [getDimensionsForRole] No roles found in hypercube data structure"),console.warn("⚠️ Expected structure: { roles: [...] } or [{ roles: [...] }]"),[];console.log("🔍 [getDimensionsForRole] Available hypercube roles:",o.roles.map(e=>e.roleId));const r=o.roles.find(t=>t.roleId===e);if(console.log("🔍 [getDimensionsForRole] Found hypercube role:",!!r),!(null==(t=null==r?void 0:r.items)?void 0:t.length))return console.warn("⚠️ [getDimensionsForRole] No items found in hypercube role for:",e),[];console.log("🔍 [getDimensionsForRole] Items count:",r.items.length);const n=(null==(i=r.items[0])?void 0:i.dimensions)||[];console.log("🔍 [getDimensionsForRole] Total dimensions found:",n.length),console.log("🔍 [getDimensionsForRole] Dimension details:",n.map(e=>{var t;return{id:e.id,type:e.dimensionType,hasMembers:!!(e.members&&e.members.length>0),membersCount:(null==(t=e.members)?void 0:t.length)||0}}));const s=n.filter(e=>"explicit"===e.dimensionType&&e.members&&Array.isArray(e.members)&&e.members.length>0);return console.log("✅ [getDimensionsForRole] Filtered dimensions count:",s.length),console.log("✅ [getDimensionsForRole] Filtered dimension IDs:",s.map(e=>e.id)),s}_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}_isSingleMemberDimension(e){return 1===this._getAllDimensionMembers(e.members).length}_handleDimensionMemberChange(e,t,i,o){var r,n;e.stopPropagation();const s=e.target,l={...this._tempPeriodPreferences};l[t]||(l[t]={showDuration:!0,showInstant:!0,showPreviousYear:!1,dimensionSelections:[]}),l[t].dimensionSelections||(l[t].dimensionSelections=[]);let a=l[t].dimensionSelections.find(e=>e.dimensionId===i);if(!a){const e=this._getDimensionsForRole(t).find(e=>e.id===i),o=(null==(n=null==(r=null==e?void 0:e.labels)?void 0:r.find(e=>"http://www.xbrl.org/2003/role/label"===e.role))?void 0:n.label)||i;a={dimensionId:i,dimensionLabel:o,selectedMemberIds:[]},l[t].dimensionSelections.push(a)}s.checked?a.selectedMemberIds.includes(o)||a.selectedMemberIds.push(o):a.selectedMemberIds=a.selectedMemberIds.filter(e=>e!==o),this._tempPeriodPreferences=l,console.log("📊 Updated dimension selections:",l[t].dimensionSelections),this.requestUpdate()}_isDimensionMemberSelected(e,t,i){const o=this._tempPeriodPreferences[e];if(!(null==o?void 0:o.dimensionSelections))return!1;const r=o.dimensionSelections.find(e=>e.dimensionId===t);return(null==r?void 0:r.selectedMemberIds.includes(i))||!1}_selectAllDimensionMembers(e,t){var i,o;const r=this._getDimensionsForRole(e).find(e=>e.id===t);if(!r)return;const n=this._getAllDimensionMembers(r.members).map(e=>e.id),s={...this._tempPeriodPreferences};s[e]||(s[e]={showDuration:!0,showInstant:!0,showPreviousYear:!1,dimensionSelections:[]}),s[e].dimensionSelections||(s[e].dimensionSelections=[]);let l=s[e].dimensionSelections.find(e=>e.dimensionId===t);if(!l){const n=(null==(o=null==(i=r.labels)?void 0:i.find(e=>"http://www.xbrl.org/2003/role/label"===e.role))?void 0:o.label)||t;l={dimensionId:t,dimensionLabel:n,selectedMemberIds:[]},s[e].dimensionSelections.push(l)}l.selectedMemberIds=n,this._tempPeriodPreferences=s,this.requestUpdate()}_deselectAllDimensionMembers(e,t){var i;const o={...this._tempPeriodPreferences};if(!(null==(i=o[e])?void 0:i.dimensionSelections))return;const r=o[e].dimensionSelections.find(e=>e.dimensionId===t);r&&(r.selectedMemberIds=[]),this._tempPeriodPreferences=o,this.requestUpdate()}_handleBackdropClick(e){e.target===this&&this._handleCancel()}_handleAvailableRoleClick(e){this._selectedAvailableRole=e,this._selectedChosenRole=null,this.requestUpdate()}_handleChosenRoleClick(e){this._selectedChosenRole=e,this._selectedAvailableRole=null,this.requestUpdate()}_moveToChosen(){if(!this._selectedAvailableRole)return;const e=new Set(this._tempSelectedRoles);e.add(this._selectedAvailableRole),this._tempSelectedRoles=e,this._chosenRoleOrder.includes(this._selectedAvailableRole)||(this._chosenRoleOrder=[...this._chosenRoleOrder,this._selectedAvailableRole]),this._selectedAvailableRole=null,this.requestUpdate()}_moveToAvailable(){if(!this._selectedChosenRole)return;const e=new Set(this._tempSelectedRoles);e.delete(this._selectedChosenRole),this._tempSelectedRoles=e,this._chosenRoleOrder=this._chosenRoleOrder.filter(e=>e!==this._selectedChosenRole),this._selectedChosenRole=null,this.requestUpdate()}_moveAllToChosen(){const e=new Set(this._tempSelectedRoles);this._filteredRoles.forEach(t=>{e.add(t.id),this._chosenRoleOrder.includes(t.id)||this._chosenRoleOrder.push(t.id)}),this._tempSelectedRoles=e,this._selectedAvailableRole=null,this.requestUpdate()}_moveAllToAvailable(){this._tempSelectedRoles=new Set,this._chosenRoleOrder=[],this._selectedChosenRole=null,this.requestUpdate()}_getAvailableRoles(){return this._filteredRoles.filter(e=>!this._tempSelectedRoles.has(e.id))}_getChosenRoles(){const e=this.availableRoles.filter(e=>this._tempSelectedRoles.has(e.id)),t=[...this._chosenRoleOrder.map(t=>e.find(e=>e.id===t)).filter(e=>void 0!==e),...e.filter(e=>!this._chosenRoleOrder.includes(e.id))];if(!this._chosenSearchQuery.trim())return t;const i=this._chosenSearchQuery.toLowerCase().trim();return t.filter(e=>{var t;const o=e.title.toLowerCase().includes(i),r=e.id.toLowerCase().includes(i),n=(null==(t=e.description)?void 0:t.toLowerCase().includes(i))||!1,s=this._searchInRoleURI(e,i);return o||r||n||s})}_handleDragStart(e,t){this._draggedRoleId=t,e.dataTransfer&&(e.dataTransfer.effectAllowed="move",e.dataTransfer.setData("text/plain",t)),this.requestUpdate()}_handleDragOver(e,t){e.preventDefault(),e.dataTransfer&&(e.dataTransfer.dropEffect="move"),this._draggedRoleId&&this._draggedRoleId!==t&&(this._dragOverRoleId=t,this.requestUpdate())}_handleDragLeave(e){this._dragOverRoleId=null,this.requestUpdate()}_handleDrop(e,t){if(e.preventDefault(),!this._draggedRoleId||this._draggedRoleId===t)return this._draggedRoleId=null,this._dragOverRoleId=null,void this.requestUpdate();const i=[...this._chosenRoleOrder],o=i.indexOf(this._draggedRoleId),r=i.indexOf(t);if(-1!==o&&-1!==r){i.splice(o,1);const e=o<r?r-1:r;i.splice(e,0,this._draggedRoleId),this._chosenRoleOrder=i,console.log("🔄 Reordered roles:",this._chosenRoleOrder)}this._draggedRoleId=null,this._dragOverRoleId=null,this.requestUpdate()}_handleDragEnd(e){this._draggedRoleId=null,this._dragOverRoleId=null,this.requestUpdate()}render(){const t=this._tempSelectedRoles.size,i=this.availableRoles.length,o=this._filteredRoles.length,r=this._searchQuery.trim().length>0;return e.html`
|
|
1453
1577
|
<div class="dialog" @click="${e=>e.stopPropagation()}">
|
|
1454
1578
|
<!-- Dialog Header -->
|
|
1455
1579
|
<div class="dialog-header">
|
|
1456
1580
|
<svg class="filter-icon" viewBox="0 0 24 24">
|
|
1457
1581
|
<path d="M10 18h4v-2h-4v2zM3 6v2h18V6H3zm3 7h12v-2H6v2z"/>
|
|
1458
1582
|
</svg>
|
|
1459
|
-
<h2 class="dialog-title">${
|
|
1583
|
+
<h2 class="dialog-title">${T.t("filter.title")}</h2>
|
|
1460
1584
|
<button class="close-button" @click="${this._handleCancel}">×</button>
|
|
1461
1585
|
</div>
|
|
1462
1586
|
|
|
@@ -1468,19 +1592,19 @@ const $={attribute:!0,type:String,converter:v,reflect:!1,hasChanged:x},I=(e=$,t,
|
|
|
1468
1592
|
<!-- Available Roles Panel -->
|
|
1469
1593
|
<div class="picklist-panel">
|
|
1470
1594
|
<div class="picklist-header">
|
|
1471
|
-
${
|
|
1595
|
+
${T.t("filter.availableRoles")} (${this._getAvailableRoles().length})
|
|
1472
1596
|
</div>
|
|
1473
1597
|
<div class="picklist-search">
|
|
1474
1598
|
<div class="search-container">
|
|
1475
1599
|
<input
|
|
1476
1600
|
type="text"
|
|
1477
1601
|
class="search-input"
|
|
1478
|
-
placeholder="${
|
|
1602
|
+
placeholder="${T.t("filter.searchPlaceholder")}"
|
|
1479
1603
|
.value="${this._searchQuery}"
|
|
1480
1604
|
@input="${this._handleSearchInput}"
|
|
1481
1605
|
/>
|
|
1482
1606
|
${this._searchQuery?e.html`
|
|
1483
|
-
<button class="clear-search" @click="${this._clearSearch}" title="${
|
|
1607
|
+
<button class="clear-search" @click="${this._clearSearch}" title="${T.t("filter.clearSearch")}">
|
|
1484
1608
|
×
|
|
1485
1609
|
</button>
|
|
1486
1610
|
`:e.html`
|
|
@@ -1505,7 +1629,7 @@ const $={attribute:!0,type:String,converter:v,reflect:!1,hasChanged:x},I=(e=$,t,
|
|
|
1505
1629
|
`})}
|
|
1506
1630
|
</div>
|
|
1507
1631
|
<div class="picklist-count">
|
|
1508
|
-
${this._getAvailableRoles().length} ${
|
|
1632
|
+
${this._getAvailableRoles().length} ${T.t("filter.roleCount")}
|
|
1509
1633
|
</div>
|
|
1510
1634
|
</div>
|
|
1511
1635
|
|
|
@@ -1515,7 +1639,7 @@ const $={attribute:!0,type:String,converter:v,reflect:!1,hasChanged:x},I=(e=$,t,
|
|
|
1515
1639
|
class="picklist-button"
|
|
1516
1640
|
@click="${this._moveToChosen}"
|
|
1517
1641
|
?disabled="${!this._selectedAvailableRole}"
|
|
1518
|
-
title="${
|
|
1642
|
+
title="${T.t("filter.addSelectedRole")}"
|
|
1519
1643
|
>
|
|
1520
1644
|
›
|
|
1521
1645
|
</button>
|
|
@@ -1523,7 +1647,7 @@ const $={attribute:!0,type:String,converter:v,reflect:!1,hasChanged:x},I=(e=$,t,
|
|
|
1523
1647
|
class="picklist-button"
|
|
1524
1648
|
@click="${this._moveAllToChosen}"
|
|
1525
1649
|
?disabled="${0===this._getAvailableRoles().length}"
|
|
1526
|
-
title="${
|
|
1650
|
+
title="${T.t("filter.addAllRoles")}"
|
|
1527
1651
|
>
|
|
1528
1652
|
»
|
|
1529
1653
|
</button>
|
|
@@ -1531,7 +1655,7 @@ const $={attribute:!0,type:String,converter:v,reflect:!1,hasChanged:x},I=(e=$,t,
|
|
|
1531
1655
|
class="picklist-button"
|
|
1532
1656
|
@click="${this._moveToAvailable}"
|
|
1533
1657
|
?disabled="${!this._selectedChosenRole}"
|
|
1534
|
-
title="${
|
|
1658
|
+
title="${T.t("filter.removeSelectedRole")}"
|
|
1535
1659
|
>
|
|
1536
1660
|
‹
|
|
1537
1661
|
</button>
|
|
@@ -1539,7 +1663,7 @@ const $={attribute:!0,type:String,converter:v,reflect:!1,hasChanged:x},I=(e=$,t,
|
|
|
1539
1663
|
class="picklist-button"
|
|
1540
1664
|
@click="${this._moveAllToAvailable}"
|
|
1541
1665
|
?disabled="${0===this._tempSelectedRoles.size}"
|
|
1542
|
-
title="${
|
|
1666
|
+
title="${T.t("filter.removeAllRoles")}"
|
|
1543
1667
|
>
|
|
1544
1668
|
«
|
|
1545
1669
|
</button>
|
|
@@ -1548,19 +1672,19 @@ const $={attribute:!0,type:String,converter:v,reflect:!1,hasChanged:x},I=(e=$,t,
|
|
|
1548
1672
|
<!-- Chosen Roles Panel -->
|
|
1549
1673
|
<div class="picklist-panel">
|
|
1550
1674
|
<div class="picklist-header">
|
|
1551
|
-
${
|
|
1675
|
+
${T.t("filter.chosenRoles")} (${this._tempSelectedRoles.size})
|
|
1552
1676
|
</div>
|
|
1553
1677
|
<div class="picklist-search">
|
|
1554
1678
|
<div class="search-container">
|
|
1555
1679
|
<input
|
|
1556
1680
|
type="text"
|
|
1557
1681
|
class="search-input chosen-search-input"
|
|
1558
|
-
placeholder="${
|
|
1682
|
+
placeholder="${T.t("filter.searchPlaceholder")}"
|
|
1559
1683
|
.value="${this._chosenSearchQuery}"
|
|
1560
1684
|
@input="${this._handleChosenSearchInput}"
|
|
1561
1685
|
/>
|
|
1562
1686
|
${this._chosenSearchQuery?e.html`
|
|
1563
|
-
<button class="clear-search" @click="${this._clearChosenSearch}" title="${
|
|
1687
|
+
<button class="clear-search" @click="${this._clearChosenSearch}" title="${T.t("filter.clearSearch")}">
|
|
1564
1688
|
×
|
|
1565
1689
|
</button>
|
|
1566
1690
|
`:e.html`
|
|
@@ -1591,13 +1715,13 @@ const $={attribute:!0,type:String,converter:v,reflect:!1,hasChanged:x},I=(e=$,t,
|
|
|
1591
1715
|
`})}
|
|
1592
1716
|
</div>
|
|
1593
1717
|
<div class="picklist-count">
|
|
1594
|
-
${this._tempSelectedRoles.size} ${
|
|
1718
|
+
${this._tempSelectedRoles.size} ${T.t("filter.rolesSelected")}
|
|
1595
1719
|
</div>
|
|
1596
1720
|
</div>
|
|
1597
1721
|
</div>
|
|
1598
1722
|
`:e.html`
|
|
1599
1723
|
<p class="description">
|
|
1600
|
-
${
|
|
1724
|
+
${T.t("filter.description")}
|
|
1601
1725
|
</p>
|
|
1602
1726
|
|
|
1603
1727
|
<!-- Search Input -->
|
|
@@ -1605,12 +1729,12 @@ const $={attribute:!0,type:String,converter:v,reflect:!1,hasChanged:x},I=(e=$,t,
|
|
|
1605
1729
|
<input
|
|
1606
1730
|
type="text"
|
|
1607
1731
|
class="search-input"
|
|
1608
|
-
placeholder="${
|
|
1732
|
+
placeholder="${T.t("filter.searchPlaceholder")}"
|
|
1609
1733
|
.value="${this._searchQuery}"
|
|
1610
1734
|
@input="${this._handleSearchInput}"
|
|
1611
1735
|
/>
|
|
1612
1736
|
${this._searchQuery?e.html`
|
|
1613
|
-
<button class="clear-search" @click="${this._clearSearch}" title="${
|
|
1737
|
+
<button class="clear-search" @click="${this._clearSearch}" title="${T.t("filter.clearSearch")}">
|
|
1614
1738
|
×
|
|
1615
1739
|
</button>
|
|
1616
1740
|
`:e.html`
|
|
@@ -1623,8 +1747,8 @@ const $={attribute:!0,type:String,converter:v,reflect:!1,hasChanged:x},I=(e=$,t,
|
|
|
1623
1747
|
<!-- Search Results Info -->
|
|
1624
1748
|
${r?e.html`
|
|
1625
1749
|
<div class="search-results-info">
|
|
1626
|
-
${
|
|
1627
|
-
${o!==i?e.html`${
|
|
1750
|
+
${T.t("filter.showingResults")} ${o} ${T.t("filter.of")} ${i} ${T.t("filter.roles")}
|
|
1751
|
+
${o!==i?e.html`${T.t("filter.matching")} "${this._searchQuery}"`:""}
|
|
1628
1752
|
</div>
|
|
1629
1753
|
`:""}
|
|
1630
1754
|
|
|
@@ -1632,27 +1756,27 @@ const $={attribute:!0,type:String,converter:v,reflect:!1,hasChanged:x},I=(e=$,t,
|
|
|
1632
1756
|
<div class="selection-controls">
|
|
1633
1757
|
${r?e.html`
|
|
1634
1758
|
<button class="selection-control" @click="${this._selectAll}">
|
|
1635
|
-
${
|
|
1759
|
+
${T.t("filter.selectFiltered")} (${o})
|
|
1636
1760
|
</button>
|
|
1637
1761
|
<button class="selection-control" @click="${this._selectNone}">
|
|
1638
|
-
${
|
|
1762
|
+
${T.t("filter.deselectFiltered")}
|
|
1639
1763
|
</button>
|
|
1640
1764
|
<button class="selection-control" @click="${this._selectAllGlobal}">
|
|
1641
|
-
${
|
|
1765
|
+
${T.t("filter.selectAll")} (${i})
|
|
1642
1766
|
</button>
|
|
1643
1767
|
<button class="selection-control" @click="${this._selectNoneGlobal}">
|
|
1644
|
-
${
|
|
1768
|
+
${T.t("filter.deselectAll")}
|
|
1645
1769
|
</button>
|
|
1646
1770
|
`:e.html`
|
|
1647
1771
|
<button class="selection-control" @click="${this._selectAll}">
|
|
1648
|
-
${
|
|
1772
|
+
${T.t("filter.selectAll")}
|
|
1649
1773
|
</button>
|
|
1650
1774
|
<button class="selection-control" @click="${this._selectNone}">
|
|
1651
|
-
${
|
|
1775
|
+
${T.t("filter.selectNone")}
|
|
1652
1776
|
</button>
|
|
1653
1777
|
`}
|
|
1654
1778
|
<button class="selection-control" @click="${this._resetToOriginal}">
|
|
1655
|
-
${
|
|
1779
|
+
${T.t("filter.reset")}
|
|
1656
1780
|
</button>
|
|
1657
1781
|
</div>
|
|
1658
1782
|
|
|
@@ -1661,10 +1785,10 @@ const $={attribute:!0,type:String,converter:v,reflect:!1,hasChanged:x},I=(e=$,t,
|
|
|
1661
1785
|
${0===this._filteredRoles.length?e.html`
|
|
1662
1786
|
<div class="no-results">
|
|
1663
1787
|
${r?e.html`
|
|
1664
|
-
${
|
|
1665
|
-
${
|
|
1788
|
+
${T.t("filter.noRolesFound")} "${this._searchQuery}".<br>
|
|
1789
|
+
${T.t("filter.tryDifferentSearch")}
|
|
1666
1790
|
`:e.html`
|
|
1667
|
-
${
|
|
1791
|
+
${T.t("filter.noRolesAvailable")}
|
|
1668
1792
|
`}
|
|
1669
1793
|
</div>
|
|
1670
1794
|
`:e.html`
|
|
@@ -1679,11 +1803,11 @@ const $={attribute:!0,type:String,converter:v,reflect:!1,hasChanged:x},I=(e=$,t,
|
|
|
1679
1803
|
<div class="role-info">
|
|
1680
1804
|
<h4 class="role-title">${t.title}</h4>
|
|
1681
1805
|
${(null==(i=t.metadata)?void 0:i.roleURI)?e.html`
|
|
1682
|
-
<p class="role-description">${
|
|
1806
|
+
<p class="role-description">${T.t("filter.uri")}: ${t.metadata.roleURI}</p>
|
|
1683
1807
|
`:""}
|
|
1684
1808
|
|
|
1685
1809
|
<div class="period-controls">
|
|
1686
|
-
<p class="period-controls-label">${
|
|
1810
|
+
<p class="period-controls-label">${T.t("filter.additionalOptions")}</p>
|
|
1687
1811
|
<div class="period-checkboxes">
|
|
1688
1812
|
<label class="period-checkbox-item">
|
|
1689
1813
|
<input
|
|
@@ -1692,14 +1816,14 @@ const $={attribute:!0,type:String,converter:v,reflect:!1,hasChanged:x},I=(e=$,t,
|
|
|
1692
1816
|
.checked="${r.showPreviousYear}"
|
|
1693
1817
|
@change="${e=>this._handlePeriodCheckboxChange(e,t.id,"previousYear")}"
|
|
1694
1818
|
/>
|
|
1695
|
-
<span class="period-checkbox-label">${
|
|
1819
|
+
<span class="period-checkbox-label">${T.t("filter.showPreviousYear")}</span>
|
|
1696
1820
|
</label>
|
|
1697
1821
|
</div>
|
|
1698
1822
|
</div>
|
|
1699
1823
|
|
|
1700
1824
|
${s?e.html`
|
|
1701
1825
|
<div class="dimension-section">
|
|
1702
|
-
<div class="dimension-header">📊 ${
|
|
1826
|
+
<div class="dimension-header">📊 ${T.t("filter.dimensionMemberSelection")}</div>
|
|
1703
1827
|
${n.map(i=>{var o,r;const n=this._getAllDimensionMembers(i.members);if(0===n.length)return e.html``;const s=(null==(r=null==(o=i.labels)?void 0:o.find(e=>"http://www.xbrl.org/2003/role/label"===e.role))?void 0:r.label)||i.conceptName,l=this._isSingleMemberDimension(i);return e.html`
|
|
1704
1828
|
<div class="dimension-group">
|
|
1705
1829
|
<div class="dimension-label">${s}</div>
|
|
@@ -1723,13 +1847,13 @@ const $={attribute:!0,type:String,converter:v,reflect:!1,hasChanged:x},I=(e=$,t,
|
|
|
1723
1847
|
class="member-select-btn"
|
|
1724
1848
|
@click="${()=>this._selectAllDimensionMembers(t.id,i.id)}"
|
|
1725
1849
|
>
|
|
1726
|
-
${
|
|
1850
|
+
${T.t("filter.selectAllMembers")}
|
|
1727
1851
|
</button>
|
|
1728
1852
|
<button
|
|
1729
1853
|
class="member-select-btn"
|
|
1730
1854
|
@click="${()=>this._deselectAllDimensionMembers(t.id,i.id)}"
|
|
1731
1855
|
>
|
|
1732
|
-
${
|
|
1856
|
+
${T.t("filter.clearMembers")}
|
|
1733
1857
|
</button>
|
|
1734
1858
|
</div>
|
|
1735
1859
|
`}
|
|
@@ -1748,14 +1872,14 @@ const $={attribute:!0,type:String,converter:v,reflect:!1,hasChanged:x},I=(e=$,t,
|
|
|
1748
1872
|
<!-- Dialog Actions -->
|
|
1749
1873
|
<div class="dialog-actions">
|
|
1750
1874
|
<button class="btn-secondary" @click="${this._handleCancel}">
|
|
1751
|
-
${
|
|
1875
|
+
${T.t("filter.cancel")}
|
|
1752
1876
|
</button>
|
|
1753
1877
|
<button
|
|
1754
1878
|
class="btn-primary"
|
|
1755
1879
|
@click="${this._handleApply}"
|
|
1756
1880
|
?disabled="${0===t}"
|
|
1757
1881
|
>
|
|
1758
|
-
${
|
|
1882
|
+
${T.t("filter.applyFilter")} (${t})
|
|
1759
1883
|
</button>
|
|
1760
1884
|
</div>
|
|
1761
1885
|
</div>
|
|
@@ -1792,24 +1916,25 @@ const $={attribute:!0,type:String,converter:v,reflect:!1,hasChanged:x},I=(e=$,t,
|
|
|
1792
1916
|
|
|
1793
1917
|
.dialog-header {
|
|
1794
1918
|
padding: 20px 24px 16px;
|
|
1795
|
-
border-bottom: 1px solid var(--jupiter-border-color, #ddd);
|
|
1919
|
+
border-bottom: 1px solid var(--primaryTextColor, var(--jupiter-border-color, #ddd));
|
|
1796
1920
|
display: flex;
|
|
1797
1921
|
align-items: center;
|
|
1798
1922
|
gap: 12px;
|
|
1923
|
+
background: var(--bg-color-1, var(--jupiter-header-background, #f8f9fa));
|
|
1799
1924
|
}
|
|
1800
1925
|
|
|
1801
1926
|
.dialog-title {
|
|
1802
1927
|
font-size: 18px;
|
|
1803
1928
|
font-weight: 600;
|
|
1804
1929
|
margin: 0;
|
|
1805
|
-
color: var(--jupiter-text-primary, #333);
|
|
1930
|
+
color: var(--primaryTextColor, var(--jupiter-text-primary, #333));
|
|
1806
1931
|
flex: 1;
|
|
1807
1932
|
}
|
|
1808
1933
|
|
|
1809
1934
|
.filter-icon {
|
|
1810
1935
|
width: 20px;
|
|
1811
1936
|
height: 20px;
|
|
1812
|
-
fill: var(--jupiter-primary-color, #1976d2);
|
|
1937
|
+
fill: var(--primaryTextColor, var(--jupiter-primary-color, #1976d2));
|
|
1813
1938
|
}
|
|
1814
1939
|
|
|
1815
1940
|
.close-button {
|
|
@@ -1818,23 +1943,24 @@ const $={attribute:!0,type:String,converter:v,reflect:!1,hasChanged:x},I=(e=$,t,
|
|
|
1818
1943
|
font-size: 24px;
|
|
1819
1944
|
cursor: pointer;
|
|
1820
1945
|
padding: 4px;
|
|
1821
|
-
color: var(--jupiter-text-secondary, #666);
|
|
1946
|
+
color: var(--primaryTextColor, var(--jupiter-text-secondary, #666));
|
|
1822
1947
|
border-radius: 4px;
|
|
1823
1948
|
transition: background-color 0.2s ease;
|
|
1824
1949
|
}
|
|
1825
1950
|
|
|
1826
|
-
.close-button:hover {
|
|
1827
|
-
|
|
1828
|
-
}
|
|
1951
|
+
// .close-button:hover {
|
|
1952
|
+
// background: var(--jupiter-hover-background, #f5f5f5);
|
|
1953
|
+
// }
|
|
1829
1954
|
|
|
1830
1955
|
.dialog-content {
|
|
1956
|
+
background: var(--bg-color-2, var(--jupiter-form-content-background, #fff));
|
|
1831
1957
|
flex: 1;
|
|
1832
1958
|
overflow-y: auto;
|
|
1833
1959
|
padding: 20px 24px;
|
|
1834
1960
|
}
|
|
1835
1961
|
|
|
1836
1962
|
.description {
|
|
1837
|
-
color: var(--jupiter-text-secondary, #666);
|
|
1963
|
+
color: var(--primaryTextColor, var(--secondaryTextColor, var(--jupiter-text-secondary, #666))) ;
|
|
1838
1964
|
font-size: 14px;
|
|
1839
1965
|
margin: 0 0 20px 0;
|
|
1840
1966
|
line-height: 1.5;
|
|
@@ -1853,25 +1979,25 @@ const $={attribute:!0,type:String,converter:v,reflect:!1,hasChanged:x},I=(e=$,t,
|
|
|
1853
1979
|
}
|
|
1854
1980
|
|
|
1855
1981
|
.search-input {
|
|
1856
|
-
width:
|
|
1982
|
+
width: stretch;
|
|
1857
1983
|
padding: 10px 40px 10px 12px;
|
|
1858
|
-
border: 1px solid var(--jupiter-border-color, #ddd);
|
|
1984
|
+
border: 1px solid var(--primaryTextColor, var(--jupiter-border-color, #ddd));
|
|
1859
1985
|
border-radius: 4px;
|
|
1860
1986
|
font-size: 14px;
|
|
1861
1987
|
font-family: inherit;
|
|
1862
|
-
background:
|
|
1863
|
-
color: var(--jupiter-text-primary, #333);
|
|
1988
|
+
background: transparent;
|
|
1989
|
+
color: var(--primaryTextColor, var(--jupiter-text-primary, #333));
|
|
1864
1990
|
transition: border-color 0.2s ease;
|
|
1865
1991
|
}
|
|
1866
1992
|
|
|
1867
|
-
.search-input:focus {
|
|
1868
|
-
|
|
1869
|
-
|
|
1870
|
-
|
|
1871
|
-
}
|
|
1993
|
+
// .search-input:focus {
|
|
1994
|
+
// outline: none;
|
|
1995
|
+
// border-color: var(--jupiter-primary-color, #1976d2);
|
|
1996
|
+
// box-shadow: 0 0 0 2px rgba(25, 118, 210, 0.1);
|
|
1997
|
+
// }
|
|
1872
1998
|
|
|
1873
1999
|
.search-input::placeholder {
|
|
1874
|
-
color: var(--jupiter-text-secondary, #666);
|
|
2000
|
+
color: var(--primaryTextColor, var(--jupiter-text-secondary, #666));
|
|
1875
2001
|
}
|
|
1876
2002
|
|
|
1877
2003
|
.search-icon {
|
|
@@ -1929,8 +2055,8 @@ const $={attribute:!0,type:String,converter:v,reflect:!1,hasChanged:x},I=(e=$,t,
|
|
|
1929
2055
|
|
|
1930
2056
|
.selection-control {
|
|
1931
2057
|
background: none;
|
|
1932
|
-
border: 1px solid var(--jupiter-primary-color, #1976d2);
|
|
1933
|
-
color: var(--jupiter-primary-color, #1976d2);
|
|
2058
|
+
border: 1px solid var(--primaryTextColor, var(--jupiter-primary-color, #1976d2));
|
|
2059
|
+
color: var(--primaryTextColor, var(--jupiter-primary-color, #1976d2));
|
|
1934
2060
|
padding: 6px 12px;
|
|
1935
2061
|
border-radius: 4px;
|
|
1936
2062
|
font-size: 12px;
|
|
@@ -1939,7 +2065,7 @@ const $={attribute:!0,type:String,converter:v,reflect:!1,hasChanged:x},I=(e=$,t,
|
|
|
1939
2065
|
}
|
|
1940
2066
|
|
|
1941
2067
|
.selection-control:hover {
|
|
1942
|
-
background: var(--jupiter-primary-color, #1976d2);
|
|
2068
|
+
background: var(--menuBgColorLighter, var(--jupiter-primary-color, #1976d2));
|
|
1943
2069
|
color: white;
|
|
1944
2070
|
}
|
|
1945
2071
|
|
|
@@ -1949,7 +2075,7 @@ const $={attribute:!0,type:String,converter:v,reflect:!1,hasChanged:x},I=(e=$,t,
|
|
|
1949
2075
|
gap: 8px;
|
|
1950
2076
|
max-height: 300px;
|
|
1951
2077
|
overflow-y: auto;
|
|
1952
|
-
border: 1px solid var(--jupiter-border-color, #ddd);
|
|
2078
|
+
border: 1px solid var(--primaryTextColor, var(--jupiter-border-color, #ddd));
|
|
1953
2079
|
border-radius: 4px;
|
|
1954
2080
|
padding: 12px;
|
|
1955
2081
|
}
|
|
@@ -1964,13 +2090,17 @@ const $={attribute:!0,type:String,converter:v,reflect:!1,hasChanged:x},I=(e=$,t,
|
|
|
1964
2090
|
}
|
|
1965
2091
|
|
|
1966
2092
|
.role-item:hover {
|
|
1967
|
-
background: var(--jupiter-hover-background, #f5f5f5);
|
|
2093
|
+
background: var(--menuBgColorLighter, var(--jupiter-hover-background, #f5f5f5));
|
|
1968
2094
|
}
|
|
1969
2095
|
|
|
1970
2096
|
.role-checkbox {
|
|
1971
2097
|
margin-top: 2px;
|
|
1972
2098
|
cursor: pointer;
|
|
1973
2099
|
}
|
|
2100
|
+
|
|
2101
|
+
.role-info * {
|
|
2102
|
+
color: var(--primaryTextColor, var(--jupiter-text-primary, #333)) !important;
|
|
2103
|
+
}
|
|
1974
2104
|
|
|
1975
2105
|
.role-info {
|
|
1976
2106
|
flex: 1;
|
|
@@ -2000,15 +2130,15 @@ const $={attribute:!0,type:String,converter:v,reflect:!1,hasChanged:x},I=(e=$,t,
|
|
|
2000
2130
|
.period-controls {
|
|
2001
2131
|
margin-top: 8px;
|
|
2002
2132
|
padding: 8px;
|
|
2003
|
-
background: var(--jupiter-background-light, #f8f9fa);
|
|
2133
|
+
background: var(--bg-color-1, var(--jupiter-background-light, #f8f9fa));
|
|
2004
2134
|
border-radius: 4px;
|
|
2005
|
-
border: 1px solid var(--jupiter-border-color, #e0e0e0);
|
|
2135
|
+
border: 1px solid var(--primaryTextColor, var(--jupiter-border-color, #e0e0e0));
|
|
2006
2136
|
}
|
|
2007
2137
|
|
|
2008
2138
|
.period-controls-label {
|
|
2009
2139
|
font-size: 12px;
|
|
2010
2140
|
font-weight: 600;
|
|
2011
|
-
color: var(--jupiter-text-primary, #333);
|
|
2141
|
+
color: var(--primaryTextColor, var(--jupiter-text-primary, #333));
|
|
2012
2142
|
margin: 0 0 6px 0;
|
|
2013
2143
|
}
|
|
2014
2144
|
|
|
@@ -2136,11 +2266,11 @@ const $={attribute:!0,type:String,converter:v,reflect:!1,hasChanged:x},I=(e=$,t,
|
|
|
2136
2266
|
|
|
2137
2267
|
.dialog-actions {
|
|
2138
2268
|
padding: 16px 24px;
|
|
2139
|
-
border-top: 1px solid var(--jupiter-border-color, #ddd);
|
|
2269
|
+
border-top: 1px solid var(--primaryTextColor, var(--jupiter-border-color, #ddd));
|
|
2140
2270
|
display: flex;
|
|
2141
2271
|
gap: 12px;
|
|
2142
2272
|
justify-content: flex-end;
|
|
2143
|
-
background: var(--jupiter-form-actions-background, #f8f9fa);
|
|
2273
|
+
background: var(--bg-color-2, var(--jupiter-form-actions-background, #f8f9fa));
|
|
2144
2274
|
}
|
|
2145
2275
|
|
|
2146
2276
|
.dialog-actions button {
|
|
@@ -2154,23 +2284,23 @@ const $={attribute:!0,type:String,converter:v,reflect:!1,hasChanged:x},I=(e=$,t,
|
|
|
2154
2284
|
}
|
|
2155
2285
|
|
|
2156
2286
|
.btn-primary {
|
|
2157
|
-
background: var(--jupiter-primary-color, #1976d2);
|
|
2158
|
-
color: white;
|
|
2287
|
+
background: var(--buttonBgColor, var(--jupiter-primary-color, #1976d2));
|
|
2288
|
+
color: var(--buttonTextColor, white);
|
|
2159
2289
|
}
|
|
2160
2290
|
|
|
2161
|
-
.btn-primary:hover:not(:disabled) {
|
|
2162
|
-
|
|
2163
|
-
}
|
|
2291
|
+
// .btn-primary:hover:not(:disabled) {
|
|
2292
|
+
// background: var(--jupiter-primary-color-dark, #1565c0);
|
|
2293
|
+
// }
|
|
2164
2294
|
|
|
2165
2295
|
.btn-secondary {
|
|
2296
|
+
color: var(--buttonBgColor, var(--jupiter-primary-color, #1976d2));
|
|
2297
|
+
border: 1px solid var(--buttonBgColor, var(--jupiter-primary-color, #1976d2)) !important;
|
|
2166
2298
|
background: transparent;
|
|
2167
|
-
color: var(--jupiter-text-secondary, #666);
|
|
2168
|
-
border: 1px solid var(--jupiter-border-color, #ddd);
|
|
2169
2299
|
}
|
|
2170
2300
|
|
|
2171
|
-
.btn-secondary:hover:not(:disabled) {
|
|
2172
|
-
|
|
2173
|
-
}
|
|
2301
|
+
// .btn-secondary:hover:not(:disabled) {
|
|
2302
|
+
// background: var(--jupiter-hover-background, #f5f5f5);
|
|
2303
|
+
// }
|
|
2174
2304
|
|
|
2175
2305
|
button:disabled {
|
|
2176
2306
|
opacity: 0.6;
|
|
@@ -2296,7 +2426,7 @@ const $={attribute:!0,type:String,converter:v,reflect:!1,hasChanged:x},I=(e=$,t,
|
|
|
2296
2426
|
border-top: 1px solid var(--jupiter-border-color, #ddd);
|
|
2297
2427
|
text-align: center;
|
|
2298
2428
|
}
|
|
2299
|
-
`,ie([S({type:Boolean,reflect:!0})],exports.JupiterFilterRolesDialog.prototype,"open",2),ie([S({type:Array})],exports.JupiterFilterRolesDialog.prototype,"availableRoles",2),ie([S({type:Array})],exports.JupiterFilterRolesDialog.prototype,"selectedRoleIds",2),ie([S({type:Object})],exports.JupiterFilterRolesDialog.prototype,"periodPreferences",2),ie([S({type:String})],exports.JupiterFilterRolesDialog.prototype,"mode",2),ie([S({type:Object})],exports.JupiterFilterRolesDialog.prototype,"hypercubeData",2),ie([w()],exports.JupiterFilterRolesDialog.prototype,"_tempSelectedRoles",2),ie([w()],exports.JupiterFilterRolesDialog.prototype,"_searchQuery",2),ie([w()],exports.JupiterFilterRolesDialog.prototype,"_filteredRoles",2),ie([w()],exports.JupiterFilterRolesDialog.prototype,"_tempPeriodPreferences",2),ie([w()],exports.JupiterFilterRolesDialog.prototype,"_selectedAvailableRole",2),ie([w()],exports.JupiterFilterRolesDialog.prototype,"_selectedChosenRole",2),ie([w()],exports.JupiterFilterRolesDialog.prototype,"_chosenSearchQuery",2),ie([w()],exports.JupiterFilterRolesDialog.prototype,"_draggedRoleId",2),ie([w()],exports.JupiterFilterRolesDialog.prototype,"_dragOverRoleId",2),ie([w()],exports.JupiterFilterRolesDialog.prototype,"_chosenRoleOrder",2),exports.JupiterFilterRolesDialog=ie([t("jupiter-filter-roles-dialog")],exports.JupiterFilterRolesDialog);var oe=Object.defineProperty,re=Object.getOwnPropertyDescriptor,ne=(e,t,i,o)=>{for(var r,n=o>1?void 0:o?re(t,i):t,s=e.length-1;s>=0;s--)(r=e[s])&&(n=(o?r(t,i,n):r(n))||n);return o&&n&&oe(t,i,n),n};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.language="en",this.reportingLanguage="en",this.display="accordion",this.mode="inputForm",this.roleFilterAxes=[],this.showLastValidationResultBtn=!1,this.isDraftSaving=!1,this.defaultUnits=[],this._formData={},this._draftLoaded=!1,this._preservedFormData={},this._periodData={},this._preservedPeriodData={},this._unitData={},this._preservedUnitData={},this._typedMemberData={},this._preservedTypedMemberData={},this._columns=[],this._errors=[],this._touched=new Set,this._dirty=!1,this._valid=!0,this._submitted=!1,this._xbrlFormErrors=[],this._showErrorPopup=!1,this._submitDisabled=!1,this._allSections=[],this._selectedRoleIds=[],this._showFilterDialog=!1,this._periodPreferences={},this._activeSidePanelRoleId=null,this._sidePanelSearchQuery="",this._sidePanelCollapsed=!1,this._adminRoleConfigs={},this._roleBorderStatuses=new Map,this._showRoleContextMenu=!1,this._contextMenuX=0,this._contextMenuY=0,this._contextMenuRoleId=null,this._validationStatus="idle",this._skipDraftLoading=!1,this._skipPeriodPreferencesRestore=!1,this._autoSaveTimer=null,this._lastAutoSaveSnapshot="",this._lastSavedDraftSnapshot=""}connectedCallback(){super.connectedCallback(),this.addEventListener("period-change",e=>{console.log("🌍 [GLOBAL DynamicForm] Caught period-change event on element:",e);const t=e;console.log("🌍 [GLOBAL DynamicForm] Event detail:",t.detail),this._handlePeriodChange(t)}),this.addEventListener("unit-change",e=>{console.log("🏷️ [GLOBAL DynamicForm] Caught unit-change event on element:",e);const t=e;console.log("🏷️ [GLOBAL DynamicForm] Event detail:",t.detail),this._handleUnitChange(t)}),this.addEventListener("field-blur",e=>{console.log("🚨 [DynamicForm] field-blur event listener triggered!",e);const t=e;this._handleFieldBlur(t)}),document.addEventListener("click",()=>{this._showRoleContextMenu&&(this._showRoleContextMenu=!1,this.requestUpdate())}),this._autoSaveTimer=setInterval(()=>{const e=JSON.stringify(this._formData);if(""===this._lastAutoSaveSnapshot)return this._lastAutoSaveSnapshot=e,void console.log("ℹ️ [Auto Save] Baseline initialized; no draft save emitted.");e!==this._lastAutoSaveSnapshot?(this._lastAutoSaveSnapshot=e,this._handleSaveDraft("auto")):console.log("ℹ️ [Auto Save] No form state change detected; skipping draft save emit.")},3e4),this._initializeForm()}disconnectedCallback(){super.disconnectedCallback(),null!==this._autoSaveTimer&&(clearInterval(this._autoSaveTimer),this._autoSaveTimer=null)}updated(e){e.has("language")&&E.setLanguage(this.language),(e.has("xbrlInput")||e.has("defaultUnits"))&&this.xbrlInput&&this.defaultUnits&&this.defaultUnits.length>0&&this._applyDefaultUnitsToDatatypes(),(e.has("xbrlInput")||e.has("schema")||e.has("language")||e.has("periodStartDate")||e.has("periodEndDate")||e.has("roleFilterAxes"))&&this._initializeForm()}_applyDefaultUnitsToDatatypes(){var e;if(!(null==(e=this.xbrlInput)?void 0:e.datatypes)||!this.defaultUnits||0===this.defaultUnits.length)return;console.log("🔧 [DynamicForm] Applying defaultUnits to datatypes:",this.defaultUnits);const t=Array.isArray(this.xbrlInput.datatypes)?this.xbrlInput.datatypes:this.xbrlInput.datatypes.concepts;t&&0!==t.length?this.defaultUnits.forEach(e=>{Object.entries(e).forEach(([e,i])=>{const o=t.find(t=>t.type===e||t.id===e);if(o&&o.units&&o.units.length>0){const t=o.units.find(e=>e.id===i);t?(o.units.forEach(e=>e.isDefault=!1),t.isDefault=!0,console.log(`✅ [DynamicForm] Set isDefault=true for unit "${i}" in datatype "${e}"`)):console.warn(`⚠️ [DynamicForm] Unit "${i}" not found in datatype "${e}"`)}else console.warn(`⚠️ [DynamicForm] Datatype "${e}" not found or has no units`)})}):console.warn("⚠️ [DynamicForm] No datatypes found to apply defaults to")}_initializeForm(){var e;if(this._draftStorageService||(this._draftStorageService=new T(!1)),this.xbrlInput)try{if(console.log("🔄 Initializing form from XBRL input:",this.xbrlInput),console.log("📅 Using period dates:",this.periodStartDate,"to",this.periodEndDate),console.log("🌐 Using language:",this.language),this._initializePeriodPreferencesFromData(),this._applyAxisFilterToPeriodPreferences(),this._applyDimensionShowPreviousYear(),console.log("⚙️ Using period preferences:",this._periodPreferences),this._currentSchema=F.buildFormSchema(this.xbrlInput,this.periodStartDate,this.periodEndDate,this.language,this._periodPreferences),console.log("✅ Generated schema with sections:",this._currentSchema.sections.length),this._allSections=[...this._currentSchema.sections],Array.isArray(this._selectedRoleIds)&&this._selectedRoleIds.length>0&&"object"==typeof this._selectedRoleIds[0]){console.log("🔄 Applying custom role order to _allSections from _selectedRoleIds");const e=this._selectedRoleIds,t=new Map;e.forEach(e=>{t.set(e.roleId,e.order)}),this._allSections=[...this._allSections].sort((e,i)=>(t.get(e.id)??999)-(t.get(i.id)??999)),console.log("✅ Custom order applied to _allSections:",this._allSections.map(e=>e.title))}if(0===this._selectedRoleIds.length){const e=this.roleFilterAxes&&this.roleFilterAxes.length>0?this._filterRolesByAxisConfig(this._allSections):this._allSections;this._selectedRoleIds=e.map(e=>e.id),console.log(`✅ Auto-selected ${this._selectedRoleIds.length} roles (of ${this._allSections.length} total)`)}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._extractTypedMembersFromFacts(),this._skipDraftLoading?(console.log("⏭️ Skipping draft loading during preference update"),this._analyzeAllVisibleRoles()):this._loadDraftIfExists().then(()=>{this._analyzeAllVisibleRoles()}).catch(()=>{this._analyzeAllVisibleRoles()}),this._validateForm()}_extractTypedMembersFromFacts(){var e;(null==(e=this._currentSchema)?void 0:e.sections)&&(console.log("🔍 [DynamicForm] Extracting typed member values from facts"),this._currentSchema.sections.forEach(e=>{this._extractTypedMembersFromConcepts(e.concepts||[],e)}),console.log("✅ [DynamicForm] Typed member data populated:",this._typedMemberData))}_extractTypedMembersFromConcepts(e,t){e.forEach(e=>{e.facts&&e.facts.length>0&&(console.log(`🔍 [DynamicForm] Checking concept ${e.id} with ${e.facts.length} facts`),e.facts.forEach(i=>{if(i.dimensions&&Array.isArray(i.dimensions)){const o=i.dimensions.filter(e=>"typed"===e.dimensionType&&e.typedMemberValue);if(o.length>0){console.log(`📝 [DynamicForm] Found ${o.length} typed dimensions in fact:`,{factName:i.name,typedDimensions:o.map(e=>({dimension:e.dimension,typedMemberValue:e.typedMemberValue}))});const r=this._findColumnWithTypedMembers(i,e,t);r?(console.log(`✅ [DynamicForm] Found matching column: ${r.id}`),o.forEach(i=>{var o,n;const s=this._normalizeAxisId(i.dimension),l=null==(n=null==(o=r.dimensionData)?void 0:o.typedMembers)?void 0:n.find(e=>e.axisId===s||this._normalizeAxisId(e.axisId)===s);if(l){this._typedMemberData[r.id]||(this._typedMemberData[r.id]={});const o=l.axisId;this._typedMemberData[r.id][o]=i.typedMemberValue,console.log("✅ [DynamicForm] Set typed member value:",{sectionId:t.id,conceptId:e.id,columnId:r.id,axisKey:o,typedMemberValue:i.typedMemberValue})}else console.warn(`⚠️ [DynamicForm] Typed member not found for axis: ${s}`)})):console.warn("⚠️ [DynamicForm] No matching column found for fact with typed dimensions")}}})),e.children&&e.children.length>0&&this._extractTypedMembersFromConcepts(e.children,t)})}_findColumnWithTypedMembers(e,t,i){var o;if(!t.fields||0===t.fields.length)return null;const r=i.columns||[];if(0===r.length)return null;for(const n of t.fields){const t=r.find(e=>e.id===n.columnId);if(t&&(null==(o=t.dimensionData)?void 0:o.hasTypedMembers)){const i=(e.dimensions||[]).filter(e=>"explicit"===e.dimensionType),o=t.dimensionData.combinations||[];if(0===i.length||i.length===o.length&&i.every(e=>o.some(t=>this._normalizeAxisId(e.dimension)===this._normalizeAxisId(t.axisId)&&this._normalizeMemberId(e.member)===this._normalizeMemberId(t.memberId))))return t}}return null}_findColumnForFactDimensions(e,t,i){if(!t.fields||0===t.fields.length)return console.log(`⚠️ [DynamicForm] No fields for concept: ${t.id}`),null;const o=i.columns||[];if(0===o.length)return console.log(`⚠️ [DynamicForm] No columns in section: ${i.id}`),null;for(const r of t.fields){const t=o.find(e=>e.id===r.columnId);if(t&&t.dimensionData){const i=e.dimensions||[],o=t.dimensionData.combinations||[];console.log(`🔍 [DynamicForm] Checking column ${t.id}:`,{factDimensions:i.map(e=>({axis:e.dimension,member:e.member,type:e.dimensionType})),columnDimensions:o.map(e=>({axis:e.axisId,member:e.memberId}))});if(o.every(e=>i.some(t=>{const i=this._normalizeAxisId(t.dimension)===this._normalizeAxisId(e.axisId);if("explicit"===t.dimensionType){const o=this._normalizeMemberId(t.member)===this._normalizeMemberId(e.memberId);return i&&o}return"typed"===t.dimensionType&&i})))return t}}return null}_normalizeAxisId(e){return e?e.includes(":")?e.split(":").pop()||e:e.includes("_")&&e.split("_").pop()||e:""}_normalizeMemberId(e){return e?e.includes(":")?e.split(":").pop()||e:e.includes("_")&&e.split("_").pop()||e:""}_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}]}_initializePeriodPreferencesFromData(){var e,t,i;if(!(null==(i=null==(t=null==(e=this.xbrlInput)?void 0:e.presentation)?void 0:t[0])?void 0:i.roles))return;const o={...this._periodPreferences};this.xbrlInput.presentation[0].roles.forEach(e=>{if(!o[e.id]){const t=!0===e.showPreviousYear,i=void 0===e.instant||!0===e.instant,r=void 0===e.duration||!0===e.duration;o[e.id]={showDuration:r,showInstant:i,showPreviousYear:t}}}),this._periodPreferences=o}_applyAxisFilterToPeriodPreferences(){var e,t,i,o;if(!this.roleFilterAxes||0===this.roleFilterAxes.length)return;if(!(null==(i=null==(t=null==(e=this.xbrlInput)?void 0:e.hypercubes)?void 0:t[0])?void 0:i.roles))return;const r=this.xbrlInput.hypercubes[0].roles,n={...this._periodPreferences};for(const s of r){const e=s.roleId,t=n[e];if((null==t?void 0:t.dimensionSelections)&&t.dimensionSelections.length>0)continue;const i=[];for(const r of this.roleFilterAxes)for(const e of s.items||[]){if(null==(o=e.dimensions)?void 0:o.find(e=>e.id===r.id||r.conceptName&&e.conceptName===r.conceptName)){i.push({dimensionId:r.id,dimensionLabel:r.conceptName||r.id,selectedMemberIds:r.members.filter(e=>!0===e.available).map(e=>e.id)});break}}i.length>0&&(n[e]={showDuration:(null==t?void 0:t.showDuration)??!0,showInstant:(null==t?void 0:t.showInstant)??!0,showPreviousYear:(null==t?void 0:t.showPreviousYear)??!1,dimensionSelections:i})}this._periodPreferences=n}_applyDimensionShowPreviousYear(){var e,t;if("admin"!==this.mode)return;const i=!(!this.dynaformsFacts||!this.dynaformsMetadata),o=(null==(e=this._draftStorageService)?void 0:e.hasDraft())??!1;if(i||o)return;const r={...this._periodPreferences};let n=!1;for(const s of Object.keys(r)){const e=r[s];if(e.showPreviousYear)continue;((null==(t=e.dimensionSelections)?void 0:t.some(e=>e.selectedMemberIds&&e.selectedMemberIds.length>0))??!1)&&(r[s]={...e,showPreviousYear:!0},n=!0,console.log(`📅 [JDF-010] Auto-enabled showPreviousYear for role "${s}" (has dimension members)`))}n&&(this._periodPreferences=r)}_getRoleIdsArray(){return Array.isArray(this._selectedRoleIds)&&0!==this._selectedRoleIds.length?"string"==typeof this._selectedRoleIds[0]?this._selectedRoleIds:this._selectedRoleIds.map(e=>e.roleId):[]}_applyRoleFilter(){if(!this._currentSchema||!this._allSections.length)return;const e=this._getRoleIdsArray();if(console.log(`🔍 Applying role filter: ${e.length} selected out of ${this._allSections.length} total`),0===e.length)return console.log("📝 No roles selected - showing empty form"),this._currentSchema={...this._currentSchema,sections:[]},void this.requestUpdate();this._preserveDataForHiddenSections();const t=this._allSections.filter(t=>e.includes(t.id)),i=this._sortSectionsByCustomOrder(t);console.log(`📊 Filtered sections: ${i.length}`),console.log("📋 Custom order applied:",i.map(e=>e.title)),this._restoreDataForVisibleSections(i),this._currentSchema={...this._currentSchema,sections:i},console.log(`✅ Schema updated with custom order. Current sections count: ${this._currentSchema.sections.length}`),this.requestUpdate()}_sortSectionsByCustomOrder(e){if(Array.isArray(this._selectedRoleIds)&&this._selectedRoleIds.length>0&&"object"==typeof this._selectedRoleIds[0]){const t=this._selectedRoleIds,i=new Map;return t.forEach(e=>{i.set(e.roleId,e.order)}),[...e].sort((e,t)=>(i.get(e.id)??999)-(i.get(t.id)??999))}return e}_filterRolesByAxisConfig(e){var t;if(!this.roleFilterAxes||0===this.roleFilterAxes.length)return e;if(!(null==(t=this.xbrlInput)?void 0:t.hypercubes)||0===this.xbrlInput.hypercubes.length)return e;const i=this.xbrlInput.hypercubes[0];return e.filter(e=>{var t;const o=null==(t=i.roles)?void 0:t.find(t=>t.roleId===e.id);if(!o||!o.items||0===o.items.length)return!0;for(const i of this.roleFilterAxes){const e=new Set(i.members.filter(e=>!0===e.available).map(e=>e.id));let t=!1,r=!1;for(const n of o.items){if(!n.dimensions||0===n.dimensions.length)continue;const o=n.dimensions.find(e=>e.id===i.id||i.conceptName&&e.conceptName===i.conceptName);if(o){if(t=!0,o.members)for(const t of o.members)if(e.has(t.id)){r=!0;break}if(r)break}}if(t&&!r)return!1}return!0})}_preserveDataForHiddenSections(){var e;const t=(null==(e=this._currentSchema)?void 0:e.sections.map(e=>e.id))||[],i=this._getRoleIdsArray();t.filter(e=>!i.includes(e)).forEach(e=>{const t=this._allSections.find(t=>t.id===e);t&&this._preserveSectionData(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]}),e.fields.forEach(e=>{this._typedMemberData[e.columnId]&&(this._preservedTypedMemberData[e.columnId]={...this._typedMemberData[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]}),e.fields.forEach(e=>{this._preservedTypedMemberData[e.columnId]&&(this._typedMemberData[e.columnId]={...this._preservedTypedMemberData[e.columnId]})}),e.children&&e.children.forEach(e=>{this._restoreConceptData(e)})}_shouldShowFilterButton(){return!0}_handleFilterRolesClick(){this._showFilterDialog=!0}_handleFilterDialogCancel(){this._showFilterDialog=!1;const e=this._getRoleIdsArray().length;console.log(`🚫 Filter dialog cancelled. Current selection: ${e}/${this._allSections.length}`)}_handleRoleFilterApply(e){var t,i;const{selectedRoleIds:o,periodPreferences:r}=e.detail;console.log("🎯 Filter apply triggered"),console.log("📊 Old _selectedRoleIds:",this._selectedRoleIds),console.log("📊 New selectedRoleIds from dialog:",o),this._selectedRoleIds=o,this._periodPreferences=r,console.log("📊 Updated _selectedRoleIds:",this._selectedRoleIds),console.log("📊 New period preferences (including dimension selections):",this._periodPreferences),console.log("💾 Capturing current form data before reinitialization...");const n=this._generateSubmissionData(),s=this._draftStorageService.createMetadataSnapshot(this.periodStartDate,this.periodEndDate,this.language,this._selectedRoleIds,this._allSections,this._typedMemberData,this._periodPreferences,this._periodData,this._unitData,this.reportingLanguage);this._draftStorageService.saveDraft(n,s),console.log("✅ Current form data saved to draft storage with NEW preferences"),this._skipPeriodPreferencesRestore=!0,this._skipDraftLoading=!0,console.log("🔄 Reinitializing form with new filter settings..."),this._initializeForm(),this._skipDraftLoading=!1,this._skipPeriodPreferencesRestore=!1,console.log("📊 After _initializeForm, _currentSchema.sections.length:",null==(t=this._currentSchema)?void 0:t.sections.length),console.log("📊 Section IDs:",null==(i=this._currentSchema)?void 0:i.sections.map(e=>e.id)),console.log("📥 Restoring form data from draft after reinitialization..."),this._loadDraftIfExists().then(()=>{console.log("✅ Form data restored successfully after reinitialization")}).catch(e=>{console.error("❌ Error restoring form data after reinitialization:",e)}),this._showFilterDialog=!1;const l=Array.isArray(this._selectedRoleIds)&&this._selectedRoleIds.length>0?(this._selectedRoleIds[0],this._selectedRoleIds.length):0;console.log(`🎯 Applied role filter: ${l}/${this._allSections.length} roles selected`),console.log("📋 Enhanced selectedRoleIds structure:",this._selectedRoleIds),this.dispatchEvent(new CustomEvent("roles-filter-changed",{detail:{selectedRoleIds:o,totalRoles:this._allSections.length,visibleRoles:l,periodPreferences:r},bubbles:!0}))}_haveDimensionSelectionsChanged(e){var t;const i=new Set([...Object.keys(this._periodPreferences||{}),...Object.keys(e||{})]);for(const o of i){const i=null==(t=this._periodPreferences)?void 0:t[o],r=null==e?void 0:e[o],n=(null==i?void 0:i.dimensionSelections)||[],s=(null==r?void 0:r.dimensionSelections)||[];if(JSON.stringify(n.sort((e,t)=>e.dimensionId.localeCompare(t.dimensionId)))!==JSON.stringify(s.sort((e,t)=>e.dimensionId.localeCompare(t.dimensionId))))return console.log(`🔍 Dimension selection changed for role: ${o}`),console.log(" Old:",n),console.log(" New:",s),!0}return!1}_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],n=C.validateField(o.id,i.id,o.columnId,r,o.type,o.validation||[]);t.push(...n)}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;console.log(`📝 Field change: conceptId=${i}, columnId=${o}, value=${r}, fieldId=${t}`);const n={...this._formData};n[i]||(n[i]={});const s=n[i][o];n[i]={...n[i],[o]:r},this._formData=n,console.log(`💾 Updated formData[${i}]:`,this._formData[i]),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:s},bubbles:!0}))}_handlePeriodChange(e){console.log("🎯 [DynamicForm] _handlePeriodChange called with event:",e),console.log("🎯 [DynamicForm] Event detail:",e.detail);const{conceptId:t,columnId:i,periodType:o,periodStartDate:r,periodEndDate:n,periodInstantDate:s,unit:l}=e.detail;console.log(`📅 Period change received: conceptId=${t}, columnId=${i}, periodType=${o}, startDate=${r}, endDate=${n}, instantDate=${s}, unit=${l}`);const a={...this._periodData};a[t]||(a[t]={}),a[t]={...a[t],[i]:{startDate:r,endDate:n,instantDate:s}},this._periodData=a,console.log(`💾 Period data stored for [${t}][${i}]:`,this._periodData[t][i]),console.log("📦 Full period data state:",JSON.stringify(this._periodData,null,2)),l&&this._storeUnit(t,i,l),this._dirty=!0,this.requestUpdate()}_handleUnitChange(e){console.log("🏷️ [DynamicForm] _handleUnitChange called with event:",e),console.log("🏷️ [DynamicForm] Event detail:",e.detail);const{conceptId:t,columnId:i,unit:o}=e.detail;console.log(`🏷️ Unit change received: conceptId=${t}, columnId=${i}, unit=${o}`),this._storeUnit(t,i,o),this._dirty=!0,this.requestUpdate()}_storeUnit(e,t,i){console.log(`🔧 [_storeUnit] Called with conceptId=${e}, columnId=${t}, unit=${i}`),console.log("🔧 [_storeUnit] Current _unitData before update:",JSON.stringify(this._unitData,null,2));const o={...this._unitData};o[e]||(console.log(`🔧 [_storeUnit] Creating new entry for conceptId: ${e}`),o[e]={}),o[e]={...o[e],[t]:i},this._unitData=o,console.log(`💾 [_storeUnit] Unit data stored for [${e}][${t}]:`,this._unitData[e][t]),console.log("📦 [_storeUnit] Full unit data state after update:",JSON.stringify(this._unitData,null,2))}_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}))}_handleFieldBlur(e){var t;console.log("🟧 [DynamicForm] _handleFieldBlur received event:",e),console.log("🟧 [DynamicForm] Event detail:",e.detail);const{fieldId:i,conceptId:o,columnId:r,xbrlValidationErrors:n}=e.detail;console.log(`🟧 [DynamicForm] Extracted - fieldId: ${i}, conceptId: ${o}, columnId: ${r}`),console.log("🟧 [DynamicForm] xbrlValidationErrors:",n);let s="";const l=e.composedPath();console.log(`🟧 [DynamicForm] Event path length: ${l.length}`);for(const a of l){const e=a;if("JUPITER-FORM-SECTION"===e.tagName){s=e.getAttribute("section-id")||"",console.log(`🟧 [DynamicForm] Found section element with id: ${s}`);break}}if(console.log(`🟧 [DynamicForm] Found sectionId: ${s}`),console.log(`🟧 [DynamicForm] Processing errors - has errors: ${n&&n.length>0}`),n&&n.length>0){console.log(`🟧 [DynamicForm] Adding/updating error for fieldId: ${i}, sectionId: ${s}`);const e=(null==(t=this._formData[o])?void 0:t[r])||"",l=this._xbrlFormErrors.findIndex(e=>e.fieldId===i&&e.sectionId===s),a={sectionId:s,fieldId:i,conceptId:o,columnId:r,value:e,errors:n};console.log("🟧 [DynamicForm] New error object:",a),console.log(`🟧 [DynamicForm] Existing index: ${l}`),l>=0?(this._xbrlFormErrors=[...this._xbrlFormErrors.slice(0,l),a,...this._xbrlFormErrors.slice(l+1)],console.log(`🟧 [DynamicForm] Updated existing error at index ${l}`)):(this._xbrlFormErrors=[...this._xbrlFormErrors,a],console.log("🟧 [DynamicForm] Added new error"))}else{console.log(`🟧 [DynamicForm] Removing error (if exists) for fieldId: ${i}, sectionId: ${s}`);const e=this._xbrlFormErrors.length;this._xbrlFormErrors=this._xbrlFormErrors.filter(e=>!(e.fieldId===i&&e.sectionId===s)),console.log(`🟧 [DynamicForm] Removed ${e-this._xbrlFormErrors.length} errors`)}console.log(`🔍 [Validation] Total errors: ${this._xbrlFormErrors.length}`,this._xbrlFormErrors)}_getSectionTitle(e){console.log(`🔍 [_getSectionTitle] Looking for sectionId: "${e}"`),console.log("🔍 [_getSectionTitle] Available sections:",this._allSections.map(e=>({id:e.id,title:e.title})));const t=this._allSections.find(t=>t.id===e),i=(null==t?void 0:t.title)||e||"(Unknown Section)";return console.log(`🔍 [_getSectionTitle] Result: "${i}"`),i}_roleHasErrors(e){return this._xbrlFormErrors.some(t=>t.sectionId===e)}async _handleErrorFieldClick(e,t,i){var o,r,n,s;console.log(`🎯 [Error Click] Attempting to focus field: ${e}__${t} in section: ${i}`),this._showErrorPopup=!1,this.requestUpdate(),await this.updateComplete,"sidePanel"===this.display&&this._activeSidePanelRoleId!==i&&(console.log(`🔀 Switching to section: ${i} (currently on: ${this._activeSidePanelRoleId})`),this._activeSidePanelRoleId=i,this.requestUpdate(),await this.updateComplete,await new Promise(e=>setTimeout(e,500)));const l=null==(o=this.shadowRoot)?void 0:o.querySelectorAll("jupiter-form-section");let a=null;if(null==l||l.forEach(e=>{var t;(null==(t=e.section)?void 0:t.id)===i&&(a=e)}),!a)return void console.warn(`⚠️ Section not found: ${i}`);if(console.log("✅ Found section element:",a),(null==(r=a.section)?void 0:r.collapsed)?(console.log("📂 Expanding collapsed section"),a.section.collapsed=!1,a.requestUpdate(),await a.updateComplete,await new Promise(e=>setTimeout(e,500))):(await a.updateComplete,await new Promise(e=>setTimeout(e,100))),console.log(`🔍 Section shadow DOM exists: ${!!a.shadowRoot}`),a.shadowRoot){console.log(`🔍 Shadow DOM innerHTML length: ${(null==(n=a.shadowRoot.innerHTML)?void 0:n.length)||0}`);const e=a.shadowRoot.querySelectorAll("*");console.log(`🔍 Total elements in shadow DOM: ${e.length}`);const t=Array.from(e).filter(e=>{const t=e;return!(!t.tagName||!t.tagName.includes("-"))});console.log("🔍 Custom elements found:",t.map(e=>e.tagName).join(", "))}const d=`${e}_${t}_field`;console.log(`🔍 Looking for input with fieldId: ${d}`),console.log(`🔍 Looking for field with conceptId: ${e} AND columnId: ${t}`);const c=null==(s=a.shadowRoot)?void 0:s.querySelectorAll("jupiter-concept-tree");let p=null;if(console.log(`🔍 Found ${(null==c?void 0:c.length)||0} concept-tree elements`),c&&c.forEach((i,o)=>{var r;if(p)return;const n=null==(r=i.shadowRoot)?void 0:r.querySelectorAll("jupiter-form-field");console.log(`🔍 Concept tree ${o}: Found ${(null==n?void 0:n.length)||0} form-field elements`),null==n||n.forEach((i,o)=>{var r;if(!p&&(console.log(` Field ${o}: conceptId=${i.conceptId}, columnId=${i.columnId}`),i.conceptId===e&&i.columnId===t)){const e=null==(r=i.shadowRoot)?void 0:r.querySelector("input, textarea");console.log(` -> Matched! Input element found: ${!!e}`),e&&(p=e,console.log("✅ Found input element in form-field"))}})}),!p)return void console.warn(`⚠️ Input field not found for: ${d}`);const u=p;a.scrollIntoView({behavior:"smooth",block:"start"}),await new Promise(e=>setTimeout(e,300)),u.focus(),"INPUT"!==u.tagName&&"TEXTAREA"!==u.tagName||u.select(),u.style.boxShadow="0 0 0 3px rgba(220, 38, 38, 0.5)",setTimeout(()=>{u.style.boxShadow=""},2e3),console.log(`✅ Successfully focused field: ${e}__${t}`)}_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,insertAfterColumnId:o}=e.detail;this._addColumnFromRequest(i,t,o)}_getAvailableDimensionsForSection(e){var t,i,o;if(!(null==(i=null==(t=this.xbrlInput)?void 0:t.hypercubes)?void 0:i[0]))return[];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}`),[];const n=[];return r.items.forEach(e=>{e.dimensions&&e.dimensions.length>0&&e.dimensions.forEach(e=>{var t;if(!n.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"}),n.push(o)}})}),n}_formatPeriodDisplay(e,t){if(!e||!t)return`${e||""} / ${t||""}`;const i=e.substring(0,4);return i===t.substring(0,4)?i:`${e} / ${t}`}_addColumnFromRequest(e,t,i){var o,r,n,s,l;const a=`col-${Date.now()}`;let d="",c="";"instant"===e.periodType?(d=e.instantDate||"",c=""):"duration"!==e.periodType&&"mixed"!==e.periodType||(d=this._formatPeriodDisplay(e.startDate,e.endDate),c="");let p={dimensionId:"period",memberValue:"instant"===e.periodType?`instant-${e.instantDate}`:`duration-${e.startDate}-${e.endDate}`,memberLabel:d};if(e.selectedDimensions&&e.selectedDimensions.length>0){const t=[],i=[];for(const o of e.selectedDimensions)o.isTyped&&o.typedValue?(t.push(`${o.axisLabel}: ${o.typedValue}`),i.push(`${o.axisId}|${o.typedValue}`)):o.memberId&&o.memberLabel&&(t.push(o.memberLabel),i.push(`${o.axisId}|${o.memberId}`));t.length>0&&(d=t.join(" | "),c="instant"===e.periodType?e.instantDate||"":this._formatPeriodDisplay(e.startDate,e.endDate),p={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: ${p.memberKey}`))}else if(null==(r=null==(o=this.xbrlInput)?void 0:o.hypercubes)?void 0:r[0]){const i=this.xbrlInput.hypercubes[0].roles.find(e=>e.roleId===t);if(1===(null==(n=null==i?void 0:i.items)?void 0:n.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==(l=o.labels.find(e=>"http://www.xbrl.org/2003/role/label"===e.role))?void 0:l.label)||o.conceptName;d=r,c="instant"===e.periodType?e.instantDate||"":this._formatPeriodDisplay(e.startDate,e.endDate),p={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: ${p.memberKey}`)}}}}const u={id:a,title:d,description:c,type:(p.memberKey,"dimension"),order:this._columns.length,removable:!0,dimensionData:p,periodStartDate:"instant"===e.periodType?e.instantDate:e.startDate,periodEndDate:"instant"===e.periodType?e.instantDate:e.endDate};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);i&&(this._typedMemberData[a]=t,u.dimensionData&&(u.dimensionData.hasTypedMembers=!0,u.dimensionData.typedMembers=e.selectedDimensions.filter(e=>e.isTyped).map(e=>({axisId:e.axisId,axisLabel:e.axisLabel,typedMemberId:e.axisId,memberLabel:e.axisLabel}))))}if(this._currentSchema){const e=this._currentSchema.sections.find(e=>e.id===t);if(e)if(e.columns||(e.columns=[...this._columns]),i){const t=e.columns.findIndex(e=>e.id===i);e.columns=-1!==t?[...e.columns.slice(0,t+1),u,...e.columns.slice(t+1)]:[...e.columns,u]}else e.columns=[...e.columns,u]}this._replicateFieldsForNewColumn(a,e,t),this._dirty=!0,this.requestUpdate(),this.dispatchEvent(new CustomEvent("column-add",{detail:{column:u},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(!(t.selectedDimensions&&t.selectedDimensions.length>0)&&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 n;n=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,periodType:e.periodType,conceptType:e.type,periodStartDate:"instant"===i.periodType?i.instantDate:i.startDate,periodEndDate:"instant"===i.periodType?i.instantDate:i.endDate,periodInstantDate:"instant"===e.periodType?i.instantDate||i.startDate:void 0}:{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:"",periodType:e.periodType,conceptType:e.type,periodStartDate:"instant"===i.periodType?i.instantDate:i.startDate,periodEndDate:"instant"===i.periodType?i.instantDate:i.endDate,periodInstantDate:"instant"===e.periodType?i.instantDate||i.startDate:void 0},e.fields||(e.fields=[]),e.fields.push(n)}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(){if(console.log("📝 Form submission started..."),this._submitted=!0,this._submitDisabled=!0,"admin"===this.mode)return this._handleSaveDraft(),this._handleAdminModeSubmit(),void(this._submitDisabled=!1);if(console.log("🔵 [Submit] Checking for errors..."),console.log(`🔵 [Submit] _xbrlFormErrors.length: ${this._xbrlFormErrors.length}`),console.log("🔵 [Submit] _xbrlFormErrors:",this._xbrlFormErrors),this._xbrlFormErrors.length>0)return console.log("❌ [Submit] Cannot submit - validation errors present:",this._xbrlFormErrors),this._showErrorPopup=!0,this._submitDisabled=!1,void this.requestUpdate();if(console.log("✅ [Submit] No validation errors, proceeding with submission..."),this._validateForm(),!this._valid)return console.log("❌ [Submit] Cannot submit - form validation errors present:",this._errors),this._showErrorPopup=!0,this._submitDisabled=!1,void this.requestUpdate();const e=this._generateSubmissionData();console.log("📊 Form Submission Data:",JSON.stringify(e,null,2)),console.log("📊 Submission Data Summary:"),e.forEach((e,t)=>{console.log(` [${t}] conceptId: ${e.conceptId}, columnId: ${e.columnId}, value: ${e.value}, unit: ${e.unit||"none"}`)}),this.dispatchEvent(new CustomEvent("form-submit",{detail:{data:this._formData,submissionData:e,valid:this._valid,errors:this._errors,reportingLanguage:this.reportingLanguage},bubbles:!0})),console.log("✅ Form submit event dispatched"),setTimeout(()=>{this._submitDisabled=!1},1e3)}_handleSaveDraft(e="manual"){if(console.log("🔵 [Save Draft] Checking for errors..."),console.log(`🔵 [Save Draft] _xbrlFormErrors.length: ${this._xbrlFormErrors.length}`),console.log("🔵 [Save Draft] _xbrlFormErrors:",this._xbrlFormErrors),this._xbrlFormErrors.length>0)return console.log("❌ [Save Draft] Cannot save - validation errors present:",this._xbrlFormErrors),this._showErrorPopup=!0,void this.requestUpdate();console.log("✅ [Save Draft] No validation errors, proceeding with save..."),console.log("💾 Raw form data before submission generation:",this._formData),console.log("🏷️ Unit data before submission generation:",this._unitData),console.log("📋 Enhanced selectedRoleIds with roleURI and order:",this._selectedRoleIds);const t=this._generateSubmissionData();console.log("📤 Generated submission data:",t),console.log("📊 Submission data breakdown:"),t.forEach((e,t)=>{console.log(` [${t}] conceptId: ${e.conceptId}, columnId: ${e.columnId}, value: ${e.value}, unit: ${e.unit||"none"}`)});const i=this._draftStorageService.createMetadataSnapshot(this.periodStartDate,this.periodEndDate,this.language,this._selectedRoleIds,this._allSections,this._typedMemberData,this._periodPreferences,this._periodData,this._unitData,this.reportingLanguage),o=JSON.stringify({draftData:t,metadata:i});if(o===this._lastSavedDraftSnapshot)return void console.log(`ℹ️ [Save Draft] No draft content change detected (${e}); skipping event emit.`);this._lastSavedDraftSnapshot=o;const r=this._draftStorageService.saveDraft(t,i);console.log("💾 [Save Draft] Metadata saved with enhanced selectedRoleIds:",i.selectedRoleIds),this.dynaformsFacts=t,this.dynaformsMetadata=i,this.dispatchEvent(new CustomEvent("form-save-draft",{detail:{data:this._formData,draftData:t,metadata:i,saved:r,valid:this._valid,errors:this._errors,dynaformsFacts:t,dynaformsMetadata:i,reportingLanguage:this.reportingLanguage,source:"auto"==e?"auto":"manual"},bubbles:!0,composed:!0}));const n=this._getRoleIdsArray().length;console.log("💾 Draft saved - localStorage + event emitted",{entries:t.length,saved:r,roles:n,customColumns:i.customColumns.length,eventEmitted:!0,enhancedRoleStructure:Array.isArray(this._selectedRoleIds)&&this._selectedRoleIds.length>0&&"object"==typeof this._selectedRoleIds[0]})}async _loadDraftIfExists(){if(console.log("📋 Checking for saved draft..."),this.dynaformsFacts&&this.dynaformsMetadata){console.log("📦 Using external draft data from properties");const e={formData:this.dynaformsFacts,metadata:this.dynaformsMetadata};return await this._restoreFromDraft(e),this._draftLoaded=!0,this._draftLoadedAt=this.dynaformsMetadata.savedAt||(new Date).toISOString(),this.dispatchEvent(new CustomEvent("form-draft-loaded",{detail:{draft:e,source:"external",compatible:!0,warnings:[]},bubbles:!0,composed:!0})),void console.log("📥 External draft loaded successfully")}if(!this._draftStorageService.hasDraft())return void console.log("ℹ️ No saved draft found");const e=this._draftStorageService.loadDraft();if(!e)return void console.warn("⚠️ Failed to load draft");const{compatible:t,warnings:i}=this._draftStorageService.validateDraftCompatibility(e,this.periodStartDate,this.periodEndDate);i.length>0&&console.warn("⚠️ Draft compatibility warnings:",i),await this._restoreFromDraft(e),this.dispatchEvent(new CustomEvent("form-draft-loaded",{detail:{draft:e,compatible:t,warnings:i},bubbles:!0,composed:!0})),console.log("📥 Draft loaded successfully",{entries:e.formData.length,savedAt:e.metadata.savedAt,age:this._draftStorageService.getDraftAge()})}async _restoreFromDraft(e){var t;const{formData:i,metadata:o}=e;o.selectedRoleIds&&o.selectedRoleIds.length>0&&(this._selectedRoleIds=o.selectedRoleIds,console.log(`🔄 Restored ${this._selectedRoleIds.length} selected roles`)),o.typedMemberData&&(this._typedMemberData=o.typedMemberData,this._preservedTypedMemberData={},console.log("🔄 Restored typed member data")),o.periodData&&(this._periodData=o.periodData,console.log("🔄 Restored custom field-level period data:",Object.keys(this._periodData).length,"concepts")),o.unitData&&(this._unitData=o.unitData,console.log("🔄 Restored custom field-level unit data:",Object.keys(this._unitData).length,"concepts")),o.periodPreferences?this._skipPeriodPreferencesRestore?console.log("⏭️ Skipping period preferences restoration - using new filter selections"):(this._periodPreferences=o.periodPreferences,console.log("🔄 Restored period preferences (including previous year settings):",this._periodPreferences),this.xbrlInput&&(console.log("🔄 Rebuilding schema with restored period preferences..."),this._currentSchema=F.buildFormSchema(this.xbrlInput,this.periodStartDate,this.periodEndDate,this.language,this._periodPreferences),this._allSections=[...this._currentSchema.sections],console.log("✅ Schema rebuilt with restored period preferences"),console.log("🔄 Applying custom period data to schema fields..."),this._applyCustomPeriodDataToFields(),o.customColumns&&o.customColumns.length>0&&(this._mergeAdditionalCustomColumns(o.customColumns),console.log(`🔄 Merged ${o.customColumns.length} additional custom columns`)))):o.customColumns&&o.customColumns.length>0&&(this._restoreCustomColumns(o.customColumns),console.log(`🔄 Restored ${o.customColumns.length} custom columns`));const r={},n={},s={};i.forEach(e=>{let{conceptId:t,value:i,columnId:o,period:l,unit:a}=e;if(!o&&l&&(o=this._inferColumnIdFromPeriod(l,t),!o))return void console.warn(`⚠️ Could not infer columnId for concept ${t}, skipping...`);const d=this._findActualConceptId(t)||t;r[d]||(r[d]={}),r[d][o]=i,console.log(`📦 Restored: ${d}[${o}] = ${i}`),l&&(n[d]||(n[d]={}),"instant"===l.type?(n[d][o]={instantDate:l.date},console.log(`📅 [Restore Period] Extracted instant date for ${d}/${o}: ${l.date}`)):"duration"===l.type&&(n[d][o]={startDate:l.startDate,endDate:l.endDate},console.log(`📅 [Restore Period] Extracted duration dates for ${d}/${o}: ${l.startDate} - ${l.endDate}`))),a&&(s[d]||(s[d]={}),s[d][o]=a,console.log(`🏷️ [Restore Unit] Extracted unit for ${d}/${o}: ${a}`))}),this._formData={...this._formData,...r},console.log(`🔄 Restored ${Object.keys(r).length} concepts with data`),this._periodData={...this._periodData,...o.periodData||{},...n},console.log(`📅 [Period Restore] Merged period data: ${Object.keys(this._periodData).length} concepts with custom periods`),console.log("📅 [Period Restore] Full _periodData after merge:",JSON.stringify(this._periodData,null,2)),this._unitData={...this._unitData,...o.unitData||{},...s},console.log(`🏷️ [Unit Restore] Merged unit data: ${Object.keys(this._unitData).length} concepts with custom units`),console.log("🏷️ [Unit Restore] Full _unitData after merge:",JSON.stringify(this._unitData,null,2)),this._selectedRoleIds.length>0&&this._applyRoleFilter(),this._dirty=!0,this._touched.clear(),this._validateForm(),this._allSections=[...this._allSections],this.requestUpdate(),await this.updateComplete,await new Promise(e=>setTimeout(e,100));const l=(null==(t=this.shadowRoot)?void 0:t.querySelectorAll("input, textarea, select").length)||0;console.log(`🔍 Found ${l} fields in DOM after update`),l>0?this._populateFieldValues(r):console.error("❌ No fields found in DOM even after updateComplete"),console.log("✅ Draft restoration completed")}_findActualConceptId(e){for(const t of this._allSections){const i=this._findActualConceptIdInTree(t.concepts,e);if(i)return i}return null}_findActualConceptIdInTree(e,t){for(const i of e){if(i.originalConceptId===t||i.id===t)return i.id;if(i.children){const e=this._findActualConceptIdInTree(i.children,t);if(e)return e}}return null}_inferColumnIdFromPeriod(e,t){for(const i of this._allSections){if(this._findConceptInSection(i.concepts,t)&&i.columns){for(const o of i.columns){const i="instant"===e.type,r="duration"===e.type;if(i&&e.date){if(o.periodStartDate===e.date||o.periodStartDate===o.periodEndDate&&o.periodStartDate===e.date)return console.log(`✓ Inferred columnId: ${o.id} for concept ${t}`),o.id}else if(r&&e.startDate&&e.endDate&&o.periodStartDate===e.startDate&&o.periodEndDate===e.endDate)return console.log(`✓ Inferred columnId: ${o.id} for concept ${t}`),o.id}if("instant"===e.type){const e=i.columns.find(e=>"instant"===e.id);if(e)return e.id}else{const e=i.columns.find(e=>"duration"===e.id);if(e)return e.id}}}return null}_findConceptInSection(e,t){for(const i of e){if(i.id===t||i.originalConceptId===t)return i;if(i.children){const e=this._findConceptInSection(i.children,t);if(e)return e}}return null}_populateFieldValues(e){let t=0,i=0;console.log("🔍 Starting field population..."),console.log("📦 Form data to populate:",e),Object.keys(e).forEach(o=>{const r=e[o];Object.keys(r).forEach(e=>{var n,s;const l=r[e],a=`${o}__${e}`;console.log(`🔍 Looking for field: ${a}`);const d=null==(n=this.shadowRoot)?void 0:n.querySelector(`#${CSS.escape(a)}`);d?(d instanceof HTMLInputElement||d instanceof HTMLTextAreaElement||d instanceof HTMLSelectElement)&&("checkbox"===d.type?d.checked=Boolean(l):d.value=null!=l?String(l):"",console.log(` ✅ Populated field ${a} with value:`,l),t++):(console.warn(` ❌ Field element NOT FOUND: ${a}`),console.warn(" Available fields in DOM:",Array.from((null==(s=this.shadowRoot)?void 0:s.querySelectorAll("input, textarea, select"))||[]).map(e=>e.id).filter(e=>e.includes(o.split("__")[0]))),i++)})}),console.log(`✅ Field population complete: ${t} populated, ${i} not found`)}_restoreCustomColumns(e){const t=new Map;e.forEach(e=>{t.has(e.sectionId)||t.set(e.sectionId,[]),t.get(e.sectionId).push(e)}),this._allSections.forEach(e=>{var i;const o=t.get(e.id);if(o){if(e.columns=o.map(e=>{const t={id:e.columnId,title:e.label,description:e.description,type:e.dimensionData?"dimension":"base",periodStartDate:e.startDate||e.date,periodEndDate:e.endDate||e.date,dimensionData:e.dimensionData,order:0,removable:"duration"!==e.columnId&&"instant"!==e.columnId,periodType:e.periodType};return console.log(`📅 [Draft Restore] Restoring column ${e.columnId}: title=${t.title}, description=${t.description}, startDate=${t.periodStartDate}, endDate=${t.periodEndDate}, periodType=${t.periodType}`),t}),(null==(i=this.xbrlInput)?void 0:i.datatypes)&&!e.datatypes){const t=Array.isArray(this.xbrlInput.datatypes)?this.xbrlInput.datatypes:this.xbrlInput.datatypes.concepts||[];e.datatypes=t,console.log(`✅ [Draft Restore] Attached ${t.length} datatypes to section ${e.id}`)}else e.datatypes?console.log(`ℹ️ [Draft Restore] Section ${e.id} already has ${e.datatypes.length} datatypes`):console.warn(`⚠️ [Draft Restore] No datatypes available for section ${e.id}`);this._regenerateFieldsForSection(e),console.log(` └─ Restored ${o.length} columns for section ${e.id}`)}}),this._currentSchema&&(this._currentSchema={...this._currentSchema,sections:this._allSections})}_mergeAdditionalCustomColumns(e){const t=new Map;e.forEach(e=>{e.columnId.startsWith("col-")&&(t.has(e.sectionId)||t.set(e.sectionId,[]),t.get(e.sectionId).push(e))}),this._allSections.forEach(e=>{var i;const o=t.get(e.id);if(o&&o.length>0){if(e.columns||(e.columns=[]),(null==(i=this.xbrlInput)?void 0:i.datatypes)&&!e.datatypes){const t=Array.isArray(this.xbrlInput.datatypes)?this.xbrlInput.datatypes:this.xbrlInput.datatypes.concepts||[];e.datatypes=t,console.log(`✅ [Merge Custom] Attached ${t.length} datatypes to section ${e.id}`)}else e.datatypes?console.log(`ℹ️ [Merge Custom] Section ${e.id} already has ${e.datatypes.length} datatypes`):console.warn(`⚠️ [Merge Custom] No datatypes available for section ${e.id}`);o.forEach(t=>{console.log(`📅 [Merge Custom Column] Column ${t.columnId}: col.startDate=${t.startDate}, col.endDate=${t.endDate}, col.date=${t.date}, col.periodType=${t.periodType}`);if(!e.columns.find(e=>e.id===t.columnId)){const i={id:t.columnId,title:t.label,description:t.description,type:t.dimensionData?"dimension":"base",periodStartDate:t.startDate||t.date,periodEndDate:t.endDate||t.date,dimensionData:t.dimensionData,order:e.columns.length,removable:!0,periodType:t.periodType};console.log(`📅 [New Column Created] Column ${i.id}: title=${i.title}, description=${i.description}, periodStartDate=${i.periodStartDate}, periodEndDate=${i.periodEndDate}, periodType=${i.periodType}`),e.columns.push(i),console.log(` └─ Added custom column ${t.columnId} to section ${e.id}`)}}),this._regenerateFieldsForSection(e)}}),this._currentSchema&&(this._currentSchema={...this._currentSchema,sections:this._allSections})}_applyCustomPeriodDataToFields(){if(!this._periodData||0===Object.keys(this._periodData).length)return void console.log("ℹ️ No custom period data to apply");let e=0;const t=i=>{i.forEach(i=>{if(this._periodData[i.id]){const t=this._periodData[i.id];i.fields&&i.fields.forEach(o=>{const r=t[o.columnId];r&&(r.startDate&&(o.periodStartDate=r.startDate),r.endDate&&(o.periodEndDate=r.endDate),r.instantDate&&(o.periodInstantDate=r.instantDate),e++,console.log(`✅ [Apply Period] Updated field ${i.id}/${o.columnId}: start=${o.periodStartDate}, end=${o.periodEndDate}, instant=${o.periodInstantDate}`))})}i.children&&i.children.length>0&&t(i.children)})};this._allSections.forEach(e=>{e.concepts&&e.concepts.length>0&&t(e.concepts)}),console.log(`📅 [Apply Period] Applied custom period data to ${e} fields`)}_regenerateFieldsForSection(e){if(!e.columns)return;const t=this._periodPreferences[e.id]||{showDuration:!0,showInstant:!0,showPreviousYear:!1},i=o=>{o.forEach(o=>{o.fields=[];this._shouldShowConceptBasedOnPeriodPreferences(o,t)&&e.columns.forEach(t=>{var i;const r=o.periodType,n=this._inferColumnPeriodType(t);if(o.abstract)return;const s=t.id.startsWith("col-"),l=t.id.startsWith("duration_")||t.id.startsWith("instant_"),a=!0===e.showPeriodControl;if(!(!n||"duration"===t.id||"default"===t.id||s&&a||l)&&r&&n&&r!==n)return void console.log(`⏭️ [Field Regeneration] Skipping field for ${o.id} in column ${t.id}: conceptPeriodType=${r}, columnPeriodType=${n}`);const d={id:`${o.id}_${t.id}`,conceptId:o.id,columnId:t.id,type:this._mapConceptTypeToFieldType(o.type),label:o.label,periodType:r,conceptType:o.type,periodStartDate:t.periodStartDate,periodEndDate:t.periodEndDate,periodInstantDate:"instant"===r?t.periodEndDate||t.periodStartDate:void 0};if(null==(i=this._periodData[o.id])?void 0:i[t.id]){const e=this._periodData[o.id][t.id];e.startDate&&(d.periodStartDate=e.startDate),e.endDate&&(d.periodEndDate=e.endDate),e.instantDate&&(d.periodInstantDate=e.instantDate),console.log(`✅ [Field Regeneration] Applied custom period data to ${o.id}/${t.id}:`,e),console.log(`✅ [Field Regeneration] Field properties after apply: periodStartDate=${d.periodStartDate}, periodEndDate=${d.periodEndDate}, periodInstantDate=${d.periodInstantDate}`)}else console.log(`ℹ️ [Field Regeneration] No custom period data for ${o.id}/${t.id}. Checking _periodData:`,this._periodData[o.id]);(o.id.includes("DescriptionLocationNL")||t.id.startsWith("col-"))&&console.log(`📅 [Field Regeneration] Concept ${o.id}, Column ${t.id}: field.periodStartDate=${d.periodStartDate}, field.periodEndDate=${d.periodEndDate}, column.periodStartDate=${t.periodStartDate}`),o.fields.push(d)}),o.children&&i(o.children)})};i(e.concepts)}_shouldShowConceptBasedOnPeriodPreferences(e,t){return!!e.abstract||(!e.periodType||!("duration"===e.periodType&&!t.showDuration)&&!("instant"===e.periodType&&!t.showInstant))}_inferColumnPeriodType(e){return e.periodType?e.periodType:e.periodStartDate&&e.periodEndDate?e.periodStartDate===e.periodEndDate?"instant":"duration":e.periodStartDate&&!e.periodEndDate?"instant":void 0}_mapConceptTypeToFieldType(e){return e?e.includes("monetary")||e.includes("Monetary")?"number":e.includes("date")||e.includes("Date")?"date":e.includes("boolean")||e.includes("Boolean")?"boolean":e.includes("integer")||e.includes("Integer")||e.includes("decimal")||e.includes("Decimal")?"number":"text":"text"}_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 n=this._findSectionForConcept(t);this._addConceptDataToSubmission(i,o,r,e,n||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}_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 n,s,l;const a=e.fields.find(e=>e.columnId===t);if(!a)return;const d="instant"===e.periodType,c=null==(n=this._periodData[e.id])?void 0:n[t],p=null==(s=this._unitData[e.id])?void 0:s[t],u=this._findColumnByIdInAllSections(t);console.log(`🔍 [Submission] Concept: ${e.id}, Column: ${t}, Field Period: ${c?JSON.stringify(c):"none"}, Unit: ${p||"none"}, Column Period: ${(null==u?void 0:u.periodStartDate)||"none"} - ${(null==u?void 0:u.periodEndDate)||"none"}`);const h=(null==c?void 0:c.startDate)||(null==u?void 0:u.periodStartDate)||a.periodStartDate||this.periodStartDate,m=(null==c?void 0:c.endDate)||(null==u?void 0:u.periodEndDate)||a.periodEndDate||this.periodEndDate,f=(null==c?void 0:c.instantDate)||a.periodInstantDate||m||h,b={conceptId:e.originalConceptId||e.id,columnId:t,value:i,period:{type:e.periodType||"duration",...d?{date:f}:{startDate:h,endDate:m}}};p&&(b.unit=p,console.log(`✅ [Submission] Adding unit to entry: ${p} for ${e.id}/${t}`)),(null==(l=null==u?void 0:u.dimensionData)?void 0:l.memberLabel)&&(b.dimension=u.dimensionData.memberLabel),console.log("📤 [Submission Entry] Created entry:",JSON.stringify(b,null,2)),o.push(b)}_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="instant"===e.period.type?e.period.date:`${e.period.startDate}_${e.period.endDate}`,o=`${e.conceptId}_${e.value}_${e.dimension||"no-dimension"}_${i}`;t.has(o)||t.set(o,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,n;if(!(null==(o=null==(i=this.xbrlInput)?void 0:i.hypercubes)?void 0:o[0]))return null;const s=null==t?void 0:t.id;if(!s)return null;const l=null==(r=this.xbrlInput.hypercubes[0].roles)?void 0:r.find(e=>e.roleId===s);if(!(null==l?void 0:l.items))return null;for(const a of l.items)if(a.dimensions){const t=a.dimensions.find(t=>t.id===e);if(null==(n=null==t?void 0:t.typedMember)?void 0:n.id)return t.typedMember.id}return null}_doesConceptApplyToTypedDimension(e,t,i){var o,r,n;if(!(null==(r=null==(o=this.xbrlInput)?void 0:o.hypercubes)?void 0:r[0]))return!1;const s=null==t?void 0:t.id;if(!s)return!1;const l=this.xbrlInput.hypercubes[0].roles.find(e=>e.roleId===s);if(!(null==(n=null==l?void 0:l.items)?void 0:n.length))return!1;for(const a of l.items){const t=e.originalConceptId||e.id;if(a.conceptIds&&a.conceptIds.includes(t)){const e=a.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 ${s}`),!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 n=this.xbrlInput.hypercubes[0].roles.find(e=>e.roleId===t.id);if(!(null==(r=null==n?void 0:n.items)?void 0:r.length))return[];const s=e.originalConceptId||e.id;for(const l of n.items)if(l.conceptIds&&l.conceptIds.includes(s)){const e=l.dimensions.filter(e=>e.typedMember).map(e=>e.id);return console.log(`🔍 [DynamicForm] Found applicable typed dimensions for concept ${s}:`,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&&e.fields.forEach((e,t)=>{}),e.fields&&e.fields.length>0&&e.fields.forEach(n=>{var s,l,a,d;const c=this._formData[e.id];let p=null==c?void 0:c[n.columnId];if((null==p||""===p)&&this.masterData){const t=n.conceptId||e.id.split("__").slice(0,-1).join("__")||e.id,i=this.masterData[t];null!=i&&""!==i&&(p=i,console.warn(` 📦 [Submission] Using masterData for: ${t} [${n.columnId}] = ${JSON.stringify(p)}`))}if(null!=p&&""!==p){const c=this._findColumnByIdInSection(n.columnId,i),u=null==(s=this._periodData[e.id])?void 0:s[n.columnId],h={conceptId:e.id,columnId:n.columnId,value:p,period:{type:e.periodType||"duration"}};if("instant"===e.periodType){const e=(null==u?void 0:u.instantDate)||(null==u?void 0:u.endDate)||(null==c?void 0:c.periodEndDate)||n.periodInstantDate||n.periodEndDate||n.periodStartDate||this.periodStartDate;h.period.date=e}else{const e=(null==u?void 0:u.startDate)||(null==c?void 0:c.periodStartDate)||n.periodStartDate||this.periodStartDate,t=(null==u?void 0:u.endDate)||(null==c?void 0:c.periodEndDate)||n.periodEndDate||this.periodEndDate;h.period.startDate=e,h.period.endDate=t}console.log(`🔍 [Submission] Concept: ${e.id}, Column: ${n.columnId}, Field Period: ${u?JSON.stringify(u):"none"}, Column Period: ${(null==c?void 0:c.periodStartDate)||"none"} - ${(null==c?void 0:c.periodEndDate)||"none"}, Used Period: ${"instant"===h.period.type?h.period.date:`${h.period.startDate} - ${h.period.endDate}`}`);const m=null==(l=this._unitData[e.id])?void 0:l[n.columnId];if(m?(h.unit=m,console.log(`✅ [Submission] Adding unit to entry: ${m} for ${e.id}/${n.columnId}`)):console.log(`⚠️ [Submission] No unit found in _unitData for ${e.id}/${n.columnId}. _unitData state:`,JSON.stringify(this._unitData,null,2)),"dimension"===(null==c?void 0:c.type)&&(null==(a=c.dimensionData)?void 0:a.dimensionIdKey)?(h.dimension=c.dimensionData.dimensionIdKey,console.log(`🔍 [DynamicForm] Using dimension key from field's column (${n.columnId}):`,c.dimensionData.dimensionIdKey)):console.log(`🔍 [DynamicForm] No dimension data found for field column ${n.columnId}. Column type: ${null==c?void 0:c.type}, has dimensionData: ${!!(null==c?void 0:c.dimensionData)}`),this._typedMemberData[n.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[n.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?(h.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 ${n.columnId}. Available columns:`,Object.keys(this._typedMemberData)),c&&console.log("🔍 [DynamicForm] Column details:",{id:c.id,type:c.type,hasTypedMembers:null==(d=c.dimensionData)?void 0:d.hasTypedMembers,dimensionData:c.dimensionData});r===o&&console.warn("[DUPLICATE DEBUG] Final submission entry:",h),t.push(h)}}),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}}_analyzeAllVisibleRoles(){if(this._currentSchema&&this._currentSchema.sections&&0!==this._currentSchema.sections.length){console.log(`🔍 Analyzing ${this._currentSchema.sections.length} visible roles for initial border status...`);for(const e of this._currentSchema.sections)this._analyzeAndLogRole(e.id);console.log("✅ Initial border status analysis complete for all visible roles")}else console.log("⏭️ No sections to analyze for initial border status")}_handleRoleContextMenu(e,t,i){e.preventDefault(),e.stopPropagation(),this._contextMenuX=e.clientX,this._contextMenuY=e.clientY,this._contextMenuRoleId=t,this._showRoleContextMenu=!0,console.log(`🖱️ Context menu opened for role: ${i} (ID: ${t})`),this.requestUpdate()}_closeRoleContextMenu(){this._showRoleContextMenu=!1,this._contextMenuRoleId=null,this.requestUpdate()}_handleRemoveRole(){if(!this._contextMenuRoleId)return void this._closeRoleContextMenu();const e=this._allSections.find(e=>e.id===this._contextMenuRoleId),t=(null==e?void 0:e.title)||"Unknown";if(console.log("🗑️ Removing role from side panel:"),console.log(` - Role ID: ${this._contextMenuRoleId}`),console.log(` - Role Title: ${t}`),Array.isArray(this._selectedRoleIds)&&(this._selectedRoleIds.length>0&&"object"==typeof this._selectedRoleIds[0]?this._selectedRoleIds=this._selectedRoleIds.filter(e=>e.roleId!==this._contextMenuRoleId):this._selectedRoleIds=this._selectedRoleIds.filter(e=>e!==this._contextMenuRoleId)),console.log(`✅ Role removed from _selectedRoleIds. Remaining roles: ${this._selectedRoleIds.length}`),this._activeSidePanelRoleId===this._contextMenuRoleId){const e=this._getRoleIdsArray();this._activeSidePanelRoleId=e.length>0?e[0]:null,console.log(`📌 Active role changed to: ${this._activeSidePanelRoleId||"None"}`)}this._applyRoleFilter(),this.dispatchEvent(new CustomEvent("role-removed",{detail:{roleId:this._contextMenuRoleId,roleTitle:t,remainingRolesCount:this._selectedRoleIds.length},bubbles:!0,composed:!0})),console.log(`✅ Role "${t}" successfully removed from side panel`),console.log("ℹ️ User can re-add this role using the Filter Roles dialog"),this._closeRoleContextMenu()}_handleSidePanelRoleClick(e){this._activeSidePanelRoleId&&this._activeSidePanelRoleId!==e&&this._analyzeAndLogRole(this._activeSidePanelRoleId),this._activeSidePanelRoleId=e}_analyzeAndLogRole(e){const t=this._allSections.find(t=>t.id===e);if(!t)return void console.warn(`⚠️ Section not found for roleId: ${e}`);console.warn("\n========================================"),console.warn(`🔍 ANALYZING ROLE: "${t.title}"`),console.warn("========================================"),this.masterData?console.warn("📦 masterData keys:",Object.keys(this.masterData)):console.warn("📦 masterData: NOT PROVIDED");const i=[];this._collectAllFields(t.concepts||[],new Set((t.columns||[]).map(e=>e.id)),t.columns||[],i),console.warn(`📊 Total fields found: ${i.length}`),console.warn("\n📋 FIELD DETAILS:"),i.forEach((e,t)=>{const i=e.isEmpty?"❌ EMPTY":"✅ FILLED";console.warn(` ${t+1}. ${e.conceptId} [${e.columnId}]: ${i} = ${JSON.stringify(e.value)}`)});const o=this._roleHasErrors(e),r=i.filter(e=>e.isEmpty).length,n=i.filter(e=>!e.isEmpty).length;let s;console.warn("\n📈 SUMMARY:"),console.warn(` Total Fields: ${i.length}`),console.warn(` Filled: ${n}`),console.warn(` Empty: ${r}`),console.warn(` Has Errors: ${o}`),o?(s="INVALID",console.warn("\n🔴 RESULT: INVALID (contains validation errors)")):r>0?(s="INCOMPLETE",console.warn(`\n🟠 RESULT: INCOMPLETE (${r} field(s) blank)`)):(s="COMPLETE",console.warn("\n🟢 RESULT: COMPLETE (all fields filled)")),console.warn("========================================\n"),"INVALID"===s||("INCOMPLETE"===s?(this._roleBorderStatuses.set(e,"incomplete"),this._roleBorderStatuses=new Map(this._roleBorderStatuses)):(this._roleBorderStatuses.set(e,"complete"),this._roleBorderStatuses=new Map(this._roleBorderStatuses)))}_collectAllFields(e,t,i,o){var r,n,s;for(const l of e)if(l.abstract)l.children&&l.children.length>0&&this._collectAllFields(l.children,t,i,o);else{if(l.fields&&l.fields.length>0){const e=l.fields.filter(e=>t.has(e.columnId));for(const t of e){const e=l.id,a=t.conceptId;let d=null==(r=this._formData[e])?void 0:r[t.columnId];void 0===d&&e!==a&&(d=null==(n=this._formData[a])?void 0:n[t.columnId]);const c=null==(s=this.masterData)?void 0:s[a];(null==d||"string"==typeof d&&""===d.trim())&&void 0!==c&&(d=c,console.warn(` 📦 Using masterData value for: ${a} [${t.columnId}] = ${JSON.stringify(d)}`));let p=null==d||"string"==typeof d&&""===d.trim();if(p&&l.facts&&l.facts.length>0){const e=i.find(e=>e.id===t.columnId),o={conceptId:a,columnId:t.columnId,periodStartDate:t.periodStartDate||(null==e?void 0:e.periodStartDate),periodEndDate:t.periodEndDate||(null==e?void 0:e.periodEndDate),periodInstantDate:t.periodInstantDate||("instant"===t.periodType?t.periodEndDate||t.periodStartDate:void 0),periodType:t.periodType,dimensionData:null==e?void 0:e.dimensionData},r=k.findMatchingFact(l.facts,o);r&&null!==r.value&&void 0!==r.value&&""!==r.value&&(d=r.value,p=!1,console.warn(` ✨ FACT PRE-POPULATED: ${a} [${t.columnId}] = ${JSON.stringify(d)}`))}console.warn(` 🔍 Field lookup: concept.id="${e}", field.conceptId="${a}", value=${JSON.stringify(d)}, isEmpty=${p}`),o.push({conceptId:a,columnId:t.columnId,value:d,isEmpty:p})}}l.children&&l.children.length>0&&this._collectAllFields(l.children,t,i,o)}}_handleSidePanelSearchInput(e){const t=e.target;this._sidePanelSearchQuery=t.value}_clearSidePanelSearch(){var e;this._sidePanelSearchQuery="";const t=null==(e=this.shadowRoot)?void 0:e.querySelector(".side-panel-search-input");t&&(t.value="",t.focus())}_toggleSidePanelCollapse(){this._sidePanelCollapsed=!this._sidePanelCollapsed}_isSectionBlank(e){const t=e.columns||this._columns,i=e=>{var o;for(const r of e){if(!r.abstract)for(const e of t){const t=null==(o=this._formData[r.id])?void 0:o[e.id];if(null!=t&&""!==t)return!0}if(r.children&&r.children.length>0&&i(r.children))return!0}return!1};return!i(e.concepts)}_filterSidePanelSections(e){if(!this._sidePanelSearchQuery.trim())return e;const t=this._sidePanelSearchQuery.toLowerCase().trim();return e.filter(e=>{var i,o,r;const n=e.title.toLowerCase().includes(t),s=e.id.toLowerCase().includes(t),l=(null==(i=e.description)?void 0:i.toLowerCase().includes(t))||!1,a=(null==(r=null==(o=e.metadata)?void 0:o.roleURI)?void 0:r.toLowerCase().includes(t))||!1;return n||s||l||a})}_renderAdminModeContent(t){var i,o;if(!t)return e.html`
|
|
2429
|
+
`,ie([S({type:Boolean,reflect:!0})],exports.JupiterFilterRolesDialog.prototype,"open",2),ie([S({type:Array})],exports.JupiterFilterRolesDialog.prototype,"availableRoles",2),ie([S({type:Array})],exports.JupiterFilterRolesDialog.prototype,"selectedRoleIds",2),ie([S({type:Object})],exports.JupiterFilterRolesDialog.prototype,"periodPreferences",2),ie([S({type:String})],exports.JupiterFilterRolesDialog.prototype,"mode",2),ie([S({type:Object})],exports.JupiterFilterRolesDialog.prototype,"hypercubeData",2),ie([w()],exports.JupiterFilterRolesDialog.prototype,"_tempSelectedRoles",2),ie([w()],exports.JupiterFilterRolesDialog.prototype,"_searchQuery",2),ie([w()],exports.JupiterFilterRolesDialog.prototype,"_filteredRoles",2),ie([w()],exports.JupiterFilterRolesDialog.prototype,"_tempPeriodPreferences",2),ie([w()],exports.JupiterFilterRolesDialog.prototype,"_selectedAvailableRole",2),ie([w()],exports.JupiterFilterRolesDialog.prototype,"_selectedChosenRole",2),ie([w()],exports.JupiterFilterRolesDialog.prototype,"_chosenSearchQuery",2),ie([w()],exports.JupiterFilterRolesDialog.prototype,"_draggedRoleId",2),ie([w()],exports.JupiterFilterRolesDialog.prototype,"_dragOverRoleId",2),ie([w()],exports.JupiterFilterRolesDialog.prototype,"_chosenRoleOrder",2),exports.JupiterFilterRolesDialog=ie([t("jupiter-filter-roles-dialog")],exports.JupiterFilterRolesDialog);var oe=Object.defineProperty,re=Object.getOwnPropertyDescriptor,ne=(e,t,i,o)=>{for(var r,n=o>1?void 0:o?re(t,i):t,s=e.length-1;s>=0;s--)(r=e[s])&&(n=(o?r(t,i,n):r(n))||n);return o&&n&&oe(t,i,n),n};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.language="en",this.reportingLanguage="en",this.display="accordion",this.mode="inputForm",this.roleFilterAxes=[],this.showLastValidationResultBtn=!1,this.isDraftSaving=!1,this.defaultUnits=[],this._formData={},this._draftLoaded=!1,this._preservedFormData={},this._periodData={},this._preservedPeriodData={},this._unitData={},this._preservedUnitData={},this._typedMemberData={},this._preservedTypedMemberData={},this._repeatCounts={},this._columns=[],this._errors=[],this._touched=new Set,this._dirty=!1,this._valid=!0,this._submitted=!1,this._xbrlFormErrors=[],this._showErrorPopup=!1,this._submitDisabled=!1,this._allSections=[],this._selectedRoleIds=[],this._showFilterDialog=!1,this._periodPreferences={},this._activeSidePanelRoleId=null,this._sidePanelSearchQuery="",this._sidePanelCollapsed=!1,this._adminRoleConfigs={},this._roleBorderStatuses=new Map,this._showRoleContextMenu=!1,this._contextMenuX=0,this._contextMenuY=0,this._contextMenuRoleId=null,this._validationStatus="idle",this._skipDraftLoading=!1,this._skipPeriodPreferencesRestore=!1,this._autoSaveTimer=null,this._lastAutoSaveSnapshot="",this._lastSavedDraftSnapshot=""}connectedCallback(){super.connectedCallback(),this.addEventListener("period-change",e=>{console.log("🌍 [GLOBAL DynamicForm] Caught period-change event on element:",e);const t=e;console.log("🌍 [GLOBAL DynamicForm] Event detail:",t.detail),this._handlePeriodChange(t)}),this.addEventListener("unit-change",e=>{console.log("🏷️ [GLOBAL DynamicForm] Caught unit-change event on element:",e);const t=e;console.log("🏷️ [GLOBAL DynamicForm] Event detail:",t.detail),this._handleUnitChange(t)}),this.addEventListener("field-blur",e=>{console.log("🚨 [DynamicForm] field-blur event listener triggered!",e);const t=e;this._handleFieldBlur(t)}),document.addEventListener("click",()=>{this._showRoleContextMenu&&(this._showRoleContextMenu=!1,this.requestUpdate())}),this._autoSaveTimer=setInterval(()=>{const e=JSON.stringify(this._formData);if(""===this._lastAutoSaveSnapshot)return this._lastAutoSaveSnapshot=e,void console.log("ℹ️ [Auto Save] Baseline initialized; no draft save emitted.");e!==this._lastAutoSaveSnapshot?(this._lastAutoSaveSnapshot=e,this._handleSaveDraft("auto")):console.log("ℹ️ [Auto Save] No form state change detected; skipping draft save emit.")},3e4),this._initializeForm()}disconnectedCallback(){super.disconnectedCallback(),null!==this._autoSaveTimer&&(clearInterval(this._autoSaveTimer),this._autoSaveTimer=null)}updated(e){e.has("language")&&T.setLanguage(this.language),(e.has("xbrlInput")||e.has("defaultUnits"))&&this.xbrlInput&&this.defaultUnits&&this.defaultUnits.length>0&&this._applyDefaultUnitsToDatatypes(),(e.has("xbrlInput")||e.has("schema")||e.has("language")||e.has("periodStartDate")||e.has("periodEndDate")||e.has("roleFilterAxes"))&&this._initializeForm()}_applyDefaultUnitsToDatatypes(){var e;if(!(null==(e=this.xbrlInput)?void 0:e.datatypes)||!this.defaultUnits||0===this.defaultUnits.length)return;console.log("🔧 [DynamicForm] Applying defaultUnits to datatypes:",this.defaultUnits);const t=Array.isArray(this.xbrlInput.datatypes)?this.xbrlInput.datatypes:this.xbrlInput.datatypes.concepts;t&&0!==t.length?this.defaultUnits.forEach(e=>{Object.entries(e).forEach(([e,i])=>{const o=t.find(t=>t.type===e||t.id===e);if(o&&o.units&&o.units.length>0){const t=o.units.find(e=>e.id===i);t?(o.units.forEach(e=>e.isDefault=!1),t.isDefault=!0,console.log(`✅ [DynamicForm] Set isDefault=true for unit "${i}" in datatype "${e}"`)):console.warn(`⚠️ [DynamicForm] Unit "${i}" not found in datatype "${e}"`)}else console.warn(`⚠️ [DynamicForm] Datatype "${e}" not found or has no units`)})}):console.warn("⚠️ [DynamicForm] No datatypes found to apply defaults to")}_initializeForm(){var e;if(this._draftStorageService||(this._draftStorageService=new E(!1)),this.xbrlInput)try{if(console.log("🔄 Initializing form from XBRL input:",this.xbrlInput),console.log("📅 Using period dates:",this.periodStartDate,"to",this.periodEndDate),console.log("🌐 Using language:",this.language),this._initializePeriodPreferencesFromData(),this._applyAxisFilterToPeriodPreferences(),this._applyDimensionShowPreviousYear(),console.log("⚙️ Using period preferences:",this._periodPreferences),this._currentSchema=F.buildFormSchema(this.xbrlInput,this.periodStartDate,this.periodEndDate,this.language,this._periodPreferences),console.log("✅ Generated schema with sections:",this._currentSchema.sections.length),this._allSections=[...this._currentSchema.sections],Array.isArray(this._selectedRoleIds)&&this._selectedRoleIds.length>0&&"object"==typeof this._selectedRoleIds[0]){console.log("🔄 Applying custom role order to _allSections from _selectedRoleIds");const e=this._selectedRoleIds,t=new Map;e.forEach(e=>{t.set(e.roleId,e.order)}),this._allSections=[...this._allSections].sort((e,i)=>(t.get(e.id)??999)-(t.get(i.id)??999)),console.log("✅ Custom order applied to _allSections:",this._allSections.map(e=>e.title))}if(0===this._selectedRoleIds.length){const e=this.roleFilterAxes&&this.roleFilterAxes.length>0?this._filterRolesByAxisConfig(this._allSections):this._allSections;this._selectedRoleIds=e.map(e=>e.id),console.log(`✅ Auto-selected ${this._selectedRoleIds.length} roles (of ${this._allSections.length} total)`)}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._extractTypedMembersFromFacts(),this._skipDraftLoading?(console.log("⏭️ Skipping draft loading during preference update"),this._analyzeAllVisibleRoles()):this._loadDraftIfExists().then(()=>{this._analyzeAllVisibleRoles()}).catch(()=>{this._analyzeAllVisibleRoles()}),this._validateForm()}_extractTypedMembersFromFacts(){var e;(null==(e=this._currentSchema)?void 0:e.sections)&&(this._currentSchema.sections.forEach(e=>{this._extractTypedMembersFromConcepts(e.concepts||[],e)}),console.log("✅ [DynamicForm] Typed member data populated:",this._typedMemberData))}_extractTypedMembersFromConcepts(e,t){e.forEach(e=>{e.facts&&e.facts.length>0&&(console.log(`🔍 [DynamicForm] Checking concept ${e.id} with ${e.facts.length} facts`),e.facts.forEach(i=>{if(i.dimensions&&Array.isArray(i.dimensions)){const o=i.dimensions.filter(e=>"typed"===e.dimensionType&&e.typedMemberValue);if(o.length>0){console.log(`📝 [DynamicForm] Found ${o.length} typed dimensions in fact:`,{factName:i.name,typedDimensions:o.map(e=>({dimension:e.dimension,typedMemberValue:e.typedMemberValue}))});const r=this._findColumnWithTypedMembers(i,e,t);r?(console.log(`✅ [DynamicForm] Found matching column: ${r.id}`),o.forEach(i=>{var o,n;const s=this._normalizeAxisId(i.dimension),l=null==(n=null==(o=r.dimensionData)?void 0:o.typedMembers)?void 0:n.find(e=>e.axisId===s||this._normalizeAxisId(e.axisId)===s);if(l){this._typedMemberData[r.id]||(this._typedMemberData[r.id]={});const o=l.axisId;this._typedMemberData[r.id][o]=i.typedMemberValue,console.log("✅ [DynamicForm] Set typed member value:",{sectionId:t.id,conceptId:e.id,columnId:r.id,axisKey:o,typedMemberValue:i.typedMemberValue})}else console.warn(`⚠️ [DynamicForm] Typed member not found for axis: ${s}`)})):console.warn("⚠️ [DynamicForm] No matching column found for fact with typed dimensions")}}})),e.children&&e.children.length>0&&this._extractTypedMembersFromConcepts(e.children,t)})}_findColumnWithTypedMembers(e,t,i){var o;if(!t.fields||0===t.fields.length)return null;const r=i.columns||[];if(0===r.length)return null;for(const n of t.fields){const t=r.find(e=>e.id===n.columnId);if(t&&(null==(o=t.dimensionData)?void 0:o.hasTypedMembers)){const i=(e.dimensions||[]).filter(e=>"explicit"===e.dimensionType),o=t.dimensionData.combinations||[];if(0===i.length||i.length===o.length&&i.every(e=>o.some(t=>this._normalizeAxisId(e.dimension)===this._normalizeAxisId(t.axisId)&&this._normalizeMemberId(e.member)===this._normalizeMemberId(t.memberId))))return t}}return null}_findColumnForFactDimensions(e,t,i){if(!t.fields||0===t.fields.length)return console.log(`⚠️ [DynamicForm] No fields for concept: ${t.id}`),null;const o=i.columns||[];if(0===o.length)return console.log(`⚠️ [DynamicForm] No columns in section: ${i.id}`),null;for(const r of t.fields){const t=o.find(e=>e.id===r.columnId);if(t&&t.dimensionData){const i=e.dimensions||[],o=t.dimensionData.combinations||[];console.log(`🔍 [DynamicForm] Checking column ${t.id}:`,{factDimensions:i.map(e=>({axis:e.dimension,member:e.member,type:e.dimensionType})),columnDimensions:o.map(e=>({axis:e.axisId,member:e.memberId}))});if(o.every(e=>i.some(t=>{const i=this._normalizeAxisId(t.dimension)===this._normalizeAxisId(e.axisId);if("explicit"===t.dimensionType){const o=this._normalizeMemberId(t.member)===this._normalizeMemberId(e.memberId);return i&&o}return"typed"===t.dimensionType&&i})))return t}}return null}_normalizeAxisId(e){return e?e.includes(":")?e.split(":").pop()||e:e.includes("_")&&e.split("_").pop()||e:""}_normalizeMemberId(e){return e?e.includes(":")?e.split(":").pop()||e:e.includes("_")&&e.split("_").pop()||e:""}_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}]}_initializePeriodPreferencesFromData(){var e,t,i;if(!(null==(i=null==(t=null==(e=this.xbrlInput)?void 0:e.presentation)?void 0:t[0])?void 0:i.roles))return;const o={...this._periodPreferences};this.xbrlInput.presentation[0].roles.forEach(e=>{if(!o[e.id]){const t=!0===e.showPreviousYear,i=void 0===e.instant||!0===e.instant,r=void 0===e.duration||!0===e.duration;o[e.id]={showDuration:r,showInstant:i,showPreviousYear:t}}}),this._periodPreferences=o}_applyAxisFilterToPeriodPreferences(){var e,t,i,o;if(!this.roleFilterAxes||0===this.roleFilterAxes.length)return;if(!(null==(i=null==(t=null==(e=this.xbrlInput)?void 0:e.hypercubes)?void 0:t[0])?void 0:i.roles))return;const r=this.xbrlInput.hypercubes[0].roles,n={...this._periodPreferences};for(const s of r){const e=s.roleId,t=n[e];if((null==t?void 0:t.dimensionSelections)&&t.dimensionSelections.length>0)continue;const i=[];for(const r of this.roleFilterAxes)for(const e of s.items||[]){if(null==(o=e.dimensions)?void 0:o.find(e=>e.id===r.id||r.conceptName&&e.conceptName===r.conceptName)){i.push({dimensionId:r.id,dimensionLabel:r.conceptName||r.id,selectedMemberIds:r.members.filter(e=>!0===e.available).map(e=>e.id)});break}}i.length>0&&(n[e]={showDuration:(null==t?void 0:t.showDuration)??!0,showInstant:(null==t?void 0:t.showInstant)??!0,showPreviousYear:(null==t?void 0:t.showPreviousYear)??!1,dimensionSelections:i})}this._periodPreferences=n}_applyDimensionShowPreviousYear(){var e,t;if("admin"!==this.mode)return;const i=!(!this.dynaformsFacts||!this.dynaformsMetadata),o=(null==(e=this._draftStorageService)?void 0:e.hasDraft())??!1;if(i||o)return;const r={...this._periodPreferences};let n=!1;for(const s of Object.keys(r)){const e=r[s];if(e.showPreviousYear)continue;((null==(t=e.dimensionSelections)?void 0:t.some(e=>e.selectedMemberIds&&e.selectedMemberIds.length>0))??!1)&&(r[s]={...e,showPreviousYear:!0},n=!0,console.log(`📅 [JDF-010] Auto-enabled showPreviousYear for role "${s}" (has dimension members)`))}n&&(this._periodPreferences=r)}_getRoleIdsArray(){return Array.isArray(this._selectedRoleIds)&&0!==this._selectedRoleIds.length?"string"==typeof this._selectedRoleIds[0]?this._selectedRoleIds:this._selectedRoleIds.map(e=>e.roleId):[]}_applyRoleFilter(){if(!this._currentSchema||!this._allSections.length)return;const e=this._getRoleIdsArray();if(console.log(`🔍 Applying role filter: ${e.length} selected out of ${this._allSections.length} total`),0===e.length)return console.log("📝 No roles selected - showing empty form"),this._currentSchema={...this._currentSchema,sections:[]},void this.requestUpdate();this._preserveDataForHiddenSections();const t=this._allSections.filter(t=>e.includes(t.id)),i=this._sortSectionsByCustomOrder(t);console.log(`📊 Filtered sections: ${i.length}`),console.log("📋 Custom order applied:",i.map(e=>e.title)),this._restoreDataForVisibleSections(i),this._currentSchema={...this._currentSchema,sections:i},console.log(`✅ Schema updated with custom order. Current sections count: ${this._currentSchema.sections.length}`),this.requestUpdate()}_sortSectionsByCustomOrder(e){if(Array.isArray(this._selectedRoleIds)&&this._selectedRoleIds.length>0&&"object"==typeof this._selectedRoleIds[0]){const t=this._selectedRoleIds,i=new Map;return t.forEach(e=>{i.set(e.roleId,e.order)}),[...e].sort((e,t)=>(i.get(e.id)??999)-(i.get(t.id)??999))}return e}_filterRolesByAxisConfig(e){var t;if(!this.roleFilterAxes||0===this.roleFilterAxes.length)return e;if(!(null==(t=this.xbrlInput)?void 0:t.hypercubes)||0===this.xbrlInput.hypercubes.length)return e;const i=this.xbrlInput.hypercubes[0];return e.filter(e=>{var t;const o=null==(t=i.roles)?void 0:t.find(t=>t.roleId===e.id);if(!o||!o.items||0===o.items.length)return!0;for(const i of this.roleFilterAxes){const e=new Set(i.members.filter(e=>!0===e.available).map(e=>e.id));let t=!1,r=!1;for(const n of o.items){if(!n.dimensions||0===n.dimensions.length)continue;const o=n.dimensions.find(e=>e.id===i.id||i.conceptName&&e.conceptName===i.conceptName);if(o){if(t=!0,o.members)for(const t of o.members)if(e.has(t.id)){r=!0;break}if(r)break}}if(t&&!r)return!1}return!0})}_preserveDataForHiddenSections(){var e;const t=(null==(e=this._currentSchema)?void 0:e.sections.map(e=>e.id))||[],i=this._getRoleIdsArray();t.filter(e=>!i.includes(e)).forEach(e=>{const t=this._allSections.find(t=>t.id===e);t&&this._preserveSectionData(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]}),e.fields.forEach(t=>{this._typedMemberData[t.columnId]&&(this._preservedTypedMemberData[t.columnId]={...this._typedMemberData[t.columnId]});const i=`${e.id}__${t.columnId}`;this._typedMemberData[i]&&(this._preservedTypedMemberData[i]={...this._typedMemberData[i]})}),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]}),e.fields.forEach(t=>{this._preservedTypedMemberData[t.columnId]&&(this._typedMemberData[t.columnId]={...this._preservedTypedMemberData[t.columnId]});const i=`${e.id}__${t.columnId}`;this._preservedTypedMemberData[i]&&(this._typedMemberData[i]={...this._preservedTypedMemberData[i]})}),e.children&&e.children.forEach(e=>{this._restoreConceptData(e)})}_shouldShowFilterButton(){return!0}_handleFilterRolesClick(){this._showFilterDialog=!0}_handleFilterDialogCancel(){this._showFilterDialog=!1;const e=this._getRoleIdsArray().length;console.log(`🚫 Filter dialog cancelled. Current selection: ${e}/${this._allSections.length}`)}_handleRoleFilterApply(e){var t,i;const{selectedRoleIds:o,periodPreferences:r}=e.detail;console.log("🎯 Filter apply triggered"),console.log("📊 Old _selectedRoleIds:",this._selectedRoleIds),console.log("📊 New selectedRoleIds from dialog:",o),this._selectedRoleIds=o,this._periodPreferences=r,console.log("📊 Updated _selectedRoleIds:",this._selectedRoleIds),console.log("📊 New period preferences (including dimension selections):",this._periodPreferences),console.log("💾 Capturing current form data before reinitialization...");const n=this._generateSubmissionData(),s=this._draftStorageService.createMetadataSnapshot(this.periodStartDate,this.periodEndDate,this.language,this._selectedRoleIds,this._allSections,this._typedMemberData,this._periodPreferences,this._periodData,this._unitData,this.reportingLanguage,this._repeatCounts);this._draftStorageService.saveDraft(n,s),console.log("✅ Current form data saved to draft storage with NEW preferences"),this._skipPeriodPreferencesRestore=!0,this._skipDraftLoading=!0,console.log("🔄 Reinitializing form with new filter settings..."),this._initializeForm(),this._skipDraftLoading=!1,this._skipPeriodPreferencesRestore=!1,console.log("📊 After _initializeForm, _currentSchema.sections.length:",null==(t=this._currentSchema)?void 0:t.sections.length),console.log("📊 Section IDs:",null==(i=this._currentSchema)?void 0:i.sections.map(e=>e.id)),console.log("📥 Restoring form data from draft after reinitialization..."),this._loadDraftIfExists().then(()=>{console.log("✅ Form data restored successfully after reinitialization")}).catch(e=>{console.error("❌ Error restoring form data after reinitialization:",e)}),this._showFilterDialog=!1;const l=Array.isArray(this._selectedRoleIds)&&this._selectedRoleIds.length>0?(this._selectedRoleIds[0],this._selectedRoleIds.length):0;console.log(`🎯 Applied role filter: ${l}/${this._allSections.length} roles selected`),console.log("📋 Enhanced selectedRoleIds structure:",this._selectedRoleIds),this.dispatchEvent(new CustomEvent("roles-filter-changed",{detail:{selectedRoleIds:o,totalRoles:this._allSections.length,visibleRoles:l,periodPreferences:r},bubbles:!0}))}_haveDimensionSelectionsChanged(e){var t;const i=new Set([...Object.keys(this._periodPreferences||{}),...Object.keys(e||{})]);for(const o of i){const i=null==(t=this._periodPreferences)?void 0:t[o],r=null==e?void 0:e[o],n=(null==i?void 0:i.dimensionSelections)||[],s=(null==r?void 0:r.dimensionSelections)||[];if(JSON.stringify(n.sort((e,t)=>e.dimensionId.localeCompare(t.dimensionId)))!==JSON.stringify(s.sort((e,t)=>e.dimensionId.localeCompare(t.dimensionId))))return console.log(`🔍 Dimension selection changed for role: ${o}`),console.log(" Old:",n),console.log(" New:",s),!0}return!1}_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],n=C.validateField(o.id,i.id,o.columnId,r,o.type,o.validation||[]);t.push(...n)}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;console.log(`📝 Field change: conceptId=${i}, columnId=${o}, value=${r}, fieldId=${t}`);const n={...this._formData};n[i]||(n[i]={});const s=n[i][o];n[i]={...n[i],[o]:r},this._formData=n,console.log(`💾 Updated formData[${i}]:`,this._formData[i]),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:s},bubbles:!0}))}_handlePeriodChange(e){console.log("🎯 [DynamicForm] _handlePeriodChange called with event:",e),console.log("🎯 [DynamicForm] Event detail:",e.detail);const{conceptId:t,columnId:i,periodType:o,periodStartDate:r,periodEndDate:n,periodInstantDate:s,unit:l}=e.detail;console.log(`📅 Period change received: conceptId=${t}, columnId=${i}, periodType=${o}, startDate=${r}, endDate=${n}, instantDate=${s}, unit=${l}`);const a={...this._periodData};a[t]||(a[t]={}),a[t]={...a[t],[i]:{startDate:r,endDate:n,instantDate:s}},this._periodData=a,console.log(`💾 Period data stored for [${t}][${i}]:`,this._periodData[t][i]),console.log("📦 Full period data state:",JSON.stringify(this._periodData,null,2)),l&&this._storeUnit(t,i,l),this._dirty=!0,this.requestUpdate()}_handleUnitChange(e){console.log("🏷️ [DynamicForm] _handleUnitChange called with event:",e),console.log("🏷️ [DynamicForm] Event detail:",e.detail);const{conceptId:t,columnId:i,unit:o}=e.detail;console.log(`🏷️ Unit change received: conceptId=${t}, columnId=${i}, unit=${o}`),this._storeUnit(t,i,o),this._dirty=!0,this.requestUpdate()}_storeUnit(e,t,i){console.log(`🔧 [_storeUnit] Called with conceptId=${e}, columnId=${t}, unit=${i}`),console.log("🔧 [_storeUnit] Current _unitData before update:",JSON.stringify(this._unitData,null,2));const o={...this._unitData};o[e]||(console.log(`🔧 [_storeUnit] Creating new entry for conceptId: ${e}`),o[e]={}),o[e]={...o[e],[t]:i},this._unitData=o,console.log(`💾 [_storeUnit] Unit data stored for [${e}][${t}]:`,this._unitData[e][t]),console.log("📦 [_storeUnit] Full unit data state after update:",JSON.stringify(this._unitData,null,2))}_generateUniqueConceptKey(e,t){return`${e}::${t}`}_extractOriginalConceptId(e){const t=e.split("::");return t.length>1?t[1]:e}_handleAddConceptRepeat(e){const{conceptId:t}=e.detail;this._repeatCounts={...this._repeatCounts,[t]:(this._repeatCounts[t]||0)+1},this._dirty=!0}_handleRemoveConceptRepeat(e){const{conceptId:t}=e.detail,i=t.match(/^(.+)__repeat_(\d+)$/),o=i?i[1]:t,r=i?parseInt(i[2]):this._repeatCounts[t]||0,n=this._repeatCounts[o]||0;if(n<=0||r<1||r>n)return;const s={...this._formData},l={...this._typedMemberData},a={...this._unitData},d={...this._periodData};for(let u=r;u<n;u++){const e=`${o}__repeat_${u+1}`,t=`${o}__repeat_${u}`;void 0!==s[e]?s[t]=s[e]:delete s[t];const i=`${t}__`,r=`${e}__`,n=Object.keys(l).filter(e=>e.startsWith(r));Object.keys(l).filter(e=>e.startsWith(i)).forEach(e=>delete l[e]),n.forEach(e=>{l[`${t}__${e.slice(r.length)}`]=l[e]}),n.forEach(e=>delete l[e]),void 0!==a[e]?a[t]=a[e]:delete a[t],void 0!==d[e]?d[t]=d[e]:delete d[t]}const c=`${o}__repeat_${n}`;delete s[c],delete a[c],delete d[c];const p=`${c}__`;Object.keys(l).filter(e=>e.startsWith(p)).forEach(e=>delete l[e]),this._formData=s,this._typedMemberData=l,this._unitData=a,this._periodData=d,this._repeatCounts={...this._repeatCounts,[o]:n-1},this._dirty=!0}_handleTypedMemberChange(e){const{columnId:t,axisId:i,value:o,conceptId:r}=e.detail,n=r?`${r}__${t}`:t;console.log(`🔍 [DynamicForm] Typed member change: storageKey=${n}, axisId=${i}, value=${o}`);const s={...this._typedMemberData};s[n]||(s[n]={}),s[n]={...s[n],[i]:o},this._typedMemberData=s,this._dirty=!0,this.requestUpdate(),this.dispatchEvent(new CustomEvent("typed-member-change",{detail:{columnId:t,axisId:i,value:o},bubbles:!0}))}_handleFieldBlur(e){var t;console.log("🟧 [DynamicForm] _handleFieldBlur received event:",e),console.log("🟧 [DynamicForm] Event detail:",e.detail);const{fieldId:i,conceptId:o,columnId:r,xbrlValidationErrors:n}=e.detail;console.log(`🟧 [DynamicForm] Extracted - fieldId: ${i}, conceptId: ${o}, columnId: ${r}`),console.log("🟧 [DynamicForm] xbrlValidationErrors:",n);let s="";const l=e.composedPath();console.log(`🟧 [DynamicForm] Event path length: ${l.length}`);for(const a of l){const e=a;if("JUPITER-FORM-SECTION"===e.tagName){s=e.getAttribute("section-id")||"",console.log(`🟧 [DynamicForm] Found section element with id: ${s}`);break}}if(console.log(`🟧 [DynamicForm] Found sectionId: ${s}`),console.log(`🟧 [DynamicForm] Processing errors - has errors: ${n&&n.length>0}`),n&&n.length>0){console.log(`🟧 [DynamicForm] Adding/updating error for fieldId: ${i}, sectionId: ${s}`);const e=(null==(t=this._formData[o])?void 0:t[r])||"",l=this._xbrlFormErrors.findIndex(e=>e.fieldId===i&&e.sectionId===s),a={sectionId:s,fieldId:i,conceptId:o,columnId:r,value:e,errors:n};console.log("🟧 [DynamicForm] New error object:",a),console.log(`🟧 [DynamicForm] Existing index: ${l}`),l>=0?(this._xbrlFormErrors=[...this._xbrlFormErrors.slice(0,l),a,...this._xbrlFormErrors.slice(l+1)],console.log(`🟧 [DynamicForm] Updated existing error at index ${l}`)):(this._xbrlFormErrors=[...this._xbrlFormErrors,a],console.log("🟧 [DynamicForm] Added new error"))}else{console.log(`🟧 [DynamicForm] Removing error (if exists) for fieldId: ${i}, sectionId: ${s}`);const e=this._xbrlFormErrors.length;this._xbrlFormErrors=this._xbrlFormErrors.filter(e=>!(e.fieldId===i&&e.sectionId===s)),console.log(`🟧 [DynamicForm] Removed ${e-this._xbrlFormErrors.length} errors`)}console.log(`🔍 [Validation] Total errors: ${this._xbrlFormErrors.length}`,this._xbrlFormErrors)}_getSectionTitle(e){console.log(`🔍 [_getSectionTitle] Looking for sectionId: "${e}"`),console.log("🔍 [_getSectionTitle] Available sections:",this._allSections.map(e=>({id:e.id,title:e.title})));const t=this._allSections.find(t=>t.id===e),i=(null==t?void 0:t.title)||e||"(Unknown Section)";return console.log(`🔍 [_getSectionTitle] Result: "${i}"`),i}_roleHasErrors(e){return this._xbrlFormErrors.some(t=>t.sectionId===e)}async _handleErrorFieldClick(e,t,i){var o,r,n,s;console.log(`🎯 [Error Click] Attempting to focus field: ${e}__${t} in section: ${i}`),this._showErrorPopup=!1,this.requestUpdate(),await this.updateComplete,"sidePanel"===this.display&&this._activeSidePanelRoleId!==i&&(console.log(`🔀 Switching to section: ${i} (currently on: ${this._activeSidePanelRoleId})`),this._activeSidePanelRoleId=i,this.requestUpdate(),await this.updateComplete,await new Promise(e=>setTimeout(e,500)));const l=null==(o=this.shadowRoot)?void 0:o.querySelectorAll("jupiter-form-section");let a=null;if(null==l||l.forEach(e=>{var t;(null==(t=e.section)?void 0:t.id)===i&&(a=e)}),!a)return void console.warn(`⚠️ Section not found: ${i}`);if(console.log("✅ Found section element:",a),(null==(r=a.section)?void 0:r.collapsed)?(console.log("📂 Expanding collapsed section"),a.section.collapsed=!1,a.requestUpdate(),await a.updateComplete,await new Promise(e=>setTimeout(e,500))):(await a.updateComplete,await new Promise(e=>setTimeout(e,100))),console.log(`🔍 Section shadow DOM exists: ${!!a.shadowRoot}`),a.shadowRoot){console.log(`🔍 Shadow DOM innerHTML length: ${(null==(n=a.shadowRoot.innerHTML)?void 0:n.length)||0}`);const e=a.shadowRoot.querySelectorAll("*");console.log(`🔍 Total elements in shadow DOM: ${e.length}`);const t=Array.from(e).filter(e=>{const t=e;return!(!t.tagName||!t.tagName.includes("-"))});console.log("🔍 Custom elements found:",t.map(e=>e.tagName).join(", "))}const d=`${e}_${t}_field`;console.log(`🔍 Looking for input with fieldId: ${d}`),console.log(`🔍 Looking for field with conceptId: ${e} AND columnId: ${t}`);const c=null==(s=a.shadowRoot)?void 0:s.querySelectorAll("jupiter-concept-tree");let p=null;if(console.log(`🔍 Found ${(null==c?void 0:c.length)||0} concept-tree elements`),c&&c.forEach((i,o)=>{var r;if(p)return;const n=null==(r=i.shadowRoot)?void 0:r.querySelectorAll("jupiter-form-field");console.log(`🔍 Concept tree ${o}: Found ${(null==n?void 0:n.length)||0} form-field elements`),null==n||n.forEach((i,o)=>{var r;if(!p&&(console.log(` Field ${o}: conceptId=${i.conceptId}, columnId=${i.columnId}`),i.conceptId===e&&i.columnId===t)){const e=null==(r=i.shadowRoot)?void 0:r.querySelector("input, textarea");console.log(` -> Matched! Input element found: ${!!e}`),e&&(p=e,console.log("✅ Found input element in form-field"))}})}),!p)return void console.warn(`⚠️ Input field not found for: ${d}`);const u=p;a.scrollIntoView({behavior:"smooth",block:"start"}),await new Promise(e=>setTimeout(e,300)),u.focus(),"INPUT"!==u.tagName&&"TEXTAREA"!==u.tagName||u.select(),u.style.boxShadow="0 0 0 3px rgba(220, 38, 38, 0.5)",setTimeout(()=>{u.style.boxShadow=""},2e3),console.log(`✅ Successfully focused field: ${e}__${t}`)}_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,insertAfterColumnId:o}=e.detail;this._addColumnFromRequest(i,t,o)}_getAvailableDimensionsForSection(e){var t,i,o;if(!(null==(i=null==(t=this.xbrlInput)?void 0:t.hypercubes)?void 0:i[0]))return[];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}`),[];const n=[];return r.items.forEach(e=>{e.dimensions&&e.dimensions.length>0&&e.dimensions.forEach(e=>{var t;if(!n.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"}),n.push(o)}})}),n}_formatPeriodDisplay(e,t){if(!e||!t)return`${e||""} / ${t||""}`;const i=e.substring(0,4);return i===t.substring(0,4)?i:`${e} / ${t}`}_addColumnFromRequest(e,t,i){var o,r,n,s,l;const a=`col-${Date.now()}`;let d="",c="";"instant"===e.periodType?(d=e.instantDate||"",c=""):"duration"!==e.periodType&&"mixed"!==e.periodType||(d=this._formatPeriodDisplay(e.startDate,e.endDate),c="");let p={dimensionId:"period",memberValue:"instant"===e.periodType?`instant-${e.instantDate}`:`duration-${e.startDate}-${e.endDate}`,memberLabel:d};if(e.selectedDimensions&&e.selectedDimensions.length>0){const t=[],i=[];for(const o of e.selectedDimensions)o.isTyped&&o.typedValue?(t.push(`${o.axisLabel}: ${o.typedValue}`),i.push(`${o.axisId}|${o.typedValue}`)):o.memberId&&o.memberLabel&&(t.push(o.memberLabel),i.push(`${o.axisId}|${o.memberId}`));t.length>0&&(d=t.join(" | "),c="instant"===e.periodType?e.instantDate||"":this._formatPeriodDisplay(e.startDate,e.endDate),p={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: ${p.memberKey}`))}else if(null==(r=null==(o=this.xbrlInput)?void 0:o.hypercubes)?void 0:r[0]){const i=this.xbrlInput.hypercubes[0].roles.find(e=>e.roleId===t);if(1===(null==(n=null==i?void 0:i.items)?void 0:n.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==(l=o.labels.find(e=>"http://www.xbrl.org/2003/role/label"===e.role))?void 0:l.label)||o.conceptName;d=r,c="instant"===e.periodType?e.instantDate||"":this._formatPeriodDisplay(e.startDate,e.endDate),p={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: ${p.memberKey}`)}}}}const u={id:a,title:d,description:c,type:(p.memberKey,"dimension"),order:this._columns.length,removable:!0,dimensionData:p,periodStartDate:"instant"===e.periodType?e.instantDate:e.startDate,periodEndDate:"instant"===e.periodType?e.instantDate:e.endDate};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);i&&(this._typedMemberData[a]=t,u.dimensionData&&(u.dimensionData.hasTypedMembers=!0,u.dimensionData.typedMembers=e.selectedDimensions.filter(e=>e.isTyped).map(e=>({axisId:e.axisId,axisLabel:e.axisLabel,typedMemberId:e.axisId,memberLabel:e.axisLabel}))))}if(this._currentSchema){const e=this._currentSchema.sections.find(e=>e.id===t);if(e)if(e.columns||(e.columns=[...this._columns]),i){const t=e.columns.findIndex(e=>e.id===i);e.columns=-1!==t?[...e.columns.slice(0,t+1),u,...e.columns.slice(t+1)]:[...e.columns,u]}else e.columns=[...e.columns,u]}this._replicateFieldsForNewColumn(a,e,t),this._dirty=!0,this.requestUpdate(),this.dispatchEvent(new CustomEvent("column-add",{detail:{column:u},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(!(t.selectedDimensions&&t.selectedDimensions.length>0)&&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 n;n=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,periodType:e.periodType,conceptType:e.type,periodStartDate:"instant"===i.periodType?i.instantDate:i.startDate,periodEndDate:"instant"===i.periodType?i.instantDate:i.endDate,periodInstantDate:"instant"===e.periodType?i.instantDate||i.startDate:void 0}:{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:"",periodType:e.periodType,conceptType:e.type,periodStartDate:"instant"===i.periodType?i.instantDate:i.startDate,periodEndDate:"instant"===i.periodType?i.instantDate:i.endDate,periodInstantDate:"instant"===e.periodType?i.instantDate||i.startDate:void 0},e.fields||(e.fields=[]),e.fields.push(n)}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(){if(console.log("📝 Form submission started..."),this._submitted=!0,this._submitDisabled=!0,"admin"===this.mode)return this._handleSaveDraft(),this._handleAdminModeSubmit(),void(this._submitDisabled=!1);if(console.log("🔵 [Submit] Checking for errors..."),console.log(`🔵 [Submit] _xbrlFormErrors.length: ${this._xbrlFormErrors.length}`),console.log("🔵 [Submit] _xbrlFormErrors:",this._xbrlFormErrors),this._xbrlFormErrors.length>0)return console.log("❌ [Submit] Cannot submit - validation errors present:",this._xbrlFormErrors),this._showErrorPopup=!0,this._submitDisabled=!1,void this.requestUpdate();if(console.log("✅ [Submit] No validation errors, proceeding with submission..."),this._validateForm(),!this._valid)return console.log("❌ [Submit] Cannot submit - form validation errors present:",this._errors),this._showErrorPopup=!0,this._submitDisabled=!1,void this.requestUpdate();const e=this._generateSubmissionData();console.log("📊 Form Submission Data:",JSON.stringify(e,null,2)),console.log("📊 Submission Data Summary:"),e.forEach((e,t)=>{console.log(` [${t}] conceptId: ${e.conceptId}, columnId: ${e.columnId}, value: ${e.value}, unit: ${e.unit||"none"}`)}),this.dispatchEvent(new CustomEvent("form-submit",{detail:{data:this._formData,submissionData:e,valid:this._valid,errors:this._errors,reportingLanguage:this.reportingLanguage},bubbles:!0})),console.log("✅ Form submit event dispatched"),setTimeout(()=>{this._submitDisabled=!1},1e3)}_handleSaveDraft(e="manual"){if(console.log("🔵 [Save Draft] Checking for errors..."),console.log(`🔵 [Save Draft] _xbrlFormErrors.length: ${this._xbrlFormErrors.length}`),console.log("🔵 [Save Draft] _xbrlFormErrors:",this._xbrlFormErrors),this._xbrlFormErrors.length>0)return console.log("❌ [Save Draft] Cannot save - validation errors present:",this._xbrlFormErrors),this._showErrorPopup=!0,void this.requestUpdate();console.log("✅ [Save Draft] No validation errors, proceeding with save..."),console.log("💾 Raw form data before submission generation:",this._formData),console.log("🏷️ Unit data before submission generation:",this._unitData),console.log("📋 Enhanced selectedRoleIds with roleURI and order:",this._selectedRoleIds);const t=this._generateSubmissionData();console.log("📤 Generated submission data:",t),console.log("📊 Submission data breakdown:"),t.forEach((e,t)=>{console.log(` [${t}] conceptId: ${e.conceptId}, columnId: ${e.columnId}, value: ${e.value}, unit: ${e.unit||"none"}`)});const i=this._draftStorageService.createMetadataSnapshot(this.periodStartDate,this.periodEndDate,this.language,this._selectedRoleIds,this._allSections,this._typedMemberData,this._periodPreferences,this._periodData,this._unitData,this.reportingLanguage,this._repeatCounts),o=JSON.stringify({draftData:t,metadata:i});if(o===this._lastSavedDraftSnapshot)return void console.log(`ℹ️ [Save Draft] No draft content change detected (${e}); skipping event emit.`);this._lastSavedDraftSnapshot=o;const r=this._draftStorageService.saveDraft(t,i);console.log("💾 [Save Draft] Metadata saved with enhanced selectedRoleIds:",i.selectedRoleIds),this.dynaformsFacts=t,this.dynaformsMetadata=i,this.dispatchEvent(new CustomEvent("form-save-draft",{detail:{data:this._formData,draftData:t,metadata:i,saved:r,valid:this._valid,errors:this._errors,dynaformsFacts:t,dynaformsMetadata:i,reportingLanguage:this.reportingLanguage,source:"auto"==e?"auto":"manual"},bubbles:!0,composed:!0}));const n=this._getRoleIdsArray().length;console.log("💾 Draft saved - localStorage + event emitted",{entries:t.length,saved:r,roles:n,customColumns:i.customColumns.length,eventEmitted:!0,enhancedRoleStructure:Array.isArray(this._selectedRoleIds)&&this._selectedRoleIds.length>0&&"object"==typeof this._selectedRoleIds[0]})}async _loadDraftIfExists(){if(console.log("📋 Checking for saved draft..."),this.dynaformsFacts&&this.dynaformsMetadata){console.log("📦 Using external draft data from properties");const e={formData:this.dynaformsFacts,metadata:this.dynaformsMetadata};return await this._restoreFromDraft(e),this._draftLoaded=!0,this._draftLoadedAt=this.dynaformsMetadata.savedAt||(new Date).toISOString(),this.dispatchEvent(new CustomEvent("form-draft-loaded",{detail:{draft:e,source:"external",compatible:!0,warnings:[]},bubbles:!0,composed:!0})),void console.log("📥 External draft loaded successfully")}if(!this._draftStorageService.hasDraft())return void console.log("ℹ️ No saved draft found");const e=this._draftStorageService.loadDraft();if(!e)return void console.warn("⚠️ Failed to load draft");const{compatible:t,warnings:i}=this._draftStorageService.validateDraftCompatibility(e,this.periodStartDate,this.periodEndDate);i.length>0&&console.warn("⚠️ Draft compatibility warnings:",i),await this._restoreFromDraft(e),this.dispatchEvent(new CustomEvent("form-draft-loaded",{detail:{draft:e,compatible:t,warnings:i},bubbles:!0,composed:!0})),console.log("📥 Draft loaded successfully",{entries:e.formData.length,savedAt:e.metadata.savedAt,age:this._draftStorageService.getDraftAge()})}async _restoreFromDraft(e){var t;const{formData:i,metadata:o}=e;o.selectedRoleIds&&o.selectedRoleIds.length>0&&(this._selectedRoleIds=o.selectedRoleIds,console.log(`🔄 Restored ${this._selectedRoleIds.length} selected roles`)),o.typedMemberData&&(this._typedMemberData=o.typedMemberData,this._preservedTypedMemberData={},console.log("🔄 Restored typed member data")),o.repeatCounts&&(this._repeatCounts=o.repeatCounts,console.log("🔄 Restored repeat counts:",this._repeatCounts)),o.periodData&&(this._periodData=o.periodData,console.log("🔄 Restored custom field-level period data:",Object.keys(this._periodData).length,"concepts")),o.unitData&&(this._unitData=o.unitData,console.log("🔄 Restored custom field-level unit data:",Object.keys(this._unitData).length,"concepts")),o.periodPreferences?this._skipPeriodPreferencesRestore?console.log("⏭️ Skipping period preferences restoration - using new filter selections"):(this._periodPreferences=o.periodPreferences,console.log("🔄 Restored period preferences (including previous year settings):",this._periodPreferences),this.xbrlInput&&(console.log("🔄 Rebuilding schema with restored period preferences..."),this._currentSchema=F.buildFormSchema(this.xbrlInput,this.periodStartDate,this.periodEndDate,this.language,this._periodPreferences),this._allSections=[...this._currentSchema.sections],console.log("✅ Schema rebuilt with restored period preferences"),console.log("🔄 Applying custom period data to schema fields..."),this._applyCustomPeriodDataToFields(),o.customColumns&&o.customColumns.length>0&&(this._mergeAdditionalCustomColumns(o.customColumns),console.log(`🔄 Merged ${o.customColumns.length} additional custom columns`)))):o.customColumns&&o.customColumns.length>0&&(this._restoreCustomColumns(o.customColumns),console.log(`🔄 Restored ${o.customColumns.length} custom columns`));const r={},n={},s={};i.forEach(e=>{let{conceptId:t,draftInstanceId:i,value:o,columnId:l,period:a,unit:d}=e;if(!l&&a&&(l=this._inferColumnIdFromPeriod(a,t),!l))return void console.warn(`⚠️ Could not infer columnId for concept ${t}, skipping...`);const c=i||t,p=c.includes("__repeat_")?c.split("__repeat_")[0]:c,u=this._findActualConceptId(p),h=c.includes("__repeat_")?`${u||p}__repeat_${c.split("__repeat_")[1]}`:u||c;r[h]||(r[h]={}),r[h][l]=o,console.log(`📦 Restored: ${h}[${l}] = ${o}${c!==t?" (repeat instance)":""}`),a&&(n[h]||(n[h]={}),"instant"===a.type?(n[h][l]={instantDate:a.date},console.log(`📅 [Restore Period] Extracted instant date for ${h}/${l}: ${a.date}`)):"duration"===a.type&&(n[h][l]={startDate:a.startDate,endDate:a.endDate},console.log(`📅 [Restore Period] Extracted duration dates for ${h}/${l}: ${a.startDate} - ${a.endDate}`))),d&&(s[h]||(s[h]={}),s[h][l]=d,console.log(`🏷️ [Restore Unit] Extracted unit for ${h}/${l}: ${d}`))}),this._formData={...this._formData,...r},console.log(`🔄 Restored ${Object.keys(r).length} concepts with data`),this._periodData={...this._periodData,...o.periodData||{},...n},console.log(`📅 [Period Restore] Merged period data: ${Object.keys(this._periodData).length} concepts with custom periods`),console.log("📅 [Period Restore] Full _periodData after merge:",JSON.stringify(this._periodData,null,2)),this._unitData={...this._unitData,...o.unitData||{},...s},console.log(`🏷️ [Unit Restore] Merged unit data: ${Object.keys(this._unitData).length} concepts with custom units`),console.log("🏷️ [Unit Restore] Full _unitData after merge:",JSON.stringify(this._unitData,null,2)),this._selectedRoleIds.length>0&&this._applyRoleFilter(),this._dirty=!0,this._touched.clear(),this._validateForm(),this._allSections=[...this._allSections],this.requestUpdate(),await this.updateComplete,await new Promise(e=>setTimeout(e,100));const l=(null==(t=this.shadowRoot)?void 0:t.querySelectorAll("input, textarea, select").length)||0;console.log(`🔍 Found ${l} fields in DOM after update`),l>0?this._populateFieldValues(r):console.error("❌ No fields found in DOM even after updateComplete"),console.log("✅ Draft restoration completed")}_findActualConceptId(e){for(const t of this._allSections){const i=this._findActualConceptIdInTree(t.concepts,e);if(i)return i}return null}_findActualConceptIdInTree(e,t){for(const i of e){if(i.originalConceptId===t||i.id===t)return i.id;if(i.children){const e=this._findActualConceptIdInTree(i.children,t);if(e)return e}}return null}_inferColumnIdFromPeriod(e,t){for(const i of this._allSections){if(this._findConceptInSection(i.concepts,t)&&i.columns){for(const o of i.columns){const i="instant"===e.type,r="duration"===e.type;if(i&&e.date){if(o.periodStartDate===e.date||o.periodStartDate===o.periodEndDate&&o.periodStartDate===e.date)return console.log(`✓ Inferred columnId: ${o.id} for concept ${t}`),o.id}else if(r&&e.startDate&&e.endDate&&o.periodStartDate===e.startDate&&o.periodEndDate===e.endDate)return console.log(`✓ Inferred columnId: ${o.id} for concept ${t}`),o.id}if("instant"===e.type){const e=i.columns.find(e=>"instant"===e.id);if(e)return e.id}else{const e=i.columns.find(e=>"duration"===e.id);if(e)return e.id}}}return null}_findConceptInSection(e,t){for(const i of e){if(i.id===t||i.originalConceptId===t)return i;if(i.children){const e=this._findConceptInSection(i.children,t);if(e)return e}}return null}_populateFieldValues(e){let t=0,i=0;console.log("🔍 Starting field population..."),console.log("📦 Form data to populate:",e),Object.keys(e).forEach(o=>{const r=e[o];Object.keys(r).forEach(e=>{var n,s;const l=r[e],a=`${o}__${e}`;console.log(`🔍 Looking for field: ${a}`);const d=null==(n=this.shadowRoot)?void 0:n.querySelector(`#${CSS.escape(a)}`);d?(d instanceof HTMLInputElement||d instanceof HTMLTextAreaElement||d instanceof HTMLSelectElement)&&("checkbox"===d.type?d.checked=Boolean(l):d.value=null!=l?String(l):"",console.log(` ✅ Populated field ${a} with value:`,l),t++):(console.warn(` ❌ Field element NOT FOUND: ${a}`),console.warn(" Available fields in DOM:",Array.from((null==(s=this.shadowRoot)?void 0:s.querySelectorAll("input, textarea, select"))||[]).map(e=>e.id).filter(e=>e.includes(o.split("__")[0]))),i++)})}),console.log(`✅ Field population complete: ${t} populated, ${i} not found`)}_restoreCustomColumns(e){const t=new Map;e.forEach(e=>{t.has(e.sectionId)||t.set(e.sectionId,[]),t.get(e.sectionId).push(e)}),this._allSections.forEach(e=>{var i;const o=t.get(e.id);if(o){if(e.columns=o.map(e=>{const t={id:e.columnId,title:e.label,description:e.description,type:e.dimensionData?"dimension":"base",periodStartDate:e.startDate||e.date,periodEndDate:e.endDate||e.date,dimensionData:e.dimensionData,order:0,removable:"duration"!==e.columnId&&"instant"!==e.columnId,periodType:e.periodType};return console.log(`📅 [Draft Restore] Restoring column ${e.columnId}: title=${t.title}, description=${t.description}, startDate=${t.periodStartDate}, endDate=${t.periodEndDate}, periodType=${t.periodType}`),t}),(null==(i=this.xbrlInput)?void 0:i.datatypes)&&!e.datatypes){const t=Array.isArray(this.xbrlInput.datatypes)?this.xbrlInput.datatypes:this.xbrlInput.datatypes.concepts||[];e.datatypes=t,console.log(`✅ [Draft Restore] Attached ${t.length} datatypes to section ${e.id}`)}else e.datatypes?console.log(`ℹ️ [Draft Restore] Section ${e.id} already has ${e.datatypes.length} datatypes`):console.warn(`⚠️ [Draft Restore] No datatypes available for section ${e.id}`);this._regenerateFieldsForSection(e),console.log(` └─ Restored ${o.length} columns for section ${e.id}`)}}),this._currentSchema&&(this._currentSchema={...this._currentSchema,sections:this._allSections})}_mergeAdditionalCustomColumns(e){const t=new Map;e.forEach(e=>{e.columnId.startsWith("col-")&&(t.has(e.sectionId)||t.set(e.sectionId,[]),t.get(e.sectionId).push(e))}),this._allSections.forEach(e=>{var i;const o=t.get(e.id);if(o&&o.length>0){if(e.columns||(e.columns=[]),(null==(i=this.xbrlInput)?void 0:i.datatypes)&&!e.datatypes){const t=Array.isArray(this.xbrlInput.datatypes)?this.xbrlInput.datatypes:this.xbrlInput.datatypes.concepts||[];e.datatypes=t,console.log(`✅ [Merge Custom] Attached ${t.length} datatypes to section ${e.id}`)}else e.datatypes?console.log(`ℹ️ [Merge Custom] Section ${e.id} already has ${e.datatypes.length} datatypes`):console.warn(`⚠️ [Merge Custom] No datatypes available for section ${e.id}`);o.forEach(t=>{console.log(`📅 [Merge Custom Column] Column ${t.columnId}: col.startDate=${t.startDate}, col.endDate=${t.endDate}, col.date=${t.date}, col.periodType=${t.periodType}`);if(!e.columns.find(e=>e.id===t.columnId)){const i={id:t.columnId,title:t.label,description:t.description,type:t.dimensionData?"dimension":"base",periodStartDate:t.startDate||t.date,periodEndDate:t.endDate||t.date,dimensionData:t.dimensionData,order:e.columns.length,removable:!0,periodType:t.periodType};console.log(`📅 [New Column Created] Column ${i.id}: title=${i.title}, description=${i.description}, periodStartDate=${i.periodStartDate}, periodEndDate=${i.periodEndDate}, periodType=${i.periodType}`),e.columns.push(i),console.log(` └─ Added custom column ${t.columnId} to section ${e.id}`)}}),this._regenerateFieldsForSection(e)}}),this._currentSchema&&(this._currentSchema={...this._currentSchema,sections:this._allSections})}_applyCustomPeriodDataToFields(){if(!this._periodData||0===Object.keys(this._periodData).length)return void console.log("ℹ️ No custom period data to apply");let e=0;const t=i=>{i.forEach(i=>{if(this._periodData[i.id]){const t=this._periodData[i.id];i.fields&&i.fields.forEach(o=>{const r=t[o.columnId];r&&(r.startDate&&(o.periodStartDate=r.startDate),r.endDate&&(o.periodEndDate=r.endDate),r.instantDate&&(o.periodInstantDate=r.instantDate),e++,console.log(`✅ [Apply Period] Updated field ${i.id}/${o.columnId}: start=${o.periodStartDate}, end=${o.periodEndDate}, instant=${o.periodInstantDate}`))})}i.children&&i.children.length>0&&t(i.children)})};this._allSections.forEach(e=>{e.concepts&&e.concepts.length>0&&t(e.concepts)}),console.log(`📅 [Apply Period] Applied custom period data to ${e} fields`)}_regenerateFieldsForSection(e){if(!e.columns)return;const t=this._periodPreferences[e.id]||{showDuration:!0,showInstant:!0,showPreviousYear:!1},i=o=>{o.forEach(o=>{o.fields=[];this._shouldShowConceptBasedOnPeriodPreferences(o,t)&&e.columns.forEach(t=>{var i;const r=o.periodType,n=this._inferColumnPeriodType(t);if(o.abstract)return;const s=t.id.startsWith("col-"),l=t.id.startsWith("duration_")||t.id.startsWith("instant_"),a=!0===e.showPeriodControl;if(!(!n||"duration"===t.id||"default"===t.id||s&&a||l)&&r&&n&&r!==n)return void console.log(`⏭️ [Field Regeneration] Skipping field for ${o.id} in column ${t.id}: conceptPeriodType=${r}, columnPeriodType=${n}`);const d={id:`${o.id}_${t.id}`,conceptId:o.id,columnId:t.id,type:this._mapConceptTypeToFieldType(o.type),label:o.label,periodType:r,conceptType:o.type,periodStartDate:t.periodStartDate,periodEndDate:t.periodEndDate,periodInstantDate:"instant"===r?t.periodEndDate||t.periodStartDate:void 0};if(null==(i=this._periodData[o.id])?void 0:i[t.id]){const e=this._periodData[o.id][t.id];e.startDate&&(d.periodStartDate=e.startDate),e.endDate&&(d.periodEndDate=e.endDate),e.instantDate&&(d.periodInstantDate=e.instantDate),console.log(`✅ [Field Regeneration] Applied custom period data to ${o.id}/${t.id}:`,e),console.log(`✅ [Field Regeneration] Field properties after apply: periodStartDate=${d.periodStartDate}, periodEndDate=${d.periodEndDate}, periodInstantDate=${d.periodInstantDate}`)}else console.log(`ℹ️ [Field Regeneration] No custom period data for ${o.id}/${t.id}. Checking _periodData:`,this._periodData[o.id]);(o.id.includes("DescriptionLocationNL")||t.id.startsWith("col-"))&&console.log(`📅 [Field Regeneration] Concept ${o.id}, Column ${t.id}: field.periodStartDate=${d.periodStartDate}, field.periodEndDate=${d.periodEndDate}, column.periodStartDate=${t.periodStartDate}`),o.fields.push(d)}),o.children&&i(o.children)})};i(e.concepts)}_shouldShowConceptBasedOnPeriodPreferences(e,t){return!!e.abstract||(!e.periodType||!("duration"===e.periodType&&!t.showDuration)&&!("instant"===e.periodType&&!t.showInstant))}_inferColumnPeriodType(e){return e.periodType?e.periodType:e.periodStartDate&&e.periodEndDate?e.periodStartDate===e.periodEndDate?"instant":"duration":e.periodStartDate&&!e.periodEndDate?"instant":void 0}_mapConceptTypeToFieldType(e){return e?e.includes("monetary")||e.includes("Monetary")?"number":e.includes("date")||e.includes("Date")?"date":e.includes("boolean")||e.includes("Boolean")?"boolean":e.includes("integer")||e.includes("Integer")||e.includes("decimal")||e.includes("Decimal")?"number":"text":"text"}_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 n=this._findSectionForConcept(t);this._addConceptDataToSubmission(i,o,r,e,n||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}_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 n,s,l;const a=e.fields.find(e=>e.columnId===t);if(!a)return;const d="instant"===e.periodType,c=null==(n=this._periodData[e.id])?void 0:n[t],p=null==(s=this._unitData[e.id])?void 0:s[t],u=this._findColumnByIdInAllSections(t);console.log(`🔍 [Submission] Concept: ${e.id}, Column: ${t}, Field Period: ${c?JSON.stringify(c):"none"}, Unit: ${p||"none"}, Column Period: ${(null==u?void 0:u.periodStartDate)||"none"} - ${(null==u?void 0:u.periodEndDate)||"none"}`);const h=(null==c?void 0:c.startDate)||(null==u?void 0:u.periodStartDate)||a.periodStartDate||this.periodStartDate,m=(null==c?void 0:c.endDate)||(null==u?void 0:u.periodEndDate)||a.periodEndDate||this.periodEndDate,b=(null==c?void 0:c.instantDate)||a.periodInstantDate||m||h,f={conceptId:e.originalConceptId||e.id,columnId:t,value:i,period:{type:e.periodType||"duration",...d?{date:b}:{startDate:h,endDate:m}}};p&&(f.unit=p,console.log(`✅ [Submission] Adding unit to entry: ${p} for ${e.id}/${t}`)),(null==(l=null==u?void 0:u.dimensionData)?void 0:l.memberLabel)&&(f.dimension=u.dimensionData.memberLabel),console.log("📤 [Submission Entry] Created entry:",JSON.stringify(f,null,2)),o.push(f)}_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="instant"===e.period.type?e.period.date:`${e.period.startDate}_${e.period.endDate}`,o=`${e.conceptId}_${e.value}_${e.dimension||"no-dimension"}_${i}`;t.has(o)||t.set(o,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,n;if(!(null==(o=null==(i=this.xbrlInput)?void 0:i.hypercubes)?void 0:o[0]))return null;const s=null==t?void 0:t.id;if(!s)return null;const l=null==(r=this.xbrlInput.hypercubes[0].roles)?void 0:r.find(e=>e.roleId===s);if(!(null==l?void 0:l.items))return null;for(const a of l.items)if(a.dimensions){const t=a.dimensions.find(t=>t.id===e);if(null==(n=null==t?void 0:t.typedMember)?void 0:n.id)return t.typedMember.id}return null}_doesConceptApplyToTypedDimension(e,t,i){var o,r,n;if(!(null==(r=null==(o=this.xbrlInput)?void 0:o.hypercubes)?void 0:r[0]))return!1;const s=null==t?void 0:t.id;if(!s)return!1;const l=this.xbrlInput.hypercubes[0].roles.find(e=>e.roleId===s);if(!(null==(n=null==l?void 0:l.items)?void 0:n.length))return!1;for(const a of l.items){const t=e.originalConceptId||e.id;if(a.conceptIds&&a.conceptIds.includes(t)){const e=a.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 ${s}`),!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 n=this.xbrlInput.hypercubes[0].roles.find(e=>e.roleId===t.id);if(!(null==(r=null==n?void 0:n.items)?void 0:r.length))return[];const s=e.originalConceptId||e.id;for(const l of n.items)if(l.conceptIds&&l.conceptIds.includes(s)){const e=l.dimensions.filter(e=>e.typedMember).map(e=>e.id);return console.log(`🔍 [DynamicForm] Found applicable typed dimensions for concept ${s}:`,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=>{if(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&&e.fields.forEach((e,t)=>{}),e.fields&&e.fields.length>0){e.fields.forEach(n=>{var s,l,a,d,c;const p=this._formData[e.id];let u=null==p?void 0:p[n.columnId];if((null==u||""===u)&&this.masterData){const t=n.conceptId||e.id.split("__").slice(0,-1).join("__")||e.id,i=this.masterData[t];null!=i&&""!==i&&(u=i,console.warn(` 📦 [Submission] Using masterData for: ${t} [${n.columnId}] = ${JSON.stringify(u)}`))}if(null!=u&&""!==u){const p=this._findColumnByIdInSection(n.columnId,i),h=null==(s=this._periodData[e.id])?void 0:s[n.columnId],m={conceptId:e.id,draftInstanceId:e.id,columnId:n.columnId,value:u,period:{type:e.periodType||"duration"}};if("instant"===e.periodType){const e=(null==h?void 0:h.instantDate)||(null==h?void 0:h.endDate)||(null==p?void 0:p.periodEndDate)||n.periodInstantDate||n.periodEndDate||n.periodStartDate||this.periodStartDate;m.period.date=e}else{const e=(null==h?void 0:h.startDate)||(null==p?void 0:p.periodStartDate)||n.periodStartDate||this.periodStartDate,t=(null==h?void 0:h.endDate)||(null==p?void 0:p.periodEndDate)||n.periodEndDate||this.periodEndDate;m.period.startDate=e,m.period.endDate=t}console.log(`🔍 [Submission] Concept: ${e.id}, Column: ${n.columnId}, Field Period: ${h?JSON.stringify(h):"none"}, Column Period: ${(null==p?void 0:p.periodStartDate)||"none"} - ${(null==p?void 0:p.periodEndDate)||"none"}, Used Period: ${"instant"===m.period.type?m.period.date:`${m.period.startDate} - ${m.period.endDate}`}`);const b=null==(l=this._unitData[e.id])?void 0:l[n.columnId];if(b?(m.unit=b,console.log(`✅ [Submission] Adding unit to entry: ${b} for ${e.id}/${n.columnId}`)):console.log(`⚠️ [Submission] No unit found in _unitData for ${e.id}/${n.columnId}. _unitData state:`,JSON.stringify(this._unitData,null,2)),"dimension"===(null==p?void 0:p.type)&&(null==(a=p.dimensionData)?void 0:a.dimensionIdKey)?(m.dimension=p.dimensionData.dimensionIdKey,console.log(`🔍 [DynamicForm] Using dimension key from field's column (${n.columnId}):`,p.dimensionData.dimensionIdKey)):console.log(`🔍 [DynamicForm] No dimension data found for field column ${n.columnId}. Column type: ${null==p?void 0:p.type}, has dimensionData: ${!!(null==p?void 0:p.dimensionData)}`),this._typedMemberData[n.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[n.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?(m.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 ${n.columnId}. Available columns:`,Object.keys(this._typedMemberData)),p&&console.log("🔍 [DynamicForm] Column details:",{id:p.id,type:p.type,hasTypedMembers:null==(d=p.dimensionData)?void 0:d.hasTypedMembers,dimensionData:p.dimensionData});if(!m.typedMembers&&(null==(c=n.crossRoleTypedMembers)?void 0:c.length)){const t=`${e.id}__${n.columnId}`,i=this._typedMemberData[t];if(i){const t={};n.crossRoleTypedMembers.forEach(e=>{const o=i[e.axisId];null!=o&&""!==o&&(t[e.axisId]={value:o,memberName:e.typedMemberId})}),Object.keys(t).length>0&&(m.typedMembers=t,console.log(`🔍 [Submission] Adding cross-role typed members for ${e.id}/${n.columnId}:`,t))}}r===o&&console.warn("[DUPLICATE DEBUG] Final submission entry:",m),t.push(m)}});const n=this._repeatCounts[e.id]||0;if(n>0&&e.fields.some(e=>{var t;return null==(t=e.crossRoleTypedMembers)?void 0:t.length}))for(let o=1;o<=n;o++){const r=`${e.id}__repeat_${o}`;e.fields.forEach(o=>{var n,s,l,a,d;const c=null==(n=this._formData[r])?void 0:n[o.columnId];if(null==c||""===c)return;const p=this._findColumnByIdInSection(o.columnId,i),u=null==(s=this._periodData[r])?void 0:s[o.columnId],h={conceptId:e.id,draftInstanceId:r,columnId:o.columnId,value:c,period:{type:e.periodType||"duration"}};"instant"===e.periodType?h.period.date=(null==u?void 0:u.instantDate)||(null==u?void 0:u.endDate)||(null==p?void 0:p.periodEndDate)||o.periodInstantDate||o.periodEndDate||o.periodStartDate||this.periodStartDate:(h.period.startDate=(null==u?void 0:u.startDate)||(null==p?void 0:p.periodStartDate)||o.periodStartDate||this.periodStartDate,h.period.endDate=(null==u?void 0:u.endDate)||(null==p?void 0:p.periodEndDate)||o.periodEndDate||this.periodEndDate);const m=null==(l=this._unitData[r])?void 0:l[o.columnId];if(m&&(h.unit=m),"dimension"===(null==p?void 0:p.type)&&(null==(a=p.dimensionData)?void 0:a.dimensionIdKey)&&(h.dimension=p.dimensionData.dimensionIdKey),null==(d=o.crossRoleTypedMembers)?void 0:d.length){const e=`${r}__${o.columnId}`,t=this._typedMemberData[e];if(t){const e={};o.crossRoleTypedMembers.forEach(i=>{const o=t[i.axisId];null!=o&&""!==o&&(e[i.axisId]={value:o,memberName:i.typedMemberId})}),Object.keys(e).length>0&&(h.typedMembers=e)}}t.push(h)})}}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}}_analyzeAllVisibleRoles(){if(this._currentSchema&&this._currentSchema.sections&&0!==this._currentSchema.sections.length){console.log(`🔍 Analyzing ${this._currentSchema.sections.length} visible roles for initial border status...`);for(const e of this._currentSchema.sections)this._analyzeAndLogRole(e.id);console.log("✅ Initial border status analysis complete for all visible roles")}else console.log("⏭️ No sections to analyze for initial border status")}_handleRoleContextMenu(e,t,i){e.preventDefault(),e.stopPropagation(),this._contextMenuX=e.clientX,this._contextMenuY=e.clientY,this._contextMenuRoleId=t,this._showRoleContextMenu=!0,console.log(`🖱️ Context menu opened for role: ${i} (ID: ${t})`),this.requestUpdate()}_closeRoleContextMenu(){this._showRoleContextMenu=!1,this._contextMenuRoleId=null,this.requestUpdate()}_handleRemoveRole(){if(!this._contextMenuRoleId)return void this._closeRoleContextMenu();const e=this._allSections.find(e=>e.id===this._contextMenuRoleId),t=(null==e?void 0:e.title)||"Unknown";if(console.log("🗑️ Removing role from side panel:"),console.log(` - Role ID: ${this._contextMenuRoleId}`),console.log(` - Role Title: ${t}`),Array.isArray(this._selectedRoleIds)&&(this._selectedRoleIds.length>0&&"object"==typeof this._selectedRoleIds[0]?this._selectedRoleIds=this._selectedRoleIds.filter(e=>e.roleId!==this._contextMenuRoleId):this._selectedRoleIds=this._selectedRoleIds.filter(e=>e!==this._contextMenuRoleId)),console.log(`✅ Role removed from _selectedRoleIds. Remaining roles: ${this._selectedRoleIds.length}`),this._activeSidePanelRoleId===this._contextMenuRoleId){const e=this._getRoleIdsArray();this._activeSidePanelRoleId=e.length>0?e[0]:null,console.log(`📌 Active role changed to: ${this._activeSidePanelRoleId||"None"}`)}this._applyRoleFilter(),this.dispatchEvent(new CustomEvent("role-removed",{detail:{roleId:this._contextMenuRoleId,roleTitle:t,remainingRolesCount:this._selectedRoleIds.length},bubbles:!0,composed:!0})),console.log(`✅ Role "${t}" successfully removed from side panel`),console.log("ℹ️ User can re-add this role using the Filter Roles dialog"),this._closeRoleContextMenu()}_handleSidePanelRoleClick(e){this._activeSidePanelRoleId&&this._activeSidePanelRoleId!==e&&this._analyzeAndLogRole(this._activeSidePanelRoleId),this._activeSidePanelRoleId=e}_analyzeAndLogRole(e){const t=this._allSections.find(t=>t.id===e);if(!t)return void console.warn(`⚠️ Section not found for roleId: ${e}`);console.warn("\n========================================"),console.warn(`🔍 ANALYZING ROLE: "${t.title}"`),console.warn("========================================"),this.masterData?console.warn("📦 masterData keys:",Object.keys(this.masterData)):console.warn("📦 masterData: NOT PROVIDED");const i=[];this._collectAllFields(t.concepts||[],new Set((t.columns||[]).map(e=>e.id)),t.columns||[],i);const o=this._roleHasErrors(e),r=i.filter(e=>e.isEmpty).length,n=i.filter(e=>!e.isEmpty).length;let s;console.warn("\n📈 SUMMARY:"),console.warn(` Total Fields: ${i.length}`),console.warn(` Filled: ${n}`),console.warn(` Empty: ${r}`),console.warn(` Has Errors: ${o}`),o?(s="INVALID",console.warn("\n🔴 RESULT: INVALID (contains validation errors)")):r>0?(s="INCOMPLETE",console.warn(`\n🟠 RESULT: INCOMPLETE (${r} field(s) blank)`)):(s="COMPLETE",console.warn("\n🟢 RESULT: COMPLETE (all fields filled)")),console.warn("========================================\n"),"INVALID"===s||("INCOMPLETE"===s?(this._roleBorderStatuses.set(e,"incomplete"),this._roleBorderStatuses=new Map(this._roleBorderStatuses)):(this._roleBorderStatuses.set(e,"complete"),this._roleBorderStatuses=new Map(this._roleBorderStatuses)))}_collectAllFields(e,t,i,o){var r,n,s;for(const l of e)if(l.abstract)l.children&&l.children.length>0&&this._collectAllFields(l.children,t,i,o);else{if(l.fields&&l.fields.length>0){const e=l.fields.filter(e=>t.has(e.columnId));for(const t of e){const e=l.id,a=t.conceptId;let d=null==(r=this._formData[e])?void 0:r[t.columnId];void 0===d&&e!==a&&(d=null==(n=this._formData[a])?void 0:n[t.columnId]);const c=null==(s=this.masterData)?void 0:s[a];(null==d||"string"==typeof d&&""===d.trim())&&void 0!==c&&(d=c,console.warn(` 📦 Using masterData value for: ${a} [${t.columnId}] = ${JSON.stringify(d)}`));let p=null==d||"string"==typeof d&&""===d.trim();if(p&&l.facts&&l.facts.length>0){const e=i.find(e=>e.id===t.columnId),o={conceptId:a,columnId:t.columnId,periodStartDate:t.periodStartDate||(null==e?void 0:e.periodStartDate),periodEndDate:t.periodEndDate||(null==e?void 0:e.periodEndDate),periodInstantDate:t.periodInstantDate||("instant"===t.periodType?t.periodEndDate||t.periodStartDate:void 0),periodType:t.periodType,dimensionData:null==e?void 0:e.dimensionData},r=k.findMatchingFact(l.facts,o);r&&null!==r.value&&void 0!==r.value&&""!==r.value&&(d=r.value,p=!1)}o.push({conceptId:a,columnId:t.columnId,value:d,isEmpty:p})}}l.children&&l.children.length>0&&this._collectAllFields(l.children,t,i,o)}}_handleSidePanelSearchInput(e){const t=e.target;this._sidePanelSearchQuery=t.value}_clearSidePanelSearch(){var e;this._sidePanelSearchQuery="";const t=null==(e=this.shadowRoot)?void 0:e.querySelector(".side-panel-search-input");t&&(t.value="",t.focus())}_toggleSidePanelCollapse(){this._sidePanelCollapsed=!this._sidePanelCollapsed}_isSectionBlank(e){const t=e.columns||this._columns,i=e=>{var o;for(const r of e){if(!r.abstract)for(const e of t){const t=null==(o=this._formData[r.id])?void 0:o[e.id];if(null!=t&&""!==t)return!0}if(r.children&&r.children.length>0&&i(r.children))return!0}return!1};return!i(e.concepts)}_filterSidePanelSections(e){if(!this._sidePanelSearchQuery.trim())return e;const t=this._sidePanelSearchQuery.toLowerCase().trim();return e.filter(e=>{var i,o,r;const n=e.title.toLowerCase().includes(t),s=e.id.toLowerCase().includes(t),l=(null==(i=e.description)?void 0:i.toLowerCase().includes(t))||!1,a=(null==(r=null==(o=e.metadata)?void 0:o.roleURI)?void 0:r.toLowerCase().includes(t))||!1;return n||s||l||a})}_renderAdminModeContent(t){var i,o;if(!t)return e.html`
|
|
2300
2430
|
<div class="admin-mode-container">
|
|
2301
2431
|
<p>No role selected</p>
|
|
2302
2432
|
</div>
|
|
@@ -2318,7 +2448,7 @@ const $={attribute:!0,type:String,converter:v,reflect:!1,hasChanged:x},I=(e=$,t,
|
|
|
2318
2448
|
|
|
2319
2449
|
${s?e.html`
|
|
2320
2450
|
<div class="admin-dimension-section">
|
|
2321
|
-
<div class="admin-dimension-header">📊 ${
|
|
2451
|
+
<div class="admin-dimension-header">📊 ${T.t("filter.dimensionMemberSelection")}</div>
|
|
2322
2452
|
${n.map(i=>{var o,r;const n=this._getAllDimensionMembers(i.members),s=(null==(r=null==(o=i.labels)?void 0:o.find(e=>"http://www.xbrl.org/2003/role/label"===e.role))?void 0:r.label)||i.conceptName,l=this._isSingleMemberDimension(i);return e.html`
|
|
2323
2453
|
<div class="admin-dimension-group">
|
|
2324
2454
|
<div class="admin-dimension-label">${s}${l?" (Mandatory)":""}</div>
|
|
@@ -2342,13 +2472,13 @@ const $={attribute:!0,type:String,converter:v,reflect:!1,hasChanged:x},I=(e=$,t,
|
|
|
2342
2472
|
class="admin-member-select-btn"
|
|
2343
2473
|
@click="${()=>this._selectAllAdminDimensionMembers(t.id,i.id)}"
|
|
2344
2474
|
>
|
|
2345
|
-
${
|
|
2475
|
+
${T.t("filter.selectAllMembers")}
|
|
2346
2476
|
</button>
|
|
2347
2477
|
<button
|
|
2348
2478
|
class="admin-member-select-btn"
|
|
2349
2479
|
@click="${()=>this._deselectAllAdminDimensionMembers(t.id,i.id)}"
|
|
2350
2480
|
>
|
|
2351
|
-
${
|
|
2481
|
+
${T.t("filter.clearMembers")}
|
|
2352
2482
|
</button>
|
|
2353
2483
|
</div>
|
|
2354
2484
|
`}
|
|
@@ -2363,7 +2493,7 @@ const $={attribute:!0,type:String,converter:v,reflect:!1,hasChanged:x},I=(e=$,t,
|
|
|
2363
2493
|
<!-- Validation Summary -->
|
|
2364
2494
|
${o?e.html`
|
|
2365
2495
|
<div class="validation-summary">
|
|
2366
|
-
<h4 class="validation-summary-title">${
|
|
2496
|
+
<h4 class="validation-summary-title">${T.t("validation.summary")}</h4>
|
|
2367
2497
|
<ul class="validation-summary-list">
|
|
2368
2498
|
${this._errors.filter(e=>"error"===e.severity).map(t=>e.html`
|
|
2369
2499
|
<li class="validation-summary-item">${t.message}</li>
|
|
@@ -2379,9 +2509,9 @@ const $={attribute:!0,type:String,converter:v,reflect:!1,hasChanged:x},I=(e=$,t,
|
|
|
2379
2509
|
</div>
|
|
2380
2510
|
`):0===t.sections.length?e.html`
|
|
2381
2511
|
<div class="no-roles-message">
|
|
2382
|
-
<h3>${
|
|
2383
|
-
<p>${
|
|
2384
|
-
<p>${
|
|
2512
|
+
<h3>${T.t("form.noRoleSelected")}</h3>
|
|
2513
|
+
<p>${T.t("filter.selectRoles")}</p>
|
|
2514
|
+
<p>${T.t("filter.roles")}: ${this._allSections.length}</p>
|
|
2385
2515
|
</div>
|
|
2386
2516
|
`:("readonly"===this.mode?t.sections.filter(e=>!this._isSectionBlank(e)):t.sections).map((t,o)=>{var r;return e.html`
|
|
2387
2517
|
<jupiter-form-section
|
|
@@ -2393,6 +2523,7 @@ const $={attribute:!0,type:String,converter:v,reflect:!1,hasChanged:x},I=(e=$,t,
|
|
|
2393
2523
|
.periodData="${this._periodData}"
|
|
2394
2524
|
.unitData="${this._unitData}"
|
|
2395
2525
|
.typedMemberData="${this._typedMemberData}"
|
|
2526
|
+
.repeatCounts="${this._repeatCounts}"
|
|
2396
2527
|
.defaultUnits="${this.defaultUnits}"
|
|
2397
2528
|
.disabled="${this.disabled||this.readonly}"
|
|
2398
2529
|
.collapsible="${!1!==i.collapsibleSections}"
|
|
@@ -2406,6 +2537,8 @@ const $={attribute:!0,type:String,converter:v,reflect:!1,hasChanged:x},I=(e=$,t,
|
|
|
2406
2537
|
@field-change="${this._handleFieldChange}"
|
|
2407
2538
|
@period-change="${this._handlePeriodChange}"
|
|
2408
2539
|
@typed-member-change="${this._handleTypedMemberChange}"
|
|
2540
|
+
@add-concept-repeat="${this._handleAddConceptRepeat}"
|
|
2541
|
+
@remove-concept-repeat="${this._handleRemoveConceptRepeat}"
|
|
2409
2542
|
@section-expand="${this._handleSectionExpand}"
|
|
2410
2543
|
@concept-expand="${this._handleConceptExpand}"
|
|
2411
2544
|
@column-remove="${this._handleColumnRemove}"
|
|
@@ -2421,7 +2554,7 @@ const $={attribute:!0,type:String,converter:v,reflect:!1,hasChanged:x},I=(e=$,t,
|
|
|
2421
2554
|
<button
|
|
2422
2555
|
class="side-panel-toggle-btn ${this._sidePanelCollapsed?"collapsed":""}"
|
|
2423
2556
|
@click="${this._toggleSidePanelCollapse}"
|
|
2424
|
-
title="${this._sidePanelCollapsed?
|
|
2557
|
+
title="${this._sidePanelCollapsed?T.t("form.expandPanel"):T.t("form.collapsePanel")}"
|
|
2425
2558
|
>
|
|
2426
2559
|
<svg viewBox="0 0 24 24">
|
|
2427
2560
|
<path d="M15.41 7.41L14 6l-6 6 6 6 1.41-1.41L10.83 12z"/>
|
|
@@ -2434,12 +2567,12 @@ const $={attribute:!0,type:String,converter:v,reflect:!1,hasChanged:x},I=(e=$,t,
|
|
|
2434
2567
|
<input
|
|
2435
2568
|
type="text"
|
|
2436
2569
|
class="side-panel-search-input"
|
|
2437
|
-
placeholder="${
|
|
2570
|
+
placeholder="${T.t("filter.searchPlaceholder")}"
|
|
2438
2571
|
.value="${this._sidePanelSearchQuery}"
|
|
2439
2572
|
@input="${this._handleSidePanelSearchInput}"
|
|
2440
2573
|
/>
|
|
2441
2574
|
${this._sidePanelSearchQuery?e.html`
|
|
2442
|
-
<button class="side-panel-clear-search" @click="${this._clearSidePanelSearch}" title="${
|
|
2575
|
+
<button class="side-panel-clear-search" @click="${this._clearSidePanelSearch}" title="${T.t("filter.clearSearch")}">
|
|
2443
2576
|
×
|
|
2444
2577
|
</button>
|
|
2445
2578
|
`:e.html`
|
|
@@ -2452,15 +2585,15 @@ const $={attribute:!0,type:String,converter:v,reflect:!1,hasChanged:x},I=(e=$,t,
|
|
|
2452
2585
|
<!-- Search Results Info -->
|
|
2453
2586
|
${this._sidePanelSearchQuery.trim()&&l.length!==s.length?e.html`
|
|
2454
2587
|
<div class="side-panel-search-results-info">
|
|
2455
|
-
${l.length} ${
|
|
2588
|
+
${l.length} ${T.t("filter.of")} ${s.length} ${T.t("filter.roles")}
|
|
2456
2589
|
</div>
|
|
2457
2590
|
`:""}
|
|
2458
2591
|
|
|
2459
2592
|
<!-- Roles List -->
|
|
2460
2593
|
${0===l.length?e.html`
|
|
2461
2594
|
<div class="side-panel-no-results">
|
|
2462
|
-
${
|
|
2463
|
-
${
|
|
2595
|
+
${T.t("filter.noRolesFound")} "${this._sidePanelSearchQuery}"<br>
|
|
2596
|
+
${T.t("filter.tryDifferentSearch")}
|
|
2464
2597
|
</div>
|
|
2465
2598
|
`:e.html`
|
|
2466
2599
|
${l.map(t=>{const i=this._roleHasErrors(t.id),o=this._roleBorderStatuses.get(t.id),r=i?"has-errors":"incomplete"===o?"has-empty-fields":"complete"===o?"has-complete-data":"";return e.html`
|
|
@@ -2506,6 +2639,7 @@ const $={attribute:!0,type:String,converter:v,reflect:!1,hasChanged:x},I=(e=$,t,
|
|
|
2506
2639
|
.periodData="${this._periodData}"
|
|
2507
2640
|
.unitData="${this._unitData}"
|
|
2508
2641
|
.typedMemberData="${this._typedMemberData}"
|
|
2642
|
+
.repeatCounts="${this._repeatCounts}"
|
|
2509
2643
|
.defaultUnits="${this.defaultUnits}"
|
|
2510
2644
|
.disabled="${this.disabled||this.readonly}"
|
|
2511
2645
|
.collapsible="${!1}"
|
|
@@ -2519,6 +2653,8 @@ const $={attribute:!0,type:String,converter:v,reflect:!1,hasChanged:x},I=(e=$,t,
|
|
|
2519
2653
|
.periodEndDate="${this.periodEndDate}"
|
|
2520
2654
|
@field-change="${this._handleFieldChange}"
|
|
2521
2655
|
@typed-member-change="${this._handleTypedMemberChange}"
|
|
2656
|
+
@add-concept-repeat="${this._handleAddConceptRepeat}"
|
|
2657
|
+
@remove-concept-repeat="${this._handleRemoveConceptRepeat}"
|
|
2522
2658
|
@section-expand="${this._handleSectionExpand}"
|
|
2523
2659
|
@concept-expand="${this._handleConceptExpand}"
|
|
2524
2660
|
@column-remove="${this._handleColumnRemove}"
|
|
@@ -2526,8 +2662,8 @@ const $={attribute:!0,type:String,converter:v,reflect:!1,hasChanged:x},I=(e=$,t,
|
|
|
2526
2662
|
></jupiter-form-section>
|
|
2527
2663
|
`:e.html`
|
|
2528
2664
|
<div class="no-roles-message">
|
|
2529
|
-
<h3>${
|
|
2530
|
-
<p>${
|
|
2665
|
+
<h3>${T.t("form.noRoleSelected")}</h3>
|
|
2666
|
+
<p>${T.t("form.pleaseSelectRole")}</p>
|
|
2531
2667
|
</div>
|
|
2532
2668
|
`}
|
|
2533
2669
|
</div>
|
|
@@ -2561,7 +2697,7 @@ const $={attribute:!0,type:String,converter:v,reflect:!1,hasChanged:x},I=(e=$,t,
|
|
|
2561
2697
|
<svg class="filter-icon" viewBox="0 0 24 24">
|
|
2562
2698
|
<path d="M10 18h4v-2h-4v2zM3 6v2h18V6H3zm3 7h12v-2H6v2z"/>
|
|
2563
2699
|
</svg>
|
|
2564
|
-
${0===this._selectedRoleIds.length?
|
|
2700
|
+
${0===this._selectedRoleIds.length?T.t("filter.selectRoles"):T.t("filter.filterRoles")}
|
|
2565
2701
|
<span class="roles-count">${this._selectedRoleIds.length}/${this._allSections.length}</span>
|
|
2566
2702
|
</button>
|
|
2567
2703
|
`:""}
|
|
@@ -2572,7 +2708,7 @@ const $={attribute:!0,type:String,converter:v,reflect:!1,hasChanged:x},I=(e=$,t,
|
|
|
2572
2708
|
@click="${this._handleSaveDraft}"
|
|
2573
2709
|
?disabled="${this.disabled||this.readonly||this.isDraftSaving}"
|
|
2574
2710
|
>
|
|
2575
|
-
${this.isDraftSaving?
|
|
2711
|
+
${this.isDraftSaving?T.t("form.savingDraft"):T.t("form.saveDraft")}
|
|
2576
2712
|
</button>
|
|
2577
2713
|
`:""}
|
|
2578
2714
|
|
|
@@ -2584,7 +2720,7 @@ const $={attribute:!0,type:String,converter:v,reflect:!1,hasChanged:x},I=(e=$,t,
|
|
|
2584
2720
|
@click="${()=>this.dispatchEvent(new CustomEvent("showPreview",{bubbles:!0,composed:!0}))}"
|
|
2585
2721
|
?disabled="${this.disabled||this.readonly}"
|
|
2586
2722
|
>
|
|
2587
|
-
${
|
|
2723
|
+
${T.t("form.preview")}
|
|
2588
2724
|
</button>
|
|
2589
2725
|
`:""}
|
|
2590
2726
|
|
|
@@ -2594,7 +2730,7 @@ const $={attribute:!0,type:String,converter:v,reflect:!1,hasChanged:x},I=(e=$,t,
|
|
|
2594
2730
|
@click="${()=>this.dispatchEvent(new CustomEvent("show-validation-results",{bubbles:!0,composed:!0}))}"
|
|
2595
2731
|
?disabled="${this.disabled||this.readonly}"
|
|
2596
2732
|
>
|
|
2597
|
-
${
|
|
2733
|
+
${T.t("form.lastValidationResults")}
|
|
2598
2734
|
</button>
|
|
2599
2735
|
`:""}
|
|
2600
2736
|
|
|
@@ -2604,7 +2740,7 @@ const $={attribute:!0,type:String,converter:v,reflect:!1,hasChanged:x},I=(e=$,t,
|
|
|
2604
2740
|
@click="${this._handleSubmit}"
|
|
2605
2741
|
?disabled="${this.disabled||this.readonly||this._submitDisabled||"inProgress"===this._validationStatus}"
|
|
2606
2742
|
>
|
|
2607
|
-
${this.submitButtonLabel||("admin"===this.mode?
|
|
2743
|
+
${this.submitButtonLabel||("admin"===this.mode?T.t("form.save"):T.t("form.submit"))}
|
|
2608
2744
|
</button>
|
|
2609
2745
|
|
|
2610
2746
|
</div>
|
|
@@ -2630,25 +2766,25 @@ const $={attribute:!0,type:String,converter:v,reflect:!1,hasChanged:x},I=(e=$,t,
|
|
|
2630
2766
|
<div class="error-popup-overlay" @click="${()=>{this._showErrorPopup=!1,this.requestUpdate()}}">
|
|
2631
2767
|
<div class="error-popup" @click="${e=>e.stopPropagation()}">
|
|
2632
2768
|
<div class="error-popup-header">
|
|
2633
|
-
<h3>⚠️ ${
|
|
2769
|
+
<h3>⚠️ ${T.t("error.popup.title")}</h3>
|
|
2634
2770
|
<button class="error-popup-close" @click="${()=>{this._showErrorPopup=!1,this.requestUpdate()}}">×</button>
|
|
2635
2771
|
</div>
|
|
2636
2772
|
<div class="error-popup-content">
|
|
2637
|
-
<p>${
|
|
2773
|
+
<p>${T.t("error.popup.message")}</p>
|
|
2638
2774
|
<ul class="error-list">
|
|
2639
2775
|
${this._xbrlFormErrors.map(t=>{const i=this._findConceptInAllSections(t.conceptId),o=this._findColumnById(t.columnId),r=(null==i?void 0:i.label)||t.conceptId,n=(null==o?void 0:o.title)||t.columnId;return e.html`
|
|
2640
2776
|
<li>
|
|
2641
|
-
<strong>${
|
|
2777
|
+
<strong>${T.t("error.popup.field")}</strong>
|
|
2642
2778
|
<a
|
|
2643
2779
|
href="javascript:void(0)"
|
|
2644
2780
|
class="error-field-link"
|
|
2645
2781
|
@click="${()=>this._handleErrorFieldClick(t.conceptId,t.columnId,t.sectionId)}"
|
|
2646
|
-
title="${
|
|
2782
|
+
title="${T.t("error.popup.clickToFocus")}"
|
|
2647
2783
|
>
|
|
2648
2784
|
${r} (${n})
|
|
2649
2785
|
</a><br>
|
|
2650
|
-
<strong>${
|
|
2651
|
-
<strong>${
|
|
2786
|
+
<strong>${T.t("error.popup.value")}</strong> ${t.value}<br>
|
|
2787
|
+
<strong>${T.t("error.popup.errors")}</strong>
|
|
2652
2788
|
<ul>
|
|
2653
2789
|
${t.errors.map(t=>e.html`<li>${t.message}</li>`)}
|
|
2654
2790
|
</ul>
|
|
@@ -2657,7 +2793,7 @@ const $={attribute:!0,type:String,converter:v,reflect:!1,hasChanged:x},I=(e=$,t,
|
|
|
2657
2793
|
</ul>
|
|
2658
2794
|
</div>
|
|
2659
2795
|
<div class="error-popup-footer">
|
|
2660
|
-
<button class="btn-primary" @click="${()=>{this._showErrorPopup=!1,this.requestUpdate()}}">${
|
|
2796
|
+
<button class="btn-primary" @click="${()=>{this._showErrorPopup=!1,this.requestUpdate()}}">${T.t("error.popup.ok")}</button>
|
|
2661
2797
|
</div>
|
|
2662
2798
|
</div>
|
|
2663
2799
|
</div>
|
|
@@ -2682,7 +2818,7 @@ const $={attribute:!0,type:String,converter:v,reflect:!1,hasChanged:x},I=(e=$,t,
|
|
|
2682
2818
|
</div>
|
|
2683
2819
|
`:""}
|
|
2684
2820
|
</div>
|
|
2685
|
-
`:e.html`<div>${
|
|
2821
|
+
`:e.html`<div>${T.t("form.loading")}</div>`}},exports.JupiterDynamicForm.styles=e.css`
|
|
2686
2822
|
:host {
|
|
2687
2823
|
display: block;
|
|
2688
2824
|
font-family: var(--jupiter-font-family, system-ui, -apple-system, sans-serif);
|
|
@@ -2723,7 +2859,7 @@ const $={attribute:!0,type:String,converter:v,reflect:!1,hasChanged:x},I=(e=$,t,
|
|
|
2723
2859
|
right: 0;
|
|
2724
2860
|
padding: 16px 24px;
|
|
2725
2861
|
border-top: 1px solid var(--jupiter-border-color, #ddd);
|
|
2726
|
-
background: var(--jupiter-form-actions-background, #f8f9fa);
|
|
2862
|
+
background: var(--bg-color-2, var(--jupiter-form-actions-background, #f8f9fa));
|
|
2727
2863
|
display: flex;
|
|
2728
2864
|
gap: 12px;
|
|
2729
2865
|
align-items: center;
|
|
@@ -2734,6 +2870,7 @@ const $={attribute:!0,type:String,converter:v,reflect:!1,hasChanged:x},I=(e=$,t,
|
|
|
2734
2870
|
.form-sections {
|
|
2735
2871
|
padding: 24px;
|
|
2736
2872
|
padding-bottom: 100px; /* Add space for fixed footer */
|
|
2873
|
+
background: var(--bg-color-2);
|
|
2737
2874
|
}
|
|
2738
2875
|
|
|
2739
2876
|
.validation-summary {
|
|
@@ -2771,22 +2908,23 @@ const $={attribute:!0,type:String,converter:v,reflect:!1,hasChanged:x},I=(e=$,t,
|
|
|
2771
2908
|
}
|
|
2772
2909
|
|
|
2773
2910
|
.btn-primary {
|
|
2774
|
-
background: var(--jupiter-primary-color, #1976d2);
|
|
2775
|
-
color: white;
|
|
2911
|
+
background: var(--buttonBgColor, var(--jupiter-primary-color, #1976d2));
|
|
2912
|
+
color: var(--buttonTextColor, white);
|
|
2776
2913
|
}
|
|
2777
2914
|
|
|
2778
|
-
.btn-primary:hover:not(:disabled) {
|
|
2779
|
-
|
|
2780
|
-
}
|
|
2915
|
+
// .btn-primary:hover:not(:disabled) {
|
|
2916
|
+
// background: var(--jupiter-primary-color-dark, #1565c0);
|
|
2917
|
+
// }
|
|
2781
2918
|
|
|
2782
2919
|
.btn-secondary {
|
|
2783
|
-
|
|
2784
|
-
|
|
2920
|
+
color: var(--buttonBgColor, var(--jupiter-primary-color, #1976d2));
|
|
2921
|
+
border: 1px solid var(--buttonBgColor, var(--jupiter-primary-color, #1976d2)) !important;
|
|
2922
|
+
background: transparent;
|
|
2785
2923
|
}
|
|
2786
2924
|
|
|
2787
|
-
.btn-secondary:hover:not(:disabled) {
|
|
2788
|
-
|
|
2789
|
-
}
|
|
2925
|
+
// .btn-secondary:hover:not(:disabled) {
|
|
2926
|
+
// background: var(--jupiter-secondary-color-dark, #616161);
|
|
2927
|
+
// }
|
|
2790
2928
|
|
|
2791
2929
|
.btn-outline {
|
|
2792
2930
|
background: transparent;
|
|
@@ -2864,7 +3002,7 @@ const $={attribute:!0,type:String,converter:v,reflect:!1,hasChanged:x},I=(e=$,t,
|
|
|
2864
3002
|
padding: 8px 16px;
|
|
2865
3003
|
background: transparent;
|
|
2866
3004
|
border: 1px solid var(--jupiter-primary-color, #1976d2);
|
|
2867
|
-
color: var(--jupiter-primary-color, #1976d2);
|
|
3005
|
+
color: var(--primaryTextColor, var(--jupiter-primary-color, #1976d2));
|
|
2868
3006
|
border-radius: 4px;
|
|
2869
3007
|
font-size: 13px;
|
|
2870
3008
|
font-weight: 500;
|
|
@@ -2873,10 +3011,10 @@ const $={attribute:!0,type:String,converter:v,reflect:!1,hasChanged:x},I=(e=$,t,
|
|
|
2873
3011
|
margin-right: auto;
|
|
2874
3012
|
}
|
|
2875
3013
|
|
|
2876
|
-
.filter-roles-button:hover:not(:disabled) {
|
|
2877
|
-
|
|
2878
|
-
|
|
2879
|
-
}
|
|
3014
|
+
// .filter-roles-button:hover:not(:disabled) {
|
|
3015
|
+
// background: var(--jupiter-primary-color, #1976d2);
|
|
3016
|
+
// color: white;
|
|
3017
|
+
// }
|
|
2880
3018
|
|
|
2881
3019
|
.filter-roles-button .filter-icon {
|
|
2882
3020
|
width: 16px;
|
|
@@ -2887,8 +3025,8 @@ const $={attribute:!0,type:String,converter:v,reflect:!1,hasChanged:x},I=(e=$,t,
|
|
|
2887
3025
|
.roles-count {
|
|
2888
3026
|
display: inline-flex;
|
|
2889
3027
|
align-items: center;
|
|
2890
|
-
background: var(--jupiter-primary-color, #1976d2);
|
|
2891
|
-
color: white;
|
|
3028
|
+
background: var(--primaryTextColor, var(--jupiter-primary-color, #1976d2));
|
|
3029
|
+
color: var(--headerBgColor, white) !important;
|
|
2892
3030
|
border-radius: 10px;
|
|
2893
3031
|
font-size: 11px;
|
|
2894
3032
|
font-weight: 600;
|
|
@@ -2927,9 +3065,9 @@ const $={attribute:!0,type:String,converter:v,reflect:!1,hasChanged:x},I=(e=$,t,
|
|
|
2927
3065
|
.side-panel-roles-list {
|
|
2928
3066
|
width: 280px;
|
|
2929
3067
|
min-width: 280px;
|
|
2930
|
-
border-right: 1px solid var(--jupiter-border-color, #ddd);
|
|
3068
|
+
border-right: 1px solid var(--primaryTextColor, var(--jupiter-border-color, #ddd));
|
|
2931
3069
|
overflow-y: auto;
|
|
2932
|
-
background: var(--jupiter-background-light, #f8f9fa);
|
|
3070
|
+
background: var(--bg-color-2, var(--jupiter-background-light, #f8f9fa));
|
|
2933
3071
|
display: flex;
|
|
2934
3072
|
flex-direction: column;
|
|
2935
3073
|
transition: width 0.3s ease, min-width 0.3s ease;
|
|
@@ -2949,8 +3087,10 @@ const $={attribute:!0,type:String,converter:v,reflect:!1,hasChanged:x},I=(e=$,t,
|
|
|
2949
3087
|
right: 0px;
|
|
2950
3088
|
width: 32px;
|
|
2951
3089
|
height: 32px;
|
|
2952
|
-
border: 1px solid var(--jupiter-border-color, #ddd);
|
|
2953
|
-
background: var(--jupiter-background, #fff);
|
|
3090
|
+
border: 1px solid var(--primaryTextColor, var(--jupiter-border-color, #ddd));
|
|
3091
|
+
background: var(--bg-color-2, var(--jupiter-background, #fff));
|
|
3092
|
+
color: var(--primaryTextColor);
|
|
3093
|
+
|
|
2954
3094
|
border-radius: 4px;
|
|
2955
3095
|
cursor: pointer;
|
|
2956
3096
|
display: flex;
|
|
@@ -2958,7 +3098,6 @@ const $={attribute:!0,type:String,converter:v,reflect:!1,hasChanged:x},I=(e=$,t,
|
|
|
2958
3098
|
justify-content: center;
|
|
2959
3099
|
z-index: 100;
|
|
2960
3100
|
transition: all 0.2s ease;
|
|
2961
|
-
box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
|
|
2962
3101
|
}
|
|
2963
3102
|
|
|
2964
3103
|
.side-panel-toggle-btn:hover {
|
|
@@ -2982,7 +3121,7 @@ const $={attribute:!0,type:String,converter:v,reflect:!1,hasChanged:x},I=(e=$,t,
|
|
|
2982
3121
|
position: sticky;
|
|
2983
3122
|
top: 0;
|
|
2984
3123
|
z-index: 10;
|
|
2985
|
-
background: var(--jupiter-background, #fff);
|
|
3124
|
+
background: var(--bg-color-2, var(--jupiter-background, #fff));
|
|
2986
3125
|
padding: 16px;
|
|
2987
3126
|
border-bottom: 1px solid var(--jupiter-border-color, #ddd);
|
|
2988
3127
|
}
|
|
@@ -2990,21 +3129,21 @@ const $={attribute:!0,type:String,converter:v,reflect:!1,hasChanged:x},I=(e=$,t,
|
|
|
2990
3129
|
.side-panel-search-input {
|
|
2991
3130
|
width: 100%;
|
|
2992
3131
|
padding: 10px 40px 10px 12px;
|
|
2993
|
-
border: 1px solid var(--jupiter-border-color, #ddd);
|
|
3132
|
+
border: 1px solid var(--primaryTextColor, var(--jupiter-border-color, #ddd));
|
|
2994
3133
|
border-radius: 4px;
|
|
2995
3134
|
font-size: 14px;
|
|
2996
3135
|
font-family: inherit;
|
|
2997
|
-
background:
|
|
2998
|
-
color: var(--jupiter-text-primary, #333);
|
|
3136
|
+
background: transparent;
|
|
3137
|
+
color: var(--primaryTextColor, var(--jupiter-text-primary, #333));
|
|
2999
3138
|
transition: border-color 0.2s ease;
|
|
3000
3139
|
box-sizing: border-box;
|
|
3001
3140
|
}
|
|
3002
3141
|
|
|
3003
|
-
.side-panel-search-input:focus {
|
|
3004
|
-
|
|
3005
|
-
|
|
3006
|
-
|
|
3007
|
-
}
|
|
3142
|
+
// .side-panel-search-input:focus {
|
|
3143
|
+
// outline: none;
|
|
3144
|
+
// border-color: var(--jupiter-primary-color, #1976d2);
|
|
3145
|
+
// box-shadow: 0 0 0 2px rgba(25, 118, 210, 0.1);
|
|
3146
|
+
// }
|
|
3008
3147
|
|
|
3009
3148
|
.side-panel-search-input::placeholder {
|
|
3010
3149
|
color: var(--jupiter-text-secondary, #666);
|
|
@@ -3064,16 +3203,16 @@ const $={attribute:!0,type:String,converter:v,reflect:!1,hasChanged:x},I=(e=$,t,
|
|
|
3064
3203
|
border-bottom: 1px solid var(--jupiter-border-color, #e0e0e0);
|
|
3065
3204
|
transition: background-color 0.2s ease;
|
|
3066
3205
|
font-size: 14px;
|
|
3067
|
-
color: var(--jupiter-text-primary, #333);
|
|
3206
|
+
color: var(--primaryTextColor, var(--jupiter-text-primary, #333));
|
|
3068
3207
|
line-height: 1.4;
|
|
3069
3208
|
}
|
|
3070
3209
|
|
|
3071
|
-
.side-panel-role-item:hover {
|
|
3072
|
-
|
|
3073
|
-
}
|
|
3210
|
+
// .side-panel-role-item:hover {
|
|
3211
|
+
// background: var(--jupiter-hover-background, #e8e8e8);
|
|
3212
|
+
// }
|
|
3074
3213
|
|
|
3075
3214
|
.side-panel-role-item.active {
|
|
3076
|
-
background: var(--jupiter-primary-color, #1976d2);
|
|
3215
|
+
background: var(--light-color-1, var(--jupiter-primary-color, #1976d2));
|
|
3077
3216
|
color: white;
|
|
3078
3217
|
font-weight: 500;
|
|
3079
3218
|
}
|
|
@@ -3430,5 +3569,5 @@ const $={attribute:!0,type:String,converter:v,reflect:!1,hasChanged:x},I=(e=$,t,
|
|
|
3430
3569
|
.context-menu-item.danger:hover {
|
|
3431
3570
|
background: #ffebee;
|
|
3432
3571
|
}
|
|
3433
|
-
`,ne([S({type:Object})],exports.JupiterDynamicForm.prototype,"schema",2),ne([S({type:Object})],exports.JupiterDynamicForm.prototype,"xbrlInput",2),ne([S({type:Object})],exports.JupiterDynamicForm.prototype,"config",2),ne([S({type:Object})],exports.JupiterDynamicForm.prototype,"initialData",2),ne([S({type:Boolean})],exports.JupiterDynamicForm.prototype,"disabled",2),ne([S({type:Boolean})],exports.JupiterDynamicForm.prototype,"readonly",2),ne([S({type:String})],exports.JupiterDynamicForm.prototype,"periodStartDate",2),ne([S({type:String})],exports.JupiterDynamicForm.prototype,"periodEndDate",2),ne([S({type:String})],exports.JupiterDynamicForm.prototype,"language",2),ne([S({type:String})],exports.JupiterDynamicForm.prototype,"reportingLanguage",2),ne([S({type:String})],exports.JupiterDynamicForm.prototype,"display",2),ne([S({type:String})],exports.JupiterDynamicForm.prototype,"mode",2),ne([S({type:String,attribute:"submit-button-label"})],exports.JupiterDynamicForm.prototype,"submitButtonLabel",2),ne([S({type:Array})],exports.JupiterDynamicForm.prototype,"roleFilterAxes",2),ne([S({type:Boolean,attribute:"show-last-validation-result-btn"})],exports.JupiterDynamicForm.prototype,"showLastValidationResultBtn",2),ne([S({type:Boolean,attribute:"is-draft-saving"})],exports.JupiterDynamicForm.prototype,"isDraftSaving",2),ne([S({type:Array})],exports.JupiterDynamicForm.prototype,"defaultUnits",2),ne([S({type:Object,attribute:"master-data"})],exports.JupiterDynamicForm.prototype,"masterData",2),ne([S({type:Object,attribute:"dynaforms-metadata"})],exports.JupiterDynamicForm.prototype,"dynaformsMetadata",2),ne([S({type:Object,attribute:"dynaforms-facts"})],exports.JupiterDynamicForm.prototype,"dynaformsFacts",2),ne([w()],exports.JupiterDynamicForm.prototype,"_formData",2),ne([w()],exports.JupiterDynamicForm.prototype,"_draftLoaded",2),ne([w()],exports.JupiterDynamicForm.prototype,"_draftLoadedAt",2),ne([w()],exports.JupiterDynamicForm.prototype,"_preservedFormData",2),ne([w()],exports.JupiterDynamicForm.prototype,"_periodData",2),ne([w()],exports.JupiterDynamicForm.prototype,"_preservedPeriodData",2),ne([w()],exports.JupiterDynamicForm.prototype,"_unitData",2),ne([w()],exports.JupiterDynamicForm.prototype,"_preservedUnitData",2),ne([w()],exports.JupiterDynamicForm.prototype,"_typedMemberData",2),ne([w()],exports.JupiterDynamicForm.prototype,"_preservedTypedMemberData",2),ne([w()],exports.JupiterDynamicForm.prototype,"_columns",2),ne([w()],exports.JupiterDynamicForm.prototype,"_errors",2),ne([w()],exports.JupiterDynamicForm.prototype,"_touched",2),ne([w()],exports.JupiterDynamicForm.prototype,"_dirty",2),ne([w()],exports.JupiterDynamicForm.prototype,"_valid",2),ne([w()],exports.JupiterDynamicForm.prototype,"_submitted",2),ne([w()],exports.JupiterDynamicForm.prototype,"_xbrlFormErrors",2),ne([w()],exports.JupiterDynamicForm.prototype,"_showErrorPopup",2),ne([w()],exports.JupiterDynamicForm.prototype,"_submitDisabled",2),ne([w()],exports.JupiterDynamicForm.prototype,"_currentSchema",2),ne([w()],exports.JupiterDynamicForm.prototype,"_allSections",2),ne([w()],exports.JupiterDynamicForm.prototype,"_selectedRoleIds",2),ne([w()],exports.JupiterDynamicForm.prototype,"_showFilterDialog",2),ne([w()],exports.JupiterDynamicForm.prototype,"_periodPreferences",2),ne([w()],exports.JupiterDynamicForm.prototype,"_activeSidePanelRoleId",2),ne([w()],exports.JupiterDynamicForm.prototype,"_sidePanelSearchQuery",2),ne([w()],exports.JupiterDynamicForm.prototype,"_sidePanelCollapsed",2),ne([w()],exports.JupiterDynamicForm.prototype,"_adminRoleConfigs",2),ne([w()],exports.JupiterDynamicForm.prototype,"_roleBorderStatuses",2),ne([w()],exports.JupiterDynamicForm.prototype,"_showRoleContextMenu",2),ne([w()],exports.JupiterDynamicForm.prototype,"_contextMenuX",2),ne([w()],exports.JupiterDynamicForm.prototype,"_contextMenuY",2),ne([w()],exports.JupiterDynamicForm.prototype,"_contextMenuRoleId",2),ne([w()],exports.JupiterDynamicForm.prototype,"_validationStatus",2),exports.JupiterDynamicForm=ne([t("jupiter-dynamic-form")],exports.JupiterDynamicForm);exports.FactMatcher=k,exports.FormValidator=C,exports.TYPE_INPUT_MAP=P,exports.XBRLValidator=A,exports.collectEnumerationsFromChain=
|
|
3572
|
+
`,ne([S({type:Object})],exports.JupiterDynamicForm.prototype,"schema",2),ne([S({type:Object})],exports.JupiterDynamicForm.prototype,"xbrlInput",2),ne([S({type:Object})],exports.JupiterDynamicForm.prototype,"config",2),ne([S({type:Object})],exports.JupiterDynamicForm.prototype,"initialData",2),ne([S({type:Boolean})],exports.JupiterDynamicForm.prototype,"disabled",2),ne([S({type:Boolean})],exports.JupiterDynamicForm.prototype,"readonly",2),ne([S({type:String})],exports.JupiterDynamicForm.prototype,"periodStartDate",2),ne([S({type:String})],exports.JupiterDynamicForm.prototype,"periodEndDate",2),ne([S({type:String})],exports.JupiterDynamicForm.prototype,"language",2),ne([S({type:String})],exports.JupiterDynamicForm.prototype,"reportingLanguage",2),ne([S({type:String})],exports.JupiterDynamicForm.prototype,"display",2),ne([S({type:String})],exports.JupiterDynamicForm.prototype,"mode",2),ne([S({type:String,attribute:"submit-button-label"})],exports.JupiterDynamicForm.prototype,"submitButtonLabel",2),ne([S({type:Array})],exports.JupiterDynamicForm.prototype,"roleFilterAxes",2),ne([S({type:Boolean,attribute:"show-last-validation-result-btn"})],exports.JupiterDynamicForm.prototype,"showLastValidationResultBtn",2),ne([S({type:Boolean,attribute:"is-draft-saving"})],exports.JupiterDynamicForm.prototype,"isDraftSaving",2),ne([S({type:Array})],exports.JupiterDynamicForm.prototype,"defaultUnits",2),ne([S({type:Object,attribute:"master-data"})],exports.JupiterDynamicForm.prototype,"masterData",2),ne([S({type:Object,attribute:"dynaforms-metadata"})],exports.JupiterDynamicForm.prototype,"dynaformsMetadata",2),ne([S({type:Object,attribute:"dynaforms-facts"})],exports.JupiterDynamicForm.prototype,"dynaformsFacts",2),ne([w()],exports.JupiterDynamicForm.prototype,"_formData",2),ne([w()],exports.JupiterDynamicForm.prototype,"_draftLoaded",2),ne([w()],exports.JupiterDynamicForm.prototype,"_draftLoadedAt",2),ne([w()],exports.JupiterDynamicForm.prototype,"_preservedFormData",2),ne([w()],exports.JupiterDynamicForm.prototype,"_periodData",2),ne([w()],exports.JupiterDynamicForm.prototype,"_preservedPeriodData",2),ne([w()],exports.JupiterDynamicForm.prototype,"_unitData",2),ne([w()],exports.JupiterDynamicForm.prototype,"_preservedUnitData",2),ne([w()],exports.JupiterDynamicForm.prototype,"_typedMemberData",2),ne([w()],exports.JupiterDynamicForm.prototype,"_preservedTypedMemberData",2),ne([w()],exports.JupiterDynamicForm.prototype,"_repeatCounts",2),ne([w()],exports.JupiterDynamicForm.prototype,"_columns",2),ne([w()],exports.JupiterDynamicForm.prototype,"_errors",2),ne([w()],exports.JupiterDynamicForm.prototype,"_touched",2),ne([w()],exports.JupiterDynamicForm.prototype,"_dirty",2),ne([w()],exports.JupiterDynamicForm.prototype,"_valid",2),ne([w()],exports.JupiterDynamicForm.prototype,"_submitted",2),ne([w()],exports.JupiterDynamicForm.prototype,"_xbrlFormErrors",2),ne([w()],exports.JupiterDynamicForm.prototype,"_showErrorPopup",2),ne([w()],exports.JupiterDynamicForm.prototype,"_submitDisabled",2),ne([w()],exports.JupiterDynamicForm.prototype,"_currentSchema",2),ne([w()],exports.JupiterDynamicForm.prototype,"_allSections",2),ne([w()],exports.JupiterDynamicForm.prototype,"_selectedRoleIds",2),ne([w()],exports.JupiterDynamicForm.prototype,"_showFilterDialog",2),ne([w()],exports.JupiterDynamicForm.prototype,"_periodPreferences",2),ne([w()],exports.JupiterDynamicForm.prototype,"_activeSidePanelRoleId",2),ne([w()],exports.JupiterDynamicForm.prototype,"_sidePanelSearchQuery",2),ne([w()],exports.JupiterDynamicForm.prototype,"_sidePanelCollapsed",2),ne([w()],exports.JupiterDynamicForm.prototype,"_adminRoleConfigs",2),ne([w()],exports.JupiterDynamicForm.prototype,"_roleBorderStatuses",2),ne([w()],exports.JupiterDynamicForm.prototype,"_showRoleContextMenu",2),ne([w()],exports.JupiterDynamicForm.prototype,"_contextMenuX",2),ne([w()],exports.JupiterDynamicForm.prototype,"_contextMenuY",2),ne([w()],exports.JupiterDynamicForm.prototype,"_contextMenuRoleId",2),ne([w()],exports.JupiterDynamicForm.prototype,"_validationStatus",2),exports.JupiterDynamicForm=ne([t("jupiter-dynamic-form")],exports.JupiterDynamicForm);exports.FactMatcher=k,exports.FormValidator=C,exports.TYPE_INPUT_MAP=P,exports.XBRLValidator=A,exports.collectEnumerationsFromChain=z,exports.determineInputTypeFromBaseChain=J,exports.getInputTypeForConceptType=M,exports.isCheckboxType=L,exports.isNumericType=U,exports.isSelectType=function(e){return"select"===e},exports.isTextareaType=j,exports.resolveBaseTypeChain=O,exports.version="1.5.0";
|
|
3434
3573
|
//# sourceMappingURL=index.js.map
|