UNPKG

@scandit/web-datacapture-barcode

Version:

Scandit Data Capture SDK for the Web

1 lines 2.07 kB
import{ArucoDictionary as e}from"./ArucoDictionary.js";import"./ArucoDictionaryPreset.js";import"./Barcode.js";import{defaultSymbologies as t}from"./defaults/DefaultsSymbologies.js";import{defaultBarcodeCapture as n}from"./defaults/DefaultsBarcodeCapture.js";import"./ScanIntention.js";import"./SelectionMode.js";import{PrivateNoneLocationSelection as r}from"@scandit/web-datacapture-core";var i=class{constructor(){this.codeDuplicateFilter=n.BarcodeCaptureSettings.codeDuplicateFilter,this.locationSelection=null,this.enabledCompositeTypes=[],this.scanIntention=`manual`,this.selectionMode=`off`,this.properties={},this.symbologies={},this._arucoDictionary=null}get enabledSymbologies(){return Object.keys(this.symbologies).filter(e=>{var t;return(t=this.symbologies[e])==null?void 0:t.isEnabled})}get compositeTypeDescriptions(){return t.CompositeTypeDescriptions.reduce((e,t)=>(e[t.types[0]]=t,e),{})}settingsForSymbology(e){if(!this.symbologies[e]){let n=t.SymbologySettings[e];n._symbology=e,this.symbologies[e]=n}return this.symbologies[e]}setProperty(e,t){this.properties[e]=t}getProperty(e){return this.properties[e]}enableSymbologies(e){for(let t of e)this.enableSymbology(t,!0)}enableSymbology(t,n){this.settingsForSymbology(t).isEnabled=n,t===`aruco`&&(this._arucoDictionary=e.fromPreset(`5X5_50`))}enableSymbologiesForCompositeTypes(e){for(let t of e)this.enableSymbologies(this.compositeTypeDescriptions[t].symbologies)}setArucoDictionary(e){this._arucoDictionary=e}toJSONObject(){var e,t;let n={};return{codeDuplicateFilter:this.codeDuplicateFilter,enabledCompositeTypes:[...this.enabledCompositeTypes],locationSelection:((e=this.locationSelection)==null?void 0:e.toJSONObject())??r,properties:{...this.properties},symbologies:Object.keys(this.symbologies).reduce((e,t)=>{var n;let r=(n=this.symbologies[t])==null?void 0:n.toJSONObject();return r&&(e[t]=r),e},n),scanIntention:this.scanIntention??null,selectionMode:this.selectionMode??null,arucoDictionary:((t=this._arucoDictionary)==null?void 0:t.toJSONObject())??null}}};export{i as BarcodeCaptureSettings};