@scandit/web-datacapture-core 8.4.0-beta.1 → 8.4.0

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 (90) hide show
  1. package/build/js/Camera.js +1 -1
  2. package/build/js/{DataCaptureContext-qacCkSOl.d.ts → DataCaptureContext-Qg40v7QA.d.ts} +1 -1
  3. package/build/js/DataCaptureContext.d.ts +1 -1
  4. package/build/js/DataCaptureContext.js +1 -1
  5. package/build/js/DataCaptureContextRelated.d.ts +1 -1
  6. package/build/js/DataCaptureVersion.js +1 -1
  7. package/build/js/DataCaptureView.d.ts +1 -1
  8. package/build/js/DataCaptureView.js +1 -1
  9. package/build/js/FrameData.d.ts +1 -1
  10. package/build/js/ImageFrameSource.js +1 -1
  11. package/build/js/NotificationPresenter/index.d.ts +1 -1
  12. package/build/js/NotificationPresenter/index.js +1 -1
  13. package/build/js/NotificationPresenter/private/ConcreteNotificationPresenter.d.ts +1 -1
  14. package/build/js/NotificationPresenter/private/presets.d.ts +1 -1
  15. package/build/js/ScanditIconBuilder.js +1 -1
  16. package/build/js/chunks/{chunk-AD77NFCP.js → chunk-43GCMDYV.js} +1 -1
  17. package/build/js/chunks/{chunk-56OQ5EHO.js → chunk-6V2N4XHI.js} +1 -1
  18. package/build/js/chunks/{chunk-ZP3YIZEC.js → chunk-ALQOQOAM.js} +1 -1
  19. package/build/js/chunks/{chunk-CA6FHIF6.js → chunk-CZI3JAVS.js} +1 -1
  20. package/build/js/chunks/{chunk-2UHUEJA4.js → chunk-DGDPZ73X.js} +1 -1
  21. package/build/js/chunks/{chunk-H3J4TP2K.js → chunk-G7ORIX4S.js} +1 -1
  22. package/build/js/chunks/{chunk-GMOTHEWV.js → chunk-GHR3BSUQ.js} +1 -1
  23. package/build/js/chunks/{chunk-ZTKCGHYQ.js → chunk-GULNUBED.js} +1 -1
  24. package/build/js/chunks/chunk-HBPGHXF2.js +1 -0
  25. package/build/js/chunks/{chunk-XUIVDVLK.js → chunk-KZEBJGMU.js} +1 -1
  26. package/build/js/chunks/{chunk-P2R7FW6C.js → chunk-MBQZOWWF.js} +1 -1
  27. package/build/js/chunks/{chunk-JLTSTUKY.js → chunk-TMIZ6Z75.js} +1 -1
  28. package/build/js/chunks/{chunk-WOOPJWJS.js → chunk-XFQTFQYR.js} +1 -1
  29. package/build/js/chunks/{chunk-ACCTMSWC.js → chunk-Z5LRFYGI.js} +1 -1
  30. package/build/js/chunks/chunk-ZCF62ALL.js +1 -0
  31. package/build/js/controls/CameraFOVSwitchControl.d.ts +1 -1
  32. package/build/js/controls/CameraFOVSwitchControl.js +1 -1
  33. package/build/js/controls/CameraSwitchControl.d.ts +1 -1
  34. package/build/js/controls/CameraSwitchControl.js +1 -1
  35. package/build/js/controls/TorchSwitchControl.d.ts +1 -1
  36. package/build/js/controls/TorchSwitchControl.js +1 -1
  37. package/build/js/controls/ZoomSwitchControl.d.ts +1 -1
  38. package/build/js/controls/ZoomSwitchControl.js +1 -1
  39. package/build/js/controls/common.d.ts +1 -1
  40. package/build/js/controls/index.d.ts +1 -1
  41. package/build/js/controls/index.js +1 -1
  42. package/build/js/defaults/DefaultsCamera.d.ts +1 -1
  43. package/build/js/defaults/DefaultsDataCaptureView.js +1 -1
  44. package/build/js/index.d.ts +1 -1
  45. package/build/js/index.js +1 -1
  46. package/build/js/moduleLoader.d.ts +1 -1
  47. package/build/js/private/CameraManager.d.ts +1 -1
  48. package/build/js/private/CameraManager.js +1 -1
  49. package/build/js/private/CameraPool.d.ts +1 -1
  50. package/build/js/private/CanvasDrawerWithMetrics.d.ts +1 -1
  51. package/build/js/private/CoreModuleLicenseTextProvider.d.ts +1 -1
  52. package/build/js/private/CoreModuleLicenseTextProvider.js +1 -1
  53. package/build/js/private/CustomLocationsView.js +1 -1
  54. package/build/js/private/DataCaptureContextRelated.d.ts +1 -1
  55. package/build/js/private/FrameReaders/FrameReader.d.ts +1 -1
  56. package/build/js/private/FrameReaders/FrameReader.js +1 -1
  57. package/build/js/private/FrameReaders/FrameReaderAbstract.d.ts +1 -1
  58. package/build/js/private/FrameReaders/GrayScaleFrameReader.d.ts +1 -1
  59. package/build/js/private/FrameReaders/GrayScaleFrameReader.js +1 -1
  60. package/build/js/private/FrameReaders/index.d.ts +1 -1
  61. package/build/js/private/FrameReaders/index.js +1 -1
  62. package/build/js/private/NormalizedModuleLoaderOptions.d.ts +1 -1
  63. package/build/js/private/SingleImageUploaderView.d.ts +1 -1
  64. package/build/js/private/SingleImageUploaderView.js +1 -1
  65. package/build/js/private/ViewControls+related.js +1 -1
  66. package/build/js/private/ViewControls_related.d.ts +1 -1
  67. package/build/js/private/ViewsRegistry.d.ts +1 -1
  68. package/build/js/private/ui/atoms/Toast.d.ts +1 -1
  69. package/build/js/private/ui/molecules/CameraFOVSwitchButton.js +1 -1
  70. package/build/js/private/ui/molecules/CameraSwitchButton.js +1 -1
  71. package/build/js/private/ui/molecules/HintPresenter.d.ts +1 -1
  72. package/build/js/private/utils/index.js +1 -1
  73. package/build/js/private/utils/replaceImagesInViewUtils.d.ts +1 -1
  74. package/build/js/worker/ImageConverterForwarder.d.ts +1 -1
  75. package/build/js/worker/ViewInfoHelper.d.ts +1 -1
  76. package/build/js/worker/WorkerMain.d.ts +1 -1
  77. package/build/js/worker/WorkerMain.js +1 -1
  78. package/build/js/worker/coreCapture.inlineWorker.d.ts +1 -1
  79. package/build/js/worker/coreCapture.inlineWorker.js +1 -1
  80. package/build/js/worker/dataCaptureEngine.d.ts +1 -1
  81. package/build/js/worker/dataCaptureEngine.js +1 -1
  82. package/build/js/worker/dataCaptureLoader.d.ts +1 -1
  83. package/build/js/worker/dataCaptureWorkerRelated.d.ts +1 -1
  84. package/build/js/worker/index.d.ts +1 -1
  85. package/build/js/worker/index.js +1 -1
  86. package/package.json +1 -1
  87. package/build/js/chunks/chunk-LPFXHHWJ.js +0 -1
  88. package/build/js/chunks/chunk-P3NPNIWR.js +0 -1
  89. /package/build/js/chunks/{chunk-AC4QOIY7.js → chunk-J3HHOJE3.js} +0 -0
  90. /package/build/js/chunks/{chunk-WHRRC6V6.js → chunk-W7VB532D.js} +0 -0
@@ -1 +1 @@
1
- export{a as Camera}from'./chunks/chunk-GMOTHEWV.js';
1
+ export{a as Camera}from'./chunks/chunk-GHR3BSUQ.js';
@@ -1737,4 +1737,4 @@ declare class DataCaptureContext implements Serializable<DataCaptureContextJSON>
1737
1737
  protected isFeatureSupported(feature: LicensedFeature): Promise<boolean>;
1738
1738
  }
1739
1739
 
1740
- export { type ConvertToJPEGResultDataCaptureAction as $, type PrivateFrameHandlerResponse as A, type PrivateLoadableFrameData as B, type Control as C, type DataCaptureComponent as D, PrivateMirrorAxis as E, type FrameData as F, convertToPublicFrameData as G, HintPresenter as H, type PerformanceMetrics as I, type FrameId as J, DataCaptureEngine as K, type Module as L, type ModuleLoader as M, type GenericHint as N, type FrameCapture as O, type PrivateCapabilityInfo as P, type AnyDataCaptureActionMessage as Q, type AugmentedWorker as R, type ModuleHandler as S, type DataCaptureCallbackMessage as T, type DataCaptureActionMessageKey as U, type ViewInfo as V, type WorkerFunctions as W, type EngineWorkerResponse as X, type AddNativeOverlayAction as Y, type BatteryData as Z, type CaptureModeDeserializerInstance as _, type ControlType as a, type SetLogLevelDataCaptureAction as a$, type CreateContextDataCaptureAction as a0, type CreateContextParameters as a1, type DataCaptureCallbackMessageKeys as a2, type DataCaptureContext$1 as a3, type DataCaptureContextDeserializer as a4, type DataCaptureContextDeserializerResult as a5, type DataCaptureImageBufferFrameSource as a6, type DataCaptureView as a7, type DataCaptureWorker as a8, type DeleteFrameDataDataCaptureAction as a9, type HintStyle as aA, HintTextAlignment as aB, HintWidth as aC, type IsFeatureSupportedAction as aD, type IsFeatureSupportedMessage as aE, type IsFeatureSupportedResponse as aF, type JSONParseable as aG, LicensedFeature as aH, type LoadLibraryDataCaptureAction as aI, type LoadLibraryParameters as aJ, type ModuleMirrorAxis as aK, type OnFrameProcessingFinishedMessage as aL, type OnFrameProcessingStartedMessage as aM, type OnFrameSkippedMessage as aN, type OnTapAction as aO, type PayloadForCommand as aP, type PerformanceMetricsReportMessage as aQ, type PlatformHintPresenter as aR, type ProcessFrameDataCaptureAction as aS, type ProcessFrameParameters as aT, type RemoveNativeOverlayAction as aU, type ReportCameraPropertiesDataCaptureAction as aV, type ReportCameraPropertiesParameters as aW, type RequestFrameDataDataCaptureAction as aX, type RequestFrameDataResponse as aY, type SetFrameSourceDataCaptureAction as aZ, type SetFrameSourceParameters as a_, type DeviceInterfaceInstance as aa, type DidTapTrackedBarcode as ab, type DisposeDataCaptureAction as ac, type EmscriptenClassHandle as ad, type ExtractCentaurusLicenseDataCaptureAction as ae, type ExtractCentaurusLicenseResponse as af, type FlushAnalyticsDataCaptureAction as ag, type GestureListener as ah, type GestureRecognizer as ai, type GetOpenSourceSoftwareLicenseInfoAction as aj, type GetOpenSourceSoftwareLicenseInfoResponse as ak, type GetViewfinderInfoAction as al, type GetViewfinderInfoResponse as am, type GuidanceHint as an, GuidanceHintAnchor as ao, GuidanceHintStyle as ap, type HideGuidanceMessage as aq, type HideHintWorkerMessage as ar, type HideToastMessage as as, HintAnchor as at, HintCornerStyle as au, HintFont as av, HintHeight as aw, HintIcon as ax, type HintPresenterV2 as ay, type HintPresenterV2updateAction as az, type Change as b, type ShowGuidanceMessage as b0, type ShowHintWorkerMessage as b1, type ShowToastMessage as b2, type StartUpdateTimerMessage as b3, type StopUpdateTimerMessage as b4, type SuccessFeedbackWorkerMessage as b5, type ToastHint as b6, ToastHintStyle as b7, type UpdateBatteryInfoDataCaptureAction as b8, type UpdateContextDataCaptureAction as b9, type UpdateContextParameters as ba, type UpdateHintWorkerMessage as bb, type Vector as bc, type ViewSizeChangedMessage as bd, type VisibilityChangeAction as be, type WasmFeedback as bf, type WasmFrameData as bg, type WorkerResponse as bh, type PrivateBaseControl as bi, type PrivateControl as bj, CameraManager as bk, CameraManagerEvent as bl, type CameraManagerEventParameters as bm, CameraResolutionConstraint as bn, type ExtendedMediaTrackCapabilities as bo, type ExtendedMediaTrackConstraintSet as bp, type GUI as bq, MeteringMode as br, createFrameId as bs, HintPresenterEvents as bt, ContextStatus as c, type ContextStatusJSON as d, type DataCaptureComponentJSON as e, DataCaptureContext as f, type DataCaptureContextCreationOptions as g, type DataCaptureContextJSON as h, type DataCaptureContextListener as i, type DataCaptureContextState as j, DataCaptureLoader as k, type DataCaptureLoaderOptions as l, type DataCaptureMode as m, type DataCaptureModeJSON as n, type DataCaptureOverlay as o, DataCaptureView$1 as p, type DataCaptureViewConnectOptions as q, type DataCaptureViewJSON as r, type DataCaptureViewListener as s, type ModuleLoaderOptions as t, type PrivateChangeSet as u, type PrivateDataCaptureComponent as v, type PrivateDataCaptureContext as w, type PrivateDataCaptureContextOptions as x, type PrivateDataCaptureMode as y, type PrivateFrameHandler as z };
1740
+ export { type ConvertToJPEGResultDataCaptureAction as $, type PrivateFrameHandlerResponse as A, type PrivateLoadableFrameData as B, type Control as C, type DataCaptureComponent as D, PrivateMirrorAxis as E, type FrameData as F, convertToPublicFrameData as G, HintPresenter as H, DataCaptureEngine as I, type Module as J, type PerformanceMetrics as K, type FrameId as L, type ModuleLoader as M, type GenericHint as N, type FrameCapture as O, type PrivateCapabilityInfo as P, type AnyDataCaptureActionMessage as Q, type AugmentedWorker as R, type ModuleHandler as S, type DataCaptureCallbackMessage as T, type DataCaptureActionMessageKey as U, type ViewInfo as V, type WorkerFunctions as W, type EngineWorkerResponse as X, type AddNativeOverlayAction as Y, type BatteryData as Z, type CaptureModeDeserializerInstance as _, type ControlType as a, type SetLogLevelDataCaptureAction as a$, type CreateContextDataCaptureAction as a0, type CreateContextParameters as a1, type DataCaptureCallbackMessageKeys as a2, type DataCaptureContext$1 as a3, type DataCaptureContextDeserializer as a4, type DataCaptureContextDeserializerResult as a5, type DataCaptureImageBufferFrameSource as a6, type DataCaptureView as a7, type DataCaptureWorker as a8, type DeleteFrameDataDataCaptureAction as a9, type HintStyle as aA, HintTextAlignment as aB, HintWidth as aC, type IsFeatureSupportedAction as aD, type IsFeatureSupportedMessage as aE, type IsFeatureSupportedResponse as aF, type JSONParseable as aG, LicensedFeature as aH, type LoadLibraryDataCaptureAction as aI, type LoadLibraryParameters as aJ, type ModuleMirrorAxis as aK, type OnFrameProcessingFinishedMessage as aL, type OnFrameProcessingStartedMessage as aM, type OnFrameSkippedMessage as aN, type OnTapAction as aO, type PayloadForCommand as aP, type PerformanceMetricsReportMessage as aQ, type PlatformHintPresenter as aR, type ProcessFrameDataCaptureAction as aS, type ProcessFrameParameters as aT, type RemoveNativeOverlayAction as aU, type ReportCameraPropertiesDataCaptureAction as aV, type ReportCameraPropertiesParameters as aW, type RequestFrameDataDataCaptureAction as aX, type RequestFrameDataResponse as aY, type SetFrameSourceDataCaptureAction as aZ, type SetFrameSourceParameters as a_, type DeviceInterfaceInstance as aa, type DidTapTrackedBarcode as ab, type DisposeDataCaptureAction as ac, type EmscriptenClassHandle as ad, type ExtractCentaurusLicenseDataCaptureAction as ae, type ExtractCentaurusLicenseResponse as af, type FlushAnalyticsDataCaptureAction as ag, type GestureListener as ah, type GestureRecognizer as ai, type GetOpenSourceSoftwareLicenseInfoAction as aj, type GetOpenSourceSoftwareLicenseInfoResponse as ak, type GetViewfinderInfoAction as al, type GetViewfinderInfoResponse as am, type GuidanceHint as an, GuidanceHintAnchor as ao, GuidanceHintStyle as ap, type HideGuidanceMessage as aq, type HideHintWorkerMessage as ar, type HideToastMessage as as, HintAnchor as at, HintCornerStyle as au, HintFont as av, HintHeight as aw, HintIcon as ax, type HintPresenterV2 as ay, type HintPresenterV2updateAction as az, type Change as b, type ShowGuidanceMessage as b0, type ShowHintWorkerMessage as b1, type ShowToastMessage as b2, type StartUpdateTimerMessage as b3, type StopUpdateTimerMessage as b4, type SuccessFeedbackWorkerMessage as b5, type ToastHint as b6, ToastHintStyle as b7, type UpdateBatteryInfoDataCaptureAction as b8, type UpdateContextDataCaptureAction as b9, type UpdateContextParameters as ba, type UpdateHintWorkerMessage as bb, type Vector as bc, type ViewSizeChangedMessage as bd, type VisibilityChangeAction as be, type WasmFeedback as bf, type WasmFrameData as bg, type WorkerResponse as bh, type PrivateBaseControl as bi, type PrivateControl as bj, CameraManager as bk, CameraManagerEvent as bl, type CameraManagerEventParameters as bm, CameraResolutionConstraint as bn, type ExtendedMediaTrackCapabilities as bo, type ExtendedMediaTrackConstraintSet as bp, type GUI as bq, MeteringMode as br, createFrameId as bs, HintPresenterEvents as bt, ContextStatus as c, type ContextStatusJSON as d, type DataCaptureComponentJSON as e, DataCaptureContext as f, type DataCaptureContextCreationOptions as g, type DataCaptureContextJSON as h, type DataCaptureContextListener as i, type DataCaptureContextState as j, DataCaptureLoader as k, type DataCaptureLoaderOptions as l, type DataCaptureMode as m, type DataCaptureModeJSON as n, type DataCaptureOverlay as o, DataCaptureView$1 as p, type DataCaptureViewConnectOptions as q, type DataCaptureViewJSON as r, type DataCaptureViewListener as s, type ModuleLoaderOptions as t, type PrivateChangeSet as u, type PrivateDataCaptureComponent as v, type PrivateDataCaptureContext as w, type PrivateDataCaptureContextOptions as x, type PrivateDataCaptureMode as y, type PrivateFrameHandler as z };
@@ -1,6 +1,6 @@
1
1
  /// <reference types="emscripten" />
2
2
  import './Camera-HgH6fwnW.js';
3
- export { b as Change, D as DataCaptureComponent, e as DataCaptureComponentJSON, f as DataCaptureContext, g as DataCaptureContextCreationOptions, h as DataCaptureContextJSON, j as DataCaptureContextState, m as DataCaptureMode, n as DataCaptureModeJSON, t as ModuleLoaderOptions, P as PrivateCapabilityInfo, u as PrivateChangeSet, v as PrivateDataCaptureComponent, w as PrivateDataCaptureContext, x as PrivateDataCaptureContextOptions, y as PrivateDataCaptureMode, z as PrivateFrameHandler, A as PrivateFrameHandlerResponse } from './DataCaptureContext-qacCkSOl.js';
3
+ export { b as Change, D as DataCaptureComponent, e as DataCaptureComponentJSON, f as DataCaptureContext, g as DataCaptureContextCreationOptions, h as DataCaptureContextJSON, j as DataCaptureContextState, m as DataCaptureMode, n as DataCaptureModeJSON, t as ModuleLoaderOptions, P as PrivateCapabilityInfo, u as PrivateChangeSet, v as PrivateDataCaptureComponent, w as PrivateDataCaptureContext, x as PrivateDataCaptureContextOptions, y as PrivateDataCaptureMode, z as PrivateFrameHandler, A as PrivateFrameHandlerResponse } from './DataCaptureContext-Qg40v7QA.js';
4
4
  import './DataCaptureContextSettings.js';
5
5
  import './commons/JSONType.js';
6
6
  import './commons/Orientation.js';
@@ -1 +1 @@
1
- export{b as DataCaptureContext}from'./chunks/chunk-XUIVDVLK.js';
1
+ export{b as DataCaptureContext}from'./chunks/chunk-KZEBJGMU.js';
@@ -1,5 +1,5 @@
1
1
  /// <reference types="emscripten" />
2
- export { c as ContextStatus, d as ContextStatusJSON, i as DataCaptureContextListener, E as PrivateMirrorAxis } from './DataCaptureContext-qacCkSOl.js';
2
+ export { c as ContextStatus, d as ContextStatusJSON, i as DataCaptureContextListener, E as PrivateMirrorAxis } from './DataCaptureContext-Qg40v7QA.js';
3
3
  import './Camera-HgH6fwnW.js';
4
4
  import './ScanditIcon.js';
5
5
  import './DataCaptureContextSettings.js';
@@ -1 +1 @@
1
- export{a as DataCaptureVersion}from'./chunks/chunk-P3NPNIWR.js';
1
+ export{a as DataCaptureVersion}from'./chunks/chunk-HBPGHXF2.js';
@@ -1,6 +1,6 @@
1
1
  /// <reference types="emscripten" />
2
2
  import './Camera-HgH6fwnW.js';
3
- export { o as DataCaptureOverlay, p as DataCaptureView, q as DataCaptureViewConnectOptions, r as DataCaptureViewJSON, s as DataCaptureViewListener } from './DataCaptureContext-qacCkSOl.js';
3
+ export { o as DataCaptureOverlay, p as DataCaptureView, q as DataCaptureViewConnectOptions, r as DataCaptureViewJSON, s as DataCaptureViewListener } from './DataCaptureContext-Qg40v7QA.js';
4
4
  import './DataCaptureViewPlusRelated-BOrDBPHq.js';
5
5
  import './NotificationPresenter/NotificationPresenter.js';
6
6
  import './commons/Anchor.js';
@@ -1 +1 @@
1
- export{a as DataCaptureView}from'./chunks/chunk-H3J4TP2K.js';
1
+ export{a as DataCaptureView}from'./chunks/chunk-G7ORIX4S.js';
@@ -1,5 +1,5 @@
1
1
  /// <reference types="emscripten" />
2
- export { F as FrameData, B as PrivateLoadableFrameData, G as convertToPublicFrameData } from './DataCaptureContext-qacCkSOl.js';
2
+ export { F as FrameData, B as PrivateLoadableFrameData, G as convertToPublicFrameData } from './DataCaptureContext-Qg40v7QA.js';
3
3
  import './ScanditIcon.js';
4
4
  import './Camera-HgH6fwnW.js';
5
5
  import './commons/Rect.js';
@@ -1 +1 @@
1
- export{a as ImageFrameSource}from'./chunks/chunk-AD77NFCP.js';
1
+ export{a as ImageFrameSource}from'./chunks/chunk-43GCMDYV.js';
@@ -8,7 +8,7 @@ import '../commons/Color.js';
8
8
  import '../private/Serializable.js';
9
9
  import '../ScanditIcon.js';
10
10
  import '../private/utils/ScanditHTMLElement.js';
11
- import '../DataCaptureContext-qacCkSOl.js';
11
+ import '../DataCaptureContext-Qg40v7QA.js';
12
12
  import '../Camera-HgH6fwnW.js';
13
13
  import '../commons/Rect.js';
14
14
  import '../commons/Point.js';
@@ -1 +1 @@
1
- export{a as NotificationBuilder}from'../chunks/chunk-5LXHD7FZ.js';export{a as ConcreteNotificationPresenter}from'../chunks/chunk-I6SWF3FQ.js';export{a as NotificationStyle}from'../chunks/chunk-RXT3JWWR.js';export{a as NotificationConfiguration}from'../chunks/chunk-CRUOVJHW.js';
1
+ export{a as NotificationBuilder}from'../chunks/chunk-5LXHD7FZ.js';export{a as ConcreteNotificationPresenter}from'../chunks/chunk-I6SWF3FQ.js';export{a as NotificationConfiguration}from'../chunks/chunk-CRUOVJHW.js';export{a as NotificationStyle}from'../chunks/chunk-RXT3JWWR.js';
@@ -1,5 +1,5 @@
1
1
  /// <reference types="emscripten" />
2
- import { H as HintPresenter } from '../../DataCaptureContext-qacCkSOl.js';
2
+ import { H as HintPresenter } from '../../DataCaptureContext-Qg40v7QA.js';
3
3
  import { NotificationConfiguration } from '../NotificationConfiguration.js';
4
4
  import { NotificationPresenter } from '../NotificationPresenter.js';
5
5
  import '../../Camera-HgH6fwnW.js';
@@ -1,5 +1,5 @@
1
1
  /// <reference types="emscripten" />
2
- import { N as GenericHint } from '../../DataCaptureContext-qacCkSOl.js';
2
+ import { N as GenericHint } from '../../DataCaptureContext-Qg40v7QA.js';
3
3
  import { NotificationConfiguration } from '../NotificationConfiguration.js';
4
4
  import '../../Camera-HgH6fwnW.js';
5
5
  import '../../commons/Rect.js';
@@ -1 +1 @@
1
- export{c as ScanditIconBuilder,b as ScanditIconForIconType,a as ScanditIconType}from'./chunks/chunk-WHRRC6V6.js';export{a as ScanditIconShape}from'./chunks/chunk-O4HDBWKK.js';
1
+ export{c as ScanditIconBuilder,b as ScanditIconForIconType,a as ScanditIconType}from'./chunks/chunk-W7VB532D.js';export{a as ScanditIconShape}from'./chunks/chunk-O4HDBWKK.js';
@@ -1 +1 @@
1
- import {e}from'./chunk-CA6FHIF6.js';import {a as a$1}from'./chunk-XR65N6EG.js';import {a}from'./chunk-QCZSSQAQ.js';var m=class i{constructor(){this.type="imageFrameSource";this._listeners=new Set;this._currentState="off";this._desiredState="off";this._context=null;this._imageData=null;}get desiredState(){return this._desiredState}get context(){return this._context}set context(e){this._context=e;}get currentState(){return this._currentState}static async fromFile(e){let r=URL.createObjectURL(e),t=new Image;t.src=r;try{await t.decode();}catch{throw new a({name:"InvalidImageError",message:"Submitted file is not an image"})}finally{URL.revokeObjectURL(r);}return i.fromImage(t)}static async fromImage(e){let r=new i;try{await e.decode();}catch{throw new a({name:"InvalidImageError",message:"Submitted image cannot be decoded"})}let t=r.getCanvasAndContext(e.width,e.height);return t.drawImage(e,0,0),r._imageData=t.getImageData(0,0,e.width,e.height,{colorSpace:"srgb"}),r}static async fromImageData(e){let r=new i,t=r.getCanvasAndContext(e.width,e.height);try{t.putImageData(e,0,0);}catch(n){throw new a({name:"InvalidImageError",message:`Submitted image data does not seem valid (details: ${n})`})}return r._imageData=e,r}async switchToDesiredState(e){if(e==="on"){if(this.currentState==="on")return}else if(this.currentState==="off")return;if(this._desiredState=e,e==="off"){await this.setCurrentState("off");return}return this._imageData==null?(a$1.log(a$1.Level.Warn,"No image data to process."),this.processSubmittedImage({data:new Uint8ClampedArray(0),width:0,height:0,colorSpace:"srgb"})):this.processSubmittedImage(this._imageData)}addListener(e){e!=null&&this._listeners.add(e);}removeListener(e){e!=null&&this._listeners.delete(e);}toJSONObject(){return {type:this.type}}getCurrentState(){return this._currentState}getCanvasAndContext(e,r){let t=document.createElement("canvas");t.width=e,t.height=r;let n=t.getContext("2d");if(n==null)throw new a({name:"ImageFrameSourceError",message:"Could not generate a canvas context to get image data"});return n}async setCurrentState(e){if(e!==this._currentState)return this._currentState=e,this.notifyListeners(),this.notifyContext({type:"frameSourceState",newValue:e})}async notifyContext(e){if(this._context)return this._context.update([e])}notifyListeners(){for(let e of this._listeners)e.didChangeState&&e.didChangeState(this,this.currentState);}async processSubmittedImage(e$1){var t;await this.setCurrentState("on");let r={data:e$1.data,width:e$1.width,height:e$1.height,frameId:e()};await((t=this._context)==null?void 0:t.sendFrameToProcessor(r)),await this.setCurrentState("off");}};export{m as a};
1
+ import {e}from'./chunk-CZI3JAVS.js';import {a as a$1}from'./chunk-XR65N6EG.js';import {a}from'./chunk-QCZSSQAQ.js';var m=class i{constructor(){this.type="imageFrameSource";this._listeners=new Set;this._currentState="off";this._desiredState="off";this._context=null;this._imageData=null;}get desiredState(){return this._desiredState}get context(){return this._context}set context(e){this._context=e;}get currentState(){return this._currentState}static async fromFile(e){let r=URL.createObjectURL(e),t=new Image;t.src=r;try{await t.decode();}catch{throw new a({name:"InvalidImageError",message:"Submitted file is not an image"})}finally{URL.revokeObjectURL(r);}return i.fromImage(t)}static async fromImage(e){let r=new i;try{await e.decode();}catch{throw new a({name:"InvalidImageError",message:"Submitted image cannot be decoded"})}let t=r.getCanvasAndContext(e.width,e.height);return t.drawImage(e,0,0),r._imageData=t.getImageData(0,0,e.width,e.height,{colorSpace:"srgb"}),r}static async fromImageData(e){let r=new i,t=r.getCanvasAndContext(e.width,e.height);try{t.putImageData(e,0,0);}catch(n){throw new a({name:"InvalidImageError",message:`Submitted image data does not seem valid (details: ${n})`})}return r._imageData=e,r}async switchToDesiredState(e){if(e==="on"){if(this.currentState==="on")return}else if(this.currentState==="off")return;if(this._desiredState=e,e==="off"){await this.setCurrentState("off");return}return this._imageData==null?(a$1.log(a$1.Level.Warn,"No image data to process."),this.processSubmittedImage({data:new Uint8ClampedArray(0),width:0,height:0,colorSpace:"srgb"})):this.processSubmittedImage(this._imageData)}addListener(e){e!=null&&this._listeners.add(e);}removeListener(e){e!=null&&this._listeners.delete(e);}toJSONObject(){return {type:this.type}}getCurrentState(){return this._currentState}getCanvasAndContext(e,r){let t=document.createElement("canvas");t.width=e,t.height=r;let n=t.getContext("2d");if(n==null)throw new a({name:"ImageFrameSourceError",message:"Could not generate a canvas context to get image data"});return n}async setCurrentState(e){if(e!==this._currentState)return this._currentState=e,this.notifyListeners(),this.notifyContext({type:"frameSourceState",newValue:e})}async notifyContext(e){if(this._context)return this._context.update([e])}notifyListeners(){for(let e of this._listeners)e.didChangeState&&e.didChangeState(this,this.currentState);}async processSubmittedImage(e$1){var t;await this.setCurrentState("on");let r={data:e$1.data,width:e$1.width,height:e$1.height,frameId:e()};await((t=this._context)==null?void 0:t.sendFrameToProcessor(r)),await this.setCurrentState("off");}};export{m as a};
@@ -1 +1 @@
1
- import {a as a$1}from'./chunk-BDGRWHLY.js';import {a}from'./chunk-MA6UDVDJ.js';import {c}from'./chunk-4QJAB4PO.js';var r={focusGesture:null,zoomGestures:[new c],logoAnchor:"bottomRight",logoStyle:"extended",logoOffset:a$1.fromJSON({x:{value:0,unit:"fraction"},y:{value:0,unit:"fraction"}}),pointOfInterest:a$1.fromJSON({x:{value:.5,unit:"fraction"},y:{value:.5,unit:"fraction"}}),scanAreaMargins:a.fromJSON({left:{value:0,unit:"fraction"},right:{value:0,unit:"fraction"},top:{value:0,unit:"fraction"},bottom:{value:0,unit:"fraction"}}),cameraRecoveryText:"(This text is updated from translations)"};export{r as a};
1
+ import {a}from'./chunk-MA6UDVDJ.js';import {a as a$1}from'./chunk-BDGRWHLY.js';import {c}from'./chunk-4QJAB4PO.js';var r={focusGesture:null,zoomGestures:[new c],logoAnchor:"bottomRight",logoStyle:"extended",logoOffset:a$1.fromJSON({x:{value:0,unit:"fraction"},y:{value:0,unit:"fraction"}}),pointOfInterest:a$1.fromJSON({x:{value:.5,unit:"fraction"},y:{value:.5,unit:"fraction"}}),scanAreaMargins:a.fromJSON({left:{value:0,unit:"fraction"},right:{value:0,unit:"fraction"},top:{value:0,unit:"fraction"},bottom:{value:0,unit:"fraction"}}),cameraRecoveryText:"(This text is updated from translations)"};export{r as a};
@@ -1 +1 @@
1
- import {a}from'./chunk-GMOTHEWV.js';import {d}from'./chunk-YUZDO2PC.js';import {b}from'./chunk-YONR3EGV.js';import {f,g}from'./chunk-D222MT4V.js';var c=class{constructor(){this.type="camera-fov";this.customIcons={wide:{idle:"",pressed:""},ultraWide:{idle:"",pressed:""}};this.fovSwitchButton=void 0;this.CameraFOVSwitchButtonClass=void 0;this.currentFrameSource=null;this.view=void 0;this.onCameraFOVChanged=this.handleCameraFOVChanged.bind(this);this.isTransitioning=false;}get cameraFOVWideImage(){return this.customIcons.wide.idle}set cameraFOVWideImage(e){this.customIcons.wide.idle=e,this.applyCustomImagesToButton();}get cameraFOVWidePressedImage(){return this.customIcons.wide.pressed}set cameraFOVWidePressedImage(e){this.customIcons.wide.pressed=e,this.applyCustomImagesToButton();}get cameraFOVUltraWideImage(){return this.customIcons.ultraWide.idle}set cameraFOVUltraWideImage(e){this.customIcons.ultraWide.idle=e,this.applyCustomImagesToButton();}get cameraFOVUltraWidePressedImage(){return this.customIcons.ultraWide.pressed}set cameraFOVUltraWidePressedImage(e){this.customIcons.ultraWide.pressed=e,this.applyCustomImagesToButton();}toJSONObject(){return {type:this.type}}async install(e){var a,r,n;this.CameraFOVSwitchButtonClass||(this.CameraFOVSwitchButtonClass=await import('../private/ui/molecules/CameraFOVSwitchButton.js').then(d=>d.CameraFOVSwitchButton),(a=this.CameraFOVSwitchButtonClass)==null||a.register()),this.view=e,this.currentFrameSource=(n=(r=e.getContext())==null?void 0:r.frameSource)!=null?n:null,this.fovSwitchButton=this.CameraFOVSwitchButtonClass.create(),this.fovSwitchButton.slot="bottomRight",this.fovSwitchButton.hidden=true,this.updateButtonMode(),this.fovSwitchButton.addEventListener("camera-fov-changed",this.onCameraFOVChanged);let t=e.controlsElement;return t&&t.append(this.fovSwitchButton),this.applyCustomImagesToButton(),await this.canShow()&&(await this.setInitialWideCamera(),this.updateButtonVisibility(true)),true}remove(e){e&&this.fovSwitchButton&&(this.fovSwitchButton.removeEventListener("camera-fov-changed",this.onCameraFOVChanged),this.fovSwitchButton.remove(),this.fovSwitchButton=null,this.currentFrameSource=null,this.view=void 0);}async update(e){var i,a;this.currentFrameSource=(a=(i=e.getContext())==null?void 0:i.frameSource)!=null?a:null,this.view=e,this.updateButtonMode();let t=await this.canShow();this.updateButtonVisibility(t);}updateButtonMode(){if(!this.fovSwitchButton)return;let t=this.isUltraWideBackCamera()?"0.5x":"1.0x";this.fovSwitchButton.mode=t;}applyCustomImagesToButton(){if(!this.fovSwitchButton)return;this.customIcons.wide.idle||this.customIcons.wide.pressed||this.customIcons.ultraWide.idle||this.customIcons.ultraWide.pressed?this.fovSwitchButton.setCustomImages(this.customIcons):this.fovSwitchButton.useCustomImages=false;}updateButtonVisibility(e){this.fovSwitchButton&&(this.fovSwitchButton.hidden=!e);}async canShow(){if(!b.isIOSDeviceWithExtendedCameraAccess())return false;let e=this.currentFrameSource;return e===null||!f(e)?false:d.isIOSBackDualWideCameraLabel(e.label)||d.isIOSBackCameraLabel(e.label)||d.isIOSUltraWideBackCameraLabel(e.label)}isUltraWideBackCamera(){let e=this.currentFrameSource;return f(e)?d.isIOSUltraWideBackCameraLabel(e.label):false}async handleCameraFOVChanged(e){await this.handleCameraFOVSwitch(),this.updateButtonMode();}async setInitialWideCamera(){var e,t;if(!this.isTransitioning&&!d.isIOSBackCameraLabel((t=(e=this.currentFrameSource)==null?void 0:e.label)!=null?t:"")){let a$1=(await a.getAll()).find(r=>d.isIOSBackCameraLabel(r.label));a$1&&await this.switchCameras(a$1);}}async handleCameraFOVSwitch(){if(this.isTransitioning)return false;let e=await this.getAlternativeCamera();return e?(await this.switchCameras(e),true):false}async getAlternativeCamera(){return (await a.getAll()).find(t=>this.isUltraWideBackCamera()?d.isIOSBackCameraLabel(t.label):d.isIOSUltraWideBackCameraLabel(t.label))}async switchCameras(e){var n;this.isTransitioning=true;let t=(n=this.view)==null?void 0:n.getContext(),i=t==null?void 0:t.frameSource,a,r;i!=null&&(a=new g(i.settings),r=i.desiredState),await(i==null?void 0:i.switchToDesiredState("off")),a!=null&&await e.applySettings(a),await(t==null?void 0:t.setFrameSource(e)),await(t==null?void 0:t.frameSource).switchToDesiredState(r!=null?r:"on"),this.isTransitioning=false;}};export{c as a};
1
+ import {a}from'./chunk-GHR3BSUQ.js';import {d}from'./chunk-YUZDO2PC.js';import {b}from'./chunk-YONR3EGV.js';import {f,g}from'./chunk-D222MT4V.js';var c=class{constructor(){this.type="camera-fov";this.customIcons={wide:{idle:"",pressed:""},ultraWide:{idle:"",pressed:""}};this.fovSwitchButton=void 0;this.CameraFOVSwitchButtonClass=void 0;this.currentFrameSource=null;this.view=void 0;this.onCameraFOVChanged=this.handleCameraFOVChanged.bind(this);this.isTransitioning=false;}get cameraFOVWideImage(){return this.customIcons.wide.idle}set cameraFOVWideImage(e){this.customIcons.wide.idle=e,this.applyCustomImagesToButton();}get cameraFOVWidePressedImage(){return this.customIcons.wide.pressed}set cameraFOVWidePressedImage(e){this.customIcons.wide.pressed=e,this.applyCustomImagesToButton();}get cameraFOVUltraWideImage(){return this.customIcons.ultraWide.idle}set cameraFOVUltraWideImage(e){this.customIcons.ultraWide.idle=e,this.applyCustomImagesToButton();}get cameraFOVUltraWidePressedImage(){return this.customIcons.ultraWide.pressed}set cameraFOVUltraWidePressedImage(e){this.customIcons.ultraWide.pressed=e,this.applyCustomImagesToButton();}toJSONObject(){return {type:this.type}}async install(e){var a,r,n;this.CameraFOVSwitchButtonClass||(this.CameraFOVSwitchButtonClass=await import('../private/ui/molecules/CameraFOVSwitchButton.js').then(d=>d.CameraFOVSwitchButton),(a=this.CameraFOVSwitchButtonClass)==null||a.register()),this.view=e,this.currentFrameSource=(n=(r=e.getContext())==null?void 0:r.frameSource)!=null?n:null,this.fovSwitchButton=this.CameraFOVSwitchButtonClass.create(),this.fovSwitchButton.slot="bottomRight",this.fovSwitchButton.hidden=true,this.updateButtonMode(),this.fovSwitchButton.addEventListener("camera-fov-changed",this.onCameraFOVChanged);let t=e.controlsElement;return t&&t.append(this.fovSwitchButton),this.applyCustomImagesToButton(),await this.canShow()&&(await this.setInitialWideCamera(),this.updateButtonVisibility(true)),true}remove(e){e&&this.fovSwitchButton&&(this.fovSwitchButton.removeEventListener("camera-fov-changed",this.onCameraFOVChanged),this.fovSwitchButton.remove(),this.fovSwitchButton=null,this.currentFrameSource=null,this.view=void 0);}async update(e){var i,a;this.currentFrameSource=(a=(i=e.getContext())==null?void 0:i.frameSource)!=null?a:null,this.view=e,this.updateButtonMode();let t=await this.canShow();this.updateButtonVisibility(t);}updateButtonMode(){if(!this.fovSwitchButton)return;let t=this.isUltraWideBackCamera()?"0.5x":"1.0x";this.fovSwitchButton.mode=t;}applyCustomImagesToButton(){if(!this.fovSwitchButton)return;this.customIcons.wide.idle||this.customIcons.wide.pressed||this.customIcons.ultraWide.idle||this.customIcons.ultraWide.pressed?this.fovSwitchButton.setCustomImages(this.customIcons):this.fovSwitchButton.useCustomImages=false;}updateButtonVisibility(e){this.fovSwitchButton&&(this.fovSwitchButton.hidden=!e);}async canShow(){if(!b.isIOSDeviceWithExtendedCameraAccess())return false;let e=this.currentFrameSource;return e===null||!f(e)?false:d.isIOSBackDualWideCameraLabel(e.label)||d.isIOSBackCameraLabel(e.label)||d.isIOSUltraWideBackCameraLabel(e.label)}isUltraWideBackCamera(){let e=this.currentFrameSource;return f(e)?d.isIOSUltraWideBackCameraLabel(e.label):false}async handleCameraFOVChanged(e){await this.handleCameraFOVSwitch(),this.updateButtonMode();}async setInitialWideCamera(){var e,t;if(!this.isTransitioning&&!d.isIOSBackCameraLabel((t=(e=this.currentFrameSource)==null?void 0:e.label)!=null?t:"")){let a$1=(await a.getAll()).find(r=>d.isIOSBackCameraLabel(r.label));a$1&&await this.switchCameras(a$1);}}async handleCameraFOVSwitch(){if(this.isTransitioning)return false;let e=await this.getAlternativeCamera();return e?(await this.switchCameras(e),true):false}async getAlternativeCamera(){return (await a.getAll()).find(t=>this.isUltraWideBackCamera()?d.isIOSBackCameraLabel(t.label):d.isIOSUltraWideBackCameraLabel(t.label))}async switchCameras(e){var n;this.isTransitioning=true;let t=(n=this.view)==null?void 0:n.getContext(),i=t==null?void 0:t.frameSource,a,r;i!=null&&(a=new g(i.settings),r=i.desiredState),await(i==null?void 0:i.switchToDesiredState("off")),a!=null&&await e.applySettings(a),await(t==null?void 0:t.setFrameSource(e)),await(t==null?void 0:t.frameSource).switchToDesiredState(r!=null?r:"on"),this.isTransitioning=false;}};export{c as a};
@@ -1,4 +1,4 @@
1
- import {a as a$4}from'./chunk-3A7LM5JG.js';import {a as a$2}from'./chunk-QHBIT2WY.js';import {b,a as a$3}from'./chunk-SK6L34IF.js';import {a as a$6}from'./chunk-ZKROZLQ4.js';import {a}from'./chunk-NQF3GUK2.js';import {d}from'./chunk-YUZDO2PC.js';import {b as b$2}from'./chunk-7LTHFX4E.js';import {a as a$a}from'./chunk-KAFNKP6O.js';import {a as a$9}from'./chunk-E4XJ4GKD.js';import {a as a$b}from'./chunk-QOCHMKNY.js';import {b as b$4}from'./chunk-FTD535WI.js';import {a as a$5}from'./chunk-R6E4CT22.js';import {a as a$c}from'./chunk-4BP7D26M.js';import {b as b$1}from'./chunk-YONR3EGV.js';import {a as a$7,b as b$3}from'./chunk-CX2R2XQK.js';import {a as a$1}from'./chunk-XR65N6EG.js';import {a as a$8}from'./chunk-QCZSSQAQ.js';var z=`
1
+ import {a as a$4}from'./chunk-3A7LM5JG.js';import {a as a$2}from'./chunk-QHBIT2WY.js';import {b,a as a$3}from'./chunk-SK6L34IF.js';import {a as a$6}from'./chunk-ZKROZLQ4.js';import {a}from'./chunk-NQF3GUK2.js';import {b as b$2}from'./chunk-7LTHFX4E.js';import {d}from'./chunk-YUZDO2PC.js';import {a as a$b}from'./chunk-QOCHMKNY.js';import {a as a$a}from'./chunk-KAFNKP6O.js';import {a as a$9}from'./chunk-E4XJ4GKD.js';import {b as b$4}from'./chunk-FTD535WI.js';import {a as a$5}from'./chunk-R6E4CT22.js';import {a as a$c}from'./chunk-4BP7D26M.js';import {b as b$1}from'./chunk-YONR3EGV.js';import {a as a$7,b as b$3}from'./chunk-CX2R2XQK.js';import {a as a$1}from'./chunk-XR65N6EG.js';import {a as a$8}from'./chunk-QCZSSQAQ.js';var z=`
2
2
  attribute vec2 a_position;
3
3
  varying vec2 v_texcoord;
4
4
 
@@ -1 +1 @@
1
- import {a as a$4}from'./chunk-DN32UPQC.js';import {a as a$8}from'./chunk-GVHXM75D.js';import {a as a$9}from'./chunk-G2BRTVN7.js';import {c as c$1,a as a$a}from'./chunk-4W2T3TLN.js';import {c}from'./chunk-UWLAKRB2.js';import {a as a$1}from'./chunk-CAUB35PV.js';import {a as a$2}from'./chunk-QIWPWOQG.js';import {a}from'./chunk-GQ7A6533.js';import {a as a$6}from'./chunk-P3NPNIWR.js';import {d}from'./chunk-AIC4H5KG.js';import {a as a$5}from'./chunk-O7TZTIHO.js';import {a as a$3}from'./chunk-XR65N6EG.js';import {a as a$7}from'./chunk-QCZSSQAQ.js';var P=class P{constructor(e,t){this.hintPresenterV2=null;this.MAX_NUMBER_OF_IMAGES_IN_FRAME_DATA_POOL=5;this.redrawInterval=1e3/30;this.redrawRequests=[];this._isDrawLoopRunning=false;this.frameDataPool=new Map;this.lastFrameColorType="RGBA";this.lastFrameId=null;this.poorMansBenchmarkLogs=false;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 a(null);this.lastFrameProcessingStartedCount=0;this.lastFrameProcessingFinishedCount=0;this.moduleHandler=e,this.workerFunctions=t,this._loadProgressCallback=this._loadProgressCallback.bind(this),c(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 t=this.lastFrameId;if(this.frameDataPool.size>=this.MAX_NUMBER_OF_IMAGES_IN_FRAME_DATA_POOL){let l=this.frameDataPool.keys().next().value;l!=null&&this.frameDataPool.delete(l);}let r=e.getFrameData(),i=new Uint8ClampedArray(r);this.frameDataPool.set(t,{data:i,colorType:this.lastFrameColorType,frameId:t,width:e.getWidth(),height:e.getHeight()});let n=this.lastUsedModuleMirrorAxis==null?false:this.lastUsedModuleMirrorAxis!==this.Module.Axis.None;return {frameId:t,width:e.getWidth(),height:e.getHeight(),isFrameSourceMirrored:n,colorType:this.lastFrameColorType}}createContext(e){var f,m,C,b,y;let t=this.getModeDeserializers(),r=c$1(location);(r==="localhost"||r==="127.0.0.1")&&navigator.userAgent.includes("Electron")&&e.appName!=null&&(r+=`-${e.appName}`),this.parentDomain=e.parentDomain,this.contextDeserializer=new this.Module.DataCaptureContextDeserializer(this.writableDataPath,e.deviceId,e.context.deviceModelName,r,this.parentDomain,t,e.delayedRegistration,e.highEndBlurryRecognition,this.resourcePath);let i=this.contextDeserializer.contextFromJson(JSON.stringify(e.context));if(i==null){let a=this.contextDeserializer.getLastError();throw new Error(`Could not create the context: ${a}`)}let n=i.getView();this.context=i.getContext(),i.delete(),this.setupDeviceInterface(e.isTablet,e.batteryInfo);let l=this.Module.DataCaptureContextListener.extend("DataCaptureContextListener",{didChangeStatus:(a,o)=>{this.contextDidChangeStatus(JSON.parse(o.toJson())),a.delete();},didStartObservingContext:a=>{this.didStartObservingContext(),a.delete();},didStopObservingContext:a=>{a.delete();}}),c=this.Module.DataCaptureContextFrameListener.extend("DataCaptureContextFrameListener",{onObservationStarted:a=>{a.delete();},onObservationStopped:a=>{a.delete();},onFrameProcessingStarted:(a,o)=>{this.workerFunctions.postMessage({type:"onFrameProcessingStarted"}),o.delete(),a.delete();},onFrameProcessingFinished:(a,o)=>{this.workerFunctions.postMessage({type:"onFrameProcessingFinished"}),o.delete(),a.delete();},onFrameSkipped:(a,o)=>{this.workerFunctions.postMessage({type:"onFrameSkipped"}),o.delete(),a.delete();}}),h=this.Module.GestureRecognizer.extend("GestureRecognizer",{setGestureListener:(a,o)=>{var w;(w=this.gestureListener)==null||w.delete(),this.gestureListener=a.clone(),a.delete();}});(f=this.gestureRecognizer)==null||f.delete(),this.gestureRecognizer=new h;let g=new l;this.context.addListener(g),g.delete();let u=new c;this.context.addFrameListener(u),u.delete(),this.setView(n),(m=this.view)==null||m.setGestureRecognizer(this.gestureRecognizer);let p=this.Module.PlatformHintPresenter.extend("PlatformHintPresenter",{setHintPresenter:a=>{a.delete();},showToast:a=>{this.workerFunctions.postMessage({type:"showToast",payload:JSON.parse(a)});},hideToast:a=>{this.workerFunctions.postMessage({type:"hideToast",payload:JSON.parse(a)});},showGuidance:a=>{this.workerFunctions.postMessage({type:"showGuidance",payload:JSON.parse(a)});},hideGuidance:a=>{this.workerFunctions.postMessage({type:"hideGuidance",payload:JSON.parse(a)});},startUpdateTimer:a=>{this.workerFunctions.postMessage({type:"startUpdateTimer",payload:{duration:{unit:"ms",value:a}}});},stopUpdateTimer:()=>{this.workerFunctions.postMessage({type:"stopUpdateTimer"});}});(C=this.hintPresenterV2)==null||C.delete(),this.hintPresenterV2=null,(b=this.webPlatformHintPresenter)==null||b.delete(),this.webPlatformHintPresenter=null,this.webPlatformHintPresenter=new p,this.view&&(this.hintPresenterV2=new this.Module.HintPresenterV2(this.webPlatformHintPresenter),(y=this.view)==null||y.setHintPresenterV2(this.hintPresenterV2)),this.webImageConverterInstance=this.getImageConverterInstance({quality:1}),this.Module.ImageConverter.setInstance(this.webImageConverterInstance);}convertToJPEGResult(e,t){this.webImageConverterInstance instanceof a$1&&this.webImageConverterInstance.onConvertToJPEGResult(e,t);}getImageConverterInstance(e){return this.workerFunctions.getOffscreenCanvas()!=null?new a$2(e):new a$1(this.workerFunctions,e)}onTap(e){var t;(t=this.gestureListener)==null||t.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 i={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:i});}deleteFrameData(e){this.frameDataPool.delete(e);}dispose(){var e,t,r,i,n;this.context.dispose(),this.frameDataPool.clear(),this.isDrawLoopRunning=false,this.cleanupMetricsReporting(),(e=this.gestureRecognizer)==null||e.delete(),this.gestureRecognizer=null,(t=this.gestureListener)==null||t.delete(),this.gestureListener=null,(r=this.hintPresenterV2)==null||r.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[P.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 n;if(this.context==null)return a$3.debug("[processFrame] Context is null, returning frame without processing"),{payload:e,transferables:[e.data.buffer]};this.lastFrameId=e.frameId;let t=e.data,r=e.colorType==="GRAYSCALE"?this.Module.ImageBufferFormat.Grayscale8:this.Module.ImageBufferFormat.Rgba8888;this.lastFrameColorType=e.colorType==="GRAYSCALE"?"GRAYSCALE":"RGBA";let i=this.Module.allocateUint8Array(t.byteLength);return this.Module.HEAPU8.set(t,i),(n=this.imageFrameSource)==null||n.outputFrame(i,e.width,e.height,r),{payload:e,transferables:[e.data.buffer]}}reportCameraProperties(e){this.context.setCameraProperties(e.deviceId,e.isFrontFacing,e.hasAutofocus);}requestFrameData(e){let t=this.frameDataPool.get(e);if(t==null)return {payload:{data:null,frameId:null,colorType:null}};if(t.data.buffer.byteLength===0)return this.frameDataPool.delete(e),{payload:{data:null,frameId:null,colorType:null}};let r=t.data;t.colorType==="GRAYSCALE"&&(r=a$4(t.data,t.width,t.height));let i={payload:{data:r,frameId:t.frameId,colorType:t.colorType},transferables:[r.buffer]};return this.frameDataPool.delete(e),i}scheduleRedraw(e,t){this.addRedrawRequest(t),this.isDrawLoopRunning||this.startDrawLoop(e);}sendViewRefreshCommands(e){this.workerFunctions.postMessage({type:"draw",payload:e},[e.buffer]);}setFrameSource(e,t){var r;this.lastUsedModuleMirrorAxis=this.mapMirrorAxisOnModule(e),(r=this.imageFrameSource)==null||r.delete(),this.imageFrameSource=new this.Module.ImageBufferFrameSource(this.lastUsedModuleMirrorAxis,t,0),this.context.setFrameSource(this.imageFrameSource);}startDrawLoop(e){this.isDrawLoopRunning=true;let t=n=>this.redrawRequests.length>0&&this.redrawRequests[0]<=n,r=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(t(n)){r(n),e.draw();let l=e.getDrawCommands();this.sendViewRefreshCommands(new Uint8Array(l));}i();},this.redrawInterval);};i();}updateContext(e){if(this.context!=null&&this.contextDeserializer!=null){e.view!=null&&!e.view.visible&&this.context.flushAnalytics();let t=this.onBeforeUpdateContextHook(e),r=this.contextDeserializer.updateContextFromJson(this.context,this.view,JSON.stringify(t.context));if(r==null){let n=this.contextDeserializer.getLastError();throw new Error(`Could not update the context: ${n}`)}this.context.delete(),this.context=r.getContext();let i=r.getView();r.delete(),i!=null&&t.view!=null&&(i.setViewSize(t.view.width,t.view.height,t.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),a$3.debug("context updated",t);}}notifyMainThreadOnViewInfoChanged(e){let t=this.getViewInfo(e);this.lastViewInfo.isSame(t)||(this.lastViewInfo.update(t),this.workerFunctions.postMessage({type:"viewSizeChanged",payload:t}));}getViewInfo(e){if(e!=null)try{let t=JSON.parse(e.getViewInfo());if(t!=null){let r=this.getOrientationFromNumber(t.orientation);return {...t,orientation:r}}}catch(t){a$3.error("Failed to get view size",t);}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,t;return {payload:{isDisplayingViewfinder:(t=(e=this.view)==null?void 0:e.isDisplayingViewfinder())!=null?t:false,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,t){return t?e?globalThis.SDC_WASM_CORE_MT_SIMD_HASH:globalThis.SDC_WASM_CORE_MT_HASH:e?globalThis.SDC_WASM_CORE_SIMD_HASH:""}getWasmCoreFileName(e,t){return t?e?globalThis.SDC_WASM_CORE_MT_SIMD_FILE_NAME:globalThis.SDC_WASM_CORE_MT_FILE_NAME:e?globalThis.SDC_WASM_CORE_SIMD_FILE_NAME:""}getWasmMetadata(){return globalThis.WASM_METADATA}getWasmSideModuleFileName(){return ""}_loadProgressCallback(e){this.workerFunctions.postMessage({type:"loadLibraryProgress",payload:e});}addRedrawRequest(e){this.redrawRequests.push(Math.round(performance.now())+e),this.redrawRequests.sort((t,r)=>t-r);}contextDidChangeStatus(e){e.code===260?e.message=e.message.replace("domain name",`domain name (${c$1(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=false,this.sendViewRefreshCommands(new Uint8Array([])));}addNativeOverlay(e){a$3.warn("addNativeOverlay has not been implemented for this module",e);}removeNativeOverlay(e){a$3.warn("removeNativeOverlay has not been implemented for this module",e);}setViewRefreshHandler(e){if(e==null||e.isViewRefreshHandlerSet)return;let t=this.Module.NeedsRedrawDelegate.extend("NeedsRedrawDelegate",{setNeedsRedrawIn:this.scheduleRedraw.bind(this,e)}),r=new t;e.setNeedsRedrawDelegate(r),e.isViewRefreshHandlerSet=true;}setupDataDecoding(){let e=this.moduleHandler.get(),t=e.DataDecoding.extend("DataDecoding",{decode(r,i){try{let n=JSON.parse(i),l=[];for(let c of n){let h=new TextDecoder(c.ianaName,{fatal:true});l.push(h.decode(r.slice(c.startIndex,c.endIndex)));}return l.join("")}catch{return ""}}});e.setDataDecoding(new t);}getBatteryData(){var t,r;let e=(r=(t=this.deviceInfo)==null?void 0:t.batteryInfo)==null?void 0:r.percentage;if(e!=null)return {percentage:e}}isTablet(){var e,t;return (t=(e=this.deviceInfo)==null?void 0:e.isTablet)!=null?t:false}setupDeviceInterface(e,t){this.deviceInfo={isTablet:e,batteryInfo:t};let r=this.moduleHandler.get(),i=r.DeviceInterface.extend("DeviceInterface",{getBatteryData:this.getBatteryData.bind(this),isTablet:this.isTablet.bind(this)});this.deviceInstance=new i,r.DeviceHolder.setCurrentDevice(this.deviceInstance);}updateBatteryInfo(e){this.deviceInfo&&(this.deviceInfo.batteryInfo=e);}start(e,t,r){e&&t&&(this.setupDataDecoding(),this.moduleHandler.get().callMain(),this.moduleHandler.get().__emscripten_proxy_main!==void 0||r());}getWritableDataPath(e){return e!=null?(a$3.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:t,writableDataPathOverride:r,indexedDBTimeoutMs:i,verifyResponseHash:n,referredOrigin:l,fixedWasmMemory:c,simdSupport:h,threadsSupport:g}){var v;let u=false,p=false;this.writableDataPath=this.getWritableDataPath(r),this.resourcePath=`${e}${this.resourceFilesSubfolder}/`,globalThis.path=t;let{resolve:f,reject:m,promise:C}=new a$5,b=a$6.sdkVersion();if(b==="")throw new a$7({name:"Invalid library version",message:"Library version is not defined or empty, cannot generate proper path to library files."});let y=this.getWasmCoreFileName(h,g),a=d(b,e,y),{jsURI:o,wasmURI:w}=a,W={instantiateWasm:(d,H)=>(a$a({importObject:d,wasmURI:w,expectedHash:this.getWasmCoreExpectedHash(h,g),verifyResponseHash:n,successCallback:H,progressCallback:this._loadProgressCallback,errorCallback:N=>{m(N);},referredOrigin:l}),{})},M=c===null?null:new WebAssembly.Memory({initial:this.numOfMBToPages(c),maximum:this.numOfMBToPages(300),shared:g});return M!==null&&a$3.log(a$3.Level.Debug,"Fixed wasmMemory set",M),this.moduleHandler.set({...M?{wasmMemory:M}:{},mainScriptUrlOrBlob:o,canvas:(v=this.workerFunctions.getOffscreenCanvas())!=null?v:{getContext:()=>null},...W,dynamicLibraries:this.getWasmDynamicLibraries(w),locateFile:d=>e+d,noInitialRun:true,preRun:[async()=>{try{await a$8({writableDataPath:this.writableDataPath,indexedDBTimeoutMs:i});}catch(d){if(d.name==="BlockedIndexedDB"){m(d.toString());return}a$3.log(a$3.Level.Debug,"No IndexedDB support, some data will not be persisted:",d);}p=true,this.start(p,u,f);}],onMainComplete:()=>{if([u,p].includes(false)){a$3.log(a$3.Level.Warn,{runtimeLoaded:u,fileSystemSynced:p},"Both runtimeLoaded and fileSystemSynced should be true when calling onMainComplete"),m("onMainComplete has been called but runtime or file system was not ready.");return}f();},onRuntimeInitialized:()=>{u=true,this.start(p,u,f);},print:d=>{a$3.info(d);}}),await a$9(o,b)||m(`Couldn't retrieve Scandit Data Capture library at ${o}, did you configure the path for it correctly?`),C}};P.get3dPartyLicenseKeyMethodName=atob("Z2V0QmxpbmtJZExpY2Vuc2VLZXk=");var V=P;export{V as a};
1
+ import {a as a$4}from'./chunk-DN32UPQC.js';import {a as a$8}from'./chunk-GVHXM75D.js';import {a as a$9}from'./chunk-G2BRTVN7.js';import {a}from'./chunk-GQ7A6533.js';import {c as c$1,a as a$a}from'./chunk-4W2T3TLN.js';import {c}from'./chunk-UWLAKRB2.js';import {a as a$1}from'./chunk-CAUB35PV.js';import {a as a$2}from'./chunk-QIWPWOQG.js';import {a as a$6}from'./chunk-HBPGHXF2.js';import {d}from'./chunk-AIC4H5KG.js';import {a as a$5}from'./chunk-O7TZTIHO.js';import {a as a$3}from'./chunk-XR65N6EG.js';import {a as a$7}from'./chunk-QCZSSQAQ.js';var P=class P{constructor(e,t){this.hintPresenterV2=null;this.MAX_NUMBER_OF_IMAGES_IN_FRAME_DATA_POOL=5;this.redrawInterval=1e3/30;this.redrawRequests=[];this._isDrawLoopRunning=false;this.frameDataPool=new Map;this.lastFrameColorType="RGBA";this.lastFrameId=null;this.poorMansBenchmarkLogs=false;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 a(null);this.lastFrameProcessingStartedCount=0;this.lastFrameProcessingFinishedCount=0;this.moduleHandler=e,this.workerFunctions=t,this._loadProgressCallback=this._loadProgressCallback.bind(this),c(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 t=this.lastFrameId;if(this.frameDataPool.size>=this.MAX_NUMBER_OF_IMAGES_IN_FRAME_DATA_POOL){let l=this.frameDataPool.keys().next().value;l!=null&&this.frameDataPool.delete(l);}let r=e.getFrameData(),i=new Uint8ClampedArray(r);this.frameDataPool.set(t,{data:i,colorType:this.lastFrameColorType,frameId:t,width:e.getWidth(),height:e.getHeight()});let n=this.lastUsedModuleMirrorAxis==null?false:this.lastUsedModuleMirrorAxis!==this.Module.Axis.None;return {frameId:t,width:e.getWidth(),height:e.getHeight(),isFrameSourceMirrored:n,colorType:this.lastFrameColorType}}createContext(e){var f,m,C,b,y;let t=this.getModeDeserializers(),r=c$1(location);(r==="localhost"||r==="127.0.0.1")&&navigator.userAgent.includes("Electron")&&e.appName!=null&&(r+=`-${e.appName}`),this.parentDomain=e.parentDomain,this.contextDeserializer=new this.Module.DataCaptureContextDeserializer(this.writableDataPath,e.deviceId,e.context.deviceModelName,r,this.parentDomain,t,e.delayedRegistration,e.highEndBlurryRecognition,this.resourcePath);let i=this.contextDeserializer.contextFromJson(JSON.stringify(e.context));if(i==null){let a=this.contextDeserializer.getLastError();throw new Error(`Could not create the context: ${a}`)}let n=i.getView();this.context=i.getContext(),i.delete(),this.setupDeviceInterface(e.isTablet,e.batteryInfo);let l=this.Module.DataCaptureContextListener.extend("DataCaptureContextListener",{didChangeStatus:(a,o)=>{this.contextDidChangeStatus(JSON.parse(o.toJson())),a.delete();},didStartObservingContext:a=>{this.didStartObservingContext(),a.delete();},didStopObservingContext:a=>{a.delete();}}),c=this.Module.DataCaptureContextFrameListener.extend("DataCaptureContextFrameListener",{onObservationStarted:a=>{a.delete();},onObservationStopped:a=>{a.delete();},onFrameProcessingStarted:(a,o)=>{this.workerFunctions.postMessage({type:"onFrameProcessingStarted"}),o.delete(),a.delete();},onFrameProcessingFinished:(a,o)=>{this.workerFunctions.postMessage({type:"onFrameProcessingFinished"}),o.delete(),a.delete();},onFrameSkipped:(a,o)=>{this.workerFunctions.postMessage({type:"onFrameSkipped"}),o.delete(),a.delete();}}),h=this.Module.GestureRecognizer.extend("GestureRecognizer",{setGestureListener:(a,o)=>{var w;(w=this.gestureListener)==null||w.delete(),this.gestureListener=a.clone(),a.delete();}});(f=this.gestureRecognizer)==null||f.delete(),this.gestureRecognizer=new h;let g=new l;this.context.addListener(g),g.delete();let u=new c;this.context.addFrameListener(u),u.delete(),this.setView(n),(m=this.view)==null||m.setGestureRecognizer(this.gestureRecognizer);let p=this.Module.PlatformHintPresenter.extend("PlatformHintPresenter",{setHintPresenter:a=>{a.delete();},showToast:a=>{this.workerFunctions.postMessage({type:"showToast",payload:JSON.parse(a)});},hideToast:a=>{this.workerFunctions.postMessage({type:"hideToast",payload:JSON.parse(a)});},showGuidance:a=>{this.workerFunctions.postMessage({type:"showGuidance",payload:JSON.parse(a)});},hideGuidance:a=>{this.workerFunctions.postMessage({type:"hideGuidance",payload:JSON.parse(a)});},startUpdateTimer:a=>{this.workerFunctions.postMessage({type:"startUpdateTimer",payload:{duration:{unit:"ms",value:a}}});},stopUpdateTimer:()=>{this.workerFunctions.postMessage({type:"stopUpdateTimer"});}});(C=this.hintPresenterV2)==null||C.delete(),this.hintPresenterV2=null,(b=this.webPlatformHintPresenter)==null||b.delete(),this.webPlatformHintPresenter=null,this.webPlatformHintPresenter=new p,this.view&&(this.hintPresenterV2=new this.Module.HintPresenterV2(this.webPlatformHintPresenter),(y=this.view)==null||y.setHintPresenterV2(this.hintPresenterV2)),this.webImageConverterInstance=this.getImageConverterInstance({quality:1}),this.Module.ImageConverter.setInstance(this.webImageConverterInstance);}convertToJPEGResult(e,t){this.webImageConverterInstance instanceof a$1&&this.webImageConverterInstance.onConvertToJPEGResult(e,t);}getImageConverterInstance(e){return this.workerFunctions.getOffscreenCanvas()!=null?new a$2(e):new a$1(this.workerFunctions,e)}onTap(e){var t;(t=this.gestureListener)==null||t.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 i={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:i});}deleteFrameData(e){this.frameDataPool.delete(e);}dispose(){var e,t,r,i,n;this.context.dispose(),this.frameDataPool.clear(),this.isDrawLoopRunning=false,this.cleanupMetricsReporting(),(e=this.gestureRecognizer)==null||e.delete(),this.gestureRecognizer=null,(t=this.gestureListener)==null||t.delete(),this.gestureListener=null,(r=this.hintPresenterV2)==null||r.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[P.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 n;if(this.context==null)return a$3.debug("[processFrame] Context is null, returning frame without processing"),{payload:e,transferables:[e.data.buffer]};this.lastFrameId=e.frameId;let t=e.data,r=e.colorType==="GRAYSCALE"?this.Module.ImageBufferFormat.Grayscale8:this.Module.ImageBufferFormat.Rgba8888;this.lastFrameColorType=e.colorType==="GRAYSCALE"?"GRAYSCALE":"RGBA";let i=this.Module.allocateUint8Array(t.byteLength);return this.Module.HEAPU8.set(t,i),(n=this.imageFrameSource)==null||n.outputFrame(i,e.width,e.height,r),{payload:e,transferables:[e.data.buffer]}}reportCameraProperties(e){this.context.setCameraProperties(e.deviceId,e.isFrontFacing,e.hasAutofocus);}requestFrameData(e){let t=this.frameDataPool.get(e);if(t==null)return {payload:{data:null,frameId:null,colorType:null}};if(t.data.buffer.byteLength===0)return this.frameDataPool.delete(e),{payload:{data:null,frameId:null,colorType:null}};let r=t.data;t.colorType==="GRAYSCALE"&&(r=a$4(t.data,t.width,t.height));let i={payload:{data:r,frameId:t.frameId,colorType:t.colorType},transferables:[r.buffer]};return this.frameDataPool.delete(e),i}scheduleRedraw(e,t){this.addRedrawRequest(t),this.isDrawLoopRunning||this.startDrawLoop(e);}sendViewRefreshCommands(e){this.workerFunctions.postMessage({type:"draw",payload:e},[e.buffer]);}setFrameSource(e,t){var r;this.lastUsedModuleMirrorAxis=this.mapMirrorAxisOnModule(e),(r=this.imageFrameSource)==null||r.delete(),this.imageFrameSource=new this.Module.ImageBufferFrameSource(this.lastUsedModuleMirrorAxis,t,0),this.context.setFrameSource(this.imageFrameSource);}startDrawLoop(e){this.isDrawLoopRunning=true;let t=n=>this.redrawRequests.length>0&&this.redrawRequests[0]<=n,r=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(t(n)){r(n),e.draw();let l=e.getDrawCommands();this.sendViewRefreshCommands(new Uint8Array(l));}i();},this.redrawInterval);};i();}updateContext(e){if(this.context!=null&&this.contextDeserializer!=null){e.view!=null&&!e.view.visible&&this.context.flushAnalytics();let t=this.onBeforeUpdateContextHook(e),r=this.contextDeserializer.updateContextFromJson(this.context,this.view,JSON.stringify(t.context));if(r==null){let n=this.contextDeserializer.getLastError();throw new Error(`Could not update the context: ${n}`)}this.context.delete(),this.context=r.getContext();let i=r.getView();r.delete(),i!=null&&t.view!=null&&(i.setViewSize(t.view.width,t.view.height,t.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),a$3.debug("context updated",t);}}notifyMainThreadOnViewInfoChanged(e){let t=this.getViewInfo(e);this.lastViewInfo.isSame(t)||(this.lastViewInfo.update(t),this.workerFunctions.postMessage({type:"viewSizeChanged",payload:t}));}getViewInfo(e){if(e!=null)try{let t=JSON.parse(e.getViewInfo());if(t!=null){let r=this.getOrientationFromNumber(t.orientation);return {...t,orientation:r}}}catch(t){a$3.error("Failed to get view size",t);}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,t;return {payload:{isDisplayingViewfinder:(t=(e=this.view)==null?void 0:e.isDisplayingViewfinder())!=null?t:false,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,t){return t?e?globalThis.SDC_WASM_CORE_MT_SIMD_HASH:globalThis.SDC_WASM_CORE_MT_HASH:e?globalThis.SDC_WASM_CORE_SIMD_HASH:""}getWasmCoreFileName(e,t){return t?e?globalThis.SDC_WASM_CORE_MT_SIMD_FILE_NAME:globalThis.SDC_WASM_CORE_MT_FILE_NAME:e?globalThis.SDC_WASM_CORE_SIMD_FILE_NAME:""}getWasmMetadata(){return globalThis.WASM_METADATA}getWasmSideModuleFileName(){return ""}_loadProgressCallback(e){this.workerFunctions.postMessage({type:"loadLibraryProgress",payload:e});}addRedrawRequest(e){this.redrawRequests.push(Math.round(performance.now())+e),this.redrawRequests.sort((t,r)=>t-r);}contextDidChangeStatus(e){e.code===260?e.message=e.message.replace("domain name",`domain name (${c$1(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=false,this.sendViewRefreshCommands(new Uint8Array([])));}addNativeOverlay(e){a$3.warn("addNativeOverlay has not been implemented for this module",e);}removeNativeOverlay(e){a$3.warn("removeNativeOverlay has not been implemented for this module",e);}setViewRefreshHandler(e){if(e==null||e.isViewRefreshHandlerSet)return;let t=this.Module.NeedsRedrawDelegate.extend("NeedsRedrawDelegate",{setNeedsRedrawIn:this.scheduleRedraw.bind(this,e)}),r=new t;e.setNeedsRedrawDelegate(r),e.isViewRefreshHandlerSet=true;}setupDataDecoding(){let e=this.moduleHandler.get(),t=e.DataDecoding.extend("DataDecoding",{decode(r,i){try{let n=JSON.parse(i),l=[];for(let c of n){let h=new TextDecoder(c.ianaName,{fatal:true});l.push(h.decode(r.slice(c.startIndex,c.endIndex)));}return l.join("")}catch{return ""}}});e.setDataDecoding(new t);}getBatteryData(){var t,r;let e=(r=(t=this.deviceInfo)==null?void 0:t.batteryInfo)==null?void 0:r.percentage;if(e!=null)return {percentage:e}}isTablet(){var e,t;return (t=(e=this.deviceInfo)==null?void 0:e.isTablet)!=null?t:false}setupDeviceInterface(e,t){this.deviceInfo={isTablet:e,batteryInfo:t};let r=this.moduleHandler.get(),i=r.DeviceInterface.extend("DeviceInterface",{getBatteryData:this.getBatteryData.bind(this),isTablet:this.isTablet.bind(this)});this.deviceInstance=new i,r.DeviceHolder.setCurrentDevice(this.deviceInstance);}updateBatteryInfo(e){this.deviceInfo&&(this.deviceInfo.batteryInfo=e);}start(e,t,r){e&&t&&(this.setupDataDecoding(),this.moduleHandler.get().callMain(),this.moduleHandler.get().__emscripten_proxy_main!==void 0||r());}getWritableDataPath(e){return e!=null?(a$3.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:t,writableDataPathOverride:r,indexedDBTimeoutMs:i,verifyResponseHash:n,referredOrigin:l,fixedWasmMemory:c,simdSupport:h,threadsSupport:g}){var v;let u=false,p=false;this.writableDataPath=this.getWritableDataPath(r),this.resourcePath=`${e}${this.resourceFilesSubfolder}/`,globalThis.path=t;let{resolve:f,reject:m,promise:C}=new a$5,b=a$6.sdkVersion();if(b==="")throw new a$7({name:"Invalid library version",message:"Library version is not defined or empty, cannot generate proper path to library files."});let y=this.getWasmCoreFileName(h,g),a=d(b,e,y),{jsURI:o,wasmURI:w}=a,W={instantiateWasm:(d,H)=>(a$a({importObject:d,wasmURI:w,expectedHash:this.getWasmCoreExpectedHash(h,g),verifyResponseHash:n,successCallback:H,progressCallback:this._loadProgressCallback,errorCallback:N=>{m(N);},referredOrigin:l}),{})},M=c===null?null:new WebAssembly.Memory({initial:this.numOfMBToPages(c),maximum:this.numOfMBToPages(300),shared:g});return M!==null&&a$3.log(a$3.Level.Debug,"Fixed wasmMemory set",M),this.moduleHandler.set({...M?{wasmMemory:M}:{},mainScriptUrlOrBlob:o,canvas:(v=this.workerFunctions.getOffscreenCanvas())!=null?v:{getContext:()=>null},...W,dynamicLibraries:this.getWasmDynamicLibraries(w),locateFile:d=>e+d,noInitialRun:true,preRun:[async()=>{try{await a$8({writableDataPath:this.writableDataPath,indexedDBTimeoutMs:i});}catch(d){if(d.name==="BlockedIndexedDB"){m(d.toString());return}a$3.log(a$3.Level.Debug,"No IndexedDB support, some data will not be persisted:",d);}p=true,this.start(p,u,f);}],onMainComplete:()=>{if([u,p].includes(false)){a$3.log(a$3.Level.Warn,{runtimeLoaded:u,fileSystemSynced:p},"Both runtimeLoaded and fileSystemSynced should be true when calling onMainComplete"),m("onMainComplete has been called but runtime or file system was not ready.");return}f();},onRuntimeInitialized:()=>{u=true,this.start(p,u,f);},print:d=>{a$3.info(d);}}),await a$9(o,b)||m(`Couldn't retrieve Scandit Data Capture library at ${o}, did you configure the path for it correctly?`),C}};P.get3dPartyLicenseKeyMethodName=atob("Z2V0QmxpbmtJZExpY2Vuc2VLZXk=");var V=P;export{V as a};
@@ -1 +1 @@
1
- import {a as a$b}from'./chunk-U7ETOWGJ.js';import {b as b$2}from'./chunk-6AZW5IIG.js';import {a as a$c}from'./chunk-DGIQ3GF7.js';import {a as a$l}from'./chunk-AE2LWVIB.js';import {b,a as a$6}from'./chunk-RXDVYEE5.js';import {a as a$j}from'./chunk-ACCTMSWC.js';import {a as a$d}from'./chunk-TPHGDMKG.js';import {a as a$h}from'./chunk-GPPCTFZF.js';import {a as a$n}from'./chunk-Y7V35LNT.js';import {b as b$1}from'./chunk-24MGHMOY.js';import {a as a$g}from'./chunk-WOOPJWJS.js';import {a as a$i}from'./chunk-U4IMOTYL.js';import {a as a$e}from'./chunk-KYNYQBNF.js';import {a}from'./chunk-56OQ5EHO.js';import {a as a$9}from'./chunk-RSQRPDVQ.js';import {a as a$8}from'./chunk-IJQG3OU6.js';import {a as a$a}from'./chunk-I6SWF3FQ.js';import {a as a$3}from'./chunk-MA6UDVDJ.js';import {e,y}from'./chunk-TTGJAMI2.js';import {a as a$r}from'./chunk-ENYHCJGH.js';import {a as a$5}from'./chunk-N5YZEC56.js';import {a as a$2}from'./chunk-VJB527QZ.js';import {a as a$1}from'./chunk-GHTCNOQN.js';import {a as a$q}from'./chunk-Q7JWDX4U.js';import {a as a$f}from'./chunk-UWBNF47P.js';import {g}from'./chunk-CA6FHIF6.js';import {a as a$4}from'./chunk-LFJUGRQV.js';import {a as a$7}from'./chunk-KAFNKP6O.js';import {a as a$p}from'./chunk-E4XJ4GKD.js';import {a as a$m}from'./chunk-QOCHMKNY.js';import {a as a$k}from'./chunk-XR65N6EG.js';import {a as a$o}from'./chunk-WUHKODFA.js';var L="core.camera.recovery",ee;ee=a$4;var V=class V{constructor(){this.focusGesture=a.focusGesture;this.shouldShowZoomNotification=true;this._zoomGestures=a.zoomGestures;this.swipeToZoomGesture=null;this.pinchToZoomGesture=null;this._scanAreaMargins=a.scanAreaMargins;this._pointOfInterest=a.pointOfInterest;this._logoStyle=a.logoStyle;this._logoAnchor=a.logoAnchor;this._logoOffset=a.logoOffset;this._context=null;this.overlays=new Set;this.controlMap=new Map;this.frameSourceListener={didChangeState:this.onFrameSourceChange.bind(this)};this._previewCamera=null;this.isConnected=false;this.controlsElement=void 0;this.frozenFrameCanvas=document.createElement("canvas");this.listeners=[];this.isVideoElementDetached=false;this.orientation="portrait";this.hiddenProperties={stopVideoTracksOnVisibilityChange:true,freezeFrameWhenStoppingFrameSource:true,forceScanAreaMarginsToPixels:false};this.orientationObserver=new b;this.onOrientationChangeListener=this.onOrientationChange.bind(this);this.onHintPresenterUpdateHandler=this.onHintPresenterUpdate.bind(this);this.onViewFinderUpdateRequestedHandler=this.onViewFinderUpdateRequested.bind(this);this.onWorkerMessageHandler=this.onWorkerMessage.bind(this);this.htmlElementDidChangeHandler=this.htmlElementDidChange.bind(this);this.htmlElementDisconnectedHandler=this.htmlElementDisconnected.bind(this);this.notificationPresenter=null;this.zoomNotificationDuration=4e3;this.zoomNotificationTimeout=null;this[ee]={attachAdditionalLayer:this.attachAdditionalLayer.bind(this)};this.visibilityListener=this.onVisibilityChange.bind(this),this.cameraRecoveryListener=this.cameraRecovery.bind(this),a$1.getInstance().updateIfMissing(a$2),this.zoomGestures=[...a.zoomGestures];}get zoomGestures(){return this._zoomGestures}set zoomGestures(e){this.removeSwipeToZoomListener(),this.removePinchToZoomListener(),this._zoomGestures=e,this.addSwipeToZoomListener(),this.addPinchToZoomListener();}get videoElement(){return g.instance().getVideoElement()}get scanAreaMargins(){return this._scanAreaMargins}set scanAreaMargins(e){var n,o,a;let t=this.hiddenProperties.forceScanAreaMarginsToPixels?this.marginsToPixels(e):e,i=this._scanAreaMargins;this._scanAreaMargins=t;for(let l of this.listeners)(n=l.willChangeScanAreaMargins)==null||n.call(l,this,i,t);((a=(o=this.privateContext)==null?void 0:o.update())!=null?a:Promise.resolve()).then(()=>{var l;for(let h of this.listeners)(l=h.didChangeScanAreaMargins)==null||l.call(h,this,t);});}marginsToPixels(e){let{width:t,height:i}=this;if(t===0&&i===0)return e;let r=(n,o)=>n.unit==="pixel"?n:new a$r(n.value*o,"pixel");return new a$3(r(e.left,t),r(e.top,i),r(e.right,t),r(e.bottom,i))}get pointOfInterest(){return this._pointOfInterest}set pointOfInterest(e){var t;this._pointOfInterest=e,(t=this.privateContext)==null||t.update();}get logoStyle(){return this._logoStyle}set logoStyle(e){var t;this._logoStyle=e,(t=this.privateContext)==null||t.update();}get logoAnchor(){return this._logoAnchor}set logoAnchor(e){var t;this._logoAnchor=e,(t=this.privateContext)==null||t.update();}get logoOffset(){return this._logoOffset}set logoOffset(e){var t;this._logoOffset=e,(t=this.privateContext)==null||t.update();}get cameraRecoveryText(){return a$1.getInstance().get(L)}get width(){var e,t;return Math.round((t=(e=this.htmlElementState)==null?void 0:e.width)!=null?t:0)}get height(){var e,t;return Math.round((t=(e=this.htmlElementState)==null?void 0:e.height)!=null?t:0)}get canvasDrawer(){return !this._canvasDrawer&&this.canvasElement!=null&&(this._canvasDrawer=new b$1(this.canvasElement),this._canvasDrawer.startObservingCanvasResize()),this._canvasDrawer}get controls(){return this.controlMap.values()}get privateContext(){return this._context}static async forContext(e){let t=new V;return await t.setContext(e),t}showProgressBar(){var e;(e=this.loadingOverlay)==null||e.show();}hideProgressBar(){var e;(e=this.loadingOverlay)==null||e.hide();}setProgressBarPercentage(e){this.loadingOverlay&&(this.loadingOverlay.progress=e);}setProgressBarMessage(e){this.loadingOverlay&&(this.loadingOverlay.message=e);}getContext(){return this._context}async setContext(e){var t,i,r;if(this._context!==e&&(this._context=e,e)){if(this.overlays.size>0&&!((t=this._context)!=null&&t[a$4].hasModes()))throw new Error(["Cannot assign this view to this context. This view has overlays but the context does not have any mode attached matching these overlays.","Remove the overlays first before attaching the view to the context, or add the corresponding mode to the context before attaching this view."].join(" "));await e.setView(this),(i=this.privateContext)==null||i.subscribeToWorkerMessages(this.onWorkerMessageHandler),(r=this._context)!=null&&r.frameSource&&await this.onFrameSourceChange(this._context.frameSource);}}connectToElement(e,t){var i,r,n,o;this.isConnected||(this.orientationObserver.register(),this.setupHtmlElement(e),(i=this.canvasDrawer)==null||i.startObservingCanvasResize(),this.htmlElementDidChange(),a$5.add(this),this.orientation=this.orientationObserver.orientation.value,this.orientationObserver.addEventListener(a$6,this.onOrientationChangeListener),(r=this.hintPresenter)==null||r.addEventListener("hintpresenterupdate",this.onHintPresenterUpdateHandler),(n=this.hintPresenter)==null||n.addEventListener("hintpresenterviewfinderupdaterequested",this.onViewFinderUpdateRequestedHandler),this.localizationSubscription=a$1.getInstance().subscribe(a=>{a[L]!=null&&(this.cameraRecoveryElement.textContent=a[L]);}),this._previewCamera=(o=t==null?void 0:t.camera)!=null?o:null,this._previewCamera&&(this._previewCamera.addListener(this.frameSourceListener),this.onFrameSourceChange(this._previewCamera)),this.updateControls(),this.isConnected=true);}detachFromElement(){var e,t,i,r,n,o,a,l;if(this.isConnected){(e=this.htmlElementState)==null||e.removeListeners(),this.removeStyles(),(t=this.canvasDrawer)==null||t.endObservingCanvasResize(),document.removeEventListener("visibilitychange",this.visibilityListener);for(let h of ["touchend","mousedown"])this.cameraRecoveryElement.removeEventListener(h,this.cameraRecoveryListener);(i=this.loadingOverlay)==null||i.remove(),(r=this.customLocationsView)==null||r.unmount(),this.notificationPresenter=null,this.htmlElementDidChange(),this.removeSwipeToZoomListener(),this.removePinchToZoomListener(),(n=this.gestureRecognizer)==null||n.removeListener(this),this.clearHtmlElementContent(),a$5.delete(this),this.orientationObserver.unregister(),this.orientationObserver.removeEventListener(a$6,this.onOrientationChangeListener),(o=this.hintPresenter)==null||o.removeEventListener("hintpresenterupdate",this.onHintPresenterUpdateHandler),(a=this.hintPresenter)==null||a.removeEventListener("hintpresenterviewfinderupdaterequested",this.onViewFinderUpdateRequestedHandler),(l=this.localizationSubscription)==null||l.cancel(),g.instance().disconnectedCallback(),this._previewCamera&&(this._previewCamera.removeListener(this.frameSourceListener),this._previewCamera=null);for(let h of this.controls)this.removeControl(h);this.isConnected=false;}}async addOverlay(e){var t;this.overlays.has(e)||(this.overlays.add(e),await((t=this.privateContext)==null?void 0:t.update([{type:"addOverlay",newValue:e,view:this}])));}async removeOverlay(e){var t;this.overlays.has(e)&&(await((t=this.privateContext)==null?void 0:t.update([{type:"removeOverlay",newValue:e,view:this}])),this.overlays.delete(e));}addListener(e){this.listeners.includes(e)||this.listeners.push(e);}removeListener(e){this.listeners.includes(e)&&this.listeners.splice(this.listeners.indexOf(e),1);}viewPointForFramePoint(e){var u,D,T,M,F,R,A,N;let t={width:(D=(u=this.htmlElementState)==null?void 0:u.width)!=null?D:0,height:(M=(T=this.htmlElementState)==null?void 0:T.height)!=null?M:0},i={width:(R=(F=this.videoElement)==null?void 0:F.videoWidth)!=null?R:0,height:(N=(A=this.videoElement)==null?void 0:A.videoHeight)!=null?N:0},r=t.width/t.height,n=i.width/i.height,o=r>n?t.width/i.width:t.height/i.height,a={x:e.x*o,y:e.y*o},l=(i.width*o-t.width)/2,h=(i.height*o-t.height)/2;return new a$7(a.x-l,a.y-h)}viewQuadrilateralForFrameQuadrilateral(e){let t=this.viewPointForFramePoint(e.topLeft),i=this.viewPointForFramePoint(e.topRight),r=this.viewPointForFramePoint(e.bottomLeft),n=this.viewPointForFramePoint(e.bottomRight);return new a$8(t,i,n,r)}addControl(e){let t=e.toJSONObject().type;if(!this.controlMap.has(t)&&!(t==="camera-fov"&&this.controlMap.has("zoom"))){if(t==="zoom"){let i=this.controlMap.get("camera-fov");i&&this.removeControl(i);}this.controlMap.set(t,e),e.install(this).then(i=>{var r;i&&((r=this.privateContext)==null||r.update([{type:"addControl",newValue:e}]));});}}removeControl(e){var i;let t=e.toJSONObject().type;this.controlMap.has(t)&&(e.remove(true),this.controlMap.delete(t),(i=this.privateContext)==null||i.update([{type:"removeControl",newValue:e}]));}toJSONObject(){var e;return {scanAreaMargins:this.scanAreaMargins.toJSONObject(),pointOfInterest:this.pointOfInterest.toJSONObject(),logoAnchor:this.logoAnchor,logoOffset:this.logoOffset.toJSONObject(),logoHidden:(e=this.logoHidden)!=null?e:false,logoStyle:this.logoStyle,overlays:[...this.overlays].map(t=>t.toJSONObject()),controls:[...this.controls].map(t=>t.toJSONObject()),focusGesture:this.focusGesture?this.focusGesture.toJSONObject():null,zoomGestures:this._zoomGestures.map(t=>t.toJSONObject())}}isCameraRecoveryVisible(){return !this.cameraRecoveryElement.hidden}setCameraRecoveryVisible(e){this.cameraRecoveryElement.hidden=!e;}async allowPictureInPicture(e){await g.instance().allowPictureInPicture(e);}viewAnchorPositionsForFrameAnchorPositions(e){let t=this.viewPointForFramePoint(e.topLeft),i=this.viewPointForFramePoint(e.topRight),r=this.viewPointForFramePoint(e.bottomLeft),n=this.viewPointForFramePoint(e.bottomRight),o=this.viewPointForFramePoint(e.centerLeft),a=this.viewPointForFramePoint(e.centerRight),l=this.viewPointForFramePoint(e.topCenter),h=this.viewPointForFramePoint(e.bottomCenter),u=this.viewPointForFramePoint(e.center);return new a$9(t,i,n,r,o,l,a,h,u)}setDidTapCustomLocationsViewListener(e){this.customLocationsView&&this.customLocationsView.listener===null&&(this.customLocationsView.listener=e);}renderCustomLocationsView(e){this.customLocationsView!=null&&(this.customLocationsView.setMirrored(g.instance().isMirrorImageEnabled()),Object.keys(e).includes("removedIds")?this.customLocationsView.render(e):this.customLocationsView.renderDomView(e));}getNotificationPresenter(){var e;if(!this.notificationPresenter){let t=(e=this.htmlElement)==null?void 0:e.querySelector(b$2.tag);if(!t)throw new Error("Notification presenter cannot be found. Please ensure the DataCaptureView is connected.");this.notificationPresenter=new a$a(t);}return this.notificationPresenter}removeStyles(){for(let e of document.querySelectorAll("style[scandit]"))e.remove();}onHintPresenterUpdate(e){var t;(t=this.privateContext)==null||t.workerCommand("hintPresenterV2update",{});}async onViewFinderUpdateRequested(e){var i;let t=await((i=this.privateContext)==null?void 0:i.workerCommand("getViewfinderInfo",{}));t!=null&&this.updateHintPresenterViewFinderRect(t.rect);}clearHtmlElementContent(){var e;this.htmlElement&&((e=this.canvasDrawer)==null||e.endObservingCanvasResize(),this.htmlElement.innerHTML="",this.cameraPaintboardElement=void 0,this.singleImageUploaderPaintboardElement=void 0,this.htmlElement=void 0);}setupHtmlElement(e){var n,o,a;this.createStyles(),this.htmlElement=e,b$2.register(),a$b.register(),a$c.register();let t=a$f`<div class="${a$d.CONTAINER_CLASS_NAME}" role="main" aria-label="Data capture view"><div class="${a$d.PAINTBOARDS_CONTAINER_CLASS_NAME}"><div data-js-id="loading-overlay"></div><div class="${a$d.PAINTBOARD_CLASS_NAME}" data-js-id="camera-paintboard"><div data-js-id="video-container"></div><img class="${a$d.FROZEN_FRAME}" data-js-id="frozen-frame" alt="Last captured camera frame shown while camera is on standby" hidden /><canvas></canvas><div data-js-id="${a$e.CUSTOM_VIEW_CONTAINER}"></div><${b$2.tag}></${b$2.tag}><${a$b.tag}></${a$b.tag}><div class="${a$d.CAMERA_RECOVERY_CLASS_NAME}" role="alert" aria-live="polite" aria-atomic="true" hidden>${this.cameraRecoveryText}</div><div class="${a$d.ERROR_CLASS_NAME}" role="alert" aria-live="assertive" aria-atomic="true" hidden></div></div><div class="${a$d.PAINTBOARD_CLASS_NAME}" data-js-id="singleimage-paintboard"></div></div></div>`;this.htmlElement.innerHTML=t,g.instance().connectedCallback(this.htmlElement.querySelector('[data-js-id="video-container"]')),this.isVideoElementDetached=false,this.hintPresenter=this.htmlElement.querySelector(b$2.tag),this.notificationPresenter=this.hintPresenter?new a$a(this.hintPresenter):null,this.loadingOverlay&&this.loadingOverlay.remove(),this.loadingOverlay=a$c.create(),this.loadingOverlay.hide(),(n=this.htmlElement.querySelector('[data-js-id="loading-overlay"]'))==null||n.replaceWith(this.loadingOverlay),this.customLocationsView&&this.customLocationsView.unmount(),this.customLocationsView=new a$g,this.customLocationsView.mount(this.htmlElement.querySelector(`[data-js-id="${a$e.CUSTOM_VIEW_CONTAINER}"]`)),this.customLocationsView.mapViewAnchorPositionsForFramePoint=l=>this.viewAnchorPositionsForFrameAnchorPositions(l),this.containerElement=this.htmlElement.querySelector(`.${a$d.CONTAINER_CLASS_NAME}`),this.cameraPaintboardElement=this.containerElement.querySelector('[data-js-id="camera-paintboard"]'),this.singleImageUploaderPaintboardElement=this.containerElement.querySelector('[data-js-id="singleimage-paintboard"]');let i=this.cameraPaintboardElement.querySelector("canvas");this.canvasElement==null?this.canvasElement=i:i.replaceWith(this.canvasElement);let r=this.cameraPaintboardElement.querySelector('[data-js-id="frozen-frame"]');this.frozenFrame==null?this.frozenFrame=r:r.replaceWith(this.frozenFrame),this.controlsElement=this.cameraPaintboardElement.querySelector(a$b.tag),this.cameraRecoveryElement=this.cameraPaintboardElement.querySelector(`.${a$d.CAMERA_RECOVERY_CLASS_NAME}`),this.errorElement=this.cameraPaintboardElement.querySelector(`.${a$d.ERROR_CLASS_NAME}`),this.lastFrameSourceState!=null&&((a=(o=this._context)==null?void 0:o.frameSource)==null||a.switchToDesiredState(this.lastFrameSourceState)),document.addEventListener("visibilitychange",this.visibilityListener);for(let l of ["touchend","mousedown"])this.cameraRecoveryElement.addEventListener(l,this.cameraRecoveryListener);this.htmlElementState&&this.htmlElementState.removeListeners(),this.htmlElementState=new a$h(this.htmlElement),this.htmlElementState.onStateChanged(this.htmlElementDidChangeHandler),this.htmlElementState.onDisconnected(this.htmlElementDisconnectedHandler),this.gestureRecognizer=new a$i(this.htmlElement),this.gestureRecognizer.addListener(this),this.addSwipeToZoomListener(),this.addPinchToZoomListener();}setupHtmlElementSingleImageUploader(e){var i;if(this.singleImageUploaderPaintboardElement==null)return;this.singleImageUploaderView&&this.singleImageUploaderView.unmount(),this.singleImageUploaderView=new a$j(e),this.singleImageUploaderView.mount(this.containerElement.querySelector('[data-js-id="singleimage-paintboard"]'));let t=(i=this._context)==null?void 0:i.frameSource;this.singleImageUploaderView.onInputCheck(r=>{t.getCurrentState()!=="starting"&&r.preventDefault();}),this.singleImageUploaderView.onBeforeFileRead(()=>{t._context&&this.singleImageUploaderView&&(this.singleImageUploaderView.canUploadFile=t._context.hasEnabledMode());}),this.singleImageUploaderView.onImageLoadError(()=>{t.currentState="starting",a$k.log(a$k.Level.Error,"Could not load image from selected file");}),this.singleImageUploaderView.onFileReaderError(r=>{var o,a;let n=r.target;t.currentState="starting",a$k.log(a$k.Level.Error,`Error while reading the file: ${(a=(o=n.error)==null?void 0:o.toString())!=null?a:""}`);}),this.singleImageUploaderView.onCaptureReady(async r=>{await t.processUploadedFileCapture(r);}),this.singleImageUploaderView.setButtonState(t.getCurrentState()==="starting"?"enabled":"disabled"),t.addView(this.singleImageUploaderView);}setupHtmlElementVisibility(e){this.cameraPaintboardElement!=null&&(this.cameraPaintboardElement.hidden=e!=="camera"),this.singleImageUploaderPaintboardElement!=null&&(this.singleImageUploaderPaintboardElement.hidden=e!=="singleImageUploader");}createStyles(){if(document.querySelector("style[scandit]")===null){let e=a$l();for(let[t,i]of Object.entries(e))i.setAttribute("scandit",`data-capture-sdk-${t}`),document.head.append(i);}}async onOrientationChange(e){var t,i;this.orientation=e.detail.value,await((i=this.privateContext)==null?void 0:i.update([{type:"viewChange",newValue:{...(t=this.htmlElementState)==null?void 0:t.toJSONObject(),orientation:this.orientation}}]));}htmlElementDidChange(){var i,r;if(!this.htmlElementState)return;let e=this.htmlElementState,t=e.toJSONObject();if(!a$h.areEquivalentJSONStates(this.lastHtmlElementState,t)){this.orientation=this.orientationObserver.orientation.value,(i=this.privateContext)==null||i.update([{type:"viewChange",newValue:{...e.toJSONObject(),orientation:this.orientation}}]),this.lastHtmlElementState=t,(r=this.canvasDrawer)==null||r.updateCanvasSizeAttributes(this.width,this.height),this.handleVideoDisplay(t.visible);for(let n of this.listeners)typeof n.didChangeSize=="function"&&n.didChangeSize(this,new a$m(t.size.width.value,t.size.height.value),this.orientation);}}async htmlElementDisconnected(){var e,t,i,r,n,o;g.instance().disconnectedCallback(),this.lastFrameSourceState=(t=(e=this._context)==null?void 0:e.frameSource)==null?void 0:t.getCurrentState(),await((r=(i=this._context)==null?void 0:i.frameSource)==null?void 0:r.switchToDesiredState("off")),await((o=this.privateContext)==null?void 0:o.update([{type:"viewChange",newValue:{...(n=this.htmlElementState)==null?void 0:n.toJSONObject(),orientation:this.orientation}}])),this.isConnected=false;}attachAdditionalLayer(e,t){var i;t==="above-controls"&&((i=this.controlsElement)==null||i.insertAdjacentElement("afterend",e));}handleVideoDisplay(e){this.videoElement==null||this.cameraPaintboardElement==null||(!e&&!this.isVideoElementDetached?(this.videoElement.width=0,this.videoElement.height=0,this.videoElement.style.opacity="0",this.videoElement.style.visibility="hidden",document.body.append(this.videoElement),this.isVideoElementDetached=true):e&&this.isVideoElementDetached&&(this.cameraPaintboardElement.insertAdjacentElement("afterbegin",this.videoElement),this.isVideoElementDetached=false,this.videoElement.style.removeProperty("visibility"),this.videoElement.removeAttribute("width"),this.videoElement.removeAttribute("height"),this.videoElement.style.removeProperty("opacity")));}isCanvasDrawerWithMetrics(e){return e instanceof a$n}onWorkerMessage(e){var t,i;switch(e.type){case "draw":{this.drawEngineCommands(e.payload);break}case "performanceMetricsReport":{let r=this._canvasDrawer;r!=null&&this.isCanvasDrawerWithMetrics(r)&&r.setPerformanceMetrics(e.payload);break}case "contextDidChangeStatus":{let r=a$o.fromJSON(e.payload);(t=this.loadingOverlay)==null||t.hide(),r.isValid?(this.clearError(),this.setVideoElementOpacity("1")):this.displayError(r);break}case "viewSizeChanged":{let r=e.payload;if(r==null)return;this.onSDCViewSizeChangedCallback(r);break}default:{(i=this.hintPresenter)==null||i.handleMessage(e);break}}}onSDCViewSizeChangedCallback(e){this.updateHintPresenterViewFinderRect(e.viewFinderRect);}updateHintPresenterViewFinderRect(e){var t;(t=this.hintPresenter)==null||t.setViewFinderRect(new a$p(new a$7(e.origin.x,e.origin.y),new a$m(e.size.width,e.size.height)));}drawEngineCommands(e){var t;(t=this.canvasDrawer)==null||t.draw(e);}displayError(e){this.errorElement.textContent=`Error ${e.code}: ${e.message}`,this.errorElement.hidden=false;}clearError(){this.errorElement.textContent="",this.errorElement.hidden=true;}updateControls(){var e;for(let t of this.controls)(e=t.update)==null||e.call(t,this);}async onFrameSourceChange(e){let t=e==null?void 0:e.type;if(this.setupHtmlElementVisibility(t),t==="camera"){let i=e==null?void 0:e.getCurrentState();i!=null&&await this.onCameraStateChanged(i);}else t==="singleImageUploader"&&this.setupHtmlElementSingleImageUploader(e.settings);}async onCameraStateChanged(e){var t;switch((t=this.cameraPaintboardElement)==null||t.classList.toggle(a$d.PAINTBOARD_CLASS_NAME_STATE_ON,e==="on"),e){case "stopping":{this.hiddenProperties.freezeFrameWhenStoppingFrameSource&&this.freezeFrame(),this.setVideoElementOpacity("0");return}case "starting":case "bootingUp":case "wakingUp":{if(!this.htmlElement){a$k.error("cannot set frame source stream before connecting view to an HTML element");return}this.videoElement&&(g.instance().gui.isCameraRecoveryVisible=this.isCameraRecoveryVisible.bind(this),g.instance().gui.setCameraRecoveryVisible=this.setCameraRecoveryVisible.bind(this),this.setVideoElementOpacity("0"));return}case "off":{this.setVideoElementOpacity("0"),this.updateControls();return}case "on":{await g.instance().waitForCapabilities(),this.updateControls(),this.unfreezeFrame(),this.setVideoElementOpacity("1");break}case "goingToSleep":{this.freezeFrame();break}}}setVideoElementOpacity(e){this.videoElement&&(this.videoElement.style.opacity=e),this.canvasElement&&(this.canvasElement.style.opacity=e);}onSingleImageUploaderSettingsChange(e){this.setupHtmlElementSingleImageUploader(e);}setHiddenProperty(e,t){this.hiddenProperties[e]=t;}async onVisibilityChange(){var t,i;let e=(t=this.videoElement)==null?void 0:t.srcObject;if(this.hiddenProperties.stopVideoTracksOnVisibilityChange&&(document.visibilityState==="hidden"&&g.instance().stopVideoTracks(),document.visibilityState==="visible"&&g.instance().activeCamera!=null&&e!=null))if(!e.active||(i=e.getVideoTracks()[0])!=null&&i.muted)try{a$k.debug('Detected visibility change ("visible") event with inactive video source, try to reinitialize camera'),await g.instance().reinitializeCamera();}catch{}else a$k.debug('Detected visibility change ("visible") event with active video source, replay video'),g.instance().playVideo();}async cameraRecovery(e){e.preventDefault(),g.instance().activeCamera=g.instance().selectedCamera,await g.instance().reinitializeCamera();}freezeFrame(){var i;if(!this.frozenFrame)return;let e=g.instance().getCurrentFrame();if(!e)return;let t=new ImageData(e.data,e.width,e.height);this.frozenFrameCanvas.width=t.width,this.frozenFrameCanvas.height=t.height,this.frozenFrame.width=t.width,this.frozenFrame.height=t.height,(i=this.frozenFrameCanvas.getContext("2d"))==null||i.putImageData(t,0,0),this.frozenFrame.src=this.frozenFrameCanvas.toDataURL("image/jpeg",.4),this.frozenFrame.classList.toggle(a$d.MIRRORED_CLASS_NAME,g.instance().isMirrorImageEnabled()),this.frozenFrame.hidden=false;}unfreezeFrame(){this.frozenFrame&&(this.frozenFrame.src="",this.frozenFrame.hidden=true);}onTap(e){var t;(t=this.privateContext)==null||t.workerCommand("onTap",{point:e.toJSONObject()});}onSwipeUp(){var e;(e=this.swipeToZoomGesture)==null||e.triggerZoomIn();}onSwipeDown(){var e;(e=this.swipeToZoomGesture)==null||e.triggerZoomOut();}onPinchIn(){var e;(e=this.pinchToZoomGesture)==null||e.triggerZoomIn();}onPinchOut(){var e;(e=this.pinchToZoomGesture)==null||e.triggerZoomOut();}didZoomInGesture(){this.performZoomIn();}didZoomOutGesture(){this.performZoomOut();}addSwipeToZoomListener(){let e=this._zoomGestures.find(t=>t.toJSONObject().type==="swipeToZoom");e&&(this.swipeToZoomGesture=e,e.addListener(this));}removeSwipeToZoomListener(){var e;(e=this.swipeToZoomGesture)==null||e.removeListener(this),this.swipeToZoomGesture=null;}addPinchToZoomListener(){let e=this._zoomGestures.find(t=>t.toJSONObject().type==="pinchToZoom");e&&(this.pinchToZoomGesture=e,e.addListener(this));}removePinchToZoomListener(){var e;(e=this.pinchToZoomGesture)==null||e.removeListener(this),this.pinchToZoomGesture=null;}async performZoomIn(){var n;let e=(n=this._context)==null?void 0:n.frameSource;if(!(e!=null&&e.settings))return;let t=e.settings.zoomFactor,r=[...e.settings.zoomLevels].sort((o,a)=>o-a).find(o=>o>t);r!=null&&(await e.setZoomFactor(r),this.showZoomNotification(r));}async performZoomOut(){var n;let e=(n=this._context)==null?void 0:n.frameSource;if(!(e!=null&&e.settings))return;let t=e.settings.zoomFactor,r=[...[...e.settings.zoomLevels].sort((o,a)=>o-a)].reverse().find(o=>o<t);r!=null&&(await e.setZoomFactor(r),this.showZoomNotification(r));}async showZoomNotification(e$1){var r,n;if(!this.shouldShowZoomNotification)return;let t=e.toJSON(),i={tag:"zoomNotification",text:this.formatZoomFactor(e$1),hintStyle:{textColor:t,backgroundColor:y.neutralWhite.withAlpha(.8).toJSON(),textAlignment:"center",hintIcon:"none",iconColor:t,isAnimatedToView:true,hintAnchor:"top",hintAnchorOffset:16,horizontalMargin:16,maxWidthFraction:1,textSize:14,textWeight:700,lineHeight:24,maxLines:3,cornerRadius:4,fitToText:true}};(r=this.zoomNotificationTimeout)==null||r.stop(),this.zoomNotificationTimeout=new a$q(this.zoomNotificationDuration,()=>{var o;(o=this.hintPresenter)==null||o.hideToast(i);}),await((n=this.hintPresenter)==null?void 0:n.showToast(i)),this.zoomNotificationTimeout.start();}formatZoomFactor(e){let t=Math.ceil(e*100)/100;return parseFloat(t.toPrecision(3))+"x"}},X=V;export{X as a};
1
+ import {a as a$b}from'./chunk-U7ETOWGJ.js';import {b as b$2}from'./chunk-6AZW5IIG.js';import {a as a$c}from'./chunk-DGIQ3GF7.js';import {a as a$l}from'./chunk-AE2LWVIB.js';import {b,a as a$6}from'./chunk-RXDVYEE5.js';import {a as a$j}from'./chunk-Z5LRFYGI.js';import {a as a$d}from'./chunk-TPHGDMKG.js';import {a as a$h}from'./chunk-GPPCTFZF.js';import {a as a$n}from'./chunk-Y7V35LNT.js';import {b as b$1}from'./chunk-24MGHMOY.js';import {a as a$g}from'./chunk-XFQTFQYR.js';import {a as a$i}from'./chunk-U4IMOTYL.js';import {a as a$e}from'./chunk-KYNYQBNF.js';import {a as a$9}from'./chunk-RSQRPDVQ.js';import {a}from'./chunk-6V2N4XHI.js';import {a as a$3}from'./chunk-MA6UDVDJ.js';import {a as a$8}from'./chunk-IJQG3OU6.js';import {a as a$a}from'./chunk-I6SWF3FQ.js';import {e,y}from'./chunk-TTGJAMI2.js';import {a as a$r}from'./chunk-ENYHCJGH.js';import {a as a$5}from'./chunk-N5YZEC56.js';import {a as a$2}from'./chunk-VJB527QZ.js';import {a as a$1}from'./chunk-GHTCNOQN.js';import {a as a$q}from'./chunk-Q7JWDX4U.js';import {a as a$f}from'./chunk-UWBNF47P.js';import {g}from'./chunk-CZI3JAVS.js';import {a as a$4}from'./chunk-LFJUGRQV.js';import {a as a$m}from'./chunk-QOCHMKNY.js';import {a as a$7}from'./chunk-KAFNKP6O.js';import {a as a$p}from'./chunk-E4XJ4GKD.js';import {a as a$k}from'./chunk-XR65N6EG.js';import {a as a$o}from'./chunk-WUHKODFA.js';var L="core.camera.recovery",ee;ee=a$4;var V=class V{constructor(){this.focusGesture=a.focusGesture;this.shouldShowZoomNotification=true;this._zoomGestures=a.zoomGestures;this.swipeToZoomGesture=null;this.pinchToZoomGesture=null;this._scanAreaMargins=a.scanAreaMargins;this._pointOfInterest=a.pointOfInterest;this._logoStyle=a.logoStyle;this._logoAnchor=a.logoAnchor;this._logoOffset=a.logoOffset;this._context=null;this.overlays=new Set;this.controlMap=new Map;this.frameSourceListener={didChangeState:this.onFrameSourceChange.bind(this)};this._previewCamera=null;this.isConnected=false;this.controlsElement=void 0;this.frozenFrameCanvas=document.createElement("canvas");this.listeners=[];this.isVideoElementDetached=false;this.orientation="portrait";this.hiddenProperties={stopVideoTracksOnVisibilityChange:true,freezeFrameWhenStoppingFrameSource:true,forceScanAreaMarginsToPixels:false};this.orientationObserver=new b;this.onOrientationChangeListener=this.onOrientationChange.bind(this);this.onHintPresenterUpdateHandler=this.onHintPresenterUpdate.bind(this);this.onViewFinderUpdateRequestedHandler=this.onViewFinderUpdateRequested.bind(this);this.onWorkerMessageHandler=this.onWorkerMessage.bind(this);this.htmlElementDidChangeHandler=this.htmlElementDidChange.bind(this);this.htmlElementDisconnectedHandler=this.htmlElementDisconnected.bind(this);this.notificationPresenter=null;this.zoomNotificationDuration=4e3;this.zoomNotificationTimeout=null;this[ee]={attachAdditionalLayer:this.attachAdditionalLayer.bind(this)};this.visibilityListener=this.onVisibilityChange.bind(this),this.cameraRecoveryListener=this.cameraRecovery.bind(this),a$1.getInstance().updateIfMissing(a$2),this.zoomGestures=[...a.zoomGestures];}get zoomGestures(){return this._zoomGestures}set zoomGestures(e){this.removeSwipeToZoomListener(),this.removePinchToZoomListener(),this._zoomGestures=e,this.addSwipeToZoomListener(),this.addPinchToZoomListener();}get videoElement(){return g.instance().getVideoElement()}get scanAreaMargins(){return this._scanAreaMargins}set scanAreaMargins(e){var n,o,a;let t=this.hiddenProperties.forceScanAreaMarginsToPixels?this.marginsToPixels(e):e,i=this._scanAreaMargins;this._scanAreaMargins=t;for(let l of this.listeners)(n=l.willChangeScanAreaMargins)==null||n.call(l,this,i,t);((a=(o=this.privateContext)==null?void 0:o.update())!=null?a:Promise.resolve()).then(()=>{var l;for(let h of this.listeners)(l=h.didChangeScanAreaMargins)==null||l.call(h,this,t);});}marginsToPixels(e){let{width:t,height:i}=this;if(t===0&&i===0)return e;let r=(n,o)=>n.unit==="pixel"?n:new a$r(n.value*o,"pixel");return new a$3(r(e.left,t),r(e.top,i),r(e.right,t),r(e.bottom,i))}get pointOfInterest(){return this._pointOfInterest}set pointOfInterest(e){var t;this._pointOfInterest=e,(t=this.privateContext)==null||t.update();}get logoStyle(){return this._logoStyle}set logoStyle(e){var t;this._logoStyle=e,(t=this.privateContext)==null||t.update();}get logoAnchor(){return this._logoAnchor}set logoAnchor(e){var t;this._logoAnchor=e,(t=this.privateContext)==null||t.update();}get logoOffset(){return this._logoOffset}set logoOffset(e){var t;this._logoOffset=e,(t=this.privateContext)==null||t.update();}get cameraRecoveryText(){return a$1.getInstance().get(L)}get width(){var e,t;return Math.round((t=(e=this.htmlElementState)==null?void 0:e.width)!=null?t:0)}get height(){var e,t;return Math.round((t=(e=this.htmlElementState)==null?void 0:e.height)!=null?t:0)}get canvasDrawer(){return !this._canvasDrawer&&this.canvasElement!=null&&(this._canvasDrawer=new b$1(this.canvasElement),this._canvasDrawer.startObservingCanvasResize()),this._canvasDrawer}get controls(){return this.controlMap.values()}get privateContext(){return this._context}static async forContext(e){let t=new V;return await t.setContext(e),t}showProgressBar(){var e;(e=this.loadingOverlay)==null||e.show();}hideProgressBar(){var e;(e=this.loadingOverlay)==null||e.hide();}setProgressBarPercentage(e){this.loadingOverlay&&(this.loadingOverlay.progress=e);}setProgressBarMessage(e){this.loadingOverlay&&(this.loadingOverlay.message=e);}getContext(){return this._context}async setContext(e){var t,i,r;if(this._context!==e&&(this._context=e,e)){if(this.overlays.size>0&&!((t=this._context)!=null&&t[a$4].hasModes()))throw new Error(["Cannot assign this view to this context. This view has overlays but the context does not have any mode attached matching these overlays.","Remove the overlays first before attaching the view to the context, or add the corresponding mode to the context before attaching this view."].join(" "));await e.setView(this),(i=this.privateContext)==null||i.subscribeToWorkerMessages(this.onWorkerMessageHandler),(r=this._context)!=null&&r.frameSource&&await this.onFrameSourceChange(this._context.frameSource);}}connectToElement(e,t){var i,r,n,o;this.isConnected||(this.orientationObserver.register(),this.setupHtmlElement(e),(i=this.canvasDrawer)==null||i.startObservingCanvasResize(),this.htmlElementDidChange(),a$5.add(this),this.orientation=this.orientationObserver.orientation.value,this.orientationObserver.addEventListener(a$6,this.onOrientationChangeListener),(r=this.hintPresenter)==null||r.addEventListener("hintpresenterupdate",this.onHintPresenterUpdateHandler),(n=this.hintPresenter)==null||n.addEventListener("hintpresenterviewfinderupdaterequested",this.onViewFinderUpdateRequestedHandler),this.localizationSubscription=a$1.getInstance().subscribe(a=>{a[L]!=null&&(this.cameraRecoveryElement.textContent=a[L]);}),this._previewCamera=(o=t==null?void 0:t.camera)!=null?o:null,this._previewCamera&&(this._previewCamera.addListener(this.frameSourceListener),this.onFrameSourceChange(this._previewCamera)),this.updateControls(),this.isConnected=true);}detachFromElement(){var e,t,i,r,n,o,a,l;if(this.isConnected){(e=this.htmlElementState)==null||e.removeListeners(),this.removeStyles(),(t=this.canvasDrawer)==null||t.endObservingCanvasResize(),document.removeEventListener("visibilitychange",this.visibilityListener);for(let h of ["touchend","mousedown"])this.cameraRecoveryElement.removeEventListener(h,this.cameraRecoveryListener);(i=this.loadingOverlay)==null||i.remove(),(r=this.customLocationsView)==null||r.unmount(),this.notificationPresenter=null,this.htmlElementDidChange(),this.removeSwipeToZoomListener(),this.removePinchToZoomListener(),(n=this.gestureRecognizer)==null||n.removeListener(this),this.clearHtmlElementContent(),a$5.delete(this),this.orientationObserver.unregister(),this.orientationObserver.removeEventListener(a$6,this.onOrientationChangeListener),(o=this.hintPresenter)==null||o.removeEventListener("hintpresenterupdate",this.onHintPresenterUpdateHandler),(a=this.hintPresenter)==null||a.removeEventListener("hintpresenterviewfinderupdaterequested",this.onViewFinderUpdateRequestedHandler),(l=this.localizationSubscription)==null||l.cancel(),g.instance().disconnectedCallback(),this._previewCamera&&(this._previewCamera.removeListener(this.frameSourceListener),this._previewCamera=null);for(let h of this.controls)this.removeControl(h);this.isConnected=false;}}async addOverlay(e){var t;this.overlays.has(e)||(this.overlays.add(e),await((t=this.privateContext)==null?void 0:t.update([{type:"addOverlay",newValue:e,view:this}])));}async removeOverlay(e){var t;this.overlays.has(e)&&(await((t=this.privateContext)==null?void 0:t.update([{type:"removeOverlay",newValue:e,view:this}])),this.overlays.delete(e));}addListener(e){this.listeners.includes(e)||this.listeners.push(e);}removeListener(e){this.listeners.includes(e)&&this.listeners.splice(this.listeners.indexOf(e),1);}viewPointForFramePoint(e){var u,D,T,M,F,R,A,N;let t={width:(D=(u=this.htmlElementState)==null?void 0:u.width)!=null?D:0,height:(M=(T=this.htmlElementState)==null?void 0:T.height)!=null?M:0},i={width:(R=(F=this.videoElement)==null?void 0:F.videoWidth)!=null?R:0,height:(N=(A=this.videoElement)==null?void 0:A.videoHeight)!=null?N:0},r=t.width/t.height,n=i.width/i.height,o=r>n?t.width/i.width:t.height/i.height,a={x:e.x*o,y:e.y*o},l=(i.width*o-t.width)/2,h=(i.height*o-t.height)/2;return new a$7(a.x-l,a.y-h)}viewQuadrilateralForFrameQuadrilateral(e){let t=this.viewPointForFramePoint(e.topLeft),i=this.viewPointForFramePoint(e.topRight),r=this.viewPointForFramePoint(e.bottomLeft),n=this.viewPointForFramePoint(e.bottomRight);return new a$8(t,i,n,r)}addControl(e){let t=e.toJSONObject().type;if(!this.controlMap.has(t)&&!(t==="camera-fov"&&this.controlMap.has("zoom"))){if(t==="zoom"){let i=this.controlMap.get("camera-fov");i&&this.removeControl(i);}this.controlMap.set(t,e),e.install(this).then(i=>{var r;i&&((r=this.privateContext)==null||r.update([{type:"addControl",newValue:e}]));});}}removeControl(e){var i;let t=e.toJSONObject().type;this.controlMap.has(t)&&(e.remove(true),this.controlMap.delete(t),(i=this.privateContext)==null||i.update([{type:"removeControl",newValue:e}]));}toJSONObject(){var e;return {scanAreaMargins:this.scanAreaMargins.toJSONObject(),pointOfInterest:this.pointOfInterest.toJSONObject(),logoAnchor:this.logoAnchor,logoOffset:this.logoOffset.toJSONObject(),logoHidden:(e=this.logoHidden)!=null?e:false,logoStyle:this.logoStyle,overlays:[...this.overlays].map(t=>t.toJSONObject()),controls:[...this.controls].map(t=>t.toJSONObject()),focusGesture:this.focusGesture?this.focusGesture.toJSONObject():null,zoomGestures:this._zoomGestures.map(t=>t.toJSONObject())}}isCameraRecoveryVisible(){return !this.cameraRecoveryElement.hidden}setCameraRecoveryVisible(e){this.cameraRecoveryElement.hidden=!e;}async allowPictureInPicture(e){await g.instance().allowPictureInPicture(e);}viewAnchorPositionsForFrameAnchorPositions(e){let t=this.viewPointForFramePoint(e.topLeft),i=this.viewPointForFramePoint(e.topRight),r=this.viewPointForFramePoint(e.bottomLeft),n=this.viewPointForFramePoint(e.bottomRight),o=this.viewPointForFramePoint(e.centerLeft),a=this.viewPointForFramePoint(e.centerRight),l=this.viewPointForFramePoint(e.topCenter),h=this.viewPointForFramePoint(e.bottomCenter),u=this.viewPointForFramePoint(e.center);return new a$9(t,i,n,r,o,l,a,h,u)}setDidTapCustomLocationsViewListener(e){this.customLocationsView&&this.customLocationsView.listener===null&&(this.customLocationsView.listener=e);}renderCustomLocationsView(e){this.customLocationsView!=null&&(this.customLocationsView.setMirrored(g.instance().isMirrorImageEnabled()),Object.keys(e).includes("removedIds")?this.customLocationsView.render(e):this.customLocationsView.renderDomView(e));}getNotificationPresenter(){var e;if(!this.notificationPresenter){let t=(e=this.htmlElement)==null?void 0:e.querySelector(b$2.tag);if(!t)throw new Error("Notification presenter cannot be found. Please ensure the DataCaptureView is connected.");this.notificationPresenter=new a$a(t);}return this.notificationPresenter}removeStyles(){for(let e of document.querySelectorAll("style[scandit]"))e.remove();}onHintPresenterUpdate(e){var t;(t=this.privateContext)==null||t.workerCommand("hintPresenterV2update",{});}async onViewFinderUpdateRequested(e){var i;let t=await((i=this.privateContext)==null?void 0:i.workerCommand("getViewfinderInfo",{}));t!=null&&this.updateHintPresenterViewFinderRect(t.rect);}clearHtmlElementContent(){var e;this.htmlElement&&((e=this.canvasDrawer)==null||e.endObservingCanvasResize(),this.htmlElement.innerHTML="",this.cameraPaintboardElement=void 0,this.singleImageUploaderPaintboardElement=void 0,this.htmlElement=void 0);}setupHtmlElement(e){var n,o,a;this.createStyles(),this.htmlElement=e,b$2.register(),a$b.register(),a$c.register();let t=a$f`<div class="${a$d.CONTAINER_CLASS_NAME}" role="main" aria-label="Data capture view"><div class="${a$d.PAINTBOARDS_CONTAINER_CLASS_NAME}"><div data-js-id="loading-overlay"></div><div class="${a$d.PAINTBOARD_CLASS_NAME}" data-js-id="camera-paintboard"><div data-js-id="video-container"></div><img class="${a$d.FROZEN_FRAME}" data-js-id="frozen-frame" alt="Last captured camera frame shown while camera is on standby" hidden /><canvas></canvas><div data-js-id="${a$e.CUSTOM_VIEW_CONTAINER}"></div><${b$2.tag}></${b$2.tag}><${a$b.tag}></${a$b.tag}><div class="${a$d.CAMERA_RECOVERY_CLASS_NAME}" role="alert" aria-live="polite" aria-atomic="true" hidden>${this.cameraRecoveryText}</div><div class="${a$d.ERROR_CLASS_NAME}" role="alert" aria-live="assertive" aria-atomic="true" hidden></div></div><div class="${a$d.PAINTBOARD_CLASS_NAME}" data-js-id="singleimage-paintboard"></div></div></div>`;this.htmlElement.innerHTML=t,g.instance().connectedCallback(this.htmlElement.querySelector('[data-js-id="video-container"]')),this.isVideoElementDetached=false,this.hintPresenter=this.htmlElement.querySelector(b$2.tag),this.notificationPresenter=this.hintPresenter?new a$a(this.hintPresenter):null,this.loadingOverlay&&this.loadingOverlay.remove(),this.loadingOverlay=a$c.create(),this.loadingOverlay.hide(),(n=this.htmlElement.querySelector('[data-js-id="loading-overlay"]'))==null||n.replaceWith(this.loadingOverlay),this.customLocationsView&&this.customLocationsView.unmount(),this.customLocationsView=new a$g,this.customLocationsView.mount(this.htmlElement.querySelector(`[data-js-id="${a$e.CUSTOM_VIEW_CONTAINER}"]`)),this.customLocationsView.mapViewAnchorPositionsForFramePoint=l=>this.viewAnchorPositionsForFrameAnchorPositions(l),this.containerElement=this.htmlElement.querySelector(`.${a$d.CONTAINER_CLASS_NAME}`),this.cameraPaintboardElement=this.containerElement.querySelector('[data-js-id="camera-paintboard"]'),this.singleImageUploaderPaintboardElement=this.containerElement.querySelector('[data-js-id="singleimage-paintboard"]');let i=this.cameraPaintboardElement.querySelector("canvas");this.canvasElement==null?this.canvasElement=i:i.replaceWith(this.canvasElement);let r=this.cameraPaintboardElement.querySelector('[data-js-id="frozen-frame"]');this.frozenFrame==null?this.frozenFrame=r:r.replaceWith(this.frozenFrame),this.controlsElement=this.cameraPaintboardElement.querySelector(a$b.tag),this.cameraRecoveryElement=this.cameraPaintboardElement.querySelector(`.${a$d.CAMERA_RECOVERY_CLASS_NAME}`),this.errorElement=this.cameraPaintboardElement.querySelector(`.${a$d.ERROR_CLASS_NAME}`),this.lastFrameSourceState!=null&&((a=(o=this._context)==null?void 0:o.frameSource)==null||a.switchToDesiredState(this.lastFrameSourceState)),document.addEventListener("visibilitychange",this.visibilityListener);for(let l of ["touchend","mousedown"])this.cameraRecoveryElement.addEventListener(l,this.cameraRecoveryListener);this.htmlElementState&&this.htmlElementState.removeListeners(),this.htmlElementState=new a$h(this.htmlElement),this.htmlElementState.onStateChanged(this.htmlElementDidChangeHandler),this.htmlElementState.onDisconnected(this.htmlElementDisconnectedHandler),this.gestureRecognizer=new a$i(this.htmlElement),this.gestureRecognizer.addListener(this),this.addSwipeToZoomListener(),this.addPinchToZoomListener();}setupHtmlElementSingleImageUploader(e){var i;if(this.singleImageUploaderPaintboardElement==null)return;this.singleImageUploaderView&&this.singleImageUploaderView.unmount(),this.singleImageUploaderView=new a$j(e),this.singleImageUploaderView.mount(this.containerElement.querySelector('[data-js-id="singleimage-paintboard"]'));let t=(i=this._context)==null?void 0:i.frameSource;this.singleImageUploaderView.onInputCheck(r=>{t.getCurrentState()!=="starting"&&r.preventDefault();}),this.singleImageUploaderView.onBeforeFileRead(()=>{t._context&&this.singleImageUploaderView&&(this.singleImageUploaderView.canUploadFile=t._context.hasEnabledMode());}),this.singleImageUploaderView.onImageLoadError(()=>{t.currentState="starting",a$k.log(a$k.Level.Error,"Could not load image from selected file");}),this.singleImageUploaderView.onFileReaderError(r=>{var o,a;let n=r.target;t.currentState="starting",a$k.log(a$k.Level.Error,`Error while reading the file: ${(a=(o=n.error)==null?void 0:o.toString())!=null?a:""}`);}),this.singleImageUploaderView.onCaptureReady(async r=>{await t.processUploadedFileCapture(r);}),this.singleImageUploaderView.setButtonState(t.getCurrentState()==="starting"?"enabled":"disabled"),t.addView(this.singleImageUploaderView);}setupHtmlElementVisibility(e){this.cameraPaintboardElement!=null&&(this.cameraPaintboardElement.hidden=e!=="camera"),this.singleImageUploaderPaintboardElement!=null&&(this.singleImageUploaderPaintboardElement.hidden=e!=="singleImageUploader");}createStyles(){if(document.querySelector("style[scandit]")===null){let e=a$l();for(let[t,i]of Object.entries(e))i.setAttribute("scandit",`data-capture-sdk-${t}`),document.head.append(i);}}async onOrientationChange(e){var t,i;this.orientation=e.detail.value,await((i=this.privateContext)==null?void 0:i.update([{type:"viewChange",newValue:{...(t=this.htmlElementState)==null?void 0:t.toJSONObject(),orientation:this.orientation}}]));}htmlElementDidChange(){var i,r;if(!this.htmlElementState)return;let e=this.htmlElementState,t=e.toJSONObject();if(!a$h.areEquivalentJSONStates(this.lastHtmlElementState,t)){this.orientation=this.orientationObserver.orientation.value,(i=this.privateContext)==null||i.update([{type:"viewChange",newValue:{...e.toJSONObject(),orientation:this.orientation}}]),this.lastHtmlElementState=t,(r=this.canvasDrawer)==null||r.updateCanvasSizeAttributes(this.width,this.height),this.handleVideoDisplay(t.visible);for(let n of this.listeners)typeof n.didChangeSize=="function"&&n.didChangeSize(this,new a$m(t.size.width.value,t.size.height.value),this.orientation);}}async htmlElementDisconnected(){var e,t,i,r,n,o;g.instance().disconnectedCallback(),this.lastFrameSourceState=(t=(e=this._context)==null?void 0:e.frameSource)==null?void 0:t.getCurrentState(),await((r=(i=this._context)==null?void 0:i.frameSource)==null?void 0:r.switchToDesiredState("off")),await((o=this.privateContext)==null?void 0:o.update([{type:"viewChange",newValue:{...(n=this.htmlElementState)==null?void 0:n.toJSONObject(),orientation:this.orientation}}])),this.isConnected=false;}attachAdditionalLayer(e,t){var i;t==="above-controls"&&((i=this.controlsElement)==null||i.insertAdjacentElement("afterend",e));}handleVideoDisplay(e){this.videoElement==null||this.cameraPaintboardElement==null||(!e&&!this.isVideoElementDetached?(this.videoElement.width=0,this.videoElement.height=0,this.videoElement.style.opacity="0",this.videoElement.style.visibility="hidden",document.body.append(this.videoElement),this.isVideoElementDetached=true):e&&this.isVideoElementDetached&&(this.cameraPaintboardElement.insertAdjacentElement("afterbegin",this.videoElement),this.isVideoElementDetached=false,this.videoElement.style.removeProperty("visibility"),this.videoElement.removeAttribute("width"),this.videoElement.removeAttribute("height"),this.videoElement.style.removeProperty("opacity")));}isCanvasDrawerWithMetrics(e){return e instanceof a$n}onWorkerMessage(e){var t,i;switch(e.type){case "draw":{this.drawEngineCommands(e.payload);break}case "performanceMetricsReport":{let r=this._canvasDrawer;r!=null&&this.isCanvasDrawerWithMetrics(r)&&r.setPerformanceMetrics(e.payload);break}case "contextDidChangeStatus":{let r=a$o.fromJSON(e.payload);(t=this.loadingOverlay)==null||t.hide(),r.isValid?(this.clearError(),this.setVideoElementOpacity("1")):this.displayError(r);break}case "viewSizeChanged":{let r=e.payload;if(r==null)return;this.onSDCViewSizeChangedCallback(r);break}default:{(i=this.hintPresenter)==null||i.handleMessage(e);break}}}onSDCViewSizeChangedCallback(e){this.updateHintPresenterViewFinderRect(e.viewFinderRect);}updateHintPresenterViewFinderRect(e){var t;(t=this.hintPresenter)==null||t.setViewFinderRect(new a$p(new a$7(e.origin.x,e.origin.y),new a$m(e.size.width,e.size.height)));}drawEngineCommands(e){var t;(t=this.canvasDrawer)==null||t.draw(e);}displayError(e){this.errorElement.textContent=`Error ${e.code}: ${e.message}`,this.errorElement.hidden=false;}clearError(){this.errorElement.textContent="",this.errorElement.hidden=true;}updateControls(){var e;for(let t of this.controls)(e=t.update)==null||e.call(t,this);}async onFrameSourceChange(e){let t=e==null?void 0:e.type;if(this.setupHtmlElementVisibility(t),t==="camera"){let i=e==null?void 0:e.getCurrentState();i!=null&&await this.onCameraStateChanged(i);}else t==="singleImageUploader"&&this.setupHtmlElementSingleImageUploader(e.settings);}async onCameraStateChanged(e){var t;switch((t=this.cameraPaintboardElement)==null||t.classList.toggle(a$d.PAINTBOARD_CLASS_NAME_STATE_ON,e==="on"),e){case "stopping":{this.hiddenProperties.freezeFrameWhenStoppingFrameSource&&this.freezeFrame(),this.setVideoElementOpacity("0");return}case "starting":case "bootingUp":case "wakingUp":{if(!this.htmlElement){a$k.error("cannot set frame source stream before connecting view to an HTML element");return}this.videoElement&&(g.instance().gui.isCameraRecoveryVisible=this.isCameraRecoveryVisible.bind(this),g.instance().gui.setCameraRecoveryVisible=this.setCameraRecoveryVisible.bind(this),this.setVideoElementOpacity("0"));return}case "off":{this.setVideoElementOpacity("0"),this.updateControls();return}case "on":{await g.instance().waitForCapabilities(),this.updateControls(),this.unfreezeFrame(),this.setVideoElementOpacity("1");break}case "goingToSleep":{this.freezeFrame();break}}}setVideoElementOpacity(e){this.videoElement&&(this.videoElement.style.opacity=e),this.canvasElement&&(this.canvasElement.style.opacity=e);}onSingleImageUploaderSettingsChange(e){this.setupHtmlElementSingleImageUploader(e);}setHiddenProperty(e,t){this.hiddenProperties[e]=t;}async onVisibilityChange(){var t,i;let e=(t=this.videoElement)==null?void 0:t.srcObject;if(this.hiddenProperties.stopVideoTracksOnVisibilityChange&&(document.visibilityState==="hidden"&&g.instance().stopVideoTracks(),document.visibilityState==="visible"&&g.instance().activeCamera!=null&&e!=null))if(!e.active||(i=e.getVideoTracks()[0])!=null&&i.muted)try{a$k.debug('Detected visibility change ("visible") event with inactive video source, try to reinitialize camera'),await g.instance().reinitializeCamera();}catch{}else a$k.debug('Detected visibility change ("visible") event with active video source, replay video'),g.instance().playVideo();}async cameraRecovery(e){e.preventDefault(),g.instance().activeCamera=g.instance().selectedCamera,await g.instance().reinitializeCamera();}freezeFrame(){var i;if(!this.frozenFrame)return;let e=g.instance().getCurrentFrame();if(!e)return;let t=new ImageData(e.data,e.width,e.height);this.frozenFrameCanvas.width=t.width,this.frozenFrameCanvas.height=t.height,this.frozenFrame.width=t.width,this.frozenFrame.height=t.height,(i=this.frozenFrameCanvas.getContext("2d"))==null||i.putImageData(t,0,0),this.frozenFrame.src=this.frozenFrameCanvas.toDataURL("image/jpeg",.4),this.frozenFrame.classList.toggle(a$d.MIRRORED_CLASS_NAME,g.instance().isMirrorImageEnabled()),this.frozenFrame.hidden=false;}unfreezeFrame(){this.frozenFrame&&(this.frozenFrame.src="",this.frozenFrame.hidden=true);}onTap(e){var t;(t=this.privateContext)==null||t.workerCommand("onTap",{point:e.toJSONObject()});}onSwipeUp(){var e;(e=this.swipeToZoomGesture)==null||e.triggerZoomIn();}onSwipeDown(){var e;(e=this.swipeToZoomGesture)==null||e.triggerZoomOut();}onPinchIn(){var e;(e=this.pinchToZoomGesture)==null||e.triggerZoomIn();}onPinchOut(){var e;(e=this.pinchToZoomGesture)==null||e.triggerZoomOut();}didZoomInGesture(){this.performZoomIn();}didZoomOutGesture(){this.performZoomOut();}addSwipeToZoomListener(){let e=this._zoomGestures.find(t=>t.toJSONObject().type==="swipeToZoom");e&&(this.swipeToZoomGesture=e,e.addListener(this));}removeSwipeToZoomListener(){var e;(e=this.swipeToZoomGesture)==null||e.removeListener(this),this.swipeToZoomGesture=null;}addPinchToZoomListener(){let e=this._zoomGestures.find(t=>t.toJSONObject().type==="pinchToZoom");e&&(this.pinchToZoomGesture=e,e.addListener(this));}removePinchToZoomListener(){var e;(e=this.pinchToZoomGesture)==null||e.removeListener(this),this.pinchToZoomGesture=null;}async performZoomIn(){var n;let e=(n=this._context)==null?void 0:n.frameSource;if(!(e!=null&&e.settings))return;let t=e.settings.zoomFactor,r=[...e.settings.zoomLevels].sort((o,a)=>o-a).find(o=>o>t);r!=null&&(await e.setZoomFactor(r),this.showZoomNotification(r));}async performZoomOut(){var n;let e=(n=this._context)==null?void 0:n.frameSource;if(!(e!=null&&e.settings))return;let t=e.settings.zoomFactor,r=[...[...e.settings.zoomLevels].sort((o,a)=>o-a)].reverse().find(o=>o<t);r!=null&&(await e.setZoomFactor(r),this.showZoomNotification(r));}async showZoomNotification(e$1){var r,n;if(!this.shouldShowZoomNotification)return;let t=e.toJSON(),i={tag:"zoomNotification",text:this.formatZoomFactor(e$1),hintStyle:{textColor:t,backgroundColor:y.neutralWhite.withAlpha(.8).toJSON(),textAlignment:"center",hintIcon:"none",iconColor:t,isAnimatedToView:true,hintAnchor:"top",hintAnchorOffset:16,horizontalMargin:16,maxWidthFraction:1,textSize:14,textWeight:700,lineHeight:24,maxLines:3,cornerRadius:4,fitToText:true}};(r=this.zoomNotificationTimeout)==null||r.stop(),this.zoomNotificationTimeout=new a$q(this.zoomNotificationDuration,()=>{var o;(o=this.hintPresenter)==null||o.hideToast(i);}),await((n=this.hintPresenter)==null?void 0:n.showToast(i)),this.zoomNotificationTimeout.start();}formatZoomFactor(e){let t=Math.ceil(e*100)/100;return parseFloat(t.toPrecision(3))+"x"}},X=V;export{X as a};
@@ -1 +1 @@
1
- import {a as a$4}from'./chunk-4KLHTKGW.js';import {g as g$1}from'./chunk-CA6FHIF6.js';import {d}from'./chunk-YUZDO2PC.js';import {b}from'./chunk-7LTHFX4E.js';import {a as a$1}from'./chunk-LFJUGRQV.js';import {b as b$1}from'./chunk-YONR3EGV.js';import {a as a$3}from'./chunk-XR65N6EG.js';import {g}from'./chunk-D222MT4V.js';import {a}from'./chunk-U2WQ3WDE.js';import {a as a$2}from'./chunk-QCZSSQAQ.js';d.addVideoDevicesListener(O=>{b.integrateIncomingVideoDevices(O.map(e=>h.fromDeviceCamera(e)));});var F;F=a$1;var s=class s{constructor(e){this._label="";this._deviceId="";this._notFoundOnDevice=false;this._isBestGuess=false;this.type="camera";this._currentState="off";this._settings=new g;this._desiredTorchState="off";this._desiredState="off";this.listeners=[];this.zoomListeners=new Set;this._context=null;this[F]={markAsUnmappedToDeviceCameras:this.markAsUnmappedToDeviceCameras.bind(this),resetUnmappedState:this.resetUnmappedState.bind(this),setDeviceId:this.setDeviceId.bind(this),setLabel:this.setLabel.bind(this),markAsBestGuess:this.markAsBestGuess.bind(this)};this._captureAndSendBound=this.captureAndSend.bind(this);this.stateTransitionStrategyMap={off:{on:this.transitionFromStateOffToOn.bind(this),standby:this.transitionFromStateOffToStandby.bind(this)},on:{off:this.transitionFromStateOnToOff.bind(this),standby:this.transitionFromStateOnToStandby.bind(this)},standby:{off:this.transitionFromStateStandbyToOff.bind(this),on:this.transitionFromStateStandbyToOn.bind(this)}};this.cameraManager=e!=null?e:g$1.instance();}static pickBestGuess(){return s.getOrCreate({position:"worldFacing",bestGuess:true})}static pickBestGuessForPosition(e){if(!a.availablePositions.includes(e))throw new Error(`Invalid camera position: "${e}"`);return s.getOrCreate({position:e})}static forDeviceId(e){return s.getOrCreate({deviceId:e})}static async getAll(e,t){return await d.getCameras(e!=null?e:false,t!=null?t:false),[...b.get()]}static getOrCreate(e){let{deviceId:t,position:a,bestGuess:i}=e,n=new s;return n._deviceId=t!=null?t:"",n.position=a!=null?a:"worldFacing",i&&n[a$1].markAsBestGuess(),b.getOrCreate(n)}static fromDeviceCamera(e){let t=new s;return t.position=e.position,t._deviceId=e.deviceId,t._label=e.label,t}get deviceId(){return this._deviceId}get label(){return this._label}get desiredState(){return this._desiredState}get settings(){return this._settings}get currentResolution(){var e;return (e=this._currentResolution)!=null?e:null}setDeviceId(e){this._deviceId=e;}setLabel(e){this._label=e;}get context(){return this._context}set context(e){this._context=e,this._context&&this.currentState==="on"&&this.startSendingCapturesToWorker();}get currentState(){return this._currentState}async switchToDesiredState(e){var t,a;if(this.currentTransitionStrategyPromise&&await this.currentTransitionStrategyPromise,this._notFoundOnDevice&&(e==="on"||e==="standby"))throw new a$2({message:`Cannot switch state to ${e}. This camera could not be mapped to a detected camera on the device. Please use another camera and delete this one.`,name:"Unmapped Camera"});return this.currentTransitionStrategyPromise=(a=(t=this.stateTransitionStrategyMap[this.currentState])==null?void 0:t[e])==null?void 0:a.call(t).catch(i=>{if(i instanceof DOMException&&i.message==="The associated Track is in an invalid state"){a$3.log(a$3.Level.Warn,i);return}throw i}),this.currentTransitionStrategyPromise}getDesiredTorchState(){return this._desiredTorchState}async setDesiredTorchState(e){this._desiredTorchState=e,await this.cameraManager.setTorchEnabled(this._desiredTorchState==="on"),await this.notifyContext({type:"torchState",newValue:this._desiredTorchState});}async isTorchAvailable(){return this.cameraManager.isTorchAvailable()}addListener(e){e!=null&&(this.listeners.includes(e)||this.listeners.push(e));}removeListener(e){e!=null&&this.listeners.includes(e)&&this.listeners.splice(this.listeners.indexOf(e),1);}addZoomListener(e){this.zoomListeners.add(e);}removeZoomListener(e){this.zoomListeners.delete(e);}isZoomAvailable(){var e;return ((e=this.cameraManager.mediaTrackCapabilities)==null?void 0:e.zoom)!=null}async getZoomRange(){var t,a,i;await this.cameraManager.waitForCapabilities();let e=(t=this.cameraManager.mediaTrackCapabilities)==null?void 0:t.zoom;return e?{min:(a=e.min)!=null?a:null,max:(i=e.max)!=null?i:null}:null}async setZoomFactor(e){let t=this._settings.zoomFactor;this._settings.zoomFactor=e,t!==e&&((this._currentState==="on"||this._currentState==="standby")&&await this.cameraManager.setZoom(e),this.notifyZoomListeners(t,e)),await this.notifyContext({type:"cameraSettings",newValue:this._settings});}async applySettings(e){var n;let t=this._settings.zoomFactor,a=this._settings.zoomLevels;this._settings=new g(e);let i=this.settings.getProperty("grayScaleFrameReader");if(this.cameraManager.setFrameReaderType(i===true?"GRAYSCALE":"RGBA"),this.currentState==="on"||this.currentState==="standby"){let c=this.cameraManager.activeCameraSettings;(c==null?void 0:c.preferredResolution)!==this.settings.preferredResolution&&(await this.cameraManager.applyCameraSettings(this.settings),(n=this.cameraManager.activeCamera)!=null&&n.currentResolution&&(this._currentResolution={width:this.cameraManager.activeCamera.currentResolution.width,height:this.cameraManager.activeCamera.currentResolution.height})),await this.cameraManager.setZoom(this.settings.zoomFactor),t!==this.settings.zoomFactor&&this.notifyZoomListeners(t,this.settings.zoomFactor);let l=this.settings.getProperty("minFrameRate"),p=this.settings.getProperty("maxFrameRate");(l!=null||p!=null)&&await this.cameraManager.setFrameRate({min:l,max:p});let S=this.settings.getProperty("manualLensPosition");S!=null&&await this.cameraManager.setFocus(S);let g=this.settings.getProperty("exposureTargetBias"),f=this.settings.getProperty("exposureDuration");(g!=null||f!=null)&&await this.cameraManager.setExposure({compensation:g,time:f});}return this.notifyListenersOfZoomLevelChange(a,this.settings.zoomLevels),this.notifyContext({type:"cameraSettings",newValue:this.settings})}toJSONObject(){return {type:this.type,position:this.position,settings:this.settings.toJSONObject(),desiredState:this.desiredState,desiredTorchState:this._desiredTorchState}}getMirrorImageEnabled(){var e;return (e=this._desiredMirrorImageEnabled)!=null?e:this.cameraManager.isMirrorImageEnabled()}async setMirrorImageEnabled(e){this._desiredMirrorImageEnabled=e,this.cameraManager.setMirrorImageEnabled(e,true),this.context&&await this.context.setFrameSource(this);}getCurrentState(){return this._currentState}async setClipArea(e){await this.cameraManager.setClipArea(e);}async setCurrentState(e){if(e!==this._currentState){this._currentState=e,this.notifyListeners();try{await this.notifyContext({type:"frameSourceState",newValue:e}),e==="on"&&this.startSendingCapturesToWorker();}catch{a$3.warn("Error while notifying context about new state of Camera");}}}async setupCamera(){if(this.cameraManager.setSelectedCameraSettings(this.settings),this.deviceId==="")this.cameraManager.setSelectedCamera(),this.cameraManager.setInitialCameraPosition(this.position);else {let t=(await d.getCameras()).find(a=>a.deviceId===this.deviceId);t&&(this.cameraManager.setInitialCameraPosition(t.position),this.cameraManager.setSelectedCamera(t));}await this.cameraManager.setupCameras(),typeof this._desiredMirrorImageEnabled=="boolean"?this.cameraManager.setMirrorImageEnabled(this._desiredMirrorImageEnabled,true):this.cameraManager.setMirrorImageEnabled(this.cameraManager.isMirrorImageEnabled(),false),this.context&&await this.context.setFrameSource(this),this.cameraManager.activeCamera&&(b.rebindToDeviceId(this,{deviceId:this.cameraManager.activeCamera.deviceId,label:this.cameraManager.activeCamera.label,position:this.cameraManager.activeCamera.position}),this._currentResolution=this.cameraManager.activeCamera.currentResolution);}markAsUnmappedToDeviceCameras(){this._notFoundOnDevice=true;}resetUnmappedState(){this._notFoundOnDevice=false;}markAsBestGuess(){this._isBestGuess=true;}async notifyContext(e){if(this.context)return this.context.update([e])}notifyListeners(){for(let e of this.listeners)e.didChangeState&&e.didChangeState(this,this.currentState);}updateCanvasVideoImage(){this.currentState==="on"&&this.context&&(this.cameraManager.updateCanvasVideoImage(),this._lastCanvasVideoPreviewAnimationFrame=this.cameraManager.requestVideoFrame(this.updateCanvasVideoImage.bind(this)));}async captureAndSend(){if(this.currentState!=="on"||!this.context)return;if(!this.context.hasEnabledMode()){this._lastCaptureRequestAnimationFrame=this.cameraManager.requestVideoFrame(this._captureAndSendBound);return}let e=null;try{e=this.cameraManager.captureImage();}catch(t){a$3.warn("Camera: error while capturing image.",t);}finally{if(e!=null)if(this.cameraManager.synchronousFrameHandling){let t=await this.context.sendFrameToProcessor(e);this.cameraManager.recycle(t.data);}else this.context.sendFrameToProcessor(e).then(t=>(this.cameraManager.recycle(t.data),null)).catch(t=>{a$3.warn("error while recycling uint8array",t);});this._lastCaptureRequestAnimationFrame=this.cameraManager.requestVideoFrame(this._captureAndSendBound);}}startSendingCapturesToWorker(){this.stopSendingCapturesToWorker(),this.captureAndSend();}stopSendingCapturesToWorker(){this._lastCanvasVideoPreviewAnimationFrame!=null&&this.cameraManager.cancelVideoFrame(this._lastCanvasVideoPreviewAnimationFrame),this._lastCaptureRequestAnimationFrame!=null&&this.cameraManager.cancelVideoFrame(this._lastCaptureRequestAnimationFrame);}async transitionFromStateOffToOn(){if(!(this.currentState==="on"||this.currentState==="starting"||this.currentState==="wakingUp")){this._desiredState="on",await this.setCurrentState("starting");try{await this.setupCamera(),await this.setCurrentState("on");}catch(e){throw a$3.log(a$3.Level.Error,e),await this.setCurrentState("off"),e}}}async transitionFromStateOffToStandby(){if(!(this.currentState==="standby"||this.currentState==="bootingUp"||this.currentState==="goingToSleep")){if(await this.isAndroidWebView()){a$3.log(a$3.Level.Warn,'Warning: "Standby" state does not work inside web views. Falling back to state "On".'),await this.transitionFromStateOffToOn();return}this._desiredState="standby",await this.setCurrentState("bootingUp");try{await this.setupCamera(),this.cameraManager.pauseStream(),await this.setCurrentState("standby");}catch(e){throw a$3.log(a$3.Level.Error,e),await this.setCurrentState("off"),e}await this.setCurrentState("standby"),await this.setDesiredTorchState("off");}}async transitionFromStateOnToOff(){this.currentState==="off"||this.currentState==="stopping"||(this._desiredState="off",await this.setCurrentState("stopping"),await this.cameraManager.stopStream(),await this.setCurrentState("off"),await this.setDesiredTorchState("off"));}async transitionFromStateOnToStandby(){if(!(this.currentState==="standby"||this.currentState==="bootingUp"||this.currentState==="goingToSleep")){if(await this.isAndroidWebView()){a$3.log(a$3.Level.Warn,'Warning: "Standby" state does not work inside web views. Falling back to state "Off".'),await this.transitionFromStateOnToOff();return}this._desiredState="standby",await this.setCurrentState("goingToSleep"),this.cameraManager.pauseStream(),await this.setCurrentState("standby"),await this.setDesiredTorchState("off");}}async transitionFromStateStandbyToOff(){this.currentState==="off"||this.currentState==="stopping"||(this._desiredState="off",await this.setCurrentState("shuttingDown"),await this.cameraManager.stopStream(),await this.setCurrentState("off"),await this.setDesiredTorchState("off"));}async transitionFromStateStandbyToOn(){this.currentState==="on"||this.currentState==="starting"||this.currentState==="wakingUp"||(this._desiredState="on",await this.setCurrentState("wakingUp"),this.cameraManager.resumeStream(),await this.setCurrentState("on"));}async isAndroidWebView(){return this._isAndroidWebView==null&&(this._isAndroidWebView=await b$1.isAndroidWebView()),this._isAndroidWebView}notifyZoomListeners(e,t){for(let a of this.zoomListeners)a.onZoomLevelChanged(this,e,t);}notifyListenersOfZoomLevelChange(e,t){var a;if(!a$4(e,t))for(let i of this.zoomListeners)(a=i.onZoomLevelsChanged)==null||a.call(i,this,t);}},h=s;export{h as a};
1
+ import {a as a$4}from'./chunk-4KLHTKGW.js';import {g as g$1}from'./chunk-CZI3JAVS.js';import {b}from'./chunk-7LTHFX4E.js';import {a as a$1}from'./chunk-LFJUGRQV.js';import {d}from'./chunk-YUZDO2PC.js';import {b as b$1}from'./chunk-YONR3EGV.js';import {a as a$3}from'./chunk-XR65N6EG.js';import {g}from'./chunk-D222MT4V.js';import {a}from'./chunk-U2WQ3WDE.js';import {a as a$2}from'./chunk-QCZSSQAQ.js';d.addVideoDevicesListener(O=>{b.integrateIncomingVideoDevices(O.map(e=>h.fromDeviceCamera(e)));});var F;F=a$1;var s=class s{constructor(e){this._label="";this._deviceId="";this._notFoundOnDevice=false;this._isBestGuess=false;this.type="camera";this._currentState="off";this._settings=new g;this._desiredTorchState="off";this._desiredState="off";this.listeners=[];this.zoomListeners=new Set;this._context=null;this[F]={markAsUnmappedToDeviceCameras:this.markAsUnmappedToDeviceCameras.bind(this),resetUnmappedState:this.resetUnmappedState.bind(this),setDeviceId:this.setDeviceId.bind(this),setLabel:this.setLabel.bind(this),markAsBestGuess:this.markAsBestGuess.bind(this)};this._captureAndSendBound=this.captureAndSend.bind(this);this.stateTransitionStrategyMap={off:{on:this.transitionFromStateOffToOn.bind(this),standby:this.transitionFromStateOffToStandby.bind(this)},on:{off:this.transitionFromStateOnToOff.bind(this),standby:this.transitionFromStateOnToStandby.bind(this)},standby:{off:this.transitionFromStateStandbyToOff.bind(this),on:this.transitionFromStateStandbyToOn.bind(this)}};this.cameraManager=e!=null?e:g$1.instance();}static pickBestGuess(){return s.getOrCreate({position:"worldFacing",bestGuess:true})}static pickBestGuessForPosition(e){if(!a.availablePositions.includes(e))throw new Error(`Invalid camera position: "${e}"`);return s.getOrCreate({position:e})}static forDeviceId(e){return s.getOrCreate({deviceId:e})}static async getAll(e,t){return await d.getCameras(e!=null?e:false,t!=null?t:false),[...b.get()]}static getOrCreate(e){let{deviceId:t,position:a,bestGuess:i}=e,n=new s;return n._deviceId=t!=null?t:"",n.position=a!=null?a:"worldFacing",i&&n[a$1].markAsBestGuess(),b.getOrCreate(n)}static fromDeviceCamera(e){let t=new s;return t.position=e.position,t._deviceId=e.deviceId,t._label=e.label,t}get deviceId(){return this._deviceId}get label(){return this._label}get desiredState(){return this._desiredState}get settings(){return this._settings}get currentResolution(){var e;return (e=this._currentResolution)!=null?e:null}setDeviceId(e){this._deviceId=e;}setLabel(e){this._label=e;}get context(){return this._context}set context(e){this._context=e,this._context&&this.currentState==="on"&&this.startSendingCapturesToWorker();}get currentState(){return this._currentState}async switchToDesiredState(e){var t,a;if(this.currentTransitionStrategyPromise&&await this.currentTransitionStrategyPromise,this._notFoundOnDevice&&(e==="on"||e==="standby"))throw new a$2({message:`Cannot switch state to ${e}. This camera could not be mapped to a detected camera on the device. Please use another camera and delete this one.`,name:"Unmapped Camera"});return this.currentTransitionStrategyPromise=(a=(t=this.stateTransitionStrategyMap[this.currentState])==null?void 0:t[e])==null?void 0:a.call(t).catch(i=>{if(i instanceof DOMException&&i.message==="The associated Track is in an invalid state"){a$3.log(a$3.Level.Warn,i);return}throw i}),this.currentTransitionStrategyPromise}getDesiredTorchState(){return this._desiredTorchState}async setDesiredTorchState(e){this._desiredTorchState=e,await this.cameraManager.setTorchEnabled(this._desiredTorchState==="on"),await this.notifyContext({type:"torchState",newValue:this._desiredTorchState});}async isTorchAvailable(){return this.cameraManager.isTorchAvailable()}addListener(e){e!=null&&(this.listeners.includes(e)||this.listeners.push(e));}removeListener(e){e!=null&&this.listeners.includes(e)&&this.listeners.splice(this.listeners.indexOf(e),1);}addZoomListener(e){this.zoomListeners.add(e);}removeZoomListener(e){this.zoomListeners.delete(e);}isZoomAvailable(){var e;return ((e=this.cameraManager.mediaTrackCapabilities)==null?void 0:e.zoom)!=null}async getZoomRange(){var t,a,i;await this.cameraManager.waitForCapabilities();let e=(t=this.cameraManager.mediaTrackCapabilities)==null?void 0:t.zoom;return e?{min:(a=e.min)!=null?a:null,max:(i=e.max)!=null?i:null}:null}async setZoomFactor(e){let t=this._settings.zoomFactor;this._settings.zoomFactor=e,t!==e&&((this._currentState==="on"||this._currentState==="standby")&&await this.cameraManager.setZoom(e),this.notifyZoomListeners(t,e)),await this.notifyContext({type:"cameraSettings",newValue:this._settings});}async applySettings(e){var n;let t=this._settings.zoomFactor,a=this._settings.zoomLevels;this._settings=new g(e);let i=this.settings.getProperty("grayScaleFrameReader");if(this.cameraManager.setFrameReaderType(i===true?"GRAYSCALE":"RGBA"),this.currentState==="on"||this.currentState==="standby"){let c=this.cameraManager.activeCameraSettings;(c==null?void 0:c.preferredResolution)!==this.settings.preferredResolution&&(await this.cameraManager.applyCameraSettings(this.settings),(n=this.cameraManager.activeCamera)!=null&&n.currentResolution&&(this._currentResolution={width:this.cameraManager.activeCamera.currentResolution.width,height:this.cameraManager.activeCamera.currentResolution.height})),await this.cameraManager.setZoom(this.settings.zoomFactor),t!==this.settings.zoomFactor&&this.notifyZoomListeners(t,this.settings.zoomFactor);let l=this.settings.getProperty("minFrameRate"),p=this.settings.getProperty("maxFrameRate");(l!=null||p!=null)&&await this.cameraManager.setFrameRate({min:l,max:p});let S=this.settings.getProperty("manualLensPosition");S!=null&&await this.cameraManager.setFocus(S);let g=this.settings.getProperty("exposureTargetBias"),f=this.settings.getProperty("exposureDuration");(g!=null||f!=null)&&await this.cameraManager.setExposure({compensation:g,time:f});}return this.notifyListenersOfZoomLevelChange(a,this.settings.zoomLevels),this.notifyContext({type:"cameraSettings",newValue:this.settings})}toJSONObject(){return {type:this.type,position:this.position,settings:this.settings.toJSONObject(),desiredState:this.desiredState,desiredTorchState:this._desiredTorchState}}getMirrorImageEnabled(){var e;return (e=this._desiredMirrorImageEnabled)!=null?e:this.cameraManager.isMirrorImageEnabled()}async setMirrorImageEnabled(e){this._desiredMirrorImageEnabled=e,this.cameraManager.setMirrorImageEnabled(e,true),this.context&&await this.context.setFrameSource(this);}getCurrentState(){return this._currentState}async setClipArea(e){await this.cameraManager.setClipArea(e);}async setCurrentState(e){if(e!==this._currentState){this._currentState=e,this.notifyListeners();try{await this.notifyContext({type:"frameSourceState",newValue:e}),e==="on"&&this.startSendingCapturesToWorker();}catch{a$3.warn("Error while notifying context about new state of Camera");}}}async setupCamera(){if(this.cameraManager.setSelectedCameraSettings(this.settings),this.deviceId==="")this.cameraManager.setSelectedCamera(),this.cameraManager.setInitialCameraPosition(this.position);else {let t=(await d.getCameras()).find(a=>a.deviceId===this.deviceId);t&&(this.cameraManager.setInitialCameraPosition(t.position),this.cameraManager.setSelectedCamera(t));}await this.cameraManager.setupCameras(),typeof this._desiredMirrorImageEnabled=="boolean"?this.cameraManager.setMirrorImageEnabled(this._desiredMirrorImageEnabled,true):this.cameraManager.setMirrorImageEnabled(this.cameraManager.isMirrorImageEnabled(),false),this.context&&await this.context.setFrameSource(this),this.cameraManager.activeCamera&&(b.rebindToDeviceId(this,{deviceId:this.cameraManager.activeCamera.deviceId,label:this.cameraManager.activeCamera.label,position:this.cameraManager.activeCamera.position}),this._currentResolution=this.cameraManager.activeCamera.currentResolution);}markAsUnmappedToDeviceCameras(){this._notFoundOnDevice=true;}resetUnmappedState(){this._notFoundOnDevice=false;}markAsBestGuess(){this._isBestGuess=true;}async notifyContext(e){if(this.context)return this.context.update([e])}notifyListeners(){for(let e of this.listeners)e.didChangeState&&e.didChangeState(this,this.currentState);}updateCanvasVideoImage(){this.currentState==="on"&&this.context&&(this.cameraManager.updateCanvasVideoImage(),this._lastCanvasVideoPreviewAnimationFrame=this.cameraManager.requestVideoFrame(this.updateCanvasVideoImage.bind(this)));}async captureAndSend(){if(this.currentState!=="on"||!this.context)return;if(!this.context.hasEnabledMode()){this._lastCaptureRequestAnimationFrame=this.cameraManager.requestVideoFrame(this._captureAndSendBound);return}let e=null;try{e=this.cameraManager.captureImage();}catch(t){a$3.warn("Camera: error while capturing image.",t);}finally{if(e!=null)if(this.cameraManager.synchronousFrameHandling){let t=await this.context.sendFrameToProcessor(e);this.cameraManager.recycle(t.data);}else this.context.sendFrameToProcessor(e).then(t=>(this.cameraManager.recycle(t.data),null)).catch(t=>{a$3.warn("error while recycling uint8array",t);});this._lastCaptureRequestAnimationFrame=this.cameraManager.requestVideoFrame(this._captureAndSendBound);}}startSendingCapturesToWorker(){this.stopSendingCapturesToWorker(),this.captureAndSend();}stopSendingCapturesToWorker(){this._lastCanvasVideoPreviewAnimationFrame!=null&&this.cameraManager.cancelVideoFrame(this._lastCanvasVideoPreviewAnimationFrame),this._lastCaptureRequestAnimationFrame!=null&&this.cameraManager.cancelVideoFrame(this._lastCaptureRequestAnimationFrame);}async transitionFromStateOffToOn(){if(!(this.currentState==="on"||this.currentState==="starting"||this.currentState==="wakingUp")){this._desiredState="on",await this.setCurrentState("starting");try{await this.setupCamera(),await this.setCurrentState("on");}catch(e){throw a$3.log(a$3.Level.Error,e),await this.setCurrentState("off"),e}}}async transitionFromStateOffToStandby(){if(!(this.currentState==="standby"||this.currentState==="bootingUp"||this.currentState==="goingToSleep")){if(await this.isAndroidWebView()){a$3.log(a$3.Level.Warn,'Warning: "Standby" state does not work inside web views. Falling back to state "On".'),await this.transitionFromStateOffToOn();return}this._desiredState="standby",await this.setCurrentState("bootingUp");try{await this.setupCamera(),this.cameraManager.pauseStream(),await this.setCurrentState("standby");}catch(e){throw a$3.log(a$3.Level.Error,e),await this.setCurrentState("off"),e}await this.setCurrentState("standby"),await this.setDesiredTorchState("off");}}async transitionFromStateOnToOff(){this.currentState==="off"||this.currentState==="stopping"||(this._desiredState="off",await this.setCurrentState("stopping"),await this.cameraManager.stopStream(),await this.setCurrentState("off"),await this.setDesiredTorchState("off"));}async transitionFromStateOnToStandby(){if(!(this.currentState==="standby"||this.currentState==="bootingUp"||this.currentState==="goingToSleep")){if(await this.isAndroidWebView()){a$3.log(a$3.Level.Warn,'Warning: "Standby" state does not work inside web views. Falling back to state "Off".'),await this.transitionFromStateOnToOff();return}this._desiredState="standby",await this.setCurrentState("goingToSleep"),this.cameraManager.pauseStream(),await this.setCurrentState("standby"),await this.setDesiredTorchState("off");}}async transitionFromStateStandbyToOff(){this.currentState==="off"||this.currentState==="stopping"||(this._desiredState="off",await this.setCurrentState("shuttingDown"),await this.cameraManager.stopStream(),await this.setCurrentState("off"),await this.setDesiredTorchState("off"));}async transitionFromStateStandbyToOn(){this.currentState==="on"||this.currentState==="starting"||this.currentState==="wakingUp"||(this._desiredState="on",await this.setCurrentState("wakingUp"),this.cameraManager.resumeStream(),await this.setCurrentState("on"));}async isAndroidWebView(){return this._isAndroidWebView==null&&(this._isAndroidWebView=await b$1.isAndroidWebView()),this._isAndroidWebView}notifyZoomListeners(e,t){for(let a of this.zoomListeners)a.onZoomLevelChanged(this,e,t);}notifyListenersOfZoomLevelChange(e,t){var a;if(!a$4(e,t))for(let i of this.zoomListeners)(a=i.onZoomLevelsChanged)==null||a.call(i,this,t);}},h=s;export{h as a};
@@ -1 +1 @@
1
- import {a}from'./chunk-GMOTHEWV.js';import {d}from'./chunk-YUZDO2PC.js';import {f,g}from'./chunk-D222MT4V.js';var u=class{constructor(){this.type="camera";this.customImages={idle:"",pressed:""};this.cameraSwitchButton=void 0;this.CameraSwitchButtonClass=void 0;this.currentFrameSource=null;this.view=void 0;this.onCameraSwitched=this.handleCameraSwitched.bind(this);this.isTransitioning=false;}get idleImage(){return this.customImages.idle}set idleImage(t){this.customImages.idle=t,this.applyCustomImagesToButton();}get pressedImage(){return this.customImages.pressed}set pressedImage(t){this.customImages.pressed=t,this.applyCustomImagesToButton();}toJSONObject(){return {type:this.type}}async install(t){var i,r,s;this.CameraSwitchButtonClass||(this.CameraSwitchButtonClass=await import('../private/ui/molecules/CameraSwitchButton.js').then(l=>l.CameraSwitchButton),(i=this.CameraSwitchButtonClass)==null||i.register()),this.view=t,this.currentFrameSource=(s=(r=t.getContext())==null?void 0:r.frameSource)!=null?s:null,this.cameraSwitchButton=this.CameraSwitchButtonClass.create(),this.cameraSwitchButton.slot="topRight",this.cameraSwitchButton.hidden=true,this.cameraSwitchButton.addEventListener("camera-switched",this.onCameraSwitched);let e=t.controlsElement;e&&e.append(this.cameraSwitchButton),this.applyCustomImagesToButton();let a=await this.canShow();return this.updateButtonVisibility(a),true}remove(t){t&&this.cameraSwitchButton&&(this.cameraSwitchButton.removeEventListener("camera-switched",this.onCameraSwitched),this.cameraSwitchButton.remove(),this.cameraSwitchButton=null,this.currentFrameSource=null,this.view=void 0);}async update(t){var a,i;this.currentFrameSource=(i=(a=t.getContext())==null?void 0:a.frameSource)!=null?i:null,this.view=t;let e=await this.canShow();this.updateButtonVisibility(e);}updateButtonVisibility(t){this.cameraSwitchButton&&(this.cameraSwitchButton.hidden=!t);}applyCustomImagesToButton(){if(!this.cameraSwitchButton)return;this.customImages.idle||this.customImages.pressed?this.cameraSwitchButton.setCustomImages(this.customImages):this.cameraSwitchButton.useCustomImages=false;}async canShow(){if(!f(this.currentFrameSource)||this.currentFrameSource.getCurrentState()!=="on")return false;try{return (await d.getCameras(false,true)).length>1}catch{return false}}handleCameraSwitched(t){let{currentMode:e}=t.detail,a=e==="back"?"front":"back";this.cameraSwitchButton.mode=a,this.handleCameraSwitch();}async handleCameraSwitch(){if(this.isTransitioning)return;let t=await this.getNextDeviceCamera();t&&await this.switchCameras(t);}async getNextDeviceCamera(){var r;let t=await a.getAll(false,true),e=this.currentFrameSource?this.currentFrameSource:null,a$1=e==null?void 0:e.deviceId,i=t.findIndex(s=>s.deviceId===a$1);return i>-1?(r=t[i+1])!=null?r:t[0]:t.length>0?t[0]:null}async switchCameras(t){var s;this.isTransitioning=true;let e=(s=this.view)==null?void 0:s.getContext(),a=e==null?void 0:e.frameSource,i,r;a!=null&&(i=new g(a.settings),r=a.desiredState),await(a==null?void 0:a.switchToDesiredState("off")),i!=null&&await t.applySettings(i),await(e==null?void 0:e.setFrameSource(t)),await(e==null?void 0:e.frameSource).switchToDesiredState(r!=null?r:"on"),this.isTransitioning=false;}};export{u as a};
1
+ import {a}from'./chunk-GHR3BSUQ.js';import {d}from'./chunk-YUZDO2PC.js';import {f,g}from'./chunk-D222MT4V.js';var u=class{constructor(){this.type="camera";this.customImages={idle:"",pressed:""};this.cameraSwitchButton=void 0;this.CameraSwitchButtonClass=void 0;this.currentFrameSource=null;this.view=void 0;this.onCameraSwitched=this.handleCameraSwitched.bind(this);this.isTransitioning=false;}get idleImage(){return this.customImages.idle}set idleImage(t){this.customImages.idle=t,this.applyCustomImagesToButton();}get pressedImage(){return this.customImages.pressed}set pressedImage(t){this.customImages.pressed=t,this.applyCustomImagesToButton();}toJSONObject(){return {type:this.type}}async install(t){var i,r,s;this.CameraSwitchButtonClass||(this.CameraSwitchButtonClass=await import('../private/ui/molecules/CameraSwitchButton.js').then(l=>l.CameraSwitchButton),(i=this.CameraSwitchButtonClass)==null||i.register()),this.view=t,this.currentFrameSource=(s=(r=t.getContext())==null?void 0:r.frameSource)!=null?s:null,this.cameraSwitchButton=this.CameraSwitchButtonClass.create(),this.cameraSwitchButton.slot="topRight",this.cameraSwitchButton.hidden=true,this.cameraSwitchButton.addEventListener("camera-switched",this.onCameraSwitched);let e=t.controlsElement;e&&e.append(this.cameraSwitchButton),this.applyCustomImagesToButton();let a=await this.canShow();return this.updateButtonVisibility(a),true}remove(t){t&&this.cameraSwitchButton&&(this.cameraSwitchButton.removeEventListener("camera-switched",this.onCameraSwitched),this.cameraSwitchButton.remove(),this.cameraSwitchButton=null,this.currentFrameSource=null,this.view=void 0);}async update(t){var a,i;this.currentFrameSource=(i=(a=t.getContext())==null?void 0:a.frameSource)!=null?i:null,this.view=t;let e=await this.canShow();this.updateButtonVisibility(e);}updateButtonVisibility(t){this.cameraSwitchButton&&(this.cameraSwitchButton.hidden=!t);}applyCustomImagesToButton(){if(!this.cameraSwitchButton)return;this.customImages.idle||this.customImages.pressed?this.cameraSwitchButton.setCustomImages(this.customImages):this.cameraSwitchButton.useCustomImages=false;}async canShow(){if(!f(this.currentFrameSource)||this.currentFrameSource.getCurrentState()!=="on")return false;try{return (await d.getCameras(false,true)).length>1}catch{return false}}handleCameraSwitched(t){let{currentMode:e}=t.detail,a=e==="back"?"front":"back";this.cameraSwitchButton.mode=a,this.handleCameraSwitch();}async handleCameraSwitch(){if(this.isTransitioning)return;let t=await this.getNextDeviceCamera();t&&await this.switchCameras(t);}async getNextDeviceCamera(){var r;let t=await a.getAll(false,true),e=this.currentFrameSource?this.currentFrameSource:null,a$1=e==null?void 0:e.deviceId,i=t.findIndex(s=>s.deviceId===a$1);return i>-1?(r=t[i+1])!=null?r:t[0]:t.length>0?t[0]:null}async switchCameras(t){var s;this.isTransitioning=true;let e=(s=this.view)==null?void 0:s.getContext(),a=e==null?void 0:e.frameSource,i,r;a!=null&&(i=new g(a.settings),r=a.desiredState),await(a==null?void 0:a.switchToDesiredState("off")),i!=null&&await t.applySettings(i),await(e==null?void 0:e.setFrameSource(t)),await(e==null?void 0:e.frameSource).switchToDesiredState(r!=null?r:"on"),this.isTransitioning=false;}};export{u as a};
@@ -0,0 +1 @@
1
+ var e;(o=>{function i(){let r="8.4.0";return r}o.sdkVersion=i;})(e||(e={}));export{e as a};
@@ -1,4 +1,4 @@
1
- import {a as a$7}from'./chunk-Y7BTRVB4.js';import {a as a$4}from'./chunk-ACFJP5SR.js';import {a as a$a,c as c$3,b as b$3}from'./chunk-L66S4DN2.js';import {a as a$j}from'./chunk-BA3RP6L2.js';import {a as a$8}from'./chunk-AIC4H5KG.js';import {a as a$h}from'./chunk-KSCFPJAW.js';import {a as a$f}from'./chunk-W3X3ZRQZ.js';import {a as a$d}from'./chunk-JS3T7K2Z.js';import {b as b$2}from'./chunk-6H6FKGVE.js';import {a as a$c}from'./chunk-N5YZEC56.js';import {a as a$6}from'./chunk-VJB527QZ.js';import {a as a$5}from'./chunk-GHTCNOQN.js';import {a as a$1}from'./chunk-LXOZUOZU.js';import {a as a$g}from'./chunk-FGO2SSRS.js';import {c as c$1,a as a$e}from'./chunk-4LGQ66HW.js';import {g,e as e$1}from'./chunk-CA6FHIF6.js';import {a as a$9}from'./chunk-GPJEB376.js';import {a as a$k}from'./chunk-LFJUGRQV.js';import {b as b$1}from'./chunk-YONR3EGV.js';import {c as c$2,e}from'./chunk-SBC5K7IT.js';import {a as a$3}from'./chunk-XR65N6EG.js';import {f as f$1}from'./chunk-D222MT4V.js';import {a as a$i}from'./chunk-WUHKODFA.js';import {a as a$2}from'./chunk-7SW2PEHB.js';import {a as a$b}from'./chunk-QCZSSQAQ.js';import {c}from'./chunk-TR3NGINC.js';var Z=[{from:"unconfigured",to:"configuring"},{from:"configuring",to:"configured"},{from:"configuring",to:"unconfigured"},{from:"configured",to:"creating-context"},{from:"creating-context",to:"ready"},{from:"creating-context",to:"unconfigured"},{from:"ready",to:"unconfigured"},{from:"configured",to:"unconfigured"}];function v(C,e,t){let r=t.value;return t.value=function(...n){let i=f.stateMachine;return i.currentState==="ready"&&f.mainDataCaptureLoader!=null?r.apply(this,n):i.isInitializing||i.currentState==="configured"?i.waitForState("ready").then(()=>r.apply(this,n)):Promise.reject(new Error(`Please call DataCaptureContext.forLicenseKey() before calling ${String(e)}`))},t}function q(C){return C[a$j]!=null}function x(C){return "skipSerialization"in C||C[a$j]!=null}var _,Y,Q,X;X=a$k;var a=class a{constructor(){this._asyncImageConverterInstance=void 0;this.framework="web";this.runtimeEnvironment={deviceOS:(_=b$1.getUserAgentInfo().getOS().name)!=null?_:"",browser:(Y=b$1.getUserAgentInfo().getBrowser().name)!=null?Y:"",browserVersion:(Q=b$1.getUserAgentInfo().getBrowser().version)!=null?Q:"",get deviceModelName(){let{model:e,vendor:t}=b$1.getUserAgentInfo().getDevice();return (t==null||t==="")&&(t="Unknown"),(e==null||e==="")&&(e="Unknown"),[t,e].join(" ")}};this.settings=new a$2;this._frameSource=null;this._view=null;this.modes=new Set;this.components=[];this.listeners=[];this.updateListeners=new Set;this.cameraPropertiesReportListener=this.reportCameraProperties.bind(this);this.cameraAccessErrorListener=this.onCameraAccessError.bind(this);this.onWorkerMessageListener=this.onWorkerMessage.bind(this);this.onVisibilityChangeListener=this.onVisibilityChange.bind(this);this.batteryChangeListener=this.onBatteryChange.bind(this);this.pendingWorkerMessageListeners=new Set;this.delayedRegistration=false;this.highEndBlurryRecognition=false;this._frameHandlers=[];this._useSynchronousFrameFlow=false;this[X]={hasModes:this.hasModes.bind(this)};}static get moduleLicenseTextProviders(){return [new b]}static get sharedInstance(){return a._sharedInstance==null&&(a._sharedInstance=new a),a._sharedInstance}static get currentState(){return a.stateMachine.currentState}static get isReady(){return a.stateMachine.currentState==="ready"}static get isInitializing(){return a.stateMachine.isInitializing}static addStateListener(e){a.stateMachine.addListener(e);}static removeStateListener(e){a.stateMachine.removeListener(e);}async initializeWithOptions(e){var t,r,n,i,s,o,u,c,l;a.deviceID===""&&(a.deviceID=await b$1.getDeviceId()),this.licenseKey=(r=(t=e.licenseKey)!=null?t:a.userLicenseKey)!=null?r:"",this.deviceName=(n=e.deviceName)!=null?n:"",this.dataCaptureInstance=(i=e.dataCaptureInstance)!=null?i:a.mainDataCaptureLoader,this.delayedRegistration=(s=e.delayedRegistration)!=null?s:false,e.settings!=null&&(this.settings=e.settings),this.highEndBlurryRecognition=(l=(c=(o=e.dataCaptureInstance)==null?void 0:o.highEndBlurryRecognition)!=null?c:(u=a.mainDataCaptureLoader)==null?void 0:u.highEndBlurryRecognition)!=null?l:false;for(let S of this.pendingWorkerMessageListeners)this.dataCaptureInstance.addWorkerListener(S);this.pendingWorkerMessageListeners.clear(),this.settings!=null&&await this.applySettings(this.settings),await this.createContext();}get frameSource(){return this._frameSource}get workerCommand(){if(this.dataCaptureInstance==null)throw new Error("Cannot call workerCommand before dataCaptureInstance is set");return this.dataCaptureInstance.workerCommand.bind(this.dataCaptureInstance)}static async forLicenseKey(e,t){return a$3.debug(`forLicenseKey called, current state: ${a.stateMachine.currentState}`),a.stateMachine.currentState==="ready"?(a$3.debug("DataCaptureContext is already ready, returning existing instance"),a.sharedInstance):a.stateMachine.isInitializing?(a$3.debug("DataCaptureContext is already initializing, waiting for completion"),await a.stateMachine.waitForState("ready"),a.sharedInstance):(a.stateMachine.currentState==="unconfigured"&&(a$3.debug("Starting initialization from unconfigured state"),await a.stateMachine.executeAsyncTransition({targetState:"configuring",action:async()=>{await a.internalConfigure(e,t);},onSuccess:"configured",onError:"unconfigured"}),await a.stateMachine.executeAsyncTransition({targetState:"creating-context",action:async()=>{await a.sharedInstance.initializeWithOptions({licenseKey:e,deviceName:t.deviceName,settings:t.settings});},onSuccess:"ready",onError:"unconfigured"})),a.sharedInstance)}static async internalConfigure(e$1,t){var S;a$4(),c$1(),a$5.getInstance().updateIfMissing(a$6);let{forceAllPolyfills:r,overrideThreadsSupport:n,overrideSimdSupport:i}=a.getOverridesFromQueryString(),[s,o,u]=await Promise.all([a$7({forceAllPolyfills:r}),c$2(),e()]);n!=="auto"&&(a$3.warn(`Threads support override: was ${u} is now ${n==="on"}`),u=n==="on"),i!=="auto"&&(a$3.warn(`SIMD support override: was ${o} is now ${i==="on"}`),o=i==="on"),a.capabilityInfo={simdSupport:o,threadsSupport:u},a$3.debug(`Capability info detected - SIMD: ${o}, Threads: ${u}`),await a.validateOptions({...t,licenseKey:e$1});let c={licenseKey:e$1,libraryLocation:a$8(t.libraryLocation),moduleLoaders:t.moduleLoaders,logLevel:(S=t.logLevel)!=null?S:a$3.Level.Debug,verifyResponseHash:true,loadProgressNotifier:b$2.notify.bind(b$2),simdSupport:o,threadsSupport:u};a$3.setLevel(c.logLevel),a.userLicenseKey=c.licenseKey,a.libraryLocation=c.libraryLocation,b$2.subscribe(a.updateViewsWithProgress);let l=b$1.checkBrowserCompatibility();if(!l.fullSupport&&!l.scannerSupport)throw new a$9(l);b$1.isSupportedIOSVersion()||a$3.warn(`Warning: Minimum supported iOS version is 14.6.
1
+ import {a as a$7}from'./chunk-Y7BTRVB4.js';import {a as a$4}from'./chunk-ACFJP5SR.js';import {a as a$a,c as c$3,b as b$3}from'./chunk-L66S4DN2.js';import {a as a$j}from'./chunk-BA3RP6L2.js';import {a as a$h}from'./chunk-KSCFPJAW.js';import {a as a$f}from'./chunk-W3X3ZRQZ.js';import {a as a$8}from'./chunk-AIC4H5KG.js';import {a as a$d}from'./chunk-JS3T7K2Z.js';import {b as b$2}from'./chunk-6H6FKGVE.js';import {a as a$c}from'./chunk-N5YZEC56.js';import {a as a$6}from'./chunk-VJB527QZ.js';import {a as a$5}from'./chunk-GHTCNOQN.js';import {a as a$1}from'./chunk-LXOZUOZU.js';import {a as a$g}from'./chunk-FGO2SSRS.js';import {c as c$1,a as a$e}from'./chunk-4LGQ66HW.js';import {g,e as e$1}from'./chunk-CZI3JAVS.js';import {a as a$k}from'./chunk-LFJUGRQV.js';import {a as a$9}from'./chunk-GPJEB376.js';import {b as b$1}from'./chunk-YONR3EGV.js';import {c as c$2,e}from'./chunk-SBC5K7IT.js';import {a as a$3}from'./chunk-XR65N6EG.js';import {f as f$1}from'./chunk-D222MT4V.js';import {a as a$i}from'./chunk-WUHKODFA.js';import {a as a$2}from'./chunk-7SW2PEHB.js';import {a as a$b}from'./chunk-QCZSSQAQ.js';import {c}from'./chunk-TR3NGINC.js';var Z=[{from:"unconfigured",to:"configuring"},{from:"configuring",to:"configured"},{from:"configuring",to:"unconfigured"},{from:"configured",to:"creating-context"},{from:"creating-context",to:"ready"},{from:"creating-context",to:"unconfigured"},{from:"ready",to:"unconfigured"},{from:"configured",to:"unconfigured"}];function v(C,e,t){let r=t.value;return t.value=function(...n){let i=f.stateMachine;return i.currentState==="ready"&&f.mainDataCaptureLoader!=null?r.apply(this,n):i.isInitializing||i.currentState==="configured"?i.waitForState("ready").then(()=>r.apply(this,n)):Promise.reject(new Error(`Please call DataCaptureContext.forLicenseKey() before calling ${String(e)}`))},t}function q(C){return C[a$j]!=null}function x(C){return "skipSerialization"in C||C[a$j]!=null}var _,Y,Q,X;X=a$k;var a=class a{constructor(){this._asyncImageConverterInstance=void 0;this.framework="web";this.runtimeEnvironment={deviceOS:(_=b$1.getUserAgentInfo().getOS().name)!=null?_:"",browser:(Y=b$1.getUserAgentInfo().getBrowser().name)!=null?Y:"",browserVersion:(Q=b$1.getUserAgentInfo().getBrowser().version)!=null?Q:"",get deviceModelName(){let{model:e,vendor:t}=b$1.getUserAgentInfo().getDevice();return (t==null||t==="")&&(t="Unknown"),(e==null||e==="")&&(e="Unknown"),[t,e].join(" ")}};this.settings=new a$2;this._frameSource=null;this._view=null;this.modes=new Set;this.components=[];this.listeners=[];this.updateListeners=new Set;this.cameraPropertiesReportListener=this.reportCameraProperties.bind(this);this.cameraAccessErrorListener=this.onCameraAccessError.bind(this);this.onWorkerMessageListener=this.onWorkerMessage.bind(this);this.onVisibilityChangeListener=this.onVisibilityChange.bind(this);this.batteryChangeListener=this.onBatteryChange.bind(this);this.pendingWorkerMessageListeners=new Set;this.delayedRegistration=false;this.highEndBlurryRecognition=false;this._frameHandlers=[];this._useSynchronousFrameFlow=false;this[X]={hasModes:this.hasModes.bind(this)};}static get moduleLicenseTextProviders(){return [new b]}static get sharedInstance(){return a._sharedInstance==null&&(a._sharedInstance=new a),a._sharedInstance}static get currentState(){return a.stateMachine.currentState}static get isReady(){return a.stateMachine.currentState==="ready"}static get isInitializing(){return a.stateMachine.isInitializing}static addStateListener(e){a.stateMachine.addListener(e);}static removeStateListener(e){a.stateMachine.removeListener(e);}async initializeWithOptions(e){var t,r,n,i,s,o,u,c,l;a.deviceID===""&&(a.deviceID=await b$1.getDeviceId()),this.licenseKey=(r=(t=e.licenseKey)!=null?t:a.userLicenseKey)!=null?r:"",this.deviceName=(n=e.deviceName)!=null?n:"",this.dataCaptureInstance=(i=e.dataCaptureInstance)!=null?i:a.mainDataCaptureLoader,this.delayedRegistration=(s=e.delayedRegistration)!=null?s:false,e.settings!=null&&(this.settings=e.settings),this.highEndBlurryRecognition=(l=(c=(o=e.dataCaptureInstance)==null?void 0:o.highEndBlurryRecognition)!=null?c:(u=a.mainDataCaptureLoader)==null?void 0:u.highEndBlurryRecognition)!=null?l:false;for(let S of this.pendingWorkerMessageListeners)this.dataCaptureInstance.addWorkerListener(S);this.pendingWorkerMessageListeners.clear(),this.settings!=null&&await this.applySettings(this.settings),await this.createContext();}get frameSource(){return this._frameSource}get workerCommand(){if(this.dataCaptureInstance==null)throw new Error("Cannot call workerCommand before dataCaptureInstance is set");return this.dataCaptureInstance.workerCommand.bind(this.dataCaptureInstance)}static async forLicenseKey(e,t){return a$3.debug(`forLicenseKey called, current state: ${a.stateMachine.currentState}`),a.stateMachine.currentState==="ready"?(a$3.debug("DataCaptureContext is already ready, returning existing instance"),a.sharedInstance):a.stateMachine.isInitializing?(a$3.debug("DataCaptureContext is already initializing, waiting for completion"),await a.stateMachine.waitForState("ready"),a.sharedInstance):(a.stateMachine.currentState==="unconfigured"&&(a$3.debug("Starting initialization from unconfigured state"),await a.stateMachine.executeAsyncTransition({targetState:"configuring",action:async()=>{await a.internalConfigure(e,t);},onSuccess:"configured",onError:"unconfigured"}),await a.stateMachine.executeAsyncTransition({targetState:"creating-context",action:async()=>{await a.sharedInstance.initializeWithOptions({licenseKey:e,deviceName:t.deviceName,settings:t.settings});},onSuccess:"ready",onError:"unconfigured"})),a.sharedInstance)}static async internalConfigure(e$1,t){var S;a$4(),c$1(),a$5.getInstance().updateIfMissing(a$6);let{forceAllPolyfills:r,overrideThreadsSupport:n,overrideSimdSupport:i}=a.getOverridesFromQueryString(),[s,o,u]=await Promise.all([a$7({forceAllPolyfills:r}),c$2(),e()]);n!=="auto"&&(a$3.warn(`Threads support override: was ${u} is now ${n==="on"}`),u=n==="on"),i!=="auto"&&(a$3.warn(`SIMD support override: was ${o} is now ${i==="on"}`),o=i==="on"),a.capabilityInfo={simdSupport:o,threadsSupport:u},a$3.debug(`Capability info detected - SIMD: ${o}, Threads: ${u}`),await a.validateOptions({...t,licenseKey:e$1});let c={licenseKey:e$1,libraryLocation:a$8(t.libraryLocation),moduleLoaders:t.moduleLoaders,logLevel:(S=t.logLevel)!=null?S:a$3.Level.Debug,verifyResponseHash:true,loadProgressNotifier:b$2.notify.bind(b$2),simdSupport:o,threadsSupport:u};a$3.setLevel(c.logLevel),a.userLicenseKey=c.licenseKey,a.libraryLocation=c.libraryLocation,b$2.subscribe(a.updateViewsWithProgress);let l=b$1.checkBrowserCompatibility();if(!l.fullSupport&&!l.scannerSupport)throw new a$9(l);b$1.isSupportedIOSVersion()||a$3.warn(`Warning: Minimum supported iOS version is 14.6.
2
2
  Please check the minimum system requirements here:
3
3
  https://docs.scandit.com/system-requirements#browser-compatibility`),a.dataCaptureLoaders=await a.loadModules(c.moduleLoaders,c),a.mainDataCaptureLoader=[...a.dataCaptureLoaders.entries()][0][1],b$2.unsubscribe(a.updateViewsWithProgress);}static async forLicenseKeyInElectronPath(e,t){if(!a$a())throw new a$b({name:"MisconfigurationError",message:"forLicenseKeyInElectronPath can only be used in Electron applications"});let r=await c$3({licenseDataPath:e});if(r==null)throw new a$b({name:"NoLicenseKeyError",message:`Cannot retrieve license key for Electron app at ${e}`});return a.forLicenseKey(r.licenseKey,{...t})}static updateViewsWithProgress({percentage:e}){for(let t of a$c.values())t.setProgressBarPercentage(e);}static getOverridesFromQueryString(){var s,o,u;function e(c){return ["auto","off","on"].includes(c)}let t=new URLSearchParams(window.location.search),[r="auto",n="auto",i=false]=[(s=t.get("pthreads"))==null?void 0:s.toLowerCase(),(o=t.get("simd"))==null?void 0:o.toLowerCase(),((u=t.get("forceAllPolyfills"))==null?void 0:u.toLowerCase())==="true"];return {overrideThreadsSupport:e(r)?r:"auto",overrideSimdSupport:e(n)?n:"auto",forceAllPolyfills:i}}static async validateOptions(e){if(e.licenseKey==null||e.licenseKey.trim().length<64)throw new a$b({name:"NoLicenseKeyError",message:"No license key provided"});if(typeof e.libraryLocation!="string")throw new a$b({name:"MisconfigurationError",message:'Option "libraryLocation" was not provided'});if(!Array.isArray(e.moduleLoaders)||e.moduleLoaders.length===0)throw new a$b({name:"MisconfigurationError",message:'Option "moduleLoaders" is missing or empty'});let t=e.moduleLoaders.map(r=>r.moduleName);if(!["BarcodeCapture","IdCapture","LabelCapture"].includes(t[0]))throw new a$b({name:"MisconfigurationError",message:'Main modules must be loaded before side modules. For example "BarcodeCapture" must be loaded before "Parser".'})}static async loadModules(e,t){let r=new Map,n=new Map;for(let i of e)n.set(i.moduleName,i.load(t));await Promise.all(n.values());for(let[i,s]of n)r.set(i,await s);return r}static async getOpenSourceSoftwareLicenseInfo(){let e=[];for(let r of a.moduleLicenseTextProviders){let n=await r.getLicenseText();e.push(n);}let t=e.join(`
4
4