@scandit/web-datacapture-barcode 8.1.0 → 8.1.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 (65) hide show
  1. package/LICENSE +1 -1
  2. package/build/js/{BarcodeArMode-CMCDbgJX.d.ts → BarcodeArMode-BME9pF28.d.ts} +1 -0
  3. package/build/js/ar/BarcodeAr.js +1 -1
  4. package/build/js/ar/BarcodeArFeedback.js +1 -1
  5. package/build/js/ar/BarcodeArPresenter.js +1 -1
  6. package/build/js/ar/BarcodeArView.js +1 -1
  7. package/build/js/chunks/{chunk-5XSU2SNR.js → chunk-273C5UAE.js} +1 -1
  8. package/build/js/chunks/{chunk-JTNWCFEZ.js → chunk-2OIPG3Z2.js} +1 -1
  9. package/build/js/chunks/{chunk-R3MQ2GAV.js → chunk-2PM6DH45.js} +1 -1
  10. package/build/js/chunks/chunk-6627JL5I.js +1 -0
  11. package/build/js/chunks/chunk-74NQM2AV.js +1 -0
  12. package/build/js/chunks/{chunk-ICLVRV4C.js → chunk-AJT34L5B.js} +1 -1
  13. package/build/js/chunks/{chunk-FOVTROJK.js → chunk-C5S6DRA7.js} +1 -1
  14. package/build/js/chunks/{chunk-ZUARER6Y.js → chunk-DSAATLKK.js} +1 -1
  15. package/build/js/chunks/{chunk-GE7YXB6N.js → chunk-JTCY7I7A.js} +1 -1
  16. package/build/js/chunks/{chunk-QJK4IOYM.js → chunk-K5PP2E7G.js} +1 -1
  17. package/build/js/chunks/{chunk-KTCC44QW.js → chunk-KTUEXDD4.js} +1 -1
  18. package/build/js/chunks/chunk-KXWJQ7RS.js +1 -0
  19. package/build/js/chunks/chunk-NA3MFO4C.js +1 -0
  20. package/build/js/chunks/{chunk-CCJSWN2G.js → chunk-O7VOH3NR.js} +1 -1
  21. package/build/js/chunks/{chunk-TJR34MLC.js → chunk-WGXK65I5.js} +1 -1
  22. package/build/js/chunks/{chunk-O3GPUK7D.js → chunk-ZAEKVXRS.js} +1 -1
  23. package/build/js/defaults/Defaults.js +1 -1
  24. package/build/js/find/BarcodeFind.js +1 -1
  25. package/build/js/find/BarcodeFindView.js +1 -1
  26. package/build/js/find/index.js +1 -1
  27. package/build/js/index.js +1 -1
  28. package/build/js/moduleLoader.js +1 -1
  29. package/build/js/spark/SparkScan.js +1 -1
  30. package/build/js/spark/index.js +1 -1
  31. package/build/js/spark/ui/SparkScanView.js +1 -1
  32. package/build/js/spark/ui/SparkScanViewMiniPreview.js +1 -1
  33. package/build/js/spark/ui/SparkScanViewPresenter.d.ts +1 -0
  34. package/build/js/spark/ui/SparkScanViewPresenter.js +1 -1
  35. package/build/js/spark/ui/SparkScanViewStateManager.d.ts +1 -0
  36. package/build/js/spark/ui/SparkScanViewTriggerButton.js +1 -1
  37. package/build/js/spark/ui/index.js +1 -1
  38. package/build/js/worker/BarcodeArMode.d.ts +1 -1
  39. package/build/js/worker/BarcodeBatchMode.d.ts +1 -1
  40. package/build/js/worker/BarcodeCaptureMode.d.ts +1 -1
  41. package/build/js/worker/BarcodeCaptureWorkerManager.js +1 -1
  42. package/build/js/worker/BarcodeFindMode.d.ts +1 -1
  43. package/build/js/worker/SparkScanMode.d.ts +1 -1
  44. package/build/js/worker/SparkScanMode.js +1 -1
  45. package/build/js/worker/WorkerMain.d.ts +1 -1
  46. package/build/js/worker/WorkerMain.js +1 -1
  47. package/build/js/worker/barcodeCapture.inlineWorker.js +1 -1
  48. package/build/js/worker/dataCaptureEngine.d.ts +1 -1
  49. package/build/js/worker/dataCaptureEngine.js +1 -1
  50. package/build/js/worker/dataCaptureWorkerRelated.d.ts +6 -3
  51. package/build/js/worker/index.d.ts +1 -1
  52. package/package.json +2 -2
  53. package/sdc-lib/scandit-datacapture-sdk-barcode-pthreads.js +1 -1
  54. package/sdc-lib/scandit-datacapture-sdk-barcode-pthreads.wasm +0 -0
  55. package/sdc-lib/scandit-datacapture-sdk-barcode-simd-pthreads.js +1 -1
  56. package/sdc-lib/scandit-datacapture-sdk-barcode-simd-pthreads.wasm +0 -0
  57. package/sdc-lib/scandit-datacapture-sdk-barcode-simd.js +1 -1
  58. package/sdc-lib/scandit-datacapture-sdk-barcode-simd.wasm +0 -0
  59. package/sdc-lib/scandit-datacapture-sdk-barcode.js +1 -1
  60. package/sdc-lib/scandit-datacapture-sdk-barcode.wasm +0 -0
  61. package/build/js/chunks/chunk-5B6PKKQ6.js +0 -1
  62. package/build/js/chunks/chunk-CSRTYWCJ.js +0 -1
  63. package/build/js/chunks/chunk-KCNBWJYB.js +0 -1
  64. package/build/js/chunks/chunk-UEWQQPHZ.js +0 -1
  65. /package/build/js/chunks/{chunk-SW4KBS3X.js → chunk-CPKZVW3K.js} +0 -0
package/LICENSE CHANGED
@@ -1,4 +1,4 @@
1
- Copyright © 2025 Scandit AG. All Rights Reserved.
1
+ Copyright © 2026 Scandit AG. All Rights Reserved.
2
2
 
3
3
  The use of this software is governed by the Scandit Terms and Conditions.
4
4
  https://ssl.scandit.com/terms/terms.pdf
@@ -85,6 +85,7 @@ declare class SparkScanMode {
85
85
  analyticsManagerPropertyChanged(property: Property): void;
86
86
  successFeedback(): void;
87
87
  selectItemWithSmartScanSelection(): void;
88
+ removeMode(): Promise<void>;
88
89
  protected sparkScanDidScan(session: JSONParseable, frameData: WasmFrameData): void;
89
90
  }
90
91
 
@@ -1 +1 @@
1
- export{a as BarcodeAr}from'../chunks/chunk-JTNWCFEZ.js';
1
+ export{a as BarcodeAr}from'../chunks/chunk-2OIPG3Z2.js';
@@ -1 +1 @@
1
- export{a as BarcodeArFeedback}from'../chunks/chunk-SW4KBS3X.js';
1
+ export{a as BarcodeArFeedback}from'../chunks/chunk-CPKZVW3K.js';
@@ -1 +1 @@
1
- export{a as BarcodeArPresenter}from'../chunks/chunk-KTCC44QW.js';
1
+ export{a as BarcodeArPresenter}from'../chunks/chunk-KTUEXDD4.js';
@@ -1 +1 @@
1
- export{a as BarcodeArView}from'../chunks/chunk-TJR34MLC.js';
1
+ export{a as BarcodeArView}from'../chunks/chunk-WGXK65I5.js';
@@ -1,2 +1,2 @@
1
- import {DataCaptureLoader,Logger}from'@scandit/web-datacapture-core';function i(r){let s=URL.createObjectURL(new Blob(['"use strict";(()=>{var u={"scandit-datacapture-sdk-barcode-pthreads.wasm":{bytes:7772114},"scandit-datacapture-sdk-barcode-simd.wasm":{bytes:7573521},"scandit-datacapture-sdk-barcode-simd-pthreads.wasm":{bytes:7703956},"scandit-datacapture-sdk-barcode.wasm":{bytes:7642031}};function M(t){return typeof t=="object"&&t!=null}function C(t){if(typeof t=="string")return t;if(M(t)){if(typeof t.message=="string")return t.message}else if(typeof(t==null?void 0:t.toString)=="function")return t.toString();return"unknown error"}var c;(t=>{(l=>(l.Debug="debug",l.Info="info",l.Warn="warn",l.Error="error",l.Quiet="quiet"))(t.Level||(t.Level={}));let e=new Map([["debug",1],["info",2],["warn",3],["error",4],["quiet",5]]),a="debug";function r(l){a=l}t.setLevel=r;function i(l,...h){if(!(e.get(a)>e.get(l)))switch(l){case"debug":{console.debug(...h);break}case"info":{console.log(...h);break}case"warn":{console.warn(...h);break}case"error":{console.error(...h);break}}}t.log=i;function s(...l){i("warn",...l)}t.warn=s;function o(...l){i("debug",...l)}t.debug=o;function n(...l){i("info",...l)}t.info=n;function d(...l){i("error",...l)}t.error=d})(c||(c={}));var xe=class{constructor(t){if(typeof t!="function")throw new TypeError("FinalizationRegistry callback must be a function")}register(t,e,a){}unregister(t){return!1}};function ee(t){typeof t.FinalizationRegistry>"u"&&(t.FinalizationRegistry=xe)}var B=class te extends Error{constructor(e){super(e.message),Object.setPrototypeOf(this,te.prototype),this.name=e.name}toString(){return`${this.name}: ${this.message}`}};var x=Promise.resolve(),j=!1,$=!1,k,G={writableDataPath:""};async function ae(t){if(k==null)return;j=!0;let e=new Promise((a,r)=>{setTimeout(()=>{r(new B({name:"BlockedIndexedDB",message:"IndexedDB database is blocked"}))},1500)});try{await Promise.race([new Promise((a,r)=>{k==null||k(t,i=>{if(i!=null){r(i);return}a()})}),e])}finally{j=!1}}async function re(t){return $||(j?($=!0,x=x.then(async()=>($=!1,ae(t)))):x=ae(t)),x}async function ie(t){G=t,k=FS.syncfs,FS.syncfs=((e,a)=>{let r=a,i=()=>{r()},s=o=>{r(o)};re(e).then(i).catch(s)});try{FS.mkdir(G.writableDataPath)}catch(e){if(e.code!=="EEXIST")throw k=void 0,e}return FS.mount(IDBFS,{},G.writableDataPath),re(!0)}var se={};function Pe(t){return[...new Uint8Array(t)].map(e=>{let a=e.toString(16);return a.length===1?`0${a}`:a}).join("")}async function*Ae(t){let e=t.getReader();try{for(;;){let{done:a,value:r}=await e.read();if(a)return;yield r}}finally{e.releaseLock()}}async function Te(t){let e=[],a=0,r=0;for await(let s of Ae(t))e.push(s),a+=s.length;let i=new Uint8Array(a);for(let s of e)i.set(s,r),r+=s.length;return i.buffer}var Oe=(t=>(t.VALID="VALID",t.INVALID="INVALID",t.NOT_VERIFIABLE="NOT_VERIFIABLE",t))(Oe||{});async function Ee(t,e,a){if(typeof crypto.subtle.digest!="function")return c.log(c.Level.Warn,`Insecure context (see https://developer.mozilla.org/en-US/docs/Web/Security/Secure_Contexts): The hash of the Scandit Data Capture library WASM file found at ${a} could not be verified`),"NOT_VERIFIABLE";try{let r=t instanceof Promise?await t:t,i=await crypto.subtle.digest("SHA-256",r),s=Pe(i);return e==null?(c.log(c.Level.Warn,"The library hash is not defined or empty, cannot correctly verify integrity."),"NOT_VERIFIABLE"):s===e?(c.log(c.Level.Debug,`Data Capture library WASM integrity found at ${a} has been verified correctly.`),"VALID"):(c.log(c.Level.Warn,`The Scandit Data Capture library WASM file found at ${a} seems invalid: expected file hash doesn\'t match (received: ${s}, expected: ${e}). Please ensure the correct Scandit Data Capture file (with correct version) is retrieved.`),"INVALID")}catch(r){return c.log(c.Level.Warn,"Wasm response could not be verified",r),"NOT_VERIFIABLE"}}var q=new Map([["br",4.4],["gzip",2.9],["none",1]]);function Le(t){var e;let a="content-encoding";if(t==null||t.get(a)==null)return q.get("none");let r=new Set(((e=t.get(a))!=null?e:"").split(",").map(i=>i.trim()));for(let[i,s]of q)if(r.has(i))return s;return q.get("none")}function We(t){var e,a;if(t==null)return 0;let r=(e=Le(t))!=null?e:1,i=Number.parseInt((a=t.get("content-length"))!=null?a:"0",10);return Number.isNaN(i)?0:Math.floor(i*r*100)/100}function Re(t){let{pathname:e}=new URL(t);for(let[a,r]of Object.entries(se))if(e.endsWith(a))return r.bytes;return 0}function ne(t){se=t}var Ne=(t,e)=>{let a=We(e);return a===0?Re(t):a};function He(t,e,a,{onProgress:r,onError:i,onComplete:s}){if(!e.body)return[e];let o=Ne(t,e.headers),n=0,d=0;if(typeof TransformStream>"u")return c.warn("TransformStream is not supported in this environment. Progress tracking will be disabled."),[e];let[l,h]=a?e.body.tee():[e.body],m=l.pipeThrough(new TransformStream({async transform(g,b){try{n+=g.length,d=Number((n/o*100).toFixed(2)),o>0&&g.length>0&&d<100?r==null||r({percentage:d,loadedBytes:n,privateUri:t}):o===0&&g.length>0&&(r==null||r({percentage:null,loadedBytes:n,privateUri:t})),b.enqueue(g)}catch(w){b.error(w),i==null||i({error:w})}},flush(g){r==null||r({percentage:100,loadedBytes:n,privateUri:t}),s==null||s({percentage:100,loadedBytes:n,privateUri:t}),g.terminate()}}));return[new Response(m,{headers:new Headers(e.headers),status:e.status,statusText:e.statusText}),h]}async function Y({wasmURI:t,expectedHash:e,verifyResponseHash:a,onProgress:r,onComplete:i,onError:s,referredOrigin:o}){let n=await fetch(t,{referrerPolicy:"origin",referrer:o!=null?o:""});if(!n.ok)throw new Error(`HTTP status code is not ok: ${n.status}, ${n.statusText}`);let[d,l]=He(t,n,a,{onProgress:r,onError:s,onComplete:i});return l!=null&&Ee(Te(l),e,t),d}function oe({wasmURI:t,expectedHash:e,verifyResponseHash:a,progressCallback:r,successCallback:i,errorCallback:s,importObject:o,referredOrigin:n}){async function d(h){try{let m=await Y({wasmURI:t,expectedHash:e,verifyResponseHash:a,onProgress:r,referredOrigin:n}),g=await(h!=null?h:m).arrayBuffer(),b=await self.WebAssembly.instantiate(g,o);i(b.instance,b.module)}catch(m){c.log(c.Level.Error,m),c.log(c.Level.Error,`Couldn\'t instantiate Scandit SDK DataCapture library at ${t}, did you configure the path for it correctly?`),s==null||s(m)}}async function l(){let h;try{h=await Y({wasmURI:t,expectedHash:e,verifyResponseHash:a,onProgress:r,referredOrigin:n});let m=await self.WebAssembly.instantiateStreaming(h,o);i(m.instance,m.module)}catch(m){c.log(c.Level.Warn,m),c.log(c.Level.Warn,"WebAssembly streaming compile failed. Falling back to ArrayBuffer instantiation (this will make things slower)"),d((h==null?void 0:h.bodyUsed)===!0?void 0:h)}}typeof self.WebAssembly.instantiateStreaming=="function"?l():d()}async function X(t,e,a,r){return new Promise((i,s)=>{t().then(i).catch(o=>{let n=e*2;if(n>a){s(o);return}r(o),self.setTimeout(()=>{X(t,n,a,r).then(i).catch(s)},e)})})}function K(t){var e,a;let r="unknown";if((e=t.href)!=null&&e.startsWith("blob:null/"))r="localhost";else{let i=((a=t.pathname)==null?void 0:a.length)>1&&!t.pathname.startsWith("/");r=new URL(i?t.pathname:t.origin).hostname}return r.startsWith("[")&&r.endsWith("]")?(r=r.slice(1,-1),r):(/^(\\d{1,3}\\.){3}\\d{1,3}$/.test(r)&&(r=r.split(".").map(i=>Number.parseInt(i,10).toString()).join(".")),r)}async function de(t,e){async function a(){return importScripts(t)}try{await X(a,250,4e3,i=>{c.log(c.Level.Warn,i),c.log(c.Level.Warn,`Couldn\'t retrieve Scandit Data Capture library at ${t}, retrying...`)}),self.Module.mainScriptUrlOrBlob=t;let r=self.SDC_WASM_JS_VERSION;return r!==e&&c.log(c.Level.Warn,`The Scandit Data Capture library JS file found at ${t} seems invalid: expected version doesn\'t match (received: ${r}, expected: ${e}). Please ensure the correct Scandit Data Capture file (with correct version) is retrieved.`),!0}catch(r){return c.log(c.Level.Error,r),!1}}var P=class{constructor(){this.promise=new Promise((t,e)=>{this.reject=e,this.resolve=t})}};var Z=class{constructor(t,e){this.workerFunctions=t,this.options=e,this.imageIdCounter=0,this.conversions=new Map}convertToJpeg(t,e){let a=this.imageIdCounter++,r=new P;this.conversions.set(a,r);let i=t.toBitmap();return this.workerFunctions.postMessage({type:"convertToJPEG",imageId:a,width:t.getWidth(),height:t.getHeight(),data:i,planes:t.getPlanes(),orientation:e,quality:this.options.quality},Array.from(new Set([i.buffer]))),r.promise}onConvertToJPEGResult(t,e){let a=this.conversions.get(t);a?(a.resolve(e),this.conversions.delete(t)):c.warn(`ImageConverterForwarder: Conversion for imageId ${t} not found in Map`)}};var A=class{constructor(t){this.options=t}get quality(){return this.options.quality}async convertToJpeg(t,e){try{let{width:a,height:r,planes:i}=this.validateAndExtractImageData(t);this.prepareCanvas(a,r);let s=this.processImageData(t,i,a,r);return await this.convertToJpegBytes(s,e)}catch(a){throw c.warn(`Failed to convert image to JPEG: ${a}`),a instanceof Error?a:new Error("Failed to convert image to JPEG")}}validateAndExtractImageData(t){let e=t.getWidth(),a=t.getHeight(),r=t.getPlanes();if(e<=0||a<=0)throw c.warn(`Invalid image dimensions: ${e}x${a}`),new Error(`Invalid image dimensions: ${e}x${a}`);if(!r||r.length===0)throw c.warn("ImageBuffer has no planes"),new Error("ImageBuffer has no planes");return{width:e,height:a,planes:r}}prepareCanvas(t,e){if(!this.ensureCanvas(t,e))throw new Error("Failed to create OffscreenCanvas");if(!this.canvas||!this.context)throw new Error("Canvas or context not properly initialized")}processImageData(t,e,a,r){let i=this.createImageDataFromBuffer(t,e,a,r);if(i===null)throw new Error("Failed to create ImageData");return this.validateImageData(i,a,r),i}validateImageData(t,e,a){var r;if(t.width!==e||t.height!==a)throw c.warn(`ImageData dimensions mismatch: expected ${e}x${a}, got ${t.width}x${t.height}`),new Error("ImageData dimensions mismatch");if(!t.data||t.data.length!==e*a*4)throw c.warn(`ImageData has invalid data length: expected ${e*a*4}, got ${((r=t.data)==null?void 0:r.length)||0}`),new Error("ImageData has invalid data length")}async convertToJpegBytes(t,e){if(!this.context||!this.canvas)throw new Error("Canvas or context not available");try{this.context.putImageData(t,0,0)}catch(s){throw c.warn(`Failed to put image data on canvas: ${s}`),new Error(`Failed to put image data on canvas: ${s}`)}let a=e!==0?this.applyRotation(this.canvas,e):this.canvas,r;try{r=await this.canvasToBlob(a)}catch(s){throw c.warn(`Failed to convert canvas to blob: ${s}`),new Error(`Failed to convert canvas to blob: ${s}`)}if(!r||r.size===0)throw c.warn("Canvas convertToBlob returned empty or null blob"),new Error("Failed to create JPEG blob");let i;try{i=await r.arrayBuffer()}catch(s){throw c.warn(`Failed to get array buffer from blob: ${s}`),new Error(`Failed to get array buffer from blob: ${s}`)}if(!i||i.byteLength===0)throw c.warn("Blob arrayBuffer returned empty or null buffer"),new Error("Failed to get array buffer from blob");return new Uint8Array(i)}ensureCanvas(t,e){try{return(!this.canvas||this.canvas.width!==t||this.canvas.height!==e)&&(this.canvas=this.getNewCanvas(t,e),this.context=this.canvas.getContext("2d")),this.context!==null}catch(a){return c.warn("Failed to create HTMLCanvasElement",a),!1}}createImageDataFromBuffer(t,e,a,r){let i=new Set(e.map(s=>s.channel));try{if(this.isYUVFormat(i)){let n=t.toBitmap();return!n||n.length!==a*r*4?(c.warn(`Invalid bitmap data from toBitmap(): expected ${a*r*4} bytes, got ${(n==null?void 0:n.length)||0}`),null):new ImageData(new Uint8ClampedArray(n),a,r)}if(this.isRGBAFormat(i))return this.createImageDataFromRGBAPlanes(e,a,r);if(this.isRGBFormat(i))return this.createImageDataFromRGBPlanes(e,a,r);if(this.isGrayscaleFormat(i))return this.createImageDataFromGrayscalePlanes(e,a,r);c.warn(`Unknown image format with channels: ${Array.from(i).join(", ")}, falling back to toBitmap()`);let s=t.toBitmap();if(!s||s.length===0)return c.warn("toBitmap() returned empty or null data"),null;let o=s.length/(a*r);return o===4?new ImageData(new Uint8ClampedArray(s),a,r):(c.warn(`Unsupported format: ${o} bytes per pixel`),null)}catch(s){return c.warn(`Failed to create ImageData: ${s}`),null}}isYUVFormat(t){return t.has(0)&&t.has(1)&&t.has(2)}isRGBAFormat(t){return t.has(3)&&t.has(4)&&t.has(5)&&t.has(6)}isRGBFormat(t){return t.has(3)&&t.has(4)&&t.has(5)&&!t.has(6)}isGrayscaleFormat(t){return t.has(0)&&!t.has(1)&&!t.has(2)}createImageDataFromRGBAPlanes(t,e,a){let r=t.find(d=>d.channel===3),i=t.find(d=>d.channel===4),s=t.find(d=>d.channel===5),o=t.find(d=>d.channel===6);if(!r||!i||!s||!o)return c.warn("Missing RGBA planes"),null;let n=new Uint8ClampedArray(e*a*4);for(let d=0;d<a;d++)for(let l=0;l<e;l++){let h=(d*e+l)*4;n[h]=this.getPixelFromPlane(r,l,d),n[h+1]=this.getPixelFromPlane(i,l,d),n[h+2]=this.getPixelFromPlane(s,l,d),n[h+3]=this.getPixelFromPlane(o,l,d)}return new ImageData(n,e,a)}createImageDataFromRGBPlanes(t,e,a){let r=t.find(n=>n.channel===3),i=t.find(n=>n.channel===4),s=t.find(n=>n.channel===5);if(!r||!i||!s)return c.warn("Missing RGB planes"),null;let o=new Uint8ClampedArray(e*a*4);for(let n=0;n<a;n++)for(let d=0;d<e;d++){let l=(n*e+d)*4;o[l]=this.getPixelFromPlane(r,d,n),o[l+1]=this.getPixelFromPlane(i,d,n),o[l+2]=this.getPixelFromPlane(s,d,n),o[l+3]=255}return new ImageData(o,e,a)}createImageDataFromGrayscalePlanes(t,e,a){let r=t.find(s=>s.channel===0);if(!r)return c.warn("Missing Y plane for grayscale"),null;let i=new Uint8ClampedArray(e*a*4);for(let s=0;s<a;s++)for(let o=0;o<e;o++){let n=(s*e+o)*4,d=this.getPixelFromPlane(r,o,s);i[n]=d,i[n+1]=d,i[n+2]=d,i[n+3]=255}return new ImageData(i,e,a)}getPixelFromPlane(t,e,a){let r=Math.floor(e/(t.subsamplingX||1)),i=Math.floor(a/(t.subsamplingY||1)),s=t.rowStride,o=t.pixelStride,n=i*s+r*o,d=t.data;return n<d.length?d[n]:0}applyRotation(t,e){let a=e*Math.PI/180,r=e===90||e===270||e===-90||e===-270,i=r?t.height:t.width,s=r?t.width:t.height,o=this.getNewCanvas(i,s),n=o.getContext("2d");if(!n)throw new Error("Failed to get 2D context for rotated canvas");return n.translate(i/2,s/2),n.rotate(a),n.translate(-t.width/2,-t.height/2),n.drawImage(t,0,0),o}};A.JPEG_IMAGE_MIME_TYPE="image/jpeg";var ce=class extends A{getNewCanvas(t,e){return new OffscreenCanvas(t,e)}canvasToBlob(t){return t.convertToBlob({type:A.JPEG_IMAGE_MIME_TYPE,quality:this.options.quality})}};var T;(t=>{function e(){return"8.1.0"}t.sdkVersion=e})(T||(T={}));function _e(t){return/^https?:\\/\\/(?:[^./]*\\.)*cdn.jsdelivr.net\\//.test(t)?{result:!0,cdnBaseURL:"https://cdn.jsdelivr.net/npm/"}:/^https?:\\/\\/(?:[^./]*\\.)*unpkg.com\\//.test(t)?{result:!0,cdnBaseURL:"https://unpkg.com/"}:{result:!1,cdnBaseURL:""}}function ze(t){let e=/@scandit\\/web-datacapture-[a-z]+/i.exec(t);return e?e[0]:null}function le(t,e,a){let r=e,i=_e(r);if(i.result){let o=ze(r);o!=null&&(r=`${i.cdnBaseURL}${o}@${t}/sdc-lib/`)}let s=a.replace(".wasm","");return i.result?{jsURI:`${r}${s}.js`,wasmURI:`${r}${s}.wasm`}:{jsURI:`${r}${s}.js?v=${t}`,wasmURI:`${r}${s}.wasm?v=${t}`}}var ue=class pe{constructor(e,a){this.hintPresenterV2=null,this.MAX_NUMBER_OF_IMAGES_IN_FRAME_DATA_POOL=10,this.redrawInterval=1e3/30,this.redrawRequests=[],this._isDrawLoopRunning=!1,this.frameDataPool=new Map,this.lastFrameColorType="RGBA",this.lastFrameCounter=-1,this.poorMansBenchmarkLogs=!1,this.writableDataPathStandard="/scandit_sync_folder",this.resourceFilesSubfolder="resources",this.performanceMetricsReporterTimer=void 0,this.performanceMetrics={frameDataPoolSize:0,processedFramesCount:0,redrawRequestsCount:0,actualRedrawsCount:0},this.gestureListener=null,this.webPlatformHintPresenter=null,this.moduleHandler=e,this.workerFunctions=a,this._loadProgressCallback=this._loadProgressCallback.bind(this),ne(this.getWasmMetadata())}get Module(){return this.moduleHandler.get()}set isDrawLoopRunning(e){this._isDrawLoopRunning=e,!e&&typeof this.loopTimeoutId=="number"&&(clearTimeout(this.loopTimeoutId),this.loopTimeoutId=void 0)}get isDrawLoopRunning(){return this._isDrawLoopRunning}convertToLoadableFrameData(e){let a=this.getNextFrameId();this.frameDataPool.set(a,{data:new Uint8ClampedArray(e.getFrameData()),colorType:this.lastFrameColorType});let r=this.lastUsedModuleMirrorAxis==null?!1:this.lastUsedModuleMirrorAxis!==this.Module.Axis.None;return{frameId:a,width:e.getWidth(),height:e.getHeight(),isFrameSourceMirrored:r,colorType:this.lastFrameColorType}}createContext(e){var a,r,i,s,o;let n=this.getModeDeserializers(),d=K(location);(d==="localhost"||d==="127.0.0.1")&&navigator.userAgent.includes("Electron")&&e.appName!=null&&(d+=`-${e.appName}`),this.parentDomain=e.parentDomain,this.contextDeserializer=new this.Module.DataCaptureContextDeserializer(this.writableDataPath,e.deviceId,e.context.deviceModelName,d,this.parentDomain,n,e.delayedRegistration,e.highEndBlurryRecognition,this.resourcePath);let l=this.contextDeserializer.contextFromJson(JSON.stringify(e.context));if(l==null){let p=this.contextDeserializer.getLastError();throw new Error(`Could not create the context: ${p}`)}let h=l.getView();this.context=l.getContext(),l.delete();let m=this.Module.DataCaptureContextListener.extend("DataCaptureContextListener",{didChangeStatus:(p,f)=>{this.contextDidChangeStatus(JSON.parse(f.toJson())),p.delete()},didStartObservingContext:p=>{this.didStartObservingContext(),p.delete()},didStopObservingContext:p=>{p.delete()}}),g=this.Module.DataCaptureContextFrameListener.extend("DataCaptureContextFrameListener",{onObservationStarted:p=>{p.delete()},onObservationStopped:p=>{p.delete()},onFrameProcessingStarted:(p,f)=>{this.workerFunctions.postMessage({type:"onFrameProcessingStarted"}),f.delete(),p.delete()},onFrameProcessingFinished:(p,f)=>{this.workerFunctions.postMessage({type:"onFrameProcessingFinished"}),f.delete(),p.delete()},onFrameSkipped:(p,f)=>{this.workerFunctions.postMessage({type:"onFrameSkipped"}),f.delete(),p.delete()}}),b=this.Module.GestureRecognizer.extend("GestureRecognizer",{setGestureListener:(p,f)=>{var F;(F=this.gestureListener)==null||F.delete(),this.gestureListener=p.clone(),p.delete()}});(a=this.gestureRecognizer)==null||a.delete(),this.gestureRecognizer=new b;let w=new m;this.context.addListener(w),w.delete();let v=new g;this.context.addFrameListener(v),v.delete(),this.setView(h),(r=this.view)==null||r.setGestureRecognizer(this.gestureRecognizer);let U=this.Module.PlatformHintPresenter.extend("PlatformHintPresenter",{setHintPresenter:p=>{p.delete()},showToast:p=>{this.workerFunctions.postMessage({type:"showToast",payload:JSON.parse(p)})},hideToast:p=>{this.workerFunctions.postMessage({type:"hideToast",payload:JSON.parse(p)})},showGuidance:p=>{this.workerFunctions.postMessage({type:"showGuidance",payload:JSON.parse(p)})},hideGuidance:p=>{this.workerFunctions.postMessage({type:"hideGuidance",payload:JSON.parse(p)})},startUpdateTimer:p=>{this.workerFunctions.postMessage({type:"startUpdateTimer",payload:{duration:{unit:"ms",value:p}}})},stopUpdateTimer:()=>{this.workerFunctions.postMessage({type:"stopUpdateTimer"})}});(i=this.hintPresenterV2)==null||i.delete(),this.hintPresenterV2=null,(s=this.webPlatformHintPresenter)==null||s.delete(),this.webPlatformHintPresenter=null,this.webPlatformHintPresenter=new U,this.view&&(this.hintPresenterV2=new this.Module.HintPresenterV2(this.webPlatformHintPresenter),(o=this.view)==null||o.setHintPresenterV2(this.hintPresenterV2)),this.webImageConverterInstance=this.getImageConverterInstance({quality:1}),this.Module.ImageConverter.setInstance(this.webImageConverterInstance)}convertToJPEGResult(e,a){this.webImageConverterInstance instanceof Z&&this.webImageConverterInstance.onConvertToJPEGResult(e,a)}getImageConverterInstance(e){return this.workerFunctions.getOffscreenCanvas()!=null?new ce(e):new Z(this.workerFunctions,e)}onTap(e){var a;(a=this.gestureListener)==null||a.onTap(JSON.stringify(e))}hintPresenterV2Update(){var e;(e=this.hintPresenterV2)==null||e.update()}startReportingPerformanceMetrics(){this.performanceMetricsReporterTimer==null&&(this.performanceMetricsReporterTimer=setInterval(()=>{this.reportPerformanceMetrics();for(let e of Object.keys(this.performanceMetrics))this.performanceMetrics[e]=0},1e3))}async reportPerformanceMetrics(){this.workerFunctions.postMessage({type:"performanceMetricsReport",payload:{...this.performanceMetrics}})}deleteFrameData(e){this.frameDataPool.delete(e)}dispose(){var e,a,r,i;this.context.dispose(),this.frameDataPool.clear(),this.isDrawLoopRunning=!1,this.lastFrameCounter=-1,(e=this.gestureRecognizer)==null||e.delete(),this.gestureRecognizer=null,(a=this.gestureListener)==null||a.delete(),this.gestureListener=null,(r=this.hintPresenterV2)==null||r.delete(),this.hintPresenterV2=null,(i=this.webPlatformHintPresenter)==null||i.delete(),this.webPlatformHintPresenter=null}flushAnalytics(){this.context.flushAnalytics()}extractCentaurusLicense(e){return{payload:{centaurus:{licenseKey:this.Module.LicenseUtils[pe.get3dPartyLicenseKeyMethodName](e)}}}}getModeDeserializers(){return new this.Module.VectorDataCaptureModeDeserializer}loadLibrary(e){return this.libraryLoadingPromise!=null?this.libraryLoadingPromise:(this.libraryLoadingPromise=this.setup(e),this.libraryLoadingPromise)}processFrame(e){var a;if(this.context==null)return{payload:e,transferables:[e.data.buffer]};let r=e.data,i=e.colorType==="GRAYSCALE"?this.Module.ImageBufferFormat.Grayscale8:this.Module.ImageBufferFormat.Rgba8888;this.lastFrameColorType=e.colorType==="GRAYSCALE"?"GRAYSCALE":"RGBA";let s=this.Module.allocateUint8Array(r.byteLength);return this.Module.HEAPU8.set(r,s),(a=this.imageFrameSource)==null||a.outputFrame(s,e.width,e.height,i),{payload:e,transferables:[e.data.buffer]}}reportCameraProperties(e){this.context.setCameraProperties(e.deviceId,e.isFrontFacing,e.hasAutofocus)}requestFrameData(e){var a;let{data:r,colorType:i}=(a=this.frameDataPool.get(e))!=null?a:{data:null,colorType:null};return r==null?{payload:{data:null,colorType:null}}:{payload:{data:r,colorType:i},transferables:[r.buffer]}}scheduleRedraw(e,a){this.addRedrawRequest(a),this.isDrawLoopRunning||this.startDrawLoop(e)}sendViewRefreshCommands(e){this.workerFunctions.postMessage({type:"draw",payload:e},[e.buffer])}setFrameSource(e,a){var r;this.lastUsedModuleMirrorAxis=this.mapMirrorAxisOnModule(e),(r=this.imageFrameSource)==null||r.delete(),this.imageFrameSource=new this.Module.ImageBufferFrameSource(this.lastUsedModuleMirrorAxis,a,0),this.context.setFrameSource(this.imageFrameSource)}startDrawLoop(e){this.isDrawLoopRunning=!0;let a=s=>this.redrawRequests.length>0&&this.redrawRequests[0]<=s,r=s=>{for(;this.redrawRequests.length>0&&this.redrawRequests[0]<=s;)this.redrawRequests.shift()},i=()=>{this.loopTimeoutId=setTimeout(()=>{if(!this.isDrawLoopRunning)return;let s=performance.now();if(a(s)){r(s),e.draw();let o=e.getDrawCommands();this.sendViewRefreshCommands(new Uint8Array(o))}i()},this.redrawInterval)};i()}updateContext(e){if(this.context!=null&&this.contextDeserializer!=null){e.view!=null&&!e.view.visible&&this.context.flushAnalytics();let a=this.onBeforeUpdateContextHook(e),r=this.contextDeserializer.updateContextFromJson(this.context,this.view,JSON.stringify(a.context));if(r==null){let s=this.contextDeserializer.getLastError();throw new Error(`Could not update the context: ${s}`)}this.context.delete(),this.context=r.getContext();let i=r.getView();r.delete(),i!=null&&a.view!=null&&i.setViewSize(a.view.width,a.view.height,a.view.orientation),!this.hintPresenterV2&&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),c.debug("context updated",a)}}onBeforeUpdateContextHook(e){return e}onDocumentVisibilityChange(e){e==="hidden"&&this.context.flushAnalytics()}isFeatureSupported(e){return{payload:{supported:this.context.isFeatureSupported(e)}}}getViewfinderInfo(){var e,a;return{payload:{isDisplayingViewfinder:(a=(e=this.view)==null?void 0:e.isDisplayingViewfinder())!=null?a:!1,rect:JSON.parse(this.view.getViewfinderRect())}}}getOpenSourceSoftwareLicenseInfo(){return{payload:{licenseText:this.Module.OpenSourceSoftwareLicenseInfo.getLicenseText()}}}getNextFrameId(){return this.lastFrameCounter++,this.lastFrameCounter>=this.MAX_NUMBER_OF_IMAGES_IN_FRAME_DATA_POOL&&(this.lastFrameCounter=0),this.lastFrameCounter}getWasmDynamicLibraries(e){return this.getWasmSideModuleFileName()==null?[]:[`${e.replace(/\\/[^/]*$/,"/")}${this.getWasmSideModuleFileName()}`]}getWasmCoreExpectedHash(e,a){return a?e?"3686364e70dd4f1095b6385721eb6f2afc35e4c95e8e43a0d33e2565f8c0e3c6":"c0ad7dd2e21fb730080c7a70baf2f789800c108f5e6a82bf35f42079c6108345":e?"c2baefa2a14e6e83699f5123df3bee385e258b43485de3ae503c1df9a9053573":""}getWasmCoreFileName(e,a){return a?e?"scandit-datacapture-sdk-barcode-simd-pthreads.wasm":"scandit-datacapture-sdk-barcode-pthreads.wasm":e?"scandit-datacapture-sdk-barcode-simd.wasm":""}getWasmMetadata(){return u}getWasmSideModuleFileName(){return""}_loadProgressCallback(e){this.workerFunctions.postMessage({type:"loadLibraryProgress",payload:e})}addRedrawRequest(e){this.redrawRequests.push(Math.round(performance.now())+e),this.redrawRequests.sort((a,r)=>a-r)}contextDidChangeStatus(e){e.code===260?e.message=e.message.replace("domain name",`domain name (${K(location)})`):e.code===265&&(e.message=e.message.replace("domain name",`domain name (${this.parentDomain})`)),this.workerFunctions.postMessage({type:"contextDidChangeStatus",payload:e})}didStartObservingContext(){this.workerFunctions.postMessage({type:"didStartObservingContext"})}mapMirrorAxisOnModule(e){switch(e){case"None":return this.Module.Axis.None;case"X":return this.Module.Axis.X;case"Y":return this.Module.Axis.Y;default:return this.Module.Axis.None}}setView(e){this.view=e,this.setViewRefreshHandler(e),e==null&&(this.isDrawLoopRunning=!1,this.sendViewRefreshCommands(new Uint8Array([])))}addNativeOverlay(e){c.warn("addNativeOverlay has not been implemented for this module",e)}removeNativeOverlay(e){c.warn("removeNativeOverlay has not been implemented for this module",e)}setViewRefreshHandler(e){if(e==null||e.isViewRefreshHandlerSet)return;let a=this.Module.NeedsRedrawDelegate.extend("NeedsRedrawDelegate",{setNeedsRedrawIn:this.scheduleRedraw.bind(this,e)}),r=new a;e.setNeedsRedrawDelegate(r),e.isViewRefreshHandlerSet=!0}setupDataDecoding(){let e=this.moduleHandler.get(),a=e.DataDecoding.extend("DataDecoding",{decode(r,i){try{let s=JSON.parse(i),o=[];for(let n of s){let d=new TextDecoder(n.ianaName,{fatal:!0});o.push(d.decode(r.slice(n.startIndex,n.endIndex)))}return o.join("")}catch{return""}}});e.setDataDecoding(new a)}start(e,a,r){e&&a&&(this.setupDataDecoding(),this.moduleHandler.get().callMain(),this.moduleHandler.get().__emscripten_proxy_main!==void 0||r())}getWritableDataPath(e){return e!=null?(c.debug(`IndexedDB database name override in use to recover from blocked standard database: ${e}`),e):this.writableDataPathStandard}numOfMBToPages(e){return Math.ceil(1024*e*1024/64/1024)}async setup({libraryLocation:e,locationPath:a,writableDataPathOverride:r,verifyResponseHash:i,referredOrigin:s,fixedWasmMemory:o,simdSupport:n,threadsSupport:d}){var l;let h=!1,m=!1;this.writableDataPath=this.getWritableDataPath(r),this.resourcePath=`${e}${this.resourceFilesSubfolder}/`,self.path=a;let{resolve:g,reject:b,promise:w}=new P,v=T.sdkVersion();if(v==="")throw new B({name:"Invalid library version",message:"Library version is not defined or empty, cannot generate proper path to library files."});let U=this.getWasmCoreFileName(n,d),p=le(v,e,U),{jsURI:f,wasmURI:F}=p,ke={instantiateWasm:(y,De)=>(oe({importObject:y,wasmURI:F,expectedHash:this.getWasmCoreExpectedHash(n,d),verifyResponseHash:i,successCallback:De,progressCallback:this._loadProgressCallback,errorCallback:Ie=>{b(Ie)},referredOrigin:s}),{})},I=o===null?null:new WebAssembly.Memory({initial:this.numOfMBToPages(o),maximum:this.numOfMBToPages(300),shared:d});return I!==null&&c.log(c.Level.Debug,"Fixed wasmMemory set",I),this.moduleHandler.set({...I?{wasmMemory:I}:{},mainScriptUrlOrBlob:f,canvas:(l=this.workerFunctions.getOffscreenCanvas())!=null?l:{getContext:()=>null},...ke,dynamicLibraries:this.getWasmDynamicLibraries(F),locateFile:y=>e+y,noInitialRun:!0,preRun:[async()=>{try{await ie({writableDataPath:this.writableDataPath})}catch(y){if(y.name==="BlockedIndexedDB"){b(y.toString());return}c.log(c.Level.Debug,"No IndexedDB support, some data will not be persisted:",y)}m=!0,this.start(m,h,g)}],onMainComplete:()=>{if([h,m].includes(!1)){c.log(c.Level.Warn,{runtimeLoaded:h,fileSystemSynced:m},"Both runtimeLoaded and fileSystemSynced should be true when calling onMainComplete"),b("onMainComplete has been called but runtime or file system was not ready.");return}g()},onRuntimeInitialized:()=>{h=!0,this.start(m,h,g)},print:y=>{c.log(c.Level.Info,y)}}),await de(f,v)||b(`Couldn\'t retrieve Scandit Data Capture library at ${f}, did you configure the path for it correctly?`),w}};ue.get3dPartyLicenseKeyMethodName=atob("Z2V0QmxpbmtJZExpY2Vuc2VLZXk=");var D=ue;function he(t){return typeof t=="object"&&t!=null&&t.document==null&&"addEventListener"in t&&typeof t.importScripts=="function"}function me(t){console.warn("Reached unexpected case",t)}var Q=class{constructor(t,e){this.onMessageListener=this.onMessage.bind(this),this.workerSelf=t,this.dataCaptureInstance=new D(e,{postMessage:this.postMessage.bind(this),getOffscreenCanvas:this.getOffscreenCanvas.bind(this)}),he(t)&&(ee(t),this.listenToMessages())}listenToMessages(){this.workerSelf.addEventListener("message",this.onMessageListener),this.workerSelf.addEventListener("error",t=>{c.log(c.Level.Error,t)}),this.workerSelf.addEventListener("messageerror",t=>{c.log(c.Level.Error,t)})}postMessage(t,e){this.workerSelf.postMessage(t,e!=null?e:[])}getOffscreenCanvas(){if(this.isOffscreenCanvasSupported())return new this.workerSelf.OffscreenCanvas(32,32)}isOffscreenCanvasSupported(){return typeof this.workerSelf.OffscreenCanvas=="function"}hasPayload(t){return M(t)&&"payload"in t}hasTransferables(t){return M(t)&&Array.isArray(t.transferables)}async respondWith(t,e,a){let r=null,i;try{i=a(),i instanceof Promise&&(i=await i)}catch(o){i=void 0,r=C(o)}let s={type:"workerTaskId",command:t,id:e,payload:this.hasPayload(i)?i.payload:void 0};r!=null&&(s.error=r),this.postMessage(s,this.hasTransferables(i)?i.transferables:[])}onMessage(t){switch(t.data.command){case"loadLibrary":{{let{data:e}=t;this.respondWith(e.command,e.id,async()=>this.dataCaptureInstance.loadLibrary({libraryLocation:e.libraryLocation,locationPath:e.locationPath,referredOrigin:e.referredOrigin,writableDataPathOverride:e.writableDataPathOverride,threadsSupport:e.threadsSupport,simdSupport:e.simdSupport,verifyResponseHash:e.verifyResponseHash,fixedWasmMemory:e.fixedWasmMemory}))}break}case"onTap":{{let{data:e}=t;this.respondWith(e.command,e.id,async()=>{this.dataCaptureInstance.onTap(e.point)})}break}case"hintPresenterV2update":{{let{data:e}=t;this.respondWith(e.command,e.id,async()=>{this.dataCaptureInstance.hintPresenterV2Update()})}break}case"createContext":{{let{data:e}=t;this.respondWith(e.command,e.id,()=>this.dataCaptureInstance.createContext({context:e.context,deviceId:e.deviceId,delayedRegistration:e.delayedRegistration,highEndBlurryRecognition:e.highEndBlurryRecognition,appName:e.appName,parentDomain:e.parentDomain}))}break}case"setFrameSource":{{let{data:e}=t;this.respondWith(e.command,e.id,()=>this.dataCaptureInstance.setFrameSource(e.mirrorAxis,e.isCameraFrameSource))}break}case"processFrame":{{let{data:e}=t;this.respondWith(e.command,e.id,()=>this.dataCaptureInstance.processFrame({data:e.data,width:e.width,height:e.height,colorType:e.colorType}))}break}case"requestFrameData":{{let{data:e}=t;this.respondWith(e.command,e.id,()=>this.dataCaptureInstance.requestFrameData(e.frameId))}break}case"deleteFrameData":{{let{data:e}=t;this.respondWith(e.command,e.id,()=>{this.dataCaptureInstance.deleteFrameData(e.frameId)})}break}case"updateContext":{{let{data:e}=t;this.respondWith(e.command,e.id,async()=>this.dataCaptureInstance.updateContext(e))}break}case"dispose":{this.respondWith(t.data.command,t.data.id,()=>this.dataCaptureInstance.dispose());break}case"flushAnalytics":{this.respondWith(t.data.command,t.data.id,()=>{this.dataCaptureInstance.flushAnalytics()});break}case"reportCameraProperties":{{let{data:e}=t;this.respondWith(e.command,e.id,async()=>this.dataCaptureInstance.reportCameraProperties(e))}break}case"setLogLevel":{{let{data:e}=t;this.respondWith(e.command,e.id,()=>{c.setLevel(e.level)})}break}case"extractCentaurusLicense":{{let{data:e}=t;this.respondWith(e.command,e.id,()=>this.dataCaptureInstance.extractCentaurusLicense(e.licenseKey))}break}case"documentVisibility":{{let{data:e}=t;this.respondWith(e.command,e.id,()=>{this.dataCaptureInstance.onDocumentVisibilityChange(e.state)})}break}case"isFeatureSupported":{{let{data:e}=t;this.respondWith(e.command,e.id,()=>this.dataCaptureInstance.isFeatureSupported(e.feature))}break}case"getViewfinderInfo":{{let{data:e}=t;this.respondWith(e.command,e.id,()=>this.dataCaptureInstance.getViewfinderInfo())}break}case"getOpenSourceSoftwareLicenseInfo":{{let{data:e}=t;this.respondWith(e.command,e.id,()=>this.dataCaptureInstance.getOpenSourceSoftwareLicenseInfo())}break}case"addNativeOverlay":this.dataCaptureInstance.addNativeOverlay(t);break;case"removeNativeOverlay":this.dataCaptureInstance.removeNativeOverlay(t);break;case"convertToJPEGResult":{{let{data:e}=t;this.dataCaptureInstance.convertToJPEGResult(e.imageId,e.result)}break}default:return me(t.data),!1}return!0}};var ge=(t=>(t.Body="body",t.Footnote="footnote",t))(ge||{}),O=(t=>(t.Start="start",t.Center="center",t.End="end",t))(O||{}),be=(t=>(t.Normal="normal",t.Wider="wider",t.FitText="fitText",t))(be||{}),fe=(t=>(t.Normal="normal",t.Taller="taller",t))(fe||{}),ye=(t=>(t.Square="square",t.Rounded="rounded",t))(ye||{}),E=(t=>(t.None="none",t.Check="check",t.ExclamationMark="exclamationMark",t))(E||{}),L=(t=>(t.Top="top",t.AboveViewFinder="aboveViewFinder",t.BelowViewFinder="belowViewFinder",t))(L||{}),Se=(t=>(t.AboveViewFinder="aboveViewFinder",t.BelowViewFinder="belowViewFinder",t))(Se||{}),we=(t=>(t.BlackOnWhite="blackOnWhite",t.WhiteOnBlack="whiteOnBlack",t.Transparent="transparent",t))(we||{}),ve=(t=>(t.Success="success",t.Error="error",t.Warning="warning",t.Info="info",t.Notification="notification",t))(ve||{}),Fe=(t=>(t[t.Ocr=0]="Ocr",t[t.HideLogo=1]="HideLogo",t[t.ShowTestLicenseMessage=2]="ShowTestLicenseMessage",t[t.AugmentedReality=5]="AugmentedReality",t[t.ActivityPingStatsAddon=8]="ActivityPingStatsAddon",t[t.ActivityPing=9]="ActivityPing",t[t.Registration=10]="Registration",t[t.Parser=11]="Parser",t[t.BarcodeCapture=14]="BarcodeCapture",t[t.Analytics=17]="Analytics",t[t.AnalyticsBatchMode=18]="AnalyticsBatchMode",t[t.AnalyticsScanContent=19]="AnalyticsScanContent",t[t.AnalyticsOnlineVerification=20]="AnalyticsOnlineVerification",t[t.SparkScan=21]="SparkScan",t[t.AamvaIdBarcodeVerification=22]="AamvaIdBarcodeVerification",t[t.MappingForTracking=23]="MappingForTracking",t[t.BarcodeFind=24]="BarcodeFind",t[t.MandatoryRegistration=25]="MandatoryRegistration",t[t.FeatureTracking=26]="FeatureTracking",t[t.IdCaptureViz=27]="IdCaptureViz",t[t.IdCaptureMrz=28]="IdCaptureMrz",t[t.IdCaptureBarcode=29]="IdCaptureBarcode",t[t.BarcodeSelectionAimToScan=30]="BarcodeSelectionAimToScan",t[t.BarcodeSelectionTapToScan=31]="BarcodeSelectionTapToScan",t[t.BarcodeCount=32]="BarcodeCount",t[t.BarcodePick=33]="BarcodePick",t[t.IdVerificationDataComparison=34]="IdVerificationDataComparison",t[t.SmartLabelBarcode=35]="SmartLabelBarcode",t[t.SmartLabelText=36]="SmartLabelText",t[t.VoidedIdDetection=37]="VoidedIdDetection",t[t.BarcodeArFull=38]="BarcodeArFull",t[t.BarcodeSequence=39]="BarcodeSequence",t))(Fe||{});var W=class{constructor(e,a,r){this.barcodeAr=null;this.coreEngine=e,this.Module=a,this.workerFunctions=r}async forSettings(e){var r;(r=this.barcodeAr)==null||r.delete(),this.barcodeAr=new this.Module.BarcodeAr(this.coreEngine.context,JSON.stringify(e));let a=this.Module.BarcodeArListener.extend("BarcodeArListener",{didUpdateSession:(i,s,o)=>{let n=this.coreEngine.convertToLoadableFrameData(o);this.workerFunctions.postMessage({type:"barcodeArDidUpdateSession",payload:{session:JSON.parse(s.toJson()),frameData:n}}),i.delete(),s.delete(),o.delete()}});this.barcodeAr.addListener(new a,1),this.Module.addBarcodeArToContext(this.coreEngine.context,this.barcodeAr)}start(){var e;(e=this.barcodeAr)==null||e.start()}pause(){var e;(e=this.barcodeAr)==null||e.pause()}stop(){var e;(e=this.barcodeAr)==null||e.stop()}setEnabled(e){var a;(a=this.barcodeAr)==null||a.setEnabled(e)}async removeMode(){this.barcodeAr!=null&&this.Module.removeBarcodeArFromContext(this.coreEngine.context,this.barcodeAr)}applySettings(e){var a;(a=this.barcodeAr)==null||a.applySettings(JSON.stringify(e))}};var R=class{constructor(e,a,r){this.trackingListenerSet=!1;this.coreEngine=e,this.Module=a,this.workerFunctions=r,this.setup()}barcodeBatchDidUpdateSession(e){this.workerFunctions.postMessage({type:"barcodeBatchDidUpdateSession",payload:JSON.parse(e.toJson())})}getBatchDeserializer(){return this.barcodeBatchDeserializer}setup(){let e=this.Module.BarcodeBatchListener.extend("BarcodeTrackingListener",{didUpdateSession:(r,i,s)=>{this.barcodeBatchDidUpdateSession(i),r.delete(),i.delete(),s.delete()},onTrackedBarcodeTapped:(r,i)=>{this.onTrackedBarcodeTapped(i),r.delete(),i.delete()}}),a=this.Module.BarcodeBatchDeserializerListener.extend("BarcodeTrackingDeserializerListener",{onModeDeserializationFinished:(r,i,s)=>{this.trackingListenerSet||(i.addListener(new e,1),this.trackingListenerSet=!0),r.delete(),i.delete(),s.delete()},onModeDeserializationStarted(r,i,s){r.delete(),i.delete(),s.delete()},onSettingsDeserializationStarted(r,i,s){r.delete(),i.delete(),s.delete()},onSettingsDeserializationFinished(r,i,s){r.delete(),i.delete(),s.delete()}});this.barcodeBatchDeserializer=new this.Module.BarcodeBatchDeserializer,this.barcodeBatchDeserializer.setListener(new a)}onTrackedBarcodeTapped(e){this.workerFunctions.postMessage({type:"didTapTrackedBarcode",payload:JSON.parse(e.toJson())})}};var N=class{constructor(e,a,r){this.captureListenerSet=!1;this.coreEngine=e,this.Module=a,this.workerFunctions=r,this.setup()}barcodeCaptureDidUpdateSession(e){this.workerFunctions.postMessage({type:"barcodeCaptureDidUpdateSession",payload:JSON.parse(e.toJson())})}barcodeBatchDidUpdateSession(e){this.workerFunctions.postMessage({type:"barcodeBatchDidUpdateSession",payload:JSON.parse(e.toJson())})}getCaptureDeserializer(){return this.barcodeCaptureDeserializer}getTrackingDeserializer(){return this.barcodeBatchDeserializer}setup(){let e=this.Module.BarcodeCaptureListener.extend("BarcodeCaptureListener",{didScan:(o,n,d)=>{this.barcodeCaptureDidScan(n,d),o.delete(),d.delete(),n.delete()},didUpdateSession:(o,n,d)=>{this.barcodeCaptureDidUpdateSession(n),o.delete(),d.delete(),n.delete()}}),a=this.Module.Feedback.extend("Feedback",{emit:()=>{this.successFeedback()}}),r=new e,i=new a,s=this.Module.BarcodeCaptureDeserializerListener.extend("BarcodeCaptureDeserializerListener",{onModeDeserializationFinished:(o,n,d)=>{n.addListener(r,1),n.setSuccessFeedback(i),o.delete(),n.delete(),d.delete()},onModeDeserializationStarted(o,n,d){o.delete(),n.delete(),d.delete()},onSettingsDeserializationStarted(o,n,d){o.delete(),n.delete(),d.delete()},onSettingsDeserializationFinished(o,n,d){o.delete(),n.delete(),d.delete()}});this.barcodeCaptureDeserializer=new this.Module.BarcodeCaptureDeserializer,this.barcodeCaptureDeserializer.setListener(new s)}successFeedback(){this.workerFunctions.postMessage({type:"successFeedback"})}barcodeCaptureDidScan(e,a){let r=this.coreEngine.convertToLoadableFrameData(a);this.workerFunctions.postMessage({type:"barcodeCaptureDidScan",payload:{session:JSON.parse(e.toJson()),frameData:r}})}};function Je(t){return t.charAt(0).toUpperCase()+t.slice(1)}function Me(t){return t}var H=class{constructor(e,a,r){this.barcodeFind=null;this.basicOverlay=null;this.transparentGuidanceHintStyle={backgroundColor:"00000000",cornerRadius:4,fitToText:!1,isAnimatedToView:!1,textAlignment:O.Center,hintIcon:E.None,hintAnchor:L.AboveViewFinder,hintAnchorOffset:-12,horizontalMargin:0,iconColor:"00000000",lineHeight:-1,maxLines:1,maxWidthFraction:.8,textColor:"ffffffff",textSize:15,textWeight:600};this.customerTransformation=Me;this.coreEngine=e,this.Module=a,this.workerFunctions=r}async forSettings(e){var o;(o=this.barcodeFind)==null||o.delete(),this.barcodeFind=new this.Module.BarcodeFind(this.coreEngine.context,JSON.stringify(e));let a=this.Module.Feedback.extend("Feedback",{emit:()=>{this.listUpdatedFeedback()}}),r=this.Module.Feedback.extend("Feedback",{emit:()=>{this.barcodeFindFeedback()}}),i=this.Module.BarcodeFindTransformer.extend("BarcodeFindTransformer",{transformBarcodeData:n=>this.customerTransformation(n)}),s=this.Module.BarcodeFindListener.extend("BarcodeFindListener",{didUpdateSession:(n,d,l)=>{let h=this.coreEngine.convertToLoadableFrameData(l);this.workerFunctions.postMessage({type:"barcodeFindDidUpdateSession",payload:{session:JSON.parse(d.toJson()),frameData:h}}),n.delete(),d.delete(),l.delete()},onSearchPaused:n=>{let d=[];for(let l=0;l<n.size();l++)d.push(n.get(l));this.workerFunctions.postMessage({type:"barcodeFindSearchPaused",payload:{foundItems:d}})},onSearchStopped:n=>{let d=[];for(let l=0;l<n.size();l++)d.push(n.get(l));this.workerFunctions.postMessage({type:"barcodeFindSearchStopped",payload:{foundItems:d}})},onSearchStarted:()=>{this.workerFunctions.postMessage({type:"barcodeFindSearchStarted",payload:{}})}});this.barcodeFind.setBarcodeFindTransformer(new i),this.barcodeFind.addListener(new s,1),this.barcodeFind.setItemListUpdatedFeedback(new a),this.barcodeFind.setFeedback(new r),this.Module.addBarcodeFindToContext(this.coreEngine.context,this.barcodeFind)}barcodeFindFeedback(){this.workerFunctions.postMessage({type:"barcodeFindFeedback",payload:{}})}start(){var e;(e=this.barcodeFind)==null||e.start()}stop(){var e;(e=this.barcodeFind)==null||e.stop()}pause(){var e;(e=this.barcodeFind)==null||e.pause()}setEnabled(e){var a;(a=this.barcodeFind)==null||a.setEnabled(e)}setItemList(e){var a;(a=this.barcodeFind)==null||a.setItemList(JSON.stringify(e))}async removeMode(){this.barcodeFind!=null&&this.Module.removeBarcodeFindFromContext(this.coreEngine.context,this.barcodeFind)}addBasicOverlay(){var e;(e=this.basicOverlay)==null||e.delete(),this.basicOverlay=null,this.barcodeFind!=null&&(this.basicOverlay=new this.Module.BarcodeFindBasicOverlay(this.barcodeFind)),this.coreEngine.view!=null&&this.basicOverlay!=null&&(this.basicOverlay.setGuidanceHandler(this.createWebFindGuidanceHandler()),this.Module.addBarcodeFindBasicOverlayToView(this.coreEngine.view,this.basicOverlay))}removeBasicOverlay(){this.coreEngine.view!=null&&this.basicOverlay!=null&&this.Module.removeBarcodeFindBasicOverlayFromView(this.coreEngine.view,this.basicOverlay)}async applySettings(e){var a;(a=this.barcodeFind)==null||a.applySettings(JSON.stringify(e))}updateBasicOverlay(e){let a=Object.entries(e).filter(([r,i])=>r!=="type");for(let[r,i]of a){let s=`set${Je(r)}`;this.basicOverlay!=null&&typeof this.basicOverlay[s]=="function"&&i!=null&&this.basicOverlay[s](i)}}setTransformerFunction(e){this.customerTransformation=e!=null?e:Me}successFeedback(){this.workerFunctions.postMessage({type:"successFeedback"})}listUpdatedFeedback(){this.workerFunctions.postMessage({type:"barcodeFindListUpdatedFeedback",payload:{}})}setToast(e,a){let r=this.coreEngine.hintPresenterV2;e?r==null||r.showToast(JSON.stringify(a)):r==null||r.hideToast(a.tag)}setGuidance(e,a,r){let i={tag:r,text:a,hintStyle:this.transparentGuidanceHintStyle};this.workerFunctions.postMessage({type:e?"showGuidance":"hideGuidance",payload:i})}createWebFindGuidanceHandler(){let e=this.Module.BarcodeFindGuidanceHandler.extend("BarcodeFindGuidanceHandler",{setInitialGuidance:(a,r)=>{this.setGuidance(a,r,"InitialGuidance")},setMoveCloserGuidance:(a,r)=>{this.setGuidance(!1,r,"InitialGuidance"),this.setGuidance(a,r,"MoveCloserGuidance")},setTapShutterToPause:(a,r)=>{this.setGuidance(!1,r,"InitialGuidance"),this.setGuidance(a,r,"TapShutterToPause")},setTapShutterToResume:(a,r)=>{this.setGuidance(!1,r,"InitialGuidance"),this.setGuidance(a,r,"TapShutterResume")}});return new e}};var S=class{constructor(e){this.subscribers=new Set;this.property={key:e,value:null}}addSubscriber(e){var a;this.subscribers.add(e),(a=e.onPropertyChanged)==null||a.call(e,this.property)}removeSubscriber(e){this.subscribers.delete(e)}setProperty(e){var a;if(this.property.value!==e.value){this.property={key:this.property.key,value:e.value};for(let r of this.subscribers)(a=r.onPropertyChanged)==null||a.call(r,this.property)}}};var Ve={torch_state:new S("torch_state"),scanning_mode:new S("scanning_mode"),sound_enabled:new S("sound_enabled"),haptic_enabled:new S("haptic_enabled"),session_stop_reason:new S("session_stop_reason"),camera_position:new S("camera_position")},_=class{getBehaviorSubject(e){return Ve[e]}};var z=class{constructor(e,a,r){this.captureListenerSet=!1;this.propertyPushSource=new _;this.coreEngine=e,this.Module=a,this.workerFunctions=r,this.setup()}sparkScanDidUpdateSession(e){this.workerFunctions.postMessage({type:"sparkScanDidUpdateSession",payload:JSON.parse(e.toJson())})}getSparkScanDeserializer(){return this.sparkScanDeserializer}setup(){let e=this.Module.SparkScanListener.extend("SparkScanListener",{didScan:(i,s,o)=>{this.sparkScanDidScan(s,o),i.delete(),s.delete(),o.delete()},didUpdateSession:(i,s,o)=>{this.sparkScanDidUpdateSession(s),i.delete(),s.delete(),o.delete()}}),a=this.Module.Feedback.extend("Feedback",{emit:()=>{this.successFeedback()}}),r=this.Module.SparkScanDeserializerListener.extend("SparkScanDeserializerListener",{onModeDeserializationFinished:(i,s,o)=>{if(!this.captureListenerSet){s.addListener(new e,1),s.setSuccessFeedback(new a),s.setPropertyPushSource(this.propertyPushSource);let n=this.Module.SparkScanViewHandlerDelegate.extend("SparkScanViewHandlerDelegate",{onSwitchedAwayFromSmartScanSelection:()=>{this.workerFunctions.postMessage({type:"sparkScanSwitchedAwayFromSmartScanSelection"})},onSwitchedToSmartScanSelection:()=>{this.workerFunctions.postMessage({type:"sparkScanSwitchedToSmartScanSelection"})},enableHapticWhenOverlapping:()=>{},onStateTransition:()=>{},resetAllTimers:()=>{}}),d=new n,l=s.getStateMachine();l.setViewHandlerDelegate(d),d.delete(),l.delete(),this.sparkScan=s.clone(),this.captureListenerSet=!0}i.delete(),o.delete(),s.delete()},onModeDeserializationStarted(i,s,o){i.delete(),s.delete(),o.delete()},onSettingsDeserializationStarted(i,s,o){i.delete(),s.delete(),o.delete()},onSettingsDeserializationFinished(i,s,o){i.delete(),s.delete(),o.delete()},onOverlayDeserializationStarted(i,s,o){i.delete(),s.delete(),o.delete()},onOverlayDeserializationFinished:(i,s,o)=>{var n;(n=this.sparkScanOverlay)==null||n.delete(),this.sparkScanOverlay=s,i.delete(),o.delete()}});this.sparkScanDeserializer=new this.Module.SparkScanDeserializer,this.sparkScanDeserializer.setListener(new r)}emitErrorFeedback(e){var a;(a=this.sparkScanOverlay)==null||a.onErrorFeedbackEmitted(e)}overlayReadyForDraw(){var e;(e=this.sparkScanOverlay)==null||e.onReadyForNewData()}analyticsManagerPropertyChanged(e){this.propertyPushSource.getBehaviorSubject(e.key).setProperty(e)}successFeedback(){this.workerFunctions.postMessage({type:"successFeedback"})}selectItemWithSmartScanSelection(){var e;(e=this.sparkScan)==null||e.selectItemWithSmartScanSelectionAsync()}sparkScanDidScan(e,a){let r=this.coreEngine.convertToLoadableFrameData(a);this.workerFunctions.postMessage({type:"sparkScanDidScan",payload:{session:JSON.parse(e.toJson()),frameData:r}})}};var J=class extends D{constructor(e,a){super(e,a)}getModeDeserializers(){this.barcodeCaptureMode=new N(this,this.Module,this.workerFunctions),this.barcodeBatchMode=new R(this,this.Module,this.workerFunctions),this.sparkScanMode=new z(this,this.Module,this.workerFunctions),this.barcodeFindMode=new H(this,this.Module,this.workerFunctions),this.barcodeArMode=new W(this,this.Module,this.workerFunctions);let e=super.getModeDeserializers();return e.push_back(this.barcodeCaptureMode.getCaptureDeserializer()),e.push_back(this.barcodeBatchMode.getBatchDeserializer()),e.push_back(this.sparkScanMode.getSparkScanDeserializer()),e}getWasmSideModuleFileName(){return""}getWasmCoreFileName(e,a){return a?e?"scandit-datacapture-sdk-barcode-simd-pthreads.wasm":"scandit-datacapture-sdk-barcode-pthreads.wasm":e?"scandit-datacapture-sdk-barcode-simd.wasm":"scandit-datacapture-sdk-barcode.wasm"}getWasmCoreExpectedHash(e,a){return a?e?"3686364e70dd4f1095b6385721eb6f2afc35e4c95e8e43a0d33e2565f8c0e3c6":"c0ad7dd2e21fb730080c7a70baf2f789800c108f5e6a82bf35f42079c6108345":e?"c2baefa2a14e6e83699f5123df3bee385e258b43485de3ae503c1df9a9053573":"42dad7facf67aba54886d951a961b6015fadd87beaad354995e5e666a2ed7c93"}getWasmMetadata(){return u}};function Ue(t){return(a=>/^[$A-Z_a-z][\\w$]*\\s*\\(.*\\)\\s*\\{/.test(a)&&!a.startsWith("function"))(t)?`function ${t}`:t}var $e=["fetch","XMLHttpRequest","eval","Function","self","globalThis","Module","importScripts","this","console","window","document","import","Worker","ServiceWorker"];function Ge(t){return $e.map(a=>new RegExp(`\\\\b${a}\\\\b`,"g")).some(a=>a.test(t))}function Ce(t){if(t==null)return null;let e=Ue(t);if(Ge(e))throw new Error("Function should be pure. Shouldn\'t introduce side effects, or rely on global scope");let a=`\'use strict\';\n return (${e});`;try{return new Function(a)()}catch{return null}}var V=class extends Q{constructor(e,a){super(e,a),this.dataCaptureInstance=new J(a,{postMessage:this.postMessage.bind(this),getOffscreenCanvas:this.getOffscreenCanvas.bind(this)})}async respondWith(e,a,r){let i=null,s;try{s=r(),s instanceof Promise&&(s=await s)}catch(n){s=void 0,i=C(n)}let o={type:"workerTaskId",command:e,id:a,payload:this.hasPayload(s)?s.payload:void 0};i!=null&&(o.error=i),this.postMessage(o,this.hasTransferables(s)?s.transferables:[])}onMessage(e){switch(e.data.command){case"sparkScanEmitErrorFeedback":{let{data:a}=e;return this.respondWith(a.command,a.id,()=>{this.dataCaptureInstance.sparkScanMode.emitErrorFeedback(a.shouldRemoveBrush)}),!0}case"sparkScanOverlayReadyForDraw":{let{data:a}=e;return this.respondWith(a.command,a.id,()=>{this.dataCaptureInstance.sparkScanMode.overlayReadyForDraw()}),!0}case"sparkScanAnalyticsManagerPropertyChanged":{let{data:a}=e;return this.respondWith(a.command,a.id,async()=>{this.dataCaptureInstance.sparkScanMode.analyticsManagerPropertyChanged(a.property)}),!0}case"sparkScanSelectItemWithSmartScanSelection":{let{data:a}=e;return this.respondWith(a.command,a.id,async()=>{this.dataCaptureInstance.sparkScanMode.selectItemWithSmartScanSelection()}),!0}case"barcodeFindForSettings":{let{data:a}=e;return this.respondWith(a.command,a.id,async()=>this.dataCaptureInstance.barcodeFindMode.forSettings(a.settings)),!0}case"barcodeFindModeRemove":{let{data:a}=e;return this.respondWith(a.command,a.id,async()=>this.dataCaptureInstance.barcodeFindMode.removeMode()),!0}case"barcodeFindSearchStart":return this.respondWith(e.data.command,e.data.id,()=>{this.dataCaptureInstance.barcodeFindMode.start()}),!0;case"barcodeFindSearchPause":return this.respondWith(e.data.command,e.data.id,()=>{this.dataCaptureInstance.barcodeFindMode.pause()}),!0;case"barcodeFindSearchStop":return this.respondWith(e.data.command,e.data.id,()=>{this.dataCaptureInstance.barcodeFindMode.stop()}),!0;case"barcodeFindSetItemList":{let{data:a}=e;return this.respondWith(e.data.command,e.data.id,()=>{this.dataCaptureInstance.barcodeFindMode.setItemList(a.itemList)}),!0}case"barcodeFindSetEnabled":{let{data:a}=e;return this.respondWith(e.data.command,e.data.id,()=>{this.dataCaptureInstance.barcodeFindMode.setEnabled(a.enabled)}),!0}case"barcodeFindApplySettings":{let{data:a}=e;return this.respondWith(a.command,a.id,async()=>this.dataCaptureInstance.barcodeFindMode.applySettings(a.settings)),!0}case"barcodeFindAddBasicOverlay":{let{data:a}=e;return this.respondWith(a.command,a.id,async()=>{this.dataCaptureInstance.barcodeFindMode.addBasicOverlay()}),!0}case"barcodeFindRemoveBasicOverlay":{let{data:a}=e;return this.respondWith(a.command,a.id,async()=>{this.dataCaptureInstance.barcodeFindMode.removeBasicOverlay()}),!0}case"barcodeFindUpdateBasicOverlay":{let{data:a}=e;return this.respondWith(a.command,a.id,async()=>{this.dataCaptureInstance.barcodeFindMode.updateBasicOverlay(a.jsonOverlay)}),!0}case"barcodeFindSetTransformerFunction":{let{data:a}=e;return this.respondWith(a.command,a.id,async()=>{let r=Ce(a.functionAsString);this.dataCaptureInstance.barcodeFindMode.setTransformerFunction(r)}),!0}case"barcodeArForSettings":{let{data:a}=e;return this.respondWith(a.command,a.id,async()=>this.dataCaptureInstance.barcodeArMode.forSettings(a.settings)),!0}case"barcodeArModeRemove":{let{data:a}=e;return this.respondWith(a.command,a.id,async()=>this.dataCaptureInstance.barcodeArMode.removeMode()),!0}case"barcodeArSearchStart":return this.respondWith(e.data.command,e.data.id,()=>{this.dataCaptureInstance.barcodeArMode.start()}),!0;case"barcodeArSearchPause":return this.respondWith(e.data.command,e.data.id,()=>{this.dataCaptureInstance.barcodeArMode.pause()}),!0;case"barcodeArSearchStop":return this.respondWith(e.data.command,e.data.id,()=>{this.dataCaptureInstance.barcodeArMode.stop()}),!0;case"barcodeArSetEnabled":{let{data:a}=e;return this.respondWith(e.data.command,e.data.id,()=>{this.dataCaptureInstance.barcodeArMode.setEnabled(a.enabled)}),!0}case"barcodeArApplySettings":{let{data:a}=e;return this.respondWith(a.command,a.id,async()=>{this.dataCaptureInstance.barcodeArMode.applySettings(a.settings)}),!0}default:return super.onMessage(e)}}};var nr=new V(self,{get:()=>self.Module,set:t=>{self.Module=t}});function or(t){}})();\n'],{type:"application/javascript"})),e=new Worker(s,r);return URL.revokeObjectURL(s),e}var o=class r extends DataCaptureLoader{constructor(){super(...arguments);this._name="BarcodeCapture";}get dataCaptureWorker(){return (this._dataCaptureWorker)!=null||(this._dataCaptureWorker=i({name:this.name})),this._dataCaptureWorker}get name(){return this._name}static async create(e){var a;let t=new r(e);return await t.workerCommand("setLogLevel",{level:(a=e.logLevel)!=null?a:Logger.Level.Debug}),await t.load(),t}async workerCommand(e,t,a){return new Promise((d,l)=>{let n=this.workerCommandId++;this.workerTasks.set(n,{resolve:d,reject:l,command:e});let c={...t,command:e,id:n};this.dataCaptureWorker.postMessage(c,a);})}};
1
+ import {DataCaptureLoader,Logger}from'@scandit/web-datacapture-core';function i(r){let s=URL.createObjectURL(new Blob(['"use strict";(()=>{var u={"scandit-datacapture-sdk-barcode-simd.wasm":{bytes:7573271},"scandit-datacapture-sdk-barcode-simd-pthreads.wasm":{bytes:7703694},"scandit-datacapture-sdk-barcode-pthreads.wasm":{bytes:7771852},"scandit-datacapture-sdk-barcode.wasm":{bytes:7641767}};function M(t){return typeof t=="object"&&t!=null}function C(t){if(typeof t=="string")return t;if(M(t)){if(typeof t.message=="string")return t.message}else if(typeof(t==null?void 0:t.toString)=="function")return t.toString();return"unknown error"}var c;(t=>{(l=>(l.Debug="debug",l.Info="info",l.Warn="warn",l.Error="error",l.Quiet="quiet"))(t.Level||(t.Level={}));let e=new Map([["debug",1],["info",2],["warn",3],["error",4],["quiet",5]]),a="debug";function r(l){a=l}t.setLevel=r;function i(l,...h){if(!(e.get(a)>e.get(l)))switch(l){case"debug":{console.debug(...h);break}case"info":{console.log(...h);break}case"warn":{console.warn(...h);break}case"error":{console.error(...h);break}}}t.log=i;function s(...l){i("warn",...l)}t.warn=s;function o(...l){i("debug",...l)}t.debug=o;function n(...l){i("info",...l)}t.info=n;function d(...l){i("error",...l)}t.error=d})(c||(c={}));var xe=class{constructor(t){if(typeof t!="function")throw new TypeError("FinalizationRegistry callback must be a function")}register(t,e,a){}unregister(t){return!1}};function ee(t){typeof t.FinalizationRegistry>"u"&&(t.FinalizationRegistry=xe)}var B=class te extends Error{constructor(e){super(e.message),Object.setPrototypeOf(this,te.prototype),this.name=e.name}toString(){return`${this.name}: ${this.message}`}};var x=Promise.resolve(),j=!1,$=!1,k,G={writableDataPath:""};async function ae(t){if(k==null)return;j=!0;let e=new Promise((a,r)=>{setTimeout(()=>{r(new B({name:"BlockedIndexedDB",message:"IndexedDB database is blocked"}))},1500)});try{await Promise.race([new Promise((a,r)=>{k==null||k(t,i=>{if(i!=null){r(i);return}a()})}),e])}finally{j=!1}}async function re(t){return $||(j?($=!0,x=x.then(async()=>($=!1,ae(t)))):x=ae(t)),x}async function ie(t){G=t,k=FS.syncfs,FS.syncfs=((e,a)=>{let r=a,i=()=>{r()},s=o=>{r(o)};re(e).then(i).catch(s)});try{FS.mkdir(G.writableDataPath)}catch(e){if(e.code!=="EEXIST")throw k=void 0,e}return FS.mount(IDBFS,{},G.writableDataPath),re(!0)}var se={};function Pe(t){return[...new Uint8Array(t)].map(e=>{let a=e.toString(16);return a.length===1?`0${a}`:a}).join("")}async function*Ae(t){let e=t.getReader();try{for(;;){let{done:a,value:r}=await e.read();if(a)return;yield r}}finally{e.releaseLock()}}async function Te(t){let e=[],a=0,r=0;for await(let s of Ae(t))e.push(s),a+=s.length;let i=new Uint8Array(a);for(let s of e)i.set(s,r),r+=s.length;return i.buffer}var Oe=(t=>(t.VALID="VALID",t.INVALID="INVALID",t.NOT_VERIFIABLE="NOT_VERIFIABLE",t))(Oe||{});async function Ee(t,e,a){if(typeof crypto.subtle.digest!="function")return c.log(c.Level.Warn,`Insecure context (see https://developer.mozilla.org/en-US/docs/Web/Security/Secure_Contexts): The hash of the Scandit Data Capture library WASM file found at ${a} could not be verified`),"NOT_VERIFIABLE";try{let r=t instanceof Promise?await t:t,i=await crypto.subtle.digest("SHA-256",r),s=Pe(i);return e==null?(c.log(c.Level.Warn,"The library hash is not defined or empty, cannot correctly verify integrity."),"NOT_VERIFIABLE"):s===e?(c.log(c.Level.Debug,`Data Capture library WASM integrity found at ${a} has been verified correctly.`),"VALID"):(c.log(c.Level.Warn,`The Scandit Data Capture library WASM file found at ${a} seems invalid: expected file hash doesn\'t match (received: ${s}, expected: ${e}). Please ensure the correct Scandit Data Capture file (with correct version) is retrieved.`),"INVALID")}catch(r){return c.log(c.Level.Warn,"Wasm response could not be verified",r),"NOT_VERIFIABLE"}}var q=new Map([["br",4.4],["gzip",2.9],["none",1]]);function Le(t){var e;let a="content-encoding";if(t==null||t.get(a)==null)return q.get("none");let r=new Set(((e=t.get(a))!=null?e:"").split(",").map(i=>i.trim()));for(let[i,s]of q)if(r.has(i))return s;return q.get("none")}function We(t){var e,a;if(t==null)return 0;let r=(e=Le(t))!=null?e:1,i=Number.parseInt((a=t.get("content-length"))!=null?a:"0",10);return Number.isNaN(i)?0:Math.floor(i*r*100)/100}function Re(t){let{pathname:e}=new URL(t);for(let[a,r]of Object.entries(se))if(e.endsWith(a))return r.bytes;return 0}function ne(t){se=t}var Ne=(t,e)=>{let a=We(e);return a===0?Re(t):a};function He(t,e,a,{onProgress:r,onError:i,onComplete:s}){if(!e.body)return[e];let o=Ne(t,e.headers),n=0,d=0;if(typeof TransformStream>"u")return c.warn("TransformStream is not supported in this environment. Progress tracking will be disabled."),[e];let[l,h]=a?e.body.tee():[e.body],m=l.pipeThrough(new TransformStream({async transform(g,b){try{n+=g.length,d=Number((n/o*100).toFixed(2)),o>0&&g.length>0&&d<100?r==null||r({percentage:d,loadedBytes:n,privateUri:t}):o===0&&g.length>0&&(r==null||r({percentage:null,loadedBytes:n,privateUri:t})),b.enqueue(g)}catch(w){b.error(w),i==null||i({error:w})}},flush(g){r==null||r({percentage:100,loadedBytes:n,privateUri:t}),s==null||s({percentage:100,loadedBytes:n,privateUri:t}),g.terminate()}}));return[new Response(m,{headers:new Headers(e.headers),status:e.status,statusText:e.statusText}),h]}async function Y({wasmURI:t,expectedHash:e,verifyResponseHash:a,onProgress:r,onComplete:i,onError:s,referredOrigin:o}){let n=await fetch(t,{referrerPolicy:"origin",referrer:o!=null?o:""});if(!n.ok)throw new Error(`HTTP status code is not ok: ${n.status}, ${n.statusText}`);let[d,l]=He(t,n,a,{onProgress:r,onError:s,onComplete:i});return l!=null&&Ee(Te(l),e,t),d}function oe({wasmURI:t,expectedHash:e,verifyResponseHash:a,progressCallback:r,successCallback:i,errorCallback:s,importObject:o,referredOrigin:n}){async function d(h){try{let m=await Y({wasmURI:t,expectedHash:e,verifyResponseHash:a,onProgress:r,referredOrigin:n}),g=await(h!=null?h:m).arrayBuffer(),b=await self.WebAssembly.instantiate(g,o);i(b.instance,b.module)}catch(m){c.log(c.Level.Error,m),c.log(c.Level.Error,`Couldn\'t instantiate Scandit SDK DataCapture library at ${t}, did you configure the path for it correctly?`),s==null||s(m)}}async function l(){let h;try{h=await Y({wasmURI:t,expectedHash:e,verifyResponseHash:a,onProgress:r,referredOrigin:n});let m=await self.WebAssembly.instantiateStreaming(h,o);i(m.instance,m.module)}catch(m){c.log(c.Level.Warn,m),c.log(c.Level.Warn,"WebAssembly streaming compile failed. Falling back to ArrayBuffer instantiation (this will make things slower)"),d((h==null?void 0:h.bodyUsed)===!0?void 0:h)}}typeof self.WebAssembly.instantiateStreaming=="function"?l():d()}async function X(t,e,a,r){return new Promise((i,s)=>{t().then(i).catch(o=>{let n=e*2;if(n>a){s(o);return}r(o),self.setTimeout(()=>{X(t,n,a,r).then(i).catch(s)},e)})})}function K(t){var e,a;let r="unknown";if((e=t.href)!=null&&e.startsWith("blob:null/"))r="localhost";else{let i=((a=t.pathname)==null?void 0:a.length)>1&&!t.pathname.startsWith("/");r=new URL(i?t.pathname:t.origin).hostname}return r.startsWith("[")&&r.endsWith("]")?(r=r.slice(1,-1),r):(/^(\\d{1,3}\\.){3}\\d{1,3}$/.test(r)&&(r=r.split(".").map(i=>Number.parseInt(i,10).toString()).join(".")),r)}async function de(t,e){async function a(){return importScripts(t)}try{await X(a,250,4e3,i=>{c.log(c.Level.Warn,i),c.log(c.Level.Warn,`Couldn\'t retrieve Scandit Data Capture library at ${t}, retrying...`)}),self.Module.mainScriptUrlOrBlob=t;let r=self.SDC_WASM_JS_VERSION;return r!==e&&c.log(c.Level.Warn,`The Scandit Data Capture library JS file found at ${t} seems invalid: expected version doesn\'t match (received: ${r}, expected: ${e}). Please ensure the correct Scandit Data Capture file (with correct version) is retrieved.`),!0}catch(r){return c.log(c.Level.Error,r),!1}}var P=class{constructor(){this.promise=new Promise((t,e)=>{this.reject=e,this.resolve=t})}};var Z=class{constructor(t,e){this.workerFunctions=t,this.options=e,this.imageIdCounter=0,this.conversions=new Map}convertToJpeg(t,e){let a=this.imageIdCounter++,r=new P;this.conversions.set(a,r);let i=t.toBitmap();return this.workerFunctions.postMessage({type:"convertToJPEG",imageId:a,width:t.getWidth(),height:t.getHeight(),data:i,planes:t.getPlanes(),orientation:e,quality:this.options.quality},Array.from(new Set([i.buffer]))),r.promise}onConvertToJPEGResult(t,e){let a=this.conversions.get(t);a?(a.resolve(e),this.conversions.delete(t)):c.warn(`ImageConverterForwarder: Conversion for imageId ${t} not found in Map`)}};var A=class{constructor(t){this.options=t}get quality(){return this.options.quality}async convertToJpeg(t,e){try{let{width:a,height:r,planes:i}=this.validateAndExtractImageData(t);this.prepareCanvas(a,r);let s=this.processImageData(t,i,a,r);return await this.convertToJpegBytes(s,e)}catch(a){throw c.warn(`Failed to convert image to JPEG: ${a}`),a instanceof Error?a:new Error("Failed to convert image to JPEG")}}validateAndExtractImageData(t){let e=t.getWidth(),a=t.getHeight(),r=t.getPlanes();if(e<=0||a<=0)throw c.warn(`Invalid image dimensions: ${e}x${a}`),new Error(`Invalid image dimensions: ${e}x${a}`);if(!r||r.length===0)throw c.warn("ImageBuffer has no planes"),new Error("ImageBuffer has no planes");return{width:e,height:a,planes:r}}prepareCanvas(t,e){if(!this.ensureCanvas(t,e))throw new Error("Failed to create OffscreenCanvas");if(!this.canvas||!this.context)throw new Error("Canvas or context not properly initialized")}processImageData(t,e,a,r){let i=this.createImageDataFromBuffer(t,e,a,r);if(i===null)throw new Error("Failed to create ImageData");return this.validateImageData(i,a,r),i}validateImageData(t,e,a){var r;if(t.width!==e||t.height!==a)throw c.warn(`ImageData dimensions mismatch: expected ${e}x${a}, got ${t.width}x${t.height}`),new Error("ImageData dimensions mismatch");if(!t.data||t.data.length!==e*a*4)throw c.warn(`ImageData has invalid data length: expected ${e*a*4}, got ${((r=t.data)==null?void 0:r.length)||0}`),new Error("ImageData has invalid data length")}async convertToJpegBytes(t,e){if(!this.context||!this.canvas)throw new Error("Canvas or context not available");try{this.context.putImageData(t,0,0)}catch(s){throw c.warn(`Failed to put image data on canvas: ${s}`),new Error(`Failed to put image data on canvas: ${s}`)}let a=e!==0?this.applyRotation(this.canvas,e):this.canvas,r;try{r=await this.canvasToBlob(a)}catch(s){throw c.warn(`Failed to convert canvas to blob: ${s}`),new Error(`Failed to convert canvas to blob: ${s}`)}if(!r||r.size===0)throw c.warn("Canvas convertToBlob returned empty or null blob"),new Error("Failed to create JPEG blob");let i;try{i=await r.arrayBuffer()}catch(s){throw c.warn(`Failed to get array buffer from blob: ${s}`),new Error(`Failed to get array buffer from blob: ${s}`)}if(!i||i.byteLength===0)throw c.warn("Blob arrayBuffer returned empty or null buffer"),new Error("Failed to get array buffer from blob");return new Uint8Array(i)}ensureCanvas(t,e){try{return(!this.canvas||this.canvas.width!==t||this.canvas.height!==e)&&(this.canvas=this.getNewCanvas(t,e),this.context=this.canvas.getContext("2d")),this.context!==null}catch(a){return c.warn("Failed to create HTMLCanvasElement",a),!1}}createImageDataFromBuffer(t,e,a,r){let i=new Set(e.map(s=>s.channel));try{if(this.isYUVFormat(i)){let n=t.toBitmap();return!n||n.length!==a*r*4?(c.warn(`Invalid bitmap data from toBitmap(): expected ${a*r*4} bytes, got ${(n==null?void 0:n.length)||0}`),null):new ImageData(new Uint8ClampedArray(n),a,r)}if(this.isRGBAFormat(i))return this.createImageDataFromRGBAPlanes(e,a,r);if(this.isRGBFormat(i))return this.createImageDataFromRGBPlanes(e,a,r);if(this.isGrayscaleFormat(i))return this.createImageDataFromGrayscalePlanes(e,a,r);c.warn(`Unknown image format with channels: ${Array.from(i).join(", ")}, falling back to toBitmap()`);let s=t.toBitmap();if(!s||s.length===0)return c.warn("toBitmap() returned empty or null data"),null;let o=s.length/(a*r);return o===4?new ImageData(new Uint8ClampedArray(s),a,r):(c.warn(`Unsupported format: ${o} bytes per pixel`),null)}catch(s){return c.warn(`Failed to create ImageData: ${s}`),null}}isYUVFormat(t){return t.has(0)&&t.has(1)&&t.has(2)}isRGBAFormat(t){return t.has(3)&&t.has(4)&&t.has(5)&&t.has(6)}isRGBFormat(t){return t.has(3)&&t.has(4)&&t.has(5)&&!t.has(6)}isGrayscaleFormat(t){return t.has(0)&&!t.has(1)&&!t.has(2)}createImageDataFromRGBAPlanes(t,e,a){let r=t.find(d=>d.channel===3),i=t.find(d=>d.channel===4),s=t.find(d=>d.channel===5),o=t.find(d=>d.channel===6);if(!r||!i||!s||!o)return c.warn("Missing RGBA planes"),null;let n=new Uint8ClampedArray(e*a*4);for(let d=0;d<a;d++)for(let l=0;l<e;l++){let h=(d*e+l)*4;n[h]=this.getPixelFromPlane(r,l,d),n[h+1]=this.getPixelFromPlane(i,l,d),n[h+2]=this.getPixelFromPlane(s,l,d),n[h+3]=this.getPixelFromPlane(o,l,d)}return new ImageData(n,e,a)}createImageDataFromRGBPlanes(t,e,a){let r=t.find(n=>n.channel===3),i=t.find(n=>n.channel===4),s=t.find(n=>n.channel===5);if(!r||!i||!s)return c.warn("Missing RGB planes"),null;let o=new Uint8ClampedArray(e*a*4);for(let n=0;n<a;n++)for(let d=0;d<e;d++){let l=(n*e+d)*4;o[l]=this.getPixelFromPlane(r,d,n),o[l+1]=this.getPixelFromPlane(i,d,n),o[l+2]=this.getPixelFromPlane(s,d,n),o[l+3]=255}return new ImageData(o,e,a)}createImageDataFromGrayscalePlanes(t,e,a){let r=t.find(s=>s.channel===0);if(!r)return c.warn("Missing Y plane for grayscale"),null;let i=new Uint8ClampedArray(e*a*4);for(let s=0;s<a;s++)for(let o=0;o<e;o++){let n=(s*e+o)*4,d=this.getPixelFromPlane(r,o,s);i[n]=d,i[n+1]=d,i[n+2]=d,i[n+3]=255}return new ImageData(i,e,a)}getPixelFromPlane(t,e,a){let r=Math.floor(e/(t.subsamplingX||1)),i=Math.floor(a/(t.subsamplingY||1)),s=t.rowStride,o=t.pixelStride,n=i*s+r*o,d=t.data;return n<d.length?d[n]:0}applyRotation(t,e){let a=e*Math.PI/180,r=e===90||e===270||e===-90||e===-270,i=r?t.height:t.width,s=r?t.width:t.height,o=this.getNewCanvas(i,s),n=o.getContext("2d");if(!n)throw new Error("Failed to get 2D context for rotated canvas");return n.translate(i/2,s/2),n.rotate(a),n.translate(-t.width/2,-t.height/2),n.drawImage(t,0,0),o}};A.JPEG_IMAGE_MIME_TYPE="image/jpeg";var ce=class extends A{getNewCanvas(t,e){return new OffscreenCanvas(t,e)}canvasToBlob(t){return t.convertToBlob({type:A.JPEG_IMAGE_MIME_TYPE,quality:this.options.quality})}};var T;(t=>{function e(){return"8.1.1"}t.sdkVersion=e})(T||(T={}));function _e(t){return/^https?:\\/\\/(?:[^./]*\\.)*cdn.jsdelivr.net\\//.test(t)?{result:!0,cdnBaseURL:"https://cdn.jsdelivr.net/npm/"}:/^https?:\\/\\/(?:[^./]*\\.)*unpkg.com\\//.test(t)?{result:!0,cdnBaseURL:"https://unpkg.com/"}:{result:!1,cdnBaseURL:""}}function ze(t){let e=/@scandit\\/web-datacapture-[a-z]+/i.exec(t);return e?e[0]:null}function le(t,e,a){let r=e,i=_e(r);if(i.result){let o=ze(r);o!=null&&(r=`${i.cdnBaseURL}${o}@${t}/sdc-lib/`)}let s=a.replace(".wasm","");return i.result?{jsURI:`${r}${s}.js`,wasmURI:`${r}${s}.wasm`}:{jsURI:`${r}${s}.js?v=${t}`,wasmURI:`${r}${s}.wasm?v=${t}`}}var ue=class pe{constructor(e,a){this.hintPresenterV2=null,this.MAX_NUMBER_OF_IMAGES_IN_FRAME_DATA_POOL=10,this.redrawInterval=1e3/30,this.redrawRequests=[],this._isDrawLoopRunning=!1,this.frameDataPool=new Map,this.lastFrameColorType="RGBA",this.lastFrameCounter=-1,this.poorMansBenchmarkLogs=!1,this.writableDataPathStandard="/scandit_sync_folder",this.resourceFilesSubfolder="resources",this.performanceMetricsReporterTimer=void 0,this.performanceMetrics={frameDataPoolSize:0,processedFramesCount:0,redrawRequestsCount:0,actualRedrawsCount:0},this.gestureListener=null,this.webPlatformHintPresenter=null,this.moduleHandler=e,this.workerFunctions=a,this._loadProgressCallback=this._loadProgressCallback.bind(this),ne(this.getWasmMetadata())}get Module(){return this.moduleHandler.get()}set isDrawLoopRunning(e){this._isDrawLoopRunning=e,!e&&typeof this.loopTimeoutId=="number"&&(clearTimeout(this.loopTimeoutId),this.loopTimeoutId=void 0)}get isDrawLoopRunning(){return this._isDrawLoopRunning}convertToLoadableFrameData(e){let a=this.getNextFrameId();this.frameDataPool.set(a,{data:new Uint8ClampedArray(e.getFrameData()),colorType:this.lastFrameColorType});let r=this.lastUsedModuleMirrorAxis==null?!1:this.lastUsedModuleMirrorAxis!==this.Module.Axis.None;return{frameId:a,width:e.getWidth(),height:e.getHeight(),isFrameSourceMirrored:r,colorType:this.lastFrameColorType}}createContext(e){var a,r,i,s,o;let n=this.getModeDeserializers(),d=K(location);(d==="localhost"||d==="127.0.0.1")&&navigator.userAgent.includes("Electron")&&e.appName!=null&&(d+=`-${e.appName}`),this.parentDomain=e.parentDomain,this.contextDeserializer=new this.Module.DataCaptureContextDeserializer(this.writableDataPath,e.deviceId,e.context.deviceModelName,d,this.parentDomain,n,e.delayedRegistration,e.highEndBlurryRecognition,this.resourcePath);let l=this.contextDeserializer.contextFromJson(JSON.stringify(e.context));if(l==null){let p=this.contextDeserializer.getLastError();throw new Error(`Could not create the context: ${p}`)}let h=l.getView();this.context=l.getContext(),l.delete();let m=this.Module.DataCaptureContextListener.extend("DataCaptureContextListener",{didChangeStatus:(p,f)=>{this.contextDidChangeStatus(JSON.parse(f.toJson())),p.delete()},didStartObservingContext:p=>{this.didStartObservingContext(),p.delete()},didStopObservingContext:p=>{p.delete()}}),g=this.Module.DataCaptureContextFrameListener.extend("DataCaptureContextFrameListener",{onObservationStarted:p=>{p.delete()},onObservationStopped:p=>{p.delete()},onFrameProcessingStarted:(p,f)=>{this.workerFunctions.postMessage({type:"onFrameProcessingStarted"}),f.delete(),p.delete()},onFrameProcessingFinished:(p,f)=>{this.workerFunctions.postMessage({type:"onFrameProcessingFinished"}),f.delete(),p.delete()},onFrameSkipped:(p,f)=>{this.workerFunctions.postMessage({type:"onFrameSkipped"}),f.delete(),p.delete()}}),b=this.Module.GestureRecognizer.extend("GestureRecognizer",{setGestureListener:(p,f)=>{var F;(F=this.gestureListener)==null||F.delete(),this.gestureListener=p.clone(),p.delete()}});(a=this.gestureRecognizer)==null||a.delete(),this.gestureRecognizer=new b;let w=new m;this.context.addListener(w),w.delete();let v=new g;this.context.addFrameListener(v),v.delete(),this.setView(h),(r=this.view)==null||r.setGestureRecognizer(this.gestureRecognizer);let U=this.Module.PlatformHintPresenter.extend("PlatformHintPresenter",{setHintPresenter:p=>{p.delete()},showToast:p=>{this.workerFunctions.postMessage({type:"showToast",payload:JSON.parse(p)})},hideToast:p=>{this.workerFunctions.postMessage({type:"hideToast",payload:JSON.parse(p)})},showGuidance:p=>{this.workerFunctions.postMessage({type:"showGuidance",payload:JSON.parse(p)})},hideGuidance:p=>{this.workerFunctions.postMessage({type:"hideGuidance",payload:JSON.parse(p)})},startUpdateTimer:p=>{this.workerFunctions.postMessage({type:"startUpdateTimer",payload:{duration:{unit:"ms",value:p}}})},stopUpdateTimer:()=>{this.workerFunctions.postMessage({type:"stopUpdateTimer"})}});(i=this.hintPresenterV2)==null||i.delete(),this.hintPresenterV2=null,(s=this.webPlatformHintPresenter)==null||s.delete(),this.webPlatformHintPresenter=null,this.webPlatformHintPresenter=new U,this.view&&(this.hintPresenterV2=new this.Module.HintPresenterV2(this.webPlatformHintPresenter),(o=this.view)==null||o.setHintPresenterV2(this.hintPresenterV2)),this.webImageConverterInstance=this.getImageConverterInstance({quality:1}),this.Module.ImageConverter.setInstance(this.webImageConverterInstance)}convertToJPEGResult(e,a){this.webImageConverterInstance instanceof Z&&this.webImageConverterInstance.onConvertToJPEGResult(e,a)}getImageConverterInstance(e){return this.workerFunctions.getOffscreenCanvas()!=null?new ce(e):new Z(this.workerFunctions,e)}onTap(e){var a;(a=this.gestureListener)==null||a.onTap(JSON.stringify(e))}hintPresenterV2Update(){var e;(e=this.hintPresenterV2)==null||e.update()}startReportingPerformanceMetrics(){this.performanceMetricsReporterTimer==null&&(this.performanceMetricsReporterTimer=setInterval(()=>{this.reportPerformanceMetrics();for(let e of Object.keys(this.performanceMetrics))this.performanceMetrics[e]=0},1e3))}async reportPerformanceMetrics(){this.workerFunctions.postMessage({type:"performanceMetricsReport",payload:{...this.performanceMetrics}})}deleteFrameData(e){this.frameDataPool.delete(e)}dispose(){var e,a,r,i;this.context.dispose(),this.frameDataPool.clear(),this.isDrawLoopRunning=!1,this.lastFrameCounter=-1,(e=this.gestureRecognizer)==null||e.delete(),this.gestureRecognizer=null,(a=this.gestureListener)==null||a.delete(),this.gestureListener=null,(r=this.hintPresenterV2)==null||r.delete(),this.hintPresenterV2=null,(i=this.webPlatformHintPresenter)==null||i.delete(),this.webPlatformHintPresenter=null}flushAnalytics(){this.context.flushAnalytics()}extractCentaurusLicense(e){return{payload:{centaurus:{licenseKey:this.Module.LicenseUtils[pe.get3dPartyLicenseKeyMethodName](e)}}}}getModeDeserializers(){return new this.Module.VectorDataCaptureModeDeserializer}loadLibrary(e){return this.libraryLoadingPromise!=null?this.libraryLoadingPromise:(this.libraryLoadingPromise=this.setup(e),this.libraryLoadingPromise)}processFrame(e){var a;if(this.context==null)return{payload:e,transferables:[e.data.buffer]};let r=e.data,i=e.colorType==="GRAYSCALE"?this.Module.ImageBufferFormat.Grayscale8:this.Module.ImageBufferFormat.Rgba8888;this.lastFrameColorType=e.colorType==="GRAYSCALE"?"GRAYSCALE":"RGBA";let s=this.Module.allocateUint8Array(r.byteLength);return this.Module.HEAPU8.set(r,s),(a=this.imageFrameSource)==null||a.outputFrame(s,e.width,e.height,i),{payload:e,transferables:[e.data.buffer]}}reportCameraProperties(e){this.context.setCameraProperties(e.deviceId,e.isFrontFacing,e.hasAutofocus)}requestFrameData(e){var a;let{data:r,colorType:i}=(a=this.frameDataPool.get(e))!=null?a:{data:null,colorType:null};return r==null?{payload:{data:null,colorType:null}}:{payload:{data:r,colorType:i},transferables:[r.buffer]}}scheduleRedraw(e,a){this.addRedrawRequest(a),this.isDrawLoopRunning||this.startDrawLoop(e)}sendViewRefreshCommands(e){this.workerFunctions.postMessage({type:"draw",payload:e},[e.buffer])}setFrameSource(e,a){var r;this.lastUsedModuleMirrorAxis=this.mapMirrorAxisOnModule(e),(r=this.imageFrameSource)==null||r.delete(),this.imageFrameSource=new this.Module.ImageBufferFrameSource(this.lastUsedModuleMirrorAxis,a,0),this.context.setFrameSource(this.imageFrameSource)}startDrawLoop(e){this.isDrawLoopRunning=!0;let a=s=>this.redrawRequests.length>0&&this.redrawRequests[0]<=s,r=s=>{for(;this.redrawRequests.length>0&&this.redrawRequests[0]<=s;)this.redrawRequests.shift()},i=()=>{this.loopTimeoutId=setTimeout(()=>{if(!this.isDrawLoopRunning)return;let s=performance.now();if(a(s)){r(s),e.draw();let o=e.getDrawCommands();this.sendViewRefreshCommands(new Uint8Array(o))}i()},this.redrawInterval)};i()}updateContext(e){if(this.context!=null&&this.contextDeserializer!=null){e.view!=null&&!e.view.visible&&this.context.flushAnalytics();let a=this.onBeforeUpdateContextHook(e),r=this.contextDeserializer.updateContextFromJson(this.context,this.view,JSON.stringify(a.context));if(r==null){let s=this.contextDeserializer.getLastError();throw new Error(`Could not update the context: ${s}`)}this.context.delete(),this.context=r.getContext();let i=r.getView();r.delete(),i!=null&&a.view!=null&&i.setViewSize(a.view.width,a.view.height,a.view.orientation),!this.hintPresenterV2&&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),c.debug("context updated",a)}}onBeforeUpdateContextHook(e){return e}onDocumentVisibilityChange(e){e==="hidden"&&this.context.flushAnalytics()}isFeatureSupported(e){return{payload:{supported:this.context.isFeatureSupported(e)}}}getViewfinderInfo(){var e,a;return{payload:{isDisplayingViewfinder:(a=(e=this.view)==null?void 0:e.isDisplayingViewfinder())!=null?a:!1,rect:JSON.parse(this.view.getViewfinderRect())}}}getOpenSourceSoftwareLicenseInfo(){return{payload:{licenseText:this.Module.OpenSourceSoftwareLicenseInfo.getLicenseText()}}}getNextFrameId(){return this.lastFrameCounter++,this.lastFrameCounter>=this.MAX_NUMBER_OF_IMAGES_IN_FRAME_DATA_POOL&&(this.lastFrameCounter=0),this.lastFrameCounter}getWasmDynamicLibraries(e){return this.getWasmSideModuleFileName()==null?[]:[`${e.replace(/\\/[^/]*$/,"/")}${this.getWasmSideModuleFileName()}`]}getWasmCoreExpectedHash(e,a){return a?e?"830dc2a432f9ed0e9633d2e85adea48784e2c9c65caf2f69111b15efa678467f":"4d2a9d39f458a2fe8850dd0cbfb2b63cf0be5248ea087ee0dfab7fba2925bfc3":e?"bdb001f777adb1eee19cc360422de40f1f6914ccf5ae4eb0c194096a3c8df72a":""}getWasmCoreFileName(e,a){return a?e?"scandit-datacapture-sdk-barcode-simd-pthreads.wasm":"scandit-datacapture-sdk-barcode-pthreads.wasm":e?"scandit-datacapture-sdk-barcode-simd.wasm":""}getWasmMetadata(){return u}getWasmSideModuleFileName(){return""}_loadProgressCallback(e){this.workerFunctions.postMessage({type:"loadLibraryProgress",payload:e})}addRedrawRequest(e){this.redrawRequests.push(Math.round(performance.now())+e),this.redrawRequests.sort((a,r)=>a-r)}contextDidChangeStatus(e){e.code===260?e.message=e.message.replace("domain name",`domain name (${K(location)})`):e.code===265&&(e.message=e.message.replace("domain name",`domain name (${this.parentDomain})`)),this.workerFunctions.postMessage({type:"contextDidChangeStatus",payload:e})}didStartObservingContext(){this.workerFunctions.postMessage({type:"didStartObservingContext"})}mapMirrorAxisOnModule(e){switch(e){case"None":return this.Module.Axis.None;case"X":return this.Module.Axis.X;case"Y":return this.Module.Axis.Y;default:return this.Module.Axis.None}}setView(e){this.view=e,this.setViewRefreshHandler(e),e==null&&(this.isDrawLoopRunning=!1,this.sendViewRefreshCommands(new Uint8Array([])))}addNativeOverlay(e){c.warn("addNativeOverlay has not been implemented for this module",e)}removeNativeOverlay(e){c.warn("removeNativeOverlay has not been implemented for this module",e)}setViewRefreshHandler(e){if(e==null||e.isViewRefreshHandlerSet)return;let a=this.Module.NeedsRedrawDelegate.extend("NeedsRedrawDelegate",{setNeedsRedrawIn:this.scheduleRedraw.bind(this,e)}),r=new a;e.setNeedsRedrawDelegate(r),e.isViewRefreshHandlerSet=!0}setupDataDecoding(){let e=this.moduleHandler.get(),a=e.DataDecoding.extend("DataDecoding",{decode(r,i){try{let s=JSON.parse(i),o=[];for(let n of s){let d=new TextDecoder(n.ianaName,{fatal:!0});o.push(d.decode(r.slice(n.startIndex,n.endIndex)))}return o.join("")}catch{return""}}});e.setDataDecoding(new a)}start(e,a,r){e&&a&&(this.setupDataDecoding(),this.moduleHandler.get().callMain(),this.moduleHandler.get().__emscripten_proxy_main!==void 0||r())}getWritableDataPath(e){return e!=null?(c.debug(`IndexedDB database name override in use to recover from blocked standard database: ${e}`),e):this.writableDataPathStandard}numOfMBToPages(e){return Math.ceil(1024*e*1024/64/1024)}async setup({libraryLocation:e,locationPath:a,writableDataPathOverride:r,verifyResponseHash:i,referredOrigin:s,fixedWasmMemory:o,simdSupport:n,threadsSupport:d}){var l;let h=!1,m=!1;this.writableDataPath=this.getWritableDataPath(r),this.resourcePath=`${e}${this.resourceFilesSubfolder}/`,self.path=a;let{resolve:g,reject:b,promise:w}=new P,v=T.sdkVersion();if(v==="")throw new B({name:"Invalid library version",message:"Library version is not defined or empty, cannot generate proper path to library files."});let U=this.getWasmCoreFileName(n,d),p=le(v,e,U),{jsURI:f,wasmURI:F}=p,ke={instantiateWasm:(y,De)=>(oe({importObject:y,wasmURI:F,expectedHash:this.getWasmCoreExpectedHash(n,d),verifyResponseHash:i,successCallback:De,progressCallback:this._loadProgressCallback,errorCallback:Ie=>{b(Ie)},referredOrigin:s}),{})},I=o===null?null:new WebAssembly.Memory({initial:this.numOfMBToPages(o),maximum:this.numOfMBToPages(300),shared:d});return I!==null&&c.log(c.Level.Debug,"Fixed wasmMemory set",I),this.moduleHandler.set({...I?{wasmMemory:I}:{},mainScriptUrlOrBlob:f,canvas:(l=this.workerFunctions.getOffscreenCanvas())!=null?l:{getContext:()=>null},...ke,dynamicLibraries:this.getWasmDynamicLibraries(F),locateFile:y=>e+y,noInitialRun:!0,preRun:[async()=>{try{await ie({writableDataPath:this.writableDataPath})}catch(y){if(y.name==="BlockedIndexedDB"){b(y.toString());return}c.log(c.Level.Debug,"No IndexedDB support, some data will not be persisted:",y)}m=!0,this.start(m,h,g)}],onMainComplete:()=>{if([h,m].includes(!1)){c.log(c.Level.Warn,{runtimeLoaded:h,fileSystemSynced:m},"Both runtimeLoaded and fileSystemSynced should be true when calling onMainComplete"),b("onMainComplete has been called but runtime or file system was not ready.");return}g()},onRuntimeInitialized:()=>{h=!0,this.start(m,h,g)},print:y=>{c.log(c.Level.Info,y)}}),await de(f,v)||b(`Couldn\'t retrieve Scandit Data Capture library at ${f}, did you configure the path for it correctly?`),w}};ue.get3dPartyLicenseKeyMethodName=atob("Z2V0QmxpbmtJZExpY2Vuc2VLZXk=");var D=ue;function he(t){return typeof t=="object"&&t!=null&&t.document==null&&"addEventListener"in t&&typeof t.importScripts=="function"}function me(t){console.warn("Reached unexpected case",t)}var Q=class{constructor(t,e){this.onMessageListener=this.onMessage.bind(this),this.workerSelf=t,this.dataCaptureInstance=new D(e,{postMessage:this.postMessage.bind(this),getOffscreenCanvas:this.getOffscreenCanvas.bind(this)}),he(t)&&(ee(t),this.listenToMessages())}listenToMessages(){this.workerSelf.addEventListener("message",this.onMessageListener),this.workerSelf.addEventListener("error",t=>{c.log(c.Level.Error,t)}),this.workerSelf.addEventListener("messageerror",t=>{c.log(c.Level.Error,t)})}postMessage(t,e){this.workerSelf.postMessage(t,e!=null?e:[])}getOffscreenCanvas(){if(this.isOffscreenCanvasSupported())return new this.workerSelf.OffscreenCanvas(32,32)}isOffscreenCanvasSupported(){return typeof this.workerSelf.OffscreenCanvas=="function"}hasPayload(t){return M(t)&&"payload"in t}hasTransferables(t){return M(t)&&Array.isArray(t.transferables)}async respondWith(t,e,a){let r=null,i;try{i=a(),i instanceof Promise&&(i=await i)}catch(o){i=void 0,r=C(o)}let s={type:"workerTaskId",command:t,id:e,payload:this.hasPayload(i)?i.payload:void 0};r!=null&&(s.error=r),this.postMessage(s,this.hasTransferables(i)?i.transferables:[])}onMessage(t){switch(t.data.command){case"loadLibrary":{{let{data:e}=t;this.respondWith(e.command,e.id,async()=>this.dataCaptureInstance.loadLibrary({libraryLocation:e.libraryLocation,locationPath:e.locationPath,referredOrigin:e.referredOrigin,writableDataPathOverride:e.writableDataPathOverride,threadsSupport:e.threadsSupport,simdSupport:e.simdSupport,verifyResponseHash:e.verifyResponseHash,fixedWasmMemory:e.fixedWasmMemory}))}break}case"onTap":{{let{data:e}=t;this.respondWith(e.command,e.id,async()=>{this.dataCaptureInstance.onTap(e.point)})}break}case"hintPresenterV2update":{{let{data:e}=t;this.respondWith(e.command,e.id,async()=>{this.dataCaptureInstance.hintPresenterV2Update()})}break}case"createContext":{{let{data:e}=t;this.respondWith(e.command,e.id,()=>this.dataCaptureInstance.createContext({context:e.context,deviceId:e.deviceId,delayedRegistration:e.delayedRegistration,highEndBlurryRecognition:e.highEndBlurryRecognition,appName:e.appName,parentDomain:e.parentDomain}))}break}case"setFrameSource":{{let{data:e}=t;this.respondWith(e.command,e.id,()=>this.dataCaptureInstance.setFrameSource(e.mirrorAxis,e.isCameraFrameSource))}break}case"processFrame":{{let{data:e}=t;this.respondWith(e.command,e.id,()=>this.dataCaptureInstance.processFrame({data:e.data,width:e.width,height:e.height,colorType:e.colorType}))}break}case"requestFrameData":{{let{data:e}=t;this.respondWith(e.command,e.id,()=>this.dataCaptureInstance.requestFrameData(e.frameId))}break}case"deleteFrameData":{{let{data:e}=t;this.respondWith(e.command,e.id,()=>{this.dataCaptureInstance.deleteFrameData(e.frameId)})}break}case"updateContext":{{let{data:e}=t;this.respondWith(e.command,e.id,async()=>this.dataCaptureInstance.updateContext(e))}break}case"dispose":{this.respondWith(t.data.command,t.data.id,()=>this.dataCaptureInstance.dispose());break}case"flushAnalytics":{this.respondWith(t.data.command,t.data.id,()=>{this.dataCaptureInstance.flushAnalytics()});break}case"reportCameraProperties":{{let{data:e}=t;this.respondWith(e.command,e.id,async()=>this.dataCaptureInstance.reportCameraProperties(e))}break}case"setLogLevel":{{let{data:e}=t;this.respondWith(e.command,e.id,()=>{c.setLevel(e.level)})}break}case"extractCentaurusLicense":{{let{data:e}=t;this.respondWith(e.command,e.id,()=>this.dataCaptureInstance.extractCentaurusLicense(e.licenseKey))}break}case"documentVisibility":{{let{data:e}=t;this.respondWith(e.command,e.id,()=>{this.dataCaptureInstance.onDocumentVisibilityChange(e.state)})}break}case"isFeatureSupported":{{let{data:e}=t;this.respondWith(e.command,e.id,()=>this.dataCaptureInstance.isFeatureSupported(e.feature))}break}case"getViewfinderInfo":{{let{data:e}=t;this.respondWith(e.command,e.id,()=>this.dataCaptureInstance.getViewfinderInfo())}break}case"getOpenSourceSoftwareLicenseInfo":{{let{data:e}=t;this.respondWith(e.command,e.id,()=>this.dataCaptureInstance.getOpenSourceSoftwareLicenseInfo())}break}case"addNativeOverlay":this.dataCaptureInstance.addNativeOverlay(t);break;case"removeNativeOverlay":this.dataCaptureInstance.removeNativeOverlay(t);break;case"convertToJPEGResult":{{let{data:e}=t;this.dataCaptureInstance.convertToJPEGResult(e.imageId,e.result)}break}default:return me(t.data),!1}return!0}};var ge=(t=>(t.Body="body",t.Footnote="footnote",t))(ge||{}),O=(t=>(t.Start="start",t.Center="center",t.End="end",t))(O||{}),be=(t=>(t.Normal="normal",t.Wider="wider",t.FitText="fitText",t))(be||{}),fe=(t=>(t.Normal="normal",t.Taller="taller",t))(fe||{}),ye=(t=>(t.Square="square",t.Rounded="rounded",t))(ye||{}),E=(t=>(t.None="none",t.Check="check",t.ExclamationMark="exclamationMark",t))(E||{}),L=(t=>(t.Top="top",t.AboveViewFinder="aboveViewFinder",t.BelowViewFinder="belowViewFinder",t))(L||{}),Se=(t=>(t.AboveViewFinder="aboveViewFinder",t.BelowViewFinder="belowViewFinder",t))(Se||{}),we=(t=>(t.BlackOnWhite="blackOnWhite",t.WhiteOnBlack="whiteOnBlack",t.Transparent="transparent",t))(we||{}),ve=(t=>(t.Success="success",t.Error="error",t.Warning="warning",t.Info="info",t.Notification="notification",t))(ve||{}),Fe=(t=>(t[t.Ocr=0]="Ocr",t[t.HideLogo=1]="HideLogo",t[t.ShowTestLicenseMessage=2]="ShowTestLicenseMessage",t[t.AugmentedReality=5]="AugmentedReality",t[t.ActivityPingStatsAddon=8]="ActivityPingStatsAddon",t[t.ActivityPing=9]="ActivityPing",t[t.Registration=10]="Registration",t[t.Parser=11]="Parser",t[t.BarcodeCapture=14]="BarcodeCapture",t[t.Analytics=17]="Analytics",t[t.AnalyticsBatchMode=18]="AnalyticsBatchMode",t[t.AnalyticsScanContent=19]="AnalyticsScanContent",t[t.AnalyticsOnlineVerification=20]="AnalyticsOnlineVerification",t[t.SparkScan=21]="SparkScan",t[t.AamvaIdBarcodeVerification=22]="AamvaIdBarcodeVerification",t[t.MappingForTracking=23]="MappingForTracking",t[t.BarcodeFind=24]="BarcodeFind",t[t.MandatoryRegistration=25]="MandatoryRegistration",t[t.FeatureTracking=26]="FeatureTracking",t[t.IdCaptureViz=27]="IdCaptureViz",t[t.IdCaptureMrz=28]="IdCaptureMrz",t[t.IdCaptureBarcode=29]="IdCaptureBarcode",t[t.BarcodeSelectionAimToScan=30]="BarcodeSelectionAimToScan",t[t.BarcodeSelectionTapToScan=31]="BarcodeSelectionTapToScan",t[t.BarcodeCount=32]="BarcodeCount",t[t.BarcodePick=33]="BarcodePick",t[t.IdVerificationDataComparison=34]="IdVerificationDataComparison",t[t.SmartLabelBarcode=35]="SmartLabelBarcode",t[t.SmartLabelText=36]="SmartLabelText",t[t.VoidedIdDetection=37]="VoidedIdDetection",t[t.BarcodeArFull=38]="BarcodeArFull",t[t.BarcodeSequence=39]="BarcodeSequence",t))(Fe||{});var W=class{constructor(e,a,r){this.barcodeAr=null;this.coreEngine=e,this.Module=a,this.workerFunctions=r}async forSettings(e){var r;(r=this.barcodeAr)==null||r.delete(),this.barcodeAr=new this.Module.BarcodeAr(this.coreEngine.context,JSON.stringify(e));let a=this.Module.BarcodeArListener.extend("BarcodeArListener",{didUpdateSession:(i,s,o)=>{let n=this.coreEngine.convertToLoadableFrameData(o);this.workerFunctions.postMessage({type:"barcodeArDidUpdateSession",payload:{session:JSON.parse(s.toJson()),frameData:n}}),i.delete(),s.delete(),o.delete()}});this.barcodeAr.addListener(new a,1),this.Module.addBarcodeArToContext(this.coreEngine.context,this.barcodeAr)}start(){var e;(e=this.barcodeAr)==null||e.start()}pause(){var e;(e=this.barcodeAr)==null||e.pause()}stop(){var e;(e=this.barcodeAr)==null||e.stop()}setEnabled(e){var a;(a=this.barcodeAr)==null||a.setEnabled(e)}async removeMode(){this.barcodeAr!=null&&this.Module.removeBarcodeArFromContext(this.coreEngine.context,this.barcodeAr)}applySettings(e){var a;(a=this.barcodeAr)==null||a.applySettings(JSON.stringify(e))}};var R=class{constructor(e,a,r){this.trackingListenerSet=!1;this.coreEngine=e,this.Module=a,this.workerFunctions=r,this.setup()}barcodeBatchDidUpdateSession(e){this.workerFunctions.postMessage({type:"barcodeBatchDidUpdateSession",payload:JSON.parse(e.toJson())})}getBatchDeserializer(){return this.barcodeBatchDeserializer}setup(){let e=this.Module.BarcodeBatchListener.extend("BarcodeTrackingListener",{didUpdateSession:(r,i,s)=>{this.barcodeBatchDidUpdateSession(i),r.delete(),i.delete(),s.delete()},onTrackedBarcodeTapped:(r,i)=>{this.onTrackedBarcodeTapped(i),r.delete(),i.delete()}}),a=this.Module.BarcodeBatchDeserializerListener.extend("BarcodeTrackingDeserializerListener",{onModeDeserializationFinished:(r,i,s)=>{this.trackingListenerSet||(i.addListener(new e,1),this.trackingListenerSet=!0),r.delete(),i.delete(),s.delete()},onModeDeserializationStarted(r,i,s){r.delete(),i.delete(),s.delete()},onSettingsDeserializationStarted(r,i,s){r.delete(),i.delete(),s.delete()},onSettingsDeserializationFinished(r,i,s){r.delete(),i.delete(),s.delete()}});this.barcodeBatchDeserializer=new this.Module.BarcodeBatchDeserializer,this.barcodeBatchDeserializer.setListener(new a)}onTrackedBarcodeTapped(e){this.workerFunctions.postMessage({type:"didTapTrackedBarcode",payload:JSON.parse(e.toJson())})}};var N=class{constructor(e,a,r){this.captureListenerSet=!1;this.coreEngine=e,this.Module=a,this.workerFunctions=r,this.setup()}barcodeCaptureDidUpdateSession(e){this.workerFunctions.postMessage({type:"barcodeCaptureDidUpdateSession",payload:JSON.parse(e.toJson())})}barcodeBatchDidUpdateSession(e){this.workerFunctions.postMessage({type:"barcodeBatchDidUpdateSession",payload:JSON.parse(e.toJson())})}getCaptureDeserializer(){return this.barcodeCaptureDeserializer}getTrackingDeserializer(){return this.barcodeBatchDeserializer}setup(){let e=this.Module.BarcodeCaptureListener.extend("BarcodeCaptureListener",{didScan:(o,n,d)=>{this.barcodeCaptureDidScan(n,d),o.delete(),d.delete(),n.delete()},didUpdateSession:(o,n,d)=>{this.barcodeCaptureDidUpdateSession(n),o.delete(),d.delete(),n.delete()}}),a=this.Module.Feedback.extend("Feedback",{emit:()=>{this.successFeedback()}}),r=new e,i=new a,s=this.Module.BarcodeCaptureDeserializerListener.extend("BarcodeCaptureDeserializerListener",{onModeDeserializationFinished:(o,n,d)=>{n.addListener(r,1),n.setSuccessFeedback(i),o.delete(),n.delete(),d.delete()},onModeDeserializationStarted(o,n,d){o.delete(),n.delete(),d.delete()},onSettingsDeserializationStarted(o,n,d){o.delete(),n.delete(),d.delete()},onSettingsDeserializationFinished(o,n,d){o.delete(),n.delete(),d.delete()}});this.barcodeCaptureDeserializer=new this.Module.BarcodeCaptureDeserializer,this.barcodeCaptureDeserializer.setListener(new s)}successFeedback(){this.workerFunctions.postMessage({type:"successFeedback"})}barcodeCaptureDidScan(e,a){let r=this.coreEngine.convertToLoadableFrameData(a);this.workerFunctions.postMessage({type:"barcodeCaptureDidScan",payload:{session:JSON.parse(e.toJson()),frameData:r}})}};function Je(t){return t.charAt(0).toUpperCase()+t.slice(1)}function Me(t){return t}var H=class{constructor(e,a,r){this.barcodeFind=null;this.basicOverlay=null;this.transparentGuidanceHintStyle={backgroundColor:"00000000",cornerRadius:4,fitToText:!1,isAnimatedToView:!1,textAlignment:O.Center,hintIcon:E.None,hintAnchor:L.AboveViewFinder,hintAnchorOffset:-12,horizontalMargin:0,iconColor:"00000000",lineHeight:-1,maxLines:1,maxWidthFraction:.8,textColor:"ffffffff",textSize:15,textWeight:600};this.customerTransformation=Me;this.coreEngine=e,this.Module=a,this.workerFunctions=r}async forSettings(e){var o;(o=this.barcodeFind)==null||o.delete(),this.barcodeFind=new this.Module.BarcodeFind(this.coreEngine.context,JSON.stringify(e));let a=this.Module.Feedback.extend("Feedback",{emit:()=>{this.listUpdatedFeedback()}}),r=this.Module.Feedback.extend("Feedback",{emit:()=>{this.barcodeFindFeedback()}}),i=this.Module.BarcodeFindTransformer.extend("BarcodeFindTransformer",{transformBarcodeData:n=>this.customerTransformation(n)}),s=this.Module.BarcodeFindListener.extend("BarcodeFindListener",{didUpdateSession:(n,d,l)=>{let h=this.coreEngine.convertToLoadableFrameData(l);this.workerFunctions.postMessage({type:"barcodeFindDidUpdateSession",payload:{session:JSON.parse(d.toJson()),frameData:h}}),n.delete(),d.delete(),l.delete()},onSearchPaused:n=>{let d=[];for(let l=0;l<n.size();l++)d.push(n.get(l));this.workerFunctions.postMessage({type:"barcodeFindSearchPaused",payload:{foundItems:d}})},onSearchStopped:n=>{let d=[];for(let l=0;l<n.size();l++)d.push(n.get(l));this.workerFunctions.postMessage({type:"barcodeFindSearchStopped",payload:{foundItems:d}})},onSearchStarted:()=>{this.workerFunctions.postMessage({type:"barcodeFindSearchStarted",payload:{}})}});this.barcodeFind.setBarcodeFindTransformer(new i),this.barcodeFind.addListener(new s,1),this.barcodeFind.setItemListUpdatedFeedback(new a),this.barcodeFind.setFeedback(new r),this.Module.addBarcodeFindToContext(this.coreEngine.context,this.barcodeFind)}barcodeFindFeedback(){this.workerFunctions.postMessage({type:"barcodeFindFeedback",payload:{}})}start(){var e;(e=this.barcodeFind)==null||e.start()}stop(){var e;(e=this.barcodeFind)==null||e.stop()}pause(){var e;(e=this.barcodeFind)==null||e.pause()}setEnabled(e){var a;(a=this.barcodeFind)==null||a.setEnabled(e)}setItemList(e){var a;(a=this.barcodeFind)==null||a.setItemList(JSON.stringify(e))}async removeMode(){this.barcodeFind!=null&&this.Module.removeBarcodeFindFromContext(this.coreEngine.context,this.barcodeFind)}addBasicOverlay(){var e;(e=this.basicOverlay)==null||e.delete(),this.basicOverlay=null,this.barcodeFind!=null&&(this.basicOverlay=new this.Module.BarcodeFindBasicOverlay(this.barcodeFind)),this.coreEngine.view!=null&&this.basicOverlay!=null&&(this.basicOverlay.setGuidanceHandler(this.createWebFindGuidanceHandler()),this.Module.addBarcodeFindBasicOverlayToView(this.coreEngine.view,this.basicOverlay))}removeBasicOverlay(){this.coreEngine.view!=null&&this.basicOverlay!=null&&this.Module.removeBarcodeFindBasicOverlayFromView(this.coreEngine.view,this.basicOverlay)}async applySettings(e){var a;(a=this.barcodeFind)==null||a.applySettings(JSON.stringify(e))}updateBasicOverlay(e){let a=Object.entries(e).filter(([r,i])=>r!=="type");for(let[r,i]of a){let s=`set${Je(r)}`;this.basicOverlay!=null&&typeof this.basicOverlay[s]=="function"&&i!=null&&this.basicOverlay[s](i)}}setTransformerFunction(e){this.customerTransformation=e!=null?e:Me}successFeedback(){this.workerFunctions.postMessage({type:"successFeedback"})}listUpdatedFeedback(){this.workerFunctions.postMessage({type:"barcodeFindListUpdatedFeedback",payload:{}})}setToast(e,a){let r=this.coreEngine.hintPresenterV2;e?r==null||r.showToast(JSON.stringify(a)):r==null||r.hideToast(a.tag)}setGuidance(e,a,r){let i={tag:r,text:a,hintStyle:this.transparentGuidanceHintStyle};this.workerFunctions.postMessage({type:e?"showGuidance":"hideGuidance",payload:i})}createWebFindGuidanceHandler(){let e=this.Module.BarcodeFindGuidanceHandler.extend("BarcodeFindGuidanceHandler",{setInitialGuidance:(a,r)=>{this.setGuidance(a,r,"InitialGuidance")},setMoveCloserGuidance:(a,r)=>{this.setGuidance(!1,r,"InitialGuidance"),this.setGuidance(a,r,"MoveCloserGuidance")},setTapShutterToPause:(a,r)=>{this.setGuidance(!1,r,"InitialGuidance"),this.setGuidance(a,r,"TapShutterToPause")},setTapShutterToResume:(a,r)=>{this.setGuidance(!1,r,"InitialGuidance"),this.setGuidance(a,r,"TapShutterResume")}});return new e}};var S=class{constructor(e){this.subscribers=new Set;this.property={key:e,value:null}}addSubscriber(e){var a;this.subscribers.add(e),(a=e.onPropertyChanged)==null||a.call(e,this.property)}removeSubscriber(e){this.subscribers.delete(e)}setProperty(e){var a;if(this.property.value!==e.value){this.property={key:this.property.key,value:e.value};for(let r of this.subscribers)(a=r.onPropertyChanged)==null||a.call(r,this.property)}}};var Ve={torch_state:new S("torch_state"),scanning_mode:new S("scanning_mode"),sound_enabled:new S("sound_enabled"),haptic_enabled:new S("haptic_enabled"),session_stop_reason:new S("session_stop_reason"),camera_position:new S("camera_position")},_=class{getBehaviorSubject(e){return Ve[e]}};var z=class{constructor(e,a,r){this.captureListenerSet=!1;this.propertyPushSource=new _;this.coreEngine=e,this.Module=a,this.workerFunctions=r,this.setup()}sparkScanDidUpdateSession(e){this.workerFunctions.postMessage({type:"sparkScanDidUpdateSession",payload:JSON.parse(e.toJson())})}getSparkScanDeserializer(){return this.sparkScanDeserializer}setup(){let e=this.Module.SparkScanListener.extend("SparkScanListener",{didScan:(i,s,o)=>{this.sparkScanDidScan(s,o),i.delete(),s.delete(),o.delete()},didUpdateSession:(i,s,o)=>{this.sparkScanDidUpdateSession(s),i.delete(),s.delete(),o.delete()}}),a=this.Module.Feedback.extend("Feedback",{emit:()=>{this.successFeedback()}}),r=this.Module.SparkScanDeserializerListener.extend("SparkScanDeserializerListener",{onModeDeserializationFinished:(i,s,o)=>{if(!this.captureListenerSet){s.addListener(new e,1),s.setSuccessFeedback(new a),s.setPropertyPushSource(this.propertyPushSource);let n=this.Module.SparkScanViewHandlerDelegate.extend("SparkScanViewHandlerDelegate",{onSwitchedAwayFromSmartScanSelection:()=>{this.workerFunctions.postMessage({type:"sparkScanSwitchedAwayFromSmartScanSelection"})},onSwitchedToSmartScanSelection:()=>{this.workerFunctions.postMessage({type:"sparkScanSwitchedToSmartScanSelection"})},enableHapticWhenOverlapping:()=>{},onStateTransition:()=>{},resetAllTimers:()=>{}}),d=new n,l=s.getStateMachine();l.setViewHandlerDelegate(d),d.delete(),l.delete(),this.sparkScan=s.clone(),this.captureListenerSet=!0}i.delete(),o.delete(),s.delete()},onModeDeserializationStarted(i,s,o){i.delete(),s.delete(),o.delete()},onSettingsDeserializationStarted(i,s,o){i.delete(),s.delete(),o.delete()},onSettingsDeserializationFinished(i,s,o){i.delete(),s.delete(),o.delete()},onOverlayDeserializationStarted(i,s,o){i.delete(),s.delete(),o.delete()},onOverlayDeserializationFinished:(i,s,o)=>{var n;(n=this.sparkScanOverlay)==null||n.delete(),this.sparkScanOverlay=s,i.delete(),o.delete()}});this.sparkScanDeserializer=new this.Module.SparkScanDeserializer,this.sparkScanDeserializer.setListener(new r)}emitErrorFeedback(e){var a;(a=this.sparkScanOverlay)==null||a.onErrorFeedbackEmitted(e)}overlayReadyForDraw(){var e;(e=this.sparkScanOverlay)==null||e.onReadyForNewData()}analyticsManagerPropertyChanged(e){this.propertyPushSource.getBehaviorSubject(e.key).setProperty(e)}successFeedback(){this.workerFunctions.postMessage({type:"successFeedback"})}selectItemWithSmartScanSelection(){var e;(e=this.sparkScan)==null||e.selectItemWithSmartScanSelectionAsync()}async removeMode(){var e,a;this.captureListenerSet=!1,(e=this.sparkScan)==null||e.delete(),this.sparkScan=void 0,(a=this.sparkScanOverlay)==null||a.delete(),this.sparkScanOverlay=void 0}sparkScanDidScan(e,a){let r=this.coreEngine.convertToLoadableFrameData(a);this.workerFunctions.postMessage({type:"sparkScanDidScan",payload:{session:JSON.parse(e.toJson()),frameData:r}})}};var J=class extends D{constructor(e,a){super(e,a)}getModeDeserializers(){this.barcodeCaptureMode=new N(this,this.Module,this.workerFunctions),this.barcodeBatchMode=new R(this,this.Module,this.workerFunctions),this.sparkScanMode=new z(this,this.Module,this.workerFunctions),this.barcodeFindMode=new H(this,this.Module,this.workerFunctions),this.barcodeArMode=new W(this,this.Module,this.workerFunctions);let e=super.getModeDeserializers();return e.push_back(this.barcodeCaptureMode.getCaptureDeserializer()),e.push_back(this.barcodeBatchMode.getBatchDeserializer()),e.push_back(this.sparkScanMode.getSparkScanDeserializer()),e}getWasmSideModuleFileName(){return""}getWasmCoreFileName(e,a){return a?e?"scandit-datacapture-sdk-barcode-simd-pthreads.wasm":"scandit-datacapture-sdk-barcode-pthreads.wasm":e?"scandit-datacapture-sdk-barcode-simd.wasm":"scandit-datacapture-sdk-barcode.wasm"}getWasmCoreExpectedHash(e,a){return a?e?"830dc2a432f9ed0e9633d2e85adea48784e2c9c65caf2f69111b15efa678467f":"4d2a9d39f458a2fe8850dd0cbfb2b63cf0be5248ea087ee0dfab7fba2925bfc3":e?"bdb001f777adb1eee19cc360422de40f1f6914ccf5ae4eb0c194096a3c8df72a":"a66559151262635deaca61d5679683235473ca36ce8bdc573b6d1b67bc323476"}getWasmMetadata(){return u}};function Ue(t){return(a=>/^[$A-Z_a-z][\\w$]*\\s*\\(.*\\)\\s*\\{/.test(a)&&!a.startsWith("function"))(t)?`function ${t}`:t}var $e=["fetch","XMLHttpRequest","eval","Function","self","globalThis","Module","importScripts","this","console","window","document","import","Worker","ServiceWorker"];function Ge(t){return $e.map(a=>new RegExp(`\\\\b${a}\\\\b`,"g")).some(a=>a.test(t))}function Ce(t){if(t==null)return null;let e=Ue(t);if(Ge(e))throw new Error("Function should be pure. Shouldn\'t introduce side effects, or rely on global scope");let a=`\'use strict\';\n return (${e});`;try{return new Function(a)()}catch{return null}}var V=class extends Q{constructor(e,a){super(e,a),this.dataCaptureInstance=new J(a,{postMessage:this.postMessage.bind(this),getOffscreenCanvas:this.getOffscreenCanvas.bind(this)})}async respondWith(e,a,r){let i=null,s;try{s=r(),s instanceof Promise&&(s=await s)}catch(n){s=void 0,i=C(n)}let o={type:"workerTaskId",command:e,id:a,payload:this.hasPayload(s)?s.payload:void 0};i!=null&&(o.error=i),this.postMessage(o,this.hasTransferables(s)?s.transferables:[])}onMessage(e){switch(e.data.command){case"sparkScanEmitErrorFeedback":{let{data:a}=e;return this.respondWith(a.command,a.id,()=>{this.dataCaptureInstance.sparkScanMode.emitErrorFeedback(a.shouldRemoveBrush)}),!0}case"sparkScanOverlayReadyForDraw":{let{data:a}=e;return this.respondWith(a.command,a.id,()=>{this.dataCaptureInstance.sparkScanMode.overlayReadyForDraw()}),!0}case"sparkScanAnalyticsManagerPropertyChanged":{let{data:a}=e;return this.respondWith(a.command,a.id,async()=>{this.dataCaptureInstance.sparkScanMode.analyticsManagerPropertyChanged(a.property)}),!0}case"sparkScanSelectItemWithSmartScanSelection":{let{data:a}=e;return this.respondWith(a.command,a.id,async()=>{this.dataCaptureInstance.sparkScanMode.selectItemWithSmartScanSelection()}),!0}case"sparkScanModeRemove":{let{data:a}=e;return this.respondWith(a.command,a.id,async()=>this.dataCaptureInstance.sparkScanMode.removeMode()),!0}case"barcodeFindForSettings":{let{data:a}=e;return this.respondWith(a.command,a.id,async()=>this.dataCaptureInstance.barcodeFindMode.forSettings(a.settings)),!0}case"barcodeFindModeRemove":{let{data:a}=e;return this.respondWith(a.command,a.id,async()=>this.dataCaptureInstance.barcodeFindMode.removeMode()),!0}case"barcodeFindSearchStart":return this.respondWith(e.data.command,e.data.id,()=>{this.dataCaptureInstance.barcodeFindMode.start()}),!0;case"barcodeFindSearchPause":return this.respondWith(e.data.command,e.data.id,()=>{this.dataCaptureInstance.barcodeFindMode.pause()}),!0;case"barcodeFindSearchStop":return this.respondWith(e.data.command,e.data.id,()=>{this.dataCaptureInstance.barcodeFindMode.stop()}),!0;case"barcodeFindSetItemList":{let{data:a}=e;return this.respondWith(e.data.command,e.data.id,()=>{this.dataCaptureInstance.barcodeFindMode.setItemList(a.itemList)}),!0}case"barcodeFindSetEnabled":{let{data:a}=e;return this.respondWith(e.data.command,e.data.id,()=>{this.dataCaptureInstance.barcodeFindMode.setEnabled(a.enabled)}),!0}case"barcodeFindApplySettings":{let{data:a}=e;return this.respondWith(a.command,a.id,async()=>this.dataCaptureInstance.barcodeFindMode.applySettings(a.settings)),!0}case"barcodeFindAddBasicOverlay":{let{data:a}=e;return this.respondWith(a.command,a.id,async()=>{this.dataCaptureInstance.barcodeFindMode.addBasicOverlay()}),!0}case"barcodeFindRemoveBasicOverlay":{let{data:a}=e;return this.respondWith(a.command,a.id,async()=>{this.dataCaptureInstance.barcodeFindMode.removeBasicOverlay()}),!0}case"barcodeFindUpdateBasicOverlay":{let{data:a}=e;return this.respondWith(a.command,a.id,async()=>{this.dataCaptureInstance.barcodeFindMode.updateBasicOverlay(a.jsonOverlay)}),!0}case"barcodeFindSetTransformerFunction":{let{data:a}=e;return this.respondWith(a.command,a.id,async()=>{let r=Ce(a.functionAsString);this.dataCaptureInstance.barcodeFindMode.setTransformerFunction(r)}),!0}case"barcodeArForSettings":{let{data:a}=e;return this.respondWith(a.command,a.id,async()=>this.dataCaptureInstance.barcodeArMode.forSettings(a.settings)),!0}case"barcodeArModeRemove":{let{data:a}=e;return this.respondWith(a.command,a.id,async()=>this.dataCaptureInstance.barcodeArMode.removeMode()),!0}case"barcodeArSearchStart":return this.respondWith(e.data.command,e.data.id,()=>{this.dataCaptureInstance.barcodeArMode.start()}),!0;case"barcodeArSearchPause":return this.respondWith(e.data.command,e.data.id,()=>{this.dataCaptureInstance.barcodeArMode.pause()}),!0;case"barcodeArSearchStop":return this.respondWith(e.data.command,e.data.id,()=>{this.dataCaptureInstance.barcodeArMode.stop()}),!0;case"barcodeArSetEnabled":{let{data:a}=e;return this.respondWith(e.data.command,e.data.id,()=>{this.dataCaptureInstance.barcodeArMode.setEnabled(a.enabled)}),!0}case"barcodeArApplySettings":{let{data:a}=e;return this.respondWith(a.command,a.id,async()=>{this.dataCaptureInstance.barcodeArMode.applySettings(a.settings)}),!0}default:return super.onMessage(e)}}};var nr=new V(self,{get:()=>self.Module,set:t=>{self.Module=t}});function or(t){}})();\n'],{type:"application/javascript"})),e=new Worker(s,r);return URL.revokeObjectURL(s),e}var o=class r extends DataCaptureLoader{constructor(){super(...arguments);this._name="BarcodeCapture";}get dataCaptureWorker(){return (this._dataCaptureWorker)!=null||(this._dataCaptureWorker=i({name:this.name})),this._dataCaptureWorker}get name(){return this._name}static async create(e){var a;let t=new r(e);return await t.workerCommand("setLogLevel",{level:(a=e.logLevel)!=null?a:Logger.Level.Debug}),await t.load(),t}async workerCommand(e,t,a){return new Promise((d,l)=>{let n=this.workerCommandId++;this.workerTasks.set(n,{resolve:d,reject:l,command:e});let c={...t,command:e,id:n};this.dataCaptureWorker.postMessage(c,a);})}};
2
2
  export{o as a};
@@ -1 +1 @@
1
- import {a as a$1}from'./chunk-SNPWBV7Y.js';import {b}from'./chunk-TCXM24SN.js';import {a}from'./chunk-SW4KBS3X.js';import {CameraSettings,convertToPublicFrameData}from'@scandit/web-datacapture-core';import {warnMultithreadingUnavailable}from'@scandit/web-datacapture-core/build/js/private/utils/warnMultithreadingUnavailable.js';var o=class n{constructor(){this.skipSerialization=true;this.type="barcodeAr";this._isEnabled=true;this._context=null;this.listeners=new Set;this.privateListeners=new Set;this.workerMessageListener=this.onWorkerMessage.bind(this);}get context(){return this._context}static createRecommendedCameraSettings(){return new CameraSettings(b)}set context(e){this._context=e;}get allListeners(){return [...this.privateListeners,...this.listeners]}static async forContext(e,t){warnMultithreadingUnavailable();let r=new n;return r.feedback=await a.createDefaultBarcodeArFeedback(),r.settings=t,await e.setMode(r),r}isEnabled(){return this._isEnabled}addListener(e){this.listeners.add(e);}removeListener(e){this.listeners.delete(e);}set feedback(e){this._feedback=e;}get feedback(){return this._feedback}async setEnabled(e){var t;this._isEnabled=e,await this.workerCommand("barcodeArSetEnabled",{enabled:e}),await((t=this.context)==null?void 0:t.update([{type:"modeEnabled",newValue:e}],{updateContext:false}));}async applySettings(e){this.settings=e,await this.workerCommand("barcodeArApplySettings",{settings:e.toJSONObject()});}toJSONObject(){return {type:this.type,enabled:this._isEnabled,settings:this.settings.toJSONObject()}}async attachedToContext(e){this._context=e,this._context.subscribeToWorkerMessages(this.workerMessageListener),await this.workerCommand("barcodeArForSettings",{settings:this.settings.toJSONObject()});}async detachedFromContext(){var e;await this.workerCommand("barcodeArModeRemove",{}),(e=this._context)==null||e.unsubscribeToWorkerMessages(this.workerMessageListener),this._context=null;}async start(){return this.workerCommand("barcodeArSearchStart",{})}async stop(){return this.workerCommand("barcodeArSearchStop",{})}async pause(){return this.workerCommand("barcodeArSearchPause",{})}async workerCommand(e,t){this.context!=null&&await this.context.workerCommand(e,t);}addPrivateListener(e){this.privateListeners.add(e);}removePrivateListener(e){this.privateListeners.delete(e);}async onWorkerMessage(e){var t;switch(e.type){case "barcodeArDidUpdateSession":{if(!this._isEnabled||!this._context)return;for(let r of this.allListeners)(t=r.didUpdateSession)==null||t.call(r,this,a$1.fromJSON(e.payload.session),convertToPublicFrameData(e.payload.frameData,this._context));break}}}};export{o as a};
1
+ import {a as a$1}from'./chunk-SNPWBV7Y.js';import {b}from'./chunk-TCXM24SN.js';import {a}from'./chunk-CPKZVW3K.js';import {CameraSettings,convertToPublicFrameData}from'@scandit/web-datacapture-core';import {warnMultithreadingUnavailable}from'@scandit/web-datacapture-core/build/js/private/utils/warnMultithreadingUnavailable.js';var o=class n{constructor(){this.skipSerialization=true;this.type="barcodeAr";this._isEnabled=true;this._context=null;this.listeners=new Set;this.privateListeners=new Set;this.workerMessageListener=this.onWorkerMessage.bind(this);}get context(){return this._context}static createRecommendedCameraSettings(){return new CameraSettings(b)}set context(e){this._context=e;}get allListeners(){return [...this.privateListeners,...this.listeners]}static async forContext(e,t){warnMultithreadingUnavailable();let r=new n;return r.feedback=await a.createDefaultBarcodeArFeedback(),r.settings=t,await e.setMode(r),r}isEnabled(){return this._isEnabled}addListener(e){this.listeners.add(e);}removeListener(e){this.listeners.delete(e);}set feedback(e){this._feedback=e;}get feedback(){return this._feedback}async setEnabled(e){var t;this._isEnabled=e,await this.workerCommand("barcodeArSetEnabled",{enabled:e}),await((t=this.context)==null?void 0:t.update([{type:"modeEnabled",newValue:e}],{updateContext:false}));}async applySettings(e){this.settings=e,await this.workerCommand("barcodeArApplySettings",{settings:e.toJSONObject()});}toJSONObject(){return {type:this.type,enabled:this._isEnabled,settings:this.settings.toJSONObject()}}async attachedToContext(e){this._context=e,this._context.subscribeToWorkerMessages(this.workerMessageListener),await this.workerCommand("barcodeArForSettings",{settings:this.settings.toJSONObject()});}async detachedFromContext(){var e;await this.workerCommand("barcodeArModeRemove",{}),(e=this._context)==null||e.unsubscribeToWorkerMessages(this.workerMessageListener),this._context=null;}async start(){return this.workerCommand("barcodeArSearchStart",{})}async stop(){return this.workerCommand("barcodeArSearchStop",{})}async pause(){return this.workerCommand("barcodeArSearchPause",{})}async workerCommand(e,t){this.context!=null&&await this.context.workerCommand(e,t);}addPrivateListener(e){this.privateListeners.add(e);}removePrivateListener(e){this.privateListeners.delete(e);}async onWorkerMessage(e){var t;switch(e.type){case "barcodeArDidUpdateSession":{if(!this._isEnabled||!this._context)return;for(let r of this.allListeners)(t=r.didUpdateSession)==null||t.call(r,this,a$1.fromJSON(e.payload.session),convertToPublicFrameData(e.payload.frameData,this._context));break}}}};export{o as a};
@@ -1 +1 @@
1
- import {a as a$2,b}from'./chunk-HTKUJZG2.js';import {a}from'./chunk-M4AENTE5.js';import {a as a$3}from'./chunk-55SHUUX6.js';import {a as a$1}from'./chunk-DHKABHFE.js';import {CameraSettings,convertToPublicFrameData}from'@scandit/web-datacapture-core';import {warnMultithreadingUnavailable}from'@scandit/web-datacapture-core/build/js/private/utils/warnMultithreadingUnavailable.js';var l=class u{constructor(){this.feedback=a.createDefaultFeedback();this.skipSerialization=true;this.type="barcodeFind";this._isEnabled=true;this._context=null;this.listeners=new Set;this.privateListeners=new Set;this.workerMessageListener=this.onWorkerMessage.bind(this);this._transformer=null;}static get recommendedCameraSettings(){return new CameraSettings(a$1.CameraSettings.settings)}get context(){return this._context}get allListeners(){return [...this.privateListeners,...this.listeners]}static async forSettings(e){warnMultithreadingUnavailable();let a=new u;return a.settings=e,a}isEnabled(){return this._isEnabled}async setEnabled(e){var a;this._isEnabled=e,await this.workerCommand("barcodeFindSetEnabled",{enabled:e}),await((a=this.context)==null?void 0:a.update([{type:"modeEnabled",newValue:e}],{updateContext:false}));}async applySettings(e){this.settings=e,await this.workerCommand("barcodeFindApplySettings",{settings:e.toJSONObject()});}addListener(e){this.listeners.add(e);}removeListener(e){this.listeners.delete(e);}async setItemList(e){var a;for(let r of this.privateListeners)(a=r.onSetItemList)==null||a.call(r,e);return this.workerCommand("barcodeFindSetItemList",{itemList:e.map(r=>r.toJSONObject())})}async setBarcodeTransformer(e){var a;return this._transformer=e,this.workerCommand("barcodeFindSetTransformerFunction",{functionAsString:(a=this._transformer)==null?void 0:a.transformBarcodeData.toString()})}async start(){return this.workerCommand("barcodeFindSearchStart",{})}async stop(){return this.workerCommand("barcodeFindSearchStop",{})}async pause(){return this.workerCommand("barcodeFindSearchPause",{})}toJSONObject(){return {type:this.type,enabled:this.isEnabled(),settings:this.settings.toJSONObject()}}async workerCommand(e,a){this.context!=null&&await this.context.workerCommand(e,a);}async attachedToContext(e){this._context=e,this._context.subscribeToWorkerMessages(this.workerMessageListener),await this.workerCommand("barcodeFindForSettings",{settings:this.settings.toJSONObject()});}async detachedFromContext(){var e;await this.workerCommand("barcodeFindModeRemove",{}),(e=this._context)==null||e.unsubscribeToWorkerMessages(this.workerMessageListener),this._context=null;}async onWorkerMessage(e){var a,r,d;switch(e.type){case "barcodeFindDidUpdateSession":{if(this._context==null)return;for(let t of this.allListeners)(a=t.onDidUpdateSession)==null||a.call(t,this,a$3.fromJSON(e.payload.session),convertToPublicFrameData(e.payload.frameData,this._context));break}case "barcodeFindSearchPaused":{for(let t of this.allListeners){let i=e.payload.foundItems.map(o=>new a$2(new b(o),null));t.didPauseSearch(i);}break}case "barcodeFindSearchStarted":{for(let t of this.allListeners)t.didStartSearch();break}case "barcodeFindSearchStopped":{for(let t of this.allListeners){let i=e.payload.foundItems.map(o=>new a$2(new b(o),null));t.didStopSearch(i);}break}case "barcodeFindListUpdatedFeedback":{for(let t of this.allListeners)(r=t.onFindListUpdatedFeedback)==null||r.call(t);break}case "barcodeFindFeedback":{for(let t of this.allListeners)(d=t.onFeedback)==null||d.call(t);break}}}addPrivateListener(e){this.privateListeners.add(e);}removePrivateListener(e){this.privateListeners.delete(e);}};export{l as a};
1
+ import {a as a$2,b}from'./chunk-HTKUJZG2.js';import {a}from'./chunk-M4AENTE5.js';import {a as a$1}from'./chunk-DHKABHFE.js';import {a as a$3}from'./chunk-55SHUUX6.js';import {CameraSettings,convertToPublicFrameData}from'@scandit/web-datacapture-core';import {warnMultithreadingUnavailable}from'@scandit/web-datacapture-core/build/js/private/utils/warnMultithreadingUnavailable.js';var l=class u{constructor(){this.feedback=a.createDefaultFeedback();this.skipSerialization=true;this.type="barcodeFind";this._isEnabled=true;this._context=null;this.listeners=new Set;this.privateListeners=new Set;this.workerMessageListener=this.onWorkerMessage.bind(this);this._transformer=null;}static get recommendedCameraSettings(){return new CameraSettings(a$1.CameraSettings.settings)}get context(){return this._context}get allListeners(){return [...this.privateListeners,...this.listeners]}static async forSettings(e){warnMultithreadingUnavailable();let a=new u;return a.settings=e,a}isEnabled(){return this._isEnabled}async setEnabled(e){var a;this._isEnabled=e,await this.workerCommand("barcodeFindSetEnabled",{enabled:e}),await((a=this.context)==null?void 0:a.update([{type:"modeEnabled",newValue:e}],{updateContext:false}));}async applySettings(e){this.settings=e,await this.workerCommand("barcodeFindApplySettings",{settings:e.toJSONObject()});}addListener(e){this.listeners.add(e);}removeListener(e){this.listeners.delete(e);}async setItemList(e){var a;for(let r of this.privateListeners)(a=r.onSetItemList)==null||a.call(r,e);return this.workerCommand("barcodeFindSetItemList",{itemList:e.map(r=>r.toJSONObject())})}async setBarcodeTransformer(e){var a;return this._transformer=e,this.workerCommand("barcodeFindSetTransformerFunction",{functionAsString:(a=this._transformer)==null?void 0:a.transformBarcodeData.toString()})}async start(){return this.workerCommand("barcodeFindSearchStart",{})}async stop(){return this.workerCommand("barcodeFindSearchStop",{})}async pause(){return this.workerCommand("barcodeFindSearchPause",{})}toJSONObject(){return {type:this.type,enabled:this.isEnabled(),settings:this.settings.toJSONObject()}}async workerCommand(e,a){this.context!=null&&await this.context.workerCommand(e,a);}async attachedToContext(e){this._context=e,this._context.subscribeToWorkerMessages(this.workerMessageListener),await this.workerCommand("barcodeFindForSettings",{settings:this.settings.toJSONObject()});}async detachedFromContext(){var e;await this.workerCommand("barcodeFindModeRemove",{}),(e=this._context)==null||e.unsubscribeToWorkerMessages(this.workerMessageListener),this._context=null;}async onWorkerMessage(e){var a,r,d;switch(e.type){case "barcodeFindDidUpdateSession":{if(this._context==null)return;for(let t of this.allListeners)(a=t.onDidUpdateSession)==null||a.call(t,this,a$3.fromJSON(e.payload.session),convertToPublicFrameData(e.payload.frameData,this._context));break}case "barcodeFindSearchPaused":{for(let t of this.allListeners){let i=e.payload.foundItems.map(o=>new a$2(new b(o),null));t.didPauseSearch(i);}break}case "barcodeFindSearchStarted":{for(let t of this.allListeners)t.didStartSearch();break}case "barcodeFindSearchStopped":{for(let t of this.allListeners){let i=e.payload.foundItems.map(o=>new a$2(new b(o),null));t.didStopSearch(i);}break}case "barcodeFindListUpdatedFeedback":{for(let t of this.allListeners)(r=t.onFindListUpdatedFeedback)==null||r.call(t);break}case "barcodeFindFeedback":{for(let t of this.allListeners)(d=t.onFeedback)==null||d.call(t);break}}}addPrivateListener(e){this.privateListeners.add(e);}removePrivateListener(e){this.privateListeners.delete(e);}};export{l as a};
@@ -0,0 +1 @@
1
+ import {a}from'./chunk-DSAATLKK.js';import {a as a$1}from'./chunk-TRITJ43A.js';import {unknownErrorToString}from'@scandit/web-datacapture-core/build/js/private/utils/unknownErrorToString.js';import {WorkerMain}from'@scandit/web-datacapture-core/build/js/worker/index.js';var i=class extends WorkerMain{constructor(t,a$1){super(t,a$1),this.dataCaptureInstance=new a(a$1,{postMessage:this.postMessage.bind(this),getOffscreenCanvas:this.getOffscreenCanvas.bind(this)});}async respondWith(t,a,r){let d=null,e;try{e=r(),e instanceof Promise&&(e=await e);}catch(c){e=void 0,d=unknownErrorToString(c);}let s={type:"workerTaskId",command:t,id:a,payload:this.hasPayload(e)?e.payload:void 0};d!=null&&(s.error=d),this.postMessage(s,this.hasTransferables(e)?e.transferables:[]);}onMessage(t){switch(t.data.command){case "sparkScanEmitErrorFeedback":{let{data:a}=t;return this.respondWith(a.command,a.id,()=>{this.dataCaptureInstance.sparkScanMode.emitErrorFeedback(a.shouldRemoveBrush);}),true}case "sparkScanOverlayReadyForDraw":{let{data:a}=t;return this.respondWith(a.command,a.id,()=>{this.dataCaptureInstance.sparkScanMode.overlayReadyForDraw();}),true}case "sparkScanAnalyticsManagerPropertyChanged":{let{data:a}=t;return this.respondWith(a.command,a.id,async()=>{this.dataCaptureInstance.sparkScanMode.analyticsManagerPropertyChanged(a.property);}),true}case "sparkScanSelectItemWithSmartScanSelection":{let{data:a}=t;return this.respondWith(a.command,a.id,async()=>{this.dataCaptureInstance.sparkScanMode.selectItemWithSmartScanSelection();}),true}case "sparkScanModeRemove":{let{data:a}=t;return this.respondWith(a.command,a.id,async()=>this.dataCaptureInstance.sparkScanMode.removeMode()),true}case "barcodeFindForSettings":{let{data:a}=t;return this.respondWith(a.command,a.id,async()=>this.dataCaptureInstance.barcodeFindMode.forSettings(a.settings)),true}case "barcodeFindModeRemove":{let{data:a}=t;return this.respondWith(a.command,a.id,async()=>this.dataCaptureInstance.barcodeFindMode.removeMode()),true}case "barcodeFindSearchStart":return this.respondWith(t.data.command,t.data.id,()=>{this.dataCaptureInstance.barcodeFindMode.start();}),true;case "barcodeFindSearchPause":return this.respondWith(t.data.command,t.data.id,()=>{this.dataCaptureInstance.barcodeFindMode.pause();}),true;case "barcodeFindSearchStop":return this.respondWith(t.data.command,t.data.id,()=>{this.dataCaptureInstance.barcodeFindMode.stop();}),true;case "barcodeFindSetItemList":{let{data:a}=t;return this.respondWith(t.data.command,t.data.id,()=>{this.dataCaptureInstance.barcodeFindMode.setItemList(a.itemList);}),true}case "barcodeFindSetEnabled":{let{data:a}=t;return this.respondWith(t.data.command,t.data.id,()=>{this.dataCaptureInstance.barcodeFindMode.setEnabled(a.enabled);}),true}case "barcodeFindApplySettings":{let{data:a}=t;return this.respondWith(a.command,a.id,async()=>this.dataCaptureInstance.barcodeFindMode.applySettings(a.settings)),true}case "barcodeFindAddBasicOverlay":{let{data:a}=t;return this.respondWith(a.command,a.id,async()=>{this.dataCaptureInstance.barcodeFindMode.addBasicOverlay();}),true}case "barcodeFindRemoveBasicOverlay":{let{data:a}=t;return this.respondWith(a.command,a.id,async()=>{this.dataCaptureInstance.barcodeFindMode.removeBasicOverlay();}),true}case "barcodeFindUpdateBasicOverlay":{let{data:a}=t;return this.respondWith(a.command,a.id,async()=>{this.dataCaptureInstance.barcodeFindMode.updateBasicOverlay(a.jsonOverlay);}),true}case "barcodeFindSetTransformerFunction":{let{data:a}=t;return this.respondWith(a.command,a.id,async()=>{let r=a$1(a.functionAsString);this.dataCaptureInstance.barcodeFindMode.setTransformerFunction(r);}),true}case "barcodeArForSettings":{let{data:a}=t;return this.respondWith(a.command,a.id,async()=>this.dataCaptureInstance.barcodeArMode.forSettings(a.settings)),true}case "barcodeArModeRemove":{let{data:a}=t;return this.respondWith(a.command,a.id,async()=>this.dataCaptureInstance.barcodeArMode.removeMode()),true}case "barcodeArSearchStart":return this.respondWith(t.data.command,t.data.id,()=>{this.dataCaptureInstance.barcodeArMode.start();}),true;case "barcodeArSearchPause":return this.respondWith(t.data.command,t.data.id,()=>{this.dataCaptureInstance.barcodeArMode.pause();}),true;case "barcodeArSearchStop":return this.respondWith(t.data.command,t.data.id,()=>{this.dataCaptureInstance.barcodeArMode.stop();}),true;case "barcodeArSetEnabled":{let{data:a}=t;return this.respondWith(t.data.command,t.data.id,()=>{this.dataCaptureInstance.barcodeArMode.setEnabled(a.enabled);}),true}case "barcodeArApplySettings":{let{data:a}=t;return this.respondWith(a.command,a.id,async()=>{this.dataCaptureInstance.barcodeArMode.applySettings(a.settings);}),true}default:return super.onMessage(t)}}};export{i as a};
@@ -0,0 +1 @@
1
+ import {a as a$1}from'./chunk-KEN6J62X.js';import {a}from'./chunk-HDODW33D.js';import {a as a$2}from'./chunk-74KP5NGF.js';import {CameraSettings,convertToPublicFrameData,Logger,DataCaptureContext}from'@scandit/web-datacapture-core';var c=class p{constructor(){this.type="sparkScan";this._synchronousFrameFlow=false;this._isEnabled=true;this._isSuppressed=null;this._context=null;this.listeners=new Set;this.allowedRemainingWorkerMessages=new Set;this.workerMessageListener=this.onWorkerMessage.bind(this);}static get recommendedCameraSettings(){return CameraSettings.fromJSON(a.CameraSettings.settings)}get context(){return this._context}static forSettings(e){let a=new p;return a.settings=e,a}isEnabled(){return this._isEnabled}async setEnabled(e){this._isSuppressed=null,this._isEnabled=e,await this.notifyContext();}isSuppressed(){return this._isSuppressed===true}async setResultSuppressionEnabled(e){this._isSuppressed=e,await this.notifyContext();}async applySettings(e){return this.settings=e,this.notifyContext()}addListener(e){this.listeners.add(e);}removeListener(e){this.listeners.delete(e);}toJSONObject(){let e={type:this.type,enabled:this._isEnabled,settings:this.settings.toJSONObject()};return this._isSuppressed!==null&&(e.isSuppressed=this._isSuppressed),e}async selectItemWithSmartScanSelection(){await this.workerCommand("sparkScanSelectItemWithSmartScanSelection",{});}setDelegate(e){this.delegate=e;}async workerCommand(e,a){this.context&&await this.context.workerCommand(e,a);}attachedToContext(e){this._context=e,this._context.subscribeToWorkerMessages(this.workerMessageListener);}async detachedFromContext(){var e;await this.workerCommand("sparkScanModeRemove",{}),(e=this._context)==null||e.unsubscribeToWorkerMessages(this.workerMessageListener),this._context=null;}sendClearFrameDataRequest(e){queueMicrotask(()=>{var a;(a=this.context)==null||a.workerCommand("deleteFrameData",{frameId:e});});}async onDidScan(e){if(this.context==null)return;let{frameData:a}=e.payload;if(this._isSuppressed){this.sendClearFrameDataRequest(a.frameId),this.allowedRemainingWorkerMessages.clear();return}if(!this._isEnabled){this.sendClearFrameDataRequest(a.frameId),this.allowedRemainingWorkerMessages.clear();return}this.allowedRemainingWorkerMessages.add("successFeedback");let t=[],s=a$1.fromJSON(e.payload.session);for(let r of this.listeners)if(r.didScan)try{let i=r.didScan(this,s,convertToPublicFrameData(a,this.context));i instanceof Promise&&await i;}catch(i){t.push(i);}this.sendClearFrameDataRequest(a.frameId),this.allowedRemainingWorkerMessages.add("sparkScanDidUpdateSession");for(let r of t)Logger.error(r);}onDidUpdateSession(e){var t;if(!this._isEnabled&&!this.allowedRemainingWorkerMessages.has(e.type))return;this.allowedRemainingWorkerMessages.delete(e.type);let a=a$1.fromJSON(e.payload);for(let s of this.listeners)(t=s.didUpdateSession)==null||t.call(s,this,a);}async onWorkerMessage(e){var a,t;switch(e.type){case "sparkScanDidScan":{await this.onDidScan(e);break}case "sparkScanDidUpdateSession":{this.onDidUpdateSession(e);break}case "sparkScanSwitchedToSmartScanSelection":{(a=this.delegate)==null||a.onSwitchedToSmartScanSelection();break}case "sparkScanSwitchedAwayFromSmartScanSelection":{(t=this.delegate)==null||t.onSwitchedAwayFromSmartScanSelection();break}}}async notifyContext(){this.context&&(this.settings=a$2(this.settings,DataCaptureContext.capabilityInfo),await this.context.update());}};export{c as a};
@@ -1 +1 @@
1
- import {a as a$3}from'./chunk-QJK4IOYM.js';import {a as a$4}from'./chunk-6KWMOMD7.js';import {b}from'./chunk-FOVTROJK.js';import {a as a$6}from'./chunk-ZQ3QKTQ5.js';import {h}from'./chunk-4PYZSS3H.js';import {a as a$5,c as c$1,e,f as f$1,g,h as h$1,i as i$1,j as j$1,k as k$1,b as b$1,d as d$2}from'./chunk-DVHTYKDX.js';import {d,c,f,i,j,k,l,m,n,b as b$2,e as e$1,g as g$1}from'./chunk-4JEIREAU.js';import {d as d$1}from'./chunk-YBD5JYCX.js';import {a as a$2}from'./chunk-KCNBWJYB.js';import {a as a$1}from'./chunk-AYZEMPSP.js';import {a}from'./chunk-PMTVYYAY.js';import {Logger,Point,CameraPosition,Color}from'@scandit/web-datacapture-core';import {OrientationObserver,orientationChangeEvent}from'@scandit/web-datacapture-core/build/js/private/OrientationObserver.js';import {ScanditHTMLElement,Timeout,defineCustomElements,css,clamp}from'@scandit/web-datacapture-core/build/js/private/utils/index.js';var U=class o extends ScanditHTMLElement{constructor(){super(...arguments);this._targetModeButtonVisible=false;this._scanningBehaviorButtonVisible=false;this._torchControlVisible=true;this._zoomSwitchControlVisible=true;this._previewSizeControlVisible=true;this._barcodeFindButtonVisible=false;this._labelCaptureButtonVisible=false;this._cameraSwitchButtonVisible=false;this._previewCloseControlVisible=true;this._triggerButtonVisible=true;this._isTorchAvailable=true;this._isZoomAvailable=true;this._isConnected=false;this.feedbackDelegate={getFeedbackForBarcode:()=>a.success()};this.resizeObserver=null;this.onResizeHandler=this.onResize.bind(this);this.settings=new a$1;this.presenter=a$2.forView(this,this.settings);this.miniPreview=b.create();this.triggerButton=a$3.create();this.visualFeedback=a$4.create();this.miniPreviewTimeout=new Timeout(500,this.onMiniPreviewTimeoutFinished.bind(this));this.orientationObserver=new OrientationObserver;this.miniPreviewPointerUpListener=this.onMiniPreviewPointerUp.bind(this);this.miniPreviewPointerMoveListener=this.onMiniPreviewPointerMove.bind(this);this.miniPreviewButtonTapListener=this.onMiniPreviewButtonTap.bind(this);this.miniPreviewDragListener=this.onMiniPreviewDrag.bind(this);this.miniPreviewDragEndListener=this.onMiniPreviewDragEnd.bind(this);this.miniPreviewVisibilityChangeListener=this.onMiniPreviewVisibilityChange.bind(this);this.triggerButtonPointerDownListener=this.onTriggerButtonPointerDown.bind(this);this.triggerButtonTapListener=this.onTriggerButtonTap.bind(this);this.triggerButtonLongPressStartListener=this.onTriggerButtonLongPressStart.bind(this);this.triggerButtonLongPressEndListener=this.onTriggerButtonLongPressEnd.bind(this);this.triggerButtonDragListener=this.onTriggerButtonDrag.bind(this);this.toolbarButtonTapListener=this.onToolbarButtonTap.bind(this);this.clickOutsideListener=this.onClickOutside.bind(this);this.visibilityChangeListener=this.onVisibilityChange.bind(this);this.orientationChangeListener=this.onOrientationChange.bind(this);this.holdingToScan=false;this.miniPreviewListeners=[["pointerup",this.miniPreviewPointerUpListener],["pointermove",this.miniPreviewPointerMoveListener],["minipreviewbuttontap",this.miniPreviewButtonTapListener],["toolbarbuttontap",this.toolbarButtonTapListener],["drag",this.miniPreviewDragListener],["dragend",this.miniPreviewDragEndListener],[h,this.miniPreviewVisibilityChangeListener]];this.triggerButtonListeners=[["pointerdown",this.triggerButtonPointerDownListener],["tap",this.triggerButtonTapListener],["longpressstart",this.triggerButtonLongPressStartListener],["longpressend",this.triggerButtonLongPressEndListener],["drag",this.triggerButtonDragListener]];}get targetModeButtonVisible(){return this._targetModeButtonVisible}set targetModeButtonVisible(e){var i;this._targetModeButtonVisible=e,(i=this.miniPreview)!=null&&i.toolbar&&(this.miniPreview.toolbar[d]=e);}get scanningBehaviorButtonVisible(){return this._scanningBehaviorButtonVisible}set scanningBehaviorButtonVisible(e){var i;this._scanningBehaviorButtonVisible=e,(i=this.miniPreview)!=null&&i.toolbar&&(this.miniPreview.toolbar[c]=e);}get torchControlVisible(){return this._torchControlVisible}set torchControlVisible(e){this._torchControlVisible=e,this.miniPreview&&(this.miniPreview[f]=e&&this._isTorchAvailable);}get zoomSwitchControlVisible(){return this._zoomSwitchControlVisible}set zoomSwitchControlVisible(e){this._zoomSwitchControlVisible=e,this.miniPreview&&(this.miniPreview[i]=e&&this._isZoomAvailable);}get previewSizeControlVisible(){return this._previewSizeControlVisible}set previewSizeControlVisible(e){this._previewSizeControlVisible=e,this.miniPreview&&(this.miniPreview[j]=e);}get barcodeFindButtonVisible(){return this._barcodeFindButtonVisible}set barcodeFindButtonVisible(e){var i;this._barcodeFindButtonVisible=e,(i=this.miniPreview)!=null&&i.toolbar&&(this.miniPreview.toolbar[k]=e);}get labelCaptureButtonVisible(){return this._labelCaptureButtonVisible}set labelCaptureButtonVisible(e){var i;this._labelCaptureButtonVisible=e,(i=this.miniPreview)!=null&&i.toolbar&&(this.miniPreview.toolbar[l]=e);}get cameraSwitchButtonVisible(){return this._cameraSwitchButtonVisible}set cameraSwitchButtonVisible(e){var i;this._cameraSwitchButtonVisible=e,(i=this.miniPreview)!=null&&i.toolbar&&(this.miniPreview.toolbar[m]=e);}get previewCloseControlVisible(){return this._previewCloseControlVisible}set previewCloseControlVisible(e){this._previewCloseControlVisible=e,this.miniPreview&&(this.miniPreview[n]=e);}get triggerButtonVisible(){return this._triggerButtonVisible}set triggerButtonVisible(e){this._triggerButtonVisible=e,this.triggerButton&&(this.triggerButton.visible=e);}get dataCaptureContext(){return this.presenter.context}set dataCaptureContext(e){this.presenter.context!==e&&(this.presenter.context=e,this._maybeAutoPrepareScanning());}get sparkScan(){return this.presenter.sparkScan}set sparkScan(e){this.presenter.sparkScan!==e&&(this.presenter.sparkScan=e,this._maybeAutoPrepareScanning());}get _targetModeEnabledMessage(){var e;return (e=this.settings.toastSettings.targetModeEnabledMessage)!=null?e:"Aimer on"}get _targetModeDisabledMessage(){var e;return (e=this.settings.toastSettings.targetModeDisabledMessage)!=null?e:"Aimer off"}get _continuousModeEnabledMessage(){var e;return (e=this.settings.toastSettings.continuousModeEnabledMessage)!=null?e:"Continuous mode on"}get _continuousModeDisabledMessage(){var e;return (e=this.settings.toastSettings.continuousModeDisabledMessage)!=null?e:"Continuous mode off"}get _scanPausedMessage(){var e;return (e=this.settings.toastSettings.scanPausedMessage)!=null?e:"Scan paused"}get _torchEnabledMessage(){var e;return (e=this.settings.toastSettings.torchEnabledMessage)!=null?e:"Torch on"}get _torchDisabledMessage(){var e;return (e=this.settings.toastSettings.torchDisabledMessage)!=null?e:"Torch off"}get _zoomedInMessage(){var e;return (e=this.settings.toastSettings.zoomedInMessage)!=null?e:"2x zoom"}get _zoomedOutMessage(){var e;return (e=this.settings.toastSettings.zoomedOutMessage)!=null?e:"1x zoom"}set sparkScanViewSettings(e){let i=e!=null?e:new a$1;this.settings=i,this.presenter.setSparkScanViewSettings(i);}get sparkScanViewSettings(){return this.settings}static forElement(e,i,t,r){let n=o.create();return r&&(n.sparkScanViewSettings=r),n.dataCaptureContext=i,n.sparkScan=t,e.append(n),n}static register(){defineCustomElements({[d$1]:o});}static create(){return o.register(),document.createElement("spark-scan-view")}static createStyleElement(){return css`:root{${a$5}:#12161966;${c$1}:#12161966;${e}:#5b707f4d;${f$1}:#fff;${g}:#121619cc;${h$1}:#fbc02c;${i$1}:#fff;${j$1}:#0ff;${k$1}:#fa4446}${d$1}{position:relative}`}async prepareScanning(){await this.presenter.prepareScanning(this.miniPreview.host);}async startScanning(){await this.presenter.startScanning();}async pauseScanning(){await this.presenter.pauseScanning();}async stopScanning(){await this.presenter.stopScanning({sessionStopReason:"user"});}showToast(e){this.miniPreview.showToast("info",e,1e3);}setListener(e){this.presenter.setListener(e);}setTriggerButtonImage(e){this.triggerButton.setImage(e);}get miniPreviewSize(){return this.miniPreview.size}set miniPreviewSize(e){this.miniPreview.size=e;}setWidthAndHeightCssStyleProperties(){var t,r;let e=((t=this.parentElement)==null?void 0:t.clientWidth)||document.body.clientWidth,i=((r=this.parentElement)==null?void 0:r.clientHeight)||document.body.clientHeight;this.style.setProperty("--dvw",`${e}px`),this.style.setProperty("--dvh",`${i}px`),this.style.setProperty("--dvw-half","calc(var(--dvw) / 2)"),this.style.setProperty("--dvh-half","calc(var(--dvh) / 2)");}onResize(){this.setWidthAndHeightCssStyleProperties(),this.repositionElementsIfOutOfBounds();}_maybeAutoPrepareScanning(){this._isConnected&&this.presenter.context&&this.presenter.sparkScan&&this.prepareScanning().catch(e=>{Logger.warn("Auto prepareScanning failed:",e);});}connectedCallback(){this.append(o.createStyleElement().cloneNode(true),this.miniPreview,this.triggerButton,this.visualFeedback),this.resizeObserver=new ResizeObserver(this.onResizeHandler),this.resizeObserver.observe(this.parentElement),this.previewCloseControlVisible=this._previewCloseControlVisible,this.previewSizeControlVisible=this._previewSizeControlVisible,this.zoomSwitchControlVisible=this._zoomSwitchControlVisible,this.torchControlVisible=this._torchControlVisible,this.miniPreview.size=this.settings.defaultMiniPreviewSize,this.targetModeButtonVisible=this._targetModeButtonVisible,this.scanningBehaviorButtonVisible=this._scanningBehaviorButtonVisible,this.barcodeFindButtonVisible=this._barcodeFindButtonVisible,this.labelCaptureButtonVisible=this._labelCaptureButtonVisible,this.cameraSwitchButtonVisible=this._cameraSwitchButtonVisible,this.triggerButtonVisible=this._triggerButtonVisible;for(let[e$1,i]of [[this.triggerButtonCollapsedColor,a$5],[this.triggerButtonExpandedColor,c$1],[this.triggerButtonAnimationColor,e],[this.triggerButtonTintColor,f$1],[this.toolbarBackgroundColor,g],[this.toolbarIconActiveTintColor,h$1],[this.toolbarIconInactiveTintColor,i$1]])e$1&&this.style.setProperty(i,`#${e$1.toJSON()}`);this.setTriggerButtonPressedColor("triggerButtonCollapsedColor",a$5,b$1),this.setTriggerButtonPressedColor("triggerButtonExpandedColor",c$1,d$2),this.addMiniPreviewListeners(),this.addTriggerButtonListeners(),this.orientationObserver.register(),document.addEventListener("pointerup",this.clickOutsideListener),document.addEventListener("visibilitychange",this.visibilityChangeListener),this.orientationObserver.addEventListener(orientationChangeEvent,this.orientationChangeListener),this.orientationObserver.dispatchOrientationChangeEvent(this.orientationObserver.orientation),this.setWidthAndHeightCssStyleProperties(),this._isConnected=true,this._maybeAutoPrepareScanning();}disconnectedCallback(){var e;this.presenter.stopTimeouts(),this.miniPreviewTimeout.stop(),(e=this.resizeObserver)==null||e.disconnect(),this.orientationObserver.unregister(),this.orientationObserver.removeEventListener(orientationChangeEvent,this.orientationChangeListener),this.removeMiniPreviewListeners(),this.removeTriggerButtonListeners(),document.removeEventListener("pointerup",this.clickOutsideListener),document.removeEventListener("visibilitychange",this.visibilityChangeListener);for(let i of Array.from(this.children))i.remove();this._isConnected=false,Promise.resolve().then(()=>this.presenter.stopScanning({sessionStopReason:"user"}).catch(i=>{Logger.warn("stopping scanning failed in disconnectedCallback:",i);}));}setTorchAvailable(e){this._isTorchAvailable=e,this.torchControlVisible=this._torchControlVisible;}setZoomAvailable(e){this._isZoomAvailable=e,this.zoomSwitchControlVisible=this._zoomSwitchControlVisible;}switchToIdleState(){this.miniPreview.darkened=false,this.miniPreview.visible=false,this.miniPreview.hideToast(),this.triggerButton.expanded=false,this.triggerButton.stopPulsating();}async switchToActiveState(e,i,t,r){this.miniPreviewTimeout.stop(),this.miniPreview.hideToast(),this.miniPreview.cancelFadeOut(),this.miniPreview.darkened=false,this.miniPreview.visible=true,this.triggerButton.expanded=true,this.triggerButton.startPulsating(),this.miniPreview.toolbar&&(this.miniPreview.toolbar[b$2]=i),e&&(t&&this.style.setProperty(j$1,`#${t.toJSON()}`),await this.visualFeedback.emitSuccessFeedback()),r===true&&this.miniPreview.showToast("warning",this._zoomedInMessage,1e3);}async switchToInactiveState(e,i,t,r){this.miniPreview.darkened=t==="persistent"||e,this.miniPreview.visible=t==="persistent"||e,this.triggerButton.expanded=true,this.triggerButton.stopPulsating(),this.miniPreview.toolbar&&(this.miniPreview.toolbar[b$2]=i),e&&(r&&this.style.setProperty(j$1,`#${r.toJSON()}`),await this.visualFeedback.emitSuccessFeedback(),t==="default"&&this.miniPreviewTimeout.start()),t==="persistent"&&this.miniPreview.showToast("warning",this._scanPausedMessage,Number.POSITIVE_INFINITY);}async switchToErrorState(e,i){e.resumeCapturingDelay>0&&(this.triggerButton.stopPulsating(),this.miniPreview.showToast("error",e.message,e.resumeCapturingDelay)),i&&(this.style.setProperty(k$1,`#${e.visualFeedbackColor.toJSON()}`),await this.visualFeedback.emitErrorFeedback());}async onMiniPreviewPointerUp(){await this.presenter.onMiniPreviewPointerUp();}onMiniPreviewPointerMove(){this.presenter.onMiniPreviewPointerMove();}async onMiniPreviewButtonTap(e){switch(e.detail.tapped){case "torchButton":{await this.presenter.onTorchButtonTap(e.detail.enabled);break}case "closeButton":{await this.presenter.onMiniPreviewCloseButtonTap();break}case "resizeButton":{this.presenter.onMiniPreviewResizeButtonTap();break}case "zoomButton":{await this.presenter.onMiniPreviewZoomButtonTap(e.detail.zoomFactor);break}}this.miniPreviewTimeout.running&&this.miniPreviewTimeout.start();}async onMiniPreviewDrag(e){e instanceof a$6&&await this.presenter.onMiniPreviewDrag(e.point,this.orientationObserver.orientation.type);}async onMiniPreviewDragEnd(e){e instanceof a$6&&await this.presenter.onMiniPreviewDragEnd();}async onMiniPreviewVisibilityChange(e){await this.presenter.onMiniPreviewVisibilityChange(e.detail.visible);}async onTriggerButtonPointerDown(){await this.presenter.onTriggerButtonPointerDown();}async onTriggerButtonTap(){await this.presenter.onTriggerButtonTap();}async onTriggerButtonLongPressStart(){this.holdingToScan||(this.holdingToScan=true,await this.presenter.onTriggerButtonLongPressStart());}async onTriggerButtonLongPressEnd(){this.holdingToScan&&(this.holdingToScan=false,await this.presenter.onTriggerButtonLongPressEnd());}onTriggerButtonDrag(e){e instanceof a$6&&this.presenter.onTriggerButtonDrag(e.point,this.orientationObserver.orientation.type);}async onToolbarButtonTap(e){switch(this.miniPreview.rewindAnimation(),e.detail.tapped){case "targetModeButton":{await this.onTargetModeButtonTap(e);return}case "scanningBehaviorButton":{await this.onScanningBehaviorButtonTap(e);return}case "barcodeFindButton":{await this.onBarcodeFindButtonTap();return}case "labelCaptureButton":{await this.onLabelCaptureButtonTap();return}case "cameraSwitchButton":await this.onCameraSwitchButtonTap();}}async onClickOutside(e){e.composedPath().includes(this)||await this.presenter.onClickOutside();}async onVisibilityChange(){document.visibilityState==="hidden"&&await this.presenter.onVisibilityChange();}async onTargetModeButtonTap(e){await this.presenter.onTargetModeButtonTap(e.detail.enabled);}async onScanningBehaviorButtonTap(e){await this.presenter.onScanningBehaviorButtonTap(e.detail.enabled);}async onBarcodeFindButtonTap(){await this.presenter.onBarcodeFindButtonTap();}async onLabelCaptureButtonTap(){await this.presenter.onLabelCaptureButtonTap();}async onCameraSwitchButtonTap(){this.torchControlVisible=false,await this.presenter.onCameraSwitchButtonTap();}async onTorchButtonTap(e){await this.presenter.onTorchButtonTap(e.detail.enabled);}async onMiniPreviewTimeoutFinished(){await this.miniPreview.fadeOut();}async onOrientationChange(e){this.setWidthAndHeightCssStyleProperties(),this.miniPreview.orientation=e.detail.type;let i,t,r,n;switch(e.detail.type){case "landscape-primary":case "landscape-secondary":{i=this.presenter.landscapeOrientationTriggerButtonTranslateX,t=this.presenter.landscapeOrientationTriggerButtonTranslateY,r=this.presenter.landscapeOrientationMiniPreviewTranslateX,n=this.presenter.landscapeOrientationMiniPreviewTranslateY;break}case "portrait-primary":case "portrait-secondary":{i=this.presenter.portraitOrientationTriggerButtonTranslateX,t=this.presenter.portraitOrientationTriggerButtonTranslateY,r=this.presenter.portraitOrientationMiniPreviewTranslateX,n=this.presenter.portraitOrientationMiniPreviewTranslateY;break}}this.triggerButton.translateTo(new Point(i,t)),this.miniPreview.translateTo(new Point(r,n)),await this.presenter.onOrientationChange();}targetModeButtonTapped(e,i=true){if(i){let t=e?"warning":"info",r=e?this._targetModeEnabledMessage:this._targetModeDisabledMessage;this.miniPreview.showToast(t,r,1e3);}this.miniPreview.toolbar&&(this.miniPreview.toolbar[e$1]=e),this.miniPreviewTimeout.running&&this.miniPreviewTimeout.start();}scanningBehaviorButtonTapped(e,i=true){if(i){let t=e?"warning":"info",r=e?this._continuousModeEnabledMessage:this._continuousModeDisabledMessage;this.miniPreview.showToast(t,r,1e3);}this.miniPreview.toolbar&&(this.miniPreview.toolbar[b$2]=e?"continuous":"single"),this.miniPreviewTimeout.running&&this.miniPreviewTimeout.start();}torchButtonTapped(e,i=true){if(i){let t=e?"warning":"info",r=e?this._torchEnabledMessage:this._torchDisabledMessage;this.miniPreview.showToast(t,r,1e3);}this.miniPreview.toolbar&&(this.miniPreview[g$1]=e),this.miniPreviewTimeout.running&&this.miniPreviewTimeout.start();}cameraSwitchButtonTapped(e,i){var t;this.torchControlVisible=e,(t=this.miniPreview.toolbar)==null||t.enableCameraSwitchButton(i===CameraPosition.UserFacing);}getDefaultCssVariableValue(e){return window.getComputedStyle(this).getPropertyValue(e)}setTriggerButtonPressedColor(e,i,t){var P;let r=(P=this[e])!=null?P:Color.fromHex(this.getDefaultCssVariableValue(i)),n=clamp(r.alpha+r.alpha*.25,r.alpha,255),N=r.withAlpha(n);this.style.setProperty(t,`#${N.toJSON()}`);}addMiniPreviewListeners(){for(let[e,i]of this.miniPreviewListeners)this.miniPreview.addEventListener(e,i);}removeMiniPreviewListeners(){for(let[e,i]of this.miniPreviewListeners)this.miniPreview.removeEventListener(e,i);}addTriggerButtonListeners(){for(let[e,i]of this.triggerButtonListeners)this.triggerButton.addEventListener(e,i);}removeTriggerButtonListeners(){for(let[e,i]of this.triggerButtonListeners)this.triggerButton.removeEventListener(e,i);}repositionElementsIfOutOfBounds(){this.triggerButton.repositionIfOutOfBounds(),this.miniPreview.repositionIfOutOfBounds();}repositionMiniPreviewIfOutOfBounds(){this.miniPreview.repositionIfOutOfBounds();}repositionTriggerButtonIfOutOfBounds(){this.triggerButton.repositionIfOutOfBounds();}};export{U as a};
1
+ import {a as a$3}from'./chunk-K5PP2E7G.js';import {a as a$4}from'./chunk-6KWMOMD7.js';import {b}from'./chunk-C5S6DRA7.js';import {a as a$6}from'./chunk-ZQ3QKTQ5.js';import {h}from'./chunk-4PYZSS3H.js';import {a as a$5,c as c$1,e,f as f$1,g,h as h$1,i as i$1,j as j$1,k as k$1,b as b$1,d as d$2}from'./chunk-DVHTYKDX.js';import {d,c,f,i,j,k,l,m,n,b as b$2,e as e$1,g as g$1}from'./chunk-4JEIREAU.js';import {d as d$1}from'./chunk-YBD5JYCX.js';import {a as a$2}from'./chunk-NA3MFO4C.js';import {a as a$1}from'./chunk-AYZEMPSP.js';import {a}from'./chunk-PMTVYYAY.js';import {Logger,Point,CameraPosition,Color}from'@scandit/web-datacapture-core';import {OrientationObserver,orientationChangeEvent}from'@scandit/web-datacapture-core/build/js/private/OrientationObserver.js';import {ScanditHTMLElement,Timeout,defineCustomElements,css,clamp}from'@scandit/web-datacapture-core/build/js/private/utils/index.js';var N=class o extends ScanditHTMLElement{constructor(){super(...arguments);this._targetModeButtonVisible=false;this._scanningBehaviorButtonVisible=false;this._torchControlVisible=true;this._zoomSwitchControlVisible=true;this._previewSizeControlVisible=true;this._barcodeFindButtonVisible=false;this._labelCaptureButtonVisible=false;this._cameraSwitchButtonVisible=false;this._previewCloseControlVisible=true;this._triggerButtonVisible=true;this._isTorchAvailable=true;this._isZoomAvailable=true;this._isConnected=false;this.feedbackDelegate={getFeedbackForBarcode:()=>a.success()};this.resizeObserver=null;this.onResizeHandler=this.onResize.bind(this);this.settings=new a$1;this.presenter=a$2.forView(this,this.settings);this.miniPreview=b.create();this.triggerButton=a$3.create();this.visualFeedback=a$4.create();this.miniPreviewTimeout=new Timeout(500,this.onMiniPreviewTimeoutFinished.bind(this));this.orientationObserver=new OrientationObserver;this.miniPreviewPointerUpListener=this.onMiniPreviewPointerUp.bind(this);this.miniPreviewPointerMoveListener=this.onMiniPreviewPointerMove.bind(this);this.miniPreviewButtonTapListener=this.onMiniPreviewButtonTap.bind(this);this.miniPreviewDragListener=this.onMiniPreviewDrag.bind(this);this.miniPreviewDragEndListener=this.onMiniPreviewDragEnd.bind(this);this.miniPreviewVisibilityChangeListener=this.onMiniPreviewVisibilityChange.bind(this);this.triggerButtonPointerDownListener=this.onTriggerButtonPointerDown.bind(this);this.triggerButtonTapListener=this.onTriggerButtonTap.bind(this);this.triggerButtonLongPressStartListener=this.onTriggerButtonLongPressStart.bind(this);this.triggerButtonLongPressEndListener=this.onTriggerButtonLongPressEnd.bind(this);this.triggerButtonDragListener=this.onTriggerButtonDrag.bind(this);this.toolbarButtonTapListener=this.onToolbarButtonTap.bind(this);this.clickOutsideListener=this.onClickOutside.bind(this);this.visibilityChangeListener=this.onVisibilityChange.bind(this);this.orientationChangeListener=this.onOrientationChange.bind(this);this.holdingToScan=false;this.miniPreviewListeners=[["pointerup",this.miniPreviewPointerUpListener],["pointermove",this.miniPreviewPointerMoveListener],["minipreviewbuttontap",this.miniPreviewButtonTapListener],["toolbarbuttontap",this.toolbarButtonTapListener],["drag",this.miniPreviewDragListener],["dragend",this.miniPreviewDragEndListener],[h,this.miniPreviewVisibilityChangeListener]];this.triggerButtonListeners=[["pointerdown",this.triggerButtonPointerDownListener],["tap",this.triggerButtonTapListener],["longpressstart",this.triggerButtonLongPressStartListener],["longpressend",this.triggerButtonLongPressEndListener],["drag",this.triggerButtonDragListener]];}get targetModeButtonVisible(){return this._targetModeButtonVisible}set targetModeButtonVisible(e){var i;this._targetModeButtonVisible=e,(i=this.miniPreview)!=null&&i.toolbar&&(this.miniPreview.toolbar[d]=e);}get scanningBehaviorButtonVisible(){return this._scanningBehaviorButtonVisible}set scanningBehaviorButtonVisible(e){var i;this._scanningBehaviorButtonVisible=e,(i=this.miniPreview)!=null&&i.toolbar&&(this.miniPreview.toolbar[c]=e);}get torchControlVisible(){return this._torchControlVisible}set torchControlVisible(e){this._torchControlVisible=e,this.miniPreview&&(this.miniPreview[f]=e&&this._isTorchAvailable);}get zoomSwitchControlVisible(){return this._zoomSwitchControlVisible}set zoomSwitchControlVisible(e){this._zoomSwitchControlVisible=e,this.miniPreview&&(this.miniPreview[i]=e&&this._isZoomAvailable);}get previewSizeControlVisible(){return this._previewSizeControlVisible}set previewSizeControlVisible(e){this._previewSizeControlVisible=e,this.miniPreview&&(this.miniPreview[j]=e);}get barcodeFindButtonVisible(){return this._barcodeFindButtonVisible}set barcodeFindButtonVisible(e){var i;this._barcodeFindButtonVisible=e,(i=this.miniPreview)!=null&&i.toolbar&&(this.miniPreview.toolbar[k]=e);}get labelCaptureButtonVisible(){return this._labelCaptureButtonVisible}set labelCaptureButtonVisible(e){var i;this._labelCaptureButtonVisible=e,(i=this.miniPreview)!=null&&i.toolbar&&(this.miniPreview.toolbar[l]=e);}get cameraSwitchButtonVisible(){return this._cameraSwitchButtonVisible}set cameraSwitchButtonVisible(e){var i;this._cameraSwitchButtonVisible=e,(i=this.miniPreview)!=null&&i.toolbar&&(this.miniPreview.toolbar[m]=e);}get previewCloseControlVisible(){return this._previewCloseControlVisible}set previewCloseControlVisible(e){this._previewCloseControlVisible=e,this.miniPreview&&(this.miniPreview[n]=e);}get triggerButtonVisible(){return this._triggerButtonVisible}set triggerButtonVisible(e){this._triggerButtonVisible=e,this.triggerButton&&(this.triggerButton.visible=e);}get dataCaptureContext(){return this.presenter.context}set dataCaptureContext(e){this.presenter.context!==e&&(this.presenter.context=e,this._maybeAutoPrepareScanning());}get sparkScan(){return this.presenter.sparkScan}set sparkScan(e){this.presenter.sparkScan!==e&&(this.presenter.sparkScan=e,this._maybeAutoPrepareScanning());}get _targetModeEnabledMessage(){var e;return (e=this.settings.toastSettings.targetModeEnabledMessage)!=null?e:"Aimer on"}get _targetModeDisabledMessage(){var e;return (e=this.settings.toastSettings.targetModeDisabledMessage)!=null?e:"Aimer off"}get _continuousModeEnabledMessage(){var e;return (e=this.settings.toastSettings.continuousModeEnabledMessage)!=null?e:"Continuous mode on"}get _continuousModeDisabledMessage(){var e;return (e=this.settings.toastSettings.continuousModeDisabledMessage)!=null?e:"Continuous mode off"}get _scanPausedMessage(){var e;return (e=this.settings.toastSettings.scanPausedMessage)!=null?e:"Scan paused"}get _torchEnabledMessage(){var e;return (e=this.settings.toastSettings.torchEnabledMessage)!=null?e:"Torch on"}get _torchDisabledMessage(){var e;return (e=this.settings.toastSettings.torchDisabledMessage)!=null?e:"Torch off"}get _zoomedInMessage(){var e;return (e=this.settings.toastSettings.zoomedInMessage)!=null?e:"2x zoom"}get _zoomedOutMessage(){var e;return (e=this.settings.toastSettings.zoomedOutMessage)!=null?e:"1x zoom"}set sparkScanViewSettings(e){let i=e!=null?e:new a$1;this.settings=i,this.presenter.setSparkScanViewSettings(i);}get sparkScanViewSettings(){return this.settings}static forElement(e,i,t,r){let n=o.create();return r&&(n.sparkScanViewSettings=r),n.dataCaptureContext=i,n.sparkScan=t,e.append(n),n}static register(){defineCustomElements({[d$1]:o});}static create(){return o.register(),document.createElement("spark-scan-view")}static createStyleElement(){return css`:root{${a$5}:#12161966;${c$1}:#12161966;${e}:#5b707f4d;${f$1}:#fff;${g}:#121619cc;${h$1}:#fbc02c;${i$1}:#fff;${j$1}:#0ff;${k$1}:#fa4446}${d$1}{position:relative}`}async prepareScanning(){await this.presenter.prepareScanning(this.miniPreview.host);}async startScanning(){await this.presenter.startScanning();}async pauseScanning(){await this.presenter.pauseScanning();}async stopScanning(){await this.presenter.stopScanning({sessionStopReason:"user"});}showToast(e){this.miniPreview.showToast("info",e,1e3);}setListener(e){this.presenter.setListener(e);}setTriggerButtonImage(e){this.triggerButton.setImage(e);}get miniPreviewSize(){return this.miniPreview.size}set miniPreviewSize(e){this.miniPreview.size=e;}setWidthAndHeightCssStyleProperties(){var t,r;let e=((t=this.parentElement)==null?void 0:t.clientWidth)||document.body.clientWidth,i=((r=this.parentElement)==null?void 0:r.clientHeight)||document.body.clientHeight;this.style.setProperty("--dvw",`${e}px`),this.style.setProperty("--dvh",`${i}px`),this.style.setProperty("--dvw-half","calc(var(--dvw) / 2)"),this.style.setProperty("--dvh-half","calc(var(--dvh) / 2)");}onResize(){this.setWidthAndHeightCssStyleProperties(),this.repositionElementsIfOutOfBounds();}_maybeAutoPrepareScanning(){this._isConnected&&this.presenter.context&&this.presenter.sparkScan&&this.prepareScanning().catch(e=>{Logger.warn("Auto prepareScanning failed:",e);});}connectedCallback(){this.append(o.createStyleElement().cloneNode(true),this.miniPreview,this.triggerButton,this.visualFeedback),this.resizeObserver=new ResizeObserver(this.onResizeHandler),this.resizeObserver.observe(this.parentElement),this.previewCloseControlVisible=this._previewCloseControlVisible,this.previewSizeControlVisible=this._previewSizeControlVisible,this.zoomSwitchControlVisible=this._zoomSwitchControlVisible,this.torchControlVisible=this._torchControlVisible,this.miniPreview.size=this.settings.defaultMiniPreviewSize,this.targetModeButtonVisible=this._targetModeButtonVisible,this.scanningBehaviorButtonVisible=this._scanningBehaviorButtonVisible,this.barcodeFindButtonVisible=this._barcodeFindButtonVisible,this.labelCaptureButtonVisible=this._labelCaptureButtonVisible,this.cameraSwitchButtonVisible=this._cameraSwitchButtonVisible,this.triggerButtonVisible=this._triggerButtonVisible;for(let[e$1,i]of [[this.triggerButtonCollapsedColor,a$5],[this.triggerButtonExpandedColor,c$1],[this.triggerButtonAnimationColor,e],[this.triggerButtonTintColor,f$1],[this.toolbarBackgroundColor,g],[this.toolbarIconActiveTintColor,h$1],[this.toolbarIconInactiveTintColor,i$1]])e$1&&this.style.setProperty(i,`#${e$1.toJSON()}`);this.setTriggerButtonPressedColor("triggerButtonCollapsedColor",a$5,b$1),this.setTriggerButtonPressedColor("triggerButtonExpandedColor",c$1,d$2),this.addMiniPreviewListeners(),this.addTriggerButtonListeners(),this.orientationObserver.register(),document.addEventListener("pointerup",this.clickOutsideListener),document.addEventListener("visibilitychange",this.visibilityChangeListener),this.orientationObserver.addEventListener(orientationChangeEvent,this.orientationChangeListener),this.orientationObserver.dispatchOrientationChangeEvent(this.orientationObserver.orientation),this.setWidthAndHeightCssStyleProperties(),this._isConnected=true,this._maybeAutoPrepareScanning();}disconnectedCallback(){var e;this.miniPreviewTimeout.stop(),(e=this.resizeObserver)==null||e.disconnect(),this.orientationObserver.unregister(),this.orientationObserver.removeEventListener(orientationChangeEvent,this.orientationChangeListener),this.removeMiniPreviewListeners(),this.removeTriggerButtonListeners(),document.removeEventListener("pointerup",this.clickOutsideListener),document.removeEventListener("visibilitychange",this.visibilityChangeListener);for(let i of Array.from(this.children))i.remove();this._isConnected=false;}setTorchAvailable(e){this._isTorchAvailable=e,this.torchControlVisible=this._torchControlVisible;}setZoomAvailable(e){this._isZoomAvailable=e,this.zoomSwitchControlVisible=this._zoomSwitchControlVisible;}switchToIdleState(){this.miniPreview.darkened=false,this.miniPreview.visible=false,this.miniPreview.hideToast(),this.triggerButton.expanded=false,this.triggerButton.stopPulsating();}async switchToActiveState(e,i,t,r){this.miniPreviewTimeout.stop(),this.miniPreview.hideToast(),this.miniPreview.cancelFadeOut(),this.miniPreview.darkened=false,this.miniPreview.visible=true,this.triggerButton.expanded=true,this.triggerButton.startPulsating(),this.miniPreview.toolbar&&(this.miniPreview.toolbar[b$2]=i),e&&(t&&this.style.setProperty(j$1,`#${t.toJSON()}`),await this.visualFeedback.emitSuccessFeedback()),r===true&&this.miniPreview.showToast("warning",this._zoomedInMessage,1e3);}async switchToInactiveState(e,i,t,r){this.miniPreview.darkened=t==="persistent"||e,this.miniPreview.visible=t==="persistent"||e,this.triggerButton.expanded=true,this.triggerButton.stopPulsating(),this.miniPreview.toolbar&&(this.miniPreview.toolbar[b$2]=i),e&&(r&&this.style.setProperty(j$1,`#${r.toJSON()}`),await this.visualFeedback.emitSuccessFeedback(),t==="default"&&this.miniPreviewTimeout.start()),t==="persistent"&&this.miniPreview.showToast("warning",this._scanPausedMessage,Number.POSITIVE_INFINITY);}async switchToErrorState(e,i){e.resumeCapturingDelay>0&&(this.triggerButton.stopPulsating(),this.miniPreview.showToast("error",e.message,e.resumeCapturingDelay)),i&&(this.style.setProperty(k$1,`#${e.visualFeedbackColor.toJSON()}`),await this.visualFeedback.emitErrorFeedback());}async onMiniPreviewPointerUp(){await this.presenter.onMiniPreviewPointerUp();}onMiniPreviewPointerMove(){this.presenter.onMiniPreviewPointerMove();}async onMiniPreviewButtonTap(e){switch(e.detail.tapped){case "torchButton":{await this.presenter.onTorchButtonTap(e.detail.enabled);break}case "closeButton":{await this.presenter.onMiniPreviewCloseButtonTap();break}case "resizeButton":{this.presenter.onMiniPreviewResizeButtonTap();break}case "zoomButton":{await this.presenter.onMiniPreviewZoomButtonTap(e.detail.zoomFactor);break}}this.miniPreviewTimeout.running&&this.miniPreviewTimeout.start();}async onMiniPreviewDrag(e){e instanceof a$6&&await this.presenter.onMiniPreviewDrag(e.point,this.orientationObserver.orientation.type);}async onMiniPreviewDragEnd(e){e instanceof a$6&&await this.presenter.onMiniPreviewDragEnd();}async onMiniPreviewVisibilityChange(e){await this.presenter.onMiniPreviewVisibilityChange(e.detail.visible);}async onTriggerButtonPointerDown(){await this.presenter.onTriggerButtonPointerDown();}async onTriggerButtonTap(){await this.presenter.onTriggerButtonTap();}async onTriggerButtonLongPressStart(){this.holdingToScan||(this.holdingToScan=true,await this.presenter.onTriggerButtonLongPressStart());}async onTriggerButtonLongPressEnd(){this.holdingToScan&&(this.holdingToScan=false,await this.presenter.onTriggerButtonLongPressEnd());}onTriggerButtonDrag(e){e instanceof a$6&&this.presenter.onTriggerButtonDrag(e.point,this.orientationObserver.orientation.type);}async onToolbarButtonTap(e){switch(this.miniPreview.rewindAnimation(),e.detail.tapped){case "targetModeButton":{await this.onTargetModeButtonTap(e);return}case "scanningBehaviorButton":{await this.onScanningBehaviorButtonTap(e);return}case "barcodeFindButton":{await this.onBarcodeFindButtonTap();return}case "labelCaptureButton":{await this.onLabelCaptureButtonTap();return}case "cameraSwitchButton":await this.onCameraSwitchButtonTap();}}async onClickOutside(e){e.composedPath().includes(this)||await this.presenter.onClickOutside();}async onVisibilityChange(){document.visibilityState==="hidden"&&await this.presenter.onVisibilityChange();}async onTargetModeButtonTap(e){await this.presenter.onTargetModeButtonTap(e.detail.enabled);}async onScanningBehaviorButtonTap(e){await this.presenter.onScanningBehaviorButtonTap(e.detail.enabled);}async onBarcodeFindButtonTap(){await this.presenter.onBarcodeFindButtonTap();}async onLabelCaptureButtonTap(){await this.presenter.onLabelCaptureButtonTap();}async onCameraSwitchButtonTap(){this.torchControlVisible=false,await this.presenter.onCameraSwitchButtonTap();}async onTorchButtonTap(e){await this.presenter.onTorchButtonTap(e.detail.enabled);}async onMiniPreviewTimeoutFinished(){await this.miniPreview.fadeOut();}async onOrientationChange(e){this.setWidthAndHeightCssStyleProperties(),this.miniPreview.orientation=e.detail.type;let i,t,r,n;switch(e.detail.type){case "landscape-primary":case "landscape-secondary":{i=this.presenter.landscapeOrientationTriggerButtonTranslateX,t=this.presenter.landscapeOrientationTriggerButtonTranslateY,r=this.presenter.landscapeOrientationMiniPreviewTranslateX,n=this.presenter.landscapeOrientationMiniPreviewTranslateY;break}case "portrait-primary":case "portrait-secondary":{i=this.presenter.portraitOrientationTriggerButtonTranslateX,t=this.presenter.portraitOrientationTriggerButtonTranslateY,r=this.presenter.portraitOrientationMiniPreviewTranslateX,n=this.presenter.portraitOrientationMiniPreviewTranslateY;break}}this.triggerButton.translateTo(new Point(i,t)),this.miniPreview.translateTo(new Point(r,n)),await this.presenter.onOrientationChange();}targetModeButtonTapped(e,i=true){if(i){let t=e?"warning":"info",r=e?this._targetModeEnabledMessage:this._targetModeDisabledMessage;this.miniPreview.showToast(t,r,1e3);}this.miniPreview.toolbar&&(this.miniPreview.toolbar[e$1]=e),this.miniPreviewTimeout.running&&this.miniPreviewTimeout.start();}scanningBehaviorButtonTapped(e,i=true){if(i){let t=e?"warning":"info",r=e?this._continuousModeEnabledMessage:this._continuousModeDisabledMessage;this.miniPreview.showToast(t,r,1e3);}this.miniPreview.toolbar&&(this.miniPreview.toolbar[b$2]=e?"continuous":"single"),this.miniPreviewTimeout.running&&this.miniPreviewTimeout.start();}torchButtonTapped(e,i=true){if(i){let t=e?"warning":"info",r=e?this._torchEnabledMessage:this._torchDisabledMessage;this.miniPreview.showToast(t,r,1e3);}this.miniPreview.toolbar&&(this.miniPreview[g$1]=e),this.miniPreviewTimeout.running&&this.miniPreviewTimeout.start();}cameraSwitchButtonTapped(e,i){var t;this.torchControlVisible=e,(t=this.miniPreview.toolbar)==null||t.enableCameraSwitchButton(i===CameraPosition.UserFacing);}getDefaultCssVariableValue(e){return window.getComputedStyle(this).getPropertyValue(e)}setTriggerButtonPressedColor(e,i,t){var P;let r=(P=this[e])!=null?P:Color.fromHex(this.getDefaultCssVariableValue(i)),n=clamp(r.alpha+r.alpha*.25,r.alpha,255),R=r.withAlpha(n);this.style.setProperty(t,`#${R.toJSON()}`);}addMiniPreviewListeners(){for(let[e,i]of this.miniPreviewListeners)this.miniPreview.addEventListener(e,i);}removeMiniPreviewListeners(){for(let[e,i]of this.miniPreviewListeners)this.miniPreview.removeEventListener(e,i);}addTriggerButtonListeners(){for(let[e,i]of this.triggerButtonListeners)this.triggerButton.addEventListener(e,i);}removeTriggerButtonListeners(){for(let[e,i]of this.triggerButtonListeners)this.triggerButton.removeEventListener(e,i);}repositionElementsIfOutOfBounds(){this.triggerButton.repositionIfOutOfBounds(),this.miniPreview.repositionIfOutOfBounds();}repositionMiniPreviewIfOutOfBounds(){this.miniPreview.repositionIfOutOfBounds();}repositionTriggerButtonIfOutOfBounds(){this.triggerButton.repositionIfOutOfBounds();}};export{N as a};
@@ -1 +1 @@
1
- import {a as a$2}from'./chunk-LWUFGA5M.js';import {a as a$1}from'./chunk-6E42EK3T.js';import {a as a$6,b as b$3}from'./chunk-ZQ3QKTQ5.js';import {b}from'./chunk-LGPC7KMW.js';import {a as a$5,b as b$2}from'./chunk-OPL5NVVM.js';import {h,g as g$2}from'./chunk-4PYZSS3H.js';import {g as g$1}from'./chunk-DVHTYKDX.js';import {a as a$3}from'./chunk-5Q3AHWJL.js';import {j,i,f,a,g,n}from'./chunk-4JEIREAU.js';import {c,e,a as a$4,b as b$1}from'./chunk-YBD5JYCX.js';import {Point}from'@scandit/web-datacapture-core';import {ScanditHTMLElement,defineCustomElements,safeAwaitAnimation,safeCancelAnimation,html,Timeout}from'@scandit/web-datacapture-core/build/js/private/utils/index.js';var q=(i=>(i.ResizeButton="resizeButton",i.ZoomButton="zoomButton",i.TorchButton="torchButton",i.CloseButton="closeButton",i))(q||{}),D=1200,w=class w extends ScanditHTMLElement{constructor(){super(...arguments);this.resizeButtonTapListener=this.onResizeButtonTap.bind(this);this.zoomButtonTapListener=this.onZoomButtonTap.bind(this);this.torchButtonTapListener=this.onTorchButtonTap.bind(this);this.closeButtonTapListener=this.onCloseButtonTap.bind(this);this.pointerDownListener=this.onPointerDown.bind(this);this.longPressStartListener=this.onLongPressStart.bind(this);this.toolbarVisibilityChangeListener=this.onToolbarVisibilityChange.bind(this);this.longPressEndListener=this.onLongPressEnd.bind(this);this.dragEndListener=this.onDragEnd.bind(this);this.fadeOutAnimation=new Animation(new KeyframeEffect(this,[{opacity:1},{opacity:0}],{duration:500,fill:"both"}));this.replayFadeOutTimeout=null;this.longPressController=new b(this);}get visible(){return this.hasAttribute("visible")}set visible(t){this.toggleAttribute("visible",t),this.dispatchEvent(new CustomEvent(h,{detail:{visible:t}}));}get size(){return this.expanded?"expanded":"regular"}set size(t){var i;this.toggleAttribute("expanded",t==="expanded");let o=this.getNextTranslate();(i=this.dragController)==null||i.translateTo(o,false).then(()=>{var n;return (n=this.dragController)==null?void 0:n.repositionIfOutOfBounds()});}get expanded(){return this.hasAttribute("expanded")}get[a](){var t;return Number((t=this.getAttribute(a))!=null?t:"1")}set[a](t){this.setAttribute(a,String(t));}get darkened(){return this.hasAttribute("darkened")}set darkened(t){this.toggleAttribute("darkened",t);}get orientation(){var t;return (t=this.getAttribute("orientation"))!=null?t:"portrait-primary"}set orientation(t){this.setAttribute("orientation",t);}get[g](){return this.hasAttribute(g)}set[g](t){this.toggleAttribute(g,t);}get[j](){return this.hasAttribute(j)}set[j](t){this.toggleAttribute(j,t);}get[i](){return this.hasAttribute(i)}set[i](t){this.toggleAttribute(i,t);}get[f](){return this.hasAttribute(f)}set[f](t){this.toggleAttribute(f,t);}get[n](){return this.hasAttribute(n)}set[n](t){this.toggleAttribute(n,t);}get cover(){return this.hasAttribute("cover")}set cover(t){this.toggleAttribute("cover",t);}get pressed(){return this.hasAttribute("pressed")}set pressed(t){this.toggleAttribute("pressed",t);}static create(){return defineCustomElements({[b$1]:w,[a$4]:a$3,[e]:a$2,[c]:a$1}),document.createElement(b$1)}repositionIfOutOfBounds(){var t;(t=this.dragController)==null||t.repositionIfOutOfBounds();}showToast(t,o,i){this.toast.show(t,o,i);}hideToast(){this.toast.hide();}zoomIn(){this.zoomButton&&(this[a]=2,this.zoomButton.textContent="2x",this.showToast("warning","2x zoom",1e3));}zoomOut(){this.zoomButton&&(this[a]=1,this.zoomButton.textContent="1x",this.showToast("info","1x zoom",1e3));}async fadeOut(){this.fadeOutAnimation.play(),await safeAwaitAnimation(this.fadeOutAnimation),this.visible=false;}cancelFadeOut(){var t;(t=this.replayFadeOutTimeout)==null||t.stop(),safeCancelAnimation(this.fadeOutAnimation);}async rewindAnimation(){var t,o;(((t=this.replayFadeOutTimeout)==null?void 0:t.running)===true||this.fadeOutAnimation.playState!=="idle")&&(this.cancelFadeOut(),(o=this.replayFadeOutTimeout)==null||o.start());}translateTo(t){var o;(o=this.dragController)==null||o.translateTo(t,false);}render(){var t,o,i$1,n$1,a$1,l,b;this.innerHTML=html`<spark-scan-view-toast></spark-scan-view-toast><div id="host"></div><div id="controls"><div id="button-container-list"><div class="button-container"><button id="torchButton" class="${b$1}__button"><spark-scan-view-icon icon="torchOff" fill="white" size="9"></spark-scan-view-icon></button><button id="closeButton" class="${b$1}__button"><spark-scan-view-icon icon="close" fill="white" size="9"></spark-scan-view-icon></button></div><div class="button-container"><button id="resizeButton" class="${b$1}__button"><spark-scan-view-icon icon="expand" fill="white" size="14"></spark-scan-view-icon></button><button id="zoomButton" class="${b$1}__button">${this[a]}x</button></div></div></div><spark-scan-view-toolbar></spark-scan-view-toolbar><div id="overlay"></div><style>${b$1}{position:absolute;top:0;left:0;display:none;background:var(${g$1});border-radius:16px;filter:drop-shadow(0px 2px 6px #${a$5.toJSON()}) drop-shadow(0px 1px 2px #${b$2.toJSON()});transition:filter .3s ease;z-index:100}${b$1},${b$1} #overlay{width:var(--dvw-half);height:var(--dvw-half);min-width:192px;min-height:192px;max-width:min(250px,var(--dvw-half));max-height:min(250px,var(--dvw-half))}@media (orientation:landscape){${b$1},${b$1} #overlay{width:var(--dvh-half);height:var(--dvh-half);max-width:min(250px,var(--dvh-half));max-height:min(250px,var(--dvh-half))}}@media screen (min-width:768px) and (orientation:portrait){${b$1},${b$1} #overlay{max-width:min(375px,var(--dvw-half));max-height:min(375px,var(--dvw-half))}}@media screen (min-width:768px) and (orientation:landscape){${b$1},${b$1} #overlay{max-width:min(375px,var(--dvh-half));max-height:min(375px,var(--dvh-half))}}${b$1}[visible]{display:flex;flex-flow:column}${b$1}[expanded],${b$1}[expanded] #overlay{width:calc(var(--dvw) - ${32}px);height:calc(var(--dvh-half) - ${32}px);max-width:min(400px,calc(var(--dvw) - ${32}px));max-height:min(400px,calc(var(--dvh-half) - ${32}px))}${b$1}[pressed]{filter:drop-shadow(0px 4px 4px #${b$2.toJSON()}) drop-shadow(0px 8px 12px #${a$5.toJSON()})}@media (orientation:landscape){${b$1}[expanded],${b$1}[expanded] #overlay{width:calc(var(--dvh-half) - ${32}px);height:calc(var(--dvh) - ${32}px);max-width:min(400px,calc(var(--dvh-half) - ${32}px));max-height:min(400px,calc(var(--dvh) - ${32}px))}}spark-scan-view-toast{position:absolute;top:16px;left:50%;transform:translateX(-50%);z-index:20}${b$1} #host,${b$1} #host *{width:100%;border-radius:16px}${b$1} #host{height:calc(100% - 48px);z-index:-10}${b$1}[cover] #host{height:100%}${b$1} #controls{position:absolute;top:0;width:100%;height:100%;display:grid;grid-template-rows:auto max-content;box-sizing:border-box}${b$1} #button-container-list{width:100%;height:calc(100% - 48px);display:flex;flex-flow:column;justify-content:space-between}${b$1}[cover] #button-container-list{height:100%}${b$1} .button-container{padding:12px;display:flex;justify-content:flex-end;align-items:center}${b$1}[${f}] .button-container:first-of-type,${b$1}[${j}] .button-container:nth-of-type(2){justify-content:space-between}.${b$1}__button{display:flex;justify-content:center;align-items:center;width:24px;height:24px;border:none;background:rgba(18,22,25,.5);color:#fff;font-family:Arial,Helvetica,sans-serif;font-size:14px;font-weight:500;border-radius:50%}${b$1} #torchButton,${b$1} #closeButton,${b$1} #resizeButton,${b$1} #zoomButton{display:none}${b$1}[${f}] #torchButton,${b$1}[${j}] #resizeButton{display:flex}${b$1}[${n}] #closeButton,${b$1}[${i}] #zoomButton{display:flex;align-self:end}${b$1} #overlay{position:absolute;z-index:10;top:0;left:0;background:#000;border-radius:16px;opacity:0;transition:opacity .3s ease;pointer-events:none}${b$1}[darkened] #overlay{opacity:.3}</style>`,this.toast=this.querySelector("spark-scan-view-toast"),this.host=this.querySelector("#host"),this.resizeButton=this.querySelector("#resizeButton"),(t=this.resizeButton)==null||t.addEventListener("pointerup",this.resizeButtonTapListener),this.resizeButtonIcon=(o=this.resizeButton)==null?void 0:o.querySelector("spark-scan-view-icon"),this.zoomButton=this.querySelector("#zoomButton"),(i$1=this.zoomButton)==null||i$1.addEventListener("pointerup",this.zoomButtonTapListener),this.torchButton=this.querySelector("#torchButton"),(n$1=this.torchButton)==null||n$1.addEventListener("pointerup",this.torchButtonTapListener),this.torchButtonIcon=(a$1=this.torchButton)==null?void 0:a$1.querySelector("spark-scan-view-icon"),this.closeButton=this.querySelector("#closeButton"),(l=this.closeButton)==null||l.addEventListener("pointerup",this.closeButtonTapListener),this.toolbar=this.querySelector(c),(b=this.toolbar)==null||b.addEventListener("toolbarvisibilitychange",this.toolbarVisibilityChangeListener),this.buttonContainerList=this.querySelector("#button-container-list");}onResizeButtonTap(t){t.stopPropagation(),this.size={regular:"expanded",expanded:"regular"}[this.size],this.resizeButtonIcon&&(this.resizeButtonIcon.icon=this.expanded?"shrink":"expand"),this.dispatchEvent(new CustomEvent(g$2,{detail:{tapped:"resizeButton",expanded:this.expanded}}));}onZoomButtonTap(t){switch(t.stopPropagation(),this[a]){case 1:{this.zoomIn();break}case 2:{this.zoomOut();break}}this.dispatchEvent(new CustomEvent(g$2,{detail:{tapped:"zoomButton",zoomFactor:this[a]}}));}onTorchButtonTap(t){t.stopPropagation(),this[g]=!this[g],this.torchButtonIcon&&(this.torchButtonIcon.icon=this[g]?"torchOn":"torchOff"),this.dispatchEvent(new CustomEvent(g$2,{detail:{tapped:"torchButton",enabled:this[g]}}));}onCloseButtonTap(t){t.stopPropagation(),this.dispatchEvent(new CustomEvent(g$2,{detail:{tapped:"closeButton"}}));}onPointerDown(){this.dragController&&(this.dragController.draggable=false),this.rewindAnimation();}onLongPressStart(){this.dragController&&(this.dragController.draggable=true),this.pressed=true;}onLongPressEnd(){this.pressed=false;}onDragEnd(t){t instanceof a$6&&(this.lastKnownTranslate=t.point);}onToolbarVisibilityChange(){this.cover=!this.toolbar||this.toolbar.hidden;}connectedCallback(){var t,o;this.rootElement=(t=this.parentElement)==null?void 0:t.parentElement,this.dragController=new b$3(this,this.rootElement),this.replayFadeOutTimeout=new Timeout(D,async()=>{await this.fadeOut();}),this.render(),this.addEventListener("pointerdown",this.pointerDownListener),this.addEventListener("longpressstart",this.longPressStartListener),this.addEventListener("longpressend",this.longPressEndListener),this.addEventListener("dragend",this.dragEndListener),this.dragController.connect(),this.longPressController.connect(),this.buttonContainerList&&((o=this.toolbar)!=null&&o.firstElementChild)&&(this.longPressController.elementsAllowedToTriggerLongPressEvents.add(this.buttonContainerList),this.longPressController.elementsAllowedToTriggerLongPressEvents.add(this.toolbar.firstElementChild)),this.dragController.margin=new Point(16,16);}disconnectedCallback(){var t,o,i,n,a,l,b;(t=this.resizeButton)==null||t.removeEventListener("pointerup",this.resizeButtonTapListener),(o=this.zoomButton)==null||o.removeEventListener("pointerup",this.zoomButtonTapListener),(i=this.torchButton)==null||i.removeEventListener("pointerup",this.torchButtonTapListener),(n=this.closeButton)==null||n.removeEventListener("pointerup",this.closeButtonTapListener),(a=this.toolbar)==null||a.removeEventListener("toolbarvisibilitychange",this.toolbarVisibilityChangeListener),this.removeEventListener("pointerdown",this.pointerDownListener),this.removeEventListener("longpressstart",this.longPressStartListener),this.removeEventListener("longpressend",this.longPressEndListener),this.removeEventListener("dragend",this.dragEndListener),safeCancelAnimation(this.fadeOutAnimation),(l=this.replayFadeOutTimeout)==null||l.stop(),(b=this.dragController)==null||b.disconnect(),this.longPressController.disconnect();}getNextTranslate(){var n,a,l;let t=((n=this.rootElement)==null?void 0:n.clientWidth)||document.body.clientWidth,o=((a=this.rootElement)==null?void 0:a.clientHeight)||document.body.clientHeight;if(!this.dragController)return new Point(0,0);if(this.size==="regular")return (l=this.lastKnownTranslate)!=null?l:this.dragController.translate;this.lastKnownTranslate=this.dragController.translate;let i=this.dragController.translate;return (this.orientation==="portrait-primary"||this.orientation==="portrait-secondary")&&this.dragController.translate.x>16&&(i=new Point(16,i.y)),(this.orientation==="landscape-primary"||this.orientation==="landscape-secondary")&&this.dragController.translate.x>t-this.clientWidth-16&&(i=new Point(t-this.clientWidth-16,i.y)),this.dragController.translate.y>o-this.clientHeight-16&&(i=new Point(i.x,o-this.clientHeight-16)),i}};w.observedAttributes=[j,i,f];var O=w;export{q as a,O as b};
1
+ import {a as a$2}from'./chunk-LWUFGA5M.js';import {a as a$1}from'./chunk-6E42EK3T.js';import {a as a$5,b as b$2}from'./chunk-OPL5NVVM.js';import {a as a$6,b as b$3}from'./chunk-ZQ3QKTQ5.js';import {b}from'./chunk-LGPC7KMW.js';import {h,g as g$2}from'./chunk-4PYZSS3H.js';import {g as g$1}from'./chunk-DVHTYKDX.js';import {a as a$3}from'./chunk-5Q3AHWJL.js';import {j,i,f,a,g,n}from'./chunk-4JEIREAU.js';import {c,e,a as a$4,b as b$1}from'./chunk-YBD5JYCX.js';import {Point}from'@scandit/web-datacapture-core';import {ScanditHTMLElement,defineCustomElements,safeAwaitAnimation,safeCancelAnimation,html,Timeout}from'@scandit/web-datacapture-core/build/js/private/utils/index.js';var q=(i=>(i.ResizeButton="resizeButton",i.ZoomButton="zoomButton",i.TorchButton="torchButton",i.CloseButton="closeButton",i))(q||{}),D=1200,w=class w extends ScanditHTMLElement{constructor(){super(...arguments);this.resizeButtonTapListener=this.onResizeButtonTap.bind(this);this.zoomButtonTapListener=this.onZoomButtonTap.bind(this);this.torchButtonTapListener=this.onTorchButtonTap.bind(this);this.closeButtonTapListener=this.onCloseButtonTap.bind(this);this.pointerDownListener=this.onPointerDown.bind(this);this.longPressStartListener=this.onLongPressStart.bind(this);this.toolbarVisibilityChangeListener=this.onToolbarVisibilityChange.bind(this);this.longPressEndListener=this.onLongPressEnd.bind(this);this.dragEndListener=this.onDragEnd.bind(this);this.fadeOutAnimation=new Animation(new KeyframeEffect(this,[{opacity:1},{opacity:0}],{duration:500,fill:"both"}));this.replayFadeOutTimeout=null;this.longPressController=new b(this);}get visible(){return this.hasAttribute("visible")}set visible(t){this.toggleAttribute("visible",t),this.dispatchEvent(new CustomEvent(h,{detail:{visible:t}}));}get size(){return this.expanded?"expanded":"regular"}set size(t){var i;this.toggleAttribute("expanded",t==="expanded");let o=this.getNextTranslate();(i=this.dragController)==null||i.translateTo(o,false).then(()=>{var n;return (n=this.dragController)==null?void 0:n.repositionIfOutOfBounds()});}get expanded(){return this.hasAttribute("expanded")}get[a](){var t;return Number((t=this.getAttribute(a))!=null?t:"1")}set[a](t){this.setAttribute(a,String(t));}get darkened(){return this.hasAttribute("darkened")}set darkened(t){this.toggleAttribute("darkened",t);}get orientation(){var t;return (t=this.getAttribute("orientation"))!=null?t:"portrait-primary"}set orientation(t){this.setAttribute("orientation",t);}get[g](){return this.hasAttribute(g)}set[g](t){this.toggleAttribute(g,t);}get[j](){return this.hasAttribute(j)}set[j](t){this.toggleAttribute(j,t);}get[i](){return this.hasAttribute(i)}set[i](t){this.toggleAttribute(i,t);}get[f](){return this.hasAttribute(f)}set[f](t){this.toggleAttribute(f,t);}get[n](){return this.hasAttribute(n)}set[n](t){this.toggleAttribute(n,t);}get cover(){return this.hasAttribute("cover")}set cover(t){this.toggleAttribute("cover",t);}get pressed(){return this.hasAttribute("pressed")}set pressed(t){this.toggleAttribute("pressed",t);}static create(){return defineCustomElements({[b$1]:w,[a$4]:a$3,[e]:a$2,[c]:a$1}),document.createElement(b$1)}repositionIfOutOfBounds(){var t;(t=this.dragController)==null||t.repositionIfOutOfBounds();}showToast(t,o,i){this.toast.show(t,o,i);}hideToast(){this.toast.hide();}zoomIn(){this.zoomButton&&(this[a]=2,this.zoomButton.textContent="2x",this.showToast("warning","2x zoom",1e3));}zoomOut(){this.zoomButton&&(this[a]=1,this.zoomButton.textContent="1x",this.showToast("info","1x zoom",1e3));}async fadeOut(){this.fadeOutAnimation.play(),await safeAwaitAnimation(this.fadeOutAnimation),this.visible=false;}cancelFadeOut(){var t;(t=this.replayFadeOutTimeout)==null||t.stop(),safeCancelAnimation(this.fadeOutAnimation);}async rewindAnimation(){var t,o;(((t=this.replayFadeOutTimeout)==null?void 0:t.running)===true||this.fadeOutAnimation.playState!=="idle")&&(this.cancelFadeOut(),(o=this.replayFadeOutTimeout)==null||o.start());}translateTo(t){var o;(o=this.dragController)==null||o.translateTo(t,false);}render(){var t,o,i$1,n$1,a$1,l,b;this.innerHTML=html`<spark-scan-view-toast></spark-scan-view-toast><div id="host"></div><div id="controls"><div id="button-container-list"><div class="button-container"><button id="torchButton" class="${b$1}__button"><spark-scan-view-icon icon="torchOff" fill="white" size="9"></spark-scan-view-icon></button><button id="closeButton" class="${b$1}__button"><spark-scan-view-icon icon="close" fill="white" size="9"></spark-scan-view-icon></button></div><div class="button-container"><button id="resizeButton" class="${b$1}__button"><spark-scan-view-icon icon="expand" fill="white" size="14"></spark-scan-view-icon></button><button id="zoomButton" class="${b$1}__button">${this[a]}x</button></div></div></div><spark-scan-view-toolbar></spark-scan-view-toolbar><div id="overlay"></div><style>${b$1}{position:absolute;top:0;left:0;display:none;background:var(${g$1});border-radius:16px;filter:drop-shadow(0px 2px 6px #${a$5.toJSON()}) drop-shadow(0px 1px 2px #${b$2.toJSON()});transition:filter .3s ease;z-index:100}${b$1},${b$1} #overlay{width:var(--dvw-half);height:var(--dvw-half);min-width:192px;min-height:192px;max-width:min(250px,var(--dvw-half));max-height:min(250px,var(--dvw-half))}@media (orientation:landscape){${b$1},${b$1} #overlay{width:var(--dvh-half);height:var(--dvh-half);max-width:min(250px,var(--dvh-half));max-height:min(250px,var(--dvh-half))}}@media screen (min-width:768px) and (orientation:portrait){${b$1},${b$1} #overlay{max-width:min(375px,var(--dvw-half));max-height:min(375px,var(--dvw-half))}}@media screen (min-width:768px) and (orientation:landscape){${b$1},${b$1} #overlay{max-width:min(375px,var(--dvh-half));max-height:min(375px,var(--dvh-half))}}${b$1}[visible]{display:flex;flex-flow:column}${b$1}[expanded],${b$1}[expanded] #overlay{width:calc(var(--dvw) - ${32}px);height:calc(var(--dvh-half) - ${32}px);max-width:min(400px,calc(var(--dvw) - ${32}px));max-height:min(400px,calc(var(--dvh-half) - ${32}px))}${b$1}[pressed]{filter:drop-shadow(0px 4px 4px #${b$2.toJSON()}) drop-shadow(0px 8px 12px #${a$5.toJSON()})}@media (orientation:landscape){${b$1}[expanded],${b$1}[expanded] #overlay{width:calc(var(--dvh-half) - ${32}px);height:calc(var(--dvh) - ${32}px);max-width:min(400px,calc(var(--dvh-half) - ${32}px));max-height:min(400px,calc(var(--dvh) - ${32}px))}}spark-scan-view-toast{position:absolute;top:16px;left:50%;transform:translateX(-50%);z-index:20}${b$1} #host,${b$1} #host *{width:100%;border-radius:16px}${b$1} #host{height:calc(100% - 48px);z-index:-10}${b$1}[cover] #host{height:100%}${b$1} #controls{position:absolute;top:0;width:100%;height:100%;display:grid;grid-template-rows:auto max-content;box-sizing:border-box}${b$1} #button-container-list{width:100%;height:calc(100% - 48px);display:flex;flex-flow:column;justify-content:space-between}${b$1}[cover] #button-container-list{height:100%}${b$1} .button-container{padding:12px;display:flex;justify-content:flex-end;align-items:center}${b$1}[${f}] .button-container:first-of-type,${b$1}[${j}] .button-container:nth-of-type(2){justify-content:space-between}.${b$1}__button{display:flex;justify-content:center;align-items:center;width:24px;height:24px;border:none;background:rgba(18,22,25,.5);color:#fff;font-family:Arial,Helvetica,sans-serif;font-size:14px;font-weight:500;border-radius:50%}${b$1} #torchButton,${b$1} #closeButton,${b$1} #resizeButton,${b$1} #zoomButton{display:none}${b$1}[${f}] #torchButton,${b$1}[${j}] #resizeButton{display:flex}${b$1}[${n}] #closeButton,${b$1}[${i}] #zoomButton{display:flex;align-self:end}${b$1} #overlay{position:absolute;z-index:10;top:0;left:0;background:#000;border-radius:16px;opacity:0;transition:opacity .3s ease;pointer-events:none}${b$1}[darkened] #overlay{opacity:.3}</style>`,this.toast=this.querySelector("spark-scan-view-toast"),this.host=this.querySelector("#host"),this.resizeButton=this.querySelector("#resizeButton"),(t=this.resizeButton)==null||t.addEventListener("pointerup",this.resizeButtonTapListener),this.resizeButtonIcon=(o=this.resizeButton)==null?void 0:o.querySelector("spark-scan-view-icon"),this.zoomButton=this.querySelector("#zoomButton"),(i$1=this.zoomButton)==null||i$1.addEventListener("pointerup",this.zoomButtonTapListener),this.torchButton=this.querySelector("#torchButton"),(n$1=this.torchButton)==null||n$1.addEventListener("pointerup",this.torchButtonTapListener),this.torchButtonIcon=(a$1=this.torchButton)==null?void 0:a$1.querySelector("spark-scan-view-icon"),this.closeButton=this.querySelector("#closeButton"),(l=this.closeButton)==null||l.addEventListener("pointerup",this.closeButtonTapListener),this.toolbar=this.querySelector(c),(b=this.toolbar)==null||b.addEventListener("toolbarvisibilitychange",this.toolbarVisibilityChangeListener),this.buttonContainerList=this.querySelector("#button-container-list");}onResizeButtonTap(t){t.stopPropagation(),this.size={regular:"expanded",expanded:"regular"}[this.size],this.resizeButtonIcon&&(this.resizeButtonIcon.icon=this.expanded?"shrink":"expand"),this.dispatchEvent(new CustomEvent(g$2,{detail:{tapped:"resizeButton",expanded:this.expanded}}));}onZoomButtonTap(t){switch(t.stopPropagation(),this[a]){case 1:{this.zoomIn();break}case 2:{this.zoomOut();break}}this.dispatchEvent(new CustomEvent(g$2,{detail:{tapped:"zoomButton",zoomFactor:this[a]}}));}onTorchButtonTap(t){t.stopPropagation(),this[g]=!this[g],this.torchButtonIcon&&(this.torchButtonIcon.icon=this[g]?"torchOn":"torchOff"),this.dispatchEvent(new CustomEvent(g$2,{detail:{tapped:"torchButton",enabled:this[g]}}));}onCloseButtonTap(t){t.stopPropagation(),this.dispatchEvent(new CustomEvent(g$2,{detail:{tapped:"closeButton"}}));}onPointerDown(){this.dragController&&(this.dragController.draggable=false),this.rewindAnimation();}onLongPressStart(){this.dragController&&(this.dragController.draggable=true),this.pressed=true;}onLongPressEnd(){this.pressed=false;}onDragEnd(t){t instanceof a$6&&(this.lastKnownTranslate=t.point);}onToolbarVisibilityChange(){this.cover=!this.toolbar||this.toolbar.hidden;}connectedCallback(){var t,o;this.rootElement=(t=this.parentElement)==null?void 0:t.parentElement,this.dragController=new b$3(this,this.rootElement),this.replayFadeOutTimeout=new Timeout(D,async()=>{await this.fadeOut();}),this.render(),this.addEventListener("pointerdown",this.pointerDownListener),this.addEventListener("longpressstart",this.longPressStartListener),this.addEventListener("longpressend",this.longPressEndListener),this.addEventListener("dragend",this.dragEndListener),this.dragController.connect(),this.longPressController.connect(),this.buttonContainerList&&((o=this.toolbar)!=null&&o.firstElementChild)&&(this.longPressController.elementsAllowedToTriggerLongPressEvents.add(this.buttonContainerList),this.longPressController.elementsAllowedToTriggerLongPressEvents.add(this.toolbar.firstElementChild)),this.dragController.margin=new Point(16,16);}disconnectedCallback(){var t,o,i,n,a,l,b;(t=this.resizeButton)==null||t.removeEventListener("pointerup",this.resizeButtonTapListener),(o=this.zoomButton)==null||o.removeEventListener("pointerup",this.zoomButtonTapListener),(i=this.torchButton)==null||i.removeEventListener("pointerup",this.torchButtonTapListener),(n=this.closeButton)==null||n.removeEventListener("pointerup",this.closeButtonTapListener),(a=this.toolbar)==null||a.removeEventListener("toolbarvisibilitychange",this.toolbarVisibilityChangeListener),this.removeEventListener("pointerdown",this.pointerDownListener),this.removeEventListener("longpressstart",this.longPressStartListener),this.removeEventListener("longpressend",this.longPressEndListener),this.removeEventListener("dragend",this.dragEndListener),safeCancelAnimation(this.fadeOutAnimation),(l=this.replayFadeOutTimeout)==null||l.stop(),(b=this.dragController)==null||b.disconnect(),this.longPressController.disconnect();}getNextTranslate(){var n,a,l;let t=((n=this.rootElement)==null?void 0:n.clientWidth)||document.body.clientWidth,o=((a=this.rootElement)==null?void 0:a.clientHeight)||document.body.clientHeight;if(!this.dragController)return new Point(0,0);if(this.size==="regular")return (l=this.lastKnownTranslate)!=null?l:this.dragController.translate;this.lastKnownTranslate=this.dragController.translate;let i=this.dragController.translate;return (this.orientation==="portrait-primary"||this.orientation==="portrait-secondary")&&this.dragController.translate.x>16&&(i=new Point(16,i.y)),(this.orientation==="landscape-primary"||this.orientation==="landscape-secondary")&&this.dragController.translate.x>t-this.clientWidth-16&&(i=new Point(t-this.clientWidth-16,i.y)),this.dragController.translate.y>o-this.clientHeight-16&&(i=new Point(i.x,o-this.clientHeight-16)),i}};w.observedAttributes=[j,i,f];var O=w;export{q as a,O as b};
@@ -1 +1 @@
1
- import {a as a$2}from'./chunk-GE7YXB6N.js';import {a as a$4}from'./chunk-4QSEBPWB.js';import {a as a$1}from'./chunk-2ZSOWJ2F.js';import {a}from'./chunk-WVIC3JWX.js';import {a as a$3}from'./chunk-PTXQJCVP.js';import {b}from'./chunk-CSRTYWCJ.js';import {DataCaptureEngine}from'@scandit/web-datacapture-core/build/js/worker/index.js';var c=class extends DataCaptureEngine{constructor(e,r){super(e,r);}getModeDeserializers(){this.barcodeCaptureMode=new a(this,this.Module,this.workerFunctions),this.barcodeBatchMode=new a$1(this,this.Module,this.workerFunctions),this.sparkScanMode=new a$2(this,this.Module,this.workerFunctions),this.barcodeFindMode=new a$3(this,this.Module,this.workerFunctions),this.barcodeArMode=new a$4(this,this.Module,this.workerFunctions);let e=super.getModeDeserializers();return e.push_back(this.barcodeCaptureMode.getCaptureDeserializer()),e.push_back(this.barcodeBatchMode.getBatchDeserializer()),e.push_back(this.sparkScanMode.getSparkScanDeserializer()),e}getWasmSideModuleFileName(){return ""}getWasmCoreFileName(e,r){return r?e?"scandit-datacapture-sdk-barcode-simd-pthreads.wasm":"scandit-datacapture-sdk-barcode-pthreads.wasm":e?"scandit-datacapture-sdk-barcode-simd.wasm":"scandit-datacapture-sdk-barcode.wasm"}getWasmCoreExpectedHash(e,r){return r?e?"3686364e70dd4f1095b6385721eb6f2afc35e4c95e8e43a0d33e2565f8c0e3c6":"c0ad7dd2e21fb730080c7a70baf2f789800c108f5e6a82bf35f42079c6108345":e?"c2baefa2a14e6e83699f5123df3bee385e258b43485de3ae503c1df9a9053573":"42dad7facf67aba54886d951a961b6015fadd87beaad354995e5e666a2ed7c93"}getWasmMetadata(){return b}};export{c as a};
1
+ import {a}from'./chunk-WVIC3JWX.js';import {a as a$3}from'./chunk-PTXQJCVP.js';import {a as a$2}from'./chunk-JTCY7I7A.js';import {a as a$4}from'./chunk-4QSEBPWB.js';import {a as a$1}from'./chunk-2ZSOWJ2F.js';import {b}from'./chunk-KXWJQ7RS.js';import {DataCaptureEngine}from'@scandit/web-datacapture-core/build/js/worker/index.js';var c=class extends DataCaptureEngine{constructor(e,r){super(e,r);}getModeDeserializers(){this.barcodeCaptureMode=new a(this,this.Module,this.workerFunctions),this.barcodeBatchMode=new a$1(this,this.Module,this.workerFunctions),this.sparkScanMode=new a$2(this,this.Module,this.workerFunctions),this.barcodeFindMode=new a$3(this,this.Module,this.workerFunctions),this.barcodeArMode=new a$4(this,this.Module,this.workerFunctions);let e=super.getModeDeserializers();return e.push_back(this.barcodeCaptureMode.getCaptureDeserializer()),e.push_back(this.barcodeBatchMode.getBatchDeserializer()),e.push_back(this.sparkScanMode.getSparkScanDeserializer()),e}getWasmSideModuleFileName(){return ""}getWasmCoreFileName(e,r){return r?e?"scandit-datacapture-sdk-barcode-simd-pthreads.wasm":"scandit-datacapture-sdk-barcode-pthreads.wasm":e?"scandit-datacapture-sdk-barcode-simd.wasm":"scandit-datacapture-sdk-barcode.wasm"}getWasmCoreExpectedHash(e,r){return r?e?"830dc2a432f9ed0e9633d2e85adea48784e2c9c65caf2f69111b15efa678467f":"4d2a9d39f458a2fe8850dd0cbfb2b63cf0be5248ea087ee0dfab7fba2925bfc3":e?"bdb001f777adb1eee19cc360422de40f1f6914ccf5ae4eb0c194096a3c8df72a":"a66559151262635deaca61d5679683235473ca36ce8bdc573b6d1b67bc323476"}getWasmMetadata(){return b}};export{c as a};
@@ -1 +1 @@
1
- import {b}from'./chunk-67E6BCDR.js';var S=class{constructor(a,i,s){this.captureListenerSet=false;this.propertyPushSource=new b;this.coreEngine=a,this.Module=i,this.workerFunctions=s,this.setup();}sparkScanDidUpdateSession(a){this.workerFunctions.postMessage({type:"sparkScanDidUpdateSession",payload:JSON.parse(a.toJson())});}getSparkScanDeserializer(){return this.sparkScanDeserializer}setup(){let a=this.Module.SparkScanListener.extend("SparkScanListener",{didScan:(r,e,t)=>{this.sparkScanDidScan(e,t),r.delete(),e.delete(),t.delete();},didUpdateSession:(r,e,t)=>{this.sparkScanDidUpdateSession(e),r.delete(),e.delete(),t.delete();}}),i=this.Module.Feedback.extend("Feedback",{emit:()=>{this.successFeedback();}}),s=this.Module.SparkScanDeserializerListener.extend("SparkScanDeserializerListener",{onModeDeserializationFinished:(r,e,t)=>{if(!this.captureListenerSet){e.addListener(new a,1),e.setSuccessFeedback(new i),e.setPropertyPushSource(this.propertyPushSource);let n=this.Module.SparkScanViewHandlerDelegate.extend("SparkScanViewHandlerDelegate",{onSwitchedAwayFromSmartScanSelection:()=>{this.workerFunctions.postMessage({type:"sparkScanSwitchedAwayFromSmartScanSelection"});},onSwitchedToSmartScanSelection:()=>{this.workerFunctions.postMessage({type:"sparkScanSwitchedToSmartScanSelection"});},enableHapticWhenOverlapping:()=>{},onStateTransition:()=>{},resetAllTimers:()=>{}}),o=new n,c=e.getStateMachine();c.setViewHandlerDelegate(o),o.delete(),c.delete(),this.sparkScan=e.clone(),this.captureListenerSet=true;}r.delete(),t.delete(),e.delete();},onModeDeserializationStarted(r,e,t){r.delete(),e.delete(),t.delete();},onSettingsDeserializationStarted(r,e,t){r.delete(),e.delete(),t.delete();},onSettingsDeserializationFinished(r,e,t){r.delete(),e.delete(),t.delete();},onOverlayDeserializationStarted(r,e,t){r.delete(),e.delete(),t.delete();},onOverlayDeserializationFinished:(r,e,t)=>{var n;(n=this.sparkScanOverlay)==null||n.delete(),this.sparkScanOverlay=e,r.delete(),t.delete();}});this.sparkScanDeserializer=new this.Module.SparkScanDeserializer,this.sparkScanDeserializer.setListener(new s);}emitErrorFeedback(a){var i;(i=this.sparkScanOverlay)==null||i.onErrorFeedbackEmitted(a);}overlayReadyForDraw(){var a;(a=this.sparkScanOverlay)==null||a.onReadyForNewData();}analyticsManagerPropertyChanged(a){this.propertyPushSource.getBehaviorSubject(a.key).setProperty(a);}successFeedback(){this.workerFunctions.postMessage({type:"successFeedback"});}selectItemWithSmartScanSelection(){var a;(a=this.sparkScan)==null||a.selectItemWithSmartScanSelectionAsync();}sparkScanDidScan(a,i){let s=this.coreEngine.convertToLoadableFrameData(i);this.workerFunctions.postMessage({type:"sparkScanDidScan",payload:{session:JSON.parse(a.toJson()),frameData:s}});}};export{S as a};
1
+ import {b}from'./chunk-67E6BCDR.js';var S=class{constructor(a,i,s){this.captureListenerSet=false;this.propertyPushSource=new b;this.coreEngine=a,this.Module=i,this.workerFunctions=s,this.setup();}sparkScanDidUpdateSession(a){this.workerFunctions.postMessage({type:"sparkScanDidUpdateSession",payload:JSON.parse(a.toJson())});}getSparkScanDeserializer(){return this.sparkScanDeserializer}setup(){let a=this.Module.SparkScanListener.extend("SparkScanListener",{didScan:(r,e,t)=>{this.sparkScanDidScan(e,t),r.delete(),e.delete(),t.delete();},didUpdateSession:(r,e,t)=>{this.sparkScanDidUpdateSession(e),r.delete(),e.delete(),t.delete();}}),i=this.Module.Feedback.extend("Feedback",{emit:()=>{this.successFeedback();}}),s=this.Module.SparkScanDeserializerListener.extend("SparkScanDeserializerListener",{onModeDeserializationFinished:(r,e,t)=>{if(!this.captureListenerSet){e.addListener(new a,1),e.setSuccessFeedback(new i),e.setPropertyPushSource(this.propertyPushSource);let n=this.Module.SparkScanViewHandlerDelegate.extend("SparkScanViewHandlerDelegate",{onSwitchedAwayFromSmartScanSelection:()=>{this.workerFunctions.postMessage({type:"sparkScanSwitchedAwayFromSmartScanSelection"});},onSwitchedToSmartScanSelection:()=>{this.workerFunctions.postMessage({type:"sparkScanSwitchedToSmartScanSelection"});},enableHapticWhenOverlapping:()=>{},onStateTransition:()=>{},resetAllTimers:()=>{}}),o=new n,c=e.getStateMachine();c.setViewHandlerDelegate(o),o.delete(),c.delete(),this.sparkScan=e.clone(),this.captureListenerSet=true;}r.delete(),t.delete(),e.delete();},onModeDeserializationStarted(r,e,t){r.delete(),e.delete(),t.delete();},onSettingsDeserializationStarted(r,e,t){r.delete(),e.delete(),t.delete();},onSettingsDeserializationFinished(r,e,t){r.delete(),e.delete(),t.delete();},onOverlayDeserializationStarted(r,e,t){r.delete(),e.delete(),t.delete();},onOverlayDeserializationFinished:(r,e,t)=>{var n;(n=this.sparkScanOverlay)==null||n.delete(),this.sparkScanOverlay=e,r.delete(),t.delete();}});this.sparkScanDeserializer=new this.Module.SparkScanDeserializer,this.sparkScanDeserializer.setListener(new s);}emitErrorFeedback(a){var i;(i=this.sparkScanOverlay)==null||i.onErrorFeedbackEmitted(a);}overlayReadyForDraw(){var a;(a=this.sparkScanOverlay)==null||a.onReadyForNewData();}analyticsManagerPropertyChanged(a){this.propertyPushSource.getBehaviorSubject(a.key).setProperty(a);}successFeedback(){this.workerFunctions.postMessage({type:"successFeedback"});}selectItemWithSmartScanSelection(){var a;(a=this.sparkScan)==null||a.selectItemWithSmartScanSelectionAsync();}async removeMode(){var a,i;this.captureListenerSet=false,(a=this.sparkScan)==null||a.delete(),this.sparkScan=void 0,(i=this.sparkScanOverlay)==null||i.delete(),this.sparkScanOverlay=void 0;}sparkScanDidScan(a,i){let s=this.coreEngine.convertToLoadableFrameData(i);this.workerFunctions.postMessage({type:"sparkScanDidScan",payload:{session:JSON.parse(a.toJson()),frameData:s}});}};export{S as a};