/*!
 * Dynamsoft JavaScript Library
 * @product Dynamsoft Barcode Reader JS Edition
 * @website http://www.dynamsoft.com
 * @copyright Copyright 2022, Dynamsoft Corporation
 * @author Dynamsoft
 * @version 9.4.0 (js 20220930)
 * @fileoverview Dynamsoft JavaScript Library for Barcode Reader
 * More info on DBR JS: https://www.dynamsoft.com/barcode-reader/sdk-javascript/
 */
var e=function(){this.init()};e.prototype={init:function(){var e=this||t;return e._counter=1e3,e._html5AudioPool=[],e.html5PoolSize=10,e._codecs={},e._howls=[],e._muted=!1,e._volume=1,e._canPlayEvent="canplaythrough",e._navigator="undefined"!=typeof window&&window.navigator?window.navigator:null,e.masterGain=null,e.noAudio=!1,e.usingWebAudio=!0,e.autoSuspend=!0,e.ctx=null,e.autoUnlock=!0,e._setup(),e},volume:function(e){var n=this||t;if(e=parseFloat(e),n.ctx||d(),void 0!==e&&e>=0&&e<=1){if(n._volume=e,n._muted)return n;n.usingWebAudio&&n.masterGain.gain.setValueAtTime(e,t.ctx.currentTime);for(var r=0;r<n._howls.length;r++)if(!n._howls[r]._webAudio)for(var o=n._howls[r]._getSoundIds(),i=0;i<o.length;i++){var a=n._howls[r]._soundById(o[i]);a&&a._node&&(a._node.volume=a._volume*e)}return n}return n._volume},mute:function(e){var n=this||t;n.ctx||d(),n._muted=e,n.usingWebAudio&&n.masterGain.gain.setValueAtTime(e?0:n._volume,t.ctx.currentTime);for(var r=0;r<n._howls.length;r++)if(!n._howls[r]._webAudio)for(var o=n._howls[r]._getSoundIds(),i=0;i<o.length;i++){var a=n._howls[r]._soundById(o[i]);a&&a._node&&(a._node.muted=!!e||a._muted)}return n},stop:function(){for(var e=this||t,n=0;n<e._howls.length;n++)e._howls[n].stop();return e},unload:function(){for(var e=this||t,n=e._howls.length-1;n>=0;n--)e._howls[n].unload();return e.usingWebAudio&&e.ctx&&void 0!==e.ctx.close&&(e.ctx.close(),e.ctx=null,d()),e},codecs:function(e){return(this||t)._codecs[e.replace(/^x-/,"")]},_setup:function(){var e=this||t;if(e.state=e.ctx&&e.ctx.state||"suspended",e._autoSuspend(),!e.usingWebAudio)if("undefined"!=typeof Audio)try{void 0===(new Audio).oncanplaythrough&&(e._canPlayEvent="canplay")}catch(t){e.noAudio=!0}else e.noAudio=!0;try{(new Audio).muted&&(e.noAudio=!0)}catch(e){}return e.noAudio||e._setupCodecs(),e},_setupCodecs:function(){var e=this||t,n=null;try{n="undefined"!=typeof Audio?new Audio:null}catch(t){return e}if(!n||"function"!=typeof n.canPlayType)return e;var r=n.canPlayType("audio/mpeg;").replace(/^no$/,""),o=e._navigator?e._navigator.userAgent:"",i=o.match(/OPR\/([0-6].)/g),a=i&&parseInt(i[0].split("/")[1],10)<33,s=-1!==o.indexOf("Safari")&&-1===o.indexOf("Chrome"),_=o.match(/Version\/(.*?) /),d=s&&_&&parseInt(_[1],10)<15;return e._codecs={mp3:!(a||!r&&!n.canPlayType("audio/mp3;").replace(/^no$/,"")),mpeg:!!r,opus:!!n.canPlayType('audio/ogg; codecs="opus"').replace(/^no$/,""),ogg:!!n.canPlayType('audio/ogg; codecs="vorbis"').replace(/^no$/,""),oga:!!n.canPlayType('audio/ogg; codecs="vorbis"').replace(/^no$/,""),wav:!!(n.canPlayType('audio/wav; codecs="1"')||n.canPlayType("audio/wav")).replace(/^no$/,""),aac:!!n.canPlayType("audio/aac;").replace(/^no$/,""),caf:!!n.canPlayType("audio/x-caf;").replace(/^no$/,""),m4a:!!(n.canPlayType("audio/x-m4a;")||n.canPlayType("audio/m4a;")||n.canPlayType("audio/aac;")).replace(/^no$/,""),m4b:!!(n.canPlayType("audio/x-m4b;")||n.canPlayType("audio/m4b;")||n.canPlayType("audio/aac;")).replace(/^no$/,""),mp4:!!(n.canPlayType("audio/x-mp4;")||n.canPlayType("audio/mp4;")||n.canPlayType("audio/aac;")).replace(/^no$/,""),weba:!(d||!n.canPlayType('audio/webm; codecs="vorbis"').replace(/^no$/,"")),webm:!(d||!n.canPlayType('audio/webm; codecs="vorbis"').replace(/^no$/,"")),dolby:!!n.canPlayType('audio/mp4; codecs="ec-3"').replace(/^no$/,""),flac:!!(n.canPlayType("audio/x-flac;")||n.canPlayType("audio/flac;")).replace(/^no$/,"")},e},_unlockAudio:function(){var e=this||t;if(!e._audioUnlocked&&e.ctx){e._audioUnlocked=!1,e.autoUnlock=!1,e._mobileUnloaded||44100===e.ctx.sampleRate||(e._mobileUnloaded=!0,e.unload()),e._scratchBuffer=e.ctx.createBuffer(1,1,22050);var n=function(t){for(;e._html5AudioPool.length<e.html5PoolSize;)try{var r=new Audio;r._unlocked=!0,e._releaseHtml5Audio(r)}catch(t){e.noAudio=!0;break}for(var o=0;o<e._howls.length;o++)if(!e._howls[o]._webAudio)for(var i=e._howls[o]._getSoundIds(),a=0;a<i.length;a++){var s=e._howls[o]._soundById(i[a]);s&&s._node&&!s._node._unlocked&&(s._node._unlocked=!0,s._node.load())}e._autoResume();var _=e.ctx.createBufferSource();_.buffer=e._scratchBuffer,_.connect(e.ctx.destination),void 0===_.start?_.noteOn(0):_.start(0),"function"==typeof e.ctx.resume&&e.ctx.resume(),_.onended=function(){_.disconnect(0),e._audioUnlocked=!0,document.removeEventListener("touchstart",n,!0),document.removeEventListener("touchend",n,!0),document.removeEventListener("click",n,!0),document.removeEventListener("keydown",n,!0);for(var t=0;t<e._howls.length;t++)e._howls[t]._emit("unlock")}};return document.addEventListener("touchstart",n,!0),document.addEventListener("touchend",n,!0),document.addEventListener("click",n,!0),document.addEventListener("keydown",n,!0),e}},_obtainHtml5Audio:function(){var e=this||t;if(e._html5AudioPool.length)return e._html5AudioPool.pop();var n=(new Audio).play();return n&&"undefined"!=typeof Promise&&(n instanceof Promise||"function"==typeof n.then)&&n.catch((function(){console.warn("HTML5 Audio pool exhausted, returning potentially locked audio object.")})),new Audio},_releaseHtml5Audio:function(e){var n=this||t;return e._unlocked&&n._html5AudioPool.push(e),n},_autoSuspend:function(){var e=this;if(e.autoSuspend&&e.ctx&&void 0!==e.ctx.suspend&&t.usingWebAudio){for(var n=0;n<e._howls.length;n++)if(e._howls[n]._webAudio)for(var r=0;r<e._howls[n]._sounds.length;r++)if(!e._howls[n]._sounds[r]._paused)return e;return e._suspendTimer&&clearTimeout(e._suspendTimer),e._suspendTimer=setTimeout((function(){if(e.autoSuspend){e._suspendTimer=null,e.state="suspending";var t=function(){e.state="suspended",e._resumeAfterSuspend&&(delete e._resumeAfterSuspend,e._autoResume())};e.ctx.suspend().then(t,t)}}),3e4),e}},_autoResume:function(){var e=this;if(e.ctx&&void 0!==e.ctx.resume&&t.usingWebAudio)return"running"===e.state&&"interrupted"!==e.ctx.state&&e._suspendTimer?(clearTimeout(e._suspendTimer),e._suspendTimer=null):"suspended"===e.state||"running"===e.state&&"interrupted"===e.ctx.state?(e.ctx.resume().then((function(){e.state="running";for(var t=0;t<e._howls.length;t++)e._howls[t]._emit("resume")})),e._suspendTimer&&(clearTimeout(e._suspendTimer),e._suspendTimer=null)):"suspending"===e.state&&(e._resumeAfterSuspend=!0),e}};var t=new e,n=function(e){e.src&&0!==e.src.length?this.init(e):console.error("An array of source files must be passed with any new Howl.")};n.prototype={init:function(e){var n=this;return t.ctx||d(),n._autoplay=e.autoplay||!1,n._format="string"!=typeof e.format?e.format:[e.format],n._html5=e.html5||!1,n._muted=e.mute||!1,n._loop=e.loop||!1,n._pool=e.pool||5,n._preload="boolean"!=typeof e.preload&&"metadata"!==e.preload||e.preload,n._rate=e.rate||1,n._sprite=e.sprite||{},n._src="string"!=typeof e.src?e.src:[e.src],n._volume=void 0!==e.volume?e.volume:1,n._xhr={method:e.xhr&&e.xhr.method?e.xhr.method:"GET",headers:e.xhr&&e.xhr.headers?e.xhr.headers:null,withCredentials:!(!e.xhr||!e.xhr.withCredentials)&&e.xhr.withCredentials},n._duration=0,n._state="unloaded",n._sounds=[],n._endTimers={},n._queue=[],n._playLock=!1,n._onend=e.onend?[{fn:e.onend}]:[],n._onfade=e.onfade?[{fn:e.onfade}]:[],n._onload=e.onload?[{fn:e.onload}]:[],n._onloaderror=e.onloaderror?[{fn:e.onloaderror}]:[],n._onplayerror=e.onplayerror?[{fn:e.onplayerror}]:[],n._onpause=e.onpause?[{fn:e.onpause}]:[],n._onplay=e.onplay?[{fn:e.onplay}]:[],n._onstop=e.onstop?[{fn:e.onstop}]:[],n._onmute=e.onmute?[{fn:e.onmute}]:[],n._onvolume=e.onvolume?[{fn:e.onvolume}]:[],n._onrate=e.onrate?[{fn:e.onrate}]:[],n._onseek=e.onseek?[{fn:e.onseek}]:[],n._onunlock=e.onunlock?[{fn:e.onunlock}]:[],n._onresume=[],n._webAudio=t.usingWebAudio&&!n._html5,void 0!==t.ctx&&t.ctx&&t.autoUnlock&&t._unlockAudio(),t._howls.push(n),n._autoplay&&n._queue.push({event:"play",action:function(){n.play()}}),n._preload&&"none"!==n._preload&&n.load(),n},load:function(){var e=this,n=null;if(t.noAudio)e._emit("loaderror",null,"No audio support.");else{"string"==typeof e._src&&(e._src=[e._src]);for(var o=0;o<e._src.length;o++){var a,s;if(e._format&&e._format[o])a=e._format[o];else{if("string"!=typeof(s=e._src[o])){e._emit("loaderror",null,"Non-string found in selected audio sources - ignoring.");continue}(a=/^data:audio\/([^;,]+);/i.exec(s))||(a=/\.([^.]+)$/.exec(s.split("?",1)[0])),a&&(a=a[1].toLowerCase())}if(a||console.warn('No file extension was found. Consider using the "format" property or specify an extension.'),a&&t.codecs(a)){n=e._src[o];break}}if(n)return e._src=n,e._state="loading","https:"===window.location.protocol&&"http:"===n.slice(0,5)&&(e._html5=!0,e._webAudio=!1),new r(e),e._webAudio&&i(e),e;e._emit("loaderror",null,"No codec support for selected audio sources.")}},play:function(e,n){var r=this,o=null;if("number"==typeof e)o=e,e=null;else{if("string"==typeof e&&"loaded"===r._state&&!r._sprite[e])return null;if(void 0===e&&(e="__default",!r._playLock)){for(var i=0,a=0;a<r._sounds.length;a++)r._sounds[a]._paused&&!r._sounds[a]._ended&&(i++,o=r._sounds[a]._id);1===i?e=null:o=null}}var s=o?r._soundById(o):r._inactiveSound();if(!s)return null;if(o&&!e&&(e=s._sprite||"__default"),"loaded"!==r._state){s._sprite=e,s._ended=!1;var _=s._id;return r._queue.push({event:"play",action:function(){r.play(_)}}),_}if(o&&!s._paused)return n||r._loadQueue("play"),s._id;r._webAudio&&t._autoResume();var d=Math.max(0,s._seek>0?s._seek:r._sprite[e][0]/1e3),c=Math.max(0,(r._sprite[e][0]+r._sprite[e][1])/1e3-d),u=1e3*c/Math.abs(s._rate),l=r._sprite[e][0]/1e3,h=(r._sprite[e][0]+r._sprite[e][1])/1e3;s._sprite=e,s._ended=!1;var A=function(){s._paused=!1,s._seek=d,s._start=l,s._stop=h,s._loop=!(!s._loop&&!r._sprite[e][2])};if(!(d>=h)){var f=s._node;if(r._webAudio){var g=function(){r._playLock=!1,A(),r._refreshBuffer(s);var e=s._muted||r._muted?0:s._volume;f.gain.setValueAtTime(e,t.ctx.currentTime),s._playStart=t.ctx.currentTime,void 0===f.bufferSource.start?s._loop?f.bufferSource.noteGrainOn(0,d,86400):f.bufferSource.noteGrainOn(0,d,c):s._loop?f.bufferSource.start(0,d,86400):f.bufferSource.start(0,d,c),u!==1/0&&(r._endTimers[s._id]=setTimeout(r._ended.bind(r,s),u)),n||setTimeout((function(){r._emit("play",s._id),r._loadQueue()}),0)};"running"===t.state&&"interrupted"!==t.ctx.state?g():(r._playLock=!0,r.once("resume",g),r._clearTimer(s._id))}else{var p=function(){f.currentTime=d,f.muted=s._muted||r._muted||t._muted||f.muted,f.volume=s._volume*t.volume(),f.playbackRate=s._rate;try{var o=f.play();if(o&&"undefined"!=typeof Promise&&(o instanceof Promise||"function"==typeof o.then)?(r._playLock=!0,A(),o.then((function(){r._playLock=!1,f._unlocked=!0,n?r._loadQueue():r._emit("play",s._id)})).catch((function(){r._playLock=!1,r._emit("playerror",s._id,"Playback was unable to start. This is most commonly an issue on mobile devices and Chrome where playback was not within a user interaction."),s._ended=!0,s._paused=!0}))):n||(r._playLock=!1,A(),r._emit("play",s._id)),f.playbackRate=s._rate,f.paused)return void r._emit("playerror",s._id,"Playback was unable to start. This is most commonly an issue on mobile devices and Chrome where playback was not within a user interaction.");"__default"!==e||s._loop?r._endTimers[s._id]=setTimeout(r._ended.bind(r,s),u):(r._endTimers[s._id]=function(){r._ended(s),f.removeEventListener("ended",r._endTimers[s._id],!1)},f.addEventListener("ended",r._endTimers[s._id],!1))}catch(e){r._emit("playerror",s._id,e)}};"data:audio/wav;base64,UklGRigAAABXQVZFZm10IBIAAAABAAEARKwAAIhYAQACABAAAABkYXRhAgAAAAEA"===f.src&&(f.src=r._src,f.load());var m=window&&window.ejecta||!f.readyState&&t._navigator.isCocoonJS;if(f.readyState>=3||m)p();else{r._playLock=!0,r._state="loading";var R=function(){r._state="loaded",p(),f.removeEventListener(t._canPlayEvent,R,!1)};f.addEventListener(t._canPlayEvent,R,!1),r._clearTimer(s._id)}}return s._id}r._ended(s)},pause:function(e){var t=this;if("loaded"!==t._state||t._playLock)return t._queue.push({event:"pause",action:function(){t.pause(e)}}),t;for(var n=t._getSoundIds(e),r=0;r<n.length;r++){t._clearTimer(n[r]);var o=t._soundById(n[r]);if(o&&!o._paused&&(o._seek=t.seek(n[r]),o._rateSeek=0,o._paused=!0,t._stopFade(n[r]),o._node))if(t._webAudio){if(!o._node.bufferSource)continue;void 0===o._node.bufferSource.stop?o._node.bufferSource.noteOff(0):o._node.bufferSource.stop(0),t._cleanBuffer(o._node)}else isNaN(o._node.duration)&&o._node.duration!==1/0||o._node.pause();arguments[1]||t._emit("pause",o?o._id:null)}return t},stop:function(e,t){var n=this;if("loaded"!==n._state||n._playLock)return n._queue.push({event:"stop",action:function(){n.stop(e)}}),n;for(var r=n._getSoundIds(e),o=0;o<r.length;o++){n._clearTimer(r[o]);var i=n._soundById(r[o]);i&&(i._seek=i._start||0,i._rateSeek=0,i._paused=!0,i._ended=!0,n._stopFade(r[o]),i._node&&(n._webAudio?i._node.bufferSource&&(void 0===i._node.bufferSource.stop?i._node.bufferSource.noteOff(0):i._node.bufferSource.stop(0),n._cleanBuffer(i._node)):isNaN(i._node.duration)&&i._node.duration!==1/0||(i._node.currentTime=i._start||0,i._node.pause(),i._node.duration===1/0&&n._clearSound(i._node))),t||n._emit("stop",i._id))}return n},mute:function(e,n){var r=this;if("loaded"!==r._state||r._playLock)return r._queue.push({event:"mute",action:function(){r.mute(e,n)}}),r;if(void 0===n){if("boolean"!=typeof e)return r._muted;r._muted=e}for(var o=r._getSoundIds(n),i=0;i<o.length;i++){var a=r._soundById(o[i]);a&&(a._muted=e,a._interval&&r._stopFade(a._id),r._webAudio&&a._node?a._node.gain.setValueAtTime(e?0:a._volume,t.ctx.currentTime):a._node&&(a._node.muted=!!t._muted||e),r._emit("mute",a._id))}return r},volume:function(){var e,n,r,o=this,i=arguments;if(0===i.length)return o._volume;if(1===i.length||2===i.length&&void 0===i[1]){var a=o._getSoundIds(),s=a.indexOf(i[0]);s>=0?n=parseInt(i[0],10):e=parseFloat(i[0])}else i.length>=2&&(e=parseFloat(i[0]),n=parseInt(i[1],10));if(!(void 0!==e&&e>=0&&e<=1))return(r=n?o._soundById(n):o._sounds[0])?r._volume:0;if("loaded"!==o._state||o._playLock)return o._queue.push({event:"volume",action:function(){o.volume.apply(o,i)}}),o;void 0===n&&(o._volume=e),n=o._getSoundIds(n);for(var _=0;_<n.length;_++)(r=o._soundById(n[_]))&&(r._volume=e,i[2]||o._stopFade(n[_]),o._webAudio&&r._node&&!r._muted?r._node.gain.setValueAtTime(e,t.ctx.currentTime):r._node&&!r._muted&&(r._node.volume=e*t.volume()),o._emit("volume",r._id));return o},fade:function(e,n,r,o){var i=this;if("loaded"!==i._state||i._playLock)return i._queue.push({event:"fade",action:function(){i.fade(e,n,r,o)}}),i;e=Math.min(Math.max(0,parseFloat(e)),1),n=Math.min(Math.max(0,parseFloat(n)),1),r=parseFloat(r),i.volume(e,o);for(var a=i._getSoundIds(o),s=0;s<a.length;s++){var _=i._soundById(a[s]);if(_){if(o||i._stopFade(a[s]),i._webAudio&&!_._muted){var d=t.ctx.currentTime,c=d+r/1e3;_._volume=e,_._node.gain.setValueAtTime(e,d),_._node.gain.linearRampToValueAtTime(n,c)}i._startFadeInterval(_,e,n,r,a[s],void 0===o)}}return i},_startFadeInterval:function(e,t,n,r,o,i){var a=this,s=t,_=n-t,d=Math.abs(_/.01),c=Math.max(4,d>0?r/d:r),u=Date.now();e._fadeTo=n,e._interval=setInterval((function(){var o=(Date.now()-u)/r;u=Date.now(),s+=_*o,s=Math.round(100*s)/100,s=_<0?Math.max(n,s):Math.min(n,s),a._webAudio?e._volume=s:a.volume(s,e._id,!0),i&&(a._volume=s),(n<t&&s<=n||n>t&&s>=n)&&(clearInterval(e._interval),e._interval=null,e._fadeTo=null,a.volume(n,e._id),a._emit("fade",e._id))}),c)},_stopFade:function(e){var n=this,r=n._soundById(e);return r&&r._interval&&(n._webAudio&&r._node.gain.cancelScheduledValues(t.ctx.currentTime),clearInterval(r._interval),r._interval=null,n.volume(r._fadeTo,e),r._fadeTo=null,n._emit("fade",e)),n},loop:function(){var e,t,n,r=this,o=arguments;if(0===o.length)return r._loop;if(1===o.length){if("boolean"!=typeof o[0])return!!(n=r._soundById(parseInt(o[0],10)))&&n._loop;e=o[0],r._loop=e}else 2===o.length&&(e=o[0],t=parseInt(o[1],10));for(var i=r._getSoundIds(t),a=0;a<i.length;a++)(n=r._soundById(i[a]))&&(n._loop=e,r._webAudio&&n._node&&n._node.bufferSource&&(n._node.bufferSource.loop=e,e&&(n._node.bufferSource.loopStart=n._start||0,n._node.bufferSource.loopEnd=n._stop,r.playing(i[a])&&(r.pause(i[a],!0),r.play(i[a],!0)))));return r},rate:function(){var e,n,r,o=this,i=arguments;if(0===i.length)n=o._sounds[0]._id;else if(1===i.length){var a=o._getSoundIds(),s=a.indexOf(i[0]);s>=0?n=parseInt(i[0],10):e=parseFloat(i[0])}else 2===i.length&&(e=parseFloat(i[0]),n=parseInt(i[1],10));if("number"!=typeof e)return(r=o._soundById(n))?r._rate:o._rate;if("loaded"!==o._state||o._playLock)return o._queue.push({event:"rate",action:function(){o.rate.apply(o,i)}}),o;void 0===n&&(o._rate=e),n=o._getSoundIds(n);for(var _=0;_<n.length;_++)if(r=o._soundById(n[_])){o.playing(n[_])&&(r._rateSeek=o.seek(n[_]),r._playStart=o._webAudio?t.ctx.currentTime:r._playStart),r._rate=e,o._webAudio&&r._node&&r._node.bufferSource?r._node.bufferSource.playbackRate.setValueAtTime(e,t.ctx.currentTime):r._node&&(r._node.playbackRate=e);var d=o.seek(n[_]),c=(o._sprite[r._sprite][0]+o._sprite[r._sprite][1])/1e3-d,u=1e3*c/Math.abs(r._rate);!o._endTimers[n[_]]&&r._paused||(o._clearTimer(n[_]),o._endTimers[n[_]]=setTimeout(o._ended.bind(o,r),u)),o._emit("rate",r._id)}return o},seek:function(){var e,n,r=this,o=arguments;if(0===o.length)r._sounds.length&&(n=r._sounds[0]._id);else if(1===o.length){var i=r._getSoundIds(),a=i.indexOf(o[0]);a>=0?n=parseInt(o[0],10):r._sounds.length&&(n=r._sounds[0]._id,e=parseFloat(o[0]))}else 2===o.length&&(e=parseFloat(o[0]),n=parseInt(o[1],10));if(void 0===n)return 0;if("number"==typeof e&&("loaded"!==r._state||r._playLock))return r._queue.push({event:"seek",action:function(){r.seek.apply(r,o)}}),r;var s=r._soundById(n);if(s){if(!("number"==typeof e&&e>=0)){if(r._webAudio){var _=r.playing(n)?t.ctx.currentTime-s._playStart:0,d=s._rateSeek?s._rateSeek-s._seek:0;return s._seek+(d+_*Math.abs(s._rate))}return s._node.currentTime}var c=r.playing(n);c&&r.pause(n,!0),s._seek=e,s._ended=!1,r._clearTimer(n),r._webAudio||!s._node||isNaN(s._node.duration)||(s._node.currentTime=e);var u=function(){c&&r.play(n,!0),r._emit("seek",n)};if(c&&!r._webAudio){var l=function(){r._playLock?setTimeout(l,0):u()};setTimeout(l,0)}else u()}return r},playing:function(e){var t=this;if("number"==typeof e){var n=t._soundById(e);return!!n&&!n._paused}for(var r=0;r<t._sounds.length;r++)if(!t._sounds[r]._paused)return!0;return!1},duration:function(e){var t=this,n=t._duration,r=t._soundById(e);return r&&(n=t._sprite[r._sprite][1]/1e3),n},state:function(){return this._state},unload:function(){for(var e=this,n=e._sounds,r=0;r<n.length;r++)n[r]._paused||e.stop(n[r]._id),e._webAudio||(e._clearSound(n[r]._node),n[r]._node.removeEventListener("error",n[r]._errorFn,!1),n[r]._node.removeEventListener(t._canPlayEvent,n[r]._loadFn,!1),n[r]._node.removeEventListener("ended",n[r]._endFn,!1),t._releaseHtml5Audio(n[r]._node)),delete n[r]._node,e._clearTimer(n[r]._id);var i=t._howls.indexOf(e);i>=0&&t._howls.splice(i,1);var a=!0;for(r=0;r<t._howls.length;r++)if(t._howls[r]._src===e._src||e._src.indexOf(t._howls[r]._src)>=0){a=!1;break}return o&&a&&delete o[e._src],t.noAudio=!1,e._state="unloaded",e._sounds=[],e=null,null},on:function(e,t,n,r){var o=this["_on"+e];return"function"==typeof t&&o.push(r?{id:n,fn:t,once:r}:{id:n,fn:t}),this},off:function(e,t,n){var r=this,o=r["_on"+e],i=0;if("number"==typeof t&&(n=t,t=null),t||n)for(i=0;i<o.length;i++){var a=n===o[i].id;if(t===o[i].fn&&a||!t&&a){o.splice(i,1);break}}else if(e)r["_on"+e]=[];else{var s=Object.keys(r);for(i=0;i<s.length;i++)0===s[i].indexOf("_on")&&Array.isArray(r[s[i]])&&(r[s[i]]=[])}return r},once:function(e,t,n){return this.on(e,t,n,1),this},_emit:function(e,t,n){for(var r=this,o=r["_on"+e],i=o.length-1;i>=0;i--)o[i].id&&o[i].id!==t&&"load"!==e||(setTimeout(function(e){e.call(this,t,n)}.bind(r,o[i].fn),0),o[i].once&&r.off(e,o[i].fn,o[i].id));return r._loadQueue(e),r},_loadQueue:function(e){var t=this;if(t._queue.length>0){var n=t._queue[0];n.event===e&&(t._queue.shift(),t._loadQueue()),e||n.action()}return t},_ended:function(e){var n=this,r=e._sprite;if(!n._webAudio&&e._node&&!e._node.paused&&!e._node.ended&&e._node.currentTime<e._stop)return setTimeout(n._ended.bind(n,e),100),n;var o=!(!e._loop&&!n._sprite[r][2]);if(n._emit("end",e._id),!n._webAudio&&o&&n.stop(e._id,!0).play(e._id),n._webAudio&&o){n._emit("play",e._id),e._seek=e._start||0,e._rateSeek=0,e._playStart=t.ctx.currentTime;var i=1e3*(e._stop-e._start)/Math.abs(e._rate);n._endTimers[e._id]=setTimeout(n._ended.bind(n,e),i)}return n._webAudio&&!o&&(e._paused=!0,e._ended=!0,e._seek=e._start||0,e._rateSeek=0,n._clearTimer(e._id),n._cleanBuffer(e._node),t._autoSuspend()),n._webAudio||o||n.stop(e._id,!0),n},_clearTimer:function(e){var t=this;if(t._endTimers[e]){if("function"!=typeof t._endTimers[e])clearTimeout(t._endTimers[e]);else{var n=t._soundById(e);n&&n._node&&n._node.removeEventListener("ended",t._endTimers[e],!1)}delete t._endTimers[e]}return t},_soundById:function(e){for(var t=this,n=0;n<t._sounds.length;n++)if(e===t._sounds[n]._id)return t._sounds[n];return null},_inactiveSound:function(){var e=this;e._drain();for(var t=0;t<e._sounds.length;t++)if(e._sounds[t]._ended)return e._sounds[t].reset();return new r(e)},_drain:function(){var e=this,t=e._pool,n=0,r=0;if(!(e._sounds.length<t)){for(r=0;r<e._sounds.length;r++)e._sounds[r]._ended&&n++;for(r=e._sounds.length-1;r>=0;r--){if(n<=t)return;e._sounds[r]._ended&&(e._webAudio&&e._sounds[r]._node&&e._sounds[r]._node.disconnect(0),e._sounds.splice(r,1),n--)}}},_getSoundIds:function(e){if(void 0===e){for(var t=[],n=0;n<this._sounds.length;n++)t.push(this._sounds[n]._id);return t}return[e]},_refreshBuffer:function(e){return e._node.bufferSource=t.ctx.createBufferSource(),e._node.bufferSource.buffer=o[this._src],e._panner?e._node.bufferSource.connect(e._panner):e._node.bufferSource.connect(e._node),e._node.bufferSource.loop=e._loop,e._loop&&(e._node.bufferSource.loopStart=e._start||0,e._node.bufferSource.loopEnd=e._stop||0),e._node.bufferSource.playbackRate.setValueAtTime(e._rate,t.ctx.currentTime),this},_cleanBuffer:function(e){var n=t._navigator&&t._navigator.vendor.indexOf("Apple")>=0;if(!e.bufferSource)return this;if(t._scratchBuffer&&e.bufferSource&&(e.bufferSource.onended=null,e.bufferSource.disconnect(0),n))try{e.bufferSource.buffer=t._scratchBuffer}catch(e){}return e.bufferSource=null,this},_clearSound:function(e){/MSIE |Trident\//.test(t._navigator&&t._navigator.userAgent)||(e.src="data:audio/wav;base64,UklGRigAAABXQVZFZm10IBIAAAABAAEARKwAAIhYAQACABAAAABkYXRhAgAAAAEA")}};var r=function(e){this._parent=e,this.init()};r.prototype={init:function(){var e=this,n=e._parent;return e._muted=n._muted,e._loop=n._loop,e._volume=n._volume,e._rate=n._rate,e._seek=0,e._paused=!0,e._ended=!0,e._sprite="__default",e._id=++t._counter,n._sounds.push(e),e.create(),e},create:function(){var e=this,n=e._parent,r=t._muted||e._muted||e._parent._muted?0:e._volume;return n._webAudio?(e._node=void 0===t.ctx.createGain?t.ctx.createGainNode():t.ctx.createGain(),e._node.gain.setValueAtTime(r,t.ctx.currentTime),e._node.paused=!0,e._node.connect(t.masterGain)):t.noAudio||(e._node=t._obtainHtml5Audio(),e._errorFn=e._errorListener.bind(e),e._node.addEventListener("error",e._errorFn,!1),e._loadFn=e._loadListener.bind(e),e._node.addEventListener(t._canPlayEvent,e._loadFn,!1),e._endFn=e._endListener.bind(e),e._node.addEventListener("ended",e._endFn,!1),e._node.src=n._src,e._node.preload=!0===n._preload?"auto":n._preload,e._node.volume=r*t.volume(),e._node.load()),e},reset:function(){var e=this,n=e._parent;return e._muted=n._muted,e._loop=n._loop,e._volume=n._volume,e._rate=n._rate,e._seek=0,e._rateSeek=0,e._paused=!0,e._ended=!0,e._sprite="__default",e._id=++t._counter,e},_errorListener:function(){var e=this;e._parent._emit("loaderror",e._id,e._node.error?e._node.error.code:0),e._node.removeEventListener("error",e._errorFn,!1)},_loadListener:function(){var e=this,n=e._parent;n._duration=Math.ceil(10*e._node.duration)/10,0===Object.keys(n._sprite).length&&(n._sprite={__default:[0,1e3*n._duration]}),"loaded"!==n._state&&(n._state="loaded",n._emit("load"),n._loadQueue()),e._node.removeEventListener(t._canPlayEvent,e._loadFn,!1)},_endListener:function(){var e=this,t=e._parent;t._duration===1/0&&(t._duration=Math.ceil(10*e._node.duration)/10,t._sprite.__default[1]===1/0&&(t._sprite.__default[1]=1e3*t._duration),t._ended(e)),e._node.removeEventListener("ended",e._endFn,!1)}};var o={},i=function(e){var t=e._src;if(o[t])return e._duration=o[t].duration,void _(e);if(/^data:[^;]+;base64,/.test(t)){for(var n=atob(t.split(",")[1]),r=new Uint8Array(n.length),i=0;i<n.length;++i)r[i]=n.charCodeAt(i);s(r.buffer,e)}else{var d=new XMLHttpRequest;d.open(e._xhr.method,t,!0),d.withCredentials=e._xhr.withCredentials,d.responseType="arraybuffer",e._xhr.headers&&Object.keys(e._xhr.headers).forEach((function(t){d.setRequestHeader(t,e._xhr.headers[t])})),d.onload=function(){var t=(d.status+"")[0];"0"===t||"2"===t||"3"===t?s(d.response,e):e._emit("loaderror",null,"Failed loading audio file with status: "+d.status+".")},d.onerror=function(){e._webAudio&&(e._html5=!0,e._webAudio=!1,e._sounds=[],delete o[t],e.load())},a(d)}},a=function(e){try{e.send()}catch(t){e.onerror()}},s=function(e,n){var r=function(){n._emit("loaderror",null,"Decoding audio data failed.")},i=function(e){e&&n._sounds.length>0?(o[n._src]=e,_(n,e)):r()};"undefined"!=typeof Promise&&1===t.ctx.decodeAudioData.length?t.ctx.decodeAudioData(e).then(i).catch(r):t.ctx.decodeAudioData(e,i,r)},_=function(e,t){t&&!e._duration&&(e._duration=t.duration),0===Object.keys(e._sprite).length&&(e._sprite={__default:[0,1e3*e._duration]}),"loaded"!==e._state&&(e._state="loaded",e._emit("load"),e._loadQueue())},d=function(){if(t.usingWebAudio){try{"undefined"!=typeof AudioContext?t.ctx=new AudioContext:"undefined"!=typeof webkitAudioContext?t.ctx=new webkitAudioContext:t.usingWebAudio=!1}catch(e){t.usingWebAudio=!1}t.ctx||(t.usingWebAudio=!1);var e=/iP(hone|od|ad)/.test(t._navigator&&t._navigator.platform),n=t._navigator&&t._navigator.appVersion.match(/OS (\d+)_(\d+)_?(\d+)?/),r=n?parseInt(n[1],10):null;if(e&&r&&r<9){var o=/safari/.test(t._navigator&&t._navigator.userAgent.toLowerCase());t._navigator&&!o&&(t.usingWebAudio=!1)}t.usingWebAudio&&(t.masterGain=void 0===t.ctx.createGain?t.ctx.createGainNode():t.ctx.createGain(),t.masterGain.gain.setValueAtTime(t._muted?0:t._volume,t.ctx.currentTime),t.masterGain.connect(t.ctx.destination)),t._setup()}};!function(e,t,n,r){var o;e.prototype._pos=[0,0,0],e.prototype._orientation=[0,0,-1,0,1,0],e.prototype.stereo=function(e){var t=this;if(!t.ctx||!t.ctx.listener)return t;for(var n=t._howls.length-1;n>=0;n--)t._howls[n].stereo(e);return t},e.prototype.pos=function(e,n,r){var o=this;return o.ctx&&o.ctx.listener?(n="number"!=typeof n?o._pos[1]:n,r="number"!=typeof r?o._pos[2]:r,"number"!=typeof e?o._pos:(o._pos=[e,n,r],void 0!==o.ctx.listener.positionX?(o.ctx.listener.positionX.setTargetAtTime(o._pos[0],t.ctx.currentTime,.1),o.ctx.listener.positionY.setTargetAtTime(o._pos[1],t.ctx.currentTime,.1),o.ctx.listener.positionZ.setTargetAtTime(o._pos[2],t.ctx.currentTime,.1)):o.ctx.listener.setPosition(o._pos[0],o._pos[1],o._pos[2]),o)):o},e.prototype.orientation=function(e,n,r,o,i,a){var s=this;if(!s.ctx||!s.ctx.listener)return s;var _=s._orientation;return n="number"!=typeof n?_[1]:n,r="number"!=typeof r?_[2]:r,o="number"!=typeof o?_[3]:o,i="number"!=typeof i?_[4]:i,a="number"!=typeof a?_[5]:a,"number"!=typeof e?_:(s._orientation=[e,n,r,o,i,a],void 0!==s.ctx.listener.forwardX?(s.ctx.listener.forwardX.setTargetAtTime(e,t.ctx.currentTime,.1),s.ctx.listener.forwardY.setTargetAtTime(n,t.ctx.currentTime,.1),s.ctx.listener.forwardZ.setTargetAtTime(r,t.ctx.currentTime,.1),s.ctx.listener.upX.setTargetAtTime(o,t.ctx.currentTime,.1),s.ctx.listener.upY.setTargetAtTime(i,t.ctx.currentTime,.1),s.ctx.listener.upZ.setTargetAtTime(a,t.ctx.currentTime,.1)):s.ctx.listener.setOrientation(e,n,r,o,i,a),s)},n.prototype.init=(o=n.prototype.init,function(e){var t=this;return t._orientation=e.orientation||[1,0,0],t._stereo=e.stereo||null,t._pos=e.pos||null,t._pannerAttr={coneInnerAngle:void 0!==e.coneInnerAngle?e.coneInnerAngle:360,coneOuterAngle:void 0!==e.coneOuterAngle?e.coneOuterAngle:360,coneOuterGain:void 0!==e.coneOuterGain?e.coneOuterGain:0,distanceModel:void 0!==e.distanceModel?e.distanceModel:"inverse",maxDistance:void 0!==e.maxDistance?e.maxDistance:1e4,panningModel:void 0!==e.panningModel?e.panningModel:"HRTF",refDistance:void 0!==e.refDistance?e.refDistance:1,rolloffFactor:void 0!==e.rolloffFactor?e.rolloffFactor:1},t._onstereo=e.onstereo?[{fn:e.onstereo}]:[],t._onpos=e.onpos?[{fn:e.onpos}]:[],t._onorientation=e.onorientation?[{fn:e.onorientation}]:[],o.call(this,e)}),n.prototype.stereo=function(e,n){var r=this;if(!r._webAudio)return r;if("loaded"!==r._state)return r._queue.push({event:"stereo",action:function(){r.stereo(e,n)}}),r;var o=void 0===t.ctx.createStereoPanner?"spatial":"stereo";if(void 0===n){if("number"!=typeof e)return r._stereo;r._stereo=e,r._pos=[e,0,0]}for(var a=r._getSoundIds(n),s=0;s<a.length;s++){var _=r._soundById(a[s]);if(_){if("number"!=typeof e)return _._stereo;_._stereo=e,_._pos=[e,0,0],_._node&&(_._pannerAttr.panningModel="equalpower",_._panner&&_._panner.pan||i(_,o),"spatial"===o?void 0!==_._panner.positionX?(_._panner.positionX.setValueAtTime(e,t.ctx.currentTime),_._panner.positionY.setValueAtTime(0,t.ctx.currentTime),_._panner.positionZ.setValueAtTime(0,t.ctx.currentTime)):_._panner.setPosition(e,0,0):_._panner.pan.setValueAtTime(e,t.ctx.currentTime)),r._emit("stereo",_._id)}}return r},n.prototype.pos=function(e,n,r,o){var a=this;if(!a._webAudio)return a;if("loaded"!==a._state)return a._queue.push({event:"pos",action:function(){a.pos(e,n,r,o)}}),a;if(n="number"!=typeof n?0:n,r="number"!=typeof r?-.5:r,void 0===o){if("number"!=typeof e)return a._pos;a._pos=[e,n,r]}for(var s=a._getSoundIds(o),_=0;_<s.length;_++){var d=a._soundById(s[_]);if(d){if("number"!=typeof e)return d._pos;d._pos=[e,n,r],d._node&&(d._panner&&!d._panner.pan||i(d,"spatial"),void 0!==d._panner.positionX?(d._panner.positionX.setValueAtTime(e,t.ctx.currentTime),d._panner.positionY.setValueAtTime(n,t.ctx.currentTime),d._panner.positionZ.setValueAtTime(r,t.ctx.currentTime)):d._panner.setPosition(e,n,r)),a._emit("pos",d._id)}}return a},n.prototype.orientation=function(e,n,r,o){var a=this;if(!a._webAudio)return a;if("loaded"!==a._state)return a._queue.push({event:"orientation",action:function(){a.orientation(e,n,r,o)}}),a;if(n="number"!=typeof n?a._orientation[1]:n,r="number"!=typeof r?a._orientation[2]:r,void 0===o){if("number"!=typeof e)return a._orientation;a._orientation=[e,n,r]}for(var s=a._getSoundIds(o),_=0;_<s.length;_++){var d=a._soundById(s[_]);if(d){if("number"!=typeof e)return d._orientation;d._orientation=[e,n,r],d._node&&(d._panner||(d._pos||(d._pos=a._pos||[0,0,-.5]),i(d,"spatial")),void 0!==d._panner.orientationX?(d._panner.orientationX.setValueAtTime(e,t.ctx.currentTime),d._panner.orientationY.setValueAtTime(n,t.ctx.currentTime),d._panner.orientationZ.setValueAtTime(r,t.ctx.currentTime)):d._panner.setOrientation(e,n,r)),a._emit("orientation",d._id)}}return a},n.prototype.pannerAttr=function(){var e,t,n,r=this,o=arguments;if(!r._webAudio)return r;if(0===o.length)return r._pannerAttr;if(1===o.length){if("object"!=typeof o[0])return(n=r._soundById(parseInt(o[0],10)))?n._pannerAttr:r._pannerAttr;e=o[0],void 0===t&&(e.pannerAttr||(e.pannerAttr={coneInnerAngle:e.coneInnerAngle,coneOuterAngle:e.coneOuterAngle,coneOuterGain:e.coneOuterGain,distanceModel:e.distanceModel,maxDistance:e.maxDistance,refDistance:e.refDistance,rolloffFactor:e.rolloffFactor,panningModel:e.panningModel}),r._pannerAttr={coneInnerAngle:void 0!==e.pannerAttr.coneInnerAngle?e.pannerAttr.coneInnerAngle:r._coneInnerAngle,coneOuterAngle:void 0!==e.pannerAttr.coneOuterAngle?e.pannerAttr.coneOuterAngle:r._coneOuterAngle,coneOuterGain:void 0!==e.pannerAttr.coneOuterGain?e.pannerAttr.coneOuterGain:r._coneOuterGain,distanceModel:void 0!==e.pannerAttr.distanceModel?e.pannerAttr.distanceModel:r._distanceModel,maxDistance:void 0!==e.pannerAttr.maxDistance?e.pannerAttr.maxDistance:r._maxDistance,refDistance:void 0!==e.pannerAttr.refDistance?e.pannerAttr.refDistance:r._refDistance,rolloffFactor:void 0!==e.pannerAttr.rolloffFactor?e.pannerAttr.rolloffFactor:r._rolloffFactor,panningModel:void 0!==e.pannerAttr.panningModel?e.pannerAttr.panningModel:r._panningModel})}else 2===o.length&&(e=o[0],t=parseInt(o[1],10));for(var a=r._getSoundIds(t),s=0;s<a.length;s++)if(n=r._soundById(a[s])){var _=n._pannerAttr;_={coneInnerAngle:void 0!==e.coneInnerAngle?e.coneInnerAngle:_.coneInnerAngle,coneOuterAngle:void 0!==e.coneOuterAngle?e.coneOuterAngle:_.coneOuterAngle,coneOuterGain:void 0!==e.coneOuterGain?e.coneOuterGain:_.coneOuterGain,distanceModel:void 0!==e.distanceModel?e.distanceModel:_.distanceModel,maxDistance:void 0!==e.maxDistance?e.maxDistance:_.maxDistance,refDistance:void 0!==e.refDistance?e.refDistance:_.refDistance,rolloffFactor:void 0!==e.rolloffFactor?e.rolloffFactor:_.rolloffFactor,panningModel:void 0!==e.panningModel?e.panningModel:_.panningModel};var d=n._panner;d||(n._pos||(n._pos=r._pos||[0,0,-.5]),i(n,"spatial"),d=n._panner),d.coneInnerAngle=_.coneInnerAngle,d.coneOuterAngle=_.coneOuterAngle,d.coneOuterGain=_.coneOuterGain,d.distanceModel=_.distanceModel,d.maxDistance=_.maxDistance,d.refDistance=_.refDistance,d.rolloffFactor=_.rolloffFactor,d.panningModel=_.panningModel}return r},r.prototype.init=function(e){return function(){var t=this,n=t._parent;t._orientation=n._orientation,t._stereo=n._stereo,t._pos=n._pos,t._pannerAttr=n._pannerAttr,e.call(this),t._stereo?n.stereo(t._stereo):t._pos&&n.pos(t._pos[0],t._pos[1],t._pos[2],t._id)}}(r.prototype.init),r.prototype.reset=function(e){return function(){var t=this,n=t._parent;return t._orientation=n._orientation,t._stereo=n._stereo,t._pos=n._pos,t._pannerAttr=n._pannerAttr,t._stereo?n.stereo(t._stereo):t._pos?n.pos(t._pos[0],t._pos[1],t._pos[2],t._id):t._panner&&(t._panner.disconnect(0),t._panner=void 0,n._refreshBuffer(t)),e.call(this)}}(r.prototype.reset);var i=function(e,n){"spatial"===(n=n||"spatial")?(e._panner=t.ctx.createPanner(),e._panner.coneInnerAngle=e._pannerAttr.coneInnerAngle,e._panner.coneOuterAngle=e._pannerAttr.coneOuterAngle,e._panner.coneOuterGain=e._pannerAttr.coneOuterGain,e._panner.distanceModel=e._pannerAttr.distanceModel,e._panner.maxDistance=e._pannerAttr.maxDistance,e._panner.refDistance=e._pannerAttr.refDistance,e._panner.rolloffFactor=e._pannerAttr.rolloffFactor,e._panner.panningModel=e._pannerAttr.panningModel,void 0!==e._panner.positionX?(e._panner.positionX.setValueAtTime(e._pos[0],t.ctx.currentTime),e._panner.positionY.setValueAtTime(e._pos[1],t.ctx.currentTime),e._panner.positionZ.setValueAtTime(e._pos[2],t.ctx.currentTime)):e._panner.setPosition(e._pos[0],e._pos[1],e._pos[2]),void 0!==e._panner.orientationX?(e._panner.orientationX.setValueAtTime(e._orientation[0],t.ctx.currentTime),e._panner.orientationY.setValueAtTime(e._orientation[1],t.ctx.currentTime),e._panner.orientationZ.setValueAtTime(e._orientation[2],t.ctx.currentTime)):e._panner.setOrientation(e._orientation[0],e._orientation[1],e._orientation[2])):(e._panner=t.ctx.createStereoPanner(),e._panner.pan.setValueAtTime(e._stereo,t.ctx.currentTime)),e._panner.connect(e._node),e._paused||e._parent.pause(e._id,!0).play(e._id,!0)}}(e,t,n,r);const c="undefined"==typeof self;let u,l,h,A,f;if("undefined"!=typeof navigator&&(u=navigator,l=u.userAgent,h=u.platform,A=u.mediaDevices),!c){const e={init:function(){this.browser=this.searchString(this.dataBrowser)||"unknownBrowser",this.version=this.searchVersion(l)||this.searchVersion(u.appVersion)||0,this.OS=this.searchString(this.dataOS)||"unknownOS","Linux"==this.OS&&-1!=l.indexOf("Windows NT")&&(this.OS="HarmonyOS")},searchString:function(e){for(let t=0;t<e.length;t++){let n=e[t].string,r=e[t].prop;if(this.versionSearchString=e[t].versionSearch||e[t].identity,n){if(-1!=n.indexOf(e[t].subString))return e[t].identity}else if(r)return e[t].identity}},searchVersion:function(e){let t=e.indexOf(this.versionSearchString);if(-1!=t)return parseFloat(e.substring(t+this.versionSearchString.length+1))},dataBrowser:[{string:l,subString:"Edge",identity:"Edge"},{string:l,subString:"OPR",identity:"OPR"},{string:l,subString:"Chrome",identity:"Chrome"},{string:u.vendor,subString:"Apple",identity:"Safari",versionSearch:"Version"},{string:l,subString:"Firefox",identity:"Firefox"},{string:l,subString:"MSIE",identity:"Explorer",versionSearch:"MSIE"}],dataOS:[{string:l,subString:"HarmonyOS",identity:"HarmonyOS"},{string:l,subString:"Android",identity:"Android"},{string:l,subString:"iPhone",identity:"iPhone"},{string:h,subString:"Win",identity:"Windows"},{string:h,subString:"Mac",identity:"Mac"},{string:h,subString:"Linux",identity:"Linux"}]};e.init(),f={browser:e.browser,version:e.version,OS:e.OS}}c&&(f={browser:"ssr",version:0,OS:"ssr"});const g="undefined"!=typeof WebAssembly&&l&&!(/Safari/.test(l)&&!/Chrome/.test(l)&&/\(.+\s11_2_([2-6]).*\)/.test(l)),p=!("undefined"==typeof Worker),m=!(!A||!A.getUserMedia),R=async()=>{let e=!1;if(m)try{(await A.getUserMedia({video:!0})).getTracks().forEach((e=>{e.stop()})),e=!0}catch(e){}return e};"Chrome"===f.browser&&f.version>66||"Safari"===f.browser&&f.version>13||"OPR"===f.browser&&f.version>43||"Edge"===f.browser&&f.version;const I=(()=>{if(!c&&document.currentScript){let e=document.currentScript.src,t=e.indexOf("?");if(-1!=t)e=e.substring(0,t);else{let t=e.indexOf("#");-1!=t&&(e=e.substring(0,t))}return e.substring(0,e.lastIndexOf("/")+1)}return"./"})(),E=" is not allowed to change after `createInstance` or `loadWasm` is called.",S=!c&&document.currentScript&&(document.currentScript.getAttribute("data-license")||document.currentScript.getAttribute("data-productKeys")||document.currentScript.getAttribute("data-licenseKey")||document.currentScript.getAttribute("data-handshakeCode")||document.currentScript.getAttribute("data-organizationID"))||"",D=!c&&document.currentScript&&document.currentScript.getAttribute("data-sessionPassword")||"",T=e=>{if(null==e)e=[];else{e=e instanceof Array?[...e]:[e];for(let t=0;t<e.length;++t){if(!c){let n=document.createElement("a");n.href=e[t],e[t]=n.href}e[t].endsWith("/")||(e[t]+="/")}}return e};var C,y,O,L;!function(e){e[e.IPF_Binary=0]="IPF_Binary",e[e.IPF_BinaryInverted=1]="IPF_BinaryInverted",e[e.IPF_GrayScaled=2]="IPF_GrayScaled",e[e.IPF_NV21=3]="IPF_NV21",e[e.IPF_RGB_565=4]="IPF_RGB_565",e[e.IPF_RGB_555=5]="IPF_RGB_555",e[e.IPF_RGB_888=6]="IPF_RGB_888",e[e.IPF_ARGB_8888=7]="IPF_ARGB_8888",e[e.IPF_RGB_161616=8]="IPF_RGB_161616",e[e.IPF_ARGB_16161616=9]="IPF_ARGB_16161616",e[e.IPF_ABGR_8888=10]="IPF_ABGR_8888",e[e.IPF_ABGR_16161616=11]="IPF_ABGR_16161616",e[e.IPF_BGR_888=12]="IPF_BGR_888"}(C||(C={})),function(e){e[e.DBR_SYSTEM_EXCEPTION=1]="DBR_SYSTEM_EXCEPTION",e[e.DBR_SUCCESS=0]="DBR_SUCCESS",e[e.DBR_UNKNOWN=-1e4]="DBR_UNKNOWN",e[e.DBR_NO_MEMORY=-10001]="DBR_NO_MEMORY",e[e.DBR_NULL_REFERENCE=-10002]="DBR_NULL_REFERENCE",e[e.DBR_LICENSE_INVALID=-10003]="DBR_LICENSE_INVALID",e[e.DBR_LICENSE_EXPIRED=-10004]="DBR_LICENSE_EXPIRED",e[e.DBR_FILE_NOT_FOUND=-10005]="DBR_FILE_NOT_FOUND",e[e.DBR_FILETYPE_NOT_SUPPORTED=-10006]="DBR_FILETYPE_NOT_SUPPORTED",e[e.DBR_BPP_NOT_SUPPORTED=-10007]="DBR_BPP_NOT_SUPPORTED",e[e.DBR_INDEX_INVALID=-10008]="DBR_INDEX_INVALID",e[e.DBR_BARCODE_FORMAT_INVALID=-10009]="DBR_BARCODE_FORMAT_INVALID",e[e.DBR_CUSTOM_REGION_INVALID=-10010]="DBR_CUSTOM_REGION_INVALID",e[e.DBR_MAX_BARCODE_NUMBER_INVALID=-10011]="DBR_MAX_BARCODE_NUMBER_INVALID",e[e.DBR_IMAGE_READ_FAILED=-10012]="DBR_IMAGE_READ_FAILED",e[e.DBR_TIFF_READ_FAILED=-10013]="DBR_TIFF_READ_FAILED",e[e.DBR_QR_LICENSE_INVALID=-10016]="DBR_QR_LICENSE_INVALID",e[e.DBR_1D_LICENSE_INVALID=-10017]="DBR_1D_LICENSE_INVALID",e[e.DBR_DIB_BUFFER_INVALID=-10018]="DBR_DIB_BUFFER_INVALID",e[e.DBR_PDF417_LICENSE_INVALID=-10019]="DBR_PDF417_LICENSE_INVALID",e[e.DBR_DATAMATRIX_LICENSE_INVALID=-10020]="DBR_DATAMATRIX_LICENSE_INVALID",e[e.DBR_PDF_READ_FAILED=-10021]="DBR_PDF_READ_FAILED",e[e.DBR_PDF_DLL_MISSING=-10022]="DBR_PDF_DLL_MISSING",e[e.DBR_PAGE_NUMBER_INVALID=-10023]="DBR_PAGE_NUMBER_INVALID",e[e.DBR_CUSTOM_SIZE_INVALID=-10024]="DBR_CUSTOM_SIZE_INVALID",e[e.DBR_CUSTOM_MODULESIZE_INVALID=-10025]="DBR_CUSTOM_MODULESIZE_INVALID",e[e.DBR_RECOGNITION_TIMEOUT=-10026]="DBR_RECOGNITION_TIMEOUT",e[e.DBR_JSON_PARSE_FAILED=-10030]="DBR_JSON_PARSE_FAILED",e[e.DBR_JSON_TYPE_INVALID=-10031]="DBR_JSON_TYPE_INVALID",e[e.DBR_JSON_KEY_INVALID=-10032]="DBR_JSON_KEY_INVALID",e[e.DBR_JSON_VALUE_INVALID=-10033]="DBR_JSON_VALUE_INVALID",e[e.DBR_JSON_NAME_KEY_MISSING=-10034]="DBR_JSON_NAME_KEY_MISSING",e[e.DBR_JSON_NAME_VALUE_DUPLICATED=-10035]="DBR_JSON_NAME_VALUE_DUPLICATED",e[e.DBR_TEMPLATE_NAME_INVALID=-10036]="DBR_TEMPLATE_NAME_INVALID",e[e.DBR_JSON_NAME_REFERENCE_INVALID=-10037]="DBR_JSON_NAME_REFERENCE_INVALID",e[e.DBR_PARAMETER_VALUE_INVALID=-10038]="DBR_PARAMETER_VALUE_INVALID",e[e.DBR_DOMAIN_NOT_MATCHED=-10039]="DBR_DOMAIN_NOT_MATCHED",e[e.DBR_RESERVEDINFO_NOT_MATCHED=-10040]="DBR_RESERVEDINFO_NOT_MATCHED",e[e.DBR_AZTEC_LICENSE_INVALID=-10041]="DBR_AZTEC_LICENSE_INVALID",e[e.DBR_LICENSE_DLL_MISSING=-10042]="DBR_LICENSE_DLL_MISSING",e[e.DBR_LICENSEKEY_NOT_MATCHED=-10043]="DBR_LICENSEKEY_NOT_MATCHED",e[e.DBR_REQUESTED_FAILED=-10044]="DBR_REQUESTED_FAILED",e[e.DBR_LICENSE_INIT_FAILED=-10045]="DBR_LICENSE_INIT_FAILED",e[e.DBR_PATCHCODE_LICENSE_INVALID=-10046]="DBR_PATCHCODE_LICENSE_INVALID",e[e.DBR_POSTALCODE_LICENSE_INVALID=-10047]="DBR_POSTALCODE_LICENSE_INVALID",e[e.DBR_DPM_LICENSE_INVALID=-10048]="DBR_DPM_LICENSE_INVALID",e[e.DBR_FRAME_DECODING_THREAD_EXISTS=-10049]="DBR_FRAME_DECODING_THREAD_EXISTS",e[e.DBR_STOP_DECODING_THREAD_FAILED=-10050]="DBR_STOP_DECODING_THREAD_FAILED",e[e.DBR_SET_MODE_ARGUMENT_ERROR=-10051]="DBR_SET_MODE_ARGUMENT_ERROR",e[e.DBR_LICENSE_CONTENT_INVALID=-10052]="DBR_LICENSE_CONTENT_INVALID",e[e.DBR_LICENSE_KEY_INVALID=-10053]="DBR_LICENSE_KEY_INVALID",e[e.DBR_LICENSE_DEVICE_RUNS_OUT=-10054]="DBR_LICENSE_DEVICE_RUNS_OUT",e[e.DBR_GET_MODE_ARGUMENT_ERROR=-10055]="DBR_GET_MODE_ARGUMENT_ERROR",e[e.DBR_IRT_LICENSE_INVALID=-10056]="DBR_IRT_LICENSE_INVALID",e[e.DBR_MAXICODE_LICENSE_INVALID=-10057]="DBR_MAXICODE_LICENSE_INVALID",e[e.DBR_GS1_DATABAR_LICENSE_INVALID=-10058]="DBR_GS1_DATABAR_LICENSE_INVALID",e[e.DBR_GS1_COMPOSITE_LICENSE_INVALID=-10059]="DBR_GS1_COMPOSITE_LICENSE_INVALID",e[e.DBR_DOTCODE_LICENSE_INVALID=-10061]="DBR_DOTCODE_LICENSE_INVALID",e[e.DMERR_NO_LICENSE=-2e4]="DMERR_NO_LICENSE",e[e.DMERR_LICENSE_SYNC_FAILED=-20003]="DMERR_LICENSE_SYNC_FAILED",e[e.DMERR_TRIAL_LICENSE=-20010]="DMERR_TRIAL_LICENSE",e[e.DMERR_FAILED_TO_REACH_LTS=-20200]="DMERR_FAILED_TO_REACH_LTS"}(y||(y={})),function(e){e[e.IMRDT_IMAGE=1]="IMRDT_IMAGE",e[e.IMRDT_CONTOUR=2]="IMRDT_CONTOUR",e[e.IMRDT_LINESEGMENT=4]="IMRDT_LINESEGMENT",e[e.IMRDT_LOCALIZATIONRESULT=8]="IMRDT_LOCALIZATIONRESULT",e[e.IMRDT_REGIONOFINTEREST=16]="IMRDT_REGIONOFINTEREST",e[e.IMRDT_QUADRILATERAL=32]="IMRDT_QUADRILATERAL"}(O||(O={})),function(e){e[e.BF_ALL=4265607167]="BF_ALL",e[e.BF_ONED=3147775]="BF_ONED",e[e.BF_GS1_DATABAR=260096]="BF_GS1_DATABAR",e[e.BF_CODE_39=1]="BF_CODE_39",e[e.BF_CODE_128=2]="BF_CODE_128",e[e.BF_CODE_93=4]="BF_CODE_93",e[e.BF_CODABAR=8]="BF_CODABAR",e[e.BF_ITF=16]="BF_ITF",e[e.BF_EAN_13=32]="BF_EAN_13",e[e.BF_EAN_8=64]="BF_EAN_8",e[e.BF_UPC_A=128]="BF_UPC_A",e[e.BF_UPC_E=256]="BF_UPC_E",e[e.BF_INDUSTRIAL_25=512]="BF_INDUSTRIAL_25",e[e.BF_CODE_39_EXTENDED=1024]="BF_CODE_39_EXTENDED",e[e.BF_GS1_DATABAR_OMNIDIRECTIONAL=2048]="BF_GS1_DATABAR_OMNIDIRECTIONAL",e[e.BF_GS1_DATABAR_TRUNCATED=4096]="BF_GS1_DATABAR_TRUNCATED",e[e.BF_GS1_DATABAR_STACKED=8192]="BF_GS1_DATABAR_STACKED",e[e.BF_GS1_DATABAR_STACKED_OMNIDIRECTIONAL=16384]="BF_GS1_DATABAR_STACKED_OMNIDIRECTIONAL",e[e.BF_GS1_DATABAR_EXPANDED=32768]="BF_GS1_DATABAR_EXPANDED",e[e.BF_GS1_DATABAR_EXPANDED_STACKED=65536]="BF_GS1_DATABAR_EXPANDED_STACKED",e[e.BF_GS1_DATABAR_LIMITED=131072]="BF_GS1_DATABAR_LIMITED",e[e.BF_PATCHCODE=262144]="BF_PATCHCODE",e[e.BF_PDF417=33554432]="BF_PDF417",e[e.BF_QR_CODE=67108864]="BF_QR_CODE",e[e.BF_DATAMATRIX=134217728]="BF_DATAMATRIX",e[e.BF_AZTEC=268435456]="BF_AZTEC",e[e.BF_MAXICODE=536870912]="BF_MAXICODE",e[e.BF_MICRO_QR=1073741824]="BF_MICRO_QR",e[e.BF_MICRO_PDF417=524288]="BF_MICRO_PDF417",e[e.BF_GS1_COMPOSITE=2147483648]="BF_GS1_COMPOSITE",e[e.BF_MSI_CODE=1048576]="BF_MSI_CODE",e[e.BF_CODE_11=2097152]="BF_CODE_11",e[e.BF_NULL=0]="BF_NULL"}(L||(L={}));const M=e=>e&&"object"==typeof e&&"function"==typeof e.then;const v="iPhone"==f.OS||"Android"==f.OS||"HarmonyOS"==f.OS?2048:4096;class w{constructor(){this._instanceID=void 0,this._ifSaveOriginalImageInACanvas=!1,this.oriCanvas=null,this.oriCanvasData=null,this.canvas=null,this.bFilterRegionInJs=!1,this._region=null,this._timeStartDecode=null,this._timeEnterInnerDBR=null,this._timeGetMessage=null,this.decodeRecords={},this.bDestroyed=!1,this._lastErrorCode=0,this._lastErrorString="",this._lastInnerDecodeDuration=0,this.intervalTime=0,this._intervalGetVideoFrame=0,this.array_getFrameTimeCost=[],this.array_decodeFrameTimeCost=[],this._indexCurrentDecodingFrame=0,this._arrPolygons=[],this._bPauseScan=!1,this._intervalDetectVideoPause=1e3,this._soundSource="data:audio/mpeg;base64,SUQzBAAAAAAAI1RTU0UAAAAPAAADTGF2ZjU4LjI5LjEwMAAAAAAAAAAAAAAA/+M4wAAAAAAAAAAAAEluZm8AAAAPAAAABQAAAkAAgICAgICAgICAgICAgICAgICAgKCgoKCgoKCgoKCgoKCgoKCgoKCgwMDAwMDAwMDAwMDAwMDAwMDAwMDg4ODg4ODg4ODg4ODg4ODg4ODg4P//////////////////////////AAAAAExhdmM1OC41NAAAAAAAAAAAAAAAACQEUQAAAAAAAAJAk0uXRQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA/+MYxAANQAbGeUEQAAHZYZ3fASqD4P5TKBgocg+Bw/8+CAYBA4XB9/4EBAEP4nB9+UOf/6gfUCAIKyjgQ/Kf//wfswAAAwQA/+MYxAYOqrbdkZGQAMA7DJLCsQxNOij///////////+tv///3RWiZGBEhsf/FO/+LoCSFs1dFVS/g8f/4Mhv0nhqAieHleLy/+MYxAYOOrbMAY2gABf/////////////////usPJ66R0wI4boY9/8jQYg//g2SPx1M0N3Z0kVJLIs///Uw4aMyvHJJYmPBYG/+MYxAgPMALBucAQAoGgaBoFQVBUFQWDv6gZBUFQVBUGgaBr5YSgqCoKhIGg7+IQVBUFQVBoGga//SsFSoKnf/iVTEFNRTMu/+MYxAYAAANIAAAAADEwMFVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVV",this.beepSound=new n({src:["data:audio/mpeg;base64,SUQzBAAAAAAAI1RTU0UAAAAPAAADTGF2ZjU4LjI5LjEwMAAAAAAAAAAAAAAA/+M4wAAAAAAAAAAAAEluZm8AAAAPAAAABQAAAkAAgICAgICAgICAgICAgICAgICAgKCgoKCgoKCgoKCgoKCgoKCgoKCgwMDAwMDAwMDAwMDAwMDAwMDAwMDg4ODg4ODg4ODg4ODg4ODg4ODg4P//////////////////////////AAAAAExhdmM1OC41NAAAAAAAAAAAAAAAACQEUQAAAAAAAAJAk0uXRQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA/+MYxAANQAbGeUEQAAHZYZ3fASqD4P5TKBgocg+Bw/8+CAYBA4XB9/4EBAEP4nB9+UOf/6gfUCAIKyjgQ/Kf//wfswAAAwQA/+MYxAYOqrbdkZGQAMA7DJLCsQxNOij///////////+tv///3RWiZGBEhsf/FO/+LoCSFs1dFVS/g8f/4Mhv0nhqAieHleLy/+MYxAYOOrbMAY2gABf/////////////////usPJ66R0wI4boY9/8jQYg//g2SPx1M0N3Z0kVJLIs///Uw4aMyvHJJYmPBYG/+MYxAgPMALBucAQAoGgaBoFQVBUFQWDv6gZBUFQVBUGgaBr5YSgqCoKhIGg7+IQVBUFQVBoGga//SsFSoKnf/iVTEFNRTMu/+MYxAYAAANIAAAAADEwMFVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVV"],onplayerror:(e,t)=>{console.warn(`Sound '${e}' playback failure: ${t}`)}}),this.bPlaySoundOnSuccessfulRead=!1,this.bVibrateOnSuccessfulRead=!1,this.vibrateDuration=300,this.captureAndDecodeInParallel=!0,this._dce=null,this._imgSource=null,this._maxCvsSideLength=v,this._tempSolutionStatus="closed"}static get version(){return this._version}static get license(){return this._license}static set license(e){((e,t)=>{const n=e;if(!n._pLoad.isEmpty)throw new Error("`license`"+E);n._license=t})(w,e)}static get productKeys(){return this._license}static set productKeys(e){w.license=e}static get handshakeCode(){return this._license}static set handshakeCode(e){w.license=e}static get organizationID(){return this._license}static set organizationID(e){w.license=e}static set sessionPassword(e){((e,t)=>{const n=e;if(!n._pLoad.isEmpty)throw new Error("`sessionPassword`"+E);n._sessionPassword=t})(w,e)}static get sessionPassword(){return this._sessionPassword}static async detectEnvironment(){return await(async()=>({wasm:g,worker:p,getUserMedia:m,camera:await R(),browser:f.browser,version:f.version,OS:f.OS}))()}static get engineResourcePath(){return this._engineResourcePath}static set engineResourcePath(e){if(!this._pLoad.isEmpty)throw new Error("`engineResourcePath` is not allowed to change after `createInstance` or `loadWasm` is called.");w._engineResourcePath=(e=>{if(null==e&&(e="./"),!c){let t=document.createElement("a");t.href=e,e=t.href}return e.endsWith("/")||(e+="/"),e})(e)}static get licenseServer(){return this._licenseServer}static set licenseServer(e){((e,t)=>{const n=e;if(!n._pLoad.isEmpty)throw new Error("`licenseServer`"+E);n._licenseServer=T(t)})(w,e)}static get deviceFriendlyName(){return this._deviceFriendlyName}static set deviceFriendlyName(e){((e,t)=>{const n=e;if(!n._pLoad.isEmpty)throw new Error("`deviceFriendlyName`"+E);n._deviceFriendlyName=t||""})(w,e)}static get _bUseFullFeature(){return this.__bUseFullFeature}static set _bUseFullFeature(e){if(!this._pLoad.isEmpty)throw new Error("`_bUseFullFeature` is not allowed to change after `createInstance` or `loadWasm` is called.");w.__bUseFullFeature=e}static isImageSource(e){return!(!e||"object"!=typeof e||Array.isArray(e))&&"getImage"in e}static isDSImage(e){return!(!e||"object"!=typeof e||Array.isArray(e))&&("data"in e&&("width"in e&&("height"in e&&"pixelFormat"in e)))}static isDCEFrame(e){return!(!e||"object"!=typeof e||Array.isArray(e))&&("data"in e&&("region"in e&&("sx"in e&&("sy"in e&&("width"in e&&("height"in e&&("colorMode"in e&&("timeSpent"in e&&("timeStamp"in e&&("isCropped"in e&&("toCanvas"in e&&("_sWidth"in e&&("_sHeight"in e&&"_bUseWebGL"in e)))))))))))))}get ifSaveOriginalImageInACanvas(){return this._ifSaveOriginalImageInACanvas}set ifSaveOriginalImageInACanvas(e){this._ifSaveOriginalImageInACanvas=e}getOriginalImageInACanvas(){return!this.oriCanvas&&this.oriCanvasData?this.oriCanvasData.toCanvas():this.oriCanvas}set region(e){this._region=e,this.array_decodeFrameTimeCost.length=0,this.array_getFrameTimeCost.length=0,this._intervalGetVideoFrame=0}get region(){return this._region}static isWasmLoaded(){return this._pLoad.isFulfilled}isContextDestroyed(){return this.bDestroyed}static get lastErrorCode(){return this._lastErrorCode}static get lastErrorString(){return this._lastErrorString}get lastErrorCode(){return this._lastErrorCode}get lastErrorString(){return this._lastErrorString}static get defaultUIElementURL(){var e;return null===(e=w._defaultUIElementURL)||void 0===e?void 0:e.replace("@engineResourcePath/",w.engineResourcePath)}static set defaultUIElementURL(e){w._defaultUIElementURL=e}static _fireHTTPSWarnning(){w.onWarning&&location&&"https:"!==location.protocol&&setTimeout((()=>{w.onWarning&&w.onWarning({id:2,message:"Not connected via SSL (HTTPS), the SDK may not work correctly."})}),0)}get soundSource(){return this._soundSource}set soundSource(e){this._soundSource=e,this.beepSound=new n({src:[this._soundSource],onplayerror:(e,t)=>{console.warn(`Sound '${e}' playback failure: ${t}`)}})}get whenToPlaySoundforSuccessfulRead(){return!0===this.bPlaySoundOnSuccessfulRead?"frame":this.bPlaySoundOnSuccessfulRead?this.bPlaySoundOnSuccessfulRead:"never"}set whenToPlaySoundforSuccessfulRead(e){this.bPlaySoundOnSuccessfulRead="never"!==e&&e}get whenToVibrateforSuccessfulRead(){return!0===this.bVibrateOnSuccessfulRead?"frame":this.bVibrateOnSuccessfulRead?this.bVibrateOnSuccessfulRead:"never"}set whenToVibrateforSuccessfulRead(e){this.bVibrateOnSuccessfulRead="never"!==e&&e}set dce(e){this._dce=e}get dce(){return!this._dce||this._dce.isDisposed?null:this._dce}set maxCvsSideLength(e){this._maxCvsSideLength=e,this._dceControler&&this._dceControler.setDisiredValue(this,"maxCvsSideLength",e)}get maxCvsSideLength(){return this._maxCvsSideLength}async _registerDCEControler(){if(!this.dce)return;w._onLog&&w._onLog("_registerDCEControler()");const e=this.dce;this._dceControler=e._createControler();const t=this._dceControler;t.register(this),t.setDisiredValue(this,"refreshInterval",200),t.setDisiredValue(this,"maxCvsSideLength",this._maxCvsSideLength),this._styleIdBeforeVerification=this.dce.createDrawingStyle({fillStyle:"rgba(248,252,0,0.2)",strokeStyle:"transparent",paintMode:"strokeAndFill"});try{ResizeObserver}catch(e){"ReferenceError"===e.name&&window&&(window.ResizeObserver=void 0)}const n=e.getUIElement(),r=this.dce.constructor;if("@engineResourcePath/dce.ui.html"===r._defaultUIElementURL)try{n?n===t._innerSetUI&&(await e.setUIElement(`${r.engineResourcePath}dce.ui.html`),t._innerSetUI=e.getUIElement()):(await e.setUIElement(`${r.engineResourcePath}dbr.ui.html`),t._innerSetUI=e.getUIElement())}catch(t){await e.setUIElement(r.defaultUIElementURL)}else n||await e.setUIElement(r.defaultUIElementURL);this.callbackCameraChange=()=>{this._drawResults(null),this.array_decodeFrameTimeCost.length=0,this.array_getFrameTimeCost.length=0,this._intervalGetVideoFrame=0},this.callbackResolutionChange=()=>{this._drawResults(null),this.array_decodeFrameTimeCost.length=0,this.array_getFrameTimeCost.length=0,this._intervalGetVideoFrame=0},this.callbackCameraClose=()=>{this.stopScanning(!0),this.array_decodeFrameTimeCost.length=0,this.array_getFrameTimeCost.length=0,this._intervalGetVideoFrame=0,this._bPauseScan=!1},this.callbackSingleFrameAcquired=async e=>{let t=await this._decode_DCEFrame(e,{bCopyData:!1}),n=null;if(t&&t.length){const{sx:r,sy:o,width:i,height:a,_sWidth:s,_sHeight:_}=e;n=t.map((e=>({localizationResult:JSON.parse(JSON.stringify(e.localizationResult))}))),w.recalculateResultLocation(n,r,o,s,_,i,a)}if(this._drawResults(n),await this.clearMapDecodeRecord(),this.onImageRead&&this.dce.isOpen()&&!this._bPauseScan){let e=this._cloneDecodeResults(t);this.onImageRead(e)}if(this.onUniqueRead&&this.dce.isOpen()&&!this._bPauseScan)for(let e of t)this.onUniqueRead(e.barcodeText,this._cloneDecodeResults(e))},e.on("cameraChange",this.callbackCameraChange),e.on("resolutionChange",this.callbackResolutionChange),e.on("cameraClose",this.callbackCameraClose),e.on("singleFrameAcquired",this.callbackSingleFrameAcquired)}_logoutDCEControler(){this.dce&&this._dceControler&&(w._onLog&&w._onLog("_logoutDCEControler()"),this._dceControler.logout(this),this.dce.off("cameraChange",this.callbackCameraChange),this.dce.off("resolutionChange",this.callbackResolutionChange),this.dce.off("cameraClose",this.callbackCameraClose),this.dce.off("singleFrameAcquired",this.callbackSingleFrameAcquired),this._dceControler=null,this.dce=null)}async setImageSource(e,t){if(null==e)return this._imgSource=null,this._logoutDCEControler(),void(this._drawingItemNamespace=null);if(e&&e.isCameraEnhancer)this.dce=e,await this._registerDCEControler(),this._imgSource=null;else{if(!w.isImageSource(e))throw new Error("Invalid value.");this._logoutDCEControler(),this._imgSource=e}t&&t.resultsHighlightBaseShapes&&(this._drawingItemNamespace=t.resultsHighlightBaseShapes)}static async loadWasm(){if(this._pLoad.isEmpty){let{lt:e,l:t,ls:n,sp:r,rmk:o}=(e=>{const t=e;if(t._pLoad.isEmpty){let e,n,r=t._license||"",o=JSON.parse(JSON.stringify(t._licenseServer)),i=t._sessionPassword,a=0;if(r.startsWith("t")||r.startsWith("f"))a=0;else if(0===r.length||r.startsWith("P")||r.startsWith("L")||r.startsWith("Y")||r.startsWith("A"))a=1;else{a=2;const t=r.indexOf(":");if(-1!=t&&(r=r.substring(t+1)),r.startsWith("DLS2")){let t=r.substring(4);try{t=atob(t)}catch(e){throw new Error("Format Error: The license string you specified is invalid, please check to make sure it is correct.")}const n=JSON.parse(t);if(r=n.handshakeCode?n.handshakeCode:n.organizationID?n.organizationID:"","number"==typeof r&&(r=JSON.stringify(r)),0===o.length){let e=[];n.mainServerURL&&(e[0]=n.mainServerURL),n.standbyServerURL&&(e[1]=n.standbyServerURL),o=T(e)}!i&&n.sessionPassword&&(i=n.sessionPassword),e=n.remark}("200001"===r||r.startsWith("200001-"))&&(o&&o.length||(r="")),r||(a=1)}if(a&&(globalThis.crypto||(n="Please upgrade your browser to support online key."),globalThis.crypto.subtle||(n="Require https to use online key in this browser.")),n){if(1!==a)throw new Error(n);a=0,console.warn(n),t._lastErrorCode=-1,t._lastErrorString=n}return 1===a&&(r="",console.warn("Applying for a public trial license ...")),{lt:a,l:r,ls:o,sp:i,rmk:e}}throw new Error("Can't preprocess license again"+E)})(w);this._pLoad.task=async(i,a)=>{let s=w.engineResourcePath+w._workerName;w.engineResourcePath.startsWith(location.origin)||(s=await fetch(s).then((e=>e.blob())).then((e=>URL.createObjectURL(e)))),w._dbrWorker=new Worker(s),w._dbrWorker.onerror=e=>{let t=new Error(e.message);a(t)},w._dbrWorker.onmessage=async t=>{let n=t.data?t.data:t;switch(n.type){case"log":w._onLog&&w._onLog(n.message);break;case"load":{n.message&&(n.message=n.message.replace("(https://www.dynamsoft.com/purchase-center/)","(https://www.dynamsoft.com/store/dynamsoft-barcode-reader/#javascript)"));let t,r=!1;1===e&&(r=!0),n.success?(w._dbrWorker.onerror=null,w._version=n.version+"(JS "+w._jsVersion+"."+w._jsEditVersion+")",w._onLog&&w._onLog("load dbr worker success"),n.message&&console.warn(n.message)):(t=new Error(n.message),t.stack=n.stack+"\n"+t.stack,r||111==n.ltsErrorCode&&-1!=n.message.toLowerCase().indexOf("trial license")&&(r=!0)),r&&w.showDialog(n.success?"warn":"error",n.message),n.success?i():a(t);break}case"task":{let e=n.id,t=n.body;try{w._taskCallbackMap.get(e)(t),w._taskCallbackMap.delete(e)}catch(t){throw w._taskCallbackMap.delete(e),t}break}default:w._onLog&&w._onLog(t)}},w._dbrWorker.postMessage({type:"loadWasm",engineResourcePath:w.engineResourcePath,bUseFullFeature:w._bUseFullFeature,bd:w._bWasmDebug,v:w._jsVersion,brtk:!!e,bptk:1===e,l:t,dm:location.origin.startsWith("http")?location.origin:"https://localhost",os:f,fn:w.deviceFriendlyName,ls:n,sp:r,rmk:o})}}await this._pLoad}static async showDialog(e,t){await(async(e,t,n)=>{if(!e._bNeverShowDialog)try{let r=await fetch(e.engineResourcePath+"dls.license.dialog.html");if(!r.ok)throw Error("Get license dialog fail. Network Error: "+r.statusText);let o=await r.text();if(!o.trim().startsWith("<"))throw Error("Get license dialog fail. Can't get valid HTMLElement.");let i=document.createElement("div");i.innerHTML=o;let a=[];for(let e=0;e<i.childElementCount;++e){let t=i.children[e];t instanceof HTMLStyleElement&&(a.push(t),document.head.append(t))}let s=1==i.childElementCount?i.children[0]:i;s.remove();let _,d,c,u,l,h=[s],A=s.children;for(let e of A)h.push(e);for(let e=0;e<h.length;++e)for(let t of h[e].children)h.push(t);for(let e of h)if(!_&&e.classList.contains("dls-license-mask"))_=e,e.addEventListener("click",(t=>{if(e==t.target){s.remove();for(let e of a)e.remove()}}));else if(!d&&e.classList.contains("dls-license-icon-close"))d=e,e.addEventListener("click",(()=>{s.remove();for(let e of a)e.remove()}));else if(!c&&e.classList.contains("dls-license-icon-error"))c=e,"error"!=t&&e.remove();else if(!u&&e.classList.contains("dls-license-icon-warn"))u=e,"warn"!=t&&e.remove();else if(!l&&e.classList.contains("dls-license-msg-content")){l=e;let t=n;for(;t;){let n=t.indexOf("["),r=t.indexOf("]",n),o=t.indexOf("(",r),i=t.indexOf(")",o);if(-1==n||-1==r||-1==o||-1==i){e.appendChild(new Text(t));break}n>0&&e.appendChild(new Text(t.substring(0,n)));let a=document.createElement("a"),s=t.substring(n+1,r);a.innerText=s;let _=t.substring(o+1,i);a.setAttribute("href",_),a.setAttribute("target","_blank"),e.appendChild(a),t=t.substring(i+1)}}document.body.appendChild(s)}catch(t){e._onLog&&e._onLog(t.message||t)}})(this,e,t)}static async createInstanceInWorker(e=!1){return await w.loadWasm(),await new Promise(((t,n)=>{let r=w._nextTaskID++;w._taskCallbackMap.set(r,(e=>{if(e.success)return t(e.instanceID);{let t=new Error(e.message);return t.stack=e.stack+"\n"+t.stack,n(t)}})),w._dbrWorker.postMessage({type:"createInstance",id:r,bScanner:e})}))}static async createInstance(){let e=new w;return e._instanceID=await w.createInstanceInWorker(),w._fireHTTPSWarnning(),e}async clearMapDecodeRecord(){return await new Promise(((e,t)=>{let n=w._nextTaskID++;w._taskCallbackMap.set(n,(n=>{if(n.success)return e();{let e=new Error(n.message);return e.stack=n.stack+"\n"+e.stack,t(e)}})),w._dbrWorker.postMessage({type:"clearMapDecodeRecord",id:n,instanceID:this._instanceID})}))}async decode(e){w._onLog&&w._onLog("decode(source: any)"),w._onLog&&(this._timeStartDecode=Date.now());{let t={};return!this.region||this.region instanceof Array||(t.region=JSON.parse(JSON.stringify(this.region))),e instanceof Blob?await this._decode_Blob(e,t):e instanceof ArrayBuffer?await this._decode_ArrayBuffer(e,t):e instanceof Uint8Array||e instanceof Uint8ClampedArray?await this._decode_Uint8Array(e,t):e instanceof HTMLImageElement||"undefined"!=typeof ImageBitmap&&e instanceof ImageBitmap?await this._decode_Image(e,t):e instanceof HTMLCanvasElement?await this._decode_Canvas(e,t):e instanceof HTMLVideoElement?await this._decode_Video(e,t):"string"==typeof e?"data:image/"==e.substring(0,11)?await this._decode_Base64(e,t):await this._decode_Url(e,t):w.isDCEFrame(e)?(t.bCopyData=!0,await this._decode_DCEFrame(e,t)):w.isDSImage(e)?(t.bCopyData=!0,await this._decode_DSImage(e,t)):await Promise.reject(TypeError("'_decode(source, config)': Type of 'source' should be 'Blob', 'ArrayBuffer', 'Uint8Array', 'HTMLImageElement', 'HTMLCanvasElement', 'HTMLVideoElement', 'String(base64 with image mime)' or 'String(url)'."))}}async decodeBase64String(e){let t={};return!this.region||this.region instanceof Array||(t.region=JSON.parse(JSON.stringify(this.region))),this._decode_Base64(e,t)}async decodeUrl(e){let t={};return!this.region||this.region instanceof Array||(t.region=JSON.parse(JSON.stringify(this.region))),this._decode_Url(e,t)}async _decodeBuffer_Uint8Array(e,t,n,r,o,i){return await new Promise(((a,s)=>{let _=w._nextTaskID++;w._taskCallbackMap.set(_,(e=>{if(e.success){let t,n=w._onLog?Date.now():0;w._onLog&&w._onLog("worker return result: "+n),this._lastInnerDecodeDuration=e.duration;try{t=this._handleRetJsonString(e.decodeReturn)}catch(e){return s(e)}if(w._onLog){let e=Date.now();w._onLog("DBR getting message from worker timestamp: "+n),w._onLog("From DBR staring decoding to entering worker costs: "+(this._timeEnterInnerDBR-this._timeStartDecode)),w._onLog("From DBR entering worker to returning message from worker costs: "+(n-this._timeEnterInnerDBR)),w._onLog("Handling results from DBR worker costs: "+(e-n)),w._onLog("Total decoding image costs: "+(e-this._timeStartDecode))}return a(t)}{let t=new Error(e.message);return t.stack=e.stack+"\n"+t.stack,s(t)}})),this._timeEnterInnerDBR=Date.now(),w._onLog&&w._onLog("Sending buffer to worker timestamp:"+this._timeEnterInnerDBR),w._dbrWorker.postMessage({type:"decodeBuffer",id:_,instanceID:this._instanceID,body:{buffer:e,width:t,height:n,stride:r,format:o,config:i}},[e.buffer]),w._onLog&&i&&i.timeStamp&&w._onLog("Delay of decoding image: "+(this._timeEnterInnerDBR-i.timeStamp))}))}async _decodeBuffer_Blob(e,t,n,r,o,i){w._onLog&&w._onLog("_decodeBuffer_Blob(buffer,width,height,stride,format)");const a=e.arrayBuffer?await e.arrayBuffer():await new Promise(((t,n)=>{let r=new FileReader;r.readAsArrayBuffer(e),r.onload=()=>{t(r.result)},r.onerror=()=>{n(r.error)}}));return await this._decodeBuffer_Uint8Array(new Uint8Array(a),t,n,r,o,i)}async decodeBuffer(e,t,n,r,o,i){let a;return w._onLog&&w._onLog("decodeBuffer(buffer,width,height,stride,format)"),w._onLog&&(this._timeStartDecode=Date.now()),e instanceof Uint8Array||e instanceof Uint8ClampedArray?a=await this._decodeBuffer_Uint8Array(e,t,n,r,o,i):e instanceof ArrayBuffer?a=await this._decodeBuffer_Uint8Array(new Uint8Array(e),t,n,r,o,i):e instanceof Blob&&(a=await this._decodeBuffer_Blob(e,t,n,r,o,i)),a}async _decodeFileInMemory_Uint8Array(e){return await new Promise(((t,n)=>{let r=w._nextTaskID++;w._taskCallbackMap.set(r,(e=>{if(e.success){let r;this._lastInnerDecodeDuration=e.duration;try{r=this._handleRetJsonString(e.decodeReturn)}catch(e){return n(e)}return t(r)}{let t=new Error(e.message);return t.stack=e.stack+"\n"+t.stack,n(t)}})),w._dbrWorker.postMessage({type:"decodeFileInMemory",id:r,instanceID:this._instanceID,body:{bytes:e}})}))}async getRuntimeSettings(){return await new Promise(((e,t)=>{let n=w._nextTaskID++;w._taskCallbackMap.set(n,(n=>{if(n.success){let t=JSON.parse(n.results);return null!=this.userDefinedRegion&&(t.region=JSON.parse(JSON.stringify(this.userDefinedRegion))),e(t)}{let e=new Error(n.message);return e.stack=n.stack+"\n"+e.stack,t(e)}})),w._dbrWorker.postMessage({type:"getRuntimeSettings",id:n,instanceID:this._instanceID})}))}async updateRuntimeSettings(e){let t;if("string"==typeof e)if("speed"==e){let e=await this.getRuntimeSettings();await this.resetRuntimeSettings(),t=await this.getRuntimeSettings(),t.barcodeFormatIds=e.barcodeFormatIds,t.barcodeFormatIds_2=e.barcodeFormatIds_2,t.region=e.region,t.deblurLevel=3,t.expectedBarcodesCount=0,t.localizationModes=[2,0,0,0,0,0,0,0]}else if("balance"==e){let e=await this.getRuntimeSettings();await this.resetRuntimeSettings(),t=await this.getRuntimeSettings(),t.barcodeFormatIds=e.barcodeFormatIds,t.barcodeFormatIds_2=e.barcodeFormatIds_2,t.region=e.region,t.deblurLevel=5,t.expectedBarcodesCount=512,t.localizationModes=[2,16,0,0,0,0,0,0]}else if("coverage"==e){let e=await this.getRuntimeSettings();await this.resetRuntimeSettings(),t=await this.getRuntimeSettings(),t.barcodeFormatIds=e.barcodeFormatIds,t.barcodeFormatIds_2=e.barcodeFormatIds_2,t.region=e.region}else if("dense"==e){let e=await this.getRuntimeSettings();await this.resetRuntimeSettings(),this.maxCvsSideLength=4096,t=await this.getRuntimeSettings(),t.barcodeFormatIds=e.barcodeFormatIds,t.barcodeFormatIds_2=e.barcodeFormatIds_2,t.region=e.region,t.deblurLevel=9,t.expectedBarcodesCount=0,t.localizationModes=[2,8,0,0,0,0,0,0]}else if("distance"==e){let e=await this.getRuntimeSettings();await this.resetRuntimeSettings(),this.maxCvsSideLength=4096,t=await this.getRuntimeSettings(),t.barcodeFormatIds=e.barcodeFormatIds,t.barcodeFormatIds_2=e.barcodeFormatIds_2,t.region=e.region,t.deblurLevel=3,t.expectedBarcodesCount=0,t.localizationModes=[2,8,0,0,0,0,0,0]}else t=JSON.parse(e);else{if("object"!=typeof e)throw TypeError("'UpdateRuntimeSettings(settings)': Type of 'settings' should be 'string' or 'PlainObject'.");if(t=JSON.parse(JSON.stringify(e)),t.region instanceof Array){let e=t.region;[e.regionLeft,e.regionTop,e.regionLeft,e.regionBottom,e.regionMeasuredByPercentage].some((e=>void 0!==e))&&(t.region={regionLeft:e.regionLeft||0,regionTop:e.regionTop||0,regionRight:e.regionRight||0,regionBottom:e.regionBottom||0,regionMeasuredByPercentage:e.regionMeasuredByPercentage||0})}}if(!w._bUseFullFeature){if(0!=(t.barcodeFormatIds&~(L.BF_ONED|L.BF_QR_CODE|L.BF_PDF417|L.BF_DATAMATRIX))||0!=t.barcodeFormatIds_2)throw Error("Some of the specified barcode formats are not supported in the compact version. Please try the full-featured version.");if(0!=t.intermediateResultTypes)throw Error("Intermediate results is not supported in the compact version. Please try the full-featured version.")}if(this.bFilterRegionInJs){let e=t.region;if(e instanceof Array)throw Error("The `region` of type `Array` is only allowed in `BarcodeScanner`.");this.userDefinedRegion=JSON.parse(JSON.stringify(e)),(e.regionLeft||e.regionTop||e.regionRight||e.regionBottom||e.regionMeasuredByPercentage)&&(e.regionLeft||e.regionTop||100!=e.regionRight||100!=e.regionBottom||!e.regionMeasuredByPercentage)?this.region=e:this.region=null,t.region={regionLeft:0,regionTop:0,regionRight:0,regionBottom:0,regionMeasuredByPercentage:0}}else this.userDefinedRegion=null,this.region=null;return await new Promise(((e,n)=>{let r=w._nextTaskID++;w._taskCallbackMap.set(r,(t=>{if(t.success){try{this._handleRetJsonString(t.updateReturn)}catch(e){n(e)}return e()}{let e=new Error(t.message);return e.stack=t.stack+"\n"+e.stack,n(e)}})),w._dbrWorker.postMessage({type:"updateRuntimeSettings",id:r,instanceID:this._instanceID,body:{settings:JSON.stringify(t)}})}))}async resetRuntimeSettings(){return this.userDefinedRegion=null,this.region=null,this.maxCvsSideLength=v,await new Promise(((e,t)=>{let n=w._nextTaskID++;w._taskCallbackMap.set(n,(n=>{if(n.success)return e();{let e=new Error(n.message);return e.stack=n.stack+"\n"+e.stack,t(e)}})),w._dbrWorker.postMessage({type:"resetRuntimeSettings",id:n,instanceID:this._instanceID})}))}async outputRuntimeSettingsToString(){if(!w._bUseFullFeature)throw Error("outputRuntimeSettingsToString() is not supported in the compact version. Please try the full-featured version.");return await new Promise(((e,t)=>{let n=w._nextTaskID++;w._taskCallbackMap.set(n,(n=>{if(n.success)return e(n.results);{let e=new Error(n.message);return e.stack=n.stack+"\n"+e.stack,t(e)}})),w._dbrWorker.postMessage({type:"outputRuntimeSettingsToString",id:n,instanceID:this._instanceID})}))}async initRuntimeSettingsWithString(e){if(!w._bUseFullFeature)throw Error("initRuntimeSettingsWithString() is not supported in the compact version. Please try the full-featured version.");if("string"==typeof e)e=e;else{if("object"!=typeof e)throw TypeError("'initRuntimeSettingstWithString(settings)': Type of 'settings' should be 'string' or 'PlainObject'.");e=JSON.stringify(e)}return await new Promise(((t,n)=>{let r=w._nextTaskID++;w._taskCallbackMap.set(r,(e=>{if(e.success){try{this._handleRetJsonString(e.initReturn)}catch(e){n(e)}return t()}{let t=new Error(e.message);return t.stack=e.stack+"\n"+t.stack,n(t)}})),w._dbrWorker.postMessage({type:"initRuntimeSettingsWithString",id:r,instanceID:this._instanceID,body:{settings:e}})}))}async _decode_Blob(e,t){w._onLog&&w._onLog("_decode_Blob(blob: Blob)");let n=null,r=null;if("undefined"!=typeof createImageBitmap)try{n=await createImageBitmap(e)}catch(e){}n||(r=await function(e){return new Promise(((t,n)=>{let r=URL.createObjectURL(e),o=new Image;o.dbrObjUrl=r,o.src=r,o.onload=()=>{t(o)},o.onerror=e=>{n(new Error("Can't convert blob to image : "+(e instanceof Event?e.type:e)))}}))}(e));let o=await this._decode_Image(n||r,t);return n&&n.close(),o}async _decode_ArrayBuffer(e,t){return await this._decode_Blob(new Blob([e]),t)}async _decode_Uint8Array(e,t){return await this._decode_Blob(new Blob([e]),t)}async _decode_Image(e,t){w._onLog&&w._onLog("_decode_Image(image: HTMLImageElement|ImageBitmap)"),t=t||{};let n,r,o=e instanceof HTMLImageElement?e.naturalWidth:e.width,i=e instanceof HTMLImageElement?e.naturalHeight:e.height,a=Math.max(o,i);if(a>this._maxCvsSideLength){let e=this._maxCvsSideLength/a;n=Math.round(o*e),r=Math.round(i*e)}else n=o,r=i;this.canvas||(this.canvas=document.createElement("canvas"));const s=this.canvas;s.width===n&&s.height===r||(s.width=n,s.height=r),s.ctx2d||(s.ctx2d=s.getContext("2d"));return s.ctx2d.drawImage(e,0,0,o,i,0,0,n,r),e.dbrObjUrl&&URL.revokeObjectURL(e.dbrObjUrl),await this._decode_Canvas(s,t)}async _decode_Canvas(e,t){if(w._onLog&&w._onLog("_decode_Canvas(canvas:HTMLCanvasElement)"),e.crossOrigin&&"anonymous"!=e.crossOrigin)throw"cors";if(0===e.width||0===e.height)throw Error("The width or height of the 'canvas' is 0.");this.ifSaveOriginalImageInACanvas&&(this.oriCanvas=e,this.oriCanvasData=null);let n=(e.ctx2d||e.getContext("2d")).getImageData(0,0,e.width,e.height).data;return await this._decodeBuffer_Uint8Array(n,e.width,e.height,4*e.width,C.IPF_ABGR_8888,t)}async _decode_Video(e,t){if(w._onLog&&w._onLog("_decode_Video(video)"),!(e instanceof HTMLVideoElement))throw TypeError("'_decode_Video(video [, config] )': Type of 'video' should be 'HTMLVideoElement'.");if(e.crossOrigin&&"anonymous"!=e.crossOrigin)throw"cors";t=t||{};let n,r,o=e.videoWidth,i=e.videoHeight,a=Math.max(o,i);if(a>this._maxCvsSideLength){let e=this._maxCvsSideLength/a;n=Math.round(o*e),r=Math.round(i*e)}else n=o,r=i;this.canvas||(this.canvas=document.createElement("canvas"));const s=this.canvas;s.width===n&&s.height===r||(s.width=n,s.height=r),s.ctx2d||(s.ctx2d=s.getContext("2d"));return s.ctx2d.drawImage(e,0,0,o,i,0,0,n,r),await this._decode_Canvas(s,t)}async _decode_DCEFrame(e,t){if(w._onLog&&w._onLog("_decode_DCEFrame(dceFrame)"),!w.isDCEFrame(e))return[];let n=[];this.ifSaveOriginalImageInACanvas&&(this.oriCanvas=null,this.oriCanvasData={width:e.width,height:e.height,colorMode:e.colorMode,data:new Uint8Array(e.data),toCanvas:e.toCanvas});const{width:r,height:o,colorMode:i,timeStamp:a}=e;let s;s=t&&t.bCopyData?new Uint8Array(e.data):e.data;let _=null;if(t?(_=JSON.parse(JSON.stringify(t)),_.timeStamp=a):_={timeStamp:a},"grey"===i)n=await this._decodeBuffer_Uint8Array(s,r,o,r,C.IPF_GrayScaled,_);else if("rgba"===i)n=await this._decodeBuffer_Uint8Array(s,r,o,4*r,C.IPF_ABGR_8888,_);else{if("bgra"!==i)throw new Error(`Color mode '${i}' is not supported to decode.`);n=await this._decodeBuffer_Uint8Array(s,r,o,4*r,C.IPF_ARGB_8888,_)}return n}async _decode_DSImage(e,t){if(w._onLog&&w._onLog("_decode_DSImage(dsImage)"),!w.isDSImage(e))return null;this.ifSaveOriginalImageInACanvas&&(this.oriCanvas=null,this.oriCanvasData={width:e.width,height:e.height,pixelFormat:e.pixelFormat.toLowerCase(),data:new Uint8Array(e.data),toCanvas:function(){const e=document.createElement("canvas");let t;switch(e.width=this.width,e.height=this.height,this.pixelFormat){case"grey":t=new Uint8ClampedArray(this.width*this.height*4);for(let e=0;e<t.length;e+=4)t[e]=this.data[e/4],t[e+1]=this.data[e/4],t[e+2]=this.data[e/4],t[e+3]=255;break;case"rgb":t=new Uint8ClampedArray(this.width*this.height*4);for(let e=0;e<t.length;e+=4)t[e]=this.data[e],t[e+1]=this.data[e+1],t[e+2]=this.data[e+2],t[e+3]=255;break;case"bgr":t=new Uint8ClampedArray(this.width*this.height*4);for(let e=0;e<t.length;e+=4)t[e]=this.data[e],t[e+1]=this.data[e+1],t[e+2]=this.data[e+2],t[e+3]=255;break;case"rgba":case"bgra":t=new Uint8ClampedArray(this.data);break;default:throw new Error("The content of 2D Canvas is currently limited to the sRGB color space.")}const n=new ImageData(t,this.width,this.height);return e.getContext("2d").putImageData(n,0,0),e}});const{width:n,height:r}=e;let o,i,a,s=e.pixelFormat.toLowerCase();switch(o=t&&t.bCopyData?new Uint8Array(e.data):e.data,s){case"grey":a=C.IPF_GrayScaled,i=n;break;case"rgb":a=C.IPF_BGR_888,i=3*n;break;case"bgr":a=C.IPF_RGB_888,i=3*n;break;case"rgba":a=C.IPF_ABGR_8888,i=4*n;break;case"bgra":a=C.IPF_ARGB_8888,i=4*n;break;default:throw new Error("The pixel format is not supported to decode.")}return await this._decodeBuffer_Uint8Array(o,n,r,i,a,t)}async _decode_Base64(e,t){if(w._onLog&&w._onLog("_decode_Base64(base64Str)"),"string"!=typeof e)return Promise.reject("'_decode_Base64(base64Str, config)': Type of 'base64Str' should be 'string'.");"data:image/"==e.substring(0,11)&&(e=e.substring(e.indexOf(",")+1));{let n=atob(e),r=n.length,o=new Uint8Array(r);for(;r--;)o[r]=n.charCodeAt(r);return await this._decode_Blob(new Blob([o]),t)}}async _decode_Url(e,t){if(w._onLog&&w._onLog("_decode_Url(url)"),"string"!=typeof e)throw TypeError("'_decode_Url(url, config)': Type of 'url' should be 'string'.");e=e;{let n=await new Promise(((t,n)=>{let r=new XMLHttpRequest;r.open("GET",e,!0),r.responseType="blob",r.send(),r.onloadend=async()=>{t(r.response)},r.onerror=()=>{n(new Error("Network Error: "+r.statusText))}}));return await this._decode_Blob(n,t)}}async _decode_FilePath(e,t){throw w._onLog&&w._onLog("_decode_FilePath(path)"),Error("'_decode_FilePath(path, config)': The method is only supported in node environment.")}static recalculateResultLocation(e,t,n,r,o,i,a){if(e.length>0)for(let s of e){let e=s.localizationResult;2==e.resultCoordinateType&&(e.x1*=.01*i,e.x2*=.01*i,e.x3*=.01*i,e.x4*=.01*i,e.y1*=.01*a,e.y2*=.01*a,e.y3*=.01*a,e.y4*=.01*a);let _=i/r,d=a/o;e.x1=e.x1/_+t,e.x2=e.x2/_+t,e.x3=e.x3/_+t,e.x4=e.x4/_+t,e.y1=e.y1/d+n,e.y2=e.y2/d+n,e.y3=e.y3/d+n,e.y4=e.y4/d+n,2==e.resultCoordinateType&&(e.x1*=100/r,e.x2*=100/r,e.x3*=100/r,e.x4*=100/r,e.y1*=100/o,e.y2*=100/o,e.y3*=100/o,e.y4*=100/o)}}static BarcodeReaderException(e,t){let n,r=y.DBR_UNKNOWN;return"number"==typeof e?(r=e,n=new Error(t)):n=new Error(e),n.code=r,n}_handleRetJsonString(e){let t=y;if(e.textResults){for(let t=0;t<e.textResults.length;t++){let n=e.textResults[t];try{let e=n.barcodeText,t="";for(let n=0;n<e.length;n++)t+=String.fromCharCode(e[n]);try{n.barcodeText=decodeURIComponent(escape(t))}catch(e){n.barcodeText=t}}catch(e){n.barcodeText=""}if(null!=n.exception){w._setWarnnedEx.has(n.exception)||(w._setWarnnedEx.add(n.exception),console.warn(n.exception));let e={};n.exception.split(";").forEach((t=>{let n=t.indexOf(":");e[t.substring(0,n)]=t.substring(n+1)})),n.exception=e}}return e.decodeRecords?this.decodeRecords=e.decodeRecords:this.decodeRecords={},this._lastErrorCode=e.exception,this._lastErrorString=e.description,e.exception&&!w._setWarnnedEx.has(e.description)&&(w._setWarnnedEx.add(e.description),console.warn(e.description)),e.textResults}if(e.exception==t.DBR_SUCCESS)return e.data;throw w.BarcodeReaderException(e.exception,e.description)}async setModeArgument(e,t,n,r){return await new Promise(((o,i)=>{let a=w._nextTaskID++;w._taskCallbackMap.set(a,(e=>{if(e.success){try{this._handleRetJsonString(e.setReturn)}catch(e){return i(e)}return o()}{let t=new Error(e.message);return t.stack=e.stack+"\n"+t.stack,i(t)}})),w._dbrWorker.postMessage({type:"setModeArgument",id:a,instanceID:this._instanceID,body:{modeName:e,index:t,argumentName:n,argumentValue:r}})}))}async getModeArgument(e,t,n){return await new Promise(((r,o)=>{let i=w._nextTaskID++;w._taskCallbackMap.set(i,(e=>{if(e.success){let t;try{t=this._handleRetJsonString(e.getReturn)}catch(e){return o(e)}return r(t)}{let t=new Error(e.message);return t.stack=e.stack+"\n"+t.stack,o(t)}})),w._dbrWorker.postMessage({type:"getModeArgument",id:i,instanceID:this._instanceID,body:{modeName:e,index:t,argumentName:n}})}))}async getIntermediateResults(){return await new Promise(((e,t)=>{let n=w._nextTaskID++;w._taskCallbackMap.set(n,(n=>{if(n.success)return e(n.results);{let e=new Error(n.message);return e.stack=n.stack+"\n"+e.stack,t(e)}})),w._dbrWorker.postMessage({type:"getIntermediateResults",id:n,instanceID:this._instanceID})}))}async getIntermediateCanvas(){let e=await this.getIntermediateResults(),t=[];for(let n of e)if(n.dataType==O.IMRDT_IMAGE)for(let e of n.results){const n=e.bytes;let r;switch(w._onLog&&w._onLog(" "+n.length+" "+n.byteLength+" "+e.width+" "+e.height+" "+e.stride+" "+e.format),e.format){case C.IPF_ABGR_8888:r=new Uint8ClampedArray(n);break;case C.IPF_RGB_888:{const e=n.length/3;r=new Uint8ClampedArray(4*e);for(let t=0;t<e;++t)r[4*t]=n[3*t+2],r[4*t+1]=n[3*t+1],r[4*t+2]=n[3*t],r[4*t+3]=255;break}case C.IPF_GrayScaled:{const e=n.length;r=new Uint8ClampedArray(4*e);for(let t=0;t<e;t++)r[4*t]=r[4*t+1]=r[4*t+2]=n[t],r[4*t+3]=255;break}case C.IPF_Binary:case C.IPF_BinaryInverted:{e.width=8*e.stride,e.height=n.length/e.stride;const t=n.length;r=new Uint8ClampedArray(8*t*4);for(let e=0;e<t;e++){let t=n[e];for(let n=0;n<8;++n)r[4*(8*e+n)]=r[4*(8*e+n)+1]=r[4*(8*e+n)+2]=(128&t)/128*255,r[4*(8*e+n)+3]=255,t<<=1}break}default:console.warn("unknow intermediate image",e)}if(!r)continue;let o=new ImageData(r,e.width,e.height),i=document.createElement("canvas");i.width=e.width,i.height=e.height,i.getContext("2d").putImageData(o,0,0),t.push(i)}return t}async keepAlive(){w._dbrWorker.postMessage({type:"keepAlive"})}async getScanSettings(){return await new Promise(((e,t)=>{let n=w._nextTaskID++;w._taskCallbackMap.set(n,(n=>{if(n.success){let t=n.results;return t.intervalTime=this.intervalTime,t.whenToPlaySoundforSuccessfulRead=this.whenToPlaySoundforSuccessfulRead,t.soundOnSuccessfullRead=this.soundSource,t.whenToVibrateforSuccessfulRead=this.whenToVibrateforSuccessfulRead,t.vibrateDuration=this.vibrateDuration,t.captureAndDecodeInParallel=this.captureAndDecodeInParallel,e(t)}{let e=new Error(n.message);return e.stack+="\n"+n.stack,t(e)}})),w._dbrWorker.postMessage({type:"getScanSettings",id:n,instanceID:this._instanceID})}))}async updateScanSettings(e){if(!e)return;const t=JSON.parse(JSON.stringify(e));return t.hasOwnProperty("intervalTime")&&(this.intervalTime=Math.max(t.intervalTime,0),delete t.intervalTime),t.hasOwnProperty("whenToPlaySoundforSuccessfulRead")&&(this.whenToPlaySoundforSuccessfulRead=t.whenToPlaySoundforSuccessfulRead,delete t.whenToPlaySoundforSuccessfulRead),t.hasOwnProperty("soundOnSuccessfullRead")&&(this.soundSource=t.soundOnSuccessfullRead,delete t.soundOnSuccessfullRead),t.hasOwnProperty("whenToVibrateforSuccessfulRead")&&(this.whenToVibrateforSuccessfulRead=t.whenToVibrateforSuccessfulRead,delete t.whenToVibrateforSuccessfulRead),t.hasOwnProperty("vibrateDuration")&&(this.vibrateDuration=t.vibrateDuration,delete t.vibrateDuration),t.hasOwnProperty("captureAndDecodeInParallel")&&(this.captureAndDecodeInParallel=t.captureAndDecodeInParallel,delete t.captureAndDecodeInParallel),await new Promise(((e,n)=>{let r=w._nextTaskID++;w._taskCallbackMap.set(r,(t=>{if(t.success)return e();{let e=new Error(t.message);return e.stack+="\n"+t.stack,n(e)}})),w._dbrWorker.postMessage({type:"updateScanSettings",id:r,instanceID:this._instanceID,body:{settings:t}})}))}_cloneDecodeResults(e){if(e instanceof Array){let t=[];for(let n of e)t.push(this._cloneDecodeResults(n));return t}{let t=e;return JSON.parse(JSON.stringify(t,((e,t)=>"oriVideoCanvas"==e||"searchRegionCanvas"==e?void 0:t)))}}async _loopReadVideo(){if(this.bDestroyed)return this.dce&&this._dceControler&&this._dceControler.setDisiredAction(this,"stopFetchingLoop"),void this._drawResults(null);if(this.dce&&!this.dce.isOpen())return this._drawResults(null),void await this.clearMapDecodeRecord();if(!this.dce&&!this._imgSource||this._bPauseScan)return w._onLog&&w._onLog("Scan is paused, or imageSource is not set. Ask in 1s."),await this.clearMapDecodeRecord(),this._loopReadVideoTimeoutId&&clearTimeout(this._loopReadVideoTimeoutId),void(this._loopReadVideoTimeoutId=setTimeout((()=>{this._loopReadVideo()}),this._intervalDetectVideoPause));w._onLog&&w._onLog("======= once read ======="),w._onLog&&(this._timeStartDecode=Date.now());let e=null,t=null;if(this.dce)e=this._getVideoFrame();else if(this._imgSource&&(t=await this._imgSource.getImage(),!w.isDSImage(t)))throw new Error("Invalid DSImage.");if(!e&&!t)return w._onLog&&w._onLog("Get invalid frame."),this._loopReadVideoTimeoutId&&clearTimeout(this._loopReadVideoTimeoutId),void(this._loopReadVideoTimeoutId=setTimeout((()=>{this._loopReadVideo()}),0));(async()=>{let n=[];if(e){n=await this._decode_DCEFrame(e,{bScanner:!0,bCopyData:!1});let t=null;if(n&&n.length){const{sx:r,sy:o,width:i,height:a,_sWidth:s,_sHeight:_}=e;t=n.map((e=>({resultState:e.resultState,localizationResult:JSON.parse(JSON.stringify(e.localizationResult))}))),w.recalculateResultLocation(t,r,o,s,_,i,a)}this._drawResults(t)}else t&&(n=await this._decode_DSImage(t,{bScanner:!0,bCopyData:!1}));return n})().then((e=>{if(w._onLog&&w._onLog(e),this.dce&&this.captureAndDecodeInParallel){let e=this.array_decodeFrameTimeCost,t=this.array_getFrameTimeCost;const n=()=>{let n=0;if(t&&t.length){let r=Math.min(...e),o=Math.max(...t);r&&o&&(n=r-o)}else n=0;return n>0?n:0};(()=>{for(;e.length>=5;)e.shift();e.push(this._lastInnerDecodeDuration)})(),this._intervalGetVideoFrame=n()+this.intervalTime}if((this.dce&&this.dce.isOpen()||this._imgSource)&&!this._bPauseScan){if(this.bPlaySoundOnSuccessfulRead&&e.length){let t=!1;!0===this.bPlaySoundOnSuccessfulRead||"frame"===this.bPlaySoundOnSuccessfulRead?t=!0:"unique"===this.bPlaySoundOnSuccessfulRead&&(t=e.some((e=>0===e.resultState))),t&&(this.beepSound.stop(),this.beepSound.play())}if(navigator.vibrate&&this.bVibrateOnSuccessfulRead&&e.length){let t=!1;if(!0===this.bVibrateOnSuccessfulRead||"frame"===this.bVibrateOnSuccessfulRead?t=!0:"unique"===this.bVibrateOnSuccessfulRead&&(t=e.some((e=>0===e.resultState))),t)try{navigator.vibrate(this.vibrateDuration)}catch(e){console.warn("Vibration not allowed. User interaction required: "+(e.message||e))}}if(this.onImageRead){e=e.filter((e=>e.resultState>=0));const t=this._cloneDecodeResults(e);this.onImageRead(t)}if(this.onUniqueRead){e=e.filter((e=>0==e.resultState));const t=this._cloneDecodeResults(e);for(let e of t)this.onUniqueRead(e.barcodeText,e)}}this._loopReadVideoTimeoutId&&clearTimeout(this._loopReadVideoTimeoutId),this.intervalTime?this._loopReadVideoTimeoutId=setTimeout((()=>{this._loopReadVideo()}),this.intervalTime):this._loopReadVideo()})).catch((e=>{this.dce&&this._dceControler&&this._dceControler.setDisiredAction(this,"stopFetchingLoop"),w._onLog&&w._onLog(e.message||e),this._loopReadVideoTimeoutId&&clearTimeout(this._loopReadVideoTimeoutId),this._loopReadVideoTimeoutId=setTimeout((()=>{this.dce&&(this.dce.startFetchingLoop(),this._dceControler&&this._dceControler.clearUserDisiredAction({user:this,actionName:"stopFetchingLoop"})),this._loopReadVideo()}),Math.max(this.intervalTime,1e3)),"platform error"==e.message||console.warn(e.message)}))}_getVideoFrame(){if(!this.dce)return null;let e;if(this.captureAndDecodeInParallel){if(w._onLog&&w._onLog("Get frame in parallel."),this._dceControler&&this._dceControler.setDisiredValue(this,"loopInterval",this._intervalGetVideoFrame),!this.dce.numberOfFramesInBuffer)return this._dceControler&&this._dceControler.setDisiredValue(this,"loopInterval",0),null;e=this.dce.getFrameFromBuffer();const t=e=>{if(!e)return;let t=e.timeSpent,n=this.array_getFrameTimeCost;for(;n.length>=5;)n.shift();n.push(t)};t(e)}else w._onLog&&w._onLog("Get frame in serial."),this._dceControler&&this._dceControler.setDisiredAction(this,"stopFetchingLoop"),e=this.dce.getFrame();return e}_drawResults(e){if(!this.dce||this._bPauseScan||!this._drawingItemNamespace||!this._drawingItemNamespace.DT_Polygon)return;if(!this._dbrDrawingLayer){if(!this.dce.isOpen())return;this._dbrDrawingLayer=this.dce.getDrawingLayer(3)}const t=this._dbrDrawingLayer;e||(e=[]);let n=this._arrPolygons;for(let r=0;r<e.length;r++){let o,i=e[r].localizationResult;n[r]?(o=n[r],t.hasDrawingItem(o)||t.addDrawingItem(o),o.set("vertices",[{x:i.x1,y:i.y1},{x:i.x2,y:i.y2},{x:i.x3,y:i.y3},{x:i.x4,y:i.y4}])):(o=new this._drawingItemNamespace.DT_Polygon([{x:i.x1,y:i.y1},{x:i.x2,y:i.y2},{x:i.x3,y:i.y3},{x:i.x4,y:i.y4}]),t.addDrawingItem(o),n[r]=o),-1===e[r].resultState?(o.styleId=this._styleIdBeforeVerification,o._mapStyle.set("default",this.dce.getDrawingStyle(this._styleIdBeforeVerification)),o._mapStyle.set("selected",this.dce.getDrawingStyle(this._styleIdBeforeVerification))):(o.styleId=null,o._mapStyle.set("default",this.dce.getDrawingStyle(3)),o._mapStyle.set("selected",this.dce.getDrawingStyle(7))),o.tag=e[r]}for(let r=e.length;r<n.length;r++)t.removeDrawingItem(n[r]);t.renderAll()}async startScanning(e){if(!this.dce&&!this._imgSource)throw new Error("'imageSource' is not set. call 'setImageSource()' before 'startScanning()'.");if("closed"!=this._tempSolutionStatus)return;if(this._tempSolutionStatus="opening","opening"!=this._tempSolutionStatus)return;let t=null;return this.dce&&(this.dce.isOpen()?(e&&this.dce.appendAndShowUI(),t=JSON.parse(JSON.stringify(this.dce.playCallbackInfo))):t=await this.dce.open(e),this._dceControler&&(this._dceControler.clearUserDisiredAction({user:this,actionName:"close"}),this._dceControler.clearUserDisiredValue({property:"ifShowScanRegionLaser"}),this._dceControler.setDisiredValue(this,"ifShowScanRegionLaser",!0),this.dce.ifShowScanRegionLaser&&this.dce.showScanRegionLaser())),"opening"==this._tempSolutionStatus?(this._bPauseScan=!1,this.dce&&this.dce.singleFrameMode||(this._loopReadVideoTimeoutId&&clearTimeout(this._loopReadVideoTimeoutId),this._loopReadVideoTimeoutId=setTimeout((()=>{this.dce&&(this.dce.startFetchingLoop(),this._dceControler&&this._dceControler.clearUserDisiredAction({user:this,actionName:"stopFetchingLoop"})),this._loopReadVideo()}),0)),this._tempSolutionStatus="opened",this.keepAlive(),t):void 0}stopScanning(e){this.dce&&(this._drawResults(null),this._dceControler&&(this._dceControler.setDisiredValue(this,"ifShowScanRegionLaser",!1),this.dce.ifShowScanRegionLaser||this.dce.hideScanRegionLaser(),this._dceControler.setDisiredAction(this,"close",[e]))),this._bPauseScan=!0,this._loopReadVideoTimeoutId&&clearTimeout(this._loopReadVideoTimeoutId),this.array_decodeFrameTimeCost.length=0,this.array_getFrameTimeCost.length=0,this._intervalGetVideoFrame=0,this._tempSolutionStatus="closed"}pauseScanning(e){if(e&&e.keepResultsHighlighted||this._drawResults(null),this._bPauseScan=!0,this.dce){if(this.dce.singleFrameMode)throw new Error("'pauseScanning()' is unavailable when property 'singleFrameMode' of the 'CameraEnhancer' instance is true.");this._dceControler&&(this._dceControler.setDisiredValue(this,"ifShowScanRegionLaser",!1),this.dce.ifShowScanRegionLaser||this.dce.hideScanRegionLaser(),this._dceControler.setDisiredAction(this,"stopFetchingLoop"))}}resumeScanning(){if(this._bPauseScan=!1,this.dce){if(this.dce.singleFrameMode)throw new Error("'resumeScanning()' is unavailable when property 'singleFrameMode' of the 'CameraEnhancer' instance is true.");this.dce.startFetchingLoop(),this._dceControler&&(this._dceControler.clearUserDisiredAction({user:this,actionName:"stopFetchingLoop"}),this._dceControler.clearUserDisiredValue({property:"ifShowScanRegionLaser"}),this._dceControler.setDisiredValue(this,"ifShowScanRegionLaser",!0),this.dce.ifShowScanRegionLaser&&this.dce.showScanRegionLaser())}}destroyContext(){if(w._onLog&&w._onLog("destroyContext()"),this.bDestroyed)return;this.bDestroyed=!0,(this.dce||"opening"===this._tempSolutionStatus)&&this.stopScanning(),this.setImageSource(null);let e=w._nextTaskID++;w._taskCallbackMap.set(e,(e=>{if(!e.success){let t=new Error(e.message);throw t.stack=e.stack+"\n"+t.stack,t}})),w._dbrWorker.postMessage({type:"destroyContext",id:e,instanceID:this._instanceID})}}var b,N,B,P,F,V,x,k,U,G,H,K,W,Y,Q,J,X,Z,j,q,$,z,ee,te,ne,re,oe;w._jsVersion="9.4.0",w._jsEditVersion="20220930",w._version=`loading...(JS ${w._jsVersion}.${w._jsEditVersion})`,w._license=S,w._sessionPassword=D,w.browserInfo=f,w._workerName=`dbr-${w._jsVersion}.browser.worker.js`,w._engineResourcePath=I,w._licenseServer=[],w._deviceFriendlyName="",w._isShowRelDecodeTimeInResults=!1,w._bWasmDebug=!1,w._bNeverShowDialog=!1,w.__bUseFullFeature=!0,w._nextTaskID=0,w._taskCallbackMap=new Map,w._pLoad=new class extends Promise{constructor(e){let t,n;super(((e,r)=>{t=e,n=r})),this._s="pending",this.resolve=e=>{this.isPending&&(M(e)?this.task=e:(this._s="fulfilled",t(e)))},this.reject=e=>{this.isPending&&(this._s="rejected",n(e))},this.task=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(e){let t;this._task=e,M(e)?t=e:"function"==typeof e&&(t=new Promise(e)),t&&(async()=>{try{const n=await t;e===this._task&&this.resolve(n)}catch(t){e===this._task&&this.reject(t)}})()}get isEmpty(){return null==this._task}},w._lastErrorCode=0,w._lastErrorString="",w._setWarnnedEx=new Set,w._defaultUIElementURL="@engineResourcePath/dbr.ui.html",function(e){e[e.BICM_DARK_ON_LIGHT=1]="BICM_DARK_ON_LIGHT",e[e.BICM_LIGHT_ON_DARK=2]="BICM_LIGHT_ON_DARK",e[e.BICM_DARK_ON_DARK=4]="BICM_DARK_ON_DARK",e[e.BICM_LIGHT_ON_LIGHT=8]="BICM_LIGHT_ON_LIGHT",e[e.BICM_DARK_LIGHT_MIXED=16]="BICM_DARK_LIGHT_MIXED",e[e.BICM_DARK_ON_LIGHT_DARK_SURROUNDING=32]="BICM_DARK_ON_LIGHT_DARK_SURROUNDING",e[e.BICM_SKIP=0]="BICM_SKIP",e[e.BICM_REV=2147483648]="BICM_REV"}(b||(b={})),function(e){e[e.BCM_AUTO=1]="BCM_AUTO",e[e.BCM_GENERAL=2]="BCM_GENERAL",e[e.BCM_SKIP=0]="BCM_SKIP",e[e.BCM_REV=2147483648]="BCM_REV"}(N||(N={})),function(e){e[e.BF2_NULL=0]="BF2_NULL",e[e.BF2_POSTALCODE=32505856]="BF2_POSTALCODE",e[e.BF2_NONSTANDARD_BARCODE=1]="BF2_NONSTANDARD_BARCODE",e[e.BF2_USPSINTELLIGENTMAIL=1048576]="BF2_USPSINTELLIGENTMAIL",e[e.BF2_POSTNET=2097152]="BF2_POSTNET",e[e.BF2_PLANET=4194304]="BF2_PLANET",e[e.BF2_AUSTRALIANPOST=8388608]="BF2_AUSTRALIANPOST",e[e.BF2_RM4SCC=16777216]="BF2_RM4SCC",e[e.BF2_DOTCODE=2]="BF2_DOTCODE",e[e.BF2_PHARMACODE_ONE_TRACK=4]="BF2_PHARMACODE_ONE_TRACK",e[e.BF2_PHARMACODE_TWO_TRACK=8]="BF2_PHARMACODE_TWO_TRACK",e[e.BF2_PHARMACODE=12]="BF2_PHARMACODE"}(B||(B={})),function(e){e[e.BM_AUTO=1]="BM_AUTO",e[e.BM_LOCAL_BLOCK=2]="BM_LOCAL_BLOCK",e[e.BM_SKIP=0]="BM_SKIP",e[e.BM_THRESHOLD=4]="BM_THRESHOLD",e[e.BM_REV=2147483648]="BM_REV"}(P||(P={})),function(e){e[e.ECCM_CONTRAST=1]="ECCM_CONTRAST"}(F||(F={})),function(e){e[e.CFM_GENERAL=1]="CFM_GENERAL"}(V||(V={})),function(e){e[e.CCM_AUTO=1]="CCM_AUTO",e[e.CCM_GENERAL_HSV=2]="CCM_GENERAL_HSV",e[e.CCM_SKIP=0]="CCM_SKIP",e[e.CCM_REV=2147483648]="CCM_REV"}(x||(x={})),function(e){e[e.CICM_GENERAL=1]="CICM_GENERAL",e[e.CICM_SKIP=0]="CICM_SKIP",e[e.CICM_REV=2147483648]="CICM_REV"}(k||(k={})),function(e){e[e.CM_IGNORE=1]="CM_IGNORE",e[e.CM_OVERWRITE=2]="CM_OVERWRITE"}(U||(U={})),function(e){e[e.DM_SKIP=0]="DM_SKIP",e[e.DM_DIRECT_BINARIZATION=1]="DM_DIRECT_BINARIZATION",e[e.DM_THRESHOLD_BINARIZATION=2]="DM_THRESHOLD_BINARIZATION",e[e.DM_GRAY_EQUALIZATION=4]="DM_GRAY_EQUALIZATION",e[e.DM_SMOOTHING=8]="DM_SMOOTHING",e[e.DM_MORPHING=16]="DM_MORPHING",e[e.DM_DEEP_ANALYSIS=32]="DM_DEEP_ANALYSIS",e[e.DM_SHARPENING=64]="DM_SHARPENING",e[e.DM_BASED_ON_LOC_BIN=128]="DM_BASED_ON_LOC_BIN",e[e.DM_SHARPENING_SMOOTHING=256]="DM_SHARPENING_SMOOTHING"}(G||(G={})),function(e){e[e.DRM_AUTO=1]="DRM_AUTO",e[e.DRM_GENERAL=2]="DRM_GENERAL",e[e.DRM_BROAD_WARP=4]="DRM_BROAD_WARP",e[e.DRM_LOCAL_REFERENCE=8]="DRM_LOCAL_REFERENCE",e[e.DRM_DEWRINKLE=16]="DRM_DEWRINKLE",e[e.DRM_SKIP=0]="DRM_SKIP",e[e.DRM_REV=2147483648]="DRM_REV"}(H||(H={})),function(e){e[e.DPMCRM_AUTO=1]="DPMCRM_AUTO",e[e.DPMCRM_GENERAL=2]="DPMCRM_GENERAL",e[e.DPMCRM_SKIP=0]="DPMCRM_SKIP",e[e.DPMCRM_REV=2147483648]="DPMCRM_REV"}(K||(K={})),function(e){e[e.GTM_INVERTED=1]="GTM_INVERTED",e[e.GTM_ORIGINAL=2]="GTM_ORIGINAL",e[e.GTM_SKIP=0]="GTM_SKIP",e[e.GTM_REV=2147483648]="GTM_REV"}(W||(W={})),function(e){e[e.IPM_AUTO=1]="IPM_AUTO",e[e.IPM_GENERAL=2]="IPM_GENERAL",e[e.IPM_GRAY_EQUALIZE=4]="IPM_GRAY_EQUALIZE",e[e.IPM_GRAY_SMOOTH=8]="IPM_GRAY_SMOOTH",e[e.IPM_SHARPEN_SMOOTH=16]="IPM_SHARPEN_SMOOTH",e[e.IPM_MORPHOLOGY=32]="IPM_MORPHOLOGY",e[e.IPM_SKIP=0]="IPM_SKIP",e[e.IPM_REV=2147483648]="IPM_REV"}(Y||(Y={})),function(e){e[e.IRSM_MEMORY=1]="IRSM_MEMORY",e[e.IRSM_FILESYSTEM=2]="IRSM_FILESYSTEM",e[e.IRSM_BOTH=4]="IRSM_BOTH"}(Q||(Q={})),function(e){e[e.IRT_NO_RESULT=0]="IRT_NO_RESULT",e[e.IRT_ORIGINAL_IMAGE=1]="IRT_ORIGINAL_IMAGE",e[e.IRT_COLOUR_CLUSTERED_IMAGE=2]="IRT_COLOUR_CLUSTERED_IMAGE",e[e.IRT_COLOUR_CONVERTED_GRAYSCALE_IMAGE=4]="IRT_COLOUR_CONVERTED_GRAYSCALE_IMAGE",e[e.IRT_TRANSFORMED_GRAYSCALE_IMAGE=8]="IRT_TRANSFORMED_GRAYSCALE_IMAGE",e[e.IRT_PREDETECTED_REGION=16]="IRT_PREDETECTED_REGION",e[e.IRT_PREPROCESSED_IMAGE=32]="IRT_PREPROCESSED_IMAGE",e[e.IRT_BINARIZED_IMAGE=64]="IRT_BINARIZED_IMAGE",e[e.IRT_TEXT_ZONE=128]="IRT_TEXT_ZONE",e[e.IRT_CONTOUR=256]="IRT_CONTOUR",e[e.IRT_LINE_SEGMENT=512]="IRT_LINE_SEGMENT",e[e.IRT_FORM=1024]="IRT_FORM",e[e.IRT_SEGMENTATION_BLOCK=2048]="IRT_SEGMENTATION_BLOCK",e[e.IRT_TYPED_BARCODE_ZONE=4096]="IRT_TYPED_BARCODE_ZONE",e[e.IRT_PREDETECTED_QUADRILATERAL=8192]="IRT_PREDETECTED_QUADRILATERAL"}(J||(J={})),function(e){e[e.LM_SKIP=0]="LM_SKIP",e[e.LM_AUTO=1]="LM_AUTO",e[e.LM_CONNECTED_BLOCKS=2]="LM_CONNECTED_BLOCKS",e[e.LM_LINES=8]="LM_LINES",e[e.LM_STATISTICS=4]="LM_STATISTICS",e[e.LM_SCAN_DIRECTLY=16]="LM_SCAN_DIRECTLY",e[e.LM_STATISTICS_MARKS=32]="LM_STATISTICS_MARKS",e[e.LM_STATISTICS_POSTAL_CODE=64]="LM_STATISTICS_POSTAL_CODE",e[e.LM_CENTRE=128]="LM_CENTRE",e[e.LM_ONED_FAST_SCAN=256]="LM_ONED_FAST_SCAN",e[e.LM_REV=2147483648]="LM_REV"}(X||(X={})),function(e){e[e.PDFRM_RASTER=1]="PDFRM_RASTER",e[e.PDFRM_AUTO=2]="PDFRM_AUTO",e[e.PDFRM_VECTOR=4]="PDFRM_VECTOR",e[e.PDFRM_REV=2147483648]="PDFRM_REV"}(Z||(Z={})),function(e){e[e.QRECL_ERROR_CORRECTION_H=0]="QRECL_ERROR_CORRECTION_H",e[e.QRECL_ERROR_CORRECTION_L=1]="QRECL_ERROR_CORRECTION_L",e[e.QRECL_ERROR_CORRECTION_M=2]="QRECL_ERROR_CORRECTION_M",e[e.QRECL_ERROR_CORRECTION_Q=3]="QRECL_ERROR_CORRECTION_Q"}(j||(j={})),function(e){e[e.RPM_AUTO=1]="RPM_AUTO",e[e.RPM_GENERAL=2]="RPM_GENERAL",e[e.RPM_GENERAL_RGB_CONTRAST=4]="RPM_GENERAL_RGB_CONTRAST",e[e.RPM_GENERAL_GRAY_CONTRAST=8]="RPM_GENERAL_GRAY_CONTRAST",e[e.RPM_GENERAL_HSV_CONTRAST=16]="RPM_GENERAL_HSV_CONTRAST",e[e.RPM_SKIP=0]="RPM_SKIP",e[e.RPM_REV=2147483648]="RPM_REV"}(q||(q={})),function(e){e[e.RCT_PIXEL=1]="RCT_PIXEL",e[e.RCT_PERCENTAGE=2]="RCT_PERCENTAGE"}($||($={})),function(e){e[e.RT_STANDARD_TEXT=0]="RT_STANDARD_TEXT",e[e.RT_RAW_TEXT=1]="RT_RAW_TEXT",e[e.RT_CANDIDATE_TEXT=2]="RT_CANDIDATE_TEXT",e[e.RT_PARTIAL_TEXT=3]="RT_PARTIAL_TEXT"}(z||(z={})),function(e){e[e.SUM_AUTO=1]="SUM_AUTO",e[e.SUM_LINEAR_INTERPOLATION=2]="SUM_LINEAR_INTERPOLATION",e[e.SUM_NEAREST_NEIGHBOUR_INTERPOLATION=4]="SUM_NEAREST_NEIGHBOUR_INTERPOLATION",e[e.SUM_SKIP=0]="SUM_SKIP",e[e.SUM_REV=2147483648]="SUM_REV"}(ee||(ee={})),function(e){e[e.TP_REGION_PREDETECTED=1]="TP_REGION_PREDETECTED",e[e.TP_IMAGE_PREPROCESSED=2]="TP_IMAGE_PREPROCESSED",e[e.TP_IMAGE_BINARIZED=4]="TP_IMAGE_BINARIZED",e[e.TP_BARCODE_LOCALIZED=8]="TP_BARCODE_LOCALIZED",e[e.TP_BARCODE_TYPE_DETERMINED=16]="TP_BARCODE_TYPE_DETERMINED",e[e.TP_BARCODE_RECOGNIZED=32]="TP_BARCODE_RECOGNIZED"}(te||(te={})),function(e){e[e.TFM_AUTO=1]="TFM_AUTO",e[e.TFM_GENERAL_CONTOUR=2]="TFM_GENERAL_CONTOUR",e[e.TFM_SKIP=0]="TFM_SKIP",e[e.TFM_REV=2147483648]="TFM_REV"}(ne||(ne={})),function(e){e[e.TROM_CONFIDENCE=1]="TROM_CONFIDENCE",e[e.TROM_POSITION=2]="TROM_POSITION",e[e.TROM_FORMAT=4]="TROM_FORMAT",e[e.TROM_SKIP=0]="TROM_SKIP",e[e.TROM_REV=2147483648]="TROM_REV"}(re||(re={})),function(e){e[e.TDM_AUTO=1]="TDM_AUTO",e[e.TDM_GENERAL_WIDTH_CONCENTRATION=2]="TDM_GENERAL_WIDTH_CONCENTRATION",e[e.TDM_SKIP=0]="TDM_SKIP",e[e.TDM_REV=2147483648]="TDM_REV"}(oe||(oe={}));export{w as BarcodeReader,b as EnumBarcodeColourMode,N as EnumBarcodeComplementMode,L as EnumBarcodeFormat,B as EnumBarcodeFormat_2,P as EnumBinarizationMode,F as EnumClarityCalculationMethod,V as EnumClarityFilterMode,x as EnumColourClusteringMode,k as EnumColourConversionMode,U as EnumConflictMode,K as EnumDPMCodeReadingMode,G as EnumDeblurMode,H as EnumDeformationResistingMode,y as EnumErrorCode,W as EnumGrayscaleTransformationMode,O as EnumIMResultDataType,C as EnumImagePixelFormat,Y as EnumImagePreprocessingMode,Q as EnumIntermediateResultSavingMode,J as EnumIntermediateResultType,X as EnumLocalizationMode,Z as EnumPDFReadingMode,j as EnumQRCodeErrorCorrectionLevel,q as EnumRegionPredetectionMode,$ as EnumResultCoordinateType,z as EnumResultType,ee as EnumScaleUpMode,te as EnumTerminatePhase,ne as EnumTextFilterMode,re as EnumTextResultOrderMode,oe as EnumTextureDetectionMode};
