@scandit/web-datacapture-barcode 8.2.0 → 8.3.0-beta.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (129) hide show
  1. package/build/js/{BarcodeBatch-BEVGY-bY.d.ts → BarcodeBatch-E9nmjbAE.d.ts} +2 -2
  2. package/build/js/BarcodeBatch.d.ts +1 -1
  3. package/build/js/BarcodeBatchAdvancedOverlay.d.ts +2 -2
  4. package/build/js/BarcodeBatchBasicOverlay.d.ts +1 -1
  5. package/build/js/BarcodeCapture.d.ts +1 -1
  6. package/build/js/BarcodeCaptureOverlay.d.ts +1 -1
  7. package/build/js/PrivateBarcodeBatchAdvancedOverlayListener.d.ts +1 -1
  8. package/build/js/PrivateBarcodeBatchBasicOverlayListener.d.ts +1 -1
  9. package/build/js/{SparkScanView-DUcwRAxm.d.ts → SparkScanView-Cwz62wQh.d.ts} +1 -1
  10. package/build/js/SymbologyDescription.d.ts +1 -1
  11. package/build/js/ar/BarcodeAr.js +1 -1
  12. package/build/js/ar/BarcodeArFeedback.js +1 -1
  13. package/build/js/ar/BarcodeArPresenter.js +1 -1
  14. package/build/js/ar/BarcodeArView.js +1 -1
  15. package/build/js/ar/ui/atoms/private/BarcodeArInfoAnnotationHeaderFooterUtils.d.ts +1 -1
  16. package/build/js/chunks/chunk-4IGF5Q5F.js +1 -0
  17. package/build/js/chunks/{chunk-HRYJX4QW.js → chunk-54FK6OJS.js} +1 -1
  18. package/build/js/chunks/{chunk-DSVREVQZ.js → chunk-BPJ5UL4U.js} +1 -1
  19. package/build/js/chunks/{chunk-3MEAY6PU.js → chunk-BUQOBHB5.js} +1 -1
  20. package/build/js/chunks/chunk-GUADOWCN.js +2 -0
  21. package/build/js/chunks/{chunk-OCYHIAM2.js → chunk-HK2533MO.js} +1 -1
  22. package/build/js/chunks/{chunk-RF4KC5J3.js → chunk-MTJ3TGSI.js} +1 -1
  23. package/build/js/chunks/{chunk-WMKH42FG.js → chunk-NPCLEL34.js} +1 -1
  24. package/build/js/chunks/{chunk-NU4EA3HH.js → chunk-QDIBZVNH.js} +1 -1
  25. package/build/js/chunks/{chunk-2PM6DH45.js → chunk-R3MQ2GAV.js} +1 -1
  26. package/build/js/chunks/{chunk-N4WXAKY6.js → chunk-SJMJPI54.js} +1 -1
  27. package/build/js/chunks/{chunk-NG3U2CXL.js → chunk-VQXEZP3B.js} +1 -1
  28. package/build/js/chunks/{chunk-Z2J2FVZ3.js → chunk-WJAB26TJ.js} +1 -1
  29. package/build/js/chunks/{chunk-LOUBDHG7.js → chunk-YK7BXRK5.js} +1 -1
  30. package/build/js/chunks/{chunk-A5R67FIL.js → chunk-ZQMDYAZS.js} +1 -1
  31. package/build/js/defaults/Defaults.js +1 -1
  32. package/build/js/find/BarcodeFind.js +1 -1
  33. package/build/js/find/BarcodeFindView.js +1 -1
  34. package/build/js/find/index.js +1 -1
  35. package/build/js/global.d.d.ts +2 -0
  36. package/build/js/index.d.ts +2 -2
  37. package/build/js/index.js +1 -1
  38. package/build/js/moduleLoader.js +1 -1
  39. package/build/js/private/SmartScanSelectionOverlay.d.ts +1 -1
  40. package/build/js/spark/SparkScanOverlay.d.ts +1 -1
  41. package/build/js/spark/SparkScanSettings.d.ts +5 -1
  42. package/build/js/spark/SparkScanSettings.js +1 -1
  43. package/build/js/spark/index.d.ts +1 -1
  44. package/build/js/spark/index.js +1 -1
  45. package/build/js/spark/ui/SparkScanView.d.ts +1 -1
  46. package/build/js/spark/ui/SparkScanView.js +1 -1
  47. package/build/js/spark/ui/SparkScanViewMiniPreview.js +1 -1
  48. package/build/js/spark/ui/SparkScanViewPresenter.d.ts +1 -1
  49. package/build/js/spark/ui/SparkScanViewPresenter.js +1 -1
  50. package/build/js/spark/ui/SparkScanViewTriggerButton.js +1 -1
  51. package/build/js/spark/ui/SparkScanViewUiListener.d.ts +1 -1
  52. package/build/js/spark/ui/index.d.ts +1 -1
  53. package/build/js/spark/ui/index.js +1 -1
  54. package/build/js/worker/BarcodeArMode.d.ts +1 -1
  55. package/build/js/worker/BarcodeBatchMode.d.ts +1 -1
  56. package/build/js/worker/BarcodeCaptureMode.d.ts +1 -1
  57. package/build/js/worker/BarcodeCaptureWorkerManager.d.ts +1 -1
  58. package/build/js/worker/BarcodeCaptureWorkerManager.js +1 -1
  59. package/build/js/worker/BarcodeFindMode.d.ts +1 -1
  60. package/build/js/worker/SparkScanMode.d.ts +1 -1
  61. package/build/js/worker/WorkerMain.d.ts +1 -1
  62. package/build/js/worker/WorkerMain.js +1 -1
  63. package/build/js/worker/barcodeCapture.inlineWorker.js +1 -1
  64. package/build/js/worker/dataCaptureEngine.d.ts +1 -1
  65. package/build/js/worker/dataCaptureEngine.js +1 -1
  66. package/build/js/worker/dataCaptureWorkerRelated.d.ts +1 -1
  67. package/build/js/worker/index.d.ts +1 -1
  68. package/package.json +7 -5
  69. package/sdc-lib/resources/models/aus_mdl_keypoint_detection.17f1b2958a9e.model +0 -0
  70. package/sdc-lib/resources/models/barcode_classification_default.48685f5fe19b.model +0 -0
  71. package/sdc-lib/resources/models/barcode_keypoints_oned.6697cfdb9ce4.model +0 -0
  72. package/sdc-lib/resources/models/barcode_label_localization_mslc_model_s.616a59ec3a8d.model +0 -0
  73. package/sdc-lib/resources/models/barcode_localization_default.59f74a846b63.model +0 -0
  74. package/sdc-lib/resources/models/barcode_localization_dpm_default.7e4fe5631f81.model +0 -0
  75. package/sdc-lib/resources/models/barcode_localization_generic_postal_code_default.184ecbeb5b83.model +0 -0
  76. package/sdc-lib/resources/models/barcode_localization_oned_default.c547484132c1.model +0 -0
  77. package/sdc-lib/resources/models/barcode_localization_twod_default.4b64523bf755.model +0 -0
  78. package/sdc-lib/resources/models/barcode_ocr_fallback_ocr_default.5bc76b6823da.model +0 -0
  79. package/sdc-lib/resources/models/barcode_ocr_fallback_ocr_detector_default.d955dfe2835e.model +0 -0
  80. package/sdc-lib/resources/models/barcode_semantics_ocr_detector_default.d955dfe2835e.model +0 -0
  81. package/sdc-lib/resources/models/eu_dl_localization.c26fc357c7bd.model +0 -0
  82. package/sdc-lib/resources/models/id_ocr.a4a57703430a.model +0 -0
  83. package/sdc-lib/resources/models/id_outline_localization_model_kpts.b7f16ab1f44c.model +0 -0
  84. package/sdc-lib/resources/models/invalidated_id_classification_default.1cd0f5859941.model +0 -0
  85. package/sdc-lib/resources/models/mrz_line_localization.577844e2ebed.model +0 -0
  86. package/sdc-lib/resources/models/mrz_localization.77e331c44b52.model +0 -0
  87. package/sdc-lib/resources/models/ocr_barcode_semantics_default.adb845cfe44c.model +0 -0
  88. package/sdc-lib/resources/models/ocr_mrz_default.08761e1a9c3b.model +0 -0
  89. package/sdc-lib/resources/models/ocr_price_label_default.4ad5b33a61d3.model +0 -0
  90. package/sdc-lib/resources/models/price_label_localization.a8a9771e8fcc.model +0 -0
  91. package/sdc-lib/resources/models/price_localization_in_whole_label.555b33695325.model +0 -0
  92. package/sdc-lib/resources/models/text_semantics_ocr_detector.fb3a9fc4fb56.model +0 -0
  93. package/sdc-lib/resources/models/uk_dl_code_localization.c26fc357c7bd.model +0 -0
  94. package/sdc-lib/resources/models/via_id_template_database.a1a557cc0045.model +1 -0
  95. package/sdc-lib/resources/models/via_orientation_classification.19281ecdf9b6.model +0 -0
  96. package/sdc-lib/scandit-datacapture-sdk-barcode-pthreads.js +1 -1
  97. package/sdc-lib/scandit-datacapture-sdk-barcode-pthreads.wasm +0 -0
  98. package/sdc-lib/scandit-datacapture-sdk-barcode-simd-pthreads.js +1 -1
  99. package/sdc-lib/scandit-datacapture-sdk-barcode-simd-pthreads.wasm +0 -0
  100. package/sdc-lib/scandit-datacapture-sdk-barcode-simd.js +1 -1
  101. package/sdc-lib/scandit-datacapture-sdk-barcode-simd.wasm +0 -0
  102. package/sdc-lib/scandit-datacapture-sdk-barcode.js +1 -1
  103. package/sdc-lib/scandit-datacapture-sdk-barcode.wasm +0 -0
  104. package/build/js/chunks/chunk-FT7V66CF.js +0 -1
  105. package/build/js/chunks/chunk-Z4OVKU6T.js +0 -2
  106. package/sdc-lib/resources/models/barcode_classification_default.fde280355f0b.model +0 -0
  107. package/sdc-lib/resources/models/barcode_keypoints_oned.ef764d7717ba.model +0 -0
  108. package/sdc-lib/resources/models/barcode_label_localization_mslc_model_s.77afd87bb1ae.model +0 -0
  109. package/sdc-lib/resources/models/barcode_localization_default.ea245fd6454e.model +0 -0
  110. package/sdc-lib/resources/models/barcode_localization_dpm_default.313e68d94ae1.model +0 -0
  111. package/sdc-lib/resources/models/barcode_localization_generic_postal_code_default.42a9746ffe91.model +0 -0
  112. package/sdc-lib/resources/models/barcode_localization_oned_default.33db0e688e2c.model +0 -0
  113. package/sdc-lib/resources/models/barcode_localization_twod_default.547ff0613d2c.model +0 -0
  114. package/sdc-lib/resources/models/barcode_ocr_fallback_ocr_default.8c2870b758fd.model +0 -0
  115. package/sdc-lib/resources/models/barcode_ocr_fallback_ocr_detector_default.9e7b3e9f0b6c.model +0 -0
  116. package/sdc-lib/resources/models/barcode_semantics_ocr_detector_default.9e7b3e9f0b6c.model +0 -0
  117. package/sdc-lib/resources/models/eu_dl_localization.d02cb8506d3f.model +0 -0
  118. package/sdc-lib/resources/models/id_ocr.1740d002ffbf.model +0 -0
  119. package/sdc-lib/resources/models/invalidated_id_classification_default.655732a12364.model +0 -0
  120. package/sdc-lib/resources/models/mrz_line_localization.4573c5a05b53.model +0 -0
  121. package/sdc-lib/resources/models/mrz_localization.c6b469e57923.model +0 -0
  122. package/sdc-lib/resources/models/ocr_barcode_semantics_default.b60d72805695.model +0 -0
  123. package/sdc-lib/resources/models/ocr_mrz_default.8b80192212c2.model +0 -0
  124. package/sdc-lib/resources/models/ocr_price_label_default.1d18eb896da3.model +0 -0
  125. package/sdc-lib/resources/models/price_label_localization.b1f6616d5e10.model +0 -0
  126. package/sdc-lib/resources/models/price_localization_in_whole_label.614fcbe425d2.model +0 -0
  127. package/sdc-lib/resources/models/text_semantics_ocr_detector.290bf42945e3.model +0 -0
  128. package/sdc-lib/resources/models/uk_dl_code_localization.d02cb8506d3f.model +0 -0
  129. /package/build/js/chunks/{chunk-VLGDYIWY.js → chunk-WIHMN2DS.js} +0 -0
@@ -1,4 +1,4 @@
1
- import { DataCaptureOverlay, BrushJSON, Optional, Brush, DataCaptureView, PrivateDataCaptureMode, DataCaptureMode, DataCaptureModeJSON, CameraSettings, DataCaptureContext } from '@scandit/web-datacapture-core';
1
+ import { DataCaptureOverlay, BrushJSON, Optional, Brush, DataCaptureView, DataCaptureMode, DataCaptureModeJSON, CameraSettings, DataCaptureContext, PrivateDataCaptureMode } from '@scandit/web-datacapture-core';
2
2
  import { Serializable } from '@scandit/web-datacapture-core/build/js/private/Serializable';
3
3
  import { BarcodeBatchSession } from './BarcodeBatchSession.js';
4
4
  import { BarcodeBatchSettingsJSON, BarcodeBatchSettings } from './BarcodeBatchSettings.js';
@@ -87,4 +87,4 @@ declare class BarcodeBatch implements DataCaptureMode, Serializable<BarcodeBatch
87
87
  private notifyContext;
88
88
  }
89
89
 
90
- export { type BarcodeBatchListener as B, type PrivateBarcodeBatch as P, BarcodeBatch as a, type BarcodeBatchBasicOverlayListener as b, BarcodeBatchBasicOverlayStyle as c, type BarcodeBatchBasicOverlayJSON as d, BarcodeBatchBasicOverlay as e, type PrivateBarcodeBatchListener as f, PrivateBarcodeBatchBasicOverlayListener as g };
90
+ export { BarcodeBatch as B, type PrivateBarcodeBatch as P, BarcodeBatchBasicOverlay as a, type BarcodeBatchBasicOverlayJSON as b, type BarcodeBatchBasicOverlayListener as c, BarcodeBatchBasicOverlayStyle as d, type BarcodeBatchListener as e, PrivateBarcodeBatchBasicOverlayListener as f, type PrivateBarcodeBatchListener as g };
@@ -2,7 +2,7 @@ import '@scandit/web-datacapture-core';
2
2
  import '@scandit/web-datacapture-core/build/js/private/Serializable';
3
3
  import './BarcodeBatchSession.js';
4
4
  import './BarcodeBatchSettings.js';
5
- export { a as BarcodeBatch, B as BarcodeBatchListener, P as PrivateBarcodeBatch } from './BarcodeBatch-BEVGY-bY.js';
5
+ export { B as BarcodeBatch, e as BarcodeBatchListener, P as PrivateBarcodeBatch } from './BarcodeBatch-E9nmjbAE.js';
6
6
  import './TrackedBarcode.js';
7
7
  import './Barcode.js';
8
8
  import './EncodingRange.js';
@@ -1,6 +1,6 @@
1
- import { DataCaptureOverlay, DataCaptureView, Anchor, PointWithUnit } from '@scandit/web-datacapture-core';
1
+ import { DataCaptureOverlay, Anchor, PointWithUnit, DataCaptureView } from '@scandit/web-datacapture-core';
2
2
  import { Serializable } from '@scandit/web-datacapture-core/build/js/private/Serializable';
3
- import { a as BarcodeBatch } from './BarcodeBatch-BEVGY-bY.js';
3
+ import { B as BarcodeBatch } from './BarcodeBatch-E9nmjbAE.js';
4
4
  import { TrackedBarcode } from './TrackedBarcode.js';
5
5
  import { TrackedBarcodeView } from './TrackedBarcodeView.js';
6
6
  import './BarcodeBatchSession.js';
@@ -1,6 +1,6 @@
1
1
  import '@scandit/web-datacapture-core';
2
2
  import '@scandit/web-datacapture-core/build/js/private/Serializable';
3
- export { e as BarcodeBatchBasicOverlay, d as BarcodeBatchBasicOverlayJSON, b as BarcodeBatchBasicOverlayListener, c as BarcodeBatchBasicOverlayStyle } from './BarcodeBatch-BEVGY-bY.js';
3
+ export { a as BarcodeBatchBasicOverlay, b as BarcodeBatchBasicOverlayJSON, c as BarcodeBatchBasicOverlayListener, d as BarcodeBatchBasicOverlayStyle } from './BarcodeBatch-E9nmjbAE.js';
4
4
  import './TrackedBarcode.js';
5
5
  import './BarcodeBatchSession.js';
6
6
  import './Barcode.js';
@@ -1,4 +1,4 @@
1
- import { PrivateDataCaptureMode, DataCaptureMode, DataCaptureModeJSON, CameraSettings, DataCaptureContext, FrameData } from '@scandit/web-datacapture-core';
1
+ import { DataCaptureMode, DataCaptureModeJSON, CameraSettings, DataCaptureContext, FrameData, PrivateDataCaptureMode } from '@scandit/web-datacapture-core';
2
2
  import { Serializable } from '@scandit/web-datacapture-core/build/js/private/Serializable';
3
3
  import { BarcodeCaptureFeedbackJSON, BarcodeCaptureFeedback } from './BarcodeCaptureFeedback.js';
4
4
  import { BarcodeCaptureSession } from './BarcodeCaptureSession.js';
@@ -1,4 +1,4 @@
1
- import { BrushJSON, ViewfinderJSON, DataCaptureOverlay, DataCaptureView, Brush, Viewfinder } from '@scandit/web-datacapture-core';
1
+ import { DataCaptureOverlay, BrushJSON, ViewfinderJSON, DataCaptureView, Brush, Viewfinder } from '@scandit/web-datacapture-core';
2
2
  import { Serializable } from '@scandit/web-datacapture-core/build/js/private/Serializable';
3
3
  import { BarcodeCapture } from './BarcodeCapture.js';
4
4
  import './BarcodeCaptureFeedback.js';
@@ -1,4 +1,4 @@
1
- import { B as BarcodeBatchListener, a as BarcodeBatch } from './BarcodeBatch-BEVGY-bY.js';
1
+ import { e as BarcodeBatchListener, B as BarcodeBatch } from './BarcodeBatch-E9nmjbAE.js';
2
2
  import { BarcodeBatchAdvancedOverlay } from './BarcodeBatchAdvancedOverlay.js';
3
3
  import { BarcodeBatchSession } from './BarcodeBatchSession.js';
4
4
  import '@scandit/web-datacapture-core';
@@ -1,4 +1,4 @@
1
- export { g as PrivateBarcodeBatchBasicOverlayListener, f as PrivateBarcodeBatchListener } from './BarcodeBatch-BEVGY-bY.js';
1
+ export { f as PrivateBarcodeBatchBasicOverlayListener, g as PrivateBarcodeBatchListener } from './BarcodeBatch-E9nmjbAE.js';
2
2
  import './BarcodeBatchSession.js';
3
3
  import './TrackedBarcode.js';
4
4
  import '@scandit/web-datacapture-core';
@@ -172,4 +172,4 @@ declare global {
172
172
  }
173
173
  }
174
174
 
175
- export { type SparkScanViewUiListener as S, SparkScanView as a };
175
+ export { SparkScanView as S, type SparkScanViewUiListener as a };
@@ -1,5 +1,5 @@
1
1
  import { Symbology } from './Barcode.js';
2
- import { RangeJSON, Range } from './Range.js';
2
+ import { Range, RangeJSON } from './Range.js';
3
3
  import '@scandit/web-datacapture-core';
4
4
  import '@scandit/web-datacapture-core/build/js/private/Serializable';
5
5
  import './EncodingRange.js';
@@ -1 +1 @@
1
- export{a as BarcodeAr}from'../chunks/chunk-RF4KC5J3.js';
1
+ export{a as BarcodeAr}from'../chunks/chunk-MTJ3TGSI.js';
@@ -1 +1 @@
1
- export{a as BarcodeArFeedback}from'../chunks/chunk-VLGDYIWY.js';
1
+ export{a as BarcodeArFeedback}from'../chunks/chunk-WIHMN2DS.js';
@@ -1 +1 @@
1
- export{a as BarcodeArPresenter}from'../chunks/chunk-NU4EA3HH.js';
1
+ export{a as BarcodeArPresenter}from'../chunks/chunk-QDIBZVNH.js';
@@ -1 +1 @@
1
- export{a as BarcodeArView}from'../chunks/chunk-DSVREVQZ.js';
1
+ export{a as BarcodeArView}from'../chunks/chunk-BPJ5UL4U.js';
@@ -1,4 +1,4 @@
1
- import { Optional, ScanditIcon, Color } from '@scandit/web-datacapture-core';
1
+ import { Color, Optional, ScanditIcon } from '@scandit/web-datacapture-core';
2
2
  import { ScanditHTMLElement } from '@scandit/web-datacapture-core/build/js/private/utils/index.js';
3
3
 
4
4
  declare const CONTAINER_SELECTOR = ".container";
@@ -0,0 +1 @@
1
+ import {a}from'./chunk-HDODW33D.js';import {a as a$1}from'./chunk-LLMMR2TB.js';import {RadiusLocationSelection,NumberWithUnit}from'@scandit/web-datacapture-core';var p=class{constructor(){this.codeDuplicateFilter=a.SparkScanSettings.codeDuplicateFilter;this.enabledCompositeTypes=[];this.scanIntention="manual";this.locationSelection=new RadiusLocationSelection(new NumberWithUnit(a.SparkScanSettings.locationSelection.radius,a.SparkScanSettings.locationSelection.unit));this.properties={};this.symbologies={};}get enabledSymbologies(){return Object.keys(this.symbologies).filter(e=>{var t;return (t=this.symbologies[e])==null?void 0:t.isEnabled})}get compositeTypeDescriptions(){return a$1.CompositeTypeDescriptions.reduce((o,e)=>(o[e.types[0]]=e,o),{})}settingsForSymbology(o){if(!this.symbologies[o]){let e=a$1.SymbologySettings[o];e._symbology=o,this.symbologies[o]=e;}return this.symbologies[o]}setProperty(o,e){this.properties[o]=e;}getProperty(o){return this.properties[o]}enableSymbologies(o){for(let e of o)this.enableSymbology(e,true);}enableSymbology(o,e){this.settingsForSymbology(o).isEnabled=e;}enableSymbologiesForCompositeTypes(o){for(let e of o)this.enableSymbologies(this.compositeTypeDescriptions[e].symbologies);}toJSONObject(){var t;let o={},e=Object.keys(this.symbologies);return {codeDuplicateFilter:this.codeDuplicateFilter,enabledCompositeTypes:[...this.enabledCompositeTypes],locationSelection:this.locationSelection.toJSONObject(),properties:{...this.properties},symbologies:e.reduce((n,r)=>{var c;let l=(c=this.symbologies[r])==null?void 0:c.toJSONObject();return l&&(n[r]=l),n},o),scanIntention:(t=this.scanIntention)!=null?t:null}}};export{p as a};
@@ -1 +1 @@
1
- import {a as a$3}from'./chunk-3OCPZ3OV.js';import {a as a$4}from'./chunk-L6BUOAGT.js';import {a as a$1}from'./chunk-QCD3RIT4.js';import {c as c$1,b as b$2}from'./chunk-SZUPDKV5.js';import {a as a$5}from'./chunk-74NQM2AV.js';import {b}from'./chunk-RU7XJPB3.js';import {a as a$2,c,b as b$1}from'./chunk-PMTVYYAY.js';import {a as a$6}from'./chunk-V2WRHFW3.js';import {a as a$7}from'./chunk-KGVFOBRT.js';import {a as a$8}from'./chunk-HDODW33D.js';import {a}from'./chunk-OCYHIAM2.js';import {Logger,DataCaptureView,Anchor,LogoStyle,isCameraFrameSource,Camera,FrameSourceState,Color,CameraPosition,TorchState,NumberWithUnit,RadiusLocationSelection}from'@scandit/web-datacapture-core';import {SafeStorage}from'@scandit/web-datacapture-core/build/js/private/utils/safeStorage.js';import {Timeout}from'@scandit/web-datacapture-core/build/js/private/utils/timeout.js';function v(U,e,t){let a=t.value;return typeof a!="function"?(Logger.warn(`@afterPrepareScanning applied to non-function: ${e}`),t):a.constructor.name==="AsyncFunction"||a.constructor===(async()=>{}).constructor?(t.value=function(...r){return this._preparationPromise?this._preparationPromise.then(()=>a.apply(this,r)):Promise.reject(new Error(`prepare should be called before calling ${e} method`))},t):(Logger.warn(`@afterPrepareScanning applied to non-async method: ${e}`),t)}var l=class l{constructor(e,t){this._context=null;this._sparkScan=null;this._preparationPromise=null;this._stopScanningPromise=null;this._dataCaptureView=null;this.preferenceManager=new a$1(SafeStorage.getInstanceFor("localStorage"));this.defaultSuccessBrush=a$2.defaultSuccessBrush();this.defaultErrorBrush=a$2.defaultErrorBrush();this.sparkScanView=e,this.setSparkScanViewSettings(t);}get camera(){var e;return (e=this.context)==null?void 0:e.frameSource}set context(e){this._context!==e&&(this._preparationPromise=null,this._context=e,e&&(this.analyticsManager=b.forContext(e)));}get context(){return this._context}set sparkScan(e){this._sparkScan!==e&&(this._preparationPromise=null,this._sparkScan=e);}get sparkScan(){return this._sparkScan}get sparkScan$(){if(!this._sparkScan)throw new Error("SparkScan mode is required to be set before calling this method");return this._sparkScan}get context$(){if(!this._context)throw new Error("Context is required to be set before calling this method");return this._context}setSparkScanViewSettings(e){this.sparkScanViewSettings=e,this.stateManager=new a$3(this.sparkScanViewSettings,this.preferenceManager),this.feedbackManager=a$4.withDefaults(this.sparkScanViewSettings.soundEnabled,this.sparkScanViewSettings.hapticEnabled),this.triggerButtonCollapseTimeout=new Timeout(this.sparkScanViewSettings.triggerButtonCollapseTimeout,async()=>{this.stateManager.state!=="idle"&&this._preparationPromise&&await this.switchToIdleState({sessionStopReason:"timeout"});}),this.inactiveStateTimeout=new Timeout(this.sparkScanViewSettings.inactiveStateTimeout,async()=>{this.stateManager.state!=="inactive"&&!this.stateManager.holdingToScan&&this._preparationPromise&&await this.switchToInactiveState({sessionStopReason:"timeout"});}),this.stateTimeouts={active:this.inactiveStateTimeout,inactive:this.triggerButtonCollapseTimeout};}get portraitOrientationTriggerButtonTranslateX(){var e;return (e=this.stateManager.portraitOrientationTriggerButtonTranslateX)!=null?e:this.defaultTriggerButtonTranslateX}get portraitOrientationTriggerButtonTranslateY(){var e;return (e=this.stateManager.portraitOrientationTriggerButtonTranslateY)!=null?e:this.defaultTriggerButtonTranslateY}get landscapeOrientationTriggerButtonTranslateX(){var e;return (e=this.stateManager.landscapeOrientationTriggerButtonTranslateX)!=null?e:this.defaultTriggerButtonTranslateX}get landscapeOrientationTriggerButtonTranslateY(){var e;return (e=this.stateManager.landscapeOrientationTriggerButtonTranslateY)!=null?e:this.defaultTriggerButtonTranslateY}get portraitOrientationMiniPreviewTranslateX(){var e;return (e=this.stateManager.portraitOrientationMiniPreviewTranslateX)!=null?e:this.defaultMiniPreviewTranslateX}get portraitOrientationMiniPreviewTranslateY(){var e;return (e=this.stateManager.portraitOrientationMiniPreviewTranslateY)!=null?e:this.defaultMiniPreviewTranslateY}get landscapeOrientationMiniPreviewTranslateX(){var e;return (e=this.stateManager.landscapeOrientationMiniPreviewTranslateX)!=null?e:this.defaultMiniPreviewTranslateX}get landscapeOrientationMiniPreviewTranslateY(){var e;return (e=this.stateManager.landscapeOrientationMiniPreviewTranslateY)!=null?e:this.defaultMiniPreviewTranslateY}get defaultTriggerButtonTranslateX(){return this.parentViewSizes.width-Math.min(this.parentViewSizes.width/3,110)-90/2}get defaultTriggerButtonTranslateY(){return this.parentViewSizes.height-Math.min(this.parentViewSizes.height/3,250)-90/2}get defaultMiniPreviewTranslateX(){return this.parentViewSizes.width-225-16}get parentViewSizes(){var e,t;return {width:(e=this.sparkScanView.parentElement.clientWidth)!=null?e:window.innerWidth,height:(t=this.sparkScanView.parentElement.clientHeight)!=null?t:window.innerHeight}}get defaultMiniPreviewTranslateY(){return 16}static forView(e,t){return new l(e,t)}async prepareScanning(e){if(this._preparationPromise)return this._preparationPromise;this._stopScanningPromise&&await this._stopScanningPromise,this._preparationPromise=this._internalPrepareScanning(e);try{await this._preparationPromise;}catch(t){throw this._preparationPromise=null,t}return this._preparationPromise}async _internalPrepareScanning(e){let t=this.context$,a=this.sparkScan$;this._dataCaptureView=await DataCaptureView.forContext(t),this._dataCaptureView.logoAnchor=Anchor.BottomCenter,this._dataCaptureView.logoStyle=LogoStyle.Minimal,this._dataCaptureView.setHiddenProperty("stopVideoTracksOnVisibilityChange",false),this._dataCaptureView.setHiddenProperty("freezeFrameWhenStoppingFrameSource",false),this._dataCaptureView.connectToElement(e);let i=isCameraFrameSource(t.frameSource)?t.frameSource:Camera.pickBestGuessForPosition(this.sparkScanViewSettings.defaultCameraPosition);await t.setFrameSource(i),await i.applySettings(a$5.recommendedCameraSettings),await i.switchToDesiredState(FrameSourceState.Standby);let r=await i.isTorchAvailable();this.sparkScanView.setTorchAvailable(r),this.sparkScanView.setZoomAvailable(i.isZoomAvailable()),this.sparkScanView.cameraSwitchButtonTapped(r,i.position),await t.setMode(a),a.addListener(this),a.setDelegate(this),this.sparkScanOverlay=await a$6.withSparkScanForView(a,this._dataCaptureView),await this.sparkScanOverlay.setShouldRemoveLocationsAfterScan(this.stateManager.scanningBehavior==="continuous"),this.smartScanSelectionOverlay=a$7.forMode(a),this.sparkScanViewSettings.smartSelectionCandidateBrush?this.smartScanSelectionOverlay.setBrush(this.sparkScanViewSettings.smartSelectionCandidateBrush):this.smartScanSelectionOverlay.setBrush(this.sparkScanOverlay.getBrush()),this.smartScanSelectionOverlay.setErrorBrush(this.sparkScanOverlay.getErrorBrush()),this.analyticsManager.startSession({cameraPosition:this.camera.position,hapticEnabled:this.sparkScanViewSettings.hapticEnabled,scanningMode:this.stateManager.scanningMode,soundEnabled:this.sparkScanViewSettings.soundEnabled,torchState:this.camera.getDesiredTorchState()}),await this.applyPreferences(),await this.switchToIdleState();}async stopScanning(e){if(this._stopScanningPromise)return this._stopScanningPromise;if(this.stateManager.state!=="Initial"){this._preparationPromise=null,this._stopScanningPromise=this._internalStopScanning(e);try{await this._stopScanningPromise;}finally{this._stopScanningPromise=null;}}}async _internalStopScanning(e){var i,r;this.stopTimeouts();let t=this.context$,a=this.sparkScan$;await a.setEnabled(false),a.removeListener(this),a.setDelegate(void 0),await t.removeMode(a),await((i=this.camera)==null?void 0:i.switchToDesiredState(FrameSourceState.Off)),(r=this._dataCaptureView)==null||r.detachFromElement(),this.analyticsManager.setSessionStopReason(e.sessionStopReason),this.setState("Initial");}async startScanning(){await this.switchToActiveState();}async pauseScanning(){await this.switchToInactiveState({sessionStopReason:"user"});}async onTriggerButtonPointerDown(){this.stateManager.triggerButtonPressed=true;}async onTriggerButtonTap(){switch(this.stateManager.state){case "Initial":{this.stateManager.triggerButtonPressed=false;return}case "idle":case "inactive":{await this.switchToActiveState({barcodeFeedback:new c(Color.fromRGBA(0,0,0,0),this.defaultSuccessBrush,this.feedbackManager.tapFeedback)});return}case "error":{await this.switchToActiveState({barcodeFeedback:new c(Color.fromRGBA(0,0,0,0),this.defaultSuccessBrush,this.feedbackManager.tapFeedback)});return}case "active":{if(this.stateManager.inSmartScanSelection){this.restartTimeouts(),await this.sparkScan$.selectItemWithSmartScanSelection();return}await(this.stateManager.continuousModeEnabled?this.switchToInactiveState({sessionStopReason:"user",barcodeFeedback:new c(Color.fromRGBA(0,0,0,0),this.defaultSuccessBrush,this.feedbackManager.noFeedback)}):this.switchToActiveState({barcodeFeedback:new c(Color.fromRGBA(0,0,0,0),this.defaultSuccessBrush,this.feedbackManager.tapFeedback)}));}}}async onTriggerButtonLongPressStart(){var e;this.stateManager.triggerButtonPressed=true,this.sparkScanViewSettings.holdToScanEnabled&&(this.scanningBehaviorCache=this.stateManager.scanningBehavior,this.stateManager.scanningBehavior="continuous",this.stateManager.holdingToScan=true,await((e=this.sparkScanOverlay)==null?void 0:e.setShouldRemoveLocationsAfterScan(true)),await this.switchToActiveState({barcodeFeedback:new c(Color.fromRGBA(0,0,0,0),this.defaultSuccessBrush,this.feedbackManager.tapFeedback)}));}async onTriggerButtonLongPressEnd(){var e,t;this.sparkScanViewSettings.holdToScanEnabled&&this.stateManager.state!=="error"?(this.stateManager.scanningBehavior=(e=this.scanningBehaviorCache)!=null?e:"single",this.stateManager.holdingToScan=false,await((t=this.sparkScanOverlay)==null?void 0:t.setShouldRemoveLocationsAfterScan(this.stateManager.continuousModeEnabled)),await this.switchToInactiveState({sessionStopReason:"user",barcodeFeedback:new b$1("",0,Color.fromRGBA(0,0,0,0),this.defaultErrorBrush,this.feedbackManager.noFeedback)})):this.stateManager.triggerButtonPressed=false;}async onClickOutside(){this.stateManager.idleState||await this.switchToIdleState({emitTapFeedback:true});}async onVisibilityChange(){await this.switchToIdleState();}async onTargetModeButtonTap(e,t=this.feedbackManager.tapFeedback,a=true){var o,s,c;t.emit();let i=String(e),r={true:e&&this.stateManager.scanningMode instanceof b$2,false:!e&&this.stateManager.scanningMode instanceof c$1}[i];r&&(this.stateManager.scanningMode=this.stateManager.scanningMode.changeMode()),this.enableTargetMode(e),await((o=this.sparkScanOverlay)==null?void 0:o.setShouldDrawViewfinder(e)),this.startTimeoutForCurrentState(),this.sparkScanView.targetModeButtonTapped(e,a),r&&((c=(s=this.listener)==null?void 0:s.didChangeScanningMode)==null||c.call(s,this.stateManager.scanningMode),this.analyticsManager.setScanningMode(this.stateManager.scanningMode)),this.updateSizeControlVisibility();}async onScanningBehaviorButtonTap(e,t=this.feedbackManager.tapFeedback,a=true){var i;t.emit(),this.stateManager.scanningMode=this.stateManager.scanningMode.copyWith(e?"continuous":"single"),await((i=this.sparkScanOverlay)==null?void 0:i.setShouldRemoveLocationsAfterScan(e)),this.startTimeoutForCurrentState(),this.sparkScanView.scanningBehaviorButtonTapped(e,a),this.analyticsManager.setScanningMode(this.stateManager.scanningMode);}async onBarcodeFindButtonTap(){var e,t;await this.switchToIdleState({sessionStopReason:"user",emitTapFeedback:true}),(t=(e=this.listener)==null?void 0:e.didTapBarcodeFindButton)==null||t.call(e,this.sparkScanView),this.restartTimeouts();}async onLabelCaptureButtonTap(){var e,t;await this.switchToIdleState({sessionStopReason:"user",emitTapFeedback:true}),(t=(e=this.listener)==null?void 0:e.didTapLabelCaptureButton)==null||t.call(e,this.sparkScanView),this.restartTimeouts();}async onCameraSwitchButtonTap(){var a,i;if(this.feedbackManager.emitTapFeedback(),this.restartTimeouts(),!this.camera||this.stateManager.state==="error")return;let e={[CameraPosition.WorldFacing]:CameraPosition.UserFacing,[CameraPosition.UserFacing]:CameraPosition.WorldFacing}[(a=this.camera)==null?void 0:a.position],t=Camera.pickBestGuessForPosition(e);t&&(await((i=this.camera)==null?void 0:i.switchToDesiredState(FrameSourceState.Off)),await this.context$.setFrameSource(t),await t.applySettings(this.camera.settings),await t.switchToDesiredState(FrameSourceState.On),this.sparkScanView.cameraSwitchButtonTapped(await t.isTorchAvailable(),e),this.analyticsManager.setCameraPosition(e));}async onTorchButtonTap(e,t=this.feedbackManager.tapFeedback,a=true){var i,r;t.emit(),this.stateManager.torchState=e?TorchState.On:TorchState.Off,((i=this.camera)==null?void 0:i.getCurrentState())===FrameSourceState.On&&await((r=this.camera)==null?void 0:r.setDesiredTorchState(this.stateManager.torchState)),this.startTimeoutForCurrentState(),this.sparkScanView.torchButtonTapped(e,a),this.analyticsManager.setTorchState(this.stateManager.torchState);}restartTimeouts(){for(let e of [this.triggerButtonCollapseTimeout,this.inactiveStateTimeout,this.resumeCapturingTimeout])(e==null?void 0:e.running)===true&&e.start();}stopTimeouts(){for(let e of [this.triggerButtonCollapseTimeout,this.inactiveStateTimeout,this.resumeCapturingTimeout])e==null||e.stop();}async onMiniPreviewCloseButtonTap(){await this.switchToIdleState({sessionStopReason:"user",emitTapFeedback:true});}onMiniPreviewResizeButtonTap(){(this.stateManager.state==="active"||this.stateManager.state==="inactive")&&(this.feedbackManager.emitTapFeedback(),this.startTimeoutForCurrentState());}async onMiniPreviewZoomButtonTap(e){this.feedbackManager.emitTapFeedback(),this.stateManager.zoomFactor=e,this.camera&&(this.camera.settings.zoomFactor=e,await this.camera.applySettings(this.camera.settings)),this.startTimeoutForCurrentState();}async onMiniPreviewDrag(e,t){switch(this.stateManager.state==="active"&&await this.sparkScan$.setEnabled(false),t){case "landscape-primary":case "landscape-secondary":{this.stateManager.landscapeOrientationMiniPreviewTranslateX=e.x,this.stateManager.landscapeOrientationMiniPreviewTranslateY=e.y;break}case "portrait-primary":case "portrait-secondary":{this.stateManager.portraitOrientationMiniPreviewTranslateX=e.x,this.stateManager.portraitOrientationMiniPreviewTranslateY=e.y;break}}this.restartTimeouts();}onMiniPreviewPointerMove(){this.restartTimeouts();}async onMiniPreviewPointerUp(){await this.switchToActiveState();}async onMiniPreviewDragEnd(){this.stateManager.state==="active"&&await this.sparkScan$.setEnabled(true);}async onMiniPreviewVisibilityChange(e){e&&this.sparkScanView.repositionMiniPreviewIfOutOfBounds(),this.stateManager.inSmartScanSelection&&!e&&await this.onSwitchedAwayFromSmartScanSelection();}onTriggerButtonDrag(e,t){switch(t){case "landscape-primary":case "landscape-secondary":{this.stateManager.landscapeOrientationTriggerButtonTranslateX=e.x,this.stateManager.landscapeOrientationTriggerButtonTranslateY=e.y;break}case "portrait-primary":case "portrait-secondary":{this.stateManager.portraitOrientationTriggerButtonTranslateX=e.x,this.stateManager.portraitOrientationTriggerButtonTranslateY=e.y;break}}}async onOrientationChange(){if(this.stateManager.state==="active"&&this.stateManager.holdingToScan){this.restartTimeouts();return}this.stateManager.state==="error"&&await this.switchToInactiveState({sessionStopReason:"user"});}async didScan(e,t){if(!t.newlyRecognizedBarcode)return;let a=this.sparkScanView.feedbackDelegate.getFeedbackForBarcode(t.newlyRecognizedBarcode);if(a){if(a instanceof b$1){await this.switchToErrorState({barcodeFeedback:a}),this.restartTimeouts();return}if(a instanceof c){if(this.stateManager.continuousModeEnabled){await this.switchToActiveState({barcodeFeedback:a}),this.restartTimeouts();return}let i=true,r="user";await this.switchToInactiveState({barcodeFeedback:a,emitSuccessFeedback:i,sessionStopReason:r}),this.restartTimeouts();}}}setListener(e){this.listener=e;}async onSwitchedToSmartScanSelection(){var e,t;this.sparkScanOverlay&&this.smartScanSelectionOverlay&&(this.stateManager.inSmartScanSelection=true,this.stateManager.miniPreviewSizeBeforeSmartScanSelection=this.sparkScanView.miniPreviewSize,this.stateManager.previewSizeControlVisibleBeforeSmartScanSelection=this.sparkScanView._previewSizeControlVisible,await((e=this._dataCaptureView)==null?void 0:e.removeOverlay(this.sparkScanOverlay)),await((t=this._dataCaptureView)==null?void 0:t.addOverlay(this.smartScanSelectionOverlay)),this.stateManager.targetModeEnabled||(this.sparkScanView.miniPreviewSize="expanded"),this.updateSizeControlVisibility());}async onSwitchedAwayFromSmartScanSelection(){var e,t;this.sparkScanOverlay&&this.smartScanSelectionOverlay&&this.stateManager.miniPreviewSizeBeforeSmartScanSelection&&(this.stateManager.inSmartScanSelection=false,await((e=this._dataCaptureView)==null?void 0:e.removeOverlay(this.smartScanSelectionOverlay)),await((t=this._dataCaptureView)==null?void 0:t.addOverlay(this.sparkScanOverlay)),this.sparkScanView.miniPreviewSize=this.stateManager.miniPreviewSizeBeforeSmartScanSelection,this.stateManager.miniPreviewSizeBeforeSmartScanSelection=void 0,this.updateSizeControlVisibility());}brushForFeedback(e){return e.brush}async switchToIdleState(e={}){var t,a,i,r,n;await this.sparkScan$.setEnabled(false),await((t=this.camera)==null?void 0:t.switchToDesiredState(FrameSourceState.Standby)),e.emitTapFeedback===true&&this.feedbackManager.emitTapFeedback(),await((a=this.sparkScanOverlay)==null?void 0:a.overlayReadyForDraw()),this.setState("idle"),(i=this.triggerButtonCollapseTimeout)==null||i.stop(),(r=this.inactiveStateTimeout)==null||r.stop(),(n=this.resumeCapturingTimeout)==null||n.stop(),this.stateManager.triggerButtonPressed=false,this.sparkScanView.switchToIdleState(),e.sessionStopReason!=null&&this.analyticsManager.setSessionStopReason(e.sessionStopReason);}async setBrushToOverlays(e){var t,a,i;this.sparkScanViewSettings.smartSelectionCandidateBrush?(t=this.smartScanSelectionOverlay)==null||t.setBrush(this.sparkScanViewSettings.smartSelectionCandidateBrush):(a=this.smartScanSelectionOverlay)==null||a.setBrush(e),await((i=this.sparkScanOverlay)==null?void 0:i.setBrush(e));}async switchToActiveState(e={}){var a,i,r,n,o,s,c$1,d;let t=this.stateManager.state;if(await((a=this.camera)==null?void 0:a.switchToDesiredState(FrameSourceState.On)),await((i=this.camera)==null?void 0:i.setDesiredTorchState(this.stateManager.torchState)),e.barcodeFeedback){let D=this.brushForFeedback(e.barcodeFeedback);await this.setBrushToOverlays(D);}await((r=this.sparkScanOverlay)==null?void 0:r.setShouldRemoveLocationsAfterScan(this.stateManager.continuousModeEnabled)),await((n=this.sparkScanOverlay)==null?void 0:n.overlayReadyForDraw()),this.feedbackManager.emitBarcodeFeedback(e.barcodeFeedback),this.stateManager.holdingToScan||(o=this.inactiveStateTimeout)==null||o.start(),(s=this.triggerButtonCollapseTimeout)==null||s.stop(),(c$1=this.resumeCapturingTimeout)==null||c$1.stop(),await this.sparkScanView.switchToActiveState(this.sparkScanViewSettings.visualFeedbackEnabled&&e.barcodeFeedback instanceof c,this.stateManager.scanningBehavior,(d=e.barcodeFeedback)==null?void 0:d.visualFeedbackColor,this.stateManager.zoomedIn&&t!=="active"),await this.sparkScan$.setEnabled(true),this.setState("active");}async switchToInactiveState(e){var t,a,r,n,o,s,c$1;if(this.stateManager.inSmartScanSelection?await this.sparkScan$.setEnabled(false):this.stateManager.shouldEnableSuppression?await this.sparkScan$.setResultSuppressionEnabled(true):await this.sparkScan$.setEnabled(false),this.stateManager.triggerButtonPressed=false,this.stateManager.scanningMode.previewBehavior==="persistent"?e.barcodeFeedback instanceof c&&await((t=this.sparkScanOverlay)==null?void 0:t.setShouldRemoveLocationsAfterScan(true)):await((a=this.camera)==null?void 0:a.switchToDesiredState(FrameSourceState.Standby)),(e.emitSuccessFeedback)!=null||(e.emitSuccessFeedback=true),this.setState("inactive"),e.barcodeFeedback){let d=this.brushForFeedback(e.barcodeFeedback);await this.setBrushToOverlays(d);}this.feedbackManager.emitBarcodeFeedback(e.barcodeFeedback),await((r=this.sparkScanOverlay)==null?void 0:r.overlayReadyForDraw()),(n=this.triggerButtonCollapseTimeout)==null||n.start(),(o=this.inactiveStateTimeout)==null||o.stop(),(s=this.resumeCapturingTimeout)==null||s.stop(),await this.sparkScanView.switchToInactiveState(this.sparkScanViewSettings.visualFeedbackEnabled&&e.barcodeFeedback instanceof c&&e.emitSuccessFeedback,this.stateManager.scanningBehavior,this.stateManager.previewBehavior,(c$1=e.barcodeFeedback)==null?void 0:c$1.visualFeedbackColor),this.analyticsManager.setSessionStopReason(e.sessionStopReason);}async switchToErrorState(e){var a,i,r,n,o,s,c;let t=e.barcodeFeedback.resumeCapturingDelay>0;t&&(await this.sparkScan$.setEnabled(false),await((a=this.camera)==null?void 0:a.switchToDesiredState(FrameSourceState.Standby)),this.setState("error"),this.stateManager.scanningBehavior="single",this.resumeCapturingTimeout=new Timeout(e.barcodeFeedback.resumeCapturingDelay,async()=>{this.stateManager.state!=="active"&&this._preparationPromise&&await this.switchToActiveState();}),this.resumeCapturingTimeout.start()),(i=this.smartScanSelectionOverlay)==null||i.setErrorBrush(e.barcodeFeedback.brush),await((r=this.sparkScanOverlay)==null?void 0:r.setErrorBrush(e.barcodeFeedback.brush)),await((n=this.sparkScanOverlay)==null?void 0:n.overlayReadyForDraw()),await((o=this.sparkScanOverlay)==null?void 0:o.setShouldRemoveLocationsAfterScan(e.barcodeFeedback.resumeCapturingDelay===0)),await this.sparkScan$.workerCommand("sparkScanEmitErrorFeedback",{shouldRemoveBrush:!t}),this.feedbackManager.emitBarcodeFeedback(e.barcodeFeedback),(s=this.triggerButtonCollapseTimeout)==null||s.stop(),(c=this.inactiveStateTimeout)==null||c.stop(),await this.sparkScanView.switchToErrorState(e.barcodeFeedback,this.sparkScanViewSettings.visualFeedbackEnabled);}enableTargetModeLocationSelection(e){var r;let t=e?a$8.SparkScanSettings.targetModeLocationSelection.radius:a$8.SparkScanSettings.locationSelection.radius,a=e?a$8.SparkScanSettings.targetModeLocationSelection.unit:a$8.SparkScanSettings.locationSelection.unit,i=new NumberWithUnit(t,a);this.sparkScan$.settings.locationSelection=new RadiusLocationSelection(i),(r=this.sparkScanOverlay)==null||r.setRadius(i);}enableTargetMode(e){this.enableTargetModeLocationSelection(e);}async applyPreferences(){await this.onTargetModeButtonTap(this.stateManager.targetModeEnabled,this.feedbackManager.noFeedback,false),await this.onScanningBehaviorButtonTap(this.stateManager.continuousModeEnabled,this.feedbackManager.noFeedback,false),await this.onTorchButtonTap(this.stateManager.torchEnabled,this.feedbackManager.noFeedback,false),this.sparkScanView.repositionElementsIfOutOfBounds();}setState(e){var t,a;e!==this.stateManager.state&&(this.stateManager.state=e,(a=(t=this.listener)==null?void 0:t.didChangeViewState)==null||a.call(t,e));}startTimeoutForCurrentState(){let e=this.stateTimeouts[this.stateManager.state];e==null||e.start();}updateSizeControlVisibility(){if(!this.stateManager.inSmartScanSelection&&this.stateManager.previewSizeControlVisibleBeforeSmartScanSelection!==void 0){this.sparkScanView.previewSizeControlVisible=this.stateManager.previewSizeControlVisibleBeforeSmartScanSelection,this.stateManager.previewSizeControlVisibleBeforeSmartScanSelection=void 0;return}let e=this.stateManager.inSmartScanSelection&&!this.stateManager.targetModeEnabled,t=this.sparkScanView._previewSizeControlVisible;this.sparkScanView.previewSizeControlVisible=t&&!e;}};a([v],l.prototype,"switchToActiveState",1),a([v],l.prototype,"switchToInactiveState",1),a([v],l.prototype,"switchToErrorState",1);var A=l;export{A as a};
1
+ import {a as a$3}from'./chunk-3OCPZ3OV.js';import {a as a$4}from'./chunk-L6BUOAGT.js';import {a as a$1}from'./chunk-QCD3RIT4.js';import {a as a$2,c,b as b$1}from'./chunk-PMTVYYAY.js';import {a as a$6}from'./chunk-V2WRHFW3.js';import {c as c$1,b as b$2}from'./chunk-SZUPDKV5.js';import {a as a$5}from'./chunk-74NQM2AV.js';import {b}from'./chunk-RU7XJPB3.js';import {a as a$7}from'./chunk-KGVFOBRT.js';import {a as a$8}from'./chunk-HDODW33D.js';import {a}from'./chunk-HK2533MO.js';import {Logger,DataCaptureView,Anchor,LogoStyle,isCameraFrameSource,Camera,FrameSourceState,Color,CameraPosition,TorchState,NumberWithUnit,RadiusLocationSelection}from'@scandit/web-datacapture-core';import {SafeStorage}from'@scandit/web-datacapture-core/build/js/private/utils/safeStorage.js';import {Timeout}from'@scandit/web-datacapture-core/build/js/private/utils/timeout.js';function v(U,e,t){let a=t.value;return typeof a!="function"?(Logger.warn(`@afterPrepareScanning applied to non-function: ${e}`),t):a.constructor.name==="AsyncFunction"||a.constructor===(async()=>{}).constructor?(t.value=function(...r){return this._preparationPromise?this._preparationPromise.then(()=>a.apply(this,r)):Promise.reject(new Error(`prepare should be called before calling ${e} method`))},t):(Logger.warn(`@afterPrepareScanning applied to non-async method: ${e}`),t)}var l=class l{constructor(e,t){this._context=null;this._sparkScan=null;this._preparationPromise=null;this._stopScanningPromise=null;this._dataCaptureView=null;this.preferenceManager=new a$1(SafeStorage.getInstanceFor("localStorage"));this.defaultSuccessBrush=a$2.defaultSuccessBrush();this.defaultErrorBrush=a$2.defaultErrorBrush();this.sparkScanView=e,this.setSparkScanViewSettings(t);}get camera(){var e;return (e=this.context)==null?void 0:e.frameSource}set context(e){this._context!==e&&(this._preparationPromise=null,this._context=e,e&&(this.analyticsManager=b.forContext(e)));}get context(){return this._context}set sparkScan(e){this._sparkScan!==e&&(this._preparationPromise=null,this._sparkScan=e);}get sparkScan(){return this._sparkScan}get sparkScan$(){if(!this._sparkScan)throw new Error("SparkScan mode is required to be set before calling this method");return this._sparkScan}get context$(){if(!this._context)throw new Error("Context is required to be set before calling this method");return this._context}setSparkScanViewSettings(e){this.sparkScanViewSettings=e,this.stateManager=new a$3(this.sparkScanViewSettings,this.preferenceManager),this.feedbackManager=a$4.withDefaults(this.sparkScanViewSettings.soundEnabled,this.sparkScanViewSettings.hapticEnabled),this.triggerButtonCollapseTimeout=new Timeout(this.sparkScanViewSettings.triggerButtonCollapseTimeout,async()=>{this.stateManager.state!=="idle"&&this._preparationPromise&&await this.switchToIdleState({sessionStopReason:"timeout"});}),this.inactiveStateTimeout=new Timeout(this.sparkScanViewSettings.inactiveStateTimeout,async()=>{this.stateManager.state!=="inactive"&&!this.stateManager.holdingToScan&&this._preparationPromise&&await this.switchToInactiveState({sessionStopReason:"timeout"});}),this.stateTimeouts={active:this.inactiveStateTimeout,inactive:this.triggerButtonCollapseTimeout};}get portraitOrientationTriggerButtonTranslateX(){var e;return (e=this.stateManager.portraitOrientationTriggerButtonTranslateX)!=null?e:this.defaultTriggerButtonTranslateX}get portraitOrientationTriggerButtonTranslateY(){var e;return (e=this.stateManager.portraitOrientationTriggerButtonTranslateY)!=null?e:this.defaultTriggerButtonTranslateY}get landscapeOrientationTriggerButtonTranslateX(){var e;return (e=this.stateManager.landscapeOrientationTriggerButtonTranslateX)!=null?e:this.defaultTriggerButtonTranslateX}get landscapeOrientationTriggerButtonTranslateY(){var e;return (e=this.stateManager.landscapeOrientationTriggerButtonTranslateY)!=null?e:this.defaultTriggerButtonTranslateY}get portraitOrientationMiniPreviewTranslateX(){var e;return (e=this.stateManager.portraitOrientationMiniPreviewTranslateX)!=null?e:this.defaultMiniPreviewTranslateX}get portraitOrientationMiniPreviewTranslateY(){var e;return (e=this.stateManager.portraitOrientationMiniPreviewTranslateY)!=null?e:this.defaultMiniPreviewTranslateY}get landscapeOrientationMiniPreviewTranslateX(){var e;return (e=this.stateManager.landscapeOrientationMiniPreviewTranslateX)!=null?e:this.defaultMiniPreviewTranslateX}get landscapeOrientationMiniPreviewTranslateY(){var e;return (e=this.stateManager.landscapeOrientationMiniPreviewTranslateY)!=null?e:this.defaultMiniPreviewTranslateY}get defaultTriggerButtonTranslateX(){return this.parentViewSizes.width-Math.min(this.parentViewSizes.width/3,110)-90/2}get defaultTriggerButtonTranslateY(){return this.parentViewSizes.height-Math.min(this.parentViewSizes.height/3,250)-90/2}get defaultMiniPreviewTranslateX(){return this.parentViewSizes.width-225-16}get parentViewSizes(){var e,t;return {width:(e=this.sparkScanView.parentElement.clientWidth)!=null?e:window.innerWidth,height:(t=this.sparkScanView.parentElement.clientHeight)!=null?t:window.innerHeight}}get defaultMiniPreviewTranslateY(){return 16}static forView(e,t){return new l(e,t)}async prepareScanning(e){if(this._preparationPromise)return this._preparationPromise;this._stopScanningPromise&&await this._stopScanningPromise,this._preparationPromise=this._internalPrepareScanning(e);try{await this._preparationPromise;}catch(t){throw this._preparationPromise=null,t}return this._preparationPromise}async _internalPrepareScanning(e){let t=this.context$,a=this.sparkScan$;this._dataCaptureView=await DataCaptureView.forContext(t),this._dataCaptureView.logoAnchor=Anchor.BottomCenter,this._dataCaptureView.logoStyle=LogoStyle.Minimal,this._dataCaptureView.setHiddenProperty("stopVideoTracksOnVisibilityChange",false),this._dataCaptureView.setHiddenProperty("freezeFrameWhenStoppingFrameSource",false),this._dataCaptureView.connectToElement(e);let i=isCameraFrameSource(t.frameSource)?t.frameSource:Camera.pickBestGuessForPosition(this.sparkScanViewSettings.defaultCameraPosition);await t.setFrameSource(i),await i.applySettings(a$5.recommendedCameraSettings),await i.switchToDesiredState(FrameSourceState.Standby);let r=await i.isTorchAvailable();this.sparkScanView.setTorchAvailable(r),this.sparkScanView.setZoomAvailable(i.isZoomAvailable()),this.sparkScanView.cameraSwitchButtonTapped(r,i.position),await t.setMode(a),a.addListener(this),a.setDelegate(this),this.sparkScanOverlay=await a$6.withSparkScanForView(a,this._dataCaptureView),await this.sparkScanOverlay.setShouldRemoveLocationsAfterScan(this.stateManager.scanningBehavior==="continuous"),this.smartScanSelectionOverlay=a$7.forMode(a),this.sparkScanViewSettings.smartSelectionCandidateBrush?this.smartScanSelectionOverlay.setBrush(this.sparkScanViewSettings.smartSelectionCandidateBrush):this.smartScanSelectionOverlay.setBrush(this.sparkScanOverlay.getBrush()),this.smartScanSelectionOverlay.setErrorBrush(this.sparkScanOverlay.getErrorBrush()),this.analyticsManager.startSession({cameraPosition:this.camera.position,hapticEnabled:this.sparkScanViewSettings.hapticEnabled,scanningMode:this.stateManager.scanningMode,soundEnabled:this.sparkScanViewSettings.soundEnabled,torchState:this.camera.getDesiredTorchState()}),await this.applyPreferences(),await this.switchToIdleState();}async stopScanning(e){if(this._stopScanningPromise)return this._stopScanningPromise;if(this.stateManager.state!=="Initial"){this._preparationPromise=null,this._stopScanningPromise=this._internalStopScanning(e);try{await this._stopScanningPromise;}finally{this._stopScanningPromise=null;}}}async _internalStopScanning(e){var i,r;this.stopTimeouts();let t=this.context$,a=this.sparkScan$;await a.setEnabled(false),a.removeListener(this),a.setDelegate(void 0),await t.removeMode(a),await((i=this.camera)==null?void 0:i.switchToDesiredState(FrameSourceState.Off)),(r=this._dataCaptureView)==null||r.detachFromElement(),this.analyticsManager.setSessionStopReason(e.sessionStopReason),this.setState("Initial");}async startScanning(){await this.switchToActiveState();}async pauseScanning(){await this.switchToInactiveState({sessionStopReason:"user"});}async onTriggerButtonPointerDown(){this.stateManager.triggerButtonPressed=true;}async onTriggerButtonTap(){switch(this.stateManager.state){case "Initial":{this.stateManager.triggerButtonPressed=false;return}case "idle":case "inactive":{await this.switchToActiveState({barcodeFeedback:new c(Color.fromRGBA(0,0,0,0),this.defaultSuccessBrush,this.feedbackManager.tapFeedback)});return}case "error":{await this.switchToActiveState({barcodeFeedback:new c(Color.fromRGBA(0,0,0,0),this.defaultSuccessBrush,this.feedbackManager.tapFeedback)});return}case "active":{if(this.stateManager.inSmartScanSelection){this.restartTimeouts(),await this.sparkScan$.selectItemWithSmartScanSelection();return}await(this.stateManager.continuousModeEnabled?this.switchToInactiveState({sessionStopReason:"user",barcodeFeedback:new c(Color.fromRGBA(0,0,0,0),this.defaultSuccessBrush,this.feedbackManager.noFeedback)}):this.switchToActiveState({barcodeFeedback:new c(Color.fromRGBA(0,0,0,0),this.defaultSuccessBrush,this.feedbackManager.tapFeedback)}));}}}async onTriggerButtonLongPressStart(){var e;this.stateManager.triggerButtonPressed=true,this.sparkScanViewSettings.holdToScanEnabled&&(this.scanningBehaviorCache=this.stateManager.scanningBehavior,this.stateManager.scanningBehavior="continuous",this.stateManager.holdingToScan=true,await((e=this.sparkScanOverlay)==null?void 0:e.setShouldRemoveLocationsAfterScan(true)),await this.switchToActiveState({barcodeFeedback:new c(Color.fromRGBA(0,0,0,0),this.defaultSuccessBrush,this.feedbackManager.tapFeedback)}));}async onTriggerButtonLongPressEnd(){var e,t;this.sparkScanViewSettings.holdToScanEnabled&&this.stateManager.state!=="error"?(this.stateManager.scanningBehavior=(e=this.scanningBehaviorCache)!=null?e:"single",this.stateManager.holdingToScan=false,await((t=this.sparkScanOverlay)==null?void 0:t.setShouldRemoveLocationsAfterScan(this.stateManager.continuousModeEnabled)),await this.switchToInactiveState({sessionStopReason:"user",barcodeFeedback:new b$1("",0,Color.fromRGBA(0,0,0,0),this.defaultErrorBrush,this.feedbackManager.noFeedback)})):this.stateManager.triggerButtonPressed=false;}async onClickOutside(){this.stateManager.idleState||await this.switchToIdleState({emitTapFeedback:true});}async onVisibilityChange(){await this.switchToIdleState();}async onTargetModeButtonTap(e,t=this.feedbackManager.tapFeedback,a=true){var o,s,c;t.emit();let i=String(e),r={true:e&&this.stateManager.scanningMode instanceof b$2,false:!e&&this.stateManager.scanningMode instanceof c$1}[i];r&&(this.stateManager.scanningMode=this.stateManager.scanningMode.changeMode()),this.enableTargetMode(e),await((o=this.sparkScanOverlay)==null?void 0:o.setShouldDrawViewfinder(e)),this.startTimeoutForCurrentState(),this.sparkScanView.targetModeButtonTapped(e,a),r&&((c=(s=this.listener)==null?void 0:s.didChangeScanningMode)==null||c.call(s,this.stateManager.scanningMode),this.analyticsManager.setScanningMode(this.stateManager.scanningMode)),this.updateSizeControlVisibility();}async onScanningBehaviorButtonTap(e,t=this.feedbackManager.tapFeedback,a=true){var i;t.emit(),this.stateManager.scanningMode=this.stateManager.scanningMode.copyWith(e?"continuous":"single"),await((i=this.sparkScanOverlay)==null?void 0:i.setShouldRemoveLocationsAfterScan(e)),this.startTimeoutForCurrentState(),this.sparkScanView.scanningBehaviorButtonTapped(e,a),this.analyticsManager.setScanningMode(this.stateManager.scanningMode);}async onBarcodeFindButtonTap(){var e,t;await this.switchToIdleState({sessionStopReason:"user",emitTapFeedback:true}),(t=(e=this.listener)==null?void 0:e.didTapBarcodeFindButton)==null||t.call(e,this.sparkScanView),this.restartTimeouts();}async onLabelCaptureButtonTap(){var e,t;await this.switchToIdleState({sessionStopReason:"user",emitTapFeedback:true}),(t=(e=this.listener)==null?void 0:e.didTapLabelCaptureButton)==null||t.call(e,this.sparkScanView),this.restartTimeouts();}async onCameraSwitchButtonTap(){var a,i;if(this.feedbackManager.emitTapFeedback(),this.restartTimeouts(),!this.camera||this.stateManager.state==="error")return;let e={[CameraPosition.WorldFacing]:CameraPosition.UserFacing,[CameraPosition.UserFacing]:CameraPosition.WorldFacing}[(a=this.camera)==null?void 0:a.position],t=Camera.pickBestGuessForPosition(e);t&&(await((i=this.camera)==null?void 0:i.switchToDesiredState(FrameSourceState.Off)),await this.context$.setFrameSource(t),await t.applySettings(this.camera.settings),await t.switchToDesiredState(FrameSourceState.On),this.sparkScanView.cameraSwitchButtonTapped(await t.isTorchAvailable(),e),this.analyticsManager.setCameraPosition(e));}async onTorchButtonTap(e,t=this.feedbackManager.tapFeedback,a=true){var i,r;t.emit(),this.stateManager.torchState=e?TorchState.On:TorchState.Off,((i=this.camera)==null?void 0:i.getCurrentState())===FrameSourceState.On&&await((r=this.camera)==null?void 0:r.setDesiredTorchState(this.stateManager.torchState)),this.startTimeoutForCurrentState(),this.sparkScanView.torchButtonTapped(e,a),this.analyticsManager.setTorchState(this.stateManager.torchState);}restartTimeouts(){for(let e of [this.triggerButtonCollapseTimeout,this.inactiveStateTimeout,this.resumeCapturingTimeout])(e==null?void 0:e.running)===true&&e.start();}stopTimeouts(){for(let e of [this.triggerButtonCollapseTimeout,this.inactiveStateTimeout,this.resumeCapturingTimeout])e==null||e.stop();}async onMiniPreviewCloseButtonTap(){await this.switchToIdleState({sessionStopReason:"user",emitTapFeedback:true});}onMiniPreviewResizeButtonTap(){(this.stateManager.state==="active"||this.stateManager.state==="inactive")&&(this.feedbackManager.emitTapFeedback(),this.startTimeoutForCurrentState());}async onMiniPreviewZoomButtonTap(e){this.feedbackManager.emitTapFeedback(),this.stateManager.zoomFactor=e,this.camera&&(this.camera.settings.zoomFactor=e,await this.camera.applySettings(this.camera.settings)),this.startTimeoutForCurrentState();}async onMiniPreviewDrag(e,t){switch(this.stateManager.state==="active"&&await this.sparkScan$.setEnabled(false),t){case "landscape-primary":case "landscape-secondary":{this.stateManager.landscapeOrientationMiniPreviewTranslateX=e.x,this.stateManager.landscapeOrientationMiniPreviewTranslateY=e.y;break}case "portrait-primary":case "portrait-secondary":{this.stateManager.portraitOrientationMiniPreviewTranslateX=e.x,this.stateManager.portraitOrientationMiniPreviewTranslateY=e.y;break}}this.restartTimeouts();}onMiniPreviewPointerMove(){this.restartTimeouts();}async onMiniPreviewPointerUp(){await this.switchToActiveState();}async onMiniPreviewDragEnd(){this.stateManager.state==="active"&&await this.sparkScan$.setEnabled(true);}async onMiniPreviewVisibilityChange(e){e&&this.sparkScanView.repositionMiniPreviewIfOutOfBounds(),this.stateManager.inSmartScanSelection&&!e&&await this.onSwitchedAwayFromSmartScanSelection();}onTriggerButtonDrag(e,t){switch(t){case "landscape-primary":case "landscape-secondary":{this.stateManager.landscapeOrientationTriggerButtonTranslateX=e.x,this.stateManager.landscapeOrientationTriggerButtonTranslateY=e.y;break}case "portrait-primary":case "portrait-secondary":{this.stateManager.portraitOrientationTriggerButtonTranslateX=e.x,this.stateManager.portraitOrientationTriggerButtonTranslateY=e.y;break}}}async onOrientationChange(){if(this.stateManager.state==="active"&&this.stateManager.holdingToScan){this.restartTimeouts();return}this.stateManager.state==="error"&&await this.switchToInactiveState({sessionStopReason:"user"});}async didScan(e,t){if(!t.newlyRecognizedBarcode)return;let a=this.sparkScanView.feedbackDelegate.getFeedbackForBarcode(t.newlyRecognizedBarcode);if(a){if(a instanceof b$1){await this.switchToErrorState({barcodeFeedback:a}),this.restartTimeouts();return}if(a instanceof c){if(this.stateManager.continuousModeEnabled){await this.switchToActiveState({barcodeFeedback:a}),this.restartTimeouts();return}let i=true,r="user";await this.switchToInactiveState({barcodeFeedback:a,emitSuccessFeedback:i,sessionStopReason:r}),this.restartTimeouts();}}}setListener(e){this.listener=e;}async onSwitchedToSmartScanSelection(){var e,t;this.sparkScanOverlay&&this.smartScanSelectionOverlay&&(this.stateManager.inSmartScanSelection=true,this.stateManager.miniPreviewSizeBeforeSmartScanSelection=this.sparkScanView.miniPreviewSize,this.stateManager.previewSizeControlVisibleBeforeSmartScanSelection=this.sparkScanView._previewSizeControlVisible,await((e=this._dataCaptureView)==null?void 0:e.removeOverlay(this.sparkScanOverlay)),await((t=this._dataCaptureView)==null?void 0:t.addOverlay(this.smartScanSelectionOverlay)),this.stateManager.targetModeEnabled||(this.sparkScanView.miniPreviewSize="expanded"),this.updateSizeControlVisibility());}async onSwitchedAwayFromSmartScanSelection(){var e,t;this.sparkScanOverlay&&this.smartScanSelectionOverlay&&this.stateManager.miniPreviewSizeBeforeSmartScanSelection&&(this.stateManager.inSmartScanSelection=false,await((e=this._dataCaptureView)==null?void 0:e.removeOverlay(this.smartScanSelectionOverlay)),await((t=this._dataCaptureView)==null?void 0:t.addOverlay(this.sparkScanOverlay)),this.sparkScanView.miniPreviewSize=this.stateManager.miniPreviewSizeBeforeSmartScanSelection,this.stateManager.miniPreviewSizeBeforeSmartScanSelection=void 0,this.updateSizeControlVisibility());}brushForFeedback(e){return e.brush}async switchToIdleState(e={}){var t,a,i,r,n;await this.sparkScan$.setEnabled(false),await((t=this.camera)==null?void 0:t.switchToDesiredState(FrameSourceState.Standby)),e.emitTapFeedback===true&&this.feedbackManager.emitTapFeedback(),await((a=this.sparkScanOverlay)==null?void 0:a.overlayReadyForDraw()),this.setState("idle"),(i=this.triggerButtonCollapseTimeout)==null||i.stop(),(r=this.inactiveStateTimeout)==null||r.stop(),(n=this.resumeCapturingTimeout)==null||n.stop(),this.stateManager.triggerButtonPressed=false,this.sparkScanView.switchToIdleState(),e.sessionStopReason!=null&&this.analyticsManager.setSessionStopReason(e.sessionStopReason);}async setBrushToOverlays(e){var t,a,i;this.sparkScanViewSettings.smartSelectionCandidateBrush?(t=this.smartScanSelectionOverlay)==null||t.setBrush(this.sparkScanViewSettings.smartSelectionCandidateBrush):(a=this.smartScanSelectionOverlay)==null||a.setBrush(e),await((i=this.sparkScanOverlay)==null?void 0:i.setBrush(e));}async switchToActiveState(e={}){var a,i,r,n,o,s,c$1,d;let t=this.stateManager.state;if(await((a=this.camera)==null?void 0:a.switchToDesiredState(FrameSourceState.On)),await((i=this.camera)==null?void 0:i.setDesiredTorchState(this.stateManager.torchState)),e.barcodeFeedback){let D=this.brushForFeedback(e.barcodeFeedback);await this.setBrushToOverlays(D);}await((r=this.sparkScanOverlay)==null?void 0:r.setShouldRemoveLocationsAfterScan(this.stateManager.continuousModeEnabled)),await((n=this.sparkScanOverlay)==null?void 0:n.overlayReadyForDraw()),this.feedbackManager.emitBarcodeFeedback(e.barcodeFeedback),this.stateManager.holdingToScan||(o=this.inactiveStateTimeout)==null||o.start(),(s=this.triggerButtonCollapseTimeout)==null||s.stop(),(c$1=this.resumeCapturingTimeout)==null||c$1.stop(),await this.sparkScanView.switchToActiveState(this.sparkScanViewSettings.visualFeedbackEnabled&&e.barcodeFeedback instanceof c,this.stateManager.scanningBehavior,(d=e.barcodeFeedback)==null?void 0:d.visualFeedbackColor,this.stateManager.zoomedIn&&t!=="active"),await this.sparkScan$.setEnabled(true),this.setState("active");}async switchToInactiveState(e){var t,a,r,n,o,s,c$1;if(this.stateManager.inSmartScanSelection?await this.sparkScan$.setEnabled(false):this.stateManager.shouldEnableSuppression?await this.sparkScan$.setResultSuppressionEnabled(true):await this.sparkScan$.setEnabled(false),this.stateManager.triggerButtonPressed=false,this.stateManager.scanningMode.previewBehavior==="persistent"?e.barcodeFeedback instanceof c&&await((t=this.sparkScanOverlay)==null?void 0:t.setShouldRemoveLocationsAfterScan(true)):await((a=this.camera)==null?void 0:a.switchToDesiredState(FrameSourceState.Standby)),(e.emitSuccessFeedback)!=null||(e.emitSuccessFeedback=true),this.setState("inactive"),e.barcodeFeedback){let d=this.brushForFeedback(e.barcodeFeedback);await this.setBrushToOverlays(d);}this.feedbackManager.emitBarcodeFeedback(e.barcodeFeedback),await((r=this.sparkScanOverlay)==null?void 0:r.overlayReadyForDraw()),(n=this.triggerButtonCollapseTimeout)==null||n.start(),(o=this.inactiveStateTimeout)==null||o.stop(),(s=this.resumeCapturingTimeout)==null||s.stop(),await this.sparkScanView.switchToInactiveState(this.sparkScanViewSettings.visualFeedbackEnabled&&e.barcodeFeedback instanceof c&&e.emitSuccessFeedback,this.stateManager.scanningBehavior,this.stateManager.previewBehavior,(c$1=e.barcodeFeedback)==null?void 0:c$1.visualFeedbackColor),this.analyticsManager.setSessionStopReason(e.sessionStopReason);}async switchToErrorState(e){var a,i,r,n,o,s,c;let t=e.barcodeFeedback.resumeCapturingDelay>0;t&&(await this.sparkScan$.setEnabled(false),await((a=this.camera)==null?void 0:a.switchToDesiredState(FrameSourceState.Standby)),this.setState("error"),this.stateManager.scanningBehavior="single",this.resumeCapturingTimeout=new Timeout(e.barcodeFeedback.resumeCapturingDelay,async()=>{this.stateManager.state!=="active"&&this._preparationPromise&&await this.switchToActiveState();}),this.resumeCapturingTimeout.start()),(i=this.smartScanSelectionOverlay)==null||i.setErrorBrush(e.barcodeFeedback.brush),await((r=this.sparkScanOverlay)==null?void 0:r.setErrorBrush(e.barcodeFeedback.brush)),await((n=this.sparkScanOverlay)==null?void 0:n.overlayReadyForDraw()),await((o=this.sparkScanOverlay)==null?void 0:o.setShouldRemoveLocationsAfterScan(e.barcodeFeedback.resumeCapturingDelay===0)),await this.sparkScan$.workerCommand("sparkScanEmitErrorFeedback",{shouldRemoveBrush:!t}),this.feedbackManager.emitBarcodeFeedback(e.barcodeFeedback),(s=this.triggerButtonCollapseTimeout)==null||s.stop(),(c=this.inactiveStateTimeout)==null||c.stop(),await this.sparkScanView.switchToErrorState(e.barcodeFeedback,this.sparkScanViewSettings.visualFeedbackEnabled);}enableTargetModeLocationSelection(e){var r;let t=e?a$8.SparkScanSettings.targetModeLocationSelection.radius:a$8.SparkScanSettings.locationSelection.radius,a=e?a$8.SparkScanSettings.targetModeLocationSelection.unit:a$8.SparkScanSettings.locationSelection.unit,i=new NumberWithUnit(t,a);this.sparkScan$.settings.locationSelection=new RadiusLocationSelection(i),(r=this.sparkScanOverlay)==null||r.setRadius(i);}enableTargetMode(e){this.enableTargetModeLocationSelection(e);}async applyPreferences(){await this.onTargetModeButtonTap(this.stateManager.targetModeEnabled,this.feedbackManager.noFeedback,false),await this.onScanningBehaviorButtonTap(this.stateManager.continuousModeEnabled,this.feedbackManager.noFeedback,false),await this.onTorchButtonTap(this.stateManager.torchEnabled,this.feedbackManager.noFeedback,false),this.sparkScanView.repositionElementsIfOutOfBounds();}setState(e){var t,a;e!==this.stateManager.state&&(this.stateManager.state=e,(a=(t=this.listener)==null?void 0:t.didChangeViewState)==null||a.call(t,e));}startTimeoutForCurrentState(){let e=this.stateTimeouts[this.stateManager.state];e==null||e.start();}updateSizeControlVisibility(){if(!this.stateManager.inSmartScanSelection&&this.stateManager.previewSizeControlVisibleBeforeSmartScanSelection!==void 0){this.sparkScanView.previewSizeControlVisible=this.stateManager.previewSizeControlVisibleBeforeSmartScanSelection,this.stateManager.previewSizeControlVisibleBeforeSmartScanSelection=void 0;return}let e=this.stateManager.inSmartScanSelection&&!this.stateManager.targetModeEnabled,t=this.sparkScanView._previewSizeControlVisible;this.sparkScanView.previewSizeControlVisible=t&&!e;}};a([v],l.prototype,"switchToActiveState",1),a([v],l.prototype,"switchToInactiveState",1),a([v],l.prototype,"switchToErrorState",1);var A=l;export{A as a};
@@ -1 +1 @@
1
- import {a as a$7}from'./chunk-ZPCWOA3Y.js';import {a as a$6}from'./chunk-MHOUYN7K.js';import {a}from'./chunk-HDLJOQJY.js';import {a as a$9}from'./chunk-KMEGIFKL.js';import {a as a$5}from'./chunk-QRG4J3CL.js';import {b as b$1}from'./chunk-33EFB3RJ.js';import {b}from'./chunk-OH47PSIL.js';import {a as a$1}from'./chunk-I53W7VSB.js';import {a as a$8}from'./chunk-O5SUMSOC.js';import {a as a$2}from'./chunk-NU4EA3HH.js';import {a as a$4}from'./chunk-I3PK5YW4.js';import {a as a$3}from'./chunk-RF4KC5J3.js';import {Anchor,DataCaptureView,Direction,Point,Size}from'@scandit/web-datacapture-core';import {Backdrop}from'@scandit/web-datacapture-core/build/js/private/ui/atoms/Backdrop.js';import {ScanditHTMLElement}from'@scandit/web-datacapture-core/build/js/private/utils/ScanditHTMLElement.js';import {css}from'@scandit/web-datacapture-core/build/js/private/utils/css.js';import {defineCustomElements}from'@scandit/web-datacapture-core/build/js/private/utils/defineCustomElements.js';import {calculateArea,calculateWidth,calculateHeight}from'@scandit/web-datacapture-core/build/js/private/utils/quadrilateralUtils.js';import {Timeout}from'@scandit/web-datacapture-core/build/js/private/utils/timeout.js';import {TorchSwitchIconButton}from'@scandit/web-datacapture-core/build/js/private/ui/molecules/TorchSwitchIconButton.js';var W={async highlightForBarcode(E,T){let t=a$9.create(E);T(t);}},c=class c extends ScanditHTMLElement{constructor(){super(...arguments);this.torchSwitchIconButton=null;this.cameraSwitchButton=null;this.zoomButton=null;this._shouldShowTorchControl=false;this._isTorchAvailable=false;this.onTorchButtonClickHandler=this.onTorchButtonClick.bind(this);this.onCameraSwitchButtonHandler=this.onCameraSwitchButtonClick.bind(this);this.onZoomButtonHandler=this.onZoomButtonClick.bind(this);this.onLayoutPointerDownHandler=this.onLayoutPointerDown.bind(this);this.onInfoAnnotationTapHandler=this.onInfoAnnotationTap.bind(this);this.pendingDeletionTimeout=null;}set shouldShowZoomControl(t){this.zoomButton&&(this.zoomButton.hidden=!t);}get shouldShowZoomControl(){return this.zoomButton===null?false:!this.zoomButton.hidden}set shouldShowCameraSwitchControl(t){this.cameraSwitchButton&&(this.cameraSwitchButton.hidden=!t);}get shouldShowCameraSwitchControl(){return this.cameraSwitchButton===null?false:!this.cameraSwitchButton.hidden}set shouldShowTorchControl(t){this.torchSwitchIconButton!==null&&(this._shouldShowTorchControl=t,this.torchSwitchIconButton.hidden=!(t&&this._isTorchAvailable));}get shouldShowTorchControl(){return this._shouldShowTorchControl}set torchControlPosition(t){var o;(o=this.torchSwitchIconButton)==null||o.setAttribute("slot",`controls-${t===Anchor.Center?Anchor.TopLeft:t}`);}get torchControlPosition(){var o,e;let t=(e=(o=this.torchSwitchIconButton)==null?void 0:o.getAttribute("slot"))!=null?e:"";return t===""?Anchor.TopLeft:t.replace("controls-","")}set zoomControlPosition(t){var o;(o=this.zoomButton)==null||o.setAttribute("slot",`controls-${t===Anchor.Center?Anchor.BottomRight:t}`);}get zoomControlPosition(){var o,e;let t=(e=(o=this.zoomButton)==null?void 0:o.getAttribute("slot"))!=null?e:"";return t===""?Anchor.BottomRight:t.replace("controls-","")}set cameraSwitchControlPosition(t){var o;(o=this.cameraSwitchButton)==null||o.setAttribute("slot",`controls-${t===Anchor.Center?Anchor.TopRight:t}`);}get cameraSwitchControlPosition(){var o,e;let t=(e=(o=this.zoomButton)==null?void 0:o.getAttribute("slot"))!=null?e:"";return t===""?Anchor.TopRight:t.replace("controls-","")}static async createWithSettings(t,o,e,i,n){c.register();let r=document.createElement(c.tag);return r.barcodeArViewSettings=i,r.layout=a.create(),r.append(r.layout),a$1(t)?(r.dataCaptureView=t,r.dataCaptureView.containerElement.prepend(r),await t.setContext(o)):(r.dataCaptureView=await DataCaptureView.forContext(o),r.dataCaptureView.connectToElement(t),r.dataCaptureView.containerElement.prepend(r)),r.presenter=new a$2(r,o,e,i,n!=null?n:a$3.createRecommendedCameraSettings()),await r.presenter.prepare(),r}static async create(t,o,e){return c.createWithSettings(t,o,e,new a$4)}static register(){defineCustomElements({[a.tag]:a,[a$7.tag]:a$7,[a$6.tag]:a$6,[TorchSwitchIconButton.tag]:TorchSwitchIconButton,[c.tag]:c,[Backdrop.tag]:Backdrop,[a$5.tag]:a$5});}static createStyleElement(){return css`[data-could-be-deleted=true]{display:none!important}[data-on-foreground=true]{z-index:3}${c.tag}{inset:0;position:absolute;z-index:1}`}getHighlightForBarcode(t){return this.queryHighlightByDataId(a$8(t))}getAnnotationForBarcode(t){return this.queryAnnotationByDataId(a$8(t))}async start(){return this.presenter.startSearching()}async stop(){return this.presenter.stopSearching()}async pause(){return this.presenter.pauseSearching()}reset(){this.deletePendingViews(),this.deleteAllViews();}getNotificationPresenter(){return this.dataCaptureView.getNotificationPresenter()}setTorchAvailable(t){this._isTorchAvailable=t,this.torchSwitchIconButton!==null&&(this.torchSwitchIconButton.hidden=!(this._shouldShowTorchControl&&this._isTorchAvailable));}toggleTorchIcon(t){this.torchSwitchIconButton!==null&&(this.torchSwitchIconButton.state=t);}onTorchButtonClick(){this.presenter.onTorchButtonClicked();}onCameraSwitchButtonClick(){this.presenter.onCameraSwitchButtonClicked();}onZoomButtonClick(){this.presenter.onZoomButtonClicked();}changeZoomButtonIcon(t){this.zoomButton&&(this.zoomButton.zoom=`${t}x`);}connectedCallback(){this.torchSwitchIconButton=TorchSwitchIconButton.create(),this.torchSwitchIconButton.shadow=true,this.torchSwitchIconButton.size=36,this.torchSwitchIconButton.slot=`controls-${this.torchControlPosition}`,this.torchSwitchIconButton.hidden=true,this.torchSwitchIconButton.addEventListener("pointerdown",this.onTorchButtonClickHandler),this.cameraSwitchButton=a$7.create(),this.cameraSwitchButton.slot=`controls-${this.cameraSwitchControlPosition}`,this.cameraSwitchButton.hidden=true,this.cameraSwitchButton.addEventListener("pointerdown",this.onCameraSwitchButtonHandler),this.zoomButton=a$6.create(),this.zoomButton.slot=`controls-${this.zoomControlPosition}`,this.zoomButton.hidden=true,this.zoomButton.addEventListener("pointerdown",this.onZoomButtonHandler),this.layout.append(this.torchSwitchIconButton,this.cameraSwitchButton,this.zoomButton),this.layout.addEventListener("pointerdown",this.onLayoutPointerDownHandler),this.layout.addEventListener("BarcodeArInfoAnnotationEventTap",this.onInfoAnnotationTapHandler),this.backdrop=Backdrop.create(),this.layout.append(this.backdrop),this.pendingDeletionTimeout=new Timeout(1e3,()=>{this.deletePendingViews();}),this.prepend(c.createStyleElement());}disconnectedCallback(){var t,o,e;this.deleteAllViews(),(t=this.torchSwitchIconButton)==null||t.removeEventListener("pointerdown",this.onTorchButtonClickHandler),(o=this.cameraSwitchButton)==null||o.removeEventListener("pointerdown",this.onCameraSwitchButtonHandler),(e=this.zoomButton)==null||e.removeEventListener("pointerdown",this.onZoomButtonHandler),this.layout.removeEventListener("pointerdown",this.onLayoutPointerDownHandler),this.layout.removeEventListener("BarcodeArInfoAnnotationEventTap",this.onInfoAnnotationTapHandler);}isPopoverAnnotation(t){return t instanceof b}isAnnotation(t){var o;return ((o=t.dataset)==null?void 0:o.identifier)==null?false:t.dataset.identifier.endsWith("-annotation")}areMultiplePopoverAllowed(){for(let t of this.layout.querySelectorAll("[data-identifier$='-annotation']"))if(t&&this.isPopoverAnnotation(t)&&t.annotationTrigger==="highlightTapAndBarcodeScan")return true;return false}async onLayoutPointerDown(t){let o=t.target,e=o==null?void 0:o.closest("[data-identifier$='-highlight']"),i=o==null?void 0:o.closest(b.tag);if((e==null?void 0:e.dataset.id)!=null){await this.handleHighlightClick(e);return}if((i==null?void 0:i.dataset.id)!=null){await this.handleAnnotationClick(i);return}await this.handleClickOutside();}async handleHighlightClick(t){var e;this.presenter.emitTappedFeedback(),(e=this.listener)==null||e.didTapHighlightForBarcode(this.presenter.barcodeAr,t.barcode,t);let o=this.queryAnnotationByDataIdentifier(t.dataset.identifier.replace("-highlight",""));!o||o.annotationTrigger==="barcodeScan"||(this.isPopoverAnnotation(o)?await this.handlePopoverHighlightClick(o,t):o.hidden=!o.hidden);}async handlePopoverHighlightClick(t,o){var e;if(!this.areMultiplePopoverAllowed()){let i=this.layout.querySelector(`${b.tag}[data-on-foreground="true"]`),n=(e=i==null?void 0:i.dataset.identifier)==null?void 0:e.replace("-annotation","-highlight"),r=this.layout.querySelector(`[data-identifier="${n}"]`);i!=null&&r!=null&&await this.hideBarcodeArPopover(i,r,false);}await this.toggleBarcodeArPopover(t,o);}async handleAnnotationClick(t){var i;let o=(i=t.dataset.identifier)==null?void 0:i.replace("-annotation","-highlight"),e=this.layout.querySelector(`[data-identifier="${o}"]`);e&&await this.toggleBarcodeArPopover(t,e);}async handleClickOutside(){var i;if(this.areMultiplePopoverAllowed())return;let t=this.layout.querySelector(`${b.tag}[data-on-foreground="true"]`);if(!t)return;let o=(i=t.dataset.identifier)==null?void 0:i.replace("-annotation","-highlight"),e=this.layout.querySelector(`[data-identifier="${o}"]`);e&&await this.hideBarcodeArPopover(t,e);}onInfoAnnotationTap(){this.presenter.emitTappedFeedback();}async showBarcodeArPopover(t,o){t.dataset.onForeground="true",t.hidden=false,o.dataset.onForeground="true",this.backdrop.open=true;}async hideBarcodeArPopover(t,o,e=true){t.dataset.onForeground="false",t.hidden=true,o&&(o.dataset.onForeground="false"),e&&this.hideBackdropIfNoPopovers();}hideBackdropIfNoPopovers(){[...this.layout.querySelectorAll(`${b.tag}`)].every(o=>o.hidden)&&(this.backdrop.open=false);}async toggleBarcodeArPopover(t,o){t.hidden?await this.showBarcodeArPopover(t,o):await this.hideBarcodeArPopover(t,o);}deleteAllViews(){for(let t of this.layout.querySelectorAll("[data-identifier]"))t.remove();}deletePendingViews(){for(let t of this.layout.querySelectorAll("[data-could-be-deleted='true']"))t.remove();this.hideBackdropIfNoPopovers();}identifierForHighlight(t){return `${t}-highlight`}identifierForAnnotation(t){return `${t}-annotation`}async onHighlightsOrAnnotationForTrackedBarcode(t){var o,e,i;await((e=(o=this.highlightProvider)!=null?o:W)==null?void 0:e.highlightForBarcode(t.barcode,async n=>this.onHighlight(t,n))),await((i=this.annotationProvider)==null?void 0:i.annotationForBarcode(t.barcode,async n=>this.onAnnotation(t,n)));}async onAnnotation(t,o){let e=o,i=a$8(t.barcode);this.updateExistingAnnotation(i)||(await this.setupNewAnnotation(e,i,t),this.updateAnnotationPosition(t,e));}updateExistingAnnotation(t){let o=this.queryAnnotationByDataId(t);return o?(o.dataset.couldBeDeleted="false",true):false}async setupNewAnnotation(t,o,e){if(t.dataset.id=o,t.dataset.identifier=this.identifierForAnnotation(e.identifier),t.hidden=true,this.layout.append(t),this.isPopoverAnnotation(t)){if(t.direction=Direction.Vertical,t.anchor==null&&(t.anchor="bottom-center"),this.areMultiplePopoverAllowed()||t.annotationTrigger==="highlightTapAndBarcodeScan"){let i=this.queryHighlightByDataId(o);i&&await this.showBarcodeArPopover(t,i);}}else t.hidden=t.annotationTrigger==="highlightTap";}getAnnotationVariationForQuad(t,o){let e=Math.max(0,Math.min(1,o)),i=t.anchorPositions,n=calculateArea(i),r=this.dataCaptureView.width,l=this.dataCaptureView.height,d=r*l;if(n<=0||d<=0)return 0;let u=n/d;return Math.max(0,Math.min(1,u))<=e?2:1}async onHighlight(t,o){let e=a$8(t.barcode),i=this.queryHighlightByDataId(e);i?i.dataset.couldBeDeleted="false":(o.dataset.id=e,o.dataset.identifier=this.identifierForHighlight(t.identifier),this.updateHighlightPosition(t,o),this.layout.append(o));}queryHighlightByDataIdentifier(t){return this.layout.querySelector(`[data-identifier$="${t}-highlight"]`)}queryAnnotationByDataIdentifier(t){return this.layout.querySelector(`[data-identifier$="${t}-annotation"]`)}queryHighlightByDataId(t){return this.layout.querySelector(`[data-identifier$="-highlight"][data-id="${t}"]`)}queryAnnotationByDataId(t){return this.layout.querySelector(`[data-identifier$="-annotation"][data-id="${t}"]`)}updateRemovedTrackedBarcodes(t){var i,n,r,l,d;let o=this.querySelectorAll("[data-identifier]");if(Object.keys(t.allTrackedBarcodes).length===0){for(let u of o)u.dataset.couldBeDeleted="true";(i=this.pendingDeletionTimeout)!=null&&i.running||(n=this.pendingDeletionTimeout)==null||n.start();return}let e=new Set(t.removedTrackedBarcodes);for(let u of o){let p=(r=u.dataset.identifier)==null?void 0:r.replace("-highlight","").replace("-annotation","");p!=null&&e.has(p)&&(u.dataset.couldBeDeleted="true");}(l=this.pendingDeletionTimeout)!=null&&l.running||(d=this.pendingDeletionTimeout)==null||d.start();}render(t){for(let[o,e]of Object.entries(t.allTrackedBarcodes)){t.addedTrackedBarcodes[o]!=null&&this.onHighlightsOrAnnotationForTrackedBarcode(e);let i=a$8(e.barcode),n=this.queryAnnotationByDataId(i),r=this.queryHighlightByDataId(i);r&&(this.updateBrushSize(r,e),this.updateHighlightPosition(e,r)),n&&this.updateAnnotationPosition(e,n,r);}this.updateRemovedTrackedBarcodes(t);}updateHighlightPosition(t,o,e="center"){if(o.hidden)return;let i=this.dataCaptureView.viewAnchorPositionsForFrameAnchorPositions(t.anchorPositions),n=this.normalizedViewPointFromFrameAnchorPositions(i,e);o.updatePosition(n,new Point(-50,-50),this.calculateRotationAngle(i.topLeft,i.topRight));}updateBrushSize(t,o){if(t.width==null||t.height==null)return;let e=this.dataCaptureView.viewAnchorPositionsForFrameAnchorPositions(o.anchorPositions),i=Math.round(calculateWidth(e)),n=Math.round(calculateHeight(e));t.width!==i&&(t.width=i),t.height!==n&&(t.height=n);}getTransformOrigin(t){return {"top-center":new Point(-50,0),"bottom-center":new Point(-50,-100),"left-center":new Point(0,-50),"right-center":new Point(-100,-50)}[t]}calculateAnnotationPosition(t,o,e){var p,f;let n=t.orderVerticesByPosition(),r=this.normalizedViewPointFromFrameAnchorPositions(t,"center"),d={"bottom-center":()=>{let s=this.normalizedViewPointFromFrameAnchorPositions(n,"topCenter");return new Point(s.x,s.y-7)},"top-center":()=>{let s=this.normalizedViewPointFromFrameAnchorPositions(n,"bottomCenter");return new Point(s.x,s.y+7)},"right-center":()=>{let s=this.normalizedViewPointFromFrameAnchorPositions(n,"centerLeft");return new Point(s.x-7,s.y)},"left-center":()=>{let s=this.normalizedViewPointFromFrameAnchorPositions(n,"centerRight");return new Point(s.x+7,s.y)}}[o]();return e?e instanceof b$1?(p={"bottom-center":new Point(r.x,r.y-7-e.clientHeight/2),"top-center":new Point(r.x,r.y+7+e.clientHeight/2),"right-center":new Point(r.x-7-e.clientWidth/2,r.y),"left-center":new Point(r.x+7+e.clientWidth/2,r.y)}[o])!=null?p:d:(f={"bottom-center":new Point(r.x,r.y-7-e.clientHeight/2),"top-center":new Point(r.x,r.y+7+e.clientHeight/2),"right-center":new Point(r.x-7-e.clientWidth/2,r.y),"left-center":new Point(r.x+7+e.clientWidth/2,r.y)}[o])!=null?f:d:d}updateAnnotationPosition(t,o,e){let i=this.dataCaptureView.viewAnchorPositionsForFrameAnchorPositions(t.anchorPositions);if(o.anchor||(o.anchor="top-center"),o.annotationVariation!=null){let l=this.getAnnotationVariationForQuad(t,a$5.threshold);o.annotationVariation=l;}let n=this.getTransformOrigin(o.anchor),r=this.calculateAnnotationPosition(i,o.anchor,e);o.updatePosition(r,n,this.calculateRotationAngle(i.topLeft,i.topRight));}normalizedViewPointFromFrameAnchorPositions(t,o="center"){let e=this.presenter.currentCamera.getMirrorImageEnabled(),i=new Size(this.dataCaptureView.width,this.dataCaptureView.height);if(e){let r=t[{centerLeft:"centerRight",centerRight:"centerLeft",center:"center",topCenter:"topCenter",bottomCenter:"bottomCenter"}[o]];return Point.mirrorX(r,i)}return t[o]}calculateRotationAngle(t,o){let e=o.x-t.x,n=this.presenter.isCameraMirrored()?-(o.y-t.y):o.y-t.y,r=Math.atan2(n,e);return Math.round(r*(180/Math.PI))}};c.tag="scandit-barcode-ar-view";var k=c;export{k as a};
1
+ import {a as a$7}from'./chunk-ZPCWOA3Y.js';import {a as a$6}from'./chunk-MHOUYN7K.js';import {a}from'./chunk-HDLJOQJY.js';import {a as a$9}from'./chunk-KMEGIFKL.js';import {a as a$5}from'./chunk-QRG4J3CL.js';import {b as b$1}from'./chunk-33EFB3RJ.js';import {b}from'./chunk-OH47PSIL.js';import {a as a$1}from'./chunk-I53W7VSB.js';import {a as a$8}from'./chunk-O5SUMSOC.js';import {a as a$2}from'./chunk-QDIBZVNH.js';import {a as a$4}from'./chunk-I3PK5YW4.js';import {a as a$3}from'./chunk-MTJ3TGSI.js';import {Anchor,DataCaptureView,Direction,Point,Size}from'@scandit/web-datacapture-core';import {Backdrop}from'@scandit/web-datacapture-core/build/js/private/ui/atoms/Backdrop.js';import {ScanditHTMLElement}from'@scandit/web-datacapture-core/build/js/private/utils/ScanditHTMLElement.js';import {css}from'@scandit/web-datacapture-core/build/js/private/utils/css.js';import {defineCustomElements}from'@scandit/web-datacapture-core/build/js/private/utils/defineCustomElements.js';import {calculateArea,calculateWidth,calculateHeight}from'@scandit/web-datacapture-core/build/js/private/utils/quadrilateralUtils.js';import {Timeout}from'@scandit/web-datacapture-core/build/js/private/utils/timeout.js';import {TorchSwitchIconButton}from'@scandit/web-datacapture-core/build/js/private/ui/molecules/TorchSwitchIconButton.js';var W={async highlightForBarcode(E,T){let t=a$9.create(E);T(t);}},c=class c extends ScanditHTMLElement{constructor(){super(...arguments);this.torchSwitchIconButton=null;this.cameraSwitchButton=null;this.zoomButton=null;this._shouldShowTorchControl=false;this._isTorchAvailable=false;this.onTorchButtonClickHandler=this.onTorchButtonClick.bind(this);this.onCameraSwitchButtonHandler=this.onCameraSwitchButtonClick.bind(this);this.onZoomButtonHandler=this.onZoomButtonClick.bind(this);this.onLayoutPointerDownHandler=this.onLayoutPointerDown.bind(this);this.onInfoAnnotationTapHandler=this.onInfoAnnotationTap.bind(this);this.pendingDeletionTimeout=null;}set shouldShowZoomControl(t){this.zoomButton&&(this.zoomButton.hidden=!t);}get shouldShowZoomControl(){return this.zoomButton===null?false:!this.zoomButton.hidden}set shouldShowCameraSwitchControl(t){this.cameraSwitchButton&&(this.cameraSwitchButton.hidden=!t);}get shouldShowCameraSwitchControl(){return this.cameraSwitchButton===null?false:!this.cameraSwitchButton.hidden}set shouldShowTorchControl(t){this.torchSwitchIconButton!==null&&(this._shouldShowTorchControl=t,this.torchSwitchIconButton.hidden=!(t&&this._isTorchAvailable));}get shouldShowTorchControl(){return this._shouldShowTorchControl}set torchControlPosition(t){var o;(o=this.torchSwitchIconButton)==null||o.setAttribute("slot",`controls-${t===Anchor.Center?Anchor.TopLeft:t}`);}get torchControlPosition(){var o,e;let t=(e=(o=this.torchSwitchIconButton)==null?void 0:o.getAttribute("slot"))!=null?e:"";return t===""?Anchor.TopLeft:t.replace("controls-","")}set zoomControlPosition(t){var o;(o=this.zoomButton)==null||o.setAttribute("slot",`controls-${t===Anchor.Center?Anchor.BottomRight:t}`);}get zoomControlPosition(){var o,e;let t=(e=(o=this.zoomButton)==null?void 0:o.getAttribute("slot"))!=null?e:"";return t===""?Anchor.BottomRight:t.replace("controls-","")}set cameraSwitchControlPosition(t){var o;(o=this.cameraSwitchButton)==null||o.setAttribute("slot",`controls-${t===Anchor.Center?Anchor.TopRight:t}`);}get cameraSwitchControlPosition(){var o,e;let t=(e=(o=this.zoomButton)==null?void 0:o.getAttribute("slot"))!=null?e:"";return t===""?Anchor.TopRight:t.replace("controls-","")}static async createWithSettings(t,o,e,i,n){c.register();let r=document.createElement(c.tag);return r.barcodeArViewSettings=i,r.layout=a.create(),r.append(r.layout),a$1(t)?(r.dataCaptureView=t,r.dataCaptureView.containerElement.prepend(r),await t.setContext(o)):(r.dataCaptureView=await DataCaptureView.forContext(o),r.dataCaptureView.connectToElement(t),r.dataCaptureView.containerElement.prepend(r)),r.presenter=new a$2(r,o,e,i,n!=null?n:a$3.createRecommendedCameraSettings()),await r.presenter.prepare(),r}static async create(t,o,e){return c.createWithSettings(t,o,e,new a$4)}static register(){defineCustomElements({[a.tag]:a,[a$7.tag]:a$7,[a$6.tag]:a$6,[TorchSwitchIconButton.tag]:TorchSwitchIconButton,[c.tag]:c,[Backdrop.tag]:Backdrop,[a$5.tag]:a$5});}static createStyleElement(){return css`[data-could-be-deleted=true]{display:none!important}[data-on-foreground=true]{z-index:3}${c.tag}{inset:0;position:absolute;z-index:1}`}getHighlightForBarcode(t){return this.queryHighlightByDataId(a$8(t))}getAnnotationForBarcode(t){return this.queryAnnotationByDataId(a$8(t))}async start(){return this.presenter.startSearching()}async stop(){return this.presenter.stopSearching()}async pause(){return this.presenter.pauseSearching()}reset(){this.deletePendingViews(),this.deleteAllViews();}getNotificationPresenter(){return this.dataCaptureView.getNotificationPresenter()}setTorchAvailable(t){this._isTorchAvailable=t,this.torchSwitchIconButton!==null&&(this.torchSwitchIconButton.hidden=!(this._shouldShowTorchControl&&this._isTorchAvailable));}toggleTorchIcon(t){this.torchSwitchIconButton!==null&&(this.torchSwitchIconButton.state=t);}onTorchButtonClick(){this.presenter.onTorchButtonClicked();}onCameraSwitchButtonClick(){this.presenter.onCameraSwitchButtonClicked();}onZoomButtonClick(){this.presenter.onZoomButtonClicked();}changeZoomButtonIcon(t){this.zoomButton&&(this.zoomButton.zoom=`${t}x`);}connectedCallback(){this.torchSwitchIconButton=TorchSwitchIconButton.create(),this.torchSwitchIconButton.shadow=true,this.torchSwitchIconButton.size=36,this.torchSwitchIconButton.slot=`controls-${this.torchControlPosition}`,this.torchSwitchIconButton.hidden=true,this.torchSwitchIconButton.addEventListener("pointerdown",this.onTorchButtonClickHandler),this.cameraSwitchButton=a$7.create(),this.cameraSwitchButton.slot=`controls-${this.cameraSwitchControlPosition}`,this.cameraSwitchButton.hidden=true,this.cameraSwitchButton.addEventListener("pointerdown",this.onCameraSwitchButtonHandler),this.zoomButton=a$6.create(),this.zoomButton.slot=`controls-${this.zoomControlPosition}`,this.zoomButton.hidden=true,this.zoomButton.addEventListener("pointerdown",this.onZoomButtonHandler),this.layout.append(this.torchSwitchIconButton,this.cameraSwitchButton,this.zoomButton),this.layout.addEventListener("pointerdown",this.onLayoutPointerDownHandler),this.layout.addEventListener("BarcodeArInfoAnnotationEventTap",this.onInfoAnnotationTapHandler),this.backdrop=Backdrop.create(),this.layout.append(this.backdrop),this.pendingDeletionTimeout=new Timeout(1e3,()=>{this.deletePendingViews();}),this.prepend(c.createStyleElement());}disconnectedCallback(){var t,o,e;this.deleteAllViews(),(t=this.torchSwitchIconButton)==null||t.removeEventListener("pointerdown",this.onTorchButtonClickHandler),(o=this.cameraSwitchButton)==null||o.removeEventListener("pointerdown",this.onCameraSwitchButtonHandler),(e=this.zoomButton)==null||e.removeEventListener("pointerdown",this.onZoomButtonHandler),this.layout.removeEventListener("pointerdown",this.onLayoutPointerDownHandler),this.layout.removeEventListener("BarcodeArInfoAnnotationEventTap",this.onInfoAnnotationTapHandler);}isPopoverAnnotation(t){return t instanceof b}isAnnotation(t){var o;return ((o=t.dataset)==null?void 0:o.identifier)==null?false:t.dataset.identifier.endsWith("-annotation")}areMultiplePopoverAllowed(){for(let t of this.layout.querySelectorAll("[data-identifier$='-annotation']"))if(t&&this.isPopoverAnnotation(t)&&t.annotationTrigger==="highlightTapAndBarcodeScan")return true;return false}async onLayoutPointerDown(t){let o=t.target,e=o==null?void 0:o.closest("[data-identifier$='-highlight']"),i=o==null?void 0:o.closest(b.tag);if((e==null?void 0:e.dataset.id)!=null){await this.handleHighlightClick(e);return}if((i==null?void 0:i.dataset.id)!=null){await this.handleAnnotationClick(i);return}await this.handleClickOutside();}async handleHighlightClick(t){var e;this.presenter.emitTappedFeedback(),(e=this.listener)==null||e.didTapHighlightForBarcode(this.presenter.barcodeAr,t.barcode,t);let o=this.queryAnnotationByDataIdentifier(t.dataset.identifier.replace("-highlight",""));!o||o.annotationTrigger==="barcodeScan"||(this.isPopoverAnnotation(o)?await this.handlePopoverHighlightClick(o,t):o.hidden=!o.hidden);}async handlePopoverHighlightClick(t,o){var e;if(!this.areMultiplePopoverAllowed()){let i=this.layout.querySelector(`${b.tag}[data-on-foreground="true"]`),n=(e=i==null?void 0:i.dataset.identifier)==null?void 0:e.replace("-annotation","-highlight"),r=this.layout.querySelector(`[data-identifier="${n}"]`);i!=null&&r!=null&&await this.hideBarcodeArPopover(i,r,false);}await this.toggleBarcodeArPopover(t,o);}async handleAnnotationClick(t){var i;let o=(i=t.dataset.identifier)==null?void 0:i.replace("-annotation","-highlight"),e=this.layout.querySelector(`[data-identifier="${o}"]`);e&&await this.toggleBarcodeArPopover(t,e);}async handleClickOutside(){var i;if(this.areMultiplePopoverAllowed())return;let t=this.layout.querySelector(`${b.tag}[data-on-foreground="true"]`);if(!t)return;let o=(i=t.dataset.identifier)==null?void 0:i.replace("-annotation","-highlight"),e=this.layout.querySelector(`[data-identifier="${o}"]`);e&&await this.hideBarcodeArPopover(t,e);}onInfoAnnotationTap(){this.presenter.emitTappedFeedback();}async showBarcodeArPopover(t,o){t.dataset.onForeground="true",t.hidden=false,o.dataset.onForeground="true",this.backdrop.open=true;}async hideBarcodeArPopover(t,o,e=true){t.dataset.onForeground="false",t.hidden=true,o&&(o.dataset.onForeground="false"),e&&this.hideBackdropIfNoPopovers();}hideBackdropIfNoPopovers(){[...this.layout.querySelectorAll(`${b.tag}`)].every(o=>o.hidden)&&(this.backdrop.open=false);}async toggleBarcodeArPopover(t,o){t.hidden?await this.showBarcodeArPopover(t,o):await this.hideBarcodeArPopover(t,o);}deleteAllViews(){for(let t of this.layout.querySelectorAll("[data-identifier]"))t.remove();}deletePendingViews(){for(let t of this.layout.querySelectorAll("[data-could-be-deleted='true']"))t.remove();this.hideBackdropIfNoPopovers();}identifierForHighlight(t){return `${t}-highlight`}identifierForAnnotation(t){return `${t}-annotation`}async onHighlightsOrAnnotationForTrackedBarcode(t){var o,e,i;await((e=(o=this.highlightProvider)!=null?o:W)==null?void 0:e.highlightForBarcode(t.barcode,async n=>this.onHighlight(t,n))),await((i=this.annotationProvider)==null?void 0:i.annotationForBarcode(t.barcode,async n=>this.onAnnotation(t,n)));}async onAnnotation(t,o){let e=o,i=a$8(t.barcode);this.updateExistingAnnotation(i)||(await this.setupNewAnnotation(e,i,t),this.updateAnnotationPosition(t,e));}updateExistingAnnotation(t){let o=this.queryAnnotationByDataId(t);return o?(o.dataset.couldBeDeleted="false",true):false}async setupNewAnnotation(t,o,e){if(t.dataset.id=o,t.dataset.identifier=this.identifierForAnnotation(e.identifier),t.hidden=true,this.layout.append(t),this.isPopoverAnnotation(t)){if(t.direction=Direction.Vertical,t.anchor==null&&(t.anchor="bottom-center"),this.areMultiplePopoverAllowed()||t.annotationTrigger==="highlightTapAndBarcodeScan"){let i=this.queryHighlightByDataId(o);i&&await this.showBarcodeArPopover(t,i);}}else t.hidden=t.annotationTrigger==="highlightTap";}getAnnotationVariationForQuad(t,o){let e=Math.max(0,Math.min(1,o)),i=t.anchorPositions,n=calculateArea(i),r=this.dataCaptureView.width,l=this.dataCaptureView.height,d=r*l;if(n<=0||d<=0)return 0;let u=n/d;return Math.max(0,Math.min(1,u))<=e?2:1}async onHighlight(t,o){let e=a$8(t.barcode),i=this.queryHighlightByDataId(e);i?i.dataset.couldBeDeleted="false":(o.dataset.id=e,o.dataset.identifier=this.identifierForHighlight(t.identifier),this.updateHighlightPosition(t,o),this.layout.append(o));}queryHighlightByDataIdentifier(t){return this.layout.querySelector(`[data-identifier$="${t}-highlight"]`)}queryAnnotationByDataIdentifier(t){return this.layout.querySelector(`[data-identifier$="${t}-annotation"]`)}queryHighlightByDataId(t){return this.layout.querySelector(`[data-identifier$="-highlight"][data-id="${t}"]`)}queryAnnotationByDataId(t){return this.layout.querySelector(`[data-identifier$="-annotation"][data-id="${t}"]`)}updateRemovedTrackedBarcodes(t){var i,n,r,l,d;let o=this.querySelectorAll("[data-identifier]");if(Object.keys(t.allTrackedBarcodes).length===0){for(let u of o)u.dataset.couldBeDeleted="true";(i=this.pendingDeletionTimeout)!=null&&i.running||(n=this.pendingDeletionTimeout)==null||n.start();return}let e=new Set(t.removedTrackedBarcodes);for(let u of o){let p=(r=u.dataset.identifier)==null?void 0:r.replace("-highlight","").replace("-annotation","");p!=null&&e.has(p)&&(u.dataset.couldBeDeleted="true");}(l=this.pendingDeletionTimeout)!=null&&l.running||(d=this.pendingDeletionTimeout)==null||d.start();}render(t){for(let[o,e]of Object.entries(t.allTrackedBarcodes)){t.addedTrackedBarcodes[o]!=null&&this.onHighlightsOrAnnotationForTrackedBarcode(e);let i=a$8(e.barcode),n=this.queryAnnotationByDataId(i),r=this.queryHighlightByDataId(i);r&&(this.updateBrushSize(r,e),this.updateHighlightPosition(e,r)),n&&this.updateAnnotationPosition(e,n,r);}this.updateRemovedTrackedBarcodes(t);}updateHighlightPosition(t,o,e="center"){if(o.hidden)return;let i=this.dataCaptureView.viewAnchorPositionsForFrameAnchorPositions(t.anchorPositions),n=this.normalizedViewPointFromFrameAnchorPositions(i,e);o.updatePosition(n,new Point(-50,-50),this.calculateRotationAngle(i.topLeft,i.topRight));}updateBrushSize(t,o){if(t.width==null||t.height==null)return;let e=this.dataCaptureView.viewAnchorPositionsForFrameAnchorPositions(o.anchorPositions),i=Math.round(calculateWidth(e)),n=Math.round(calculateHeight(e));t.width!==i&&(t.width=i),t.height!==n&&(t.height=n);}getTransformOrigin(t){return {"top-center":new Point(-50,0),"bottom-center":new Point(-50,-100),"left-center":new Point(0,-50),"right-center":new Point(-100,-50)}[t]}calculateAnnotationPosition(t,o,e){var p,f;let n=t.orderVerticesByPosition(),r=this.normalizedViewPointFromFrameAnchorPositions(t,"center"),d={"bottom-center":()=>{let s=this.normalizedViewPointFromFrameAnchorPositions(n,"topCenter");return new Point(s.x,s.y-7)},"top-center":()=>{let s=this.normalizedViewPointFromFrameAnchorPositions(n,"bottomCenter");return new Point(s.x,s.y+7)},"right-center":()=>{let s=this.normalizedViewPointFromFrameAnchorPositions(n,"centerLeft");return new Point(s.x-7,s.y)},"left-center":()=>{let s=this.normalizedViewPointFromFrameAnchorPositions(n,"centerRight");return new Point(s.x+7,s.y)}}[o]();return e?e instanceof b$1?(p={"bottom-center":new Point(r.x,r.y-7-e.clientHeight/2),"top-center":new Point(r.x,r.y+7+e.clientHeight/2),"right-center":new Point(r.x-7-e.clientWidth/2,r.y),"left-center":new Point(r.x+7+e.clientWidth/2,r.y)}[o])!=null?p:d:(f={"bottom-center":new Point(r.x,r.y-7-e.clientHeight/2),"top-center":new Point(r.x,r.y+7+e.clientHeight/2),"right-center":new Point(r.x-7-e.clientWidth/2,r.y),"left-center":new Point(r.x+7+e.clientWidth/2,r.y)}[o])!=null?f:d:d}updateAnnotationPosition(t,o,e){let i=this.dataCaptureView.viewAnchorPositionsForFrameAnchorPositions(t.anchorPositions);if(o.anchor||(o.anchor="top-center"),o.annotationVariation!=null){let l=this.getAnnotationVariationForQuad(t,a$5.threshold);o.annotationVariation=l;}let n=this.getTransformOrigin(o.anchor),r=this.calculateAnnotationPosition(i,o.anchor,e);o.updatePosition(r,n,this.calculateRotationAngle(i.topLeft,i.topRight));}normalizedViewPointFromFrameAnchorPositions(t,o="center"){let e=this.presenter.currentCamera.getMirrorImageEnabled(),i=new Size(this.dataCaptureView.width,this.dataCaptureView.height);if(e){let r=t[{centerLeft:"centerRight",centerRight:"centerLeft",center:"center",topCenter:"topCenter",bottomCenter:"bottomCenter"}[o]];return Point.mirrorX(r,i)}return t[o]}calculateRotationAngle(t,o){let e=o.x-t.x,n=this.presenter.isCameraMirrored()?-(o.y-t.y):o.y-t.y,r=Math.atan2(n,e);return Math.round(r*(180/Math.PI))}};c.tag="scandit-barcode-ar-view";var k=c;export{k as a};
@@ -1,2 +1,2 @@
1
- import {a as a$1,b as b$2}from'./chunk-OPL5NVVM.js';import {b as b$1}from'./chunk-NZCSU4S2.js';import {b}from'./chunk-LGPC7KMW.js';import {a as a$2}from'./chunk-T2Y2C76P.js';import {e,f as f$1,a,b as b$3,d,c as c$1}from'./chunk-DVHTYKDX.js';import {f}from'./chunk-YBD5JYCX.js';import {Point}from'@scandit/web-datacapture-core';import {ScanditHTMLElement,defineCustomElements,safeCancelAnimation,html}from'@scandit/web-datacapture-core/build/js/private/utils/index.js';var c=class b$4 extends ScanditHTMLElement{constructor(){super(...arguments);this._pointerDownListener=this.onPointerDown.bind(this);this._pointerUpListener=this.onPointerUp.bind(this);this._longPressController=new b(this);this._longPressStartListener=this.onLongPressStart.bind(this);}get minimized(){return !this.hasAttribute("expanded")}set minimized(t){this.toggleAttribute("minimized",!t);}get expanded(){return this.hasAttribute("expanded")}set expanded(t){this.toggleAttribute("expanded",t),this._dragController&&(this._dragController.margin=t?new Point(-65,-65):new Point(0,0),this._dragController.repositionIfOutOfBounds());}get pressed(){return this.hasAttribute("pressed")}set pressed(t){this.toggleAttribute("pressed",t);}get visible(){return this.hasAttribute("visible")}set visible(t){this.toggleAttribute("visible",t);}set useViewportBounds(t){this._dragController&&(this._dragController.useViewportBounds=t);}static create(){return defineCustomElements({[f]:b$4}),document.createElement(f)}connectedCallback(){var t;this.render(),this._dragController=new b$1(this,(t=this.parentElement)==null?void 0:t.parentElement),this._dragController.connect(),this.addEventListener("pointerdown",this._pointerDownListener),this.addEventListener("pointerup",this._pointerUpListener),this.addEventListener("longpressstart",this._longPressStartListener),this._longPressController.connect(),this._longPressController.elementsAllowedToTriggerLongPressEvents.add(this),this._pulse=this.querySelector(".pulse"),this._pulseAnimation=new Animation(new KeyframeEffect(this._pulse,[{background:"rgba(0, 0, 0, 0)"},{background:`var(${e})`,transform:"translate(-50%, -50%) scale(1.1)"},{background:"rgba(0, 0, 0, 0)"}],{duration:1100,easing:"ease-out",iterations:Number.POSITIVE_INFINITY}));}disconnectedCallback(){var t;this.removeEventListener("pointerdown",this._pointerDownListener),this.removeEventListener("pointerup",this._pointerUpListener),this.removeEventListener("longpressstart",this._longPressStartListener),(t=this._dragController)==null||t.disconnect(),this._longPressController.disconnect(),this.innerHTML="";}repositionIfOutOfBounds(){var t;(t=this._dragController)==null||t.repositionIfOutOfBounds();}translateTo(t){var i;(i=this._dragController)==null||i.translateTo(t,false);}setImage(t){var n;let i=this.querySelector("div");(n=i.firstElementChild)==null||n.remove(),t&&i.append(t);}startPulsating(){var t;(t=this._pulseAnimation)==null||t.play();}stopPulsating(){this._pulseAnimation&&(safeCancelAnimation(this._pulseAnimation),this._pulseAnimation.currentTime=0);}render(){this.innerHTML=html`<div><div class="pulse"></div><svg width="49" height="26" viewBox="0 0 49 26" fill="none" xmlns="http://www.w3.org/2000/svg"><rect x="7.57422" y="-0.00390625" width="3.20017" height="25.7171" rx="0.5" fill="white" style="fill:var(${f$1})"/><path d="M44.8418 0.496094C44.8418 0.219952 45.0657 -0.00390625 45.3418 -0.00390625H48.001C48.2771 -0.00390625 48.501 0.219951 48.501 0.496094V25.2132C48.501 25.4894 48.2771 25.7132 48.001 25.7132H45.3418C45.0657 25.7132 44.8418 25.4894 44.8418 25.2132V0.496094Z" fill="white" style="fill:var(${f$1})"/><path d="M33.8271 0.896094C33.8271 0.399038 34.2301 -0.00390625 34.7271 -0.00390625H39.1368C39.6338 -0.00390625 40.0368 0.399038 40.0368 0.896094V24.8132C40.0368 25.3103 39.6338 25.7132 39.1368 25.7132H34.7271C34.2301 25.7132 33.8271 25.3103 33.8271 24.8132V0.896094Z" fill="white" style="fill:var(${f$1})"/><path d="M16.3154 0.746095C16.3154 0.331881 16.6512 -0.00390625 17.0654 -0.00390625H20.1879C20.6021 -0.00390625 20.9379 0.33188 20.9379 0.746094V24.9632C20.9379 25.3774 20.6021 25.7132 20.1879 25.7132H17.0654C16.6512 25.7132 16.3154 25.3774 16.3154 24.9632V0.746095Z" fill="white" style="fill:var(${f$1})"/><path d="M0.5 0.246094C0.5 0.108023 0.611929 -0.00390625 0.75 -0.00390625H2.2897C2.42777 -0.00390625 2.5397 0.108023 2.5397 0.246094V25.4632C2.5397 25.6013 2.42777 25.7132 2.2897 25.7132H0.75C0.611929 25.7132 0.5 25.6013 0.5 25.4632V0.246094Z" fill="white" style="fill:var(${f$1})"/><rect x="25.9688" y="-0.00390625" width="3.05794" height="25.7171" rx="0.5" fill="white" style="fill:var(${f$1})"/></svg></div><style>${f}{position:absolute;top:0;left:0;width:90px;height:90px;display:none;background:rgba(0,0,0,0);border-radius:50%;z-index:10}${f}[unconstrained]{position:fixed;z-index:9999}${f}[expanded]{width:220px;height:220px;margin-top:-65px;margin-left:-65px}${f}[visible]{display:flex;justify-content:center;align-items:center}${f} div{position:relative;width:90px;height:90px;background:var(${a});border-radius:50%;filter:drop-shadow(0px 2px 6px #${a$1.toJSON()}) drop-shadow(0px 1px 2px #${b$2.toJSON()});transition:filter .3s ease}${f} div .pulse{position:absolute;top:50%;left:50%;width:100%;height:100%;background:0 0;opacity:.3;pointer-events:none;transform:translate(-50%,-50%);z-index:-1}${f}[pressed] div{background:var(${b$3});filter:drop-shadow(0px 4px 4px #${a$1.toJSON()}) drop-shadow(0px 8px 12px #${b$2.toJSON()})}${f}[pressed][expanded] div{background:var(${d})}${f}[expanded] div{width:200px;height:200px;background:var(${c$1})}${f} div img,${f} div svg{position:absolute;top:50%;left:50%;width:100%;height:auto;max-width:48px;max-height:48px;transform:translate(-50%,-50%)}${f}[expanded] div img,${f}[expanded] div svg{max-width:64px;max-height:64px}</style>`;}onPointerDown(t){t instanceof PointerEvent&&(this._dragController&&(this._dragController.draggable=this.minimized),this._holdStart=Date.now(),this.setPointerCapture(t.pointerId));}onPointerUp(t){var i;if(t instanceof PointerEvent){let n=this._holdStart!=null&&Date.now()-this._holdStart<400,f=!((i=this._dragController)!=null&&i.pointerDownEvent)||!a$2(this._dragController.pointerDownEvent,t);n&&f&&this.dispatchEvent(new CustomEvent("tap")),this.pressed=false,this._holdStart=void 0,this.releasePointerCapture(t.pointerId);}}onLongPressStart(){this._dragController&&(this._dragController.draggable=true),this.pressed=true,this._holdStart=void 0;}};
1
+ import {b}from'./chunk-LGPC7KMW.js';import {a as a$1,b as b$3}from'./chunk-OPL5NVVM.js';import {b as b$1}from'./chunk-NZCSU4S2.js';import {a as a$2}from'./chunk-T2Y2C76P.js';import {e,f as f$1,a,b as b$2,d,c as c$1}from'./chunk-DVHTYKDX.js';import {f}from'./chunk-YBD5JYCX.js';import {Point}from'@scandit/web-datacapture-core';import {ScanditHTMLElement,defineCustomElements,safeCancelAnimation,html}from'@scandit/web-datacapture-core/build/js/private/utils/index.js';var c=class b$4 extends ScanditHTMLElement{constructor(){super(...arguments);this._pointerDownListener=this.onPointerDown.bind(this);this._pointerUpListener=this.onPointerUp.bind(this);this._longPressController=new b(this);this._longPressStartListener=this.onLongPressStart.bind(this);}get minimized(){return !this.hasAttribute("expanded")}set minimized(t){this.toggleAttribute("minimized",!t);}get expanded(){return this.hasAttribute("expanded")}set expanded(t){this.toggleAttribute("expanded",t),this._dragController&&(this._dragController.margin=t?new Point(-65,-65):new Point(0,0),this._dragController.repositionIfOutOfBounds());}get pressed(){return this.hasAttribute("pressed")}set pressed(t){this.toggleAttribute("pressed",t);}get visible(){return this.hasAttribute("visible")}set visible(t){this.toggleAttribute("visible",t);}set useViewportBounds(t){this._dragController&&(this._dragController.useViewportBounds=t);}static create(){return defineCustomElements({[f]:b$4}),document.createElement(f)}connectedCallback(){var t;this.render(),this._dragController=new b$1(this,(t=this.parentElement)==null?void 0:t.parentElement),this._dragController.connect(),this.addEventListener("pointerdown",this._pointerDownListener),this.addEventListener("pointerup",this._pointerUpListener),this.addEventListener("longpressstart",this._longPressStartListener),this._longPressController.connect(),this._longPressController.elementsAllowedToTriggerLongPressEvents.add(this),this._pulse=this.querySelector(".pulse"),this._pulseAnimation=new Animation(new KeyframeEffect(this._pulse,[{background:"rgba(0, 0, 0, 0)"},{background:`var(${e})`,transform:"translate(-50%, -50%) scale(1.1)"},{background:"rgba(0, 0, 0, 0)"}],{duration:1100,easing:"ease-out",iterations:Number.POSITIVE_INFINITY}));}disconnectedCallback(){var t;this.removeEventListener("pointerdown",this._pointerDownListener),this.removeEventListener("pointerup",this._pointerUpListener),this.removeEventListener("longpressstart",this._longPressStartListener),(t=this._dragController)==null||t.disconnect(),this._longPressController.disconnect(),this.innerHTML="";}repositionIfOutOfBounds(){var t;(t=this._dragController)==null||t.repositionIfOutOfBounds();}translateTo(t){var i;(i=this._dragController)==null||i.translateTo(t,false);}setImage(t){var n;let i=this.querySelector("div");(n=i.firstElementChild)==null||n.remove(),t&&i.append(t);}startPulsating(){var t;(t=this._pulseAnimation)==null||t.play();}stopPulsating(){this._pulseAnimation&&(safeCancelAnimation(this._pulseAnimation),this._pulseAnimation.currentTime=0);}render(){this.innerHTML=html`<div><div class="pulse"></div><svg width="49" height="26" viewBox="0 0 49 26" fill="none" xmlns="http://www.w3.org/2000/svg"><rect x="7.57422" y="-0.00390625" width="3.20017" height="25.7171" rx="0.5" fill="white" style="fill:var(${f$1})"/><path d="M44.8418 0.496094C44.8418 0.219952 45.0657 -0.00390625 45.3418 -0.00390625H48.001C48.2771 -0.00390625 48.501 0.219951 48.501 0.496094V25.2132C48.501 25.4894 48.2771 25.7132 48.001 25.7132H45.3418C45.0657 25.7132 44.8418 25.4894 44.8418 25.2132V0.496094Z" fill="white" style="fill:var(${f$1})"/><path d="M33.8271 0.896094C33.8271 0.399038 34.2301 -0.00390625 34.7271 -0.00390625H39.1368C39.6338 -0.00390625 40.0368 0.399038 40.0368 0.896094V24.8132C40.0368 25.3103 39.6338 25.7132 39.1368 25.7132H34.7271C34.2301 25.7132 33.8271 25.3103 33.8271 24.8132V0.896094Z" fill="white" style="fill:var(${f$1})"/><path d="M16.3154 0.746095C16.3154 0.331881 16.6512 -0.00390625 17.0654 -0.00390625H20.1879C20.6021 -0.00390625 20.9379 0.33188 20.9379 0.746094V24.9632C20.9379 25.3774 20.6021 25.7132 20.1879 25.7132H17.0654C16.6512 25.7132 16.3154 25.3774 16.3154 24.9632V0.746095Z" fill="white" style="fill:var(${f$1})"/><path d="M0.5 0.246094C0.5 0.108023 0.611929 -0.00390625 0.75 -0.00390625H2.2897C2.42777 -0.00390625 2.5397 0.108023 2.5397 0.246094V25.4632C2.5397 25.6013 2.42777 25.7132 2.2897 25.7132H0.75C0.611929 25.7132 0.5 25.6013 0.5 25.4632V0.246094Z" fill="white" style="fill:var(${f$1})"/><rect x="25.9688" y="-0.00390625" width="3.05794" height="25.7171" rx="0.5" fill="white" style="fill:var(${f$1})"/></svg></div><style>${f}{position:absolute;top:0;left:0;width:90px;height:90px;display:none;background:rgba(0,0,0,0);border-radius:50%;z-index:10}${f}[unconstrained]{position:fixed;z-index:9999}${f}[expanded]{width:220px;height:220px;margin-top:-65px;margin-left:-65px}${f}[visible]{display:flex;justify-content:center;align-items:center}${f} div{position:relative;width:90px;height:90px;background:var(${a});border-radius:50%;filter:drop-shadow(0px 2px 6px #${a$1.toJSON()}) drop-shadow(0px 1px 2px #${b$3.toJSON()});transition:filter .3s ease}${f} div .pulse{position:absolute;top:50%;left:50%;width:100%;height:100%;background:0 0;opacity:.3;pointer-events:none;transform:translate(-50%,-50%);z-index:-1}${f}[pressed] div{background:var(${b$2});filter:drop-shadow(0px 4px 4px #${a$1.toJSON()}) drop-shadow(0px 8px 12px #${b$3.toJSON()})}${f}[pressed][expanded] div{background:var(${d})}${f}[expanded] div{width:200px;height:200px;background:var(${c$1})}${f} div img,${f} div svg{position:absolute;top:50%;left:50%;width:100%;height:auto;max-width:48px;max-height:48px;transform:translate(-50%,-50%)}${f}[expanded] div img,${f}[expanded] div svg{max-width:64px;max-height:64px}</style>`;}onPointerDown(t){t instanceof PointerEvent&&(this._dragController&&(this._dragController.draggable=this.minimized),this._holdStart=Date.now(),this.setPointerCapture(t.pointerId));}onPointerUp(t){var i;if(t instanceof PointerEvent){let n=this._holdStart!=null&&Date.now()-this._holdStart<400,f=!((i=this._dragController)!=null&&i.pointerDownEvent)||!a$2(this._dragController.pointerDownEvent,t);n&&f&&this.dispatchEvent(new CustomEvent("tap")),this.pressed=false,this._holdStart=void 0,this.releasePointerCapture(t.pointerId);}}onLongPressStart(){this._dragController&&(this._dragController.draggable=true),this.pressed=true,this._holdStart=void 0;}};
2
2
  export{c as a};
@@ -0,0 +1,2 @@
1
+ import {DataCaptureLoader,Logger}from'@scandit/web-datacapture-core';function d(r){let n=URL.createObjectURL(new Blob(['"use strict";(()=>{var u={"scandit-datacapture-sdk-barcode-pthreads.wasm":{bytes:8225377},"scandit-datacapture-sdk-barcode-simd-pthreads.wasm":{bytes:8116647},"scandit-datacapture-sdk-barcode.wasm":{bytes:8088927},"scandit-datacapture-sdk-barcode-simd.wasm":{bytes:7979742}};function C(t){return typeof t=="object"&&t!=null}function k(t){if(typeof t=="string")return t;if(C(t)){if(typeof t.message=="string")return t.message}else if(typeof(t==null?void 0:t.toString)=="function")return t.toString();return"unknown error"}var d;(t=>{(l=>(l.Debug="debug",l.Info="info",l.Warn="warn",l.Error="error",l.Quiet="quiet"))(t.Level||(t.Level={}));let e=new Map([["debug",1],["info",2],["warn",3],["error",4],["quiet",5]]),r="debug";function a(l){r=l}t.setLevel=a;function i(l,...h){if(!(e.get(r)>e.get(l)))switch(l){case"debug":{console.debug(...h);break}case"info":{console.log(...h);break}case"warn":{console.warn(...h);break}case"error":{console.error(...h);break}}}t.log=i;function n(...l){i("warn",...l)}t.warn=n;function o(...l){i("debug",...l)}t.debug=o;function s(...l){i("info",...l)}t.info=s;function c(...l){i("error",...l)}t.error=c})(d||(d={}));var Re=class{constructor(t){if(typeof t!="function")throw new TypeError("FinalizationRegistry callback must be a function")}register(t,e,r){}unregister(t){return!1}};function ae(t){typeof t.FinalizationRegistry>"u"&&(t.FinalizationRegistry=Re)}function ie(t,e,r){let a=e*r,i=new Uint8ClampedArray(a*4),n=new Uint32Array(i.buffer);for(let o=0;o<a;o++){let s=t[o];n[o]=4278190080|s<<16|s<<8|s}return i}var x=class ne extends Error{constructor(e){super(e.message),Object.setPrototypeOf(this,ne.prototype),this.name=e.name}toString(){return`${this.name}: ${this.message}`}};var D=Promise.resolve(),q=!1,G=!1,T=!1,v,Y=1500,j="";async function se(t){if(v==null)return;q=!0;let e;try{let r=new Promise((i,n)=>{e=setTimeout(()=>{d.debug(`IndexedDB database is blocked (timed out after ${Y}ms). If you are running a Debug wasm build, things are slower and the timeout can be configured via IndexedDBBlockedTimeoutMs in localStorage (requires page reload).`),n(new x({name:"BlockedIndexedDB",message:"IndexedDB database is blocked"}))},Y)}),a=new Promise((i,n)=>{v==null||v(t,o=>{o!=null?n(o):i()})});await Promise.race([a,r])}finally{e!==void 0&&clearTimeout(e),q=!1}}async function oe(t){return G?(T=t,D):(q?(G=!0,T=t,D=D.then(async()=>(G=!1,se(T)))):(T=t,D=se(t)),D)}function Ee(){FS.syncfs=((t,e)=>{oe(t).then(()=>e(),r=>e(r))})}async function de(t){if(j=t.writableDataPath,Y=t.indexedDBTimeoutMs,v=FS.syncfs,v==null)throw new Error("FS.syncfs is not available");Ee();try{FS.mkdir(j)}catch(e){if(e.code!=="EEXIST")throw v=void 0,e}try{FS.mount(IDBFS,{},j)}catch(e){throw v=void 0,e}return oe(!0)}var ce={};function Le(t){return[...new Uint8Array(t)].map(e=>{let r=e.toString(16);return r.length===1?`0${r}`:r}).join("")}async function*We(t){let e=t.getReader();try{for(;;){let{done:r,value:a}=await e.read();if(r)return;yield a}}finally{e.releaseLock()}}async function Ne(t){let e=[],r=0,a=0;for await(let n of We(t))e.push(n),r+=n.length;let i=new Uint8Array(r);for(let n of e)i.set(n,a),a+=n.length;return i.buffer}var He=(t=>(t.VALID="VALID",t.INVALID="INVALID",t.NOT_VERIFIABLE="NOT_VERIFIABLE",t))(He||{});async function _e(t,e,r){if(typeof crypto.subtle.digest!="function")return d.log(d.Level.Warn,`Insecure context (see https://developer.mozilla.org/en-US/docs/Web/Security/Secure_Contexts): The hash of the Scandit Data Capture library WASM file found at ${r} could not be verified`),"NOT_VERIFIABLE";try{let a=t instanceof Promise?await t:t,i=await crypto.subtle.digest("SHA-256",a),n=Le(i);return e==null?(d.log(d.Level.Warn,"The library hash is not defined or empty, cannot correctly verify integrity."),"NOT_VERIFIABLE"):n===e?(d.log(d.Level.Debug,`Data Capture library WASM integrity found at ${r} has been verified correctly.`),"VALID"):(d.log(d.Level.Warn,`The Scandit Data Capture library WASM file found at ${r} seems invalid: expected file hash doesn\'t match (received: ${n}, expected: ${e}). Please ensure the correct Scandit Data Capture file (with correct version) is retrieved.`),"INVALID")}catch(a){return d.log(d.Level.Warn,"Wasm response could not be verified",a),"NOT_VERIFIABLE"}}var X=new Map([["br",4.4],["gzip",2.9],["none",1]]);function ze(t){var e;let r="content-encoding";if(t==null||t.get(r)==null)return X.get("none");let a=new Set(((e=t.get(r))!=null?e:"").split(",").map(i=>i.trim()));for(let[i,n]of X)if(a.has(i))return n;return X.get("none")}function Ve(t){var e,r;if(t==null)return 0;let a=(e=ze(t))!=null?e:1,i=Number.parseInt((r=t.get("content-length"))!=null?r:"0",10);return Number.isNaN(i)?0:Math.floor(i*a*100)/100}function Je(t){let{pathname:e}=new URL(t);for(let[r,a]of Object.entries(ce))if(e.endsWith(r))return a.bytes;return 0}function le(t){ce=t}var Ue=(t,e)=>{let r=Ve(e);return r===0?Je(t):r};function $e(t,e,r,{onProgress:a,onError:i,onComplete:n}){if(!e.body)return[e];let o=Ue(t,e.headers),s=0,c=0;if(typeof TransformStream>"u")return d.warn("TransformStream is not supported in this environment. Progress tracking will be disabled."),[e];let[l,h]=r?e.body.tee():[e.body],m=l.pipeThrough(new TransformStream({async transform(g,f){try{s+=g.length,c=Number((s/o*100).toFixed(2)),o>0&&g.length>0&&c<100?a==null||a({percentage:c,loadedBytes:s,privateUri:t}):o===0&&g.length>0&&(a==null||a({percentage:null,loadedBytes:s,privateUri:t})),f.enqueue(g)}catch(b){f.error(b),i==null||i({error:b})}},flush(g){a==null||a({percentage:100,loadedBytes:s,privateUri:t}),n==null||n({percentage:100,loadedBytes:s,privateUri:t}),g.terminate()}}));return[new Response(m,{headers:new Headers(e.headers),status:e.status,statusText:e.statusText}),h]}async function K({wasmURI:t,expectedHash:e,verifyResponseHash:r,onProgress:a,onComplete:i,onError:n,referredOrigin:o}){let s=await fetch(t,{referrerPolicy:"origin",referrer:o!=null?o:""});if(!s.ok)throw new Error(`HTTP status code is not ok: ${s.status}, ${s.statusText}`);let[c,l]=$e(t,s,r,{onProgress:a,onError:n,onComplete:i});return l!=null&&_e(Ne(l),e,t),c}function ue({wasmURI:t,expectedHash:e,verifyResponseHash:r,progressCallback:a,successCallback:i,errorCallback:n,importObject:o,referredOrigin:s}){async function c(h){try{let m=await K({wasmURI:t,expectedHash:e,verifyResponseHash:r,onProgress:a,referredOrigin:s}),g=await(h!=null?h:m).arrayBuffer(),f=await self.WebAssembly.instantiate(g,o);i(f.instance,f.module)}catch(m){d.log(d.Level.Error,m),d.log(d.Level.Error,`Couldn\'t instantiate Scandit SDK DataCapture library at ${t}, did you configure the path for it correctly?`),n==null||n(m)}}async function l(){let h;try{h=await K({wasmURI:t,expectedHash:e,verifyResponseHash:r,onProgress:a,referredOrigin:s});let m=await self.WebAssembly.instantiateStreaming(h,o);i(m.instance,m.module)}catch(m){d.log(d.Level.Warn,m),d.log(d.Level.Warn,"WebAssembly streaming compile failed. Falling back to ArrayBuffer instantiation (this will make things slower)"),c((h==null?void 0:h.bodyUsed)===!0?void 0:h)}}typeof self.WebAssembly.instantiateStreaming=="function"?l():c()}async function Z(t,e,r,a){return new Promise((i,n)=>{t().then(i).catch(o=>{let s=e*2;if(s>r){n(o);return}a(o),self.setTimeout(()=>{Z(t,s,r,a).then(i).catch(n)},e)})})}function Q(t){var e,r;let a="unknown";if((e=t.href)!=null&&e.startsWith("blob:null/"))a="localhost";else{let i=((r=t.pathname)==null?void 0:r.length)>1&&!t.pathname.startsWith("/");a=new URL(i?t.pathname:t.origin).hostname}return a.startsWith("[")&&a.endsWith("]")?(a=a.slice(1,-1),a):(/^(\\d{1,3}\\.){3}\\d{1,3}$/.test(a)&&(a=a.split(".").map(i=>Number.parseInt(i,10).toString()).join(".")),a)}async function pe(t,e){async function r(){return importScripts(t)}try{await Z(r,250,4e3,i=>{d.log(d.Level.Warn,i),d.log(d.Level.Warn,`Couldn\'t retrieve Scandit Data Capture library at ${t}, retrying...`)}),self.Module.mainScriptUrlOrBlob=t;let a=self.SDC_WASM_JS_VERSION;return a!==e&&d.log(d.Level.Warn,`The Scandit Data Capture library JS file found at ${t} seems invalid: expected version doesn\'t match (received: ${a}, expected: ${e}). Please ensure the correct Scandit Data Capture file (with correct version) is retrieved.`),!0}catch(a){return d.log(d.Level.Error,a),!1}}var A=class{constructor(){this.promise=new Promise((t,e)=>{this.reject=e,this.resolve=t})}};var ee=class{constructor(t,e){this.workerFunctions=t,this.options=e,this.imageIdCounter=0,this.conversions=new Map}convertToJpeg(t,e){let r=this.imageIdCounter++,a=new A;this.conversions.set(r,a);let i=t.toBitmap();return this.workerFunctions.postMessage({type:"convertToJPEG",imageId:r,width:t.getWidth(),height:t.getHeight(),data:i,planes:t.getPlanes(),orientation:e,quality:this.options.quality},Array.from(new Set([i.buffer]))),a.promise}convertToBitmap(t){return{data:t.toBitmap(),byteOrder:1}}onConvertToJPEGResult(t,e){let r=this.conversions.get(t);r?(r.resolve(e),this.conversions.delete(t)):d.warn(`ImageConverterForwarder: Conversion for imageId ${t} not found in Map`)}};var O=class{constructor(t){this.options=t}get quality(){return this.options.quality}async convertToJpeg(t,e){try{let{width:r,height:a,planes:i}=this.validateAndExtractImageData(t);this.prepareCanvas(r,a);let n=this.processImageData(t,i,r,a);return await this.convertToJpegBytes(n,e)}catch(r){throw d.warn(`Failed to convert image to JPEG: ${r}`),r instanceof Error?r:new Error("Failed to convert image to JPEG")}}convertToBitmap(t){return{data:t.toBitmap(),byteOrder:1}}validateAndExtractImageData(t){let e=t.getWidth(),r=t.getHeight(),a=t.getPlanes();if(e<=0||r<=0)throw d.warn(`Invalid image dimensions: ${e}x${r}`),new Error(`Invalid image dimensions: ${e}x${r}`);if(!a||a.length===0)throw d.warn("ImageBuffer has no planes"),new Error("ImageBuffer has no planes");return{width:e,height:r,planes:a}}prepareCanvas(t,e){if(!this.ensureCanvas(t,e))throw new Error("Failed to create OffscreenCanvas");if(!this.canvas||!this.context)throw new Error("Canvas or context not properly initialized")}processImageData(t,e,r,a){let i=this.createImageDataFromBuffer(t,e,r,a);if(i===null)throw new Error("Failed to create ImageData");return this.validateImageData(i,r,a),i}validateImageData(t,e,r){var a;if(t.width!==e||t.height!==r)throw d.warn(`ImageData dimensions mismatch: expected ${e}x${r}, got ${t.width}x${t.height}`),new Error("ImageData dimensions mismatch");if(!t.data||t.data.length!==e*r*4)throw d.warn(`ImageData has invalid data length: expected ${e*r*4}, got ${((a=t.data)==null?void 0:a.length)||0}`),new Error("ImageData has invalid data length")}async convertToJpegBytes(t,e){if(!this.context||!this.canvas)throw new Error("Canvas or context not available");try{this.context.putImageData(t,0,0)}catch(n){throw d.warn(`Failed to put image data on canvas: ${n}`),new Error(`Failed to put image data on canvas: ${n}`)}let r=e!==0?this.applyRotation(this.canvas,e):this.canvas,a;try{a=await this.canvasToBlob(r)}catch(n){throw d.warn(`Failed to convert canvas to blob: ${n}`),new Error(`Failed to convert canvas to blob: ${n}`)}if(!a||a.size===0)throw d.warn("Canvas convertToBlob returned empty or null blob"),new Error("Failed to create JPEG blob");let i;try{i=await a.arrayBuffer()}catch(n){throw d.warn(`Failed to get array buffer from blob: ${n}`),new Error(`Failed to get array buffer from blob: ${n}`)}if(!i||i.byteLength===0)throw d.warn("Blob arrayBuffer returned empty or null buffer"),new Error("Failed to get array buffer from blob");return new Uint8Array(i)}ensureCanvas(t,e){try{return(!this.canvas||this.canvas.width!==t||this.canvas.height!==e)&&(this.canvas=this.getNewCanvas(t,e),this.context=this.canvas.getContext("2d")),this.context!==null}catch(r){return d.warn("Failed to create HTMLCanvasElement",r),!1}}createImageDataFromBuffer(t,e,r,a){let i=new Set(e.map(n=>n.channel));try{if(this.isYUVFormat(i)){let s=t.toBitmap();return!s||s.length!==r*a*4?(d.warn(`Invalid bitmap data from toBitmap(): expected ${r*a*4} bytes, got ${(s==null?void 0:s.length)||0}`),null):new ImageData(new Uint8ClampedArray(s),r,a)}if(this.isRGBAFormat(i))return this.createImageDataFromRGBAPlanes(e,r,a);if(this.isRGBFormat(i))return this.createImageDataFromRGBPlanes(e,r,a);if(this.isGrayscaleFormat(i))return this.createImageDataFromGrayscalePlanes(e,r,a);d.warn(`Unknown image format with channels: ${Array.from(i).join(", ")}, falling back to toBitmap()`);let n=t.toBitmap();if(!n||n.length===0)return d.warn("toBitmap() returned empty or null data"),null;let o=n.length/(r*a);return o===4?new ImageData(new Uint8ClampedArray(n),r,a):(d.warn(`Unsupported format: ${o} bytes per pixel`),null)}catch(n){return d.warn(`Failed to create ImageData: ${n}`),null}}isYUVFormat(t){return t.has(0)&&t.has(1)&&t.has(2)}isRGBAFormat(t){return t.has(3)&&t.has(4)&&t.has(5)&&t.has(6)}isRGBFormat(t){return t.has(3)&&t.has(4)&&t.has(5)&&!t.has(6)}isGrayscaleFormat(t){return t.has(0)&&!t.has(1)&&!t.has(2)}createImageDataFromRGBAPlanes(t,e,r){let a=t.find(c=>c.channel===3),i=t.find(c=>c.channel===4),n=t.find(c=>c.channel===5),o=t.find(c=>c.channel===6);if(!a||!i||!n||!o)return d.warn("Missing RGBA planes"),null;let s=new Uint8ClampedArray(e*r*4);for(let c=0;c<r;c++)for(let l=0;l<e;l++){let h=(c*e+l)*4;s[h]=this.getPixelFromPlane(a,l,c),s[h+1]=this.getPixelFromPlane(i,l,c),s[h+2]=this.getPixelFromPlane(n,l,c),s[h+3]=this.getPixelFromPlane(o,l,c)}return new ImageData(s,e,r)}createImageDataFromRGBPlanes(t,e,r){let a=t.find(s=>s.channel===3),i=t.find(s=>s.channel===4),n=t.find(s=>s.channel===5);if(!a||!i||!n)return d.warn("Missing RGB planes"),null;let o=new Uint8ClampedArray(e*r*4);for(let s=0;s<r;s++)for(let c=0;c<e;c++){let l=(s*e+c)*4;o[l]=this.getPixelFromPlane(a,c,s),o[l+1]=this.getPixelFromPlane(i,c,s),o[l+2]=this.getPixelFromPlane(n,c,s),o[l+3]=255}return new ImageData(o,e,r)}createImageDataFromGrayscalePlanes(t,e,r){let a=t.find(n=>n.channel===0);if(!a)return d.warn("Missing Y plane for grayscale"),null;let i=new Uint8ClampedArray(e*r*4);for(let n=0;n<r;n++)for(let o=0;o<e;o++){let s=(n*e+o)*4,c=this.getPixelFromPlane(a,o,n);i[s]=c,i[s+1]=c,i[s+2]=c,i[s+3]=255}return new ImageData(i,e,r)}getPixelFromPlane(t,e,r){let a=Math.floor(e/(t.subsamplingX||1)),i=Math.floor(r/(t.subsamplingY||1)),n=t.rowStride,o=t.pixelStride,s=i*n+a*o,c=t.data;return s<c.length?c[s]:0}applyRotation(t,e){let r=e*Math.PI/180,a=e===90||e===270||e===-90||e===-270,i=a?t.height:t.width,n=a?t.width:t.height,o=this.getNewCanvas(i,n),s=o.getContext("2d");if(!s)throw new Error("Failed to get 2D context for rotated canvas");return s.translate(i/2,n/2),s.rotate(r),s.translate(-t.width/2,-t.height/2),s.drawImage(t,0,0),o}};O.JPEG_IMAGE_MIME_TYPE="image/jpeg";var he=class extends O{getNewCanvas(t,e){return new OffscreenCanvas(t,e)}canvasToBlob(t){return t.convertToBlob({type:O.JPEG_IMAGE_MIME_TYPE,quality:this.options.quality})}};var me=class{constructor(t){this.viewInfo=null,this.viewInfo=this.cloneViewInfo(t)}isSame(t){return this.viewInfo==null&&t==null?!0:this.viewInfo==null&&t!=null||this.viewInfo!=null&&t==null?!1:this.viewInfo.width===t.width&&this.viewInfo.height===t.height&&this.viewInfo.orientation===t.orientation&&this.viewInfo.viewFinderRect.origin.x===t.viewFinderRect.origin.x&&this.viewInfo.viewFinderRect.origin.y===t.viewFinderRect.origin.y&&this.viewInfo.viewFinderRect.size.width===t.viewFinderRect.size.width&&this.viewInfo.viewFinderRect.size.height===t.viewFinderRect.size.height}update(t){this.viewInfo=this.cloneViewInfo(t)}cloneViewInfo(t){return t?{...t,viewFinderRect:{origin:{...t.viewFinderRect.origin},size:{...t.viewFinderRect.size}}}:null}};var R;(t=>{function e(){return"8.3.0-beta.1"}t.sdkVersion=e})(R||(R={}));function Ge(t){return/^https?:\\/\\/(?:[^./]*\\.)*cdn.jsdelivr.net\\//.test(t)?{result:!0,cdnBaseURL:"https://cdn.jsdelivr.net/npm/"}:/^https?:\\/\\/(?:[^./]*\\.)*unpkg.com\\//.test(t)?{result:!0,cdnBaseURL:"https://unpkg.com/"}:{result:!1,cdnBaseURL:""}}function je(t){let e=/@scandit\\/web-datacapture-[a-z]+/i.exec(t);return e?e[0]:null}function ge(t,e,r){let a=e,i=Ge(a);if(i.result){let o=je(a);o!=null&&(a=`${i.cdnBaseURL}${o}@${t}/sdc-lib/`)}let n=r.replace(".wasm","");return i.result?{jsURI:`${a}${n}.js`,wasmURI:`${a}${n}.wasm`}:{jsURI:`${a}${n}.js?v=${t}`,wasmURI:`${a}${n}.wasm?v=${t}`}}var fe=class be{constructor(e,r){this.hintPresenterV2=null,this.MAX_NUMBER_OF_IMAGES_IN_FRAME_DATA_POOL=5,this.redrawInterval=1e3/30,this.redrawRequests=[],this._isDrawLoopRunning=!1,this.frameDataPool=new Map,this.lastFrameColorType="RGBA",this.lastFrameId=null,this.poorMansBenchmarkLogs=!1,this.writableDataPathStandard="/scandit_sync_folder",this.resourceFilesSubfolder="resources",this.performanceMetricsReporterTimer=void 0,this.lastMetricsReportTime=0,this.metricsReportInterval=1e3,this.performanceMetrics={frameDataPoolSize:0,cameraOutputFrames:0,redrawRequestsCount:0,actualRedrawsCount:0,frameProcessingStartedCount:0,frameProcessedCount:0,frameSkippedCount:0},this.frameProcessingStartedCount=0,this.frameProcessingFinishedCount=0,this.gestureListener=null,this.webPlatformHintPresenter=null,this.deviceInstance=null,this.deviceInfo=null,this.lastViewInfo=new me(null),this.lastFrameProcessingStartedCount=0,this.lastFrameProcessingFinishedCount=0,this.moduleHandler=e,this.workerFunctions=r,this._loadProgressCallback=this._loadProgressCallback.bind(this),le(this.getWasmMetadata())}get Module(){return this.moduleHandler.get()}set isDrawLoopRunning(e){this._isDrawLoopRunning=e,!e&&typeof this.loopTimeoutId=="number"&&(clearTimeout(this.loopTimeoutId),this.loopTimeoutId=void 0)}get isDrawLoopRunning(){return this._isDrawLoopRunning}prepareFrameForListener(e){let r=this.lastFrameId;if(this.frameDataPool.size>=this.MAX_NUMBER_OF_IMAGES_IN_FRAME_DATA_POOL){let o=this.frameDataPool.keys().next().value;o!=null&&this.frameDataPool.delete(o)}let a=e.getFrameData(),i=new Uint8ClampedArray(a);this.frameDataPool.set(r,{data:i,colorType:this.lastFrameColorType,frameId:r,width:e.getWidth(),height:e.getHeight()});let n=this.lastUsedModuleMirrorAxis==null?!1:this.lastUsedModuleMirrorAxis!==this.Module.Axis.None;return{frameId:r,width:e.getWidth(),height:e.getHeight(),isFrameSourceMirrored:n,colorType:this.lastFrameColorType}}createContext(e){var r,a,i,n,o;let s=this.getModeDeserializers(),c=Q(location);(c==="localhost"||c==="127.0.0.1")&&navigator.userAgent.includes("Electron")&&e.appName!=null&&(c+=`-${e.appName}`),this.parentDomain=e.parentDomain,this.contextDeserializer=new this.Module.DataCaptureContextDeserializer(this.writableDataPath,e.deviceId,e.context.deviceModelName,c,this.parentDomain,s,e.delayedRegistration,e.highEndBlurryRecognition,this.resourcePath);let l=this.contextDeserializer.contextFromJson(JSON.stringify(e.context));if(l==null){let p=this.contextDeserializer.getLastError();throw new Error(`Could not create the context: ${p}`)}let h=l.getView();this.context=l.getContext(),l.delete(),this.setupDeviceInterface(e.isTablet,e.batteryInfo);let m=this.Module.DataCaptureContextListener.extend("DataCaptureContextListener",{didChangeStatus:(p,y)=>{this.contextDidChangeStatus(JSON.parse(y.toJson())),p.delete()},didStartObservingContext:p=>{this.didStartObservingContext(),p.delete()},didStopObservingContext:p=>{p.delete()}}),g=this.Module.DataCaptureContextFrameListener.extend("DataCaptureContextFrameListener",{onObservationStarted:p=>{p.delete()},onObservationStopped:p=>{p.delete()},onFrameProcessingStarted:(p,y)=>{this.workerFunctions.postMessage({type:"onFrameProcessingStarted"}),y.delete(),p.delete()},onFrameProcessingFinished:(p,y)=>{this.workerFunctions.postMessage({type:"onFrameProcessingFinished"}),y.delete(),p.delete()},onFrameSkipped:(p,y)=>{this.workerFunctions.postMessage({type:"onFrameSkipped"}),y.delete(),p.delete()}}),f=this.Module.GestureRecognizer.extend("GestureRecognizer",{setGestureListener:(p,y)=>{var F;(F=this.gestureListener)==null||F.delete(),this.gestureListener=p.clone(),p.delete()}});(r=this.gestureRecognizer)==null||r.delete(),this.gestureRecognizer=new f;let b=new m;this.context.addListener(b),b.delete();let P=new g;this.context.addFrameListener(P),P.delete(),this.setView(h),(a=this.view)==null||a.setGestureRecognizer(this.gestureRecognizer);let M=this.Module.PlatformHintPresenter.extend("PlatformHintPresenter",{setHintPresenter:p=>{p.delete()},showToast:p=>{this.workerFunctions.postMessage({type:"showToast",payload:JSON.parse(p)})},hideToast:p=>{this.workerFunctions.postMessage({type:"hideToast",payload:JSON.parse(p)})},showGuidance:p=>{this.workerFunctions.postMessage({type:"showGuidance",payload:JSON.parse(p)})},hideGuidance:p=>{this.workerFunctions.postMessage({type:"hideGuidance",payload:JSON.parse(p)})},startUpdateTimer:p=>{this.workerFunctions.postMessage({type:"startUpdateTimer",payload:{duration:{unit:"ms",value:p}}})},stopUpdateTimer:()=>{this.workerFunctions.postMessage({type:"stopUpdateTimer"})}});(i=this.hintPresenterV2)==null||i.delete(),this.hintPresenterV2=null,(n=this.webPlatformHintPresenter)==null||n.delete(),this.webPlatformHintPresenter=null,this.webPlatformHintPresenter=new M,this.view&&(this.hintPresenterV2=new this.Module.HintPresenterV2(this.webPlatformHintPresenter),(o=this.view)==null||o.setHintPresenterV2(this.hintPresenterV2)),this.webImageConverterInstance=this.getImageConverterInstance({quality:1}),this.Module.ImageConverter.setInstance(this.webImageConverterInstance)}convertToJPEGResult(e,r){this.webImageConverterInstance instanceof ee&&this.webImageConverterInstance.onConvertToJPEGResult(e,r)}getImageConverterInstance(e){return this.workerFunctions.getOffscreenCanvas()!=null?new he(e):new ee(this.workerFunctions,e)}onTap(e){var r;(r=this.gestureListener)==null||r.onTap(JSON.stringify(e))}hintPresenterV2Update(){var e;(e=this.hintPresenterV2)==null||e.update()}startReportingPerformanceMetrics(){this.performanceMetricsReporterTimer==null&&(this.lastMetricsReportTime=performance.now(),this.scheduleMetricsReporting())}scheduleMetricsReporting(){this.performanceMetricsReporterTimer=setTimeout(()=>{this.checkAndReportMetrics()},100)}checkAndReportMetrics(){let e=performance.now();e-this.lastMetricsReportTime>=this.metricsReportInterval&&(this.reportPerformanceMetrics(),this.performanceMetrics.cameraOutputFrames=0,this.performanceMetrics.redrawRequestsCount=0,this.performanceMetrics.actualRedrawsCount=0,this.lastMetricsReportTime=e),this._isDrawLoopRunning&&this.scheduleMetricsReporting()}async reportPerformanceMetrics(){let e=this.frameProcessingStartedCount-this.lastFrameProcessingStartedCount,r=this.frameProcessingFinishedCount-this.lastFrameProcessingFinishedCount;this.lastFrameProcessingStartedCount=this.frameProcessingStartedCount,this.lastFrameProcessingFinishedCount=this.frameProcessingFinishedCount;let a={cameraOutputFrames:this.performanceMetrics.cameraOutputFrames,redrawRequestsCount:this.performanceMetrics.redrawRequestsCount,actualRedrawsCount:this.performanceMetrics.actualRedrawsCount,frameDataPoolSize:this.performanceMetrics.frameDataPoolSize,frameProcessingStartedCount:e,frameProcessedCount:r,frameSkippedCount:this.performanceMetrics.frameSkippedCount};this.workerFunctions.postMessage({type:"performanceMetricsReport",payload:a})}deleteFrameData(e){this.frameDataPool.delete(e)}dispose(){var e,r,a,i,n;this.context.dispose(),this.frameDataPool.clear(),this.isDrawLoopRunning=!1,this.cleanupMetricsReporting(),(e=this.gestureRecognizer)==null||e.delete(),this.gestureRecognizer=null,(r=this.gestureListener)==null||r.delete(),this.gestureListener=null,(a=this.hintPresenterV2)==null||a.delete(),this.hintPresenterV2=null,(i=this.webPlatformHintPresenter)==null||i.delete(),this.webPlatformHintPresenter=null,(n=this.deviceInstance)==null||n.delete(),this.deviceInstance=null,this.deviceInfo=null}cleanupMetricsReporting(){this.performanceMetricsReporterTimer!=null&&(typeof this.performanceMetricsReporterTimer=="number"?cancelAnimationFrame(this.performanceMetricsReporterTimer):clearTimeout(this.performanceMetricsReporterTimer),this.performanceMetricsReporterTimer=void 0)}flushAnalytics(){this.context.flushAnalytics()}extractCentaurusLicense(e){return{payload:{centaurus:{licenseKey:this.Module.LicenseUtils[be.get3dPartyLicenseKeyMethodName](e)}}}}getModeDeserializers(){return new this.Module.VectorDataCaptureModeDeserializer}loadLibrary(e){return this.libraryLoadingPromise!=null?this.libraryLoadingPromise:(this.libraryLoadingPromise=this.setup(e),this.libraryLoadingPromise)}processFrame(e){var r;if(this.context==null)return d.debug("[processFrame] Context is null, returning frame without processing"),{payload:e,transferables:[e.data.buffer]};this.lastFrameId=e.frameId;let a=e.data,i=e.colorType==="GRAYSCALE"?this.Module.ImageBufferFormat.Grayscale8:this.Module.ImageBufferFormat.Rgba8888;this.lastFrameColorType=e.colorType==="GRAYSCALE"?"GRAYSCALE":"RGBA";let n=this.Module.allocateUint8Array(a.byteLength);return this.Module.HEAPU8.set(a,n),(r=this.imageFrameSource)==null||r.outputFrame(n,e.width,e.height,i),{payload:e,transferables:[e.data.buffer]}}reportCameraProperties(e){this.context.setCameraProperties(e.deviceId,e.isFrontFacing,e.hasAutofocus)}requestFrameData(e){let r=this.frameDataPool.get(e);if(r==null)return{payload:{data:null,frameId:null,colorType:null}};if(r.data.buffer.byteLength===0)return this.frameDataPool.delete(e),{payload:{data:null,frameId:null,colorType:null}};let a=r.data;r.colorType==="GRAYSCALE"&&(a=ie(r.data,r.width,r.height));let i={payload:{data:a,frameId:r.frameId,colorType:r.colorType},transferables:[a.buffer]};return this.frameDataPool.delete(e),i}scheduleRedraw(e,r){this.addRedrawRequest(r),this.isDrawLoopRunning||this.startDrawLoop(e)}sendViewRefreshCommands(e){this.workerFunctions.postMessage({type:"draw",payload:e},[e.buffer])}setFrameSource(e,r){var a;this.lastUsedModuleMirrorAxis=this.mapMirrorAxisOnModule(e),(a=this.imageFrameSource)==null||a.delete(),this.imageFrameSource=new this.Module.ImageBufferFrameSource(this.lastUsedModuleMirrorAxis,r,0),this.context.setFrameSource(this.imageFrameSource)}startDrawLoop(e){this.isDrawLoopRunning=!0;let r=n=>this.redrawRequests.length>0&&this.redrawRequests[0]<=n,a=n=>{for(;this.redrawRequests.length>0&&this.redrawRequests[0]<=n;)this.redrawRequests.shift()},i=()=>{this.loopTimeoutId=setTimeout(()=>{if(!this.isDrawLoopRunning)return;let n=performance.now();if(r(n)){a(n),e.draw();let o=e.getDrawCommands();this.sendViewRefreshCommands(new Uint8Array(o))}i()},this.redrawInterval)};i()}updateContext(e){if(this.context!=null&&this.contextDeserializer!=null){e.view!=null&&!e.view.visible&&this.context.flushAnalytics();let r=this.onBeforeUpdateContextHook(e),a=this.contextDeserializer.updateContextFromJson(this.context,this.view,JSON.stringify(r.context));if(a==null){let n=this.contextDeserializer.getLastError();throw new Error(`Could not update the context: ${n}`)}this.context.delete(),this.context=a.getContext();let i=a.getView();a.delete(),i!=null&&r.view!=null&&(i.setViewSize(r.view.width,r.view.height,r.view.orientation),i.draw()),!this.hintPresenterV2&&this.webPlatformHintPresenter&&(this.hintPresenterV2=new this.Module.HintPresenterV2(this.webPlatformHintPresenter)),i!=null&&this.hintPresenterV2&&i.setHintPresenterV2(this.hintPresenterV2),this.gestureRecognizer!=null&&(i==null||i.setGestureRecognizer(this.gestureRecognizer)),this.setView(i),this.notifyMainThreadOnViewInfoChanged(i),d.debug("context updated",r)}}notifyMainThreadOnViewInfoChanged(e){let r=this.getViewInfo(e);this.lastViewInfo.isSame(r)||(this.lastViewInfo.update(r),this.workerFunctions.postMessage({type:"viewSizeChanged",payload:r}))}getViewInfo(e){if(e!=null)try{let r=JSON.parse(e.getViewInfo());if(r!=null){let a=this.getOrientationFromNumber(r.orientation);return{...r,orientation:a}}}catch(r){d.error("Failed to get view size",r)}return null}getOrientationFromNumber(e){switch(e){case 90:return"landscapeRight";case 180:return"portraitUpsideDown";case 270:return"landscapeLeft";default:return"portrait"}}onBeforeUpdateContextHook(e){return e}onDocumentVisibilityChange(e){e==="hidden"&&this.context.flushAnalytics()}isFeatureSupported(e){return{payload:{supported:this.context.isFeatureSupported(e)}}}getViewfinderInfo(){var e,r;return{payload:{isDisplayingViewfinder:(r=(e=this.view)==null?void 0:e.isDisplayingViewfinder())!=null?r:!1,rect:JSON.parse(this.view.getViewfinderRect())}}}getOpenSourceSoftwareLicenseInfo(){return{payload:{licenseText:this.Module.OpenSourceSoftwareLicenseInfo.getLicenseText()}}}getWasmDynamicLibraries(e){return this.getWasmSideModuleFileName()==null?[]:[`${e.replace(/\\/[^/]*$/,"/")}${this.getWasmSideModuleFileName()}`]}getWasmCoreExpectedHash(e,r){return r?e?"85dc3552838b61f5c0c3a20b03ab3d6ec0ac34536bc3c8ff09ba7943d4cd7dc6":"91e683aec80d2fb4c4f9d7bb123ffca731a534cf8d953c4492a5f84bb9194c01":e?"64914911045cd522d294d10b3d28c425edf22f939eda121165aeb66f9ffe7308":""}getWasmCoreFileName(e,r){return r?e?"scandit-datacapture-sdk-barcode-simd-pthreads.wasm":"scandit-datacapture-sdk-barcode-pthreads.wasm":e?"scandit-datacapture-sdk-barcode-simd.wasm":""}getWasmMetadata(){return u}getWasmSideModuleFileName(){return""}_loadProgressCallback(e){this.workerFunctions.postMessage({type:"loadLibraryProgress",payload:e})}addRedrawRequest(e){this.redrawRequests.push(Math.round(performance.now())+e),this.redrawRequests.sort((r,a)=>r-a)}contextDidChangeStatus(e){e.code===260?e.message=e.message.replace("domain name",`domain name (${Q(location)})`):e.code===265&&(e.message=e.message.replace("domain name",`domain name (${this.parentDomain})`)),this.workerFunctions.postMessage({type:"contextDidChangeStatus",payload:e})}didStartObservingContext(){this.workerFunctions.postMessage({type:"didStartObservingContext"})}mapMirrorAxisOnModule(e){switch(e){case"None":return this.Module.Axis.None;case"X":return this.Module.Axis.X;case"Y":return this.Module.Axis.Y;default:return this.Module.Axis.None}}setView(e){this.view=e,this.setViewRefreshHandler(e),e==null&&(this.isDrawLoopRunning=!1,this.sendViewRefreshCommands(new Uint8Array([])))}addNativeOverlay(e){d.warn("addNativeOverlay has not been implemented for this module",e)}removeNativeOverlay(e){d.warn("removeNativeOverlay has not been implemented for this module",e)}setViewRefreshHandler(e){if(e==null||e.isViewRefreshHandlerSet)return;let r=this.Module.NeedsRedrawDelegate.extend("NeedsRedrawDelegate",{setNeedsRedrawIn:this.scheduleRedraw.bind(this,e)}),a=new r;e.setNeedsRedrawDelegate(a),e.isViewRefreshHandlerSet=!0}setupDataDecoding(){let e=this.moduleHandler.get(),r=e.DataDecoding.extend("DataDecoding",{decode(a,i){try{let n=JSON.parse(i),o=[];for(let s of n){let c=new TextDecoder(s.ianaName,{fatal:!0});o.push(c.decode(a.slice(s.startIndex,s.endIndex)))}return o.join("")}catch{return""}}});e.setDataDecoding(new r)}getBatteryData(){var e,r;let a=(r=(e=this.deviceInfo)==null?void 0:e.batteryInfo)==null?void 0:r.percentage;if(a!=null)return{percentage:a}}isTablet(){var e,r;return(r=(e=this.deviceInfo)==null?void 0:e.isTablet)!=null?r:!1}setupDeviceInterface(e,r){this.deviceInfo={isTablet:e,batteryInfo:r};let a=this.moduleHandler.get(),i=a.DeviceInterface.extend("DeviceInterface",{getBatteryData:this.getBatteryData.bind(this),isTablet:this.isTablet.bind(this)});this.deviceInstance=new i,a.DeviceHolder.setCurrentDevice(this.deviceInstance)}updateBatteryInfo(e){this.deviceInfo&&(this.deviceInfo.batteryInfo=e)}start(e,r,a){e&&r&&(this.setupDataDecoding(),this.moduleHandler.get().callMain(),this.moduleHandler.get().__emscripten_proxy_main!==void 0||a())}getWritableDataPath(e){return e!=null?(d.debug(`IndexedDB database name override in use to recover from blocked standard database: ${e}`),e):this.writableDataPathStandard}numOfMBToPages(e){return Math.ceil(1024*e*1024/64/1024)}async setup({libraryLocation:e,locationPath:r,writableDataPathOverride:a,indexedDBTimeoutMs:i,verifyResponseHash:n,referredOrigin:o,fixedWasmMemory:s,simdSupport:c,threadsSupport:l}){var h;let m=!1,g=!1;this.writableDataPath=this.getWritableDataPath(a),this.resourcePath=`${e}${this.resourceFilesSubfolder}/`,self.path=r;let{resolve:f,reject:b,promise:P}=new A,M=R.sdkVersion();if(M==="")throw new x({name:"Invalid library version",message:"Library version is not defined or empty, cannot generate proper path to library files."});let p=this.getWasmCoreFileName(c,l),y=ge(M,e,p),{jsURI:F,wasmURI:re}=y,xe={instantiateWasm:(S,Te)=>(ue({importObject:S,wasmURI:re,expectedHash:this.getWasmCoreExpectedHash(c,l),verifyResponseHash:n,successCallback:Te,progressCallback:this._loadProgressCallback,errorCallback:Ae=>{b(Ae)},referredOrigin:o}),{})},B=s===null?null:new WebAssembly.Memory({initial:this.numOfMBToPages(s),maximum:this.numOfMBToPages(300),shared:l});return B!==null&&d.log(d.Level.Debug,"Fixed wasmMemory set",B),this.moduleHandler.set({...B?{wasmMemory:B}:{},mainScriptUrlOrBlob:F,canvas:(h=this.workerFunctions.getOffscreenCanvas())!=null?h:{getContext:()=>null},...xe,dynamicLibraries:this.getWasmDynamicLibraries(re),locateFile:S=>e+S,noInitialRun:!0,preRun:[async()=>{try{await de({writableDataPath:this.writableDataPath,indexedDBTimeoutMs:i})}catch(S){if(S.name==="BlockedIndexedDB"){b(S.toString());return}d.log(d.Level.Debug,"No IndexedDB support, some data will not be persisted:",S)}g=!0,this.start(g,m,f)}],onMainComplete:()=>{if([m,g].includes(!1)){d.log(d.Level.Warn,{runtimeLoaded:m,fileSystemSynced:g},"Both runtimeLoaded and fileSystemSynced should be true when calling onMainComplete"),b("onMainComplete has been called but runtime or file system was not ready.");return}f()},onRuntimeInitialized:()=>{m=!0,this.start(g,m,f)},print:S=>{d.info(S)}}),await pe(F,M)||b(`Couldn\'t retrieve Scandit Data Capture library at ${F}, did you configure the path for it correctly?`),P}};fe.get3dPartyLicenseKeyMethodName=atob("Z2V0QmxpbmtJZExpY2Vuc2VLZXk=");var I=fe;function ye(t){return typeof t=="object"&&t!=null&&t.document==null&&"addEventListener"in t&&typeof t.importScripts=="function"}function Se(t){console.warn("Reached unexpected case",t)}var te=class{constructor(t,e){this.onMessageListener=this.onMessage.bind(this),this.workerSelf=t,this.dataCaptureInstance=new I(e,{postMessage:this.postMessage.bind(this),getOffscreenCanvas:this.getOffscreenCanvas.bind(this)}),ye(t)&&(ae(t),this.listenToMessages())}listenToMessages(){this.workerSelf.addEventListener("message",this.onMessageListener),this.workerSelf.addEventListener("error",t=>{d.log(d.Level.Error,t)}),this.workerSelf.addEventListener("messageerror",t=>{d.log(d.Level.Error,t)})}postMessage(t,e){this.workerSelf.postMessage(t,e!=null?e:[])}getOffscreenCanvas(){if(this.isOffscreenCanvasSupported())return new this.workerSelf.OffscreenCanvas(32,32)}isOffscreenCanvasSupported(){return typeof this.workerSelf.OffscreenCanvas=="function"}hasPayload(t){return C(t)&&"payload"in t}hasTransferables(t){return C(t)&&Array.isArray(t.transferables)}async respondWith(t,e,r){let a=null,i;try{i=r(),i instanceof Promise&&(i=await i)}catch(o){i=void 0,a=k(o)}let n={type:"workerTaskId",command:t,id:e,payload:this.hasPayload(i)?i.payload:void 0};a!=null&&(n.error=a),this.postMessage(n,this.hasTransferables(i)?i.transferables:[])}onMessage(t){switch(t.data.command){case"loadLibrary":{{let{data:e}=t;this.respondWith(e.command,e.id,async()=>this.dataCaptureInstance.loadLibrary({libraryLocation:e.libraryLocation,locationPath:e.locationPath,referredOrigin:e.referredOrigin,writableDataPathOverride:e.writableDataPathOverride,threadsSupport:e.threadsSupport,simdSupport:e.simdSupport,verifyResponseHash:e.verifyResponseHash,fixedWasmMemory:e.fixedWasmMemory,indexedDBTimeoutMs:e.indexedDBTimeoutMs}))}break}case"onTap":{{let{data:e}=t;this.respondWith(e.command,e.id,async()=>{this.dataCaptureInstance.onTap(e.point)})}break}case"hintPresenterV2update":{{let{data:e}=t;this.respondWith(e.command,e.id,async()=>{this.dataCaptureInstance.hintPresenterV2Update()})}break}case"createContext":{{let{data:e}=t;this.respondWith(e.command,e.id,()=>this.dataCaptureInstance.createContext({context:e.context,deviceId:e.deviceId,delayedRegistration:e.delayedRegistration,highEndBlurryRecognition:e.highEndBlurryRecognition,appName:e.appName,parentDomain:e.parentDomain,isTablet:e.isTablet,batteryInfo:e.batteryInfo}))}break}case"setFrameSource":{{let{data:e}=t;this.respondWith(e.command,e.id,()=>this.dataCaptureInstance.setFrameSource(e.mirrorAxis,e.isCameraFrameSource))}break}case"processFrame":{{let{data:e}=t;this.respondWith(e.command,e.id,()=>this.dataCaptureInstance.processFrame({data:e.data,frameId:e.frameId,width:e.width,height:e.height,colorType:e.colorType}))}break}case"requestFrameData":{{let{data:e}=t;this.respondWith(e.command,e.id,()=>this.dataCaptureInstance.requestFrameData(e.frameId))}break}case"deleteFrameData":{{let{data:e}=t;this.respondWith(e.command,e.id,()=>{this.dataCaptureInstance.deleteFrameData(e.frameId)})}break}case"updateContext":{{let{data:e}=t;this.respondWith(e.command,e.id,async()=>this.dataCaptureInstance.updateContext(e))}break}case"dispose":{this.respondWith(t.data.command,t.data.id,()=>this.dataCaptureInstance.dispose());break}case"flushAnalytics":{this.respondWith(t.data.command,t.data.id,()=>{this.dataCaptureInstance.flushAnalytics()});break}case"reportCameraProperties":{{let{data:e}=t;this.respondWith(e.command,e.id,async()=>this.dataCaptureInstance.reportCameraProperties(e))}break}case"setLogLevel":{{let{data:e}=t;this.respondWith(e.command,e.id,()=>{d.setLevel(e.level)})}break}case"updateBatteryInfo":{{let{data:e}=t;this.respondWith(e.command,e.id,()=>{this.dataCaptureInstance.updateBatteryInfo(e.batteryInfo)})}break}case"extractCentaurusLicense":{{let{data:e}=t;this.respondWith(e.command,e.id,()=>this.dataCaptureInstance.extractCentaurusLicense(e.licenseKey))}break}case"documentVisibility":{{let{data:e}=t;this.respondWith(e.command,e.id,()=>{this.dataCaptureInstance.onDocumentVisibilityChange(e.state)})}break}case"isFeatureSupported":{{let{data:e}=t;this.respondWith(e.command,e.id,()=>this.dataCaptureInstance.isFeatureSupported(e.feature))}break}case"getViewfinderInfo":{{let{data:e}=t;this.respondWith(e.command,e.id,()=>this.dataCaptureInstance.getViewfinderInfo())}break}case"getOpenSourceSoftwareLicenseInfo":{{let{data:e}=t;this.respondWith(e.command,e.id,()=>this.dataCaptureInstance.getOpenSourceSoftwareLicenseInfo())}break}case"addNativeOverlay":this.dataCaptureInstance.addNativeOverlay(t);break;case"removeNativeOverlay":this.dataCaptureInstance.removeNativeOverlay(t);break;case"convertToJPEGResult":{{let{data:e}=t;this.dataCaptureInstance.convertToJPEGResult(e.imageId,e.result)}break}default:return Se(t.data),!1}return!0}};var we=(t=>(t.Body="body",t.Footnote="footnote",t))(we||{}),E=(t=>(t.Start="start",t.Center="center",t.End="end",t))(E||{}),ve=(t=>(t.Normal="normal",t.Wider="wider",t.FitText="fitText",t))(ve||{}),Fe=(t=>(t.Normal="normal",t.Taller="taller",t))(Fe||{}),Me=(t=>(t.Square="square",t.Rounded="rounded",t))(Me||{}),L=(t=>(t.None="none",t.Check="check",t.ExclamationMark="exclamationMark",t))(L||{}),W=(t=>(t.Top="top",t.Center="center",t.AboveViewFinder="aboveViewFinder",t.BelowViewFinder="belowViewFinder",t))(W||{}),Ce=(t=>(t.AboveViewFinder="aboveViewFinder",t.BelowViewFinder="belowViewFinder",t))(Ce||{}),ke=(t=>(t.BlackOnWhite="blackOnWhite",t.WhiteOnBlack="whiteOnBlack",t.Transparent="transparent",t))(ke||{}),De=(t=>(t.Success="success",t.Error="error",t.Warning="warning",t.Info="info",t.Notification="notification",t))(De||{}),Ie=(t=>(t[t.Ocr=0]="Ocr",t[t.HideLogo=1]="HideLogo",t[t.ShowTestLicenseMessage=2]="ShowTestLicenseMessage",t[t.AugmentedReality=5]="AugmentedReality",t[t.ActivityPingStatsAddon=8]="ActivityPingStatsAddon",t[t.ActivityPing=9]="ActivityPing",t[t.Registration=10]="Registration",t[t.Parser=11]="Parser",t[t.BarcodeCapture=14]="BarcodeCapture",t[t.Analytics=17]="Analytics",t[t.AnalyticsBatchMode=18]="AnalyticsBatchMode",t[t.AnalyticsScanContent=19]="AnalyticsScanContent",t[t.AnalyticsOnlineVerification=20]="AnalyticsOnlineVerification",t[t.SparkScan=21]="SparkScan",t[t.AamvaIdBarcodeVerification=22]="AamvaIdBarcodeVerification",t[t.MappingForTracking=23]="MappingForTracking",t[t.BarcodeFind=24]="BarcodeFind",t[t.MandatoryRegistration=25]="MandatoryRegistration",t[t.FeatureTracking=26]="FeatureTracking",t[t.IdCaptureViz=27]="IdCaptureViz",t[t.IdCaptureMrz=28]="IdCaptureMrz",t[t.IdCaptureBarcode=29]="IdCaptureBarcode",t[t.BarcodeSelectionAimToScan=30]="BarcodeSelectionAimToScan",t[t.BarcodeSelectionTapToScan=31]="BarcodeSelectionTapToScan",t[t.BarcodeCount=32]="BarcodeCount",t[t.BarcodePick=33]="BarcodePick",t[t.IdVerificationDataComparison=34]="IdVerificationDataComparison",t[t.SmartLabelBarcode=35]="SmartLabelBarcode",t[t.SmartLabelText=36]="SmartLabelText",t[t.VoidedIdDetection=37]="VoidedIdDetection",t[t.BarcodeArFull=38]="BarcodeArFull",t[t.BarcodeSequence=39]="BarcodeSequence",t))(Ie||{});var N=class{constructor(e,r,a){this.barcodeAr=null;this.coreEngine=e,this.Module=r,this.workerFunctions=a}async forSettings(e){var a;(a=this.barcodeAr)==null||a.delete(),this.barcodeAr=new this.Module.BarcodeAr(this.coreEngine.context,JSON.stringify(e));let r=this.Module.BarcodeArListener.extend("BarcodeArListener",{didUpdateSession:(i,n,o)=>{let s=this.coreEngine.prepareFrameForListener(o);this.workerFunctions.postMessage({type:"barcodeArDidUpdateSession",payload:{session:JSON.parse(n.toJson()),frameData:s}}),i.delete(),n.delete(),o.delete()}});this.barcodeAr.addListener(new r,1),this.Module.addBarcodeArToContext(this.coreEngine.context,this.barcodeAr)}start(){var e;(e=this.barcodeAr)==null||e.start()}pause(){var e;(e=this.barcodeAr)==null||e.pause()}stop(){var e;(e=this.barcodeAr)==null||e.stop()}setEnabled(e){var r;(r=this.barcodeAr)==null||r.setEnabled(e)}async removeMode(){this.barcodeAr!=null&&this.Module.removeBarcodeArFromContext(this.coreEngine.context,this.barcodeAr)}applySettings(e){var r;(r=this.barcodeAr)==null||r.applySettings(JSON.stringify(e))}};var H=class{constructor(e,r,a){this.trackingListenerSet=!1;this.coreEngine=e,this.Module=r,this.workerFunctions=a,this.setup()}barcodeBatchDidUpdateSession(e){this.workerFunctions.postMessage({type:"barcodeBatchDidUpdateSession",payload:JSON.parse(e.toJson())})}getBatchDeserializer(){return this.barcodeBatchDeserializer}setup(){let e=this.Module.BarcodeBatchListener.extend("BarcodeTrackingListener",{didUpdateSession:(a,i,n)=>{this.barcodeBatchDidUpdateSession(i),a.delete(),i.delete(),n.delete()},onTrackedBarcodeTapped:(a,i)=>{this.onTrackedBarcodeTapped(i),a.delete(),i.delete()}}),r=this.Module.BarcodeBatchDeserializerListener.extend("BarcodeTrackingDeserializerListener",{onModeDeserializationFinished:(a,i,n)=>{this.trackingListenerSet||(i.addListener(new e,1),this.trackingListenerSet=!0),a.delete(),i.delete(),n.delete()},onModeDeserializationStarted(a,i,n){a.delete(),i.delete(),n.delete()},onSettingsDeserializationStarted(a,i,n){a.delete(),i.delete(),n.delete()},onSettingsDeserializationFinished(a,i,n){a.delete(),i.delete(),n.delete()}});this.barcodeBatchDeserializer=new this.Module.BarcodeBatchDeserializer,this.barcodeBatchDeserializer.setListener(new r)}onTrackedBarcodeTapped(e){this.workerFunctions.postMessage({type:"didTapTrackedBarcode",payload:JSON.parse(e.toJson())})}};var _=class{constructor(e,r,a){this.captureListenerSet=!1;this.coreEngine=e,this.Module=r,this.workerFunctions=a,this.setup()}barcodeCaptureDidUpdateSession(e){this.workerFunctions.postMessage({type:"barcodeCaptureDidUpdateSession",payload:JSON.parse(e.toJson())})}barcodeBatchDidUpdateSession(e){this.workerFunctions.postMessage({type:"barcodeBatchDidUpdateSession",payload:JSON.parse(e.toJson())})}getCaptureDeserializer(){return this.barcodeCaptureDeserializer}getTrackingDeserializer(){return this.barcodeBatchDeserializer}setup(){let e=this.Module.BarcodeCaptureListener.extend("BarcodeCaptureListener",{didScan:(o,s,c)=>{this.barcodeCaptureDidScan(s,c),o.delete(),c.delete(),s.delete()},didUpdateSession:(o,s,c)=>{this.barcodeCaptureDidUpdateSession(s),o.delete(),c.delete(),s.delete()}}),r=this.Module.Feedback.extend("Feedback",{emit:()=>{this.successFeedback()}}),a=new e,i=new r,n=this.Module.BarcodeCaptureDeserializerListener.extend("BarcodeCaptureDeserializerListener",{onModeDeserializationFinished:(o,s,c)=>{s.addListener(a,1),s.setSuccessFeedback(i),o.delete(),s.delete(),c.delete()},onModeDeserializationStarted(o,s,c){o.delete(),s.delete(),c.delete()},onSettingsDeserializationStarted(o,s,c){o.delete(),s.delete(),c.delete()},onSettingsDeserializationFinished(o,s,c){o.delete(),s.delete(),c.delete()}});this.barcodeCaptureDeserializer=new this.Module.BarcodeCaptureDeserializer,this.barcodeCaptureDeserializer.setListener(new n)}successFeedback(){this.workerFunctions.postMessage({type:"successFeedback"})}barcodeCaptureDidScan(e,r){let a=this.coreEngine.prepareFrameForListener(r);this.workerFunctions.postMessage({type:"barcodeCaptureDidScan",payload:{session:JSON.parse(e.toJson()),frameData:a}})}};function qe(t){return t.charAt(0).toUpperCase()+t.slice(1)}function Pe(t){return t}var z=class{constructor(e,r,a){this.barcodeFind=null;this.basicOverlay=null;this.transparentGuidanceHintStyle={backgroundColor:"00000000",cornerRadius:4,fitToText:!1,isAnimatedToView:!1,textAlignment:E.Center,hintIcon:L.None,hintAnchor:W.Center,hintAnchorOffset:0,horizontalMargin:0,iconColor:"00000000",lineHeight:-1,maxLines:1,maxWidthFraction:.8,textColor:"ffffffff",textSize:15,textWeight:600};this.customerTransformation=Pe;this.coreEngine=e,this.Module=r,this.workerFunctions=a}async forSettings(e){var o;(o=this.barcodeFind)==null||o.delete(),this.barcodeFind=new this.Module.BarcodeFind(this.coreEngine.context,JSON.stringify(e));let r=this.Module.Feedback.extend("Feedback",{emit:()=>{this.listUpdatedFeedback()}}),a=this.Module.Feedback.extend("Feedback",{emit:()=>{this.barcodeFindFeedback()}}),i=this.Module.BarcodeFindTransformer.extend("BarcodeFindTransformer",{transformBarcodeData:s=>this.customerTransformation(s)}),n=this.Module.BarcodeFindListener.extend("BarcodeFindListener",{didUpdateSession:(s,c,l)=>{let h=this.coreEngine.prepareFrameForListener(l);this.workerFunctions.postMessage({type:"barcodeFindDidUpdateSession",payload:{session:JSON.parse(c.toJson()),frameData:h}}),s.delete(),c.delete(),l.delete()},onSearchPaused:s=>{let c=[];for(let l=0;l<s.size();l++)c.push(s.get(l));this.workerFunctions.postMessage({type:"barcodeFindSearchPaused",payload:{foundItems:c}})},onSearchStopped:s=>{let c=[];for(let l=0;l<s.size();l++)c.push(s.get(l));this.workerFunctions.postMessage({type:"barcodeFindSearchStopped",payload:{foundItems:c}})},onSearchStarted:()=>{this.workerFunctions.postMessage({type:"barcodeFindSearchStarted",payload:{}})}});this.barcodeFind.setBarcodeFindTransformer(new i),this.barcodeFind.addListener(new n,1),this.barcodeFind.setItemListUpdatedFeedback(new r),this.barcodeFind.setFeedback(new a),this.Module.addBarcodeFindToContext(this.coreEngine.context,this.barcodeFind)}barcodeFindFeedback(){this.workerFunctions.postMessage({type:"barcodeFindFeedback",payload:{}})}start(){var e;(e=this.barcodeFind)==null||e.start()}stop(){var e;(e=this.barcodeFind)==null||e.stop()}pause(){var e;(e=this.barcodeFind)==null||e.pause()}setEnabled(e){var r;(r=this.barcodeFind)==null||r.setEnabled(e)}setItemList(e){var r;(r=this.barcodeFind)==null||r.setItemList(JSON.stringify(e))}async removeMode(){this.barcodeFind!=null&&this.Module.removeBarcodeFindFromContext(this.coreEngine.context,this.barcodeFind)}addBasicOverlay(){var e;(e=this.basicOverlay)==null||e.delete(),this.basicOverlay=null,this.barcodeFind!=null&&(this.basicOverlay=new this.Module.BarcodeFindBasicOverlay(this.barcodeFind)),this.coreEngine.view!=null&&this.basicOverlay!=null&&(this.basicOverlay.setGuidanceHandler(this.createWebFindGuidanceHandler()),this.Module.addBarcodeFindBasicOverlayToView(this.coreEngine.view,this.basicOverlay))}removeBasicOverlay(){this.coreEngine.view!=null&&this.basicOverlay!=null&&this.Module.removeBarcodeFindBasicOverlayFromView(this.coreEngine.view,this.basicOverlay)}async applySettings(e){var r;(r=this.barcodeFind)==null||r.applySettings(JSON.stringify(e))}updateBasicOverlay(e){let r=Object.entries(e).filter(([a,i])=>a!=="type");for(let[a,i]of r){let n=`set${qe(a)}`;this.basicOverlay!=null&&typeof this.basicOverlay[n]=="function"&&i!=null&&this.basicOverlay[n](i)}}setTransformerFunction(e){this.customerTransformation=e!=null?e:Pe}successFeedback(){this.workerFunctions.postMessage({type:"successFeedback"})}listUpdatedFeedback(){this.workerFunctions.postMessage({type:"barcodeFindListUpdatedFeedback",payload:{}})}setToast(e,r){let a=this.coreEngine.hintPresenterV2;e?a==null||a.showToast(JSON.stringify(r)):a==null||a.hideToast(r.tag)}setGuidance(e,r,a){let i={tag:a,text:r,hintStyle:this.transparentGuidanceHintStyle};this.workerFunctions.postMessage({type:e?"showGuidance":"hideGuidance",payload:i})}createWebFindGuidanceHandler(){let e=this.Module.BarcodeFindGuidanceHandler.extend("BarcodeFindGuidanceHandler",{setInitialGuidance:(r,a)=>{this.setGuidance(r,a,"InitialGuidance")},setMoveCloserGuidance:(r,a)=>{this.setGuidance(!1,a,"InitialGuidance"),this.setGuidance(r,a,"MoveCloserGuidance")},setTapShutterToPause:(r,a)=>{this.setGuidance(!1,a,"InitialGuidance"),this.setGuidance(r,a,"TapShutterToPause")},setTapShutterToResume:(r,a)=>{this.setGuidance(!1,a,"InitialGuidance"),this.setGuidance(r,a,"TapShutterResume")}});return new e}};var w=class{constructor(e){this.subscribers=new Set;this.property={key:e,value:null}}addSubscriber(e){var r;this.subscribers.add(e),(r=e.onPropertyChanged)==null||r.call(e,this.property)}removeSubscriber(e){this.subscribers.delete(e)}setProperty(e){var r;if(this.property.value!==e.value){this.property={key:this.property.key,value:e.value};for(let a of this.subscribers)(r=a.onPropertyChanged)==null||r.call(a,this.property)}}};var Ye={torch_state:new w("torch_state"),scanning_mode:new w("scanning_mode"),sound_enabled:new w("sound_enabled"),haptic_enabled:new w("haptic_enabled"),session_stop_reason:new w("session_stop_reason"),camera_position:new w("camera_position")},V=class{getBehaviorSubject(e){return Ye[e]}};var J=class{constructor(e,r,a){this.captureListenerSet=!1;this.propertyPushSource=new V;this.coreEngine=e,this.Module=r,this.workerFunctions=a,this.setup()}sparkScanDidUpdateSession(e){this.workerFunctions.postMessage({type:"sparkScanDidUpdateSession",payload:JSON.parse(e.toJson())})}getSparkScanDeserializer(){return this.sparkScanDeserializer}setup(){let e=this.Module.SparkScanListener.extend("SparkScanListener",{didScan:(i,n,o)=>{this.sparkScanDidScan(n,o),i.delete(),n.delete(),o.delete()},didUpdateSession:(i,n,o)=>{this.sparkScanDidUpdateSession(n),i.delete(),n.delete(),o.delete()}}),r=this.Module.Feedback.extend("Feedback",{emit:()=>{this.successFeedback()}}),a=this.Module.SparkScanDeserializerListener.extend("SparkScanDeserializerListener",{onModeDeserializationFinished:(i,n,o)=>{if(!this.captureListenerSet){n.addListener(new e,1),n.setSuccessFeedback(new r),n.setPropertyPushSource(this.propertyPushSource);let s=this.Module.SparkScanViewHandlerDelegate.extend("SparkScanViewHandlerDelegate",{onSwitchedAwayFromSmartScanSelection:()=>{this.workerFunctions.postMessage({type:"sparkScanSwitchedAwayFromSmartScanSelection"})},onSwitchedToSmartScanSelection:()=>{this.workerFunctions.postMessage({type:"sparkScanSwitchedToSmartScanSelection"})},enableHapticWhenOverlapping:()=>{},onStateTransition:()=>{},resetAllTimers:()=>{}}),c=new s,l=n.getStateMachine();l.setViewHandlerDelegate(c),c.delete(),l.delete(),this.sparkScan=n.clone(),this.captureListenerSet=!0}i.delete(),o.delete(),n.delete()},onModeDeserializationStarted(i,n,o){i.delete(),n.delete(),o.delete()},onSettingsDeserializationStarted(i,n,o){i.delete(),n.delete(),o.delete()},onSettingsDeserializationFinished(i,n,o){i.delete(),n.delete(),o.delete()},onOverlayDeserializationStarted(i,n,o){i.delete(),n.delete(),o.delete()},onOverlayDeserializationFinished:(i,n,o)=>{var s;(s=this.sparkScanOverlay)==null||s.delete(),this.sparkScanOverlay=n,i.delete(),o.delete()}});this.sparkScanDeserializer=new this.Module.SparkScanDeserializer,this.sparkScanDeserializer.setListener(new a)}emitErrorFeedback(e){var r;(r=this.sparkScanOverlay)==null||r.onErrorFeedbackEmitted(e)}overlayReadyForDraw(){var e;(e=this.sparkScanOverlay)==null||e.onReadyForNewData()}analyticsManagerPropertyChanged(e){this.propertyPushSource.getBehaviorSubject(e.key).setProperty(e)}successFeedback(){this.workerFunctions.postMessage({type:"successFeedback"})}selectItemWithSmartScanSelection(){var e;(e=this.sparkScan)==null||e.selectItemWithSmartScanSelectionAsync()}async removeMode(){var e,r;this.captureListenerSet=!1,(e=this.sparkScan)==null||e.delete(),this.sparkScan=void 0,(r=this.sparkScanOverlay)==null||r.delete(),this.sparkScanOverlay=void 0}sparkScanDidScan(e,r){let a=this.coreEngine.prepareFrameForListener(r);this.workerFunctions.postMessage({type:"sparkScanDidScan",payload:{session:JSON.parse(e.toJson()),frameData:a}})}};var U=class extends I{constructor(e,r){super(e,r)}getModeDeserializers(){this.barcodeCaptureMode=new _(this,this.Module,this.workerFunctions),this.barcodeBatchMode=new H(this,this.Module,this.workerFunctions),this.sparkScanMode=new J(this,this.Module,this.workerFunctions),this.barcodeFindMode=new z(this,this.Module,this.workerFunctions),this.barcodeArMode=new N(this,this.Module,this.workerFunctions);let e=super.getModeDeserializers();return e.push_back(this.barcodeCaptureMode.getCaptureDeserializer()),e.push_back(this.barcodeBatchMode.getBatchDeserializer()),e.push_back(this.sparkScanMode.getSparkScanDeserializer()),e}getWasmSideModuleFileName(){return""}getWasmCoreFileName(e,r){return r?e?"scandit-datacapture-sdk-barcode-simd-pthreads.wasm":"scandit-datacapture-sdk-barcode-pthreads.wasm":e?"scandit-datacapture-sdk-barcode-simd.wasm":"scandit-datacapture-sdk-barcode.wasm"}getWasmCoreExpectedHash(e,r){return r?e?"85dc3552838b61f5c0c3a20b03ab3d6ec0ac34536bc3c8ff09ba7943d4cd7dc6":"91e683aec80d2fb4c4f9d7bb123ffca731a534cf8d953c4492a5f84bb9194c01":e?"64914911045cd522d294d10b3d28c425edf22f939eda121165aeb66f9ffe7308":"484c4590bc04b0ce0fc0e0987cd61df91b799f4f4bc782ea0e8a0d7ce0d1a809"}getWasmMetadata(){return u}};function Xe(t){return(r=>/^[$A-Z_a-z][\\w$]*\\s*\\(.*\\)\\s*\\{/.test(r)&&!r.startsWith("function"))(t)?`function ${t}`:t}var Ke=["fetch","XMLHttpRequest","eval","Function","self","globalThis","Module","importScripts","this","console","window","document","import","Worker","ServiceWorker"];function Ze(t){return Ke.map(r=>new RegExp(`\\\\b${r}\\\\b`,"g")).some(r=>r.test(t))}function Be(t){if(t==null)return null;let e=Xe(t);if(Ze(e))throw new Error("Function should be pure. Shouldn\'t introduce side effects, or rely on global scope");let r=`\'use strict\';\n return (${e});`;try{return new Function(r)()}catch{return null}}var $=class extends te{constructor(e,r){super(e,r),this.dataCaptureInstance=new U(r,{postMessage:this.postMessage.bind(this),getOffscreenCanvas:this.getOffscreenCanvas.bind(this)})}async respondWith(e,r,a){let i=null,n;try{n=a(),n instanceof Promise&&(n=await n)}catch(s){n=void 0,i=k(s)}let o={type:"workerTaskId",command:e,id:r,payload:this.hasPayload(n)?n.payload:void 0};i!=null&&(o.error=i),this.postMessage(o,this.hasTransferables(n)?n.transferables:[])}onMessage(e){switch(e.data.command){case"sparkScanEmitErrorFeedback":{let{data:r}=e;return this.respondWith(r.command,r.id,()=>{this.dataCaptureInstance.sparkScanMode.emitErrorFeedback(r.shouldRemoveBrush)}),!0}case"sparkScanOverlayReadyForDraw":{let{data:r}=e;return this.respondWith(r.command,r.id,()=>{this.dataCaptureInstance.sparkScanMode.overlayReadyForDraw()}),!0}case"sparkScanAnalyticsManagerPropertyChanged":{let{data:r}=e;return this.respondWith(r.command,r.id,async()=>{this.dataCaptureInstance.sparkScanMode.analyticsManagerPropertyChanged(r.property)}),!0}case"sparkScanSelectItemWithSmartScanSelection":{let{data:r}=e;return this.respondWith(r.command,r.id,async()=>{this.dataCaptureInstance.sparkScanMode.selectItemWithSmartScanSelection()}),!0}case"sparkScanModeRemove":{let{data:r}=e;return this.respondWith(r.command,r.id,async()=>this.dataCaptureInstance.sparkScanMode.removeMode()),!0}case"barcodeFindForSettings":{let{data:r}=e;return this.respondWith(r.command,r.id,async()=>this.dataCaptureInstance.barcodeFindMode.forSettings(r.settings)),!0}case"barcodeFindModeRemove":{let{data:r}=e;return this.respondWith(r.command,r.id,async()=>this.dataCaptureInstance.barcodeFindMode.removeMode()),!0}case"barcodeFindSearchStart":return this.respondWith(e.data.command,e.data.id,()=>{this.dataCaptureInstance.barcodeFindMode.start()}),!0;case"barcodeFindSearchPause":return this.respondWith(e.data.command,e.data.id,()=>{this.dataCaptureInstance.barcodeFindMode.pause()}),!0;case"barcodeFindSearchStop":return this.respondWith(e.data.command,e.data.id,()=>{this.dataCaptureInstance.barcodeFindMode.stop()}),!0;case"barcodeFindSetItemList":{let{data:r}=e;return this.respondWith(e.data.command,e.data.id,()=>{this.dataCaptureInstance.barcodeFindMode.setItemList(r.itemList)}),!0}case"barcodeFindSetEnabled":{let{data:r}=e;return this.respondWith(e.data.command,e.data.id,()=>{this.dataCaptureInstance.barcodeFindMode.setEnabled(r.enabled)}),!0}case"barcodeFindApplySettings":{let{data:r}=e;return this.respondWith(r.command,r.id,async()=>this.dataCaptureInstance.barcodeFindMode.applySettings(r.settings)),!0}case"barcodeFindAddBasicOverlay":{let{data:r}=e;return this.respondWith(r.command,r.id,async()=>{this.dataCaptureInstance.barcodeFindMode.addBasicOverlay()}),!0}case"barcodeFindRemoveBasicOverlay":{let{data:r}=e;return this.respondWith(r.command,r.id,async()=>{this.dataCaptureInstance.barcodeFindMode.removeBasicOverlay()}),!0}case"barcodeFindUpdateBasicOverlay":{let{data:r}=e;return this.respondWith(r.command,r.id,async()=>{this.dataCaptureInstance.barcodeFindMode.updateBasicOverlay(r.jsonOverlay)}),!0}case"barcodeFindSetTransformerFunction":{let{data:r}=e;return this.respondWith(r.command,r.id,async()=>{let a=Be(r.functionAsString);this.dataCaptureInstance.barcodeFindMode.setTransformerFunction(a)}),!0}case"barcodeArForSettings":{let{data:r}=e;return this.respondWith(r.command,r.id,async()=>this.dataCaptureInstance.barcodeArMode.forSettings(r.settings)),!0}case"barcodeArModeRemove":{let{data:r}=e;return this.respondWith(r.command,r.id,async()=>this.dataCaptureInstance.barcodeArMode.removeMode()),!0}case"barcodeArSearchStart":return this.respondWith(e.data.command,e.data.id,()=>{this.dataCaptureInstance.barcodeArMode.start()}),!0;case"barcodeArSearchPause":return this.respondWith(e.data.command,e.data.id,()=>{this.dataCaptureInstance.barcodeArMode.pause()}),!0;case"barcodeArSearchStop":return this.respondWith(e.data.command,e.data.id,()=>{this.dataCaptureInstance.barcodeArMode.stop()}),!0;case"barcodeArSetEnabled":{let{data:r}=e;return this.respondWith(e.data.command,e.data.id,()=>{this.dataCaptureInstance.barcodeArMode.setEnabled(r.enabled)}),!0}case"barcodeArApplySettings":{let{data:r}=e;return this.respondWith(r.command,r.id,async()=>{this.dataCaptureInstance.barcodeArMode.applySettings(r.settings)}),!0}default:return super.onMessage(e)}}};var Sa=new $(self,{get:()=>self.Module,set:t=>{self.Module=t}});function wa(t){}})();\n'],{type:"application/javascript"})),e=new Worker(n,r);return URL.revokeObjectURL(n),e}var l=class r extends DataCaptureLoader{constructor(){super(...arguments);this._name="BarcodeCapture";}get dataCaptureWorker(){return (this._dataCaptureWorker)!=null||(this._dataCaptureWorker=d({name:this.name})),this._dataCaptureWorker}get name(){return this._name}static async create(e){var a;let t=new r(e);return await t.workerCommand("setLogLevel",{level:(a=e.logLevel)!=null?a:Logger.Level.Debug}),await t.load(),t}async workerCommand(e,t,a){return new Promise((c,o)=>{let i=this.workerCommandId++;this.workerTasks.set(i,{resolve:c,reject:o,command:e});let s={...t,command:e,id:i};this.dataCaptureWorker.postMessage(s,a);})}};
2
+ export{l as a};
@@ -1 +1 @@
1
- var b=Object.defineProperty;var i=Object.getOwnPropertyDescriptor;var p=(r,d,t,s)=>{for(var a=s>1?void 0:s?i(d,t):d,e=r.length-1,c;e>=0;e--)(c=r[e])&&(a=(s?c(d,t,a):c(a))||a);return s&&a&&b(d,t,a),a};var o={"scandit-datacapture-sdk-barcode-pthreads.wasm":{bytes:7955842},"scandit-datacapture-sdk-barcode-simd-pthreads.wasm":{bytes:7872164},"scandit-datacapture-sdk-barcode-simd.wasm":{bytes:7739457},"scandit-datacapture-sdk-barcode.wasm":{bytes:7823444}};export{p as a,o as b};
1
+ var b=Object.defineProperty;var i=Object.getOwnPropertyDescriptor;var p=(r,d,t,s)=>{for(var a=s>1?void 0:s?i(d,t):d,e=r.length-1,c;e>=0;e--)(c=r[e])&&(a=(s?c(d,t,a):c(a))||a);return s&&a&&b(d,t,a),a};var o={"scandit-datacapture-sdk-barcode-pthreads.wasm":{bytes:8225377},"scandit-datacapture-sdk-barcode-simd-pthreads.wasm":{bytes:8116647},"scandit-datacapture-sdk-barcode.wasm":{bytes:8088927},"scandit-datacapture-sdk-barcode-simd.wasm":{bytes:7979742}};export{p as a,o as b};
@@ -1 +1 @@
1
- import {a as a$1}from'./chunk-SNPWBV7Y.js';import {b}from'./chunk-TCXM24SN.js';import {a}from'./chunk-VLGDYIWY.js';import {CameraSettings,convertToPublicFrameData}from'@scandit/web-datacapture-core';import {warnMultithreadingUnavailable}from'@scandit/web-datacapture-core/build/js/private/utils/warnMultithreadingUnavailable.js';var o=class n{constructor(){this.skipSerialization=true;this.type="barcodeAr";this._isEnabled=true;this._context=null;this.listeners=new Set;this.privateListeners=new Set;this.workerMessageListener=this.onWorkerMessage.bind(this);}get context(){return this._context}static createRecommendedCameraSettings(){return new CameraSettings(b)}set context(e){this._context=e;}get allListeners(){return [...this.privateListeners,...this.listeners]}static async forContext(e,t){warnMultithreadingUnavailable();let r=new n;return r.feedback=await a.createDefaultBarcodeArFeedback(),r.settings=t,await e.setMode(r),r}isEnabled(){return this._isEnabled}addListener(e){this.listeners.add(e);}removeListener(e){this.listeners.delete(e);}set feedback(e){this._feedback=e;}get feedback(){return this._feedback}async setEnabled(e){var t;this._isEnabled=e,await this.workerCommand("barcodeArSetEnabled",{enabled:e}),await((t=this.context)==null?void 0:t.update([{type:"modeEnabled",newValue:e}],{updateContext:false}));}async applySettings(e){this.settings=e,await this.workerCommand("barcodeArApplySettings",{settings:e.toJSONObject()});}toJSONObject(){return {type:this.type,enabled:this._isEnabled,settings:this.settings.toJSONObject()}}async attachedToContext(e){this._context=e,this._context.subscribeToWorkerMessages(this.workerMessageListener),await this.workerCommand("barcodeArForSettings",{settings:this.settings.toJSONObject()});}async detachedFromContext(){var e;await this.workerCommand("barcodeArModeRemove",{}),(e=this._context)==null||e.unsubscribeToWorkerMessages(this.workerMessageListener),this._context=null;}async start(){return this.workerCommand("barcodeArSearchStart",{})}async stop(){return this.workerCommand("barcodeArSearchStop",{})}async pause(){return this.workerCommand("barcodeArSearchPause",{})}async workerCommand(e,t){this.context!=null&&await this.context.workerCommand(e,t);}addPrivateListener(e){this.privateListeners.add(e);}removePrivateListener(e){this.privateListeners.delete(e);}async onWorkerMessage(e){var t;switch(e.type){case "barcodeArDidUpdateSession":{if(!this._isEnabled||!this._context)return;for(let r of this.allListeners)(t=r.didUpdateSession)==null||t.call(r,this,a$1.fromJSON(e.payload.session),convertToPublicFrameData(e.payload.frameData,this._context));break}}}};export{o as a};
1
+ import {a as a$1}from'./chunk-SNPWBV7Y.js';import {b}from'./chunk-TCXM24SN.js';import {a}from'./chunk-WIHMN2DS.js';import {CameraSettings,convertToPublicFrameData}from'@scandit/web-datacapture-core';import {warnMultithreadingUnavailable}from'@scandit/web-datacapture-core/build/js/private/utils/warnMultithreadingUnavailable.js';var o=class n{constructor(){this.skipSerialization=true;this.type="barcodeAr";this._isEnabled=true;this._context=null;this.listeners=new Set;this.privateListeners=new Set;this.workerMessageListener=this.onWorkerMessage.bind(this);}get context(){return this._context}static createRecommendedCameraSettings(){return new CameraSettings(b)}set context(e){this._context=e;}get allListeners(){return [...this.privateListeners,...this.listeners]}static async forContext(e,t){warnMultithreadingUnavailable();let r=new n;return r.feedback=await a.createDefaultBarcodeArFeedback(),r.settings=t,await e.setMode(r),r}isEnabled(){return this._isEnabled}addListener(e){this.listeners.add(e);}removeListener(e){this.listeners.delete(e);}set feedback(e){this._feedback=e;}get feedback(){return this._feedback}async setEnabled(e){var t;this._isEnabled=e,await this.workerCommand("barcodeArSetEnabled",{enabled:e}),await((t=this.context)==null?void 0:t.update([{type:"modeEnabled",newValue:e}],{updateContext:false}));}async applySettings(e){this.settings=e,await this.workerCommand("barcodeArApplySettings",{settings:e.toJSONObject()});}toJSONObject(){return {type:this.type,enabled:this._isEnabled,settings:this.settings.toJSONObject()}}async attachedToContext(e){this._context=e,this._context.subscribeToWorkerMessages(this.workerMessageListener),await this.workerCommand("barcodeArForSettings",{settings:this.settings.toJSONObject()});}async detachedFromContext(){var e;await this.workerCommand("barcodeArModeRemove",{}),(e=this._context)==null||e.unsubscribeToWorkerMessages(this.workerMessageListener),this._context=null;}async start(){return this.workerCommand("barcodeArSearchStart",{})}async stop(){return this.workerCommand("barcodeArSearchStop",{})}async pause(){return this.workerCommand("barcodeArSearchPause",{})}async workerCommand(e,t){this.context!=null&&await this.context.workerCommand(e,t);}addPrivateListener(e){this.privateListeners.add(e);}removePrivateListener(e){this.privateListeners.delete(e);}async onWorkerMessage(e){var t;switch(e.type){case "barcodeArDidUpdateSession":{if(!this._isEnabled||!this._context)return;for(let r of this.allListeners)(t=r.didUpdateSession)==null||t.call(r,this,a$1.fromJSON(e.payload.session),convertToPublicFrameData(e.payload.frameData,this._context));break}}}};export{o as a};