dwt 17.3.4 → 18.0.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE.txt +2 -2
- package/README.md +26 -33
- package/dist/addon/dbrjs/dbr-9.2.13.browser.worker.js +11 -0
- package/dist/addon/dbrjs/dbr-9.2.13.full.wasm +0 -0
- package/dist/addon/dbrjs/{dbr-8.8.7.full.wasm.js → dbr-9.2.13.full.wasm.js} +285 -285
- package/dist/addon/dbrjs/dbr.js +21 -22
- package/dist/addon/dynamsoft.webtwain.addon.camera.css +7 -7
- package/dist/dist/DynamsoftServiceSetup-arm64.deb +0 -0
- package/dist/dist/DynamsoftServiceSetup.deb +0 -0
- package/dist/dist/DynamsoftServiceSetup.msi +0 -0
- package/dist/dist/DynamsoftServiceSetup.pkg +0 -0
- package/dist/dist/DynamsoftServiceSetup.rpm +0 -0
- package/dist/dynamsoft.webtwain.min.js +327 -191
- package/dist/dynamsoft.webtwain.min.mjs +330 -195
- package/dist/src/{dynamsoft.imagecore-1.7.3.wasm → dynamsoft.imagecore-1.8.0.wasm} +0 -0
- package/dist/src/{dynamsoft.imageio-1.7.3.wasm → dynamsoft.imageio-1.8.0.wasm} +0 -0
- package/dist/src/{dynamsoft.imageio_wasm-1.7.3.js → dynamsoft.imageio_wasm-1.8.0.js} +34 -34
- package/dist/src/dynamsoft.lts.js +12 -34
- package/dist/src/{dynamsoft.pdfReader-1.7.3.wasm → dynamsoft.pdfReader-1.8.0.wasm} +0 -0
- package/dist/src/{dynamsoft.pdfReader_wasm-1.7.3.js → dynamsoft.pdfReader_wasm-1.8.0.js} +34 -34
- package/dist/src/dynamsoft.viewer.css +2 -2
- package/dist/src/dynamsoft.viewer.js +1 -1
- package/dist/src/dynamsoft.webtwain.css +43 -21
- package/dist/src/fastcomp/{dynamsoft.imagecore-1.7.3.wasm → dynamsoft.imagecore-1.8.0.wasm} +0 -0
- package/dist/src/fastcomp/{dynamsoft.imageio-1.7.3.wasm → dynamsoft.imageio-1.8.0.wasm} +0 -0
- package/dist/src/fastcomp/{dynamsoft.imageio_wasm-1.7.3.js → dynamsoft.imageio_wasm-1.8.0.js} +34 -34
- package/dist/types/Addon.Camera.d.ts +22 -4
- package/dist/types/Dynamsoft.Enum.d.ts +14 -0
- package/dist/types/Dynamsoft.d.ts +81 -2
- package/dist/types/WebTwain.Acquire.d.ts +37 -3
- package/dist/types/WebTwain.Viewer.d.ts +21 -17
- package/dist/types/index.d.ts +1 -1
- package/package.json +2 -2
- package/dist/addon/dbrjs/dbr-8.8.7.full.wasm +0 -0
- package/dist/addon/dbrjs/dbr-8.8.7.worker.js +0 -113
- package/dist/dist/DynamsoftServiceSetup-mips64el.deb +0 -0
- package/samples/AcquireImage.html +0 -69
- package/samples/CustomScan.html +0 -98
- package/samples/Dynamic Web TWAIN Online Demo.html +0 -8
- package/samples/Dynamic Web TWAIN Sample Code Gallery.html +0 -8
- package/samples/Edit.html +0 -111
- package/samples/LoadAndSaveImages.html +0 -103
- package/samples/Navigation.html +0 -197
- package/samples/PDFRasterizer.html +0 -88
- package/samples/ReadBarcode.html +0 -231
- package/samples/ScanOrCapture.html +0 -202
- package/samples/Thumbnail.html +0 -88
- package/samples/mobilebrowsercapture.html +0 -13
- /package/dist/src/{dynamsoft.crypto-1.7.3.wasm → dynamsoft.crypto-1.8.0.wasm} +0 -0
- /package/dist/src/{dynamsoft.imageProc-1.7.3.wasm → dynamsoft.imageProc-1.8.0.wasm} +0 -0
- /package/dist/src/{dynamsoft.imageProc-sn-1.7.3.wasm → dynamsoft.imageProc-sn-1.8.0.wasm} +0 -0
- /package/dist/src/{dynamsoft.pdfWriter-1.7.3.wasm → dynamsoft.pdfWriter-1.8.0.wasm} +0 -0
- /package/dist/src/fastcomp/{dynamsoft.crypto-1.7.3.wasm → dynamsoft.crypto-1.8.0.wasm} +0 -0
- /package/dist/src/fastcomp/{dynamsoft.imageProc-1.7.3.wasm → dynamsoft.imageProc-1.8.0.wasm} +0 -0
- /package/dist/src/fastcomp/{dynamsoft.pdfWriter-1.7.3.wasm → dynamsoft.pdfWriter-1.8.0.wasm} +0 -0
|
@@ -1,113 +0,0 @@
|
|
|
1
|
-
'use strict';var $jscomp=$jscomp||{};$jscomp.scope={};$jscomp.arrayIteratorImpl=function(a){var b=0;return function(){return b<a.length?{done:!1,value:a[b++]}:{done:!0}}};$jscomp.arrayIterator=function(a){return{next:$jscomp.arrayIteratorImpl(a)}};$jscomp.makeIterator=function(a){var b="undefined"!=typeof Symbol&&Symbol.iterator&&a[Symbol.iterator];return b?b.call(a):$jscomp.arrayIterator(a)};
|
|
2
|
-
$jscomp.getGlobal=function(a){return"undefined"!=typeof window&&window===a?a:"undefined"!=typeof global&&null!=global?global:a};$jscomp.global=$jscomp.getGlobal(this);$jscomp.ASSUME_ES5=!1;$jscomp.ASSUME_NO_NATIVE_MAP=!1;$jscomp.ASSUME_NO_NATIVE_SET=!1;$jscomp.SIMPLE_FROUND_POLYFILL=!1;$jscomp.defineProperty=$jscomp.ASSUME_ES5||"function"==typeof Object.defineProperties?Object.defineProperty:function(a,b,f){a!=Array.prototype&&a!=Object.prototype&&(a[b]=f.value)};
|
|
3
|
-
$jscomp.polyfill=function(a,b,f,v){if(b){f=$jscomp.global;a=a.split(".");for(v=0;v<a.length-1;v++){var A=a[v];A in f||(f[A]={});f=f[A]}a=a[a.length-1];v=f[a];b=b(v);b!=v&&null!=b&&$jscomp.defineProperty(f,a,{configurable:!0,writable:!0,value:b})}};$jscomp.FORCE_POLYFILL_PROMISE=!1;$jscomp.SYMBOL_PREFIX="jscomp_symbol_";$jscomp.initSymbol=function(){$jscomp.initSymbol=function(){};$jscomp.global.Symbol||($jscomp.global.Symbol=$jscomp.Symbol)};
|
|
4
|
-
$jscomp.SymbolClass=function(a,b){this.$jscomp$symbol$id_=a;$jscomp.defineProperty(this,"description",{configurable:!0,writable:!0,value:b})};$jscomp.SymbolClass.prototype.toString=function(){return this.$jscomp$symbol$id_};$jscomp.Symbol=function(){function a(f){if(this instanceof a)throw new TypeError("Symbol is not a constructor");return new $jscomp.SymbolClass($jscomp.SYMBOL_PREFIX+(f||"")+"_"+b++,f)}var b=0;return a}();
|
|
5
|
-
$jscomp.initSymbolIterator=function(){$jscomp.initSymbol();var a=$jscomp.global.Symbol.iterator;a||(a=$jscomp.global.Symbol.iterator=$jscomp.global.Symbol("Symbol.iterator"));"function"!=typeof Array.prototype[a]&&$jscomp.defineProperty(Array.prototype,a,{configurable:!0,writable:!0,value:function(){return $jscomp.iteratorPrototype($jscomp.arrayIteratorImpl(this))}});$jscomp.initSymbolIterator=function(){}};
|
|
6
|
-
$jscomp.initSymbolAsyncIterator=function(){$jscomp.initSymbol();var a=$jscomp.global.Symbol.asyncIterator;a||(a=$jscomp.global.Symbol.asyncIterator=$jscomp.global.Symbol("Symbol.asyncIterator"));$jscomp.initSymbolAsyncIterator=function(){}};$jscomp.iteratorPrototype=function(a){$jscomp.initSymbolIterator();a={next:a};a[$jscomp.global.Symbol.iterator]=function(){return this};return a};$jscomp.underscoreProtoCanBeSet=function(){var a={a:!0},b={};try{return b.__proto__=a,b.a}catch(f){}return!1};
|
|
7
|
-
$jscomp.setPrototypeOf="function"==typeof Object.setPrototypeOf?Object.setPrototypeOf:$jscomp.underscoreProtoCanBeSet()?function(a,b){a.__proto__=b;if(a.__proto__!==b)throw new TypeError(a+" is not extensible");return a}:null;$jscomp.generator={};$jscomp.generator.ensureIteratorResultIsObject_=function(a){if(!(a instanceof Object))throw new TypeError("Iterator result "+a+" is not an object");};
|
|
8
|
-
$jscomp.generator.Context=function(){this.isRunning_=!1;this.yieldAllIterator_=null;this.yieldResult=void 0;this.nextAddress=1;this.finallyAddress_=this.catchAddress_=0;this.finallyContexts_=this.abruptCompletion_=null};$jscomp.generator.Context.prototype.start_=function(){if(this.isRunning_)throw new TypeError("Generator is already running");this.isRunning_=!0};$jscomp.generator.Context.prototype.stop_=function(){this.isRunning_=!1};
|
|
9
|
-
$jscomp.generator.Context.prototype.jumpToErrorHandler_=function(){this.nextAddress=this.catchAddress_||this.finallyAddress_};$jscomp.generator.Context.prototype.next_=function(a){this.yieldResult=a};$jscomp.generator.Context.prototype.throw_=function(a){this.abruptCompletion_={exception:a,isException:!0};this.jumpToErrorHandler_()};$jscomp.generator.Context.prototype.return=function(a){this.abruptCompletion_={return:a};this.nextAddress=this.finallyAddress_};
|
|
10
|
-
$jscomp.generator.Context.prototype.jumpThroughFinallyBlocks=function(a){this.abruptCompletion_={jumpTo:a};this.nextAddress=this.finallyAddress_};$jscomp.generator.Context.prototype.yield=function(a,b){this.nextAddress=b;return{value:a}};$jscomp.generator.Context.prototype.yieldAll=function(a,b){a=$jscomp.makeIterator(a);var f=a.next();$jscomp.generator.ensureIteratorResultIsObject_(f);if(f.done)this.yieldResult=f.value,this.nextAddress=b;else return this.yieldAllIterator_=a,this.yield(f.value,b)};
|
|
11
|
-
$jscomp.generator.Context.prototype.jumpTo=function(a){this.nextAddress=a};$jscomp.generator.Context.prototype.jumpToEnd=function(){this.nextAddress=0};$jscomp.generator.Context.prototype.setCatchFinallyBlocks=function(a,b){this.catchAddress_=a;void 0!=b&&(this.finallyAddress_=b)};$jscomp.generator.Context.prototype.setFinallyBlock=function(a){this.catchAddress_=0;this.finallyAddress_=a||0};$jscomp.generator.Context.prototype.leaveTryBlock=function(a,b){this.nextAddress=a;this.catchAddress_=b||0};
|
|
12
|
-
$jscomp.generator.Context.prototype.enterCatchBlock=function(a){this.catchAddress_=a||0;a=this.abruptCompletion_.exception;this.abruptCompletion_=null;return a};$jscomp.generator.Context.prototype.enterFinallyBlock=function(a,b,f){f?this.finallyContexts_[f]=this.abruptCompletion_:this.finallyContexts_=[this.abruptCompletion_];this.catchAddress_=a||0;this.finallyAddress_=b||0};
|
|
13
|
-
$jscomp.generator.Context.prototype.leaveFinallyBlock=function(a,b){b=this.finallyContexts_.splice(b||0)[0];if(b=this.abruptCompletion_=this.abruptCompletion_||b){if(b.isException)return this.jumpToErrorHandler_();void 0!=b.jumpTo&&this.finallyAddress_<b.jumpTo?(this.nextAddress=b.jumpTo,this.abruptCompletion_=null):this.nextAddress=this.finallyAddress_}else this.nextAddress=a};$jscomp.generator.Context.prototype.forIn=function(a){return new $jscomp.generator.Context.PropertyIterator(a)};
|
|
14
|
-
$jscomp.generator.Context.PropertyIterator=function(a){this.object_=a;this.properties_=[];for(var b in a)this.properties_.push(b);this.properties_.reverse()};$jscomp.generator.Context.PropertyIterator.prototype.getNext=function(){for(;0<this.properties_.length;){var a=this.properties_.pop();if(a in this.object_)return a}return null};$jscomp.generator.Engine_=function(a){this.context_=new $jscomp.generator.Context;this.program_=a};
|
|
15
|
-
$jscomp.generator.Engine_.prototype.next_=function(a){this.context_.start_();if(this.context_.yieldAllIterator_)return this.yieldAllStep_(this.context_.yieldAllIterator_.next,a,this.context_.next_);this.context_.next_(a);return this.nextStep_()};
|
|
16
|
-
$jscomp.generator.Engine_.prototype.return_=function(a){this.context_.start_();var b=this.context_.yieldAllIterator_;if(b)return this.yieldAllStep_("return"in b?b["return"]:function(a){return{value:a,done:!0}},a,this.context_.return);this.context_.return(a);return this.nextStep_()};
|
|
17
|
-
$jscomp.generator.Engine_.prototype.throw_=function(a){this.context_.start_();if(this.context_.yieldAllIterator_)return this.yieldAllStep_(this.context_.yieldAllIterator_["throw"],a,this.context_.next_);this.context_.throw_(a);return this.nextStep_()};
|
|
18
|
-
$jscomp.generator.Engine_.prototype.yieldAllStep_=function(a,b,f){try{var v=a.call(this.context_.yieldAllIterator_,b);$jscomp.generator.ensureIteratorResultIsObject_(v);if(!v.done)return this.context_.stop_(),v;var A=v.value}catch(D){return this.context_.yieldAllIterator_=null,this.context_.throw_(D),this.nextStep_()}this.context_.yieldAllIterator_=null;f.call(this.context_,A);return this.nextStep_()};
|
|
19
|
-
$jscomp.generator.Engine_.prototype.nextStep_=function(){for(;this.context_.nextAddress;)try{var a=this.program_(this.context_);if(a)return this.context_.stop_(),{value:a.value,done:!1}}catch(b){this.context_.yieldResult=void 0,this.context_.throw_(b)}this.context_.stop_();if(this.context_.abruptCompletion_){a=this.context_.abruptCompletion_;this.context_.abruptCompletion_=null;if(a.isException)throw a.exception;return{value:a.return,done:!0}}return{value:void 0,done:!0}};
|
|
20
|
-
$jscomp.generator.Generator_=function(a){this.next=function(b){return a.next_(b)};this.throw=function(b){return a.throw_(b)};this.return=function(b){return a.return_(b)};$jscomp.initSymbolIterator();this[Symbol.iterator]=function(){return this}};$jscomp.generator.createGenerator=function(a,b){b=new $jscomp.generator.Generator_(new $jscomp.generator.Engine_(b));$jscomp.setPrototypeOf&&$jscomp.setPrototypeOf(b,a.prototype);return b};
|
|
21
|
-
$jscomp.asyncExecutePromiseGenerator=function(a){function b(b){return a.next(b)}function f(b){return a.throw(b)}return new Promise(function(v,A){function D(a){a.done?v(a.value):Promise.resolve(a.value).then(b,f).then(D,A)}D(a.next())})};$jscomp.asyncExecutePromiseGeneratorFunction=function(a){return $jscomp.asyncExecutePromiseGenerator(a())};$jscomp.asyncExecutePromiseGeneratorProgram=function(a){return $jscomp.asyncExecutePromiseGenerator(new $jscomp.generator.Generator_(new $jscomp.generator.Engine_(a)))};
|
|
22
|
-
$jscomp.polyfill("Array.prototype.includes",function(a){return a?a:function(a,f){var b=this;b instanceof String&&(b=String(b));var A=b.length;f=f||0;for(0>f&&(f=Math.max(f+A,0));f<A;f++){var D=b[f];if(D===a||Object.is(D,a))return!0}return!1}},"es7","es3");
|
|
23
|
-
(()=>{const a=!!("object"==typeof global&&global.process&&global.process.release&&global.process.release.name);a&&(global.self=global);var b;a&&(b=require("worker_threads"));let f=a?b.parentPort:self,v,A,D,W=!1,N,ba,R,S,C,ca=0,T=0;const ya=(a,b)=>{b>ca&&(T&&Module._free(T),T=Module._malloc(b),ca=b);Module.HEAPU8.set(a.subarray(0,b),T)};let ma,za=new Promise(a=>{ma=a}),ra=!1,Aa=()=>$jscomp.asyncExecutePromiseGeneratorFunction(function*(){if(ra)throw"can't load wasm twice";ra=!0;I("wasm loading...");
|
|
24
|
-
N=Date.now();yield new Promise(b=>{self.KModule=self.Module={locateFile:function(b){return"libDynamsoftBarcodeReader.wasm"==b?a?A+"dbr-"+D+".node.wasm":A+"dbr-"+D+(W?".full":"")+".wasm":A+b},print:a=>{I(a)},printErr:a=>{console.error(a);I(a)},onRuntimeInitialized:function(){return $jscomp.asyncExecutePromiseGeneratorFunction(function*(){I("wasm initialized, cost "+(Date.now()-N)+" ms");a||(Module=KModule);ma();b()})}};if(a){let a=Module;Module=require("./dbr-"+D+".node.wasm.js");for(let b in a)Module[b]=
|
|
25
|
-
a[b]}else importScripts(A+"dbr-"+D+(W?".full":"")+".wasm.js")})}),ea=a=>$jscomp.asyncExecutePromiseGeneratorFunction(function*(){yield za;R=a.trial;S=a.msg;Module.BarcodeReaderWasm.init(JSON.stringify(a))}),Ba=()=>Module.BarcodeReaderWasm.getMinExpireTime(),Va=()=>Module.BarcodeReaderWasm.getMaxExpireTime(),y=new Map,Wa=0;b=function(b){return $jscomp.asyncExecutePromiseGeneratorFunction(function*(){const n=b.data?b.data:b;var q=n.id,w=n.instanceID,m=n.body;!ba||"decodeBuffer"!=n.type&&"decodeFileInMemory"!=
|
|
26
|
-
n.type||(yield C.c());switch(n.type){case "loadWasm":try{v=n.bd;A=n.engineResourcePath;W=n.bUseFullFeature;D=n.version;let a=n.dm,b=n.lcs;ba=n.brtk;let m=n.bptk;Aa();let w;q=()=>$jscomp.asyncExecutePromiseGeneratorFunction(function*(){try{C=(a=>{const b=!!("object"==typeof global&&global.process&&global.process.release&&global.process.release.name);let e=a.dwt?Dynamsoft.Lib.Promise:self.Promise,f=a.btoa||(b?global.btoa||(a=>Buffer.from(a,"binary").toString("base64")):self.btoa),h=a.atob||(b?global.atob||
|
|
27
|
-
(a=>Buffer.from(a,"base64").toString("binary")):self.atob),q,m=a.product,w,v,n,y,A,G,p,D,ja,J=["https://mlts.dynamsoft.com/","https://slts.dynamsoft.com/"],C,U,I,F,W,E,T=!1,N=e.resolve(),X=a.lf,V,H,K,fa,ba=a.log||(()=>{}),Y=a.dwt?t=>{try{a.debugLog&&a.debugLog(t)}catch(l){}}:a.debugLog||(()=>{}),M=a.fol,ca,da,R,S=a.sutlcb;Date.prototype.kUtilFormat=function(a){var t={"M+":this.getUTCMonth()+1,"d+":this.getUTCDate(),"H+":this.getUTCHours(),"h+":this.getUTCHours()%12||12,"m+":this.getUTCMinutes(),"s+":this.getUTCSeconds(),
|
|
28
|
-
"q+":Math.floor((this.getUTCMonth()+3)/3),"S+":this.getUTCMilliseconds()};/(y+)/.test(a)&&(a=a.replace(RegExp.$1,(this.getUTCFullYear()+"").substr(4-RegExp.$1.length)));for(var b in t)(new RegExp("("+b+")")).test(a)&&(a=a.replace(RegExp.$1,1==RegExp.$1.length?t[b]:("000"+t[b]).substr(("000"+t[b]).length-RegExp.$1.length)));return a};let ha,z=a=>a.join("");var la=[80,88,27,82,145,164,199,211],ma=[187,87,89,128,150,44,190,213],O=[89,51,74,53,99,72,82,118],ra=[99,181,118,158,215,103,76,117],Z=[99,51,
|
|
29
|
-
86,105,100,71,120,108],Ca=[97,87,49,119,98,51,74,48,83,50,86,53],Da=[81,85,86,84,76,85,100,68,84,81,32,32],ea=[90,87,53,106,99,110,108,119,100,65,32,32],aa=[90,71,86,106,99,110,108,119,100,65,32,32],La=[97,88,89,32],ya=[29,83,122,137,5,180,157,114],Ma=[100,71,70,110,84,71,86,117,90,51,82,111];let Na=()=>self[z(O)][z(Z)][z(Ca)]("raw",new Uint8Array(la.concat(ma,ra,ya)),z(Da),!0,[z(ea),z(aa)]),Oa=a.fdaa||(a=>$jscomp.asyncExecutePromiseGeneratorFunction(function*(){if(self[z(O)]&&self[z(O)][z(Z)]&&self[z(O)][z(Z)][z(Ca)]){var b=
|
|
30
|
-
h(a),t=new Uint8Array(b.length);for(let a=0;a<b.length;++a)t[a]=b.charCodeAt(a);b=t.subarray(0,12);t=t.subarray(b.length);ha||(ha=yield Na());t=yield self[z(O)][z(Z)][z(aa)]({name:z(Da),[z(La)]:b,[z(Ma)]:128},ha,t);return String.fromCharCode.apply(null,new Uint8Array(t))}})),Pa=a.feab||(a=>$jscomp.asyncExecutePromiseGeneratorFunction(function*(){if(self[z(O)]&&self[z(O)][z(Z)]&&self[z(O)][z(Z)][z(Ca)]){var b=new Uint8Array(a.length);for(var t=0;t<a.length;++t)b[t]=a.charCodeAt(t);t=self.crypto.getRandomValues(new Uint8Array(12));
|
|
31
|
-
ha||(ha=yield Na());b=yield self[z(O)][z(Z)][z(ea)]({name:z(Da),[z(La)]:t,[z(Ma)]:128},ha,b);b=new Uint8Array(b);let e=new Uint8Array(t.length+b.length);e.set(t);e.set(b,t.length);return f(String.fromCharCode.apply(null,e))}})),Ea=a=>h(h(a.replace(/\n/g,"+").replace(/\s/g,"=")).substring(1)),Fa=a=>f(String.fromCharCode(97+25*Math.random())+f(a)).replace(/\+/g,"\n").replace(/=/g," "),L,Qa=()=>{if(L)return L;if(self.crypto){let a=new Uint8Array(36);self.crypto.getRandomValues(a);let b="";for(let t=
|
|
32
|
-
0;36>t;++t){let e=a[t]%36;b=10>e?b+e:b+String.fromCharCode(e+87)}return b}return"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,function(a){var b=16*Math.random()|0;return("x"==a?b:b&3|8).toString(16)})},za=()=>{X||self.localforage||(b?(global.localforage=require("node-localstorage").LocalStorage,global.localforage.prototype.keys=function(){let a=[];for(let b=0;b<this.length;++b)a.push(this.key(b));return a},global.localforage.createInstance=function(a){return new X("./dynamsoftverify/"+a.name)}):
|
|
33
|
-
!function(a){"object"==typeof exports&&"undefined"!=typeof module?module.exports=a():"function"==typeof define&&define.amd?define([],a):("undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:this).localforage=a()}(function(){return function ka(a,b,e){function f(r,h){if(!b[r]){if(!a[r]){var n="function"==typeof require&&require;if(!h&&n)return n(r,!0);if(l)return l(r,!0);h=Error("Cannot find module '"+r+"'");throw h.code="MODULE_NOT_FOUND",h;}h=b[r]={exports:{}};
|
|
34
|
-
a[r][0].call(h.exports,function(b){return f(a[r][1][b]||b)},h,h.exports,ka,a,b,e)}return b[r].exports}for(var l="function"==typeof require&&require,h=0;h<e.length;h++)f(e[h]);return f}({1:[function(a,b,e){(function(a){function e(){q=!0;for(var a,b,e=m.length;e;){b=m;m=[];for(a=-1;++a<e;)b[a]();e=m.length}q=!1}var f=a.MutationObserver||a.WebKitMutationObserver;if(f){var h=0;f=new f(e);var l=a.document.createTextNode("");f.observe(l,{characterData:!0});var ka=function(){l.data=h=++h%2}}else if(a.setImmediate||
|
|
35
|
-
void 0===a.MessageChannel)ka="document"in a&&"onreadystatechange"in a.document.createElement("script")?function(){var b=a.document.createElement("script");b.onreadystatechange=function(){e();b.onreadystatechange=null;b.parentNode.removeChild(b);b=null};a.document.documentElement.appendChild(b)}:function(){setTimeout(e,0)};else{var n=new a.MessageChannel;n.port1.onmessage=e;ka=function(){n.port2.postMessage(0)}}var q,m=[];b.exports=function(a){1!==m.push(a)||q||ka()}}).call(this,"undefined"!=typeof global?
|
|
36
|
-
global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{}],2:[function(a,b,e){function f(){}function h(a){if("function"!=typeof a)throw new TypeError("resolver must be a function");this.state=na;this.queue=[];this.outcome=void 0;a!==f&&q(this,a)}function l(a,b,e){this.promise=a;"function"==typeof b&&(this.onFulfilled=b,this.callFulfilled=this.otherCallFulfilled);"function"==typeof e&&(this.onRejected=e,this.callRejected=this.otherCallRejected)}function n(a,b,e){z(function(){try{var f=
|
|
37
|
-
b(e)}catch(Za){return p.reject(a,Za)}f===a?p.reject(a,new TypeError("Cannot resolve promise with itself")):p.resolve(a,f)})}function m(a){var b=a&&a.then;if(a&&("object"==typeof a||"function"==typeof a)&&"function"==typeof b)return function(){b.apply(a,arguments)}}function q(a,b){function e(b){h||(h=!0,p.reject(a,b))}function f(b){h||(h=!0,p.resolve(a,b))}var h=!1,l=y(function(){b(f,e)});"error"===l.status&&e(l.value)}function y(a,b){var e={};try{e.value=a(b),e.status="success"}catch(Ya){e.status=
|
|
38
|
-
"error",e.value=Ya}return e}var z=a(1),p={},v=["REJECTED"],w=["FULFILLED"],na=["PENDING"];b.exports=h;h.prototype.catch=function(a){return this.then(null,a)};h.prototype.then=function(a,b){if("function"!=typeof a&&this.state===w||"function"!=typeof b&&this.state===v)return this;var e=new this.constructor(f);this.state!==na?n(e,this.state===w?a:b,this.outcome):this.queue.push(new l(e,a,b));return e};l.prototype.callFulfilled=function(a){p.resolve(this.promise,a)};l.prototype.otherCallFulfilled=function(a){n(this.promise,
|
|
39
|
-
this.onFulfilled,a)};l.prototype.callRejected=function(a){p.reject(this.promise,a)};l.prototype.otherCallRejected=function(a){n(this.promise,this.onRejected,a)};p.resolve=function(a,b){var e=y(m,b);if("error"===e.status)return p.reject(a,e.value);if(e=e.value)q(a,e);else{a.state=w;a.outcome=b;e=-1;for(var f=a.queue.length;++e<f;)a.queue[e].callFulfilled(b)}return a};p.reject=function(a,b){a.state=v;a.outcome=b;for(var e=-1,f=a.queue.length;++e<f;)a.queue[e].callRejected(b);return a};h.resolve=function(a){return a instanceof
|
|
40
|
-
this?a:p.resolve(new this(f),a)};h.reject=function(a){var b=new this(f);return p.reject(b,a)};h.all=function(a){function b(a,b){e.resolve(a).then(function(a){r[b]=a;++n!==h||l||(l=!0,p.resolve(q,r))},function(a){l||(l=!0,p.reject(q,a))})}var e=this;if("[object Array]"!==Object.prototype.toString.call(a))return this.reject(new TypeError("must be an array"));var h=a.length,l=!1;if(!h)return this.resolve([]);for(var r=Array(h),n=0,m=-1,q=new this(f);++m<h;)b(a[m],m);return q};h.race=function(a){function b(a){e.resolve(a).then(function(a){l||
|
|
41
|
-
(l=!0,p.resolve(n,a))},function(a){l||(l=!0,p.reject(n,a))})}var e=this;if("[object Array]"!==Object.prototype.toString.call(a))return this.reject(new TypeError("must be an array"));var h=a.length,l=!1;if(!h)return this.resolve([]);for(var r=-1,n=new this(f);++r<h;)b(a[r]);return n}},{1:1}],3:[function(a,b,e){b="undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{};"function"!=typeof b.Promise&&(b.Promise=a(2))},{2:2}],4:[function(a,b,n){function l(c,
|
|
42
|
-
a){c=c||[];a=a||{};try{return new Blob(c,a)}catch(B){if("TypeError"!==B.name)throw B;for(var d=new ("undefined"!=typeof BlobBuilder?BlobBuilder:"undefined"!=typeof MSBlobBuilder?MSBlobBuilder:"undefined"!=typeof MozBlobBuilder?MozBlobBuilder:WebKitBlobBuilder),b=0;b<c.length;b+=1)d.append(c[b]);return d.getBlob(a.type)}}function r(a,d){d&&a.then(function(a){d(null,a)},function(a){d(a)})}function m(a,d,g){"function"==typeof d&&a.then(d);"function"==typeof g&&a.catch(g)}function p(a){return"string"!=
|
|
43
|
-
typeof a&&(console.warn(a+" used as a key, but it is not a string."),a=String(a)),a}function q(){if(arguments.length&&"function"==typeof arguments[arguments.length-1])return arguments[arguments.length-1]}function y(a){return(new u(function(c){var d=a.transaction(R,da),b=l([""]);d.objectStore(R).put(b,"key");d.onabort=function(a){a.preventDefault();a.stopPropagation();c(!1)};d.oncomplete=function(){var a=navigator.userAgent.match(/Chrome\/(\d+)/),d=navigator.userAgent.match(/Edge\//);c(d||!a||43<=
|
|
44
|
-
parseInt(a[1],10))}})).catch(function(){return!1})}function z(a){return"boolean"==typeof S?u.resolve(S):y(a).then(function(a){return S=a})}function v(a){a=P[a.name];var c={};c.promise=new u(function(a,d){c.resolve=a;c.reject=d});a.deferredOperations.push(c);a.dbReady?a.dbReady=a.dbReady.then(function(){return c.promise}):a.dbReady=c.promise}function w(a){if(a=P[a.name].deferredOperations.pop())return a.resolve(),a.promise}function na(a,d){if(a=P[a.name].deferredOperations.pop())return a.reject(d),
|
|
45
|
-
a.promise}function A(a,d){return new u(function(c,b){if(P[a.name]=P[a.name]||I(),a.db){if(!d)return c(a.db);v(a);a.db.close()}var g=[a.name];d&&g.push(a.version);var k=K.open.apply(K,g);d&&(k.onupgradeneeded=function(c){var d=k.result;try{d.createObjectStore(a.storeName),1>=c.oldVersion&&d.createObjectStore(R)}catch(Q){if("ConstraintError"!==Q.name)throw Q;console.warn('The database "'+a.name+'" has been upgraded from version '+c.oldVersion+" to version "+c.newVersion+', but the storage "'+a.storeName+
|
|
46
|
-
'" already exists.')}});k.onerror=function(a){a.preventDefault();b(k.error)};k.onsuccess=function(){c(k.result);w(a)}})}function G(a,d){if(!a.db)return!0;var c=!a.db.objectStoreNames.contains(a.storeName),b=a.version>a.db.version;return(a.version<a.db.version&&(a.version!==d&&console.warn('The database "'+a.name+"\" can't be downgraded from version "+a.db.version+" to version "+a.version+"."),a.version=a.db.version),b||c)?(c&&(d=a.db.version+1,d>a.version&&(a.version=d)),!0):!1}function D(a){return new u(function(c,
|
|
47
|
-
g){var d=new FileReader;d.onerror=g;d.onloadend=function(d){d=f(d.target.result||"");c({__local_forage_encoded_blob:!0,data:d,type:a.type})};d.readAsBinaryString(a)})}function ja(a){for(var c=h(a.data),g=c.length,b=new ArrayBuffer(g),B=new Uint8Array(b),k=0;k<g;k++)B[k]=c.charCodeAt(k);return l([b],{type:a.type})}function F(a){var c=this,g=c._initReady().then(function(){var a=P[c._dbInfo.name];if(a&&a.dbReady)return a.dbReady});return m(g,a,a),g}function Xa(a){v(a);for(var c=P[a.name],g=c.forages,
|
|
48
|
-
b=0;b<g.length;b++){var B=g[b];B._dbInfo.db&&(B._dbInfo.db.close(),B._dbInfo.db=null)}return a.db=null,A(a,!1).then(function(c){return a.db=c,G(a)?A(a,!0):c}).then(function(d){a.db=c.db=d;for(var b=0;b<g.length;b++)g[b]._dbInfo.db=d}).catch(function(c){throw na(a,c),c;})}function C(a,d,g,b){void 0===b&&(b=1);try{var c=a.db.transaction(a.storeName,d);g(null,c)}catch(k){if(0<b&&(!a.db||"InvalidStateError"===k.name||"NotFoundError"===k.name))return u.resolve().then(function(){if(!a.db||"NotFoundError"===
|
|
49
|
-
k.name&&!a.db.objectStoreNames.contains(a.storeName)&&a.version<=a.db.version)return a.db&&(a.version=a.db.version+1),A(a,!0)}).then(function(){return Xa(a).then(function(){C(a,d,g,b-1)})}).catch(g);g(k)}}function I(){return{forages:[],db:null,dbReady:null,deferredOperations:[]}}function J(a){var c=.75*a.length;var b=a.length,x=0;"="===a[a.length-1]&&(c--,"="===a[a.length-2]&&c--);var B=new ArrayBuffer(c),k=new Uint8Array(B);for(c=0;c<b;c+=4){var e=ia.indexOf(a[c]);var pa=ia.indexOf(a[c+1]);var Q=
|
|
50
|
-
ia.indexOf(a[c+2]);var f=ia.indexOf(a[c+3]);k[x++]=e<<2|pa>>4;k[x++]=(15&pa)<<4|Q>>2;k[x++]=(3&Q)<<6|63&f}return B}function H(a){var c=new Uint8Array(a),b="";for(a=0;a<c.length;a+=3)b+=ia[c[a]>>2],b+=ia[(3&c[a])<<4|c[a+1]>>4],b+=ia[(15&c[a+1])<<2|c[a+2]>>6],b+=ia[63&c[a+2]];return 2==c.length%3?b=b.substring(0,b.length-1)+"=":1==c.length%3&&(b=b.substring(0,b.length-2)+"=="),b}function U(a,b,g,x){a.executeSql("CREATE TABLE IF NOT EXISTS "+b.storeName+" (id INTEGER PRIMARY KEY, key unique, value)",
|
|
51
|
-
[],g,x)}function E(a,b,g,x,B,k){a.executeSql(g,x,B,function(a,c){c.code===c.SYNTAX_ERR?a.executeSql("SELECT name FROM sqlite_master WHERE type='table' AND name = ?",[b.storeName],function(a,d){d.rows.length?k(a,c):U(a,b,function(){a.executeSql(g,x,B,k)},k)},k):k(a,c)},k)}function L(a,b,g,x){var c=this;a=p(a);var d=new u(function(d,k){c.ready().then(function(){void 0===b&&(b=null);var e=b,B=c._dbInfo;B.serializer.serialize(b,function(b,Q){Q?k(Q):B.db.transaction(function(c){E(c,B,"INSERT OR REPLACE INTO "+
|
|
52
|
-
B.storeName+" (key, value) VALUES (?, ?)",[a,b],function(){d(e)},function(a,c){k(c)})},function(b){if(b.code===b.QUOTA_ERR){if(0<x)return void d(L.apply(c,[a,e,g,x-1]));k(b)}})})}).catch(k)});return r(d,g),d}function T(a){return new u(function(c,b){a.transaction(function(d){d.executeSql("SELECT name FROM sqlite_master WHERE type='table' AND name <> '__WebKitDatabaseInfoTable__'",[],function(b,d){b=[];for(var g=0;g<d.rows.length;g++)b.push(d.rows.item(g).name);c({db:a,storeNames:b})},function(a,c){b(c)})},
|
|
53
|
-
function(a){b(a)})})}function O(a,b){var c=a.name+"/";return a.storeName!==b.storeName&&(c+=a.storeName+"/"),c}function W(a,b){a[b]=function(){var c=arguments;return a.ready().then(function(){return a[b].apply(a,c)})}}function N(){for(var a=1;a<arguments.length;a++){var b=arguments[a];if(b)for(var g in b)b.hasOwnProperty(g)&&(ea(b[g])?arguments[0][g]=b[g].slice():arguments[0][g]=b[g])}return arguments[0]}var X="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(a){return typeof a}:
|
|
54
|
-
function(a){return a&&"function"==typeof Symbol&&a.constructor===Symbol&&a!==Symbol.prototype?"symbol":typeof a},K=function(){if("undefined"!=typeof indexedDB)return indexedDB;if("undefined"!=typeof webkitIndexedDB)return webkitIndexedDB;if("undefined"!=typeof mozIndexedDB)return mozIndexedDB;if("undefined"!=typeof OIndexedDB)return OIndexedDB;if("undefined"!=typeof msIndexedDB)return msIndexedDB}();"undefined"==typeof e&&a(3);var u=e,R="local-forage-detect-blob-support",S=void 0,P={},ca=Object.prototype.toString,
|
|
55
|
-
da="readwrite";a={_driver:"asyncStorage",_initStorage:function(a){function b(){return u.resolve()}var c=this,x={db:null};if(a)for(var e in a)x[e]=a[e];var k=P[x.name];k||(k=I(),P[x.name]=k);k.forages.push(c);c._initReady||(c._initReady=c.ready,c.ready=F);a=[];for(e=0;e<k.forages.length;e++){var f=k.forages[e];f!==c&&a.push(f._initReady().catch(b))}var pa=k.forages.slice(0);return u.all(a).then(function(){return x.db=k.db,A(x,!1)}).then(function(a){return x.db=a,G(x,c._defaultConfig.version)?A(x,!0):
|
|
56
|
-
a}).then(function(a){x.db=k.db=a;c._dbInfo=x;for(a=0;a<pa.length;a++){var b=pa[a];b!==c&&(b._dbInfo.db=x.db,b._dbInfo.version=x.version)}})},_support:function(){try{if(!K)return!1;var a="undefined"!=typeof openDatabase&&/(Safari|iPhone|iPad|iPod)/.test(navigator.userAgent)&&!/Chrome/.test(navigator.userAgent)&&!/BlackBerry/.test(navigator.platform),b="function"==typeof fetch&&-1!==fetch.toString().indexOf("[native code");return(!a||b)&&"undefined"!=typeof indexedDB&&"undefined"!=typeof IDBKeyRange}catch(g){return!1}}(),
|
|
57
|
-
iterate:function(a,b){var c=this,d=new u(function(b,d){c.ready().then(function(){C(c._dbInfo,"readonly",function(g,k){if(g)return d(g);try{var e=k.objectStore(c._dbInfo.storeName).openCursor(),x=1;e.onsuccess=function(){var c=e.result;if(c){var d=c.value;d&&d.__local_forage_encoded_blob&&(d=ja(d));d=a(d,c.key,x++);void 0!==d?b(d):c.continue()}else b()};e.onerror=function(){d(e.error)}}catch(Ha){d(Ha)}})}).catch(d)});return r(d,b),d},getItem:function(a,b){var c=this;a=p(a);var d=new u(function(b,d){c.ready().then(function(){C(c._dbInfo,
|
|
58
|
-
"readonly",function(g,e){if(g)return d(g);try{var k=e.objectStore(c._dbInfo.storeName).get(a);k.onsuccess=function(){var a=k.result;void 0===a&&(a=null);a&&a.__local_forage_encoded_blob&&(a=ja(a));b(a)};k.onerror=function(){d(k.error)}}catch(qa){d(qa)}})}).catch(d)});return r(d,b),d},setItem:function(a,b,g){var c=this;a=p(a);var d=new u(function(d,g){var e;c.ready().then(function(){return e=c._dbInfo,"[object Blob]"===ca.call(b)?z(e.db).then(function(a){return a?b:D(b)}):b}).then(function(b){C(c._dbInfo,
|
|
59
|
-
da,function(e,k){if(e)return g(e);try{var x=k.objectStore(c._dbInfo.storeName);null===b&&(b=void 0);var B=x.put(b,a);k.oncomplete=function(){void 0===b&&(b=null);d(b)};k.onabort=k.onerror=function(){g(B.error?B.error:B.transaction.error)}}catch(Ia){g(Ia)}})}).catch(g)});return r(d,g),d},removeItem:function(a,b){var c=this;a=p(a);var d=new u(function(b,d){c.ready().then(function(){C(c._dbInfo,da,function(g,e){if(g)return d(g);try{var k=e.objectStore(c._dbInfo.storeName).delete(a);e.oncomplete=function(){b()};
|
|
60
|
-
e.onerror=function(){d(k.error)};e.onabort=function(){d(k.error?k.error:k.transaction.error)}}catch(qa){d(qa)}})}).catch(d)});return r(d,b),d},clear:function(a){var b=this,c=new u(function(a,c){b.ready().then(function(){C(b._dbInfo,da,function(d,g){if(d)return c(d);try{var e=g.objectStore(b._dbInfo.storeName).clear();g.oncomplete=function(){a()};g.onabort=g.onerror=function(){c(e.error?e.error:e.transaction.error)}}catch(Q){c(Q)}})}).catch(c)});return r(c,a),c},length:function(a){var b=this,c=new u(function(a,
|
|
61
|
-
c){b.ready().then(function(){C(b._dbInfo,"readonly",function(d,g){if(d)return c(d);try{var e=g.objectStore(b._dbInfo.storeName).count();e.onsuccess=function(){a(e.result)};e.onerror=function(){c(e.error)}}catch(Q){c(Q)}})}).catch(c)});return r(c,a),c},key:function(a,b){var c=this,d=new u(function(b,d){if(0>a)return void b(null);c.ready().then(function(){C(c._dbInfo,"readonly",function(g,e){if(g)return d(g);try{var k=!1,x=e.objectStore(c._dbInfo.storeName).openCursor();x.onsuccess=function(){var c=
|
|
62
|
-
x.result;if(!c)return void b(null);0===a?b(c.key):k?b(c.key):(k=!0,c.advance(a))};x.onerror=function(){d(x.error)}}catch(Ha){d(Ha)}})}).catch(d)});return r(d,b),d},keys:function(a){var b=this,c=new u(function(a,c){b.ready().then(function(){C(b._dbInfo,"readonly",function(d,g){if(d)return c(d);try{var e=g.objectStore(b._dbInfo.storeName).openCursor(),k=[];e.onsuccess=function(){var b=e.result;if(!b)return void a(k);k.push(b.key);b.continue()};e.onerror=function(){c(e.error)}}catch(qa){c(qa)}})}).catch(c)});
|
|
63
|
-
return r(c,a),c},dropInstance:function(a,b){b=q.apply(this,arguments);var c=this.config();a="function"!=typeof a&&a||{};a.name||(a.name=a.name||c.name,a.storeName=a.storeName||c.storeName);a.name?(c=a.name===c.name&&this._dbInfo.db?u.resolve(this._dbInfo.db):A(a,!1).then(function(b){var c=P[a.name],d=c.forages;c.db=b;for(c=0;c<d.length;c++)d[c]._dbInfo.db=b;return b}),c=a.storeName?c.then(function(b){if(b.objectStoreNames.contains(a.storeName)){var c=b.version+1;v(a);var d=P[a.name],g=d.forages;b.close();
|
|
64
|
-
for(b=0;b<g.length;b++){var e=g[b];e._dbInfo.db=null;e._dbInfo.version=c}return(new u(function(b,d){var g=K.open(a.name,c);g.onerror=function(a){g.result.close();d(a)};g.onupgradeneeded=function(){g.result.deleteObjectStore(a.storeName)};g.onsuccess=function(){var a=g.result;a.close();b(a)}})).then(function(a){d.db=a;for(var b=0;b<g.length;b++){var c=g[b];c._dbInfo.db=a;w(c._dbInfo)}}).catch(function(b){throw(na(a,b)||u.resolve()).catch(function(){}),b;})}}):c.then(function(b){v(a);var c=P[a.name],
|
|
65
|
-
d=c.forages;b.close();for(b=0;b<d.length;b++)d[b]._dbInfo.db=null;return(new u(function(b,c){var d=K.deleteDatabase(a.name);d.onerror=d.onblocked=function(a){var b=d.result;b&&b.close();c(a)};d.onsuccess=function(){var a=d.result;a&&a.close();b(a)}})).then(function(a){c.db=a;for(a=0;a<d.length;a++)w(d[a]._dbInfo)}).catch(function(b){throw(na(a,b)||u.resolve()).catch(function(){}),b;})})):c=u.reject("Invalid arguments");return r(c,b),c}};var ia="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",
|
|
66
|
-
Z=/^~~local_forage_type~([^~]+)~/,ba=Object.prototype.toString,Y={serialize:function(a,b){var c="";if(a&&(c=ba.call(a)),a&&("[object ArrayBuffer]"===c||a.buffer&&"[object ArrayBuffer]"===ba.call(a.buffer))){var d,e="__lfsc__:";a instanceof ArrayBuffer?(d=a,e+="arbf"):(d=a.buffer,"[object Int8Array]"===c?e+="si08":"[object Uint8Array]"===c?e+="ui08":"[object Uint8ClampedArray]"===c?e+="uic8":"[object Int16Array]"===c?e+="si16":"[object Uint16Array]"===c?e+="ur16":"[object Int32Array]"===c?e+="si32":
|
|
67
|
-
"[object Uint32Array]"===c?e+="ui32":"[object Float32Array]"===c?e+="fl32":"[object Float64Array]"===c?e+="fl64":b(Error("Failed to get type for BinaryArray")));b(e+H(d))}else if("[object Blob]"===c)c=new FileReader,c.onload=function(){var c="~~local_forage_type~"+a.type+"~"+H(this.result);b("__lfsc__:blob"+c)},c.readAsArrayBuffer(a);else try{b(JSON.stringify(a))}catch(k){console.error("Couldn't convert value into a JSON string: ",a),b(null,k)}},deserialize:function(a){if("__lfsc__:"!==a.substring(0,
|
|
68
|
-
9))return JSON.parse(a);var b=a.substring(13);a=a.substring(9,13);if("blob"===a&&Z.test(b)){var c=b.match(Z);var e=c[1];b=b.substring(c[0].length)}b=J(b);switch(a){case "arbf":return b;case "blob":return l([b],{type:e});case "si08":return new Int8Array(b);case "ui08":return new Uint8Array(b);case "uic8":return new Uint8ClampedArray(b);case "si16":return new Int16Array(b);case "ur16":return new Uint16Array(b);case "si32":return new Int32Array(b);case "ui32":return new Uint32Array(b);case "fl32":return new Float32Array(b);
|
|
69
|
-
case "fl64":return new Float64Array(b);default:throw Error("Unkown type: "+a);}},stringToBuffer:J,bufferToString:H};n={_driver:"webSQLStorage",_initStorage:function(a){var b=this,c={db:null};if(a)for(var e in a)c[e]="string"!=typeof a[e]?a[e].toString():a[e];a=new u(function(a,d){try{c.db=openDatabase(c.name,String(c.version),c.description,c.size)}catch(Sa){return d(Sa)}c.db.transaction(function(e){U(e,c,function(){b._dbInfo=c;a()},function(a,b){d(b)})},d)});return c.serializer=Y,a},_support:"function"==
|
|
70
|
-
typeof openDatabase,iterate:function(a,b){var c=this,d=new u(function(b,d){c.ready().then(function(){var e=c._dbInfo;e.db.transaction(function(c){E(c,e,"SELECT * FROM "+e.storeName,[],function(c,d){c=d.rows;d=c.length;for(var g=0;g<d;g++){var k=c.item(g),f=k.value;if(f&&(f=e.serializer.deserialize(f)),void 0!==(f=a(f,k.key,g+1)))return void b(f)}b()},function(a,b){d(b)})})}).catch(d)});return r(d,b),d},getItem:function(a,b){var c=this;a=p(a);var d=new u(function(b,d){c.ready().then(function(){var e=
|
|
71
|
-
c._dbInfo;e.db.transaction(function(c){E(c,e,"SELECT * FROM "+e.storeName+" WHERE key = ? LIMIT 1",[a],function(a,c){(a=c.rows.length?c.rows.item(0).value:null)&&(a=e.serializer.deserialize(a));b(a)},function(a,b){d(b)})})}).catch(d)});return r(d,b),d},setItem:function(a,b,e){return L.apply(this,[a,b,e,1])},removeItem:function(a,b){var c=this;a=p(a);var d=new u(function(b,d){c.ready().then(function(){var e=c._dbInfo;e.db.transaction(function(c){E(c,e,"DELETE FROM "+e.storeName+" WHERE key = ?",[a],
|
|
72
|
-
function(){b()},function(a,b){d(b)})})}).catch(d)});return r(d,b),d},clear:function(a){var b=this,c=new u(function(a,c){b.ready().then(function(){var d=b._dbInfo;d.db.transaction(function(b){E(b,d,"DELETE FROM "+d.storeName,[],function(){a()},function(a,b){c(b)})})}).catch(c)});return r(c,a),c},length:function(a){var b=this,c=new u(function(a,c){b.ready().then(function(){var d=b._dbInfo;d.db.transaction(function(b){E(b,d,"SELECT COUNT(key) as c FROM "+d.storeName,[],function(b,c){b=c.rows.item(0).c;
|
|
73
|
-
a(b)},function(a,b){c(b)})})}).catch(c)});return r(c,a),c},key:function(a,b){var c=this,d=new u(function(b,d){c.ready().then(function(){var e=c._dbInfo;e.db.transaction(function(c){E(c,e,"SELECT key FROM "+e.storeName+" WHERE id = ? LIMIT 1",[a+1],function(a,c){a=c.rows.length?c.rows.item(0).key:null;b(a)},function(a,b){d(b)})})}).catch(d)});return r(d,b),d},keys:function(a){var b=this,c=new u(function(a,c){b.ready().then(function(){var d=b._dbInfo;d.db.transaction(function(b){E(b,d,"SELECT key FROM "+
|
|
74
|
-
d.storeName,[],function(b,c){b=[];for(var d=0;d<c.rows.length;d++)b.push(c.rows.item(d).key);a(b)},function(a,b){c(b)})})}).catch(c)});return r(c,a),c},dropInstance:function(a,b){b=q.apply(this,arguments);var c=this.config();a="function"!=typeof a&&a||{};a.name||(a.name=a.name||c.name,a.storeName=a.storeName||c.storeName);var d,e=this;return d=a.name?(new u(function(b){var d=a.name===c.name?e._dbInfo.db:openDatabase(a.name,"","",0);b(a.storeName?{db:d,storeNames:[a.storeName]}:T(d))})).then(function(a){return new u(function(b,
|
|
75
|
-
c){a.db.transaction(function(d){function e(a){return new u(function(b,c){d.executeSql("DROP TABLE IF EXISTS "+a,[],function(){b()},function(a,b){c(b)})})}for(var g=[],f=0,k=a.storeNames.length;f<k;f++)g.push(e(a.storeNames[f]));u.all(g).then(function(){b()}).catch(function(a){c(a)})},function(a){c(a)})})}):u.reject("Invalid arguments"),r(d,b),d}};try{var M="undefined"!=typeof localStorage&&"setItem"in localStorage&&!!localStorage.setItem}catch(c){M=!1}var ha=function(a,b){for(var c=a.length,d=0;d<
|
|
76
|
-
c;){var e=a[d],f=b;if(e===f||"number"==typeof e&&"number"==typeof f&&isNaN(e)&&isNaN(f))return!0;d++}return!1},ea=Array.isArray||function(a){return"[object Array]"===Object.prototype.toString.call(a)},V={},fa={},oa={INDEXEDDB:a,WEBSQL:n,LOCALSTORAGE:{_driver:"localStorageWrapper",_initStorage:function(a){var b={};if(a)for(var c in a)b[c]=a[c];b.keyPrefix=O(a,this._defaultConfig);try{var e=(localStorage.setItem("_localforage_support_test",!0),localStorage.removeItem("_localforage_support_test"),!1)}catch(B){e=
|
|
77
|
-
!0}return!e||0<localStorage.length?(this._dbInfo=b,b.serializer=Y,u.resolve()):u.reject()},_support:M,iterate:function(a,b){var c=this,d=c.ready().then(function(){for(var b=c._dbInfo,d=b.keyPrefix,e=d.length,g=localStorage.length,f=1,h=0;h<g;h++){var l=localStorage.key(h);if(0===l.indexOf(d)){var x=localStorage.getItem(l);if(x&&(x=b.serializer.deserialize(x)),void 0!==(x=a(x,l.substring(e),f++)))return x}}});return r(d,b),d},getItem:function(a,b){var c=this;a=p(a);var d=c.ready().then(function(){var b=
|
|
78
|
-
c._dbInfo,d=localStorage.getItem(b.keyPrefix+a);return d&&(d=b.serializer.deserialize(d)),d});return r(d,b),d},setItem:function(a,b,e){var c=this;a=p(a);var d=c.ready().then(function(){void 0===b&&(b=null);var d=b;return new u(function(e,g){var f=c._dbInfo;f.serializer.serialize(b,function(b,c){if(c)g(c);else try{localStorage.setItem(f.keyPrefix+a,b),e(d)}catch(sa){"QuotaExceededError"!==sa.name&&"NS_ERROR_DOM_QUOTA_REACHED"!==sa.name||g(sa),g(sa)}})})});return r(d,e),d},removeItem:function(a,b){var c=
|
|
79
|
-
this;a=p(a);var d=c.ready().then(function(){localStorage.removeItem(c._dbInfo.keyPrefix+a)});return r(d,b),d},clear:function(a){var b=this,c=b.ready().then(function(){for(var a=b._dbInfo.keyPrefix,c=localStorage.length-1;0<=c;c--){var d=localStorage.key(c);0===d.indexOf(a)&&localStorage.removeItem(d)}});return r(c,a),c},length:function(a){var b=this.keys().then(function(a){return a.length});return r(b,a),b},key:function(a,b){var c=this,d=c.ready().then(function(){var b=c._dbInfo;try{var d=localStorage.key(a)}catch(Sa){d=
|
|
80
|
-
null}return d&&(d=d.substring(b.keyPrefix.length)),d});return r(d,b),d},keys:function(a){var b=this,c=b.ready().then(function(){for(var a=b._dbInfo,c=localStorage.length,d=[],e=0;e<c;e++){var g=localStorage.key(e);0===g.indexOf(a.keyPrefix)&&d.push(g.substring(a.keyPrefix.length))}return d});return r(c,a),c},dropInstance:function(a,b){if(b=q.apply(this,arguments),a="function"!=typeof a&&a||{},!a.name){var c=this.config();a.name=a.name||c.name;a.storeName=a.storeName||c.storeName}var d,e=this;return d=
|
|
81
|
-
a.name?(new u(function(b){b(a.storeName?O(a,e._defaultConfig):a.name+"/")})).then(function(a){for(var b=localStorage.length-1;0<=b;b--){var c=localStorage.key(b);0===c.indexOf(a)&&localStorage.removeItem(c)}}):u.reject("Invalid arguments"),r(d,b),d}}};M=[oa.INDEXEDDB._driver,oa.WEBSQL._driver,oa.LOCALSTORAGE._driver];var aa=["dropInstance"],la="clear getItem iterate key keys length removeItem setItem".split(" ").concat(aa),ma={description:"",driver:M.slice(),name:"localforage",size:4980736,storeName:"keyvaluepairs",
|
|
82
|
-
version:1};M=new (function(){function a(b){if(!(this instanceof a))throw new TypeError("Cannot call a class as a function");for(var c in oa)if(oa.hasOwnProperty(c)){var d=oa[c],e=d._driver;this[c]=e;V[e]||this.defineDriver(d)}this._defaultConfig=N({},ma);this._config=N({},this._defaultConfig,b);this._initDriver=this._driverSet=null;this._ready=!1;this._dbInfo=null;this._wrapLibraryMethodsWithReady();this.setDriver(this._config.driver).catch(function(){})}return a.prototype.config=function(a){if("object"===
|
|
83
|
-
(void 0===a?"undefined":X(a))){if(this._ready)return Error("Can't call config() after localforage has been used.");for(var b in a){if("storeName"===b&&(a[b]=a[b].replace(/\W/g,"_")),"version"===b&&"number"!=typeof a[b])return Error("Database version must be a number.");this._config[b]=a[b]}return!("driver"in a&&a.driver)||this.setDriver(this._config.driver)}return"string"==typeof a?this._config[a]:this._config},a.prototype.defineDriver=function(a,b,c){var d=new u(function(b,c){try{var d=a._driver,
|
|
84
|
-
e=Error("Custom driver not compliant; see https://mozilla.github.io/localForage/#definedriver");if(!a._driver)return void c(e);for(var f=la.concat("_initStorage"),g=0,h=f.length;g<h;g++){var l=f[g];if((!ha(aa,l)||a[l])&&"function"!=typeof a[l])return void c(e)}(function(){for(var b=function(a){return function(){var b=u.reject(Error("Method "+a+" is not implemented by the current driver"));return r(b,arguments[arguments.length-1]),b}},c=0,d=aa.length;c<d;c++){var e=aa[c];a[e]||(a[e]=b(e))}})();e=function(c){V[d]&&
|
|
85
|
-
console.info("Redefining LocalForage driver: "+d);V[d]=a;fa[d]=c;b()};"_support"in a?a._support&&"function"==typeof a._support?a._support().then(e,c):e(!!a._support):e(!0)}catch(Ia){c(Ia)}});return m(d,b,c),d},a.prototype.driver=function(){return this._driver||null},a.prototype.getDriver=function(a,b,c){a=V[a]?u.resolve(V[a]):u.reject(Error("Driver not found."));return m(a,b,c),a},a.prototype.getSerializer=function(a){var b=u.resolve(Y);return m(b,a),b},a.prototype.ready=function(a){var b=this,c=
|
|
86
|
-
b._driverSet.then(function(){return null===b._ready&&(b._ready=b._initDriver()),b._ready});return m(c,a,a),c},a.prototype.setDriver=function(a,b,c){function e(){g._config.driver=g.driver()}function d(a){return g._extend(a),e(),g._ready=g._initStorage(g._config),g._ready}function f(a){return function(){function b(){for(;c<a.length;){var f=a[c];return c++,g._dbInfo=null,g._ready=null,g.getDriver(f).then(d).catch(b)}e();return g._driverSet=u.reject(Error("No available storage method found.")),g._driverSet}
|
|
87
|
-
var c=0;return b()}}var g=this;ea(a)||(a=[a]);var h=this._getSupportedDrivers(a);return this._driverSet=(null!==this._driverSet?this._driverSet.catch(function(){return u.resolve()}):u.resolve()).then(function(){var a=h[0];return g._dbInfo=null,g._ready=null,g.getDriver(a).then(function(a){g._driver=a._driver;e();g._wrapLibraryMethodsWithReady();g._initDriver=f(h)})}).catch(function(){e();return g._driverSet=u.reject(Error("No available storage method found.")),g._driverSet}),m(this._driverSet,b,c),
|
|
88
|
-
this._driverSet},a.prototype.supports=function(a){return!!fa[a]},a.prototype._extend=function(a){N(this,a)},a.prototype._getSupportedDrivers=function(a){for(var b=[],c=0,e=a.length;c<e;c++){var d=a[c];this.supports(d)&&b.push(d)}return b},a.prototype._wrapLibraryMethodsWithReady=function(){for(var a=0,b=la.length;a<b;a++)W(this,la[a])},a.prototype.createInstance=function(b){return new a(b)},a}());b.exports=M},{3:3}]},{},[4])(4)}));X=X||self.localforage},Aa=()=>$jscomp.asyncExecutePromiseGeneratorFunction(function*(){za();
|
|
89
|
-
b&&(global.fetch=global.fetch||require("node-fetch"),global.crypto=global.crypto||require("crypto").webcrypto);z=a=>h(String.fromCharCode.apply(null,a).replace(/\n/g,"+").replace(/\s/g,"="));try{yield(yield X.createInstance({name:m+"jshello"})).setItem(m+"jshello","available")}catch(t){throw t&&"No available storage method found."===t.message&&(t=Error("Failed to access indexedDB. Our SDK stores the client's UUID in the browser's indexedDB for licensing purposes. Please make sure you are not in the private browsing mode or allow cookies in Browser Settings > Site Settings > Cookies.")),
|
|
90
|
-
t;}H=yield X.createInstance({name:"dynamltsinfo"});K=L?null:f(f("v2")+String.fromCharCode(G.charCodeAt(G.length/2)+1)+f(G));fa=f(String.fromCharCode(n.charCodeAt(0)+10)+f(m)+f(n)+v+f(""+A));if(!L){try{let a=yield H.getItem(K);a&&([p,F]=JSON.parse(yield Ea(a)))}catch(t){}try{null==p&&(p=Qa())}catch(t){}}V=yield X.createInstance({name:"dynamltsuns"+f(String.fromCharCode(n.charCodeAt(0)+10)+f(m)+f(n)+v+f(""+A))});try{y=yield H.getItem(fa)}catch(t){}}),ta,ua=t=>$jscomp.asyncExecutePromiseGeneratorFunction(function*(){ta||
|
|
91
|
-
(ta=(()=>$jscomp.asyncExecutePromiseGeneratorFunction(function*(){try{let a={pd:m,vm:v,dt:A||(b?"server":"browser"),ed:"javascript",cu:p,ad:G,os:JSON.stringify(D),fn:ja};n&&(a=-1!=n.indexOf("-")?Object.assign({},a,{hs:n}):Object.assign({},a,{og:n}));let h={};if(F&&!L){let a=yield H.getItem(K);a&&([p,F]=JSON.parse(yield Ea(a)));h["lts-time"]=F}C&&(a.sp=C);U&&(a.lm=U);I&&(a.cw=I);y=yield e.race([(()=>$jscomp.asyncExecutePromiseGeneratorFunction(function*(){let b=(new Date).kUtilFormat("yyyy-MM-ddTHH:mm:ss.SSSZ");
|
|
92
|
-
F&&!L&&(H.setItem(K,yield Fa(JSON.stringify([p,b]))),F=b);let l;var r="auth/?ext="+encodeURIComponent(f(JSON.stringify(a)));let m=!1,q=!1,v,w=a=>$jscomp.asyncExecutePromiseGeneratorFunction(function*(){if(a&&!a.ok)try{let b=yield a.text();if(b){let a=JSON.parse(b);a.errorCode&&(v=a,100<a.errorCode&&200>a.errorCode&&(y=null,q=m=!0))}}catch($a){}});try{l=yield e.race([fetch(J[0]+r,{headers:h,cache:t?"reload":"default",mode:"cors",timeout:1E4}),new e((a,b)=>{setTimeout(b,1E4)})]),yield w(l)}catch(Ga){}if(!(F||
|
|
93
|
-
l&&l.ok||m))try{l=yield fetch(J[1]+r,{headers:h,mode:"cors",timeout:3E4}),yield w(l)}catch(Ga){}if(!(F||l&&l.ok||m))try{l=yield fetch(J[0]+r,{headers:h,mode:"cors",timeout:3E4}),yield w(l)}catch(Ga){}v&&151==v.errorCode&&(L||H.removeItem(K),H.removeItem(fa),p=Qa(),a.cu=p,F=void 0,r=encodeURIComponent(f(JSON.stringify(a))),l=yield fetch(J[0]+"auth/?ext="+r,{headers:h,mode:"cors",timeout:3E4}),yield w(l));(()=>{if(!l||!l.ok){q&&H.setItem(fa,"");if(v)if(111==v.errorCode)var a=v.message;else a=v.message.trim(),
|
|
94
|
-
a.endsWith(".")||(a+="."),a=n?`An error occurred during authorization: ${a} Contact the site administrator for more information.`:`An error occurred during authorization: ${a} [Contact Dynamsoft](https://www.dynamsoft.com/company/contact/) for more information.`;else a=n?"Failed to connect to the License Tracking Server: network connection error. Check your Internet connection or contact the site administrator for more information.":"Failed to connect to the License Tracking Server: network connection error. Check your Internet connection or [contact Dynamsoft](https://www.dynamsoft.com/company/contact/) for more information.";
|
|
95
|
-
a=Error(a);v&&v.errorCode&&(a.ltsErrorCode=v.errorCode);throw a;}})();r=yield l.text();try{F||L||(H.setItem(K,yield Fa(JSON.stringify([p,b]))),F=b),H.setItem(fa,r)}catch(Ga){}fetch(J[0]+"verify",{mode:"cors",method:"POST",headers:{"Content-Type":"application/json","lts-time":"options"},body:"[]",timeout:3E4});return r}))(),new e((a,b)=>{let e;e=n?"Failed to connect to the License Tracking Server: network timed out. Check your Internet connection or contact the site administrator for more information.":
|
|
96
|
-
"Failed to connect to the License Tracking Server: network timed out. Check your Internet connection or [contact Dynamsoft](https://www.dynamsoft.com/company/contact/) for more information.";setTimeout(()=>b(Error(e)),y?3E3:15E3)})])}catch(l){q&&(a.dwt?self.console.error(l):console.error(l)),E=l}W=(new Date).kUtilFormat("yyyy-MM-ddTHH:mm:ss.SSSZ");ta=null}))());yield ta}),va,wa=()=>$jscomp.asyncExecutePromiseGeneratorFunction(function*(){va||(va=(()=>$jscomp.asyncExecutePromiseGeneratorFunction(function*(){Y(p);
|
|
97
|
-
if(y){E&&M&&(M(E),M=null);var b={dm:G};q&&(b.bd=!0);b.brtk=!0;b.ls=J[0];n&&(b.hs=n);b.cu=p;ja&&(b.fn=ja);m&&(b.product=m);A&&(b.dt=A);I&&(b.cw=I);D&&(b.os=JSON.stringify(D));Y(y);try{if(a.dwt)b.ar=y;else{let a=JSON.parse(yield Oa(y));a.ba&&(b.ba=a.ba);a.usu&&(b.usu=a.usu);a.trial&&(b.trial=a.trial);a.its&&(b.its=a.its);1==b.trial&&a.msg?b.msg=a.msg:E?b.msg=E.message||E:a.msg&&(b.msg=a.msg);b.ar=a.in}b.bafc=!!E}catch(l){}Y(b);try{yield ca(b)}catch(l){}yield Ta();T||(T=!0);va=null}else if(!T)throw ba(E.message),
|
|
98
|
-
E;}))());yield va}),Ta=()=>$jscomp.asyncExecutePromiseGeneratorFunction(function*(){let a=(new Date).kUtilFormat("yyyy-MM-ddTHH:mm:ss.SSSZ"),b=yield R();Y(b);if(b&&b<a){if(E)throw Error("Failed to connect to the License Tracking Server. The cached license has expired. Please get connected to the network as soon as possible or contact the site administrator for more information.");throw Error("Your system date and time appear to have been changed, causing the license to fail. Please correct the system data and time and try again.");
|
|
99
|
-
}}),Ja=!1,Ua,Ba=new e(a=>{Ua=a}),Ka=null,xa=(a,b)=>$jscomp.asyncExecutePromiseGeneratorFunction(function*(){N=N.then(()=>$jscomp.asyncExecutePromiseGeneratorFunction(function*(){let f=!1;try{let t=yield V.keys();b||(Ja?a&&(t=t.filter(b=>b<a)):a&&t.includes(a)?t=[a]:(t=[],Y("Unexpected null key")));if(t.length){Ja||(Ja=f=!0);for(let a=0;a<t.length/1E3;++a){let b=t.slice(1E3*a,1E3*(a+1)),l=[];for(var h=0;h<b.length;++h)l.push(yield V.getItem(b[h]));let m=(new Date).kUtilFormat("yyyy-MM-ddTHH:mm:ss.SSSZ");
|
|
100
|
-
if(!L){H.setItem(K,yield Fa(JSON.stringify([p,m])));let a=yield H.getItem(K);a&&([p,F]=JSON.parse(yield Ea(a)))}try{const a={"Content-Type":"application/json"};F&&!L&&(a["lts-time"]=F);let t=f?yield new e((b,e)=>{const f=new XMLHttpRequest;f.responseType="json";f.timeout=3E4;f.onload=()=>{b({ok:!0,json:()=>f.response})};f.onerror=f.timeout=f.onabort=()=>{b({ok:!1,status:f.status})};f.upload.onloadend=()=>{Ua()};f.open("POST",J[0]+"verify",!0);for(let b in a)f.setRequestHeader(b,a[b]);f.send(JSON.stringify(l))}):
|
|
101
|
-
yield fetch(J[0]+"verify",{mode:"cors",method:"POST",body:JSON.stringify(l),headers:a,timeout:3E4});if(t.ok){F=m;for(h=0;h<b.length;++h)yield V.removeItem(b[h]);(yield t.json()).handshakeUpdateTime>W&&(yield ua(!0),yield wa())}else throw Error("verify failed. Status Code: "+t.status);}catch(Ra){throw M&&(M(Ra),M=null),Ra;}}S&&S()}}catch(ka){}}));return yield N});return{i:a=>$jscomp.asyncExecutePromiseGeneratorFunction(function*(){q=a.bd;w=a.version;v=w.split(".")[0];a.dt&&(A=a.dt);G=a.dm;n=a.lcs||
|
|
102
|
-
"";D=a.browserInfo;ja=a.deviceFriendlyName;a.ls&&a.ls.length&&(J=a.ls,1==J.length&&J.push(J[0]));C=a.sp;U=a.lm;I=a.cw;a.lf&&(X=a.lf);a.lsu&&(p=L=a.lsu);a.fdaa&&(Oa=a.fdaa);a.feab&&(Pa=a.feab);ca=a.updateLicense;da=a.getMinExpireTime;R=a.getMaxExpireTime;a.sutlcb&&(S=a.sutlcb);yield Aa();yield ua();yield wa();E||xa(null,!0);return{ar:y,cu:p}}),c:()=>$jscomp.asyncExecutePromiseGeneratorFunction(function*(){var a=new Date,b=a.kUtilFormat("yyyy-MM-ddTHH:mm:ss.SSSZ");let e=yield da(),f=yield R();f&&f<
|
|
103
|
-
b?(yield ua(!0),yield wa()):e&&e<b&&(a.setMinutes(a.getMinutes()-6),b=a,a=null,a=b.kUtilFormat("yyyy-MM-ddTHH:mm:ss.SSSZ"),F<a&&ua().then(()=>wa()))}),s:(b,e,f,h)=>$jscomp.asyncExecutePromiseGeneratorFunction(function*(){if(a.dwt&&!e)yield xa(f);else{try{let a=e.startsWith("{")&&e.endsWith("}")?yield Pa(e):e;a?yield V.setItem(f,a):Y("ept ecpt")}catch(ka){}h&&(yield xa(f));Ka&&clearTimeout(Ka);Ka=setTimeout(()=>$jscomp.asyncExecutePromiseGeneratorFunction(function*(){yield xa()}),36E4)}}),caret:Ta,
|
|
104
|
-
pdsf:Ba}})({product:"dbr",log:I,debugLog:aa}),self.scsd=C.s,n.updateLicense=ea,n.getMinExpireTime=Ba,n.getMaxExpireTime=Va,yield C.i(n)}catch(U){if(m)ba=!1,yield y(),w=U.ltsErrorCode,S=U.message||U;else throw U;}});let y=()=>$jscomp.asyncExecutePromiseGeneratorFunction(function*(){let e={pk:b,dm:a};v&&(e.bd=!0);yield ea(e)});ba?yield q():yield y();f.postMessage({type:"load",success:!0,version:Module.BarcodeReaderWasm.getVersion(),trial:R,ltsErrorCode:w,message:S})}catch(e){f.postMessage({type:"load",
|
|
105
|
-
success:!1,ltsErrorCode:e&&e.ltsErrorCode,message:e&&e.message,trial:R,stack:v&&e?e.stack:null})}break;case "createInstance":w=Wa++;try{var G=new Module.BarcodeReaderWasm(n.bScanner,w);y.set(w,G);let b=JSON.parse(G.getRuntimeSettings());n.bScanner?(b.localizationModes=[2,0,0,0,0,0,0,0],b.deblurLevel=0):(b.expectedBarcodesCount=512,b.scaleDownThreshold=1E5,b.timeout=1E5);a||W||(b.barcodeFormatIds=235931647);G.updateRuntimeSettings(JSON.stringify(b))}catch(e){p(e,q);break}f.postMessage({type:"task",
|
|
106
|
-
id:q,body:{success:!0,instanceID:w}});break;case "destroyContext":try{if(!y.get(w))break;y.get(w).delete();y.delete(w)}catch(e){p(e,q);break}f.postMessage({type:"task",id:q,body:{success:!0}});break;case "decodeBuffer":{G=Date.now();let a,b,n,A;try{a=v?Date.now():0,ya(m.buffer,m.stride*m.height),b=v?Date.now():0,A=JSON.parse(y.get(w).decodeBufferPtr(T,m.width,m.height,m.stride,m.format)),n=Date.now()}catch(la){p(la,q);break}C&&C.pdsf&&(yield Promise.race([C.pdsf,new Promise(a=>{setTimeout(()=>{a();
|
|
107
|
-
C.pdsf=null},500)})]));f.postMessage({type:"task",id:q,body:{success:!0,decodeReturn:A,buffer:m.buffer,duration:Date.now()-G}},[m.buffer.buffer]);aa(["timeWorkerGetMsg: "+G,"timeBeforeSendBufferToWasm: "+a+" "+(a-G),"timeBeforeDecode: "+b+" "+(b-a),"timeFinishDecode: "+n+" "+(n-b)].join("\n"));break}case "decodeFileInMemory":{let a,b,n;try{b=v?Date.now():0,a=JSON.parse(y.get(w).decodeFileInMemory(m.bytes)),n=v?Date.now():0}catch(da){p(da,q);break}f.postMessage({type:"task",id:q,body:{success:!0,decodeReturn:a,
|
|
108
|
-
duration:n-b}});break}case "clearMapDecodeRecord":try{y.get(w).clearMapDecodeRecord()}catch(e){p(e,q);break}f.postMessage({type:"task",id:q,body:{success:!0}});break;case "getRuntimeSettings":{let a;try{a=y.get(w).getRuntimeSettings()}catch(h){p(h,q);break}f.postMessage({type:"task",id:q,body:{success:!0,results:a}});break}case "updateRuntimeSettings":{let a;try{a=JSON.parse(y.get(w).updateRuntimeSettings(m.settings))}catch(h){p(h,q);break}f.postMessage({type:"task",id:q,body:{success:!0,updateReturn:a}});
|
|
109
|
-
break}case "resetRuntimeSettings":try{let a=y.get(w);a.resetRuntimeSettings();let b=JSON.parse(a.getRuntimeSettings());a.bScanner?(b.localizationModes=[2,0,0,0,0,0,0,0],b.deblurLevel=0,b.barcodeZoneMinDistanceToImageBorders=9):(b.expectedBarcodesCount=512,b.scaleDownThreshold=1E5,b.timeout=1E5);W||(b.barcodeFormatIds=235931647);a.updateRuntimeSettings(JSON.stringify(b))}catch(e){p(b,q);break}f.postMessage({type:"task",id:q,body:{success:!0}});break;case "outputSettingsToString":{let a;try{a=y.get(w).outputSettingsToString()}catch(h){p(h,
|
|
110
|
-
q);break}f.postMessage({type:"task",id:q,body:{success:!0,results:a}});break}case "initRuntimeSettingsWithString":{let a;try{a=JSON.parse(y.get(w).initRuntimeSettingsWithString(m.settings))}catch(h){p(h,q);break}f.postMessage({type:"task",id:q,body:{success:!0,initReturn:a}});break}case "getIntermediateResults":{let a=[];try{var N=y.get(w).getIntermediateResults(),ca=JSON.parse(N,(b,e)=>"bytes"===b&&"ptr"in e&&"length"in e?(b=Module.BarcodeReaderWasm.getBytes(e.ptr,e.length),b=b.slice(0),a.push(b.buffer),
|
|
111
|
-
b):e)}catch(h){p(h,q);break}f.postMessage({type:"task",id:q,body:{success:!0,results:ca}},a);y.get(w).freeIntermediateResults();break}case "setModeArgument":{let a;try{a=JSON.parse(y.get(w).setModeArgument(m.modeName,m.index,m.argumentName,m.argumentValue))}catch(h){p(h,q);break}f.postMessage({type:"task",id:q,body:{success:!0,setReturn:a}});break}case "getModeArgument":{let a;try{a=JSON.parse(y.get(w).getModeArgument(m.modeName,m.index,m.argumentName))}catch(h){p(h,q);break}f.postMessage({type:"task",
|
|
112
|
-
id:q,body:{success:!0,getReturn:a}});break}case "updateScanSettings":try{let a=y.get(w),b=m.settings;a.duplicateForgetTime=b.duplicateForgetTime;a.oneDRememberFrameCount=b.oneDRememberFrameCount;a.oneDTrustFrameCount=b.oneDTrustFrameCount;b.frameFilter?a.setFrameFilter(JSON.stringify(b.frameFilter)):a.setFrameFilter("")}catch(e){p(e,q);break}f.postMessage({type:"task",id:q,body:{success:!0}});break;case "getScanSettings":m={};try{let a=y.get(w);m.duplicateForgetTime=a.duplicateForgetTime;m.oneDRememberFrameCount=
|
|
113
|
-
a.oneDRememberFrameCount;m.oneDTrustFrameCount=a.oneDTrustFrameCount;let b=a.getFrameFilter();b&&(m.frameFilter=JSON.parse(b))}catch(e){p(e,q);break}f.postMessage({type:"task",id:q,body:{success:!0,results:m}});break;default:console.warn("Unmatched task: ",b)}})};if(a)f.on("message",b);else f.onmessage=b;let I=a=>{f.postMessage({type:"log",message:a})},aa=a=>{v&&I(a)},p=(a,b)=>{f.postMessage({type:"task",id:b,body:{success:!1,message:a.message,stack:a.stack}});setTimeout(()=>{throw a;},0)}})();
|
|
Binary file
|
|
@@ -1,69 +0,0 @@
|
|
|
1
|
-
<!DOCTYPE html>
|
|
2
|
-
<html>
|
|
3
|
-
|
|
4
|
-
<head>
|
|
5
|
-
<title>Use Auto Feeder to scan</title>
|
|
6
|
-
<script src="../dist/dynamsoft.webtwain.min.js"></script>
|
|
7
|
-
</head>
|
|
8
|
-
|
|
9
|
-
<body style="padding: 30px;">
|
|
10
|
-
<lable id="ADF" style="font-size: x-large;" ><input type="checkbox" checked="checked">Auto Feeder</lable>
|
|
11
|
-
<input type="button" style="font-size: x-large;" id="acquireButton" value="Acquire" onclick="AcquireImage();" />
|
|
12
|
-
<input type="button" style="font-size: x-large;display:none;" id="mobileFile" value="Acquire" onclick="LoadImage()" />
|
|
13
|
-
<!-- dwtcontrolContainer is the default div id for Dynamic Web TWAIN control.
|
|
14
|
-
If you need to rename the id, you should also change the id in the dynamsoft.webtwain.config.js accordingly. -->
|
|
15
|
-
<br />
|
|
16
|
-
<br />
|
|
17
|
-
<div id="dwtcontrolContainer"></div>
|
|
18
|
-
|
|
19
|
-
<script type="text/javascript">
|
|
20
|
-
Dynamsoft.DWT.ResourcesPath = "../dist";
|
|
21
|
-
Dynamsoft.DWT.ProductKey = 't0078lQAAAA6/IlIbNC7kmlEwnoekMXbQCjKCIbXQPNX5YcTlkQ1q4R4g+O1GT800Pmu8OKFOEv81ye/RJPXBdG9de9pkHxXgXq2nohPqqh9G';
|
|
22
|
-
Dynamsoft.DWT.RegisterEvent('OnWebTwainReady', Dynamsoft_OnReady);
|
|
23
|
-
window.onload = function () {
|
|
24
|
-
if (Dynamsoft.Lib.env.bMobile) {
|
|
25
|
-
document.getElementById('ADF').style.display = "none";
|
|
26
|
-
document.getElementById('acquireButton').style.display = "none";
|
|
27
|
-
document.getElementById('mobileFile').style.display = "";
|
|
28
|
-
}
|
|
29
|
-
Dynamsoft.DWT.Containers = [{ContainerId:'dwtcontrolContainer', Width:600, Height:800}];
|
|
30
|
-
Dynamsoft.DWT.Load();
|
|
31
|
-
};
|
|
32
|
-
var DWObject;
|
|
33
|
-
|
|
34
|
-
function Dynamsoft_OnReady() {
|
|
35
|
-
DWObject = Dynamsoft.DWT.GetWebTwain('dwtcontrolContainer');
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
function AcquireImage() {
|
|
39
|
-
if (DWObject) {
|
|
40
|
-
DWObject.SelectSource(function () {
|
|
41
|
-
DWObject.OpenSource();
|
|
42
|
-
DWObject.AcquireImage(
|
|
43
|
-
{
|
|
44
|
-
IfShowUI: false,
|
|
45
|
-
IfFeederEnabled: document.getElementById("ADF").checked,
|
|
46
|
-
PixelType: Dynamsoft.DWT.EnumDWT_PixelType.TWPT_RGB,
|
|
47
|
-
Resolution: 200,
|
|
48
|
-
IfDisableSourceAfterAcquire: true
|
|
49
|
-
},
|
|
50
|
-
function () {
|
|
51
|
-
console.log("Successful!");
|
|
52
|
-
},
|
|
53
|
-
function (settings, errCode, errString) {
|
|
54
|
-
alert(errString)
|
|
55
|
-
}
|
|
56
|
-
);
|
|
57
|
-
}, function () {
|
|
58
|
-
alert('SelectSource failed!');
|
|
59
|
-
});
|
|
60
|
-
}
|
|
61
|
-
}
|
|
62
|
-
|
|
63
|
-
function LoadImage() {
|
|
64
|
-
DWObject.LoadImageEx('', 5);
|
|
65
|
-
}
|
|
66
|
-
</script>
|
|
67
|
-
</body>
|
|
68
|
-
|
|
69
|
-
</html>
|
package/samples/CustomScan.html
DELETED
|
@@ -1,98 +0,0 @@
|
|
|
1
|
-
<!DOCTYPE html>
|
|
2
|
-
<html>
|
|
3
|
-
|
|
4
|
-
<head>
|
|
5
|
-
<title>Custom Scan</title>
|
|
6
|
-
<script src="../dist/dynamsoft.webtwain.min.js"></script>
|
|
7
|
-
</head>
|
|
8
|
-
|
|
9
|
-
<body style="padding: 30px;">
|
|
10
|
-
<div id="scanOptions">
|
|
11
|
-
<label for="BW" >
|
|
12
|
-
<input type="radio" value="0" name="PixelType">B&W </label>
|
|
13
|
-
<label for="Gray">
|
|
14
|
-
<input type="radio" value="1" name="PixelType">Gray</label>
|
|
15
|
-
<label for="RGB">
|
|
16
|
-
<input type="radio" value="2" name="PixelType" checked="checked">Color</label>
|
|
17
|
-
|
|
|
18
|
-
|
|
19
|
-
<label>
|
|
20
|
-
<input type="checkbox" id="ADF" checked="checked">Auto Feeder</label>
|
|
21
|
-
<label>
|
|
22
|
-
<input type="checkbox" id="ShowUI" checked="checked">Show UI
|
|
23
|
-
<br />
|
|
24
|
-
</label>
|
|
25
|
-
|
|
26
|
-
<select id="Resolution">
|
|
27
|
-
<option value="100">100</option>
|
|
28
|
-
<option value="150">150</option>
|
|
29
|
-
<option value="200">200</option>
|
|
30
|
-
<option value="300">300</option>
|
|
31
|
-
</select>
|
|
32
|
-
<select id="source" style="position: relative; width: 220px;"></select>
|
|
33
|
-
|
|
34
|
-
<input type="button" value="Scan" onclick="AcquireImage();" />
|
|
35
|
-
</div>
|
|
36
|
-
<input type="button" id="mobileFile" value="Acquire" style="font-size: x-large;display:none" onclick="LoadImage()" />
|
|
37
|
-
<br />
|
|
38
|
-
<div id="dwtcontrolContainer"></div>
|
|
39
|
-
<script type="text/javascript">
|
|
40
|
-
Dynamsoft.DWT.ResourcesPath = "../dist";
|
|
41
|
-
Dynamsoft.DWT.ProductKey = 't0078lQAAAA6/IlIbNC7kmlEwnoekMXbQCjKCIbXQPNX5YcTlkQ1q4R4g+O1GT800Pmu8OKFOEv81ye/RJPXBdG9de9pkHxXgXq2nohPqqh9G';
|
|
42
|
-
Dynamsoft.DWT.RegisterEvent('OnWebTwainReady', Dynamsoft_OnReady); // Register OnWebTwainReady event. This event fires as soon as Dynamic Web TWAIN is initialized and ready to be used
|
|
43
|
-
window.onload = function () {
|
|
44
|
-
if (Dynamsoft.Lib.env.bMobile) {
|
|
45
|
-
document.getElementById('scanOptions').style.display = "none";
|
|
46
|
-
document.getElementById('mobileFile').style.display = "";
|
|
47
|
-
}
|
|
48
|
-
Dynamsoft.DWT.Containers = [{ContainerId:'dwtcontrolContainer', Width:600, Height:800}];
|
|
49
|
-
Dynamsoft.DWT.Load();
|
|
50
|
-
};
|
|
51
|
-
var DWObject;
|
|
52
|
-
|
|
53
|
-
function Dynamsoft_OnReady() {
|
|
54
|
-
DWObject = Dynamsoft.DWT.GetWebTwain('dwtcontrolContainer'); // Get the Dynamic Web TWAIN object that is embeded in the div with id 'dwtcontrolContainer'
|
|
55
|
-
if (DWObject) {
|
|
56
|
-
var count = DWObject.SourceCount;
|
|
57
|
-
for (var i = 0; i < count; i++)
|
|
58
|
-
document.getElementById("source").options.add(new Option(DWObject.GetSourceNameItems(i), i));
|
|
59
|
-
}
|
|
60
|
-
}
|
|
61
|
-
|
|
62
|
-
function AcquireImage() {
|
|
63
|
-
if (DWObject) {
|
|
64
|
-
DWObject.SelectSourceByIndex(document.getElementById("source").selectedIndex);
|
|
65
|
-
DWObject.OpenSource();
|
|
66
|
-
var pixelType = 2;
|
|
67
|
-
var pixelTypeInputs = document.getElementsByName("PixelType");
|
|
68
|
-
for (var i = 0; i < pixelTypeInputs.length; i++) {
|
|
69
|
-
if (pixelTypeInputs[i].checked) {
|
|
70
|
-
pixelType = pixelTypeInputs[i].value;
|
|
71
|
-
break;
|
|
72
|
-
}
|
|
73
|
-
}
|
|
74
|
-
DWObject.AcquireImage(
|
|
75
|
-
{
|
|
76
|
-
IfShowUI: document.getElementById("ShowUI").checked,
|
|
77
|
-
IfFeederEnabled: document.getElementById("ADF").checked,
|
|
78
|
-
PixelType: pixelType,
|
|
79
|
-
Resolution: parseInt(document.getElementById("Resolution").value),
|
|
80
|
-
IfDisableSourceAfterAcquire: true
|
|
81
|
-
},
|
|
82
|
-
function () {
|
|
83
|
-
console.log("Successful!");
|
|
84
|
-
},
|
|
85
|
-
function (settings, errCode, errString) {
|
|
86
|
-
alert(errString)
|
|
87
|
-
}
|
|
88
|
-
);
|
|
89
|
-
}
|
|
90
|
-
}
|
|
91
|
-
|
|
92
|
-
function LoadImage() {
|
|
93
|
-
DWObject.LoadImageEx('', 5);
|
|
94
|
-
}
|
|
95
|
-
</script>
|
|
96
|
-
</body>
|
|
97
|
-
|
|
98
|
-
</html>
|
package/samples/Edit.html
DELETED
|
@@ -1,111 +0,0 @@
|
|
|
1
|
-
<!DOCTYPE html>
|
|
2
|
-
<html>
|
|
3
|
-
|
|
4
|
-
<head>
|
|
5
|
-
<title>Use Dynamic Web TWAIN's Editing features</title>
|
|
6
|
-
<script src="../dist/dynamsoft.webtwain.min.js"></script>
|
|
7
|
-
</head>
|
|
8
|
-
|
|
9
|
-
<body style="padding: 30px;">
|
|
10
|
-
<input type="button" style="font-size: x-large;" value="Scan" onclick="AcquireImage();" />
|
|
11
|
-
<input type="button" style="font-size: x-large;" value="Load" onclick="LoadImage();" />
|
|
12
|
-
<input type="button" style="font-size: x-large;" value="Rotate Left" onclick="RotateLeft();" />
|
|
13
|
-
<input type="button" style="font-size: x-large;" value="Rotate Right" onclick="RotateRight();" />
|
|
14
|
-
<input type="button" style="font-size: x-large;" value="Mirror" onclick="Mirror();" />
|
|
15
|
-
<input type="button" style="font-size: x-large;" value="Flip" onclick="Flip();" />
|
|
16
|
-
<input type="button" style="font-size: x-large;" value="Show Image Editor" onclick="ShowImageEditor();" />
|
|
17
|
-
<br />
|
|
18
|
-
<br />
|
|
19
|
-
<!-- dwtcontrolContainer is the default div id for Dynamic Web TWAIN control.
|
|
20
|
-
If you need to rename the id, you should also change the id in the dynamsoft.webtwain.config.js accordingly. -->
|
|
21
|
-
<div id="dwtcontrolContainer"></div>
|
|
22
|
-
|
|
23
|
-
<script type="text/javascript">
|
|
24
|
-
Dynamsoft.DWT.ResourcesPath = "../dist";
|
|
25
|
-
Dynamsoft.DWT.ProductKey = 't0078lQAAAA6/IlIbNC7kmlEwnoekMXbQCjKCIbXQPNX5YcTlkQ1q4R4g+O1GT800Pmu8OKFOEv81ye/RJPXBdG9de9pkHxXgXq2nohPqqh9G';
|
|
26
|
-
window.onload = function () {
|
|
27
|
-
Dynamsoft.DWT.Containers = [{ContainerId:'dwtcontrolContainer', Width:700, Height:800}];
|
|
28
|
-
Dynamsoft.DWT.Load();
|
|
29
|
-
};
|
|
30
|
-
|
|
31
|
-
var console = window['console'] ? window['console'] : { 'log': function () { } };
|
|
32
|
-
Dynamsoft.DWT.RegisterEvent('OnWebTwainReady', Dynamsoft_OnReady); // Register OnWebTwainReady event. This event fires as soon as Dynamic Web TWAIN is initialized and ready to be used
|
|
33
|
-
|
|
34
|
-
var DWObject;
|
|
35
|
-
|
|
36
|
-
function Dynamsoft_OnReady() {
|
|
37
|
-
DWObject = Dynamsoft.DWT.GetWebTwain('dwtcontrolContainer'); // Get the Dynamic Web TWAIN object that is embeded in the div with id 'dwtcontrolContainer'
|
|
38
|
-
}
|
|
39
|
-
|
|
40
|
-
function AcquireImage() {
|
|
41
|
-
if (DWObject) {
|
|
42
|
-
DWObject.SelectSource(function () {
|
|
43
|
-
var OnAcquireImageSuccess, OnAcquireImageFailure;
|
|
44
|
-
OnAcquireImageSuccess = OnAcquireImageFailure = function () {
|
|
45
|
-
DWObject.CloseSource();
|
|
46
|
-
};
|
|
47
|
-
|
|
48
|
-
DWObject.OpenSource();
|
|
49
|
-
DWObject.IfDisableSourceAfterAcquire = true; // Scanner source will be disabled/closed automatically after the scan.
|
|
50
|
-
DWObject.AcquireImage(OnAcquireImageSuccess, OnAcquireImageFailure);
|
|
51
|
-
}, function () {
|
|
52
|
-
console.log('SelectSource failed!');
|
|
53
|
-
});
|
|
54
|
-
}
|
|
55
|
-
}
|
|
56
|
-
|
|
57
|
-
//Callback functions for async APIs
|
|
58
|
-
function OnSuccess() {
|
|
59
|
-
console.log('successful');
|
|
60
|
-
}
|
|
61
|
-
|
|
62
|
-
function OnFailure(errorCode, errorString) {
|
|
63
|
-
alert(errorString);
|
|
64
|
-
}
|
|
65
|
-
|
|
66
|
-
function LoadImage() {
|
|
67
|
-
if (DWObject) {
|
|
68
|
-
DWObject.IfShowFileDialog = true; // Open the system's file dialog to load image
|
|
69
|
-
DWObject.LoadImageEx("", Dynamsoft.DWT.EnumDWT_ImageType.IT_ALL, OnSuccess, OnFailure); // Load images in all supported formats (.bmp, .jpg, .tif, .png, .pdf). OnSuccess or OnFailure will be called after the operation
|
|
70
|
-
}
|
|
71
|
-
}
|
|
72
|
-
|
|
73
|
-
function RotateLeft() {
|
|
74
|
-
if (DWObject)
|
|
75
|
-
if (DWObject.HowManyImagesInBuffer > 0)
|
|
76
|
-
DWObject.RotateLeft(DWObject.CurrentImageIndexInBuffer);
|
|
77
|
-
}
|
|
78
|
-
|
|
79
|
-
function RotateRight() {
|
|
80
|
-
if (DWObject)
|
|
81
|
-
if (DWObject.HowManyImagesInBuffer > 0)
|
|
82
|
-
DWObject.RotateRight(DWObject.CurrentImageIndexInBuffer);
|
|
83
|
-
}
|
|
84
|
-
|
|
85
|
-
function Mirror() {
|
|
86
|
-
if (DWObject)
|
|
87
|
-
if (DWObject.HowManyImagesInBuffer > 0)
|
|
88
|
-
DWObject.Mirror(DWObject.CurrentImageIndexInBuffer);
|
|
89
|
-
}
|
|
90
|
-
|
|
91
|
-
function Flip() {
|
|
92
|
-
if (DWObject)
|
|
93
|
-
if (DWObject.HowManyImagesInBuffer > 0)
|
|
94
|
-
DWObject.Flip(DWObject.CurrentImageIndexInBuffer);
|
|
95
|
-
|
|
96
|
-
}
|
|
97
|
-
|
|
98
|
-
function ShowImageEditor() {
|
|
99
|
-
if (DWObject) {
|
|
100
|
-
if (DWObject.HowManyImagesInBuffer == 0)
|
|
101
|
-
alert("There is no image in buffer.");
|
|
102
|
-
else{
|
|
103
|
-
var imageEditor = DWObject.Viewer.createImageEditor();
|
|
104
|
-
imageEditor.show();
|
|
105
|
-
}
|
|
106
|
-
}
|
|
107
|
-
}
|
|
108
|
-
</script>
|
|
109
|
-
</body>
|
|
110
|
-
|
|
111
|
-
</html>
|
|
@@ -1,103 +0,0 @@
|
|
|
1
|
-
<!DOCTYPE html>
|
|
2
|
-
<html>
|
|
3
|
-
|
|
4
|
-
<head>
|
|
5
|
-
<title>Use Dynamic Web TWAIN to load and save images</title>
|
|
6
|
-
<script src="../dist/dynamsoft.webtwain.min.js"></script>
|
|
7
|
-
</head>
|
|
8
|
-
|
|
9
|
-
<body style="padding: 30px;">
|
|
10
|
-
<input type="button" style="font-size: x-large;" value="Scan and Save" onclick="AcquireImage();" />
|
|
11
|
-
<input type="button" style="font-size: x-large;" value="Load" onclick="LoadImage();" />
|
|
12
|
-
<input type="button" style="font-size: x-large;" value="Save" onclick="SaveWithFileDialog();" />
|
|
13
|
-
<br />
|
|
14
|
-
<label style="font-size: x-large;">
|
|
15
|
-
<input type="radio" value="jpg" name="ImageType" id="imgTypejpeg" />JPEG</label>
|
|
16
|
-
<label style="font-size: x-large;">
|
|
17
|
-
<input type="radio" value="tif" name="ImageType" id="imgTypetiff" />TIFF</label>
|
|
18
|
-
<label style="font-size: x-large;">
|
|
19
|
-
<input type="radio" value="pdf" name="ImageType" id="imgTypepdf" checked="checked" />PDF</label>
|
|
20
|
-
<br />
|
|
21
|
-
<br />
|
|
22
|
-
<!-- dwtcontrolContainer is the default div id for Dynamic Web TWAIN control.
|
|
23
|
-
If you need to rename the id, you should also change the id in dynamsoft.webtwain.config.js accordingly. -->
|
|
24
|
-
<div id="dwtcontrolContainer"></div>
|
|
25
|
-
|
|
26
|
-
<script type="text/javascript">
|
|
27
|
-
Dynamsoft.DWT.ResourcesPath = "../dist";
|
|
28
|
-
Dynamsoft.DWT.ProductKey = 't0078lQAAAA6/IlIbNC7kmlEwnoekMXbQCjKCIbXQPNX5YcTlkQ1q4R4g+O1GT800Pmu8OKFOEv81ye/RJPXBdG9de9pkHxXgXq2nohPqqh9G';
|
|
29
|
-
window.onload = function () {
|
|
30
|
-
Dynamsoft.DWT.Containers = [{ContainerId:'dwtcontrolContainer', Width:600, Height:800}];
|
|
31
|
-
Dynamsoft.DWT.Load();
|
|
32
|
-
};
|
|
33
|
-
|
|
34
|
-
var console = window['console'] ? window['console'] : { 'log': function () { } };
|
|
35
|
-
Dynamsoft.DWT.RegisterEvent('OnWebTwainReady', Dynamsoft_OnReady); // Register OnWebTwainReady event. This event fires as soon as Dynamic Web TWAIN is initialized and ready to be used
|
|
36
|
-
|
|
37
|
-
var DWObject;
|
|
38
|
-
|
|
39
|
-
function Dynamsoft_OnReady() {
|
|
40
|
-
DWObject = Dynamsoft.DWT.GetWebTwain('dwtcontrolContainer'); // Get the Dynamic Web TWAIN object that is embeded in the div with id 'dwtcontrolContainer'
|
|
41
|
-
if (DWObject) {
|
|
42
|
-
DWObject.RegisterEvent('OnPostAllTransfers', function(){setTimeout(SaveWithFileDialog,20);});
|
|
43
|
-
}
|
|
44
|
-
}
|
|
45
|
-
|
|
46
|
-
function AcquireImage() {
|
|
47
|
-
if (DWObject) {
|
|
48
|
-
DWObject.SelectSource(function () {
|
|
49
|
-
var OnAcquireImageSuccess, OnAcquireImageFailure;
|
|
50
|
-
OnAcquireImageSuccess = OnAcquireImageFailure = function () {
|
|
51
|
-
DWObject.CloseSource();
|
|
52
|
-
};
|
|
53
|
-
|
|
54
|
-
DWObject.OpenSource();
|
|
55
|
-
DWObject.IfDisableSourceAfterAcquire = true; // Scanner source will be disabled/closed automatically after the scan.
|
|
56
|
-
DWObject.AcquireImage(OnAcquireImageSuccess, OnAcquireImageFailure);
|
|
57
|
-
}, function () {
|
|
58
|
-
console.log('SelectSource failed!');
|
|
59
|
-
});
|
|
60
|
-
}
|
|
61
|
-
}
|
|
62
|
-
|
|
63
|
-
//Callback functions for async APIs
|
|
64
|
-
function OnSuccess() {
|
|
65
|
-
console.log('successful');
|
|
66
|
-
}
|
|
67
|
-
|
|
68
|
-
function OnFailure(errorCode, errorString) {
|
|
69
|
-
if(errorCode != -2326)
|
|
70
|
-
alert(errorString);
|
|
71
|
-
}
|
|
72
|
-
|
|
73
|
-
function LoadImage() {
|
|
74
|
-
if (DWObject) {
|
|
75
|
-
DWObject.IfShowFileDialog = true; // Open the system's file dialog to load image
|
|
76
|
-
DWObject.LoadImageEx("", Dynamsoft.DWT.EnumDWT_ImageType.IT_ALL, OnSuccess, OnFailure); // Load images in all supported formats (.bmp, .jpg, .tif, .png, .pdf). OnSuccess or OnFailure will be called after the operation
|
|
77
|
-
}
|
|
78
|
-
}
|
|
79
|
-
|
|
80
|
-
function SaveWithFileDialog() {
|
|
81
|
-
if (DWObject) {
|
|
82
|
-
if (DWObject.HowManyImagesInBuffer > 0) {
|
|
83
|
-
DWObject.IfShowFileDialog = true;
|
|
84
|
-
if (document.getElementById("imgTypejpeg").checked == true) {
|
|
85
|
-
//If the current image is B&W
|
|
86
|
-
//1 is B&W, 8 is Gray, 24 is RGB
|
|
87
|
-
if (DWObject.GetImageBitDepth(DWObject.CurrentImageIndexInBuffer) == 1)
|
|
88
|
-
//If so, convert the image to Gray
|
|
89
|
-
DWObject.ConvertToGrayScale(DWObject.CurrentImageIndexInBuffer);
|
|
90
|
-
//Save image in JPEG
|
|
91
|
-
DWObject.SaveAsJPEG("DynamicWebTWAIN.jpg", DWObject.CurrentImageIndexInBuffer);
|
|
92
|
-
}
|
|
93
|
-
else if (document.getElementById("imgTypetiff").checked == true)
|
|
94
|
-
DWObject.SaveAllAsMultiPageTIFF("DynamicWebTWAIN.tiff", OnSuccess, OnFailure);
|
|
95
|
-
else if (document.getElementById("imgTypepdf").checked == true)
|
|
96
|
-
DWObject.SaveAllAsPDF("DynamicWebTWAIN.pdf", OnSuccess, OnFailure);
|
|
97
|
-
}
|
|
98
|
-
}
|
|
99
|
-
}
|
|
100
|
-
</script>
|
|
101
|
-
</body>
|
|
102
|
-
|
|
103
|
-
</html>
|