@scandit/web-datacapture-barcode 8.2.0 → 8.2.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (44) hide show
  1. package/build/js/ar/BarcodeAr.js +1 -1
  2. package/build/js/ar/BarcodeArFeedback.js +1 -1
  3. package/build/js/ar/BarcodeArPresenter.js +1 -1
  4. package/build/js/ar/BarcodeArView.js +1 -1
  5. package/build/js/chunks/{chunk-Z2J2FVZ3.js → chunk-64CJPZJB.js} +1 -1
  6. package/build/js/chunks/{chunk-NG3U2CXL.js → chunk-7VVWXFDF.js} +1 -1
  7. package/build/js/chunks/{chunk-WMKH42FG.js → chunk-AC3ULD45.js} +1 -1
  8. package/build/js/chunks/{chunk-OCYHIAM2.js → chunk-F4ZXJ2AL.js} +1 -1
  9. package/build/js/chunks/{chunk-HRYJX4QW.js → chunk-FAYWVBAS.js} +1 -1
  10. package/build/js/chunks/{chunk-Z4OVKU6T.js → chunk-IYVUSV45.js} +1 -1
  11. package/build/js/chunks/{chunk-A5R67FIL.js → chunk-J4KUL4XN.js} +1 -1
  12. package/build/js/chunks/{chunk-DSVREVQZ.js → chunk-P6XHJNAK.js} +1 -1
  13. package/build/js/chunks/{chunk-3MEAY6PU.js → chunk-PGXSKHUL.js} +1 -1
  14. package/build/js/chunks/{chunk-NU4EA3HH.js → chunk-QEA62LQD.js} +1 -1
  15. package/build/js/chunks/{chunk-2PM6DH45.js → chunk-R3MQ2GAV.js} +1 -1
  16. package/build/js/chunks/{chunk-N4WXAKY6.js → chunk-R6AWN5DL.js} +1 -1
  17. package/build/js/chunks/{chunk-RF4KC5J3.js → chunk-SBAQY2WJ.js} +1 -1
  18. package/build/js/chunks/{chunk-LOUBDHG7.js → chunk-UN5Y2KA6.js} +1 -1
  19. package/build/js/defaults/Defaults.js +1 -1
  20. package/build/js/find/BarcodeFind.js +1 -1
  21. package/build/js/find/BarcodeFindView.js +1 -1
  22. package/build/js/find/index.js +1 -1
  23. package/build/js/index.js +1 -1
  24. package/build/js/moduleLoader.js +1 -1
  25. package/build/js/spark/index.js +1 -1
  26. package/build/js/spark/ui/SparkScanView.js +1 -1
  27. package/build/js/spark/ui/SparkScanViewMiniPreview.js +1 -1
  28. package/build/js/spark/ui/SparkScanViewPresenter.js +1 -1
  29. package/build/js/spark/ui/SparkScanViewTriggerButton.js +1 -1
  30. package/build/js/spark/ui/index.js +1 -1
  31. package/build/js/worker/BarcodeCaptureWorkerManager.js +1 -1
  32. package/build/js/worker/WorkerMain.js +1 -1
  33. package/build/js/worker/barcodeCapture.inlineWorker.js +1 -1
  34. package/build/js/worker/dataCaptureEngine.js +1 -1
  35. package/package.json +2 -2
  36. package/sdc-lib/scandit-datacapture-sdk-barcode-pthreads.js +1 -1
  37. package/sdc-lib/scandit-datacapture-sdk-barcode-pthreads.wasm +0 -0
  38. package/sdc-lib/scandit-datacapture-sdk-barcode-simd-pthreads.js +1 -1
  39. package/sdc-lib/scandit-datacapture-sdk-barcode-simd-pthreads.wasm +0 -0
  40. package/sdc-lib/scandit-datacapture-sdk-barcode-simd.js +1 -1
  41. package/sdc-lib/scandit-datacapture-sdk-barcode-simd.wasm +0 -0
  42. package/sdc-lib/scandit-datacapture-sdk-barcode.js +1 -1
  43. package/sdc-lib/scandit-datacapture-sdk-barcode.wasm +0 -0
  44. /package/build/js/chunks/{chunk-VLGDYIWY.js → chunk-Z2LBBBJM.js} +0 -0
@@ -1,2 +1,2 @@
1
- import {DataCaptureLoader,Logger}from'@scandit/web-datacapture-core';function n(r){let s=URL.createObjectURL(new Blob(['"use strict";(()=>{var u={"scandit-datacapture-sdk-barcode-pthreads.wasm":{bytes:7955842},"scandit-datacapture-sdk-barcode-simd-pthreads.wasm":{bytes:7872164},"scandit-datacapture-sdk-barcode-simd.wasm":{bytes:7739457},"scandit-datacapture-sdk-barcode.wasm":{bytes:7823444}};function C(t){return typeof t=="object"&&t!=null}function k(t){if(typeof t=="string")return t;if(C(t)){if(typeof t.message=="string")return t.message}else if(typeof(t==null?void 0:t.toString)=="function")return t.toString();return"unknown error"}var d;(t=>{(l=>(l.Debug="debug",l.Info="info",l.Warn="warn",l.Error="error",l.Quiet="quiet"))(t.Level||(t.Level={}));let e=new Map([["debug",1],["info",2],["warn",3],["error",4],["quiet",5]]),r="debug";function a(l){r=l}t.setLevel=a;function i(l,...h){if(!(e.get(r)>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 c(...l){i("error",...l)}t.error=c})(d||(d={}));var Re=class{constructor(t){if(typeof t!="function")throw new TypeError("FinalizationRegistry callback must be a function")}register(t,e,r){}unregister(t){return!1}};function ae(t){typeof t.FinalizationRegistry>"u"&&(t.FinalizationRegistry=Re)}function ie(t,e,r){let a=e*r,i=new Uint8ClampedArray(a*4),s=new Uint32Array(i.buffer);for(let o=0;o<a;o++){let n=t[o];s[o]=4278190080|n<<16|n<<8|n}return i}var x=class se extends Error{constructor(e){super(e.message),Object.setPrototypeOf(this,se.prototype),this.name=e.name}toString(){return`${this.name}: ${this.message}`}};var D=Promise.resolve(),q=!1,G=!1,A=!1,v,Y=1500,j="";async function ne(t){if(v==null)return;q=!0;let e;try{let r=new Promise((i,s)=>{e=setTimeout(()=>{d.debug(`IndexedDB database is blocked (timed out after ${Y}ms). If you are running a Debug wasm build, things are slower and the timeout can be configured via IndexedDBBlockedTimeoutMs in localStorage (requires page reload).`),s(new x({name:"BlockedIndexedDB",message:"IndexedDB database is blocked"}))},Y)}),a=new Promise((i,s)=>{v==null||v(t,o=>{o!=null?s(o):i()})});await Promise.race([a,r])}finally{e!==void 0&&clearTimeout(e),q=!1}}async function oe(t){return G?(A=t,D):(q?(G=!0,A=t,D=D.then(async()=>(G=!1,ne(A)))):(A=t,D=ne(t)),D)}function Ee(){FS.syncfs=((t,e)=>{oe(t).then(()=>e(),r=>e(r))})}async function de(t){if(j=t.writableDataPath,Y=t.indexedDBTimeoutMs,v=FS.syncfs,v==null)throw new Error("FS.syncfs is not available");Ee();try{FS.mkdir(j)}catch(e){if(e.code!=="EEXIST")throw v=void 0,e}try{FS.mount(IDBFS,{},j)}catch(e){throw v=void 0,e}return oe(!0)}var ce={};function Le(t){return[...new Uint8Array(t)].map(e=>{let r=e.toString(16);return r.length===1?`0${r}`:r}).join("")}async function*We(t){let e=t.getReader();try{for(;;){let{done:r,value:a}=await e.read();if(r)return;yield a}}finally{e.releaseLock()}}async function Ne(t){let e=[],r=0,a=0;for await(let s of We(t))e.push(s),r+=s.length;let i=new Uint8Array(r);for(let s of e)i.set(s,a),a+=s.length;return i.buffer}var He=(t=>(t.VALID="VALID",t.INVALID="INVALID",t.NOT_VERIFIABLE="NOT_VERIFIABLE",t))(He||{});async function _e(t,e,r){if(typeof crypto.subtle.digest!="function")return d.log(d.Level.Warn,`Insecure context (see https://developer.mozilla.org/en-US/docs/Web/Security/Secure_Contexts): The hash of the Scandit Data Capture library WASM file found at ${r} could not be verified`),"NOT_VERIFIABLE";try{let a=t instanceof Promise?await t:t,i=await crypto.subtle.digest("SHA-256",a),s=Le(i);return e==null?(d.log(d.Level.Warn,"The library hash is not defined or empty, cannot correctly verify integrity."),"NOT_VERIFIABLE"):s===e?(d.log(d.Level.Debug,`Data Capture library WASM integrity found at ${r} has been verified correctly.`),"VALID"):(d.log(d.Level.Warn,`The Scandit Data Capture library WASM file found at ${r} 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(a){return d.log(d.Level.Warn,"Wasm response could not be verified",a),"NOT_VERIFIABLE"}}var X=new Map([["br",4.4],["gzip",2.9],["none",1]]);function ze(t){var e;let r="content-encoding";if(t==null||t.get(r)==null)return X.get("none");let a=new Set(((e=t.get(r))!=null?e:"").split(",").map(i=>i.trim()));for(let[i,s]of X)if(a.has(i))return s;return X.get("none")}function Ve(t){var e,r;if(t==null)return 0;let a=(e=ze(t))!=null?e:1,i=Number.parseInt((r=t.get("content-length"))!=null?r:"0",10);return Number.isNaN(i)?0:Math.floor(i*a*100)/100}function Je(t){let{pathname:e}=new URL(t);for(let[r,a]of Object.entries(ce))if(e.endsWith(r))return a.bytes;return 0}function le(t){ce=t}var Ue=(t,e)=>{let r=Ve(e);return r===0?Je(t):r};function $e(t,e,r,{onProgress:a,onError:i,onComplete:s}){if(!e.body)return[e];let o=Ue(t,e.headers),n=0,c=0;if(typeof TransformStream>"u")return d.warn("TransformStream is not supported in this environment. Progress tracking will be disabled."),[e];let[l,h]=r?e.body.tee():[e.body],m=l.pipeThrough(new TransformStream({async transform(g,f){try{n+=g.length,c=Number((n/o*100).toFixed(2)),o>0&&g.length>0&&c<100?a==null||a({percentage:c,loadedBytes:n,privateUri:t}):o===0&&g.length>0&&(a==null||a({percentage:null,loadedBytes:n,privateUri:t})),f.enqueue(g)}catch(b){f.error(b),i==null||i({error:b})}},flush(g){a==null||a({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 K({wasmURI:t,expectedHash:e,verifyResponseHash:r,onProgress:a,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[c,l]=$e(t,n,r,{onProgress:a,onError:s,onComplete:i});return l!=null&&_e(Ne(l),e,t),c}function ue({wasmURI:t,expectedHash:e,verifyResponseHash:r,progressCallback:a,successCallback:i,errorCallback:s,importObject:o,referredOrigin:n}){async function c(h){try{let m=await K({wasmURI:t,expectedHash:e,verifyResponseHash:r,onProgress:a,referredOrigin:n}),g=await(h!=null?h:m).arrayBuffer(),f=await self.WebAssembly.instantiate(g,o);i(f.instance,f.module)}catch(m){d.log(d.Level.Error,m),d.log(d.Level.Error,`Couldn\'t instantiate Scandit SDK DataCapture library at ${t}, did you configure the path for it correctly?`),s==null||s(m)}}async function l(){let h;try{h=await K({wasmURI:t,expectedHash:e,verifyResponseHash:r,onProgress:a,referredOrigin:n});let m=await self.WebAssembly.instantiateStreaming(h,o);i(m.instance,m.module)}catch(m){d.log(d.Level.Warn,m),d.log(d.Level.Warn,"WebAssembly streaming compile failed. Falling back to ArrayBuffer instantiation (this will make things slower)"),c((h==null?void 0:h.bodyUsed)===!0?void 0:h)}}typeof self.WebAssembly.instantiateStreaming=="function"?l():c()}async function Z(t,e,r,a){return new Promise((i,s)=>{t().then(i).catch(o=>{let n=e*2;if(n>r){s(o);return}a(o),self.setTimeout(()=>{Z(t,n,r,a).then(i).catch(s)},e)})})}function Q(t){var e,r;let a="unknown";if((e=t.href)!=null&&e.startsWith("blob:null/"))a="localhost";else{let i=((r=t.pathname)==null?void 0:r.length)>1&&!t.pathname.startsWith("/");a=new URL(i?t.pathname:t.origin).hostname}return a.startsWith("[")&&a.endsWith("]")?(a=a.slice(1,-1),a):(/^(\\d{1,3}\\.){3}\\d{1,3}$/.test(a)&&(a=a.split(".").map(i=>Number.parseInt(i,10).toString()).join(".")),a)}async function pe(t,e){async function r(){return importScripts(t)}try{await Z(r,250,4e3,i=>{d.log(d.Level.Warn,i),d.log(d.Level.Warn,`Couldn\'t retrieve Scandit Data Capture library at ${t}, retrying...`)}),self.Module.mainScriptUrlOrBlob=t;let a=self.SDC_WASM_JS_VERSION;return a!==e&&d.log(d.Level.Warn,`The Scandit Data Capture library JS file found at ${t} seems invalid: expected version doesn\'t match (received: ${a}, expected: ${e}). Please ensure the correct Scandit Data Capture file (with correct version) is retrieved.`),!0}catch(a){return d.log(d.Level.Error,a),!1}}var he=class{constructor(t){this.viewInfo=null,this.viewInfo=this.cloneViewInfo(t)}isSame(t){return this.viewInfo==null&&t==null?!0:this.viewInfo==null&&t!=null||this.viewInfo!=null&&t==null?!1:this.viewInfo.width===t.width&&this.viewInfo.height===t.height&&this.viewInfo.orientation===t.orientation&&this.viewInfo.viewFinderRect.origin.x===t.viewFinderRect.origin.x&&this.viewInfo.viewFinderRect.origin.y===t.viewFinderRect.origin.y&&this.viewInfo.viewFinderRect.size.width===t.viewFinderRect.size.width&&this.viewInfo.viewFinderRect.size.height===t.viewFinderRect.size.height}update(t){this.viewInfo=this.cloneViewInfo(t)}cloneViewInfo(t){return t?{...t,viewFinderRect:{origin:{...t.viewFinderRect.origin},size:{...t.viewFinderRect.size}}}:null}};var T=class{constructor(){this.promise=new Promise((t,e)=>{this.reject=e,this.resolve=t})}};var ee=class{constructor(t,e){this.workerFunctions=t,this.options=e,this.imageIdCounter=0,this.conversions=new Map}convertToJpeg(t,e){let r=this.imageIdCounter++,a=new T;this.conversions.set(r,a);let i=t.toBitmap();return this.workerFunctions.postMessage({type:"convertToJPEG",imageId:r,width:t.getWidth(),height:t.getHeight(),data:i,planes:t.getPlanes(),orientation:e,quality:this.options.quality},Array.from(new Set([i.buffer]))),a.promise}convertToBitmap(t){return{data:t.toBitmap(),byteOrder:1}}onConvertToJPEGResult(t,e){let r=this.conversions.get(t);r?(r.resolve(e),this.conversions.delete(t)):d.warn(`ImageConverterForwarder: Conversion for imageId ${t} not found in Map`)}};var O=class{constructor(t){this.options=t}get quality(){return this.options.quality}async convertToJpeg(t,e){try{let{width:r,height:a,planes:i}=this.validateAndExtractImageData(t);this.prepareCanvas(r,a);let s=this.processImageData(t,i,r,a);return await this.convertToJpegBytes(s,e)}catch(r){throw d.warn(`Failed to convert image to JPEG: ${r}`),r instanceof Error?r:new Error("Failed to convert image to JPEG")}}convertToBitmap(t){return{data:t.toBitmap(),byteOrder:1}}validateAndExtractImageData(t){let e=t.getWidth(),r=t.getHeight(),a=t.getPlanes();if(e<=0||r<=0)throw d.warn(`Invalid image dimensions: ${e}x${r}`),new Error(`Invalid image dimensions: ${e}x${r}`);if(!a||a.length===0)throw d.warn("ImageBuffer has no planes"),new Error("ImageBuffer has no planes");return{width:e,height:r,planes:a}}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,r,a){let i=this.createImageDataFromBuffer(t,e,r,a);if(i===null)throw new Error("Failed to create ImageData");return this.validateImageData(i,r,a),i}validateImageData(t,e,r){var a;if(t.width!==e||t.height!==r)throw d.warn(`ImageData dimensions mismatch: expected ${e}x${r}, got ${t.width}x${t.height}`),new Error("ImageData dimensions mismatch");if(!t.data||t.data.length!==e*r*4)throw d.warn(`ImageData has invalid data length: expected ${e*r*4}, got ${((a=t.data)==null?void 0:a.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 d.warn(`Failed to put image data on canvas: ${s}`),new Error(`Failed to put image data on canvas: ${s}`)}let r=e!==0?this.applyRotation(this.canvas,e):this.canvas,a;try{a=await this.canvasToBlob(r)}catch(s){throw d.warn(`Failed to convert canvas to blob: ${s}`),new Error(`Failed to convert canvas to blob: ${s}`)}if(!a||a.size===0)throw d.warn("Canvas convertToBlob returned empty or null blob"),new Error("Failed to create JPEG blob");let i;try{i=await a.arrayBuffer()}catch(s){throw d.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 d.warn("Blob arrayBuffer returned empty or null buffer"),new Error("Failed to get array buffer from blob");return new Uint8Array(i)}ensureCanvas(t,e){try{return(!this.canvas||this.canvas.width!==t||this.canvas.height!==e)&&(this.canvas=this.getNewCanvas(t,e),this.context=this.canvas.getContext("2d")),this.context!==null}catch(r){return d.warn("Failed to create HTMLCanvasElement",r),!1}}createImageDataFromBuffer(t,e,r,a){let i=new Set(e.map(s=>s.channel));try{if(this.isYUVFormat(i)){let n=t.toBitmap();return!n||n.length!==r*a*4?(d.warn(`Invalid bitmap data from toBitmap(): expected ${r*a*4} bytes, got ${(n==null?void 0:n.length)||0}`),null):new ImageData(new Uint8ClampedArray(n),r,a)}if(this.isRGBAFormat(i))return this.createImageDataFromRGBAPlanes(e,r,a);if(this.isRGBFormat(i))return this.createImageDataFromRGBPlanes(e,r,a);if(this.isGrayscaleFormat(i))return this.createImageDataFromGrayscalePlanes(e,r,a);d.warn(`Unknown image format with channels: ${Array.from(i).join(", ")}, falling back to toBitmap()`);let s=t.toBitmap();if(!s||s.length===0)return d.warn("toBitmap() returned empty or null data"),null;let o=s.length/(r*a);return o===4?new ImageData(new Uint8ClampedArray(s),r,a):(d.warn(`Unsupported format: ${o} bytes per pixel`),null)}catch(s){return d.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,r){let a=t.find(c=>c.channel===3),i=t.find(c=>c.channel===4),s=t.find(c=>c.channel===5),o=t.find(c=>c.channel===6);if(!a||!i||!s||!o)return d.warn("Missing RGBA planes"),null;let n=new Uint8ClampedArray(e*r*4);for(let c=0;c<r;c++)for(let l=0;l<e;l++){let h=(c*e+l)*4;n[h]=this.getPixelFromPlane(a,l,c),n[h+1]=this.getPixelFromPlane(i,l,c),n[h+2]=this.getPixelFromPlane(s,l,c),n[h+3]=this.getPixelFromPlane(o,l,c)}return new ImageData(n,e,r)}createImageDataFromRGBPlanes(t,e,r){let a=t.find(n=>n.channel===3),i=t.find(n=>n.channel===4),s=t.find(n=>n.channel===5);if(!a||!i||!s)return d.warn("Missing RGB planes"),null;let o=new Uint8ClampedArray(e*r*4);for(let n=0;n<r;n++)for(let c=0;c<e;c++){let l=(n*e+c)*4;o[l]=this.getPixelFromPlane(a,c,n),o[l+1]=this.getPixelFromPlane(i,c,n),o[l+2]=this.getPixelFromPlane(s,c,n),o[l+3]=255}return new ImageData(o,e,r)}createImageDataFromGrayscalePlanes(t,e,r){let a=t.find(s=>s.channel===0);if(!a)return d.warn("Missing Y plane for grayscale"),null;let i=new Uint8ClampedArray(e*r*4);for(let s=0;s<r;s++)for(let o=0;o<e;o++){let n=(s*e+o)*4,c=this.getPixelFromPlane(a,o,s);i[n]=c,i[n+1]=c,i[n+2]=c,i[n+3]=255}return new ImageData(i,e,r)}getPixelFromPlane(t,e,r){let a=Math.floor(e/(t.subsamplingX||1)),i=Math.floor(r/(t.subsamplingY||1)),s=t.rowStride,o=t.pixelStride,n=i*s+a*o,c=t.data;return n<c.length?c[n]:0}applyRotation(t,e){let r=e*Math.PI/180,a=e===90||e===270||e===-90||e===-270,i=a?t.height:t.width,s=a?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(r),n.translate(-t.width/2,-t.height/2),n.drawImage(t,0,0),o}};O.JPEG_IMAGE_MIME_TYPE="image/jpeg";var me=class extends O{getNewCanvas(t,e){return new OffscreenCanvas(t,e)}canvasToBlob(t){return t.convertToBlob({type:O.JPEG_IMAGE_MIME_TYPE,quality:this.options.quality})}};var R;(t=>{function e(){return"8.2.0"}t.sdkVersion=e})(R||(R={}));function Ge(t){return/^https?:\\/\\/(?:[^./]*\\.)*cdn.jsdelivr.net\\//.test(t)?{result:!0,cdnBaseURL:"https://cdn.jsdelivr.net/npm/"}:/^https?:\\/\\/(?:[^./]*\\.)*unpkg.com\\//.test(t)?{result:!0,cdnBaseURL:"https://unpkg.com/"}:{result:!1,cdnBaseURL:""}}function je(t){let e=/@scandit\\/web-datacapture-[a-z]+/i.exec(t);return e?e[0]:null}function ge(t,e,r){let a=e,i=Ge(a);if(i.result){let o=je(a);o!=null&&(a=`${i.cdnBaseURL}${o}@${t}/sdc-lib/`)}let s=r.replace(".wasm","");return i.result?{jsURI:`${a}${s}.js`,wasmURI:`${a}${s}.wasm`}:{jsURI:`${a}${s}.js?v=${t}`,wasmURI:`${a}${s}.wasm?v=${t}`}}var fe=class be{constructor(e,r){this.hintPresenterV2=null,this.MAX_NUMBER_OF_IMAGES_IN_FRAME_DATA_POOL=5,this.redrawInterval=1e3/30,this.redrawRequests=[],this._isDrawLoopRunning=!1,this.frameDataPool=new Map,this.lastFrameColorType="RGBA",this.lastFrameId=null,this.poorMansBenchmarkLogs=!1,this.writableDataPathStandard="/scandit_sync_folder",this.resourceFilesSubfolder="resources",this.performanceMetricsReporterTimer=void 0,this.lastMetricsReportTime=0,this.metricsReportInterval=1e3,this.performanceMetrics={frameDataPoolSize:0,cameraOutputFrames:0,redrawRequestsCount:0,actualRedrawsCount:0,frameProcessingStartedCount:0,frameProcessedCount:0,frameSkippedCount:0},this.frameProcessingStartedCount=0,this.frameProcessingFinishedCount=0,this.gestureListener=null,this.webPlatformHintPresenter=null,this.lastViewInfo=new he(null),this.lastFrameProcessingStartedCount=0,this.lastFrameProcessingFinishedCount=0,this.moduleHandler=e,this.workerFunctions=r,this._loadProgressCallback=this._loadProgressCallback.bind(this),le(this.getWasmMetadata())}get Module(){return this.moduleHandler.get()}set isDrawLoopRunning(e){this._isDrawLoopRunning=e,!e&&typeof this.loopTimeoutId=="number"&&(clearTimeout(this.loopTimeoutId),this.loopTimeoutId=void 0)}get isDrawLoopRunning(){return this._isDrawLoopRunning}prepareFrameForListener(e){let r=this.lastFrameId;if(this.frameDataPool.size>=this.MAX_NUMBER_OF_IMAGES_IN_FRAME_DATA_POOL){let o=this.frameDataPool.keys().next().value;o!=null&&this.frameDataPool.delete(o)}let a=e.getFrameData(),i=new Uint8ClampedArray(a);this.frameDataPool.set(r,{data:i,colorType:this.lastFrameColorType,frameId:r,width:e.getWidth(),height:e.getHeight()});let s=this.lastUsedModuleMirrorAxis==null?!1:this.lastUsedModuleMirrorAxis!==this.Module.Axis.None;return{frameId:r,width:e.getWidth(),height:e.getHeight(),isFrameSourceMirrored:s,colorType:this.lastFrameColorType}}createContext(e){var r,a,i,s,o;let n=this.getModeDeserializers(),c=Q(location);(c==="localhost"||c==="127.0.0.1")&&navigator.userAgent.includes("Electron")&&e.appName!=null&&(c+=`-${e.appName}`),this.parentDomain=e.parentDomain,this.contextDeserializer=new this.Module.DataCaptureContextDeserializer(this.writableDataPath,e.deviceId,e.context.deviceModelName,c,this.parentDomain,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,y)=>{this.contextDidChangeStatus(JSON.parse(y.toJson())),p.delete()},didStartObservingContext:p=>{this.didStartObservingContext(),p.delete()},didStopObservingContext:p=>{p.delete()}}),g=this.Module.DataCaptureContextFrameListener.extend("DataCaptureContextFrameListener",{onObservationStarted:p=>{p.delete()},onObservationStopped:p=>{p.delete()},onFrameProcessingStarted:(p,y)=>{this.workerFunctions.postMessage({type:"onFrameProcessingStarted"}),y.delete(),p.delete()},onFrameProcessingFinished:(p,y)=>{this.workerFunctions.postMessage({type:"onFrameProcessingFinished"}),y.delete(),p.delete()},onFrameSkipped:(p,y)=>{this.workerFunctions.postMessage({type:"onFrameSkipped"}),y.delete(),p.delete()}}),f=this.Module.GestureRecognizer.extend("GestureRecognizer",{setGestureListener:(p,y)=>{var F;(F=this.gestureListener)==null||F.delete(),this.gestureListener=p.clone(),p.delete()}});(r=this.gestureRecognizer)==null||r.delete(),this.gestureRecognizer=new f;let b=new m;this.context.addListener(b),b.delete();let P=new g;this.context.addFrameListener(P),P.delete(),this.setView(h),(a=this.view)==null||a.setGestureRecognizer(this.gestureRecognizer);let M=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 M,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,r){this.webImageConverterInstance instanceof ee&&this.webImageConverterInstance.onConvertToJPEGResult(e,r)}getImageConverterInstance(e){return this.workerFunctions.getOffscreenCanvas()!=null?new me(e):new ee(this.workerFunctions,e)}onTap(e){var r;(r=this.gestureListener)==null||r.onTap(JSON.stringify(e))}hintPresenterV2Update(){var e;(e=this.hintPresenterV2)==null||e.update()}startReportingPerformanceMetrics(){this.performanceMetricsReporterTimer==null&&(this.lastMetricsReportTime=performance.now(),this.scheduleMetricsReporting())}scheduleMetricsReporting(){this.performanceMetricsReporterTimer=setTimeout(()=>{this.checkAndReportMetrics()},100)}checkAndReportMetrics(){let e=performance.now();e-this.lastMetricsReportTime>=this.metricsReportInterval&&(this.reportPerformanceMetrics(),this.performanceMetrics.cameraOutputFrames=0,this.performanceMetrics.redrawRequestsCount=0,this.performanceMetrics.actualRedrawsCount=0,this.lastMetricsReportTime=e),this._isDrawLoopRunning&&this.scheduleMetricsReporting()}async reportPerformanceMetrics(){let e=this.frameProcessingStartedCount-this.lastFrameProcessingStartedCount,r=this.frameProcessingFinishedCount-this.lastFrameProcessingFinishedCount;this.lastFrameProcessingStartedCount=this.frameProcessingStartedCount,this.lastFrameProcessingFinishedCount=this.frameProcessingFinishedCount;let a={cameraOutputFrames:this.performanceMetrics.cameraOutputFrames,redrawRequestsCount:this.performanceMetrics.redrawRequestsCount,actualRedrawsCount:this.performanceMetrics.actualRedrawsCount,frameDataPoolSize:this.performanceMetrics.frameDataPoolSize,frameProcessingStartedCount:e,frameProcessedCount:r,frameSkippedCount:this.performanceMetrics.frameSkippedCount};this.workerFunctions.postMessage({type:"performanceMetricsReport",payload:a})}deleteFrameData(e){this.frameDataPool.delete(e)}dispose(){var e,r,a,i;this.context.dispose(),this.frameDataPool.clear(),this.isDrawLoopRunning=!1,this.cleanupMetricsReporting(),(e=this.gestureRecognizer)==null||e.delete(),this.gestureRecognizer=null,(r=this.gestureListener)==null||r.delete(),this.gestureListener=null,(a=this.hintPresenterV2)==null||a.delete(),this.hintPresenterV2=null,(i=this.webPlatformHintPresenter)==null||i.delete(),this.webPlatformHintPresenter=null}cleanupMetricsReporting(){this.performanceMetricsReporterTimer!=null&&(typeof this.performanceMetricsReporterTimer=="number"?cancelAnimationFrame(this.performanceMetricsReporterTimer):clearTimeout(this.performanceMetricsReporterTimer),this.performanceMetricsReporterTimer=void 0)}flushAnalytics(){this.context.flushAnalytics()}extractCentaurusLicense(e){return{payload:{centaurus:{licenseKey:this.Module.LicenseUtils[be.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 r;if(this.context==null)return d.debug("[processFrame] Context is null, returning frame without processing"),{payload:e,transferables:[e.data.buffer]};this.lastFrameId=e.frameId;let a=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(a.byteLength);return this.Module.HEAPU8.set(a,s),(r=this.imageFrameSource)==null||r.outputFrame(s,e.width,e.height,i),{payload:e,transferables:[e.data.buffer]}}reportCameraProperties(e){this.context.setCameraProperties(e.deviceId,e.isFrontFacing,e.hasAutofocus)}requestFrameData(e){let r=this.frameDataPool.get(e);if(r==null)return{payload:{data:null,frameId:null,colorType:null}};if(r.data.buffer.byteLength===0)return this.frameDataPool.delete(e),{payload:{data:null,frameId:null,colorType:null}};let a=r.data;r.colorType==="GRAYSCALE"&&(a=ie(r.data,r.width,r.height));let i={payload:{data:a,frameId:r.frameId,colorType:r.colorType},transferables:[a.buffer]};return this.frameDataPool.delete(e),i}scheduleRedraw(e,r){this.addRedrawRequest(r),this.isDrawLoopRunning||this.startDrawLoop(e)}sendViewRefreshCommands(e){this.workerFunctions.postMessage({type:"draw",payload:e},[e.buffer])}setFrameSource(e,r){var a;this.lastUsedModuleMirrorAxis=this.mapMirrorAxisOnModule(e),(a=this.imageFrameSource)==null||a.delete(),this.imageFrameSource=new this.Module.ImageBufferFrameSource(this.lastUsedModuleMirrorAxis,r,0),this.context.setFrameSource(this.imageFrameSource)}startDrawLoop(e){this.isDrawLoopRunning=!0;let r=s=>this.redrawRequests.length>0&&this.redrawRequests[0]<=s,a=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(r(s)){a(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 r=this.onBeforeUpdateContextHook(e),a=this.contextDeserializer.updateContextFromJson(this.context,this.view,JSON.stringify(r.context));if(a==null){let s=this.contextDeserializer.getLastError();throw new Error(`Could not update the context: ${s}`)}this.context.delete(),this.context=a.getContext();let i=a.getView();a.delete(),i!=null&&r.view!=null&&(i.setViewSize(r.view.width,r.view.height,r.view.orientation),i.draw()),!this.hintPresenterV2&&this.webPlatformHintPresenter&&(this.hintPresenterV2=new this.Module.HintPresenterV2(this.webPlatformHintPresenter)),i!=null&&this.hintPresenterV2&&i.setHintPresenterV2(this.hintPresenterV2),this.gestureRecognizer!=null&&(i==null||i.setGestureRecognizer(this.gestureRecognizer)),this.setView(i),this.notifyMainThreadOnViewInfoChanged(i),d.debug("context updated",r)}}notifyMainThreadOnViewInfoChanged(e){let r=this.getViewInfo(e);this.lastViewInfo.isSame(r)||(this.lastViewInfo.update(r),this.workerFunctions.postMessage({type:"viewSizeChanged",payload:r}))}getViewInfo(e){if(e!=null)try{let r=JSON.parse(e.getViewInfo());if(r!=null){let a=this.getOrientationFromNumber(r.orientation);return{...r,orientation:a}}}catch(r){d.error("Failed to get view size",r)}return null}getOrientationFromNumber(e){switch(e){case 90:return"landscapeRight";case 180:return"portraitUpsideDown";case 270:return"landscapeLeft";default:return"portrait"}}onBeforeUpdateContextHook(e){return e}onDocumentVisibilityChange(e){e==="hidden"&&this.context.flushAnalytics()}isFeatureSupported(e){return{payload:{supported:this.context.isFeatureSupported(e)}}}getViewfinderInfo(){var e,r;return{payload:{isDisplayingViewfinder:(r=(e=this.view)==null?void 0:e.isDisplayingViewfinder())!=null?r:!1,rect:JSON.parse(this.view.getViewfinderRect())}}}getOpenSourceSoftwareLicenseInfo(){return{payload:{licenseText:this.Module.OpenSourceSoftwareLicenseInfo.getLicenseText()}}}getWasmDynamicLibraries(e){return this.getWasmSideModuleFileName()==null?[]:[`${e.replace(/\\/[^/]*$/,"/")}${this.getWasmSideModuleFileName()}`]}getWasmCoreExpectedHash(e,r){return r?e?"6ea5df9121d5c015e1d5bdfa8afb5d3eed4452c187c3e7e3c8c7d095f279279f":"8c9907fe8bea3dfb7b4aad8b2fd59f8dd0278ac81452e864f5827eba99321480":e?"7cd946e7149a606b34879c4cfe8c563a633e86044702b76a2d2a1d4e69c1971c":""}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":""}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((r,a)=>r-a)}contextDidChangeStatus(e){e.code===260?e.message=e.message.replace("domain name",`domain name (${Q(location)})`):e.code===265&&(e.message=e.message.replace("domain name",`domain name (${this.parentDomain})`)),this.workerFunctions.postMessage({type:"contextDidChangeStatus",payload:e})}didStartObservingContext(){this.workerFunctions.postMessage({type:"didStartObservingContext"})}mapMirrorAxisOnModule(e){switch(e){case"None":return this.Module.Axis.None;case"X":return this.Module.Axis.X;case"Y":return this.Module.Axis.Y;default:return this.Module.Axis.None}}setView(e){this.view=e,this.setViewRefreshHandler(e),e==null&&(this.isDrawLoopRunning=!1,this.sendViewRefreshCommands(new Uint8Array([])))}addNativeOverlay(e){d.warn("addNativeOverlay has not been implemented for this module",e)}removeNativeOverlay(e){d.warn("removeNativeOverlay has not been implemented for this module",e)}setViewRefreshHandler(e){if(e==null||e.isViewRefreshHandlerSet)return;let r=this.Module.NeedsRedrawDelegate.extend("NeedsRedrawDelegate",{setNeedsRedrawIn:this.scheduleRedraw.bind(this,e)}),a=new r;e.setNeedsRedrawDelegate(a),e.isViewRefreshHandlerSet=!0}setupDataDecoding(){let e=this.moduleHandler.get(),r=e.DataDecoding.extend("DataDecoding",{decode(a,i){try{let s=JSON.parse(i),o=[];for(let n of s){let c=new TextDecoder(n.ianaName,{fatal:!0});o.push(c.decode(a.slice(n.startIndex,n.endIndex)))}return o.join("")}catch{return""}}});e.setDataDecoding(new r)}start(e,r,a){e&&r&&(this.setupDataDecoding(),this.moduleHandler.get().callMain(),this.moduleHandler.get().__emscripten_proxy_main!==void 0||a())}getWritableDataPath(e){return e!=null?(d.debug(`IndexedDB database name override in use to recover from blocked standard database: ${e}`),e):this.writableDataPathStandard}numOfMBToPages(e){return Math.ceil(1024*e*1024/64/1024)}async setup({libraryLocation:e,locationPath:r,writableDataPathOverride:a,indexedDBTimeoutMs:i,verifyResponseHash:s,referredOrigin:o,fixedWasmMemory:n,simdSupport:c,threadsSupport:l}){var h;let m=!1,g=!1;this.writableDataPath=this.getWritableDataPath(a),this.resourcePath=`${e}${this.resourceFilesSubfolder}/`,self.path=r;let{resolve:f,reject:b,promise:P}=new T,M=R.sdkVersion();if(M==="")throw new x({name:"Invalid library version",message:"Library version is not defined or empty, cannot generate proper path to library files."});let p=this.getWasmCoreFileName(c,l),y=ge(M,e,p),{jsURI:F,wasmURI:re}=y,xe={instantiateWasm:(S,Ae)=>(ue({importObject:S,wasmURI:re,expectedHash:this.getWasmCoreExpectedHash(c,l),verifyResponseHash:s,successCallback:Ae,progressCallback:this._loadProgressCallback,errorCallback:Te=>{b(Te)},referredOrigin:o}),{})},B=n===null?null:new WebAssembly.Memory({initial:this.numOfMBToPages(n),maximum:this.numOfMBToPages(300),shared:l});return B!==null&&d.log(d.Level.Debug,"Fixed wasmMemory set",B),this.moduleHandler.set({...B?{wasmMemory:B}:{},mainScriptUrlOrBlob:F,canvas:(h=this.workerFunctions.getOffscreenCanvas())!=null?h:{getContext:()=>null},...xe,dynamicLibraries:this.getWasmDynamicLibraries(re),locateFile:S=>e+S,noInitialRun:!0,preRun:[async()=>{try{await de({writableDataPath:this.writableDataPath,indexedDBTimeoutMs:i})}catch(S){if(S.name==="BlockedIndexedDB"){b(S.toString());return}d.log(d.Level.Debug,"No IndexedDB support, some data will not be persisted:",S)}g=!0,this.start(g,m,f)}],onMainComplete:()=>{if([m,g].includes(!1)){d.log(d.Level.Warn,{runtimeLoaded:m,fileSystemSynced:g},"Both runtimeLoaded and fileSystemSynced should be true when calling onMainComplete"),b("onMainComplete has been called but runtime or file system was not ready.");return}f()},onRuntimeInitialized:()=>{m=!0,this.start(g,m,f)},print:S=>{d.info(S)}}),await pe(F,M)||b(`Couldn\'t retrieve Scandit Data Capture library at ${F}, did you configure the path for it correctly?`),P}};fe.get3dPartyLicenseKeyMethodName=atob("Z2V0QmxpbmtJZExpY2Vuc2VLZXk=");var I=fe;function ye(t){return typeof t=="object"&&t!=null&&t.document==null&&"addEventListener"in t&&typeof t.importScripts=="function"}function Se(t){console.warn("Reached unexpected case",t)}var te=class{constructor(t,e){this.onMessageListener=this.onMessage.bind(this),this.workerSelf=t,this.dataCaptureInstance=new I(e,{postMessage:this.postMessage.bind(this),getOffscreenCanvas:this.getOffscreenCanvas.bind(this)}),ye(t)&&(ae(t),this.listenToMessages())}listenToMessages(){this.workerSelf.addEventListener("message",this.onMessageListener),this.workerSelf.addEventListener("error",t=>{d.log(d.Level.Error,t)}),this.workerSelf.addEventListener("messageerror",t=>{d.log(d.Level.Error,t)})}postMessage(t,e){this.workerSelf.postMessage(t,e!=null?e:[])}getOffscreenCanvas(){if(this.isOffscreenCanvasSupported())return new this.workerSelf.OffscreenCanvas(32,32)}isOffscreenCanvasSupported(){return typeof this.workerSelf.OffscreenCanvas=="function"}hasPayload(t){return C(t)&&"payload"in t}hasTransferables(t){return C(t)&&Array.isArray(t.transferables)}async respondWith(t,e,r){let a=null,i;try{i=r(),i instanceof Promise&&(i=await i)}catch(o){i=void 0,a=k(o)}let s={type:"workerTaskId",command:t,id:e,payload:this.hasPayload(i)?i.payload:void 0};a!=null&&(s.error=a),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,indexedDBTimeoutMs:e.indexedDBTimeoutMs}))}break}case"onTap":{{let{data:e}=t;this.respondWith(e.command,e.id,async()=>{this.dataCaptureInstance.onTap(e.point)})}break}case"hintPresenterV2update":{{let{data:e}=t;this.respondWith(e.command,e.id,async()=>{this.dataCaptureInstance.hintPresenterV2Update()})}break}case"createContext":{{let{data:e}=t;this.respondWith(e.command,e.id,()=>this.dataCaptureInstance.createContext({context:e.context,deviceId:e.deviceId,delayedRegistration:e.delayedRegistration,highEndBlurryRecognition:e.highEndBlurryRecognition,appName:e.appName,parentDomain:e.parentDomain}))}break}case"setFrameSource":{{let{data:e}=t;this.respondWith(e.command,e.id,()=>this.dataCaptureInstance.setFrameSource(e.mirrorAxis,e.isCameraFrameSource))}break}case"processFrame":{{let{data:e}=t;this.respondWith(e.command,e.id,()=>this.dataCaptureInstance.processFrame({data:e.data,frameId:e.frameId,width:e.width,height:e.height,colorType:e.colorType}))}break}case"requestFrameData":{{let{data:e}=t;this.respondWith(e.command,e.id,()=>this.dataCaptureInstance.requestFrameData(e.frameId))}break}case"deleteFrameData":{{let{data:e}=t;this.respondWith(e.command,e.id,()=>{this.dataCaptureInstance.deleteFrameData(e.frameId)})}break}case"updateContext":{{let{data:e}=t;this.respondWith(e.command,e.id,async()=>this.dataCaptureInstance.updateContext(e))}break}case"dispose":{this.respondWith(t.data.command,t.data.id,()=>this.dataCaptureInstance.dispose());break}case"flushAnalytics":{this.respondWith(t.data.command,t.data.id,()=>{this.dataCaptureInstance.flushAnalytics()});break}case"reportCameraProperties":{{let{data:e}=t;this.respondWith(e.command,e.id,async()=>this.dataCaptureInstance.reportCameraProperties(e))}break}case"setLogLevel":{{let{data:e}=t;this.respondWith(e.command,e.id,()=>{d.setLevel(e.level)})}break}case"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 Se(t.data),!1}return!0}};var we=(t=>(t.Body="body",t.Footnote="footnote",t))(we||{}),E=(t=>(t.Start="start",t.Center="center",t.End="end",t))(E||{}),ve=(t=>(t.Normal="normal",t.Wider="wider",t.FitText="fitText",t))(ve||{}),Fe=(t=>(t.Normal="normal",t.Taller="taller",t))(Fe||{}),Me=(t=>(t.Square="square",t.Rounded="rounded",t))(Me||{}),L=(t=>(t.None="none",t.Check="check",t.ExclamationMark="exclamationMark",t))(L||{}),W=(t=>(t.Top="top",t.Center="center",t.AboveViewFinder="aboveViewFinder",t.BelowViewFinder="belowViewFinder",t))(W||{}),Ce=(t=>(t.AboveViewFinder="aboveViewFinder",t.BelowViewFinder="belowViewFinder",t))(Ce||{}),ke=(t=>(t.BlackOnWhite="blackOnWhite",t.WhiteOnBlack="whiteOnBlack",t.Transparent="transparent",t))(ke||{}),De=(t=>(t.Success="success",t.Error="error",t.Warning="warning",t.Info="info",t.Notification="notification",t))(De||{}),Ie=(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))(Ie||{});var N=class{constructor(e,r,a){this.barcodeAr=null;this.coreEngine=e,this.Module=r,this.workerFunctions=a}async forSettings(e){var a;(a=this.barcodeAr)==null||a.delete(),this.barcodeAr=new this.Module.BarcodeAr(this.coreEngine.context,JSON.stringify(e));let r=this.Module.BarcodeArListener.extend("BarcodeArListener",{didUpdateSession:(i,s,o)=>{let n=this.coreEngine.prepareFrameForListener(o);this.workerFunctions.postMessage({type:"barcodeArDidUpdateSession",payload:{session:JSON.parse(s.toJson()),frameData:n}}),i.delete(),s.delete(),o.delete()}});this.barcodeAr.addListener(new r,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 r;(r=this.barcodeAr)==null||r.setEnabled(e)}async removeMode(){this.barcodeAr!=null&&this.Module.removeBarcodeArFromContext(this.coreEngine.context,this.barcodeAr)}applySettings(e){var r;(r=this.barcodeAr)==null||r.applySettings(JSON.stringify(e))}};var H=class{constructor(e,r,a){this.trackingListenerSet=!1;this.coreEngine=e,this.Module=r,this.workerFunctions=a,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:(a,i,s)=>{this.barcodeBatchDidUpdateSession(i),a.delete(),i.delete(),s.delete()},onTrackedBarcodeTapped:(a,i)=>{this.onTrackedBarcodeTapped(i),a.delete(),i.delete()}}),r=this.Module.BarcodeBatchDeserializerListener.extend("BarcodeTrackingDeserializerListener",{onModeDeserializationFinished:(a,i,s)=>{this.trackingListenerSet||(i.addListener(new e,1),this.trackingListenerSet=!0),a.delete(),i.delete(),s.delete()},onModeDeserializationStarted(a,i,s){a.delete(),i.delete(),s.delete()},onSettingsDeserializationStarted(a,i,s){a.delete(),i.delete(),s.delete()},onSettingsDeserializationFinished(a,i,s){a.delete(),i.delete(),s.delete()}});this.barcodeBatchDeserializer=new this.Module.BarcodeBatchDeserializer,this.barcodeBatchDeserializer.setListener(new r)}onTrackedBarcodeTapped(e){this.workerFunctions.postMessage({type:"didTapTrackedBarcode",payload:JSON.parse(e.toJson())})}};var _=class{constructor(e,r,a){this.captureListenerSet=!1;this.coreEngine=e,this.Module=r,this.workerFunctions=a,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,c)=>{this.barcodeCaptureDidScan(n,c),o.delete(),c.delete(),n.delete()},didUpdateSession:(o,n,c)=>{this.barcodeCaptureDidUpdateSession(n),o.delete(),c.delete(),n.delete()}}),r=this.Module.Feedback.extend("Feedback",{emit:()=>{this.successFeedback()}}),a=new e,i=new r,s=this.Module.BarcodeCaptureDeserializerListener.extend("BarcodeCaptureDeserializerListener",{onModeDeserializationFinished:(o,n,c)=>{n.addListener(a,1),n.setSuccessFeedback(i),o.delete(),n.delete(),c.delete()},onModeDeserializationStarted(o,n,c){o.delete(),n.delete(),c.delete()},onSettingsDeserializationStarted(o,n,c){o.delete(),n.delete(),c.delete()},onSettingsDeserializationFinished(o,n,c){o.delete(),n.delete(),c.delete()}});this.barcodeCaptureDeserializer=new this.Module.BarcodeCaptureDeserializer,this.barcodeCaptureDeserializer.setListener(new s)}successFeedback(){this.workerFunctions.postMessage({type:"successFeedback"})}barcodeCaptureDidScan(e,r){let a=this.coreEngine.prepareFrameForListener(r);this.workerFunctions.postMessage({type:"barcodeCaptureDidScan",payload:{session:JSON.parse(e.toJson()),frameData:a}})}};function qe(t){return t.charAt(0).toUpperCase()+t.slice(1)}function Pe(t){return t}var z=class{constructor(e,r,a){this.barcodeFind=null;this.basicOverlay=null;this.transparentGuidanceHintStyle={backgroundColor:"00000000",cornerRadius:4,fitToText:!1,isAnimatedToView:!1,textAlignment:E.Center,hintIcon:L.None,hintAnchor:W.Center,hintAnchorOffset:0,horizontalMargin:0,iconColor:"00000000",lineHeight:-1,maxLines:1,maxWidthFraction:.8,textColor:"ffffffff",textSize:15,textWeight:600};this.customerTransformation=Pe;this.coreEngine=e,this.Module=r,this.workerFunctions=a}async forSettings(e){var o;(o=this.barcodeFind)==null||o.delete(),this.barcodeFind=new this.Module.BarcodeFind(this.coreEngine.context,JSON.stringify(e));let r=this.Module.Feedback.extend("Feedback",{emit:()=>{this.listUpdatedFeedback()}}),a=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,c,l)=>{let h=this.coreEngine.prepareFrameForListener(l);this.workerFunctions.postMessage({type:"barcodeFindDidUpdateSession",payload:{session:JSON.parse(c.toJson()),frameData:h}}),n.delete(),c.delete(),l.delete()},onSearchPaused:n=>{let c=[];for(let l=0;l<n.size();l++)c.push(n.get(l));this.workerFunctions.postMessage({type:"barcodeFindSearchPaused",payload:{foundItems:c}})},onSearchStopped:n=>{let c=[];for(let l=0;l<n.size();l++)c.push(n.get(l));this.workerFunctions.postMessage({type:"barcodeFindSearchStopped",payload:{foundItems:c}})},onSearchStarted:()=>{this.workerFunctions.postMessage({type:"barcodeFindSearchStarted",payload:{}})}});this.barcodeFind.setBarcodeFindTransformer(new i),this.barcodeFind.addListener(new s,1),this.barcodeFind.setItemListUpdatedFeedback(new r),this.barcodeFind.setFeedback(new a),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 r;(r=this.barcodeFind)==null||r.setEnabled(e)}setItemList(e){var r;(r=this.barcodeFind)==null||r.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 r;(r=this.barcodeFind)==null||r.applySettings(JSON.stringify(e))}updateBasicOverlay(e){let r=Object.entries(e).filter(([a,i])=>a!=="type");for(let[a,i]of r){let s=`set${qe(a)}`;this.basicOverlay!=null&&typeof this.basicOverlay[s]=="function"&&i!=null&&this.basicOverlay[s](i)}}setTransformerFunction(e){this.customerTransformation=e!=null?e:Pe}successFeedback(){this.workerFunctions.postMessage({type:"successFeedback"})}listUpdatedFeedback(){this.workerFunctions.postMessage({type:"barcodeFindListUpdatedFeedback",payload:{}})}setToast(e,r){let a=this.coreEngine.hintPresenterV2;e?a==null||a.showToast(JSON.stringify(r)):a==null||a.hideToast(r.tag)}setGuidance(e,r,a){let i={tag:a,text:r,hintStyle:this.transparentGuidanceHintStyle};this.workerFunctions.postMessage({type:e?"showGuidance":"hideGuidance",payload:i})}createWebFindGuidanceHandler(){let e=this.Module.BarcodeFindGuidanceHandler.extend("BarcodeFindGuidanceHandler",{setInitialGuidance:(r,a)=>{this.setGuidance(r,a,"InitialGuidance")},setMoveCloserGuidance:(r,a)=>{this.setGuidance(!1,a,"InitialGuidance"),this.setGuidance(r,a,"MoveCloserGuidance")},setTapShutterToPause:(r,a)=>{this.setGuidance(!1,a,"InitialGuidance"),this.setGuidance(r,a,"TapShutterToPause")},setTapShutterToResume:(r,a)=>{this.setGuidance(!1,a,"InitialGuidance"),this.setGuidance(r,a,"TapShutterResume")}});return new e}};var w=class{constructor(e){this.subscribers=new Set;this.property={key:e,value:null}}addSubscriber(e){var r;this.subscribers.add(e),(r=e.onPropertyChanged)==null||r.call(e,this.property)}removeSubscriber(e){this.subscribers.delete(e)}setProperty(e){var r;if(this.property.value!==e.value){this.property={key:this.property.key,value:e.value};for(let a of this.subscribers)(r=a.onPropertyChanged)==null||r.call(a,this.property)}}};var Ye={torch_state:new w("torch_state"),scanning_mode:new w("scanning_mode"),sound_enabled:new w("sound_enabled"),haptic_enabled:new w("haptic_enabled"),session_stop_reason:new w("session_stop_reason"),camera_position:new w("camera_position")},V=class{getBehaviorSubject(e){return Ye[e]}};var J=class{constructor(e,r,a){this.captureListenerSet=!1;this.propertyPushSource=new V;this.coreEngine=e,this.Module=r,this.workerFunctions=a,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()}}),r=this.Module.Feedback.extend("Feedback",{emit:()=>{this.successFeedback()}}),a=this.Module.SparkScanDeserializerListener.extend("SparkScanDeserializerListener",{onModeDeserializationFinished:(i,s,o)=>{if(!this.captureListenerSet){s.addListener(new e,1),s.setSuccessFeedback(new r),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:()=>{}}),c=new n,l=s.getStateMachine();l.setViewHandlerDelegate(c),c.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 a)}emitErrorFeedback(e){var r;(r=this.sparkScanOverlay)==null||r.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,r;this.captureListenerSet=!1,(e=this.sparkScan)==null||e.delete(),this.sparkScan=void 0,(r=this.sparkScanOverlay)==null||r.delete(),this.sparkScanOverlay=void 0}sparkScanDidScan(e,r){let a=this.coreEngine.prepareFrameForListener(r);this.workerFunctions.postMessage({type:"sparkScanDidScan",payload:{session:JSON.parse(e.toJson()),frameData:a}})}};var U=class extends I{constructor(e,r){super(e,r)}getModeDeserializers(){this.barcodeCaptureMode=new _(this,this.Module,this.workerFunctions),this.barcodeBatchMode=new H(this,this.Module,this.workerFunctions),this.sparkScanMode=new J(this,this.Module,this.workerFunctions),this.barcodeFindMode=new z(this,this.Module,this.workerFunctions),this.barcodeArMode=new N(this,this.Module,this.workerFunctions);let e=super.getModeDeserializers();return e.push_back(this.barcodeCaptureMode.getCaptureDeserializer()),e.push_back(this.barcodeBatchMode.getBatchDeserializer()),e.push_back(this.sparkScanMode.getSparkScanDeserializer()),e}getWasmSideModuleFileName(){return""}getWasmCoreFileName(e,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?"6ea5df9121d5c015e1d5bdfa8afb5d3eed4452c187c3e7e3c8c7d095f279279f":"8c9907fe8bea3dfb7b4aad8b2fd59f8dd0278ac81452e864f5827eba99321480":e?"7cd946e7149a606b34879c4cfe8c563a633e86044702b76a2d2a1d4e69c1971c":"c820e8a917292c0cc7819b025602e71fa334e1a864c51a28329cb8b31374489d"}getWasmMetadata(){return u}};function Xe(t){return(r=>/^[$A-Z_a-z][\\w$]*\\s*\\(.*\\)\\s*\\{/.test(r)&&!r.startsWith("function"))(t)?`function ${t}`:t}var Ke=["fetch","XMLHttpRequest","eval","Function","self","globalThis","Module","importScripts","this","console","window","document","import","Worker","ServiceWorker"];function Ze(t){return Ke.map(r=>new RegExp(`\\\\b${r}\\\\b`,"g")).some(r=>r.test(t))}function Be(t){if(t==null)return null;let e=Xe(t);if(Ze(e))throw new Error("Function should be pure. Shouldn\'t introduce side effects, or rely on global scope");let r=`\'use strict\';\n return (${e});`;try{return new Function(r)()}catch{return null}}var $=class extends te{constructor(e,r){super(e,r),this.dataCaptureInstance=new U(r,{postMessage:this.postMessage.bind(this),getOffscreenCanvas:this.getOffscreenCanvas.bind(this)})}async respondWith(e,r,a){let i=null,s;try{s=a(),s instanceof Promise&&(s=await s)}catch(n){s=void 0,i=k(n)}let o={type:"workerTaskId",command:e,id:r,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:r}=e;return this.respondWith(r.command,r.id,()=>{this.dataCaptureInstance.sparkScanMode.emitErrorFeedback(r.shouldRemoveBrush)}),!0}case"sparkScanOverlayReadyForDraw":{let{data:r}=e;return this.respondWith(r.command,r.id,()=>{this.dataCaptureInstance.sparkScanMode.overlayReadyForDraw()}),!0}case"sparkScanAnalyticsManagerPropertyChanged":{let{data:r}=e;return this.respondWith(r.command,r.id,async()=>{this.dataCaptureInstance.sparkScanMode.analyticsManagerPropertyChanged(r.property)}),!0}case"sparkScanSelectItemWithSmartScanSelection":{let{data:r}=e;return this.respondWith(r.command,r.id,async()=>{this.dataCaptureInstance.sparkScanMode.selectItemWithSmartScanSelection()}),!0}case"sparkScanModeRemove":{let{data:r}=e;return this.respondWith(r.command,r.id,async()=>this.dataCaptureInstance.sparkScanMode.removeMode()),!0}case"barcodeFindForSettings":{let{data:r}=e;return this.respondWith(r.command,r.id,async()=>this.dataCaptureInstance.barcodeFindMode.forSettings(r.settings)),!0}case"barcodeFindModeRemove":{let{data:r}=e;return this.respondWith(r.command,r.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:r}=e;return this.respondWith(e.data.command,e.data.id,()=>{this.dataCaptureInstance.barcodeFindMode.setItemList(r.itemList)}),!0}case"barcodeFindSetEnabled":{let{data:r}=e;return this.respondWith(e.data.command,e.data.id,()=>{this.dataCaptureInstance.barcodeFindMode.setEnabled(r.enabled)}),!0}case"barcodeFindApplySettings":{let{data:r}=e;return this.respondWith(r.command,r.id,async()=>this.dataCaptureInstance.barcodeFindMode.applySettings(r.settings)),!0}case"barcodeFindAddBasicOverlay":{let{data:r}=e;return this.respondWith(r.command,r.id,async()=>{this.dataCaptureInstance.barcodeFindMode.addBasicOverlay()}),!0}case"barcodeFindRemoveBasicOverlay":{let{data:r}=e;return this.respondWith(r.command,r.id,async()=>{this.dataCaptureInstance.barcodeFindMode.removeBasicOverlay()}),!0}case"barcodeFindUpdateBasicOverlay":{let{data:r}=e;return this.respondWith(r.command,r.id,async()=>{this.dataCaptureInstance.barcodeFindMode.updateBasicOverlay(r.jsonOverlay)}),!0}case"barcodeFindSetTransformerFunction":{let{data:r}=e;return this.respondWith(r.command,r.id,async()=>{let a=Be(r.functionAsString);this.dataCaptureInstance.barcodeFindMode.setTransformerFunction(a)}),!0}case"barcodeArForSettings":{let{data:r}=e;return this.respondWith(r.command,r.id,async()=>this.dataCaptureInstance.barcodeArMode.forSettings(r.settings)),!0}case"barcodeArModeRemove":{let{data:r}=e;return this.respondWith(r.command,r.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:r}=e;return this.respondWith(e.data.command,e.data.id,()=>{this.dataCaptureInstance.barcodeArMode.setEnabled(r.enabled)}),!0}case"barcodeArApplySettings":{let{data:r}=e;return this.respondWith(r.command,r.id,async()=>{this.dataCaptureInstance.barcodeArMode.applySettings(r.settings)}),!0}default:return super.onMessage(e)}}};var Sa=new $(self,{get:()=>self.Module,set:t=>{self.Module=t}});function wa(t){}})();\n'],{type:"application/javascript"})),e=new Worker(s,r);return URL.revokeObjectURL(s),e}var o=class r extends DataCaptureLoader{constructor(){super(...arguments);this._name="BarcodeCapture";}get dataCaptureWorker(){return (this._dataCaptureWorker)!=null||(this._dataCaptureWorker=n({name:this.name})),this._dataCaptureWorker}get name(){return this._name}static async create(e){var a;let t=new r(e);return await t.workerCommand("setLogLevel",{level:(a=e.logLevel)!=null?a:Logger.Level.Debug}),await t.load(),t}async workerCommand(e,t,a){return new Promise((d,l)=>{let i=this.workerCommandId++;this.workerTasks.set(i,{resolve:d,reject:l,command:e});let c={...t,command:e,id:i};this.dataCaptureWorker.postMessage(c,a);})}};
1
+ import {DataCaptureLoader,Logger}from'@scandit/web-datacapture-core';function n(r){let s=URL.createObjectURL(new Blob(['"use strict";(()=>{var u={"scandit-datacapture-sdk-barcode-pthreads.wasm":{bytes:7955952},"scandit-datacapture-sdk-barcode-simd.wasm":{bytes:7739571},"scandit-datacapture-sdk-barcode.wasm":{bytes:7823559},"scandit-datacapture-sdk-barcode-simd-pthreads.wasm":{bytes:7872275}};function C(t){return typeof t=="object"&&t!=null}function k(t){if(typeof t=="string")return t;if(C(t)){if(typeof t.message=="string")return t.message}else if(typeof(t==null?void 0:t.toString)=="function")return t.toString();return"unknown error"}var d;(t=>{(l=>(l.Debug="debug",l.Info="info",l.Warn="warn",l.Error="error",l.Quiet="quiet"))(t.Level||(t.Level={}));let e=new Map([["debug",1],["info",2],["warn",3],["error",4],["quiet",5]]),r="debug";function a(l){r=l}t.setLevel=a;function i(l,...h){if(!(e.get(r)>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 c(...l){i("error",...l)}t.error=c})(d||(d={}));var Re=class{constructor(t){if(typeof t!="function")throw new TypeError("FinalizationRegistry callback must be a function")}register(t,e,r){}unregister(t){return!1}};function ae(t){typeof t.FinalizationRegistry>"u"&&(t.FinalizationRegistry=Re)}function ie(t,e,r){let a=e*r,i=new Uint8ClampedArray(a*4),s=new Uint32Array(i.buffer);for(let o=0;o<a;o++){let n=t[o];s[o]=4278190080|n<<16|n<<8|n}return i}var x=class se extends Error{constructor(e){super(e.message),Object.setPrototypeOf(this,se.prototype),this.name=e.name}toString(){return`${this.name}: ${this.message}`}};var D=Promise.resolve(),q=!1,G=!1,A=!1,v,Y=1500,j="";async function ne(t){if(v==null)return;q=!0;let e;try{let r=new Promise((i,s)=>{e=setTimeout(()=>{d.debug(`IndexedDB database is blocked (timed out after ${Y}ms). If you are running a Debug wasm build, things are slower and the timeout can be configured via IndexedDBBlockedTimeoutMs in localStorage (requires page reload).`),s(new x({name:"BlockedIndexedDB",message:"IndexedDB database is blocked"}))},Y)}),a=new Promise((i,s)=>{v==null||v(t,o=>{o!=null?s(o):i()})});await Promise.race([a,r])}finally{e!==void 0&&clearTimeout(e),q=!1}}async function oe(t){return G?(A=t,D):(q?(G=!0,A=t,D=D.then(async()=>(G=!1,ne(A)))):(A=t,D=ne(t)),D)}function Ee(){FS.syncfs=((t,e)=>{oe(t).then(()=>e(),r=>e(r))})}async function de(t){if(j=t.writableDataPath,Y=t.indexedDBTimeoutMs,v=FS.syncfs,v==null)throw new Error("FS.syncfs is not available");Ee();try{FS.mkdir(j)}catch(e){if(e.code!=="EEXIST")throw v=void 0,e}try{FS.mount(IDBFS,{},j)}catch(e){throw v=void 0,e}return oe(!0)}var ce={};function Le(t){return[...new Uint8Array(t)].map(e=>{let r=e.toString(16);return r.length===1?`0${r}`:r}).join("")}async function*We(t){let e=t.getReader();try{for(;;){let{done:r,value:a}=await e.read();if(r)return;yield a}}finally{e.releaseLock()}}async function Ne(t){let e=[],r=0,a=0;for await(let s of We(t))e.push(s),r+=s.length;let i=new Uint8Array(r);for(let s of e)i.set(s,a),a+=s.length;return i.buffer}var He=(t=>(t.VALID="VALID",t.INVALID="INVALID",t.NOT_VERIFIABLE="NOT_VERIFIABLE",t))(He||{});async function _e(t,e,r){if(typeof crypto.subtle.digest!="function")return d.log(d.Level.Warn,`Insecure context (see https://developer.mozilla.org/en-US/docs/Web/Security/Secure_Contexts): The hash of the Scandit Data Capture library WASM file found at ${r} could not be verified`),"NOT_VERIFIABLE";try{let a=t instanceof Promise?await t:t,i=await crypto.subtle.digest("SHA-256",a),s=Le(i);return e==null?(d.log(d.Level.Warn,"The library hash is not defined or empty, cannot correctly verify integrity."),"NOT_VERIFIABLE"):s===e?(d.log(d.Level.Debug,`Data Capture library WASM integrity found at ${r} has been verified correctly.`),"VALID"):(d.log(d.Level.Warn,`The Scandit Data Capture library WASM file found at ${r} 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(a){return d.log(d.Level.Warn,"Wasm response could not be verified",a),"NOT_VERIFIABLE"}}var X=new Map([["br",4.4],["gzip",2.9],["none",1]]);function ze(t){var e;let r="content-encoding";if(t==null||t.get(r)==null)return X.get("none");let a=new Set(((e=t.get(r))!=null?e:"").split(",").map(i=>i.trim()));for(let[i,s]of X)if(a.has(i))return s;return X.get("none")}function Ve(t){var e,r;if(t==null)return 0;let a=(e=ze(t))!=null?e:1,i=Number.parseInt((r=t.get("content-length"))!=null?r:"0",10);return Number.isNaN(i)?0:Math.floor(i*a*100)/100}function Je(t){let{pathname:e}=new URL(t);for(let[r,a]of Object.entries(ce))if(e.endsWith(r))return a.bytes;return 0}function le(t){ce=t}var Ue=(t,e)=>{let r=Ve(e);return r===0?Je(t):r};function $e(t,e,r,{onProgress:a,onError:i,onComplete:s}){if(!e.body)return[e];let o=Ue(t,e.headers),n=0,c=0;if(typeof TransformStream>"u")return d.warn("TransformStream is not supported in this environment. Progress tracking will be disabled."),[e];let[l,h]=r?e.body.tee():[e.body],m=l.pipeThrough(new TransformStream({async transform(g,f){try{n+=g.length,c=Number((n/o*100).toFixed(2)),o>0&&g.length>0&&c<100?a==null||a({percentage:c,loadedBytes:n,privateUri:t}):o===0&&g.length>0&&(a==null||a({percentage:null,loadedBytes:n,privateUri:t})),f.enqueue(g)}catch(b){f.error(b),i==null||i({error:b})}},flush(g){a==null||a({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 K({wasmURI:t,expectedHash:e,verifyResponseHash:r,onProgress:a,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[c,l]=$e(t,n,r,{onProgress:a,onError:s,onComplete:i});return l!=null&&_e(Ne(l),e,t),c}function ue({wasmURI:t,expectedHash:e,verifyResponseHash:r,progressCallback:a,successCallback:i,errorCallback:s,importObject:o,referredOrigin:n}){async function c(h){try{let m=await K({wasmURI:t,expectedHash:e,verifyResponseHash:r,onProgress:a,referredOrigin:n}),g=await(h!=null?h:m).arrayBuffer(),f=await self.WebAssembly.instantiate(g,o);i(f.instance,f.module)}catch(m){d.log(d.Level.Error,m),d.log(d.Level.Error,`Couldn\'t instantiate Scandit SDK DataCapture library at ${t}, did you configure the path for it correctly?`),s==null||s(m)}}async function l(){let h;try{h=await K({wasmURI:t,expectedHash:e,verifyResponseHash:r,onProgress:a,referredOrigin:n});let m=await self.WebAssembly.instantiateStreaming(h,o);i(m.instance,m.module)}catch(m){d.log(d.Level.Warn,m),d.log(d.Level.Warn,"WebAssembly streaming compile failed. Falling back to ArrayBuffer instantiation (this will make things slower)"),c((h==null?void 0:h.bodyUsed)===!0?void 0:h)}}typeof self.WebAssembly.instantiateStreaming=="function"?l():c()}async function Z(t,e,r,a){return new Promise((i,s)=>{t().then(i).catch(o=>{let n=e*2;if(n>r){s(o);return}a(o),self.setTimeout(()=>{Z(t,n,r,a).then(i).catch(s)},e)})})}function Q(t){var e,r;let a="unknown";if((e=t.href)!=null&&e.startsWith("blob:null/"))a="localhost";else{let i=((r=t.pathname)==null?void 0:r.length)>1&&!t.pathname.startsWith("/");a=new URL(i?t.pathname:t.origin).hostname}return a.startsWith("[")&&a.endsWith("]")?(a=a.slice(1,-1),a):(/^(\\d{1,3}\\.){3}\\d{1,3}$/.test(a)&&(a=a.split(".").map(i=>Number.parseInt(i,10).toString()).join(".")),a)}async function pe(t,e){async function r(){return importScripts(t)}try{await Z(r,250,4e3,i=>{d.log(d.Level.Warn,i),d.log(d.Level.Warn,`Couldn\'t retrieve Scandit Data Capture library at ${t}, retrying...`)}),self.Module.mainScriptUrlOrBlob=t;let a=self.SDC_WASM_JS_VERSION;return a!==e&&d.log(d.Level.Warn,`The Scandit Data Capture library JS file found at ${t} seems invalid: expected version doesn\'t match (received: ${a}, expected: ${e}). Please ensure the correct Scandit Data Capture file (with correct version) is retrieved.`),!0}catch(a){return d.log(d.Level.Error,a),!1}}var he=class{constructor(t){this.viewInfo=null,this.viewInfo=this.cloneViewInfo(t)}isSame(t){return this.viewInfo==null&&t==null?!0:this.viewInfo==null&&t!=null||this.viewInfo!=null&&t==null?!1:this.viewInfo.width===t.width&&this.viewInfo.height===t.height&&this.viewInfo.orientation===t.orientation&&this.viewInfo.viewFinderRect.origin.x===t.viewFinderRect.origin.x&&this.viewInfo.viewFinderRect.origin.y===t.viewFinderRect.origin.y&&this.viewInfo.viewFinderRect.size.width===t.viewFinderRect.size.width&&this.viewInfo.viewFinderRect.size.height===t.viewFinderRect.size.height}update(t){this.viewInfo=this.cloneViewInfo(t)}cloneViewInfo(t){return t?{...t,viewFinderRect:{origin:{...t.viewFinderRect.origin},size:{...t.viewFinderRect.size}}}:null}};var T=class{constructor(){this.promise=new Promise((t,e)=>{this.reject=e,this.resolve=t})}};var ee=class{constructor(t,e){this.workerFunctions=t,this.options=e,this.imageIdCounter=0,this.conversions=new Map}convertToJpeg(t,e){let r=this.imageIdCounter++,a=new T;this.conversions.set(r,a);let i=t.toBitmap();return this.workerFunctions.postMessage({type:"convertToJPEG",imageId:r,width:t.getWidth(),height:t.getHeight(),data:i,planes:t.getPlanes(),orientation:e,quality:this.options.quality},Array.from(new Set([i.buffer]))),a.promise}convertToBitmap(t){return{data:t.toBitmap(),byteOrder:1}}onConvertToJPEGResult(t,e){let r=this.conversions.get(t);r?(r.resolve(e),this.conversions.delete(t)):d.warn(`ImageConverterForwarder: Conversion for imageId ${t} not found in Map`)}};var O=class{constructor(t){this.options=t}get quality(){return this.options.quality}async convertToJpeg(t,e){try{let{width:r,height:a,planes:i}=this.validateAndExtractImageData(t);this.prepareCanvas(r,a);let s=this.processImageData(t,i,r,a);return await this.convertToJpegBytes(s,e)}catch(r){throw d.warn(`Failed to convert image to JPEG: ${r}`),r instanceof Error?r:new Error("Failed to convert image to JPEG")}}convertToBitmap(t){return{data:t.toBitmap(),byteOrder:1}}validateAndExtractImageData(t){let e=t.getWidth(),r=t.getHeight(),a=t.getPlanes();if(e<=0||r<=0)throw d.warn(`Invalid image dimensions: ${e}x${r}`),new Error(`Invalid image dimensions: ${e}x${r}`);if(!a||a.length===0)throw d.warn("ImageBuffer has no planes"),new Error("ImageBuffer has no planes");return{width:e,height:r,planes:a}}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,r,a){let i=this.createImageDataFromBuffer(t,e,r,a);if(i===null)throw new Error("Failed to create ImageData");return this.validateImageData(i,r,a),i}validateImageData(t,e,r){var a;if(t.width!==e||t.height!==r)throw d.warn(`ImageData dimensions mismatch: expected ${e}x${r}, got ${t.width}x${t.height}`),new Error("ImageData dimensions mismatch");if(!t.data||t.data.length!==e*r*4)throw d.warn(`ImageData has invalid data length: expected ${e*r*4}, got ${((a=t.data)==null?void 0:a.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 d.warn(`Failed to put image data on canvas: ${s}`),new Error(`Failed to put image data on canvas: ${s}`)}let r=e!==0?this.applyRotation(this.canvas,e):this.canvas,a;try{a=await this.canvasToBlob(r)}catch(s){throw d.warn(`Failed to convert canvas to blob: ${s}`),new Error(`Failed to convert canvas to blob: ${s}`)}if(!a||a.size===0)throw d.warn("Canvas convertToBlob returned empty or null blob"),new Error("Failed to create JPEG blob");let i;try{i=await a.arrayBuffer()}catch(s){throw d.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 d.warn("Blob arrayBuffer returned empty or null buffer"),new Error("Failed to get array buffer from blob");return new Uint8Array(i)}ensureCanvas(t,e){try{return(!this.canvas||this.canvas.width!==t||this.canvas.height!==e)&&(this.canvas=this.getNewCanvas(t,e),this.context=this.canvas.getContext("2d")),this.context!==null}catch(r){return d.warn("Failed to create HTMLCanvasElement",r),!1}}createImageDataFromBuffer(t,e,r,a){let i=new Set(e.map(s=>s.channel));try{if(this.isYUVFormat(i)){let n=t.toBitmap();return!n||n.length!==r*a*4?(d.warn(`Invalid bitmap data from toBitmap(): expected ${r*a*4} bytes, got ${(n==null?void 0:n.length)||0}`),null):new ImageData(new Uint8ClampedArray(n),r,a)}if(this.isRGBAFormat(i))return this.createImageDataFromRGBAPlanes(e,r,a);if(this.isRGBFormat(i))return this.createImageDataFromRGBPlanes(e,r,a);if(this.isGrayscaleFormat(i))return this.createImageDataFromGrayscalePlanes(e,r,a);d.warn(`Unknown image format with channels: ${Array.from(i).join(", ")}, falling back to toBitmap()`);let s=t.toBitmap();if(!s||s.length===0)return d.warn("toBitmap() returned empty or null data"),null;let o=s.length/(r*a);return o===4?new ImageData(new Uint8ClampedArray(s),r,a):(d.warn(`Unsupported format: ${o} bytes per pixel`),null)}catch(s){return d.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,r){let a=t.find(c=>c.channel===3),i=t.find(c=>c.channel===4),s=t.find(c=>c.channel===5),o=t.find(c=>c.channel===6);if(!a||!i||!s||!o)return d.warn("Missing RGBA planes"),null;let n=new Uint8ClampedArray(e*r*4);for(let c=0;c<r;c++)for(let l=0;l<e;l++){let h=(c*e+l)*4;n[h]=this.getPixelFromPlane(a,l,c),n[h+1]=this.getPixelFromPlane(i,l,c),n[h+2]=this.getPixelFromPlane(s,l,c),n[h+3]=this.getPixelFromPlane(o,l,c)}return new ImageData(n,e,r)}createImageDataFromRGBPlanes(t,e,r){let a=t.find(n=>n.channel===3),i=t.find(n=>n.channel===4),s=t.find(n=>n.channel===5);if(!a||!i||!s)return d.warn("Missing RGB planes"),null;let o=new Uint8ClampedArray(e*r*4);for(let n=0;n<r;n++)for(let c=0;c<e;c++){let l=(n*e+c)*4;o[l]=this.getPixelFromPlane(a,c,n),o[l+1]=this.getPixelFromPlane(i,c,n),o[l+2]=this.getPixelFromPlane(s,c,n),o[l+3]=255}return new ImageData(o,e,r)}createImageDataFromGrayscalePlanes(t,e,r){let a=t.find(s=>s.channel===0);if(!a)return d.warn("Missing Y plane for grayscale"),null;let i=new Uint8ClampedArray(e*r*4);for(let s=0;s<r;s++)for(let o=0;o<e;o++){let n=(s*e+o)*4,c=this.getPixelFromPlane(a,o,s);i[n]=c,i[n+1]=c,i[n+2]=c,i[n+3]=255}return new ImageData(i,e,r)}getPixelFromPlane(t,e,r){let a=Math.floor(e/(t.subsamplingX||1)),i=Math.floor(r/(t.subsamplingY||1)),s=t.rowStride,o=t.pixelStride,n=i*s+a*o,c=t.data;return n<c.length?c[n]:0}applyRotation(t,e){let r=e*Math.PI/180,a=e===90||e===270||e===-90||e===-270,i=a?t.height:t.width,s=a?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(r),n.translate(-t.width/2,-t.height/2),n.drawImage(t,0,0),o}};O.JPEG_IMAGE_MIME_TYPE="image/jpeg";var me=class extends O{getNewCanvas(t,e){return new OffscreenCanvas(t,e)}canvasToBlob(t){return t.convertToBlob({type:O.JPEG_IMAGE_MIME_TYPE,quality:this.options.quality})}};var R;(t=>{function e(){return"8.2.1"}t.sdkVersion=e})(R||(R={}));function Ge(t){return/^https?:\\/\\/(?:[^./]*\\.)*cdn.jsdelivr.net\\//.test(t)?{result:!0,cdnBaseURL:"https://cdn.jsdelivr.net/npm/"}:/^https?:\\/\\/(?:[^./]*\\.)*unpkg.com\\//.test(t)?{result:!0,cdnBaseURL:"https://unpkg.com/"}:{result:!1,cdnBaseURL:""}}function je(t){let e=/@scandit\\/web-datacapture-[a-z]+/i.exec(t);return e?e[0]:null}function ge(t,e,r){let a=e,i=Ge(a);if(i.result){let o=je(a);o!=null&&(a=`${i.cdnBaseURL}${o}@${t}/sdc-lib/`)}let s=r.replace(".wasm","");return i.result?{jsURI:`${a}${s}.js`,wasmURI:`${a}${s}.wasm`}:{jsURI:`${a}${s}.js?v=${t}`,wasmURI:`${a}${s}.wasm?v=${t}`}}var fe=class be{constructor(e,r){this.hintPresenterV2=null,this.MAX_NUMBER_OF_IMAGES_IN_FRAME_DATA_POOL=5,this.redrawInterval=1e3/30,this.redrawRequests=[],this._isDrawLoopRunning=!1,this.frameDataPool=new Map,this.lastFrameColorType="RGBA",this.lastFrameId=null,this.poorMansBenchmarkLogs=!1,this.writableDataPathStandard="/scandit_sync_folder",this.resourceFilesSubfolder="resources",this.performanceMetricsReporterTimer=void 0,this.lastMetricsReportTime=0,this.metricsReportInterval=1e3,this.performanceMetrics={frameDataPoolSize:0,cameraOutputFrames:0,redrawRequestsCount:0,actualRedrawsCount:0,frameProcessingStartedCount:0,frameProcessedCount:0,frameSkippedCount:0},this.frameProcessingStartedCount=0,this.frameProcessingFinishedCount=0,this.gestureListener=null,this.webPlatformHintPresenter=null,this.lastViewInfo=new he(null),this.lastFrameProcessingStartedCount=0,this.lastFrameProcessingFinishedCount=0,this.moduleHandler=e,this.workerFunctions=r,this._loadProgressCallback=this._loadProgressCallback.bind(this),le(this.getWasmMetadata())}get Module(){return this.moduleHandler.get()}set isDrawLoopRunning(e){this._isDrawLoopRunning=e,!e&&typeof this.loopTimeoutId=="number"&&(clearTimeout(this.loopTimeoutId),this.loopTimeoutId=void 0)}get isDrawLoopRunning(){return this._isDrawLoopRunning}prepareFrameForListener(e){let r=this.lastFrameId;if(this.frameDataPool.size>=this.MAX_NUMBER_OF_IMAGES_IN_FRAME_DATA_POOL){let o=this.frameDataPool.keys().next().value;o!=null&&this.frameDataPool.delete(o)}let a=e.getFrameData(),i=new Uint8ClampedArray(a);this.frameDataPool.set(r,{data:i,colorType:this.lastFrameColorType,frameId:r,width:e.getWidth(),height:e.getHeight()});let s=this.lastUsedModuleMirrorAxis==null?!1:this.lastUsedModuleMirrorAxis!==this.Module.Axis.None;return{frameId:r,width:e.getWidth(),height:e.getHeight(),isFrameSourceMirrored:s,colorType:this.lastFrameColorType}}createContext(e){var r,a,i,s,o;let n=this.getModeDeserializers(),c=Q(location);(c==="localhost"||c==="127.0.0.1")&&navigator.userAgent.includes("Electron")&&e.appName!=null&&(c+=`-${e.appName}`),this.parentDomain=e.parentDomain,this.contextDeserializer=new this.Module.DataCaptureContextDeserializer(this.writableDataPath,e.deviceId,e.context.deviceModelName,c,this.parentDomain,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,y)=>{this.contextDidChangeStatus(JSON.parse(y.toJson())),p.delete()},didStartObservingContext:p=>{this.didStartObservingContext(),p.delete()},didStopObservingContext:p=>{p.delete()}}),g=this.Module.DataCaptureContextFrameListener.extend("DataCaptureContextFrameListener",{onObservationStarted:p=>{p.delete()},onObservationStopped:p=>{p.delete()},onFrameProcessingStarted:(p,y)=>{this.workerFunctions.postMessage({type:"onFrameProcessingStarted"}),y.delete(),p.delete()},onFrameProcessingFinished:(p,y)=>{this.workerFunctions.postMessage({type:"onFrameProcessingFinished"}),y.delete(),p.delete()},onFrameSkipped:(p,y)=>{this.workerFunctions.postMessage({type:"onFrameSkipped"}),y.delete(),p.delete()}}),f=this.Module.GestureRecognizer.extend("GestureRecognizer",{setGestureListener:(p,y)=>{var F;(F=this.gestureListener)==null||F.delete(),this.gestureListener=p.clone(),p.delete()}});(r=this.gestureRecognizer)==null||r.delete(),this.gestureRecognizer=new f;let b=new m;this.context.addListener(b),b.delete();let P=new g;this.context.addFrameListener(P),P.delete(),this.setView(h),(a=this.view)==null||a.setGestureRecognizer(this.gestureRecognizer);let M=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 M,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,r){this.webImageConverterInstance instanceof ee&&this.webImageConverterInstance.onConvertToJPEGResult(e,r)}getImageConverterInstance(e){return this.workerFunctions.getOffscreenCanvas()!=null?new me(e):new ee(this.workerFunctions,e)}onTap(e){var r;(r=this.gestureListener)==null||r.onTap(JSON.stringify(e))}hintPresenterV2Update(){var e;(e=this.hintPresenterV2)==null||e.update()}startReportingPerformanceMetrics(){this.performanceMetricsReporterTimer==null&&(this.lastMetricsReportTime=performance.now(),this.scheduleMetricsReporting())}scheduleMetricsReporting(){this.performanceMetricsReporterTimer=setTimeout(()=>{this.checkAndReportMetrics()},100)}checkAndReportMetrics(){let e=performance.now();e-this.lastMetricsReportTime>=this.metricsReportInterval&&(this.reportPerformanceMetrics(),this.performanceMetrics.cameraOutputFrames=0,this.performanceMetrics.redrawRequestsCount=0,this.performanceMetrics.actualRedrawsCount=0,this.lastMetricsReportTime=e),this._isDrawLoopRunning&&this.scheduleMetricsReporting()}async reportPerformanceMetrics(){let e=this.frameProcessingStartedCount-this.lastFrameProcessingStartedCount,r=this.frameProcessingFinishedCount-this.lastFrameProcessingFinishedCount;this.lastFrameProcessingStartedCount=this.frameProcessingStartedCount,this.lastFrameProcessingFinishedCount=this.frameProcessingFinishedCount;let a={cameraOutputFrames:this.performanceMetrics.cameraOutputFrames,redrawRequestsCount:this.performanceMetrics.redrawRequestsCount,actualRedrawsCount:this.performanceMetrics.actualRedrawsCount,frameDataPoolSize:this.performanceMetrics.frameDataPoolSize,frameProcessingStartedCount:e,frameProcessedCount:r,frameSkippedCount:this.performanceMetrics.frameSkippedCount};this.workerFunctions.postMessage({type:"performanceMetricsReport",payload:a})}deleteFrameData(e){this.frameDataPool.delete(e)}dispose(){var e,r,a,i;this.context.dispose(),this.frameDataPool.clear(),this.isDrawLoopRunning=!1,this.cleanupMetricsReporting(),(e=this.gestureRecognizer)==null||e.delete(),this.gestureRecognizer=null,(r=this.gestureListener)==null||r.delete(),this.gestureListener=null,(a=this.hintPresenterV2)==null||a.delete(),this.hintPresenterV2=null,(i=this.webPlatformHintPresenter)==null||i.delete(),this.webPlatformHintPresenter=null}cleanupMetricsReporting(){this.performanceMetricsReporterTimer!=null&&(typeof this.performanceMetricsReporterTimer=="number"?cancelAnimationFrame(this.performanceMetricsReporterTimer):clearTimeout(this.performanceMetricsReporterTimer),this.performanceMetricsReporterTimer=void 0)}flushAnalytics(){this.context.flushAnalytics()}extractCentaurusLicense(e){return{payload:{centaurus:{licenseKey:this.Module.LicenseUtils[be.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 r;if(this.context==null)return d.debug("[processFrame] Context is null, returning frame without processing"),{payload:e,transferables:[e.data.buffer]};this.lastFrameId=e.frameId;let a=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(a.byteLength);return this.Module.HEAPU8.set(a,s),(r=this.imageFrameSource)==null||r.outputFrame(s,e.width,e.height,i),{payload:e,transferables:[e.data.buffer]}}reportCameraProperties(e){this.context.setCameraProperties(e.deviceId,e.isFrontFacing,e.hasAutofocus)}requestFrameData(e){let r=this.frameDataPool.get(e);if(r==null)return{payload:{data:null,frameId:null,colorType:null}};if(r.data.buffer.byteLength===0)return this.frameDataPool.delete(e),{payload:{data:null,frameId:null,colorType:null}};let a=r.data;r.colorType==="GRAYSCALE"&&(a=ie(r.data,r.width,r.height));let i={payload:{data:a,frameId:r.frameId,colorType:r.colorType},transferables:[a.buffer]};return this.frameDataPool.delete(e),i}scheduleRedraw(e,r){this.addRedrawRequest(r),this.isDrawLoopRunning||this.startDrawLoop(e)}sendViewRefreshCommands(e){this.workerFunctions.postMessage({type:"draw",payload:e},[e.buffer])}setFrameSource(e,r){var a;this.lastUsedModuleMirrorAxis=this.mapMirrorAxisOnModule(e),(a=this.imageFrameSource)==null||a.delete(),this.imageFrameSource=new this.Module.ImageBufferFrameSource(this.lastUsedModuleMirrorAxis,r,0),this.context.setFrameSource(this.imageFrameSource)}startDrawLoop(e){this.isDrawLoopRunning=!0;let r=s=>this.redrawRequests.length>0&&this.redrawRequests[0]<=s,a=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(r(s)){a(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 r=this.onBeforeUpdateContextHook(e),a=this.contextDeserializer.updateContextFromJson(this.context,this.view,JSON.stringify(r.context));if(a==null){let s=this.contextDeserializer.getLastError();throw new Error(`Could not update the context: ${s}`)}this.context.delete(),this.context=a.getContext();let i=a.getView();a.delete(),i!=null&&r.view!=null&&(i.setViewSize(r.view.width,r.view.height,r.view.orientation),i.draw()),!this.hintPresenterV2&&this.webPlatformHintPresenter&&(this.hintPresenterV2=new this.Module.HintPresenterV2(this.webPlatformHintPresenter)),i!=null&&this.hintPresenterV2&&i.setHintPresenterV2(this.hintPresenterV2),this.gestureRecognizer!=null&&(i==null||i.setGestureRecognizer(this.gestureRecognizer)),this.setView(i),this.notifyMainThreadOnViewInfoChanged(i),d.debug("context updated",r)}}notifyMainThreadOnViewInfoChanged(e){let r=this.getViewInfo(e);this.lastViewInfo.isSame(r)||(this.lastViewInfo.update(r),this.workerFunctions.postMessage({type:"viewSizeChanged",payload:r}))}getViewInfo(e){if(e!=null)try{let r=JSON.parse(e.getViewInfo());if(r!=null){let a=this.getOrientationFromNumber(r.orientation);return{...r,orientation:a}}}catch(r){d.error("Failed to get view size",r)}return null}getOrientationFromNumber(e){switch(e){case 90:return"landscapeRight";case 180:return"portraitUpsideDown";case 270:return"landscapeLeft";default:return"portrait"}}onBeforeUpdateContextHook(e){return e}onDocumentVisibilityChange(e){e==="hidden"&&this.context.flushAnalytics()}isFeatureSupported(e){return{payload:{supported:this.context.isFeatureSupported(e)}}}getViewfinderInfo(){var e,r;return{payload:{isDisplayingViewfinder:(r=(e=this.view)==null?void 0:e.isDisplayingViewfinder())!=null?r:!1,rect:JSON.parse(this.view.getViewfinderRect())}}}getOpenSourceSoftwareLicenseInfo(){return{payload:{licenseText:this.Module.OpenSourceSoftwareLicenseInfo.getLicenseText()}}}getWasmDynamicLibraries(e){return this.getWasmSideModuleFileName()==null?[]:[`${e.replace(/\\/[^/]*$/,"/")}${this.getWasmSideModuleFileName()}`]}getWasmCoreExpectedHash(e,r){return r?e?"44eadcb5e36da3e39236c267d022d41b21155b628056947f2efd7b89ce2d3d4c":"a9ec86f920e77189b02053f014e21e3547323b1351599a6bdf8ac3acfc8fd9e3":e?"4226e9075d67fb4f8194a6296637f1ca8701d33a33990b54036df465ad172257":""}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":""}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((r,a)=>r-a)}contextDidChangeStatus(e){e.code===260?e.message=e.message.replace("domain name",`domain name (${Q(location)})`):e.code===265&&(e.message=e.message.replace("domain name",`domain name (${this.parentDomain})`)),this.workerFunctions.postMessage({type:"contextDidChangeStatus",payload:e})}didStartObservingContext(){this.workerFunctions.postMessage({type:"didStartObservingContext"})}mapMirrorAxisOnModule(e){switch(e){case"None":return this.Module.Axis.None;case"X":return this.Module.Axis.X;case"Y":return this.Module.Axis.Y;default:return this.Module.Axis.None}}setView(e){this.view=e,this.setViewRefreshHandler(e),e==null&&(this.isDrawLoopRunning=!1,this.sendViewRefreshCommands(new Uint8Array([])))}addNativeOverlay(e){d.warn("addNativeOverlay has not been implemented for this module",e)}removeNativeOverlay(e){d.warn("removeNativeOverlay has not been implemented for this module",e)}setViewRefreshHandler(e){if(e==null||e.isViewRefreshHandlerSet)return;let r=this.Module.NeedsRedrawDelegate.extend("NeedsRedrawDelegate",{setNeedsRedrawIn:this.scheduleRedraw.bind(this,e)}),a=new r;e.setNeedsRedrawDelegate(a),e.isViewRefreshHandlerSet=!0}setupDataDecoding(){let e=this.moduleHandler.get(),r=e.DataDecoding.extend("DataDecoding",{decode(a,i){try{let s=JSON.parse(i),o=[];for(let n of s){let c=new TextDecoder(n.ianaName,{fatal:!0});o.push(c.decode(a.slice(n.startIndex,n.endIndex)))}return o.join("")}catch{return""}}});e.setDataDecoding(new r)}start(e,r,a){e&&r&&(this.setupDataDecoding(),this.moduleHandler.get().callMain(),this.moduleHandler.get().__emscripten_proxy_main!==void 0||a())}getWritableDataPath(e){return e!=null?(d.debug(`IndexedDB database name override in use to recover from blocked standard database: ${e}`),e):this.writableDataPathStandard}numOfMBToPages(e){return Math.ceil(1024*e*1024/64/1024)}async setup({libraryLocation:e,locationPath:r,writableDataPathOverride:a,indexedDBTimeoutMs:i,verifyResponseHash:s,referredOrigin:o,fixedWasmMemory:n,simdSupport:c,threadsSupport:l}){var h;let m=!1,g=!1;this.writableDataPath=this.getWritableDataPath(a),this.resourcePath=`${e}${this.resourceFilesSubfolder}/`,self.path=r;let{resolve:f,reject:b,promise:P}=new T,M=R.sdkVersion();if(M==="")throw new x({name:"Invalid library version",message:"Library version is not defined or empty, cannot generate proper path to library files."});let p=this.getWasmCoreFileName(c,l),y=ge(M,e,p),{jsURI:F,wasmURI:re}=y,xe={instantiateWasm:(S,Ae)=>(ue({importObject:S,wasmURI:re,expectedHash:this.getWasmCoreExpectedHash(c,l),verifyResponseHash:s,successCallback:Ae,progressCallback:this._loadProgressCallback,errorCallback:Te=>{b(Te)},referredOrigin:o}),{})},B=n===null?null:new WebAssembly.Memory({initial:this.numOfMBToPages(n),maximum:this.numOfMBToPages(300),shared:l});return B!==null&&d.log(d.Level.Debug,"Fixed wasmMemory set",B),this.moduleHandler.set({...B?{wasmMemory:B}:{},mainScriptUrlOrBlob:F,canvas:(h=this.workerFunctions.getOffscreenCanvas())!=null?h:{getContext:()=>null},...xe,dynamicLibraries:this.getWasmDynamicLibraries(re),locateFile:S=>e+S,noInitialRun:!0,preRun:[async()=>{try{await de({writableDataPath:this.writableDataPath,indexedDBTimeoutMs:i})}catch(S){if(S.name==="BlockedIndexedDB"){b(S.toString());return}d.log(d.Level.Debug,"No IndexedDB support, some data will not be persisted:",S)}g=!0,this.start(g,m,f)}],onMainComplete:()=>{if([m,g].includes(!1)){d.log(d.Level.Warn,{runtimeLoaded:m,fileSystemSynced:g},"Both runtimeLoaded and fileSystemSynced should be true when calling onMainComplete"),b("onMainComplete has been called but runtime or file system was not ready.");return}f()},onRuntimeInitialized:()=>{m=!0,this.start(g,m,f)},print:S=>{d.info(S)}}),await pe(F,M)||b(`Couldn\'t retrieve Scandit Data Capture library at ${F}, did you configure the path for it correctly?`),P}};fe.get3dPartyLicenseKeyMethodName=atob("Z2V0QmxpbmtJZExpY2Vuc2VLZXk=");var I=fe;function ye(t){return typeof t=="object"&&t!=null&&t.document==null&&"addEventListener"in t&&typeof t.importScripts=="function"}function Se(t){console.warn("Reached unexpected case",t)}var te=class{constructor(t,e){this.onMessageListener=this.onMessage.bind(this),this.workerSelf=t,this.dataCaptureInstance=new I(e,{postMessage:this.postMessage.bind(this),getOffscreenCanvas:this.getOffscreenCanvas.bind(this)}),ye(t)&&(ae(t),this.listenToMessages())}listenToMessages(){this.workerSelf.addEventListener("message",this.onMessageListener),this.workerSelf.addEventListener("error",t=>{d.log(d.Level.Error,t)}),this.workerSelf.addEventListener("messageerror",t=>{d.log(d.Level.Error,t)})}postMessage(t,e){this.workerSelf.postMessage(t,e!=null?e:[])}getOffscreenCanvas(){if(this.isOffscreenCanvasSupported())return new this.workerSelf.OffscreenCanvas(32,32)}isOffscreenCanvasSupported(){return typeof this.workerSelf.OffscreenCanvas=="function"}hasPayload(t){return C(t)&&"payload"in t}hasTransferables(t){return C(t)&&Array.isArray(t.transferables)}async respondWith(t,e,r){let a=null,i;try{i=r(),i instanceof Promise&&(i=await i)}catch(o){i=void 0,a=k(o)}let s={type:"workerTaskId",command:t,id:e,payload:this.hasPayload(i)?i.payload:void 0};a!=null&&(s.error=a),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,indexedDBTimeoutMs:e.indexedDBTimeoutMs}))}break}case"onTap":{{let{data:e}=t;this.respondWith(e.command,e.id,async()=>{this.dataCaptureInstance.onTap(e.point)})}break}case"hintPresenterV2update":{{let{data:e}=t;this.respondWith(e.command,e.id,async()=>{this.dataCaptureInstance.hintPresenterV2Update()})}break}case"createContext":{{let{data:e}=t;this.respondWith(e.command,e.id,()=>this.dataCaptureInstance.createContext({context:e.context,deviceId:e.deviceId,delayedRegistration:e.delayedRegistration,highEndBlurryRecognition:e.highEndBlurryRecognition,appName:e.appName,parentDomain:e.parentDomain}))}break}case"setFrameSource":{{let{data:e}=t;this.respondWith(e.command,e.id,()=>this.dataCaptureInstance.setFrameSource(e.mirrorAxis,e.isCameraFrameSource))}break}case"processFrame":{{let{data:e}=t;this.respondWith(e.command,e.id,()=>this.dataCaptureInstance.processFrame({data:e.data,frameId:e.frameId,width:e.width,height:e.height,colorType:e.colorType}))}break}case"requestFrameData":{{let{data:e}=t;this.respondWith(e.command,e.id,()=>this.dataCaptureInstance.requestFrameData(e.frameId))}break}case"deleteFrameData":{{let{data:e}=t;this.respondWith(e.command,e.id,()=>{this.dataCaptureInstance.deleteFrameData(e.frameId)})}break}case"updateContext":{{let{data:e}=t;this.respondWith(e.command,e.id,async()=>this.dataCaptureInstance.updateContext(e))}break}case"dispose":{this.respondWith(t.data.command,t.data.id,()=>this.dataCaptureInstance.dispose());break}case"flushAnalytics":{this.respondWith(t.data.command,t.data.id,()=>{this.dataCaptureInstance.flushAnalytics()});break}case"reportCameraProperties":{{let{data:e}=t;this.respondWith(e.command,e.id,async()=>this.dataCaptureInstance.reportCameraProperties(e))}break}case"setLogLevel":{{let{data:e}=t;this.respondWith(e.command,e.id,()=>{d.setLevel(e.level)})}break}case"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 Se(t.data),!1}return!0}};var we=(t=>(t.Body="body",t.Footnote="footnote",t))(we||{}),E=(t=>(t.Start="start",t.Center="center",t.End="end",t))(E||{}),ve=(t=>(t.Normal="normal",t.Wider="wider",t.FitText="fitText",t))(ve||{}),Fe=(t=>(t.Normal="normal",t.Taller="taller",t))(Fe||{}),Me=(t=>(t.Square="square",t.Rounded="rounded",t))(Me||{}),L=(t=>(t.None="none",t.Check="check",t.ExclamationMark="exclamationMark",t))(L||{}),W=(t=>(t.Top="top",t.Center="center",t.AboveViewFinder="aboveViewFinder",t.BelowViewFinder="belowViewFinder",t))(W||{}),Ce=(t=>(t.AboveViewFinder="aboveViewFinder",t.BelowViewFinder="belowViewFinder",t))(Ce||{}),ke=(t=>(t.BlackOnWhite="blackOnWhite",t.WhiteOnBlack="whiteOnBlack",t.Transparent="transparent",t))(ke||{}),De=(t=>(t.Success="success",t.Error="error",t.Warning="warning",t.Info="info",t.Notification="notification",t))(De||{}),Ie=(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))(Ie||{});var N=class{constructor(e,r,a){this.barcodeAr=null;this.coreEngine=e,this.Module=r,this.workerFunctions=a}async forSettings(e){var a;(a=this.barcodeAr)==null||a.delete(),this.barcodeAr=new this.Module.BarcodeAr(this.coreEngine.context,JSON.stringify(e));let r=this.Module.BarcodeArListener.extend("BarcodeArListener",{didUpdateSession:(i,s,o)=>{let n=this.coreEngine.prepareFrameForListener(o);this.workerFunctions.postMessage({type:"barcodeArDidUpdateSession",payload:{session:JSON.parse(s.toJson()),frameData:n}}),i.delete(),s.delete(),o.delete()}});this.barcodeAr.addListener(new r,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 r;(r=this.barcodeAr)==null||r.setEnabled(e)}async removeMode(){this.barcodeAr!=null&&this.Module.removeBarcodeArFromContext(this.coreEngine.context,this.barcodeAr)}applySettings(e){var r;(r=this.barcodeAr)==null||r.applySettings(JSON.stringify(e))}};var H=class{constructor(e,r,a){this.trackingListenerSet=!1;this.coreEngine=e,this.Module=r,this.workerFunctions=a,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:(a,i,s)=>{this.barcodeBatchDidUpdateSession(i),a.delete(),i.delete(),s.delete()},onTrackedBarcodeTapped:(a,i)=>{this.onTrackedBarcodeTapped(i),a.delete(),i.delete()}}),r=this.Module.BarcodeBatchDeserializerListener.extend("BarcodeTrackingDeserializerListener",{onModeDeserializationFinished:(a,i,s)=>{this.trackingListenerSet||(i.addListener(new e,1),this.trackingListenerSet=!0),a.delete(),i.delete(),s.delete()},onModeDeserializationStarted(a,i,s){a.delete(),i.delete(),s.delete()},onSettingsDeserializationStarted(a,i,s){a.delete(),i.delete(),s.delete()},onSettingsDeserializationFinished(a,i,s){a.delete(),i.delete(),s.delete()}});this.barcodeBatchDeserializer=new this.Module.BarcodeBatchDeserializer,this.barcodeBatchDeserializer.setListener(new r)}onTrackedBarcodeTapped(e){this.workerFunctions.postMessage({type:"didTapTrackedBarcode",payload:JSON.parse(e.toJson())})}};var _=class{constructor(e,r,a){this.captureListenerSet=!1;this.coreEngine=e,this.Module=r,this.workerFunctions=a,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,c)=>{this.barcodeCaptureDidScan(n,c),o.delete(),c.delete(),n.delete()},didUpdateSession:(o,n,c)=>{this.barcodeCaptureDidUpdateSession(n),o.delete(),c.delete(),n.delete()}}),r=this.Module.Feedback.extend("Feedback",{emit:()=>{this.successFeedback()}}),a=new e,i=new r,s=this.Module.BarcodeCaptureDeserializerListener.extend("BarcodeCaptureDeserializerListener",{onModeDeserializationFinished:(o,n,c)=>{n.addListener(a,1),n.setSuccessFeedback(i),o.delete(),n.delete(),c.delete()},onModeDeserializationStarted(o,n,c){o.delete(),n.delete(),c.delete()},onSettingsDeserializationStarted(o,n,c){o.delete(),n.delete(),c.delete()},onSettingsDeserializationFinished(o,n,c){o.delete(),n.delete(),c.delete()}});this.barcodeCaptureDeserializer=new this.Module.BarcodeCaptureDeserializer,this.barcodeCaptureDeserializer.setListener(new s)}successFeedback(){this.workerFunctions.postMessage({type:"successFeedback"})}barcodeCaptureDidScan(e,r){let a=this.coreEngine.prepareFrameForListener(r);this.workerFunctions.postMessage({type:"barcodeCaptureDidScan",payload:{session:JSON.parse(e.toJson()),frameData:a}})}};function qe(t){return t.charAt(0).toUpperCase()+t.slice(1)}function Pe(t){return t}var z=class{constructor(e,r,a){this.barcodeFind=null;this.basicOverlay=null;this.transparentGuidanceHintStyle={backgroundColor:"00000000",cornerRadius:4,fitToText:!1,isAnimatedToView:!1,textAlignment:E.Center,hintIcon:L.None,hintAnchor:W.Center,hintAnchorOffset:0,horizontalMargin:0,iconColor:"00000000",lineHeight:-1,maxLines:1,maxWidthFraction:.8,textColor:"ffffffff",textSize:15,textWeight:600};this.customerTransformation=Pe;this.coreEngine=e,this.Module=r,this.workerFunctions=a}async forSettings(e){var o;(o=this.barcodeFind)==null||o.delete(),this.barcodeFind=new this.Module.BarcodeFind(this.coreEngine.context,JSON.stringify(e));let r=this.Module.Feedback.extend("Feedback",{emit:()=>{this.listUpdatedFeedback()}}),a=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,c,l)=>{let h=this.coreEngine.prepareFrameForListener(l);this.workerFunctions.postMessage({type:"barcodeFindDidUpdateSession",payload:{session:JSON.parse(c.toJson()),frameData:h}}),n.delete(),c.delete(),l.delete()},onSearchPaused:n=>{let c=[];for(let l=0;l<n.size();l++)c.push(n.get(l));this.workerFunctions.postMessage({type:"barcodeFindSearchPaused",payload:{foundItems:c}})},onSearchStopped:n=>{let c=[];for(let l=0;l<n.size();l++)c.push(n.get(l));this.workerFunctions.postMessage({type:"barcodeFindSearchStopped",payload:{foundItems:c}})},onSearchStarted:()=>{this.workerFunctions.postMessage({type:"barcodeFindSearchStarted",payload:{}})}});this.barcodeFind.setBarcodeFindTransformer(new i),this.barcodeFind.addListener(new s,1),this.barcodeFind.setItemListUpdatedFeedback(new r),this.barcodeFind.setFeedback(new a),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 r;(r=this.barcodeFind)==null||r.setEnabled(e)}setItemList(e){var r;(r=this.barcodeFind)==null||r.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 r;(r=this.barcodeFind)==null||r.applySettings(JSON.stringify(e))}updateBasicOverlay(e){let r=Object.entries(e).filter(([a,i])=>a!=="type");for(let[a,i]of r){let s=`set${qe(a)}`;this.basicOverlay!=null&&typeof this.basicOverlay[s]=="function"&&i!=null&&this.basicOverlay[s](i)}}setTransformerFunction(e){this.customerTransformation=e!=null?e:Pe}successFeedback(){this.workerFunctions.postMessage({type:"successFeedback"})}listUpdatedFeedback(){this.workerFunctions.postMessage({type:"barcodeFindListUpdatedFeedback",payload:{}})}setToast(e,r){let a=this.coreEngine.hintPresenterV2;e?a==null||a.showToast(JSON.stringify(r)):a==null||a.hideToast(r.tag)}setGuidance(e,r,a){let i={tag:a,text:r,hintStyle:this.transparentGuidanceHintStyle};this.workerFunctions.postMessage({type:e?"showGuidance":"hideGuidance",payload:i})}createWebFindGuidanceHandler(){let e=this.Module.BarcodeFindGuidanceHandler.extend("BarcodeFindGuidanceHandler",{setInitialGuidance:(r,a)=>{this.setGuidance(r,a,"InitialGuidance")},setMoveCloserGuidance:(r,a)=>{this.setGuidance(!1,a,"InitialGuidance"),this.setGuidance(r,a,"MoveCloserGuidance")},setTapShutterToPause:(r,a)=>{this.setGuidance(!1,a,"InitialGuidance"),this.setGuidance(r,a,"TapShutterToPause")},setTapShutterToResume:(r,a)=>{this.setGuidance(!1,a,"InitialGuidance"),this.setGuidance(r,a,"TapShutterResume")}});return new e}};var w=class{constructor(e){this.subscribers=new Set;this.property={key:e,value:null}}addSubscriber(e){var r;this.subscribers.add(e),(r=e.onPropertyChanged)==null||r.call(e,this.property)}removeSubscriber(e){this.subscribers.delete(e)}setProperty(e){var r;if(this.property.value!==e.value){this.property={key:this.property.key,value:e.value};for(let a of this.subscribers)(r=a.onPropertyChanged)==null||r.call(a,this.property)}}};var Ye={torch_state:new w("torch_state"),scanning_mode:new w("scanning_mode"),sound_enabled:new w("sound_enabled"),haptic_enabled:new w("haptic_enabled"),session_stop_reason:new w("session_stop_reason"),camera_position:new w("camera_position")},V=class{getBehaviorSubject(e){return Ye[e]}};var J=class{constructor(e,r,a){this.captureListenerSet=!1;this.propertyPushSource=new V;this.coreEngine=e,this.Module=r,this.workerFunctions=a,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()}}),r=this.Module.Feedback.extend("Feedback",{emit:()=>{this.successFeedback()}}),a=this.Module.SparkScanDeserializerListener.extend("SparkScanDeserializerListener",{onModeDeserializationFinished:(i,s,o)=>{if(!this.captureListenerSet){s.addListener(new e,1),s.setSuccessFeedback(new r),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:()=>{}}),c=new n,l=s.getStateMachine();l.setViewHandlerDelegate(c),c.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 a)}emitErrorFeedback(e){var r;(r=this.sparkScanOverlay)==null||r.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,r;this.captureListenerSet=!1,(e=this.sparkScan)==null||e.delete(),this.sparkScan=void 0,(r=this.sparkScanOverlay)==null||r.delete(),this.sparkScanOverlay=void 0}sparkScanDidScan(e,r){let a=this.coreEngine.prepareFrameForListener(r);this.workerFunctions.postMessage({type:"sparkScanDidScan",payload:{session:JSON.parse(e.toJson()),frameData:a}})}};var U=class extends I{constructor(e,r){super(e,r)}getModeDeserializers(){this.barcodeCaptureMode=new _(this,this.Module,this.workerFunctions),this.barcodeBatchMode=new H(this,this.Module,this.workerFunctions),this.sparkScanMode=new J(this,this.Module,this.workerFunctions),this.barcodeFindMode=new z(this,this.Module,this.workerFunctions),this.barcodeArMode=new N(this,this.Module,this.workerFunctions);let e=super.getModeDeserializers();return e.push_back(this.barcodeCaptureMode.getCaptureDeserializer()),e.push_back(this.barcodeBatchMode.getBatchDeserializer()),e.push_back(this.sparkScanMode.getSparkScanDeserializer()),e}getWasmSideModuleFileName(){return""}getWasmCoreFileName(e,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?"44eadcb5e36da3e39236c267d022d41b21155b628056947f2efd7b89ce2d3d4c":"a9ec86f920e77189b02053f014e21e3547323b1351599a6bdf8ac3acfc8fd9e3":e?"4226e9075d67fb4f8194a6296637f1ca8701d33a33990b54036df465ad172257":"a0808725b47747c68979103ca9850b71ac36621a8438b27987a9816e5ba1058c"}getWasmMetadata(){return u}};function Xe(t){return(r=>/^[$A-Z_a-z][\\w$]*\\s*\\(.*\\)\\s*\\{/.test(r)&&!r.startsWith("function"))(t)?`function ${t}`:t}var Ke=["fetch","XMLHttpRequest","eval","Function","self","globalThis","Module","importScripts","this","console","window","document","import","Worker","ServiceWorker"];function Ze(t){return Ke.map(r=>new RegExp(`\\\\b${r}\\\\b`,"g")).some(r=>r.test(t))}function Be(t){if(t==null)return null;let e=Xe(t);if(Ze(e))throw new Error("Function should be pure. Shouldn\'t introduce side effects, or rely on global scope");let r=`\'use strict\';\n return (${e});`;try{return new Function(r)()}catch{return null}}var $=class extends te{constructor(e,r){super(e,r),this.dataCaptureInstance=new U(r,{postMessage:this.postMessage.bind(this),getOffscreenCanvas:this.getOffscreenCanvas.bind(this)})}async respondWith(e,r,a){let i=null,s;try{s=a(),s instanceof Promise&&(s=await s)}catch(n){s=void 0,i=k(n)}let o={type:"workerTaskId",command:e,id:r,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:r}=e;return this.respondWith(r.command,r.id,()=>{this.dataCaptureInstance.sparkScanMode.emitErrorFeedback(r.shouldRemoveBrush)}),!0}case"sparkScanOverlayReadyForDraw":{let{data:r}=e;return this.respondWith(r.command,r.id,()=>{this.dataCaptureInstance.sparkScanMode.overlayReadyForDraw()}),!0}case"sparkScanAnalyticsManagerPropertyChanged":{let{data:r}=e;return this.respondWith(r.command,r.id,async()=>{this.dataCaptureInstance.sparkScanMode.analyticsManagerPropertyChanged(r.property)}),!0}case"sparkScanSelectItemWithSmartScanSelection":{let{data:r}=e;return this.respondWith(r.command,r.id,async()=>{this.dataCaptureInstance.sparkScanMode.selectItemWithSmartScanSelection()}),!0}case"sparkScanModeRemove":{let{data:r}=e;return this.respondWith(r.command,r.id,async()=>this.dataCaptureInstance.sparkScanMode.removeMode()),!0}case"barcodeFindForSettings":{let{data:r}=e;return this.respondWith(r.command,r.id,async()=>this.dataCaptureInstance.barcodeFindMode.forSettings(r.settings)),!0}case"barcodeFindModeRemove":{let{data:r}=e;return this.respondWith(r.command,r.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:r}=e;return this.respondWith(e.data.command,e.data.id,()=>{this.dataCaptureInstance.barcodeFindMode.setItemList(r.itemList)}),!0}case"barcodeFindSetEnabled":{let{data:r}=e;return this.respondWith(e.data.command,e.data.id,()=>{this.dataCaptureInstance.barcodeFindMode.setEnabled(r.enabled)}),!0}case"barcodeFindApplySettings":{let{data:r}=e;return this.respondWith(r.command,r.id,async()=>this.dataCaptureInstance.barcodeFindMode.applySettings(r.settings)),!0}case"barcodeFindAddBasicOverlay":{let{data:r}=e;return this.respondWith(r.command,r.id,async()=>{this.dataCaptureInstance.barcodeFindMode.addBasicOverlay()}),!0}case"barcodeFindRemoveBasicOverlay":{let{data:r}=e;return this.respondWith(r.command,r.id,async()=>{this.dataCaptureInstance.barcodeFindMode.removeBasicOverlay()}),!0}case"barcodeFindUpdateBasicOverlay":{let{data:r}=e;return this.respondWith(r.command,r.id,async()=>{this.dataCaptureInstance.barcodeFindMode.updateBasicOverlay(r.jsonOverlay)}),!0}case"barcodeFindSetTransformerFunction":{let{data:r}=e;return this.respondWith(r.command,r.id,async()=>{let a=Be(r.functionAsString);this.dataCaptureInstance.barcodeFindMode.setTransformerFunction(a)}),!0}case"barcodeArForSettings":{let{data:r}=e;return this.respondWith(r.command,r.id,async()=>this.dataCaptureInstance.barcodeArMode.forSettings(r.settings)),!0}case"barcodeArModeRemove":{let{data:r}=e;return this.respondWith(r.command,r.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:r}=e;return this.respondWith(e.data.command,e.data.id,()=>{this.dataCaptureInstance.barcodeArMode.setEnabled(r.enabled)}),!0}case"barcodeArApplySettings":{let{data:r}=e;return this.respondWith(r.command,r.id,async()=>{this.dataCaptureInstance.barcodeArMode.applySettings(r.settings)}),!0}default:return super.onMessage(e)}}};var Sa=new $(self,{get:()=>self.Module,set:t=>{self.Module=t}});function wa(t){}})();\n'],{type:"application/javascript"})),e=new Worker(s,r);return URL.revokeObjectURL(s),e}var o=class r extends DataCaptureLoader{constructor(){super(...arguments);this._name="BarcodeCapture";}get dataCaptureWorker(){return (this._dataCaptureWorker)!=null||(this._dataCaptureWorker=n({name:this.name})),this._dataCaptureWorker}get name(){return this._name}static async create(e){var a;let t=new r(e);return await t.workerCommand("setLogLevel",{level:(a=e.logLevel)!=null?a:Logger.Level.Debug}),await t.load(),t}async workerCommand(e,t,a){return new Promise((d,l)=>{let i=this.workerCommandId++;this.workerTasks.set(i,{resolve:d,reject:l,command:e});let c={...t,command:e,id:i};this.dataCaptureWorker.postMessage(c,a);})}};
2
2
  export{o as a};
@@ -1 +1 @@
1
- import {a as a$7}from'./chunk-ZPKXVCG3.js';import {b as b$1}from'./chunk-3N7HH72O.js';import {a as a$6}from'./chunk-TKSABJXC.js';import {a}from'./chunk-HHYYL23G.js';import {b}from'./chunk-5V3FWMGO.js';import {a as a$8}from'./chunk-RZWYP24A.js';import {a as a$9}from'./chunk-PJKEAS4K.js';import {a as a$1}from'./chunk-DDLFCE34.js';import {a as a$3}from'./chunk-2PM6DH45.js';import {a as a$4}from'./chunk-POONUNDO.js';import {b as b$2}from'./chunk-6KDQGEUY.js';import {a as a$5}from'./chunk-DHKABHFE.js';import {a as a$2}from'./chunk-I53W7VSB.js';import {Anchor,Localization,DataCaptureView,Size,Point}from'@scandit/web-datacapture-core';import {ShutterButton}from'@scandit/web-datacapture-core/build/js/private/ui/atoms/ShutterButton.js';import {ScanditHTMLElement}from'@scandit/web-datacapture-core/build/js/private/utils/ScanditHTMLElement.js';import {defineCustomElements}from'@scandit/web-datacapture-core/build/js/private/utils/defineCustomElements.js';import {html}from'@scandit/web-datacapture-core/build/js/private/utils/html.js';import {Card}from'@scandit/web-datacapture-core/build/js/private/ui/atoms/Card.js';import {TorchSwitchIconButton}from'@scandit/web-datacapture-core/build/js/private/ui/molecules/TorchSwitchIconButton.js';var l={FinishButton:a$1.tag,ShutterButton:ShutterButton.tag,ProgressBarWithLabel:a.tag,CardListContainer:b$1.tag,TorchSwitchIconButton:TorchSwitchIconButton.tag},u=class u extends ScanditHTMLElement{constructor(){super(...arguments);this.shouldShowCarousel=true;this.shouldShowPauseButton=true;this.shouldShowFinishButton=true;this.shouldShowProgressBar=true;this.torchControlPosition=Anchor.TopLeft;this.textForItemListUpdatedWhenPausedHint=null;this.textForItemListUpdatedHint=null;this.textForTapShutterToResumeSearchHint=null;this.textForTapShutterToPauseScreenHint=null;this.textForMoveCloserToBarcodesHint=null;this.textForPointAtBarcodesToSearchHint=null;this.textForAllItemsFoundSuccessfullyHint=null;this.textForCollapseCardsButton=Localization.getInstance().get("barcode.find.view.textForCollapseCardsButton");this.barcodeFindViewUiListener=null;this.shutterButton=null;this.finishButton=null;this.progressBar=null;this.cardList=null;this.onShutterButtonClickedHandler=this.onShutterButtonClicked.bind(this);this.onFinishButtonClickedHandler=this.onFinishButtonClicked.bind(this);this.onTorchButtonClickedHandler=this.onTorchButtonClicked.bind(this);this.torchSwitchIconButton=null;this._shouldShowTorchControl=false;this._isTorchAvailable=false;this.onDotClickHandler=this.onDotClick.bind(this);}set shouldShowTorchControl(t){this._shouldShowTorchControl=t,this.torchSwitchIconButton!==null&&(this.torchSwitchIconButton.hidden=!(t&&this._isTorchAvailable));}get shouldShowTorchControl(){return this._shouldShowTorchControl}get camera(){return this.presenter.context.frameSource}static async createWithSettings(t,o,i,s,r){let e=document.createElement(u.tag);return e.barcodeFindViewSettings=s,e.layout=b.create(),e.layout.innerHTML=html`<${a.tag} slot="progress" value="0" max="1" ${e.shouldShowProgressBar?"":"hidden"}></${a.tag}><${TorchSwitchIconButton.tag} slot="top-controls-left" ${e.shouldShowTorchControl?"":"hidden"}></${TorchSwitchIconButton.tag}><${b$1.tag} slot="card-list" hidden text-for-collapse-cards-button=${e.textForCollapseCardsButton}></${b$1.tag}><${ShutterButton.tag} slot="bottom-controls-center" variant="play" ${e.shouldShowPauseButton?"":"hidden"}></${ShutterButton.tag}><${a$1.tag} slot="bottom-controls-right" ${e.shouldShowFinishButton?"":"hidden"}></${a$1.tag}>`,e.append(e.layout),a$2(t)?(e.dataCaptureView=t,t.htmlElement.prepend(e),await o.setMode(i),await t.setContext(o)):(e.dataCaptureView=await DataCaptureView.forContext(o),e.dataCaptureView.connectToElement(t),t.prepend(e)),e.presenter=new b$2(e,o,i,s,r!=null?r:a$3.recommendedCameraSettings),await e.presenter.prepare(),e.barcodeFindBasicOverlay=await a$4.withBarcodeFind(i,e.dataCaptureView),e}static async create(t,o,i){return u.register(),u.createWithSettings(t,o,i,a$5.BarcodeFindViewSettings.settings,a$3.recommendedCameraSettings)}static register(){defineCustomElements({[u.tag]:u,[TorchSwitchIconButton.tag]:TorchSwitchIconButton,[ShutterButton.tag]:ShutterButton,[a.tag]:a,[b$1.tag]:b$1,[a$1.tag]:a$1,[b.tag]:b});}async startSearching(){return this.onShutterButtonClickedHandler()}async stopSearching(){return this.presenter.stopSearching()}async pauseSearching(){return this.onShutterButtonClickedHandler()}setListener(t){this.barcodeFindViewUiListener=t,this.presenter.barcodeFindViewUiListener=this.barcodeFindViewUiListener;}async setShouldShowUserGuidanceView(t){return this.shouldShowUserGuidance=t,this.barcodeFindBasicOverlay.setUserGuidanceEnabled(this.shouldShowUserGuidance)}async setShouldShowHints(t){return this.shouldShowHints=t,this.barcodeFindBasicOverlay.setShouldShowHint(this.shouldShowHints)}setShouldShowCarousel(t){this.shouldShowCarousel=t,this.layout.toggleVisibility(l.CardListContainer,t);}setShouldShowPauseButton(t){this.shouldShowPauseButton=t,this.layout.toggleVisibility(l.ShutterButton,t);}setShouldShowFinishButton(t){this.shouldShowFinishButton=t,this.layout.toggleVisibility(l.FinishButton,t);}setShouldShowProgressBar(t){this.shouldShowProgressBar=t,this.layout.toggleVisibility(l.ProgressBarWithLabel,t);}setShouldShowTorchControl(t){this.shouldShowTorchControl=t;}setTorchAvailable(t){this._isTorchAvailable=t,this.torchSwitchIconButton!==null&&(this.torchSwitchIconButton.hidden=!(this._shouldShowTorchControl&&this._isTorchAvailable));}setTorchControlPosition(t){var i;this.torchControlPosition=t,[Anchor.TopCenter,Anchor.TopLeft,Anchor.TopRight,Anchor.BottomLeft].includes(t)||(this.torchControlPosition=Anchor.TopLeft);let o={[Anchor.TopCenter]:"top-controls-center",[Anchor.TopLeft]:"top-controls-left",[Anchor.TopRight]:"top-controls-right",[Anchor.BottomLeft]:"bottom-controls-left"}[this.torchControlPosition];(i=this.torchSwitchIconButton)==null||i.setAttribute("slot",o);}setTextForCollapseCardsButton(t){this.textForCollapseCardsButton=t,this.cardList!=null&&(this.cardList["text-for-collapse-cards-button"]=t);}async setTextForAllItemsFoundSuccessfullyHint(t){return this.textForAllItemsFoundSuccessfullyHint=t,this.barcodeFindBasicOverlay.setTextForAllItemsFoundSuccessfullyHint(this.textForAllItemsFoundSuccessfullyHint)}async setTextForPointAtBarcodesToSearchHint(t){return this.textForPointAtBarcodesToSearchHint=t,this.barcodeFindBasicOverlay.setTextForPointAtBarcodesToSearchHint(this.textForPointAtBarcodesToSearchHint)}async setTextForMoveCloserToBarcodesHint(t){return this.textForMoveCloserToBarcodesHint=t,this.barcodeFindBasicOverlay.setTextForPointAtBarcodesToSearchHint(this.textForMoveCloserToBarcodesHint)}async setTextForTapShutterToPauseScreenHint(t){return this.textForTapShutterToPauseScreenHint=t,this.barcodeFindBasicOverlay.setTextForPointAtBarcodesToSearchHint(this.textForTapShutterToPauseScreenHint)}async setTextForTapShutterToResumeSearchHint(t){return this.textForTapShutterToResumeSearchHint=t,this.barcodeFindBasicOverlay.setTextForTapShutterToResumeScreenHint(this.textForTapShutterToResumeSearchHint)}async setTextForItemListUpdatedWhenPausedHint(t){return this.textForItemListUpdatedWhenPausedHint=t,this.barcodeFindBasicOverlay.setTextForItemListUpdatedWhenPausedHint(this.textForItemListUpdatedWhenPausedHint)}async setTextForItemListUpdatedHint(t){return this.textForItemListUpdatedHint=t,this.barcodeFindBasicOverlay.setTextForItemListUpdatedWhenPausedHint(this.textForItemListUpdatedHint)}connectedCallback(){var t,o,i;this.shutterButton=this.layout.querySelector(l.ShutterButton),this.finishButton=this.layout.querySelector(l.FinishButton),this.progressBar=this.layout.querySelector(l.ProgressBarWithLabel),this.cardList=this.layout.querySelector(l.CardListContainer),this.torchSwitchIconButton=this.layout.querySelector(l.TorchSwitchIconButton),(t=this.torchSwitchIconButton)==null||t.addEventListener("pointerdown",this.onTorchButtonClickedHandler),(o=this.shutterButton)==null||o.addEventListener("pointerdown",this.onShutterButtonClickedHandler),(i=this.finishButton)==null||i.addEventListener("pointerdown",this.onFinishButtonClickedHandler),this.layout.addEventListener("onlayouttap",this.onDotClickHandler);}disconnectedCallback(){var t,o,i;(t=this.shutterButton)==null||t.removeEventListener("pointerdown",this.onShutterButtonClickedHandler),(o=this.torchSwitchIconButton)==null||o.addEventListener("pointerdown",this.onTorchButtonClickedHandler),(i=this.finishButton)==null||i.removeEventListener("pointerdown",this.onFinishButtonClickedHandler),this.layout.removeEventListener("onlayouttap",this.onDotClickHandler),this.presenter.dispose();}async onShutterButtonClicked(){this.presenter.onShutterButtonClicked();}async onTorchButtonClicked(){this.presenter.onTorchButtonClicked();}updateProgressBar(t,o){this.progressBar&&(this.progressBar.value!==t&&(this.progressBar.value=t),o!=null&&this.progressBar.max!==o&&(this.progressBar.max=o));}setShutterButtonPulse(t){this.shutterButton!=null&&(this.shutterButton.pulse=t);}switchToPaused(t,o){var s,r,e,h,a,g,f,y,L,P,H,x;let i=[];for(let c of t){let C=Card.create();C.id=`${String(c.uid)}`;let p=a$6.create();if(C.append(p),p.title=(r=(s=c.content)==null?void 0:s.info)!=null?r:c.searchOptions.barcodeData,((e=c.content)==null?void 0:e.additionalInfo)!=null&&(p.subtitle=(a=(h=c.content)==null?void 0:h.additionalInfo)!=null?a:""),o.find(n=>n.searchOptions.barcodeData===c.searchOptions.barcodeData)!=null){let n=a$7.create();n.slot="right",p.append(n);}if(((g=c.content)==null?void 0:g.image)==null){let n=a$8.create();n.slot="image-left",p.append(n);}else {let n=document.createElement("img");n.slot="image-left",n.src=(y=(f=c.content)==null?void 0:f.image)!=null?y:"",n.alt=(P=(L=c.content)==null?void 0:L.additionalInfo)!=null?P:"",p.append(n);}i.push(C);}(H=this.cardList)==null||H.renderCards(i),(x=this.cardList)==null||x.removeAttribute("hidden"),this.shutterButton.variant="play",this.shutterButton.pulse=false,this.toggleDotPulse(false);}moveCardOnTheFront(t){var i,s;if(!t)return;let o=(i=this.cardList)==null?void 0:i.getCardBySelector(`${Card.tag}#${t.uid}`);o!=null&&((s=this.cardList)==null||s.unshiftCard(o));}switchToStarted(){var t;this.clearDots(),(t=this.cardList)==null||t.setAttribute("hidden",""),this.shutterButton.variant="pause";}toggleTorchIcon(t){this.torchSwitchIconButton&&(this.torchSwitchIconButton.state=t);}onFinishButtonClicked(){this.presenter.onFinishButtonClicked();}clearDots(){let t=this.layout.querySelectorAll("[data-identifier]");for(let o of t)o.remove();}toggleDotPulse(t){let o=[...this.layout.querySelectorAll("[data-identifier]")];for(let i of o)i.pulse=t;}pointTransformation(t){return `translate3d(calc(${t.x}px - 50%), calc(${t.y}px - 50%), 0px)`}onDotClick(t){let o=t.detail.target;if(o.dataset.identifier!=null){for(let i of this.layout.querySelectorAll(a$9.tag))i.pulse=false,o===i&&o.variant==="target"&&(o.pulse=true);this.presenter.onDotClick(o.dataset.identifier);}}renderDots(t){var o,i,s;for(let r of t.removedTrackedBarcodes){let e=this.layout.querySelector(`[data-identifier="${r}"]`);e==null||e.remove();}if(t.addedTrackedBarcodes.length>0){let r=document.createDocumentFragment();for(let e of t.addedTrackedBarcodes){let h=this.dataCaptureView.viewAnchorPositionsForFrameAnchorPositions(e.anchorPositions),a=a$9.createWithColors(this.barcodeFindViewSettings.inListItemColor,this.barcodeFindViewSettings.notInListItemColor);a.style.setProperty("position","absolute"),a.style.setProperty("transform",this.pointTransformation(h.center)),a.dataset.identifier=`${e.identifier}`,e.barcode.data!=null&&((o=t.foundTrackedBarcodesInLastProcessedFrame[`${e.identifier}`])==null?void 0:o.barcode.data)===e.barcode.data&&(a.setAttribute("variant","target"),a.pulse=true),r.append(a);}this.layout.append(r);}for(let r of t.updatedTrackedBarcodes){let e=this.layout.querySelector(`[data-identifier="${r.identifier}"]`),{center:h}=this.dataCaptureView.viewAnchorPositionsForFrameAnchorPositions(r.anchorPositions);if(e){let a=(s=(i=this.camera)==null?void 0:i.getMirrorImageEnabled())!=null?s:false,g=new Size(this.dataCaptureView.width,this.dataCaptureView.height);e.style.setProperty("position","absolute");let f=a?Point.mirrorX(h,g):h;e.style.setProperty("transform",this.pointTransformation(f));}}}};u.tag="scandit-barcode-find-view";var O=u;export{O as a};
1
+ import {a as a$1}from'./chunk-DDLFCE34.js';import {a as a$7}from'./chunk-ZPKXVCG3.js';import {b as b$1}from'./chunk-3N7HH72O.js';import {a as a$6}from'./chunk-TKSABJXC.js';import {a}from'./chunk-HHYYL23G.js';import {b}from'./chunk-5V3FWMGO.js';import {a as a$8}from'./chunk-RZWYP24A.js';import {a as a$9}from'./chunk-PJKEAS4K.js';import {a as a$3}from'./chunk-R3MQ2GAV.js';import {a as a$4}from'./chunk-POONUNDO.js';import {b as b$2}from'./chunk-6KDQGEUY.js';import {a as a$5}from'./chunk-DHKABHFE.js';import {a as a$2}from'./chunk-I53W7VSB.js';import {Anchor,Localization,DataCaptureView,Size,Point}from'@scandit/web-datacapture-core';import {ShutterButton}from'@scandit/web-datacapture-core/build/js/private/ui/atoms/ShutterButton.js';import {ScanditHTMLElement}from'@scandit/web-datacapture-core/build/js/private/utils/ScanditHTMLElement.js';import {defineCustomElements}from'@scandit/web-datacapture-core/build/js/private/utils/defineCustomElements.js';import {html}from'@scandit/web-datacapture-core/build/js/private/utils/html.js';import {Card}from'@scandit/web-datacapture-core/build/js/private/ui/atoms/Card.js';import {TorchSwitchIconButton}from'@scandit/web-datacapture-core/build/js/private/ui/molecules/TorchSwitchIconButton.js';var l={FinishButton:a$1.tag,ShutterButton:ShutterButton.tag,ProgressBarWithLabel:a.tag,CardListContainer:b$1.tag,TorchSwitchIconButton:TorchSwitchIconButton.tag},u=class u extends ScanditHTMLElement{constructor(){super(...arguments);this.shouldShowCarousel=true;this.shouldShowPauseButton=true;this.shouldShowFinishButton=true;this.shouldShowProgressBar=true;this.torchControlPosition=Anchor.TopLeft;this.textForItemListUpdatedWhenPausedHint=null;this.textForItemListUpdatedHint=null;this.textForTapShutterToResumeSearchHint=null;this.textForTapShutterToPauseScreenHint=null;this.textForMoveCloserToBarcodesHint=null;this.textForPointAtBarcodesToSearchHint=null;this.textForAllItemsFoundSuccessfullyHint=null;this.textForCollapseCardsButton=Localization.getInstance().get("barcode.find.view.textForCollapseCardsButton");this.barcodeFindViewUiListener=null;this.shutterButton=null;this.finishButton=null;this.progressBar=null;this.cardList=null;this.onShutterButtonClickedHandler=this.onShutterButtonClicked.bind(this);this.onFinishButtonClickedHandler=this.onFinishButtonClicked.bind(this);this.onTorchButtonClickedHandler=this.onTorchButtonClicked.bind(this);this.torchSwitchIconButton=null;this._shouldShowTorchControl=false;this._isTorchAvailable=false;this.onDotClickHandler=this.onDotClick.bind(this);}set shouldShowTorchControl(t){this._shouldShowTorchControl=t,this.torchSwitchIconButton!==null&&(this.torchSwitchIconButton.hidden=!(t&&this._isTorchAvailable));}get shouldShowTorchControl(){return this._shouldShowTorchControl}get camera(){return this.presenter.context.frameSource}static async createWithSettings(t,o,i,s,r){let e=document.createElement(u.tag);return e.barcodeFindViewSettings=s,e.layout=b.create(),e.layout.innerHTML=html`<${a.tag} slot="progress" value="0" max="1" ${e.shouldShowProgressBar?"":"hidden"}></${a.tag}><${TorchSwitchIconButton.tag} slot="top-controls-left" ${e.shouldShowTorchControl?"":"hidden"}></${TorchSwitchIconButton.tag}><${b$1.tag} slot="card-list" hidden text-for-collapse-cards-button=${e.textForCollapseCardsButton}></${b$1.tag}><${ShutterButton.tag} slot="bottom-controls-center" variant="play" ${e.shouldShowPauseButton?"":"hidden"}></${ShutterButton.tag}><${a$1.tag} slot="bottom-controls-right" ${e.shouldShowFinishButton?"":"hidden"}></${a$1.tag}>`,e.append(e.layout),a$2(t)?(e.dataCaptureView=t,t.htmlElement.prepend(e),await o.setMode(i),await t.setContext(o)):(e.dataCaptureView=await DataCaptureView.forContext(o),e.dataCaptureView.connectToElement(t),t.prepend(e)),e.presenter=new b$2(e,o,i,s,r!=null?r:a$3.recommendedCameraSettings),await e.presenter.prepare(),e.barcodeFindBasicOverlay=await a$4.withBarcodeFind(i,e.dataCaptureView),e}static async create(t,o,i){return u.register(),u.createWithSettings(t,o,i,a$5.BarcodeFindViewSettings.settings,a$3.recommendedCameraSettings)}static register(){defineCustomElements({[u.tag]:u,[TorchSwitchIconButton.tag]:TorchSwitchIconButton,[ShutterButton.tag]:ShutterButton,[a.tag]:a,[b$1.tag]:b$1,[a$1.tag]:a$1,[b.tag]:b});}async startSearching(){return this.onShutterButtonClickedHandler()}async stopSearching(){return this.presenter.stopSearching()}async pauseSearching(){return this.onShutterButtonClickedHandler()}setListener(t){this.barcodeFindViewUiListener=t,this.presenter.barcodeFindViewUiListener=this.barcodeFindViewUiListener;}async setShouldShowUserGuidanceView(t){return this.shouldShowUserGuidance=t,this.barcodeFindBasicOverlay.setUserGuidanceEnabled(this.shouldShowUserGuidance)}async setShouldShowHints(t){return this.shouldShowHints=t,this.barcodeFindBasicOverlay.setShouldShowHint(this.shouldShowHints)}setShouldShowCarousel(t){this.shouldShowCarousel=t,this.layout.toggleVisibility(l.CardListContainer,t);}setShouldShowPauseButton(t){this.shouldShowPauseButton=t,this.layout.toggleVisibility(l.ShutterButton,t);}setShouldShowFinishButton(t){this.shouldShowFinishButton=t,this.layout.toggleVisibility(l.FinishButton,t);}setShouldShowProgressBar(t){this.shouldShowProgressBar=t,this.layout.toggleVisibility(l.ProgressBarWithLabel,t);}setShouldShowTorchControl(t){this.shouldShowTorchControl=t;}setTorchAvailable(t){this._isTorchAvailable=t,this.torchSwitchIconButton!==null&&(this.torchSwitchIconButton.hidden=!(this._shouldShowTorchControl&&this._isTorchAvailable));}setTorchControlPosition(t){var i;this.torchControlPosition=t,[Anchor.TopCenter,Anchor.TopLeft,Anchor.TopRight,Anchor.BottomLeft].includes(t)||(this.torchControlPosition=Anchor.TopLeft);let o={[Anchor.TopCenter]:"top-controls-center",[Anchor.TopLeft]:"top-controls-left",[Anchor.TopRight]:"top-controls-right",[Anchor.BottomLeft]:"bottom-controls-left"}[this.torchControlPosition];(i=this.torchSwitchIconButton)==null||i.setAttribute("slot",o);}setTextForCollapseCardsButton(t){this.textForCollapseCardsButton=t,this.cardList!=null&&(this.cardList["text-for-collapse-cards-button"]=t);}async setTextForAllItemsFoundSuccessfullyHint(t){return this.textForAllItemsFoundSuccessfullyHint=t,this.barcodeFindBasicOverlay.setTextForAllItemsFoundSuccessfullyHint(this.textForAllItemsFoundSuccessfullyHint)}async setTextForPointAtBarcodesToSearchHint(t){return this.textForPointAtBarcodesToSearchHint=t,this.barcodeFindBasicOverlay.setTextForPointAtBarcodesToSearchHint(this.textForPointAtBarcodesToSearchHint)}async setTextForMoveCloserToBarcodesHint(t){return this.textForMoveCloserToBarcodesHint=t,this.barcodeFindBasicOverlay.setTextForPointAtBarcodesToSearchHint(this.textForMoveCloserToBarcodesHint)}async setTextForTapShutterToPauseScreenHint(t){return this.textForTapShutterToPauseScreenHint=t,this.barcodeFindBasicOverlay.setTextForPointAtBarcodesToSearchHint(this.textForTapShutterToPauseScreenHint)}async setTextForTapShutterToResumeSearchHint(t){return this.textForTapShutterToResumeSearchHint=t,this.barcodeFindBasicOverlay.setTextForTapShutterToResumeScreenHint(this.textForTapShutterToResumeSearchHint)}async setTextForItemListUpdatedWhenPausedHint(t){return this.textForItemListUpdatedWhenPausedHint=t,this.barcodeFindBasicOverlay.setTextForItemListUpdatedWhenPausedHint(this.textForItemListUpdatedWhenPausedHint)}async setTextForItemListUpdatedHint(t){return this.textForItemListUpdatedHint=t,this.barcodeFindBasicOverlay.setTextForItemListUpdatedWhenPausedHint(this.textForItemListUpdatedHint)}connectedCallback(){var t,o,i;this.shutterButton=this.layout.querySelector(l.ShutterButton),this.finishButton=this.layout.querySelector(l.FinishButton),this.progressBar=this.layout.querySelector(l.ProgressBarWithLabel),this.cardList=this.layout.querySelector(l.CardListContainer),this.torchSwitchIconButton=this.layout.querySelector(l.TorchSwitchIconButton),(t=this.torchSwitchIconButton)==null||t.addEventListener("pointerdown",this.onTorchButtonClickedHandler),(o=this.shutterButton)==null||o.addEventListener("pointerdown",this.onShutterButtonClickedHandler),(i=this.finishButton)==null||i.addEventListener("pointerdown",this.onFinishButtonClickedHandler),this.layout.addEventListener("onlayouttap",this.onDotClickHandler);}disconnectedCallback(){var t,o,i;(t=this.shutterButton)==null||t.removeEventListener("pointerdown",this.onShutterButtonClickedHandler),(o=this.torchSwitchIconButton)==null||o.addEventListener("pointerdown",this.onTorchButtonClickedHandler),(i=this.finishButton)==null||i.removeEventListener("pointerdown",this.onFinishButtonClickedHandler),this.layout.removeEventListener("onlayouttap",this.onDotClickHandler),this.presenter.dispose();}async onShutterButtonClicked(){this.presenter.onShutterButtonClicked();}async onTorchButtonClicked(){this.presenter.onTorchButtonClicked();}updateProgressBar(t,o){this.progressBar&&(this.progressBar.value!==t&&(this.progressBar.value=t),o!=null&&this.progressBar.max!==o&&(this.progressBar.max=o));}setShutterButtonPulse(t){this.shutterButton!=null&&(this.shutterButton.pulse=t);}switchToPaused(t,o){var s,r,e,h,a,g,f,y,L,P,H,x;let i=[];for(let c of t){let C=Card.create();C.id=`${String(c.uid)}`;let p=a$6.create();if(C.append(p),p.title=(r=(s=c.content)==null?void 0:s.info)!=null?r:c.searchOptions.barcodeData,((e=c.content)==null?void 0:e.additionalInfo)!=null&&(p.subtitle=(a=(h=c.content)==null?void 0:h.additionalInfo)!=null?a:""),o.find(n=>n.searchOptions.barcodeData===c.searchOptions.barcodeData)!=null){let n=a$7.create();n.slot="right",p.append(n);}if(((g=c.content)==null?void 0:g.image)==null){let n=a$8.create();n.slot="image-left",p.append(n);}else {let n=document.createElement("img");n.slot="image-left",n.src=(y=(f=c.content)==null?void 0:f.image)!=null?y:"",n.alt=(P=(L=c.content)==null?void 0:L.additionalInfo)!=null?P:"",p.append(n);}i.push(C);}(H=this.cardList)==null||H.renderCards(i),(x=this.cardList)==null||x.removeAttribute("hidden"),this.shutterButton.variant="play",this.shutterButton.pulse=false,this.toggleDotPulse(false);}moveCardOnTheFront(t){var i,s;if(!t)return;let o=(i=this.cardList)==null?void 0:i.getCardBySelector(`${Card.tag}#${t.uid}`);o!=null&&((s=this.cardList)==null||s.unshiftCard(o));}switchToStarted(){var t;this.clearDots(),(t=this.cardList)==null||t.setAttribute("hidden",""),this.shutterButton.variant="pause";}toggleTorchIcon(t){this.torchSwitchIconButton&&(this.torchSwitchIconButton.state=t);}onFinishButtonClicked(){this.presenter.onFinishButtonClicked();}clearDots(){let t=this.layout.querySelectorAll("[data-identifier]");for(let o of t)o.remove();}toggleDotPulse(t){let o=[...this.layout.querySelectorAll("[data-identifier]")];for(let i of o)i.pulse=t;}pointTransformation(t){return `translate3d(calc(${t.x}px - 50%), calc(${t.y}px - 50%), 0px)`}onDotClick(t){let o=t.detail.target;if(o.dataset.identifier!=null){for(let i of this.layout.querySelectorAll(a$9.tag))i.pulse=false,o===i&&o.variant==="target"&&(o.pulse=true);this.presenter.onDotClick(o.dataset.identifier);}}renderDots(t){var o,i,s;for(let r of t.removedTrackedBarcodes){let e=this.layout.querySelector(`[data-identifier="${r}"]`);e==null||e.remove();}if(t.addedTrackedBarcodes.length>0){let r=document.createDocumentFragment();for(let e of t.addedTrackedBarcodes){let h=this.dataCaptureView.viewAnchorPositionsForFrameAnchorPositions(e.anchorPositions),a=a$9.createWithColors(this.barcodeFindViewSettings.inListItemColor,this.barcodeFindViewSettings.notInListItemColor);a.style.setProperty("position","absolute"),a.style.setProperty("transform",this.pointTransformation(h.center)),a.dataset.identifier=`${e.identifier}`,e.barcode.data!=null&&((o=t.foundTrackedBarcodesInLastProcessedFrame[`${e.identifier}`])==null?void 0:o.barcode.data)===e.barcode.data&&(a.setAttribute("variant","target"),a.pulse=true),r.append(a);}this.layout.append(r);}for(let r of t.updatedTrackedBarcodes){let e=this.layout.querySelector(`[data-identifier="${r.identifier}"]`),{center:h}=this.dataCaptureView.viewAnchorPositionsForFrameAnchorPositions(r.anchorPositions);if(e){let a=(s=(i=this.camera)==null?void 0:i.getMirrorImageEnabled())!=null?s:false,g=new Size(this.dataCaptureView.width,this.dataCaptureView.height);e.style.setProperty("position","absolute");let f=a?Point.mirrorX(h,g):h;e.style.setProperty("transform",this.pointTransformation(f));}}}};u.tag="scandit-barcode-find-view";var O=u;export{O as a};
@@ -1 +1 @@
1
- import {a as a$7}from'./chunk-ZPCWOA3Y.js';import {a as a$6}from'./chunk-MHOUYN7K.js';import {a}from'./chunk-HDLJOQJY.js';import {a as a$9}from'./chunk-KMEGIFKL.js';import {a as a$5}from'./chunk-QRG4J3CL.js';import {b as b$1}from'./chunk-33EFB3RJ.js';import {b}from'./chunk-OH47PSIL.js';import {a as a$1}from'./chunk-I53W7VSB.js';import {a as a$8}from'./chunk-O5SUMSOC.js';import {a as a$2}from'./chunk-NU4EA3HH.js';import {a as a$4}from'./chunk-I3PK5YW4.js';import {a as a$3}from'./chunk-RF4KC5J3.js';import {Anchor,DataCaptureView,Direction,Point,Size}from'@scandit/web-datacapture-core';import {Backdrop}from'@scandit/web-datacapture-core/build/js/private/ui/atoms/Backdrop.js';import {ScanditHTMLElement}from'@scandit/web-datacapture-core/build/js/private/utils/ScanditHTMLElement.js';import {css}from'@scandit/web-datacapture-core/build/js/private/utils/css.js';import {defineCustomElements}from'@scandit/web-datacapture-core/build/js/private/utils/defineCustomElements.js';import {calculateArea,calculateWidth,calculateHeight}from'@scandit/web-datacapture-core/build/js/private/utils/quadrilateralUtils.js';import {Timeout}from'@scandit/web-datacapture-core/build/js/private/utils/timeout.js';import {TorchSwitchIconButton}from'@scandit/web-datacapture-core/build/js/private/ui/molecules/TorchSwitchIconButton.js';var W={async highlightForBarcode(E,T){let t=a$9.create(E);T(t);}},c=class c extends ScanditHTMLElement{constructor(){super(...arguments);this.torchSwitchIconButton=null;this.cameraSwitchButton=null;this.zoomButton=null;this._shouldShowTorchControl=false;this._isTorchAvailable=false;this.onTorchButtonClickHandler=this.onTorchButtonClick.bind(this);this.onCameraSwitchButtonHandler=this.onCameraSwitchButtonClick.bind(this);this.onZoomButtonHandler=this.onZoomButtonClick.bind(this);this.onLayoutPointerDownHandler=this.onLayoutPointerDown.bind(this);this.onInfoAnnotationTapHandler=this.onInfoAnnotationTap.bind(this);this.pendingDeletionTimeout=null;}set shouldShowZoomControl(t){this.zoomButton&&(this.zoomButton.hidden=!t);}get shouldShowZoomControl(){return this.zoomButton===null?false:!this.zoomButton.hidden}set shouldShowCameraSwitchControl(t){this.cameraSwitchButton&&(this.cameraSwitchButton.hidden=!t);}get shouldShowCameraSwitchControl(){return this.cameraSwitchButton===null?false:!this.cameraSwitchButton.hidden}set shouldShowTorchControl(t){this.torchSwitchIconButton!==null&&(this._shouldShowTorchControl=t,this.torchSwitchIconButton.hidden=!(t&&this._isTorchAvailable));}get shouldShowTorchControl(){return this._shouldShowTorchControl}set torchControlPosition(t){var o;(o=this.torchSwitchIconButton)==null||o.setAttribute("slot",`controls-${t===Anchor.Center?Anchor.TopLeft:t}`);}get torchControlPosition(){var o,e;let t=(e=(o=this.torchSwitchIconButton)==null?void 0:o.getAttribute("slot"))!=null?e:"";return t===""?Anchor.TopLeft:t.replace("controls-","")}set zoomControlPosition(t){var o;(o=this.zoomButton)==null||o.setAttribute("slot",`controls-${t===Anchor.Center?Anchor.BottomRight:t}`);}get zoomControlPosition(){var o,e;let t=(e=(o=this.zoomButton)==null?void 0:o.getAttribute("slot"))!=null?e:"";return t===""?Anchor.BottomRight:t.replace("controls-","")}set cameraSwitchControlPosition(t){var o;(o=this.cameraSwitchButton)==null||o.setAttribute("slot",`controls-${t===Anchor.Center?Anchor.TopRight:t}`);}get cameraSwitchControlPosition(){var o,e;let t=(e=(o=this.zoomButton)==null?void 0:o.getAttribute("slot"))!=null?e:"";return t===""?Anchor.TopRight:t.replace("controls-","")}static async createWithSettings(t,o,e,i,n){c.register();let r=document.createElement(c.tag);return r.barcodeArViewSettings=i,r.layout=a.create(),r.append(r.layout),a$1(t)?(r.dataCaptureView=t,r.dataCaptureView.containerElement.prepend(r),await t.setContext(o)):(r.dataCaptureView=await DataCaptureView.forContext(o),r.dataCaptureView.connectToElement(t),r.dataCaptureView.containerElement.prepend(r)),r.presenter=new a$2(r,o,e,i,n!=null?n:a$3.createRecommendedCameraSettings()),await r.presenter.prepare(),r}static async create(t,o,e){return c.createWithSettings(t,o,e,new a$4)}static register(){defineCustomElements({[a.tag]:a,[a$7.tag]:a$7,[a$6.tag]:a$6,[TorchSwitchIconButton.tag]:TorchSwitchIconButton,[c.tag]:c,[Backdrop.tag]:Backdrop,[a$5.tag]:a$5});}static createStyleElement(){return css`[data-could-be-deleted=true]{display:none!important}[data-on-foreground=true]{z-index:3}${c.tag}{inset:0;position:absolute;z-index:1}`}getHighlightForBarcode(t){return this.queryHighlightByDataId(a$8(t))}getAnnotationForBarcode(t){return this.queryAnnotationByDataId(a$8(t))}async start(){return this.presenter.startSearching()}async stop(){return this.presenter.stopSearching()}async pause(){return this.presenter.pauseSearching()}reset(){this.deletePendingViews(),this.deleteAllViews();}getNotificationPresenter(){return this.dataCaptureView.getNotificationPresenter()}setTorchAvailable(t){this._isTorchAvailable=t,this.torchSwitchIconButton!==null&&(this.torchSwitchIconButton.hidden=!(this._shouldShowTorchControl&&this._isTorchAvailable));}toggleTorchIcon(t){this.torchSwitchIconButton!==null&&(this.torchSwitchIconButton.state=t);}onTorchButtonClick(){this.presenter.onTorchButtonClicked();}onCameraSwitchButtonClick(){this.presenter.onCameraSwitchButtonClicked();}onZoomButtonClick(){this.presenter.onZoomButtonClicked();}changeZoomButtonIcon(t){this.zoomButton&&(this.zoomButton.zoom=`${t}x`);}connectedCallback(){this.torchSwitchIconButton=TorchSwitchIconButton.create(),this.torchSwitchIconButton.shadow=true,this.torchSwitchIconButton.size=36,this.torchSwitchIconButton.slot=`controls-${this.torchControlPosition}`,this.torchSwitchIconButton.hidden=true,this.torchSwitchIconButton.addEventListener("pointerdown",this.onTorchButtonClickHandler),this.cameraSwitchButton=a$7.create(),this.cameraSwitchButton.slot=`controls-${this.cameraSwitchControlPosition}`,this.cameraSwitchButton.hidden=true,this.cameraSwitchButton.addEventListener("pointerdown",this.onCameraSwitchButtonHandler),this.zoomButton=a$6.create(),this.zoomButton.slot=`controls-${this.zoomControlPosition}`,this.zoomButton.hidden=true,this.zoomButton.addEventListener("pointerdown",this.onZoomButtonHandler),this.layout.append(this.torchSwitchIconButton,this.cameraSwitchButton,this.zoomButton),this.layout.addEventListener("pointerdown",this.onLayoutPointerDownHandler),this.layout.addEventListener("BarcodeArInfoAnnotationEventTap",this.onInfoAnnotationTapHandler),this.backdrop=Backdrop.create(),this.layout.append(this.backdrop),this.pendingDeletionTimeout=new Timeout(1e3,()=>{this.deletePendingViews();}),this.prepend(c.createStyleElement());}disconnectedCallback(){var t,o,e;this.deleteAllViews(),(t=this.torchSwitchIconButton)==null||t.removeEventListener("pointerdown",this.onTorchButtonClickHandler),(o=this.cameraSwitchButton)==null||o.removeEventListener("pointerdown",this.onCameraSwitchButtonHandler),(e=this.zoomButton)==null||e.removeEventListener("pointerdown",this.onZoomButtonHandler),this.layout.removeEventListener("pointerdown",this.onLayoutPointerDownHandler),this.layout.removeEventListener("BarcodeArInfoAnnotationEventTap",this.onInfoAnnotationTapHandler);}isPopoverAnnotation(t){return t instanceof b}isAnnotation(t){var o;return ((o=t.dataset)==null?void 0:o.identifier)==null?false:t.dataset.identifier.endsWith("-annotation")}areMultiplePopoverAllowed(){for(let t of this.layout.querySelectorAll("[data-identifier$='-annotation']"))if(t&&this.isPopoverAnnotation(t)&&t.annotationTrigger==="highlightTapAndBarcodeScan")return true;return false}async onLayoutPointerDown(t){let o=t.target,e=o==null?void 0:o.closest("[data-identifier$='-highlight']"),i=o==null?void 0:o.closest(b.tag);if((e==null?void 0:e.dataset.id)!=null){await this.handleHighlightClick(e);return}if((i==null?void 0:i.dataset.id)!=null){await this.handleAnnotationClick(i);return}await this.handleClickOutside();}async handleHighlightClick(t){var e;this.presenter.emitTappedFeedback(),(e=this.listener)==null||e.didTapHighlightForBarcode(this.presenter.barcodeAr,t.barcode,t);let o=this.queryAnnotationByDataIdentifier(t.dataset.identifier.replace("-highlight",""));!o||o.annotationTrigger==="barcodeScan"||(this.isPopoverAnnotation(o)?await this.handlePopoverHighlightClick(o,t):o.hidden=!o.hidden);}async handlePopoverHighlightClick(t,o){var e;if(!this.areMultiplePopoverAllowed()){let i=this.layout.querySelector(`${b.tag}[data-on-foreground="true"]`),n=(e=i==null?void 0:i.dataset.identifier)==null?void 0:e.replace("-annotation","-highlight"),r=this.layout.querySelector(`[data-identifier="${n}"]`);i!=null&&r!=null&&await this.hideBarcodeArPopover(i,r,false);}await this.toggleBarcodeArPopover(t,o);}async handleAnnotationClick(t){var i;let o=(i=t.dataset.identifier)==null?void 0:i.replace("-annotation","-highlight"),e=this.layout.querySelector(`[data-identifier="${o}"]`);e&&await this.toggleBarcodeArPopover(t,e);}async handleClickOutside(){var i;if(this.areMultiplePopoverAllowed())return;let t=this.layout.querySelector(`${b.tag}[data-on-foreground="true"]`);if(!t)return;let o=(i=t.dataset.identifier)==null?void 0:i.replace("-annotation","-highlight"),e=this.layout.querySelector(`[data-identifier="${o}"]`);e&&await this.hideBarcodeArPopover(t,e);}onInfoAnnotationTap(){this.presenter.emitTappedFeedback();}async showBarcodeArPopover(t,o){t.dataset.onForeground="true",t.hidden=false,o.dataset.onForeground="true",this.backdrop.open=true;}async hideBarcodeArPopover(t,o,e=true){t.dataset.onForeground="false",t.hidden=true,o&&(o.dataset.onForeground="false"),e&&this.hideBackdropIfNoPopovers();}hideBackdropIfNoPopovers(){[...this.layout.querySelectorAll(`${b.tag}`)].every(o=>o.hidden)&&(this.backdrop.open=false);}async toggleBarcodeArPopover(t,o){t.hidden?await this.showBarcodeArPopover(t,o):await this.hideBarcodeArPopover(t,o);}deleteAllViews(){for(let t of this.layout.querySelectorAll("[data-identifier]"))t.remove();}deletePendingViews(){for(let t of this.layout.querySelectorAll("[data-could-be-deleted='true']"))t.remove();this.hideBackdropIfNoPopovers();}identifierForHighlight(t){return `${t}-highlight`}identifierForAnnotation(t){return `${t}-annotation`}async onHighlightsOrAnnotationForTrackedBarcode(t){var o,e,i;await((e=(o=this.highlightProvider)!=null?o:W)==null?void 0:e.highlightForBarcode(t.barcode,async n=>this.onHighlight(t,n))),await((i=this.annotationProvider)==null?void 0:i.annotationForBarcode(t.barcode,async n=>this.onAnnotation(t,n)));}async onAnnotation(t,o){let e=o,i=a$8(t.barcode);this.updateExistingAnnotation(i)||(await this.setupNewAnnotation(e,i,t),this.updateAnnotationPosition(t,e));}updateExistingAnnotation(t){let o=this.queryAnnotationByDataId(t);return o?(o.dataset.couldBeDeleted="false",true):false}async setupNewAnnotation(t,o,e){if(t.dataset.id=o,t.dataset.identifier=this.identifierForAnnotation(e.identifier),t.hidden=true,this.layout.append(t),this.isPopoverAnnotation(t)){if(t.direction=Direction.Vertical,t.anchor==null&&(t.anchor="bottom-center"),this.areMultiplePopoverAllowed()||t.annotationTrigger==="highlightTapAndBarcodeScan"){let i=this.queryHighlightByDataId(o);i&&await this.showBarcodeArPopover(t,i);}}else t.hidden=t.annotationTrigger==="highlightTap";}getAnnotationVariationForQuad(t,o){let e=Math.max(0,Math.min(1,o)),i=t.anchorPositions,n=calculateArea(i),r=this.dataCaptureView.width,l=this.dataCaptureView.height,d=r*l;if(n<=0||d<=0)return 0;let u=n/d;return Math.max(0,Math.min(1,u))<=e?2:1}async onHighlight(t,o){let e=a$8(t.barcode),i=this.queryHighlightByDataId(e);i?i.dataset.couldBeDeleted="false":(o.dataset.id=e,o.dataset.identifier=this.identifierForHighlight(t.identifier),this.updateHighlightPosition(t,o),this.layout.append(o));}queryHighlightByDataIdentifier(t){return this.layout.querySelector(`[data-identifier$="${t}-highlight"]`)}queryAnnotationByDataIdentifier(t){return this.layout.querySelector(`[data-identifier$="${t}-annotation"]`)}queryHighlightByDataId(t){return this.layout.querySelector(`[data-identifier$="-highlight"][data-id="${t}"]`)}queryAnnotationByDataId(t){return this.layout.querySelector(`[data-identifier$="-annotation"][data-id="${t}"]`)}updateRemovedTrackedBarcodes(t){var i,n,r,l,d;let o=this.querySelectorAll("[data-identifier]");if(Object.keys(t.allTrackedBarcodes).length===0){for(let u of o)u.dataset.couldBeDeleted="true";(i=this.pendingDeletionTimeout)!=null&&i.running||(n=this.pendingDeletionTimeout)==null||n.start();return}let e=new Set(t.removedTrackedBarcodes);for(let u of o){let p=(r=u.dataset.identifier)==null?void 0:r.replace("-highlight","").replace("-annotation","");p!=null&&e.has(p)&&(u.dataset.couldBeDeleted="true");}(l=this.pendingDeletionTimeout)!=null&&l.running||(d=this.pendingDeletionTimeout)==null||d.start();}render(t){for(let[o,e]of Object.entries(t.allTrackedBarcodes)){t.addedTrackedBarcodes[o]!=null&&this.onHighlightsOrAnnotationForTrackedBarcode(e);let i=a$8(e.barcode),n=this.queryAnnotationByDataId(i),r=this.queryHighlightByDataId(i);r&&(this.updateBrushSize(r,e),this.updateHighlightPosition(e,r)),n&&this.updateAnnotationPosition(e,n,r);}this.updateRemovedTrackedBarcodes(t);}updateHighlightPosition(t,o,e="center"){if(o.hidden)return;let i=this.dataCaptureView.viewAnchorPositionsForFrameAnchorPositions(t.anchorPositions),n=this.normalizedViewPointFromFrameAnchorPositions(i,e);o.updatePosition(n,new Point(-50,-50),this.calculateRotationAngle(i.topLeft,i.topRight));}updateBrushSize(t,o){if(t.width==null||t.height==null)return;let e=this.dataCaptureView.viewAnchorPositionsForFrameAnchorPositions(o.anchorPositions),i=Math.round(calculateWidth(e)),n=Math.round(calculateHeight(e));t.width!==i&&(t.width=i),t.height!==n&&(t.height=n);}getTransformOrigin(t){return {"top-center":new Point(-50,0),"bottom-center":new Point(-50,-100),"left-center":new Point(0,-50),"right-center":new Point(-100,-50)}[t]}calculateAnnotationPosition(t,o,e){var p,f;let n=t.orderVerticesByPosition(),r=this.normalizedViewPointFromFrameAnchorPositions(t,"center"),d={"bottom-center":()=>{let s=this.normalizedViewPointFromFrameAnchorPositions(n,"topCenter");return new Point(s.x,s.y-7)},"top-center":()=>{let s=this.normalizedViewPointFromFrameAnchorPositions(n,"bottomCenter");return new Point(s.x,s.y+7)},"right-center":()=>{let s=this.normalizedViewPointFromFrameAnchorPositions(n,"centerLeft");return new Point(s.x-7,s.y)},"left-center":()=>{let s=this.normalizedViewPointFromFrameAnchorPositions(n,"centerRight");return new Point(s.x+7,s.y)}}[o]();return e?e instanceof b$1?(p={"bottom-center":new Point(r.x,r.y-7-e.clientHeight/2),"top-center":new Point(r.x,r.y+7+e.clientHeight/2),"right-center":new Point(r.x-7-e.clientWidth/2,r.y),"left-center":new Point(r.x+7+e.clientWidth/2,r.y)}[o])!=null?p:d:(f={"bottom-center":new Point(r.x,r.y-7-e.clientHeight/2),"top-center":new Point(r.x,r.y+7+e.clientHeight/2),"right-center":new Point(r.x-7-e.clientWidth/2,r.y),"left-center":new Point(r.x+7+e.clientWidth/2,r.y)}[o])!=null?f:d:d}updateAnnotationPosition(t,o,e){let i=this.dataCaptureView.viewAnchorPositionsForFrameAnchorPositions(t.anchorPositions);if(o.anchor||(o.anchor="top-center"),o.annotationVariation!=null){let l=this.getAnnotationVariationForQuad(t,a$5.threshold);o.annotationVariation=l;}let n=this.getTransformOrigin(o.anchor),r=this.calculateAnnotationPosition(i,o.anchor,e);o.updatePosition(r,n,this.calculateRotationAngle(i.topLeft,i.topRight));}normalizedViewPointFromFrameAnchorPositions(t,o="center"){let e=this.presenter.currentCamera.getMirrorImageEnabled(),i=new Size(this.dataCaptureView.width,this.dataCaptureView.height);if(e){let r=t[{centerLeft:"centerRight",centerRight:"centerLeft",center:"center",topCenter:"topCenter",bottomCenter:"bottomCenter"}[o]];return Point.mirrorX(r,i)}return t[o]}calculateRotationAngle(t,o){let e=o.x-t.x,n=this.presenter.isCameraMirrored()?-(o.y-t.y):o.y-t.y,r=Math.atan2(n,e);return Math.round(r*(180/Math.PI))}};c.tag="scandit-barcode-ar-view";var k=c;export{k as a};
1
+ import {a as a$7}from'./chunk-ZPCWOA3Y.js';import {a as a$6}from'./chunk-MHOUYN7K.js';import {a}from'./chunk-HDLJOQJY.js';import {a as a$9}from'./chunk-KMEGIFKL.js';import {a as a$5}from'./chunk-QRG4J3CL.js';import {b as b$1}from'./chunk-33EFB3RJ.js';import {b}from'./chunk-OH47PSIL.js';import {a as a$1}from'./chunk-I53W7VSB.js';import {a as a$8}from'./chunk-O5SUMSOC.js';import {a as a$2}from'./chunk-QEA62LQD.js';import {a as a$4}from'./chunk-I3PK5YW4.js';import {a as a$3}from'./chunk-SBAQY2WJ.js';import {Anchor,DataCaptureView,Direction,Point,Size}from'@scandit/web-datacapture-core';import {Backdrop}from'@scandit/web-datacapture-core/build/js/private/ui/atoms/Backdrop.js';import {ScanditHTMLElement}from'@scandit/web-datacapture-core/build/js/private/utils/ScanditHTMLElement.js';import {css}from'@scandit/web-datacapture-core/build/js/private/utils/css.js';import {defineCustomElements}from'@scandit/web-datacapture-core/build/js/private/utils/defineCustomElements.js';import {calculateArea,calculateWidth,calculateHeight}from'@scandit/web-datacapture-core/build/js/private/utils/quadrilateralUtils.js';import {Timeout}from'@scandit/web-datacapture-core/build/js/private/utils/timeout.js';import {TorchSwitchIconButton}from'@scandit/web-datacapture-core/build/js/private/ui/molecules/TorchSwitchIconButton.js';var W={async highlightForBarcode(E,T){let t=a$9.create(E);T(t);}},c=class c extends ScanditHTMLElement{constructor(){super(...arguments);this.torchSwitchIconButton=null;this.cameraSwitchButton=null;this.zoomButton=null;this._shouldShowTorchControl=false;this._isTorchAvailable=false;this.onTorchButtonClickHandler=this.onTorchButtonClick.bind(this);this.onCameraSwitchButtonHandler=this.onCameraSwitchButtonClick.bind(this);this.onZoomButtonHandler=this.onZoomButtonClick.bind(this);this.onLayoutPointerDownHandler=this.onLayoutPointerDown.bind(this);this.onInfoAnnotationTapHandler=this.onInfoAnnotationTap.bind(this);this.pendingDeletionTimeout=null;}set shouldShowZoomControl(t){this.zoomButton&&(this.zoomButton.hidden=!t);}get shouldShowZoomControl(){return this.zoomButton===null?false:!this.zoomButton.hidden}set shouldShowCameraSwitchControl(t){this.cameraSwitchButton&&(this.cameraSwitchButton.hidden=!t);}get shouldShowCameraSwitchControl(){return this.cameraSwitchButton===null?false:!this.cameraSwitchButton.hidden}set shouldShowTorchControl(t){this.torchSwitchIconButton!==null&&(this._shouldShowTorchControl=t,this.torchSwitchIconButton.hidden=!(t&&this._isTorchAvailable));}get shouldShowTorchControl(){return this._shouldShowTorchControl}set torchControlPosition(t){var o;(o=this.torchSwitchIconButton)==null||o.setAttribute("slot",`controls-${t===Anchor.Center?Anchor.TopLeft:t}`);}get torchControlPosition(){var o,e;let t=(e=(o=this.torchSwitchIconButton)==null?void 0:o.getAttribute("slot"))!=null?e:"";return t===""?Anchor.TopLeft:t.replace("controls-","")}set zoomControlPosition(t){var o;(o=this.zoomButton)==null||o.setAttribute("slot",`controls-${t===Anchor.Center?Anchor.BottomRight:t}`);}get zoomControlPosition(){var o,e;let t=(e=(o=this.zoomButton)==null?void 0:o.getAttribute("slot"))!=null?e:"";return t===""?Anchor.BottomRight:t.replace("controls-","")}set cameraSwitchControlPosition(t){var o;(o=this.cameraSwitchButton)==null||o.setAttribute("slot",`controls-${t===Anchor.Center?Anchor.TopRight:t}`);}get cameraSwitchControlPosition(){var o,e;let t=(e=(o=this.zoomButton)==null?void 0:o.getAttribute("slot"))!=null?e:"";return t===""?Anchor.TopRight:t.replace("controls-","")}static async createWithSettings(t,o,e,i,n){c.register();let r=document.createElement(c.tag);return r.barcodeArViewSettings=i,r.layout=a.create(),r.append(r.layout),a$1(t)?(r.dataCaptureView=t,r.dataCaptureView.containerElement.prepend(r),await t.setContext(o)):(r.dataCaptureView=await DataCaptureView.forContext(o),r.dataCaptureView.connectToElement(t),r.dataCaptureView.containerElement.prepend(r)),r.presenter=new a$2(r,o,e,i,n!=null?n:a$3.createRecommendedCameraSettings()),await r.presenter.prepare(),r}static async create(t,o,e){return c.createWithSettings(t,o,e,new a$4)}static register(){defineCustomElements({[a.tag]:a,[a$7.tag]:a$7,[a$6.tag]:a$6,[TorchSwitchIconButton.tag]:TorchSwitchIconButton,[c.tag]:c,[Backdrop.tag]:Backdrop,[a$5.tag]:a$5});}static createStyleElement(){return css`[data-could-be-deleted=true]{display:none!important}[data-on-foreground=true]{z-index:3}${c.tag}{inset:0;position:absolute;z-index:1}`}getHighlightForBarcode(t){return this.queryHighlightByDataId(a$8(t))}getAnnotationForBarcode(t){return this.queryAnnotationByDataId(a$8(t))}async start(){return this.presenter.startSearching()}async stop(){return this.presenter.stopSearching()}async pause(){return this.presenter.pauseSearching()}reset(){this.deletePendingViews(),this.deleteAllViews();}getNotificationPresenter(){return this.dataCaptureView.getNotificationPresenter()}setTorchAvailable(t){this._isTorchAvailable=t,this.torchSwitchIconButton!==null&&(this.torchSwitchIconButton.hidden=!(this._shouldShowTorchControl&&this._isTorchAvailable));}toggleTorchIcon(t){this.torchSwitchIconButton!==null&&(this.torchSwitchIconButton.state=t);}onTorchButtonClick(){this.presenter.onTorchButtonClicked();}onCameraSwitchButtonClick(){this.presenter.onCameraSwitchButtonClicked();}onZoomButtonClick(){this.presenter.onZoomButtonClicked();}changeZoomButtonIcon(t){this.zoomButton&&(this.zoomButton.zoom=`${t}x`);}connectedCallback(){this.torchSwitchIconButton=TorchSwitchIconButton.create(),this.torchSwitchIconButton.shadow=true,this.torchSwitchIconButton.size=36,this.torchSwitchIconButton.slot=`controls-${this.torchControlPosition}`,this.torchSwitchIconButton.hidden=true,this.torchSwitchIconButton.addEventListener("pointerdown",this.onTorchButtonClickHandler),this.cameraSwitchButton=a$7.create(),this.cameraSwitchButton.slot=`controls-${this.cameraSwitchControlPosition}`,this.cameraSwitchButton.hidden=true,this.cameraSwitchButton.addEventListener("pointerdown",this.onCameraSwitchButtonHandler),this.zoomButton=a$6.create(),this.zoomButton.slot=`controls-${this.zoomControlPosition}`,this.zoomButton.hidden=true,this.zoomButton.addEventListener("pointerdown",this.onZoomButtonHandler),this.layout.append(this.torchSwitchIconButton,this.cameraSwitchButton,this.zoomButton),this.layout.addEventListener("pointerdown",this.onLayoutPointerDownHandler),this.layout.addEventListener("BarcodeArInfoAnnotationEventTap",this.onInfoAnnotationTapHandler),this.backdrop=Backdrop.create(),this.layout.append(this.backdrop),this.pendingDeletionTimeout=new Timeout(1e3,()=>{this.deletePendingViews();}),this.prepend(c.createStyleElement());}disconnectedCallback(){var t,o,e;this.deleteAllViews(),(t=this.torchSwitchIconButton)==null||t.removeEventListener("pointerdown",this.onTorchButtonClickHandler),(o=this.cameraSwitchButton)==null||o.removeEventListener("pointerdown",this.onCameraSwitchButtonHandler),(e=this.zoomButton)==null||e.removeEventListener("pointerdown",this.onZoomButtonHandler),this.layout.removeEventListener("pointerdown",this.onLayoutPointerDownHandler),this.layout.removeEventListener("BarcodeArInfoAnnotationEventTap",this.onInfoAnnotationTapHandler);}isPopoverAnnotation(t){return t instanceof b}isAnnotation(t){var o;return ((o=t.dataset)==null?void 0:o.identifier)==null?false:t.dataset.identifier.endsWith("-annotation")}areMultiplePopoverAllowed(){for(let t of this.layout.querySelectorAll("[data-identifier$='-annotation']"))if(t&&this.isPopoverAnnotation(t)&&t.annotationTrigger==="highlightTapAndBarcodeScan")return true;return false}async onLayoutPointerDown(t){let o=t.target,e=o==null?void 0:o.closest("[data-identifier$='-highlight']"),i=o==null?void 0:o.closest(b.tag);if((e==null?void 0:e.dataset.id)!=null){await this.handleHighlightClick(e);return}if((i==null?void 0:i.dataset.id)!=null){await this.handleAnnotationClick(i);return}await this.handleClickOutside();}async handleHighlightClick(t){var e;this.presenter.emitTappedFeedback(),(e=this.listener)==null||e.didTapHighlightForBarcode(this.presenter.barcodeAr,t.barcode,t);let o=this.queryAnnotationByDataIdentifier(t.dataset.identifier.replace("-highlight",""));!o||o.annotationTrigger==="barcodeScan"||(this.isPopoverAnnotation(o)?await this.handlePopoverHighlightClick(o,t):o.hidden=!o.hidden);}async handlePopoverHighlightClick(t,o){var e;if(!this.areMultiplePopoverAllowed()){let i=this.layout.querySelector(`${b.tag}[data-on-foreground="true"]`),n=(e=i==null?void 0:i.dataset.identifier)==null?void 0:e.replace("-annotation","-highlight"),r=this.layout.querySelector(`[data-identifier="${n}"]`);i!=null&&r!=null&&await this.hideBarcodeArPopover(i,r,false);}await this.toggleBarcodeArPopover(t,o);}async handleAnnotationClick(t){var i;let o=(i=t.dataset.identifier)==null?void 0:i.replace("-annotation","-highlight"),e=this.layout.querySelector(`[data-identifier="${o}"]`);e&&await this.toggleBarcodeArPopover(t,e);}async handleClickOutside(){var i;if(this.areMultiplePopoverAllowed())return;let t=this.layout.querySelector(`${b.tag}[data-on-foreground="true"]`);if(!t)return;let o=(i=t.dataset.identifier)==null?void 0:i.replace("-annotation","-highlight"),e=this.layout.querySelector(`[data-identifier="${o}"]`);e&&await this.hideBarcodeArPopover(t,e);}onInfoAnnotationTap(){this.presenter.emitTappedFeedback();}async showBarcodeArPopover(t,o){t.dataset.onForeground="true",t.hidden=false,o.dataset.onForeground="true",this.backdrop.open=true;}async hideBarcodeArPopover(t,o,e=true){t.dataset.onForeground="false",t.hidden=true,o&&(o.dataset.onForeground="false"),e&&this.hideBackdropIfNoPopovers();}hideBackdropIfNoPopovers(){[...this.layout.querySelectorAll(`${b.tag}`)].every(o=>o.hidden)&&(this.backdrop.open=false);}async toggleBarcodeArPopover(t,o){t.hidden?await this.showBarcodeArPopover(t,o):await this.hideBarcodeArPopover(t,o);}deleteAllViews(){for(let t of this.layout.querySelectorAll("[data-identifier]"))t.remove();}deletePendingViews(){for(let t of this.layout.querySelectorAll("[data-could-be-deleted='true']"))t.remove();this.hideBackdropIfNoPopovers();}identifierForHighlight(t){return `${t}-highlight`}identifierForAnnotation(t){return `${t}-annotation`}async onHighlightsOrAnnotationForTrackedBarcode(t){var o,e,i;await((e=(o=this.highlightProvider)!=null?o:W)==null?void 0:e.highlightForBarcode(t.barcode,async n=>this.onHighlight(t,n))),await((i=this.annotationProvider)==null?void 0:i.annotationForBarcode(t.barcode,async n=>this.onAnnotation(t,n)));}async onAnnotation(t,o){let e=o,i=a$8(t.barcode);this.updateExistingAnnotation(i)||(await this.setupNewAnnotation(e,i,t),this.updateAnnotationPosition(t,e));}updateExistingAnnotation(t){let o=this.queryAnnotationByDataId(t);return o?(o.dataset.couldBeDeleted="false",true):false}async setupNewAnnotation(t,o,e){if(t.dataset.id=o,t.dataset.identifier=this.identifierForAnnotation(e.identifier),t.hidden=true,this.layout.append(t),this.isPopoverAnnotation(t)){if(t.direction=Direction.Vertical,t.anchor==null&&(t.anchor="bottom-center"),this.areMultiplePopoverAllowed()||t.annotationTrigger==="highlightTapAndBarcodeScan"){let i=this.queryHighlightByDataId(o);i&&await this.showBarcodeArPopover(t,i);}}else t.hidden=t.annotationTrigger==="highlightTap";}getAnnotationVariationForQuad(t,o){let e=Math.max(0,Math.min(1,o)),i=t.anchorPositions,n=calculateArea(i),r=this.dataCaptureView.width,l=this.dataCaptureView.height,d=r*l;if(n<=0||d<=0)return 0;let u=n/d;return Math.max(0,Math.min(1,u))<=e?2:1}async onHighlight(t,o){let e=a$8(t.barcode),i=this.queryHighlightByDataId(e);i?i.dataset.couldBeDeleted="false":(o.dataset.id=e,o.dataset.identifier=this.identifierForHighlight(t.identifier),this.updateHighlightPosition(t,o),this.layout.append(o));}queryHighlightByDataIdentifier(t){return this.layout.querySelector(`[data-identifier$="${t}-highlight"]`)}queryAnnotationByDataIdentifier(t){return this.layout.querySelector(`[data-identifier$="${t}-annotation"]`)}queryHighlightByDataId(t){return this.layout.querySelector(`[data-identifier$="-highlight"][data-id="${t}"]`)}queryAnnotationByDataId(t){return this.layout.querySelector(`[data-identifier$="-annotation"][data-id="${t}"]`)}updateRemovedTrackedBarcodes(t){var i,n,r,l,d;let o=this.querySelectorAll("[data-identifier]");if(Object.keys(t.allTrackedBarcodes).length===0){for(let u of o)u.dataset.couldBeDeleted="true";(i=this.pendingDeletionTimeout)!=null&&i.running||(n=this.pendingDeletionTimeout)==null||n.start();return}let e=new Set(t.removedTrackedBarcodes);for(let u of o){let p=(r=u.dataset.identifier)==null?void 0:r.replace("-highlight","").replace("-annotation","");p!=null&&e.has(p)&&(u.dataset.couldBeDeleted="true");}(l=this.pendingDeletionTimeout)!=null&&l.running||(d=this.pendingDeletionTimeout)==null||d.start();}render(t){for(let[o,e]of Object.entries(t.allTrackedBarcodes)){t.addedTrackedBarcodes[o]!=null&&this.onHighlightsOrAnnotationForTrackedBarcode(e);let i=a$8(e.barcode),n=this.queryAnnotationByDataId(i),r=this.queryHighlightByDataId(i);r&&(this.updateBrushSize(r,e),this.updateHighlightPosition(e,r)),n&&this.updateAnnotationPosition(e,n,r);}this.updateRemovedTrackedBarcodes(t);}updateHighlightPosition(t,o,e="center"){if(o.hidden)return;let i=this.dataCaptureView.viewAnchorPositionsForFrameAnchorPositions(t.anchorPositions),n=this.normalizedViewPointFromFrameAnchorPositions(i,e);o.updatePosition(n,new Point(-50,-50),this.calculateRotationAngle(i.topLeft,i.topRight));}updateBrushSize(t,o){if(t.width==null||t.height==null)return;let e=this.dataCaptureView.viewAnchorPositionsForFrameAnchorPositions(o.anchorPositions),i=Math.round(calculateWidth(e)),n=Math.round(calculateHeight(e));t.width!==i&&(t.width=i),t.height!==n&&(t.height=n);}getTransformOrigin(t){return {"top-center":new Point(-50,0),"bottom-center":new Point(-50,-100),"left-center":new Point(0,-50),"right-center":new Point(-100,-50)}[t]}calculateAnnotationPosition(t,o,e){var p,f;let n=t.orderVerticesByPosition(),r=this.normalizedViewPointFromFrameAnchorPositions(t,"center"),d={"bottom-center":()=>{let s=this.normalizedViewPointFromFrameAnchorPositions(n,"topCenter");return new Point(s.x,s.y-7)},"top-center":()=>{let s=this.normalizedViewPointFromFrameAnchorPositions(n,"bottomCenter");return new Point(s.x,s.y+7)},"right-center":()=>{let s=this.normalizedViewPointFromFrameAnchorPositions(n,"centerLeft");return new Point(s.x-7,s.y)},"left-center":()=>{let s=this.normalizedViewPointFromFrameAnchorPositions(n,"centerRight");return new Point(s.x+7,s.y)}}[o]();return e?e instanceof b$1?(p={"bottom-center":new Point(r.x,r.y-7-e.clientHeight/2),"top-center":new Point(r.x,r.y+7+e.clientHeight/2),"right-center":new Point(r.x-7-e.clientWidth/2,r.y),"left-center":new Point(r.x+7+e.clientWidth/2,r.y)}[o])!=null?p:d:(f={"bottom-center":new Point(r.x,r.y-7-e.clientHeight/2),"top-center":new Point(r.x,r.y+7+e.clientHeight/2),"right-center":new Point(r.x-7-e.clientWidth/2,r.y),"left-center":new Point(r.x+7+e.clientWidth/2,r.y)}[o])!=null?f:d:d}updateAnnotationPosition(t,o,e){let i=this.dataCaptureView.viewAnchorPositionsForFrameAnchorPositions(t.anchorPositions);if(o.anchor||(o.anchor="top-center"),o.annotationVariation!=null){let l=this.getAnnotationVariationForQuad(t,a$5.threshold);o.annotationVariation=l;}let n=this.getTransformOrigin(o.anchor),r=this.calculateAnnotationPosition(i,o.anchor,e);o.updatePosition(r,n,this.calculateRotationAngle(i.topLeft,i.topRight));}normalizedViewPointFromFrameAnchorPositions(t,o="center"){let e=this.presenter.currentCamera.getMirrorImageEnabled(),i=new Size(this.dataCaptureView.width,this.dataCaptureView.height);if(e){let r=t[{centerLeft:"centerRight",centerRight:"centerLeft",center:"center",topCenter:"topCenter",bottomCenter:"bottomCenter"}[o]];return Point.mirrorX(r,i)}return t[o]}calculateRotationAngle(t,o){let e=o.x-t.x,n=this.presenter.isCameraMirrored()?-(o.y-t.y):o.y-t.y,r=Math.atan2(n,e);return Math.round(r*(180/Math.PI))}};c.tag="scandit-barcode-ar-view";var k=c;export{k as a};
@@ -1,2 +1,2 @@
1
- import {a as a$1,b as b$2}from'./chunk-OPL5NVVM.js';import {b as b$1}from'./chunk-NZCSU4S2.js';import {b}from'./chunk-LGPC7KMW.js';import {a as a$2}from'./chunk-T2Y2C76P.js';import {e,f as f$1,a,b as b$3,d,c as c$1}from'./chunk-DVHTYKDX.js';import {f}from'./chunk-YBD5JYCX.js';import {Point}from'@scandit/web-datacapture-core';import {ScanditHTMLElement,defineCustomElements,safeCancelAnimation,html}from'@scandit/web-datacapture-core/build/js/private/utils/index.js';var c=class b$4 extends ScanditHTMLElement{constructor(){super(...arguments);this._pointerDownListener=this.onPointerDown.bind(this);this._pointerUpListener=this.onPointerUp.bind(this);this._longPressController=new b(this);this._longPressStartListener=this.onLongPressStart.bind(this);}get minimized(){return !this.hasAttribute("expanded")}set minimized(t){this.toggleAttribute("minimized",!t);}get expanded(){return this.hasAttribute("expanded")}set expanded(t){this.toggleAttribute("expanded",t),this._dragController&&(this._dragController.margin=t?new Point(-65,-65):new Point(0,0),this._dragController.repositionIfOutOfBounds());}get pressed(){return this.hasAttribute("pressed")}set pressed(t){this.toggleAttribute("pressed",t);}get visible(){return this.hasAttribute("visible")}set visible(t){this.toggleAttribute("visible",t);}set useViewportBounds(t){this._dragController&&(this._dragController.useViewportBounds=t);}static create(){return defineCustomElements({[f]:b$4}),document.createElement(f)}connectedCallback(){var t;this.render(),this._dragController=new b$1(this,(t=this.parentElement)==null?void 0:t.parentElement),this._dragController.connect(),this.addEventListener("pointerdown",this._pointerDownListener),this.addEventListener("pointerup",this._pointerUpListener),this.addEventListener("longpressstart",this._longPressStartListener),this._longPressController.connect(),this._longPressController.elementsAllowedToTriggerLongPressEvents.add(this),this._pulse=this.querySelector(".pulse"),this._pulseAnimation=new Animation(new KeyframeEffect(this._pulse,[{background:"rgba(0, 0, 0, 0)"},{background:`var(${e})`,transform:"translate(-50%, -50%) scale(1.1)"},{background:"rgba(0, 0, 0, 0)"}],{duration:1100,easing:"ease-out",iterations:Number.POSITIVE_INFINITY}));}disconnectedCallback(){var t;this.removeEventListener("pointerdown",this._pointerDownListener),this.removeEventListener("pointerup",this._pointerUpListener),this.removeEventListener("longpressstart",this._longPressStartListener),(t=this._dragController)==null||t.disconnect(),this._longPressController.disconnect(),this.innerHTML="";}repositionIfOutOfBounds(){var t;(t=this._dragController)==null||t.repositionIfOutOfBounds();}translateTo(t){var i;(i=this._dragController)==null||i.translateTo(t,false);}setImage(t){var n;let i=this.querySelector("div");(n=i.firstElementChild)==null||n.remove(),t&&i.append(t);}startPulsating(){var t;(t=this._pulseAnimation)==null||t.play();}stopPulsating(){this._pulseAnimation&&(safeCancelAnimation(this._pulseAnimation),this._pulseAnimation.currentTime=0);}render(){this.innerHTML=html`<div><div class="pulse"></div><svg width="49" height="26" viewBox="0 0 49 26" fill="none" xmlns="http://www.w3.org/2000/svg"><rect x="7.57422" y="-0.00390625" width="3.20017" height="25.7171" rx="0.5" fill="white" style="fill:var(${f$1})"/><path d="M44.8418 0.496094C44.8418 0.219952 45.0657 -0.00390625 45.3418 -0.00390625H48.001C48.2771 -0.00390625 48.501 0.219951 48.501 0.496094V25.2132C48.501 25.4894 48.2771 25.7132 48.001 25.7132H45.3418C45.0657 25.7132 44.8418 25.4894 44.8418 25.2132V0.496094Z" fill="white" style="fill:var(${f$1})"/><path d="M33.8271 0.896094C33.8271 0.399038 34.2301 -0.00390625 34.7271 -0.00390625H39.1368C39.6338 -0.00390625 40.0368 0.399038 40.0368 0.896094V24.8132C40.0368 25.3103 39.6338 25.7132 39.1368 25.7132H34.7271C34.2301 25.7132 33.8271 25.3103 33.8271 24.8132V0.896094Z" fill="white" style="fill:var(${f$1})"/><path d="M16.3154 0.746095C16.3154 0.331881 16.6512 -0.00390625 17.0654 -0.00390625H20.1879C20.6021 -0.00390625 20.9379 0.33188 20.9379 0.746094V24.9632C20.9379 25.3774 20.6021 25.7132 20.1879 25.7132H17.0654C16.6512 25.7132 16.3154 25.3774 16.3154 24.9632V0.746095Z" fill="white" style="fill:var(${f$1})"/><path d="M0.5 0.246094C0.5 0.108023 0.611929 -0.00390625 0.75 -0.00390625H2.2897C2.42777 -0.00390625 2.5397 0.108023 2.5397 0.246094V25.4632C2.5397 25.6013 2.42777 25.7132 2.2897 25.7132H0.75C0.611929 25.7132 0.5 25.6013 0.5 25.4632V0.246094Z" fill="white" style="fill:var(${f$1})"/><rect x="25.9688" y="-0.00390625" width="3.05794" height="25.7171" rx="0.5" fill="white" style="fill:var(${f$1})"/></svg></div><style>${f}{position:absolute;top:0;left:0;width:90px;height:90px;display:none;background:rgba(0,0,0,0);border-radius:50%;z-index:10}${f}[unconstrained]{position:fixed;z-index:9999}${f}[expanded]{width:220px;height:220px;margin-top:-65px;margin-left:-65px}${f}[visible]{display:flex;justify-content:center;align-items:center}${f} div{position:relative;width:90px;height:90px;background:var(${a});border-radius:50%;filter:drop-shadow(0px 2px 6px #${a$1.toJSON()}) drop-shadow(0px 1px 2px #${b$2.toJSON()});transition:filter .3s ease}${f} div .pulse{position:absolute;top:50%;left:50%;width:100%;height:100%;background:0 0;opacity:.3;pointer-events:none;transform:translate(-50%,-50%);z-index:-1}${f}[pressed] div{background:var(${b$3});filter:drop-shadow(0px 4px 4px #${a$1.toJSON()}) drop-shadow(0px 8px 12px #${b$2.toJSON()})}${f}[pressed][expanded] div{background:var(${d})}${f}[expanded] div{width:200px;height:200px;background:var(${c$1})}${f} div img,${f} div svg{position:absolute;top:50%;left:50%;width:100%;height:auto;max-width:48px;max-height:48px;transform:translate(-50%,-50%)}${f}[expanded] div img,${f}[expanded] div svg{max-width:64px;max-height:64px}</style>`;}onPointerDown(t){t instanceof PointerEvent&&(this._dragController&&(this._dragController.draggable=this.minimized),this._holdStart=Date.now(),this.setPointerCapture(t.pointerId));}onPointerUp(t){var i;if(t instanceof PointerEvent){let n=this._holdStart!=null&&Date.now()-this._holdStart<400,f=!((i=this._dragController)!=null&&i.pointerDownEvent)||!a$2(this._dragController.pointerDownEvent,t);n&&f&&this.dispatchEvent(new CustomEvent("tap")),this.pressed=false,this._holdStart=void 0,this.releasePointerCapture(t.pointerId);}}onLongPressStart(){this._dragController&&(this._dragController.draggable=true),this.pressed=true,this._holdStart=void 0;}};
1
+ import {b as b$1}from'./chunk-NZCSU4S2.js';import {b}from'./chunk-LGPC7KMW.js';import {a as a$2}from'./chunk-T2Y2C76P.js';import {a as a$1,b as b$2}from'./chunk-OPL5NVVM.js';import {e,f as f$1,a,b as b$3,d,c as c$1}from'./chunk-DVHTYKDX.js';import {f}from'./chunk-YBD5JYCX.js';import {Point}from'@scandit/web-datacapture-core';import {ScanditHTMLElement,defineCustomElements,safeCancelAnimation,html}from'@scandit/web-datacapture-core/build/js/private/utils/index.js';var c=class b$4 extends ScanditHTMLElement{constructor(){super(...arguments);this._pointerDownListener=this.onPointerDown.bind(this);this._pointerUpListener=this.onPointerUp.bind(this);this._longPressController=new b(this);this._longPressStartListener=this.onLongPressStart.bind(this);}get minimized(){return !this.hasAttribute("expanded")}set minimized(t){this.toggleAttribute("minimized",!t);}get expanded(){return this.hasAttribute("expanded")}set expanded(t){this.toggleAttribute("expanded",t),this._dragController&&(this._dragController.margin=t?new Point(-65,-65):new Point(0,0),this._dragController.repositionIfOutOfBounds());}get pressed(){return this.hasAttribute("pressed")}set pressed(t){this.toggleAttribute("pressed",t);}get visible(){return this.hasAttribute("visible")}set visible(t){this.toggleAttribute("visible",t);}set useViewportBounds(t){this._dragController&&(this._dragController.useViewportBounds=t);}static create(){return defineCustomElements({[f]:b$4}),document.createElement(f)}connectedCallback(){var t;this.render(),this._dragController=new b$1(this,(t=this.parentElement)==null?void 0:t.parentElement),this._dragController.connect(),this.addEventListener("pointerdown",this._pointerDownListener),this.addEventListener("pointerup",this._pointerUpListener),this.addEventListener("longpressstart",this._longPressStartListener),this._longPressController.connect(),this._longPressController.elementsAllowedToTriggerLongPressEvents.add(this),this._pulse=this.querySelector(".pulse"),this._pulseAnimation=new Animation(new KeyframeEffect(this._pulse,[{background:"rgba(0, 0, 0, 0)"},{background:`var(${e})`,transform:"translate(-50%, -50%) scale(1.1)"},{background:"rgba(0, 0, 0, 0)"}],{duration:1100,easing:"ease-out",iterations:Number.POSITIVE_INFINITY}));}disconnectedCallback(){var t;this.removeEventListener("pointerdown",this._pointerDownListener),this.removeEventListener("pointerup",this._pointerUpListener),this.removeEventListener("longpressstart",this._longPressStartListener),(t=this._dragController)==null||t.disconnect(),this._longPressController.disconnect(),this.innerHTML="";}repositionIfOutOfBounds(){var t;(t=this._dragController)==null||t.repositionIfOutOfBounds();}translateTo(t){var i;(i=this._dragController)==null||i.translateTo(t,false);}setImage(t){var n;let i=this.querySelector("div");(n=i.firstElementChild)==null||n.remove(),t&&i.append(t);}startPulsating(){var t;(t=this._pulseAnimation)==null||t.play();}stopPulsating(){this._pulseAnimation&&(safeCancelAnimation(this._pulseAnimation),this._pulseAnimation.currentTime=0);}render(){this.innerHTML=html`<div><div class="pulse"></div><svg width="49" height="26" viewBox="0 0 49 26" fill="none" xmlns="http://www.w3.org/2000/svg"><rect x="7.57422" y="-0.00390625" width="3.20017" height="25.7171" rx="0.5" fill="white" style="fill:var(${f$1})"/><path d="M44.8418 0.496094C44.8418 0.219952 45.0657 -0.00390625 45.3418 -0.00390625H48.001C48.2771 -0.00390625 48.501 0.219951 48.501 0.496094V25.2132C48.501 25.4894 48.2771 25.7132 48.001 25.7132H45.3418C45.0657 25.7132 44.8418 25.4894 44.8418 25.2132V0.496094Z" fill="white" style="fill:var(${f$1})"/><path d="M33.8271 0.896094C33.8271 0.399038 34.2301 -0.00390625 34.7271 -0.00390625H39.1368C39.6338 -0.00390625 40.0368 0.399038 40.0368 0.896094V24.8132C40.0368 25.3103 39.6338 25.7132 39.1368 25.7132H34.7271C34.2301 25.7132 33.8271 25.3103 33.8271 24.8132V0.896094Z" fill="white" style="fill:var(${f$1})"/><path d="M16.3154 0.746095C16.3154 0.331881 16.6512 -0.00390625 17.0654 -0.00390625H20.1879C20.6021 -0.00390625 20.9379 0.33188 20.9379 0.746094V24.9632C20.9379 25.3774 20.6021 25.7132 20.1879 25.7132H17.0654C16.6512 25.7132 16.3154 25.3774 16.3154 24.9632V0.746095Z" fill="white" style="fill:var(${f$1})"/><path d="M0.5 0.246094C0.5 0.108023 0.611929 -0.00390625 0.75 -0.00390625H2.2897C2.42777 -0.00390625 2.5397 0.108023 2.5397 0.246094V25.4632C2.5397 25.6013 2.42777 25.7132 2.2897 25.7132H0.75C0.611929 25.7132 0.5 25.6013 0.5 25.4632V0.246094Z" fill="white" style="fill:var(${f$1})"/><rect x="25.9688" y="-0.00390625" width="3.05794" height="25.7171" rx="0.5" fill="white" style="fill:var(${f$1})"/></svg></div><style>${f}{position:absolute;top:0;left:0;width:90px;height:90px;display:none;background:rgba(0,0,0,0);border-radius:50%;z-index:10}${f}[unconstrained]{position:fixed;z-index:9999}${f}[expanded]{width:220px;height:220px;margin-top:-65px;margin-left:-65px}${f}[visible]{display:flex;justify-content:center;align-items:center}${f} div{position:relative;width:90px;height:90px;background:var(${a});border-radius:50%;filter:drop-shadow(0px 2px 6px #${a$1.toJSON()}) drop-shadow(0px 1px 2px #${b$2.toJSON()});transition:filter .3s ease}${f} div .pulse{position:absolute;top:50%;left:50%;width:100%;height:100%;background:0 0;opacity:.3;pointer-events:none;transform:translate(-50%,-50%);z-index:-1}${f}[pressed] div{background:var(${b$3});filter:drop-shadow(0px 4px 4px #${a$1.toJSON()}) drop-shadow(0px 8px 12px #${b$2.toJSON()})}${f}[pressed][expanded] div{background:var(${d})}${f}[expanded] div{width:200px;height:200px;background:var(${c$1})}${f} div img,${f} div svg{position:absolute;top:50%;left:50%;width:100%;height:auto;max-width:48px;max-height:48px;transform:translate(-50%,-50%)}${f}[expanded] div img,${f}[expanded] div svg{max-width:64px;max-height:64px}</style>`;}onPointerDown(t){t instanceof PointerEvent&&(this._dragController&&(this._dragController.draggable=this.minimized),this._holdStart=Date.now(),this.setPointerCapture(t.pointerId));}onPointerUp(t){var i;if(t instanceof PointerEvent){let n=this._holdStart!=null&&Date.now()-this._holdStart<400,f=!((i=this._dragController)!=null&&i.pointerDownEvent)||!a$2(this._dragController.pointerDownEvent,t);n&&f&&this.dispatchEvent(new CustomEvent("tap")),this.pressed=false,this._holdStart=void 0,this.releasePointerCapture(t.pointerId);}}onLongPressStart(){this._dragController&&(this._dragController.draggable=true),this.pressed=true,this._holdStart=void 0;}};
2
2
  export{c as a};
@@ -1 +1 @@
1
- import {a}from'./chunk-VLGDYIWY.js';import {TorchState,isCameraFrameSource,Camera,CameraPosition,FrameSourceState}from'@scandit/web-datacapture-core';var l=class{constructor(e,t,a,o,r){this.torchState=TorchState.Off;this.cameraSupportMap=new Map;this.zoomFactor=1;this.cameras=[];this.view=e,this.context=t,this.barcodeAr=a,this.viewSettings=o,this.cameraSettings=r;}get currentCamera(){if(isCameraFrameSource(this.context.frameSource))return this.context.frameSource;throw new Error("The current frame source is not a Camera")}isCameraMirrored(){return this.currentCamera.getMirrorImageEnabled()}async prepare(){var a$1,o,r;await this.barcodeAr.setEnabled(false),this.barcodeAr.feedback=await a.createWithOptions(true,true),this.barcodeAr.addPrivateListener(this),this.cameras=await Camera.getAll(false,isCameraFrameSource(this.context.frameSource));let e=isCameraFrameSource(this.context.frameSource)?this.context.frameSource:(r=(o=(a$1=this.cameras.find(s=>s.position===this.viewSettings.defaultCameraPosition))!=null?a$1:this.cameras.find(s=>s.position===(this.viewSettings.defaultCameraPosition===CameraPosition.WorldFacing?CameraPosition.UserFacing:CameraPosition.WorldFacing)))!=null?o:this.cameras[0])!=null?r:Camera.pickBestGuess();await this.context.setFrameSource(e),await this.currentCamera.applySettings(this.cameraSettings),await this.currentCamera.switchToDesiredState(FrameSourceState.Standby),this.zoomFactor=this.currentCamera.settings.zoomFactor,this.view.changeZoomButtonIcon(this.zoomFactor);let t=await this.isTorchAvailableForCurrentCamera();this.view.setTorchAvailable(t);}async dispose(){var e;this.view.deleteAllViews(),await this.context.removeMode(this.barcodeAr),this.barcodeAr.removePrivateListener(this),await((e=this.context.frameSource)==null?void 0:e.switchToDesiredState(FrameSourceState.Off));}async startSearching(){var e;this.view.deleteAllViews(),await((e=this.context.frameSource)==null?void 0:e.switchToDesiredState(FrameSourceState.On)),await this.barcodeAr.setEnabled(true),await this.barcodeAr.start();}async stopSearching(){var e;this.view.deleteAllViews(),await((e=this.context.frameSource)==null?void 0:e.switchToDesiredState(FrameSourceState.Off)),await this.barcodeAr.setEnabled(false),await this.barcodeAr.stop();}async pauseSearching(){var e;this.view.deletePendingViews(),await((e=this.context.frameSource)==null?void 0:e.switchToDesiredState(FrameSourceState.Standby)),await this.barcodeAr.setEnabled(false),await this.barcodeAr.pause();}emitTappedFeedback(){this.barcodeAr.feedback.tapped.emit();}didUpdateSession(e,t){Object.keys(t.addedTrackedBarcodes).length>0&&this.barcodeAr.feedback.scanned.emit(),this.view.render(t);}async isTorchAvailableForCurrentCamera(){let e=this.currentCamera.label,t=this.cameraSupportMap.get(e);if(t!==void 0)return t.torch;let a=await this.currentCamera.isTorchAvailable();return this.cameraSupportMap.set(e,{torch:a}),a}async onTorchButtonClicked(){let e=await this.isTorchAvailableForCurrentCamera();this.view.setTorchAvailable(e),e&&(await this.currentCamera.setDesiredTorchState(this.torchState===TorchState.Off?TorchState.On:TorchState.Off),this.torchState=this.torchState===TorchState.Off?TorchState.On:TorchState.Off,this.view.toggleTorchIcon(this.torchState));}async onZoomButtonClicked(){var t;if(!this.currentCamera.isZoomAvailable())return;let e=(t={1:2,2:1}[this.zoomFactor])!=null?t:1;this.currentCamera.settings.zoomFactor=e,await this.currentCamera.applySettings(this.currentCamera.settings),this.zoomFactor=e,this.view.changeZoomButtonIcon(e);}async onCameraSwitchButtonClicked(){var r,s;let e=this.currentCamera.getCurrentState(),t=this.currentCamera.position===CameraPosition.UserFacing?CameraPosition.WorldFacing:CameraPosition.UserFacing,a=(s=(r=this.cameras.find(u=>u.position===t))!=null?r:this.cameras[0])!=null?s:Camera.pickBestGuessForPosition(t);await this.context.setFrameSource(a),await this.currentCamera.switchToDesiredState(e);let o=await this.isTorchAvailableForCurrentCamera();this.view.setTorchAvailable(o);}};export{l as a};
1
+ import {a}from'./chunk-Z2LBBBJM.js';import {TorchState,isCameraFrameSource,Camera,CameraPosition,FrameSourceState}from'@scandit/web-datacapture-core';var l=class{constructor(e,t,a,o,r){this.torchState=TorchState.Off;this.cameraSupportMap=new Map;this.zoomFactor=1;this.cameras=[];this.view=e,this.context=t,this.barcodeAr=a,this.viewSettings=o,this.cameraSettings=r;}get currentCamera(){if(isCameraFrameSource(this.context.frameSource))return this.context.frameSource;throw new Error("The current frame source is not a Camera")}isCameraMirrored(){return this.currentCamera.getMirrorImageEnabled()}async prepare(){var a$1,o,r;await this.barcodeAr.setEnabled(false),this.barcodeAr.feedback=await a.createWithOptions(true,true),this.barcodeAr.addPrivateListener(this),this.cameras=await Camera.getAll(false,isCameraFrameSource(this.context.frameSource));let e=isCameraFrameSource(this.context.frameSource)?this.context.frameSource:(r=(o=(a$1=this.cameras.find(s=>s.position===this.viewSettings.defaultCameraPosition))!=null?a$1:this.cameras.find(s=>s.position===(this.viewSettings.defaultCameraPosition===CameraPosition.WorldFacing?CameraPosition.UserFacing:CameraPosition.WorldFacing)))!=null?o:this.cameras[0])!=null?r:Camera.pickBestGuess();await this.context.setFrameSource(e),await this.currentCamera.applySettings(this.cameraSettings),await this.currentCamera.switchToDesiredState(FrameSourceState.Standby),this.zoomFactor=this.currentCamera.settings.zoomFactor,this.view.changeZoomButtonIcon(this.zoomFactor);let t=await this.isTorchAvailableForCurrentCamera();this.view.setTorchAvailable(t);}async dispose(){var e;this.view.deleteAllViews(),await this.context.removeMode(this.barcodeAr),this.barcodeAr.removePrivateListener(this),await((e=this.context.frameSource)==null?void 0:e.switchToDesiredState(FrameSourceState.Off));}async startSearching(){var e;this.view.deleteAllViews(),await((e=this.context.frameSource)==null?void 0:e.switchToDesiredState(FrameSourceState.On)),await this.barcodeAr.setEnabled(true),await this.barcodeAr.start();}async stopSearching(){var e;this.view.deleteAllViews(),await((e=this.context.frameSource)==null?void 0:e.switchToDesiredState(FrameSourceState.Off)),await this.barcodeAr.setEnabled(false),await this.barcodeAr.stop();}async pauseSearching(){var e;this.view.deletePendingViews(),await((e=this.context.frameSource)==null?void 0:e.switchToDesiredState(FrameSourceState.Standby)),await this.barcodeAr.setEnabled(false),await this.barcodeAr.pause();}emitTappedFeedback(){this.barcodeAr.feedback.tapped.emit();}didUpdateSession(e,t){Object.keys(t.addedTrackedBarcodes).length>0&&this.barcodeAr.feedback.scanned.emit(),this.view.render(t);}async isTorchAvailableForCurrentCamera(){let e=this.currentCamera.label,t=this.cameraSupportMap.get(e);if(t!==void 0)return t.torch;let a=await this.currentCamera.isTorchAvailable();return this.cameraSupportMap.set(e,{torch:a}),a}async onTorchButtonClicked(){let e=await this.isTorchAvailableForCurrentCamera();this.view.setTorchAvailable(e),e&&(await this.currentCamera.setDesiredTorchState(this.torchState===TorchState.Off?TorchState.On:TorchState.Off),this.torchState=this.torchState===TorchState.Off?TorchState.On:TorchState.Off,this.view.toggleTorchIcon(this.torchState));}async onZoomButtonClicked(){var t;if(!this.currentCamera.isZoomAvailable())return;let e=(t={1:2,2:1}[this.zoomFactor])!=null?t:1;this.currentCamera.settings.zoomFactor=e,await this.currentCamera.applySettings(this.currentCamera.settings),this.zoomFactor=e,this.view.changeZoomButtonIcon(e);}async onCameraSwitchButtonClicked(){var r,s;let e=this.currentCamera.getCurrentState(),t=this.currentCamera.position===CameraPosition.UserFacing?CameraPosition.WorldFacing:CameraPosition.UserFacing,a=(s=(r=this.cameras.find(u=>u.position===t))!=null?r:this.cameras[0])!=null?s:Camera.pickBestGuessForPosition(t);await this.context.setFrameSource(a),await this.currentCamera.switchToDesiredState(e);let o=await this.isTorchAvailableForCurrentCamera();this.view.setTorchAvailable(o);}};export{l as a};
@@ -1 +1 @@
1
- import {a 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};
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 +1 @@
1
- import {a as a$1}from'./chunk-Z4OVKU6T.js';import {a}from'./chunk-LKZBVQXD.js';import {Localization}from'@scandit/web-datacapture-core';import {normalizeLibraryLocation}from'@scandit/web-datacapture-core/build/js/private/Helper.js';function y(r){return Localization.getInstance().updateIfMissing({...a}),r!=null&&r.libraryLocation&&(r.libraryLocation=normalizeLibraryLocation(r.libraryLocation)),{moduleName:"BarcodeCapture",load:async d=>{var e,o;let a=d;return await a$1.create({...a,libraryLocation:(e=r==null?void 0:r.libraryLocation)!=null?e:a.libraryLocation,highEndBlurryRecognition:(o=r==null?void 0:r.highEndBlurryRecognition)!=null?o:false})}}}export{y as a};
1
+ import {a as a$1}from'./chunk-IYVUSV45.js';import {a}from'./chunk-LKZBVQXD.js';import {Localization}from'@scandit/web-datacapture-core';import {normalizeLibraryLocation}from'@scandit/web-datacapture-core/build/js/private/Helper.js';function y(r){return Localization.getInstance().updateIfMissing({...a}),r!=null&&r.libraryLocation&&(r.libraryLocation=normalizeLibraryLocation(r.libraryLocation)),{moduleName:"BarcodeCapture",load:async d=>{var e,o;let a=d;return await a$1.create({...a,libraryLocation:(e=r==null?void 0:r.libraryLocation)!=null?e:a.libraryLocation,highEndBlurryRecognition:(o=r==null?void 0:r.highEndBlurryRecognition)!=null?o:false})}}}export{y as a};
@@ -1 +1 @@
1
- import {a as a$1}from'./chunk-SNPWBV7Y.js';import {b}from'./chunk-TCXM24SN.js';import {a}from'./chunk-VLGDYIWY.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-Z2LBBBJM.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}from'./chunk-YTPS5MHJ.js';import {a as a$3}from'./chunk-FBW5J2QT.js';import {a as a$2}from'./chunk-QTKRK537.js';import {a as a$4}from'./chunk-SLZMFNXI.js';import {a as a$1}from'./chunk-2ZSOWJ2F.js';import {b}from'./chunk-OCYHIAM2.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?"6ea5df9121d5c015e1d5bdfa8afb5d3eed4452c187c3e7e3c8c7d095f279279f":"8c9907fe8bea3dfb7b4aad8b2fd59f8dd0278ac81452e864f5827eba99321480":e?"7cd946e7149a606b34879c4cfe8c563a633e86044702b76a2d2a1d4e69c1971c":"c820e8a917292c0cc7819b025602e71fa334e1a864c51a28329cb8b31374489d"}getWasmMetadata(){return b}};export{c as a};
1
+ import {a}from'./chunk-YTPS5MHJ.js';import {a as a$3}from'./chunk-FBW5J2QT.js';import {a as a$2}from'./chunk-QTKRK537.js';import {a as a$4}from'./chunk-SLZMFNXI.js';import {a as a$1}from'./chunk-2ZSOWJ2F.js';import {b}from'./chunk-F4ZXJ2AL.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?"44eadcb5e36da3e39236c267d022d41b21155b628056947f2efd7b89ce2d3d4c":"a9ec86f920e77189b02053f014e21e3547323b1351599a6bdf8ac3acfc8fd9e3":e?"4226e9075d67fb4f8194a6296637f1ca8701d33a33990b54036df465ad172257":"a0808725b47747c68979103ca9850b71ac36621a8438b27987a9816e5ba1058c"}getWasmMetadata(){return b}};export{c as a};
@@ -1 +1 @@
1
- export{a as defaultSparkCapture}from'../chunks/chunk-J3R5M6PN.js';export{a as defaultSparkScan}from'../chunks/chunk-HDODW33D.js';export{a as defaultBarcodeFind}from'../chunks/chunk-DHKABHFE.js';export{a as defaultSymbologies}from'../chunks/chunk-LLMMR2TB.js';export{a as defaultBarcodeCapture}from'../chunks/chunk-3YNK2VJA.js';export{a as defaultBarcodeBatch}from'../chunks/chunk-CHU6GKFW.js';
1
+ export{a as defaultSparkCapture}from'../chunks/chunk-J3R5M6PN.js';export{a as defaultBarcodeFind}from'../chunks/chunk-DHKABHFE.js';export{a as defaultSparkScan}from'../chunks/chunk-HDODW33D.js';export{a as defaultSymbologies}from'../chunks/chunk-LLMMR2TB.js';export{a as defaultBarcodeCapture}from'../chunks/chunk-3YNK2VJA.js';export{a as defaultBarcodeBatch}from'../chunks/chunk-CHU6GKFW.js';
@@ -1 +1 @@
1
- export{a as BarcodeFind}from'../chunks/chunk-2PM6DH45.js';
1
+ export{a as BarcodeFind}from'../chunks/chunk-R3MQ2GAV.js';
@@ -1 +1 @@
1
- export{a as BarcodeFindView}from'../chunks/chunk-A5R67FIL.js';
1
+ export{a as BarcodeFindView}from'../chunks/chunk-J4KUL4XN.js';
@@ -1 +1 @@
1
- export{a as BarcodeFindView}from'../chunks/chunk-A5R67FIL.js';export{a as BarcodeFind}from'../chunks/chunk-2PM6DH45.js';export{a as BarcodeFindItem,c as BarcodeFindItemContent,b as BarcodeFindItemSearchOptions}from'../chunks/chunk-HTKUJZG2.js';export{a as BarcodeFindViewSettings}from'../chunks/chunk-4PTIOBXM.js';export{a as BarcodeFindSettings}from'../chunks/chunk-7L2BXR3E.js';
1
+ export{a as BarcodeFindSettings}from'../chunks/chunk-7L2BXR3E.js';export{a as BarcodeFindView}from'../chunks/chunk-J4KUL4XN.js';export{a as BarcodeFind}from'../chunks/chunk-R3MQ2GAV.js';export{a as BarcodeFindItem,c as BarcodeFindItemContent,b as BarcodeFindItemSearchOptions}from'../chunks/chunk-HTKUJZG2.js';export{a as BarcodeFindViewSettings}from'../chunks/chunk-4PTIOBXM.js';