{"id":26198,"date":"2024-09-04T14:17:40","date_gmt":"2024-09-04T19:17:40","guid":{"rendered":"https:\/\/smartax.com.co\/smartax\/duplicado-calculadora\/"},"modified":"2025-08-08T16:20:55","modified_gmt":"2025-08-08T21:20:55","slug":"proyecto-ucot","status":"publish","type":"page","link":"https:\/\/smartax.com.co\/smartax\/proyecto-ucot\/","title":{"rendered":"Proyecto UCOT"},"content":{"rendered":"\t\t<div data-elementor-type=\"wp-page\" data-elementor-id=\"26198\" class=\"elementor elementor-26198\">\n\t\t\t\t\t\t<section class=\"elementor-section elementor-top-section elementor-element elementor-element-f510f9f elementor-section-height-min-height elementor-section-stretched elementor-section-boxed elementor-section-height-default elementor-section-items-middle\" data-id=\"f510f9f\" data-element_type=\"section\" data-e-type=\"section\" data-settings=\"{&quot;stretch_section&quot;:&quot;section-stretched&quot;,&quot;background_background&quot;:&quot;classic&quot;}\">\n\t\t\t\t\t\t<div class=\"elementor-container elementor-column-gap-custom\">\n\t\t\t\t\t<div class=\"elementor-column elementor-col-100 elementor-top-column elementor-element elementor-element-42b5315\" data-id=\"42b5315\" data-element_type=\"column\" data-e-type=\"column\">\n\t\t\t<div class=\"elementor-widget-wrap elementor-element-populated\">\n\t\t\t\t\t\t<div class=\"elementor-element elementor-element-da725e1 elementor-widget elementor-widget-thim-ekits-breadcrumb\" data-id=\"da725e1\" data-element_type=\"widget\" data-e-type=\"widget\" data-widget_type=\"thim-ekits-breadcrumb.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t\t\t\n\t\t\t<div class=\"thim-ekit-breadcrumb\">\n\n\t\t\t\tHome\n\t\t\t<\/div>\n\n\t\t\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t\t<\/div>\n\t\t<\/div>\n\t\t\t\t\t<\/div>\n\t\t<\/section>\n\t\t<div class=\"elementor-element elementor-element-7a57022 e-flex e-con-boxed e-con e-parent\" data-id=\"7a57022\" data-element_type=\"container\" data-e-type=\"container\">\n\t\t\t\t\t<div class=\"e-con-inner\">\n\t\t\t\t<div class=\"elementor-element elementor-element-8644b11 elementor-widget-divider--view-line elementor-widget elementor-widget-divider\" data-id=\"8644b11\" data-element_type=\"widget\" data-e-type=\"widget\" data-widget_type=\"divider.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t\t\t\t\t<div class=\"elementor-divider\">\n\t\t\t<span class=\"elementor-divider-separator\">\n\t\t\t\t\t\t<\/span>\n\t\t<\/div>\n\t\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t<div class=\"elementor-element elementor-element-54ce85c elementor-widget elementor-widget-html\" data-id=\"54ce85c\" data-element_type=\"widget\" data-e-type=\"widget\" data-widget_type=\"html.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t\t\t<!DOCTYPE html>\r\n<html lang=\"es\">\r\n<head>\r\n    <meta charset=\"UTF-8\">\r\n    <meta name=\"viewport\" content=\"width=device-width, initial-scale=1.0\">\r\n    <title>An\u00e1lisis Comparativo de Declaraci\u00f3n de Renta<\/title>\r\n    <!-- Carga de Tailwind CSS desde CDN -->\r\n    <script src=\"https:\/\/cdn.tailwindcss.com\"><\/script>\r\n    <!-- Carga de la fuente Inter desde Google Fonts -->\r\n    <link href=\"https:\/\/fonts.googleapis.com\/css2?family=Inter:wght@300;400;500;600;700;800;900&display=swap\" rel=\"stylesheet\">\r\n    <style>\r\n        \/* Estilos personalizados para la fuente y el cuerpo *\/\r\n        body {\r\n            font-family: 'Inter', sans-serif;\r\n            margin: 0;\r\n            padding: 0;\r\n            box-sizing: border-box;\r\n        }\r\n        \/* Asegura que el contenedor principal ocupe toda la altura disponible *\/\r\n        #app-root {\r\n            min-height: 100vh;\r\n            display: flex;\r\n            align-items: center;\r\n            justify-content: center;\r\n            padding: 1rem; \/* Espaciado general *\/\r\n            position: relative; \/* A\u00f1adido para que z-index funcione *\/\r\n            z-index: 1; \/* Asegura que est\u00e9 por encima de otros elementos por defecto *\/\r\n        }\r\n        \/* Estilos para los botones de acci\u00f3n (Procesar, PDF, Seleccionar Todos) *\/\r\n        .action-button {\r\n            background-color: #D82A36; \/* Rojo de marca *\/\r\n            color: #FFFFFF; \/* Texto blanco *\/\r\n            padding: 0.75rem 1.5rem;\r\n            border-radius: 8px;\r\n            cursor: pointer;\r\n            transition: all 0.3s ease;\r\n            font-weight: 600;\r\n            border: none;\r\n            display: block; \/* Para que ocupe su propia l\u00ednea *\/\r\n            margin: 1rem auto; \/* Centrar el bot\u00f3n y darle margen *\/\r\n            font-size: 1.125rem; \/* Tama\u00f1o de fuente un poco m\u00e1s grande *\/\r\n            box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1); \/* Sombra sutil *\/\r\n        }\r\n        .action-button:hover {\r\n            background-color: #B0222B; \/* Un tono m\u00e1s oscuro de rojo para hover *\/\r\n        }\r\n        .action-button:disabled {\r\n            background-color: #cccccc;\r\n            cursor: not-allowed;\r\n            color: #666666;\r\n            box-shadow: none;\r\n        }\r\n        \/* Estilo para el mensaje de error\/\u00e9xito *\/\r\n        .message-box {\r\n            position: fixed;\r\n            top: 50%;\r\n            left: 50%;\r\n            transform: translate(-50%, -50%);\r\n            padding: 15px 25px;\r\n            border-radius: 8px;\r\n            z-index: 1000;\r\n            box-shadow: 0 4px 8px rgba(0,0,0,0.2);\r\n            text-align: center;\r\n            color: white;\r\n        }\r\n        .message-box.error {\r\n            background-color: #D82A36;\r\n        }\r\n        .message-box.success {\r\n            background-color: #4CAF50;\r\n        }\r\n        \/* Estilo para el indicador de carga *\/\r\n        .loading-indicator {\r\n            position: fixed;\r\n            top: 50%;\r\n            left: 50%;\r\n            transform: translate(-50%, -50%);\r\n            background-color: rgba(0, 0, 0, 0.7);\r\n            color: white;\r\n            padding: 20px 30px;\r\n            border-radius: 10px;\r\n            z-index: 1001; \/* Alto z-index para asegurar que est\u00e9 en la parte superior *\/\r\n            display: flex; \/* Cambiado a flex para centrar el contenido *\/\r\n            align-items: center;\r\n            gap: 10px;\r\n        }\r\n        .loading-spinner {\r\n            border: 4px solid rgba(255, 255, 255, 0.3);\r\n            border-top: 4px solid #fff;\r\n            border-radius: 50%;\r\n            width: 24px;\r\n            height: 24px;\r\n            animation: spin 1s linear infinite;\r\n        }\r\n        @keyframes spin {\r\n            0% { transform: rotate(0deg); }\r\n            100% { transform: rotate(360deg); }\r\n        }\r\n        \/* Estilos para el tooltip del gr\u00e1fico *\/\r\n        .chart-tooltip {\r\n            position: absolute;\r\n            text-align: center;\r\n            padding: 8px;\r\n            background: rgba(0, 0, 0, 0.8);\r\n            color: white;\r\n            border-radius: 4px;\r\n            pointer-events: none;\r\n            opacity: 0;\r\n            transition: opacity 0.2s ease;\r\n            font-size: 0.875rem;\r\n            z-index: 10;\r\n        }\r\n        \/* Estilo espec\u00edfico para los t\u00edtulos de conceptos que podr\u00edan ser largos *\/\r\n        .concept-title {\r\n            font-weight: 600;\r\n            font-size: 1rem; \/* Reducido para evitar desbordamiento *\/\r\n            line-height: 1.25rem;\r\n            color: #1a202c; \/* gray-900 en Tailwind *\/\r\n            margin-bottom: 0.5rem;\r\n            text-align: center; \/* Centrado para mejor visualizaci\u00f3n *\/\r\n        }\r\n        \/* Estilo para la informaci\u00f3n de valores y diferencia *\/\r\n        .concept-info {\r\n            font-size: 0.875rem; \/* Texto m\u00e1s peque\u00f1o *\/\r\n            line-height: 1.25rem;\r\n            color: #4a5568; \/* gray-700 en Tailwind *\/\r\n            text-align: center;\r\n        }\r\n        \/* Ajuste de espacio para los valores *\/\r\n        .concept-values {\r\n            margin-top: 0.5rem;\r\n            margin-bottom: 0.5rem;\r\n        }\r\n        \/* Estilo para la diferencia con el color din\u00e1mico *\/\r\n        .concept-difference {\r\n            font-weight: 700;\r\n            text-align: center;\r\n            margin-top: 0.5rem;\r\n        }\r\n        \/* Clase para el borde de las tarjetas de concepto *\/\r\n        .concept-card {\r\n            border-color: #000; \/* Borde negro m\u00e1s marcado *\/\r\n            border-width: 1px;\r\n            border-style: solid;\r\n            box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);\r\n        }\r\n    <\/style>\r\n<\/head>\r\n<body>\r\n    <!-- Contenedor principal para la aplicaci\u00f3n React -->\r\n    <div id=\"react-app-root\"><\/div>\r\n\r\n    <!-- Carga de librer\u00edas de React desde CDN -->\r\n    <script crossorigin src=\"https:\/\/unpkg.com\/react@18\/umd\/react.production.min.js\"><\/script>\r\n    <script crossorigin src=\"https:\/\/unpkg.com\/react-dom@18\/umd\/react-dom.production.min.js\"><\/script>\r\n    <!-- Carga de Babel Standalone para transpilar JSX en el navegador -->\r\n    <script src=\"https:\/\/unpkg.com\/@babel\/standalone\/babel.min.js\"><\/script>\r\n\r\n    <!-- Carga de librer\u00edas externas desde CDN (PapaParse, XLSX, jsPDF, html2canvas, D3.js) -->\r\n    <script src=\"https:\/\/cdnjs.cloudflare.com\/ajax\/libs\/PapaParse\/5.3.0\/papaparse.min.js\"><\/script>\r\n    <script src=\"https:\/\/cdnjs.cloudflare.com\/ajax\/libs\/xlsx\/0.18.5\/xlsx.full.min.js\"><\/script>\r\n    <script src=\"https:\/\/cdnjs.cloudflare.com\/ajax\/libs\/jspdf\/2.5.1\/jspdf.umd.min.js\"><\/script>\r\n    <script src=\"https:\/\/cdnjs.cloudflare.com\/ajax\/libs\/html2canvas\/1.4.1\/html2canvas.min.js\"><\/script>\r\n    <script src=\"https:\/\/cdnjs.cloudflare.com\/ajax\/libs\/d3\/7.8.5\/d3.min.js\"><\/script>\r\n\r\n    <script type=\"text\/babel\">\r\n        \/\/ Acceder a React hooks desde el objeto global React\r\n        const { useState, useEffect, useRef, useCallback } = React; \r\n\r\n        \/\/ Define los conceptos m\u00e1s importantes para el filtrado inicial\r\n        const IMPORTANT_CONCEPTS = [\r\n            \"RENTA L\u00cdQUIDA GRAVABLE\",\r\n            \"IMPUESTO A CARGO\",\r\n            \"TOTAL RETENCIONES\",\r\n            \"TOTAL SALDO A PAGAR POR IMPUESTO\",\r\n            \"GANANCIAS OCASIONALES GRAVABLES\",\r\n            \"SALDO A FAVOR\"\r\n        ];\r\n\r\n        \/\/ Define los conceptos a excluir del men\u00fa de selecci\u00f3n (ahora solo para procesamiento, no para UI de filtro)\r\n        const CONCEPTS_TO_EXCLUDE = [\r\n            \"Patrimonio\",\r\n            \"Deudas\",\r\n            \"Ingresos\",\r\n            \"Rentas de trabajo\",\r\n            \"Rentas de Capital\",\r\n            \"Rentas no Laborales\",\r\n            \"Rentas de Pensiones\",\r\n            \"Dividendos\"\r\n        ];\r\n\r\n        \/\/ Conceptos espec\u00edficos que forman parte del Patrimonio para el gr\u00e1fico\r\n        const PATRIMONIO_CONCEPTS = [\r\n            \"Efectivo Y Bancos\",\r\n            \"Otras Inversiones (Fondos)\",\r\n            \"Acciones Y Aportes\",\r\n            \"Derechos Fiduciarios\",\r\n            \"Bienes Inmuebles\",\r\n            \"Bienes Muebles\",\r\n            \"Veh\u00edculos\",\r\n            \"Otros Activos\"\r\n        ];\r\n\r\n        \/\/ Definiciones de explicaciones para cada concepto\r\n        const CONCEPT_EXPLANATIONS = {\r\n            \"RENTA L\u00cdQUIDA GRAVABLE\": \"Es la porci\u00f3n de tu ingreso que est\u00e1 sujeta a impuestos despu\u00e9s de aplicar todas las deducciones y exenciones. Es la base sobre la cual se calcula tu impuesto de renta.\",\r\n            \"IMPUESTO A CARGO\": \"Es el monto total de impuesto que debes pagar antes de aplicar cualquier retenci\u00f3n o saldo a favor. Refleja tu obligaci\u00f3n fiscal directa.\",\r\n            \"TOTAL RETENCIONES\": \"Son los montos que ya te han sido descontados de tus ingresos durante el a\u00f1o por concepto de impuestos. Estas retenciones se aplican para reducir el impuesto a cargo.\",\r\n            \"TOTAL SALDO A PAGAR POR IMPUESTO\": \"Es el monto final que debes pagar a la autoridad tributaria despu\u00e9s de restar las retenciones y saldos a favor al impuesto a cargo.\",\r\n            \"GANANCIAS OCASIONALES GRAVABLES\": \"Son ganancias de eventos no recurrentes, como herencias, premios de loter\u00eda o la venta de activos fijos. Generalmente se gravan a una tasa diferente.\",\r\n            \"SALDO A FAVOR\": \"Es el monto que te queda a tu favor si tus retenciones o pagos anticipados excedieron el impuesto a cargo. Este saldo puede ser solicitado en devoluci\u00f3n o imputado al siguiente periodo.\",\r\n            \/\/ Explicaciones a\u00f1adidas para conceptos comunes del CSV\r\n            \"Efectivo Y Bancos\": \"Representa el dinero disponible en cuentas bancarias y efectivo, indicando tu liquidez inmediata.\",\r\n            \"Otras Inversiones (Fondos)\": \"Se refiere a inversiones en fondos u otros instrumentos financieros. Un cambio puede indicar movimientos en tu estrategia de inversi\u00f3n.\",\r\n            \"Acciones Y Aportes\": \"Corresponde a la propiedad de acciones en empresas o aportes en sociedades. Refleja tu participaci\u00f3n en el capital de otras entidades.\",\r\n            \"Bienes Inmuebles\": \"Incluye propiedades como casas, apartamentos o terrenos.\",\r\n            \"Otros Activos\": \"Activos no clasificados en las anteriores categor\u00edas mencionadas.\",\r\n            \"Deudas Con Entidades Financieras Y Otras\": \"Representa deudas con bancos u otras instituciones financieras. Un aumento puede indicar nuevos cr\u00e9ditos o pr\u00e9stamos.\",\r\n            \"Ingresos Por Intereses Y Rendimientos Financieros\": \"Ganancias obtenidas por el capital invertido, como intereses de cuentas de ahorro, CDT o bonos.\",\r\n            \"Ingresos No Constitutivos De Renta\": \"Son ingresos que, por ley, no se consideran parte de la base gravable para el impuesto de renta.\",\r\n            \"Costos Y Gastos Procedentes\": \"Gastos directamente relacionados con la generaci\u00f3n de tus ingresos. Reducen la base sobre la cual se calcula el impuesto.\",\r\n            \"Ingresos Por Rentas No Laborales\": \"Ingresos obtenidos por actividades que no son consideradas laborales, como honorarios por servicios profesionales independientes o arrendamientos.\",\r\n            \"Rentas Exentas Y Deducciones Imputables (Limitadas)\": \"Beneficios fiscales que permiten reducir la base gravable de tus ingresos, sujeto a ciertos l\u00edmites y condiciones.\",\r\n            \"Total Patrimonio\": \"Es la suma total de todos tus activos (bienes y derechos) en un per\u00edodo determinado. Representa el valor total de lo que posees.\",\r\n            \"Total Deudas\": \"Es la suma total de todas tus obligaciones financieras o pasivos. Un aumento podr\u00eda indicar nuevas responsabilidades crediticias.\",\r\n            \"Patrimonio Liquido\": \"Es el resultado de restar tus deudas al total de tu patrimonio. Indica tu riqueza neta real.\",\r\n            \"Rentas De Trabajo\": \"Son los ingresos que obtienes por tu actividad laboral, como salarios, comisiones o prestaciones sociales.\",\r\n            \"Ingresos Por Salarios\": \"El aumento en este ingreso respecto al a\u00f1o anterior puede responder a un ajuste en el salario o por alg\u00fan rubro extra recibido como ingreso laboral.\",\r\n            \"Derechos Fiduciarios\": \"Representan la participaci\u00f3n en un fideicomiso, donde un activo es administrado por un tercero en tu beneficio.\",\r\n            \"Bienes Muebles\": \"Son activos que pueden trasladarse de un lugar a otro sin alterar su naturaleza, como mobiliario, equipos o joyas.\",\r\n            \"Veh\u00edculos\": \"Activos como autom\u00f3viles, motocicletas o camiones. Su valor puede depreciarse con el tiempo.\",\r\n            \"Ingresos Por Honorarios, Comisiones Y Servicios\": \"Ganancias obtenidas por servicios profesionales prestados de forma independiente, comisiones por ventas o cualquier otro servicio.\",\r\n            \"Ingresos En El Exterior\": \"Son los ingresos que generas o recibes de fuentes ubicadas fuera de tu pa\u00eds de residencia fiscal.\",\r\n            \"Costos Y Deducciones Procedentes (Trabajadores Independientes)\": \"Gastos permitidos legalmente para reducir la base gravable de los ingresos de trabajadores independientes.\",\r\n            \"Rentas Exentas De Trabajo Y Deducciones Imputables (Limitadas)\": \"Beneficios fiscales que permiten reducir la base gravable de tus ingresos laborales, sujeto a l\u00edmites y condiciones espec\u00edficas.\",\r\n            \"Ingresos Por Arrendamiento\": \"Ganancias obtenidas por el alquiler de bienes inmuebles o muebles.\",\r\n            \"Ingresos Por Regalias Y Propiedad Intelectual\": \"Ingresos provenientes del uso o explotaci\u00f3n de derechos de autor, patentes, marcas o cualquier otra propiedad intelectual.\",\r\n            \"Ingresos En El Exterior Por Rentas De Capital\": \"Rendimientos de capital (intereses, dividendos) obtenidos de fuentes fuera del pa\u00eds.\",\r\n            \"Rentas Liquidas Pasivas De Capital - Ece\": \"Rentas obtenidas por capital que no requieren tu participaci\u00f3n activa, provenientes de Entidades Controladas del Exterior (ECE).\",\r\n            \"Ingresos En El Exterior Por Rentas No Laborales\": \"Ingresos no laborales (honorarios, arrendamientos) obtenidos de fuentes fuera del pa\u00eds.\",\r\n            \"Devouciones, Rebajas Y Descuentos\": \"Disminuciones en el valor de ventas o ingresos debido a devoluciones de productos, rebajas por volumen o descuentos comerciales.\",\r\n            \"Rentas Liquidas Pasivas No Laborales - Ece\": \"Rentas no laborales obtenidas de forma pasiva (sin participaci\u00f3n activa) de Entidades Controladas del Exterior (ECE).\",\r\n            \"Rentas Exentas Y Deducciones Imputables (Limitadas)\": \"Beneficios fiscales que permiten reducir la base gravable, sujeto a ciertos l\u00edmites y condiciones.\",\r\n            \"Pensiones Del Pais Y Del Exterior\": \"Ingresos recibidos por concepto de pensiones, ya sean de origen nacional o extranjero.\",\r\n            \"Rentas Exentas De Pensiones\": \"Parte de los ingresos por pensiones que, por ley, est\u00e1n exentas de tributaci\u00f3n hasta cierto l\u00edmite.\",\r\n            \"Dividendos Y Participaciones 2016 Y Anteriores Y Otros\": \"Distribuciones de ganancias de empresas recibidas como accionista, espec\u00edficamente aquellas generadas en 2016 o a\u00f1os anteriores, y otros conceptos similares.\",\r\n            \"Ingresos No Constituvos De Renta\": \"Ingresos que, por su naturaleza o disposici\u00f3n legal, no forman parte de la base para calcular el impuesto sobre la renta.\",\r\n            \"1A. Subcedula A\u00f1o 2017 Y Siguientes Numeral 3 Art. 49 Del Et\": \"Referencia a una subc\u00e9dula espec\u00edfica de la ley tributaria para el c\u00e1lculo de dividendos y participaciones a partir de 2017.\",\r\n            \"2A. Subcedula A\u00f1o 2017 Y Siguientes Paragrafo 2 Art. 49 Del Et\": \"Otra referencia a una subc\u00e9dula y p\u00e1rrafo espec\u00edfico de la ley tributaria para el c\u00e1lculo de dividendos y participaciones a partir de 2017.\",\r\n            \"Renta Liquida Pasiva Dividendos - Ece Y\/O Recibidos Del Exterior\": \"Ganancias por dividendos obtenidas de forma pasiva de Entidades Controladas del Exterior (ECE) o recibidas directamente del extranjero.\",\r\n            \"TOTAL INGRESOS\": \"La suma total de todos los ingresos brutos percibidos antes de cualquier deducci\u00f3n o exenci\u00f3n.\"\r\n        };\r\n\r\n        const PatrimonioPieChart = ({ data, formatCurrency }) => {\r\n            const svgRef = useRef();\r\n            const tooltipRef = useRef();\r\n            const brandColors = [\"#D82A36\", \"#FFD700\", \"#38bdf8\", \"#4A4A4A\", \"#9333ea\", \"#16a34a\", \"#fb923c\", \"#6d28d9\"];\r\n            const color = typeof window.d3 !== 'undefined' ? d3.scaleOrdinal(brandColors) : () => \"gray\";\r\n\r\n            useEffect(() => {\r\n                if (typeof window.d3 === 'undefined') {\r\n                    console.error(\"D3.js no est\u00e1 cargado. El gr\u00e1fico de pastel no se puede renderizar.\");\r\n                    return;\r\n                }\r\n\r\n                const width = 400;\r\n                const height = 400;\r\n                const radius = Math.min(width, height) \/ 2;\r\n                const innerRadius = radius * 0.5;\r\n\r\n                d3.select(svgRef.current).selectAll(\"*\").remove();\r\n\r\n                const svg = d3.select(svgRef.current)\r\n                    .attr(\"width\", \"100%\")\r\n                    .attr(\"height\", \"100%\")\r\n                    .attr(\"viewBox\", `0 0 ${width} ${height}`)\r\n                    .append(\"g\")\r\n                    .attr(\"transform\", `translate(${width \/ 2},${height \/ 2})`);\r\n\r\n                const pie = d3.pie()\r\n                    .value(d => d.value)\r\n                    .sort(null);\r\n\r\n                const arc = d3.arc()\r\n                    .innerRadius(innerRadius)\r\n                    .outerRadius(radius);\r\n\r\n                const pieData = data.filter(d => d.value > 0);\r\n                const totalValue = d3.sum(pieData, d => d.value);\r\n\r\n                const arcs = svg.selectAll(\".arc\")\r\n                    .data(pie(pieData))\r\n                    .enter()\r\n                    .append(\"g\")\r\n                    .attr(\"class\", \"arc\");\r\n\r\n                arcs.append(\"path\")\r\n                    .attr(\"d\", arc)\r\n                    .attr(\"fill\", d => color(d.data.label))\r\n                    .attr(\"stroke\", \"white\")\r\n                    .style(\"stroke-width\", \"2px\")\r\n                    .on(\"mouseover\", (event, d) => {\r\n                        d3.select(tooltipRef.current)\r\n                            .style(\"opacity\", 1)\r\n                            .html(`\r\n                                <strong>${d.data.label}<\/strong><br\/>\r\n                                ${formatCurrency(d.data.value)}<br\/>\r\n                                ${(d.data.value \/ totalValue * 100).toFixed(2)}%\r\n                            `)\r\n                            .style(\"left\", (event.pageX + 10) + \"px\")\r\n                            .style(\"top\", (event.pageY - 28) + \"px\");\r\n                    })\r\n                    .on(\"mousemove\", (event) => {\r\n                        d3.select(tooltipRef.current)\r\n                            .style(\"left\", (event.pageX + 10) + \"px\")\r\n                            .style(\"top\", (event.pageY - 28) + \"px\");\r\n                    })\r\n                    .on(\"mouseout\", () => {\r\n                        d3.select(tooltipRef.current)\r\n                            .style(\"opacity\", 0);\r\n                    });\r\n\r\n                arcs.append(\"text\")\r\n                    .attr(\"transform\", d => `translate(${arc.centroid(d)})`)\r\n                    .attr(\"text-anchor\", \"middle\")\r\n                    .attr(\"font-size\", \"10px\")\r\n                    .attr(\"fill\", d => {\r\n                        const brightness = d3.lab(color(d.data.label)).l;\r\n                        return brightness > 60 ? \"black\" : \"white\";\r\n                    })\r\n                    .text(d => {\r\n                        const percentage = (d.data.value \/ totalValue * 100);\r\n                        if (percentage > 0.5) {\r\n                            return `${percentage.toFixed(1)}%`;\r\n                        }\r\n                        return '';\r\n                    });\r\n\r\n            }, [data, formatCurrency, color]);\r\n\r\n            return (\r\n                <div className=\"flex flex-col items-center justify-center w-full\">\r\n                    {\/* Leyenda *\/}\r\n                    <div className=\"flex flex-wrap justify-center gap-x-4 gap-y-2 mb-4\">\r\n                        {data.filter(d => d.value > 0).map((d, i) => (\r\n                            <div key={d.label} className=\"flex items-center\">\r\n                                <span style={{ backgroundColor: color(d.label), width: '16px', height: '16px', borderRadius: '4px' }} className=\"inline-block mr-2\"><\/span>\r\n                                <span className=\"text-sm text-gray-800\">{d.label}<\/span>\r\n                            <\/div>\r\n                        ))}\r\n                    <\/div>\r\n                    <svg ref={svgRef} className=\"w-full h-96\"><\/svg> {\/* SVG responsive *\/}\r\n                    <div ref={tooltipRef} className=\"chart-tooltip\"><\/div>\r\n                <\/div>\r\n            );\r\n        };\r\n\r\n        const getExplanation = (concept) => {\r\n            if (!concept) return \"No hay una explicaci\u00f3n detallada disponible para este concepto.\";\r\n            const normalizedConcept = concept.trim();\r\n            for (const key in CONCEPT_EXPLANATIONS) {\r\n                if (key.trim() === normalizedConcept) {\r\n                    return CONCEPT_EXPLANATIONS[key];\r\n                }\r\n            }\r\n            return \"No hay una explicaci\u00f3n detallada disponible para este concepto.\";\r\n        };\r\n\r\n\r\n        const App = () => {\r\n            const [taxData, setTaxData] = useState([]);\r\n            const [loadedFile, setLoadedFile] = useState(null);\r\n            const [loading, setLoading] = useState(false);\r\n            const [message, setMessage] = useState({ text: '', type: '' });\r\n            const [librariesReady, setLibrariesReady] = useState(false);\r\n\r\n            const summarySectionRef = useRef(null);\r\n            const totalIngresosSummaryRef = useRef(null);\r\n            const patrimonioPieChartRef = useRef(null);\r\n            const detailSectionRef = useRef(null);\r\n            const conclusionSectionRef = useRef(null);\r\n\r\n            useEffect(() => {\r\n                const checkLibraries = () => {\r\n                    if (\r\n                        typeof window.Papa !== 'undefined' &&\r\n                        typeof window.XLSX !== 'undefined' &&\r\n                        typeof window.jspdf !== 'undefined' &&\r\n                        typeof window.html2canvas !== 'undefined' &&\r\n                        typeof window.React !== 'undefined' &&\r\n                        typeof window.ReactDOM !== 'undefined' &&\r\n                        typeof window.d3 !== 'undefined'\r\n                    ) {\r\n                        setLibrariesReady(true);\r\n                        console.log(\"Todas las librer\u00edas externas est\u00e1n cargadas.\");\r\n                    } else {\r\n                        setLibrariesReady(false);\r\n                        console.log(\"Esperando que las librer\u00edas externas se carguen...\");\r\n                    }\r\n                };\r\n\r\n                checkLibraries();\r\n                const interval = setInterval(checkLibraries, 500);\r\n                return () => clearInterval(interval);\r\n            }, []);\r\n\r\n            const showMessage = useCallback((text, type) => {\r\n                setMessage({ text, type });\r\n                setTimeout(() => {\r\n                    setMessage({ text: '', type: '' });\r\n                }, 3000);\r\n            }, []);\r\n\r\n            const formatCurrency = (amount) => {\r\n                return new Intl.NumberFormat('es-CO', {\r\n                    style: 'currency',\r\n                    currency: 'COP',\r\n                    minimumFractionDigits: 0,\r\n                    maximumFractionDigits: 0,\r\n                }).format(amount);\r\n            };\r\n\r\n            const handleFileChange = async (event) => {\r\n                const file = event.target.files[0];\r\n                setLoadedFile(file);\r\n                setTaxData([]);\r\n                setMessage({ text: '', type: '' });\r\n\r\n                if (file) {\r\n                    await processFileData(file);\r\n                }\r\n            };\r\n\r\n            const processFileData = useCallback(async (fileToProcess) => {\r\n                if (!librariesReady) {\r\n                    showMessage('Las librer\u00edas necesarias a\u00fan no est\u00e1n cargadas. Por favor, espera un momento.', 'error');\r\n                    return;\r\n                }\r\n                if (!fileToProcess) {\r\n                    showMessage('Por favor, selecciona un archivo CSV o XLSX primero.', 'error');\r\n                    return;\r\n                }\r\n\r\n                setLoading(true);\r\n                const fileName = fileToProcess.name;\r\n                const fileExtension = fileName.split('.').pop().toLowerCase();\r\n                let parsedData = [];\r\n\r\n                try {\r\n                    if (fileExtension === 'csv') {\r\n                        if (typeof window.Papa === 'undefined') {\r\n                            throw new Error('Librer\u00eda PapaParse no cargada. Aseg\u00farate de que el CDN est\u00e9 disponible.');\r\n                        }\r\n                        const results = await new Promise((resolve, reject) => {\r\n                            window.Papa.parse(fileToProcess, {\r\n                                header: true,\r\n                                dynamicTyping: true,\r\n                                skipEmptyLines: true,\r\n                                complete: resolve,\r\n                                error: reject,\r\n                            });\r\n                        });\r\n                        if (results.errors.length) {\r\n                            throw new Error('Errores al parsear CSV: ' + JSON.stringify(results.errors));\r\n                        }\r\n                        parsedData = results.data;\r\n                    } else if (fileExtension === 'xlsx') {\r\n                        if (typeof window.XLSX === 'undefined') {\r\n                            throw new Error('Librer\u00eda XLSX no cargada. Aseg\u00farate de que el CDN est\u00e9 disponible.');\r\n                        }\r\n                        const data = await new Promise((resolve, reject) => {\r\n                            const reader = new FileReader();\r\n                            reader.onload = (e) => resolve(e.target.result);\r\n                            reader.onerror = (e) => reject(new Error('Error al leer el archivo XLSX: ' + (e.target.error ? e.target.error.message : 'Error desconocido')));\r\n                            reader.readAsArrayBuffer(fileToProcess);\r\n                        });\r\n                        const workbook = window.XLSX.read(new Uint8Array(data), { type: 'array' });\r\n                        const firstSheetName = workbook.SheetNames[0];\r\n                        const worksheet = workbook.Sheets[firstSheetName];\r\n                        parsedData = window.XLSX.utils.sheet_to_json(worksheet);\r\n                    } else {\r\n                        throw new Error('Tipo de archivo no soportado. Por favor, sube un archivo CSV o XLSX.');\r\n                    }\r\n                    \r\n                    const processedTaxData = parsedData.map(row => ({\r\n                        concept: row['Concepto'],\r\n                        value2023: parseFloat(row['Valor 2023']) || 0,\r\n                        value2024: parseFloat(row['Valor 2024']) || 0,\r\n                        explanation: row['Explicacion'] || ''\r\n                    })).filter(item => item.concept && String(item.concept).trim() !== '');\r\n\r\n                    if (processedTaxData.length === 0) {\r\n                        showMessage('El archivo no contiene datos v\u00e1lidos para el an\u00e1lisis. Verifique los encabezados (Concepto, Valor 2023, Valor 2024) y el contenido.', 'error');\r\n                        setTaxData([]);\r\n                    } else {\r\n                        const filteredData = processedTaxData.filter(item => item.value2023 > 0 || item.value2024 > 0);\r\n                        setTaxData(filteredData);\r\n                        showMessage(`Datos cargados exitosamente desde ${fileExtension.toUpperCase()}.`, 'success');\r\n                    }\r\n\r\n                } catch (error) {\r\n                    console.error(\"Error processing file:\", error);\r\n                    const errorMessageText = error instanceof Error\r\n                        ? error.message\r\n                        : (error && typeof error === 'object' && 'isTrusted' in error\r\n                            ? 'Error de evento al procesar el archivo. Intente con otro archivo o revise el formato.'\r\n                            : String(error));\r\n                    showMessage(`Error al procesar el archivo: ${errorMessageText}.`, 'error');\r\n                    setTaxData([]);\r\n                } finally {\r\n                    setLoading(false);\r\n                }\r\n            }, [showMessage, librariesReady]);\r\n\r\n            const renderTaxDataItem = useCallback((item) => {\r\n                const { concept, value2023, value2024 } = item;\r\n                const difference = value2024 - value2023;\r\n                const isIncrease = difference > 0;\r\n                const isDecrease = difference < 0;\r\n                const isZero = difference === 0;\r\n\r\n                const maxValue = Math.max(value2023, value2024, 1);\r\n                const maxHeight = 120;\r\n\r\n                const height2023 = (value2023 \/ maxValue) * maxHeight;\r\n                const height2024 = (value2024 \/ maxValue) * maxHeight;\r\n\r\n                \/\/ Nueva l\u00f3gica para buscar la explicaci\u00f3n de forma m\u00e1s flexible\r\n                const getExplanation = (concept) => {\r\n                    const normalizedConcept = concept.trim();\r\n                    for (const key in CONCEPT_EXPLANATIONS) {\r\n                        if (key.trim() === normalizedConcept) {\r\n                            return CONCEPT_EXPLANATIONS[key];\r\n                        }\r\n                    }\r\n                    return \"No hay una explicaci\u00f3n detallada disponible para este concepto.\";\r\n                };\r\n\r\n                const predefinedExplanation = getExplanation(concept);\r\n\r\n                return (\r\n                    <div className=\"bg-white p-4 rounded-lg shadow-md concept-card h-full flex flex-col justify-between\">\r\n                        <div>\r\n                            <h3 className=\"font-semibold text-base text-gray-800 mb-2 text-center\">{concept}<\/h3>\r\n                            <div className=\"flex flex-col md:flex-row md:items-center text-sm md:text-base concept-values\">\r\n                                <div className=\"flex-1 text-gray-600 mb-1 md:mb-0 text-center\">\r\n                                    <span className=\"font-medium\">2023:<\/span> {formatCurrency(value2023)}\r\n                                <\/div>\r\n                                <div className=\"flex-1 text-gray-600 mb-1 md:mb-0 text-center\">\r\n                                    <span className=\"font-medium\">2024:<\/span> {formatCurrency(value2024)}\r\n                                <\/div>\r\n                            <\/div>\r\n                            <div className={`w-full text-center font-bold text-sm underline ${isIncrease ? 'text-green-600' : isDecrease ? 'text-red-600' : 'text-gray-500'} mt-2`}>\r\n                                Diferencia: {formatCurrency(difference)}\r\n                                {!isZero ? (\r\n                                    <span className=\"ml-2\">{isIncrease ? '\u2191' : '\u2193'}<\/span>\r\n                                ) : (\r\n                                    <span className=\"ml-2 text-gray-500\">\u2714<\/span>\r\n                                )}\r\n                            <\/div>\r\n                            <div className=\"mt-4 w-full flex justify-center items-end h-40\">\r\n                                <div className=\"flex flex-col items-center mx-4\">\r\n                                    <div className=\"w-12 bg-yellow-500 rounded-t-md relative flex items-end justify-center\"\r\n                                        style={{ height: `${height2023}px` }}>\r\n                                    <\/div>\r\n                                    <span className=\"text-sm text-gray-700 mt-2\">2023<\/span>\r\n                                <\/div>\r\n                                <div className=\"flex flex-col items-center mx-4\">\r\n                                    <div className=\"w-12 bg-red-600 rounded-t-md relative flex items-end justify-center\"\r\n                                        style={{ height: `${height2024}px` }}>\r\n                                    <\/div>\r\n                                    <span className=\"text-sm text-gray-700 mt-2\">2024<\/span>\r\n                                <\/div>\r\n                            <\/div>\r\n                        <\/div>\r\n                        <p className=\"explanation-text mt-2 text-gray-700 text-sm bg-gray-50 p-3 rounded-md border border-gray-100 text-center\">\r\n                            {predefinedExplanation}\r\n                        <\/p>\r\n                    <\/div>\r\n                );\r\n            }, [formatCurrency]);\r\n\r\n            \/\/ Funci\u00f3n para copiar el c\u00f3digo de los resultados al portapapeles\r\n            const copyCodeToClipboard = () => {\r\n                const resultsContainer = document.getElementById('results-container');\r\n                if (!resultsContainer || taxData.length === 0) {\r\n                    showMessage('Por favor, sube un archivo y procesa los datos antes de copiar el c\u00f3digo.', 'error');\r\n                    return;\r\n                }\r\n\r\n                \/\/ Genera el HTML completo, incluyendo los estilos y scripts\r\n                const styleAndScriptTags = `\r\n                    <style>\r\n                        ${document.querySelector('style').innerHTML}\r\n                    <\/style>\r\n                    ${Array.from(document.querySelectorAll('script')).map(script => script.outerHTML).join('')}\r\n                `;\r\n\r\n                const resultsHtml = resultsContainer.outerHTML;\r\n                const htmlContentToCopy = `\r\n                    <!DOCTYPE html>\r\n                    <html lang=\"es\">\r\n                    <head>\r\n                        <meta charset=\"UTF-8\">\r\n                        <meta name=\"viewport\" content=\"width=device-width, initial-scale=1.0\">\r\n                        <title>An\u00e1lisis de Declaraci\u00f3n de Renta<\/title>\r\n                        ${styleAndScriptTags}\r\n                    <\/head>\r\n                    <body>\r\n                        ${resultsHtml}\r\n                    <\/body>\r\n                    <\/html>\r\n                `;\r\n\r\n                const tempElement = document.createElement('textarea');\r\n                tempElement.value = htmlContentToCopy;\r\n                document.body.appendChild(tempElement);\r\n                tempElement.select();\r\n                try {\r\n                    document.execCommand('copy');\r\n                    showMessage('C\u00f3digo copiado al portapapeles. \u00a1Ya puedes pegarlo en tu sitio!', 'success');\r\n                } catch (err) {\r\n                    console.error('Error al copiar el c\u00f3digo:', err);\r\n                    showMessage('Error al copiar el c\u00f3digo. Por favor, int\u00e9ntalo manualmente.', 'error');\r\n                }\r\n                document.body.removeChild(tempElement);\r\n            };\r\n\r\n            const handleGeneratePdf = async () => {\r\n                if (!librariesReady) {\r\n                    showMessage('Las librer\u00edas necesarias para generar el PDF a\u00fan no est\u00e1n cargadas. Por favor, espera un momento.', 'error');\r\n                    return;\r\n                }\r\n                setLoading(true);\r\n                try {\r\n                    if (typeof window.jspdf === 'undefined' || typeof window.html2canvas === 'undefined') {\r\n                        throw new Error('Librer\u00edas jsPDF o html2canvas no cargadas. Aseg\u00farate de que los CDN est\u00e9n disponibles.');\r\n                    }\r\n                    const { jsPDF } = window.jspdf;\r\n                    const doc = new jsPDF('p', 'mm', 'a4');\r\n                    let yOffset = 20;\r\n                    const pageHeight = doc.internal.pageSize.height;\r\n                    const margin = 15;\r\n                    const contentWidth = 180;\r\n                    let currentPage = 1;\r\n\r\n                    const addPageIfNeeded = (requiredHeight) => {\r\n                        if (yOffset + requiredHeight > pageHeight - margin) {\r\n                            doc.addPage();\r\n                            yOffset = margin;\r\n                            currentPage++;\r\n                        }\r\n                    };\r\n                    \r\n                    const captureAndAddImage = async (elementRef, title = null) => {\r\n                        if (!elementRef || !elementRef.current) return;\r\n                        \r\n                        if (title) {\r\n                            addPageIfNeeded(10);\r\n                            doc.setFontSize(20);\r\n                            doc.text(title, 105, yOffset, { align: \"center\" });\r\n                            yOffset += 10;\r\n                        }\r\n                        \r\n                        const canvas = await window.html2canvas(elementRef.current, { backgroundColor: null, scale: 2 });\r\n                        const imgData = canvas.toDataURL('image\/png');\r\n                        const imgWidth = contentWidth;\r\n                        const imgHeight = canvas.height * (imgWidth \/ canvas.width);\r\n                        \r\n                        addPageIfNeeded(imgHeight + 10);\r\n                        doc.addImage(imgData, 'PNG', margin, yOffset, imgWidth, imgHeight);\r\n                        yOffset += imgHeight + 15;\r\n                    };\r\n\r\n\r\n                    doc.setFontSize(24);\r\n                    doc.text(\"An\u00e1lisis de Declaraci\u00f3n de Renta\", 105, yOffset, { align: \"center\" });\r\n                    yOffset += 12;\r\n                    doc.setFontSize(16);\r\n                    doc.text(\"Panel Interactivo para Clientes\", 105, yOffset, { align: \"center\" });\r\n                    yOffset += 20;\r\n\r\n                    await captureAndAddImage(summarySectionRef, \"Resumen Ejecutivo de Patrimonio\");\r\n                    \r\n                    await captureAndAddImage(totalIngresosSummaryRef, \"Resumen Ejecutivo de Ingresos\");\r\n                    \r\n                    await captureAndAddImage(patrimonioPieChartRef, \"Composici\u00f3n del Patrimonio (2024)\");\r\n\r\n                    if (finalFilteredTaxData.length > 0) {\r\n                        await captureAndAddImage(detailSectionRef, \"Desglose Detallado por Concepto\");\r\n                    } else if (taxData.length > 0) {\r\n                        addPageIfNeeded(20);\r\n                        doc.setFontSize(14);\r\n                        doc.setTextColor(100);\r\n                        doc.text(\"No hay conceptos con valores diferentes de cero para visualizar en el desglose detallado.\", 105, yOffset, { align: \"center\" });\r\n                        yOffset += 20;\r\n                        doc.setTextColor(0);\r\n                    }\r\n                    \r\n                    await captureAndAddImage(conclusionSectionRef, \"Conclusiones Clave\");\r\n\r\n\r\n                    doc.save('dashboard_declaraciones_renta.pdf');\r\n                    showMessage('PDF generado exitosamente.', 'success');\r\n\r\n                } catch (error) {\r\n                    console.error(\"Error generating PDF:\", error);\r\n                    showMessage('Error al generar el PDF. Por favor, int\u00e9ntelo de nuevo.', 'error');\r\n                } finally {\r\n                    setLoading(false);\r\n                }\r\n            };\r\n\r\n\r\n            const patrimonioLiquido2023 = taxData.find(item => item.concept === \"Patrimonio Liquido\")?.value2023 || 0;\r\n            const patrimonioLiquido2024 = taxData.find(item => item.concept === \"Patrimonio Liquido\")?.value2024 || 0;\r\n            const differencePatrimonio = patrimonioLiquido2024 - patrimonioLiquido2023;\r\n            const isPatrimonioIncrease = differencePatrimonio > 0;\r\n\r\n            const totalIngresos2023 = taxData.find(item => item.concept === \"TOTAL INGRESOS\")?.value2023 || 0;\r\n            const totalIngresos2024 = taxData.find(item => item.concept === \"TOTAL INGRESOS\")?.value2024 || 0;\r\n            const differenceTotalIngresos = totalIngresos2024 - totalIngresos2023;\r\n            const isTotalIngresosIncrease = differenceTotalIngresos > 0;\r\n\r\n            const patrimonioChartData = PATRIMONIO_CONCEPTS.map(conceptName => {\r\n                const item = taxData.find(d => d.concept === conceptName);\r\n                return {\r\n                    label: conceptName,\r\n                    value: item ? item.value2024 : 0\r\n                };\r\n            }).filter(d => d.value > 0);\r\n            \r\n            let processedForDisplay = taxData.filter(item => item.value2023 > 0 || item.value2024 > 0);\r\n            const totalIngresosItem = processedForDisplay.find(item => item.concept === \"TOTAL INGRESOS\");\r\n            let otherConceptsForDisplay = processedForDisplay.filter(item => item.concept !== \"TOTAL INGRESOS\");\r\n            const finalFilteredTaxData = totalIngresosItem ? [...otherConceptsForDisplay, totalIngresosItem] : otherConceptsForDisplay;\r\n\r\n            return (\r\n                <div className=\"min-h-screen bg-gradient-to-br from-[#E0F2F7] to-[#FFFBEB] p-4 sm:p-6 font-sans\">\r\n                    <div className=\"max-w-4xl mx-auto bg-white p-6 sm:p-8 rounded-xl shadow-2xl w-full\">\r\n\r\n                        {\/* File Upload Section and action buttons *\/}\r\n                        <div id=\"main-app-container\">\r\n                            <h1 className=\"text-3xl sm:text-4xl font-extrabold text-center text-gray-900 mb-8 leading-tight\">\r\n                                Tu Declaraci\u00f3n de Renta: <br className=\"sm:hidden\"\/>An\u00e1lisis Comparativo 2023 vs. 2024\r\n                            <\/h1>\r\n\r\n                            <div className=\"bg-[#EBF8FF] p-6 rounded-lg shadow-inner mb-8 border border-black\">\r\n                                <h2 className=\"text-2xl font-bold text-gray-900 mb-4 text-center\">Cargar Datos de Declaraci\u00f3n<\/h2>\r\n                                <input\r\n                                    type=\"file\"\r\n                                    id=\"file-input\"\r\n                                    accept=\".csv, .xlsx\"\r\n                                    onChange={handleFileChange}\r\n                                    className=\"block w-full text-sm text-gray-900\r\n                                        file:mr-4 file:py-2 file:px-4\r\n                                        file:rounded-full file:border-0\r\n                                        file:text-sm file:font-semibold\r\n                                        file:bg-[#D82A36] file:text-white\r\n                                        hover:file:bg-[#B0222B]\r\n                                        cursor-pointer\"\r\n                                \/>\r\n                                <p id=\"file-status-message\" className=\"text-center text-gray-700 mt-2 text-sm\">\r\n                                    {loadedFile ? `Archivo seleccionado: ${loadedFile.name}` : 'Por favor, selecciona tu archivo CSV o XLSX para analizar los datos.'}\r\n                                <\/p>\r\n                            <\/div>\r\n\r\n                             <div className=\"flex flex-col justify-center space-y-4 mt-8\">\r\n                                <button\r\n                                    id=\"generate-pdf-button\"\r\n                                    onClick={handleGeneratePdf}\r\n                                    className=\"action-button\"\r\n                                    disabled={loading || taxData.length === 0 || !librariesReady}\r\n                                >\r\n                                    {loading ? 'Generando PDF...' : 'Generar PDF de la Declaraci\u00f3n'}\r\n                                <\/button>\r\n                                 <button\r\n                                    id=\"copy-code-button\"\r\n                                    onClick={copyCodeToClipboard}\r\n                                    className=\"action-button bg-gray-500 hover:bg-gray-700\"\r\n                                >\r\n                                    Copiar c\u00f3digo completo\r\n                                <\/button>\r\n                            <\/div>\r\n                        <\/div>\r\n\r\n                        {\/* Message Box *\/}\r\n                        {message.text && (\r\n                            <div className={`message-box ${message.type}`}>\r\n                                {message.text}\r\n                            <\/div>\r\n                        )}\r\n\r\n                        {\/* Loading Indicator *\/}\r\n                        {loading && !message.text && (\r\n                            <div className=\"loading-indicator\">\r\n                                <div className=\"loading-spinner\"><\/div>\r\n                                <span>Cargando datos...<\/span>\r\n                            <\/div>\r\n                        )}\r\n\r\n                        {\/* Conditional rendering of sections based on taxData availability *\/}\r\n                        {taxData.length > 0 && (\r\n                            <div id=\"results-container\" class=\"results-container mt-8\">\r\n                                {\/* New: Executive Summary Title *\/}\r\n                                <h2 className=\"text-2xl font-bold text-gray-900 mb-6 text-center\">Resumen Ejecutivo<\/h2>\r\n\r\n                                {\/* General Summary Section (Patrimonio L\u00edquido) *\/}\r\n                                <div id=\"summary-section-container\" ref={summarySectionRef} className=\"bg-[#FFFBEB] p-6 rounded-lg shadow-inner mb-8 border border-black\">\r\n                                    <h2 className=\"text-2xl font-bold text-gray-900 mb-4 text-center\">Patrimonio L\u00edquido<\/h2>\r\n                                    <div id=\"summary-section\" className=\"grid grid-cols-1 md:grid-cols-3 gap-4 text-center\">\r\n                                        <div className=\"bg-[#FEE3A4] p-4 rounded-lg shadow-sm border border-black\">\r\n                                            <p className=\"text-gray-900 text-lg font-semibold\">Patrimonio L\u00edquido 2023<\/p>\r\n                                            <p className=\"text-gray-900 text-xl font-bold\">{formatCurrency(patrimonioLiquido2023)}<\/p>\r\n                                        <\/div>\r\n                                        <div className=\"bg-[#FCD34D] p-4 rounded-lg shadow-sm border border-black\">\r\n                                            <p className=\"text-gray-900 text-lg font-semibold\">Patrimonio L\u00edquido 2024<\/p>\r\n                                            <p className=\"text-gray-900 text-xl font-bold\">{formatCurrency(patrimonioLiquido2024)}<\/p>\r\n                                        <\/div>\r\n                                        <div className=\"bg-white p-4 rounded-lg shadow-sm border border-black\">\r\n                                            <p className=\"text-gray-900 text-lg font-semibold\">Diferencia<\/p>\r\n                                            <p className={`text-xl font-bold ${isPatrimonioIncrease ? 'text-green-600' : 'text-red-600'}`}>\r\n                                                {formatCurrency(differencePatrimonio)}\r\n                                                {isPatrimonioIncrease ? ' \u2191' : ' \u2193'}\r\n                                            <\/p>\r\n                                        <\/div>\r\n                                    <\/div>\r\n                                    <p id=\"summary-conclusion\" className=\"text-gray-800 text-center mt-4 text-md\">\r\n                                        Tu patrimonio l\u00edquido {isPatrimonioIncrease ? 'aument\u00f3' : 'disminuy\u00f3'} en {formatCurrency(differencePatrimonio)}.\r\n                                    <\/p>\r\n                                <\/div>\r\n\r\n                                {\/* New: General Summary Section (Total Ingresos) *\/}\r\n                                <div id=\"total-ingresos-summary-container\" ref={totalIngresosSummaryRef} className=\"bg-[#E0F2F7] p-6 rounded-lg shadow-inner mb-8 border border-black\">\r\n                                    <h2 className=\"text-2xl font-bold text-gray-900 mb-4 text-center\">Total Ingresos<\/h2>\r\n                                    <div id=\"total-ingresos-summary-section\" className=\"grid grid-cols-1 md:grid-cols-3 gap-4 text-center\">\r\n                                        <div className=\"bg-[#BEE3ED] p-4 rounded-lg shadow-sm border border-black\">\r\n                                            <p className=\"text-gray-900 text-lg font-semibold\">Total Ingresos 2023<\/p>\r\n                                            <p className=\"text-gray-900 text-xl font-bold\">{formatCurrency(totalIngresos2023)}<\/p>\r\n                                        <\/div>\r\n                                        <div className=\"bg-[#90D9EC] p-4 rounded-lg shadow-sm border border-black\">\r\n                                            <p className=\"text-gray-900 text-lg font-semibold\">Total Ingresos 2024<\/p>\r\n                                            <p className=\"text-gray-900 text-xl font-bold\">{formatCurrency(totalIngresos2024)}<\/p>\r\n                                        <\/div>\r\n                                        <div className=\"bg-white p-4 rounded-lg shadow-sm border border-black\">\r\n                                            <p className=\"text-gray-900 text-lg font-semibold\">Diferencia<\/p>\r\n                                            <p className={`text-xl font-bold ${isTotalIngresosIncrease ? 'text-green-600' : 'text-red-600'}`}>\r\n                                                {formatCurrency(differenceTotalIngresos)}\r\n                                                {isTotalIngresosIncrease ? ' \u2191' : ' \u2193'}\r\n                                            <\/p>\r\n                                        <\/div>\r\n                                    <\/div>\r\n                                    <p id=\"total-ingresos-summary-conclusion\" className=\"text-gray-800 text-center mt-4 text-md\">\r\n                                        Tu total de ingresos {isTotalIngresosIncrease ? 'aument\u00f3' : 'disminuy\u00f3'} en {formatCurrency(differenceTotalIngresos)}.\r\n                                    <\/p>\r\n                                <\/div>\r\n\r\n                                {\/* New: Patrimonio Pie Chart Section *\/}\r\n                                <div id=\"patrimonio-pie-chart-container\" ref={patrimonioPieChartRef} className=\"bg-[#EBF8FF] p-6 rounded-lg shadow-inner mb-8 border border-black flex flex-col items-center\">\r\n                                    <h2 className=\"text-2xl font-bold text-gray-900 mb-4 text-center\">Composici\u00f3n del Patrimonio (2024)<\/h2>\r\n                                    {patrimonioChartData.length > 0 ? (\r\n                                        <PatrimonioPieChart data={patrimonioChartData} formatCurrency={formatCurrency} \/>\r\n                                    ) : (\r\n                                        <p className=\"text-center text-gray-600 mt-4\">No hay datos de patrimonio disponibles para el gr\u00e1fico de pastel.<\/p>\r\n                                    )}\r\n                                <\/div>\r\n\r\n\r\n                                {\/* Detailed Concept Section (filtered) - Ahora muestra solo conceptos con valores > 0 y seleccionados *\/}\r\n                                <h2 className=\"text-2xl font-bold text-gray-900 mb-6 text-center\">Desglose Detallado por Concepto<\/h2>\r\n                                <div id=\"detail-section\" className=\"grid grid-cols-1 md:grid-cols-3 gap-6\" ref={detailSectionRef}>\r\n                                    {finalFilteredTaxData.length === 0 ? (\r\n                                        <p className=\"col-span-full text-center text-gray-600 mt-4\">No hay datos con valores diferentes de cero para visualizar en el desglose detallado.<\/p>\r\n                                    ) : (\r\n                                        finalFilteredTaxData.map(item => (\r\n                                            <div key={item.concept}>\r\n                                                {renderTaxDataItem(item)}\r\n                                            <\/div>\r\n                                        ))\r\n                                    )}\r\n                                <\/div>\r\n                                \r\n                                {\/* Conclusion *\/}\r\n                                <div id=\"conclusion-section-container\" ref={conclusionSectionRef} className=\"bg-[#FFFBEB] p-6 rounded-lg shadow-inner mt-8 border border-black\">\r\n                                    <h2 className=\"text-2xl font-bold text-gray-900 mb-4 text-center\">Conclusiones Clave<\/h2>\r\n                                    <ul class=\"list-disc list-inside text-gray-800 space-y-2\">\r\n                                        <li>Tu <strong class=\"font-bold\">Renta L\u00edquida Gravable<\/strong> (ingreso imponible) aument\u00f3 significativamente, siendo el principal factor del incremento en tus impuestos.<\/li>\r\n                                        <li>Aunque tus <strong class=\"font-bold\">Retenciones<\/strong> tambi\u00e9n aumentaron, no lograron cubrir completamente el incremento en tu <strong class=\"font-bold\">Impuesto a Cargo<\/strong>.<\/li>\r\n                                        <li>Esto result\u00f3 en un <strong class=\"font-bold\">Saldo a Pagar por Impuesto<\/strong> m\u00e1s alto en 2024.<\/li>\r\n                                        <li>No se registraron <strong class=\"font-bold\">Ganancias Ocasionales<\/strong> ni <strong class=\"font-bold\">Saldos a Favor<\/strong> en ninguno de los dos a\u00f1os.<\/li>\r\n                                    <\/ul>\r\n                                    <p class=\"text-center text-gray-800 mt-4 text-md font-semibold\">\r\n                                        \u00a1Comprender estos conceptos te ayuda a tomar mejores decisiones financieras!\r\n                                    <\/p>\r\n                                <\/div>\r\n                            <\/div>\r\n                        )}\r\n                    <\/div>\r\n                <\/div>\r\n            );\r\n        };\r\n\r\n        const rootElement = document.getElementById('react-app-root');\r\n        if (rootElement) {\r\n            if (typeof ReactDOM !== 'undefined' && typeof ReactDOM.createRoot === 'function') {\r\n                const root = ReactDOM.createRoot(rootElement);\r\n                root.render(<App \/>);\r\n            } else {\r\n                console.error(\"ReactDOM no est\u00e1 disponible. La aplicaci\u00f3n React no puede ser renderizada.\");\r\n                rootElement.innerHTML = \"<p style='color: red; text-align: center;'>Error: La aplicaci\u00f3n no pudo cargarse. Aseg\u00farate de que React y ReactDOM est\u00e9n cargados.<\/p>\";\r\n            }\r\n        }\r\n    <\/script>\r\n<\/body>\r\n<\/html>\r\n\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t<div class=\"elementor-element elementor-element-e230f82 elementor-widget-divider--view-line elementor-widget elementor-widget-divider\" data-id=\"e230f82\" data-element_type=\"widget\" data-e-type=\"widget\" data-widget_type=\"divider.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t\t\t\t\t<div class=\"elementor-divider\">\n\t\t\t<span class=\"elementor-divider-separator\">\n\t\t\t\t\t\t<\/span>\n\t\t<\/div>\n\t\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t<div class=\"elementor-element elementor-element-0267671 e-flex e-con-boxed e-con e-parent\" data-id=\"0267671\" data-element_type=\"container\" data-e-type=\"container\">\n\t\t\t\t\t<div class=\"e-con-inner\">\n\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t<div class=\"elementor-element elementor-element-054323e e-flex e-con-boxed e-con e-parent\" data-id=\"054323e\" data-element_type=\"container\" data-e-type=\"container\">\n\t\t\t\t\t<div class=\"e-con-inner\">\n\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t","protected":false},"excerpt":{"rendered":"<p>Home An\u00e1lisis Comparativo de Declaraci\u00f3n de Renta<\/p>\n","protected":false},"author":1,"featured_media":0,"parent":0,"menu_order":0,"comment_status":"closed","ping_status":"closed","template":"elementor_header_footer","meta":{"_acf_changed":false,"footnotes":""},"class_list":["post-26198","page","type-page","status-publish","hentry"],"acf":[],"_links":{"self":[{"href":"https:\/\/smartax.com.co\/smartax\/wp-json\/wp\/v2\/pages\/26198","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/smartax.com.co\/smartax\/wp-json\/wp\/v2\/pages"}],"about":[{"href":"https:\/\/smartax.com.co\/smartax\/wp-json\/wp\/v2\/types\/page"}],"author":[{"embeddable":true,"href":"https:\/\/smartax.com.co\/smartax\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/smartax.com.co\/smartax\/wp-json\/wp\/v2\/comments?post=26198"}],"version-history":[{"count":181,"href":"https:\/\/smartax.com.co\/smartax\/wp-json\/wp\/v2\/pages\/26198\/revisions"}],"predecessor-version":[{"id":26631,"href":"https:\/\/smartax.com.co\/smartax\/wp-json\/wp\/v2\/pages\/26198\/revisions\/26631"}],"wp:attachment":[{"href":"https:\/\/smartax.com.co\/smartax\/wp-json\/wp\/v2\/media?parent=26198"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}