import { Component, EventEmitter, Input, Output } from '@angular/core';
import { CommonModule } from '@angular/common';
import { FormsModule } from '@angular/forms';
import { DialogModule } from 'primeng/dialog';
import { ButtonModule } from 'primeng/button';
import { RadioButtonModule } from 'primeng/radiobutton';
import { CheckboxModule } from 'primeng/checkbox';
import { DividerModule } from 'primeng/divider';
import * as XLSX from 'xlsx';
import jsPDF from 'jspdf';
import 'jspdf-autotable';
import { TranslatePipe } from '../../pipes/translate.pipe';
import * as i0 from "@angular/core";
import * as i1 from "../../services/translation.service";
import * as i2 from "@angular/common";
import * as i3 from "@angular/forms";
import * as i4 from "primeng/dialog";
import * as i5 from "primeng/api";
import * as i6 from "primeng/button";
import * as i7 from "primeng/radiobutton";
import * as i8 from "primeng/checkbox";
export class ExportDialogComponent {
    translationService;
    visible = false;
    allRecords = [];
    selectedRecords = [];
    statusLabels;
    translationPrefix = 'design.components_ai';
    set availableColumns(columns) {
        if (columns && columns.length > 0) {
            this.columns = columns;
        }
    }
    visibleChange = new EventEmitter();
    exportFormat = 'xlsx';
    exportScope = 'all';
    formats = [];
    scopes = [];
    columns = [];
    constructor(translationService) {
        this.translationService = translationService;
        this.initializeFormats();
        this.initializeScopes();
    }
    ngOnChanges() {
        this.initializeFormats();
        this.initializeScopes();
    }
    initializeFormats() {
        this.formats = [
            {
                value: 'xlsx',
                label: 'Excel',
                icon: 'pi-file-excel',
                description: this.translationService.translate('design.components_ai.export_excel_description')
            },
            {
                value: 'pdf',
                label: 'PDF',
                icon: 'pi-file-pdf',
                description: this.translationService.translate('design.components_ai.export_pdf_description')
            }
        ];
    }
    initializeScopes() {
        this.scopes = [
            {
                value: 'all',
                label: this.translationService.translate('design.components_ai.export_all_records'),
                icon: 'pi-list',
                description: this.translationService.translate('design.components_ai.export_all_records_description')
            },
            {
                value: 'selected',
                label: this.translationService.translate('design.components_ai.export_selected_records'),
                icon: 'pi-check-square',
                description: this.translationService.translate('design.components_ai.export_selected_records_description')
            }
        ];
    }
    get recordsToExport() {
        return this.exportScope === 'all' ? this.allRecords : this.selectedRecords;
    }
    get selectedColumnsCount() {
        return this.columns.filter(col => col.selected).length;
    }
    get canExport() {
        return this.selectedColumnsCount > 0 && this.recordsToExport.length > 0;
    }
    onHide() {
        this.visibleChange.emit(false);
    }
    selectAllColumns() {
        this.columns.forEach(col => col.selected = true);
    }
    deselectAllColumns() {
        this.columns.forEach(col => col.selected = false);
    }
    export() {
        if (!this.canExport)
            return;
        if (this.exportFormat === 'xlsx') {
            this.exportToExcel();
        }
        else {
            this.exportToPDF();
        }
        this.onHide();
    }
    exportToExcel() {
        const selectedColumns = this.columns.filter(col => col.selected);
        const data = this.recordsToExport.map(record => {
            const row = {};
            selectedColumns.forEach(col => {
                if (col.field === 'status' && record.status && this.statusLabels) {
                    row[col.header] = this.statusLabels[record.status];
                }
                else {
                    row[col.header] = record[col.field];
                }
            });
            return row;
        });
        const worksheet = XLSX.utils.json_to_sheet(data);
        const workbook = XLSX.utils.book_new();
        XLSX.utils.book_append_sheet(workbook, worksheet, this.translationService.translate('design.components_ai.export_data_sheet_name'));
        // Ajustar largura das colunas
        const maxWidth = 30;
        const colWidths = selectedColumns.map(col => ({
            wch: Math.min(col.header.length + 5, maxWidth)
        }));
        worksheet['!cols'] = colWidths;
        const fileName = `export-${new Date().getTime()}.xlsx`;
        XLSX.writeFile(workbook, fileName);
    }
    exportToPDF() {
        const doc = new jsPDF();
        const selectedColumns = this.columns.filter(col => col.selected);
        // Título
        doc.setFontSize(18);
        doc.setTextColor(18, 168, 133);
        doc.text(this.translationService.translate('design.components_ai.export_pdf_title'), 14, 20);
        // Subtítulo
        doc.setFontSize(10);
        doc.setTextColor(100);
        doc.text(`${this.translationService.translate('design.components_ai.export_exported_at')}: ${new Date().toLocaleString('pt-BR')}`, 14, 28);
        doc.text(`${this.translationService.translate('design.components_ai.export_total_records')}: ${this.recordsToExport.length}`, 14, 34);
        // Preparar dados
        const headers = selectedColumns.map(col => col.header);
        const data = this.recordsToExport.map(record => {
            return selectedColumns.map(col => {
                if (col.field === 'status' && record.status && this.statusLabels) {
                    return this.statusLabels[record.status];
                }
                return String(record[col.field] || '');
            });
        });
        // Tabela
        doc.autoTable({
            head: [headers],
            body: data,
            startY: 40,
            theme: 'grid',
            headStyles: {
                fillColor: [18, 168, 133],
                textColor: [255, 255, 255],
                fontStyle: 'bold',
                halign: 'center'
            },
            styles: {
                fontSize: 9,
                cellPadding: 3
            },
            alternateRowStyles: {
                fillColor: [248, 255, 254]
            }
        });
        const fileName = `export-${new Date().getTime()}.pdf`;
        doc.save(fileName);
    }
    static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.14", ngImport: i0, type: ExportDialogComponent, deps: [{ token: i1.TranslationService }], target: i0.ɵɵFactoryTarget.Component });
    static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "18.2.14", type: ExportDialogComponent, isStandalone: true, selector: "sia-export-dialog", inputs: { visible: "visible", allRecords: "allRecords", selectedRecords: "selectedRecords", statusLabels: "statusLabels", translationPrefix: "translationPrefix", availableColumns: "availableColumns" }, outputs: { visibleChange: "visibleChange" }, usesOnChanges: true, ngImport: i0, template: "<p-dialog\n  [(visible)]=\"visible\"\n  (onHide)=\"onHide()\"\n  [modal]=\"true\"\n  [draggable]=\"false\"\n  [resizable]=\"false\"\n  [style]=\"{ width: '700px' }\"\n  styleClass=\"export-dialog\"\n>\n  <ng-template pTemplate=\"header\">\n    <div class=\"custom-header\">\n      <i class=\"pi pi-download header-icon\"></i>\n      <span>{{ 'design.components_ai.export_data_title' | translate }}</span>\n    </div>\n  </ng-template>\n\n  <div class=\"export-content\">\n    <!-- Formato de Exporta\u00E7\u00E3o -->\n    <div class=\"export-section\">\n      <div class=\"section-header\">\n        <div class=\"section-icon\">\n          <i class=\"pi pi-file\"></i>\n        </div>\n        <h3>{{ 'design.components_ai.export_format_title' | translate }}</h3>\n      </div>\n      <div class=\"format-options\">\n        <div\n          *ngFor=\"let format of formats\"\n          class=\"format-card\"\n          [class.selected]=\"exportFormat === format.value\"\n          (click)=\"exportFormat = format.value\"\n        >\n          <div class=\"card-radio\">\n            <p-radioButton\n              [value]=\"format.value\"\n              [(ngModel)]=\"exportFormat\"\n              [inputId]=\"format.value\"\n            ></p-radioButton>\n          </div>\n          <div class=\"card-icon\" [class.excel]=\"format.value === 'xlsx'\" [class.pdf]=\"format.value === 'pdf'\">\n            <i class=\"pi\" [ngClass]=\"format.icon\"></i>\n          </div>\n          <div class=\"card-info\">\n            <label [for]=\"format.value\" class=\"card-label\">{{ format.label }}</label>\n            <span class=\"card-description\">{{ format.description }}</span>\n          </div>\n        </div>\n      </div>\n    </div>\n\n    <!-- Escopo de Exporta\u00E7\u00E3o -->\n    <div class=\"export-section\">\n      <div class=\"section-header\">\n        <div class=\"section-icon\">\n          <i class=\"pi pi-filter\"></i>\n        </div>\n        <h3>{{ 'design.components_ai.export_scope_title' | translate }}</h3>\n      </div>\n      <div class=\"scope-options\">\n        <div\n          *ngFor=\"let scope of scopes\"\n          class=\"scope-card\"\n          [class.selected]=\"exportScope === scope.value\"\n          [class.disabled]=\"scope.value === 'selected' && selectedRecords.length === 0\"\n          (click)=\"scope.value === 'selected' && selectedRecords.length === 0 ? null : exportScope = scope.value\"\n        >\n          <div class=\"card-radio\">\n            <p-radioButton\n              [value]=\"scope.value\"\n              [(ngModel)]=\"exportScope\"\n              [inputId]=\"scope.value\"\n              [disabled]=\"scope.value === 'selected' && selectedRecords.length === 0\"\n            ></p-radioButton>\n          </div>\n          <div class=\"card-icon\">\n            <i class=\"pi\" [ngClass]=\"scope.icon\"></i>\n          </div>\n          <div class=\"card-info\">\n            <label [for]=\"scope.value\" class=\"card-label\">{{ scope.label }}</label>\n            <span class=\"card-description\">{{ scope.description }}</span>\n            <span class=\"card-count\">\n              <i class=\"pi pi-circle-fill\"></i>\n              {{ scope.value === 'all' ? allRecords.length : selectedRecords.length }} {{ 'design.components_ai.export_records_count' | translate }}\n            </span>\n          </div>\n        </div>\n      </div>\n    </div>\n\n    <!-- Sele\u00E7\u00E3o de Colunas -->\n    <div class=\"export-section\">\n      <div class=\"section-header\">\n        <div class=\"section-icon\">\n          <i class=\"pi pi-table\"></i>\n        </div>\n        <h3>{{ 'design.components_ai.export_columns_title' | translate }}</h3>\n        <div class=\"column-actions\">\n          <button type=\"button\" class=\"action-link\" (click)=\"selectAllColumns()\">\n            {{ 'design.components_ai.export_select_all_columns' | translate }}\n          </button>\n          <span class=\"separator\">|</span>\n          <button type=\"button\" class=\"action-link\" (click)=\"deselectAllColumns()\">\n            {{ 'design.components_ai.export_clear_selection' | translate }}\n          </button>\n        </div>\n      </div>\n      <div class=\"columns-grid\">\n        <div\n          *ngFor=\"let column of columns\"\n          class=\"column-item\"\n          [class.selected]=\"column.selected\"\n          (click)=\"column.selected = !column.selected\"\n        >\n          <p-checkbox\n            [(ngModel)]=\"column.selected\"\n            [binary]=\"true\"\n            [inputId]=\"column.field\"\n          ></p-checkbox>\n          <label [for]=\"column.field\" class=\"column-label\">\n            {{ column.header }}\n          </label>\n        </div>\n      </div>\n      <div class=\"columns-summary\">\n        <i class=\"pi pi-info-circle\"></i>\n        <span>{{ selectedColumnsCount }} {{ 'design.components_ai.export_columns_summary' | translate }} {{ columns.length }} {{ 'design.components_ai.export_columns_selected' | translate }}</span>\n      </div>\n    </div>\n  </div>\n\n  <ng-template pTemplate=\"footer\">\n    <p-button\n      [label]=\"'design.components_ai.cancel' | translate\"\n      icon=\"pi pi-times\"\n      severity=\"secondary\"\n      [text]=\"true\"\n      (onClick)=\"onHide()\"\n    ></p-button>\n    <p-button\n      [label]=\"'design.components_ai.export_button' | translate\"\n      icon=\"pi pi-download\"\n      [disabled]=\"!canExport\"\n      (onClick)=\"export()\"\n    ></p-button>\n  </ng-template>\n</p-dialog>\n", styles: ["::ng-deep .export-dialog .p-dialog{border-radius:16px;overflow:hidden;box-shadow:0 20px 60px #0000004d}::ng-deep .export-dialog .p-dialog-content{padding:0;background:#fff;max-height:70vh;overflow-y:auto}.custom-header{display:flex;align-items:center;gap:12px;font-size:18px;font-weight:600}.custom-header .header-icon{font-size:22px;color:var(--p-primary-500)}.export-content{padding:28px 32px}.export-section{margin-bottom:32px}.export-section:last-child{margin-bottom:0}.export-section .section-header{display:flex;align-items:center;gap:12px;margin-bottom:20px}.export-section .section-header .section-icon{width:36px;height:36px;display:flex;align-items:center;justify-content:center;background:linear-gradient(135deg,rgba(var(--p-primary-rgb),.1),rgba(var(--p-primary-rgb),.15));border-radius:10px}.export-section .section-header .section-icon i{font-size:18px;color:var(--p-primary-500)}.export-section .section-header h3{margin:0;font-size:17px;font-weight:700;color:var(--neutral-color-800);flex:1}.export-section .section-header .column-actions{display:flex;align-items:center;gap:10px;font-size:13px}.export-section .section-header .column-actions .action-link{background:none;border:none;color:var(--p-primary-500);cursor:pointer;font-weight:600;padding:0;transition:all .2s;font-size:13px}.export-section .section-header .column-actions .action-link:hover{color:var(--p-primary-500)}.export-section .section-header .column-actions .separator{color:var(--neutral-color-300);font-weight:400}.format-options{display:grid;grid-template-columns:repeat(2,1fr);gap:16px}.format-card{display:flex;align-items:center;gap:16px;padding:20px;border:2px solid #e5e7eb;border-radius:12px;cursor:pointer;transition:all .3s cubic-bezier(.4,0,.2,1);background:#fff;position:relative;overflow:hidden}.format-card:before{content:\"\";position:absolute;inset:0;background:linear-gradient(135deg,rgba(var(--p-primary-rgb),.03),rgba(var(--p-primary-rgb),.06));opacity:0;transition:opacity .3s}.format-card:hover{border-color:var(--p-primary-500);transform:translateY(-2px);box-shadow:0 8px 24px rgba(var(--p-primary-rgb),.15)}.format-card:hover:before{opacity:1}.format-card.selected{border-color:var(--p-primary-500);background:linear-gradient(135deg,rgba(var(--p-primary-rgb),.05),rgba(var(--p-primary-rgb),.08));box-shadow:0 0 0 4px rgba(var(--p-primary-rgb),.1)}.format-card.selected .card-icon{background:linear-gradient(135deg,var(--p-primary-500) 0%,var(--p-primary-500) 100%);transform:scale(1.05)}.format-card.selected .card-icon i{color:#fff}.format-card .card-radio ::ng-deep .p-radiobutton .p-radiobutton-box{width:20px;height:20px;border-width:2px}.format-card .card-icon{width:52px;height:52px;display:flex;align-items:center;justify-content:center;border-radius:12px;transition:all .3s;position:relative;z-index:1}.format-card .card-icon.excel{background:linear-gradient(135deg,var(--p-primary-50) 0%,var(--p-primary-100) 100%)}.format-card .card-icon.excel i{color:#107c41;font-size:26px}.format-card .card-icon.pdf{background:linear-gradient(135deg,#fee8e8,#fdd4d4)}.format-card .card-icon.pdf i{color:#dc2626;font-size:26px}.format-card .card-info{flex:1;display:flex;flex-direction:column;gap:4px;position:relative;z-index:1}.format-card .card-label{font-size:16px;font-weight:700;color:var(--neutral-color-800);cursor:pointer;margin:0}.format-card .card-description{font-size:13px;color:var(--neutral-color-600);line-height:1.4}.scope-options{display:flex;flex-direction:column;gap:14px}.scope-card{display:flex;align-items:center;gap:16px;padding:20px;border:2px solid #e5e7eb;border-radius:12px;cursor:pointer;transition:all .3s cubic-bezier(.4,0,.2,1);background:#fff;position:relative;overflow:hidden}.scope-card:before{content:\"\";position:absolute;inset:0;background:linear-gradient(135deg,rgba(var(--p-primary-rgb),.03),rgba(var(--p-primary-rgb),.06));opacity:0;transition:opacity .3s}.scope-card:hover:not(.disabled){border-color:var(--p-primary-500);box-shadow:0 4px 16px rgba(var(--p-primary-rgb),.12)}.scope-card:hover:not(.disabled):before{opacity:1}.scope-card.selected{border-color:var(--p-primary-500);background:linear-gradient(135deg,rgba(var(--p-primary-rgb),.05),rgba(var(--p-primary-rgb),.08));box-shadow:0 0 0 4px rgba(var(--p-primary-rgb),.1)}.scope-card.selected .card-icon{background:linear-gradient(135deg,var(--p-primary-500) 0%,var(--p-primary-500) 100%);transform:scale(1.05)}.scope-card.selected .card-icon i{color:#fff}.scope-card.disabled{opacity:.5;cursor:not-allowed;background:#f9fafb}.scope-card.disabled:hover{border-color:#e5e7eb;box-shadow:none}.scope-card .card-radio ::ng-deep .p-radiobutton .p-radiobutton-box{width:20px;height:20px;border-width:2px}.scope-card .card-icon{width:48px;height:48px;display:flex;align-items:center;justify-content:center;background:linear-gradient(135deg,var(--p-primary-50) 0%,var(--p-primary-100) 100%);border-radius:12px;transition:all .3s;position:relative;z-index:1}.scope-card .card-icon i{font-size:22px;color:var(--p-primary-500);transition:all .3s}.scope-card .card-info{flex:1;display:flex;flex-direction:column;gap:4px;position:relative;z-index:1}.scope-card .card-label{font-size:16px;font-weight:700;color:var(--neutral-color-800);cursor:pointer;margin:0}.scope-card .card-description{font-size:13px;color:var(--neutral-color-600);line-height:1.4}.scope-card .card-count{font-size:13px;font-weight:600;color:var(--p-primary-500);margin-top:6px;display:inline-flex;align-items:center;gap:6px}.scope-card .card-count i{font-size:6px}.columns-grid{display:grid;grid-template-columns:repeat(3,1fr);gap:12px;margin-bottom:16px}.column-item{display:flex;align-items:center;gap:12px;padding:16px;border:2px solid #e5e7eb;border-radius:10px;transition:all .2s;background:#fff;cursor:pointer}.column-item:hover{border-color:var(--p-primary-500);background:rgba(var(--p-primary-rgb),.03)}.column-item.selected{border-color:var(--p-primary-500);background:linear-gradient(135deg,rgba(var(--p-primary-rgb),.05),rgba(var(--p-primary-rgb),.08))}.column-item ::ng-deep .p-checkbox .p-checkbox-box{width:20px;height:20px;border-width:2px}.column-item .column-label{font-size:14px;font-weight:600;color:var(--neutral-color-800);cursor:pointer;margin:0;-webkit-user-select:none;user-select:none}.columns-summary{display:flex;align-items:center;gap:10px;padding:14px 18px;background:linear-gradient(135deg,var(--p-primary-50) 0%,var(--p-primary-100) 100%);border-radius:10px;font-size:14px;color:var(--neutral-color-700);font-weight:600}.columns-summary i{color:var(--p-primary-500);font-size:18px}@media (max-width: 768px){::ng-deep .export-dialog .p-dialog{width:95vw!important;margin:0}.dialog-header{padding:28px 24px}.dialog-header .header-icon-wrapper{width:56px;height:56px}.dialog-header .header-icon-wrapper i{font-size:28px}.dialog-header .header-text h2{font-size:24px}.export-content{padding:24px}.format-options,.columns-grid{grid-template-columns:1fr}}\n"], dependencies: [{ kind: "ngmodule", type: CommonModule }, { kind: "directive", type: i2.NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { kind: "directive", type: i2.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { kind: "ngmodule", type: FormsModule }, { kind: "directive", type: i3.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i3.NgModel, selector: "[ngModel]:not([formControlName]):not([formControl])", inputs: ["name", "disabled", "ngModel", "ngModelOptions"], outputs: ["ngModelChange"], exportAs: ["ngModel"] }, { kind: "ngmodule", type: DialogModule }, { kind: "component", type: i4.Dialog, selector: "p-dialog", inputs: ["header", "draggable", "resizable", "positionLeft", "positionTop", "contentStyle", "contentStyleClass", "modal", "closeOnEscape", "dismissableMask", "rtl", "closable", "responsive", "appendTo", "breakpoints", "styleClass", "maskStyleClass", "maskStyle", "showHeader", "breakpoint", "blockScroll", "autoZIndex", "baseZIndex", "minX", "minY", "focusOnShow", "maximizable", "keepInViewport", "focusTrap", "transitionOptions", "closeIcon", "closeAriaLabel", "closeTabindex", "minimizeIcon", "maximizeIcon", "closeButtonProps", "maximizeButtonProps", "visible", "style", "position", "role", "content", "contentTemplate", "footerTemplate", "closeIconTemplate", "maximizeIconTemplate", "minimizeIconTemplate", "headlessTemplate"], outputs: ["onShow", "onHide", "visibleChange", "onResizeInit", "onResizeEnd", "onDragEnd", "onMaximize"] }, { kind: "directive", type: i5.PrimeTemplate, selector: "[pTemplate]", inputs: ["type", "pTemplate"] }, { kind: "ngmodule", type: ButtonModule }, { kind: "component", type: i6.Button, selector: "p-button", inputs: ["type", "iconPos", "icon", "badge", "label", "disabled", "loading", "loadingIcon", "raised", "rounded", "text", "plain", "severity", "outlined", "link", "tabindex", "size", "variant", "style", "styleClass", "badgeClass", "badgeSeverity", "ariaLabel", "autofocus", "fluid", "buttonProps"], outputs: ["onClick", "onFocus", "onBlur"] }, { kind: "ngmodule", type: RadioButtonModule }, { kind: "component", type: i7.RadioButton, selector: "p-radioButton, p-radiobutton, p-radio-button", inputs: ["value", "formControlName", "name", "disabled", "variant", "size", "tabindex", "inputId", "ariaLabelledBy", "ariaLabel", "style", "styleClass", "autofocus", "binary"], outputs: ["onClick", "onFocus", "onBlur"] }, { kind: "ngmodule", type: CheckboxModule }, { kind: "component", type: i8.Checkbox, selector: "p-checkbox, p-checkBox, p-check-box", inputs: ["value", "name", "disabled", "binary", "ariaLabelledBy", "ariaLabel", "tabindex", "inputId", "style", "inputStyle", "styleClass", "inputClass", "indeterminate", "size", "formControl", "checkboxIcon", "readonly", "required", "autofocus", "trueValue", "falseValue", "variant"], outputs: ["onChange", "onFocus", "onBlur"] }, { kind: "ngmodule", type: DividerModule }, { kind: "pipe", type: TranslatePipe, name: "translate" }] });
}
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.14", ngImport: i0, type: ExportDialogComponent, decorators: [{
            type: Component,
            args: [{ selector: 'sia-export-dialog', standalone: true, imports: [
                        CommonModule,
                        FormsModule,
                        DialogModule,
                        ButtonModule,
                        RadioButtonModule,
                        CheckboxModule,
                        DividerModule,
                        TranslatePipe
                    ], template: "<p-dialog\n  [(visible)]=\"visible\"\n  (onHide)=\"onHide()\"\n  [modal]=\"true\"\n  [draggable]=\"false\"\n  [resizable]=\"false\"\n  [style]=\"{ width: '700px' }\"\n  styleClass=\"export-dialog\"\n>\n  <ng-template pTemplate=\"header\">\n    <div class=\"custom-header\">\n      <i class=\"pi pi-download header-icon\"></i>\n      <span>{{ 'design.components_ai.export_data_title' | translate }}</span>\n    </div>\n  </ng-template>\n\n  <div class=\"export-content\">\n    <!-- Formato de Exporta\u00E7\u00E3o -->\n    <div class=\"export-section\">\n      <div class=\"section-header\">\n        <div class=\"section-icon\">\n          <i class=\"pi pi-file\"></i>\n        </div>\n        <h3>{{ 'design.components_ai.export_format_title' | translate }}</h3>\n      </div>\n      <div class=\"format-options\">\n        <div\n          *ngFor=\"let format of formats\"\n          class=\"format-card\"\n          [class.selected]=\"exportFormat === format.value\"\n          (click)=\"exportFormat = format.value\"\n        >\n          <div class=\"card-radio\">\n            <p-radioButton\n              [value]=\"format.value\"\n              [(ngModel)]=\"exportFormat\"\n              [inputId]=\"format.value\"\n            ></p-radioButton>\n          </div>\n          <div class=\"card-icon\" [class.excel]=\"format.value === 'xlsx'\" [class.pdf]=\"format.value === 'pdf'\">\n            <i class=\"pi\" [ngClass]=\"format.icon\"></i>\n          </div>\n          <div class=\"card-info\">\n            <label [for]=\"format.value\" class=\"card-label\">{{ format.label }}</label>\n            <span class=\"card-description\">{{ format.description }}</span>\n          </div>\n        </div>\n      </div>\n    </div>\n\n    <!-- Escopo de Exporta\u00E7\u00E3o -->\n    <div class=\"export-section\">\n      <div class=\"section-header\">\n        <div class=\"section-icon\">\n          <i class=\"pi pi-filter\"></i>\n        </div>\n        <h3>{{ 'design.components_ai.export_scope_title' | translate }}</h3>\n      </div>\n      <div class=\"scope-options\">\n        <div\n          *ngFor=\"let scope of scopes\"\n          class=\"scope-card\"\n          [class.selected]=\"exportScope === scope.value\"\n          [class.disabled]=\"scope.value === 'selected' && selectedRecords.length === 0\"\n          (click)=\"scope.value === 'selected' && selectedRecords.length === 0 ? null : exportScope = scope.value\"\n        >\n          <div class=\"card-radio\">\n            <p-radioButton\n              [value]=\"scope.value\"\n              [(ngModel)]=\"exportScope\"\n              [inputId]=\"scope.value\"\n              [disabled]=\"scope.value === 'selected' && selectedRecords.length === 0\"\n            ></p-radioButton>\n          </div>\n          <div class=\"card-icon\">\n            <i class=\"pi\" [ngClass]=\"scope.icon\"></i>\n          </div>\n          <div class=\"card-info\">\n            <label [for]=\"scope.value\" class=\"card-label\">{{ scope.label }}</label>\n            <span class=\"card-description\">{{ scope.description }}</span>\n            <span class=\"card-count\">\n              <i class=\"pi pi-circle-fill\"></i>\n              {{ scope.value === 'all' ? allRecords.length : selectedRecords.length }} {{ 'design.components_ai.export_records_count' | translate }}\n            </span>\n          </div>\n        </div>\n      </div>\n    </div>\n\n    <!-- Sele\u00E7\u00E3o de Colunas -->\n    <div class=\"export-section\">\n      <div class=\"section-header\">\n        <div class=\"section-icon\">\n          <i class=\"pi pi-table\"></i>\n        </div>\n        <h3>{{ 'design.components_ai.export_columns_title' | translate }}</h3>\n        <div class=\"column-actions\">\n          <button type=\"button\" class=\"action-link\" (click)=\"selectAllColumns()\">\n            {{ 'design.components_ai.export_select_all_columns' | translate }}\n          </button>\n          <span class=\"separator\">|</span>\n          <button type=\"button\" class=\"action-link\" (click)=\"deselectAllColumns()\">\n            {{ 'design.components_ai.export_clear_selection' | translate }}\n          </button>\n        </div>\n      </div>\n      <div class=\"columns-grid\">\n        <div\n          *ngFor=\"let column of columns\"\n          class=\"column-item\"\n          [class.selected]=\"column.selected\"\n          (click)=\"column.selected = !column.selected\"\n        >\n          <p-checkbox\n            [(ngModel)]=\"column.selected\"\n            [binary]=\"true\"\n            [inputId]=\"column.field\"\n          ></p-checkbox>\n          <label [for]=\"column.field\" class=\"column-label\">\n            {{ column.header }}\n          </label>\n        </div>\n      </div>\n      <div class=\"columns-summary\">\n        <i class=\"pi pi-info-circle\"></i>\n        <span>{{ selectedColumnsCount }} {{ 'design.components_ai.export_columns_summary' | translate }} {{ columns.length }} {{ 'design.components_ai.export_columns_selected' | translate }}</span>\n      </div>\n    </div>\n  </div>\n\n  <ng-template pTemplate=\"footer\">\n    <p-button\n      [label]=\"'design.components_ai.cancel' | translate\"\n      icon=\"pi pi-times\"\n      severity=\"secondary\"\n      [text]=\"true\"\n      (onClick)=\"onHide()\"\n    ></p-button>\n    <p-button\n      [label]=\"'design.components_ai.export_button' | translate\"\n      icon=\"pi pi-download\"\n      [disabled]=\"!canExport\"\n      (onClick)=\"export()\"\n    ></p-button>\n  </ng-template>\n</p-dialog>\n", styles: ["::ng-deep .export-dialog .p-dialog{border-radius:16px;overflow:hidden;box-shadow:0 20px 60px #0000004d}::ng-deep .export-dialog .p-dialog-content{padding:0;background:#fff;max-height:70vh;overflow-y:auto}.custom-header{display:flex;align-items:center;gap:12px;font-size:18px;font-weight:600}.custom-header .header-icon{font-size:22px;color:var(--p-primary-500)}.export-content{padding:28px 32px}.export-section{margin-bottom:32px}.export-section:last-child{margin-bottom:0}.export-section .section-header{display:flex;align-items:center;gap:12px;margin-bottom:20px}.export-section .section-header .section-icon{width:36px;height:36px;display:flex;align-items:center;justify-content:center;background:linear-gradient(135deg,rgba(var(--p-primary-rgb),.1),rgba(var(--p-primary-rgb),.15));border-radius:10px}.export-section .section-header .section-icon i{font-size:18px;color:var(--p-primary-500)}.export-section .section-header h3{margin:0;font-size:17px;font-weight:700;color:var(--neutral-color-800);flex:1}.export-section .section-header .column-actions{display:flex;align-items:center;gap:10px;font-size:13px}.export-section .section-header .column-actions .action-link{background:none;border:none;color:var(--p-primary-500);cursor:pointer;font-weight:600;padding:0;transition:all .2s;font-size:13px}.export-section .section-header .column-actions .action-link:hover{color:var(--p-primary-500)}.export-section .section-header .column-actions .separator{color:var(--neutral-color-300);font-weight:400}.format-options{display:grid;grid-template-columns:repeat(2,1fr);gap:16px}.format-card{display:flex;align-items:center;gap:16px;padding:20px;border:2px solid #e5e7eb;border-radius:12px;cursor:pointer;transition:all .3s cubic-bezier(.4,0,.2,1);background:#fff;position:relative;overflow:hidden}.format-card:before{content:\"\";position:absolute;inset:0;background:linear-gradient(135deg,rgba(var(--p-primary-rgb),.03),rgba(var(--p-primary-rgb),.06));opacity:0;transition:opacity .3s}.format-card:hover{border-color:var(--p-primary-500);transform:translateY(-2px);box-shadow:0 8px 24px rgba(var(--p-primary-rgb),.15)}.format-card:hover:before{opacity:1}.format-card.selected{border-color:var(--p-primary-500);background:linear-gradient(135deg,rgba(var(--p-primary-rgb),.05),rgba(var(--p-primary-rgb),.08));box-shadow:0 0 0 4px rgba(var(--p-primary-rgb),.1)}.format-card.selected .card-icon{background:linear-gradient(135deg,var(--p-primary-500) 0%,var(--p-primary-500) 100%);transform:scale(1.05)}.format-card.selected .card-icon i{color:#fff}.format-card .card-radio ::ng-deep .p-radiobutton .p-radiobutton-box{width:20px;height:20px;border-width:2px}.format-card .card-icon{width:52px;height:52px;display:flex;align-items:center;justify-content:center;border-radius:12px;transition:all .3s;position:relative;z-index:1}.format-card .card-icon.excel{background:linear-gradient(135deg,var(--p-primary-50) 0%,var(--p-primary-100) 100%)}.format-card .card-icon.excel i{color:#107c41;font-size:26px}.format-card .card-icon.pdf{background:linear-gradient(135deg,#fee8e8,#fdd4d4)}.format-card .card-icon.pdf i{color:#dc2626;font-size:26px}.format-card .card-info{flex:1;display:flex;flex-direction:column;gap:4px;position:relative;z-index:1}.format-card .card-label{font-size:16px;font-weight:700;color:var(--neutral-color-800);cursor:pointer;margin:0}.format-card .card-description{font-size:13px;color:var(--neutral-color-600);line-height:1.4}.scope-options{display:flex;flex-direction:column;gap:14px}.scope-card{display:flex;align-items:center;gap:16px;padding:20px;border:2px solid #e5e7eb;border-radius:12px;cursor:pointer;transition:all .3s cubic-bezier(.4,0,.2,1);background:#fff;position:relative;overflow:hidden}.scope-card:before{content:\"\";position:absolute;inset:0;background:linear-gradient(135deg,rgba(var(--p-primary-rgb),.03),rgba(var(--p-primary-rgb),.06));opacity:0;transition:opacity .3s}.scope-card:hover:not(.disabled){border-color:var(--p-primary-500);box-shadow:0 4px 16px rgba(var(--p-primary-rgb),.12)}.scope-card:hover:not(.disabled):before{opacity:1}.scope-card.selected{border-color:var(--p-primary-500);background:linear-gradient(135deg,rgba(var(--p-primary-rgb),.05),rgba(var(--p-primary-rgb),.08));box-shadow:0 0 0 4px rgba(var(--p-primary-rgb),.1)}.scope-card.selected .card-icon{background:linear-gradient(135deg,var(--p-primary-500) 0%,var(--p-primary-500) 100%);transform:scale(1.05)}.scope-card.selected .card-icon i{color:#fff}.scope-card.disabled{opacity:.5;cursor:not-allowed;background:#f9fafb}.scope-card.disabled:hover{border-color:#e5e7eb;box-shadow:none}.scope-card .card-radio ::ng-deep .p-radiobutton .p-radiobutton-box{width:20px;height:20px;border-width:2px}.scope-card .card-icon{width:48px;height:48px;display:flex;align-items:center;justify-content:center;background:linear-gradient(135deg,var(--p-primary-50) 0%,var(--p-primary-100) 100%);border-radius:12px;transition:all .3s;position:relative;z-index:1}.scope-card .card-icon i{font-size:22px;color:var(--p-primary-500);transition:all .3s}.scope-card .card-info{flex:1;display:flex;flex-direction:column;gap:4px;position:relative;z-index:1}.scope-card .card-label{font-size:16px;font-weight:700;color:var(--neutral-color-800);cursor:pointer;margin:0}.scope-card .card-description{font-size:13px;color:var(--neutral-color-600);line-height:1.4}.scope-card .card-count{font-size:13px;font-weight:600;color:var(--p-primary-500);margin-top:6px;display:inline-flex;align-items:center;gap:6px}.scope-card .card-count i{font-size:6px}.columns-grid{display:grid;grid-template-columns:repeat(3,1fr);gap:12px;margin-bottom:16px}.column-item{display:flex;align-items:center;gap:12px;padding:16px;border:2px solid #e5e7eb;border-radius:10px;transition:all .2s;background:#fff;cursor:pointer}.column-item:hover{border-color:var(--p-primary-500);background:rgba(var(--p-primary-rgb),.03)}.column-item.selected{border-color:var(--p-primary-500);background:linear-gradient(135deg,rgba(var(--p-primary-rgb),.05),rgba(var(--p-primary-rgb),.08))}.column-item ::ng-deep .p-checkbox .p-checkbox-box{width:20px;height:20px;border-width:2px}.column-item .column-label{font-size:14px;font-weight:600;color:var(--neutral-color-800);cursor:pointer;margin:0;-webkit-user-select:none;user-select:none}.columns-summary{display:flex;align-items:center;gap:10px;padding:14px 18px;background:linear-gradient(135deg,var(--p-primary-50) 0%,var(--p-primary-100) 100%);border-radius:10px;font-size:14px;color:var(--neutral-color-700);font-weight:600}.columns-summary i{color:var(--p-primary-500);font-size:18px}@media (max-width: 768px){::ng-deep .export-dialog .p-dialog{width:95vw!important;margin:0}.dialog-header{padding:28px 24px}.dialog-header .header-icon-wrapper{width:56px;height:56px}.dialog-header .header-icon-wrapper i{font-size:28px}.dialog-header .header-text h2{font-size:24px}.export-content{padding:24px}.format-options,.columns-grid{grid-template-columns:1fr}}\n"] }]
        }], ctorParameters: () => [{ type: i1.TranslationService }], propDecorators: { visible: [{
                type: Input
            }], allRecords: [{
                type: Input
            }], selectedRecords: [{
                type: Input
            }], statusLabels: [{
                type: Input
            }], translationPrefix: [{
                type: Input
            }], availableColumns: [{
                type: Input
            }], visibleChange: [{
                type: Output
            }] } });
//# sourceMappingURL=data:application/json;base64, 