@scandit/web-datacapture-core 8.3.0-beta.1 → 8.3.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (141) hide show
  1. package/build/js/{Camera-BnPnXqAt.d.ts → Camera-Cc__1Nc-.d.ts} +2 -0
  2. package/build/js/Camera.d.ts +1 -1
  3. package/build/js/Camera.js +1 -1
  4. package/build/js/CameraRelated.d.ts +1 -1
  5. package/build/js/{DataCaptureContext-LM_Re1B4.d.ts → DataCaptureContext-BcSpF9Dt.d.ts} +2 -1
  6. package/build/js/DataCaptureContext.d.ts +2 -2
  7. package/build/js/DataCaptureContext.js +1 -1
  8. package/build/js/DataCaptureContextRelated.d.ts +2 -2
  9. package/build/js/DataCaptureVersion.js +1 -1
  10. package/build/js/DataCaptureView.d.ts +2 -2
  11. package/build/js/DataCaptureView.js +1 -1
  12. package/build/js/Feedback.js +1 -1
  13. package/build/js/FrameData.d.ts +2 -2
  14. package/build/js/ImageFrameSource.d.ts +1 -1
  15. package/build/js/ImageFrameSource.js +1 -1
  16. package/build/js/NotificationPresenter/index.d.ts +2 -2
  17. package/build/js/NotificationPresenter/private/ConcreteNotificationPresenter.d.ts +2 -2
  18. package/build/js/NotificationPresenter/private/presets.d.ts +2 -2
  19. package/build/js/ScanditIconBuilder.js +1 -1
  20. package/build/js/SingleImageUploader.d.ts +1 -1
  21. package/build/js/Sound.d.ts +4 -0
  22. package/build/js/Sound.js +1 -1
  23. package/build/js/chunks/{chunk-BQO4QYI6.js → chunk-2N546PXQ.js} +1 -1
  24. package/build/js/chunks/{chunk-H7FKC2FI.js → chunk-35JLCTLQ.js} +1 -1
  25. package/build/js/chunks/chunk-3JLTBSEJ.js +1 -0
  26. package/build/js/chunks/chunk-5DKZR6UB.js +1 -0
  27. package/build/js/chunks/{chunk-OCKYBUXO.js → chunk-5VJXJTUX.js} +1 -1
  28. package/build/js/chunks/chunk-AAPD5YU3.js +1 -0
  29. package/build/js/chunks/chunk-ATSAENLJ.js +6 -0
  30. package/build/js/chunks/{chunk-KVRNF3VA.js → chunk-DTREAYZQ.js} +1 -1
  31. package/build/js/chunks/chunk-FK5L5YTR.js +1 -0
  32. package/build/js/chunks/{chunk-YXXMWHFX.js → chunk-GZCWMFWA.js} +1 -1
  33. package/build/js/chunks/{chunk-RYXKMXTY.js → chunk-HILZP6OW.js} +1 -1
  34. package/build/js/chunks/chunk-INVYPEGF.js +1 -0
  35. package/build/js/chunks/chunk-KYAHE2Q3.js +1 -0
  36. package/build/js/chunks/chunk-LV6LGCDC.js +1 -0
  37. package/build/js/chunks/chunk-MBF27IWL.js +1 -0
  38. package/build/js/chunks/chunk-NYYGU4ZV.js +1 -0
  39. package/build/js/chunks/{chunk-XVH5A2QH.js → chunk-PDJEYYPX.js} +1 -1
  40. package/build/js/chunks/chunk-QHBYNYWX.js +1 -0
  41. package/build/js/chunks/chunk-SJIN27Q5.js +1 -0
  42. package/build/js/chunks/chunk-TNIR74NN.js +1 -0
  43. package/build/js/chunks/{chunk-M2ZQCUEL.js → chunk-U2VELHGX.js} +1 -1
  44. package/build/js/chunks/chunk-U6MNF7M6.js +35 -0
  45. package/build/js/chunks/{chunk-2OCDIZIS.js → chunk-UQVVJP5Z.js} +1 -1
  46. package/build/js/chunks/{chunk-IVQL2BYY.js → chunk-XDTXM6UX.js} +1 -1
  47. package/build/js/chunks/{chunk-7ZU6DPLL.js → chunk-XV75QMNK.js} +1 -1
  48. package/build/js/chunks/chunk-Y3TODCJD.js +1 -0
  49. package/build/js/chunks/{chunk-7EGT56UE.js → chunk-Z6CZGU5N.js} +1 -1
  50. package/build/js/chunks/chunk-ZAXZRQYF.js +1 -0
  51. package/build/js/controls/CameraFOVSwitchControl.d.ts +2 -2
  52. package/build/js/controls/CameraFOVSwitchControl.js +1 -1
  53. package/build/js/controls/CameraSwitchControl.d.ts +2 -2
  54. package/build/js/controls/CameraSwitchControl.js +1 -1
  55. package/build/js/controls/TorchSwitchControl.d.ts +2 -2
  56. package/build/js/controls/TorchSwitchControl.js +1 -1
  57. package/build/js/controls/common.d.ts +2 -2
  58. package/build/js/controls/index.d.ts +2 -2
  59. package/build/js/controls/index.js +1 -1
  60. package/build/js/defaults/DefaultsCamera.d.ts +2 -2
  61. package/build/js/defaults/DefaultsCameraSettings.d.ts +1 -1
  62. package/build/js/defaults/DefaultsDataCaptureView.js +1 -1
  63. package/build/js/global.d.d.ts +1 -0
  64. package/build/js/index.d.ts +2 -2
  65. package/build/js/index.js +1 -1
  66. package/build/js/moduleLoader.d.ts +2 -2
  67. package/build/js/private/CameraAccess.d.ts +1 -1
  68. package/build/js/private/CameraManager.d.ts +2 -2
  69. package/build/js/private/CameraManager.js +1 -1
  70. package/build/js/private/CameraPool.d.ts +3 -2
  71. package/build/js/private/CameraPool.js +1 -1
  72. package/build/js/private/CanvasDrawerWithMetrics.d.ts +2 -2
  73. package/build/js/private/CoreModuleLicenseTextProvider.d.ts +2 -2
  74. package/build/js/private/CoreModuleLicenseTextProvider.js +1 -1
  75. package/build/js/private/CustomLocationsView.js +1 -1
  76. package/build/js/private/DataCaptureContextRelated.d.ts +2 -2
  77. package/build/js/private/FrameReaders/FrameReader.d.ts +2 -2
  78. package/build/js/private/FrameReaders/FrameReader.js +1 -1
  79. package/build/js/private/FrameReaders/FrameReaderAbstract.d.ts +2 -2
  80. package/build/js/private/FrameReaders/GrayScaleFrameReader.d.ts +2 -2
  81. package/build/js/private/FrameReaders/GrayScaleFrameReader.js +1 -1
  82. package/build/js/private/FrameReaders/index.d.ts +2 -2
  83. package/build/js/private/FrameReaders/index.js +1 -1
  84. package/build/js/private/NormalizedModuleLoaderOptions.d.ts +2 -2
  85. package/build/js/private/SingleImageUploaderView.d.ts +2 -2
  86. package/build/js/private/SingleImageUploaderView.js +1 -1
  87. package/build/js/private/ViewControls+related.js +1 -1
  88. package/build/js/private/ViewControls_related.d.ts +2 -2
  89. package/build/js/private/ViewsRegistry.d.ts +2 -2
  90. package/build/js/private/customHowler/AudioCache.d.ts +37 -0
  91. package/build/js/private/customHowler/AudioCache.js +1 -0
  92. package/build/js/private/customHowler/Howl.d.ts +189 -0
  93. package/build/js/private/customHowler/Howl.js +1 -0
  94. package/build/js/private/customHowler/HowlRegistry.d.ts +18 -0
  95. package/build/js/private/customHowler/HowlRegistry.js +1 -0
  96. package/build/js/private/customHowler/Html5Sound.d.ts +52 -0
  97. package/build/js/private/customHowler/Html5Sound.js +1 -0
  98. package/build/js/private/customHowler/UnlockManager.d.ts +39 -0
  99. package/build/js/private/customHowler/UnlockManager.js +1 -0
  100. package/build/js/private/customHowler/WebAudioContextManager.d.ts +161 -0
  101. package/build/js/private/customHowler/WebAudioContextManager.js +1 -0
  102. package/build/js/private/customHowler/debug.d.ts +28 -0
  103. package/build/js/private/customHowler/debug.js +1 -0
  104. package/build/js/private/customHowler/index.d.ts +2 -0
  105. package/build/js/private/customHowler/index.js +1 -0
  106. package/build/js/private/customHowler/setup.d.ts +55 -0
  107. package/build/js/private/customHowler/setup.js +1 -0
  108. package/build/js/private/ui/atoms/Toast.d.ts +2 -2
  109. package/build/js/private/ui/atoms/Toast.js +1 -1
  110. package/build/js/private/ui/molecules/CameraFOVSwitchButton.js +1 -1
  111. package/build/js/private/ui/molecules/CameraSwitchButton.js +1 -1
  112. package/build/js/private/ui/molecules/HintPresenter.d.ts +2 -2
  113. package/build/js/private/ui/molecules/HintPresenter.js +1 -1
  114. package/build/js/private/ui/molecules/TorchSwitchIconButton.d.ts +1 -1
  115. package/build/js/private/ui/molecules/TorchSwitchIconButton.js +1 -1
  116. package/build/js/private/utils/replaceImagesInViewUtils.d.ts +2 -2
  117. package/build/js/worker/ImageConverterForwarder.d.ts +2 -2
  118. package/build/js/worker/ViewInfoHelper.d.ts +2 -2
  119. package/build/js/worker/WorkerMain.d.ts +2 -2
  120. package/build/js/worker/WorkerMain.js +1 -1
  121. package/build/js/worker/coreCapture.inlineWorker.d.ts +2 -2
  122. package/build/js/worker/coreCapture.inlineWorker.js +1 -1
  123. package/build/js/worker/dataCaptureEngine.d.ts +2 -2
  124. package/build/js/worker/dataCaptureEngine.js +1 -1
  125. package/build/js/worker/dataCaptureLoader.d.ts +2 -2
  126. package/build/js/worker/dataCaptureWorkerRelated.d.ts +2 -2
  127. package/build/js/worker/index.d.ts +2 -2
  128. package/build/js/worker/index.js +1 -1
  129. package/package.json +1 -1
  130. package/build/js/chunks/chunk-7JVAQ2A3.js +0 -1
  131. package/build/js/chunks/chunk-BV63CXZF.js +0 -1
  132. package/build/js/chunks/chunk-E7IMQECS.js +0 -35
  133. package/build/js/chunks/chunk-IBDUCVB4.js +0 -1
  134. package/build/js/chunks/chunk-KUAZYGPM.js +0 -1
  135. package/build/js/chunks/chunk-WBYBTOBZ.js +0 -1
  136. package/build/js/chunks/chunk-XW3Z6KKS.js +0 -1
  137. package/build/js/chunks/chunk-YMM2PV73.js +0 -6
  138. package/build/js/private/customHowler.d.ts +0 -27
  139. package/build/js/private/customHowler.js +0 -1
  140. /package/build/js/chunks/{chunk-FHNMZZV2.js → chunk-YRQQE3NR.js} +0 -0
  141. /package/build/js/chunks/{chunk-DQ5X7FNV.js → chunk-ZCEA7BEH.js} +0 -0
@@ -1 +1 @@
1
- import {a as a$3}from'./chunk-YP53ND2Q.js';import {a as a$2}from'./chunk-6IM6NGGI.js';import {e as e$1}from'./chunk-TTGJAMI2.js';import {a as a$7,b}from'./chunk-EQ6V4W5K.js';import {a as a$4}from'./chunk-UWBNF47P.js';import {a as a$1}from'./chunk-EV4OEANA.js';import {a as a$6}from'./chunk-3A4KLILV.js';import {a as a$5}from'./chunk-LSZZVJ6B.js';var w=(t=>(t.DidShow="didshow",t.DidHide="didhide",t))(w||{}),s="--text-size",r="--text-color",i="--text-alignment",a="--text-weight",l="--line-height",c="--background-color",h="--corner-radius",o="--max-lines",A="ease-in-out",e=class e extends a$1{constructor(){super();this.toast=null;this._hintStyle=null;this._customIcon=null;this.currentAnimation=null;this.animationDuration=250;this._currentAnimationDirection=null;let t=this.attachShadow({mode:"open"});this._exclamationIcon=a$2.create(),this._checkIcon=a$3.create(),this._exclamationIcon.size=24,this._checkIcon.size=24,t.innerHTML=a$4`<div class="toast"><slot name="first-child"></slot><div class="left"><slot name="icon"></slot></div><p class="middle"><slot></slot></p></div>`,t.append(e.createStyleElement().cloneNode(true)),this.toast=t.querySelector(".toast");}static createStyleElement(){return a$5`:host{display:inline-block;font-family:SF Pro Display,sans-serif}:host([hidden]){display:none}.toast{${s}:1rem;${r}:#000;${a}:400;${i}:${"center"};${l}:1.5rem;${c}:#fff;${h}:.25rem;${o}:2;align-items:flex-start;background-color:var(${c});border-radius:var(${h});color:var(${r});display:flex;flex-direction:row;font-size:var(${s});font-weight:var(${a});gap:.625rem;justify-content:var(${i});line-height:var(${l});padding:.75rem 1rem}:host([direction=column]) .toast{align-items:center;flex-direction:column}:host([direction=row]) .toast{align-items:center;flex-direction:row}.toast .left{align-self:flex-start;display:flex}.toast.icon-${"none"} .left{display:none}.toast p.middle{display:inline-block;display:-webkit-box;line-clamp:var(${o});-webkit-line-clamp:var(${o});margin:0;padding:0;text-align:var(${i});-webkit-box-orient:vertical;align-self:center;overflow:hidden;text-shadow:0 1px 2px #${e$1.withAlpha(.3).toJSON()}}p.middle{text-align:var(${i})}`}get hintStyle(){return this._hintStyle}set hintStyle(t){this._hintStyle=t,this.render();}get customIcon(){return this._customIcon}set customIcon(t){this._customIcon=t,this.render();}get showAnimation(){return new Animation(new KeyframeEffect(this,[{opacity:0},{opacity:1}],{duration:this.animationDuration,fill:"both",easing:A}))}get hideAnimation(){return new Animation(new KeyframeEffect(this,[{opacity:1},{opacity:0}],{duration:this.animationDuration,fill:"both",easing:A}))}static create(){return e.register(),document.createElement(e.tag)}static register(){a$6({[e.tag]:e});}async show(){return this.toggle(true)}async hide(){return this.toggle(false)}connectedCallback(){this.render();}async toggle(t){var m,d;let n=t?"showing":"hiding";this.currentAnimation&&this._currentAnimationDirection===n&&this.currentAnimation.playState==="running"||(this.currentAnimation&&a$7(this.currentAnimation),this.animationDuration=(d=(m=this.hintStyle)==null?void 0:m.isAnimatedToView)==null||d?250:0,this._currentAnimationDirection=n,this.currentAnimation=t?this.showAnimation:this.hideAnimation,this.currentAnimation.play(),await b(this.currentAnimation),this.dispatchEvent(new CustomEvent(t?"didshow":"didhide",{bubbles:true,detail:{target:this}})),this.currentAnimation=null,this._currentAnimationDirection=null);}render(){var t;if(!(!this.toast||!this.hintStyle)){this.toast.className="toast",this.toast.style.setProperty(s,`${this.hintStyle.textSize}px`),this.toast.style.setProperty(r,`#${this.hintStyle.textColor}`),this.toast.style.setProperty(a,this.hintStyle.textWeight.toString()),this.toast.style.setProperty(i,this.hintStyle.textAlignment),this.toast.style.setProperty(l,`${this.hintStyle.lineHeight/14}`),this.toast.style.setProperty(c,`#${this.hintStyle.backgroundColor}`),this.toast.style.setProperty(h,`${this.hintStyle.cornerRadius/10}rem`),this.toast.style.setProperty(o,this.hintStyle.maxLines.toString());for(let n of this.querySelectorAll("[slot=icon]"))n.remove();this._customIcon?(this._customIcon.setAttribute("slot","icon"),this.append(this._customIcon),this.toast.classList.remove("icon-none")):(this.toast.classList.toggle("icon-none",this.hintStyle.hintIcon==="none"),this.hintStyle.hintIcon==="check"?(this._checkIcon.setAttribute("slot","icon"),this.append(this._checkIcon)):this.hintStyle.hintIcon==="exclamationMark"&&(this._exclamationIcon.setAttribute("slot","icon"),this.append(this._exclamationIcon)),this.hintStyle.iconColor&&((t=this.querySelector("[slot=icon]"))==null||t.setAttribute("fill",`#${this.hintStyle.iconColor}`)));}}};e.tag="scandit-toast-hint";var I=e;export{w as a,I as b};
1
+ import {a as a$2}from'./chunk-6IM6NGGI.js';import {a as a$3}from'./chunk-YP53ND2Q.js';import {e as e$1}from'./chunk-TTGJAMI2.js';import {a as a$7,b}from'./chunk-EQ6V4W5K.js';import {a as a$4}from'./chunk-UWBNF47P.js';import {a as a$1}from'./chunk-EV4OEANA.js';import {a as a$6}from'./chunk-3A4KLILV.js';import {a as a$5}from'./chunk-LSZZVJ6B.js';var w=(t=>(t.DidShow="didshow",t.DidHide="didhide",t))(w||{}),s="--text-size",r="--text-color",i="--text-alignment",a="--text-weight",l="--line-height",c="--background-color",h="--corner-radius",o="--max-lines",A="ease-in-out",e=class e extends a$1{constructor(){super();this.toast=null;this._hintStyle=null;this._customIcon=null;this.currentAnimation=null;this.animationDuration=250;this._currentAnimationDirection=null;let t=this.attachShadow({mode:"open"});this._exclamationIcon=a$2.create(),this._checkIcon=a$3.create(),this._exclamationIcon.size=24,this._checkIcon.size=24,t.innerHTML=a$4`<div class="toast"><slot name="first-child"></slot><div class="left"><slot name="icon"></slot></div><p class="middle"><slot></slot></p></div>`,t.append(e.createStyleElement().cloneNode(true)),this.toast=t.querySelector(".toast");}static createStyleElement(){return a$5`:host{display:inline-block;font-family:SF Pro Display,sans-serif}:host([hidden]){display:none}.toast{${s}:1rem;${r}:#000;${a}:400;${i}:${"center"};${l}:1.5rem;${c}:#fff;${h}:.25rem;${o}:2;align-items:flex-start;background-color:var(${c});border-radius:var(${h});color:var(${r});display:flex;flex-direction:row;font-size:var(${s});font-weight:var(${a});gap:.625rem;justify-content:var(${i});line-height:var(${l});padding:.75rem 1rem}:host([direction=column]) .toast{align-items:center;flex-direction:column}:host([direction=row]) .toast{align-items:center;flex-direction:row}.toast .left{align-self:flex-start;display:flex}.toast.icon-${"none"} .left{display:none}.toast p.middle{display:inline-block;display:-webkit-box;line-clamp:var(${o});-webkit-line-clamp:var(${o});margin:0;padding:0;text-align:var(${i});-webkit-box-orient:vertical;align-self:center;overflow:hidden;text-shadow:0 1px 2px #${e$1.withAlpha(.3).toJSON()}}p.middle{text-align:var(${i})}`}get hintStyle(){return this._hintStyle}set hintStyle(t){this._hintStyle=t,this.render();}get customIcon(){return this._customIcon}set customIcon(t){this._customIcon=t,this.render();}get showAnimation(){return new Animation(new KeyframeEffect(this,[{opacity:0},{opacity:1}],{duration:this.animationDuration,fill:"both",easing:A}))}get hideAnimation(){return new Animation(new KeyframeEffect(this,[{opacity:1},{opacity:0}],{duration:this.animationDuration,fill:"both",easing:A}))}static create(){return e.register(),document.createElement(e.tag)}static register(){a$6({[e.tag]:e});}async show(){return this.toggle(true)}async hide(){return this.toggle(false)}connectedCallback(){this.render();}async toggle(t){var m,d;let n=t?"showing":"hiding";this.currentAnimation&&this._currentAnimationDirection===n&&this.currentAnimation.playState==="running"||(this.currentAnimation&&a$7(this.currentAnimation),this.animationDuration=(d=(m=this.hintStyle)==null?void 0:m.isAnimatedToView)==null||d?250:0,this._currentAnimationDirection=n,this.currentAnimation=t?this.showAnimation:this.hideAnimation,this.currentAnimation.play(),await b(this.currentAnimation),this.dispatchEvent(new CustomEvent(t?"didshow":"didhide",{bubbles:true,detail:{target:this}})),this.currentAnimation=null,this._currentAnimationDirection=null);}render(){var t;if(!(!this.toast||!this.hintStyle)){this.toast.className="toast",this.toast.style.setProperty(s,`${this.hintStyle.textSize}px`),this.toast.style.setProperty(r,`#${this.hintStyle.textColor}`),this.toast.style.setProperty(a,this.hintStyle.textWeight.toString()),this.toast.style.setProperty(i,this.hintStyle.textAlignment),this.toast.style.setProperty(l,`${this.hintStyle.lineHeight/14}`),this.toast.style.setProperty(c,`#${this.hintStyle.backgroundColor}`),this.toast.style.setProperty(h,`${this.hintStyle.cornerRadius/10}rem`),this.toast.style.setProperty(o,this.hintStyle.maxLines.toString());for(let n of this.querySelectorAll("[slot=icon]"))n.remove();this._customIcon?(this._customIcon.setAttribute("slot","icon"),this.append(this._customIcon),this.toast.classList.remove("icon-none")):(this.toast.classList.toggle("icon-none",this.hintStyle.hintIcon==="none"),this.hintStyle.hintIcon==="check"?(this._checkIcon.setAttribute("slot","icon"),this.append(this._checkIcon)):this.hintStyle.hintIcon==="exclamationMark"&&(this._exclamationIcon.setAttribute("slot","icon"),this.append(this._exclamationIcon)),this.hintStyle.iconColor&&((t=this.querySelector("[slot=icon]"))==null||t.setAttribute("fill",`#${this.hintStyle.iconColor}`)));}}};e.tag="scandit-toast-hint";var I=e;export{w as a,I as b};
@@ -0,0 +1 @@
1
+ import {a}from'./chunk-LFJUGRQV.js';import {a as a$1}from'./chunk-XR65N6EG.js';var p=class{constructor(){this.cameraPool=new Set;}getOrCreate(a$1){var e;let{position:l,deviceId:n,label:s}=a$1,c=(e=a$1._isBestGuess)!=null?e:false;if(this.cameraPool.size===0)return this.push(a$1);let o=this.allCamerasNoDeviceId(),i=Array.from(this.cameraPool);if(n){let t=i.find(d=>d.deviceId===n);if(t)return t;if(o){let d=i.find(h=>h.position===l);if(d)return d[a].setDeviceId(n),d[a].setLabel(s),d}}if(c){let t=i.find(d=>d._isBestGuess);if(t)return t}if(o&&!n){let t=i.find(d=>d.position===l);if(t)return t}return this.push(a$1)}integrateIncomingVideoDevices(a$2){let l=Array.from(this.cameraPool),n=new Set,s=[...a$2].reverse();for(let o=s.length-1;o>=0;o--){let i=s[o];if(!i.deviceId)continue;let e=l.find(t=>t.deviceId===i.deviceId&&!n.has(t));e&&(e[a].setLabel(i.label),e.position=i.position,e[a].resetUnmappedState(),n.add(e),s.splice(o,1),this.debugLog("Updated pool camera by deviceId",{deviceId:e.deviceId,label:e.label,position:e.position}));}for(let o=s.length-1;o>=0;o--){let i=s[o],e=l.find(t=>t.position===i.position&&!n.has(t));e&&(e[a].setDeviceId(i.deviceId),e[a].setLabel(i.label),e[a].resetUnmappedState(),n.add(e),s.splice(o,1),this.debugLog("Updated pool camera by position",{deviceId:e.deviceId,label:e.label,position:e.position}));}if(s.length>0){let o=l.filter(i=>!n.has(i));if(o.length>0){for(let i=0;i<Math.min(s.length,o.length);i++){let e=o[i],t=s[i];e[a].setDeviceId(t.deviceId),e[a].setLabel(t.label),e.position=t.position,e[a].resetUnmappedState(),n.add(e),this.debugLog("Force updated pool camera",{deviceId:e.deviceId,label:e.label,position:e.position});}s.splice(0,Math.min(s.length,o.length));}for(let i of s)this.cameraPool.add(i),this.debugLog("Added new camera to pool",{deviceId:i.deviceId,label:i.label,position:i.position});}let c=l.filter(o=>!n.has(o));if(c.length>0){a$1.warn("Some cameras were created but could not be mapped to cameras found on the device. This happens when you create more Cameras than it exists. These cameras will not be accessible.");for(let o of c)a$1.warn("Removing non-updated camera:",{deviceId:o.deviceId,label:o.label,position:o.position}),o[a].markAsUnmappedToDeviceCameras(),this.cameraPool.delete(o);}this.debugLog("Camera pool state after reconciliation:"),this.logPool();}allCamerasNoDeviceId(){return Array.from(this.cameraPool).every(a=>a.deviceId==="")}get(){return Array.from(this.cameraPool)}clear(){this.cameraPool.clear();}push(a){return this.debugLog("adding camera to pool",JSON.stringify({deviceId:a.deviceId,position:a.position,label:a.label})),this.cameraPool.add(a),a}debugLog(...a){}logPool(){}dumpAsSimpleObjects(){return [...this.cameraPool].map(a=>({deviceId:a.deviceId,label:a.label,position:a.position}))}},f={[a]:{CameraPool:p}};var u=new p;export{f as a,u as b};
@@ -0,0 +1 @@
1
+ var o=void 0;export{o as a};
@@ -0,0 +1 @@
1
+ import {a}from'./chunk-LV6LGCDC.js';import {c,b}from'./chunk-Y3TODCJD.js';import {c as c$1}from'./chunk-ZAXZRQYF.js';import {a as a$1}from'./chunk-SJIN27Q5.js';var i=new a,o=null;function m(){return o||(o=new c),o}function h(){var t,e;let u=c$1();for(let c of u)c.dispose();(t=a$1)==null||t(`\u{1F3B5} Disposed ${u.length} Howl instances`),i.reset(),o&&(o.dispose(),o=null),b().clear(),(e=a$1)==null||e("\u{1F3A7} Audio buffer cache cleared during disposal");}function k(){h();}function w(){var t;if(i.isSetupComplete()||typeof document>"u")return;i.markSetupComplete(),(t=a$1)==null||t("\u{1F3A7} Setting up audio unlock event listeners");let u=e=>{var l,s,r,a,d;(d=a$1)==null||d(`\u{1F446} User ${e.type} detected at (${(s=(l=e.touches)==null?void 0:l[0])==null?void 0:s.clientX}, ${(a=(r=e.touches)==null?void 0:r[0])==null?void 0:a.clientY}), unlocking audio...`),m().unlock(),i.reset();};i.setup(u);}export{m as a,h as b,k as c,w as d};
@@ -1 +1 @@
1
- import {a as a$4}from'./chunk-DN32UPQC.js';import {a as a$8}from'./chunk-DZKTI5AJ.js';import {a as a$9}from'./chunk-G2BRTVN7.js';import {c as c$1,a as a$a}from'./chunk-4W2T3TLN.js';import {c}from'./chunk-UWLAKRB2.js';import {a as a$1}from'./chunk-CAUB35PV.js';import {a as a$2}from'./chunk-QIWPWOQG.js';import {a}from'./chunk-GQ7A6533.js';import {a as a$6}from'./chunk-7JVAQ2A3.js';import {d}from'./chunk-AIC4H5KG.js';import {a as a$5}from'./chunk-O7TZTIHO.js';import {a as a$3}from'./chunk-XR65N6EG.js';import {a as a$7}from'./chunk-QCZSSQAQ.js';var P=class P{constructor(e,t){this.hintPresenterV2=null;this.MAX_NUMBER_OF_IMAGES_IN_FRAME_DATA_POOL=5;this.redrawInterval=1e3/30;this.redrawRequests=[];this._isDrawLoopRunning=false;this.frameDataPool=new Map;this.lastFrameColorType="RGBA";this.lastFrameId=null;this.poorMansBenchmarkLogs=false;this.writableDataPathStandard="/scandit_sync_folder";this.resourceFilesSubfolder="resources";this.performanceMetricsReporterTimer=void 0;this.lastMetricsReportTime=0;this.metricsReportInterval=1e3;this.performanceMetrics={frameDataPoolSize:0,cameraOutputFrames:0,redrawRequestsCount:0,actualRedrawsCount:0,frameProcessingStartedCount:0,frameProcessedCount:0,frameSkippedCount:0};this.frameProcessingStartedCount=0;this.frameProcessingFinishedCount=0;this.gestureListener=null;this.webPlatformHintPresenter=null;this.deviceInstance=null;this.deviceInfo=null;this.lastViewInfo=new a(null);this.lastFrameProcessingStartedCount=0;this.lastFrameProcessingFinishedCount=0;this.moduleHandler=e,this.workerFunctions=t,this._loadProgressCallback=this._loadProgressCallback.bind(this),c(this.getWasmMetadata());}get Module(){return this.moduleHandler.get()}set isDrawLoopRunning(e){this._isDrawLoopRunning=e,!e&&typeof this.loopTimeoutId=="number"&&(clearTimeout(this.loopTimeoutId),this.loopTimeoutId=void 0);}get isDrawLoopRunning(){return this._isDrawLoopRunning}prepareFrameForListener(e){let t=this.lastFrameId;if(this.frameDataPool.size>=this.MAX_NUMBER_OF_IMAGES_IN_FRAME_DATA_POOL){let l=this.frameDataPool.keys().next().value;l!=null&&this.frameDataPool.delete(l);}let r=e.getFrameData(),i=new Uint8ClampedArray(r);this.frameDataPool.set(t,{data:i,colorType:this.lastFrameColorType,frameId:t,width:e.getWidth(),height:e.getHeight()});let n=this.lastUsedModuleMirrorAxis==null?false:this.lastUsedModuleMirrorAxis!==this.Module.Axis.None;return {frameId:t,width:e.getWidth(),height:e.getHeight(),isFrameSourceMirrored:n,colorType:this.lastFrameColorType}}createContext(e){var f,m,C,b,y;let t=this.getModeDeserializers(),r=c$1(location);(r==="localhost"||r==="127.0.0.1")&&navigator.userAgent.includes("Electron")&&e.appName!=null&&(r+=`-${e.appName}`),this.parentDomain=e.parentDomain,this.contextDeserializer=new this.Module.DataCaptureContextDeserializer(this.writableDataPath,e.deviceId,e.context.deviceModelName,r,this.parentDomain,t,e.delayedRegistration,e.highEndBlurryRecognition,this.resourcePath);let i=this.contextDeserializer.contextFromJson(JSON.stringify(e.context));if(i==null){let a=this.contextDeserializer.getLastError();throw new Error(`Could not create the context: ${a}`)}let n=i.getView();this.context=i.getContext(),i.delete(),this.setupDeviceInterface(e.isTablet,e.batteryInfo);let l=this.Module.DataCaptureContextListener.extend("DataCaptureContextListener",{didChangeStatus:(a,o)=>{this.contextDidChangeStatus(JSON.parse(o.toJson())),a.delete();},didStartObservingContext:a=>{this.didStartObservingContext(),a.delete();},didStopObservingContext:a=>{a.delete();}}),c=this.Module.DataCaptureContextFrameListener.extend("DataCaptureContextFrameListener",{onObservationStarted:a=>{a.delete();},onObservationStopped:a=>{a.delete();},onFrameProcessingStarted:(a,o)=>{this.workerFunctions.postMessage({type:"onFrameProcessingStarted"}),o.delete(),a.delete();},onFrameProcessingFinished:(a,o)=>{this.workerFunctions.postMessage({type:"onFrameProcessingFinished"}),o.delete(),a.delete();},onFrameSkipped:(a,o)=>{this.workerFunctions.postMessage({type:"onFrameSkipped"}),o.delete(),a.delete();}}),h=this.Module.GestureRecognizer.extend("GestureRecognizer",{setGestureListener:(a,o)=>{var w;(w=this.gestureListener)==null||w.delete(),this.gestureListener=a.clone(),a.delete();}});(f=this.gestureRecognizer)==null||f.delete(),this.gestureRecognizer=new h;let g=new l;this.context.addListener(g),g.delete();let u=new c;this.context.addFrameListener(u),u.delete(),this.setView(n),(m=this.view)==null||m.setGestureRecognizer(this.gestureRecognizer);let p=this.Module.PlatformHintPresenter.extend("PlatformHintPresenter",{setHintPresenter:a=>{a.delete();},showToast:a=>{this.workerFunctions.postMessage({type:"showToast",payload:JSON.parse(a)});},hideToast:a=>{this.workerFunctions.postMessage({type:"hideToast",payload:JSON.parse(a)});},showGuidance:a=>{this.workerFunctions.postMessage({type:"showGuidance",payload:JSON.parse(a)});},hideGuidance:a=>{this.workerFunctions.postMessage({type:"hideGuidance",payload:JSON.parse(a)});},startUpdateTimer:a=>{this.workerFunctions.postMessage({type:"startUpdateTimer",payload:{duration:{unit:"ms",value:a}}});},stopUpdateTimer:()=>{this.workerFunctions.postMessage({type:"stopUpdateTimer"});}});(C=this.hintPresenterV2)==null||C.delete(),this.hintPresenterV2=null,(b=this.webPlatformHintPresenter)==null||b.delete(),this.webPlatformHintPresenter=null,this.webPlatformHintPresenter=new p,this.view&&(this.hintPresenterV2=new this.Module.HintPresenterV2(this.webPlatformHintPresenter),(y=this.view)==null||y.setHintPresenterV2(this.hintPresenterV2)),this.webImageConverterInstance=this.getImageConverterInstance({quality:1}),this.Module.ImageConverter.setInstance(this.webImageConverterInstance);}convertToJPEGResult(e,t){this.webImageConverterInstance instanceof a$1&&this.webImageConverterInstance.onConvertToJPEGResult(e,t);}getImageConverterInstance(e){return this.workerFunctions.getOffscreenCanvas()!=null?new a$2(e):new a$1(this.workerFunctions,e)}onTap(e){var t;(t=this.gestureListener)==null||t.onTap(JSON.stringify(e));}hintPresenterV2Update(){var e;(e=this.hintPresenterV2)==null||e.update();}startReportingPerformanceMetrics(){this.performanceMetricsReporterTimer==null&&(this.lastMetricsReportTime=performance.now(),this.scheduleMetricsReporting());}scheduleMetricsReporting(){this.performanceMetricsReporterTimer=setTimeout(()=>{this.checkAndReportMetrics();},100);}checkAndReportMetrics(){let e=performance.now();e-this.lastMetricsReportTime>=this.metricsReportInterval&&(this.reportPerformanceMetrics(),this.performanceMetrics.cameraOutputFrames=0,this.performanceMetrics.redrawRequestsCount=0,this.performanceMetrics.actualRedrawsCount=0,this.lastMetricsReportTime=e),this._isDrawLoopRunning&&this.scheduleMetricsReporting();}async reportPerformanceMetrics(){let e=this.frameProcessingStartedCount-this.lastFrameProcessingStartedCount,r=this.frameProcessingFinishedCount-this.lastFrameProcessingFinishedCount;this.lastFrameProcessingStartedCount=this.frameProcessingStartedCount,this.lastFrameProcessingFinishedCount=this.frameProcessingFinishedCount;let i={cameraOutputFrames:this.performanceMetrics.cameraOutputFrames,redrawRequestsCount:this.performanceMetrics.redrawRequestsCount,actualRedrawsCount:this.performanceMetrics.actualRedrawsCount,frameDataPoolSize:this.performanceMetrics.frameDataPoolSize,frameProcessingStartedCount:e,frameProcessedCount:r,frameSkippedCount:this.performanceMetrics.frameSkippedCount};this.workerFunctions.postMessage({type:"performanceMetricsReport",payload:i});}deleteFrameData(e){this.frameDataPool.delete(e);}dispose(){var e,t,r,i,n;this.context.dispose(),this.frameDataPool.clear(),this.isDrawLoopRunning=false,this.cleanupMetricsReporting(),(e=this.gestureRecognizer)==null||e.delete(),this.gestureRecognizer=null,(t=this.gestureListener)==null||t.delete(),this.gestureListener=null,(r=this.hintPresenterV2)==null||r.delete(),this.hintPresenterV2=null,(i=this.webPlatformHintPresenter)==null||i.delete(),this.webPlatformHintPresenter=null,(n=this.deviceInstance)==null||n.delete(),this.deviceInstance=null,this.deviceInfo=null;}cleanupMetricsReporting(){this.performanceMetricsReporterTimer!=null&&(typeof this.performanceMetricsReporterTimer=="number"?cancelAnimationFrame(this.performanceMetricsReporterTimer):clearTimeout(this.performanceMetricsReporterTimer),this.performanceMetricsReporterTimer=void 0);}flushAnalytics(){this.context.flushAnalytics();}extractCentaurusLicense(e){return {payload:{centaurus:{licenseKey:this.Module.LicenseUtils[P.get3dPartyLicenseKeyMethodName](e)}}}}getModeDeserializers(){return new this.Module.VectorDataCaptureModeDeserializer}loadLibrary(e){return this.libraryLoadingPromise!=null?this.libraryLoadingPromise:(this.libraryLoadingPromise=this.setup(e),this.libraryLoadingPromise)}processFrame(e){var n;if(this.context==null)return a$3.debug("[processFrame] Context is null, returning frame without processing"),{payload:e,transferables:[e.data.buffer]};this.lastFrameId=e.frameId;let t=e.data,r=e.colorType==="GRAYSCALE"?this.Module.ImageBufferFormat.Grayscale8:this.Module.ImageBufferFormat.Rgba8888;this.lastFrameColorType=e.colorType==="GRAYSCALE"?"GRAYSCALE":"RGBA";let i=this.Module.allocateUint8Array(t.byteLength);return this.Module.HEAPU8.set(t,i),(n=this.imageFrameSource)==null||n.outputFrame(i,e.width,e.height,r),{payload:e,transferables:[e.data.buffer]}}reportCameraProperties(e){this.context.setCameraProperties(e.deviceId,e.isFrontFacing,e.hasAutofocus);}requestFrameData(e){let t=this.frameDataPool.get(e);if(t==null)return {payload:{data:null,frameId:null,colorType:null}};if(t.data.buffer.byteLength===0)return this.frameDataPool.delete(e),{payload:{data:null,frameId:null,colorType:null}};let r=t.data;t.colorType==="GRAYSCALE"&&(r=a$4(t.data,t.width,t.height));let i={payload:{data:r,frameId:t.frameId,colorType:t.colorType},transferables:[r.buffer]};return this.frameDataPool.delete(e),i}scheduleRedraw(e,t){this.addRedrawRequest(t),this.isDrawLoopRunning||this.startDrawLoop(e);}sendViewRefreshCommands(e){this.workerFunctions.postMessage({type:"draw",payload:e},[e.buffer]);}setFrameSource(e,t){var r;this.lastUsedModuleMirrorAxis=this.mapMirrorAxisOnModule(e),(r=this.imageFrameSource)==null||r.delete(),this.imageFrameSource=new this.Module.ImageBufferFrameSource(this.lastUsedModuleMirrorAxis,t,0),this.context.setFrameSource(this.imageFrameSource);}startDrawLoop(e){this.isDrawLoopRunning=true;let t=n=>this.redrawRequests.length>0&&this.redrawRequests[0]<=n,r=n=>{for(;this.redrawRequests.length>0&&this.redrawRequests[0]<=n;)this.redrawRequests.shift();},i=()=>{this.loopTimeoutId=setTimeout(()=>{if(!this.isDrawLoopRunning)return;let n=performance.now();if(t(n)){r(n),e.draw();let l=e.getDrawCommands();this.sendViewRefreshCommands(new Uint8Array(l));}i();},this.redrawInterval);};i();}updateContext(e){if(this.context!=null&&this.contextDeserializer!=null){e.view!=null&&!e.view.visible&&this.context.flushAnalytics();let t=this.onBeforeUpdateContextHook(e),r=this.contextDeserializer.updateContextFromJson(this.context,this.view,JSON.stringify(t.context));if(r==null){let n=this.contextDeserializer.getLastError();throw new Error(`Could not update the context: ${n}`)}this.context.delete(),this.context=r.getContext();let i=r.getView();r.delete(),i!=null&&t.view!=null&&(i.setViewSize(t.view.width,t.view.height,t.view.orientation),i.draw()),!this.hintPresenterV2&&this.webPlatformHintPresenter&&(this.hintPresenterV2=new this.Module.HintPresenterV2(this.webPlatformHintPresenter)),i!=null&&this.hintPresenterV2&&i.setHintPresenterV2(this.hintPresenterV2),this.gestureRecognizer!=null&&(i==null||i.setGestureRecognizer(this.gestureRecognizer)),this.setView(i),this.notifyMainThreadOnViewInfoChanged(i),a$3.debug("context updated",t);}}notifyMainThreadOnViewInfoChanged(e){let t=this.getViewInfo(e);this.lastViewInfo.isSame(t)||(this.lastViewInfo.update(t),this.workerFunctions.postMessage({type:"viewSizeChanged",payload:t}));}getViewInfo(e){if(e!=null)try{let t=JSON.parse(e.getViewInfo());if(t!=null){let r=this.getOrientationFromNumber(t.orientation);return {...t,orientation:r}}}catch(t){a$3.error("Failed to get view size",t);}return null}getOrientationFromNumber(e){switch(e){case 90:return "landscapeRight";case 180:return "portraitUpsideDown";case 270:return "landscapeLeft";default:return "portrait"}}onBeforeUpdateContextHook(e){return e}onDocumentVisibilityChange(e){e==="hidden"&&this.context.flushAnalytics();}isFeatureSupported(e){return {payload:{supported:this.context.isFeatureSupported(e)}}}getViewfinderInfo(){var e,t;return {payload:{isDisplayingViewfinder:(t=(e=this.view)==null?void 0:e.isDisplayingViewfinder())!=null?t:false,rect:JSON.parse(this.view.getViewfinderRect())}}}getOpenSourceSoftwareLicenseInfo(){return {payload:{licenseText:this.Module.OpenSourceSoftwareLicenseInfo.getLicenseText()}}}getWasmDynamicLibraries(e){return this.getWasmSideModuleFileName()==null?[]:[`${e.replace(/\/[^/]*$/,"/")}${this.getWasmSideModuleFileName()}`]}getWasmCoreExpectedHash(e,t){return t?e?globalThis.SDC_WASM_CORE_MT_SIMD_HASH:globalThis.SDC_WASM_CORE_MT_HASH:e?globalThis.SDC_WASM_CORE_SIMD_HASH:""}getWasmCoreFileName(e,t){return t?e?globalThis.SDC_WASM_CORE_MT_SIMD_FILE_NAME:globalThis.SDC_WASM_CORE_MT_FILE_NAME:e?globalThis.SDC_WASM_CORE_SIMD_FILE_NAME:""}getWasmMetadata(){return globalThis.WASM_METADATA}getWasmSideModuleFileName(){return ""}_loadProgressCallback(e){this.workerFunctions.postMessage({type:"loadLibraryProgress",payload:e});}addRedrawRequest(e){this.redrawRequests.push(Math.round(performance.now())+e),this.redrawRequests.sort((t,r)=>t-r);}contextDidChangeStatus(e){e.code===260?e.message=e.message.replace("domain name",`domain name (${c$1(location)})`):e.code===265&&(e.message=e.message.replace("domain name",`domain name (${this.parentDomain})`)),this.workerFunctions.postMessage({type:"contextDidChangeStatus",payload:e});}didStartObservingContext(){this.workerFunctions.postMessage({type:"didStartObservingContext"});}mapMirrorAxisOnModule(e){switch(e){case "None":return this.Module.Axis.None;case "X":return this.Module.Axis.X;case "Y":return this.Module.Axis.Y;default:return this.Module.Axis.None}}setView(e){this.view=e,this.setViewRefreshHandler(e),e==null&&(this.isDrawLoopRunning=false,this.sendViewRefreshCommands(new Uint8Array([])));}addNativeOverlay(e){a$3.warn("addNativeOverlay has not been implemented for this module",e);}removeNativeOverlay(e){a$3.warn("removeNativeOverlay has not been implemented for this module",e);}setViewRefreshHandler(e){if(e==null||e.isViewRefreshHandlerSet)return;let t=this.Module.NeedsRedrawDelegate.extend("NeedsRedrawDelegate",{setNeedsRedrawIn:this.scheduleRedraw.bind(this,e)}),r=new t;e.setNeedsRedrawDelegate(r),e.isViewRefreshHandlerSet=true;}setupDataDecoding(){let e=this.moduleHandler.get(),t=e.DataDecoding.extend("DataDecoding",{decode(r,i){try{let n=JSON.parse(i),l=[];for(let c of n){let h=new TextDecoder(c.ianaName,{fatal:true});l.push(h.decode(r.slice(c.startIndex,c.endIndex)));}return l.join("")}catch{return ""}}});e.setDataDecoding(new t);}getBatteryData(){var t,r;let e=(r=(t=this.deviceInfo)==null?void 0:t.batteryInfo)==null?void 0:r.percentage;if(e!=null)return {percentage:e}}isTablet(){var e,t;return (t=(e=this.deviceInfo)==null?void 0:e.isTablet)!=null?t:false}setupDeviceInterface(e,t){this.deviceInfo={isTablet:e,batteryInfo:t};let r=this.moduleHandler.get(),i=r.DeviceInterface.extend("DeviceInterface",{getBatteryData:this.getBatteryData.bind(this),isTablet:this.isTablet.bind(this)});this.deviceInstance=new i,r.DeviceHolder.setCurrentDevice(this.deviceInstance);}updateBatteryInfo(e){this.deviceInfo&&(this.deviceInfo.batteryInfo=e);}start(e,t,r){e&&t&&(this.setupDataDecoding(),this.moduleHandler.get().callMain(),this.moduleHandler.get().__emscripten_proxy_main!==void 0||r());}getWritableDataPath(e){return e!=null?(a$3.debug(`IndexedDB database name override in use to recover from blocked standard database: ${e}`),e):this.writableDataPathStandard}numOfMBToPages(e){return Math.ceil(1024*e*1024/64/1024)}async setup({libraryLocation:e,locationPath:t,writableDataPathOverride:r,indexedDBTimeoutMs:i,verifyResponseHash:n,referredOrigin:l,fixedWasmMemory:c,simdSupport:h,threadsSupport:g}){var v;let u=false,p=false;this.writableDataPath=this.getWritableDataPath(r),this.resourcePath=`${e}${this.resourceFilesSubfolder}/`,globalThis.path=t;let{resolve:f,reject:m,promise:C}=new a$5,b=a$6.sdkVersion();if(b==="")throw new a$7({name:"Invalid library version",message:"Library version is not defined or empty, cannot generate proper path to library files."});let y=this.getWasmCoreFileName(h,g),a=d(b,e,y),{jsURI:o,wasmURI:w}=a,W={instantiateWasm:(d,H)=>(a$a({importObject:d,wasmURI:w,expectedHash:this.getWasmCoreExpectedHash(h,g),verifyResponseHash:n,successCallback:H,progressCallback:this._loadProgressCallback,errorCallback:N=>{m(N);},referredOrigin:l}),{})},M=c===null?null:new WebAssembly.Memory({initial:this.numOfMBToPages(c),maximum:this.numOfMBToPages(300),shared:g});return M!==null&&a$3.log(a$3.Level.Debug,"Fixed wasmMemory set",M),this.moduleHandler.set({...M?{wasmMemory:M}:{},mainScriptUrlOrBlob:o,canvas:(v=this.workerFunctions.getOffscreenCanvas())!=null?v:{getContext:()=>null},...W,dynamicLibraries:this.getWasmDynamicLibraries(w),locateFile:d=>e+d,noInitialRun:true,preRun:[async()=>{try{await a$8({writableDataPath:this.writableDataPath,indexedDBTimeoutMs:i});}catch(d){if(d.name==="BlockedIndexedDB"){m(d.toString());return}a$3.log(a$3.Level.Debug,"No IndexedDB support, some data will not be persisted:",d);}p=true,this.start(p,u,f);}],onMainComplete:()=>{if([u,p].includes(false)){a$3.log(a$3.Level.Warn,{runtimeLoaded:u,fileSystemSynced:p},"Both runtimeLoaded and fileSystemSynced should be true when calling onMainComplete"),m("onMainComplete has been called but runtime or file system was not ready.");return}f();},onRuntimeInitialized:()=>{u=true,this.start(p,u,f);},print:d=>{a$3.info(d);}}),await a$9(o,b)||m(`Couldn't retrieve Scandit Data Capture library at ${o}, did you configure the path for it correctly?`),C}};P.get3dPartyLicenseKeyMethodName=atob("Z2V0QmxpbmtJZExpY2Vuc2VLZXk=");var V=P;export{V as a};
1
+ import {a as a$4}from'./chunk-DN32UPQC.js';import {a as a$8}from'./chunk-DZKTI5AJ.js';import {a as a$9}from'./chunk-G2BRTVN7.js';import {c as c$1,a as a$a}from'./chunk-4W2T3TLN.js';import {c}from'./chunk-UWLAKRB2.js';import {a as a$1}from'./chunk-CAUB35PV.js';import {a as a$2}from'./chunk-QIWPWOQG.js';import {a}from'./chunk-GQ7A6533.js';import {a as a$6}from'./chunk-KYAHE2Q3.js';import {d}from'./chunk-AIC4H5KG.js';import {a as a$5}from'./chunk-O7TZTIHO.js';import {a as a$3}from'./chunk-XR65N6EG.js';import {a as a$7}from'./chunk-QCZSSQAQ.js';var P=class P{constructor(e,t){this.hintPresenterV2=null;this.MAX_NUMBER_OF_IMAGES_IN_FRAME_DATA_POOL=5;this.redrawInterval=1e3/30;this.redrawRequests=[];this._isDrawLoopRunning=false;this.frameDataPool=new Map;this.lastFrameColorType="RGBA";this.lastFrameId=null;this.poorMansBenchmarkLogs=false;this.writableDataPathStandard="/scandit_sync_folder";this.resourceFilesSubfolder="resources";this.performanceMetricsReporterTimer=void 0;this.lastMetricsReportTime=0;this.metricsReportInterval=1e3;this.performanceMetrics={frameDataPoolSize:0,cameraOutputFrames:0,redrawRequestsCount:0,actualRedrawsCount:0,frameProcessingStartedCount:0,frameProcessedCount:0,frameSkippedCount:0};this.frameProcessingStartedCount=0;this.frameProcessingFinishedCount=0;this.gestureListener=null;this.webPlatformHintPresenter=null;this.deviceInstance=null;this.deviceInfo=null;this.lastViewInfo=new a(null);this.lastFrameProcessingStartedCount=0;this.lastFrameProcessingFinishedCount=0;this.moduleHandler=e,this.workerFunctions=t,this._loadProgressCallback=this._loadProgressCallback.bind(this),c(this.getWasmMetadata());}get Module(){return this.moduleHandler.get()}set isDrawLoopRunning(e){this._isDrawLoopRunning=e,!e&&typeof this.loopTimeoutId=="number"&&(clearTimeout(this.loopTimeoutId),this.loopTimeoutId=void 0);}get isDrawLoopRunning(){return this._isDrawLoopRunning}prepareFrameForListener(e){let t=this.lastFrameId;if(this.frameDataPool.size>=this.MAX_NUMBER_OF_IMAGES_IN_FRAME_DATA_POOL){let l=this.frameDataPool.keys().next().value;l!=null&&this.frameDataPool.delete(l);}let r=e.getFrameData(),i=new Uint8ClampedArray(r);this.frameDataPool.set(t,{data:i,colorType:this.lastFrameColorType,frameId:t,width:e.getWidth(),height:e.getHeight()});let n=this.lastUsedModuleMirrorAxis==null?false:this.lastUsedModuleMirrorAxis!==this.Module.Axis.None;return {frameId:t,width:e.getWidth(),height:e.getHeight(),isFrameSourceMirrored:n,colorType:this.lastFrameColorType}}createContext(e){var f,m,C,b,y;let t=this.getModeDeserializers(),r=c$1(location);(r==="localhost"||r==="127.0.0.1")&&navigator.userAgent.includes("Electron")&&e.appName!=null&&(r+=`-${e.appName}`),this.parentDomain=e.parentDomain,this.contextDeserializer=new this.Module.DataCaptureContextDeserializer(this.writableDataPath,e.deviceId,e.context.deviceModelName,r,this.parentDomain,t,e.delayedRegistration,e.highEndBlurryRecognition,this.resourcePath);let i=this.contextDeserializer.contextFromJson(JSON.stringify(e.context));if(i==null){let a=this.contextDeserializer.getLastError();throw new Error(`Could not create the context: ${a}`)}let n=i.getView();this.context=i.getContext(),i.delete(),this.setupDeviceInterface(e.isTablet,e.batteryInfo);let l=this.Module.DataCaptureContextListener.extend("DataCaptureContextListener",{didChangeStatus:(a,o)=>{this.contextDidChangeStatus(JSON.parse(o.toJson())),a.delete();},didStartObservingContext:a=>{this.didStartObservingContext(),a.delete();},didStopObservingContext:a=>{a.delete();}}),c=this.Module.DataCaptureContextFrameListener.extend("DataCaptureContextFrameListener",{onObservationStarted:a=>{a.delete();},onObservationStopped:a=>{a.delete();},onFrameProcessingStarted:(a,o)=>{this.workerFunctions.postMessage({type:"onFrameProcessingStarted"}),o.delete(),a.delete();},onFrameProcessingFinished:(a,o)=>{this.workerFunctions.postMessage({type:"onFrameProcessingFinished"}),o.delete(),a.delete();},onFrameSkipped:(a,o)=>{this.workerFunctions.postMessage({type:"onFrameSkipped"}),o.delete(),a.delete();}}),h=this.Module.GestureRecognizer.extend("GestureRecognizer",{setGestureListener:(a,o)=>{var w;(w=this.gestureListener)==null||w.delete(),this.gestureListener=a.clone(),a.delete();}});(f=this.gestureRecognizer)==null||f.delete(),this.gestureRecognizer=new h;let g=new l;this.context.addListener(g),g.delete();let u=new c;this.context.addFrameListener(u),u.delete(),this.setView(n),(m=this.view)==null||m.setGestureRecognizer(this.gestureRecognizer);let p=this.Module.PlatformHintPresenter.extend("PlatformHintPresenter",{setHintPresenter:a=>{a.delete();},showToast:a=>{this.workerFunctions.postMessage({type:"showToast",payload:JSON.parse(a)});},hideToast:a=>{this.workerFunctions.postMessage({type:"hideToast",payload:JSON.parse(a)});},showGuidance:a=>{this.workerFunctions.postMessage({type:"showGuidance",payload:JSON.parse(a)});},hideGuidance:a=>{this.workerFunctions.postMessage({type:"hideGuidance",payload:JSON.parse(a)});},startUpdateTimer:a=>{this.workerFunctions.postMessage({type:"startUpdateTimer",payload:{duration:{unit:"ms",value:a}}});},stopUpdateTimer:()=>{this.workerFunctions.postMessage({type:"stopUpdateTimer"});}});(C=this.hintPresenterV2)==null||C.delete(),this.hintPresenterV2=null,(b=this.webPlatformHintPresenter)==null||b.delete(),this.webPlatformHintPresenter=null,this.webPlatformHintPresenter=new p,this.view&&(this.hintPresenterV2=new this.Module.HintPresenterV2(this.webPlatformHintPresenter),(y=this.view)==null||y.setHintPresenterV2(this.hintPresenterV2)),this.webImageConverterInstance=this.getImageConverterInstance({quality:1}),this.Module.ImageConverter.setInstance(this.webImageConverterInstance);}convertToJPEGResult(e,t){this.webImageConverterInstance instanceof a$1&&this.webImageConverterInstance.onConvertToJPEGResult(e,t);}getImageConverterInstance(e){return this.workerFunctions.getOffscreenCanvas()!=null?new a$2(e):new a$1(this.workerFunctions,e)}onTap(e){var t;(t=this.gestureListener)==null||t.onTap(JSON.stringify(e));}hintPresenterV2Update(){var e;(e=this.hintPresenterV2)==null||e.update();}startReportingPerformanceMetrics(){this.performanceMetricsReporterTimer==null&&(this.lastMetricsReportTime=performance.now(),this.scheduleMetricsReporting());}scheduleMetricsReporting(){this.performanceMetricsReporterTimer=setTimeout(()=>{this.checkAndReportMetrics();},100);}checkAndReportMetrics(){let e=performance.now();e-this.lastMetricsReportTime>=this.metricsReportInterval&&(this.reportPerformanceMetrics(),this.performanceMetrics.cameraOutputFrames=0,this.performanceMetrics.redrawRequestsCount=0,this.performanceMetrics.actualRedrawsCount=0,this.lastMetricsReportTime=e),this._isDrawLoopRunning&&this.scheduleMetricsReporting();}async reportPerformanceMetrics(){let e=this.frameProcessingStartedCount-this.lastFrameProcessingStartedCount,r=this.frameProcessingFinishedCount-this.lastFrameProcessingFinishedCount;this.lastFrameProcessingStartedCount=this.frameProcessingStartedCount,this.lastFrameProcessingFinishedCount=this.frameProcessingFinishedCount;let i={cameraOutputFrames:this.performanceMetrics.cameraOutputFrames,redrawRequestsCount:this.performanceMetrics.redrawRequestsCount,actualRedrawsCount:this.performanceMetrics.actualRedrawsCount,frameDataPoolSize:this.performanceMetrics.frameDataPoolSize,frameProcessingStartedCount:e,frameProcessedCount:r,frameSkippedCount:this.performanceMetrics.frameSkippedCount};this.workerFunctions.postMessage({type:"performanceMetricsReport",payload:i});}deleteFrameData(e){this.frameDataPool.delete(e);}dispose(){var e,t,r,i,n;this.context.dispose(),this.frameDataPool.clear(),this.isDrawLoopRunning=false,this.cleanupMetricsReporting(),(e=this.gestureRecognizer)==null||e.delete(),this.gestureRecognizer=null,(t=this.gestureListener)==null||t.delete(),this.gestureListener=null,(r=this.hintPresenterV2)==null||r.delete(),this.hintPresenterV2=null,(i=this.webPlatformHintPresenter)==null||i.delete(),this.webPlatformHintPresenter=null,(n=this.deviceInstance)==null||n.delete(),this.deviceInstance=null,this.deviceInfo=null;}cleanupMetricsReporting(){this.performanceMetricsReporterTimer!=null&&(typeof this.performanceMetricsReporterTimer=="number"?cancelAnimationFrame(this.performanceMetricsReporterTimer):clearTimeout(this.performanceMetricsReporterTimer),this.performanceMetricsReporterTimer=void 0);}flushAnalytics(){this.context.flushAnalytics();}extractCentaurusLicense(e){return {payload:{centaurus:{licenseKey:this.Module.LicenseUtils[P.get3dPartyLicenseKeyMethodName](e)}}}}getModeDeserializers(){return new this.Module.VectorDataCaptureModeDeserializer}loadLibrary(e){return this.libraryLoadingPromise!=null?this.libraryLoadingPromise:(this.libraryLoadingPromise=this.setup(e),this.libraryLoadingPromise)}processFrame(e){var n;if(this.context==null)return a$3.debug("[processFrame] Context is null, returning frame without processing"),{payload:e,transferables:[e.data.buffer]};this.lastFrameId=e.frameId;let t=e.data,r=e.colorType==="GRAYSCALE"?this.Module.ImageBufferFormat.Grayscale8:this.Module.ImageBufferFormat.Rgba8888;this.lastFrameColorType=e.colorType==="GRAYSCALE"?"GRAYSCALE":"RGBA";let i=this.Module.allocateUint8Array(t.byteLength);return this.Module.HEAPU8.set(t,i),(n=this.imageFrameSource)==null||n.outputFrame(i,e.width,e.height,r),{payload:e,transferables:[e.data.buffer]}}reportCameraProperties(e){this.context.setCameraProperties(e.deviceId,e.isFrontFacing,e.hasAutofocus);}requestFrameData(e){let t=this.frameDataPool.get(e);if(t==null)return {payload:{data:null,frameId:null,colorType:null}};if(t.data.buffer.byteLength===0)return this.frameDataPool.delete(e),{payload:{data:null,frameId:null,colorType:null}};let r=t.data;t.colorType==="GRAYSCALE"&&(r=a$4(t.data,t.width,t.height));let i={payload:{data:r,frameId:t.frameId,colorType:t.colorType},transferables:[r.buffer]};return this.frameDataPool.delete(e),i}scheduleRedraw(e,t){this.addRedrawRequest(t),this.isDrawLoopRunning||this.startDrawLoop(e);}sendViewRefreshCommands(e){this.workerFunctions.postMessage({type:"draw",payload:e},[e.buffer]);}setFrameSource(e,t){var r;this.lastUsedModuleMirrorAxis=this.mapMirrorAxisOnModule(e),(r=this.imageFrameSource)==null||r.delete(),this.imageFrameSource=new this.Module.ImageBufferFrameSource(this.lastUsedModuleMirrorAxis,t,0),this.context.setFrameSource(this.imageFrameSource);}startDrawLoop(e){this.isDrawLoopRunning=true;let t=n=>this.redrawRequests.length>0&&this.redrawRequests[0]<=n,r=n=>{for(;this.redrawRequests.length>0&&this.redrawRequests[0]<=n;)this.redrawRequests.shift();},i=()=>{this.loopTimeoutId=setTimeout(()=>{if(!this.isDrawLoopRunning)return;let n=performance.now();if(t(n)){r(n),e.draw();let l=e.getDrawCommands();this.sendViewRefreshCommands(new Uint8Array(l));}i();},this.redrawInterval);};i();}updateContext(e){if(this.context!=null&&this.contextDeserializer!=null){e.view!=null&&!e.view.visible&&this.context.flushAnalytics();let t=this.onBeforeUpdateContextHook(e),r=this.contextDeserializer.updateContextFromJson(this.context,this.view,JSON.stringify(t.context));if(r==null){let n=this.contextDeserializer.getLastError();throw new Error(`Could not update the context: ${n}`)}this.context.delete(),this.context=r.getContext();let i=r.getView();r.delete(),i!=null&&t.view!=null&&(i.setViewSize(t.view.width,t.view.height,t.view.orientation),i.draw()),!this.hintPresenterV2&&this.webPlatformHintPresenter&&(this.hintPresenterV2=new this.Module.HintPresenterV2(this.webPlatformHintPresenter)),i!=null&&this.hintPresenterV2&&i.setHintPresenterV2(this.hintPresenterV2),this.gestureRecognizer!=null&&(i==null||i.setGestureRecognizer(this.gestureRecognizer)),this.setView(i),this.notifyMainThreadOnViewInfoChanged(i),a$3.debug("context updated",t);}}notifyMainThreadOnViewInfoChanged(e){let t=this.getViewInfo(e);this.lastViewInfo.isSame(t)||(this.lastViewInfo.update(t),this.workerFunctions.postMessage({type:"viewSizeChanged",payload:t}));}getViewInfo(e){if(e!=null)try{let t=JSON.parse(e.getViewInfo());if(t!=null){let r=this.getOrientationFromNumber(t.orientation);return {...t,orientation:r}}}catch(t){a$3.error("Failed to get view size",t);}return null}getOrientationFromNumber(e){switch(e){case 90:return "landscapeRight";case 180:return "portraitUpsideDown";case 270:return "landscapeLeft";default:return "portrait"}}onBeforeUpdateContextHook(e){return e}onDocumentVisibilityChange(e){e==="hidden"&&this.context.flushAnalytics();}isFeatureSupported(e){return {payload:{supported:this.context.isFeatureSupported(e)}}}getViewfinderInfo(){var e,t;return {payload:{isDisplayingViewfinder:(t=(e=this.view)==null?void 0:e.isDisplayingViewfinder())!=null?t:false,rect:JSON.parse(this.view.getViewfinderRect())}}}getOpenSourceSoftwareLicenseInfo(){return {payload:{licenseText:this.Module.OpenSourceSoftwareLicenseInfo.getLicenseText()}}}getWasmDynamicLibraries(e){return this.getWasmSideModuleFileName()==null?[]:[`${e.replace(/\/[^/]*$/,"/")}${this.getWasmSideModuleFileName()}`]}getWasmCoreExpectedHash(e,t){return t?e?globalThis.SDC_WASM_CORE_MT_SIMD_HASH:globalThis.SDC_WASM_CORE_MT_HASH:e?globalThis.SDC_WASM_CORE_SIMD_HASH:""}getWasmCoreFileName(e,t){return t?e?globalThis.SDC_WASM_CORE_MT_SIMD_FILE_NAME:globalThis.SDC_WASM_CORE_MT_FILE_NAME:e?globalThis.SDC_WASM_CORE_SIMD_FILE_NAME:""}getWasmMetadata(){return globalThis.WASM_METADATA}getWasmSideModuleFileName(){return ""}_loadProgressCallback(e){this.workerFunctions.postMessage({type:"loadLibraryProgress",payload:e});}addRedrawRequest(e){this.redrawRequests.push(Math.round(performance.now())+e),this.redrawRequests.sort((t,r)=>t-r);}contextDidChangeStatus(e){e.code===260?e.message=e.message.replace("domain name",`domain name (${c$1(location)})`):e.code===265&&(e.message=e.message.replace("domain name",`domain name (${this.parentDomain})`)),this.workerFunctions.postMessage({type:"contextDidChangeStatus",payload:e});}didStartObservingContext(){this.workerFunctions.postMessage({type:"didStartObservingContext"});}mapMirrorAxisOnModule(e){switch(e){case "None":return this.Module.Axis.None;case "X":return this.Module.Axis.X;case "Y":return this.Module.Axis.Y;default:return this.Module.Axis.None}}setView(e){this.view=e,this.setViewRefreshHandler(e),e==null&&(this.isDrawLoopRunning=false,this.sendViewRefreshCommands(new Uint8Array([])));}addNativeOverlay(e){a$3.warn("addNativeOverlay has not been implemented for this module",e);}removeNativeOverlay(e){a$3.warn("removeNativeOverlay has not been implemented for this module",e);}setViewRefreshHandler(e){if(e==null||e.isViewRefreshHandlerSet)return;let t=this.Module.NeedsRedrawDelegate.extend("NeedsRedrawDelegate",{setNeedsRedrawIn:this.scheduleRedraw.bind(this,e)}),r=new t;e.setNeedsRedrawDelegate(r),e.isViewRefreshHandlerSet=true;}setupDataDecoding(){let e=this.moduleHandler.get(),t=e.DataDecoding.extend("DataDecoding",{decode(r,i){try{let n=JSON.parse(i),l=[];for(let c of n){let h=new TextDecoder(c.ianaName,{fatal:true});l.push(h.decode(r.slice(c.startIndex,c.endIndex)));}return l.join("")}catch{return ""}}});e.setDataDecoding(new t);}getBatteryData(){var t,r;let e=(r=(t=this.deviceInfo)==null?void 0:t.batteryInfo)==null?void 0:r.percentage;if(e!=null)return {percentage:e}}isTablet(){var e,t;return (t=(e=this.deviceInfo)==null?void 0:e.isTablet)!=null?t:false}setupDeviceInterface(e,t){this.deviceInfo={isTablet:e,batteryInfo:t};let r=this.moduleHandler.get(),i=r.DeviceInterface.extend("DeviceInterface",{getBatteryData:this.getBatteryData.bind(this),isTablet:this.isTablet.bind(this)});this.deviceInstance=new i,r.DeviceHolder.setCurrentDevice(this.deviceInstance);}updateBatteryInfo(e){this.deviceInfo&&(this.deviceInfo.batteryInfo=e);}start(e,t,r){e&&t&&(this.setupDataDecoding(),this.moduleHandler.get().callMain(),this.moduleHandler.get().__emscripten_proxy_main!==void 0||r());}getWritableDataPath(e){return e!=null?(a$3.debug(`IndexedDB database name override in use to recover from blocked standard database: ${e}`),e):this.writableDataPathStandard}numOfMBToPages(e){return Math.ceil(1024*e*1024/64/1024)}async setup({libraryLocation:e,locationPath:t,writableDataPathOverride:r,indexedDBTimeoutMs:i,verifyResponseHash:n,referredOrigin:l,fixedWasmMemory:c,simdSupport:h,threadsSupport:g}){var v;let u=false,p=false;this.writableDataPath=this.getWritableDataPath(r),this.resourcePath=`${e}${this.resourceFilesSubfolder}/`,globalThis.path=t;let{resolve:f,reject:m,promise:C}=new a$5,b=a$6.sdkVersion();if(b==="")throw new a$7({name:"Invalid library version",message:"Library version is not defined or empty, cannot generate proper path to library files."});let y=this.getWasmCoreFileName(h,g),a=d(b,e,y),{jsURI:o,wasmURI:w}=a,W={instantiateWasm:(d,H)=>(a$a({importObject:d,wasmURI:w,expectedHash:this.getWasmCoreExpectedHash(h,g),verifyResponseHash:n,successCallback:H,progressCallback:this._loadProgressCallback,errorCallback:N=>{m(N);},referredOrigin:l}),{})},M=c===null?null:new WebAssembly.Memory({initial:this.numOfMBToPages(c),maximum:this.numOfMBToPages(300),shared:g});return M!==null&&a$3.log(a$3.Level.Debug,"Fixed wasmMemory set",M),this.moduleHandler.set({...M?{wasmMemory:M}:{},mainScriptUrlOrBlob:o,canvas:(v=this.workerFunctions.getOffscreenCanvas())!=null?v:{getContext:()=>null},...W,dynamicLibraries:this.getWasmDynamicLibraries(w),locateFile:d=>e+d,noInitialRun:true,preRun:[async()=>{try{await a$8({writableDataPath:this.writableDataPath,indexedDBTimeoutMs:i});}catch(d){if(d.name==="BlockedIndexedDB"){m(d.toString());return}a$3.log(a$3.Level.Debug,"No IndexedDB support, some data will not be persisted:",d);}p=true,this.start(p,u,f);}],onMainComplete:()=>{if([u,p].includes(false)){a$3.log(a$3.Level.Warn,{runtimeLoaded:u,fileSystemSynced:p},"Both runtimeLoaded and fileSystemSynced should be true when calling onMainComplete"),m("onMainComplete has been called but runtime or file system was not ready.");return}f();},onRuntimeInitialized:()=>{u=true,this.start(p,u,f);},print:d=>{a$3.info(d);}}),await a$9(o,b)||m(`Couldn't retrieve Scandit Data Capture library at ${o}, did you configure the path for it correctly?`),C}};P.get3dPartyLicenseKeyMethodName=atob("Z2V0QmxpbmtJZExpY2Vuc2VLZXk=");var V=P;export{V as a};
@@ -0,0 +1,35 @@
1
+ import {a as a$4}from'./chunk-3A7LM5JG.js';import {a}from'./chunk-NQF3GUK2.js';import {a as a$2}from'./chunk-QHBIT2WY.js';import {b,a as a$3}from'./chunk-SK6L34IF.js';import {d}from'./chunk-YUZDO2PC.js';import {b as b$2}from'./chunk-QHBYNYWX.js';import {a as a$6}from'./chunk-ZKROZLQ4.js';import {a as a$9}from'./chunk-E4XJ4GKD.js';import {a as a$b}from'./chunk-QOCHMKNY.js';import {a as a$a}from'./chunk-KAFNKP6O.js';import {b as b$4}from'./chunk-FTD535WI.js';import {a as a$5}from'./chunk-R6E4CT22.js';import {a as a$c}from'./chunk-4BP7D26M.js';import {b as b$1}from'./chunk-YONR3EGV.js';import {a as a$7,b as b$3}from'./chunk-CX2R2XQK.js';import {a as a$1}from'./chunk-XR65N6EG.js';import {a as a$8}from'./chunk-QCZSSQAQ.js';var O=`
2
+ attribute vec2 a_position;
3
+ varying vec2 v_texcoord;
4
+
5
+ void main() {
6
+ gl_Position = vec4(a_position, 0, 1);
7
+ v_texcoord = a_position * 0.5 + 0.5;
8
+ }
9
+ `,U=`
10
+ precision mediump float;
11
+ varying vec2 v_texcoord;
12
+ uniform sampler2D u_texture;
13
+ uniform float x_spacing; // Uniform for x-spacing between pixels
14
+
15
+ // Function to calculate grayscale
16
+ float toGray(vec4 color) {
17
+ return dot(color.rgb, vec3(0.299, 0.587, 0.114));
18
+ }
19
+
20
+ void main() {
21
+ // Sample adjacent pixels with spacing of 1/width
22
+ vec4 a = texture2D(u_texture, v_texcoord + vec2(0.0 * x_spacing, 0.0));
23
+ vec4 b = texture2D(u_texture, v_texcoord + vec2(1.0 * x_spacing, 0.0));
24
+ vec4 c = texture2D(u_texture, v_texcoord + vec2(2.0 * x_spacing, 0.0));
25
+ vec4 d = texture2D(u_texture, v_texcoord + vec2(3.0 * x_spacing, 0.0));
26
+
27
+ // Calculate grayscale values
28
+ float grayscaleA = toGray(a);
29
+ float grayscaleB = toGray(b);
30
+ float grayscaleC = toGray(c);
31
+ float grayscaleD = toGray(d);
32
+
33
+ // Set the final color with grayscale values
34
+ gl_FragColor = vec4(grayscaleA, grayscaleB, grayscaleC, grayscaleD);
35
+ }`,T=class extends a{constructor(t,i){super(t,i);this.colorType="GRAYSCALE";this._useRgbaFallback=false;this._positions=new Float32Array([-1,-1,-1,1,1,-1,1,-1,-1,1,1,1]);this._canvas=document.createElement("canvas");}get _webglContext(){var t;if(!this._ctx){if(this._ctx=(t=this._canvas)==null?void 0:t.getContext("webgl",{antialias:false}),!this._ctx)throw new Error("Cannot get WebGL context");this.setup();}return this._ctx}readFromSource(t){var R,_;let i=(R=t==null?void 0:t.videoWidth)!=null?R:this._contextWebGL.drawingBufferWidth,a=i%4!==0;if(a!==this._useRgbaFallback&&(a?(a$1.debug("[GrayScaleFrameReader] Video width not divisible by 4, falling back to RGBA reader for better performance",{width:i}),this._rgbaFallbackReader||(this._rgbaFallbackReader=new v(this._contextWebGL,{minPoolCapacity:this._minPoolCapacity,maxPoolCapacity:this._maxPoolCapacity}),this._rgbaFallbackReader.setup())):a$1.log(a$1.Level.Info,"[GrayScaleFrameReader] Video width now divisible by 4, using optimized grayscale reader",{width:i}),this._useRgbaFallback=a),this._useRgbaFallback&&this._rgbaFallbackReader)return this._rgbaFallbackReader.readFromSource(t);this.updateCanvasSizeIfNeeded(),this.updateFrameSizeIfNeeded();let{drawingBufferWidth:s,drawingBufferHeight:o,TEXTURE_2D:c,RGBA:d,UNSIGNED_BYTE:l,TRIANGLES:p}=this._webglContext;this._webglContext.viewport(0,0,s,o);let b=this._webglContext.getUniformLocation(this._shaderProgram,"x_spacing"),u=1/i;this._webglContext.uniform1f(b,u),this._webglContext.texImage2D(c,0,d,d,l,t),this._webglContext.drawArrays(p,0,6);let h=(_=this._framePool)==null?void 0:_.pop();if(!h)throw new Error("Frame pool found empty!");let g=s*o*4;return h.length!==g&&(a$1.warn("[GrayScaleFrameReader] Buffer from pool has wrong size, allocating new one",{bufferLength:h.length,requiredSize:g}),h=new Uint8ClampedArray(g)),this._webglContext.readPixels(0,0,s,o,d,l,h),{width:i,height:o,data:new Uint8ClampedArray(h.buffer,0,i*o),frameId:E(),colorType:"GRAYSCALE"}}setup(){this.initShaderProgram(),this.initBuffers(),this.initTexture();}dispose(){var t;this._ctx&&(this._shaderProgram&&(this._ctx.deleteProgram(this._shaderProgram),this._shaderProgram=null),this._positionBuffer&&(this._ctx.deleteBuffer(this._positionBuffer),this._positionBuffer=null),this._texture&&(this._ctx.deleteTexture(this._texture),this._texture=null),this._ctx=null),this._rgbaFallbackReader&&(this._rgbaFallbackReader.dispose(),this._rgbaFallbackReader=null),(t=this._framePool)==null||t.empty(),this._canvas=void 0;}updateCanvasSizeIfNeeded(){if(!this._canvas)return;let t=Math.ceil(this._contextWebGL.drawingBufferWidth/4);(this._canvas.width!==t||this._canvas.height!==this._contextWebGL.drawingBufferHeight)&&(this._canvas.width=t,this._canvas.height=this._contextWebGL.drawingBufferHeight);}updateFrameSizeIfNeeded(){let{drawingBufferWidth:t,drawingBufferHeight:i}=this._webglContext,a=t*i*4;this._frameSize!==a&&(this._frameSize=a,this._framePool&&this._framePool.empty(),this._framePool=new a$2({capacity:this._maxPoolCapacity,lowWaterMark:this._minPoolCapacity,createItem:()=>new Uint8ClampedArray(this._frameSize)}));}initShaderProgram(){let t=b(this._webglContext,this._webglContext.VERTEX_SHADER,O),i=b(this._webglContext,this._webglContext.FRAGMENT_SHADER,U);if(!t||!i)throw new Error("Shaders cannot be created");this._shaderProgram=a$3(this._webglContext,t,i),this._webglContext.useProgram(this._shaderProgram);}initBuffers(){this._positionBuffer=this._webglContext.createBuffer(),this._webglContext.bindBuffer(this._webglContext.ARRAY_BUFFER,this._positionBuffer),this._webglContext.bufferData(this._webglContext.ARRAY_BUFFER,this._positions,this._webglContext.STATIC_DRAW);let t=this._webglContext.getAttribLocation(this._shaderProgram,"a_position");this._webglContext.enableVertexAttribArray(t),this._webglContext.bindBuffer(this._webglContext.ARRAY_BUFFER,this._positionBuffer),this._webglContext.vertexAttribPointer(t,2,this._webglContext.FLOAT,false,0,0);}initTexture(){this._texture=this._webglContext.createTexture(),this._webglContext.bindTexture(this._webglContext.TEXTURE_2D,this._texture),this._webglContext.texParameteri(this._webglContext.TEXTURE_2D,this._webglContext.TEXTURE_WRAP_S,this._webglContext.CLAMP_TO_EDGE),this._webglContext.texParameteri(this._webglContext.TEXTURE_2D,this._webglContext.TEXTURE_WRAP_T,this._webglContext.CLAMP_TO_EDGE),this._webglContext.texParameteri(this._webglContext.TEXTURE_2D,this._webglContext.TEXTURE_MIN_FILTER,this._webglContext.LINEAR),this._webglContext.texParameteri(this._webglContext.TEXTURE_2D,this._webglContext.TEXTURE_MAG_FILTER,this._webglContext.LINEAR);let t=this._webglContext.getUniformLocation(this._shaderProgram,"u_texture");this._webglContext.uniform1i(t,0);}};var H=(a=>(a.CONTINUOUS="continuous",a.MANUAL="manual",a.NONE="none",a.SINGLE_SHOT="single-shot",a))(H||{}),Z=(s=>(s[s.ULTRA_HD=0]="ULTRA_HD",s[s.FULL_HD=1]="FULL_HD",s[s.HD=2]="HD",s[s.SD=3]="SD",s[s.NONE=4]="NONE",s))(Z||{});function E(){return a$4()}var X=(t=>(t.CAMERA_PROPERTIES="cameraProperties",t.CAMERA_ACCESS_ERROR="cameraAccessError",t))(X||{}),n=class n{constructor(){this.constraint=4;this.checkCameraVideoStreamAccessIfVisibleListener=this.checkCameraVideoStreamAccessIfVisible.bind(this);this.handleWebGLContextLostListener=this.handleWebGLContextLost.bind(this);this.listeners=new Map;this.mirrorImageOverrides=new Map;this.postStreamInitializationListener=this.postStreamInitialization.bind(this);this.triggerManualFocusListener=this.triggerManualFocus.bind(this);this.triggerZoomMoveListener=this.triggerZoomMove.bind(this);this.triggerZoomStartListener=this.triggerZoomStart.bind(this);this.videoResizeListener=a$5(this.handleVideoResize.bind(this),500);this.videoTrackEndedListener=this.videoTrackEndedRecovery.bind(this);this.videoTrackMuteListener=this.videoTrackMuteRecovery.bind(this);this._synchronousFrameHandling=false;this._glFrameReaders={GRAYSCALE:null,RGBA:null};this._frameReaderType="RGBA";this.isVideoStreamPaused=false;this.handleVideoPauseHandler=this.handleVideoPause.bind(this);this.cameraPosition="worldFacing",this.gui={isCameraRecoveryVisible:()=>false,setCameraRecoveryVisible:()=>{}},this.isWebGLSupported=!b$1.checkBrowserCompatibility().missingFeatures.includes("webGL"),this.videoElement=document.createElement("video"),this.videoElement.autoplay=true,this.videoElement.playsInline=true,this.videoElement.muted=true,this.videoElement.style.opacity="0",this.videoElement.poster=a$6,this.canvas=document.createElement("canvas"),this.canvas.addEventListener("webglcontextlost",this.handleWebGLContextLostListener);}get mediaStream(){return this._mediaStream}set mediaStream(e){this._mediaStream=e,e&&(this.mediaTrackCapabilitiesPromise=new Promise(t=>{this.mediaTrackCapabilitiesPromiseResolver=t;}));}get synchronousFrameHandling(){return this._synchronousFrameHandling}get canvas2dContext(){return this._canvas2dContext||(this._canvas2dContext=this.canvas.getContext("2d",{willReadFrequently:true}),this._canvas2dContext==null&&a$1.warn("Unable to get 2d canvas context"),this.handleVideoResize()),this._canvas2dContext}get canvasWebGLContext(){var e;if(!this._canvas2dContext&&!this._canvasWebGLContext){if(!this.isWebGLSupported){a$1.warn("WebGL context not supported, falling back to 2d canvas context. This may impact the scanning performance.");return}let t=(e=this.canvas.getContext("webgl",{alpha:false,antialias:false}))!=null?e:this.canvas.getContext("experimental-webgl",{alpha:false,antialias:false});t!=null&&(this._canvasWebGLContext=t,this.handleVideoResize());}return this._canvasWebGLContext}static instance(){return n._instance==null&&(n._instance=new n),n._instance}dispose(){b$2.clear(),n._instance=null;}recycle(e){var t;(t=this.getFrameReader())==null||t.recycle(e);}getCurrentFrame(){var e;return (e=this._glFrameReaders.RGBA)==null?void 0:e.readFromSource(this.videoElement)}requestVideoFrame(e,t=this.videoElement){return "requestVideoFrameCallback"in HTMLVideoElement.prototype?t.requestVideoFrameCallback(e):a$7(e)}cancelVideoFrame(e,t=this.videoElement){if("cancelVideoFrameCallback"in HTMLVideoElement.prototype){t.cancelVideoFrameCallback(e);return}b$3(e);}addListener(e,t){var a;let i=(a=this.listeners.get(e))!=null?a:[];i.includes(t)||this.listeners.set(e,[...i,t]);}async applyCameraSettings(e){if(this.selectedCameraSettings=e,this.activeCamera==null)throw new a$8(n.noCameraErrorParameters);return this.initializeCameraWithSettings(this.activeCamera,e)}captureImage(){var e;if(((e=this.mediaStream)==null?void 0:e.active)!=null){if(this.canvasWebGLContext!=null)return this.captureImageForWebGLContext();if(this.canvas2dContext!=null)return this.captureImageFor2dContext()}return null}async initializeCameraWithSettings(e,t){if(this.cameraInitializationPromise&&await this.cameraInitializationPromise,e==null)throw new a$8(n.noCameraErrorParameters);return this.setSelectedCamera(e),this.selectedCameraSettings=t,this.activeCameraSettings=t,this.cameraInitializationPromise=this.initializeCameraAndCheckUpdatedSettings(e),this.cameraInitializationPromise}isMirrorImageEnabled(){if(this.selectedCamera&&this.activeCamera){let e=this.mirrorImageOverrides.get(this.activeCamera);return e!=null?e:this.activeCamera.position==="userFacing"}return false}isPinchToZoomEnabled(){return this.pinchToZoomEnabled}isTapToFocusEnabled(){return this.tapToFocusEnabled}async isTorchAvailable(){var e;return this.mediaStream?(await this.waitForCapabilities(),((e=this.mediaTrackCapabilities)==null?void 0:e.torch)===true):false}async playVideo(){return new Promise(e=>{this._canvas2dContext&&this._canvas2dContext.clearRect(0,0,this.canvas.width,this.canvas.height);let t=this.videoElement.play();t==null?e():t.then(e).catch(()=>{e();});})}async reinitializeCamera(){if(this.activeCamera==null)a$1.debug("Camera reinitialization delayed");else {a$1.debug("Reinitialize camera:",this.activeCamera);try{let e=this.activeCamera;await this.stopStream(),await this.initializeCameraWithSettings(e,this.activeCameraSettings);}catch(e){throw a$1.warn("Couldn't access camera:",this.activeCamera,e),this.emit("cameraAccessError",e),e}}}removeListener(e,t){var s;let a=((s=this.listeners.get(e))!=null?s:[]).filter(o=>o!==t);this.listeners.set(e,a);}async setCameraPosition(e){var i;this.setInitialCameraPosition(e);let t=d.getMainCameraForPosition(await d.getCameras(),e);if(t&&t.deviceId!==((i=this.selectedCamera)==null?void 0:i.deviceId))return this.initializeCameraWithSettings(t,this.selectedCameraSettings)}async setExposure(e){var a,s,o,c,d,l,p,b;let t=(s=(a=this.mediaStream)==null?void 0:a.getVideoTracks())!=null?s:[];if(t.length===0||typeof t[0].applyConstraints!="function")return;await this.waitForCapabilities();let i=e.time!=null&&e.time>0?"manual":"continuous";if(((c=(o=this.mediaTrackCapabilities)==null?void 0:o.exposureMode)==null?void 0:c.includes(i))===true){if(await t[0].applyConstraints({advanced:[{exposureMode:i}]}),e.time!=null&&e.time>0&&this.mediaTrackCapabilities.exposureTime){let u=Math.max((d=this.mediaTrackCapabilities.exposureTime.min)!=null?d:.01,Math.min(e.time,(l=this.mediaTrackCapabilities.exposureTime.max)!=null?l:1e5));await t[0].applyConstraints({advanced:[{exposureTime:u}]});}else if(e.compensation!=null&&i==="continuous"&&this.mediaTrackCapabilities.exposureCompensation){let u=Math.max((p=this.mediaTrackCapabilities.exposureCompensation.min)!=null?p:-10,Math.min(e.compensation,(b=this.mediaTrackCapabilities.exposureCompensation.max)!=null?b:10));await t[0].applyConstraints({advanced:[{exposureCompensation:u}]});}}}async setFocus(e){var i,a,s,o,c;if(!this.mediaStream)return;let t=this.mediaStream.getVideoTracks();if(t.length>0&&typeof t[0].applyConstraints=="function"){await this.waitForCapabilities();let d=e>=0?"manual":"continuous";if(((a=(i=this.mediaTrackCapabilities)==null?void 0:i.focusMode)==null?void 0:a.includes(d))===true&&(await t[0].applyConstraints({advanced:[{focusMode:d}]}),d==="manual"&&this.mediaTrackCapabilities.focusDistance)){let l=Math.max(0,Math.min(e,1))*(((s=this.mediaTrackCapabilities.focusDistance.max)!=null?s:1e3)-((o=this.mediaTrackCapabilities.focusDistance.min)!=null?o:.01))+((c=this.mediaTrackCapabilities.focusDistance.min)!=null?c:.01);await t[0].applyConstraints({advanced:[{focusDistance:l}]});}}}async setFrameRate(e){var t,i,a;if(this.mediaStream&&(await this.waitForCapabilities(),(t=this.mediaTrackCapabilities)!=null&&t.frameRate)){let s=this.mediaStream.getVideoTracks();if(s.length>0&&typeof s[0].applyConstraints=="function"){let o=Math.min((i=this.mediaTrackCapabilities.frameRate.max)!=null?i:240,(a=e.max)!=null?a:240);await s[0].applyConstraints({advanced:[{frameRate:o}]});}}}setInitialCameraPosition(e){this.cameraPosition=e;}setInteractionOptions(e,t,i){this.torchToggleEnabled=e,this.tapToFocusEnabled=t,this.pinchToZoomEnabled=i;}setMirrorImageEnabled(e,t){this.selectedCamera&&(e?(this.videoElement.classList.add(n.MIRRORED_CLASS_NAME),this.canvas.classList.add(n.MIRRORED_CLASS_NAME)):(this.videoElement.classList.remove(n.MIRRORED_CLASS_NAME),this.canvas.classList.remove(n.MIRRORED_CLASS_NAME)),t&&this.mirrorImageOverrides.set(this.selectedCamera,e));}setPinchToZoomEnabled(e){this.pinchToZoomEnabled=e,this.mediaStream&&(this.pinchToZoomEnabled?this.enablePinchToZoomListeners():this.disablePinchToZoomListeners());}setSelectedCamera(e){this.selectedCamera=e;}setSelectedCameraSettings(e){this.selectedCameraSettings=e;}setTapToFocusEnabled(e){this.tapToFocusEnabled=e,this.mediaStream&&(this.tapToFocusEnabled?this.enableTapToFocusListeners():this.disableTapToFocusListeners());}async setTorchEnabled(e){var t;if(this.mediaStream&&((t=this.mediaTrackCapabilities)==null?void 0:t.torch)===true){this.torchEnabled=e;let i=this.mediaStream.getVideoTracks();i.length>0&&typeof i[0].applyConstraints=="function"&&await i[0].applyConstraints({advanced:[{torch:e}]});}}async setZoom(e){var t,i,a;if(this.mediaStream&&(await this.waitForCapabilities(),(t=this.mediaTrackCapabilities)!=null&&t.zoom)){let s=this.mediaStream.getVideoTracks();if(s.length>0&&typeof s[0].applyConstraints=="function"){let o=Math.max((i=this.mediaTrackCapabilities.zoom.min)!=null?i:1,Math.min(e,(a=this.mediaTrackCapabilities.zoom.max)!=null?a:16));await s[0].applyConstraints({advanced:[{zoom:o}]});}}}async setupCameras(){if(this.cameraSetupPromise)return this.cameraSetupPromise;let e=this.isVideoStreamPaused;return this.cameraSetupPromise=this.setupCamerasAndStream(),this.cameraSetupPromise.then(()=>{e||(this.isVideoStreamPaused=false);})}pauseStream(){if(this.mediaStream){for(let e of this.mediaStream.getVideoTracks())e.enabled=false;this.isVideoStreamPaused=true,a$1.debug("Paused camera video stream",this.mediaStream);}}resumeStream(){if(this.mediaStream){for(let e of this.mediaStream.getVideoTracks())e.enabled=true;this.isVideoStreamPaused=false,a$1.debug("Resumed camera video stream",this.mediaStream);}}async stopStream(e=false){this.activeCamera&&(this.activeCamera.currentResolution=void 0),this.activeCamera=void 0,this.torchEnabled=false,this.isVideoStreamPaused=false,this.mediaStream&&(a$1.debug(`Stop camera video stream access${e?" (abort access detection)":""}:`,this.mediaStream),a$1.debug("Stopping camera video stream access",this.mediaStream),document.removeEventListener("visibilitychange",this.checkCameraVideoStreamAccessIfVisibleListener),window.clearTimeout(this.cameraAccessTimeout),window.clearInterval(this.videoMetadataCheckInterval),window.clearTimeout(this.getCapabilitiesTimeout),window.clearTimeout(this.manualFocusWaitTimeout),window.clearTimeout(this.manualToAutofocusResumeTimeout),window.clearInterval(this.autofocusInterval),this.videoElement.pause(),await new Promise(t=>{setTimeout(()=>{var i,a,s;for(let o of (a=(i=this.mediaStream)==null?void 0:i.getVideoTracks())!=null?a:[])o.removeEventListener("ended",this.videoTrackEndedListener),o.stop();this.videoElement.srcObject=null,this._canvas2dContext&&this._canvas2dContext.clearRect(0,0,this.canvas.width,this.canvas.height),this.mediaStream=void 0,this.mediaTrackCapabilities=void 0,this.mediaTrackCapabilitiesPromise=void 0,this.mediaTrackCapabilitiesPromiseResolver=void 0,e||(s=this.abortedCameraInitializationResolveCallback)==null||s.call(this),t();},0);}));}stopVideoTracks(){if(this.mediaStream!=null)for(let e of this.mediaStream.getVideoTracks())e.stop();}async toggleTorch(){this.torchEnabled=!this.torchEnabled,await this.setTorchEnabled(this.torchEnabled);}updateCanvasVideoImage(){this.canvas2dContext.drawImage(this.videoElement,0,0);}async waitForCapabilities(){var e;return (e=this.mediaTrackCapabilitiesPromise)!=null?e:Promise.resolve()}setFrameReaderType(e){e!==this._frameReaderType&&(this._frameReaderType=e,a$1.log(a$1.Level.Debug,`Change frame reader type to ${this._frameReaderType} mode`));}async allowPictureInPicture(e){e?(this.videoElement.disablePictureInPicture=false,this.videoElement.removeAttribute("controlslist"),this.videoElement.removeAttribute("disablepictureinpicture")):(this.videoElement.disablePictureInPicture=true,this.videoElement.setAttribute("controlslist","nodownload"),this.videoElement.setAttribute("disablepictureinpicture","true")),await this.reinitializeCamera();}setFrameHandling(e){var t;this._synchronousFrameHandling=e,this._frameReaderOptions=this.getFrameReaderOptions(e),(t=this._glFrameReaders[this._frameReaderType])==null||t.dispose(),delete this._glFrameReaders[this._frameReaderType];}async setClipArea(e){if(this.activeCamera&&this.isVideoAndContextStateValid()){this.clipArea=e?this.frameRectFromViewRect(e):void 0,await this.initializeStreamForResolution(this.activeCamera,this.constraint,this.isVideoStreamPaused);return}this.clipArea=e;}frameRectFromViewRect(e){let t=this.videoElement.videoWidth/this.videoElement.clientWidth||1,i=this.videoElement.videoHeight/this.videoElement.clientHeight||1;return new a$9(new a$a(e.origin.x*t,e.origin.y*i),new a$b(e.size.width*t,e.size.height*i))}async accessAutoselectedCamera(e){let t=d.sortCamerasForCameraPosition(e,this.cameraPosition),i=t.shift();for(;i;)try{await this.initializeCameraWithSettings(i,this.selectedCameraSettings);return}catch(a){if(this.setSelectedCamera(),t.length>0){a$1.log(a$1.Level.Warn,"Couldn't access camera:",i,a),i=t.shift();continue}throw a}throw new a$8(n.noCameraErrorParameters)}getFrameReaderOptions(e){return e?{minPoolCapacity:0,maxPoolCapacity:1}:b$1.isDesktopDevice()?{maxPoolCapacity:2,minPoolCapacity:1}:{maxPoolCapacity:10,minPoolCapacity:3}}getFrameReader(){var t;if(this._glFrameReaders[this._frameReaderType])return this._glFrameReaders[this._frameReaderType];if(!this._canvasWebGLContext)return null;let e=(t=this._frameReaderOptions)!=null?t:this.getFrameReaderOptions(this._synchronousFrameHandling);switch(this._frameReaderType){case "GRAYSCALE":{this._glFrameReaders.GRAYSCALE=new T(this._canvasWebGLContext,e),this._glFrameReaders.RGBA=new v(this._canvasWebGLContext,{minPoolCapacity:1,maxPoolCapacity:2});break}case "RGBA":{this._glFrameReaders.RGBA=new v(this._canvasWebGLContext,e);break}default:b$4(this._frameReaderType);}return a$1.debug(`Created frame reader ${this._frameReaderType}`,e),this._glFrameReaders[this._frameReaderType]}async accessInitialCamera(){let e={position:this.cameraPosition,deviceId:"",label:""};try{await this.initializeCameraWithSettings(e,this.selectedCameraSettings);}catch{}finally{this.setSelectedCamera();}return e}recreateCanvas(){this.canvas.removeEventListener("webglcontextlost",this.handleWebGLContextLostListener),this._canvasWebGLContext=void 0,this._canvas2dContext=void 0;for(let t of Object.values(this._glFrameReaders))t==null||t.dispose();let e=document.createElement("canvas");e.addEventListener("webglcontextlost",this.handleWebGLContextLostListener),e.width=this.canvas.width,e.height=this.canvas.height,e.className=this.canvas.className,this.canvas=e;}captureImageFor2dContext(){if(!this.isVideoAndContextStateValid())return null;let{width:e,height:t}=this.canvas,i=E();return {colorType:"RGBA",data:this.canvas2dContext.getImageData(0,0,e,t).data,frameId:i,width:e,height:t}}areVideoAndWebGLSizeMismatching(){return this.canvasWebGLContext?this.canvasWebGLContext.drawingBufferWidth!==this.videoElement.videoWidth||this.canvasWebGLContext.drawingBufferHeight!==this.videoElement.videoHeight:true}captureImageForWebGLContext(){if(!this.isVideoAndContextStateValid()||!this.canvasWebGLContext||this.canvasWebGLContext.drawingBufferWidth<=2||this.canvasWebGLContext.drawingBufferHeight<=2||this.areVideoAndWebGLSizeMismatching()||this.getFrameReader()==null)return null;let e=this.getFrameReader().readFromSource(this.videoElement);if(e.data[3]!==255&&e.colorType==="RGBA"){if(a$1.log(a$1.Level.Warn,"Detected incorrect GPU accelerated WebGL image processing, switching to canvas mode"),this.recreateCanvas(),this.canvas2dContext==null)throw new Error("Unable to get 2d canvas context");return this.captureImage()}return e}async checkCameraAccess(e){return new Promise((t,i)=>{this.cameraAccessRejectCallback=a=>{a$1.log(a$1.Level.Debug,"Camera video stream access failure (video data load timeout):",e),this.gui.setCameraRecoveryVisible(true),i(a);},this.setCameraAccessTimeout();})}checkCameraVideoStreamAccessIfVisible(){document.visibilityState==="visible"&&(a$1.debug("Page is visible again, waiting for camera video stream start..."),document.removeEventListener("visibilitychange",this.checkCameraVideoStreamAccessIfVisibleListener),this.setCameraAccessTimeout());}async checkVideoMetadata(e){return new Promise((t,i)=>{this.videoElement.onloadeddata=()=>{if(this.videoElement.onloadeddata=null,window.clearTimeout(this.cameraAccessTimeout),this.videoElement.videoWidth>2&&this.videoElement.videoHeight>2&&this.videoElement.currentTime>0){this.updateActiveCameraCurrentResolution(e),a$1.log(a$1.Level.Debug,"Camera video stream access success:",e),t();return}let a=performance.now();window.clearInterval(this.videoMetadataCheckInterval),this.videoMetadataCheckInterval=window.setInterval(async()=>{if(this.videoElement.videoWidth<=2||this.videoElement.videoHeight<=2||this.videoElement.currentTime===0){if(performance.now()-a>n.videoMetadataCheckTimeoutMs){a$1.log(a$1.Level.Warn,"Camera video stream access failure (valid video metadata timeout):",e),window.clearInterval(this.videoMetadataCheckInterval),await this.stopStream(true),i(new a$8(n.notReadableErrorParameters));return}return}window.clearInterval(this.videoMetadataCheckInterval),this.updateActiveCameraCurrentResolution(e),a$1.log(a$1.Level.Debug,"Camera video stream access success:",e),t();},n.videoMetadataCheckIntervalMs);};})}disablePinchToZoomListeners(){this.videoElement.removeEventListener("touchstart",this.triggerZoomStartListener),this.videoElement.removeEventListener("touchmove",this.triggerZoomMoveListener);}disableTapToFocusListeners(){for(let e of ["touchend","mousedown"])this.videoElement.removeEventListener(e,this.triggerManualFocusListener);}emit(e,t){var a;let i=(a=this.listeners.get(e))!=null?a:[];for(let s of i)s(t);}enablePinchToZoomListeners(){this.videoElement.addEventListener("touchstart",this.triggerZoomStartListener),this.videoElement.addEventListener("touchmove",this.triggerZoomMoveListener);}enableTapToFocusListeners(){for(let e of ["touchend","mousedown"])this.videoElement.addEventListener(e,this.triggerManualFocusListener);}getActiveCamera(e,t,i){return e.length===1?e[0]:e.find(a=>a.deviceId===i||a.label!==""&&a.label===t)}getInitialCameraResolutionConstraint(e){var i;let t;switch((i=this.activeCameraSettings)==null?void 0:i.preferredResolution){case "uhd4k":{t=0;break}case "fullHd":{t=1;break}default:{t=2;break}}return t}async handleCameraInitializationError(e,t,i){if(!["OverconstrainedError","NotReadableError"].includes(i.name)||i.name==="NotReadableError"&&t===4)throw a$1.log(a$1.Level.Debug,"Camera video stream access failure (unrecoverable error)",e,i),i.name!=="NotAllowedError"&&d.markCameraAsInaccessible(e),i;if(i.name==="OverconstrainedError"&&t===4){if(e.deviceId==="")throw a$1.log(a$1.Level.Warn,"Camera video stream access failure (no camera with such type error)",e,i),i;a$1.log(a$1.Level.Warn,"Detected non-existent deviceId error, attempt to find and reaccess updated camera",e,i);let a=e.deviceId;if(await d.getCameras(true),a===e.deviceId)throw a$1.log(a$1.Level.Warn,"Camera video stream access failure (updated camera not found after non-existent deviceId error)",e,i),d.markCameraAsInaccessible(e),i;return a$1.log(a$1.Level.Warn,"Updated camera found (recovered from non-existent deviceId error), attempt to access it",e),this.initializeCameraForResolution(e)}return this.initializeCameraForResolution(e,t+1)}handleVideoResize(){if(!(this.videoElement.videoWidth<=2||this.videoElement.videoHeight<=2)){if(this.activeCamera&&this.updateActiveCameraCurrentResolution(this.activeCamera),this.canvasWebGLContext!=null){if(this.canvas.width===this.videoElement.videoWidth&&this.canvas.height===this.videoElement.videoHeight)return;this.canvas.width=this.videoElement.videoWidth,this.canvas.height=this.videoElement.videoHeight,this.canvasWebGLContext.viewport(0,0,this.canvasWebGLContext.drawingBufferWidth,this.canvasWebGLContext.drawingBufferHeight);}else if(this.canvas2dContext!=null){if(this.canvas.width===this.videoElement.videoWidth&&this.canvas.height===this.videoElement.videoHeight)return;this.canvas.width=this.videoElement.videoWidth,this.canvas.height=this.videoElement.videoHeight;}}}handleWebGLContextLost(){a$1.log(a$1.Level.Warn,"WebGL context has been lost, restoring..."),this._canvasWebGLContext=void 0,this.canvasWebGLContext?(this.handleVideoResize(),a$1.log(a$1.Level.Warn,"WebGL context restored")):a$1.log(a$1.Level.Error,"WebGL context restore failed");}async initializeCameraAndCheckUpdatedSettings(e){var t,i,a,s,o;try{if(await this.initializeCameraForResolution(e),this.selectedCameraSettings!==this.activeCameraSettings&&(this.selectedCameraSettings==null||this.activeCameraSettings==null||Object.keys(this.selectedCameraSettings).some(u=>{var h,g;return ((h=this.selectedCameraSettings)==null?void 0:h[u])!==((g=this.activeCameraSettings)==null?void 0:g[u])}))){this.activeCameraSettings=this.selectedCameraSettings,await this.initializeCameraAndCheckUpdatedSettings(e);return}this.activeCameraSettings&&this.activeCameraSettings.zoomFactor>1&&await this.setZoom(this.activeCameraSettings.zoomFactor);let c=(t=this.activeCameraSettings)==null?void 0:t.getProperty("minFrameRate"),d=(i=this.activeCameraSettings)==null?void 0:i.getProperty("maxFrameRate");(c!=null||d!=null)&&await this.setFrameRate({min:c,max:d});let l=(a=this.activeCameraSettings)==null?void 0:a.getProperty("manualLensPosition");l!=null&&await this.setFocus(l);let p=(s=this.activeCameraSettings)==null?void 0:s.getProperty("exposureTargetBias"),b=(o=this.activeCameraSettings)==null?void 0:o.getProperty("exposureDuration");(p!=null||b!=null)&&await this.setExposure({compensation:p,time:b});}finally{this.cameraInitializationPromise=void 0;}}async initializeCameraForResolution(e,t){var i;this.gui.setCameraRecoveryVisible(false),this.constraint=t!=null?t:this.getInitialCameraResolutionConstraint(e),this.mediaStream!=null&&e.deviceId!==""&&((i=this.activeCamera)==null?void 0:i.deviceId)===e.deviceId?await(b$1.isIPhone()?this.initializeStreamForResolution(e,this.constraint):this.updateStreamForResolution(e,this.constraint)):await this.initializeStreamForResolution(e,this.constraint);}async initializeStreamForResolution(e,t,i=false){var a;await this.stopStream();try{let s=(a=this.activeCameraSettings)==null?void 0:a.getProperty("preferredAspectRatio"),o=await d.accessCameraStream(e,t,s),c=await this.clipMediaStreamIfNeeded(o);if(a$1.log(a$1.Level.Debug,"Camera accessed, waiting for camera video stream start..."),typeof c.getVideoTracks()[0].getSettings=="function"){let d=c.getVideoTracks()[0].getSettings();if(d.width!=null&&d.height!=null&&(d.width===2||d.height===2)){if(a$1.log(a$1.Level.Debug,"Camera video stream access failure (invalid video metadata):",e),t===4)throw new a$8(n.notReadableErrorParameters);return await this.stopStream(),this.initializeStreamForResolution(e,t+1)}}this.mediaStream=c,i&&this.pauseStream();for(let d of this.mediaStream.getVideoTracks())d.addEventListener("ended",this.videoTrackEndedListener),d.addEventListener("mute",this.videoTrackMuteListener),d.addEventListener("unmute",this.videoTrackMuteListener);try{await this.setupCameraStreamVideo(e,c);}catch(d){if(t===4)throw d;return this.initializeStreamForResolution(e,t+1)}}catch(s){return this.handleCameraInitializationError(e,t,s)}}isVideoAndContextStateValid(){return this.videoElement.readyState===4&&this.videoElement.videoWidth>2&&this.videoElement.videoHeight>2&&this.canvas.width>2&&this.canvas.height>2}postStreamInitialization(){window.clearTimeout(this.getCapabilitiesTimeout),this.getCapabilitiesTimeout=window.setTimeout(()=>{this.storeStreamCapabilities(),this.setupAutofocus();},n.getCapabilitiesTimeoutMs);}async recoverStreamIfNeeded(){var t,i;let e=(t=this.mediaStream)==null?void 0:t.getVideoTracks();((i=e==null?void 0:e[0])==null?void 0:i.readyState)==="ended"&&await this.reinitializeCamera();}reportCameraProperties(e,t,i=true){this.emit("cameraProperties",{deviceId:e,isFrontFacing:t==="userFacing",hasAutofocus:i});}setCameraAccessTimeout(){window.clearTimeout(this.cameraAccessTimeout),this.cameraAccessTimeout=window.setTimeout(async()=>{var e;document.visibilityState==="visible"?(await this.stopStream(true),(e=this.cameraAccessRejectCallback)==null||e.call(this,new a$8(n.notReadableErrorParameters))):(a$1.debug("Page is currently not visible, delay camera video stream access detection"),document.addEventListener("visibilitychange",this.checkCameraVideoStreamAccessIfVisibleListener));},n.cameraAccessTimeoutMs);}setupAutofocus(){if(window.clearTimeout(this.manualFocusWaitTimeout),window.clearTimeout(this.manualToAutofocusResumeTimeout),this.mediaStream&&this.mediaTrackCapabilities){let e=this.mediaTrackCapabilities.focusMode;Array.isArray(e)&&!e.includes("continuous")&&e.includes("single-shot")&&(window.clearInterval(this.autofocusInterval),this.autofocusInterval=window.setInterval(this.triggerAutoFocus.bind(this),n.autofocusIntervalMs));}}async setupCameraStreamVideo(e,t){this.videoElement.addEventListener("loadedmetadata",this.postStreamInitializationListener),this.videoElement.addEventListener("resize",this.videoResizeListener),this.tapToFocusEnabled&&this.enableTapToFocusListeners(),this.pinchToZoomEnabled&&this.enablePinchToZoomListeners();let i=Promise.race([this.checkCameraAccess(e),this.checkVideoMetadata(e),new Promise(a=>{this.abortedCameraInitializationResolveCallback=a;})]);return this.videoElement.srcObject=t,this.videoElement.load(),await this.playVideo(),this.handleVideoResize(),this.reportCameraProperties(e.deviceId,e.position),i}async setupCamerasAndStream(){var e,t;try{let i;this.selectedCamera==null&&(i=await this.accessInitialCamera());let a=await d.getCameras(false,true),s=(t=(e=this.mediaStream)==null?void 0:e.getVideoTracks()[0])==null?void 0:t.getSettings().deviceId;if(this.mediaStream&&i){let o=this.getActiveCamera(a,i.label,s);if(o){if(d.adjustCameraFromMediaStream(this.mediaStream,o),b$1.isDesktopDevice()&&(d.setMainCameraForPositionOverridesOnDesktop(this.cameraPosition,o),d.setMainCameraForPositionOverridesOnDesktop(o.position,o)),a.length===1||d.getMainCameraForPosition(a,this.cameraPosition)===o){a$1.debug("Initial camera access was correct (main camera), keep camera:",o),this.setSelectedCamera(o),this.updateActiveCameraCurrentResolution(o),await this.recoverStreamIfNeeded();return}a$1.debug("Initial camera access was incorrect (not main camera), change camera",{...i,deviceId:s});}else a$1.debug("Initial camera access was incorrect (unknown camera), change camera",{...i,deviceId:s});}if(this.selectedCamera==null){await this.accessAutoselectedCamera(a);return}await this.initializeCameraWithSettings(this.selectedCamera,this.selectedCameraSettings);}finally{this.cameraSetupPromise=void 0;}}storeStreamCapabilities(){var e;if(this.mediaStream){let t=this.mediaStream.getVideoTracks();t.length>0&&typeof t[0].getCapabilities=="function"&&(this.mediaTrackCapabilities=t[0].getCapabilities()),this.mediaTrackCapabilitiesPromiseResolver&&this.mediaTrackCapabilitiesPromiseResolver();}this.activeCamera&&this.reportCameraProperties(this.activeCamera.deviceId,this.activeCamera.position,((e=this.mediaTrackCapabilities)==null?void 0:e.focusMode)==null||this.mediaTrackCapabilities.focusMode.includes("continuous"));}async triggerAutoFocus(){await this.triggerFocusMode("single-shot");}async triggerFocusMode(e){if(this.mediaStream){let t=this.mediaStream.getVideoTracks();if(t.length>0&&typeof t[0].applyConstraints=="function")try{await t[0].applyConstraints({advanced:[{focusMode:e}]});}catch{}}}async triggerManualFocus(e){if(e){if(e.preventDefault(),e.type==="touchend"&&e.touches.length>0)return;if(this.pinchToZoomDistance!=null){this.pinchToZoomDistance=void 0;return}}if(window.clearTimeout(this.manualFocusWaitTimeout),window.clearTimeout(this.manualToAutofocusResumeTimeout),!this.mediaStream||!this.mediaTrackCapabilities)return;let t=this.mediaTrackCapabilities.focusMode;Array.isArray(t)&&t.includes("single-shot")&&(t.includes("continuous")&&t.includes("manual")?await this.triggerManualFocusForContinuous():t.includes("continuous")||await this.triggerManualFocusForSingleShot());}async triggerManualFocusForContinuous(){var i;if(!this.mediaStream)return;this.manualToAutofocusResumeTimeout=window.setTimeout(async()=>{await this.triggerFocusMode("continuous");},n.manualToAutofocusResumeTimeoutMs);let e=true,t=this.mediaStream.getVideoTracks();t.length>0&&typeof t[0].getConstraints=="function"&&(e=((i=t[0].getConstraints().advanced)==null?void 0:i.some(a=>a.focusMode==="manual"))===true),e?(await this.triggerFocusMode("continuous"),this.manualFocusWaitTimeout=window.setTimeout(async()=>{await this.triggerFocusMode("manual");},n.manualFocusWaitTimeoutMs)):await this.triggerFocusMode("manual");}async triggerManualFocusForSingleShot(){window.clearInterval(this.autofocusInterval),this.manualToAutofocusResumeTimeout=window.setTimeout(()=>{this.autofocusInterval=window.setInterval(this.triggerAutoFocus.bind(this),n.autofocusIntervalMs);},n.manualToAutofocusResumeTimeoutMs);try{await this.triggerFocusMode("single-shot");}catch{}}async triggerZoomMove(e){this.pinchToZoomDistance==null||(e==null?void 0:e.touches.length)!==2||e.preventDefault();}triggerZoomStart(e){var a,s,o,c;if((e==null?void 0:e.touches.length)!==2||(e.preventDefault(),this.pinchToZoomDistance=Math.hypot((e.touches[1].screenX-e.touches[0].screenX)/screen.width,(e.touches[1].screenY-e.touches[0].screenY)/screen.height),!this.mediaStream||!((a=this.mediaTrackCapabilities)!=null&&a.zoom)))return;let t=this.mediaStream.getVideoTracks();if(t.length===0||typeof t[0].getConstraints!="function")return;this.pinchToZoomInitialZoom=(s=this.mediaTrackCapabilities.zoom.min)!=null?s:1;let i=t[0].getConstraints();if(i.advanced){let d=(o=i.advanced.find(l=>"zoom"in l))==null?void 0:o.zoom;d!=null&&(this.pinchToZoomInitialZoom=typeof d=="number"?d:(c=d.ideal)!=null?c:1);}}updateActiveCameraCurrentResolution(e){this.videoElement.videoWidth>2&&this.videoElement.videoHeight>2&&(e.currentResolution={width:this.videoElement.videoWidth,height:this.videoElement.videoHeight}),e.deviceId!==""&&(this.activeCamera=e,this.setMirrorImageEnabled(this.isMirrorImageEnabled(),false));}async updateStreamForResolution(e,t){var i;if(this.mediaStream==null)await this.initializeCameraForResolution(e,t);else try{let a=(i=this.activeCameraSettings)==null?void 0:i.getProperty("preferredAspectRatio");a$1.debug("Setting new resolution for active camera video stream..."),await this.mediaStream.getVideoTracks()[0].applyConstraints(d.getUserMediaVideoParameters(t,a)),await new Promise(o=>{this.videoElement.addEventListener("timeupdate",()=>{o();},{once:true});});let s=this.mediaStream.getVideoTracks()[0].getSettings();a$1.debug("New active camera video stream resolution set",{width:s.width,height:s.height});}catch(a){if(t===4)throw a;await this.updateStreamForResolution(e,t+1);}}async videoTrackEndedRecovery(){if(document.visibilityState==="visible")try{a$1.debug('Detected video track "ended" event, try to reinitialize camera'),await this.reinitializeCamera();}catch{}else a$1.debug("Page is currently not visible, delay camera reinitialization until visible"),document.addEventListener("visibilitychange",this.checkCameraVideoStreamAccessIfVisibleListener);}videoTrackMuteRecovery(e){if(this.videoElement.onloadeddata!=null){a$1.debug(`Detected video track "${e.type}" event, delay camera video stream access detection`),this.setCameraAccessTimeout();return}let t=e.type==="mute";t!==this.gui.isCameraRecoveryVisible()&&(a$1.debug(`Detected video track "${e.type}" event, ${t?"enable":"disable"} camera recovery`),this.gui.setCameraRecoveryVisible(t));}async clipMediaStreamIfNeeded(e){if(!this.clipArea)return e;let t=this.videoElement.cloneNode();t.srcObject=e,t.load();let i=document.createElement("canvas");i.width=this.clipArea.size.width,i.height=this.clipArea.size.height;let a=i.getContext("2d",{alpha:false,willReadFrequently:false});return a?(t.addEventListener("play",this.drawClippedFrame.bind(this,this.clipArea,t,a),{once:true}),t.addEventListener("pause",this.cleanupClippedStream.bind(this,t),{once:true}),await t.play(),i.captureStream()):e}drawClippedFrame(e,t,i){i.drawImage(t,e.origin.x,e.origin.y,e.size.width,e.size.height,0,0,e.size.width,e.size.height),this.clippedFrameRequestID=this.requestVideoFrame(this.drawClippedFrame.bind(this,e,t,i),t);}cleanupClippedStream(e){this.clippedFrameRequestID&&(this.cancelVideoFrame(this.clippedFrameRequestID,e),this.clippedFrameRequestID=void 0);}connectedCallback(e){e.replaceWith(this.videoElement),this.canvas.addEventListener("webglcontextlost",this.handleWebGLContextLostListener),this.videoElement.addEventListener("pause",this.handleVideoPauseHandler),this.playVideo();}disconnectedCallback(){this.canvas.removeEventListener("webglcontextlost",this.handleWebGLContextLostListener),this.videoElement.removeEventListener("pause",this.handleVideoPauseHandler),this.videoElement.remove(),this.videoElement.removeAttribute("width"),this.videoElement.removeAttribute("height"),this.videoElement.style.removeProperty("visibility");}getVideoElement(){return this.videoElement}handleVideoPause(){this.playVideo();}};n.autofocusIntervalMs=1500,n.cameraAccessTimeoutMs=4e3,n.getCapabilitiesTimeoutMs=500,n.manualFocusWaitTimeoutMs=400,n.manualToAutofocusResumeTimeoutMs=5e3,n.noCameraErrorParameters={name:"NoCameraAvailableError",message:"No camera available"},n.notReadableErrorParameters={name:"NotReadableError",message:"Could not initialize camera correctly"},n.videoMetadataCheckIntervalMs=50,n.videoMetadataCheckTimeoutMs=4e3,n.MIRRORED_CLASS_NAME=a$c.MIRRORED_CLASS_NAME,n._instance=null;var z=n;var v=class extends a{constructor(){super(...arguments);this.colorType="RGBA";}get _initialized(){return this._texture!=null&&this._framebuffer!=null}readFromSource(t){this._initialized||this.setup(),this.updateFrameSizeIfNeeded();let i=this._framePool.pop();return this._contextWebGL.texImage2D(this._contextWebGL.TEXTURE_2D,0,this._contextWebGL.RGBA,this._contextWebGL.RGBA,this._contextWebGL.UNSIGNED_BYTE,t),this._contextWebGL.readPixels(0,0,this._contextWebGL.drawingBufferWidth,this._contextWebGL.drawingBufferHeight,this._contextWebGL.RGBA,this._contextWebGL.UNSIGNED_BYTE,i),{width:this._contextWebGL.drawingBufferWidth,height:this._contextWebGL.drawingBufferHeight,data:i,frameId:E(),colorType:this.colorType}}setup(){this._texture=this._contextWebGL.createTexture(),this._texture==null&&a$1.warn("Could not create texture from WebGLRenderingContext"),this._contextWebGL.bindTexture(this._contextWebGL.TEXTURE_2D,this._texture),this._framebuffer=this._contextWebGL.createFramebuffer(),this._framebuffer==null&&a$1.warn("Could not create frameBuffer from WebGLRenderingContext"),this._contextWebGL.bindFramebuffer(this._contextWebGL.FRAMEBUFFER,this._framebuffer),this._contextWebGL.framebufferTexture2D(this._contextWebGL.FRAMEBUFFER,this._contextWebGL.COLOR_ATTACHMENT0,this._contextWebGL.TEXTURE_2D,this._texture,0),this._contextWebGL.texParameteri(this._contextWebGL.TEXTURE_2D,this._contextWebGL.TEXTURE_WRAP_S,this._contextWebGL.CLAMP_TO_EDGE),this._contextWebGL.texParameteri(this._contextWebGL.TEXTURE_2D,this._contextWebGL.TEXTURE_WRAP_T,this._contextWebGL.CLAMP_TO_EDGE),this._contextWebGL.texParameteri(this._contextWebGL.TEXTURE_2D,this._contextWebGL.TEXTURE_MIN_FILTER,this._contextWebGL.NEAREST),this._contextWebGL.texParameteri(this._contextWebGL.TEXTURE_2D,this._contextWebGL.TEXTURE_MAG_FILTER,this._contextWebGL.NEAREST);}dispose(){var t;this._texture!=null&&(this._contextWebGL.deleteTexture(this._texture),this._texture=null),this._framebuffer!=null&&(this._contextWebGL.deleteFramebuffer(this._framebuffer),this._framebuffer=null),(t=this._framePool)==null||t.empty();}updateFrameSizeIfNeeded(){var s;let{drawingBufferWidth:t,drawingBufferHeight:i}=this._contextWebGL,a=t*i*4;this._frameSize!==a&&(this._frameSize=a,(s=this._framePool)==null||s.empty(),this._framePool=new a$2({capacity:this._maxPoolCapacity,lowWaterMark:this._minPoolCapacity,createItem:()=>new Uint8ClampedArray(this._frameSize)}));}};export{v as a,T as b,H as c,Z as d,E as e,X as f,z as g};
@@ -1 +1 @@
1
- import {a as a$2}from'./chunk-BDGRWHLY.js';import {a as a$1}from'./chunk-MA6UDVDJ.js';var a={focusGesture:null,zoomGesture:null,logoAnchor:"bottomRight",logoStyle:"extended",logoOffset:a$2.fromJSON({x:{value:0,unit:"fraction"},y:{value:0,unit:"fraction"}}),pointOfInterest:a$2.fromJSON({x:{value:.5,unit:"fraction"},y:{value:.5,unit:"fraction"}}),scanAreaMargins:a$1.fromJSON({left:{value:0,unit:"fraction"},right:{value:0,unit:"fraction"},top:{value:0,unit:"fraction"},bottom:{value:0,unit:"fraction"}}),cameraRecoveryText:"(This text is updated from translations)"};export{a};
1
+ import {a as a$1}from'./chunk-MA6UDVDJ.js';import {a as a$2}from'./chunk-BDGRWHLY.js';var a={focusGesture:null,zoomGesture:null,logoAnchor:"bottomRight",logoStyle:"extended",logoOffset:a$2.fromJSON({x:{value:0,unit:"fraction"},y:{value:0,unit:"fraction"}}),pointOfInterest:a$2.fromJSON({x:{value:.5,unit:"fraction"},y:{value:.5,unit:"fraction"}}),scanAreaMargins:a$1.fromJSON({left:{value:0,unit:"fraction"},right:{value:0,unit:"fraction"},top:{value:0,unit:"fraction"},bottom:{value:0,unit:"fraction"}}),cameraRecoveryText:"(This text is updated from translations)"};export{a};
@@ -1 +1 @@
1
- import {c,a as a$1,b}from'./chunk-JFRSUCMO.js';import {a as a$3}from'./chunk-EQRBQJYM.js';import {a as a$2}from'./chunk-GHTCNOQN.js';import {e}from'./chunk-E7IMQECS.js';import {b as b$1}from'./chunk-YONR3EGV.js';import {a as a$4}from'./chunk-XR65N6EG.js';var a=class a{constructor(e){this.canUploadFile=false;this._mounted=false;this._loading=false;this._htmlRoot=void 0;this._canvas=void 0;this._onInputCheck=void 0;this._onBeforeFileRead=void 0;this._onImageLoadError=void 0;this._onFileReaderError=void 0;this._onCaptureReady=void 0;this._resizedImageSizeLimit=1440;this._inputElement=void 0;this._buttonElement=void 0;this._informationElement=void 0;this._chooseImageText="";this._localizationSubscription=void 0;this._onLocalizationUpdated=this.onLocalizationUpdated.bind(this);this._settings=e;}get canvas(){return this._canvas||(this._canvas=document.createElement("canvas")),this._canvas}get canvasContext(){return this._canvasContext||(this._canvasContext=this.canvas.getContext("2d",{willReadFrequently:true})),this._canvasContext}mount(e){var _,f;if(this._mounted)return;if(!document.head.querySelector(`[data-component=${a.componentName}]`)){let r=document.createElement("style");r.dataset.component=a.componentName,r.textContent=c,document.head.append(r);}let t=document.createElement("div");t.className=a$1.SINGLE_IMAGE_UPLOADER_CONTAINER,Object.assign(t.style,b.SINGLE_IMAGE_UPLOADER_CONTAINER_STYLE,this._settings.containerStyle),e.append(t);let{iconElement:n,iconStyle:s,informationElement:i,informationStyle:l,buttonElement:d,buttonStyle:h,onlyCameraCapture:p}=this._settings;Object.assign(n.style,b.SINGLE_IMAGE_UPLOADER_ICON_STYLE,s,{maxWidth:"100px",maxHeight:"100px"}),t.append(n),i.hasAttribute(a.DEFAULT_DOM_ATTRIBUTE)&&(Object.assign(i.style,b.SINGLE_IMAGE_UPLOADER_INFORMATION_STYLE,l),i.textContent=a$2.getInstance().get("core.singleImageUploader.title")),t.append(i);let o=document.createElement("input");o.type="file",p?(o.accept="image/*",o.capture="environment",o.dataset.onlyCaptureOnMobile="environment"):o.accept=b$1.isAndroid()&&((_=b$1.getUserAgentInfo().getBrowser().name)!=null&&_.toLowerCase().includes("chrome"))?"image/*;capture=camera":"image/*",o.addEventListener("change",r=>{this.onFileUpload(r);}),o.addEventListener("click",r=>{var m;(m=this._onInputCheck)==null||m.call(this,r);}),o.addEventListener("keydown",r=>{var m;(m=this._onInputCheck)==null||m.call(this,r);});let g=document.createElement("label");g.append(o),d.hasAttribute(a.DEFAULT_DOM_ATTRIBUTE)&&Object.assign(d.style,b.SINGLE_IMAGE_UPLOADER_BUTTON_STYLE,h),g.append(d),t.append(g);let E=document.createRange().createContextualFragment(atob(a$3)).firstElementChild;Object.assign(E.style,{position:"absolute",bottom:"1em",right:"1em",width:"10em"}),t.append(E),this._htmlRoot=t,this._mounted=true,this._inputElement=o,this._buttonElement=d,this._chooseImageText=(f=d.textContent)!=null?f:"",this._informationElement=i,this._localizationSubscription=a$2.getInstance().subscribe(this._onLocalizationUpdated);}unmount(){var e,t,n;this._mounted&&((e=this._htmlRoot)==null||e.remove(),(t=document.head.querySelector(`[data-component=${a.componentName}]`))==null||t.remove(),(n=this._localizationSubscription)==null||n.cancel(),this._mounted=false);}setButtonState(e){this._inputElement&&(this._inputElement.disabled=e==="disabled");}getButtonState(){return this._inputElement?this._inputElement.disabled?"disabled":"enabled":"disabled"}onInputCheck(e){this._onInputCheck=e;}onBeforeFileRead(e){this._onBeforeFileRead=e;}onImageLoadError(e){this._onImageLoadError=e;}onFileReaderError(e){this._onFileReaderError=e;}onCaptureReady(e){this._onCaptureReady=e;}onAfterImageProcessed(){this.setLoading(false);}onLocalizationUpdated(){var e,t;(e=this._buttonElement)!=null&&e.hasAttribute(a.DEFAULT_DOM_ATTRIBUTE)&&(this._buttonElement.textContent=a$2.getInstance().get("core.singleImageUploader.button")),(t=this._informationElement)!=null&&t.hasAttribute(a.DEFAULT_DOM_ATTRIBUTE)&&(this._informationElement.textContent=a$2.getInstance().get("core.singleImageUploader.title"));}setLoading(e){this._buttonElement&&(this.setButtonState(e?"disabled":"enabled"),this._buttonElement.textContent=e?"...":this._chooseImageText,this._loading=e);}getResizedImageDimensions(e,t){return e<=this._resizedImageSizeLimit&&t<=this._resizedImageSizeLimit?{width:e,height:t}:e>t?{width:this._resizedImageSizeLimit,height:Math.round(t/e*this._resizedImageSizeLimit)}:{width:Math.round(e/t*this._resizedImageSizeLimit),height:this._resizedImageSizeLimit}}onImageLoad(e$1){var i;let{height:t,width:n}=this.getResizedImageDimensions(e$1.naturalWidth,e$1.naturalHeight);this.canvasContext.canvas.width=n,this.canvasContext.canvas.height=t,this.canvasContext.drawImage(e$1,0,0,n,t);let s={data:this.canvasContext.getImageData(0,0,n,t).data,frameId:e(),width:n,height:t};(i=this._onCaptureReady)==null||i.call(this,s);}onFileReaderLoad(e,t,n){e.value="",t.result!=null&&(n.addEventListener("load",()=>{this.onImageLoad(n);},{once:true}),n.addEventListener("error",s=>{var i;(i=this._onImageLoadError)==null||i.call(this,s),this.setLoading(false);},{once:true}),n.src=t.result);}async onFileUpload(e){var d;this.setLoading(true);let t=e.currentTarget,{files:n}=t;if(n==null||n.length===0){this.setLoading(false);return}let s=(d=this._onBeforeFileRead)==null?void 0:d.call(this,e);if(s instanceof Promise&&await s,!this.canUploadFile){t.value="",a$4.warn("Can't upload file, no capture mode enabled."),this.setLoading(false);return}let i=new Image,l=new FileReader;l.addEventListener("load",()=>{this.onFileReaderLoad(t,l,i);}),l.addEventListener("error",h=>{var p;(p=this._onFileReaderError)==null||p.call(this,h),this.setLoading(false);}),l.readAsDataURL(n[0]);}};a.componentName="SingleImageUploaderView",a.DEFAULT_DOM_ATTRIBUTE="data-scandit-default";var T=a;export{T as a};
1
+ import {c,a as a$1,b}from'./chunk-JFRSUCMO.js';import {a as a$3}from'./chunk-EQRBQJYM.js';import {a as a$2}from'./chunk-GHTCNOQN.js';import {e}from'./chunk-U6MNF7M6.js';import {b as b$1}from'./chunk-YONR3EGV.js';import {a as a$4}from'./chunk-XR65N6EG.js';var a=class a{constructor(e){this.canUploadFile=false;this._mounted=false;this._loading=false;this._htmlRoot=void 0;this._canvas=void 0;this._onInputCheck=void 0;this._onBeforeFileRead=void 0;this._onImageLoadError=void 0;this._onFileReaderError=void 0;this._onCaptureReady=void 0;this._resizedImageSizeLimit=1440;this._inputElement=void 0;this._buttonElement=void 0;this._informationElement=void 0;this._chooseImageText="";this._localizationSubscription=void 0;this._onLocalizationUpdated=this.onLocalizationUpdated.bind(this);this._settings=e;}get canvas(){return this._canvas||(this._canvas=document.createElement("canvas")),this._canvas}get canvasContext(){return this._canvasContext||(this._canvasContext=this.canvas.getContext("2d",{willReadFrequently:true})),this._canvasContext}mount(e){var _,f;if(this._mounted)return;if(!document.head.querySelector(`[data-component=${a.componentName}]`)){let r=document.createElement("style");r.dataset.component=a.componentName,r.textContent=c,document.head.append(r);}let t=document.createElement("div");t.className=a$1.SINGLE_IMAGE_UPLOADER_CONTAINER,Object.assign(t.style,b.SINGLE_IMAGE_UPLOADER_CONTAINER_STYLE,this._settings.containerStyle),e.append(t);let{iconElement:n,iconStyle:s,informationElement:i,informationStyle:l,buttonElement:d,buttonStyle:h,onlyCameraCapture:p}=this._settings;Object.assign(n.style,b.SINGLE_IMAGE_UPLOADER_ICON_STYLE,s,{maxWidth:"100px",maxHeight:"100px"}),t.append(n),i.hasAttribute(a.DEFAULT_DOM_ATTRIBUTE)&&(Object.assign(i.style,b.SINGLE_IMAGE_UPLOADER_INFORMATION_STYLE,l),i.textContent=a$2.getInstance().get("core.singleImageUploader.title")),t.append(i);let o=document.createElement("input");o.type="file",p?(o.accept="image/*",o.capture="environment",o.dataset.onlyCaptureOnMobile="environment"):o.accept=b$1.isAndroid()&&((_=b$1.getUserAgentInfo().getBrowser().name)!=null&&_.toLowerCase().includes("chrome"))?"image/*;capture=camera":"image/*",o.addEventListener("change",r=>{this.onFileUpload(r);}),o.addEventListener("click",r=>{var m;(m=this._onInputCheck)==null||m.call(this,r);}),o.addEventListener("keydown",r=>{var m;(m=this._onInputCheck)==null||m.call(this,r);});let g=document.createElement("label");g.append(o),d.hasAttribute(a.DEFAULT_DOM_ATTRIBUTE)&&Object.assign(d.style,b.SINGLE_IMAGE_UPLOADER_BUTTON_STYLE,h),g.append(d),t.append(g);let E=document.createRange().createContextualFragment(atob(a$3)).firstElementChild;Object.assign(E.style,{position:"absolute",bottom:"1em",right:"1em",width:"10em"}),t.append(E),this._htmlRoot=t,this._mounted=true,this._inputElement=o,this._buttonElement=d,this._chooseImageText=(f=d.textContent)!=null?f:"",this._informationElement=i,this._localizationSubscription=a$2.getInstance().subscribe(this._onLocalizationUpdated);}unmount(){var e,t,n;this._mounted&&((e=this._htmlRoot)==null||e.remove(),(t=document.head.querySelector(`[data-component=${a.componentName}]`))==null||t.remove(),(n=this._localizationSubscription)==null||n.cancel(),this._mounted=false);}setButtonState(e){this._inputElement&&(this._inputElement.disabled=e==="disabled");}getButtonState(){return this._inputElement?this._inputElement.disabled?"disabled":"enabled":"disabled"}onInputCheck(e){this._onInputCheck=e;}onBeforeFileRead(e){this._onBeforeFileRead=e;}onImageLoadError(e){this._onImageLoadError=e;}onFileReaderError(e){this._onFileReaderError=e;}onCaptureReady(e){this._onCaptureReady=e;}onAfterImageProcessed(){this.setLoading(false);}onLocalizationUpdated(){var e,t;(e=this._buttonElement)!=null&&e.hasAttribute(a.DEFAULT_DOM_ATTRIBUTE)&&(this._buttonElement.textContent=a$2.getInstance().get("core.singleImageUploader.button")),(t=this._informationElement)!=null&&t.hasAttribute(a.DEFAULT_DOM_ATTRIBUTE)&&(this._informationElement.textContent=a$2.getInstance().get("core.singleImageUploader.title"));}setLoading(e){this._buttonElement&&(this.setButtonState(e?"disabled":"enabled"),this._buttonElement.textContent=e?"...":this._chooseImageText,this._loading=e);}getResizedImageDimensions(e,t){return e<=this._resizedImageSizeLimit&&t<=this._resizedImageSizeLimit?{width:e,height:t}:e>t?{width:this._resizedImageSizeLimit,height:Math.round(t/e*this._resizedImageSizeLimit)}:{width:Math.round(e/t*this._resizedImageSizeLimit),height:this._resizedImageSizeLimit}}onImageLoad(e$1){var i;let{height:t,width:n}=this.getResizedImageDimensions(e$1.naturalWidth,e$1.naturalHeight);this.canvasContext.canvas.width=n,this.canvasContext.canvas.height=t,this.canvasContext.drawImage(e$1,0,0,n,t);let s={data:this.canvasContext.getImageData(0,0,n,t).data,frameId:e(),width:n,height:t};(i=this._onCaptureReady)==null||i.call(this,s);}onFileReaderLoad(e,t,n){e.value="",t.result!=null&&(n.addEventListener("load",()=>{this.onImageLoad(n);},{once:true}),n.addEventListener("error",s=>{var i;(i=this._onImageLoadError)==null||i.call(this,s),this.setLoading(false);},{once:true}),n.src=t.result);}async onFileUpload(e){var d;this.setLoading(true);let t=e.currentTarget,{files:n}=t;if(n==null||n.length===0){this.setLoading(false);return}let s=(d=this._onBeforeFileRead)==null?void 0:d.call(this,e);if(s instanceof Promise&&await s,!this.canUploadFile){t.value="",a$4.warn("Can't upload file, no capture mode enabled."),this.setLoading(false);return}let i=new Image,l=new FileReader;l.addEventListener("load",()=>{this.onFileReaderLoad(t,l,i);}),l.addEventListener("error",h=>{var p;(p=this._onFileReaderError)==null||p.call(this,h),this.setLoading(false);}),l.readAsDataURL(n[0]);}};a.componentName="SingleImageUploaderView",a.DEFAULT_DOM_ATTRIBUTE="data-scandit-default";var T=a;export{T as a};
@@ -1 +1 @@
1
- import {a}from'./chunk-XW3Z6KKS.js';import {d}from'./chunk-YUZDO2PC.js';import {b}from'./chunk-YONR3EGV.js';import {f,g}from'./chunk-3D2HNEVH.js';var c=class{constructor(){this.type="camera-fov";this.customIcons={wide:{idle:"",pressed:""},ultraWide:{idle:"",pressed:""}};this.fovSwitchButton=void 0;this.CameraFOVSwitchButtonClass=void 0;this.currentFrameSource=null;this.view=void 0;this.onCameraFOVChanged=this.handleCameraFOVChanged.bind(this);this.isTransitioning=false;}get cameraFOVWideImage(){return this.customIcons.wide.idle}set cameraFOVWideImage(e){this.customIcons.wide.idle=e,this.applyCustomImagesToButton();}get cameraFOVWidePressedImage(){return this.customIcons.wide.pressed}set cameraFOVWidePressedImage(e){this.customIcons.wide.pressed=e,this.applyCustomImagesToButton();}get cameraFOVUltraWideImage(){return this.customIcons.ultraWide.idle}set cameraFOVUltraWideImage(e){this.customIcons.ultraWide.idle=e,this.applyCustomImagesToButton();}get cameraFOVUltraWidePressedImage(){return this.customIcons.ultraWide.pressed}set cameraFOVUltraWidePressedImage(e){this.customIcons.ultraWide.pressed=e,this.applyCustomImagesToButton();}toJSONObject(){return {type:this.type}}async install(e){var a,r,n;this.CameraFOVSwitchButtonClass||(this.CameraFOVSwitchButtonClass=await import('../private/ui/molecules/CameraFOVSwitchButton.js').then(d=>d.CameraFOVSwitchButton),(a=this.CameraFOVSwitchButtonClass)==null||a.register()),this.view=e,this.currentFrameSource=(n=(r=e.getContext())==null?void 0:r.frameSource)!=null?n:null,this.fovSwitchButton=this.CameraFOVSwitchButtonClass.create(),this.fovSwitchButton.slot="bottomRight",this.fovSwitchButton.hidden=true,this.updateButtonMode(),this.fovSwitchButton.addEventListener("camera-fov-changed",this.onCameraFOVChanged);let t=e.controlsElement;return t&&t.append(this.fovSwitchButton),this.applyCustomImagesToButton(),await this.canShow()&&(await this.setInitialWideCamera(),this.updateButtonVisibility(true)),true}remove(e){e&&this.fovSwitchButton&&(this.fovSwitchButton.removeEventListener("camera-fov-changed",this.onCameraFOVChanged),this.fovSwitchButton.remove(),this.fovSwitchButton=null,this.currentFrameSource=null,this.view=void 0);}async update(e){var i,a;this.currentFrameSource=(a=(i=e.getContext())==null?void 0:i.frameSource)!=null?a:null,this.view=e,this.updateButtonMode();let t=await this.canShow();this.updateButtonVisibility(t);}updateButtonMode(){if(!this.fovSwitchButton)return;let t=this.isUltraWideBackCamera()?"0.5x":"1.0x";this.fovSwitchButton.mode=t;}applyCustomImagesToButton(){if(!this.fovSwitchButton)return;this.customIcons.wide.idle||this.customIcons.wide.pressed||this.customIcons.ultraWide.idle||this.customIcons.ultraWide.pressed?this.fovSwitchButton.setCustomImages(this.customIcons):this.fovSwitchButton.useCustomImages=false;}updateButtonVisibility(e){this.fovSwitchButton&&(this.fovSwitchButton.hidden=!e);}async canShow(){if(!b.isIOSDeviceWithExtendedCameraAccess())return false;let e=this.currentFrameSource;return e===null||!f(e)?false:d.isIOSBackDualWideCameraLabel(e.label)||d.isIOSBackCameraLabel(e.label)||d.isIOSUltraWideBackCameraLabel(e.label)}isUltraWideBackCamera(){let e=this.currentFrameSource;return f(e)?d.isIOSUltraWideBackCameraLabel(e.label):false}async handleCameraFOVChanged(e){await this.handleCameraFOVSwitch(),this.updateButtonMode();}async setInitialWideCamera(){var e,t;if(!this.isTransitioning&&!d.isIOSBackCameraLabel((t=(e=this.currentFrameSource)==null?void 0:e.label)!=null?t:"")){let a$1=(await a.getAll()).find(r=>d.isIOSBackCameraLabel(r.label));a$1&&await this.switchCameras(a$1);}}async handleCameraFOVSwitch(){if(this.isTransitioning)return false;let e=await this.getAlternativeCamera();return e?(await this.switchCameras(e),true):false}async getAlternativeCamera(){return (await a.getAll()).find(t=>this.isUltraWideBackCamera()?d.isIOSBackCameraLabel(t.label):d.isIOSUltraWideBackCameraLabel(t.label))}async switchCameras(e){var n;this.isTransitioning=true;let t=(n=this.view)==null?void 0:n.getContext(),i=t==null?void 0:t.frameSource,a,r;i!=null&&(a=new g(i.settings),r=i.desiredState),await(i==null?void 0:i.switchToDesiredState("off")),a!=null&&await e.applySettings(a),await(t==null?void 0:t.setFrameSource(e)),await(t==null?void 0:t.frameSource).switchToDesiredState(r!=null?r:"on"),this.isTransitioning=false;}};export{c as a};
1
+ import {a}from'./chunk-5DKZR6UB.js';import {d}from'./chunk-YUZDO2PC.js';import {b}from'./chunk-YONR3EGV.js';import {f,g}from'./chunk-3D2HNEVH.js';var c=class{constructor(){this.type="camera-fov";this.customIcons={wide:{idle:"",pressed:""},ultraWide:{idle:"",pressed:""}};this.fovSwitchButton=void 0;this.CameraFOVSwitchButtonClass=void 0;this.currentFrameSource=null;this.view=void 0;this.onCameraFOVChanged=this.handleCameraFOVChanged.bind(this);this.isTransitioning=false;}get cameraFOVWideImage(){return this.customIcons.wide.idle}set cameraFOVWideImage(e){this.customIcons.wide.idle=e,this.applyCustomImagesToButton();}get cameraFOVWidePressedImage(){return this.customIcons.wide.pressed}set cameraFOVWidePressedImage(e){this.customIcons.wide.pressed=e,this.applyCustomImagesToButton();}get cameraFOVUltraWideImage(){return this.customIcons.ultraWide.idle}set cameraFOVUltraWideImage(e){this.customIcons.ultraWide.idle=e,this.applyCustomImagesToButton();}get cameraFOVUltraWidePressedImage(){return this.customIcons.ultraWide.pressed}set cameraFOVUltraWidePressedImage(e){this.customIcons.ultraWide.pressed=e,this.applyCustomImagesToButton();}toJSONObject(){return {type:this.type}}async install(e){var a,r,n;this.CameraFOVSwitchButtonClass||(this.CameraFOVSwitchButtonClass=await import('../private/ui/molecules/CameraFOVSwitchButton.js').then(d=>d.CameraFOVSwitchButton),(a=this.CameraFOVSwitchButtonClass)==null||a.register()),this.view=e,this.currentFrameSource=(n=(r=e.getContext())==null?void 0:r.frameSource)!=null?n:null,this.fovSwitchButton=this.CameraFOVSwitchButtonClass.create(),this.fovSwitchButton.slot="bottomRight",this.fovSwitchButton.hidden=true,this.updateButtonMode(),this.fovSwitchButton.addEventListener("camera-fov-changed",this.onCameraFOVChanged);let t=e.controlsElement;return t&&t.append(this.fovSwitchButton),this.applyCustomImagesToButton(),await this.canShow()&&(await this.setInitialWideCamera(),this.updateButtonVisibility(true)),true}remove(e){e&&this.fovSwitchButton&&(this.fovSwitchButton.removeEventListener("camera-fov-changed",this.onCameraFOVChanged),this.fovSwitchButton.remove(),this.fovSwitchButton=null,this.currentFrameSource=null,this.view=void 0);}async update(e){var i,a;this.currentFrameSource=(a=(i=e.getContext())==null?void 0:i.frameSource)!=null?a:null,this.view=e,this.updateButtonMode();let t=await this.canShow();this.updateButtonVisibility(t);}updateButtonMode(){if(!this.fovSwitchButton)return;let t=this.isUltraWideBackCamera()?"0.5x":"1.0x";this.fovSwitchButton.mode=t;}applyCustomImagesToButton(){if(!this.fovSwitchButton)return;this.customIcons.wide.idle||this.customIcons.wide.pressed||this.customIcons.ultraWide.idle||this.customIcons.ultraWide.pressed?this.fovSwitchButton.setCustomImages(this.customIcons):this.fovSwitchButton.useCustomImages=false;}updateButtonVisibility(e){this.fovSwitchButton&&(this.fovSwitchButton.hidden=!e);}async canShow(){if(!b.isIOSDeviceWithExtendedCameraAccess())return false;let e=this.currentFrameSource;return e===null||!f(e)?false:d.isIOSBackDualWideCameraLabel(e.label)||d.isIOSBackCameraLabel(e.label)||d.isIOSUltraWideBackCameraLabel(e.label)}isUltraWideBackCamera(){let e=this.currentFrameSource;return f(e)?d.isIOSUltraWideBackCameraLabel(e.label):false}async handleCameraFOVChanged(e){await this.handleCameraFOVSwitch(),this.updateButtonMode();}async setInitialWideCamera(){var e,t;if(!this.isTransitioning&&!d.isIOSBackCameraLabel((t=(e=this.currentFrameSource)==null?void 0:e.label)!=null?t:"")){let a$1=(await a.getAll()).find(r=>d.isIOSBackCameraLabel(r.label));a$1&&await this.switchCameras(a$1);}}async handleCameraFOVSwitch(){if(this.isTransitioning)return false;let e=await this.getAlternativeCamera();return e?(await this.switchCameras(e),true):false}async getAlternativeCamera(){return (await a.getAll()).find(t=>this.isUltraWideBackCamera()?d.isIOSBackCameraLabel(t.label):d.isIOSUltraWideBackCameraLabel(t.label))}async switchCameras(e){var n;this.isTransitioning=true;let t=(n=this.view)==null?void 0:n.getContext(),i=t==null?void 0:t.frameSource,a,r;i!=null&&(a=new g(i.settings),r=i.desiredState),await(i==null?void 0:i.switchToDesiredState("off")),a!=null&&await e.applySettings(a),await(t==null?void 0:t.setFrameSource(e)),await(t==null?void 0:t.frameSource).switchToDesiredState(r!=null?r:"on"),this.isTransitioning=false;}};export{c as a};
@@ -0,0 +1 @@
1
+ import {a as a$1}from'./chunk-NYYGU4ZV.js';import {a}from'./chunk-SJIN27Q5.js';import {b}from'./chunk-YONR3EGV.js';function R(){return document.visibilityState==="visible"}function p(l=44100){var i,a$1;let e=new AudioContext;if(b.isIOS()&&e.sampleRate!==l){(i=a)==null||i(`\u26A0\uFE0F iOS sample rate mismatch: got ${e.sampleRate}Hz, expected ${l}Hz \u2014 applying fix`);let n=e.createBuffer(1,1,l),o=e.createBufferSource();o.buffer=n,o.connect(e.destination),o.start(0),o.disconnect(),e.close();let s=new AudioContext;return (a$1=a)==null||a$1(`\u2705 iOS sample rate corrected: ${s.sampleRate}Hz`),s}return e}var f=null;function M(){return f||(f=new a$1),f}var P=class{constructor(){this.audioContext=null;this.isUnlocked=false;this.unlockPromise=null;this.unlockAttempts=0;this.MAX_UNLOCK_ATTEMPTS=3;this.lastKnownSampleRate=-1;this.mediaStreamDestination=null;this.streamAudioElement=null;this.handlerStreamAudioElementError=this.onStreamAudioElementError.bind(this);this.handlerStreamAudioElementPause=this.onStreamAudioElementPause.bind(this);}getContext(){var e,i;return this.audioContext||((e=a)==null||e("\u{1F3B5} Creating new AudioContext (outside unlock - may not work on iOS)..."),this.audioContext=p(),this.lastKnownSampleRate=this.audioContext.sampleRate,(i=a)==null||i(`\u{1F3B5} AudioContext created. Initial state: ${this.audioContext.state}, sampleRate: ${this.audioContext.sampleRate}Hz (native hardware rate)`)),this.audioContext}getDestination(){var i,a$1,n;let e=this.getContext();return b.isIOS()?((i=a)==null||i("\u{1F3B5} iOS detected - using MediaStreamDestination workaround"),this.mediaStreamDestination||((a$1=a)==null||a$1("\u{1F3B5} Creating MediaStreamDestination for iOS workaround..."),this.mediaStreamDestination=e.createMediaStreamDestination(),this.streamAudioElement=new Audio,this.streamAudioElement.srcObject=this.mediaStreamDestination.stream,this.streamAudioElement.addEventListener("error",this.handlerStreamAudioElementError),this.streamAudioElement.addEventListener("pause",this.handlerStreamAudioElementPause),this.streamAudioElement.play().catch(o=>{var s;(s=a)==null||s(`Failed to start stream audio element: ${o}`);}),(n=a)==null||n("\u{1F3B5} MediaStreamDestination connected to HTML5 Audio element (stream playing continuously)")),this.mediaStreamDestination):e.destination}onStreamAudioElementError(){var e,i,a$1;if(!R()){(e=a)==null||e("\u26A0\uFE0F Document is not visible - skipping attempt to restart stream audio element");return}(i=a)==null||i("\u26A0\uFE0F Stream audio element error - attempting to restart..."),(a$1=this.streamAudioElement)==null||a$1.play().catch(n=>{var o;(o=a)==null||o(`Failed to restart stream audio element: ${n}`);});}onStreamAudioElementPause(){var e,i,a$1;if(!R()){(e=a)==null||e("\u26A0\uFE0F Document is not visible - skipping attempt to restart stream audio element");return}(i=a)==null||i("\u26A0\uFE0F Stream audio element paused unexpectedly - restarting..."),(a$1=this.streamAudioElement)==null||a$1.play().catch(n=>{var o;(o=a)==null||o(`Failed to restart stream audio element after pause: ${n}`);});}checkAndRecreateContextIfSampleRateChanged(){var i,a$1;if(!this.audioContext)return;let e=this.audioContext.sampleRate;this.lastKnownSampleRate!==-1&&e!==this.lastKnownSampleRate&&((i=a)==null||i(`\u26A0\uFE0F Hardware sample rate changed: was ${this.lastKnownSampleRate}Hz, now ${e}Hz`),(a$1=a)==null||a$1("\u{1F504} Sample rate change detected. Recreating AudioContext to match new hardware rate..."),this.recreateContext());}recreateContext(){var e,i,a$1;try{this.audioContext&&this.audioContext.state!=="closed"&&typeof this.audioContext.close=="function"&&this.audioContext.close(),this.audioContext=null,this.mediaStreamDestination=null,this.streamAudioElement&&(this.streamAudioElement.pause(),this.streamAudioElement.srcObject=null),M().clear(),(e=a)==null||e("\u{1F3A7} Audio buffer cache cleared after context recreation"),this.audioContext=p(),this.lastKnownSampleRate=this.audioContext.sampleRate,this.isUnlocked=false,(i=a)==null||i(`\u2705 AudioContext recreated: using native hardware rate of ${this.audioContext.sampleRate}Hz (state: ${this.audioContext.state})`);}catch(n){(a$1=a)==null||a$1(`\u274C Failed to recreate AudioContext: ${n instanceof Error?n.message:String(n)}`);}}createContext(){var e,i;this.audioContext||((e=a)==null||e("\u{1F3B5} Creating AudioContext during user gesture..."),this.audioContext=p(),this.lastKnownSampleRate=this.audioContext.sampleRate,(i=a)==null||i(`\u{1F3B5} AudioContext created with state: ${this.audioContext.state}, sampleRate: ${this.audioContext.sampleRate}Hz`));}async unlock(){var e,i,a$1,n;if(this.isUnlocked){(e=a)==null||e("\u{1F513} Audio already unlocked");return}if(this.unlockPromise){(i=a)==null||i("\u23F3 Unlock already in progress, waiting..."),await this.unlockPromise;return}if(this.unlockAttempts>=this.MAX_UNLOCK_ATTEMPTS){(a$1=a)==null||a$1(`\u274C Max unlock attempts (${this.MAX_UNLOCK_ATTEMPTS}) exceeded. Audio will not work this session.`);return}this.unlockAttempts++,(n=a)==null||n(`\u{1F513} Unlock attempt ${this.unlockAttempts}/${this.MAX_UNLOCK_ATTEMPTS}`),this.unlockPromise=(async()=>{var s,A,C,x,S,g,k,E,v,w,b$1;(s=a)==null||s("\u{1F513} Unlocking audio context during user gesture..."),this.createContext();let o=this.audioContext;(A=a)==null||A(`\u{1F513} AudioContext state during unlock: ${o.state}`),o.state==="suspended"&&((C=a)==null||C("\u{1F513} Calling context.resume() synchronously during user gesture..."),o.resume());try{if(o.state==="suspended"){(x=a)==null||x("\u{1F513} Waiting for context.resume() to complete...");for(let u=0;u<10;u++)if(await new Promise(d=>setTimeout(d,10)),o.state==="running"){(S=a)==null||S(`\u{1F513} AudioContext resumed successfully after ${(u+1)*10}ms`);break}}(g=a)==null||g(`\u{1F513} AudioContext state before test tone: ${o.state}`),(k=a)==null||k("\u{1F513} Creating and playing silent scratch buffer for unlock...");let m=o.createBuffer(2,1,o.sampleRate);(E=a)==null||E("\u{1F513} Created silent scratch buffer to unlock iOS");let r=o.createBufferSource();r.buffer=m,r.loop=false;let h=o.createGain();h.gain.value=1,r.connect(h);let D=this.getDestination();h.connect(D),(v=a)==null||v(`\u{1F513} Audio graph connected to ${b.isIOS()?"MediaStreamDestination":"standard destination"} during user gesture`),await new Promise(u=>{var d;r.onended=()=>{var y;(y=a)==null||y("\u{1F513} Silent scratch buffer playback completed"),u();},(d=a)==null||d("\u{1F513} Starting silent scratch buffer playback..."),r.start(0);}),this.isUnlocked=true,(w=a)==null||w("\u2705 Audio successfully unlocked");}catch(m){(b$1=a)==null||b$1(`\u274C Failed to unlock audio (attempt ${this.unlockAttempts}/${this.MAX_UNLOCK_ATTEMPTS}): ${m}`);}finally{this.unlockPromise=null;}})(),await this.unlockPromise;}get unlocked(){return this.isUnlocked}dispose(){this.streamAudioElement&&(this.streamAudioElement.removeEventListener("error",this.handlerStreamAudioElementError),this.streamAudioElement.removeEventListener("pause",this.handlerStreamAudioElementPause),this.streamAudioElement.pause(),this.streamAudioElement.srcObject=null,this.streamAudioElement=null),this.audioContext&&this.audioContext.state!=="closed"&&typeof this.audioContext.close=="function"&&this.audioContext.close(),this.audioContext=null,this.isUnlocked=false,this.unlockPromise=null,this.unlockAttempts=0,this.mediaStreamDestination=null;}};export{p as a,M as b,P as c};
@@ -1 +1 @@
1
- import {a as a$1}from'./chunk-BV63CXZF.js';import {a}from'./chunk-IASACVTH.js';var o=class r{constructor(i,e){this._vibration=null;this._sound=null;this._vibration=i,this._sound=e;}static get defaultFeedback(){return new r(a.defaultVibration,a$1.defaultSound)}get vibration(){return this._vibration}get sound(){return this._sound}emit(){this.sound&&this.sound.play(),this.vibration&&this.vibration.vibrate();}toJSONObject(){let i={};return this.sound!==null&&(i.sound=this.sound.toJSONObject()),this.vibration!==null&&(i.vibration=this.vibration.toJSONObject()),i}};export{o as a};
1
+ import {a as a$1}from'./chunk-FK5L5YTR.js';import {a}from'./chunk-IASACVTH.js';var o=class r{constructor(i,e){this._vibration=null;this._sound=null;this._vibration=i,this._sound=e;}static get defaultFeedback(){return new r(a.defaultVibration,a$1.defaultSound)}get vibration(){return this._vibration}get sound(){return this._sound}emit(){this.sound&&this.sound.play(),this.vibration&&this.vibration.vibrate();}toJSONObject(){let i={};return this.sound!==null&&(i.sound=this.sound.toJSONObject()),this.vibration!==null&&(i.vibration=this.vibration.toJSONObject()),i}};export{o as a};
@@ -0,0 +1 @@
1
+ var e=new Set;function t(n){e.add(n);}function o(n){e.delete(n);}function r(){return Array.from(e)}export{t as a,o as b,r as c};
@@ -1,6 +1,6 @@
1
1
  /// <reference types="emscripten" />
2
- import { C as Control, a as ControlType } from '../DataCaptureContext-LM_Re1B4.js';
3
- import '../Camera-BnPnXqAt.js';
2
+ import { C as Control, a as ControlType } from '../DataCaptureContext-BcSpF9Dt.js';
3
+ import '../Camera-Cc__1Nc-.js';
4
4
  import '../commons/Rect.js';
5
5
  import '../private/Serializable.js';
6
6
  import '../commons/Point.js';
@@ -1 +1 @@
1
- export{a as CameraFOVSwitchControl}from'../chunks/chunk-7ZU6DPLL.js';
1
+ export{a as CameraFOVSwitchControl}from'../chunks/chunk-XV75QMNK.js';
@@ -1,6 +1,6 @@
1
1
  /// <reference types="emscripten" />
2
- import { C as Control, a as ControlType } from '../DataCaptureContext-LM_Re1B4.js';
3
- import '../Camera-BnPnXqAt.js';
2
+ import { C as Control, a as ControlType } from '../DataCaptureContext-BcSpF9Dt.js';
3
+ import '../Camera-Cc__1Nc-.js';
4
4
  import '../commons/Rect.js';
5
5
  import '../private/Serializable.js';
6
6
  import '../commons/Point.js';
@@ -1 +1 @@
1
- export{a as CameraSwitchControl}from'../chunks/chunk-H7FKC2FI.js';
1
+ export{a as CameraSwitchControl}from'../chunks/chunk-35JLCTLQ.js';
@@ -1,6 +1,6 @@
1
1
  /// <reference types="emscripten" />
2
- import { C as Control, a as ControlType } from '../DataCaptureContext-LM_Re1B4.js';
3
- import '../Camera-BnPnXqAt.js';
2
+ import { C as Control, a as ControlType } from '../DataCaptureContext-BcSpF9Dt.js';
3
+ import '../Camera-Cc__1Nc-.js';
4
4
  import '../commons/Rect.js';
5
5
  import '../private/Serializable.js';
6
6
  import '../commons/Point.js';
@@ -1 +1 @@
1
- export{a as TorchSwitchControl}from'../chunks/chunk-FHNMZZV2.js';
1
+ export{a as TorchSwitchControl}from'../chunks/chunk-YRQQE3NR.js';
@@ -1,7 +1,7 @@
1
1
  /// <reference types="emscripten" />
2
- export { C as Control, a as ControlType, bh as PrivateBaseControl, bi as PrivateControl } from '../DataCaptureContext-LM_Re1B4.js';
2
+ export { C as Control, a as ControlType, bh as PrivateBaseControl, bi as PrivateControl } from '../DataCaptureContext-BcSpF9Dt.js';
3
3
  import '../private/Serializable.js';
4
- import '../Camera-BnPnXqAt.js';
4
+ import '../Camera-Cc__1Nc-.js';
5
5
  import '../commons/Rect.js';
6
6
  import '../commons/Point.js';
7
7
  import '../commons/Size.js';
@@ -1,9 +1,9 @@
1
1
  /// <reference types="emscripten" />
2
2
  export { CameraFOVSwitchControl } from './CameraFOVSwitchControl.js';
3
3
  export { CameraSwitchControl } from './CameraSwitchControl.js';
4
- export { C as Control, a as ControlType } from '../DataCaptureContext-LM_Re1B4.js';
4
+ export { C as Control, a as ControlType } from '../DataCaptureContext-BcSpF9Dt.js';
5
5
  export { TorchSwitchControl } from './TorchSwitchControl.js';
6
- import '../Camera-BnPnXqAt.js';
6
+ import '../Camera-Cc__1Nc-.js';
7
7
  import '../commons/Rect.js';
8
8
  import '../private/Serializable.js';
9
9
  import '../commons/Point.js';
@@ -1 +1 @@
1
- export{a as CameraFOVSwitchControl}from'../chunks/chunk-7ZU6DPLL.js';export{a as CameraSwitchControl}from'../chunks/chunk-H7FKC2FI.js';export{a as TorchSwitchControl}from'../chunks/chunk-FHNMZZV2.js';
1
+ export{a as CameraFOVSwitchControl}from'../chunks/chunk-XV75QMNK.js';export{a as CameraSwitchControl}from'../chunks/chunk-35JLCTLQ.js';export{a as TorchSwitchControl}from'../chunks/chunk-YRQQE3NR.js';
@@ -1,7 +1,7 @@
1
1
  /// <reference types="emscripten" />
2
- import { k as VideoResolution, F as FocusGestureStrategy, b as CameraPosition } from '../Camera-BnPnXqAt.js';
2
+ import { k as VideoResolution, F as FocusGestureStrategy, b as CameraPosition } from '../Camera-Cc__1Nc-.js';
3
3
  import '../ScanditIcon.js';
4
- import '../DataCaptureContext-LM_Re1B4.js';
4
+ import '../DataCaptureContext-BcSpF9Dt.js';
5
5
  import '../commons/Rect.js';
6
6
  import '../private/Serializable.js';
7
7
  import '../commons/Point.js';
@@ -1,5 +1,5 @@
1
1
  /// <reference types="emscripten" />
2
- import { k as VideoResolution, F as FocusGestureStrategy } from '../Camera-BnPnXqAt.js';
2
+ import { k as VideoResolution, F as FocusGestureStrategy } from '../Camera-Cc__1Nc-.js';
3
3
  import '../commons/Rect.js';
4
4
  import '../private/Serializable.js';
5
5
  import '../commons/Point.js';
@@ -1 +1 @@
1
- export{a as defaultDataCaptureView}from'../chunks/chunk-2OCDIZIS.js';
1
+ export{a as defaultDataCaptureView}from'../chunks/chunk-UQVVJP5Z.js';
@@ -22,6 +22,7 @@ declare global {
22
22
  var WASM_METADATA: Record<string, { bytes: number }>;
23
23
  var DEBUG_PERFORMANCE: boolean;
24
24
  var DEBUG_CAMERA: boolean;
25
+ var DEBUG_AUDIO: boolean;
25
26
  var WEBASSEMBLY_SKIP_CUSTOM_LOADER: boolean;
26
27
  var path: string;
27
28
 
@@ -5,7 +5,7 @@ export { AimerViewfinder } from './AimerViewfinder.js';
5
5
  export { BrowserCompatibility, Feature } from './browserCompatibility.js';
6
6
  export { BrowserHelper, DisplayMode } from './browserHelper.js';
7
7
  export { Brush, BrushJSON } from './Brush.js';
8
- export { C as Camera, a as CameraJSON, b as CameraPosition, c as CameraSettings, d as CameraSettingsFromJSON, e as CameraSettingsJSON, f as CameraSettingsJSONBase, F as FocusGestureStrategy, g as FrameSource, h as FrameSourceJSON, i as FrameSourceListener, j as FrameSourceState, P as PrivateCameraExtraProperties, T as TorchState, V as VideoFrameResolution, k as VideoResolution, l as isCameraFrameSource } from './Camera-BnPnXqAt.js';
8
+ export { C as Camera, a as CameraJSON, b as CameraPosition, c as CameraSettings, d as CameraSettingsFromJSON, e as CameraSettingsJSON, f as CameraSettingsJSONBase, F as FocusGestureStrategy, g as FrameSource, h as FrameSourceJSON, i as FrameSourceListener, j as FrameSourceState, P as PrivateCameraExtraProperties, T as TorchState, V as VideoFrameResolution, k as VideoResolution, l as isCameraFrameSource } from './Camera-Cc__1Nc-.js';
9
9
  export { Anchor } from './commons/Anchor.js';
10
10
  export { Color, ColorJSON } from './commons/Color.js';
11
11
  export { Direction } from './commons/Direction.js';
@@ -26,7 +26,7 @@ export { SizeWithUnit, SizeWithUnitJSON } from './commons/SizeWithUnit.js';
26
26
  export { SizeWithUnitAndAspect, SizeWithUnitAndAspectJSON } from './commons/SizeWithUnitAndAspect.js';
27
27
  export { CameraFOVSwitchControl } from './controls/CameraFOVSwitchControl.js';
28
28
  export { CameraSwitchControl } from './controls/CameraSwitchControl.js';
29
- export { b as Change, c as ContextStatus, d as ContextStatusJSON, C as Control, a as ControlType, D as DataCaptureComponent, e as DataCaptureComponentJSON, f as DataCaptureContext, g as DataCaptureContextCreationOptions, h as DataCaptureContextJSON, i as DataCaptureContextListener, j as DataCaptureContextState, k as DataCaptureLoader, l as DataCaptureLoaderOptions, m as DataCaptureMode, n as DataCaptureModeJSON, o as DataCaptureOverlay, p as DataCaptureView, q as DataCaptureViewConnectOptions, r as DataCaptureViewJSON, s as DataCaptureViewListener, F as FrameData, M as ModuleLoader, t as ModuleLoaderOptions, P as PrivateCapabilityInfo, u as PrivateChangeSet, v as PrivateDataCaptureComponent, w as PrivateDataCaptureContext, x as PrivateDataCaptureContextOptions, y as PrivateDataCaptureMode, z as PrivateFrameHandler, A as PrivateFrameHandlerResponse, B as PrivateLoadableFrameData, E as PrivateMirrorAxis, G as convertToPublicFrameData } from './DataCaptureContext-LM_Re1B4.js';
29
+ export { b as Change, c as ContextStatus, d as ContextStatusJSON, C as Control, a as ControlType, D as DataCaptureComponent, e as DataCaptureComponentJSON, f as DataCaptureContext, g as DataCaptureContextCreationOptions, h as DataCaptureContextJSON, i as DataCaptureContextListener, j as DataCaptureContextState, k as DataCaptureLoader, l as DataCaptureLoaderOptions, m as DataCaptureMode, n as DataCaptureModeJSON, o as DataCaptureOverlay, p as DataCaptureView, q as DataCaptureViewConnectOptions, r as DataCaptureViewJSON, s as DataCaptureViewListener, F as FrameData, M as ModuleLoader, t as ModuleLoaderOptions, P as PrivateCapabilityInfo, u as PrivateChangeSet, v as PrivateDataCaptureComponent, w as PrivateDataCaptureContext, x as PrivateDataCaptureContextOptions, y as PrivateDataCaptureMode, z as PrivateFrameHandler, A as PrivateFrameHandlerResponse, B as PrivateLoadableFrameData, E as PrivateMirrorAxis, G as convertToPublicFrameData } from './DataCaptureContext-BcSpF9Dt.js';
30
30
  export { TorchSwitchControl } from './controls/TorchSwitchControl.js';
31
31
  export { DataCaptureContextSettings, DataCaptureContextSettingsJSON } from './DataCaptureContextSettings.js';
32
32
  export { DataCaptureError, DataCaptureErrorDetails } from './DataCaptureError.js';
package/build/js/index.js CHANGED
@@ -1 +1 @@
1
- export{a as DataCaptureLoader}from'./chunks/chunk-YJNJGCAN.js';export{a as WorkerMain}from'./chunks/chunk-YXXMWHFX.js';export{a as CameraFOVSwitchControl}from'./chunks/chunk-7ZU6DPLL.js';export{a as CameraSwitchControl}from'./chunks/chunk-H7FKC2FI.js';export{a as TorchSwitchControl}from'./chunks/chunk-FHNMZZV2.js';export{a as RectWithUnit}from'./chunks/chunk-TKO5JMMS.js';export{a as Direction}from'./chunks/chunk-WARGMW7Z.js';export{a as NotificationBuilder}from'./chunks/chunk-5LXHD7FZ.js';export{a as NoViewfinder}from'./chunks/chunk-4ZMCJXZS.js';export{a as PrivateNoneLocationSelection,b as RadiusLocationSelection,c as RectangularLocationSelection}from'./chunks/chunk-CAHJ3YOV.js';export{a as RectangularViewfinder}from'./chunks/chunk-GPUTPXQM.js';export{c as ScanditIconBuilder,b as ScanditIconForIconType,a as ScanditIconType}from'./chunks/chunk-DQ5X7FNV.js';export{b as ScanditIcon,a as ScanditIconShape}from'./chunks/chunk-FMOB7R2T.js';export{a as SingleImageUploader}from'./chunks/chunk-EQP4U5U2.js';export{a as SingleImageUploaderSettings}from'./chunks/chunk-IMXMNDKM.js';export{a as DataCaptureVersion}from'./chunks/chunk-7JVAQ2A3.js';export{a as DataCaptureView}from'./chunks/chunk-BQO4QYI6.js';export{a as AdditionalLayerPosition}from'./chunks/chunk-DZE2EYSZ.js';export{a as AnchorPositions}from'./chunks/chunk-RSQRPDVQ.js';export{a as Orientation}from'./chunks/chunk-5RCWM6NI.js';export{a as PointWithUnit}from'./chunks/chunk-BDGRWHLY.js';export{a as Quadrilateral}from'./chunks/chunk-IJQG3OU6.js';export{a as Anchor}from'./chunks/chunk-Y7ZNLVR2.js';export{a as MarginsWithUnit}from'./chunks/chunk-MA6UDVDJ.js';export{a as NotificationConfiguration}from'./chunks/chunk-CRUOVJHW.js';export{a as NotificationStyle}from'./chunks/chunk-RXT3JWWR.js';export{a as MeasureUnit}from'./chunks/chunk-QQEY536Q.js';export{a as LogoStyle,c as SwipeToZoom,b as TapToFocus}from'./chunks/chunk-GX4YCYCH.js';export{a as Feedback}from'./chunks/chunk-7EGT56UE.js';export{a as Sound}from'./chunks/chunk-BV63CXZF.js';export{a as Vibration}from'./chunks/chunk-IASACVTH.js';export{a as convertToPublicFrameData}from'./chunks/chunk-W33RVR5M.js';export{a as ImageFrameSource}from'./chunks/chunk-OCKYBUXO.js';export{a as LaserlineViewfinder}from'./chunks/chunk-RXPPTQAB.js';export{a as AimerViewfinder}from'./chunks/chunk-3KKUZY2T.js';export{c as RectangularViewfinderAnimation,b as RectangularViewfinderLineStyle,a as RectangularViewfinderStyle}from'./chunks/chunk-WGLHZXRT.js';export{a as SizeWithUnitAndAspect}from'./chunks/chunk-AZWFNBVA.js';export{a as SizeWithAspect}from'./chunks/chunk-FR24G4R7.js';export{a as SizingMode}from'./chunks/chunk-2JIATMSD.js';export{a as SizeWithUnit}from'./chunks/chunk-F2GMW4LP.js';export{a as NumberWithUnit}from'./chunks/chunk-ENYHCJGH.js';export{a as Brush}from'./chunks/chunk-YOTQPBO6.js';export{a as Color}from'./chunks/chunk-SGL5J2CI.js';export{a as Camera}from'./chunks/chunk-XW3Z6KKS.js';export{a as INTERNAL_ACCESS}from'./chunks/chunk-LFJUGRQV.js';export{b as DataCaptureContext}from'./chunks/chunk-YMM2PV73.js';export{a as OverrideState}from'./chunks/chunk-6W7FX6LD.js';export{b as loadingStatus}from'./chunks/chunk-6H6FKGVE.js';export{a as Localization}from'./chunks/chunk-GHTCNOQN.js';export{a as ScanditHTMLElement}from'./chunks/chunk-EV4OEANA.js';export{a as Point}from'./chunks/chunk-KAFNKP6O.js';export{a as Rect}from'./chunks/chunk-E4XJ4GKD.js';export{a as Size}from'./chunks/chunk-QOCHMKNY.js';export{a as assert,b as assertUnreachable,c as assertUnreachableThrowException}from'./chunks/chunk-FTD535WI.js';export{b as BrowserHelper,a as DisplayMode}from'./chunks/chunk-YONR3EGV.js';export{a as Feature}from'./chunks/chunk-NVK73TNL.js';export{a as Logger}from'./chunks/chunk-XR65N6EG.js';export{c as CameraPosition,g as CameraSettings,e as FocusGestureStrategy,a as FrameSourceState,b as TorchState,d as VideoResolution,f as isCameraFrameSource}from'./chunks/chunk-3D2HNEVH.js';export{a as ContextStatus,b as PrivateMirrorAxis}from'./chunks/chunk-WUHKODFA.js';export{a as DataCaptureContextSettings}from'./chunks/chunk-7SW2PEHB.js';export{a as DataCaptureError}from'./chunks/chunk-QCZSSQAQ.js';
1
+ export{a as DataCaptureLoader}from'./chunks/chunk-YJNJGCAN.js';export{a as WorkerMain}from'./chunks/chunk-GZCWMFWA.js';export{a as RectWithUnit}from'./chunks/chunk-TKO5JMMS.js';export{a as Direction}from'./chunks/chunk-WARGMW7Z.js';export{a as CameraFOVSwitchControl}from'./chunks/chunk-XV75QMNK.js';export{a as CameraSwitchControl}from'./chunks/chunk-35JLCTLQ.js';export{a as TorchSwitchControl}from'./chunks/chunk-YRQQE3NR.js';export{a as NotificationBuilder}from'./chunks/chunk-5LXHD7FZ.js';export{a as NoViewfinder}from'./chunks/chunk-4ZMCJXZS.js';export{a as PrivateNoneLocationSelection,b as RadiusLocationSelection,c as RectangularLocationSelection}from'./chunks/chunk-CAHJ3YOV.js';export{a as RectangularViewfinder}from'./chunks/chunk-GPUTPXQM.js';export{c as ScanditIconBuilder,b as ScanditIconForIconType,a as ScanditIconType}from'./chunks/chunk-ZCEA7BEH.js';export{b as ScanditIcon,a as ScanditIconShape}from'./chunks/chunk-FMOB7R2T.js';export{a as SingleImageUploader}from'./chunks/chunk-EQP4U5U2.js';export{a as SingleImageUploaderSettings}from'./chunks/chunk-IMXMNDKM.js';export{a as DataCaptureVersion}from'./chunks/chunk-KYAHE2Q3.js';export{a as DataCaptureView}from'./chunks/chunk-2N546PXQ.js';export{a as AdditionalLayerPosition}from'./chunks/chunk-DZE2EYSZ.js';export{a as AnchorPositions}from'./chunks/chunk-RSQRPDVQ.js';export{a as Quadrilateral}from'./chunks/chunk-IJQG3OU6.js';export{a as MarginsWithUnit}from'./chunks/chunk-MA6UDVDJ.js';export{a as Orientation}from'./chunks/chunk-5RCWM6NI.js';export{a as PointWithUnit}from'./chunks/chunk-BDGRWHLY.js';export{a as Anchor}from'./chunks/chunk-Y7ZNLVR2.js';export{a as NotificationConfiguration}from'./chunks/chunk-CRUOVJHW.js';export{a as NotificationStyle}from'./chunks/chunk-RXT3JWWR.js';export{a as MeasureUnit}from'./chunks/chunk-QQEY536Q.js';export{a as LogoStyle,c as SwipeToZoom,b as TapToFocus}from'./chunks/chunk-GX4YCYCH.js';export{a as Feedback}from'./chunks/chunk-Z6CZGU5N.js';export{a as Sound}from'./chunks/chunk-FK5L5YTR.js';export{a as Vibration}from'./chunks/chunk-IASACVTH.js';export{a as convertToPublicFrameData}from'./chunks/chunk-W33RVR5M.js';export{a as ImageFrameSource}from'./chunks/chunk-5VJXJTUX.js';export{a as LaserlineViewfinder}from'./chunks/chunk-RXPPTQAB.js';export{a as AimerViewfinder}from'./chunks/chunk-3KKUZY2T.js';export{c as RectangularViewfinderAnimation,b as RectangularViewfinderLineStyle,a as RectangularViewfinderStyle}from'./chunks/chunk-WGLHZXRT.js';export{a as SizeWithUnitAndAspect}from'./chunks/chunk-AZWFNBVA.js';export{a as SizingMode}from'./chunks/chunk-2JIATMSD.js';export{a as SizeWithAspect}from'./chunks/chunk-FR24G4R7.js';export{a as SizeWithUnit}from'./chunks/chunk-F2GMW4LP.js';export{a as NumberWithUnit}from'./chunks/chunk-ENYHCJGH.js';export{a as Brush}from'./chunks/chunk-YOTQPBO6.js';export{a as Color}from'./chunks/chunk-SGL5J2CI.js';export{a as Camera}from'./chunks/chunk-5DKZR6UB.js';export{b as DataCaptureContext}from'./chunks/chunk-ATSAENLJ.js';export{a as OverrideState}from'./chunks/chunk-6W7FX6LD.js';export{b as loadingStatus}from'./chunks/chunk-6H6FKGVE.js';export{a as Localization}from'./chunks/chunk-GHTCNOQN.js';export{a as ScanditHTMLElement}from'./chunks/chunk-EV4OEANA.js';export{a as INTERNAL_ACCESS}from'./chunks/chunk-LFJUGRQV.js';export{a as Rect}from'./chunks/chunk-E4XJ4GKD.js';export{a as Size}from'./chunks/chunk-QOCHMKNY.js';export{a as Point}from'./chunks/chunk-KAFNKP6O.js';export{a as assert,b as assertUnreachable,c as assertUnreachableThrowException}from'./chunks/chunk-FTD535WI.js';export{b as BrowserHelper,a as DisplayMode}from'./chunks/chunk-YONR3EGV.js';export{a as Feature}from'./chunks/chunk-NVK73TNL.js';export{a as Logger}from'./chunks/chunk-XR65N6EG.js';export{c as CameraPosition,g as CameraSettings,e as FocusGestureStrategy,a as FrameSourceState,b as TorchState,d as VideoResolution,f as isCameraFrameSource}from'./chunks/chunk-3D2HNEVH.js';export{a as ContextStatus,b as PrivateMirrorAxis}from'./chunks/chunk-WUHKODFA.js';export{a as DataCaptureContextSettings}from'./chunks/chunk-7SW2PEHB.js';export{a as DataCaptureError}from'./chunks/chunk-QCZSSQAQ.js';
@@ -1,6 +1,6 @@
1
1
  /// <reference types="emscripten" />
2
- export { M as ModuleLoader } from './DataCaptureContext-LM_Re1B4.js';
3
- import './Camera-BnPnXqAt.js';
2
+ export { M as ModuleLoader } from './DataCaptureContext-BcSpF9Dt.js';
3
+ import './Camera-Cc__1Nc-.js';
4
4
  import './commons/Rect.js';
5
5
  import './private/Serializable.js';
6
6
  import './commons/Point.js';
@@ -1,5 +1,5 @@
1
1
  /// <reference types="emscripten" />
2
- export { A as AspectRatio, m as CameraAccess, n as CameraPosition, o as CameraResolutionConstraint, D as DeviceCamera } from '../Camera-BnPnXqAt.js';
2
+ export { A as AspectRatio, m as CameraAccess, n as CameraPosition, o as CameraResolutionConstraint, D as DeviceCamera } from '../Camera-Cc__1Nc-.js';
3
3
  import '../commons/Rect.js';
4
4
  import './Serializable.js';
5
5
  import '../commons/Point.js';
@@ -1,7 +1,7 @@
1
1
  /// <reference types="emscripten" />
2
2
  import './FrameReaders/ColorType.js';
3
- export { bj as CameraManager, bk as CameraManagerEvent, bl as CameraManagerEventParameters, bm as CameraResolutionConstraint, bn as ExtendedMediaTrackCapabilities, bo as ExtendedMediaTrackConstraintSet, O as FrameCapture, J as FrameId, bp as GUI, bq as MeteringMode, br as createFrameId } from '../DataCaptureContext-LM_Re1B4.js';
4
- import '../Camera-BnPnXqAt.js';
3
+ export { bj as CameraManager, bk as CameraManagerEvent, bl as CameraManagerEventParameters, bm as CameraResolutionConstraint, bn as ExtendedMediaTrackCapabilities, bo as ExtendedMediaTrackConstraintSet, O as FrameCapture, J as FrameId, bp as GUI, bq as MeteringMode, br as createFrameId } from '../DataCaptureContext-BcSpF9Dt.js';
4
+ import '../Camera-Cc__1Nc-.js';
5
5
  import '../commons/Rect.js';
6
6
  import '../DataCaptureContextSettings.js';
7
7
  import '../commons/JSONType.js';
@@ -1 +1 @@
1
- export{g as CameraManager,f as CameraManagerEvent,d as CameraResolutionConstraint,c as MeteringMode,e as createFrameId}from'../chunks/chunk-E7IMQECS.js';
1
+ export{g as CameraManager,f as CameraManagerEvent,d as CameraResolutionConstraint,c as MeteringMode,e as createFrameId}from'../chunks/chunk-U6MNF7M6.js';
@@ -1,8 +1,8 @@
1
1
  /// <reference types="emscripten" />
2
- import { C as Camera } from '../Camera-BnPnXqAt.js';
2
+ import { C as Camera } from '../Camera-Cc__1Nc-.js';
3
3
  import '../ScanditIcon.js';
4
4
  import { INTERNAL_ACCESS } from './privateAccess.js';
5
- import '../DataCaptureContext-LM_Re1B4.js';
5
+ import '../DataCaptureContext-BcSpF9Dt.js';
6
6
  import '../commons/Rect.js';
7
7
  import './Serializable.js';
8
8
  import '../commons/Point.js';
@@ -84,6 +84,7 @@ declare class CameraPool {
84
84
  integrateIncomingVideoDevices(newCameras: Camera[]): void;
85
85
  private allCamerasNoDeviceId;
86
86
  get(): Camera[];
87
+ clear(): void;
87
88
  private push;
88
89
  private debugLog;
89
90
  private logPool;