UNPKG

capacitor-plugin-scanbot-sdk

Version:

Scanbot Document and Barcode Scanner SDK for Capacitor

1,304 lines (1,254 loc) 1.37 MB
var capacitorScanbotSDKCapacitor = (function (exports, core) { 'use strict'; /// Auto-generated with ScanbotSDKCodegenV3. Modifications will be overwritten. /// Generated from core/schemas/JSONSerializationTypes.yaml /** Configuration used to serialize an object to json. */ class ToJsonConfiguration { /** @param source {@displayType `DeepPartial<ToJsonConfiguration>`} */ constructor(source = {}) { /** Serialize images in the object to json. If false, then fields that contain images are not serialized. Default is true */ this.serializeImages = true; /** Image serialization mode. Default is REFERENCE */ this.imageSerializationMode = 'REFERENCE'; if (source.serializeImages !== undefined) { this.serializeImages = source.serializeImages; } if (source.imageSerializationMode !== undefined) { this.imageSerializationMode = source.imageSerializationMode; } } serialize(config = new ToJsonConfiguration()) { return { serializeImages: this.serializeImages, imageSerializationMode: this.imageSerializationMode, }; } } /** @hidden */ const ImageSerializationModeValues = ['REFERENCE', 'BUFFER']; /// Auto-generated with ScanbotSDKCodegenV3. Modifications will be overwritten. /// Generated from core/schemas/ParametricFilters.yaml /** @hidden */ const OutputModeValues = ['BINARY', 'ANTIALIASED']; /** @hidden */ const BinarizationFilterPresetValues = [ 'PRESET_1', 'PRESET_2', 'PRESET_3', 'PRESET_4', 'PRESET_5', ]; /** @internal */ exports.ParametricFilter = void 0; (function (ParametricFilter) { /** @internal */ function from(source) { const _type = source['_type']; switch (_type) { case 'LegacyFilter': return new LegacyFilter(source); case 'ScanbotBinarizationFilter': return new ScanbotBinarizationFilter(source); case 'CustomBinarizationFilter': return new CustomBinarizationFilter(source); case 'ColorDocumentFilter': return new ColorDocumentFilter(source); case 'BrightnessFilter': return new BrightnessFilter(source); case 'ContrastFilter': return new ContrastFilter(source); case 'GrayscaleFilter': return new GrayscaleFilter(source); case 'WhiteBlackPointFilter': return new WhiteBlackPointFilter(source); default: throw new Error(`Unknown child class name: ${_type}`); } } ParametricFilter.from = from; })(exports.ParametricFilter || (exports.ParametricFilter = {})); /** Deprecated. Returns the input image unchanged. */ class LegacyFilter { /** @param source {@displayType `DeepPartial<LegacyFilter>`} */ constructor(source = {}) { this._type = 'LegacyFilter'; /** Ignored. Default is 0 */ this.filterType = 0; if (source.filterType !== undefined) { this.filterType = source.filterType; } } serialize(config = new ToJsonConfiguration()) { return { _type: this._type, filterType: this.filterType, }; } } /** Automatic binarization filter. This filter is a good starting point for most use cases. */ class ScanbotBinarizationFilter { /** @param source {@displayType `DeepPartial<ScanbotBinarizationFilter>`} */ constructor(source = {}) { this._type = 'ScanbotBinarizationFilter'; /** Output mode of the filter. BINARY will return a black and white image, GRAYSCALE will return an antialiased grayscale image. Default is BINARY */ this.outputMode = 'BINARY'; if (source.outputMode !== undefined) { this.outputMode = source.outputMode; } } serialize(config = new ToJsonConfiguration()) { return { _type: this._type, outputMode: this.outputMode, }; } } /** Automatic binarization filter. This filter is a good starting point for most use cases. */ class CustomBinarizationFilter { /** @param source {@displayType `DeepPartial<CustomBinarizationFilter>`} */ constructor(source = {}) { this._type = 'CustomBinarizationFilter'; /** Output mode of the filter. BINARY will return a black and white image, GRAYSCALE will return an antialiased grayscale image. Default is BINARY */ this.outputMode = 'BINARY'; /** Value controlling the amount of noise removal. Value between 0 and 1. Too little noise removal may result in a very noisy image, worsening readability. Too much noise removal may result in the degradation of text, again, worsening readability. Default is 0.5 */ this.denoise = 0.5; /** Filter radius. The bigger the radius, the slower the filter and generally the less noise in the result. The radius is used for both shadows removal and the calculation of local statistics in the main body of the filter. Higher radius usually allows to cope better with regions of light text on dark background. All the values larger than 127 are clamped to 127. Default is 32 */ this.radius = 32; /** Preset of binarization filter parameters that are found to perform well on different types of documents. Default is PRESET_4 */ this.preset = 'PRESET_4'; if (source.outputMode !== undefined) { this.outputMode = source.outputMode; } if (source.denoise !== undefined) { this.denoise = source.denoise; } if (source.radius !== undefined) { this.radius = source.radius; } if (source.preset !== undefined) { this.preset = source.preset; } } serialize(config = new ToJsonConfiguration()) { return { _type: this._type, outputMode: this.outputMode, denoise: this.denoise, radius: this.radius, preset: this.preset, }; } } /** Color document filter. This filter is a good starting point for most use cases. */ class ColorDocumentFilter { /** @param source {@displayType `DeepPartial<ColorDocumentFilter>`} */ constructor(source = {}) { this._type = 'ColorDocumentFilter'; /** Strength of contrast enhancement. Typical values are between 0 and 1, although higher values are possible. Default is 0.5 */ this.contrastEnhancement = 0.5; /** Strength of color saturation enhancement. Typical values are between 0 and 1, although higher values are possible. Default is 0.5 */ this.colorEnhancement = 0.5; /** Paper whitening strength balances color enhancement and paper color improvement. Only relevant if colorEnhancement is above 0. Typical values are between 0 and 2. Default is 1 */ this.paperWhitening = 1.0; /** Paper whitening bias balances between whitening more of the paper of preserving more of the colors. Negative values will preserve more colors, positive values will whiten more of the paper. Only relevant if colorEnhancement is above 0. Typical values are between -25 and 25. Default is 0 */ this.paperWhiteningBias = 0; if (source.contrastEnhancement !== undefined) { this.contrastEnhancement = source.contrastEnhancement; } if (source.colorEnhancement !== undefined) { this.colorEnhancement = source.colorEnhancement; } if (source.paperWhitening !== undefined) { this.paperWhitening = source.paperWhitening; } if (source.paperWhiteningBias !== undefined) { this.paperWhiteningBias = source.paperWhiteningBias; } } serialize(config = new ToJsonConfiguration()) { return { _type: this._type, contrastEnhancement: this.contrastEnhancement, colorEnhancement: this.colorEnhancement, paperWhitening: this.paperWhitening, paperWhiteningBias: this.paperWhiteningBias, }; } } /** Brightness adjustment filter. */ class BrightnessFilter { /** @param source {@displayType `DeepPartial<BrightnessFilter>`} */ constructor(source = {}) { this._type = 'BrightnessFilter'; /** Brightness adjustment value in the range from -1 to 1. Negative values will make the image darker, positive values will make it brighter. Default is 0.0 */ this.brightness = 0.0; if (source.brightness !== undefined) { this.brightness = source.brightness; } } serialize(config = new ToJsonConfiguration()) { return { _type: this._type, brightness: this.brightness, }; } } /** Contrast adjustment filter. */ class ContrastFilter { /** @param source {@displayType `DeepPartial<ContrastFilter>`} */ constructor(source = {}) { this._type = 'ContrastFilter'; /** Contrast adjustment value in the range from -1 to 254 (inclusively). Negative values will decrease the contrast, positive values will increase it. Default is 0.0 */ this.contrast = 0.0; if (source.contrast !== undefined) { this.contrast = source.contrast; } } serialize(config = new ToJsonConfiguration()) { return { _type: this._type, contrast: this.contrast, }; } } /** Converts color images to grayscale and applies autocontrast. */ class GrayscaleFilter { /** @param source {@displayType `DeepPartial<GrayscaleFilter>`} */ constructor(source = {}) { this._type = 'GrayscaleFilter'; /** Ignore this fraction of pixels at the edge of the image when calculating statistics. Pixels at the edge of the image typically have poor statistics. Ignoring them and using only the inner pixels when calculating certain statistics can substantially improve the quality of the result. The value must be less than 0.5 but usually good values are between 0 and 0.15. Default is 0.06 */ this.borderWidthFraction = 0.06; /** Clip this fraction of the darkest pixels in operations such as autocontrast. Increasing the range of middle gray levels at the expense of the brightest and darkest levels may improve the overall contrast and quality of the result. Sum of blackOutliersFraction and whiteOutliersFraction must be less than 1 but usually good values for the parameters do not exceed 0.05;. Default is 0.0 */ this.blackOutliersFraction = 0.0; /** Clip this fraction of the brightest pixels in operations such as autocontrast. Increasing the range of middle gray levels at the expense of the brightest and darkest levels may improve the overall contrast and quality of the result. Sum of blackOutliersFraction and whiteOutliersFraction must be less than 1 but usually good values for the parameters do not exceed 0.05;. Default is 0.02 */ this.whiteOutliersFraction = 0.02; if (source.borderWidthFraction !== undefined) { this.borderWidthFraction = source.borderWidthFraction; } if (source.blackOutliersFraction !== undefined) { this.blackOutliersFraction = source.blackOutliersFraction; } if (source.whiteOutliersFraction !== undefined) { this.whiteOutliersFraction = source.whiteOutliersFraction; } } serialize(config = new ToJsonConfiguration()) { return { _type: this._type, borderWidthFraction: this.borderWidthFraction, blackOutliersFraction: this.blackOutliersFraction, whiteOutliersFraction: this.whiteOutliersFraction, }; } } /** Maps image value channel so that all the pixels darker than the black point are set to 0, all the pixels brighter than the white point are set to 255, and the pixels in between are linearly scaled. */ class WhiteBlackPointFilter { /** @param source {@displayType `DeepPartial<WhiteBlackPointFilter>`} */ constructor(source = {}) { this._type = 'WhiteBlackPointFilter'; /** Fraction of the value channel range that is set to 0. The value should be in the range from 0 to 1. Default is 0.0 */ this.blackPoint = 0.0; /** Fraction of the value channel range that is not set to 255. The value should be in the range from 0 to 1. Default is 1.0 */ this.whitePoint = 1.0; if (source.blackPoint !== undefined) { this.blackPoint = source.blackPoint; } if (source.whitePoint !== undefined) { this.whitePoint = source.whitePoint; } } serialize(config = new ToJsonConfiguration()) { return { _type: this._type, blackPoint: this.blackPoint, whitePoint: this.whitePoint, }; } } /** @hidden */ const PageBinarizationValues = [ 'DISABLED', 'ENABLED', 'ENABLED_IF_BINARIZATION_FILTER_SET', ]; /// Auto-generated with ScanbotSDKCodegenV3. Modifications will be overwritten. /// Generated from xplatforms/schemas/document_scanner/AddPageOptions.yaml /** Options for creating a document from images. */ class AddPageOptions { /** @param source {@displayType `DeepPartial<AddPageOptions>`} */ constructor(source = {}) { /** The list of filters applied to the page. If not specified, no filters are applied. */ this.filters = null; /** The index at which the new page will be inserted. If not provided, the page will be added at the end of the document. */ this.index = null; /** Recognizes documents on created page. Default is true */ this.documentDetection = true; if (source.filters !== undefined) { this.filters = source.filters != null ? source.filters.map((it) => { return exports.ParametricFilter.from(it); }) : null; } if (source.index !== undefined) { this.index = source.index != null ? source.index : null; } if (source.documentDetection !== undefined) { this.documentDetection = source.documentDetection; } } } /// Auto-generated with ScanbotSDKCodegenV3. Modifications will be overwritten. /// Generated from xplatforms/schemas/document_scanner/CreateDocumentOptions.yaml /** Options for creating a document from images. */ class CreateDocumentOptions { /** @param source {@displayType `DeepPartial<CreateDocumentOptions>`} */ constructor(source = {}) { /** The maximum size of the document image. 0 means no limit. Default is 0 */ this.documentImageSizeLimit = 0; /** The list of filters applied to the page. If not specified, no filters are applied. */ this.filters = null; /** Recognizes documents on created document. Default is true */ this.documentDetection = true; if (source.documentImageSizeLimit !== undefined) { this.documentImageSizeLimit = source.documentImageSizeLimit; } if (source.filters !== undefined) { this.filters = source.filters != null ? source.filters.map((it) => { return exports.ParametricFilter.from(it); }) : null; } if (source.documentDetection !== undefined) { this.documentDetection = source.documentDetection; } } } class SBError extends Error { constructor(message) { super(message); } } class InvalidLicenseError extends SBError { constructor(message) { super(message); this.type = 'InvalidLicense'; } } class NullPointerError extends SBError { constructor(message) { super(message); this.type = 'NullPointer'; } } class InvalidArgumentError extends SBError { constructor(message) { super(message); this.type = 'InvalidArgument'; } } class InvalidImageRefError extends SBError { constructor(message) { super(message); this.type = 'InvalidImageRef'; } } class ComponentUnavailableError extends SBError { constructor(message) { super(message); this.type = 'ComponentUnavailable'; } } class IllegalStateError extends SBError { constructor(message) { super(message); this.type = 'IllegalState'; } } class IOError extends SBError { constructor(message) { super(message); this.type = 'IOError'; } } class InvalidDataError extends SBError { constructor(message) { super(message); this.type = 'InvalidData'; } } class OutOfMemoryError extends SBError { constructor(message) { super(message); this.type = 'OutOfMemory'; } } class TimeoutError extends SBError { constructor(message) { super(message); this.type = 'Timeout'; } } class UnknownError extends SBError { constructor(message) { super(message); this.type = 'Unknown'; } } class ProcessError extends SBError { constructor(message, code) { super(message); this.type = 'ProcessError'; this.code = code; } } /** * @internal * @hidden */ function createSBError(err) { const code = Number(err.code); const message = err.message || err.errorMessage || 'An unknown error occurred'; switch (code) { case 1: return new UnknownError(message); case 2: return new InvalidLicenseError(message); case 3: return new NullPointerError(message); case 4: return new InvalidArgumentError(message); case 5: return new InvalidImageRefError(message); case 6: return new ComponentUnavailableError(message); case 7: return new IllegalStateError(message); case 8: return new IOError(message); case 9: return new InvalidDataError(message); case 11: return new OutOfMemoryError(message); case 12: return new TimeoutError(message); default: { if (code >= 100) { return new ProcessError(message, code); } return new UnknownError(message); } } } /// Auto-generated with ScanbotSDKCodegenV3. Modifications will be overwritten. /// Generated from xplatforms/schemas/document_scanner/ModifyPageOptions.yaml /** Options for modifying a page within a document. */ class ModifyPageOptions { /** @param source {@displayType `DeepPartial<ModifyPageOptions>`} */ constructor(source = {}) { /** The type of rotation to apply. Default is NONE */ this.rotation = 'NONE'; /** The polygon to which the page will be cropped. If not specified, no cropping is applied. */ this.polygon = null; /** The list of filters applied to the page. If not specified, no filters are applied. */ this.filters = null; if (source.rotation !== undefined) { this.rotation = source.rotation; } if (source.polygon !== undefined) { this.polygon = source.polygon != null ? source.polygon.map((it) => { return { x: it.x, y: it.y }; }) : null; } if (source.filters !== undefined) { this.filters = source.filters != null ? source.filters.map((it) => { return exports.ParametricFilter.from(it); }) : null; } } } /// Auto-generated with ScanbotSDKCodegenV3. Modifications will be overwritten. /// Generated from core/overridden_schemas/OCRTypes.yaml /** @internal */ exports.OcrElement = void 0; (function (OcrElement) { /** @internal */ function from(source) { const _type = source['_type']; switch (_type) { case 'Glyph': return new Glyph(source); case 'Word': return new Word(source); case 'Line': return new Line(source); case 'Block': return new Block(source); case 'Page': return new OcrPage(source); default: throw new Error(`Unknown child class name: ${_type}`); } } OcrElement.from = from; })(exports.OcrElement || (exports.OcrElement = {})); /** Represents a single glyph, i.e. a character. */ class Glyph { /** @param source {@displayType `DeepPartial<Glyph>`} */ constructor(source = {}) { this._type = 'Glyph'; if (source.text !== undefined) { this.text = source.text; } else { throw new Error('text must be present in constructor argument'); } if (source.confidence !== undefined) { this.confidence = source.confidence; } else { throw new Error('confidence must be present in constructor argument'); } if (source.roi !== undefined) { this.roi = source.roi.map((it) => { return { x: it.x, y: it.y }; }); } else { throw new Error('roi must be present in constructor argument'); } } serialize(config = new ToJsonConfiguration()) { return { _type: this._type, }; } } /** Represents a single word. A word is made up of glyphs. */ class Word { /** @param source {@displayType `DeepPartial<Word>`} */ constructor(source = {}) { this._type = 'Word'; if (source.text !== undefined) { this.text = source.text; } else { throw new Error('text must be present in constructor argument'); } if (source.confidence !== undefined) { this.confidence = source.confidence; } else { throw new Error('confidence must be present in constructor argument'); } if (source.roi !== undefined) { this.roi = source.roi.map((it) => { return { x: it.x, y: it.y }; }); } else { throw new Error('roi must be present in constructor argument'); } if (source.glyphs !== undefined) { this.glyphs = source.glyphs.map((it) => { return new Glyph(it); }); } else { throw new Error('glyphs must be present in constructor argument'); } } serialize(config = new ToJsonConfiguration()) { return { _type: this._type, glyphs: this.glyphs.map((it) => { return it.serialize(config); }), }; } } /** Represents a single line. A line is made up of words. */ class Line { /** @param source {@displayType `DeepPartial<Line>`} */ constructor(source = {}) { this._type = 'Line'; if (source.text !== undefined) { this.text = source.text; } else { throw new Error('text must be present in constructor argument'); } if (source.confidence !== undefined) { this.confidence = source.confidence; } else { throw new Error('confidence must be present in constructor argument'); } if (source.roi !== undefined) { this.roi = source.roi.map((it) => { return { x: it.x, y: it.y }; }); } else { throw new Error('roi must be present in constructor argument'); } if (source.words !== undefined) { this.words = source.words.map((it) => { return new Word(it); }); } else { throw new Error('words must be present in constructor argument'); } } serialize(config = new ToJsonConfiguration()) { return { _type: this._type, words: this.words.map((it) => { return it.serialize(config); }), }; } } /** Represents a single block, e.g. a paragraph. A block is made up of lines. */ class Block { /** @param source {@displayType `DeepPartial<Block>`} */ constructor(source = {}) { this._type = 'Block'; if (source.text !== undefined) { this.text = source.text; } else { throw new Error('text must be present in constructor argument'); } if (source.confidence !== undefined) { this.confidence = source.confidence; } else { throw new Error('confidence must be present in constructor argument'); } if (source.roi !== undefined) { this.roi = source.roi.map((it) => { return { x: it.x, y: it.y }; }); } else { throw new Error('roi must be present in constructor argument'); } if (source.lines !== undefined) { this.lines = source.lines.map((it) => { return new Line(it); }); } else { throw new Error('lines must be present in constructor argument'); } } serialize(config = new ToJsonConfiguration()) { return { _type: this._type, lines: this.lines.map((it) => { return it.serialize(config); }), }; } } /** Represents result of performing OCR on an image. A page is made up of blocks. */ class OcrPage { /** @param source {@displayType `DeepPartial<OcrPage>`} */ constructor(source = {}) { this._type = 'Page'; if (source.text !== undefined) { this.text = source.text; } else { throw new Error('text must be present in constructor argument'); } if (source.confidence !== undefined) { this.confidence = source.confidence; } else { throw new Error('confidence must be present in constructor argument'); } if (source.roi !== undefined) { this.roi = source.roi.map((it) => { return { x: it.x, y: it.y }; }); } else { throw new Error('roi must be present in constructor argument'); } if (source.blocks !== undefined) { this.blocks = source.blocks.map((it) => { return new Block(it); }); } else { throw new Error('blocks must be present in constructor argument'); } } serialize(config = new ToJsonConfiguration()) { return { _type: this._type, blocks: this.blocks.map((it) => { return it.serialize(config); }), }; } } /// Auto-generated with ScanbotSDKCodegenV3. Modifications will be overwritten. /// Generated from xplatforms/schemas/document_scanner/OCREngineResult.yaml /** OCR configurations result. */ class OcrConfigsResult { /** @param source {@displayType `DeepPartial<OcrConfigsResult>`} */ constructor(source = {}) { if (source.languageDataPath !== undefined) { this.languageDataPath = source.languageDataPath; } else { throw new Error('languageDataPath must be present in constructor argument'); } if (source.installedLanguages !== undefined) { this.installedLanguages = source.installedLanguages.map((it) => { return it; }); } else { throw new Error('installedLanguages must be present in constructor argument'); } } serialize(config = new ToJsonConfiguration()) { return { languageDataPath: this.languageDataPath, installedLanguages: this.installedLanguages.map((it) => { return it; }), }; } } /** The result of OCR recognition. */ class PerformOcrResult { /** @param source {@displayType `DeepPartial<PerformOcrResult>`} */ constructor(source = {}) { if (source.recognizedText !== undefined) { this.recognizedText = source.recognizedText; } else { throw new Error('recognizedText must be present in constructor argument'); } if (source.pages !== undefined) { this.pages = source.pages.map((it) => { return new OcrPage(it); }); } else { throw new Error('pages must be present in constructor argument'); } } serialize(config = new ToJsonConfiguration()) { return { recognizedText: this.recognizedText, pages: this.pages.map((it) => { return it.serialize(config); }), }; } } /// Auto-generated with ScanbotSDKCodegenV3. Modifications will be overwritten. /// Generated from xplatforms/schemas/document_scanner/PDFExtractorOptions.yaml /** Options for extracting images from a PDF document. */ class PdfExtractorOptions { /** @param source {@displayType `DeepPartial<PdfExtractorOptions>`} */ constructor(source = {}) { /** The quality that each extracted image should have. This tweaks the compression, affecting the final image file size. (100 - maximum quality, 0 - minimum quality). Default is 90 */ this.quality = 90; /** Scaling factor applied to the PDF media box frame while extracting. Default is 2 */ this.scaling = 2.0; if (source.quality !== undefined) { this.quality = source.quality; } if (source.scaling !== undefined) { this.scaling = source.scaling; } } } /// Auto-generated with ScanbotSDKCodegenV3. Modifications will be overwritten. /// Generated from xplatforms/schemas/document_scanner/SdkConfiguration.yaml /** Initialize configuration for the Scanbot SDK. */ class SdkConfiguration { /** @param source {@displayType `DeepPartial<SdkConfiguration>`} */ constructor(source = {}) { /** Optional boolean flag to enable logging. See the "Logging" section below. Default is false */ this.loggingEnabled = false; /** Optional boolean flag that enables Scanbot SDK Core native logging (default is false, Android only). Default is false */ this.enableNativeLogging = false; /** Optional directory as file URI to override the default storage base directory of the Scanbot SDK. Refer to the section "Storage" for more details. */ this.storageBaseDirectory = null; /** Optional image quality value. It defines the quality factor of JPEG images. The value must be between 1 and 100, where 100 means maximum quality and largest file size. The recommended default value is 80 which is a good compromise between image file size and document legibility. Default is 80 */ this.storageImageQuality = 80; /** Optional image format, either 'JPG' or 'PNG'. The recommended default value is 'JPG'. Please note that 'PNG' will result in larger image files! Also, the storageImageQuality value does not apply for 'PNG'. Default is JPG */ this.storageImageFormat = 'JPG'; /** Optional file encryption mode, 'AES128' or 'AES256'. */ this.fileEncryptionMode = null; /** Optional file encryption password. Refer to the section "Storage Encryption" for more details. */ this.fileEncryptionPassword = null; /** If set to `true`, PerformanceHintApi is enabled, which lead to increase of performance due of increased use of top CPU cores (Android only), also increase battery usage. Default is true */ this.performanceHintApi = true; /** If set to `true`, GPU Acceleration will be enabled for Barcode Scanner, Document Scanner and Generic Document Recognizer (Android only). Default is true */ this.allowGpuAcceleration = true; /** Enables/disables XNNPACK acceleration for TensorFlow ML models, which provides highly optimized implementations of floating-point neural network operators (Android only). Default is true */ this.allowXnnpackAcceleration = true; if (source.licenseKey !== undefined) { this.licenseKey = source.licenseKey; } else { throw new Error('licenseKey must be present in constructor argument'); } if (source.loggingEnabled !== undefined) { this.loggingEnabled = source.loggingEnabled; } if (source.enableNativeLogging !== undefined) { this.enableNativeLogging = source.enableNativeLogging; } if (source.storageBaseDirectory !== undefined) { this.storageBaseDirectory = source.storageBaseDirectory != null ? source.storageBaseDirectory : null; } if (source.storageImageQuality !== undefined) { this.storageImageQuality = source.storageImageQuality; } if (source.storageImageFormat !== undefined) { this.storageImageFormat = source.storageImageFormat; } if (source.fileEncryptionMode !== undefined) { this.fileEncryptionMode = source.fileEncryptionMode != null ? FileEncryptionModeValues.includes(source.fileEncryptionMode) ? source.fileEncryptionMode : null : null; } if (source.fileEncryptionPassword !== undefined) { this.fileEncryptionPassword = source.fileEncryptionPassword != null ? source.fileEncryptionPassword : null; } if (source.performanceHintApi !== undefined) { this.performanceHintApi = source.performanceHintApi; } if (source.allowGpuAcceleration !== undefined) { this.allowGpuAcceleration = source.allowGpuAcceleration; } if (source.allowXnnpackAcceleration !== undefined) { this.allowXnnpackAcceleration = source.allowXnnpackAcceleration; } } } /** @hidden */ const StorageImageFormatValues = ['JPG', 'PNG']; /** @hidden */ const FileEncryptionModeValues = ['AES128', 'AES256']; /// Auto-generated with ScanbotSDKCodegenV3. Modifications will be overwritten. /// Generated from native/schemas/analytics/Analytics.yaml /** The feature that is being tracked. */ class AnalyticsFeature { /** @param source {@displayType `DeepPartial<AnalyticsFeature>`} */ constructor(source = {}) { } serialize(config = new ToJsonConfiguration()) { return {}; } } (function (AnalyticsFeature) { /** The document scanner feature. Default is "rtuui_document_scanner" */ AnalyticsFeature.documentScanner = 'rtuui_document_scanner'; })(AnalyticsFeature || (AnalyticsFeature = {})); /** The category that is being tracked. */ class AnalyticsCategory { /** @param source {@displayType `DeepPartial<AnalyticsCategory>`} */ constructor(source = {}) { } serialize(config = new ToJsonConfiguration()) { return {}; } } (function (AnalyticsCategory) { /** The acknowledge category. Default is "acknowledge" */ AnalyticsCategory.acknowledge = 'acknowledge'; })(AnalyticsCategory || (AnalyticsCategory = {})); /** The event that is being tracked. */ class AnalyticsEvent { /** @param source {@displayType `DeepPartial<AnalyticsEvent>`} */ constructor(source = {}) { /** The value associated with the event. */ this.values = []; if (source.feature !== undefined) { this.feature = source.feature; } else { throw new Error('feature must be present in constructor argument'); } if (source.category !== undefined) { this.category = source.category; } else { throw new Error('category must be present in constructor argument'); } if (source.name !== undefined) { this.name = source.name; } else { throw new Error('name must be present in constructor argument'); } if (source.values !== undefined) { this.values = source.values.map((it) => { return it; }); } } serialize(config = new ToJsonConfiguration()) { return { feature: this.feature, category: this.category, name: this.name, values: this.values.map((it) => { return it; }), }; } } /** The name of the event. */ class AnalyticsEventName { /** @param source {@displayType `DeepPartial<AnalyticsEventName>`} */ constructor(source = {}) { } serialize(config = new ToJsonConfiguration()) { return {}; } } (function (AnalyticsEventName) { /** The image quality result event for imported page. Default is "imported_image_quality_result" */ AnalyticsEventName.importedImageQualityResult = 'imported_image_quality_result'; /** The image quality result event for scanned page. Default is "scanned_image_quality_result" */ AnalyticsEventName.scannedImageQualityResult = 'scanned_image_quality_result'; /** The proceed event. Default is "proceed_with_image" */ AnalyticsEventName.proceedImage = 'proceed_with_image'; /** The retake event. Default is "retake_image" */ AnalyticsEventName.retakeImage = 'retake_image'; })(AnalyticsEventName || (AnalyticsEventName = {})); /** A predefined analytics event. */ class AnalyticsEventFactory { /** @param source {@displayType `DeepPartial<AnalyticsEventFactory>`} */ constructor(source = {}) { } serialize(config = new ToJsonConfiguration()) { return {}; } } (function (AnalyticsEventFactory) { /** A predefined analytics event. */ AnalyticsEventFactory.scannedImageQualityResult = new AnalyticsEvent({ feature: 'rtuui_document_scanner', category: 'acknowledge', name: 'scanned_image_quality_result', }); /** A predefined analytics event. */ AnalyticsEventFactory.importedImageQualityResult = new AnalyticsEvent({ feature: 'rtuui_document_scanner', category: 'acknowledge', name: 'imported_image_quality_result', }); /** A predefined analytics event. */ AnalyticsEventFactory.proceedWithImage = new AnalyticsEvent({ feature: 'rtuui_document_scanner', category: 'acknowledge', name: 'proceed_with_image', }); /** A predefined analytics event. */ AnalyticsEventFactory.retakeImage = new AnalyticsEvent({ feature: 'rtuui_document_scanner', category: 'acknowledge', name: 'retake_image', }); })(AnalyticsEventFactory || (AnalyticsEventFactory = {})); /// Auto-generated with ScanbotSDKCodegenV3. Modifications will be overwritten. /// Generated from core/schemas/BarcodeConfigurationTypes.yaml /** @internal */ exports.BarcodeFormatConfigurationBase = void 0; (function (BarcodeFormatConfigurationBase) { /** @internal */ function from(source) { const _type = source['_type']; switch (_type) { case 'BarcodeFormatCodabarConfiguration': return new BarcodeFormatCodabarConfiguration(source); case 'BarcodeFormatCode11Configuration': return new BarcodeFormatCode11Configuration(source); case 'BarcodeFormatCode39Configuration': return new BarcodeFormatCode39Configuration(source); case 'BarcodeFormatCode93Configuration': return new BarcodeFormatCode93Configuration(source); case 'BarcodeFormatCode128Configuration': return new BarcodeFormatCode128Configuration(source); case 'BarcodeFormatCode2Of5Configuration': return new BarcodeFormatCode2Of5Configuration(source); case 'BarcodeFormatDataBarConfiguration': return new BarcodeFormatDataBarConfiguration(source); case 'BarcodeFormatDataBarExpandedConfiguration': return new BarcodeFormatDataBarExpandedConfiguration(source); case 'BarcodeFormatDataBarLimitedConfiguration': return new BarcodeFormatDataBarLimitedConfiguration(source); case 'BarcodeFormatITFConfiguration': return new BarcodeFormatItfConfiguration(source); case 'BarcodeFormatMSIPlesseyConfiguration': return new BarcodeFormatMsiPlesseyConfiguration(source); case 'BarcodeFormatUpcEanConfiguration': return new BarcodeFormatUpcEanConfiguration(source); case 'BarcodeFormatPharmaCodeConfiguration': return new BarcodeFormatPharmaCodeConfiguration(source); case 'BarcodeFormatAztecConfiguration': return new BarcodeFormatAztecConfiguration(source); case 'BarcodeFormatQRCodeConfiguration': return new BarcodeFormatQrCodeConfiguration(source); case 'BarcodeFormatPDF417Configuration': return new BarcodeFormatPdf417Configuration(source); case 'BarcodeFormatMicroPDF417Configuration': return new BarcodeFormatMicroPdf417Configuration(source); case 'BarcodeFormatDataMatrixConfiguration': return new BarcodeFormatDataMatrixConfiguration(source); case 'BarcodeFormatMaxiCodeConfiguration': return new BarcodeFormatMaxiCodeConfiguration(source); case 'BarcodeFormatAustraliaPostConfiguration': return new BarcodeFormatAustraliaPostConfiguration(source); case 'BarcodeFormatJapanPostConfiguration': return new BarcodeFormatJapanPostConfiguration(source); case 'BarcodeFormatRoyalMailConfiguration': return new BarcodeFormatRoyalMailConfiguration(source); case 'BarcodeFormatRoyalTNTPostConfiguration': return new BarcodeFormatRoyalTntPostConfiguration(source); case 'BarcodeFormatUSPSIntelligentMailConfiguration': return new BarcodeFormatUspsIntelligentMailConfiguration(source); case 'BarcodeFormatPharmaCodeTwoTrackConfiguration': return new BarcodeFormatPharmaCodeTwoTrackConfiguration(source); case 'BarcodeFormatGS1CompositeConfiguration': return new BarcodeFormatGs1CompositeConfiguration(source); case 'BarcodeFormatCommonOneDConfiguration': return new BarcodeFormatCommonOneDConfiguration(source); case 'BarcodeFormatCommonTwoDConfiguration': return new Barcode