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

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (42) hide show
  1. package/build/js/ar/BarcodeAr.js +1 -1
  2. package/build/js/ar/BarcodeArFeedback.js +1 -1
  3. package/build/js/ar/BarcodeArPresenter.js +1 -1
  4. package/build/js/ar/BarcodeArView.js +1 -1
  5. package/build/js/chunks/{chunk-67T3NHWA.js → chunk-D3EYLYMV.js} +1 -1
  6. package/build/js/chunks/{chunk-TG4676J6.js → chunk-DLQZYEGL.js} +1 -1
  7. package/build/js/chunks/{chunk-NPXFX53D.js → chunk-E4E7YAFV.js} +1 -1
  8. package/build/js/chunks/{chunk-5OXVYZEI.js → chunk-GEYDSROX.js} +1 -1
  9. package/build/js/chunks/{chunk-NT3OW5YR.js → chunk-H7B3Z5IN.js} +1 -1
  10. package/build/js/chunks/chunk-IIKG5XTG.js +1 -0
  11. package/build/js/chunks/{chunk-QOOBITBM.js → chunk-IJOTIY4J.js} +1 -1
  12. package/build/js/chunks/chunk-PIREZFTI.js +2 -0
  13. package/build/js/chunks/{chunk-H3L3KXMQ.js → chunk-QGQK7I7Q.js} +1 -1
  14. package/build/js/chunks/{chunk-7KA6GQ5S.js → chunk-TIIOVGLO.js} +1 -1
  15. package/build/js/chunks/{chunk-WJUDQ22D.js → chunk-VLLMY76J.js} +1 -1
  16. package/build/js/chunks/{chunk-2BAG3TGN.js → chunk-ZI65J3L4.js} +1 -1
  17. package/build/js/defaults/Defaults.js +1 -1
  18. package/build/js/find/BarcodeFind.js +1 -1
  19. package/build/js/find/BarcodeFindView.js +1 -1
  20. package/build/js/find/index.js +1 -1
  21. package/build/js/index.js +1 -1
  22. package/build/js/moduleLoader.js +1 -1
  23. package/build/js/spark/index.js +1 -1
  24. package/build/js/spark/ui/SparkScanView.js +1 -1
  25. package/build/js/spark/ui/SparkScanViewPresenter.js +1 -1
  26. package/build/js/spark/ui/index.js +1 -1
  27. package/build/js/worker/BarcodeCaptureWorkerManager.js +1 -1
  28. package/build/js/worker/WorkerMain.js +1 -1
  29. package/build/js/worker/barcodeCapture.inlineWorker.js +1 -1
  30. package/build/js/worker/dataCaptureEngine.js +1 -1
  31. package/package.json +2 -2
  32. package/sdc-lib/scandit-datacapture-sdk-barcode-pthreads.js +1 -1
  33. package/sdc-lib/scandit-datacapture-sdk-barcode-pthreads.wasm +0 -0
  34. package/sdc-lib/scandit-datacapture-sdk-barcode-simd-pthreads.js +1 -1
  35. package/sdc-lib/scandit-datacapture-sdk-barcode-simd-pthreads.wasm +0 -0
  36. package/sdc-lib/scandit-datacapture-sdk-barcode-simd.js +1 -1
  37. package/sdc-lib/scandit-datacapture-sdk-barcode-simd.wasm +0 -0
  38. package/sdc-lib/scandit-datacapture-sdk-barcode.js +1 -1
  39. package/sdc-lib/scandit-datacapture-sdk-barcode.wasm +0 -0
  40. package/build/js/chunks/chunk-YP5QNLH3.js +0 -2
  41. package/build/js/chunks/chunk-YPRTU5S2.js +0 -1
  42. /package/build/js/chunks/{chunk-WBM6DAMR.js → chunk-F2FSFE64.js} +0 -0
@@ -1 +1 @@
1
- export{a as BarcodeAr}from'../chunks/chunk-H3L3KXMQ.js';
1
+ export{a as BarcodeAr}from'../chunks/chunk-QGQK7I7Q.js';
@@ -1 +1 @@
1
- export{a as BarcodeArFeedback}from'../chunks/chunk-WBM6DAMR.js';
1
+ export{a as BarcodeArFeedback}from'../chunks/chunk-F2FSFE64.js';
@@ -1 +1 @@
1
- export{a as BarcodeArPresenter}from'../chunks/chunk-NPXFX53D.js';
1
+ export{a as BarcodeArPresenter}from'../chunks/chunk-E4E7YAFV.js';
@@ -1 +1 @@
1
- export{a as BarcodeArView}from'../chunks/chunk-NT3OW5YR.js';
1
+ export{a as BarcodeArView}from'../chunks/chunk-H7B3Z5IN.js';
@@ -1 +1 @@
1
- import {a as a$2,b}from'./chunk-XKYLJ6V4.js';import {a}from'./chunk-M4AENTE5.js';import {a as a$3}from'./chunk-55SHUUX6.js';import {a as a$1}from'./chunk-DHKABHFE.js';import {CameraSettings,convertToPublicFrameData}from'@scandit/web-datacapture-core';import {warnMultithreadingUnavailable}from'@scandit/web-datacapture-core/build/js/private/utils/warnMultithreadingUnavailable.js';var l=class u{constructor(){this.feedback=a.createDefaultFeedback();this.skipSerialization=true;this.type="barcodeFind";this._isEnabled=true;this._context=null;this.listeners=new Set;this.privateListeners=new Set;this.workerMessageListener=this.onWorkerMessage.bind(this);this._transformer=null;}static get recommendedCameraSettings(){return new CameraSettings(a$1.CameraSettings.settings)}get context(){return this._context}get allListeners(){return [...this.privateListeners,...this.listeners]}static async forSettings(e){warnMultithreadingUnavailable();let a=new u;return a.settings=e,a}isEnabled(){return this._isEnabled}async setEnabled(e){var a;this._isEnabled=e,await this.workerCommand("barcodeFindSetEnabled",{enabled:e}),await((a=this.context)==null?void 0:a.update([{type:"modeEnabled",newValue:e}],{updateContext:false}));}async applySettings(e){this.settings=e,await this.workerCommand("barcodeFindApplySettings",{settings:e.toJSONObject()});}addListener(e){this.listeners.add(e);}removeListener(e){this.listeners.delete(e);}async setItemList(e){var a;for(let r of this.privateListeners)(a=r.onSetItemList)==null||a.call(r,e);return this.workerCommand("barcodeFindSetItemList",{itemList:e.map(r=>r.toJSONObject())})}async setBarcodeTransformer(e){var a;return this._transformer=e,this.workerCommand("barcodeFindSetTransformerFunction",{functionAsString:(a=this._transformer)==null?void 0:a.transformBarcodeData.toString()})}async start(){return this.workerCommand("barcodeFindSearchStart",{})}async stop(){return this.workerCommand("barcodeFindSearchStop",{})}async pause(){return this.workerCommand("barcodeFindSearchPause",{})}toJSONObject(){return {type:this.type,enabled:this.isEnabled(),settings:this.settings.toJSONObject()}}async workerCommand(e,a){this.context!=null&&await this.context.workerCommand(e,a);}async attachedToContext(e){this._context=e,this._context.subscribeToWorkerMessages(this.workerMessageListener),await this.workerCommand("barcodeFindForSettings",{settings:this.settings.toJSONObject()});}async detachedFromContext(){var e;await this.workerCommand("barcodeFindModeRemove",{}),(e=this._context)==null||e.unsubscribeToWorkerMessages(this.workerMessageListener),this._context=null;}async onWorkerMessage(e){var a,r,d;switch(e.type){case "barcodeFindDidUpdateSession":{if(this._context==null)return;for(let t of this.allListeners)(a=t.onDidUpdateSession)==null||a.call(t,this,a$3.fromJSON(e.payload.session),convertToPublicFrameData(e.payload.frameData,this._context));break}case "barcodeFindSearchPaused":{for(let t of this.allListeners){let i=e.payload.foundItems.map(o=>new a$2(new b(o),null));t.didPauseSearch(i);}break}case "barcodeFindSearchStarted":{for(let t of this.allListeners)t.didStartSearch();break}case "barcodeFindSearchStopped":{for(let t of this.allListeners){let i=e.payload.foundItems.map(o=>new a$2(new b(o),null));t.didStopSearch(i);}break}case "barcodeFindListUpdatedFeedback":{for(let t of this.allListeners)(r=t.onFindListUpdatedFeedback)==null||r.call(t);break}case "barcodeFindFeedback":{for(let t of this.allListeners)(d=t.onFeedback)==null||d.call(t);break}}}addPrivateListener(e){this.privateListeners.add(e);}removePrivateListener(e){this.privateListeners.delete(e);}};export{l as a};
1
+ import {a as a$3}from'./chunk-55SHUUX6.js';import {a as a$2,b}from'./chunk-XKYLJ6V4.js';import {a}from'./chunk-M4AENTE5.js';import {a as a$1}from'./chunk-DHKABHFE.js';import {CameraSettings,convertToPublicFrameData}from'@scandit/web-datacapture-core';import {warnMultithreadingUnavailable}from'@scandit/web-datacapture-core/build/js/private/utils/warnMultithreadingUnavailable.js';var l=class u{constructor(){this.feedback=a.createDefaultFeedback();this.skipSerialization=true;this.type="barcodeFind";this._isEnabled=true;this._context=null;this.listeners=new Set;this.privateListeners=new Set;this.workerMessageListener=this.onWorkerMessage.bind(this);this._transformer=null;}static get recommendedCameraSettings(){return new CameraSettings(a$1.CameraSettings.settings)}get context(){return this._context}get allListeners(){return [...this.privateListeners,...this.listeners]}static async forSettings(e){warnMultithreadingUnavailable();let a=new u;return a.settings=e,a}isEnabled(){return this._isEnabled}async setEnabled(e){var a;this._isEnabled=e,await this.workerCommand("barcodeFindSetEnabled",{enabled:e}),await((a=this.context)==null?void 0:a.update([{type:"modeEnabled",newValue:e}],{updateContext:false}));}async applySettings(e){this.settings=e,await this.workerCommand("barcodeFindApplySettings",{settings:e.toJSONObject()});}addListener(e){this.listeners.add(e);}removeListener(e){this.listeners.delete(e);}async setItemList(e){var a;for(let r of this.privateListeners)(a=r.onSetItemList)==null||a.call(r,e);return this.workerCommand("barcodeFindSetItemList",{itemList:e.map(r=>r.toJSONObject())})}async setBarcodeTransformer(e){var a;return this._transformer=e,this.workerCommand("barcodeFindSetTransformerFunction",{functionAsString:(a=this._transformer)==null?void 0:a.transformBarcodeData.toString()})}async start(){return this.workerCommand("barcodeFindSearchStart",{})}async stop(){return this.workerCommand("barcodeFindSearchStop",{})}async pause(){return this.workerCommand("barcodeFindSearchPause",{})}toJSONObject(){return {type:this.type,enabled:this.isEnabled(),settings:this.settings.toJSONObject()}}async workerCommand(e,a){this.context!=null&&await this.context.workerCommand(e,a);}async attachedToContext(e){this._context=e,this._context.subscribeToWorkerMessages(this.workerMessageListener),await this.workerCommand("barcodeFindForSettings",{settings:this.settings.toJSONObject()});}async detachedFromContext(){var e;await this.workerCommand("barcodeFindModeRemove",{}),(e=this._context)==null||e.unsubscribeToWorkerMessages(this.workerMessageListener),this._context=null;}async onWorkerMessage(e){var a,r,d;switch(e.type){case "barcodeFindDidUpdateSession":{if(this._context==null)return;for(let t of this.allListeners)(a=t.onDidUpdateSession)==null||a.call(t,this,a$3.fromJSON(e.payload.session),convertToPublicFrameData(e.payload.frameData,this._context));break}case "barcodeFindSearchPaused":{for(let t of this.allListeners){let i=e.payload.foundItems.map(o=>new a$2(new b(o),null));t.didPauseSearch(i);}break}case "barcodeFindSearchStarted":{for(let t of this.allListeners)t.didStartSearch();break}case "barcodeFindSearchStopped":{for(let t of this.allListeners){let i=e.payload.foundItems.map(o=>new a$2(new b(o),null));t.didStopSearch(i);}break}case "barcodeFindListUpdatedFeedback":{for(let t of this.allListeners)(r=t.onFindListUpdatedFeedback)==null||r.call(t);break}case "barcodeFindFeedback":{for(let t of this.allListeners)(d=t.onFeedback)==null||d.call(t);break}}}addPrivateListener(e){this.privateListeners.add(e);}removePrivateListener(e){this.privateListeners.delete(e);}};export{l as a};
@@ -1 +1 @@
1
- import {a as a$1}from'./chunk-QCD3RIT4.js';import {a as a$5}from'./chunk-3OCPZ3OV.js';import {a as a$4}from'./chunk-4AF7CEVC.js';import {a as a$7}from'./chunk-S4QFMFLQ.js';import {a as a$6}from'./chunk-L6BUOAGT.js';import {a as a$3}from'./chunk-GCXWZHE6.js';import {c as c$1,b as b$2}from'./chunk-SZUPDKV5.js';import {b}from'./chunk-RU7XJPB3.js';import {a as a$2,b as b$1,c}from'./chunk-PMTVYYAY.js';import {a as a$8}from'./chunk-HDODW33D.js';import {a}from'./chunk-YPRTU5S2.js';import {Logger,DataCaptureView,Anchor,LogoStyle,TorchState,Color,NumberWithUnit,RadiusLocationSelection}from'@scandit/web-datacapture-core';import {SafeStorage}from'@scandit/web-datacapture-core/build/js/private/utils/safeStorage.js';function d(I,e,a){let t=a.value;return typeof t!="function"?(Logger.warn(`@afterPrepareScanning applied to non-function: ${e}`),a):t.constructor.name==="AsyncFunction"||t.constructor===(async()=>{}).constructor?(a.value=function(...n){return this._preparationPromise?this._preparationPromise.then(()=>t.apply(this,n)):Promise.reject(new Error(`prepare should be called before calling ${e} method`))},a):(Logger.warn(`@afterPrepareScanning applied to non-async method: ${e}`),a)}var s=class s{constructor(e,a){this._context=null;this._sparkScan=null;this._preparationPromise=null;this._stopScanningPromise=null;this._dataCaptureView=null;this.preferenceManager=new a$1(SafeStorage.getInstanceFor("localStorage"));this.defaultSuccessBrush=a$2.defaultSuccessBrush();this.defaultErrorBrush=a$2.defaultErrorBrush();this.sparkScanView=e,this.cameraManager=new a$3,this.setSparkScanViewSettings(a);}get camera(){return this.cameraManager.camera}set context(e){this._context!==e&&(this._preparationPromise=null,this._context=e,e&&(this.analyticsManager=b.forContext(e)));}get context(){return this._context}set sparkScan(e){this._sparkScan!==e&&(this._preparationPromise=null,this._sparkScan=e);}get sparkScan(){return this._sparkScan}get sparkScan$(){if(!this._sparkScan)throw new Error("SparkScan mode is required to be set before calling this method");return this._sparkScan}get context$(){if(!this._context)throw new Error("Context is required to be set before calling this method");return this._context}setSparkScanViewSettings(e){this.sparkScanViewSettings=e,this.overlayManager=new a$4(this.sparkScanViewSettings),this.stateManager=new a$5(this.sparkScanViewSettings,this.preferenceManager),this.feedbackManager=a$6.withDefaults(this.sparkScanViewSettings.soundEnabled,this.sparkScanViewSettings.hapticEnabled),this.timeoutManager=new a$7(this.sparkScanViewSettings,this);}get portraitOrientationTriggerButtonTranslateX(){var e;return (e=this.stateManager.portraitOrientationTriggerButtonTranslateX)!=null?e:this.defaultTriggerButtonTranslateX}get portraitOrientationTriggerButtonTranslateY(){var e;return (e=this.stateManager.portraitOrientationTriggerButtonTranslateY)!=null?e:this.defaultTriggerButtonTranslateY}get landscapeOrientationTriggerButtonTranslateX(){var e;return (e=this.stateManager.landscapeOrientationTriggerButtonTranslateX)!=null?e:this.defaultTriggerButtonTranslateX}get landscapeOrientationTriggerButtonTranslateY(){var e;return (e=this.stateManager.landscapeOrientationTriggerButtonTranslateY)!=null?e:this.defaultTriggerButtonTranslateY}get portraitOrientationMiniPreviewTranslateX(){var e;return (e=this.stateManager.portraitOrientationMiniPreviewTranslateX)!=null?e:this.defaultMiniPreviewTranslateX}get portraitOrientationMiniPreviewTranslateY(){var e;return (e=this.stateManager.portraitOrientationMiniPreviewTranslateY)!=null?e:this.defaultMiniPreviewTranslateY}get landscapeOrientationMiniPreviewTranslateX(){var e;return (e=this.stateManager.landscapeOrientationMiniPreviewTranslateX)!=null?e:this.defaultMiniPreviewTranslateX}get landscapeOrientationMiniPreviewTranslateY(){var e;return (e=this.stateManager.landscapeOrientationMiniPreviewTranslateY)!=null?e:this.defaultMiniPreviewTranslateY}get defaultTriggerButtonTranslateX(){return this.parentViewSizes.width-Math.min(this.parentViewSizes.width/3,110)-90/2}get defaultTriggerButtonTranslateY(){return this.parentViewSizes.height-Math.min(this.parentViewSizes.height/3,250)-90/2}get defaultMiniPreviewTranslateX(){return this.parentViewSizes.width-225-16}get parentViewSizes(){var e,a;return {width:(e=this.sparkScanView.parentElement.clientWidth)!=null?e:window.innerWidth,height:(a=this.sparkScanView.parentElement.clientHeight)!=null?a:window.innerHeight}}get defaultMiniPreviewTranslateY(){return 16}static forView(e,a){return new s(e,a)}async prepareScanning(e){if(this._preparationPromise)return this._preparationPromise;this._stopScanningPromise&&await this._stopScanningPromise,this._preparationPromise=this._internalPrepareScanning(e);try{await this._preparationPromise;}catch(a){throw this._preparationPromise=null,a}return this._preparationPromise}async _internalPrepareScanning(e){let a=this.context$,t=this.sparkScan$;this._dataCaptureView=await DataCaptureView.forContext(a),this._dataCaptureView.logoAnchor=Anchor.BottomCenter,this._dataCaptureView.logoStyle=LogoStyle.Minimal,this._dataCaptureView.setHiddenProperty("stopVideoTracksOnVisibilityChange",false),this._dataCaptureView.setHiddenProperty("freezeFrameWhenStoppingFrameSource",false),this._dataCaptureView.connectToElement(e);let i=await this.cameraManager.prepareScanning(a,this.sparkScanViewSettings);this.sparkScanView.setTorchAvailable(i.isTorchAvailable),this.sparkScanView.setZoomAvailable(i.isZoomAvailable),this.sparkScanView.cameraSwitchButtonTapped(i.isTorchAvailable,i.cameraPosition),await a.setMode(t),t.addListener(this),t.setDelegate(this),await this.overlayManager.prepareScanning(t,this._dataCaptureView,this.stateManager.scanningBehavior),this.analyticsManager.startSession({cameraPosition:this.camera.position,hapticEnabled:this.sparkScanViewSettings.hapticEnabled,scanningMode:this.stateManager.scanningMode,soundEnabled:this.sparkScanViewSettings.soundEnabled,torchState:this.camera.getDesiredTorchState()}),await this.applyPreferences(),await this.switchToIdleState();}async stopScanning(e){if(this._stopScanningPromise)return this._stopScanningPromise;if(this.stateManager.state!=="Initial"){this._preparationPromise=null,this._stopScanningPromise=this._internalStopScanning(e);try{await this._stopScanningPromise;}finally{this._stopScanningPromise=null;}}}async _internalStopScanning(e){var i;this.timeoutManager.stopCurrentTimeout();let a=this.context$,t=this.sparkScan$;await t.setEnabled(false),t.removeListener(this),t.setDelegate(void 0),await a.removeMode(t),await this.cameraManager.stopScanning(),(i=this._dataCaptureView)==null||i.detachFromElement(),this.analyticsManager.setSessionStopReason(e.sessionStopReason),this.setState("Initial");}async startScanning(){await this.switchToActiveState();}async pauseScanning(){await this.switchToInactiveState({sessionStopReason:"user"});}async onTriggerButtonPointerDown(){this.stateManager.triggerButtonPressed=true;}async onTriggerButtonTap(){switch(this.stateManager.state){case "Initial":{this.stateManager.triggerButtonPressed=false;return}case "idle":case "inactive":case "error":{await this.switchToActiveState({barcodeFeedback:this.tapBarcodeFeedback});return}case "active":{if(this.stateManager.inSmartScanSelection){this.timeoutManager.restartCurrentTimeout(),await this.sparkScan$.selectItemWithSmartScanSelection();return}await(this.stateManager.continuousModeEnabled?this.switchToInactiveState({sessionStopReason:"user",barcodeFeedback:this.silentBarcodeFeedback}):this.switchToActiveState({barcodeFeedback:this.tapBarcodeFeedback}));}}}async onTriggerButtonLongPressStart(){this.stateManager.triggerButtonPressed=true,this.sparkScanViewSettings.holdToScanEnabled&&(this.scanningBehaviorCache=this.stateManager.scanningBehavior,this.stateManager.scanningBehavior="continuous",this.stateManager.holdingToScan=true,await this.overlayManager.setShouldRemoveLocationsAfterScan(true),await this.switchToActiveState({barcodeFeedback:this.tapBarcodeFeedback}));}async onTriggerButtonLongPressEnd(){var e;this.sparkScanViewSettings.holdToScanEnabled&&this.stateManager.state!=="error"?(this.stateManager.scanningBehavior=(e=this.scanningBehaviorCache)!=null?e:"single",this.stateManager.holdingToScan=false,await this.overlayManager.setShouldRemoveLocationsAfterScan(this.stateManager.continuousModeEnabled),await this.switchToInactiveState({sessionStopReason:"user",barcodeFeedback:this.silentErrorBarcodeFeedback})):this.stateManager.triggerButtonPressed=false;}async onClickOutside(){this.stateManager.idleState||await this.switchToIdleState({emitTapFeedback:true});}async onVisibilityChange(){await this.switchToIdleState();}async onTargetModeButtonTap(e,a=this.feedbackManager.tapFeedback,t=true){var c,g;a.emit();let i=String(e),n={true:e&&this.stateManager.scanningMode instanceof b$2,false:!e&&this.stateManager.scanningMode instanceof c$1}[i];n&&(this.stateManager.scanningMode=this.stateManager.scanningMode.changeMode()),this.enableTargetModeLocationSelection(e),await this.overlayManager.setShouldDrawViewfinder(e),this.timeoutManager.restartCurrentTimeout(),this.sparkScanView.targetModeButtonTapped(e,t),n&&((g=(c=this.listener)==null?void 0:c.didChangeScanningMode)==null||g.call(c,this.stateManager.scanningMode),this.analyticsManager.setScanningMode(this.stateManager.scanningMode)),this.updateSizeControlVisibility();}async onScanningBehaviorButtonTap(e,a=this.feedbackManager.tapFeedback,t=true){a.emit(),this.stateManager.scanningMode=this.stateManager.scanningMode.copyWith(e?"continuous":"single"),await this.overlayManager.setShouldRemoveLocationsAfterScan(e),this.timeoutManager.restartCurrentTimeout(),this.sparkScanView.scanningBehaviorButtonTapped(e,t),this.analyticsManager.setScanningMode(this.stateManager.scanningMode);}async onBarcodeFindButtonTap(){var e,a;await this.switchToIdleState({sessionStopReason:"user",emitTapFeedback:true}),(a=(e=this.listener)==null?void 0:e.didTapBarcodeFindButton)==null||a.call(e,this.sparkScanView),this.timeoutManager.restartCurrentTimeout();}async onLabelCaptureButtonTap(){var e,a;await this.switchToIdleState({sessionStopReason:"user",emitTapFeedback:true}),(a=(e=this.listener)==null?void 0:e.didTapLabelCaptureButton)==null||a.call(e,this.sparkScanView),this.timeoutManager.restartCurrentTimeout();}async onCameraSwitchButtonTap(){if(this.feedbackManager.emitTapFeedback(),this.timeoutManager.restartCurrentTimeout(),!this.camera||this.stateManager.state==="error")return;let e=await this.cameraManager.onCameraSwitchButtonTap();e&&(this.sparkScanView.cameraSwitchButtonTapped(e.isTorchAvailable,e.cameraPosition),this.analyticsManager.setCameraPosition(e.cameraPosition));}async onTorchButtonTap(e,a=this.feedbackManager.tapFeedback,t=true){a.emit(),this.stateManager.torchState=e?TorchState.On:TorchState.Off,await this.cameraManager.onTorchButtonTap(this.stateManager.torchState),this.timeoutManager.restartCurrentTimeout(),this.sparkScanView.torchButtonTapped(e,t),this.analyticsManager.setTorchState(this.stateManager.torchState);}async onTriggerButtonCollapseTimeout(){this.stateManager.state!=="idle"&&this._preparationPromise&&await this.switchToIdleState({sessionStopReason:"timeout"});}async onInactiveStateTimeout(){this.stateManager.state!=="inactive"&&!this.stateManager.holdingToScan&&this._preparationPromise&&await this.switchToInactiveState({sessionStopReason:"timeout"});}async onResumeCapturingTimeout(){this.stateManager.state!=="active"&&this._preparationPromise&&await this.switchToActiveState();}async onMiniPreviewCloseButtonTap(){await this.switchToIdleState({sessionStopReason:"user",emitTapFeedback:true});}onMiniPreviewResizeButtonTap(){(this.stateManager.state==="active"||this.stateManager.state==="inactive")&&(this.feedbackManager.emitTapFeedback(),this.timeoutManager.restartCurrentTimeout());}async onMiniPreviewZoomButtonTap(e){this.feedbackManager.emitTapFeedback(),this.stateManager.zoomFactor=e,await this.cameraManager.onMiniPreviewZoomButtonTap(e),this.timeoutManager.restartCurrentTimeout();}async onMiniPreviewDrag(e,a){switch(this.stateManager.state==="active"&&await this.sparkScan$.setEnabled(false),a){case "landscape-primary":case "landscape-secondary":{this.stateManager.landscapeOrientationMiniPreviewTranslateX=e.x,this.stateManager.landscapeOrientationMiniPreviewTranslateY=e.y;break}case "portrait-primary":case "portrait-secondary":{this.stateManager.portraitOrientationMiniPreviewTranslateX=e.x,this.stateManager.portraitOrientationMiniPreviewTranslateY=e.y;break}}this.timeoutManager.restartCurrentTimeout();}onMiniPreviewPointerMove(){this.timeoutManager.restartCurrentTimeout();}async onMiniPreviewPointerUp(){await this.switchToActiveState();}async onMiniPreviewDragEnd(){this.stateManager.state==="active"&&await this.sparkScan$.setEnabled(true);}async onMiniPreviewVisibilityChange(e){e&&this.sparkScanView.repositionMiniPreviewIfOutOfBounds(),this.stateManager.inSmartScanSelection&&!e&&await this.onSwitchedAwayFromSmartScanSelection();}onTriggerButtonDrag(e,a){switch(a){case "landscape-primary":case "landscape-secondary":{this.stateManager.landscapeOrientationTriggerButtonTranslateX=e.x,this.stateManager.landscapeOrientationTriggerButtonTranslateY=e.y;break}case "portrait-primary":case "portrait-secondary":{this.stateManager.portraitOrientationTriggerButtonTranslateX=e.x,this.stateManager.portraitOrientationTriggerButtonTranslateY=e.y;break}}}async onOrientationChange(){if(this.stateManager.state==="active"&&this.stateManager.holdingToScan){this.timeoutManager.restartCurrentTimeout();return}this.stateManager.state==="error"&&await this.switchToInactiveState({sessionStopReason:"user"});}async didScan(e,a){if(!a.newlyRecognizedBarcode)return;let t=this.sparkScanView.feedbackDelegate.getFeedbackForBarcode(a.newlyRecognizedBarcode);if(t){if(t instanceof b$1){await this.switchToErrorState({barcodeFeedback:t}),this.timeoutManager.restartCurrentTimeout();return}if(t instanceof c){if(this.stateManager.continuousModeEnabled){await this.switchToActiveState({barcodeFeedback:t}),this.timeoutManager.restartCurrentTimeout();return}let i=true,n="user";await this.switchToInactiveState({barcodeFeedback:t,emitSuccessFeedback:i,sessionStopReason:n}),this.timeoutManager.restartCurrentTimeout();}}}setListener(e){this.listener=e;}async onSwitchedToSmartScanSelection(){this.overlayManager.isReady&&(this.stateManager.inSmartScanSelection=true,this.stateManager.miniPreviewSizeBeforeSmartScanSelection=this.sparkScanView.miniPreviewSize,this.stateManager.previewSizeControlVisibleBeforeSmartScanSelection=this.sparkScanView.previewSizeControlVisible,await this.overlayManager.onSwitchedToSmartScanSelection(this._dataCaptureView),this.stateManager.targetModeEnabled||(this.sparkScanView.miniPreviewSize="expanded"),this.updateSizeControlVisibility());}async onSwitchedAwayFromSmartScanSelection(){this.overlayManager.isReady&&this.stateManager.miniPreviewSizeBeforeSmartScanSelection&&(this.stateManager.inSmartScanSelection=false,await this.overlayManager.onSwitchedAwayFromSmartScanSelection(this._dataCaptureView),this.sparkScanView.miniPreviewSize=this.stateManager.miniPreviewSizeBeforeSmartScanSelection,this.stateManager.miniPreviewSizeBeforeSmartScanSelection=void 0,this.updateSizeControlVisibility());}get tapBarcodeFeedback(){return new c(Color.fromRGBA(0,0,0,0),this.defaultSuccessBrush,this.feedbackManager.tapFeedback)}get silentBarcodeFeedback(){return new c(Color.fromRGBA(0,0,0,0),this.defaultSuccessBrush,this.feedbackManager.noFeedback)}get silentErrorBarcodeFeedback(){return new b$1("",0,Color.fromRGBA(0,0,0,0),this.defaultErrorBrush,this.feedbackManager.noFeedback)}async switchToIdleState(e={}){await this.sparkScan$.setEnabled(false),await this.cameraManager.onSwitchToIdleState(),e.emitTapFeedback===true&&this.feedbackManager.emitTapFeedback(),await this.overlayManager.onSwitchToIdleState(),this.setState("idle"),this.timeoutManager.onSwitchToIdleState(),this.stateManager.triggerButtonPressed=false,this.sparkScanView.switchToIdleState(),e.sessionStopReason!=null&&this.analyticsManager.setSessionStopReason(e.sessionStopReason);}async switchToActiveState(e={}){var t;let a=this.stateManager.state;await this.cameraManager.onSwitchToActiveState(this.stateManager.torchState),await this.overlayManager.onSwitchToActiveState(a,this.stateManager.continuousModeEnabled,e.barcodeFeedback),this.feedbackManager.emitBarcodeFeedback(e.barcodeFeedback),this.timeoutManager.onSwitchToActiveState(this.stateManager.holdingToScan),await this.sparkScanView.switchToActiveState(this.sparkScanViewSettings.visualFeedbackEnabled&&e.barcodeFeedback instanceof c,this.stateManager.scanningBehavior,(t=e.barcodeFeedback)==null?void 0:t.visualFeedbackColor,this.stateManager.zoomedIn&&a!=="active"),await this.sparkScan$.setEnabled(true),this.setState("active");}async switchToInactiveState(e){var t;this.stateManager.inSmartScanSelection?await this.sparkScan$.setEnabled(false):this.stateManager.shouldEnableSuppression?await this.sparkScan$.setResultSuppressionEnabled(true):await this.sparkScan$.setEnabled(false),this.stateManager.triggerButtonPressed=false,this.stateManager.scanningMode.previewBehavior==="persistent"&&e.barcodeFeedback instanceof c&&await this.overlayManager.setShouldRemoveLocationsAfterScan(true),await this.cameraManager.onSwitchToInactiveState(this.stateManager.scanningMode.previewBehavior),(e.emitSuccessFeedback)!=null||(e.emitSuccessFeedback=true),this.setState("inactive"),e.barcodeFeedback&&await this.overlayManager.setBrushForFeedback(e.barcodeFeedback),this.feedbackManager.emitBarcodeFeedback(e.barcodeFeedback),await this.overlayManager.overlayReadyForDraw(),this.timeoutManager.onSwitchToInactiveState(),await this.sparkScanView.switchToInactiveState(this.sparkScanViewSettings.visualFeedbackEnabled&&e.barcodeFeedback instanceof c&&e.emitSuccessFeedback,this.stateManager.scanningBehavior,this.stateManager.previewBehavior,(t=e.barcodeFeedback)==null?void 0:t.visualFeedbackColor),this.analyticsManager.setSessionStopReason(e.sessionStopReason);}async switchToErrorState(e){let a=e.barcodeFeedback.resumeCapturingDelay>0;a&&(await this.sparkScan$.setEnabled(false),await this.cameraManager.onSwitchToErrorState(),this.setState("error"),this.stateManager.scanningBehavior="single"),this.timeoutManager.onSwitchToErrorState(a,e.barcodeFeedback.resumeCapturingDelay),await this.overlayManager.onSwitchToErrorState(e.barcodeFeedback),await this.sparkScan$.workerCommand("sparkScanEmitErrorFeedback",{shouldRemoveBrush:!a}),this.feedbackManager.emitBarcodeFeedback(e.barcodeFeedback),await this.sparkScanView.switchToErrorState(e.barcodeFeedback,this.sparkScanViewSettings.visualFeedbackEnabled);}enableTargetModeLocationSelection(e){let a=e?a$8.SparkScanSettings.targetModeLocationSelection.radius:a$8.SparkScanSettings.locationSelection.radius,t=e?a$8.SparkScanSettings.targetModeLocationSelection.unit:a$8.SparkScanSettings.locationSelection.unit,i=new NumberWithUnit(a,t);this.sparkScan$.settings.locationSelection=new RadiusLocationSelection(i),this.overlayManager.setRadius(i);}async applyPreferences(){await this.onTargetModeButtonTap(this.stateManager.targetModeEnabled,this.feedbackManager.noFeedback,false),await this.onScanningBehaviorButtonTap(this.stateManager.continuousModeEnabled,this.feedbackManager.noFeedback,false),await this.onTorchButtonTap(this.stateManager.torchEnabled,this.feedbackManager.noFeedback,false),this.sparkScanView.repositionElementsIfOutOfBounds();}setState(e){var a,t;e!==this.stateManager.state&&(this.stateManager.state=e,(t=(a=this.listener)==null?void 0:a.didChangeViewState)==null||t.call(a,e));}updateSizeControlVisibility(){if(!this.stateManager.inSmartScanSelection&&this.stateManager.previewSizeControlVisibleBeforeSmartScanSelection!==void 0){this.sparkScanView.previewSizeControlVisible=this.stateManager.previewSizeControlVisibleBeforeSmartScanSelection,this.stateManager.previewSizeControlVisibleBeforeSmartScanSelection=void 0;return}let e=this.stateManager.inSmartScanSelection&&!this.stateManager.targetModeEnabled,a=this.sparkScanView.previewSizeControlVisible;this.sparkScanView.previewSizeControlVisible=a&&!e;}};a([d],s.prototype,"switchToActiveState",1),a([d],s.prototype,"switchToInactiveState",1),a([d],s.prototype,"switchToErrorState",1);var V=s;export{V as a};
1
+ import {a as a$1}from'./chunk-QCD3RIT4.js';import {a as a$5}from'./chunk-3OCPZ3OV.js';import {a as a$4}from'./chunk-4AF7CEVC.js';import {a as a$7}from'./chunk-S4QFMFLQ.js';import {a as a$6}from'./chunk-L6BUOAGT.js';import {a as a$3}from'./chunk-GCXWZHE6.js';import {b}from'./chunk-RU7XJPB3.js';import {a as a$2,b as b$1,c}from'./chunk-PMTVYYAY.js';import {c as c$1,b as b$2}from'./chunk-SZUPDKV5.js';import {a as a$8}from'./chunk-HDODW33D.js';import {a}from'./chunk-IIKG5XTG.js';import {Logger,DataCaptureView,Anchor,LogoStyle,TorchState,Color,NumberWithUnit,RadiusLocationSelection}from'@scandit/web-datacapture-core';import {SafeStorage}from'@scandit/web-datacapture-core/build/js/private/utils/safeStorage.js';function d(I,e,a){let t=a.value;return typeof t!="function"?(Logger.warn(`@afterPrepareScanning applied to non-function: ${e}`),a):t.constructor.name==="AsyncFunction"||t.constructor===(async()=>{}).constructor?(a.value=function(...n){return this._preparationPromise?this._preparationPromise.then(()=>t.apply(this,n)):Promise.reject(new Error(`prepare should be called before calling ${e} method`))},a):(Logger.warn(`@afterPrepareScanning applied to non-async method: ${e}`),a)}var s=class s{constructor(e,a){this._context=null;this._sparkScan=null;this._preparationPromise=null;this._stopScanningPromise=null;this._dataCaptureView=null;this.preferenceManager=new a$1(SafeStorage.getInstanceFor("localStorage"));this.defaultSuccessBrush=a$2.defaultSuccessBrush();this.defaultErrorBrush=a$2.defaultErrorBrush();this.sparkScanView=e,this.cameraManager=new a$3,this.setSparkScanViewSettings(a);}get camera(){return this.cameraManager.camera}set context(e){this._context!==e&&(this._preparationPromise=null,this._context=e,e&&(this.analyticsManager=b.forContext(e)));}get context(){return this._context}set sparkScan(e){this._sparkScan!==e&&(this._preparationPromise=null,this._sparkScan=e);}get sparkScan(){return this._sparkScan}get sparkScan$(){if(!this._sparkScan)throw new Error("SparkScan mode is required to be set before calling this method");return this._sparkScan}get context$(){if(!this._context)throw new Error("Context is required to be set before calling this method");return this._context}setSparkScanViewSettings(e){this.sparkScanViewSettings=e,this.overlayManager=new a$4(this.sparkScanViewSettings),this.stateManager=new a$5(this.sparkScanViewSettings,this.preferenceManager),this.feedbackManager=a$6.withDefaults(this.sparkScanViewSettings.soundEnabled,this.sparkScanViewSettings.hapticEnabled),this.timeoutManager=new a$7(this.sparkScanViewSettings,this);}get portraitOrientationTriggerButtonTranslateX(){var e;return (e=this.stateManager.portraitOrientationTriggerButtonTranslateX)!=null?e:this.defaultTriggerButtonTranslateX}get portraitOrientationTriggerButtonTranslateY(){var e;return (e=this.stateManager.portraitOrientationTriggerButtonTranslateY)!=null?e:this.defaultTriggerButtonTranslateY}get landscapeOrientationTriggerButtonTranslateX(){var e;return (e=this.stateManager.landscapeOrientationTriggerButtonTranslateX)!=null?e:this.defaultTriggerButtonTranslateX}get landscapeOrientationTriggerButtonTranslateY(){var e;return (e=this.stateManager.landscapeOrientationTriggerButtonTranslateY)!=null?e:this.defaultTriggerButtonTranslateY}get portraitOrientationMiniPreviewTranslateX(){var e;return (e=this.stateManager.portraitOrientationMiniPreviewTranslateX)!=null?e:this.defaultMiniPreviewTranslateX}get portraitOrientationMiniPreviewTranslateY(){var e;return (e=this.stateManager.portraitOrientationMiniPreviewTranslateY)!=null?e:this.defaultMiniPreviewTranslateY}get landscapeOrientationMiniPreviewTranslateX(){var e;return (e=this.stateManager.landscapeOrientationMiniPreviewTranslateX)!=null?e:this.defaultMiniPreviewTranslateX}get landscapeOrientationMiniPreviewTranslateY(){var e;return (e=this.stateManager.landscapeOrientationMiniPreviewTranslateY)!=null?e:this.defaultMiniPreviewTranslateY}get defaultTriggerButtonTranslateX(){return this.parentViewSizes.width-Math.min(this.parentViewSizes.width/3,110)-90/2}get defaultTriggerButtonTranslateY(){return this.parentViewSizes.height-Math.min(this.parentViewSizes.height/3,250)-90/2}get defaultMiniPreviewTranslateX(){return this.parentViewSizes.width-225-16}get parentViewSizes(){var e,a;return {width:(e=this.sparkScanView.parentElement.clientWidth)!=null?e:window.innerWidth,height:(a=this.sparkScanView.parentElement.clientHeight)!=null?a:window.innerHeight}}get defaultMiniPreviewTranslateY(){return 16}static forView(e,a){return new s(e,a)}async prepareScanning(e){if(this._preparationPromise)return this._preparationPromise;this._stopScanningPromise&&await this._stopScanningPromise,this._preparationPromise=this._internalPrepareScanning(e);try{await this._preparationPromise;}catch(a){throw this._preparationPromise=null,a}return this._preparationPromise}async _internalPrepareScanning(e){let a=this.context$,t=this.sparkScan$;this._dataCaptureView=await DataCaptureView.forContext(a),this._dataCaptureView.logoAnchor=Anchor.BottomCenter,this._dataCaptureView.logoStyle=LogoStyle.Minimal,this._dataCaptureView.setHiddenProperty("stopVideoTracksOnVisibilityChange",false),this._dataCaptureView.setHiddenProperty("freezeFrameWhenStoppingFrameSource",false),this._dataCaptureView.connectToElement(e);let i=await this.cameraManager.prepareScanning(a,this.sparkScanViewSettings);this.sparkScanView.setTorchAvailable(i.isTorchAvailable),this.sparkScanView.setZoomAvailable(i.isZoomAvailable),this.sparkScanView.cameraSwitchButtonTapped(i.isTorchAvailable,i.cameraPosition),await a.setMode(t),t.addListener(this),t.setDelegate(this),await this.overlayManager.prepareScanning(t,this._dataCaptureView,this.stateManager.scanningBehavior),this.analyticsManager.startSession({cameraPosition:this.camera.position,hapticEnabled:this.sparkScanViewSettings.hapticEnabled,scanningMode:this.stateManager.scanningMode,soundEnabled:this.sparkScanViewSettings.soundEnabled,torchState:this.camera.getDesiredTorchState()}),await this.applyPreferences(),await this.switchToIdleState();}async stopScanning(e){if(this._stopScanningPromise)return this._stopScanningPromise;if(this.stateManager.state!=="Initial"){this._preparationPromise=null,this._stopScanningPromise=this._internalStopScanning(e);try{await this._stopScanningPromise;}finally{this._stopScanningPromise=null;}}}async _internalStopScanning(e){var i;this.timeoutManager.stopCurrentTimeout();let a=this.context$,t=this.sparkScan$;await t.setEnabled(false),t.removeListener(this),t.setDelegate(void 0),await a.removeMode(t),await this.cameraManager.stopScanning(),(i=this._dataCaptureView)==null||i.detachFromElement(),this.analyticsManager.setSessionStopReason(e.sessionStopReason),this.setState("Initial");}async startScanning(){await this.switchToActiveState();}async pauseScanning(){await this.switchToInactiveState({sessionStopReason:"user"});}async onTriggerButtonPointerDown(){this.stateManager.triggerButtonPressed=true;}async onTriggerButtonTap(){switch(this.stateManager.state){case "Initial":{this.stateManager.triggerButtonPressed=false;return}case "idle":case "inactive":case "error":{await this.switchToActiveState({barcodeFeedback:this.tapBarcodeFeedback});return}case "active":{if(this.stateManager.inSmartScanSelection){this.timeoutManager.restartCurrentTimeout(),await this.sparkScan$.selectItemWithSmartScanSelection();return}await(this.stateManager.continuousModeEnabled?this.switchToInactiveState({sessionStopReason:"user",barcodeFeedback:this.silentBarcodeFeedback}):this.switchToActiveState({barcodeFeedback:this.tapBarcodeFeedback}));}}}async onTriggerButtonLongPressStart(){this.stateManager.triggerButtonPressed=true,this.sparkScanViewSettings.holdToScanEnabled&&(this.scanningBehaviorCache=this.stateManager.scanningBehavior,this.stateManager.scanningBehavior="continuous",this.stateManager.holdingToScan=true,await this.overlayManager.setShouldRemoveLocationsAfterScan(true),await this.switchToActiveState({barcodeFeedback:this.tapBarcodeFeedback}));}async onTriggerButtonLongPressEnd(){var e;this.sparkScanViewSettings.holdToScanEnabled&&this.stateManager.state!=="error"?(this.stateManager.scanningBehavior=(e=this.scanningBehaviorCache)!=null?e:"single",this.stateManager.holdingToScan=false,await this.overlayManager.setShouldRemoveLocationsAfterScan(this.stateManager.continuousModeEnabled),await this.switchToInactiveState({sessionStopReason:"user",barcodeFeedback:this.silentErrorBarcodeFeedback})):this.stateManager.triggerButtonPressed=false;}async onClickOutside(){this.stateManager.idleState||await this.switchToIdleState({emitTapFeedback:true});}async onVisibilityChange(){await this.switchToIdleState();}async onTargetModeButtonTap(e,a=this.feedbackManager.tapFeedback,t=true){var c,g;a.emit();let i=String(e),n={true:e&&this.stateManager.scanningMode instanceof b$2,false:!e&&this.stateManager.scanningMode instanceof c$1}[i];n&&(this.stateManager.scanningMode=this.stateManager.scanningMode.changeMode()),this.enableTargetModeLocationSelection(e),await this.overlayManager.setShouldDrawViewfinder(e),this.timeoutManager.restartCurrentTimeout(),this.sparkScanView.targetModeButtonTapped(e,t),n&&((g=(c=this.listener)==null?void 0:c.didChangeScanningMode)==null||g.call(c,this.stateManager.scanningMode),this.analyticsManager.setScanningMode(this.stateManager.scanningMode)),this.updateSizeControlVisibility();}async onScanningBehaviorButtonTap(e,a=this.feedbackManager.tapFeedback,t=true){a.emit(),this.stateManager.scanningMode=this.stateManager.scanningMode.copyWith(e?"continuous":"single"),await this.overlayManager.setShouldRemoveLocationsAfterScan(e),this.timeoutManager.restartCurrentTimeout(),this.sparkScanView.scanningBehaviorButtonTapped(e,t),this.analyticsManager.setScanningMode(this.stateManager.scanningMode);}async onBarcodeFindButtonTap(){var e,a;await this.switchToIdleState({sessionStopReason:"user",emitTapFeedback:true}),(a=(e=this.listener)==null?void 0:e.didTapBarcodeFindButton)==null||a.call(e,this.sparkScanView),this.timeoutManager.restartCurrentTimeout();}async onLabelCaptureButtonTap(){var e,a;await this.switchToIdleState({sessionStopReason:"user",emitTapFeedback:true}),(a=(e=this.listener)==null?void 0:e.didTapLabelCaptureButton)==null||a.call(e,this.sparkScanView),this.timeoutManager.restartCurrentTimeout();}async onCameraSwitchButtonTap(){if(this.feedbackManager.emitTapFeedback(),this.timeoutManager.restartCurrentTimeout(),!this.camera||this.stateManager.state==="error")return;let e=await this.cameraManager.onCameraSwitchButtonTap();e&&(this.sparkScanView.cameraSwitchButtonTapped(e.isTorchAvailable,e.cameraPosition),this.analyticsManager.setCameraPosition(e.cameraPosition));}async onTorchButtonTap(e,a=this.feedbackManager.tapFeedback,t=true){a.emit(),this.stateManager.torchState=e?TorchState.On:TorchState.Off,await this.cameraManager.onTorchButtonTap(this.stateManager.torchState),this.timeoutManager.restartCurrentTimeout(),this.sparkScanView.torchButtonTapped(e,t),this.analyticsManager.setTorchState(this.stateManager.torchState);}async onTriggerButtonCollapseTimeout(){this.stateManager.state!=="idle"&&this._preparationPromise&&await this.switchToIdleState({sessionStopReason:"timeout"});}async onInactiveStateTimeout(){this.stateManager.state!=="inactive"&&!this.stateManager.holdingToScan&&this._preparationPromise&&await this.switchToInactiveState({sessionStopReason:"timeout"});}async onResumeCapturingTimeout(){this.stateManager.state!=="active"&&this._preparationPromise&&await this.switchToActiveState();}async onMiniPreviewCloseButtonTap(){await this.switchToIdleState({sessionStopReason:"user",emitTapFeedback:true});}onMiniPreviewResizeButtonTap(){(this.stateManager.state==="active"||this.stateManager.state==="inactive")&&(this.feedbackManager.emitTapFeedback(),this.timeoutManager.restartCurrentTimeout());}async onMiniPreviewZoomButtonTap(e){this.feedbackManager.emitTapFeedback(),this.stateManager.zoomFactor=e,await this.cameraManager.onMiniPreviewZoomButtonTap(e),this.timeoutManager.restartCurrentTimeout();}async onMiniPreviewDrag(e,a){switch(this.stateManager.state==="active"&&await this.sparkScan$.setEnabled(false),a){case "landscape-primary":case "landscape-secondary":{this.stateManager.landscapeOrientationMiniPreviewTranslateX=e.x,this.stateManager.landscapeOrientationMiniPreviewTranslateY=e.y;break}case "portrait-primary":case "portrait-secondary":{this.stateManager.portraitOrientationMiniPreviewTranslateX=e.x,this.stateManager.portraitOrientationMiniPreviewTranslateY=e.y;break}}this.timeoutManager.restartCurrentTimeout();}onMiniPreviewPointerMove(){this.timeoutManager.restartCurrentTimeout();}async onMiniPreviewPointerUp(){await this.switchToActiveState();}async onMiniPreviewDragEnd(){this.stateManager.state==="active"&&await this.sparkScan$.setEnabled(true);}async onMiniPreviewVisibilityChange(e){e&&this.sparkScanView.repositionMiniPreviewIfOutOfBounds(),this.stateManager.inSmartScanSelection&&!e&&await this.onSwitchedAwayFromSmartScanSelection();}onTriggerButtonDrag(e,a){switch(a){case "landscape-primary":case "landscape-secondary":{this.stateManager.landscapeOrientationTriggerButtonTranslateX=e.x,this.stateManager.landscapeOrientationTriggerButtonTranslateY=e.y;break}case "portrait-primary":case "portrait-secondary":{this.stateManager.portraitOrientationTriggerButtonTranslateX=e.x,this.stateManager.portraitOrientationTriggerButtonTranslateY=e.y;break}}}async onOrientationChange(){if(this.stateManager.state==="active"&&this.stateManager.holdingToScan){this.timeoutManager.restartCurrentTimeout();return}this.stateManager.state==="error"&&await this.switchToInactiveState({sessionStopReason:"user"});}async didScan(e,a){if(!a.newlyRecognizedBarcode)return;let t=this.sparkScanView.feedbackDelegate.getFeedbackForBarcode(a.newlyRecognizedBarcode);if(t){if(t instanceof b$1){await this.switchToErrorState({barcodeFeedback:t}),this.timeoutManager.restartCurrentTimeout();return}if(t instanceof c){if(this.stateManager.continuousModeEnabled){await this.switchToActiveState({barcodeFeedback:t}),this.timeoutManager.restartCurrentTimeout();return}let i=true,n="user";await this.switchToInactiveState({barcodeFeedback:t,emitSuccessFeedback:i,sessionStopReason:n}),this.timeoutManager.restartCurrentTimeout();}}}setListener(e){this.listener=e;}async onSwitchedToSmartScanSelection(){this.overlayManager.isReady&&(this.stateManager.inSmartScanSelection=true,this.stateManager.miniPreviewSizeBeforeSmartScanSelection=this.sparkScanView.miniPreviewSize,this.stateManager.previewSizeControlVisibleBeforeSmartScanSelection=this.sparkScanView.previewSizeControlVisible,await this.overlayManager.onSwitchedToSmartScanSelection(this._dataCaptureView),this.stateManager.targetModeEnabled||(this.sparkScanView.miniPreviewSize="expanded"),this.updateSizeControlVisibility());}async onSwitchedAwayFromSmartScanSelection(){this.overlayManager.isReady&&this.stateManager.miniPreviewSizeBeforeSmartScanSelection&&(this.stateManager.inSmartScanSelection=false,await this.overlayManager.onSwitchedAwayFromSmartScanSelection(this._dataCaptureView),this.sparkScanView.miniPreviewSize=this.stateManager.miniPreviewSizeBeforeSmartScanSelection,this.stateManager.miniPreviewSizeBeforeSmartScanSelection=void 0,this.updateSizeControlVisibility());}get tapBarcodeFeedback(){return new c(Color.fromRGBA(0,0,0,0),this.defaultSuccessBrush,this.feedbackManager.tapFeedback)}get silentBarcodeFeedback(){return new c(Color.fromRGBA(0,0,0,0),this.defaultSuccessBrush,this.feedbackManager.noFeedback)}get silentErrorBarcodeFeedback(){return new b$1("",0,Color.fromRGBA(0,0,0,0),this.defaultErrorBrush,this.feedbackManager.noFeedback)}async switchToIdleState(e={}){await this.sparkScan$.setEnabled(false),await this.cameraManager.onSwitchToIdleState(),e.emitTapFeedback===true&&this.feedbackManager.emitTapFeedback(),await this.overlayManager.onSwitchToIdleState(),this.setState("idle"),this.timeoutManager.onSwitchToIdleState(),this.stateManager.triggerButtonPressed=false,this.sparkScanView.switchToIdleState(),e.sessionStopReason!=null&&this.analyticsManager.setSessionStopReason(e.sessionStopReason);}async switchToActiveState(e={}){var t;let a=this.stateManager.state;await this.cameraManager.onSwitchToActiveState(this.stateManager.torchState),await this.overlayManager.onSwitchToActiveState(a,this.stateManager.continuousModeEnabled,e.barcodeFeedback),this.feedbackManager.emitBarcodeFeedback(e.barcodeFeedback),this.timeoutManager.onSwitchToActiveState(this.stateManager.holdingToScan),await this.sparkScanView.switchToActiveState(this.sparkScanViewSettings.visualFeedbackEnabled&&e.barcodeFeedback instanceof c,this.stateManager.scanningBehavior,(t=e.barcodeFeedback)==null?void 0:t.visualFeedbackColor,this.stateManager.zoomedIn&&a!=="active"),await this.sparkScan$.setEnabled(true),this.setState("active");}async switchToInactiveState(e){var t;this.stateManager.inSmartScanSelection?await this.sparkScan$.setEnabled(false):this.stateManager.shouldEnableSuppression?await this.sparkScan$.setResultSuppressionEnabled(true):await this.sparkScan$.setEnabled(false),this.stateManager.triggerButtonPressed=false,this.stateManager.scanningMode.previewBehavior==="persistent"&&e.barcodeFeedback instanceof c&&await this.overlayManager.setShouldRemoveLocationsAfterScan(true),await this.cameraManager.onSwitchToInactiveState(this.stateManager.scanningMode.previewBehavior),(e.emitSuccessFeedback)!=null||(e.emitSuccessFeedback=true),this.setState("inactive"),e.barcodeFeedback&&await this.overlayManager.setBrushForFeedback(e.barcodeFeedback),this.feedbackManager.emitBarcodeFeedback(e.barcodeFeedback),await this.overlayManager.overlayReadyForDraw(),this.timeoutManager.onSwitchToInactiveState(),await this.sparkScanView.switchToInactiveState(this.sparkScanViewSettings.visualFeedbackEnabled&&e.barcodeFeedback instanceof c&&e.emitSuccessFeedback,this.stateManager.scanningBehavior,this.stateManager.previewBehavior,(t=e.barcodeFeedback)==null?void 0:t.visualFeedbackColor),this.analyticsManager.setSessionStopReason(e.sessionStopReason);}async switchToErrorState(e){let a=e.barcodeFeedback.resumeCapturingDelay>0;a&&(await this.sparkScan$.setEnabled(false),await this.cameraManager.onSwitchToErrorState(),this.setState("error"),this.stateManager.scanningBehavior="single"),this.timeoutManager.onSwitchToErrorState(a,e.barcodeFeedback.resumeCapturingDelay),await this.overlayManager.onSwitchToErrorState(e.barcodeFeedback),await this.sparkScan$.workerCommand("sparkScanEmitErrorFeedback",{shouldRemoveBrush:!a}),this.feedbackManager.emitBarcodeFeedback(e.barcodeFeedback),await this.sparkScanView.switchToErrorState(e.barcodeFeedback,this.sparkScanViewSettings.visualFeedbackEnabled);}enableTargetModeLocationSelection(e){let a=e?a$8.SparkScanSettings.targetModeLocationSelection.radius:a$8.SparkScanSettings.locationSelection.radius,t=e?a$8.SparkScanSettings.targetModeLocationSelection.unit:a$8.SparkScanSettings.locationSelection.unit,i=new NumberWithUnit(a,t);this.sparkScan$.settings.locationSelection=new RadiusLocationSelection(i),this.overlayManager.setRadius(i);}async applyPreferences(){await this.onTargetModeButtonTap(this.stateManager.targetModeEnabled,this.feedbackManager.noFeedback,false),await this.onScanningBehaviorButtonTap(this.stateManager.continuousModeEnabled,this.feedbackManager.noFeedback,false),await this.onTorchButtonTap(this.stateManager.torchEnabled,this.feedbackManager.noFeedback,false),this.sparkScanView.repositionElementsIfOutOfBounds();}setState(e){var a,t;e!==this.stateManager.state&&(this.stateManager.state=e,(t=(a=this.listener)==null?void 0:a.didChangeViewState)==null||t.call(a,e));}updateSizeControlVisibility(){if(!this.stateManager.inSmartScanSelection&&this.stateManager.previewSizeControlVisibleBeforeSmartScanSelection!==void 0){this.sparkScanView.previewSizeControlVisible=this.stateManager.previewSizeControlVisibleBeforeSmartScanSelection,this.stateManager.previewSizeControlVisibleBeforeSmartScanSelection=void 0;return}let e=this.stateManager.inSmartScanSelection&&!this.stateManager.targetModeEnabled,a=this.sparkScanView.previewSizeControlVisible;this.sparkScanView.previewSizeControlVisible=a&&!e;}};a([d],s.prototype,"switchToActiveState",1),a([d],s.prototype,"switchToInactiveState",1),a([d],s.prototype,"switchToErrorState",1);var V=s;export{V as a};
@@ -1 +1 @@
1
- import {a}from'./chunk-WBM6DAMR.js';import {TorchState,isCameraFrameSource,Camera,CameraPosition,FrameSourceState}from'@scandit/web-datacapture-core';var l=class{constructor(e,t,a,o,r){this.torchState=TorchState.Off;this.cameraSupportMap=new Map;this.cameras=[];this.view=e,this.context=t,this.barcodeAr=a,this.viewSettings=o,this.cameraSettings=r;}get currentCamera(){if(isCameraFrameSource(this.context.frameSource))return this.context.frameSource;throw new Error("The current frame source is not a Camera")}isCameraMirrored(){return this.currentCamera.getMirrorImageEnabled()}async prepare(){var a$1,o,r;await this.barcodeAr.setEnabled(false),this.barcodeAr.feedback=await a.createWithOptions(true,true),this.barcodeAr.addPrivateListener(this),this.cameras=await Camera.getAll(false,isCameraFrameSource(this.context.frameSource));let e=isCameraFrameSource(this.context.frameSource)?this.context.frameSource:(r=(o=(a$1=this.cameras.find(s=>s.position===this.viewSettings.defaultCameraPosition))!=null?a$1:this.cameras.find(s=>s.position===(this.viewSettings.defaultCameraPosition===CameraPosition.WorldFacing?CameraPosition.UserFacing:CameraPosition.WorldFacing)))!=null?o:this.cameras[0])!=null?r:Camera.pickBestGuess();await this.context.setFrameSource(e),await this.currentCamera.applySettings(this.cameraSettings),await this.currentCamera.switchToDesiredState(FrameSourceState.Standby);let t=await this.isTorchAvailableForCurrentCamera();this.view.setTorchAvailable(t);}async dispose(){var e;this.view.deleteAllViews(),await this.context.removeMode(this.barcodeAr),this.barcodeAr.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.barcodeAr.setEnabled(true),await this.barcodeAr.start();}async stopSearching(){var e;this.view.deleteAllViews(),await((e=this.context.frameSource)==null?void 0:e.switchToDesiredState(FrameSourceState.Off)),await this.barcodeAr.setEnabled(false),await this.barcodeAr.stop();}async pauseSearching(){var e;this.view.deletePendingViews(),await((e=this.context.frameSource)==null?void 0:e.switchToDesiredState(FrameSourceState.Standby)),await this.barcodeAr.setEnabled(false),await this.barcodeAr.pause();}emitTappedFeedback(){this.barcodeAr.feedback.tapped.emit();}didUpdateSession(e,t){Object.keys(t.addedTrackedBarcodes).length>0&&this.barcodeAr.feedback.scanned.emit(),this.view.render(t);}async isTorchAvailableForCurrentCamera(){let e=this.currentCamera.label,t=this.cameraSupportMap.get(e);if(t!==void 0)return t.torch;let a=await this.currentCamera.isTorchAvailable();return this.cameraSupportMap.set(e,{torch:a}),a}async onTorchButtonClicked(){let e=await this.isTorchAvailableForCurrentCamera();this.view.setTorchAvailable(e),e&&(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 onCameraSwitchButtonClicked(){var r,s;let e=this.currentCamera.getCurrentState(),t=this.currentCamera.position===CameraPosition.UserFacing?CameraPosition.WorldFacing:CameraPosition.UserFacing,a=(s=(r=this.cameras.find(p=>p.position===t))!=null?r:this.cameras[0])!=null?s:Camera.pickBestGuessForPosition(t);await this.context.setFrameSource(a),await this.currentCamera.switchToDesiredState(e);let o=await this.isTorchAvailableForCurrentCamera();this.view.setTorchAvailable(o);}};export{l as a};
1
+ import {a}from'./chunk-F2FSFE64.js';import {TorchState,isCameraFrameSource,Camera,CameraPosition,FrameSourceState}from'@scandit/web-datacapture-core';var l=class{constructor(e,t,a,o,r){this.torchState=TorchState.Off;this.cameraSupportMap=new Map;this.cameras=[];this.view=e,this.context=t,this.barcodeAr=a,this.viewSettings=o,this.cameraSettings=r;}get currentCamera(){if(isCameraFrameSource(this.context.frameSource))return this.context.frameSource;throw new Error("The current frame source is not a Camera")}isCameraMirrored(){return this.currentCamera.getMirrorImageEnabled()}async prepare(){var a$1,o,r;await this.barcodeAr.setEnabled(false),this.barcodeAr.feedback=await a.createWithOptions(true,true),this.barcodeAr.addPrivateListener(this),this.cameras=await Camera.getAll(false,isCameraFrameSource(this.context.frameSource));let e=isCameraFrameSource(this.context.frameSource)?this.context.frameSource:(r=(o=(a$1=this.cameras.find(s=>s.position===this.viewSettings.defaultCameraPosition))!=null?a$1:this.cameras.find(s=>s.position===(this.viewSettings.defaultCameraPosition===CameraPosition.WorldFacing?CameraPosition.UserFacing:CameraPosition.WorldFacing)))!=null?o:this.cameras[0])!=null?r:Camera.pickBestGuess();await this.context.setFrameSource(e),await this.currentCamera.applySettings(this.cameraSettings),await this.currentCamera.switchToDesiredState(FrameSourceState.Standby);let t=await this.isTorchAvailableForCurrentCamera();this.view.setTorchAvailable(t);}async dispose(){var e;this.view.deleteAllViews(),await this.context.removeMode(this.barcodeAr),this.barcodeAr.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.barcodeAr.setEnabled(true),await this.barcodeAr.start();}async stopSearching(){var e;this.view.deleteAllViews(),await((e=this.context.frameSource)==null?void 0:e.switchToDesiredState(FrameSourceState.Off)),await this.barcodeAr.setEnabled(false),await this.barcodeAr.stop();}async pauseSearching(){var e;this.view.deletePendingViews(),await((e=this.context.frameSource)==null?void 0:e.switchToDesiredState(FrameSourceState.Standby)),await this.barcodeAr.setEnabled(false),await this.barcodeAr.pause();}emitTappedFeedback(){this.barcodeAr.feedback.tapped.emit();}didUpdateSession(e,t){Object.keys(t.addedTrackedBarcodes).length>0&&this.barcodeAr.feedback.scanned.emit(),this.view.render(t);}async isTorchAvailableForCurrentCamera(){let e=this.currentCamera.label,t=this.cameraSupportMap.get(e);if(t!==void 0)return t.torch;let a=await this.currentCamera.isTorchAvailable();return this.cameraSupportMap.set(e,{torch:a}),a}async onTorchButtonClicked(){let e=await this.isTorchAvailableForCurrentCamera();this.view.setTorchAvailable(e),e&&(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 onCameraSwitchButtonClicked(){var r,s;let e=this.currentCamera.getCurrentState(),t=this.currentCamera.position===CameraPosition.UserFacing?CameraPosition.WorldFacing:CameraPosition.UserFacing,a=(s=(r=this.cameras.find(p=>p.position===t))!=null?r:this.cameras[0])!=null?s:Camera.pickBestGuessForPosition(t);await this.context.setFrameSource(a),await this.currentCamera.switchToDesiredState(e);let o=await this.isTorchAvailableForCurrentCamera();this.view.setTorchAvailable(o);}};export{l as a};
@@ -1 +1 @@
1
- import {a}from'./chunk-2BAG3TGN.js';import {a as a$1}from'./chunk-TRITJ43A.js';import {unknownErrorToString}from'@scandit/web-datacapture-core/build/js/private/utils/unknownErrorToString.js';import {WorkerMain}from'@scandit/web-datacapture-core/build/js/worker/index.js';var i=class extends WorkerMain{constructor(t,a$1){super(t,a$1),this.dataCaptureInstance=new a(a$1,{postMessage:this.postMessage.bind(this),getOffscreenCanvas:this.getOffscreenCanvas.bind(this)});}async respondWith(t,a,r){let d=null,e;try{e=r(),e instanceof Promise&&(e=await e);}catch(c){e=void 0,d=unknownErrorToString(c);}let s={type:"workerTaskId",command:t,id:a,payload:this.hasPayload(e)?e.payload:void 0};d!=null&&(s.error=d),this.postMessage(s,this.hasTransferables(e)?e.transferables:[]);}onMessage(t){switch(t.data.command){case "sparkScanEmitErrorFeedback":{let{data:a}=t;return this.respondWith(a.command,a.id,()=>{this.dataCaptureInstance.sparkScanMode.emitErrorFeedback(a.shouldRemoveBrush);}),true}case "sparkScanOverlayReadyForDraw":{let{data:a}=t;return this.respondWith(a.command,a.id,()=>{this.dataCaptureInstance.sparkScanMode.overlayReadyForDraw();}),true}case "sparkScanOverlayDiscardEnqueuedData":{let{data:a}=t;return this.respondWith(a.command,a.id,()=>{this.dataCaptureInstance.sparkScanMode.discardEnqueuedData();}),true}case "sparkScanAnalyticsManagerPropertyChanged":{let{data:a}=t;return this.respondWith(a.command,a.id,async()=>{this.dataCaptureInstance.sparkScanMode.analyticsManagerPropertyChanged(a.property);}),true}case "sparkScanSelectItemWithSmartScanSelection":{let{data:a}=t;return this.respondWith(a.command,a.id,async()=>{this.dataCaptureInstance.sparkScanMode.selectItemWithSmartScanSelection();}),true}case "sparkScanModeRemove":{let{data:a}=t;return this.respondWith(a.command,a.id,async()=>this.dataCaptureInstance.sparkScanMode.removeMode()),true}case "barcodeFindForSettings":{let{data:a}=t;return this.respondWith(a.command,a.id,async()=>this.dataCaptureInstance.barcodeFindMode.forSettings(a.settings)),true}case "barcodeFindModeRemove":{let{data:a}=t;return this.respondWith(a.command,a.id,async()=>this.dataCaptureInstance.barcodeFindMode.removeMode()),true}case "barcodeFindSearchStart":return this.respondWith(t.data.command,t.data.id,()=>{this.dataCaptureInstance.barcodeFindMode.start();}),true;case "barcodeFindSearchPause":return this.respondWith(t.data.command,t.data.id,()=>{this.dataCaptureInstance.barcodeFindMode.pause();}),true;case "barcodeFindSearchStop":return this.respondWith(t.data.command,t.data.id,()=>{this.dataCaptureInstance.barcodeFindMode.stop();}),true;case "barcodeFindSetItemList":{let{data:a}=t;return this.respondWith(t.data.command,t.data.id,()=>{this.dataCaptureInstance.barcodeFindMode.setItemList(a.itemList);}),true}case "barcodeFindSetEnabled":{let{data:a}=t;return this.respondWith(t.data.command,t.data.id,()=>{this.dataCaptureInstance.barcodeFindMode.setEnabled(a.enabled);}),true}case "barcodeFindApplySettings":{let{data:a}=t;return this.respondWith(a.command,a.id,async()=>this.dataCaptureInstance.barcodeFindMode.applySettings(a.settings)),true}case "barcodeFindAddBasicOverlay":{let{data:a}=t;return this.respondWith(a.command,a.id,async()=>{this.dataCaptureInstance.barcodeFindMode.addBasicOverlay();}),true}case "barcodeFindRemoveBasicOverlay":{let{data:a}=t;return this.respondWith(a.command,a.id,async()=>{this.dataCaptureInstance.barcodeFindMode.removeBasicOverlay();}),true}case "barcodeFindUpdateBasicOverlay":{let{data:a}=t;return this.respondWith(a.command,a.id,async()=>{this.dataCaptureInstance.barcodeFindMode.updateBasicOverlay(a.jsonOverlay);}),true}case "barcodeFindSetTransformerFunction":{let{data:a}=t;return this.respondWith(a.command,a.id,async()=>{let r=a$1(a.functionAsString);this.dataCaptureInstance.barcodeFindMode.setTransformerFunction(r);}),true}case "barcodeArForSettings":{let{data:a}=t;return this.respondWith(a.command,a.id,async()=>this.dataCaptureInstance.barcodeArMode.forSettings(a.settings)),true}case "barcodeArModeRemove":{let{data:a}=t;return this.respondWith(a.command,a.id,async()=>this.dataCaptureInstance.barcodeArMode.removeMode()),true}case "barcodeArSearchStart":return this.respondWith(t.data.command,t.data.id,()=>{this.dataCaptureInstance.barcodeArMode.start();}),true;case "barcodeArSearchPause":return this.respondWith(t.data.command,t.data.id,()=>{this.dataCaptureInstance.barcodeArMode.pause();}),true;case "barcodeArSearchStop":return this.respondWith(t.data.command,t.data.id,()=>{this.dataCaptureInstance.barcodeArMode.stop();}),true;case "barcodeArSetEnabled":{let{data:a}=t;return this.respondWith(t.data.command,t.data.id,()=>{this.dataCaptureInstance.barcodeArMode.setEnabled(a.enabled);}),true}case "barcodeArApplySettings":{let{data:a}=t;return this.respondWith(a.command,a.id,async()=>{this.dataCaptureInstance.barcodeArMode.applySettings(a.settings);}),true}default:return super.onMessage(t)}}};export{i as a};
1
+ import {a}from'./chunk-ZI65J3L4.js';import {a as a$1}from'./chunk-TRITJ43A.js';import {unknownErrorToString}from'@scandit/web-datacapture-core/build/js/private/utils/unknownErrorToString.js';import {WorkerMain}from'@scandit/web-datacapture-core/build/js/worker/index.js';var i=class extends WorkerMain{constructor(t,a$1){super(t,a$1),this.dataCaptureInstance=new a(a$1,{postMessage:this.postMessage.bind(this),getOffscreenCanvas:this.getOffscreenCanvas.bind(this)});}async respondWith(t,a,r){let d=null,e;try{e=r(),e instanceof Promise&&(e=await e);}catch(c){e=void 0,d=unknownErrorToString(c);}let s={type:"workerTaskId",command:t,id:a,payload:this.hasPayload(e)?e.payload:void 0};d!=null&&(s.error=d),this.postMessage(s,this.hasTransferables(e)?e.transferables:[]);}onMessage(t){switch(t.data.command){case "sparkScanEmitErrorFeedback":{let{data:a}=t;return this.respondWith(a.command,a.id,()=>{this.dataCaptureInstance.sparkScanMode.emitErrorFeedback(a.shouldRemoveBrush);}),true}case "sparkScanOverlayReadyForDraw":{let{data:a}=t;return this.respondWith(a.command,a.id,()=>{this.dataCaptureInstance.sparkScanMode.overlayReadyForDraw();}),true}case "sparkScanOverlayDiscardEnqueuedData":{let{data:a}=t;return this.respondWith(a.command,a.id,()=>{this.dataCaptureInstance.sparkScanMode.discardEnqueuedData();}),true}case "sparkScanAnalyticsManagerPropertyChanged":{let{data:a}=t;return this.respondWith(a.command,a.id,async()=>{this.dataCaptureInstance.sparkScanMode.analyticsManagerPropertyChanged(a.property);}),true}case "sparkScanSelectItemWithSmartScanSelection":{let{data:a}=t;return this.respondWith(a.command,a.id,async()=>{this.dataCaptureInstance.sparkScanMode.selectItemWithSmartScanSelection();}),true}case "sparkScanModeRemove":{let{data:a}=t;return this.respondWith(a.command,a.id,async()=>this.dataCaptureInstance.sparkScanMode.removeMode()),true}case "barcodeFindForSettings":{let{data:a}=t;return this.respondWith(a.command,a.id,async()=>this.dataCaptureInstance.barcodeFindMode.forSettings(a.settings)),true}case "barcodeFindModeRemove":{let{data:a}=t;return this.respondWith(a.command,a.id,async()=>this.dataCaptureInstance.barcodeFindMode.removeMode()),true}case "barcodeFindSearchStart":return this.respondWith(t.data.command,t.data.id,()=>{this.dataCaptureInstance.barcodeFindMode.start();}),true;case "barcodeFindSearchPause":return this.respondWith(t.data.command,t.data.id,()=>{this.dataCaptureInstance.barcodeFindMode.pause();}),true;case "barcodeFindSearchStop":return this.respondWith(t.data.command,t.data.id,()=>{this.dataCaptureInstance.barcodeFindMode.stop();}),true;case "barcodeFindSetItemList":{let{data:a}=t;return this.respondWith(t.data.command,t.data.id,()=>{this.dataCaptureInstance.barcodeFindMode.setItemList(a.itemList);}),true}case "barcodeFindSetEnabled":{let{data:a}=t;return this.respondWith(t.data.command,t.data.id,()=>{this.dataCaptureInstance.barcodeFindMode.setEnabled(a.enabled);}),true}case "barcodeFindApplySettings":{let{data:a}=t;return this.respondWith(a.command,a.id,async()=>this.dataCaptureInstance.barcodeFindMode.applySettings(a.settings)),true}case "barcodeFindAddBasicOverlay":{let{data:a}=t;return this.respondWith(a.command,a.id,async()=>{this.dataCaptureInstance.barcodeFindMode.addBasicOverlay();}),true}case "barcodeFindRemoveBasicOverlay":{let{data:a}=t;return this.respondWith(a.command,a.id,async()=>{this.dataCaptureInstance.barcodeFindMode.removeBasicOverlay();}),true}case "barcodeFindUpdateBasicOverlay":{let{data:a}=t;return this.respondWith(a.command,a.id,async()=>{this.dataCaptureInstance.barcodeFindMode.updateBasicOverlay(a.jsonOverlay);}),true}case "barcodeFindSetTransformerFunction":{let{data:a}=t;return this.respondWith(a.command,a.id,async()=>{let r=a$1(a.functionAsString);this.dataCaptureInstance.barcodeFindMode.setTransformerFunction(r);}),true}case "barcodeArForSettings":{let{data:a}=t;return this.respondWith(a.command,a.id,async()=>this.dataCaptureInstance.barcodeArMode.forSettings(a.settings)),true}case "barcodeArModeRemove":{let{data:a}=t;return this.respondWith(a.command,a.id,async()=>this.dataCaptureInstance.barcodeArMode.removeMode()),true}case "barcodeArSearchStart":return this.respondWith(t.data.command,t.data.id,()=>{this.dataCaptureInstance.barcodeArMode.start();}),true;case "barcodeArSearchPause":return this.respondWith(t.data.command,t.data.id,()=>{this.dataCaptureInstance.barcodeArMode.pause();}),true;case "barcodeArSearchStop":return this.respondWith(t.data.command,t.data.id,()=>{this.dataCaptureInstance.barcodeArMode.stop();}),true;case "barcodeArSetEnabled":{let{data:a}=t;return this.respondWith(t.data.command,t.data.id,()=>{this.dataCaptureInstance.barcodeArMode.setEnabled(a.enabled);}),true}case "barcodeArApplySettings":{let{data:a}=t;return this.respondWith(a.command,a.id,async()=>{this.dataCaptureInstance.barcodeArMode.applySettings(a.settings);}),true}default:return super.onMessage(t)}}};export{i as a};
@@ -1 +1 @@
1
- import {a}from'./chunk-HDLJOQJY.js';import {a as a$6}from'./chunk-ZPCWOA3Y.js';import {b}from'./chunk-OH47PSIL.js';import {a as a$8}from'./chunk-KMEGIFKL.js';import {a as a$5}from'./chunk-QRG4J3CL.js';import {b as b$1}from'./chunk-33EFB3RJ.js';import {a as a$1}from'./chunk-I53W7VSB.js';import {a as a$7}from'./chunk-O5SUMSOC.js';import {a as a$2}from'./chunk-NPXFX53D.js';import {a as a$4}from'./chunk-I3PK5YW4.js';import {a as a$3}from'./chunk-H3L3KXMQ.js';import {Anchor,DataCaptureView,ZoomSwitchControl,Direction,Point,Size}from'@scandit/web-datacapture-core';import {Backdrop}from'@scandit/web-datacapture-core/build/js/private/ui/atoms/Backdrop.js';import {ScanditHTMLElement}from'@scandit/web-datacapture-core/build/js/private/utils/ScanditHTMLElement.js';import {css}from'@scandit/web-datacapture-core/build/js/private/utils/css.js';import {defineCustomElements}from'@scandit/web-datacapture-core/build/js/private/utils/defineCustomElements.js';import {calculateArea,calculateWidth,calculateHeight}from'@scandit/web-datacapture-core/build/js/private/utils/quadrilateralUtils.js';import {Timeout}from'@scandit/web-datacapture-core/build/js/private/utils/timeout.js';import {TorchSwitchIconButton}from'@scandit/web-datacapture-core/build/js/private/ui/molecules/TorchSwitchIconButton.js';var W={async highlightForBarcode(k,y){let t=a$8.create(k);y(t);}},d=class d extends ScanditHTMLElement{constructor(){super(...arguments);this.torchSwitchIconButton=null;this.cameraSwitchButton=null;this.zoomSwitchControl=null;this._shouldShowTorchControl=false;this._isTorchAvailable=false;this.onTorchButtonClickHandler=this.onTorchButtonClick.bind(this);this.onCameraSwitchButtonHandler=this.onCameraSwitchButtonClick.bind(this);this.onLayoutPointerDownHandler=this.onLayoutPointerDown.bind(this);this.onInfoAnnotationTapHandler=this.onInfoAnnotationTap.bind(this);this.pendingDeletionTimeout=null;}set shouldShowZoomControl(t){var o;let e=(o=this.zoomSwitchControl)==null?void 0:o.zoomSwitchPill;e&&(e.hidden=!t);}get shouldShowZoomControl(){var e;let t=(e=this.zoomSwitchControl)==null?void 0:e.zoomSwitchPill;return t?!t.hidden:false}set shouldShowCameraSwitchControl(t){this.cameraSwitchButton&&(this.cameraSwitchButton.hidden=!t);}get shouldShowCameraSwitchControl(){return this.cameraSwitchButton===null?false:!this.cameraSwitchButton.hidden}set shouldShowTorchControl(t){this.torchSwitchIconButton!==null&&(this._shouldShowTorchControl=t,this.torchSwitchIconButton.hidden=!(t&&this._isTorchAvailable));}get shouldShowTorchControl(){return this._shouldShowTorchControl}set torchControlPosition(t){var e;(e=this.torchSwitchIconButton)==null||e.setAttribute("slot",`controls-${t===Anchor.Center?Anchor.TopLeft:t}`);}get torchControlPosition(){var e,o;let t=(o=(e=this.torchSwitchIconButton)==null?void 0:e.getAttribute("slot"))!=null?o:"";return t===""?Anchor.TopLeft:t.replace("controls-","")}set zoomControlPosition(t){var o;let e=(o=this.zoomSwitchControl)==null?void 0:o.zoomSwitchPill;e==null||e.setAttribute("slot",`controls-${t===Anchor.Center?Anchor.BottomRight:t}`);}get zoomControlPosition(){var o,i;let t=(o=this.zoomSwitchControl)==null?void 0:o.zoomSwitchPill,e=(i=t==null?void 0:t.getAttribute("slot"))!=null?i:"";return e===""?Anchor.BottomRight:e.replace("controls-","")}set cameraSwitchControlPosition(t){var e;(e=this.cameraSwitchButton)==null||e.setAttribute("slot",`controls-${t===Anchor.Center?Anchor.TopRight:t}`);}get cameraSwitchControlPosition(){var e,o;let t=(o=(e=this.cameraSwitchButton)==null?void 0:e.getAttribute("slot"))!=null?o:"";return t===""?Anchor.TopRight:t.replace("controls-","")}static async createWithSettings(t,e,o,i,n){d.register();let r=document.createElement(d.tag);return r.barcodeArViewSettings=i,r.layout=a.create(),r.append(r.layout),a$1(t)?(r.dataCaptureView=t,r.dataCaptureView.containerElement.prepend(r),await t.setContext(e)):(r.dataCaptureView=await DataCaptureView.forContext(e),r.dataCaptureView.connectToElement(t),r.dataCaptureView.containerElement.prepend(r)),r.presenter=new a$2(r,e,o,i,n!=null?n:a$3.createRecommendedCameraSettings()),await r.presenter.prepare(),await r.installZoomControl(),r}static async create(t,e,o){return d.createWithSettings(t,e,o,new a$4)}static register(){defineCustomElements({[a.tag]:a,[a$6.tag]:a$6,[TorchSwitchIconButton.tag]:TorchSwitchIconButton,[d.tag]:d,[Backdrop.tag]:Backdrop,[a$5.tag]:a$5});}static createStyleElement(){return css`[data-could-be-deleted=true]{display:none!important}[data-on-foreground=true]{z-index:3}${d.tag}{inset:0;position:absolute;z-index:1}`}getHighlightForBarcode(t){return this.queryHighlightByDataId(a$7(t))}getAnnotationForBarcode(t){return this.queryAnnotationByDataId(a$7(t))}async start(){return this.presenter.startSearching()}async stop(){return this.presenter.stopSearching()}async pause(){return this.presenter.pauseSearching()}reset(){this.deletePendingViews(),this.deleteAllViews();}getNotificationPresenter(){return this.dataCaptureView.getNotificationPresenter()}setTorchAvailable(t){this._isTorchAvailable=t,this.torchSwitchIconButton!==null&&(this.torchSwitchIconButton.hidden=!(this._shouldShowTorchControl&&this._isTorchAvailable));}toggleTorchIcon(t){this.torchSwitchIconButton!==null&&(this.torchSwitchIconButton.state=t);}onTorchButtonClick(){this.presenter.onTorchButtonClicked();}onCameraSwitchButtonClick(){this.presenter.onCameraSwitchButtonClicked();}async installZoomControl(){this.zoomSwitchControl=new ZoomSwitchControl,await this.zoomSwitchControl.install(this.dataCaptureView);let t=this.zoomSwitchControl.zoomSwitchPill;t&&(t.setAttribute("slot",`controls-${Anchor.BottomRight}`),t.hidden=true,this.layout.append(t));}connectedCallback(){this.torchSwitchIconButton=TorchSwitchIconButton.create(),this.torchSwitchIconButton.shadow=true,this.torchSwitchIconButton.size=36,this.torchSwitchIconButton.slot=`controls-${this.torchControlPosition}`,this.torchSwitchIconButton.hidden=true,this.torchSwitchIconButton.addEventListener("pointerdown",this.onTorchButtonClickHandler),this.cameraSwitchButton=a$6.create(),this.cameraSwitchButton.slot=`controls-${this.cameraSwitchControlPosition}`,this.cameraSwitchButton.hidden=true,this.cameraSwitchButton.addEventListener("pointerdown",this.onCameraSwitchButtonHandler),this.layout.append(this.torchSwitchIconButton,this.cameraSwitchButton),this.layout.addEventListener("pointerdown",this.onLayoutPointerDownHandler),this.layout.addEventListener("BarcodeArInfoAnnotationEventTap",this.onInfoAnnotationTapHandler),this.backdrop=Backdrop.create(),this.layout.append(this.backdrop),this.pendingDeletionTimeout=new Timeout(1e3,()=>{this.deletePendingViews();}),this.prepend(d.createStyleElement());}disconnectedCallback(){var t,e,o;this.deleteAllViews(),(t=this.torchSwitchIconButton)==null||t.removeEventListener("pointerdown",this.onTorchButtonClickHandler),(e=this.cameraSwitchButton)==null||e.removeEventListener("pointerdown",this.onCameraSwitchButtonHandler),(o=this.zoomSwitchControl)==null||o.remove(),this.layout.removeEventListener("pointerdown",this.onLayoutPointerDownHandler),this.layout.removeEventListener("BarcodeArInfoAnnotationEventTap",this.onInfoAnnotationTapHandler);}isPopoverAnnotation(t){return t instanceof b}isAnnotation(t){var e;return ((e=t.dataset)==null?void 0:e.identifier)==null?false:t.dataset.identifier.endsWith("-annotation")}areMultiplePopoverAllowed(){for(let t of this.layout.querySelectorAll("[data-identifier$='-annotation']"))if(t&&this.isPopoverAnnotation(t)&&t.annotationTrigger==="highlightTapAndBarcodeScan")return true;return false}async onLayoutPointerDown(t){let e=t.target,o=e==null?void 0:e.closest("[data-identifier$='-highlight']"),i=e==null?void 0:e.closest(b.tag);if((o==null?void 0:o.dataset.id)!=null){await this.handleHighlightClick(o);return}if((i==null?void 0:i.dataset.id)!=null){await this.handleAnnotationClick(i);return}await this.handleClickOutside();}async handleHighlightClick(t){var o;this.presenter.emitTappedFeedback(),(o=this.listener)==null||o.didTapHighlightForBarcode(this.presenter.barcodeAr,t.barcode,t);let e=this.queryAnnotationByDataIdentifier(t.dataset.identifier.replace("-highlight",""));!e||e.annotationTrigger==="barcodeScan"||(this.isPopoverAnnotation(e)?await this.handlePopoverHighlightClick(e,t):e.hidden=!e.hidden);}async handlePopoverHighlightClick(t,e){var o;if(!this.areMultiplePopoverAllowed()){let i=this.layout.querySelector(`${b.tag}[data-on-foreground="true"]`),n=(o=i==null?void 0:i.dataset.identifier)==null?void 0:o.replace("-annotation","-highlight"),r=this.layout.querySelector(`[data-identifier="${n}"]`);i!=null&&r!=null&&await this.hideBarcodeArPopover(i,r,false);}await this.toggleBarcodeArPopover(t,e);}async handleAnnotationClick(t){var i;let e=(i=t.dataset.identifier)==null?void 0:i.replace("-annotation","-highlight"),o=this.layout.querySelector(`[data-identifier="${e}"]`);o&&await this.toggleBarcodeArPopover(t,o);}async handleClickOutside(){var i;if(this.areMultiplePopoverAllowed())return;let t=this.layout.querySelector(`${b.tag}[data-on-foreground="true"]`);if(!t)return;let e=(i=t.dataset.identifier)==null?void 0:i.replace("-annotation","-highlight"),o=this.layout.querySelector(`[data-identifier="${e}"]`);o&&await this.hideBarcodeArPopover(t,o);}onInfoAnnotationTap(){this.presenter.emitTappedFeedback();}async showBarcodeArPopover(t,e){t.dataset.onForeground="true",t.hidden=false,e.dataset.onForeground="true",this.backdrop.open=true;}async hideBarcodeArPopover(t,e,o=true){t.dataset.onForeground="false",t.hidden=true,e&&(e.dataset.onForeground="false"),o&&this.hideBackdropIfNoPopovers();}hideBackdropIfNoPopovers(){[...this.layout.querySelectorAll(`${b.tag}`)].every(e=>e.hidden)&&(this.backdrop.open=false);}async toggleBarcodeArPopover(t,e){t.hidden?await this.showBarcodeArPopover(t,e):await this.hideBarcodeArPopover(t,e);}deleteAllViews(){for(let t of this.layout.querySelectorAll("[data-identifier]"))t.remove();}deletePendingViews(){for(let t of this.layout.querySelectorAll("[data-could-be-deleted='true']"))t.remove();this.hideBackdropIfNoPopovers();}identifierForHighlight(t){return `${t}-highlight`}identifierForAnnotation(t){return `${t}-annotation`}async onHighlightsOrAnnotationForTrackedBarcode(t){var e,o,i;await((o=(e=this.highlightProvider)!=null?e:W)==null?void 0:o.highlightForBarcode(t.barcode,async n=>this.onHighlight(t,n))),await((i=this.annotationProvider)==null?void 0:i.annotationForBarcode(t.barcode,async n=>this.onAnnotation(t,n)));}async onAnnotation(t,e){let o=e,i=a$7(t.barcode);this.updateExistingAnnotation(i)||(await this.setupNewAnnotation(o,i,t),this.updateAnnotationPosition(t,o));}updateExistingAnnotation(t){let e=this.queryAnnotationByDataId(t);return e?(e.dataset.couldBeDeleted="false",true):false}async setupNewAnnotation(t,e,o){if(t.dataset.id=e,t.dataset.identifier=this.identifierForAnnotation(o.identifier),t.hidden=true,this.layout.append(t),this.isPopoverAnnotation(t)){if(t.direction=Direction.Vertical,t.anchor==null&&(t.anchor="bottom-center"),this.areMultiplePopoverAllowed()||t.annotationTrigger==="highlightTapAndBarcodeScan"){let i=this.queryHighlightByDataId(e);i&&await this.showBarcodeArPopover(t,i);}}else t.hidden=t.annotationTrigger==="highlightTap";}getAnnotationVariationForQuad(t,e){let o=Math.max(0,Math.min(1,e)),i=t.anchorPositions,n=calculateArea(i),r=this.dataCaptureView.width,l=this.dataCaptureView.height,h=r*l;if(n<=0||h<=0)return 0;let u=n/h;return Math.max(0,Math.min(1,u))<=o?2:1}async onHighlight(t,e){let o=a$7(t.barcode),i=this.queryHighlightByDataId(o);i?i.dataset.couldBeDeleted="false":(e.dataset.id=o,e.dataset.identifier=this.identifierForHighlight(t.identifier),this.updateHighlightPosition(t,e),this.layout.append(e));}queryHighlightByDataIdentifier(t){return this.layout.querySelector(`[data-identifier$="${t}-highlight"]`)}queryAnnotationByDataIdentifier(t){return this.layout.querySelector(`[data-identifier$="${t}-annotation"]`)}queryHighlightByDataId(t){return this.layout.querySelector(`[data-identifier$="-highlight"][data-id="${t}"]`)}queryAnnotationByDataId(t){return this.layout.querySelector(`[data-identifier$="-annotation"][data-id="${t}"]`)}updateRemovedTrackedBarcodes(t){var i,n,r,l,h;let e=this.querySelectorAll("[data-identifier]");if(Object.keys(t.allTrackedBarcodes).length===0){for(let u of e)u.dataset.couldBeDeleted="true";(i=this.pendingDeletionTimeout)!=null&&i.running||(n=this.pendingDeletionTimeout)==null||n.start();return}let o=new Set(t.removedTrackedBarcodes);for(let u of e){let p=(r=u.dataset.identifier)==null?void 0:r.replace("-highlight","").replace("-annotation","");p!=null&&o.has(p)&&(u.dataset.couldBeDeleted="true");}(l=this.pendingDeletionTimeout)!=null&&l.running||(h=this.pendingDeletionTimeout)==null||h.start();}render(t){for(let[e,o]of Object.entries(t.allTrackedBarcodes)){t.addedTrackedBarcodes[e]!=null&&this.onHighlightsOrAnnotationForTrackedBarcode(o);let i=a$7(o.barcode),n=this.queryAnnotationByDataId(i),r=this.queryHighlightByDataId(i);r&&(this.updateBrushSize(r,o),this.updateHighlightPosition(o,r)),n&&this.updateAnnotationPosition(o,n,r);}this.updateRemovedTrackedBarcodes(t);}updateHighlightPosition(t,e,o="center"){if(e.hidden)return;let i=this.dataCaptureView.viewAnchorPositionsForFrameAnchorPositions(t.anchorPositions),n=this.normalizedViewPointFromFrameAnchorPositions(i,o);e.updatePosition(n,new Point(-50,-50),this.calculateRotationAngle(i.topLeft,i.topRight));}updateBrushSize(t,e){if(t.width==null||t.height==null)return;let o=this.dataCaptureView.viewAnchorPositionsForFrameAnchorPositions(e.anchorPositions),i=Math.round(calculateWidth(o)),n=Math.round(calculateHeight(o));t.width!==i&&(t.width=i),t.height!==n&&(t.height=n);}getTransformOrigin(t){return {"top-center":new Point(-50,0),"bottom-center":new Point(-50,-100),"left-center":new Point(0,-50),"right-center":new Point(-100,-50)}[t]}calculateAnnotationPosition(t,e,o){var p,P;let n=t.orderVerticesByPosition(),r=this.normalizedViewPointFromFrameAnchorPositions(t,"center"),h={"bottom-center":()=>{let s=this.normalizedViewPointFromFrameAnchorPositions(n,"topCenter");return new Point(s.x,s.y-7)},"top-center":()=>{let s=this.normalizedViewPointFromFrameAnchorPositions(n,"bottomCenter");return new Point(s.x,s.y+7)},"right-center":()=>{let s=this.normalizedViewPointFromFrameAnchorPositions(n,"centerLeft");return new Point(s.x-7,s.y)},"left-center":()=>{let s=this.normalizedViewPointFromFrameAnchorPositions(n,"centerRight");return new Point(s.x+7,s.y)}}[e]();return o?o instanceof b$1?(p={"bottom-center":new Point(r.x,r.y-7-o.clientHeight/2),"top-center":new Point(r.x,r.y+7+o.clientHeight/2),"right-center":new Point(r.x-7-o.clientWidth/2,r.y),"left-center":new Point(r.x+7+o.clientWidth/2,r.y)}[e])!=null?p:h:(P={"bottom-center":new Point(r.x,r.y-7-o.clientHeight/2),"top-center":new Point(r.x,r.y+7+o.clientHeight/2),"right-center":new Point(r.x-7-o.clientWidth/2,r.y),"left-center":new Point(r.x+7+o.clientWidth/2,r.y)}[e])!=null?P:h:h}updateAnnotationPosition(t,e,o){let i=this.dataCaptureView.viewAnchorPositionsForFrameAnchorPositions(t.anchorPositions);if(e.anchor||(e.anchor="top-center"),e.annotationVariation!=null){let l=this.getAnnotationVariationForQuad(t,a$5.threshold);e.annotationVariation=l;}let n=this.getTransformOrigin(e.anchor),r=this.calculateAnnotationPosition(i,e.anchor,o);e.updatePosition(r,n,this.calculateRotationAngle(i.topLeft,i.topRight));}normalizedViewPointFromFrameAnchorPositions(t,e="center"){let o=this.presenter.currentCamera.getMirrorImageEnabled(),i=new Size(this.dataCaptureView.width,this.dataCaptureView.height);if(o){let r=t[{centerLeft:"centerRight",centerRight:"centerLeft",center:"center",topCenter:"topCenter",bottomCenter:"bottomCenter"}[e]];return Point.mirrorX(r,i)}return t[e]}calculateRotationAngle(t,e){let o=e.x-t.x,n=this.presenter.isCameraMirrored()?-(e.y-t.y):e.y-t.y,r=Math.atan2(n,o);return Math.round(r*(180/Math.PI))}};d.tag="scandit-barcode-ar-view";var R=d;export{R as a};
1
+ import {a}from'./chunk-HDLJOQJY.js';import {a as a$6}from'./chunk-ZPCWOA3Y.js';import {b}from'./chunk-OH47PSIL.js';import {a as a$8}from'./chunk-KMEGIFKL.js';import {a as a$5}from'./chunk-QRG4J3CL.js';import {b as b$1}from'./chunk-33EFB3RJ.js';import {a as a$7}from'./chunk-O5SUMSOC.js';import {a as a$1}from'./chunk-I53W7VSB.js';import {a as a$2}from'./chunk-E4E7YAFV.js';import {a as a$4}from'./chunk-I3PK5YW4.js';import {a as a$3}from'./chunk-QGQK7I7Q.js';import {Anchor,DataCaptureView,ZoomSwitchControl,Direction,Point,Size}from'@scandit/web-datacapture-core';import {Backdrop}from'@scandit/web-datacapture-core/build/js/private/ui/atoms/Backdrop.js';import {ScanditHTMLElement}from'@scandit/web-datacapture-core/build/js/private/utils/ScanditHTMLElement.js';import {css}from'@scandit/web-datacapture-core/build/js/private/utils/css.js';import {defineCustomElements}from'@scandit/web-datacapture-core/build/js/private/utils/defineCustomElements.js';import {calculateArea,calculateWidth,calculateHeight}from'@scandit/web-datacapture-core/build/js/private/utils/quadrilateralUtils.js';import {Timeout}from'@scandit/web-datacapture-core/build/js/private/utils/timeout.js';import {TorchSwitchIconButton}from'@scandit/web-datacapture-core/build/js/private/ui/molecules/TorchSwitchIconButton.js';var W={async highlightForBarcode(k,y){let t=a$8.create(k);y(t);}},d=class d extends ScanditHTMLElement{constructor(){super(...arguments);this.torchSwitchIconButton=null;this.cameraSwitchButton=null;this.zoomSwitchControl=null;this._shouldShowTorchControl=false;this._isTorchAvailable=false;this.onTorchButtonClickHandler=this.onTorchButtonClick.bind(this);this.onCameraSwitchButtonHandler=this.onCameraSwitchButtonClick.bind(this);this.onLayoutPointerDownHandler=this.onLayoutPointerDown.bind(this);this.onInfoAnnotationTapHandler=this.onInfoAnnotationTap.bind(this);this.pendingDeletionTimeout=null;}set shouldShowZoomControl(t){var o;let e=(o=this.zoomSwitchControl)==null?void 0:o.zoomSwitchPill;e&&(e.hidden=!t);}get shouldShowZoomControl(){var e;let t=(e=this.zoomSwitchControl)==null?void 0:e.zoomSwitchPill;return t?!t.hidden:false}set shouldShowCameraSwitchControl(t){this.cameraSwitchButton&&(this.cameraSwitchButton.hidden=!t);}get shouldShowCameraSwitchControl(){return this.cameraSwitchButton===null?false:!this.cameraSwitchButton.hidden}set shouldShowTorchControl(t){this.torchSwitchIconButton!==null&&(this._shouldShowTorchControl=t,this.torchSwitchIconButton.hidden=!(t&&this._isTorchAvailable));}get shouldShowTorchControl(){return this._shouldShowTorchControl}set torchControlPosition(t){var e;(e=this.torchSwitchIconButton)==null||e.setAttribute("slot",`controls-${t===Anchor.Center?Anchor.TopLeft:t}`);}get torchControlPosition(){var e,o;let t=(o=(e=this.torchSwitchIconButton)==null?void 0:e.getAttribute("slot"))!=null?o:"";return t===""?Anchor.TopLeft:t.replace("controls-","")}set zoomControlPosition(t){var o;let e=(o=this.zoomSwitchControl)==null?void 0:o.zoomSwitchPill;e==null||e.setAttribute("slot",`controls-${t===Anchor.Center?Anchor.BottomRight:t}`);}get zoomControlPosition(){var o,i;let t=(o=this.zoomSwitchControl)==null?void 0:o.zoomSwitchPill,e=(i=t==null?void 0:t.getAttribute("slot"))!=null?i:"";return e===""?Anchor.BottomRight:e.replace("controls-","")}set cameraSwitchControlPosition(t){var e;(e=this.cameraSwitchButton)==null||e.setAttribute("slot",`controls-${t===Anchor.Center?Anchor.TopRight:t}`);}get cameraSwitchControlPosition(){var e,o;let t=(o=(e=this.cameraSwitchButton)==null?void 0:e.getAttribute("slot"))!=null?o:"";return t===""?Anchor.TopRight:t.replace("controls-","")}static async createWithSettings(t,e,o,i,n){d.register();let r=document.createElement(d.tag);return r.barcodeArViewSettings=i,r.layout=a.create(),r.append(r.layout),a$1(t)?(r.dataCaptureView=t,r.dataCaptureView.containerElement.prepend(r),await t.setContext(e)):(r.dataCaptureView=await DataCaptureView.forContext(e),r.dataCaptureView.connectToElement(t),r.dataCaptureView.containerElement.prepend(r)),r.presenter=new a$2(r,e,o,i,n!=null?n:a$3.createRecommendedCameraSettings()),await r.presenter.prepare(),await r.installZoomControl(),r}static async create(t,e,o){return d.createWithSettings(t,e,o,new a$4)}static register(){defineCustomElements({[a.tag]:a,[a$6.tag]:a$6,[TorchSwitchIconButton.tag]:TorchSwitchIconButton,[d.tag]:d,[Backdrop.tag]:Backdrop,[a$5.tag]:a$5});}static createStyleElement(){return css`[data-could-be-deleted=true]{display:none!important}[data-on-foreground=true]{z-index:3}${d.tag}{inset:0;position:absolute;z-index:1}`}getHighlightForBarcode(t){return this.queryHighlightByDataId(a$7(t))}getAnnotationForBarcode(t){return this.queryAnnotationByDataId(a$7(t))}async start(){return this.presenter.startSearching()}async stop(){return this.presenter.stopSearching()}async pause(){return this.presenter.pauseSearching()}reset(){this.deletePendingViews(),this.deleteAllViews();}getNotificationPresenter(){return this.dataCaptureView.getNotificationPresenter()}setTorchAvailable(t){this._isTorchAvailable=t,this.torchSwitchIconButton!==null&&(this.torchSwitchIconButton.hidden=!(this._shouldShowTorchControl&&this._isTorchAvailable));}toggleTorchIcon(t){this.torchSwitchIconButton!==null&&(this.torchSwitchIconButton.state=t);}onTorchButtonClick(){this.presenter.onTorchButtonClicked();}onCameraSwitchButtonClick(){this.presenter.onCameraSwitchButtonClicked();}async installZoomControl(){this.zoomSwitchControl=new ZoomSwitchControl,await this.zoomSwitchControl.install(this.dataCaptureView);let t=this.zoomSwitchControl.zoomSwitchPill;t&&(t.setAttribute("slot",`controls-${Anchor.BottomRight}`),t.hidden=true,this.layout.append(t));}connectedCallback(){this.torchSwitchIconButton=TorchSwitchIconButton.create(),this.torchSwitchIconButton.shadow=true,this.torchSwitchIconButton.size=36,this.torchSwitchIconButton.slot=`controls-${this.torchControlPosition}`,this.torchSwitchIconButton.hidden=true,this.torchSwitchIconButton.addEventListener("pointerdown",this.onTorchButtonClickHandler),this.cameraSwitchButton=a$6.create(),this.cameraSwitchButton.slot=`controls-${this.cameraSwitchControlPosition}`,this.cameraSwitchButton.hidden=true,this.cameraSwitchButton.addEventListener("pointerdown",this.onCameraSwitchButtonHandler),this.layout.append(this.torchSwitchIconButton,this.cameraSwitchButton),this.layout.addEventListener("pointerdown",this.onLayoutPointerDownHandler),this.layout.addEventListener("BarcodeArInfoAnnotationEventTap",this.onInfoAnnotationTapHandler),this.backdrop=Backdrop.create(),this.layout.append(this.backdrop),this.pendingDeletionTimeout=new Timeout(1e3,()=>{this.deletePendingViews();}),this.prepend(d.createStyleElement());}disconnectedCallback(){var t,e,o;this.deleteAllViews(),(t=this.torchSwitchIconButton)==null||t.removeEventListener("pointerdown",this.onTorchButtonClickHandler),(e=this.cameraSwitchButton)==null||e.removeEventListener("pointerdown",this.onCameraSwitchButtonHandler),(o=this.zoomSwitchControl)==null||o.remove(),this.layout.removeEventListener("pointerdown",this.onLayoutPointerDownHandler),this.layout.removeEventListener("BarcodeArInfoAnnotationEventTap",this.onInfoAnnotationTapHandler);}isPopoverAnnotation(t){return t instanceof b}isAnnotation(t){var e;return ((e=t.dataset)==null?void 0:e.identifier)==null?false:t.dataset.identifier.endsWith("-annotation")}areMultiplePopoverAllowed(){for(let t of this.layout.querySelectorAll("[data-identifier$='-annotation']"))if(t&&this.isPopoverAnnotation(t)&&t.annotationTrigger==="highlightTapAndBarcodeScan")return true;return false}async onLayoutPointerDown(t){let e=t.target,o=e==null?void 0:e.closest("[data-identifier$='-highlight']"),i=e==null?void 0:e.closest(b.tag);if((o==null?void 0:o.dataset.id)!=null){await this.handleHighlightClick(o);return}if((i==null?void 0:i.dataset.id)!=null){await this.handleAnnotationClick(i);return}await this.handleClickOutside();}async handleHighlightClick(t){var o;this.presenter.emitTappedFeedback(),(o=this.listener)==null||o.didTapHighlightForBarcode(this.presenter.barcodeAr,t.barcode,t);let e=this.queryAnnotationByDataIdentifier(t.dataset.identifier.replace("-highlight",""));!e||e.annotationTrigger==="barcodeScan"||(this.isPopoverAnnotation(e)?await this.handlePopoverHighlightClick(e,t):e.hidden=!e.hidden);}async handlePopoverHighlightClick(t,e){var o;if(!this.areMultiplePopoverAllowed()){let i=this.layout.querySelector(`${b.tag}[data-on-foreground="true"]`),n=(o=i==null?void 0:i.dataset.identifier)==null?void 0:o.replace("-annotation","-highlight"),r=this.layout.querySelector(`[data-identifier="${n}"]`);i!=null&&r!=null&&await this.hideBarcodeArPopover(i,r,false);}await this.toggleBarcodeArPopover(t,e);}async handleAnnotationClick(t){var i;let e=(i=t.dataset.identifier)==null?void 0:i.replace("-annotation","-highlight"),o=this.layout.querySelector(`[data-identifier="${e}"]`);o&&await this.toggleBarcodeArPopover(t,o);}async handleClickOutside(){var i;if(this.areMultiplePopoverAllowed())return;let t=this.layout.querySelector(`${b.tag}[data-on-foreground="true"]`);if(!t)return;let e=(i=t.dataset.identifier)==null?void 0:i.replace("-annotation","-highlight"),o=this.layout.querySelector(`[data-identifier="${e}"]`);o&&await this.hideBarcodeArPopover(t,o);}onInfoAnnotationTap(){this.presenter.emitTappedFeedback();}async showBarcodeArPopover(t,e){t.dataset.onForeground="true",t.hidden=false,e.dataset.onForeground="true",this.backdrop.open=true;}async hideBarcodeArPopover(t,e,o=true){t.dataset.onForeground="false",t.hidden=true,e&&(e.dataset.onForeground="false"),o&&this.hideBackdropIfNoPopovers();}hideBackdropIfNoPopovers(){[...this.layout.querySelectorAll(`${b.tag}`)].every(e=>e.hidden)&&(this.backdrop.open=false);}async toggleBarcodeArPopover(t,e){t.hidden?await this.showBarcodeArPopover(t,e):await this.hideBarcodeArPopover(t,e);}deleteAllViews(){for(let t of this.layout.querySelectorAll("[data-identifier]"))t.remove();}deletePendingViews(){for(let t of this.layout.querySelectorAll("[data-could-be-deleted='true']"))t.remove();this.hideBackdropIfNoPopovers();}identifierForHighlight(t){return `${t}-highlight`}identifierForAnnotation(t){return `${t}-annotation`}async onHighlightsOrAnnotationForTrackedBarcode(t){var e,o,i;await((o=(e=this.highlightProvider)!=null?e:W)==null?void 0:o.highlightForBarcode(t.barcode,async n=>this.onHighlight(t,n))),await((i=this.annotationProvider)==null?void 0:i.annotationForBarcode(t.barcode,async n=>this.onAnnotation(t,n)));}async onAnnotation(t,e){let o=e,i=a$7(t.barcode);this.updateExistingAnnotation(i)||(await this.setupNewAnnotation(o,i,t),this.updateAnnotationPosition(t,o));}updateExistingAnnotation(t){let e=this.queryAnnotationByDataId(t);return e?(e.dataset.couldBeDeleted="false",true):false}async setupNewAnnotation(t,e,o){if(t.dataset.id=e,t.dataset.identifier=this.identifierForAnnotation(o.identifier),t.hidden=true,this.layout.append(t),this.isPopoverAnnotation(t)){if(t.direction=Direction.Vertical,t.anchor==null&&(t.anchor="bottom-center"),this.areMultiplePopoverAllowed()||t.annotationTrigger==="highlightTapAndBarcodeScan"){let i=this.queryHighlightByDataId(e);i&&await this.showBarcodeArPopover(t,i);}}else t.hidden=t.annotationTrigger==="highlightTap";}getAnnotationVariationForQuad(t,e){let o=Math.max(0,Math.min(1,e)),i=t.anchorPositions,n=calculateArea(i),r=this.dataCaptureView.width,l=this.dataCaptureView.height,h=r*l;if(n<=0||h<=0)return 0;let u=n/h;return Math.max(0,Math.min(1,u))<=o?2:1}async onHighlight(t,e){let o=a$7(t.barcode),i=this.queryHighlightByDataId(o);i?i.dataset.couldBeDeleted="false":(e.dataset.id=o,e.dataset.identifier=this.identifierForHighlight(t.identifier),this.updateHighlightPosition(t,e),this.layout.append(e));}queryHighlightByDataIdentifier(t){return this.layout.querySelector(`[data-identifier$="${t}-highlight"]`)}queryAnnotationByDataIdentifier(t){return this.layout.querySelector(`[data-identifier$="${t}-annotation"]`)}queryHighlightByDataId(t){return this.layout.querySelector(`[data-identifier$="-highlight"][data-id="${t}"]`)}queryAnnotationByDataId(t){return this.layout.querySelector(`[data-identifier$="-annotation"][data-id="${t}"]`)}updateRemovedTrackedBarcodes(t){var i,n,r,l,h;let e=this.querySelectorAll("[data-identifier]");if(Object.keys(t.allTrackedBarcodes).length===0){for(let u of e)u.dataset.couldBeDeleted="true";(i=this.pendingDeletionTimeout)!=null&&i.running||(n=this.pendingDeletionTimeout)==null||n.start();return}let o=new Set(t.removedTrackedBarcodes);for(let u of e){let p=(r=u.dataset.identifier)==null?void 0:r.replace("-highlight","").replace("-annotation","");p!=null&&o.has(p)&&(u.dataset.couldBeDeleted="true");}(l=this.pendingDeletionTimeout)!=null&&l.running||(h=this.pendingDeletionTimeout)==null||h.start();}render(t){for(let[e,o]of Object.entries(t.allTrackedBarcodes)){t.addedTrackedBarcodes[e]!=null&&this.onHighlightsOrAnnotationForTrackedBarcode(o);let i=a$7(o.barcode),n=this.queryAnnotationByDataId(i),r=this.queryHighlightByDataId(i);r&&(this.updateBrushSize(r,o),this.updateHighlightPosition(o,r)),n&&this.updateAnnotationPosition(o,n,r);}this.updateRemovedTrackedBarcodes(t);}updateHighlightPosition(t,e,o="center"){if(e.hidden)return;let i=this.dataCaptureView.viewAnchorPositionsForFrameAnchorPositions(t.anchorPositions),n=this.normalizedViewPointFromFrameAnchorPositions(i,o);e.updatePosition(n,new Point(-50,-50),this.calculateRotationAngle(i.topLeft,i.topRight));}updateBrushSize(t,e){if(t.width==null||t.height==null)return;let o=this.dataCaptureView.viewAnchorPositionsForFrameAnchorPositions(e.anchorPositions),i=Math.round(calculateWidth(o)),n=Math.round(calculateHeight(o));t.width!==i&&(t.width=i),t.height!==n&&(t.height=n);}getTransformOrigin(t){return {"top-center":new Point(-50,0),"bottom-center":new Point(-50,-100),"left-center":new Point(0,-50),"right-center":new Point(-100,-50)}[t]}calculateAnnotationPosition(t,e,o){var p,P;let n=t.orderVerticesByPosition(),r=this.normalizedViewPointFromFrameAnchorPositions(t,"center"),h={"bottom-center":()=>{let s=this.normalizedViewPointFromFrameAnchorPositions(n,"topCenter");return new Point(s.x,s.y-7)},"top-center":()=>{let s=this.normalizedViewPointFromFrameAnchorPositions(n,"bottomCenter");return new Point(s.x,s.y+7)},"right-center":()=>{let s=this.normalizedViewPointFromFrameAnchorPositions(n,"centerLeft");return new Point(s.x-7,s.y)},"left-center":()=>{let s=this.normalizedViewPointFromFrameAnchorPositions(n,"centerRight");return new Point(s.x+7,s.y)}}[e]();return o?o instanceof b$1?(p={"bottom-center":new Point(r.x,r.y-7-o.clientHeight/2),"top-center":new Point(r.x,r.y+7+o.clientHeight/2),"right-center":new Point(r.x-7-o.clientWidth/2,r.y),"left-center":new Point(r.x+7+o.clientWidth/2,r.y)}[e])!=null?p:h:(P={"bottom-center":new Point(r.x,r.y-7-o.clientHeight/2),"top-center":new Point(r.x,r.y+7+o.clientHeight/2),"right-center":new Point(r.x-7-o.clientWidth/2,r.y),"left-center":new Point(r.x+7+o.clientWidth/2,r.y)}[e])!=null?P:h:h}updateAnnotationPosition(t,e,o){let i=this.dataCaptureView.viewAnchorPositionsForFrameAnchorPositions(t.anchorPositions);if(e.anchor||(e.anchor="top-center"),e.annotationVariation!=null){let l=this.getAnnotationVariationForQuad(t,a$5.threshold);e.annotationVariation=l;}let n=this.getTransformOrigin(e.anchor),r=this.calculateAnnotationPosition(i,e.anchor,o);e.updatePosition(r,n,this.calculateRotationAngle(i.topLeft,i.topRight));}normalizedViewPointFromFrameAnchorPositions(t,e="center"){let o=this.presenter.currentCamera.getMirrorImageEnabled(),i=new Size(this.dataCaptureView.width,this.dataCaptureView.height);if(o){let r=t[{centerLeft:"centerRight",centerRight:"centerLeft",center:"center",topCenter:"topCenter",bottomCenter:"bottomCenter"}[e]];return Point.mirrorX(r,i)}return t[e]}calculateRotationAngle(t,e){let o=e.x-t.x,n=this.presenter.isCameraMirrored()?-(e.y-t.y):e.y-t.y,r=Math.atan2(n,o);return Math.round(r*(180/Math.PI))}};d.tag="scandit-barcode-ar-view";var R=d;export{R as a};
@@ -0,0 +1 @@
1
+ var b=Object.defineProperty;var i=Object.getOwnPropertyDescriptor;var p=(r,d,t,s)=>{for(var a=s>1?void 0:s?i(d,t):d,e=r.length-1,c;e>=0;e--)(c=r[e])&&(a=(s?c(d,t,a):c(a))||a);return s&&a&&b(d,t,a),a};var o={"scandit-datacapture-sdk-barcode-pthreads.wasm":{bytes:7334919},"scandit-datacapture-sdk-barcode-simd-pthreads.wasm":{bytes:7221211},"scandit-datacapture-sdk-barcode-simd.wasm":{bytes:7268717},"scandit-datacapture-sdk-barcode.wasm":{bytes:7397834}};export{p as a,o as b};
@@ -1 +1 @@
1
- import {a as a$6}from'./chunk-TKSABJXC.js';import {a}from'./chunk-HHYYL23G.js';import {a as a$9}from'./chunk-5A3VQBKX.js';import {a as a$1}from'./chunk-DDLFCE34.js';import {a as a$7}from'./chunk-ZPKXVCG3.js';import {b}from'./chunk-5V3FWMGO.js';import {b as b$1}from'./chunk-3N7HH72O.js';import {a as a$8}from'./chunk-RZWYP24A.js';import {a as a$3}from'./chunk-67T3NHWA.js';import {a as a$4}from'./chunk-POONUNDO.js';import {b as b$2}from'./chunk-M7SLG4OU.js';import {a as a$5}from'./chunk-DHKABHFE.js';import {a as a$2}from'./chunk-I53W7VSB.js';import {Anchor,Localization,DataCaptureView,ZoomSwitchControl,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';import {Card}from'@scandit/web-datacapture-core/build/js/private/ui/atoms/Card.js';import {TorchSwitchIconButton}from'@scandit/web-datacapture-core/build/js/private/ui/molecules/TorchSwitchIconButton.js';var c={FinishButton:a$1.tag,ShutterButton:ShutterButton.tag,ProgressBarWithLabel:a.tag,CardListContainer:b$1.tag,TorchSwitchIconButton:TorchSwitchIconButton.tag},h=class h extends ScanditHTMLElement{constructor(){super(...arguments);this.shouldShowCarousel=true;this.shouldShowPauseButton=true;this.shouldShowFinishButton=true;this.shouldShowProgressBar=true;this.torchControlPosition=Anchor.TopLeft;this.zoomControlPosition=Anchor.TopRight;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.torchSwitchIconButton=null;this._shouldShowTorchControl=false;this._isTorchAvailable=false;this.zoomSwitchControl=null;this._shouldShowZoomControl=false;this.onDotClickHandler=this.onDotClick.bind(this);}set shouldShowTorchControl(t){this._shouldShowTorchControl=t,this.torchSwitchIconButton!==null&&(this.torchSwitchIconButton.hidden=!(t&&this._isTorchAvailable));}get shouldShowTorchControl(){return this._shouldShowTorchControl}set shouldShowZoomControl(t){var e;this._shouldShowZoomControl=t;let o=(e=this.zoomSwitchControl)==null?void 0:e.zoomSwitchPill;o!=null&&(o.hidden=!t);}get shouldShowZoomControl(){return this._shouldShowZoomControl}get camera(){return this.presenter.context.frameSource}static async createWithSettings(t,o,e,n,s){let i=document.createElement(h.tag);i.barcodeFindViewSettings=n,i.layout=b.create(),i.layout.innerHTML=html`<${a.tag} slot="progress" value="0" max="1" ${i.shouldShowProgressBar?"":"hidden"}></${a.tag}><${TorchSwitchIconButton.tag} slot="top-controls-left" ${i.shouldShowTorchControl?"":"hidden"}></${TorchSwitchIconButton.tag}><${b$1.tag} slot="card-list" hidden text-for-collapse-cards-button=${i.textForCollapseCardsButton}></${b$1.tag}><${ShutterButton.tag} slot="bottom-controls-center" variant="play" ${i.shouldShowPauseButton?"":"hidden"}></${ShutterButton.tag}><${a$1.tag} slot="bottom-controls-right" ${i.shouldShowFinishButton?"":"hidden"}></${a$1.tag}>`,i.append(i.layout),a$2(t)?(i.dataCaptureView=t,t.htmlElement.prepend(i),await o.setMode(e),await t.setContext(o)):(i.dataCaptureView=await DataCaptureView.forContext(o),i.dataCaptureView.connectToElement(t),t.prepend(i));let a$5=s!=null?s:a$3.recommendedCameraSettings;return a$5.zoomLevels=[.5,1],i.presenter=new b$2(i,o,e,n,a$5),await i.presenter.prepare(),await i.installZoomControl(),i.barcodeFindBasicOverlay=await a$4.withBarcodeFind(e,i.dataCaptureView),i}static async create(t,o,e){return h.register(),h.createWithSettings(t,o,e,a$5.BarcodeFindViewSettings.settings,a$3.recommendedCameraSettings)}static register(){defineCustomElements({[h.tag]:h,[TorchSwitchIconButton.tag]:TorchSwitchIconButton,[ShutterButton.tag]:ShutterButton,[a.tag]:a,[b$1.tag]:b$1,[a$1.tag]:a$1,[b.tag]:b});}async startSearching(){return this.onShutterButtonClickedHandler()}async stopSearching(){return this.presenter.stopSearching()}async pauseSearching(){return this.onShutterButtonClickedHandler()}setListener(t){this.barcodeFindViewUiListener=t,this.presenter.barcodeFindViewUiListener=this.barcodeFindViewUiListener;}async setShouldShowUserGuidanceView(t){return this.shouldShowUserGuidance=t,this.barcodeFindBasicOverlay.setUserGuidanceEnabled(this.shouldShowUserGuidance)}async setShouldShowHints(t){return this.shouldShowHints=t,this.barcodeFindBasicOverlay.setShouldShowHint(this.shouldShowHints)}setShouldShowCarousel(t){this.shouldShowCarousel=t,this.layout.toggleVisibility(c.CardListContainer,t);}setShouldShowPauseButton(t){this.shouldShowPauseButton=t,this.layout.toggleVisibility(c.ShutterButton,t);}setShouldShowFinishButton(t){this.shouldShowFinishButton=t,this.layout.toggleVisibility(c.FinishButton,t);}setShouldShowProgressBar(t){this.shouldShowProgressBar=t,this.layout.toggleVisibility(c.ProgressBarWithLabel,t);}setShouldShowTorchControl(t){this.shouldShowTorchControl=t;}setShouldShowZoomControl(t){this.shouldShowZoomControl=t;}setTorchAvailable(t){this._isTorchAvailable=t,this.torchSwitchIconButton!==null&&(this.torchSwitchIconButton.hidden=!(this._shouldShowTorchControl&&this._isTorchAvailable));}setTorchControlPosition(t){var e;this.torchControlPosition=t,[Anchor.TopCenter,Anchor.TopLeft,Anchor.TopRight,Anchor.BottomLeft].includes(t)||(this.torchControlPosition=Anchor.TopLeft);let o={[Anchor.TopCenter]:"top-controls-center",[Anchor.TopLeft]:"top-controls-left",[Anchor.TopRight]:"top-controls-right",[Anchor.BottomLeft]:"bottom-controls-left"}[this.torchControlPosition];(e=this.torchSwitchIconButton)==null||e.setAttribute("slot",o);}setZoomControlPosition(t){var n;this.zoomControlPosition=t,[Anchor.TopCenter,Anchor.TopLeft,Anchor.TopRight,Anchor.BottomLeft].includes(t)||(this.zoomControlPosition=Anchor.TopRight);let o={[Anchor.TopCenter]:"top-controls-center",[Anchor.TopLeft]:"top-controls-left",[Anchor.TopRight]:"top-controls-right",[Anchor.BottomLeft]:"bottom-controls-left"}[this.zoomControlPosition],e=(n=this.zoomSwitchControl)==null?void 0:n.zoomSwitchPill;e==null||e.setAttribute("slot",o);}setTextForCollapseCardsButton(t){this.textForCollapseCardsButton=t,this.cardList!=null&&(this.cardList["text-for-collapse-cards-button"]=t);}async setTextForAllItemsFoundSuccessfullyHint(t){return this.textForAllItemsFoundSuccessfullyHint=t,this.barcodeFindBasicOverlay.setTextForAllItemsFoundSuccessfullyHint(this.textForAllItemsFoundSuccessfullyHint)}async setTextForPointAtBarcodesToSearchHint(t){return this.textForPointAtBarcodesToSearchHint=t,this.barcodeFindBasicOverlay.setTextForPointAtBarcodesToSearchHint(this.textForPointAtBarcodesToSearchHint)}async setTextForMoveCloserToBarcodesHint(t){return this.textForMoveCloserToBarcodesHint=t,this.barcodeFindBasicOverlay.setTextForMoveCloserToBarcodesHint(this.textForMoveCloserToBarcodesHint)}async setTextForTapShutterToPauseScreenHint(t){return this.textForTapShutterToPauseScreenHint=t,this.barcodeFindBasicOverlay.setTextForTapShutterToPauseScreenHint(this.textForTapShutterToPauseScreenHint)}async setTextForTapShutterToResumeSearchHint(t){return this.textForTapShutterToResumeSearchHint=t,this.barcodeFindBasicOverlay.setTextForTapShutterToResumeScreenHint(this.textForTapShutterToResumeSearchHint)}async setTextForItemListUpdatedWhenPausedHint(t){return this.textForItemListUpdatedWhenPausedHint=t,this.barcodeFindBasicOverlay.setTextForItemListUpdatedWhenPausedHint(this.textForItemListUpdatedWhenPausedHint)}async setTextForItemListUpdatedHint(t){return this.textForItemListUpdatedHint=t,this.barcodeFindBasicOverlay.setTextForItemListUpdatedHint(this.textForItemListUpdatedHint)}connectedCallback(){var t,o,e;this.shutterButton=this.layout.querySelector(c.ShutterButton),this.finishButton=this.layout.querySelector(c.FinishButton),this.progressBar=this.layout.querySelector(c.ProgressBarWithLabel),this.cardList=this.layout.querySelector(c.CardListContainer),this.torchSwitchIconButton=this.layout.querySelector(c.TorchSwitchIconButton),(t=this.torchSwitchIconButton)==null||t.addEventListener("pointerdown",this.onTorchButtonClickedHandler),(o=this.shutterButton)==null||o.addEventListener("pointerdown",this.onShutterButtonClickedHandler),(e=this.finishButton)==null||e.addEventListener("pointerdown",this.onFinishButtonClickedHandler),this.layout.addEventListener("onlayouttap",this.onDotClickHandler);}disconnectedCallback(){var t,o,e,n;(t=this.shutterButton)==null||t.removeEventListener("pointerdown",this.onShutterButtonClickedHandler),(o=this.torchSwitchIconButton)==null||o.addEventListener("pointerdown",this.onTorchButtonClickedHandler),(e=this.finishButton)==null||e.removeEventListener("pointerdown",this.onFinishButtonClickedHandler),this.layout.removeEventListener("onlayouttap",this.onDotClickHandler),(n=this.zoomSwitchControl)==null||n.remove(),this.presenter.dispose();}async installZoomControl(){this.zoomSwitchControl=new ZoomSwitchControl,await this.zoomSwitchControl.install(this.dataCaptureView);let t=this.zoomSwitchControl.zoomSwitchPill;t!=null&&(t.setAttribute("slot","top-controls-right"),t.hidden=!this._shouldShowZoomControl,this.layout.append(t));}async onShutterButtonClicked(){this.presenter.onShutterButtonClicked();}async onTorchButtonClicked(){this.presenter.onTorchButtonClicked();}updateProgressBar(t,o){this.progressBar&&(this.progressBar.value!==t&&(this.progressBar.value=t),o!=null&&this.progressBar.max!==o&&(this.progressBar.max=o));}setShutterButtonPulse(t){this.shutterButton!=null&&(this.shutterButton.pulse=t);}switchToPaused(t,o){var n,s,i,a,u,p,m,y,L,P,H,x;let e=[];for(let d of t){let w=Card.create();w.id=`${String(d.uid)}`;let B=a$6.create();if(w.append(B),B.title=(s=(n=d.content)==null?void 0:n.info)!=null?s:d.searchOptions.barcodeData,((i=d.content)==null?void 0:i.additionalInfo)!=null&&(B.subtitle=(u=(a=d.content)==null?void 0:a.additionalInfo)!=null?u:""),o.find(l=>l.searchOptions.barcodeData===d.searchOptions.barcodeData)!=null){let l=a$7.create();l.slot="right",B.append(l);}if(((p=d.content)==null?void 0:p.image)==null){let l=a$8.create();l.slot="image-left",B.append(l);}else {let l=document.createElement("img");l.slot="image-left",l.src=(y=(m=d.content)==null?void 0:m.image)!=null?y:"",l.alt=(P=(L=d.content)==null?void 0:L.additionalInfo)!=null?P:"",B.append(l);}e.push(w);}(H=this.cardList)==null||H.renderCards(e),(x=this.cardList)==null||x.removeAttribute("hidden"),this.shutterButton.variant="play",this.shutterButton.pulse=false,this.toggleDotPulse(false);}moveCardOnTheFront(t){var e,n;if(!t)return;let o=(e=this.cardList)==null?void 0:e.getCardBySelector(`${Card.tag}#${t.uid}`);o!=null&&((n=this.cardList)==null||n.unshiftCard(o));}switchToStarted(){var t;this.clearDots(),(t=this.cardList)==null||t.setAttribute("hidden",""),this.shutterButton.variant="pause";}toggleTorchIcon(t){this.torchSwitchIconButton&&(this.torchSwitchIconButton.state=t);}onFinishButtonClicked(){this.presenter.onFinishButtonClicked();}clearDots(){let t=this.layout.querySelectorAll("[data-identifier]");for(let o of t)o.remove();}toggleDotPulse(t){let o=[...this.layout.querySelectorAll("[data-identifier]")];for(let e of o)e.pulse=t;}pointTransformation(t){return `translate3d(calc(${t.x}px - 50%), calc(${t.y}px - 50%), 0px)`}onDotClick(t){let o=t.detail.target;if(o.dataset.identifier!=null){for(let e of this.layout.querySelectorAll(a$9.tag))e.pulse=false,o===e&&o.variant==="target"&&(o.pulse=true);this.presenter.onDotClick(o.dataset.identifier);}}createDotForTrackedBarcode(t,o,e){var u,p,m;let n=this.dataCaptureView.viewAnchorPositionsForFrameAnchorPositions(t.anchorPositions),s=t.barcode.data!=null&&((u=o.foundTrackedBarcodesInLastProcessedFrame[`${t.identifier}`])==null?void 0:u.barcode.data)===t.barcode.data,i=s?(m=e==null?void 0:e[(p=t.barcode.data)!=null?p:""])==null?void 0:m.searchOptions.brush:void 0,a=i?a$9.createWithBrush(i,this.barcodeFindViewSettings.notInListItemColor):a$9.createWithColors(this.barcodeFindViewSettings.inListItemColor,this.barcodeFindViewSettings.notInListItemColor);return a.style.setProperty("position","absolute"),a.style.setProperty("transform",this.pointTransformation(n.center)),a.dataset.identifier=`${t.identifier}`,s&&(a.setAttribute("variant","target"),a.pulse=true),a}renderDots(t,o){var e,n;for(let s of t.removedTrackedBarcodes){let i=this.layout.querySelector(`[data-identifier="${s}"]`);i==null||i.remove();}if(t.addedTrackedBarcodes.length>0){let s=document.createDocumentFragment();for(let i of t.addedTrackedBarcodes)s.append(this.createDotForTrackedBarcode(i,t,o));this.layout.append(s);}for(let s of t.updatedTrackedBarcodes){let i=this.layout.querySelector(`[data-identifier="${s.identifier}"]`),{center:a}=this.dataCaptureView.viewAnchorPositionsForFrameAnchorPositions(s.anchorPositions);if(i){let u=(n=(e=this.camera)==null?void 0:e.getMirrorImageEnabled())!=null?n:false,p=new Size(this.dataCaptureView.width,this.dataCaptureView.height);i.style.setProperty("position","absolute");let m=u?Point.mirrorX(a,p):a;i.style.setProperty("transform",this.pointTransformation(m));}}}};h.tag="scandit-barcode-find-view";var M=h;export{M as a};
1
+ import {a as a$6}from'./chunk-TKSABJXC.js';import {a}from'./chunk-HHYYL23G.js';import {a as a$9}from'./chunk-5A3VQBKX.js';import {a as a$1}from'./chunk-DDLFCE34.js';import {a as a$7}from'./chunk-ZPKXVCG3.js';import {b}from'./chunk-5V3FWMGO.js';import {b as b$1}from'./chunk-3N7HH72O.js';import {a as a$8}from'./chunk-RZWYP24A.js';import {a as a$3}from'./chunk-D3EYLYMV.js';import {a as a$4}from'./chunk-POONUNDO.js';import {b as b$2}from'./chunk-M7SLG4OU.js';import {a as a$5}from'./chunk-DHKABHFE.js';import {a as a$2}from'./chunk-I53W7VSB.js';import {Anchor,Localization,DataCaptureView,ZoomSwitchControl,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';import {Card}from'@scandit/web-datacapture-core/build/js/private/ui/atoms/Card.js';import {TorchSwitchIconButton}from'@scandit/web-datacapture-core/build/js/private/ui/molecules/TorchSwitchIconButton.js';var c={FinishButton:a$1.tag,ShutterButton:ShutterButton.tag,ProgressBarWithLabel:a.tag,CardListContainer:b$1.tag,TorchSwitchIconButton:TorchSwitchIconButton.tag},h=class h extends ScanditHTMLElement{constructor(){super(...arguments);this.shouldShowCarousel=true;this.shouldShowPauseButton=true;this.shouldShowFinishButton=true;this.shouldShowProgressBar=true;this.torchControlPosition=Anchor.TopLeft;this.zoomControlPosition=Anchor.TopRight;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.torchSwitchIconButton=null;this._shouldShowTorchControl=false;this._isTorchAvailable=false;this.zoomSwitchControl=null;this._shouldShowZoomControl=false;this.onDotClickHandler=this.onDotClick.bind(this);}set shouldShowTorchControl(t){this._shouldShowTorchControl=t,this.torchSwitchIconButton!==null&&(this.torchSwitchIconButton.hidden=!(t&&this._isTorchAvailable));}get shouldShowTorchControl(){return this._shouldShowTorchControl}set shouldShowZoomControl(t){var e;this._shouldShowZoomControl=t;let o=(e=this.zoomSwitchControl)==null?void 0:e.zoomSwitchPill;o!=null&&(o.hidden=!t);}get shouldShowZoomControl(){return this._shouldShowZoomControl}get camera(){return this.presenter.context.frameSource}static async createWithSettings(t,o,e,n,s){let i=document.createElement(h.tag);i.barcodeFindViewSettings=n,i.layout=b.create(),i.layout.innerHTML=html`<${a.tag} slot="progress" value="0" max="1" ${i.shouldShowProgressBar?"":"hidden"}></${a.tag}><${TorchSwitchIconButton.tag} slot="top-controls-left" ${i.shouldShowTorchControl?"":"hidden"}></${TorchSwitchIconButton.tag}><${b$1.tag} slot="card-list" hidden text-for-collapse-cards-button=${i.textForCollapseCardsButton}></${b$1.tag}><${ShutterButton.tag} slot="bottom-controls-center" variant="play" ${i.shouldShowPauseButton?"":"hidden"}></${ShutterButton.tag}><${a$1.tag} slot="bottom-controls-right" ${i.shouldShowFinishButton?"":"hidden"}></${a$1.tag}>`,i.append(i.layout),a$2(t)?(i.dataCaptureView=t,t.htmlElement.prepend(i),await o.setMode(e),await t.setContext(o)):(i.dataCaptureView=await DataCaptureView.forContext(o),i.dataCaptureView.connectToElement(t),t.prepend(i));let a$5=s!=null?s:a$3.recommendedCameraSettings;return a$5.zoomLevels=[.5,1],i.presenter=new b$2(i,o,e,n,a$5),await i.presenter.prepare(),await i.installZoomControl(),i.barcodeFindBasicOverlay=await a$4.withBarcodeFind(e,i.dataCaptureView),i}static async create(t,o,e){return h.register(),h.createWithSettings(t,o,e,a$5.BarcodeFindViewSettings.settings,a$3.recommendedCameraSettings)}static register(){defineCustomElements({[h.tag]:h,[TorchSwitchIconButton.tag]:TorchSwitchIconButton,[ShutterButton.tag]:ShutterButton,[a.tag]:a,[b$1.tag]:b$1,[a$1.tag]:a$1,[b.tag]:b});}async startSearching(){return this.onShutterButtonClickedHandler()}async stopSearching(){return this.presenter.stopSearching()}async pauseSearching(){return this.onShutterButtonClickedHandler()}setListener(t){this.barcodeFindViewUiListener=t,this.presenter.barcodeFindViewUiListener=this.barcodeFindViewUiListener;}async setShouldShowUserGuidanceView(t){return this.shouldShowUserGuidance=t,this.barcodeFindBasicOverlay.setUserGuidanceEnabled(this.shouldShowUserGuidance)}async setShouldShowHints(t){return this.shouldShowHints=t,this.barcodeFindBasicOverlay.setShouldShowHint(this.shouldShowHints)}setShouldShowCarousel(t){this.shouldShowCarousel=t,this.layout.toggleVisibility(c.CardListContainer,t);}setShouldShowPauseButton(t){this.shouldShowPauseButton=t,this.layout.toggleVisibility(c.ShutterButton,t);}setShouldShowFinishButton(t){this.shouldShowFinishButton=t,this.layout.toggleVisibility(c.FinishButton,t);}setShouldShowProgressBar(t){this.shouldShowProgressBar=t,this.layout.toggleVisibility(c.ProgressBarWithLabel,t);}setShouldShowTorchControl(t){this.shouldShowTorchControl=t;}setShouldShowZoomControl(t){this.shouldShowZoomControl=t;}setTorchAvailable(t){this._isTorchAvailable=t,this.torchSwitchIconButton!==null&&(this.torchSwitchIconButton.hidden=!(this._shouldShowTorchControl&&this._isTorchAvailable));}setTorchControlPosition(t){var e;this.torchControlPosition=t,[Anchor.TopCenter,Anchor.TopLeft,Anchor.TopRight,Anchor.BottomLeft].includes(t)||(this.torchControlPosition=Anchor.TopLeft);let o={[Anchor.TopCenter]:"top-controls-center",[Anchor.TopLeft]:"top-controls-left",[Anchor.TopRight]:"top-controls-right",[Anchor.BottomLeft]:"bottom-controls-left"}[this.torchControlPosition];(e=this.torchSwitchIconButton)==null||e.setAttribute("slot",o);}setZoomControlPosition(t){var n;this.zoomControlPosition=t,[Anchor.TopCenter,Anchor.TopLeft,Anchor.TopRight,Anchor.BottomLeft].includes(t)||(this.zoomControlPosition=Anchor.TopRight);let o={[Anchor.TopCenter]:"top-controls-center",[Anchor.TopLeft]:"top-controls-left",[Anchor.TopRight]:"top-controls-right",[Anchor.BottomLeft]:"bottom-controls-left"}[this.zoomControlPosition],e=(n=this.zoomSwitchControl)==null?void 0:n.zoomSwitchPill;e==null||e.setAttribute("slot",o);}setTextForCollapseCardsButton(t){this.textForCollapseCardsButton=t,this.cardList!=null&&(this.cardList["text-for-collapse-cards-button"]=t);}async setTextForAllItemsFoundSuccessfullyHint(t){return this.textForAllItemsFoundSuccessfullyHint=t,this.barcodeFindBasicOverlay.setTextForAllItemsFoundSuccessfullyHint(this.textForAllItemsFoundSuccessfullyHint)}async setTextForPointAtBarcodesToSearchHint(t){return this.textForPointAtBarcodesToSearchHint=t,this.barcodeFindBasicOverlay.setTextForPointAtBarcodesToSearchHint(this.textForPointAtBarcodesToSearchHint)}async setTextForMoveCloserToBarcodesHint(t){return this.textForMoveCloserToBarcodesHint=t,this.barcodeFindBasicOverlay.setTextForMoveCloserToBarcodesHint(this.textForMoveCloserToBarcodesHint)}async setTextForTapShutterToPauseScreenHint(t){return this.textForTapShutterToPauseScreenHint=t,this.barcodeFindBasicOverlay.setTextForTapShutterToPauseScreenHint(this.textForTapShutterToPauseScreenHint)}async setTextForTapShutterToResumeSearchHint(t){return this.textForTapShutterToResumeSearchHint=t,this.barcodeFindBasicOverlay.setTextForTapShutterToResumeScreenHint(this.textForTapShutterToResumeSearchHint)}async setTextForItemListUpdatedWhenPausedHint(t){return this.textForItemListUpdatedWhenPausedHint=t,this.barcodeFindBasicOverlay.setTextForItemListUpdatedWhenPausedHint(this.textForItemListUpdatedWhenPausedHint)}async setTextForItemListUpdatedHint(t){return this.textForItemListUpdatedHint=t,this.barcodeFindBasicOverlay.setTextForItemListUpdatedHint(this.textForItemListUpdatedHint)}connectedCallback(){var t,o,e;this.shutterButton=this.layout.querySelector(c.ShutterButton),this.finishButton=this.layout.querySelector(c.FinishButton),this.progressBar=this.layout.querySelector(c.ProgressBarWithLabel),this.cardList=this.layout.querySelector(c.CardListContainer),this.torchSwitchIconButton=this.layout.querySelector(c.TorchSwitchIconButton),(t=this.torchSwitchIconButton)==null||t.addEventListener("pointerdown",this.onTorchButtonClickedHandler),(o=this.shutterButton)==null||o.addEventListener("pointerdown",this.onShutterButtonClickedHandler),(e=this.finishButton)==null||e.addEventListener("pointerdown",this.onFinishButtonClickedHandler),this.layout.addEventListener("onlayouttap",this.onDotClickHandler);}disconnectedCallback(){var t,o,e,n;(t=this.shutterButton)==null||t.removeEventListener("pointerdown",this.onShutterButtonClickedHandler),(o=this.torchSwitchIconButton)==null||o.addEventListener("pointerdown",this.onTorchButtonClickedHandler),(e=this.finishButton)==null||e.removeEventListener("pointerdown",this.onFinishButtonClickedHandler),this.layout.removeEventListener("onlayouttap",this.onDotClickHandler),(n=this.zoomSwitchControl)==null||n.remove(),this.presenter.dispose();}async installZoomControl(){this.zoomSwitchControl=new ZoomSwitchControl,await this.zoomSwitchControl.install(this.dataCaptureView);let t=this.zoomSwitchControl.zoomSwitchPill;t!=null&&(t.setAttribute("slot","top-controls-right"),t.hidden=!this._shouldShowZoomControl,this.layout.append(t));}async onShutterButtonClicked(){this.presenter.onShutterButtonClicked();}async onTorchButtonClicked(){this.presenter.onTorchButtonClicked();}updateProgressBar(t,o){this.progressBar&&(this.progressBar.value!==t&&(this.progressBar.value=t),o!=null&&this.progressBar.max!==o&&(this.progressBar.max=o));}setShutterButtonPulse(t){this.shutterButton!=null&&(this.shutterButton.pulse=t);}switchToPaused(t,o){var n,s,i,a,u,p,m,y,L,P,H,x;let e=[];for(let d of t){let w=Card.create();w.id=`${String(d.uid)}`;let B=a$6.create();if(w.append(B),B.title=(s=(n=d.content)==null?void 0:n.info)!=null?s:d.searchOptions.barcodeData,((i=d.content)==null?void 0:i.additionalInfo)!=null&&(B.subtitle=(u=(a=d.content)==null?void 0:a.additionalInfo)!=null?u:""),o.find(l=>l.searchOptions.barcodeData===d.searchOptions.barcodeData)!=null){let l=a$7.create();l.slot="right",B.append(l);}if(((p=d.content)==null?void 0:p.image)==null){let l=a$8.create();l.slot="image-left",B.append(l);}else {let l=document.createElement("img");l.slot="image-left",l.src=(y=(m=d.content)==null?void 0:m.image)!=null?y:"",l.alt=(P=(L=d.content)==null?void 0:L.additionalInfo)!=null?P:"",B.append(l);}e.push(w);}(H=this.cardList)==null||H.renderCards(e),(x=this.cardList)==null||x.removeAttribute("hidden"),this.shutterButton.variant="play",this.shutterButton.pulse=false,this.toggleDotPulse(false);}moveCardOnTheFront(t){var e,n;if(!t)return;let o=(e=this.cardList)==null?void 0:e.getCardBySelector(`${Card.tag}#${t.uid}`);o!=null&&((n=this.cardList)==null||n.unshiftCard(o));}switchToStarted(){var t;this.clearDots(),(t=this.cardList)==null||t.setAttribute("hidden",""),this.shutterButton.variant="pause";}toggleTorchIcon(t){this.torchSwitchIconButton&&(this.torchSwitchIconButton.state=t);}onFinishButtonClicked(){this.presenter.onFinishButtonClicked();}clearDots(){let t=this.layout.querySelectorAll("[data-identifier]");for(let o of t)o.remove();}toggleDotPulse(t){let o=[...this.layout.querySelectorAll("[data-identifier]")];for(let e of o)e.pulse=t;}pointTransformation(t){return `translate3d(calc(${t.x}px - 50%), calc(${t.y}px - 50%), 0px)`}onDotClick(t){let o=t.detail.target;if(o.dataset.identifier!=null){for(let e of this.layout.querySelectorAll(a$9.tag))e.pulse=false,o===e&&o.variant==="target"&&(o.pulse=true);this.presenter.onDotClick(o.dataset.identifier);}}createDotForTrackedBarcode(t,o,e){var u,p,m;let n=this.dataCaptureView.viewAnchorPositionsForFrameAnchorPositions(t.anchorPositions),s=t.barcode.data!=null&&((u=o.foundTrackedBarcodesInLastProcessedFrame[`${t.identifier}`])==null?void 0:u.barcode.data)===t.barcode.data,i=s?(m=e==null?void 0:e[(p=t.barcode.data)!=null?p:""])==null?void 0:m.searchOptions.brush:void 0,a=i?a$9.createWithBrush(i,this.barcodeFindViewSettings.notInListItemColor):a$9.createWithColors(this.barcodeFindViewSettings.inListItemColor,this.barcodeFindViewSettings.notInListItemColor);return a.style.setProperty("position","absolute"),a.style.setProperty("transform",this.pointTransformation(n.center)),a.dataset.identifier=`${t.identifier}`,s&&(a.setAttribute("variant","target"),a.pulse=true),a}renderDots(t,o){var e,n;for(let s of t.removedTrackedBarcodes){let i=this.layout.querySelector(`[data-identifier="${s}"]`);i==null||i.remove();}if(t.addedTrackedBarcodes.length>0){let s=document.createDocumentFragment();for(let i of t.addedTrackedBarcodes)s.append(this.createDotForTrackedBarcode(i,t,o));this.layout.append(s);}for(let s of t.updatedTrackedBarcodes){let i=this.layout.querySelector(`[data-identifier="${s.identifier}"]`),{center:a}=this.dataCaptureView.viewAnchorPositionsForFrameAnchorPositions(s.anchorPositions);if(i){let u=(n=(e=this.camera)==null?void 0:e.getMirrorImageEnabled())!=null?n:false,p=new Size(this.dataCaptureView.width,this.dataCaptureView.height);i.style.setProperty("position","absolute");let m=u?Point.mirrorX(a,p):a;i.style.setProperty("transform",this.pointTransformation(m));}}}};h.tag="scandit-barcode-find-view";var M=h;export{M as a};
@@ -0,0 +1,2 @@
1
+ import {DataCaptureLoader,Logger}from'@scandit/web-datacapture-core';function d(r){let n=URL.createObjectURL(new Blob(['"use strict";(()=>{var u={"scandit-datacapture-sdk-barcode-pthreads.wasm":{bytes:7334919},"scandit-datacapture-sdk-barcode-simd-pthreads.wasm":{bytes:7221211},"scandit-datacapture-sdk-barcode-simd.wasm":{bytes:7268717},"scandit-datacapture-sdk-barcode.wasm":{bytes:7397834}};function M(t){return typeof t=="object"&&t!=null}function C(t){if(typeof t=="string")return t;if(M(t)){if(typeof t.message=="string")return t.message}else if(typeof(t==null?void 0:t.toString)=="function")return t.toString();return"unknown error"}var d;(t=>{(l=>(l.Debug="debug",l.Info="info",l.Warn="warn",l.Error="error",l.Quiet="quiet"))(t.Level||(t.Level={}));let e=new Map([["debug",1],["info",2],["warn",3],["error",4],["quiet",5]]),a="debug";function r(l){a=l}t.setLevel=r;function i(l,...h){if(!(e.get(a)>e.get(l)))switch(l){case"debug":{console.debug(...h);break}case"info":{console.log(...h);break}case"warn":{console.warn(...h);break}case"error":{console.error(...h);break}}}t.log=i;function n(...l){i("warn",...l)}t.warn=n;function o(...l){i("debug",...l)}t.debug=o;function s(...l){i("info",...l)}t.info=s;function c(...l){i("error",...l)}t.error=c})(d||(d={}));var ke=class{constructor(t){if(typeof t!="function")throw new TypeError("FinalizationRegistry callback must be a function")}register(t,e,a){}unregister(t){return!1}};function X(t){typeof t.FinalizationRegistry>"u"&&(t.FinalizationRegistry=ke)}function K(t,e,a){let r=e*a,i=new Uint8ClampedArray(r*4),n=new Uint32Array(i.buffer);for(let o=0;o<r;o++){let s=t[o];n[o]=4278190080|s<<16|s<<8|s}return i}var P=class Z extends Error{constructor(e){super(e.message),Object.setPrototypeOf(this,Z.prototype),this.name=e.name}toString(){return`${this.name}: ${this.message}`}};async function De(t){let e;try{let a=new Promise((i,n)=>{e=setTimeout(()=>{d.debug(`IndexedDB database is blocked (timed out after ${t}ms). If you are running a Debug wasm build, things are slower and the timeout can be configured via IndexedDBBlockedTimeoutMs in localStorage (requires page reload).`),n(new P({name:"BlockedIndexedDB",message:"IndexedDB database is blocked"}))},t)}),r=new Promise((i,n)=>{FS.syncfs(!0,o=>{o!=null?n(o):i()})});await Promise.race([r,a])}finally{e!==void 0&&clearTimeout(e)}}async function Q(t){try{FS.mkdir(t.writableDataPath)}catch(e){if(e.code!=="EEXIST")throw e}return FS.mount(IDBFS,{autoPersist:!0},t.writableDataPath),De(t.indexedDBTimeoutMs)}var ee={};function Ie(t){return[...new Uint8Array(t)].map(e=>{let a=e.toString(16);return a.length===1?`0${a}`:a}).join("")}async function*Pe(t){let e=t.getReader();try{for(;;){let{done:a,value:r}=await e.read();if(a)return;yield r}}finally{e.releaseLock()}}async function Be(t){let e=[],a=0,r=0;for await(let n of Pe(t))e.push(n),a+=n.length;let i=new Uint8Array(a);for(let n of e)i.set(n,r),r+=n.length;return i.buffer}var xe=(t=>(t.VALID="VALID",t.INVALID="INVALID",t.NOT_VERIFIABLE="NOT_VERIFIABLE",t))(xe||{});async function Te(t,e,a){if(typeof crypto.subtle.digest!="function")return d.log(d.Level.Warn,`Insecure context (see https://developer.mozilla.org/en-US/docs/Web/Security/Secure_Contexts): The hash of the Scandit Data Capture library WASM file found at ${a} could not be verified`),"NOT_VERIFIABLE";try{let r=t instanceof Promise?await t:t,i=await crypto.subtle.digest("SHA-256",r),n=Ie(i);return e==null?(d.log(d.Level.Warn,"The library hash is not defined or empty, cannot correctly verify integrity."),"NOT_VERIFIABLE"):n===e?(d.log(d.Level.Debug,`Data Capture library WASM integrity found at ${a} has been verified correctly.`),"VALID"):(d.log(d.Level.Warn,`The Scandit Data Capture library WASM file found at ${a} seems invalid: expected file hash doesn\'t match (received: ${n}, expected: ${e}). Please ensure the correct Scandit Data Capture file (with correct version) is retrieved.`),"INVALID")}catch(r){return d.log(d.Level.Warn,"Wasm response could not be verified",r),"NOT_VERIFIABLE"}}var J=new Map([["br",4.4],["gzip",2.9],["none",1]]);function Ae(t){var e;let a="content-encoding";if(t==null||t.get(a)==null)return J.get("none");let r=new Set(((e=t.get(a))!=null?e:"").split(",").map(i=>i.trim()));for(let[i,n]of J)if(r.has(i))return n;return J.get("none")}function Oe(t){var e,a;if(t==null)return 0;let r=(e=Ae(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 Re(t){let{pathname:e}=new URL(t);for(let[a,r]of Object.entries(ee))if(e.endsWith(a))return r.bytes;return 0}function te(t){ee=t}var Ee=(t,e)=>{let a=Oe(e);return a===0?Re(t):a};function Le(t,e,a,{onProgress:r,onError:i,onComplete:n}){if(!e.body)return[e];let o=Ee(t,e.headers),s=0,c=0;if(typeof TransformStream>"u")return d.warn("TransformStream is not supported in this environment. Progress tracking will be disabled."),[e];let[l,h]=a?e.body.tee():[e.body],m=l.pipeThrough(new TransformStream({async transform(g,f){try{s+=g.length,c=Number((s/o*100).toFixed(2)),o>0&&g.length>0&&c<100?r==null||r({percentage:c,loadedBytes:s,privateUri:t}):o===0&&g.length>0&&(r==null||r({percentage:null,loadedBytes:s,privateUri:t})),f.enqueue(g)}catch(b){f.error(b),i==null||i({error:b})}},flush(g){r==null||r({percentage:100,loadedBytes:s,privateUri:t}),n==null||n({percentage:100,loadedBytes:s,privateUri:t}),g.terminate()}}));return[new Response(m,{headers:new Headers(e.headers),status:e.status,statusText:e.statusText}),h]}async function U({wasmURI:t,expectedHash:e,verifyResponseHash:a,onProgress:r,onComplete:i,onError:n,referredOrigin:o}){let s=await fetch(t,{referrerPolicy:"origin",referrer:o!=null?o:""});if(!s.ok)throw new Error(`HTTP status code is not ok: ${s.status}, ${s.statusText}`);let[c,l]=Le(t,s,a,{onProgress:r,onError:n,onComplete:i});return l!=null&&Te(Be(l),e,t),c}function ae({wasmURI:t,expectedHash:e,verifyResponseHash:a,progressCallback:r,successCallback:i,errorCallback:n,importObject:o,referredOrigin:s}){async function c(h){try{let m=await U({wasmURI:t,expectedHash:e,verifyResponseHash:a,onProgress:r,referredOrigin:s}),g=await(h!=null?h:m).arrayBuffer(),f=await self.WebAssembly.instantiate(g,o);i(f.instance,f.module)}catch(m){d.log(d.Level.Error,m),d.log(d.Level.Error,`Couldn\'t instantiate Scandit SDK DataCapture library at ${t}, did you configure the path for it correctly?`),n==null||n(m)}}async function l(){let h;try{h=await U({wasmURI:t,expectedHash:e,verifyResponseHash:a,onProgress:r,referredOrigin:s});let m=await self.WebAssembly.instantiateStreaming(h,o);i(m.instance,m.module)}catch(m){d.log(d.Level.Warn,m),d.log(d.Level.Warn,"WebAssembly streaming compile failed. Falling back to ArrayBuffer instantiation (this will make things slower)"),c((h==null?void 0:h.bodyUsed)===!0?void 0:h)}}typeof self.WebAssembly.instantiateStreaming=="function"?l():c()}async function $(t,e,a,r){return new Promise((i,n)=>{t().then(i).catch(o=>{let s=e*2;if(s>a){n(o);return}r(o),self.setTimeout(()=>{$(t,s,a,r).then(i).catch(n)},e)})})}function G(t){var e,a;let r="unknown";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):(/^(\\d{1,3}\\.){3}\\d{1,3}$/.test(r)&&(r=r.split(".").map(i=>Number.parseInt(i,10).toString()).join(".")),r)}async function re(t,e){async function a(){return importScripts(t)}try{await $(a,250,4e3,i=>{d.log(d.Level.Warn,i),d.log(d.Level.Warn,`Couldn\'t retrieve Scandit Data Capture library at ${t}, retrying...`)}),self.Module.mainScriptUrlOrBlob=t;let r=self.SDC_WASM_JS_VERSION;return r!==e&&d.log(d.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 d.log(d.Level.Error,r),!1}}var ie=class{constructor(t){this.viewInfo=null,this.viewInfo=this.cloneViewInfo(t)}isSame(t){return this.viewInfo==null&&t==null?!0:this.viewInfo==null&&t!=null||this.viewInfo!=null&&t==null?!1:this.viewInfo.width===t.width&&this.viewInfo.height===t.height&&this.viewInfo.orientation===t.orientation&&this.viewInfo.viewFinderRect.origin.x===t.viewFinderRect.origin.x&&this.viewInfo.viewFinderRect.origin.y===t.viewFinderRect.origin.y&&this.viewInfo.viewFinderRect.size.width===t.viewFinderRect.size.width&&this.viewInfo.viewFinderRect.size.height===t.viewFinderRect.size.height}update(t){this.viewInfo=this.cloneViewInfo(t)}cloneViewInfo(t){return t?{...t,viewFinderRect:{origin:{...t.viewFinderRect.origin},size:{...t.viewFinderRect.size}}}:null}};var B=class{constructor(){this.promise=new Promise((t,e)=>{this.reject=e,this.resolve=t})}};var j=class{constructor(t,e){this.workerFunctions=t,this.options=e,this.imageIdCounter=0,this.conversions=new Map}convertToJpeg(t,e){let a=this.imageIdCounter++,r=new B;this.conversions.set(a,r);let i=t.toBitmap();return this.workerFunctions.postMessage({type:"convertToJPEG",imageId:a,width:t.getWidth(),height:t.getHeight(),data:i,planes:t.getPlanes(),orientation:e,quality:this.options.quality},Array.from(new Set([i.buffer]))),r.promise}convertToBitmap(t){return{data:t.toBitmap(),byteOrder:1}}onConvertToJPEGResult(t,e){let a=this.conversions.get(t);a?(a.resolve(e),this.conversions.delete(t)):d.warn(`ImageConverterForwarder: Conversion for imageId ${t} not found in Map`)}};var x=class{constructor(t){this.options=t}get quality(){return this.options.quality}async convertToJpeg(t,e){try{let{width:a,height:r,planes:i}=this.validateAndExtractImageData(t);this.prepareCanvas(a,r);let n=this.processImageData(t,i,a,r);return await this.convertToJpegBytes(n,e)}catch(a){throw d.warn(`Failed to convert image to JPEG: ${a}`),a instanceof Error?a:new Error("Failed to convert image to JPEG")}}convertToBitmap(t){return{data:t.toBitmap(),byteOrder:1}}validateAndExtractImageData(t){let e=t.getWidth(),a=t.getHeight(),r=t.getPlanes();if(e<=0||a<=0)throw d.warn(`Invalid image dimensions: ${e}x${a}`),new Error(`Invalid image dimensions: ${e}x${a}`);if(!r||r.length===0)throw d.warn("ImageBuffer has no planes"),new Error("ImageBuffer has no planes");return{width:e,height:a,planes:r}}prepareCanvas(t,e){if(!this.ensureCanvas(t,e))throw new Error("Failed to create OffscreenCanvas");if(!this.canvas||!this.context)throw new Error("Canvas or context not properly initialized")}processImageData(t,e,a,r){let i=this.createImageDataFromBuffer(t,e,a,r);if(i===null)throw new Error("Failed to create ImageData");return this.validateImageData(i,a,r),i}validateImageData(t,e,a){var r;if(t.width!==e||t.height!==a)throw d.warn(`ImageData dimensions mismatch: expected ${e}x${a}, got ${t.width}x${t.height}`),new Error("ImageData dimensions mismatch");if(!t.data||t.data.length!==e*a*4)throw d.warn(`ImageData has invalid data length: expected ${e*a*4}, got ${((r=t.data)==null?void 0:r.length)||0}`),new Error("ImageData has invalid data length")}async convertToJpegBytes(t,e){if(!this.context||!this.canvas)throw new Error("Canvas or context not available");try{this.context.putImageData(t,0,0)}catch(n){throw d.warn(`Failed to put image data on canvas: ${n}`),new Error(`Failed to put image data on canvas: ${n}`)}let a=e!==0?this.applyRotation(this.canvas,e):this.canvas,r;try{r=await this.canvasToBlob(a)}catch(n){throw d.warn(`Failed to convert canvas to blob: ${n}`),new Error(`Failed to convert canvas to blob: ${n}`)}if(!r||r.size===0)throw d.warn("Canvas convertToBlob returned empty or null blob"),new Error("Failed to create JPEG blob");let i;try{i=await r.arrayBuffer()}catch(n){throw d.warn(`Failed to get array buffer from blob: ${n}`),new Error(`Failed to get array buffer from blob: ${n}`)}if(!i||i.byteLength===0)throw d.warn("Blob arrayBuffer returned empty or null buffer"),new Error("Failed to get array buffer from blob");return new Uint8Array(i)}ensureCanvas(t,e){try{return(!this.canvas||this.canvas.width!==t||this.canvas.height!==e)&&(this.canvas=this.getNewCanvas(t,e),this.context=this.canvas.getContext("2d")),this.context!==null}catch(a){return d.warn("Failed to create HTMLCanvasElement",a),!1}}createImageDataFromBuffer(t,e,a,r){let i=new Set(e.map(n=>n.channel));try{if(this.isYUVFormat(i)){let s=t.toBitmap();return!s||s.length!==a*r*4?(d.warn(`Invalid bitmap data from toBitmap(): expected ${a*r*4} bytes, got ${(s==null?void 0:s.length)||0}`),null):new ImageData(new Uint8ClampedArray(s),a,r)}if(this.isRGBAFormat(i))return this.createImageDataFromRGBAPlanes(e,a,r);if(this.isRGBFormat(i))return this.createImageDataFromRGBPlanes(e,a,r);if(this.isGrayscaleFormat(i))return this.createImageDataFromGrayscalePlanes(e,a,r);d.warn(`Unknown image format with channels: ${Array.from(i).join(", ")}, falling back to toBitmap()`);let n=t.toBitmap();if(!n||n.length===0)return d.warn("toBitmap() returned empty or null data"),null;let o=n.length/(a*r);return o===4?new ImageData(new Uint8ClampedArray(n),a,r):(d.warn(`Unsupported format: ${o} bytes per pixel`),null)}catch(n){return d.warn(`Failed to create ImageData: ${n}`),null}}isYUVFormat(t){return t.has(0)&&t.has(1)&&t.has(2)}isRGBAFormat(t){return t.has(3)&&t.has(4)&&t.has(5)&&t.has(6)}isRGBFormat(t){return t.has(3)&&t.has(4)&&t.has(5)&&!t.has(6)}isGrayscaleFormat(t){return t.has(0)&&!t.has(1)&&!t.has(2)}createImageDataFromRGBAPlanes(t,e,a){let r=t.find(c=>c.channel===3),i=t.find(c=>c.channel===4),n=t.find(c=>c.channel===5),o=t.find(c=>c.channel===6);if(!r||!i||!n||!o)return d.warn("Missing RGBA planes"),null;let s=new Uint8ClampedArray(e*a*4);for(let c=0;c<a;c++)for(let l=0;l<e;l++){let h=(c*e+l)*4;s[h]=this.getPixelFromPlane(r,l,c),s[h+1]=this.getPixelFromPlane(i,l,c),s[h+2]=this.getPixelFromPlane(n,l,c),s[h+3]=this.getPixelFromPlane(o,l,c)}return new ImageData(s,e,a)}createImageDataFromRGBPlanes(t,e,a){let r=t.find(s=>s.channel===3),i=t.find(s=>s.channel===4),n=t.find(s=>s.channel===5);if(!r||!i||!n)return d.warn("Missing RGB planes"),null;let o=new Uint8ClampedArray(e*a*4);for(let s=0;s<a;s++)for(let c=0;c<e;c++){let l=(s*e+c)*4;o[l]=this.getPixelFromPlane(r,c,s),o[l+1]=this.getPixelFromPlane(i,c,s),o[l+2]=this.getPixelFromPlane(n,c,s),o[l+3]=255}return new ImageData(o,e,a)}createImageDataFromGrayscalePlanes(t,e,a){let r=t.find(n=>n.channel===0);if(!r)return d.warn("Missing Y plane for grayscale"),null;let i=new Uint8ClampedArray(e*a*4);for(let n=0;n<a;n++)for(let o=0;o<e;o++){let s=(n*e+o)*4,c=this.getPixelFromPlane(r,o,n);i[s]=c,i[s+1]=c,i[s+2]=c,i[s+3]=255}return new ImageData(i,e,a)}getPixelFromPlane(t,e,a){let r=Math.floor(e/(t.subsamplingX||1)),i=Math.floor(a/(t.subsamplingY||1)),n=t.rowStride,o=t.pixelStride,s=i*n+r*o,c=t.data;return s<c.length?c[s]:0}applyRotation(t,e){let a=e*Math.PI/180,r=e===90||e===270||e===-90||e===-270,i=r?t.height:t.width,n=r?t.width:t.height,o=this.getNewCanvas(i,n),s=o.getContext("2d");if(!s)throw new Error("Failed to get 2D context for rotated canvas");return s.translate(i/2,n/2),s.rotate(a),s.translate(-t.width/2,-t.height/2),s.drawImage(t,0,0),o}};x.JPEG_IMAGE_MIME_TYPE="image/jpeg";var ne=class extends x{getNewCanvas(t,e){return new OffscreenCanvas(t,e)}canvasToBlob(t){return t.convertToBlob({type:x.JPEG_IMAGE_MIME_TYPE,quality:this.options.quality})}};var T;(t=>{function e(){return"8.4.0"}t.sdkVersion=e})(T||(T={}));function We(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 Ne(t){let e=/@scandit\\/web-datacapture-[a-z]+/i.exec(t);return e?e[0]:null}function se(t,e,a){let r=e,i=We(r);if(i.result){let o=Ne(r);o!=null&&(r=`${i.cdnBaseURL}${o}@${t}/sdc-lib/`)}let n=a.replace(".wasm","");return i.result?{jsURI:`${r}${n}.js`,wasmURI:`${r}${n}.wasm`}:{jsURI:`${r}${n}.js?v=${t}`,wasmURI:`${r}${n}.wasm?v=${t}`}}var oe=class de{constructor(e,a){this.hintPresenterV2=null,this.MAX_NUMBER_OF_IMAGES_IN_FRAME_DATA_POOL=5,this.redrawInterval=1e3/30,this.redrawRequests=[],this._isDrawLoopRunning=!1,this.frameDataPool=new Map,this.lastFrameColorType="RGBA",this.lastFrameId=null,this.poorMansBenchmarkLogs=!1,this.writableDataPathStandard="/scandit_sync_folder",this.resourceFilesSubfolder="resources",this.performanceMetricsReporterTimer=void 0,this.lastMetricsReportTime=0,this.metricsReportInterval=1e3,this.performanceMetrics={frameDataPoolSize:0,cameraOutputFrames:0,redrawRequestsCount:0,actualRedrawsCount:0,frameProcessingStartedCount:0,frameProcessedCount:0,frameSkippedCount:0},this.frameProcessingStartedCount=0,this.frameProcessingFinishedCount=0,this.gestureListener=null,this.webPlatformHintPresenter=null,this.deviceInstance=null,this.deviceInfo=null,this.lastViewInfo=new ie(null),this.lastFrameProcessingStartedCount=0,this.lastFrameProcessingFinishedCount=0,this.moduleHandler=e,this.workerFunctions=a,this._loadProgressCallback=this._loadProgressCallback.bind(this),te(this.getWasmMetadata())}get Module(){return this.moduleHandler.get()}set isDrawLoopRunning(e){this._isDrawLoopRunning=e,!e&&typeof this.loopTimeoutId=="number"&&(clearTimeout(this.loopTimeoutId),this.loopTimeoutId=void 0)}get isDrawLoopRunning(){return this._isDrawLoopRunning}prepareFrameForListener(e){let a=this.lastFrameId;if(this.frameDataPool.size>=this.MAX_NUMBER_OF_IMAGES_IN_FRAME_DATA_POOL){let o=this.frameDataPool.keys().next().value;o!=null&&this.frameDataPool.delete(o)}let r=e.getFrameData(),i=new Uint8ClampedArray(r);this.frameDataPool.set(a,{data:i,colorType:this.lastFrameColorType,frameId:a,width:e.getWidth(),height:e.getHeight()});let n=this.lastUsedModuleMirrorAxis==null?!1:this.lastUsedModuleMirrorAxis!==this.Module.Axis.None;return{frameId:a,width:e.getWidth(),height:e.getHeight(),isFrameSourceMirrored:n,colorType:this.lastFrameColorType}}createContext(e){var a,r,i,n,o;let s=this.getModeDeserializers(),c=G(location);(c==="localhost"||c==="127.0.0.1")&&navigator.userAgent.includes("Electron")&&e.appName!=null&&(c+=`-${e.appName}`),this.parentDomain=e.parentDomain,this.contextDeserializer=new this.Module.DataCaptureContextDeserializer(this.writableDataPath,e.deviceId,e.context.deviceModelName,c,this.parentDomain,s,e.delayedRegistration,e.highEndBlurryRecognition,this.resourcePath);let l=this.contextDeserializer.contextFromJson(JSON.stringify(e.context));if(l==null){let p=this.contextDeserializer.getLastError();throw new Error(`Could not create the context: ${p}`)}let h=l.getView();this.context=l.getContext(),l.delete(),this.setupDeviceInterface(e.isTablet,e.batteryInfo);let m=this.Module.DataCaptureContextListener.extend("DataCaptureContextListener",{didChangeStatus:(p,y)=>{this.contextDidChangeStatus(JSON.parse(y.toJson())),p.delete()},didStartObservingContext:p=>{this.didStartObservingContext(),p.delete()},didStopObservingContext:p=>{p.delete()}}),g=this.Module.DataCaptureContextFrameListener.extend("DataCaptureContextFrameListener",{onObservationStarted:p=>{p.delete()},onObservationStopped:p=>{p.delete()},onFrameProcessingStarted:(p,y)=>{this.workerFunctions.postMessage({type:"onFrameProcessingStarted"}),y.delete(),p.delete()},onFrameProcessingFinished:(p,y)=>{this.workerFunctions.postMessage({type:"onFrameProcessingFinished"}),y.delete(),p.delete()},onFrameSkipped:(p,y)=>{this.workerFunctions.postMessage({type:"onFrameSkipped"}),y.delete(),p.delete()}}),f=this.Module.GestureRecognizer.extend("GestureRecognizer",{setGestureListener:(p,y)=>{var v;(v=this.gestureListener)==null||v.delete(),this.gestureListener=p.clone(),p.delete()}});(a=this.gestureRecognizer)==null||a.delete(),this.gestureRecognizer=new f;let b=new m;this.context.addListener(b),b.delete();let D=new g;this.context.addFrameListener(D),D.delete(),this.setView(h),(r=this.view)==null||r.setGestureRecognizer(this.gestureRecognizer);let F=this.Module.PlatformHintPresenter.extend("PlatformHintPresenter",{setHintPresenter:p=>{p.delete()},showToast:p=>{this.workerFunctions.postMessage({type:"showToast",payload:JSON.parse(p)})},hideToast:p=>{this.workerFunctions.postMessage({type:"hideToast",payload:JSON.parse(p)})},showGuidance:p=>{this.workerFunctions.postMessage({type:"showGuidance",payload:JSON.parse(p)})},hideGuidance:p=>{this.workerFunctions.postMessage({type:"hideGuidance",payload:JSON.parse(p)})},startUpdateTimer:p=>{this.workerFunctions.postMessage({type:"startUpdateTimer",payload:{duration:{unit:"ms",value:p}}})},stopUpdateTimer:()=>{this.workerFunctions.postMessage({type:"stopUpdateTimer"})}});(i=this.hintPresenterV2)==null||i.delete(),this.hintPresenterV2=null,(n=this.webPlatformHintPresenter)==null||n.delete(),this.webPlatformHintPresenter=null,this.webPlatformHintPresenter=new F,this.view&&(this.hintPresenterV2=new this.Module.HintPresenterV2(this.webPlatformHintPresenter),(o=this.view)==null||o.setHintPresenterV2(this.hintPresenterV2)),this.webImageConverterInstance=this.getImageConverterInstance({quality:1}),this.Module.ImageConverter.setInstance(this.webImageConverterInstance)}convertToJPEGResult(e,a){this.webImageConverterInstance instanceof j&&this.webImageConverterInstance.onConvertToJPEGResult(e,a)}getImageConverterInstance(e){return this.workerFunctions.getOffscreenCanvas()!=null?new ne(e):new j(this.workerFunctions,e)}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.lastMetricsReportTime=performance.now(),this.scheduleMetricsReporting())}scheduleMetricsReporting(){this.performanceMetricsReporterTimer=setTimeout(()=>{this.checkAndReportMetrics()},100)}checkAndReportMetrics(){let e=performance.now();e-this.lastMetricsReportTime>=this.metricsReportInterval&&(this.reportPerformanceMetrics(),this.performanceMetrics.cameraOutputFrames=0,this.performanceMetrics.redrawRequestsCount=0,this.performanceMetrics.actualRedrawsCount=0,this.lastMetricsReportTime=e),this._isDrawLoopRunning&&this.scheduleMetricsReporting()}async reportPerformanceMetrics(){let e=this.frameProcessingStartedCount-this.lastFrameProcessingStartedCount,a=this.frameProcessingFinishedCount-this.lastFrameProcessingFinishedCount;this.lastFrameProcessingStartedCount=this.frameProcessingStartedCount,this.lastFrameProcessingFinishedCount=this.frameProcessingFinishedCount;let r={cameraOutputFrames:this.performanceMetrics.cameraOutputFrames,redrawRequestsCount:this.performanceMetrics.redrawRequestsCount,actualRedrawsCount:this.performanceMetrics.actualRedrawsCount,frameDataPoolSize:this.performanceMetrics.frameDataPoolSize,frameProcessingStartedCount:e,frameProcessedCount:a,frameSkippedCount:this.performanceMetrics.frameSkippedCount};this.workerFunctions.postMessage({type:"performanceMetricsReport",payload:r})}deleteFrameData(e){this.frameDataPool.delete(e)}dispose(){var e,a,r,i,n;this.context.dispose(),this.frameDataPool.clear(),this.isDrawLoopRunning=!1,this.cleanupMetricsReporting(),(e=this.gestureRecognizer)==null||e.delete(),this.gestureRecognizer=null,(a=this.gestureListener)==null||a.delete(),this.gestureListener=null,(r=this.hintPresenterV2)==null||r.delete(),this.hintPresenterV2=null,(i=this.webPlatformHintPresenter)==null||i.delete(),this.webPlatformHintPresenter=null,(n=this.deviceInstance)==null||n.delete(),this.deviceInstance=null,this.deviceInfo=null}cleanupMetricsReporting(){this.performanceMetricsReporterTimer!=null&&(typeof this.performanceMetricsReporterTimer=="number"?cancelAnimationFrame(this.performanceMetricsReporterTimer):clearTimeout(this.performanceMetricsReporterTimer),this.performanceMetricsReporterTimer=void 0)}flushAnalytics(){this.context.flushAnalytics()}extractCentaurusLicense(e){return{payload:{centaurus:{licenseKey:this.Module.LicenseUtils[de.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 d.debug("[processFrame] Context is null, returning frame without processing"),{payload:e,transferables:[e.data.buffer]};this.lastFrameId=e.frameId;let r=e.data,i=e.colorType==="GRAYSCALE"?this.Module.ImageBufferFormat.Grayscale8:this.Module.ImageBufferFormat.Rgba8888;this.lastFrameColorType=e.colorType==="GRAYSCALE"?"GRAYSCALE":"RGBA";let n=this.Module.allocateUint8Array(r.byteLength);return this.Module.HEAPU8.set(r,n),(a=this.imageFrameSource)==null||a.outputFrame(n,e.width,e.height,i),{payload:e,transferables:[e.data.buffer]}}reportCameraProperties(e){this.context.setCameraProperties(e.deviceId,e.isFrontFacing,e.hasAutofocus)}requestFrameData(e){let a=this.frameDataPool.get(e);if(a==null)return{payload:{data:null,frameId:null,colorType:null}};if(a.data.buffer.byteLength===0)return this.frameDataPool.delete(e),{payload:{data:null,frameId:null,colorType:null}};let r=a.data;a.colorType==="GRAYSCALE"&&(r=K(a.data,a.width,a.height));let i={payload:{data:r,frameId:a.frameId,colorType:a.colorType},transferables:[r.buffer]};return this.frameDataPool.delete(e),i}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=n=>this.redrawRequests.length>0&&this.redrawRequests[0]<=n,r=n=>{for(;this.redrawRequests.length>0&&this.redrawRequests[0]<=n;)this.redrawRequests.shift()},i=()=>{this.loopTimeoutId=setTimeout(()=>{if(!this.isDrawLoopRunning)return;let n=performance.now();if(a(n)){r(n),e.draw();let o=e.getDrawCommands();this.sendViewRefreshCommands(new Uint8Array(o))}i()},this.redrawInterval)};i()}updateContext(e){if(this.context!=null&&this.contextDeserializer!=null){e.view!=null&&!e.view.visible&&this.context.flushAnalytics();let a=this.onBeforeUpdateContextHook(e),r=this.contextDeserializer.updateContextFromJson(this.context,this.view,JSON.stringify(a.context));if(r==null){let n=this.contextDeserializer.getLastError();throw new Error(`Could not update the context: ${n}`)}this.context.delete(),this.context=r.getContext();let i=r.getView();r.delete(),i!=null&&a.view!=null&&(i.setViewSize(a.view.width,a.view.height,a.view.orientation),i.draw()),!this.hintPresenterV2&&this.webPlatformHintPresenter&&(this.hintPresenterV2=new this.Module.HintPresenterV2(this.webPlatformHintPresenter)),i!=null&&this.hintPresenterV2&&i.setHintPresenterV2(this.hintPresenterV2),this.gestureRecognizer!=null&&(i==null||i.setGestureRecognizer(this.gestureRecognizer)),this.setView(i),this.notifyMainThreadOnViewInfoChanged(i),d.debug("context updated",a)}}notifyMainThreadOnViewInfoChanged(e){let a=this.getViewInfo(e);this.lastViewInfo.isSame(a)||(this.lastViewInfo.update(a),this.workerFunctions.postMessage({type:"viewSizeChanged",payload:a}))}getViewInfo(e){if(e!=null)try{let a=JSON.parse(e.getViewInfo());if(a!=null){let r=this.getOrientationFromNumber(a.orientation);return{...a,orientation:r}}}catch(a){d.error("Failed to get view size",a)}return null}getOrientationFromNumber(e){switch(e){case 90:return"landscapeRight";case 180:return"portraitUpsideDown";case 270:return"landscapeLeft";default:return"portrait"}}onBeforeUpdateContextHook(e){return e}onDocumentVisibilityChange(e){e==="hidden"&&this.context.flushAnalytics()}isFeatureSupported(e){return{payload:{supported:this.context.isFeatureSupported(e)}}}getViewfinderInfo(){var e,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()}}}getWasmDynamicLibraries(e){return this.getWasmSideModuleFileName()==null?[]:[`${e.replace(/\\/[^/]*$/,"/")}${this.getWasmSideModuleFileName()}`]}getWasmCoreExpectedHash(e,a){return a?e?"a6fdbd54509d0430486d3f8db30e9cd9b56c776e13f950afd7f748c3a766fcce":"b199954cae14b20468d2e8073423068c9034ef5d083526f99470ed954a0a8153":e?"baaf12e7f85c82d6890e099664d15bc8bee1b913ad7b8871c4d023d931171977":""}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 u}getWasmSideModuleFileName(){return""}_loadProgressCallback(e){this.workerFunctions.postMessage({type:"loadLibraryProgress",payload:e})}addRedrawRequest(e){this.redrawRequests.push(Math.round(performance.now())+e),this.redrawRequests.sort((a,r)=>a-r)}contextDidChangeStatus(e){e.code===260?e.message=e.message.replace("domain name",`domain name (${G(location)})`):e.code===265&&(e.message=e.message.replace("domain name",`domain name (${this.parentDomain})`)),this.workerFunctions.postMessage({type:"contextDidChangeStatus",payload:e})}didStartObservingContext(){this.workerFunctions.postMessage({type:"didStartObservingContext"})}mapMirrorAxisOnModule(e){switch(e){case"None":return this.Module.Axis.None;case"X":return this.Module.Axis.X;case"Y":return this.Module.Axis.Y;default:return this.Module.Axis.None}}setView(e){this.view=e,this.setViewRefreshHandler(e),e==null&&(this.isDrawLoopRunning=!1,this.sendViewRefreshCommands(new Uint8Array([])))}addNativeOverlay(e){d.warn("addNativeOverlay has not been implemented for this module",e)}removeNativeOverlay(e){d.warn("removeNativeOverlay has not been implemented for this module",e)}setViewRefreshHandler(e){if(e==null||e.isViewRefreshHandlerSet)return;let 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 n=JSON.parse(i),o=[];for(let s of n){let c=new TextDecoder(s.ianaName,{fatal:!0});o.push(c.decode(r.slice(s.startIndex,s.endIndex)))}return o.join("")}catch{return""}}});e.setDataDecoding(new a)}getBatteryData(){var e,a;let r=(a=(e=this.deviceInfo)==null?void 0:e.batteryInfo)==null?void 0:a.percentage;if(r!=null)return{percentage:r}}isTablet(){var e,a;return(a=(e=this.deviceInfo)==null?void 0:e.isTablet)!=null?a:!1}setupDeviceInterface(e,a){this.deviceInfo={isTablet:e,batteryInfo:a};let r=this.moduleHandler.get(),i=r.DeviceInterface.extend("DeviceInterface",{getBatteryData:this.getBatteryData.bind(this),isTablet:this.isTablet.bind(this)});this.deviceInstance=new i,r.DeviceHolder.setCurrentDevice(this.deviceInstance)}updateBatteryInfo(e){this.deviceInfo&&(this.deviceInfo.batteryInfo=e)}start(e,a,r){e&&a&&(this.setupDataDecoding(),this.moduleHandler.get().callMain(),this.moduleHandler.get().__emscripten_proxy_main!==void 0||r())}getWritableDataPath(e){return e!=null?(d.debug(`IndexedDB database name override in use to recover from blocked standard database: ${e}`),e):this.writableDataPathStandard}numOfMBToPages(e){return Math.ceil(1024*e*1024/64/1024)}async setup({libraryLocation:e,locationPath:a,writableDataPathOverride:r,indexedDBTimeoutMs:i,verifyResponseHash:n,referredOrigin:o,fixedWasmMemory:s,simdSupport:c,threadsSupport:l}){var h;let m=!1,g=!1;this.writableDataPath=this.getWritableDataPath(r),this.resourcePath=`${e}${this.resourceFilesSubfolder}/`,self.path=a;let{resolve:f,reject:b,promise:D}=new B,F=T.sdkVersion();if(F==="")throw new P({name:"Invalid library version",message:"Library version is not defined or empty, cannot generate proper path to library files."});let p=this.getWasmCoreFileName(c,l),y=se(F,e,p),{jsURI:v,wasmURI:Y}=y,ve={instantiateWasm:(S,Fe)=>(ae({importObject:S,wasmURI:Y,expectedHash:this.getWasmCoreExpectedHash(c,l),verifyResponseHash:n,successCallback:Fe,progressCallback:this._loadProgressCallback,errorCallback:Me=>{b(Me)},referredOrigin:o}),{})},I=s===null?null:new WebAssembly.Memory({initial:this.numOfMBToPages(s),maximum:this.numOfMBToPages(300),shared:l});return I!==null&&d.log(d.Level.Debug,"Fixed wasmMemory set",I),this.moduleHandler.set({...I?{wasmMemory:I}:{},mainScriptUrlOrBlob:v,canvas:(h=this.workerFunctions.getOffscreenCanvas())!=null?h:{getContext:()=>null},...ve,dynamicLibraries:this.getWasmDynamicLibraries(Y),locateFile:S=>e+S,noInitialRun:!0,preRun:[async()=>{try{await Q({writableDataPath:this.writableDataPath,indexedDBTimeoutMs:i})}catch(S){if(S.name==="BlockedIndexedDB"){b(S.toString());return}d.log(d.Level.Debug,"No IndexedDB support, some data will not be persisted:",S)}g=!0,this.start(g,m,f)}],onMainComplete:()=>{if([m,g].includes(!1)){d.log(d.Level.Warn,{runtimeLoaded:m,fileSystemSynced:g},"Both runtimeLoaded and fileSystemSynced should be true when calling onMainComplete"),b("onMainComplete has been called but runtime or file system was not ready.");return}f()},onRuntimeInitialized:()=>{m=!0,this.start(g,m,f)},print:S=>{d.info(S)}}),await re(v,F)||b(`Couldn\'t retrieve Scandit Data Capture library at ${v}, did you configure the path for it correctly?`),D}};oe.get3dPartyLicenseKeyMethodName=atob("Z2V0QmxpbmtJZExpY2Vuc2VLZXk=");var k=oe;function ce(t){return typeof t=="object"&&t!=null&&t.document==null&&"addEventListener"in t&&typeof t.importScripts=="function"}function le(t){console.warn("Reached unexpected case",t)}var q=class{constructor(t,e){this.onMessageListener=this.onMessage.bind(this),this.workerSelf=t,this.dataCaptureInstance=new k(e,{postMessage:this.postMessage.bind(this),getOffscreenCanvas:this.getOffscreenCanvas.bind(this)}),ce(t)&&(X(t),this.listenToMessages())}listenToMessages(){this.workerSelf.addEventListener("message",this.onMessageListener),this.workerSelf.addEventListener("error",t=>{d.log(d.Level.Error,t)}),this.workerSelf.addEventListener("messageerror",t=>{d.log(d.Level.Error,t)})}postMessage(t,e){this.workerSelf.postMessage(t,e!=null?e:[])}getOffscreenCanvas(){if(this.isOffscreenCanvasSupported())return new this.workerSelf.OffscreenCanvas(32,32)}isOffscreenCanvasSupported(){return typeof this.workerSelf.OffscreenCanvas=="function"}hasPayload(t){return 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(o){i=void 0,r=C(o)}let n={type:"workerTaskId",command:t,id:e,payload:this.hasPayload(i)?i.payload:void 0};r!=null&&(n.error=r),this.postMessage(n,this.hasTransferables(i)?i.transferables:[])}onMessage(t){switch(t.data.command){case"loadLibrary":{{let{data:e}=t;this.respondWith(e.command,e.id,async()=>this.dataCaptureInstance.loadLibrary({libraryLocation:e.libraryLocation,locationPath:e.locationPath,referredOrigin:e.referredOrigin,writableDataPathOverride:e.writableDataPathOverride,threadsSupport:e.threadsSupport,simdSupport:e.simdSupport,verifyResponseHash:e.verifyResponseHash,fixedWasmMemory:e.fixedWasmMemory,indexedDBTimeoutMs:e.indexedDBTimeoutMs}))}break}case"onTap":{{let{data:e}=t;this.respondWith(e.command,e.id,async()=>{this.dataCaptureInstance.onTap(e.point)})}break}case"hintPresenterV2update":{{let{data:e}=t;this.respondWith(e.command,e.id,async()=>{this.dataCaptureInstance.hintPresenterV2Update()})}break}case"createContext":{{let{data:e}=t;this.respondWith(e.command,e.id,()=>this.dataCaptureInstance.createContext({context:e.context,deviceId:e.deviceId,delayedRegistration:e.delayedRegistration,highEndBlurryRecognition:e.highEndBlurryRecognition,appName:e.appName,parentDomain:e.parentDomain,isTablet:e.isTablet,batteryInfo:e.batteryInfo}))}break}case"setFrameSource":{{let{data:e}=t;this.respondWith(e.command,e.id,()=>this.dataCaptureInstance.setFrameSource(e.mirrorAxis,e.isCameraFrameSource))}break}case"processFrame":{{let{data:e}=t;this.respondWith(e.command,e.id,()=>this.dataCaptureInstance.processFrame({data:e.data,frameId:e.frameId,width:e.width,height:e.height,colorType:e.colorType}))}break}case"requestFrameData":{{let{data:e}=t;this.respondWith(e.command,e.id,()=>this.dataCaptureInstance.requestFrameData(e.frameId))}break}case"deleteFrameData":{{let{data:e}=t;this.respondWith(e.command,e.id,()=>{this.dataCaptureInstance.deleteFrameData(e.frameId)})}break}case"updateContext":{{let{data:e}=t;this.respondWith(e.command,e.id,async()=>this.dataCaptureInstance.updateContext(e))}break}case"dispose":{this.respondWith(t.data.command,t.data.id,()=>this.dataCaptureInstance.dispose());break}case"flushAnalytics":{this.respondWith(t.data.command,t.data.id,()=>{this.dataCaptureInstance.flushAnalytics()});break}case"reportCameraProperties":{{let{data:e}=t;this.respondWith(e.command,e.id,async()=>this.dataCaptureInstance.reportCameraProperties(e))}break}case"setLogLevel":{{let{data:e}=t;this.respondWith(e.command,e.id,()=>{d.setLevel(e.level)})}break}case"updateBatteryInfo":{{let{data:e}=t;this.respondWith(e.command,e.id,()=>{this.dataCaptureInstance.updateBatteryInfo(e.batteryInfo)})}break}case"extractCentaurusLicense":{{let{data:e}=t;this.respondWith(e.command,e.id,()=>this.dataCaptureInstance.extractCentaurusLicense(e.licenseKey))}break}case"documentVisibility":{{let{data:e}=t;this.respondWith(e.command,e.id,()=>{this.dataCaptureInstance.onDocumentVisibilityChange(e.state)})}break}case"isFeatureSupported":{{let{data:e}=t;this.respondWith(e.command,e.id,()=>this.dataCaptureInstance.isFeatureSupported(e.feature))}break}case"getViewfinderInfo":{{let{data:e}=t;this.respondWith(e.command,e.id,()=>this.dataCaptureInstance.getViewfinderInfo())}break}case"getOpenSourceSoftwareLicenseInfo":{{let{data:e}=t;this.respondWith(e.command,e.id,()=>this.dataCaptureInstance.getOpenSourceSoftwareLicenseInfo())}break}case"addNativeOverlay":this.dataCaptureInstance.addNativeOverlay(t);break;case"removeNativeOverlay":this.dataCaptureInstance.removeNativeOverlay(t);break;case"convertToJPEGResult":{{let{data:e}=t;this.dataCaptureInstance.convertToJPEGResult(e.imageId,e.result)}break}default:return le(t.data),!1}return!0}};var ue=(t=>(t.Body="body",t.Footnote="footnote",t))(ue||{}),A=(t=>(t.Start="start",t.Center="center",t.End="end",t))(A||{}),pe=(t=>(t.Normal="normal",t.Wider="wider",t.FitText="fitText",t))(pe||{}),he=(t=>(t.Normal="normal",t.Taller="taller",t))(he||{}),me=(t=>(t.Square="square",t.Rounded="rounded",t))(me||{}),O=(t=>(t.None="none",t.Check="check",t.ExclamationMark="exclamationMark",t))(O||{}),R=(t=>(t.Top="top",t.Center="center",t.AboveViewFinder="aboveViewFinder",t.BelowViewFinder="belowViewFinder",t))(R||{}),ge=(t=>(t.AboveViewFinder="aboveViewFinder",t.BelowViewFinder="belowViewFinder",t))(ge||{}),fe=(t=>(t.BlackOnWhite="blackOnWhite",t.WhiteOnBlack="whiteOnBlack",t.Transparent="transparent",t))(fe||{}),be=(t=>(t.Success="success",t.Error="error",t.Warning="warning",t.Info="info",t.Notification="notification",t))(be||{}),ye=(t=>(t[t.Ocr=0]="Ocr",t[t.HideLogo=1]="HideLogo",t[t.ShowTestLicenseMessage=2]="ShowTestLicenseMessage",t[t.AugmentedReality=5]="AugmentedReality",t[t.ActivityPingStatsAddon=8]="ActivityPingStatsAddon",t[t.ActivityPing=9]="ActivityPing",t[t.Registration=10]="Registration",t[t.Parser=11]="Parser",t[t.BarcodeCapture=14]="BarcodeCapture",t[t.Analytics=17]="Analytics",t[t.AnalyticsBatchMode=18]="AnalyticsBatchMode",t[t.AnalyticsScanContent=19]="AnalyticsScanContent",t[t.AnalyticsOnlineVerification=20]="AnalyticsOnlineVerification",t[t.SparkScan=21]="SparkScan",t[t.AamvaIdBarcodeVerification=22]="AamvaIdBarcodeVerification",t[t.MappingForTracking=23]="MappingForTracking",t[t.BarcodeFind=24]="BarcodeFind",t[t.MandatoryRegistration=25]="MandatoryRegistration",t[t.FeatureTracking=26]="FeatureTracking",t[t.IdCaptureViz=27]="IdCaptureViz",t[t.IdCaptureMrz=28]="IdCaptureMrz",t[t.IdCaptureBarcode=29]="IdCaptureBarcode",t[t.BarcodeSelectionAimToScan=30]="BarcodeSelectionAimToScan",t[t.BarcodeSelectionTapToScan=31]="BarcodeSelectionTapToScan",t[t.BarcodeCount=32]="BarcodeCount",t[t.BarcodePick=33]="BarcodePick",t[t.IdVerificationDataComparison=34]="IdVerificationDataComparison",t[t.SmartLabelBarcode=35]="SmartLabelBarcode",t[t.SmartLabelText=36]="SmartLabelText",t[t.VoidedIdDetection=37]="VoidedIdDetection",t[t.BarcodeArFull=38]="BarcodeArFull",t[t.BarcodeSequence=39]="BarcodeSequence",t))(ye||{});var E=class{constructor(e,a,r){this.barcodeAr=null;this.coreEngine=e,this.Module=a,this.workerFunctions=r}async forSettings(e){var r;(r=this.barcodeAr)==null||r.delete(),this.barcodeAr=new this.Module.BarcodeAr(this.coreEngine.context,JSON.stringify(e));let a=this.Module.BarcodeArListener.extend("BarcodeArListener",{didUpdateSession:(i,n,o)=>{let s=this.coreEngine.prepareFrameForListener(o);this.workerFunctions.postMessage({type:"barcodeArDidUpdateSession",payload:{session:JSON.parse(n.toJson()),frameData:s}}),i.delete(),n.delete(),o.delete()}});this.barcodeAr.addListener(new a,1),this.Module.addBarcodeArToContext(this.coreEngine.context,this.barcodeAr)}start(){var e;(e=this.barcodeAr)==null||e.start()}pause(){var e;(e=this.barcodeAr)==null||e.pause()}stop(){var e;(e=this.barcodeAr)==null||e.stop()}setEnabled(e){var a;(a=this.barcodeAr)==null||a.setEnabled(e)}async removeMode(){this.barcodeAr!=null&&this.Module.removeBarcodeArFromContext(this.coreEngine.context,this.barcodeAr)}applySettings(e){var a;(a=this.barcodeAr)==null||a.applySettings(JSON.stringify(e))}};var L=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,n)=>{this.barcodeBatchDidUpdateSession(i),r.delete(),i.delete(),n.delete()},onTrackedBarcodeTapped:(r,i)=>{this.onTrackedBarcodeTapped(i),r.delete(),i.delete()}}),a=this.Module.BarcodeBatchDeserializerListener.extend("BarcodeTrackingDeserializerListener",{onModeDeserializationFinished:(r,i,n)=>{this.trackingListenerSet||(i.addListener(new e,1),this.trackingListenerSet=!0),r.delete(),i.delete(),n.delete()},onModeDeserializationStarted(r,i,n){r.delete(),i.delete(),n.delete()},onSettingsDeserializationStarted(r,i,n){r.delete(),i.delete(),n.delete()},onSettingsDeserializationFinished(r,i,n){r.delete(),i.delete(),n.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 W=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:(o,s,c)=>{this.barcodeCaptureDidScan(s,c),o.delete(),c.delete(),s.delete()},didUpdateSession:(o,s,c)=>{this.barcodeCaptureDidUpdateSession(s),o.delete(),c.delete(),s.delete()}}),a=this.Module.Feedback.extend("Feedback",{emit:()=>{this.successFeedback()}}),r=new e,i=new a,n=this.Module.BarcodeCaptureDeserializerListener.extend("BarcodeCaptureDeserializerListener",{onModeDeserializationFinished:(o,s,c)=>{s.addListener(r,1),s.setSuccessFeedback(i),o.delete(),s.delete(),c.delete()},onModeDeserializationStarted(o,s,c){o.delete(),s.delete(),c.delete()},onSettingsDeserializationStarted(o,s,c){o.delete(),s.delete(),c.delete()},onSettingsDeserializationFinished(o,s,c){o.delete(),s.delete(),c.delete()}});this.barcodeCaptureDeserializer=new this.Module.BarcodeCaptureDeserializer,this.barcodeCaptureDeserializer.setListener(new n)}successFeedback(){this.workerFunctions.postMessage({type:"successFeedback"})}barcodeCaptureDidScan(e,a){let r=this.coreEngine.prepareFrameForListener(a);this.workerFunctions.postMessage({type:"barcodeCaptureDidScan",payload:{session:JSON.parse(e.toJson()),frameData:r}})}};function He(t){return t.charAt(0).toUpperCase()+t.slice(1)}function Se(t){return t}var N=class{constructor(e,a,r){this.barcodeFind=null;this.basicOverlay=null;this.transparentGuidanceHintStyle={backgroundColor:"00000000",cornerRadius:4,fitToText:!1,isAnimatedToView:!1,textAlignment:A.Center,hintIcon:O.None,hintAnchor:R.Center,hintAnchorOffset:0,horizontalMargin:0,iconColor:"00000000",lineHeight:-1,maxLines:1,maxWidthFraction:.8,textColor:"ffffffff",textSize:15,textWeight:600};this.customerTransformation=Se;this.coreEngine=e,this.Module=a,this.workerFunctions=r}async forSettings(e){var o;(o=this.barcodeFind)==null||o.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:s=>this.customerTransformation(s)}),n=this.Module.BarcodeFindListener.extend("BarcodeFindListener",{didUpdateSession:(s,c,l)=>{let h=this.coreEngine.prepareFrameForListener(l);this.workerFunctions.postMessage({type:"barcodeFindDidUpdateSession",payload:{session:JSON.parse(c.toJson()),frameData:h}}),s.delete(),c.delete(),l.delete()},onSearchPaused:s=>{let c=[];for(let l=0;l<s.size();l++)c.push(s.get(l));this.workerFunctions.postMessage({type:"barcodeFindSearchPaused",payload:{foundItems:c}})},onSearchStopped:s=>{let c=[];for(let l=0;l<s.size();l++)c.push(s.get(l));this.workerFunctions.postMessage({type:"barcodeFindSearchStopped",payload:{foundItems:c}})},onSearchStarted:()=>{this.workerFunctions.postMessage({type:"barcodeFindSearchStarted",payload:{}})}});this.barcodeFind.setBarcodeFindTransformer(new i),this.barcodeFind.addListener(new n,1),this.barcodeFind.setItemListUpdatedFeedback(new a),this.barcodeFind.setFeedback(new r),this.Module.addBarcodeFindToContext(this.coreEngine.context,this.barcodeFind)}barcodeFindFeedback(){this.workerFunctions.postMessage({type:"barcodeFindFeedback",payload:{}})}start(){var e;(e=this.barcodeFind)==null||e.start()}stop(){var e;(e=this.barcodeFind)==null||e.stop()}pause(){var e;(e=this.barcodeFind)==null||e.pause()}setEnabled(e){var a;(a=this.barcodeFind)==null||a.setEnabled(e)}setItemList(e){var a;(a=this.barcodeFind)==null||a.setItemList(JSON.stringify(e))}async removeMode(){this.barcodeFind!=null&&this.Module.removeBarcodeFindFromContext(this.coreEngine.context,this.barcodeFind)}addBasicOverlay(){var e;(e=this.basicOverlay)==null||e.delete(),this.basicOverlay=null,this.barcodeFind!=null&&(this.basicOverlay=new this.Module.BarcodeFindBasicOverlay(this.barcodeFind)),this.coreEngine.view!=null&&this.basicOverlay!=null&&(this.basicOverlay.setGuidanceHandler(this.createWebFindGuidanceHandler()),this.Module.addBarcodeFindBasicOverlayToView(this.coreEngine.view,this.basicOverlay))}removeBasicOverlay(){this.coreEngine.view!=null&&this.basicOverlay!=null&&this.Module.removeBarcodeFindBasicOverlayFromView(this.coreEngine.view,this.basicOverlay)}async applySettings(e){var a;(a=this.barcodeFind)==null||a.applySettings(JSON.stringify(e))}updateBasicOverlay(e){let a=Object.entries(e).filter(([r,i])=>r!=="type");for(let[r,i]of a){let n=`set${He(r)}`;this.basicOverlay!=null&&typeof this.basicOverlay[n]=="function"&&i!=null&&this.basicOverlay[n](i)}}setTransformerFunction(e){this.customerTransformation=e!=null?e:Se}successFeedback(){this.workerFunctions.postMessage({type:"successFeedback"})}listUpdatedFeedback(){this.workerFunctions.postMessage({type:"barcodeFindListUpdatedFeedback",payload:{}})}setToast(e,a){let r=this.coreEngine.hintPresenterV2;e?r==null||r.showToast(JSON.stringify(a)):r==null||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")},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")}});return new e}};var w=class{constructor(e){this.subscribers=new Set;this.property={key:e,value:null}}addSubscriber(e){var a;this.subscribers.add(e),(a=e.onPropertyChanged)==null||a.call(e,this.property)}removeSubscriber(e){this.subscribers.delete(e)}setProperty(e){var a;if(this.property.value!==e.value){this.property={key:this.property.key,value:e.value};for(let r of this.subscribers)(a=r.onPropertyChanged)==null||a.call(r,this.property)}}};var _e={torch_state:new w("torch_state"),scanning_mode:new w("scanning_mode"),sound_enabled:new w("sound_enabled"),haptic_enabled:new w("haptic_enabled"),session_stop_reason:new w("session_stop_reason"),camera_position:new w("camera_position")},H=class{getBehaviorSubject(e){return _e[e]}};var _=class{constructor(e,a,r){this.captureListenerSet=!1;this.propertyPushSource=new H;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,n,o)=>{this.sparkScanDidScan(n,o),i.delete(),n.delete(),o.delete()},didUpdateSession:(i,n,o)=>{this.sparkScanDidUpdateSession(n),i.delete(),n.delete(),o.delete()}}),a=this.Module.Feedback.extend("Feedback",{emit:()=>{this.successFeedback()}}),r=this.Module.SparkScanDeserializerListener.extend("SparkScanDeserializerListener",{onModeDeserializationFinished:(i,n,o)=>{if(!this.captureListenerSet){n.addListener(new e,1),n.setSuccessFeedback(new a),n.setPropertyPushSource(this.propertyPushSource);let s=this.Module.SparkScanViewHandlerDelegate.extend("SparkScanViewHandlerDelegate",{onSwitchedAwayFromSmartScanSelection:()=>{this.workerFunctions.postMessage({type:"sparkScanSwitchedAwayFromSmartScanSelection"})},onSwitchedToSmartScanSelection:()=>{this.workerFunctions.postMessage({type:"sparkScanSwitchedToSmartScanSelection"})},enableHapticWhenOverlapping:()=>{},onStateTransition:()=>{},resetAllTimers:()=>{}}),c=new s,l=n.getStateMachine();l.setViewHandlerDelegate(c),c.delete(),l.delete(),this.sparkScan=n.clone(),this.captureListenerSet=!0}i.delete(),o.delete(),n.delete()},onModeDeserializationStarted(i,n,o){i.delete(),n.delete(),o.delete()},onSettingsDeserializationStarted(i,n,o){i.delete(),n.delete(),o.delete()},onSettingsDeserializationFinished(i,n,o){i.delete(),n.delete(),o.delete()},onOverlayDeserializationStarted(i,n,o){i.delete(),n.delete(),o.delete()},onOverlayDeserializationFinished:(i,n,o)=>{var s;(s=this.sparkScanOverlay)==null||s.delete(),this.sparkScanOverlay=n,i.delete(),o.delete()}});this.sparkScanDeserializer=new this.Module.SparkScanDeserializer,this.sparkScanDeserializer.setListener(new r)}emitErrorFeedback(e){var a;(a=this.sparkScanOverlay)==null||a.onErrorFeedbackEmitted(e)}overlayReadyForDraw(){var e;(e=this.sparkScanOverlay)==null||e.onReadyForNewData()}discardEnqueuedData(){var e;(e=this.sparkScanOverlay)==null||e.discardEnqueuedData()}analyticsManagerPropertyChanged(e){this.propertyPushSource.getBehaviorSubject(e.key).setProperty(e)}successFeedback(){this.workerFunctions.postMessage({type:"successFeedback"})}selectItemWithSmartScanSelection(){var e;(e=this.sparkScan)==null||e.selectItemWithSmartScanSelectionAsync()}async removeMode(){var e,a;this.captureListenerSet=!1,(e=this.sparkScan)==null||e.delete(),this.sparkScan=void 0,(a=this.sparkScanOverlay)==null||a.delete(),this.sparkScanOverlay=void 0}sparkScanDidScan(e,a){let r=this.coreEngine.prepareFrameForListener(a);this.workerFunctions.postMessage({type:"sparkScanDidScan",payload:{session:JSON.parse(e.toJson()),frameData:r}})}};var z=class extends k{constructor(e,a){super(e,a)}getModeDeserializers(){this.barcodeCaptureMode=new W(this,this.Module,this.workerFunctions),this.barcodeBatchMode=new L(this,this.Module,this.workerFunctions),this.sparkScanMode=new _(this,this.Module,this.workerFunctions),this.barcodeFindMode=new N(this,this.Module,this.workerFunctions),this.barcodeArMode=new E(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?"a6fdbd54509d0430486d3f8db30e9cd9b56c776e13f950afd7f748c3a766fcce":"b199954cae14b20468d2e8073423068c9034ef5d083526f99470ed954a0a8153":e?"baaf12e7f85c82d6890e099664d15bc8bee1b913ad7b8871c4d023d931171977":"44e7416a3ba85f1439e67914e7aab3cdd6ea9eda484ab9fb3eebed50866b167b"}getWasmMetadata(){return u}};function ze(t){return(a=>/^[$A-Z_a-z][\\w$]*\\s*\\(.*\\)\\s*\\{/.test(a)&&!a.startsWith("function"))(t)?`function ${t}`:t}var Ve=["fetch","XMLHttpRequest","eval","Function","self","globalThis","Module","importScripts","this","console","window","document","import","Worker","ServiceWorker"];function Je(t){return Ve.map(a=>new RegExp(`\\\\b${a}\\\\b`,"g")).some(a=>a.test(t))}function we(t){if(t==null)return null;let e=ze(t);if(Je(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 V=class extends q{constructor(e,a){super(e,a),this.dataCaptureInstance=new z(a,{postMessage:this.postMessage.bind(this),getOffscreenCanvas:this.getOffscreenCanvas.bind(this)})}async respondWith(e,a,r){let i=null,n;try{n=r(),n instanceof Promise&&(n=await n)}catch(s){n=void 0,i=C(s)}let o={type:"workerTaskId",command:e,id:a,payload:this.hasPayload(n)?n.payload:void 0};i!=null&&(o.error=i),this.postMessage(o,this.hasTransferables(n)?n.transferables:[])}onMessage(e){switch(e.data.command){case"sparkScanEmitErrorFeedback":{let{data: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"sparkScanOverlayDiscardEnqueuedData":{let{data:a}=e;return this.respondWith(a.command,a.id,()=>{this.dataCaptureInstance.sparkScanMode.discardEnqueuedData()}),!0}case"sparkScanAnalyticsManagerPropertyChanged":{let{data:a}=e;return this.respondWith(a.command,a.id,async()=>{this.dataCaptureInstance.sparkScanMode.analyticsManagerPropertyChanged(a.property)}),!0}case"sparkScanSelectItemWithSmartScanSelection":{let{data:a}=e;return this.respondWith(a.command,a.id,async()=>{this.dataCaptureInstance.sparkScanMode.selectItemWithSmartScanSelection()}),!0}case"sparkScanModeRemove":{let{data:a}=e;return this.respondWith(a.command,a.id,async()=>this.dataCaptureInstance.sparkScanMode.removeMode()),!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=we(a.functionAsString);this.dataCaptureInstance.barcodeFindMode.setTransformerFunction(r)}),!0}case"barcodeArForSettings":{let{data:a}=e;return this.respondWith(a.command,a.id,async()=>this.dataCaptureInstance.barcodeArMode.forSettings(a.settings)),!0}case"barcodeArModeRemove":{let{data:a}=e;return this.respondWith(a.command,a.id,async()=>this.dataCaptureInstance.barcodeArMode.removeMode()),!0}case"barcodeArSearchStart":return this.respondWith(e.data.command,e.data.id,()=>{this.dataCaptureInstance.barcodeArMode.start()}),!0;case"barcodeArSearchPause":return this.respondWith(e.data.command,e.data.id,()=>{this.dataCaptureInstance.barcodeArMode.pause()}),!0;case"barcodeArSearchStop":return this.respondWith(e.data.command,e.data.id,()=>{this.dataCaptureInstance.barcodeArMode.stop()}),!0;case"barcodeArSetEnabled":{let{data:a}=e;return this.respondWith(e.data.command,e.data.id,()=>{this.dataCaptureInstance.barcodeArMode.setEnabled(a.enabled)}),!0}case"barcodeArApplySettings":{let{data:a}=e;return this.respondWith(a.command,a.id,async()=>{this.dataCaptureInstance.barcodeArMode.applySettings(a.settings)}),!0}default:return super.onMessage(e)}}};var lr=new V(self,{get:()=>self.Module,set:t=>{self.Module=t}});function ur(t){}})();\n'],{type:"application/javascript"})),e=new Worker(n,r);return URL.revokeObjectURL(n),e}var l=class r extends DataCaptureLoader{constructor(){super(...arguments);this._name="BarcodeCapture";}get dataCaptureWorker(){return (this._dataCaptureWorker)!=null||(this._dataCaptureWorker=d({name:this.name})),this._dataCaptureWorker}get name(){return this._name}static async create(e){var a;let t=new r(e);return await t.workerCommand("setLogLevel",{level:(a=e.logLevel)!=null?a:Logger.Level.Debug}),await t.load(),t}async workerCommand(e,t,a){return new Promise((c,o)=>{let i=this.workerCommandId++;this.workerTasks.set(i,{resolve:c,reject:o,command:e});let s={...t,command:e,id:i};this.dataCaptureWorker.postMessage(s,a);})}};
2
+ export{l as a};
@@ -1 +1 @@
1
- import {a as a$1}from'./chunk-SNPWBV7Y.js';import {b}from'./chunk-TCXM24SN.js';import {a}from'./chunk-WBM6DAMR.js';import {CameraSettings,convertToPublicFrameData}from'@scandit/web-datacapture-core';import {warnMultithreadingUnavailable}from'@scandit/web-datacapture-core/build/js/private/utils/warnMultithreadingUnavailable.js';var o=class n{constructor(){this.skipSerialization=true;this.type="barcodeAr";this._isEnabled=true;this._context=null;this.listeners=new Set;this.privateListeners=new Set;this.workerMessageListener=this.onWorkerMessage.bind(this);}get context(){return this._context}static createRecommendedCameraSettings(){return new CameraSettings(b)}set context(e){this._context=e;}get allListeners(){return [...this.privateListeners,...this.listeners]}static async forContext(e,t){warnMultithreadingUnavailable();let r=new n;return r.feedback=await a.createDefaultBarcodeArFeedback(),r.settings=t,await e.setMode(r),r}isEnabled(){return this._isEnabled}addListener(e){this.listeners.add(e);}removeListener(e){this.listeners.delete(e);}set feedback(e){this._feedback=e;}get feedback(){return this._feedback}async setEnabled(e){var t;this._isEnabled=e,await this.workerCommand("barcodeArSetEnabled",{enabled:e}),await((t=this.context)==null?void 0:t.update([{type:"modeEnabled",newValue:e}],{updateContext:false}));}async applySettings(e){this.settings=e,await this.workerCommand("barcodeArApplySettings",{settings:e.toJSONObject()});}toJSONObject(){return {type:this.type,enabled:this._isEnabled,settings:this.settings.toJSONObject()}}async attachedToContext(e){this._context=e,this._context.subscribeToWorkerMessages(this.workerMessageListener),await this.workerCommand("barcodeArForSettings",{settings:this.settings.toJSONObject()});}async detachedFromContext(){var e;await this.workerCommand("barcodeArModeRemove",{}),(e=this._context)==null||e.unsubscribeToWorkerMessages(this.workerMessageListener),this._context=null;}async start(){return this.workerCommand("barcodeArSearchStart",{})}async stop(){return this.workerCommand("barcodeArSearchStop",{})}async pause(){return this.workerCommand("barcodeArSearchPause",{})}async workerCommand(e,t){this.context!=null&&await this.context.workerCommand(e,t);}addPrivateListener(e){this.privateListeners.add(e);}removePrivateListener(e){this.privateListeners.delete(e);}async onWorkerMessage(e){var t;switch(e.type){case "barcodeArDidUpdateSession":{if(!this._isEnabled||!this._context)return;for(let r of this.allListeners)(t=r.didUpdateSession)==null||t.call(r,this,a$1.fromJSON(e.payload.session),convertToPublicFrameData(e.payload.frameData,this._context));break}}}};export{o as a};
1
+ import {a as a$1}from'./chunk-SNPWBV7Y.js';import {b}from'./chunk-TCXM24SN.js';import {a}from'./chunk-F2FSFE64.js';import {CameraSettings,convertToPublicFrameData}from'@scandit/web-datacapture-core';import {warnMultithreadingUnavailable}from'@scandit/web-datacapture-core/build/js/private/utils/warnMultithreadingUnavailable.js';var o=class n{constructor(){this.skipSerialization=true;this.type="barcodeAr";this._isEnabled=true;this._context=null;this.listeners=new Set;this.privateListeners=new Set;this.workerMessageListener=this.onWorkerMessage.bind(this);}get context(){return this._context}static createRecommendedCameraSettings(){return new CameraSettings(b)}set context(e){this._context=e;}get allListeners(){return [...this.privateListeners,...this.listeners]}static async forContext(e,t){warnMultithreadingUnavailable();let r=new n;return r.feedback=await a.createDefaultBarcodeArFeedback(),r.settings=t,await e.setMode(r),r}isEnabled(){return this._isEnabled}addListener(e){this.listeners.add(e);}removeListener(e){this.listeners.delete(e);}set feedback(e){this._feedback=e;}get feedback(){return this._feedback}async setEnabled(e){var t;this._isEnabled=e,await this.workerCommand("barcodeArSetEnabled",{enabled:e}),await((t=this.context)==null?void 0:t.update([{type:"modeEnabled",newValue:e}],{updateContext:false}));}async applySettings(e){this.settings=e,await this.workerCommand("barcodeArApplySettings",{settings:e.toJSONObject()});}toJSONObject(){return {type:this.type,enabled:this._isEnabled,settings:this.settings.toJSONObject()}}async attachedToContext(e){this._context=e,this._context.subscribeToWorkerMessages(this.workerMessageListener),await this.workerCommand("barcodeArForSettings",{settings:this.settings.toJSONObject()});}async detachedFromContext(){var e;await this.workerCommand("barcodeArModeRemove",{}),(e=this._context)==null||e.unsubscribeToWorkerMessages(this.workerMessageListener),this._context=null;}async start(){return this.workerCommand("barcodeArSearchStart",{})}async stop(){return this.workerCommand("barcodeArSearchStop",{})}async pause(){return this.workerCommand("barcodeArSearchPause",{})}async workerCommand(e,t){this.context!=null&&await this.context.workerCommand(e,t);}addPrivateListener(e){this.privateListeners.add(e);}removePrivateListener(e){this.privateListeners.delete(e);}async onWorkerMessage(e){var t;switch(e.type){case "barcodeArDidUpdateSession":{if(!this._isEnabled||!this._context)return;for(let r of this.allListeners)(t=r.didUpdateSession)==null||t.call(r,this,a$1.fromJSON(e.payload.session),convertToPublicFrameData(e.payload.frameData,this._context));break}}}};export{o as a};