Sync-in · Sovereign platform for file storage, sharing, synchronization, and collaboration.
TypeScript cloud-alternativecollaborationcollaborative-editingdropboxfile-serverfile-sharingfile-storagefile-syncfull-text-searchhomelabnextcloudon-premiseopen-sourceprivacy-firstprivate-cloudrealtimesecureself-hostedstorage-serverwebdav
feat(backend:files): add pdf ocr indexing
johavend37c531313d4
diff --git a/.gitignore b/.gitignoreindex 39fe4586..f058f190 100755--- a/.gitignore+++ b/.gitignore@@ -15,5 +15,5 @@ frontend/tmpfrontend/out-tscfrontend/bazel-out/frontend/src/assets/pdfjs/-circular-dependencies.png!+circular-dependencies.pngbackend/src/applications/files/assets/ocr-languages/*.traineddata\ No newline at end of filediff --git a/backend/package.json b/backend/package.jsonindex 9b4ed9f1..38d85d09 100755--- a/backend/package.json+++ b/backend/package.json@@ -80,6 +80,7 @@"sharp": "^0.34.4","socket.io": "^4.8.1","tar": "^7.5.10",+ "tesseract.js": "^7.0.0","text-to-svg": "^3.1.5","time2fa": "^1.4.2","unpdf": "^1.3.2",diff --git a/backend/src/applications/files/files.config.ts b/backend/src/applications/files/files.config.tsindex f6f7feae..bf2e99fc 100644--- a/backend/src/applications/files/files.config.ts+++ b/backend/src/applications/files/files.config.ts@@ -1,8 +1,33 @@import { Type } from 'class-transformer'-import { IsBoolean, IsInt, IsNotEmpty, IsNotEmptyObject, IsString, ValidateNested } from 'class-validator'+import { ArrayNotEmpty, IsArray, IsBoolean, IsInt, IsNotEmpty, IsNotEmptyObject, IsString, ValidateIf, ValidateNested } from 'class-validator'import { CollaboraOnlineConfig } from './modules/collabora-online/collabora-online.config'import { OnlyOfficeConfig } from './modules/only-office/only-office.config'+export class FilesContentIndexingOCRConfig {+ @IsBoolean()+ enabled: boolean = true++ @ValidateIf((o: FilesContentIndexingOCRConfig) => o.enabled)+ @ArrayNotEmpty()+ @IsArray()+ @IsString({ each: true })+ languages: string[] = ['eng']++ @IsBoolean()+ offline: boolean = false+}++export class FilesContentIndexingConfig {+ @IsBoolean()+ enabled: boolean = true++ @ValidateIf((o: FilesContentIndexingConfig) => o.enabled)+ @IsNotEmptyObject()+ @ValidateNested()+ @Type(() => FilesContentIndexingOCRConfig)+ ocr: FilesContentIndexingOCRConfig = new FilesContentIndexingOCRConfig()+}+export class FilesConfig {@IsNotEmpty()@IsString()@@ -23,8 +48,10 @@ export class FilesConfig {@IsInt()maxUploadSize: number = 5368709120 // 5 GB- @IsBoolean()- contentIndexing: boolean = true+ @IsNotEmptyObject()+ @ValidateNested()+ @Type(() => FilesContentIndexingConfig)+ contentIndexing: FilesContentIndexingConfig = new FilesContentIndexingConfig()@IsBoolean()showHiddenFiles: boolean = falsediff --git a/backend/src/applications/files/services/files-content-manager.service.ts b/backend/src/applications/files/services/files-content-manager.service.tsindex ba092a68..c0af33df 100644--- a/backend/src/applications/files/services/files-content-manager.service.ts+++ b/backend/src/applications/files/services/files-content-manager.service.ts@@ -7,6 +7,7 @@ import { FileIndexContext, FileParseContext } from '../interfaces/file-parse-indimport { FilesIndexer } from '../models/files-indexer'import { FileContent } from '../schemas/file-content.interface'import { docTextify } from '../utils/doc-textify/doc-textify'+import { PdfOCRWorkerManager } from '../utils/doc-textify/utils/pdf-ocr'import { getMimeType } from '../utils/files'import { FilesParser } from './files-parser.service'@@ -14,6 +15,7 @@ import { FilesParser } from './files-parser.service'export class FilesContentManager {private readonly maxDocumentSize = 150 * 1_000_000private readonly logger = new Logger(FilesContentManager.name)+ private pdfOcrWorkerManager: PdfOCRWorkerManager | null = nullconstructor(private readonly filesIndexer: FilesIndexer,@@ -21,28 +23,39 @@ export class FilesContentManager {) {}async parseAndIndexAllFiles(): Promise<void> {- const indexSuffixes: string[] = []- for await (const [id, type, paths] of this.filesParser.allPaths()) {- let indexSuffix: string- switch (type) {- case 'user':- indexSuffix = `${userIndexPrefix}${id}`- break- case 'space':- indexSuffix = `${spaceIndexPrefix}${id}`- break- case 'share':- indexSuffix = `${shareIndexPrefix}${id}`- }- try {- await this.indexFiles(indexSuffix, paths)- } catch (e) {- this.logger.error({ tag: this.parseAndIndexAllFiles.name, msg: `${e}` })+ this.pdfOcrWorkerManager = PdfOCRWorkerManager.getInstance(this.logger)+ try {+ await this.pdfOcrWorkerManager.start()+ } catch (e) {+ this.logger.warn({ tag: this.parseAndIndexAllFiles.name, msg: `unable to initialize OCR worker: ${e}` })+ }+ try {+ const indexSuffixes: string[] = []+ for await (const [id, type, paths] of this.filesParser.allPaths()) {+ let indexSuffix: string+ switch (type) {+ case 'user':+ indexSuffix = `${userIndexPrefix}${id}`+ break+ case 'space':+ indexSuffix = `${spaceIndexPrefix}${id}`+ break+ case 'share':+ indexSuffix = `${shareIndexPrefix}${id}`+ }+ try {+ await this.indexFiles(indexSuffix, paths)+ } catch (e) {+ this.logger.error({ tag: this.parseAndIndexAllFiles.name, msg: `${e}` })+ }+ indexSuffixes.push(indexSuffix)}- indexSuffixes.push(indexSuffix)+ // clean up old tables+ await this.filesIndexer.cleanIndexes(indexSuffixes)+ } finally {+ await this.pdfOcrWorkerManager?.stop()+ this.pdfOcrWorkerManager = null}- // clean up old tables- await this.filesIndexer.cleanIndexes(indexSuffixes)}private async indexFiles(indexSuffix: string, paths: FileParseContext[]): Promise<void> {@@ -117,7 +130,7 @@ export class FilesContentManager {yield* this.parseFiles(realPath, context)continue}- const fileContent = await this.analyzeFile(realPath, context)+ const fileContent = await this.analyzeFile(realPath, context, false)if (fileContent !== null) {yield fileContent}@@ -177,7 +190,11 @@ export class FilesContentManager {try {const content = await docTextify(rPath,- { newlineDelimiter: ' ', minCharsToExtract: 10 },+ {+ newlineDelimiter: ' ',+ minCharsToExtract: 10,+ ocrWorker: this.pdfOcrWorkerManager?.worker+ },{extension: extension,verified: truediff --git a/backend/src/applications/files/services/files-search-manager.service.ts b/backend/src/applications/files/services/files-search-manager.service.tsindex c4fd72b3..8a7e4865 100644--- a/backend/src/applications/files/services/files-search-manager.service.ts+++ b/backend/src/applications/files/services/files-search-manager.service.ts@@ -28,7 +28,7 @@ export class FilesSearchManager {async search(user: UserModel, search: SearchFilesDto): Promise<FileContent[]> {const [spaceIds, shareIds] = await Promise.all([this.spacesQueries.spaceIds(user.id), this.sharesQueries.shareIds(user.id, +user.isAdmin)])if (search.fullText) {- if (!configuration.applications.files.contentIndexing) {+ if (!configuration.applications.files.contentIndexing.enabled) {throw new HttpException('Full-text search is disabled', HttpStatus.BAD_REQUEST)}return await this.searchFullText(user.id, spaceIds, shareIds, search.content, search.limit)diff --git a/backend/src/applications/files/utils/doc-textify/adapters/pdf.ts b/backend/src/applications/files/utils/doc-textify/adapters/pdf.tsindex 16f39753..370231c2 100644--- a/backend/src/applications/files/utils/doc-textify/adapters/pdf.ts+++ b/backend/src/applications/files/utils/doc-textify/adapters/pdf.ts@@ -1,63 +1,176 @@import { readFile } from 'node:fs/promises'-import { getDocumentProxy } from 'unpdf'+import sharp from 'sharp'+import { extractImages, getDocumentProxy } from 'unpdf'import type { PDFDocumentProxy } from 'unpdf/pdfjs'-import type { DocTextifyOptions } from '../interfaces/doc-textify.interfaces'+import type { DocTextifyOCRWorkerLike, DocTextifyOptions } from '../interfaces/doc-textify.interfaces'++const ignorePdfBadFormat = new Set([0x0000, 0x0001])-// Type guard to filter true text itemsinterface TextItem {str: stringtransform: [number, number, number, number, number, number]}-function isTextItem(item: any): item is TextItem {- return typeof item.str === 'string' && Array.isArray(item.transform)++type ExtractedImages = Awaited<ReturnType<typeof extractImages>>++function isTextItem(item: unknown): item is TextItem {+ return (+ typeof item === 'object' &&+ item !== null &&+ 'str' in item &&+ 'transform' in item &&+ typeof (item as TextItem).str === 'string' &&+ Array.isArray((item as TextItem).transform)+ )}-const ignorePdfBadFormat = new Set([0x0000, 0x0001])+function shouldOcrImage(image: { width: number; height: number; channels: number }): boolean {+ const { width, height } = image++ // too small for OCR+ if (width < 32 || height < 32) return false++ // not enough pixels+ if (width * height < 4000) return false++ const minSide = Math.min(width, height)+ const maxSide = Math.max(width, height)+ const ratio = maxSide / minSide++ // too thin overall+ if (minSide < 12) return false++ // reject extreme shapes+ return ratio <= 8+}++function extractText(items: unknown[], newlineDelimiter: string): string {+ const fragments: string[] = []+ let lastY: number | undefined = undefined++ for (const item of items) {+ if (!isTextItem(item)) continue+ const currentY = item.transform[5]+ if (lastY !== undefined && currentY !== lastY) {+ fragments.push(newlineDelimiter)+ }+ fragments.push(item.str)+ lastY = currentY+ }++ return fragments.join('')+}++async function extractTextFromImages(images: ExtractedImages, options: DocTextifyOptions): Promise<string[]> {+ const contents: string[] = []+ const worker: DocTextifyOCRWorkerLike | undefined = options.ocrWorker++ if (!worker) return contents++ for (const image of images) {+ if (!shouldOcrImage(image)) {+ continue+ }++ let imageBuffer: Buffer | undefined++ try {+ let imageProcessor = sharp(image.data, {+ raw: {+ width: image.width,+ height: image.height,+ channels: image.channels+ }+ })++ if (image.channels === 4) {+ imageProcessor = imageProcessor.flatten({ background: '#ffffff' })+ }++ imageBuffer = await imageProcessor+ .resize({+ width: 1800,+ height: 1800,+ fit: 'inside',+ withoutEnlargement: true,+ fastShrinkOnLoad: true+ })+ .grayscale()+ .jpeg({ quality: 85 })+ // .png({ compressionLevel: 0, adaptiveFiltering: false })+ .toBuffer()+ const result = await worker.recognize(imageBuffer)+ const content = result.data?.text?.trim() || ''++ if (content.length > 0) {+ contents.push(content)+ }+ } catch {+ // ignore OCR errors for a single image+ } finally {+ imageBuffer = undefined+ }+ }++ return contents+}-/** Parse PDF files */export async function parsePdf(filePath: string, options: DocTextifyOptions): Promise<string> {let doc: PDFDocumentProxy | undefinedconst buffer = await readFile(filePath)+ const canUseOcr = !!options.ocrWorkertry {- // Load the document, allowing system fonts as fallbackdoc = await getDocumentProxy(new Uint8Array(buffer.buffer, buffer.byteOffset, buffer.byteLength), {disableFontFace: true,verbosity: 0})- const fragments: string[] = []- let lastY: number | undefined = undefined+ const contents: string[] = []for (let pageNum = 1; pageNum <= doc.numPages; pageNum++) {const page = await doc.getPage(pageNum)- const { items } = await page.getTextContent()-- for (const item of items) {- // Skip non-text items- if (!isTextItem(item)) continue- const currentY = item.transform[5]- if (lastY !== undefined && currentY !== lastY) {- fragments.push(options.newlineDelimiter)+ try {+ let pageText = ''+ try {+ const { items } = await page.getTextContent()+ pageText = extractText(items, options.newlineDelimiter).trim()+ } catch {+ // ignore text extraction error and fallback to image OCR when possible}-- fragments.push(item.str)- lastY = currentY+ const pageHasText = pageText.length > 1+ if (pageHasText) {+ contents.push(pageText)+ continue+ }+ if (!canUseOcr) {+ continue+ }+ let images: ExtractedImages = []+ try {+ images = await extractImages(doc, pageNum)+ } catch {+ // ignore image extraction error for this page+ }+ const pageHasImages = images.some(shouldOcrImage)+ if (!pageHasImages) {+ continue+ }+ const ocrContents = await extractTextFromImages(images, options)+ if (ocrContents.length > 0) {+ contents.push(...ocrContents)+ }+ } finally {+ page.cleanup()}- page.cleanup()}- const content = fragments.join('')- if (ignorePdfBadFormat.has(content.charCodeAt(0))) {+ const content = contents.join(options.newlineDelimiter)+ if (content.length > 0 && ignorePdfBadFormat.has(content.charCodeAt(0))) {return ''}return content- } catch (e) {- if (options.outputErrorToConsole) {- console.error('Error parsing PDF:', e)- }- throw e} finally {- doc?.destroy().catch((e: Error) => console.error(e))+ await doc?.destroy().catch(() => undefined)}}diff --git a/backend/src/applications/files/utils/doc-textify/doc-textify.ts b/backend/src/applications/files/utils/doc-textify/doc-textify.tsindex 473c7ae5..1699ecf6 100644--- a/backend/src/applications/files/utils/doc-textify/doc-textify.ts+++ b/backend/src/applications/files/utils/doc-textify/doc-textify.ts@@ -19,7 +19,6 @@ export async function docTextify(options = {newlineDelimiter: '\n',minCharsToExtract: 10,- outputErrorToConsole: false,...options}@@ -33,32 +32,25 @@ export async function docTextify(const ext = fileProperties?.extension || path.extname(filePath).slice(1).toLowerCase()- try {- switch (ext) {- case 'docx':- return cleanContent(await parseWord(filePath, options), options)- case 'pptx':- return cleanContent(await parsePowerPoint(filePath, options), options)- case 'xlsx':- return cleanContent(await parseExcel(filePath, options), options)- case 'odt':- case 'odp':- case 'ods':- return cleanContent(await parseOpenOffice(filePath, options), options)- case 'pdf':- return cleanContent(await parsePdf(filePath, options), options)- case 'txt':- return cleanContent(await parseText(filePath), options)- case 'html':- case 'htm':- return cleanContent(await parseHtml(filePath), options)- default:- throw new Error('currently only supports docx, pptx, xlsx, odt, odp, ods, pdf files')- }- } catch (e) {- if (options.outputErrorToConsole) {- console.error(e.message)- }- throw e+ switch (ext) {+ case 'docx':+ return cleanContent(await parseWord(filePath, options), options)+ case 'pptx':+ return cleanContent(await parsePowerPoint(filePath, options), options)+ case 'xlsx':+ return cleanContent(await parseExcel(filePath, options), options)+ case 'odt':+ case 'odp':+ case 'ods':+ return cleanContent(await parseOpenOffice(filePath, options), options)+ case 'pdf':+ return cleanContent(await parsePdf(filePath, options), options)+ case 'txt':+ return cleanContent(await parseText(filePath), options)+ case 'html':+ case 'htm':+ return cleanContent(await parseHtml(filePath), options)+ default:+ throw new Error('currently only supports docx, pptx, xlsx, odt, odp, ods, pdf files')}}diff --git a/backend/src/applications/files/utils/doc-textify/interfaces/doc-textify.interfaces.ts b/backend/src/applications/files/utils/doc-textify/interfaces/doc-textify.interfaces.tsindex 9a298f83..d5182424 100644--- a/backend/src/applications/files/utils/doc-textify/interfaces/doc-textify.interfaces.ts+++ b/backend/src/applications/files/utils/doc-textify/interfaces/doc-textify.interfaces.ts@@ -1,5 +1,9 @@+export interface DocTextifyOCRWorkerLike {+ recognize: (image: Buffer) => Promise<{ data?: { text?: string } }>+}+export interface DocTextifyOptions {- outputErrorToConsole?: booleannewlineDelimiter: stringminCharsToExtract: number+ ocrWorker?: DocTextifyOCRWorkerLike | null}diff --git a/backend/src/applications/files/utils/doc-textify/utils/pdf-ocr.ts b/backend/src/applications/files/utils/doc-textify/utils/pdf-ocr.tsnew file mode 100644index 00000000..5f088f1a--- /dev/null+++ b/backend/src/applications/files/utils/doc-textify/utils/pdf-ocr.ts@@ -0,0 +1,132 @@+import type { Logger } from '@nestjs/common'+import { mkdir } from 'node:fs/promises'+import path from 'node:path'+import Tesseract from 'tesseract.js'+import { configuration } from '../../../../../configuration/config.environment'++export type PdfOCRWorker = Awaited<ReturnType<typeof Tesseract.createWorker>>+type PdfOCRWorkerOptions = NonNullable<Parameters<typeof Tesseract.createWorker>[2]>++export class PdfOCRWorkerManager {+ private static instance: PdfOCRWorkerManager+ public worker: PdfOCRWorker | null+ private readonly ocrLanguagesPath = path.resolve(__dirname, '../../../assets/ocr-languages')+ private readonly ocrUserDefinedDpi = '300'+ private logger: Logger+ private workerInitializationPromise: Promise<PdfOCRWorker | null> | null++ private constructor(logger: Logger) {+ this.logger = logger+ this.worker = null+ this.workerInitializationPromise = null+ }++ static getInstance(logger: Logger): PdfOCRWorkerManager {+ if (!PdfOCRWorkerManager.instance) {+ PdfOCRWorkerManager.instance = new PdfOCRWorkerManager(logger)+ }+ return PdfOCRWorkerManager.instance+ }++ async start(): Promise<PdfOCRWorker | null> {+ if (this.worker) {+ return this.worker+ }+ if (this.workerInitializationPromise) {+ return this.workerInitializationPromise+ }+ this.logger.verbose({ tag: this.constructor.name, msg: 'Starting OCR' })+ this.workerInitializationPromise = this.createWorkerFromConfiguration()+ .then((worker) => {+ this.worker = worker+ return worker+ })+ .finally(() => {+ this.workerInitializationPromise = null+ })+ return this.workerInitializationPromise+ }++ async stop(): Promise<void> {+ this.logger.verbose({ tag: this.constructor.name, msg: 'Stopping OCR' })+ if (this.workerInitializationPromise) {+ await this.workerInitializationPromise.catch((e) =>+ this.logger.error({+ tag: this.constructor.name,+ msg: `Worker promise: ${e}`+ })+ )+ }+ const worker = this.worker+ this.worker = null+ if (!worker) {+ return+ }+ await worker.terminate().catch((e) =>+ this.logger.error({+ tag: this.constructor.name,+ msg: `Worker stop: ${e}`+ })+ )+ }++ private async createConfiguredWorker(languages: string[], options: PdfOCRWorkerOptions): Promise<PdfOCRWorker> {+ const worker = await Tesseract.createWorker(languages, Tesseract.OEM.LSTM_ONLY, {+ ...options,+ errorHandler: (err: unknown) =>+ this.logger.error({+ tag: this.constructor.name,+ msg: `Tesseract worker error: ${err}`+ }),+ logger: () => {+ // intentionally disabled+ }+ })+ await worker.setParameters({+ user_defined_dpi: this.ocrUserDefinedDpi+ })+ return worker+ }++ private async createWorkerFromConfiguration(): Promise<PdfOCRWorker | null> {+ const ocrOptions = configuration.applications.files.contentIndexing.ocr+ if (!ocrOptions.enabled) {+ return null+ }+ try {+ await mkdir(this.ocrLanguagesPath, { recursive: true })+ } catch (e) {+ this.logger.error({+ tag: this.constructor.name,+ msg: `unable to create languages directory: ${e}`+ })+ }+ if (ocrOptions.offline) {+ const offlineWorkerOptions = {+ langPath: this.ocrLanguagesPath,+ cacheMethod: 'none' as const+ }+ try {+ // First try for gzipped files: <lang>.traineddata.gz+ return await this.createConfiguredWorker(ocrOptions.languages, {+ ...offlineWorkerOptions,+ gzip: true+ })+ } catch (error) {+ this.logger.warn({+ tag: this.constructor.name,+ msg: `unable to load offline OCR languages as .traineddata, retrying with .traineddata.gz: ${error}`+ })+ // Fallback for non-gz files: <lang>.traineddata+ return this.createConfiguredWorker(ocrOptions.languages, {+ ...offlineWorkerOptions,+ gzip: false+ })+ }+ }+ return this.createConfiguredWorker(ocrOptions.languages, {+ cachePath: this.ocrLanguagesPath,+ cacheMethod: 'write' as const+ })+ }+}diff --git a/backend/src/configuration/config.environment.ts b/backend/src/configuration/config.environment.tsindex c85b6057..1fe8e776 100755--- a/backend/src/configuration/config.environment.ts+++ b/backend/src/configuration/config.environment.ts@@ -1,4 +1,5 @@import { join } from 'node:path'+import { FilesContentIndexingConfig } from '../applications/files/files.config'import { AuthTokenAccessConfig, AuthTokenRefreshConfig } from '../authentication/auth.config'import { ACCESS_KEY, CSRF_KEY, TWO_FA_VERIFY_EXPIRATION, WS_KEY } from '../authentication/constants/auth'import { TOKEN_TYPE } from '../authentication/interfaces/token.interface'@@ -41,6 +42,18 @@ function loadConfiguration(): GlobalConfig {config.applications.files.usersPath = join(config.applications.files.dataPath, 'users')config.applications.files.spacesPath = join(config.applications.files.dataPath, 'spaces')config.applications.files.tmpPath = join(config.applications.files.dataPath, 'tmp')+ // DEPRECATIONS+ // applications.files.contentIndexing → applications.files.contentIndexing.enabled+ if (typeof config.applications.files.contentIndexing === 'boolean') {+ const filesContentIndexingConfig = new FilesContentIndexingConfig()+ filesContentIndexingConfig.enabled = config.applications.files.contentIndexing+ config.applications.files.contentIndexing = filesContentIndexingConfig+ console.warn(+ '[DEPRECATED][CONFIGURATION] applications.files.contentIndexing is deprecated and will be removed in a future version. ' ++ 'Please use applications.files.contentIndexing.enabled instead.'+ )+ }+return transformAndValidate(GlobalConfig,config,diff --git a/environment/environment.dist.yaml b/environment/environment.dist.yamlindex ebdf81bd..78a4ad6b 100755--- a/environment/environment.dist.yaml+++ b/environment/environment.dist.yaml@@ -297,9 +297,23 @@ applications:dataPath: /home/sync-in# default: 5368709120 (5 GB)maxUploadSize: 5368709120- # Enable indexing of file contents for search (disabling this turns off full-text search)- # default: true- contentIndexing: true+ contentIndexing:+ # Enable indexing of file contents for search (disabling this turns off full-text search)+ # default: true+ enabled: true+ ocr:+ # Enable OCR on PDF+ # default: true+ enabled: true+ # OCR languages used by tesseract.js+ # Supports ISO 639-2/T three-letter codes: 'eng', 'spa', 'fra', 'deu', etc.+ # examples: `[eng,fra]`, `[fra]`+ # default: [eng]+ languages: [eng]+ # Offline mode: do not download OCR languages, only use local language files from the built-in OCR folder+ # To download languages, use this scheme: https://cdn.jsdelivr.net/npm/@tesseract.js-data/<lang>@1.0.0/4.0.0_best_int/<lang>.traineddata.gz+ # default: false+ offline: false# Show files starting with a dot in the file explorer# default: falseshowHiddenFiles: falsediff --git a/package-lock.json b/package-lock.jsonindex 705aa1a3..0e78db0b 100644--- a/package-lock.json+++ b/package-lock.json@@ -93,6 +93,7 @@"sharp": "^0.34.4","socket.io": "^4.8.1","tar": "^7.5.10",+ "tesseract.js": "^7.0.0","text-to-svg": "^3.1.5","time2fa": "^1.4.2","unpdf": "^1.3.2",@@ -13292,6 +13293,12 @@"readable-stream": "^3.4.0"}},+ "node_modules/bmp-js": {+ "version": "0.1.0",+ "resolved": "https://registry.npmjs.org/bmp-js/-/bmp-js-0.1.0.tgz",+ "integrity": "sha512-vHdS19CnY3hwiNdkaqk93DvjVLfbEcI8mys4UjuWrlX1haDmroo8o4xCzh4wD6DGV6HxRCyauwhHRqMTfERtjw==",+ "license": "MIT"+ },"node_modules/body-parser": {"version": "2.2.2","resolved": "https://registry.npmjs.org/body-parser/-/body-parser-2.2.2.tgz",@@ -18007,6 +18014,12 @@"url": "https://opencollective.com/express"}},+ "node_modules/idb-keyval": {+ "version": "6.2.2",+ "resolved": "https://registry.npmjs.org/idb-keyval/-/idb-keyval-6.2.2.tgz",+ "integrity": "sha512-yjD9nARJ/jb1g+CvD0tlhUHOrJ9Sy0P8T9MF3YaLlHnSRpwPfpTX0XIvpmw3gAJUmEu3FiICLBDPXVwyEvrleg==",+ "license": "Apache-2.0"+ },"node_modules/ieee754": {"version": "1.2.1","resolved": "https://registry.npmjs.org/ieee754/-/ieee754-1.2.1.tgz",@@ -18383,7 +18396,6 @@"version": "1.2.4","resolved": "https://registry.npmjs.org/is-url/-/is-url-1.2.4.tgz","integrity": "sha512-ITvGim8FhRiYe4IQ5uHSkj7pVaPDrCTkNd3yq3cV7iZAcJdHTUMPMEHcqSOy9xZ9qFenQCvi+2wjH9a1nXqHww==",- "dev": true,"license": "MIT"},"node_modules/is-url-superb": {@@ -22595,6 +22607,26 @@"lodash": "^4.17.21"}},+ "node_modules/node-fetch": {+ "version": "2.7.0",+ "resolved": "https://registry.npmjs.org/node-fetch/-/node-fetch-2.7.0.tgz",+ "integrity": "sha512-c4FRfUm/dbcWZ7U+1Wq0AwCyFL+3nt2bEw05wfxSz+DWpWsitgmSgYmy2dQdWyKC1694ELPqMs/YzUSNozLt8A==",+ "license": "MIT",+ "dependencies": {+ "whatwg-url": "^5.0.0"+ },+ "engines": {+ "node": "4.x || >=6.0.0"+ },+ "peerDependencies": {+ "encoding": "^0.1.0"+ },+ "peerDependenciesMeta": {+ "encoding": {+ "optional": true+ }+ }+ },"node_modules/node-gyp": {"version": "12.2.0","resolved": "https://registry.npmjs.org/node-gyp/-/node-gyp-12.2.0.tgz",@@ -23055,6 +23087,15 @@"url": "https://github.com/sponsors/sindresorhus"}},+ "node_modules/opencollective-postinstall": {+ "version": "2.0.3",+ "resolved": "https://registry.npmjs.org/opencollective-postinstall/-/opencollective-postinstall-2.0.3.tgz",+ "integrity": "sha512-8AV/sCtuzUeTo8gQK5qDZzARrulB3egtLzFgteqB2tcT4Mw7B8Kt7JcDHmltjz6FOAHsvTevk70gZEbhM4ZS9Q==",+ "license": "MIT",+ "bin": {+ "opencollective-postinstall": "index.js"+ }+ },"node_modules/openid-client": {"version": "6.8.2","resolved": "https://registry.npmjs.org/openid-client/-/openid-client-6.8.2.tgz",@@ -24556,6 +24597,12 @@"integrity": "sha512-urBwgfrvVP/eAyXx4hluJivBKzuEbSQs9rKWCrCkbSxNv8mxPcUZKeuoF3Uy4mJl3Lwprp6yy5/39VWigZ4K6Q==","license": "Apache-2.0"},+ "node_modules/regenerator-runtime": {+ "version": "0.13.11",+ "resolved": "https://registry.npmjs.org/regenerator-runtime/-/regenerator-runtime-0.13.11.tgz",+ "integrity": "sha512-kY1AZVr2Ra+t+piVaJ4gxaFaReZVH40AKNo7UCX6W+dEwBo/2oZJzqfuN1qLq1oL45o56cPaTXELwrTh8Fpggg==",+ "license": "MIT"+ },"node_modules/require-directory": {"version": "2.1.1","resolved": "https://registry.npmjs.org/require-directory/-/require-directory-2.1.1.tgz",@@ -26299,6 +26346,30 @@"dev": true,"license": "MIT"},+ "node_modules/tesseract.js": {+ "version": "7.0.0",+ "resolved": "https://registry.npmjs.org/tesseract.js/-/tesseract.js-7.0.0.tgz",+ "integrity": "sha512-exPBkd+z+wM1BuMkx/Bjv43OeLBxhL5kKWsz/9JY+DXcXdiBjiAch0V49QR3oAJqCaL5qURE0vx9Eo+G5YE7mA==",+ "hasInstallScript": true,+ "license": "Apache-2.0",+ "dependencies": {+ "bmp-js": "^0.1.0",+ "idb-keyval": "^6.2.0",+ "is-url": "^1.2.4",+ "node-fetch": "^2.6.9",+ "opencollective-postinstall": "^2.0.3",+ "regenerator-runtime": "^0.13.3",+ "tesseract.js-core": "^7.0.0",+ "wasm-feature-detect": "^1.8.0",+ "zlibjs": "^0.3.1"+ }+ },+ "node_modules/tesseract.js-core": {+ "version": "7.0.0",+ "resolved": "https://registry.npmjs.org/tesseract.js-core/-/tesseract.js-core-7.0.0.tgz",+ "integrity": "sha512-WnNH518NzmbSq9zgTPeoF8c+xmilS8rFIl1YKbk/ptuuc7p6cLNELNuPAzcmsYw450ca6bLa8j3t0VAtq435Vw==",+ "license": "Apache-2.0"+ },"node_modules/test-exclude": {"version": "6.0.0","resolved": "https://registry.npmjs.org/test-exclude/-/test-exclude-6.0.0.tgz",@@ -26525,6 +26596,12 @@"url": "https://github.com/sponsors/Borewit"}},+ "node_modules/tr46": {+ "version": "0.0.3",+ "resolved": "https://registry.npmjs.org/tr46/-/tr46-0.0.3.tgz",+ "integrity": "sha512-N3WMsuqV66lT30CrXNbEjx4GEwlow3v6rr4mCcv6prnfwhS01rkgyFdjPNBYd9br7LpXV1+Emh01fHnq2Gdgrw==",+ "license": "MIT"+ },"node_modules/trim-newlines": {"version": "3.0.1","resolved": "https://registry.npmjs.org/trim-newlines/-/trim-newlines-3.0.1.tgz",@@ -27430,6 +27507,12 @@"makeerror": "1.0.12"}},+ "node_modules/wasm-feature-detect": {+ "version": "1.8.0",+ "resolved": "https://registry.npmjs.org/wasm-feature-detect/-/wasm-feature-detect-1.8.0.tgz",+ "integrity": "sha512-zksaLKM2fVlnB5jQQDqKXXwYHLQUVH9es+5TOOHwGOVJOCeRBCiPjwSg+3tN2AdTCzjgli4jijCH290kXb/zWQ==",+ "license": "Apache-2.0"+ },"node_modules/watchpack": {"version": "2.4.4","resolved": "https://registry.npmjs.org/watchpack/-/watchpack-2.4.4.tgz",@@ -27475,6 +27558,12 @@"license": "MIT","optional": true},+ "node_modules/webidl-conversions": {+ "version": "3.0.1",+ "resolved": "https://registry.npmjs.org/webidl-conversions/-/webidl-conversions-3.0.1.tgz",+ "integrity": "sha512-2JAn3z8AR6rjK8Sm8orRC0h/bcl/DqL7tRPdGZ4I1CjdF+EaMLmYxBHyXuKL849eucPFhvBoxMsflfOb8kxaeQ==",+ "license": "BSD-2-Clause"+ },"node_modules/webpack": {"version": "5.105.4","resolved": "https://registry.npmjs.org/webpack/-/webpack-5.105.4.tgz",@@ -27651,6 +27740,16 @@"node": ">=10.13.0"}},+ "node_modules/whatwg-url": {+ "version": "5.0.0",+ "resolved": "https://registry.npmjs.org/whatwg-url/-/whatwg-url-5.0.0.tgz",+ "integrity": "sha512-saE57nupxk6v3HY35+jzBwYa0rKSy0XR8JSxZPwgLr7ys0IBzhGviA1/TUGJLmSVqs8pb9AnvICXEuOHLprYTw==",+ "license": "MIT",+ "dependencies": {+ "tr46": "~0.0.3",+ "webidl-conversions": "^3.0.0"+ }+ },"node_modules/which": {"version": "2.0.2","resolved": "https://registry.npmjs.org/which/-/which-2.0.2.tgz",@@ -28032,6 +28131,15 @@"node": "^12.22.0 || ^14.17.0 || >=16.0.0"}},+ "node_modules/zlibjs": {+ "version": "0.3.1",+ "resolved": "https://registry.npmjs.org/zlibjs/-/zlibjs-0.3.1.tgz",+ "integrity": "sha512-+J9RrgTKOmlxFSDHo0pI1xM6BLVUv+o0ZT9ANtCxGkjIVCCUdx9alUF8Gm+dGLKbkkkidWIHFDZHDMpfITt4+w==",+ "license": "MIT",+ "engines": {+ "node": "*"+ }+ },"node_modules/zod": {"version": "4.1.13","resolved": "https://registry.npmjs.org/zod/-/zod-4.1.13.tgz",