ngx-export-as
Version:
[](https://badge.fury.io/js/ngx-export-as) [](https://opensource.org/licenses/MIT)
1 lines • 35.3 kB
Source Map (JSON)
{"version":3,"file":"ngx-export-as.mjs","sources":["../../../projects/ngx-export-as/src/lib/export-as.service.ts","../../../projects/ngx-export-as/src/public_api.ts","../../../projects/ngx-export-as/src/ngx-export-as.ts"],"sourcesContent":["import { Inject, Injectable, PLATFORM_ID } from '@angular/core';\nimport { Observable } from 'rxjs';\n\nimport { ExportAsConfig } from './export-as-config.model';\n\nimport html2canvas from 'html2canvas';\nimport * as XLSX from 'xlsx';\n// import HTMLtoDOCX from 'html-to-docx';\nimport html2pdf from 'html2pdf.js';\nimport { isPlatformBrowser } from '@angular/common';\n\n/**\n * Angular service for exporting HTML/Table elements to various file formats\n * \n * @description\n * This service provides functionality to export HTML content, tables, or specific DOM elements\n * into various file formats including PDF, PNG, Excel, Word documents, CSV, JSON, and XML.\n * \n * Supports both browser download and base64 content retrieval for further processing.\n * \n * **As of v1.21.0:** This is a standalone service - no NgModule required.\n * Provide it directly in your component or app.config.ts.\n * \n * @export\n * @class ExportAsService\n * \n * @example\n * ```typescript\n * // Standalone Component (Recommended)\n * import { Component, inject } from '@angular/core';\n * \n * @Component({\n * selector: 'app-export',\n * standalone: true,\n * providers: [ExportAsService]\n * })\n * export class ExportComponent {\n * private readonly exportAsService = inject(ExportAsService);\n * \n * exportToPDF() {\n * const config: ExportAsConfig = {\n * type: 'pdf',\n * elementIdOrContent: 'tableId'\n * };\n * this.exportAsService.save(config, 'my-export').subscribe(() => {\n * console.log('Export completed');\n * });\n * }\n * }\n * ```\n * \n * @example\n * ```typescript\n * // App-wide provider (app.config.ts)\n * export const appConfig: ApplicationConfig = {\n * providers: [ExportAsService]\n * };\n * ```\n */\n@Injectable()\nexport class ExportAsService {\n\n /**\n * Creates an instance of ExportAsService\n * @param {Object} platformId - Angular platform identifier for SSR compatibility\n * @memberof ExportAsService\n */\n constructor(\n @Inject(PLATFORM_ID) private platformId: Object\n ) {\n if (isPlatformBrowser(this.platformId)) {\n window['html2canvas'] = html2canvas;\n }\n }\n\n /**\n * Retrieves the exported content as a base64 string or JSON object\n * \n * @description\n * This is the main method for retrieving exported content without downloading.\n * The return type varies by format:\n * - Most formats: base64 encoded string\n * - JSON format: returns actual JSON object (not base64)\n * \n * @param {ExportAsConfig} config - Export configuration object\n * @returns {Observable<string | null>} Observable containing the base64 string or null\n * \n * @example\n * ```typescript\n * const config: ExportAsConfig = {\n * type: 'pdf',\n * elementIdOrContent: 'myTableId'\n * };\n * \n * this.exportAsService.get(config).subscribe(content => {\n * console.log('Base64 content:', content);\n * // Use content for upload, preview, etc.\n * });\n * ```\n * \n * @memberof ExportAsService\n */\n get(config: ExportAsConfig): Observable<string | null> {\n // structure method name dynamically by type\n const func = 'get' + config.type.toUpperCase();\n // if type supported execute and return\n if (this[func]) {\n return this[func](config);\n }\n\n // throw error for unsupported formats\n return new Observable((observer) => { observer.error('Export type is not supported.'); });\n }\n\n /**\n * Exports and automatically downloads the file to the user's device\n * \n * @description\n * This method triggers an automatic download of the exported content.\n * The file extension is automatically appended based on the export type.\n * \n * @param {ExportAsConfig} config - Export configuration object\n * @param {string} fileName - The name of the file to be saved (without extension)\n * @returns {Observable<string | null>} Observable that completes when download starts\n * \n * @example\n * ```typescript\n * private readonly exportAsService = inject(ExportAsService);\n * \n * downloadReport() {\n * const config: ExportAsConfig = {\n * type: 'xlsx',\n * elementIdOrContent: 'dataTable',\n * options: { /* SheetJS options *\\/ }\n * };\n * \n * this.exportAsService.save(config, 'quarterly-report').subscribe(() => {\n * console.log('Download started');\n * });\n * }\n * ```\n * \n * @memberof ExportAsService\n */\n save(config: ExportAsConfig, fileName: string): Observable<string | null> {\n // set download\n config.download = true;\n // get file name with type\n config.fileName = fileName + '.' + config.type;\n return this.get(config);\n }\n\n /**\n * Converts a base64 data URL string to a Blob object\n * \n * @description\n * Extracts the MIME type and decodes the base64 string to create a Blob.\n * Useful for handling binary data in browsers.\n * \n * @param {string} content - Base64 encoded data URL string (e.g., \"data:image/png;base64,...\")\n * @returns {Observable<Blob>} Observable containing the Blob object\n * \n * @example\n * ```typescript\n * private readonly exportAsService = inject(ExportAsService);\n * \n * convertToBlob() {\n * const dataUrl = 'data:image/png;base64,iVBORw0KGgo...';\n * this.exportAsService.contentToBlob(dataUrl).subscribe(blob => {\n * console.log('Blob size:', blob.size);\n * });\n * }\n * ```\n * \n * @memberof ExportAsService\n */\n contentToBlob(content: string): Observable<Blob> {\n return new Observable((observer) => {\n // get content string and extract mime type\n const arr = content.split(','), mime = arr[0].match(/:(.*?);/)[1],\n bstr = atob(arr[1]);\n let n = bstr.length;\n const u8arr = new Uint8Array(n);\n while (n--) {\n u8arr[n] = bstr.charCodeAt(n);\n }\n observer.next(new Blob([u8arr], { type: mime }));\n observer.complete();\n });\n }\n\n /**\n * Removes the data URL prefix from a base64 string\n * \n * @description\n * Strips the MIME type prefix (e.g., \"data:text/csv;base64,\") from a base64 data URL,\n * leaving only the raw base64 encoded content.\n * \n * @param {string} fileContent - The complete base64 data URL string\n * @returns {string} The raw base64 string without the data URL prefix\n * \n * @example\n * ```typescript\n * const dataUrl = 'data:text/csv;base64,SGVsbG8gV29ybGQ=';\n * const base64Only = this.removeFileTypeFromBase64(dataUrl);\n * // Result: 'SGVsbG8gV29ybGQ='\n * ```\n * \n * @memberof ExportAsService\n */\n removeFileTypeFromBase64(fileContent: string): string {\n const re = /^data:[^]*;base64,/g;\n const newContent: string = re[Symbol.replace](fileContent, '');\n return newContent;\n }\n\n /**\n * Adds a data URL prefix to a raw base64 string\n * \n * @description\n * Prepends the MIME type and base64 identifier to create a valid data URL\n * that can be used in browsers.\n * \n * @param {string} fileContent - Raw base64 encoded string\n * @param {string} fileMime - MIME type (e.g., \"text/csv\", \"image/png\")\n * @returns {string} Complete base64 data URL string\n * \n * @example\n * ```typescript\n * const base64 = 'SGVsbG8gV29ybGQ=';\n * const dataUrl = this.addFileTypeToBase64(base64, 'text/plain');\n * // Result: 'data:text/plain;base64,SGVsbG8gV29ybGQ='\n * ```\n * \n * @memberof ExportAsService\n */\n addFileTypeToBase64(fileContent: string, fileMime: string): string {\n return `data:${fileMime};base64,${fileContent}`;\n }\n\n /**\n * Downloads a file from a data URL\n * \n * @description\n * Converts a base64 data URL to a Blob and initiates a browser download.\n * \n * @param {string} fileName - The name for the downloaded file (with extension)\n * @param {string} dataURL - Base64 data URL string\n * @returns {void}\n * \n * @example\n * ```typescript\n * const dataUrl = 'data:text/csv;base64,SGVsbG8gV29ybGQ=';\n * this.downloadFromDataURL('myfile.csv', dataUrl);\n * ```\n * \n * @memberof ExportAsService\n */\n downloadFromDataURL(fileName: string, dataURL: string): void {\n // create blob\n this.contentToBlob(dataURL).subscribe(blob => {\n // download the blob\n this.downloadFromBlob(blob, fileName);\n });\n }\n\n /**\n * Downloads a file from a Blob object\n * \n * @description\n * Handles file download from Blob with cross-browser support including legacy IE.\n * Creates an object URL and triggers the download appropriately for each browser.\n * \n * @param {Blob} blob - The Blob object containing file data\n * @param {string} fileName - The name for the downloaded file (with extension)\n * @returns {void}\n * \n * @example\n * ```typescript\n * const blob = new Blob(['Hello World'], { type: 'text/plain' });\n * this.downloadFromBlob(blob, 'hello.txt');\n * ```\n * \n * @memberof ExportAsService\n */\n downloadFromBlob(blob: Blob, fileName: string) {\n // get object url\n const url = window.URL.createObjectURL(blob);\n // check for microsoft internet explorer\n if (window.navigator && window.navigator['msSaveOrOpenBlob']) {\n // use IE download or open if the user using IE\n window.navigator['msSaveOrOpenBlob'](blob, fileName);\n } else {\n this.saveFile(fileName, url);\n }\n }\n\n /**\n * Creates and triggers a download link programmatically\n * \n * @private\n * @description\n * Creates a temporary anchor element, simulates a click to trigger download,\n * and then removes the element from the DOM.\n * \n * @param {string} fileName - The name for the downloaded file\n * @param {string} url - The object URL or data URL to download\n * @returns {void}\n * \n * @memberof ExportAsService\n */\n private saveFile(fileName: string, url: string) {\n // if not using IE then create link element\n const element = document.createElement('a');\n // set download attr with file name\n element.setAttribute('download', fileName);\n // set the element as hidden\n element.style.display = 'none';\n // append the body\n document.body.appendChild(element);\n // set href attr\n element.href = url;\n // click on it to start downloading\n element.click();\n // remove the link from the dom\n document.body.removeChild(element);\n }\n\n /**\n * Exports content to PDF format\n * \n * @private\n * @description\n * Uses html2pdf.js library to convert HTML content to PDF.\n * Supports custom PDF manipulation via pdfCallbackFn option.\n * Accepts HTMLElement, Canvas, Image, or element ID as input.\n * \n * @param {ExportAsConfig} config - Export configuration with PDF-specific options\n * @returns {Observable<string | null>} Observable with base64 PDF data or null if downloading\n * \n * @example\n * ```typescript\n * // PDF with custom options\n * config.options = {\n * margin: 10,\n * filename: 'report.pdf',\n * image: { type: 'jpeg', quality: 0.98 },\n * html2canvas: { scale: 2 },\n * jsPDF: { unit: 'mm', format: 'a4', orientation: 'portrait' },\n * pdfCallbackFn: (pdf) => {\n * const pageCount = pdf.internal.getNumberOfPages();\n * for (let i = 1; i <= pageCount; i++) {\n * pdf.setPage(i);\n * pdf.text('Page ' + i, 10, 10);\n * }\n * }\n * };\n * ```\n * \n * @memberof ExportAsService\n */\n private getPDF(config: ExportAsConfig): Observable<string | null> {\n return new Observable((observer) => {\n if (!config.options) {\n config.options = {};\n }\n config.options.filename = config.fileName;\n const element: HTMLElement = document.getElementById(config.elementIdOrContent);\n const pdf = html2pdf().set(config.options).from(element ? element : config.elementIdOrContent);\n\n const download = config.download;\n const pdfCallbackFn = config.options.pdfCallbackFn;\n if (download) {\n if (pdfCallbackFn) {\n this.applyPdfCallbackFn(pdf, pdfCallbackFn).save();\n } else {\n pdf.save();\n }\n observer.next(null);\n observer.complete();\n } else {\n if (pdfCallbackFn) {\n this.applyPdfCallbackFn(pdf, pdfCallbackFn).outputPdf('datauristring').then(data => {\n observer.next(data);\n observer.complete();\n });\n } else {\n pdf.outputPdf('datauristring').then(data => {\n observer.next(data);\n observer.complete();\n });\n }\n }\n });\n }\n\n /**\n * Applies a custom callback function to modify the PDF before output\n * \n * @private\n * @description\n * Allows custom modifications to the PDF object (headers, footers, page numbers, etc.)\n * before final rendering or download.\n * \n * @param {any} pdf - The html2pdf instance\n * @param {Function} pdfCallbackFn - Callback function to modify the PDF\n * @returns {Promise} Promise that resolves after callback execution\n * \n * @memberof ExportAsService\n */\n private applyPdfCallbackFn(pdf, pdfCallbackFn) {\n return pdf.toPdf().get('pdf').then((pdfRef) => {\n pdfCallbackFn(pdfRef);\n });\n }\n\n /**\n * Exports content to PNG image format\n * \n * @private\n * @description\n * Uses html2canvas library to convert HTML element to PNG image.\n * Captures the visual representation of the specified DOM element.\n * \n * @param {ExportAsConfig} config - Export configuration with html2canvas options\n * @returns {Observable<string | null>} Observable with base64 PNG data or null if downloading\n * \n * @example\n * ```typescript\n * // PNG with custom options\n * config.options = {\n * scale: 2, // Higher quality\n * backgroundColor: '#ffffff',\n * logging: false,\n * useCORS: true, // For external images\n * allowTaint: false\n * };\n * ```\n * \n * @memberof ExportAsService\n */\n private getPNG(config: ExportAsConfig): Observable<string | null> {\n return new Observable((observer) => {\n const element: HTMLElement = document.getElementById(config.elementIdOrContent);\n html2canvas(element, config.options).then((canvas) => {\n const imgData = canvas.toDataURL('image/PNG');\n if (config.type === 'png' && config.download) {\n this.downloadFromDataURL(config.fileName, imgData);\n observer.next(null);\n } else {\n observer.next(imgData);\n }\n observer.complete();\n }, err => {\n observer.error(err);\n });\n });\n }\n\n /**\n * Exports HTML table to CSV format\n * \n * @private\n * @description\n * Extracts data from HTML table elements (th, td) and converts to CSV format.\n * Each row becomes a CSV line with comma-separated values.\n * Values are quoted to handle special characters.\n * \n * @param {ExportAsConfig} config - Export configuration (requires table element)\n * @returns {Observable<string | null>} Observable with base64 CSV data or null if downloading\n * \n * @example\n * ```typescript\n * // HTML table structure required\n * <table id=\"myTable\">\n * <tr><th>Name</th><th>Age</th></tr>\n * <tr><td>John</td><td>30</td></tr>\n * </table>\n * ```\n * \n * @memberof ExportAsService\n */\n private getCSV(config: ExportAsConfig): Observable<string | null> {\n return new Observable((observer) => {\n const element: HTMLElement = document.getElementById(config.elementIdOrContent);\n const csv = [];\n const rows: any = element.querySelectorAll('table tr');\n for (let index = 0; index < rows.length; index++) {\n const rowElement = rows[index];\n const row = [];\n const cols = rowElement.querySelectorAll('td, th');\n for (let colIndex = 0; colIndex < cols.length; colIndex++) {\n const col = cols[colIndex];\n row.push('\"'+col.innerText+'\"');\n }\n csv.push(row.join(','));\n }\n const csvContent = 'data:text/csv;base64,' + this.btoa(csv.join('\\n'));\n if (config.download) {\n this.downloadFromDataURL(config.fileName, csvContent);\n observer.next(null);\n } else {\n observer.next(csvContent);\n }\n observer.complete();\n });\n }\n\n /**\n * Exports HTML table to plain text format\n * \n * @private\n * @description\n * Reuses CSV export logic but saves as .txt file extension.\n * Outputs comma-separated values in plain text format.\n * \n * @param {ExportAsConfig} config - Export configuration (requires table element)\n * @returns {Observable<string | null>} Observable with base64 text data or null if downloading\n * \n * @memberof ExportAsService\n */\n private getTXT(config: ExportAsConfig): Observable<string | null> {\n const nameFrags = config.fileName.split('.');\n config.fileName = `${nameFrags[0]}.txt`;\n return this.getCSV(config);\n }\n\n /**\n * Exports HTML table to Microsoft Excel format (.xls)\n * \n * @private\n * @description\n * Uses SheetJS (xlsx library) to convert HTML table to Excel format.\n * Supports both legacy .xls and modern .xlsx formats.\n * The resulting file is compatible with Microsoft Excel and other spreadsheet applications.\n * \n * @param {ExportAsConfig} config - Export configuration with SheetJS options\n * @returns {Observable<string | null>} Observable with base64 Excel data or null if downloading\n * \n * @example\n * ```typescript\n * // Excel with custom options\n * config.options = {\n * bookType: 'xlsx',\n * sheet: 'Sheet1',\n * raw: false,\n * dateNF: 'yyyy-mm-dd'\n * };\n * ```\n * \n * @memberof ExportAsService\n */\n private getXLS(config: ExportAsConfig): Observable<string | null> {\n return new Observable((observer) => {\n\n const element: HTMLElement = document.getElementById(config.elementIdOrContent);\n const ws3 = XLSX.utils.table_to_sheet(element, config.options);\n const wb = XLSX.utils.book_new();\n XLSX.utils.book_append_sheet(wb, ws3, config.fileName);\n const out = XLSX.write(wb, { type: 'base64' });\n const xlsContent = 'data:application/vnd.openxmlformats-officedocument.spreadsheetml.sheet;base64,' + out;\n if (config.download) {\n this.downloadFromDataURL(config.fileName, xlsContent);\n observer.next(null);\n } else {\n observer.next(xlsContent);\n }\n observer.complete();\n });\n }\n\n /**\n * Exports HTML table to Microsoft Excel format (.xlsx)\n * \n * @private\n * @description\n * Alias for getXLS method. Both .xls and .xlsx use the same underlying implementation\n * via SheetJS library.\n * \n * @param {ExportAsConfig} config - Export configuration with SheetJS options\n * @returns {Observable<string | null>} Observable with base64 Excel data or null if downloading\n * \n * @memberof ExportAsService\n */\n private getXLSX(config: ExportAsConfig): Observable<string | null> {\n return this.getXLS(config);\n }\n\n // private getDOCX(config: ExportAsConfig): Observable<string | null> {\n // return new Observable((observer) => {\n // const contentDocument: string = document.getElementById(config.elementIdOrContent).outerHTML;\n // const content = '<!DOCTYPE html>' + contentDocument;\n // HTMLtoDOCX(content, null, config.options).then(converted => {\n // if (config.download) {\n // this.downloadFromBlob(converted, config.fileName);\n // observer.next();\n // observer.complete();\n // } else {\n // const reader = new FileReader();\n // reader.onloadend = () => {\n // const base64data = reader.result as string;\n // observer.next(base64data);\n // observer.complete();\n // };\n // reader.readAsDataURL(converted);\n // }\n // });\n // });\n // }\n\n // private getDOC(config: ExportAsConfig): Observable<string | null> {\n // return this.getDOCX(config);\n // }\n\n /**\n * Exports HTML table to JSON format\n * \n * @private\n * @description\n * Converts HTML table to JSON array of objects.\n * First row is treated as headers (keys), subsequent rows as data values.\n * Headers are normalized (lowercase, spaces removed).\n * \n * **Note:** Unlike other formats, this returns actual JSON objects, not base64.\n * \n * @param {ExportAsConfig} config - Export configuration (requires table element)\n * @returns {Observable<any[] | null>} Observable with JSON array or null if downloading\n * \n * @example\n * ```typescript\n * // HTML table:\n * // | Name | Age |\n * // | John | 30 |\n * // | Jane | 25 |\n * \n * // Result:\n * [\n * { \"name\": \"John\", \"age\": \"30\" },\n * { \"name\": \"Jane\", \"age\": \"25\" }\n * ]\n * ```\n * \n * @memberof ExportAsService\n */\n private getJSON(config: ExportAsConfig): Observable<any[] | null> {\n return new Observable((observer) => {\n const data = []; // first row needs to be headers\n const headers = [];\n const table = <HTMLTableElement>document.getElementById(config.elementIdOrContent);\n for (let index = 0; index < table.rows[0].cells.length; index++) {\n headers[index] = table.rows[0].cells[index].innerHTML.toLowerCase().replace(/ /gi, '');\n }\n // go through cells\n for (let i = 1; i < table.rows.length; i++) {\n const tableRow = table.rows[i]; const rowData = {};\n for (let j = 0; j < tableRow.cells.length; j++) {\n rowData[headers[j]] = tableRow.cells[j].innerHTML;\n }\n data.push(rowData);\n }\n const jsonString = JSON.stringify(data);\n const jsonBase64 = this.btoa(jsonString);\n const dataStr = 'data:text/json;base64,' + jsonBase64;\n if (config.download) {\n this.downloadFromDataURL(config.fileName, dataStr);\n observer.next(null);\n } else {\n observer.next(data);\n }\n observer.complete();\n });\n }\n\n /**\n * Exports HTML table to XML format\n * \n * @private\n * @description\n * Converts HTML table to XML structure.\n * First cell of each row becomes the class name attribute,\n * remaining cells become data elements.\n * \n * @param {ExportAsConfig} config - Export configuration (requires table element)\n * @returns {Observable<string | null>} Observable with base64 XML data or null if downloading\n * \n * @example\n * ```typescript\n * // HTML table:\n * // | Name | Age | City |\n * // | John | 30 | NYC |\n * // | Jane | 25 | Boston |\n * \n * // Result:\n * <?xml version=\"1.0\" encoding=\"UTF-8\"?>\n * <Root>\n * <Classes>\n * <Class name=\"John\">\n * <data>30</data>\n * <data>NYC</data>\n * </Class>\n * <Class name=\"Jane\">\n * <data>25</data>\n * <data>Boston</data>\n * </Class>\n * </Classes>\n * </Root>\n * ```\n * \n * @memberof ExportAsService\n */\n private getXML(config: ExportAsConfig): Observable<string | null> {\n return new Observable((observer) => {\n let xml = '<?xml version=\"1.0\" encoding=\"UTF-8\"?><Root><Classes>';\n const tritem = document.getElementById(config.elementIdOrContent).getElementsByTagName('tr');\n for (let i = 0; i < tritem.length; i++) {\n const celldata = tritem[i];\n if (celldata.cells.length > 0) {\n xml += '<Class name=\"' + celldata.cells[0].textContent + '\">\\n';\n for (let m = 1; m < celldata.cells.length; ++m) {\n xml += '\\t<data>' + celldata.cells[m].textContent + '</data>\\n';\n }\n xml += '</Class>\\n';\n }\n }\n xml += '</Classes></Root>';\n const base64 = 'data:text/xml;base64,' + this.btoa(xml);\n if (config.download) {\n this.downloadFromDataURL(config.fileName, base64);\n observer.next(null);\n } else {\n observer.next(base64);\n }\n observer.complete();\n });\n }\n\n /**\n * Encodes a string to base64 with UTF-8 support\n * \n * @private\n * @description\n * Wrapper around browser's btoa() with proper UTF-8 encoding.\n * Handles special characters and international text correctly.\n * Uses encodeURIComponent and unescape for proper character encoding.\n * \n * @param {string} content - The string content to encode\n * @returns {string} Base64 encoded string\n * \n * @memberof ExportAsService\n */\n private btoa(content: string) {\n return btoa(unescape(encodeURIComponent(content)));\n }\n\n}\n","/*\n * Public API Surface of ngx-export-as\n */\n\nexport * from './lib/export-as.service';\nexport * from './lib/export-as-config.model';\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './public_api';\n"],"names":[],"mappings":";;;;;;;;AAWA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA+CG;MAEU,eAAe,CAAA;AAE1B;;;;AAIG;AACH,IAAA,WAAA,CAC+B,UAAkB,EAAA;QAAlB,IAAA,CAAA,UAAU,GAAV,UAAU;AAEvC,QAAA,IAAI,iBAAiB,CAAC,IAAI,CAAC,UAAU,CAAC,EAAE;AACtC,YAAA,MAAM,CAAC,aAAa,CAAC,GAAG,WAAW;QACrC;IACD;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;AA0BG;AACH,IAAA,GAAG,CAAC,MAAsB,EAAA;;QAExB,MAAM,IAAI,GAAG,KAAK,GAAG,MAAM,CAAC,IAAI,CAAC,WAAW,EAAE;;AAE9C,QAAA,IAAI,IAAI,CAAC,IAAI,CAAC,EAAE;AAC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