dynamsoft-barcode-reader-bundle
Version:
Dynamsoft Barcode Reader JS is a recognition SDK which enables you to embed barcode reading functionality in your web, desktop, and mobile applications. With a few lines of JavaScript code, you can develop a robust application to scan a linear barcode, QR
11 lines • 624 kB
JavaScript
/*!
* Dynamsoft JavaScript Library
* @product Dynamsoft Barcode Reader JS Edition Bundle
* @website http://www.dynamsoft.com
* @copyright Copyright 2025, Dynamsoft Corporation
* @author Dynamsoft
* @version 10.5.3000
* @fileoverview Dynamsoft JavaScript Library for Barcode Reader
* More info on dbr JS: https://www.dynamsoft.com/barcode-reader/docs/web/programming/javascript/
*/
const t=t=>t&&"object"==typeof t&&"function"==typeof t.then,e=(async()=>{})().constructor;let i=class extends e{get status(){return this._s}get isPending(){return"pending"===this._s}get isFulfilled(){return"fulfilled"===this._s}get isRejected(){return"rejected"===this._s}get task(){return this._task}set task(i){let n;this._task=i,t(i)?n=i:"function"==typeof i&&(n=new e(i)),n&&(async()=>{try{const t=await n;i===this._task&&this.resolve(t)}catch(t){i===this._task&&this.reject(t)}})()}get isEmpty(){return null==this._task}constructor(e){let i,n;super(((t,e)=>{i=t,n=e})),this._s="pending",this.resolve=e=>{this.isPending&&(t(e)?this.task=e:(this._s="fulfilled",i(e)))},this.reject=t=>{this.isPending&&(this._s="rejected",n(t))},this.task=e}};function n(t,e,i,n){if("a"===i&&!n)throw new TypeError("Private accessor was defined without a getter");if("function"==typeof e?t!==e||!n:!e.has(t))throw new TypeError("Cannot read private member from an object whose class did not declare it");return"m"===i?n:"a"===i?n.call(t):n?n.value:e.get(t)}function r(t,e,i,n,r){if("m"===n)throw new TypeError("Private method is not writable");if("a"===n&&!r)throw new TypeError("Private accessor was defined without a setter");if("function"==typeof e?t!==e||!r:!e.has(t))throw new TypeError("Cannot write private member to an object whose class did not declare it");return"a"===n?r.call(t,i):r?r.value=i:e.set(t,i),i}var s,o,a;"function"==typeof SuppressedError&&SuppressedError,function(t){t[t.BOPM_BLOCK=0]="BOPM_BLOCK",t[t.BOPM_UPDATE=1]="BOPM_UPDATE"}(s||(s={})),function(t){t[t.CCUT_AUTO=0]="CCUT_AUTO",t[t.CCUT_FULL_CHANNEL=1]="CCUT_FULL_CHANNEL",t[t.CCUT_Y_CHANNEL_ONLY=2]="CCUT_Y_CHANNEL_ONLY",t[t.CCUT_RGB_R_CHANNEL_ONLY=3]="CCUT_RGB_R_CHANNEL_ONLY",t[t.CCUT_RGB_G_CHANNEL_ONLY=4]="CCUT_RGB_G_CHANNEL_ONLY",t[t.CCUT_RGB_B_CHANNEL_ONLY=5]="CCUT_RGB_B_CHANNEL_ONLY"}(o||(o={})),function(t){t[t.IPF_BINARY=0]="IPF_BINARY",t[t.IPF_BINARYINVERTED=1]="IPF_BINARYINVERTED",t[t.IPF_GRAYSCALED=2]="IPF_GRAYSCALED",t[t.IPF_NV21=3]="IPF_NV21",t[t.IPF_RGB_565=4]="IPF_RGB_565",t[t.IPF_RGB_555=5]="IPF_RGB_555",t[t.IPF_RGB_888=6]="IPF_RGB_888",t[t.IPF_ARGB_8888=7]="IPF_ARGB_8888",t[t.IPF_RGB_161616=8]="IPF_RGB_161616",t[t.IPF_ARGB_16161616=9]="IPF_ARGB_16161616",t[t.IPF_ABGR_8888=10]="IPF_ABGR_8888",t[t.IPF_ABGR_16161616=11]="IPF_ABGR_16161616",t[t.IPF_BGR_888=12]="IPF_BGR_888",t[t.IPF_BINARY_8=13]="IPF_BINARY_8",t[t.IPF_NV12=14]="IPF_NV12",t[t.IPF_BINARY_8_INVERTED=15]="IPF_BINARY_8_INVERTED"}(a||(a={}));const h="undefined"==typeof self,l="function"==typeof importScripts,c=(()=>{if(!l){if(!h&&document.currentScript){let t=document.currentScript.src,e=t.indexOf("?");if(-1!=e)t=t.substring(0,e);else{let e=t.indexOf("#");-1!=e&&(t=t.substring(0,e))}return t.substring(0,t.lastIndexOf("/")+1)}return"./"}})(),u=t=>{if(null==t&&(t="./"),h||l);else{let e=document.createElement("a");e.href=t,t=e.href}return t.endsWith("/")||(t+="/"),t},d=t=>Object.prototype.toString.call(t),f=t=>Array.isArray?Array.isArray(t):"[object Array]"===d(t),g=t=>"[object Boolean]"===d(t),m=t=>"number"==typeof t&&!Number.isNaN(t),p=t=>null!==t&&"object"==typeof t&&!Array.isArray(t),_=t=>!(!p(t)||!m(t.x)||!m(t.y)||!m(t.radius)||t.radius<0||!m(t.startAngle)||!m(t.endAngle)),v=t=>!!p(t)&&!!f(t.points)&&0!=t.points.length&&!t.points.some((t=>!b(t))),y=t=>!(!p(t)||!m(t.width)||t.width<=0||!m(t.height)||t.height<=0||!m(t.stride)||t.stride<=0||!("format"in t)||"tag"in t&&!S(t.tag)),w=t=>!(!y(t)||!m(t.bytes.length)&&!m(t.bytes.ptr)),C=t=>!!y(t)&&t.bytes instanceof Uint8Array,E=t=>!(!p(t)||!m(t.left)||t.left<0||!m(t.top)||t.top<0||!m(t.right)||t.right<0||!m(t.bottom)||t.bottom<0||t.left>=t.right||t.top>=t.bottom||!g(t.isMeasuredInPercentage)),S=t=>null===t||!!p(t)&&!!m(t.imageId)&&"type"in t,T=t=>!(!p(t)||!b(t.startPoint)||!b(t.endPoint)||t.startPoint.x==t.endPoint.x&&t.startPoint.y==t.endPoint.y),b=t=>!!p(t)&&!!m(t.x)&&!!m(t.y),I=t=>!!p(t)&&!!f(t.points)&&0!=t.points.length&&!t.points.some((t=>!b(t))),x=t=>!!p(t)&&!!f(t.points)&&0!=t.points.length&&4==t.points.length&&!t.points.some((t=>!b(t))),O=t=>!(!p(t)||!m(t.x)||!m(t.y)||!m(t.width)||t.width<0||!m(t.height)||t.height<0||"isMeasuredInPercentage"in t&&!g(t.isMeasuredInPercentage)),A=async(t,e)=>await new Promise(((i,n)=>{let r=new XMLHttpRequest;r.open("GET",t,!0),r.responseType=e,r.send(),r.onloadend=async()=>{r.status<200||r.status>=300?n(new Error(t+" "+r.status)):i(r.response)},r.onerror=()=>{n(new Error("Network Error: "+r.statusText))}})),R=t=>/^(https:\/\/www\.|http:\/\/www\.|https:\/\/|http:\/\/)|^[a-zA-Z0-9]{2,}(\.[a-zA-Z0-9]{2,})(\.[a-zA-Z0-9]{2,})?/.test(t),D=(t,e)=>{let i=t.split("."),n=e.split(".");for(let t=0;t<i.length&&t<n.length;++t){let e=i[t],r=n[t];if(e===r)continue;let s=parseInt(i[t]),o=parseInt(n[t]);return s===o||Number.isNaN(s)&&Number.isNaN(o)?e<r?-1:1:s<o||Number.isNaN(s)&&Number.isInteger(o)?-1:1}return i.length===n.length?0:i.length<n.length?-1:1},L=t=>{const e={},i={std:"dynamsoft-capture-vision-std",dip:"dynamsoft-image-processing",core:"dynamsoft-core",dnn:"dynamsoft-capture-vision-dnn",license:"dynamsoft-license",utility:"dynamsoft-utility",cvr:"dynamsoft-capture-vision-router",dbr:"dynamsoft-barcode-reader",dlr:"dynamsoft-label-recognizer",ddn:"dynamsoft-document-normalizer",dcp:"dynamsoft-code-parser",dcpd:"dynamsoft-code-parser",dlrData:"dynamsoft-label-recognizer-data",dce:"dynamsoft-camera-enhancer",ddv:"dynamsoft-document-viewer"};for(let n in t){if("rootDirectory"===n)continue;let r=n,s=t[r],o=s&&"object"==typeof s&&s.path?s.path:s,a=t.rootDirectory;if(a&&!a.endsWith("/")&&(a+="/"),"object"==typeof s&&s.isInternal)a&&(o=t[r].version?`${a}${i[r]}@${t[r].version}/dist/${"ddv"===r?"engine":""}`:`${a}${i[r]}/dist/${"ddv"===r?"engine":""}`);else{const i=/^@engineRootDirectory(\/?)/;if("string"==typeof o&&(o=o.replace(i,a||"")),"object"==typeof o&&"dwt"===r){const n=t[r].resourcesPath,s=t[r].serviceInstallerLocation;e[r]={resourcesPath:n.replace(i,a||""),serviceInstallerLocation:s.replace(i,a||"")};continue}}e[r]=u(o)}return e},M=async(t,e,i)=>await new Promise((async(n,r)=>{try{const r=e.split(".");let s=r[r.length-1];const o=await k(`image/${s}`,t);r.length<=1&&(s="png");const a=new File([o],e,{type:`image/${s}`});if(i){const t=URL.createObjectURL(a),i=document.createElement("a");i.href=t,i.download=e,i.click()}return n(a)}catch(t){return r()}})),F=t=>{C(t)&&(t=B(t));const e=document.createElement("canvas");return e.width=t.width,e.height=t.height,e.getContext("2d",{willReadFrequently:!0}).putImageData(t,0,0),e},P=(t,e)=>{C(e)&&(e=B(e));const i=F(e);let n=new Image,r=i.toDataURL(t);return n.src=r,n},k=async(t,e)=>{C(e)&&(e=B(e));const i=F(e);return new Promise(((e,n)=>{i.toBlob((t=>e(t)),t)}))},B=t=>{let e,i=t.bytes;if(!(i&&i instanceof Uint8Array))throw Error("Parameter type error");if(Number(t.format)===a.IPF_BGR_888){const t=i.length/3;e=new Uint8ClampedArray(4*t);for(let n=0;n<t;++n)e[4*n]=i[3*n],e[4*n+1]=i[3*n+1],e[4*n+2]=i[3*n+2],e[4*n+3]=255}else if(Number(t.format)===a.IPF_RGB_888){const t=i.length/3;e=new Uint8ClampedArray(4*t);for(let n=0;n<t;++n)e[4*n]=i[3*n+2],e[4*n+1]=i[3*n+1],e[4*n+2]=i[3*n],e[4*n+3]=255}else if(Number(t.format)===a.IPF_GRAYSCALED){const t=i.length;e=new Uint8ClampedArray(4*t);for(let n=0;n<t;n++)e[4*n]=e[4*n+1]=e[4*n+2]=i[n],e[4*n+3]=255}else if(Number(t.format)===a.IPF_BINARY_8){const n=i.length,r=t.width,s=t.height,o=t.stride;e=new Uint8ClampedArray(r*s*4);for(let t=0;t<n;t++){let n=i[t],s=t%o,a=Math.floor(t/o);for(let t=0;t<8;t++){let i=s+t,o=4*(a*r+i);if(i>=r)break;e[o]=e[o+1]=e[o+2]=(128&n)/128*255,e[o+3]=255,n<<=1}}}else if(Number(t.format)===a.IPF_ABGR_8888){const t=i.length/4;e=new Uint8ClampedArray(i.length);for(let n=0;n<t;++n)e[4*n]=i[4*n],e[4*n+1]=i[4*n+1],e[4*n+2]=i[4*n+2],e[4*n+3]=i[4*n+3]}else if(Number(t.format)===a.IPF_ARGB_8888){const t=i.length/4;e=new Uint8ClampedArray(i.length);for(let n=0;n<t;++n)e[4*n]=i[4*n+2],e[4*n+1]=i[4*n+1],e[4*n+2]=i[4*n],e[4*n+3]=i[4*n+3]}else if(Number(t.format)===a.IPF_BINARY_8_INVERTED){const n=i.length,r=t.width,s=t.height,o=t.stride;e=new Uint8ClampedArray(r*s*4);for(let t=0;t<n;t++){let n=i[t],s=t%o,a=Math.floor(t/o);for(let t=0;t<8;t++){let i=s+t,o=4*(a*r+i);if(i>=r)break;e[o]=e[o+1]=e[o+2]=128&n?0:255,e[o+3]=255,n<<=1}}}return new ImageData(e,t.width,t.height)};var N,j,U,V,G,W,Y,H;let X,z,q,Z,K,J=class t{get _isFetchingStarted(){return n(this,G,"f")}constructor(){N.add(this),j.set(this,[]),U.set(this,1),V.set(this,s.BOPM_BLOCK),G.set(this,!1),W.set(this,void 0),Y.set(this,o.CCUT_AUTO)}setErrorListener(t){}addImageToBuffer(t){var e;if(!C(t))throw new TypeError("Invalid 'image'.");if((null===(e=t.tag)||void 0===e?void 0:e.hasOwnProperty("imageId"))&&"number"==typeof t.tag.imageId&&this.hasImage(t.tag.imageId))throw new Error("Existed imageId.");if(n(this,j,"f").length>=n(this,U,"f"))switch(n(this,V,"f")){case s.BOPM_BLOCK:break;case s.BOPM_UPDATE:if(n(this,j,"f").push(t),p(n(this,W,"f"))&&m(n(this,W,"f").imageId)&&1==n(this,W,"f").keepInBuffer)for(;n(this,j,"f").length>n(this,U,"f");){const t=n(this,j,"f").findIndex((t=>{var e;return(null===(e=t.tag)||void 0===e?void 0:e.imageId)!==n(this,W,"f").imageId}));n(this,j,"f").splice(t,1)}else n(this,j,"f").splice(0,n(this,j,"f").length-n(this,U,"f"))}else n(this,j,"f").push(t)}getImage(){if(0===n(this,j,"f").length)return null;let e;if(n(this,W,"f")&&m(n(this,W,"f").imageId)){const t=n(this,N,"m",H).call(this,n(this,W,"f").imageId);if(t<0)throw new Error(`Image with id ${n(this,W,"f").imageId} doesn't exist.`);e=n(this,j,"f").slice(t,t+1)[0]}else e=n(this,j,"f").pop();if([a.IPF_RGB_565,a.IPF_RGB_555,a.IPF_RGB_888,a.IPF_ARGB_8888,a.IPF_RGB_161616,a.IPF_ARGB_16161616,a.IPF_ABGR_8888,a.IPF_ABGR_16161616,a.IPF_BGR_888].includes(e.format)){if(n(this,Y,"f")===o.CCUT_RGB_R_CHANNEL_ONLY){t._onLog&&t._onLog("only get R channel data.");const i=new Uint8Array(e.width*e.height);for(let t=0;t<i.length;t++)switch(e.format){case a.IPF_RGB_565:case a.IPF_RGB_555:case a.IPF_RGB_888:case a.IPF_RGB_161616:i[t]=e.bytes[3*t+2];break;case a.IPF_ARGB_8888:case a.IPF_ARGB_16161616:i[t]=e.bytes[4*t+2];break;case a.IPF_BGR_888:i[t]=e.bytes[3*t];break;case a.IPF_ABGR_8888:case a.IPF_ABGR_16161616:i[t]=e.bytes[4*t]}e.bytes=i,e.stride=e.width,e.format=a.IPF_GRAYSCALED}else if(n(this,Y,"f")===o.CCUT_RGB_G_CHANNEL_ONLY){t._onLog&&t._onLog("only get G channel data.");const i=new Uint8Array(e.width*e.height);for(let t=0;t<i.length;t++)switch(e.format){case a.IPF_RGB_565:case a.IPF_RGB_555:case a.IPF_RGB_888:case a.IPF_RGB_161616:case a.IPF_BGR_888:i[t]=e.bytes[3*t+1];break;case a.IPF_ARGB_8888:case a.IPF_ARGB_16161616:case a.IPF_ABGR_8888:case a.IPF_ABGR_16161616:i[t]=e.bytes[4*t+1]}e.bytes=i,e.stride=e.width,e.format=a.IPF_GRAYSCALED}else if(n(this,Y,"f")===o.CCUT_RGB_B_CHANNEL_ONLY){t._onLog&&t._onLog("only get B channel data.");const i=new Uint8Array(e.width*e.height);for(let t=0;t<i.length;t++)switch(e.format){case a.IPF_RGB_565:case a.IPF_RGB_555:case a.IPF_RGB_888:case a.IPF_RGB_161616:i[t]=e.bytes[3*t];break;case a.IPF_ARGB_8888:case a.IPF_ARGB_16161616:i[t]=e.bytes[4*t];break;case a.IPF_BGR_888:i[t]=e.bytes[3*t+2];break;case a.IPF_ABGR_8888:case a.IPF_ABGR_16161616:i[t]=e.bytes[4*t+2]}e.bytes=i,e.stride=e.width,e.format=a.IPF_GRAYSCALED}}else[a.IPF_NV21,a.IPF_NV12].includes(e.format)&&t._onLog&&t._onLog("NV21 or NV12 is not supported.");return e}setNextImageToReturn(t,e){if(!((...t)=>0!==t.length&&t.every((t=>m(t))))(t))throw new TypeError("Invalid 'imageId'.");if(void 0!==e&&!g(e))throw new TypeError("Invalid 'keepInBuffer'.");r(this,W,{imageId:t,keepInBuffer:e},"f")}_resetNextReturnedImage(){r(this,W,null,"f")}hasImage(t){return n(this,N,"m",H).call(this,t)>=0}startFetching(){r(this,G,!0,"f")}stopFetching(){r(this,G,!1,"f")}setMaxImageCount(t){if("number"!=typeof t)throw new TypeError("Invalid 'count'.");if(t<1||Math.round(t)!==t)throw new Error("Invalid 'count'.");for(r(this,U,t,"f");n(this,j,"f")&&n(this,j,"f").length>t;)n(this,j,"f").shift()}getMaxImageCount(){return n(this,U,"f")}getImageCount(){return n(this,j,"f").length}clearBuffer(){n(this,j,"f").length=0}isBufferEmpty(){return 0===n(this,j,"f").length}setBufferOverflowProtectionMode(t){r(this,V,t,"f")}getBufferOverflowProtectionMode(){return n(this,V,"f")}setColourChannelUsageType(t){r(this,Y,t,"f")}getColourChannelUsageType(){return n(this,Y,"f")}};j=new WeakMap,U=new WeakMap,V=new WeakMap,G=new WeakMap,W=new WeakMap,Y=new WeakMap,N=new WeakSet,H=function(t){if("number"!=typeof t)throw new TypeError("Invalid 'imageId'.");return n(this,j,"f").findIndex((e=>{var i;return(null===(i=e.tag)||void 0===i?void 0:i.imageId)===t}))},"undefined"!=typeof navigator&&(X=navigator,z=X.userAgent,q=X.platform,Z=X.mediaDevices),function(){if(!h){const t={Edge:{search:"Edg",verSearch:"Edg"},OPR:null,Chrome:null,Safari:{str:X.vendor,search:"Apple",verSearch:["Version","iPhone OS","CPU OS"]},Firefox:null,Explorer:{search:"MSIE",verSearch:"MSIE"}},e={HarmonyOS:null,Android:null,iPhone:null,iPad:null,Windows:{str:q,search:"Win"},Mac:{str:q},Linux:{str:q}};let i="unknownBrowser",n=0,r="unknownOS";for(let e in t){const r=t[e]||{};let s=r.str||z,o=r.search||e,a=r.verStr||z,h=r.verSearch||e;if(h instanceof Array||(h=[h]),-1!=s.indexOf(o)){i=e;for(let t of h){let e=a.indexOf(t);if(-1!=e){n=parseFloat(a.substring(e+t.length+1));break}}break}}for(let t in e){const i=e[t]||{};let n=i.str||z,s=i.search||t;if(-1!=n.indexOf(s)){r=t;break}}"Linux"==r&&-1!=z.indexOf("Windows NT")&&(r="HarmonyOS"),K={browser:i,version:n,OS:r}}h&&(K={browser:"ssr",version:0,OS:"ssr"})}();const Q="undefined"!=typeof WebAssembly&&z&&!(/Safari/.test(z)&&!/Chrome/.test(z)&&/\(.+\s11_2_([2-6]).*\)/.test(z)),$=!("undefined"==typeof Worker),tt=!(!Z||!Z.getUserMedia),et=async()=>{let t=!1;if(tt)try{(await Z.getUserMedia({video:!0})).getTracks().forEach((t=>{t.stop()})),t=!0}catch(t){}return t};"Chrome"===K.browser&&K.version>66||"Safari"===K.browser&&K.version>13||"OPR"===K.browser&&K.version>43||"Edge"===K.browser&&K.version;const it={},nt=async t=>{let e="string"==typeof t?[t]:t,n=[];for(let t of e)n.push(it[t]=it[t]||new i);await Promise.all(n)},rt=async(t,e)=>{let n,r="string"==typeof t?[t]:t,s=[];for(let t of r){let r;s.push(r=it[t]=it[t]||new i(n=n||e())),r.isEmpty&&(r.task=n=n||e())}await Promise.all(s)};let st,ot=0;const at=()=>ot++,ht={};let lt;const ct=t=>{lt=t,st&&st.postMessage({type:"setBLog",body:{value:!!t}})};let ut=!1;const dt=t=>{ut=t,st&&st.postMessage({type:"setBDebug",body:{value:!!t}})},ft={},gt={},mt={dip:{wasm:!0}},pt={std:{version:"1.4.21",path:u(c+"../../dynamsoft-capture-vision-std@1.4.21/dist/"),isInternal:!0},core:{version:"3.4.31",path:c,isInternal:!0}},_t=async t=>{let e;t instanceof Array||(t=t?[t]:[]);let n=it.core;e=!n||n.isEmpty;let r=new Map;const s=t=>{if("std"==(t=t.toLowerCase())||"core"==t)return;if(!mt[t])throw Error("The '"+t+"' module cannot be found.");let e=mt[t].deps;if(null==e?void 0:e.length)for(let t of e)s(t);let i=it[t];r.has(t)||r.set(t,!i||i.isEmpty)};for(let e of t)s(e);let o=[];e&&o.push("core"),o.push(...r.keys());const a=[...r.entries()].filter((t=>!t[1])).map((t=>t[0]));await rt(o,(async()=>{const t=[...r.entries()].filter((t=>t[1])).map((t=>t[0]));await nt(a);const n=L(pt),s={};for(let e of t)s[e]=mt[e];const o={engineResourcePaths:n,autoResources:s,names:t};let h=new i;if(e){o.needLoadCore=!0;let t=n.core+vt._workerName;t.startsWith(location.origin)||(t=await fetch(t).then((t=>t.blob())).then((t=>URL.createObjectURL(t)))),st=new Worker(t),st.onerror=t=>{let e=new Error(t.message);h.reject(e)},st.addEventListener("message",(t=>{let e=t.data?t.data:t,i=e.type,n=e.id,r=e.body;switch(i){case"log":lt&<(e.message);break;case"task":try{ht[n](r),delete ht[n]}catch(t){throw delete ht[n],t}break;case"event":try{ht[n](r)}catch(t){throw t}break;default:console.log(t)}})),o.bLog=!!lt,o.bd=ut,o.dm=location.origin.startsWith("http")?location.origin:"https://localhost"}else await nt("core");let l=ot++;ht[l]=t=>{if(t.success)Object.assign(ft,t.versions),"{}"!==JSON.stringify(t.versions)&&(vt._versions=t.versions),h.resolve(void 0);else{const e=Error(t.message);t.stack&&(e.stack=t.stack),h.reject(e)}},st.postMessage({type:"loadWasm",body:o,id:l}),await h}))};class vt{static get engineResourcePaths(){return pt}static set engineResourcePaths(t){Object.assign(pt,t)}static get bSupportDce4Module(){return this._bSupportDce4Module}static get bSupportIRTModule(){return this._bSupportIRTModule}static get versions(){return this._versions}static get _onLog(){return lt}static set _onLog(t){ct(t)}static get _bDebug(){return ut}static set _bDebug(t){dt(t)}static isModuleLoaded(t){return t=(t=t||"core").toLowerCase(),!!it[t]&&it[t].isFulfilled}static async loadWasm(t){return await _t(t)}static async detectEnvironment(){return await(async()=>({wasm:Q,worker:$,getUserMedia:tt,camera:await et(),browser:K.browser,version:K.version,OS:K.OS}))()}static async getModuleVersion(){return await new Promise(((t,e)=>{let i=at();ht[i]=async i=>{if(i.success)return t(i.versions);{let t=new Error(i.message);return t.stack=i.stack+"\n"+t.stack,e(t)}},st.postMessage({type:"getModuleVersion",id:i})}))}static getVersion(){return`3.4.31(Worker: ${ft.core&&ft.core.worker||"Not Loaded"}, Wasm: ${ft.core&&ft.core.wasm||"Not Loaded"})`}static enableLogging(){J._onLog=console.log,vt._onLog=console.log}static disableLogging(){J._onLog=null,vt._onLog=null}static async cfd(t){return await new Promise(((e,i)=>{let n=at();ht[n]=async t=>{if(t.success)return e();{let e=new Error(t.message);return e.stack=t.stack+"\n"+e.stack,i(e)}},st.postMessage({type:"cfd",id:n,body:{count:t}})}))}}var yt,wt,Ct,Et,St,Tt,bt,It,xt;vt._bSupportDce4Module=-1,vt._bSupportIRTModule=-1,vt._versions=null,vt._workerName="core.worker.js",vt.browserInfo=K,function(t){t[t.CRIT_ORIGINAL_IMAGE=1]="CRIT_ORIGINAL_IMAGE",t[t.CRIT_BARCODE=2]="CRIT_BARCODE",t[t.CRIT_TEXT_LINE=4]="CRIT_TEXT_LINE",t[t.CRIT_DETECTED_QUAD=8]="CRIT_DETECTED_QUAD",t[t.CRIT_NORMALIZED_IMAGE=16]="CRIT_NORMALIZED_IMAGE",t[t.CRIT_PARSED_RESULT=32]="CRIT_PARSED_RESULT"}(yt||(yt={})),function(t){t[t.CT_NORMAL_INTERSECTED=0]="CT_NORMAL_INTERSECTED",t[t.CT_T_INTERSECTED=1]="CT_T_INTERSECTED",t[t.CT_CROSS_INTERSECTED=2]="CT_CROSS_INTERSECTED",t[t.CT_NOT_INTERSECTED=3]="CT_NOT_INTERSECTED"}(wt||(wt={})),function(t){t[t.EC_OK=0]="EC_OK",t[t.EC_UNKNOWN=-1e4]="EC_UNKNOWN",t[t.EC_NO_MEMORY=-10001]="EC_NO_MEMORY",t[t.EC_NULL_POINTER=-10002]="EC_NULL_POINTER",t[t.EC_LICENSE_INVALID=-10003]="EC_LICENSE_INVALID",t[t.EC_LICENSE_EXPIRED=-10004]="EC_LICENSE_EXPIRED",t[t.EC_FILE_NOT_FOUND=-10005]="EC_FILE_NOT_FOUND",t[t.EC_FILE_TYPE_NOT_SUPPORTED=-10006]="EC_FILE_TYPE_NOT_SUPPORTED",t[t.EC_BPP_NOT_SUPPORTED=-10007]="EC_BPP_NOT_SUPPORTED",t[t.EC_INDEX_INVALID=-10008]="EC_INDEX_INVALID",t[t.EC_CUSTOM_REGION_INVALID=-10010]="EC_CUSTOM_REGION_INVALID",t[t.EC_IMAGE_READ_FAILED=-10012]="EC_IMAGE_READ_FAILED",t[t.EC_TIFF_READ_FAILED=-10013]="EC_TIFF_READ_FAILED",t[t.EC_DIB_BUFFER_INVALID=-10018]="EC_DIB_BUFFER_INVALID",t[t.EC_PDF_READ_FAILED=-10021]="EC_PDF_READ_FAILED",t[t.EC_PDF_DLL_MISSING=-10022]="EC_PDF_DLL_MISSING",t[t.EC_PAGE_NUMBER_INVALID=-10023]="EC_PAGE_NUMBER_INVALID",t[t.EC_CUSTOM_SIZE_INVALID=-10024]="EC_CUSTOM_SIZE_INVALID",t[t.EC_TIMEOUT=-10026]="EC_TIMEOUT",t[t.EC_JSON_PARSE_FAILED=-10030]="EC_JSON_PARSE_FAILED",t[t.EC_JSON_TYPE_INVALID=-10031]="EC_JSON_TYPE_INVALID",t[t.EC_JSON_KEY_INVALID=-10032]="EC_JSON_KEY_INVALID",t[t.EC_JSON_VALUE_INVALID=-10033]="EC_JSON_VALUE_INVALID",t[t.EC_JSON_NAME_KEY_MISSING=-10034]="EC_JSON_NAME_KEY_MISSING",t[t.EC_JSON_NAME_VALUE_DUPLICATED=-10035]="EC_JSON_NAME_VALUE_DUPLICATED",t[t.EC_TEMPLATE_NAME_INVALID=-10036]="EC_TEMPLATE_NAME_INVALID",t[t.EC_JSON_NAME_REFERENCE_INVALID=-10037]="EC_JSON_NAME_REFERENCE_INVALID",t[t.EC_PARAMETER_VALUE_INVALID=-10038]="EC_PARAMETER_VALUE_INVALID",t[t.EC_DOMAIN_NOT_MATCH=-10039]="EC_DOMAIN_NOT_MATCH",t[t.EC_RESERVED_INFO_NOT_MATCH=-10040]="EC_RESERVED_INFO_NOT_MATCH",t[t.EC_LICENSE_KEY_NOT_MATCH=-10043]="EC_LICENSE_KEY_NOT_MATCH",t[t.EC_REQUEST_FAILED=-10044]="EC_REQUEST_FAILED",t[t.EC_LICENSE_INIT_FAILED=-10045]="EC_LICENSE_INIT_FAILED",t[t.EC_SET_MODE_ARGUMENT_ERROR=-10051]="EC_SET_MODE_ARGUMENT_ERROR",t[t.EC_LICENSE_CONTENT_INVALID=-10052]="EC_LICENSE_CONTENT_INVALID",t[t.EC_LICENSE_KEY_INVALID=-10053]="EC_LICENSE_KEY_INVALID",t[t.EC_LICENSE_DEVICE_RUNS_OUT=-10054]="EC_LICENSE_DEVICE_RUNS_OUT",t[t.EC_GET_MODE_ARGUMENT_ERROR=-10055]="EC_GET_MODE_ARGUMENT_ERROR",t[t.EC_IRT_LICENSE_INVALID=-10056]="EC_IRT_LICENSE_INVALID",t[t.EC_FILE_SAVE_FAILED=-10058]="EC_FILE_SAVE_FAILED",t[t.EC_STAGE_TYPE_INVALID=-10059]="EC_STAGE_TYPE_INVALID",t[t.EC_IMAGE_ORIENTATION_INVALID=-10060]="EC_IMAGE_ORIENTATION_INVALID",t[t.EC_CONVERT_COMPLEX_TEMPLATE_ERROR=-10061]="EC_CONVERT_COMPLEX_TEMPLATE_ERROR",t[t.EC_CALL_REJECTED_WHEN_CAPTURING=-10062]="EC_CALL_REJECTED_WHEN_CAPTURING",t[t.EC_NO_IMAGE_SOURCE=-10063]="EC_NO_IMAGE_SOURCE",t[t.EC_READ_DIRECTORY_FAILED=-10064]="EC_READ_DIRECTORY_FAILED",t[t.EC_MODULE_NOT_FOUND=-10065]="EC_MODULE_NOT_FOUND",t[t.EC_MULTI_PAGES_NOT_SUPPORTED=-10066]="EC_MULTI_PAGES_NOT_SUPPORTED",t[t.EC_FILE_ALREADY_EXISTS=-10067]="EC_FILE_ALREADY_EXISTS",t[t.EC_CREATE_FILE_FAILED=-10068]="EC_CREATE_FILE_FAILED",t[t.EC_IMGAE_DATA_INVALID=-10069]="EC_IMGAE_DATA_INVALID",t[t.EC_IMAGE_SIZE_NOT_MATCH=-10070]="EC_IMAGE_SIZE_NOT_MATCH",t[t.EC_IMAGE_PIXEL_FORMAT_NOT_MATCH=-10071]="EC_IMAGE_PIXEL_FORMAT_NOT_MATCH",t[t.EC_SECTION_LEVEL_RESULT_IRREPLACEABLE=-10072]="EC_SECTION_LEVEL_RESULT_IRREPLACEABLE",t[t.EC_AXIS_DEFINITION_INCORRECT=-10073]="EC_AXIS_DEFINITION_INCORRECT",t[t.EC_RESULT_TYPE_MISMATCH_IRREPLACEABLE=-10074]="EC_RESULT_TYPE_MISMATCH_IRREPLACEABLE",t[t.EC_PDF_LIBRARY_LOAD_FAILED=-10075]="EC_PDF_LIBRARY_LOAD_FAILED",t[t.EC_NO_LICENSE=-2e4]="EC_NO_LICENSE",t[t.EC_HANDSHAKE_CODE_INVALID=-20001]="EC_HANDSHAKE_CODE_INVALID",t[t.EC_LICENSE_BUFFER_FAILED=-20002]="EC_LICENSE_BUFFER_FAILED",t[t.EC_LICENSE_SYNC_FAILED=-20003]="EC_LICENSE_SYNC_FAILED",t[t.EC_DEVICE_NOT_MATCH=-20004]="EC_DEVICE_NOT_MATCH",t[t.EC_BIND_DEVICE_FAILED=-20005]="EC_BIND_DEVICE_FAILED",t[t.EC_INSTANCE_COUNT_OVER_LIMIT=-20008]="EC_INSTANCE_COUNT_OVER_LIMIT",t[t.EC_LICENSE_INIT_SEQUENCE_FAILED=-20009]="EC_LICENSE_INIT_SEQUENCE_FAILED",t[t.EC_TRIAL_LICENSE=-20010]="EC_TRIAL_LICENSE",t[t.EC_FAILED_TO_REACH_DLS=-20200]="EC_FAILED_TO_REACH_DLS",t[t.EC_LICENSE_CACHE_USED=-20012]="EC_LICENSE_CACHE_USED",t[t.EC_BARCODE_FORMAT_INVALID=-30009]="EC_BARCODE_FORMAT_INVALID",t[t.EC_QR_LICENSE_INVALID=-30016]="EC_QR_LICENSE_INVALID",t[t.EC_1D_LICENSE_INVALID=-30017]="EC_1D_LICENSE_INVALID",t[t.EC_PDF417_LICENSE_INVALID=-30019]="EC_PDF417_LICENSE_INVALID",t[t.EC_DATAMATRIX_LICENSE_INVALID=-30020]="EC_DATAMATRIX_LICENSE_INVALID",t[t.EC_CUSTOM_MODULESIZE_INVALID=-30025]="EC_CUSTOM_MODULESIZE_INVALID",t[t.EC_AZTEC_LICENSE_INVALID=-30041]="EC_AZTEC_LICENSE_INVALID",t[t.EC_PATCHCODE_LICENSE_INVALID=-30046]="EC_PATCHCODE_LICENSE_INVALID",t[t.EC_POSTALCODE_LICENSE_INVALID=-30047]="EC_POSTALCODE_LICENSE_INVALID",t[t.EC_DPM_LICENSE_INVALID=-30048]="EC_DPM_LICENSE_INVALID",t[t.EC_FRAME_DECODING_THREAD_EXISTS=-30049]="EC_FRAME_DECODING_THREAD_EXISTS",t[t.EC_STOP_DECODING_THREAD_FAILED=-30050]="EC_STOP_DECODING_THREAD_FAILED",t[t.EC_MAXICODE_LICENSE_INVALID=-30057]="EC_MAXICODE_LICENSE_INVALID",t[t.EC_GS1_DATABAR_LICENSE_INVALID=-30058]="EC_GS1_DATABAR_LICENSE_INVALID",t[t.EC_GS1_COMPOSITE_LICENSE_INVALID=-30059]="EC_GS1_COMPOSITE_LICENSE_INVALID",t[t.EC_DOTCODE_LICENSE_INVALID=-30061]="EC_DOTCODE_LICENSE_INVALID",t[t.EC_PHARMACODE_LICENSE_INVALID=-30062]="EC_PHARMACODE_LICENSE_INVALID",t[t.EC_CHARACTER_MODEL_FILE_NOT_FOUND=-40100]="EC_CHARACTER_MODEL_FILE_NOT_FOUND",t[t.EC_TEXT_LINE_GROUP_LAYOUT_CONFLICT=-40101]="EC_TEXT_LINE_GROUP_LAYOUT_CONFLICT",t[t.EC_TEXT_LINE_GROUP_REGEX_CONFLICT=-40102]="EC_TEXT_LINE_GROUP_REGEX_CONFLICT",t[t.EC_QUADRILATERAL_INVALID=-50057]="EC_QUADRILATERAL_INVALID",t[t.EC_PANORAMA_LICENSE_INVALID=-70060]="EC_PANORAMA_LICENSE_INVALID",t[t.EC_RESOURCE_PATH_NOT_EXIST=-90001]="EC_RESOURCE_PATH_NOT_EXIST",t[t.EC_RESOURCE_LOAD_FAILED=-90002]="EC_RESOURCE_LOAD_FAILED",t[t.EC_CODE_SPECIFICATION_NOT_FOUND=-90003]="EC_CODE_SPECIFICATION_NOT_FOUND",t[t.EC_FULL_CODE_EMPTY=-90004]="EC_FULL_CODE_EMPTY",t[t.EC_FULL_CODE_PREPROCESS_FAILED=-90005]="EC_FULL_CODE_PREPROCESS_FAILED",t[t.EC_ZA_DL_LICENSE_INVALID=-90006]="EC_ZA_DL_LICENSE_INVALID",t[t.EC_AAMVA_DL_ID_LICENSE_INVALID=-90007]="EC_AAMVA_DL_ID_LICENSE_INVALID",t[t.EC_AADHAAR_LICENSE_INVALID=-90008]="EC_AADHAAR_LICENSE_INVALID",t[t.EC_MRTD_LICENSE_INVALID=-90009]="EC_MRTD_LICENSE_INVALID",t[t.EC_VIN_LICENSE_INVALID=-90010]="EC_VIN_LICENSE_INVALID",t[t.EC_CUSTOMIZED_CODE_TYPE_LICENSE_INVALID=-90011]="EC_CUSTOMIZED_CODE_TYPE_LICENSE_INVALID",t[t.EC_LICENSE_WARNING=-10076]="EC_LICENSE_WARNING",t[t.EC_BARCODE_READER_LICENSE_NOT_FOUND=-30063]="EC_BARCODE_READER_LICENSE_NOT_FOUND",t[t.EC_LABEL_RECOGNIZER_LICENSE_NOT_FOUND=-40103]="EC_LABEL_RECOGNIZER_LICENSE_NOT_FOUND",t[t.EC_DOCUMENT_NORMALIZER_LICENSE_NOT_FOUND=-50058]="EC_DOCUMENT_NORMALIZER_LICENSE_NOT_FOUND",t[t.EC_CODE_PARSER_LICENSE_NOT_FOUND=-90012]="EC_CODE_PARSER_LICENSE_NOT_FOUND"}(Ct||(Ct={})),function(t){t[t.GEM_SKIP=0]="GEM_SKIP",t[t.GEM_AUTO=1]="GEM_AUTO",t[t.GEM_GENERAL=2]="GEM_GENERAL",t[t.GEM_GRAY_EQUALIZE=4]="GEM_GRAY_EQUALIZE",t[t.GEM_GRAY_SMOOTH=8]="GEM_GRAY_SMOOTH",t[t.GEM_SHARPEN_SMOOTH=16]="GEM_SHARPEN_SMOOTH",t[t.GEM_REV=-2147483648]="GEM_REV"}(Et||(Et={})),function(t){t[t.GTM_SKIP=0]="GTM_SKIP",t[t.GTM_INVERTED=1]="GTM_INVERTED",t[t.GTM_ORIGINAL=2]="GTM_ORIGINAL",t[t.GTM_AUTO=4]="GTM_AUTO",t[t.GTM_REV=-2147483648]="GTM_REV"}(St||(St={})),function(t){t[t.ITT_FILE_IMAGE=0]="ITT_FILE_IMAGE",t[t.ITT_VIDEO_FRAME=1]="ITT_VIDEO_FRAME"}(Tt||(Tt={})),function(t){t[t.PDFRM_VECTOR=1]="PDFRM_VECTOR",t[t.PDFRM_RASTER=2]="PDFRM_RASTER",t[t.PDFRM_REV=-2147483648]="PDFRM_REV"}(bt||(bt={})),function(t){t[t.RDS_RASTERIZED_PAGES=0]="RDS_RASTERIZED_PAGES",t[t.RDS_EXTRACTED_IMAGES=1]="RDS_EXTRACTED_IMAGES"}(It||(It={})),function(t){t[t.CVS_NOT_VERIFIED=0]="CVS_NOT_VERIFIED",t[t.CVS_PASSED=1]="CVS_PASSED",t[t.CVS_FAILED=2]="CVS_FAILED"}(xt||(xt={}));const Ot={IRUT_NULL:BigInt(0),IRUT_COLOUR_IMAGE:BigInt(1),IRUT_SCALED_DOWN_COLOUR_IMAGE:BigInt(2),IRUT_GRAYSCALE_IMAGE:BigInt(4),IRUT_TRANSOFORMED_GRAYSCALE_IMAGE:BigInt(8),IRUT_ENHANCED_GRAYSCALE_IMAGE:BigInt(16),IRUT_PREDETECTED_REGIONS:BigInt(32),IRUT_BINARY_IMAGE:BigInt(64),IRUT_TEXTURE_DETECTION_RESULT:BigInt(128),IRUT_TEXTURE_REMOVED_GRAYSCALE_IMAGE:BigInt(256),IRUT_TEXTURE_REMOVED_BINARY_IMAGE:BigInt(512),IRUT_CONTOURS:BigInt(1024),IRUT_LINE_SEGMENTS:BigInt(2048),IRUT_TEXT_ZONES:BigInt(4096),IRUT_TEXT_REMOVED_BINARY_IMAGE:BigInt(8192),IRUT_CANDIDATE_BARCODE_ZONES:BigInt(16384),IRUT_LOCALIZED_BARCODES:BigInt(32768),IRUT_SCALED_UP_BARCODE_IMAGE:BigInt(65536),IRUT_DEFORMATION_RESISTED_BARCODE_IMAGE:BigInt(1<<17),IRUT_COMPLEMENTED_BARCODE_IMAGE:BigInt(1<<18),IRUT_DECODED_BARCODES:BigInt(1<<19),IRUT_LONG_LINES:BigInt(1<<20),IRUT_CORNERS:BigInt(1<<21),IRUT_CANDIDATE_QUAD_EDGES:BigInt(1<<22),IRUT_DETECTED_QUADS:BigInt(1<<23),IRUT_LOCALIZED_TEXT_LINES:BigInt(1<<24),IRUT_RECOGNIZED_TEXT_LINES:BigInt(1<<25),IRUT_NORMALIZED_IMAGES:BigInt(1<<26),IRUT_SHORT_LINES:BigInt(1<<27),IRUT_RAW_TEXT_LINES:BigInt(1<<28),IRUT_LOGIC_LINES:BigInt(1<<29),IRUT_ALL:BigInt("0xFFFFFFFFFFFFFFFF")};var At,Rt;!function(t){t[t.ROET_PREDETECTED_REGION=0]="ROET_PREDETECTED_REGION",t[t.ROET_LOCALIZED_BARCODE=1]="ROET_LOCALIZED_BARCODE",t[t.ROET_DECODED_BARCODE=2]="ROET_DECODED_BARCODE",t[t.ROET_LOCALIZED_TEXT_LINE=3]="ROET_LOCALIZED_TEXT_LINE",t[t.ROET_RECOGNIZED_TEXT_LINE=4]="ROET_RECOGNIZED_TEXT_LINE",t[t.ROET_DETECTED_QUAD=5]="ROET_DETECTED_QUAD",t[t.ROET_NORMALIZED_IMAGE=6]="ROET_NORMALIZED_IMAGE",t[t.ROET_SOURCE_IMAGE=7]="ROET_SOURCE_IMAGE",t[t.ROET_TARGET_ROI=8]="ROET_TARGET_ROI"}(At||(At={})),function(t){t[t.ST_NULL=0]="ST_NULL",t[t.ST_REGION_PREDETECTION=1]="ST_REGION_PREDETECTION",t[t.ST_BARCODE_LOCALIZATION=2]="ST_BARCODE_LOCALIZATION",t[t.ST_BARCODE_DECODING=3]="ST_BARCODE_DECODING",t[t.ST_TEXT_LINE_LOCALIZATION=4]="ST_TEXT_LINE_LOCALIZATION",t[t.ST_TEXT_LINE_RECOGNITION=5]="ST_TEXT_LINE_RECOGNITION",t[t.ST_DOCUMENT_DETECTION=6]="ST_DOCUMENT_DETECTION",t[t.ST_DOCUMENT_NORMALIZATION=7]="ST_DOCUMENT_NORMALIZATION"}(Rt||(Rt={}));let Dt="./";if(document.currentScript){let t=document.currentScript.src,e=t.indexOf("?");if(-1!=e)t=t.substring(0,e);else{let e=t.indexOf("#");-1!=e&&(t=t.substring(0,e))}Dt=t.substring(0,t.lastIndexOf("/")+1)}function Lt(t,e,i,n){if("a"===i&&!n)throw new TypeError("Private accessor was defined without a getter");if("function"==typeof e?t!==e||!n:!e.has(t))throw new TypeError("Cannot read private member from an object whose class did not declare it");return"m"===i?n:"a"===i?n.call(t):n?n.value:e.get(t)}function Mt(t,e,i,n,r){if("m"===n)throw new TypeError("Private method is not writable");if("a"===n&&!r)throw new TypeError("Private accessor was defined without a setter");if("function"==typeof e?t!==e||!r:!e.has(t))throw new TypeError("Cannot write private member to an object whose class did not declare it");return"a"===n?r.call(t,i):r?r.value=i:e.set(t,i),i}vt.engineResourcePaths={rootDirectory:(t=>{null==t&&(t="./");let e=document.createElement("a");return e.href=t,(t=e.href).endsWith("/")||(t+="/"),t})(Dt+"../../")},"function"==typeof SuppressedError&&SuppressedError;const Ft="undefined"==typeof self,Pt="function"==typeof importScripts,kt=(()=>{if(!Pt){if(!Ft&&document.currentScript){let t=document.currentScript.src,e=t.indexOf("?");if(-1!=e)t=t.substring(0,e);else{let e=t.indexOf("#");-1!=e&&(t=t.substring(0,e))}return t.substring(0,t.lastIndexOf("/")+1)}return"./"}})(),Bt=t=>{if(null==t&&(t="./"),Ft||Pt);else{let e=document.createElement("a");e.href=t,t=e.href}return t.endsWith("/")||(t+="/"),t};var Nt,jt,Ut;!function(t){t[t.SM_SINGLE=0]="SM_SINGLE",t[t.SM_MULTI_UNIQUE=1]="SM_MULTI_UNIQUE"}(Nt||(Nt={})),function(t){t[t.OM_NONE=0]="OM_NONE",t[t.OM_SPEED=1]="OM_SPEED",t[t.OM_COVERAGE=2]="OM_COVERAGE",t[t.OM_BALANCE=3]="OM_BALANCE",t[t.OM_DPM=4]="OM_DPM",t[t.OM_DENSE=5]="OM_DENSE"}(jt||(jt={})),function(t){t[t.RS_SUCCESS=0]="RS_SUCCESS",t[t.RS_CANCELLED=1]="RS_CANCELLED",t[t.RS_FAILED=2]="RS_FAILED"}(Ut||(Ut={}));var Vt={license:"",scanMode:Nt.SM_SINGLE,templateFilePath:void 0,utilizedTemplateNames:{single:"ReadSingleBarcode",multi_unique:"ReadBarcodes_SpeedFirst",image:"ReadBarcodes_ReadRateFirst"},engineResourcePaths:{rootDirectory:kt},barcodeFormats:void 0,duplicateForgetTime:3e3,container:void 0,onUniqueBarcodeScanned:void 0,showResultView:!1,showUploadImageButton:!1,removePoweredByMessage:!1,uiPath:kt,scannerViewConfig:{container:void 0,showCloseButton:!1},resultViewConfig:{container:void 0,toolbarButtonsConfig:{clear:{label:"Clear",className:"btn-clear",isHidden:!1},done:{label:"Done",className:"btn-done",isHidden:!1}}}};const Gt=t=>t&&"object"==typeof t&&"function"==typeof t.then,Wt=(async()=>{})().constructor;let Yt=class extends Wt{get status(){return this._s}get isPending(){return"pending"===this._s}get isFulfilled(){return"fulfilled"===this._s}get isRejected(){return"rejected"===this._s}get task(){return this._task}set task(t){let e;this._task=t,Gt(t)?e=t:"function"==typeof t&&(e=new Wt(t)),e&&(async()=>{try{const i=await e;t===this._task&&this.resolve(i)}catch(e){t===this._task&&this.reject(e)}})()}get isEmpty(){return null==this._task}constructor(t){let e,i;super(((t,n)=>{e=t,i=n})),this._s="pending",this.resolve=t=>{this.isPending&&(Gt(t)?this.task=t:(this._s="fulfilled",e(t)))},this.reject=t=>{this.isPending&&(this._s="rejected",i(t))},this.task=t}};function Ht(t,e,i,n){if("a"===i&&!n)throw new TypeError("Private accessor was defined without a getter");if("function"==typeof e?t!==e||!n:!e.has(t))throw new TypeError("Cannot read private member from an object whose class did not declare it");return"m"===i?n:"a"===i?n.call(t):n?n.value:e.get(t)}function Xt(t,e,i,n,r){if("m"===n)throw new TypeError("Private method is not writable");if("a"===n&&!r)throw new TypeError("Private accessor was defined without a setter");if("function"==typeof e?t!==e||!r:!e.has(t))throw new TypeError("Cannot write private member to an object whose class did not declare it");return"a"===n?r.call(t,i):r?r.value=i:e.set(t,i),i}"function"==typeof SuppressedError&&SuppressedError;const zt=t=>t&&"object"==typeof t&&"function"==typeof t.then,qt=(async()=>{})().constructor;class Zt extends qt{get status(){return this._s}get isPending(){return"pending"===this._s}get isFulfilled(){return"fulfilled"===this._s}get isRejected(){return"rejected"===this._s}get task(){return this._task}set task(t){let e;this._task=t,zt(t)?e=t:"function"==typeof t&&(e=new qt(t)),e&&(async()=>{try{const i=await e;t===this._task&&this.resolve(i)}catch(e){t===this._task&&this.reject(e)}})()}get isEmpty(){return null==this._task}constructor(t){let e,i;super(((t,n)=>{e=t,i=n})),this._s="pending",this.resolve=t=>{this.isPending&&(zt(t)?this.task=t:(this._s="fulfilled",e(t)))},this.reject=t=>{this.isPending&&(this._s="rejected",i(t))},this.task=t}}class Kt{constructor(t){this._cvr=t}async getMaxBufferedItems(){return await new Promise(((t,e)=>{let i=at();ht[i]=async i=>{if(i.success)return t(i.count);{let t=new Error(i.message);return t.stack=i.stack+"\n"+t.stack,e(t)}},st.postMessage({type:"cvr_getMaxBufferedItems",id:i,instanceID:this._cvr._instanceID})}))}async setMaxBufferedItems(t){return await new Promise(((e,i)=>{let n=at();ht[n]=async t=>{if(t.success)return e();{let e=new Error(t.message);return e.stack=t.stack+"\n"+e.stack,i(e)}},st.postMessage({type:"cvr_setMaxBufferedItems",id:n,instanceID:this._cvr._instanceID,body:{count:t}})}))}async getBufferedCharacterItemSet(){return await new Promise(((t,e)=>{let i=at();ht[i]=async i=>{if(i.success)return t(i.itemSet);{let t=new Error(i.message);return t.stack=i.stack+"\n"+t.stack,e(t)}},st.postMessage({type:"cvr_getBufferedCharacterItemSet",id:i,instanceID:this._cvr._instanceID})}))}}var Jt={onTaskResultsReceived:!1,onTaskResultsReceivedForDce:!1,onPredetectedRegionsReceived:!1,onLocalizedBarcodesReceived:!1,onDecodedBarcodesReceived:!1,onLocalizedTextLinesReceived:!1,onRecognizedTextLinesReceived:!1,onDetectedQuadsReceived:!1,onNormalizedImagesReceived:!1,onColourImageUnitReceived:!1,onScaledDownColourImageUnitReceived:!1,onGrayscaleImageUnitReceived:!1,onTransformedGrayscaleImageUnitReceived:!1,onEnhancedGrayscaleImageUnitReceived:!1,onBinaryImageUnitReceived:!1,onTextureDetectionResultUnitReceived:!1,onTextureRemovedGrayscaleImageUnitReceived:!1,onTextureRemovedBinaryImageUnitReceived:!1,onContoursUnitReceived:!1,onLineSegmentsUnitReceived:!1,onTextZonesUnitReceived:!1,onTextRemovedBinaryImageUnitReceived:!1,onRawTextLinesReceived:!1,onLongLinesUnitReceived:!1,onCornersUnitReceived:!1,onCandidateQuadEdgesUnitReceived:!1,onCandidateBarcodeZonesUnitReceived:!1,onScaledUpBarcodeImageUnitReceived:!1,onDeformationResistedBarcodeImageUnitReceived:!1,onComplementedBarcodeImageUnitReceived:!1,onShortLinesUnitReceived:!1,onLogicLinesReceived:!1};const Qt=t=>{for(let e in t._irrRegistryState)t._irrRegistryState[e]=!1;for(let e of t._intermediateResultReceiverSet)if(e.isDce||e.isFilter)t._irrRegistryState.onTaskResultsReceivedForDce=!0;else for(let i in e)t._irrRegistryState[i]||(t._irrRegistryState[i]=!!e[i])};class $t{constructor(t){this._irrRegistryState=Jt,this._intermediateResultReceiverSet=new Set,this._cvr=t}async addResultReceiver(t){if("object"!=typeof t)throw new Error("Invalid receiver.");this._intermediateResultReceiverSet.add(t),Qt(this);let e=-1,i={};if(!t.isDce&&!t.isFilter){if(!t._observedResultUnitTypes||!t._observedTaskMap)throw new Error("Invalid Intermediate Result Receiver.");e=t._observedResultUnitTypes,t._observedTaskMap.forEach(((t,e)=>{i[e]=t})),t._observedTaskMap.clear()}return await new Promise(((t,n)=>{let r=at();ht[r]=async e=>{if(e.success)return t();{let t=new Error(e.message);return t.stack=e.stack+"\n"+t.stack,n(t)}},st.postMessage({type:"cvr_setIrrRegistry",id:r,instanceID:this._cvr._instanceID,body:{receiverObj:this._irrRegistryState,observedResultUnitTypes:e.toString(),observedTaskMap:i}})}))}async removeResultReceiver(t){return this._intermediateResultReceiverSet.delete(t),Qt(this),await new Promise(((t,e)=>{let i=at();ht[i]=async i=>{if(i.success)return t();{let t=new Error(i.message);return t.stack=i.stack+"\n"+t.stack,e(t)}},st.postMessage({type:"cvr_setIrrRegistry",id:i,instanceID:this._cvr._instanceID,body:{receiverObj:this._irrRegistryState}})}))}getOriginalImage(){return this._cvr._dsImage}}const te="undefined"==typeof self,ee="function"==typeof importScripts,ie=(()=>{if(!ee){if(!te&&document.currentScript){let t=document.currentScript.src,e=t.indexOf("?");if(-1!=e)t=t.substring(0,e);else{let e=t.indexOf("#");-1!=e&&(t=t.substring(0,e))}return t.substring(0,t.lastIndexOf("/")+1)}return"./"}})(),ne=t=>{if(null==t&&(t="./"),te||ee);else{let e=document.createElement("a");e.href=t,t=e.href}return t.endsWith("/")||(t+="/"),t};var re;vt.engineResourcePaths.cvr={version:"2.4.33",path:ie,isInternal:!0},mt.cvr={js:!0,wasm:!0,deps:["license","dip"]},gt.cvr={};const se="1.4.21";"string"!=typeof vt.engineResourcePaths.std&&D(vt.engineResourcePaths.std.version,se)<0&&(vt.engineResourcePaths.std={version:se,path:ne(ie+`../../dynamsoft-capture-vision-std@${se}/dist/`),isInternal:!0});const oe="2.4.31";(!vt.engineResourcePaths.dip||"string"!=typeof vt.engineResourcePaths.dip&&D(vt.engineResourcePaths.dip.version,oe)<0)&&(vt.engineResourcePaths.dip={version:oe,path:ne(ie+`../../dynamsoft-image-processing@${oe}/dist/`),isInternal:!0});class ae{static getVersion(){return this._version}}ae._version=`2.4.33(Worker: ${null===(re=ft.cvr)||void 0===re?void 0:re.worker}, Wasm: loading...`;const he={barcodeResultItems:{type:yt.CRIT_BARCODE,reveiver:"onDecodedBarcodesReceived",isNeedFilter:!0},textLineResultItems:{type:yt.CRIT_TEXT_LINE,reveiver:"onRecognizedTextLinesReceived",isNeedFilter:!0},detectedQuadResultItems:{type:yt.CRIT_DETECTED_QUAD,reveiver:"onDetectedQuadsReceived",isNeedFilter:!1},normalizedImageResultItems:{type:yt.CRIT_NORMALIZED_IMAGE,reveiver:"onNormalizedImagesReceived",isNeedFilter:!1},parsedResultItems:{type:yt.CRIT_PARSED_RESULT,reveiver:"onParsedResultsReceived",isNeedFilter:!1}};var le,ce,ue,de,fe,ge,me,pe,_e,ve,ye,we,Ce;function Ee(t,e){if(t&&t.location){const i=t.location.points;for(let t of i)t.x=t.x/e,t.y=t.y/e;Ee(t.referencedItem,e)}}function Se(t){if(t.disposed)throw new Error('"CaptureVisionRouter" instance has been disposed')}!function(t){t[t.ISS_BUFFER_EMPTY=0]="ISS_BUFFER_EMPTY",t[t.ISS_EXHAUSTED=1]="ISS_EXHAUSTED"}(le||(le={}));const Te={onTaskResultsReceived:()=>{},isFilter:!0};class be{constructor(){this.maxImageSideLength=["iPhone","Android","HarmonyOS"].includes(vt.browserInfo.OS)?2048:4096,this._instanceID=void 0,this._dsImage=null,this._isPauseScan=!0,this._isOutputOriginalImage=!1,this._isOpenDetectVerify=!1,this._isOpenNormalizeVerify=!1,this._isOpenBarcodeVerify=!1,this._isOpenLabelVerify=!1,this._minImageCaptureInterval=0,this._averageProcessintTimeArray=[],this._averageFetchImageTimeArray=[],this._currentSettings=null,this._averageTime=999,ce.set(this,null),ue.set(this,null),de.set(this,null),fe.set(this,null),ge.set(this,null),me.set(this,new Set),pe.set(this,new Set),_e.set(this,new Set),ve.set(this,0),ye.set(this,!1),we.set(this,!1),Ce.set(this,!1),this._singleFrameModeCallbackBind=this._singleFrameModeCallback.bind(this)}get disposed(){return Ht(this,Ce,"f")}static async createInstance(){if(!gt.license)throw Error("Module `license` is not existed.");await gt.license.dynamsoft(),await _t(["cvr"]);const t=new be,e=new Zt;let i=at();return ht[i]=async i=>{var n;if(i.success)t._instanceID=i.instanceID,t._currentSettings=JSON.parse(JSON.parse(i.outputSettings).data),ae._version=`2.4.33(Worker: ${null===(n=ft.cvr)||void 0===n?void 0:n.worker}, Wasm: ${i.version})`,Xt(t,we,!0,"f"),Xt(t,fe,t.getIntermediateResultManager(),"f"),Xt(t,we,!1,"f"),e.resolve(t);else{const t=Error(i.message);i.stack&&(t.stack=i.stack),e.reject(t)}},st.postMessage({type:"cvr_createInstance",id:i}),e}async _singleFrameModeCallback(t){for(let e of Ht(this,me,"f"))this._isOutputOriginalImage&&e.onOriginalImageResultReceived&&e.onOriginalImageResultReceived({imageData:t});const e={bytes:new Uint8Array(t.bytes),width:t.width,height:t.height,stride:t.stride,format:t.format,tag:t.tag};this._templateName||(this._templateName=this._currentSettings.CaptureVisionTemplates[0].Name);const i=await this.capture(e,this._templateName);i.originalImageTag=t.tag;const n={originalImageHashId:i.originalImageHashId,originalImageTag:i.originalImageTag,errorCode:i.errorCode,errorString:i.errorString};for(let t of Ht(this,me,"f"))if(t.isDce)t.onCapturedResultReceived(i,{isDetectVerifyOpen:!1,isNormalizeVerifyOpen:!1,isBarcodeVerifyOpen:!1,isLabelVerifyOpen:!1});else{for(let e in he){const r=e,s=he[r];t[s.reveiver]&&i[r]&&t[s.reveiver](Object.assign(Object.assign({},n),{[r]:i[r]}))}t.onCapturedResultReceived&&t.onCapturedResultReceived(i)}}setInput(t){if(Se(this),t){if(Xt(this,ce,t,"f"),t.isCameraEnhancer){Ht(this,fe,"f")&&(Ht(this,ce,"f")._intermediateResultReceiver.isDce=!0,Ht(this,fe,"f").addResultReceiver(Ht(this,ce,"f")._intermediateResultReceiver));const t=Ht(this,ce,"f").getCameraView();if(t){const e=t._capturedResultReceiver;e.isDce=!0,Ht(this,me,"f").add(e)}}}else Xt(this,ce,null,"f")}getInput(){return Ht(this,ce,"f")}addImageSourceStateListener(t){if(Se(this),"object"!=typeof t)return console.warn("Invalid ISA state listener.");t&&Object.keys(t)&&Ht(this,pe,"f").add(t)}removeImageSourceStateListener(t){return Se(this),Ht(this,pe,"f").delete(t)}addResultReceiver(t){if(Se(this),"object"!=typeof t)throw new Error("Invalid receiver.");t&&Object.keys(t).length&&(Ht(this,me,"f").add(t),this._setCrrRegistry())}removeResultReceiver(t){Se(this),Ht(this,me,"f").delete(t),this._setCrrRegistry()}async _setCrrRegistry(){const t={onCapturedResultReceived:!1,onDecodedBarcodesReceived:!1,onRecognizedTextLinesReceived:!1,onDetectedQuadsReceived:!1,onNormalizedImagesReceived:!1,onParsedResultsReceived:!1};for(let e of Ht(this,me,"f"))e.isDce||(t.onCapturedResultReceived=!!e.onCapturedResultReceived,t.onDecodedBarcodesReceived=!!e.onDecodedBarcodesReceived,t.onRecognizedTextLinesReceived=!!e.onRecognizedTextLinesReceived,t.onDetectedQuadsReceived=!!e.onDetectedQuadsReceived,t.onNormalizedImagesReceived=!!e.onNormalizedImagesReceived,t.onParsedResultsReceived=!!e.onParsedResultsReceived);const e=new Zt;let i=at();return ht[i]=async t=>{if(t.success)e.resolve();else{let i=new Error(t.message);i.stack=t.stack+"\n"+i.stack,e.reject()}},st.postMessage({type:"cvr_setCrrRegistry",id:i,instanceID:this._instanceID,body:{receiver:JSON.stringify(t)}}),e}async addResultFilter(t){if(Se(this),!t||"object"!=typeof t||!Object.keys(t).length)return console.warn("Invalid filter.");Ht(this,_e,"f").add(t),t._dynamsoft(),await this._handleFilterUpdate()}async removeResultFilter(t){Se(this),Ht(this,_e,"f").delete(t),await this._handleFilterUpdate()}async _handleFilterUpdate(){if(Ht(this,fe,"f").removeResultReceiver(Te),0===Ht(this,_e,"f").size){this._isOpenBarcodeVerify=!1,this._isOpenLabelVerify=!1,this._isOpenDetectVerify=!1,this._isOpenNormalizeVerify=!1;const t={[yt.CRIT_BARCODE]:!1,[yt.CRIT_TEXT_LINE]:!1,[yt.CRIT_DETECTED_QUAD]:!1,[yt.CRIT_NORMALIZED_IMAGE]:!1},e={[yt.CRIT_BARCODE]:!1,[yt.CRIT_TEXT_LINE]:!1,[yt.CRIT_DETECTED_QUAD]:!1,[yt.CRIT_NORMALIZED_IMAGE]:!1};return await Ie(this,t),void await xe(this,e)}for(let t of Ht(this,_e,"f")){if(this._isOpenBarcodeVerify=t.isResultCrossVerificationEnabled(yt.CRIT_BARCODE),this._isOpenLabelVerify=t.isResultCrossVerificationEnabled(yt.CRIT_TEXT_LINE),this._isOpenDetectVerify=t.isResultCrossVerificationEnabled(yt.CRIT_DETECTED_QUAD),this._isOpenNormalizeVerify=t.isResultCrossVerificationEnabled(yt.CRIT_NORMALIZED_IMAGE),t.isLatestOverlappingEnabled(yt.CRIT_BARCODE)){[...Ht(this,fe,"f")._intermediateResultReceiverSet.values()].find((t=>t.isFilter))||Ht(this,fe,"f").addResultReceiver(Te)}await Ie(this,t.verificationEnabled),await xe(this,t.duplicateFilterEnabled),await Oe(this,t.duplicateForgetTime)}}async startCapturing(t){var e,i;if(Se(this),!this._isPauseScan)return;if(!Ht(this,ce,"f"))throw new Error("'ImageSourceAdapter' is not set. call 'setInput' before 'startCapturing'");t||(t=be._defaultTemplate);const n=await this.containsTask(t);await _t(n);for(let t of Ht(this,_e,"f"))await this.addResultFilter(t);if(n.includes("dlr")&&!(null===(e=gt.dlr)||void 0===e?void 0:e.bLoadConfusableCharsData)){const t=L(vt.engineResourcePaths);await(null===(i=gt.dlr)||void 0===i?void 0:i.loadRecognitionData("ConfusableChars",t.dlr))}if(Ht(this,ce,"f").isCameraEnhancer&&(n.includes("ddn")?Ht(this,ce,"f").setPixelFormat(a.IPF_ABGR_8888):Ht(this,ce,"f").setPixelFormat(a.IPF_GRAYSCALED)),void 0!==Ht(this,ce,"f").singleFrameMode&&"disabled"!==Ht(this,ce,"f").singleFrameMode)return this._templateName=t,void Ht(this,ce,"f").on("singleFrameAcquired",this._singleFrameModeCallbackBind);return Ht(this,ce,"f").getColourChannelUsageType()===o.CCUT_AUTO&&Ht(this,ce,"f").setColourChannelUsageType(n.includes("ddn")?o.CCUT_FULL_CHANNEL:o.CCUT_Y_CHANNEL_ONLY),Ht(this,de,"f")&&Ht(this,de,"f").isPending?Ht(this,de,"f"):(Xt(this,de,new Zt(((e,i)=>{if(this.disposed)return;let n=at();ht[n]=async n=>{if(Ht(this,de,"f")&&!Ht(this,de,"f").isFulfilled){if(!n.success){let t=new Error(n.message);return t.stack=n.stack+"\n"+t.stack,i(t)}this._isPauseScan=!1,this._isOutputOriginalImage=n.isOutputOriginalImage,this._loopReadVideoTimeoutId&&clearTimeout(this._loopReadVideoTimeoutId),this._loopReadVideoTimeoutId=setTimeout((async()=>{-1!==this._minImageCaptureInterval&&Ht(this,ce,"f").startFetching(),this._loopReadVideo(t),e()}),0)}},st.postMessage({type:"cvr_startCapturing",id:n,instanceID:this._instanceID,body:{templateName:t}})})),"f"),await Ht(this,de,"f"))}stopCapturing(){Se(this),Ht(this,ce,"f")&&(Ht(this,ce,"f").isCameraEnhancer&&void 0!==Ht(this,ce,"f").singleFrameMode&&"disabled"!==Ht(this,ce,"f").singleFrameMode?Ht(this,ce,"f").off("singleFrameAcquired",this._singleFrameModeCallbackBind):(!async function(t){let e=at();const i=new Zt;ht[e]=async t=>{if(t.success)return i.resolve();{let e=new Error(t.message);return e.stack=t.stack+"\n"+e.stack,i.reject(e)}},st.postMessage({type:"cvr_clearVerifyList",id:e,instanceID:t._instanceID})}(this),Ht(this,ce,"f").stopFetching(),this._averageProcessintTimeArray=[],this._averageTime=999,this._isPauseScan=!0,Xt(this,de,null,"f"),Ht(this,ce,"f").setColourChannelUsageType(o.CCUT_AUTO)))}async containsTask(t){return Se(this),await new Promise(((e,i)=>{let n=at();ht[n]=async t=>{if(t.success)return e(JSON.parse(t.tasks));{let e=new Error(t.message);return e.stack=t.stack+"\n"+e.stack,i(e)}},st.postMessage({type:"cvr_containsTask",id:n,instanceID:this._instanceID,body:{templateName:t}})}))}async _loopReadVideo(t){if(this.disposed||this._isPauseScan)return;if(Xt(this,ye,!0,"f"),Ht(this,ce,"f").isBufferEmpty())if(Ht(this,ce,"f").hasNextImageToFetch())for(let t of Ht(this,pe,"f"))t.onImageSourceStateReceived&&t.onImageSourceStateReceived(le.ISS_BUFFER_EMPTY);else if(!Ht(this,ce,"f").hasNextImageToFetch())for(let t of Ht(this,pe,"f"))t.onImageSourceStateReceived&&t.onImageSourceStateReceived(le.ISS_EXHAUSTED);if(-1===this._minImageCaptureInterval||Ht(this,ce,"f").isBufferEmpty())try{Ht(this,ce,"f").isBufferEmpty()&&be._onLog&&be._onLog("buffer is empty so fetch image"),be._onLog&&be._onLog(`DCE: start fetching a frame: ${Date.now()}`),this._dsImage=Ht(this,ce,"f").fetchImage(),be._onLog&&be._onLog(`DCE: finish fetching a frame: ${Date.now()}`),Ht(this,ce,"f").setImageFetchInterval(this._averageTime)}catch(e){return void this._reRunCurrnetFunc(t)}else if(Ht(this,ce,"f").setImageFetchInterval(this._averageTime-(this._dsImage&&this._dsImage.tag?this._dsImage.tag.timeSpent:0)),this._dsImage=Ht(this,ce,"f").getImage(),this._dsImage.tag&&Date.now()-this._dsImage.tag.timeStamp>200)return void this._reRunCurrnetFunc(t);if(!this._dsImage)return void this._reRunCurrnetFunc(t);for(let t of Ht(this,me,"f"))this._isOutputOriginalImage&&t.onOriginalImageResultReceived&&t.onOriginalImageResultReceived({imageData:this._dsImage});const e=Date.now();this._captureDsimage(this._dsImage,t).then((async i=>{if(be._onLog&&be._onLog("no js handle time: "+(Date.now()-e)),this._isPauseScan)return void this._reRunCurrnetFunc(t);i.originalImageTag=this._dsImage.tag?this._dsImage.tag:null;const n={originalImageHashId:i.originalImageHashId,originalImageTag:i.originalImageTag,errorCode:i.errorCode,errorString:i.errorString};for(let t of Ht(this,me,"f"))if(t.isDce){const e=Date.now();if(t.onCapturedResultReceived(i,{isDetectVerifyOpen:this._isOpenDetectVerify,isNormalizeVerifyOpen:this._isOpenNormalizeVerify,isBarcodeVerifyOpen:this._isOpenBarcodeVerify,isLabelVerifyOpen:this._isOpenLabelVerify}),be._onLog){const t=Date.now()-e;t>10&&be._onLog(`draw result time: ${t}`)}}else{for(let e in he){const r=e,s=he[r];t[s.reveiver],t[s.reveiver]&&i[r]&&t[s.reveiver](Object.assign(Object.assign({},n),{[r]:i[r].filter((t=>!s.isNeedFilter||!t.isFilter))})),i[r]&&(i[r]=i[r].filter((t=>!s.isNeedFilter||!t.isFilter)))}t.onCapturedResultReceived&&(i.items=i.items.filter((t=>[yt.CRIT_DETECTED_QUAD,yt.CRIT_NORMALIZED_IMAGE].includes(t.type)||!t.isFilter)),t.onCapturedResultReceived(i))}const r=Date.now();if(this._minImageCaptureInterval>-1&&(5===this._averageProcessintTimeArray.length&&this._averageProcessintTimeArray.shift(),5===this._averageFetchImageTimeArray.length&&this._averageFetchImageTim