@scandit/web-datacapture-barcode 7.2.0 → 7.2.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (73) hide show
  1. package/build/js/{SparkScanView-BHTEutX-.d.ts → SparkScanView-CInaxmG9.d.ts} +4 -0
  2. package/build/js/check/BarcodeCheck.js +1 -1
  3. package/build/js/check/BarcodeCheckFeedback.js +1 -1
  4. package/build/js/check/BarcodeCheckPresenter.js +1 -1
  5. package/build/js/check/BarcodeCheckView.js +1 -1
  6. package/build/js/chunks/{chunk-PUMPP7D6.js → chunk-2SVQMM7R.js} +1 -1
  7. package/build/js/chunks/{chunk-EEWERXCW.js → chunk-33DDD652.js} +1 -1
  8. package/build/js/chunks/{chunk-A2JYXIGU.js → chunk-3KS5SAB5.js} +1 -1
  9. package/build/js/chunks/chunk-62I36ZHW.js +1 -0
  10. package/build/js/chunks/chunk-64AES6FW.js +1 -0
  11. package/build/js/chunks/{chunk-BTRDH2AV.js → chunk-7IHFDDCQ.js} +1 -1
  12. package/build/js/chunks/chunk-BZBGJHXV.js +211 -0
  13. package/build/js/chunks/{chunk-QGAFQZJW.js → chunk-JA2J2COW.js} +1 -1
  14. package/build/js/chunks/{chunk-Y5LNDJE7.js → chunk-LY4V725T.js} +4 -4
  15. package/build/js/chunks/{chunk-IQEPXI6U.js → chunk-MVG7P7AH.js} +1 -1
  16. package/build/js/chunks/{chunk-TLDFT6RG.js → chunk-QA3MUV4X.js} +1 -1
  17. package/build/js/chunks/chunk-RWDAYBTQ.js +1 -0
  18. package/build/js/chunks/{chunk-5KVH2XIO.js → chunk-TQ3DI76M.js} +1 -1
  19. package/build/js/chunks/chunk-UC3AH6LP.js +1 -0
  20. package/build/js/chunks/chunk-UYTQR774.js +1 -0
  21. package/build/js/chunks/{chunk-LAWBMRSV.js → chunk-V4HNUUMT.js} +1 -1
  22. package/build/js/find/BarcodeFind.js +1 -1
  23. package/build/js/find/BarcodeFindView.js +1 -1
  24. package/build/js/find/index.js +1 -1
  25. package/build/js/index.d.ts +1 -1
  26. package/build/js/index.js +1 -1
  27. package/build/js/moduleLoader.js +1 -1
  28. package/build/js/spark/index.d.ts +1 -1
  29. package/build/js/spark/index.js +1 -1
  30. package/build/js/spark/ui/SparkScanView.d.ts +1 -1
  31. package/build/js/spark/ui/SparkScanView.js +1 -1
  32. package/build/js/spark/ui/SparkScanViewMiniPreview.d.ts +2 -0
  33. package/build/js/spark/ui/SparkScanViewMiniPreview.js +1 -1
  34. package/build/js/spark/ui/SparkScanViewPresenter.d.ts +2 -1
  35. package/build/js/spark/ui/SparkScanViewPresenter.js +1 -1
  36. package/build/js/spark/ui/SparkScanViewTriggerButton.d.ts +1 -0
  37. package/build/js/spark/ui/SparkScanViewTriggerButton.js +1 -1
  38. package/build/js/spark/ui/SparkScanViewUiListener.d.ts +1 -1
  39. package/build/js/spark/ui/SparkScanViewVisualFeedback.js +1 -1
  40. package/build/js/spark/ui/controllers/DragController.d.ts +2 -1
  41. package/build/js/spark/ui/controllers/DragController.js +1 -1
  42. package/build/js/spark/ui/index.d.ts +1 -1
  43. package/build/js/spark/ui/index.js +1 -1
  44. package/build/js/worker/BarcodeBatchMode.d.ts +1 -1
  45. package/build/js/worker/BarcodeCaptureMode.d.ts +1 -1
  46. package/build/js/worker/BarcodeCaptureWorkerManager.d.ts +1 -1
  47. package/build/js/worker/BarcodeCaptureWorkerManager.js +1 -1
  48. package/build/js/worker/BarcodeCheckMode.d.ts +1 -1
  49. package/build/js/worker/BarcodeFindMode.d.ts +1 -1
  50. package/build/js/worker/SparkScanMode.d.ts +1 -1
  51. package/build/js/worker/WorkerMain.d.ts +1 -1
  52. package/build/js/worker/WorkerMain.js +1 -1
  53. package/build/js/worker/dataCapture.inlineWorker.js +1 -1
  54. package/build/js/worker/dataCaptureEngine.d.ts +1 -1
  55. package/build/js/worker/dataCaptureEngine.js +1 -1
  56. package/build/js/worker/dataCaptureWorkerRelated.d.ts +1 -1
  57. package/build/js/worker/index.d.ts +1 -1
  58. package/package.json +2 -2
  59. package/sdc-lib/scandit-datacapture-sdk-barcode-pthreads.js +1 -1
  60. package/sdc-lib/scandit-datacapture-sdk-barcode-pthreads.wasm +0 -0
  61. package/sdc-lib/scandit-datacapture-sdk-barcode-simd-pthreads.js +1 -1
  62. package/sdc-lib/scandit-datacapture-sdk-barcode-simd-pthreads.wasm +0 -0
  63. package/sdc-lib/scandit-datacapture-sdk-barcode-simd.js +1 -1
  64. package/sdc-lib/scandit-datacapture-sdk-barcode-simd.wasm +0 -0
  65. package/sdc-lib/scandit-datacapture-sdk-barcode.js +1 -1
  66. package/sdc-lib/scandit-datacapture-sdk-barcode.wasm +0 -0
  67. package/build/js/chunks/chunk-63KZV5XE.js +0 -1
  68. package/build/js/chunks/chunk-BAOM24RT.js +0 -1
  69. package/build/js/chunks/chunk-C5GWADSL.js +0 -1
  70. package/build/js/chunks/chunk-FJ4SOETD.js +0 -1
  71. package/build/js/chunks/chunk-RMCPFLAA.js +0 -211
  72. package/build/js/chunks/chunk-S2PGFYJU.js +0 -1
  73. /package/build/js/chunks/{chunk-7PUNN73L.js → chunk-5OIAUK6Q.js} +0 -0
@@ -69,6 +69,8 @@ declare class SparkScanView extends ScanditHTMLElement {
69
69
  * @deprecated Use `triggerButtonTintColor` instead.
70
70
  */
71
71
  captureButtonTintColor?: Color;
72
+ private resizeObserver;
73
+ private onResizeHandler;
72
74
  private presenter;
73
75
  private settings;
74
76
  private miniPreview;
@@ -110,6 +112,8 @@ declare class SparkScanView extends ScanditHTMLElement {
110
112
  showToast(message: string): void;
111
113
  setListener(listener: SparkScanViewUiListener | null): void;
112
114
  setTriggerButtonImage(image?: HTMLImageElement | SVGElement): void;
115
+ private setWidthAndHeightCssStyleProperties;
116
+ private onResize;
113
117
  private mount;
114
118
  private unmount;
115
119
  private connectedCallback;
@@ -1 +1 @@
1
- export{a as BarcodeCheck}from'../chunks/chunk-LAWBMRSV.js';
1
+ export{a as BarcodeCheck}from'../chunks/chunk-V4HNUUMT.js';
@@ -1 +1 @@
1
- export{a as BarcodeCheckFeedback}from'../chunks/chunk-7PUNN73L.js';
1
+ export{a as BarcodeCheckFeedback}from'../chunks/chunk-5OIAUK6Q.js';
@@ -1 +1 @@
1
- export{a as BarcodeCheckPresenter}from'../chunks/chunk-A2JYXIGU.js';
1
+ export{a as BarcodeCheckPresenter}from'../chunks/chunk-3KS5SAB5.js';
@@ -1 +1 @@
1
- export{a as BarcodeCheckView}from'../chunks/chunk-TLDFT6RG.js';
1
+ export{a as BarcodeCheckView}from'../chunks/chunk-QA3MUV4X.js';
@@ -1 +1 @@
1
- import {a as a$2}from'./chunk-LTNZJEG4.js';import {a as a$1}from'./chunk-2ZSOWJ2F.js';import {a}from'./chunk-WVIC3JWX.js';import {a as a$4}from'./chunk-7JOXKPVL.js';import {a as a$3}from'./chunk-7O2NHA3I.js';import {a as a$5}from'./chunk-S2PGFYJU.js';import {DataCaptureEngine}from'@scandit/web-datacapture-core/build/js/worker/index.js';var c=class extends DataCaptureEngine{constructor(e,r){super(e,r);}getModeDeserializers(){this.barcodeCaptureMode=new a(this,this.Module,this.workerFunctions),this.barcodeBatchMode=new a$1(this,this.Module,this.workerFunctions),this.sparkScanMode=new a$2(this,this.Module,this.workerFunctions),this.barcodeFindMode=new a$3(this,this.Module,this.workerFunctions),this.barcodeCheckMode=new a$4(this,this.Module,this.workerFunctions);let e=super.getModeDeserializers();return e.push_back(this.barcodeCaptureMode.getCaptureDeserializer()),e.push_back(this.barcodeBatchMode.getBatchDeserializer()),e.push_back(this.sparkScanMode.getSparkScanDeserializer()),e}getWasmSideModuleFileName(){return ""}getWasmCoreFileName(e,r){return r?e?"scandit-datacapture-sdk-barcode-simd-pthreads.wasm":"scandit-datacapture-sdk-barcode-pthreads.wasm":e?"scandit-datacapture-sdk-barcode-simd.wasm":"scandit-datacapture-sdk-barcode.wasm"}getWasmCoreExpectedHash(e,r){return r?e?"8c1f345ea9074e8b80cb044d99a0e10e47bc3a5d236a1e765abdea80b43dd348":"59b6a672054cdd5713b437cecd86df0e7d31bea8e87373f5e41036bd519b4542":e?"fb4f822587eada38163083dc4c2a1ac27c29ab3b0e82590446dfb724621b7dfd":"906c7c8df6f255a43e9b3a2f735d44e5745d497d165d06ca8fa3cf6dc15a89b7"}getWasmMetadata(){return a$5}};export{c as a};
1
+ import {a as a$2}from'./chunk-LTNZJEG4.js';import {a as a$1}from'./chunk-2ZSOWJ2F.js';import {a}from'./chunk-WVIC3JWX.js';import {a as a$4}from'./chunk-7JOXKPVL.js';import {a as a$3}from'./chunk-7O2NHA3I.js';import {a as a$5}from'./chunk-UYTQR774.js';import {DataCaptureEngine}from'@scandit/web-datacapture-core/build/js/worker/index.js';var c=class extends DataCaptureEngine{constructor(e,r){super(e,r);}getModeDeserializers(){this.barcodeCaptureMode=new a(this,this.Module,this.workerFunctions),this.barcodeBatchMode=new a$1(this,this.Module,this.workerFunctions),this.sparkScanMode=new a$2(this,this.Module,this.workerFunctions),this.barcodeFindMode=new a$3(this,this.Module,this.workerFunctions),this.barcodeCheckMode=new a$4(this,this.Module,this.workerFunctions);let e=super.getModeDeserializers();return e.push_back(this.barcodeCaptureMode.getCaptureDeserializer()),e.push_back(this.barcodeBatchMode.getBatchDeserializer()),e.push_back(this.sparkScanMode.getSparkScanDeserializer()),e}getWasmSideModuleFileName(){return ""}getWasmCoreFileName(e,r){return r?e?"scandit-datacapture-sdk-barcode-simd-pthreads.wasm":"scandit-datacapture-sdk-barcode-pthreads.wasm":e?"scandit-datacapture-sdk-barcode-simd.wasm":"scandit-datacapture-sdk-barcode.wasm"}getWasmCoreExpectedHash(e,r){return r?e?"ac71af99bcfd4aad0e5e3beba1cc6e6dff7c585362221d7bf3cd17a46ef02dcb":"4d068ed97dfc8d46adf179bf9584aaacd4a3cff4da477942a5241d44e5f5471f":e?"b33512d5eb5e0cb439a01424f641caa2d3244cce8a529ff3320a043bfe570d5c":"be3d1f696bda507e014e9af2c787db53978137136bd10e8d92aa200a92af18b2"}getWasmMetadata(){return a$5}};export{c as a};
@@ -1 +1 @@
1
- import {a as a$1}from'./chunk-QGAFQZJW.js';import {a}from'./chunk-LKZBVQXD.js';import {Localization}from'@scandit/web-datacapture-core';import {normalizeLibraryLocation}from'@scandit/web-datacapture-core/build/js/private/Helper.js';function b(r){return Localization.getInstance().updateIfMissing({...a}),r!=null&&r.libraryLocation&&(r.libraryLocation=normalizeLibraryLocation(r.libraryLocation)),{moduleName:"BarcodeCapture",load:async n=>{var e,o;let a=n;return await a$1.create({...a,libraryLocation:(e=r==null?void 0:r.libraryLocation)!=null?e:a.libraryLocation,highEndBlurryRecognition:(o=r==null?void 0:r.highEndBlurryRecognition)!=null?o:!1})}}}export{b as a};
1
+ import {a as a$1}from'./chunk-JA2J2COW.js';import {a}from'./chunk-LKZBVQXD.js';import {Localization}from'@scandit/web-datacapture-core';import {normalizeLibraryLocation}from'@scandit/web-datacapture-core/build/js/private/Helper.js';function b(r){return Localization.getInstance().updateIfMissing({...a}),r!=null&&r.libraryLocation&&(r.libraryLocation=normalizeLibraryLocation(r.libraryLocation)),{moduleName:"BarcodeCapture",load:async n=>{var e,o;let a=n;return await a$1.create({...a,libraryLocation:(e=r==null?void 0:r.libraryLocation)!=null?e:a.libraryLocation,highEndBlurryRecognition:(o=r==null?void 0:r.highEndBlurryRecognition)!=null?o:!1})}}}export{b as a};
@@ -1 +1 @@
1
- import {a}from'./chunk-7PUNN73L.js';import {TorchState,isCameraFrameSource,Camera,FrameSourceState,CameraPosition}from'@scandit/web-datacapture-core';var h=class{constructor(e,t,c,n,d){this.torchState=TorchState.Off;this.cameraSupportMap=new Map;this.zoomFactor=1;this.view=e,this.context=t,this.barcodeCheck=c,this.viewSettings=n,this.cameraSettings=d;}get currentCamera(){if(isCameraFrameSource(this.context.frameSource))return this.context.frameSource;throw new Error("The current frame source is not a Camera")}async prepare(){await this.barcodeCheck.setEnabled(!1),this.barcodeCheck.feedback=await a.createWithOptions(!0,!0),this.barcodeCheck.addPrivateListener(this);let e=Camera.atPosition(this.viewSettings.defaultCameraPosition);await this.context.setFrameSource(e),await this.currentCamera.applySettings(this.cameraSettings),await this.currentCamera.switchToDesiredState(FrameSourceState.Standby),this.zoomFactor=this.currentCamera.settings.zoomFactor,this.view.changeZoomButtonIcon(this.zoomFactor);}async dispose(){var e;this.view.deleteAllViews(),await this.context.removeMode(this.barcodeCheck),this.barcodeCheck.removePrivateListener(this),await((e=this.context.frameSource)==null?void 0:e.switchToDesiredState(FrameSourceState.Off));}async startSearching(){var e;this.view.deleteAllViews(),await((e=this.context.frameSource)==null?void 0:e.switchToDesiredState(FrameSourceState.On)),await this.barcodeCheck.setEnabled(!0),await this.barcodeCheck.start();}async stopSearching(){var e;this.view.deleteAllViews(),await((e=this.context.frameSource)==null?void 0:e.switchToDesiredState(FrameSourceState.Off)),await this.barcodeCheck.setEnabled(!1),await this.barcodeCheck.stop();}async pauseSearching(){var e;this.view.deletePendingViews(),await((e=this.context.frameSource)==null?void 0:e.switchToDesiredState(FrameSourceState.Standby)),await this.barcodeCheck.setEnabled(!1),await this.barcodeCheck.pause();}emitTappedFeedback(){this.barcodeCheck.feedback.tapped.emit();}didUpdateSession(e,t){Object.keys(t.addedTrackedBarcodes).length>0&&this.barcodeCheck.feedback.scanned.emit(),this.view.render(t);}async onTorchButtonClicked(){var e,t;this.cameraSupportMap.get(this.currentCamera.label)||this.cameraSupportMap.set(this.currentCamera.label,{torch:await this.currentCamera.isTorchAvailable()}),(t=(e=this.cameraSupportMap.get(this.currentCamera.label))==null?void 0:e.torch)!=null&&t&&(await this.currentCamera.setDesiredTorchState(this.torchState===TorchState.Off?TorchState.On:TorchState.Off),this.torchState=this.torchState===TorchState.Off?TorchState.On:TorchState.Off,this.view.toggleTorchIcon(this.torchState));}async onZoomButtonClicked(){var t;if(!this.currentCamera.isZoomAvailable())return;let e=(t={1:2,2:1}[this.zoomFactor])!=null?t:1;this.currentCamera.settings.zoomFactor=e,await this.currentCamera.applySettings(this.currentCamera.settings),this.zoomFactor=e,this.view.changeZoomButtonIcon(e);}async onCameraSwitchButtonClicked(){let e=this.currentCamera.getCurrentState(),t=Camera.atPosition(this.currentCamera.position===CameraPosition.UserFacing?CameraPosition.WorldFacing:CameraPosition.UserFacing);await this.context.setFrameSource(t),await this.currentCamera.switchToDesiredState(e);}};export{h as a};
1
+ import {a}from'./chunk-5OIAUK6Q.js';import {TorchState,isCameraFrameSource,Camera,FrameSourceState,CameraPosition}from'@scandit/web-datacapture-core';var h=class{constructor(e,t,c,n,d){this.torchState=TorchState.Off;this.cameraSupportMap=new Map;this.zoomFactor=1;this.view=e,this.context=t,this.barcodeCheck=c,this.viewSettings=n,this.cameraSettings=d;}get currentCamera(){if(isCameraFrameSource(this.context.frameSource))return this.context.frameSource;throw new Error("The current frame source is not a Camera")}async prepare(){await this.barcodeCheck.setEnabled(!1),this.barcodeCheck.feedback=await a.createWithOptions(!0,!0),this.barcodeCheck.addPrivateListener(this);let e=Camera.atPosition(this.viewSettings.defaultCameraPosition);await this.context.setFrameSource(e),await this.currentCamera.applySettings(this.cameraSettings),await this.currentCamera.switchToDesiredState(FrameSourceState.Standby),this.zoomFactor=this.currentCamera.settings.zoomFactor,this.view.changeZoomButtonIcon(this.zoomFactor);}async dispose(){var e;this.view.deleteAllViews(),await this.context.removeMode(this.barcodeCheck),this.barcodeCheck.removePrivateListener(this),await((e=this.context.frameSource)==null?void 0:e.switchToDesiredState(FrameSourceState.Off));}async startSearching(){var e;this.view.deleteAllViews(),await((e=this.context.frameSource)==null?void 0:e.switchToDesiredState(FrameSourceState.On)),await this.barcodeCheck.setEnabled(!0),await this.barcodeCheck.start();}async stopSearching(){var e;this.view.deleteAllViews(),await((e=this.context.frameSource)==null?void 0:e.switchToDesiredState(FrameSourceState.Off)),await this.barcodeCheck.setEnabled(!1),await this.barcodeCheck.stop();}async pauseSearching(){var e;this.view.deletePendingViews(),await((e=this.context.frameSource)==null?void 0:e.switchToDesiredState(FrameSourceState.Standby)),await this.barcodeCheck.setEnabled(!1),await this.barcodeCheck.pause();}emitTappedFeedback(){this.barcodeCheck.feedback.tapped.emit();}didUpdateSession(e,t){Object.keys(t.addedTrackedBarcodes).length>0&&this.barcodeCheck.feedback.scanned.emit(),this.view.render(t);}async onTorchButtonClicked(){var e,t;this.cameraSupportMap.get(this.currentCamera.label)||this.cameraSupportMap.set(this.currentCamera.label,{torch:await this.currentCamera.isTorchAvailable()}),(t=(e=this.cameraSupportMap.get(this.currentCamera.label))==null?void 0:e.torch)!=null&&t&&(await this.currentCamera.setDesiredTorchState(this.torchState===TorchState.Off?TorchState.On:TorchState.Off),this.torchState=this.torchState===TorchState.Off?TorchState.On:TorchState.Off,this.view.toggleTorchIcon(this.torchState));}async onZoomButtonClicked(){var t;if(!this.currentCamera.isZoomAvailable())return;let e=(t={1:2,2:1}[this.zoomFactor])!=null?t:1;this.currentCamera.settings.zoomFactor=e,await this.currentCamera.applySettings(this.currentCamera.settings),this.zoomFactor=e,this.view.changeZoomButtonIcon(e);}async onCameraSwitchButtonClicked(){let e=this.currentCamera.getCurrentState(),t=Camera.atPosition(this.currentCamera.position===CameraPosition.UserFacing?CameraPosition.WorldFacing:CameraPosition.UserFacing);await this.context.setFrameSource(t),await this.currentCamera.switchToDesiredState(e);}};export{h as a};
@@ -0,0 +1 @@
1
+ import {j,k}from'./chunk-DVHTYKDX.js';import {g}from'./chunk-YBD5JYCX.js';import {ScanditHTMLElement,css,defineCustomElements}from'@scandit/web-datacapture-core/build/js/private/utils/index.js';var r=class c extends ScanditHTMLElement{constructor(){super(...arguments);this.styleElement=css`${g}{height:var(--dvh);left:0;opacity:0;pointer-events:none;position:absolute;top:0;user-select:none;width:var(--dvw)}${g}[success]{background:var(${j})}${g}[error]{background:var(${k})}`;}get success(){return this.hasAttribute("success")}set success(e){this.toggleAttribute("error",!e),this.toggleAttribute("success",e);}get error(){return this.hasAttribute("error")}set error(e){this.toggleAttribute("error",e),this.toggleAttribute("success",!e);}static create(){return defineCustomElements({[g]:c}),document.createElement(g)}async fadeIn(e,a){await this.animate([{opacity:"0"},{opacity:e}],{duration:a,easing:"linear"}).finished;}async fadeOut(e,a){await this.animate([{opacity:e},{opacity:"0"}],{duration:a,easing:"linear"}).finished;}async emitSuccessFeedback(){this.success=!0,await this.fadeIn("1",200),await this.fadeOut("1",0);}async emitErrorFeedback(){this.error=!0,await this.fadeIn("1",100),await this.fadeOut("1",100),await this.fadeIn("0.5",100),await this.fadeOut("0.5",0);}connectedCallback(){this.append(this.styleElement);}};export{r as a};
@@ -0,0 +1 @@
1
+ import {a}from'./chunk-QCD3RIT4.js';import {a as a$2}from'./chunk-OTZPCIBD.js';import {a as a$3}from'./chunk-BG7VNYCV.js';import {a as a$5}from'./chunk-LCXQXE27.js';import {b as b$2,c as c$1}from'./chunk-SZUPDKV5.js';import {a as a$4}from'./chunk-KYQRFAWX.js';import {b}from'./chunk-JMUNN3HX.js';import {a as a$1,c,b as b$1}from'./chunk-HKWMKBIV.js';import {b as b$3}from'./chunk-2RKBANN2.js';import {DataCaptureView,Anchor,LogoStyle,CameraAccess,Camera,isCameraFrameSource,FrameSourceState,Color,TorchState,Logger,NumberWithUnit,RadiusLocationSelection,CameraPosition}from'@scandit/web-datacapture-core';import {Timeout}from'@scandit/web-datacapture-core/build/js/private/utils/timeout.js';var P=class O{constructor(a$4,e,t,i){this.cameras=[];this.preferenceManager=new a(localStorage);this.defaultSuccessBrush=a$1.defaultSuccessBrush();this.defaultErrorBrush=a$1.defaultErrorBrush();this.sparkScanView=a$4,this.context=e,this.sparkScan=t,this.sparkScanViewSettings=i,this.stateManager=new a$2(this.sparkScanViewSettings,this.preferenceManager),this.feedbackManager=a$3.withDefaults(i.soundEnabled,i.hapticEnabled),this.analyticsManager=b.forContext(e),this.triggerButtonCollapseTimeout=new Timeout(this.sparkScanViewSettings.triggerButtonCollapseTimeout,async()=>{this.stateManager.state!=="idle"&&await this.switchToIdleState({sessionStopReason:"timeout"});}),this.inactiveStateTimeout=new Timeout(i.inactiveStateTimeout,async()=>{this.stateManager.state!=="inactive"&&!this.stateManager.holdingToScan&&await this.switchToInactiveState({sessionStopReason:"timeout"});}),this.switchToIdleState();}get portraitOrientationTriggerButtonTranslateX(){var a;return (a=this.stateManager.portraitOrientationTriggerButtonTranslateX)!=null?a:this.defaultTriggerButtonTranslateX}get portraitOrientationTriggerButtonTranslateY(){var a;return (a=this.stateManager.portraitOrientationTriggerButtonTranslateY)!=null?a:this.defaultTriggerButtonTranslateY}get landscapeOrientationTriggerButtonTranslateX(){var a;return (a=this.stateManager.landscapeOrientationTriggerButtonTranslateX)!=null?a:this.defaultTriggerButtonTranslateX}get landscapeOrientationTriggerButtonTranslateY(){var a;return (a=this.stateManager.landscapeOrientationTriggerButtonTranslateY)!=null?a:this.defaultTriggerButtonTranslateY}get portraitOrientationMiniPreviewTranslateX(){var a;return (a=this.stateManager.portraitOrientationMiniPreviewTranslateX)!=null?a:this.defaultMiniPreviewTranslateX}get portraitOrientationMiniPreviewTranslateY(){var a;return (a=this.stateManager.portraitOrientationMiniPreviewTranslateY)!=null?a:this.defaultMiniPreviewTranslateY}get landscapeOrientationMiniPreviewTranslateX(){var a;return (a=this.stateManager.landscapeOrientationMiniPreviewTranslateX)!=null?a:this.defaultMiniPreviewTranslateX}get landscapeOrientationMiniPreviewTranslateY(){var a;return (a=this.stateManager.landscapeOrientationMiniPreviewTranslateY)!=null?a:this.defaultMiniPreviewTranslateY}get defaultTriggerButtonTranslateX(){return this.parentViewSizes.width-Math.min(this.parentViewSizes.width/3,110)-90/2}get defaultTriggerButtonTranslateY(){return this.parentViewSizes.height-Math.min(this.parentViewSizes.height/3,250)-90/2}get defaultMiniPreviewTranslateX(){return this.parentViewSizes.width-225-16}get parentViewSizes(){var a,e;return {width:(a=this.sparkScanView.parentElement.clientWidth)!=null?a:window.innerWidth,height:(e=this.sparkScanView.parentElement.clientHeight)!=null?e:window.innerHeight}}get defaultMiniPreviewTranslateY(){return 16}static forView(a,e,t,i){return new O(a,e,t,i)}async prepareScanning(a){var i;this.context.addListener(this),this.dataCaptureView=await DataCaptureView.forContext(this.context),this.dataCaptureView.logoAnchor=Anchor.BottomCenter,this.dataCaptureView.logoStyle=LogoStyle.Minimal,this.dataCaptureView.setHiddenProperty("stopVideoTracksOnVisibilityChange",!1),this.dataCaptureView.setHiddenProperty("freezeFrameWhenStoppingFrameSource",!1),this.dataCaptureView.connectToElement(a);let e=await CameraAccess.getCameras();this.cameras=e.map(r=>Camera.fromDeviceCamera(r)),this.camera=isCameraFrameSource(this.context.frameSource)?this.context.frameSource:(i=this.cameras.find(r=>r.position===this.sparkScanViewSettings.defaultCameraPosition))!=null?i:Camera.default,await this.camera.applySettings(a$4.recommendedCameraSettings),await this.context.setFrameSource(this.camera),await this.camera.switchToDesiredState(FrameSourceState.Standby);let t=await this.camera.isTorchAvailable();this.sparkScanView.setTorchAvailable(t),this.sparkScanView.setZoomAvailable(this.camera.isZoomAvailable()),this.sparkScanView.cameraSwitchButtonTapped(t,this.camera.position),await this.context.addMode(this.sparkScan),this.sparkScan.addListener(this),this.sparkScanOverlay=await a$5.withSparkScanForView(this.sparkScan,this.dataCaptureView),await this.sparkScanOverlay.setShouldRemoveLocationsAfterScan(this.stateManager.scanningBehavior==="continuous"),this.analyticsManager.startSession({cameraPosition:this.camera.position,handMode:"right",hapticEnabled:this.sparkScanViewSettings.hapticEnabled,scanningMode:this.stateManager.scanningMode,soundEnabled:this.sparkScanViewSettings.soundEnabled,torchState:this.camera.getDesiredTorchState()}),await this.applyPreferences();}async startScanning(){await this.switchToActiveState();}async pauseScanning(){await this.switchToInactiveState({sessionStopReason:"user"});}async stopScanning(a){var e;await this.sparkScan.setEnabled(!1),this.sparkScan.removeListener(this),await((e=this.camera)==null?void 0:e.switchToDesiredState(FrameSourceState.Off)),this.dataCaptureView.detachFromElement(),this.context.removeListener(this),this.analyticsManager.setSessionStopReason(a.sessionStopReason);}async onTriggerButtonPointerDown(){await this.sparkScan.setResultSuppressionEnabled(!0);}async onTriggerButtonTap(){switch(await this.sparkScan.setResultSuppressionEnabled(!1),this.stateManager.state){case"Initial":return;case"idle":case"inactive":case"error":{await this.switchToActiveState({barcodeFeedback:new c(Color.fromRGBA(0,0,0,0),this.defaultSuccessBrush,this.feedbackManager.tapFeedback)});return}case"active":await(this.stateManager.continuousModeEnabled?this.switchToInactiveState({sessionStopReason:"user",barcodeFeedback:new c(Color.fromRGBA(0,0,0,0),this.defaultSuccessBrush,this.feedbackManager.tapFeedback)}):this.switchToActiveState({barcodeFeedback:new c(Color.fromRGBA(0,0,0,0),this.defaultSuccessBrush,this.feedbackManager.tapFeedback)}));}}async onTriggerButtonLongPressStart(){var a;await this.sparkScan.setResultSuppressionEnabled(!1),this.sparkScanViewSettings.holdToScanEnabled&&(this.scanningBehaviorCache=this.stateManager.scanningBehavior,this.stateManager.scanningBehavior="continuous",this.stateManager.holdingToScan=!0,await((a=this.sparkScanOverlay)==null?void 0:a.setShouldRemoveLocationsAfterScan(!0)),await this.switchToActiveState({barcodeFeedback:new c(Color.fromRGBA(0,0,0,0),this.defaultSuccessBrush,this.feedbackManager.tapFeedback)}));}async onTriggerButtonLongPressEnd(){var a,e;this.sparkScanViewSettings.holdToScanEnabled&&this.stateManager.state!=="error"&&(this.stateManager.scanningBehavior=(a=this.scanningBehaviorCache)!=null?a:"single",this.stateManager.holdingToScan=!1,await((e=this.sparkScanOverlay)==null?void 0:e.setShouldRemoveLocationsAfterScan(this.stateManager.continuousModeEnabled)),await this.switchToInactiveState({sessionStopReason:"user",barcodeFeedback:new b$1("",0,Color.fromRGBA(0,0,0,0),this.defaultErrorBrush,this.feedbackManager.noFeedback)}));}async onClickOutside(){this.stateManager.idleState||await this.switchToIdleState();}async onVisibilityChange(){await this.switchToIdleState();}async onTargetModeButtonTap(a,e=this.feedbackManager.tapFeedback,t=!0){var h,s,p;let i=String(a),r={true:a&&this.stateManager.scanningMode instanceof b$2,false:!a&&this.stateManager.scanningMode instanceof c$1}[i];r&&(this.stateManager.scanningMode=this.stateManager.scanningMode.changeMode()),this.enableTargetMode(a),await((h=this.sparkScanOverlay)==null?void 0:h.setShouldDrawViewfinder(a)),e.emit(),this.stateManager.state!=="idle"&&this.stateManager.state!=="error"&&(this.triggerButtonCollapseTimeout.start(),this.inactiveStateTimeout.start()),this.sparkScanView.targetModeButtonTapped(a,t),r&&((p=(s=this.listener)==null?void 0:s.didChangeScanningMode)==null||p.call(s,this.stateManager.scanningMode),this.analyticsManager.setScanningMode(this.stateManager.scanningMode));}async onScanningBehaviorButtonTap(a,e=this.feedbackManager.tapFeedback,t=!0){var i;e.emit(),this.stateManager.scanningMode=this.stateManager.scanningMode.copyWith(a?"continuous":"single"),await((i=this.sparkScanOverlay)==null?void 0:i.setShouldRemoveLocationsAfterScan(a)),this.stateManager.state!=="idle"&&this.stateManager.state!=="error"&&(this.triggerButtonCollapseTimeout.start(),this.inactiveStateTimeout.start()),this.sparkScanView.scanningBehaviorButtonTapped(a,t),this.analyticsManager.setScanningMode(this.stateManager.scanningMode);}async onBarcodeFindButtonTap(){var a,e;await this.switchToIdleState({sessionStopReason:"user"}),(e=(a=this.listener)==null?void 0:a.didTapBarcodeFindButton)==null||e.call(a,this.sparkScanView),this.restartTimeouts();}async onLabelCaptureButtonTap(){var a,e;await this.switchToIdleState({sessionStopReason:"user"}),(e=(a=this.listener)==null?void 0:a.didTapLabelCaptureButton)==null||e.call(a,this.sparkScanView),this.restartTimeouts();}async onCameraSwitchButtonTap(){if(this.feedbackManager.emitTapFeedback(),this.restartTimeouts(),!this.camera||this.stateManager.state==="error")return;let a={[CameraPosition.WorldFacing]:CameraPosition.UserFacing,[CameraPosition.UserFacing]:CameraPosition.WorldFacing}[this.camera.position],e=this.cameras.find(t=>t.position===a);e&&(await this.camera.switchToDesiredState(FrameSourceState.Off),await e.applySettings(this.camera.settings),await this.context.setFrameSource(e),await e.switchToDesiredState(FrameSourceState.On),this.sparkScanView.cameraSwitchButtonTapped(await e.isTorchAvailable(),a),this.analyticsManager.setCameraPosition(a),this.camera=e);}async onTorchButtonTap(a,e=this.feedbackManager.tapFeedback,t=!0){var i;e.emit(),this.stateManager.torchState=a?TorchState.On:TorchState.Off,((i=this.camera)==null?void 0:i.getCurrentState())===FrameSourceState.On&&await this.camera.setDesiredTorchState(this.stateManager.torchState),this.stateManager.state!=="idle"&&this.stateManager.state!=="error"&&(this.triggerButtonCollapseTimeout.start(),this.inactiveStateTimeout.start()),this.sparkScanView.torchButtonTapped(a,t),this.analyticsManager.setTorchState(this.stateManager.torchState);}restartTimeouts(){for(let a of [this.triggerButtonCollapseTimeout,this.inactiveStateTimeout,this.resumeCapturingTimeout])(a==null?void 0:a.running)===!0&&a.start();}async onMiniPreviewCloseButtonTap(){await this.switchToIdleState({sessionStopReason:"user"});}onMiniPreviewResizeButtonTap(){this.stateManager.state!=="idle"&&this.stateManager.state!=="error"&&(this.feedbackManager.emitTapFeedback(),this.triggerButtonCollapseTimeout.start(),this.inactiveStateTimeout.start());}async onMiniPreviewZoomButtonTap(a){this.feedbackManager.emitTapFeedback(),this.stateManager.zoomFactor=a,this.camera&&(this.camera.settings.zoomFactor=a,await this.camera.applySettings(this.camera.settings)),this.stateManager.state!=="idle"&&this.stateManager.state!=="error"&&(this.triggerButtonCollapseTimeout.start(),this.inactiveStateTimeout.start());}async onMiniPreviewDrag(a,e){switch(this.stateManager.state==="active"&&await this.sparkScan.setEnabled(!1),e){case"landscape-primary":case"landscape-secondary":{this.stateManager.landscapeOrientationMiniPreviewTranslateX=a.x,this.stateManager.landscapeOrientationMiniPreviewTranslateY=a.y;break}case"portrait-primary":case"portrait-secondary":{this.stateManager.portraitOrientationMiniPreviewTranslateX=a.x,this.stateManager.portraitOrientationMiniPreviewTranslateY=a.y;break}}this.restartTimeouts();}onMiniPreviewPointerMove(){this.restartTimeouts();}async onMiniPreviewPointerUp(){await this.switchToActiveState();}async onMiniPreviewDragEnd(){this.stateManager.state==="active"&&await this.sparkScan.setEnabled(!0);}onTriggerButtonDrag(a,e){switch(e){case"landscape-primary":case"landscape-secondary":{this.stateManager.landscapeOrientationTriggerButtonTranslateX=a.x,this.stateManager.landscapeOrientationTriggerButtonTranslateY=a.y;break}case"portrait-primary":case"portrait-secondary":{this.stateManager.portraitOrientationTriggerButtonTranslateX=a.x,this.stateManager.portraitOrientationTriggerButtonTranslateY=a.y;break}}}async onOrientationChange(){this.stateManager.state==="error"&&await this.switchToInactiveState({sessionStopReason:"user"});}async didScan(a,e){if(!e.newlyRecognizedBarcode)return;let t=this.sparkScanView.feedbackDelegate.getFeedbackForBarcode(e.newlyRecognizedBarcode);t instanceof b$1?await this.switchToErrorState({barcodeFeedback:t}):t instanceof c&&await(this.stateManager.continuousModeEnabled?this.switchToActiveState({barcodeFeedback:t}):this.switchToInactiveState({sessionStopReason:"user",barcodeFeedback:t,emitSuccessFeedback:!0})),this.restartTimeouts();}didChangeFrameSource(a,e){var t;if(isCameraFrameSource(e))this.camera=e;else {let i=(t=e==null?void 0:e.toJSONObject().type)!=null?t:"unknown";Logger.warn(`SparkScanView instances require a camera frame source to work, but a frame source of type "${i}" was found.`);}}setListener(a){this.listener=a;}brushForFeedback(a){return a.brush}async switchToIdleState(a={}){var e,t,i;this.feedbackManager.emitTapFeedback(),await((e=this.sparkScanOverlay)==null?void 0:e.overlayReadyForDraw()),this.setState("idle"),await this.sparkScan.setEnabled(!1),await((t=this.camera)==null?void 0:t.switchToDesiredState(FrameSourceState.Standby)),this.triggerButtonCollapseTimeout.stop(),this.inactiveStateTimeout.stop(),(i=this.resumeCapturingTimeout)==null||i.stop(),this.sparkScanView.switchToIdleState(),a.sessionStopReason!=null&&this.analyticsManager.setSessionStopReason(a.sessionStopReason);}async switchToActiveState(a={}){var t,i,r,o,h,s,p;let e=this.stateManager.state;await((t=this.camera)==null?void 0:t.switchToDesiredState(FrameSourceState.On)),await((i=this.camera)==null?void 0:i.setDesiredTorchState(this.stateManager.torchState)),a.barcodeFeedback&&await((r=this.sparkScanOverlay)==null?void 0:r.setBrush(this.brushForFeedback(a.barcodeFeedback))),await((o=this.sparkScanOverlay)==null?void 0:o.setShouldRemoveLocationsAfterScan(this.stateManager.continuousModeEnabled)),await((h=this.sparkScanOverlay)==null?void 0:h.overlayReadyForDraw()),this.feedbackManager.emitBarcodeFeedback(a.barcodeFeedback),this.stateManager.holdingToScan||this.inactiveStateTimeout.start(),this.triggerButtonCollapseTimeout.stop(),(s=this.resumeCapturingTimeout)==null||s.stop(),await this.sparkScanView.switchToActiveState(this.sparkScanViewSettings.visualFeedbackEnabled&&a.barcodeFeedback instanceof c,this.stateManager.scanningBehavior,(p=a.barcodeFeedback)==null?void 0:p.visualFeedbackColor,this.stateManager.zoomedIn&&e!=="active"),await this.sparkScan.setEnabled(!0),this.setState("active");}async switchToInactiveState(a){var t,i,r,o,h,s;(a.emitSuccessFeedback)!=null||(a.emitSuccessFeedback=!0),this.setState("inactive"),a.barcodeFeedback&&await((t=this.sparkScanOverlay)==null?void 0:t.setBrush(this.brushForFeedback(a.barcodeFeedback))),await this.sparkScan.setEnabled(!1),this.stateManager.scanningMode.previewBehavior==="persistent"?a.barcodeFeedback instanceof c&&await((i=this.sparkScanOverlay)==null?void 0:i.setShouldRemoveLocationsAfterScan(!0)):await((r=this.camera)==null?void 0:r.switchToDesiredState(FrameSourceState.Standby)),this.feedbackManager.emitBarcodeFeedback(a.barcodeFeedback),await((o=this.sparkScanOverlay)==null?void 0:o.overlayReadyForDraw()),this.triggerButtonCollapseTimeout.start(),this.inactiveStateTimeout.stop(),(h=this.resumeCapturingTimeout)==null||h.stop(),await this.sparkScanView.switchToInactiveState(this.sparkScanViewSettings.visualFeedbackEnabled&&a.barcodeFeedback instanceof c&&a.emitSuccessFeedback,this.stateManager.scanningBehavior,this.stateManager.previewBehavior,(s=a.barcodeFeedback)==null?void 0:s.visualFeedbackColor),this.analyticsManager.setSessionStopReason(a.sessionStopReason);}async switchToErrorState(a){var t,i,r,o;let e=a.barcodeFeedback.resumeCapturingDelay>0;e&&(this.setState("error"),this.stateManager.scanningBehavior="single",await this.sparkScan.setEnabled(!1),await((t=this.camera)==null?void 0:t.switchToDesiredState(FrameSourceState.Standby)),this.resumeCapturingTimeout=new Timeout(a.barcodeFeedback.resumeCapturingDelay,async()=>{this.stateManager.state!=="active"&&await this.switchToActiveState();}),this.resumeCapturingTimeout.start()),await((i=this.sparkScanOverlay)==null?void 0:i.setErrorBrush(a.barcodeFeedback.brush)),await((r=this.sparkScanOverlay)==null?void 0:r.overlayReadyForDraw()),await((o=this.sparkScanOverlay)==null?void 0:o.setShouldRemoveLocationsAfterScan(a.barcodeFeedback.resumeCapturingDelay===0)),await this.sparkScan.workerCommand("sparkScanEmitErrorFeedback",{shouldRemoveBrush:!e}),this.feedbackManager.emitBarcodeFeedback(a.barcodeFeedback),this.triggerButtonCollapseTimeout.stop(),this.inactiveStateTimeout.stop(),await this.sparkScanView.switchToErrorState(a.barcodeFeedback,this.sparkScanViewSettings.visualFeedbackEnabled);}enableTargetModeLocationSelection(a){var r;let e=a?b$3.SparkScan.SparkScanSettings.targetModeLocationSelection.radius:b$3.SparkScan.SparkScanSettings.locationSelection.radius,t=a?b$3.SparkScan.SparkScanSettings.targetModeLocationSelection.unit:b$3.SparkScan.SparkScanSettings.locationSelection.unit,i=new NumberWithUnit(e,t);this.sparkScan.settings.locationSelection=new RadiusLocationSelection(i),(r=this.sparkScanOverlay)==null||r.setRadius(i);}enableTargetMode(a){this.enableTargetModeLocationSelection(a);}async applyPreferences(){await this.onTargetModeButtonTap(this.stateManager.targetModeEnabled,this.feedbackManager.noFeedback,!1),await this.onScanningBehaviorButtonTap(this.stateManager.continuousModeEnabled,this.feedbackManager.noFeedback,!1),await this.onTorchButtonTap(this.stateManager.torchEnabled,this.feedbackManager.noFeedback,!1);}setState(a){var e,t;a!==this.stateManager.state&&(this.stateManager.state=a,(t=(e=this.listener)==null?void 0:e.didChangeViewState)==null||t.call(e,a));}};export{P as a};
@@ -1,4 +1,4 @@
1
- import {a as a$7}from'./chunk-5GGUCEGU.js';import {b}from'./chunk-XY65BTLP.js';import {b as b$1}from'./chunk-DFIOIHPG.js';import {a}from'./chunk-WRTJHOS5.js';import {a as a$6}from'./chunk-QJOHE5A3.js';import {a as a$8}from'./chunk-7J6MRLL2.js';import {a as a$2}from'./chunk-YH5IBNOK.js';import {a as a$5}from'./chunk-POONUNDO.js';import {b as b$2}from'./chunk-IC4MKVBG.js';import {a as a$1}from'./chunk-JKO4EZPZ.js';import {a as a$3}from'./chunk-I53W7VSB.js';import {a as a$4}from'./chunk-5KVH2XIO.js';import {b as b$3}from'./chunk-2RKBANN2.js';import {Anchor,Localization,DataCaptureView,Size,Point}from'@scandit/web-datacapture-core';import {ShutterButton}from'@scandit/web-datacapture-core/build/js/private/ui/atoms/ShutterButton.js';import {ScanditHTMLElement}from'@scandit/web-datacapture-core/build/js/private/utils/ScanditHTMLElement.js';import {defineCustomElements}from'@scandit/web-datacapture-core/build/js/private/utils/defineCustomElements.js';import {html}from'@scandit/web-datacapture-core/build/js/private/utils/html.js';var d={FinishButton:a$2.tag,ShutterButton:ShutterButton.tag,ProgressBarWithLabel:a.tag,CardListContainer:b$1.tag,TorchIconButton:a$1.tag},c=class c extends ScanditHTMLElement{constructor(){super(...arguments);this.shouldShowCarousel=!0;this.shouldShowPauseButton=!0;this.shouldShowFinishButton=!0;this.shouldShowProgressBar=!0;this.shouldShowTorchControl=!1;this.torchControlPosition=Anchor.TopLeft;this.textForItemListUpdatedWhenPausedHint=null;this.textForItemListUpdatedHint=null;this.textForTapShutterToResumeSearchHint=null;this.textForTapShutterToPauseScreenHint=null;this.textForMoveCloserToBarcodesHint=null;this.textForPointAtBarcodesToSearchHint=null;this.textForAllItemsFoundSuccessfullyHint=null;this.textForCollapseCardsButton=Localization.getInstance().get("barcode.find.view.textForCollapseCardsButton");this.barcodeFindViewUiListener=null;this.shutterButton=null;this.finishButton=null;this.progressBar=null;this.cardList=null;this.onShutterButtonClickedHandler=this.onShutterButtonClicked.bind(this);this.onFinishButtonClickedHandler=this.onFinishButtonClicked.bind(this);this.onTorchButtonClickedHandler=this.onTorchButtonClicked.bind(this);this.torchIconButton=null;this.onDotClickHandler=this.onDotClick.bind(this);}get camera(){return this.presenter.context.frameSource}static async createWithSettings(t,o,i,s,r){let e=document.createElement(c.tag);return e.barcodeFindViewSettings=s,e.layout=b.create(),e.layout.innerHTML=html`
1
+ import {b}from'./chunk-XY65BTLP.js';import {a as a$8}from'./chunk-7J6MRLL2.js';import {a as a$2}from'./chunk-YH5IBNOK.js';import {a as a$7}from'./chunk-5GGUCEGU.js';import {b as b$1}from'./chunk-DFIOIHPG.js';import {a}from'./chunk-WRTJHOS5.js';import {a as a$6}from'./chunk-QJOHE5A3.js';import {a as a$1}from'./chunk-JKO4EZPZ.js';import {a as a$3}from'./chunk-I53W7VSB.js';import {a as a$4}from'./chunk-TQ3DI76M.js';import {a as a$5}from'./chunk-POONUNDO.js';import {b as b$2}from'./chunk-IC4MKVBG.js';import {b as b$3}from'./chunk-2RKBANN2.js';import {Anchor,Localization,DataCaptureView,Size,Point}from'@scandit/web-datacapture-core';import {ShutterButton}from'@scandit/web-datacapture-core/build/js/private/ui/atoms/ShutterButton.js';import {ScanditHTMLElement}from'@scandit/web-datacapture-core/build/js/private/utils/ScanditHTMLElement.js';import {defineCustomElements}from'@scandit/web-datacapture-core/build/js/private/utils/defineCustomElements.js';import {html}from'@scandit/web-datacapture-core/build/js/private/utils/html.js';var d={FinishButton:a$2.tag,ShutterButton:ShutterButton.tag,ProgressBarWithLabel:a.tag,CardListContainer:b$1.tag,TorchIconButton:a$1.tag},c=class c extends ScanditHTMLElement{constructor(){super(...arguments);this.shouldShowCarousel=!0;this.shouldShowPauseButton=!0;this.shouldShowFinishButton=!0;this.shouldShowProgressBar=!0;this.shouldShowTorchControl=!1;this.torchControlPosition=Anchor.TopLeft;this.textForItemListUpdatedWhenPausedHint=null;this.textForItemListUpdatedHint=null;this.textForTapShutterToResumeSearchHint=null;this.textForTapShutterToPauseScreenHint=null;this.textForMoveCloserToBarcodesHint=null;this.textForPointAtBarcodesToSearchHint=null;this.textForAllItemsFoundSuccessfullyHint=null;this.textForCollapseCardsButton=Localization.getInstance().get("barcode.find.view.textForCollapseCardsButton");this.barcodeFindViewUiListener=null;this.shutterButton=null;this.finishButton=null;this.progressBar=null;this.cardList=null;this.onShutterButtonClickedHandler=this.onShutterButtonClicked.bind(this);this.onFinishButtonClickedHandler=this.onFinishButtonClicked.bind(this);this.onTorchButtonClickedHandler=this.onTorchButtonClicked.bind(this);this.torchIconButton=null;this.onDotClickHandler=this.onDotClick.bind(this);}get camera(){return this.presenter.context.frameSource}static async createWithSettings(t,o,i,s,r){let e=document.createElement(c.tag);return e.barcodeFindViewSettings=s,e.layout=b.create(),e.layout.innerHTML=html`
2
2
  <${a.tag} slot="progress" value="0" max="1" ${e.shouldShowProgressBar?"":"hidden"}></${a.tag}>
3
3
  <${a$1.tag} slot="top-controls-left" ${e.shouldShowTorchControl?"":"hidden"}></${a$1.tag}>
4
4
  <${b$1.tag} slot="card-list" hidden text-for-collapse-cards-button=${e.textForCollapseCardsButton}></${b$1.tag}>
@@ -0,0 +1,211 @@
1
+ import {a as a$4}from'./chunk-YQNNEW67.js';import {a as a$6,b as b$3}from'./chunk-RWDAYBTQ.js';import {b}from'./chunk-5DP5VNWQ.js';import {a as a$5,b as b$2}from'./chunk-OPL5NVVM.js';import {g as g$2}from'./chunk-3A6GSH7S.js';import {g as g$1}from'./chunk-DVHTYKDX.js';import {a as a$2}from'./chunk-DOA2Q3CZ.js';import {j,i,f,a,g,n}from'./chunk-4JEIREAU.js';import {a as a$3}from'./chunk-XSJEGOGN.js';import {b as b$1,a as a$1,e,c}from'./chunk-YBD5JYCX.js';import {Point}from'@scandit/web-datacapture-core';import {ScanditHTMLElement,defineCustomElements,html,Timeout}from'@scandit/web-datacapture-core/build/js/private/utils/index.js';var H=(i=>(i.ResizeButton="resizeButton",i.ZoomButton="zoomButton",i.TorchButton="torchButton",i.CloseButton="closeButton",i))(H||{}),I=1200,w=class w extends ScanditHTMLElement{constructor(){super(...arguments);this.resizeButtonTapListener=this.onResizeButtonTap.bind(this);this.zoomButtonTapListener=this.onZoomButtonTap.bind(this);this.torchButtonTapListener=this.onTorchButtonTap.bind(this);this.closeButtonTapListener=this.onCloseButtonTap.bind(this);this.pointerDownListener=this.onPointerDown.bind(this);this.longPressStartListener=this.onLongPressStart.bind(this);this.toolbarVisibilityChangeListener=this.onToolbarVisibilityChange.bind(this);this.longPressEndListener=this.onLongPressEnd.bind(this);this.dragEndListener=this.onDragEnd.bind(this);this.fadeOutAnimation=new Animation(new KeyframeEffect(this,[{opacity:1},{opacity:0}],{duration:500,fill:"both"}));this.replayFadeOutTimeout=null;this.longPressController=new b(this);}get visible(){return this.hasAttribute("visible")}set visible(t){this.toggleAttribute("visible",t);}get size(){return this.expanded?"expanded":"regular"}set size(t){var i;this.toggleAttribute("expanded",t==="expanded");let o=this.getNextTranslate();(i=this.dragController)==null||i.translateTo(o,!1).then(async()=>{var n;return (n=this.dragController)==null?void 0:n.repositionIfOutOfBounds()});}get expanded(){return this.hasAttribute("expanded")}get[a](){var t;return Number((t=this.getAttribute(a))!=null?t:"1")}set[a](t){this.setAttribute(a,String(t));}get darkened(){return this.hasAttribute("darkened")}set darkened(t){this.toggleAttribute("darkened",t);}get orientation(){var t;return (t=this.getAttribute("orientation"))!=null?t:"portrait-primary"}set orientation(t){this.setAttribute("orientation",t);}get[g](){return this.hasAttribute(g)}set[g](t){this.toggleAttribute(g,t);}get[j](){return this.hasAttribute(j)}set[j](t){this.toggleAttribute(j,t);}get[i](){return this.hasAttribute(i)}set[i](t){this.toggleAttribute(i,t);}get[f](){return this.hasAttribute(f)}set[f](t){this.toggleAttribute(f,t);}get[n](){return this.hasAttribute(n)}set[n](t){this.toggleAttribute(n,t);}get cover(){return this.hasAttribute("cover")}set cover(t){this.toggleAttribute("cover",t);}get pressed(){return this.hasAttribute("pressed")}set pressed(t){this.toggleAttribute("pressed",t);}static create(){return defineCustomElements({[b$1]:w,[a$1]:a$2,[e]:a$3,[c]:a$4}),document.createElement(b$1)}repositionIfOutOfBounds(){var t;(t=this.dragController)==null||t.repositionIfOutOfBounds();}showToast(t,o,i){this.toast.show(t,o,i);}hideToast(){this.toast.hide();}zoomIn(){this.zoomButton&&(this[a]=2,this.zoomButton.textContent="2x",this.showToast("warning","2x zoom",1e3));}zoomOut(){this.zoomButton&&(this[a]=1,this.zoomButton.textContent="1x",this.showToast("info","1x zoom",1e3));}async fadeOut(){try{this.fadeOutAnimation.play(),await this.fadeOutAnimation.finished,this.visible=!1;}catch(t){}}cancelFadeOut(){var t;(t=this.replayFadeOutTimeout)==null||t.stop(),this.fadeOutAnimation.cancel();}async rewindAnimation(){var t,o;(((t=this.replayFadeOutTimeout)==null?void 0:t.running)===!0||this.fadeOutAnimation.playState!=="idle")&&(this.cancelFadeOut(),(o=this.replayFadeOutTimeout)==null||o.start());}translateTo(t){var o;(o=this.dragController)==null||o.translateTo(t,!1);}render(){var t,o,i$1,n$1,a$1,l,b;this.innerHTML=html`
2
+ <spark-scan-view-toast></spark-scan-view-toast>
3
+ <div id="host"></div>
4
+ <div id="controls">
5
+ <div id="button-container-list">
6
+ <div class="button-container">
7
+ <button id="torchButton" class="${b$1}__button">
8
+ <spark-scan-view-icon icon="torchOff" fill="white" size="9"></spark-scan-view-icon>
9
+ </button>
10
+ <button id="closeButton" class="${b$1}__button">
11
+ <spark-scan-view-icon icon="close" fill="white" size="9"></spark-scan-view-icon>
12
+ </button>
13
+ </div>
14
+ <div class="button-container">
15
+ <button id="resizeButton" class="${b$1}__button">
16
+ <spark-scan-view-icon icon="expand" fill="white" size="14"></spark-scan-view-icon>
17
+ </button>
18
+ <button id="zoomButton" class="${b$1}__button">
19
+ ${this[a]}x
20
+ </button>
21
+ </div>
22
+ </div>
23
+ </div>
24
+ <spark-scan-view-toolbar></spark-scan-view-toolbar>
25
+ <div id="overlay"></div>
26
+
27
+ <style>
28
+ ${b$1} {
29
+ position: absolute;
30
+ top: 0;
31
+ left: 0;
32
+ display: none;
33
+ background: var(${g$1});
34
+ border-radius: 16px;
35
+ filter: drop-shadow(0px 2px 6px #${a$5.toJSON()})
36
+ drop-shadow(0px 1px 2px #${b$2.toJSON()});
37
+ transition: filter 0.3s ease;
38
+ z-index: 100;
39
+ }
40
+
41
+ ${b$1},
42
+ ${b$1} #overlay {
43
+ width: var(--dvw-half);
44
+ height: var(--dvw-half);
45
+ min-width: 192px;
46
+ min-height: 192px;
47
+ max-width: min(250px, var(--dvw-half));
48
+ max-height: min(250px, var(--dvw-half));
49
+ }
50
+
51
+ @media (orientation: landscape) {
52
+ ${b$1},
53
+ ${b$1} #overlay {
54
+ width: var(--dvh-half);
55
+ height: var(--dvh-half);
56
+ max-width: min(250px, var(--dvh-half));
57
+ max-height: min(250px, var(--dvh-half));
58
+ }
59
+ }
60
+
61
+ @media screen (min-width: 768px) and (orientation: portrait) {
62
+ ${b$1},
63
+ ${b$1} #overlay {
64
+ max-width: min(375px, var(--dvw-half));
65
+ max-height: min(375px, var(--dvw-half));
66
+ }
67
+ }
68
+
69
+ @media screen (min-width: 768px) and (orientation: landscape) {
70
+ ${b$1},
71
+ ${b$1} #overlay {
72
+ max-width: min(375px, var(--dvh-half));
73
+ max-height: min(375px, var(--dvh-half));
74
+ }
75
+ }
76
+
77
+ ${b$1}[visible] {
78
+ display: flex;
79
+ flex-flow: column;
80
+ }
81
+
82
+ ${b$1}[expanded],
83
+ ${b$1}[expanded] #overlay {
84
+ width: calc(var(--dvw) - ${32}px);
85
+ height: calc(var(--dvh-half) - ${32}px);
86
+ max-width: min(400px, calc(var(--dvw) - ${32}px));
87
+ max-height: min(400px, calc(var(--dvh-half) - ${32}px));
88
+ }
89
+
90
+ ${b$1}[pressed] {
91
+ filter: drop-shadow(0px 4px 4px #${b$2.toJSON()})
92
+ drop-shadow(0px 8px 12px #${a$5.toJSON()});
93
+ }
94
+
95
+ @media (orientation: landscape) {
96
+ ${b$1}[expanded],
97
+ ${b$1}[expanded] #overlay {
98
+ width: calc(var(--dvh-half) - ${32}px);
99
+ height: calc(var(--dvh) - ${32}px);
100
+ max-width: min(400px, calc(var(--dvh-half) - ${32}px));
101
+ max-height: min(400px, calc(var(--dvh) - ${32}px));
102
+ }
103
+ }
104
+
105
+ spark-scan-view-toast {
106
+ position: absolute;
107
+ top: 16px;
108
+ left: 50%;
109
+ transform: translateX(-50%);
110
+ z-index: 20;
111
+ }
112
+
113
+ ${b$1} #host,
114
+ ${b$1} #host * {
115
+ width: 100%;
116
+ border-radius: 16px;
117
+ }
118
+
119
+ ${b$1} #host {
120
+ height: calc(100% - 48px);
121
+ z-index: -10;
122
+ }
123
+
124
+ ${b$1}[cover] #host {
125
+ height: 100%;
126
+ }
127
+
128
+ ${b$1} #controls {
129
+ position: absolute;
130
+ top: 0;
131
+ width: 100%;
132
+ height: 100%;
133
+ display: grid;
134
+ grid-template-rows: auto max-content;
135
+ box-sizing: border-box;
136
+ }
137
+
138
+ ${b$1} #button-container-list {
139
+ width: 100%;
140
+ height: calc(100% - 48px);
141
+ display: flex;
142
+ flex-flow: column;
143
+ justify-content: space-between;
144
+ }
145
+
146
+ ${b$1}[cover] #button-container-list {
147
+ height: 100%;
148
+ }
149
+
150
+ ${b$1} .button-container {
151
+ padding: 12px;
152
+ display: flex;
153
+ justify-content: flex-end;
154
+ align-items: center;
155
+ }
156
+
157
+ ${b$1}[${f}] .button-container:first-of-type,
158
+ ${b$1}[${j}] .button-container:nth-of-type(2) {
159
+ justify-content: space-between;
160
+ }
161
+
162
+ .${b$1}__button {
163
+ display: flex;
164
+ justify-content: center;
165
+ align-items: center;
166
+ width: 24px;
167
+ height: 24px;
168
+ border: none;
169
+ background: rgba(18, 22, 25, 0.5);
170
+ color: white;
171
+ font-family: Arial, Helvetica, sans-serif;
172
+ font-size: 14px;
173
+ font-weight: 500;
174
+ border-radius: 50%;
175
+ }
176
+
177
+ ${b$1} #torchButton,
178
+ ${b$1} #closeButton,
179
+ ${b$1} #resizeButton,
180
+ ${b$1} #zoomButton {
181
+ display: none;
182
+ }
183
+
184
+ ${b$1}[${f}] #torchButton,
185
+ ${b$1}[${j}] #resizeButton {
186
+ display: flex;
187
+ }
188
+
189
+ ${b$1}[${n}] #closeButton,
190
+ ${b$1}[${i}] #zoomButton {
191
+ display: flex;
192
+ align-self: end;
193
+ }
194
+
195
+ ${b$1} #overlay {
196
+ position: absolute;
197
+ z-index: 10;
198
+ top: 0;
199
+ left: 0;
200
+ background: black;
201
+ border-radius: 16px;
202
+ opacity: 0;
203
+ transition: opacity 0.3s ease;
204
+ pointer-events: none;
205
+ }
206
+
207
+ ${b$1}[darkened] #overlay {
208
+ opacity: 0.3;
209
+ }
210
+ </style>
211
+ `,this.toast=this.querySelector("spark-scan-view-toast"),this.host=this.querySelector("#host"),this.resizeButton=this.querySelector("#resizeButton"),(t=this.resizeButton)==null||t.addEventListener("pointerup",this.resizeButtonTapListener),this.resizeButtonIcon=(o=this.resizeButton)==null?void 0:o.querySelector("spark-scan-view-icon"),this.zoomButton=this.querySelector("#zoomButton"),(i$1=this.zoomButton)==null||i$1.addEventListener("pointerup",this.zoomButtonTapListener),this.torchButton=this.querySelector("#torchButton"),(n$1=this.torchButton)==null||n$1.addEventListener("pointerup",this.torchButtonTapListener),this.torchButtonIcon=(a$1=this.torchButton)==null?void 0:a$1.querySelector("spark-scan-view-icon"),this.closeButton=this.querySelector("#closeButton"),(l=this.closeButton)==null||l.addEventListener("pointerup",this.closeButtonTapListener),this.toolbar=this.querySelector(c),(b=this.toolbar)==null||b.addEventListener("toolbarvisibilitychange",this.toolbarVisibilityChangeListener),this.buttonContainerList=this.querySelector("#button-container-list");}onResizeButtonTap(t){t.stopPropagation(),this.size={regular:"expanded",expanded:"regular"}[this.size],this.resizeButtonIcon&&(this.resizeButtonIcon.icon=this.expanded?"shrink":"expand"),this.dispatchEvent(new CustomEvent(g$2,{detail:{tapped:"resizeButton",expanded:this.expanded}}));}onZoomButtonTap(t){switch(t.stopPropagation(),this[a]){case 1:{this.zoomIn();break}case 2:{this.zoomOut();break}}this.dispatchEvent(new CustomEvent(g$2,{detail:{tapped:"zoomButton",zoomFactor:this[a]}}));}onTorchButtonTap(t){t.stopPropagation(),this[g]=!this[g],this.torchButtonIcon&&(this.torchButtonIcon.icon=this[g]?"torchOn":"torchOff"),this.dispatchEvent(new CustomEvent(g$2,{detail:{tapped:"torchButton",enabled:this[g]}}));}onCloseButtonTap(t){t.stopPropagation(),this.dispatchEvent(new CustomEvent(g$2,{detail:{tapped:"closeButton"}}));}onPointerDown(){this.dragController&&(this.dragController.draggable=!1),this.rewindAnimation();}onLongPressStart(){this.dragController&&(this.dragController.draggable=!0),this.pressed=!0;}onLongPressEnd(){this.pressed=!1;}onDragEnd(t){t instanceof a$6&&(this.lastKnownTranslate=t.point);}onToolbarVisibilityChange(){this.cover=!this.toolbar||this.toolbar.hidden;}connectedCallback(){var t,o;this.rootElement=(t=this.parentElement)==null?void 0:t.parentElement,this.dragController=new b$3(this,this.rootElement),this.replayFadeOutTimeout=new Timeout(I,async()=>{await this.fadeOut();}),this.render(),this.addEventListener("pointerdown",this.pointerDownListener),this.addEventListener("longpressstart",this.longPressStartListener),this.addEventListener("longpressend",this.longPressEndListener),this.addEventListener("dragend",this.dragEndListener),this.dragController.connect(),this.longPressController.connect(),this.buttonContainerList&&((o=this.toolbar)!=null&&o.firstElementChild)&&(this.longPressController.elementsAllowedToTriggerLongPressEvents.add(this.buttonContainerList),this.longPressController.elementsAllowedToTriggerLongPressEvents.add(this.toolbar.firstElementChild)),this.dragController.margin=new Point(16,16);}disconnectedCallback(){var t,o,i,n,a,l,b;(t=this.resizeButton)==null||t.removeEventListener("pointerup",this.resizeButtonTapListener),(o=this.zoomButton)==null||o.removeEventListener("pointerup",this.zoomButtonTapListener),(i=this.torchButton)==null||i.removeEventListener("pointerup",this.torchButtonTapListener),(n=this.closeButton)==null||n.removeEventListener("pointerup",this.closeButtonTapListener),(a=this.toolbar)==null||a.removeEventListener("toolbarvisibilitychange",this.toolbarVisibilityChangeListener),this.removeEventListener("pointerdown",this.pointerDownListener),this.removeEventListener("longpressstart",this.longPressStartListener),this.removeEventListener("longpressend",this.longPressEndListener),this.removeEventListener("dragend",this.dragEndListener),this.fadeOutAnimation.cancel(),(l=this.replayFadeOutTimeout)==null||l.stop(),(b=this.dragController)==null||b.disconnect(),this.longPressController.disconnect();}getNextTranslate(){var n,a,l;let t=((n=this.rootElement)==null?void 0:n.clientWidth)||document.body.clientWidth,o=((a=this.rootElement)==null?void 0:a.clientHeight)||document.body.clientHeight;if(!this.dragController)return new Point(0,0);if(this.size==="regular")return (l=this.lastKnownTranslate)!=null?l:this.dragController.translate;this.lastKnownTranslate=this.dragController.translate;let i=this.dragController.translate;return (this.orientation==="portrait-primary"||this.orientation==="portrait-secondary")&&this.dragController.translate.x>16&&(i=new Point(16,i.y)),(this.orientation==="landscape-primary"||this.orientation==="landscape-secondary")&&this.dragController.translate.x>t-this.clientWidth-16&&(i=new Point(t-this.clientWidth-16,i.y)),this.dragController.translate.y>o-this.clientHeight-16&&(i=new Point(i.x,o-this.clientHeight-16)),i}};w.observedAttributes=[j,i,f];var P=w;export{H as a,P as b};
@@ -1,2 +1,2 @@
1
- import {DataCaptureLoader,Logger}from'@scandit/web-datacapture-core';function n(r){let s=URL.createObjectURL(new Blob(['"use strict";(()=>{var p={"scandit-datacapture-sdk-barcode-pthreads.wasm":{bytes:6908597},"scandit-datacapture-sdk-barcode-simd-pthreads.wasm":{bytes:6824681},"scandit-datacapture-sdk-barcode.wasm":{bytes:6788817},"scandit-datacapture-sdk-barcode-simd.wasm":{bytes:6704430}};function M(t){return typeof t=="object"&&t!=null}function F(t){if(typeof t=="string")return t;if(M(t)){if(typeof t.message=="string")return t.message}else if(typeof t?.toString=="function")return t.toString();return"unknown error"}var l;(t=>{(d=>(d.Debug="debug",d.Info="info",d.Warn="warn",d.Error="error",d.Quiet="quiet"))(t.Level||(t.Level={}));let e=new Map([["debug",1],["info",2],["warn",3],["error",4],["quiet",5]]),a="debug";function r(d){a=d}t.setLevel=r;function i(d,...h){if(!(e.get(a)>e.get(d)))switch(d){case"debug":{console.debug(...h);break}case"info":{console.log(...h);break}case"warn":{console.warn(...h);break}case"error":{console.error(...h);break}}}t.log=i;function s(...d){i("warn",...d)}t.warn=s;function n(...d){i("debug",...d)}t.debug=n;function o(...d){i("info",...d)}t.info=o;function c(...d){i("error",...d)}t.error=c})(l||(l={}));var P=class ae extends Error{constructor(e){super(e.message),Object.setPrototypeOf(this,ae.prototype),this.name=e.name}toString(){return`${this.name}: ${this.message}`}};var I=Promise.resolve(),G=!1,$=!1,k,j={writableDataPath:""};async function re(t){if(k==null)return;G=!0;let e=new Promise((a,r)=>{setTimeout(()=>{r(new P({name:"BlockedIndexedDB",message:"IndexedDB database is blocked"}))},1500)});try{await Promise.race([new Promise((a,r)=>{k?.(t,i=>{if(i!=null){r(i);return}a()})}),e])}finally{G=!1}}async function ie(t){return $||(G?($=!0,I=I.then(async()=>($=!1,re(t)))):I=re(t)),I}async function se(t){j=t,k=FS.syncfs,FS.syncfs=(e,a)=>{let r=a,i=()=>{r()},s=n=>{r(n)};ie(e).then(i).catch(s)};try{FS.mkdir(j.writableDataPath)}catch(e){if(e.code!=="EEXIST")throw k=void 0,e}return FS.mount(IDBFS,{},j.writableDataPath),ie(!0)}var q=(t,e)=>(e=Symbol[t])?e:Symbol.for("Symbol."+t);var K=function(t,e){this[0]=t,this[1]=e},ne=(t,e,a)=>{var r=(n,o,c,d)=>{try{var h=a[n](o),g=(o=h.value)instanceof K,m=h.done;Promise.resolve(g?o[0]:o).then(b=>g?r(n==="return"?n:"next",o[1]?{done:b.done,value:b.value}:b,c,d):c({value:b,done:m})).catch(b=>r("throw",b,c,d))}catch(b){d(b)}},i=n=>s[n]=o=>new Promise((c,d)=>r(n,o,c,d)),s={};return a=a.apply(t,e),s[q("asyncIterator")]=()=>s,i("next"),i("throw"),i("return"),s},oe=(t,e,a)=>(e=t[q("asyncIterator")])?e.call(t):(t=t[q("iterator")](),e={},a=(r,i)=>(i=t[r])&&(e[r]=s=>new Promise((n,o,c)=>(s=i.call(t,s),c=s.done,Promise.resolve(s.value).then(d=>n({value:d,done:c}),o)))),a("next"),a("return"),e);var de={};function Le(t){return[...new Uint8Array(t)].map(e=>{let a=e.toString(16);return a.length===1?`0${a}`:a}).join("")}function Te(t){return ne(this,null,function*(){let e=t.getReader();try{for(;;){let{done:a,value:r}=yield new K(e.read());if(a)return;yield r}}finally{e.releaseLock()}})}async function We(t){let e=[],a=0,r=0;try{for(var i=oe(Te(t)),s,n,o;s=!(n=await i.next()).done;s=!1){let d=n.value;e.push(d),a+=d.length}}catch(d){o=[d]}finally{try{s&&(n=i.return)&&await n.call(i)}finally{if(o)throw o[0]}}let c=new Uint8Array(a);for(let d of e)c.set(d,r),r+=d.length;return c.buffer}var Ee=(t=>(t.VALID="VALID",t.INVALID="INVALID",t.NOT_VERIFIABLE="NOT_VERIFIABLE",t))(Ee||{});async function Ae(t,e,a){if(typeof crypto.subtle.digest!="function")return l.log(l.Level.Warn,`Insecure context (see https://developer.mozilla.org/en-US/docs/Web/Security/Secure_Contexts): The hash of the Scandit Data Capture library WASM file found at ${a} could not be verified`),"NOT_VERIFIABLE";try{let r=t instanceof Promise?await t:t,i=await crypto.subtle.digest("SHA-256",r),s=Le(i);return e==null?(l.log(l.Level.Warn,"The library hash is not defined or empty, cannot correctly verify integrity."),"NOT_VERIFIABLE"):s===e?(l.log(l.Level.Debug,`Data Capture library WASM integrity found at ${a} has been verified correctly.`),"VALID"):(l.log(l.Level.Warn,`The Scandit Data Capture library WASM file found at ${a} seems invalid: expected file hash doesn\'t match (received: ${s}, expected: ${e}). Please ensure the correct Scandit Data Capture file (with correct version) is retrieved.`),"INVALID")}catch(r){return l.log(l.Level.Warn,"Wasm response could not be verified",r),"NOT_VERIFIABLE"}}var X=new Map([["br",4.4],["gzip",2.9],["none",1]]);function Re(t){var e;let a="content-encoding";if(t==null||t.get(a)==null)return X.get("none");let r=new Set(((e=t.get(a))!=null?e:"").split(",").map(i=>i.trim()));for(let[i,s]of X)if(r.has(i))return s;return X.get("none")}function Ne(t){var e,a;if(t==null)return 0;let r=(e=Re(t))!=null?e:1,i=Number.parseInt((a=t.get("content-length"))!=null?a:"0",10);return Number.isNaN(i)?0:Math.floor(i*r*100)/100}function He(t){let{pathname:e}=new URL(t);for(let[a,r]of Object.entries(de))if(e.endsWith(a))return r.bytes;return 0}function ce(t){de=t}var _e=(t,e)=>{let a=Ne(e);return a===0?He(t):a};function ze(t,e,a,{onProgress:r,onError:i,onComplete:s}){if(!e.body)return[e];let n=_e(t,e.headers),o=0,c=0,[d,h]=a?e.body.tee():[e.body],g=d.pipeThrough(new TransformStream({async transform(m,b){try{o+=m.length,c=Number((o/n*100).toFixed(2)),n>0&&m.length>0&&c<100?r?.({percentage:c,loadedBytes:o,privateUri:t}):n===0&&m.length>0&&r?.({percentage:null,loadedBytes:o,privateUri:t}),b.enqueue(m)}catch(v){b.error(v),i?.({error:v})}},flush(m){r?.({percentage:100,loadedBytes:o,privateUri:t}),s?.({percentage:100,loadedBytes:o,privateUri:t}),m.terminate()}}));return[new Response(g,{headers:new Headers(e.headers),status:e.status,statusText:e.statusText}),h]}async function Y({wasmURI:t,expectedHash:e,verifyResponseHash:a,onProgress:r,onComplete:i,onError:s,referredOrigin:n}){let o=await fetch(t,{referrerPolicy:"origin",referrer:n??""});if(!o.ok)throw new Error(`HTTP status code is not ok: ${o.status}, ${o.statusText}`);let[c,d]=ze(t,o,a,{onProgress:r,onError:s,onComplete:i});return d!=null&&Ae(We(d),e,t),c}function le({wasmURI:t,expectedHash:e,verifyResponseHash:a,progressCallback:r,successCallback:i,importObject:s,referredOrigin:n}){async function o(d){try{let h=await Y({wasmURI:t,expectedHash:e,verifyResponseHash:a,onProgress:r,referredOrigin:n}),g=await(d??h).arrayBuffer(),m=await globalThis.WebAssembly.instantiate(g,s);i(m.instance,m.module)}catch(h){l.log(l.Level.Error,h),l.log(l.Level.Error,`Couldn\'t instantiate Scandit SDK DataCapture library at ${t}, did you configure the path for it correctly?`)}}async function c(){let d;try{d=await Y({wasmURI:t,expectedHash:e,verifyResponseHash:a,onProgress:r,referredOrigin:n});let h=await globalThis.WebAssembly.instantiateStreaming(d,s);i(h.instance,h.module)}catch(h){l.log(l.Level.Warn,h),l.log(l.Level.Warn,"WebAssembly streaming compile failed. Falling back to ArrayBuffer instantiation (this will make things slower)"),o(d?.bodyUsed===!0?void 0:d)}}typeof globalThis.WebAssembly.instantiateStreaming=="function"?c():o()}async function Z(t,e,a,r){return new Promise((i,s)=>{t().then(i).catch(n=>{let o=e*2;if(o>a){s(n);return}r(n),globalThis.setTimeout(()=>{Z(t,o,a,r).then(i).catch(s)},e)})})}function Q(t){var e,a;let r="";if((e=t.href)!=null&&e.startsWith("blob:null/"))r="localhost";else{let i=((a=t.pathname)==null?void 0:a.length)>1&&!t.pathname.startsWith("/");r=new URL(i?t.pathname:t.origin).hostname}return r.startsWith("[")&&r.endsWith("]")&&(r=r.slice(1,-1)),r}async function ue(t,e){async function a(){return importScripts(t)}try{await Z(a,250,4e3,i=>{l.log(l.Level.Warn,i),l.log(l.Level.Warn,`Couldn\'t retrieve Scandit Data Capture library at ${t}, retrying...`)}),self.Module.mainScriptUrlOrBlob=t;let r=globalThis.SDC_WASM_JS_VERSION;return r!==e&&l.log(l.Level.Warn,`The Scandit Data Capture library JS file found at ${t} seems invalid: expected version doesn\'t match (received: ${r}, expected: ${e}). Please ensure the correct Scandit Data Capture file (with correct version) is retrieved.`),!0}catch(r){return l.log(l.Level.Error,r),!1}}function Ve(t){return/^https?:\\/\\/(?:[^./]*\\.)*cdn.jsdelivr.net\\//.test(t)?{result:!0,cdnBaseURL:"https://cdn.jsdelivr.net/npm/"}:/^https?:\\/\\/(?:[^./]*\\.)*unpkg.com\\//.test(t)?{result:!0,cdnBaseURL:"https://unpkg.com/"}:{result:!1,cdnBaseURL:""}}function Je(t){let e=/@scandit\\/web-datacapture-[a-z]+/i.exec(t);return e?e[0]:null}function pe(t,e,a){let r=e,i=Ve(r);if(i.result){let n=Je(r);n!=null&&(r=`${i.cdnBaseURL}${n}@${t}/sdc-lib/`)}let s=a.replace(".wasm","");return i.result?{jsURI:`${r}${s}.js`,wasmURI:`${r}${s}.wasm`}:{jsURI:`${r}${s}.js?v=${t}`,wasmURI:`${r}${s}.wasm?v=${t}`}}var L;(t=>{function e(){return"7.2.0"}t.sdkVersion=e})(L||(L={}));var he=class{constructor(){this.promise=new Promise((t,e)=>{this.reject=e,this.resolve=t})}};var Ue=async()=>WebAssembly.validate(new Uint8Array([0,97,115,109,1,0,0,0,1,5,1,96,0,1,123,3,2,1,0,10,10,1,8,0,65,0,253,15,253,98,11])),$e=()=>(async t=>{try{return typeof MessageChannel<"u"&&new MessageChannel().port1.postMessage(new SharedArrayBuffer(1)),WebAssembly.validate(t)}catch{return!1}})(new Uint8Array([0,97,115,109,1,0,0,0,1,4,1,96,0,0,3,2,1,0,5,4,1,3,1,1,10,11,1,9,0,65,0,254,16,2,0,26,11]));function je(){return typeof crossOriginIsolated>"u"?!1:crossOriginIsolated}function Ge(){try{return new WebAssembly.Memory({initial:1,maximum:1,shared:!0}).buffer.constructor.name==="SharedArrayBuffer"}catch{return!1}}async function me(){return Ue()}async function qe(){if(!await $e())return!1;let t=null;try{t=new Worker(URL.createObjectURL(new Blob([\'postMessage("Worker" in self);\'],{type:"text/javascript"})),{name:"nestedWorkerTest"})}catch{return!1}return new Promise(e=>{if(t==null){e(!1);return}t.onmessage=a=>{t?.terminate(),e(a.data)}})}async function be(){let t=await qe();return je()&&Ge()&&t}var ge=class fe{constructor(e,a){this.hintPresenterV2=null,this.MAX_NUMBER_OF_IMAGES_IN_FRAME_DATA_POOL=10,this.redrawInterval=1e3/30,this.redrawRequests=[],this._isDrawLoopRunning=!1,this.frameDataPool=new Map,this.lastFrameCounter=-1,this.poorMansBenchmarkLogs=!1,this.writableDataPathStandard="/scandit_sync_folder",this.resourceFilesSubfolder="resources",this.performanceMetricsReporterTimer=void 0,this.performanceMetrics={frameDataPoolSize:0,processedFramesCount:0,redrawRequestsCount:0,actualRedrawsCount:0},this.gestureListener=null,this.webPlatformHintPresenter=null,this.moduleHandler=e,this.workerFunctions=a,this._loadProgressCallback=this._loadProgressCallback.bind(this),ce(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}convertToLoadableFrameData(e){let a=this.getNextFrameId();this.frameDataPool.set(a,new Uint8ClampedArray(e.getFrameData()));let r=this.lastUsedModuleMirrorAxis==null?!1:this.lastUsedModuleMirrorAxis!==this.Module.Axis.None;return{frameId:a,width:e.getWidth(),height:e.getHeight(),isFrameSourceMirrored:r}}createContext(e){var a,r,i,s,n;let o=this.getModeDeserializers(),c=Q(location);(c==="localhost"||c==="127.0.0.1")&&navigator.userAgent.includes("Electron")&&e.appName!=null&&(c+=`-${e.appName}`),this.parentDomain=e.parentDomain,this.contextDeserializer=new this.Module.DataCaptureContextDeserializer(this.writableDataPath,e.deviceId,e.context.deviceModelName,c,this.parentDomain,o,e.delayedRegistration,e.highEndBlurryRecognition,this.resourcePath);let d=this.contextDeserializer.contextFromJson(JSON.stringify(e.context));if(d==null){let u=this.contextDeserializer.getLastError();throw new Error(`Could not create the context: ${u}`)}let h=d.getView();this.context=d.getContext(),d.delete();let g=this.Module.DataCaptureContextListener.extend("DataCaptureContextListener",{didChangeStatus:(u,f)=>{this.contextDidChangeStatus(JSON.parse(f.toJson())),u.delete()},didStartObservingContext:u=>{this.didStartObservingContext(),u.delete()},didStopObservingContext:u=>{u.delete()}}),m=this.Module.DataCaptureContextFrameListener.extend("DataCaptureContextFrameListener",{onObservationStarted:u=>{u.delete()},onObservationStopped:u=>{u.delete()},onFrameProcessingStarted:(u,f)=>{this.workerFunctions.postMessage({type:"onFrameProcessingStarted"}),f.delete(),u.delete()},onFrameProcessingFinished:(u,f)=>{this.workerFunctions.postMessage({type:"onFrameProcessingFinished"}),f.delete(),u.delete()},onFrameSkipped:(u,f)=>{this.workerFunctions.postMessage({type:"onFrameSkipped"}),f.delete(),u.delete()}}),b=this.Module.GestureRecognizer.extend("GestureRecognizer",{setGestureListener:(u,f)=>{var O;(O=this.gestureListener)==null||O.delete(),this.gestureListener=u.clone(),u.delete()}});(a=this.gestureRecognizer)==null||a.delete(),this.gestureRecognizer=new b;let v=new g;this.context.addListener(v),v.delete();let w=new m;this.context.addFrameListener(w),w.delete(),this.setView(h),(r=this.view)==null||r.setGestureRecognizer(this.gestureRecognizer);let C=this.Module.PlatformHintPresenter.extend("PlatformHintPresenter",{setHintPresenter:u=>{u.delete()},showToast:u=>{this.workerFunctions.postMessage({type:"showToast",payload:JSON.parse(u)})},hideToast:u=>{this.workerFunctions.postMessage({type:"hideToast",payload:JSON.parse(u)})},showGuidance:u=>{this.workerFunctions.postMessage({type:"showGuidance",payload:JSON.parse(u)})},hideGuidance:u=>{this.workerFunctions.postMessage({type:"hideGuidance",payload:JSON.parse(u)})},startUpdateTimer:u=>{this.workerFunctions.postMessage({type:"startUpdateTimer",payload:{duration:{unit:"ms",value:u}}})},stopUpdateTimer:()=>{this.workerFunctions.postMessage({type:"stopUpdateTimer"})}});(i=this.hintPresenterV2)==null||i.delete(),(s=this.webPlatformHintPresenter)==null||s.delete(),this.webPlatformHintPresenter=new C,this.hintPresenterV2=new this.Module.HintPresenterV2(this.webPlatformHintPresenter),(n=this.view)==null||n.setHintPresenterV2(this.hintPresenterV2)}onTap(e){var a;(a=this.gestureListener)==null||a.onTap(JSON.stringify(e))}hintPresenterV2Update(){var e;(e=this.hintPresenterV2)==null||e.update()}startReportingPerformanceMetrics(){this.performanceMetricsReporterTimer==null&&(this.performanceMetricsReporterTimer=setInterval(()=>{this.reportPerformanceMetrics();for(let e of Object.keys(this.performanceMetrics))this.performanceMetrics[e]=0},1e3))}async reportPerformanceMetrics(){this.workerFunctions.postMessage({type:"performanceMetricsReport",payload:{...this.performanceMetrics}})}deleteFrameData(e){this.frameDataPool.delete(e)}dispose(){var e,a;this.context.dispose(),this.frameDataPool.clear(),this.isDrawLoopRunning=!1,this.lastFrameCounter=-1,(e=this.gestureRecognizer)==null||e.delete(),this.gestureRecognizer=null,(a=this.gestureListener)==null||a.delete(),this.gestureListener=null}flushAnalytics(){this.context.flushAnalytics()}extractCentaurusLicense(e){return{payload:{centaurus:{licenseKey:this.Module.LicenseUtils[fe.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 a;if(this.context==null)return{payload:e,transferables:[e.data.buffer]};let r=e.data,i=e.colorType==="GRAYSCALE"?this.Module.ImageBufferFormat.Grayscale8:this.Module.ImageBufferFormat.Rgba8888,s=this.Module.allocateUint8Array(r.byteLength);return this.Module.HEAPU8.set(r,s),(a=this.imageFrameSource)==null||a.outputFrame(s,e.width,e.height,i),{payload:e,transferables:[e.data.buffer]}}reportCameraProperties(e){this.context.setCameraProperties(e.deviceId,e.isFrontFacing,e.hasAutofocus)}requestFrameData(e){let a=this.frameDataPool.get(e);return a==null?{payload:{data:null}}:{payload:{data:a},transferables:[a.buffer]}}scheduleRedraw(e,a){this.addRedrawRequest(a),this.isDrawLoopRunning||this.startDrawLoop(e)}sendViewRefreshCommands(e){this.workerFunctions.postMessage({type:"draw",payload:e},[e.buffer])}setFrameSource(e,a){var r;this.lastUsedModuleMirrorAxis=this.mapMirrorAxisOnModule(e),(r=this.imageFrameSource)==null||r.delete(),this.imageFrameSource=new this.Module.ImageBufferFrameSource(this.lastUsedModuleMirrorAxis,a,0),this.context.setFrameSource(this.imageFrameSource)}startDrawLoop(e){this.isDrawLoopRunning=!0;let a=s=>this.redrawRequests.length>0&&this.redrawRequests[0]<=s,r=s=>{for(;this.redrawRequests.length>0&&this.redrawRequests[0]<=s;)this.redrawRequests.shift()},i=()=>{this.loopTimeoutId=setTimeout(()=>{if(!this.isDrawLoopRunning)return;let s=performance.now();if(a(s)){r(s),e.draw();let n=e.getDrawCommands();this.sendViewRefreshCommands(new Uint8Array(n))}i()},this.redrawInterval)};i()}updateContext(e){if(this.context!=null&&this.contextDeserializer!=null){e.view!=null&&!e.view.visible&&this.context.flushAnalytics();let a=this.onBeforeUpdateContextHook(e),r=this.contextDeserializer.updateContextFromJson(this.context,this.view,JSON.stringify(a.context));if(r==null){let s=this.contextDeserializer.getLastError();throw new Error(`Could not update the context: ${s}`)}this.context.delete(),this.context=r.getContext();let i=r.getView();r.delete(),i!=null&&a.view!=null&&i.setViewSize(a.view.width,a.view.height,a.view.orientation),this.hintPresenterV2!=null&&i?.setHintPresenterV2(this.hintPresenterV2),this.gestureRecognizer!=null&&i?.setGestureRecognizer(this.gestureRecognizer),this.setView(i),l.debug("context updated",a)}}onBeforeUpdateContextHook(e){return e}onDocumentVisibilityChange(e){e==="hidden"&&this.context.flushAnalytics()}isFeatureSupported(e){return{payload:{supported:this.context.isFeatureSupported(e)}}}getViewfinderInfo(){var e,a;return{payload:{isDisplayingViewfinder:(a=(e=this.view)==null?void 0:e.isDisplayingViewfinder())!=null?a:!1,rect:JSON.parse(this.view.getViewfinderRect())}}}getOpenSourceSoftwareLicenseInfo(){return{payload:{licenseText:this.Module.OpenSourceSoftwareLicenseInfo.getLicenseText()}}}getNextFrameId(){return this.lastFrameCounter++,this.lastFrameCounter>=this.MAX_NUMBER_OF_IMAGES_IN_FRAME_DATA_POOL&&(this.lastFrameCounter=0),this.lastFrameCounter}getWasmDynamicLibraries(e){return this.getWasmSideModuleFileName()==null?[]:[`${e.replace(/\\/[^/]*$/,"/")}${this.getWasmSideModuleFileName()}`]}getWasmCoreExpectedHash(e,a){return a?e?"8c1f345ea9074e8b80cb044d99a0e10e47bc3a5d236a1e765abdea80b43dd348":"59b6a672054cdd5713b437cecd86df0e7d31bea8e87373f5e41036bd519b4542":e?"fb4f822587eada38163083dc4c2a1ac27c29ab3b0e82590446dfb724621b7dfd":""}getWasmCoreFileName(e,a){return a?e?"scandit-datacapture-sdk-barcode-simd-pthreads.wasm":"scandit-datacapture-sdk-barcode-pthreads.wasm":e?"scandit-datacapture-sdk-barcode-simd.wasm":""}getWasmMetadata(){return p}getWasmSideModuleFileName(){return""}_loadProgressCallback(e){this.workerFunctions.postMessage({type:"loadLibraryProgress",payload:e})}addRedrawRequest(e){this.redrawRequests.push(Math.round(performance.now())+e),this.redrawRequests.sort((a,r)=>a-r)}contextDidChangeStatus(e){e.code===260?e.message=e.message.replace("domain name",`domain name (${Q(location)})`):e.code===265&&(e.message=e.message.replace("domain name",`domain name (${this.parentDomain})`)),this.workerFunctions.postMessage({type:"contextDidChangeStatus",payload:e})}didStartObservingContext(){this.workerFunctions.postMessage({type:"didStartObservingContext"})}mapMirrorAxisOnModule(e){switch(e){case"None":return this.Module.Axis.None;case"X":return this.Module.Axis.X;case"Y":return this.Module.Axis.Y;default:return this.Module.Axis.None}}setView(e){this.view=e,this.setViewRefreshHandler(e),e==null&&(this.isDrawLoopRunning=!1,this.sendViewRefreshCommands(new Uint8Array([])))}addNativeOverlay(e){l.warn("addNativeOverlay has not been implemented for this module",e)}removeNativeOverlay(e){l.warn("removeNativeOverlay has not been implemented for this module",e)}setViewRefreshHandler(e){if(e==null||e.isViewRefreshHandlerSet)return;let a=this.Module.NeedsRedrawDelegate.extend("NeedsRedrawDelegate",{setNeedsRedrawIn:this.scheduleRedraw.bind(this,e)}),r=new a;e.setNeedsRedrawDelegate(r),e.isViewRefreshHandlerSet=!0}setupDataDecoding(){let e=this.moduleHandler.get(),a=e.DataDecoding.extend("DataDecoding",{decode(r,i){try{let s=JSON.parse(i),n=[];for(let o of s){let c=new TextDecoder(o.ianaName,{fatal:!0});n.push(c.decode(r.slice(o.startIndex,o.endIndex)))}return n.join("")}catch{return""}}});e.setDataDecoding(new a)}start(e,a,r){e&&a&&(this.setupDataDecoding(),this.moduleHandler.get().callMain(),this.moduleHandler.get().__emscripten_proxy_main!==void 0||r())}getWritableDataPath(e){return e!=null?(l.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:a,writableDataPathOverride:r,overrideThreadsSupport:i,overrideSimdSupport:s,verifyResponseHash:n,referredOrigin:o,fixedWasmMemory:c}){var d;let h=!1,g=!1;this.writableDataPath=this.getWritableDataPath(r),this.resourcePath=`${e}${this.resourceFilesSubfolder}/`,globalThis.path=a;let{resolve:m,reject:b,promise:v}=new he,w=L.sdkVersion();if(w==="")throw new P({name:"Invalid library version",message:"Library version is not defined or empty, cannot generate proper path to library files."});let[C,u]=await Promise.all([me(),be()]);i!=="auto"&&(u=i==="on"),s!=="auto"&&(C=s==="on");let f=this.getWasmCoreFileName(C,u),O=pe(w,e,f),{jsURI:U,wasmURI:te}=O,Be={instantiateWasm:(S,Pe)=>(le({importObject:S,wasmURI:te,expectedHash:this.getWasmCoreExpectedHash(C,u),verifyResponseHash:n,successCallback:Pe,progressCallback:this._loadProgressCallback,referredOrigin:o}),{})},B=c===null?null:new WebAssembly.Memory({initial:this.numOfMBToPages(c),maximum:this.numOfMBToPages(300),shared:u});return B!==null&&l.log(l.Level.Debug,"Fixed wasmMemory set",B),this.moduleHandler.set({...B?{wasmMemory:B}:{},mainScriptUrlOrBlob:U,canvas:(d=this.workerFunctions.getOffscreenCanvas())!=null?d:{getContext:()=>null},...Be,dynamicLibraries:this.getWasmDynamicLibraries(te),locateFile:S=>e+S,noInitialRun:!0,preRun:[async()=>{try{await se({writableDataPath:this.writableDataPath})}catch(S){if(S.name==="BlockedIndexedDB"){b(S.toString());return}l.log(l.Level.Debug,"No IndexedDB support, some data will not be persisted:",S)}g=!0,this.start(g,h,m)}],onMainComplete:()=>{if([h,g].includes(!1)){l.log(l.Level.Warn,{runtimeLoaded:h,fileSystemSynced:g},"Both runtimeLoaded and fileSystemSynced should be true when calling onMainComplete"),b("onMainComplete has been called but runtime or file system was not ready.");return}m()},onRuntimeInitialized:()=>{h=!0,this.start(g,h,m)},print:S=>{l.log(l.Level.Info,S)}}),await ue(U,w)||b(`Couldn\'t retrieve Scandit Data Capture library at ${U}, did you configure the path for it correctly?`),v}};ge.get3dPartyLicenseKeyMethodName=atob("Z2V0QmxpbmtJZExpY2Vuc2VLZXk=");var D=ge;function ye(t){return typeof t=="object"&&t!=null&&t.document==null&&"addEventListener"in t&&typeof t.importScripts=="function"}function Se(t){console.warn("Reached unexpected case",t)}var ee=class{constructor(t,e){this.onMessageListener=this.onMessage.bind(this),this.workerSelf=t,this.dataCaptureInstance=new D(e,{postMessage:this.postMessage.bind(this),getOffscreenCanvas:this.getOffscreenCanvas.bind(this)}),ye(t)&&this.listenToMessages()}listenToMessages(){this.workerSelf.addEventListener("message",this.onMessageListener),this.workerSelf.addEventListener("error",t=>{l.log(l.Level.Error,t)}),this.workerSelf.addEventListener("messageerror",t=>{l.log(l.Level.Error,t)})}postMessage(t,e){this.workerSelf.postMessage(t,e??[])}getOffscreenCanvas(){if(typeof this.workerSelf.OffscreenCanvas=="function")return new this.workerSelf.OffscreenCanvas(32,32)}hasPayload(t){return M(t)&&"payload"in t}hasTransferables(t){return M(t)&&Array.isArray(t.transferables)}async respondWith(t,e,a){let r=null,i;try{i=a(),i instanceof Promise&&(i=await i)}catch(n){i=void 0,r=F(n)}let s={type:"workerTaskId",command:t,id:e,payload:this.hasPayload(i)?i.payload:void 0};r!=null&&(s.error=r),this.postMessage(s,this.hasTransferables(i)?i.transferables:[])}onMessage(t){switch(t.data.command){case"loadLibrary":{{let{data:e}=t;this.respondWith(e.command,e.id,async()=>this.dataCaptureInstance.loadLibrary({libraryLocation:e.libraryLocation,locationPath:e.locationPath,referredOrigin:e.referredOrigin,writableDataPathOverride:e.writableDataPathOverride,overrideThreadsSupport:e.overrideThreadsSupport,overrideSimdSupport:e.overrideSimdSupport,verifyResponseHash:e.verifyResponseHash,fixedWasmMemory:e.fixedWasmMemory}))}break}case"onTap":{{let{data:e}=t;this.respondWith(e.command,e.id,async()=>{this.dataCaptureInstance.onTap(e.point)})}break}case"hintPresenterV2update":{{let{data:e}=t;this.respondWith(e.command,e.id,async()=>{this.dataCaptureInstance.hintPresenterV2Update()})}break}case"createContext":{{let{data:e}=t;this.respondWith(e.command,e.id,()=>this.dataCaptureInstance.createContext({context:e.context,deviceId:e.deviceId,delayedRegistration:e.delayedRegistration,highEndBlurryRecognition:e.highEndBlurryRecognition,appName:e.appName,parentDomain:e.parentDomain}))}break}case"setFrameSource":{{let{data:e}=t;this.respondWith(e.command,e.id,()=>this.dataCaptureInstance.setFrameSource(e.mirrorAxis,e.isCameraFrameSource))}break}case"processFrame":{{let{data:e}=t;this.respondWith(e.command,e.id,()=>this.dataCaptureInstance.processFrame({data:e.data,width:e.width,height:e.height,colorType:e.colorType}))}break}case"requestFrameData":{{let{data:e}=t;this.respondWith(e.command,e.id,()=>this.dataCaptureInstance.requestFrameData(e.frameId))}break}case"deleteFrameData":{{let{data:e}=t;this.respondWith(e.command,e.id,()=>{this.dataCaptureInstance.deleteFrameData(e.frameId)})}break}case"updateContext":{{let{data:e}=t;this.respondWith(e.command,e.id,async()=>this.dataCaptureInstance.updateContext(e))}break}case"dispose":{this.respondWith(t.data.command,t.data.id,()=>this.dataCaptureInstance.dispose());break}case"flushAnalytics":{this.respondWith(t.data.command,t.data.id,()=>{this.dataCaptureInstance.flushAnalytics()});break}case"reportCameraProperties":{{let{data:e}=t;this.respondWith(e.command,e.id,async()=>this.dataCaptureInstance.reportCameraProperties(e))}break}case"setLogLevel":{{let{data:e}=t;this.respondWith(e.command,e.id,()=>{l.setLevel(e.level)})}break}case"extractCentaurusLicense":{{let{data:e}=t;this.respondWith(e.command,e.id,()=>this.dataCaptureInstance.extractCentaurusLicense(e.licenseKey))}break}case"documentVisibility":{{let{data:e}=t;this.respondWith(e.command,e.id,()=>{this.dataCaptureInstance.onDocumentVisibilityChange(e.state)})}break}case"isFeatureSupported":{{let{data:e}=t;this.respondWith(e.command,e.id,()=>this.dataCaptureInstance.isFeatureSupported(e.feature))}break}case"getViewfinderInfo":{{let{data:e}=t;this.respondWith(e.command,e.id,()=>this.dataCaptureInstance.getViewfinderInfo())}break}case"getOpenSourceSoftwareLicenseInfo":{{let{data:e}=t;this.respondWith(e.command,e.id,()=>this.dataCaptureInstance.getOpenSourceSoftwareLicenseInfo())}break}case"addNativeOverlay":this.dataCaptureInstance.addNativeOverlay(t);break;case"removeNativeOverlay":this.dataCaptureInstance.removeNativeOverlay(t);break;default:return Se(t.data),!1}return!0}};var ve=(t=>(t.Body="body",t.Footnote="footnote",t))(ve||{}),T=(t=>(t.Start="start",t.Center="center",t.End="end",t))(T||{}),we=(t=>(t.Normal="normal",t.Wider="wider",t.FitText="fitText",t))(we||{}),Ce=(t=>(t.Normal="normal",t.Taller="taller",t))(Ce||{}),Me=(t=>(t.Square="square",t.Rounded="rounded",t))(Me||{}),W=(t=>(t.None="none",t.Check="check",t.ExclamationMark="exclamationMark",t))(W||{}),E=(t=>(t.Top="top",t.AboveViewFinder="aboveViewFinder",t.BelowViewFinder="belowViewFinder",t))(E||{}),Fe=(t=>(t.AboveViewFinder="aboveViewFinder",t.BelowViewFinder="belowViewFinder",t))(Fe||{}),ke=(t=>(t.BlackOnWhite="blackOnWhite",t.WhiteOnBlack="whiteOnBlack",t.Transparent="transparent",t))(ke||{}),x=(t=>(t.Success="success",t.Error="error",t.Warning="warning",t.Info="info",t.Notification="notification",t))(x||{}),De=(t=>(t[t.Ocr=0]="Ocr",t[t.HideLogo=1]="HideLogo",t[t.ShowTestLicenseMessage=2]="ShowTestLicenseMessage",t[t.AugmentedReality=5]="AugmentedReality",t[t.ActivityPingStatsAddon=8]="ActivityPingStatsAddon",t[t.ActivityPing=9]="ActivityPing",t[t.Registration=10]="Registration",t[t.Parser=11]="Parser",t[t.BarcodeCapture=14]="BarcodeCapture",t[t.Analytics=17]="Analytics",t[t.AnalyticsBatchMode=18]="AnalyticsBatchMode",t[t.AnalyticsScanContent=19]="AnalyticsScanContent",t[t.AnalyticsOnlineVerification=20]="AnalyticsOnlineVerification",t[t.SparkScan=21]="SparkScan",t[t.AamvaIdBarcodeVerification=22]="AamvaIdBarcodeVerification",t[t.MappingForTracking=23]="MappingForTracking",t[t.BarcodeFind=24]="BarcodeFind",t[t.MandatoryRegistration=25]="MandatoryRegistration",t[t.FeatureTracking=26]="FeatureTracking",t[t.IdCaptureViz=27]="IdCaptureViz",t[t.IdCaptureMrz=28]="IdCaptureMrz",t[t.IdCaptureBarcode=29]="IdCaptureBarcode",t[t.BarcodeSelectionAimToScan=30]="BarcodeSelectionAimToScan",t[t.BarcodeSelectionTapToScan=31]="BarcodeSelectionTapToScan",t[t.BarcodeCount=32]="BarcodeCount",t[t.BarcodePick=33]="BarcodePick",t[t.IdVerificationDataComparison=34]="IdVerificationDataComparison",t[t.SmartLabelBarcode=35]="SmartLabelBarcode",t[t.SmartLabelText=36]="SmartLabelText",t[t.VoidedIdDetection=37]="VoidedIdDetection",t[t.BarcodeArFull=38]="BarcodeArFull",t))(De||{});var A=class{constructor(e,a,r){this.trackingListenerSet=!1;this.coreEngine=e,this.Module=a,this.workerFunctions=r,this.setup()}barcodeBatchDidUpdateSession(e){this.workerFunctions.postMessage({type:"barcodeBatchDidUpdateSession",payload:JSON.parse(e.toJson())})}getBatchDeserializer(){return this.barcodeBatchDeserializer}setup(){let e=this.Module.BarcodeBatchListener.extend("BarcodeTrackingListener",{didUpdateSession:(r,i,s)=>{this.barcodeBatchDidUpdateSession(i),r.delete(),i.delete(),s.delete()},onTrackedBarcodeTapped:(r,i)=>{this.onTrackedBarcodeTapped(i),r.delete(),i.delete()}}),a=this.Module.BarcodeBatchDeserializerListener.extend("BarcodeTrackingDeserializerListener",{onModeDeserializationFinished:(r,i,s)=>{this.trackingListenerSet||(i.addListener(new e,1),this.trackingListenerSet=!0),r.delete(),i.delete(),s.delete()},onModeDeserializationStarted(r,i,s){r.delete(),i.delete(),s.delete()},onSettingsDeserializationStarted(r,i,s){r.delete(),i.delete(),s.delete()},onSettingsDeserializationFinished(r,i,s){r.delete(),i.delete(),s.delete()}});this.barcodeBatchDeserializer=new this.Module.BarcodeBatchDeserializer,this.barcodeBatchDeserializer.setListener(new a)}onTrackedBarcodeTapped(e){this.workerFunctions.postMessage({type:"didTapTrackedBarcode",payload:JSON.parse(e.toJson())})}};var R=class{constructor(e,a,r){this.captureListenerSet=!1;this.coreEngine=e,this.Module=a,this.workerFunctions=r,this.setup()}barcodeCaptureDidUpdateSession(e){this.workerFunctions.postMessage({type:"barcodeCaptureDidUpdateSession",payload:JSON.parse(e.toJson())})}barcodeBatchDidUpdateSession(e){this.workerFunctions.postMessage({type:"barcodeBatchDidUpdateSession",payload:JSON.parse(e.toJson())})}getCaptureDeserializer(){return this.barcodeCaptureDeserializer}getTrackingDeserializer(){return this.barcodeBatchDeserializer}setup(){let e=this.Module.BarcodeCaptureListener.extend("BarcodeCaptureListener",{didScan:(n,o,c)=>{this.barcodeCaptureDidScan(o,c),n.delete(),c.delete(),o.delete()},didUpdateSession:(n,o,c)=>{this.barcodeCaptureDidUpdateSession(o),n.delete(),c.delete(),o.delete()}}),a=this.Module.Feedback.extend("Feedback",{emit:()=>{this.successFeedback()}}),r=new e,i=new a,s=this.Module.BarcodeCaptureDeserializerListener.extend("BarcodeCaptureDeserializerListener",{onModeDeserializationFinished:(n,o,c)=>{o.addListener(r,1),o.setSuccessFeedback(i),n.delete(),o.delete(),c.delete()},onModeDeserializationStarted(n,o,c){n.delete(),o.delete(),c.delete()},onSettingsDeserializationStarted(n,o,c){n.delete(),o.delete(),c.delete()},onSettingsDeserializationFinished(n,o,c){n.delete(),o.delete(),c.delete()}});this.barcodeCaptureDeserializer=new this.Module.BarcodeCaptureDeserializer,this.barcodeCaptureDeserializer.setListener(new s)}successFeedback(){this.workerFunctions.postMessage({type:"successFeedback"})}barcodeCaptureDidScan(e,a){let r=this.coreEngine.convertToLoadableFrameData(a);this.workerFunctions.postMessage({type:"barcodeCaptureDidScan",payload:{session:JSON.parse(e.toJson()),frameData:r}})}};var N=class{constructor(e,a,r){this.barcodeCheck=null;this.coreEngine=e,this.Module=a,this.workerFunctions=r}async forSettings(e){this.barcodeCheck?.delete(),this.barcodeCheck=new this.Module.BarcodeCheck(this.coreEngine.context,JSON.stringify(e));let a=this.Module.BarcodeCheckListener.extend("BarcodeCheckListener",{didUpdateSession:(r,i,s)=>{let n=this.coreEngine.convertToLoadableFrameData(s);this.workerFunctions.postMessage({type:"barcodeCheckDidUpdateSession",payload:{session:JSON.parse(i.toJson()),frameData:n}}),r.delete(),i.delete(),s.delete()}});this.barcodeCheck.addListener(new a,1),this.Module.addBarcodeCheckToContext(this.coreEngine.context,this.barcodeCheck)}start(){this.barcodeCheck?.start()}pause(){this.barcodeCheck?.pause()}stop(){this.barcodeCheck?.stop()}setEnabled(e){this.barcodeCheck?.setEnabled(e)}async removeMode(){this.barcodeCheck!=null&&this.Module.removeBarcodeCheckFromContext(this.coreEngine.context,this.barcodeCheck)}applySettings(e){this.barcodeCheck?.applySettings(JSON.stringify(e))}};function Ke(t){return t.charAt(0).toUpperCase()+t.slice(1)}function xe(t){return t}var H=class{constructor(e,a,r){this.barcodeFind=null;this.basicOverlay=null;this.transparentGuidanceHintStyle={backgroundColor:"00000000",cornerRadius:4,fitToText:!1,isAnimatedToView:!1,textAlignment:T.Center,hintIcon:W.None,hintAnchor:E.AboveViewFinder,hintAnchorOffset:-12,horizontalMargin:0,iconColor:"00000000",lineHeight:-1,maxLines:1,maxWidthFraction:.8,textColor:"ffffffff",textSize:15,textWeight:600};this.customerTransformation=xe;this.coreEngine=e,this.Module=a,this.workerFunctions=r}async forSettings(e){this.barcodeFind?.delete(),this.barcodeFind=new this.Module.BarcodeFind(this.coreEngine.context,JSON.stringify(e));let a=this.Module.Feedback.extend("Feedback",{emit:()=>{this.listUpdatedFeedback()}}),r=this.Module.Feedback.extend("Feedback",{emit:()=>{this.barcodeFindFeedback()}}),i=this.Module.BarcodeFindTransformer.extend("BarcodeFindTransformer",{transformBarcodeData:n=>this.customerTransformation(n)}),s=this.Module.BarcodeFindListener.extend("BarcodeFindListener",{didUpdateSession:(n,o,c)=>{let d=this.coreEngine.convertToLoadableFrameData(c);this.workerFunctions.postMessage({type:"barcodeFindDidUpdateSession",payload:{session:JSON.parse(o.toJson()),frameData:d}}),n.delete(),o.delete(),c.delete()},onSearchPaused:n=>{let o=[];for(let c=0;c<n.size();c++)o.push(n.get(c));this.workerFunctions.postMessage({type:"barcodeFindSearchPaused",payload:{foundItems:o}})},onSearchStopped:n=>{let o=[];for(let c=0;c<n.size();c++)o.push(n.get(c));this.workerFunctions.postMessage({type:"barcodeFindSearchStopped",payload:{foundItems:o}})},onSearchStarted:()=>{this.workerFunctions.postMessage({type:"barcodeFindSearchStarted",payload:{}})}});this.barcodeFind.setBarcodeFindTransformer(new i),this.barcodeFind.addListener(new s,1),this.barcodeFind.setItemListUpdatedFeedback(new a),this.barcodeFind.setFeedback(new r),this.Module.addBarcodeFindToContext(this.coreEngine.context,this.barcodeFind)}barcodeFindFeedback(){this.workerFunctions.postMessage({type:"barcodeFindFeedback",payload:{}})}start(){this.barcodeFind?.start()}stop(){this.barcodeFind?.stop()}pause(){this.barcodeFind?.pause()}setEnabled(e){this.barcodeFind?.setEnabled(e)}setItemList(e){this.barcodeFind?.setItemList(JSON.stringify(e))}async removeMode(){this.barcodeFind!=null&&this.Module.removeBarcodeFindFromContext(this.coreEngine.context,this.barcodeFind)}addBasicOverlay(){this.basicOverlay?.delete(),this.basicOverlay=null,this.barcodeFind!=null&&(this.basicOverlay=new this.Module.BarcodeFindBasicOverlay(this.barcodeFind)),this.coreEngine.view!=null&&this.basicOverlay!=null&&(this.basicOverlay.setGuidanceHandler(this.createWebFindGuidanceHandler()),this.Module.addBarcodeFindBasicOverlayToView(this.coreEngine.view,this.basicOverlay))}removeBasicOverlay(){this.coreEngine.view!=null&&this.basicOverlay!=null&&this.Module.removeBarcodeFindBasicOverlayFromView(this.coreEngine.view,this.basicOverlay)}async applySettings(e){this.barcodeFind?.applySettings(JSON.stringify(e))}updateBasicOverlay(e){let a=Object.entries(e).filter(([r,i])=>r!=="type");for(let[r,i]of a){let s=`set${Ke(r)}`;this.basicOverlay!=null&&typeof this.basicOverlay[s]=="function"&&i!=null&&this.basicOverlay[s](i)}}setTransformerFunction(e){this.customerTransformation=e??xe}successFeedback(){this.workerFunctions.postMessage({type:"successFeedback"})}listUpdatedFeedback(){this.workerFunctions.postMessage({type:"barcodeFindListUpdatedFeedback",payload:{}})}setToast(e,a){let r=this.coreEngine.hintPresenterV2;e?r?.showToast(JSON.stringify(a)):r?.hideToast(a.tag)}setGuidance(e,a,r){let i={tag:r,text:a,hintStyle:this.transparentGuidanceHintStyle};this.workerFunctions.postMessage({type:e?"showGuidance":"hideGuidance",payload:i})}createWebFindGuidanceHandler(){let e=this.Module.BarcodeFindGuidanceHandler.extend("BarcodeFindGuidanceHandler",{setInitialGuidance:(a,r)=>{this.setGuidance(a,r,"InitialGuidance")},setMoveCloserGuidance:(a,r)=>{this.setGuidance(!1,r,"InitialGuidance"),this.setGuidance(a,r,"MoveCloserGuidance")},setAllItemsFound:(a,r)=>{let i={text:r,toastHintStyle:x.Success,tag:"AllItemsFound"};this.setToast(a,i)},setTapShutterToPause:(a,r)=>{this.setGuidance(!1,r,"InitialGuidance"),this.setGuidance(a,r,"TapShutterToPause")},setTapShutterToResume:(a,r)=>{this.setGuidance(!1,r,"InitialGuidance"),this.setGuidance(a,r,"TapShutterResume")},setItemListUpdated:(a,r)=>{let i={text:r,toastHintStyle:x.Info,tag:"ItemListUpdated"};this.setToast(a,i)}});return new e}};var y=class{constructor(e){this.subscribers=new Set;this.property={key:e,value:null}}addSubscriber(e){this.subscribers.add(e),e.onPropertyChanged?.(this.property)}removeSubscriber(e){this.subscribers.delete(e)}setProperty(e){if(this.property.value!==e.value){this.property={key:this.property.key,value:e.value};for(let a of this.subscribers)a.onPropertyChanged?.(this.property)}}};var Xe={torch_state:new y("torch_state"),scanning_mode:new y("scanning_mode"),sound_enabled:new y("sound_enabled"),haptic_enabled:new y("haptic_enabled"),hand_mode:new y("hand_mode"),session_stop_reason:new y("session_stop_reason"),camera_position:new y("camera_position")},_=class{getBehaviorSubject(e){return Xe[e]}};var z=class{constructor(e,a,r){this.captureListenerSet=!1;this.propertyPushSource=new _;this.coreEngine=e,this.Module=a,this.workerFunctions=r,this.setup()}sparkScanDidUpdateSession(e){this.workerFunctions.postMessage({type:"sparkScanDidUpdateSession",payload:JSON.parse(e.toJson())})}getSparkScanDeserializer(){return this.sparkScanDeserializer}setup(){let e=this.Module.SparkScanListener.extend("SparkScanListener",{didScan:(i,s,n)=>{this.sparkScanDidScan(s,n),i.delete(),s.delete(),n.delete()},didUpdateSession:(i,s,n)=>{this.sparkScanDidUpdateSession(s),i.delete(),s.delete(),n.delete()}}),a=this.Module.Feedback.extend("Feedback",{emit:()=>{this.successFeedback()}}),r=this.Module.SparkScanDeserializerListener.extend("SparkScanDeserializerListener",{onModeDeserializationFinished:(i,s,n)=>{this.captureListenerSet||(s.addListener(new e,1),s.setSuccessFeedback(new a),s.setPropertyPushSource(this.propertyPushSource),this.captureListenerSet=!0),i.delete(),s.delete(),n.delete()},onModeDeserializationStarted(i,s,n){i.delete(),s.delete(),n.delete()},onSettingsDeserializationStarted(i,s,n){i.delete(),s.delete(),n.delete()},onSettingsDeserializationFinished(i,s,n){i.delete(),s.delete(),n.delete()},onOverlayDeserializationStarted(i,s,n){i.delete(),s.delete(),n.delete()},onOverlayDeserializationFinished:(i,s,n)=>{this.sparkScanOverlay?.delete(),this.sparkScanOverlay=s,i.delete(),n.delete()}});this.sparkScanDeserializer=new this.Module.SparkScanDeserializer,this.sparkScanDeserializer.setListener(new r)}emitErrorFeedback(e){this.sparkScanOverlay?.onErrorFeedbackEmitted(e)}overlayReadyForDraw(){this.sparkScanOverlay?.onReadyForNewData()}analyticsManagerPropertyChanged(e){this.propertyPushSource.getBehaviorSubject(e.key).setProperty(e)}successFeedback(){this.workerFunctions.postMessage({type:"successFeedback"})}sparkScanDidScan(e,a){let r=this.coreEngine.convertToLoadableFrameData(a);this.workerFunctions.postMessage({type:"sparkScanDidScan",payload:{session:JSON.parse(e.toJson()),frameData:r}})}};var V=class extends D{constructor(e,a){super(e,a)}getModeDeserializers(){this.barcodeCaptureMode=new R(this,this.Module,this.workerFunctions),this.barcodeBatchMode=new A(this,this.Module,this.workerFunctions),this.sparkScanMode=new z(this,this.Module,this.workerFunctions),this.barcodeFindMode=new H(this,this.Module,this.workerFunctions),this.barcodeCheckMode=new N(this,this.Module,this.workerFunctions);let e=super.getModeDeserializers();return e.push_back(this.barcodeCaptureMode.getCaptureDeserializer()),e.push_back(this.barcodeBatchMode.getBatchDeserializer()),e.push_back(this.sparkScanMode.getSparkScanDeserializer()),e}getWasmSideModuleFileName(){return""}getWasmCoreFileName(e,a){return a?e?"scandit-datacapture-sdk-barcode-simd-pthreads.wasm":"scandit-datacapture-sdk-barcode-pthreads.wasm":e?"scandit-datacapture-sdk-barcode-simd.wasm":"scandit-datacapture-sdk-barcode.wasm"}getWasmCoreExpectedHash(e,a){return a?e?"8c1f345ea9074e8b80cb044d99a0e10e47bc3a5d236a1e765abdea80b43dd348":"59b6a672054cdd5713b437cecd86df0e7d31bea8e87373f5e41036bd519b4542":e?"fb4f822587eada38163083dc4c2a1ac27c29ab3b0e82590446dfb724621b7dfd":"906c7c8df6f255a43e9b3a2f735d44e5745d497d165d06ca8fa3cf6dc15a89b7"}getWasmMetadata(){return p}};function Ye(t){return(a=>/^[$A-Z_a-z][\\w$]*\\s*\\(.*\\)\\s*\\{/.test(a)&&!a.startsWith("function"))(t)?`function ${t}`:t}var Ze=["fetch","XMLHttpRequest","eval","Function","self","globalThis","Module","importScripts","this","console","window","document","import","Worker","ServiceWorker"];function Qe(t){return Ze.map(a=>new RegExp(`\\\\b${a}\\\\b`,"g")).some(a=>a.test(t))}function Oe(t){if(t==null)return null;let e=Ye(t);if(Qe(e))throw new Error("Function should be pure. Shouldn\'t introduce side effects, or rely on global scope");let a=`\'use strict\';\n return (${e});`;try{return new Function(a)()}catch{return null}}var J=class extends ee{constructor(e,a){super(e,a),this.dataCaptureInstance=new V(a,{postMessage:this.postMessage.bind(this),getOffscreenCanvas:this.getOffscreenCanvas.bind(this)})}async respondWith(e,a,r){let i=null,s;try{s=r(),s instanceof Promise&&(s=await s)}catch(o){s=void 0,i=F(o)}let n={type:"workerTaskId",command:e,id:a,payload:this.hasPayload(s)?s.payload:void 0};i!=null&&(n.error=i),this.postMessage(n,this.hasTransferables(s)?s.transferables:[])}onMessage(e){switch(e.data.command){case"sparkScanEmitErrorFeedback":{let{data:a}=e;return this.respondWith(a.command,a.id,()=>{this.dataCaptureInstance.sparkScanMode.emitErrorFeedback(a.shouldRemoveBrush)}),!0}case"sparkScanOverlayReadyForDraw":{let{data:a}=e;return this.respondWith(a.command,a.id,()=>{this.dataCaptureInstance.sparkScanMode.overlayReadyForDraw()}),!0}case"sparkScanAnalyticsManagerPropertyChanged":{let{data:a}=e;return this.respondWith(a.command,a.id,async()=>{this.dataCaptureInstance.sparkScanMode.analyticsManagerPropertyChanged(a.property)}),!0}case"barcodeFindForSettings":{let{data:a}=e;return this.respondWith(a.command,a.id,async()=>this.dataCaptureInstance.barcodeFindMode.forSettings(a.settings)),!0}case"barcodeFindModeRemove":{let{data:a}=e;return this.respondWith(a.command,a.id,async()=>this.dataCaptureInstance.barcodeFindMode.removeMode()),!0}case"barcodeFindSearchStart":return this.respondWith(e.data.command,e.data.id,()=>{this.dataCaptureInstance.barcodeFindMode.start()}),!0;case"barcodeFindSearchPause":return this.respondWith(e.data.command,e.data.id,()=>{this.dataCaptureInstance.barcodeFindMode.pause()}),!0;case"barcodeFindSearchStop":return this.respondWith(e.data.command,e.data.id,()=>{this.dataCaptureInstance.barcodeFindMode.stop()}),!0;case"barcodeFindSetItemList":{let{data:a}=e;return this.respondWith(e.data.command,e.data.id,()=>{this.dataCaptureInstance.barcodeFindMode.setItemList(a.itemList)}),!0}case"barcodeFindSetEnabled":{let{data:a}=e;return this.respondWith(e.data.command,e.data.id,()=>{this.dataCaptureInstance.barcodeFindMode.setEnabled(a.enabled)}),!0}case"barcodeFindApplySettings":{let{data:a}=e;return this.respondWith(a.command,a.id,async()=>this.dataCaptureInstance.barcodeFindMode.applySettings(a.settings)),!0}case"barcodeFindAddBasicOverlay":{let{data:a}=e;return this.respondWith(a.command,a.id,async()=>{this.dataCaptureInstance.barcodeFindMode.addBasicOverlay()}),!0}case"barcodeFindRemoveBasicOverlay":{let{data:a}=e;return this.respondWith(a.command,a.id,async()=>{this.dataCaptureInstance.barcodeFindMode.removeBasicOverlay()}),!0}case"barcodeFindUpdateBasicOverlay":{let{data:a}=e;return this.respondWith(a.command,a.id,async()=>{this.dataCaptureInstance.barcodeFindMode.updateBasicOverlay(a.jsonOverlay)}),!0}case"barcodeFindSetTransformerFunction":{let{data:a}=e;return this.respondWith(a.command,a.id,async()=>{let r=Oe(a.functionAsString);this.dataCaptureInstance.barcodeFindMode.setTransformerFunction(r)}),!0}case"barcodeCheckForSettings":{let{data:a}=e;return this.respondWith(a.command,a.id,async()=>this.dataCaptureInstance.barcodeCheckMode.forSettings(a.settings)),!0}case"barcodeCheckModeRemove":{let{data:a}=e;return this.respondWith(a.command,a.id,async()=>this.dataCaptureInstance.barcodeCheckMode.removeMode()),!0}case"barcodeCheckSearchStart":return this.respondWith(e.data.command,e.data.id,()=>{this.dataCaptureInstance.barcodeCheckMode.start()}),!0;case"barcodeCheckSearchPause":return this.respondWith(e.data.command,e.data.id,()=>{this.dataCaptureInstance.barcodeCheckMode.pause()}),!0;case"barcodeCheckSearchStop":return this.respondWith(e.data.command,e.data.id,()=>{this.dataCaptureInstance.barcodeCheckMode.stop()}),!0;case"barcodeCheckSetEnabled":{let{data:a}=e;return this.respondWith(e.data.command,e.data.id,()=>{this.dataCaptureInstance.barcodeCheckMode.setEnabled(a.enabled)}),!0}case"barcodeCheckApplySettings":{let{data:a}=e;return this.respondWith(a.command,a.id,async()=>{this.dataCaptureInstance.barcodeCheckMode.applySettings(a.settings)}),!0}default:return super.onMessage(e)}}};var Qa=new J(globalThis,{get:()=>globalThis.Module,set:t=>{globalThis.Module=t}});function er(t){}})();\n'],{type:"application/javascript"})),e=new Worker(s,r);return URL.revokeObjectURL(s),e}var o=class r extends DataCaptureLoader{constructor(){super(...arguments);this._name="BarcodeCapture";}get dataCaptureWorker(){return (this._dataCaptureWorker)!=null||(this._dataCaptureWorker=n({name:this.name})),this._dataCaptureWorker}get name(){return this._name}static async create(e){var a;let t=new r(e);return await t.workerCommand("setLogLevel",{level:(a=e.logLevel)!=null?a:Logger.Level.Debug}),await t.load(),t}async workerCommand(e,t,a){return new Promise((d,c)=>{let i=this.workerCommandId++;this.workerTasks.set(i,{resolve:d,reject:c,command:e});let l={...t,command:e,id:i};this.dataCaptureWorker.postMessage(l,a);})}};
1
+ import {DataCaptureLoader,Logger}from'@scandit/web-datacapture-core';function n(r){let s=URL.createObjectURL(new Blob(['"use strict";(()=>{var p={"scandit-datacapture-sdk-barcode-pthreads.wasm":{bytes:6905904},"scandit-datacapture-sdk-barcode-simd-pthreads.wasm":{bytes:6818053},"scandit-datacapture-sdk-barcode-simd.wasm":{bytes:6697900},"scandit-datacapture-sdk-barcode.wasm":{bytes:6786220}};function M(t){return typeof t=="object"&&t!=null}function F(t){if(typeof t=="string")return t;if(M(t)){if(typeof t.message=="string")return t.message}else if(typeof t?.toString=="function")return t.toString();return"unknown error"}var l;(t=>{(d=>(d.Debug="debug",d.Info="info",d.Warn="warn",d.Error="error",d.Quiet="quiet"))(t.Level||(t.Level={}));let e=new Map([["debug",1],["info",2],["warn",3],["error",4],["quiet",5]]),a="debug";function r(d){a=d}t.setLevel=r;function i(d,...h){if(!(e.get(a)>e.get(d)))switch(d){case"debug":{console.debug(...h);break}case"info":{console.log(...h);break}case"warn":{console.warn(...h);break}case"error":{console.error(...h);break}}}t.log=i;function s(...d){i("warn",...d)}t.warn=s;function n(...d){i("debug",...d)}t.debug=n;function o(...d){i("info",...d)}t.info=o;function c(...d){i("error",...d)}t.error=c})(l||(l={}));var P=class ae extends Error{constructor(e){super(e.message),Object.setPrototypeOf(this,ae.prototype),this.name=e.name}toString(){return`${this.name}: ${this.message}`}};var I=Promise.resolve(),G=!1,$=!1,k,j={writableDataPath:""};async function re(t){if(k==null)return;G=!0;let e=new Promise((a,r)=>{setTimeout(()=>{r(new P({name:"BlockedIndexedDB",message:"IndexedDB database is blocked"}))},1500)});try{await Promise.race([new Promise((a,r)=>{k?.(t,i=>{if(i!=null){r(i);return}a()})}),e])}finally{G=!1}}async function ie(t){return $||(G?($=!0,I=I.then(async()=>($=!1,re(t)))):I=re(t)),I}async function se(t){j=t,k=FS.syncfs,FS.syncfs=(e,a)=>{let r=a,i=()=>{r()},s=n=>{r(n)};ie(e).then(i).catch(s)};try{FS.mkdir(j.writableDataPath)}catch(e){if(e.code!=="EEXIST")throw k=void 0,e}return FS.mount(IDBFS,{},j.writableDataPath),ie(!0)}var q=(t,e)=>(e=Symbol[t])?e:Symbol.for("Symbol."+t);var K=function(t,e){this[0]=t,this[1]=e},ne=(t,e,a)=>{var r=(n,o,c,d)=>{try{var h=a[n](o),g=(o=h.value)instanceof K,m=h.done;Promise.resolve(g?o[0]:o).then(b=>g?r(n==="return"?n:"next",o[1]?{done:b.done,value:b.value}:b,c,d):c({value:b,done:m})).catch(b=>r("throw",b,c,d))}catch(b){d(b)}},i=n=>s[n]=o=>new Promise((c,d)=>r(n,o,c,d)),s={};return a=a.apply(t,e),s[q("asyncIterator")]=()=>s,i("next"),i("throw"),i("return"),s},oe=(t,e,a)=>(e=t[q("asyncIterator")])?e.call(t):(t=t[q("iterator")](),e={},a=(r,i)=>(i=t[r])&&(e[r]=s=>new Promise((n,o,c)=>(s=i.call(t,s),c=s.done,Promise.resolve(s.value).then(d=>n({value:d,done:c}),o)))),a("next"),a("return"),e);var de={};function Le(t){return[...new Uint8Array(t)].map(e=>{let a=e.toString(16);return a.length===1?`0${a}`:a}).join("")}function Te(t){return ne(this,null,function*(){let e=t.getReader();try{for(;;){let{done:a,value:r}=yield new K(e.read());if(a)return;yield r}}finally{e.releaseLock()}})}async function We(t){let e=[],a=0,r=0;try{for(var i=oe(Te(t)),s,n,o;s=!(n=await i.next()).done;s=!1){let d=n.value;e.push(d),a+=d.length}}catch(d){o=[d]}finally{try{s&&(n=i.return)&&await n.call(i)}finally{if(o)throw o[0]}}let c=new Uint8Array(a);for(let d of e)c.set(d,r),r+=d.length;return c.buffer}var Ee=(t=>(t.VALID="VALID",t.INVALID="INVALID",t.NOT_VERIFIABLE="NOT_VERIFIABLE",t))(Ee||{});async function Ae(t,e,a){if(typeof crypto.subtle.digest!="function")return l.log(l.Level.Warn,`Insecure context (see https://developer.mozilla.org/en-US/docs/Web/Security/Secure_Contexts): The hash of the Scandit Data Capture library WASM file found at ${a} could not be verified`),"NOT_VERIFIABLE";try{let r=t instanceof Promise?await t:t,i=await crypto.subtle.digest("SHA-256",r),s=Le(i);return e==null?(l.log(l.Level.Warn,"The library hash is not defined or empty, cannot correctly verify integrity."),"NOT_VERIFIABLE"):s===e?(l.log(l.Level.Debug,`Data Capture library WASM integrity found at ${a} has been verified correctly.`),"VALID"):(l.log(l.Level.Warn,`The Scandit Data Capture library WASM file found at ${a} seems invalid: expected file hash doesn\'t match (received: ${s}, expected: ${e}). Please ensure the correct Scandit Data Capture file (with correct version) is retrieved.`),"INVALID")}catch(r){return l.log(l.Level.Warn,"Wasm response could not be verified",r),"NOT_VERIFIABLE"}}var X=new Map([["br",4.4],["gzip",2.9],["none",1]]);function Re(t){var e;let a="content-encoding";if(t==null||t.get(a)==null)return X.get("none");let r=new Set(((e=t.get(a))!=null?e:"").split(",").map(i=>i.trim()));for(let[i,s]of X)if(r.has(i))return s;return X.get("none")}function Ne(t){var e,a;if(t==null)return 0;let r=(e=Re(t))!=null?e:1,i=Number.parseInt((a=t.get("content-length"))!=null?a:"0",10);return Number.isNaN(i)?0:Math.floor(i*r*100)/100}function He(t){let{pathname:e}=new URL(t);for(let[a,r]of Object.entries(de))if(e.endsWith(a))return r.bytes;return 0}function ce(t){de=t}var _e=(t,e)=>{let a=Ne(e);return a===0?He(t):a};function ze(t,e,a,{onProgress:r,onError:i,onComplete:s}){if(!e.body)return[e];let n=_e(t,e.headers),o=0,c=0,[d,h]=a?e.body.tee():[e.body],g=d.pipeThrough(new TransformStream({async transform(m,b){try{o+=m.length,c=Number((o/n*100).toFixed(2)),n>0&&m.length>0&&c<100?r?.({percentage:c,loadedBytes:o,privateUri:t}):n===0&&m.length>0&&r?.({percentage:null,loadedBytes:o,privateUri:t}),b.enqueue(m)}catch(v){b.error(v),i?.({error:v})}},flush(m){r?.({percentage:100,loadedBytes:o,privateUri:t}),s?.({percentage:100,loadedBytes:o,privateUri:t}),m.terminate()}}));return[new Response(g,{headers:new Headers(e.headers),status:e.status,statusText:e.statusText}),h]}async function Y({wasmURI:t,expectedHash:e,verifyResponseHash:a,onProgress:r,onComplete:i,onError:s,referredOrigin:n}){let o=await fetch(t,{referrerPolicy:"origin",referrer:n??""});if(!o.ok)throw new Error(`HTTP status code is not ok: ${o.status}, ${o.statusText}`);let[c,d]=ze(t,o,a,{onProgress:r,onError:s,onComplete:i});return d!=null&&Ae(We(d),e,t),c}function le({wasmURI:t,expectedHash:e,verifyResponseHash:a,progressCallback:r,successCallback:i,importObject:s,referredOrigin:n}){async function o(d){try{let h=await Y({wasmURI:t,expectedHash:e,verifyResponseHash:a,onProgress:r,referredOrigin:n}),g=await(d??h).arrayBuffer(),m=await globalThis.WebAssembly.instantiate(g,s);i(m.instance,m.module)}catch(h){l.log(l.Level.Error,h),l.log(l.Level.Error,`Couldn\'t instantiate Scandit SDK DataCapture library at ${t}, did you configure the path for it correctly?`)}}async function c(){let d;try{d=await Y({wasmURI:t,expectedHash:e,verifyResponseHash:a,onProgress:r,referredOrigin:n});let h=await globalThis.WebAssembly.instantiateStreaming(d,s);i(h.instance,h.module)}catch(h){l.log(l.Level.Warn,h),l.log(l.Level.Warn,"WebAssembly streaming compile failed. Falling back to ArrayBuffer instantiation (this will make things slower)"),o(d?.bodyUsed===!0?void 0:d)}}typeof globalThis.WebAssembly.instantiateStreaming=="function"?c():o()}async function Z(t,e,a,r){return new Promise((i,s)=>{t().then(i).catch(n=>{let o=e*2;if(o>a){s(n);return}r(n),globalThis.setTimeout(()=>{Z(t,o,a,r).then(i).catch(s)},e)})})}function Q(t){var e,a;let r="";if((e=t.href)!=null&&e.startsWith("blob:null/"))r="localhost";else{let i=((a=t.pathname)==null?void 0:a.length)>1&&!t.pathname.startsWith("/");r=new URL(i?t.pathname:t.origin).hostname}return r.startsWith("[")&&r.endsWith("]")&&(r=r.slice(1,-1)),r}async function ue(t,e){async function a(){return importScripts(t)}try{await Z(a,250,4e3,i=>{l.log(l.Level.Warn,i),l.log(l.Level.Warn,`Couldn\'t retrieve Scandit Data Capture library at ${t}, retrying...`)}),self.Module.mainScriptUrlOrBlob=t;let r=globalThis.SDC_WASM_JS_VERSION;return r!==e&&l.log(l.Level.Warn,`The Scandit Data Capture library JS file found at ${t} seems invalid: expected version doesn\'t match (received: ${r}, expected: ${e}). Please ensure the correct Scandit Data Capture file (with correct version) is retrieved.`),!0}catch(r){return l.log(l.Level.Error,r),!1}}function Ve(t){return/^https?:\\/\\/(?:[^./]*\\.)*cdn.jsdelivr.net\\//.test(t)?{result:!0,cdnBaseURL:"https://cdn.jsdelivr.net/npm/"}:/^https?:\\/\\/(?:[^./]*\\.)*unpkg.com\\//.test(t)?{result:!0,cdnBaseURL:"https://unpkg.com/"}:{result:!1,cdnBaseURL:""}}function Je(t){let e=/@scandit\\/web-datacapture-[a-z]+/i.exec(t);return e?e[0]:null}function pe(t,e,a){let r=e,i=Ve(r);if(i.result){let n=Je(r);n!=null&&(r=`${i.cdnBaseURL}${n}@${t}/sdc-lib/`)}let s=a.replace(".wasm","");return i.result?{jsURI:`${r}${s}.js`,wasmURI:`${r}${s}.wasm`}:{jsURI:`${r}${s}.js?v=${t}`,wasmURI:`${r}${s}.wasm?v=${t}`}}var L;(t=>{function e(){return"7.2.1"}t.sdkVersion=e})(L||(L={}));var he=class{constructor(){this.promise=new Promise((t,e)=>{this.reject=e,this.resolve=t})}};var Ue=async()=>WebAssembly.validate(new Uint8Array([0,97,115,109,1,0,0,0,1,5,1,96,0,1,123,3,2,1,0,10,10,1,8,0,65,0,253,15,253,98,11])),$e=()=>(async t=>{try{return typeof MessageChannel<"u"&&new MessageChannel().port1.postMessage(new SharedArrayBuffer(1)),WebAssembly.validate(t)}catch{return!1}})(new Uint8Array([0,97,115,109,1,0,0,0,1,4,1,96,0,0,3,2,1,0,5,4,1,3,1,1,10,11,1,9,0,65,0,254,16,2,0,26,11]));function je(){return typeof crossOriginIsolated>"u"?!1:crossOriginIsolated}function Ge(){try{return new WebAssembly.Memory({initial:1,maximum:1,shared:!0}).buffer.constructor.name==="SharedArrayBuffer"}catch{return!1}}async function me(){return Ue()}async function qe(){if(!await $e())return!1;let t=null;try{t=new Worker(URL.createObjectURL(new Blob([\'postMessage("Worker" in self);\'],{type:"text/javascript"})),{name:"nestedWorkerTest"})}catch{return!1}return new Promise(e=>{if(t==null){e(!1);return}t.onmessage=a=>{t?.terminate(),e(a.data)}})}async function be(){let t=await qe();return je()&&Ge()&&t}var ge=class fe{constructor(e,a){this.hintPresenterV2=null,this.MAX_NUMBER_OF_IMAGES_IN_FRAME_DATA_POOL=10,this.redrawInterval=1e3/30,this.redrawRequests=[],this._isDrawLoopRunning=!1,this.frameDataPool=new Map,this.lastFrameCounter=-1,this.poorMansBenchmarkLogs=!1,this.writableDataPathStandard="/scandit_sync_folder",this.resourceFilesSubfolder="resources",this.performanceMetricsReporterTimer=void 0,this.performanceMetrics={frameDataPoolSize:0,processedFramesCount:0,redrawRequestsCount:0,actualRedrawsCount:0},this.gestureListener=null,this.webPlatformHintPresenter=null,this.moduleHandler=e,this.workerFunctions=a,this._loadProgressCallback=this._loadProgressCallback.bind(this),ce(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}convertToLoadableFrameData(e){let a=this.getNextFrameId();this.frameDataPool.set(a,new Uint8ClampedArray(e.getFrameData()));let r=this.lastUsedModuleMirrorAxis==null?!1:this.lastUsedModuleMirrorAxis!==this.Module.Axis.None;return{frameId:a,width:e.getWidth(),height:e.getHeight(),isFrameSourceMirrored:r}}createContext(e){var a,r,i,s,n;let o=this.getModeDeserializers(),c=Q(location);(c==="localhost"||c==="127.0.0.1")&&navigator.userAgent.includes("Electron")&&e.appName!=null&&(c+=`-${e.appName}`),this.parentDomain=e.parentDomain,this.contextDeserializer=new this.Module.DataCaptureContextDeserializer(this.writableDataPath,e.deviceId,e.context.deviceModelName,c,this.parentDomain,o,e.delayedRegistration,e.highEndBlurryRecognition,this.resourcePath);let d=this.contextDeserializer.contextFromJson(JSON.stringify(e.context));if(d==null){let u=this.contextDeserializer.getLastError();throw new Error(`Could not create the context: ${u}`)}let h=d.getView();this.context=d.getContext(),d.delete();let g=this.Module.DataCaptureContextListener.extend("DataCaptureContextListener",{didChangeStatus:(u,f)=>{this.contextDidChangeStatus(JSON.parse(f.toJson())),u.delete()},didStartObservingContext:u=>{this.didStartObservingContext(),u.delete()},didStopObservingContext:u=>{u.delete()}}),m=this.Module.DataCaptureContextFrameListener.extend("DataCaptureContextFrameListener",{onObservationStarted:u=>{u.delete()},onObservationStopped:u=>{u.delete()},onFrameProcessingStarted:(u,f)=>{this.workerFunctions.postMessage({type:"onFrameProcessingStarted"}),f.delete(),u.delete()},onFrameProcessingFinished:(u,f)=>{this.workerFunctions.postMessage({type:"onFrameProcessingFinished"}),f.delete(),u.delete()},onFrameSkipped:(u,f)=>{this.workerFunctions.postMessage({type:"onFrameSkipped"}),f.delete(),u.delete()}}),b=this.Module.GestureRecognizer.extend("GestureRecognizer",{setGestureListener:(u,f)=>{var O;(O=this.gestureListener)==null||O.delete(),this.gestureListener=u.clone(),u.delete()}});(a=this.gestureRecognizer)==null||a.delete(),this.gestureRecognizer=new b;let v=new g;this.context.addListener(v),v.delete();let w=new m;this.context.addFrameListener(w),w.delete(),this.setView(h),(r=this.view)==null||r.setGestureRecognizer(this.gestureRecognizer);let C=this.Module.PlatformHintPresenter.extend("PlatformHintPresenter",{setHintPresenter:u=>{u.delete()},showToast:u=>{this.workerFunctions.postMessage({type:"showToast",payload:JSON.parse(u)})},hideToast:u=>{this.workerFunctions.postMessage({type:"hideToast",payload:JSON.parse(u)})},showGuidance:u=>{this.workerFunctions.postMessage({type:"showGuidance",payload:JSON.parse(u)})},hideGuidance:u=>{this.workerFunctions.postMessage({type:"hideGuidance",payload:JSON.parse(u)})},startUpdateTimer:u=>{this.workerFunctions.postMessage({type:"startUpdateTimer",payload:{duration:{unit:"ms",value:u}}})},stopUpdateTimer:()=>{this.workerFunctions.postMessage({type:"stopUpdateTimer"})}});(i=this.hintPresenterV2)==null||i.delete(),(s=this.webPlatformHintPresenter)==null||s.delete(),this.webPlatformHintPresenter=new C,this.hintPresenterV2=new this.Module.HintPresenterV2(this.webPlatformHintPresenter),(n=this.view)==null||n.setHintPresenterV2(this.hintPresenterV2)}onTap(e){var a;(a=this.gestureListener)==null||a.onTap(JSON.stringify(e))}hintPresenterV2Update(){var e;(e=this.hintPresenterV2)==null||e.update()}startReportingPerformanceMetrics(){this.performanceMetricsReporterTimer==null&&(this.performanceMetricsReporterTimer=setInterval(()=>{this.reportPerformanceMetrics();for(let e of Object.keys(this.performanceMetrics))this.performanceMetrics[e]=0},1e3))}async reportPerformanceMetrics(){this.workerFunctions.postMessage({type:"performanceMetricsReport",payload:{...this.performanceMetrics}})}deleteFrameData(e){this.frameDataPool.delete(e)}dispose(){var e,a;this.context.dispose(),this.frameDataPool.clear(),this.isDrawLoopRunning=!1,this.lastFrameCounter=-1,(e=this.gestureRecognizer)==null||e.delete(),this.gestureRecognizer=null,(a=this.gestureListener)==null||a.delete(),this.gestureListener=null}flushAnalytics(){this.context.flushAnalytics()}extractCentaurusLicense(e){return{payload:{centaurus:{licenseKey:this.Module.LicenseUtils[fe.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 a;if(this.context==null)return{payload:e,transferables:[e.data.buffer]};let r=e.data,i=e.colorType==="GRAYSCALE"?this.Module.ImageBufferFormat.Grayscale8:this.Module.ImageBufferFormat.Rgba8888,s=this.Module.allocateUint8Array(r.byteLength);return this.Module.HEAPU8.set(r,s),(a=this.imageFrameSource)==null||a.outputFrame(s,e.width,e.height,i),{payload:e,transferables:[e.data.buffer]}}reportCameraProperties(e){this.context.setCameraProperties(e.deviceId,e.isFrontFacing,e.hasAutofocus)}requestFrameData(e){let a=this.frameDataPool.get(e);return a==null?{payload:{data:null}}:{payload:{data:a},transferables:[a.buffer]}}scheduleRedraw(e,a){this.addRedrawRequest(a),this.isDrawLoopRunning||this.startDrawLoop(e)}sendViewRefreshCommands(e){this.workerFunctions.postMessage({type:"draw",payload:e},[e.buffer])}setFrameSource(e,a){var r;this.lastUsedModuleMirrorAxis=this.mapMirrorAxisOnModule(e),(r=this.imageFrameSource)==null||r.delete(),this.imageFrameSource=new this.Module.ImageBufferFrameSource(this.lastUsedModuleMirrorAxis,a,0),this.context.setFrameSource(this.imageFrameSource)}startDrawLoop(e){this.isDrawLoopRunning=!0;let a=s=>this.redrawRequests.length>0&&this.redrawRequests[0]<=s,r=s=>{for(;this.redrawRequests.length>0&&this.redrawRequests[0]<=s;)this.redrawRequests.shift()},i=()=>{this.loopTimeoutId=setTimeout(()=>{if(!this.isDrawLoopRunning)return;let s=performance.now();if(a(s)){r(s),e.draw();let n=e.getDrawCommands();this.sendViewRefreshCommands(new Uint8Array(n))}i()},this.redrawInterval)};i()}updateContext(e){if(this.context!=null&&this.contextDeserializer!=null){e.view!=null&&!e.view.visible&&this.context.flushAnalytics();let a=this.onBeforeUpdateContextHook(e),r=this.contextDeserializer.updateContextFromJson(this.context,this.view,JSON.stringify(a.context));if(r==null){let s=this.contextDeserializer.getLastError();throw new Error(`Could not update the context: ${s}`)}this.context.delete(),this.context=r.getContext();let i=r.getView();r.delete(),i!=null&&a.view!=null&&i.setViewSize(a.view.width,a.view.height,a.view.orientation),this.hintPresenterV2!=null&&i?.setHintPresenterV2(this.hintPresenterV2),this.gestureRecognizer!=null&&i?.setGestureRecognizer(this.gestureRecognizer),this.setView(i),l.debug("context updated",a)}}onBeforeUpdateContextHook(e){return e}onDocumentVisibilityChange(e){e==="hidden"&&this.context.flushAnalytics()}isFeatureSupported(e){return{payload:{supported:this.context.isFeatureSupported(e)}}}getViewfinderInfo(){var e,a;return{payload:{isDisplayingViewfinder:(a=(e=this.view)==null?void 0:e.isDisplayingViewfinder())!=null?a:!1,rect:JSON.parse(this.view.getViewfinderRect())}}}getOpenSourceSoftwareLicenseInfo(){return{payload:{licenseText:this.Module.OpenSourceSoftwareLicenseInfo.getLicenseText()}}}getNextFrameId(){return this.lastFrameCounter++,this.lastFrameCounter>=this.MAX_NUMBER_OF_IMAGES_IN_FRAME_DATA_POOL&&(this.lastFrameCounter=0),this.lastFrameCounter}getWasmDynamicLibraries(e){return this.getWasmSideModuleFileName()==null?[]:[`${e.replace(/\\/[^/]*$/,"/")}${this.getWasmSideModuleFileName()}`]}getWasmCoreExpectedHash(e,a){return a?e?"ac71af99bcfd4aad0e5e3beba1cc6e6dff7c585362221d7bf3cd17a46ef02dcb":"4d068ed97dfc8d46adf179bf9584aaacd4a3cff4da477942a5241d44e5f5471f":e?"b33512d5eb5e0cb439a01424f641caa2d3244cce8a529ff3320a043bfe570d5c":""}getWasmCoreFileName(e,a){return a?e?"scandit-datacapture-sdk-barcode-simd-pthreads.wasm":"scandit-datacapture-sdk-barcode-pthreads.wasm":e?"scandit-datacapture-sdk-barcode-simd.wasm":""}getWasmMetadata(){return p}getWasmSideModuleFileName(){return""}_loadProgressCallback(e){this.workerFunctions.postMessage({type:"loadLibraryProgress",payload:e})}addRedrawRequest(e){this.redrawRequests.push(Math.round(performance.now())+e),this.redrawRequests.sort((a,r)=>a-r)}contextDidChangeStatus(e){e.code===260?e.message=e.message.replace("domain name",`domain name (${Q(location)})`):e.code===265&&(e.message=e.message.replace("domain name",`domain name (${this.parentDomain})`)),this.workerFunctions.postMessage({type:"contextDidChangeStatus",payload:e})}didStartObservingContext(){this.workerFunctions.postMessage({type:"didStartObservingContext"})}mapMirrorAxisOnModule(e){switch(e){case"None":return this.Module.Axis.None;case"X":return this.Module.Axis.X;case"Y":return this.Module.Axis.Y;default:return this.Module.Axis.None}}setView(e){this.view=e,this.setViewRefreshHandler(e),e==null&&(this.isDrawLoopRunning=!1,this.sendViewRefreshCommands(new Uint8Array([])))}addNativeOverlay(e){l.warn("addNativeOverlay has not been implemented for this module",e)}removeNativeOverlay(e){l.warn("removeNativeOverlay has not been implemented for this module",e)}setViewRefreshHandler(e){if(e==null||e.isViewRefreshHandlerSet)return;let a=this.Module.NeedsRedrawDelegate.extend("NeedsRedrawDelegate",{setNeedsRedrawIn:this.scheduleRedraw.bind(this,e)}),r=new a;e.setNeedsRedrawDelegate(r),e.isViewRefreshHandlerSet=!0}setupDataDecoding(){let e=this.moduleHandler.get(),a=e.DataDecoding.extend("DataDecoding",{decode(r,i){try{let s=JSON.parse(i),n=[];for(let o of s){let c=new TextDecoder(o.ianaName,{fatal:!0});n.push(c.decode(r.slice(o.startIndex,o.endIndex)))}return n.join("")}catch{return""}}});e.setDataDecoding(new a)}start(e,a,r){e&&a&&(this.setupDataDecoding(),this.moduleHandler.get().callMain(),this.moduleHandler.get().__emscripten_proxy_main!==void 0||r())}getWritableDataPath(e){return e!=null?(l.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:a,writableDataPathOverride:r,overrideThreadsSupport:i,overrideSimdSupport:s,verifyResponseHash:n,referredOrigin:o,fixedWasmMemory:c}){var d;let h=!1,g=!1;this.writableDataPath=this.getWritableDataPath(r),this.resourcePath=`${e}${this.resourceFilesSubfolder}/`,globalThis.path=a;let{resolve:m,reject:b,promise:v}=new he,w=L.sdkVersion();if(w==="")throw new P({name:"Invalid library version",message:"Library version is not defined or empty, cannot generate proper path to library files."});let[C,u]=await Promise.all([me(),be()]);i!=="auto"&&(u=i==="on"),s!=="auto"&&(C=s==="on");let f=this.getWasmCoreFileName(C,u),O=pe(w,e,f),{jsURI:U,wasmURI:te}=O,Be={instantiateWasm:(S,Pe)=>(le({importObject:S,wasmURI:te,expectedHash:this.getWasmCoreExpectedHash(C,u),verifyResponseHash:n,successCallback:Pe,progressCallback:this._loadProgressCallback,referredOrigin:o}),{})},B=c===null?null:new WebAssembly.Memory({initial:this.numOfMBToPages(c),maximum:this.numOfMBToPages(300),shared:u});return B!==null&&l.log(l.Level.Debug,"Fixed wasmMemory set",B),this.moduleHandler.set({...B?{wasmMemory:B}:{},mainScriptUrlOrBlob:U,canvas:(d=this.workerFunctions.getOffscreenCanvas())!=null?d:{getContext:()=>null},...Be,dynamicLibraries:this.getWasmDynamicLibraries(te),locateFile:S=>e+S,noInitialRun:!0,preRun:[async()=>{try{await se({writableDataPath:this.writableDataPath})}catch(S){if(S.name==="BlockedIndexedDB"){b(S.toString());return}l.log(l.Level.Debug,"No IndexedDB support, some data will not be persisted:",S)}g=!0,this.start(g,h,m)}],onMainComplete:()=>{if([h,g].includes(!1)){l.log(l.Level.Warn,{runtimeLoaded:h,fileSystemSynced:g},"Both runtimeLoaded and fileSystemSynced should be true when calling onMainComplete"),b("onMainComplete has been called but runtime or file system was not ready.");return}m()},onRuntimeInitialized:()=>{h=!0,this.start(g,h,m)},print:S=>{l.log(l.Level.Info,S)}}),await ue(U,w)||b(`Couldn\'t retrieve Scandit Data Capture library at ${U}, did you configure the path for it correctly?`),v}};ge.get3dPartyLicenseKeyMethodName=atob("Z2V0QmxpbmtJZExpY2Vuc2VLZXk=");var D=ge;function ye(t){return typeof t=="object"&&t!=null&&t.document==null&&"addEventListener"in t&&typeof t.importScripts=="function"}function Se(t){console.warn("Reached unexpected case",t)}var ee=class{constructor(t,e){this.onMessageListener=this.onMessage.bind(this),this.workerSelf=t,this.dataCaptureInstance=new D(e,{postMessage:this.postMessage.bind(this),getOffscreenCanvas:this.getOffscreenCanvas.bind(this)}),ye(t)&&this.listenToMessages()}listenToMessages(){this.workerSelf.addEventListener("message",this.onMessageListener),this.workerSelf.addEventListener("error",t=>{l.log(l.Level.Error,t)}),this.workerSelf.addEventListener("messageerror",t=>{l.log(l.Level.Error,t)})}postMessage(t,e){this.workerSelf.postMessage(t,e??[])}getOffscreenCanvas(){if(typeof this.workerSelf.OffscreenCanvas=="function")return new this.workerSelf.OffscreenCanvas(32,32)}hasPayload(t){return M(t)&&"payload"in t}hasTransferables(t){return M(t)&&Array.isArray(t.transferables)}async respondWith(t,e,a){let r=null,i;try{i=a(),i instanceof Promise&&(i=await i)}catch(n){i=void 0,r=F(n)}let s={type:"workerTaskId",command:t,id:e,payload:this.hasPayload(i)?i.payload:void 0};r!=null&&(s.error=r),this.postMessage(s,this.hasTransferables(i)?i.transferables:[])}onMessage(t){switch(t.data.command){case"loadLibrary":{{let{data:e}=t;this.respondWith(e.command,e.id,async()=>this.dataCaptureInstance.loadLibrary({libraryLocation:e.libraryLocation,locationPath:e.locationPath,referredOrigin:e.referredOrigin,writableDataPathOverride:e.writableDataPathOverride,overrideThreadsSupport:e.overrideThreadsSupport,overrideSimdSupport:e.overrideSimdSupport,verifyResponseHash:e.verifyResponseHash,fixedWasmMemory:e.fixedWasmMemory}))}break}case"onTap":{{let{data:e}=t;this.respondWith(e.command,e.id,async()=>{this.dataCaptureInstance.onTap(e.point)})}break}case"hintPresenterV2update":{{let{data:e}=t;this.respondWith(e.command,e.id,async()=>{this.dataCaptureInstance.hintPresenterV2Update()})}break}case"createContext":{{let{data:e}=t;this.respondWith(e.command,e.id,()=>this.dataCaptureInstance.createContext({context:e.context,deviceId:e.deviceId,delayedRegistration:e.delayedRegistration,highEndBlurryRecognition:e.highEndBlurryRecognition,appName:e.appName,parentDomain:e.parentDomain}))}break}case"setFrameSource":{{let{data:e}=t;this.respondWith(e.command,e.id,()=>this.dataCaptureInstance.setFrameSource(e.mirrorAxis,e.isCameraFrameSource))}break}case"processFrame":{{let{data:e}=t;this.respondWith(e.command,e.id,()=>this.dataCaptureInstance.processFrame({data:e.data,width:e.width,height:e.height,colorType:e.colorType}))}break}case"requestFrameData":{{let{data:e}=t;this.respondWith(e.command,e.id,()=>this.dataCaptureInstance.requestFrameData(e.frameId))}break}case"deleteFrameData":{{let{data:e}=t;this.respondWith(e.command,e.id,()=>{this.dataCaptureInstance.deleteFrameData(e.frameId)})}break}case"updateContext":{{let{data:e}=t;this.respondWith(e.command,e.id,async()=>this.dataCaptureInstance.updateContext(e))}break}case"dispose":{this.respondWith(t.data.command,t.data.id,()=>this.dataCaptureInstance.dispose());break}case"flushAnalytics":{this.respondWith(t.data.command,t.data.id,()=>{this.dataCaptureInstance.flushAnalytics()});break}case"reportCameraProperties":{{let{data:e}=t;this.respondWith(e.command,e.id,async()=>this.dataCaptureInstance.reportCameraProperties(e))}break}case"setLogLevel":{{let{data:e}=t;this.respondWith(e.command,e.id,()=>{l.setLevel(e.level)})}break}case"extractCentaurusLicense":{{let{data:e}=t;this.respondWith(e.command,e.id,()=>this.dataCaptureInstance.extractCentaurusLicense(e.licenseKey))}break}case"documentVisibility":{{let{data:e}=t;this.respondWith(e.command,e.id,()=>{this.dataCaptureInstance.onDocumentVisibilityChange(e.state)})}break}case"isFeatureSupported":{{let{data:e}=t;this.respondWith(e.command,e.id,()=>this.dataCaptureInstance.isFeatureSupported(e.feature))}break}case"getViewfinderInfo":{{let{data:e}=t;this.respondWith(e.command,e.id,()=>this.dataCaptureInstance.getViewfinderInfo())}break}case"getOpenSourceSoftwareLicenseInfo":{{let{data:e}=t;this.respondWith(e.command,e.id,()=>this.dataCaptureInstance.getOpenSourceSoftwareLicenseInfo())}break}case"addNativeOverlay":this.dataCaptureInstance.addNativeOverlay(t);break;case"removeNativeOverlay":this.dataCaptureInstance.removeNativeOverlay(t);break;default:return Se(t.data),!1}return!0}};var ve=(t=>(t.Body="body",t.Footnote="footnote",t))(ve||{}),T=(t=>(t.Start="start",t.Center="center",t.End="end",t))(T||{}),we=(t=>(t.Normal="normal",t.Wider="wider",t.FitText="fitText",t))(we||{}),Ce=(t=>(t.Normal="normal",t.Taller="taller",t))(Ce||{}),Me=(t=>(t.Square="square",t.Rounded="rounded",t))(Me||{}),W=(t=>(t.None="none",t.Check="check",t.ExclamationMark="exclamationMark",t))(W||{}),E=(t=>(t.Top="top",t.AboveViewFinder="aboveViewFinder",t.BelowViewFinder="belowViewFinder",t))(E||{}),Fe=(t=>(t.AboveViewFinder="aboveViewFinder",t.BelowViewFinder="belowViewFinder",t))(Fe||{}),ke=(t=>(t.BlackOnWhite="blackOnWhite",t.WhiteOnBlack="whiteOnBlack",t.Transparent="transparent",t))(ke||{}),x=(t=>(t.Success="success",t.Error="error",t.Warning="warning",t.Info="info",t.Notification="notification",t))(x||{}),De=(t=>(t[t.Ocr=0]="Ocr",t[t.HideLogo=1]="HideLogo",t[t.ShowTestLicenseMessage=2]="ShowTestLicenseMessage",t[t.AugmentedReality=5]="AugmentedReality",t[t.ActivityPingStatsAddon=8]="ActivityPingStatsAddon",t[t.ActivityPing=9]="ActivityPing",t[t.Registration=10]="Registration",t[t.Parser=11]="Parser",t[t.BarcodeCapture=14]="BarcodeCapture",t[t.Analytics=17]="Analytics",t[t.AnalyticsBatchMode=18]="AnalyticsBatchMode",t[t.AnalyticsScanContent=19]="AnalyticsScanContent",t[t.AnalyticsOnlineVerification=20]="AnalyticsOnlineVerification",t[t.SparkScan=21]="SparkScan",t[t.AamvaIdBarcodeVerification=22]="AamvaIdBarcodeVerification",t[t.MappingForTracking=23]="MappingForTracking",t[t.BarcodeFind=24]="BarcodeFind",t[t.MandatoryRegistration=25]="MandatoryRegistration",t[t.FeatureTracking=26]="FeatureTracking",t[t.IdCaptureViz=27]="IdCaptureViz",t[t.IdCaptureMrz=28]="IdCaptureMrz",t[t.IdCaptureBarcode=29]="IdCaptureBarcode",t[t.BarcodeSelectionAimToScan=30]="BarcodeSelectionAimToScan",t[t.BarcodeSelectionTapToScan=31]="BarcodeSelectionTapToScan",t[t.BarcodeCount=32]="BarcodeCount",t[t.BarcodePick=33]="BarcodePick",t[t.IdVerificationDataComparison=34]="IdVerificationDataComparison",t[t.SmartLabelBarcode=35]="SmartLabelBarcode",t[t.SmartLabelText=36]="SmartLabelText",t[t.VoidedIdDetection=37]="VoidedIdDetection",t[t.BarcodeArFull=38]="BarcodeArFull",t))(De||{});var A=class{constructor(e,a,r){this.trackingListenerSet=!1;this.coreEngine=e,this.Module=a,this.workerFunctions=r,this.setup()}barcodeBatchDidUpdateSession(e){this.workerFunctions.postMessage({type:"barcodeBatchDidUpdateSession",payload:JSON.parse(e.toJson())})}getBatchDeserializer(){return this.barcodeBatchDeserializer}setup(){let e=this.Module.BarcodeBatchListener.extend("BarcodeTrackingListener",{didUpdateSession:(r,i,s)=>{this.barcodeBatchDidUpdateSession(i),r.delete(),i.delete(),s.delete()},onTrackedBarcodeTapped:(r,i)=>{this.onTrackedBarcodeTapped(i),r.delete(),i.delete()}}),a=this.Module.BarcodeBatchDeserializerListener.extend("BarcodeTrackingDeserializerListener",{onModeDeserializationFinished:(r,i,s)=>{this.trackingListenerSet||(i.addListener(new e,1),this.trackingListenerSet=!0),r.delete(),i.delete(),s.delete()},onModeDeserializationStarted(r,i,s){r.delete(),i.delete(),s.delete()},onSettingsDeserializationStarted(r,i,s){r.delete(),i.delete(),s.delete()},onSettingsDeserializationFinished(r,i,s){r.delete(),i.delete(),s.delete()}});this.barcodeBatchDeserializer=new this.Module.BarcodeBatchDeserializer,this.barcodeBatchDeserializer.setListener(new a)}onTrackedBarcodeTapped(e){this.workerFunctions.postMessage({type:"didTapTrackedBarcode",payload:JSON.parse(e.toJson())})}};var R=class{constructor(e,a,r){this.captureListenerSet=!1;this.coreEngine=e,this.Module=a,this.workerFunctions=r,this.setup()}barcodeCaptureDidUpdateSession(e){this.workerFunctions.postMessage({type:"barcodeCaptureDidUpdateSession",payload:JSON.parse(e.toJson())})}barcodeBatchDidUpdateSession(e){this.workerFunctions.postMessage({type:"barcodeBatchDidUpdateSession",payload:JSON.parse(e.toJson())})}getCaptureDeserializer(){return this.barcodeCaptureDeserializer}getTrackingDeserializer(){return this.barcodeBatchDeserializer}setup(){let e=this.Module.BarcodeCaptureListener.extend("BarcodeCaptureListener",{didScan:(n,o,c)=>{this.barcodeCaptureDidScan(o,c),n.delete(),c.delete(),o.delete()},didUpdateSession:(n,o,c)=>{this.barcodeCaptureDidUpdateSession(o),n.delete(),c.delete(),o.delete()}}),a=this.Module.Feedback.extend("Feedback",{emit:()=>{this.successFeedback()}}),r=new e,i=new a,s=this.Module.BarcodeCaptureDeserializerListener.extend("BarcodeCaptureDeserializerListener",{onModeDeserializationFinished:(n,o,c)=>{o.addListener(r,1),o.setSuccessFeedback(i),n.delete(),o.delete(),c.delete()},onModeDeserializationStarted(n,o,c){n.delete(),o.delete(),c.delete()},onSettingsDeserializationStarted(n,o,c){n.delete(),o.delete(),c.delete()},onSettingsDeserializationFinished(n,o,c){n.delete(),o.delete(),c.delete()}});this.barcodeCaptureDeserializer=new this.Module.BarcodeCaptureDeserializer,this.barcodeCaptureDeserializer.setListener(new s)}successFeedback(){this.workerFunctions.postMessage({type:"successFeedback"})}barcodeCaptureDidScan(e,a){let r=this.coreEngine.convertToLoadableFrameData(a);this.workerFunctions.postMessage({type:"barcodeCaptureDidScan",payload:{session:JSON.parse(e.toJson()),frameData:r}})}};var N=class{constructor(e,a,r){this.barcodeCheck=null;this.coreEngine=e,this.Module=a,this.workerFunctions=r}async forSettings(e){this.barcodeCheck?.delete(),this.barcodeCheck=new this.Module.BarcodeCheck(this.coreEngine.context,JSON.stringify(e));let a=this.Module.BarcodeCheckListener.extend("BarcodeCheckListener",{didUpdateSession:(r,i,s)=>{let n=this.coreEngine.convertToLoadableFrameData(s);this.workerFunctions.postMessage({type:"barcodeCheckDidUpdateSession",payload:{session:JSON.parse(i.toJson()),frameData:n}}),r.delete(),i.delete(),s.delete()}});this.barcodeCheck.addListener(new a,1),this.Module.addBarcodeCheckToContext(this.coreEngine.context,this.barcodeCheck)}start(){this.barcodeCheck?.start()}pause(){this.barcodeCheck?.pause()}stop(){this.barcodeCheck?.stop()}setEnabled(e){this.barcodeCheck?.setEnabled(e)}async removeMode(){this.barcodeCheck!=null&&this.Module.removeBarcodeCheckFromContext(this.coreEngine.context,this.barcodeCheck)}applySettings(e){this.barcodeCheck?.applySettings(JSON.stringify(e))}};function Ke(t){return t.charAt(0).toUpperCase()+t.slice(1)}function xe(t){return t}var H=class{constructor(e,a,r){this.barcodeFind=null;this.basicOverlay=null;this.transparentGuidanceHintStyle={backgroundColor:"00000000",cornerRadius:4,fitToText:!1,isAnimatedToView:!1,textAlignment:T.Center,hintIcon:W.None,hintAnchor:E.AboveViewFinder,hintAnchorOffset:-12,horizontalMargin:0,iconColor:"00000000",lineHeight:-1,maxLines:1,maxWidthFraction:.8,textColor:"ffffffff",textSize:15,textWeight:600};this.customerTransformation=xe;this.coreEngine=e,this.Module=a,this.workerFunctions=r}async forSettings(e){this.barcodeFind?.delete(),this.barcodeFind=new this.Module.BarcodeFind(this.coreEngine.context,JSON.stringify(e));let a=this.Module.Feedback.extend("Feedback",{emit:()=>{this.listUpdatedFeedback()}}),r=this.Module.Feedback.extend("Feedback",{emit:()=>{this.barcodeFindFeedback()}}),i=this.Module.BarcodeFindTransformer.extend("BarcodeFindTransformer",{transformBarcodeData:n=>this.customerTransformation(n)}),s=this.Module.BarcodeFindListener.extend("BarcodeFindListener",{didUpdateSession:(n,o,c)=>{let d=this.coreEngine.convertToLoadableFrameData(c);this.workerFunctions.postMessage({type:"barcodeFindDidUpdateSession",payload:{session:JSON.parse(o.toJson()),frameData:d}}),n.delete(),o.delete(),c.delete()},onSearchPaused:n=>{let o=[];for(let c=0;c<n.size();c++)o.push(n.get(c));this.workerFunctions.postMessage({type:"barcodeFindSearchPaused",payload:{foundItems:o}})},onSearchStopped:n=>{let o=[];for(let c=0;c<n.size();c++)o.push(n.get(c));this.workerFunctions.postMessage({type:"barcodeFindSearchStopped",payload:{foundItems:o}})},onSearchStarted:()=>{this.workerFunctions.postMessage({type:"barcodeFindSearchStarted",payload:{}})}});this.barcodeFind.setBarcodeFindTransformer(new i),this.barcodeFind.addListener(new s,1),this.barcodeFind.setItemListUpdatedFeedback(new a),this.barcodeFind.setFeedback(new r),this.Module.addBarcodeFindToContext(this.coreEngine.context,this.barcodeFind)}barcodeFindFeedback(){this.workerFunctions.postMessage({type:"barcodeFindFeedback",payload:{}})}start(){this.barcodeFind?.start()}stop(){this.barcodeFind?.stop()}pause(){this.barcodeFind?.pause()}setEnabled(e){this.barcodeFind?.setEnabled(e)}setItemList(e){this.barcodeFind?.setItemList(JSON.stringify(e))}async removeMode(){this.barcodeFind!=null&&this.Module.removeBarcodeFindFromContext(this.coreEngine.context,this.barcodeFind)}addBasicOverlay(){this.basicOverlay?.delete(),this.basicOverlay=null,this.barcodeFind!=null&&(this.basicOverlay=new this.Module.BarcodeFindBasicOverlay(this.barcodeFind)),this.coreEngine.view!=null&&this.basicOverlay!=null&&(this.basicOverlay.setGuidanceHandler(this.createWebFindGuidanceHandler()),this.Module.addBarcodeFindBasicOverlayToView(this.coreEngine.view,this.basicOverlay))}removeBasicOverlay(){this.coreEngine.view!=null&&this.basicOverlay!=null&&this.Module.removeBarcodeFindBasicOverlayFromView(this.coreEngine.view,this.basicOverlay)}async applySettings(e){this.barcodeFind?.applySettings(JSON.stringify(e))}updateBasicOverlay(e){let a=Object.entries(e).filter(([r,i])=>r!=="type");for(let[r,i]of a){let s=`set${Ke(r)}`;this.basicOverlay!=null&&typeof this.basicOverlay[s]=="function"&&i!=null&&this.basicOverlay[s](i)}}setTransformerFunction(e){this.customerTransformation=e??xe}successFeedback(){this.workerFunctions.postMessage({type:"successFeedback"})}listUpdatedFeedback(){this.workerFunctions.postMessage({type:"barcodeFindListUpdatedFeedback",payload:{}})}setToast(e,a){let r=this.coreEngine.hintPresenterV2;e?r?.showToast(JSON.stringify(a)):r?.hideToast(a.tag)}setGuidance(e,a,r){let i={tag:r,text:a,hintStyle:this.transparentGuidanceHintStyle};this.workerFunctions.postMessage({type:e?"showGuidance":"hideGuidance",payload:i})}createWebFindGuidanceHandler(){let e=this.Module.BarcodeFindGuidanceHandler.extend("BarcodeFindGuidanceHandler",{setInitialGuidance:(a,r)=>{this.setGuidance(a,r,"InitialGuidance")},setMoveCloserGuidance:(a,r)=>{this.setGuidance(!1,r,"InitialGuidance"),this.setGuidance(a,r,"MoveCloserGuidance")},setAllItemsFound:(a,r)=>{let i={text:r,toastHintStyle:x.Success,tag:"AllItemsFound"};this.setToast(a,i)},setTapShutterToPause:(a,r)=>{this.setGuidance(!1,r,"InitialGuidance"),this.setGuidance(a,r,"TapShutterToPause")},setTapShutterToResume:(a,r)=>{this.setGuidance(!1,r,"InitialGuidance"),this.setGuidance(a,r,"TapShutterResume")},setItemListUpdated:(a,r)=>{let i={text:r,toastHintStyle:x.Info,tag:"ItemListUpdated"};this.setToast(a,i)}});return new e}};var y=class{constructor(e){this.subscribers=new Set;this.property={key:e,value:null}}addSubscriber(e){this.subscribers.add(e),e.onPropertyChanged?.(this.property)}removeSubscriber(e){this.subscribers.delete(e)}setProperty(e){if(this.property.value!==e.value){this.property={key:this.property.key,value:e.value};for(let a of this.subscribers)a.onPropertyChanged?.(this.property)}}};var Xe={torch_state:new y("torch_state"),scanning_mode:new y("scanning_mode"),sound_enabled:new y("sound_enabled"),haptic_enabled:new y("haptic_enabled"),hand_mode:new y("hand_mode"),session_stop_reason:new y("session_stop_reason"),camera_position:new y("camera_position")},_=class{getBehaviorSubject(e){return Xe[e]}};var z=class{constructor(e,a,r){this.captureListenerSet=!1;this.propertyPushSource=new _;this.coreEngine=e,this.Module=a,this.workerFunctions=r,this.setup()}sparkScanDidUpdateSession(e){this.workerFunctions.postMessage({type:"sparkScanDidUpdateSession",payload:JSON.parse(e.toJson())})}getSparkScanDeserializer(){return this.sparkScanDeserializer}setup(){let e=this.Module.SparkScanListener.extend("SparkScanListener",{didScan:(i,s,n)=>{this.sparkScanDidScan(s,n),i.delete(),s.delete(),n.delete()},didUpdateSession:(i,s,n)=>{this.sparkScanDidUpdateSession(s),i.delete(),s.delete(),n.delete()}}),a=this.Module.Feedback.extend("Feedback",{emit:()=>{this.successFeedback()}}),r=this.Module.SparkScanDeserializerListener.extend("SparkScanDeserializerListener",{onModeDeserializationFinished:(i,s,n)=>{this.captureListenerSet||(s.addListener(new e,1),s.setSuccessFeedback(new a),s.setPropertyPushSource(this.propertyPushSource),this.captureListenerSet=!0),i.delete(),s.delete(),n.delete()},onModeDeserializationStarted(i,s,n){i.delete(),s.delete(),n.delete()},onSettingsDeserializationStarted(i,s,n){i.delete(),s.delete(),n.delete()},onSettingsDeserializationFinished(i,s,n){i.delete(),s.delete(),n.delete()},onOverlayDeserializationStarted(i,s,n){i.delete(),s.delete(),n.delete()},onOverlayDeserializationFinished:(i,s,n)=>{this.sparkScanOverlay?.delete(),this.sparkScanOverlay=s,i.delete(),n.delete()}});this.sparkScanDeserializer=new this.Module.SparkScanDeserializer,this.sparkScanDeserializer.setListener(new r)}emitErrorFeedback(e){this.sparkScanOverlay?.onErrorFeedbackEmitted(e)}overlayReadyForDraw(){this.sparkScanOverlay?.onReadyForNewData()}analyticsManagerPropertyChanged(e){this.propertyPushSource.getBehaviorSubject(e.key).setProperty(e)}successFeedback(){this.workerFunctions.postMessage({type:"successFeedback"})}sparkScanDidScan(e,a){let r=this.coreEngine.convertToLoadableFrameData(a);this.workerFunctions.postMessage({type:"sparkScanDidScan",payload:{session:JSON.parse(e.toJson()),frameData:r}})}};var V=class extends D{constructor(e,a){super(e,a)}getModeDeserializers(){this.barcodeCaptureMode=new R(this,this.Module,this.workerFunctions),this.barcodeBatchMode=new A(this,this.Module,this.workerFunctions),this.sparkScanMode=new z(this,this.Module,this.workerFunctions),this.barcodeFindMode=new H(this,this.Module,this.workerFunctions),this.barcodeCheckMode=new N(this,this.Module,this.workerFunctions);let e=super.getModeDeserializers();return e.push_back(this.barcodeCaptureMode.getCaptureDeserializer()),e.push_back(this.barcodeBatchMode.getBatchDeserializer()),e.push_back(this.sparkScanMode.getSparkScanDeserializer()),e}getWasmSideModuleFileName(){return""}getWasmCoreFileName(e,a){return a?e?"scandit-datacapture-sdk-barcode-simd-pthreads.wasm":"scandit-datacapture-sdk-barcode-pthreads.wasm":e?"scandit-datacapture-sdk-barcode-simd.wasm":"scandit-datacapture-sdk-barcode.wasm"}getWasmCoreExpectedHash(e,a){return a?e?"ac71af99bcfd4aad0e5e3beba1cc6e6dff7c585362221d7bf3cd17a46ef02dcb":"4d068ed97dfc8d46adf179bf9584aaacd4a3cff4da477942a5241d44e5f5471f":e?"b33512d5eb5e0cb439a01424f641caa2d3244cce8a529ff3320a043bfe570d5c":"be3d1f696bda507e014e9af2c787db53978137136bd10e8d92aa200a92af18b2"}getWasmMetadata(){return p}};function Ye(t){return(a=>/^[$A-Z_a-z][\\w$]*\\s*\\(.*\\)\\s*\\{/.test(a)&&!a.startsWith("function"))(t)?`function ${t}`:t}var Ze=["fetch","XMLHttpRequest","eval","Function","self","globalThis","Module","importScripts","this","console","window","document","import","Worker","ServiceWorker"];function Qe(t){return Ze.map(a=>new RegExp(`\\\\b${a}\\\\b`,"g")).some(a=>a.test(t))}function Oe(t){if(t==null)return null;let e=Ye(t);if(Qe(e))throw new Error("Function should be pure. Shouldn\'t introduce side effects, or rely on global scope");let a=`\'use strict\';\n return (${e});`;try{return new Function(a)()}catch{return null}}var J=class extends ee{constructor(e,a){super(e,a),this.dataCaptureInstance=new V(a,{postMessage:this.postMessage.bind(this),getOffscreenCanvas:this.getOffscreenCanvas.bind(this)})}async respondWith(e,a,r){let i=null,s;try{s=r(),s instanceof Promise&&(s=await s)}catch(o){s=void 0,i=F(o)}let n={type:"workerTaskId",command:e,id:a,payload:this.hasPayload(s)?s.payload:void 0};i!=null&&(n.error=i),this.postMessage(n,this.hasTransferables(s)?s.transferables:[])}onMessage(e){switch(e.data.command){case"sparkScanEmitErrorFeedback":{let{data:a}=e;return this.respondWith(a.command,a.id,()=>{this.dataCaptureInstance.sparkScanMode.emitErrorFeedback(a.shouldRemoveBrush)}),!0}case"sparkScanOverlayReadyForDraw":{let{data:a}=e;return this.respondWith(a.command,a.id,()=>{this.dataCaptureInstance.sparkScanMode.overlayReadyForDraw()}),!0}case"sparkScanAnalyticsManagerPropertyChanged":{let{data:a}=e;return this.respondWith(a.command,a.id,async()=>{this.dataCaptureInstance.sparkScanMode.analyticsManagerPropertyChanged(a.property)}),!0}case"barcodeFindForSettings":{let{data:a}=e;return this.respondWith(a.command,a.id,async()=>this.dataCaptureInstance.barcodeFindMode.forSettings(a.settings)),!0}case"barcodeFindModeRemove":{let{data:a}=e;return this.respondWith(a.command,a.id,async()=>this.dataCaptureInstance.barcodeFindMode.removeMode()),!0}case"barcodeFindSearchStart":return this.respondWith(e.data.command,e.data.id,()=>{this.dataCaptureInstance.barcodeFindMode.start()}),!0;case"barcodeFindSearchPause":return this.respondWith(e.data.command,e.data.id,()=>{this.dataCaptureInstance.barcodeFindMode.pause()}),!0;case"barcodeFindSearchStop":return this.respondWith(e.data.command,e.data.id,()=>{this.dataCaptureInstance.barcodeFindMode.stop()}),!0;case"barcodeFindSetItemList":{let{data:a}=e;return this.respondWith(e.data.command,e.data.id,()=>{this.dataCaptureInstance.barcodeFindMode.setItemList(a.itemList)}),!0}case"barcodeFindSetEnabled":{let{data:a}=e;return this.respondWith(e.data.command,e.data.id,()=>{this.dataCaptureInstance.barcodeFindMode.setEnabled(a.enabled)}),!0}case"barcodeFindApplySettings":{let{data:a}=e;return this.respondWith(a.command,a.id,async()=>this.dataCaptureInstance.barcodeFindMode.applySettings(a.settings)),!0}case"barcodeFindAddBasicOverlay":{let{data:a}=e;return this.respondWith(a.command,a.id,async()=>{this.dataCaptureInstance.barcodeFindMode.addBasicOverlay()}),!0}case"barcodeFindRemoveBasicOverlay":{let{data:a}=e;return this.respondWith(a.command,a.id,async()=>{this.dataCaptureInstance.barcodeFindMode.removeBasicOverlay()}),!0}case"barcodeFindUpdateBasicOverlay":{let{data:a}=e;return this.respondWith(a.command,a.id,async()=>{this.dataCaptureInstance.barcodeFindMode.updateBasicOverlay(a.jsonOverlay)}),!0}case"barcodeFindSetTransformerFunction":{let{data:a}=e;return this.respondWith(a.command,a.id,async()=>{let r=Oe(a.functionAsString);this.dataCaptureInstance.barcodeFindMode.setTransformerFunction(r)}),!0}case"barcodeCheckForSettings":{let{data:a}=e;return this.respondWith(a.command,a.id,async()=>this.dataCaptureInstance.barcodeCheckMode.forSettings(a.settings)),!0}case"barcodeCheckModeRemove":{let{data:a}=e;return this.respondWith(a.command,a.id,async()=>this.dataCaptureInstance.barcodeCheckMode.removeMode()),!0}case"barcodeCheckSearchStart":return this.respondWith(e.data.command,e.data.id,()=>{this.dataCaptureInstance.barcodeCheckMode.start()}),!0;case"barcodeCheckSearchPause":return this.respondWith(e.data.command,e.data.id,()=>{this.dataCaptureInstance.barcodeCheckMode.pause()}),!0;case"barcodeCheckSearchStop":return this.respondWith(e.data.command,e.data.id,()=>{this.dataCaptureInstance.barcodeCheckMode.stop()}),!0;case"barcodeCheckSetEnabled":{let{data:a}=e;return this.respondWith(e.data.command,e.data.id,()=>{this.dataCaptureInstance.barcodeCheckMode.setEnabled(a.enabled)}),!0}case"barcodeCheckApplySettings":{let{data:a}=e;return this.respondWith(a.command,a.id,async()=>{this.dataCaptureInstance.barcodeCheckMode.applySettings(a.settings)}),!0}default:return super.onMessage(e)}}};var Qa=new J(globalThis,{get:()=>globalThis.Module,set:t=>{globalThis.Module=t}});function er(t){}})();\n'],{type:"application/javascript"})),e=new Worker(s,r);return URL.revokeObjectURL(s),e}var o=class r extends DataCaptureLoader{constructor(){super(...arguments);this._name="BarcodeCapture";}get dataCaptureWorker(){return (this._dataCaptureWorker)!=null||(this._dataCaptureWorker=n({name:this.name})),this._dataCaptureWorker}get name(){return this._name}static async create(e){var a;let t=new r(e);return await t.workerCommand("setLogLevel",{level:(a=e.logLevel)!=null?a:Logger.Level.Debug}),await t.load(),t}async workerCommand(e,t,a){return new Promise((d,c)=>{let i=this.workerCommandId++;this.workerTasks.set(i,{resolve:d,reject:c,command:e});let l={...t,command:e,id:i};this.dataCaptureWorker.postMessage(l,a);})}};
2
2
  export{o as a};