{"version":3,"file":"ajf-core-reports.mjs","sources":["../../../projects/core/reports/src/base-widget.ts","../../../projects/core/reports/src/interface/charts/chart-type.ts","../../../projects/core/reports/src/chart-utils.ts","../../../projects/core/reports/src/get-column-content.ts","../../../projects/core/reports/src/interface/aggregation/aggregation.ts","../../../projects/core/reports/src/interface/aggregation/aggregation-type.ts","../../../projects/core/reports/src/interface/dataset/chart-dataset.ts","../../../projects/core/reports/src/interface/dataset/chart-dataset-options.ts","../../../projects/core/reports/src/interface/dataset/dataset.ts","../../../projects/core/reports/src/interface/dataset/table-dataset.ts","../../../projects/core/reports/src/interface/reports/report.ts","../../../projects/core/reports/src/interface/reports/report-container.ts","../../../projects/core/reports/src/interface/reports/report-string-identifier.ts","../../../projects/core/reports/src/interface/reports/report-variable.ts","../../../projects/core/reports/src/interface/reports-instances/report-container-instance.ts","../../../projects/core/reports/src/interface/reports-instances/report-instance.ts","../../../projects/core/reports/src/interface/styles.ts","../../../projects/core/reports/src/interface/widgets/base-widget.ts","../../../projects/core/reports/src/interface/widgets/chart-widget.ts","../../../projects/core/reports/src/interface/widgets/column-widget.ts","../../../projects/core/reports/src/interface/widgets/custom-widget.ts","../../../projects/core/reports/src/interface/widgets/data-widget.ts","../../../projects/core/reports/src/interface/widgets/dialog-widget.ts","../../../projects/core/reports/src/interface/widgets/filter.ts","../../../projects/core/reports/src/interface/widgets/formula-widget.ts","../../../projects/core/reports/src/interface/widgets/graph-widget.ts","../../../projects/core/reports/src/interface/widgets/heat-map-widget.ts","../../../projects/core/reports/src/interface/widgets/image-container-widget.ts","../../../projects/core/reports/src/interface/widgets/image-widget.ts","../../../projects/core/reports/src/interface/widgets/layout-widget.ts","../../../projects/core/reports/src/interface/widgets/map-widget.ts","../../../projects/core/reports/src/interface/widgets/page-break-widget.ts","../../../projects/core/reports/src/interface/widgets/paginated-list-widget.ts","../../../projects/core/reports/src/interface/widgets/paginated-table-widget.ts","../../../projects/core/reports/src/interface/widgets/table-widget.ts","../../../projects/core/reports/src/interface/widgets/text-widget.ts","../../../projects/core/reports/src/interface/widgets/widget.ts","../../../projects/core/reports/src/interface/widgets/widget-components-map.ts","../../../projects/core/reports/src/interface/widgets/widget-type.ts","../../../projects/core/reports/src/interface/widgets/widget-with-content.ts","../../../projects/core/reports/src/interface/widgets-instances/base-widget-instance.ts","../../../projects/core/reports/src/interface/widgets-instances/chart-widget-instance.ts","../../../projects/core/reports/src/interface/widgets-instances/column-widget-instance.ts","../../../projects/core/reports/src/interface/widgets-instances/data-widget-instance.ts","../../../projects/core/reports/src/interface/widgets-instances/dialog-widget-instance.ts","../../../projects/core/reports/src/interface/widgets-instances/filter-instance.ts","../../../projects/core/reports/src/interface/widgets-instances/formula-widget-instance.ts","../../../projects/core/reports/src/interface/widgets-instances/graph-widget-instance.ts","../../../projects/core/reports/src/interface/widgets-instances/heat-map-widget-instance.ts","../../../projects/core/reports/src/interface/widgets-instances/image-container-widget-instance.ts","../../../projects/core/reports/src/interface/widgets-instances/image-widget-instance.ts","../../../projects/core/reports/src/interface/widgets-instances/layout-widget-instance.ts","../../../projects/core/reports/src/interface/widgets-instances/map-widget-instance.ts","../../../projects/core/reports/src/interface/widgets-instances/page-break-widget-instance.ts","../../../projects/core/reports/src/interface/widgets-instances/paginated-list-widget-instance.ts","../../../projects/core/reports/src/interface/widgets-instances/paginated-table-widget-instance.ts","../../../projects/core/reports/src/interface/widgets-instances/table-widget-instance.ts","../../../projects/core/reports/src/interface/widgets-instances/text-widget-instance.ts","../../../projects/core/reports/src/interface/widgets-instances/widget-instance.ts","../../../projects/core/reports/src/interface/widgets-instances/widget-with-content-instance.ts","../../../projects/core/reports/src/report.ts","../../../projects/core/reports/src/utils/reports/build-report-string-identifier.ts","../../../projects/core/reports/src/report-string-identifier.ts","../../../projects/core/reports/src/widget-export.ts","../../../projects/core/reports/src/widget-export.html","../../../projects/core/reports/src/widget-host.ts","../../../projects/core/reports/src/reports-module.ts","../../../projects/core/reports/src/utils/aggregation/create-aggregation.ts","../../../projects/core/reports/src/serializers/aggregation-serializer.ts","../../../projects/core/reports/src/utils/dataset/create-dataset.ts","../../../projects/core/reports/src/serializers/dataset-serializer.ts","../../../projects/core/reports/src/utils/widgets/create-widget.ts","../../../projects/core/reports/src/serializers/widget-serializer.ts","../../../projects/core/reports/src/serializers/report-container-serializer.ts","../../../projects/core/reports/src/utils/reports/create-report.ts","../../../projects/core/reports/src/serializers/report-serializer.ts","../../../projects/core/reports/src/widget.ts","../../../projects/core/reports/src/utils/widgets/widgets-map.ts","../../../projects/core/reports/src/widget-service.ts","../../../projects/core/reports/src/utils/aggregation/evaluate-aggregation.ts","../../../projects/core/reports/src/utils/widgets/is-chart-widget.ts","../../../projects/core/reports/src/utils/widgets/is-dialog-widget.ts","../../../projects/core/reports/src/utils/widgets/is-dynamic-table-widget.ts","../../../projects/core/reports/src/utils/widgets/is-formula-widget.ts","../../../projects/core/reports/src/utils/widgets/is-graph-widget.ts","../../../projects/core/reports/src/utils/widgets/is-heat-map-widget.ts","../../../projects/core/reports/src/utils/widgets/is-image-container-widget.ts","../../../projects/core/reports/src/utils/widgets/is-image-widget.ts","../../../projects/core/reports/src/utils/widgets/is-map-widget.ts","../../../projects/core/reports/src/utils/widgets/is-paginated-list-widget.ts","../../../projects/core/reports/src/utils/widgets/is-paginated-table-widget.ts","../../../projects/core/reports/src/utils/widgets/is-widget-with-content.ts","../../../projects/core/reports/src/utils/widgets/is-table-widget.ts","../../../projects/core/reports/src/utils/widgets/is-text-widget.ts","../../../projects/core/reports/src/utils/widgets-instances/is-chart-widget-instance.ts","../../../projects/core/reports/src/utils/widgets-instances/is-dialog-widget-instance.ts","../../../projects/core/reports/src/utils/widgets-instances/is-dynamic-table-widget-instance.ts","../../../projects/core/reports/src/utils/widgets-instances/is-formula-widget-instance.ts","../../../projects/core/reports/src/utils/widgets-instances/is-graph-widget-instance.ts","../../../projects/core/reports/src/utils/widgets-instances/is-heat-map-widget-instance.ts","../../../projects/core/reports/src/utils/widgets-instances/is-image-container-widget-instance.ts","../../../projects/core/reports/src/utils/widgets-instances/is-image-widget-instance.ts","../../../projects/core/reports/src/utils/widgets-instances/is-map-widget-instance.ts","../../../projects/core/reports/src/utils/widgets-instances/is-paginated-list-widget-instance.ts","../../../projects/core/reports/src/utils/widgets-instances/is-paginated-table-widget-instance.ts","../../../projects/core/reports/src/utils/widgets-instances/is-table-widget-instance.ts","../../../projects/core/reports/src/utils/widgets-instances/is-text-widget-instance.ts","../../../projects/core/reports/src/utils/widgets-instances/is-widget-with-content-instance.ts","../../../projects/core/reports/src/utils/widgets-instances/create-widget-instance.ts","../../../projects/core/reports/src/utils/widgets-instances/widget-instance-utils.ts","../../../projects/core/reports/src/utils/widgets-instances/widget-to-widget-instance.ts","../../../projects/core/reports/src/utils/reports-instances/create-report-container-instance.ts","../../../projects/core/reports/src/utils/reports-instances/create-report-instance.ts","../../../projects/core/reports/src/utils/reports/create-report-container.ts","../../../projects/core/reports/src/automatic-report/styles.ts","../../../projects/core/reports/src/automatic-report/automatic-report.ts","../../../projects/core/reports/src/xls-report/hindikit-parser.ts","../../../projects/core/reports/src/xls-report/styles.ts","../../../projects/core/reports/src/xls-report/xls-report.ts","../../../projects/core/reports/src/report-to-pdf/utils.ts","../../../projects/core/reports/src/report-to-pdf/report-to-pdf.ts","../../../projects/core/reports/src/report-to-pdf/report-to-doc.ts","../../../projects/core/reports/src/public_api.ts","../../../projects/core/reports/src/ajf-core-reports.ts"],"sourcesContent":["/**\n * @license\n * Copyright (C) Gnucoop soc. coop.\n *\n * This file is part of the Advanced JSON forms (ajf).\n *\n * Advanced JSON forms (ajf) is free software: you can redistribute it and/or\n * modify it under the terms of the GNU Affero General Public License as\n * published by the Free Software Foundation, either version 3 of the License,\n * or (at your option) any later version.\n *\n * Advanced JSON forms (ajf) is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero\n * General Public License for more details.\n *\n * You should have received a copy of the GNU Affero General Public License\n * along with Advanced JSON forms (ajf).\n * If not, see http://www.gnu.org/licenses/.\n *\n */\n\nimport {ChangeDetectorRef, Directive, ElementRef, Input} from '@angular/core';\n\nimport {AjfWidgetInstance} from './interface/widgets-instances/widget-instance';\n\n@Directive()\nexport class AjfBaseWidgetComponent<T extends AjfWidgetInstance = AjfWidgetInstance> {\n  private _instance: T | undefined;\n  get instance(): T | undefined {\n    return this._instance;\n  }\n  @Input()\n  set instance(instance: T | undefined) {\n    if (this._instance !== instance) {\n      this._instance = instance;\n      this._cdr.detectChanges();\n    }\n  }\n\n  constructor(protected _cdr: ChangeDetectorRef, readonly el: ElementRef) {}\n}\n","/**\n * @license\n * Copyright (C) Gnucoop soc. coop.\n *\n * This file is part of the Advanced JSON forms (ajf).\n *\n * Advanced JSON forms (ajf) is free software: you can redistribute it and/or\n * modify it under the terms of the GNU Affero General Public License as\n * published by the Free Software Foundation, either version 3 of the License,\n * or (at your option) any later version.\n *\n * Advanced JSON forms (ajf) is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero\n * General Public License for more details.\n *\n * You should have received a copy of the GNU Affero General Public License\n * along with Advanced JSON forms (ajf).\n * If not, see http://www.gnu.org/licenses/.\n *\n */\n\n// tslint:disable-next-line:prefer-const-enum\nexport enum AjfChartType {\n  Line,\n  Bar,\n  HorizontalBar,\n  Radar,\n  Scatter,\n  Doughnut,\n  Pie,\n  PolarArea,\n  Bubble,\n  LENGTH,\n}\n","/**\n * @license\n * Copyright (C) Gnucoop soc. coop.\n *\n * This file is part of the Advanced JSON forms (ajf).\n *\n * Advanced JSON forms (ajf) is free software: you can redistribute it and/or\n * modify it under the terms of the GNU Affero General Public License as\n * published by the Free Software Foundation, either version 3 of the License,\n * or (at your option) any later version.\n *\n * Advanced JSON forms (ajf) is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero\n * General Public License for more details.\n *\n * You should have received a copy of the GNU Affero General Public License\n * along with Advanced JSON forms (ajf).\n * If not, see http://www.gnu.org/licenses/.\n *\n */\n\nimport {AjfChartType} from './interface/charts/chart-type';\nimport {ChartType} from 'chart.js';\n\nexport function chartToChartJsType(chartType?: AjfChartType): ChartType {\n  switch (chartType) {\n    case AjfChartType.Line:\n      return 'line';\n    case AjfChartType.Bar:\n      return 'bar';\n    case AjfChartType.HorizontalBar:\n      return 'horizontalBar';\n    case AjfChartType.Radar:\n      return 'radar';\n    case AjfChartType.Scatter:\n      return 'scatter';\n    case AjfChartType.Doughnut:\n      return 'doughnut';\n    case AjfChartType.Pie:\n      return 'pie';\n    case AjfChartType.PolarArea:\n      return 'polarArea';\n    case AjfChartType.Bubble:\n      return 'bubble';\n    default:\n      return 'line';\n  }\n}\n","/**\n * @license\n * Copyright (C) Gnucoop soc. coop.\n *\n * This file is part of the Advanced JSON forms (ajf).\n *\n * Advanced JSON forms (ajf) is free software: you can redistribute it and/or\n * modify it under the terms of the GNU Affero General Public License as\n * published by the Free Software Foundation, either version 3 of the License,\n * or (at your option) any later version.\n *\n * Advanced JSON forms (ajf) is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero\n * General Public License for more details.\n *\n * You should have received a copy of the GNU Affero General Public License\n * along with Advanced JSON forms (ajf).\n * If not, see http://www.gnu.org/licenses/.\n *\n */\n\nimport {Pipe, PipeTransform} from '@angular/core';\nimport {AjfLayoutWidgetInstance} from './interface/widgets-instances/layout-widget-instance';\nimport {AjfWidgetInstance} from './interface/widgets-instances/widget-instance';\n\n@Pipe({name: 'ajfGetColumnContent'})\nexport class AjfGetColumnContentPipe implements PipeTransform {\n  transform(instance: AjfLayoutWidgetInstance, column: number): AjfWidgetInstance | null {\n    return column >= 0 && column < instance.content.length ? instance.content[column] : null;\n  }\n}\n","/**\n * @license\n * Copyright (C) Gnucoop soc. coop.\n *\n * This file is part of the Advanced JSON forms (ajf).\n *\n * Advanced JSON forms (ajf) is free software: you can redistribute it and/or\n * modify it under the terms of the GNU Affero General Public License as\n * published by the Free Software Foundation, either version 3 of the License,\n * or (at your option) any later version.\n *\n * Advanced JSON forms (ajf) is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero\n * General Public License for more details.\n *\n * You should have received a copy of the GNU Affero General Public License\n * along with Advanced JSON forms (ajf).\n * If not, see http://www.gnu.org/licenses/.\n *\n */\n\nimport {AjfAggregationType} from './aggregation-type';\n\nexport interface AjfAggregation {\n  aggregation: AjfAggregationType;\n}\n","/**\n * @license\n * Copyright (C) Gnucoop soc. coop.\n *\n * This file is part of the Advanced JSON forms (ajf).\n *\n * Advanced JSON forms (ajf) is free software: you can redistribute it and/or\n * modify it under the terms of the GNU Affero General Public License as\n * published by the Free Software Foundation, either version 3 of the License,\n * or (at your option) any later version.\n *\n * Advanced JSON forms (ajf) is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero\n * General Public License for more details.\n *\n * You should have received a copy of the GNU Affero General Public License\n * along with Advanced JSON forms (ajf).\n * If not, see http://www.gnu.org/licenses/.\n *\n */\n\n// tslint:disable-next-line:prefer-const-enum\nexport enum AjfAggregationType {\n  None,\n  Sum,\n  Average,\n  WeightedAverage,\n  LENGTH,\n}\n","/**\n * @license\n * Copyright (C) Gnucoop soc. coop.\n *\n * This file is part of the Advanced JSON forms (ajf).\n *\n * Advanced JSON forms (ajf) is free software: you can redistribute it and/or\n * modify it under the terms of the GNU Affero General Public License as\n * published by the Free Software Foundation, either version 3 of the License,\n * or (at your option) any later version.\n *\n * Advanced JSON forms (ajf) is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero\n * General Public License for more details.\n *\n * You should have received a copy of the GNU Affero General Public License\n * along with Advanced JSON forms (ajf).\n * If not, see http://www.gnu.org/licenses/.\n *\n */\n\nimport {AjfFormula} from '@ajf/core/models';\nimport {AjfChartType} from '../charts/chart-type';\nimport {AjfChartDatasetOptions} from './chart-dataset-options';\nimport {AjfDataset} from './dataset';\n\nexport interface AjfChartDataset extends AjfDataset {\n  formula: AjfFormula[];\n  chartType?: AjfChartType;\n  options?: AjfChartDatasetOptions;\n  datalabels?: any;\n}\n","/**\n * @license\n * Copyright (C) Gnucoop soc. coop.\n *\n * This file is part of the Advanced JSON forms (ajf).\n *\n * Advanced JSON forms (ajf) is free software: you can redistribute it and/or\n * modify it under the terms of the GNU Affero General Public License as\n * published by the Free Software Foundation, either version 3 of the License,\n * or (at your option) any later version.\n *\n * Advanced JSON forms (ajf) is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero\n * General Public License for more details.\n *\n * You should have received a copy of the GNU Affero General Public License\n * along with Advanced JSON forms (ajf).\n * If not, see http://www.gnu.org/licenses/.\n *\n */\n\nimport {ChartColor} from 'chart.js';\n\nexport interface AjfChartDatasetOptions {\n  backgroundColor?: ChartColor | ChartColor[];\n  borderWidth?: number;\n  borderColor?: ChartColor;\n  borderCapStyle?: string;\n  borderDash?: number[];\n  borderDashOffset?: number;\n  borderJoinStyle?: string;\n  fill?: boolean;\n  label?: string;\n  lineTension?: number;\n  pointBorderColor?: ChartColor | ChartColor[];\n  pointBackgroundColor?: ChartColor | ChartColor[];\n  pointBorderWidth?: number | number[];\n  pointRadius?: number | number[];\n  pointHoverRadius?: number | number[];\n  pointHitRadius?: number | number[];\n  pointHoverBackgroundColor?: ChartColor | ChartColor[];\n  pointHoverBorderColor?: ChartColor | ChartColor[];\n  pointHoverBorderWidth?: number | number[];\n  pointStyle?: string | string[] | HTMLImageElement | HTMLImageElement[];\n  xAxisID?: string;\n  yAxisID?: string;\n  type?: string;\n  hidden?: boolean;\n  hideInLegendAndTooltip?: boolean;\n  stack?: string;\n  datalabels?: any;\n}\n","/**\n * @license\n * Copyright (C) Gnucoop soc. coop.\n *\n * This file is part of the Advanced JSON forms (ajf).\n *\n * Advanced JSON forms (ajf) is free software: you can redistribute it and/or\n * modify it under the terms of the GNU Affero General Public License as\n * published by the Free Software Foundation, either version 3 of the License,\n * or (at your option) any later version.\n *\n * Advanced JSON forms (ajf) is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero\n * General Public License for more details.\n *\n * You should have received a copy of the GNU Affero General Public License\n * along with Advanced JSON forms (ajf).\n * If not, see http://www.gnu.org/licenses/.\n *\n */\n\nimport {AjfFormula} from '@ajf/core/models';\nimport {AjfAggregation} from '../aggregation/aggregation';\n\nexport interface AjfDataset {\n  formula?: AjfFormula | AjfFormula[];\n  aggregation: AjfAggregation;\n  label?: string;\n}\n","/**\n * @license\n * Copyright (C) Gnucoop soc. coop.\n *\n * This file is part of the Advanced JSON forms (ajf).\n *\n * Advanced JSON forms (ajf) is free software: you can redistribute it and/or\n * modify it under the terms of the GNU Affero General Public License as\n * published by the Free Software Foundation, either version 3 of the License,\n * or (at your option) any later version.\n *\n * Advanced JSON forms (ajf) is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero\n * General Public License for more details.\n *\n * You should have received a copy of the GNU Affero General Public License\n * along with Advanced JSON forms (ajf).\n * If not, see http://www.gnu.org/licenses/.\n *\n */\n\nimport {AjfFormula} from '@ajf/core/models';\nimport {AjfDataset} from './dataset';\n\nexport interface AjfTableDataset extends AjfDataset {\n  formula: AjfFormula;\n  colspan: number;\n  rowspan: number;\n  style: any;\n  sorted?: boolean;\n}\n","/**\n * @license\n * Copyright (C) Gnucoop soc. coop.\n *\n * This file is part of the Advanced JSON forms (ajf).\n *\n * Advanced JSON forms (ajf) is free software: you can redistribute it and/or\n * modify it under the terms of the GNU Affero General Public License as\n * published by the Free Software Foundation, either version 3 of the License,\n * or (at your option) any later version.\n *\n * Advanced JSON forms (ajf) is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero\n * General Public License for more details.\n *\n * You should have received a copy of the GNU Affero General Public License\n * along with Advanced JSON forms (ajf).\n * If not, see http://www.gnu.org/licenses/.\n *\n */\n\nimport {AjfForm} from '@ajf/core/forms';\nimport {AjfStyles} from '../styles';\nimport {AjfReportContainer} from './report-container';\nimport {AjfReportStringIdentifier} from './report-string-identifier';\nimport {AjfReportVariable} from './report-variable';\n\nexport interface AjfReport {\n  header?: AjfReportContainer;\n  content?: AjfReportContainer;\n  footer?: AjfReportContainer;\n  styles?: AjfStyles;\n  forms?: AjfForm[];\n  variables?: AjfReportVariable[];\n  stringIdentifier?: AjfReportStringIdentifier[];\n}\n","/**\n * @license\n * Copyright (C) Gnucoop soc. coop.\n *\n * This file is part of the Advanced JSON forms (ajf).\n *\n * Advanced JSON forms (ajf) is free software: you can redistribute it and/or\n * modify it under the terms of the GNU Affero General Public License as\n * published by the Free Software Foundation, either version 3 of the License,\n * or (at your option) any later version.\n *\n * Advanced JSON forms (ajf) is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero\n * General Public License for more details.\n *\n * You should have received a copy of the GNU Affero General Public License\n * along with Advanced JSON forms (ajf).\n * If not, see http://www.gnu.org/licenses/.\n *\n */\n\nimport {AjfStyles} from '../styles';\nimport {AjfWidget} from '../widgets/widget';\n\nexport interface AjfReportContainer {\n  content: AjfWidget[];\n  styles: AjfStyles;\n}\n","/**\n * @license\n * Copyright (C) Gnucoop soc. coop.\n *\n * This file is part of the Advanced JSON forms (ajf).\n *\n * Advanced JSON forms (ajf) is free software: you can redistribute it and/or\n * modify it under the terms of the GNU Affero General Public License as\n * published by the Free Software Foundation, either version 3 of the License,\n * or (at your option) any later version.\n *\n * Advanced JSON forms (ajf) is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero\n * General Public License for more details.\n *\n * You should have received a copy of the GNU Affero General Public License\n * along with Advanced JSON forms (ajf).\n * If not, see http://www.gnu.org/licenses/.\n *\n */\n\nimport {AjfStringIdentifier} from '@ajf/core/common';\n\nexport type AjfReportStringIdentifier = AjfStringIdentifier;\n","/**\n * @license\n * Copyright (C) Gnucoop soc. coop.\n *\n * This file is part of the Advanced JSON forms (ajf).\n *\n * Advanced JSON forms (ajf) is free software: you can redistribute it and/or\n * modify it under the terms of the GNU Affero General Public License as\n * published by the Free Software Foundation, either version 3 of the License,\n * or (at your option) any later version.\n *\n * Advanced JSON forms (ajf) is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero\n * General Public License for more details.\n *\n * You should have received a copy of the GNU Affero General Public License\n * along with Advanced JSON forms (ajf).\n * If not, see http://www.gnu.org/licenses/.\n *\n */\n\nimport {AjfFormula} from '@ajf/core/models';\n\nexport interface AjfReportVariable {\n  name: string;\n  formula: AjfFormula;\n  isAIPrompt?: boolean;\n}\n","/**\n * @license\n * Copyright (C) Gnucoop soc. coop.\n *\n * This file is part of the Advanced JSON forms (ajf).\n *\n * Advanced JSON forms (ajf) is free software: you can redistribute it and/or\n * modify it under the terms of the GNU Affero General Public License as\n * published by the Free Software Foundation, either version 3 of the License,\n * or (at your option) any later version.\n *\n * Advanced JSON forms (ajf) is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero\n * General Public License for more details.\n *\n * You should have received a copy of the GNU Affero General Public License\n * along with Advanced JSON forms (ajf).\n * If not, see http://www.gnu.org/licenses/.\n *\n */\n\nimport {AjfReportContainer} from '../reports/report-container';\nimport {AjfStyles} from '../styles';\nimport {AjfWidgetInstance} from '../widgets-instances/widget-instance';\n\nexport interface AjfReportContainerInstance {\n  container: AjfReportContainer;\n  content: AjfWidgetInstance[];\n  styles: AjfStyles;\n}\n","/**\n * @license\n * Copyright (C) Gnucoop soc. coop.\n *\n * This file is part of the Advanced JSON forms (ajf).\n *\n * Advanced JSON forms (ajf) is free software: you can redistribute it and/or\n * modify it under the terms of the GNU Affero General Public License as\n * published by the Free Software Foundation, either version 3 of the License,\n * or (at your option) any later version.\n *\n * Advanced JSON forms (ajf) is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero\n * General Public License for more details.\n *\n * You should have received a copy of the GNU Affero General Public License\n * along with Advanced JSON forms (ajf).\n * If not, see http://www.gnu.org/licenses/.\n *\n */\n\nimport {AjfReport} from '../reports/report';\nimport {AjfStyles} from '../styles';\nimport {AjfReportContainerInstance} from './report-container-instance';\n\nexport interface AjfReportInstance {\n  report: AjfReport;\n  header?: AjfReportContainerInstance;\n  content?: AjfReportContainerInstance;\n  footer?: AjfReportContainerInstance;\n  styles: AjfStyles;\n}\n","/**\n * @license\n * Copyright (C) Gnucoop soc. coop.\n *\n * This file is part of the Advanced JSON forms (ajf).\n *\n * Advanced JSON forms (ajf) is free software: you can redistribute it and/or\n * modify it under the terms of the GNU Affero General Public License as\n * published by the Free Software Foundation, either version 3 of the License,\n * or (at your option) any later version.\n *\n * Advanced JSON forms (ajf) is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero\n * General Public License for more details.\n *\n * You should have received a copy of the GNU Affero General Public License\n * along with Advanced JSON forms (ajf).\n * If not, see http://www.gnu.org/licenses/.\n *\n */\n\nexport interface AjfStyles {\n  [style: string]: any;\n}\n","/**\n * @license\n * Copyright (C) Gnucoop soc. coop.\n *\n * This file is part of the Advanced JSON forms (ajf).\n *\n * Advanced JSON forms (ajf) is free software: you can redistribute it and/or\n * modify it under the terms of the GNU Affero General Public License as\n * published by the Free Software Foundation, either version 3 of the License,\n * or (at your option) any later version.\n *\n * Advanced JSON forms (ajf) is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero\n * General Public License for more details.\n *\n * You should have received a copy of the GNU Affero General Public License\n * along with Advanced JSON forms (ajf).\n * If not, see http://www.gnu.org/licenses/.\n *\n */\n\nimport {AjfCondition, AjfFormula} from '@ajf/core/models';\n\nimport {AjfStyles} from '../styles';\nimport {AjfFilter} from './filter';\n\nimport {AjfWidgetType} from './widget-type';\n\nexport interface AjfBaseWidget {\n  widgetType: AjfWidgetType;\n  styles: AjfStyles;\n  visibility: AjfCondition;\n  repetitions?: AjfFormula;\n  filter?: AjfFilter;\n}\n","/**\n * @license\n * Copyright (C) Gnucoop soc. coop.\n *\n * This file is part of the Advanced JSON forms (ajf).\n *\n * Advanced JSON forms (ajf) is free software: you can redistribute it and/or\n * modify it under the terms of the GNU Affero General Public License as\n * published by the Free Software Foundation, either version 3 of the License,\n * or (at your option) any later version.\n *\n * Advanced JSON forms (ajf) is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero\n * General Public License for more details.\n *\n * You should have received a copy of the GNU Affero General Public License\n * along with Advanced JSON forms (ajf).\n * If not, see http://www.gnu.org/licenses/.\n *\n */\n\nimport {AjfFormula} from '@ajf/core/models';\nimport {ChartOptions} from 'chart.js';\n\nimport {AjfChartType} from '../charts/chart-type';\nimport {AjfChartDataset} from '../dataset/chart-dataset';\nimport {AjfDataWidget} from './data-widget';\nimport {AjfWidgetType} from './widget-type';\n\nexport interface AjfChartWidget extends AjfDataWidget {\n  widgetType: AjfWidgetType.Chart;\n\n  /**\n   * The chart type\n   */\n  chartType: AjfChartType;\n  type?: AjfChartType;\n\n  /**\n   * Chart Labels formula\n   */\n  labels: AjfFormula | AjfFormula[];\n\n  /**\n   * The chart dataset\n   */\n  dataset: AjfChartDataset[];\n  options: ChartOptions;\n\n  /**\n   * If true the widget is exportable in csv/xls\n   */\n  exportable?: boolean;\n\n  /**\n   * When specified, this number of different single data entries will be displayed as separate\n   * options/bars/slices in the chart. The rest will be displayed as an aggregate \"other\" option/bar/slice.\n   */\n  mainDataNumberThreshold?: number;\n\n  /**\n   * If true remove zero values from the chart dataset\n   */\n  removeZeroValues?: boolean;\n}\n","/**\n * @license\n * Copyright (C) Gnucoop soc. coop.\n *\n * This file is part of the Advanced JSON forms (ajf).\n *\n * Advanced JSON forms (ajf) is free software: you can redistribute it and/or\n * modify it under the terms of the GNU Affero General Public License as\n * published by the Free Software Foundation, either version 3 of the License,\n * or (at your option) any later version.\n *\n * Advanced JSON forms (ajf) is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero\n * General Public License for more details.\n *\n * You should have received a copy of the GNU Affero General Public License\n * along with Advanced JSON forms (ajf).\n * If not, see http://www.gnu.org/licenses/.\n *\n */\n\nimport {AjfWidgetType} from './widget-type';\nimport {AjfWidgetWithContent} from './widget-with-content';\n\nexport interface AjfColumnWidget extends AjfWidgetWithContent {\n  widgetType: AjfWidgetType.Column;\n}\n","/**\n * @license\n * Copyright (C) Gnucoop soc. coop.\n *\n * This file is part of the Advanced JSON forms (ajf).\n *\n * Advanced JSON forms (ajf) is free software: you can redistribute it and/or\n * modify it under the terms of the GNU Affero General Public License as\n * published by the Free Software Foundation, either version 3 of the License,\n * or (at your option) any later version.\n *\n * Advanced JSON forms (ajf) is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero\n * General Public License for more details.\n *\n * You should have received a copy of the GNU Affero General Public License\n * along with Advanced JSON forms (ajf).\n * If not, see http://www.gnu.org/licenses/.\n *\n */\n\nexport interface AjfCustomWidget {\n  json: string;\n  type: string;\n}\n","/**\n * @license\n * Copyright (C) Gnucoop soc. coop.\n *\n * This file is part of the Advanced JSON forms (ajf).\n *\n * Advanced JSON forms (ajf) is free software: you can redistribute it and/or\n * modify it under the terms of the GNU Affero General Public License as\n * published by the Free Software Foundation, either version 3 of the License,\n * or (at your option) any later version.\n *\n * Advanced JSON forms (ajf) is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero\n * General Public License for more details.\n *\n * You should have received a copy of the GNU Affero General Public License\n * along with Advanced JSON forms (ajf).\n * If not, see http://www.gnu.org/licenses/.\n *\n */\n\nimport {AjfDataset} from '../dataset/dataset';\nimport {AjfBaseWidget} from './base-widget';\n\nexport interface AjfDataWidget extends AjfBaseWidget {\n  dataset: AjfDataset[] | AjfDataset[][];\n}\n","/**\n * @license\n * Copyright (C) Gnucoop soc. coop.\n *\n * This file is part of the Advanced JSON forms (ajf).\n *\n * Advanced JSON forms (ajf) is free software: you can redistribute it and/or\n * modify it under the terms of the GNU Affero General Public License as\n * published by the Free Software Foundation, either version 3 of the License,\n * or (at your option) any later version.\n *\n * Advanced JSON forms (ajf) is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero\n * General Public License for more details.\n *\n * You should have received a copy of the GNU Affero General Public License\n * along with Advanced JSON forms (ajf).\n * If not, see http://www.gnu.org/licenses/.\n *\n */\n\nimport {AjfWidget} from './widget';\nimport {AjfWidgetWithContent} from './widget-with-content';\nimport {AjfWidgetType} from './widget-type';\n\nexport interface AjfDialogWidget extends AjfWidgetWithContent {\n  widgetType: AjfWidgetType.Dialog;\n  toggle: AjfWidget;\n}\n","/**\n * @license\n * Copyright (C) Gnucoop soc. coop.\n *\n * This file is part of the Advanced JSON forms (ajf).\n *\n * Advanced JSON forms (ajf) is free software: you can redistribute it and/or\n * modify it under the terms of the GNU Affero General Public License as\n * published by the Free Software Foundation, either version 3 of the License,\n * or (at your option) any later version.\n *\n * Advanced JSON forms (ajf) is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero\n * General Public License for more details.\n *\n * You should have received a copy of the GNU Affero General Public License\n * along with Advanced JSON forms (ajf).\n * If not, see http://www.gnu.org/licenses/.\n *\n */\n\nimport {AjfFormCreate} from '@ajf/core/forms';\n\nexport interface AjfFilter {\n  schema: AjfFormCreate;\n}\n","/**\n * @license\n * Copyright (C) Gnucoop soc. coop.\n *\n * This file is part of the Advanced JSON forms (ajf).\n *\n * Advanced JSON forms (ajf) is free software: you can redistribute it and/or\n * modify it under the terms of the GNU Affero General Public License as\n * published by the Free Software Foundation, either version 3 of the License,\n * or (at your option) any later version.\n *\n * Advanced JSON forms (ajf) is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero\n * General Public License for more details.\n *\n * You should have received a copy of the GNU Affero General Public License\n * along with Advanced JSON forms (ajf).\n * If not, see http://www.gnu.org/licenses/.\n *\n */\n\nimport {AjfFormula} from '@ajf/core/models';\n\nimport {AjfBaseWidget} from './base-widget';\nimport {AjfWidgetType} from './widget-type';\n\nexport interface AjfFormulaWidget extends AjfBaseWidget {\n  widgetType: AjfWidgetType.Formula;\n  formula: AjfFormula;\n}\n","/**\n * @license\n * Copyright (C) Gnucoop soc. coop.\n *\n * This file is part of the Advanced JSON forms (ajf).\n *\n * Advanced JSON forms (ajf) is free software: you can redistribute it and/or\n * modify it under the terms of the GNU Affero General Public License as\n * published by the Free Software Foundation, either version 3 of the License,\n * or (at your option) any later version.\n *\n * Advanced JSON forms (ajf) is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero\n * General Public License for more details.\n *\n * You should have received a copy of the GNU Affero General Public License\n * along with Advanced JSON forms (ajf).\n * If not, see http://www.gnu.org/licenses/.\n *\n */\n\nimport {AjfGraphNodeDataset} from '../dataset/graph-dataset';\nimport {AjfBaseWidget} from './base-widget';\nimport {AjfWidgetType} from './widget-type';\n\nexport interface AjfGraphWidget extends AjfBaseWidget {\n  widgetType: AjfWidgetType.Graph;\n  nodes: AjfGraphNodeDataset[];\n}\n","/**\n * @license\n * Copyright (C) Gnucoop soc. coop.\n *\n * This file is part of the Advanced JSON forms (ajf).\n *\n * Advanced JSON forms (ajf) is free software: you can redistribute it and/or\n * modify it under the terms of the GNU Affero General Public License as\n * published by the Free Software Foundation, either version 3 of the License,\n * or (at your option) any later version.\n *\n * Advanced JSON forms (ajf) is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero\n * General Public License for more details.\n *\n * You should have received a copy of the GNU Affero General Public License\n * along with Advanced JSON forms (ajf).\n * If not, see http://www.gnu.org/licenses/.\n *\n */\n\nimport {AjfFormula} from '@ajf/core/models';\nimport {AjfHeatMapFeatureCollection} from '@ajf/core/heat-map';\n\nimport {AjfBaseWidget} from './base-widget';\nimport {AjfWidgetType} from './widget-type';\n\nexport interface AjfHeatMapWidget extends AjfBaseWidget {\n  widgetType: AjfWidgetType.HeatMap;\n  idProp?: string;\n  features: AjfHeatMapFeatureCollection | string;\n  values: AjfFormula;\n  startColor?: string;\n  endColor?: string;\n  highlightColor?: string;\n  showVisualMap?: boolean;\n  action?: string;\n}\n","/**\n * @license\n * Copyright (C) Gnucoop soc. coop.\n *\n * This file is part of the Advanced JSON forms (ajf).\n *\n * Advanced JSON forms (ajf) is free software: you can redistribute it and/or\n * modify it under the terms of the GNU Affero General Public License as\n * published by the Free Software Foundation, either version 3 of the License,\n * or (at your option) any later version.\n *\n * Advanced JSON forms (ajf) is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero\n * General Public License for more details.\n *\n * You should have received a copy of the GNU Affero General Public License\n * along with Advanced JSON forms (ajf).\n * If not, see http://www.gnu.org/licenses/.\n *\n */\n\nimport {AjfImageType} from '@ajf/core/image';\nimport {AjfFormula} from '@ajf/core/models';\n\nimport {AjfBaseWidget} from './base-widget';\nimport {AjfWidgetType} from './widget-type';\n\nexport interface AjfImageContainerWidget extends AjfBaseWidget {\n  widgetType: AjfWidgetType.ImageContainer;\n  imageType: AjfImageType;\n  icons?: AjfFormula | AjfFormula[];\n  flags?: AjfFormula | AjfFormula[];\n  urls?: AjfFormula | AjfFormula[];\n}\n","/**\n * @license\n * Copyright (C) Gnucoop soc. coop.\n *\n * This file is part of the Advanced JSON forms (ajf).\n *\n * Advanced JSON forms (ajf) is free software: you can redistribute it and/or\n * modify it under the terms of the GNU Affero General Public License as\n * published by the Free Software Foundation, either version 3 of the License,\n * or (at your option) any later version.\n *\n * Advanced JSON forms (ajf) is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero\n * General Public License for more details.\n *\n * You should have received a copy of the GNU Affero General Public License\n * along with Advanced JSON forms (ajf).\n * If not, see http://www.gnu.org/licenses/.\n *\n */\n\nimport {AjfImageType} from '@ajf/core/image';\nimport {AjfFormula} from '@ajf/core/models';\n\nimport {AjfBaseWidget} from './base-widget';\nimport {AjfWidgetType} from './widget-type';\n\nexport interface AjfImageWidget extends AjfBaseWidget {\n  widgetType: AjfWidgetType.Image;\n  imageType: AjfImageType;\n  icon?: AjfFormula;\n  flag?: AjfFormula;\n  url?: AjfFormula;\n}\n","/**\n * @license\n * Copyright (C) Gnucoop soc. coop.\n *\n * This file is part of the Advanced JSON forms (ajf).\n *\n * Advanced JSON forms (ajf) is free software: you can redistribute it and/or\n * modify it under the terms of the GNU Affero General Public License as\n * published by the Free Software Foundation, either version 3 of the License,\n * or (at your option) any later version.\n *\n * Advanced JSON forms (ajf) is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero\n * General Public License for more details.\n *\n * You should have received a copy of the GNU Affero General Public License\n * along with Advanced JSON forms (ajf).\n * If not, see http://www.gnu.org/licenses/.\n *\n */\n\nimport {AjfWidgetWithContent} from './widget-with-content';\nimport {AjfWidgetType} from './widget-type';\n\nexport interface AjfLayoutWidget extends AjfWidgetWithContent {\n  widgetType: AjfWidgetType.Layout;\n  columns: number[];\n}\n","/**\n * @license\n * Copyright (C) Gnucoop soc. coop.\n *\n * This file is part of the Advanced JSON forms (ajf).\n *\n * Advanced JSON forms (ajf) is free software: you can redistribute it and/or\n * modify it under the terms of the GNU Affero General Public License as\n * published by the Free Software Foundation, either version 3 of the License,\n * or (at your option) any later version.\n *\n * Advanced JSON forms (ajf) is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero\n * General Public License for more details.\n *\n * You should have received a copy of the GNU Affero General Public License\n * along with Advanced JSON forms (ajf).\n * If not, see http://www.gnu.org/licenses/.\n *\n */\n\nimport {AjfFormula} from '@ajf/core/models';\n\nimport {AjfDataWidget} from './data-widget';\nimport {AjfWidgetType} from './widget-type';\n\nexport interface AjfMapWidget extends AjfDataWidget {\n  widgetType: AjfWidgetType.Map;\n  coordinate: AjfFormula;\n  tileLayer: string;\n  attribution: string;\n  disabled: boolean;\n}\n","/**\n * @license\n * Copyright (C) Gnucoop soc. coop.\n *\n * This file is part of the Advanced JSON forms (ajf).\n *\n * Advanced JSON forms (ajf) is free software: you can redistribute it and/or\n * modify it under the terms of the GNU Affero General Public License as\n * published by the Free Software Foundation, either version 3 of the License,\n * or (at your option) any later version.\n *\n * Advanced JSON forms (ajf) is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero\n * General Public License for more details.\n *\n * You should have received a copy of the GNU Affero General Public License\n * along with Advanced JSON forms (ajf).\n * If not, see http://www.gnu.org/licenses/.\n *\n */\n\nimport {AjfBaseWidget} from './base-widget';\nimport {AjfWidgetType} from './widget-type';\n\nexport interface AjfPageBreakWidget extends AjfBaseWidget {\n  widgetType: AjfWidgetType.PageBreak;\n}\n","/**\n * @license\n * Copyright (C) Gnucoop soc. coop.\n *\n * This file is part of the Advanced JSON forms (ajf).\n *\n * Advanced JSON forms (ajf) is free software: you can redistribute it and/or\n * modify it under the terms of the GNU Affero General Public License as\n * published by the Free Software Foundation, either version 3 of the License,\n * or (at your option) any later version.\n *\n * Advanced JSON forms (ajf) is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero\n * General Public License for more details.\n *\n * You should have received a copy of the GNU Affero General Public License\n * along with Advanced JSON forms (ajf).\n * If not, see http://www.gnu.org/licenses/.\n *\n */\n\nimport {AjfWidgetType} from './widget-type';\nimport {AjfFormula} from '@ajf/core/models';\nimport {AjfWidgetWithContent} from './widget-with-content';\n\nexport interface AjfPaginatedListWidget extends AjfWidgetWithContent {\n  widgetType: AjfWidgetType.PaginatedList;\n  title: string;\n  pageSize: number;\n  contentDefinition?: AjfFormula;\n  exportable?: boolean;\n}\n","/**\n * @license\n * Copyright (C) Gnucoop soc. coop.\n *\n * This file is part of the Advanced JSON forms (ajf).\n *\n * Advanced JSON forms (ajf) is free software: you can redistribute it and/or\n * modify it under the terms of the GNU Affero General Public License as\n * published by the Free Software Foundation, either version 3 of the License,\n * or (at your option) any later version.\n *\n * Advanced JSON forms (ajf) is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero\n * General Public License for more details.\n *\n * You should have received a copy of the GNU Affero General Public License\n * along with Advanced JSON forms (ajf).\n * If not, see http://www.gnu.org/licenses/.\n *\n */\n\nimport {AjfWidgetType} from './widget-type';\nimport {AjfFormula} from '@ajf/core/models';\nimport {AjfDataWidget} from './data-widget';\nimport {AjfTableDataset} from '../dataset/table-dataset';\n\nexport interface AjfPaginatedTableWidget extends AjfDataWidget {\n  widgetType: AjfWidgetType.PaginatedTable;\n  pageSize: number;\n\n  /**\n   * it should return a AjfTableCell[][]\n   */\n  rowDefinition: AjfFormula;\n  cellStyles: any;\n  dataset: AjfTableDataset[];\n  exportable?: boolean;\n}\n","/**\n * @license\n * Copyright (C) Gnucoop soc. coop.\n *\n * This file is part of the Advanced JSON forms (ajf).\n *\n * Advanced JSON forms (ajf) is free software: you can redistribute it and/or\n * modify it under the terms of the GNU Affero General Public License as\n * published by the Free Software Foundation, either version 3 of the License,\n * or (at your option) any later version.\n *\n * Advanced JSON forms (ajf) is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero\n * General Public License for more details.\n *\n * You should have received a copy of the GNU Affero General Public License\n * along with Advanced JSON forms (ajf).\n * If not, see http://www.gnu.org/licenses/.\n *\n */\n\nimport {AjfTableDataset} from '../dataset/table-dataset';\nimport {AjfDataWidget} from './data-widget';\nimport {AjfWidgetType} from './widget-type';\n\nexport interface AjfTableWidget extends AjfDataWidget {\n  widgetType: AjfWidgetType.Table;\n  cellStyles: any;\n  dataset: AjfTableDataset[][];\n  exportable?: boolean;\n}\n","/**\n * @license\n * Copyright (C) Gnucoop soc. coop.\n *\n * This file is part of the Advanced JSON forms (ajf).\n *\n * Advanced JSON forms (ajf) is free software: you can redistribute it and/or\n * modify it under the terms of the GNU Affero General Public License as\n * published by the Free Software Foundation, either version 3 of the License,\n * or (at your option) any later version.\n *\n * Advanced JSON forms (ajf) is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero\n * General Public License for more details.\n *\n * You should have received a copy of the GNU Affero General Public License\n * along with Advanced JSON forms (ajf).\n * If not, see http://www.gnu.org/licenses/.\n *\n */\n\nimport {AjfBaseWidget} from './base-widget';\nimport {AjfWidgetType} from './widget-type';\n\nexport interface AjfTextWidget extends AjfBaseWidget {\n  widgetType: AjfWidgetType.Text;\n  htmlText: string;\n}\n","/**\n * @license\n * Copyright (C) Gnucoop soc. coop.\n *\n * This file is part of the Advanced JSON forms (ajf).\n *\n * Advanced JSON forms (ajf) is free software: you can redistribute it and/or\n * modify it under the terms of the GNU Affero General Public License as\n * published by the Free Software Foundation, either version 3 of the License,\n * or (at your option) any later version.\n *\n * Advanced JSON forms (ajf) is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero\n * General Public License for more details.\n *\n * You should have received a copy of the GNU Affero General Public License\n * along with Advanced JSON forms (ajf).\n * If not, see http://www.gnu.org/licenses/.\n *\n */\n\nimport {AjfBaseWidget} from './base-widget';\nimport {AjfChartWidget} from './chart-widget';\nimport {AjfColumnWidget} from './column-widget';\nimport {AjfDataWidget} from './data-widget';\nimport {AjfDialogWidget} from './dialog-widget';\nimport {AjfDynamicTableWidget} from './dynamic-table-widget';\nimport {AjfFormulaWidget} from './formula-widget';\nimport {AjfHeatMapWidget} from './heat-map-widget';\nimport {AjfImageContainerWidget} from './image-container-widget';\nimport {AjfImageWidget} from './image-widget';\nimport {AjfLayoutWidget} from './layout-widget';\nimport {AjfPageBreakWidget} from './page-break-widget';\nimport {AjfPaginatedListWidget} from './paginated-list-widget';\nimport {AjfMapWidget} from './map-widget';\nimport {AjfTextWidget} from './text-widget';\nimport {AjfWidgetWithContent} from './widget-with-content';\nimport {AjfWidgetType} from './widget-type';\nimport {AjfGraphWidget} from './graph-widget';\nimport {AjfPaginatedTableWidget} from './paginated-table-widget';\n\nexport interface AjfUnknownWidget extends AjfBaseWidget {\n  widgetType: AjfWidgetType.LENGTH;\n}\n\nexport type AjfWidget =\n  | AjfChartWidget\n  | AjfColumnWidget\n  | AjfDataWidget\n  | AjfDialogWidget\n  | AjfDynamicTableWidget\n  | AjfFormulaWidget\n  | AjfGraphWidget\n  | AjfHeatMapWidget\n  | AjfImageContainerWidget\n  | AjfImageWidget\n  | AjfLayoutWidget\n  | AjfMapWidget\n  | AjfPageBreakWidget\n  | AjfPaginatedListWidget\n  | AjfTextWidget\n  | AjfUnknownWidget\n  | AjfWidgetWithContent\n  | AjfPaginatedTableWidget;\n","/**\n * @license\n * Copyright (C) Gnucoop soc. coop.\n *\n * This file is part of the Advanced JSON forms (ajf).\n *\n * Advanced JSON forms (ajf) is free software: you can redistribute it and/or\n * modify it under the terms of the GNU Affero General Public License as\n * published by the Free Software Foundation, either version 3 of the License,\n * or (at your option) any later version.\n *\n * Advanced JSON forms (ajf) is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero\n * General Public License for more details.\n *\n * You should have received a copy of the GNU Affero General Public License\n * along with Advanced JSON forms (ajf).\n * If not, see http://www.gnu.org/licenses/.\n *\n */\n\nimport {AjfContext} from '@ajf/core/models';\nimport {TranslocoService} from '@ajf/core/transloco';\nimport {Type} from '@angular/core';\n\nimport {AjfBaseWidgetComponent} from '../../base-widget';\nimport {AjfWidgetInstance} from '../widgets-instances/widget-instance';\n\nexport interface AjfWidgetComponentsMap {\n  [key: number]: {\n    component: Type<AjfBaseWidgetComponent>;\n    inputs?: {[key: string]: any};\n    initInstance?: (\n      widgetInstance: AjfWidgetInstance,\n      context: AjfContext,\n      translateService: TranslocoService,\n    ) => AjfWidgetInstance;\n  };\n}\n","/**\n * @license\n * Copyright (C) Gnucoop soc. coop.\n *\n * This file is part of the Advanced JSON forms (ajf).\n *\n * Advanced JSON forms (ajf) is free software: you can redistribute it and/or\n * modify it under the terms of the GNU Affero General Public License as\n * published by the Free Software Foundation, either version 3 of the License,\n * or (at your option) any later version.\n *\n * Advanced JSON forms (ajf) is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero\n * General Public License for more details.\n *\n * You should have received a copy of the GNU Affero General Public License\n * along with Advanced JSON forms (ajf).\n * If not, see http://www.gnu.org/licenses/.\n *\n */\n\n// tslint:disable-next-line:prefer-const-enum\nexport enum AjfWidgetType {\n  Layout,\n  PageBreak,\n  Image,\n  Text,\n  Chart,\n  Table,\n  Map,\n  Column,\n  Formula,\n  ImageContainer,\n  DynamicTable,\n  Graph,\n  PaginatedList,\n  Dialog,\n  HeatMap,\n  PaginatedTable,\n  LENGTH,\n}\n","/**\n * @license\n * Copyright (C) Gnucoop soc. coop.\n *\n * This file is part of the Advanced JSON forms (ajf).\n *\n * Advanced JSON forms (ajf) is free software: you can redistribute it and/or\n * modify it under the terms of the GNU Affero General Public License as\n * published by the Free Software Foundation, either version 3 of the License,\n * or (at your option) any later version.\n *\n * Advanced JSON forms (ajf) is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero\n * General Public License for more details.\n *\n * You should have received a copy of the GNU Affero General Public License\n * along with Advanced JSON forms (ajf).\n * If not, see http://www.gnu.org/licenses/.\n *\n */\n\nimport {AjfBaseWidget} from './base-widget';\nimport {AjfWidget} from './widget';\n\nexport interface AjfWidgetWithContent extends AjfBaseWidget {\n  content: AjfWidget[];\n}\n","/**\n * @license\n * Copyright (C) Gnucoop soc. coop.\n *\n * This file is part of the Advanced JSON forms (ajf).\n *\n * Advanced JSON forms (ajf) is free software: you can redistribute it and/or\n * modify it under the terms of the GNU Affero General Public License as\n * published by the Free Software Foundation, either version 3 of the License,\n * or (at your option) any later version.\n *\n * Advanced JSON forms (ajf) is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero\n * General Public License for more details.\n *\n * You should have received a copy of the GNU Affero General Public License\n * along with Advanced JSON forms (ajf).\n * If not, see http://www.gnu.org/licenses/.\n *\n */\n\nimport {AjfStyles} from '../styles';\nimport {AjfWidget} from '../widgets/widget';\nimport {AjfWidgetType} from '../widgets/widget-type';\nimport {AjfFilterInstance} from './filter-instance';\n\nexport interface AjfBaseWidgetInstance {\n  widget: AjfWidget;\n  visible: boolean;\n  styles: AjfStyles;\n  widgetType: AjfWidgetType;\n  filter?: AjfFilterInstance;\n  repetitions?: number;\n}\n","/**\n * @license\n * Copyright (C) Gnucoop soc. coop.\n *\n * This file is part of the Advanced JSON forms (ajf).\n *\n * Advanced JSON forms (ajf) is free software: you can redistribute it and/or\n * modify it under the terms of the GNU Affero General Public License as\n * published by the Free Software Foundation, either version 3 of the License,\n * or (at your option) any later version.\n *\n * Advanced JSON forms (ajf) is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero\n * General Public License for more details.\n *\n * You should have received a copy of the GNU Affero General Public License\n * along with Advanced JSON forms (ajf).\n * If not, see http://www.gnu.org/licenses/.\n *\n */\n\nimport {ChartData, ChartDataSets, ChartType} from 'chart.js';\n\nimport {AjfChartWidget} from '../widgets/chart-widget';\nimport {AjfDataWidgetInstance} from './data-widget-instance';\n\nexport interface AjfChartWidgetInstance extends AjfDataWidgetInstance {\n  /**\n   * The chart widget\n   */\n  widget: AjfChartWidget;\n\n  /**\n   * The chart dataset\n   */\n  datasets: ChartDataSets[];\n\n  /**\n   * The chart type\n   */\n  chartType: ChartType;\n\n  /**\n   * If true the widget is exportable in csv/xls\n   */\n  exportable: boolean;\n\n  /**\n   * When specified, this number of different single data entries will be displayed as separate\n   * options/bars/slices in the chart. The rest will be displayed as an aggregate \"other\" option/bar/slice.\n   */\n  mainDataNumberThreshold?: number;\n\n  /**\n   * If true remove zero values from the chart dataset\n   */\n  removeZeroValues?: boolean;\n\n  /**\n   * Chart data\n   */\n  data: ChartData;\n\n  /**\n   * Chart Labels\n   */\n  labels: string[];\n  canvasDataUrl?(): string;\n}\n","/**\n * @license\n * Copyright (C) Gnucoop soc. coop.\n *\n * This file is part of the Advanced JSON forms (ajf).\n *\n * Advanced JSON forms (ajf) is free software: you can redistribute it and/or\n * modify it under the terms of the GNU Affero General Public License as\n * published by the Free Software Foundation, either version 3 of the License,\n * or (at your option) any later version.\n *\n * Advanced JSON forms (ajf) is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero\n * General Public License for more details.\n *\n * You should have received a copy of the GNU Affero General Public License\n * along with Advanced JSON forms (ajf).\n * If not, see http://www.gnu.org/licenses/.\n *\n */\n\nimport {AjfColumnWidget} from '../widgets/column-widget';\nimport {AjfWidgetWithContentInstance} from './widget-with-content-instance';\n\nexport interface AjfColumnWidgetInstance extends AjfWidgetWithContentInstance {\n  widget: AjfColumnWidget;\n}\n","/**\n * @license\n * Copyright (C) Gnucoop soc. coop.\n *\n * This file is part of the Advanced JSON forms (ajf).\n *\n * Advanced JSON forms (ajf) is free software: you can redistribute it and/or\n * modify it under the terms of the GNU Affero General Public License as\n * published by the Free Software Foundation, either version 3 of the License,\n * or (at your option) any later version.\n *\n * Advanced JSON forms (ajf) is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero\n * General Public License for more details.\n *\n * You should have received a copy of the GNU Affero General Public License\n * along with Advanced JSON forms (ajf).\n * If not, see http://www.gnu.org/licenses/.\n *\n */\n\nimport {AjfDataWidget} from '../widgets/data-widget';\nimport {AjfBaseWidgetInstance} from './base-widget-instance';\n\nexport interface AjfDataWidgetInstance extends AjfBaseWidgetInstance {\n  widget: AjfDataWidget;\n  dataset: any;\n}\n","/**\n * @license\n * Copyright (C) Gnucoop soc. coop.\n *\n * This file is part of the Advanced JSON forms (ajf).\n *\n * Advanced JSON forms (ajf) is free software: you can redistribute it and/or\n * modify it under the terms of the GNU Affero General Public License as\n * published by the Free Software Foundation, either version 3 of the License,\n * or (at your option) any later version.\n *\n * Advanced JSON forms (ajf) is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero\n * General Public License for more details.\n *\n * You should have received a copy of the GNU Affero General Public License\n * along with Advanced JSON forms (ajf).\n * If not, see http://www.gnu.org/licenses/.\n *\n */\n\nimport {AjfDialogWidget} from '../widgets/dialog-widget';\nimport {AjfWidgetInstance} from './widget-instance';\nimport {AjfWidgetWithContentInstance} from './widget-with-content-instance';\n\nexport interface AjfDialogWidgetInstance extends AjfWidgetWithContentInstance {\n  widget: AjfDialogWidget;\n  toggle: AjfWidgetInstance;\n}\n","/**\n * @license\n * Copyright (C) Gnucoop soc. coop.\n *\n * This file is part of the Advanced JSON forms (ajf).\n *\n * Advanced JSON forms (ajf) is free software: you can redistribute it and/or\n * modify it under the terms of the GNU Affero General Public License as\n * published by the Free Software Foundation, either version 3 of the License,\n * or (at your option) any later version.\n *\n * Advanced JSON forms (ajf) is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero\n * General Public License for more details.\n *\n * You should have received a copy of the GNU Affero General Public License\n * along with Advanced JSON forms (ajf).\n * If not, see http://www.gnu.org/licenses/.\n *\n */\n\nimport {AjfForm} from '@ajf/core/forms';\nimport {AjfContext} from '@ajf/core/models';\n\nimport {AjfReportVariable} from '../reports/report-variable';\n\nexport interface AjfFilterInstance {\n  form: AjfForm;\n  variables: AjfReportVariable[];\n  context: AjfContext;\n}\n","/**\n * @license\n * Copyright (C) Gnucoop soc. coop.\n *\n * This file is part of the Advanced JSON forms (ajf).\n *\n * Advanced JSON forms (ajf) is free software: you can redistribute it and/or\n * modify it under the terms of the GNU Affero General Public License as\n * published by the Free Software Foundation, either version 3 of the License,\n * or (at your option) any later version.\n *\n * Advanced JSON forms (ajf) is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero\n * General Public License for more details.\n *\n * You should have received a copy of the GNU Affero General Public License\n * along with Advanced JSON forms (ajf).\n * If not, see http://www.gnu.org/licenses/.\n *\n */\n\nimport {AjfFormulaWidget} from '../widgets/formula-widget';\nimport {AjfBaseWidgetInstance} from './base-widget-instance';\n\nexport interface AjfFormulaWidgetInstance extends AjfBaseWidgetInstance {\n  widget: AjfFormulaWidget;\n  formula: string;\n}\n","/**\n * @license\n * Copyright (C) Gnucoop soc. coop.\n *\n * This file is part of the Advanced JSON forms (ajf).\n *\n * Advanced JSON forms (ajf) is free software: you can redistribute it and/or\n * modify it under the terms of the GNU Affero General Public License as\n * published by the Free Software Foundation, either version 3 of the License,\n * or (at your option) any later version.\n *\n * Advanced JSON forms (ajf) is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero\n * General Public License for more details.\n *\n * You should have received a copy of the GNU Affero General Public License\n * along with Advanced JSON forms (ajf).\n * If not, see http://www.gnu.org/licenses/.\n *\n */\n\nimport {AjfGraphNode} from '@ajf/core/graph';\nimport {AjfGraphWidget} from '../widgets/graph-widget';\nimport {AjfBaseWidgetInstance} from './base-widget-instance';\n\nexport interface AjfGraphWidgetInstance extends AjfBaseWidgetInstance {\n  widget: AjfGraphWidget;\n  nodes: AjfGraphNode[];\n}\n","/**\n * @license\n * Copyright (C) Gnucoop soc. coop.\n *\n * This file is part of the Advanced JSON forms (ajf).\n *\n * Advanced JSON forms (ajf) is free software: you can redistribute it and/or\n * modify it under the terms of the GNU Affero General Public License as\n * published by the Free Software Foundation, either version 3 of the License,\n * or (at your option) any later version.\n *\n * Advanced JSON forms (ajf) is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero\n * General Public License for more details.\n *\n * You should have received a copy of the GNU Affero General Public License\n * along with Advanced JSON forms (ajf).\n * If not, see http://www.gnu.org/licenses/.\n *\n */\n\nimport {AjfHeatMapFeatureCollection} from '@ajf/core/heat-map';\n\nimport {AjfHeatMapWidget} from '../widgets/heat-map-widget';\nimport {AjfBaseWidgetInstance} from './base-widget-instance';\n\nexport interface AjfHeatMapWidgetInstance extends AjfBaseWidgetInstance {\n  widget: AjfHeatMapWidget;\n  idProp: string;\n  features: AjfHeatMapFeatureCollection;\n  values: number[];\n  startColor: string;\n  endColor: string;\n  highlightColor: string;\n  showVisualMap: boolean;\n  action: string;\n}\n","/**\n * @license\n * Copyright (C) Gnucoop soc. coop.\n *\n * This file is part of the Advanced JSON forms (ajf).\n *\n * Advanced JSON forms (ajf) is free software: you can redistribute it and/or\n * modify it under the terms of the GNU Affero General Public License as\n * published by the Free Software Foundation, either version 3 of the License,\n * or (at your option) any later version.\n *\n * Advanced JSON forms (ajf) is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero\n * General Public License for more details.\n *\n * You should have received a copy of the GNU Affero General Public License\n * along with Advanced JSON forms (ajf).\n * If not, see http://www.gnu.org/licenses/.\n *\n */\n\nimport {AjfImageIcon} from '@ajf/core/image';\n\nimport {AjfImageContainerWidget} from '../widgets/image-container-widget';\nimport {AjfBaseWidgetInstance} from './base-widget-instance';\n\nexport interface AjfImageContainerWidgetInstance extends AjfBaseWidgetInstance {\n  widget: AjfImageContainerWidget;\n  icons: AjfImageIcon[];\n  flags: string[];\n  urls: string[];\n}\n","/**\n * @license\n * Copyright (C) Gnucoop soc. coop.\n *\n * This file is part of the Advanced JSON forms (ajf).\n *\n * Advanced JSON forms (ajf) is free software: you can redistribute it and/or\n * modify it under the terms of the GNU Affero General Public License as\n * published by the Free Software Foundation, either version 3 of the License,\n * or (at your option) any later version.\n *\n * Advanced JSON forms (ajf) is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero\n * General Public License for more details.\n *\n * You should have received a copy of the GNU Affero General Public License\n * along with Advanced JSON forms (ajf).\n * If not, see http://www.gnu.org/licenses/.\n *\n */\n\nimport {AjfImageIcon} from '@ajf/core/image';\n\nimport {AjfImageWidget} from '../widgets/image-widget';\nimport {AjfBaseWidgetInstance} from './base-widget-instance';\n\nexport interface AjfImageWidgetInstance extends AjfBaseWidgetInstance {\n  widget: AjfImageWidget;\n  icon: AjfImageIcon;\n  flag: string;\n  url: string;\n}\n","/**\n * @license\n * Copyright (C) Gnucoop soc. coop.\n *\n * This file is part of the Advanced JSON forms (ajf).\n *\n * Advanced JSON forms (ajf) is free software: you can redistribute it and/or\n * modify it under the terms of the GNU Affero General Public License as\n * published by the Free Software Foundation, either version 3 of the License,\n * or (at your option) any later version.\n *\n * Advanced JSON forms (ajf) is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero\n * General Public License for more details.\n *\n * You should have received a copy of the GNU Affero General Public License\n * along with Advanced JSON forms (ajf).\n * If not, see http://www.gnu.org/licenses/.\n *\n */\n\nimport {AjfLayoutWidget} from '../widgets/layout-widget';\nimport {AjfWidgetWithContentInstance} from './widget-with-content-instance';\n\nexport interface AjfLayoutWidgetInstance extends AjfWidgetWithContentInstance {\n  widget: AjfLayoutWidget;\n}\n","/**\n * @license\n * Copyright (C) Gnucoop soc. coop.\n *\n * This file is part of the Advanced JSON forms (ajf).\n *\n * Advanced JSON forms (ajf) is free software: you can redistribute it and/or\n * modify it under the terms of the GNU Affero General Public License as\n * published by the Free Software Foundation, either version 3 of the License,\n * or (at your option) any later version.\n *\n * Advanced JSON forms (ajf) is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero\n * General Public License for more details.\n *\n * You should have received a copy of the GNU Affero General Public License\n * along with Advanced JSON forms (ajf).\n * If not, see http://www.gnu.org/licenses/.\n *\n */\n\nimport {AjfMapWidget} from '../widgets/map-widget';\nimport {AjfBaseWidgetInstance} from './base-widget-instance';\n\nexport interface AjfMapWidgetInstance extends AjfBaseWidgetInstance {\n  widget: AjfMapWidget;\n  coordinate: number[];\n}\n","/**\n * @license\n * Copyright (C) Gnucoop soc. coop.\n *\n * This file is part of the Advanced JSON forms (ajf).\n *\n * Advanced JSON forms (ajf) is free software: you can redistribute it and/or\n * modify it under the terms of the GNU Affero General Public License as\n * published by the Free Software Foundation, either version 3 of the License,\n * or (at your option) any later version.\n *\n * Advanced JSON forms (ajf) is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero\n * General Public License for more details.\n *\n * You should have received a copy of the GNU Affero General Public License\n * along with Advanced JSON forms (ajf).\n * If not, see http://www.gnu.org/licenses/.\n *\n */\n\nimport {AjfPageBreakWidget} from '../widgets/page-break-widget';\nimport {AjfBaseWidgetInstance} from './base-widget-instance';\n\nexport interface AjfPageBreakWidgetInstance extends AjfBaseWidgetInstance {\n  widget: AjfPageBreakWidget;\n}\n","/**\n * @license\n * Copyright (C) Gnucoop soc. coop.\n *\n * This file is part of the Advanced JSON forms (ajf).\n *\n * Advanced JSON forms (ajf) is free software: you can redistribute it and/or\n * modify it under the terms of the GNU Affero General Public License as\n * published by the Free Software Foundation, either version 3 of the License,\n * or (at your option) any later version.\n *\n * Advanced JSON forms (ajf) is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero\n * General Public License for more details.\n *\n * You should have received a copy of the GNU Affero General Public License\n * along with Advanced JSON forms (ajf).\n * If not, see http://www.gnu.org/licenses/.\n *\n */\n\nimport {AjfPaginatedListWidget} from '../widgets/paginated-list-widget';\nimport {AjfWidgetWithContentInstance} from './widget-with-content-instance';\n\nexport interface AjfPaginatedListWidgetInstance extends AjfWidgetWithContentInstance {\n  widget: AjfPaginatedListWidget;\n}\n","/**\n * @license\n * Copyright (C) Gnucoop soc. coop.\n *\n * This file is part of the Advanced JSON forms (ajf).\n *\n * Advanced JSON forms (ajf) is free software: you can redistribute it and/or\n * modify it under the terms of the GNU Affero General Public License as\n * published by the Free Software Foundation, either version 3 of the License,\n * or (at your option) any later version.\n *\n * Advanced JSON forms (ajf) is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero\n * General Public License for more details.\n *\n * You should have received a copy of the GNU Affero General Public License\n * along with Advanced JSON forms (ajf).\n * If not, see http://www.gnu.org/licenses/.\n *\n */\n\nimport {AjfTableCell} from '@ajf/core/table';\nimport {AjfPaginatedTableWidget} from '../widgets/paginated-table-widget';\nimport {AjfDataWidgetInstance} from './data-widget-instance';\n\nexport interface AjfPaginatedTableWidgetInstance extends AjfDataWidgetInstance {\n  widget: AjfPaginatedTableWidget;\n  exportable: boolean;\n  data: AjfTableCell[][];\n}\n","/**\n * @license\n * Copyright (C) Gnucoop soc. coop.\n *\n * This file is part of the Advanced JSON forms (ajf).\n *\n * Advanced JSON forms (ajf) is free software: you can redistribute it and/or\n * modify it under the terms of the GNU Affero General Public License as\n * published by the Free Software Foundation, either version 3 of the License,\n * or (at your option) any later version.\n *\n * Advanced JSON forms (ajf) is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero\n * General Public License for more details.\n *\n * You should have received a copy of the GNU Affero General Public License\n * along with Advanced JSON forms (ajf).\n * If not, see http://www.gnu.org/licenses/.\n *\n */\n\nimport {AjfTableCell} from '@ajf/core/table';\nimport {Subject} from 'rxjs';\n\nimport {AjfTableWidget} from '../widgets/table-widget';\nimport {AjfDataWidgetInstance} from './data-widget-instance';\n\nexport interface AjfTableWidgetInstance extends AjfDataWidgetInstance {\n  widget: AjfTableWidget;\n  data: AjfTableCell[][];\n  recalcEvt: Subject<boolean>;\n  exportable: boolean;\n}\n","/**\n * @license\n * Copyright (C) Gnucoop soc. coop.\n *\n * This file is part of the Advanced JSON forms (ajf).\n *\n * Advanced JSON forms (ajf) is free software: you can redistribute it and/or\n * modify it under the terms of the GNU Affero General Public License as\n * published by the Free Software Foundation, either version 3 of the License,\n * or (at your option) any later version.\n *\n * Advanced JSON forms (ajf) is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero\n * General Public License for more details.\n *\n * You should have received a copy of the GNU Affero General Public License\n * along with Advanced JSON forms (ajf).\n * If not, see http://www.gnu.org/licenses/.\n *\n */\n\nimport {AjfTextWidget} from '../widgets/text-widget';\nimport {AjfBaseWidgetInstance} from './base-widget-instance';\n\nexport interface AjfTextWidgetInstance extends AjfBaseWidgetInstance {\n  widget: AjfTextWidget;\n  htmlText: string;\n}\n","/**\n * @license\n * Copyright (C) Gnucoop soc. coop.\n *\n * This file is part of the Advanced JSON forms (ajf).\n *\n * Advanced JSON forms (ajf) is free software: you can redistribute it and/or\n * modify it under the terms of the GNU Affero General Public License as\n * published by the Free Software Foundation, either version 3 of the License,\n * or (at your option) any later version.\n *\n * Advanced JSON forms (ajf) is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero\n * General Public License for more details.\n *\n * You should have received a copy of the GNU Affero General Public License\n * along with Advanced JSON forms (ajf).\n * If not, see http://www.gnu.org/licenses/.\n *\n */\n\nimport {AjfUnknownWidget} from '../widgets/widget';\nimport {AjfBaseWidgetInstance} from './base-widget-instance';\nimport {AjfChartWidgetInstance} from './chart-widget-instance';\nimport {AjfColumnWidgetInstance} from './column-widget-instance';\nimport {AjfDataWidgetInstance} from './data-widget-instance';\nimport {AjfDialogWidgetInstance} from './dialog-widget-instance';\nimport {AjfDynamicTableWidgetInstance} from './dynamic-table-widget-instance';\nimport {AjfFormulaWidgetInstance} from './formula-widget-instance';\nimport {AjfGraphWidgetInstance} from './graph-widget-instance';\nimport {AjfHeatMapWidgetInstance} from './heat-map-widget-instance';\nimport {AjfImageContainerWidgetInstance} from './image-container-widget-instance';\nimport {AjfImageWidgetInstance} from './image-widget-instance';\nimport {AjfLayoutWidgetInstance} from './layout-widget-instance';\nimport {AjfMapWidgetInstance} from './map-widget-instance';\nimport {AjfPageBreakWidgetInstance} from './page-break-widget-instance';\nimport {AjfPaginatedListWidgetInstance} from './paginated-list-widget-instance';\nimport {AjfTableWidgetInstance} from './table-widget-instance';\nimport {AjfTextWidgetInstance} from './text-widget-instance';\nimport {AjfWidgetWithContentInstance} from './widget-with-content-instance';\nimport {AjfPaginatedTableWidgetInstance} from './paginated-table-widget-instance';\n\nexport interface AjfUnknownWidgetInstance extends AjfBaseWidgetInstance {\n  widget: AjfUnknownWidget;\n}\n\nexport type AjfWidgetInstance =\n  | AjfChartWidgetInstance\n  | AjfColumnWidgetInstance\n  | AjfDataWidgetInstance\n  | AjfDialogWidgetInstance\n  | AjfDynamicTableWidgetInstance\n  | AjfFormulaWidgetInstance\n  | AjfGraphWidgetInstance\n  | AjfHeatMapWidgetInstance\n  | AjfImageContainerWidgetInstance\n  | AjfImageWidgetInstance\n  | AjfLayoutWidgetInstance\n  | AjfMapWidgetInstance\n  | AjfPageBreakWidgetInstance\n  | AjfPaginatedListWidgetInstance\n  | AjfTableWidgetInstance\n  | AjfTextWidgetInstance\n  | AjfWidgetWithContentInstance\n  | AjfPaginatedTableWidgetInstance;\n","/**\n * @license\n * Copyright (C) Gnucoop soc. coop.\n *\n * This file is part of the Advanced JSON forms (ajf).\n *\n * Advanced JSON forms (ajf) is free software: you can redistribute it and/or\n * modify it under the terms of the GNU Affero General Public License as\n * published by the Free Software Foundation, either version 3 of the License,\n * or (at your option) any later version.\n *\n * Advanced JSON forms (ajf) is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero\n * General Public License for more details.\n *\n * You should have received a copy of the GNU Affero General Public License\n * along with Advanced JSON forms (ajf).\n * If not, see http://www.gnu.org/licenses/.\n *\n */\n\nimport {AjfBaseWidgetInstance} from './base-widget-instance';\nimport {AjfWidgetInstance} from './widget-instance';\n\nexport interface AjfWidgetWithContentInstance extends AjfBaseWidgetInstance {\n  content: AjfWidgetInstance[];\n}\n","/**\n * @license\n * Copyright (C) Gnucoop soc. coop.\n *\n * This file is part of the Advanced JSON forms (ajf).\n *\n * Advanced JSON forms (ajf) is free software: you can redistribute it and/or\n * modify it under the terms of the GNU Affero General Public License as\n * published by the Free Software Foundation, either version 3 of the License,\n * or (at your option) any later version.\n *\n * Advanced JSON forms (ajf) is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero\n * General Public License for more details.\n *\n * You should have received a copy of the GNU Affero General Public License\n * along with Advanced JSON forms (ajf).\n * If not, see http://www.gnu.org/licenses/.\n *\n */\n\nimport {AfterViewInit, ChangeDetectorRef, Directive, Input} from '@angular/core';\n\nimport {AjfReportInstance} from './interface/reports-instances/report-instance';\nimport {AjfReport} from './interface/reports/report';\n\n@Directive()\nexport abstract class AjfReportRenderer implements AfterViewInit {\n  private _instance: AjfReportInstance | undefined;\n  get instance(): AjfReportInstance | undefined {\n    return this._instance;\n  }\n  @Input()\n  set instance(instance: AjfReportInstance | undefined) {\n    this._instance = instance;\n    this._report = instance != null ? instance.report : null;\n    this._cdr.markForCheck();\n  }\n\n  @Input() enableExportAll: boolean = false;\n\n  private _report: AjfReport | null = null;\n  get report(): AjfReport | null {\n    return this._report;\n  }\n\n  private _enableExport: boolean = true;\n  get enableExport(): boolean {\n    return this._enableExport;\n  }\n\n  constructor(private _cdr: ChangeDetectorRef) {}\n\n  ngAfterViewInit(): void {\n    this._enableExport =\n      this.enableExportAll &&\n      this._instance != null &&\n      this._instance.content &&\n      this._instance.content.content\n        ? true\n        : false;\n    this._cdr.markForCheck();\n  }\n}\n","/**\n * @license\n * Copyright (C) Gnucoop soc. coop.\n *\n * This file is part of the Advanced JSON forms (ajf).\n *\n * Advanced JSON forms (ajf) is free software: you can redistribute it and/or\n * modify it under the terms of the GNU Affero General Public License as\n * published by the Free Software Foundation, either version 3 of the License,\n * or (at your option) any later version.\n *\n * Advanced JSON forms (ajf) is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero\n * General Public License for more details.\n *\n * You should have received a copy of the GNU Affero General Public License\n * along with Advanced JSON forms (ajf).\n * If not, see http://www.gnu.org/licenses/.\n *\n */\n\nimport {AjfContext, buildStringIdentifier, BuildStringIdentifierOpts} from '@ajf/core/common';\n\nimport {AjfReport} from '../../interface/reports/report';\n\nexport const buildReportStringIdentifier = (\n  report: AjfReport,\n  context: AjfContext,\n  opts?: BuildStringIdentifierOpts,\n): string => {\n  if (report == null) {\n    return '';\n  }\n  const stringIdentifier = report.stringIdentifier || [];\n  if (stringIdentifier.length === 0) {\n    return '';\n  }\n  return buildStringIdentifier(stringIdentifier, context, opts);\n};\n","/**\n * @license\n * Copyright (C) Gnucoop soc. coop.\n *\n * This file is part of the Advanced JSON forms (ajf).\n *\n * Advanced JSON forms (ajf) is free software: you can redistribute it and/or\n * modify it under the terms of the GNU Affero General Public License as\n * published by the Free Software Foundation, either version 3 of the License,\n * or (at your option) any later version.\n *\n * Advanced JSON forms (ajf) is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero\n * General Public License for more details.\n *\n * You should have received a copy of the GNU Affero General Public License\n * along with Advanced JSON forms (ajf).\n * If not, see http://www.gnu.org/licenses/.\n *\n */\n\nimport {AjfContext, BuildStringIdentifierOpts} from '@ajf/core/common';\nimport {Pipe, PipeTransform} from '@angular/core';\n\nimport {AjfReport} from './interface/reports/report';\nimport {buildReportStringIdentifier} from './utils/reports/build-report-string-identifier';\n\n@Pipe({name: 'ajfReportStringIdentifier'})\nexport class AjfReportStringIdentifierPipe implements PipeTransform {\n  transform(report: AjfReport, context: AjfContext, opts?: BuildStringIdentifierOpts): string {\n    return buildReportStringIdentifier(report, context, opts);\n  }\n}\n","/**\n * @license\n * Copyright (C) Gnucoop soc. coop.\n *\n * This file is part of the Advanced JSON forms (ajf).\n *\n * Advanced JSON forms (ajf) is free software: you can redistribute it and/or\n * modify it under the terms of the GNU Affero General Public License as\n * published by the Free Software Foundation, either version 3 of the License,\n * or (at your option) any later version.\n *\n * Advanced JSON forms (ajf) is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero\n * General Public License for more details.\n *\n * You should have received a copy of the GNU Affero General Public License\n * along with Advanced JSON forms (ajf).\n * If not, see http://www.gnu.org/licenses/.\n *\n */\n\nimport {AjfTableCell} from '@ajf/core/table';\nimport {ChangeDetectionStrategy, Component, Input, ViewEncapsulation} from '@angular/core';\nimport {ChartData} from 'chart.js';\nimport {format} from 'date-fns';\nimport {utils, WorkBook, WorkSheet, writeFile} from 'xlsx';\nimport {AjfReportInstance} from './interface/reports-instances/report-instance';\nimport {AjfChartWidgetInstance} from './interface/widgets-instances/chart-widget-instance';\nimport {AjfColumnWidgetInstance} from './interface/widgets-instances/column-widget-instance';\nimport {AjfLayoutWidgetInstance} from './interface/widgets-instances/layout-widget-instance';\nimport {AjfTableWidgetInstance} from './interface/widgets-instances/table-widget-instance';\nimport {AjfTextWidgetInstance} from './interface/widgets-instances/text-widget-instance';\nimport {AjfWidgetInstance} from './interface/widgets-instances/widget-instance';\n\nimport {AjfWidgetType} from './interface/widgets/widget-type';\n\n/**\n * Export all widgets data in Xlsx format, one per sheet\n * @param report the ajf report instance\n * @param iconsMap\n */\nexport function exportReportXlsx(\n  report: AjfReportInstance,\n  iconsMap: {[html: string]: string} | undefined,\n): boolean {\n  iconsMap = iconsMap ? iconsMap : {};\n  const widgetInstances = report && report.content ? report.content.content : undefined;\n  return exportAllWidgets(widgetInstances, iconsMap);\n}\n\n/**\n * Checks if p is a {x, y, r?} point and eventually formats it as string.\n */\nfunction formatPointData(p: any): any {\n  if (typeof p === 'object' && p !== null && p.x !== undefined && p.y !== undefined) {\n    if (p.r === undefined) {\n      return `(${p.x}, ${p.y})`;\n    }\n    return `(${p.x}, ${p.y}, ${p.r})`;\n  }\n  return p;\n}\n\n/**\n * Build xlsx data for export\n * @param widgetType\n * @param data\n * @param iconsMap\n */\nfunction buildXlsxData(\n  widgetType: AjfWidgetType | undefined,\n  data: ChartData | AjfTableCell[][] | undefined,\n  iconsMap: {[html: string]: string},\n): unknown[][] {\n  let xlsxData: unknown[][] = [];\n  let labels: string[] = [];\n  switch (widgetType) {\n    default:\n    case AjfWidgetType.Chart:\n      data = data as ChartData;\n      const datasets = data.datasets || [];\n      labels = ['name'].concat(data.labels as string[]);\n      xlsxData.push(labels);\n      for (let i = 0; i < datasets.length; i++) {\n        const row: unknown[] = [];\n        const data = datasets[i].data || [];\n        row.push(datasets[i].label);\n        for (let j = 0; j < data.length; j++) {\n          row.push(formatPointData(data[j]));\n        }\n        xlsxData.push(row);\n      }\n      break;\n    case AjfWidgetType.DynamicTable:\n    case AjfWidgetType.Table:\n    case AjfWidgetType.PaginatedTable:\n      const tableData = data as AjfTableCell[][];\n      if (tableData.length > 1) {\n        xlsxData = [];\n        const nextRows: unknown[][] = [];\n        let nextRow: unknown[] = [];\n        let totRowSpan = 0;\n        let nextRowspanNum = 0;\n\n        for (let i = 0; i < tableData.length; i++) {\n          let isNewRowAfterRowspan = false;\n          let res: unknown[] = [];\n\n          nextRow = [];\n          if (totRowSpan > 0) {\n            res = [...nextRows[nextRowspanNum - 1]];\n            isNewRowAfterRowspan = true;\n          }\n          tableData[i].forEach((elem: AjfTableCell, idxElem: number) => {\n            let val = elem.value?.changingThisBreaksApplicationSecurity;\n            if (val === undefined) {\n              if (Array.isArray(elem.value)) {\n                val = String(elem.value);\n              } else {\n                val = elem.value;\n              }\n            }\n            if (val != null && iconsMap[val]) {\n              val = iconsMap[val];\n            }\n            res.push(val);\n\n            if (elem.colspan && elem.colspan > 1) {\n              for (let j = 1; j < elem.colspan; j++) {\n                res.push(' ');\n              }\n            }\n            if (isNewRowAfterRowspan) {\n              if (elem.rowspan && elem.rowspan > 1) {\n                for (let idx = 1; idx < elem.rowspan; idx++) {\n                  nextRow.push(' ');\n                  nextRows[nextRowspanNum] = nextRows[nextRowspanNum].concat(nextRow);\n                }\n              }\n              if (idxElem === tableData[i].length - 1 && nextRowspanNum > 0) {\n                nextRowspanNum++;\n                if (nextRowspanNum === totRowSpan) {\n                  totRowSpan = 0;\n                  nextRowspanNum = 0;\n                }\n              }\n            } else {\n              if (elem.rowspan && elem.rowspan > 1) {\n                totRowSpan = elem.rowspan;\n                nextRowspanNum = 1;\n                for (let idx = 1; idx < elem.rowspan; idx++) {\n                  nextRow.push(' ');\n                  nextRows[idx - 1] = nextRow;\n                }\n              }\n            }\n          });\n          xlsxData.push(res);\n        }\n      }\n      break;\n  }\n\n  return xlsxData;\n}\n\nfunction addExportableWidgetsToSheets(\n  widget: AjfWidgetInstance,\n  iconsMap: {[html: string]: string},\n  sheets: {[sheet: string]: WorkSheet},\n): void {\n  const idx = Object.keys(sheets).length;\n  const sheetName = `${idx}_${AjfWidgetType[widget.widgetType]}`;\n  switch (widget.widget.widgetType) {\n    case AjfWidgetType.Layout:\n      const lw = widget as AjfLayoutWidgetInstance;\n      lw.content.map(w => addExportableWidgetsToSheets(w, iconsMap, sheets));\n      break;\n    case AjfWidgetType.Column:\n      const cw = widget as AjfColumnWidgetInstance;\n      cw.content.map(w => addExportableWidgetsToSheets(w, iconsMap, sheets));\n      break;\n    case AjfWidgetType.Chart:\n      const chartInstance = widget as AjfChartWidgetInstance;\n      sheets[sheetName] = utils.aoa_to_sheet(\n        buildXlsxData(chartInstance.widgetType, chartInstance.data, iconsMap),\n      );\n      break;\n    case AjfWidgetType.Text:\n      const tw = widget as AjfTextWidgetInstance;\n      sheets[sheetName] = utils.aoa_to_sheet([[tw.htmlText]]);\n      break;\n    case AjfWidgetType.Table:\n    case AjfWidgetType.DynamicTable:\n    case AjfWidgetType.PaginatedTable:\n      const tableInstance = widget as AjfTableWidgetInstance;\n      sheets[sheetName] = utils.aoa_to_sheet(\n        buildXlsxData(tableInstance.widgetType, tableInstance.data, iconsMap),\n      );\n      break;\n  }\n}\n\n/**\n * Export all exportable widgets in Xlsx format, one per sheet\n */\nfunction exportAllWidgets(\n  widgets: AjfWidgetInstance[] | undefined,\n  iconsMap: {[html: string]: string},\n): boolean {\n  const bookType = 'xlsx';\n  const sheets: {[sheet: string]: WorkSheet} = {};\n  let fileName = `AllWidgets_${format(new Date(), `yyyy-MM-dd`)}`;\n  if (widgets && widgets.length) {\n    widgets.forEach(instance => {\n      addExportableWidgetsToSheets(instance, iconsMap, sheets);\n    });\n  }\n  if (Object.keys(sheets).length) {\n    const workBook: WorkBook = {Sheets: sheets, SheetNames: Object.keys(sheets)};\n    writeFile(workBook, `${fileName}.${bookType}`, {\n      bookType,\n      type: 'array',\n    });\n    return true;\n  }\n  return false;\n}\n\n@Component({\n  selector: 'ajf-widget-export',\n  templateUrl: 'widget-export.html',\n  styleUrls: ['widget-export.scss'],\n  encapsulation: ViewEncapsulation.None,\n  changeDetection: ChangeDetectionStrategy.OnPush,\n})\nexport class AjfWidgetExport {\n  @Input() widgetType: AjfWidgetType | undefined;\n  @Input() data: ChartData | AjfTableCell[][] | undefined;\n  @Input() widgets: AjfWidgetInstance[] | undefined;\n  @Input() overlay = true;\n  @Input() enable = false;\n\n  showOverlay = false;\n\n  private static _iconsMap: {[html: string]: string} = {};\n\n  /**\n   * Allows rendering html icons as text.\n   */\n  static addIcons(icons: {[html: string]: string}) {\n    AjfWidgetExport._iconsMap = {...AjfWidgetExport._iconsMap, ...icons};\n  }\n\n  constructor() {}\n\n  /**\n   * Export widget data in CSV format\n   * @deprecated Use `AjfWidgetExport.export` with 'csv' parameter.\n   * @breaking-change 13.0.0\n   */\n  exportCsv(): void {\n    this.export('csv');\n  }\n\n  /**\n   * Export widget data in Xlsx format\n   * @deprecated Use `AjfWidgetExport.export` with 'xlsx' parameter.\n   * @breaking-change 13.0.0\n   */\n  exportXlsx(): void {\n    this.export('xlsx');\n  }\n\n  /**\n   * Export all widgets data in Xlsx format, one per sheet\n   */\n  exportAll(): void {\n    exportAllWidgets(this.widgets, AjfWidgetExport._iconsMap);\n  }\n\n  /**\n   * Export widget data in CSV or Xlsx format\n   */\n  export(bookType: 'csv' | 'xlsx'): void {\n    if (this.widgetType == null) {\n      return;\n    }\n    const sheetName = this._buildTitle(this.widgetType);\n    const sheets: {[sheet: string]: WorkSheet} = {};\n    sheets[sheetName] = utils.aoa_to_sheet(\n      buildXlsxData(this.widgetType, this.data, AjfWidgetExport._iconsMap),\n    );\n    const workBook: WorkBook = {Sheets: sheets, SheetNames: [sheetName]};\n    writeFile(workBook, `${sheetName}.${bookType}`, {\n      bookType,\n      type: 'array',\n    });\n  }\n\n  private _buildTitle(widgetType: AjfWidgetType): string {\n    return `${AjfWidgetType[widgetType]} ${format(new Date(), `yyyy-MM-dd`)}`;\n  }\n}\n","<div class=\"ajf-widget-wrapper\" (mouseenter)=\"showOverlay = true\" (mouseleave)=\"showOverlay = false\"\n  [class.ajf-show-overlay]=\"showOverlay\">\n  <ng-content></ng-content>\n  <ng-container *ngIf=\"enable\">\n    <div *ngIf=\"widgets; else single\" class=\"ajf-export-all\">\n      <button (click)=\"exportAll()\">EXPORT XLSX</button>\n    </div>\n    <ng-template #single>\n      <div *ngIf=\"!widgets; else single\" class=\"ajf-export-menu\"\n        [class.ajf-export-menu-overlay]=\"overlay\">\n        <button (click)=\"export('csv')\">CSV</button>\n        <button (click)=\"export('xlsx')\">XLSX</button>\n      </div>\n    </ng-template>\n  </ng-container>\n</div>","/**\n * @license\n * Copyright (C) Gnucoop soc. coop.\n *\n * This file is part of the Advanced JSON forms (ajf).\n *\n * Advanced JSON forms (ajf) is free software: you can redistribute it and/or\n * modify it under the terms of the GNU Affero General Public License as\n * published by the Free Software Foundation, either version 3 of the License,\n * or (at your option) any later version.\n *\n * Advanced JSON forms (ajf) is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero\n * General Public License for more details.\n *\n * You should have received a copy of the GNU Affero General Public License\n * along with Advanced JSON forms (ajf).\n * If not, see http://www.gnu.org/licenses/.\n *\n */\n\nimport {Directive, ViewContainerRef} from '@angular/core';\n\n// eslint-disable-next-line\n@Directive({selector: '[ajf-widget-host]'})\nexport class AjfWidgetHost {\n  constructor(readonly viewContainerRef: ViewContainerRef) {}\n}\n","/**\n * @license\n * Copyright (C) Gnucoop soc. coop.\n *\n * This file is part of the Advanced JSON forms (ajf).\n *\n * Advanced JSON forms (ajf) is free software: you can redistribute it and/or\n * modify it under the terms of the GNU Affero General Public License as\n * published by the Free Software Foundation, either version 3 of the License,\n * or (at your option) any later version.\n *\n * Advanced JSON forms (ajf) is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero\n * General Public License for more details.\n *\n * You should have received a copy of the GNU Affero General Public License\n * along with Advanced JSON forms (ajf).\n * If not, see http://www.gnu.org/licenses/.\n *\n */\n\nimport {CommonModule} from '@angular/common';\nimport {NgModule} from '@angular/core';\n\nimport {AjfGetColumnContentPipe} from './get-column-content';\nimport {AjfReportStringIdentifierPipe} from './report-string-identifier';\nimport {AjfWidgetExport} from './widget-export';\nimport {AjfWidgetHost} from './widget-host';\n\n@NgModule({\n  declarations: [\n    AjfGetColumnContentPipe,\n    AjfReportStringIdentifierPipe,\n    AjfWidgetHost,\n    AjfWidgetExport,\n  ],\n  imports: [CommonModule],\n  exports: [AjfGetColumnContentPipe, AjfReportStringIdentifierPipe, AjfWidgetHost, AjfWidgetExport],\n})\nexport class AjfReportsModule {}\n","/**\n * @license\n * Copyright (C) Gnucoop soc. coop.\n *\n * This file is part of the Advanced JSON forms (ajf).\n *\n * Advanced JSON forms (ajf) is free software: you can redistribute it and/or\n * modify it under the terms of the GNU Affero General Public License as\n * published by the Free Software Foundation, either version 3 of the License,\n * or (at your option) any later version.\n *\n * Advanced JSON forms (ajf) is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero\n * General Public License for more details.\n *\n * You should have received a copy of the GNU Affero General Public License\n * along with Advanced JSON forms (ajf).\n * If not, see http://www.gnu.org/licenses/.\n *\n */\n\nimport {AjfAggregation} from '../../interface/aggregation/aggregation';\nimport {AjfAggregationType} from '../../interface/aggregation/aggregation-type';\n\nexport type AjfAggregationCreate = Partial<AjfAggregation>;\n\nexport function createAggregation(aggregation: AjfAggregationCreate): AjfAggregation {\n  return {\n    ...aggregation,\n    aggregation: aggregation.aggregation || AjfAggregationType.None,\n  };\n}\n","/**\n * @license\n * Copyright (C) Gnucoop soc. coop.\n *\n * This file is part of the Advanced JSON forms (ajf).\n *\n * Advanced JSON forms (ajf) is free software: you can redistribute it and/or\n * modify it under the terms of the GNU Affero General Public License as\n * published by the Free Software Foundation, either version 3 of the License,\n * or (at your option) any later version.\n *\n * Advanced JSON forms (ajf) is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero\n * General Public License for more details.\n *\n * You should have received a copy of the GNU Affero General Public License\n * along with Advanced JSON forms (ajf).\n * If not, see http://www.gnu.org/licenses/.\n *\n */\n\nimport {AjfAggregation} from '../interface/aggregation/aggregation';\nimport {createAggregation} from '../utils/aggregation/create-aggregation';\n\nexport class AjfAggregationSerializer {\n  static fromJson(json: Partial<AjfAggregation>): AjfAggregation {\n    if (json.aggregation == null) {\n      throw new Error('Malformed aggregation');\n    }\n    return createAggregation({...json, aggregation: json.aggregation});\n  }\n}\n","/**\n * @license\n * Copyright (C) Gnucoop soc. coop.\n *\n * This file is part of the Advanced JSON forms (ajf).\n *\n * Advanced JSON forms (ajf) is free software: you can redistribute it and/or\n * modify it under the terms of the GNU Affero General Public License as\n * published by the Free Software Foundation, either version 3 of the License,\n * or (at your option) any later version.\n *\n * Advanced JSON forms (ajf) is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero\n * General Public License for more details.\n *\n * You should have received a copy of the GNU Affero General Public License\n * along with Advanced JSON forms (ajf).\n * If not, see http://www.gnu.org/licenses/.\n *\n */\n\nimport {AjfAggregationType} from '../../interface/aggregation/aggregation-type';\nimport {AjfDataset} from '../../interface/dataset/dataset';\nimport {createAggregation} from '../aggregation/create-aggregation';\n\nexport function createDataset(dataset: Partial<AjfDataset>): AjfDataset {\n  return {\n    ...dataset,\n    aggregation: dataset.aggregation || createAggregation({aggregation: AjfAggregationType.None}),\n  };\n}\n","/**\n * @license\n * Copyright (C) Gnucoop soc. coop.\n *\n * This file is part of the Advanced JSON forms (ajf).\n *\n * Advanced JSON forms (ajf) is free software: you can redistribute it and/or\n * modify it under the terms of the GNU Affero General Public License as\n * published by the Free Software Foundation, either version 3 of the License,\n * or (at your option) any later version.\n *\n * Advanced JSON forms (ajf) is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero\n * General Public License for more details.\n *\n * You should have received a copy of the GNU Affero General Public License\n * along with Advanced JSON forms (ajf).\n * If not, see http://www.gnu.org/licenses/.\n *\n */\n\nimport {AjfFormulaSerializer} from '@ajf/core/models';\n\nimport {AjfDataset} from '../interface/dataset/dataset';\nimport {createDataset} from '../utils/dataset/create-dataset';\n\nimport {AjfAggregationSerializer} from './aggregation-serializer';\n\nexport class AjfDatasetSerializer {\n  static fromJson(json: Partial<AjfDataset>): AjfDataset {\n    if (json.formula == null || json.aggregation == null || json.label == null) {\n      throw new Error('Malformed dataset');\n    }\n    json.formula =\n      json.formula instanceof Array\n        ? (json.formula = json.formula.map(f => AjfFormulaSerializer.fromJson(f)))\n        : AjfFormulaSerializer.fromJson(json.formula);\n    json.aggregation = AjfAggregationSerializer.fromJson(json.aggregation);\n    return createDataset(json);\n  }\n}\n","/**\n * @license\n * Copyright (C) Gnucoop soc. coop.\n *\n * This file is part of the Advanced JSON forms (ajf).\n *\n * Advanced JSON forms (ajf) is free software: you can redistribute it and/or\n * modify it under the terms of the GNU Affero General Public License as\n * published by the Free Software Foundation, either version 3 of the License,\n * or (at your option) any later version.\n *\n * Advanced JSON forms (ajf) is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero\n * General Public License for more details.\n *\n * You should have received a copy of the GNU Affero General Public License\n * along with Advanced JSON forms (ajf).\n * If not, see http://www.gnu.org/licenses/.\n *\n */\n\nimport {alwaysCondition} from '@ajf/core/models';\nimport {AjfWidget} from '../../interface/widgets/widget';\n\nexport type AjfWidgetCreate = Pick<AjfWidget, 'widgetType'> & Partial<AjfWidget>;\n\nexport function createWidget(widget: AjfWidgetCreate): AjfWidget {\n  return {\n    ...widget,\n    styles: widget.styles || {},\n    visibility: widget.visibility || alwaysCondition(),\n  } as AjfWidget;\n}\n","/**\n * @license\n * Copyright (C) Gnucoop soc. coop.\n *\n * This file is part of the Advanced JSON forms (ajf).\n *\n * Advanced JSON forms (ajf) is free software: you can redistribute it and/or\n * modify it under the terms of the GNU Affero General Public License as\n * published by the Free Software Foundation, either version 3 of the License,\n * or (at your option) any later version.\n *\n * Advanced JSON forms (ajf) is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero\n * General Public License for more details.\n *\n * You should have received a copy of the GNU Affero General Public License\n * along with Advanced JSON forms (ajf).\n * If not, see http://www.gnu.org/licenses/.\n *\n */\n\nimport {AjfConditionSerializer, AjfFormulaSerializer, alwaysCondition} from '@ajf/core/models';\n\nimport {AjfChartDataset} from '../interface/dataset/chart-dataset';\nimport {AjfDataset} from '../interface/dataset/dataset';\nimport {AjfTableDataset} from '../interface/dataset/table-dataset';\nimport {AjfChartWidget} from '../interface/widgets/chart-widget';\nimport {AjfDataWidget} from '../interface/widgets/data-widget';\nimport {AjfMapWidget} from '../interface/widgets/map-widget';\nimport {AjfWidget} from '../interface/widgets/widget';\nimport {AjfWidgetType} from '../interface/widgets/widget-type';\nimport {AjfWidgetWithContent} from '../interface/widgets/widget-with-content';\nimport {createWidget} from '../utils/widgets/create-widget';\n\nimport {AjfDatasetSerializer} from './dataset-serializer';\n\nexport class AjfWidgetSerializer {\n  static fromJson(json: Partial<AjfWidget>): AjfWidget {\n    if (json.widgetType == null) {\n      throw new Error('Malformed widget');\n    }\n    json.visibility = json.visibility\n      ? AjfConditionSerializer.fromJson(json.visibility)\n      : alwaysCondition();\n    json.styles = json.styles || {};\n    const obj = json as AjfWidget;\n    if (obj.widgetType === AjfWidgetType.Layout || obj.widgetType === AjfWidgetType.Column) {\n      return AjfWidgetSerializer._widgetWithContentFromJson(obj);\n    }\n    if (obj.widgetType === AjfWidgetType.Chart || obj.widgetType === AjfWidgetType.Table) {\n      const w = AjfWidgetSerializer._dataWidgetFromJson(obj);\n      if (obj.widgetType === AjfWidgetType.Chart) {\n        const cw = w as AjfChartWidget;\n        if (cw.labels instanceof Array) {\n          cw.labels.map(l => AjfFormulaSerializer.fromJson(l));\n        } else if (cw.labels != null) {\n          cw.labels = AjfFormulaSerializer.fromJson(cw.labels);\n        }\n      }\n      return w;\n    }\n    if (obj.widgetType === AjfWidgetType.Map) {\n      const mw = obj as AjfMapWidget;\n      mw.coordinate = AjfFormulaSerializer.fromJson(mw.coordinate);\n    }\n    return obj;\n  }\n\n  private static _dataWidgetFromJson(json: AjfWidget & Partial<AjfDataWidget>): AjfDataWidget {\n    let dataset: AjfDataset[] | AjfDataset[][];\n    if (json.dataset == null) {\n      dataset = [];\n    } else {\n      if (json.widgetType === AjfWidgetType.Table) {\n        dataset = (json.dataset as AjfTableDataset[][]).map(row =>\n          row.map(cell => AjfDatasetSerializer.fromJson(cell)),\n        );\n      } else {\n        dataset = (json.dataset as AjfChartDataset[]).map(d => AjfDatasetSerializer.fromJson(d));\n      }\n    }\n    return {...createWidget(json), dataset};\n  }\n\n  private static _widgetWithContentFromJson(\n    json: AjfWidget & Partial<AjfWidgetWithContent>,\n  ): AjfWidgetWithContent {\n    const content = (json.content || []).map(c => AjfWidgetSerializer.fromJson(c));\n    return {...createWidget(json), content};\n  }\n}\n","/**\n * @license\n * Copyright (C) Gnucoop soc. coop.\n *\n * This file is part of the Advanced JSON forms (ajf).\n *\n * Advanced JSON forms (ajf) is free software: you can redistribute it and/or\n * modify it under the terms of the GNU Affero General Public License as\n * published by the Free Software Foundation, either version 3 of the License,\n * or (at your option) any later version.\n *\n * Advanced JSON forms (ajf) is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero\n * General Public License for more details.\n *\n * You should have received a copy of the GNU Affero General Public License\n * along with Advanced JSON forms (ajf).\n * If not, see http://www.gnu.org/licenses/.\n *\n */\n\nimport {AjfReportContainer} from '../interface/reports/report-container';\nimport {AjfWidgetSerializer} from './widget-serializer';\n\nexport class AjfReportContainerSerializer {\n  static fromJson(json: Partial<AjfReportContainer>): AjfReportContainer {\n    json.content = (json.content || []).map(c => AjfWidgetSerializer.fromJson(c));\n    return {...json, content: json.content!, styles: json.styles || {}};\n  }\n}\n","/**\n * @license\n * Copyright (C) Gnucoop soc. coop.\n *\n * This file is part of the Advanced JSON forms (ajf).\n *\n * Advanced JSON forms (ajf) is free software: you can redistribute it and/or\n * modify it under the terms of the GNU Affero General Public License as\n * published by the Free Software Foundation, either version 3 of the License,\n * or (at your option) any later version.\n *\n * Advanced JSON forms (ajf) is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero\n * General Public License for more details.\n *\n * You should have received a copy of the GNU Affero General Public License\n * along with Advanced JSON forms (ajf).\n * If not, see http://www.gnu.org/licenses/.\n *\n */\n\nimport {AjfReport} from '../../interface/reports/report';\n\nexport type AjfReportCreate = Partial<AjfReport>;\n\nexport function createReport(report: AjfReportCreate): AjfReport {\n  return {...report};\n}\n","/**\n * @license\n * Copyright (C) Gnucoop soc. coop.\n *\n * This file is part of the Advanced JSON forms (ajf).\n *\n * Advanced JSON forms (ajf) is free software: you can redistribute it and/or\n * modify it under the terms of the GNU Affero General Public License as\n * published by the Free Software Foundation, either version 3 of the License,\n * or (at your option) any later version.\n *\n * Advanced JSON forms (ajf) is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero\n * General Public License for more details.\n *\n * You should have received a copy of the GNU Affero General Public License\n * along with Advanced JSON forms (ajf).\n * If not, see http://www.gnu.org/licenses/.\n *\n */\n\nimport {AjfReport} from '../interface/reports/report';\nimport {AjfReportContainer} from '../interface/reports/report-container';\nimport {createReport} from '../utils/reports/create-report';\nimport {AjfReportContainerSerializer} from './report-container-serializer';\n\nexport class AjfReportSerializer {\n  static fromJson(json: Partial<AjfReport>): AjfReport {\n    const containers: (keyof AjfReport)[] = ['header', 'footer', 'content'];\n    containers.forEach(c => {\n      if (json[c]) {\n        (json[c] as AjfReportContainer) = AjfReportContainerSerializer.fromJson(\n          json[c] as Partial<AjfReportContainer>,\n        );\n      }\n    });\n    return createReport(json);\n  }\n}\n","/**\n * @license\n * Copyright (C) Gnucoop soc. coop.\n *\n * This file is part of the Advanced JSON forms (ajf).\n *\n * Advanced JSON forms (ajf) is free software: you can redistribute it and/or\n * modify it under the terms of the GNU Affero General Public License as\n * published by the Free Software Foundation, either version 3 of the License,\n * or (at your option) any later version.\n *\n * Advanced JSON forms (ajf) is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero\n * General Public License for more details.\n *\n * You should have received a copy of the GNU Affero General Public License\n * along with Advanced JSON forms (ajf).\n * If not, see http://www.gnu.org/licenses/.\n *\n */\n\nimport {ComponentRef, Directive, Input, isDevMode, OnInit, Renderer2, Type, ViewChild} from '@angular/core';\n\nimport {AjfBaseWidgetComponent} from './base-widget';\nimport {AjfWidgetInstance} from './interface/widgets-instances/widget-instance';\nimport {AjfWidgetComponentsMap} from './interface/widgets/widget-components-map';\nimport {AjfWidgetHost} from './widget-host';\n\n@Directive()\nexport abstract class AjfReportWidget implements OnInit {\n  @ViewChild(AjfWidgetHost, {static: true}) widgetHost!: AjfWidgetHost;\n\n  private _instance: AjfWidgetInstance | undefined;\n  get instance(): AjfWidgetInstance | undefined {\n    return this._instance;\n  }\n  @Input()\n  set instance(instance: AjfWidgetInstance | undefined) {\n    if (this._instance !== instance) {\n      this._instance = instance;\n      if (this._init) {\n        this._loadComponent();\n      }\n    }\n  }\n\n  protected abstract widgetsMap: AjfWidgetComponentsMap;\n\n  private _init = false;\n  private _currentComponentRef: ComponentRef<AjfBaseWidgetComponent> | undefined;\n  private _currentComponentType: Type<AjfBaseWidgetComponent> | undefined;\n\n  constructor(private _renderer: Renderer2) {}\n\n  ngOnInit(): void {\n    this._init = true;\n    this._loadComponent();\n  }\n\n  private _loadComponent(): void {\n    if (\n      !this._init ||\n      this._instance == null ||\n      this.widgetHost == null ||\n      !this._instance.visible\n    ) {\n      return;\n    }\n\n    const componentDef = this.widgetsMap[this._instance.widget.widgetType];\n    if (componentDef == null) {\n      return;\n    }\n    const component = componentDef.component;\n\n    if (component === this._currentComponentType && this._currentComponentRef != null) {\n      this._currentComponentRef.instance.instance = this._instance;\n      return;\n    }\n\n    const vcr = this.widgetHost.viewContainerRef;\n    vcr.clear();\n    this._currentComponentType = component;\n\n    try {\n      const componentRef = vcr.createComponent(component);\n      this._currentComponentRef = componentRef;\n      const componentInstance = componentRef.instance;\n\n      Object.keys(this._instance.widget.styles).forEach((style: string) => {\n        try {\n          this._renderer.setStyle(\n            componentInstance.el.nativeElement,\n            style,\n            `${this._instance!.widget.styles[style]}`,\n          );\n        } catch (e) {\n          if (isDevMode()) {\n            console.log(e);\n          }\n        }\n      });\n\n      componentInstance.instance = this._instance;\n      if (componentDef.inputs) {\n        Object.keys(componentDef.inputs).forEach(key => {\n          if (key in componentInstance) {\n            (componentInstance as any)[key] = componentDef.inputs![key];\n          }\n        });\n      }\n    } catch (e) {\n      if (isDevMode()) {\n        console.log(e);\n      }\n      this._currentComponentRef = undefined;\n      this._currentComponentType = undefined;\n    }\n  }\n}\n","/**\n * @license\n * Copyright (C) Gnucoop soc. coop.\n *\n * This file is part of the Advanced JSON forms (ajf).\n *\n * Advanced JSON forms (ajf) is free software: you can redistribute it and/or\n * modify it under the terms of the GNU Affero General Public License as\n * published by the Free Software Foundation, either version 3 of the License,\n * or (at your option) any later version.\n *\n * Advanced JSON forms (ajf) is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero\n * General Public License for more details.\n *\n * You should have received a copy of the GNU Affero General Public License\n * along with Advanced JSON forms (ajf).\n * If not, see http://www.gnu.org/licenses/.\n *\n */\n\nimport {AjfWidgetComponentsMap} from '../../interface/widgets/widget-components-map';\n\nexport const componentsMap: AjfWidgetComponentsMap = {};\n","/**\n * @license\n * Copyright (C) Gnucoop soc. coop.\n *\n * This file is part of the Advanced JSON forms (ajf).\n *\n * Advanced JSON forms (ajf) is free software: you can redistribute it and/or\n * modify it under the terms of the GNU Affero General Public License as\n * published by the Free Software Foundation, either version 3 of the License,\n * or (at your option) any later version.\n *\n * Advanced JSON forms (ajf) is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero\n * General Public License for more details.\n *\n * You should have received a copy of the GNU Affero General Public License\n * along with Advanced JSON forms (ajf).\n * If not, see http://www.gnu.org/licenses/.\n *\n */\n\nimport {Type} from '@angular/core';\n\nimport {AjfBaseWidgetComponent} from './base-widget';\nimport {AjfWidgetComponentsMap} from './interface/widgets/widget-components-map';\nimport {componentsMap} from './utils/widgets/widgets-map';\n\nexport abstract class AjfWidgetService {\n  readonly componentsMap: AjfWidgetComponentsMap = componentsMap;\n\n  constructor(defaultWidgets: AjfWidgetComponentsMap) {\n    if (defaultWidgets != null) {\n      for (const key in defaultWidgets) {\n        const nKey = parseInt(key, 10);\n        this.componentsMap[nKey] = defaultWidgets[key];\n      }\n    }\n  }\n\n  registerCustomWidget(widget: {\n    widgetType: number;\n    component: Type<AjfBaseWidgetComponent>;\n    inputs?: {[key: string]: any};\n  }): void {\n    const {widgetType, component} = widget;\n    if (widgetType < 100) {\n      throw new Error('Invalid custom widget type, it must be greater than 100');\n    }\n    if (component == null) {\n      throw new Error('Invalid custom widget component');\n    }\n    this.componentsMap[widgetType] = widget;\n  }\n}\n","/**\n * @license\n * Copyright (C) Gnucoop soc. coop.\n *\n * This file is part of the Advanced JSON forms (ajf).\n *\n * Advanced JSON forms (ajf) is free software: you can redistribute it and/or\n * modify it under the terms of the GNU Affero General Public License as\n * published by the Free Software Foundation, either version 3 of the License,\n * or (at your option) any later version.\n *\n * Advanced JSON forms (ajf) is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero\n * General Public License for more details.\n *\n * You should have received a copy of the GNU Affero General Public License\n * along with Advanced JSON forms (ajf).\n * If not, see http://www.gnu.org/licenses/.\n *\n */\n\nimport {AjfContext, AjfFormula, evaluateExpression} from '@ajf/core/models';\nimport {AjfAggregation} from '../../interface/aggregation/aggregation';\nimport {AjfAggregationType} from '../../interface/aggregation/aggregation-type';\n\nexport function evaluateAggregation(\n  aggregation: AjfAggregation,\n  formulas: AjfFormula[],\n  context: AjfContext,\n): number[] {\n  const data: any[] = formulas.map(f => evaluateExpression(f.formula, context));\n  switch (aggregation.aggregation) {\n    case AjfAggregationType.None:\n      if (data.length !== 1) {\n        throw new Error('Invalid aggregation');\n      }\n      return data[0];\n    case AjfAggregationType.Sum:\n      return data.map((r: any) => r.reduce((s: any, d: any) => s + d, 0));\n    case AjfAggregationType.Average:\n    case AjfAggregationType.WeightedAverage:\n      return data.map((r: any) => {\n        const sum = r.reduce((s: any, d: any) => s + d, 0);\n        return sum / data.length;\n      });\n    default:\n      return [];\n  }\n}\n","/**\n * @license\n * Copyright (C) Gnucoop soc. coop.\n *\n * This file is part of the Advanced JSON forms (ajf).\n *\n * Advanced JSON forms (ajf) is free software: you can redistribute it and/or\n * modify it under the terms of the GNU Affero General Public License as\n * published by the Free Software Foundation, either version 3 of the License,\n * or (at your option) any later version.\n *\n * Advanced JSON forms (ajf) is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero\n * General Public License for more details.\n *\n * You should have received a copy of the GNU Affero General Public License\n * along with Advanced JSON forms (ajf).\n * If not, see http://www.gnu.org/licenses/.\n *\n */\n\nimport {AjfChartWidget} from '../../interface/widgets/chart-widget';\nimport {AjfWidget} from '../../interface/widgets/widget';\nimport {AjfWidgetType} from '../../interface/widgets/widget-type';\n\nexport const isChartWidget = (widget: AjfWidget): widget is AjfChartWidget => {\n  return widget != null && widget.widgetType === AjfWidgetType.Chart;\n};\n","/**\n * @license\n * Copyright (C) Gnucoop soc. coop.\n *\n * This file is part of the Advanced JSON forms (ajf).\n *\n * Advanced JSON forms (ajf) is free software: you can redistribute it and/or\n * modify it under the terms of the GNU Affero General Public License as\n * published by the Free Software Foundation, either version 3 of the License,\n * or (at your option) any later version.\n *\n * Advanced JSON forms (ajf) is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero\n * General Public License for more details.\n *\n * You should have received a copy of the GNU Affero General Public License\n * along with Advanced JSON forms (ajf).\n * If not, see http://www.gnu.org/licenses/.\n *\n */\n\nimport {AjfDialogWidget} from '../../interface/widgets/dialog-widget';\nimport {AjfWidget} from '../../interface/widgets/widget';\nimport {AjfWidgetType} from '../../interface/widgets/widget-type';\n\nexport const isDialogWidget = (widget: AjfWidget): widget is AjfDialogWidget => {\n  return widget != null && widget.widgetType === AjfWidgetType.Dialog;\n};\n","/**\n * @license\n * Copyright (C) Gnucoop soc. coop.\n *\n * This file is part of the Advanced JSON forms (ajf).\n *\n * Advanced JSON forms (ajf) is free software: you can redistribute it and/or\n * modify it under the terms of the GNU Affero General Public License as\n * published by the Free Software Foundation, either version 3 of the License,\n * or (at your option) any later version.\n *\n * Advanced JSON forms (ajf) is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero\n * General Public License for more details.\n *\n * You should have received a copy of the GNU Affero General Public License\n * along with Advanced JSON forms (ajf).\n * If not, see http://www.gnu.org/licenses/.\n *\n */\n\nimport {AjfDynamicTableWidget} from '../../interface/widgets/dynamic-table-widget';\nimport {AjfWidget} from '../../interface/widgets/widget';\nimport {AjfWidgetType} from '../../interface/widgets/widget-type';\n\nexport const isDynamicTableWidget = (widget: AjfWidget): widget is AjfDynamicTableWidget => {\n  return widget != null && widget.widgetType === AjfWidgetType.DynamicTable;\n};\n","/**\n * @license\n * Copyright (C) Gnucoop soc. coop.\n *\n * This file is part of the Advanced JSON forms (ajf).\n *\n * Advanced JSON forms (ajf) is free software: you can redistribute it and/or\n * modify it under the terms of the GNU Affero General Public License as\n * published by the Free Software Foundation, either version 3 of the License,\n * or (at your option) any later version.\n *\n * Advanced JSON forms (ajf) is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero\n * General Public License for more details.\n *\n * You should have received a copy of the GNU Affero General Public License\n * along with Advanced JSON forms (ajf).\n * If not, see http://www.gnu.org/licenses/.\n *\n */\n\nimport {AjfFormulaWidget} from '../../interface/widgets/formula-widget';\nimport {AjfWidget} from '../../interface/widgets/widget';\nimport {AjfWidgetType} from '../../interface/widgets/widget-type';\n\nexport const isFormulaWidget = (widget: AjfWidget): widget is AjfFormulaWidget => {\n  return widget != null && widget.widgetType === AjfWidgetType.Formula;\n};\n","/**\n * @license\n * Copyright (C) Gnucoop soc. coop.\n *\n * This file is part of the Advanced JSON forms (ajf).\n *\n * Advanced JSON forms (ajf) is free software: you can redistribute it and/or\n * modify it under the terms of the GNU Affero General Public License as\n * published by the Free Software Foundation, either version 3 of the License,\n * or (at your option) any later version.\n *\n * Advanced JSON forms (ajf) is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero\n * General Public License for more details.\n *\n * You should have received a copy of the GNU Affero General Public License\n * along with Advanced JSON forms (ajf).\n * If not, see http://www.gnu.org/licenses/.\n *\n */\n\nimport {AjfGraphWidget} from '../../interface/widgets/graph-widget';\nimport {AjfWidget} from '../../interface/widgets/widget';\nimport {AjfWidgetType} from '../../interface/widgets/widget-type';\n\nexport const isGraphWidget = (widget: AjfWidget): widget is AjfGraphWidget => {\n  return widget != null && widget.widgetType === AjfWidgetType.Graph;\n};\n","/**\n * @license\n * Copyright (C) Gnucoop soc. coop.\n *\n * This file is part of the Advanced JSON forms (ajf).\n *\n * Advanced JSON forms (ajf) is free software: you can redistribute it and/or\n * modify it under the terms of the GNU Affero General Public License as\n * published by the Free Software Foundation, either version 3 of the License,\n * or (at your option) any later version.\n *\n * Advanced JSON forms (ajf) is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero\n * General Public License for more details.\n *\n * You should have received a copy of the GNU Affero General Public License\n * along with Advanced JSON forms (ajf).\n * If not, see http://www.gnu.org/licenses/.\n *\n */\n\nimport {AjfHeatMapWidget} from '../../interface/widgets/heat-map-widget';\nimport {AjfWidget} from '../../interface/widgets/widget';\nimport {AjfWidgetType} from '../../interface/widgets/widget-type';\n\nexport const isHeatMapWidget = (widget: AjfWidget): widget is AjfHeatMapWidget => {\n  return widget != null && widget.widgetType === AjfWidgetType.HeatMap;\n};\n","/**\n * @license\n * Copyright (C) Gnucoop soc. coop.\n *\n * This file is part of the Advanced JSON forms (ajf).\n *\n * Advanced JSON forms (ajf) is free software: you can redistribute it and/or\n * modify it under the terms of the GNU Affero General Public License as\n * published by the Free Software Foundation, either version 3 of the License,\n * or (at your option) any later version.\n *\n * Advanced JSON forms (ajf) is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero\n * General Public License for more details.\n *\n * You should have received a copy of the GNU Affero General Public License\n * along with Advanced JSON forms (ajf).\n * If not, see http://www.gnu.org/licenses/.\n *\n */\n\nimport {AjfImageContainerWidget} from '../../interface/widgets/image-container-widget';\nimport {AjfWidget} from '../../interface/widgets/widget';\nimport {AjfWidgetType} from '../../interface/widgets/widget-type';\n\nexport const isImageContainerWidget = (widget: AjfWidget): widget is AjfImageContainerWidget => {\n  return widget != null && widget.widgetType === AjfWidgetType.ImageContainer;\n};\n","/**\n * @license\n * Copyright (C) Gnucoop soc. coop.\n *\n * This file is part of the Advanced JSON forms (ajf).\n *\n * Advanced JSON forms (ajf) is free software: you can redistribute it and/or\n * modify it under the terms of the GNU Affero General Public License as\n * published by the Free Software Foundation, either version 3 of the License,\n * or (at your option) any later version.\n *\n * Advanced JSON forms (ajf) is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero\n * General Public License for more details.\n *\n * You should have received a copy of the GNU Affero General Public License\n * along with Advanced JSON forms (ajf).\n * If not, see http://www.gnu.org/licenses/.\n *\n */\n\nimport {AjfImageWidget} from '../../interface/widgets/image-widget';\nimport {AjfWidget} from '../../interface/widgets/widget';\nimport {AjfWidgetType} from '../../interface/widgets/widget-type';\n\nexport const isImageWidget = (widget: AjfWidget): widget is AjfImageWidget => {\n  return widget != null && widget.widgetType === AjfWidgetType.Image;\n};\n","/**\n * @license\n * Copyright (C) Gnucoop soc. coop.\n *\n * This file is part of the Advanced JSON forms (ajf).\n *\n * Advanced JSON forms (ajf) is free software: you can redistribute it and/or\n * modify it under the terms of the GNU Affero General Public License as\n * published by the Free Software Foundation, either version 3 of the License,\n * or (at your option) any later version.\n *\n * Advanced JSON forms (ajf) is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero\n * General Public License for more details.\n *\n * You should have received a copy of the GNU Affero General Public License\n * along with Advanced JSON forms (ajf).\n * If not, see http://www.gnu.org/licenses/.\n *\n */\n\nimport {AjfMapWidget} from '../../interface/widgets/map-widget';\nimport {AjfWidget} from '../../interface/widgets/widget';\nimport {AjfWidgetType} from '../../interface/widgets/widget-type';\n\nexport const isMapWidget = (widget: AjfWidget): widget is AjfMapWidget => {\n  return widget != null && widget.widgetType === AjfWidgetType.Map;\n};\n","/**\n * @license\n * Copyright (C) Gnucoop soc. coop.\n *\n * This file is part of the Advanced JSON forms (ajf).\n *\n * Advanced JSON forms (ajf) is free software: you can redistribute it and/or\n * modify it under the terms of the GNU Affero General Public License as\n * published by the Free Software Foundation, either version 3 of the License,\n * or (at your option) any later version.\n *\n * Advanced JSON forms (ajf) is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero\n * General Public License for more details.\n *\n * You should have received a copy of the GNU Affero General Public License\n * along with Advanced JSON forms (ajf).\n * If not, see http://www.gnu.org/licenses/.\n *\n */\n\nimport {AjfPaginatedListWidget} from '../../interface/widgets/paginated-list-widget';\nimport {AjfWidget} from '../../interface/widgets/widget';\nimport {AjfWidgetType} from '../../interface/widgets/widget-type';\n\nexport const isPaginatedListWidget = (widget: AjfWidget): widget is AjfPaginatedListWidget => {\n  return widget != null && widget.widgetType === AjfWidgetType.PaginatedList;\n};\n","/**\n * @license\n * Copyright (C) Gnucoop soc. coop.\n *\n * This file is part of the Advanced JSON forms (ajf).\n *\n * Advanced JSON forms (ajf) is free software: you can redistribute it and/or\n * modify it under the terms of the GNU Affero General Public License as\n * published by the Free Software Foundation, either version 3 of the License,\n * or (at your option) any later version.\n *\n * Advanced JSON forms (ajf) is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero\n * General Public License for more details.\n *\n * You should have received a copy of the GNU Affero General Public License\n * along with Advanced JSON forms (ajf).\n * If not, see http://www.gnu.org/licenses/.\n *\n */\n\nimport {AjfPaginatedTableWidget} from '../../interface/widgets/paginated-table-widget';\nimport {AjfWidget} from '../../interface/widgets/widget';\nimport {AjfWidgetType} from '../../interface/widgets/widget-type';\n\nexport const isPaginatedTableWidget = (widget: AjfWidget): widget is AjfPaginatedTableWidget => {\n  return widget != null && widget.widgetType === AjfWidgetType.PaginatedTable;\n};\n","/**\n * @license\n * Copyright (C) Gnucoop soc. coop.\n *\n * This file is part of the Advanced JSON forms (ajf).\n *\n * Advanced JSON forms (ajf) is free software: you can redistribute it and/or\n * modify it under the terms of the GNU Affero General Public License as\n * published by the Free Software Foundation, either version 3 of the License,\n * or (at your option) any later version.\n *\n * Advanced JSON forms (ajf) is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero\n * General Public License for more details.\n *\n * You should have received a copy of the GNU Affero General Public License\n * along with Advanced JSON forms (ajf).\n * If not, see http://www.gnu.org/licenses/.\n *\n */\n\nimport {AjfColumnWidget} from '../../interface/widgets/column-widget';\nimport {AjfDialogWidget} from '../../interface/widgets/dialog-widget';\nimport {AjfLayoutWidget} from '../../interface/widgets/layout-widget';\nimport {AjfWidget} from '../../interface/widgets/widget';\nimport {AjfWidgetType} from '../../interface/widgets/widget-type';\n\nexport const isWidgetWithContent = (\n  widget: AjfWidget,\n): widget is AjfColumnWidget | AjfLayoutWidget | AjfDialogWidget => {\n  return (\n    widget != null &&\n    (widget.widgetType === AjfWidgetType.Column ||\n      widget.widgetType === AjfWidgetType.Layout ||\n      widget.widgetType === AjfWidgetType.Dialog)\n  );\n};\n","/**\n * @license\n * Copyright (C) Gnucoop soc. coop.\n *\n * This file is part of the Advanced JSON forms (ajf).\n *\n * Advanced JSON forms (ajf) is free software: you can redistribute it and/or\n * modify it under the terms of the GNU Affero General Public License as\n * published by the Free Software Foundation, either version 3 of the License,\n * or (at your option) any later version.\n *\n * Advanced JSON forms (ajf) is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero\n * General Public License for more details.\n *\n * You should have received a copy of the GNU Affero General Public License\n * along with Advanced JSON forms (ajf).\n * If not, see http://www.gnu.org/licenses/.\n *\n */\n\nimport {AjfTableWidget} from '../../interface/widgets/table-widget';\nimport {AjfWidget} from '../../interface/widgets/widget';\nimport {AjfWidgetType} from '../../interface/widgets/widget-type';\n\nexport const isTableWidget = (widget: AjfWidget): widget is AjfTableWidget => {\n  return widget != null && widget.widgetType === AjfWidgetType.Table;\n};\n","/**\n * @license\n * Copyright (C) Gnucoop soc. coop.\n *\n * This file is part of the Advanced JSON forms (ajf).\n *\n * Advanced JSON forms (ajf) is free software: you can redistribute it and/or\n * modify it under the terms of the GNU Affero General Public License as\n * published by the Free Software Foundation, either version 3 of the License,\n * or (at your option) any later version.\n *\n * Advanced JSON forms (ajf) is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero\n * General Public License for more details.\n *\n * You should have received a copy of the GNU Affero General Public License\n * along with Advanced JSON forms (ajf).\n * If not, see http://www.gnu.org/licenses/.\n *\n */\n\nimport {AjfTextWidget} from '../../interface/widgets/text-widget';\nimport {AjfWidget} from '../../interface/widgets/widget';\nimport {AjfWidgetType} from '../../interface/widgets/widget-type';\n\nexport const isTextWidget = (widget: AjfWidget): widget is AjfTextWidget => {\n  return widget != null && widget.widgetType === AjfWidgetType.Text;\n};\n","/**\n * @license\n * Copyright (C) Gnucoop soc. coop.\n *\n * This file is part of the Advanced JSON forms (ajf).\n *\n * Advanced JSON forms (ajf) is free software: you can redistribute it and/or\n * modify it under the terms of the GNU Affero General Public License as\n * published by the Free Software Foundation, either version 3 of the License,\n * or (at your option) any later version.\n *\n * Advanced JSON forms (ajf) is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero\n * General Public License for more details.\n *\n * You should have received a copy of the GNU Affero General Public License\n * along with Advanced JSON forms (ajf).\n * If not, see http://www.gnu.org/licenses/.\n *\n */\n\nimport {AjfChartWidgetInstance} from '../../interface/widgets-instances/chart-widget-instance';\nimport {AjfWidgetInstance} from '../../interface/widgets-instances/widget-instance';\nimport {isChartWidget} from '../widgets/is-chart-widget';\n\nexport const isChartWidgetInstance = (\n  instance: AjfWidgetInstance,\n): instance is AjfChartWidgetInstance => {\n  return instance != null && isChartWidget(instance.widget);\n};\n","/**\n * @license\n * Copyright (C) Gnucoop soc. coop.\n *\n * This file is part of the Advanced JSON forms (ajf).\n *\n * Advanced JSON forms (ajf) is free software: you can redistribute it and/or\n * modify it under the terms of the GNU Affero General Public License as\n * published by the Free Software Foundation, either version 3 of the License,\n * or (at your option) any later version.\n *\n * Advanced JSON forms (ajf) is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero\n * General Public License for more details.\n *\n * You should have received a copy of the GNU Affero General Public License\n * along with Advanced JSON forms (ajf).\n * If not, see http://www.gnu.org/licenses/.\n *\n */\n\nimport {AjfDialogWidgetInstance} from '../../interface/widgets-instances/dialog-widget-instance';\nimport {AjfWidgetInstance} from '../../interface/widgets-instances/widget-instance';\nimport {isDialogWidget} from '../widgets/is-dialog-widget';\n\nexport const isDialogWidgetInstance = (\n  instance: AjfWidgetInstance,\n): instance is AjfDialogWidgetInstance => {\n  return instance != null && isDialogWidget(instance.widget);\n};\n","/**\n * @license\n * Copyright (C) Gnucoop soc. coop.\n *\n * This file is part of the Advanced JSON forms (ajf).\n *\n * Advanced JSON forms (ajf) is free software: you can redistribute it and/or\n * modify it under the terms of the GNU Affero General Public License as\n * published by the Free Software Foundation, either version 3 of the License,\n * or (at your option) any later version.\n *\n * Advanced JSON forms (ajf) is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero\n * General Public License for more details.\n *\n * You should have received a copy of the GNU Affero General Public License\n * along with Advanced JSON forms (ajf).\n * If not, see http://www.gnu.org/licenses/.\n *\n */\n\nimport {AjfDynamicTableWidgetInstance} from '../../interface/widgets-instances/dynamic-table-widget-instance';\nimport {AjfWidgetInstance} from '../../interface/widgets-instances/widget-instance';\nimport {isDynamicTableWidget} from '../widgets/is-dynamic-table-widget';\n\nexport const isDynamicTableWidgetInstance = (\n  instance: AjfWidgetInstance,\n): instance is AjfDynamicTableWidgetInstance => {\n  return instance != null && isDynamicTableWidget(instance.widget);\n};\n","/**\n * @license\n * Copyright (C) Gnucoop soc. coop.\n *\n * This file is part of the Advanced JSON forms (ajf).\n *\n * Advanced JSON forms (ajf) is free software: you can redistribute it and/or\n * modify it under the terms of the GNU Affero General Public License as\n * published by the Free Software Foundation, either version 3 of the License,\n * or (at your option) any later version.\n *\n * Advanced JSON forms (ajf) is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero\n * General Public License for more details.\n *\n * You should have received a copy of the GNU Affero General Public License\n * along with Advanced JSON forms (ajf).\n * If not, see http://www.gnu.org/licenses/.\n *\n */\n\nimport {AjfFormulaWidgetInstance} from '../../interface/widgets-instances/formula-widget-instance';\nimport {AjfWidgetInstance} from '../../interface/widgets-instances/widget-instance';\nimport {isFormulaWidget} from '../widgets/is-formula-widget';\n\nexport const isFormulaWidgetInstance = (\n  instance: AjfWidgetInstance,\n): instance is AjfFormulaWidgetInstance => {\n  return instance != null && isFormulaWidget(instance.widget);\n};\n","/**\n * @license\n * Copyright (C) Gnucoop soc. coop.\n *\n * This file is part of the Advanced JSON forms (ajf).\n *\n * Advanced JSON forms (ajf) is free software: you can redistribute it and/or\n * modify it under the terms of the GNU Affero General Public License as\n * published by the Free Software Foundation, either version 3 of the License,\n * or (at your option) any later version.\n *\n * Advanced JSON forms (ajf) is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero\n * General Public License for more details.\n *\n * You should have received a copy of the GNU Affero General Public License\n * along with Advanced JSON forms (ajf).\n * If not, see http://www.gnu.org/licenses/.\n *\n */\n\nimport {AjfGraphWidgetInstance} from '../../interface/widgets-instances/graph-widget-instance';\nimport {AjfWidgetInstance} from '../../interface/widgets-instances/widget-instance';\nimport {isGraphWidget} from '../widgets/is-graph-widget';\n\nexport const isGraphWidgetInstance = (\n  instance: AjfWidgetInstance,\n): instance is AjfGraphWidgetInstance => {\n  return instance != null && isGraphWidget(instance.widget);\n};\n","/**\n * @license\n * Copyright (C) Gnucoop soc. coop.\n *\n * This file is part of the Advanced JSON forms (ajf).\n *\n * Advanced JSON forms (ajf) is free software: you can redistribute it and/or\n * modify it under the terms of the GNU Affero General Public License as\n * published by the Free Software Foundation, either version 3 of the License,\n * or (at your option) any later version.\n *\n * Advanced JSON forms (ajf) is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero\n * General Public License for more details.\n *\n * You should have received a copy of the GNU Affero General Public License\n * along with Advanced JSON forms (ajf).\n * If not, see http://www.gnu.org/licenses/.\n *\n */\n\nimport {AjfHeatMapWidgetInstance} from '../../interface/widgets-instances/heat-map-widget-instance';\nimport {AjfWidgetInstance} from '../../interface/widgets-instances/widget-instance';\nimport {isHeatMapWidget} from '../widgets/is-heat-map-widget';\n\nexport const isHeatMapWidgetInstance = (\n  instance: AjfWidgetInstance,\n): instance is AjfHeatMapWidgetInstance => {\n  return instance != null && isHeatMapWidget(instance.widget);\n};\n","/**\n * @license\n * Copyright (C) Gnucoop soc. coop.\n *\n * This file is part of the Advanced JSON forms (ajf).\n *\n * Advanced JSON forms (ajf) is free software: you can redistribute it and/or\n * modify it under the terms of the GNU Affero General Public License as\n * published by the Free Software Foundation, either version 3 of the License,\n * or (at your option) any later version.\n *\n * Advanced JSON forms (ajf) is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero\n * General Public License for more details.\n *\n * You should have received a copy of the GNU Affero General Public License\n * along with Advanced JSON forms (ajf).\n * If not, see http://www.gnu.org/licenses/.\n *\n */\n\nimport {AjfImageContainerWidgetInstance} from '../../interface/widgets-instances/image-container-widget-instance';\nimport {AjfWidgetInstance} from '../../interface/widgets-instances/widget-instance';\nimport {isImageContainerWidget} from '../widgets/is-image-container-widget';\n\nexport const isImageContainerWidgetInstance = (\n  instance: AjfWidgetInstance,\n): instance is AjfImageContainerWidgetInstance => {\n  return instance != null && isImageContainerWidget(instance.widget);\n};\n","/**\n * @license\n * Copyright (C) Gnucoop soc. coop.\n *\n * This file is part of the Advanced JSON forms (ajf).\n *\n * Advanced JSON forms (ajf) is free software: you can redistribute it and/or\n * modify it under the terms of the GNU Affero General Public License as\n * published by the Free Software Foundation, either version 3 of the License,\n * or (at your option) any later version.\n *\n * Advanced JSON forms (ajf) is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero\n * General Public License for more details.\n *\n * You should have received a copy of the GNU Affero General Public License\n * along with Advanced JSON forms (ajf).\n * If not, see http://www.gnu.org/licenses/.\n *\n */\n\nimport {AjfImageWidgetInstance} from '../../interface/widgets-instances/image-widget-instance';\nimport {AjfWidgetInstance} from '../../interface/widgets-instances/widget-instance';\nimport {isImageWidget} from '../widgets/is-image-widget';\n\nexport const isImageWidgetInstance = (\n  instance: AjfWidgetInstance,\n): instance is AjfImageWidgetInstance => {\n  return instance != null && isImageWidget(instance.widget);\n};\n","/**\n * @license\n * Copyright (C) Gnucoop soc. coop.\n *\n * This file is part of the Advanced JSON forms (ajf).\n *\n * Advanced JSON forms (ajf) is free software: you can redistribute it and/or\n * modify it under the terms of the GNU Affero General Public License as\n * published by the Free Software Foundation, either version 3 of the License,\n * or (at your option) any later version.\n *\n * Advanced JSON forms (ajf) is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero\n * General Public License for more details.\n *\n * You should have received a copy of the GNU Affero General Public License\n * along with Advanced JSON forms (ajf).\n * If not, see http://www.gnu.org/licenses/.\n *\n */\n\nimport {AjfMapWidgetInstance} from '../../interface/widgets-instances/map-widget-instance';\nimport {AjfWidgetInstance} from '../../interface/widgets-instances/widget-instance';\nimport {isMapWidget} from '../widgets/is-map-widget';\n\nexport const isMapWidgetInstance = (\n  instance: AjfWidgetInstance,\n): instance is AjfMapWidgetInstance => {\n  return instance != null && isMapWidget(instance.widget);\n};\n","/**\n * @license\n * Copyright (C) Gnucoop soc. coop.\n *\n * This file is part of the Advanced JSON forms (ajf).\n *\n * Advanced JSON forms (ajf) is free software: you can redistribute it and/or\n * modify it under the terms of the GNU Affero General Public License as\n * published by the Free Software Foundation, either version 3 of the License,\n * or (at your option) any later version.\n *\n * Advanced JSON forms (ajf) is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero\n * General Public License for more details.\n *\n * You should have received a copy of the GNU Affero General Public License\n * along with Advanced JSON forms (ajf).\n * If not, see http://www.gnu.org/licenses/.\n *\n */\n\nimport {AjfPaginatedListWidgetInstance} from '../../interface/widgets-instances/paginated-list-widget-instance';\nimport {AjfWidgetInstance} from '../../interface/widgets-instances/widget-instance';\nimport {isPaginatedListWidget} from '../widgets/is-paginated-list-widget';\n\nexport const isPaginatedListWidgetInstance = (\n  instance: AjfWidgetInstance,\n): instance is AjfPaginatedListWidgetInstance => {\n  return instance != null && isPaginatedListWidget(instance.widget);\n};\n","/**\n * @license\n * Copyright (C) Gnucoop soc. coop.\n *\n * This file is part of the Advanced JSON forms (ajf).\n *\n * Advanced JSON forms (ajf) is free software: you can redistribute it and/or\n * modify it under the terms of the GNU Affero General Public License as\n * published by the Free Software Foundation, either version 3 of the License,\n * or (at your option) any later version.\n *\n * Advanced JSON forms (ajf) is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero\n * General Public License for more details.\n *\n * You should have received a copy of the GNU Affero General Public License\n * along with Advanced JSON forms (ajf).\n * If not, see http://www.gnu.org/licenses/.\n *\n */\n\nimport {AjfPaginatedTableWidgetInstance} from '../../interface/widgets-instances/paginated-table-widget-instance';\nimport {AjfWidgetInstance} from '../../interface/widgets-instances/widget-instance';\nimport {isPaginatedTableWidget} from '../widgets/is-paginated-table-widget';\n\nexport const isPaginatedTableWidgetInstance = (\n  instance: AjfWidgetInstance,\n): instance is AjfPaginatedTableWidgetInstance => {\n  return instance != null && isPaginatedTableWidget(instance.widget);\n};\n","/**\n * @license\n * Copyright (C) Gnucoop soc. coop.\n *\n * This file is part of the Advanced JSON forms (ajf).\n *\n * Advanced JSON forms (ajf) is free software: you can redistribute it and/or\n * modify it under the terms of the GNU Affero General Public License as\n * published by the Free Software Foundation, either version 3 of the License,\n * or (at your option) any later version.\n *\n * Advanced JSON forms (ajf) is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero\n * General Public License for more details.\n *\n * You should have received a copy of the GNU Affero General Public License\n * along with Advanced JSON forms (ajf).\n * If not, see http://www.gnu.org/licenses/.\n *\n */\n\nimport {AjfTableWidgetInstance} from '../../interface/widgets-instances/table-widget-instance';\nimport {AjfWidgetInstance} from '../../interface/widgets-instances/widget-instance';\nimport {isTableWidget} from '../widgets/is-table-widget';\n\nexport const isTableWidgetInstance = (\n  instance: AjfWidgetInstance,\n): instance is AjfTableWidgetInstance => {\n  return instance != null && isTableWidget(instance.widget);\n};\n","/**\n * @license\n * Copyright (C) Gnucoop soc. coop.\n *\n * This file is part of the Advanced JSON forms (ajf).\n *\n * Advanced JSON forms (ajf) is free software: you can redistribute it and/or\n * modify it under the terms of the GNU Affero General Public License as\n * published by the Free Software Foundation, either version 3 of the License,\n * or (at your option) any later version.\n *\n * Advanced JSON forms (ajf) is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero\n * General Public License for more details.\n *\n * You should have received a copy of the GNU Affero General Public License\n * along with Advanced JSON forms (ajf).\n * If not, see http://www.gnu.org/licenses/.\n *\n */\n\nimport {AjfTextWidgetInstance} from '../../interface/widgets-instances/text-widget-instance';\nimport {AjfWidgetInstance} from '../../interface/widgets-instances/widget-instance';\nimport {isTextWidget} from '../widgets/is-text-widget';\n\nexport const isTextWidgetInstance = (\n  instance: AjfWidgetInstance,\n): instance is AjfTextWidgetInstance => {\n  return instance != null && isTextWidget(instance.widget);\n};\n","/**\n * @license\n * Copyright (C) Gnucoop soc. coop.\n *\n * This file is part of the Advanced JSON forms (ajf).\n *\n * Advanced JSON forms (ajf) is free software: you can redistribute it and/or\n * modify it under the terms of the GNU Affero General Public License as\n * published by the Free Software Foundation, either version 3 of the License,\n * or (at your option) any later version.\n *\n * Advanced JSON forms (ajf) is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero\n * General Public License for more details.\n *\n * You should have received a copy of the GNU Affero General Public License\n * along with Advanced JSON forms (ajf).\n * If not, see http://www.gnu.org/licenses/.\n *\n */\n\nimport {AjfColumnWidgetInstance} from '../../interface/widgets-instances/column-widget-instance';\nimport {AjfDialogWidgetInstance} from '../../interface/widgets-instances/dialog-widget-instance';\nimport {AjfLayoutWidgetInstance} from '../../interface/widgets-instances/layout-widget-instance';\nimport {AjfWidgetInstance} from '../../interface/widgets-instances/widget-instance';\nimport {isWidgetWithContent} from '../widgets/is-widget-with-content';\n\nexport const isWidgetWithContentInstance = (\n  instance: AjfWidgetInstance,\n): instance is AjfColumnWidgetInstance | AjfLayoutWidgetInstance | AjfDialogWidgetInstance => {\n  return instance != null && isWidgetWithContent(instance.widget);\n};\n","/**\n * @license\n * Copyright (C) Gnucoop soc. coop.\n *\n * This file is part of the Advanced JSON forms (ajf).\n *\n * Advanced JSON forms (ajf) is free software: you can redistribute it and/or\n * modify it under the terms of the GNU Affero General Public License as\n * published by the Free Software Foundation, either version 3 of the License,\n * or (at your option) any later version.\n *\n * Advanced JSON forms (ajf) is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero\n * General Public License for more details.\n *\n * You should have received a copy of the GNU Affero General Public License\n * along with Advanced JSON forms (ajf).\n * If not, see http://www.gnu.org/licenses/.\n *\n */\n\nimport {AjfContext, evaluateExpression} from '@ajf/core/models';\nimport {TranslocoService} from '@ajf/core/transloco';\nimport {AjfFormSerializer} from '@ajf/core/forms';\nimport {AjfWidgetInstance} from '../../interface/widgets-instances/widget-instance';\nimport {AjfWidget} from '../../interface/widgets/widget';\nimport {AjfReportVariable} from '../../interface/reports/report-variable';\n\nexport function createWidgetInstance(\n  widget: AjfWidget,\n  context: AjfContext,\n  _ts: TranslocoService,\n  variables: AjfReportVariable[] = [],\n): AjfWidgetInstance {\n  let filter = undefined;\n  if (widget.filter != null && widget.filter.schema != null) {\n    filter = {\n      form: AjfFormSerializer.fromJson(widget.filter.schema, context),\n      context,\n      variables,\n    };\n  }\n  return {\n    widget,\n    widgetType: widget.widgetType,\n    visible: evaluateExpression(widget.visibility.condition, context),\n    styles: widget.styles || {},\n    filter,\n  } as AjfWidgetInstance;\n}\n","/**\n * @license\n * Copyright (C) Gnucoop soc. coop.\n *\n * This file is part of the Advanced JSON forms (ajf).\n *\n * Advanced JSON forms (ajf) is free software: you can redistribute it and/or\n * modify it under the terms of the GNU Affero General Public License as\n * published by the Free Software Foundation, either version 3 of the License,\n * or (at your option) any later version.\n *\n * Advanced JSON forms (ajf) is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero\n * General Public License for more details.\n *\n * You should have received a copy of the GNU Affero General Public License\n * along with Advanced JSON forms (ajf).\n * If not, see http://www.gnu.org/licenses/.\n *\n */\n\nimport {AjfContext, AjfFormula, evaluateExpression} from '@ajf/core/models';\nimport {TranslocoService} from '@ajf/core/transloco';\n\nexport function evalAndTranslate(f: AjfFormula, context: AjfContext, ts: TranslocoService): any {\n  const val = evaluateExpression(f.formula, context);\n  if (typeof val === 'string') {\n    return ts.translate(val);\n  }\n  return val;\n}\n\n/**\n * Evaluate a string with expressions inside, delimited by double square brackets.\n * Example: \"Number of positive identified: [[n_positive_campaign]]\"\n */\nexport function evaluateHtmlText(text: string, context: AjfContext): string {\n  if (!text.includes('[[')) {\n    return text;\n  }\n  if (text.includes('`')) {\n    return \"Error: htmlText can't contain backticks `\";\n  }\n  text = text.replaceAll('[[', '${');\n  text = text.replaceAll(']]', '}');\n  text = '`' + text + '`';\n  return evaluateExpression(text, context);\n}\n","/**\n * @license\n * Copyright (C) Gnucoop soc. coop.\n *\n * This file is part of the Advanced JSON forms (ajf).\n *\n * Advanced JSON forms (ajf) is free software: you can redistribute it and/or\n * modify it under the terms of the GNU Affero General Public License as\n * published by the Free Software Foundation, either version 3 of the License,\n * or (at your option) any later version.\n *\n * Advanced JSON forms (ajf) is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero\n * General Public License for more details.\n *\n * You should have received a copy of the GNU Affero General Public License\n * along with Advanced JSON forms (ajf).\n * If not, see http://www.gnu.org/licenses/.\n *\n */\n\nimport {AjfContext, evaluateExpression} from '@ajf/core/models';\nimport {AjfTableCell} from '@ajf/core/table';\nimport {TranslocoService} from '@ajf/core/transloco';\nimport {deepCopy} from '@ajf/core/utils';\n\nimport {chartToChartJsType} from '../../chart-utils';\nimport {AjfTableDataset} from '../../interface/dataset/table-dataset';\nimport {AjfReportVariable} from '../../interface/reports/report-variable';\nimport {AjfWidgetInstance} from '../../interface/widgets-instances/widget-instance';\nimport {AjfWidget} from '../../interface/widgets/widget';\nimport {evaluateAggregation} from '../aggregation/evaluate-aggregation';\nimport {isChartWidget} from '../widgets/is-chart-widget';\nimport {isDialogWidget} from '../widgets/is-dialog-widget';\nimport {isDynamicTableWidget} from '../widgets/is-dynamic-table-widget';\nimport {isFormulaWidget} from '../widgets/is-formula-widget';\nimport {isGraphWidget} from '../widgets/is-graph-widget';\nimport {isHeatMapWidget} from '../widgets/is-heat-map-widget';\nimport {isImageContainerWidget} from '../widgets/is-image-container-widget';\nimport {isImageWidget} from '../widgets/is-image-widget';\nimport {isMapWidget} from '../widgets/is-map-widget';\nimport {isPaginatedListWidget} from '../widgets/is-paginated-list-widget';\nimport {isPaginatedTableWidget} from '../widgets/is-paginated-table-widget';\nimport {isWidgetWithContent} from '../widgets/is-widget-with-content';\nimport {isTableWidget} from '../widgets/is-table-widget';\nimport {isTextWidget} from '../widgets/is-text-widget';\nimport {componentsMap} from '../widgets/widgets-map';\nimport {isChartWidgetInstance} from '../widgets-instances/is-chart-widget-instance';\nimport {isDialogWidgetInstance} from '../widgets-instances/is-dialog-widget-instance';\nimport {isDynamicTableWidgetInstance} from '../widgets-instances/is-dynamic-table-widget-instance';\nimport {isFormulaWidgetInstance} from '../widgets-instances/is-formula-widget-instance';\nimport {isGraphWidgetInstance} from '../widgets-instances/is-graph-widget-instance';\nimport {isHeatMapWidgetInstance} from '../widgets-instances/is-heat-map-widget-instance';\nimport {isImageContainerWidgetInstance} from '../widgets-instances/is-image-container-widget-instance';\nimport {isImageWidgetInstance} from '../widgets-instances/is-image-widget-instance';\nimport {isMapWidgetInstance} from '../widgets-instances/is-map-widget-instance';\nimport {isPaginatedListWidgetInstance} from '../widgets-instances/is-paginated-list-widget-instance';\nimport {isPaginatedTableWidgetInstance} from './is-paginated-table-widget-instance';\nimport {isTableWidgetInstance} from '../widgets-instances/is-table-widget-instance';\nimport {isTextWidgetInstance} from '../widgets-instances/is-text-widget-instance';\nimport {isWidgetWithContentInstance} from '../widgets-instances/is-widget-with-content-instance';\n\nimport {createWidgetInstance} from './create-widget-instance';\nimport {evalAndTranslate, evaluateHtmlText} from './widget-instance-utils';\nimport {isDevMode} from '@angular/core';\n\nexport function widgetToWidgetInstance(\n  widget: AjfWidget,\n  context: AjfContext,\n  ts: TranslocoService,\n  variables: AjfReportVariable[] = [],\n): AjfWidgetInstance {\n  const wi = createWidgetInstance(widget, context, ts, variables);\n\n  if (isWidgetWithContent(widget) && isWidgetWithContentInstance(wi)) {\n    let content: AjfWidgetInstance[] = [];\n    widget.content.forEach(c => {\n      if (widget.repetitions != null) {\n        wi.repetitions = evaluateExpression(widget.repetitions.formula, context);\n        if (typeof wi.repetitions === 'number' && wi.repetitions > 0) {\n          for (let i = 0; i < wi.repetitions; i++) {\n            content.push(widgetToWidgetInstance(c, {...context, '$repetition': i}, ts, variables));\n          }\n        }\n      } else {\n        content.push(widgetToWidgetInstance(c, context, ts, variables));\n      }\n      wi.content = content;\n    });\n    if (isDialogWidget(widget) && isDialogWidgetInstance(wi)) {\n      wi.toggle = widgetToWidgetInstance(widget.toggle, context, ts, variables);\n    }\n  } else if (isChartWidget(widget) && isChartWidgetInstance(wi)) {\n    if (widget.options == null) {\n      widget.options = {};\n    }\n    const labels = widget.labels instanceof Array ? widget.labels : [widget.labels];\n    const evLabels = labels.map(l => {\n      let evf = evaluateExpression(l.formula, context);\n      try {\n        if (evf instanceof Array) {\n          evf = evf.map(v =>\n            v != null && typeof v === 'string' && v.trim().length > 0 ? ts.translate(v) : v,\n          );\n        } else {\n          evf =\n            evf != null && typeof evf === 'string' && evf.trim().length > 0\n              ? ts.translate(evf)\n              : evf;\n        }\n      } catch (e) {\n        if (isDevMode()) {\n          console.log(e);\n        }\n      }\n      return evf;\n    });\n    wi.labels = widget.labels instanceof Array ? evLabels : evLabels[0];\n    wi.datasets = widget.dataset.map(d => {\n      let ds: any = {\n        ...(d.options || {}),\n        data: evaluateAggregation(d.aggregation, d.formula, context),\n      };\n      if (d.chartType != null) {\n        const ct = chartToChartJsType(d.chartType);\n        ds = {...ds, chartType: ct, type: ct};\n      }\n      if (d.options != null) {\n        ds = {...ds, options: d.options};\n      }\n      if (d.label != null) {\n        ds = {...ds, label: d.label.trim().length > 0 ? ts.translate(d.label) : d.label};\n      }\n      if (d.datalabels != null) {\n        ds.datalabels = deepCopy(d.datalabels);\n      }\n      return ds;\n    });\n    wi.data = {labels: wi.labels, datasets: wi.datasets};\n    wi.chartType = chartToChartJsType(widget.type || widget.chartType);\n    wi.exportable =\n      widget.exportable && (widget.exportable === true || widget.exportable === 'true')\n        ? true\n        : false;\n    wi.mainDataNumberThreshold = widget.mainDataNumberThreshold;\n    wi.removeZeroValues = widget.removeZeroValues;\n\n    if (widget.options != null && widget.options.plugins != null) {\n      const plugins = widget.options.plugins;\n      const pluginNames = Object.keys(plugins);\n      pluginNames.forEach(pluginName => {\n        const plugin = plugins[pluginName];\n        const pluginOptions = Object.keys(plugin);\n        pluginOptions.forEach((pluginOptionName: string) => {\n          const pluginOption = plugin[pluginOptionName];\n          if (\n            typeof pluginOption !== 'string' &&\n            pluginOption != null &&\n            pluginOption.formula != null\n          ) {\n            plugin[pluginOptionName] = evaluateExpression(pluginOption.formula, context);\n          }\n        });\n      });\n    }\n  } else if (isTableWidget(widget) && isTableWidgetInstance(wi)) {\n    wi.dataset = widget.dataset.map(row =>\n      row.map(cell => {\n        return cell.formula instanceof Array\n          ? cell.formula.map(f => evalAndTranslate(f, context, ts))\n          : evalAndTranslate(cell.formula!, context, ts);\n      }),\n    );\n    wi.exportable =\n      widget.exportable && (widget.exportable === true || widget.exportable === 'true')\n        ? true\n        : false;\n    wi.data = (widget.dataset || []).map(row =>\n      row.map(cell => {\n        const val = cell.formula instanceof Array\n          ? cell.formula.map(f => evalAndTranslate(f, context, ts))\n          : evalAndTranslate(cell.formula!, context, ts);\n        return {\n          value: val,\n          style: {...widget.cellStyles, ...cell.style},\n          rowspan: cell.rowspan,\n          colspan: cell.colspan,\n          sorted: cell.sorted ?? false,\n        };\n      }),\n    );\n  } else if (\n    (isDynamicTableWidget(widget) && isDynamicTableWidgetInstance(wi)) ||\n    (isPaginatedTableWidget(widget) && isPaginatedTableWidgetInstance(wi))\n  ) {\n    wi.dataset = widget.dataset.map((cell: AjfTableDataset) => {\n      return cell.formula instanceof Array\n        ? cell.formula.map(f => evalAndTranslate(f, context, ts))\n        : evalAndTranslate(cell.formula!, context, ts);\n    });\n    wi.exportable =\n      widget.exportable && (widget.exportable === true || widget.exportable === 'true')\n        ? true\n        : false;\n\n    let dataset: AjfTableCell[][] = evaluateExpression(widget.rowDefinition.formula, context) || [];\n    dataset = (dataset || []).map((row: AjfTableCell[]) =>\n      row.map(cell => {\n        let trf = cell.value;\n        try {\n          if (trf instanceof Array) {\n            trf = trf.map(v =>\n              v != null && typeof v === 'string' && v.trim().length > 0 ? ts.translate(v) : v,\n            );\n          } else {\n            trf =\n              trf != null && typeof trf === 'string' && trf.trim().length > 0\n                ? ts.translate(trf)\n                : trf;\n          }\n        } catch (e) {\n          if (isDevMode()) {\n            console.log(e);\n          }\n        }\n        return {...cell, value: trf};\n      }),\n    );\n\n    const header = (widget.dataset || []).map(cell => {\n      const val = cell.formula instanceof Array\n        ? cell.formula.map(f => evalAndTranslate(f, context, ts))\n        : evalAndTranslate(cell.formula, context, ts);\n      return {\n        value: val,\n        style: {...widget.cellStyles, ...cell.style},\n        rowspan: cell.rowspan,\n        colspan: cell.colspan,\n        sorted: cell.sorted ?? false,\n      };\n    });\n    wi.data = header.length === 0 ? [...dataset] : [[...header], ...dataset];\n    wi.styles = {...wi.styles, alignItems: 'flex-start'};\n  } else if (isPaginatedListWidget(widget) && isPaginatedListWidgetInstance(wi)) {\n    let content: AjfWidgetInstance[] = [];\n    if (widget.contentDefinition) {\n      let contentDefinition: AjfWidget[] =\n        evaluateExpression(widget.contentDefinition.formula, context) || [];\n      contentDefinition.forEach(c => {\n        content.push(widgetToWidgetInstance(c, context, ts, variables));\n      });\n    } else if (widget.content) {\n      widget.content.forEach(c => {\n        content.push(widgetToWidgetInstance(c, context, ts, variables));\n      });\n    }\n    wi.content = content;\n  } else if (isImageWidget(widget) && isImageWidgetInstance(wi)) {\n    if (widget.flag) {\n      wi.flag = evaluateExpression(widget.flag.formula, context);\n    }\n    if (widget.icon) {\n      wi.icon = evaluateExpression(widget.icon.formula, context);\n    }\n    if (widget.url) {\n      wi.url = evaluateExpression(widget.url.formula, context);\n    }\n  } else if (isImageContainerWidget(widget) && isImageContainerWidgetInstance(wi)) {\n    if (widget.flags) {\n      wi.flags =\n        widget.flags instanceof Array\n          ? widget.flags.map(f => evaluateExpression(f.formula, context))\n          : evaluateExpression(widget.flags.formula, context);\n    }\n    if (widget.icons) {\n      wi.icons =\n        widget.icons instanceof Array\n          ? widget.icons.map(f => evaluateExpression(f.formula, context))\n          : evaluateExpression(widget.icons.formula, context);\n    }\n    if (widget.urls) {\n      wi.urls =\n        widget.urls instanceof Array\n          ? widget.urls.map(f => evaluateExpression(f.formula, context))\n          : evaluateExpression(widget.urls.formula, context);\n    }\n  } else if (isTextWidget(widget) && isTextWidgetInstance(wi)) {\n    wi.htmlText = ts.translate(evaluateHtmlText(widget.htmlText, context));\n  } else if (isFormulaWidget(widget) && isFormulaWidgetInstance(wi)) {\n    wi.formula = evaluateExpression(widget.formula.formula, context);\n  } else if (isMapWidget(widget) && isMapWidgetInstance(wi)) {\n    wi.coordinate = evaluateExpression(widget.coordinate.formula, context);\n  } else if (isGraphWidget(widget) && isGraphWidgetInstance(wi)) {\n    if (widget.nodes != null) {\n      wi.nodes = widget.nodes.map(ds => ({\n        id: ds.id,\n        label: ds.label,\n        parentId: ds.parentId,\n        green: ds.green === 'true',\n        red: ds.red === 'true',\n        yellow: ds.yellow === 'true',\n        color: ds.color,\n      }));\n    }\n  } else if (isHeatMapWidget(widget) && isHeatMapWidgetInstance(wi)) {\n    wi.idProp = widget.idProp || 'id';\n    wi.features = (typeof widget.features === 'string'\n      ? JSON.parse(widget.features)\n      : widget.features) || {type: 'FeatureCollection', features: []};\n    wi.values = evaluateExpression(widget.values.formula, context);\n    wi.startColor = widget.startColor || '#ffeb3b';\n    wi.endColor = widget.endColor || '#f44336';\n    wi.highlightColor = widget.highlightColor || '#009688';\n    wi.showVisualMap = widget.showVisualMap === true;\n    if (widget.action) {\n      wi.action = widget.action;\n    }\n  } else if (widget.widgetType > 100) {\n    const iiFn =\n      componentsMap[widget.widgetType] != null\n        ? componentsMap[widget.widgetType].initInstance\n        : null;\n    if (iiFn != null) {\n      return iiFn(wi, context, ts);\n    }\n  }\n  return wi;\n}\n","/**\n * @license\n * Copyright (C) Gnucoop soc. coop.\n *\n * This file is part of the Advanced JSON forms (ajf).\n *\n * Advanced JSON forms (ajf) is free software: you can redistribute it and/or\n * modify it under the terms of the GNU Affero General Public License as\n * published by the Free Software Foundation, either version 3 of the License,\n * or (at your option) any later version.\n *\n * Advanced JSON forms (ajf) is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero\n * General Public License for more details.\n *\n * You should have received a copy of the GNU Affero General Public License\n * along with Advanced JSON forms (ajf).\n * If not, see http://www.gnu.org/licenses/.\n *\n */\n\nimport {AjfContext} from '@ajf/core/models';\nimport {TranslocoService} from '@ajf/core/transloco';\n\nimport {AjfReportContainerInstance} from '../../interface/reports-instances/report-container-instance';\nimport {AjfReportContainer} from '../../interface/reports/report-container';\nimport {AjfReportVariable} from '../../interface/reports/report-variable';\nimport {widgetToWidgetInstance} from '../widgets-instances/widget-to-widget-instance';\n\nexport function createReportContainerInstance(\n  container: AjfReportContainer,\n  context: AjfContext,\n  ts: TranslocoService,\n  variables: AjfReportVariable[] = [],\n): AjfReportContainerInstance {\n  const content = container.content.map(c => {\n    return widgetToWidgetInstance(c, context, ts, variables);\n  });\n  return {\n    container,\n    content,\n    styles: container.styles,\n  };\n}\n","/**\n * @license\n * Copyright (C) Gnucoop soc. coop.\n *\n * This file is part of the Advanced JSON forms (ajf).\n *\n * Advanced JSON forms (ajf) is free software: you can redistribute it and/or\n * modify it under the terms of the GNU Affero General Public License as\n * published by the Free Software Foundation, either version 3 of the License,\n * or (at your option) any later version.\n *\n * Advanced JSON forms (ajf) is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero\n * General Public License for more details.\n *\n * You should have received a copy of the GNU Affero General Public License\n * along with Advanced JSON forms (ajf).\n * If not, see http://www.gnu.org/licenses/.\n *\n */\n\nimport {AjfContext, evaluateExpression} from '@ajf/core/models';\nimport {TranslocoService} from '@ajf/core/transloco';\n\nimport {AjfReportInstance} from '../../interface/reports-instances/report-instance';\nimport {AjfReport} from '../../interface/reports/report';\n\nimport {createReportContainerInstance} from './create-report-container-instance';\n\nexport function createReportInstance(\n  report: AjfReport,\n  context: AjfContext,\n  ts: TranslocoService,\n): AjfReportInstance {\n  (report.variables || []).forEach(variable => {\n    context[variable.name] = evaluateExpression(variable.formula.formula, context);\n  });\n  return {\n    report,\n    header: report.header\n      ? createReportContainerInstance(report.header, context, ts, report.variables)\n      : undefined,\n    content: report.content\n      ? createReportContainerInstance(report.content, context, ts, report.variables)\n      : undefined,\n    footer: report.footer\n      ? createReportContainerInstance(report.footer, context, ts, report.variables)\n      : undefined,\n    styles: report.styles || {},\n  };\n}\n\nexport function evaluateReportVariables(report: AjfReport, context: AjfContext): AjfContext {\n  (report.variables || []).forEach(variable => {\n    context[variable.name] = evaluateExpression(variable.formula.formula, context);\n  });\n  return context;\n}\n","/**\n * @license\n * Copyright (C) Gnucoop soc. coop.\n *\n * This file is part of the Advanced JSON forms (ajf).\n *\n * Advanced JSON forms (ajf) is free software: you can redistribute it and/or\n * modify it under the terms of the GNU Affero General Public License as\n * published by the Free Software Foundation, either version 3 of the License,\n * or (at your option) any later version.\n *\n * Advanced JSON forms (ajf) is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero\n * General Public License for more details.\n *\n * You should have received a copy of the GNU Affero General Public License\n * along with Advanced JSON forms (ajf).\n * If not, see http://www.gnu.org/licenses/.\n *\n */\n\nimport {AjfReportContainer} from '../../interface/reports/report-container';\n\nexport type AjfReportContainerCreate = Partial<AjfReportContainer>;\n\nexport function createReportContainer(container: AjfReportContainer): AjfReportContainer {\n  return {...container};\n}\n","/**\n * @license\n * Copyright (C) Gnucoop soc. coop.\n *\n * This file is part of the Advanced JSON forms (ajf).\n *\n * Advanced JSON forms (ajf) is free software: you can redistribute it and/or\n * modify it under the terms of the GNU Affero General Public License as\n * published by the Free Software Foundation, either version 3 of the License,\n * or (at your option) any later version.\n *\n * Advanced JSON forms (ajf) is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero\n * General Public License for more details.\n *\n * You should have received a copy of the GNU Affero General Public License\n * along with Advanced JSON forms (ajf).\n * If not, see http://www.gnu.org/licenses/.\n *\n */\n\nimport {AjfStyles} from '../interface/styles';\n\nexport const slideTitleStyle: AjfStyles = {\n  width: '100%',\n  dislay: 'block',\n  marginTop: '30px',\n};\nexport const widgetTitleStyle: AjfStyles = {\n  width: '100%',\n  dislay: 'block',\n  borderTop: '1px dashed gray',\n  marginTop: '15px',\n  padding: '10px',\n  paddingTop: '20px',\n  maxHeight: '600px',\n};\nexport const boxStyle: AjfStyles = {\n  dislay: 'block',\n  padding: '10px',\n};\nexport const indicatorStyle: AjfStyles = {\n  fontSize: '30px',\n};\nexport const widgetStyle: AjfStyles = {\n  border: '1px dotted gray',\n  borderRadius: '6px',\n  marginBottom: '10px',\n};\nexport const chartStyle: AjfStyles = {\n  ...widgetStyle,\n  width: '100%',\n  maxWidth: '1000px',\n  margin: '10px auto',\n}\nconst bgColor = [\n  'rgba(54, 162, 235, 0.6)', // blue\n  'rgba(255, 99, 132, 0.6)', // red\n  'rgba(255, 159, 64, 0.6)', // orange\n  'rgba(255, 205, 86, 0.6)', // yellow\n  'rgba(75, 192, 192, 0.6)', // green\n  'rgba(153, 102, 255, 0.6)', // purple\n  'rgba(201, 203, 207, 0.6)' // grey\n];\nexport const backgroundColor: string[] = [];\nfor (let i = 0; i < 10; i++) {\n  backgroundColor.push(...bgColor);\n}\n","/**\n * @license\n * Copyright (C) Gnucoop soc. coop.\n *\n * This file is part of the Advanced JSON forms (ajf).\n *\n * Advanced JSON forms (ajf) is free software: you can redistribute it and/or\n * modify it under the terms of the GNU Affero General Public License as\n * published by the Free Software Foundation, either version 3 of the License,\n * or (at your option) any later version.\n *\n * Advanced JSON forms (ajf) is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero\n * General Public License for more details.\n *\n * You should have received a copy of the GNU Affero General Public License\n * along with Advanced JSON forms (ajf).\n * If not, see http://www.gnu.org/licenses/.\n *\n */\n\nimport {\n  AjfField,\n  AjfFieldType,\n  AjfFieldWithChoices,\n  AjfForm,\n  AjfFormSerializer,\n  AjfNodeType,\n  AjfRangeField,\n} from '@ajf/core/forms';\nimport {createFormula} from '@ajf/core/models';\n\nimport {AjfChartType} from '../interface/charts/chart-type';\nimport {AjfDataset} from '../interface/dataset/dataset';\nimport {AjfReport} from '../interface/reports/report';\nimport {AjfWidget} from '../interface/widgets/widget';\nimport {AjfWidgetType} from '../interface/widgets/widget-type';\nimport {createDataset} from '../utils/dataset/create-dataset';\nimport {createReportContainer} from '../utils/reports/create-report-container';\nimport {createWidget} from '../utils/widgets/create-widget';\nimport {\n  backgroundColor,\n  boxStyle,\n  chartStyle,\n  indicatorStyle,\n  slideTitleStyle,\n  widgetTitleStyle,\n} from './styles';\n\nfunction createBooleanWidget(field: AjfField, countFunc: string): AjfWidget {\n  return createWidget({\n    widgetType: AjfWidgetType.Chart,\n    type: AjfChartType.Pie,\n    labels: {formula: \"['True', 'False']\"},\n    dataset: [\n      createDataset({\n        label: 'true',\n        formula: [\n          createFormula({\n            formula: `[${countFunc}(dataset, f => f.${field.name} === true), ${countFunc}(dataset, f => f.${field.name} === false)]`,\n          }),\n        ],\n        options: {backgroundColor: [backgroundColor[4], backgroundColor[1]]}, // green, red\n      } as Partial<AjfDataset>),\n    ],\n    options: {\n      responsive: true,\n      maintainAspectRatio: true,\n      legend: {display: true, position: 'bottom'},\n    },\n    styles: chartStyle,\n    exportable: true,\n  });\n}\n\nfunction createMultipleChoiceWidget(field: AjfFieldWithChoices<any>, countFunc: string): AjfWidget {\n  const choices = field.choicesOrigin.choices;\n  let dataset: AjfDataset[] = choices.map((c, index) =>\n    createDataset({\n      label: `${c.label}`,\n      formula: [\n        createFormula({\n          formula: `[${countFunc}(dataset, f => (f.${field.name} || []).indexOf(\"${c.value}\") > -1)]`,\n        }),\n      ],\n      options: {\n        backgroundColor: backgroundColor[index],\n        stack: `Stack ${index}`,\n      },\n    } as Partial<AjfDataset>),\n  );\n\n  let chartType = AjfChartType.Bar;\n  let labels = {formula: `[]`};\n  return createWidget({\n    widgetType: AjfWidgetType.Chart,\n    type: chartType,\n    labels,\n    dataset,\n    options: {\n      responsive: true,\n      maintainAspectRatio: true,\n      legend: {display: true, position: 'bottom'},\n    },\n    styles: chartStyle,\n    exportable: true,\n  });\n}\n\nfunction createIndicator(name: string, value: string): AjfWidget {\n  return createWidget({\n    widgetType: AjfWidgetType.Column,\n    styles: boxStyle,\n    content: [\n      createWidget({\n        widgetType: AjfWidgetType.Text,\n        htmlText: name,\n      }),\n      createWidget({\n        widgetType: AjfWidgetType.Text,\n        htmlText: value,\n        styles: indicatorStyle,\n      }),\n    ],\n  });\n}\n\nfunction createNumberWidget(field: AjfField): AjfWidget {\n  return createWidget({\n    widgetType: AjfWidgetType.Layout,\n    columns: Array(5).fill(1 / 5),\n    content: [\n      createIndicator('Mean', `[[ROUND(MEAN(dataset, \"${field.name}\"), 2)]]`),\n      createIndicator('Median', `[[ROUND(MEDIAN(dataset, \"${field.name}\"), 2)]]`),\n      createIndicator('Mode', `[[ROUND(MODE(dataset, \"${field.name}\"), 2)]]`),\n      createIndicator('Standard Deviation', `[[ROUND(STD(dataset, \"${field.name}\"), 2)]]`),\n      createIndicator('Sum', `[[ROUND(SUM(dataset, \"${field.name}\"), 2)]]`),\n    ],\n  });\n}\n\nfunction createSingleChoiceWidget(field: AjfFieldWithChoices<any>, countFunc: string): AjfWidget {\n  const choices = field.choicesOrigin.choices;\n  let dataset: AjfDataset[] = [];\n  let chartType = AjfChartType.Bar;\n  let labels = {formula: `[]`};\n\n  if (choices.length > 5) {\n    labels = {formula: `[${choices.map(c => `${JSON.stringify(c.label)}`)}]`};\n    chartType = AjfChartType.Pie;\n    dataset = [\n      createDataset({\n        label: field.label,\n        formula: [\n          createFormula({\n            formula: `[${choices\n              .map(choice => `${countFunc}(dataset, f => f.${field.name} === '${choice.value}')`)\n              .toString()}]`,\n          }),\n        ],\n        options: {backgroundColor},\n      } as Partial<AjfDataset>),\n    ];\n  } else {\n    dataset = choices.map((c, index) =>\n      createDataset({\n        label: `${c.label}`,\n        formula: [\n          createFormula({\n            formula: `[${countFunc}(dataset, f => f.${field.name} === '${c.value}')]`,\n          }),\n        ],\n        options: {\n          backgroundColor: backgroundColor[index],\n          stack: `Stack ${index}`,\n        },\n      } as Partial<AjfDataset>),\n    );\n  }\n\n  return createWidget({\n    widgetType: AjfWidgetType.Chart,\n    type: chartType,\n    labels,\n    dataset,\n    options: {\n      responsive: true,\n      maintainAspectRatio: true,\n      legend: {display: true, position: 'bottom'},\n    },\n    styles: chartStyle,\n    exportable: true,\n  });\n}\n\nfunction createRangeWidget(field: AjfRangeField, countFunc: string): AjfWidget {\n  const end = field.end ?? 11;\n  const start = field.start ?? 1;\n  let choices = [];\n  for (let i = start; i <= end; i++) {\n    choices.push(i);\n  }\n\n  let labels = {formula: `[${JSON.stringify(field.label)}]`};\n  let dataset: AjfDataset[] = choices.map((_, index) =>\n    createDataset({\n      label: `${index + start}`,\n      formula: [\n        createFormula({\n          formula: `[${countFunc}(dataset, f => f.${field.name} === ${index + start})]`,\n        }),\n      ],\n      options: {\n        backgroundColor: backgroundColor[index],\n        stack: `Stack ${index}`,\n      },\n    } as Partial<AjfDataset>),\n  );\n  return createWidget({\n    widgetType: AjfWidgetType.Column,\n    content: [\n      createWidget({\n        widgetType: AjfWidgetType.Layout,\n        columns: Array(5).fill(1 / 5),\n        content: [\n          createIndicator('Mean', `[[ROUND(MEAN(dataset, \"${field.name}\"), 2)]]`),\n          createIndicator('Median', `[[ROUND(MEDIAN(dataset, \"${field.name}\"), 2)]]`),\n          createIndicator('Mode', `[[ROUND(MODE(dataset, \"${field.name}\"), 2)]]`),\n          createIndicator('Standard Deviation', `[[ROUND(STD(dataset, \"${field.name}\"), 2)]]`),\n          createIndicator('Sum', `[[ROUND(SUM(dataset, \"${field.name}\"), 2)]]`),\n        ],\n      }),\n      createWidget({\n        widgetType: AjfWidgetType.Chart,\n        type: AjfChartType.Bar,\n        labels,\n        dataset,\n        options: {\n          responsive: true,\n          maintainAspectRatio: true,\n          legend: {display: true, position: 'bottom'},\n        },\n        styles: chartStyle,\n        exportable: true,\n      }),\n    ],\n  });\n}\n\n/**\n * This function returns a basic report for any form passed in input.\n *\n * @param form the form schema\n * @param id? the id of the form inside the platform.\n */\nexport function automaticReport(formSchema: {schema: Partial<AjfForm>; id?: string}): AjfReport {\n  const form = AjfFormSerializer.fromJson(formSchema.schema);\n  const report: AjfReport = {};\n  const reportWidgets: AjfWidget[] = [];\n\n  report.variables = [];\n  // we assume that the array of forms passed to the report is called 'forms'.\n  if (formSchema.id != null) {\n    report.variables = [{name: 'forms', formula: {formula: `forms['${formSchema.id}']`}}];\n  }\n  report.variables.push({name: 'dataset', formula: {formula: 'BUILD_DATASET(forms)'}});\n\n  for (const slide of form.nodes) {\n    const countFunc =\n      slide.nodeType === AjfNodeType.AjfRepeatingSlide ? 'COUNT_REPS' : 'COUNT_FORMS';\n    const slideWidgets: AjfWidget[] = [];\n\n    for (const field of slide.nodes as AjfField[]) {\n      const fieldTitleWidget: AjfWidget = createWidget({\n        widgetType: AjfWidgetType.Text,\n        htmlText: `<h4>${field.label} - [[${countFunc}(dataset, f => f.${field.name} != null)]] answers</h4>`,\n        styles: widgetTitleStyle,\n      });\n      slideWidgets.push(fieldTitleWidget);\n\n      switch (field.fieldType) {\n        case AjfFieldType.Number:\n        case AjfFieldType.Formula:\n          slideWidgets.push(createNumberWidget(field));\n          break;\n        case AjfFieldType.Boolean:\n          slideWidgets.push(createBooleanWidget(field, countFunc));\n          break;\n        case AjfFieldType.SingleChoice:\n          slideWidgets.push(createSingleChoiceWidget(field, countFunc));\n          break;\n        case AjfFieldType.MultipleChoice:\n          slideWidgets.push(createMultipleChoiceWidget(field, countFunc));\n          break;\n        case AjfFieldType.Range:\n          slideWidgets.push(createRangeWidget(field, countFunc));\n          break;\n        default:\n          slideWidgets.pop(); // remove the title of empty widget\n      }\n    }\n    if (slideWidgets.length > 0) {\n      const slideTitleWidget: AjfWidget = createWidget({\n        widgetType: AjfWidgetType.Text,\n        htmlText: `<h1>${slide.label}</h1>`,\n        styles: slideTitleStyle,\n      });\n      reportWidgets.push(slideTitleWidget, ...slideWidgets);\n    }\n  }\n\n  report.content = createReportContainer({content: [...reportWidgets], styles: {}});\n\n  return report;\n}\n","/**\n * @license\n * Copyright (C) Gnucoop soc. coop.\n *\n * This file is part of the Advanced JSON forms (ajf).\n *\n * Advanced JSON forms (ajf) is free software: you can redistribute it and/or\n * modify it under the terms of the GNU Affero General Public License as\n * published by the Free Software Foundation, either version 3 of the License,\n * or (at your option) any later version.\n *\n * Advanced JSON forms (ajf) is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero\n * General Public License for more details.\n *\n * You should have received a copy of the GNU Affero General Public License\n * along with Advanced JSON forms (ajf).\n * If not, see http://www.gnu.org/licenses/.\n *\n */\n\nconst enum TokenType {\n  END,\n  LParen,\n  RParen,\n  LBracket,\n  RBracket,\n  Comma,\n\n  // Binary operators from Plus to GreaterOrEq have the same representation\n  // in indicator formulas and JavaScript and don't need a translation.\n  Plus,\n  Minus,\n  Mul,\n  Div,\n  Less,\n  LessOrEq,\n  Greater,\n  GreaterOrEq,\n\n  Equal,\n  NotEqual,\n  Not,\n  String,\n  Number,\n  Ident,\n  Field, // an identifier starting with $\n}\n\ninterface Token {\n  type: TokenType;\n  text: string;\n}\n\n// firstToken returns the first token in s.\n// s must not begin with whitespace characters.\nfunction firstToken(s: string): Token {\n  if (s.length === 0) {\n    return {type: TokenType.END, text: ''};\n  }\n  let m: RegExpMatchArray | null;\n  const c = s.charAt(0);\n  switch (c) {\n    case '(':\n      return {type: TokenType.LParen, text: '('};\n    case ')':\n      return {type: TokenType.RParen, text: ')'};\n    case '[':\n      return {type: TokenType.LBracket, text: '['};\n    case ']':\n      return {type: TokenType.RBracket, text: ']'};\n    case ',':\n      return {type: TokenType.Comma, text: ','};\n    case '+':\n      return {type: TokenType.Plus, text: '+'};\n    case '-':\n      return {type: TokenType.Minus, text: '-'};\n    case '*':\n      return {type: TokenType.Mul, text: '*'};\n    case '/':\n      return {type: TokenType.Div, text: '/'};\n    case '<':\n      if (s.length > 1 && s.charAt(1) === '=') {\n        return {type: TokenType.LessOrEq, text: '<='};\n      }\n      return {type: TokenType.Less, text: '<'};\n    case '>':\n      if (s.length > 1 && s.charAt(1) === '=') {\n        return {type: TokenType.GreaterOrEq, text: '>='};\n      }\n      return {type: TokenType.Greater, text: '>'};\n    case '=':\n      return {type: TokenType.Equal, text: '='};\n    case '!':\n      if (s.length > 1 && s.charAt(1) === '=') {\n        return {type: TokenType.NotEqual, text: '!='};\n      }\n      return {type: TokenType.Not, text: '!'};\n    case '$':\n      m = s.match(/^\\$[a-zA-Z_]\\w*/);\n      if (m === null) {\n        throw new Error('invalid field name in: ' + s);\n      }\n      return {type: TokenType.Field, text: m[0]};\n    case '\"':\n      m = s.match(/^\"(\\\\\\\\|\\\\\"|[^\"])*\"/);\n      if (m === null) {\n        throw new Error('unterminated string literal in: ' + s);\n      }\n      return {type: TokenType.String, text: m[0]};\n    case \"'\":\n      m = s.match(/^'(\\\\\\\\|\\\\'|[^'])*'/);\n      if (m === null) {\n        throw new Error('unterminated string literal in: ' + s);\n      }\n      return {type: TokenType.String, text: m[0]};\n  }\n  if (c >= '0' && c <= '9') {\n    m = s.match(/^\\d+(\\.\\d+)?([eE][\\+\\-]?\\d+)?/);\n    if (m === null) {\n      throw new Error('impossible');\n    }\n    return {type: TokenType.Number, text: m[0]};\n  }\n  m = s.match(/^[a-zA-Z_]\\w*/);\n  if (m !== null) {\n    return {type: TokenType.Ident, text: m[0]};\n  }\n  if (s.match(/^\\s/) !== null) {\n    throw new Error('string s has a leading whitespace');\n  }\n  throw new Error('unrecognized token in: ' + s);\n}\n\nfunction tokenize(s: string): Token[] {\n  const toks: Token[] = [];\n  while (true) {\n    s = s.trim();\n    const t = firstToken(s);\n    toks.push(t);\n    if (t.type === TokenType.END) {\n      return toks;\n    }\n    s = s.slice(t.text.length);\n  }\n}\n\nexport function indicatorToJs(formula: string): string {\n  switch (typeof formula) {\n    case 'string':\n      if (formula.startsWith('js:')) {\n        return formula.slice(3).trim();\n      }\n      break;\n    case 'number':\n    case 'boolean':\n      formula = String(formula);\n      break;\n    default:\n      throw new Error('formula is not a string');\n  }\n  return parseExpression(tokenize(formula).reverse(), TokenType.END);\n}\n\nfunction unexpectedTokenError(tok: Token, rest: Token[]): Error {\n  if (tok.type === TokenType.END) {\n    return new Error('unexpected end of token stream');\n  }\n  rest.push(tok);\n  return new Error('unexpected token at the start of: ' + printTokens(rest));\n}\n\nfunction printTokens(revToks: Token[]) {\n  let s = '';\n  while (revToks.length > 0) {\n    const tok = revToks.pop() as Token;\n    if (tok.type >= TokenType.Plus && tok.type <= TokenType.NotEqual) {\n      // binary operators\n      s += ' ' + tok.text + ' ';\n    } else if (tok.type === TokenType.Comma) {\n      s += ', ';\n    } else {\n      s += tok.text;\n    }\n  }\n  return s;\n}\n\nfunction consume(revToks: Token[], expectedType: TokenType): Token {\n  const tok = revToks.pop() as Token;\n  if (tok.type !== expectedType) {\n    throw unexpectedTokenError(tok, revToks);\n  }\n  return tok;\n}\n\n// parseExpression parses the first expression in revToks\n// and returns its JavaScript/ajf translation.\n// revToks is reversed, the first token of the expression being at index length-1;\n// this way, tokens can be consumed efficiently with revToks.pop().\n// After the expression, the function expects to find the token expectedEnd.\nfunction parseExpression(revToks: Token[], expectedEnd: TokenType): string {\n  if (\n    expectedEnd !== TokenType.END &&\n    expectedEnd !== TokenType.RParen &&\n    expectedEnd !== TokenType.Comma &&\n    expectedEnd !== TokenType.RBracket\n  ) {\n    throw new Error('invalid expectedEnd');\n  }\n\n  let js = '';\n  while (true) {\n    // Expression.\n    let tok = revToks.pop() as Token;\n    let next: Token;\n    switch (tok.type) {\n      case TokenType.Ident:\n        next = revToks[revToks.length - 1];\n        if (next.type === TokenType.LParen) {\n          js += parseFunctionCall(tok.text, revToks);\n        } else if (next.type === TokenType.LBracket) {\n          consume(revToks, TokenType.LBracket);\n          const index = parseExpression(revToks, TokenType.RBracket);\n          consume(revToks, TokenType.RBracket);\n          js += `${tok.text}[${index}]`;\n        } else {\n          js += tok.text;\n        }\n        break;\n      case TokenType.Field:\n        js += 'form.' + tok.text.slice('$'.length);\n        break;\n      case TokenType.String:\n      case TokenType.Number:\n        js += tok.text;\n        break;\n      case TokenType.Plus:\n      case TokenType.Minus:\n        next = revToks[revToks.length - 1];\n        if (next.type === TokenType.Plus || next.type === TokenType.Minus) {\n          throw unexpectedTokenError(revToks.pop() as Token, revToks);\n        }\n        js += tok.text;\n        continue;\n      case TokenType.Not:\n        js += '!';\n        continue;\n      case TokenType.LParen:\n        js += '(' + parseExpression(revToks, TokenType.RParen) + ')';\n        consume(revToks, TokenType.RParen);\n        break;\n      case TokenType.LBracket:\n        js += '[' + parseList(revToks, TokenType.RBracket) + ']';\n        consume(revToks, TokenType.RBracket);\n        break;\n      default:\n        throw unexpectedTokenError(tok, revToks);\n    }\n\n    // Possible end of expression. expectedEnd can be:\n    // END,\n    // RParen for expressions between parentheses,\n    // Comma for function arguments, in which case we also accept RParen,\n    // RBracket for array elements,  in which case we also accept Comma.\n    // Note that we don't consume the end token.\n    const type = revToks[revToks.length - 1].type;\n    if (\n      type === expectedEnd ||\n      (expectedEnd === TokenType.Comma && type === TokenType.RParen) ||\n      (expectedEnd === TokenType.RBracket && type === TokenType.Comma)\n    ) {\n      return js;\n    }\n\n    // Operator.\n    tok = revToks.pop() as Token;\n    if (tok.type >= TokenType.Plus && tok.type <= TokenType.GreaterOrEq) {\n      js += ' ' + tok.text + ' ';\n      continue;\n    }\n    switch (tok.type) {\n      case TokenType.Ident:\n        if (tok.text === 'AND') {\n          js += ' && ';\n          break;\n        }\n        if (tok.text === 'OR') {\n          js += ' || ';\n          break;\n        }\n        throw unexpectedTokenError(tok, revToks);\n      case TokenType.Equal:\n        js += ' == ';\n        break;\n      case TokenType.NotEqual:\n        js += ' != ';\n        break;\n      default:\n        throw unexpectedTokenError(tok, revToks);\n    }\n  }\n}\n\n// parseList parses a comma-separated list of expressions.\n// expectedEnd is Comma for function arguments and RBracket for arrays,\n// according to the behavior of parseExpression.\nfunction parseList(revToks: Token[], expectedEnd: TokenType): string {\n  if (expectedEnd !== TokenType.Comma && expectedEnd !== TokenType.RBracket) {\n    throw new Error('invalid expectedEnd');\n  }\n  let next = revToks[revToks.length - 1];\n  if (next.type === TokenType.RParen || next.type === TokenType.RBracket) {\n    // empty list\n    return '';\n  }\n  let js = '';\n  while (true) {\n    js += parseExpression(revToks, expectedEnd);\n    next = revToks[revToks.length - 1];\n    if (next.type === TokenType.RParen || next.type === TokenType.RBracket) {\n      return js;\n    }\n    consume(revToks, TokenType.Comma);\n    js += ', ';\n  }\n}\n\n// parseFunctionCall parses a function call expression.\n// The list of supported functions is in\n//   projects/core/models/utils/expression-utils.ts\n// The function name has already been scanned.\nfunction parseFunctionCall(name: string, revToks: Token[]): string {\n  const args = functionArgs[name];\n  if (args) {\n    return parseFunctionWithArgs(name, revToks, args);\n  }\n  if (name === 'IF') {\n    consume(revToks, TokenType.LParen);\n    let js = '(' + parseExpression(revToks, TokenType.Comma) + ' ? ';\n    consume(revToks, TokenType.Comma);\n    js += parseExpression(revToks, TokenType.Comma) + ' : ';\n    consume(revToks, TokenType.Comma);\n    js += parseExpression(revToks, TokenType.Comma) + ')';\n    consume(revToks, TokenType.RParen);\n    return js;\n  }\n  throw new Error('unsupported function: ' + name);\n}\n\n/*\n  Parses a function call expression.\n  args tells how many arguments the function takes and their type.\n  For example, the indicator function\n    SUM(forms[0], $age, $gender = \"male\")\n  can be parsed with\n    parseFunctionWithArgs('SUM', revToks, ['arg', 'field', 'func(form)?'])\n  resulting in the following JavaScript:\n    SUM(forms[0], 'age', (form) => form.gender === \"male\")\n*/\nfunction parseFunctionWithArgs(name: string, revToks: Token[], args: string[]): string {\n  consume(revToks, TokenType.LParen);\n  let argsJs = '';\n  for (let i = 0; i < args.length; i++) {\n    let argType = args[i];\n    if (argType.endsWith('?') && revToks[revToks.length - 1].type === TokenType.RParen) {\n      break;\n    }\n    if (argType.endsWith('?')) {\n      argType = argType.slice(0, -1);\n    }\n    if (i !== 0) {\n      consume(revToks, TokenType.Comma);\n      argsJs += ', ';\n    }\n    let argJs = parseExpression(revToks, TokenType.Comma);\n    if (argType === 'field' && isField(argJs)) {\n      argJs = \"'\" + argJs.slice('form.'.length) + \"'\";\n    } else if (argType.startsWith('func')) {\n      argJs = argType.slice('func'.length) + ' => ' + argJs;\n    }\n    argsJs += argJs;\n  }\n  consume(revToks, TokenType.RParen);\n  return `${name}(${argsJs})`;\n}\n\nfunction isField(js: string): boolean {\n  return /^form\\.[a-zA-Z_]\\w*$/.test(js);\n}\n\nconst functionArgs: {[name: string]: string[]} = {\n  ADD_DAYS: [\"arg\", \"arg\"],\n  ALL_VALUES_OF: [\"arg\", \"field\", \"func(form)?\"],\n  APPLY_LABELS: [\"arg\", \"arg\", \"arg\"],\n  APPLY: [\"arg\", \"field\", \"func(form)\"],\n  BUILD_DATASET: [\"arg\", \"arg?\"],\n  CHART_TO_DATA: [\"arg\", \"arg\"],\n  COMPARE_DATE: [\"arg\", \"arg\", \"arg\", \"arg?\"],\n  CONCAT: [\"arg\", \"arg\"],\n  CONSOLE_LOG: [\"arg\"],\n  COUNT_FORMS: [\"arg\", \"func(form)?\"],\n  COUNT_REPS: [\"arg\", \"func(form)?\"],\n  DAYS_DIFF: [\"arg\", \"arg\"],\n  FILTER_BY: [\"arg\", \"func(form)\"],\n  FIRST: [\"arg\", \"func(form)\", \"field?\"],\n  FLATTEN_REPS: [\"arg\", \"arg\"],\n  FORMAT_TABLE_ROWS: [\"arg\"],\n  FORMAT_TABLE_COLS: [\"arg\"],\n  FORMAT_TABLE_FIELDS: [\"arg\", \"arg\"],\n  FROM_REPS: [\"arg\", \"func(form)\"],\n  GET_AGE: [\"arg\", \"arg?\"],\n  GET_LABELS: [\"arg\", \"arg\"],\n  INCLUDES: [\"arg\", \"arg\"],\n  IS_AFTER: [\"arg\", \"arg\"],\n  IS_BEFORE: [\"arg\", \"arg\"],\n  IS_WITHIN_INTERVAL: [\"arg\", \"arg\", \"arg\"],\n  JOIN_FORMS: [\"arg\", \"arg\", \"field\", \"field?\"],\n  JOIN_REPEATING_SLIDES: [\"arg\", \"arg\", \"field\", \"field\", \"field\", \"field?\"],\n  LAST: [\"arg\", \"func(form)\", \"field?\"],\n  LEN: [\"arg\"],\n  MAP: [\"arg\", \"func(elem)\"],\n  MIN: [\"arg\", \"field\", \"func(form)?\"],\n  MAX: [\"arg\", \"field\", \"func(form)?\"],\n  MEAN: [\"arg\", \"field\", \"func(form)?\"],\n  MEDIAN: [\"arg\", \"field\", \"func(form)?\"],\n  MODE: [\"arg\", \"field\", \"func(form)?\"],\n  OP: [\"arg\", \"arg\", \"func(elemA, elemB)\"],\n  PERCENT: [\"arg\", \"arg\"],\n  PERCENTAGE_CHANGE: [\"arg\", \"arg\"],\n  PROMPT_RESULT: [\"arg\", \"arg\"],\n  REMOVE_DUPLICATES: [\"arg\"],\n  ROUND: [\"arg\", \"arg?\"],\n  SUM: [\"arg\", \"field\", \"func(form)?\"],\n  TODAY: [],\n};\n","/**\n * @license\n * Copyright (C) Gnucoop soc. coop.\n *\n * This file is part of the Advanced JSON forms (ajf).\n *\n * Advanced JSON forms (ajf) is free software: you can redistribute it and/or\n * modify it under the terms of the GNU Affero General Public License as\n * published by the Free Software Foundation, either version 3 of the License,\n * or (at your option) any later version.\n *\n * Advanced JSON forms (ajf) is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero\n * General Public License for more details.\n *\n * You should have received a copy of the GNU Affero General Public License\n * along with Advanced JSON forms (ajf).\n * If not, see http://www.gnu.org/licenses/.\n *\n */\n\nimport {AjfStyles} from '../interface/styles';\n\nexport const slideTitleStyle: AjfStyles = {\n  width: '100%',\n  dislay: 'block',\n  border: '1px solid gray',\n  margin: '10px 10px 0px 10px',\n  padding: '10px',\n  backgroundColor: 'white',\n};\nexport const slideContentStyle: AjfStyles = {\n  with: '100%',\n  dislay: 'block',\n  border: '1px solid gray',\n  margin: '0px 10px 10px 50px',\n  padding: '10px',\n  backgroundColor: 'white',\n};\nexport const widgetTitleStyle: AjfStyles = {\n  width: '100%',\n  dislay: 'block',\n  padding: '10px',\n  maxHeight: '600px',\n  backgroundColor: 'white',\n};\nexport const htmlWidget: AjfStyles = {\n  width: '100%',\n  dislay: 'block',\n  padding: '10px',\n  backgroundColor: 'white',\n  marginBottom: '10px',\n};\nexport const boxStyle: AjfStyles = {\n  dislay: 'block',\n  padding: '10px',\n  width: '100%',\n  height: '100%',\n};\nexport const widgetStyle: AjfStyles = {\n  border: '1px dotted gray',\n  borderRadius: '6px',\n  marginBottom: '10px',\n};\nconst bgColor = [\n  'rgba(54, 162, 235, 0.6)', // blue\n  'rgba(255, 99, 132, 0.6)', // red\n  'rgba(255, 159, 64, 0.6)', // orange\n  'rgba(255, 205, 86, 0.6)', // yellow\n  'rgba(75, 192, 192, 0.6)', // green\n  'rgba(153, 102, 255, 0.6)', // purple\n  'rgba(201, 203, 207, 0.6)' // grey\n];\nexport const backgroundColor: string[] = [];\nfor (let i = 0; i < 10; i++) {\n  backgroundColor.push(...bgColor);\n}\n","/**\n * @license\n * Copyright (C) Gnucoop soc. coop.\n *\n * This file is part of the Advanced JSON forms (ajf).\n *\n * Advanced JSON forms (ajf) is free software: you can redistribute it and/or\n * modify it under the terms of the GNU Affero General Public License as\n * published by the Free Software Foundation, either version 3 of the License,\n * or (at your option) any later version.\n *\n * Advanced JSON forms (ajf) is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero\n * General Public License for more details.\n *\n * You should have received a copy of the GNU Affero General Public License\n * along with Advanced JSON forms (ajf).\n * If not, see http://www.gnu.org/licenses/.\n *\n */\n\nimport {AjfFormula, createFormula} from '@ajf/core/models';\nimport {deepCopy} from '@ajf/core/utils';\nimport {HttpClient} from '@angular/common/http';\nimport {forkJoin, Observable, of} from 'rxjs';\nimport {map} from 'rxjs/operators';\nimport * as XLSX from 'xlsx';\n\nimport {backgroundColor} from '../automatic-report/styles';\n\nimport {indicatorToJs} from './hindikit-parser';\nimport {htmlWidget, widgetStyle} from './styles';\nimport {createDataset} from '../utils/dataset/create-dataset';\nimport {createReportContainer} from '../utils/reports/create-report-container';\nimport {AjfWidgetCreate, createWidget} from '../utils/widgets/create-widget';\nimport {AjfWidgetType} from '../interface/widgets/widget-type';\nimport {AjfTableDataset} from '../interface/dataset/table-dataset';\nimport {AjfChartDataset} from '../interface/dataset/chart-dataset';\nimport {AjfChartType} from '../interface/charts/chart-type';\nimport {AjfWidget} from '../interface/widgets/widget';\nimport {AjfReport} from '../interface/reports/report';\nimport {AjfReportVariable} from '../interface/reports/report-variable';\nimport {AjfLayoutWidget} from '../interface/widgets/layout-widget';\nimport {AjfColumnWidget} from '../interface/widgets/column-widget';\nimport {AjfGraphNodeDataset} from '../interface/dataset/graph-dataset';\n\n/**\n * This function builds a report from an excel file.\n */\nexport function xlsReport(file: string, http: HttpClient): Observable<AjfReport> {\n  const workbook = XLSX.read(file, {type: 'binary'});\n  const report: AjfReport = {};\n  const reportWidgets: AjfWidget[] = [];\n\n  const variables: AjfReportVariable[] = [];\n  const filters: {[sheetName: string]: Observable<any>} = {};\n  // create filters\n  workbook.SheetNames.forEach((sheetName, index) => {\n    const sheet: XLSX.WorkSheet = workbook.Sheets[sheetName];\n    if (sheetName.includes('filter') && index + 1 < workbook.SheetNames.length) {\n      const nextSheet = sheetName.includes('global')\n        ? 'global_filter'\n        : workbook.SheetNames[index + 1];\n      filters[nextSheet] = _buildFilter(workbook, sheet, http);\n    }\n  });\n\n  const obsFilterValues: Observable<any>[] = Object.values(filters).length\n    ? Object.values(filters)\n    : [of({})];\n  const filterNames: string[] = Object.keys(filters);\n\n  return forkJoin(obsFilterValues).pipe(\n    map(f => {\n      workbook.SheetNames.forEach(sheetName => {\n        const sheet: XLSX.WorkSheet = workbook.Sheets[sheetName];\n        const json = XLSX.utils.sheet_to_json(sheet) as {[key: string]: string}[];\n        if (sheetName === 'variables') {\n          const jsonVars = json.map(\n            jsonVar =>\n              jsonVar as unknown as {\n                name: string;\n                value: string;\n                isAIPrompt?: boolean;\n                __rowNum__: string;\n              },\n          );\n\n          jsonVars\n            .filter(e => e != null && e.name != null && e.name !== '')\n            .forEach(elem => {\n              const r = Number(elem.__rowNum__) + 1;\n              const name = String(elem.name).trim();\n              if (!/^[A-Za-z_][A-Za-z0-9_]*$/.test(name)) {\n                const msg = `Variable name \"${name}\" (row ${r}) is not a valid identifier`;\n                window.alert(msg);\n                throw new Error(msg);\n              }\n              let js: string;\n              try {\n                js = indicatorToJs(elem.value);\n              } catch (err: any) {\n                err = new Error(`Error in variable \"${name}\" (row ${r}): ${err.message}`);\n                window.alert(err.message);\n                throw err;\n              }\n              variables.push({\n                name,\n                formula: {formula: js},\n                isAIPrompt: elem.isAIPrompt,\n              });\n            });\n        } else {\n          const idx = filterNames.indexOf(sheetName);\n\n          if (sheetName.includes('table')) {\n            const tableWidget = _buildTable(sheetName, json);\n            reportWidgets.push(tableWidget);\n          } else if (sheetName.includes('chart')) {\n            const chartWidget = _buildChart(sheetName, json);\n            reportWidgets.push(chartWidget);\n          } else if (sheetName.includes('image')) {\n            const imageWidget = _buildImage(sheetName, json);\n            reportWidgets.push(imageWidget);\n          } else if (sheetName.includes('html')) {\n            const chartWidget = _buildHtml(json);\n            reportWidgets.push(chartWidget);\n          } else if (sheetName.includes('graph')) {\n            const graphWidget = _buildGraph(sheetName, json);\n            reportWidgets.push(graphWidget);\n          } else if (sheetName.includes('heatmap')) {\n            const heatmapWidget = _buildHeatmap(sheetName, json);\n            reportWidgets.push(heatmapWidget);\n          } else if (sheetName.includes('paginatedlist')) {\n            const pagListWidget = _buildPaginatedListTable(sheetName, json);\n            reportWidgets.push(pagListWidget);\n          } else if (sheetName.includes('paginatedDialogList')) {\n            const pagListWidget = _buildPaginatedListTableWithDialog(sheetName, json);\n            reportWidgets.push(pagListWidget);\n          } else if (sheetName.includes('single')) {\n            const singleWidget = _buildSingleIndicator(json);\n            reportWidgets.push(...singleWidget);\n          }\n\n          if (idx >= 0) {\n            reportWidgets[reportWidgets.length - 1].filter = {\n              schema: f[idx] as any,\n            };\n          }\n        }\n      });\n      const globalFilterIdx = filterNames.indexOf('global_filter');\n      const layoutWidget: AjfLayoutWidget = {\n        widgetType: AjfWidgetType.Layout,\n        content: [\n          createWidget({\n            widgetType: AjfWidgetType.Column,\n            content: [...reportWidgets],\n            filter: globalFilterIdx >= 0 ? {schema: f[globalFilterIdx]} : undefined,\n          } as AjfColumnWidget),\n        ],\n        columns: [1],\n        visibility: {\n          condition: 'true',\n        },\n        styles: {},\n      };\n\n      report.variables = variables;\n      report.content = createReportContainer(layoutWidget);\n\n      return report;\n    }),\n  );\n}\n\nfunction _buildFilter(\n  wbook: XLSX.WorkBook,\n  sheet: XLSX.WorkSheet,\n  http: HttpClient,\n): Observable<any> {\n  const data = new FormData();\n  const filterBook: XLSX.WorkBook = deepCopy(wbook);\n  const filterSheet: XLSX.WorkSheet = deepCopy(sheet);\n  const choicesSheet: XLSX.WorkSheet = deepCopy(wbook.Sheets['choices']);\n  filterBook.SheetNames = ['survey', 'choices'];\n  filterBook.Sheets = {survey: filterSheet, choices: choicesSheet};\n  const filterXlsx = XLSX.write(filterBook, {\n    bookType: 'xlsx',\n    type: 'array',\n  });\n  const file = new File([filterXlsx], 'filter.xlsx');\n  data.append('excelFile', file);\n\n  return http.post('https://formconv.herokuapp.com/result.json', data);\n}\n\nfunction alertAndThrow(err: string) {\n  window.alert(err);\n  throw new Error(err);\n}\n\nfunction _buildChart(name: string, sheet: {[key: string]: string}[]): AjfWidget {\n  if (sheet == null || sheet.length === 0) {\n    alertAndThrow('Empty sheet for chart ' + name);\n  }\n  const data = sheet[0];\n  const optionsNames = [\n    'chartType',\n    'title',\n    'stacked',\n    'beginAtZeroX',\n    'beginAtZeroY',\n    'axisLabelX',\n    'axisLabelY',\n    'axisMinX',\n    'axisMinY',\n    'axisMaxX',\n    'axisMaxY',\n    'removeZeroValues',\n    'mainDataNumberThreshold',\n  ];\n  const options: {[key: string]: string} = {};\n  for (const name of optionsNames) {\n    if (data[name] != null) {\n      options[name] = data[name];\n      delete data[name];\n    }\n  }\n  const type = AjfChartType[options['chartType'] as any] as unknown as AjfChartType;\n  if (type == null) {\n    alertAndThrow('Invalid chart type for chart ' + name);\n  }\n  if (type !== AjfChartType.Scatter && type !== AjfChartType.Bubble && sheet.length !== 1) {\n    alertAndThrow(`Chart \"${name}\" must have 1 row of data`);\n  }\n  if (type === AjfChartType.Scatter && sheet.length !== 2) {\n    alertAndThrow(`Scatter chart \"${name}\" must have 2 rows of data`);\n  }\n  if (type === AjfChartType.Bubble && sheet.length !== 3) {\n    alertAndThrow(`Bubble chart \"${name}\" must have 3 rows of data`);\n  }\n  const labels = data['labels'];\n  let labelsFormula: AjfFormula = {formula: '[]'};\n  if (labels != null) {\n    delete data['labels'];\n    let labelsJs = '';\n    try {\n      labelsJs = indicatorToJs(labels);\n    } catch (err: any) {\n      alertAndThrow(`Error in labels of chart ${name}: ${err.message}`);\n    }\n    labelsFormula = {formula: labelsJs};\n  }\n\n  const stacked = Boolean(options['stacked']);\n  const beginAtZeroX = Boolean(options['beginAtZeroX']);\n  const beginAtZeroY = Boolean(options['beginAtZeroY']);\n  const axisLabelX = options['axisLabelX'];\n  const axisLabelY = options['axisLabelY'];\n  const axisMinX = options['axisMinX'];\n  const axisMinY = options['axisMinY'];\n  const axisMaxX = options['axisMaxX'];\n  const axisMaxY = options['axisMaxY'];\n  const removeZeroValues = Boolean(options['removeZeroValues']);\n  const mainDataNumberThreshold =\n    +options['mainDataNumberThreshold'] || +options['mainDataNumberThreshold'] === 0\n      ? +options['mainDataNumberThreshold']\n      : 10;\n\n  const dataset: AjfChartDataset[] = [];\n  Object.keys(data).forEach((key, index) => {\n    let xs = '';\n    try {\n      xs = indicatorToJs(data[key]);\n    } catch (err: any) {\n      alertAndThrow(`Error in X data \"${key}\" of chart \"${name}\": ${err.message}`);\n    }\n    let ys = '';\n    if (type === AjfChartType.Scatter || type === AjfChartType.Bubble) {\n      try {\n        ys = indicatorToJs(sheet[1][key]);\n      } catch (err: any) {\n        alertAndThrow(`Error in Y data \"${key}\" of chart \"${name}\": ${err.message}`);\n      }\n    }\n    let rs = 'undefined';\n    if (type === AjfChartType.Bubble) {\n      try {\n        rs = indicatorToJs(sheet[2][key]);\n      } catch (err: any) {\n        alertAndThrow(`Error in radius data \"${key}\" of chart \"${name}\": ${err.message}`);\n      }\n    }\n    let formula: AjfFormula[];\n    if (type === AjfChartType.Scatter || type === AjfChartType.Bubble) {\n      formula = [createFormula({formula: `buildPointData(${xs}, ${ys}, ${rs})`})];\n    } else {\n      formula = [createFormula({formula: xs})];\n    }\n\n    const multipleColors =\n      type === AjfChartType.Pie ||\n      type === AjfChartType.PolarArea ||\n      type === AjfChartType.Doughnut;\n    const color = multipleColors ? backgroundColor : backgroundColor[index];\n    const datasetOptions: any = {backgroundColor: color, tension: 0};\n    if (type === AjfChartType.Line && !stacked) {\n      datasetOptions.backgroundColor = 'transparent';\n      datasetOptions.borderColor = color;\n      datasetOptions.pointBackgroundColor = color;\n    }\n    dataset.push({\n      ...createDataset({\n        aggregation: {aggregation: 0},\n        formula,\n        label: key,\n      }),\n      options: datasetOptions,\n    } as AjfChartDataset);\n  });\n\n  const scales: Chart.ChartScales = {};\n  if (stacked || beginAtZeroX || axisMinX != null || axisMaxX != null || axisLabelX) {\n    const axisX: Chart.ChartXAxe = {\n      stacked,\n      ticks: {beginAtZero: beginAtZeroX},\n    };\n    if (axisMinX != null) {\n      axisX.ticks!.suggestedMin = Number(axisMinX);\n    }\n    if (axisMaxX != null) {\n      axisX.ticks!.suggestedMax = Number(axisMaxX);\n    }\n    if (axisLabelX) {\n      axisX.scaleLabel = {display: true, labelString: axisLabelX};\n    }\n    scales.xAxes = [axisX];\n  }\n  if (stacked || beginAtZeroY || axisMinY != null || axisMaxY != null || axisLabelY) {\n    const axisY: Chart.ChartYAxe = {\n      stacked,\n      ticks: {beginAtZero: stacked || beginAtZeroY},\n    };\n    if (axisMinY != null) {\n      axisY.ticks!.suggestedMin = Number(axisMinY);\n    }\n    if (axisMaxY != null) {\n      axisY.ticks!.suggestedMax = Number(axisMaxY);\n    }\n    if (axisLabelY) {\n      axisY.scaleLabel = {display: true, labelString: axisLabelY};\n    }\n    scales.yAxes = [axisY];\n  }\n  return createWidget({\n    name,\n    widgetType: AjfWidgetType.Chart,\n    type,\n    labels: labelsFormula,\n    dataset,\n    options: {\n      responsive: true,\n      maintainAspectRatio: true,\n      legend: {display: true, position: 'bottom'},\n      title: {\n        display: true,\n        text: options['title'] || '',\n      },\n      scales,\n    },\n    styles: {\n      ...widgetStyle,\n      ...{width: '100%', maxWidth: '1000px', margin: '10px auto'},\n    },\n    exportable: true,\n    mainDataNumberThreshold: mainDataNumberThreshold,\n    removeZeroValues: removeZeroValues,\n  } as AjfWidgetCreate);\n}\n\nfunction _buildGraph(name: string, json: {[key: string]: string}[]): AjfWidget {\n  const nodes: AjfGraphNodeDataset[] = [];\n\n  json.forEach(row => {\n    const rowKeys = Object.keys(row);\n    if (rowKeys.includes('id') && row['id']) {\n      const rowId = row['id'].trim().replace(/\"/g, '');\n      if (rowId && rowId.length) {\n        let graphNodeObj: {[key: string]: any} = {};\n        rowKeys.forEach(rowKey => {\n          let js: string;\n          try {\n            js = indicatorToJs(row[rowKey]);\n          } catch (err: any) {\n            const rowNum = Number(row['__rowNum__']) + 1;\n            err = new Error(\n              `Error in \"${name}\", row ${rowNum}, column \"${rowKey}\": ${err.message}`,\n            );\n            window.alert(err.message);\n            throw err;\n          }\n          graphNodeObj[rowKey] = js;\n        });\n        graphNodeObj['id'] = rowId;\n        nodes.push(graphNodeObj as AjfGraphNodeDataset);\n      }\n    }\n  });\n\n  return createWidget({\n    widgetType: AjfWidgetType.Graph,\n    nodes,\n    styles: {},\n  } as AjfWidgetCreate);\n}\n\nfunction _buildImage(sheetName: string, rows: {[key: string]: string}[]): AjfWidget {\n  if (rows.length === 0 || !rows[0]['url']) {\n    const msg = `Image \"${sheetName}\" has no url`;\n    window.alert(msg);\n    throw new Error(msg);\n  }\n  const row = rows[0];\n  let urlFormula = String(row['url']);\n  if (urlFormula.startsWith('js:')) {\n    urlFormula = urlFormula.slice(3).trim();\n  } else {\n    urlFormula = `\"${urlFormula}\"`;\n  }\n  const align = (row['align'] || '').trim().toLowerCase();\n  const styles: any = {};\n  if (align === 'left' || align === 'center') {\n    styles.marginRight = 'auto';\n  }\n  if (align === 'right' || align === 'center') {\n    styles.marginLeft = 'auto';\n  }\n  if (row['width']) {\n    styles.width = row['width'];\n  }\n  if (row['height']) {\n    styles.height = row['height'];\n  }\n  return createWidget({\n    widgetType: AjfWidgetType.Image,\n    imageType: 0,\n    url: {formula: urlFormula},\n    styles,\n  });\n}\n\nfunction _buildHtml(json: {[key: string]: string}[]): AjfWidget {\n  const firstRow = json.length > 0 && json[0]['html'] != null ? json[0] : {html: ''};\n\n  return createWidget({\n    widgetType: AjfWidgetType.Text,\n    htmlText: String(firstRow['html']),\n    styles: htmlWidget,\n  });\n}\n\nfunction getTrendWidget(\n  value: string | null,\n  color: string,\n  condition: string,\n  icon: string,\n): AjfWidget {\n  let percValue = `[[${value}]]%`;\n  if (!value) {\n    percValue = '';\n  }\n  return createWidget({\n    widgetType: AjfWidgetType.Text,\n    htmlText: `<i class=\\\"material-icons\\\" style=\\\"vertical-align: bottom; color: ${color}\\\">${icon}</i><span style=\\\"color: ${color}\\\">${percValue}</span>`,\n    styles: {\n      ...htmlWidget,\n      color: color,\n      fontSize: '16px',\n      justifyContent: 'center',\n    },\n    visibility: {\n      condition: condition,\n    },\n  });\n}\n\nfunction _buildSingleIndicator(json: {[key: string]: string}[]): AjfWidget[] {\n  const indicatorWidgets: AjfWidget[] = [];\n  const firstRow = json.length > 0 && json[0]['html'] != null ? json[0] : {html: ''};\n\n  indicatorWidgets.push(\n    createWidget({\n      widgetType: AjfWidgetType.Text,\n      htmlText: String(firstRow['html']),\n      styles: {\n        ...htmlWidget,\n        marginBottom: '0',\n        justifyContent: 'center',\n      },\n    }),\n  );\n\n  let showTrend = false;\n  let marginBottom = '10px';\n  if (firstRow['percentage_change']) {\n    showTrend = true;\n    marginBottom = '0';\n  }\n  indicatorWidgets.push(\n    createWidget({\n      widgetType: AjfWidgetType.Text,\n      htmlText: '[[' + String(firstRow['current_value']) + ']]',\n      styles: {\n        ...htmlWidget,\n        marginBottom,\n        fontSize: '90px',\n        fontWeight: 'bold',\n        lineHeight: '1',\n        justifyContent: 'center',\n      },\n    }),\n  );\n\n  if (showTrend) {\n    indicatorWidgets.push(\n      getTrendWidget(\n        String(firstRow['percentage_change']),\n        'red',\n        `${String(firstRow['percentage_change'])} < 0`,\n        'trending_down',\n      ),\n    );\n\n    indicatorWidgets.push(\n      getTrendWidget(\n        String(firstRow['percentage_change']),\n        'green',\n        `${String(firstRow['percentage_change'])} > 0`,\n        'trending_up',\n      ),\n    );\n\n    indicatorWidgets.push(\n      getTrendWidget(\n        String(firstRow['percentage_change']),\n        'orange',\n        `${String(firstRow['percentage_change'])} == 0`,\n        'trending_flat',\n      ),\n    );\n\n    indicatorWidgets.push(\n      getTrendWidget(null, 'orange', `${String(firstRow['percentage_change'])} === '-'`, 'remove'),\n    );\n  }\n  return indicatorWidgets;\n}\n\nfunction headerFormula(s: string): AjfFormula {\n  s = String(s);\n  if (s.startsWith('js:')) {\n    return {formula: s.slice(3).trim()};\n  }\n  // quote s\n  return {formula: JSON.stringify(s)};\n}\n\nfunction _buildTable(\n  sheetName: string,\n  json: {[key: string]: string | number | boolean}[],\n): AjfWidget {\n  let tableHeader: AjfTableDataset[] = [];\n  let dataRows = '[]';\n  let formula = '';\n  let pageSize = 10;\n  let pagination = false;\n  if (json.length > 1) {\n    const rowspan = 1;\n    const titles = Object.keys(json[0]);\n    const colspanRowValues = Object.values(json[0]).map(v => (v ? v.toString() : ''));\n    const colspans: number[] = colspanRowValues.map(r => +r.charAt(0));\n    const textAlign: string[] = colspanRowValues.map(r => {\n      switch (r.charAt(1)) {\n        case 'l':\n          return 'left';\n        case 'r':\n          return 'right';\n        default:\n          return 'center';\n      }\n    });\n    const sortCols: boolean[] = colspanRowValues.map(r =>\n      r.charAt(2) && r.charAt(2) === 's' ? true : false,\n    );\n    tableHeader = titles.map((title, index) => ({\n      label: '',\n      formula: headerFormula(title),\n      aggregation: {aggregation: 0},\n      colspan: colspans[index],\n      rowspan,\n      sorted: sortCols[index],\n      style: {\n        textAlign: 'center',\n        fontWeight: 'bold',\n        color: 'white',\n        backgroundColor: '#3f51b5',\n        borderBottom: '2px solid #ddd',\n      },\n    }));\n    pagination = json[1]['pagination'] ? (json[1]['pagination'] as boolean) : false;\n\n    if ('dataset' in json[1]) {\n      const dialogFields = json[1]['dialog_fields']\n        ? (json[1]['dialog_fields'] as string).split(',').map(v => v.trim())\n        : [];\n      const dialogLabelFields = json[1]['dialog_fields_labels']\n        ? (json[1]['dialog_fields_labels'] as string).split(',').map(v => v.trim())\n        : [];\n      formula = _buildFormListTable(json, colspans, textAlign, dialogFields, dialogLabelFields);\n      if (dialogFields && dialogFields.length) {\n        tableHeader.push({\n          label: '',\n          formula: {formula: `\" \"`},\n          aggregation: {aggregation: 0},\n          colspan: 1,\n          rowspan,\n          style: {\n            textAlign: 'center',\n            fontWeight: 'bold',\n            color: 'white',\n            backgroundColor: '#3f51b5',\n            borderBottom: '2px solid #ddd',\n          },\n        });\n      }\n    } else {\n      delete json[0];\n      dataRows = '[';\n      json.forEach(row => {\n        let dataRow = '[';\n        titles.forEach(title => {\n          let elem = row[title] || `''`;\n          try {\n            elem = indicatorToJs(elem as string);\n          } catch (err: any) {\n            const rowNum = Number(row['__rowNum__']) + 1;\n            err = new Error(\n              `Error in \"${sheetName}\", row ${rowNum}, column \"${title}\": ${err.message}`,\n            );\n            window.alert(err.message);\n            throw err;\n          }\n          dataRow += elem + ',';\n        });\n        dataRow += ']';\n        dataRows += dataRow + ',';\n      });\n      dataRows += ']';\n      formula = `buildAlignedDataset(plainArray(${dataRows}),${JSON.stringify(\n        colspans,\n      )},${JSON.stringify(textAlign)})`;\n    }\n  }\n\n  if (pagination) {\n    return createWidget({\n      widgetType: AjfWidgetType.PaginatedTable,\n      pageSize: pageSize,\n      rowDefinition: {\n        formula: formula,\n      },\n      dataset: tableHeader,\n      exportable: true,\n      cellStyles: {\n        textAlign: 'center',\n        color: 'black',\n        backgroundColor: 'white',\n      },\n      styles: {\n        borderCollapse: 'collapse',\n      },\n    });\n  } else {\n    return createWidget({\n      widgetType: AjfWidgetType.DynamicTable,\n      rowDefinition: {\n        formula: formula,\n      },\n      dataset: tableHeader,\n      exportable: true,\n      cellStyles: {\n        textAlign: 'center',\n        color: 'black',\n        backgroundColor: 'white',\n      },\n      styles: {\n        borderCollapse: 'collapse',\n      },\n    });\n  }\n}\n\n/**\n * Create a formula for a dynamic table widget, based on a list of Forms\n * @param json\n * @returns the formula for the DynamicTable AjfWidget, like this:\n * buildFormDataset(projectsDataset, ['id_p','donors','budget','dino_area_name','calc_progress',])\"\n */\nfunction _buildFormListTable(\n  json: {[key: string]: string | number | boolean}[],\n  colspans: number[],\n  textAlign: string[],\n  dialogFields: string[],\n  dialogLabelFields: string[],\n): string {\n  let formula = '';\n  if (json.length > 1) {\n    let fields = '[';\n    Object.keys(json[0]).forEach(fieldColName => {\n      let elem = json[1][fieldColName] ? `'${json[1][fieldColName]}'` : `''`;\n      fields += elem + ',';\n    });\n    fields += ']';\n    const dataset = json[1]['dataset'] as string;\n    const linkField = json[1]['link_field'] as string;\n    const linkPos = json[1]['link_position'] ? +json[1]['link_position'] : 0;\n    const rowLink =\n      linkField && linkField.length ? `{'link': '${linkField}', 'position': ${linkPos}}` : null;\n\n    formula = `buildAlignedFormDataset(${dataset}, ${fields}, ${JSON.stringify(\n      colspans,\n    )}, ${JSON.stringify(textAlign)}, ${rowLink}, ${JSON.stringify(dialogFields)}, ${JSON.stringify(\n      dialogLabelFields,\n    )})`;\n  }\n  return formula;\n}\n\n/**\n * Create a widget with a dynamic paginated table based on a list of Forms. Each row is an AjfTable.\n * @param sheetName\n * @param json\n * @returns a Paginated AjfWidget with a formula like this:\n * buildWidgetDataset(projectsDataset, ['id_p','donors','budget','dino_area_name','calc_progress','home_link_text',],\n *   {'link': 'home_link', 'position': 5}, {'border': 'none'},{'width': '900px'}, ['10%','30%','10%','25%','15%','10%'], \\\"#f0f0f0\\\", \\\"white\\\")\"\n */\nfunction _buildPaginatedListTable(_: string, json: {[key: string]: string}[]): AjfWidget {\n  let formula = '';\n  let pageSize = 10;\n  let dataset: string = '';\n  let title = '';\n  if (json.length > 1) {\n    const colsPercentage: string = (Object.values(json[0]) as string[])\n      .map(r => `'${r}%'`)\n      .join(',');\n    const colsPercentageArray = `[${colsPercentage}]`;\n\n    let fields = '[';\n    Object.keys(json[0]).forEach(fieldColName => {\n      let elem = json[1][fieldColName] ? `'${json[1][fieldColName]}'` : `''`;\n      fields += elem + ',';\n    });\n    fields += ']';\n\n    dataset = json[1]['dataset'] as string;\n    title = json[1]['title'] as string;\n    pageSize = json[1]['pageSize'] ? +json[1]['pageSize'] : 10;\n    const linkField = json[1]['link_field'] as string;\n    const linkPos = json[1]['link_position'] ? +json[1]['link_position'] : 0;\n    const rowLink =\n      linkField && linkField.length ? `{'link': '${linkField}', 'position': ${linkPos}}` : null;\n    const cellStyles = json[1]['cellStyles'];\n    const rowStyle = json[1]['rowStyle'];\n    const backgroundColorA = json[1]['backgroundColorA'] as string;\n    const backgroundColorB = json[1]['backgroundColorB'] as string;\n\n    formula =\n      `buildWidgetDataset(${dataset}, ${fields}, ${rowLink}, ${cellStyles},` +\n      `${rowStyle}, ${colsPercentageArray}, ${JSON.stringify(backgroundColorA)}, ${JSON.stringify(\n        backgroundColorB,\n      )})`;\n  }\n  return createWidget({\n    widgetType: AjfWidgetType.PaginatedList,\n    pageSize: pageSize,\n    title: title,\n    contentDefinition: {\n      formula: formula,\n    },\n    exportable: true,\n    styles: {\n      height: '500px',\n    },\n  });\n}\n\n/**\n * Create a widget with a dynamic paginated table based on a list of Forms. Each row is an AjfDialogWidget with an AjfTable\n * that open, on click, a dialog.\n * @param sheetName\n * @param json\n * @returns a Paginated AjfWidget with a formula like this:\n * buildWidgetDatasetWithDialog(projectsDataset, ['id_p','donors','province_choicesLabel','dino_area_name','calc_progress','home_link_text',],\n *  ['id_p','donors','province_choicesLabel','dino_area_name'], ['Codice progetto','Donors','Provinces','Settore di attivita'],\n *  {'border': 'none'},{'width': '900px'}, ['10%','30%','10%','25%','15%','10%'], \\\"#f0f0f0\\\", \\\"white\\\")\n */\nfunction _buildPaginatedListTableWithDialog(_: string, json: {[key: string]: string}[]): AjfWidget {\n  let formula = '';\n  let pageSize = 10;\n  let dataset: string = '';\n  let title = '';\n  if (json.length > 1) {\n    const colsPercentage: string = (Object.values(json[0]) as string[])\n      .map(r => `'${r}%'`)\n      .join(',');\n    const colsPercentageArray = `[${colsPercentage}]`;\n\n    let fields = '[';\n    Object.keys(json[0]).forEach(fieldColName => {\n      let elem = json[1][fieldColName] ? `'${json[1][fieldColName]}'` : `''`;\n      fields += elem + ',';\n    });\n    fields += ']';\n\n    let dialogFields = '[';\n    let dialogLabelFields = '[';\n    if (json.length > 3) {\n      dialogLabelFields += (Object.values(json[2]) as string[]).map(v => `'${v}'`).join(',');\n      dialogFields += (Object.values(json[3]) as string[]).map(v => `'${v}'`).join(',');\n    }\n    dialogFields += ']';\n    dialogLabelFields += ']';\n\n    dataset = json[1]['dataset'] as string;\n    title = json[1]['title'] as string;\n    pageSize = json[1]['pageSize'] ? +json[1]['pageSize'] : 10;\n    const cellStyles = json[1]['cellStyles'];\n    const rowStyle = json[1]['rowStyle'];\n    const backgroundColorA = json[1]['backgroundColorA'] as string;\n    const backgroundColorB = json[1]['backgroundColorB'] as string;\n\n    formula =\n      `buildWidgetDatasetWithDialog(${dataset}, ${fields}, ${dialogFields}, ${dialogLabelFields}, ${cellStyles},` +\n      `${rowStyle}, ${colsPercentageArray}, ${JSON.stringify(backgroundColorA)}, ${JSON.stringify(\n        backgroundColorB,\n      )})`;\n  }\n  return createWidget({\n    widgetType: AjfWidgetType.PaginatedList,\n    pageSize: pageSize,\n    title: title,\n    contentDefinition: {\n      formula: formula,\n    },\n    exportable: true,\n    styles: {\n      height: '500px',\n    },\n  });\n}\n\nconst _buildHeatmap = (_: string, json: {[key: string]: string}[]): AjfWidget => {\n  const defaultFeatures = {\n    type: 'FeatureCollection',\n    features: [],\n  };\n  const options = {\n    values: '[]',\n    idProp: 'id',\n    features: JSON.stringify(defaultFeatures),\n    startColor: '#ffeb3b',\n    endColor: '#f44336',\n    highlightColor: '#009688',\n    showVisualMap: false,\n    ...(json.length > 0 ? json[0] : {}),\n  };\n  return createWidget({\n    widgetType: AjfWidgetType.HeatMap,\n    ...options,\n    values: {formula: options.values},\n    styles: {\n      minHeight: '200px',\n    },\n  });\n};\n","/**\n * @license\n * Copyright (C) Gnucoop soc. coop.\n *\n * This file is part of the Advanced JSON forms (ajf).\n *\n * Advanced JSON forms (ajf) is free software: you can redistribute it and/or\n * modify it under the terms of the GNU Affero General Public License as\n * published by the Free Software Foundation, either version 3 of the License,\n * or (at your option) any later version.\n *\n * Advanced JSON forms (ajf) is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero\n * General Public License for more details.\n *\n * You should have received a copy of the GNU Affero General Public License\n * along with Advanced JSON forms (ajf).\n * If not, see http://www.gnu.org/licenses/.\n *\n */\n\nimport {AjfImageWidgetInstance} from '../interface/widgets-instances/image-widget-instance';\nimport {AjfReportContainerInstance} from '../interface/reports-instances/report-container-instance';\nimport {AjfReportInstance} from '../interface/reports-instances/report-instance';\nimport {AjfWidgetInstance} from '../interface/widgets-instances/widget-instance';\nimport {AjfWidgetType} from '../interface/widgets/widget-type';\nimport {AjfWidgetWithContentInstance} from '../interface/widgets-instances/widget-with-content-instance';\n\nimport {AjfImageType} from '@ajf/core/image';\nimport {AjfTableCell} from '@ajf/core/table';\n\n// ImageMap maps image urls to dataurls, like:\n// 'http://whatever.com/image.png': 'data:image/png;base64,...'\nexport interface ImageMap {\n  [url: string]: string;\n}\n\nexport function loadReportImages(report: AjfReportInstance): Promise<ImageMap> {\n  const promises: Promise<ImageMap>[] = [];\n  if (report.header != null) {\n    promises.push(loadContainerImages(report.header));\n  }\n  if (report.content != null) {\n    promises.push(loadContainerImages(report.content));\n  }\n  if (report.footer != null) {\n    promises.push(loadContainerImages(report.footer));\n  }\n  return new Promise<ImageMap>(resolve => {\n    Promise.all(promises).then(maps => {\n      let map: ImageMap = {};\n      for (const m of maps) {\n        map = {...map, ...m};\n      }\n      resolve(map);\n    });\n  });\n}\n\nfunction loadContainerImages(\n  container: AjfReportContainerInstance | AjfWidgetWithContentInstance,\n): Promise<ImageMap> {\n  const promises: Promise<ImageMap>[] = [];\n  for (let widget of container.content) {\n    promises.push(loadWidgetImages(widget));\n  }\n  return new Promise<ImageMap>(resolve => {\n    Promise.all(promises).then(maps => {\n      let map: ImageMap = {};\n      for (const m of maps) {\n        map = {...map, ...m};\n      }\n      resolve(map);\n    });\n  });\n}\n\nfunction loadWidgetImages(widget: AjfWidgetInstance): Promise<ImageMap> {\n  switch (widget.widgetType) {\n    case AjfWidgetType.Layout:\n    case AjfWidgetType.Column:\n      return loadContainerImages(widget as AjfWidgetWithContentInstance);\n    case AjfWidgetType.Image:\n      const image = widget as AjfImageWidgetInstance;\n      if (image.widget.imageType !== AjfImageType.Image) {\n        break;\n      }\n      if (image.url.startsWith('data:image')) {\n        return Promise.resolve({[image.url]: image.url});\n      }\n      return new Promise<ImageMap>(resolve => {\n        const req = new XMLHttpRequest();\n        req.onerror = () => resolve({}); // ignore 404's\n        req.onload = () => {\n          const r = new FileReader();\n          r.onerror = () => resolve({});\n          r.onloadend = () => {\n            const result = r.result as string;\n            if (result.startsWith('data:image')) {\n              const map: ImageMap = {};\n              map[image.url] = result;\n              resolve(map);\n            } else {\n              resolve({});\n            }\n          };\n          r.readAsDataURL(req.response);\n        };\n        req.open('GET', image.url);\n        req.responseType = 'blob';\n        req.send();\n      });\n  }\n  return new Promise<ImageMap>(resolve => resolve({}));\n}\n\nexport function tableCellText(cell: AjfTableCell): string {\n  switch (typeof cell.value) {\n  case 'number':\n    return String(cell.value);\n  case 'string':\n    return cell.value;\n  case 'object':\n    if (cell.value == null) {\n      return '';\n    }\n    let val = cell.value.changingThisBreaksApplicationSecurity;\n    if (val === undefined) {\n      val = cell.value.toString();\n    }\n    if (typeof val === 'number') {\n      val = String(val);\n    }\n    return val || '';\n  default:\n    if (cell.value == null) {\n      return '';\n    }\n    return String(cell.value);\n  }\n}\n\nexport function stripHTML(s: string): string {\n  s = s.replace(/<\\/?[^>]+(>|$)/g, '');\n  if (!s.includes('&')) {\n    return s;\n  }\n  return s.replaceAll('&nbsp;', ' ')\n    .replaceAll('&lt;', '<')\n    .replaceAll('&gt;', '>')\n    .replaceAll('&#61;', '=')\n    .replaceAll('&#39;', \"'\")\n    .replaceAll('&quot;', '\"')\n    .replaceAll('&amp;', '&');\n}\n","/**\n * @license\n * Copyright (C) Gnucoop soc. coop.\n *\n * This file is part of the Advanced JSON forms (ajf).\n *\n * Advanced JSON forms (ajf) is free software: you can redistribute it and/or\n * modify it under the terms of the GNU Affero General Public License as\n * published by the Free Software Foundation, either version 3 of the License,\n * or (at your option) any later version.\n *\n * Advanced JSON forms (ajf) is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero\n * General Public License for more details.\n *\n * You should have received a copy of the GNU Affero General Public License\n * along with Advanced JSON forms (ajf).\n * If not, see http://www.gnu.org/licenses/.\n *\n */\n\nimport {AjfImageType} from '@ajf/core/image';\nimport {\n  Column,\n  Content,\n  ContentStack,\n  createPdf,\n  PageOrientation,\n  TableCell,\n  TCreatedPdf,\n  TDocumentDefinitions,\n} from '@ajf/core/pdfmake';\nimport {AjfTableCell} from '@ajf/core/table';\nimport {deepCopy} from '@ajf/core/utils';\n\nimport {AjfReportContainerInstance} from '../interface/reports-instances/report-container-instance';\nimport {AjfReportInstance} from '../interface/reports-instances/report-instance';\nimport {AjfChartWidgetInstance} from '../interface/widgets-instances/chart-widget-instance';\nimport {AjfColumnWidgetInstance} from '../interface/widgets-instances/column-widget-instance';\nimport {AjfFormulaWidgetInstance} from '../interface/widgets-instances/formula-widget-instance';\nimport {AjfImageWidgetInstance} from '../interface/widgets-instances/image-widget-instance';\nimport {AjfLayoutWidgetInstance} from '../interface/widgets-instances/layout-widget-instance';\nimport {AjfTableWidgetInstance} from '../interface/widgets-instances/table-widget-instance';\nimport {AjfTextWidgetInstance} from '../interface/widgets-instances/text-widget-instance';\nimport {AjfWidgetInstance} from '../interface/widgets-instances/widget-instance';\nimport {AjfWidgetType} from '../interface/widgets/widget-type';\n\nimport {ImageMap, loadReportImages, stripHTML, tableCellText} from './utils';\n\nconst pageWidth = 800;\nconst pageHeight = pageWidth * 1.4142; // A4 proportions\nconst pageMargins: [number, number] = [40, 60];\n\nexport function openReportPdf(\n  report: AjfReportInstance,\n  orientation: PageOrientation = 'portrait',\n  icons: ImageMap = {},\n  header?: Content[],\n) {\n  createReportPdf(report, orientation, icons, header).then(pdf => {\n    pdf.open();\n  });\n}\n\nexport function createReportPdf(\n  report: AjfReportInstance,\n  orientation: PageOrientation = 'portrait',\n  icons: ImageMap = {},\n  header?: Content[],\n): Promise<TCreatedPdf> {\n  return new Promise<TCreatedPdf>(resolve => {\n    loadReportImages(report).then(images => {\n      let width = pageWidth - pageMargins[0] * 2;\n      if (orientation === 'landscape') {\n        width = pageHeight - pageMargins[1] * 2;\n      }\n      const pdfDef = reportToPdf(report, {...images, ...icons}, width, header);\n      pdfDef.pageSize = {width: pageWidth, height: pageHeight};\n      pdfDef.pageMargins = pageMargins;\n      pdfDef.pageOrientation = orientation;\n      resolve(createPdf(pdfDef));\n    });\n  });\n}\n\nfunction reportToPdf(\n  report: AjfReportInstance,\n  images: ImageMap,\n  width: number,\n  header?: Content[],\n): TDocumentDefinitions {\n  const stack: Content[] = header ? [...header] : [];\n  if (report.header != null) {\n    stack.push(containerToPdf(report.header, images, width));\n  }\n  if (report.content != null) {\n    stack.push(containerToPdf(report.content, images, width));\n  }\n  if (report.footer != null) {\n    stack.push(containerToPdf(report.footer, images, width));\n  }\n  return {content: {stack}};\n}\n\nfunction containerToPdf(\n  container: AjfReportContainerInstance,\n  images: ImageMap,\n  width: number,\n): Content {\n  return {stack: container.content.map(w => widgetToPdf(w, images, width))};\n}\n\nconst marginBetweenWidgets = 10;\n\nfunction widgetToPdf(widget: AjfWidgetInstance, images: ImageMap, width: number): Content {\n  switch (widget.widget.widgetType) {\n    case AjfWidgetType.Layout:\n      return layoutToPdf(widget as AjfLayoutWidgetInstance, images, width);\n    case AjfWidgetType.PageBreak:\n      return {text: '', pageBreak: 'after'};\n    case AjfWidgetType.Image:\n      return imageToPdf(widget as AjfImageWidgetInstance, images, width);\n    case AjfWidgetType.Text:\n      return htmlTextToPdf((widget as AjfTextWidgetInstance).htmlText);\n    case AjfWidgetType.Chart:\n      const chart = widget as AjfChartWidgetInstance;\n      const dataUrl = chart.canvasDataUrl == null ? '' : chart.canvasDataUrl();\n      if (dataUrl === '') {\n        return {text: '[chart with no attached canvas]'};\n      }\n      return {image: dataUrl, width, margin: [0, 0, 0, marginBetweenWidgets]};\n    case AjfWidgetType.Table:\n    case AjfWidgetType.DynamicTable:\n    case AjfWidgetType.PaginatedTable:\n      return tableToPdf(widget as AjfTableWidgetInstance);\n    case AjfWidgetType.Column:\n      const cw = widget as AjfColumnWidgetInstance;\n      return {stack: cw.content.map(w => widgetToPdf(w, images, width))};\n    case AjfWidgetType.Formula:\n      const fw = widget as AjfFormulaWidgetInstance;\n      return {text: fw.formula, margin: [0, 0, 0, marginBetweenWidgets]};\n    default:\n      return {text: ''};\n  }\n}\n\nfunction layoutToPdf(lw: AjfLayoutWidgetInstance, images: ImageMap, width: number): Content {\n  const columns = [...lw.widget.columns];\n  while (columns.length < lw.content.length) {\n    columns.push(1);\n  }\n  const childWidth = width / (columns.length || 1);\n  const children = [];\n  for (let i = 0; i < lw.content.length; i++) {\n    let child = widgetToPdf(lw.content[i], images, childWidth) as ContentStack;\n    // Children of Layout widgets are supposed to be Columns. If they aren't,\n    // we must wrap them to avoid problems like images having an 'auto' width.\n    if (child.stack == null) {\n      child = {stack: [child]};\n    }\n    (child as Column).width = columns[i] === -1 ? 'auto' : '*';\n    children.push(child);\n  }\n  return {columns: children};\n}\n\nfunction imageToPdf(image: AjfImageWidgetInstance, images: ImageMap, width: number): Content {\n  if (image.widget.imageType !== AjfImageType.Image) {\n    // Can't get icons to work, pdfs with multiple fonts don't seem to be working\n    return {text: ''};\n  }\n  const dataUrl = images[image.url];\n  if (dataUrl == null) {\n    return {text: ''};\n  }\n  width /= 2;\n  const w = image.styles['width'];\n  if (typeof w === 'string' && w.endsWith('px')) {\n    width = Number(w.slice(0, -2));\n  }\n  const styles: any = image.styles;\n  let alignment: any = 'left';\n  if (styles.marginLeft === 'auto' && styles.marginRight === 'auto') {\n    alignment = 'center';\n  } else if (styles.marginLeft === 'auto') {\n    alignment = 'right';\n  }\n  return {image: dataUrl, width, alignment, margin: [0, 0, 0, marginBetweenWidgets]};\n}\n\nfunction htmlTextToPdf(htmlText: string): ContentStack {\n  const paragraphs = htmlText.split(/(?=<p|<h1|<h2|<h3|<li)/);\n  return {\n    stack: paragraphs.map(paragraphToPdf),\n    margin: [0, 0, 0, marginBetweenWidgets],\n  };\n}\n\nfunction paragraphToPdf(par: string): Content {\n  let alignment: 'left'|'center'|'right'|'justify'|undefined;\n  if (/^<\\w\\w? align=\"center\"/.test(par)) {\n    alignment = \"center\";\n  } else if (/^<\\w\\w? align=\"right\"/.test(par)) {\n    alignment = \"right\";\n  } else if (/^<\\w\\w? align=\"justify\"/.test(par)) {\n    alignment = \"justify\";\n  }\n\n  let fontSize: number|undefined;\n  if (par.startsWith('<h1')) {\n    fontSize = 20;\n  } else if (par.startsWith('<h2')) {\n    fontSize = 16;\n  } else if (par.startsWith('<h3')) {\n    fontSize = 14;\n  }\n  if (fontSize !== undefined) {\n    return {text: stripHTML(par).trim(), fontSize, alignment, margin: [0, 5, 0, 0]};\n  }\n\n  if (par.startsWith('<li')) {\n    return {ul: [{text: textRuns(par), alignment}]};\n  }\n  return {text: textRuns(par), alignment};\n}\n\nfunction textRuns(par: string): Content[] {\n  const strings = par.split(/(?=<b>|<\\/b>|<i>|<\\/i>|<u>|<\\/u>)/);\n  let bold = false;\n  let italics = false;\n  let decoration: 'underline'|undefined;\n  const runs: Content[] = [];\n  for (let i = 0; i < strings.length; i++) {\n    let s = strings[i];\n    if (s.startsWith('<b>')) {\n      bold = true;\n    } else if (s.startsWith('</b>')) {\n      bold = false;\n    } else if (s.startsWith('<i>')) {\n      italics = true;\n    } else if (s.startsWith('</i>')) {\n      italics = false;\n    } else if (s.startsWith('<u>')) {\n      decoration = 'underline';\n    } else if (s.startsWith('</u>')) {\n      decoration = undefined;\n    }\n    s = stripHTML(s);\n    if (i === 0) {\n      s = s.trimStart();\n    }\n    if (i === strings.length - 1) {\n      s = s.trimEnd();\n    }\n    runs.push({text: s, bold, italics, decoration});\n  }\n  return runs;\n}\n\nfunction tableToPdf(table: AjfTableWidgetInstance): Content {\n  if (table.data == null || table.data.length === 0) {\n    return {text: ''};\n  }\n  const body: TableCell[][] = [];\n  for (const dataRow of expandColAndRowSpan(table.data)) {\n    const bodyRow: TableCell[] = [];\n    for (const cell of dataRow) {\n      const text = tableCellText(cell);\n      const stack = htmlTextToPdf(text);\n      bodyRow.push({...stack, colSpan: cell.colspan, rowSpan: cell.rowspan});\n    }\n    body.push(bodyRow);\n  }\n  return {\n    table: {headerRows: 0, body},\n    margin: [0, 0, 0, marginBetweenWidgets],\n  };\n}\n\n// pdfmake wants placeholder cells after cells with col/rowspan > 1\nfunction expandColAndRowSpan(data: AjfTableCell[][]): AjfTableCell[][] {\n  data = deepCopy(data);\n  // expand colspan:\n  for (const row of data) {\n    for (let j = 0; j < row.length; j++) {\n      const cell = row[j];\n      for (let k = 1; k < (cell.colspan || 1); k++) {\n        row.splice(j + k, 0, {rowspan: cell.rowspan, value: '', style: {}});\n      }\n    }\n  }\n  // expand rowspan:\n  for (let i = 0; i < data.length; i++) {\n    const row = data[i];\n    for (let j = 0; j < row.length; j++) {\n      const cell = row[j];\n      for (let k = 1; k < (cell.rowspan || 1); k++) {\n        data[i + k].splice(j, 0, {value: '', style: {}});\n      }\n    }\n  }\n  return data;\n}\n","/**\n * @license\n * Copyright (C) Gnucoop soc. coop.\n *\n * This file is part of the Advanced JSON forms (ajf).\n *\n * Advanced JSON forms (ajf) is free software: you can redistribute it and/or\n * modify it under the terms of the GNU Affero General Public License as\n * published by the Free Software Foundation, either version 3 of the License,\n * or (at your option) any later version.\n *\n * Advanced JSON forms (ajf) is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero\n * General Public License for more details.\n *\n * You should have received a copy of the GNU Affero General Public License\n * along with Advanced JSON forms (ajf).\n * If not, see http://www.gnu.org/licenses/.\n *\n */\n\nimport {AjfImageType} from '@ajf/core/image';\nimport {\n  AlignmentType,\n  Document,\n  HeadingLevel,\n  ImageRun,\n  PageOrientation,\n  Packer,\n  PageBreak,\n  Paragraph,\n  Table,\n  TableCell,\n  TableRow,\n  TextRun,\n  UnderlineType,\n} from 'docx';\n\nimport {AjfReportInstance} from '../interface/reports-instances/report-instance';\nimport {AjfChartWidgetInstance} from '../interface/widgets-instances/chart-widget-instance';\nimport {AjfFormulaWidgetInstance} from '../interface/widgets-instances/formula-widget-instance';\nimport {AjfImageWidgetInstance} from '../interface/widgets-instances/image-widget-instance';\nimport {AjfTableWidgetInstance} from '../interface/widgets-instances/table-widget-instance';\nimport {AjfTextWidgetInstance} from '../interface/widgets-instances/text-widget-instance';\nimport {AjfWidgetInstance} from '../interface/widgets-instances/widget-instance';\nimport {AjfWidgetType} from '../interface/widgets/widget-type';\n\nimport {ImageMap, loadReportImages, stripHTML, tableCellText} from './utils';\n\nfunction downloadBlob(b: Blob) {\n  const url = URL.createObjectURL(b);\n  const a = document.createElement('a');\n  a.setAttribute('style', 'display: none');\n  a.href = url;\n  a.target = '_blank';\n  a.download = 'report.docx';\n  document.body.appendChild(a);\n  a.click();\n  a.remove();\n  URL.revokeObjectURL(url);\n}\n\nexport function downloadReportDoc(\n  report: AjfReportInstance, header: SectionChild[] = [], orient: PageOrientation = PageOrientation.PORTRAIT\n) {\n  createReportDoc(report, header, orient).then(blob => {\n    downloadBlob(blob);\n  });\n}\n\nexport function createReportDoc(\n  report: AjfReportInstance, header: SectionChild[] = [], orient: PageOrientation = PageOrientation.PORTRAIT\n): Promise<Blob> {\n  return new Promise<Blob>(resolve => {\n    loadReportImages(report).then(images => {\n      const doc = reportToDoc(report, images, header, orient);\n      Packer.toBlob(doc).then(blob => resolve(blob));\n    });\n  });\n}\n\ntype SectionChild = Paragraph | Table;\n\nfunction reportToDoc(\n  report: AjfReportInstance, images: ImageMap, header: SectionChild[], orientation: PageOrientation\n): Document {\n  const width = orientation === PageOrientation.LANDSCAPE ? 13950 : 9000;\n  const children: SectionChild[] = [...header];\n  if (report.header != null) {\n    children.push(...containerToDoc(report.header, images, width));\n  }\n  if (report.content != null) {\n    children.push(...containerToDoc(report.content, images, width));\n  }\n  if (report.footer != null) {\n    children.push(...containerToDoc(report.footer, images, width));\n  }\n  return new Document({sections: [{\n    properties: {page: {size: {orientation}}},\n    children\n  }]});\n}\n\ninterface Container {\n  content: AjfWidgetInstance[];\n}\n\nfunction containerToDoc(container: Container, images: ImageMap, width: number): SectionChild[] {\n  return container.content.map(w => widgetToDoc(w, images, width)).flat();\n}\n\nconst chartSize = {width: 600, height: 300};\n\nfunction imageSize(styles: any) {\n  const size = {width: 300, height: 300};\n  if (typeof styles.width === 'string' && styles.width.endsWith('px')) {\n    size.width = Number(styles.width.slice(0, -2));\n  }\n  if (typeof styles.height === 'string' && styles.height.endsWith('px')) {\n    size.height = Number(styles.height.slice(0, -2));\n  }\n  return size;\n}\n\nfunction widgetToDoc(widget: AjfWidgetInstance, images: ImageMap, width: number): SectionChild[] {\n  const marginBetweenWidgets = new Paragraph('');\n\n  switch (widget.widget.widgetType) {\n    case AjfWidgetType.Layout:\n    case AjfWidgetType.Column:\n      return containerToDoc(widget as Container, images, width);\n    case AjfWidgetType.PageBreak:\n      return [new Paragraph({children: [new PageBreak()]})];\n    case AjfWidgetType.Image:\n      return [imageToDoc(widget as AjfImageWidgetInstance, images), marginBetweenWidgets];\n    case AjfWidgetType.Text:\n      return [...htmlTextToDoc((widget as AjfTextWidgetInstance).htmlText), marginBetweenWidgets];\n    case AjfWidgetType.Chart:\n      const chart = widget as AjfChartWidgetInstance;\n      const dataUrl = chart.canvasDataUrl == null ? '' : chart.canvasDataUrl();\n      if (dataUrl === '') {\n        return [new Paragraph('[chart with no attached canvas]'), marginBetweenWidgets];\n      }\n      return [\n        new Paragraph({\n          alignment: AlignmentType.CENTER,\n          children: [new ImageRun({data: dataUrl, transformation: chartSize})],\n        }),\n        marginBetweenWidgets,\n      ];\n    case AjfWidgetType.Table:\n    case AjfWidgetType.DynamicTable:\n    case AjfWidgetType.PaginatedTable:\n      return [tableToDoc(widget as AjfTableWidgetInstance, width), marginBetweenWidgets];\n    case AjfWidgetType.Formula:\n      return [new Paragraph((widget as AjfFormulaWidgetInstance).formula), marginBetweenWidgets];\n    default:\n      return [];\n  }\n}\n\nfunction imageToDoc(image: AjfImageWidgetInstance, images: ImageMap): Paragraph {\n  if (image.widget.imageType !== AjfImageType.Image) {\n    return new Paragraph('[unsupported image type]');\n  }\n  const dataUrl = images[image.url];\n  if (dataUrl == null) {\n    return new Paragraph(\"[couldn't load image]\");\n  }\n  const styles: any = image.styles;\n  let alignment = AlignmentType.LEFT;\n  if (styles.marginLeft === 'auto' && styles.marginRight === 'auto') {\n    alignment = AlignmentType.CENTER;\n  } else if (styles.marginLeft === 'auto') {\n    alignment = AlignmentType.RIGHT;\n  }\n  const i = dataUrl.indexOf(',');\n  const base64 = dataUrl.slice(i + 1);\n  return new Paragraph({alignment, children: [new ImageRun({\n    data: Uint8Array.from(atob(base64), c => c.charCodeAt(0)),\n    transformation: imageSize(styles),\n  })]});\n}\n\nfunction htmlTextToDoc(htmlText: string): Paragraph[] {\n  const paragraphs = htmlText.split(/(?=<p|<h1|<h2|<h3|<li)/);\n  return paragraphs.map(paragraphToDoc);\n}\n\nfunction paragraphToDoc(par: string): Paragraph {\n  let alignment: AlignmentType|undefined = undefined;\n  if (/^<\\w\\w? align=\"center\"/.test(par)) {\n    alignment = AlignmentType.CENTER;\n  } else if (/^<\\w\\w? align=\"right\"/.test(par)) {\n    alignment = AlignmentType.RIGHT;\n  } else if (/^<\\w\\w? align=\"justify\"/.test(par)) {\n    alignment = AlignmentType.JUSTIFIED;\n  }\n\n  let heading: HeadingLevel|undefined = undefined;\n  if (par.startsWith('<h1')) {\n    heading = HeadingLevel.HEADING_1;\n  } else if (par.startsWith('<h2')) {\n    heading = HeadingLevel.HEADING_2;\n  } else if (par.startsWith('<h3')) {\n    heading = HeadingLevel.HEADING_3;\n  }\n  if (heading !== undefined) {\n    return new Paragraph({text: stripHTML(par).trim(), heading, alignment});\n  }\n\n  let bullet: {level: number}|undefined = undefined;\n  if (par.startsWith('<li')) {\n    bullet = {level: 0};\n  }\n  return new Paragraph({children: textRuns(par), bullet, alignment});\n}\n\nfunction textRuns(par: string): TextRun[] {\n  const strings = par.split(/(?=<b>|<\\/b>|<i>|<\\/i>|<u>|<\\/u>)/);\n  let bold = false;\n  let italics = false;\n  let underline: {type: UnderlineType}|undefined = undefined;\n  const runs: TextRun[] = [];\n  for (let i = 0; i < strings.length; i++) {\n    let s = strings[i];\n    if (s.startsWith('<b>')) {\n      bold = true;\n    } else if (s.startsWith('</b>')) {\n      bold = false;\n    } else if (s.startsWith('<i>')) {\n      italics = true;\n    } else if (s.startsWith('</i>')) {\n      italics = false;\n    } else if (s.startsWith('<u>')) {\n      underline = {type: UnderlineType.SINGLE};\n    } else if (s.startsWith('</u>')) {\n      underline = undefined;\n    }\n    s = stripHTML(s);\n    if (i === 0) {\n      s = s.trimStart();\n    }\n    if (i === strings.length - 1) {\n      s = s.trimEnd();\n    }\n    runs.push(new TextRun({text: s, bold, italics, underline}));\n  }\n  return runs;\n}\n\nfunction tableToDoc(table: AjfTableWidgetInstance, width: number): Table {\n  if (table.data == null || table.data.length === 0) {\n    return new Paragraph('[empty table]');\n  }\n  let numCols = 0;\n  for (const cell of table.data[0]) {\n    numCols += cell.colspan || 1;\n  }\n  return new Table({\n    columnWidths: Array(numCols).fill(width / numCols),\n    rows: table.data.map(row => new TableRow({\n      children: row.map(cell => {\n        const text = tableCellText(cell);\n        const paragraphs = htmlTextToDoc(text);\n        return new TableCell({\n          children: paragraphs,\n          columnSpan: cell.colspan || undefined,\n          rowSpan: cell.rowspan || undefined,\n        });\n      }),\n    })),\n  });\n}\n","/**\n * @license\n * Copyright (C) Gnucoop soc. coop.\n *\n * This file is part of the Advanced JSON forms (ajf).\n *\n * Advanced JSON forms (ajf) is free software: you can redistribute it and/or\n * modify it under the terms of the GNU Affero General Public License as\n * published by the Free Software Foundation, either version 3 of the License,\n * or (at your option) any later version.\n *\n * Advanced JSON forms (ajf) is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero\n * General Public License for more details.\n *\n * You should have received a copy of the GNU Affero General Public License\n * along with Advanced JSON forms (ajf).\n * If not, see http://www.gnu.org/licenses/.\n *\n */\n\nexport * from './base-widget';\nexport * from './chart-utils';\nexport * from './get-column-content';\nexport * from './interface/aggregation/aggregation';\nexport * from './interface/aggregation/aggregation-type';\nexport * from './interface/charts/chart-type';\nexport * from './interface/dataset/chart-dataset';\nexport * from './interface/dataset/chart-dataset-options';\nexport * from './interface/dataset/dataset';\nexport * from './interface/dataset/table-dataset';\nexport * from './interface/reports/report';\nexport * from './interface/reports/report-container';\nexport * from './interface/reports/report-string-identifier';\nexport * from './interface/reports/report-variable';\nexport * from './interface/reports-instances/report-container-instance';\nexport * from './interface/reports-instances/report-instance';\nexport * from './interface/styles';\nexport * from './interface/widgets/base-widget';\nexport * from './interface/widgets/chart-widget';\nexport * from './interface/widgets/column-widget';\nexport * from './interface/widgets/custom-widget';\nexport * from './interface/widgets/data-widget';\nexport * from './interface/widgets/dialog-widget';\nexport * from './interface/widgets/filter';\nexport * from './interface/widgets/formula-widget';\nexport * from './interface/widgets/graph-widget';\nexport * from './interface/widgets/heat-map-widget';\nexport * from './interface/widgets/image-container-widget';\nexport * from './interface/widgets/image-widget';\nexport * from './interface/widgets/layout-widget';\nexport * from './interface/widgets/map-widget';\nexport * from './interface/widgets/page-break-widget';\nexport * from './interface/widgets/paginated-list-widget';\nexport * from './interface/widgets/paginated-table-widget';\nexport * from './interface/widgets/table-widget';\nexport * from './interface/widgets/text-widget';\nexport * from './interface/widgets/widget';\nexport * from './interface/widgets/widget-components-map';\nexport * from './interface/widgets/widget-type';\nexport * from './interface/widgets/widget-with-content';\nexport * from './interface/widgets-instances/base-widget-instance';\nexport * from './interface/widgets-instances/chart-widget-instance';\nexport * from './interface/widgets-instances/column-widget-instance';\nexport * from './interface/widgets-instances/data-widget-instance';\nexport * from './interface/widgets-instances/dialog-widget-instance';\nexport * from './interface/widgets-instances/filter-instance';\nexport * from './interface/widgets-instances/formula-widget-instance';\nexport * from './interface/widgets-instances/graph-widget-instance';\nexport * from './interface/widgets-instances/heat-map-widget-instance';\nexport * from './interface/widgets-instances/image-container-widget-instance';\nexport * from './interface/widgets-instances/image-widget-instance';\nexport * from './interface/widgets-instances/layout-widget-instance';\nexport * from './interface/widgets-instances/map-widget-instance';\nexport * from './interface/widgets-instances/page-break-widget-instance';\nexport * from './interface/widgets-instances/paginated-list-widget-instance';\nexport * from './interface/widgets-instances/paginated-table-widget-instance';\nexport * from './interface/widgets-instances/table-widget-instance';\nexport * from './interface/widgets-instances/text-widget-instance';\nexport * from './interface/widgets-instances/widget-instance';\nexport * from './interface/widgets-instances/widget-with-content-instance';\nexport * from './report';\nexport * from './report-string-identifier';\nexport * from './reports-module';\nexport * from './serializers/aggregation-serializer';\nexport * from './serializers/dataset-serializer';\nexport * from './serializers/report-container-serializer';\nexport * from './serializers/report-serializer';\nexport * from './serializers/widget-serializer';\nexport * from './widget';\nexport * from './widget-export';\nexport * from './widget-host';\nexport * from './widget-service';\n\nexport * from './utils/aggregation/create-aggregation';\nexport * from './utils/reports-instances/create-report-instance';\nexport * from './utils/widgets/create-widget';\nexport * from './utils/widgets-instances/create-widget-instance';\nexport * from './utils/widgets-instances/widget-to-widget-instance';\n\nexport * from './automatic-report/automatic-report';\nexport * from './xls-report/xls-report';\nexport * from './report-to-pdf/report-to-pdf';\nexport * from './report-to-pdf/report-to-doc';\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './public_api';\n"],"names":["slideTitleStyle","widgetTitleStyle","boxStyle","widgetStyle","bgColor","backgroundColor","textRuns"],"mappings":";;;;;;;;;;;;;;;;;AAAA;;;;;;;;;;;;;;;;;;;;AAoBG;MAOU,sBAAsB,CAAA;AAEjC,IAAA,IAAI,QAAQ,GAAA;QACV,OAAO,IAAI,CAAC,SAAS;;IAEvB,IACI,QAAQ,CAAC,QAAuB,EAAA;AAClC,QAAA,IAAI,IAAI,CAAC,SAAS,KAAK,QAAQ,EAAE;AAC/B,YAAA,IAAI,CAAC,SAAS,GAAG,QAAQ;AACzB,YAAA,IAAI,CAAC,IAAI,CAAC,aAAa,EAAE;;;IAI7B,WAAsB,CAAA,IAAuB,EAAW,E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