@scandit/web-datacapture-barcode 7.6.1 → 7.6.3
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.
- package/build/js/ar/BarcodeAr.js +1 -1
- package/build/js/ar/BarcodeArFeedback.js +1 -1
- package/build/js/ar/BarcodeArPresenter.js +1 -1
- package/build/js/ar/BarcodeArView.js +1 -1
- package/build/js/chunks/{chunk-LRX7OEVG.js → chunk-2DOK6PMQ.js} +1 -1
- package/build/js/chunks/{chunk-NIO3PMWV.js → chunk-44A2C43B.js} +1 -1
- package/build/js/chunks/chunk-4DK52S3S.js +1 -0
- package/build/js/chunks/{chunk-IBYGNNYH.js → chunk-AATIU42U.js} +1 -1
- package/build/js/chunks/{chunk-6SURH53X.js → chunk-AO7NE6M4.js} +1 -3
- package/build/js/chunks/{chunk-UNW3DDTC.js → chunk-BPLI67IL.js} +1 -1
- package/build/js/chunks/{chunk-IGVLJFSQ.js → chunk-CF6ETO3C.js} +1 -1
- package/build/js/chunks/{chunk-TCOXR6SM.js → chunk-GAASASQE.js} +1 -1
- package/build/js/chunks/chunk-KAEWVPFY.js +7 -0
- package/build/js/chunks/{chunk-F4ER57PM.js → chunk-MXII5PJI.js} +1 -1
- package/build/js/chunks/{chunk-AAXGDI2V.js → chunk-RBH6OGXU.js} +1 -1
- package/build/js/chunks/{chunk-ZZ64BDE5.js → chunk-TSG4ZHM6.js} +1 -1
- package/build/js/chunks/chunk-WGZHL6TO.js +16 -0
- package/build/js/chunks/{chunk-RERRFDJ6.js → chunk-YPBX2TPG.js} +1 -1
- package/build/js/chunks/{chunk-KVPRRTFE.js → chunk-YU64MALU.js} +1 -1
- package/build/js/find/BarcodeFindView.js +1 -1
- package/build/js/find/index.js +1 -1
- package/build/js/find/ui/atoms/BarcodeSvgIcon.d.ts +15 -0
- package/build/js/find/ui/atoms/BarcodeSvgIcon.js +1 -0
- package/build/js/find/ui/molecules/ImageAndTextCardLayout.js +1 -1
- package/build/js/index.js +1 -1
- package/build/js/moduleLoader.js +1 -1
- package/build/js/spark/index.js +1 -1
- package/build/js/spark/ui/SparkScanView.js +1 -1
- package/build/js/spark/ui/SparkScanViewMiniPreview.js +1 -1
- package/build/js/spark/ui/SparkScanViewPresenter.js +1 -1
- package/build/js/spark/ui/SparkScanViewTriggerButton.js +1 -1
- package/build/js/spark/ui/index.js +1 -1
- package/build/js/worker/BarcodeCaptureWorkerManager.js +1 -1
- package/build/js/worker/WorkerMain.js +1 -1
- package/build/js/worker/barcodeCapture.inlineWorker.js +1 -1
- package/build/js/worker/dataCaptureEngine.js +1 -1
- package/package.json +2 -2
- package/sdc-lib/scandit-datacapture-sdk-barcode-pthreads.js +1 -1
- package/sdc-lib/scandit-datacapture-sdk-barcode-pthreads.wasm +0 -0
- package/sdc-lib/scandit-datacapture-sdk-barcode-simd-pthreads.js +1 -1
- package/sdc-lib/scandit-datacapture-sdk-barcode-simd-pthreads.wasm +0 -0
- package/sdc-lib/scandit-datacapture-sdk-barcode-simd.js +1 -1
- package/sdc-lib/scandit-datacapture-sdk-barcode-simd.wasm +0 -0
- package/sdc-lib/scandit-datacapture-sdk-barcode.js +1 -1
- package/sdc-lib/scandit-datacapture-sdk-barcode.wasm +0 -0
- package/build/js/chunks/chunk-AS2CRCYP.js +0 -1
- package/build/js/chunks/chunk-FMC4G2U5.js +0 -7
- /package/build/js/chunks/{chunk-EDRUOAO6.js → chunk-U4SUPIV3.js} +0 -0
package/build/js/ar/BarcodeAr.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export{a as BarcodeAr}from'../chunks/chunk-
|
|
1
|
+
export{a as BarcodeAr}from'../chunks/chunk-GAASASQE.js';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export{a as BarcodeArFeedback}from'../chunks/chunk-
|
|
1
|
+
export{a as BarcodeArFeedback}from'../chunks/chunk-U4SUPIV3.js';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export{a as BarcodeArPresenter}from'../chunks/chunk-
|
|
1
|
+
export{a as BarcodeArPresenter}from'../chunks/chunk-YPBX2TPG.js';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export{a as BarcodeArView}from'../chunks/chunk-
|
|
1
|
+
export{a as BarcodeArView}from'../chunks/chunk-BPLI67IL.js';
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import {DataCaptureLoader,Logger}from'@scandit/web-datacapture-core';function n(r){let s=URL.createObjectURL(new Blob(['"use strict";(()=>{var p={"scandit-datacapture-sdk-barcode-simd-pthreads.wasm":{bytes:7161844},"scandit-datacapture-sdk-barcode-simd.wasm":{bytes:7045258},"scandit-datacapture-sdk-barcode.wasm":{bytes:7108746},"scandit-datacapture-sdk-barcode-pthreads.wasm":{bytes:7224995}};function F(t){return typeof t=="object"&&t!=null}function C(t){if(typeof t=="string")return t;if(F(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=>{(c=>(c.Debug="debug",c.Info="info",c.Warn="warn",c.Error="error",c.Quiet="quiet"))(t.Level||(t.Level={}));let e=new Map([["debug",1],["info",2],["warn",3],["error",4],["quiet",5]]),r="debug";function a(c){r=c}t.setLevel=a;function i(c,...h){if(!(e.get(r)>e.get(c)))switch(c){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(...c){i("warn",...c)}t.warn=s;function n(...c){i("debug",...c)}t.debug=n;function o(...c){i("info",...c)}t.info=o;function l(...c){i("error",...c)}t.error=l})(d||(d={}));var O=class ee extends Error{constructor(e){super(e.message),Object.setPrototypeOf(this,ee.prototype),this.name=e.name}toString(){return`${this.name}: ${this.message}`}};var P=Promise.resolve(),G=!1,$=!1,k,j={writableDataPath:""};async function te(t){if(k==null)return;G=!0;let e=new Promise((r,a)=>{setTimeout(()=>{a(new O({name:"BlockedIndexedDB",message:"IndexedDB database is blocked"}))},1500)});try{await Promise.race([new Promise((r,a)=>{k==null||k(t,i=>{if(i!=null){a(i);return}r()})}),e])}finally{G=!1}}async function re(t){return $||(G?($=!0,P=P.then(async()=>($=!1,te(t)))):P=te(t)),P}async function ae(t){j=t,k=FS.syncfs,FS.syncfs=(e,r)=>{let a=r,i=()=>{a()},s=n=>{a(n)};re(e).then(i).catch(s)};try{FS.mkdir(j.writableDataPath)}catch(e){if(e.code!=="EEXIST")throw k=void 0,e}return FS.mount(IDBFS,{},j.writableDataPath),re(!0)}var ie={};function Oe(t){return[...new Uint8Array(t)].map(e=>{let r=e.toString(16);return r.length===1?`0${r}`:r}).join("")}async function*Pe(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 Te(t){let e=[],r=0,a=0;for await(let s of Pe(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 Ie=(t=>(t.VALID="VALID",t.INVALID="INVALID",t.NOT_VERIFIABLE="NOT_VERIFIABLE",t))(Ie||{});async function Le(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=Oe(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 q=new Map([["br",4.4],["gzip",2.9],["none",1]]);function We(t){var e;let r="content-encoding";if(t==null||t.get(r)==null)return q.get("none");let a=new Set(((e=t.get(r))!=null?e:"").split(",").map(i=>i.trim()));for(let[i,s]of q)if(a.has(i))return s;return q.get("none")}function Ee(t){var e,r;if(t==null)return 0;let a=(e=We(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 Re(t){let{pathname:e}=new URL(t);for(let[r,a]of Object.entries(ie))if(e.endsWith(r))return a.bytes;return 0}function se(t){ie=t}var Ne=(t,e)=>{let r=Ee(e);return r===0?Re(t):r};function He(t,e,r,{onProgress:a,onError:i,onComplete:s}){if(!e.body)return[e];let n=Ne(t,e.headers),o=0,l=0;if(typeof TransformStream>"u")return d.warn("TransformStream is not supported in this environment. Progress tracking will be disabled."),[e];let[c,h]=r?e.body.tee():[e.body],m=c.pipeThrough(new TransformStream({async transform(b,g){try{o+=b.length,l=Number((o/n*100).toFixed(2)),n>0&&b.length>0&&l<100?a==null||a({percentage:l,loadedBytes:o,privateUri:t}):n===0&&b.length>0&&(a==null||a({percentage:null,loadedBytes:o,privateUri:t})),g.enqueue(b)}catch(w){g.error(w),i==null||i({error:w})}},flush(b){a==null||a({percentage:100,loadedBytes:o,privateUri:t}),s==null||s({percentage:100,loadedBytes:o,privateUri:t}),b.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:n}){let o=await fetch(t,{referrerPolicy:"origin",referrer:n!=null?n:""});if(!o.ok)throw new Error(`HTTP status code is not ok: ${o.status}, ${o.statusText}`);let[l,c]=He(t,o,r,{onProgress:a,onError:s,onComplete:i});return c!=null&&Le(Te(c),e,t),l}function ne({wasmURI:t,expectedHash:e,verifyResponseHash:r,progressCallback:a,successCallback:i,errorCallback:s,importObject:n,referredOrigin:o}){async function l(h){try{let m=await K({wasmURI:t,expectedHash:e,verifyResponseHash:r,onProgress:a,referredOrigin:o}),b=await(h!=null?h:m).arrayBuffer(),g=await self.WebAssembly.instantiate(b,n);i(g.instance,g.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 c(){let h;try{h=await K({wasmURI:t,expectedHash:e,verifyResponseHash:r,onProgress:a,referredOrigin:o});let m=await self.WebAssembly.instantiateStreaming(h,n);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)"),l((h==null?void 0:h.bodyUsed)===!0?void 0:h)}}typeof self.WebAssembly.instantiateStreaming=="function"?c():l()}async function X(t,e,r,a){return new Promise((i,s)=>{t().then(i).catch(n=>{let o=e*2;if(o>r){s(n);return}a(n),self.setTimeout(()=>{X(t,o,r,a).then(i).catch(s)},e)})})}function Y(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 oe(t,e){async function r(){return importScripts(t)}try{await X(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}}function _e(t){return/^https?:\\/\\/(?:[^./]*\\.)*cdn.jsdelivr.net\\//.test(t)?{result:!0,cdnBaseURL:"https://cdn.jsdelivr.net/npm/"}:/^https?:\\/\\/(?:[^./]*\\.)*unpkg.com\\//.test(t)?{result:!0,cdnBaseURL:"https://unpkg.com/"}:{result:!1,cdnBaseURL:""}}function ze(t){let e=/@scandit\\/web-datacapture-[a-z]+/i.exec(t);return e?e[0]:null}function de(t,e,r){let a=e,i=_e(a);if(i.result){let n=ze(a);n!=null&&(a=`${i.cdnBaseURL}${n}@${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 T;(t=>{function e(){return"7.6.1"}t.sdkVersion=e})(T||(T={}));var ce=class{constructor(){this.promise=new Promise((t,e)=>{this.reject=e,this.resolve=t})}};var Ve=async()=>WebAssembly.validate(new Uint8Array([0,97,115,109,1,0,0,0,1,5,1,96,0,1,123,3,2,1,0,10,10,1,8,0,65,0,253,15,253,98,11])),Je=()=>(async t=>{try{return typeof MessageChannel<"u"&&new MessageChannel().port1.postMessage(new SharedArrayBuffer(1)),WebAssembly.validate(t)}catch{return!1}})(new Uint8Array([0,97,115,109,1,0,0,0,1,4,1,96,0,0,3,2,1,0,5,4,1,3,1,1,10,11,1,9,0,65,0,254,16,2,0,26,11]));function Ue(){return typeof crossOriginIsolated>"u"?!1:crossOriginIsolated}function $e(){try{return new WebAssembly.Memory({initial:1,maximum:1,shared:!0}).buffer.constructor.name==="SharedArrayBuffer"}catch{return!1}}async function le(){return Ve()}async function je(){if(!await Je())return!1;let t=null;try{t=new Worker(URL.createObjectURL(new Blob([\'postMessage("Worker" in self);\'],{type:"text/javascript"})),{name:"nestedWorkerTest"})}catch{return!1}return new Promise(e=>{if(t==null){e(!1);return}t.onmessage=r=>{t==null||t.terminate(),e(r.data)}})}async function ue(){let t=await je();return Ue()&&$e()&&t}var pe=class he{constructor(e,r){this.hintPresenterV2=null,this.MAX_NUMBER_OF_IMAGES_IN_FRAME_DATA_POOL=10,this.redrawInterval=1e3/30,this.redrawRequests=[],this._isDrawLoopRunning=!1,this.frameDataPool=new Map,this.lastFrameCounter=-1,this.poorMansBenchmarkLogs=!1,this.writableDataPathStandard="/scandit_sync_folder",this.resourceFilesSubfolder="resources",this.performanceMetricsReporterTimer=void 0,this.performanceMetrics={frameDataPoolSize:0,processedFramesCount:0,redrawRequestsCount:0,actualRedrawsCount:0},this.gestureListener=null,this.webPlatformHintPresenter=null,this.moduleHandler=e,this.workerFunctions=r,this._loadProgressCallback=this._loadProgressCallback.bind(this),se(this.getWasmMetadata())}get Module(){return this.moduleHandler.get()}set isDrawLoopRunning(e){this._isDrawLoopRunning=e,!e&&typeof this.loopTimeoutId=="number"&&(clearTimeout(this.loopTimeoutId),this.loopTimeoutId=void 0)}get isDrawLoopRunning(){return this._isDrawLoopRunning}convertToLoadableFrameData(e){let r=this.getNextFrameId();this.frameDataPool.set(r,new Uint8ClampedArray(e.getFrameData()));let a=this.lastUsedModuleMirrorAxis==null?!1:this.lastUsedModuleMirrorAxis!==this.Module.Axis.None;return{frameId:r,width:e.getWidth(),height:e.getHeight(),isFrameSourceMirrored:a}}createContext(e){var r,a,i,s,n;let o=this.getModeDeserializers(),l=Y(location);(l==="localhost"||l==="127.0.0.1")&&navigator.userAgent.includes("Electron")&&e.appName!=null&&(l+=`-${e.appName}`),this.parentDomain=e.parentDomain,this.contextDeserializer=new this.Module.DataCaptureContextDeserializer(this.writableDataPath,e.deviceId,e.context.deviceModelName,l,this.parentDomain,o,e.delayedRegistration,e.highEndBlurryRecognition,this.resourcePath);let c=this.contextDeserializer.contextFromJson(JSON.stringify(e.context));if(c==null){let u=this.contextDeserializer.getLastError();throw new Error(`Could not create the context: ${u}`)}let h=c.getView();this.context=c.getContext(),c.delete();let m=this.Module.DataCaptureContextListener.extend("DataCaptureContextListener",{didChangeStatus:(u,f)=>{this.contextDidChangeStatus(JSON.parse(f.toJson())),u.delete()},didStartObservingContext:u=>{this.didStartObservingContext(),u.delete()},didStopObservingContext:u=>{u.delete()}}),b=this.Module.DataCaptureContextFrameListener.extend("DataCaptureContextFrameListener",{onObservationStarted:u=>{u.delete()},onObservationStopped:u=>{u.delete()},onFrameProcessingStarted:(u,f)=>{this.workerFunctions.postMessage({type:"onFrameProcessingStarted"}),f.delete(),u.delete()},onFrameProcessingFinished:(u,f)=>{this.workerFunctions.postMessage({type:"onFrameProcessingFinished"}),f.delete(),u.delete()},onFrameSkipped:(u,f)=>{this.workerFunctions.postMessage({type:"onFrameSkipped"}),f.delete(),u.delete()}}),g=this.Module.GestureRecognizer.extend("GestureRecognizer",{setGestureListener:(u,f)=>{var B;(B=this.gestureListener)==null||B.delete(),this.gestureListener=u.clone(),u.delete()}});(r=this.gestureRecognizer)==null||r.delete(),this.gestureRecognizer=new g;let w=new m;this.context.addListener(w),w.delete();let v=new b;this.context.addFrameListener(v),v.delete(),this.setView(h),(a=this.view)==null||a.setGestureRecognizer(this.gestureRecognizer);let M=this.Module.PlatformHintPresenter.extend("PlatformHintPresenter",{setHintPresenter:u=>{u.delete()},showToast:u=>{this.workerFunctions.postMessage({type:"showToast",payload:JSON.parse(u)})},hideToast:u=>{this.workerFunctions.postMessage({type:"hideToast",payload:JSON.parse(u)})},showGuidance:u=>{this.workerFunctions.postMessage({type:"showGuidance",payload:JSON.parse(u)})},hideGuidance:u=>{this.workerFunctions.postMessage({type:"hideGuidance",payload:JSON.parse(u)})},startUpdateTimer:u=>{this.workerFunctions.postMessage({type:"startUpdateTimer",payload:{duration:{unit:"ms",value:u}}})},stopUpdateTimer:()=>{this.workerFunctions.postMessage({type:"stopUpdateTimer"})}});(i=this.hintPresenterV2)==null||i.delete(),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),(n=this.view)==null||n.setHintPresenterV2(this.hintPresenterV2))}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.performanceMetricsReporterTimer=setInterval(()=>{this.reportPerformanceMetrics();for(let e of Object.keys(this.performanceMetrics))this.performanceMetrics[e]=0},1e3))}async reportPerformanceMetrics(){this.workerFunctions.postMessage({type:"performanceMetricsReport",payload:{...this.performanceMetrics}})}deleteFrameData(e){this.frameDataPool.delete(e)}dispose(){var e,r,a,i;this.context.dispose(),this.frameDataPool.clear(),this.isDrawLoopRunning=!1,this.lastFrameCounter=-1,(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}flushAnalytics(){this.context.flushAnalytics()}extractCentaurusLicense(e){return{payload:{centaurus:{licenseKey:this.Module.LicenseUtils[he.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{payload:e,transferables:[e.data.buffer]};let a=e.data,i=e.colorType==="GRAYSCALE"?this.Module.ImageBufferFormat.Grayscale8:this.Module.ImageBufferFormat.Rgba8888,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);return r==null?{payload:{data:null}}:{payload:{data:r},transferables:[r.buffer]}}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 n=e.getDrawCommands();this.sendViewRefreshCommands(new Uint8Array(n))}i()},this.redrawInterval)};i()}updateContext(e){if(this.context!=null&&this.contextDeserializer!=null){e.view!=null&&!e.view.visible&&this.context.flushAnalytics();let 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),!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),d.debug("context updated",r)}}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()}}}getNextFrameId(){return this.lastFrameCounter++,this.lastFrameCounter>=this.MAX_NUMBER_OF_IMAGES_IN_FRAME_DATA_POOL&&(this.lastFrameCounter=0),this.lastFrameCounter}getWasmDynamicLibraries(e){return this.getWasmSideModuleFileName()==null?[]:[`${e.replace(/\\/[^/]*$/,"/")}${this.getWasmSideModuleFileName()}`]}getWasmCoreExpectedHash(e,r){return r?e?"c8f0dcdc6ee10ac4a2104b348d9358105ff0e3b33e311d7a3efcd0cd2246933b":"e518be4916de213be6919af743e75fcebaac12756aed8074dd3d863f13683a46":e?"a545d2231e2adaee8f7952c96f818d34a9d5e220331dc2a3f3781f76c1d5cc81":""}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 p}getWasmSideModuleFileName(){return""}_loadProgressCallback(e){this.workerFunctions.postMessage({type:"loadLibraryProgress",payload:e})}addRedrawRequest(e){this.redrawRequests.push(Math.round(performance.now())+e),this.redrawRequests.sort((r,a)=>r-a)}contextDidChangeStatus(e){e.code===260?e.message=e.message.replace("domain name",`domain name (${Y(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),n=[];for(let o of s){let l=new TextDecoder(o.ianaName,{fatal:!0});n.push(l.decode(a.slice(o.startIndex,o.endIndex)))}return n.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,overrideThreadsSupport:i,overrideSimdSupport:s,verifyResponseHash:n,referredOrigin:o,fixedWasmMemory:l}){var c;let h=!1,m=!1;this.writableDataPath=this.getWritableDataPath(a),this.resourcePath=`${e}${this.resourceFilesSubfolder}/`,self.path=r;let{resolve:b,reject:g,promise:w}=new ce,v=T.sdkVersion();if(v==="")throw new O({name:"Invalid library version",message:"Library version is not defined or empty, cannot generate proper path to library files."});let[M,u]=await Promise.all([le(),ue()]);i!=="auto"&&(u=i==="on"),s!=="auto"&&(M=s==="on");let f=this.getWasmCoreFileName(M,u),B=de(v,e,f),{jsURI:U,wasmURI:Q}=B,De={instantiateWasm:(S,Ae)=>(ne({importObject:S,wasmURI:Q,expectedHash:this.getWasmCoreExpectedHash(M,u),verifyResponseHash:n,successCallback:Ae,progressCallback:this._loadProgressCallback,errorCallback:Be=>{g(Be)},referredOrigin:o}),{})},x=l===null?null:new WebAssembly.Memory({initial:this.numOfMBToPages(l),maximum:this.numOfMBToPages(300),shared:u});return x!==null&&d.log(d.Level.Debug,"Fixed wasmMemory set",x),this.moduleHandler.set({...x?{wasmMemory:x}:{},mainScriptUrlOrBlob:U,canvas:(c=this.workerFunctions.getOffscreenCanvas())!=null?c:{getContext:()=>null},...De,dynamicLibraries:this.getWasmDynamicLibraries(Q),locateFile:S=>e+S,noInitialRun:!0,preRun:[async()=>{try{await ae({writableDataPath:this.writableDataPath})}catch(S){if(S.name==="BlockedIndexedDB"){g(S.toString());return}d.log(d.Level.Debug,"No IndexedDB support, some data will not be persisted:",S)}m=!0,this.start(m,h,b)}],onMainComplete:()=>{if([h,m].includes(!1)){d.log(d.Level.Warn,{runtimeLoaded:h,fileSystemSynced:m},"Both runtimeLoaded and fileSystemSynced should be true when calling onMainComplete"),g("onMainComplete has been called but runtime or file system was not ready.");return}b()},onRuntimeInitialized:()=>{h=!0,this.start(m,h,b)},print:S=>{d.log(d.Level.Info,S)}}),await oe(U,v)||g(`Couldn\'t retrieve Scandit Data Capture library at ${U}, did you configure the path for it correctly?`),w}};pe.get3dPartyLicenseKeyMethodName=atob("Z2V0QmxpbmtJZExpY2Vuc2VLZXk=");var D=pe;var Ge=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 me(t){typeof t.FinalizationRegistry>"u"&&(t.FinalizationRegistry=Ge)}function be(t){return typeof t=="object"&&t!=null&&t.document==null&&"addEventListener"in t&&typeof t.importScripts=="function"}function ge(t){console.warn("Reached unexpected case",t)}var Z=class{constructor(t,e){this.onMessageListener=this.onMessage.bind(this),this.workerSelf=t,this.dataCaptureInstance=new D(e,{postMessage:this.postMessage.bind(this),getOffscreenCanvas:this.getOffscreenCanvas.bind(this)}),be(t)&&(me(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(typeof this.workerSelf.OffscreenCanvas=="function")return new this.workerSelf.OffscreenCanvas(32,32)}hasPayload(t){return F(t)&&"payload"in t}hasTransferables(t){return F(t)&&Array.isArray(t.transferables)}async respondWith(t,e,r){let a=null,i;try{i=r(),i instanceof Promise&&(i=await i)}catch(n){i=void 0,a=C(n)}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,overrideThreadsSupport:e.overrideThreadsSupport,overrideSimdSupport:e.overrideSimdSupport,verifyResponseHash:e.verifyResponseHash,fixedWasmMemory:e.fixedWasmMemory}))}break}case"onTap":{{let{data:e}=t;this.respondWith(e.command,e.id,async()=>{this.dataCaptureInstance.onTap(e.point)})}break}case"hintPresenterV2update":{{let{data:e}=t;this.respondWith(e.command,e.id,async()=>{this.dataCaptureInstance.hintPresenterV2Update()})}break}case"createContext":{{let{data:e}=t;this.respondWith(e.command,e.id,()=>this.dataCaptureInstance.createContext({context:e.context,deviceId:e.deviceId,delayedRegistration:e.delayedRegistration,highEndBlurryRecognition:e.highEndBlurryRecognition,appName:e.appName,parentDomain:e.parentDomain}))}break}case"setFrameSource":{{let{data:e}=t;this.respondWith(e.command,e.id,()=>this.dataCaptureInstance.setFrameSource(e.mirrorAxis,e.isCameraFrameSource))}break}case"processFrame":{{let{data:e}=t;this.respondWith(e.command,e.id,()=>this.dataCaptureInstance.processFrame({data:e.data,width:e.width,height:e.height,colorType:e.colorType}))}break}case"requestFrameData":{{let{data:e}=t;this.respondWith(e.command,e.id,()=>this.dataCaptureInstance.requestFrameData(e.frameId))}break}case"deleteFrameData":{{let{data:e}=t;this.respondWith(e.command,e.id,()=>{this.dataCaptureInstance.deleteFrameData(e.frameId)})}break}case"updateContext":{{let{data:e}=t;this.respondWith(e.command,e.id,async()=>this.dataCaptureInstance.updateContext(e))}break}case"dispose":{this.respondWith(t.data.command,t.data.id,()=>this.dataCaptureInstance.dispose());break}case"flushAnalytics":{this.respondWith(t.data.command,t.data.id,()=>{this.dataCaptureInstance.flushAnalytics()});break}case"reportCameraProperties":{{let{data:e}=t;this.respondWith(e.command,e.id,async()=>this.dataCaptureInstance.reportCameraProperties(e))}break}case"setLogLevel":{{let{data:e}=t;this.respondWith(e.command,e.id,()=>{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;default:return ge(t.data),!1}return!0}};var fe=(t=>(t.Body="body",t.Footnote="footnote",t))(fe||{}),I=(t=>(t.Start="start",t.Center="center",t.End="end",t))(I||{}),ye=(t=>(t.Normal="normal",t.Wider="wider",t.FitText="fitText",t))(ye||{}),Se=(t=>(t.Normal="normal",t.Taller="taller",t))(Se||{}),we=(t=>(t.Square="square",t.Rounded="rounded",t))(we||{}),L=(t=>(t.None="none",t.Check="check",t.ExclamationMark="exclamationMark",t))(L||{}),W=(t=>(t.Top="top",t.AboveViewFinder="aboveViewFinder",t.BelowViewFinder="belowViewFinder",t))(W||{}),ve=(t=>(t.AboveViewFinder="aboveViewFinder",t.BelowViewFinder="belowViewFinder",t))(ve||{}),Me=(t=>(t.BlackOnWhite="blackOnWhite",t.WhiteOnBlack="whiteOnBlack",t.Transparent="transparent",t))(Me||{}),A=(t=>(t.Success="success",t.Error="error",t.Warning="warning",t.Info="info",t.Notification="notification",t))(A||{}),Fe=(t=>(t[t.Ocr=0]="Ocr",t[t.HideLogo=1]="HideLogo",t[t.ShowTestLicenseMessage=2]="ShowTestLicenseMessage",t[t.AugmentedReality=5]="AugmentedReality",t[t.ActivityPingStatsAddon=8]="ActivityPingStatsAddon",t[t.ActivityPing=9]="ActivityPing",t[t.Registration=10]="Registration",t[t.Parser=11]="Parser",t[t.BarcodeCapture=14]="BarcodeCapture",t[t.Analytics=17]="Analytics",t[t.AnalyticsBatchMode=18]="AnalyticsBatchMode",t[t.AnalyticsScanContent=19]="AnalyticsScanContent",t[t.AnalyticsOnlineVerification=20]="AnalyticsOnlineVerification",t[t.SparkScan=21]="SparkScan",t[t.AamvaIdBarcodeVerification=22]="AamvaIdBarcodeVerification",t[t.MappingForTracking=23]="MappingForTracking",t[t.BarcodeFind=24]="BarcodeFind",t[t.MandatoryRegistration=25]="MandatoryRegistration",t[t.FeatureTracking=26]="FeatureTracking",t[t.IdCaptureViz=27]="IdCaptureViz",t[t.IdCaptureMrz=28]="IdCaptureMrz",t[t.IdCaptureBarcode=29]="IdCaptureBarcode",t[t.BarcodeSelectionAimToScan=30]="BarcodeSelectionAimToScan",t[t.BarcodeSelectionTapToScan=31]="BarcodeSelectionTapToScan",t[t.BarcodeCount=32]="BarcodeCount",t[t.BarcodePick=33]="BarcodePick",t[t.IdVerificationDataComparison=34]="IdVerificationDataComparison",t[t.SmartLabelBarcode=35]="SmartLabelBarcode",t[t.SmartLabelText=36]="SmartLabelText",t[t.VoidedIdDetection=37]="VoidedIdDetection",t[t.BarcodeArFull=38]="BarcodeArFull",t))(Fe||{});var E=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,n)=>{let o=this.coreEngine.convertToLoadableFrameData(n);this.workerFunctions.postMessage({type:"barcodeArDidUpdateSession",payload:{session:JSON.parse(s.toJson()),frameData:o}}),i.delete(),s.delete(),n.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 R=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 N=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:(n,o,l)=>{this.barcodeCaptureDidScan(o,l),n.delete(),l.delete(),o.delete()},didUpdateSession:(n,o,l)=>{this.barcodeCaptureDidUpdateSession(o),n.delete(),l.delete(),o.delete()}}),r=this.Module.Feedback.extend("Feedback",{emit:()=>{this.successFeedback()}}),a=new e,i=new r,s=this.Module.BarcodeCaptureDeserializerListener.extend("BarcodeCaptureDeserializerListener",{onModeDeserializationFinished:(n,o,l)=>{o.addListener(a,1),o.setSuccessFeedback(i),n.delete(),o.delete(),l.delete()},onModeDeserializationStarted(n,o,l){n.delete(),o.delete(),l.delete()},onSettingsDeserializationStarted(n,o,l){n.delete(),o.delete(),l.delete()},onSettingsDeserializationFinished(n,o,l){n.delete(),o.delete(),l.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.convertToLoadableFrameData(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 Ce(t){return t}var H=class{constructor(e,r,a){this.barcodeFind=null;this.basicOverlay=null;this.transparentGuidanceHintStyle={backgroundColor:"00000000",cornerRadius:4,fitToText:!1,isAnimatedToView:!1,textAlignment:I.Center,hintIcon:L.None,hintAnchor:W.AboveViewFinder,hintAnchorOffset:-12,horizontalMargin:0,iconColor:"00000000",lineHeight:-1,maxLines:1,maxWidthFraction:.8,textColor:"ffffffff",textSize:15,textWeight:600};this.customerTransformation=Ce;this.coreEngine=e,this.Module=r,this.workerFunctions=a}async forSettings(e){var n;(n=this.barcodeFind)==null||n.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:o=>this.customerTransformation(o)}),s=this.Module.BarcodeFindListener.extend("BarcodeFindListener",{didUpdateSession:(o,l,c)=>{let h=this.coreEngine.convertToLoadableFrameData(c);this.workerFunctions.postMessage({type:"barcodeFindDidUpdateSession",payload:{session:JSON.parse(l.toJson()),frameData:h}}),o.delete(),l.delete(),c.delete()},onSearchPaused:o=>{let l=[];for(let c=0;c<o.size();c++)l.push(o.get(c));this.workerFunctions.postMessage({type:"barcodeFindSearchPaused",payload:{foundItems:l}})},onSearchStopped:o=>{let l=[];for(let c=0;c<o.size();c++)l.push(o.get(c));this.workerFunctions.postMessage({type:"barcodeFindSearchStopped",payload:{foundItems:l}})},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:Ce}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")},setAllItemsFound:(r,a)=>{let i={text:a,toastHintStyle:A.Success,tag:"AllItemsFound"};this.setToast(r,i)},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")},setItemListUpdated:(r,a)=>{let i={text:a,toastHintStyle:A.Info,tag:"ItemListUpdated"};this.setToast(r,i)}});return new e}};var y=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 Ke={torch_state:new y("torch_state"),scanning_mode:new y("scanning_mode"),sound_enabled:new y("sound_enabled"),haptic_enabled:new y("haptic_enabled"),hand_mode:new y("hand_mode"),session_stop_reason:new y("session_stop_reason"),camera_position:new y("camera_position")},_=class{getBehaviorSubject(e){return Ke[e]}};var z=class{constructor(e,r,a){this.captureListenerSet=!1;this.propertyPushSource=new _;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,n)=>{this.sparkScanDidScan(s,n),i.delete(),s.delete(),n.delete()},didUpdateSession:(i,s,n)=>{this.sparkScanDidUpdateSession(s),i.delete(),s.delete(),n.delete()}}),r=this.Module.Feedback.extend("Feedback",{emit:()=>{this.successFeedback()}}),a=this.Module.SparkScanDeserializerListener.extend("SparkScanDeserializerListener",{onModeDeserializationFinished:(i,s,n)=>{this.captureListenerSet||(s.addListener(new e,1),s.setSuccessFeedback(new r),s.setPropertyPushSource(this.propertyPushSource),this.captureListenerSet=!0),i.delete(),s.delete(),n.delete()},onModeDeserializationStarted(i,s,n){i.delete(),s.delete(),n.delete()},onSettingsDeserializationStarted(i,s,n){i.delete(),s.delete(),n.delete()},onSettingsDeserializationFinished(i,s,n){i.delete(),s.delete(),n.delete()},onOverlayDeserializationStarted(i,s,n){i.delete(),s.delete(),n.delete()},onOverlayDeserializationFinished:(i,s,n)=>{var o;(o=this.sparkScanOverlay)==null||o.delete(),this.sparkScanOverlay=s,i.delete(),n.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"})}sparkScanDidScan(e,r){let a=this.coreEngine.convertToLoadableFrameData(r);this.workerFunctions.postMessage({type:"sparkScanDidScan",payload:{session:JSON.parse(e.toJson()),frameData:a}})}};var V=class extends D{constructor(e,r){super(e,r)}getModeDeserializers(){this.barcodeCaptureMode=new N(this,this.Module,this.workerFunctions),this.barcodeBatchMode=new R(this,this.Module,this.workerFunctions),this.sparkScanMode=new z(this,this.Module,this.workerFunctions),this.barcodeFindMode=new H(this,this.Module,this.workerFunctions),this.barcodeArMode=new E(this,this.Module,this.workerFunctions);let e=super.getModeDeserializers();return e.push_back(this.barcodeCaptureMode.getCaptureDeserializer()),e.push_back(this.barcodeBatchMode.getBatchDeserializer()),e.push_back(this.sparkScanMode.getSparkScanDeserializer()),e}getWasmSideModuleFileName(){return""}getWasmCoreFileName(e,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?"c8f0dcdc6ee10ac4a2104b348d9358105ff0e3b33e311d7a3efcd0cd2246933b":"e518be4916de213be6919af743e75fcebaac12756aed8074dd3d863f13683a46":e?"a545d2231e2adaee8f7952c96f818d34a9d5e220331dc2a3f3781f76c1d5cc81":"5cc61a14dfe32403fc2bdf006f7bc8fc0695785dc4d88c49af97075776e057d9"}getWasmMetadata(){return p}};function Xe(t){return(r=>/^[$A-Z_a-z][\\w$]*\\s*\\(.*\\)\\s*\\{/.test(r)&&!r.startsWith("function"))(t)?`function ${t}`:t}var Ye=["fetch","XMLHttpRequest","eval","Function","self","globalThis","Module","importScripts","this","console","window","document","import","Worker","ServiceWorker"];function Ze(t){return Ye.map(r=>new RegExp(`\\\\b${r}\\\\b`,"g")).some(r=>r.test(t))}function ke(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 J=class extends Z{constructor(e,r){super(e,r),this.dataCaptureInstance=new V(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(o){s=void 0,i=C(o)}let n={type:"workerTaskId",command:e,id:r,payload:this.hasPayload(s)?s.payload:void 0};i!=null&&(n.error=i),this.postMessage(n,this.hasTransferables(s)?s.transferables:[])}onMessage(e){switch(e.data.command){case"sparkScanEmitErrorFeedback":{let{data: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"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=ke(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 Qr=new J(self,{get:()=>self.Module,set:t=>{self.Module=t}});function ea(t){}})();\n'],{type:"application/javascript"})),e=new Worker(s,r);return URL.revokeObjectURL(s),e}var o=class r extends DataCaptureLoader{constructor(){super(...arguments);this._name="BarcodeCapture";}get dataCaptureWorker(){return (this._dataCaptureWorker)!=null||(this._dataCaptureWorker=n({name:this.name})),this._dataCaptureWorker}get name(){return this._name}static async create(e){var a;let t=new r(e);return await t.workerCommand("setLogLevel",{level:(a=e.logLevel)!=null?a:Logger.Level.Debug}),await t.load(),t}async workerCommand(e,t,a){return new Promise((d,c)=>{let i=this.workerCommandId++;this.workerTasks.set(i,{resolve:d,reject:c,command:e});let l={...t,command:e,id:i};this.dataCaptureWorker.postMessage(l,a);})}};
|
|
1
|
+
import {DataCaptureLoader,Logger}from'@scandit/web-datacapture-core';function n(r){let s=URL.createObjectURL(new Blob(['"use strict";(()=>{var p={"scandit-datacapture-sdk-barcode-pthreads.wasm":{bytes:7238065},"scandit-datacapture-sdk-barcode-simd-pthreads.wasm":{bytes:7174883},"scandit-datacapture-sdk-barcode.wasm":{bytes:7122413},"scandit-datacapture-sdk-barcode-simd.wasm":{bytes:7058891}};function F(t){return typeof t=="object"&&t!=null}function C(t){if(typeof t=="string")return t;if(F(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=>{(c=>(c.Debug="debug",c.Info="info",c.Warn="warn",c.Error="error",c.Quiet="quiet"))(t.Level||(t.Level={}));let e=new Map([["debug",1],["info",2],["warn",3],["error",4],["quiet",5]]),r="debug";function a(c){r=c}t.setLevel=a;function i(c,...h){if(!(e.get(r)>e.get(c)))switch(c){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(...c){i("warn",...c)}t.warn=s;function n(...c){i("debug",...c)}t.debug=n;function o(...c){i("info",...c)}t.info=o;function l(...c){i("error",...c)}t.error=l})(d||(d={}));var O=class ee extends Error{constructor(e){super(e.message),Object.setPrototypeOf(this,ee.prototype),this.name=e.name}toString(){return`${this.name}: ${this.message}`}};var P=Promise.resolve(),G=!1,$=!1,k,j={writableDataPath:""};async function te(t){if(k==null)return;G=!0;let e=new Promise((r,a)=>{setTimeout(()=>{a(new O({name:"BlockedIndexedDB",message:"IndexedDB database is blocked"}))},1500)});try{await Promise.race([new Promise((r,a)=>{k==null||k(t,i=>{if(i!=null){a(i);return}r()})}),e])}finally{G=!1}}async function re(t){return $||(G?($=!0,P=P.then(async()=>($=!1,te(t)))):P=te(t)),P}async function ae(t){j=t,k=FS.syncfs,FS.syncfs=(e,r)=>{let a=r,i=()=>{a()},s=n=>{a(n)};re(e).then(i).catch(s)};try{FS.mkdir(j.writableDataPath)}catch(e){if(e.code!=="EEXIST")throw k=void 0,e}return FS.mount(IDBFS,{},j.writableDataPath),re(!0)}var ie={};function Oe(t){return[...new Uint8Array(t)].map(e=>{let r=e.toString(16);return r.length===1?`0${r}`:r}).join("")}async function*Pe(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 Te(t){let e=[],r=0,a=0;for await(let s of Pe(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 Ie=(t=>(t.VALID="VALID",t.INVALID="INVALID",t.NOT_VERIFIABLE="NOT_VERIFIABLE",t))(Ie||{});async function Le(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=Oe(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 q=new Map([["br",4.4],["gzip",2.9],["none",1]]);function We(t){var e;let r="content-encoding";if(t==null||t.get(r)==null)return q.get("none");let a=new Set(((e=t.get(r))!=null?e:"").split(",").map(i=>i.trim()));for(let[i,s]of q)if(a.has(i))return s;return q.get("none")}function Ee(t){var e,r;if(t==null)return 0;let a=(e=We(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 Re(t){let{pathname:e}=new URL(t);for(let[r,a]of Object.entries(ie))if(e.endsWith(r))return a.bytes;return 0}function se(t){ie=t}var Ne=(t,e)=>{let r=Ee(e);return r===0?Re(t):r};function He(t,e,r,{onProgress:a,onError:i,onComplete:s}){if(!e.body)return[e];let n=Ne(t,e.headers),o=0,l=0;if(typeof TransformStream>"u")return d.warn("TransformStream is not supported in this environment. Progress tracking will be disabled."),[e];let[c,h]=r?e.body.tee():[e.body],m=c.pipeThrough(new TransformStream({async transform(b,g){try{o+=b.length,l=Number((o/n*100).toFixed(2)),n>0&&b.length>0&&l<100?a==null||a({percentage:l,loadedBytes:o,privateUri:t}):n===0&&b.length>0&&(a==null||a({percentage:null,loadedBytes:o,privateUri:t})),g.enqueue(b)}catch(w){g.error(w),i==null||i({error:w})}},flush(b){a==null||a({percentage:100,loadedBytes:o,privateUri:t}),s==null||s({percentage:100,loadedBytes:o,privateUri:t}),b.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:n}){let o=await fetch(t,{referrerPolicy:"origin",referrer:n!=null?n:""});if(!o.ok)throw new Error(`HTTP status code is not ok: ${o.status}, ${o.statusText}`);let[l,c]=He(t,o,r,{onProgress:a,onError:s,onComplete:i});return c!=null&&Le(Te(c),e,t),l}function ne({wasmURI:t,expectedHash:e,verifyResponseHash:r,progressCallback:a,successCallback:i,errorCallback:s,importObject:n,referredOrigin:o}){async function l(h){try{let m=await K({wasmURI:t,expectedHash:e,verifyResponseHash:r,onProgress:a,referredOrigin:o}),b=await(h!=null?h:m).arrayBuffer(),g=await self.WebAssembly.instantiate(b,n);i(g.instance,g.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 c(){let h;try{h=await K({wasmURI:t,expectedHash:e,verifyResponseHash:r,onProgress:a,referredOrigin:o});let m=await self.WebAssembly.instantiateStreaming(h,n);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)"),l((h==null?void 0:h.bodyUsed)===!0?void 0:h)}}typeof self.WebAssembly.instantiateStreaming=="function"?c():l()}async function X(t,e,r,a){return new Promise((i,s)=>{t().then(i).catch(n=>{let o=e*2;if(o>r){s(n);return}a(n),self.setTimeout(()=>{X(t,o,r,a).then(i).catch(s)},e)})})}function Y(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 oe(t,e){async function r(){return importScripts(t)}try{await X(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}}function _e(t){return/^https?:\\/\\/(?:[^./]*\\.)*cdn.jsdelivr.net\\//.test(t)?{result:!0,cdnBaseURL:"https://cdn.jsdelivr.net/npm/"}:/^https?:\\/\\/(?:[^./]*\\.)*unpkg.com\\//.test(t)?{result:!0,cdnBaseURL:"https://unpkg.com/"}:{result:!1,cdnBaseURL:""}}function ze(t){let e=/@scandit\\/web-datacapture-[a-z]+/i.exec(t);return e?e[0]:null}function de(t,e,r){let a=e,i=_e(a);if(i.result){let n=ze(a);n!=null&&(a=`${i.cdnBaseURL}${n}@${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 T;(t=>{function e(){return"7.6.3"}t.sdkVersion=e})(T||(T={}));var ce=class{constructor(){this.promise=new Promise((t,e)=>{this.reject=e,this.resolve=t})}};var Ve=async()=>WebAssembly.validate(new Uint8Array([0,97,115,109,1,0,0,0,1,5,1,96,0,1,123,3,2,1,0,10,10,1,8,0,65,0,253,15,253,98,11])),Je=()=>(async t=>{try{return typeof MessageChannel<"u"&&new MessageChannel().port1.postMessage(new SharedArrayBuffer(1)),WebAssembly.validate(t)}catch{return!1}})(new Uint8Array([0,97,115,109,1,0,0,0,1,4,1,96,0,0,3,2,1,0,5,4,1,3,1,1,10,11,1,9,0,65,0,254,16,2,0,26,11]));function Ue(){return typeof crossOriginIsolated>"u"?!1:crossOriginIsolated}function $e(){try{return new WebAssembly.Memory({initial:1,maximum:1,shared:!0}).buffer.constructor.name==="SharedArrayBuffer"}catch{return!1}}async function le(){return Ve()}async function je(){if(!await Je())return!1;let t=null;try{t=new Worker(URL.createObjectURL(new Blob([\'postMessage("Worker" in self);\'],{type:"text/javascript"})),{name:"nestedWorkerTest"})}catch{return!1}return new Promise(e=>{if(t==null){e(!1);return}t.onmessage=r=>{t==null||t.terminate(),e(r.data)}})}async function ue(){let t=await je();return Ue()&&$e()&&t}var pe=class he{constructor(e,r){this.hintPresenterV2=null,this.MAX_NUMBER_OF_IMAGES_IN_FRAME_DATA_POOL=10,this.redrawInterval=1e3/30,this.redrawRequests=[],this._isDrawLoopRunning=!1,this.frameDataPool=new Map,this.lastFrameCounter=-1,this.poorMansBenchmarkLogs=!1,this.writableDataPathStandard="/scandit_sync_folder",this.resourceFilesSubfolder="resources",this.performanceMetricsReporterTimer=void 0,this.performanceMetrics={frameDataPoolSize:0,processedFramesCount:0,redrawRequestsCount:0,actualRedrawsCount:0},this.gestureListener=null,this.webPlatformHintPresenter=null,this.moduleHandler=e,this.workerFunctions=r,this._loadProgressCallback=this._loadProgressCallback.bind(this),se(this.getWasmMetadata())}get Module(){return this.moduleHandler.get()}set isDrawLoopRunning(e){this._isDrawLoopRunning=e,!e&&typeof this.loopTimeoutId=="number"&&(clearTimeout(this.loopTimeoutId),this.loopTimeoutId=void 0)}get isDrawLoopRunning(){return this._isDrawLoopRunning}convertToLoadableFrameData(e){let r=this.getNextFrameId();this.frameDataPool.set(r,new Uint8ClampedArray(e.getFrameData()));let a=this.lastUsedModuleMirrorAxis==null?!1:this.lastUsedModuleMirrorAxis!==this.Module.Axis.None;return{frameId:r,width:e.getWidth(),height:e.getHeight(),isFrameSourceMirrored:a}}createContext(e){var r,a,i,s,n;let o=this.getModeDeserializers(),l=Y(location);(l==="localhost"||l==="127.0.0.1")&&navigator.userAgent.includes("Electron")&&e.appName!=null&&(l+=`-${e.appName}`),this.parentDomain=e.parentDomain,this.contextDeserializer=new this.Module.DataCaptureContextDeserializer(this.writableDataPath,e.deviceId,e.context.deviceModelName,l,this.parentDomain,o,e.delayedRegistration,e.highEndBlurryRecognition,this.resourcePath);let c=this.contextDeserializer.contextFromJson(JSON.stringify(e.context));if(c==null){let u=this.contextDeserializer.getLastError();throw new Error(`Could not create the context: ${u}`)}let h=c.getView();this.context=c.getContext(),c.delete();let m=this.Module.DataCaptureContextListener.extend("DataCaptureContextListener",{didChangeStatus:(u,f)=>{this.contextDidChangeStatus(JSON.parse(f.toJson())),u.delete()},didStartObservingContext:u=>{this.didStartObservingContext(),u.delete()},didStopObservingContext:u=>{u.delete()}}),b=this.Module.DataCaptureContextFrameListener.extend("DataCaptureContextFrameListener",{onObservationStarted:u=>{u.delete()},onObservationStopped:u=>{u.delete()},onFrameProcessingStarted:(u,f)=>{this.workerFunctions.postMessage({type:"onFrameProcessingStarted"}),f.delete(),u.delete()},onFrameProcessingFinished:(u,f)=>{this.workerFunctions.postMessage({type:"onFrameProcessingFinished"}),f.delete(),u.delete()},onFrameSkipped:(u,f)=>{this.workerFunctions.postMessage({type:"onFrameSkipped"}),f.delete(),u.delete()}}),g=this.Module.GestureRecognizer.extend("GestureRecognizer",{setGestureListener:(u,f)=>{var B;(B=this.gestureListener)==null||B.delete(),this.gestureListener=u.clone(),u.delete()}});(r=this.gestureRecognizer)==null||r.delete(),this.gestureRecognizer=new g;let w=new m;this.context.addListener(w),w.delete();let v=new b;this.context.addFrameListener(v),v.delete(),this.setView(h),(a=this.view)==null||a.setGestureRecognizer(this.gestureRecognizer);let M=this.Module.PlatformHintPresenter.extend("PlatformHintPresenter",{setHintPresenter:u=>{u.delete()},showToast:u=>{this.workerFunctions.postMessage({type:"showToast",payload:JSON.parse(u)})},hideToast:u=>{this.workerFunctions.postMessage({type:"hideToast",payload:JSON.parse(u)})},showGuidance:u=>{this.workerFunctions.postMessage({type:"showGuidance",payload:JSON.parse(u)})},hideGuidance:u=>{this.workerFunctions.postMessage({type:"hideGuidance",payload:JSON.parse(u)})},startUpdateTimer:u=>{this.workerFunctions.postMessage({type:"startUpdateTimer",payload:{duration:{unit:"ms",value:u}}})},stopUpdateTimer:()=>{this.workerFunctions.postMessage({type:"stopUpdateTimer"})}});(i=this.hintPresenterV2)==null||i.delete(),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),(n=this.view)==null||n.setHintPresenterV2(this.hintPresenterV2))}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.performanceMetricsReporterTimer=setInterval(()=>{this.reportPerformanceMetrics();for(let e of Object.keys(this.performanceMetrics))this.performanceMetrics[e]=0},1e3))}async reportPerformanceMetrics(){this.workerFunctions.postMessage({type:"performanceMetricsReport",payload:{...this.performanceMetrics}})}deleteFrameData(e){this.frameDataPool.delete(e)}dispose(){var e,r,a,i;this.context.dispose(),this.frameDataPool.clear(),this.isDrawLoopRunning=!1,this.lastFrameCounter=-1,(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}flushAnalytics(){this.context.flushAnalytics()}extractCentaurusLicense(e){return{payload:{centaurus:{licenseKey:this.Module.LicenseUtils[he.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{payload:e,transferables:[e.data.buffer]};let a=e.data,i=e.colorType==="GRAYSCALE"?this.Module.ImageBufferFormat.Grayscale8:this.Module.ImageBufferFormat.Rgba8888,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);return r==null?{payload:{data:null}}:{payload:{data:r},transferables:[r.buffer]}}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 n=e.getDrawCommands();this.sendViewRefreshCommands(new Uint8Array(n))}i()},this.redrawInterval)};i()}updateContext(e){if(this.context!=null&&this.contextDeserializer!=null){e.view!=null&&!e.view.visible&&this.context.flushAnalytics();let 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),!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),d.debug("context updated",r)}}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()}}}getNextFrameId(){return this.lastFrameCounter++,this.lastFrameCounter>=this.MAX_NUMBER_OF_IMAGES_IN_FRAME_DATA_POOL&&(this.lastFrameCounter=0),this.lastFrameCounter}getWasmDynamicLibraries(e){return this.getWasmSideModuleFileName()==null?[]:[`${e.replace(/\\/[^/]*$/,"/")}${this.getWasmSideModuleFileName()}`]}getWasmCoreExpectedHash(e,r){return r?e?"076ea0ee0cc1947c7d6dd9f31009f3326f64896a21146e64ba333462a654120a":"87bd3b2bf709f692fb1b3c33acb325ef734ef276d5a1f594bd55f84fed4038e6":e?"eae8da5a618178a2a034603a788d8838d6f8b79d594af1dbd89c36cacfa4545f":""}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 p}getWasmSideModuleFileName(){return""}_loadProgressCallback(e){this.workerFunctions.postMessage({type:"loadLibraryProgress",payload:e})}addRedrawRequest(e){this.redrawRequests.push(Math.round(performance.now())+e),this.redrawRequests.sort((r,a)=>r-a)}contextDidChangeStatus(e){e.code===260?e.message=e.message.replace("domain name",`domain name (${Y(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),n=[];for(let o of s){let l=new TextDecoder(o.ianaName,{fatal:!0});n.push(l.decode(a.slice(o.startIndex,o.endIndex)))}return n.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,overrideThreadsSupport:i,overrideSimdSupport:s,verifyResponseHash:n,referredOrigin:o,fixedWasmMemory:l}){var c;let h=!1,m=!1;this.writableDataPath=this.getWritableDataPath(a),this.resourcePath=`${e}${this.resourceFilesSubfolder}/`,self.path=r;let{resolve:b,reject:g,promise:w}=new ce,v=T.sdkVersion();if(v==="")throw new O({name:"Invalid library version",message:"Library version is not defined or empty, cannot generate proper path to library files."});let[M,u]=await Promise.all([le(),ue()]);i!=="auto"&&(u=i==="on"),s!=="auto"&&(M=s==="on");let f=this.getWasmCoreFileName(M,u),B=de(v,e,f),{jsURI:U,wasmURI:Q}=B,De={instantiateWasm:(S,Ae)=>(ne({importObject:S,wasmURI:Q,expectedHash:this.getWasmCoreExpectedHash(M,u),verifyResponseHash:n,successCallback:Ae,progressCallback:this._loadProgressCallback,errorCallback:Be=>{g(Be)},referredOrigin:o}),{})},x=l===null?null:new WebAssembly.Memory({initial:this.numOfMBToPages(l),maximum:this.numOfMBToPages(300),shared:u});return x!==null&&d.log(d.Level.Debug,"Fixed wasmMemory set",x),this.moduleHandler.set({...x?{wasmMemory:x}:{},mainScriptUrlOrBlob:U,canvas:(c=this.workerFunctions.getOffscreenCanvas())!=null?c:{getContext:()=>null},...De,dynamicLibraries:this.getWasmDynamicLibraries(Q),locateFile:S=>e+S,noInitialRun:!0,preRun:[async()=>{try{await ae({writableDataPath:this.writableDataPath})}catch(S){if(S.name==="BlockedIndexedDB"){g(S.toString());return}d.log(d.Level.Debug,"No IndexedDB support, some data will not be persisted:",S)}m=!0,this.start(m,h,b)}],onMainComplete:()=>{if([h,m].includes(!1)){d.log(d.Level.Warn,{runtimeLoaded:h,fileSystemSynced:m},"Both runtimeLoaded and fileSystemSynced should be true when calling onMainComplete"),g("onMainComplete has been called but runtime or file system was not ready.");return}b()},onRuntimeInitialized:()=>{h=!0,this.start(m,h,b)},print:S=>{d.log(d.Level.Info,S)}}),await oe(U,v)||g(`Couldn\'t retrieve Scandit Data Capture library at ${U}, did you configure the path for it correctly?`),w}};pe.get3dPartyLicenseKeyMethodName=atob("Z2V0QmxpbmtJZExpY2Vuc2VLZXk=");var D=pe;var Ge=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 me(t){typeof t.FinalizationRegistry>"u"&&(t.FinalizationRegistry=Ge)}function be(t){return typeof t=="object"&&t!=null&&t.document==null&&"addEventListener"in t&&typeof t.importScripts=="function"}function ge(t){console.warn("Reached unexpected case",t)}var Z=class{constructor(t,e){this.onMessageListener=this.onMessage.bind(this),this.workerSelf=t,this.dataCaptureInstance=new D(e,{postMessage:this.postMessage.bind(this),getOffscreenCanvas:this.getOffscreenCanvas.bind(this)}),be(t)&&(me(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(typeof this.workerSelf.OffscreenCanvas=="function")return new this.workerSelf.OffscreenCanvas(32,32)}hasPayload(t){return F(t)&&"payload"in t}hasTransferables(t){return F(t)&&Array.isArray(t.transferables)}async respondWith(t,e,r){let a=null,i;try{i=r(),i instanceof Promise&&(i=await i)}catch(n){i=void 0,a=C(n)}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,overrideThreadsSupport:e.overrideThreadsSupport,overrideSimdSupport:e.overrideSimdSupport,verifyResponseHash:e.verifyResponseHash,fixedWasmMemory:e.fixedWasmMemory}))}break}case"onTap":{{let{data:e}=t;this.respondWith(e.command,e.id,async()=>{this.dataCaptureInstance.onTap(e.point)})}break}case"hintPresenterV2update":{{let{data:e}=t;this.respondWith(e.command,e.id,async()=>{this.dataCaptureInstance.hintPresenterV2Update()})}break}case"createContext":{{let{data:e}=t;this.respondWith(e.command,e.id,()=>this.dataCaptureInstance.createContext({context:e.context,deviceId:e.deviceId,delayedRegistration:e.delayedRegistration,highEndBlurryRecognition:e.highEndBlurryRecognition,appName:e.appName,parentDomain:e.parentDomain}))}break}case"setFrameSource":{{let{data:e}=t;this.respondWith(e.command,e.id,()=>this.dataCaptureInstance.setFrameSource(e.mirrorAxis,e.isCameraFrameSource))}break}case"processFrame":{{let{data:e}=t;this.respondWith(e.command,e.id,()=>this.dataCaptureInstance.processFrame({data:e.data,width:e.width,height:e.height,colorType:e.colorType}))}break}case"requestFrameData":{{let{data:e}=t;this.respondWith(e.command,e.id,()=>this.dataCaptureInstance.requestFrameData(e.frameId))}break}case"deleteFrameData":{{let{data:e}=t;this.respondWith(e.command,e.id,()=>{this.dataCaptureInstance.deleteFrameData(e.frameId)})}break}case"updateContext":{{let{data:e}=t;this.respondWith(e.command,e.id,async()=>this.dataCaptureInstance.updateContext(e))}break}case"dispose":{this.respondWith(t.data.command,t.data.id,()=>this.dataCaptureInstance.dispose());break}case"flushAnalytics":{this.respondWith(t.data.command,t.data.id,()=>{this.dataCaptureInstance.flushAnalytics()});break}case"reportCameraProperties":{{let{data:e}=t;this.respondWith(e.command,e.id,async()=>this.dataCaptureInstance.reportCameraProperties(e))}break}case"setLogLevel":{{let{data:e}=t;this.respondWith(e.command,e.id,()=>{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;default:return ge(t.data),!1}return!0}};var fe=(t=>(t.Body="body",t.Footnote="footnote",t))(fe||{}),I=(t=>(t.Start="start",t.Center="center",t.End="end",t))(I||{}),ye=(t=>(t.Normal="normal",t.Wider="wider",t.FitText="fitText",t))(ye||{}),Se=(t=>(t.Normal="normal",t.Taller="taller",t))(Se||{}),we=(t=>(t.Square="square",t.Rounded="rounded",t))(we||{}),L=(t=>(t.None="none",t.Check="check",t.ExclamationMark="exclamationMark",t))(L||{}),W=(t=>(t.Top="top",t.AboveViewFinder="aboveViewFinder",t.BelowViewFinder="belowViewFinder",t))(W||{}),ve=(t=>(t.AboveViewFinder="aboveViewFinder",t.BelowViewFinder="belowViewFinder",t))(ve||{}),Me=(t=>(t.BlackOnWhite="blackOnWhite",t.WhiteOnBlack="whiteOnBlack",t.Transparent="transparent",t))(Me||{}),A=(t=>(t.Success="success",t.Error="error",t.Warning="warning",t.Info="info",t.Notification="notification",t))(A||{}),Fe=(t=>(t[t.Ocr=0]="Ocr",t[t.HideLogo=1]="HideLogo",t[t.ShowTestLicenseMessage=2]="ShowTestLicenseMessage",t[t.AugmentedReality=5]="AugmentedReality",t[t.ActivityPingStatsAddon=8]="ActivityPingStatsAddon",t[t.ActivityPing=9]="ActivityPing",t[t.Registration=10]="Registration",t[t.Parser=11]="Parser",t[t.BarcodeCapture=14]="BarcodeCapture",t[t.Analytics=17]="Analytics",t[t.AnalyticsBatchMode=18]="AnalyticsBatchMode",t[t.AnalyticsScanContent=19]="AnalyticsScanContent",t[t.AnalyticsOnlineVerification=20]="AnalyticsOnlineVerification",t[t.SparkScan=21]="SparkScan",t[t.AamvaIdBarcodeVerification=22]="AamvaIdBarcodeVerification",t[t.MappingForTracking=23]="MappingForTracking",t[t.BarcodeFind=24]="BarcodeFind",t[t.MandatoryRegistration=25]="MandatoryRegistration",t[t.FeatureTracking=26]="FeatureTracking",t[t.IdCaptureViz=27]="IdCaptureViz",t[t.IdCaptureMrz=28]="IdCaptureMrz",t[t.IdCaptureBarcode=29]="IdCaptureBarcode",t[t.BarcodeSelectionAimToScan=30]="BarcodeSelectionAimToScan",t[t.BarcodeSelectionTapToScan=31]="BarcodeSelectionTapToScan",t[t.BarcodeCount=32]="BarcodeCount",t[t.BarcodePick=33]="BarcodePick",t[t.IdVerificationDataComparison=34]="IdVerificationDataComparison",t[t.SmartLabelBarcode=35]="SmartLabelBarcode",t[t.SmartLabelText=36]="SmartLabelText",t[t.VoidedIdDetection=37]="VoidedIdDetection",t[t.BarcodeArFull=38]="BarcodeArFull",t))(Fe||{});var E=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,n)=>{let o=this.coreEngine.convertToLoadableFrameData(n);this.workerFunctions.postMessage({type:"barcodeArDidUpdateSession",payload:{session:JSON.parse(s.toJson()),frameData:o}}),i.delete(),s.delete(),n.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 R=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 N=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:(n,o,l)=>{this.barcodeCaptureDidScan(o,l),n.delete(),l.delete(),o.delete()},didUpdateSession:(n,o,l)=>{this.barcodeCaptureDidUpdateSession(o),n.delete(),l.delete(),o.delete()}}),r=this.Module.Feedback.extend("Feedback",{emit:()=>{this.successFeedback()}}),a=new e,i=new r,s=this.Module.BarcodeCaptureDeserializerListener.extend("BarcodeCaptureDeserializerListener",{onModeDeserializationFinished:(n,o,l)=>{o.addListener(a,1),o.setSuccessFeedback(i),n.delete(),o.delete(),l.delete()},onModeDeserializationStarted(n,o,l){n.delete(),o.delete(),l.delete()},onSettingsDeserializationStarted(n,o,l){n.delete(),o.delete(),l.delete()},onSettingsDeserializationFinished(n,o,l){n.delete(),o.delete(),l.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.convertToLoadableFrameData(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 Ce(t){return t}var H=class{constructor(e,r,a){this.barcodeFind=null;this.basicOverlay=null;this.transparentGuidanceHintStyle={backgroundColor:"00000000",cornerRadius:4,fitToText:!1,isAnimatedToView:!1,textAlignment:I.Center,hintIcon:L.None,hintAnchor:W.AboveViewFinder,hintAnchorOffset:-12,horizontalMargin:0,iconColor:"00000000",lineHeight:-1,maxLines:1,maxWidthFraction:.8,textColor:"ffffffff",textSize:15,textWeight:600};this.customerTransformation=Ce;this.coreEngine=e,this.Module=r,this.workerFunctions=a}async forSettings(e){var n;(n=this.barcodeFind)==null||n.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:o=>this.customerTransformation(o)}),s=this.Module.BarcodeFindListener.extend("BarcodeFindListener",{didUpdateSession:(o,l,c)=>{let h=this.coreEngine.convertToLoadableFrameData(c);this.workerFunctions.postMessage({type:"barcodeFindDidUpdateSession",payload:{session:JSON.parse(l.toJson()),frameData:h}}),o.delete(),l.delete(),c.delete()},onSearchPaused:o=>{let l=[];for(let c=0;c<o.size();c++)l.push(o.get(c));this.workerFunctions.postMessage({type:"barcodeFindSearchPaused",payload:{foundItems:l}})},onSearchStopped:o=>{let l=[];for(let c=0;c<o.size();c++)l.push(o.get(c));this.workerFunctions.postMessage({type:"barcodeFindSearchStopped",payload:{foundItems:l}})},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:Ce}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")},setAllItemsFound:(r,a)=>{let i={text:a,toastHintStyle:A.Success,tag:"AllItemsFound"};this.setToast(r,i)},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")},setItemListUpdated:(r,a)=>{let i={text:a,toastHintStyle:A.Info,tag:"ItemListUpdated"};this.setToast(r,i)}});return new e}};var y=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 Ke={torch_state:new y("torch_state"),scanning_mode:new y("scanning_mode"),sound_enabled:new y("sound_enabled"),haptic_enabled:new y("haptic_enabled"),hand_mode:new y("hand_mode"),session_stop_reason:new y("session_stop_reason"),camera_position:new y("camera_position")},_=class{getBehaviorSubject(e){return Ke[e]}};var z=class{constructor(e,r,a){this.captureListenerSet=!1;this.propertyPushSource=new _;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,n)=>{this.sparkScanDidScan(s,n),i.delete(),s.delete(),n.delete()},didUpdateSession:(i,s,n)=>{this.sparkScanDidUpdateSession(s),i.delete(),s.delete(),n.delete()}}),r=this.Module.Feedback.extend("Feedback",{emit:()=>{this.successFeedback()}}),a=this.Module.SparkScanDeserializerListener.extend("SparkScanDeserializerListener",{onModeDeserializationFinished:(i,s,n)=>{this.captureListenerSet||(s.addListener(new e,1),s.setSuccessFeedback(new r),s.setPropertyPushSource(this.propertyPushSource),this.captureListenerSet=!0),i.delete(),s.delete(),n.delete()},onModeDeserializationStarted(i,s,n){i.delete(),s.delete(),n.delete()},onSettingsDeserializationStarted(i,s,n){i.delete(),s.delete(),n.delete()},onSettingsDeserializationFinished(i,s,n){i.delete(),s.delete(),n.delete()},onOverlayDeserializationStarted(i,s,n){i.delete(),s.delete(),n.delete()},onOverlayDeserializationFinished:(i,s,n)=>{var o;(o=this.sparkScanOverlay)==null||o.delete(),this.sparkScanOverlay=s,i.delete(),n.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"})}sparkScanDidScan(e,r){let a=this.coreEngine.convertToLoadableFrameData(r);this.workerFunctions.postMessage({type:"sparkScanDidScan",payload:{session:JSON.parse(e.toJson()),frameData:a}})}};var V=class extends D{constructor(e,r){super(e,r)}getModeDeserializers(){this.barcodeCaptureMode=new N(this,this.Module,this.workerFunctions),this.barcodeBatchMode=new R(this,this.Module,this.workerFunctions),this.sparkScanMode=new z(this,this.Module,this.workerFunctions),this.barcodeFindMode=new H(this,this.Module,this.workerFunctions),this.barcodeArMode=new E(this,this.Module,this.workerFunctions);let e=super.getModeDeserializers();return e.push_back(this.barcodeCaptureMode.getCaptureDeserializer()),e.push_back(this.barcodeBatchMode.getBatchDeserializer()),e.push_back(this.sparkScanMode.getSparkScanDeserializer()),e}getWasmSideModuleFileName(){return""}getWasmCoreFileName(e,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?"076ea0ee0cc1947c7d6dd9f31009f3326f64896a21146e64ba333462a654120a":"87bd3b2bf709f692fb1b3c33acb325ef734ef276d5a1f594bd55f84fed4038e6":e?"eae8da5a618178a2a034603a788d8838d6f8b79d594af1dbd89c36cacfa4545f":"180414f0accd73ac78bbe3c90597c7b1ddb79fbe9cfefe25a476d38618150bc3"}getWasmMetadata(){return p}};function Xe(t){return(r=>/^[$A-Z_a-z][\\w$]*\\s*\\(.*\\)\\s*\\{/.test(r)&&!r.startsWith("function"))(t)?`function ${t}`:t}var Ye=["fetch","XMLHttpRequest","eval","Function","self","globalThis","Module","importScripts","this","console","window","document","import","Worker","ServiceWorker"];function Ze(t){return Ye.map(r=>new RegExp(`\\\\b${r}\\\\b`,"g")).some(r=>r.test(t))}function ke(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 J=class extends Z{constructor(e,r){super(e,r),this.dataCaptureInstance=new V(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(o){s=void 0,i=C(o)}let n={type:"workerTaskId",command:e,id:r,payload:this.hasPayload(s)?s.payload:void 0};i!=null&&(n.error=i),this.postMessage(n,this.hasTransferables(s)?s.transferables:[])}onMessage(e){switch(e.data.command){case"sparkScanEmitErrorFeedback":{let{data: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"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=ke(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 Qr=new J(self,{get:()=>self.Module,set:t=>{self.Module=t}});function ea(t){}})();\n'],{type:"application/javascript"})),e=new Worker(s,r);return URL.revokeObjectURL(s),e}var o=class r extends DataCaptureLoader{constructor(){super(...arguments);this._name="BarcodeCapture";}get dataCaptureWorker(){return (this._dataCaptureWorker)!=null||(this._dataCaptureWorker=n({name:this.name})),this._dataCaptureWorker}get name(){return this._name}static async create(e){var a;let t=new r(e);return await t.workerCommand("setLogLevel",{level:(a=e.logLevel)!=null?a:Logger.Level.Debug}),await t.load(),t}async workerCommand(e,t,a){return new Promise((d,c)=>{let i=this.workerCommandId++;this.workerTasks.set(i,{resolve:d,reject:c,command:e});let l={...t,command:e,id:i};this.dataCaptureWorker.postMessage(l,a);})}};
|
|
2
2
|
export{o as a};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import {a as a$2}from'./chunk-OTZPCIBD.js';import {a as a$3}from'./chunk-ZXTRTKEZ.js';import {a}from'./chunk-QCD3RIT4.js';import {a as a$5}from'./chunk-3UGEG7WU.js';import {c as c$1,b as b$3}from'./chunk-SZUPDKV5.js';import {a as a$4}from'./chunk-OXYHO7V6.js';import {b}from'./chunk-JMUNN3HX.js';import {a as a$1,c,b as b$1}from'./chunk-WICRT6CF.js';import {b as b$2}from'./chunk-OLJXVUYE.js';import {DataCaptureView,Anchor,LogoStyle,CameraAccess,Camera,isCameraFrameSource,FrameSourceState,Color,CameraPosition,TorchState,Logger,NumberWithUnit,RadiusLocationSelection}from'@scandit/web-datacapture-core';import {localStorage}from'@scandit/web-datacapture-core/build/js/private/utils/safeStorage.js';import {Timeout}from'@scandit/web-datacapture-core/build/js/private/utils/timeout.js';var P=class O{constructor(a$4,e,t,i){this.cameras=[];this.preferenceManager=new a(localStorage);this.defaultSuccessBrush=a$1.defaultSuccessBrush();this.defaultErrorBrush=a$1.defaultErrorBrush();this.sparkScanView=a$4,this.context=e,this.sparkScan=t,this.sparkScanViewSettings=i,this.stateManager=new a$2(this.sparkScanViewSettings,this.preferenceManager),this.feedbackManager=a$3.withDefaults(i.soundEnabled,i.hapticEnabled),this.analyticsManager=b.forContext(e),this.triggerButtonCollapseTimeout=new Timeout(this.sparkScanViewSettings.triggerButtonCollapseTimeout,async()=>{this.stateManager.state!=="idle"&&await this.switchToIdleState({sessionStopReason:"timeout"});}),this.inactiveStateTimeout=new Timeout(i.inactiveStateTimeout,async()=>{this.stateManager.state!=="inactive"&&!this.stateManager.holdingToScan&&await this.switchToInactiveState({sessionStopReason:"timeout"});}),this.stateTimeouts={active:this.inactiveStateTimeout,inactive:this.triggerButtonCollapseTimeout},this.switchToIdleState();}get portraitOrientationTriggerButtonTranslateX(){var a;return (a=this.stateManager.portraitOrientationTriggerButtonTranslateX)!=null?a:this.defaultTriggerButtonTranslateX}get portraitOrientationTriggerButtonTranslateY(){var a;return (a=this.stateManager.portraitOrientationTriggerButtonTranslateY)!=null?a:this.defaultTriggerButtonTranslateY}get landscapeOrientationTriggerButtonTranslateX(){var a;return (a=this.stateManager.landscapeOrientationTriggerButtonTranslateX)!=null?a:this.defaultTriggerButtonTranslateX}get landscapeOrientationTriggerButtonTranslateY(){var a;return (a=this.stateManager.landscapeOrientationTriggerButtonTranslateY)!=null?a:this.defaultTriggerButtonTranslateY}get portraitOrientationMiniPreviewTranslateX(){var a;return (a=this.stateManager.portraitOrientationMiniPreviewTranslateX)!=null?a:this.defaultMiniPreviewTranslateX}get portraitOrientationMiniPreviewTranslateY(){var a;return (a=this.stateManager.portraitOrientationMiniPreviewTranslateY)!=null?a:this.defaultMiniPreviewTranslateY}get landscapeOrientationMiniPreviewTranslateX(){var a;return (a=this.stateManager.landscapeOrientationMiniPreviewTranslateX)!=null?a:this.defaultMiniPreviewTranslateX}get landscapeOrientationMiniPreviewTranslateY(){var a;return (a=this.stateManager.landscapeOrientationMiniPreviewTranslateY)!=null?a:this.defaultMiniPreviewTranslateY}get defaultTriggerButtonTranslateX(){return this.parentViewSizes.width-Math.min(this.parentViewSizes.width/3,110)-90/2}get defaultTriggerButtonTranslateY(){return this.parentViewSizes.height-Math.min(this.parentViewSizes.height/3,250)-90/2}get defaultMiniPreviewTranslateX(){return this.parentViewSizes.width-225-16}get parentViewSizes(){var a,e;return {width:(a=this.sparkScanView.parentElement.clientWidth)!=null?a:window.innerWidth,height:(e=this.sparkScanView.parentElement.clientHeight)!=null?e:window.innerHeight}}get defaultMiniPreviewTranslateY(){return 16}static forView(a,e,t,i){return new O(a,e,t,i)}async prepareScanning(a){var i;this.context.addListener(this),this.dataCaptureView=await DataCaptureView.forContext(this.context),this.dataCaptureView.logoAnchor=Anchor.BottomCenter,this.dataCaptureView.logoStyle=LogoStyle.Minimal,this.dataCaptureView.setHiddenProperty("stopVideoTracksOnVisibilityChange",false),this.dataCaptureView.setHiddenProperty("freezeFrameWhenStoppingFrameSource",false),this.dataCaptureView.connectToElement(a);let e=await CameraAccess.getCameras();this.cameras=e.map(r=>Camera.fromDeviceCamera(r)),this.camera=isCameraFrameSource(this.context.frameSource)?this.context.frameSource:(i=this.cameras.find(r=>r.position===this.sparkScanViewSettings.defaultCameraPosition))!=null?i:Camera.default,await this.camera.applySettings(a$4.recommendedCameraSettings),await this.context.setFrameSource(this.camera),await this.camera.switchToDesiredState(FrameSourceState.Standby);let t=await this.camera.isTorchAvailable();this.sparkScanView.setTorchAvailable(t),this.sparkScanView.setZoomAvailable(this.camera.isZoomAvailable()),this.sparkScanView.cameraSwitchButtonTapped(t,this.camera.position),await this.context.setMode(this.sparkScan),this.sparkScan.addListener(this),this.sparkScanOverlay=await a$5.withSparkScanForView(this.sparkScan,this.dataCaptureView),await this.sparkScanOverlay.setShouldRemoveLocationsAfterScan(this.stateManager.scanningBehavior==="continuous"),this.analyticsManager.startSession({cameraPosition:this.camera.position,handMode:"right",hapticEnabled:this.sparkScanViewSettings.hapticEnabled,scanningMode:this.stateManager.scanningMode,soundEnabled:this.sparkScanViewSettings.soundEnabled,torchState:this.camera.getDesiredTorchState()}),await this.applyPreferences();}async startScanning(){await this.switchToActiveState();}async pauseScanning(){await this.switchToInactiveState({sessionStopReason:"user"});}async stopScanning(a){var e;await this.sparkScan.setEnabled(false),this.sparkScan.removeListener(this),await((e=this.camera)==null?void 0:e.switchToDesiredState(FrameSourceState.Off)),this.dataCaptureView.detachFromElement(),this.context.removeListener(this),this.analyticsManager.setSessionStopReason(a.sessionStopReason);}async onTriggerButtonPointerDown(){await this.sparkScan.setResultSuppressionEnabled(true);}async onTriggerButtonTap(){switch(await this.sparkScan.setResultSuppressionEnabled(false),this.stateManager.state){case "Initial":return;case "idle":case "inactive":case "error":{await this.switchToActiveState({barcodeFeedback:new c(Color.fromRGBA(0,0,0,0),this.defaultSuccessBrush,this.feedbackManager.tapFeedback)});return}case "active":await(this.stateManager.continuousModeEnabled?this.switchToInactiveState({sessionStopReason:"user",barcodeFeedback:new c(Color.fromRGBA(0,0,0,0),this.defaultSuccessBrush,this.feedbackManager.tapFeedback)}):this.switchToActiveState({barcodeFeedback:new c(Color.fromRGBA(0,0,0,0),this.defaultSuccessBrush,this.feedbackManager.tapFeedback)}));}}async onTriggerButtonLongPressStart(){var a;await this.sparkScan.setResultSuppressionEnabled(false),this.sparkScanViewSettings.holdToScanEnabled&&(this.scanningBehaviorCache=this.stateManager.scanningBehavior,this.stateManager.scanningBehavior="continuous",this.stateManager.holdingToScan=true,await((a=this.sparkScanOverlay)==null?void 0:a.setShouldRemoveLocationsAfterScan(true)),await this.switchToActiveState({barcodeFeedback:new c(Color.fromRGBA(0,0,0,0),this.defaultSuccessBrush,this.feedbackManager.tapFeedback)}));}async onTriggerButtonLongPressEnd(){var a,e;this.sparkScanViewSettings.holdToScanEnabled&&this.stateManager.state!=="error"&&(this.stateManager.scanningBehavior=(a=this.scanningBehaviorCache)!=null?a:"single",this.stateManager.holdingToScan=false,await((e=this.sparkScanOverlay)==null?void 0:e.setShouldRemoveLocationsAfterScan(this.stateManager.continuousModeEnabled)),await this.switchToInactiveState({sessionStopReason:"user",barcodeFeedback:new b$1("",0,Color.fromRGBA(0,0,0,0),this.defaultErrorBrush,this.feedbackManager.noFeedback)}));}async onClickOutside(){this.stateManager.idleState||await this.switchToIdleState();}async onVisibilityChange(){await this.switchToIdleState();}async onTargetModeButtonTap(a,e=this.feedbackManager.tapFeedback,t=true){var h,s,S;e.emit();let i=String(a),r={true:a&&this.stateManager.scanningMode instanceof b$3,false:!a&&this.stateManager.scanningMode instanceof c$1}[i];r&&(this.stateManager.scanningMode=this.stateManager.scanningMode.changeMode()),this.enableTargetMode(a),await((h=this.sparkScanOverlay)==null?void 0:h.setShouldDrawViewfinder(a)),this.startTimeoutForCurrentState(),this.sparkScanView.targetModeButtonTapped(a,t),r&&((S=(s=this.listener)==null?void 0:s.didChangeScanningMode)==null||S.call(s,this.stateManager.scanningMode),this.analyticsManager.setScanningMode(this.stateManager.scanningMode));}async onScanningBehaviorButtonTap(a,e=this.feedbackManager.tapFeedback,t=true){var i;e.emit(),this.stateManager.scanningMode=this.stateManager.scanningMode.copyWith(a?"continuous":"single"),await((i=this.sparkScanOverlay)==null?void 0:i.setShouldRemoveLocationsAfterScan(a)),this.startTimeoutForCurrentState(),this.sparkScanView.scanningBehaviorButtonTapped(a,t),this.analyticsManager.setScanningMode(this.stateManager.scanningMode);}async onBarcodeFindButtonTap(){var a,e;await this.switchToIdleState({sessionStopReason:"user"}),(e=(a=this.listener)==null?void 0:a.didTapBarcodeFindButton)==null||e.call(a,this.sparkScanView),this.restartTimeouts();}async onLabelCaptureButtonTap(){var a,e;await this.switchToIdleState({sessionStopReason:"user"}),(e=(a=this.listener)==null?void 0:a.didTapLabelCaptureButton)==null||e.call(a,this.sparkScanView),this.restartTimeouts();}async onCameraSwitchButtonTap(){if(this.feedbackManager.emitTapFeedback(),this.restartTimeouts(),!this.camera||this.stateManager.state==="error")return;let a={[CameraPosition.WorldFacing]:CameraPosition.UserFacing,[CameraPosition.UserFacing]:CameraPosition.WorldFacing}[this.camera.position],e=this.cameras.find(t=>t.position===a);e&&(await this.camera.switchToDesiredState(FrameSourceState.Off),await e.applySettings(this.camera.settings),await this.context.setFrameSource(e),await e.switchToDesiredState(FrameSourceState.On),this.sparkScanView.cameraSwitchButtonTapped(await e.isTorchAvailable(),a),this.analyticsManager.setCameraPosition(a),this.camera=e);}async onTorchButtonTap(a,e=this.feedbackManager.tapFeedback,t=true){var i;e.emit(),this.stateManager.torchState=a?TorchState.On:TorchState.Off,((i=this.camera)==null?void 0:i.getCurrentState())===FrameSourceState.On&&await this.camera.setDesiredTorchState(this.stateManager.torchState),this.startTimeoutForCurrentState(),this.sparkScanView.torchButtonTapped(a,t),this.analyticsManager.setTorchState(this.stateManager.torchState);}restartTimeouts(){for(let a of [this.triggerButtonCollapseTimeout,this.inactiveStateTimeout,this.resumeCapturingTimeout])(a==null?void 0:a.running)===true&&a.start();}async onMiniPreviewCloseButtonTap(){await this.switchToIdleState({sessionStopReason:"user"});}onMiniPreviewResizeButtonTap(){(this.stateManager.state==="active"||this.stateManager.state==="inactive")&&(this.feedbackManager.emitTapFeedback(),this.startTimeoutForCurrentState());}async onMiniPreviewZoomButtonTap(a){this.feedbackManager.emitTapFeedback(),this.stateManager.zoomFactor=a,this.camera&&(this.camera.settings.zoomFactor=a,await this.camera.applySettings(this.camera.settings)),this.startTimeoutForCurrentState();}async onMiniPreviewDrag(a,e){switch(this.stateManager.state==="active"&&await this.sparkScan.setEnabled(false),e){case "landscape-primary":case "landscape-secondary":{this.stateManager.landscapeOrientationMiniPreviewTranslateX=a.x,this.stateManager.landscapeOrientationMiniPreviewTranslateY=a.y;break}case "portrait-primary":case "portrait-secondary":{this.stateManager.portraitOrientationMiniPreviewTranslateX=a.x,this.stateManager.portraitOrientationMiniPreviewTranslateY=a.y;break}}this.restartTimeouts();}onMiniPreviewPointerMove(){this.restartTimeouts();}async onMiniPreviewPointerUp(){await this.switchToActiveState();}async onMiniPreviewDragEnd(){this.stateManager.state==="active"&&await this.sparkScan.setEnabled(true);}onTriggerButtonDrag(a,e){switch(e){case "landscape-primary":case "landscape-secondary":{this.stateManager.landscapeOrientationTriggerButtonTranslateX=a.x,this.stateManager.landscapeOrientationTriggerButtonTranslateY=a.y;break}case "portrait-primary":case "portrait-secondary":{this.stateManager.portraitOrientationTriggerButtonTranslateX=a.x,this.stateManager.portraitOrientationTriggerButtonTranslateY=a.y;break}}}async onOrientationChange(){if(this.stateManager.state==="active"&&this.stateManager.holdingToScan){this.restartTimeouts();return}this.stateManager.state==="error"&&await this.switchToInactiveState({sessionStopReason:"user"});}async didScan(a,e){if(!e.newlyRecognizedBarcode)return;let t=this.sparkScanView.feedbackDelegate.getFeedbackForBarcode(e.newlyRecognizedBarcode);t instanceof b$1?await this.switchToErrorState({barcodeFeedback:t}):t instanceof c&&await(this.stateManager.continuousModeEnabled?this.switchToActiveState({barcodeFeedback:t}):this.switchToInactiveState({sessionStopReason:"user",barcodeFeedback:t,emitSuccessFeedback:true})),this.restartTimeouts();}didChangeFrameSource(a,e){var t;if(isCameraFrameSource(e))this.camera=e;else {let i=(t=e==null?void 0:e.toJSONObject().type)!=null?t:"unknown";Logger.warn(`SparkScanView instances require a camera frame source to work, but a frame source of type "${i}" was found.`);}}setListener(a){this.listener=a;}brushForFeedback(a){return a.brush}async switchToIdleState(a={}){var e,t,i;this.feedbackManager.emitTapFeedback(),await((e=this.sparkScanOverlay)==null?void 0:e.overlayReadyForDraw()),this.setState("idle"),await this.sparkScan.setEnabled(false),await((t=this.camera)==null?void 0:t.switchToDesiredState(FrameSourceState.Standby)),this.triggerButtonCollapseTimeout.stop(),this.inactiveStateTimeout.stop(),(i=this.resumeCapturingTimeout)==null||i.stop(),this.sparkScanView.switchToIdleState(),a.sessionStopReason!=null&&this.analyticsManager.setSessionStopReason(a.sessionStopReason);}async switchToActiveState(a={}){var t,i,r,o,h,s,S;let e=this.stateManager.state;await((t=this.camera)==null?void 0:t.switchToDesiredState(FrameSourceState.On)),await((i=this.camera)==null?void 0:i.setDesiredTorchState(this.stateManager.torchState)),a.barcodeFeedback&&await((r=this.sparkScanOverlay)==null?void 0:r.setBrush(this.brushForFeedback(a.barcodeFeedback))),await((o=this.sparkScanOverlay)==null?void 0:o.setShouldRemoveLocationsAfterScan(this.stateManager.continuousModeEnabled)),await((h=this.sparkScanOverlay)==null?void 0:h.overlayReadyForDraw()),this.feedbackManager.emitBarcodeFeedback(a.barcodeFeedback),this.stateManager.holdingToScan||this.inactiveStateTimeout.start(),this.triggerButtonCollapseTimeout.stop(),(s=this.resumeCapturingTimeout)==null||s.stop(),await this.sparkScanView.switchToActiveState(this.sparkScanViewSettings.visualFeedbackEnabled&&a.barcodeFeedback instanceof c,this.stateManager.scanningBehavior,(S=a.barcodeFeedback)==null?void 0:S.visualFeedbackColor,this.stateManager.zoomedIn&&e!=="active"),await this.sparkScan.setEnabled(true),this.setState("active");}async switchToInactiveState(a){var t,i,r,o,h,s;(a.emitSuccessFeedback)!=null||(a.emitSuccessFeedback=true),this.setState("inactive"),a.barcodeFeedback&&await((t=this.sparkScanOverlay)==null?void 0:t.setBrush(this.brushForFeedback(a.barcodeFeedback))),await this.sparkScan.setEnabled(false),this.stateManager.scanningMode.previewBehavior==="persistent"?a.barcodeFeedback instanceof c&&await((i=this.sparkScanOverlay)==null?void 0:i.setShouldRemoveLocationsAfterScan(true)):await((r=this.camera)==null?void 0:r.switchToDesiredState(FrameSourceState.Standby)),this.feedbackManager.emitBarcodeFeedback(a.barcodeFeedback),await((o=this.sparkScanOverlay)==null?void 0:o.overlayReadyForDraw()),this.triggerButtonCollapseTimeout.start(),this.inactiveStateTimeout.stop(),(h=this.resumeCapturingTimeout)==null||h.stop(),await this.sparkScanView.switchToInactiveState(this.sparkScanViewSettings.visualFeedbackEnabled&&a.barcodeFeedback instanceof c&&a.emitSuccessFeedback,this.stateManager.scanningBehavior,this.stateManager.previewBehavior,(s=a.barcodeFeedback)==null?void 0:s.visualFeedbackColor),this.analyticsManager.setSessionStopReason(a.sessionStopReason);}async switchToErrorState(a){var t,i,r,o;let e=a.barcodeFeedback.resumeCapturingDelay>0;e&&(this.setState("error"),this.stateManager.scanningBehavior="single",await this.sparkScan.setEnabled(false),await((t=this.camera)==null?void 0:t.switchToDesiredState(FrameSourceState.Standby)),this.resumeCapturingTimeout=new Timeout(a.barcodeFeedback.resumeCapturingDelay,async()=>{this.stateManager.state!=="active"&&await this.switchToActiveState();}),this.resumeCapturingTimeout.start()),await((i=this.sparkScanOverlay)==null?void 0:i.setErrorBrush(a.barcodeFeedback.brush)),await((r=this.sparkScanOverlay)==null?void 0:r.overlayReadyForDraw()),await((o=this.sparkScanOverlay)==null?void 0:o.setShouldRemoveLocationsAfterScan(a.barcodeFeedback.resumeCapturingDelay===0)),await this.sparkScan.workerCommand("sparkScanEmitErrorFeedback",{shouldRemoveBrush:!e}),this.feedbackManager.emitBarcodeFeedback(a.barcodeFeedback),this.triggerButtonCollapseTimeout.stop(),this.inactiveStateTimeout.stop(),await this.sparkScanView.switchToErrorState(a.barcodeFeedback,this.sparkScanViewSettings.visualFeedbackEnabled);}enableTargetModeLocationSelection(a){var r;let e=a?b$2.SparkScan.SparkScanSettings.targetModeLocationSelection.radius:b$2.SparkScan.SparkScanSettings.locationSelection.radius,t=a?b$2.SparkScan.SparkScanSettings.targetModeLocationSelection.unit:b$2.SparkScan.SparkScanSettings.locationSelection.unit,i=new NumberWithUnit(e,t);this.sparkScan.settings.locationSelection=new RadiusLocationSelection(i),(r=this.sparkScanOverlay)==null||r.setRadius(i);}enableTargetMode(a){this.enableTargetModeLocationSelection(a);}async applyPreferences(){await this.onTargetModeButtonTap(this.stateManager.targetModeEnabled,this.feedbackManager.noFeedback,false),await this.onScanningBehaviorButtonTap(this.stateManager.continuousModeEnabled,this.feedbackManager.noFeedback,false),await this.onTorchButtonTap(this.stateManager.torchEnabled,this.feedbackManager.noFeedback,false);}setState(a){var e,t;a!==this.stateManager.state&&(this.stateManager.state=a,(t=(e=this.listener)==null?void 0:e.didChangeViewState)==null||t.call(e,a));}startTimeoutForCurrentState(){let a=this.stateTimeouts[this.stateManager.state];a==null||a.start();}};export{P as a};
|
|
1
|
+
import {a as a$2}from'./chunk-OTZPCIBD.js';import {a as a$3}from'./chunk-ZXTRTKEZ.js';import {a}from'./chunk-QCD3RIT4.js';import {b}from'./chunk-JMUNN3HX.js';import {a as a$1,c,b as b$1}from'./chunk-WICRT6CF.js';import {a as a$5}from'./chunk-3UGEG7WU.js';import {c as c$1,b as b$3}from'./chunk-SZUPDKV5.js';import {a as a$4}from'./chunk-OXYHO7V6.js';import {b as b$2}from'./chunk-OLJXVUYE.js';import {DataCaptureView,Anchor,LogoStyle,CameraAccess,Camera,isCameraFrameSource,FrameSourceState,Color,CameraPosition,TorchState,Logger,NumberWithUnit,RadiusLocationSelection}from'@scandit/web-datacapture-core';import {localStorage}from'@scandit/web-datacapture-core/build/js/private/utils/safeStorage.js';import {Timeout}from'@scandit/web-datacapture-core/build/js/private/utils/timeout.js';var P=class O{constructor(a$4,e,t,i){this.cameras=[];this.preferenceManager=new a(localStorage);this.defaultSuccessBrush=a$1.defaultSuccessBrush();this.defaultErrorBrush=a$1.defaultErrorBrush();this.sparkScanView=a$4,this.context=e,this.sparkScan=t,this.sparkScanViewSettings=i,this.stateManager=new a$2(this.sparkScanViewSettings,this.preferenceManager),this.feedbackManager=a$3.withDefaults(i.soundEnabled,i.hapticEnabled),this.analyticsManager=b.forContext(e),this.triggerButtonCollapseTimeout=new Timeout(this.sparkScanViewSettings.triggerButtonCollapseTimeout,async()=>{this.stateManager.state!=="idle"&&await this.switchToIdleState({sessionStopReason:"timeout"});}),this.inactiveStateTimeout=new Timeout(i.inactiveStateTimeout,async()=>{this.stateManager.state!=="inactive"&&!this.stateManager.holdingToScan&&await this.switchToInactiveState({sessionStopReason:"timeout"});}),this.stateTimeouts={active:this.inactiveStateTimeout,inactive:this.triggerButtonCollapseTimeout},this.switchToIdleState();}get portraitOrientationTriggerButtonTranslateX(){var a;return (a=this.stateManager.portraitOrientationTriggerButtonTranslateX)!=null?a:this.defaultTriggerButtonTranslateX}get portraitOrientationTriggerButtonTranslateY(){var a;return (a=this.stateManager.portraitOrientationTriggerButtonTranslateY)!=null?a:this.defaultTriggerButtonTranslateY}get landscapeOrientationTriggerButtonTranslateX(){var a;return (a=this.stateManager.landscapeOrientationTriggerButtonTranslateX)!=null?a:this.defaultTriggerButtonTranslateX}get landscapeOrientationTriggerButtonTranslateY(){var a;return (a=this.stateManager.landscapeOrientationTriggerButtonTranslateY)!=null?a:this.defaultTriggerButtonTranslateY}get portraitOrientationMiniPreviewTranslateX(){var a;return (a=this.stateManager.portraitOrientationMiniPreviewTranslateX)!=null?a:this.defaultMiniPreviewTranslateX}get portraitOrientationMiniPreviewTranslateY(){var a;return (a=this.stateManager.portraitOrientationMiniPreviewTranslateY)!=null?a:this.defaultMiniPreviewTranslateY}get landscapeOrientationMiniPreviewTranslateX(){var a;return (a=this.stateManager.landscapeOrientationMiniPreviewTranslateX)!=null?a:this.defaultMiniPreviewTranslateX}get landscapeOrientationMiniPreviewTranslateY(){var a;return (a=this.stateManager.landscapeOrientationMiniPreviewTranslateY)!=null?a:this.defaultMiniPreviewTranslateY}get defaultTriggerButtonTranslateX(){return this.parentViewSizes.width-Math.min(this.parentViewSizes.width/3,110)-90/2}get defaultTriggerButtonTranslateY(){return this.parentViewSizes.height-Math.min(this.parentViewSizes.height/3,250)-90/2}get defaultMiniPreviewTranslateX(){return this.parentViewSizes.width-225-16}get parentViewSizes(){var a,e;return {width:(a=this.sparkScanView.parentElement.clientWidth)!=null?a:window.innerWidth,height:(e=this.sparkScanView.parentElement.clientHeight)!=null?e:window.innerHeight}}get defaultMiniPreviewTranslateY(){return 16}static forView(a,e,t,i){return new O(a,e,t,i)}async prepareScanning(a){var i;this.context.addListener(this),this.dataCaptureView=await DataCaptureView.forContext(this.context),this.dataCaptureView.logoAnchor=Anchor.BottomCenter,this.dataCaptureView.logoStyle=LogoStyle.Minimal,this.dataCaptureView.setHiddenProperty("stopVideoTracksOnVisibilityChange",false),this.dataCaptureView.setHiddenProperty("freezeFrameWhenStoppingFrameSource",false),this.dataCaptureView.connectToElement(a);let e=await CameraAccess.getCameras();this.cameras=e.map(r=>Camera.fromDeviceCamera(r)),this.camera=isCameraFrameSource(this.context.frameSource)?this.context.frameSource:(i=this.cameras.find(r=>r.position===this.sparkScanViewSettings.defaultCameraPosition))!=null?i:Camera.default,await this.camera.applySettings(a$4.recommendedCameraSettings),await this.context.setFrameSource(this.camera),await this.camera.switchToDesiredState(FrameSourceState.Standby);let t=await this.camera.isTorchAvailable();this.sparkScanView.setTorchAvailable(t),this.sparkScanView.setZoomAvailable(this.camera.isZoomAvailable()),this.sparkScanView.cameraSwitchButtonTapped(t,this.camera.position),await this.context.setMode(this.sparkScan),this.sparkScan.addListener(this),this.sparkScanOverlay=await a$5.withSparkScanForView(this.sparkScan,this.dataCaptureView),await this.sparkScanOverlay.setShouldRemoveLocationsAfterScan(this.stateManager.scanningBehavior==="continuous"),this.analyticsManager.startSession({cameraPosition:this.camera.position,handMode:"right",hapticEnabled:this.sparkScanViewSettings.hapticEnabled,scanningMode:this.stateManager.scanningMode,soundEnabled:this.sparkScanViewSettings.soundEnabled,torchState:this.camera.getDesiredTorchState()}),await this.applyPreferences();}async startScanning(){await this.switchToActiveState();}async pauseScanning(){await this.switchToInactiveState({sessionStopReason:"user"});}async stopScanning(a){var e;await this.sparkScan.setEnabled(false),this.sparkScan.removeListener(this),await((e=this.camera)==null?void 0:e.switchToDesiredState(FrameSourceState.Off)),this.dataCaptureView.detachFromElement(),this.context.removeListener(this),this.analyticsManager.setSessionStopReason(a.sessionStopReason);}async onTriggerButtonPointerDown(){await this.sparkScan.setResultSuppressionEnabled(true);}async onTriggerButtonTap(){switch(await this.sparkScan.setResultSuppressionEnabled(false),this.stateManager.state){case "Initial":return;case "idle":case "inactive":case "error":{await this.switchToActiveState({barcodeFeedback:new c(Color.fromRGBA(0,0,0,0),this.defaultSuccessBrush,this.feedbackManager.tapFeedback)});return}case "active":await(this.stateManager.continuousModeEnabled?this.switchToInactiveState({sessionStopReason:"user",barcodeFeedback:new c(Color.fromRGBA(0,0,0,0),this.defaultSuccessBrush,this.feedbackManager.tapFeedback)}):this.switchToActiveState({barcodeFeedback:new c(Color.fromRGBA(0,0,0,0),this.defaultSuccessBrush,this.feedbackManager.tapFeedback)}));}}async onTriggerButtonLongPressStart(){var a;await this.sparkScan.setResultSuppressionEnabled(false),this.sparkScanViewSettings.holdToScanEnabled&&(this.scanningBehaviorCache=this.stateManager.scanningBehavior,this.stateManager.scanningBehavior="continuous",this.stateManager.holdingToScan=true,await((a=this.sparkScanOverlay)==null?void 0:a.setShouldRemoveLocationsAfterScan(true)),await this.switchToActiveState({barcodeFeedback:new c(Color.fromRGBA(0,0,0,0),this.defaultSuccessBrush,this.feedbackManager.tapFeedback)}));}async onTriggerButtonLongPressEnd(){var a,e;this.sparkScanViewSettings.holdToScanEnabled&&this.stateManager.state!=="error"&&(this.stateManager.scanningBehavior=(a=this.scanningBehaviorCache)!=null?a:"single",this.stateManager.holdingToScan=false,await((e=this.sparkScanOverlay)==null?void 0:e.setShouldRemoveLocationsAfterScan(this.stateManager.continuousModeEnabled)),await this.switchToInactiveState({sessionStopReason:"user",barcodeFeedback:new b$1("",0,Color.fromRGBA(0,0,0,0),this.defaultErrorBrush,this.feedbackManager.noFeedback)}));}async onClickOutside(){this.stateManager.idleState||await this.switchToIdleState();}async onVisibilityChange(){await this.switchToIdleState();}async onTargetModeButtonTap(a,e=this.feedbackManager.tapFeedback,t=true){var h,s,S;e.emit();let i=String(a),r={true:a&&this.stateManager.scanningMode instanceof b$3,false:!a&&this.stateManager.scanningMode instanceof c$1}[i];r&&(this.stateManager.scanningMode=this.stateManager.scanningMode.changeMode()),this.enableTargetMode(a),await((h=this.sparkScanOverlay)==null?void 0:h.setShouldDrawViewfinder(a)),this.startTimeoutForCurrentState(),this.sparkScanView.targetModeButtonTapped(a,t),r&&((S=(s=this.listener)==null?void 0:s.didChangeScanningMode)==null||S.call(s,this.stateManager.scanningMode),this.analyticsManager.setScanningMode(this.stateManager.scanningMode));}async onScanningBehaviorButtonTap(a,e=this.feedbackManager.tapFeedback,t=true){var i;e.emit(),this.stateManager.scanningMode=this.stateManager.scanningMode.copyWith(a?"continuous":"single"),await((i=this.sparkScanOverlay)==null?void 0:i.setShouldRemoveLocationsAfterScan(a)),this.startTimeoutForCurrentState(),this.sparkScanView.scanningBehaviorButtonTapped(a,t),this.analyticsManager.setScanningMode(this.stateManager.scanningMode);}async onBarcodeFindButtonTap(){var a,e;await this.switchToIdleState({sessionStopReason:"user"}),(e=(a=this.listener)==null?void 0:a.didTapBarcodeFindButton)==null||e.call(a,this.sparkScanView),this.restartTimeouts();}async onLabelCaptureButtonTap(){var a,e;await this.switchToIdleState({sessionStopReason:"user"}),(e=(a=this.listener)==null?void 0:a.didTapLabelCaptureButton)==null||e.call(a,this.sparkScanView),this.restartTimeouts();}async onCameraSwitchButtonTap(){if(this.feedbackManager.emitTapFeedback(),this.restartTimeouts(),!this.camera||this.stateManager.state==="error")return;let a={[CameraPosition.WorldFacing]:CameraPosition.UserFacing,[CameraPosition.UserFacing]:CameraPosition.WorldFacing}[this.camera.position],e=this.cameras.find(t=>t.position===a);e&&(await this.camera.switchToDesiredState(FrameSourceState.Off),await e.applySettings(this.camera.settings),await this.context.setFrameSource(e),await e.switchToDesiredState(FrameSourceState.On),this.sparkScanView.cameraSwitchButtonTapped(await e.isTorchAvailable(),a),this.analyticsManager.setCameraPosition(a),this.camera=e);}async onTorchButtonTap(a,e=this.feedbackManager.tapFeedback,t=true){var i;e.emit(),this.stateManager.torchState=a?TorchState.On:TorchState.Off,((i=this.camera)==null?void 0:i.getCurrentState())===FrameSourceState.On&&await this.camera.setDesiredTorchState(this.stateManager.torchState),this.startTimeoutForCurrentState(),this.sparkScanView.torchButtonTapped(a,t),this.analyticsManager.setTorchState(this.stateManager.torchState);}restartTimeouts(){for(let a of [this.triggerButtonCollapseTimeout,this.inactiveStateTimeout,this.resumeCapturingTimeout])(a==null?void 0:a.running)===true&&a.start();}async onMiniPreviewCloseButtonTap(){await this.switchToIdleState({sessionStopReason:"user"});}onMiniPreviewResizeButtonTap(){(this.stateManager.state==="active"||this.stateManager.state==="inactive")&&(this.feedbackManager.emitTapFeedback(),this.startTimeoutForCurrentState());}async onMiniPreviewZoomButtonTap(a){this.feedbackManager.emitTapFeedback(),this.stateManager.zoomFactor=a,this.camera&&(this.camera.settings.zoomFactor=a,await this.camera.applySettings(this.camera.settings)),this.startTimeoutForCurrentState();}async onMiniPreviewDrag(a,e){switch(this.stateManager.state==="active"&&await this.sparkScan.setEnabled(false),e){case "landscape-primary":case "landscape-secondary":{this.stateManager.landscapeOrientationMiniPreviewTranslateX=a.x,this.stateManager.landscapeOrientationMiniPreviewTranslateY=a.y;break}case "portrait-primary":case "portrait-secondary":{this.stateManager.portraitOrientationMiniPreviewTranslateX=a.x,this.stateManager.portraitOrientationMiniPreviewTranslateY=a.y;break}}this.restartTimeouts();}onMiniPreviewPointerMove(){this.restartTimeouts();}async onMiniPreviewPointerUp(){await this.switchToActiveState();}async onMiniPreviewDragEnd(){this.stateManager.state==="active"&&await this.sparkScan.setEnabled(true);}onTriggerButtonDrag(a,e){switch(e){case "landscape-primary":case "landscape-secondary":{this.stateManager.landscapeOrientationTriggerButtonTranslateX=a.x,this.stateManager.landscapeOrientationTriggerButtonTranslateY=a.y;break}case "portrait-primary":case "portrait-secondary":{this.stateManager.portraitOrientationTriggerButtonTranslateX=a.x,this.stateManager.portraitOrientationTriggerButtonTranslateY=a.y;break}}}async onOrientationChange(){if(this.stateManager.state==="active"&&this.stateManager.holdingToScan){this.restartTimeouts();return}this.stateManager.state==="error"&&await this.switchToInactiveState({sessionStopReason:"user"});}async didScan(a,e){if(!e.newlyRecognizedBarcode)return;let t=this.sparkScanView.feedbackDelegate.getFeedbackForBarcode(e.newlyRecognizedBarcode);t instanceof b$1?await this.switchToErrorState({barcodeFeedback:t}):t instanceof c&&await(this.stateManager.continuousModeEnabled?this.switchToActiveState({barcodeFeedback:t}):this.switchToInactiveState({sessionStopReason:"user",barcodeFeedback:t,emitSuccessFeedback:true})),this.restartTimeouts();}didChangeFrameSource(a,e){var t;if(isCameraFrameSource(e))this.camera=e;else {let i=(t=e==null?void 0:e.toJSONObject().type)!=null?t:"unknown";Logger.warn(`SparkScanView instances require a camera frame source to work, but a frame source of type "${i}" was found.`);}}setListener(a){this.listener=a;}brushForFeedback(a){return a.brush}async switchToIdleState(a={}){var e,t,i;this.feedbackManager.emitTapFeedback(),await((e=this.sparkScanOverlay)==null?void 0:e.overlayReadyForDraw()),this.setState("idle"),await this.sparkScan.setEnabled(false),await((t=this.camera)==null?void 0:t.switchToDesiredState(FrameSourceState.Standby)),this.triggerButtonCollapseTimeout.stop(),this.inactiveStateTimeout.stop(),(i=this.resumeCapturingTimeout)==null||i.stop(),this.sparkScanView.switchToIdleState(),a.sessionStopReason!=null&&this.analyticsManager.setSessionStopReason(a.sessionStopReason);}async switchToActiveState(a={}){var t,i,r,o,h,s,S;let e=this.stateManager.state;await((t=this.camera)==null?void 0:t.switchToDesiredState(FrameSourceState.On)),await((i=this.camera)==null?void 0:i.setDesiredTorchState(this.stateManager.torchState)),a.barcodeFeedback&&await((r=this.sparkScanOverlay)==null?void 0:r.setBrush(this.brushForFeedback(a.barcodeFeedback))),await((o=this.sparkScanOverlay)==null?void 0:o.setShouldRemoveLocationsAfterScan(this.stateManager.continuousModeEnabled)),await((h=this.sparkScanOverlay)==null?void 0:h.overlayReadyForDraw()),this.feedbackManager.emitBarcodeFeedback(a.barcodeFeedback),this.stateManager.holdingToScan||this.inactiveStateTimeout.start(),this.triggerButtonCollapseTimeout.stop(),(s=this.resumeCapturingTimeout)==null||s.stop(),await this.sparkScanView.switchToActiveState(this.sparkScanViewSettings.visualFeedbackEnabled&&a.barcodeFeedback instanceof c,this.stateManager.scanningBehavior,(S=a.barcodeFeedback)==null?void 0:S.visualFeedbackColor,this.stateManager.zoomedIn&&e!=="active"),await this.sparkScan.setEnabled(true),this.setState("active");}async switchToInactiveState(a){var t,i,r,o,h,s;(a.emitSuccessFeedback)!=null||(a.emitSuccessFeedback=true),this.setState("inactive"),a.barcodeFeedback&&await((t=this.sparkScanOverlay)==null?void 0:t.setBrush(this.brushForFeedback(a.barcodeFeedback))),await this.sparkScan.setEnabled(false),this.stateManager.scanningMode.previewBehavior==="persistent"?a.barcodeFeedback instanceof c&&await((i=this.sparkScanOverlay)==null?void 0:i.setShouldRemoveLocationsAfterScan(true)):await((r=this.camera)==null?void 0:r.switchToDesiredState(FrameSourceState.Standby)),this.feedbackManager.emitBarcodeFeedback(a.barcodeFeedback),await((o=this.sparkScanOverlay)==null?void 0:o.overlayReadyForDraw()),this.triggerButtonCollapseTimeout.start(),this.inactiveStateTimeout.stop(),(h=this.resumeCapturingTimeout)==null||h.stop(),await this.sparkScanView.switchToInactiveState(this.sparkScanViewSettings.visualFeedbackEnabled&&a.barcodeFeedback instanceof c&&a.emitSuccessFeedback,this.stateManager.scanningBehavior,this.stateManager.previewBehavior,(s=a.barcodeFeedback)==null?void 0:s.visualFeedbackColor),this.analyticsManager.setSessionStopReason(a.sessionStopReason);}async switchToErrorState(a){var t,i,r,o;let e=a.barcodeFeedback.resumeCapturingDelay>0;e&&(this.setState("error"),this.stateManager.scanningBehavior="single",await this.sparkScan.setEnabled(false),await((t=this.camera)==null?void 0:t.switchToDesiredState(FrameSourceState.Standby)),this.resumeCapturingTimeout=new Timeout(a.barcodeFeedback.resumeCapturingDelay,async()=>{this.stateManager.state!=="active"&&await this.switchToActiveState();}),this.resumeCapturingTimeout.start()),await((i=this.sparkScanOverlay)==null?void 0:i.setErrorBrush(a.barcodeFeedback.brush)),await((r=this.sparkScanOverlay)==null?void 0:r.overlayReadyForDraw()),await((o=this.sparkScanOverlay)==null?void 0:o.setShouldRemoveLocationsAfterScan(a.barcodeFeedback.resumeCapturingDelay===0)),await this.sparkScan.workerCommand("sparkScanEmitErrorFeedback",{shouldRemoveBrush:!e}),this.feedbackManager.emitBarcodeFeedback(a.barcodeFeedback),this.triggerButtonCollapseTimeout.stop(),this.inactiveStateTimeout.stop(),await this.sparkScanView.switchToErrorState(a.barcodeFeedback,this.sparkScanViewSettings.visualFeedbackEnabled);}enableTargetModeLocationSelection(a){var r;let e=a?b$2.SparkScan.SparkScanSettings.targetModeLocationSelection.radius:b$2.SparkScan.SparkScanSettings.locationSelection.radius,t=a?b$2.SparkScan.SparkScanSettings.targetModeLocationSelection.unit:b$2.SparkScan.SparkScanSettings.locationSelection.unit,i=new NumberWithUnit(e,t);this.sparkScan.settings.locationSelection=new RadiusLocationSelection(i),(r=this.sparkScanOverlay)==null||r.setRadius(i);}enableTargetMode(a){this.enableTargetModeLocationSelection(a);}async applyPreferences(){await this.onTargetModeButtonTap(this.stateManager.targetModeEnabled,this.feedbackManager.noFeedback,false),await this.onScanningBehaviorButtonTap(this.stateManager.continuousModeEnabled,this.feedbackManager.noFeedback,false),await this.onTorchButtonTap(this.stateManager.torchEnabled,this.feedbackManager.noFeedback,false);}setState(a){var e,t;a!==this.stateManager.state&&(this.stateManager.state=a,(t=(e=this.listener)==null?void 0:e.didChangeViewState)==null||t.call(e,a));}startTimeoutForCurrentState(){let a=this.stateTimeouts[this.stateManager.state];a==null||a.start();}};export{P as a};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
var s={"scandit-datacapture-sdk-barcode-pthreads.wasm":{bytes:7238065},"scandit-datacapture-sdk-barcode-simd-pthreads.wasm":{bytes:7174883},"scandit-datacapture-sdk-barcode.wasm":{bytes:7122413},"scandit-datacapture-sdk-barcode-simd.wasm":{bytes:7058891}};export{s as a};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import {a as a$1}from'./chunk-2ZSOWJ2F.js';import {a}from'./chunk-WVIC3JWX.js';import {a as a$3}from'./chunk-7O2NHA3I.js';import {a as a$2}from'./chunk-LTNZJEG4.js';import {a as a$4}from'./chunk-4QSEBPWB.js';import {a as a$5}from'./chunk-
|
|
1
|
+
import {a as a$1}from'./chunk-2ZSOWJ2F.js';import {a}from'./chunk-WVIC3JWX.js';import {a as a$3}from'./chunk-7O2NHA3I.js';import {a as a$2}from'./chunk-LTNZJEG4.js';import {a as a$4}from'./chunk-4QSEBPWB.js';import {a as a$5}from'./chunk-4DK52S3S.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?"076ea0ee0cc1947c7d6dd9f31009f3326f64896a21146e64ba333462a654120a":"87bd3b2bf709f692fb1b3c33acb325ef734ef276d5a1f594bd55f84fed4038e6":e?"eae8da5a618178a2a034603a788d8838d6f8b79d594af1dbd89c36cacfa4545f":"180414f0accd73ac78bbe3c90597c7b1ddb79fbe9cfefe25a476d38618150bc3"}getWasmMetadata(){return a$5}};export{c as a};
|
|
@@ -1,9 +1,7 @@
|
|
|
1
1
|
import {html,ScanditHTMLElement,defineCustomElements,css}from'@scandit/web-datacapture-core/build/js/private/utils/index.js';var c=html`
|
|
2
2
|
<div id="container">
|
|
3
3
|
<div class="left">
|
|
4
|
-
<div class="rect">
|
|
5
4
|
<slot name="image-left"></slot>
|
|
6
|
-
</div>
|
|
7
5
|
</div>
|
|
8
6
|
<div class="middle">
|
|
9
7
|
<div class="title overflow-text-mask"></div>
|
|
@@ -13,4 +11,4 @@ import {html,ScanditHTMLElement,defineCustomElements,css}from'@scandit/web-datac
|
|
|
13
11
|
<slot name="right"></slot>
|
|
14
12
|
</div>
|
|
15
13
|
</div>
|
|
16
|
-
`,t=class t extends ScanditHTMLElement{constructor(){super();let e=this.attachShadow({mode:"open"});e.innerHTML=c,e.append(t.createStyleElement().cloneNode(true));}set title(e){var a;let i=(a=this.shadowRoot)==null?void 0:a.querySelector(".title");i!=null&&(i.textContent=e);}set subtitle(e){var a;let i=(a=this.shadowRoot)==null?void 0:a.querySelector(".subtitle");i!=null&&(i.textContent=e);}static create(){return document.createElement(t.tag)}static register(){defineCustomElements({[t.tag]:t});}static createStyleElement(){return css`#container{align-items:center;display:flex;flex-direction:row;gap:.625rem;justify-content:center;padding:1rem}.overflow-text-mask{-webkit-mask-image:linear-gradient(90deg,#000 95%,#0000);mask-image:linear-gradient(90deg,#000 95%,#0000);overflow-x:auto;padding-right:.3rem}#container>div{display:flex;flex:1 1 17.5%;justify-content:center}#container>div.middle{flex:1 1 65%;flex-direction:column;overflow:hidden}#container>div
|
|
14
|
+
`,t=class t extends ScanditHTMLElement{constructor(){super();let e=this.attachShadow({mode:"open"});e.innerHTML=c,e.append(t.createStyleElement().cloneNode(true));}set title(e){var a;let i=(a=this.shadowRoot)==null?void 0:a.querySelector(".title");i!=null&&(i.textContent=e);}set subtitle(e){var a;let i=(a=this.shadowRoot)==null?void 0:a.querySelector(".subtitle");i!=null&&(i.textContent=e);}static create(){return document.createElement(t.tag)}static register(){defineCustomElements({[t.tag]:t});}static createStyleElement(){return css`#container{align-items:center;display:flex;flex-direction:row;gap:.625rem;justify-content:center;padding:1rem}.overflow-text-mask{-webkit-mask-image:linear-gradient(90deg,#000 95%,#0000);mask-image:linear-gradient(90deg,#000 95%,#0000);overflow-x:auto;padding-right:.3rem}#container>div{display:flex;flex:1 1 17.5%;justify-content:center}#container>div.middle{flex:1 1 65%;flex-direction:column;overflow:hidden}#container>div ::slotted([slot=image-left]){height:50px;object-fit:cover;width:50px}#container .title{color:#121619;font-size:.938rem;font-weight:600}#container .subtitle{font-size:.75rem;font-weight:400;margin-top:.25rem}`}};t.tag="scandit-image-and-text-card-layout";var n=t;n.register();export{n as a};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import {a}from'./chunk-ZZQLFO35.js';import {a as a$8}from'./chunk-ZPCWOA3Y.js';import {a as a$7}from'./chunk-DQVSIMLI.js';import {b}from'./chunk-B5IOSUX4.js';import {a as a$a}from'./chunk-KMEGIFKL.js';import {a as a$5}from'./chunk-QIOYMBBP.js';import {b as b$1}from'./chunk-33EFB3RJ.js';import {a as a$6}from'./chunk-JKO4EZPZ.js';import {a as a$9}from'./chunk-UXI6I6RZ.js';import {a as a$1}from'./chunk-I53W7VSB.js';import {a as a$2}from'./chunk-RERRFDJ6.js';import {a as a$4}from'./chunk-LKQMBRKB.js';import {a as a$3}from'./chunk-TCOXR6SM.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';var W={async highlightForBarcode(E,T){let t=a$a.create(E);T(t);}},c=class c extends ScanditHTMLElement{constructor(){super(...arguments);this.torchIconButton=null;this.cameraSwitchButton=null;this.zoomButton=null;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.torchIconButton!==null&&(this.torchIconButton.hidden=!t);}get shouldShowTorchControl(){return this.torchIconButton===null?false:!this.torchIconButton.hidden}set torchControlPosition(t){var e;(e=this.torchIconButton)==null||e.setAttribute("slot",`controls-${t===Anchor.Center?Anchor.TopLeft:t}`);}get torchControlPosition(){var e,o;let t=(o=(e=this.torchIconButton)==null?void 0:e.getAttribute("slot"))!=null?o:"";return t===""?Anchor.TopLeft:t.replace("controls-","")}set zoomControlPosition(t){var e;(e=this.zoomButton)==null||e.setAttribute("slot",`controls-${t===Anchor.Center?Anchor.BottomRight:t}`);}get zoomControlPosition(){var e,o;let t=(o=(e=this.zoomButton)==null?void 0:e.getAttribute("slot"))!=null?o:"";return t===""?Anchor.BottomRight:t.replace("controls-","")}set cameraSwitchControlPosition(t){var e;(e=this.cameraSwitchButton)==null||e.setAttribute("slot",`controls-${t===Anchor.Center?Anchor.TopRight:t}`);}get cameraSwitchControlPosition(){var e,o;let t=(o=(e=this.zoomButton)==null?void 0:e.getAttribute("slot"))!=null?o:"";return t===""?Anchor.TopRight:t.replace("controls-","")}static async createWithSettings(t,e,o,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(e)):(r.dataCaptureView=await DataCaptureView.forContext(e),r.dataCaptureView.connectToElement(t),r.dataCaptureView.containerElement.prepend(r)),r.presenter=new a$2(r,e,o,i,n!=null?n:a$3.createRecommendedCameraSettings()),await r.presenter.prepare(),r}static async create(t,e,o){return c.createWithSettings(t,e,o,new a$4)}static register(){defineCustomElements({[a.tag]:a,[a$8.tag]:a$8,[a$7.tag]:a$7,[a$6.tag]:a$6,[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}`}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()}toggleTorchIcon(t){this.torchIconButton!==null&&(this.torchIconButton.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.torchIconButton=a$6.create(),this.torchIconButton.slot=`controls-${this.torchControlPosition}`,this.torchIconButton.hidden=true,this.torchIconButton.addEventListener("pointerdown",this.onTorchButtonClickHandler),this.cameraSwitchButton=a$8.create(),this.cameraSwitchButton.slot=`controls-${this.cameraSwitchControlPosition}`,this.cameraSwitchButton.hidden=true,this.cameraSwitchButton.addEventListener("pointerdown",this.onCameraSwitchButtonHandler),this.zoomButton=a$7.create(),this.zoomButton.slot=`controls-${this.zoomControlPosition}`,this.zoomButton.hidden=true,this.zoomButton.addEventListener("pointerdown",this.onZoomButtonHandler),this.layout.append(this.torchIconButton,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,e,o;this.deleteAllViews(),(t=this.torchIconButton)==null||t.removeEventListener("pointerdown",this.onTorchButtonClickHandler),(e=this.cameraSwitchButton)==null||e.removeEventListener("pointerdown",this.onCameraSwitchButtonHandler),(o=this.zoomButton)==null||o.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 e;return ((e=t.dataset)==null?void 0:e.identifier)==null?false:t.dataset.identifier.endsWith("-annotation")}areMultiplePopoverAllowed(){for(let t of this.layout.querySelectorAll("[data-identifier$='-annotation']"))if(t&&this.isPopoverAnnotation(t)&&t.annotationTrigger==="highlightTapAndBarcodeScan")return true;return false}async onLayoutPointerDown(t){let e=t.target,o=e==null?void 0:e.closest("[data-identifier$='-highlight']"),i=e==null?void 0:e.closest(b.tag);if((o==null?void 0:o.dataset.id)!=null){await this.handleHighlightClick(o);return}if((i==null?void 0:i.dataset.id)!=null){await this.handleAnnotationClick(i);return}await this.handleClickOutside();}async handleHighlightClick(t){var o;this.presenter.emitTappedFeedback(),(o=this.listener)==null||o.didTapHighlightForBarcode(this.presenter.barcodeAr,t.barcode,t);let e=this.queryAnnotationByDataIdentifier(t.dataset.identifier.replace("-highlight",""));!e||e.annotationTrigger==="barcodeScan"||(this.isPopoverAnnotation(e)?await this.handlePopoverHighlightClick(e,t):e.hidden=!e.hidden);}async handlePopoverHighlightClick(t,e){var o;if(!this.areMultiplePopoverAllowed()){let i=this.layout.querySelector(`${b.tag}[data-on-foreground="true"]`),n=(o=i==null?void 0:i.dataset.identifier)==null?void 0:o.replace("-annotation","-highlight"),r=this.layout.querySelector(`[data-identifier="${n}"]`);i!=null&&r!=null&&await this.hideBarcodeArPopover(i,r,false);}await this.toggleBarcodeArPopover(t,e);}async handleAnnotationClick(t){var i;let e=(i=t.dataset.identifier)==null?void 0:i.replace("-annotation","-highlight"),o=this.layout.querySelector(`[data-identifier="${e}"]`);o&&await this.toggleBarcodeArPopover(t,o);}async handleClickOutside(){var i;if(this.areMultiplePopoverAllowed())return;let t=this.layout.querySelector(`${b.tag}[data-on-foreground="true"]`);if(!t)return;let e=(i=t.dataset.identifier)==null?void 0:i.replace("-annotation","-highlight"),o=this.layout.querySelector(`[data-identifier="${e}"]`);o&&await this.hideBarcodeArPopover(t,o);}onInfoAnnotationTap(){this.presenter.emitTappedFeedback();}async showBarcodeArPopover(t,e){t.dataset.onForeground="true",t.hidden=false,e.dataset.onForeground="true",this.backdrop.open=true;}async hideBarcodeArPopover(t,e,o=true){t.dataset.onForeground="false",t.hidden=true,e&&(e.dataset.onForeground="false"),o&&this.hideBackdropIfNoPopovers();}hideBackdropIfNoPopovers(){[...this.layout.querySelectorAll(`${b.tag}`)].every(e=>e.hidden)&&(this.backdrop.open=false);}async toggleBarcodeArPopover(t,e){t.hidden?await this.showBarcodeArPopover(t,e):await this.hideBarcodeArPopover(t,e);}deleteAllViews(){for(let t of this.layout.querySelectorAll("[data-identifier]"))t.remove();}deletePendingViews(){for(let t of this.layout.querySelectorAll("[data-could-be-deleted='true']"))t.remove();this.hideBackdropIfNoPopovers();}identifierForHighlight(t){return `${t}-highlight`}identifierForAnnotation(t){return `${t}-annotation`}async onHighlightsOrAnnotationForTrackedBarcode(t){var e,o,i;await((o=(e=this.highlightProvider)!=null?e:W)==null?void 0:o.highlightForBarcode(t.barcode,async n=>this.onHighlight(t,n))),await((i=this.annotationProvider)==null?void 0:i.annotationForBarcode(t.barcode,async n=>this.onAnnotation(t,n)));}async onAnnotation(t,e){let o=e,i=a$9(t);this.updateExistingAnnotation(i)||(await this.setupNewAnnotation(o,i,t),this.updateAnnotationPosition(t,o));}updateExistingAnnotation(t){let e=this.queryAnnotationByDataId(t);return e?(e.dataset.couldBeDeleted="false",true):false}async setupNewAnnotation(t,e,o){if(t.dataset.id=e,t.dataset.identifier=this.identifierForAnnotation(o.identifier),t.hidden=true,this.layout.append(t),this.isPopoverAnnotation(t)){if(t.direction=Direction.Vertical,t.anchor==null&&(t.anchor="bottom-center"),this.areMultiplePopoverAllowed()||t.annotationTrigger==="highlightTapAndBarcodeScan"){let i=this.queryHighlightByDataId(e);i&&await this.showBarcodeArPopover(t,i);}}else t.hidden=t.annotationTrigger==="highlightTap";}getAnnotationVariationForQuad(t,e){let o=Math.max(0,Math.min(1,e)),i=t.anchorPositions,n=calculateArea(i),r=this.dataCaptureView.width,l=this.dataCaptureView.height,d=r*l;if(n<=0||d<=0)return 0;let u=n/d;return Math.max(0,Math.min(1,u))<=o?2:1}async onHighlight(t,e){let o=a$9(t),i=this.queryHighlightByDataId(o);i?i.dataset.couldBeDeleted="false":(e.dataset.id=o,e.dataset.identifier=this.identifierForHighlight(t.identifier),this.updateHighlightPosition(t,e),this.layout.append(e));}queryHighlightByDataIdentifier(t){return this.layout.querySelector(`[data-identifier$="${t}-highlight"]`)}queryAnnotationByDataIdentifier(t){return this.layout.querySelector(`[data-identifier$="${t}-annotation"]`)}queryHighlightByDataId(t){return this.layout.querySelector(`[data-identifier$="-highlight"][data-id="${t}"]`)}queryAnnotationByDataId(t){return this.layout.querySelector(`[data-identifier$="-annotation"][data-id="${t}"]`)}updateRemovedTrackedBarcodes(t){var i,n,r,l,d;let e=this.querySelectorAll("[data-identifier]");if(Object.keys(t.allTrackedBarcodes).length===0){for(let u of e)u.dataset.couldBeDeleted="true";(i=this.pendingDeletionTimeout)!=null&&i.running||(n=this.pendingDeletionTimeout)==null||n.start();return}let o=new Set(t.removedTrackedBarcodes);for(let u of e){let p=(r=u.dataset.identifier)==null?void 0:r.replace("-highlight","").replace("-annotation","");p!=null&&o.has(p)&&(u.dataset.couldBeDeleted="true");}(l=this.pendingDeletionTimeout)!=null&&l.running||(d=this.pendingDeletionTimeout)==null||d.start();}render(t){for(let[e,o]of Object.entries(t.allTrackedBarcodes)){t.addedTrackedBarcodes[e]!=null&&this.onHighlightsOrAnnotationForTrackedBarcode(o);let i=a$9(o),n=this.queryAnnotationByDataId(i),r=this.queryHighlightByDataId(i);r&&(this.updateBrushSize(r,o),this.updateHighlightPosition(o,r)),n&&this.updateAnnotationPosition(o,n,r);}this.updateRemovedTrackedBarcodes(t);}updateHighlightPosition(t,e,o="center"){if(e.hidden)return;let i=this.dataCaptureView.viewAnchorPositionsForFrameAnchorPositions(t.anchorPositions),n=this.normalizedViewPointFromFrameAnchorPositions(i,o);e.updatePosition(n,new Point(-50,-50),this.calculateRotationAngle(i.topLeft,i.topRight));}updateBrushSize(t,e){if(t.width==null||t.height==null)return;let o=this.dataCaptureView.viewAnchorPositionsForFrameAnchorPositions(e.anchorPositions),i=Math.round(calculateWidth(o)),n=Math.round(calculateHeight(o));t.width!==i&&(t.width=i),t.height!==n&&(t.height=n);}getTransformOrigin(t){return {"top-center":new Point(-50,0),"bottom-center":new Point(-50,-100),"left-center":new Point(0,-50),"right-center":new Point(-100,-50)}[t]}calculateAnnotationPosition(t,e,o){var p,w;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)}}[e]();return o?o instanceof b$1?(p={"bottom-center":new Point(r.x,r.y-7-o.clientHeight/2),"top-center":new Point(r.x,r.y+7+o.clientHeight/2),"right-center":new Point(r.x-7-o.clientWidth/2,r.y),"left-center":new Point(r.x+7+o.clientWidth/2,r.y)}[e])!=null?p:d:(w={"bottom-center":new Point(r.x,r.y-7-o.clientHeight/2),"top-center":new Point(r.x,r.y+7+o.clientHeight/2),"right-center":new Point(r.x-7-o.clientWidth/2,r.y),"left-center":new Point(r.x+7+o.clientWidth/2,r.y)}[e])!=null?w:d:d}updateAnnotationPosition(t,e,o){let i=this.dataCaptureView.viewAnchorPositionsForFrameAnchorPositions(t.anchorPositions);if(e.anchor||(e.anchor="top-center"),e.annotationVariation!=null){let l=this.getAnnotationVariationForQuad(t,a$5.threshold);e.annotationVariation=l;}let n=this.getTransformOrigin(e.anchor),r=this.calculateAnnotationPosition(i,e.anchor,o);e.updatePosition(r,n,this.calculateRotationAngle(i.topLeft,i.topRight));}normalizedViewPointFromFrameAnchorPositions(t,e="center"){let o=this.presenter.currentCamera.getMirrorImageEnabled(),i=new Size(this.dataCaptureView.width,this.dataCaptureView.height);if(o){let r=t[{centerLeft:"centerRight",centerRight:"centerLeft",center:"center",topCenter:"topCenter",bottomCenter:"bottomCenter"}[e]];return Point.mirrorX(r,i)}return t[e]}calculateRotationAngle(t,e){let o=e.x-t.x,n=this.presenter.isCameraMirrored()?-(e.y-t.y):e.y-t.y,r=Math.atan2(n,o);return Math.round(r*(180/Math.PI))}};c.tag="scandit-barcode-ar-view";var k=c;export{k as a};
|
|
1
|
+
import {a}from'./chunk-ZZQLFO35.js';import {a as a$8}from'./chunk-ZPCWOA3Y.js';import {a as a$7}from'./chunk-DQVSIMLI.js';import {b}from'./chunk-B5IOSUX4.js';import {a as a$a}from'./chunk-KMEGIFKL.js';import {a as a$5}from'./chunk-QIOYMBBP.js';import {b as b$1}from'./chunk-33EFB3RJ.js';import {a as a$6}from'./chunk-JKO4EZPZ.js';import {a as a$1}from'./chunk-I53W7VSB.js';import {a as a$9}from'./chunk-UXI6I6RZ.js';import {a as a$2}from'./chunk-YPBX2TPG.js';import {a as a$4}from'./chunk-LKQMBRKB.js';import {a as a$3}from'./chunk-GAASASQE.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';var W={async highlightForBarcode(E,T){let t=a$a.create(E);T(t);}},c=class c extends ScanditHTMLElement{constructor(){super(...arguments);this.torchIconButton=null;this.cameraSwitchButton=null;this.zoomButton=null;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.torchIconButton!==null&&(this.torchIconButton.hidden=!t);}get shouldShowTorchControl(){return this.torchIconButton===null?false:!this.torchIconButton.hidden}set torchControlPosition(t){var e;(e=this.torchIconButton)==null||e.setAttribute("slot",`controls-${t===Anchor.Center?Anchor.TopLeft:t}`);}get torchControlPosition(){var e,o;let t=(o=(e=this.torchIconButton)==null?void 0:e.getAttribute("slot"))!=null?o:"";return t===""?Anchor.TopLeft:t.replace("controls-","")}set zoomControlPosition(t){var e;(e=this.zoomButton)==null||e.setAttribute("slot",`controls-${t===Anchor.Center?Anchor.BottomRight:t}`);}get zoomControlPosition(){var e,o;let t=(o=(e=this.zoomButton)==null?void 0:e.getAttribute("slot"))!=null?o:"";return t===""?Anchor.BottomRight:t.replace("controls-","")}set cameraSwitchControlPosition(t){var e;(e=this.cameraSwitchButton)==null||e.setAttribute("slot",`controls-${t===Anchor.Center?Anchor.TopRight:t}`);}get cameraSwitchControlPosition(){var e,o;let t=(o=(e=this.zoomButton)==null?void 0:e.getAttribute("slot"))!=null?o:"";return t===""?Anchor.TopRight:t.replace("controls-","")}static async createWithSettings(t,e,o,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(e)):(r.dataCaptureView=await DataCaptureView.forContext(e),r.dataCaptureView.connectToElement(t),r.dataCaptureView.containerElement.prepend(r)),r.presenter=new a$2(r,e,o,i,n!=null?n:a$3.createRecommendedCameraSettings()),await r.presenter.prepare(),r}static async create(t,e,o){return c.createWithSettings(t,e,o,new a$4)}static register(){defineCustomElements({[a.tag]:a,[a$8.tag]:a$8,[a$7.tag]:a$7,[a$6.tag]:a$6,[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}`}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()}toggleTorchIcon(t){this.torchIconButton!==null&&(this.torchIconButton.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.torchIconButton=a$6.create(),this.torchIconButton.slot=`controls-${this.torchControlPosition}`,this.torchIconButton.hidden=true,this.torchIconButton.addEventListener("pointerdown",this.onTorchButtonClickHandler),this.cameraSwitchButton=a$8.create(),this.cameraSwitchButton.slot=`controls-${this.cameraSwitchControlPosition}`,this.cameraSwitchButton.hidden=true,this.cameraSwitchButton.addEventListener("pointerdown",this.onCameraSwitchButtonHandler),this.zoomButton=a$7.create(),this.zoomButton.slot=`controls-${this.zoomControlPosition}`,this.zoomButton.hidden=true,this.zoomButton.addEventListener("pointerdown",this.onZoomButtonHandler),this.layout.append(this.torchIconButton,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,e,o;this.deleteAllViews(),(t=this.torchIconButton)==null||t.removeEventListener("pointerdown",this.onTorchButtonClickHandler),(e=this.cameraSwitchButton)==null||e.removeEventListener("pointerdown",this.onCameraSwitchButtonHandler),(o=this.zoomButton)==null||o.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 e;return ((e=t.dataset)==null?void 0:e.identifier)==null?false:t.dataset.identifier.endsWith("-annotation")}areMultiplePopoverAllowed(){for(let t of this.layout.querySelectorAll("[data-identifier$='-annotation']"))if(t&&this.isPopoverAnnotation(t)&&t.annotationTrigger==="highlightTapAndBarcodeScan")return true;return false}async onLayoutPointerDown(t){let e=t.target,o=e==null?void 0:e.closest("[data-identifier$='-highlight']"),i=e==null?void 0:e.closest(b.tag);if((o==null?void 0:o.dataset.id)!=null){await this.handleHighlightClick(o);return}if((i==null?void 0:i.dataset.id)!=null){await this.handleAnnotationClick(i);return}await this.handleClickOutside();}async handleHighlightClick(t){var o;this.presenter.emitTappedFeedback(),(o=this.listener)==null||o.didTapHighlightForBarcode(this.presenter.barcodeAr,t.barcode,t);let e=this.queryAnnotationByDataIdentifier(t.dataset.identifier.replace("-highlight",""));!e||e.annotationTrigger==="barcodeScan"||(this.isPopoverAnnotation(e)?await this.handlePopoverHighlightClick(e,t):e.hidden=!e.hidden);}async handlePopoverHighlightClick(t,e){var o;if(!this.areMultiplePopoverAllowed()){let i=this.layout.querySelector(`${b.tag}[data-on-foreground="true"]`),n=(o=i==null?void 0:i.dataset.identifier)==null?void 0:o.replace("-annotation","-highlight"),r=this.layout.querySelector(`[data-identifier="${n}"]`);i!=null&&r!=null&&await this.hideBarcodeArPopover(i,r,false);}await this.toggleBarcodeArPopover(t,e);}async handleAnnotationClick(t){var i;let e=(i=t.dataset.identifier)==null?void 0:i.replace("-annotation","-highlight"),o=this.layout.querySelector(`[data-identifier="${e}"]`);o&&await this.toggleBarcodeArPopover(t,o);}async handleClickOutside(){var i;if(this.areMultiplePopoverAllowed())return;let t=this.layout.querySelector(`${b.tag}[data-on-foreground="true"]`);if(!t)return;let e=(i=t.dataset.identifier)==null?void 0:i.replace("-annotation","-highlight"),o=this.layout.querySelector(`[data-identifier="${e}"]`);o&&await this.hideBarcodeArPopover(t,o);}onInfoAnnotationTap(){this.presenter.emitTappedFeedback();}async showBarcodeArPopover(t,e){t.dataset.onForeground="true",t.hidden=false,e.dataset.onForeground="true",this.backdrop.open=true;}async hideBarcodeArPopover(t,e,o=true){t.dataset.onForeground="false",t.hidden=true,e&&(e.dataset.onForeground="false"),o&&this.hideBackdropIfNoPopovers();}hideBackdropIfNoPopovers(){[...this.layout.querySelectorAll(`${b.tag}`)].every(e=>e.hidden)&&(this.backdrop.open=false);}async toggleBarcodeArPopover(t,e){t.hidden?await this.showBarcodeArPopover(t,e):await this.hideBarcodeArPopover(t,e);}deleteAllViews(){for(let t of this.layout.querySelectorAll("[data-identifier]"))t.remove();}deletePendingViews(){for(let t of this.layout.querySelectorAll("[data-could-be-deleted='true']"))t.remove();this.hideBackdropIfNoPopovers();}identifierForHighlight(t){return `${t}-highlight`}identifierForAnnotation(t){return `${t}-annotation`}async onHighlightsOrAnnotationForTrackedBarcode(t){var e,o,i;await((o=(e=this.highlightProvider)!=null?e:W)==null?void 0:o.highlightForBarcode(t.barcode,async n=>this.onHighlight(t,n))),await((i=this.annotationProvider)==null?void 0:i.annotationForBarcode(t.barcode,async n=>this.onAnnotation(t,n)));}async onAnnotation(t,e){let o=e,i=a$9(t);this.updateExistingAnnotation(i)||(await this.setupNewAnnotation(o,i,t),this.updateAnnotationPosition(t,o));}updateExistingAnnotation(t){let e=this.queryAnnotationByDataId(t);return e?(e.dataset.couldBeDeleted="false",true):false}async setupNewAnnotation(t,e,o){if(t.dataset.id=e,t.dataset.identifier=this.identifierForAnnotation(o.identifier),t.hidden=true,this.layout.append(t),this.isPopoverAnnotation(t)){if(t.direction=Direction.Vertical,t.anchor==null&&(t.anchor="bottom-center"),this.areMultiplePopoverAllowed()||t.annotationTrigger==="highlightTapAndBarcodeScan"){let i=this.queryHighlightByDataId(e);i&&await this.showBarcodeArPopover(t,i);}}else t.hidden=t.annotationTrigger==="highlightTap";}getAnnotationVariationForQuad(t,e){let o=Math.max(0,Math.min(1,e)),i=t.anchorPositions,n=calculateArea(i),r=this.dataCaptureView.width,l=this.dataCaptureView.height,d=r*l;if(n<=0||d<=0)return 0;let u=n/d;return Math.max(0,Math.min(1,u))<=o?2:1}async onHighlight(t,e){let o=a$9(t),i=this.queryHighlightByDataId(o);i?i.dataset.couldBeDeleted="false":(e.dataset.id=o,e.dataset.identifier=this.identifierForHighlight(t.identifier),this.updateHighlightPosition(t,e),this.layout.append(e));}queryHighlightByDataIdentifier(t){return this.layout.querySelector(`[data-identifier$="${t}-highlight"]`)}queryAnnotationByDataIdentifier(t){return this.layout.querySelector(`[data-identifier$="${t}-annotation"]`)}queryHighlightByDataId(t){return this.layout.querySelector(`[data-identifier$="-highlight"][data-id="${t}"]`)}queryAnnotationByDataId(t){return this.layout.querySelector(`[data-identifier$="-annotation"][data-id="${t}"]`)}updateRemovedTrackedBarcodes(t){var i,n,r,l,d;let e=this.querySelectorAll("[data-identifier]");if(Object.keys(t.allTrackedBarcodes).length===0){for(let u of e)u.dataset.couldBeDeleted="true";(i=this.pendingDeletionTimeout)!=null&&i.running||(n=this.pendingDeletionTimeout)==null||n.start();return}let o=new Set(t.removedTrackedBarcodes);for(let u of e){let p=(r=u.dataset.identifier)==null?void 0:r.replace("-highlight","").replace("-annotation","");p!=null&&o.has(p)&&(u.dataset.couldBeDeleted="true");}(l=this.pendingDeletionTimeout)!=null&&l.running||(d=this.pendingDeletionTimeout)==null||d.start();}render(t){for(let[e,o]of Object.entries(t.allTrackedBarcodes)){t.addedTrackedBarcodes[e]!=null&&this.onHighlightsOrAnnotationForTrackedBarcode(o);let i=a$9(o),n=this.queryAnnotationByDataId(i),r=this.queryHighlightByDataId(i);r&&(this.updateBrushSize(r,o),this.updateHighlightPosition(o,r)),n&&this.updateAnnotationPosition(o,n,r);}this.updateRemovedTrackedBarcodes(t);}updateHighlightPosition(t,e,o="center"){if(e.hidden)return;let i=this.dataCaptureView.viewAnchorPositionsForFrameAnchorPositions(t.anchorPositions),n=this.normalizedViewPointFromFrameAnchorPositions(i,o);e.updatePosition(n,new Point(-50,-50),this.calculateRotationAngle(i.topLeft,i.topRight));}updateBrushSize(t,e){if(t.width==null||t.height==null)return;let o=this.dataCaptureView.viewAnchorPositionsForFrameAnchorPositions(e.anchorPositions),i=Math.round(calculateWidth(o)),n=Math.round(calculateHeight(o));t.width!==i&&(t.width=i),t.height!==n&&(t.height=n);}getTransformOrigin(t){return {"top-center":new Point(-50,0),"bottom-center":new Point(-50,-100),"left-center":new Point(0,-50),"right-center":new Point(-100,-50)}[t]}calculateAnnotationPosition(t,e,o){var p,w;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)}}[e]();return o?o instanceof b$1?(p={"bottom-center":new Point(r.x,r.y-7-o.clientHeight/2),"top-center":new Point(r.x,r.y+7+o.clientHeight/2),"right-center":new Point(r.x-7-o.clientWidth/2,r.y),"left-center":new Point(r.x+7+o.clientWidth/2,r.y)}[e])!=null?p:d:(w={"bottom-center":new Point(r.x,r.y-7-o.clientHeight/2),"top-center":new Point(r.x,r.y+7+o.clientHeight/2),"right-center":new Point(r.x-7-o.clientWidth/2,r.y),"left-center":new Point(r.x+7+o.clientWidth/2,r.y)}[e])!=null?w:d:d}updateAnnotationPosition(t,e,o){let i=this.dataCaptureView.viewAnchorPositionsForFrameAnchorPositions(t.anchorPositions);if(e.anchor||(e.anchor="top-center"),e.annotationVariation!=null){let l=this.getAnnotationVariationForQuad(t,a$5.threshold);e.annotationVariation=l;}let n=this.getTransformOrigin(e.anchor),r=this.calculateAnnotationPosition(i,e.anchor,o);e.updatePosition(r,n,this.calculateRotationAngle(i.topLeft,i.topRight));}normalizedViewPointFromFrameAnchorPositions(t,e="center"){let o=this.presenter.currentCamera.getMirrorImageEnabled(),i=new Size(this.dataCaptureView.width,this.dataCaptureView.height);if(o){let r=t[{centerLeft:"centerRight",centerRight:"centerLeft",center:"center",topCenter:"topCenter",bottomCenter:"bottomCenter"}[e]];return Point.mirrorX(r,i)}return t[e]}calculateRotationAngle(t,e){let o=e.x-t.x,n=this.presenter.isCameraMirrored()?-(e.y-t.y):e.y-t.y,r=Math.atan2(n,o);return Math.round(r*(180/Math.PI))}};c.tag="scandit-barcode-ar-view";var k=c;export{k as a};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import {a}from'./chunk-
|
|
1
|
+
import {a}from'./chunk-AATIU42U.js';import {a as a$1}from'./chunk-KQ3LRAYO.js';import {unknownErrorToString}from'@scandit/web-datacapture-core/build/js/private/utils/unknownErrorToString.js';import {WorkerMain}from'@scandit/web-datacapture-core/build/js/worker/index.js';var i=class extends WorkerMain{constructor(t,a$1){super(t,a$1),this.dataCaptureInstance=new a(a$1,{postMessage:this.postMessage.bind(this),getOffscreenCanvas:this.getOffscreenCanvas.bind(this)});}async respondWith(t,a,r){let d=null,e;try{e=r(),e instanceof Promise&&(e=await e);}catch(c){e=void 0,d=unknownErrorToString(c);}let s={type:"workerTaskId",command:t,id:a,payload:this.hasPayload(e)?e.payload:void 0};d!=null&&(s.error=d),this.postMessage(s,this.hasTransferables(e)?e.transferables:[]);}onMessage(t){switch(t.data.command){case "sparkScanEmitErrorFeedback":{let{data:a}=t;return this.respondWith(a.command,a.id,()=>{this.dataCaptureInstance.sparkScanMode.emitErrorFeedback(a.shouldRemoveBrush);}),true}case "sparkScanOverlayReadyForDraw":{let{data:a}=t;return this.respondWith(a.command,a.id,()=>{this.dataCaptureInstance.sparkScanMode.overlayReadyForDraw();}),true}case "sparkScanAnalyticsManagerPropertyChanged":{let{data:a}=t;return this.respondWith(a.command,a.id,async()=>{this.dataCaptureInstance.sparkScanMode.analyticsManagerPropertyChanged(a.property);}),true}case "barcodeFindForSettings":{let{data:a}=t;return this.respondWith(a.command,a.id,async()=>this.dataCaptureInstance.barcodeFindMode.forSettings(a.settings)),true}case "barcodeFindModeRemove":{let{data:a}=t;return this.respondWith(a.command,a.id,async()=>this.dataCaptureInstance.barcodeFindMode.removeMode()),true}case "barcodeFindSearchStart":return this.respondWith(t.data.command,t.data.id,()=>{this.dataCaptureInstance.barcodeFindMode.start();}),true;case "barcodeFindSearchPause":return this.respondWith(t.data.command,t.data.id,()=>{this.dataCaptureInstance.barcodeFindMode.pause();}),true;case "barcodeFindSearchStop":return this.respondWith(t.data.command,t.data.id,()=>{this.dataCaptureInstance.barcodeFindMode.stop();}),true;case "barcodeFindSetItemList":{let{data:a}=t;return this.respondWith(t.data.command,t.data.id,()=>{this.dataCaptureInstance.barcodeFindMode.setItemList(a.itemList);}),true}case "barcodeFindSetEnabled":{let{data:a}=t;return this.respondWith(t.data.command,t.data.id,()=>{this.dataCaptureInstance.barcodeFindMode.setEnabled(a.enabled);}),true}case "barcodeFindApplySettings":{let{data:a}=t;return this.respondWith(a.command,a.id,async()=>this.dataCaptureInstance.barcodeFindMode.applySettings(a.settings)),true}case "barcodeFindAddBasicOverlay":{let{data:a}=t;return this.respondWith(a.command,a.id,async()=>{this.dataCaptureInstance.barcodeFindMode.addBasicOverlay();}),true}case "barcodeFindRemoveBasicOverlay":{let{data:a}=t;return this.respondWith(a.command,a.id,async()=>{this.dataCaptureInstance.barcodeFindMode.removeBasicOverlay();}),true}case "barcodeFindUpdateBasicOverlay":{let{data:a}=t;return this.respondWith(a.command,a.id,async()=>{this.dataCaptureInstance.barcodeFindMode.updateBasicOverlay(a.jsonOverlay);}),true}case "barcodeFindSetTransformerFunction":{let{data:a}=t;return this.respondWith(a.command,a.id,async()=>{let r=a$1(a.functionAsString);this.dataCaptureInstance.barcodeFindMode.setTransformerFunction(r);}),true}case "barcodeArForSettings":{let{data:a}=t;return this.respondWith(a.command,a.id,async()=>this.dataCaptureInstance.barcodeArMode.forSettings(a.settings)),true}case "barcodeArModeRemove":{let{data:a}=t;return this.respondWith(a.command,a.id,async()=>this.dataCaptureInstance.barcodeArMode.removeMode()),true}case "barcodeArSearchStart":return this.respondWith(t.data.command,t.data.id,()=>{this.dataCaptureInstance.barcodeArMode.start();}),true;case "barcodeArSearchPause":return this.respondWith(t.data.command,t.data.id,()=>{this.dataCaptureInstance.barcodeArMode.pause();}),true;case "barcodeArSearchStop":return this.respondWith(t.data.command,t.data.id,()=>{this.dataCaptureInstance.barcodeArMode.stop();}),true;case "barcodeArSetEnabled":{let{data:a}=t;return this.respondWith(t.data.command,t.data.id,()=>{this.dataCaptureInstance.barcodeArMode.setEnabled(a.enabled);}),true}case "barcodeArApplySettings":{let{data:a}=t;return this.respondWith(a.command,a.id,async()=>{this.dataCaptureInstance.barcodeArMode.applySettings(a.settings);}),true}default:return super.onMessage(t)}}};export{i as a};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import {a}from'./chunk-
|
|
1
|
+
import {a}from'./chunk-U4SUPIV3.js';import {a as a$1}from'./chunk-D26TRBZS.js';import {b}from'./chunk-EWNVCDJ6.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(){let e=new CameraSettings(b);return e.setProperty("grayScaleFrameReader",true),e}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};
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import {b}from'./chunk-YJ42KEYE.js';import {a as a$2}from'./chunk-YH5IBNOK.js';import {a as a$7}from'./chunk-5GGUCEGU.js';import {b as b$1}from'./chunk-EWLALL5J.js';import {a as a$6}from'./chunk-AO7NE6M4.js';import {a}from'./chunk-WRTJHOS5.js';import {a as a$8}from'./chunk-WGZHL6TO.js';import {a as a$9}from'./chunk-7J6MRLL2.js';import {a as a$4}from'./chunk-TFYQKG6K.js';import {a as a$5}from'./chunk-POONUNDO.js';import {b as b$2}from'./chunk-IHFZ5YLD.js';import {a as a$1}from'./chunk-JKO4EZPZ.js';import {a as a$3}from'./chunk-I53W7VSB.js';import {b as b$3}from'./chunk-OLJXVUYE.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';var l={FinishButton:a$2.tag,ShutterButton:ShutterButton.tag,ProgressBarWithLabel:a.tag,CardListContainer:b$1.tag,TorchIconButton:a$1.tag},h=class h extends ScanditHTMLElement{constructor(){super(...arguments);this.shouldShowCarousel=true;this.shouldShowPauseButton=true;this.shouldShowFinishButton=true;this.shouldShowProgressBar=true;this.shouldShowTorchControl=false;this.torchControlPosition=Anchor.TopLeft;this.textForItemListUpdatedWhenPausedHint=null;this.textForItemListUpdatedHint=null;this.textForTapShutterToResumeSearchHint=null;this.textForTapShutterToPauseScreenHint=null;this.textForMoveCloserToBarcodesHint=null;this.textForPointAtBarcodesToSearchHint=null;this.textForAllItemsFoundSuccessfullyHint=null;this.textForCollapseCardsButton=Localization.getInstance().get("barcode.find.view.textForCollapseCardsButton");this.barcodeFindViewUiListener=null;this.shutterButton=null;this.finishButton=null;this.progressBar=null;this.cardList=null;this.onShutterButtonClickedHandler=this.onShutterButtonClicked.bind(this);this.onFinishButtonClickedHandler=this.onFinishButtonClicked.bind(this);this.onTorchButtonClickedHandler=this.onTorchButtonClicked.bind(this);this.torchIconButton=null;this.onDotClickHandler=this.onDotClick.bind(this);}get camera(){return this.presenter.context.frameSource}static async createWithSettings(t,o,i,s,r){let e=document.createElement(h.tag);return e.barcodeFindViewSettings=s,e.layout=b.create(),e.layout.innerHTML=html`
|
|
2
|
+
<${a.tag} slot="progress" value="0" max="1" ${e.shouldShowProgressBar?"":"hidden"}></${a.tag}>
|
|
3
|
+
<${a$1.tag} slot="top-controls-left" ${e.shouldShowTorchControl?"":"hidden"}></${a$1.tag}>
|
|
4
|
+
<${b$1.tag} slot="card-list" hidden text-for-collapse-cards-button=${e.textForCollapseCardsButton}></${b$1.tag}>
|
|
5
|
+
<${ShutterButton.tag} slot="bottom-controls-center" variant="play" ${e.shouldShowPauseButton?"":"hidden"}></${ShutterButton.tag}>
|
|
6
|
+
<${a$2.tag} slot="bottom-controls-right" ${e.shouldShowFinishButton?"":"hidden"}></${a$2.tag}>
|
|
7
|
+
`,e.append(e.layout),a$3(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$4.recommendedCameraSettings),await e.presenter.prepare(),e.barcodeFindBasicOverlay=await a$5.withBarcodeFind(i,e.dataCaptureView),e}static async create(t,o,i){return h.createWithSettings(t,o,i,b$3.BarcodeFind.BarcodeFindViewSettings.settings,a$4.recommendedCameraSettings)}static register(){defineCustomElements({[h.tag]:h});}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=this.presenter.isTorchAvailable?t:false,this.layout.toggleVisibility(l.TorchIconButton,this.shouldShowTorchControl);}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.torchIconButton)==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.torchIconButton=this.layout.querySelector(l.TorchIconButton),(t=this.torchIconButton)==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.torchIconButton)==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,u,a,m,B,w,L,P,H,x;let i=[];for(let c of t){let F=Card.create();F.id=`${String(c.uid)}`;let p=a$6.create();if(F.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=(u=c.content)==null?void 0:u.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(((m=c.content)==null?void 0:m.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=(w=(B=c.content)==null?void 0:B.image)!=null?w:"",n.alt=(P=(L=c.content)==null?void 0:L.additionalInfo)!=null?P:"",p.append(n);}i.push(F);}(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.torchIconButton&&(this.torchIconButton.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 u=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(u.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:u}=this.dataCaptureView.viewAnchorPositionsForFrameAnchorPositions(r.anchorPositions);if(e){let a=(s=(i=this.camera)==null?void 0:i.getMirrorImageEnabled())!=null?s:false,m=new Size(this.dataCaptureView.width,this.dataCaptureView.height);e.style.setProperty("position","absolute");let B=a?Point.mirrorX(u,m):u;e.style.setProperty("transform",this.pointTransformation(B));}}}};h.tag="scandit-barcode-find-view";var y=h;y.register();export{y as a};
|