-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathdynamsoft.webtwain.initiate.js
53 lines (50 loc) · 956 KB
/
dynamsoft.webtwain.initiate.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
/*! 20241010102903 - 20230504
* Dynamsoft JavaScript Library
* Product: Dynamic Web TWAIN
* Web Site: https://www.dynamsoft.com
*
* Copyright 2024, Dynamsoft Corporation
* Author: Dynamsoft Support Team
* Version: 18.5.1
*/
var globalThis=self||window||{},Dynamsoft=globalThis.Dynamsoft||{};
(function(b){if(!b.DWT){b.DWT={}}if(!b.DWT.LTS){b.DWT.LTS={}}if(!b.Lib){b.Lib={}}if(!b.Lib.UI){b.Lib.UI={}}if(!b.Lib.html5){b.Lib.html5={}}globalThis.Dynamsoft=b})(Dynamsoft);
(function(e){if(!e.WeakSet){e.WeakSet=b;var c=Date.now()%1E9;function b(a){this.name="__st"+(1E9*Math.random()>>>0)+(c++ +"__");a&&a.forEach&&a.forEach(this.add,this)}var z=b.prototype;z.add=function(a){var d=this.name;a[d]||Object.defineProperty(a,d,{value:!0,writable:!0});return this};z["delete"]=function(a){if(!a[this.name])return!1;a[this.name]=void 0;return!0};z.has=function(a){return!!a[this.name]};}
if(!e.WeakMap){var r=Object.prototype.hasOwnProperty;var n=Object.defineProperty&&function(){try{return Object.defineProperty({},"x",{value:1}).x===1}catch(e){}}();var i=function(e,t,r){if(n){Object.defineProperty(e,t,{configurable:true,writable:true,value:r})}else{e[t]=r}};e.WeakMap=function(){function WeakMap(){if(this===void 0){throw new TypeError("Constructor WeakMap requires 'new'")}i(this,"_id",genId("_WeakMap"));if(arguments.length>0){throw new TypeError("WeakMap iterable is not supported")}}i(WeakMap.prototype,"delete",function(e){checkInstance(this,"delete");if(!isObject(e)){return false}var t=e[this._id];if(t&&t[0]===e){delete e[this._id];return true}return false});i(WeakMap.prototype,"get",function(e){checkInstance(this,"get");if(!isObject(e)){return void 0}var t=e[this._id];if(t&&t[0]===e){return t[1]}return void 0});i(WeakMap.prototype,"has",function(e){checkInstance(this,"has");if(!isObject(e)){return false}var t=e[this._id];if(t&&t[0]===e){return true}return false});i(WeakMap.prototype,"set",function(e,t){checkInstance(this,"set");if(!isObject(e)){throw new TypeError("Invalid value used as weak map key")}var r=e[this._id];if(r&&r[0]===e){r[1]=t;return this}i(e,this._id,[e,t]);return this});function checkInstance(e,t){if(!isObject(e)||!r.call(e,"_id")){throw new TypeError(t+" method called on incompatible receiver "+typeof e)}}function genId(e){return e+"_"+rand()+"."+rand()}function rand(){return Math.random().toString().substring(2)}i(WeakMap,"_polyfill",true);return WeakMap}();function isObject(e){return Object(e)===e}}})(typeof globalThis!=="undefined"?globalThis:typeof self!=="undefined"?self:typeof window!=="undefined"?window:typeof global!=="undefined"?global:this);
if(!Dynamsoft.Lib.jsinited){Dynamsoft.Lib.jsinited=1;
(function(factory){if(typeof exports==="object"){module.exports=factory()}else if(typeof define==="function"&&define.amd){define(factory)}else{var glob;try{glob=window}catch(e){glob=self}glob.SparkMD5=factory()}})(function(undefined){"use strict";var add32=function(a,b){return a+b&4294967295},hex_chr=["0","1","2","3","4","5","6","7","8","9","a","b","c","d","e","f"];function cmn(q,a,b,x,s,t){a=add32(add32(a,q),add32(x,t));return add32(a<<s|a>>>32-s,b)}function md5cycle(x,k){var a=x[0],b=x[1],c=x[2],d=x[3];a+=(b&c|~b&d)+k[0]-680876936|0;a=(a<<7|a>>>25)+b|0;d+=(a&b|~a&c)+k[1]-389564586|0;d=(d<<12|d>>>20)+a|0;c+=(d&a|~d&b)+k[2]+606105819|0;c=(c<<17|c>>>15)+d|0;b+=(c&d|~c&a)+k[3]-1044525330|0;b=(b<<22|b>>>10)+c|0;a+=(b&c|~b&d)+k[4]-176418897|0;a=(a<<7|a>>>25)+b|0;d+=(a&b|~a&c)+k[5]+1200080426|0;d=(d<<12|d>>>20)+a|0;c+=(d&a|~d&b)+k[6]-1473231341|0;c=(c<<17|c>>>15)+d|0;b+=(c&d|~c&a)+k[7]-45705983|0;b=(b<<22|b>>>10)+c|0;a+=(b&c|~b&d)+k[8]+1770035416|0;a=(a<<7|a>>>25)+b|0;d+=(a&b|~a&c)+k[9]-1958414417|0;d=(d<<12|d>>>20)+a|0;c+=(d&a|~d&b)+k[10]-42063|0;c=(c<<17|c>>>15)+d|0;b+=(c&d|~c&a)+k[11]-1990404162|0;b=(b<<22|b>>>10)+c|0;a+=(b&c|~b&d)+k[12]+1804603682|0;a=(a<<7|a>>>25)+b|0;d+=(a&b|~a&c)+k[13]-40341101|0;d=(d<<12|d>>>20)+a|0;c+=(d&a|~d&b)+k[14]-1502002290|0;c=(c<<17|c>>>15)+d|0;b+=(c&d|~c&a)+k[15]+1236535329|0;b=(b<<22|b>>>10)+c|0;a+=(b&d|c&~d)+k[1]-165796510|0;a=(a<<5|a>>>27)+b|0;d+=(a&c|b&~c)+k[6]-1069501632|0;d=(d<<9|d>>>23)+a|0;c+=(d&b|a&~b)+k[11]+643717713|0;c=(c<<14|c>>>18)+d|0;b+=(c&a|d&~a)+k[0]-373897302|0;b=(b<<20|b>>>12)+c|0;a+=(b&d|c&~d)+k[5]-701558691|0;a=(a<<5|a>>>27)+b|0;d+=(a&c|b&~c)+k[10]+38016083|0;d=(d<<9|d>>>23)+a|0;c+=(d&b|a&~b)+k[15]-660478335|0;c=(c<<14|c>>>18)+d|0;b+=(c&a|d&~a)+k[4]-405537848|0;b=(b<<20|b>>>12)+c|0;a+=(b&d|c&~d)+k[9]+568446438|0;a=(a<<5|a>>>27)+b|0;d+=(a&c|b&~c)+k[14]-1019803690|0;d=(d<<9|d>>>23)+a|0;c+=(d&b|a&~b)+k[3]-187363961|0;c=(c<<14|c>>>18)+d|0;b+=(c&a|d&~a)+k[8]+1163531501|0;b=(b<<20|b>>>12)+c|0;a+=(b&d|c&~d)+k[13]-1444681467|0;a=(a<<5|a>>>27)+b|0;d+=(a&c|b&~c)+k[2]-51403784|0;d=(d<<9|d>>>23)+a|0;c+=(d&b|a&~b)+k[7]+1735328473|0;c=(c<<14|c>>>18)+d|0;b+=(c&a|d&~a)+k[12]-1926607734|0;b=(b<<20|b>>>12)+c|0;a+=(b^c^d)+k[5]-378558|0;a=(a<<4|a>>>28)+b|0;d+=(a^b^c)+k[8]-2022574463|0;d=(d<<11|d>>>21)+a|0;c+=(d^a^b)+k[11]+1839030562|0;c=(c<<16|c>>>16)+d|0;b+=(c^d^a)+k[14]-35309556|0;b=(b<<23|b>>>9)+c|0;a+=(b^c^d)+k[1]-1530992060|0;a=(a<<4|a>>>28)+b|0;d+=(a^b^c)+k[4]+1272893353|0;d=(d<<11|d>>>21)+a|0;c+=(d^a^b)+k[7]-155497632|0;c=(c<<16|c>>>16)+d|0;b+=(c^d^a)+k[10]-1094730640|0;b=(b<<23|b>>>9)+c|0;a+=(b^c^d)+k[13]+681279174|0;a=(a<<4|a>>>28)+b|0;d+=(a^b^c)+k[0]-358537222|0;d=(d<<11|d>>>21)+a|0;c+=(d^a^b)+k[3]-722521979|0;c=(c<<16|c>>>16)+d|0;b+=(c^d^a)+k[6]+76029189|0;b=(b<<23|b>>>9)+c|0;a+=(b^c^d)+k[9]-640364487|0;a=(a<<4|a>>>28)+b|0;d+=(a^b^c)+k[12]-421815835|0;d=(d<<11|d>>>21)+a|0;c+=(d^a^b)+k[15]+530742520|0;c=(c<<16|c>>>16)+d|0;b+=(c^d^a)+k[2]-995338651|0;b=(b<<23|b>>>9)+c|0;a+=(c^(b|~d))+k[0]-198630844|0;a=(a<<6|a>>>26)+b|0;d+=(b^(a|~c))+k[7]+1126891415|0;d=(d<<10|d>>>22)+a|0;c+=(a^(d|~b))+k[14]-1416354905|0;c=(c<<15|c>>>17)+d|0;b+=(d^(c|~a))+k[5]-57434055|0;b=(b<<21|b>>>11)+c|0;a+=(c^(b|~d))+k[12]+1700485571|0;a=(a<<6|a>>>26)+b|0;d+=(b^(a|~c))+k[3]-1894986606|0;d=(d<<10|d>>>22)+a|0;c+=(a^(d|~b))+k[10]-1051523|0;c=(c<<15|c>>>17)+d|0;b+=(d^(c|~a))+k[1]-2054922799|0;b=(b<<21|b>>>11)+c|0;a+=(c^(b|~d))+k[8]+1873313359|0;a=(a<<6|a>>>26)+b|0;d+=(b^(a|~c))+k[15]-30611744|0;d=(d<<10|d>>>22)+a|0;c+=(a^(d|~b))+k[6]-1560198380|0;c=(c<<15|c>>>17)+d|0;b+=(d^(c|~a))+k[13]+1309151649|0;b=(b<<21|b>>>11)+c|0;a+=(c^(b|~d))+k[4]-145523070|0;a=(a<<6|a>>>26)+b|0;d+=(b^(a|~c))+k[11]-1120210379|0;d=(d<<10|d>>>22)+a|0;c+=(a^(d|~b))+k[2]+718787259|0;c=(c<<15|c>>>17)+d|0;b+=(d^(c|~a))+k[9]-343485551|0;b=(b<<21|b>>>11)+c|0;x[0]=a+x[0]|0;x[1]=b+x[1]|0;x[2]=c+x[2]|0;x[3]=d+x[3]|0}function md5blk(s){var md5blks=[],i;for(i=0;i<64;i+=4){md5blks[i>>2]=s.charCodeAt(i)+(s.charCodeAt(i+1)<<8)+(s.charCodeAt(i+2)<<16)+(s.charCodeAt(i+3)<<24)}return md5blks}function md5blk_array(a){var md5blks=[],i;for(i=0;i<64;i+=4){md5blks[i>>2]=a[i]+(a[i+1]<<8)+(a[i+2]<<16)+(a[i+3]<<24)}return md5blks}function md51(s){var n=s.length,state=[1732584193,-271733879,-1732584194,271733878],i,length,tail,tmp,lo,hi;for(i=64;i<=n;i+=64){md5cycle(state,md5blk(s.substring(i-64,i)))}s=s.substring(i-64);length=s.length;tail=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0];for(i=0;i<length;i+=1){tail[i>>2]|=s.charCodeAt(i)<<(i%4<<3)}tail[i>>2]|=128<<(i%4<<3);if(i>55){md5cycle(state,tail);for(i=0;i<16;i+=1){tail[i]=0}}tmp=n*8;tmp=tmp.toString(16).match(/(.*?)(.{0,8})$/);lo=parseInt(tmp[2],16);hi=parseInt(tmp[1],16)||0;tail[14]=lo;tail[15]=hi;md5cycle(state,tail);return state}function md51_array(a){var n=a.length,state=[1732584193,-271733879,-1732584194,271733878],i,length,tail,tmp,lo,hi;for(i=64;i<=n;i+=64){md5cycle(state,md5blk_array(a.subarray(i-64,i)))}a=i-64<n?a.subarray(i-64):new Uint8Array(0);length=a.length;tail=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0];for(i=0;i<length;i+=1){tail[i>>2]|=a[i]<<(i%4<<3)}tail[i>>2]|=128<<(i%4<<3);if(i>55){md5cycle(state,tail);for(i=0;i<16;i+=1){tail[i]=0}}tmp=n*8;tmp=tmp.toString(16).match(/(.*?)(.{0,8})$/);lo=parseInt(tmp[2],16);hi=parseInt(tmp[1],16)||0;tail[14]=lo;tail[15]=hi;md5cycle(state,tail);return state}function rhex(n){var s="",j;for(j=0;j<4;j+=1){s+=hex_chr[n>>j*8+4&15]+hex_chr[n>>j*8&15]}return s}function hex(x){var i;for(i=0;i<x.length;i+=1){x[i]=rhex(x[i])}return x.join("")}if(hex(md51("hello"))!=="5d41402abc4b2a76b9719d911017c592"){add32=function(x,y){var lsw=(x&65535)+(y&65535),msw=(x>>16)+(y>>16)+(lsw>>16);return msw<<16|lsw&65535}}if(typeof ArrayBuffer!=="undefined"&&!ArrayBuffer.prototype.slice){(function(){function clamp(val,length){val=val|0||0;if(val<0){return Math.max(val+length,0)}return Math.min(val,length)}ArrayBuffer.prototype.slice=function(from,to){var length=this.byteLength,begin=clamp(from,length),end=length,num,target,targetArray,sourceArray;if(to!==undefined){end=clamp(to,length)}if(begin>end){return new ArrayBuffer(0)}num=end-begin;target=new ArrayBuffer(num);targetArray=new Uint8Array(target);sourceArray=new Uint8Array(this,begin,num);targetArray.set(sourceArray);return target}})()}function toUtf8(str){if(/[\u0080-\uFFFF]/.test(str)){str=unescape(encodeURIComponent(str))}return str}function utf8Str2ArrayBuffer(str,returnUInt8Array){var length=str.length,buff=new ArrayBuffer(length),arr=new Uint8Array(buff),i;for(i=0;i<length;i+=1){arr[i]=str.charCodeAt(i)}return returnUInt8Array?arr:buff}function arrayBuffer2Utf8Str(buff){return String.fromCharCode.apply(null,new Uint8Array(buff))}function concatenateArrayBuffers(first,second,returnUInt8Array){var result=new Uint8Array(first.byteLength+second.byteLength);result.set(new Uint8Array(first));result.set(new Uint8Array(second),first.byteLength);return returnUInt8Array?result:result.buffer}function hexToBinaryString(hex){var bytes=[],length=hex.length,x;for(x=0;x<length-1;x+=2){bytes.push(parseInt(hex.substr(x,2),16))}return String.fromCharCode.apply(String,bytes)}function SparkMD5(){this.reset()}SparkMD5.prototype.append=function(str){this.appendBinary(toUtf8(str));return this};SparkMD5.prototype.appendBinary=function(contents){this._buff+=contents;this._length+=contents.length;var length=this._buff.length,i;for(i=64;i<=length;i+=64){md5cycle(this._hash,md5blk(this._buff.substring(i-64,i)))}this._buff=this._buff.substring(i-64);return this};SparkMD5.prototype.end=function(raw){var buff=this._buff,length=buff.length,i,tail=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],ret;for(i=0;i<length;i+=1){tail[i>>2]|=buff.charCodeAt(i)<<(i%4<<3)}this._finish(tail,length);ret=hex(this._hash);if(raw){ret=hexToBinaryString(ret)}this.reset();return ret};SparkMD5.prototype.reset=function(){this._buff="";this._length=0;this._hash=[1732584193,-271733879,-1732584194,271733878];return this};SparkMD5.prototype.getState=function(){return{buff:this._buff,length:this._length,hash:this._hash.slice()}};SparkMD5.prototype.setState=function(state){this._buff=state.buff;this._length=state.length;this._hash=state.hash;return this};SparkMD5.prototype.destroy=function(){delete this._hash;delete this._buff;delete this._length};SparkMD5.prototype._finish=function(tail,length){var i=length,tmp,lo,hi;tail[i>>2]|=128<<(i%4<<3);if(i>55){md5cycle(this._hash,tail);for(i=0;i<16;i+=1){tail[i]=0}}tmp=this._length*8;tmp=tmp.toString(16).match(/(.*?)(.{0,8})$/);lo=parseInt(tmp[2],16);hi=parseInt(tmp[1],16)||0;tail[14]=lo;tail[15]=hi;md5cycle(this._hash,tail)};SparkMD5.hash=function(str,raw){return SparkMD5.hashBinary(toUtf8(str),raw)};SparkMD5.hashBinary=function(content,raw){var hash=md51(content),ret=hex(hash);return raw?hexToBinaryString(ret):ret};SparkMD5.ArrayBuffer=function(){this.reset()};SparkMD5.ArrayBuffer.prototype.append=function(arr){var buff=concatenateArrayBuffers(this._buff.buffer,arr,true),length=buff.length,i;this._length+=arr.byteLength;for(i=64;i<=length;i+=64){md5cycle(this._hash,md5blk_array(buff.subarray(i-64,i)))}this._buff=i-64<length?new Uint8Array(buff.buffer.slice(i-64)):new Uint8Array(0);return this};SparkMD5.ArrayBuffer.prototype.end=function(raw){var buff=this._buff,length=buff.length,tail=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],i,ret;for(i=0;i<length;i+=1){tail[i>>2]|=buff[i]<<(i%4<<3)}this._finish(tail,length);ret=hex(this._hash);if(raw){ret=hexToBinaryString(ret)}this.reset();return ret};SparkMD5.ArrayBuffer.prototype.reset=function(){this._buff=new Uint8Array(0);this._length=0;this._hash=[1732584193,-271733879,-1732584194,271733878];return this};SparkMD5.ArrayBuffer.prototype.getState=function(){var state=SparkMD5.prototype.getState.call(this);state.buff=arrayBuffer2Utf8Str(state.buff);return state};SparkMD5.ArrayBuffer.prototype.setState=function(state){state.buff=utf8Str2ArrayBuffer(state.buff,true);return SparkMD5.prototype.setState.call(this,state)};SparkMD5.ArrayBuffer.prototype.destroy=SparkMD5.prototype.destroy;SparkMD5.ArrayBuffer.prototype._finish=SparkMD5.prototype._finish;SparkMD5.ArrayBuffer.hash=function(arr,raw){var hash=md51_array(new Uint8Array(arr)),ret=hex(hash);return raw?hexToBinaryString(ret):ret};return SparkMD5});
if(window && !window['Promise']){
/* @preserve
* The MIT License (MIT)
*
* Copyright (c) 2013-2018 Petka Antonov
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*
*/
/**
* bluebird build version 3.7.2
* Features enabled: core, race, call_get, generators, map, nodeify, promisify, props, reduce, settle, some, using, timers, filter, any, each
*/
!function(t){if("object"==typeof exports&&"undefined"!=typeof module)module.exports=t();else if("function"==typeof define&&define.amd)define([],t);else{var e;"undefined"!=typeof window?e=window:"undefined"!=typeof global?e=global:"undefined"!=typeof self&&(e=self),e.Promise=t()}}(function(){var t,e,n;return function r(t,e,n){function i(s,a){if(!e[s]){if(!t[s]){var c="function"==typeof _dereq_&&_dereq_;if(!a&&c)return c(s,!0);if(o)return o(s,!0);var u=new Error("Cannot find module '"+s+"'");throw u.code="MODULE_NOT_FOUND",u}var l=e[s]={exports:{}};t[s][0].call(l.exports,function(e){var n=t[s][1][e];return i(n?n:e)},l,l.exports,r,t,e,n)}return e[s].exports}for(var o="function"==typeof _dereq_&&_dereq_,s=0;s<n.length;s++)i(n[s]);return i}({1:[function(t,e,n){"use strict";e.exports=function(t){function e(t){var e=new n(t),r=e.promise();return e.setHowMany(1),e.setUnwrap(),e.init(),r}var n=t._SomePromiseArray;t.any=function(t){return e(t)},t.prototype.any=function(){return e(this)}}},{}],2:[function(t,e,n){"use strict";function r(){this._customScheduler=!1,this._isTickUsed=!1,this._lateQueue=new f(16),this._normalQueue=new f(16),this._haveDrainedQueues=!1;var t=this;this.drainQueues=function(){t._drainQueues()},this._schedule=p}function i(t,e,n){this._lateQueue.push(t,e,n),this._queueTick()}function o(t,e,n){this._normalQueue.push(t,e,n),this._queueTick()}function s(t){this._normalQueue._pushOne(t),this._queueTick()}function a(t){for(;t.length()>0;)c(t)}function c(t){var e=t.shift();if("function"!=typeof e)e._settlePromises();else{var n=t.shift(),r=t.shift();e.call(n,r)}}var u;try{throw new Error}catch(l){u=l}var p=t("./schedule"),f=t("./queue");r.prototype.setScheduler=function(t){var e=this._schedule;return this._schedule=t,this._customScheduler=!0,e},r.prototype.hasCustomScheduler=function(){return this._customScheduler},r.prototype.haveItemsQueued=function(){return this._isTickUsed||this._haveDrainedQueues},r.prototype.fatalError=function(t,e){e?(process.stderr.write("Fatal "+(t instanceof Error?t.stack:t)+"\n"),process.exit(2)):this.throwLater(t)},r.prototype.throwLater=function(t,e){if(1===arguments.length&&(e=t,t=function(){throw e}),"undefined"!=typeof setTimeout)setTimeout(function(){t(e)},0);else try{this._schedule(function(){t(e)})}catch(n){throw new Error("No async scheduler available\n\n See http://goo.gl/MqrFmX\n")}},r.prototype.invokeLater=i,r.prototype.invoke=o,r.prototype.settlePromises=s,r.prototype._drainQueues=function(){a(this._normalQueue),this._reset(),this._haveDrainedQueues=!0,a(this._lateQueue)},r.prototype._queueTick=function(){this._isTickUsed||(this._isTickUsed=!0,this._schedule(this.drainQueues))},r.prototype._reset=function(){this._isTickUsed=!1},e.exports=r,e.exports.firstLineError=u},{"./queue":26,"./schedule":29}],3:[function(t,e,n){"use strict";e.exports=function(t,e,n,r){var i=!1,o=function(t,e){this._reject(e)},s=function(t,e){e.promiseRejectionQueued=!0,e.bindingPromise._then(o,o,null,this,t)},a=function(t,e){0===(50397184&this._bitField)&&this._resolveCallback(e.target)},c=function(t,e){e.promiseRejectionQueued||this._reject(t)};t.prototype.bind=function(o){i||(i=!0,t.prototype._propagateFrom=r.propagateFromFunction(),t.prototype._boundValue=r.boundValueFunction());var u=n(o),l=new t(e);l._propagateFrom(this,1);var p=this._target();if(l._setBoundTo(u),u instanceof t){var f={promiseRejectionQueued:!1,promise:l,target:p,bindingPromise:u};p._then(e,s,void 0,l,f),u._then(a,c,void 0,l,f),l._setOnCancel(u)}else l._resolveCallback(p);return l},t.prototype._setBoundTo=function(t){void 0!==t?(this._bitField=2097152|this._bitField,this._boundTo=t):this._bitField=-2097153&this._bitField},t.prototype._isBound=function(){return 2097152===(2097152&this._bitField)},t.bind=function(e,n){return t.resolve(n).bind(e)}}},{}],4:[function(t,e,n){"use strict";function r(){try{Promise===o&&(Promise=i)}catch(t){}return o}var i;"undefined"!=typeof Promise&&(i=Promise);var o=t("./promise")();o.noConflict=r,e.exports=o},{"./promise":22}],5:[function(t,e,n){"use strict";var r=Object.create;if(r){var i=r(null),o=r(null);i[" size"]=o[" size"]=0}e.exports=function(e){function n(t,n){var r;if(null!=t&&(r=t[n]),"function"!=typeof r){var i="Object "+a.classString(t)+" has no method '"+a.toString(n)+"'";throw new e.TypeError(i)}return r}function r(t){var e=this.pop(),r=n(t,e);return r.apply(t,this)}function i(t){return t[this]}function o(t){var e=+this;return 0>e&&(e=Math.max(0,e+t.length)),t[e]}var s,a=t("./util"),c=a.canEvaluate;a.isIdentifier;e.prototype.call=function(t){var e=[].slice.call(arguments,1);return e.push(t),this._then(r,void 0,void 0,e,void 0)},e.prototype.get=function(t){var e,n="number"==typeof t;if(n)e=o;else if(c){var r=s(t);e=null!==r?r:i}else e=i;return this._then(e,void 0,void 0,t,void 0)}}},{"./util":36}],6:[function(t,e,n){"use strict";e.exports=function(e,n,r,i){var o=t("./util"),s=o.tryCatch,a=o.errorObj,c=e._async;e.prototype["break"]=e.prototype.cancel=function(){if(!i.cancellation())return this._warn("cancellation is disabled");for(var t=this,e=t;t._isCancellable();){if(!t._cancelBy(e)){e._isFollowing()?e._followee().cancel():e._cancelBranched();break}var n=t._cancellationParent;if(null==n||!n._isCancellable()){t._isFollowing()?t._followee().cancel():t._cancelBranched();break}t._isFollowing()&&t._followee().cancel(),t._setWillBeCancelled(),e=t,t=n}},e.prototype._branchHasCancelled=function(){this._branchesRemainingToCancel--},e.prototype._enoughBranchesHaveCancelled=function(){return void 0===this._branchesRemainingToCancel||this._branchesRemainingToCancel<=0},e.prototype._cancelBy=function(t){return t===this?(this._branchesRemainingToCancel=0,this._invokeOnCancel(),!0):(this._branchHasCancelled(),this._enoughBranchesHaveCancelled()?(this._invokeOnCancel(),!0):!1)},e.prototype._cancelBranched=function(){this._enoughBranchesHaveCancelled()&&this._cancel()},e.prototype._cancel=function(){this._isCancellable()&&(this._setCancelled(),c.invoke(this._cancelPromises,this,void 0))},e.prototype._cancelPromises=function(){this._length()>0&&this._settlePromises()},e.prototype._unsetOnCancel=function(){this._onCancelField=void 0},e.prototype._isCancellable=function(){return this.isPending()&&!this._isCancelled()},e.prototype.isCancellable=function(){return this.isPending()&&!this.isCancelled()},e.prototype._doInvokeOnCancel=function(t,e){if(o.isArray(t))for(var n=0;n<t.length;++n)this._doInvokeOnCancel(t[n],e);else if(void 0!==t)if("function"==typeof t){if(!e){var r=s(t).call(this._boundValue());r===a&&(this._attachExtraTrace(r.e),c.throwLater(r.e))}}else t._resultCancelled(this)},e.prototype._invokeOnCancel=function(){var t=this._onCancel();this._unsetOnCancel(),c.invoke(this._doInvokeOnCancel,this,t)},e.prototype._invokeInternalOnCancel=function(){this._isCancellable()&&(this._doInvokeOnCancel(this._onCancel(),!0),this._unsetOnCancel())},e.prototype._resultCancelled=function(){this.cancel()}}},{"./util":36}],7:[function(t,e,n){"use strict";e.exports=function(e){function n(t,n,a){return function(c){var u=a._boundValue();t:for(var l=0;l<t.length;++l){var p=t[l];if(p===Error||null!=p&&p.prototype instanceof Error){if(c instanceof p)return o(n).call(u,c)}else if("function"==typeof p){var f=o(p).call(u,c);if(f===s)return f;if(f)return o(n).call(u,c)}else if(r.isObject(c)){for(var h=i(p),_=0;_<h.length;++_){var d=h[_];if(p[d]!=c[d])continue t}return o(n).call(u,c)}}return e}}var r=t("./util"),i=t("./es5").keys,o=r.tryCatch,s=r.errorObj;return n}},{"./es5":13,"./util":36}],8:[function(t,e,n){"use strict";e.exports=function(t){function e(){this._trace=new e.CapturedTrace(r())}function n(){return i?new e:void 0}function r(){var t=o.length-1;return t>=0?o[t]:void 0}var i=!1,o=[];return t.prototype._promiseCreated=function(){},t.prototype._pushContext=function(){},t.prototype._popContext=function(){return null},t._peekContext=t.prototype._peekContext=function(){},e.prototype._pushContext=function(){void 0!==this._trace&&(this._trace._promiseCreated=null,o.push(this._trace))},e.prototype._popContext=function(){if(void 0!==this._trace){var t=o.pop(),e=t._promiseCreated;return t._promiseCreated=null,e}return null},e.CapturedTrace=null,e.create=n,e.deactivateLongStackTraces=function(){},e.activateLongStackTraces=function(){var n=t.prototype._pushContext,o=t.prototype._popContext,s=t._peekContext,a=t.prototype._peekContext,c=t.prototype._promiseCreated;e.deactivateLongStackTraces=function(){t.prototype._pushContext=n,t.prototype._popContext=o,t._peekContext=s,t.prototype._peekContext=a,t.prototype._promiseCreated=c,i=!1},i=!0,t.prototype._pushContext=e.prototype._pushContext,t.prototype._popContext=e.prototype._popContext,t._peekContext=t.prototype._peekContext=r,t.prototype._promiseCreated=function(){var t=this._peekContext();t&&null==t._promiseCreated&&(t._promiseCreated=this)}},e}},{}],9:[function(t,e,n){"use strict";e.exports=function(e,n,r,i){function o(t,e){return{promise:e}}function s(){return!1}function a(t,e,n){var r=this;try{t(e,n,function(t){if("function"!=typeof t)throw new TypeError("onCancel must be a function, got: "+B.toString(t));r._attachCancellationCallback(t)})}catch(i){return i}}function c(t){if(!this._isCancellable())return this;var e=this._onCancel();void 0!==e?B.isArray(e)?e.push(t):this._setOnCancel([e,t]):this._setOnCancel(t)}function u(){return this._onCancelField}function l(t){this._onCancelField=t}function p(){this._cancellationParent=void 0,this._onCancelField=void 0}function f(t,e){if(0!==(1&e)){this._cancellationParent=t;var n=t._branchesRemainingToCancel;void 0===n&&(n=0),t._branchesRemainingToCancel=n+1}0!==(2&e)&&t._isBound()&&this._setBoundTo(t._boundTo)}function h(t,e){0!==(2&e)&&t._isBound()&&this._setBoundTo(t._boundTo)}function _(){var t=this._boundTo;return void 0!==t&&t instanceof e?t.isFulfilled()?t.value():void 0:t}function d(){this._trace=new V(this._peekContext())}function v(t,e){if(q(t)){var n=this._trace;if(void 0!==n&&e&&(n=n._parent),void 0!==n)n.attachExtraTrace(t);else if(!t.__stackCleaned__){var r=F(t);B.notEnumerableProp(t,"stack",r.message+"\n"+r.stack.join("\n")),B.notEnumerableProp(t,"__stackCleaned__",!0)}}}function y(){this._trace=void 0}function g(t,e,n,r,i){if(void 0===t&&null!==e&&Z){if(void 0!==i&&i._returnedNonUndefined())return;if(0===(65535&r._bitField))return;n&&(n+=" ");var o="",s="";if(e._trace){for(var a=e._trace.stack.split("\n"),c=k(a),u=c.length-1;u>=0;--u){var l=c[u];if(!Q.test(l)){var p=l.match(G);p&&(o="at "+p[1]+":"+p[2]+":"+p[3]+" ");break}}if(c.length>0)for(var f=c[0],u=0;u<a.length;++u)if(a[u]===f){u>0&&(s="\n"+a[u-1]);break}}var h="a promise was created in a "+n+"handler "+o+"but was not returned from it, see http://goo.gl/rRqMUw"+s;r._warn(h,!0,e)}}function m(t,e){var n=t+" is deprecated and will be removed in a future version.";return e&&(n+=" Use "+e+" instead."),b(n)}function b(t,n,r){if(lt.warnings){var i,o=new U(t);if(n)r._attachExtraTrace(o);else if(lt.longStackTraces&&(i=e._peekContext()))i.attachExtraTrace(o);else{var s=F(o);o.stack=s.message+"\n"+s.stack.join("\n")}ot("warning",o)||x(o,"",!0)}}function w(t,e){for(var n=0;n<e.length-1;++n)e[n].push("From previous event:"),e[n]=e[n].join("\n");return n<e.length&&(e[n]=e[n].join("\n")),t+"\n"+e.join("\n")}function C(t){for(var e=0;e<t.length;++e)(0===t[e].length||e+1<t.length&&t[e][0]===t[e+1][0])&&(t.splice(e,1),e--)}function j(t){for(var e=t[0],n=1;n<t.length;++n){for(var r=t[n],i=e.length-1,o=e[i],s=-1,a=r.length-1;a>=0;--a)if(r[a]===o){s=a;break}for(var a=s;a>=0;--a){var c=r[a];if(e[i]!==c)break;e.pop(),i--}e=r}}function k(t){for(var e=[],n=0;n<t.length;++n){var r=t[n],i=" (No stack trace)"===r||z.test(r),o=i&&at(r);i&&!o&&(W&&" "!==r.charAt(0)&&(r=" "+r),e.push(r))}return e}function E(t){for(var e=t.stack.replace(/\s+$/g,"").split("\n"),n=0;n<e.length;++n){var r=e[n];if(" (No stack trace)"===r||z.test(r))break}return n>0&&"SyntaxError"!=t.name&&(e=e.slice(n)),e}function F(t){var e=t.stack,n=t.toString();return e="string"==typeof e&&e.length>0?E(t):[" (No stack trace)"],{message:n,stack:"SyntaxError"==t.name?e:k(e)}}function x(t,e,n){if("undefined"!=typeof console){var r;if(B.isObject(t)){var i=t.stack;r=e+X(i,t)}else r=e+String(t);"function"==typeof I?I(r,n):("function"==typeof console.log||"object"==typeof console.log)&&console.log(r)}}function T(t,e,n,r){var i=!1;try{"function"==typeof e&&(i=!0,"rejectionHandled"===t?e(r):e(n,r))}catch(o){N.throwLater(o)}"unhandledRejection"===t?ot(t,n,r)||i||x(n,"Unhandled rejection "):ot(t,r)}function P(t){var e;if("function"==typeof t)e="[function "+(t.name||"anonymous")+"]";else{e=t&&"function"==typeof t.toString?t.toString():B.toString(t);var n=/\[object [a-zA-Z0-9$_]+\]/;if(n.test(e))try{var r=JSON.stringify(t);e=r}catch(i){}0===e.length&&(e="(empty array)")}return"(<"+R(e)+">, no stack trace)"}function R(t){var e=41;return t.length<e?t:t.substr(0,e-3)+"..."}function S(){return"function"==typeof ut}function O(t){var e=t.match(ct);return e?{fileName:e[1],line:parseInt(e[2],10)}:void 0}function A(t,e){if(S()){for(var n,r,i=(t.stack||"").split("\n"),o=(e.stack||"").split("\n"),s=-1,a=-1,c=0;c<i.length;++c){var u=O(i[c]);if(u){n=u.fileName,s=u.line;break}}for(var c=0;c<o.length;++c){var u=O(o[c]);if(u){r=u.fileName,a=u.line;break}}0>s||0>a||!n||!r||n!==r||s>=a||(at=function(t){if($.test(t))return!0;var e=O(t);return e&&e.fileName===n&&s<=e.line&&e.line<=a?!0:!1})}}function V(t){this._parent=t,this._promisesCreated=0;var e=this._length=1+(void 0===t?0:t._length);ut(this,V),e>32&&this.uncycle()}var H,D,I,L,N=e._async,U=t("./errors").Warning,B=t("./util"),M=t("./es5"),q=B.canAttachTrace,$=/[\\\/]bluebird[\\\/]js[\\\/](release|debug|instrumented)/,Q=/\((?:timers\.js):\d+:\d+\)/,G=/[\/<\(](.+?):(\d+):(\d+)\)?\s*$/,z=null,X=null,W=!1,K=!(0==B.env("BLUEBIRD_DEBUG")||!B.env("BLUEBIRD_DEBUG")&&"development"!==B.env("NODE_ENV")),J=!(0==B.env("BLUEBIRD_WARNINGS")||!K&&!B.env("BLUEBIRD_WARNINGS")),Y=!(0==B.env("BLUEBIRD_LONG_STACK_TRACES")||!K&&!B.env("BLUEBIRD_LONG_STACK_TRACES")),Z=0!=B.env("BLUEBIRD_W_FORGOTTEN_RETURN")&&(J||!!B.env("BLUEBIRD_W_FORGOTTEN_RETURN"));!function(){function t(){for(var t=0;t<r.length;++t)r[t]._notifyUnhandledRejection();n()}function n(){r.length=0}var r=[];L=function(e){r.push(e),setTimeout(t,1)},M.defineProperty(e,"_unhandledRejectionCheck",{value:t}),M.defineProperty(e,"_unhandledRejectionClear",{value:n})}(),e.prototype.suppressUnhandledRejections=function(){var t=this._target();t._bitField=-1048577&t._bitField|524288},e.prototype._ensurePossibleRejectionHandled=function(){0===(524288&this._bitField)&&(this._setRejectionIsUnhandled(),L(this))},e.prototype._notifyUnhandledRejectionIsHandled=function(){T("rejectionHandled",H,void 0,this)},e.prototype._setReturnedNonUndefined=function(){this._bitField=268435456|this._bitField},e.prototype._returnedNonUndefined=function(){return 0!==(268435456&this._bitField)},e.prototype._notifyUnhandledRejection=function(){if(this._isRejectionUnhandled()){var t=this._settledValue();this._setUnhandledRejectionIsNotified(),T("unhandledRejection",D,t,this)}},e.prototype._setUnhandledRejectionIsNotified=function(){this._bitField=262144|this._bitField},e.prototype._unsetUnhandledRejectionIsNotified=function(){this._bitField=-262145&this._bitField},e.prototype._isUnhandledRejectionNotified=function(){return(262144&this._bitField)>0},e.prototype._setRejectionIsUnhandled=function(){this._bitField=1048576|this._bitField},e.prototype._unsetRejectionIsUnhandled=function(){this._bitField=-1048577&this._bitField,this._isUnhandledRejectionNotified()&&(this._unsetUnhandledRejectionIsNotified(),this._notifyUnhandledRejectionIsHandled())},e.prototype._isRejectionUnhandled=function(){return(1048576&this._bitField)>0},e.prototype._warn=function(t,e,n){return b(t,e,n||this)},e.onPossiblyUnhandledRejection=function(t){var n=e._getContext();D=B.contextBind(n,t)},e.onUnhandledRejectionHandled=function(t){var n=e._getContext();H=B.contextBind(n,t)};var tt=function(){};e.longStackTraces=function(){if(N.haveItemsQueued()&&!lt.longStackTraces)throw new Error("cannot enable long stack traces after promises have been created\n\n See http://goo.gl/MqrFmX\n");if(!lt.longStackTraces&&S()){var t=e.prototype._captureStackTrace,r=e.prototype._attachExtraTrace,i=e.prototype._dereferenceTrace;lt.longStackTraces=!0,tt=function(){if(N.haveItemsQueued()&&!lt.longStackTraces)throw new Error("cannot enable long stack traces after promises have been created\n\n See http://goo.gl/MqrFmX\n");e.prototype._captureStackTrace=t,e.prototype._attachExtraTrace=r,e.prototype._dereferenceTrace=i,n.deactivateLongStackTraces(),lt.longStackTraces=!1},e.prototype._captureStackTrace=d,e.prototype._attachExtraTrace=v,e.prototype._dereferenceTrace=y,n.activateLongStackTraces()}},e.hasLongStackTraces=function(){return lt.longStackTraces&&S()};var et={unhandledrejection:{before:function(){var t=B.global.onunhandledrejection;return B.global.onunhandledrejection=null,t},after:function(t){B.global.onunhandledrejection=t}},rejectionhandled:{before:function(){var t=B.global.onrejectionhandled;return B.global.onrejectionhandled=null,t},after:function(t){B.global.onrejectionhandled=t}}},nt=function(){var t=function(t,e){if(!t)return!B.global.dispatchEvent(e);var n;try{return n=t.before(),!B.global.dispatchEvent(e)}finally{t.after(n)}};try{if("function"==typeof CustomEvent){var e=new CustomEvent("CustomEvent");return B.global.dispatchEvent(e),function(e,n){e=e.toLowerCase();var r={detail:n,cancelable:!0},i=new CustomEvent(e,r);return M.defineProperty(i,"promise",{value:n.promise}),M.defineProperty(i,"reason",{value:n.reason}),t(et[e],i)}}if("function"==typeof Event){var e=new Event("CustomEvent");return B.global.dispatchEvent(e),function(e,n){e=e.toLowerCase();var r=new Event(e,{cancelable:!0});return r.detail=n,M.defineProperty(r,"promise",{value:n.promise}),M.defineProperty(r,"reason",{value:n.reason}),t(et[e],r)}}var e=document.createEvent("CustomEvent");return e.initCustomEvent("testingtheevent",!1,!0,{}),B.global.dispatchEvent(e),function(e,n){e=e.toLowerCase();var r=document.createEvent("CustomEvent");return r.initCustomEvent(e,!1,!0,n),t(et[e],r)}}catch(n){}return function(){return!1}}(),rt=function(){return B.isNode?function(){return process.emit.apply(process,arguments)}:B.global?function(t){var e="on"+t.toLowerCase(),n=B.global[e];return n?(n.apply(B.global,[].slice.call(arguments,1)),!0):!1}:function(){return!1}}(),it={promiseCreated:o,promiseFulfilled:o,promiseRejected:o,promiseResolved:o,promiseCancelled:o,promiseChained:function(t,e,n){return{promise:e,child:n}},warning:function(t,e){return{warning:e}},unhandledRejection:function(t,e,n){return{reason:e,promise:n}},rejectionHandled:o},ot=function(t){var e=!1;try{e=rt.apply(null,arguments)}catch(n){N.throwLater(n),e=!0}var r=!1;try{r=nt(t,it[t].apply(null,arguments))}catch(n){N.throwLater(n),r=!0}return r||e};e.config=function(t){if(t=Object(t),"longStackTraces"in t&&(t.longStackTraces?e.longStackTraces():!t.longStackTraces&&e.hasLongStackTraces()&&tt()),"warnings"in t){var n=t.warnings;lt.warnings=!!n,Z=lt.warnings,B.isObject(n)&&"wForgottenReturn"in n&&(Z=!!n.wForgottenReturn)}if("cancellation"in t&&t.cancellation&&!lt.cancellation){if(N.haveItemsQueued())throw new Error("cannot enable cancellation after promises are in use");e.prototype._clearCancellationData=p,e.prototype._propagateFrom=f,e.prototype._onCancel=u,e.prototype._setOnCancel=l,e.prototype._attachCancellationCallback=c,e.prototype._execute=a,st=f,lt.cancellation=!0}if("monitoring"in t&&(t.monitoring&&!lt.monitoring?(lt.monitoring=!0,e.prototype._fireEvent=ot):!t.monitoring&<.monitoring&&(lt.monitoring=!1,e.prototype._fireEvent=s)),"asyncHooks"in t&&B.nodeSupportsAsyncResource){var o=lt.asyncHooks,h=!!t.asyncHooks;o!==h&&(lt.asyncHooks=h,h?r():i())}return e},e.prototype._fireEvent=s,e.prototype._execute=function(t,e,n){try{t(e,n)}catch(r){return r}},e.prototype._onCancel=function(){},e.prototype._setOnCancel=function(t){},e.prototype._attachCancellationCallback=function(t){},e.prototype._captureStackTrace=function(){},e.prototype._attachExtraTrace=function(){},e.prototype._dereferenceTrace=function(){},e.prototype._clearCancellationData=function(){},e.prototype._propagateFrom=function(t,e){};var st=h,at=function(){return!1},ct=/[\/<\(]([^:\/]+):(\d+):(?:\d+)\)?\s*$/;B.inherits(V,Error),n.CapturedTrace=V,V.prototype.uncycle=function(){var t=this._length;if(!(2>t)){for(var e=[],n={},r=0,i=this;void 0!==i;++r)e.push(i),i=i._parent;t=this._length=r;for(var r=t-1;r>=0;--r){var o=e[r].stack;void 0===n[o]&&(n[o]=r)}for(var r=0;t>r;++r){var s=e[r].stack,a=n[s];if(void 0!==a&&a!==r){a>0&&(e[a-1]._parent=void 0,e[a-1]._length=1),e[r]._parent=void 0,e[r]._length=1;var c=r>0?e[r-1]:this;t-1>a?(c._parent=e[a+1],c._parent.uncycle(),c._length=c._parent._length+1):(c._parent=void 0,c._length=1);for(var u=c._length+1,l=r-2;l>=0;--l)e[l]._length=u,u++;return}}}},V.prototype.attachExtraTrace=function(t){if(!t.__stackCleaned__){this.uncycle();for(var e=F(t),n=e.message,r=[e.stack],i=this;void 0!==i;)r.push(k(i.stack.split("\n"))),i=i._parent;j(r),C(r),B.notEnumerableProp(t,"stack",w(n,r)),B.notEnumerableProp(t,"__stackCleaned__",!0)}};var ut=function(){var t=/^\s*at\s*/,e=function(t,e){return"string"==typeof t?t:void 0!==e.name&&void 0!==e.message?e.toString():P(e)};if("number"==typeof Error.stackTraceLimit&&"function"==typeof Error.captureStackTrace){Error.stackTraceLimit+=6,z=t,X=e;var n=Error.captureStackTrace;return at=function(t){return $.test(t)},function(t,e){Error.stackTraceLimit+=6,n(t,e),Error.stackTraceLimit-=6}}var r=new Error;if("string"==typeof r.stack&&r.stack.split("\n")[0].indexOf("stackDetection@")>=0)return z=/@/,X=e,W=!0,function(t){t.stack=(new Error).stack};var i;try{throw new Error}catch(o){i="stack"in o}return"stack"in r||!i||"number"!=typeof Error.stackTraceLimit?(X=function(t,e){return"string"==typeof t?t:"object"!=typeof e&&"function"!=typeof e||void 0===e.name||void 0===e.message?P(e):e.toString()},null):(z=t,X=e,function(t){Error.stackTraceLimit+=6;try{throw new Error}catch(e){t.stack=e.stack}Error.stackTraceLimit-=6})}([]);"undefined"!=typeof console&&"undefined"!=typeof console.warn&&(I=function(t){console.warn(t)},B.isNode&&process.stderr.isTTY?I=function(t,e){var n=e?"[33m":"[31m";console.warn(n+t+"[0m\n")}:B.isNode||"string"!=typeof(new Error).stack||(I=function(t,e){console.warn("%c"+t,e?"color: darkorange":"color: red")}));var lt={warnings:J,longStackTraces:!1,cancellation:!1,monitoring:!1,asyncHooks:!1};return Y&&e.longStackTraces(),{asyncHooks:function(){return lt.asyncHooks},longStackTraces:function(){return lt.longStackTraces},warnings:function(){return lt.warnings},cancellation:function(){return lt.cancellation},monitoring:function(){return lt.monitoring},propagateFromFunction:function(){return st},boundValueFunction:function(){return _},checkForgottenReturns:g,setBounds:A,warn:b,deprecated:m,CapturedTrace:V,fireDomEvent:nt,fireGlobalEvent:rt}}},{"./errors":12,"./es5":13,"./util":36}],10:[function(t,e,n){"use strict";e.exports=function(t){function e(){return this.value}function n(){throw this.reason}t.prototype["return"]=t.prototype.thenReturn=function(n){return n instanceof t&&n.suppressUnhandledRejections(),this._then(e,void 0,void 0,{value:n},void 0)},t.prototype["throw"]=t.prototype.thenThrow=function(t){return this._then(n,void 0,void 0,{reason:t},void 0)},t.prototype.catchThrow=function(t){if(arguments.length<=1)return this._then(void 0,n,void 0,{reason:t},void 0);var e=arguments[1],r=function(){throw e};return this.caught(t,r)},t.prototype.catchReturn=function(n){if(arguments.length<=1)return n instanceof t&&n.suppressUnhandledRejections(),this._then(void 0,e,void 0,{value:n},void 0);var r=arguments[1];r instanceof t&&r.suppressUnhandledRejections();var i=function(){return r};return this.caught(n,i)}}},{}],11:[function(t,e,n){"use strict";e.exports=function(t,e){function n(){return o(this)}function r(t,n){return i(t,n,e,e)}var i=t.reduce,o=t.all;t.prototype.each=function(t){return i(this,t,e,0)._then(n,void 0,void 0,this,void 0)},t.prototype.mapSeries=function(t){return i(this,t,e,e)},t.each=function(t,r){return i(t,r,e,0)._then(n,void 0,void 0,t,void 0)},t.mapSeries=r}},{}],12:[function(t,e,n){"use strict";function r(t,e){function n(r){return this instanceof n?(p(this,"message","string"==typeof r?r:e),p(this,"name",t),void(Error.captureStackTrace?Error.captureStackTrace(this,this.constructor):Error.call(this))):new n(r)}return l(n,Error),n}function i(t){return this instanceof i?(p(this,"name","OperationalError"),p(this,"message",t),this.cause=t,this.isOperational=!0,void(t instanceof Error?(p(this,"message",t.message),p(this,"stack",t.stack)):Error.captureStackTrace&&Error.captureStackTrace(this,this.constructor))):new i(t)}var o,s,a=t("./es5"),c=a.freeze,u=t("./util"),l=u.inherits,p=u.notEnumerableProp,f=r("Warning","warning"),h=r("CancellationError","cancellation error"),_=r("TimeoutError","timeout error"),d=r("AggregateError","aggregate error");try{o=TypeError,s=RangeError}catch(v){o=r("TypeError","type error"),s=r("RangeError","range error")}for(var y="join pop push shift unshift slice filter forEach some every map indexOf lastIndexOf reduce reduceRight sort reverse".split(" "),g=0;g<y.length;++g)"function"==typeof Array.prototype[y[g]]&&(d.prototype[y[g]]=Array.prototype[y[g]]);a.defineProperty(d.prototype,"length",{value:0,configurable:!1,writable:!0,enumerable:!0}),d.prototype.isOperational=!0;var m=0;d.prototype.toString=function(){var t=Array(4*m+1).join(" "),e="\n"+t+"AggregateError of:\n";m++,t=Array(4*m+1).join(" ");for(var n=0;n<this.length;++n){for(var r=this[n]===this?"[Circular AggregateError]":this[n]+"",i=r.split("\n"),o=0;o<i.length;++o)i[o]=t+i[o];r=i.join("\n"),e+=r+"\n"}return m--,e},l(i,Error);var b=Error.__BluebirdErrorTypes__;b||(b=c({CancellationError:h,TimeoutError:_,OperationalError:i,RejectionError:i,AggregateError:d}),a.defineProperty(Error,"__BluebirdErrorTypes__",{value:b,writable:!1,enumerable:!1,configurable:!1})),e.exports={Error:Error,TypeError:o,RangeError:s,CancellationError:b.CancellationError,OperationalError:b.OperationalError,TimeoutError:b.TimeoutError,AggregateError:b.AggregateError,Warning:f}},{"./es5":13,"./util":36}],13:[function(t,e,n){var r=function(){"use strict";return void 0===this}();if(r)e.exports={freeze:Object.freeze,defineProperty:Object.defineProperty,getDescriptor:Object.getOwnPropertyDescriptor,keys:Object.keys,names:Object.getOwnPropertyNames,getPrototypeOf:Object.getPrototypeOf,isArray:Array.isArray,isES5:r,propertyIsWritable:function(t,e){var n=Object.getOwnPropertyDescriptor(t,e);return!(n&&!n.writable&&!n.set)}};else{var i={}.hasOwnProperty,o={}.toString,s={}.constructor.prototype,a=function(t){var e=[];for(var n in t)i.call(t,n)&&e.push(n);return e},c=function(t,e){return{value:t[e]}},u=function(t,e,n){return t[e]=n.value,t},l=function(t){return t},p=function(t){try{return Object(t).constructor.prototype}catch(e){return s}},f=function(t){try{return"[object Array]"===o.call(t)}catch(e){return!1}};e.exports={isArray:f,keys:a,names:a,defineProperty:u,getDescriptor:c,freeze:l,getPrototypeOf:p,isES5:r,propertyIsWritable:function(){return!0}}}},{}],14:[function(t,e,n){"use strict";e.exports=function(t,e){var n=t.map;t.prototype.filter=function(t,r){return n(this,t,r,e)},t.filter=function(t,r,i){return n(t,r,i,e)}}},{}],15:[function(t,e,n){"use strict";e.exports=function(e,n,r){function i(t,e,n){this.promise=t,this.type=e,this.handler=n,this.called=!1,this.cancelPromise=null}function o(t){this.finallyHandler=t}function s(t,e){return null!=t.cancelPromise?(arguments.length>1?t.cancelPromise._reject(e):t.cancelPromise._cancel(),t.cancelPromise=null,!0):!1}function a(){return u.call(this,this.promise._target()._settledValue())}function c(t){return s(this,t)?void 0:(f.e=t,f)}function u(t){var i=this.promise,u=this.handler;if(!this.called){this.called=!0;var l=this.isFinallyHandler()?u.call(i._boundValue()):u.call(i._boundValue(),t);if(l===r)return l;if(void 0!==l){i._setReturnedNonUndefined();var h=n(l,i);if(h instanceof e){if(null!=this.cancelPromise){if(h._isCancelled()){var _=new p("late cancellation observer");return i._attachExtraTrace(_),f.e=_,f}h.isPending()&&h._attachCancellationCallback(new o(this))}return h._then(a,c,void 0,this,void 0)}}}return i.isRejected()?(s(this),f.e=t,f):(s(this),t)}var l=t("./util"),p=e.CancellationError,f=l.errorObj,h=t("./catch_filter")(r);return i.prototype.isFinallyHandler=function(){return 0===this.type},o.prototype._resultCancelled=function(){s(this.finallyHandler)},e.prototype._passThrough=function(t,e,n,r){return"function"!=typeof t?this.then():this._then(n,r,void 0,new i(this,e,t),void 0)},e.prototype.lastly=e.prototype["finally"]=function(t){return this._passThrough(t,0,u,u)},e.prototype.tap=function(t){return this._passThrough(t,1,u)},e.prototype.tapCatch=function(t){var n=arguments.length;if(1===n)return this._passThrough(t,1,void 0,u);var r,i=new Array(n-1),o=0;for(r=0;n-1>r;++r){var s=arguments[r];if(!l.isObject(s))return e.reject(new TypeError("tapCatch statement predicate: expecting an object but got "+l.classString(s)));i[o++]=s}i.length=o;var a=arguments[r];return this._passThrough(h(i,a,this),1,void 0,u)},i}},{"./catch_filter":7,"./util":36}],16:[function(t,e,n){"use strict";e.exports=function(e,n,r,i,o,s){function a(t,n,r){for(var o=0;o<n.length;++o){r._pushContext();var s=h(n[o])(t);if(r._popContext(),s===f){r._pushContext();var a=e.reject(f.e);return r._popContext(),a}var c=i(s,r);if(c instanceof e)return c}return null}function c(t,n,i,o){if(s.cancellation()){var a=new e(r),c=this._finallyPromise=new e(r);this._promise=a.lastly(function(){return c}),a._captureStackTrace(),a._setOnCancel(this)}else{var u=this._promise=new e(r);u._captureStackTrace()}this._stack=o,this._generatorFunction=t,this._receiver=n,this._generator=void 0,this._yieldHandlers="function"==typeof i?[i].concat(_):_,this._yieldedPromise=null,this._cancellationPhase=!1}var u=t("./errors"),l=u.TypeError,p=t("./util"),f=p.errorObj,h=p.tryCatch,_=[];p.inherits(c,o),c.prototype._isResolved=function(){return null===this._promise},c.prototype._cleanup=function(){this._promise=this._generator=null,s.cancellation()&&null!==this._finallyPromise&&(this._finallyPromise._fulfill(),this._finallyPromise=null)},c.prototype._promiseCancelled=function(){if(!this._isResolved()){var t,n="undefined"!=typeof this._generator["return"];if(n)this._promise._pushContext(),t=h(this._generator["return"]).call(this._generator,void 0),this._promise._popContext();else{var r=new e.CancellationError("generator .return() sentinel");e.coroutine.returnSentinel=r,this._promise._attachExtraTrace(r),this._promise._pushContext(),t=h(this._generator["throw"]).call(this._generator,r),this._promise._popContext()}this._cancellationPhase=!0,this._yieldedPromise=null,this._continue(t)}},c.prototype._promiseFulfilled=function(t){this._yieldedPromise=null,this._promise._pushContext();var e=h(this._generator.next).call(this._generator,t);this._promise._popContext(),this._continue(e)},c.prototype._promiseRejected=function(t){this._yieldedPromise=null,this._promise._attachExtraTrace(t),this._promise._pushContext();var e=h(this._generator["throw"]).call(this._generator,t);this._promise._popContext(),this._continue(e)},c.prototype._resultCancelled=function(){if(this._yieldedPromise instanceof e){var t=this._yieldedPromise;this._yieldedPromise=null,t.cancel()}},c.prototype.promise=function(){return this._promise},c.prototype._run=function(){this._generator=this._generatorFunction.call(this._receiver),this._receiver=this._generatorFunction=void 0,this._promiseFulfilled(void 0)},c.prototype._continue=function(t){var n=this._promise;if(t===f)return this._cleanup(),this._cancellationPhase?n.cancel():n._rejectCallback(t.e,!1);var r=t.value;if(t.done===!0)return this._cleanup(),this._cancellationPhase?n.cancel():n._resolveCallback(r);
var o=i(r,this._promise);if(!(o instanceof e)&&(o=a(o,this._yieldHandlers,this._promise),null===o))return void this._promiseRejected(new l("A value %s was yielded that could not be treated as a promise\n\n See http://goo.gl/MqrFmX\n\n".replace("%s",String(r))+"From coroutine:\n"+this._stack.split("\n").slice(1,-7).join("\n")));o=o._target();var s=o._bitField;0===(50397184&s)?(this._yieldedPromise=o,o._proxy(this,null)):0!==(33554432&s)?e._async.invoke(this._promiseFulfilled,this,o._value()):0!==(16777216&s)?e._async.invoke(this._promiseRejected,this,o._reason()):this._promiseCancelled()},e.coroutine=function(t,e){if("function"!=typeof t)throw new l("generatorFunction must be a function\n\n See http://goo.gl/MqrFmX\n");var n=Object(e).yieldHandler,r=c,i=(new Error).stack;return function(){var e=t.apply(this,arguments),o=new r(void 0,void 0,n,i),s=o.promise();return o._generator=e,o._promiseFulfilled(void 0),s}},e.coroutine.addYieldHandler=function(t){if("function"!=typeof t)throw new l("expecting a function but got "+p.classString(t));_.push(t)},e.spawn=function(t){if(s.deprecated("Promise.spawn()","Promise.coroutine()"),"function"!=typeof t)return n("generatorFunction must be a function\n\n See http://goo.gl/MqrFmX\n");var r=new c(t,this),i=r.promise();return r._run(e.spawn),i}}},{"./errors":12,"./util":36}],17:[function(t,e,n){"use strict";e.exports=function(e,n,r,i,o){var s=t("./util");s.canEvaluate,s.tryCatch,s.errorObj;e.join=function(){var t,e=arguments.length-1;if(e>0&&"function"==typeof arguments[e]){t=arguments[e];var r}var i=[].slice.call(arguments);t&&i.pop();var r=new n(i).promise();return void 0!==t?r.spread(t):r}}},{"./util":36}],18:[function(t,e,n){"use strict";e.exports=function(e,n,r,i,o,s){function a(t,n,r,i){this.constructor$(t),this._promise._captureStackTrace();var s=e._getContext();if(this._callback=u.contextBind(s,n),this._preservedValues=i===o?new Array(this.length()):null,this._limit=r,this._inFlight=0,this._queue=[],f.invoke(this._asyncInit,this,void 0),u.isArray(t))for(var a=0;a<t.length;++a){var c=t[a];c instanceof e&&c.suppressUnhandledRejections()}}function c(t,n,i,o){if("function"!=typeof n)return r("expecting a function but got "+u.classString(n));var s=0;if(void 0!==i){if("object"!=typeof i||null===i)return e.reject(new TypeError("options argument must be an object but it is "+u.classString(i)));if("number"!=typeof i.concurrency)return e.reject(new TypeError("'concurrency' must be a number but it is "+u.classString(i.concurrency)));s=i.concurrency}return s="number"==typeof s&&isFinite(s)&&s>=1?s:0,new a(t,n,s,o).promise()}var u=t("./util"),l=u.tryCatch,p=u.errorObj,f=e._async;u.inherits(a,n),a.prototype._asyncInit=function(){this._init$(void 0,-2)},a.prototype._init=function(){},a.prototype._promiseFulfilled=function(t,n){var r=this._values,o=this.length(),a=this._preservedValues,c=this._limit;if(0>n){if(n=-1*n-1,r[n]=t,c>=1&&(this._inFlight--,this._drainQueue(),this._isResolved()))return!0}else{if(c>=1&&this._inFlight>=c)return r[n]=t,this._queue.push(n),!1;null!==a&&(a[n]=t);var u=this._promise,f=this._callback,h=u._boundValue();u._pushContext();var _=l(f).call(h,t,n,o),d=u._popContext();if(s.checkForgottenReturns(_,d,null!==a?"Promise.filter":"Promise.map",u),_===p)return this._reject(_.e),!0;var v=i(_,this._promise);if(v instanceof e){v=v._target();var y=v._bitField;if(0===(50397184&y))return c>=1&&this._inFlight++,r[n]=v,v._proxy(this,-1*(n+1)),!1;if(0===(33554432&y))return 0!==(16777216&y)?(this._reject(v._reason()),!0):(this._cancel(),!0);_=v._value()}r[n]=_}var g=++this._totalResolved;return g>=o?(null!==a?this._filter(r,a):this._resolve(r),!0):!1},a.prototype._drainQueue=function(){for(var t=this._queue,e=this._limit,n=this._values;t.length>0&&this._inFlight<e;){if(this._isResolved())return;var r=t.pop();this._promiseFulfilled(n[r],r)}},a.prototype._filter=function(t,e){for(var n=e.length,r=new Array(n),i=0,o=0;n>o;++o)t[o]&&(r[i++]=e[o]);r.length=i,this._resolve(r)},a.prototype.preservedValues=function(){return this._preservedValues},e.prototype.map=function(t,e){return c(this,t,e,null)},e.map=function(t,e,n,r){return c(t,e,n,r)}}},{"./util":36}],19:[function(t,e,n){"use strict";e.exports=function(e,n,r,i,o){var s=t("./util"),a=s.tryCatch;e.method=function(t){if("function"!=typeof t)throw new e.TypeError("expecting a function but got "+s.classString(t));return function(){var r=new e(n);r._captureStackTrace(),r._pushContext();var i=a(t).apply(this,arguments),s=r._popContext();return o.checkForgottenReturns(i,s,"Promise.method",r),r._resolveFromSyncValue(i),r}},e.attempt=e["try"]=function(t){if("function"!=typeof t)return i("expecting a function but got "+s.classString(t));var r=new e(n);r._captureStackTrace(),r._pushContext();var c;if(arguments.length>1){o.deprecated("calling Promise.try with more than 1 argument");var u=arguments[1],l=arguments[2];c=s.isArray(u)?a(t).apply(l,u):a(t).call(l,u)}else c=a(t)();var p=r._popContext();return o.checkForgottenReturns(c,p,"Promise.try",r),r._resolveFromSyncValue(c),r},e.prototype._resolveFromSyncValue=function(t){t===s.errorObj?this._rejectCallback(t.e,!1):this._resolveCallback(t,!0)}}},{"./util":36}],20:[function(t,e,n){"use strict";function r(t){return t instanceof Error&&l.getPrototypeOf(t)===Error.prototype}function i(t){var e;if(r(t)){e=new u(t),e.name=t.name,e.message=t.message,e.stack=t.stack;for(var n=l.keys(t),i=0;i<n.length;++i){var o=n[i];p.test(o)||(e[o]=t[o])}return e}return s.markAsOriginatingFromRejection(t),t}function o(t,e){return function(n,r){if(null!==t){if(n){var o=i(a(n));t._attachExtraTrace(o),t._reject(o)}else if(e){var s=[].slice.call(arguments,1);t._fulfill(s)}else t._fulfill(r);t=null}}}var s=t("./util"),a=s.maybeWrapAsError,c=t("./errors"),u=c.OperationalError,l=t("./es5"),p=/^(?:name|message|stack|cause)$/;e.exports=o},{"./errors":12,"./es5":13,"./util":36}],21:[function(t,e,n){"use strict";e.exports=function(e){function n(t,e){var n=this;if(!o.isArray(t))return r.call(n,t,e);var i=a(e).apply(n._boundValue(),[null].concat(t));i===c&&s.throwLater(i.e)}function r(t,e){var n=this,r=n._boundValue(),i=void 0===t?a(e).call(r,null):a(e).call(r,null,t);i===c&&s.throwLater(i.e)}function i(t,e){var n=this;if(!t){var r=new Error(t+"");r.cause=t,t=r}var i=a(e).call(n._boundValue(),t);i===c&&s.throwLater(i.e)}var o=t("./util"),s=e._async,a=o.tryCatch,c=o.errorObj;e.prototype.asCallback=e.prototype.nodeify=function(t,e){if("function"==typeof t){var o=r;void 0!==e&&Object(e).spread&&(o=n),this._then(o,i,void 0,this,t)}return this}}},{"./util":36}],22:[function(t,e,n){"use strict";e.exports=function(){function n(){}function r(t,e){if(null==t||(t.constructor!==i&&"undefined"!=typeof Promise&&t.constructor!==Promise))throw new E("the promise constructor cannot be invoked directly\n\n See http://goo.gl/MqrFmX\n");if("function"!=typeof e)throw new E("expecting a function but got "+f.classString(e))}function i(t){t!==x&&r(this,t),this._bitField=0,this._fulfillmentHandler0=void 0,this._rejectionHandler0=void 0,this._promise0=void 0,this._receiver0=void 0,this._resolveFromExecutor(t),this._promiseCreated(),this._fireEvent("promiseCreated",this)}function o(t){this.promise._resolveCallback(t)}function s(t){this.promise._rejectCallback(t,!1)}function a(t){var e=new i(x);e._fulfillmentHandler0=t,e._rejectionHandler0=t,e._promise0=t,e._receiver0=t}var c=function(){return new E("circular promise resolution chain\n\n See http://goo.gl/MqrFmX\n")},u=function(){return new i.PromiseInspection(this._target())},l=function(t){return i.reject(new E(t))},p={},f=t("./util");f.setReflectHandler(u);var h=function(){var t=process.domain;return void 0===t?null:t},_=function(){return null},d=function(){return{domain:h(),async:null}},v=f.isNode&&f.nodeSupportsAsyncResource?t("async_hooks").AsyncResource:null,y=function(){return{domain:h(),async:new v("Bluebird::Promise")}},g=f.isNode?d:_;f.notEnumerableProp(i,"_getContext",g);var m=function(){g=y,f.notEnumerableProp(i,"_getContext",y)},b=function(){g=d,f.notEnumerableProp(i,"_getContext",d)},w=t("./es5"),C=t("./async"),j=new C;w.defineProperty(i,"_async",{value:j});var k=t("./errors"),E=i.TypeError=k.TypeError;i.RangeError=k.RangeError;var F=i.CancellationError=k.CancellationError;i.TimeoutError=k.TimeoutError,i.OperationalError=k.OperationalError,i.RejectionError=k.OperationalError,i.AggregateError=k.AggregateError;var x=function(){},T={},P={},R=t("./thenables")(i,x),S=t("./promise_array")(i,x,R,l,n),O=t("./context")(i),A=O.create,V=t("./debuggability")(i,O,m,b),H=(V.CapturedTrace,t("./finally")(i,R,P)),D=t("./catch_filter")(P),I=t("./nodeback"),L=f.errorObj,N=f.tryCatch;return i.prototype.toString=function(){return"[object Promise]"},i.prototype.caught=i.prototype["catch"]=function(t){var e=arguments.length;if(e>1){var n,r=new Array(e-1),i=0;for(n=0;e-1>n;++n){var o=arguments[n];if(!f.isObject(o))return l("Catch statement predicate: expecting an object but got "+f.classString(o));r[i++]=o}if(r.length=i,t=arguments[n],"function"!=typeof t)throw new E("The last argument to .catch() must be a function, got "+f.toString(t));return this.then(void 0,D(r,t,this))}return this.then(void 0,t)},i.prototype.reflect=function(){return this._then(u,u,void 0,this,void 0)},i.prototype.then=function(t,e){if(V.warnings()&&arguments.length>0&&"function"!=typeof t&&"function"!=typeof e){var n=".then() only accepts functions but was passed: "+f.classString(t);arguments.length>1&&(n+=", "+f.classString(e)),this._warn(n)}return this._then(t,e,void 0,void 0,void 0)},i.prototype.done=function(t,e){var n=this._then(t,e,void 0,void 0,void 0);n._setIsFinal()},i.prototype.spread=function(t){return"function"!=typeof t?l("expecting a function but got "+f.classString(t)):this.all()._then(t,void 0,void 0,T,void 0)},i.prototype.toJSON=function(){var t={isFulfilled:!1,isRejected:!1,fulfillmentValue:void 0,rejectionReason:void 0};return this.isFulfilled()?(t.fulfillmentValue=this.value(),t.isFulfilled=!0):this.isRejected()&&(t.rejectionReason=this.reason(),t.isRejected=!0),t},i.prototype.all=function(){return arguments.length>0&&this._warn(".all() was passed arguments but it does not take any"),new S(this).promise()},i.prototype.error=function(t){return this.caught(f.originatesFromRejection,t)},i.getNewLibraryCopy=e.exports,i.is=function(t){return t instanceof i},i.fromNode=i.fromCallback=function(t){var e=new i(x);e._captureStackTrace();var n=arguments.length>1?!!Object(arguments[1]).multiArgs:!1,r=N(t)(I(e,n));return r===L&&e._rejectCallback(r.e,!0),e._isFateSealed()||e._setAsyncGuaranteed(),e},i.all=function(t){return new S(t).promise()},i.cast=function(t){var e=R(t);return e instanceof i||(e=new i(x),e._captureStackTrace(),e._setFulfilled(),e._rejectionHandler0=t),e},i.resolve=i.fulfilled=i.cast,i.reject=i.rejected=function(t){var e=new i(x);return e._captureStackTrace(),e._rejectCallback(t,!0),e},i.setScheduler=function(t){if("function"!=typeof t)throw new E("expecting a function but got "+f.classString(t));return j.setScheduler(t)},i.prototype._then=function(t,e,n,r,o){var s=void 0!==o,a=s?o:new i(x),c=this._target(),u=c._bitField;s||(a._propagateFrom(this,3),a._captureStackTrace(),void 0===r&&0!==(2097152&this._bitField)&&(r=0!==(50397184&u)?this._boundValue():c===this?void 0:this._boundTo),this._fireEvent("promiseChained",this,a));var l=g();if(0!==(50397184&u)){var p,h,_=c._settlePromiseCtx;0!==(33554432&u)?(h=c._rejectionHandler0,p=t):0!==(16777216&u)?(h=c._fulfillmentHandler0,p=e,c._unsetRejectionIsUnhandled()):(_=c._settlePromiseLateCancellationObserver,h=new F("late cancellation observer"),c._attachExtraTrace(h),p=e),j.invoke(_,c,{handler:f.contextBind(l,p),promise:a,receiver:r,value:h})}else c._addCallbacks(t,e,a,r,l);return a},i.prototype._length=function(){return 65535&this._bitField},i.prototype._isFateSealed=function(){return 0!==(117506048&this._bitField)},i.prototype._isFollowing=function(){return 67108864===(67108864&this._bitField)},i.prototype._setLength=function(t){this._bitField=-65536&this._bitField|65535&t},i.prototype._setFulfilled=function(){this._bitField=33554432|this._bitField,this._fireEvent("promiseFulfilled",this)},i.prototype._setRejected=function(){this._bitField=16777216|this._bitField,this._fireEvent("promiseRejected",this)},i.prototype._setFollowing=function(){this._bitField=67108864|this._bitField,this._fireEvent("promiseResolved",this)},i.prototype._setIsFinal=function(){this._bitField=4194304|this._bitField},i.prototype._isFinal=function(){return(4194304&this._bitField)>0},i.prototype._unsetCancelled=function(){this._bitField=-65537&this._bitField},i.prototype._setCancelled=function(){this._bitField=65536|this._bitField,this._fireEvent("promiseCancelled",this)},i.prototype._setWillBeCancelled=function(){this._bitField=8388608|this._bitField},i.prototype._setAsyncGuaranteed=function(){if(!j.hasCustomScheduler()){var t=this._bitField;this._bitField=t|(536870912&t)>>2^134217728}},i.prototype._setNoAsyncGuarantee=function(){this._bitField=-134217729&(536870912|this._bitField)},i.prototype._receiverAt=function(t){var e=0===t?this._receiver0:this[4*t-4+3];return e===p?void 0:void 0===e&&this._isBound()?this._boundValue():e},i.prototype._promiseAt=function(t){return this[4*t-4+2]},i.prototype._fulfillmentHandlerAt=function(t){return this[4*t-4+0]},i.prototype._rejectionHandlerAt=function(t){return this[4*t-4+1]},i.prototype._boundValue=function(){},i.prototype._migrateCallback0=function(t){var e=(t._bitField,t._fulfillmentHandler0),n=t._rejectionHandler0,r=t._promise0,i=t._receiverAt(0);void 0===i&&(i=p),this._addCallbacks(e,n,r,i,null)},i.prototype._migrateCallbackAt=function(t,e){var n=t._fulfillmentHandlerAt(e),r=t._rejectionHandlerAt(e),i=t._promiseAt(e),o=t._receiverAt(e);void 0===o&&(o=p),this._addCallbacks(n,r,i,o,null)},i.prototype._addCallbacks=function(t,e,n,r,i){var o=this._length();if(o>=65531&&(o=0,this._setLength(0)),0===o)this._promise0=n,this._receiver0=r,"function"==typeof t&&(this._fulfillmentHandler0=f.contextBind(i,t)),"function"==typeof e&&(this._rejectionHandler0=f.contextBind(i,e));else{var s=4*o-4;this[s+2]=n,this[s+3]=r,"function"==typeof t&&(this[s+0]=f.contextBind(i,t)),"function"==typeof e&&(this[s+1]=f.contextBind(i,e))}return this._setLength(o+1),o},i.prototype._proxy=function(t,e){this._addCallbacks(void 0,void 0,e,t,null)},i.prototype._resolveCallback=function(t,e){if(0===(117506048&this._bitField)){if(t===this)return this._rejectCallback(c(),!1);var n=R(t,this);if(!(n instanceof i))return this._fulfill(t);e&&this._propagateFrom(n,2);var r=n._target();if(r===this)return void this._reject(c());var o=r._bitField;if(0===(50397184&o)){var s=this._length();s>0&&r._migrateCallback0(this);for(var a=1;s>a;++a)r._migrateCallbackAt(this,a);this._setFollowing(),this._setLength(0),this._setFollowee(n)}else if(0!==(33554432&o))this._fulfill(r._value());else if(0!==(16777216&o))this._reject(r._reason());else{var u=new F("late cancellation observer");r._attachExtraTrace(u),this._reject(u)}}},i.prototype._rejectCallback=function(t,e,n){var r=f.ensureErrorObject(t),i=r===t;if(!i&&!n&&V.warnings()){var o="a promise was rejected with a non-error: "+f.classString(t);this._warn(o,!0)}this._attachExtraTrace(r,e?i:!1),this._reject(t)},i.prototype._resolveFromExecutor=function(t){if(t!==x){var e=this;this._captureStackTrace(),this._pushContext();var n=!0,r=this._execute(t,function(t){e._resolveCallback(t)},function(t){e._rejectCallback(t,n)});n=!1,this._popContext(),void 0!==r&&e._rejectCallback(r,!0)}},i.prototype._settlePromiseFromHandler=function(t,e,n,r){var i=r._bitField;if(0===(65536&i)){r._pushContext();var o;e===T?n&&"number"==typeof n.length?o=N(t).apply(this._boundValue(),n):(o=L,o.e=new E("cannot .spread() a non-array: "+f.classString(n))):o=N(t).call(e,n);var s=r._popContext();i=r._bitField,0===(65536&i)&&(o===P?r._reject(n):o===L?r._rejectCallback(o.e,!1):(V.checkForgottenReturns(o,s,"",r,this),r._resolveCallback(o)))}},i.prototype._target=function(){for(var t=this;t._isFollowing();)t=t._followee();return t},i.prototype._followee=function(){return this._rejectionHandler0},i.prototype._setFollowee=function(t){this._rejectionHandler0=t},i.prototype._settlePromise=function(t,e,r,o){var s=t instanceof i,a=this._bitField,c=0!==(134217728&a);0!==(65536&a)?(s&&t._invokeInternalOnCancel(),r instanceof H&&r.isFinallyHandler()?(r.cancelPromise=t,N(e).call(r,o)===L&&t._reject(L.e)):e===u?t._fulfill(u.call(r)):r instanceof n?r._promiseCancelled(t):s||t instanceof S?t._cancel():r.cancel()):"function"==typeof e?s?(c&&t._setAsyncGuaranteed(),this._settlePromiseFromHandler(e,r,o,t)):e.call(r,o,t):r instanceof n?r._isResolved()||(0!==(33554432&a)?r._promiseFulfilled(o,t):r._promiseRejected(o,t)):s&&(c&&t._setAsyncGuaranteed(),0!==(33554432&a)?t._fulfill(o):t._reject(o))},i.prototype._settlePromiseLateCancellationObserver=function(t){var e=t.handler,n=t.promise,r=t.receiver,o=t.value;"function"==typeof e?n instanceof i?this._settlePromiseFromHandler(e,r,o,n):e.call(r,o,n):n instanceof i&&n._reject(o)},i.prototype._settlePromiseCtx=function(t){this._settlePromise(t.promise,t.handler,t.receiver,t.value)},i.prototype._settlePromise0=function(t,e,n){var r=this._promise0,i=this._receiverAt(0);this._promise0=void 0,this._receiver0=void 0,this._settlePromise(r,t,i,e)},i.prototype._clearCallbackDataAtIndex=function(t){var e=4*t-4;this[e+2]=this[e+3]=this[e+0]=this[e+1]=void 0},i.prototype._fulfill=function(t){var e=this._bitField;if(!((117506048&e)>>>16)){if(t===this){var n=c();return this._attachExtraTrace(n),this._reject(n)}this._setFulfilled(),this._rejectionHandler0=t,(65535&e)>0&&(0!==(134217728&e)?this._settlePromises():j.settlePromises(this),this._dereferenceTrace())}},i.prototype._reject=function(t){var e=this._bitField;if(!((117506048&e)>>>16))return this._setRejected(),this._fulfillmentHandler0=t,this._isFinal()?j.fatalError(t,f.isNode):void((65535&e)>0?j.settlePromises(this):this._ensurePossibleRejectionHandled())},i.prototype._fulfillPromises=function(t,e){for(var n=1;t>n;n++){var r=this._fulfillmentHandlerAt(n),i=this._promiseAt(n),o=this._receiverAt(n);this._clearCallbackDataAtIndex(n),this._settlePromise(i,r,o,e)}},i.prototype._rejectPromises=function(t,e){for(var n=1;t>n;n++){var r=this._rejectionHandlerAt(n),i=this._promiseAt(n),o=this._receiverAt(n);this._clearCallbackDataAtIndex(n),this._settlePromise(i,r,o,e)}},i.prototype._settlePromises=function(){var t=this._bitField,e=65535&t;if(e>0){if(0!==(16842752&t)){var n=this._fulfillmentHandler0;this._settlePromise0(this._rejectionHandler0,n,t),this._rejectPromises(e,n)}else{var r=this._rejectionHandler0;this._settlePromise0(this._fulfillmentHandler0,r,t),this._fulfillPromises(e,r)}this._setLength(0)}this._clearCancellationData()},i.prototype._settledValue=function(){var t=this._bitField;return 0!==(33554432&t)?this._rejectionHandler0:0!==(16777216&t)?this._fulfillmentHandler0:void 0},"undefined"!=typeof Symbol&&Symbol.toStringTag&&w.defineProperty(i.prototype,Symbol.toStringTag,{get:function(){return"Object"}}),i.defer=i.pending=function(){V.deprecated("Promise.defer","new Promise");var t=new i(x);return{promise:t,resolve:o,reject:s}},f.notEnumerableProp(i,"_makeSelfResolutionError",c),t("./method")(i,x,R,l,V),t("./bind")(i,x,R,V),t("./cancel")(i,S,l,V),t("./direct_resolve")(i),t("./synchronous_inspection")(i),t("./join")(i,S,R,x,j),i.Promise=i,i.version="3.7.2",t("./call_get.js")(i),t("./generators.js")(i,l,x,R,n,V),t("./map.js")(i,S,l,R,x,V),t("./nodeify.js")(i),t("./promisify.js")(i,x),t("./props.js")(i,S,R,l),t("./race.js")(i,x,R,l),t("./reduce.js")(i,S,l,R,x,V),t("./settle.js")(i,S,V),t("./some.js")(i,S,l),t("./timers.js")(i,x,V),t("./using.js")(i,l,R,A,x,V),t("./any.js")(i),t("./each.js")(i,x),t("./filter.js")(i,x),f.toFastProperties(i),f.toFastProperties(i.prototype),a({a:1}),a({b:2}),a({c:3}),a(1),a(function(){}),a(void 0),a(!1),a(new i(x)),V.setBounds(C.firstLineError,f.lastLineError),i}},{"./any.js":1,"./async":2,"./bind":3,"./call_get.js":5,"./cancel":6,"./catch_filter":7,"./context":8,"./debuggability":9,"./direct_resolve":10,"./each.js":11,"./errors":12,"./es5":13,"./filter.js":14,"./finally":15,"./generators.js":16,"./join":17,"./map.js":18,"./method":19,"./nodeback":20,"./nodeify.js":21,"./promise_array":23,"./promisify.js":24,"./props.js":25,"./race.js":27,"./reduce.js":28,"./settle.js":30,"./some.js":31,"./synchronous_inspection":32,"./thenables":33,"./timers.js":34,"./using.js":35,"./util":36,async_hooks:void 0}],23:[function(t,e,n){"use strict";e.exports=function(e,n,r,i,o){function s(t){switch(t){case-2:return[];case-3:return{};case-6:return new Map}}function a(t){var r=this._promise=new e(n);t instanceof e&&(r._propagateFrom(t,3),t.suppressUnhandledRejections()),r._setOnCancel(this),this._values=t,this._length=0,this._totalResolved=0,this._init(void 0,-2)}var c=t("./util");c.isArray;return c.inherits(a,o),a.prototype.length=function(){return this._length},a.prototype.promise=function(){return this._promise},a.prototype._init=function u(t,n){var o=r(this._values,this._promise);if(o instanceof e){o=o._target();var a=o._bitField;if(this._values=o,0===(50397184&a))return this._promise._setAsyncGuaranteed(),o._then(u,this._reject,void 0,this,n);if(0===(33554432&a))return 0!==(16777216&a)?this._reject(o._reason()):this._cancel();o=o._value()}if(o=c.asArray(o),null===o){var l=i("expecting an array or an iterable object but got "+c.classString(o)).reason();return void this._promise._rejectCallback(l,!1)}return 0===o.length?void(-5===n?this._resolveEmptyArray():this._resolve(s(n))):void this._iterate(o)},a.prototype._iterate=function(t){var n=this.getActualLength(t.length);this._length=n,this._values=this.shouldCopyValues()?new Array(n):this._values;for(var i=this._promise,o=!1,s=null,a=0;n>a;++a){var c=r(t[a],i);c instanceof e?(c=c._target(),s=c._bitField):s=null,o?null!==s&&c.suppressUnhandledRejections():null!==s?0===(50397184&s)?(c._proxy(this,a),this._values[a]=c):o=0!==(33554432&s)?this._promiseFulfilled(c._value(),a):0!==(16777216&s)?this._promiseRejected(c._reason(),a):this._promiseCancelled(a):o=this._promiseFulfilled(c,a)}o||i._setAsyncGuaranteed()},a.prototype._isResolved=function(){return null===this._values},a.prototype._resolve=function(t){this._values=null,this._promise._fulfill(t)},a.prototype._cancel=function(){!this._isResolved()&&this._promise._isCancellable()&&(this._values=null,this._promise._cancel())},a.prototype._reject=function(t){this._values=null,this._promise._rejectCallback(t,!1)},a.prototype._promiseFulfilled=function(t,e){this._values[e]=t;var n=++this._totalResolved;return n>=this._length?(this._resolve(this._values),!0):!1},a.prototype._promiseCancelled=function(){return this._cancel(),!0},a.prototype._promiseRejected=function(t){return this._totalResolved++,this._reject(t),!0},a.prototype._resultCancelled=function(){if(!this._isResolved()){var t=this._values;if(this._cancel(),t instanceof e)t.cancel();else for(var n=0;n<t.length;++n)t[n]instanceof e&&t[n].cancel()}},a.prototype.shouldCopyValues=function(){return!0},a.prototype.getActualLength=function(t){return t},a}},{"./util":36}],24:[function(t,e,n){"use strict";e.exports=function(e,n){function r(t){return!C.test(t)}function i(t){try{return t.__isPromisified__===!0}catch(e){return!1}}function o(t,e,n){var r=h.getDataPropertyOrDefault(t,e+n,b);return r?i(r):!1}function s(t,e,n){for(var r=0;r<t.length;r+=2){var i=t[r];if(n.test(i))for(var o=i.replace(n,""),s=0;s<t.length;s+=2)if(t[s]===o)throw new g("Cannot promisify an API that has normal methods with '%s'-suffix\n\n See http://goo.gl/MqrFmX\n".replace("%s",e))}}function a(t,e,n,r){for(var a=h.inheritedDataKeys(t),c=[],u=0;u<a.length;++u){var l=a[u],p=t[l],f=r===j?!0:j(l,p,t);"function"!=typeof p||i(p)||o(t,l,e)||!r(l,p,t,f)||c.push(l,p)}return s(c,e,n),c}function c(t,r,i,o,s,a){function c(){var i=r;r===f&&(i=this);var o=new e(n);o._captureStackTrace();var s="string"==typeof l&&this!==u?this[l]:t,c=_(o,a);try{s.apply(i,d(arguments,c))}catch(p){o._rejectCallback(v(p),!0,!0)}return o._isFateSealed()||o._setAsyncGuaranteed(),o}var u=function(){return this}(),l=t;return"string"==typeof l&&(t=o),h.notEnumerableProp(c,"__isPromisified__",!0),c}function u(t,e,n,r,i){for(var o=new RegExp(k(e)+"$"),s=a(t,e,o,n),c=0,u=s.length;u>c;c+=2){var l=s[c],p=s[c+1],_=l+e;if(r===E)t[_]=E(l,f,l,p,e,i);else{var d=r(p,function(){return E(l,f,l,p,e,i)});h.notEnumerableProp(d,"__isPromisified__",!0),t[_]=d}}return h.toFastProperties(t),t}function l(t,e,n){return E(t,e,void 0,t,null,n)}var p,f={},h=t("./util"),_=t("./nodeback"),d=h.withAppended,v=h.maybeWrapAsError,y=h.canEvaluate,g=t("./errors").TypeError,m="Async",b={__isPromisified__:!0},w=["arity","length","name","arguments","caller","callee","prototype","__isPromisified__"],C=new RegExp("^(?:"+w.join("|")+")$"),j=function(t){return h.isIdentifier(t)&&"_"!==t.charAt(0)&&"constructor"!==t},k=function(t){return t.replace(new RegExp(/\$/, 'g'),"\\$")},E=y?p:c;e.promisify=function(t,e){if("function"!=typeof t)throw new g("expecting a function but got "+h.classString(t));if(i(t))return t;e=Object(e);var n=void 0===e.context?f:e.context,o=!!e.multiArgs,s=l(t,n,o);return h.copyDescriptors(t,s,r),s},e.promisifyAll=function(t,e){if("function"!=typeof t&&"object"!=typeof t)throw new g("the target of promisifyAll must be an object or a function\n\n See http://goo.gl/MqrFmX\n");e=Object(e);var n=!!e.multiArgs,r=e.suffix;"string"!=typeof r&&(r=m);var i=e.filter;"function"!=typeof i&&(i=j);var o=e.promisifier;if("function"!=typeof o&&(o=E),!h.isIdentifier(r))throw new RangeError("suffix must be a valid identifier\n\n See http://goo.gl/MqrFmX\n");for(var s=h.inheritedDataKeys(t),a=0;a<s.length;++a){var c=t[s[a]];"constructor"!==s[a]&&h.isClass(c)&&(u(c.prototype,r,i,o,n),u(c,r,i,o,n))}return u(t,r,i,o,n)}}},{"./errors":12,"./nodeback":20,"./util":36}],25:[function(t,e,n){"use strict";e.exports=function(e,n,r,i){function o(t){var e,n=!1;if(void 0!==a&&t instanceof a)e=p(t),n=!0;else{var r=l.keys(t),i=r.length;e=new Array(2*i);for(var o=0;i>o;++o){var s=r[o];e[o]=t[s],e[o+i]=s}}this.constructor$(e),this._isMap=n,this._init$(void 0,n?-6:-3)}function s(t){var n,s=r(t);return u(s)?(n=s instanceof e?s._then(e.props,void 0,void 0,void 0,void 0):new o(s).promise(),s instanceof e&&n._propagateFrom(s,2),n):i("cannot await properties of a non-object\n\n See http://goo.gl/MqrFmX\n")}var a,c=t("./util"),u=c.isObject,l=t("./es5");"function"==typeof Map&&(a=Map);var p=function(){function t(t,r){this[e]=t,this[e+n]=r,e++}var e=0,n=0;return function(r){n=r.size,e=0;var i=new Array(2*r.size);return r.forEach(t,i),i}}(),f=function(t){for(var e=new a,n=t.length/2|0,r=0;n>r;++r){var i=t[n+r],o=t[r];e.set(i,o)}return e};c.inherits(o,n),o.prototype._init=function(){},o.prototype._promiseFulfilled=function(t,e){this._values[e]=t;var n=++this._totalResolved;if(n>=this._length){var r;if(this._isMap)r=f(this._values);else{r={};for(var i=this.length(),o=0,s=this.length();s>o;++o)r[this._values[o+i]]=this._values[o]}return this._resolve(r),!0}return!1},o.prototype.shouldCopyValues=function(){return!1},o.prototype.getActualLength=function(t){return t>>1},e.prototype.props=function(){return s(this)},e.props=function(t){return s(t)}}},{"./es5":13,"./util":36}],26:[function(t,e,n){"use strict";function r(t,e,n,r,i){for(var o=0;i>o;++o)n[o+r]=t[o+e],t[o+e]=void 0}function i(t){this._capacity=t,this._length=0,this._front=0}i.prototype._willBeOverCapacity=function(t){return this._capacity<t},i.prototype._pushOne=function(t){var e=this.length();this._checkCapacity(e+1);var n=this._front+e&this._capacity-1;this[n]=t,this._length=e+1},i.prototype.push=function(t,e,n){var r=this.length()+3;if(this._willBeOverCapacity(r))return this._pushOne(t),this._pushOne(e),void this._pushOne(n);var i=this._front+r-3;this._checkCapacity(r);var o=this._capacity-1;this[i+0&o]=t,this[i+1&o]=e,this[i+2&o]=n,this._length=r},i.prototype.shift=function(){var t=this._front,e=this[t];return this[t]=void 0,this._front=t+1&this._capacity-1,this._length--,e},i.prototype.length=function(){return this._length},i.prototype._checkCapacity=function(t){this._capacity<t&&this._resizeTo(this._capacity<<1)},i.prototype._resizeTo=function(t){var e=this._capacity;this._capacity=t;var n=this._front,i=this._length,o=n+i&e-1;r(this,0,this,e,o)},e.exports=i},{}],27:[function(t,e,n){"use strict";e.exports=function(e,n,r,i){function o(t,o){var c=r(t);if(c instanceof e)return a(c);if(t=s.asArray(t),null===t)return i("expecting an array or an iterable object but got "+s.classString(t));var u=new e(n);void 0!==o&&u._propagateFrom(o,3);for(var l=u._fulfill,p=u._reject,f=0,h=t.length;h>f;++f){var _=t[f];(void 0!==_||f in t)&&e.cast(_)._then(l,p,void 0,u,null)}return u}var s=t("./util"),a=function(t){return t.then(function(e){return o(e,t)})};e.race=function(t){return o(t,void 0)},e.prototype.race=function(){return o(this,void 0)}}},{"./util":36}],28:[function(t,e,n){"use strict";e.exports=function(e,n,r,i,o,s){function a(t,n,r,i){this.constructor$(t);var s=e._getContext();this._fn=f.contextBind(s,n),void 0!==r&&(r=e.resolve(r),r._attachCancellationCallback(this)),this._initialValue=r,this._currentCancellable=null,i===o?this._eachValues=Array(this._length):0===i?this._eachValues=null:this._eachValues=void 0,this._promise._captureStackTrace(),this._init$(void 0,-5)}function c(t,e){this.isFulfilled()?e._resolve(t):e._reject(t)}function u(t,e,n,i){if("function"!=typeof e)return r("expecting a function but got "+f.classString(e));var o=new a(t,e,n,i);return o.promise()}function l(t){this.accum=t,this.array._gotAccum(t);var n=i(this.value,this.array._promise);return n instanceof e?(this.array._currentCancellable=n,n._then(p,void 0,void 0,this,void 0)):p.call(this,n)}function p(t){var n=this.array,r=n._promise,i=h(n._fn);r._pushContext();var o;o=void 0!==n._eachValues?i.call(r._boundValue(),t,this.index,this.length):i.call(r._boundValue(),this.accum,t,this.index,this.length),o instanceof e&&(n._currentCancellable=o);var a=r._popContext();return s.checkForgottenReturns(o,a,void 0!==n._eachValues?"Promise.each":"Promise.reduce",r),o}var f=t("./util"),h=f.tryCatch;f.inherits(a,n),a.prototype._gotAccum=function(t){void 0!==this._eachValues&&null!==this._eachValues&&t!==o&&this._eachValues.push(t)},a.prototype._eachComplete=function(t){return null!==this._eachValues&&this._eachValues.push(t),this._eachValues},a.prototype._init=function(){},a.prototype._resolveEmptyArray=function(){this._resolve(void 0!==this._eachValues?this._eachValues:this._initialValue)},a.prototype.shouldCopyValues=function(){return!1},a.prototype._resolve=function(t){this._promise._resolveCallback(t),this._values=null},a.prototype._resultCancelled=function(t){return t===this._initialValue?this._cancel():void(this._isResolved()||(this._resultCancelled$(),this._currentCancellable instanceof e&&this._currentCancellable.cancel(),this._initialValue instanceof e&&this._initialValue.cancel()))},a.prototype._iterate=function(t){this._values=t;var n,r,i=t.length;void 0!==this._initialValue?(n=this._initialValue,r=0):(n=e.resolve(t[0]),r=1),this._currentCancellable=n;for(var o=r;i>o;++o){var s=t[o];s instanceof e&&s.suppressUnhandledRejections()}if(!n.isRejected())for(;i>r;++r){var a={accum:null,value:t[r],index:r,length:i,array:this};n=n._then(l,void 0,void 0,a,void 0),0===(127&r)&&n._setNoAsyncGuarantee()}void 0!==this._eachValues&&(n=n._then(this._eachComplete,void 0,void 0,this,void 0)),n._then(c,c,void 0,n,this)},e.prototype.reduce=function(t,e){return u(this,t,e,null)},e.reduce=function(t,e,n,r){return u(t,e,n,r)}}},{"./util":36}],29:[function(t,e,n){"use strict";var r,i=t("./util"),o=function(){throw new Error("No async scheduler available\n\n See http://goo.gl/MqrFmX\n")},s=i.getNativePromise();if(i.isNode&&"undefined"==typeof MutationObserver){var a=global.setImmediate,c=process.nextTick;r=i.isRecentNode?function(t){a.call(global,t)}:function(t){c.call(process,t)}}else if("function"==typeof s&&"function"==typeof s.resolve){
var u=s.resolve();r=function(t){u.then(t)}}else r="undefined"!=typeof MutationObserver&&("undefined"==typeof window||!window.navigator||!window.navigator.standalone&&!window.cordova)&&"classList"in document.documentElement?function(){var t=document.createElement("div"),e={attributes:!0},n=!1,r=document.createElement("div"),i=new MutationObserver(function(){t.classList.toggle("foo"),n=!1});i.observe(r,e);var o=function(){n||(n=!0,r.classList.toggle("foo"))};return function(n){var r=new MutationObserver(function(){r.disconnect(),n()});r.observe(t,e),o()}}():"undefined"!=typeof setImmediate?function(t){setImmediate(t)}:"undefined"!=typeof setTimeout?function(t){setTimeout(t,0)}:o;e.exports=r},{"./util":36}],30:[function(t,e,n){"use strict";e.exports=function(e,n,r){function i(t){this.constructor$(t)}var o=e.PromiseInspection,s=t("./util");s.inherits(i,n),i.prototype._promiseResolved=function(t,e){this._values[t]=e;var n=++this._totalResolved;return n>=this._length?(this._resolve(this._values),!0):!1},i.prototype._promiseFulfilled=function(t,e){var n=new o;return n._bitField=33554432,n._settledValueField=t,this._promiseResolved(e,n)},i.prototype._promiseRejected=function(t,e){var n=new o;return n._bitField=16777216,n._settledValueField=t,this._promiseResolved(e,n)},e.settle=function(t){return r.deprecated(".settle()",".reflect()"),new i(t).promise()},e.allSettled=function(t){return new i(t).promise()},e.prototype.settle=function(){return e.settle(this)}}},{"./util":36}],31:[function(t,e,n){"use strict";e.exports=function(e,n,r){function i(t){this.constructor$(t),this._howMany=0,this._unwrap=!1,this._initialized=!1}function o(t,e){if((0|e)!==e||0>e)return r("expecting a positive integer\n\n See http://goo.gl/MqrFmX\n");var n=new i(t),o=n.promise();return n.setHowMany(e),n.init(),o}var s=t("./util"),a=t("./errors").RangeError,c=t("./errors").AggregateError,u=s.isArray,l={};s.inherits(i,n),i.prototype._init=function(){if(this._initialized){if(0===this._howMany)return void this._resolve([]);this._init$(void 0,-5);var t=u(this._values);!this._isResolved()&&t&&this._howMany>this._canPossiblyFulfill()&&this._reject(this._getRangeError(this.length()))}},i.prototype.init=function(){this._initialized=!0,this._init()},i.prototype.setUnwrap=function(){this._unwrap=!0},i.prototype.howMany=function(){return this._howMany},i.prototype.setHowMany=function(t){this._howMany=t},i.prototype._promiseFulfilled=function(t){return this._addFulfilled(t),this._fulfilled()===this.howMany()?(this._values.length=this.howMany(),1===this.howMany()&&this._unwrap?this._resolve(this._values[0]):this._resolve(this._values),!0):!1},i.prototype._promiseRejected=function(t){return this._addRejected(t),this._checkOutcome()},i.prototype._promiseCancelled=function(){return this._values instanceof e||null==this._values?this._cancel():(this._addRejected(l),this._checkOutcome())},i.prototype._checkOutcome=function(){if(this.howMany()>this._canPossiblyFulfill()){for(var t=new c,e=this.length();e<this._values.length;++e)this._values[e]!==l&&t.push(this._values[e]);return t.length>0?this._reject(t):this._cancel(),!0}return!1},i.prototype._fulfilled=function(){return this._totalResolved},i.prototype._rejected=function(){return this._values.length-this.length()},i.prototype._addRejected=function(t){this._values.push(t)},i.prototype._addFulfilled=function(t){this._values[this._totalResolved++]=t},i.prototype._canPossiblyFulfill=function(){return this.length()-this._rejected()},i.prototype._getRangeError=function(t){var e="Input array must contain at least "+this._howMany+" items but contains only "+t+" items";return new a(e)},i.prototype._resolveEmptyArray=function(){this._reject(this._getRangeError(0))},e.some=function(t,e){return o(t,e)},e.prototype.some=function(t){return o(this,t)},e._SomePromiseArray=i}},{"./errors":12,"./util":36}],32:[function(t,e,n){"use strict";e.exports=function(t){function e(t){void 0!==t?(t=t._target(),this._bitField=t._bitField,this._settledValueField=t._isFateSealed()?t._settledValue():void 0):(this._bitField=0,this._settledValueField=void 0)}e.prototype._settledValue=function(){return this._settledValueField};var n=e.prototype.value=function(){if(!this.isFulfilled())throw new TypeError("cannot get fulfillment value of a non-fulfilled promise\n\n See http://goo.gl/MqrFmX\n");return this._settledValue()},r=e.prototype.error=e.prototype.reason=function(){if(!this.isRejected())throw new TypeError("cannot get rejection reason of a non-rejected promise\n\n See http://goo.gl/MqrFmX\n");return this._settledValue()},i=e.prototype.isFulfilled=function(){return 0!==(33554432&this._bitField)},o=e.prototype.isRejected=function(){return 0!==(16777216&this._bitField)},s=e.prototype.isPending=function(){return 0===(50397184&this._bitField)},a=e.prototype.isResolved=function(){return 0!==(50331648&this._bitField)};e.prototype.isCancelled=function(){return 0!==(8454144&this._bitField)},t.prototype.__isCancelled=function(){return 65536===(65536&this._bitField)},t.prototype._isCancelled=function(){return this._target().__isCancelled()},t.prototype.isCancelled=function(){return 0!==(8454144&this._target()._bitField)},t.prototype.isPending=function(){return s.call(this._target())},t.prototype.isRejected=function(){return o.call(this._target())},t.prototype.isFulfilled=function(){return i.call(this._target())},t.prototype.isResolved=function(){return a.call(this._target())},t.prototype.value=function(){return n.call(this._target())},t.prototype.reason=function(){var t=this._target();return t._unsetRejectionIsUnhandled(),r.call(t)},t.prototype._value=function(){return this._settledValue()},t.prototype._reason=function(){return this._unsetRejectionIsUnhandled(),this._settledValue()},t.PromiseInspection=e}},{}],33:[function(t,e,n){"use strict";e.exports=function(e,n){function r(t,r){if(l(t)){if(t instanceof e)return t;var i=o(t);if(i===u){r&&r._pushContext();var c=e.reject(i.e);return r&&r._popContext(),c}if("function"==typeof i){if(s(t)){var c=new e(n);return t._then(c._fulfill,c._reject,void 0,c,null),c}return a(t,i,r)}}return t}function i(t){return t.then}function o(t){try{return i(t)}catch(e){return u.e=e,u}}function s(t){try{return p.call(t,"_promise0")}catch(e){return!1}}function a(t,r,i){function o(t){a&&(a._resolveCallback(t),a=null)}function s(t){a&&(a._rejectCallback(t,p,!0),a=null)}var a=new e(n),l=a;i&&i._pushContext(),a._captureStackTrace(),i&&i._popContext();var p=!0,f=c.tryCatch(r).call(t,o,s);return p=!1,a&&f===u&&(a._rejectCallback(f.e,!0,!0),a=null),l}var c=t("./util"),u=c.errorObj,l=c.isObject,p={}.hasOwnProperty;return r}},{"./util":36}],34:[function(t,e,n){"use strict";e.exports=function(e,n,r){function i(t){this.handle=t}function o(t){return clearTimeout(this.handle),t}function s(t){throw clearTimeout(this.handle),t}var a=t("./util"),c=e.TimeoutError;i.prototype._resultCancelled=function(){clearTimeout(this.handle)};var u=function(t){return l(+this).thenReturn(t)},l=e.delay=function(t,o){var s,a;return void 0!==o?(s=e.resolve(o)._then(u,null,null,t,void 0),r.cancellation()&&o instanceof e&&s._setOnCancel(o)):(s=new e(n),a=setTimeout(function(){s._fulfill()},+t),r.cancellation()&&s._setOnCancel(new i(a)),s._captureStackTrace()),s._setAsyncGuaranteed(),s};e.prototype.delay=function(t){return l(t,this)};var p=function(t,e,n){var r;r="string"!=typeof e?e instanceof Error?e:new c("operation timed out"):new c(e),a.markAsOriginatingFromRejection(r),t._attachExtraTrace(r),t._reject(r),null!=n&&n.cancel()};e.prototype.timeout=function(t,e){t=+t;var n,a,c=new i(setTimeout(function(){n.isPending()&&p(n,e,a)},t));return r.cancellation()?(a=this.then(),n=a._then(o,s,void 0,c,void 0),n._setOnCancel(c)):n=this._then(o,s,void 0,c,void 0),n}}},{"./util":36}],35:[function(t,e,n){"use strict";e.exports=function(e,n,r,i,o,s){function a(t){setTimeout(function(){throw t},0)}function c(t){var e=r(t);return e!==t&&"function"==typeof t._isDisposable&&"function"==typeof t._getDisposer&&t._isDisposable()&&e._setDisposable(t._getDisposer()),e}function u(t,n){function i(){if(s>=u)return l._fulfill();var o=c(t[s++]);if(o instanceof e&&o._isDisposable()){try{o=r(o._getDisposer().tryDispose(n),t.promise)}catch(p){return a(p)}if(o instanceof e)return o._then(i,a,null,null,null)}i()}var s=0,u=t.length,l=new e(o);return i(),l}function l(t,e,n){this._data=t,this._promise=e,this._context=n}function p(t,e,n){this.constructor$(t,e,n)}function f(t){return l.isDisposer(t)?(this.resources[this.index]._setDisposable(t),t.promise()):t}function h(t){this.length=t,this.promise=null,this[t-1]=null}var _=t("./util"),d=t("./errors").TypeError,v=t("./util").inherits,y=_.errorObj,g=_.tryCatch,m={};l.prototype.data=function(){return this._data},l.prototype.promise=function(){return this._promise},l.prototype.resource=function(){return this.promise().isFulfilled()?this.promise().value():m},l.prototype.tryDispose=function(t){var e=this.resource(),n=this._context;void 0!==n&&n._pushContext();var r=e!==m?this.doDispose(e,t):null;return void 0!==n&&n._popContext(),this._promise._unsetDisposable(),this._data=null,r},l.isDisposer=function(t){return null!=t&&"function"==typeof t.resource&&"function"==typeof t.tryDispose},v(p,l),p.prototype.doDispose=function(t,e){var n=this.data();return n.call(t,t,e)},h.prototype._resultCancelled=function(){for(var t=this.length,n=0;t>n;++n){var r=this[n];r instanceof e&&r.cancel()}},e.using=function(){var t=arguments.length;if(2>t)return n("you must pass at least 2 arguments to Promise.using");var i=arguments[t-1];if("function"!=typeof i)return n("expecting a function but got "+_.classString(i));var o,a=!0;2===t&&Array.isArray(arguments[0])?(o=arguments[0],t=o.length,a=!1):(o=arguments,t--);for(var c=new h(t),p=0;t>p;++p){var d=o[p];if(l.isDisposer(d)){var v=d;d=d.promise(),d._setDisposable(v)}else{var m=r(d);m instanceof e&&(d=m._then(f,null,null,{resources:c,index:p},void 0))}c[p]=d}for(var b=new Array(c.length),p=0;p<b.length;++p)b[p]=e.resolve(c[p]).reflect();var w=e.all(b).then(function(t){for(var e=0;e<t.length;++e){var n=t[e];if(n.isRejected())return y.e=n.error(),y;if(!n.isFulfilled())return void w.cancel();t[e]=n.value()}C._pushContext(),i=g(i);var r=a?i.apply(void 0,t):i(t),o=C._popContext();return s.checkForgottenReturns(r,o,"Promise.using",C),r}),C=w.lastly(function(){var t=new e.PromiseInspection(w);return u(c,t)});return c.promise=C,C._setOnCancel(c),C},e.prototype._setDisposable=function(t){this._bitField=131072|this._bitField,this._disposer=t},e.prototype._isDisposable=function(){return(131072&this._bitField)>0},e.prototype._getDisposer=function(){return this._disposer},e.prototype._unsetDisposable=function(){this._bitField=-131073&this._bitField,this._disposer=void 0},e.prototype.disposer=function(t){if("function"==typeof t)return new p(t,this,i());throw new d}}},{"./errors":12,"./util":36}],36:[function(t,e,n){"use strict";function r(){try{var t=P;return P=null,t.apply(this,arguments)}catch(e){return T.e=e,T}}function i(t){return P=t,r}function o(t){return null==t||t===!0||t===!1||"string"==typeof t||"number"==typeof t}function s(t){return"function"==typeof t||"object"==typeof t&&null!==t}function a(t){return o(t)?new Error(v(t)):t}function c(t,e){var n,r=t.length,i=new Array(r+1);for(n=0;r>n;++n)i[n]=t[n];return i[n]=e,i}function u(t,e,n){if(!F.isES5)return{}.hasOwnProperty.call(t,e)?t[e]:void 0;var r=Object.getOwnPropertyDescriptor(t,e);return null!=r?null==r.get&&null==r.set?r.value:n:void 0}function l(t,e,n){if(o(t))return t;var r={value:n,configurable:!0,enumerable:!1,writable:!0};return F.defineProperty(t,e,r),t}function p(t){throw t}function f(t){try{if("function"==typeof t){var e=F.names(t.prototype),n=F.isES5&&e.length>1,r=e.length>0&&!(1===e.length&&"constructor"===e[0]),i=A.test(t+"")&&F.names(t).length>0;if(n||r||i)return!0}return!1}catch(o){return!1}}function h(t){function e(){}function n(){return typeof r.foo}e.prototype=t;var r=new e;return n(),n(),t}function _(t){return V.test(t)}function d(t,e,n){for(var r=new Array(t),i=0;t>i;++i)r[i]=e+i+n;return r}function v(t){try{return t+""}catch(e){return"[no string representation]"}}function y(t){return t instanceof Error||null!==t&&"object"==typeof t&&"string"==typeof t.message&&"string"==typeof t.name}function g(t){try{l(t,"isOperational",!0)}catch(e){}}function m(t){return null==t?!1:t instanceof Error.__BluebirdErrorTypes__.OperationalError||t.isOperational===!0}function b(t){return y(t)&&F.propertyIsWritable(t,"stack")}function w(t){return{}.toString.call(t)}function C(t,e,n){for(var r=F.names(t),i=0;i<r.length;++i){var o=r[i];if(n(o))try{F.defineProperty(e,o,F.getDescriptor(t,o))}catch(s){}}}function j(t){return N?process.env[t]:void 0}function k(){if("function"==typeof Promise)try{var t=new Promise(function(){});if("[object Promise]"===w(t))return Promise}catch(e){}}function E(t,e){if(null===t||"function"!=typeof e||e===U)return e;null!==t.domain&&(e=t.domain.bind(e));var n=t.async;if(null!==n){var r=e;e=function(){var t=new Array(2).concat([].slice.call(arguments));return t[0]=r,t[1]=this,n.runInAsyncScope.apply(n,t)}}return e}var F=t("./es5"),x="undefined"==typeof navigator,T={e:{}},P,R="undefined"!=typeof self?self:"undefined"!=typeof window?window:"undefined"!=typeof global?global:void 0!==this?this:null,S=function(t,e){function n(){this.constructor=t,this.constructor$=e;for(var n in e.prototype)r.call(e.prototype,n)&&"$"!==n.charAt(n.length-1)&&(this[n+"$"]=e.prototype[n])}var r={}.hasOwnProperty;return n.prototype=e.prototype,t.prototype=new n,t.prototype},O=function(){var t=[Array.prototype,Object.prototype,Function.prototype],e=function(e){for(var n=0;n<t.length;++n)if(t[n]===e)return!0;return!1};if(F.isES5){var n=Object.getOwnPropertyNames;return function(t){for(var r=[],i=Object.create(null);null!=t&&!e(t);){var o;try{o=n(t)}catch(s){return r}for(var a=0;a<o.length;++a){var c=o[a];if(!i[c]){i[c]=!0;var u=Object.getOwnPropertyDescriptor(t,c);null!=u&&null==u.get&&null==u.set&&r.push(c)}}t=F.getPrototypeOf(t)}return r}}var r={}.hasOwnProperty;return function(n){if(e(n))return[];var i=[];t:for(var o in n)if(r.call(n,o))i.push(o);else{for(var s=0;s<t.length;++s)if(r.call(t[s],o))continue t;i.push(o)}return i}}(),A=/this\s*\.\s*\S+\s*=/,V=/^[a-z$_][a-z$_0-9]*$/i,H=function(){return"stack"in new Error?function(t){return b(t)?t:new Error(v(t))}:function(t){if(b(t))return t;try{throw new Error(v(t))}catch(e){return e}}}(),D=function(t){return F.isArray(t)?t:null};if("undefined"!=typeof Symbol&&Symbol.iterator){var I="function"==typeof Array.from?function(t){return Array.from(t)}:function(t){for(var e,n=[],r=t[Symbol.iterator]();!(e=r.next()).done;)n.push(e.value);return n};D=function(t){return F.isArray(t)?t:null!=t&&"function"==typeof t[Symbol.iterator]?I(t):null}}var L="undefined"!=typeof process&&"[object process]"===w(process).toLowerCase(),N="undefined"!=typeof process&&"undefined"!=typeof process.env,U,B={setReflectHandler:function(t){U=t},isClass:f,isIdentifier:_,inheritedDataKeys:O,getDataPropertyOrDefault:u,thrower:p,isArray:F.isArray,asArray:D,notEnumerableProp:l,isPrimitive:o,isObject:s,isError:y,canEvaluate:x,errorObj:T,tryCatch:i,inherits:S,withAppended:c,maybeWrapAsError:a,toFastProperties:h,filledRange:d,toString:v,canAttachTrace:b,ensureErrorObject:H,originatesFromRejection:m,markAsOriginatingFromRejection:g,classString:w,copyDescriptors:C,isNode:L,hasEnvVariables:N,env:j,global:R,getNativePromise:k,contextBind:E};B.isRecentNode=B.isNode&&function(){var t;return process.versions&&process.versions.node?t=process.versions.node.split(".").map(Number):process.version&&(t=process.version.split(".").map(Number)),0===t[0]&&t[1]>10||t[0]>0}(),B.nodeSupportsAsyncResource=B.isNode&&function(){var e=!1;try{var n=t("async_hooks").AsyncResource;e="function"==typeof n.prototype.runInAsyncScope}catch(r){e=!1}return e}(),B.isNode&&B.toFastProperties(process);try{throw new Error}catch(M){B.lastLineError=M}e.exports=B},{"./es5":13,async_hooks:void 0}]},{},[4])(4)}),"undefined"!=typeof window&&null!==window?window.P=window.Promise:"undefined"!=typeof self&&null!==self&&(self.P=self.Promise);
}
!function(e){"use strict";function t(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=Array(t);r<t;r++)n[r]=e[r];return n}function r(e,t,r,n,i,o,a){try{var s=e[o](a),u=s.value}catch(e){return void r(e)}s.done?t(u):Promise.resolve(u).then(n,i)}function n(e){return function(){var t=this,n=arguments;return new Promise((function(i,o){var a=e.apply(t,n);function s(e){r(a,i,o,s,u,"next",e)}function u(e){r(a,i,o,s,u,"throw",e)}s(void 0)}))}}function i(e,t,r){return t=d(t),function(e,t){if(t&&("object"==typeof t||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e)}(e,h()?Reflect.construct(t,r||[],d(e).constructor):t.apply(e,r))}function o(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function a(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,v(n.key),n)}}function s(e,t,r){return t&&a(e.prototype,t),r&&a(e,r),Object.defineProperty(e,"prototype",{writable:!1}),e}function u(e,t){var r="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(!r){if(Array.isArray(e)||(r=y(e))||t&&e&&"number"==typeof e.length){r&&(e=r);var n=0,i=function(){};return{s:i,n:function(){return n>=e.length?{done:!0}:{done:!1,value:e[n++]}},e:function(e){throw e},f:i}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var o,a=!0,s=!1;return{s:function(){r=r.call(e)},n:function(){var e=r.next();return a=e.done,e},e:function(e){s=!0,o=e},f:function(){try{a||null==r["return"]||r["return"]()}finally{if(s)throw o}}}}function c(e,t,r){return(t=v(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function l(){return l="undefined"!=typeof Reflect&&Reflect.get?Reflect.get.bind():function(e,t,r){var n=function(e,t){for(;!{}.hasOwnProperty.call(e,t)&&null!==(e=d(e)););return e}(e,t);if(n){var i=Object.getOwnPropertyDescriptor(n,t);return i.get?i.get.call(arguments.length<3?e:r):i.value}},l.apply(null,arguments)}function d(e){return d=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},d(e)}function f(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&m(e,t)}function h(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(e){}return(h=function(){return!!e})()}function g(){g=function(){return t};var e,t={},r=Object.prototype,n=r.hasOwnProperty,i=Object.defineProperty||function(e,t,r){e[t]=r.value},o="function"==typeof Symbol?Symbol:{},a=o.iterator||"@@iterator",s=o.asyncIterator||"@@asyncIterator",u=o.toStringTag||"@@toStringTag";function c(e,t,r){return Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}),e[t]}try{c({},"")}catch(e){c=function(e,t,r){return e[t]=r}}function l(e,t,r,n){var o=t&&t.prototype instanceof _?t:_,a=Object.create(o.prototype),s=new D(n||[]);return i(a,"_invoke",{value:k(e,r,s)}),a}function d(e,t,r){try{return{type:"normal",arg:e.call(t,r)}}catch(e){return{type:"throw",arg:e}}}t.wrap=l;var f="suspendedStart",h="suspendedYield",m="executing",p="completed",v={};function _(){}function y(){}function S(){}var I={};c(I,a,(function(){return this}));var b=Object.getPrototypeOf,T=b&&b(b(F([])));T&&T!==r&&n.call(T,a)&&(I=T);var C=S.prototype=_.prototype=Object.create(I);function w(e){["next","throw","return"].forEach((function(t){c(e,t,(function(e){return this._invoke(t,e)}))}))}function E(e,t){function r(i,o,a,s){var u=d(e[i],e,o);if("throw"!==u.type){var c=u.arg,l=c.value;return l&&"object"==typeof l&&n.call(l,"__await")?t.resolve(l.__await).then((function(e){r("next",e,a,s)}),(function(e){r("throw",e,a,s)})):t.resolve(l).then((function(e){c.value=e,a(c)}),(function(e){return r("throw",e,a,s)}))}s(u.arg)}var o;i(this,"_invoke",{value:function(e,n){function i(){return new t((function(t,i){r(e,n,t,i)}))}return o=o?o.then(i,i):i()}})}function k(t,r,n){var i=f;return function(o,a){if(i===m)throw Error("Generator is already running");if(i===p){if("throw"===o)throw a;return{value:e,done:!0}}for(n.method=o,n.arg=a;;){var s=n.delegate;if(s){var u=A(s,n);if(u){if(u===v)continue;return u}}if("next"===n.method)n.sent=n._sent=n.arg;else if("throw"===n.method){if(i===f)throw i=p,n.arg;n.dispatchException(n.arg)}else"return"===n.method&&n.abrupt("return",n.arg);i=m;var c=d(t,r,n);if("normal"===c.type){if(i=n.done?p:h,c.arg===v)continue;return{value:c.arg,done:n.done}}"throw"===c.type&&(i=p,n.method="throw",n.arg=c.arg)}}}function A(t,r){var n=r.method,i=t.iterator[n];if(i===e)return r.delegate=null,"throw"===n&&t.iterator["return"]&&(r.method="return",r.arg=e,A(t,r),"throw"===r.method)||"return"!==n&&(r.method="throw",r.arg=new TypeError("The iterator does not provide a '"+n+"' method")),v;var o=d(i,t.iterator,r.arg);if("throw"===o.type)return r.method="throw",r.arg=o.arg,r.delegate=null,v;var a=o.arg;return a?a.done?(r[t.resultName]=a.value,r.next=t.nextLoc,"return"!==r.method&&(r.method="next",r.arg=e),r.delegate=null,v):a:(r.method="throw",r.arg=new TypeError("iterator result is not an object"),r.delegate=null,v)}function x(e){var t={tryLoc:e[0]};1 in e&&(t.catchLoc=e[1]),2 in e&&(t.finallyLoc=e[2],t.afterLoc=e[3]),this.tryEntries.push(t)}function P(e){var t=e.completion||{};t.type="normal",delete t.arg,e.completion=t}function D(e){this.tryEntries=[{tryLoc:"root"}],e.forEach(x,this),this.reset(!0)}function F(t){if(t||""===t){var r=t[a];if(r)return r.call(t);if("function"==typeof t.next)return t;if(!isNaN(t.length)){var i=-1,o=function r(){for(;++i<t.length;)if(n.call(t,i))return r.value=t[i],r.done=!1,r;return r.value=e,r.done=!0,r};return o.next=o}}throw new TypeError(typeof t+" is not iterable")}return y.prototype=S,i(C,"constructor",{value:S,configurable:!0}),i(S,"constructor",{value:y,configurable:!0}),y.displayName=c(S,u,"GeneratorFunction"),t.isGeneratorFunction=function(e){var t="function"==typeof e&&e.constructor;return!!t&&(t===y||"GeneratorFunction"===(t.displayName||t.name))},t.mark=function(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,S):(e.__proto__=S,c(e,u,"GeneratorFunction")),e.prototype=Object.create(C),e},t.awrap=function(e){return{__await:e}},w(E.prototype),c(E.prototype,s,(function(){return this})),t.AsyncIterator=E,t.async=function(e,r,n,i,o){void 0===o&&(o=Promise);var a=new E(l(e,r,n,i),o);return t.isGeneratorFunction(r)?a:a.next().then((function(e){return e.done?e.value:a.next()}))},w(C),c(C,u,"Generator"),c(C,a,(function(){return this})),c(C,"toString",(function(){return"[object Generator]"})),t.keys=function(e){var t=Object(e),r=[];for(var n in t)r.push(n);return r.reverse(),function i(){for(;r.length;){var e=r.pop();if(e in t)return i.value=e,i.done=!1,i}return i.done=!0,i}},t.values=F,D.prototype={constructor:D,reset:function(t){if(this.prev=0,this.next=0,this.sent=this._sent=e,this.done=!1,this.delegate=null,this.method="next",this.arg=e,this.tryEntries.forEach(P),!t)for(var r in this)"t"===r.charAt(0)&&n.call(this,r)&&!isNaN(+r.slice(1))&&(this[r]=e)},stop:function(){this.done=!0;var e=this.tryEntries[0].completion;if("throw"===e.type)throw e.arg;return this.rval},dispatchException:function(t){if(this.done)throw t;var r=this;function i(n,i){return s.type="throw",s.arg=t,r.next=n,i&&(r.method="next",r.arg=e),!!i}for(var o=this.tryEntries.length-1;o>=0;--o){var a=this.tryEntries[o],s=a.completion;if("root"===a.tryLoc)return i("end");if(a.tryLoc<=this.prev){var u=n.call(a,"catchLoc"),c=n.call(a,"finallyLoc");if(u&&c){if(this.prev<a.catchLoc)return i(a.catchLoc,!0);if(this.prev<a.finallyLoc)return i(a.finallyLoc)}else if(u){if(this.prev<a.catchLoc)return i(a.catchLoc,!0)}else{if(!c)throw Error("try statement without catch or finally");if(this.prev<a.finallyLoc)return i(a.finallyLoc)}}}},abrupt:function(e,t){for(var r=this.tryEntries.length-1;r>=0;--r){var i=this.tryEntries[r];if(i.tryLoc<=this.prev&&n.call(i,"finallyLoc")&&this.prev<i.finallyLoc){var o=i;break}}o&&("break"===e||"continue"===e)&&o.tryLoc<=t&&t<=o.finallyLoc&&(o=null);var a=o?o.completion:{};return a.type=e,a.arg=t,o?(this.method="next",this.next=o.finallyLoc,v):this.complete(a)},complete:function(e,t){if("throw"===e.type)throw e.arg;return"break"===e.type||"continue"===e.type?this.next=e.arg:"return"===e.type?(this.rval=this.arg=e.arg,this.method="return",this.next="end"):"normal"===e.type&&t&&(this.next=t),v},finish:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var r=this.tryEntries[t];if(r.finallyLoc===e)return this.complete(r.completion,r.afterLoc),P(r),v}},"catch":function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var r=this.tryEntries[t];if(r.tryLoc===e){var n=r.completion;if("throw"===n.type){var i=n.arg;P(r)}return i}}throw Error("illegal catch attempt")},delegateYield:function(t,r,n){return this.delegate={iterator:F(t),resultName:r,nextLoc:n},"next"===this.method&&(this.arg=e),v}},t}function m(e,t){return m=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},m(e,t)}function p(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var r=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=r){var n,i,o,a,s=[],u=!0,c=!1;try{if(o=(r=r.call(e)).next,0===t){if(Object(r)!==r)return;u=!1}else for(;!(u=(n=o.call(r)).done)&&(s.push(n.value),s.length!==t);u=!0);}catch(e){c=!0,i=e}finally{try{if(!u&&null!=r["return"]&&(a=r["return"](),Object(a)!==a))return}finally{if(c)throw i}}return s}}(e,t)||y(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function v(e){var t=function(e,t){if("object"!=typeof e||!e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var n=r.call(e,t||"default");if("object"!=typeof n)return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==typeof t?t:t+""}function _(e){return _="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},_(e)}function y(e,r){if(e){if("string"==typeof e)return t(e,r);var n={}.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?t(e,r):void 0}}var S;function I(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function b(e){return b="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},b(e)}function T(e){var t=function(e,t){if("object"!=b(e)||!e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var n=r.call(e,t||"default");if("object"!=b(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==b(t)?t:t+""}function C(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,T(n.key),n)}}function w(e,t,r){return t&&C(e.prototype,t),r&&C(e,r),Object.defineProperty(e,"prototype",{writable:!1}),e}var E="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{};function k(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e["default"]:e}var A={exports:{}},x={exports:{}};!function(e){function t(r){return e.exports=t="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},e.exports.__esModule=!0,e.exports["default"]=e.exports,t(r)}e.exports=t,e.exports.__esModule=!0,e.exports["default"]=e.exports}(x);var P=x.exports;!function(e){var t=P["default"];function r(){e.exports=r=function(){return i},e.exports.__esModule=!0,e.exports["default"]=e.exports;var n,i={},o=Object.prototype,a=o.hasOwnProperty,s=Object.defineProperty||function(e,t,r){e[t]=r.value},u="function"==typeof Symbol?Symbol:{},c=u.iterator||"@@iterator",l=u.asyncIterator||"@@asyncIterator",d=u.toStringTag||"@@toStringTag";function f(e,t,r){return Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}),e[t]}try{f({},"")}catch(n){f=function(e,t,r){return e[t]=r}}function h(e,t,r,n){var i=t&&t.prototype instanceof S?t:S,o=Object.create(i.prototype),a=new W(n||[]);return s(o,"_invoke",{value:x(e,r,a)}),o}function g(e,t,r){try{return{type:"normal",arg:e.call(t,r)}}catch(e){return{type:"throw",arg:e}}}i.wrap=h;var m="suspendedStart",p="suspendedYield",v="executing",_="completed",y={};function S(){}function I(){}function b(){}var T={};f(T,c,(function(){return this}));var C=Object.getPrototypeOf,w=C&&C(C(R([])));w&&w!==o&&a.call(w,c)&&(T=w);var E=b.prototype=S.prototype=Object.create(T);function k(e){["next","throw","return"].forEach((function(t){f(e,t,(function(e){return this._invoke(t,e)}))}))}function A(e,r){function n(i,o,s,u){var c=g(e[i],e,o);if("throw"!==c.type){var l=c.arg,d=l.value;return d&&"object"==t(d)&&a.call(d,"__await")?r.resolve(d.__await).then((function(e){n("next",e,s,u)}),(function(e){n("throw",e,s,u)})):r.resolve(d).then((function(e){l.value=e,s(l)}),(function(e){return n("throw",e,s,u)}))}u(c.arg)}var i;s(this,"_invoke",{value:function(e,t){function o(){return new r((function(r,i){n(e,t,r,i)}))}return i=i?i.then(o,o):o()}})}function x(e,t,r){var i=m;return function(o,a){if(i===v)throw Error("Generator is already running");if(i===_){if("throw"===o)throw a;return{value:n,done:!0}}for(r.method=o,r.arg=a;;){var s=r.delegate;if(s){var u=P(s,r);if(u){if(u===y)continue;return u}}if("next"===r.method)r.sent=r._sent=r.arg;else if("throw"===r.method){if(i===m)throw i=_,r.arg;r.dispatchException(r.arg)}else"return"===r.method&&r.abrupt("return",r.arg);i=v;var c=g(e,t,r);if("normal"===c.type){if(i=r.done?_:p,c.arg===y)continue;return{value:c.arg,done:r.done}}"throw"===c.type&&(i=_,r.method="throw",r.arg=c.arg)}}}function P(e,t){var r=t.method,i=e.iterator[r];if(i===n)return t.delegate=null,"throw"===r&&e.iterator["return"]&&(t.method="return",t.arg=n,P(e,t),"throw"===t.method)||"return"!==r&&(t.method="throw",t.arg=new TypeError("The iterator does not provide a '"+r+"' method")),y;var o=g(i,e.iterator,t.arg);if("throw"===o.type)return t.method="throw",t.arg=o.arg,t.delegate=null,y;var a=o.arg;return a?a.done?(t[e.resultName]=a.value,t.next=e.nextLoc,"return"!==t.method&&(t.method="next",t.arg=n),t.delegate=null,y):a:(t.method="throw",t.arg=new TypeError("iterator result is not an object"),t.delegate=null,y)}function D(e){var t={tryLoc:e[0]};1 in e&&(t.catchLoc=e[1]),2 in e&&(t.finallyLoc=e[2],t.afterLoc=e[3]),this.tryEntries.push(t)}function F(e){var t=e.completion||{};t.type="normal",delete t.arg,e.completion=t}function W(e){this.tryEntries=[{tryLoc:"root"}],e.forEach(D,this),this.reset(!0)}function R(e){if(e||""===e){var r=e[c];if(r)return r.call(e);if("function"==typeof e.next)return e;if(!isNaN(e.length)){var i=-1,o=function t(){for(;++i<e.length;)if(a.call(e,i))return t.value=e[i],t.done=!1,t;return t.value=n,t.done=!0,t};return o.next=o}}throw new TypeError(t(e)+" is not iterable")}return I.prototype=b,s(E,"constructor",{value:b,configurable:!0}),s(b,"constructor",{value:I,configurable:!0}),I.displayName=f(b,d,"GeneratorFunction"),i.isGeneratorFunction=function(e){var t="function"==typeof e&&e.constructor;return!!t&&(t===I||"GeneratorFunction"===(t.displayName||t.name))},i.mark=function(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,b):(e.__proto__=b,f(e,d,"GeneratorFunction")),e.prototype=Object.create(E),e},i.awrap=function(e){return{__await:e}},k(A.prototype),f(A.prototype,l,(function(){return this})),i.AsyncIterator=A,i.async=function(e,t,r,n,o){void 0===o&&(o=Promise);var a=new A(h(e,t,r,n),o);return i.isGeneratorFunction(t)?a:a.next().then((function(e){return e.done?e.value:a.next()}))},k(E),f(E,d,"Generator"),f(E,c,(function(){return this})),f(E,"toString",(function(){return"[object Generator]"})),i.keys=function(e){var t=Object(e),r=[];for(var n in t)r.push(n);return r.reverse(),function i(){for(;r.length;){var e=r.pop();if(e in t)return i.value=e,i.done=!1,i}return i.done=!0,i}},i.values=R,W.prototype={constructor:W,reset:function(e){if(this.prev=0,this.next=0,this.sent=this._sent=n,this.done=!1,this.delegate=null,this.method="next",this.arg=n,this.tryEntries.forEach(F),!e)for(var t in this)"t"===t.charAt(0)&&a.call(this,t)&&!isNaN(+t.slice(1))&&(this[t]=n)},stop:function(){this.done=!0;var e=this.tryEntries[0].completion;if("throw"===e.type)throw e.arg;return this.rval},dispatchException:function(e){if(this.done)throw e;var t=this;function r(r,i){return s.type="throw",s.arg=e,t.next=r,i&&(t.method="next",t.arg=n),!!i}for(var i=this.tryEntries.length-1;i>=0;--i){var o=this.tryEntries[i],s=o.completion;if("root"===o.tryLoc)return r("end");if(o.tryLoc<=this.prev){var u=a.call(o,"catchLoc"),c=a.call(o,"finallyLoc");if(u&&c){if(this.prev<o.catchLoc)return r(o.catchLoc,!0);if(this.prev<o.finallyLoc)return r(o.finallyLoc)}else if(u){if(this.prev<o.catchLoc)return r(o.catchLoc,!0)}else{if(!c)throw Error("try statement without catch or finally");if(this.prev<o.finallyLoc)return r(o.finallyLoc)}}}},abrupt:function(e,t){for(var r=this.tryEntries.length-1;r>=0;--r){var n=this.tryEntries[r];if(n.tryLoc<=this.prev&&a.call(n,"finallyLoc")&&this.prev<n.finallyLoc){var i=n;break}}i&&("break"===e||"continue"===e)&&i.tryLoc<=t&&t<=i.finallyLoc&&(i=null);var o=i?i.completion:{};return o.type=e,o.arg=t,i?(this.method="next",this.next=i.finallyLoc,y):this.complete(o)},complete:function(e,t){if("throw"===e.type)throw e.arg;return"break"===e.type||"continue"===e.type?this.next=e.arg:"return"===e.type?(this.rval=this.arg=e.arg,this.method="return",this.next="end"):"normal"===e.type&&t&&(this.next=t),y},finish:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var r=this.tryEntries[t];if(r.finallyLoc===e)return this.complete(r.completion,r.afterLoc),F(r),y}},"catch":function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var r=this.tryEntries[t];if(r.tryLoc===e){var n=r.completion;if("throw"===n.type){var i=n.arg;F(r)}return i}}throw Error("illegal catch attempt")},delegateYield:function(e,t,r){return this.delegate={iterator:R(e),resultName:t,nextLoc:r},"next"===this.method&&(this.arg=n),y}},i}e.exports=r,e.exports.__esModule=!0,e.exports["default"]=e.exports}(A);var D=(0,A.exports)(),F=D;try{regeneratorRuntime=D}catch(xJ){"object"===("undefined"==typeof globalThis?"undefined":_(globalThis))?globalThis.regeneratorRuntime=D:Function("r","regeneratorRuntime = r")(D)}var W,R,N=k(F);function O(e){var t=e?new Date(e):new Date,r="yyyy-MM-dd HH:mm:ss.SSSZ",n={"M+":t.getUTCMonth()+1,"d+":t.getUTCDate(),"H+":t.getUTCHours(),"h+":t.getUTCHours()%12||12,"m+":t.getUTCMinutes(),"s+":t.getUTCSeconds(),"q+":Math.floor((t.getUTCMonth()+3)/3),"S+":t.getUTCMilliseconds()};for(var i in/(y+)/.test(r)&&(r=r.replace(RegExp.$1,(t.getUTCFullYear()+"").substr(4-RegExp.$1.length))),n)new RegExp("("+i+")").test(r)&&(r=r.replace(RegExp.$1,1==RegExp.$1.length?n[i]:("000"+n[i]).substr(("000"+n[i]).length-RegExp.$1.length)));return r}function M(e){return e===R}function L(e){return e!==R}function B(e){return null===e}W="object"===("undefined"==typeof window?"undefined":b(window))?window:{};var U={"[object Function]":"function","[object AsyncFunction]":"function","[object String]":"string","[object Object]":"object","[object Boolean]":"boolean","[object Number]":"number","[object Array]":"array"};function V(e){return B(e)||M(e)?String(e):U[{}.toString.call(e)]||"object"}function j(e){return"function"===V(e)}function G(e){return"string"===V(e)}function H(e){return"object"===V(e)}function z(e){return"boolean"===V(e)}function K(e){return"number"===V(e)}function J(e){return Array.isArray?Array.isArray(e):"array"===V(e)}function Q(e){if(null==e)return[];if(J(e))return e;var t=b(e.length),r=b(e);if("number"!==t||e.alert||"string"===r||"function"===r&&(!("item"in e)||"number"!==t))return[e];for(var n=[],i=0,o=e.length;i<o;i++)n[i]=e[i];return n}var q,Y,X={debug:!1,showConsoleError:!1};function Z(){return q}function $(e){q=e}function ee(e,t,r,n){if(X.debug&&Y&&j(Y.log)){var i=O((new Date).getTime()),o=Q(arguments);Y.log(["[",i,"] ",o].join(""))}}function te(e,t,r,n){if((X.debug||X.showConsoleError)&&Y&&j(Y.error)){var i=O((new Date).getTime()),o=Q(arguments);Y.error(["[",i,"] ",o].join(""))}}function re(e,t,r,n){if(X.debug&&Y&&j(Y.warn)){var i=O((new Date).getTime()),o=Q(arguments);Y.warn(["[",i,"] ",o].join(""))}}function ne(e,t,r,n){if(X.debug&&Y&&j(Y.info)){var i=O((new Date).getTime()),o=Q(arguments);Y.info(["[",i,"] ",o].join(""))}}W&&L(W.console)&&(j((Y=W.console).log)&&j(Y.error)?q={log:ee,error:te,info:ne,warn:re,debug:function(e,t,r,n){if(X.debug&&Y&&j(Y.debug)){var i=O((new Date).getTime()),o=Q(arguments);Y.debug(["[",i,"] ",o].join(""))}}}:(Y=!1,q=!1));var ie={queue:[],doNextStarted:!1,timer:null,pushToDo:function(e,t,r){ie.queue.push({obj:e,method:t,args:r})},doNext:function(){if(ie.doNextStarted)if(0!=ie.queue.length){var e=ie.queue[0],t=e.obj,r=e.method,n=e.args;if(ie.queue.splice(0,1),t&&j(t[r])){var i=!1;if(n.length>2){var o=n[n.length-2],a=n[n.length-1];j(o)&&j(a)&&(n[n.length-2]=function(){try{o.apply(t,arguments)}catch(Mj){}ie.timer=setTimeout(ie.doNext,0)},n[n.length-1]=function(){try{a.apply(t,arguments)}catch(Mj){}ie.timer=setTimeout(ie.doNext,0)},i=!0)}try{t[r].apply(t,n)}catch(s){}i||(ie.timer=setTimeout(ie.doNext,0))}else if(null===t&&j(r)){try{r.apply(null,n)}catch(u){}ie.timer=setTimeout(ie.doNext,0)}else ee("not invoke a function: "+r),ie.timer=setTimeout(ie.doNext,0)}else ie.stop();else ie.stop()},start:function(){ie.doNextStarted||(ie.doNextStarted=!0,ie.timer=setTimeout(ie.doNext,0))},stop:function(){clearTimeout(ie.timer),ie.timer=null,ie.doNextStarted=!1,ie.queue=[]}},oe=!0,ae=!1;function se(e,t,r){if(e){var n,i,o,a=0,s=e.length;if(r=r||null,M(s)||j(e))for(o=Object.keys(e);a<o.length&&(n=o[a],t.call(r,e[n],n,e)!==ae);a++);else for(i=e[0];a<s&&t.call(r,i,a,e)!==ae;i=e[++a]);}return e}var ue,ce={fire:function(e){var t,r=this;r.exec=r.exec||{},e=e.toLowerCase(),t=Array.prototype.slice.call(arguments,1),se(r.exec[e]||[],(function(e){var n=e.f,i=e.c||r;try{n.apply(i,t)}catch(Mj){ee(Mj)}}))},on:function(e,t,r){var n=this;n.exec=n.exec||{},e=e.toLowerCase(),n.exec[e]=n.exec[e]||[],n.exec[e].push({f:t,c:r})},off:function(e,t,r){var n=this.exec;if(n)if(e)if(e=e.toLowerCase(),t)for(var i=n[e]||[],o=i.length-1;o>=0;o--)i[o]===t&&i.splice(o,1);else n[e]=null;else this.exec=null}},le="";var de,fe,he,ge,me=navigator,pe=!0;if("userAgentData"in me){var ve=me.userAgentData,_e=[];ve.platform&&""!=ve.platform&&("brands"in ve&&Array.isArray(ve.brands)&&ve.brands.length>0?_e=ve.brands:"uaList"in ve&&Array.isArray(ve.uaList)&&ve.uaList.length>0&&(_e=ve.uaList),_e.length>0&&(pe=!1,fe=ve.platform.toLowerCase(),de=function(e,t,r){var n,i,o,a,s,u,c,l,d,f=!1,h=!1,g=!1,m=e.mobile,p=!1,v=le,_=navigator.maxTouchPoints||0;for(i=t.length,n=0;n<i;n++){var y=t[n].brand.toLowerCase();if(y.indexOf("chrome")>=0){g=!0,v=t[n].version;break}if(y.indexOf("edge")>=0){f=!0,v=t[n].version;break}if(y.indexOf("opera")>=0){h=!0,v=t[n].version;break}}return g||f||h||(g=!0,v="100"),o=/windows/g.test(r),a=/mac/g.test(r),s=/linux/g.test(r),u=/android/g.test(r),c=/harmony/g.test(r),l=/(chromeos|chrome\sos)/g.test(r),d=/iphone/g.test(r),o||u||s||d||(p=/macintel/g.test(r)&&_>1),(u||c||d||p)&&(m=!0),{bUseUserAgent:!1,bWin:o,bMac:a,bLinux:s,bAndroid:u,bHarmonyOS:c,bChromeOS:l,bIE:!1,bEdge:f,bUC:!1,bPlaybook:!1,bBlackBerry:!1,bHuaWeiBrowser:!1,bOpera:h,bFirefox:!1,bChrome:g,bJSDom:!1,biPhone:d,biPad:p,bPad:u&&!e.mobile,bSafari:!1,bMobile:m,strBrowserVersion:v,bHTML5Edition:!0,IEVersion:0,IEMode:0}}(ve,_e,fe)))}pe&&(he||(he=me.userAgent.toLowerCase()),ge||(ge=me.platform.toLowerCase()),de=function(e,t){var r,n=e.toLowerCase(),i=t.toLowerCase(),o=/harmonyos/g.test(n);"linux"==i&&n.indexOf("windows nt")>=0&&(i="harmonyos",o=!0);var a=!o&&/cros/.test(n),s=!o&&/android/g.test(n)||/android/g.test(i),u=/iphone/g.test(n)||/iphone/g.test(i),c=/macintosh/.test(n),l=navigator.maxTouchPoints||0,d=/ipad/g.test(n)||(c||"macintel"==i)&&l>1,f=/ucweb|ucbrowser/g.test(n),h=!f&&/nexus/g.test(n)&&/version\/[\d.]+.*safari\//g.test(n),g=/playbook/g.test(n),m=/hp-tablet/g.test(n),p=/blackberry|bb10/g.test(n),v=/symbian/g.test(n),_=/windows phone/g.test(n),y=/mobile/g.test(n),S=/arm64|aarch64/g.test(n),I=/mips64/g.test(n),b=/huaweibrowser/g.test(n),T=/jsdom/g.test(n),C=g||d||m,w=!C&&!a&&(u||h||p||v||_||s||o||y),E=!w&&!C&&!a,k=E&&/win32|win64|windows/.test(i),A=k&&/win64|x64/.test(n),x=E&&/mac68k|macppc|macintosh|macintel/.test(n),P=E&&/linux/.test(i),D="win64"==i||/wow64|x86_64|win64|x64/.test(n)||S||I,F=/wow64/g.test(n),R=ae,N=/opera|opr/g.test(n),O=/360se/g.test(n),M=/maxthon/g.test(n),L=/tencenttraveler|qqbrowser/g.test(n),B=/the world/g.test(n),U=/metasr/g.test(n),V=/avant/g.test(n),j=/firefox|fxios/g.test(n),G=/gecko/g.test(n),H=!(j||b)&&/edge\/|edga\/|edgios\/|edg\//g.test(n),z=!(p||g||f||N||H||b||T)&&/chrome|crios/g.test(n),K=!1,J=le,Q=0,q=0,Y=le;if(k&&!H&&!j&&!z){var X=n.indexOf("msie "),Z=n.indexOf("trident"),$=n.indexOf("rv:");K=-1!=X||-1!=Z||-1!=$}if(!(x||u||d||k||p||g||h)||f||N||H||K||j||(r=n.match(/version\/([\d.]+).*safari\//))&&(p||g||h||(R=oe,z=ae),Y=r[1]),H){var ee=n.indexOf("edge/");ee>-1?ee+=5:(ee=n.indexOf("edg/"))>-1?ee+=4:(ee=n.indexOf("edga/"))>-1?ee+=5:(ee=n.indexOf("edgios/"))>-1&&(ee+=7),ee>-1&&(r=(Y=n.slice(ee)).indexOf(" "))>-1&&(Y=Y.slice(0,r))}else if(j)if((r=n.indexOf("firefox/"))>-1){var te=(r=n.slice(r+8)).indexOf(" ");te>-1&&(r=r.slice(0,te)),Y=r,(te=r.indexOf("."))>-1&&(r=Y.slice(0,te))}else(u||d)&&(r=n.indexOf("fxios/"))>-1&&(Y=r=(r=n.slice(r+6)).slice(0,r.indexOf(" ")));else if(K){var re=n.indexOf("msie "),ne=n.indexOf("trident"),ie=n.indexOf("rv:");-1!=re?J=r=(r=n.slice(re+5)).slice(0,r.indexOf(";")):-1!=ie?J=r=(r=(r=n.slice(ie+3)).slice(0,r.indexOf(";"))).slice(0,r.indexOf(")")):-1!=ne&&(J=r=(r=n.slice(ne+7)).slice(0,r.indexOf(";"))),Y=r}else if(R)(r=Y.indexOf("."))>-1&&(r=Y.slice(0,r));else if(f)(r=n.indexOf("ucweb"))>-1?Y=n.slice(r+5):(r=n.indexOf("ucbrowser/"))>-1&&(r=(Y=n.slice(r+10)).indexOf(" "))>-1&&(Y=Y.slice(0,r));else if(N)(r=n.indexOf("version/"))>-1?Y=n.slice(r+8):(r=n.indexOf("opr/"))>-1&&(Y=n.slice(r+4));else if(v)(r=n.indexOf("browserng/"))>-1&&(Y=n.slice(r+10));else if(_)(r=n.indexOf("iemobile/"))>-1&&(Y=n.slice(r+9));else if(z){var se=n.indexOf("chrome/");se>-1?(r=(Y=n.slice(se+7)).indexOf(" "))>-1&&(Y=Y.slice(0,r)):(se=n.indexOf("crios/"))>-1&&(r=(Y=n.slice(se+6)).indexOf(" "))>-1&&(Y=Y.slice(0,r)),(r=Y.indexOf("."))>-1&&(r=Y.slice(0,r))}else if(b){var ue=n.indexOf("huaweibrowser");ue>-1&&(r=(Y=n.slice(ue+14)).indexOf(" "))>-1&&(Y=Y.slice(0,r))}else if(T){var ce=n.indexOf("jsdom");ce>-1&&(r=(Y=n.slice(ce+6)).indexOf(" "))>-1&&(Y=Y.slice(0,r))}if(H||K){var de=window.document;de&&de.documentMode?Q=de.documentMode:(Q=5,de.compatMode&&"CSS1Compat"==de.compatMode&&(Q=7)),K&&(q=parseInt(Y))}(x||P)&&(D=!0,x&&(r=n.match(/mac os x (\d+)(_|\.)(\d+)/))&&r.length>3&&(10==r[1]&&r[3]<14||r[1]<10)&&(D=!1)),k||x||P||S||I||(w=!0);var fe=!0;if(K)if(""===J||parseInt(J)>=10){var he=W.Dynamsoft;he&&he.DWT&&he.DWT.IfUseActiveXForIE10Plus&&(fe=ae)}else fe=ae;return{bUseUserAgent:!0,bWin:k,bMac:x,bLinux:P,bMobile:w,bPad:C,bChromeOS:a,bHarmonyOS:o,bArm64:S,bMips64:I,bEmbed:S||I,bAndroid:s,biPhone:u,biPad:d,bWin64:A,bWOW64:F,bOSx64:D,bIE:K,bEdge:H,bChrome:z,bFirefox:j,bSafari:R,bOpera:N,bNexus:h,bUC:f,b360SE:O,bMaxthon:M,bTencentTraveler:L,bTheWorld:B,bMetaSr:U,bAvant:V,bHuaWeiBrowser:b,bJSDom:T,bGecko:G,bHTML5Edition:fe,strBrowserVersion:Y,IEVersion:q,IEMode:Q}}(he,ge));var ye=null===(ue=null===document||void 0===document?void 0:document.location)||void 0===ue?void 0:ue.protocol;function Se(e){return de.bGecko&&"mousewheel"===e?"DOMMouseScroll":e}function Ie(e,t,r){var n=Se(t);e&&e.addEventListener(n,r,!1)}function be(e,t,r){var n=Se(t);e&&e.removeEventListener(n,r,!1)}function Te(e){var t=e||W.event;t.preventDefault&&t.preventDefault(),t.stopPropagation&&t.stopPropagation(),t.returnValue=!1,t.cancelBubble=!0}function Ce(e,t){var r=W.document.createEvent("HTMLEvents");r.initEvent(e,oe,oe),t.dispatchEvent&&t.dispatchEvent(r)}ye||(ye="https:"),de.protocol=ye,de.bSSL="https:"===ye,de.bFileSystem="https:"!==ye&&"http:"!==ye;var we,Ee,ke,Ae,xe=W.document,Pe=[],De=Pe.push,Fe=Pe.slice,We=/^(?:#([\w-]+)|(\w+)|\.([\w-]+))$/,Re=function(){Ee()};function Ne(e,t,r,n){var i,o,a,s=t&&t.ownerDocument,u=t?t.nodeType:9;if(r=r||[],"string"!=typeof e||!e||1!==u&&9!==u&&11!==u)return r;if(!n&&((t?t.ownerDocument||t:xe)!==ke&&Ee(t),t=t||ke,11!==u&&(a=We.exec(e))))if(i=a[1]){if(9===u){if(!(o=t.getElementById(i)))return r;if(o.id===i)return r.push(o),r}else if(s&&(o=s.getElementById(i))&&Ae(t,o)&&o.id===i)return r.push(o),r}else{if(a[2])return De.apply(r,t.getElementsByTagName(e)),r;if((i=a[3])&&t.getElementsByClassName)return De.apply(r,t.getElementsByClassName(i)),r}return r}De.apply(Fe.call(xe.childNodes),xe.childNodes),Ee=Ne.setDocument=function(e){var t,r=e?e.ownerDocument||e:xe;return r!==ke&&9===r.nodeType&&r.documentElement?(xe!==(ke=r)&&(t=ke.defaultView)&&t.top!==t&&(t.addEventListener?t.addEventListener("unload",Re,!1):t.attachEvent&&t.attachEvent("onunload",Re)),Ae=function(e,t){if(t)for(;t=t.parentNode;)if(t===e)return!0;return!1},ke):ke},Ne.contains=function(e,t){return(e.ownerDocument||e)!==ke&&Ee(e),Ae(e,t)},Ne.error=function(e){throw new Error("Syntax error: "+e)},we=Ne.getText=function(e){var t,r="",n=0,i=e.nodeType;if(i){if(1===i||9===i||11===i){if("string"==typeof e.textContent)return e.textContent;for(e=e.firstChild;e;e=e.nextSibling)r+=we(e)}else if(3===i||4===i)return e.nodeValue}else for(;t=e[n++];)r+=we(t);return r},Ee();var Oe={encodeChars:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",decodeChars:[-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,62,-1,-1,-1,63,52,53,54,55,56,57,58,59,60,61,-1,-1,-1,-1,-1,-1,-1,0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,-1,-1,-1,-1,-1,-1,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,-1,-1,-1,-1,-1]},Me={UTF16ToUTF8:function(e){for(var t,r,n=[],i=e.length,o=0;o<i;o++){var a=e.charCodeAt(o);if(a>0&&a<=127)n.push(e.charAt(o));else if(a>=128&&a<=2047)t=192|a>>6&31,r=128|63&a,n.push(String.fromCharCode(t),String.fromCharCode(r));else if(a>=2048&&a<=65535){t=224|a>>12&15,r=128|a>>6&63;var s=128|63&a;n.push(String.fromCharCode(t),String.fromCharCode(r),String.fromCharCode(s))}}return n.join("")},UTF8ToUTF16:function(e){var t,r,n,i,o=[],a=e.length;for(t=0;t<a;t++)(r=e.charCodeAt(t))>>7&255?6==(r>>5&255)?(i=(31&r)<<6|63&(n=e.charCodeAt(++t)),o.push(String.fromCharCode(i))):14==(r>>4&255)&&(i=(255&(r<<4|(n=e.charCodeAt(++t))>>2&15))<<8|((3&n)<<6|63&e.charCodeAt(++t)),o.push(String.fromCharCode(i))):o.push(e.charAt(t));return o.join("")},encode:function(e){for(var t,r,n,i=this.UTF16ToUTF8(e),o=[],a=0,s=i.length;a<s;){if(t=255&i.charCodeAt(a++),a==s){o.push(Oe.encodeChars.charAt(t>>2)),o.push(Oe.encodeChars.charAt((3&t)<<4)),o.push("==");break}if(r=i.charCodeAt(a++),a==s){o.push(Oe.encodeChars.charAt(t>>2)),o.push(Oe.encodeChars.charAt((3&t)<<4|(240&r)>>4)),o.push(Oe.encodeChars.charAt((15&r)<<2)),o.push("=");break}n=i.charCodeAt(a++),o.push(Oe.encodeChars.charAt(t>>2)),o.push(Oe.encodeChars.charAt((3&t)<<4|(240&r)>>4)),o.push(Oe.encodeChars.charAt((15&r)<<2|(192&n)>>6)),o.push(Oe.encodeChars.charAt(63&n))}return o.join("")},encodeArray:function(e){for(var t,r,n,i=[],o=0,a=e.length;o<a;){if(t=255&e[o++],o==a){i.push(Oe.encodeChars.charAt(t>>2)),i.push(Oe.encodeChars.charAt((3&t)<<4)),i.push("==");break}if(r=255&e[o++],o==a){i.push(Oe.encodeChars.charAt(t>>2)),i.push(Oe.encodeChars.charAt((3&t)<<4|(240&r)>>4)),i.push(Oe.encodeChars.charAt((15&r)<<2)),i.push("=");break}n=255&e[o++],i.push(Oe.encodeChars.charAt(t>>2)),i.push(Oe.encodeChars.charAt((3&t)<<4|(240&r)>>4)),i.push(Oe.encodeChars.charAt((15&r)<<2|(192&n)>>6)),i.push(Oe.encodeChars.charAt(63&n))}return i.join("")},decode:function(e,t){for(var r,n,i,o,a=this,s=[],u=0,c=e.length;u<c;){do{r=Oe.decodeChars[255&e.charCodeAt(u++)]}while(u<c&&-1==r);if(-1==r)break;do{n=Oe.decodeChars[255&e.charCodeAt(u++)]}while(u<c&&-1==n);if(-1==n)break;t?s.push(r<<2|(48&n)>>4):s.push(String.fromCharCode(r<<2|(48&n)>>4));do{if(61==(i=255&e.charCodeAt(u++)))return t?s:a.UTF8ToUTF16(s.join(""));i=Oe.decodeChars[i]}while(u<c&&-1==i);if(-1==i)break;t?s.push((15&n)<<4|(60&i)>>2):s.push(String.fromCharCode((15&n)<<4|(60&i)>>2));do{if(61==(o=255&e.charCodeAt(u++)))return t?s:a.UTF8ToUTF16(s.join(""));o=Oe.decodeChars[o]}while(u<c&&-1==o);if(-1==o)break;t?s.push((3&i)<<6|o):s.push(String.fromCharCode((3&i)<<6|o))}return t?s:a.UTF8ToUTF16(s.join(""))}},Le={fromUTF16:function(e){for(var t,r=[],n=0,i=e.length;n<i;)(t=e.charCodeAt(n))>=1&&t<=127?r.push(e.charAt(n)):t>2047?(r.push(String.fromCharCode(224|t>>12&15)),r.push(String.fromCharCode(128|t>>6&63)),r.push(String.fromCharCode(128|63&t))):(r.push(String.fromCharCode(192|t>>6&31)),r.push(String.fromCharCode(128|63&t))),n++;return r.join("")},toUTF16:function(e){for(var t,r,n,i=[],o=0,a=e.length;o<a;)switch((t=e.charCodeAt(o++))>>4){case 0:case 1:case 2:case 3:case 4:case 5:case 6:case 7:i.push(e.charAt(o-1));break;case 12:case 13:r=e.charCodeAt(o++),i.push(String.fromCharCode((31&t)<<6|63&r));break;case 14:r=e.charCodeAt(o++),n=e.charCodeAt(o++),i.push(String.fromCharCode((15&t)<<12|(63&r)<<6|63&n))}return i.join("")}},Be="undefined"!=typeof self?self:global,Ue=Be.btoa?function(e){return Be.btoa(e)}:function(e){for(var t,r,n=String(e),i=0,o=Oe.encodeChars,a="";n.charAt(0|i)||(o="=",i%1);a+=o.charAt(63&t>>8-i%1*8)){if((r=n.charCodeAt(i+=3/4))>255)throw new Error("'btoa' failed: The string to be encoded contains characters outside of the Latin1 range.");t=t<<8|r}return a},Ve=Be.atob?function(e){return Be.atob(e)}:function(e){var t=String(e).replace(/[=]+$/,"");if(t.length%4==1)throw new Error("'atob' failed: The string to be decoded is not correctly encoded.");for(var r,n,i=0,o=0,a="";n=t.charAt(o++);~n&&(r=i%4?64*r+n:n,i++%4)?a+=String.fromCharCode(255&r>>(-2*i&6)):0)n=Oe.encodeChars.indexOf(n);return a};function je(e){if(null==e||"object"!=b(e))return e;var t,r,n;if(e instanceof Date)return(t=new Date).setTime(e.getTime()),t;if(e instanceof Array){for(t=[],n=e.length,r=0;r<n;r++)t[r]=je(e[r]);return t}if(e instanceof Object){for(r in t={},e)e.hasOwnProperty(r)&&(t[r]=je(e[r]));return t}return 0}function Ge(e){return Math.random().toString(16).substring(2,2+e)}function He(e){var t=[Ge(8),"-",Ge(4),"-",Ge(4),"-",Ge(4),"-",Ge(8)];return e&&t.unshift(e),t.join("")}var ze=Date.now||function(){return+new Date},Ke=function(){return""+ze()};function Je(){for(var e,t=ze()%1e4,r=[],n=0;n<5;n++)e=Math.floor(10*Math.random()),0!=n||0!=e?r.push(e):n=-1;return t<10?r.push("000"):t<100?r.push("00"):t<1e3&&r.push("0"),r.push(t),r.join("")}function Qe(e,t){var r;for(r in t)t.hasOwnProperty(r)&&(e[r]=t[r]);return e}function qe(e,t,r,n){return new(r||(r=Promise))((function(i,o){function a(e){try{u(n.next(e))}catch(Mj){o(Mj)}}function s(e){try{u(n["throw"](e))}catch(Mj){o(Mj)}}function u(e){var t;e.done?i(e.value):(t=e.value,t instanceof r?t:new r((function(e){e(t)}))).then(a,s)}u((n=n.apply(e,t||[])).next())}))}"function"==typeof SuppressedError&&SuppressedError;var Ye=!1;"wakeLock"in navigator&&(Ye=!0);var Xe=null;function Ze(){Ye&&(null==Xe?function(){qe(this,void 0,void 0,N.mark((function e(){return N.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.prev=0,e.next=3,navigator.wakeLock.request("screen");case 3:Xe=e.sent,e.next=9;break;case 6:e.prev=6,e.t0=e["catch"](0),Xe=null;case 9:case"end":return e.stop()}}),e,null,[[0,6]])})))}():Xe.release().then((function(){Xe=null})))}function $e(){return Xe}var et=Array.prototype;function tt(e,t,r){return et.filter.call(e,t,r||this)}function rt(e,t){return et.indexOf.call(t,e)}function nt(e){var t,r,n=[],i=e.length;for(t=0;t<i;t++){for(r=t+1;r<i;r++)e[t]===e[r]&&(r=++t);n.push(e[t])}return n}var it=/^(\/?)([\s\S]+\/(?!$)|\/)?((?:\.{1,2}$|[\s\S]+?)?(\.[^.\/]*)?)$/;function ot(e,t){var r,n=[];for(r=0;r<e.length;r++){var i=e[r];i&&"."!==i&&(".."===i?n.length&&".."!==n[n.length-1]?n.pop():t&&n.push(".."):n.push(i))}return n}function at(e){var t="/"===e.charAt(0),r="/"===e.slice(-1);return(e=ot(tt(e.split("/"),(function(e){return!!e})),!t).join("/"))||t||(e="."),e&&r&&(e+="/"),(t?"/":"")+e}var st=function(){return w((function e(){I(this,e)}),[{key:"resolve",value:function(){var e,t,r="",n=arguments,i=!1;for(e=n.length-1;e>=0&&!i;e--)G(t=n[e])&&t&&(r=t+"/"+r,i="/"===t.charAt(0));return(i?"/":"")+ot(tt(r.split("/"),(function(e){return!!e})),!i).join("/")||"."}},{key:"join",value:function(){return at(tt(Q(arguments),(function(e){return e&&G(e)})).join("/"))}},{key:"relative",value:function(e,t){e=at(e),t=at(t);var r,n,i=tt(e.split("/"),(function(e){return!!e})),o=[],a=tt(t.split("/"),(function(e){return!!e})),s=Math.min(i.length,a.length);for(r=0;r<s&&i[r]===a[r];r++);for(n=r;r<i.length;)o.push(".."),r++;return(o=o.concat(a.slice(n))).join("/")}},{key:"basename",value:function(e,t){var r;return r=(e.match(it)||[])[3]||"",t&&r&&r.slice(-1*t.length)===t&&(r=r.slice(0,-1*t.length)),r}},{key:"dirname",value:function(e){var t=e.match(it)||[],r=t[1]||"",n=t[2]||"";return r||n?(n&&(n=n.substring(0,n.length-1)),r+n):"."}},{key:"extname",value:function(e){return(e.match(it)||[])[4]||""}}])}(),ut={}.hasOwnProperty;function ct(e){if(!e||"object"!==V(e)||e.nodeType||e.window==e)return ae;var t,r;try{if((r=e.constructor)&&!ut(e,"constructor")&&!ut(r.prototype,"isPrototypeOf"))return ae}catch(Mj){return ae}for(t in e);return M(t)||ut(e,t)}var lt="object"===("undefined"==typeof HTMLElement?"undefined":b(HTMLElement));function dt(e){return lt?e instanceof HTMLElement:e&&"object"===b(e)&&(1===e.nodeType||9===e.nodeType)&&"string"==typeof e.nodeName}function ft(e){var t=e;if(dt(e))for(;!t&&t!=document.body;)t=t.parentNode;else t=0;return!!t}function ht(e,t){return 0===e.lastIndexOf(t,0)}function gt(e,t){var r=e.length-t.length;return r>=0&&e.indexOf(t,r)===r}function mt(e){return null==e?le:String.prototype.trim.call(e)}function pt(e){var t;if(e)for(t in e)if(!M(t))return!1;return!0}function vt(e){return G(e)?e.replace(/[^\x20-\x7E]/g,""):e}function _t(e,t,r){return e.replace(new RegExp(t,"gi"),r)}function yt(e){return e.charAt(0).toUpperCase()+e.substr(1)}var St,It="none",bt={getOffset:function(e,t,r){var n,i;e=e||W.event;for(var o,a,s=r||e.target,u=0,c=0,l=0,d=0,f=!1,h=W.document;s&&!isNaN(s.offsetLeft)&&!isNaN(s.offsetTop);)a=s.scrollLeft,o=s.scrollTop,"BODY"===s.tagName?f?(a=0,o=0):(a|=null===(n=h.documentElement)||void 0===n?void 0:n.scrollLeft,o|=null===(i=h.documentElement)||void 0===i?void 0:i.scrollTop):"fixed"===s.style.position&&(f=!0),u+=s.offsetLeft-a,c+=s.offsetTop-o,s=s.offsetParent;return t&&(l=t.Left,d=t.Top),{x:u=e.clientX-u-l,y:c=e.clientY-c-d}},getElDimensions:function(e,t){var r,n;return e?(r=e.style.display,e.style.display="",n=t?{offsetTop:e.offsetTop,offsetLeft:e.offsetLeft,offsetWidth:e.offsetWidth,offsetHeight:e.offsetHeight}:{clientTop:e.clientTop,clientLeft:e.clientLeft,clientWidth:e.clientWidth?e.clientWidth:parseInt(e.style.width)?parseInt(e.style.width):0,clientHeight:e.clientHeight?e.clientHeight:parseInt(e.style.height)?parseInt(e.style.height):0},e.style.display=r,n):{offsetTop:0,offsetLeft:0,offsetWidth:0,offsetHeight:0}}};function Tt(e){return document.getElementById(e)}function Ct(e){var t=G(e)?Tt(e):e;t&&(t.length>0&&(t=t[0]),t.style.display=It)}function wt(e){var t=G(e)?Tt(e):e;t&&(t.length>0&&(t=t[0]),t.style.display=le)}function Et(e){var t=G(e)?Tt(e):e;t&&(t.length>0&&(t=t[0]),t.style.display===It?t.style.display=le:t.style.display=It)}function kt(e){if(e)for(;e.firstChild;)e.removeChild(e.firstChild)}function At(e){return encodeURIComponent(String(e))}function xt(e){return decodeURIComponent(e.replace(/\+/g," "))}if(window.trustedTypes){try{St=window.trustedTypes.createPolicy("d-create-script",{createScriptURL:function(e){return e}})}catch(PJ){}}function Pt(e){return St?St.createScriptURL(e):e}var Dt=!0,Ft=document,Wt=Ft&&Ft.documentElement,Rt=Ft.getElementsByTagName("head")[0]||Wt,Nt=Ft.createElement("script").readyState?function(e,t){var r=e.onreadystatechange;e.onreadystatechange=function(){var n=e.readyState;if("loaded"===n||"complete"===n){e.onreadystatechange=null,r&&r();t.call(this,{type:"load",path:[e]})}else"loading"===n||t.call(this,{type:"error",path:[e]})}}:function(e,t){e.addEventListener("load",t,ae),e.addEventListener("error",t,ae)};function Ot(e,t,r){return Mt(e,t,!1,r)}function Mt(e,t,r,n){var i,o,a=n;if(j(a)||(a=function(){}),G(e)&&e!=le)return i=Ft.createElement("script"),o=["",e].join(le),i.src=Pt(o),t&&(i.async=Dt),i.charset="utf-8",Nt(i,a),r?Rt.appendChild(i):Rt.insertBefore(i,Rt.firstChild),i;a()}function Lt(e,t,r){return Bt(e,t,!1,r)}function Bt(e,t,r,n){var i=n;if(j(i)||(i=function(){}),de.bJSDom)i("ok");else if(J(e)){var o=e.length,a=function(e){e&&"load"==e.type?o--:(e&&"error"==e.type&&te(["Failed to load resource: ",e.target.src,"."].join("")),i()),o<=0&&i("ok")};o<=0?i("ok"):se(e,(function(e){Mt(e,t,r,a)}))}else i()}function Ut(e,t){return Vt(e,!1,t)}function Vt(e,t,r){var n,i=r;if(j(i)||(i=!1),G(e)&&e!=le){if(!de.bJSDom)return(n=Ft.createElement("link")).href=Pt(e),n.rel="stylesheet",n.async=Dt,i&&Nt(n,i),t?Rt.appendChild(n):Rt.insertBefore(n,Rt.firstChild),n;i&&i()}else i&&i()}function jt(e,t){return Gt(e,!1,t)}function Gt(e,t,r){if(de.bJSDom)r&&r("ok");else if(J(e)){var n=e.length,i=function(e){e&&"load"==e.type&&n--,e&&"load"!=e.type&&(e&&"error"==e.type&&te(["Failed to load resource: ",e.target.href,"."].join("")),r()),n<=0&&r("ok")};se(e,(function(e){Vt(e,t,i)}))}else r&&r()}function Ht(e){var t,r;if(!de.bJSDom){var n=document;if(n&&G(r=e.body)&&r!=le){(t=n.createElement("script")).charset="utf-8",de.bIE?t.text=r:t.appendChild(n.createTextNode(r)),e.language?t.language=e.language:t.language="javascript",e.type?t.type=e.type:t.type="text/javascript";var i=n&&n.documentElement,o=n.getElementsByTagName("head")[0]||i;o.insertBefore(t,o.firstChild)}}}function zt(e){Ht({body:e})}function Kt(e){Ht({body:e,language:"vbscript",type:"text/vbscript"})}function Jt(e){return null!=e&&e==e.window}var Qt,qt,Yt,Xt=function(){return w((function e(){I(this,e),this.nil=undefined,this.bNode=!1,this.noop=function(){},this.mix=Qe,this.clone=je,this.keys=Object.keys,this.now=Ke,this.getFormatedNow=O,this.getRandom=Je,this.guid=He,this.get=Tt,this.show=wt,this.hide=Ct,this.toggle=Et,this.empty=kt,this.stringify=W.JSON.stringify,this.parse=W.JSON.parse,this.isDef=L,this.isUndef=M,this.isUndefined=M,this.isNull=B,this.isNaN=isNaN,this.isFunction=j,this.isString=G,this.isObject=H,this.isBoolean=z,this.isNumber=K,this.isArray=J,this.type=V,this.isPlainObject=ct,this.isDOM=dt,this.isDOMInBody=ft,this.each=se,this.getLogger=Z,this.setLogger=$,this.log=ee,this.error=te,this.warn=re,this.info=ne,this.filter=tt,this.indexOf=rt,this.uniq=nt,this.startsWith=ht,this.endsWith=gt,this.replaceAll=_t,this.upperCaseFirst=yt,this.removeNonPrintableChar=vt,this.trim=mt,this.makeArray=Q,this.isEmptyObject=pt,this.Path=new st,this.DOM=bt,this.isWindow=Jt,this.obj={customEvent:ce},this.addEventListener=Ie,this.removeEventListener=be,this.stopPropagation=Te,this.fireEvent=Ce,this.base64=Me,this.utf8=Le,this.btoa=Ue,this.atob=Ve,this.asyncQueue=ie,this.sizzle=Ne,this.toggleWakeLock=Ze,this.getWakeLock=$e,this.urlEncode=At,this.urlDecode=xt,this.scriptOnload=Nt,this.addAllCss=Gt,this.getAllCss=jt,this.addCss=Vt,this.getCss=Ut,this.addScripts=Bt,this.getScripts=Lt,this.addScript=Mt,this.getScript=Ot,this.addJS=zt,this.addVBS=Kt}),[{key:"debug",get:function(){return X.debug},set:function(e){X.debug=e}},{key:"showConsoleError",get:function(){return X.debug},set:function(e){X.showConsoleError=e}}])}(),Zt=new Xt,$t=20230515,er=!!("object"==("undefined"==typeof global?"undefined":_(global))&&global.process&&global.process.release&&global.process.release.name&&"undefined"==typeof HTMLCanvasElement),tr=er?global:self||{},rr=tr.Dynamsoft;function nr(e){return Math.floor(e)}function ir(e,t,r){return(t=T(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function or(e,t){(function(e,t){if(t.has(e))throw new TypeError("Cannot initialize the same private elements twice on an object")})(e,t),t.add(e)}function ar(e,t,r){if("function"==typeof e?e===t:e.has(t))return arguments.length<3?t:r;throw new TypeError("Private element is not present on this object")}function sr(e){var t,r,n="0x";if(/^(rgb|RGB)/.test(e)){var i=e.replace(/[^\d,.]/g,"").split(",");for(r=0;r<3;++r)1==(t=Number(i[r]).toString(16)).length&&(t="0"+t),n+=t;4==i.length?(1==(t=Math.round(255*Number(i[r])).toString(16)).length&&(t="0"+t),n+=t):n+="ff"}else if("transparent"==e)n+="00000000";else if(/^#[0-9a-fA-F]{6}$/.test(e))n+=e.replace(/#/,"")+"ff";else if(/^#[0-9a-fA-F]{3}$/.test(e)){for(r=0;r<3;++r)n+=e[r]+e[r];n+="ff"}else n="-1";return Number(n)}function ur(e){if(e>4294967295||e<0)return null;var t;if(de.bHTML5Edition)t="rgba("+Math.floor(e/16777216)+","+Math.floor(e/65536)%256+","+Math.floor(e/256)%256+","+e%256/255+")";else if(e%256==0)t="transparent";else{for(t=Math.floor(e/256).toString(16);6!=t.length;)t="0"+t;t="#"+t}return t}function cr(e){var t,r=(e=e||window.event).wheelDelta,n=e.detail;return r&&(t=r/120),n&&(t=-(n%3==0?n/3:n)),t}rr?rr.Lib||(rr.Lib={}):(rr={Lib:{},DWT:{}},tr&&(tr.Dynamsoft=rr)),rr.navInfoSync=de,Qt=Zt.mix(rr.Lib,Zt),(qt=rr).DWT||(qt.DWT={}),qt.DWT.LTS||(qt.DWT.LTS={}),qt.Lib.UI||(qt.Lib.UI={}),qt.Lib.html5||(qt.Lib.html5={}),String.prototype.trim||(String.prototype.trim=function(){return this.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,le)}),Yt={registedClass:[],registedObjs:[]};var lr={LEFT:0,MIDDLE:1,RIGHT:2};function dr(e){var t=e||window.event;return null==t.which?t.button<2?lr.LEFT:4==t.button?lr.MIDDLE:lr.RIGHT:t.which<2?lr.LEFT:2==t.which?lr.MIDDLE:lr.RIGHT}var fr,hr,gr=/[\-#$\^*()+\[\]{}|\\,.?\s]/g,mr={"&":"&",">":">","<":"<"," ":" ","`":"`","/":"/",""":'"',"'":"'"},pr={};function vr(e){return e.replace(/\\u([a-f\d]{4})/gi,(function(e,t){return String.fromCharCode(parseInt(t,16))}))}function _r(e){return(e+"").replace(function(){if(fr)return fr;var e=le;return Zt.each(mr,(function(t){e+=t+"|"})),e=e.slice(0,-1),fr=new RegExp(e,"g")}(),(function(e){return pr[e]}))}function yr(e){return e.replace(gr,"\\$&")}function Sr(e){return e.replace(function(){if(hr)return hr;var e=le;return Zt.each(pr,(function(t){e+=t+"|"})),e+="&#(\\d{1,5});",hr=new RegExp(e,"g")}(),(function(e,t){return mr[e]||String.fromCharCode(+t)}))}Zt.each(mr,(function(e,t){pr[e]=t}));var Ir,br,Tr=window;Tr&&Zt.isFunction(Tr.__zone_symbol__Promise)&&(br=Tr.__zone_symbol__Promise);var Cr=w((function DJ(){I(this,DJ)}));function wr(e){return null==(e=e||window.event).which?e.which=e.button<2?1:4==e.button?2:3:e.which=e.which<2?1:2==e.which?2:3,e}function Er(e,t){return e.currentStyle?e.currentStyle[t]:window.getComputedStyle?document.defaultView.getComputedStyle(e,null)[t]:null}Ir=self&&self.Promise?self.Promise:Tr&&Tr.Promise?Tr.Promise:Cr,br||(br=Ir);function kr(e){var t=b(e);return null==e||"object"!==t&&"function"!==t}function Ar(e,t,r,n){t=t||"&",r=r||"=",Zt.isUndefined(n)&&(n=oe);var i=[];return Zt.each(e,(function(e,o){var a=Zt.urlEncode(o);kr(e)?(i.push(a),Zt.isDef(e)&&i.push(r,Zt.urlEncode(e+le)),i.push(t)):Zt.isArray(e)&&e.length&&Zt.each(e,(function(e){kr(e)&&(i.push(a,n?Zt.urlEncode("[]"):le),Zt.isDef(e)&&i.push(r,Zt.urlEncode(e+le)),i.push(t))}))})),i.pop(),i.join(le)}function xr(e,t,r){if(!Zt.isString(e)||!(e=Zt.trim(e)))return{};t=t||"&",r=r||"=";for(var n,i,o,a={},s=Zt.urlDecode,u=e.split(t),c=0,l=u.length;c<l;++c){if(-1===(n=Zt.indexOf(r,u[c])))i=s(u[c]),o=undefined;else{i=s(u[c].substring(0,n)),o=u[c].substring(n+1);try{o=s(o)}catch(Mj){Zt.error("decodeURIComponent error : "+o),Zt.error(Mj)}Zt.endsWith(i,"[]")&&(i=i.substring(0,i.length-2))}i in a?Zt.isArray(a[i])?a[i].push(o):a[i]=[a[i],o]:a[i]=o}return a}Zt.each({"&":"&",">":">","<":"<","`":"`","/":"/",""":'"',"'":"'"},(function(e,t){}));var Pr,Dr=w((function FJ(e){I(this,FJ),ir(this,"tagName",void 0),ir(this,"attr",void 0),ir(this,"childNodes",void 0),this.tagName=e,this.attr={},this.childNodes=[]})),Fr=w((function WJ(e){I(this,WJ),ir(this,"value",void 0),this.value=e||""})),Wr=new WeakSet,Rr=function(){return w((function e(){I(this,e),or(this,Wr),ir(this,"stack",void 0),ir(this,"stacks",void 0),this.stack=[],this.stacks=[]}),[{key:"getStacks",value:function(){return this.stacks}},{key:"receiveInput",value:function(e){var t=this.stack;if("startTag"===e.type)t.push(new Dr(e.value));else if("attr"===e.type){var r,n,i=e.value,o=i.indexOf("=");o>-1&&(r=i.substring(0,o),n='"'===i.charAt(o+1)||"'"===i.charAt(o+1)?i.substring(o+2,i.length-1):i.substring(o+1),t[t.length-1].attr[r]=n)}else if("text"===e.type)t.length?t[t.length-1].childNodes.push(new Fr(e.value)):this.stacks.push(new Fr(e.value));else if("endTag"===e.type){var a=t.pop();t.length?t[t.length-1].childNodes.push(a):this.stacks.push(a)}}},{key:"getOutPutHtml",value:function(){var e,t=document.createDocumentFragment(),r=this.stacks;for(e=0;e<r.length;e++){var n=r[e],i=ar(Wr,this,Lr).call(this,n);i&&t.appendChild(i)}return t}}])}();function Nr(e){return e.replace(/-([a-z])/g,(function(e,t){return t.toUpperCase()}))}function Or(e){var t={};if(!e)return t;var r,n=e.split(";");for(r=0;r<n.length;r++){var i=n[r].split(":");if(2===i.length){var o=i[0].trim(),a=i[1].trim();""!==a&&(t[o=ar(Wr,this,Nr).call(this,o)]=a)}}return t}function Mr(e,t){var r=ar(Wr,this,Or).call(this,t);for(var n in r)e.style[n]=r[n]}function Lr(e){if(e instanceof Dr){var t=document.createElement(e.tagName);for(var r in e.attr)""!==r&&""!==e.attr[r]&&("style"===r?ar(Wr,this,Mr).call(this,t,e.attr[r]):t.setAttribute(r,e.attr[r]));if(e.childNodes.length)for(var n=0;n<e.childNodes.length;n++){var i=e.childNodes[n];t.appendChild(ar(Wr,this,Lr).call(this,i))}return t}if(e instanceof Fr)return document.createTextNode(Sr(e.value))}!function(e){e[e.None=0]="None",e[e.AttrKey=1]="AttrKey",e[e.AttrKeyQuoteStart=2]="AttrKeyQuoteStart",e[e.AttrKeyQuoteEnd=3]="AttrKeyQuoteEnd",e[e.AttrValueQuoteStart=4]="AttrValueQuoteStart",e[e.AttrSpace=5]="AttrSpace",e[e.AttrSplite=6]="AttrSplite"}(Pr||(Pr={}));var Br,Ur=w((function RJ(e,t){I(this,RJ),ir(this,"allChars",void 0),ir(this,"curIndex",void 0),ir(this,"state",void 0),ir(this,"attrStatus",void 0),ir(this,"attrQuoteChar",void 0),this.allChars=e,this.curIndex=0,this.state=t,this.attrStatus=Pr.None,this.attrQuoteChar=""})),Vr=new WeakSet,jr=function(){return w((function e(t,r){I(this,e),or(this,Vr),ir(this,"token",void 0),ir(this,"tokens",void 0),ir(this,"htmlString",void 0),ir(this,"tokenHandler",void 0),ir(this,"thisStartTagName",void 0),ir(this,"attrStatus",void 0),this.token=[],this.tokens=[],this.attrStatus=Pr.None,this.thisStartTagName=null,Zt.isString(t)?this.htmlString=t:t&&(this.htmlString=t.toString()),this.tokenHandler=r}),[{key:"start",value:function(e){var t=e.allChars[e.curIndex];return"<"===t?(this.token.push(t),e.state=this.tagState,e):this.textState(e)}},{key:"textState",value:function(e){var t=e.allChars[e.curIndex];return"<"===t?(ar(Vr,this,Gr).call(this,"text",this.token.join("")),this.token=[],this.start(e)):(this.token.push(t),e.state=this.textState,e)}},{key:"tagState",value:function(e){var t=e.allChars[e.curIndex];return this.token.push(t),"/"===t?(e.state=this.endTagState,e):(e.state=this.startTagState,e)}},{key:"startTagState",value:function(e){var t=e.curIndex,r=e.allChars,n=r[t];if(n.match(/[a-zA-Z]/))return this.token.push(n),e.state=this.startTagState,e;if(" "===n){if(this.thisStartTagName=this.token.join("").substring(1),ar(Vr,this,Gr).call(this,"startTag",this.thisStartTagName.toLowerCase()),this.token=[],t<r.length-2){var i=r[t+1],o=r[t+2];if("/"===i&&">"===o)return ar(Vr,this,Gr).call(this,"endTag",this.thisStartTagName),this.token=[],e.state=this.start,e.curIndex+=2,e}return e.attrQuoteChar="",e.attrStatus=Pr.None,e.state=this.attrState,e}return">"===n?(this.thisStartTagName=this.token.join("").substring(1),ar(Vr,this,Gr).call(this,"startTag",this.thisStartTagName.toLowerCase()),this.token=[],e.state=this.start,ar(Vr,this,Hr).call(this)&&e.curIndex++,e):void 0}},{key:"attrState",value:function(e){var t=e.curIndex,r=e.allChars,n=r[t],i=!1,o=!1;if(e.attrStatus==Pr.AttrSplite?n.match(/[0-9|^<&;#]/)&&(i=!0):e.attrStatus!=Pr.AttrKey&&e.attrStatus!=Pr.AttrKeyQuoteStart||(n.match(/[0-9]/)||"."===n||"-"===n)&&(o=!0),n.match(/[:|a-z|A-Z|_]/)||i||o){if(e.attrStatus==Pr.None||e.attrStatus==Pr.AttrKey||e.attrStatus==Pr.AttrKeyQuoteStart)return this.token.push(n),e.state=this.attrState,e.attrStatus==Pr.None&&(e.attrStatus=Pr.AttrKey),e;if(e.attrStatus==Pr.AttrSpace)return this.token=[n],e.state=this.attrState,e.attrStatus=Pr.AttrKey,e;var a;if(e.attrStatus==Pr.AttrSplite)for(a=t;a<r.length;a++)if(this.token.push(r[a]),a+1<r.length){var s=r[a+1],u=!1,c=!1;if(" "===s||">"===s)u=!0;else if("/"===s){if(a+2<r.length)">"===r[a+2]&&(u=!0,c=!0)}if(u)return e.curIndex=a,e.attrStatus=Pr.None,e.attrQuoteChar="",ar(Vr,this,Gr).call(this,"attr",this.token.join("")),this.token=[],e.state=this.attrState,">"===s&&ar(Vr,this,Hr).call(this)&&(this.token=[],e.curIndex++,e.state=this.start),c&&(ar(Vr,this,Gr).call(this,"endTag",this.thisStartTagName),this.token=[],e.curIndex+=2,e.state=this.start),e}}if("="===n&&(e.attrStatus==Pr.AttrKey||e.attrStatus==Pr.AttrKeyQuoteEnd||e.attrStatus==Pr.AttrSpace))return this.token.push(n),e.state=this.attrState,e.attrStatus=Pr.AttrSplite,e;if(n.match(/['"]/)){if(e.attrStatus==Pr.AttrValueQuoteStart||e.attrStatus==Pr.AttrKeyQuoteStart){if(n===e.attrQuoteChar)return e.attrStatus==Pr.AttrValueQuoteStart?(this.token.push(n),ar(Vr,this,Gr).call(this,"attr",this.token.join("")),this.token=[],e.attrStatus=Pr.None):e.attrStatus=Pr.AttrKeyQuoteEnd,e.attrQuoteChar="",e.state=this.attrState,e;this.token.push(n)}else e.attrStatus==Pr.None?e.attrStatus=Pr.AttrKeyQuoteStart:e.attrStatus==Pr.AttrSplite&&(e.attrStatus=Pr.AttrValueQuoteStart,this.token.push(n)),e.attrQuoteChar=n;return e.state=this.attrState,e}if(e.attrStatus==Pr.AttrValueQuoteStart){if(this.token.push(n),"\\"===n&&t<r.length-1){var l=r[t+1];this.token.push(l),e.curIndex++}return e.state=this.attrState,e}if(" "===n){if(e.attrStatus==Pr.AttrKey||e.attrStatus==Pr.AttrKeyQuoteEnd)return e.attrStatus=Pr.AttrSpace,e.state=this.attrState,e;if(e.attrStatus==Pr.None||e.attrStatus==Pr.AttrSplite||e.attrStatus==Pr.AttrSpace)return e.state=this.attrState,e}if("/"===n){if(t<r.length-1)if(">"===r[t+1])return ar(Vr,this,Gr).call(this,"attr",this.token.join("")),ar(Vr,this,Gr).call(this,"endTag",this.thisStartTagName),this.token=[],e.state=this.start,e.curIndex++,e;return this.token.push(n),e.state=this.attrState,e}return">"===n?(ar(Vr,this,Gr).call(this,"attr",this.token.join("")),this.token=[],ar(Vr,this,Hr).call(this),e.state=this.start,e):(e.state=this.attrState,e)}},{key:"endTagState",value:function(e){var t=e.allChars[e.curIndex];if(t.match(/[a-zA-Z]/))return this.token.push(t.toLowerCase()),e.state=this.endTagState,e;if(">"===t){var r=this.token.join("").toLowerCase();return r=r.replace("</",""),ar(Vr,this,Gr).call(this,"endTag",r),this.token=[],e.state=this.start,e}}},{key:"doParse",value:function(){if(this.htmlString){var e=this.htmlString.split(""),t=new Ur(e,this.start);do{t.state.bind(this)(t),t.curIndex++}while(t.curIndex<e.length)}}},{key:"getTokens",value:function(){return this.tokens}}])}();function Gr(e,t){var r={type:e,value:t};"attr"==e&&""===t||(this.tokens.push(r),this.tokenHandler&&this.tokenHandler(r))}function Hr(){if(this.thisStartTagName){if("img"==this.thisStartTagName)return ar(Vr,this,Gr).call(this,"endTag","img"),!0;if("input"==this.thisStartTagName)return ar(Vr,this,Gr).call(this,"endTag","input"),!0}return!1}function zr(e,t){if(document.body)if(de.bIE)e.innerHTML=t;else{var r=new Rr;new jr(t,r.receiveInput.bind(r)).doParse();var n=r.getOutPutHtml();n.children.length>0&&function(e,t){for(;e.firstChild;)e.removeChild(e.firstChild);for(;t.firstChild;){var r=t.firstChild;t.removeChild(r),e.appendChild(r)}}(e,n)}}var Kr="ds-dwt-loaderBar",Jr="data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0iVVRGLTgiIHN0YW5kYWxvbmU9Im5vIj8+PHN2ZyB4bWxuczpzdmc9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIiB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHhtbG5zOnhsaW5rPSJodHRwOi8vd3d3LnczLm9yZy8xOTk5L3hsaW5rIiB2ZXJzaW9uPSIxLjAiIHdpZHRoPSIxMDBweCIgaGVpZ2h0PSIxMDBweCIgdmlld0JveD0iMCAwIDEyOCAxMjgiIHhtbDpzcGFjZT0icHJlc2VydmUiPjxnPjxjaXJjbGUgY3g9IjE2IiBjeT0iNjQiIHI9IjE2IiBmaWxsPSIjZmU4ZTE0Ii8+PGNpcmNsZSBjeD0iMTYiIGN5PSI2NCIgcj0iMTQuMzQ0IiBmaWxsPSIjZmU4ZTE0IiB0cmFuc2Zvcm09InJvdGF0ZSg0NSA2NCA2NCkiLz48Y2lyY2xlIGN4PSIxNiIgY3k9IjY0IiByPSIxMi41MzEiIGZpbGw9IiNmZThlMTQiIHRyYW5zZm9ybT0icm90YXRlKDkwIDY0IDY0KSIvPjxjaXJjbGUgY3g9IjE2IiBjeT0iNjQiIHI9IjEwLjc1IiBmaWxsPSIjZmU4ZTE0IiB0cmFuc2Zvcm09InJvdGF0ZSgxMzUgNjQgNjQpIi8+PGNpcmNsZSBjeD0iMTYiIGN5PSI2NCIgcj0iMTAuMDYzIiBmaWxsPSIjZmU4ZTE0IiB0cmFuc2Zvcm09InJvdGF0ZSgxODAgNjQgNjQpIi8+PGNpcmNsZSBjeD0iMTYiIGN5PSI2NCIgcj0iOC4wNjMiIGZpbGw9IiNmZThlMTQiIHRyYW5zZm9ybT0icm90YXRlKDIyNSA2NCA2NCkiLz48Y2lyY2xlIGN4PSIxNiIgY3k9IjY0IiByPSI2LjQzOCIgZmlsbD0iI2ZlOGUxNCIgdHJhbnNmb3JtPSJyb3RhdGUoMjcwIDY0IDY0KSIvPjxjaXJjbGUgY3g9IjE2IiBjeT0iNjQiIHI9IjUuMzc1IiBmaWxsPSIjZmU4ZTE0IiB0cmFuc2Zvcm09InJvdGF0ZSgzMTUgNjQgNjQpIi8+PGFuaW1hdGVUcmFuc2Zvcm0gYXR0cmlidXRlTmFtZT0idHJhbnNmb3JtIiB0eXBlPSJyb3RhdGUiIHZhbHVlcz0iNDUgNjQgNjQ7OTAgNjQgNjQ7MTM1IDY0IDY0OzE4MCA2NCA2NDsyMjUgNjQgNjQ7MjcwIDY0IDY0OzMxNSA2NCA2NDswIDY0IDY0IiBjYWxjTW9kZT0iZGlzY3JldGUiIGR1cj0iNzIwbXMiIHJlcGVhdENvdW50PSJpbmRlZmluaXRlIj48L2FuaW1hdGVUcmFuc2Zvcm0+PC9nPjwvc3ZnPg==";function Qr(e){var t,r,n,i="",o="230px",a="240px",s="",u="";return e&&(e.background&&(i=";background:"+e.background),e.width&&(o=e.width),e.height&&(a=e.height),e.imageSource&&(t=e.imageSource)),t||(t=Jr),n=parseInt(o)/2,Zt.isNumber(n)&&n>0&&(u=";width:"+n+"px"),r=parseInt(a)/2,Zt.isNumber(r)&&r>0&&(s=";height:"+r+"px"),['<div align="center" ','class="',Kr,'" ','style="margin:0 auto;max-width:',o,";max-height:",a,";line-height:",a,i,'"><img style="user-select:none',s,u,';max-width:230px;max-height:240px;vertical-align:middle" src="',t,'" draggable="false" /></div>'].join("")}var qr,Yr=window,Xr=document,Zr=5e5;function $r(e,t){for(var r=0;r<e.length;++r)if(e[r]==t)return oe;return ae}function en(e){var t;return Yr.getComputedStyle?t=Yr.getComputedStyle(e):e.currentStyle&&(t=e.currentStyle),t&&"absolute"!=t.position||"auto"!=e.style.top&&""!=e.style.top||"auto"!=e.style.bottom&&""!=e.style.bottom?ae:!function(e){for(var t=0;t<Xr.styleSheets.length;++t){var r=Xr.styleSheets[t],n=void 0,i=void 0,o=void 0,a=void 0;try{n=r.cssRules,i=Xr.querySelectorAll}catch(Mj){}if(n&&i)for(var s=0;s<n.length;++s){o=n[s],a=ae;try{a=i(o.selectorText)}catch(Mj){}if(a&&$r(a,e)){var u=o.style.getPropertyValue("top"),c=o.style.getPropertyValue("bottom");if(u&&"auto"!=u||c&&"auto"!=c)return oe}}}return ae}(e)}function tn(e){var t=Xr.createEvent("MouseEvents");return null==t||t.initMouseEvent(e.type,e.bubbles,e.cancelable,Yr,e.detail,e.screenX,e.screenY,e.clientX,e.clientY,e.ctrlKey,e.altKey,e.shiftKey,e.metaKey,e.button,e.relatedTarget),t}function rn(e){var t;null===(t=Xr.body)||void 0===t||t.dispatchEvent(tn(e))}function nn(e,t){if(qr){var r=qr.style;r.backgroundColor=["rgba(",t,",",t,",",t,",",e,")"].join(""),r.filter=["alpha(opacity=",100*e,")"].join(""),r.opacity=r.MozOpacity=e}}function on(e,t){qr===Br?function(e,t){if(qr=Xr.createElement("div")){var r=qr.style;if(r.position="fixed",r.display="block",r.left=r.top=r.margin=r.padding=0,nn(e,t),r.zIndex=Zr,r.width=r.height="100%",de.bIE&&de.IEVersion<10){var n=Xr.createElement("iframe");n.style.background="none",n.style.margin="0px auto",n.style.border="0",n.style.width="100%",n.style.height="100%",n.style.position="relative",n.style.zIndex="9999",n.src="javascript:''",qr.appendChild(n)}Xr.createEvent&&Zt.addEventListener(qr,"click",rn)}}(e,t):nn(e,t),Xr.body&&!Xr.body.contains(qr)&&Xr.body.appendChild(qr)}var an,sn,un={pendingDialogStack:[],pendingDialogTopmostStack:[],opacity:.1,grayHex:128,_updateStacking:function(e){var t,r;0!=(t=this.pendingDialogStack).length?(1!=e&&on(un.opacity,un.grayHex),r=Zr,Zt.each(t,(function(e){r++,e._dlgInfo.mask&&(e._dlgInfo.mask.style.zIndex=r++),e.style.zIndex=r}))):qr!==Br&&(Zt.removeEventListener(qr,"click",rn),Xr&&Xr.body&&Xr.body.removeChild(qr),qr=Br)},pushDialog:function(e,t){var r,n,i=this;if(e.getBoundingClientRect(),(n=e.bTopmost?i.pendingDialogTopmostStack:i.pendingDialogStack).length>=1e3)Zt.error("Too many modal dialogs.");else{if((r=Xr.createElement("div")).style.zIndex="10000",r.className="dynamsoft-backdrop",1==t?(r.style.left=0,r.style.top=0,r.style.position="absolute"):(r.style.left=0,r.style.top=0,r.style.width="100%",r.style.height="100%",r.style.position="fixed"),Xr.createEvent&&Zt.addEventListener(r,"click",(function(t){if(e.dispatchEvent){var r=tn(t);e.dispatchEvent(r)}})),e.parentNode.insertBefore(r,e.nextSibling),e._dlgInfo.mask=r,e.bTopmost){var o=501e3;e._dlgInfo.mask&&(e._dlgInfo.mask.style.zIndex=o),e.style.zIndex=501001}n.push(e),i._updateStacking(t)}},removeDialog:function(e){var t,r,n,i=this;n=e.bTopmost?i.pendingDialogTopmostStack:i.pendingDialogStack,-1!=(t=Zt.isArray(n)?Zt.indexOf(e,n):-1)&&(n.splice(t,1),(r=e._dlgInfo.mask).parentNode&&r.parentNode.removeChild(r),e._dlgInfo.mask=null,i._updateStacking())}};function cn(e,t){var r,n,i,o,a,s,u=this,c=!0,l=1==t?"absolute":"fixed",d="50%",f="50%",h="",g="",m=null;if(u._dlgInfo&&u._dlgInfo.styleConfig){var p=u._dlgInfo.styleConfig;Zt.isString(p.position)&&(l=p.position,c=!1),(Zt.isString(p.left)||Zt.isNumber(p.left))&&(f=p.left,c=!1),(Zt.isString(p.top)||Zt.isNumber(p.top))&&(d=p.top,c=!1),(Zt.isString(p.width)||Zt.isNumber(p.width))&&(h=p.width,c=!1),(Zt.isString(p.height)||Zt.isNumber(p.height))&&(g=p.height,c=!1),Zt.isString(p.transform)&&(m=p.transform,c=!1)}u.open?Zt.error("showDialog called on open dialog."):(u.open=oe,u.removeAttribute("closed"),u.setAttribute("open","open"),c?r=de.bIE&&"fixed"==l?{display:"block",position:"fixed",top:"35%",margin:"0 auto",left:0,right:0}:{display:"block",position:l,left:"50%",top:"50%",transform:"translate(-50%,-50%)"}:(r={display:"block",position:l,left:f,top:d,width:h,height:g},m&&(r.transform=m)),"DIALOG"==u.tagName?(de.bIE?r.margin="0 auto":r.margin="0",r.broderRadius="6px",r.boxShadow="2px 2px 0 0 rgba(0,0,0,.05)",r.webkitBoxSizing="border-box",r.boxSizing="border-box"):(r.border="0",de.bIE?r.margin="0 auto":r.margin="0",r.webkitBoxSizing="border-box",r.boxSizing="border-box"),Zt.mix(u.style,r),en(u)&&(n=u,s=((null===(i=Xr.body)||void 0===i?void 0:i.scrollTop)||(null===(o=Xr.documentElement)||void 0===o?void 0:o.scrollTop)||0)+((Yr.innerHeight?Yr.innerHeight:null===(a=Xr.documentElement)||void 0===a?void 0:a.clientHeight)-n.offsetHeight)/2,n.style.top=s+"px",n._dlgInfo.isTopOverridden=oe),e&&(u._dlgInfo.modal=oe,un.pushDialog(u,t)))}function ln(e){var t=this;return t.open||Zt.error("closeDialog called on closed dialog."),t.open=ae,t.removeAttribute("open"),t.setAttribute("closed","closed"),t.style.display="none",void 0!==e&&(t.returnValue=e),t._dlgInfo.isTopOverridden&&(t.style.top="auto"),t._dlgInfo.modal&&un.removeDialog(t),t.returnValue}function dn(e){Zt.isNumber(e.opacity)?un.opacity=e.opacity:un.opacity=.1,Zt.isNumber(e.grayHex)?un.grayHex=e.grayHex:un.grayHex=128}function fn(e){var t,r,n,i;if(!sn.dlgMask){var o,a,s,u,c=!1;if(e){if(u={},(Zt.isString(e.top)||Zt.isNumber(e.top))&&(u.top=e.top),(Zt.isString(e.left)||Zt.isNumber(e.left))&&(u.left=e.left),Zt.isString(e.position)&&(u.position=e.position),e.confined)document.getElementsByClassName("dwt-viewer-imageEditor-fullScreen")[0]||(c=e.confined);(Zt.isString(e.width)||Zt.isNumber(e.width))&&(t=e.width),(Zt.isString(e.height)||Zt.isNumber(e.height))&&(r=e.height),Zt.isString(e.background)&&(n=e.background),Zt.isString(e.imageSource)&&(i=e.imageSource),dn(e),c&&e.wrapperEl&&(a=e.wrapperEl,Zt.isString(a)&&(a=Xr.getElementById(a)))}if(!i){var l;if(window&&window.Dynamsoft){var d=window.Dynamsoft.DWT;d&&d.CustomizableDisplayInfo&&(l=d.CustomizableDisplayInfo)}l?(de.bIE&&Zt.isString(l.loaderBarSourceIE)&&""!=l.loaderBarSourceIE&&(i=l.loaderBarSourceIE),!i&&Zt.isString(l.loaderBarSource)&&""!=l.loaderBarSource&&(i=l.loaderBarSource)):i=Jr}if(a&&(s=a.getBoundingClientRect(),a.style.position="relative"),o=Xr.createElement("div")){var f;if(o.className="dynamsoft-dialog-wrap",zr(o,Qr({width:t,height:r,backgroundColor:n,imageSource:i})),a)a.appendChild(o),o.style.position="absolute",o.style.top="50%",o.style.left="50%",o.style.transform="translate(-50%, -50%)";else null===(f=Xr.body)||void 0===f||f.appendChild(o);c&&s&&(window.onresize?sn.preOnresize=window.onresize:sn.preOnresize=!1,window.onscroll?sn.preOnscroll=window.onscroll:sn.preOnscroll=!1),sn.dlgMask=o,an.setup(o,c),u&&(o._dlgInfo.styleConfig=u),a&&(o._dlgInfo.wrapperEl=a),o.showModal()}}}function hn(){var e=sn.dlgMask;if(e){var t;if(e.close(),e._dlgInfo&&e._dlgInfo.wrapperEl)e._dlgInfo.wrapperEl.removeChild(e),e._dlgInfo.wrapperEl=null;else null===(t=Xr.body)||void 0===t||t.removeChild(e);sn.dlgMask=!1}sn.preOnresize?window.onresize=sn.preOnresize:window.onresize=null,sn.preOnresize=!1,sn.preOnscroll?window.onscroll=sn.preOnscroll:window.onscroll=null,sn.preOnscroll=!1}an={setup:function(e,t){e.show=cn.bind(e,ae,t),e.showModal=cn.bind(e,oe,t),e.close=ln.bind(e),e._dlgInfo={}}},sn={dlgMask:!1,preOnresize:!1,preOnscroll:!1};var gn=function(){return w((function e(t){I(this,e),ir(this,"div",void 0),ir(this,"container",void 0),ir(this,"docElem",void 0),ir(this,"opacity",void 0),ir(this,"cssFloat",void 0),ir(this,"clearCloneStyle",void 0),ir(this,"boxSizing",void 0),ir(this,"pixelPositionVal",void 0),ir(this,"pixelMarginRightVal",void 0),ir(this,"boxSizingReliableVal",void 0),ir(this,"pixelBoxStylesVal",void 0),ir(this,"reliableHiddenOffsetsVal",void 0),ir(this,"reliableMarginRightVal",void 0),ir(this,"reliableMarginLeftVal",void 0),ir(this,"leadingWhitespace",void 0),ir(this,"tbody",void 0),ir(this,"htmlSerialize",void 0);var r=t.createElement("div"),n=t.createElement("div");if(n.style){this.div=n,this.container=r,this.docElem=t.documentElement,n.textContent=" ";var i=document.createElement("link");n.appendChild(i);var o=document.createElement("table");n.appendChild(o);var a=document.createElement("a");a.href="/a",n.appendChild(a);var s=document.createElement("input");for(s.type="checkbox",n.appendChild(s),this.leadingWhitespace=3===n.firstChild.nodeType,this.tbody=!n.getElementsByTagName("tbody").length,this.htmlSerialize=!!n.getElementsByTagName("link").length,n.style.cssText="float:left;opacity:.5",this.opacity="0.5"===n.style.opacity,this.cssFloat=!!n.style.cssFloat,n.style.backgroundClip="content-box",n.cloneNode(!0).style.backgroundClip="",this.clearCloneStyle="content-box"===n.style.backgroundClip,(r=document.createElement("div")).style.cssText="border:0;width:60px;height:0;top:0;left:-11111px;padding:0;margin-top:1px;position:absolute";n.firstChild;)n.removeChild(n.firstChild);r.appendChild(n),this.boxSizing=""===n.style.boxSizing||""===n.style.MozBoxSizing||""===n.style.WebkitBoxSizing}}),[{key:"reliableHiddenOffsets",value:function(){return null==this.pixelPositionVal&&this.computeStyleTests(),this.reliableHiddenOffsetsVal}},{key:"boxSizingReliable",value:function(){return null==this.pixelPositionVal&&this.computeStyleTests(),this.boxSizingReliableVal}},{key:"pixelBoxStyles",value:function(){return null==this.pixelPositionVal&&this.computeStyleTests(),this.pixelBoxStylesVal}},{key:"pixelMarginRight",value:function(){return null==this.pixelPositionVal&&this.computeStyleTests(),this.pixelMarginRightVal}},{key:"pixelPosition",value:function(){return null==this.pixelPositionVal&&this.computeStyleTests(),this.pixelPositionVal}},{key:"reliableMarginRight",value:function(){return null==this.pixelPositionVal&&this.computeStyleTests(),this.reliableMarginRightVal}},{key:"reliableMarginLeft",value:function(){return null==this.pixelPositionVal&&this.computeStyleTests(),this.reliableMarginLeftVal}},{key:"roundPixelMeasures",value:function(e){return Math.round(parseFloat(e))}},{key:"computeStyleTests",value:function(){var e,t,r=this.div;if(this.docElem&&this.docElem.appendChild(this.container),r.style.cssText="-webkit-box-sizing:border-box;box-sizing:border-box;overflow:scroll;position:relative;display:block;margin:auto;border:1px;padding:1px;top:1%;width:60%",this.pixelPositionVal=this.boxSizingReliableVal=this.reliableMarginLeftVal=this.pixelBoxStylesVal=!1,this.pixelMarginRightVal=this.reliableMarginRightVal=!0,window.getComputedStyle)return t=window.getComputedStyle(r),this.pixelPositionVal="1%"!==(t||{}).top,this.reliableMarginLeftVal="2px"===(t||{}).marginLeft,this.boxSizingReliableVal="4px"===(t||{width:"4px"}).width,r.style.marginRight="50%",this.pixelMarginRightVal="4px"===(t||{marginRight:"4px"}).marginRight,(e=r.appendChild(document.createElement("div"))).style.cssText=r.style.cssText="-webkit-box-sizing:content-box;-moz-box-sizing:content-box;box-sizing:content-box;display:block;margin:0;border:0;padding:0",e.style.marginRight=e.style.width="0",r.style.width="1px",this.reliableMarginRightVal=!parseFloat((window.getComputedStyle(e)||{}).marginRight),r.style.right="60%",this.pixelBoxStylesVal=36===this.roundPixelMeasures(t.right),r&&r.removeChild(e),void(r=null);if(r.style.display="none",this.reliableHiddenOffsetsVal=0===r.getClientRects().length,this.reliableHiddenOffsetsVal){r.style.display="";var n=document.createElement("table"),i=document.createElement("tr"),o=document.createElement("td");i.appendChild(o);var a=document.createElement("td");a.textContent="t",i.appendChild(a),n.appendChild(i),r.appendChild(i),r.childNodes[0].style.borderCollapse="separate",(e=r.getElementsByTagName("td"))[0].style.cssText="margin:0;border:0;padding:0;display:none",this.reliableHiddenOffsetsVal=0===e[0].offsetHeight,this.reliableHiddenOffsetsVal&&(e[0].style.display="",e[1].style.display="none",this.reliableHiddenOffsetsVal=0===e[0].offsetHeight)}this.docElem&&this.docElem.removeChild(this.container)}},{key:"createHTMLDocument",get:function(){if(document.implementation){var e=document.implementation.createHTMLDocument("").body;return e.innerHTML="<form></form><form></form>",2===e.childNodes.length}return!1}}])}(),mn=new gn(document),pn=mn.docElem;Zt.sizzle;var vn,_n,yn=/^(top|right|bottom|left)$/,Sn=/[+-]?(?:\d*\.|)\d+(?:[eE][+-]?\d+|)/.source,In=new RegExp("^("+Sn+")(?!px)[a-z%]+$","i"),bn=new RegExp("^("+Sn+")(.*)$","i");window.getComputedStyle?vn=function(e){var t,r;return(r=(t=Zt.isFunction(e.getEL)?e.getEL():e).ownerDocument.defaultView)&&r.opener||(r=window),r.getComputedStyle(t)}:pn&&pn.currentStyle&&(vn=function(e){return e.currentStyle});var Tn=/^--/,Cn="[\\x20\\t\\r\\n\\f]",wn=new RegExp("^"+Cn+"+|((?:^|[^\\\\])(?:\\\\.)*)"+Cn+"+$","g"),En=["Top","Right","Bottom","Left"],kn=new RegExp(En.join("|"),"i");window.getComputedStyle?_n=function(e,t,r){var n,i,o,a,s=Tn.test(t),u=e.style;return(r=r||vn(e))&&(a=r.getPropertyValue(t)||r[t],s&&a&&(a=a.replace(wn,"$1")||undefined),""!==a||function(e){return Gn.contains(e.ownerDocument,e)}(e)||(a=Qn(e,t)),!mn.pixelBoxStyles()&&In.test(a)&&kn.test(t)&&(n=u.width,i=u.minWidth,o=u.maxWidth,u.minWidth=u.maxWidth=u.width=a,a=r.width,u.width=n,u.minWidth=i,u.maxWidth=o)),a===undefined?a:a+""}:pn&&pn.currentStyle&&(_n=function(e,t,r){var n,i,o,a,s=e.style;return null==(a=(r=r||vn(e))?r[t]:undefined)&&s&&s[t]&&(a=s[t]),In.test(a)&&!yn.test(t)&&(n=s.left,(o=(i=e.runtimeStyle)&&i.left)&&(i.left=e.currentStyle.left),s.left="fontSize"===t?"1em":a,a=s.pixelLeft+"px",s.left=n,o&&(i.left=o)),a===undefined?a:a+""||"auto"});var An,xn=/<([\w:-]+)/,Pn=/<|&#?\w+;/,Dn=/^-ms-/,Fn=/-([\da-z])/gi,Wn=/^(none|table(?!-c[ea]).+)/,Rn=/^<([a-z][^\/\0>:\x20\t\r\n\f]*)[\x20\t\r\n\f]*\/?>(?:<\/\1>|)$/i,Nn={position:"absolute",visibility:"hidden",display:"block"},On={letterSpacing:"0",fontWeight:"400"},Mn={option:[1,"<select multiple='multiple'>","</select>"],legend:[1,"<fieldset>","</fieldset>"],area:[1,"<map>","</map>"],param:[1,"<object>","</object>"],thead:[1,"<table>","</table>"],tr:[2,"<table><tbody>","</tbody></table>"],col:[2,"<table><tbody></tbody><colgroup>","</colgroup></table>"],td:[3,"<table><tbody><tr>","</tr></tbody></table>"],_default:mn.htmlSerialize?[0,"",""]:[1,"X<div>","</div>"]},Ln=document.createElement("div");An=Ln.style,mn.cssFloat=!!Ln.style.cssFloat;var Bn=function(e,t){return t.toUpperCase()},Un=["Webkit","Moz","ms"],Vn={};function jn(e){var t=Gn.cssProps[e]||Vn[e];return t||(e in An?e:Vn[e]=function(e){if(e in An)return e;var t=e.charAt(0).toUpperCase()+e.slice(1),r=Un.length;for(;r--;)if((e=Un[r]+t)in An)return e}(e)||e)}var Gn={cssHooks:{},contains:function(e,t){var r=t&&t.parentNode;return e===r||!(!r||1!==r.nodeType||!(e.contains?e.contains(r):e.compareDocumentPosition&&16&e.compareDocumentPosition(r)))},merge:function(e,t){for(var r=+t.length,n=0,i=e.length;n<r;)e[i++]=t[n++];if(r!=r)for(;t[n]!==undefined;)e[i++]=t[n++];return e.length=i,e},camelCase:function(e){return e.replace(Dn,"ms-").replace(Fn,Bn)},cssProps:{},cssNumber:{animationIterationCount:!0,columnCount:!0,fillOpacity:!0,flexGrow:!0,flexShrink:!0,fontWeight:!0,lineHeight:!0,opacity:!0,order:!0,orphans:!0,widows:!0,zIndex:!0,zoom:!0}},Hn=["flo","at"].join("");Gn.cssProps[Hn]=mn.cssFloat?"cssFloat":"styleFloat";function zn(e,t,r,n,i){for(var o=r===(n?"border":"content")?4:"width"===t?1:0,a=0;o<4;o+=2)"margin"===r&&(a+=qn(e,r+En[o],!0,i)),n?("content"===r&&(a-=qn(e,"padding"+En[o],!0,i)),"margin"!==r&&(a-=qn(e,"border"+En[o]+"Width",!0,i))):(a+=qn(e,"padding"+En[o],!0,i),"padding"!==r&&(a+=qn(e,"border"+En[o]+"Width",!0,i)));return a}function Kn(e,t,r){var n=!0,i="width"===t?e.offsetWidth:e.offsetHeight,o=vn(e),a=mn.boxSizing&&"border-box"===qn(e,"boxSizing",!1,o);if(i<=0||null==i){if(((i=_n(e,t,o))<0||null==i)&&(i=e.style[t]),In.test(i))return i;n=a&&(mn.boxSizingReliable()||i===e.style[t]),i=parseFloat(i)||0}return i+zn(e,t,r||(a?"border":"content"),n,o)}function Jn(e){return new RegExp("^(?:([+-])=|)("+Sn+")([a-z%]*)$","i").exec(e)}function Qn(e,t,r,n){if(e&&3!==e.nodeType&&8!==e.nodeType&&e.style){var i,o,a,s=Gn.camelCase(t),u=Tn.test(t),c=e.style;if(u||(t=jn(s)),a=Gn.cssHooks[t]||Gn.cssHooks[s],r===undefined)return a&&"get"in a&&(i=a.get(e,!1,n))!==undefined?i:c[t];"string"===(o=b(r))&&(i=Jn(r))&&i[1]&&(r=function(e,t,r,n){var i,o=1,a=20,s=n?function(){return n.cur()}:function(){return qn(e,t,"")},u=s(),c=r&&r[3]||(Gn.cssNumber[t]?"":"px"),l=(Gn.cssNumber[t]||"px"!==c&&+u)&&Jn(qn(e,t));if(l&&l[3]!==c){c=c||l[3],r=r||[],l=+u||1;do{Qn(e,t,(l/=o=o||".5")+c)}while(o!==(o=s()/u)&&1!==o&&--a)}return r&&(l=+l||+u||0,i=r[1]?l+(r[1]+1)*r[2]:+r[2],n&&(n.unit=c,n.start=l,n.end=i)),i}(e,t,i),o="number"),null!=r&&r==r&&("number"!==o||u||(r+=i&&i[3]||(Gn.cssNumber[s]?"":"px")),mn.clearCloneStyle||""!==r||0!==t.indexOf("background")||(c[t]="inherit"),a&&"set"in a&&(r=a.set(e,r,n))===undefined||(u?c.setProperty(t,r):c[t]=r))}}function qn(e,t,r,n){var i,o,a,s=Gn.camelCase(t);return Tn.test(t)||(t=jn(s)),(a=Gn.cssHooks[t]||Gn.cssHooks[s])&&"get"in a&&(i=a.get(e,!0,r)),i===undefined&&(i=_n(e,t,n)),"normal"===i&&t in On&&(i=On[t]),""===r||r?(o=parseFloat(i),!0===r||isFinite(o)?o||0:i):i}function Yn(e,t){if(!e||"string"!=typeof e)return[];if("boolean"==typeof t&&(t=!1),!t)if(mn.createHTMLDocument){var r=(t=document.implementation.createHTMLDocument("")).createElement("base");r.href=document.location.href,t.head.appendChild(r)}else t=document;var n=Rn.exec(e);return n?[t.createElement(n[1])]:(n=function(e,t){for(var r,n,i,o,a,s=t.createDocumentFragment(),u=[],c=0,l=e.length;c<l;c++)if((r=e[c])||0===r)if("object"===Zt.type(r))Gn.merge(u,r.nodeType?[r]:r);else if(Pn.test(r)){for(n=n||s.appendChild(t.createElement("div")),i=(xn.exec(r)||["",""])[1].toLowerCase(),zr(n,(o=Mn[i]||Mn._default)[1]+r+o[2]),a=o[0];a--;)n=n.lastChild;Gn.merge(u,n.childNodes),(n=s.firstChild).textContent=""}else u.push(t.createTextNode(r));for(s.textContent="",c=0;r=u[c++];)s.appendChild(r);return n=null,s}([e],t),Gn.merge([],n.childNodes))}Zt.each(["height","width"],(function(e,t){Gn.cssHooks[e]={get:function(t,r,n){if(r)return Wn.test(qn(t,"display"))&&0===t.offsetWidth?function(e,t,r,n){var i,o={};return Zt.each(t,(function(r,n){o[n]=e.style[n],e.style[n]=t[n]})),i=r.apply(e,n||[]),Zt.each(t,(function(t,r){e.style[r]=o[r]})),i}(t,Nn,(function(){return Kn(t,e,n)})):Kn(t,e,n)},set:function(t,r,n){var i=n&&vn(t);return function(e,t,r){var n=bn.exec(t);return n?Math.max(0,parseInt(n[1])-(r||0))+(n[2]||"px"):t}(0,r,n?zn(t,e,n,mn.boxSizing&&"border-box"===qn(t,"boxSizing",!1,i),i):0)}}}));var Xn,Zn=Array.prototype.slice,$n=" ",ei=de.bIE&&de.IEMode<10,ti=/[\n\t\r\.]/g,ri=function(){function e(t,r,n){I(this,e),ir(this,"isNodeList",!0),ir(this,"length",0);var i=this;return!t||Zt.isString(t)?i:Zt.isArray(t)||t.isNodeList?(Array.prototype.push.apply(i,Zt.makeArray(t)),i):(i[0]=t,i.length=1,i)}return w(e,[{key:"item",value:function(t){return Zt.isNumber(t)?t>=this.length?null:new e(this[t]):new e(t)}},{key:"slice",value:function(){return new e(Zn.apply(this,arguments))}},{key:"getDOMNodes",value:function(){return Zn.call(this)}},{key:"each",value:function(t,r){var n=this;return Zt.each(n,(function(i,o){return i=new e(i),t.call(r||i,i,o,n)})),n}},{key:"getEL",value:function(){return this.length>0?this[0]:undefined}},{key:"all",value:function(t){return this.length>0?ai(t,this):new e}},{key:"one",value:function(e){var t=this.all(e);return t.length?t.slice(0,1):t}},{key:"attr",value:function(e,t){var r=this.getEL();if(r){if(Zt.isUndefined(t))return"readonly"===e?r.readOnly?"readonly":"":("style"!==e&&ei?r=r[e]:(r=r.attributes[e])&&(r=r.value),r);"class"==e?r.className=t:r[e]=t}}},{key:"addClass",value:function(e){var t=this.getEL();t&&function(e,t){var r,n,i,o,a=e.className,s=t.length;if(a){for(r=ii(a),n=a,i=0;i<s;i++)o=oi(t[i]),r.indexOf($n+o+$n)<0&&(n+=$n+o);n=Zt.trim(n)}else n=t.join(" ");e.className=n}(t,e.split($n))}},{key:"removeClass",value:function(e){var t=this.getEL();t&&function(e,t){var r,n,i,o=e.className,a=t.length;if(o&&a){for(r=ii(o),n=0;n<a;n++)for(i=$n+oi(t[n])+$n;r.indexOf(i)>=0;)r=r.replace(i,$n);e.className=Zt.trim(r)}}(t,e.split($n))}},{key:"hasClass",value:function(e){var t=this.getEL();if(t)return function(e,t){var r,n,i,o=e.className,a=t.length;if(o&&a){for(r=ii(o),n=0;n<a;n++)if(i=$n+oi(t[n])+$n,r.indexOf(i)<0)return ae;return oe}return ae}(t,e.split($n))}},{key:"parent",value:function(){var t=this.getEL();return t&&(t=t.parentNode),new e(t)}},{key:"remove",value:function(){var e=this.getEL();e&&e.parentNode&&e.parentNode.removeChild(e)}},{key:"offset",value:function(){var e=this.getEL();return Zt.DOM.getElDimensions(e,oe)}},{key:"before",value:function(e){var t=this.getEL(),r=[e];t&&(ni(e)&&(r=Yn(e)),Zt.each(r,(function(e){t.insertBefore(e,t.childNodes[0])})))}},{key:"append",value:function(e){var t=this.getEL(),r=[e];t&&(ni(e)&&(r=Yn(e)),Zt.each(r,(function(e){t.appendChild(e)})))}},{key:"html",value:function(e){var t=this.getEL();if(t){if(Zt.isUndefined(e))return function(e){var t=e.innerHTML;if(!document.all)return t;var r=/(\s+\w+)\s*=\s*([^<>"\s]+)(?=[^<>]*\/>)/gi,n=/"'([^'"]*)'"/gi;return(t=t.replace(r,'$1="$2"').replace(n,'"$1"')).replace(/<(\/?)(\w+)([^>]*)>/g,(function(e,t,r,n){return t?"</"+r.toLowerCase()+">":("<"+r.toLowerCase()+n+">").replace(/=(("[^"]*?")|('[^']*?')|([\w\-\.]+))([\s>])/g,(function(e,t,r,n,i,o,a,s){return i?'="'+i+'"'+o:e}))})).replace(/<\/?([^>]+)>/g,(function(e){return e}))}(t);for(;t.firstChild;)t.removeChild(t.firstChild);Zt.each(Yn(e),(function(e){t.appendChild(e)}))}}},{key:"style",value:function(e,t){var r=this.getEL();if(r)return Qn(r,e,t)}},{key:"css",value:function(e){Zt.each(this,(function(t){Zt.each(e,(function(e,r){Qn(t,r,e)}))}))}},{key:"show",value:function(){Zt.each(this,(function(e){e.style.display=""}))}},{key:"hide",value:function(){Zt.each(this,(function(e){e.style.display="none"}))}}])}();function ni(e){return Zt.isString(e)&&(e=Zt.trim(e))&&e.length>=3&&Zt.startsWith(e,"<")&&Zt.endsWith(e,">")}function ii(e){return($n+e+$n).replace(ti,$n)}function oi(e){return e.replace(ti,"")}function ai(e,t){var r=t;return r&&r.isNodeList&&(r=r.getEL()),Zt.isString(e)?(ni(e)&&Zt.error("Err 4002."),new ri(Zt.sizzle(e,r))):e.isNodeList?e:new ri(e)}function si(e,t){var r=ai(e,t);return r.length?r.slice(0,1):r}function ui(e){return e instanceof ri}(Xn=self||{}).Map||(Xn.Map=function(){this.keys=[],this.data={},this.set=function(e,t){null==this.data[e]&&-1==this.keys.indexOf(e)&&this.keys.push(e),this.data[e]=t},this.get=function(e){return this.data[e]}});var ci=new(w((function NJ(){I(this,NJ),ir(this,"__ver",20230516),ir(this,"Events",Yt),ir(this,"EnumMouseButton",lr),ir(this,"detectButton",dr),ir(this,"getWheelDelta",cr),ir(this,"fromUnicode",vr),ir(this,"escapeHtml",_r),ir(this,"escapeRegExp",yr),ir(this,"unEscapeHtml",Sr),ir(this,"param",Ar),ir(this,"unparam",xr),ir(this,"colorStrToInt",sr),ir(this,"IntToColorStr",ur),ir(this,"currentStyle",Er),ir(this,"parseHTML",Yn),ir(this,"setHtml",zr),ir(this,"css",qn),ir(this,"style",Qn),ir(this,"support",mn),ir(this,"all",ai),ir(this,"one",si),ir(this,"isNodeList",ui),ir(this,"Promise",Ir),ir(this,"nativePromise",br),ir(this,"loaderBarClassName",Kr),ir(this,"loaderBarSource",Jr),ir(this,"createShowMaskContent",Qr),ir(this,"switchEvent",wr),ir(this,"setBackOpacity",dn),ir(this,"showMask",fn),ir(this,"hideMask",hn),ir(this,"dialog",an),ir(this,"mask",sn)}))),li={getHex:function(e){var t=Number(e).toString(16).toUpperCase();return 1==t.length&&(t=["0",t].join("")),t},getColor:function(e){var t,r,n;return n=e>>16,r=(65280&e)>>8,t=255&e,["#",li.getHex(n),li.getHex(r),li.getHex(t)].join("")},RGB2BGR:function(e){return(255&e)<<16|65280&e|e>>16}};li.BGR2RGB=li.RGB2BGR;var di=!1,fi=!0,hi=/[#\/\?@]/g,gi=/[#\?]/g,mi={scheme:1,userInfo:2,hostname:3,port:4,path:5},pi=new RegExp("^(?:([\\w\\d+.-]+):)?(?://(?:([^/?#@]*)@)?([\\w\\d\\-\\u0100-\\uffff.+%]*|\\[[^\\]]+\\])(?::([0-9]+))?)?(.+)?$");function vi(e,t){return Zt.isString(e)&&Zt.isString(t)?e.toLowerCase()===t.toLowerCase():e===t}function _i(e,t){return encodeURI(e).replace(t,(function(e){return"%"+function(e){return 1===e.length?"0"+e:e}(e.charCodeAt(0).toString(16))}))}var yi,Si=function(){function e(t){if(o(this,e),c(this,"scheme",""),c(this,"userInfo",""),c(this,"hostname",""),c(this,"port",""),c(this,"path",""),t instanceof e)return Zt.clone(t);e.getComponents(t,this)}return s(e,[{key:"clone",value:function(){var t=new e,r=this;return Zt.each(mi,(function(e,n){t[n]=r[n]})),t}},{key:"getScheme",value:function(){return this.scheme}},{key:"setScheme",value:function(e){return this.scheme=e,this}},{key:"getHostname",value:function(){return this.hostname}},{key:"setHostname",value:function(e){return this.hostname=e,this}},{key:"setUserInfo",value:function(e){return this.userInfo=e,this}},{key:"getUserInfo",value:function(){return this.userInfo}},{key:"setPort",value:function(e){return this.port=e,this}},{key:"getPort",value:function(){return this.port}},{key:"setPath",value:function(e){return this.path=e,this}},{key:"getPath",value:function(){return this.path}},{key:"isSameOriginAs",value:function(e){var t=this;return vi(t.hostname,e.hostname)&&vi(t.scheme,e.scheme)&&vi(t.port,e.port)}},{key:"toString",value:function(e){var t,r,n,i,o,a=[],s=this;return(t=s.scheme)&&(a.push(_i(t,hi)),a.push(":")),(r=s.hostname)&&(a.push("//"),(o=s.userInfo)&&(a.push(_i(o,hi)),a.push("@")),a.push(encodeURIComponent(r)),(i=s.port)&&(a.push(":"),a.push(i))),(n=s.path)&&(r&&!Zt.startsWith(n,"/")&&(n="/"+n),a.push(_i(n,gi))),a.join("")}}],[{key:"getComponents",value:function(e,t){var r=(e=e||le).match(pi)||[],n=t||{};return Zt.each(mi,(function(e,t){n[t]=r[e]})),n}}])}(),Ii=Zt.each,bi=Zt.error,Ti=Zt.isFunction,Ci=Zt.isString,wi=de.bIE&&de.IEVersion<=9,Ei=de.bIE&&de.IEVersion<=10,ki=window,Ai=new Si(location.href),xi=Ai&&/^(?:about|app|app\-storage|.+\-extension|file|widget)$/.test(Ai.getScheme()),Pi=!1,Di=function(){try{return new ki.XMLHttpRequest}catch(Mj){}},Fi=function(){try{var e=di;return Ii(["Msxml2.XMLHTTP.6.0","Msxml2.XMLHTTP","Microsoft.XMLHTTP","Msxml2.XMLHTTP.3.0","Msxml3.XMLHTTP"],(function(t){try{if(!e)return e=new ki.ActiveXObject(t),di}catch(Mj){bi("new xhr error: "+Mj.message)}})),e}catch(Mj){}},Wi=!(xi||!ki.XMLHttpRequest)&&"withCredentials"in(Di()||[]),Ri=ki.ActiveXObject?function(e){return wi?Fi():!xi&&Di()||Fi()}:Di,Ni=function(e){return Pi},Oi=/^(?:GET|HEAD)$/,Mi=/^(.*?):[ \t]*([^\r\n]*)\r?$/gm,Li={xml:"application/xml, text/xml",html:"text/html",text:"text/plain",json:"application/json, text/javascript","*":"*/*"},Bi=yi;Ei&&(Bi=Zt.noop);var Ui=function(){function e(){o(this,e),c(this,"url",!1),c(this,"onSuccess",!1),c(this,"onError",!1),c(this,"onComplete",!1),c(this,"method","GET"),c(this,"async",!0),c(this,"xhrFields",!1),c(this,"mimeType",!1),c(this,"username",!1),c(this,"password",!1),c(this,"data",!1),c(this,"dataType","text"),c(this,"headers",!1),c(this,"contentType","application/x-www-form-urlencoded; charset=UTF-8"),c(this,"beforeSend",!1),c(this,"afterSend",!1),c(this,"timeout",0),c(this,"cache",!0),c(this,"crossDomain",!1),c(this,"retry",0)}return s(e,[{key:"setRequestHeader",value:function(e,t){this.headers[e]=t}},{key:"getAllResponseHeaders",value:function(){return 2===this.state?this.responseHeadersString:null}},{key:"getNativeXhr",value:function(){return this.nativeXhr}},{key:"getResponseHeader",value:function(e){var t,r;if(e=e.toLowerCase(),2===this.state){if(!(r=this.responseHeaders))for(r=this.responseHeaders={};t=Mi.exec(this.responseHeadersString);)r[t[1].toLowerCase()]=t[2];t=r[e]}return t===undefined?null:t}},{key:"overrideMimeType",value:function(e){return this.state||(this.mimeType=e),this}},{key:"abort",value:function(e){return this.state=3,this.status=0,this.statusText=null!=e?e:"abort",this.nativeXhr&&this.nativeXhr.abort(),this._callback(),this}},{key:"_ioReady",value:function(e,t){var r=!1,n=this;if(2!==this.state&&3!==this.state){1===this.state&&(this.state=2),this.readyState=4,e>=200&&e<300||304===e?304===e?(t="not modified",r=!0):(t="success",r=!0):e<0&&(e=0);try{e>=200&&this.handleResponseData()}catch(Mj){bi(Mj,"error"),t=Mj.message||"parser error"}return(e<200||!r)&&this.retry>0?(this.retry=this.retry-1,void setTimeout((function(){n.sendInternal()}),200)):(this.status=e,this.statusText=t,this._callback(r),r)}}},{key:"_callback",value:function(e){var t=this,r=this.timeoutTimer;r&&(clearTimeout(r),this.timeoutTimer=0),Ii([e?this.onSuccess:this.onError,this.onComplete],(function(e){Ti(e)&&e.apply(t.context,[t.responseData,t.statusText,t])})),this.responseData=null}},{key:"handleResponseData",value:function(){var e,t=this.dataType,r=this.nativeXhr;if("blob"===t||"arraybuffer"===t)if(wi){var n,i,o;if("responseBody"in r)n=r.responseBody,i=ki.dsVbsBinGetLength(n),e=new ki.VBArray(ki.dsVbsBinGetBytes(n,0,i)).toArray();else for(e=[],i=(n=r.responseText).length,o=0;o<i;++o)e.push(255&n.charCodeAt(o));n=null}else e=ki.Blob?r.response:"responseBody"in r?r.responseBody:r.responseText;else if("json"==t)e=r.responseType&&"json"==r.responseType.toLowerCase()?r.response:r.responseText?Zt.parse(r.responseText):Zt.parse(r.response);else if("user-defined"===t)e=r.response!==undefined?r.response:r.responseText;else{this.responseText=e=r.responseText||"";try{var a=r.responseXML;a&&a.documentElement&&(this.responseXML=a)}catch(Mj){}}this.responseData=e}},{key:"sendInternal",value:function(e){var t,r,n,i,o,a,s,u,c,l,d,f=this;if(r=(t=this._setup(e)).method,Ci(r)&&(r=r.toUpperCase()),o=t.contentType,n=t.url,i=t.dataType,u=t.mimeType,Ci(n)&&(this.nativeXhr=a=Ri(t.crossDomain),a)){try{if(this.state=1,t.username?a.open(r,n,t.async,t.username,t.password):a.open(r,n,t.async),(t.async||de.bIE)&&i&&"user-defined"!=i&&"responseType"in a)try{a.responseType=i}catch(Mj){}}catch(h){return void(this.state<2?(bi(h,"error"),this._ioReady(-1,"open error: "+(Zt.isNumber(h.number)?"("+h.number+")":"")+(h.message||""))):bi(h))}"withCredentials"in(s=t.xhrFields||{})&&(Wi||delete s.withCredentials),Ii(s,(function(e,t){try{a[t]=e}catch(Mj){bi(Mj)}})),u&&a.overrideMimeType&&a.overrideMimeType(u),!1===(c=t.headers||{})["X-Requested-With"]&&delete c["X-Requested-With"],"setRequestHeader"in a&&(o&&a.setRequestHeader("Content-Type",t.contentType),a.setRequestHeader("Accept",i&&Li[i]?Li[i]+("*"===i?"":", */*; q=0.01"):Li["*"]),Ii(c,(function(e,t){a.setRequestHeader(t,e)}))),"GET"!=r||t.cache||(a.setRequestHeader("If-Modified-Since","0"),a.setRequestHeader("Cache-Control","no-cache")),d=(l=!Oi.test(t.method))&&t.data||null,l&&wi&&(d=t.data),t.async&&t.timeout>0&&(t.timeout<300&&(t.timeout=300),this.timeoutTimer=setTimeout((function(){f.abort("timeout")}),t.timeout));try{if(this.state=1,Ti(this.beforeSend))if(!1===this.beforeSend(a,f))return void this.abort("cancel");a.send(d),d=null,t.data=null,Ti(this.afterSend)&&this.afterSend(f)}catch(Mj){this.state<2?(bi(Mj,"error"),this._ioReady(-1,"send error: "+(Mj.message||""))):bi(Mj)}if(!t.async||4===a.readyState)return f._xhrCallback();a.onreadystatechange=function(){f._xhrCallback()}}}},{key:"_xhrCallback",value:function(e,t){var r,n=this.nativeXhr;try{if(4===n.readyState||t)if(Ni()||(n.onreadystatechange=Bi),t)4!==n.readyState&&n.abort();else{Ni()||(this.responseHeadersString=n.getAllResponseHeaders());var i,o=n.status;try{i=n.statusText}catch(Mj){bi("xhr statusText error: "),bi(Mj),i=""}r=this._ioReady(o,i)}}catch(Mj){bi(Mj,"error"),n.onreadystatechange=Bi,t||this._ioReady(-1,Mj.message||"process error")}return r}},{key:"_setup",value:function(t){var r,n,i,o,a;if(t){for(n in this.context=t.context,delete t.context,t instanceof e&&(t=t.config),this.config=t,o=t.url,Zt.startsWith(o,"//")&&(t.url=o="http:"+o),(Zt.startsWith(o,"http://")||Zt.startsWith(o,"https://"))&&(a=new Si(o)),r=t.dataType?t.dataType.toLowerCase():"text",t.dataType=r,t.method?t.method=t.method.toUpperCase():t.method="GET",a&&!("crossDomain"in t)&&(t.crossDomain=!a.isSameOriginAs(Ai)),i=t.headers)i[n]===yi&&delete i[n];Zt.mix(this,t)}return this.state=1,this}},{key:"dispose",value:function(){this.responseHeaders=null,this.responseHeadersString=null,this.responseData=null,this.responseText=null,this.responseXML=null,this.context=null,this.config=null,this.onSuccess=null,this.onError=null,this.onComplete=null,this.xhrFields=null,this.data=null,this.headers=null,this.beforeSend=null,this.afterSend=null}}])}();function Vi(e){if(e&&Ci(e.url)){var t=new Ui;return e.async?(e.async=!0,t.sendInternal(e),t):(e.async=!1,t.sendInternal(e))}Zt.log("the url is error.")}var ji="Please make sure the Dynamsoft Service has been installed.",Gi="Error: This browser is currently not supported.",Hi="Error: Duplicate ContainerId detected while creating a Dynamic Web TWAIN object.",zi="Error: Duplicate WebTwainId detected while creating a Dynamic Web TWAIN object.",Ki="Error: The ID of the target DIV for the new DWT object is invalid.",Ji="18",Qi="5",qi="1",Yi="0828",Xi="5",Zi="1",$i="".concat(Ji,",").concat(Qi,",").concat(qi,",").concat(Yi),eo="".concat(Ji,",").concat(Xi,",").concat(Zi,",").concat("0828"),to=parseInt(Ji),ro=parseInt(Qi),no=parseInt(qi),io=[to,ro,no,Yi],oo=[to,ro,no,Yi],ao=[to,ro,no,Yi],so=[1,8,5,Yi],uo=[1,8,5,Yi],co=[1,8,5,Yi];function lo(){if(de.bWin);else{if(de.bMac)return oo;if(de.bLinux)return ao}return io}function fo(){if(de.bWin);else{if(de.bMac)return uo;if(de.bLinux)return co}return so}function ho(){return"dcp/dwasm2_"+go()}function go(){return lo().join("")}var mo=de.bWin,po=de.bMac,vo=de.bLinux,_o=de.bSafari,yo=de.bFirefox,So=de.bChrome,Io=location.hostname,bo=location.pathname,To=0,Co=de.bMobile,wo=parseFloat(de.strBrowserVersion);if(de.bWin||de.bMac||de.bLinux||de.bChromeOS){if(rr.navInfo){var Eo=rr.navInfo;Co=Co||Eo.bAndroid||Eo.bPad||Eo.biPhone||Eo.biPad}}else Co=!0;""===Io?mo&&bo.lastIndexOf("\\")>1?bo=bo.substring(1,bo.lastIndexOf("\\")).replace(/%20/g," "):(To=1,bo=bo.substring(1,bo.lastIndexOf("/")).replace(/%20/g," ")):(To=1,bo=bo.substring(0,bo.lastIndexOf("/")));var ko={bChrome:So,bFirefox:yo,bSafari:_o,bIE:de.bIE,bEdge:de.bEdge,bWin:mo,bMac:po,bLinux:vo,iPluginLength:0,bFileSystem:de.bFileSystem,bMobile:Co,strIEVersion:de.IEVersion,strChromeVersion:de.bChrome?wo:"",strFirefoxVersion:de.bFirefox?wo:"",basePath:bo,pathType:To,isDesktopViewer:function(){return de.bWin||de.bLinux||de.bChromeOS||de.bMac},isPadViewer:function(){return de.bPad||de.biPad},isMobileViewer:function(){return de.bMobile||de.biPhone||de.bAndroid||de.bHarmonyOS},WSVersion:"18.5.0",WSSession:(new Date).getTime(),bDiscardBlankImage:di};function Ao(e){var t=e||{};t.basePath&&(ko.basePath=t.basePath),t.pathType&&(ko.pathType=t.pathType),Zt.isUndefined(t.bDiscardBlankImage)||(ko.bDiscardBlankImage=t.bDiscardBlankImage),t.msgPrefix&&t.msgPrefix,t.msgSuffix&&t.msgSuffix,t.detectType&&(Qt.detect.detectType=t.detectType),t.tryTimes&&(Qt.detect.tryTimes=t.tryTimes);var r=rr.DWT.RemoteScanConfig;r||(r={sessionTimeout:300,keepAwake:!0},rr.DWT.RemoteScanConfig=r),r.keepAwake===undefined&&(r.keepAwake=!0)}function xo(){return!!Zt.getWakeLock()}function Po(e){return Do.apply(this,arguments)}function Do(){return(Do=n(g().mark((function e(t){var r;return g().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(r=Zt.getWakeLock(),!t){e.next=7;break}if(null!=r){e.next=5;break}return e.next=5,Zt.toggleWakeLock();case 5:e.next=10;break;case 7:if(!r){e.next=10;break}return e.next=10,Zt.toggleWakeLock();case 10:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function Fo(){for(var e,t,r,n=["dynamsoft.webtwain.install.js","dynamsoft.webtwain.viewer.js","dynamsoft.lts.js","dynamsoft.webtwain.viewer.css","dynamsoft.webtwain.css"],i=document.head.childNodes,o=i.length-1;o>=0;o--)if("LINK"==(t=i[o]).tagName?r=t.href:"SCRIPT"==t.tagName&&(r=t.src),r)for(e=0;e<n.length;e++)r.indexOf(n[e])>=0&&t.remove();Qt.detect.cssLoaded=!1}function Wo(e){return Ro.apply(this,arguments)}function Ro(){return(Ro=n(g().mark((function e(t){var r;return g().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:t&&((r=document.createElement("style")).innerHTML=['@import url("',Oo(),"/src/dynamsoft.webtwain.viewer.css",Qt.timestamp,'")'].join(""),t.appendChild(r));case 1:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function No(e,t){var r;for(r=0;r<e.length;r++)if(e[r]==t)return!0;return!1}function Oo(){var t=ia.refResourcesPath||null;if(!t){var r,n,i;if(e.CoreModule&&e.CoreModule.engineResourcePaths)r=e.CoreModule.engineResourcePaths.dwt,n=e.CoreModule.engineResourcePaths.rootDirectory;else null!==(i=window)&&void 0!==i&&null!==(i=i.Dynamsoft)&&void 0!==i&&null!==(i=i.Core)&&void 0!==i&&null!==(i=i.CoreModule)&&void 0!==i&&null!==(i=i.engineResourcePaths)&&void 0!==i&&i.dwt&&(r=window.Dynamsoft.Core.CoreModule.engineResourcePaths.dwt,window.Dynamsoft.Core.CoreModule.engineResourcePaths.rootDirectory&&(n=window.Dynamsoft.Core.CoreModule.engineResourcePaths.rootDirectory));if(r&&(Zt.isString(r)?t=r:Zt.isString(r.resourcesPath)&&(t=r.resourcesPath),Zt.isString(t)))if(Zt.startsWith(t,"https://")||Zt.startsWith(t,"http://"));else if(n&&Zt.isString(n)&&n.length>0){var o="";"/"==n.charAt(n.length-1)||(o="/"),t=[n,o,t].join("")}if(Zt.isString(t)||(t=rr.DWT.ResourcesPath||""),!de.bFileSystem){void 0!==t&&""!=t||(t=ko.basePath||""),t.length>0&&"/"==t.charAt(t.length-1)&&(t=t.substr(0,t.length-1)),ia.refResourcesPath=t}}return t}var Mo=function(e){return e.enumUnknown=-1,e.enumChrome=1,e.enumFirefox=2,e.enumEdge=3,e.enumSafari=4,e.enumIE=5,e.enumOpera=6,e.enumHuaWeiBrowser=7,e}({}),Lo=function(e){return e.enumUnknown=-1,e.enumWindow=0,e.enumMac=1,e.enumLinux=2,e.enumEmbed=3,e.enumChromeOS=4,e.enumHarmonyOS=5,e.enumAndroid=6,e.enumiOS=7,e}({});function Bo(){var t,r,n=ia.refServiceInstallerLocation||null;if(!n){var i;if(e.CoreModule&&e.CoreModule.engineResourcePaths?(t=e.CoreModule.engineResourcePaths.dwt,r=e.CoreModule.engineResourcePaths.rootDirectory):null!==(i=window)&&void 0!==i&&null!==(i=i.Dynamsoft)&&void 0!==i&&null!==(i=i.Core)&&void 0!==i&&null!==(i=i.CoreModule)&&void 0!==i&&null!==(i=i.engineResourcePaths)&&void 0!==i&&i.dwt&&(t=window.Dynamsoft.Core.CoreModule.engineResourcePaths.dwt,window.Dynamsoft.Core.CoreModule.engineResourcePaths.rootDirectory&&(r=window.Dynamsoft.Core.CoreModule.engineResourcePaths.rootDirectory)),t&&(Zt.isString(t)||Zt.isString(t.serviceInstallerLocation)&&(n=t.serviceInstallerLocation),Zt.isString(n)))if(Zt.startsWith(n,"https://")||Zt.startsWith(n,"http://"));else if(r&&Zt.isString(r)&&r.length>0){var o="";"/"==r.charAt(r.length-1)||(o="/"),n=[r,o,n].join("")}if(Zt.isString(n)||(n=rr.DWT.ServiceInstallerLocation||""),Zt.isString(n)&&n.length>0)"/"!=n[n.length-1]&&(n+="/");else{var a=Oo();if(Zt.isString(a)&&a.length>0){var s="";"/"==a.charAt(a.length-1)||(s="/"),n=[a,s,"dist/"].join("")}else n="Resources/dist/"}ia.refServiceInstallerLocation=n}return n}var Uo={getDSPath:function(e){var t=Bo(),r=e;return r||(r=de.bWin?".msi":de.bMac?".pkg":rr.navInfo.bArm64?"-arm64.deb":rr.navInfo.bMips64?"-mips64el.deb":rr.navInfo.bAndroid?".apk":de.bLinux||de.bChromeOS||de.bHarmonyOS?".deb":".msi"),[t,"DynamsoftServiceSetup",r].join("")},getLinuxHTML5DebPath:function(){return Uo.getDSPath(".deb")},getLinuxHTML5RpmPath:function(){return Uo.getDSPath(".rpm")},getEnumPlatform:function(){return de.bAndroid?Lo.enumAndroid:de.bMac?Lo.enumMac:de.bChromeOS?Lo.enumChromeOS:de.bHarmonyOS?Lo.enumHarmonyOS:rr.navInfo.bEmbed?Lo.enumEmbed:de.bLinux?Lo.enumLinux:de.biPhone||de.biPad?Lo.enumiOS:Lo.enumWindow},getEnumBrowser:function(){return de.bEdge?Mo.enumEdge:de.bChrome?Mo.enumChrome:de.bFirefox?Mo.enumFirefox:de.bIE?Mo.enumIE:de.bSafari?Mo.enumSafari:de.bHuaWeiBrowser?Mo.enumHuaWeiBrowser:de.bOpera?Mo.enumOpera:Mo.enumUnknown}},Vo=function(e){return e.NONE=0,e.TRACE=1,e.DEBUG=2,e.INFO=4,e.WARN=8,e.ERROR=16,e}({}),jo=Zt.getLogger(),Go=(S=function(){return s((function e(){o(this,e)}),null,[{key:"LogLevel",get:function(){return this._logLevel},set:function(e){this._logLevel=e}},{key:"LogFunc",set:function(e){this._logFunc=e}},{key:"all",value:function(e,t){if((this._logLevel&e)==e)if(this._logFunc)this._logFunc(t,e);else switch(e){case Vo.DEBUG:jo.debug(t);break;case Vo.ERROR:jo.error(t);break;case Vo.INFO:jo.info(t);break;case Vo.WARN:jo.warn(t);break;case Vo.TRACE:jo.trace(t)}}},{key:"trace",value:function(e){this.all(Vo.TRACE,e)}},{key:"debug",value:function(e){this.all(Vo.DEBUG,e)}},{key:"info",value:function(e){this.all(Vo.INFO,e)}},{key:"warn",value:function(e){this.all(Vo.WARN,e)}},{key:"error",value:function(e){this.all(Vo.ERROR,e)}}])}(),c(S,"_logLevel",Vo.ERROR),c(S,"_logFunc",undefined),S);function Ho(e){var t;window.console&&(e instanceof Error||Zt.isString(e)?(t=e,rr.navInfoSync.bIE&&(t=Zt.stringify(e))):t=Zt.stringify(e),window.console.error(t))}var zo,Ko="127.0.0.1";de.bAndroid&&de.bSSL&&(Ko="local.dynamsoft.com"),zo="0"==Zi.toLowerCase()?"Dynamic Web TWAIN "+[Ji,Xi].join("."):"Dynamic Web TWAIN "+[Ji,Xi,Zi].join(".");var Jo={JSVersion:eo,ServerVersionInfo:$i,ServerLinuxVersionInfo:$i,ServerMacVersionInfo:$i,ServerAndroidVersionInfo:$i,ActiveXVersion:"18,0,0,1025",ActiveXPdfVersion:"11.5.2.0312",PdfVersion:"11.5.2.0312",PdfLinuxVersion:"11.5.2.0312",PdfMacVersion:"11.5.2.0312"},Qo={ProductName:zo,Containers:undefined,ContainerMap:{},WebTwainIdMap:{},RemoteScanIdMap:{},Trial:!1,ResourcesPath:"Resources",Debug:!1,IfUpdateService:!1,AutoLoad:!0,ReConnectToService:!0,OnWebTwainReady:!1,OnWebTwainError:function(e){Ho(e)},OnWebTwainNotFound:!1,OnWebTwainOldPluginNotAllowed:!1,OnWebTwainNeedUpgrade:!1,OnWebTwainNeedUpgradeWebJavascript:!1,OnWebTwainInitMessage:!1,ViewerJSIntegerited:!0,ActiveXInstallWithCAB:!1,IfUseActiveXForIE10Plus:!1,IfUseEmbeddedDownloadNoticeForActiveX:!1,IfCheckDCP:!1,IfDisableDefaultSettings:!1,OnWebTwainWillInit:!1,IfAddMD5InUploadHeader:!1,IfAlwaysFocusOnPopupWindow:!0,IfConfineMaskWithinTheViewer:!1,fetchOptions:{mode:"cors",credentials:"same-origin"},HideTrialMessage:!1,CheckCertExpired:!0,ConnectWithSocket:!1,SSLPort:18623,Port:18622,showLoadingMsgDialog:!0,licenseServer:undefined,sessionPassword:undefined,organizationID:undefined,handshakeCode:undefined,UseDefaultViewer:!0,Host:Ko,DeviceFriendlyName:"",LocalHosts:["127.0.0.1","localhost","local.dynamsoftwebtwain.com","local.dynamsoft.com"],IfCheckCORS:!1,IfCheckCert:!0,IfChromeExtension:!1,IfLoadResources:!0,IfResourcesAddTimestamp:!0,IfCheckCssFiles:!0};function qo(){var e=rr.DWT.Host;return Zt.isString(e)&&""!=e||(rr.DWT.Host=e=Ko),e}function Yo(){var e=300,t=rr.DWT.RemoteScanConfig;return t&&Zt.isNumber(t.sessionTimeout)&&t.sessionTimeout>0&&(e=t.sessionTimeout),e}var Xo={URL:"",UpdateDaysBeforeExpired:30},Zo=!0,$o=!1,ea=de.bHTML5Edition,ta=0,ra=$o;de.bIE&&(""===(ta=de.IEVersion)||ta>=10?rr.DWT.IfUseActiveXForIE10Plus?(ea=$o,ra=Zo,de.bHTML5Edition=ea):ea=Zo:(ea=$o,ta>=9&&(ra=Zo))),ra||ea||(ea=Zo);var na={SSLPort:18626,Port:18625,bEnhancedMode:!1,oldDWASMVerStr:"dwasm_13000404",oldDWASMVer:[13,0,0,"0404"],wsProtocol:"dwt_command",managerVersion:io,managerVersionMac:oo,managerVersionLinux:ao,serviceVersion:so,serviceVersionMac:uo,serviceVersionLinux:co,detect:{dcpStatus:0,ddmPort:0,dwtPort:0,dwtSSLPort:0,bConnected:!1,connectedResult:"",MaxManagerModuleConnectCount:1,EnumDCP_DetectStatus:{Init:0,Connected:1,CheckingManagerVer:15,CheckingServiceVer:16,NotInstalled:17,CheckedService:5,VerifyingZip:6,VerifiedZip:7,UpdatingService:8,UpdateSucceed:9,UpdateFailed:10,UpdateSkipped:11}},strSID:"",b64bit:!0,objEnhancedPorts:{}},ia={name:"Dynamic Web TWAIN",bHTML5Edition:ea,bActiveXEdition:ra,_iImageCaptureDriverType:3,_iBrokerProcessType:1,getChromeEditionPath:Uo.getDSPath,getPKGPath:function(){return Bo()+"DynamicWebTWAINMacEdition.pkg"},getMSIPath:function(){return Bo()+"DynamicWebTWAINPlugIn.msi"},getActiveXCABx86Path:function(){return Bo()+"DynamicWebTWAIN.cab"},getActiveXCABx64Path:function(){return Bo()+"DynamicWebTWAINx64.cab"},onlineResources:"https://demo.dynamsoft.com/DWT/Resources/",strMIMEType:"Application/DynamicWebTwain-Plugin",strFullClassID:"E7DA7F8D-27AB-4EE9-8FC0-3FEC9ECFE758",scripts:{},dwtConfigLoaded:!1,dwtConfigLoading:!1,getServerVersionInfo:function(e){var t=Jo.ServerVersionInfo;return de.bWin||(de.bMac?t=Jo.ServerMacVersionInfo:de.bAndroid?t=Jo.ServerAndroidVersionInfo:(de.bLinux||de.bChromeOS||de.bHarmonyOS)&&(t=Jo.ServerLinuxVersionInfo)),e?t:Zt.replaceAll(t,",","")},getDWTPrefix:function(){return!0===rr.DWT.CustomMode?"dwtc_":"dwt_"},loadResourcePath:!1,loadingResourcePath:!1,handshakeCode:undefined,organizationID:undefined,licenseServer:undefined,sessionPassword:"",bPublicLTS:!0,refProductKey:undefined,ltsDebug:!1,bDWTLoading:!1,bDWTUnloading:!1,bAndroidConnected:!1,unloadQueue:[],appendBrowserLicenseWhenServiceMode:function(){},bDCPChecked:!1,bDWTChecked:!1,bUseDynamsoftLicenseManager:!1,bChromeEdition:ea},oa={bFullEdition:!1,getVersionStrForCheck:function(){return"".concat(Ji,"000000")},versionInfoFromServer:"",hostForCheckCert:Ko,RemoteReconnectMaxTimes:200,RemoteReconnectTimeSpan:5e3,LocalReconnectMaxTimes:60,LocaleReconnectTimeSpan:3e3,HttpConnectTimeout:de.bSSL?3e3:1e3,WebsocketConnectTimeout:de.bSSL?1e3:600};function aa(){return ia.HttpConnectTimeout}function sa(){return ia.WebSocketConnectTimeout}function ua(){return ia.bUseDynamsoftLicenseManager?Zt.isString(ia.refProductKey)&&(Zt.startsWith(ia.refProductKey,"DLS2")||""===ia.refProductKey):Zt.isString(ia.handshakeCode)||Zt.isString(ia.organizationID)||ia.bPublicLTS||Zt.isString(rr.DWT.ProductKey)&&Zt.startsWith(rr.DWT.ProductKey,"DLS2")}function ca(e){if(e===undefined)return!0;var t;if(e)for(t=0;t<rr.DWT.LocalHosts.length;t++)if(e===rr.DWT.LocalHosts[t])return!0;return!1}function la(e){return-1!=e.indexOf("text/json")||-1!=e.indexOf("application/json")}function da(e){return"text/json"===e||"application/json"===e}var fa=function(e){return e.LicenseInvalid=-2325,e.LicenseExpired=-2326,e.LicenseParseFailed=-2546,e.LicenseExpiredForDLS=-2808,e.LicenseNoCoreForDLS=-2809,e.LicenseNoCore=-2810,e.LicenseIsFuture=-2396,e.LicenseVersionNotCurrent=-2539,e}({});function ha(e,t,r){e._errorCode=t,e._errorString=r}function ga(e){var t=rr.DWT.licenseException;t.code=e._errorCode,t.message=e._errorString,t.fromLTS=!1}function ma(){return rr.DWT.IfChromeExtension?"":"Please contact the site administrator."}rr.DWT.EnumDWT_LicenseErrorCode=fa;var pa,va,_a=function(e){return e.UserCancelled=-1032,e.CORSErrorFromService=-2137,e.CommonError=-2201,e.ModuleNotExists=-2371,e.MustUpgrade=-2207,e.RemoteDynamsoftServiceStopped=-2613,e.ResponseDataTypeError=-2801,e.HTSTError=-2817,e.SSLCertExpired=-2818,e.SSLCertInvalid=-2819,e.CORSError=-2820,e.DWTPortNotReady=-2821,e.HTTPRedirected=-2823,e.BboError=-2827,e.HTTPServerError=-2842,e}({});function ya(e){ha(e,-1033,"Invalid index.")}function Sa(e){ha(e,-1034,"Invalid value.")}function Ia(e){ha(e,-1035,"There is no image.")}function ba(e){ha(e,-1110,"Unrecognized file extension.")}function Ta(e){ha(e,-2007,"The system is busy, some operations are not completed. Please try later.")}function Ca(e,t){var r=t?["[",t,"]"].join(""):"your device";ha(e,_a.MustUpgrade,"The Dynamsoft Service installed on "+r+" is outdated and no longer works with the JavaScript code on the website.")}function wa(e){ha(e,-2209,"The HTML5 edition does not support this method or property.")}function Ea(e){ha(e,-2300,"Http upload error: the HTTP Server name/ip cannot be empty.")}function ka(e){ha(e,-2301,"Network error.")}function Aa(e){ha(e,-2302,"The result format is invalid.")}function xa(e,t,r,n){if(t)ps(e);else if(e._errorCode=-2003,n&&n>0||r){var i=["HTTP process error: "];r&&(r.indexOf("HTTP process error: ")>=0&&(i=[""]),i.push(r)),n&&n>0&&(i.push(" ("+n+")"),n>=300&&(e._errorCode=_a.HTTPServerError));var o=i.toString().lastIndexOf(".");o>=0&&o==i.toString().length-1?e._errorString=i.join(""):e._errorString=i.join("")+"."}else e._errorString="HTTP process error."}function Pa(e){ha(e,-2304,"Http download error: the url is invalid.")}function Da(e,t,r,n){if(t)ha(e,-2305,"User cancelled the operation.");else if(e._errorCode=-2003,n&&n>0||r){var i=["HTTP put error: "];r&&(r.indexOf("HTTP put error: ")>=0&&(i=[""]),i.push(r)),n&&n>=300&&(e._errorCode=_a.HTTPServerError);var o=i.toString().lastIndexOf(".");o>=0&&o==i.toString().length-1?e._errorString=i.join(""):e._errorString=i.join("")+"."}else e._errorString="HTTP put error."}function Fa(e,t,r,n){if(t)ha(e,-2305,"User cancelled the operation.");else if(e._errorCode=-2003,n&&n>0||r){var i=["HTTP process error: "];r&&(r.indexOf("HTTP process error: ")>=0&&(i=[""]),i.push(r));var o=i.toString().lastIndexOf(".");o>=0&&o==i.toString().length-1?e._errorString=i.join(""):e._errorString=i.join("")+"."}else e._errorString="HTTP process error."}function Wa(e){ha(e,-2306,"Upload Error: the upload file cannot be empty.")}function Ra(e){ha(e,-2307,"The width or height you entered is invalid.")}function Na(e){ha(e,-2313,"The size of the images you are about to upload has exceeded the limit.")}function Oa(e){ha(e,-2314,"The parameter cannot be empty.")}function Ma(e){ha(e,-2320,"Invalid file.")}function La(e){ha(e,fa.LicenseInvalid,ua()?"The license is invalid.":"The current product key is empty or invalid."),ga(e)}function Ba(e,t){e._errorCode=fa.LicenseExpired;var r="";if(t&&""!=t&&(-1==t.indexOf("on")&&(r=" on "+t),e.__licenseInfo&&(e.__licenseInfo.ExpireDate=t)),ua()){var n,i,o,a;if(n=rr.DWT.lgdt(),e._bRemoteMode)i=null!==(o=null===(a=e._dmService)||void 0===a||null===(a=a.attrs)||void 0===a?void 0:a.UUID)&&void 0!==o?o:"";else i="";e._errorString="The license has expired"+r+". Please contact the application developer.",rr.DWT.lcexp(n,i).then((function(){e._errorString=rr.DWT.licenseException.message}))}else e._errorString="The current product key has expired"+r+". Please contact the application developer.",ga(e)}function Ua(e,t){ua()?111==t?(e._errorCode=fa.LicenseExpiredForDLS,e._errorString="The license for v"+Ji+" Service Core Module has expired."):(e._errorCode=fa.LicenseNoCoreForDLS,e._errorString="The license for v"+Ji+" Service Core Module is not found."):(e._errorCode=fa.LicenseNoCore,e._errorString="The product key for the current operating system is missing the Service Core license. "+ma()),ga(e)}function Va(e){e._errorCode=-2339,ua()?e._errorString="The license for the module pdf rasterizer is not found or has expired.":e._errorString="The current product key does not support pdf rasterizer. "+ma(),ga(e)}function ja(e){ha(e,-2351,"You cannot upload more than one image when the format is BMP, JPG or PNG")}function Ga(e){ha(e,-2352,"The indices are out of range.")}function Ha(e){ha(e,-2353,"The header name being used is a protected keyword and is not allowed.")}function za(e){ha(e,-2358,"The type of the parameter indices must be an Array.")}function Ka(e){ha(e,-2359,"The index is out of range.")}function Ja(e){ha(e,-2360,"The index is null or undefined.")}function Qa(e){ha(e,-2362,"The image type is not supported.")}function qa(e){ha(e,-2363,"The data format is not supported.")}function Ya(e){ha(e,-2365,"The url is invalid.")}function Xa(e){ha(e,-2376,"The generate url failed.")}function Za(e){ha(e,-2377,"Failed to set Image Capture Driver Type.")}function $a(e){ha(e,-2391,"Invalid event name.")}function es(e){ha(e,-2393,"Failed to convert the data to blob.")}function ts(e){ha(e,-2399,"Invalid imageId.")}function rs(e){ha(e,-2416,"Invalid parameter.")}function ns(e){ha(e,-2426,"You have used a full license with a trial license which is not permitted. Please check and update Dynamsoft.DWT.ProductKey.")}function is(e){ha(e,-2510,"The callback is not a function.")}function os(e){ha(e,-2513,"The WebTwain instance has been destroyed and can not be used anymore.")}function as(e){ha(e,-2530,"Document name cannot be empty.")}function ss(e){ha(e,-2531,"Document name is not a string.")}function us(e){ha(e,-2548,"You cannot call this function when Dynamsoft.DWT.UseDefaultViewer is set to false.")}function cs(e){ha(e,-2549,"You cannot call this function when there is no ui binding.")}function ls(e){ha(e,0,"")}function ds(e){var t=e;return t||(t="[]"),{code:-2601,message:"Failed to connect to the Dynamsoft Service on "+t+". Please make sure Dynamsoft Service is running or the certificate is valid."}}function fs(e){var t;return e._bRemoteMode?ds(null===(t=e._dmService)||void 0===t||null===(t=t.attrs)||void 0===t?void 0:t.name).message:"The Dynamsoft Service has been stopped."}function hs(e){ha(e,-2607,"The device selected was not found under the current service object.")}function gs(e){ha(e,-2608,"IfShowFileDialog cannot be set to true when Object is created by CreateRemoteScanObjectAsync.")}function ms(e,t){Zt.isString(t)&&""!=t?ha(e,_a.RemoteDynamsoftServiceStopped,"The Dynamsoft Service on ["+t+"] has been stopped."):ha(e,-2308,"The Dynamsoft Service has been stopped.")}function ps(e){ha(e,-2615,"User cancelled the operation.")}function vs(e){ha(e,-2616,"Invalid image format type.")}function _s(e){ha(e,-2618,"Only single index selection is allowed when enumImageType is set to BMP, JPG or PNG.")}function ys(e){ha(e,-2620,"The RemoteScan object has been disposed.")}function Ss(e){ha(e,-2621,"Dynamsoft.DWT.Containers was not set.")}function Is(e){ha(e,-2622,'Please do not set enumImageType to "IT_MULTIPAGE_PDF", "IT_MULTIPAGE_TIF" or "IT_ALL".')}function bs(e){ha(e,-2624,"The element within Dynamsoft.DWT.Containers should be a valid object.")}function Ts(e){ha(e,-2800,ji)}function Cs(e){ha(e,_a.ResponseDataTypeError,"Invalid response data was returned from the Dynamsoft Service.")}function ws(e){return{code:-2807,message:'Error: The element specified by the id "'+e+"\" doesn't exist."}}function Es(e,t){ha(e,-2811,t)}function ks(e){ha(e,-2812,zi)}function As(e){ha(e,-2815,Hi)}function xs(e,t,r){ha(e,-2816,["HTTP process error: ",r," (",t,")."].join(""))}function Ps(){return{code:_a.HTSTError,message:"The Connection from the insecure (HTTP) web page failed for HTST."}}function Ds(){return{code:_a.DWTPortNotReady,message:"The Dynamsoft Service is not ready, please try again later."}}function Fs(e){return{code:-2826,message:"Failed to connect the Dynamsoft Service on ["+e+"]."}}function Ws(e){ha(e,-2828,"Invalid PDF Convert Mode Value.")}function Rs(e){ha(e,-2848,"The capability value is out of range.")}function Ns(e){ha(e,-2854,"The imageId does not exist.")}function Os(e){ha(e,-2855,"The blob cannot be empty.")}function Ms(e){ha(e,-2857,"Invalid blob value.")}function Ls(e){ha(e,-2901,"Source document does not exist. Please check the document name or create the document before performing this operation.")}function Bs(e){ha(e,-2902,"Target document does not exist. Please check the document name or create the document before performing this operation.")}function Us(e){ha(e,-2906,"After initialization, the product key cannot be changed.")}var Vs=de.bIE&&de.IEVersion<=9;pa=self&&self.fetch?self.fetch:window.fetch;var js=0;function Gs(e,t){var r,n=!1;return js=t,pa?r=function(r,i){var o=!1,a="text",s=!1;if(i&&(i.dataType&&(a=i.dataType),i.fetchRaw&&(s=!0),i.timeout)){var u=i.timeout;u<300&&(u=300);var c=new AbortController;i.signal=c.signal,setTimeout((function(){o||c.abort("timeout")}),u)}n=!1;var l=pa(r,i).then((function(r){if(r.ok){var i,a;if(o=!0,!e)return r;if(e.__clickCancel)return e.__clickCancel=!1,e.__cancelBeforObjectCreated=!1,n=!0,r;e.IfShowCancelDialogWhenImageTransfer?(zs(!0),a=e.on("cancel",(function(){n=!0}))):zs(!1);var s=r.headers.get("Content-Length"),u=0;e._onPercent&&js==t&&e._onPercent({loaded:u,total:s});var c=null==r||null===(i=r.body)||void 0===i?void 0:i.getReader(),l=new ReadableStream({start:function(r){var i=function(){return c.read().then((function(o){if(o.done||n)return n?c.cancel():a&&e.off("cancel",a),r.close(),void(a=null);var l=o.value;u+=l.length,e._onPercent&&js==t&&e._onPercent({loaded:u,total:s});try{return r.enqueue(l),i()}catch(d){Zt.error(d)}}))};c?setTimeout(i,0):r.close()}}),d=r.headers.get("Content-Type");return d&&""!=d||(d="application/octet-stream"),new Response(l,{headers:{"Content-Type":d}})}if("opaqueredirect"==r.type)throw{code:_a.HTTPRedirected,message:"The http url redirected."};var f;throw xs(f={},r.status,r.statusText),{code:f._errorCode,message:f._errorString,httpCode:r.status}}));return s?l:(l="blob"==a?l.then((function(e){var t=e.headers.get("content-type");return da(t)?e.json():de.bLinux?e.arrayBuffer().then((function(e){return new Blob([e],{type:t})})):e.blob()})):"json"==a?l.then((function(e){return e.json()})):"arraybuffer"==a?l.then((function(e){return da(e.headers.get("content-type"))?e.json():e.arrayBuffer()})):l.then((function(e){return e.text()}))).then((function(e){var t;if(n)throw ps(t={}),{code:t._errorCode,message:t._errorString};return e}))}:(Vs&&Zt.addVBS(["Function dsVbsBinGetAt(strBinary,iOffset)\r\n"," dsVbsBinGetAt=AscB(MidB(strBinary,iOffset+1,1))\r\n","End Function\r\n","Function dsVbsBinGetBytes(strBinary,iOffset,iLength)\r\n"," Dim aBytes()\r\n"," ReDim aBytes(iLength-1)\r\n"," For i=0 To iLength-1\r\n"," aBytes(i)=dsVbsBinGetAt(strBinary,iOffset+i)\r\n"," Next\r\n"," dsVbsBinGetBytes=aBytes\r\n","End Function\r\n","Function dsVbsBinGetLength(strBinary)\r\n"," dsVbsBinGetLength=LenB(strBinary)\r\n","End Function"].join("")),r=function(r,n){return new(Qt.nativePromise||window.Promise)((function(i,o){var a,s=!1;a={url:r,async:!0,onSuccess:function(e,t,r){var n=!1;r.responseHeadersString&&(la(r.responseHeadersString)&&(Zt.isArray(e)||e instanceof ArrayBuffer)&&(n=!0));if(n){var o=e;e instanceof ArrayBuffer&&(o=new Uint8Array(e));var a=String.fromCharCode.apply(null,o);i(a)}else i(e)},onError:function(e,t,r){var n;xs(n={},r.status,t),o({code:n._errorCode,message:n._errorString,httpCode:r.status})},dataType:"text",method:va,data:va,headers:va,contentType:va,mimeType:va},n&&(n.method&&(a.method=n.method),n.body&&(a.data=n.body),n.headers&&(a.headers||(a.headers={}),Zt.each(n.headers,(function(e,t){"content-type"==t.toLowerCase()&&(s=!0),a.headers[t]=e}))),n.dataType&&(a.dataType=n.dataType),n.contentType&&(a.contentType=n.contentType),Zt.isNumber(n.timeout)&&n.timeout>0&&(a.timeout=n.timeout)),s&&(a.contentType=!1),"blob"==a.dataType&&Vs&&(a.mimeType="text/plain; charset=x-user-defined"),e&&(e._onPercent&&(a.beforeSend=function(r,n,i){r.upload.addEventListener("progress",(function(r){e._onPercent&&js==t&&e._onPercent(r)}),!1)}),e.IfShowCancelDialogWhenImageTransfer?zs(!0):zs(!1));var u=Vi(a);e&&e.IfShowCancelDialogWhenImageTransfer&&e.on("cancel",(function(){u.abort()}))}))}),r}var Hs=Gs(null,0);function zs(e){var t=Zt.sizzle(".dynamsoft-btnCancel");if(t.length>0){var r=t[0];r.style.display=e?"":"none"}}String.prototype.startsWith||(String.prototype.startsWith=function(e){return 0==this.indexOf(e)});var Ks=function(e){var t,r=e,n=r._license||"",i=JSON.parse(JSON.stringify(r._licenseServer)),o=r._sessionPassword,a=0;if(n.startsWith("t")||n.startsWith("f"))a=0;else if(0===n.length||n.startsWith("P")||n.startsWith("L")||n.startsWith("Y")||n.startsWith("A"))a=1;else{a=2;var s=n.indexOf(":");if(-1!=s&&(n=n.substring(s+1)),n.startsWith("DLS2")){var u;try{var c=n.substring(4);c=Dynamsoft.Lib.atob(c),u=JSON.parse(c)}catch(d){throw new Error("Format Error: The license string you specified is invalid, please check to make sure it is correct.")}if("number"==typeof(n=u.handshakeCode?u.handshakeCode:u.organizationID?u.organizationID:"")&&(n=JSON.stringify(n)),0===i.length){var l=[];u.mainServerURL&&(l[0]=u.mainServerURL),u.standbyServerURL&&(l[1]=u.standbyServerURL),i=function(e){if(null==e)e=[];else{e instanceof Array||(e=[e]);for(var t=0;t<e.length;++t){if(document&&document.createElement){var r=document.createElement("a");r.href=e[t],e[t]=r.href}e[t].lastIndexOf("/")!=e[t].length-1&&(e[t]+="/")}}return e}(l)}!o&&u.sessionPassword&&(o=u.sessionPassword),t=u.remark}n&&"200001"!==n&&!n.startsWith("200001-")||(a=1)}return 1===a&&(n=""),{lt:a,l:n,ls:i,sp:o,rmk:t}},Js=s((function OJ(e,t,r,n,i){o(this,OJ),this.server=e,this.port=t,this.ssl=r,this.useWS=n,this.protocol=i}));function Qs(e,t){return(null==e?void 0:e.port)==(null==t?void 0:t.port)&&(null==e?void 0:e.protocol)==(null==t?void 0:t.protocol)&&(null==e?void 0:e.server)==(null==t?void 0:t.server)&&(null==e?void 0:e.ssl)==(null==t?void 0:t.ssl)&&(null==e?void 0:e.useWS)==(null==t?void 0:t.useWS)}var qs=function(e){return e.OK=0,e.Custom=-1,e.NWB=-4200,e.WS_DISCONN=-4201,e.CB=-5e3,e.JSON_REQUIRED=-5001,e.OBJECT_DISPOSED=-5002,e.INVALID_TASK=-5003,e.OBJECT_DISPOSING=-5004,e}({}),Ys=function(e){return e.WS_DISCONN="The Web Socket connection failed.",e.JSON_REQUIRED="The input is not a JSON object or JSON styled string.",e.OBJECT_DISPOSED="The object has been disposed.",e.INVALID_TASK="The task is invalid.",e.OBJECT_DISPOSING="The object need to be disposed.",e}({}),Xs=function(){return s((function e(){o(this,e)}),null,[{key:"message",value:function(e){return this._errorMessage[e]}},{key:"init",value:function(){this._errorMessage[qs.OK]="Successful.",this._errorMessage[qs.WS_DISCONN]=Ys.WS_DISCONN,this._errorMessage[qs.JSON_REQUIRED]=Ys.JSON_REQUIRED,this._errorMessage[qs.OBJECT_DISPOSED]=Ys.OBJECT_DISPOSED,this._errorMessage[qs.INVALID_TASK]=Ys.INVALID_TASK,this._errorMessage[qs.OBJECT_DISPOSING]=Ys.OBJECT_DISPOSING}}])}();c(Xs,"_errorMessage",Object.create(null)),Xs.init();var Zs=function(){return s((function e(t,r){o(this,e),c(this,"_code",qs.OK),this.name="DSError",this.message=null!=r?r:"string"==typeof t?t:Xs.message(t),this._code="string"==typeof t?qs.Custom:t}),[{key:"code",get:function(){return this._code}}])}();function $s(e){return{code:e._errorCode,message:e._errorString}}function eu(e){return"exception"in e&&"description"in e&&0!=e.exception&&""!=e.description}function tu(e){return-1416==e}var ru=function(e){return e.GET_TASKID=0,e.GET_EVENT_TASKID=1,e.ONMESSAGE_PROCESS_DATA=2,e.ONMESSAGE_GET_TASKID=3,e.ONMESSAGE_GET_EVENT_TASKID=4,e.HANDLE_RAW_MESSAGE=5,e.HANDLE_PROCESSED_MESSAGE=6,e}({}),nu=function(){return s((function i(e){o(this,i),c(this,"_serverInfo",undefined),c(this,"_disposed",!1),this._serverInfo=e,this._ref=1}),[{key:"serverInfo",get:function(){return this._serverInfo}},{key:"requestSync",value:function(e,t){return Go.error("requestSync should be implemented in child class"),undefined}},{key:"request",value:function(e,t,r,n){return Go.error("request should be implemented in child class"),Promise.resolve(null)}},{key:"send",value:(r=n(g().mark((function a(e,t,r){return g().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:Go.error("reqsenduestSync should be implemented in child class");case 1:case"end":return e.stop()}}),a)}))),function(e,t,n){return r.apply(this,arguments)})},{key:"testConnection",value:function(e,t,r,n){return Go.error("testConnection should be implemented in child class"),Promise.resolve(null)}},{key:"disposed",get:function(){return this._disposed}},{key:"dispose",value:(t=n(g().mark((function u(){return g().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(this._ref--,!(this._ref>0)){e.next=3;break}return e.abrupt("return",!1);case 3:return this._disposed=!0,e.next=6,this._terminate();case 6:case"end":return e.stop()}}),u,this)}))),function(){return t.apply(this,arguments)})},{key:"_terminate",value:(e=n(g().mark((function l(){return g().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:case"end":return e.stop()}}),l)}))),function(){return e.apply(this,arguments)})},{key:"addRef",value:function(){this._ref++}}]);var e,t,r}();function iu(e,t){(function(e,t){if(t.has(e))throw new TypeError("Cannot initialize the same private elements twice on an object")})(e,t),t.add(e)}function ou(e,t,r){if("function"==typeof e?e===t:e.has(t))return arguments.length<3?t:r;throw new TypeError("Private element is not present on this object")}var au,su=Zt.getLogger(),uu=new WeakSet,cu=function(e){function t(){var e;o(this,t);for(var r=arguments.length,n=new Array(r),a=0;a<r;a++)n[a]=arguments[a];return iu(e=i(this,t,[].concat(n)),uu),e}return f(t,e),s(t,[{key:"send",value:(r=n(g().mark((function a(e,t,r){return g().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:su.error("HTTP Client send not supported");case 1:case"end":return e.stop()}}),a)}))),function(e,t,n){return r.apply(this,arguments)})},{key:"requestSync",value:function(e,t,r){return undefined}},{key:"request",value:function(e,t,r,n){return ou(uu,this,du).call(this,e,t,r,undefined,undefined,n)}},{key:"testConnection",value:function(e,t,r,n){return ou(uu,this,du).call(this,undefined,undefined,e,t,r,n)}}]);var r}(nu);function lu(e){var t=this.serverInfo,r="";return r=t.ssl?"https://":"http://",r+=t.server,t.port&&(r+=":",r+=t.port),e&&(Zt.startsWith(e,"/")||Zt.endsWith(r,"/")||(r+="/"),Zt.endsWith(e,"/")?r+=e.slice(0,-1):r+=e),r}function du(e,t,r,n,i,o){return fu.apply(this,arguments)}function fu(){return fu=n(g().mark((function e(t,r,n,i,o,a){var s,u;return g().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.prev=0,s=null!=n?n:{},t&&(s.body=t),s.method||(s.method="POST"),a&&(s.timeout=a),u=ou(uu,this,lu).call(this,r),su.debug("HTTP URL: "+u),e.next=9,Hs(u,s);case 9:return e.abrupt("return",e.sent);case 12:if(e.prev=12,e.t0=e["catch"](0),!(e.t0 instanceof Zs||e.t0&&e.t0.code&&e.t0.message)){e.next=18;break}throw e.t0;case 18:if(!e.t0.message){e.next=20;break}throw new Zs(e.t0.message);case 20:case"end":return e.stop()}}),e,this,[[0,12]])}))),fu.apply(this,arguments)}function hu(e){try{return"object"===_(e)?e:(e="string"!=typeof e?Zt.stringify(e):e,Zt.parse(e))}catch(t){throw t instanceof Zs?t:new Zs(qs.JSON_REQUIRED)}}function gu(e){return Math.random().toString(16).substring(2,2+e)}function mu(e,t){(function(e,t){if(t.has(e))throw new TypeError("Cannot initialize the same private elements twice on an object")})(e,t),t.add(e)}function pu(e,t,r){return(t=function(e){var t=function(e,t){if("object"!=_(e)||!e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var n=r.call(e,t||"default");if("object"!=_(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==_(t)?t:t+""}(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function vu(e,t,r){if("function"==typeof e?e===t:e.has(t))return arguments.length<3?t:r;throw new TypeError("Private element is not present on this object")}var _u,yu,Su=Zt.getLogger(),Iu=new WeakSet,bu=function(e){function t(e){var r;return o(this,t),mu(r=i(this,t,[e]),Iu),pu(r,"_defaultRetries",1),pu(r,"_ws",_u),pu(r,"_events",{}),pu(r,"_bHeartBeatStarted",!1),pu(r,"_heartBeatTicks",6e4),r._ws=_u,r.bUseParentWS=!1,r._tasks=Object.create(null),r.bReady=!1,r._blob_callbacks=[],r._processing_blob=!1,r}return f(t,e),s(t,[{key:"ws",get:function(){return this._ws}},{key:"requestSync",value:function(e,t,r){return Su.error("WebSocket Client requestSync not supported"),undefined}},{key:"send",value:(u=n(g().mark((function c(e,t,r){var n,i,o,a;return g().wrap((function(s){for(;;)switch(s.prev=s.next){case 0:if(n=r.client,s.prev=1,(i=r.taskId)!==undefined){s.next=7;break}return s.next=6,t(e,ru.GET_TASKID,n._requestTaskId,r);case 6:i=s.sent;case 7:if(o=n._tasks[i]){s.next=11;break}throw Su.error("invalid task id: "+i),new Zs(qs.INVALID_TASK);case 11:return s.next=13,vu(Iu,n,xu).call(n,!1);case 13:return s.next=15,vu(Iu,n,Du).call(n,e,t,r,o);case 15:Su.debug("begin to send data "+i),n.disposed||n._ws.send(e),e=null,Su.debug("end to send data "+i),s.next=27;break;case 21:s.prev=21,s.t0=s["catch"](1),Su.debug("failed to send data."),Su.error(s.t0),delete n._tasks[i],null===(a=o)||void 0===a||null===(a=a.resolver)||void 0===a||a.reject(s.t0.message);case 27:case"end":return s.stop()}}),c,null,[[1,21]])}))),function(e,t,r){return u.apply(this,arguments)})},{key:"request",value:function(e,t,r,n){var i=this._defaultRetries,o=null!=t?t:vu(Iu,this,ku),a=null!=r?r:{client:this,userData:this};return vu(Iu,this,Wu).call(this,e,o,a,i,!1,undefined,n)}},{key:"connected",get:function(){var e;return(null===(e=this._ws)||void 0===e?void 0:e.readyState)==WebSocket.OPEN}},{key:"testConnection",value:function(e,t,r,n){return vu(Iu,this,xu).call(this,!0,null!=t?t:0,r,n)}},{key:"_terminate",value:(a=n(g().mark((function l(){var e,t;return g().wrap((function(r){for(;;)switch(r.prev=r.next){case 0:for(t in Su.debug("terminate WSClient"),this.fireEvent("disposed"),e=!1,this._tasks)this._tasks[t]!==undefined&&this._tasks[t].resolver&&(e=!0);if(this._lic_callback=_u,this._blob_callbacks=[],this._processing_blob=!1,this._ws&&(this._ws.onopen=null,this._ws.onerror=null,this._ws.onmessage=null,this._ws.onclose=null,this._ws.close()),this._ws=_u,this._tasks=Object.create(null),!e){r.next=12;break}throw new Zs(qs.OBJECT_DISPOSING);case 12:case"end":return r.stop()}}),l,this)}))),function(){return a.apply(this,arguments)})},{key:"setRetry",value:function(e){this._defaultRetries=null!=e?e:1}},{key:"addEvent",value:function(e,t,r){var n=this._events[e];n||(this._events[e]={},n=this._events[e]),Zt.isString(t)&&Zt.isFunction(r)&&(n[t]=r)}},{key:"removeEvent",value:function(e,t){var r=this._events[e];r&&Zt.isString(t)&&delete r[t]}},{key:"clearEvent",value:function(e){this._events[e]&&(this._events[e]={})}},{key:"fireEvent",value:function(e){var t,r=this._events[e];if(r){var n=Object.keys(r);for(t=0;t<n.length;t++)Zt.isFunction(r[n[t]])&&r[n[t]]()}}},{key:"getRequestTaskId",value:function(){return this._requestTaskId?this._requestTaskId:0}}],[{key:"_waitForPreBlob",value:(r=n(g().mark((function d(e){return g().wrap((function(r){for(;;)switch(r.prev=r.next){case 0:if(!e._processing_blob){r.next=3;break}return setTimeout((function(){t._waitForPreBlob(e)}),500),r.abrupt("return");case 3:t._preBlobResolv&&t._preBlobResolv();case 4:case"end":return r.stop()}}),d)}))),function(e){return r.apply(this,arguments)})}]);var r,a,u}(nu);function Tu(e){var t="";return t=e.ssl?"wss://":"ws://",t+=e.server,e.port&&(t+=":",t+=e.port),t}function Cu(e,t,r,n){var i=this;return new Qt.Promise((function(o,a){try{var s,u,c=a,l=o;if(n&&(u=setTimeout((function(){var e=new Zs("createWebSocket timed out.");Su.debug(e.message),c&&(c(e),c=null,l=null),u&&clearTimeout(u),s&&s.close()}),n)),e.bUseParentWS){var d=window,f=parent,h=d.WebSocket;try{for(;d!=f&&f&&f.WebSocket;)h=f.WebSocket,d=f.window,f=f.parent}catch(g){h=window.WebSocket}s=r?new h(t,r):new h(t)}else s=r?new WebSocket(t,r):new WebSocket(t);s.onopen=function(){u&&clearTimeout(u),e._ws=s,l&&(l(s),c=null,l=null)},s.onerror=function(t){s.close(),e.bReady=!1,u&&clearTimeout(u),i.fireEvent("error"),c&&(c(new Zs("websocket error")),c=null,l=null)},s.onmessage=function(t){vu(Iu,e,wu).call(e,e,t.data)},s.onclose=function(t){e.bReady=!1,u&&clearTimeout(u),i.fireEvent("close"),c&&(t&&1006==t.code?c(new Zs("websocket error")):c(t),c=null,l=null)}}catch(m){if(m instanceof Zs||m&&m.code&&m.message)throw m;if(m.message)throw new Zs(m.message)}}))}function wu(e,t){return Eu.apply(this,arguments)}function Eu(){return Eu=n(g().mark((function e(t,r){var n,i,o,a,s,u,c,l,d;return g().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(n=t,e.prev=1,a={client:n,userData:undefined},"object"!==_(r)){e.next=17;break}if(!(n._blob_callbacks.length>0)){e.next=17;break}if(!n._processing_blob){e.next=9;break}return e.next=8,new Qt.Promise((function(e){au._preBlobResolv=e,au._waitForPreBlob(n)}));case 8:au._preBlobResolv=null;case 9:return n._processing_blob=!0,s=n._blob_callbacks.shift(),e.next=13,s(r);case 13:return e.sent,n._processing_blob=!1,e.abrupt("return");case 17:if(!(n.bReady&&Zt.isString(r)&&(r.indexOf("Function not found")>0||r.indexOf("Version not found")>0))){e.next=19;break}return e.abrupt("return");case 19:if(n._cbToGetTaskId){e.next=21;break}return e.abrupt("return");case 21:return e.next=23,n._cbToGetTaskId(r,ru.ONMESSAGE_PROCESS_DATA,n._requestTaskId,a);case 23:return u=e.sent,c=!1,e.next=27,n._cbToGetTaskId(u,ru.ONMESSAGE_GET_TASKID,n._requestTaskId,a);case 27:if(o=e.sent){e.next=36;break}if(!u.Detail||!u.Domain){e.next=32;break}return n._lic_callback&&n._lic_callback(u),e.abrupt("return");case 32:return e.next=34,n._cbToGetTaskId(u,ru.ONMESSAGE_GET_EVENT_TASKID,n._requestTaskId,a);case 34:(o=e.sent)&&(c=!0);case 36:if(i=n._tasks[o]){e.next=46;break}if(!c){e.next=42;break}i={},e.next=44;break;case 42:return""!=o&&Su.log("invalid task id: "+o),e.abrupt("return");case 44:e.next=48;break;case 46:if(!i.timedout){e.next=48;break}return e.abrupt("return");case 48:return e.next=50,n._cbToGetTaskId(r,ru.HANDLE_RAW_MESSAGE,n._requestTaskId,i.ctx);case 50:if((l=e.sent)!==undefined){e.next=55;break}return e.next=54,n._cbToGetTaskId(u,ru.HANDLE_PROCESSED_MESSAGE,n._requestTaskId,i.ctx);case 54:l=e.sent;case 55:l&&!c&&(i.tmid&&clearTimeout(i.tmid),delete n._tasks[o],i.resolver&&i.resolver.resolve(l)),e.next=64;break;case 58:e.prev=58,e.t0=e["catch"](1),Su.debug("failed to handle message."),e.t0 instanceof Error?Su.error(e.t0):Su.error(Zt.stringify(e.t0)),delete n._tasks[o],null===(d=i)||void 0===d||null===(d=d.resolver)||void 0===d||d.reject(e.t0.message);case 64:case"end":return e.stop()}}),e,null,[[1,58]])}))),Eu.apply(this,arguments)}function ku(e,t,r){return Au.apply(this,arguments)}function Au(){return Au=n(g().mark((function e(t,r,n){var i,o;return g().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:e.t0=r,e.next=e.t0===ru.GET_TASKID?3:e.t0===ru.HANDLE_RAW_MESSAGE?7:9;break;case 3:return(o=hu(t)).cmdId=null!==(i=o.cmdId)&&void 0!==i?i:(n=void 0,a=void 0,a=[gu(8),"-",gu(4),"-",gu(4),"-",gu(4),"-",gu(8)],n&&a.unshift(n),a.join("")),Qt.Promise.resolve(["cmdId"]),e.abrupt("break",9);case 7:return Qt.Promise.resolve(t),e.abrupt("break",9);case 9:case"end":return e.stop()}var n,a}),e)}))),Au.apply(this,arguments)}function xu(e,t,r,n){return Pu.apply(this,arguments)}function Pu(){return Pu=n(g().mark((function e(t,r,n,i){var o,a,s,u;return g().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(!this.connected&&!this.disposed){e.next=2;break}return e.abrupt("return");case 2:if(!(s=this)._connectPromise){e.next=7;break}return e.next=6,s._connectPromise;case 6:return e.abrupt("return");case 7:return r=null!==(o=r)&&void 0!==o?o:this._defaultRetries,n=null!==(a=n)&&void 0!==a?a:100,u=vu(Iu,s,Tu).call(s,s.serverInfo),Su.debug("WebSocket URL: "+u+", try to create websocket "+r+"/"+n),s._connectPromise=new Qt.Promise((function(e,t){var o=function(n){vu(Iu,s,Cu).call(s,s,u,s.serverInfo.protocol,i).then((function(t){e(t)}))["catch"]((function(e){Su.debug("create websocket failed: "+e.message),n<r?a(n):t(e)}))};function a(e,t,r){setTimeout((function(){o(++e)}),n)}o(0)})),e.prev=12,e.next=15,s._connectPromise;case 15:e.next=20;break;case 17:throw e.prev=17,e.t0=e["catch"](12),e.t0;case 20:return e.prev=20,s._connectPromise=null,e.finish(20);case 23:case"end":return e.stop()}}),e,this,[[12,17,20,23]])}))),Pu.apply(this,arguments)}function Du(e,t,r,n){return Fu.apply(this,arguments)}function Fu(){return Fu=n(g().mark((function e(t,r,n,i){var o,a,s,u;return g().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(o=this,a=n.eventTaskId,s=n.lastEventTaskId,a!==undefined){e.next=7;break}return e.next=6,r(t,ru.GET_EVENT_TASKID,o._requestTaskId,n);case 6:a=e.sent;case 7:a&&(o._tasks[a]?n&&n.userData&&n.userData.command&&((u=o._tasks[a]).ctx=n,s&&((u=o._tasks[s]).ctx=n)):(u={id:i.id,resolver:null,ctx:n,timedout:!1},o._tasks[a]=u,s&&(o._tasks[s]=u)));case 8:case"end":return e.stop()}}),e,this)}))),Fu.apply(this,arguments)}function Wu(e,t,r,n,i,o,a){return Ru.apply(this,arguments)}function Ru(){return Ru=n(g().mark((function e(t,r,n,i,o,a,s){var u,c,l,d;return g().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return u=this,e.prev=1,n.client=u,e.next=5,vu(Iu,u,xu).call(u,o,i,a,s);case 5:if("0"!=(c=n.taskId)){e.next=12;break}return u.disposed||u._ws.send(t),t=null,e.abrupt("return");case 12:if(c!==undefined){e.next=16;break}return e.next=15,r(t,ru.GET_TASKID,null,n);case 15:c=e.sent;case 16:return c===undefined&&Su.debug("websocket send: task id is invalid."),(l={}).promise=new Qt.Promise((function(e,t){l.resolve=e,l.reject=t})),d={id:c,resolver:l,ctx:n,timedout:!1},u._tasks[c]=d,u._requestTaskId=c,e.next=24,vu(Iu,u,Du).call(u,t,r,n,d);case 24:return u._cbToGetTaskId=r,s&&(d.tmid=setTimeout((function(){Su.debug("ws request time out."),d.timedout=!0,d.resolver.reject("request timed out.")}),s)),u.disposed||u._ws.send(t),Su.debug("end to send task "+c),t=null,e.abrupt("return",l.promise);case 32:if(e.prev=32,e.t0=e["catch"](1),c&&delete u._tasks[c],!(e.t0 instanceof Zs||e.t0&&e.t0.code&&e.t0.message)){e.next=39;break}throw e.t0;case 39:if(!e.t0.message){e.next=41;break}throw new Zs(e.t0.message);case 41:return e.prev=41,t=null,e.finish(41);case 44:case"end":return e.stop()}}),e,this,[[1,32,41,44]])}))),Ru.apply(this,arguments)}function Nu(e,t){(function(e,t){if(t.has(e))throw new TypeError("Cannot initialize the same private elements twice on an object")})(e,t),t.add(e)}function Ou(e,t,r){return(t=function(e){var t=function(e,t){if("object"!=_(e)||!e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var n=r.call(e,t||"default");if("object"!=_(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==_(t)?t:t+""}(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function Mu(e,t,r){if("function"==typeof e?e===t:e.has(t))return arguments.length<3?t:r;throw new TypeError("Private element is not present on this object")}au=bu;var Lu=new WeakSet,Bu=function(){function e(){o(this,e),Nu(this,Lu),Ou(this,"_maxWebSocketCon",10),Ou(this,"_wsClients",[])}return s(e,[{key:"removeTerminatedWSClient",value:function(){this._wsClients=this._wsClients.filter((function(e){return!e.disposed}))}},{key:"getClient",value:function(e,t){return e.useWS?Mu(Lu,this,Vu).call(this,e,t):new cu(e)}},{key:"closeClient",value:(t=n(g().mark((function r(e){var t,n,i,o;return g().wrap((function(r){for(;;)switch(r.prev=r.next){case 0:t=this._wsClients,n=u(t),r.prev=2,n.s();case 4:if((i=n.n()).done){r.next=12;break}if(!Qs((o=i.value).serverInfo,e)){r.next=10;break}if(o.disposed){r.next=10;break}return r.next=10,o.dispose();case 10:r.next=4;break;case 12:r.next=17;break;case 14:r.prev=14,r.t0=r["catch"](2),n.e(r.t0);case 17:return r.prev=17,n.f(),r.finish(17);case 20:this.removeTerminatedWSClient();case 21:case"end":return r.stop()}}),r,this,[[2,14,17,20]])}))),function(e){return t.apply(this,arguments)})},{key:"terminate",value:function(){var e=this._wsClients.slice();this._wsClients=[],e.forEach((function(e){e.dispose()}))}}],[{key:"Instance",get:function(){return this._gClientPool||(this._gClientPool=new e),this._gClientPool}}]);var t}();function Uu(e){this.removeTerminatedWSClient();var t,r=u(this._wsClients);try{for(r.s();!(t=r.n()).done;){var n=t.value;if(Qs(n.serverInfo,e)&&!n.disposed)return n.addRef(),n}}catch(i){r.e(i)}finally{r.f()}return null}function Vu(e,t){var r;return t||(r=Mu(Lu,this,Uu).call(this,e)),r||(this._wsClients.length<this._maxWebSocketCon?((r=new bu(e)).addEvent("disposed","1",(function(){yu.Instance.removeTerminatedWSClient()})),this._wsClients.push(r),r):null)}yu=Bu,Ou(Bu,"_gClientPool",null);var ju=function(){function e(){o(this,e)}return s(e,null,[{key:"getHttpClientForDcp",value:function(t,r){var n,i=rr.dcp,o=Qt.detect.ssl;if(r||!de.bSSL?(n=i.Port,o=!1):(n=i.SSLPort,o=!0),Zt.isString(t)){var a=new Js;return Zt.startsWith(t,"https://")?(a.ssl=!0,a.server=t.substring(8)):Zt.startsWith(t,"http://")?(a.ssl=!1,a.server=t.substring(7)):(a.ssl=Qt.detect.ssl,a.server=t),Bu.Instance.getClient(a)}return e.getHttpClient(null,n,o)}},{key:"getHttpClient",value:function(e,t,r){var n=r?"https":"http",i=new Js(e||qo(),t,r,!1,n);return Bu.Instance.getClient(i)}},{key:"getWsClient",value:function(e,t,r,n){var i=new Js(e||qo(),t,r,!0,na.wsProtocol);return Bu.Instance.getClient(i,n)}},{key:"closeWsClient",value:function(e,t,r){var n=new Js(e||qo(),t,r,!0,na.wsProtocol);return Bu.Instance.closeClient(n)}}])}();Qt.ClientPool=Bu;var Gu=parseInt(Ji),Hu=parseInt(Qi),zu=parseInt(qi),Ku="ddm/",Ju="ddm_"+[Gu,Hu,zu,Yi].join("");function Qu(){return Ku+Ju}function qu(e){return Yu.apply(this,arguments)}function Yu(){return(Yu=n(g().mark((function e(t){var r,n,i,o;return g().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return r=aa(),n=[Qu(),"/VersionInfo?","ts=",Zt.now()].join(""),i=['{"id":"',Zt.guid(),'","method":"VersionInfo"}'].join(""),o=ju.getHttpClientForDcp(t),e.abrupt("return",o.request(i,n,{dataType:"json"},r));case 4:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function Xu(e){Zt.log(e)}var Zu="All scripts and css loaded.",$u="Getting the WebTwain port...",ec="The WebTwain version not compatible.",tc="Decoding the license...",rc="Checking the license...",nc=function(e){return e.CM_RENDERALL=1,e.CM_IMAGEONLY=2,e.CM_AUTO=3,e.CM_RENDERALLWITHANNOTATION=4,e}({});function ic(e,t){(function(e,t){if(t.has(e))throw new TypeError("Cannot initialize the same private elements twice on an object")})(e,t),t.add(e)}function oc(e,t,r){return(t=function(e){var t=function(e,t){if("object"!=_(e)||!e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var n=r.call(e,t||"default");if("object"!=_(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==_(t)?t:t+""}(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function ac(e,t,r){if("function"==typeof e?e===t:e.has(t))return arguments.length<3?t:r;throw new TypeError("Private element is not present on this object")}var sc=Ji+".",uc=parseInt(Ji),cc=0,lc=1,dc=2,fc=3,hc=4,gc=7,mc=8,pc=9,vc=10,_c=50,yc=51,Sc=52;function Ic(e){return Zt.isString(e)?Zt.trim(e):e}var bc=new WeakSet,Tc=function(){return s((function r(){o(this,r),ic(this,bc),oc(this,"isLTS",ua)}),[{key:"isLongKey",value:function(e){if(Zt.isString(e)&&e.length>0){var t=e.charAt(0);if("f"==t||"t"==t)return!0;if(Zt.startsWith(e,"DLS"))return!1;if(Zt.isNumber(e))return!1;var r=parseInt(e)+"-";return!Zt.startsWith(e,r)}return!1}},{key:"isLicenseMixed",value:function(e,t){var r,n=!1,i=e||rr.DWT.ProductKey;(rr.DWT.lclex(),t)&&((Ic(rr.DWT.organizationID)||Ic(rr.DWT.handshakeCode))&&i&&(n=!0,ha(r={},-2444,"A license can only be specified once and has already been set using the ProductKey API.")));if(!n&&Zt.isString(i))if(i=Zt.trim(i),Zt.startsWith(i,"f")||Zt.startsWith(i,"t"));else if(""==i);else if(Zt.startsWith(i,"DLS2"))try{ac(bc,this,wc).call(this,i)}catch(a){n=!0,ha(r={},-2440,""),r._errorString=a.message}else{ac(bc,this,Cc).call(this,i).LTS||(n=!0,function(e){ha(e,fa.LicenseParseFailed,"The license is invalid.")}(r={}))}if(n&&r){ga(r);var o=rr.DWT.licenseException;Zt.error(o.message)}return n}},{key:"getLicenseFromDynamsoftCore",value:function(){var t,r,n=null;if(e.mapPackageRegister&&e.mapPackageRegister.license)n=null===(r=e.mapPackageRegister.license.LicenseManager)||void 0===r?void 0:r.license;else if(null!==(t=window)&&void 0!==t&&null!==(t=t.Dynamsoft)&&void 0!==t&&null!==(t=t.Core)&&void 0!==t&&null!==(t=t.mapPackageRegister)&&void 0!==t&&t.license){var i;n=null===(i=window.Dynamsoft.Core.mapPackageRegister.license.LicenseManager)||void 0===i?void 0:i.license}if(null!==n){if(""===n)return"";if(Zt.isString(n))return n=Zt.trim(n)}return null}},{key:"_initAR",value:function(e){var t,r;e&&(e.pk||(t=e.ar,r=e.u,t&&r&&(ia.bUseDynamsoftLicenseManager=!0,rr.DWT.lsdt(rr.DWT.EnumInstance.dwt_browser),rr.DWT.lsmid(r,""),rr.DWT.lsar(t,""))))}},{key:"preParseProductKey",value:(t=n(g().mark((function i(t){var r,n,o,a;return g().wrap((function(i){for(;;)switch(i.prev=i.next){case 0:if(r=null,n=!1,r=this.getLicenseFromDynamsoftCore(),!Zt.isString(r)){i.next=32;break}if(""===r||!this.isLongKey(r)){i.next=8;break}return this.isLicenseMixed(r,!1)||(this._innerResetLicense(),ia.bPublicLTS=!1,ia.refProductKey=r),i.abrupt("return");case 8:if(!e.mapPackageRegister||!e.mapPackageRegister.license){i.next=14;break}return i.next=11,e.mapPackageRegister.license.getAR();case 11:a=i.sent,i.next=18;break;case 14:if(null===(o=window)||void 0===o||null===(o=o.Dynamsoft)||void 0===o||null===(o=o.Core)||void 0===o||null===(o=o.mapPackageRegister)||void 0===o||!o.license){i.next=18;break}return i.next=17,window.Dynamsoft.Core.mapPackageRegister.license.getAR();case 17:a=i.sent;case 18:if(!a){i.next=32;break}if(this._initAR(a),""!==r){i.next=26;break}return this._innerResetLicense(),ia.refProductKey="",ia.bPublicLTS=!0,ia.handshakeCode="200001",i.abrupt("return");case 26:if(!a.pk){i.next=31;break}return this.isLicenseMixed(a.pk,!1)||(this._innerResetLicense(),ia.bPublicLTS=!1,ia.refProductKey=a.pk),i.abrupt("return");case 31:ia.refProductKey!==r&&(n=!0);case 32:!n&&this.isLicenseMixed(null,!0)||this.reparseProductKey(t);case 33:case"end":return i.stop()}}),i,this)}))),function(e){return t.apply(this,arguments)})},{key:"reparseProductKey",value:function(e){e&&Xu("Parsing Product Key...");var t=this.getLicenseFromDynamsoftCore(),r=!1;if(null===t||""===t){var n=Ic(rr.DWT.organizationID),i=Ic(rr.DWT.handshakeCode),o=n||i;if(t=Zt.trim(rr.DWT.ProductKey),!o){var a=ac(bc,this,Cc).call(this,t);a.LTS&&(i=Ic(a.handshakeCode),o=(n=Ic(a.organizationID))||i)}if(o)return this._innerResetLicense(),Zt.isNumber(t)&&(n=t),ia.handshakeCode=i,ia.organizationID=n,ia.licenseServer=rr.DWT.licenseServer,ia.sessionPassword=rr.DWT.sessionPassword,void(ia.bPublicLTS=ac(bc,this,Ec).call(this,ia.licenseServer,o))}if(ia.refProductKey!==t&&(this._innerResetLicense(),Zt.isString(t)&&t.length>0&&(ia.refProductKey=t,r=!0)),r)if(this.isLongKey(ia.refProductKey))ia.bPublicLTS=!1;else{var s,u={_pLoad:{isEmpty:fi},_license:ia.refProductKey,_licenseServer:[]};try{s=Ks(u)}catch(l){Zt.error(l),s=!1}if(s&&Zt.isString(s.l)){var c=Zt.trim(s.l);""==c?(c="200001",ia.organizationID=c,ia.handshakeCode=c):(-1!=c.indexOf("-")||(ia.organizationID=c),ia.handshakeCode=c),Zt.isArray(s.ls)&&s.ls.length>0&&(ia.licenseServer=s.ls),ia.bPublicLTS=ac(bc,this,Ec).call(this,ia.licenseServer,c),ia.sessionPassword=s.sp}else ia.bPublicLTS=!1,s&&Zt.isNumber(s.l)&&(ia.handshakeCode=""+s.l)}}},{key:"_innerResetLicense",value:function(){ia.refProductKey="",ia.handshakeCode=undefined,ia.organizationID=undefined,ia.licenseServer=undefined,ia.sessionPassword="",ia.bPublicLTS=!0}},{key:"checkOSForAllowCore",value:function(e,t,r){if(ia.bHTML5Edition){if(e)return ac(bc,this,Fc).call(this,t);var n=r._bRemoteMode,i=r.__serverPlatform;return this.isOSOK(t,n,i)}return fi}},{key:"checkLocalPlatformForRemoteService",value:function(e){var t,r,n,i=e.__licenseInfo,o=Uo.getEnumPlatform(),a=!1;for(t=0;t<i.Detail.length;t++)if(r=i.Detail[t],(n=ac(bc,this,Pc).call(this,r.EnumLicenseType,r.LicenseType)).Core&&Zt.isString(r.Version)&&0==r.Version.indexOf(sc)){if(a=ac(bc,this,Fc).call(this,r.OS))break;if(a=this.isOSOK(r.OS,true,o))break;if(!e._blts&&e._bScanForProxyRemote&&n.RemoteScan)break}return a||(o==Lo.enumWindow?function(e){ha(e,-2344,"The current product key does not support Windows OS. "+ma()),ga(e)}(e):o==Lo.enumLinux?function(e){ha(e,-2346,"The current product key does not support Linux OS. "+ma()),ga(e)}(e):o==Lo.enumMac?function(e){ha(e,-2345,"The current product key does not support MAC OS. "+ma()),ga(e)}(e):function(e){ha(e,-2347,"The current product key does not support your OS. "+ma()),ga(e)}(e)),a}},{key:"checkProductKey",value:function(e,t,r){var n,i=rr.DWT.licenseException;return!t.Camera&&(e.__licenseInfo||(e.__licenseInfo={}),(n=ac(bc,this,Ac).call(this,e,e.__licenseInfo,di,t,r))||(i.code=e._errorCode,i.message=e._getErrorString(),i.fromLTS=!1),n)}},{key:"isBindDomainOK",value:function(e){if(Zt.isUndefined(e)||null==e||""==e||"*"==e||"*.*"==e)return fi;var t=location.hostname,r=di;if(""==t)return fi;for(var n=t.toLowerCase().split("."),i=n.length,o=e.toLowerCase().split(";"),a=0;a<o.length;a++){var s=o[a];if("*.*"==s){r=fi;break}var u=s.split("."),c=u.length;if(c>0&&c-1<=i){for(var l=fi,d=c-1;d>0;d--){if(u[d].indexOf("*")>-1){r=fi;break}if(d+i-c>=0){if(n[d+i-c]!=u[d]){l=di;break}}else if("*"!=u[d]){l=di;break}}if(l&&("*"==u[0]||i>=c&&n[i-c]==u[0])){r=fi;break}}}return r}},{key:"isExpiredOrFuture",value:function(e,t){if(""==e)return di;if(!t){var r=e.length;if(r>2&&"/"==e[r-2]&&"0"==e[r-1])return di}var n=Lc(e),i=(new Date).getTime(),o=i+5184e6;return n.getTime()<i||t&&n.getTime()>o?fi:di}},{key:"willTrialExpire",value:function(e){if(""==e)return di;var t=Lc(e),r=(new Date).getTime();return t.getTime()<r+432e6&&t.getTime()>r?fi:di}},{key:"isOSOK",value:function(e,t,r){var n=!1,i=!1,o=!1,a=!1,s=!1,u=!1,c=!1,l=!1;return""==e||"0"==e?fi:(t?r==Lo.enumWindow?o=!0:r==Lo.enumLinux?i=!0:r==Lo.enumMac?n=!0:r==Lo.enumEmbed?s=!0:r==Lo.enumChromeOS?u=!0:r==Lo.enumAndroid?c=!0:r==Lo.enumHarmonyOS?l=!0:r==Lo.enumiOS&&(a=!0):(n=de.bMac,i=de.bLinux,o=de.bWin,a=de.biPhone||de.biPad,u=de.bChromeOS,s=rr.navInfo.bEmbed,c=de.bAndroid,l=de.bHarmonyOS),(e=e.toLowerCase()).indexOf("windows")>-1&&o||e.indexOf("mac")>-1&&n||e.indexOf("linux")>-1&&(i||u||l)||e.indexOf("android")>-1&&c||e.indexOf("ios")>-1&&a||e.indexOf("embed")>-1&&s?fi:di)}},{key:"isBrowserOK",value:function(e){if(Zt.isString(e)){if(""==e||"0"==e)return fi;var t=(e=e.toLowerCase()).split(";"),r=di;return Zt.each(t,(function(e){("chrome"==Zt.trim(e)&&(de.bChrome||de.bSafari||de.bOpera||de.bEdge)||"ie"==Zt.trim(e)&&de.bIE||"firefox"==Zt.trim(e)&&de.bFirefox)&&(r=fi)})),r}return di}},{key:"isAllowLicenseType",value:function(e,t){return t.Core?e.Core:t.PDFRasterizer?e.PDFRasterizer:t.Webcam||t.Camera?e.Webcam:t.barcode1D?e.barcode1D:t.QR?e.QR:t.PDF417?e.PDF417:t.DataMatrix?e.DataMatrix:t.OCR?e.OCR:t.OCRPro?e.OCRPro:e.Core}},{key:"setNoAllowedLicenseTypeError",value:function(e,t,r){r.Core?Ua(e):r.Webcam||r.Camera?t||r.Camera?function(e){e._errorCode=-2431,ua()?e._errorString="The license for the Camera Addon is not found or has expired.":ha(e,-2431,"The current product key does not support Camera Addon. "+ma()),ga(e)}(e):function(e){e._errorCode=-2338,ua()?e._errorString="The license for the module direct show is not found or has expired.":e._errorString="The current product key does not support Webcam. "+ma(),ga(e)}(e):r.PDFRasterizer?t?function(e){e._errorCode=-2370,ua()?e._errorString="The license for the module pdf rasterizer is not found or has expired.":e._errorString="The current product key does not support Pdf Rasterizer Wasm. "+ma(),ga(e)}(e):Va(e):r.OCR?function(e){e._errorCode=-2340,ua()?e._errorString="The license for the module ocr is not found or has expired.":e._errorString="The current product key does not support OCR. "+ma(),ga(e)}(e):r.OCRPro?function(e){e._errorCode=-2341,ua()?e._errorString="The license for the module ocr pro is not found or has expired.":e._errorString="The current product key does not support OCR pro. "+ma(),ga(e)}(e):La(e)}},{key:"getLicenseDateString",value:function(e){var t,r=e.getFullYear();return[(t=e.getMonth()+1)>=10?""+t:"0"+t,"/",e.getDate()>=10?""+e.getDate():"0"+e.getDate(),"/",r].join("")}},{key:"hasPDFRProductKey",value:function(e){return!!this.checkProductKey(e,{PDFRasterizer:!0},!0)||(e._resetErr(),!1)}},{key:"checkPDFProductKeyWhenNeeds",value:function(e,t){var r;if((t==rr.DWT.EnumDWT_ImageType.IT_PDF||t==rr.DWT.EnumDWT_ImageType.IT_MULTIPAGE_PDF)&&(ia.bHTML5Edition?e.__addon&&e.__addon.PDF&&(r=e._getConvertMode()):e.Addon&&e.Addon.PDF&&(r=e._getConvertMode()),r==nc.CM_RENDERALL||r==nc.CM_RENDERALLWITHANNOTATION))return this.checkProductKey(e,{PDFRasterizer:!0},!0);return fi}},{key:"getPublicLicenseContent",value:function(e){var t=[],r=e;if(!Zt.isString(r)){if(Zt.isUndefined(r))return"";r=r instanceof Error||"message"in r?r.message:""+r}var n=r.indexOf("["),i=r.indexOf("]",n),o=r.indexOf("(",i),a=r.indexOf(")",o);if(-1==n||-1==i||-1==o||-1==a)return r;n>0&&t.push(r.substring(0,n));var s=r.substring(n+1,i),u=r.substring(o+1,a);return t.push(['<a href="',u,'" target="_blank" class="dynamsoft-major-color">',s,"</a>"].join("")),t.push(r.substring(a+1)),t.join("")}},{key:"getLTSLicense",value:function(){return ia.bPublicLTS?"":ia.handshakeCode||ia.organizationID}}]);var t}();function Cc(e){var t,r,n=e,i=e.indexOf("-"),o=-1!=i;return r={},o&&(n=e.substring(0,i)),t=Number(n),isNaN(t)||String(Number(t))!==n||(o?r.handshakeCode=e:r.organizationID=e,r.LTS=fi),r}function wc(e){Ks({_pLoad:{isEmpty:fi},_license:e,_licenseServer:[]})}function Ec(e,t){var r=!0;if(Zt.isArray(e)&&e.length>0){var n=e[0];if(Zt.isString(n)&&""!=n)"mlts.dynamsoft.com"!==new Si(n).getHostname()&&(r=!1)}return r&&(!t||"200001"===t||Zt.startsWith(t,"200001-"))}function kc(e,t,r){return this.checkOSForAllowCore(e,t,r)}function Ac(e,t,r,n,i){var o,a=!1;if(ia.bHTML5Edition&&Zt.isFunction(e._needCheckProxyRemoteScanLicense)&&(a=e._needCheckProxyRemoteScanLicense()),t&&t.LTS){if(!t||!Zt.isArray(t.Detail)||0==t.Detail.length)return this.isLTS()?Ua(e):La(e),di}else if(!t||!Zt.isArray(t.Detail)||0==t.Detail.length)return this.isLTS()?Ua(e):La(e),di;var s,u,c,l,d=0,f=0,h=[],g=[],m=di,p=di,v=di,_=di,y=di;if(!this.isBindDomainOK(t.Domain))return function(e){ha(e,-2342,"The domain of your current site does not match the domain bound in the current product key. "+ma()),ga(e)}(e),di;for(t.Detail.length>0&&(o="FALSE"!=(c=t.Detail[0]).Trial),u=1;u<t.Detail.length;u++)if("FALSE"==(c=t.Detail[u]).Trial&&o||"TRUE"==c.Trial&&!o)return ns(e),di;if(t.bTrial=o,n.Core||n.Webcam){var S=[],I=!1;for(u=0;u<t.Detail.length;u++)if(c=t.Detail[u],l=ac(bc,this,Pc).call(this,c.EnumLicenseType,c.LicenseType),n.Core&&l.Core&&this.checkOSForAllowCore(r,c.OS,e)||n.Core&&l.Core&&ia.bActiveXEdition&&l.ActiveX||n.Webcam&&l.Webcam&&!r){if(t.LTS);else if(!Zt.isString(c.Version)||0!=c.Version.indexOf(sc)){S.push(c);continue}if(ia.bHTML5Edition){if(l.ActiveX&&!l.Html5)continue;if(a&&!l.RemoteScan)continue;g.push(c)}else{if(!l.ActiveX&&l.Html5)continue;g.push(c)}I=!0}if(!I&&S.length>0)return S.splice(0),function(e,t){var r=ma();ha(e,fa.LicenseVersionNotCurrent,"The current product key is not for version ".concat(t,". ").concat(r)),ga(e)}(e,"0"==qi.toString()?[Ji,Qi].join("."):[Ji,Qi,qi].join(".")),!1;S.splice(0)}else g=t.Detail;for(u=0;u<g.length;u++){var b=fi;if(c=g[u],l=ac(bc,this,Pc).call(this,c.EnumLicenseType,c.LicenseType),n.Core&&l.Core||this.isAllowLicenseType(l,n)){s=c.ExpireDate.replace(/-/g,"/");var T="FALSE"!=c.Trial;if(this.isExpiredOrFuture(s,T))h.push(s);else if(T&&l.Core&&this.willTrialExpire(s)&&(t.ExpireDate=s),t.LTS||l.Core&&ia.bHTML5Edition&&parseInt(c.Version)>=uc||l.Core&&ia.bActiveXEdition||!l.Core){var C=!1;if(l.Core)(this.checkOSForAllowCore(r,c.OS,e)||ia.bActiveXEdition&&l.ActiveX)&&(C=!0);else{var w=r;n.Camera&&(w=!0),ac(bc,this,kc).call(this,w,c.OS,e)&&(C=!0)}C?this.isBrowserOK(c.Browser)||i?(d++,b=di):p=fi:n.Core?m=fi:n.PDFRasterizer?_=fi:(n.Webcam||n.Camera)&&(y=fi)}else v=fi;b&&f++}}if(d>0)return fi;if(0==f)return this.setNoAllowedLicenseTypeError(e,r,n),di;if(h.length>0){var E,k=0,A=1e20,x="",P=(new Date).getTime();for(s="",u=0;u<h.length;u++)(E=Lc(h[u])).getTime()<P&&E.getTime()>k?(k=E.getTime(),s=h[u]):E.getTime()>P&&E.getTime()<A&&(A=E.getTime(),x=h[u]);return""!=s?(E=Lc(s),Ba(e,s=this.getLicenseDateString(E))):""!=x?(E=Lc(x),x=this.getLicenseDateString(E),function(e){ha(e,fa.LicenseIsFuture,"The current product key is invalid. "+ma()),ga(e)}(e)):Ba(e,""),di}return v?(function(e){ha(e,-2348,"The current product key is invalid because it's generated with the licenses of a different major version."),ga(e)}(e),di):p?(de.bEdge?function(e){ha(e,-2330,"The current product key does not support Edge. "+ma()),ga(e)}(e):de.bChrome?function(e){ha(e,-2327,"The current product key does not support Chrome. "+ma()),ga(e)}(e):de.bFirefox?function(e){ha(e,-2328,"The current product key does not support Firefox. "+ma()),ga(e)}(e):de.bIE?function(e){ha(e,-2329,"The current product key does not support IE. "+ma()),ga(e)}(e):de.bSafari?function(e){ha(e,-2392,"The current product key does not support Safari. "+ma()),ga(e)}(e):function(e){ha(e,-2343,"The current product key does not support your browser. "+ma()),ga(e)}(e),di):m?(this.setNoAllowedLicenseTypeError(e,r,{Core:!0}),di):_?(this.setNoAllowedLicenseTypeError(e,r,{PDFRasterizer:!0}),di):y?(this.setNoAllowedLicenseTypeError(e,r,{Webcam:!0}),di):(La(e),di)}function xc(e){var t=di,r=di,n=di,i=di,o=di,a=di,s=di,u=di,c=di;return Zt.isString(e)&&""!=e&&Zt.each(e.split(";"),(function(e){var l=1*e;l==dc||l==fc||l==cc||l==lc?t=fi:l==hc?r=fi:l==_c?n=fi:l==yc?i=fi:l==Sc?o=fi:l==gc?a=fi:l==mc?s=fi:l==pc?u=fi:l==vc&&(c=fi)})),{Core:t,PDFRasterizer:u,Webcam:s,barcode1D:r,QR:n,PDF417:i,DataMatrix:o,OCR:a,OCRPro:c}}function Pc(e,t){var r=ac(bc,this,xc).call(this,e),n=ac(bc,this,Dc).call(this,t);return Zt.each(["Core","Html5","RemoteScan","LocalScan","ActiveX","PDFRasterizer","Webcam","barcode1D","QR","PDF417","DataMatrix","OCR","OCRPro"],(function(e){r[e]=r[e]||n[e]})),r}function Dc(e){var t=di,r=di,n=di,i=di,o=di,a=di,s=di,u=di,c=di,l=di,d=di,f=di,h=di;return e&&""!=e&&((e=e.toLowerCase()).indexOf("html5")>-1||"win=(aph) or mac=(ph) or linux(h)"==e?(t=fi,e.indexOf("html5;activex;oldie")>-1?i=fi:e.indexOf("html5;activex")>-1?(r=fi,h=fi,i=fi):(r=fi,h=fi),e.indexOf(";remotescan")>-1&&(r=fi,f=fi,e.indexOf(";onlyremote")>-1&&(h=di))):"1d barcode reader"==e?n=fi:"2d barcode reader(qrcode)"==e?o=fi:"2d barcode reader(pdf417)"==e?a=fi:"2d barcode reader(data matrix)"==e?s=fi:"ocr"==e?u=fi:"webcam"==e?c=fi:"pdf rasterizer"==e?l=fi:"proocr"==e&&(d=fi)),{Core:t,Html5:r,RemoteScan:f,LocalScan:h,ActiveX:i,PDFRasterizer:l,Webcam:c,barcode1D:n,QR:o,PDF417:a,DataMatrix:s,OCR:u,OCRPro:d}}function Fc(e){var t=e.toLowerCase();return t.indexOf("wasm")>-1||t.indexOf("mobile")>-1}var Wc=new Tc;function Rc(e,t){return Nc.apply(this,arguments)}function Nc(){return(Nc=n(g().mark((function e(t,r){var n;return g().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(ua()){e.next=2;break}return e.abrupt("return");case 2:if(e.prev=2,rr.DWT.li({instanceMode:rr.DWT.lgdt()},"")){e.next=17;break}return r&&Xu("Getting Machine ID."),e.prev=6,e.next=9,qu();case 9:return n=e.sent,e.next=12,Oc(n);case 12:e.next=17;break;case 14:e.prev=14,e.t0=e["catch"](6),Zt.log(e.t0);case 17:e.next=22;break;case 19:e.prev=19,e.t1=e["catch"](2),Zt.log(e.t1);case 22:case"end":return e.stop()}}),e,null,[[2,19],[6,14]])})))).apply(this,arguments)}function Oc(e){return Mc.apply(this,arguments)}function Mc(){return(Mc=n(g().mark((function e(t){var r;return g().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(!t){e.next=7;break}if(!(Zt.isArray(t.result)&&t.result.length>3)){e.next=5;break}r=t.result[3],e.next=7;break;case 5:if(!t.description){e.next=7;break}return e.abrupt("return",{code:t.exception,message:t.description});case 7:Zt.isString(r)&&""!=r&&(rr.DWT.lsmid(r,""),rr.DWT.lsmid2b(r));case 8:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function Lc(e){var t,r=e;return r=r.replace(/-/g,"/"),t=Date.parse(r),isNaN(t)&&(t=0),(t=new Date(t)).setHours(23,59,59,999),t}function Bc(e){if(""==e)return 65536;var t=Lc(e),r=(new Date).getTime(),n=(t.getTime()-r)/864e5;return t.getTime()<r?0:Math.ceil(n)}rr.DWT.isPublicLicense=function(){return ia.bPublicLTS};var Uc,Vc=function(){return s((function e(){o(this,e),c(this,"_exec",{})}),[{key:"fire",value:function(e,t){var r,n=this;e=e.toLowerCase(),r=Array.prototype.slice.call(arguments,1),Zt.each(n._exec[e]||[],(function(e){var t=e.f,i=e.c||n;try{t.apply(i,r)}catch(Mj){Zt.error(Mj)}}))}},{key:"on",value:function(e,t,r){e=e.toLowerCase(),this._exec[e]=this._exec[e]||[],this._exec[e].push({f:t,c:r})}},{key:"off",value:function(e,t,r){if(e&&t){e=e.toLowerCase();for(var n=this._exec[e]||[],i=n.length-1;i>=0;i--)n[i]===t&&n.splice(i,1)}else this._exec={}}}])}();function jc(e,t){(function(e,t){if(t.has(e))throw new TypeError("Cannot initialize the same private elements twice on an object")})(e,t),t.add(e)}function Gc(e,t,r){return(t=function(e){var t=function(e,t){if("object"!=_(e)||!e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var n=r.call(e,t||"default");if("object"!=_(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==_(t)?t:t+""}(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function Hc(e,t,r){if("function"==typeof e?e===t:e.has(t))return arguments.length<3?t:r;throw new TypeError("Private element is not present on this object")}var zc,Kc="[bio]: ",Jc=window,Qc=Jc&&Jc.FormData,qc=new WeakSet,Yc=function(e){function t(e){var r;return o(this,t),jc(r=i(this,t),qc),Gc(r,"_attrs",{}),Zt.mix(r._attrs,{action:"",data:{},bChunkedSendData:fi,ajaxConfig:{value:{},type:"post",processData:di,cache:di,dataType:"text",async:fi,contentType:di,retry:0,headers:{"X-Requested-With":di}},ajax:"",formData:"",CORS:di,bOnlyResponseEmptyIsOK:fi}),Zt.mix(r._attrs,e),Hc(qc,r,Xc).call(r),r}return f(t,e),s(t,[{key:"get",value:function(e){return e in this._attrs?this._attrs[e]:""}},{key:"set",value:function(e,t){e in this._attrs&&(this._attrs[e]=t)}},{key:"uploadFilesToServer",value:function(e){return Hc(qc,this,Zc).call(this,e)}},{key:"uploadToServer",value:function(e){var r=this,n=r.get("ajaxConfig");Hc(qc,r,$c).call(r),e&&e.size>0&&(Hc(qc,r,el).call(r,e),Zt.isString(e.name)&&""!=e.name?r.name=e.name:r.name=e.fileName,e=null),Zt.mix(n,{data:r.get(t.PROP.formData),url:r.get(t.PROP.action),beforeSend:function(e,n,i){e.upload.addEventListener("progress",(function(e){r.fire(t.event.PROGRESS,{loaded:e.loaded,total:e.total,name:r.name})}),!1)}});var i=r.get("async");if(Zt.mix(n,{method:"POST",async:i,onSuccess:function(e){nl(r.get(t.PROP.data)),nl(r.get(t.PROP.formData));var n=r.get(t.PROP.ajax);Zt.isFunction(n.dispose)&&n.dispose(),r.set(t.PROP.data,null),r.set(t.PROP.formData,null),r.set(t.PROP.ajax,null);var i=Hc(qc,r,rl).call(r,e);r.fire(t.event.SUCCESS,i)},onError:function(e,n,i){var o;nl(r.get(t.PROP.data)),nl(r.get(t.PROP.formData));var a,s,u=r.get(t.PROP.ajax);Zt.isFunction(u.dispose)&&u.dispose(),r.set(t.PROP.data,null),r.set(t.PROP.formData,null),r.set(t.PROP.ajax,null),e&&Zt.isArray(e)&&e.length>2?(o=e[0],a=e[1],s=e[2]):(o=e,a=n,s=i),Hc(qc,r,tl).call(r,s,a,o)}}),i){var o=Vi(n);return r.set(t.PROP.ajax,o),!0}return Vi(n)}},{key:"abort",value:function(){var e=this,t=e.get("ajax");return Zt.isObject(t)?(t.abort(),e.set("ajax",!1),e):(Zt.log(Kc+"abort(), the value of io invalid!"),e)}},{key:"setRequestHeader",value:function(e,t){var r=this.get("ajaxConfig");return r.headers[e]=t,this.set("ajaxConfig",r),r=null,t}}])}(Vc);function Xc(){this.get("CORS");var e=this.get("ajaxConfig");return Zt.mix(e,{xhrFields:{withCredentials:!1}}),e}function Zc(e){var t=this,r=t.get(Uc.PROP.ajaxConfig),n=[];if(Hc(qc,t,$c).call(t),Zt.each(e,(function(e){e&&e.size>0?(Hc(qc,t,el).call(t,e),Zt.isString(e.name)&&""!=e.name?n.push(e.name):n.push(e.fileName)):n.push("")})),Zt.mix(r,{data:t.get(Uc.PROP.formData),url:t.get(Uc.PROP.action),beforeSend:function(e,r,n){e.upload.addEventListener("progress",(function(e){t.fire(Uc.event.PROGRESS,{loaded:e.loaded,total:e.total,name:""})}),!1)}}),Zt.mix(r,{method:"POST",async:t.get("async"),onSuccess:function(e){var r="";n=[],e&&(e&&Zt.isArray(e)&&e.length>1?r=e[0]:Zt.isString(e)&&(r=e)),r=Hc(qc,t,rl).call(t,r),t.fire(Uc.event.SUCCESS,r)},onError:function(e,r,i){var o,a;n=[],e&&Zt.isArray(e)&&e.length>2?(o=e[1],a=e[2]):(o=r,a=i),Hc(qc,t,tl).call(t,a,o)}}),t.name="",t.get("async")){var i=Vi(r);return t.set(Uc.PROP.formData,null),t.set(Uc.PROP.ajax,i),!0}var o=Vi(r);return t.set(Uc.PROP.formData,null),o}function $c(){var e,t=this,r=t.get("data");if(Qc)if(r instanceof Qc)t.set(Uc.PROP.formData,r);else{e=new Qc;try{Zt.each(r,(function(t,r){e.append(r,t)})),t.set(Uc.PROP.formData,e)}catch(Mj){Zt.log(Kc+"something error when reset FormData.")}}else Zt.log(Kc+"the browser does not support ajax.")}function el(e){if(!Zt.isObject(e))return Zt.log(Kc+"_addFileData(), file parameter invalid!"),!1;var t=this.get(Uc.PROP.formData),r=e.name,n=e.remoteFilename;return n||(n="RemoteFile"),t.append(n,e,r),this.set(Uc.PROP.formData,t),e=null,t}function tl(e,t,r){var n=Uc.status.ERROR,i={status:n,msg:t,response:!1,name:this.name};e&&(i.httpStatus=e.status,i.response=r||e.responseText),this.fire(n,i)}function rl(e){var t,r,n,i=!1,o=this.name,a=Uc.status.SUCCESS,s=Uc.event.ERROR;if(Zt.log("Response from server: "+e),!this.get("bOnlyResponseEmptyIsOK"))return{status:a,msg:!1,json:!1,response:e,name:o};if(Zt.isUndefined(e)||""===e)t={status:a,msg:!1,json:!1,response:"",name:o};else if(Zt.isString(e)){try{for(r=0;r<e.length&&!(r>10);r++){if("{"==(n=e[r])){i=!0;break}if(" "!=n&&"\r"!=n&&"\n"!=n&&"\t"!=n)break}if(i){var u=Zt.parse(e);t=1==u.status?{status:a,msg:!1,json:u,response:e,name:o}:{status:s,msg:!1,json:u,response:e,name:o}}}catch(Mj){i=!1,Zt.log(Mj)}if(!i){var c=String(e);t=""==(c=c.replace(/( |\t|\r|\n)/g,""))?{status:a,msg:!1,json:!1,response:e,name:o}:{status:s,msg:!1,json:!1,response:e,name:o}}}else t={status:a,msg:!1,json:!1,response:"",name:o};return t}function nl(e){e&&e instanceof Qc&&e.forEach&&e.forEach((function(t,r){r&&e["delete"](r)}))}function il(e,t){(function(e,t){if(t.has(e))throw new TypeError("Cannot initialize the same private elements twice on an object")})(e,t),t.add(e)}function ol(e,t,r){return(t=function(e){var t=function(e,t){if("object"!=_(e)||!e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var n=r.call(e,t||"default");if("object"!=_(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==_(t)?t:t+""}(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function al(e,t,r){if("function"==typeof e?e===t:e.has(t))return arguments.length<3?t:r;throw new TypeError("Private element is not present on this object")}Uc=Yc,Gc(Yc,"event",{SUCCESS:"success",ERROR:"error",PROGRESS:"progress"}),Gc(Yc,"status",{SUCCESS:"success",ERROR:"error"}),Gc(Yc,"PROP",{action:"action",data:"data",bChunkedSendData:"bChunkedSendData",ajaxConfig:"ajaxConfig",ajax:"ajax",formData:"formData",CORS:"CORS",bOnlyResponseEmptyIsOK:"bOnlyResponseEmptyIsOK"});var sl=new WeakSet,ul=function(e){function t(e){var r;return o(this,t),il(r=i(this,t),sl),r._attrs={action:"",retry:0,timeout:0,CORS:di,async:fi,dataType:"text",fileStatus:"",data:{},bOnlyResponseEmptyIsOK:fi},Zt.mix(r._attrs,e),al(sl,r,ll).call(r),r}return f(t,e),s(t,[{key:"get",value:function(e){return e in this._attrs?this._attrs[e]:""}},{key:"set",value:function(e,t){e in this._attrs&&(this._attrs[e]=t)}},{key:"upload",value:function(e){var t;if(e){if(Zt.isArray(e))return t=this._uploadType.uploadFilesToServer(e),e=null,t;if(Zt.isObject(e)){var r=e;return r.size?(r.id||(r.id=Zt.guid("file-")),r.size&&(r.textSize=al(sl,this,cl).call(this,r.size))):r.size=0,t=this._uploadType.uploadToServer(r),r=null,e=null,t}}return t=this._uploadType.uploadToServer(e),e=null,t}},{key:"abort",value:function(e){return this._uploadType&&this._uploadType.abort(),!0}},{key:"setRequestHeader",value:function(e,t){this._uploadType.setRequestHeader(e,t)}}])}(Vc);function cl(e){var t=-1;do{e/=1024,t++}while(e>99&&t<4);return Math.max(e,.1).toFixed(1)+["KB","MB","GB","TB"][t]}function ll(){var e=this,t={async:e.get(zc.PROP.async),action:e.get(zc.PROP.action),data:e.get(zc.PROP.data),CORS:e.get(zc.PROP.CORS),bOnlyResponseEmptyIsOK:e.get(zc.PROP.bOnlyResponseEmptyIsOK)};this._uploadType=new Yc(t);var r=this._uploadType.get(Yc.PROP.ajaxConfig);return r&&(r.dataType=e.get(zc.PROP.dataType),r.async=e.get(zc.PROP.async),r.retry=e.get(zc.PROP.retry)),this._uploadType.on(Yc.event.SUCCESS,al(sl,e,fl),e),this._uploadType.on(Yc.event.ERROR,al(sl,e,fl),e),this._uploadType.on(Yc.event.PROGRESS,al(sl,e,dl),e),this._uploadType}function dl(e){this.fire(zc.event.PROGRESS,e)}function fl(e){var t=this,r=e.status,n=e.msg,i=t.get("file");Zt.mix(e,{file:i}),"success"===r?t.fire(zc.event.SUCCESS,e):(!1===n||("abort"===n?Zt.mix(e,{canceled:!0}):"timeout"===n&&Zt.mix(e,{timeout:!0})),t.fire(zc.event.ERROR,e))}zc=ul,ol(ul,"event",{SUCCESS:"success",ERROR:"error",PROGRESS:"progress"}),ol(ul,"PROP",{action:"action",retry:"retry",timeout:"timeout",CORS:"CORS",async:"async",dataType:"dataType",fileStatus:"fileStatus",data:"data",bOnlyResponseEmptyIsOK:"bOnlyResponseEmptyIsOK"});var hl={Loading:"Processing...",LoadingTiff:"Processing tiff...",LoadingPdf:"Processing pdf...",Encoding:"Processing...",ConvertingToBlob:"Converting to blob...",ConvertingToBase64:"Converting to base64...",SavingPdf:"Saving pdf...",SavingTiff:"Saving tiff...",Downloading:"Downloading...",Uploading:"Uploading...",Transfer:"Transferring...",CanvasLoading:"Loading ...",Err_ServiceModeNotSupportMobile:"Service Mode does not support your Operating System. Please contact the site administrator."};function gl(e,t){Qt.detect.bMaskShow=!0,rr.DWT.ScanDirectly||Zt.isFunction(rr.DWT.OnWebTwainPreExecute)&&rr.DWT.OnWebTwainPreExecute(e,t)}function ml(){Qt.detect.bMaskShow=!1,rr.DWT.ScanDirectly||Zt.isFunction(rr.DWT.OnWebTwainPostExecute)&&rr.DWT.OnWebTwainPostExecute()}var pl={getImageUrl:function(e,t,r,n,i){var o,a=[e];if(Zt.isNumber(t)&&t<0)return"";if(t!==undefined&&null!==t&&(a.push("&index="),a.push(t)),a.push("&width="),a.push(r),a.push("&height="),a.push(n),ko.bMobile&&a.push("&type=1&quality=85"),a.push("&ticks="),i?a.push(i):a.push(Date.now()),o=a.join(""),de.bFileSystem&&o.indexOf("dwt://")<0){var s=new Image;s.crossOrigin="anonymous",s.src=o,s=null}return o},getUrlByAct:function(e,t,r){var n=[e];return t!==undefined&&null!==t&&(n.push("&index="),n.push(t)),r&&(n.push("&act="),n.push(r)),n.push("&ticks="),n.push(Date.now()),n.join("")},output:function(e,t){Zt.debug&&Zt.log(t)},print:function(e){var t,r=0,n="";for(r=0;r<e.length;r++)n=n+'<div class="image-container"><img src="'+e[r].Url+'" /></div>';var i,o=Oo()+"/src/dynamsoft.webtwain.css",a=["alwaysRaised=yes,z-look=yes,top=0,left=0,toolbar=no,menubar=no,location=no,status=no,width=",0,",height=",0].join(""),s=window.open("about:blank","_blank",a);t=["<html>",'<head><link rel="stylesheet" type="text/css" href="',o,'"></head>','<body id="D_body">',n,"</body></html>"].join(""),s&&(s.document.write(t),s.document.close(),s.focus(),(i=s.document.body)?i.onload=function(){s&&s.print(),Zt.log("print image...ok")}:Zt.log("cannot find image"))}};Qt.html5.Funs2=pl;var vl=Zt.isString,_l=Zt.isArray,yl=Zt.each;function Sl(e,t){if(vl(t))e.push('"'),e.push(t),e.push('"');else if(_l(t)){var r=fi;e.push("["),yl(t,(function(t){r?r=di:e.push(","),Sl(e,t)})),e.push("]")}else t===undefined?e.push('""'):e.push(t)}function Il(){for(var e=[],t=arguments.length,r=new Array(t),n=0;n<t;n++)r[n]=arguments[n];if(r.length>0)if(1===r.length){var i=r[0];e.push("["),Sl(e,i),e.push("]")}else if(2===r.length){var o=r[0],a=r[1];e.push("["),Sl(e,o),e.push(","),Sl(e,a),e.push("]")}else Sl(e,Array.prototype.slice.call(r));return e.join("")}function bl(e){return e instanceof ArrayBuffer||e instanceof Uint8Array||e instanceof Uint16Array||e instanceof Uint32Array||e instanceof Int8Array||e instanceof Int16Array||e instanceof Int32Array||window.Uint8ClampedArray&&e instanceof window.Uint8ClampedArray||e instanceof Float32Array||e instanceof Float64Array}var Tl=function(e){return e.TWAINSCANNER=16,e.WIASCANNER=32,e.TWAINX64SCANNER=64,e.ICASCANNER=128,e.SANESCANNER=256,e.ESCLSCANNER=512,e.WIFIDIRECTSCANNER=1024,e.WIATWAINSCANNER=2048,e}(Tl||{}),Cl=Tl.TWAINSCANNER|Tl.WIASCANNER|Tl.TWAINX64SCANNER|Tl.ICASCANNER|Tl.SANESCANNER|Tl.ESCLSCANNER|Tl.WIFIDIRECTSCANNER|Tl.WIATWAINSCANNER,wl=Tl.TWAINSCANNER|Tl.WIASCANNER|Tl.TWAINX64SCANNER|Tl.ICASCANNER|Tl.SANESCANNER,El=Tl.TWAINSCANNER|Tl.WIATWAINSCANNER|Tl.TWAINX64SCANNER|Tl.ICASCANNER|Tl.SANESCANNER;Tl.TWAINSCANNER,Tl.WIASCANNER,Tl.WIATWAINSCANNER;var kl=Tl.ESCLSCANNER|Tl.WIFIDIRECTSCANNER,Al=Tl.TWAINSCANNER|Tl.WIATWAINSCANNER,xl=1;function Pl(){return(++xl).toString()}function Dl(){return["dwt_",Zt.getRandom()].join("")}var Fl=0;function Wl(e,t,r){if(Zt.log("showMask:"+e+"--"+Fl),0==Fl)if(t){gl(t);var n=Qt.mask.dlgMask;if(n){n.style.zIndex="10000";var i=Zt.sizzle(".dynamsoft-backdrop",n.parentNode);i&&i.length>0&&(i[0].style.zIndex="10000")}}else gl(r||{});Fl++}function Rl(e){Zt.log("hideMask:"+e+"--"+Fl),Fl>1?Fl--:Fl<=1&&(ml(),Fl=0)}var Nl=function(){return s((function e(t,r){o(this,e),c(this,"m_server",""),c(this,"m_iUsingTime",0),c(this,"m_countMap",{}),c(this,"m_newConsum",!1),c(this,"m_mapSavedToDb",!1),this.clearData(),this.m_enumInstance=t,t==rr.DWT.EnumInstance.dwt_desktop?(this.m_deploymentType="desktop",this.m_server=r):t==rr.DWT.EnumInstance.dwt_browser?(this.m_deploymentType="browser",this.m_server=r):t==rr.DWT.EnumInstance.dbr&&(this.m_deploymentType="browser",this.m_server="")}),[{key:"clearData",value:function(){this.m_iUsingTime=0,this.m_jvUsingTime=Zt.nil,this.m_countMap={},this.m_newConsum=!1,this.m_mapSavedToDb=!1,this.m_minExpiredTime=Zt.nil,this.m_maxExpiredTime=Zt.nil,this.m_cu=Zt.nil,this.m_ar=Zt.nil,this.m_ltsInstance=Zt.nil}},{key:"set_cu",value:function(e){this.m_cu=e}},{key:"get_cu",value:function(){return this.m_cu}},{key:"set_ar",value:function(e){this.m_ar=e}},{key:"get_ar",value:function(){return this.m_ar}},{key:"get_ltsInstance",value:function(e){return this.m_ltsInstance||(this.m_ltsInstance=e(this.m_enumInstance)),this.m_ltsInstance}},{key:"inited_ltsInstance",value:function(){return!!this.m_ltsInstance}},{key:"set_maxExpiredTime",value:function(e){this.m_maxExpiredTime=e}},{key:"get_maxExpiredTime",value:function(){return this.m_maxExpiredTime}},{key:"set_minExpiredTime",value:function(e){this.m_minExpiredTime=e}},{key:"get_minExpiredTime",value:function(){return this.m_minExpiredTime}},{key:"get_deploymentType",value:function(){return this.m_deploymentType}},{key:"get_enumDeploymentType",value:function(){return this.m_enumInstance}}])}();var Ol=rr.DWT;Ol.LTS=Ol.LTS||{},Ol.licenseException={code:0,message:"",fromLTS:!1},Ol.bLTSOnline=!0,Ol.axInstance=undefined,Ol.lOnUpdateDWObj=[],Ol.EnumInstance={dwt_desktop:0,dwt_browser:1,dbr:2};var Ml,Ll=0,Bl={},Ul=!1,Vl=!1,jl=!1,Gl=!1,Hl=!1;function zl(){var e=ia.handshakeCode;return Zt.isString(e)||(e=""),e}function Kl(){var e=ia.organizationID;return Zt.isNumber(e)?e=""+e:Zt.isString(e)||(e=""),e}function Jl(){return Zt.replaceAll(Jo.JSVersion,",",".")}function Ql(e,t){var r=e;return r===Zt.nil&&(r=rr.DWT.lgdt()),r==Ol.EnumInstance.dbr?(Ol._dbrLicense||(Ol._dbrLicense=new Nl(r,"")),Ol._dbrLicense):(Ol._dwtDLicense||(Ol._dwtDLicense=new Nl(r,"")),Ol._dwtDLicense)}Ol.lupverfy=function(){Ql(Ol.lgdt()).get_ltsInstance(Xl),Ql(Ol.EnumInstance.dbr).get_ltsInstance(Xl)};var ql=Ol.EnumInstance.dwt_desktop;Ol.lsdt=function(e,t){ql=e},Ol.lgdt=function(e){return ql},Ol.lsmid=function(e,t){Ql(Ol.lgdt()).set_cu(e)},Ol.lsar=function(e,t){Ql(Ol.lgdt()).set_ar(e)},Ol.lsmid2b=function(e){Ql(Ol.lgdt("")).set_cu(e)},Ol.lgar=function(e,t){return Ql(e).get_ar()},Ol.laddDWTObj=function(e){var t=!1;Zt.each(Ol.lOnUpdateDWObj,(function(r){if(r==e)return t=!0,!1})),t||Ol.lOnUpdateDWObj.push(e)},Ol.lremoveDWTObj=function(e){Zt.each(Ol.lOnUpdateDWObj,(function(t,r){if(t==e)return Ol.lOnUpdateDWObj.splice(r,1),!1}))},Ol.lsendUpdateEvt=function(e,t){var r=[];if(Zt.each(Ol.lOnUpdateDWObj,(function(t){e==Ol.EnumInstance.dwt_desktop&&r.push(t)})),0==r.length)return Qt.Promise.resolve();var n,i=r[0];return i._bAx?(Zt.each(r,(function(t){t.SetLTSInfo(Ql(e).get_ar(),Ql(e).get_cu())})),i.GetLicenseInfo().then((function(r){r&&Zt.isArray(r.Detail)&&r.Detail.length>0&&Ol.lsexp(e,r.Detail[0].ExpireDate,t)}))):(n=i.SetLTSLicenseAsync(Ql(e).get_ar()).then((function(r){r&&Zt.isArray(r.Detail)&&r.Detail.length>0&&Ol.lsexp(e,r.Detail[0].ExpireDate,t)})),Zt.each(r,(function(t,r){0!=r&&t.SetLTSLicenseAsync(Ql(e).get_ar())})),n)},Ol.lgcb=function(){var e=[];return de.bChrome?e.push("Chrome"):de.bFirefox?e.push("Firefox"):de.bEdge?e.push("Edge"):de.bIE?e.push("IE"):de.bSafari?e.push("Safari"):de.bOpera?e.push("Opera"):de.b360SE?e.push("360SE"):de.bTencentTraveler?e.push("TencentTraveler"):de.bMaxthon?e.push("Maxthon"):de.bMetaSr?e.push("MetaSr"):de.bTheWorld?e.push("TheWorld"):de.bUC?e.push("UC"):de.bHuaWeiBrowser&&e.push("HuaWeiBrowser"),e.push(de.strBrowserVersion),de.bWin?e.push("Windows"):de.bMac?e.push("Mac"):de.bLinux?e.push("Linux"):de.bAndroid?e.push("Android"):de.bChromeOS?e.push("ChromeOS"):de.bHarmonyOS?e.push("HarmonyOS"):ko.bMobile?e.push("Mobile OS"):rr.navInfo.bEmbed&&e.push("Embed OS"),e.join(" ")};var Yl={NetworkError:-2440,Timedout:-2441,JsonError:-2442,CorsError:-2443,Expired:-2445,LtsJsLoadError:-2446,UUIDError:-2447};function Xl(e){var t,r,n=ia.licenseServer;if(n&&n.length>0)for(t=0;t<n.length;t++)r=n[t],Zt.endsWith(r,"/")||(n[t]=r+"/");var i=Ql(e),o={bd:Qt.ltsDebug,dm:location.origin?Zt.startsWith(location.origin,"http")?location.origin:"https://localhost":Zt.startsWith(location.href,"http")?location.href:"https://localhost",hs:Qt.product.handshakeCode||"",pd:Ol.lgpd(e),vm:Ji,dt:i.get_enumDeploymentType(),btoa:Zt.btoa,atob:Zt.atob,fol:Ol.OnFirstOffline,sutlcb:function(){Zt.isFunction(Ol.lonsend)&&Ol.lonsend()},lf:Qt.localforage,updl:function(t){i.set_ar(t.ar),i.get_cu()||i.set_cu(t.cu),Ol.lsendUpdateEvt(e,"")},mnet:function(){return i.get_maxExpiredTime()},mxet:function(){return i.get_minExpiredTime()},dwt:!0};if(e==Ol.EnumInstance.dwt_browser||e==Ol.EnumInstance.dbr?o.feab=Ol.lfeab_wasm:o.feab=Ol.lfeab_ax,!de.bIE&&ia.ltsDebug&&(o.log=console.log),rr.LTS&&rr.LTS._)return rr.LTS._.createLtsInstance(o);var a={},s=function(){return Qt.Promise.reject({code:Yl.LtsJsLoadError,message:"The dynamsoft.lts.js load failed."})};return a.i=s,a.s=s,a.u=s,a.caret=s,a}Ol.lgpd=function(e){return e==Ol.EnumInstance.dwt_desktop?"dwt|dbr|ddv":"dwt|ddv"};var Zl=!1;function $l(e,t){return ed.apply(this,arguments)}function ed(){return ed=n(g().mark((function e(t,r){var n,i,o,a,s,u,c,l,d,f;return g().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(n=null!=r?r:"",o=Ql(t),a=o.get_enumDeploymentType(),Ol.lclex(),!o.get_ar()||!o.get_cu()){e.next=10;break}if(Zl){e.next=9;break}return i=o.get_ltsInstance(Xl),e.next=8,i.ih();case 8:Zl=!0;case 9:return e.abrupt("return",Qt.Promise.resolve({ar:o.get_ar(),cu:o.get_cu()}));case 10:if((s={pd:Ol.lgpd(t),v:Jl(),os:Ol.lgcb(),fn:Ol.DeviceFriendlyName||"",ls:ia.licenseServer,sp:ia.sessionPassword,l:Wc.getLTSLicense(),mnet:function(){return o.get_maxExpiredTime()},mxet:function(){return o.get_minExpiredTime()},fol:Ol.OnFirstOffline}).dt=o.get_deploymentType(),a!=Ol.EnumInstance.dwt_desktop){e.next=20;break}if(""!=o.get_cu()){e.next=17;break}return La(u={}),e.abrupt("return",Qt.Promise.reject({code:u._errorCode,message:u._errorString}));case 17:s.lsu=o.get_cu(),e.next=21;break;case 20:a==Ol.EnumInstance.dbr||(s.dwt=!0,""!=o.get_cu()&&(s.lsu=o.get_cu()),s.updl=function(e){o.set_ar(e.ar),o.get_cu()||o.set_cu(e.cu),Ol.lsendUpdateEvt(a,n)});case 21:return e.prev=21,i=o.get_ltsInstance(Xl),e.next=25,i.i(s);case 25:return c=e.sent,o.get_ar()||o.set_ar(c.ar),o.get_cu()||o.set_cu(c.cu),e.abrupt("return",c);case 31:throw e.prev=31,e.t0=e["catch"](21),o.clearData(),Zt.isString(e.t0)?(d=nd(e.t0),Ol.lsetException(d,e.t0,!0),l=Ol.licenseException):(id(f={},e.t0),l={code:f._errorCode,message:f._errorString}),l;case 36:case"end":return e.stop()}}),e,null,[[21,31]])}))),ed.apply(this,arguments)}function td(){return Date.now()}function rd(e){var t=e?new Date(e):new Date,r="yyyy-MM-ddTHH:mm:ss.SSSZ",n={"M+":t.getUTCMonth()+1,"d+":t.getUTCDate(),"H+":t.getUTCHours(),"h+":t.getUTCHours()%12||12,"m+":t.getUTCMinutes(),"s+":t.getUTCSeconds(),"q+":Math.floor((t.getUTCMonth()+3)/3),"S+":t.getUTCMilliseconds()};for(var i in/(y+)/.test(r)&&(r=r.replace(RegExp.$1,(t.getUTCFullYear()+"").substr(4-RegExp.$1.length))),n)new RegExp("("+i+")").test(r)&&(r=r.replace(RegExp.$1,1==RegExp.$1.length?n[i]:("000"+n[i]).substr(("000"+n[i]).length-RegExp.$1.length)));return r}function nd(e){var t=Yl.NetworkError;return e.indexOf("timed out")>-1||e.indexOf("timeout")>-1?t=Yl.Timedout:(e.indexOf("access-control-allow-origin")>-1||e.indexOf("cors")>-1)&&(t=Yl.CorsError),t}function id(e,t){if(t){var r=t.code||t.ltsErrorCode,n=t.message;111==r||106==r||108==r?(Ua(e,r),e._errorString=n):(e._errorCode=r,e._errorString=n),rr.DWT.lsetException(e._errorCode,e._errorString,!0)}}function od(e,t){e.__licenseInfo=t,function(e){e.__calic||(e.__calic=e.__licenseInfo)}(e)}function ad(e){var t=rr.DWT.licenseException;t.code=e.code,t.message=e.message,e&&(sd(e),e instanceof Error?Zt.error(e):Zt.error(Zt.stringify(e)))}function sd(e){Zt.isFunction(rr.DWT.OnWebTwainError)?rr.DWT.OnWebTwainError(e):Zt.isFunction(window.Dynamsoft_OnError)&&window.Dynamsoft_OnError(e)}function ud(e){return e==fa.LicenseExpiredForDLS||e==fa.LicenseNoCoreForDLS||e==fa.LicenseNoCore||e==fa.LicenseInvalid||e==fa.LicenseExpired||e==fa.LicenseParseFailed||e==fa.LicenseIsFuture||e==fa.LicenseVersionNotCurrent}function cd(e){return e==fa.LicenseExpired}function ld(e){var t=0,r=e.message;Zt.isNumber(e.code)?t=e.code:Zt.isString(r)&&(t=-1),0!=t&&function(e,t){Zt.isFunction(rr.OnLicenseError)&&rr.OnLicenseError(t,e)}(t,r)}function dd(e){ld($s(e))}Ol.lglic=$l,Ol.lgbuuid=function(){return""},Ol.lshow=function(){return{t:Ml,t2:Ll,m:Zt.stringify(Bl)}},Ol.lgct=function(e){switch(e){case 0:return"3011";case 1:return"3012";case 2:return"3014";case 3:return"3013";case 4:return"3015";case 14:return"3016";case 3001:return"3001";case 3002:return"3002";case 3003:return"3003";case 3004:return"3004";case 3005:return"3005";case 3006:return"3006";case 3007:return"3007";case 3008:return"3008";case 3009:return"3009";case 5001:return"5001";case 4001:return"4001";case 4002:return"4002";case 4003:return"4003"}return""},Ol.lcvrf=function(e){e&&(e._canConsume&&!e._canConsume()||setTimeout((function(){Ol.lcvrf_(e)}),1))},Ol.lcvrf_=function(e){var t;t=Ol.lgdt();var r,n=Ol.DeviceFriendlyName||"",i=Ol.lgcb(),o=Ql(t),a={hs:zl(),og:Kl(),cu:o.get_cu(),fn:n,cw:"",os:i,v:Jl(),dt:o.get_deploymentType(),ed:"js"},s=function(e,t){var r,n,i=0;if(Zt.isString(e)&&""!=e&&"{}"!=e&&t&&Zt.isArray(t)&&!(t.length<1)){if(n=Ql(t[0]),r=Zt.parse(e),Ol.lclex(),0==Ll){var o=td(),a="";Ll=o,Ml=rd(o),Bl={},i=0,Zt.each(r,(function(e,t){(t<i||0==i)&&(i=t,a=e)})),i>0&&n.get_ltsInstance(Xl).s(ia.licenseServer,a,i,!0).then((function(){}),(function(e){}))}Zt.each(r,(function(e,t){var r=!1,o=parseInt(t);o>0&&o!=i&&(o+18e4<td()&&(r=!0),n.get_ltsInstance(Xl).s(ia.licenseServer,e,t,r).then((function(){}),(function(e){})))}))}};if(a.pd=Ol.lgpd(t),r=Zt.stringify(a),!e._bAx){var u="GetBuffer",c=Il(Zt.replaceAll(r,'"','\\"')),l={cmd:u,cmdId:Pl(),sFun:s,fFun:function(){},params:[t]};return e._innerSendByWS(u,c,l,null,!0)}s(e.GetBuffer(r),[t,""])},Ol.lavrf=function(e,t,r,n){var i=1;if(""!=e){t>1&&(i=t);var o=td();if(Ll>0&&Ll+18e4<o){Vl?(Bl={},Ol.lavrf__unload()):Ol.lavrf__(!0,r,n);var a=td()+1;Ll=a,Ml=rd(a),Bl={}}Ul=!0,Vl=!1,Bl[e]?Bl[e]+=i:Bl[e]=i,0==Ll&&Ol.lavrf__(!0,r,n)}},Ol.lavrf_=function(e,t,r){if(Ul){var n=1;e&&(n=e),setTimeout((function(){Ol.lavrf__(!1,t,r)}),n)}},Ol.lavrf__=function(e,t,r){var n,i,o,a=td(),s=!1,u=!!e,c=0,l=t;Zt.isUndefined(l)&&(l=Ol.lgdt()),o=Ql(l),Ul=!1,0==Ll&&(s=!0,Ll=a,Ml=rd(a)),n=Ll,i=Ml;var d={};d.ut=i;var f={};if(Zt.each(Bl,(function(e,t){f[t]=e,e>0&&c++})),d.cts=f,u||n+18e4<a){u=!0;var h=td()+1;if(Ll=h,Ml=rd(h),Bl={},Vl=!1,0==c)return}else{if(0==c)return;Vl=!0}d.dur=s?1:180;var g,m=Ol.DeviceFriendlyName||"",p=Ol.lgcb(),v={hs:zl(),og:Kl(),cu:o.get_cu(),fn:m,cw:"",os:p,v:Jl(),dt:o.get_deploymentType(),ed:"js",rcs:[d]};v.product=Ol.lgpd(t),g=Zt.stringify(v),ia.ltsDebug&&rd(),Ol.lclex(),o.get_ltsInstance(Xl).s(ia.licenseServer,g,""+n,u).then((function(){}),(function(e){}))},Ol.lavrf__unload=n(g().mark((function MJ(){var e,t,r,n,i,o,a;return g().wrap((function(s){for(;;)switch(s.prev=s.next){case 0:if(e=td(),t=!0,n=!1,i=Ql(Ol.lgdt()),o=Ql(Ol.EnumInstance.dbr),Ul=!1,0==Ll&&(Ll=e,Ml=rd(e)),r=Ll,a=td()+1,Ll=a,Ml=rd(a),Bl={},Vl=!1,r+=1,Ol.lclex(),!i.inited_ltsInstance()){s.next=20;break}return s.prev=13,s.next=16,i.get_ltsInstance(Xl).s(ia.licenseServer,n,""+r,t);case 16:s.next=20;break;case 18:s.prev=18,s.t0=s["catch"](13);case 20:if(!o.inited_ltsInstance()){s.next=28;break}return s.prev=21,s.next=24,o.get_ltsInstance(Xl).s(ia.licenseServer,n,""+r,t);case 24:s.next=28;break;case 26:s.prev=26,s.t1=s["catch"](21);case 28:case"end":return s.stop()}}),MJ,null,[[13,18],[21,26]])}))),Ol.lclex=function(){var e=Ol.licenseException;e.code=0,e.message="",e.httpResponse="",e.fromLTS=!1},Ol.li=function(e,t){var r;if(e.axInstance&&(Ol.axInstance=e.axInstance,Ol.axInstance))return r=Ol.axInstance.GetUUID(),ia.ltsDebug&&Zt.log("ActiveX cu: "+r),Ql(e.instanceMode).set_cu(r),r;return Ql(e.instanceMode).get_cu()},Ol.lfeab_ax=function(e){return new Qt.Promise((function(t,r){var n="";if(Ol.axInstance)try{n=Ol.axInstance.Encrypt(e,0)}catch(jj){}t(n)}))},Ol.lfeab_wasm=function(e){return Qt.Promise.resolve("")},Ol.lwsproc=function(e,t){try{e=Zt.parse(e)}catch(r){return void(t.fFun&&t.fFun(r))}"GetBuffer"==e.method?t.sFun&&e.result.length>0?t.sFun(e.result[0],t.params):t.sFun("",t.params):t.sFun&&t.sFun(e)},Ol.lsexp=function(e,t,r){var n,i=t;if(3==(n=(i=Zt.replaceAll(i,"/","-")).split("-")).length){var o=n[0],a=n[1],s=n[2];a.length<2&&(a=(a="00"+a).substr(a.length-2)),s.length<2&&(s=(s="00"+s).substr(s.length-2)),i=[o,a,s].join("-")}var u=[i,"T23:59:59.999Z"].join("");Ql(e).set_minExpiredTime(u),Ql(e).set_maxExpiredTime(u)},Ol.lunload=n(g().mark((function LJ(){return g().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,Ol.lavrf__unload();case 2:Ll=0,Ml=Zt.nil,Bl={},Vl=!1,Ul=!1,jl=!1,Gl=!1,Hl=!1,Ol.lclex(),Ol.bLTSOnline=!0,Ol.axInstance=Zt.nil,Ol.lOnUpdateDWObj=[];case 14:case"end":return e.stop()}}),LJ)}))),Ol.lcexp=function(e,t){return Ql(e).get_ltsInstance(Xl).caret().then((function(){return!1}),(function(e){var t=Ol.licenseException,r="";return e instanceof Error||"message"in e?r=e.message:Zt.isString(e)&&(r=e),Ol.lsetException(Yl.Expired,r,!1),Gl||(Gl=!0,Zt.error(r),rr.OnLTSLicenseError&&rr.OnLTSLicenseError(Wc.getPublicLicenseContent(t.message),t.code)),!0}))},Ol.OnLicenseException=function(){var e=Ol.licenseException,t=e.message;if(Zt.isString(t)&&(t.indexOf("Error Code")>-1?t=Zt.replaceAll(t,"Error Code","error code"):t.indexOf("Error code")>-1&&(t=Zt.replaceAll(t,"Error code","error code"))),t.indexOf("(https://www.dynamsoft.com/purchase-center/)")>-1&&(t=t.replace("(https://www.dynamsoft.com/purchase-center/)","(https://www.dynamsoft.com/store/dynamic-web-twain/)"),e.message=t),t.indexOf("error code:")>-1){var r=t.substr(0,t.indexOf("message")),n=t.substr(t.indexOf("message"));r.indexOf("{")>-1&&(r=r.substr(r.indexOf("{")+1)),n.indexOf("}")>-1&&(n=n.substr(0,n.indexOf("}"))),r=Zt.replaceAll(r,"error code:",""),n=Zt.replaceAll(n,"message: ",""),Ol.lsetException(parseInt(r),n,!0),Zt.error(n),rr.OnLTSLicenseError&&rr.OnLTSLicenseError(Wc.getPublicLicenseContent(t),e.code)}else{if(!e.code){var i=nd(t);Ol.lsetException(i,t,!0)}if(Zt.error(e.message),e.code==Yl.LtsJsLoadError)return;rr.OnLTSLicenseError&&rr.OnLTSLicenseError(Wc.getPublicLicenseContent(e.message),e.code)}},Ol.lol=function(){return Ol.bLTSOnline},Ol.OnFirstOffline=function(e){Ol.bLTSOnline=!1},Ol.lpubdlg=function(e,t){if(Zt.isString(e)&&""!=e){if(e=Zt.atob(e),console&&console.warn&&!jl&&ia.bUseDynamsoftLicenseManager,1==t)return jl||ia.bUseDynamsoftLicenseManager||(jl=!0,rr.OnLTSPublicLicenseWarning&&rr.OnLTSPublicLicenseWarning(Wc.getPublicLicenseContent(e))),!0;2==t&&(jl||(jl=!0))}return!1},Ol.lcheckLic=function(e,t,r){var n=!1;if(t){if(Zt.isArray(t.Detail)&&t.Detail.length>0){var i=t.Detail[0].ExpireDate;return Ol.lsexp(e,i,r),Ol.lcexp(e,r).then((function(e){var r=!1;e?r=!0:1!=t.Trial&&2!=t.Trial||(r=Ol.lpubdlg(t.Message,t.Trial)),r||Ol.bLTSOnline||Hl||(Hl=!0,rr.OnLTSConnectionWarning&&rr.OnLTSConnectionWarning())}))}1!=t.Trial&&2!=t.Trial||(n=Ol.lpubdlg(t.Message,t.Trial))}return n||Ol.bLTSOnline||Hl||(Hl=!0,rr.OnLTSConnectionWarning&&rr.OnLTSConnectionWarning()),Qt.Promise.resolve()},Ol.lisValidID=function(e){if(Zt.isString(e)&&""!=e)return!0;var t,r=Ol.licenseException;return Ol.lsetException(Yl.UUIDError,"Failed to generate an ID for your device to license it: not enough permission.",!0),Zt.error(r.message),t=r.message,rr.OnLTSLicenseError&&rr.OnLTSLicenseError(t,r.code),!1},Ol.lsetException=function(e,t,r){var n=Ol.licenseException;n.code=e,n.message=t,r?n.fromLTS=!0:r in n&&delete n.fromLTS},Ol.lgcuid=function(e){var t=rr.DWT.li({instanceMode:e},"");return t?Qt.Promise.resolve(t):Ql(e).get_ltsInstance(Xl).u().then((function(e){return rr.DWT.lsmid(e,""),rr.DWT.lsmid2b(e),e}))};var fd=s((function BJ(){o(this,BJ)}));function hd(e){var t=new fd;return t.server=e.server,t.normal=!0,e.attrs&&(t.attrs=Zt.clone(e.attrs)),t}var gd=function(e){return e.CONNECTING=0,e.OPEN=1,e.CLOSING=2,e.CLOSED=3,e}({});function md(e,t,r){if(Zt.isString(e)&&(e.indexOf("Function not found")>0||e.indexOf("Version not found")>0))t&&t(e);else{var n=e.data;if("object"===_(n))return n=null,e=null,void(r&&r());var i=n.replace(/\0/g,"");try{t&&t(i)}catch(o){Zt.log(n),r&&r()}n=null,e=null}}function pd(e,t){e&&e.readyState!=gd.CLOSING&&e.readyState!=gd.CLOSED?e.readyState==gd.CONNECTING?(e.onerror=function(t){t&&Zt.log("websocket error: "+t),e._reject&&(e._reject(t),e._reject=null),e.close()},e.onclose=function(t){e.onclose=null,e.onerror=null,e.onmessage=null,e.onopen=null,e._reject=null},e.onopen=function(){e.readyState==gd.OPEN?(e.onopen=null,e.send(t)):e.readyState==gd.CONNECTING&&(e.onopen?setTimeout(e.onopen,100):e._reject&&(e._reject(),e._reject=null))}):e.readyState==gd.OPEN&&(e.onopen=null,e.send(t)):e._reject&&(e._reject({closed:!0}),e._reject=null)}function vd(e,t,r){var n,i=r;return i||(rr.DWT.ConnectWithSocket?Zt.startsWith(e,"wss://")||Zt.startsWith(e,"ws://")||(i=de.bSSL?"wss://":"ws://"):Zt.startsWith(e,"https://")||Zt.startsWith(e,"http://")||(i=de.bSSL?"https://":"http://")),t?(Zt.endsWith(e,"/")&&(e=e.substring(0,e.length-1)),n=":"+t+"/"):Zt.endsWith(e,"/")||(n="/"),[i,e,n].join("")}var _d=function(){function e(){o(this,e)}return s(e,null,[{key:"postStringDataByWS",value:function(e,t){return new Qt.Promise((function(r,n){e.onmessage=function(t){md(t,(function(t){r(t),e.close(),e=null}),(function(){n(),e.close(),e=null}))},e._reject=n,pd(e,t)}))}},{key:"postStringDataByWSUrl",value:function(t,r){var n=new Qt.Promise((function(n,i){var o=e.newWebsocket(t,!1);o.onmessage=function(e){md(e,(function(e){n(e),o.close(),o=null}),(function(e){i(e),o.close(),o=null}))},o._reject=i,pd(o,r)}));return de.bEdge&&n["catch"]((function(){return new Qt.Promise((function(n,i){var o=e.newWebsocket(t,!0);o.onmessage=function(e){md(e,(function(e){n(e),o.close(),o=null}),(function(e){i(e),o.close(),o=null}))},o._reject=i,pd(o,r)}))})),n}},{key:"newWebsocket",value:function(e,t){var r,n=na.wsProtocol,i=window.MozWebSocket;if(void 0!==i)r=n?new i(e,n):new i(e);else{var o=window.WebSocket;if(t){var a=window,s=parent;try{for(;a!=s&&s.WebSocket;)o=s.WebSocket,a=s.window,s=s.parent}catch(u){o=window.WebSocket}}r=n?new o(e,n):new o(e)}return r}},{key:"getWsUrl",value:function(e,t,r){var n=r;return n===undefined&&(n=de.bSSL),vd(e,t,n?"wss://":"ws://")}},{key:"getDDMUrl",value:function(e,t,r){var n,i,o="/";return Zt.startsWith(e,"https://")?n=!0:Zt.startsWith(e,"http://")?n=!1:e=(n=Qt.detect.ssl)?"https://"+e:"http://"+e,i=n?"18626/":"18625/",Zt.endsWith(e,"/")&&(o=""),t?[e,o,"ddm/",i,r].join(""):[e,o,r].join("")}},{key:"getModuleUrl",value:function(e){var t;return t=vd(qo(),de.bSSL?rr.DWT.SSLPort:rr.DWT.Port),e?t+e:t}}])}();rr.DWT.NetManager=_d;var yd=function(e){return e.ST_UNKNOWN=0,e.ST_TWAIN_DIRECT=1,e.ST_DYNAMSOFT_SERVICE=2,e.ST_ESCL=3,e.ST_WIFI_DIRECT=4,e}({}),Sd=function(){return s((function e(t){o(this,e);var r=this;if(r._id=t.id,r._clientId=Zt.getRandom(),r._uuidForActiveUI=null,r._bReady=di,r._destroy=di,r._bMustUpgradeService=di,r._wsClient=null,r._wsRetry=0,r._wsFailedTimes=0,r._bConnecting=di,r._bNoMask=di,r._bNotShowMessage=di,r.__serverPlatform=Lo.enumWindow,r.__productKey="",r.__licenseInfo=null,r._reconnectTimeSpan=oa.RemoteReconnectTimeSpan,r._reconnectShortSpan=300,r._reconnectShortSpanTimes=5,r._bIfShowProgressBar=fi,r.__IfShowCancelDialogWhenImageTransfer=fi,r._bLicenseErrorDispose=!0,t.dmService){var n,i,a,s,u,c,l=hd(t.dmService),d="/",f="";i=l.server;var h=new Si(t.dmService.server),g=h.scheme;g&&(g=g.toLowerCase()),"https"==g?(n=!0,a=i.substring(8)):"http"==g?(n=!1,a=i.substring(7)):"wss"==g?(n=!0,a=i,i=Zt.replaceAll(i,"wss://","")):"ws"==g?(n=!1,a=i,i=Zt.replaceAll(i,"ws://","")):(a=i,i=(n=Qt.detect.ssl)?"https://"+i:"http://"+i),ca(h.hostname||h.scheme)?r._bRemoteMode=di:r._bRemoteMode=fi,Zt.endsWith(i,"/")&&(d="");var m=l.attrs;if(m){var p,v;s=(null===(p=m)||void 0===p?void 0:p.UUID)||"";var _=(null===(v=m.modules)||void 0===v?void 0:v.length)||0;if(""!=s&&_>0){var y;n?_>1&&_>1+(y=m.modules[1])+2&&(u=m.modules[1+y+2]):_>2&&(u=m.modules[2]),Zt.endsWith(u,"/")&&(d=""),f=[s,"/",u,"/"].join("")}}else m={UUID:"",service_type:yd.ST_DYNAMSOFT_SERVICE};c=[i,d,f].join(""),m.url=c,r._serverInfo=new Js([a,d,f].join(""),null,n,!0,na.wsProtocol),r._httpUrl=c,r._dmService=l}else{var S,I=Qt.detect.ssl,b=t.port,T=t.sslPort;ca(S=t.host?t.host:qo())?r._bRemoteMode=!1:r._bRemoteMode=!0,b||(b=rr.DWT.Port),T||(T=rr.DWT.SSLPort),r._serverInfo=new Js(S,I?T:b,I,!0,na.wsProtocol),r._httpUrl=function(e){var t=e.server;if(t){if(Zt.startsWith(t,"wss://")||Zt.startsWith(t,"ws://"))return t}else t=qo();return e.ssl?["https://",t,":",e.port,"/"].join(""):["http://",t,":",e.port,"/"].join("")}(r._serverInfo),r._dmService={server:r._httpUrl,attrs:{url:r._httpUrl,UUID:"",service_type:yd.ST_DYNAMSOFT_SERVICE},normal:!0}}}),[{key:"_resetErr",value:function(){this._errorCode=0,this._errorString="";var e=rr.DWT.licenseException;e.code=0,e.message=""}},{key:"dispose",value:function(){this._bReady=di,this._destroy=fi}},{key:"isDestroy",get:function(){return this._destroy}}])}(),Id=s((function UJ(){o(this,UJ)}));function bd(e,t){var r,n=[],i=t;if(Zt.isString(i)&&(i=Zt.parse(i)),Zt.isArray(i))for(r=0;r<i.length;r++){var o=Ed(i[r]);n.push(o)}for(r=0;r<n.length;r++){var a=n[r],s=a.deviceType;a.name&&(a.name=Zt.base64.decode(a.name)),s&Cl&&a.deviceInfo&&wd(a.deviceInfo),a.serviceInfo=null==e?void 0:e._dmService,Cd(a,null==e?void 0:e._dmService),Zt.isBoolean(a.isSystemDefaultPrinter)||(a.isSystemDefaultPrinter=!1)}return n}function Td(e,t){return function(e,t){var r=t.deviceType;t.name&&(t.name=Zt.base64.decode(t.name));r&Cl&&t.deviceInfo&&wd(t.deviceInfo);t.serviceInfo=null==e?void 0:e._dmService,Cd(t,null==e?void 0:e._dmService),Zt.isBoolean(t.isSystemDefaultPrinter)||(t.isSystemDefaultPrinter=!1);return t}(e,Zt.parse(t))}function Cd(e,t){var r,n=e.name,i="",o=e.deviceType;o==Tl.TWAINSCANNER?r="":o==Tl.TWAINX64SCANNER?r="Twain64-":o==Tl.WIASCANNER?r="WIA-":o==Tl.WIATWAINSCANNER?(n=Zt.replaceAll(n,"WIA-",""),r="WIATWAIN-"):r=o==Tl.ICASCANNER?"ICA-":o==Tl.SANESCANNER?"Sane-":o==Tl.ESCLSCANNER?"eSCL-":(Tl.WIFIDIRECTSCANNER,""),t&&t.attrs&&t.attrs.ty&&(i=" on ["+t.attrs.ty+"]"),e.displayName=[r,n,i].join("")}function wd(e){if(e.ProductName){var t=e.ProductName;e.ProductName=Zt.base64.decode(t)}if(e.ProductFamily){var r=e.ProductFamily;e.ProductFamily=Zt.base64.decode(r)}if(e.Manufacturer){var n=e.Manufacturer;e.Manufacturer=Zt.base64.decode(n)}if(e.Version&&e.Version.Info){var i=e.Version.Info;e.Version.Info=Zt.base64.decode(i)}}function Ed(e){var t=new Id;return t.strDevice=Zt.stringify(e),e.deviceInfo&&(t.deviceInfo=Zt.clone(e.deviceInfo)),e.deviceType&&(t.deviceType=Zt.clone(e.deviceType)),e.displayName&&(t.displayName=Zt.clone(e.displayName)),e.name&&(t.name=Zt.clone(e.name)),e.serviceInfo&&(t.serviceInfo=hd(e.serviceInfo)),Zt.isBoolean(e.isSystemDefaultPrinter)?t.isSystemDefaultPrinter=e.isSystemDefaultPrinter:t.isSystemDefaultPrinter=!1,t}Qt.removeNonPrintableChar;var kd=function(e){return e.SMF_NAME=1,e.SMF_TWAINVERSION=2,e.SMF_TWAINPROTOCOL=4,e.SMF_ICAUUID=8,e.SMF_ICAMODULEVERSION=16,e.SMF_ICALOCATIONTYPE=32,e}({}),Ad=function(e){return e.IT_BMP=0,e.IT_JPG=1,e.IT_TIF=2,e.IT_PNG=3,e.IT_PDF=4,e.IT_ALL=5,e.IT_MULTIPAGE_PDF=7,e.IT_MULTIPAGE_TIF=8,e.IT_J2K=14,e}({}),xd=function(e){return e.RGBA=15,e.Auto=16,e}({});function Pd(e){var t="application/octet-stream";switch(e){case Ad.IT_BMP:t="image/bmp";break;case Ad.IT_JPG:t="image/jpeg";break;case Ad.IT_TIF:t="image/tiff";break;case Ad.IT_PNG:t="image/png";break;case Ad.IT_PDF:t="application/pdf";break;case Ad.IT_J2K:t="image/jp2"}return t}var Dd={isSupportLS:function(){var e=!1;if(de.bEdge&&de.bFileSystem);else try{e=!!window.localStorage}catch(Mj){}return e},item:function(e,t,r){var n=null;return this.isSupportLS()?(t?(localStorage.setItem(e,t),n=t):n=localStorage.getItem(e),null===n?r:n):r},removeItem:function(e){return!!this.isSupportLS()&&(localStorage.removeItem(e),!0)}},Fd=!0,Wd=!1;function Rd(e){if(Zt.isUndefined(e))return Wd;var t,r,n,i=e.toString().toLowerCase(),o=(n=i.toLowerCase().replace(ia.name.toLowerCase()+" ",""),(n=Zt.replaceAll(n,"[.]",",")).split(","));t=ia.bActiveXEdition?Jo.ActiveXVersion:ia.getServerVersionInfo(!0),r=(t=Zt.replaceAll(String(t),"[.]",",")).split(",");for(var a=o.length>r.length?o.length:r.length,s=0;s<a;s++){if(null==o[s]&&(o[s]=0),null==r[s]&&(r[s]=0),parseInt(o[s])<parseInt(r[s]))return Wd;if(parseInt(o[s])>parseInt(r[s]))return Fd}return Fd}function Nd(e,t){var r=e.split(","),n=t.split(",");return r.length>1&&Zt.trim(r[0])==n[0]}function Od(e,t){var r=e.split(","),n=t.split(",");return r.length>3&&Zt.trim(r[0])==n[0]&&(Zt.trim(r[1])>n[1]||Zt.trim(r[1])==n[1]&&Zt.trim(r[2])>n[2]||Zt.trim(r[1])==n[1]&&Zt.trim(r[2])==n[2]&&parseInt(Zt.trim(r[3]))>=parseInt(n[3]))}function Md(e,t){Qt.detect.urls.splice(0),Qt.detect.urls.push({port:e,ssl:de.bSSL}),Qt.detect.ports=[{port:e,ssl:de.bSSL}],Qt.detect.cUrlIndex=0,na.detect.dwtPort=e,na.detect.dwtSSLPort=t,rr.DWT.Port=e,rr.DWT.SSLPort=t}function Ld(e,t,r){return Bd.apply(this,arguments)}function Bd(){return(Bd=n(g().mark((function e(t,r,n){var i,o,a;return g().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(!ia.bDCPChecked){e.next=2;break}return e.abrupt("return",{host:t,port:rr.DWT.Port,sslPort:rr.DWT.SSLPort});case 2:return Xu("Initializing the service..."),e.prev=3,e.next=6,Hd(t);case 6:i=e.sent,e.next=13;break;case 9:throw e.prev=9,e.t0=e["catch"](3),Zt.log(e.t0),Ds();case 13:if(!na.bEnhancedMode){e.next=27;break}if(Xu("Checking the service enhanced module..."),o=Qt.install._dlgInstall,a=500,o&&o.open||(a=0),!(i.port<=0||i.sslPort<=0)){e.next=25;break}if(!(a>0)){e.next=21;break}return e.next=21,new Qt.Promise((function(e,t){setTimeout((function(){e()}),a)}));case 21:return Xu($u),e.next=24,Ud(t);case 24:i=e.sent;case 25:e.next=28;break;case 27:i={host:t,port:r,sslPort:n};case 28:return ia.bDCPChecked=!0,e.abrupt("return",i);case 30:case"end":return e.stop()}}),e,null,[[3,9]])})))).apply(this,arguments)}function Ud(e){return Vd.apply(this,arguments)}function Vd(){return Vd=n(g().mark((function e(t){var r,n,i,o;return g().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:n=5,i=1500,o={host:t,port:0,sslPort:0},r=0;case 3:if(!(r<n)){e.next=22;break}return r>2&&(i=3e3),Xu($u),e.prev=6,e.next=9,jd(t);case 9:o=e.sent,e.next=14;break;case 12:e.prev=12,e.t0=e["catch"](6);case 14:if(!(Zt.isNumber(o.port)&&o.port>0&&Zt.isNumber(o.sslPort)&&o.sslPort>0)){e.next=17;break}return Md(o.port,o.sslPort),e.abrupt("return",o);case 17:return e.next=19,new Qt.Promise((function(e,t){setTimeout((function(){e()}),i)}));case 19:r++,e.next=3;break;case 22:throw Qt.detect.dcpStatus=3,Ds();case 25:case"end":return e.stop()}}),e,null,[[6,12]])}))),Vd.apply(this,arguments)}function jd(e){return Gd.apply(this,arguments)}function Gd(){return Gd=n(g().mark((function e(t){var r,n,i,o,a,s,u,c,l;return g().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return r=ia.refProductKey,Zt.startsWith(t,"wss://")||Zt.startsWith(t,"ws://")?i=t:(o=de.bSSL?na.SSLPort:na.Port,i=_d.getWsUrl(t,o,de.bSSL)),a={id:Zt.guid(),method:"GetPorts",version:"dwasm2_"+go(),parameter:[na.strSID]},Wc.isLongKey(r)&&(a.productKey=r),e.next=6,_d.postStringDataByWSUrl(i,Zt.stringify(a));case 6:if(s=e.sent,!Zt.isString(s)){e.next=19;break}if(e.prev=8,(u=Zt.parse(s))&&"result"in u&&(n=u.result),!(Zt.isArray(n)&&n.length>1&&n[1])){e.next=15;break}if(!(c=n[1]).dwt){e.next=15;break}return e.abrupt("return",{host:t,port:c.dwt.port,sslPort:c.dwt.sslPort});case 15:e.next=19;break;case 17:e.prev=17,e.t0=e["catch"](8);case 19:throw Cs(l={}),$s(l);case 22:case"end":return e.stop()}}),e,null,[[8,17]])}))),Gd.apply(this,arguments)}function Hd(e){return zd.apply(this,arguments)}function zd(){return(zd=n(g().mark((function e(t){var r,n;return g().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return na.detect.bConnected=!1,e.prev=1,e.next=4,Kd(t);case 4:return Qd(e.sent),na.detect.bConnected=!0,e.abrupt("return",{host:t,port:na.detect.dwtPort,sslPort:na.detect.dwtSSLPort});case 10:if(e.prev=10,e.t0=e["catch"](1),!e.t0){e.next=21;break}if(r=e.t0.code,!Zt.isNumber(r)){e.next=21;break}if(r!=_a.ResponseDataTypeError&&r!=_a.HTSTError&&r!=_a.CORSError&&r!=_a.CORSErrorFromService&&r!=_a.SSLCertExpired&&r!=_a.SSLCertInvalid){e.next=19;break}throw e.t0;case 19:if(r!=_a.MustUpgrade){e.next=21;break}throw e.t0;case 21:throw na.detect.dcpStatus=na.detect.EnumDCP_DetectStatus.NotInstalled,rr.dcp._sendStatusEvent(),Ts(n={}),{code:n._errorCode,message:n._errorString};case 26:case"end":return e.stop()}}),e,null,[[1,10]])})))).apply(this,arguments)}function Kd(e){return Jd.apply(this,arguments)}function Jd(){return(Jd=n(g().mark((function e(t){var r,n,i,o,a,s,u,c,l;return g().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return r=ia.refProductKey,Zt.startsWith(t,"wss://")||Zt.startsWith(t,"ws://")?i=t:(o=de.bSSL?na.SSLPort:na.Port,i=_d.getWsUrl(t,o,de.bSSL)),a={id:Zt.guid(),method:"VersionInfo",version:"dwasm2_"+oa.getVersionStrForCheck(),parameter:[]},Wc.isLongKey(r)&&(a.productKey=r),e.next=6,_d.postStringDataByWSUrl(i,Zt.stringify(a));case 6:if(s=e.sent,Zt.isString(s))try{(u=Zt.parse(s))&&"result"in u&&(n=u.result)}catch(d){}if(c={},!(Zt.isArray(n)&&n.length>0&&n[0])){e.next=21;break}if(l=n[0],!Zt.isString(l)||""==l){e.next=21;break}if(!Nd(l,ia.getServerVersionInfo(!0))){e.next=18;break}return na.detect.dcpStatus=na.detect.EnumDCP_DetectStatus.UpdateSkipped,rr.dcp._sendStatusEvent(),e.abrupt("return",n);case 18:throw Xu(ec),Ca(c),$s(c);case 21:throw Cs(c),$s(c);case 23:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function Qd(e){var t="",r=!1,n=!1,i={};if(e.length>4&&(t=Zt.isString(e[2])?e[2]:"",r=Zt.isString(e[3])&&"true"===e[3],n=Zt.isString(e[4])&&"64"===e[4]),e.length>5&&(i=e[5]),na.detect.connectedResult=e,na.strSID=t,na.bEnhancedMode=r,na.b64bit=n,na.objEnhancedPorts=i,r&&i){if(i.dcp){var o=i.dcp;na.SSLPort=o.sslPort,na.Port=o.port}if(i.ddm){var a=i.ddm;a?de.bSSL?na.detect.ddmPort=a.sslPort:na.detect.ddmPort=a.port:na.detect.ddmPort=0}if(rr.DWT.Port=0,rr.DWT.SSLPort=0,i.dwt){var s=i.dwt;s&&s.port>0&&s.sslPort>0&&Md(s.port,s.sslPort)}}}function qd(e,t){(function(e,t){if(t.has(e))throw new TypeError("Cannot initialize the same private elements twice on an object")})(e,t),t.add(e)}function Yd(e,t,r){if("function"==typeof e?e===t:e.has(t))return arguments.length<3?t:r;throw new TypeError("Private element is not present on this object")}rr.DWT.NetManager.checkModuleManager=function(e,t){Hd(qo()).then(e,t)};var Xd=new WeakSet,Zd=function(e){function t(e){var r;return o(this,t),qd(r=i(this,t,[e]),Xd),r._acquireDivEL=null,r.__serverId="",r.__bAcquireImageNow=di,r._blts=ua(),r._bltsCopyImage=!1,r._b64bit=na.b64bit,r._logLevel=0,r._bServerAlwaysFocusOnPopupWindow=fi,r._bPageFocus=fi,r.__bOpenFileNow=di,r._bScanForProxyRemote=di,r}return f(t,e),s(t,[{key:"_isValid",value:function(){return!this._destroy||(os(this),!1)}},{key:"_connnect",value:(A=n(g().mark((function x(){var e;return g().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return e=this,t.abrupt("return",new Qt.Promise((function(t,r){var n,i;n=e._serverInfo.server,i=e._serverInfo.port,rr.DWT.CheckConnectToTheService(n,i,t,r)})));case 2:case"end":return t.stop()}}),x,this)}))),function(){return A.apply(this,arguments)})},{key:"_waitForConnect",value:function(){var e=this;return e._wsRetry=0,e._bReady?Qt.Promise.resolve():new Qt.Promise((function(t,r){e._wsCheckResolve=t,e._wsCheckReject=r,of(e)}))}},{key:"_getWSCallback",value:function(){return af}},{key:"_getWSContextData",value:function(){return{}}},{key:"_additionalWSCallback",value:function(e,t,r,n){"ConvertToBlob"==e&&t._blob_callbacks.push((function(e){return r(e,ru.HANDLE_RAW_MESSAGE,"0",n)}))}},{key:"_innerSendBlobByWS",value:function(e,t,r,n,i){var o={cmd:e,cmdId:Pl(),sFun:function(e){Zt.isFunction(n)&&n(e)},fFun:i,contextData:{document:r.currentFileName,tag:r.currentTagName,bNeedClearTag:r.bNeedClearCurrentTagName,index:r.index,bNeedRefresh:"UpdateImage"==e},rawData:!0};return this._innerSendByWS(e,t,o,r,!0)}},{key:"_innerSendByWS",value:function(e,t,r,n,i){var o,a,s,u,c=this,l=this._getWSCallback();r&&r.cmdId?(o=r.cmdId,s=nf(c._clientId,o),u=nf(c._clientId,"")):(o=0,s=0,u=0);var d=rf(c._clientId,e,t,o,c._bScanForProxyRemote),f=c._wsClient;a={client:f,userData:{stwain:c,command:r},taskId:o,eventTaskId:s,lastEventTaskId:u};var h,g,m,p,v,_,y,S,I=0;if(!i){try{f.request(d,l,a)}catch(Mj){Zt.log(Mj)}return di}if(m=new ArrayBuffer(12),n)if(n instanceof Blob)I=n.size;else if(n instanceof ArrayBuffer||n instanceof Uint8Array)I=n.byteLength;else if(n instanceof Array)I=n.length;else{var b=n;I=b.size||b.byteLength||b.length}for(g=(h=(y=new Blob([d])).size)+I,p=new DataView(m),_=0;_<8&&g;_++)p.setUint8(_,g%256),g=Math.floor(g/256);for(_=0;_<4&&h;_++)p.setUint8(8+_,h%256),h=Math.floor(h/256);return v=new Blob([m,y]),S=f.request(v,l,a),this._additionalWSCallback(e,f,l,a),I>0&&(S=f.request(n,l,a)),m=null,y=null,v=null,p=null,n=null,S}},{key:"_sendDataConnectWithSocket",value:function(e,t,r,n){var i=this;return new Qt.Promise((function(r,o){i._sendData(e,t,!0,(function(e){var t=!1;try{t=Zt.isString(e)?Zt.parse(e):e}catch(Mj){}if(i._resetErr(),t){if(t instanceof Blob||bl(t))return void r(t);eu(t)&&(i._errorCode=t.exception,i._errorString=t.description)}r(n?t:t.result)}),(function(e){o({code:i._errorCode,message:i._getErrorString()})}))}))}},{key:"_sendDataByHttpAsync",value:function(e,r,n,i,o){var a,s=this;if(s._resetErr(),!s._isValid())return Qt.Promise.reject({code:s._errorCode,message:s._getErrorString()});if(t.isServerInvalid(s))return o?Qt.Promise.reject({code:s._errorCode,message:s._getErrorString()}):s._waitForConnect().then((function(){return s._sendDataByHttpAsync(e,r,n)}));if(rr.DWT.ConnectWithSocket)return s._sendDataConnectWithSocket(e,r,n,i);a={method:"post",async:!0,body:rf(s._clientId,e,r,0,s._bScanForProxyRemote),dataType:null!=n?n:"text"};var u=null,c=Zt.guid();return s._bIfShowProgressBar&&(u=Qt.progressContext),Gs(u,c)([s._httpUrl,"fa/",e].join(""),a).then((function(e){var t=!1;try{t=Zt.isString(e)?Zt.parse(e):e}catch(Mj){}if(t){if(t instanceof Blob||bl(t))return t;if(!eu(t))return s._resetErr(),i?t:t.result;s._errorCode=t.exception,s._errorString=t.description}else Aa(s);throw{code:s._errorCode,message:s._getErrorString()}}),(function(e){if(s._errorCode=e.code,s._errorString=e.message,!Qt.page.bUnload)throw e}))}},{key:"_sendData",value:function(e,r,n,i,o){var a=this,s=null,u=null,c=!1,l=!0;if(!a._destroy){if("ActiveUI"==e?l=!1:c=t.isServerInvalid(a),c)return a._waitForConnect().then((function(){a._sendData(e,r,n,i,o)}))["catch"]((function(e){Zt.isFunction(o)&&o(e.code,e.message)}));var d;Zt.isFunction(i)&&(u=i),Zt.isFunction(o)&&(s=o),d="ConvertToBlob"==e||"Heartbeat"==e?0:Pl();var f=this._getWSContextData(),h={cmd:e,cmdId:d,sFun:u,fFun:s,contextData:f,rawData:null!=n&&n};return a._innerSendByWS(e,r,h,null,l)}}},{key:"_innerFunV2",value:(k=n(g().mark((function P(e,t,r){var n,i,o;return g().wrap((function(a){for(;;)switch(a.prev=a.next){case 0:if(n=this,!(o=r)&&!Zt.isUndefined(o)){a.next=7;break}return a.next=4,n._sendDataConnectWithSocket(e,t,"json",!0);case 4:i=a.sent,a.next=10;break;case 7:return a.next=9,n._sendDataByHttpAsync(e,t,"json",!0);case 9:i=a.sent;case 10:if(!(i&&Zt.isArray(i)&&i.length>0)){a.next=12;break}return a.abrupt("return",i[0]);case 12:if(!(i&&Zt.isArray(i.result)&&i.result.length>0)){a.next=14;break}return a.abrupt("return",i.result[0]);case 14:return a.abrupt("return",i);case 15:case"end":return a.stop()}}),P,this)}))),function(e,t,r){return k.apply(this,arguments)})},{key:"_OnReady",value:(E=n(g().mark((function D(){var e,t;return g().wrap((function(r){for(;;)switch(r.prev=r.next){case 0:if((e=this)._wsRetry=0,e._wsFailedTimes=0,Qt.detect.starting=!1,e._bRemoteMode||(Qt.detect.bOK=!0),e._bReady=!0,null!==(t=e._wsClient.ws)){r.next=9;break}return r.abrupt("return");case 9:t.onopen=null,e._wsClient.addEvent("close",e._clientId,(function(t){t&&Zt.log("websocket close: "+t),e.__bAcquireImageNow=!1,e._OnWSClose(t)})),e._wsClient.addEvent("error",e._clientId,(function(t){t&&Zt.log("websocket error: "+t),e.__bAcquireImageNow=!1,e._OnWSError(t)})),e._wsClient.addEvent("timeout",e._clientId,(function(t){t&&Zt.log("websocket timeout: "+t),e._OnWSTimeout(t)}));case 13:case"end":return r.stop()}}),D,this)}))),function(){return E.apply(this,arguments)})},{key:"getServiceInfo",value:function(){return this._dmService}},{key:"_OnWSClose",value:function(e){var r,n,i,o=this;(o._bReady=!1,o._wsRetry=0,o._bRemoteMode)&&(r=null!==(n=null===(i=o.getServiceInfo())||void 0===i||null===(i=i.attrs)||void 0===i?void 0:i.name)&&void 0!==n?n:"");ms(o,r),o.__closeRemoteScanUI(!0),o._heartBeatTimer&&(clearTimeout(o._heartBeatTimer),o._heartBeatTimer=null),o._bNoMask||function(e){Zt.log("hideMask:"+e+"--"+Fl),ml(),Fl=0}("websocket close"),o.__OnWSClose&&o.__OnWSClose();var a=o._bRemoteMode?oa.RemoteReconnectMaxTimes:oa.LocalReconnectMaxTimes;if(o._wsFailedTimes<a){var s=o._reconnectTimeSpan;o._wsFailedTimes<o._reconnectShortSpanTimes&&(s=o._reconnectShortSpan),o._heartBeatTimer=setTimeout((function(){t.startDWTReconnect(o)}),s)}}},{key:"_OnWSError",value:function(e){var t=this;t._bReady=!1,t.__OnWSError&&t.__OnWSError()}},{key:"_OnWSTimeout",value:function(e){var r,n,i,o=this;(o._bReady=!1,o._wsRetry=0,o._bRemoteMode)&&(r=null!==(n=null===(i=o.getServiceInfo())||void 0===i||null===(i=i.attrs)||void 0===i?void 0:i.name)&&void 0!==n?n:"");ms(o,r),o.__closeRemoteScanUI(!0),o._heartBeatTimer&&(clearTimeout(o._heartBeatTimer),o._heartBeatTimer=null);var a=o._bRemoteMode?oa.RemoteReconnectMaxTimes:oa.LocalReconnectMaxTimes;if(o._wsFailedTimes<a){var s=o._reconnectTimeSpan;o._wsFailedTimes<o._reconnectShortSpanTimes&&(s=o._reconnectShortSpan),o._heartBeatTimer=setTimeout((function(){t.startDWTReconnect(o)}),s)}}},{key:"__OnRecieveMsg",value:function(e,t){var r=this;if(e.event)return r._handleEvent(e,t.contextData);if(eu(e)?(r._errorCode=e.exception,r._errorString=e.description):(r._errorCode=0,r._errorString=""),rr.DWT.ConnectWithSocket){var n=e,i=null==t?void 0:t.cmd;return"ActiveUI"==i||"VersionInfo"==i||"ConvertToBase64"==i||"SaveSelectedImagesToBase64Binary"==i||"ConvertToBlob"==i?t.sFun&&Zt.isArray(e.result)&&e.result.length>0?(t.sFun(e.result),!0):(t.fFun&&t.fFun(e.result),!1):(0!=r._errorCode&&t.fFun&&t.fFun(r._errorString),"BeginSaveMem"==i||"CreateLocalStorage"==i||"LocalStorageExist"==i||"SaveToLocalStorage"==i||"LoadFromLocalStorage"==i||"RemoveLocalStorage"==i?t.sFun&&Zt.isArray(e.result)&&e.result.length>0?(t.sFun(e.result),!0):(t.fFun&&t.fFun(e.result),!1):(n=t.rawData?e:Zt.isArray(e.result)&&e.result.length>0?e.result[0]:e.result,t.sFun?t.sFun(n):t.fFun&&t.fFun(n),e=null,!0))}if(0==r._errorCode)return t.sFun&&Zt.isArray(e.result)&&e.result.length>0?(t.sFun(e.result),!0):(t.fFun(e.result),!0);var o=!1;t.fFun&&(o=t.fFun(r._errorString)),!o&&e.exception&&e.exception<0&&-2115!=e.exception&&Zt.isFunction(r.__OnPrintMsg)&&r.__OnPrintMsg(r._errorString)}},{key:"_handleOnBitmapChangedEvent",value:function(e,t){try{var r,n,i,o,a,s,u,c,l,d,f,h,g,m,p,v,_=e.result[0],y=e.result[1];if(Zt.isString(y)){var S=JSON.parse(y);r=Zt.isArray(S)?S:[S]}else Zt.isArray(y)&&(r=y);if(Zt.isArray(r))for(v=t||{},m=0;m<r.length;m++)if(p=r[m],Zt.isArray(p.images))if(n=p.consumeType,i=p.curImageId,o=p.type,a=p.images.length,o!=df.enumBCAppend&&o!=df.enumBCInsert||(!v.document&&p.document&&(v.document=p.document),!v.tag&&p.tag&&(v.tag=p.tag)),o==df.enumBCRemove){var I=[];for(s=0;s<a;s++)I.push(p.images[s].id);var b=[_,I.join(","),o,i,a,null,null,null,null,null,null,c];this._OnBitmapChanged(b,e,v)}else for(s=0;s<a;s++){u=p.images[s].id,d=p.images[s].width,f=p.images[s].height,l=p.images[s].depth,h=p.images[s].xdpi,g=p.images[s].ydpi,c=p.images[s].uid;var T=[_,u.toString(),o,i,a,d,f,l,h,g,n,c];this._OnBitmapChanged(T,e,v)}}catch(C){Ho(C)}return fi}},{key:"_handleEvent",value:function(e,t){var r=this,n=e.result[0],i=di;return"OnBitmapChanged"==e.event?r._handleOnBitmapChangedEvent(e,t):(Zt.each(ff,(function(t,n){if(e.event===t){var o=["_",t].join("");return i=fi,Zt.isFunction(r[o])&&r[o](e.result,e),di}})),i?(Zt.log("handled event:"+e.event),Zt.each(hf,(function(t,i){if(e.event===t)return Zt.log("sendback event:"+e.event),r._innerSendByWS(e.event,Il(n),null,null,fi),di}))):(Zt.each(Qt.Addon_Events,(function(t,n){if(e.event===t){var o=["_",t].join("");return i=fi,Zt.isFunction(r[o])&&r[o](e.result),di}})),i&&(Zt.log("handled addon event:"+e.event),Zt.each(Qt.Addon_Sendback_Events,(function(t,i){if(e.event===t)return Zt.log("sendback addon event:"+e.event),r._innerSendByWS(e.event,Il(n),null,null,fi),di})))),i)}},{key:"_setProductKeyAsync",value:function(e){var t=this,r=e;return t._resetErr(),t._isValid()?ia.bUseDynamsoftLicenseManager||t._blts?(Us(t),Qt.Promise.reject({code:t._errorCode,message:t._getErrorString()})):Zt.isString(r)?Wc.isLicenseMixed(r,!1)?Qt.Promise.reject(rr.DWT.licenseException):Wc.isLongKey(r)?Yd(Xd,t,$d).call(t,r).then((function(e){var r=e;if(!r||r.message)throw La(t),r&&r.message&&(t._errorString=r.message),{code:t._errorCode,message:t._getErrorString()};return od(t,r),r})):(La(t),Qt.Promise.reject({code:t._errorCode,message:t._getErrorString()})):(La(t),Qt.Promise.reject({code:t._errorCode,message:t._getErrorString()})):Qt.Promise.reject({code:t._errorCode,message:t._getErrorString()})}},{key:"_setLTSLic",value:function(e){var t=this,r=e;return t._resetErr(),!!t._isValid()&&(Zt.isString(r)?t._sendDataByHttpAsync("LTSLicense",Il(r),null,!0).then((function(e){if(e){if(eu(e))throw t._errorCode=e.exception,t._errorString=e.description,{code:t._errorCode,message:t._getErrorString()};return t._innerFunV2("GetLicenseInfo",Il(0))}throw La(t),{code:t._errorCode,message:t._getErrorString()}})):(La(t),Qt.Promise.reject({code:t._errorCode,message:t._getErrorString()})))}},{key:"_setLTSLicenseAsync",value:function(e){var t=this;return t._resetErr(),t._isValid()?Zt.isString(e)?t._setLTSLic(e).then((function(e){var r=e;if(!r||r.message)throw La(t),r&&r.message&&(t._errorString=r.message),{code:t._errorCode,message:t._getErrorString()};return od(t,r),t.__licenseInfo&&(t.__licenseInfo.LTS=!0),r})):(La(t),Qt.Promise.reject({code:t._errorCode,message:t._getErrorString()})):Qt.Promise.reject({code:t._errorCode,message:t._getErrorString()})}},{key:"_innerActiveUI",value:(w=n(g().mark((function F(e){var t,r,n,i,o;return g().wrap((function(a){for(;;)switch(a.prev=a.next){case 0:return t=this,r=Qt.detect.ssl,n=Yo(),t._bRemoteMode||(n=5),i="",t._blts&&(i=null!=e?e:""),a.next=6,new Qt.Promise((function(e,o){t._sendData("ActiveUI",Il(ko.WSVersion,ko.WSSession,1,i,r,1,n),!1,e,o)}));case 6:return o=a.sent,t=null,a.abrupt("return",o);case 9:case"end":return a.stop()}}),F,this)}))),function(e){return w.apply(this,arguments)})},{key:"_reconnected",value:(C=n(g().mark((function W(e){var r,n,i,o,a,s,u,c;return g().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return(r=this)._wsFailedTimes=0,e.next=4,r._innerActiveUI(r._uuidForActiveUI);case 4:if(n=e.sent,i=!1,n&&(n.length>12?(r.__serverId=n[1],i=n[12]):n.length>8?(r.__serverId=n[1],i=n[8]):n.length>=2&&(r.__serverId=n[1])),r._bReady=!0,r._bRemoteMode||(Qt.detect.bOK=!0),Qt.detect.starting=!1,i){try{r._OnActiveUIClearBuffer()}catch(l){r._resetErr()}ha(r,-2614,"The Dynamsoft Service has been restarted.")}if(e.prev=11,!r._blts){e.next=21;break}return o=r._bRemoteMode&&null!==(a=null===(s=r._dmService)||void 0===s||null===(s=s.attrs)||void 0===s?void 0:s.UUID)&&void 0!==a?a:"",e.next=16,$l(rr.DWT.lgdt(),o);case 16:return u=e.sent,e.next=19,r._setLTSLicenseAsync(u.ar);case 19:e.next=24;break;case 21:return c=ia.refProductKey,e.next=24,r._setProductKeyAsync(c);case 24:return e.next=26,r._OnReconnected();case 26:e.next=32;break;case 28:throw e.prev=28,e.t0=e["catch"](11),r._bRemoteMode&&Ua(r),{code:r._errorCode,message:r._errorString};case 32:return e.prev=32,r._bRemoteMode&&t.startHeartBeat(r),e.finish(32);case 35:case"end":return e.stop()}}),W,this,[[11,28,32,35]])}))),function(e){return C.apply(this,arguments)})},{key:"_OnReconnected",value:(T=n(g().mark((function R(){return g().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:case"end":return e.stop()}}),R)}))),function(){return T.apply(this,arguments)})},{key:"_initRemoteDiv",value:function(){if(!this._acquireDivEL){var e=document.createElement("div");e.style.position="fixed",e.style.zIndex="510000",e.style.left="0",e.style.top="0";var t=document.createElement("img");t.className="ds-img-screen",e.appendChild(t),document.body.appendChild(e),this._acquireDivEL=e}}},{key:"getHeartBeatData",value:function(e){var t,r=rf(this._clientId,e.cmd,null,e.cmdId,this._bScanForProxyRemote),n=r.length,i=n,o=new ArrayBuffer(12+i),a=new DataView(o);for(t=0;t<8&&i;t++)a.setUint8(t,i%256),i=Math.floor(i/256);for(t=0;t<4&&n;t++)a.setUint8(8+t,n%256),n=Math.floor(n/256);for(t=0;t<r.length;t++)a.setUint8(12+t,r.charCodeAt(t));return o}},{key:"__closeRemoteScanUI",value:function(e){var t=this;if(t._acquireDivEL){var r=Zt.sizzle(".ds-img-screen");t._acquireDivEL.evtFun?(r&&r.length>0&&Zt.removeEventListener(r[0],"mouseup",t._acquireDivEL.evtFun),t._acquireDivEL.evtFun=null):r&&r.length>0&&Zt.removeEventListener(r[0],"mouseup"),r&&r.length>0&&(r[0].src=""),e&&(document.body.removeChild(t._acquireDivEL),t._acquireDivEL=null)}}},{key:"_removeImageByIdAsync",value:(b=n(g().mark((function N(e){var t;return g().wrap((function(r){for(;;)switch(r.prev=r.next){case 0:if((t=this)._resetErr(),t._isValid()){r.next=4;break}throw{code:t._errorCode,message:t._errorString};case 4:return r.next=6,t._innerFunV2("RemoveAllImages",Il(e));case 6:return r.abrupt("return",r.sent);case 7:case"end":return r.stop()}}),N,this)}))),function(e){return b.apply(this,arguments)})},{key:"_removeAllImagesAsync",value:(I=n(g().mark((function O(e,t){var r;return g().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if((r=this)._resetErr(),r._isValid()){e.next=4;break}throw{code:r._errorCode,message:r._getErrorString()};case 4:return e.next=6,r._innerFunV2("RemoveAllImages");case 6:return e.abrupt("return",e.sent);case 7:case"end":return e.stop()}}),O,this)}))),function(e,t){return I.apply(this,arguments)})},{key:"_LicensePromptExpired",value:function(){}},{key:"_OnActiveUI",value:(S=n(g().mark((function M(e){var r,n,i,o,a,s,u,c,l,d,f,h,m,p,v,_,y;return g().wrap((function(g){for(;;)switch(g.prev=g.next){case 0:if(r=this,i=!1,e&&e.length>=6?(e[2],n=e[5],o=!1,a=!1,s=0,e.length>12?(e[6],r._b64bit="64"==e[7],e[8],o=e[9],a=e[10],s=e[11],e[12]):e.length>8&&(o=e[6],a=e[7],s=e[8]),o?a&&s&&(r._bRemoteMode=!0):r._bRemoteMode=!0,Zt.isString(n)&&("win"==n?r.__serverPlatform=Lo.enumWindow:"linux"==n?r.__serverPlatform=Lo.enumLinux:"mac"==n?r.__serverPlatform=Lo.enumMac:"embed"==n?r.__serverPlatform=Lo.enumEmbed:"chromeos"==n&&(r.__serverPlatform=Lo.enumChromeOS))):i=!0,r._bMustUpgradeService=i,i){g.next=67;break}if(Xu("Activating the WebTwain instance..."),u=!1,!r._blts){g.next=44;break}return l=r._bRemoteMode&&null!==(d=null===(f=r._dmService)||void 0===f||null===(f=f.attrs)||void 0===f?void 0:f.UUID)&&void 0!==d?d:"",g.prev=10,g.next=13,$l(rr.DWT.lgdt(),l);case 13:c=g.sent,g.next=27;break;case 16:if(g.prev=16,g.t0=g["catch"](10),id(r,g.t0),h=cd(r._errorCode),!r._bLicenseErrorDispose){g.next=25;break}throw r._bRemoteMode||(h?this._LicensePromptExpired():dd(r)),{code:r._errorCode,message:r._errorString};case 25:h||Zt.warn(r._errorString),c=null;case 27:if(Xu(tc),!c){g.next=41;break}return g.next=31,r._setLTSLicenseAsync(c.ar);case 31:return m=g.sent,rr.DWT.laddDWTObj(r),l="",r._bRemoteMode&&(l=null!==(p=null===(v=r._dmService)||void 0===v||null===(v=v.attrs)||void 0===v?void 0:v.UUID)&&void 0!==p?p:""),Xu(rc),g.next=38,rr.DWT.lcheckLic(rr.DWT.lgdt(),m,l);case 38:u=0==rr.DWT.licenseException.code,g.next=42;break;case 41:u=!1;case 42:g.next=62;break;case 44:return Xu(tc),_=ia.refProductKey,g.prev=46,g.next=49,r._setProductKeyAsync(_);case 49:g.sent&&(u=!0),g.next=62;break;case 53:if(g.prev=53,g.t1=g["catch"](46),!r._bLicenseErrorDispose){g.next=60;break}throw r._bRemoteMode||ud(g.t1.code)&&ld(g.t1),g.t1;case 60:Zt.warn(g.t1.message);case 61:u=!1;case 62:if(u&&(Xu(rc),Wc.checkProductKey(r,{Core:!0})||(y={code:r._errorCode,message:r._getErrorString()},r._resetErr(),rr.DWT.lclex(),de.bWin&&Wc.checkProductKey(r,{Webcam:!0},!0)||(r._errorCode=y.code,r._errorString=y.message))),0==r._errorCode){g.next=67;break}if(r._bRemoteMode||(cd(r._errorCode)?this._LicensePromptExpired():dd(r)),!r._bLicenseErrorDispose){g.next=67;break}throw{code:r._errorCode,message:r._getErrorString()};case 67:r._bRemoteMode&&t.startHeartBeat(r);case 68:case"end":return g.stop()}}),M,this,[[10,16],[46,53]])}))),function(e){return S.apply(this,arguments)})},{key:"_innerConvertToArrayBufferAsync",value:(y=n(g().mark((function L(e,t,r,n){var i,o,a,s,u;return g().wrap((function(c){for(;;)switch(c.prev=c.next){case 0:return i=this,o=r,a=null!=n?n:"arraybuffer",s=",",Zt.isString(o)&&""!=o||(o="",s=""),u=["[",e,',"',t.join(","),'"',s,o,"]"].join(""),c.next=6,i._sendDataByHttpAsync("ConvertToBlob",u,a,!0);case 6:return c.abrupt("return",c.sent);case 7:case"end":return c.stop()}}),L,this)}))),function(e,t,r,n){return y.apply(this,arguments)})},{key:"_getImageByServerId",value:(_=n(g().mark((function B(e){var t,r,n;return g().wrap((function(i){for(;;)switch(i.prev=i.next){case 0:return t=Ad.IT_PNG,i.next=3,this._innerConvertToArrayBufferAsync(t,[e],void 0,void 0);case 3:return r=i.sent,n=Pd(t),i.abrupt("return",new Blob([r],{type:n}));case 6:case"end":return i.stop()}}),B,this)}))),function(e){return _.apply(this,arguments)})},{key:"_getSourcesAsync",value:(v=n(g().mark((function U(e,t,r){var n,i;return g().wrap((function(o){for(;;)switch(o.prev=o.next){case 0:return n=this,o.next=3,n._innerFunV2("GetSources",Il(e,null!=t&&t,null!=r&&r));case 3:return i=o.sent,o.abrupt("return",bd(this,i));case 5:case"end":return o.stop()}}),U,this)}))),function(e,t,r){return v.apply(this,arguments)})},{key:"_getDevices",value:(p=n(g().mark((function V(e,t,r){var n,i,o,a,s,u;return g().wrap((function(c){for(;;)switch(c.prev=c.next){case 0:if(i=[],o="getDevices",a=(n=this)._bRemoteMode?wl:de.bAndroid?kl:wl,s=null!=e?e:a,n._resetErr(),n._isValid()){c.next=5;break}return c.abrupt("return",Qt.Promise.reject({code:n._errorCode,message:n._getErrorString()}));case 5:return n._bNoMask||Wl(o,n),c.prev=6,c.next=9,n._getSourcesAsync(s,t,r);case 9:u=c.sent,Zt.isArray(u)&&u.length>0&&(i=i.concat(u)),c.next=16;break;case 13:throw c.prev=13,c.t0=c["catch"](6),c.t0;case 16:return c.prev=16,n._bNoMask||Rl(o),c.finish(16);case 19:return c.abrupt("return",i);case 20:case"end":return c.stop()}}),V,this,[[6,13,16,19]])}))),function(e,t,r){return p.apply(this,arguments)})},{key:"_innerAcquireImageFromService",value:function(e,t,r){var n,i,o=this;if(i=Zt.clone(e),!Wc.checkProductKey(o,{Core:!0}))return Zt.isFunction(r)&&r(o._errorCode,o._getErrorString()),!1;var a=o._bRemoteMode?fi:di;i.RemoteScan=a?1:0,o._bRemoteMode&&(Zt.isFunction(o.__OnRemoteScanStatusAsync)||(o.__OnRemoteScanStatusAsync=function(){}),Zt.isFunction(o.__OnSourceUIClose)||(o.__OnSourceUIClose=function(){}));for(var s=0,u=0;u<lf.length;u++){var c=["__",lf[u]].join("");Zt.isFunction(o[c])&&(s|=1<<u)}return i.EnableEvents=s,a&&o._isBindViewer()&&o._initRemoteDiv(),o._bRemoteMode||(o._bPageFocus&&rr.DWT.IfAlwaysFocusOnPopupWindow?o._bServerAlwaysFocusOnPopupWindow||o._OnPageFocus(!0):o._bServerAlwaysFocusOnPopupWindow&&o._OnPageBlur(!0)),n=["[",Zt.stringify(i),"]"].join(""),o._sendData("AcquireImage",n,!0,(function(e){t(e)}),(function(e){r(o._errorCode,o._getErrorString())})),!0}},{key:"_canConsume",value:function(){return this._blts&&!this._bltsCopyImage}},{key:"_acquireImageFromServiceAsync",value:function(e){var t=this;return new Qt.Promise((function(r,n){return t._innerAcquireImageFromService(e,(function(){t._canConsume()&&rr.DWT.lcvrf(t),r(!0)}),(function(e,t){n({code:e,message:t})}))}))}},{key:"_acquireImage",value:(m=n(g().mark((function j(e,t){var r,n,i,o,a;return g().wrap((function(s){for(;;)switch(s.prev=s.next){case 0:if(r=this,n=t?Zt.clone(t):{},i="acuqireImage",r._resetErr(),r._isValid()){s.next=4;break}throw{code:r._errorCode,message:r._getErrorString()};case 4:if(Wc.checkProductKey(r,{Core:!0})&&r._isValid()){s.next=6;break}throw{code:r._errorCode,message:r._getErrorString()};case 6:if(!r.__bAcquireImageNow){s.next=9;break}throw Ta(r),{code:r._errorCode,message:r._getErrorString()};case 9:return r.__bAcquireImageNow=!0,r._bNoMask||Wl(i,r),o=rr.DWT.RemoteScanConfig,a=xo(),s.prev=12,uf(n),o&&Po(o.keepAwake),null!=e&&(n.Device=e.strDevice,n.DeviceMatchField=kd.SMF_NAME),s.next=18,r._acquireImageFromServiceAsync(n);case 18:s.next=23;break;case 20:throw s.prev=20,s.t0=s["catch"](12),s.t0;case 23:return s.prev=23,r.__bAcquireImageNow=!1,r._bNoMask||Rl(i),Po(a),s.finish(23);case 28:return s.abrupt("return",!0);case 29:case"end":return s.stop()}}),j,this,[[12,20,23,28]])}))),function(e,t){return m.apply(this,arguments)})},{key:"_getCapabilities",value:(h=n(g().mark((function G(e,t,r){var n,i,o,a,s;return g().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return i=null,Yd(Xd,n=this,ef).call(n,e),n._initRemoteDiv(),t.next=5,n._innerSelectDeviceAsync(e);case 5:return Zt.isArray(r)&&(i=Il(r)),t.next=8,n._sendDataByHttpAsync("GetCapabilities",i);case 8:if(o=t.sent,t.prev=9,o.length>0&&(s=o[0]),!Zt.isString(s)){t.next=22;break}if(s=Qt.removeNonPrintableChar(s),s=Zt.replaceAll(s,"\\\\","\\\\"),0!=(a=JSON.parse(s)).errorCode){t.next=17;break}return t.abrupt("return",a.response);case 17:throw n._errorCode=a.errorCode,n._errorString=a.errorString,{code:n._errorCode,message:n._getErrorString()};case 22:throw Cs(n),{code:n._errorCode,message:n._getErrorString()};case 24:t.next=31;break;case 26:throw t.prev=26,t.t0=t["catch"](9),n._errorCode=-2302,n._errorString=t.t0,{code:n._errorCode,message:n._getErrorString()};case 31:case"end":return t.stop()}}),G,this,[[9,26]])}))),function(e,t,r){return h.apply(this,arguments)})},{key:"_setCapabilities",value:(d=n(g().mark((function H(e,t,r){var n,i;return g().wrap((function(r){for(;;)switch(r.prev=r.next){case 0:if(Yd(Xd,n=this,ef).call(n,e),Zt.isObject(t)&&!Zt.isArray(t)){r.next=5;break}throw rs(n),{code:n._errorCode,message:n._getErrorString()};case 5:return n._initRemoteDiv(),r.next=8,n._innerSelectDeviceAsync(e);case 8:return i=["[",Zt.stringify(t),"]"].join(""),r.next=11,n._sendDataByHttpAsync("SetCapabilities",i);case 11:return r.abrupt("return",r.sent);case 12:case"end":return r.stop()}}),H,this)}))),function(e,t,r){return d.apply(this,arguments)})},{key:"_closeSource",value:(l=n(g().mark((function z(){var e;return g().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return e=this,t.next=3,e._innerFunV2("CloseSource");case 3:case"end":return t.stop()}}),z,this)}))),function(){return l.apply(this,arguments)})},{key:"_innerSelectDeviceAsync",value:(c=n(g().mark((function K(e,t){var r,n,i,o,a,s,u,c;return g().wrap((function(l){for(;;)switch(l.prev=l.next){case 0:if(n=this,e&&e instanceof Id){l.next=4;break}throw rs(n),{code:n._errorCode,message:n._errorString};case 4:if(!(i=null===(r=this._dmService.attrs)||void 0===r?void 0:r.UUID)){l.next=17;break}if((null===(o=e.serviceInfo.attrs)||void 0===o?void 0:o.UUID)!=i){l.next=10;break}l.next=17;break;case 10:if(!((s=(null===(a=e.serviceInfo.attrs)||void 0===a?void 0:a.url)||e.serviceInfo.server)&&s.indexOf(i)>-1)){l.next=15;break}l.next=17;break;case 15:throw hs(n),{code:n._errorCode,message:n._errorString};case 17:return u=null!=t?t:kd.SMF_NAME,c=["[",e.strDevice,",",u,"]"].join(""),l.next=20,n._innerFunV2("SelectSourceEx",c);case 20:return l.abrupt("return",l.sent);case 21:case"end":return l.stop()}}),K,this)}))),function(e,t){return c.apply(this,arguments)})},{key:"registerEvent",value:function(e,t){return Zt.isUndefined(e)?(Oa(this),!1):!Zt.isString(e)||Zt.isString(e)&&0==e.trim().length||Zt.isUndefined(t)||!Zt.isFunction(t)?(rs(this),!1):!!this._registerEvent(e,t)}},{key:"unregisterEvent",value:function(e,t){return this._unregisterEvent(e,t)}},{key:"_registerEvent",value:function(e,t){var r=this;return r._resetErr(),!!r._isValid()&&(r[["__",e].join("")]=t,!0)}},{key:"_unregisterEvent",value:function(e,t){var r=this;return r._resetErr(),!!r._isValid()&&(r[["__",e].join("")]=null,fi)}},{key:"_OnPageFocus",value:function(e){var t=this;if(t._bPageFocus=!0,t._bReady&&de.bWin&&rr.DWT.IfAlwaysFocusOnPopupWindow){var r=Zt.stringify({sequence:0,wnds:0,wnd:"0",type:3,x:0,y:0});if(t.__bAcquireImageNow||e||t.__bOpenFileNow){t._bServerAlwaysFocusOnPopupWindow=!0;try{t._isValid()&&t._sendDataByHttpAsync("SendEventToScannerUI",["[",r,"]"].join(""))}catch(PJ){}}}}},{key:"_OnPageBlur",value:function(e){var t=this;if(de.bWin&&t._bReady){var r=Zt.stringify({sequence:0,wnds:0,wnd:"0",type:4,x:0,y:0});if((0!=t._bPageFocus||e)&&(t._bPageFocus=!1,t.__bAcquireImageNow||e||t.__bOpenFileNow)){t._bServerAlwaysFocusOnPopupWindow=!1;try{t._isValid()&&t._sendDataByHttpAsync("SendEventToScannerUI",["[",r,"]"].join(""))}catch(PJ){}}}}},{key:"_OnRemoteScanStatusAsync",value:function(e){var t,r,n,i,o,a,s,u=this;if(e&&e.length>=2){try{var c=new String(e[1]);t=Zt.parse(c)}catch(d){Zt.error(d.message),Zt.log("parse json failed: "+e[1])}t||(t={sequence:0,screen:[]})}if(t&&t.sequence)if(t.sequence>0&&t.screen&&t.screen.length>0){if(r=t.screen,i=t.sequence,a=t.wnds,s=(n=r[0]).img,Zt.isString(s)&&""!=s&&(o=n.wnd),i&&o){var l=Zt.sizzle(".ds-img-screen");l&&l.length>0&&u._acquireDivEL&&(u._acquireDivEL.evtFun&&(Zt.removeEventListener(l[0],"mouseup",u._acquireDivEL.evtFun),u._acquireDivEL.evtFun=null),l[0].src=s,u._acquireDivEL.evtFun=function(e){a||(a="0");var t=Zt.stringify({sequence:i,wnds:a,wnd:o+"",type:2,x:e.offsetX,y:e.offsetY});u._sendDataByHttpAsync("SendEventToScannerUI",["[",t,"]"].join(""))},Zt.addEventListener(l[0],"mouseup",u._acquireDivEL.evtFun))}}else u.__closeRemoteScanUI(!1);return Zt.isFunction(u.__OnRemoteScanStatusAsync)&&u.__OnRemoteScanStatusAsync(t),!0}},{key:"_OnBitmapChanged",value:function(e,t,r){var n=this,i="m1"==e[0],o="c1"==e[0],a="c2"==e[0],s=o||a||i,u=e[2],c=e[3],l=-1;if(!s){if(e.length>10&&(l=e[10]),l>-1&&n._canConsume()&&(u==df.enumBCAppend||u==df.enumBCInsert)){var d=rr.DWT.lgct(l);Zt.isFunction(n.__OnLtsverify)&&n.__OnLtsverify(d,1)}if((u==df.enumBCAppend||u==df.enumBCInsert)&&Zt.isFunction(n.__OnBufferChanged)){var f={action:"add",currentId:c,imageIds:[],selectedIds:[]};n.__OnBufferChanged(f)}}}},{key:"_OnPostTransferAsync",value:function(e,t,r){var n,i=this;if(e&&e.length>=2)try{var o=String(e[1]).replace(/\\/g,"\\\\");n=Zt.parse(o)}catch(s){Zt.error(s)}n||(n={imageId:""});var a=!1;if(Zt.isFunction(i.__OnPostTransferAsync))try{a=i.__OnPostTransferAsync(n)}catch(u){Ho(u)}if(Zt.isFunction(i.__OnPostTransferAsync2))try{i.__OnPostTransferAsync2(n)}catch(u){Ho(u)}return a}},{key:"_OnCurrentDeviceSelected",value:function(e,t){}},{key:"_getErrorCode",value:function(){return this._errorCode}},{key:"_getErrorString",value:function(){return 0!=this._errorCode?this._errorString:"Successful."}},{key:"_isBindViewer",value:function(){return!1}},{key:"_isNoViewer",value:function(){return!0}},{key:"_isMobileMode",value:function(){return!1}},{key:"_needCheckProxyRemoteScanLicense",value:function(){if(!this._blts&&this._bScanForProxyRemote){if(""==this._strRemoteServiceVer)return!0;var e=function(e){var t=e.split(","),r=[18,3];return Zt.trim(t[0])>r[0]||t.length>1&&Zt.trim(t[0])==r[0]&&Zt.trim(t[1])>=r[1]}(this._strRemoteServiceVer);if(e)return!0}return!1}},{key:"_OnActiveUIClearBuffer",value:function(){}}],[{key:"isServerInvalid",value:function(e){var t,r;if(t=!e._bReady||null===e._wsClient,r=e._bMustUpgradeService,t){var n,i,o;if(e._bRemoteMode)n=null!==(i=null===(o=e._dmService)||void 0===o||null===(o=o.attrs)||void 0===o?void 0:o.name)&&void 0!==i?i:"";ms(e,n)}else r?Ca(e):e.isDestroy&&os(e);return t||r||-2208==e._errorCode||e.isDestroy}},{key:"STwainConnectToServer",value:(u=n(g().mark((function J(e){var t,r;return g().wrap((function(n){for(;;)switch(n.prev=n.next){case 0:if(t=e._id,!rr.DWT.WebTwainIdMap[t]){n.next=5;break}return n.next=4,e._OnReady();case 4:return n.abrupt("return");case 5:if(!e._bReady&&!e._destroy){n.next=7;break}return n.abrupt("return");case 7:return e._bConnecting=!0,(r=Bu.Instance.getClient(e._serverInfo)).setRetry(0),e._bNoMask||Wl("",e),n.prev=11,n.next=14,Rc(e._bRemoteMode);case 14:return n.next=17,r.testConnection(void 0,0,void 0,1e4);case 17:if(e._wsClient=r,e._wsClient.bReady=!0,Qt.detect.bFirst&&(mf(),Qt.detect.bFirst=!1),e._bReady){n.next=24;break}return e._bReady=!0,n.next=24,e._OnReady();case 24:n.next=30;break;case 26:throw n.prev=26,n.t0=n["catch"](11),e._bReady=!1,{code:e._errorCode,message:e._getErrorString()};case 30:return n.prev=30,e._bConnecting=!1,e._bNoMask||Rl(""),n.finish(30);case 34:case"end":return n.stop()}}),J,null,[[11,26,30,34]])}))),function(e){return u.apply(this,arguments)})},{key:"_innerSendHeartBeat",value:(a=n(g().mark((function Q(e,r){var n,i,o,a;return g().wrap((function(s){for(;;)switch(s.prev=s.next){case 0:if(s.prev=0,!e.__bAcquireImageNow){s.next=4;break}s.next=14;break;case 4:if(n={client:null,userData:null,taskId:"0",eventTaskId:"0",lastEventTaskId:"0"},i=Pl(),o={cmd:"Heartbeat",cmdId:i,sFun:null,fFun:null,contextData:null,rawData:!0},a=e.getHeartBeatData(o),!e._wsClient){s.next=12;break}return e._wsClient.setRetry(0),s.next=12,e._wsClient.request(a,null,n);case 12:o=null,a=null;case 14:s.next=18;break;case 16:s.prev=16,s.t0=s["catch"](0);case 18:e._wsClient&&e._wsClient.connected&&r&&setTimeout((function(){t._innerSendHeartBeat(e,r)}),e._wsClient._heartBeatTicks);case 19:case"end":return s.stop()}}),Q,null,[[0,16]])}))),function(e,t){return a.apply(this,arguments)})},{key:"startDWTReconnect",value:(r=n(g().mark((function q(e){var r,n,i,o,a;return g().wrap((function(s){for(;;)switch(s.prev=s.next){case 0:if(s.prev=0,!e._destroy){s.next=3;break}return s.abrupt("return");case 3:if(r=e._serverInfo,!(na.bEnhancedMode&&r&&r.port)){s.next=24;break}return ia.bDCPChecked=!1,s.prev=6,s.next=9,Ld(qo(),rr.DWT.Port,rr.DWT.SSLPort);case 9:if(!(n=s.sent)){s.next=14;break}e._serverInfo.port=de.bSSL?n.sslPort:n.port,s.next=16;break;case 14:throw Cs(e),$s(e);case 16:s.next=24;break;case 18:return s.prev=18,s.t0=s["catch"](6),e._wsFailedTimes++,i=e._bRemoteMode?oa.RemoteReconnectMaxTimes:oa.LocalReconnectMaxTimes,e._wsFailedTimes<i&&(o=e._reconnectTimeSpan,e._wsFailedTimes<e._reconnectShortSpanTimes&&(o=e._reconnectShortSpan),e._heartBeatTimer=setTimeout((function(){t.startDWTReconnect(e)}),o)),s.abrupt("return");case 24:return e._bConnecting=!0,(a=Bu.Instance.getClient(e._serverInfo)).setRetry(0),s.next=30,a.testConnection(void 0,0,void 0,3e4);case 30:return e._wsClient=a,e._wsClient.bReady=!0,e._wsRetry=0,s.next=35,e._reconnected(a);case 35:s.next=40;break;case 37:s.prev=37,s.t1=s["catch"](0),e._wsFailedTimes++;case 40:return s.prev=40,e._bConnecting=!1,s.finish(40);case 43:case"end":return s.stop()}}),q,null,[[0,37,40,43],[6,18]])}))),function(e){return r.apply(this,arguments)})},{key:"startHeartBeat",value:function(e){var r=e._wsClient;r&&r.connected&&!r._bHeartBeatStarted&&(r._bHeartBeatStarted=!0,setTimeout((function(){t._innerSendHeartBeat(e,!0)}),r._heartBeatTicks))}},{key:"getServerImageUrlPrefix",value:function(e){var t,r=e._httpUrl;return t=e._bScanForProxyRemote?oa.getVersionStrForCheck():ia.getServerVersionInfo(),[r,"dwt/",ia.getDWTPrefix(),t,"/img?id=",e._clientId].join("")}}]);var r,a,u,c,l,d,h,m,p,v,_,y,S,I,b,T,C,w,E,k,A}(Sd);function $d(e){var t,r=this,n=e;return r._resetErr(),r._isValid()?ia.bUseDynamsoftLicenseManager||r._blts?(Us(r),Qt.Promise.reject({code:r._errorCode,message:r._getErrorString()})):(n=Zt.isString(n)?Zt.trim(n):"",t=r._sendDataConnectWithSocket("ProductKey",Il(n),"json",!0),r.__productKey=n,t=t.then((function(e){if(Zt.isArray(e)&&e.length>0){if(0!=r._errorCode)throw r.__productKey="",{code:r._errorCode,message:r._getErrorString()};rr.DWT.ProductKey=r.__productKey,Wc.reparseProductKey();return r._innerFunV2("GetLicenseInfo",Il(0))}throw La(r),t.context=null,{code:r._errorCode,message:r._getErrorString()}}))):Qt.Promise.reject({code:r._errorCode,message:r._getErrorString()})}function ef(e){return tf.apply(this,arguments)}function tf(){return(tf=n(g().mark((function e(t){var r;return g().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if((r=this)._resetErr(),r._isValid()){e.next=4;break}return e.abrupt("return",Qt.Promise.reject({code:r._errorCode,message:r._errorString}));case 4:if(t&&t instanceof Id){e.next=7;break}throw rs(r),{code:r._errorCode,message:r._errorString};case 7:case"end":return e.stop()}}),e,this)})))).apply(this,arguments)}function rf(e,t,r,n,i){var o,a=[];return a.push("{"),a.push('"id":"'),a.push(e),a.push('"'),n&&(a.push(',"cmdId":"'),a.push(n),a.push('"')),a.push(',"method":"'),a.push(t),a.push('"'),a.push(',"module":"dwt","version":"'),o=i?[ia.getDWTPrefix(),oa.getVersionStrForCheck()].join(""):[ia.getDWTPrefix(),ia.getServerVersionInfo()].join(""),a.push(o),a.push('"'),r!==undefined&&null!==r&&(a.push(',"parameter":'),Zt.isArray(r)?a.push(Zt.stringify(r)):a.push(r)),a.push("}"),a.join("")}function nf(e,t){return["evt",e,t].join("_")}function of(e){if(e._bReady)e._wsCheckResolve();else{if(rr.DWT.bConnectCanceled)return Zt.asyncQueue.stop(),ps(e),void e._wsCheckReject({code:e._errorCode,message:e._getErrorString()});if(e._wsRetry>10)return fs(e),void e._wsCheckReject({code:e._errorCode,message:e._getErrorString()});e._wsRetry++,setTimeout((function(){of(e)}),1100)}}function af(e,t,r,n){return sf.apply(this,arguments)}function sf(){return sf=n(g().mark((function e(t,r,n,i){var o,a,s,u,c,l,d;return g().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(r!=ru.GET_TASKID){e.next=4;break}return e.abrupt("return",i.taskId);case 4:if(r!=ru.GET_EVENT_TASKID){e.next=8;break}return e.abrupt("return",i.eventTaskId);case 8:if(r!=ru.ONMESSAGE_PROCESS_DATA){e.next=17;break}if("object"!==_(t)){e.next=11;break}return e.abrupt("return",t);case 11:if(!((u=t).indexOf("Version not found")>=0||u.indexOf("Function not found")>=0)){e.next=14;break}return e.abrupt("return",{cmdId:null!=n?n:0});case 14:return e.abrupt("return",Zt.parse(t));case 17:if(r!=ru.ONMESSAGE_GET_TASKID){e.next=25;break}if(!t){e.next=22;break}if(!t.event){e.next=21;break}return e.abrupt("return",0);case 21:return e.abrupt("return",t.cmdId);case 22:return e.abrupt("return",t);case 25:if(r!=ru.ONMESSAGE_GET_EVENT_TASKID){e.next=31;break}if(!t||!t.event){e.next=28;break}return e.abrupt("return",nf(t.id,t.cmdId));case 28:return e.abrupt("return",0);case 31:if(r!=ru.HANDLE_RAW_MESSAGE){e.next=59;break}if(o=null==i?void 0:i.userData){e.next=35;break}return e.abrupt("return",!1);case 35:if(a=o.stwain,s=o.command){e.next=39;break}return e.abrupt("return",!1);case 39:if(a&&Zt.isFunction(a.__OnWSMessage)&&a.__OnWSMessage(t),"object"!==_(t)){e.next=44;break}if(!rr.DWT.ConnectWithSocket){e.next=44;break}return"ConvertToBlob"!=s.cmd&&"GetImageByIndex"!=s.cmd||s.sFun(t),e.abrupt("return",!0);case 44:if(!((c=t.replace(/\0/g,"")).indexOf('"method" : "Heartbeat"')>=0)){e.next=47;break}return e.abrupt("return",!0);case 47:if(!(c.indexOf('"method" : "EnableBuffer"')>=0||c.indexOf('"method" : "GetBuffer"')>=0)){e.next=50;break}return rr.DWT.lwsproc(c,s),e.abrupt("return",!0);case 50:if(!(c.indexOf("Exception:")>=0||0==c.indexOf("Error"))){e.next=57;break}return l=t,d=!1,Zt.log(l+"@"+s.cmd),s.fFun&&(d=s.fFun(l)),!d&&a&&Zt.isFunction(a.__OnPrintMsg)&&a.__OnPrintMsg(l),e.abrupt("return",!0);case 57:e.next=70;break;case 59:if(r!=ru.HANDLE_PROCESSED_MESSAGE){e.next=70;break}if(o=null==i?void 0:i.userData){e.next=63;break}return e.abrupt("return",!1);case 63:if(a=o.stwain){e.next=66;break}return e.abrupt("return",!1);case 66:if(s=o.command){e.next=69;break}return e.abrupt("return",!1);case 69:return e.abrupt("return",a.__OnRecieveMsg(t,s));case 70:case"end":return e.stop()}}),e)}))),sf.apply(this,arguments)}function uf(e){e.Resolution!==undefined&&(e.Resolution=parseInt(e.Resolution)),e.PixelType!==undefined&&(e.PixelType=parseInt(e.PixelType)),e.SelectSourceByIndex!==undefined&&(e.SelectSourceByIndex=parseInt(e.SelectSourceByIndex))}var cf,lf=["OnPreAllTransfers","OnPreTransfer","OnPostTransfer","OnPostTransferAsync"],df=function(e){return e.enumBCAppend=1,e.enumBCInsert=2,e.enumBCRemove=3,e.enumBCEdit=4,e.enumBCIndexChange=5,e.enumBCUpdate=6,e}({}),ff=["OnPostAllTransfers","OnPostTransfer","OnPostLoad","OnPreTransfer","OnPreAllTransfers","OnResult","OnTransferCancelled","OnTransferError","OnSourceUIClose","OnGetFilePath","OnPercentDone","OnPostTransferAsync","OnPreAllTransfersAsync","OnRemoteScanStatusAsync","OnConsumed","OnDiskExceedLimit","OnCurrentDeviceSelected"],hf=["OnPreAllTransfers","OnPreTransfer","OnPostTransfer","OnGetFilePath","OnPostLoad"],gf=Zt.each;function mf(){var e,t=Dd.item("DWT_port"),r=Dd.item("DWT_ssl");if(na.bEnhancedMode)return!0;Qt.detect.urls.splice(0),Qt.detect.cUrlIndex=0,t!==cf&&r!==cf&&(e={port:t,ssl:"true"==r});var n=function(t){return!e||!(!t||t.port==e.port&&t.ssl==e.ssl)};1===Qt.detect.detectType?(e!==cf&&e.ssl&&Qt.detect.urls.push(e),gf(Qt.detect.ports,(function(e){e.ssl&&n(e)&&Qt.detect.urls.push(e)}))):0===Qt.detect.detectType?(e===cf||e.ssl||Qt.detect.urls.push(e),gf(Qt.detect.ports,(function(e){!1===e.ssl&&n(e)&&Qt.detect.urls.push(e)}))):(e!==cf&&Qt.detect.urls.push(e),gf(Qt.detect.ports,(function(e){n(e)&&Qt.detect.urls.push(e)})))}var pf=function(e){return e.TWAIN=0,e.ICA=3,e.SANE=3,e.TWAIN_AND_ICA=4,e.TWAIN_AND_TWAIN64=4,e.TWAIN64=5,e}({}),vf={notSupportProperty:function(e){},notSupportMethod:function(e){},refreshImageAfterInvokeFun:function(e,t,r){return 1==r},loadHttpBlob:function(e,t,r,n,i,o,a,s){var u,c,l=di;if(c={method:t,dataType:"blob"},s&&(c.headers=s),""!=e.HTTPUserName&&(c.username=e.HTTPUserName,c.password=e.HTTPPassword),e.__HTTPPostResponseString="",n){if("get"==t){var d=Zt.guid();return Qt.progressContext&&(Qt.progressContext._onPercent=a),void Gs(Qt.progressContext,d)(r,c).then((function(t){var r=t.type;if("text/plain"==r||"text/html"==r||da(r)){var n=new FileReader;n.readAsText(t),n.onload=function(){e.__HTTPPostResponseString=n.result,i(t)},n.onerror=function(){i(t)}}else i(t)}),(function(t){t&&t.code?(e._errorCode=t.code,e._errorString=t.message):t&&t.httpCode?Fa(e,!1,t.message,t.httpCode):Pa(e),Zt.isFunction(o)&&o({code:e._errorCode,message:e._errorString})}))}c.onSuccess=function(t,r,n){var o=n?n.getResponseHeader("content-type"):"";if(o.indexOf("text/")>=0||da(o)){var a=new FileReader;a.readAsText(t),a.onload=function(){e.__HTTPPostResponseString=a.result,i(t)},a.onerror=function(){i(t)}}else i(t)},Zt.isFunction(a)&&(c.beforeSend=function(e){e.addEventListener("progress",(function(e){!de.bSafari&&e&&(delete e.totalSize,delete e.position),a(e)}),di)})}else de.bIE?(c.dataType="arraybuffer",c.onSuccess=function(t,r,n){var o,a;(o=t||n.responseData)&&(a=new Uint8Array(o)),e.__HTTPPostResponseString=n.responseText,e._errorCode=0,e._errorString="",i(a),a=null,l=fi}):(c.dataType="text",c.contentType="text/plain; charset=x-user-defined",c.mimeType="text/plain; charset=x-user-defined",c.onSuccess=function(t,r,n){var o,a,s;o=n.responseText,e.__HTTPPostResponseString=o,a=o.length,s=new Uint8Array(a);for(var u=0;u<a;u++)s[u]=o.charCodeAt(u);e._errorCode=0,e._errorString="",i(s),s=null,l=fi}),c.headers?Zt.mix(c.headers,{"X-Requested-With":di}):c.headers={"X-Requested-With":di};if("post"==t){var f,h=e.httpFormFields;if(h)try{f=new FormData,Zt.each(h,(function(e,t){if(e instanceof Blob){var r=e.name;f.append(t,e,r)}else f.append(t,e)})),Zt.mix(c,{data:f,processData:di,contentType:di})}catch(Mj){}}u=function(t,r,n){var i,a;if(t&&Zt.isArray(t)&&t.length>2?(i=t[1],a=t[2]):(i=r,a=n),2!=a.state&&3!=a.state||0!=a.status)Fa(e,di,i,a.status);else if("abort"===a.statusText){Fa(e,true)}else Pa(e);Zt.isFunction(o)&&o()},c.url=r,c.async=n,c.onError=u,c.onComplete=function(){e._cancelableObj=null};var g=Vi(c);if(!n)return l;Qt.progressContext&&(Qt.progressContext._onPercent=a,e.IfShowCancelDialogWhenImageTransfer&&Qt.progressContext.on("cancel",(function(){g.abort()})))},combineUrl:function(e,t,r){var n=[],i=t;return i===undefined||r===undefined?undefined:(Zt.isString(i)||(i=String(t)),0==i.indexOf("http://")?(i=i.replace("http://",""),n.push("http://")):0==i.indexOf("https://")?(i=i.replace("https://",""),n.push("https://")):(0==i.indexOf("//")&&(i=i.replace("//","")),e.IfSSL?n.push("https://"):n.push("http://")),n.push(i),i.indexOf(":")<0&&(e.HTTPPort||(e.HTTPPort=Qt.detect.ssl?443:80),(!Qt.detect.ssl&&80!=e.HTTPPort||Qt.detect.ssl&&443!=e.HTTPPort)&&(n.push(":"),n.push(e.HTTPPort))),0!==r.indexOf("/")&&n.push("/"),n.push(r),n.join(""))},httpPutImage:function(e,t,r,n,i,o,a){var s=fi,u={method:"PUT",url:t,hasContent:fi,processData:di,async:n,data:r,onSuccess:i,onError:function(t,r,n){var i,a;if(s=di,t&&Zt.isArray(t)&&t.length>2?(i=t[1],a=t[2]):(i=r,a=n),2!=a.state&&3!=a.state||0!=a.status)Da(e,di,i,a.status);else if("abort"===a.statusText){Da(e,true)}else!function(e){ha(e,-2304,"Http put error: the url is invalid.")}(e);Zt.isFunction(o)&&o()},onComplete:function(){e._cancelableObj=null},beforeSend:function(e){Zt.isFunction(a)&&e.upload.addEventListener("progress",(function(e){!de.bSafari&&e&&(delete e.totalSize,delete e.position),a(e)}),di)}};""!=e.HTTPUserName&&(u.username=e.HTTPUserName,u.password=e.HTTPPassword),n||Zt.mix(u,{headers:{"X-Requested-With":di}});var c=Vi(u);return Qt.progressContext&&(Qt.progressContext._onPercent=a,Qt.progressContext._onCancel=function(){c.abort()}),s},GetImageInfo:function(e,t){var r=e._ImgManager.convertClientIndexToServerId(t);return-1==r?(Ka(e),!1):e._innerFun("GetImageInfo",Il(r))},getBlobTypeByImageType:Pd,callbacks:[],pushCallback:function(e,t,r){var n={method:e,callback:t,ticks:r};vf.callbacks.push(n)},refreshUIRef:0,isServerInvalid:function(e){Zd.isServerInvalid(e)},replaceLocalFilename:function(e){var t;return e===undefined?"":(t=(e=String(e)).replace(/\\/g,"\\\\"),de.bFileSystem&&(t=decodeURI(t)),t)},getImageType:function(e){if(e===undefined)return-1;if(e.length<4)return-1;var t=e.lastIndexOf(".");if(-1===t)return-1;var r=e.slice(t).toLowerCase();return".bmp"===r||".dib"===r?rr.DWT.EnumDWT_ImageType.IT_BMP:".jpg"===r||".jpe"===r||".jpeg"===r||".jfif"===r?rr.DWT.EnumDWT_ImageType.IT_JPG:".tif"===r||".tiff"===r?rr.DWT.EnumDWT_ImageType.IT_TIF:".png"===r?rr.DWT.EnumDWT_ImageType.IT_PNG:".pdf"===r?rr.DWT.EnumDWT_ImageType.IT_PDF:".jp2"===r||".j2k"===r||".j2c"===r?rr.DWT.EnumDWT_ImageType.IT_J2K:-1},makeParams:Il,showMask:Wl,hideMask:Rl};function _f(e,t,r,n,i){var o=0;return e==pf.TWAIN&&(o=Al),e==pf.TWAIN64?o=Tl.TWAINX64SCANNER:e==pf.ICA?r?o=Tl.SANESCANNER:n?o=Tl.ICASCANNER:(t||i)&&(o=Al):e==pf.TWAIN_AND_TWAIN64&&(r?o=Al|Tl.SANESCANNER:n?o=Al|Tl.ICASCANNER:t?o=Al|Tl.TWAINX64SCANNER:i&&(o=Al)),o}function yf(e,t){for(var r=e.HowManyImagesInBuffer,n=0;n<r;n++)t.push(e._ImgManager.convertClientIndexToServerId(n))}function Sf(e,t){return 0!=e._ImgManager.count()||(Ia(e),Zt.isFunction(t)&&t(e._errorCode,e._getErrorString()),!1)}function If(e,t,r){return!!Sf(e,r)&&(!(isNaN(t)||!Zt.isNumber(t)||t<0||t>=e._ImgManager.count())||(Ka(e),Zt.isFunction(r)&&r(e._errorCode,e._getErrorString()),!1))}function bf(e){var t,r,n,i=[];return e._ImgManager.count()<=0||((r=e._ImgManager.getCurrentImageIndex())>=0&&(t=e._ImgManager.convertClientIndexToServerId(r)),n=e._ImgManager.getSelectedClientIndexArray(),Zt.isArray(n)&&Zt.each(n,(function(t){var r=e._ImgManager.convertClientIndexToServerId(t);-1!=r&&i.push(r)})),-1!=t&&0==i.length&&i.push(t)),i}function Tf(e){var t,r=[];return e._ImgManager.count()<=0||(t=e._ImgManager.getCurrentImageIndex(),r=e._ImgManager.getSelectedClientIndexArray(),-1!=t&&0==r.length&&r.push(t)),r}function Cf(e,t,r){return e._resetErr(),!!e._isValid()&&(isNaN(t)?(ya(e),Zt.isFunction(r)&&r(e._errorCode,e.ErrorString),di):t<0||t>=e._ImgManager.count()?(Ka(e),Zt.isFunction(r)&&r(e._errorCode,e.ErrorString),di):fi)}function wf(e){var t,r=[],n=e.HowManyImagesInBuffer;for(t=0;t<n;t++)r.push(t);return e._imageBufferWrapper.convertIndicesToServerIds(r)}function Ef(e,t){return e._imageBufferWrapper.convertIndicesToServerIds(t)}function kf(e,t,r,n,i){try{e(t,r,n,i)}catch(o){}t=r=n=i=null}function Af(e,t,r){try{e(t._errorCode,t._getErrorString(),r)}catch(n){}t=r=null}function xf(e,t,r,n,i,o){try{e(t._errorCode,t._getErrorString(),r,n,i,o)}catch(a){}t=r=n=i=o=null}Qt.html5.Funs=vf;var Pf=function(){return s((function e(){o(this,e),c(this,"bIsDirty",!1),c(this,"imageWidth",0),c(this,"imageHeight",0),c(this,"iImageControlWidth",0),c(this,"iImageControlHeight",0),c(this,"imageUrl",""),c(this,"minImageUrl",""),c(this,"uuid",-1),c(this,"serverId",-1),c(this,"uidFromServer",""),c(this,"aryOverlayRectangleData",[]),c(this,"ticks",Date.now())}),[{key:"Clear",value:function(){this.imageUrl="",this.minImageUrl="",this.serverId=-1,this.uuid=-1,this.uidFromServer="",this.aryOverlayRectangleData=[]}}])}(),Df=function(e){return e&&e.Math===Math&&e},Ff=Df("object"==("undefined"==typeof globalThis?"undefined":_(globalThis))&&globalThis)||Df("object"==("undefined"==typeof window?"undefined":_(window))&&window)||Df("object"==("undefined"==typeof self?"undefined":_(self))&&self)||Df("object"==_(E)&&E)||Df("object"==_(E)&&E)||function(){return this}()||Function("return this")(),Wf=function(e){try{return!!e()}catch(bi){return!0}},Rf=!Wf((function(){var e=function(){}.bind();return"function"!=typeof e||e.hasOwnProperty("prototype")})),Nf=Rf,Of=Function.prototype,Mf=Of.apply,Lf=Of.call,Bf="object"==("undefined"==typeof Reflect?"undefined":_(Reflect))&&Reflect.apply||(Nf?Lf.bind(Mf):function(){return Lf.apply(Mf,arguments)}),Uf=Rf,Vf=Function.prototype,jf=Vf.call,Gf=Uf&&Vf.bind.bind(jf,jf),Hf=Uf?Gf:function(e){return function(){return jf.apply(e,arguments)}},zf=Hf,Kf=zf({}.toString),Jf=zf("".slice),Qf=function(e){return Jf(Kf(e),8,-1)},qf=Qf,Yf=Hf,Xf=function(e){if("Function"===qf(e))return Yf(e)},Zf="object"==("undefined"==typeof document?"undefined":_(document))&&document.all,$f=void 0===Zf&&Zf!==undefined?function(e){return"function"==typeof e||e===Zf}:function(e){return"function"==typeof e},eh={},th=!Wf((function(){return 7!==Object.defineProperty({},1,{get:function(){return 7}})[1]})),rh=Rf,nh=Function.prototype.call,ih=rh?nh.bind(nh):function(){return nh.apply(nh,arguments)},oh={},ah={}.propertyIsEnumerable,sh=Object.getOwnPropertyDescriptor,uh=sh&&!ah.call({1:2},1);oh.f=uh?function(e){var t=sh(this,e);return!!t&&t.enumerable}:ah;var ch,lh,dh=function(e,t){return{enumerable:!(1&e),configurable:!(2&e),writable:!(4&e),value:t}},fh=Wf,hh=Qf,gh=Object,mh=Hf("".split),ph=fh((function(){return!gh("z").propertyIsEnumerable(0)}))?function(e){return"String"===hh(e)?mh(e,""):gh(e)}:gh,vh=function(e){return null===e||e===undefined},_h=vh,yh=TypeError,Sh=function(e){if(_h(e))throw new yh("Can't call method on "+e);return e},Ih=ph,bh=Sh,Th=function(e){return Ih(bh(e))},Ch=$f,wh=function(e){return"object"==_(e)?null!==e:Ch(e)},Eh={},kh=Eh,Ah=Ff,xh=$f,Ph=function(e){return xh(e)?e:undefined},Dh=function(e,t){return arguments.length<2?Ph(kh[e])||Ph(Ah[e]):kh[e]&&kh[e][t]||Ah[e]&&Ah[e][t]},Fh=Hf({}.isPrototypeOf),Wh=Ff.navigator,Rh=Wh&&Wh.userAgent,Nh=Rh?String(Rh):"",Oh=Ff,Mh=Nh,Lh=Oh.process,Bh=Oh.Deno,Uh=Lh&&Lh.versions||Bh&&Bh.version,Vh=Uh&&Uh.v8;Vh&&(lh=(ch=Vh.split("."))[0]>0&&ch[0]<4?1:+(ch[0]+ch[1])),!lh&&Mh&&(!(ch=Mh.match(/Edge\/(\d+)/))||ch[1]>=74)&&(ch=Mh.match(/Chrome\/(\d+)/))&&(lh=+ch[1]);var jh=lh,Gh=jh,Hh=Wf,zh=Ff.String,Kh=!!Object.getOwnPropertySymbols&&!Hh((function(){var e=Symbol("symbol detection");return!zh(e)||!(Object(e)instanceof Symbol)||!Symbol.sham&&Gh&&Gh<41})),Jh=Kh&&!Symbol.sham&&"symbol"==_(Symbol.iterator),Qh=Dh,qh=$f,Yh=Fh,Xh=Object,Zh=Jh?function(e){return"symbol"==_(e)}:function(e){var t=Qh("Symbol");return qh(t)&&Yh(t.prototype,Xh(e))},$h=String,eg=function(e){try{return $h(e)}catch(bi){return"Object"}},tg=$f,rg=eg,ng=TypeError,ig=function(e){if(tg(e))return e;throw new ng(rg(e)+" is not a function")},og=ig,ag=vh,sg=function(e,t){var r=e[t];return ag(r)?undefined:og(r)},ug=ih,cg=$f,lg=wh,dg=TypeError,fg={exports:{}},hg=!0,gg=Ff,mg=Object.defineProperty,pg=Ff,vg=function(e,t){try{mg(gg,e,{value:t,configurable:!0,writable:!0})}catch(bi){gg[e]=t}return t},_g="__core-js_shared__",yg=fg.exports=pg[_g]||vg(_g,{});(yg.versions||(yg.versions=[])).push({version:"3.38.1",mode:"pure",copyright:"© 2014-2024 Denis Pushkarev (zloirock.ru)",license:"https://github.com/zloirock/core-js/blob/v3.38.1/LICENSE",source:"https://github.com/zloirock/core-js"});var Sg=fg.exports,Ig=Sg,bg=function(e,t){return Ig[e]||(Ig[e]=t||{})},Tg=Sh,Cg=Object,wg=function(e){return Cg(Tg(e))},Eg=wg,kg=Hf({}.hasOwnProperty),Ag=Object.hasOwn||function(e,t){return kg(Eg(e),t)},xg=Hf,Pg=0,Dg=Math.random(),Fg=xg(1..toString),Wg=function(e){return"Symbol("+(e===undefined?"":e)+")_"+Fg(++Pg+Dg,36)},Rg=bg,Ng=Ag,Og=Wg,Mg=Kh,Lg=Jh,Bg=Ff.Symbol,Ug=Rg("wks"),Vg=Lg?Bg["for"]||Bg:Bg&&Bg.withoutSetter||Og,jg=function(e){return Ng(Ug,e)||(Ug[e]=Mg&&Ng(Bg,e)?Bg[e]:Vg("Symbol."+e)),Ug[e]},Gg=ih,Hg=wh,zg=Zh,Kg=sg,Jg=function(e,t){var r,n;if("string"===t&&cg(r=e.toString)&&!lg(n=ug(r,e)))return n;if(cg(r=e.valueOf)&&!lg(n=ug(r,e)))return n;if("string"!==t&&cg(r=e.toString)&&!lg(n=ug(r,e)))return n;throw new dg("Can't convert object to primitive value")},Qg=TypeError,qg=jg("toPrimitive"),Yg=function(e,t){if(!Hg(e)||zg(e))return e;var r,n=Kg(e,qg);if(n){if(t===undefined&&(t="default"),r=Gg(n,e,t),!Hg(r)||zg(r))return r;throw new Qg("Can't convert object to primitive value")}return t===undefined&&(t="number"),Jg(e,t)},Xg=Zh,Zg=function(e){var t=Yg(e,"string");return Xg(t)?t:t+""},$g=wh,em=Ff.document,tm=$g(em)&&$g(em.createElement),rm=function(e){return tm?em.createElement(e):{}},nm=rm,im=!th&&!Wf((function(){return 7!==Object.defineProperty(nm("div"),"a",{get:function(){return 7}}).a})),om=th,am=ih,sm=oh,um=dh,cm=Th,lm=Zg,dm=Ag,fm=im,hm=Object.getOwnPropertyDescriptor;eh.f=om?hm:function(e,t){if(e=cm(e),t=lm(t),fm)try{return hm(e,t)}catch(bi){}if(dm(e,t))return um(!am(sm.f,e,t),e[t])};var gm=Wf,mm=$f,pm=/#|\.prototype\./,vm=function(e,t){var r=ym[_m(e)];return r===Im||r!==Sm&&(mm(t)?gm(t):!!t)},_m=vm.normalize=function(e){return String(e).replace(pm,".").toLowerCase()},ym=vm.data={},Sm=vm.NATIVE="N",Im=vm.POLYFILL="P",bm=vm,Tm=ig,Cm=Rf,wm=Xf(Xf.bind),Em=function(e,t){return Tm(e),t===undefined?e:Cm?wm(e,t):function(){return e.apply(t,arguments)}},km={},Am=th&&Wf((function(){return 42!==Object.defineProperty((function(){}),"prototype",{value:42,writable:!1}).prototype})),xm=wh,Pm=String,Dm=TypeError,Fm=function(e){if(xm(e))return e;throw new Dm(Pm(e)+" is not an object")},Wm=th,Rm=im,Nm=Am,Om=Fm,Mm=Zg,Lm=TypeError,Bm=Object.defineProperty,Um=Object.getOwnPropertyDescriptor,Vm="enumerable",jm="configurable",Gm="writable";km.f=Wm?Nm?function(e,t,r){if(Om(e),t=Mm(t),Om(r),"function"==typeof e&&"prototype"===t&&"value"in r&&Gm in r&&!r[Gm]){var n=Um(e,t);n&&n[Gm]&&(e[t]=r.value,r={configurable:jm in r?r[jm]:n[jm],enumerable:Vm in r?r[Vm]:n[Vm],writable:!1})}return Bm(e,t,r)}:Bm:function(e,t,r){if(Om(e),t=Mm(t),Om(r),Rm)try{return Bm(e,t,r)}catch(bi){}if("get"in r||"set"in r)throw new Lm("Accessors not supported");return"value"in r&&(e[t]=r.value),e};var Hm=km,zm=dh,Km=th?function(e,t,r){return Hm.f(e,t,zm(1,r))}:function(e,t,r){return e[t]=r,e},Jm=Ff,Qm=Bf,qm=Xf,Ym=$f,Xm=eh.f,Zm=bm,$m=Eh,ep=Em,tp=Km,rp=Ag,np=function(e){var t=function(r,n,i){if(this instanceof t){switch(arguments.length){case 0:return new e;case 1:return new e(r);case 2:return new e(r,n)}return new e(r,n,i)}return Qm(e,this,arguments)};return t.prototype=e.prototype,t},ip=function(e,t){var r,n,i,o,a,s,u,c,l,d=e.target,f=e.global,h=e.stat,g=e.proto,m=f?Jm:h?Jm[d]:Jm[d]&&Jm[d].prototype,p=f?$m:$m[d]||tp($m,d,{})[d],v=p.prototype;for(o in t)n=!(r=Zm(f?o:d+(h?".":"#")+o,e.forced))&&m&&rp(m,o),s=p[o],n&&(u=e.dontCallGetSet?(l=Xm(m,o))&&l.value:m[o]),a=n&&u?u:t[o],(r||g||_(s)!=_(a))&&(c=e.bind&&n?ep(a,Jm):e.wrap&&n?np(a):g&&Ym(a)?qm(a):a,(e.sham||a&&a.sham||s&&s.sham)&&tp(c,"sham",!0),tp(p,o,c),g&&(rp($m,i=d+"Prototype")||tp($m,i,{}),tp($m[i],o,a),e.real&&v&&(r||!v[o])&&tp(v,o,a)))},op=Hf([].slice),ap=Hf,sp=ig,up=wh,cp=Ag,lp=op,dp=Rf,fp=Function,hp=ap([].concat),gp=ap([].join),mp={},pp=dp?fp.bind:function(e){var t=sp(this),r=t.prototype,n=lp(arguments,1),i=function(){var r=hp(n,lp(arguments));return this instanceof i?function(e,t,r){if(!cp(mp,t)){for(var n=[],i=0;i<t;i++)n[i]="a["+i+"]";mp[t]=fp("C,a","return new C("+gp(n,",")+")")}return mp[t](e,r)}(t,r.length,r):t.apply(e,r)};return up(r)&&(i.prototype=r),i},vp={};vp[jg("toStringTag")]="z";var _p="[object z]"===String(vp),yp=_p,Sp=$f,Ip=Qf,bp=jg("toStringTag"),Tp=Object,Cp="Arguments"===Ip(function(){return arguments}()),wp=yp?Ip:function(e){var t,r,n;return e===undefined?"Undefined":null===e?"Null":"string"==typeof(r=function(e,t){try{return e[t]}catch(bi){}}(t=Tp(e),bp))?r:Cp?Ip(t):"Object"===(n=Ip(t))&&Sp(t.callee)?"Arguments":n},Ep=$f,kp=Sg,Ap=Hf(Function.toString);Ep(kp.inspectSource)||(kp.inspectSource=function(e){return Ap(e)});var xp=kp.inspectSource,Pp=Hf,Dp=Wf,Fp=$f,Wp=wp,Rp=xp,Np=function(){},Op=Dh("Reflect","construct"),Mp=/^\s*(?:class|function)\b/,Lp=Pp(Mp.exec),Bp=!Mp.test(Np),Up=function(e){if(!Fp(e))return!1;try{return Op(Np,[],e),!0}catch(bi){return!1}},Vp=function(e){if(!Fp(e))return!1;switch(Wp(e)){case"AsyncFunction":case"GeneratorFunction":case"AsyncGeneratorFunction":return!1}try{return Bp||!!Lp(Mp,Rp(e))}catch(bi){return!0}};Vp.sham=!0;var jp=!Op||Dp((function(){var e;return Up(Up.call)||!Up(Object)||!Up((function(){e=!0}))||e}))?Vp:Up,Gp=jp,Hp=eg,zp=TypeError,Kp=function(e){if(Gp(e))return e;throw new zp(Hp(e)+" is not a constructor")},Jp={},Qp=Math.ceil,qp=Math.floor,Yp=Math.trunc||function(e){var t=+e;return(t>0?qp:Qp)(t)},Xp=function(e){var t=+e;return t!=t||0===t?0:Yp(t)},Zp=Xp,$p=Math.max,ev=Math.min,tv=function(e,t){var r=Zp(e);return r<0?$p(r+t,0):ev(r,t)},rv=Xp,nv=Math.min,iv=function(e){var t=rv(e);return t>0?nv(t,9007199254740991):0},ov=function(e){return iv(e.length)},av=Th,sv=tv,uv=ov,cv=function(e){return function(t,r,n){var i=av(t),o=uv(i);if(0===o)return!e&&-1;var a,s=sv(n,o);if(e&&r!=r){for(;o>s;)if((a=i[s++])!=a)return!0}else for(;o>s;s++)if((e||s in i)&&i[s]===r)return e||s||0;return!e&&-1}},lv={includes:cv(!0),indexOf:cv(!1)},dv={},fv=Ag,hv=Th,gv=lv.indexOf,mv=dv,pv=Hf([].push),vv=function(e,t){var r,n=hv(e),i=0,o=[];for(r in n)!fv(mv,r)&&fv(n,r)&&pv(o,r);for(;t.length>i;)fv(n,r=t[i++])&&(~gv(o,r)||pv(o,r));return o},_v=["constructor","hasOwnProperty","isPrototypeOf","propertyIsEnumerable","toLocaleString","toString","valueOf"],yv=vv,Sv=_v,Iv=Object.keys||function(e){return yv(e,Sv)},bv=th,Tv=Am,Cv=km,wv=Fm,Ev=Th,kv=Iv;Jp.f=bv&&!Tv?Object.defineProperties:function(e,t){wv(e);for(var r,n=Ev(t),i=kv(t),o=i.length,a=0;o>a;)Cv.f(e,r=i[a++],n[r]);return e};var Av,xv=Dh("document","documentElement"),Pv=Wg,Dv=bg("keys"),Fv=function(e){return Dv[e]||(Dv[e]=Pv(e))},Wv=Fm,Rv=Jp,Nv=_v,Ov=dv,Mv=xv,Lv=rm,Bv="prototype",Uv="script",Vv=Fv("IE_PROTO"),jv=function(){},Gv=function(e){return"<"+Uv+">"+e+"</"+Uv+">"},Hv=function(e){e.write(Gv("")),e.close();var t=e.parentWindow.Object;return e=null,t},zv=function(){try{Av=new ActiveXObject("htmlfile")}catch(bi){}var e,t,r;zv="undefined"!=typeof document?document.domain&&Av?Hv(Av):(t=Lv("iframe"),r="java"+Uv+":",t.style.display="none",Mv.appendChild(t),t.src=String(r),(e=t.contentWindow.document).open(),e.write(Gv("document.F=Object")),e.close(),e.F):Hv(Av);for(var n=Nv.length;n--;)delete zv[Bv][Nv[n]];return zv()};Ov[Vv]=!0;var Kv=Object.create||function(e,t){var r;return null!==e?(jv[Bv]=Wv(e),r=new jv,jv[Bv]=null,r[Vv]=e):r=zv(),t===undefined?r:Rv.f(r,t)},Jv=ip,Qv=Bf,qv=pp,Yv=Kp,Xv=Fm,Zv=wh,$v=Kv,e_=Wf,t_=Dh("Reflect","construct"),r_=Object.prototype,n_=[].push,i_=e_((function(){function e(){}return!(t_((function(){}),[],e)instanceof e)})),o_=!e_((function(){t_((function(){}))})),a_=i_||o_;Jv({target:"Reflect",stat:!0,forced:a_,sham:a_},{construct:function(e,t){Yv(e),Xv(t);var r=arguments.length<3?e:Yv(arguments[2]);if(o_&&!i_)return t_(e,t,r);if(e===r){switch(t.length){case 0:return new e;case 1:return new e(t[0]);case 2:return new e(t[0],t[1]);case 3:return new e(t[0],t[1],t[2]);case 4:return new e(t[0],t[1],t[2],t[3])}var n=[null];return Qv(n_,n,t),new(Qv(qv,e,n))}var i=r.prototype,o=$v(Zv(i)?i:r_),a=Qv(e,o,t);return Zv(a)?a:o}});var s_=k(Eh.Reflect.construct),u_=wp,c_=String,l_=function(e){if("Symbol"===u_(e))throw new TypeError("Cannot convert a Symbol value to a string");return c_(e)},d_={},f_=vv,h_=_v.concat("length","prototype");d_.f=Object.getOwnPropertyNames||function(e){return f_(e,h_)};var g_={},m_=Qf,p_=Th,v_=d_.f,__=op,y_="object"==("undefined"==typeof window?"undefined":_(window))&&window&&Object.getOwnPropertyNames?Object.getOwnPropertyNames(window):[];g_.f=function(e){return y_&&"Window"===m_(e)?function(e){try{return v_(e)}catch(bi){return __(y_)}}(e):v_(p_(e))};var S_={};S_.f=Object.getOwnPropertySymbols;var I_=Km,b_=function(e,t,r,n){return n&&n.enumerable?e[t]=r:I_(e,t,r),e},T_=km,C_=function(e,t,r){return T_.f(e,t,r)},w_={},E_=jg;w_.f=E_;var k_,A_,x_,P_=Eh,D_=Ag,F_=w_,W_=km.f,R_=function(e){var t=P_.Symbol||(P_.Symbol={});D_(t,e)||W_(t,e,{value:F_.f(e)})},N_=ih,O_=Dh,M_=jg,L_=b_,B_=function(){var e=O_("Symbol"),t=e&&e.prototype,r=t&&t.valueOf,n=M_("toPrimitive");t&&!t[n]&&L_(t,n,(function(e){return N_(r,this)}),{arity:1})},U_=wp,V_=_p?{}.toString:function(){return"[object "+U_(this)+"]"},j_=_p,G_=km.f,H_=Km,z_=Ag,K_=V_,J_=jg("toStringTag"),Q_=function(e,t,r,n){var i=r?e:e&&e.prototype;i&&(z_(i,J_)||G_(i,J_,{configurable:!0,value:t}),n&&!j_&&H_(i,"toString",K_))},q_=$f,Y_=Ff.WeakMap,X_=q_(Y_)&&/native code/.test(String(Y_)),Z_=Ff,$_=wh,ey=Km,ty=Ag,ry=Sg,ny=Fv,iy=dv,oy="Object already initialized",ay=Z_.TypeError,sy=Z_.WeakMap;if(X_||ry.state){var uy=ry.state||(ry.state=new sy);uy.get=uy.get,uy.has=uy.has,uy.set=uy.set,k_=function(e,t){if(uy.has(e))throw new ay(oy);return t.facade=e,uy.set(e,t),t},A_=function(e){return uy.get(e)||{}},x_=function(e){return uy.has(e)}}else{var cy=ny("state");iy[cy]=!0,k_=function(e,t){if(ty(e,cy))throw new ay(oy);return t.facade=e,ey(e,cy,t),t},A_=function(e){return ty(e,cy)?e[cy]:{}},x_=function(e){return ty(e,cy)}}var ly={set:k_,get:A_,has:x_,enforce:function(e){return x_(e)?A_(e):k_(e,{})},getterFor:function(e){return function(t){var r;if(!$_(t)||(r=A_(t)).type!==e)throw new ay("Incompatible receiver, "+e+" required");return r}}},dy=Qf,fy=Array.isArray||function(e){return"Array"===dy(e)},hy=fy,gy=jp,my=wh,py=jg("species"),vy=Array,_y=function(e){var t;return hy(e)&&(t=e.constructor,(gy(t)&&(t===vy||hy(t.prototype))||my(t)&&null===(t=t[py]))&&(t=undefined)),t===undefined?vy:t},yy=function(e,t){return new(_y(e))(0===t?0:t)},Sy=Em,Iy=ph,by=wg,Ty=ov,Cy=yy,wy=Hf([].push),Ey=function(e){var t=1===e,r=2===e,n=3===e,i=4===e,o=6===e,a=7===e,s=5===e||o;return function(u,c,l,d){for(var f,h,g=by(u),m=Iy(g),p=Ty(m),v=Sy(c,l),_=0,y=d||Cy,S=t?y(u,p):r||a?y(u,0):undefined;p>_;_++)if((s||_ in m)&&(h=v(f=m[_],_,g),e))if(t)S[_]=h;else if(h)switch(e){case 3:return!0;case 5:return f;case 6:return _;case 2:wy(S,f)}else switch(e){case 4:return!1;case 7:wy(S,f)}return o?-1:n||i?i:S}},ky={forEach:Ey(0),map:Ey(1),filter:Ey(2),some:Ey(3),every:Ey(4),find:Ey(5),findIndex:Ey(6),filterReject:Ey(7)},Ay=ip,xy=Ff,Py=ih,Dy=Hf,Fy=th,Wy=Kh,Ry=Wf,Ny=Ag,Oy=Fh,My=Fm,Ly=Th,By=Zg,Uy=l_,Vy=dh,jy=Kv,Gy=Iv,Hy=d_,zy=g_,Ky=S_,Jy=eh,Qy=km,qy=Jp,Yy=oh,Xy=b_,Zy=C_,$y=bg,eS=dv,tS=Wg,rS=jg,nS=w_,iS=R_,oS=B_,aS=Q_,sS=ly,uS=ky.forEach,cS=Fv("hidden"),lS="Symbol",dS="prototype",fS=sS.set,hS=sS.getterFor(lS),gS=Object[dS],mS=xy.Symbol,pS=mS&&mS[dS],vS=xy.RangeError,_S=xy.TypeError,yS=xy.QObject,SS=Jy.f,IS=Qy.f,bS=zy.f,TS=Yy.f,CS=Dy([].push),wS=$y("symbols"),ES=$y("op-symbols"),kS=$y("wks"),AS=!yS||!yS[dS]||!yS[dS].findChild,xS=function(e,t,r){var n=SS(gS,t);n&&delete gS[t],IS(e,t,r),n&&e!==gS&&IS(gS,t,n)},PS=Fy&&Ry((function(){return 7!==jy(IS({},"a",{get:function(){return IS(this,"a",{value:7}).a}})).a}))?xS:IS,DS=function(e,t){var r=wS[e]=jy(pS);return fS(r,{type:lS,tag:e,description:t}),Fy||(r.description=t),r},FS=function(e,t,r){e===gS&&FS(ES,t,r),My(e);var n=By(t);return My(r),Ny(wS,n)?(r.enumerable?(Ny(e,cS)&&e[cS][n]&&(e[cS][n]=!1),r=jy(r,{enumerable:Vy(0,!1)})):(Ny(e,cS)||IS(e,cS,Vy(1,jy(null))),e[cS][n]=!0),PS(e,n,r)):IS(e,n,r)},WS=function(e,t){My(e);var r=Ly(t),n=Gy(r).concat(MS(r));return uS(n,(function(t){Fy&&!Py(RS,r,t)||FS(e,t,r[t])})),e},RS=function(e){var t=By(e),r=Py(TS,this,t);return!(this===gS&&Ny(wS,t)&&!Ny(ES,t))&&(!(r||!Ny(this,t)||!Ny(wS,t)||Ny(this,cS)&&this[cS][t])||r)},NS=function(e,t){var r=Ly(e),n=By(t);if(r!==gS||!Ny(wS,n)||Ny(ES,n)){var i=SS(r,n);return!i||!Ny(wS,n)||Ny(r,cS)&&r[cS][n]||(i.enumerable=!0),i}},OS=function(e){var t=bS(Ly(e)),r=[];return uS(t,(function(e){Ny(wS,e)||Ny(eS,e)||CS(r,e)})),r},MS=function(e){var t=e===gS,r=bS(t?ES:Ly(e)),n=[];return uS(r,(function(e){!Ny(wS,e)||t&&!Ny(gS,e)||CS(n,wS[e])})),n};Wy||(mS=function(){if(Oy(pS,this))throw new _S("Symbol is not a constructor");var e=arguments.length&&arguments[0]!==undefined?Uy(arguments[0]):undefined,t=tS(e),r=function(e){var n=this===undefined?xy:this;n===gS&&Py(r,ES,e),Ny(n,cS)&&Ny(n[cS],t)&&(n[cS][t]=!1);var i=Vy(1,e);try{PS(n,t,i)}catch(bi){if(!(bi instanceof vS))throw bi;xS(n,t,i)}};return Fy&&AS&&PS(gS,t,{configurable:!0,set:r}),DS(t,e)},Xy(pS=mS[dS],"toString",(function(){return hS(this).tag})),Xy(mS,"withoutSetter",(function(e){return DS(tS(e),e)})),Yy.f=RS,Qy.f=FS,qy.f=WS,Jy.f=NS,Hy.f=zy.f=OS,Ky.f=MS,nS.f=function(e){return DS(rS(e),e)},Fy&&Zy(pS,"description",{configurable:!0,get:function(){return hS(this).description}})),Ay({global:!0,constructor:!0,wrap:!0,forced:!Wy,sham:!Wy},{Symbol:mS}),uS(Gy(kS),(function(e){iS(e)})),Ay({target:lS,stat:!0,forced:!Wy},{useSetter:function(){AS=!0},useSimple:function(){AS=!1}}),Ay({target:"Object",stat:!0,forced:!Wy,sham:!Fy},{create:function(e,t){return t===undefined?jy(e):WS(jy(e),t)},defineProperty:FS,defineProperties:WS,getOwnPropertyDescriptor:NS}),Ay({target:"Object",stat:!0,forced:!Wy},{getOwnPropertyNames:OS}),oS(),aS(mS,lS),eS[cS]=!0;var LS=Kh&&!!Symbol["for"]&&!!Symbol.keyFor,BS=ip,US=Dh,VS=Ag,jS=l_,GS=bg,HS=LS,zS=GS("string-to-symbol-registry"),KS=GS("symbol-to-string-registry");BS({target:"Symbol",stat:!0,forced:!HS},{"for":function(e){var t=jS(e);if(VS(zS,t))return zS[t];var r=US("Symbol")(t);return zS[t]=r,KS[r]=t,r}});var JS=ip,QS=Ag,qS=Zh,YS=eg,XS=LS,ZS=bg("symbol-to-string-registry");JS({target:"Symbol",stat:!0,forced:!XS},{keyFor:function(e){if(!qS(e))throw new TypeError(YS(e)+" is not a symbol");if(QS(ZS,e))return ZS[e]}});var $S=fy,eI=$f,tI=Qf,rI=l_,nI=Hf([].push),iI=ip,oI=Dh,aI=Bf,sI=ih,uI=Hf,cI=Wf,lI=$f,dI=Zh,fI=op,hI=function(e){if(eI(e))return e;if($S(e)){for(var t=e.length,r=[],n=0;n<t;n++){var i=e[n];"string"==typeof i?nI(r,i):"number"!=typeof i&&"Number"!==tI(i)&&"String"!==tI(i)||nI(r,rI(i))}var o=r.length,a=!0;return function(e,t){if(a)return a=!1,t;if($S(this))return t;for(var n=0;n<o;n++)if(r[n]===e)return t}}},gI=Kh,mI=String,pI=oI("JSON","stringify"),vI=uI(/./.exec),_I=uI("".charAt),yI=uI("".charCodeAt),SI=uI("".replace),II=uI(1..toString),bI=/[\uD800-\uDFFF]/g,TI=/^[\uD800-\uDBFF]$/,CI=/^[\uDC00-\uDFFF]$/,wI=!gI||cI((function(){var e=oI("Symbol")("stringify detection");return"[null]"!==pI([e])||"{}"!==pI({a:e})||"{}"!==pI(Object(e))})),EI=cI((function(){return'"\\udf06\\ud834"'!==pI("\udf06\ud834")||'"\\udead"'!==pI("\udead")})),kI=function(e,t){var r=fI(arguments),n=hI(t);if(lI(n)||e!==undefined&&!dI(e))return r[1]=function(e,t){if(lI(n)&&(t=sI(n,this,mI(e),t)),!dI(t))return t},aI(pI,null,r)},AI=function(e,t,r){var n=_I(r,t-1),i=_I(r,t+1);return vI(TI,e)&&!vI(CI,i)||vI(CI,e)&&!vI(TI,n)?"\\u"+II(yI(e,0),16):e};pI&&iI({target:"JSON",stat:!0,arity:3,forced:wI||EI},{stringify:function(e,t,r){var n=fI(arguments),i=aI(wI?kI:pI,null,n);return EI&&"string"==typeof i?SI(i,bI,AI):i}});var xI=S_,PI=wg;ip({target:"Object",stat:!0,forced:!Kh||Wf((function(){xI.f(1)}))},{getOwnPropertySymbols:function(e){var t=xI.f;return t?t(PI(e)):[]}});var DI=k(Eh.Object.getOwnPropertySymbols),FI={exports:{}},WI=ip,RI=Wf,NI=Th,OI=eh.f,MI=th;WI({target:"Object",stat:!0,forced:!MI||RI((function(){OI(1)})),sham:!MI},{getOwnPropertyDescriptor:function(e,t){return OI(NI(e),t)}});var LI=Eh.Object,BI=FI.exports=function(e,t){return LI.getOwnPropertyDescriptor(e,t)};LI.getOwnPropertyDescriptor.sham&&(BI.sham=!0);var UI=FI.exports,VI=k(UI),jI=Dh,GI=d_,HI=S_,zI=Fm,KI=Hf([].concat),JI=jI("Reflect","ownKeys")||function(e){var t=GI.f(zI(e)),r=HI.f;return r?KI(t,r(e)):t},QI=th,qI=km,YI=dh,XI=function(e,t,r){QI?qI.f(e,t,YI(0,r)):e[t]=r},ZI=JI,$I=Th,eb=eh,tb=XI;ip({target:"Object",stat:!0,sham:!th},{getOwnPropertyDescriptors:function(e){for(var t,r,n=$I(e),i=eb.f,o=ZI(n),a={},s=0;o.length>s;)(r=i(n,t=o[s++]))!==undefined&&tb(a,t,r);return a}});var rb=k(Eh.Object.getOwnPropertyDescriptors),nb={exports:{}},ib=ip,ob=th,ab=Jp.f;ib({target:"Object",stat:!0,forced:Object.defineProperties!==ab,sham:!ob},{defineProperties:ab});var sb=Eh.Object,ub=nb.exports=function(e,t){return sb.defineProperties(e,t)};sb.defineProperties.sham&&(ub.sham=!0);var cb=k(nb.exports),lb=!Wf((function(){function e(){}return e.prototype.constructor=null,Object.getPrototypeOf(new e)!==e.prototype})),db=Ag,fb=$f,hb=wg,gb=lb,mb=Fv("IE_PROTO"),pb=Object,vb=pb.prototype,_b=gb?pb.getPrototypeOf:function(e){var t=hb(e);if(db(t,mb))return t[mb];var r=t.constructor;return fb(r)&&t instanceof r?r.prototype:t instanceof pb?vb:null},yb=Hf,Sb=ig,Ib=wh,bb=function(e){return Ib(e)||null===e},Tb=String,Cb=TypeError,wb=function(e,t,r){try{return yb(Sb(Object.getOwnPropertyDescriptor(e,t)[r]))}catch(bi){}},Eb=wh,kb=Sh,Ab=function(e){if(bb(e))return e;throw new Cb("Can't set "+Tb(e)+" as a prototype")},xb=Object.setPrototypeOf||("__proto__"in{}?function(){var e,t=!1,r={};try{(e=wb(Object.prototype,"__proto__","set"))(r,[]),t=r instanceof Array}catch(bi){}return function(r,n){return kb(r),Ab(n),Eb(r)?(t?e(r,n):r.__proto__=n,r):r}}():undefined),Pb=Ag,Db=JI,Fb=eh,Wb=km,Rb=wh,Nb=Km,Ob=Error,Mb=Hf("".replace),Lb=String(new Ob("zxcasd").stack),Bb=/\n\s*at [^:]*:[^\n]*/,Ub=Bb.test(Lb),Vb=dh,jb=!Wf((function(){var e=new Error("a");return!("stack"in e)||(Object.defineProperty(e,"stack",Vb(1,7)),7!==e.stack)})),Gb=Km,Hb=function(e,t){if(Ub&&"string"==typeof e&&!Ob.prepareStackTrace)for(;t--;)e=Mb(e,Bb,"");return e},zb=jb,Kb=Error.captureStackTrace,Jb={},Qb=Jb,qb=jg("iterator"),Yb=Array.prototype,Xb=function(e){return e!==undefined&&(Qb.Array===e||Yb[qb]===e)},Zb=wp,$b=sg,eT=vh,tT=Jb,rT=jg("iterator"),nT=function(e){if(!eT(e))return $b(e,rT)||$b(e,"@@iterator")||tT[Zb(e)]},iT=ih,oT=ig,aT=Fm,sT=eg,uT=nT,cT=TypeError,lT=function(e,t){var r=arguments.length<2?uT(e):t;if(oT(r))return aT(iT(r,e));throw new cT(sT(e)+" is not iterable")},dT=ih,fT=Fm,hT=sg,gT=function(e,t,r){var n,i;fT(e);try{if(!(n=hT(e,"return"))){if("throw"===t)throw r;return r}n=dT(n,e)}catch(bi){i=!0,n=bi}if("throw"===t)throw r;if(i)throw n;return fT(n),r},mT=Em,pT=ih,vT=Fm,_T=eg,yT=Xb,ST=ov,IT=Fh,bT=lT,TT=nT,CT=gT,wT=TypeError,ET=function(e,t){this.stopped=e,this.result=t},kT=ET.prototype,AT=function(e,t,r){var n,i,o,a,s,u,c,l=r&&r.that,d=!(!r||!r.AS_ENTRIES),f=!(!r||!r.IS_RECORD),h=!(!r||!r.IS_ITERATOR),g=!(!r||!r.INTERRUPTED),m=mT(t,l),p=function(e){return n&&CT(n,"normal",e),new ET(!0,e)},v=function(e){return d?(vT(e),g?m(e[0],e[1],p):m(e[0],e[1])):g?m(e,p):m(e)};if(f)n=e.iterator;else if(h)n=e;else{if(!(i=TT(e)))throw new wT(_T(e)+" is not iterable");if(yT(i)){for(o=0,a=ST(e);a>o;o++)if((s=v(e[o]))&&IT(kT,s))return s;return new ET(!1)}n=bT(e,i)}for(u=f?e.next:n.next;!(c=pT(u,n)).done;){try{s=v(c.value)}catch(bi){CT(n,"throw",bi)}if("object"==_(s)&&s&&IT(kT,s))return s}return new ET(!1)},xT=l_,PT=ip,DT=Fh,FT=_b,WT=xb,RT=function(e,t,r){for(var n=Db(t),i=Wb.f,o=Fb.f,a=0;a<n.length;a++){var s=n[a];Pb(e,s)||r&&Pb(r,s)||i(e,s,o(t,s))}},NT=Kv,OT=Km,MT=dh,LT=function(e,t){Rb(t)&&"cause"in t&&Nb(e,"cause",t.cause)},BT=function(e,t,r,n){zb&&(Kb?Kb(e,t):Gb(e,"stack",Hb(r,n)))},UT=AT,VT=function(e,t){return e===undefined?arguments.length<2?"":t:xT(e)},jT=jg("toStringTag"),GT=Error,HT=[].push,zT=function(e,t){var r,n=DT(KT,this);WT?r=WT(new GT,n?FT(this):KT):(r=n?this:NT(KT),OT(r,jT,"Error")),t!==undefined&&OT(r,"message",VT(t)),BT(r,zT,r.stack,1),arguments.length>2&<(r,arguments[2]);var i=[];return UT(e,HT,{that:i}),OT(r,"errors",i),r};WT?WT(zT,GT):RT(zT,GT,{name:!0});var KT=zT.prototype=NT(GT.prototype,{constructor:MT(1,zT),message:MT(1,""),name:MT(1,"AggregateError")});PT({global:!0,constructor:!0,arity:2},{AggregateError:zT});var JT,QT,qT,YT=th,XT=Ag,ZT=Function.prototype,$T=YT&&Object.getOwnPropertyDescriptor,eC=XT(ZT,"name"),tC={EXISTS:eC,PROPER:eC&&"something"===function(){}.name,CONFIGURABLE:eC&&(!YT||YT&&$T(ZT,"name").configurable)},rC=Wf,nC=$f,iC=wh,oC=Kv,aC=_b,sC=b_,uC=jg("iterator"),cC=!1;[].keys&&("next"in(qT=[].keys())?(QT=aC(aC(qT)))!==Object.prototype&&(JT=QT):cC=!0);var lC=!iC(JT)||rC((function(){var e={};return JT[uC].call(e)!==e}));nC((JT=lC?{}:oC(JT))[uC])||sC(JT,uC,(function(){return this}));var dC={IteratorPrototype:JT,BUGGY_SAFARI_ITERATORS:cC},fC=dC.IteratorPrototype,hC=Kv,gC=dh,mC=Q_,pC=Jb,vC=function(){return this},_C=function(e,t,r,n){var i=t+" Iterator";return e.prototype=hC(fC,{next:gC(+!n,r)}),mC(e,i,!1,!0),pC[i]=vC,e},yC=ip,SC=ih,IC=_C,bC=_b,TC=Q_,CC=b_,wC=Jb,EC=tC.PROPER,kC=dC.BUGGY_SAFARI_ITERATORS,AC=jg("iterator"),xC="keys",PC="values",DC="entries",FC=function(){return this},WC=function(e,t,r,n,i,o,a){IC(r,t,n);var s,u,c,l=function(e){if(e===i&&m)return m;if(!kC&&e&&e in h)return h[e];switch(e){case xC:case PC:case DC:return function(){return new r(this,e)}}return function(){return new r(this)}},d=t+" Iterator",f=!1,h=e.prototype,g=h[AC]||h["@@iterator"]||i&&h[i],m=!kC&&g||l(i),p="Array"===t&&h.entries||g;if(p&&(s=bC(p.call(new e)))!==Object.prototype&&s.next&&(TC(s,d,!0,!0),wC[d]=FC),EC&&i===PC&&g&&g.name!==PC&&(f=!0,m=function(){return SC(g,this)}),i)if(u={values:l(PC),keys:o?m:l(xC),entries:l(DC)},a)for(c in u)(kC||f||!(c in h))&&CC(h,c,u[c]);else yC({target:t,proto:!0,forced:kC||f},u);return a&&h[AC]!==m&&CC(h,AC,m,{name:i}),wC[t]=m,u},RC=function(e,t){return{value:e,done:t}},NC=Th,OC=Jb,MC=ly;km.f;var LC=WC,BC=RC,UC="Array Iterator",VC=MC.set,jC=MC.getterFor(UC);LC(Array,"Array",(function(e,t){VC(this,{type:UC,target:NC(e),index:0,kind:t})}),(function(){var e=jC(this),t=e.target,r=e.index++;if(!t||r>=t.length)return e.target=null,BC(undefined,!0);switch(e.kind){case"keys":return BC(r,!1);case"values":return BC(t[r],!1)}return BC([r,t[r]],!1)}),"values"),OC.Arguments=OC.Array;var GC,HC,zC,KC,JC=Ff,QC=Nh,qC=Qf,YC=function(e){return QC.slice(0,e.length)===e},XC=YC("Bun/")?"BUN":YC("Cloudflare-Workers")?"CLOUDFLARE":YC("Deno/")?"DENO":YC("Node.js/")?"NODE":JC.Bun&&"string"==typeof Bun.version?"BUN":JC.Deno&&"object"==_(Deno.version)?"DENO":"process"===qC(JC.process)?"NODE":JC.window&&JC.document?"BROWSER":"REST",ZC="NODE"===XC,$C=Dh,ew=C_,tw=th,rw=jg("species"),nw=function(e){var t=$C(e);tw&&t&&!t[rw]&&ew(t,rw,{configurable:!0,get:function(){return this}})},iw=Fh,ow=TypeError,aw=function(e,t){if(iw(t,e))return e;throw new ow("Incorrect invocation")},sw=Fm,uw=Kp,cw=vh,lw=jg("species"),dw=function(e,t){var r,n=sw(e).constructor;return n===undefined||cw(r=sw(n)[lw])?t:uw(r)},fw=TypeError,hw=function(e,t){if(e<t)throw new fw("Not enough arguments");return e},gw=/(?:ipad|iphone|ipod).*applewebkit/i.test(Nh),mw=Ff,pw=Bf,vw=Em,_w=$f,yw=Ag,Sw=Wf,Iw=xv,bw=op,Tw=rm,Cw=hw,ww=gw,Ew=ZC,kw=mw.setImmediate,Aw=mw.clearImmediate,xw=mw.process,Pw=mw.Dispatch,Dw=mw.Function,Fw=mw.MessageChannel,Ww=mw.String,Rw=0,Nw={},Ow="onreadystatechange";Sw((function(){GC=mw.location}));var Mw=function(e){if(yw(Nw,e)){var t=Nw[e];delete Nw[e],t()}},Lw=function(e){return function(){Mw(e)}},Bw=function(e){Mw(e.data)},Uw=function(e){mw.postMessage(Ww(e),GC.protocol+"//"+GC.host)};kw&&Aw||(kw=function(e){Cw(arguments.length,1);var t=_w(e)?e:Dw(e),r=bw(arguments,1);return Nw[++Rw]=function(){pw(t,undefined,r)},HC(Rw),Rw},Aw=function(e){delete Nw[e]},Ew?HC=function(e){xw.nextTick(Lw(e))}:Pw&&Pw.now?HC=function(e){Pw.now(Lw(e))}:Fw&&!ww?(KC=(zC=new Fw).port2,zC.port1.onmessage=Bw,HC=vw(KC.postMessage,KC)):mw.addEventListener&&_w(mw.postMessage)&&!mw.importScripts&&GC&&"file:"!==GC.protocol&&!Sw(Uw)?(HC=Uw,mw.addEventListener("message",Bw,!1)):HC=Ow in Tw("script")?function(e){Iw.appendChild(Tw("script"))[Ow]=function(){Iw.removeChild(this),Mw(e)}}:function(e){setTimeout(Lw(e),0)});var Vw={set:kw,clear:Aw},jw=Ff,Gw=th,Hw=Object.getOwnPropertyDescriptor,zw=function(e){if(!Gw)return jw[e];var t=Hw(jw,e);return t&&t.value},Kw=function(){this.head=null,this.tail=null};Kw.prototype={add:function(e){var t={item:e,next:null},r=this.tail;r?r.next=t:this.head=t,this.tail=t},get:function(){var e=this.head;if(e)return null===(this.head=e.next)&&(this.tail=null),e.item}};var Jw,Qw,qw,Yw,Xw,Zw=Kw,$w=/ipad|iphone|ipod/i.test(Nh)&&"undefined"!=typeof Pebble,eE=/web0s(?!.*chrome)/i.test(Nh),tE=Ff,rE=zw,nE=Em,iE=Vw.set,oE=Zw,aE=gw,sE=$w,uE=eE,cE=ZC,lE=tE.MutationObserver||tE.WebKitMutationObserver,dE=tE.document,fE=tE.process,hE=tE.Promise,gE=rE("queueMicrotask");if(!gE){var mE=new oE,pE=function(){var e,t;for(cE&&(e=fE.domain)&&e.exit();t=mE.get();)try{t()}catch(bi){throw mE.head&&Jw(),bi}e&&e.enter()};aE||cE||uE||!lE||!dE?!sE&&hE&&hE.resolve?((Yw=hE.resolve(undefined)).constructor=hE,Xw=nE(Yw.then,Yw),Jw=function(){Xw(pE)}):cE?Jw=function(){fE.nextTick(pE)}:(iE=nE(iE,tE),Jw=function(){iE(pE)}):(Qw=!0,qw=dE.createTextNode(""),new lE(pE).observe(qw,{characterData:!0}),Jw=function(){qw.data=Qw=!Qw}),gE=function(e){mE.head||Jw(),mE.add(e)}}var vE=gE,_E=function(e){try{return{error:!1,value:e()}}catch(bi){return{error:!0,value:bi}}},yE=Ff.Promise,SE=Ff,IE=yE,bE=$f,TE=bm,CE=xp,wE=jg,EE=XC,kE=jh,AE=IE&&IE.prototype,xE=wE("species"),PE=!1,DE=bE(SE.PromiseRejectionEvent),FE=TE("Promise",(function(){var e=CE(IE),t=e!==String(IE);if(!t&&66===kE)return!0;if(!AE["catch"]||!AE["finally"])return!0;if(!kE||kE<51||!/native code/.test(e)){var r=new IE((function(e){e(1)})),n=function(e){e((function(){}),(function(){}))};if((r.constructor={})[xE]=n,!(PE=r.then((function(){}))instanceof n))return!0}return!(t||"BROWSER"!==EE&&"DENO"!==EE||DE)})),WE={CONSTRUCTOR:FE,REJECTION_EVENT:DE,SUBCLASSING:PE},RE={},NE=ig,OE=TypeError,ME=function(e){var t,r;this.promise=new e((function(e,n){if(t!==undefined||r!==undefined)throw new OE("Bad Promise constructor");t=e,r=n})),this.resolve=NE(t),this.reject=NE(r)};RE.f=function(e){return new ME(e)};var LE,BE,UE=ip,VE=ZC,jE=Ff,GE=ih,HE=b_,zE=Q_,KE=nw,JE=ig,QE=$f,qE=wh,YE=aw,XE=dw,ZE=Vw.set,$E=vE,ek=function(e,t){},tk=_E,rk=Zw,nk=ly,ik=yE,ok=RE,ak="Promise",sk=WE.CONSTRUCTOR,uk=WE.REJECTION_EVENT,ck=nk.getterFor(ak),lk=nk.set,dk=ik&&ik.prototype,fk=ik,hk=dk,gk=jE.TypeError,mk=jE.document,pk=jE.process,vk=ok.f,_k=vk,yk=!!(mk&&mk.createEvent&&jE.dispatchEvent),Sk="unhandledrejection",Ik=function(e){var t;return!(!qE(e)||!QE(t=e.then))&&t},bk=function(e,t){var r,n,i,o=t.value,a=1===t.state,s=a?e.ok:e.fail,u=e.resolve,c=e.reject,l=e.domain;try{s?(a||(2===t.rejection&&kk(t),t.rejection=1),!0===s?r=o:(l&&l.enter(),r=s(o),l&&(l.exit(),i=!0)),r===e.promise?c(new gk("Promise-chain cycle")):(n=Ik(r))?GE(n,r,u,c):u(r)):c(o)}catch(bi){l&&!i&&l.exit(),c(bi)}},Tk=function(e,t){e.notified||(e.notified=!0,$E((function(){for(var r,n=e.reactions;r=n.get();)bk(r,e);e.notified=!1,t&&!e.rejection&&wk(e)})))},Ck=function(e,t,r){var n,i;yk?((n=mk.createEvent("Event")).promise=t,n.reason=r,n.initEvent(e,!1,!0),jE.dispatchEvent(n)):n={promise:t,reason:r},!uk&&(i=jE["on"+e])?i(n):e===Sk&&ek("Unhandled promise rejection",r)},wk=function(e){GE(ZE,jE,(function(){var t,r=e.facade,n=e.value;if(Ek(e)&&(t=tk((function(){VE?pk.emit("unhandledRejection",n,r):Ck(Sk,r,n)})),e.rejection=VE||Ek(e)?2:1,t.error))throw t.value}))},Ek=function(e){return 1!==e.rejection&&!e.parent},kk=function(e){GE(ZE,jE,(function(){var t=e.facade;VE?pk.emit("rejectionHandled",t):Ck("rejectionhandled",t,e.value)}))},Ak=function(e,t,r){return function(n){e(t,n,r)}},xk=function(e,t,r){e.done||(e.done=!0,r&&(e=r),e.value=t,e.state=2,Tk(e,!0))},Pk=function(e,t,r){if(!e.done){e.done=!0,r&&(e=r);try{if(e.facade===t)throw new gk("Promise can't be resolved itself");var n=Ik(t);n?$E((function(){var r={done:!1};try{GE(n,t,Ak(Pk,r,e),Ak(xk,r,e))}catch(bi){xk(r,bi,e)}})):(e.value=t,e.state=1,Tk(e,!1))}catch(bi){xk({done:!1},bi,e)}}};sk&&(hk=(fk=function(e){YE(this,hk),JE(e),GE(LE,this);var t=ck(this);try{e(Ak(Pk,t),Ak(xk,t))}catch(bi){xk(t,bi)}}).prototype,(LE=function(e){lk(this,{type:ak,done:!1,notified:!1,parent:!1,reactions:new rk,rejection:!1,state:0,value:null})}).prototype=HE(hk,"then",(function(e,t){var r=ck(this),n=vk(XE(this,fk));return r.parent=!0,n.ok=!QE(e)||e,n.fail=QE(t)&&t,n.domain=VE?pk.domain:undefined,0===r.state?r.reactions.add(n):$E((function(){bk(n,r)})),n.promise})),BE=function(){var e=new LE,t=ck(e);this.promise=e,this.resolve=Ak(Pk,t),this.reject=Ak(xk,t)},ok.f=vk=function(e){return e===fk||undefined===e?new BE(e):_k(e)}),UE({global:!0,constructor:!0,wrap:!0,forced:sk},{Promise:fk}),zE(fk,ak,!1,!0),KE(ak);var Dk=jg("iterator"),Fk=!1;try{var Wk=0,Rk={next:function(){return{done:!!Wk++}},"return":function(){Fk=!0}};Rk[Dk]=function(){return this},Array.from(Rk,(function(){throw 2}))}catch(bi){}var Nk=function(e,t){try{if(!t&&!Fk)return!1}catch(bi){return!1}var r=!1;try{var n={};n[Dk]=function(){return{next:function(){return{done:r=!0}}}},e(n)}catch(bi){}return r},Ok=yE,Mk=WE.CONSTRUCTOR||!Nk((function(e){Ok.all(e).then(undefined,(function(){}))})),Lk=ih,Bk=ig,Uk=RE,Vk=_E,jk=AT;ip({target:"Promise",stat:!0,forced:Mk},{all:function(e){var t=this,r=Uk.f(t),n=r.resolve,i=r.reject,o=Vk((function(){var r=Bk(t.resolve),o=[],a=0,s=1;jk(e,(function(e){var u=a++,c=!1;s++,Lk(r,t,e).then((function(e){c||(c=!0,o[u]=e,--s||n(o))}),i)})),--s||n(o)}));return o.error&&i(o.value),r.promise}});var Gk=ip,Hk=WE.CONSTRUCTOR;yE&&yE.prototype,Gk({target:"Promise",proto:!0,forced:Hk,real:!0},{"catch":function(e){return this.then(undefined,e)}});var zk=ih,Kk=ig,Jk=RE,Qk=_E,qk=AT;ip({target:"Promise",stat:!0,forced:Mk},{race:function(e){var t=this,r=Jk.f(t),n=r.reject,i=Qk((function(){var i=Kk(t.resolve);qk(e,(function(e){zk(i,t,e).then(r.resolve,n)}))}));return i.error&&n(i.value),r.promise}});var Yk=RE;ip({target:"Promise",stat:!0,forced:WE.CONSTRUCTOR},{reject:function(e){var t=Yk.f(this);return(0,t.reject)(e),t.promise}});var Xk=Fm,Zk=wh,$k=RE,eA=function(e,t){if(Xk(e),Zk(t)&&t.constructor===e)return t;var r=$k.f(e);return(0,r.resolve)(t),r.promise},tA=ip,rA=yE,nA=WE.CONSTRUCTOR,iA=eA,oA=Dh("Promise"),aA=!nA;tA({target:"Promise",stat:!0,forced:true},{resolve:function(e){return iA(aA&&this===oA?rA:this,e)}});var sA=ih,uA=ig,cA=RE,lA=_E,dA=AT;ip({target:"Promise",stat:!0,forced:Mk},{allSettled:function(e){var t=this,r=cA.f(t),n=r.resolve,i=r.reject,o=lA((function(){var r=uA(t.resolve),i=[],o=0,a=1;dA(e,(function(e){var s=o++,u=!1;a++,sA(r,t,e).then((function(e){u||(u=!0,i[s]={status:"fulfilled",value:e},--a||n(i))}),(function(e){u||(u=!0,i[s]={status:"rejected",reason:e},--a||n(i))}))})),--a||n(i)}));return o.error&&i(o.value),r.promise}});var fA=ih,hA=ig,gA=Dh,mA=RE,pA=_E,vA=AT,_A="No one promise resolved";ip({target:"Promise",stat:!0,forced:Mk},{any:function(e){var t=this,r=gA("AggregateError"),n=mA.f(t),i=n.resolve,o=n.reject,a=pA((function(){var n=hA(t.resolve),a=[],s=0,u=1,c=!1;vA(e,(function(e){var l=s++,d=!1;u++,fA(n,t,e).then((function(e){d||c||(c=!0,i(e))}),(function(e){d||c||(d=!0,a[l]=e,--u||o(new r(a,_A)))}))})),--u||o(new r(a,_A))}));return a.error&&o(a.value),n.promise}});var yA=RE;ip({target:"Promise",stat:!0},{withResolvers:function(){var e=yA.f(this);return{promise:e.promise,resolve:e.resolve,reject:e.reject}}});var SA=ip,IA=yE,bA=Wf,TA=Dh,CA=$f,wA=dw,EA=eA,kA=IA&&IA.prototype;SA({target:"Promise",proto:!0,real:!0,forced:!!IA&&bA((function(){kA["finally"].call({then:function(){}},(function(){}))}))},{"finally":function(e){var t=wA(this,TA("Promise")),r=CA(e);return this.then(r?function(r){return EA(t,e()).then((function(){return r}))}:e,r?function(r){return EA(t,e()).then((function(){throw r}))}:e)}});var AA=Hf,xA=Xp,PA=l_,DA=Sh,FA=AA("".charAt),WA=AA("".charCodeAt),RA=AA("".slice),NA=function(e){return function(t,r){var n,i,o=PA(DA(t)),a=xA(r),s=o.length;return a<0||a>=s?e?"":undefined:(n=WA(o,a))<55296||n>56319||a+1===s||(i=WA(o,a+1))<56320||i>57343?e?FA(o,a):n:e?RA(o,a,a+2):i-56320+(n-55296<<10)+65536}},OA={codeAt:NA(!1),charAt:NA(!0)},MA=OA.charAt,LA=l_,BA=ly,UA=WC,VA=RC,jA="String Iterator",GA=BA.set,HA=BA.getterFor(jA);UA(String,"String",(function(e){GA(this,{type:jA,string:LA(e),index:0})}),(function(){var e,t=HA(this),r=t.string,n=t.index;return n>=r.length?VA(undefined,!0):(e=MA(r,n),t.index+=e.length,VA(e,!1))}));var zA=Eh.Promise,KA={CSSRuleList:0,CSSStyleDeclaration:0,CSSValueList:0,ClientRectList:0,DOMRectList:0,DOMStringList:0,DOMTokenList:1,DataTransferItemList:0,FileList:0,HTMLAllCollection:0,HTMLCollection:0,HTMLFormElement:0,HTMLSelectElement:0,MediaList:0,MimeTypeArray:0,NamedNodeMap:0,NodeList:1,PaintRequestList:0,Plugin:0,PluginArray:0,SVGLengthList:0,SVGNumberList:0,SVGPathSegList:0,SVGPointList:0,SVGStringList:0,SVGTransformList:0,SourceBufferList:0,StyleSheetList:0,TextTrackCueList:0,TextTrackList:0,TouchList:0},JA=Ff,QA=Q_,qA=Jb;for(var YA in KA)QA(JA[YA],YA),qA[YA]=qA.Array;var XA=zA,ZA=ip,$A=Bf,ex=op,tx=RE,rx=ig,nx=_E,ix=Ff.Promise,ox=!1;ZA({target:"Promise",stat:!0,forced:!ix||!ix["try"]||nx((function(){ix["try"]((function(e){ox=8===e}),8)})).error||!ox},{"try":function(e){var t=arguments.length>1?ex(arguments,1):[],r=tx.f(this),n=nx((function(){return $A(rx(e),undefined,t)}));return(n.error?r.reject:r.resolve)(n.value),r.promise}});var ax=XA,sx=k(ax);function ux(e,t,r,n,i,o,a){try{var s=e[o](a),u=s.value}catch(e){return void r(e)}s.done?t(u):sx.resolve(u).then(n,i)}function cx(e){return function(){var t=this,r=arguments;return new sx((function(n,i){var o=e.apply(t,r);function a(e){ux(o,n,i,a,s,"next",e)}function s(e){ux(o,n,i,a,s,"throw",e)}a(void 0)}))}}function lx(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}var dx=Ag,fx=ih,hx=wh,gx=Fm,mx=function(e){return e!==undefined&&(dx(e,"value")||dx(e,"writable"))},px=eh,vx=_b;ip({target:"Reflect",stat:!0},{get:function VJ(e,t){var r,n,i=arguments.length<3?e:arguments[2];return gx(e)===i?e[t]:(r=px.f(e,t))?mx(r)?r.value:r.get===undefined?undefined:fx(r.get,i):hx(n=vx(e))?VJ(n,t,i):void 0}});var _x=k(Eh.Reflect.get),yx=pp;ip({target:"Function",proto:!0,forced:Function.bind!==yx},{bind:yx});var Sx=Ff,Ix=Eh,bx=function(e,t){var r=Ix[e+"Prototype"],n=r&&r[t];if(n)return n;var i=Sx[e],o=i&&i.prototype;return o&&o[t]},Tx=bx("Function","bind"),Cx=Fh,wx=Tx,Ex=Function.prototype,kx=function(e){var t=e.bind;return e===Ex||Cx(Ex,e)&&t===Ex.bind?wx:t},Ax=k(kx),xx=k(UI);ip({target:"Object",stat:!0},{setPrototypeOf:xb});var Px=Eh.Object.setPrototypeOf,Dx=k(Px),Fx=wg,Wx=_b,Rx=lb;ip({target:"Object",stat:!0,forced:Wf((function(){Wx(1)})),sham:!Rx},{getPrototypeOf:function(e){return Wx(Fx(e))}});var Nx=Eh.Object.getPrototypeOf,Ox=k(Nx);function Mx(e){var t;return Mx=Dx?Ax(t=Ox).call(t):function(e){return e.__proto__||Ox(e)},Mx(e)}function Lx(){var e;return Lx="undefined"!=typeof Reflect&&_x?Ax(e=_x).call(e):function(e,t,r){var n=function(e,t){for(;!{}.hasOwnProperty.call(e,t)&&null!==(e=Mx(e)););return e}(e,t);if(n){var i=xx(n,t);return i.get?i.get.call(arguments.length<3?e:r):i.value}},Lx.apply(null,arguments)}ip({target:"Object",stat:!0,sham:!th},{create:Kv});var Bx=Eh.Object,Ux=function(e,t){return Bx.create(e,t)},Vx=k(Ux),jx={exports:{}},Gx=ip,Hx=th,zx=km.f;Gx({target:"Object",stat:!0,forced:Object.defineProperty!==zx,sham:!Hx},{defineProperty:zx});var Kx=Eh.Object,Jx=jx.exports=function(e,t,r){return Kx.defineProperty(e,t,r)};Kx.defineProperty.sham&&(Jx.sham=!0);var Qx=jx.exports,qx=Qx,Yx=k(qx);function Xx(e,t){var r;return Xx=Dx?Ax(r=Dx).call(r):function(e,t){return e.__proto__=t,e},Xx(e,t)}function Zx(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Vx(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Yx(e,"prototype",{writable:!1}),t&&Xx(e,t)}var $x=TypeError,eP=function(e){if(e>9007199254740991)throw $x("Maximum allowed index exceeded");return e},tP=Wf,rP=jh,nP=jg("species"),iP=function(e){return rP>=51||!tP((function(){var t=[];return(t.constructor={})[nP]=function(){return{foo:1}},1!==t[e](Boolean).foo}))},oP=ip,aP=Wf,sP=fy,uP=wh,cP=wg,lP=ov,dP=eP,fP=XI,hP=yy,gP=iP,mP=jh,pP=jg("isConcatSpreadable"),vP=mP>=51||!aP((function(){var e=[];return e[pP]=!1,e.concat()[0]!==e})),_P=function(e){if(!uP(e))return!1;var t=e[pP];return t!==undefined?!!t:sP(e)};oP({target:"Array",proto:!0,arity:1,forced:!vP||!gP("concat")},{concat:function(e){var t,r,n,i,o,a=cP(this),s=hP(a,0),u=0;for(t=-1,n=arguments.length;t<n;t++)if(_P(o=-1===t?a:arguments[t]))for(i=lP(o),dP(u+i),r=0;r<i;r++,u++)r in o&&fP(s,u,o[r]);else dP(u+1),fP(s,u++,o);return s.length=u,s}}),R_("asyncIterator"),R_("hasInstance"),R_("isConcatSpreadable"),R_("iterator"),R_("match"),R_("matchAll"),R_("replace"),R_("search"),R_("species"),R_("split");var yP=B_;R_("toPrimitive"),yP();var SP=Dh,IP=Q_;R_("toStringTag"),IP(SP("Symbol"),"Symbol"),R_("unscopables"),Q_(Ff.JSON,"JSON",!0);var bP=Eh.Symbol,TP=jg,CP=km.f,wP=TP("metadata"),EP=Function.prototype;EP[wP]===undefined&&CP(EP,wP,{value:null}),R_("asyncDispose"),R_("dispose"),R_("metadata");var kP=bP,AP=Hf,xP=Dh("Symbol"),PP=xP.keyFor,DP=AP(xP.prototype.valueOf),FP=xP.isRegisteredSymbol||function(e){try{return PP(DP(e))!==undefined}catch(bi){return!1}};ip({target:"Symbol",stat:!0},{isRegisteredSymbol:FP});for(var WP=bg,RP=Dh,NP=Hf,OP=Zh,MP=jg,LP=RP("Symbol"),BP=LP.isWellKnownSymbol,UP=RP("Object","getOwnPropertyNames"),VP=NP(LP.prototype.valueOf),jP=WP("wks"),GP=0,HP=UP(LP),zP=HP.length;GP<zP;GP++)try{var KP=HP[GP];OP(LP[KP])&&MP(KP)}catch(bi){}var JP=function(e){if(BP&&BP(e))return!0;try{for(var t=VP(e),r=0,n=UP(jP),i=n.length;r<i;r++)if(jP[n[r]]==t)return!0}catch(bi){}return!1};ip({target:"Symbol",stat:!0,forced:!0},{isWellKnownSymbol:JP}),R_("customMatcher"),R_("observable"),ip({target:"Symbol",stat:!0,name:"isRegisteredSymbol"},{isRegistered:FP}),ip({target:"Symbol",stat:!0,name:"isWellKnownSymbol",forced:!0},{isWellKnown:JP}),R_("matcher"),R_("metadataKey"),R_("patternMatch"),R_("replaceAll");var QP=kP,qP=k(QP),YP=w_.f("iterator"),XP=k(YP);function ZP(e){return ZP="function"==typeof qP&&"symbol"==typeof XP?function(e){return typeof e}:function(e){return e&&"function"==typeof qP&&e.constructor===qP&&e!==qP.prototype?"symbol":typeof e},ZP(e)}ip({target:"Array",stat:!0},{isArray:fy});var $P=Eh.Array.isArray,eD=k($P);var tD=k(nT),rD=th,nD=fy,iD=TypeError,oD=Object.getOwnPropertyDescriptor,aD=rD&&!function(){if(this!==undefined)return!0;try{Object.defineProperty([],"length",{writable:!1}).length=1}catch(bi){return bi instanceof TypeError}}()?function(e,t){if(nD(e)&&!oD(e,"length").writable)throw new iD("Cannot set read only .length");return e.length=t}:function(e,t){return e.length=t},sD=wg,uD=ov,cD=aD,lD=eP;ip({target:"Array",proto:!0,arity:1,forced:Wf((function(){return 4294967297!==[].push.call({length:4294967296},1)}))||!function(){try{Object.defineProperty([],"length",{writable:!1}).push()}catch(bi){return bi instanceof TypeError}}()},{push:function(e){var t=sD(this),r=uD(t),n=arguments.length;lD(r+n);for(var i=0;i<n;i++)t[r]=arguments[i],r++;return cD(t,r),r}});var dD=bx("Array","push"),fD=Fh,hD=dD,gD=Array.prototype,mD=function(e){var t=e.push;return e===gD||fD(gD,e)&&t===gD.push?hD:t},pD=mD,vD=k(pD);var _D=ip,yD=fy,SD=jp,ID=wh,bD=tv,TD=ov,CD=Th,wD=XI,ED=jg,kD=op,AD=iP("slice"),xD=ED("species"),PD=Array,DD=Math.max;_D({target:"Array",proto:!0,forced:!AD},{slice:function(e,t){var r,n,i,o=CD(this),a=TD(o),s=bD(e,a),u=bD(t===undefined?a:t,a);if(yD(o)&&(r=o.constructor,(SD(r)&&(r===PD||yD(r.prototype))||ID(r)&&null===(r=r[xD]))&&(r=undefined),r===PD||r===undefined))return kD(o,s,u);for(n=new(r===undefined?PD:r)(DD(u-s,0)),i=0;s<u;s++,i++)s in o&&wD(n,i,o[s]);return n.length=i,n}});var FD=bx("Array","slice"),WD=Fh,RD=FD,ND=Array.prototype,OD=function(e){var t=e.slice;return e===ND||WD(ND,e)&&t===ND.slice?RD:t},MD=OD,LD=MD,BD=k(LD),UD=Fm,VD=gT,jD=Em,GD=ih,HD=wg,zD=function(e,t,r,n){try{return n?t(UD(r)[0],r[1]):t(r)}catch(bi){VD(e,"throw",bi)}},KD=Xb,JD=jp,QD=ov,qD=XI,YD=lT,XD=nT,ZD=Array,$D=function(e){var t=HD(e),r=JD(this),n=arguments.length,i=n>1?arguments[1]:undefined,o=i!==undefined;o&&(i=jD(i,n>2?arguments[2]:undefined));var a,s,u,c,l,d,f=XD(t),h=0;if(!f||this===ZD&&KD(f))for(a=QD(t),s=r?new this(a):ZD(a);a>h;h++)d=o?i(t[h],h):t[h],qD(s,h,d);else for(s=r?new this:[],l=(c=YD(t,f)).next;!(u=GD(l,c)).done;h++)d=o?zD(c,i,[u.value,h],!0):u.value,qD(s,h,d);return s.length=h,s},eF=$D;ip({target:"Array",stat:!0,forced:!Nk((function(e){Array.from(e)}))},{from:eF});var tF=Eh.Array.from,rF=k(tF);function nF(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=Array(t);r<t;r++)n[r]=e[r];return n}function iF(e,t){if(e){var r;if("string"==typeof e)return nF(e,t);var n=BD(r={}.toString.call(e)).call(r,8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?rF(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?nF(e,t):void 0}}function oF(e,t){return function(e){if(eD(e))return e}(e)||function(e,t){var r=null==e?null:void 0!==qP&&tD(e)||e["@@iterator"];if(null!=r){var n,i,o,a,s=[],u=!0,c=!1;try{if(o=(r=r.call(e)).next,0===t){if(Object(r)!==r)return;u=!1}else for(;!(u=(n=o.call(r)).done)&&(vD(s).call(s,n.value),s.length!==t);u=!0);}catch(e){c=!0,i=e}finally{try{if(!u&&null!=r["return"]&&(a=r["return"](),Object(a)!==a))return}finally{if(c)throw i}}return s}}(e,t)||iF(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function aF(e){return function(e){if(eD(e))return nF(e)}(e)||function(e){if(void 0!==qP&&null!=tD(e)||null!=e["@@iterator"])return rF(e)}(e)||iF(e)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function sF(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}var uF=k(w_.f("toPrimitive"));function cF(e){var t=function(e,t){if("object"!=ZP(e)||!e)return e;var r=e[uF];if(void 0!==r){var n=r.call(e,t||"default");if("object"!=ZP(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==ZP(t)?t:t+""}function lF(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Yx(e,cF(n.key),n)}}function dF(e,t,r){return t&&lF(e.prototype,t),r&&lF(e,r),Yx(e,"prototype",{writable:!1}),e}function fF(e,t,r){return(t=cF(t))in e?Yx(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}var hF={exports:{}},gF={exports:{}};!function(e){var t=QP,r=YP;function n(i){return e.exports=n="function"==typeof t&&"symbol"==typeof r?function(e){return typeof e}:function(e){return e&&"function"==typeof t&&e.constructor===t&&e!==t.prototype?"symbol":typeof e},e.exports.__esModule=!0,e.exports["default"]=e.exports,n(i)}e.exports=n,e.exports.__esModule=!0,e.exports["default"]=e.exports}(gF);var mF=gF.exports,pF=Wf,vF=function(e,t){var r=[][e];return!!r&&pF((function(){r.call(null,t||function(){return 1},1)}))},_F=ky.forEach,yF=vF("forEach")?[].forEach:function(e){return _F(this,e,arguments.length>1?arguments[1]:undefined)};ip({target:"Array",proto:!0,forced:[].forEach!==yF},{forEach:yF});var SF=bx("Array","forEach"),IF=wp,bF=Ag,TF=Fh,CF=SF,wF=Array.prototype,EF={DOMTokenList:!0,NodeList:!0},kF=function(e){var t=e.forEach;return e===wF||TF(wF,e)&&t===wF.forEach||bF(EF,IF(e))?CF:t},AF=kF,xF=ip,PF=fy,DF=Hf([].reverse),FF=[1,2];xF({target:"Array",proto:!0,forced:String(FF)===String(FF.reverse())},{reverse:function(){return PF(this)&&(this.length=this.length),DF(this)}});var WF=bx("Array","reverse"),RF=Fh,NF=WF,OF=Array.prototype,MF=function(e){var t=e.reverse;return e===OF||RF(OF,e)&&t===OF.reverse?NF:t},LF=MF;!function(e){var t=mF["default"],r=qx,n=QP,i=Ux,o=Nx,a=AF,s=pD,u=Px,c=ax,l=LF,d=LD;function f(){e.exports=f=function(){return g},e.exports.__esModule=!0,e.exports["default"]=e.exports;var h,g={},m=Object.prototype,p=m.hasOwnProperty,v=r||function(e,t,r){e[t]=r.value},_="function"==typeof n?n:{},y=_.iterator||"@@iterator",S=_.asyncIterator||"@@asyncIterator",I=_.toStringTag||"@@toStringTag";function b(e,t,n){return r(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}),e[t]}try{b({},"")}catch(h){b=function(e,t,r){return e[t]=r}}function T(e,t,r,n){var o=t&&t.prototype instanceof P?t:P,a=i(o.prototype),s=new j(n||[]);return v(a,"_invoke",{value:L(e,r,s)}),a}function C(e,t,r){try{return{type:"normal",arg:e.call(t,r)}}catch(e){return{type:"throw",arg:e}}}g.wrap=T;var w="suspendedStart",E="suspendedYield",k="executing",A="completed",x={};function P(){}function D(){}function F(){}var W={};b(W,y,(function(){return this}));var R=o&&o(o(G([])));R&&R!==m&&p.call(R,y)&&(W=R);var N=F.prototype=P.prototype=i(W);function O(e){var t;a(t=["next","throw","return"]).call(t,(function(t){b(e,t,(function(e){return this._invoke(t,e)}))}))}function M(e,r){function n(i,o,a,s){var u=C(e[i],e,o);if("throw"!==u.type){var c=u.arg,l=c.value;return l&&"object"==t(l)&&p.call(l,"__await")?r.resolve(l.__await).then((function(e){n("next",e,a,s)}),(function(e){n("throw",e,a,s)})):r.resolve(l).then((function(e){c.value=e,a(c)}),(function(e){return n("throw",e,a,s)}))}s(u.arg)}var i;v(this,"_invoke",{value:function(e,t){function o(){return new r((function(r,i){n(e,t,r,i)}))}return i=i?i.then(o,o):o()}})}function L(e,t,r){var n=w;return function(i,o){if(n===k)throw Error("Generator is already running");if(n===A){if("throw"===i)throw o;return{value:h,done:!0}}for(r.method=i,r.arg=o;;){var a=r.delegate;if(a){var s=B(a,r);if(s){if(s===x)continue;return s}}if("next"===r.method)r.sent=r._sent=r.arg;else if("throw"===r.method){if(n===w)throw n=A,r.arg;r.dispatchException(r.arg)}else"return"===r.method&&r.abrupt("return",r.arg);n=k;var u=C(e,t,r);if("normal"===u.type){if(n=r.done?A:E,u.arg===x)continue;return{value:u.arg,done:r.done}}"throw"===u.type&&(n=A,r.method="throw",r.arg=u.arg)}}}function B(e,t){var r=t.method,n=e.iterator[r];if(n===h)return t.delegate=null,"throw"===r&&e.iterator["return"]&&(t.method="return",t.arg=h,B(e,t),"throw"===t.method)||"return"!==r&&(t.method="throw",t.arg=new TypeError("The iterator does not provide a '"+r+"' method")),x;var i=C(n,e.iterator,t.arg);if("throw"===i.type)return t.method="throw",t.arg=i.arg,t.delegate=null,x;var o=i.arg;return o?o.done?(t[e.resultName]=o.value,t.next=e.nextLoc,"return"!==t.method&&(t.method="next",t.arg=h),t.delegate=null,x):o:(t.method="throw",t.arg=new TypeError("iterator result is not an object"),t.delegate=null,x)}function U(e){var t,r={tryLoc:e[0]};1 in e&&(r.catchLoc=e[1]),2 in e&&(r.finallyLoc=e[2],r.afterLoc=e[3]),s(t=this.tryEntries).call(t,r)}function V(e){var t=e.completion||{};t.type="normal",delete t.arg,e.completion=t}function j(e){this.tryEntries=[{tryLoc:"root"}],a(e).call(e,U,this),this.reset(!0)}function G(e){if(e||""===e){var r=e[y];if(r)return r.call(e);if("function"==typeof e.next)return e;if(!isNaN(e.length)){var n=-1,i=function t(){for(;++n<e.length;)if(p.call(e,n))return t.value=e[n],t.done=!1,t;return t.value=h,t.done=!0,t};return i.next=i}}throw new TypeError(t(e)+" is not iterable")}return D.prototype=F,v(N,"constructor",{value:F,configurable:!0}),v(F,"constructor",{value:D,configurable:!0}),D.displayName=b(F,I,"GeneratorFunction"),g.isGeneratorFunction=function(e){var t="function"==typeof e&&e.constructor;return!!t&&(t===D||"GeneratorFunction"===(t.displayName||t.name))},g.mark=function(e){return u?u(e,F):(e.__proto__=F,b(e,I,"GeneratorFunction")),e.prototype=i(N),e},g.awrap=function(e){return{__await:e}},O(M.prototype),b(M.prototype,S,(function(){return this})),g.AsyncIterator=M,g.async=function(e,t,r,n,i){void 0===i&&(i=c);var o=new M(T(e,t,r,n),i);return g.isGeneratorFunction(t)?o:o.next().then((function(e){return e.done?e.value:o.next()}))},O(N),b(N,I,"Generator"),b(N,y,(function(){return this})),b(N,"toString",(function(){return"[object Generator]"})),g.keys=function(e){var t=Object(e),r=[];for(var n in t)s(r).call(r,n);return l(r).call(r),function i(){for(;r.length;){var e=r.pop();if(e in t)return i.value=e,i.done=!1,i}return i.done=!0,i}},g.values=G,j.prototype={constructor:j,reset:function(e){var t;if(this.prev=0,this.next=0,this.sent=this._sent=h,this.done=!1,this.delegate=null,this.method="next",this.arg=h,a(t=this.tryEntries).call(t,V),!e)for(var r in this)"t"===r.charAt(0)&&p.call(this,r)&&!isNaN(+d(r).call(r,1))&&(this[r]=h)},stop:function(){this.done=!0;var e=this.tryEntries[0].completion;if("throw"===e.type)throw e.arg;return this.rval},dispatchException:function(e){if(this.done)throw e;var t=this;function r(r,n){return o.type="throw",o.arg=e,t.next=r,n&&(t.method="next",t.arg=h),!!n}for(var n=this.tryEntries.length-1;n>=0;--n){var i=this.tryEntries[n],o=i.completion;if("root"===i.tryLoc)return r("end");if(i.tryLoc<=this.prev){var a=p.call(i,"catchLoc"),s=p.call(i,"finallyLoc");if(a&&s){if(this.prev<i.catchLoc)return r(i.catchLoc,!0);if(this.prev<i.finallyLoc)return r(i.finallyLoc)}else if(a){if(this.prev<i.catchLoc)return r(i.catchLoc,!0)}else{if(!s)throw Error("try statement without catch or finally");if(this.prev<i.finallyLoc)return r(i.finallyLoc)}}}},abrupt:function(e,t){for(var r=this.tryEntries.length-1;r>=0;--r){var n=this.tryEntries[r];if(n.tryLoc<=this.prev&&p.call(n,"finallyLoc")&&this.prev<n.finallyLoc){var i=n;break}}i&&("break"===e||"continue"===e)&&i.tryLoc<=t&&t<=i.finallyLoc&&(i=null);var o=i?i.completion:{};return o.type=e,o.arg=t,i?(this.method="next",this.next=i.finallyLoc,x):this.complete(o)},complete:function(e,t){if("throw"===e.type)throw e.arg;return"break"===e.type||"continue"===e.type?this.next=e.arg:"return"===e.type?(this.rval=this.arg=e.arg,this.method="return",this.next="end"):"normal"===e.type&&t&&(this.next=t),x},finish:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var r=this.tryEntries[t];if(r.finallyLoc===e)return this.complete(r.completion,r.afterLoc),V(r),x}},"catch":function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var r=this.tryEntries[t];if(r.tryLoc===e){var n=r.completion;if("throw"===n.type){var i=n.arg;V(r)}return i}}throw Error("illegal catch attempt")},delegateYield:function(e,t,r){return this.delegate={iterator:G(e),resultName:t,nextLoc:r},"next"===this.method&&(this.arg=h),x}},g}e.exports=f,e.exports.__esModule=!0,e.exports["default"]=e.exports}(hF);var BF=(0,hF.exports)(),UF=BF;try{regeneratorRuntime=BF}catch(xJ){"object"===("undefined"==typeof globalThis?"undefined":_(globalThis))?globalThis.regeneratorRuntime=BF:Function("r","regeneratorRuntime = r")(BF)}var VF=k(UF),jF=k($P),GF=k(kF),HF=wg,zF=Iv;ip({target:"Object",stat:!0,forced:Wf((function(){zF(1)}))},{keys:function(e){return zF(HF(e))}});var KF=k(Eh.Object.keys);ip({target:"Number",stat:!0},{isNaN:function(e){return e!=e}});var JF=k(Eh.Number.isNaN),QF=bx("Array","concat"),qF=Fh,YF=QF,XF=Array.prototype,ZF=function(e){var t=e.concat;return e===XF||qF(XF,e)&&t===XF.concat?YF:t},$F=k(ZF),eW=ip,tW=Hf,rW=tv,nW=RangeError,iW=String.fromCharCode,oW=String.fromCodePoint,aW=tW([].join);eW({target:"String",stat:!0,arity:1,forced:!!oW&&1!==oW.length},{fromCodePoint:function(e){for(var t,r=[],n=arguments.length,i=0;n>i;){if(t=+arguments[i++],rW(t,1114111)!==t)throw new nW(t+" is not a valid code point");r[i]=t<65536?iW(t):iW(55296+((t-=65536)>>10),t%1024+56320)}return aW(r,"")}});var sW=Wf,uW=hg,cW=jg("iterator"),lW=!sW((function(){var e=new URL("b?a=1&b=2&c=3","https://a"),t=e.searchParams,r=new URLSearchParams("a=1&a=2&b=3"),n="";return e.pathname="c%20d",t.forEach((function(e,r){t["delete"]("b"),n+=r+e})),r["delete"]("a",2),r["delete"]("b",undefined),!e.toJSON||!r.has("a",1)||r.has("a",2)||!r.has("a",undefined)||r.has("b")||!t.size&&uW||!t.sort||"https://a/c%20d?a=1&c=3"!==e.href||"3"!==t.get("c")||"a=1"!==String(new URLSearchParams("?a=1"))||!t[cW]||"a"!==new URL("https://a@b").username||"b"!==new URLSearchParams(new URLSearchParams("a=b")).get("a")||"xn--e1aybc"!==new URL("https://тест").host||"#%D0%B1"!==new URL("https://a#б").hash||"a1c3"!==n||"x"!==new URL("https://x",undefined).host})),dW=b_,fW=function(e,t,r){for(var n in t)r&&r.unsafe&&e[n]?e[n]=t[n]:dW(e,n,t[n],r);return e},hW=op,gW=Math.floor,mW=function(e,t){var r=e.length;if(r<8)for(var n,i,o=1;o<r;){for(i=o,n=e[o];i&&t(e[i-1],n)>0;)e[i]=e[--i];i!==o++&&(e[i]=n)}else for(var a=gW(r/2),s=mW(hW(e,0,a),t),u=mW(hW(e,a),t),c=s.length,l=u.length,d=0,f=0;d<c||f<l;)e[d+f]=d<c&&f<l?t(s[d],u[f])<=0?s[d++]:u[f++]:d<c?s[d++]:u[f++];return e},pW=ip,vW=Ff,_W=zw,yW=Dh,SW=ih,IW=Hf,bW=th,TW=lW,CW=b_,wW=C_,EW=fW,kW=Q_,AW=_C,xW=ly,PW=aw,DW=$f,FW=Ag,WW=Em,RW=wp,NW=Fm,OW=wh,MW=l_,LW=Kv,BW=dh,UW=lT,VW=nT,jW=RC,GW=hw,HW=mW,zW=jg("iterator"),KW="URLSearchParams",JW=KW+"Iterator",QW=xW.set,qW=xW.getterFor(KW),YW=xW.getterFor(JW),XW=_W("fetch"),ZW=_W("Request"),$W=_W("Headers"),eR=ZW&&ZW.prototype,tR=$W&&$W.prototype,rR=vW.TypeError,nR=vW.encodeURIComponent,iR=String.fromCharCode,oR=yW("String","fromCodePoint"),aR=parseInt,sR=IW("".charAt),uR=IW([].join),cR=IW([].push),lR=IW("".replace),dR=IW([].shift),fR=IW([].splice),hR=IW("".split),gR=IW("".slice),mR=IW(/./.exec),pR=/\+/g,vR=/^[0-9a-f]+$/i,_R=function(e,t){var r=gR(e,t,t+2);return mR(vR,r)?aR(r,16):NaN},yR=function(e){for(var t=0,r=128;r>0&&e&r;r>>=1)t++;return t},SR=function(e){var t=null;switch(e.length){case 1:t=e[0];break;case 2:t=(31&e[0])<<6|63&e[1];break;case 3:t=(15&e[0])<<12|(63&e[1])<<6|63&e[2];break;case 4:t=(7&e[0])<<18|(63&e[1])<<12|(63&e[2])<<6|63&e[3]}return t>1114111?null:t},IR=function(e){for(var t=(e=lR(e,pR," ")).length,r="",n=0;n<t;){var i=sR(e,n);if("%"===i){if("%"===sR(e,n+1)||n+3>t){r+="%",n++;continue}var o=_R(e,n+1);if(o!=o){r+=i,n++;continue}n+=2;var a=yR(o);if(0===a)i=iR(o);else{if(1===a||a>4){r+="�",n++;continue}for(var s=[o],u=1;u<a&&!(++n+3>t||"%"!==sR(e,n));){var c=_R(e,n+1);if(c!=c){n+=3;break}if(c>191||c<128)break;cR(s,c),n+=2,u++}if(s.length!==a){r+="�";continue}var l=SR(s);null===l?r+="�":i=oR(l)}}r+=i,n++}return r},bR=/[!'()~]|%20/g,TR={"!":"%21","'":"%27","(":"%28",")":"%29","~":"%7E","%20":"+"},CR=function(e){return TR[e]},wR=function(e){return lR(nR(e),bR,CR)},ER=AW((function(e,t){QW(this,{type:JW,target:qW(e).entries,index:0,kind:t})}),KW,(function(){var e=YW(this),t=e.target,r=e.index++;if(!t||r>=t.length)return e.target=null,jW(undefined,!0);var n=t[r];switch(e.kind){case"keys":return jW(n.key,!1);case"values":return jW(n.value,!1)}return jW([n.key,n.value],!1)}),!0),kR=function(e){this.entries=[],this.url=null,e!==undefined&&(OW(e)?this.parseObject(e):this.parseQuery("string"==typeof e?"?"===sR(e,0)?gR(e,1):e:MW(e)))};kR.prototype={type:KW,bindURL:function(e){this.url=e,this.update()},parseObject:function(e){var t,r,n,i,o,a,s,u=this.entries,c=VW(e);if(c)for(r=(t=UW(e,c)).next;!(n=SW(r,t)).done;){if(o=(i=UW(NW(n.value))).next,(a=SW(o,i)).done||(s=SW(o,i)).done||!SW(o,i).done)throw new rR("Expected sequence with length 2");cR(u,{key:MW(a.value),value:MW(s.value)})}else for(var l in e)FW(e,l)&&cR(u,{key:l,value:MW(e[l])})},parseQuery:function(e){if(e)for(var t,r,n=this.entries,i=hR(e,"&"),o=0;o<i.length;)(t=i[o++]).length&&(r=hR(t,"="),cR(n,{key:IR(dR(r)),value:IR(uR(r,"="))}))},serialize:function(){for(var e,t=this.entries,r=[],n=0;n<t.length;)e=t[n++],cR(r,wR(e.key)+"="+wR(e.value));return uR(r,"&")},update:function(){this.entries.length=0,this.parseQuery(this.url.query)},updateURL:function(){this.url&&this.url.update()}};var AR=function(){PW(this,xR);var e=arguments.length>0?arguments[0]:undefined,t=QW(this,new kR(e));bW||(this.size=t.entries.length)},xR=AR.prototype;if(EW(xR,{append:function(e,t){var r=qW(this);GW(arguments.length,2),cR(r.entries,{key:MW(e),value:MW(t)}),bW||this.length++,r.updateURL()},"delete":function(e){for(var t=qW(this),r=GW(arguments.length,1),n=t.entries,i=MW(e),o=r<2?undefined:arguments[1],a=o===undefined?o:MW(o),s=0;s<n.length;){var u=n[s];if(u.key!==i||a!==undefined&&u.value!==a)s++;else if(fR(n,s,1),a!==undefined)break}bW||(this.size=n.length),t.updateURL()},get:function(e){var t=qW(this).entries;GW(arguments.length,1);for(var r=MW(e),n=0;n<t.length;n++)if(t[n].key===r)return t[n].value;return null},getAll:function(e){var t=qW(this).entries;GW(arguments.length,1);for(var r=MW(e),n=[],i=0;i<t.length;i++)t[i].key===r&&cR(n,t[i].value);return n},has:function(e){for(var t=qW(this).entries,r=GW(arguments.length,1),n=MW(e),i=r<2?undefined:arguments[1],o=i===undefined?i:MW(i),a=0;a<t.length;){var s=t[a++];if(s.key===n&&(o===undefined||s.value===o))return!0}return!1},set:function(e,t){var r=qW(this);GW(arguments.length,1);for(var n,i=r.entries,o=!1,a=MW(e),s=MW(t),u=0;u<i.length;u++)(n=i[u]).key===a&&(o?fR(i,u--,1):(o=!0,n.value=s));o||cR(i,{key:a,value:s}),bW||(this.size=i.length),r.updateURL()},sort:function(){var e=qW(this);HW(e.entries,(function(e,t){return e.key>t.key?1:-1})),e.updateURL()},forEach:function(e){for(var t,r=qW(this).entries,n=WW(e,arguments.length>1?arguments[1]:undefined),i=0;i<r.length;)n((t=r[i++]).value,t.key,this)},keys:function(){return new ER(this,"keys")},values:function(){return new ER(this,"values")},entries:function(){return new ER(this,"entries")}},{enumerable:!0}),CW(xR,zW,xR.entries,{name:"entries"}),CW(xR,"toString",(function(){return qW(this).serialize()}),{enumerable:!0}),bW&&wW(xR,"size",{get:function(){return qW(this).entries.length},configurable:!0,enumerable:!0}),kW(AR,KW),pW({global:!0,constructor:!0,forced:!TW},{URLSearchParams:AR}),!TW&&DW($W)){var PR=IW(tR.has),DR=IW(tR.set),FR=function(e){if(OW(e)){var t,r=e.body;if(RW(r)===KW)return t=e.headers?new $W(e.headers):new $W,PR(t,"content-type")||DR(t,"content-type","application/x-www-form-urlencoded;charset=UTF-8"),LW(e,{body:BW(0,MW(r)),headers:BW(0,t)})}return e};if(DW(XW)&&pW({global:!0,enumerable:!0,dontCallGetSet:!0,forced:!0},{fetch:function(e){return XW(e,arguments.length>1?FR(arguments[1]):{})}}),DW(ZW)){var WR=function(e){return PW(this,eR),new ZW(e,arguments.length>1?FR(arguments[1]):{})};eR.constructor=WR,WR.prototype=eR,pW({global:!0,constructor:!0,dontCallGetSet:!0,forced:!0},{Request:WR})}}var RR,NR={URLSearchParams:AR,getState:qW},OR=th,MR=Hf,LR=ih,BR=Wf,UR=Iv,VR=S_,jR=oh,GR=wg,HR=ph,zR=Object.assign,KR=Object.defineProperty,JR=MR([].concat),QR=!zR||BR((function(){if(OR&&1!==zR({b:1},zR(KR({},"a",{enumerable:!0,get:function(){KR(this,"b",{value:3,enumerable:!1})}}),{b:2})).b)return!0;var e={},t={},r=Symbol("assign detection"),n="abcdefghijklmnopqrst";return e[r]=7,n.split("").forEach((function(e){t[e]=e})),7!==zR({},e)[r]||UR(zR({},t)).join("")!==n}))?function(e,t){for(var r=GR(e),n=arguments.length,i=1,o=VR.f,a=jR.f;n>i;)for(var s,u=HR(arguments[i++]),c=o?JR(UR(u),o(u)):UR(u),l=c.length,d=0;l>d;)s=c[d++],OR&&!LR(a,u,s)||(r[s]=u[s]);return r}:zR,qR=Hf,YR=2147483647,XR=/[^\0-\u007E]/,ZR=/[.\u3002\uFF0E\uFF61]/g,$R="Overflow: input needs wider integers to process",eN=RangeError,tN=qR(ZR.exec),rN=Math.floor,nN=String.fromCharCode,iN=qR("".charCodeAt),oN=qR([].join),aN=qR([].push),sN=qR("".replace),uN=qR("".split),cN=qR("".toLowerCase),lN=function(e){return e+22+75*(e<26)},dN=function(e,t,r){var n=0;for(e=r?rN(e/700):e>>1,e+=rN(e/t);e>455;)e=rN(e/35),n+=36;return rN(n+36*e/(e+38))},fN=function(e){var t=[];e=function(e){for(var t=[],r=0,n=e.length;r<n;){var i=iN(e,r++);if(i>=55296&&i<=56319&&r<n){var o=iN(e,r++);56320==(64512&o)?aN(t,((1023&i)<<10)+(1023&o)+65536):(aN(t,i),r--)}else aN(t,i)}return t}(e);var r,n,i=e.length,o=128,a=0,s=72;for(r=0;r<e.length;r++)(n=e[r])<128&&aN(t,nN(n));var u=t.length,c=u;for(u&&aN(t,"-");c<i;){var l=YR;for(r=0;r<e.length;r++)(n=e[r])>=o&&n<l&&(l=n);var d=c+1;if(l-o>rN((YR-a)/d))throw new eN($R);for(a+=(l-o)*d,o=l,r=0;r<e.length;r++){if((n=e[r])<o&&++a>YR)throw new eN($R);if(n===o){for(var f=a,h=36;;){var g=h<=s?1:h>=s+26?26:h-s;if(f<g)break;var m=f-g,p=36-g;aN(t,nN(lN(g+m%p))),f=rN(m/p),h+=36}aN(t,nN(lN(f))),s=dN(a,d,c===u),a=0,c++}}a++,o++}return oN(t,"")},hN=ip,gN=th,mN=lW,pN=Ff,vN=Em,_N=Hf,yN=b_,SN=C_,IN=aw,bN=Ag,TN=QR,CN=$D,wN=op,EN=OA.codeAt,kN=function(e){var t,r,n=[],i=uN(sN(cN(e),ZR,"."),".");for(t=0;t<i.length;t++)r=i[t],aN(n,tN(XR,r)?"xn--"+fN(r):r);return oN(n,".")},AN=l_,xN=Q_,PN=hw,DN=NR,FN=ly,WN=FN.set,RN=FN.getterFor("URL"),NN=DN.URLSearchParams,ON=DN.getState,MN=pN.URL,LN=pN.TypeError,BN=pN.parseInt,UN=Math.floor,VN=Math.pow,jN=_N("".charAt),GN=_N(/./.exec),HN=_N([].join),zN=_N(1..toString),KN=_N([].pop),JN=_N([].push),QN=_N("".replace),qN=_N([].shift),YN=_N("".split),XN=_N("".slice),ZN=_N("".toLowerCase),$N=_N([].unshift),eO="Invalid scheme",tO="Invalid host",rO="Invalid port",nO=/[a-z]/i,iO=/[\d+-.a-z]/i,oO=/\d/,aO=/^0x/i,sO=/^[0-7]+$/,uO=/^\d+$/,cO=/^[\da-f]+$/i,lO=/[\0\t\n\r #%/:<>?@[\\\]^|]/,dO=/[\0\t\n\r #/:<>?@[\\\]^|]/,fO=/^[\u0000-\u0020]+/,hO=/(^|[^\u0000-\u0020])[\u0000-\u0020]+$/,gO=/[\t\n\r]/g,mO=function(e){var t,r,n,i;if("number"==typeof e){for(t=[],r=0;r<4;r++)$N(t,e%256),e=UN(e/256);return HN(t,".")}if("object"==_(e)){for(t="",n=function(e){for(var t=null,r=1,n=null,i=0,o=0;o<8;o++)0!==e[o]?(i>r&&(t=n,r=i),n=null,i=0):(null===n&&(n=o),++i);return i>r?n:t}(e),r=0;r<8;r++)i&&0===e[r]||(i&&(i=!1),n===r?(t+=r?":":"::",i=!0):(t+=zN(e[r],16),r<7&&(t+=":")));return"["+t+"]"}return e},pO={},vO=TN({},pO,{" ":1,'"':1,"<":1,">":1,"`":1}),_O=TN({},vO,{"#":1,"?":1,"{":1,"}":1}),yO=TN({},_O,{"/":1,":":1,";":1,"=":1,"@":1,"[":1,"\\":1,"]":1,"^":1,"|":1}),SO=function(e,t){var r=EN(e,0);return r>32&&r<127&&!bN(t,e)?e:encodeURIComponent(e)},IO={ftp:21,file:null,http:80,https:443,ws:80,wss:443},bO=function(e,t){var r;return 2===e.length&&GN(nO,jN(e,0))&&(":"===(r=jN(e,1))||!t&&"|"===r)},TO=function(e){var t;return e.length>1&&bO(XN(e,0,2))&&(2===e.length||"/"===(t=jN(e,2))||"\\"===t||"?"===t||"#"===t)},CO=function(e){return"."===e||"%2e"===ZN(e)},wO={},EO={},kO={},AO={},xO={},PO={},DO={},FO={},WO={},RO={},NO={},OO={},MO={},LO={},BO={},UO={},VO={},jO={},GO={},HO={},zO={},KO=function(e,t,r){var n,i,o,a=AN(e);if(t){if(i=this.parse(a))throw new LN(i);this.searchParams=null}else{if(r!==undefined&&(n=new KO(r,!0)),i=this.parse(a,null,n))throw new LN(i);(o=ON(new NN)).bindURL(this),this.searchParams=o}};KO.prototype={type:"URL",parse:function(e,t,r){var n,i,o,a,s,u=this,c=t||wO,l=0,d="",f=!1,h=!1,g=!1;for(e=AN(e),t||(u.scheme="",u.username="",u.password="",u.host=null,u.port=null,u.path=[],u.query=null,u.fragment=null,u.cannotBeABaseURL=!1,e=QN(e,fO,""),e=QN(e,hO,"$1")),e=QN(e,gO,""),n=CN(e);l<=n.length;){switch(i=n[l],c){case wO:if(!i||!GN(nO,i)){if(t)return eO;c=kO;continue}d+=ZN(i),c=EO;break;case EO:if(i&&(GN(iO,i)||"+"===i||"-"===i||"."===i))d+=ZN(i);else{if(":"!==i){if(t)return eO;d="",c=kO,l=0;continue}if(t&&(u.isSpecial()!==bN(IO,d)||"file"===d&&(u.includesCredentials()||null!==u.port)||"file"===u.scheme&&!u.host))return;if(u.scheme=d,t)return void(u.isSpecial()&&IO[u.scheme]===u.port&&(u.port=null));d="","file"===u.scheme?c=LO:u.isSpecial()&&r&&r.scheme===u.scheme?c=AO:u.isSpecial()?c=FO:"/"===n[l+1]?(c=xO,l++):(u.cannotBeABaseURL=!0,JN(u.path,""),c=GO)}break;case kO:if(!r||r.cannotBeABaseURL&&"#"!==i)return eO;if(r.cannotBeABaseURL&&"#"===i){u.scheme=r.scheme,u.path=wN(r.path),u.query=r.query,u.fragment="",u.cannotBeABaseURL=!0,c=zO;break}c="file"===r.scheme?LO:PO;continue;case AO:if("/"!==i||"/"!==n[l+1]){c=PO;continue}c=WO,l++;break;case xO:if("/"===i){c=RO;break}c=jO;continue;case PO:if(u.scheme=r.scheme,i===RR)u.username=r.username,u.password=r.password,u.host=r.host,u.port=r.port,u.path=wN(r.path),u.query=r.query;else if("/"===i||"\\"===i&&u.isSpecial())c=DO;else if("?"===i)u.username=r.username,u.password=r.password,u.host=r.host,u.port=r.port,u.path=wN(r.path),u.query="",c=HO;else{if("#"!==i){u.username=r.username,u.password=r.password,u.host=r.host,u.port=r.port,u.path=wN(r.path),u.path.length--,c=jO;continue}u.username=r.username,u.password=r.password,u.host=r.host,u.port=r.port,u.path=wN(r.path),u.query=r.query,u.fragment="",c=zO}break;case DO:if(!u.isSpecial()||"/"!==i&&"\\"!==i){if("/"!==i){u.username=r.username,u.password=r.password,u.host=r.host,u.port=r.port,c=jO;continue}c=RO}else c=WO;break;case FO:if(c=WO,"/"!==i||"/"!==jN(d,l+1))continue;l++;break;case WO:if("/"!==i&&"\\"!==i){c=RO;continue}break;case RO:if("@"===i){f&&(d="%40"+d),f=!0,o=CN(d);for(var m=0;m<o.length;m++){var p=o[m];if(":"!==p||g){var v=SO(p,yO);g?u.password+=v:u.username+=v}else g=!0}d=""}else if(i===RR||"/"===i||"?"===i||"#"===i||"\\"===i&&u.isSpecial()){if(f&&""===d)return"Invalid authority";l-=CN(d).length+1,d="",c=NO}else d+=i;break;case NO:case OO:if(t&&"file"===u.scheme){c=UO;continue}if(":"!==i||h){if(i===RR||"/"===i||"?"===i||"#"===i||"\\"===i&&u.isSpecial()){if(u.isSpecial()&&""===d)return tO;if(t&&""===d&&(u.includesCredentials()||null!==u.port))return;if(a=u.parseHost(d))return a;if(d="",c=VO,t)return;continue}"["===i?h=!0:"]"===i&&(h=!1),d+=i}else{if(""===d)return tO;if(a=u.parseHost(d))return a;if(d="",c=MO,t===OO)return}break;case MO:if(!GN(oO,i)){if(i===RR||"/"===i||"?"===i||"#"===i||"\\"===i&&u.isSpecial()||t){if(""!==d){var _=BN(d,10);if(_>65535)return rO;u.port=u.isSpecial()&&_===IO[u.scheme]?null:_,d=""}if(t)return;c=VO;continue}return rO}d+=i;break;case LO:if(u.scheme="file","/"===i||"\\"===i)c=BO;else{if(!r||"file"!==r.scheme){c=jO;continue}switch(i){case RR:u.host=r.host,u.path=wN(r.path),u.query=r.query;break;case"?":u.host=r.host,u.path=wN(r.path),u.query="",c=HO;break;case"#":u.host=r.host,u.path=wN(r.path),u.query=r.query,u.fragment="",c=zO;break;default:TO(HN(wN(n,l),""))||(u.host=r.host,u.path=wN(r.path),u.shortenPath()),c=jO;continue}}break;case BO:if("/"===i||"\\"===i){c=UO;break}r&&"file"===r.scheme&&!TO(HN(wN(n,l),""))&&(bO(r.path[0],!0)?JN(u.path,r.path[0]):u.host=r.host),c=jO;continue;case UO:if(i===RR||"/"===i||"\\"===i||"?"===i||"#"===i){if(!t&&bO(d))c=jO;else if(""===d){if(u.host="",t)return;c=VO}else{if(a=u.parseHost(d))return a;if("localhost"===u.host&&(u.host=""),t)return;d="",c=VO}continue}d+=i;break;case VO:if(u.isSpecial()){if(c=jO,"/"!==i&&"\\"!==i)continue}else if(t||"?"!==i)if(t||"#"!==i){if(i!==RR&&(c=jO,"/"!==i))continue}else u.fragment="",c=zO;else u.query="",c=HO;break;case jO:if(i===RR||"/"===i||"\\"===i&&u.isSpecial()||!t&&("?"===i||"#"===i)){if(".."===(s=ZN(s=d))||"%2e."===s||".%2e"===s||"%2e%2e"===s?(u.shortenPath(),"/"===i||"\\"===i&&u.isSpecial()||JN(u.path,"")):CO(d)?"/"===i||"\\"===i&&u.isSpecial()||JN(u.path,""):("file"===u.scheme&&!u.path.length&&bO(d)&&(u.host&&(u.host=""),d=jN(d,0)+":"),JN(u.path,d)),d="","file"===u.scheme&&(i===RR||"?"===i||"#"===i))for(;u.path.length>1&&""===u.path[0];)qN(u.path);"?"===i?(u.query="",c=HO):"#"===i&&(u.fragment="",c=zO)}else d+=SO(i,_O);break;case GO:"?"===i?(u.query="",c=HO):"#"===i?(u.fragment="",c=zO):i!==RR&&(u.path[0]+=SO(i,pO));break;case HO:t||"#"!==i?i!==RR&&("'"===i&&u.isSpecial()?u.query+="%27":u.query+="#"===i?"%23":SO(i,pO)):(u.fragment="",c=zO);break;case zO:i!==RR&&(u.fragment+=SO(i,vO))}l++}},parseHost:function(e){var t,r,n;if("["===jN(e,0)){if("]"!==jN(e,e.length-1))return tO;if(t=function(e){var t,r,n,i,o,a,s,u=[0,0,0,0,0,0,0,0],c=0,l=null,d=0,f=function(){return jN(e,d)};if(":"===f()){if(":"!==jN(e,1))return;d+=2,l=++c}for(;f();){if(8===c)return;if(":"!==f()){for(t=r=0;r<4&&GN(cO,f());)t=16*t+BN(f(),16),d++,r++;if("."===f()){if(0===r)return;if(d-=r,c>6)return;for(n=0;f();){if(i=null,n>0){if(!("."===f()&&n<4))return;d++}if(!GN(oO,f()))return;for(;GN(oO,f());){if(o=BN(f(),10),null===i)i=o;else{if(0===i)return;i=10*i+o}if(i>255)return;d++}u[c]=256*u[c]+i,2!=++n&&4!==n||c++}if(4!==n)return;break}if(":"===f()){if(d++,!f())return}else if(f())return;u[c++]=t}else{if(null!==l)return;d++,l=++c}}if(null!==l)for(a=c-l,c=7;0!==c&&a>0;)s=u[c],u[c--]=u[l+a-1],u[l+--a]=s;else if(8!==c)return;return u}(XN(e,1,-1)),!t)return tO;this.host=t}else if(this.isSpecial()){if(e=kN(e),GN(lO,e))return tO;if(t=function(e){var t,r,n,i,o,a,s,u=YN(e,".");if(u.length&&""===u[u.length-1]&&u.length--,(t=u.length)>4)return e;for(r=[],n=0;n<t;n++){if(""===(i=u[n]))return e;if(o=10,i.length>1&&"0"===jN(i,0)&&(o=GN(aO,i)?16:8,i=XN(i,8===o?1:2)),""===i)a=0;else{if(!GN(10===o?uO:8===o?sO:cO,i))return e;a=BN(i,o)}JN(r,a)}for(n=0;n<t;n++)if(a=r[n],n===t-1){if(a>=VN(256,5-t))return null}else if(a>255)return null;for(s=KN(r),n=0;n<r.length;n++)s+=r[n]*VN(256,3-n);return s}(e),null===t)return tO;this.host=t}else{if(GN(dO,e))return tO;for(t="",r=CN(e),n=0;n<r.length;n++)t+=SO(r[n],pO);this.host=t}},cannotHaveUsernamePasswordPort:function(){return!this.host||this.cannotBeABaseURL||"file"===this.scheme},includesCredentials:function(){return""!==this.username||""!==this.password},isSpecial:function(){return bN(IO,this.scheme)},shortenPath:function(){var e=this.path,t=e.length;!t||"file"===this.scheme&&1===t&&bO(e[0],!0)||e.length--},serialize:function(){var e=this,t=e.scheme,r=e.username,n=e.password,i=e.host,o=e.port,a=e.path,s=e.query,u=e.fragment,c=t+":";return null!==i?(c+="//",e.includesCredentials()&&(c+=r+(n?":"+n:"")+"@"),c+=mO(i),null!==o&&(c+=":"+o)):"file"===t&&(c+="//"),c+=e.cannotBeABaseURL?a[0]:a.length?"/"+HN(a,"/"):"",null!==s&&(c+="?"+s),null!==u&&(c+="#"+u),c},setHref:function(e){var t=this.parse(e);if(t)throw new LN(t);this.searchParams.update()},getOrigin:function(){var e=this.scheme,t=this.port;if("blob"===e)try{return new JO(e.path[0]).origin}catch(bi){return"null"}return"file"!==e&&this.isSpecial()?e+"://"+mO(this.host)+(null!==t?":"+t:""):"null"},getProtocol:function(){return this.scheme+":"},setProtocol:function(e){this.parse(AN(e)+":",wO)},getUsername:function(){return this.username},setUsername:function(e){var t=CN(AN(e));if(!this.cannotHaveUsernamePasswordPort()){this.username="";for(var r=0;r<t.length;r++)this.username+=SO(t[r],yO)}},getPassword:function(){return this.password},setPassword:function(e){var t=CN(AN(e));if(!this.cannotHaveUsernamePasswordPort()){this.password="";for(var r=0;r<t.length;r++)this.password+=SO(t[r],yO)}},getHost:function(){var e=this.host,t=this.port;return null===e?"":null===t?mO(e):mO(e)+":"+t},setHost:function(e){this.cannotBeABaseURL||this.parse(e,NO)},getHostname:function(){var e=this.host;return null===e?"":mO(e)},setHostname:function(e){this.cannotBeABaseURL||this.parse(e,OO)},getPort:function(){var e=this.port;return null===e?"":AN(e)},setPort:function(e){this.cannotHaveUsernamePasswordPort()||(""===(e=AN(e))?this.port=null:this.parse(e,MO))},getPathname:function(){var e=this.path;return this.cannotBeABaseURL?e[0]:e.length?"/"+HN(e,"/"):""},setPathname:function(e){this.cannotBeABaseURL||(this.path=[],this.parse(e,VO))},getSearch:function(){var e=this.query;return e?"?"+e:""},setSearch:function(e){""===(e=AN(e))?this.query=null:("?"===jN(e,0)&&(e=XN(e,1)),this.query="",this.parse(e,HO)),this.searchParams.update()},getSearchParams:function(){return this.searchParams.facade},getHash:function(){var e=this.fragment;return e?"#"+e:""},setHash:function(e){""!==(e=AN(e))?("#"===jN(e,0)&&(e=XN(e,1)),this.fragment="",this.parse(e,zO)):this.fragment=null},update:function(){this.query=this.searchParams.serialize()||null}};var JO=function(e){var t=IN(this,QO),r=PN(arguments.length,1)>1?arguments[1]:undefined,n=WN(t,new KO(e,!1,r));gN||(t.href=n.serialize(),t.origin=n.getOrigin(),t.protocol=n.getProtocol(),t.username=n.getUsername(),t.password=n.getPassword(),t.host=n.getHost(),t.hostname=n.getHostname(),t.port=n.getPort(),t.pathname=n.getPathname(),t.search=n.getSearch(),t.searchParams=n.getSearchParams(),t.hash=n.getHash())},QO=JO.prototype,qO=function(e,t){return{get:function(){return RN(this)[e]()},set:t&&function(e){return RN(this)[t](e)},configurable:!0,enumerable:!0}};if(gN&&(SN(QO,"href",qO("serialize","setHref")),SN(QO,"origin",qO("getOrigin")),SN(QO,"protocol",qO("getProtocol","setProtocol")),SN(QO,"username",qO("getUsername","setUsername")),SN(QO,"password",qO("getPassword","setPassword")),SN(QO,"host",qO("getHost","setHost")),SN(QO,"hostname",qO("getHostname","setHostname")),SN(QO,"port",qO("getPort","setPort")),SN(QO,"pathname",qO("getPathname","setPathname")),SN(QO,"search",qO("getSearch","setSearch")),SN(QO,"searchParams",qO("getSearchParams")),SN(QO,"hash",qO("getHash","setHash"))),yN(QO,"toJSON",(function(){return RN(this).serialize()}),{enumerable:!0}),yN(QO,"toString",(function(){return RN(this).serialize()}),{enumerable:!0}),MN){var YO=MN.createObjectURL,XO=MN.revokeObjectURL;YO&&yN(JO,"createObjectURL",vN(YO,MN)),XO&&yN(JO,"revokeObjectURL",vN(XO,MN))}xN(JO,"URL"),hN({global:!0,constructor:!0,forced:!mN,sham:!gN},{URL:JO});var ZO=ip,$O=Wf,eM=hw,tM=l_,rM=lW,nM=Dh("URL"),iM=rM&&$O((function(){nM.canParse()})),oM=$O((function(){return 1!==nM.canParse.length}));ZO({target:"URL",stat:!0,forced:!iM||oM},{canParse:function(e){var t=eM(arguments.length,1),r=tM(e),n=t<2||arguments[1]===undefined?undefined:tM(arguments[1]);try{return!!new nM(r,n)}catch(bi){return!1}}});var aM=ip,sM=hw,uM=l_,cM=lW,lM=Dh("URL");aM({target:"URL",stat:!0,forced:!cM},{parse:function(e){var t=sM(arguments.length,1),r=uM(e),n=t<2||arguments[1]===undefined?undefined:uM(arguments[1]);try{return new lM(r,n)}catch(bi){return null}}});var dM=k(Eh.URL),fM=k(MD),hM=ip,gM=lv.indexOf,mM=vF,pM=Xf([].indexOf),vM=!!pM&&1/pM([1],1,-0)<0;hM({target:"Array",proto:!0,forced:vM||!mM("indexOf")},{indexOf:function(e){var t=arguments.length>1?arguments[1]:undefined;return vM?pM(this,e,t)||0:gM(this,e,t)}});var _M=bx("Array","indexOf"),yM=Fh,SM=_M,IM=Array.prototype,bM=function(e){var t=e.indexOf;return e===IM||yM(IM,e)&&t===IM.indexOf?SM:t},TM=k(bM),CM=eg,wM=TypeError,EM=ip,kM=wg,AM=tv,xM=Xp,PM=ov,DM=aD,FM=eP,WM=yy,RM=XI,NM=function(e,t){if(!delete e[t])throw new wM("Cannot delete property "+CM(t)+" of "+CM(e))},OM=iP("splice"),MM=Math.max,LM=Math.min;EM({target:"Array",proto:!0,forced:!OM},{splice:function(e,t){var r,n,i,o,a,s,u=kM(this),c=PM(u),l=AM(e,c),d=arguments.length;for(0===d?r=n=0:1===d?(r=0,n=c-l):(r=d-2,n=LM(MM(xM(t),0),c-l)),FM(c+r-n),i=WM(u,n),o=0;o<n;o++)(a=l+o)in u&&RM(i,o,u[a]);if(i.length=n,r<n){for(o=l;o<c-n;o++)s=o+r,(a=o+n)in u?u[s]=u[a]:NM(u,s);for(o=c;o>c-n+r;o--)NM(u,o-1)}else if(r>n)for(o=c-n;o>l;o--)s=o+r-1,(a=o+n-1)in u?u[s]=u[a]:NM(u,s);for(o=0;o<r;o++)u[o+l]=arguments[o+2];return DM(u,c-n+r),i}});var BM=bx("Array","splice"),UM=Fh,VM=BM,jM=Array.prototype,GM=function(e){var t=e.splice;return e===jM||UM(jM,e)&&t===jM.splice?VM:t},HM=k(GM),zM=ip,KM=ky.findIndex,JM="findIndex",QM=!0;JM in[]&&Array(1)[JM]((function(){QM=!1})),zM({target:"Array",proto:!0,forced:QM},{findIndex:function(e){return KM(this,e,arguments.length>1?arguments[1]:undefined)}});var qM=bx("Array","findIndex"),YM=Fh,XM=qM,ZM=Array.prototype,$M=function(e){var t=e.findIndex;return e===ZM||YM(ZM,e)&&t===ZM.findIndex?XM:t},eL=k($M),tL=th,rL=Wf,nL=Hf,iL=_b,oL=Iv,aL=Th,sL=nL(oh.f),uL=nL([].push),cL=tL&&rL((function(){var e=Object.create(null);return e[2]=2,!sL(e,2)})),lL=function(e){return function(t){for(var r,n=aL(t),i=oL(n),o=cL&&null===iL(n),a=i.length,s=0,u=[];a>s;)r=i[s++],tL&&!(o?r in n:sL(n,r))||uL(u,e?[r,n[r]]:n[r]);return u}},dL={entries:lL(!0),values:lL(!1)}.entries;ip({target:"Object",stat:!0},{entries:function(e){return dL(e)}});var fL=k(Eh.Object.entries),hL=k(XA),gL=ip,mL=ky.find,pL="find",vL=!0;pL in[]&&Array(1)[pL]((function(){vL=!1})),gL({target:"Array",proto:!0,forced:vL},{find:function(e){return mL(this,e,arguments.length>1?arguments[1]:undefined)}});var _L=bx("Array","find"),yL=Fh,SL=_L,IL=Array.prototype,bL=function(e){var t=e.find;return e===IL||yL(IL,e)&&t===IL.find?SL:t},TL=k(bL),CL=ky.filter;ip({target:"Array",proto:!0,forced:!iP("filter")},{filter:function(e){return CL(this,e,arguments.length>1?arguments[1]:undefined)}});var wL=bx("Array","filter"),EL=Fh,kL=wL,AL=Array.prototype,xL=function(e){var t=e.filter;return e===AL||EL(AL,e)&&t===AL.filter?kL:t},PL=k(xL),DL=ky.map;ip({target:"Array",proto:!0,forced:!iP("map")},{map:function(e){return DL(this,e,arguments.length>1?arguments[1]:undefined)}});var FL=bx("Array","map"),WL=Fh,RL=FL,NL=Array.prototype,OL=function(e){var t=e.map;return e===NL||WL(NL,e)&&t===NL.map?RL:t},ML=k(OL),LL=lv.includes;ip({target:"Array",proto:!0,forced:Wf((function(){return!Array(1).includes()}))},{includes:function(e){return LL(this,e,arguments.length>1?arguments[1]:undefined)}});var BL=bx("Array","includes"),UL=wh,VL=Qf,jL=jg("match"),GL=function(e){var t;return UL(e)&&((t=e[jL])!==undefined?!!t:"RegExp"===VL(e))},HL=TypeError,zL=jg("match"),KL=ip,JL=function(e){if(GL(e))throw new HL("The method doesn't accept regular expressions");return e},QL=Sh,qL=l_,YL=function(e){var t=/./;try{"/./"[e](t)}catch(r){try{return t[zL]=!1,"/./"[e](t)}catch(n){}}return!1},XL=Hf("".indexOf);KL({target:"String",proto:!0,forced:!YL("includes")},{includes:function(e){return!!~XL(qL(QL(this)),qL(JL(e)),arguments.length>1?arguments[1]:undefined)}});var ZL=bx("String","includes"),$L=Fh,eB=BL,tB=ZL,rB=Array.prototype,nB=String.prototype,iB=function(e){var t=e.includes;return e===rB||$L(rB,e)&&t===rB.includes?eB:"string"==typeof e||e===nB||$L(nB,e)&&t===nB.includes?tB:t},oB=k(iB),aB="\t\n\x0B\f\r \u2028\u2029\ufeff",sB=Sh,uB=l_,cB=aB,lB=Hf("".replace),dB=RegExp("^["+cB+"]+"),fB=RegExp("(^|[^"+cB+"])["+cB+"]+$"),hB=function(e){return function(t){var r=uB(sB(t));return 1&e&&(r=lB(r,dB,"")),2&e&&(r=lB(r,fB,"$1")),r}},gB={start:hB(1),end:hB(2),trim:hB(3)},mB=Ff,pB=Wf,vB=Hf,_B=l_,yB=gB.trim,SB=aB,IB=mB.parseInt,bB=mB.Symbol,TB=bB&&bB.iterator,CB=/^[+-]?0x/i,wB=vB(CB.exec),EB=8!==IB(SB+"08")||22!==IB(SB+"0x16")||TB&&!pB((function(){IB(Object(TB))}))?function(e,t){var r=yB(_B(e));return IB(r,t>>>0||(wB(CB,r)?16:10))}:IB;ip({global:!0,forced:parseInt!==EB},{parseInt:EB});var kB=k(Eh.parseInt),AB=k(tF),xB=bx("Array","keys"),PB=wp,DB=Ag,FB=Fh,WB=xB,RB=Array.prototype,NB={DOMTokenList:!0,NodeList:!0},OB=function(e){var t=e.keys;return e===RB||FB(RB,e)&&t===RB.keys||DB(NB,PB(e))?WB:t},MB=k(OB),LB={exports:{}},BB=Wf((function(){if("function"==typeof ArrayBuffer){var e=new ArrayBuffer(8);Object.isExtensible(e)&&Object.defineProperty(e,"a",{value:8})}})),UB=Wf,VB=wh,jB=Qf,GB=BB,HB=Object.isExtensible,zB=UB((function(){HB(1)}))||GB?function(e){return!!VB(e)&&((!GB||"ArrayBuffer"!==jB(e))&&(!HB||HB(e)))}:HB,KB=!Wf((function(){return Object.isExtensible(Object.preventExtensions({}))})),JB=ip,QB=Hf,qB=dv,YB=wh,XB=Ag,ZB=km.f,$B=d_,eU=g_,tU=zB,rU=KB,nU=!1,iU=Wg("meta"),oU=0,aU=function(e){ZB(e,iU,{value:{objectID:"O"+oU++,weakData:{}}})},sU=LB.exports={enable:function(){sU.enable=function(){},nU=!0;var e=$B.f,t=QB([].splice),r={};r[iU]=1,e(r).length&&($B.f=function(r){for(var n=e(r),i=0,o=n.length;i<o;i++)if(n[i]===iU){t(n,i,1);break}return n},JB({target:"Object",stat:!0,forced:!0},{getOwnPropertyNames:eU.f}))},fastKey:function(e,t){if(!YB(e))return"symbol"==_(e)?e:("string"==typeof e?"S":"P")+e;if(!XB(e,iU)){if(!tU(e))return"F";if(!t)return"E";aU(e)}return e[iU].objectID},getWeakData:function(e,t){if(!XB(e,iU)){if(!tU(e))return!0;if(!t)return!1;aU(e)}return e[iU].weakData},onFreeze:function(e){return rU&&nU&&tU(e)&&!XB(e,iU)&&aU(e),e}};qB[iU]=!0;var uU=LB.exports,cU=ip,lU=Ff,dU=uU,fU=Wf,hU=Km,gU=AT,mU=aw,pU=$f,vU=wh,_U=vh,yU=Q_,SU=km.f,IU=ky.forEach,bU=th,TU=ly.set,CU=ly.getterFor,wU=Kv,EU=C_,kU=fW,AU=Em,xU=aw,PU=vh,DU=AT,FU=WC,WU=RC,RU=nw,NU=th,OU=uU.fastKey,MU=ly.set,LU=ly.getterFor,BU={getConstructor:function(e,t,r,n){var i=e((function(e,i){xU(e,o),MU(e,{type:t,index:wU(null),first:null,last:null,size:0}),NU||(e.size=0),PU(i)||DU(i,e[n],{that:e,AS_ENTRIES:r})})),o=i.prototype,a=LU(t),s=function(e,t,r){var n,i,o=a(e),s=u(e,t);return s?s.value=r:(o.last=s={index:i=OU(t,!0),key:t,value:r,previous:n=o.last,next:null,removed:!1},o.first||(o.first=s),n&&(n.next=s),NU?o.size++:e.size++,"F"!==i&&(o.index[i]=s)),e},u=function(e,t){var r,n=a(e),i=OU(t);if("F"!==i)return n.index[i];for(r=n.first;r;r=r.next)if(r.key===t)return r};return kU(o,{clear:function(){for(var e=a(this),t=e.first;t;)t.removed=!0,t.previous&&(t.previous=t.previous.next=null),t=t.next;e.first=e.last=null,e.index=wU(null),NU?e.size=0:this.size=0},"delete":function(e){var t=this,r=a(t),n=u(t,e);if(n){var i=n.next,o=n.previous;delete r.index[n.index],n.removed=!0,o&&(o.next=i),i&&(i.previous=o),r.first===n&&(r.first=i),r.last===n&&(r.last=o),NU?r.size--:t.size--}return!!n},forEach:function(e){for(var t,r=a(this),n=AU(e,arguments.length>1?arguments[1]:undefined);t=t?t.next:r.first;)for(n(t.value,t.key,this);t&&t.removed;)t=t.previous},has:function(e){return!!u(this,e)}}),kU(o,r?{get:function(e){var t=u(this,e);return t&&t.value},set:function(e,t){return s(this,0===e?0:e,t)}}:{add:function(e){return s(this,e=0===e?0:e,e)}}),NU&&EU(o,"size",{configurable:!0,get:function(){return a(this).size}}),i},setStrong:function(e,t,r){var n=t+" Iterator",i=LU(t),o=LU(n);FU(e,t,(function(e,t){MU(this,{type:n,target:e,state:i(e),kind:t,last:null})}),(function(){for(var e=o(this),t=e.kind,r=e.last;r&&r.removed;)r=r.previous;return e.target&&(e.last=r=r?r.next:e.state.first)?WU("keys"===t?r.key:"values"===t?r.value:[r.key,r.value],!1):(e.target=null,WU(undefined,!0))}),r?"entries":"values",!r,!0),RU(t)}},UU=function(e,t,r){var n,i=-1!==e.indexOf("Map"),o=-1!==e.indexOf("Weak"),a=i?"set":"add",s=lU[e],u=s&&s.prototype,c={};if(bU&&pU(s)&&(o||u.forEach&&!fU((function(){(new s).entries().next()})))){var l=(n=t((function(t,r){TU(mU(t,l),{type:e,collection:new s}),_U(r)||gU(r,t[a],{that:t,AS_ENTRIES:i})}))).prototype,d=CU(e);IU(["add","clear","delete","forEach","get","has","set","keys","values","entries"],(function(e){var t="add"===e||"set"===e;!(e in u)||o&&"clear"===e||hU(l,e,(function(r,n){var i=d(this).collection;if(!t&&o&&!vU(r))return"get"===e&&undefined;var a=i[e](0===r?0:r,n);return t?this:a}))})),o||SU(l,"size",{configurable:!0,get:function(){return d(this).collection.size}})}else n=r.getConstructor(t,e,i,a),dU.enable();return yU(n,e,!1,!0),c[e]=n,cU({global:!0,forced:!0},c),o||r.setStrong(n,e,i),n};UU("Set",(function(e){return function(){return e(this,arguments.length?arguments[0]:undefined)}}),BU);var VU=eg,jU=TypeError,GU=function(e){if("object"==_(e)&&"size"in e&&"has"in e&&"add"in e&&"delete"in e&&"keys"in e)return e;throw new jU(VU(e)+" is not a set")},HU=function(e,t){return 1===t?function(t,r){return t[e](r)}:function(t,r,n){return t[e](r,n)}},zU=Dh("Set"),KU=zU.prototype,JU={Set:zU,add:HU("add",1),has:HU("has",1),remove:HU("delete",1),proto:KU},QU=ih,qU=function(e,t,r){for(var n,i,o=r?e:e.iterator,a=e.next;!(n=QU(a,o)).done;)if((i=t(n.value))!==undefined)return i},YU=qU,XU=function(e,t,r){return r?YU(e.keys(),t,!0):e.forEach(t)},ZU=XU,$U=JU.Set,eV=JU.add,tV=function(e){var t=new $U;return ZU(e,(function(e){eV(t,e)})),t},rV=function(e){return e.size},nV=ig,iV=Fm,oV=ih,aV=Xp,sV=function(e){return{iterator:e,next:e.next,done:!1}},uV="Invalid size",cV=RangeError,lV=TypeError,dV=Math.max,fV=function(e,t){this.set=e,this.size=dV(t,0),this.has=nV(e.has),this.keys=nV(e.keys)};fV.prototype={getIterator:function(){return sV(iV(oV(this.keys,this.set)))},includes:function(e){return oV(this.has,this.set,e)}};var hV=function(e){iV(e);var t=+e.size;if(t!=t)throw new lV(uV);var r=aV(t);if(r<0)throw new cV(uV);return new fV(e,r)},gV=GU,mV=tV,pV=rV,vV=hV,_V=XU,yV=qU,SV=JU.has,IV=JU.remove,bV=function(){return!1},TV=function(e){var t=gV(this),r=vV(e),n=mV(t);return pV(t)<=r.size?_V(t,(function(e){r.includes(e)&&IV(n,e)})):yV(r.getIterator(),(function(e){SV(t,e)&&IV(n,e)})),n};ip({target:"Set",proto:!0,real:!0,forced:!bV()},{difference:TV});var CV=GU,wV=rV,EV=hV,kV=XU,AV=qU,xV=JU.Set,PV=JU.add,DV=JU.has,FV=function(e){var t=CV(this),r=EV(e),n=new xV;return wV(t)>r.size?AV(r.getIterator(),(function(e){DV(t,e)&&PV(n,e)})):kV(t,(function(e){r.includes(e)&&PV(n,e)})),n};ip({target:"Set",proto:!0,real:!0,forced:!bV()},{intersection:FV});var WV=GU,RV=JU.has,NV=rV,OV=hV,MV=XU,LV=qU,BV=gT,UV=function(e){var t=WV(this),r=OV(e);if(NV(t)<=r.size)return!1!==MV(t,(function(e){if(r.includes(e))return!1}),!0);var n=r.getIterator();return!1!==LV(n,(function(e){if(RV(t,e))return BV(n,"normal",!1)}))};ip({target:"Set",proto:!0,real:!0,forced:!bV()},{isDisjointFrom:UV});var VV=GU,jV=rV,GV=XU,HV=hV,zV=function(e){var t=VV(this),r=HV(e);return!(jV(t)>r.size)&&!1!==GV(t,(function(e){if(!r.includes(e))return!1}),!0)};ip({target:"Set",proto:!0,real:!0,forced:!bV()},{isSubsetOf:zV});var KV=GU,JV=JU.has,QV=rV,qV=hV,YV=qU,XV=gT,ZV=function(e){var t=KV(this),r=qV(e);if(QV(t)<r.size)return!1;var n=r.getIterator();return!1!==YV(n,(function(e){if(!JV(t,e))return XV(n,"normal",!1)}))};ip({target:"Set",proto:!0,real:!0,forced:!bV()},{isSupersetOf:ZV});var $V=GU,ej=tV,tj=hV,rj=qU,nj=JU.add,ij=JU.has,oj=JU.remove,aj=function(e){var t=$V(this),r=tj(e).getIterator(),n=ej(t);return rj(r,(function(e){ij(t,e)?oj(n,e):nj(n,e)})),n};ip({target:"Set",proto:!0,real:!0,forced:!bV()},{symmetricDifference:aj});var sj=GU,uj=JU.add,cj=tV,lj=hV,dj=qU,fj=function(e){var t=sj(this),r=lj(e).getIterator(),n=cj(t);return dj(r,(function(e){uj(n,e)})),n};ip({target:"Set",proto:!0,real:!0,forced:!bV()},{union:fj});var hj=k(Eh.Set),gj=k(Qx);function mj(e,t){var r=KF(e);if(DI){var n=DI(e);t&&(n=PL(n).call(n,(function(t){return VI(e,t).enumerable}))),r.push.apply(r,n)}return r}function pj(e){for(var t=1;t<arguments.length;t++){var r,n,i=null!=arguments[t]?arguments[t]:{};t%2?GF(r=mj(Object(i),!0)).call(r,(function(t){fF(e,t,i[t])})):rb?cb(e,rb(i)):GF(n=mj(Object(i))).call(n,(function(t){gj(e,t,VI(i,t))}))}return e}function vj(e){var t=function(){if("undefined"==typeof Reflect||!s_)return!1;if(s_.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(s_(Boolean,[],(function(){}))),!0}catch(Mj){return!1}}();return function(){var r,n=Mx(e);if(t){var i=Mx(this).constructor;r=s_(n,arguments,i)}else r=n.apply(this,arguments);return function(e,t){if(t&&("object"==ZP(t)||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return lx(e)}(this,r)}}var _j=function(e){return jF?jF(e):"[object Array]"===function(e){return Object.prototype.toString.call(e)}(e)},yj=function(e){return void 0===e},Sj=function(e,t){var r,n;e=null!==(r=e)&&void 0!==r?r:"yyyy-MM-dd hh:mm:ss";var i=yj(t)?new Date:new Date(t),o={"M+":(i.getMonth()+1).toString(),"d+":i.getDate().toString(),"h+":i.getHours().toString(),"m+":i.getMinutes().toString(),"s+":i.getSeconds().toString(),"q+":Math.floor((i.getMonth()+3)/3).toString(),S:i.getMilliseconds().toString()};return/(y+)/.test(e)&&(e=e.replace(RegExp.$1,"".concat(i.getFullYear()).substring(4-RegExp.$1.length))),GF(n=KF(o)).call(n,(function(t){new RegExp("(".concat(t,")")).test(e)&&(e=e.replace(RegExp.$1,1===RegExp.$1.length?o[t]:"00".concat(o[t]).substring("".concat(o[t]).length)))})),e},Ij=function(e){return"string"==typeof e},bj=function(e){return"number"==typeof e&&!JF(e)},Tj=function(e){return"function"==typeof e},Cj=0,wj=function(){var e;return Cj+=1,$F(e="".concat((new Date).getTime().toString(36))).call(e,Cj.toString(36))};!function(e,t){for(var r=KF(e),n=0;n<r.length;n++){var i=r[n];if(!1===t.call(null,e[i],i,e))break}}({"&":"&",">":">","<":"<"," ":" ",""":'"',"'":"'"},(function(e,t){})),function(e,t){for(var r=KF(e),n=0;n<r.length;n++){var i=r[n];if(!1===t.call(null,e[i],i,e))break}}({"&":"&",">":">","<":"<"," ":" ",""":'"',"'":"'"},(function(e,t){}));var Ej=function(e){var t=dM||window.webkitURL;/^blob:/.test(e)&&t.revokeObjectURL(e)},kj=function(){function e(){var t=arguments.length>0&&arguments[0]!==undefined?arguments[0]:"",r=arguments.length>1&&arguments[1]!==undefined?arguments[1]:"";sF(this,e),fF(this,"prefix",void 0),fF(this,"postfix",void 0),fF(this,"isDestroyed",!1),fF(this,"uid",wj()),fF(this,"cacheEvents",void 0),fF(this,"events",void 0),fF(this,"isCached",void 0),this.cacheEvents=[],this.events={},this.isCached=!1,this.prefix=t,this.postfix=r}return dF(e,[{key:"save",value:function(){this.isCached=!0}},{key:"restore",value:function(){var e,t=this;this.isCached=!1,GF(e=this.cacheEvents).call(e,(function(e){var r,n=e.eventName,i=e.param;t.emit.apply(t,$F(r=[n]).call(r,aF(i)))})),this.cacheEvents.length=0}},{key:"destroy",value:function(){var e=this;if(!this.isDestroyed){for(var t in this.events)if(Object.prototype.hasOwnProperty.call(this.events,t)){var r,n=this.events[t];n&&GF(r=fM(n).call(n)).call(r,(function(t){var r=t.name,n=t.fn,i=t.context,o=t.once;e.off(r,n,i,o)}))}this.events={},this.isDestroyed=!0}}},{key:"on",value:function(e,t,r){var n,i=arguments.length>3&&arguments[3]!==undefined&&arguments[3],o=this.events,a={name:e=this.format(e),uid:wj(),context:r,once:i,fn:t};return o[e]||(o[e]=[]),TM(n=o[e]).call(n,a)<0&&o[e].push(a),a}},{key:"once",value:function(e,t,r){return this.on(e,t,r,!0)}},{key:"emit",value:function(e){for(var t,r,n=this,i=arguments.length,o=new Array(i>1?i-1:0),a=1;a<i;a++)o[a-1]=arguments[a];if(this.isCached)return this.cacheEvents.push({eventName:e,param:o}),!0;var s=this.events[e=this.format(e)];return!(!s||!s.length||(GF(t=fM(s).call(s)).call(t,(function(e){var t,r=e.fn,n=e.context;r.call.apply(r,$F(t=[n||null]).call(t,o))})),GF(r=fM(s).call(s)).call(r,(function(t){var r=t.fn,i=t.context,o=t.once;o&&n.off(e,r,i,o)})),0))}},{key:"off",value:function(e,t,r,n){var i=this.events[e=this.format(e)];if(!i)return!1;if(!arguments.length)return i.length=0,!0;for(var o=i.length-1;o>=0;o--){var a=i[o];t&&a.fn!==t||r&&a.context!==r||n&&a.once!==n||HM(i).call(i,o,1)}return!0}},{key:"removeAllEventListeners",value:function(e){if(e){var t,r;e=this.format(e);var n=eL(t=this.cacheEvents).call(t,(function(t){return t.eventName===e}));n>-1&&HM(r=this.cacheEvents).call(r,n,1),this.events[e]&&delete this.events[e]}else this.cacheEvents=[],this.events={}}},{key:"getAllEvents",value:function(){return this.events}},{key:"format",value:function(e){var t,r;return $F(t=$F(r="".concat(this.prefix||"")).call(r,e)).call(t,this.postfix||"")}}],[{key:"create",value:function(t,r){return new e(t,r)}}]),e}(),Aj="default",xj=function(){function e(){sF(this,e),fF(this,"emitter",new kj)}return dF(e,[{key:"on",value:function(e){this.emitter.on(Aj,e)}},{key:"emit",value:function(){for(var e,t,r=arguments.length,n=new Array(r),i=0;i<r;i++)n[i]=arguments[i];(e=this.emitter).emit.apply(e,$F(t=[Aj]).call(t,n))}},{key:"off",value:function(e){this.emitter.off(Aj,e)}}],[{key:"create",value:function(){return new e}}]),e}(),Pj=function(){function e(t){sF(this,e),fF(this,"uid",void 0),fF(this,"children",void 0),this.uid=t.uid,this.children=t.children||[]}return dF(e,[{key:"append",value:function(e){var t=this.children;return TM(t).call(t,e)<0&&(t.push(e),!0)}},{key:"insert",value:function(e,t){var r=this.children;return!(t<0||(t>r.length&&(t=r.length),HM(r).call(r,t,0,e),0))}},{key:"remove",value:function(e){var t=this.children,r=TM(t).call(t,e);return!(r<0||(HM(t).call(t,r,1),0))}},{key:"clear",value:function(){return this.children=[],!0}},{key:"move",value:function(e,t){if(e===t)return!0;var r=this.children,n=oF(HM(r).call(r,e,1),1)[0];return HM(r).call(r,t,0,n),!0}},{key:"switch",value:function(e,t){if(e===t)return!0;var r=this.children,n=r[e];return r[e]=r[t],r[t]=n,!0}},{key:"reorder",value:function(e){var t=this.children,r=e.length,n=[],i=0;if(t.length!==r||0===r)return!1;for(var o=0;o<r;o++)e[o]===o&&(i+=1);if(i===r)return!0;for(var a=0;a<r;a++)n[a]=t[e[a]];for(var s=0;s<r;s++)t[s]=n[s];return!0}}]),e}(),Dj=function(){function e(t,r){sF(this,e),fF(this,"isDestroyed",!1),fF(this,"data",void 0),fF(this,"table",["database","table","item"]),fF(this,"dbName",void 0),fF(this,"tableName",void 0),this.data={},this.dbName=t,this.tableName=r,this.createDatabase(t,r)}return dF(e,[{key:"destroy",value:function(){if(!this.isDestroyed){for(var e=0,t=fL(this.data);e<t.length;e++){var r=oF(t[e],2),n=r[0];r[1],this.data[n]=null}this.data=null,this.isDestroyed=!0}}},{key:"createDatabase",value:function(e,t){this.data[e]={},this.data[e][t]={}}},{key:"set",value:function(e,t){var r=this,n=this.dbName,i=this.tableName;return new hL((function(o,a){r.checkId(e)?a(new Error("The ".concat(e," already exists."))):(r.data[n][i][e]=t,o("Save ".concat(e," to database successful.")))}))}},{key:"get",value:function(e){var t=this,r=this.dbName,n=this.tableName;return new hL((function(i,o){t.checkId(e)?i(t.data[r][n][e]):o(t.erMsg(2,e))}))}},{key:"remove",value:function(e){var t=this,r=this.dbName,n=this.tableName;return new hL((function(i,o){delete t.data[r][n][e],i("Remove ".concat(e," successful."))}))}},{key:"update",value:function(e,t){var r=this,n=this.dbName,i=this.tableName;return new hL((function(o,a){r.checkId(e)?(r.data[n][i][e]=t,o("Update ".concat(e," successful."))):a(r.erMsg(2,e))}))}},{key:"checkId",value:function(e){var t=this.dbName,r=this.tableName;return void 0!==this.data[t][r][e]}},{key:"erMsg",value:function(e,t){var r;return $F(r="The ".concat(this.table[e]," ")).call(r,t," does not exist.")}}]),e}(),Fj=function(){function e(){sF(this,e),fF(this,"isDestroyed",!1),fF(this,"data",void 0),this.data={}}return dF(e,[{key:"destroy",value:function(){if(!this.isDestroyed){for(var e=0,t=fL(this.data);e<t.length;e++){var r,n=oF(t[e],2),i=n[0];n[1],null!==(r=this.data[i])&&void 0!==r&&r.destroy(),this.data[i]=null}this.data=null,this.isDestroyed=!0}}},{key:"set",value:function(e,t){return!this.check(e)&&(this.data[e]=t,!0)}},{key:"get",value:function(e){return this.data[e]}},{key:"remove",value:function(e){return!!this.check(e)&&(delete this.data[e],!0)}},{key:"update",value:function(e,t){return!!this.check(e)&&(this.data[e]=t,!0)}},{key:"check",value:function(e){return void 0!==this.data[e]}}]),e}(),Wj=function(e){Zx(r,e);var t=vj(r);function r(e){var n;return sF(this,r),fF(lx(n=t.call(this,e)),"name",void 0),fF(lx(n),"type",void 0),fF(lx(n),"fileType",void 0),fF(lx(n),"createdDate",void 0),fF(lx(n),"modifiedDate",void 0),fF(lx(n),"parent",void 0),fF(lx(n),"isRoot",!1),n.name=e.name,n.type=e.type,n.fileType=e.fileType,n.parent=e.parent||null,n.isRoot=e.isRoot||!1,n.createdDate=Sj(),n.modifiedDate=n.createdDate,n}return dF(r,[{key:"updateDate",value:function(){this.modifiedDate=Sj()}},{key:"setName",value:function(e){this.name=e}},{key:"reorder",value:function(e){var t=this.type;return("file"===t||"default"===t)&&Lx(Mx(r.prototype),"reorder",this).call(this,e)}}]),r}(Pj),Rj=function(){function e(){sF(this,e),fF(this,"root",void 0),fF(this,"currentNode",void 0),fF(this,"selectedUid",void 0),fF(this,"defaultNode",void 0),fF(this,"hooks",{fileChanged:xj.create(),beforeRemoveFile:xj.create(),removeFile:xj.create(),afterRemoveFile:xj.create(),afterRenameFile:xj.create(),destroy:xj.create()}),this.root=new Wj({uid:wj(),children:[],name:"root",type:"file",fileType:"folder",parent:void 0,isRoot:!0}),this.defaultNode=this.root,this.currentNode=this.root}return dF(e,[{key:"appendChildrenToFile",value:function(e,t,r){var n=r,i=Nj(this.defaultNode,e);return i||(i=this.createFile(e),this.hooks.fileChanged.emit(this.defaultNode)),GF(t).call(t,(function(e){yj(n)?i.append(e):(i.insert(e,n),n+=1)})),i}},{key:"removeChildFromFile",value:function(e,t){Ij(t)&&(t=[t]);var r=this.getFileByUid(e);r&&GF(t).call(t,(function(e){r.remove(e)}))}},{key:"findChild",value:function(e,t){var r;return TL(r=e.children).call(r,(function(e){return e.name===t}))}},{key:"createFile",value:function(e){var t=this.defaultNode;t||(t=this.root);var r=Nj(t,e);return r&&"file"===r.type||(r=new Wj({uid:wj(),children:[],name:e,type:"file",fileType:"file",parent:t,isRoot:!1}),this.currentNode.append(r),this.hooks.fileChanged.emit(this.currentNode.children)),r}},{key:"removeFile",value:function(e){for(var t=this.defaultNode.children,r=0;r<t.length;r++){var n=t[r];if(n.name===e)return this.hooks.beforeRemoveFile.emit(n),HM(t).call(t,r,1),this.hooks.afterRemoveFile.emit(n),this.hooks.fileChanged.emit(n),!0}return!1}},{key:"renameFile",value:function(e,t){var r=this.findChild(this.defaultNode,e),n=this.findChild(this.defaultNode,t);return!!r&&!n&&(r.name=t,this.hooks.afterRenameFile.emit(r),this.hooks.fileChanged.emit(this.currentNode.children),!0)}},{key:"getFile",value:function(e){return this.findChild(this.defaultNode,e)}},{key:"getFileByUid",value:function(e){return TL(this).call(this,e,this.root)}},{key:"getCurrentFileList",value:function(){return this.currentNode.children}},{key:"isFileExist",value:function(e){return!!this.findChild(this.defaultNode,e)}},{key:"createFolder",value:function(){}},{key:"find",value:function(e,t){for(var r=t.children,n=r.length,i=0;i<n;i++){if(r[i].uid===e)return r[i];if(r[i].children){var o=TL(this).call(this,e,r[i]);if(o)return o}}return null}}]),e}();function Nj(e,t){var r,n=PL(r=e.children).call(r,(function(e){return e.name===t}));return 0===n.length?null:n[0]}var Oj,Mj,Lj=function(e){Zx(r,e);var t=vj(r);function r(e){var n;return sF(this,r),fF(lx(n=t.call(this,e)),"name",void 0),fF(lx(n),"type","tag"),n.name=e.name,n.uid=e.uid||wj(),n.type="tag",n}return dF(r)}(Pj),Bj=function(){function e(){sF(this,e),fF(this,"tags",void 0),fF(this,"defaultName",void 0),fF(this,"defaultUid",void 0),fF(this,"selectedUid",void 0),fF(this,"emptyItem",void 0),fF(this,"hooks",{beforeRemoveTag:xj.create(),afterRenameTag:xj.create(),destroy:xj.create(),load:xj.create()}),this.tags=[],this.defaultName=null,this.defaultUid=null,this.selectedUid=null,this.emptyItem=new Lj({name:"defaultTag",children:[]})}return dF(e,[{key:"appendChildToTag",value:function(e,t){var r=this.createTag(e);Ij(t)&&(t=[t]);var n=!1;return GF(t).call(t,(function(e){r.append(e)&&(n=!0)})),n}},{key:"removeChildFromTag",value:function(e,t){var r=this.getTag(e);return!!r&&(Ij(t)&&(t=[t]),GF(t).call(t,(function(e){r.remove(e)})),!0)}},{key:"createTag",value:function(e){var t=arguments.length>1&&arguments[1]!==undefined?arguments[1]:[],r=this.getTag(e);return r||(r=new Lj({name:e,children:t}),this.tags.push(r)),r}},{key:"removeTag",value:function(e){var t,r,n=this.getTag(e);if(!n)return!1;this.hooks.beforeRemoveTag.emit(n);var i=eL(t=this.tags).call(t,(function(t){return t.name===e}));return e===this.defaultName&&(this.defaultName=null,this.selectedUid=null),HM(r=this.tags).call(r,i,1),!0}},{key:"renameTag",value:function(e,t){if(!Ij(e)||!Ij(t))return!1;var r=this.isTagExisted(t),n=this.getTag(e);return!(!n||r||(n.name=t,this.hooks.afterRenameTag.emit(n),0))}},{key:"getTag",value:function(e){var t;return TL(t=this.tags).call(t,(function(t){return t.name===e}))}},{key:"getTagByUid",value:function(e){var t;return TL(t=this.tags).call(t,(function(t){return t.uid===e}))}},{key:"getTagList",value:function(){var e;return fM(e=this.tags).call(e)}},{key:"setDefaultTag",value:function(e){if(!e)return this.defaultName=null,this.defaultUid=null,!0;var t=this.getTag(e);return!!t&&(this.defaultName=e,this.defaultUid=t.uid,!0)}},{key:"getDefaultTag",value:function(){return this.defaultName}},{key:"isTagExisted",value:function(e){return!!this.getTag(e)}}]),e}(),Uj=function(){function e(){sF(this,e)}return dF(e,[{key:"apply",value:function(e){var t=e.hooks,r={beforeStatus:null,afterStatus:null,operation:null,docUid:null},n=function(e){r.beforeStatus={uids:e.uids,selectedUids:[],currentUid:"",modifiedUid:e.modifiedUid,removedUids:e.removedUids}},i=function(t){r.afterStatus={uids:t.uids,selectedUids:[],currentUid:"",modifiedUid:t.modifiedUid,removedUids:t.removedUids},r.docUid=t.docUid,r.operation=t.operation,r.docType=t.docType,r.docName=t.docName,e.emit("bufferChanged",pj({},r)),r={beforeStatus:null,afterStatus:null,operation:null,docUid:null}};t.beforeBufferChanged.on(n),t.afterBufferChanged.on(i),t.destroy.on((function(){t.beforeBufferChanged.off(n),t.afterBufferChanged.off(i)}))}}]),e}(),Vj=function(){function e(){sF(this,e)}return dF(e,[{key:"apply",value:function(e){var t=e.hooks;e.customStore=new Fj;var r=function(t){var r=t.data;GF(r).call(r,(function(t){var r=t.customData;r||(r={}),e.customStore.set(t.uid,r)}))},n=function(t){var r=t.removedUids;GF(r).call(r,(function(t){e.customStore.remove(t)}))},i=function(t){var r=t.data.customData;r&&e.customStore.update(t.modifiedUid,r)};t.loadSource.on(r),t.removeSource.on(n),t.updateSource.on(i),t.destroy.on((function(){t.loadSource.off(r),t.removeSource.off(n),t.updateSource.off(i)}))}}]),e}(),jj=function(e){Zx(r,e);var t=vj(r);function r(){var e;return sF(this,r),fF(lx(e=t.call(this,{uid:wj(),children:[]})),"name","dvs-default"),fF(lx(e),"isDestroyed",!1),fF(lx(e),"type",void 0),e}return dF(r,[{key:"destroy",value:function(){this.isDestroyed||(this.isDestroyed=!0)}}]),r}(Pj),Gj=function(){function e(){sF(this,e)}return dF(e,[{key:"apply",value:function(e){e.defaultFile=new jj;var t=e.hooks,r=function(t){var r,n,i,o=t.filename,a=t.index,s=t.data;if(yj(o)){var u=ML(s).call(s,(function(e){return e.uid}));void 0===a?(r=e.defaultFile.children).push.apply(r,aF(u)):HM(n=e.defaultFile.children).apply(n,$F(i=[a,0]).call(i,aF(u)));var c={docUid:e.defaultFile.uid,sourceUids:u,type:"default",index:a};e.hooks.loadToDoc.emit(c)}},n=function(t){var r=t.removedUids,n=[];GF(r).call(r,(function(t){var r=e.statusStore.get(t);r&&r.ownerDefaultFile&&(e.defaultFile.remove(t),n.push(t))})),n.length&&e.hooks.removeFromDoc.emit({docUid:e.defaultFile.uid,sourceUids:r,type:"default"})};t.loadSource.on(r),t.removeSource.on(n),t.destroy.on((function(){t.loadSource.off(r),t.removeSource.off(n)}))}}]),e}(),Hj=function(){function e(){sF(this,e)}return dF(e,[{key:"apply",value:function(e){e.dir=new Rj,this.listenDirectoryHooks(e),this.listenSpaceHooks(e)}},{key:"listenDirectoryHooks",value:function(e){var t=e.dir.hooks,r=function(t){var r;GF(r=t.children).call(r,(function(r){var n=e.statusStore.get(r);n&&n.ownerFiles.remove(t.uid)})),e.hooks.removeDoc.emit(t)},n=function(t){e.hooks.renameDoc.emit(t)};t.beforeRemoveFile.on(r),t.afterRenameFile.on(n),t.destroy.on((function(){t.beforeRemoveFile.off(r),t.afterRenameFile.off(n)}))}},{key:"listenSpaceHooks",value:function(e){var t=e.hooks,r=function(t){var r=t.data,n=t.filename,i=t.index;if(!yj(n)){var o=e.dir.getFile(n);e.hooks.beforeBufferChanged.emit({docType:"file",docUid:null==o?void 0:o.uid,uids:aF((null==o?void 0:o.children)||[]),operation:"add"});var a=ML(r).call(r,(function(e){return e.uid})),s=e.dir.appendChildrenToFile(n,a,i),u={docUid:s.uid,sourceUids:a,type:"file",index:i};e.hooks.loadToDoc.emit(u),e.hooks.afterBufferChanged.emit({docType:"file",docName:n,docUid:null==s?void 0:s.uid,uids:aF((null==s?void 0:s.children)||[]),operation:"add"})}},n=function(t){var r=t.removedUids,n={};GF(r).call(r,(function(t){var r,i,o=e.statusStore.get(t);o&&GF(r=fM(i=o.ownerFiles.children).call(i)).call(r,(function(e){n[e]||(n[e]=[]),n[e].push(t)}))}));for(var i=0,o=fL(n);i<o.length;i++){var a=oF(o[i],2),s=a[0],u=a[1],c=e.dir.getFileByUid(s);c&&(e.hooks.beforeBufferChanged.emit({docUid:s,uids:aF(c.children),removedUids:aF(u),operation:"remove"}),e.dir.removeChildFromFile(s,u),e.hooks.afterBufferChanged.emit({docType:"file",docName:c.name,docUid:s,uids:aF(c.children),removedUids:aF(u),operation:"remove"})),e.hooks.removeFromDoc.emit({docUid:s,sourceUids:u})}},i=function(t){var r,n,i=e.statusStore.get(t.modifiedUid);i&&GF(r=fM(n=i.ownerFiles.children).call(n)).call(r,(function(r){var n=e.dir.getFileByUid(r);n&&(e.hooks.beforeBufferChanged.emit({uids:aF(n.children),modifiedUid:t.modifiedUid,operation:"modify"}),e.hooks.afterBufferChanged.emit({docType:"file",docName:n.name,docUid:r,uids:aF(n.children),modifiedUid:t.modifiedUid,operation:"modify"}))}))};t.loadSource.on(r),t.removeSource.on(n),t.updateSource.on(i),t.destroy.on((function(){t.loadSource.off(r),t.removeSource.off(n),t.updateSource.off(i)}))}}]),e}(),zj=function(){function e(){sF(this,e)}return dF(e,[{key:"apply",value:function(e){var t=e.hooks;e.metadataStore=new Fj;var r=function(t){var r=t.data;GF(r).call(r,(function(t){var r=t.metadata;r||(r={width:void 0,height:void 0}),e.metadataStore.set(t.uid,r)}))},n=function(t){var r=t.removedUids;GF(r).call(r,(function(t){e.metadataStore.remove(t)}))},i=function(t){var r=t.data.metadata;r&&e.metadataStore.update(t.modifiedUid,r)};t.loadSource.on(r),t.removeSource.on(n),t.updateSource.on(i),t.destroy.on((function(){t.loadSource.off(r),t.removeSource.off(n),t.updateSource.off(i)}))}}]),e}(),Kj=function(){function e(t){sF(this,e),fF(this,"uid",null),fF(this,"minData",null),fF(this,"oriData",null),fF(this,"customData",{}),fF(this,"activeOri",!1),fF(this,"activeMin",!1),fF(this,"minTask",null),fF(this,"oriTask",null),fF(this,"load",!1),fF(this,"preload",[]),fF(this,"visible",[]),fF(this,"overlays",[]),fF(this,"img",null),fF(this,"minImg",null),fF(this,"imageScale",1),fF(this,"owners",[]),fF(this,"oriType",null),fF(this,"minType",null),fF(this,"metadata",null),fF(this,"realTimeWidth",0),fF(this,"realTimeHeight",0),fF(this,"isFromFile",!1),fF(this,"isCached",!1),fF(this,"isDestroyed",!1),fF(this,"isLoading",!1),fF(this,"isMinLoading",!1),fF(this,"isSaving",!1),fF(this,"annotations",void 0),fF(this,"ownerFiles",new Pj({children:[]})),fF(this,"ownerTags",new Pj({children:[]})),fF(this,"ownerDefaultFile",void 0),fF(this,"operations",[]),fF(this,"useFillColor",!1),this.uid=t.uid,this.metadata=pj({},t.metadata),this.setRealTimeSize(this.metadata.width,this.metadata.height)}return dF(e,[{key:"setRealTimeSize",value:function(e,t){this.realTimeWidth=e,this.realTimeHeight=t}},{key:"destroy",value:function(){this.isDestroyed||(this.customData=null,this.img=null,this.owners=null,this.metadata=null,this.isDestroyed=!0)}},{key:"addOwner",value:function(e){var t=this.owners;TM(t).call(t,e)<0&&t.push(e)}},{key:"removeOwner",value:function(e){var t=this.owners,r=TM(t).call(t,e);r>-1&&HM(t).call(t,r,1)}},{key:"removeViewer",value:function(e){var t=this.owners,r=TM(t).call(t,e);r>-1&&HM(t).call(t,r,1)}},{key:"setVisible",value:function(e){var t;TM(t=this.visible).call(t,e)<0&&this.visible.push(e)}},{key:"cancelVisible",value:function(e){var t,r,n=TM(t=this.visible).call(t,e);n>-1&&HM(r=this.visible).call(r,n,1)}},{key:"setPreload",value:function(e){var t;TM(t=this.preload).call(t,e)<0&&this.preload.push(e)}},{key:"cancelPreload",value:function(e){var t,r,n=TM(t=this.preload).call(t,e);n>-1&&HM(r=this.preload).call(r,n,1)}},{key:"reset",value:function(){this.minData=null,this.oriData=null,this.img=null,this.activeOri=!1,this.activeMin=!1,this.minTask=null,this.oriTask=null,this.operations=[]}}]),e}(),Jj=function(){function e(){sF(this,e)}return dF(e,[{key:"apply",value:function(e){var t=e.hooks;e.statusStore=new Fj;var r=function(t){var r=t.data;t.filename,t.index,GF(r).call(r,(function(t){var r=new Kj(t);e.statusStore.set(t.uid,r)}))},n=function(t){var r=t.removedUids;GF(r).call(r,(function(t){var r,n,i=e.statusStore.get(t);i&&(Ej(i.minData),Ej(i.oriData),i.ownerFiles.clear(),i.ownerTags.clear(),i.ownerDefaultFile=!1,null!==(r=i.img)&&void 0!==r&&r.src&&(i.img.src=""),null!==(n=i.minImg)&&void 0!==n&&n.src&&(i.minImg.src=""),i.img=null,i.minImg=null),e.statusStore.remove(t)}))},i=function(t){var r=t.modifiedUid,n=t.data,i=t.revoke,o=e.statusStore.get(r);if(o){o.img=null,o.minImg=null;var a=n.metadata;a&&(o.metadata=pj({},a),o.setRealTimeSize(a.width,a.height)),i&&(Ej(o.oriData),Ej(o.minData)),o.reset(),e.statusStore.update(r,o)}},o=function(t){var r;GF(r=t.children).call(r,(function(r){var n=e.statusStore.get(r);n&&("file"===t.type?n.ownerFiles.remove(t.uid):"tag"===t.type&&n.ownerTags.remove(t.uid))}))},a=function(t){var r=t.docUid,n=t.sourceUids,i=t.type;GF(n).call(n,(function(t){var n=e.statusStore.get(t);n&&("file"===i?n.ownerFiles.append(r):"tag"===i?n.ownerTags.append(r):"default"===i&&(n.ownerDefaultFile=!0))}))},s=function(t){var r=t.docUid,n=t.sourceUids,i=t.type;GF(n).call(n,(function(t){var n=e.statusStore.get(t);n&&("file"===i?n.ownerFiles.remove(r):"tag"===i?n.ownerTags.remove(r):"default"===i&&(n.ownerDefaultFile=!0))}))};t.loadSource.on(r),t.afterRemoveSource.on(n),t.updateSource.on(i),t.removeDoc.on(o),t.loadToDoc.on(a),t.removeFromDoc.on(s),t.destroy.on((function(){t.loadSource.off(r),t.afterRemoveSource.off(n),t.updateSource.off(i),t.removeDoc.off(o),t.loadToDoc.off(a),t.removeFromDoc.off(s)}))}}]),e}(),Qj=function(){function e(){sF(this,e)}return dF(e,[{key:"apply",value:function(e){var t=e.hooks;e.store=new Dj("space_db","space_doc");var r=function(t){var r=t.data;r&&GF(r).call(r,(function(t){e.store.set(t.uid,t)}))},n=function(t){var r;GF(r=t.removedUids).call(r,(function(t){e.store.remove(t)}))},i=function(t){e.store.update(t.modifiedUid,t.data)};t.loadSource.on(r),t.removeSource.on(n),t.updateSource.on(i),t.destroy.on((function(){t.loadSource.off(r),t.removeSource.off(n),t.updateSource.off(i)}))}}]),e}(),qj=function(){function e(){sF(this,e)}return dF(e,[{key:"apply",value:function(e){e.tag=new Bj,this.listenSpaceHooks(e),this.listenTagHooks(e)}},{key:"listenTagHooks",value:function(e){var t=e.tag.hooks,r=function(t){var r;GF(r=t.children).call(r,(function(r){var n=e.statusStore.get(r);n&&n.ownerFiles.remove(t.uid)})),e.hooks.removeDoc.emit(t)},n=function(t){e.hooks.renameDoc.emit(t)};t.beforeRemoveTag.on(r),t.afterRenameTag.on(n),t.destroy.on((function(){t.beforeRemoveTag.off(r),t.afterRenameTag.off(n)}))}},{key:"listenSpaceHooks",value:function(e){var t=e.hooks,r=function(t){var r=t.data,n=e.tag.defaultName;GF(r).call(r,(function(e){var t;(e.tags||(e.tags=[]),n)&&(TM(t=e.tags).call(t,n)<0&&e.tags.push(n))}))},n=function(t){var r=t.data;GF(r).call(r,(function(t){var r;null===(r=t.tags)||void 0===r||GF(r).call(r,(function(r){var n=e.tag.getTag(r);e.hooks.beforeBufferChanged.emit({uids:aF((null==n?void 0:n.children)||[]),operation:"add"}),e.tag.appendChildToTag(r,t.uid);var i=e.tag.getTag(r),o={docUid:i.uid,sourceUids:[t.uid],type:"tag"};e.hooks.loadToDoc.emit(o),e.hooks.afterBufferChanged.emit({docType:"tag",docName:r,docUid:null==i?void 0:i.uid,uids:aF((null==i?void 0:i.children)||[]),operation:"add"})}))}))},i=function(t){var r=t.removedUids,n={};GF(r).call(r,(function(t){var r,i,o=e.statusStore.get(t);o&&GF(r=fM(i=o.ownerTags.children).call(i)).call(r,(function(e){n[e]||(n[e]=[]),n[e].push(t)}))}));for(var i=0,o=fL(n);i<o.length;i++){var a=oF(o[i],2),s=a[0],u=a[1],c=e.tag.getTagByUid(s);c&&(e.hooks.beforeBufferChanged.emit({uids:aF(c.children),removedUids:aF(u),operation:"remove"}),e.tag.removeChildFromTag(c.name,u),e.hooks.afterBufferChanged.emit({docType:"tag",docName:c.name,docUid:s,uids:aF(c.children),removedUids:aF(u),operation:"remove"})),e.hooks.removeFromDoc.emit({docUid:s,sourceUids:u,type:"tag"})}},o=function(e){"tag"!==e.type&&i({removedUids:e.children})},a=function(t){var r=t.docUid,n=t.sourceUids;if("tag"===t.type){var i=e.tag.getTagByUid(r);i&&GF(n).call(n,function(){var t=cx(VF.mark((function r(t){var n,o;return VF.wrap((function(r){for(;;)switch(r.prev=r.next){case 0:return r.prev=0,r.next=3,e.store.get(t);case 3:if(o=r.sent,r.t0=o&&TM(n=o.tags).call(n,i.name)<0,!r.t0){r.next=9;break}return o.tags.push(i.name),r.next=9,e.store.update(t,o);case 9:r.next=14;break;case 11:r.prev=11,r.t1=r["catch"](0);case 14:case"end":return r.stop()}}),r,null,[[0,11]])})));return function(e){return t.apply(this,arguments)}}())}},s=function(t){var r=t.docUid,n=t.sourceUids;if("tag"===t.type){var i=e.tag.getTagByUid(r);i&&GF(n).call(n,function(){var t=cx(VF.mark((function r(t){var n,o,a,s;return VF.wrap((function(r){for(;;)switch(r.prev=r.next){case 0:return r.prev=0,r.next=3,e.store.get(t);case 3:if(!(n=r.sent)){r.next=9;break}return(s=TM(o=n.tags).call(o,i.name))>-1&&HM(a=n.tags).call(a,s,1),r.next=9,e.store.update(t,n);case 9:r.next=14;break;case 11:r.prev=11,r.t0=r["catch"](0);case 14:case"end":return r.stop()}}),r,null,[[0,11]])})));return function(e){return t.apply(this,arguments)}}())}},u=function(t){var r,n,i=e.statusStore.get(t.modifiedUid);i&&GF(r=fM(n=i.ownerTags.children).call(n)).call(r,(function(r){var n=e.tag.getTagByUid(r);n&&(e.hooks.beforeBufferChanged.emit({uids:aF(n.children),modifiedUid:t.modifiedUid,operation:"modify"}),e.hooks.afterBufferChanged.emit({docType:"tag",docName:n.name,docUid:r,uids:aF(n.children),modifiedUid:t.modifiedUid,operation:"modify"}))}))};t.beforeLoadSource.on(r),t.loadSource.on(n),t.removeSource.on(i),t.removeDoc.on(o),t.loadToDoc.on(a),t.removeFromDoc.on(s),t.updateSource.on(u),t.destroy.on((function(){t.beforeLoadSource.off(r),t.loadSource.off(n),t.removeSource.off(i),t.removeDoc.off(o),t.loadToDoc.off(a),t.removeFromDoc.off(s),t.updateSource.off(u)}))}}]),e}(),Yj=function(e){Zx(r,e);var t=vj(r);function r(){var e;return sF(this,r),fF(lx(e=t.call(this)),"uid",wj()),fF(lx(e),"hooks",{init:xj.create(),destroy:xj.create(),beforeLoadSource:xj.create(),loadSource:xj.create(),afterLoadSource:xj.create(),beforeRemoveSource:xj.create(),removeSource:xj.create(),afterRemoveSource:xj.create(),beforeUpdateSource:xj.create(),updateSource:xj.create(),afterUpdateSource:xj.create(),beforeBufferChanged:xj.create(),afterBufferChanged:xj.create(),directoryChanged:xj.create(),tagChanged:xj.create(),openDoc:xj.create(),loadToDoc:xj.create(),removeFromDoc:xj.create(),removeDoc:xj.create(),renameDoc:xj.create(),move:xj.create(),afterMove:xj.create(),"switch":xj.create(),afterSwitch:xj.create(),reorder:xj.create(),afterReorder:xj.create()}),fF(lx(e),"dir",void 0),fF(lx(e),"tag",void 0),fF(lx(e),"store",void 0),fF(lx(e),"customStore",void 0),fF(lx(e),"metadataStore",void 0),fF(lx(e),"statusStore",void 0),fF(lx(e),"defaultFile",void 0),fF(lx(e),"plugins",[]),fF(lx(e),"imageLoader",void 0),e.initPlugins(),e.hooks.init.emit(),e}return dF(r,[{key:"destroy",value:function(){this.hooks.destroy.emit()}},{key:"initPlugins",value:function(){(new Qj).apply(this),(new Jj).apply(this),(new Vj).apply(this),(new zj).apply(this),(new Uj).apply(this),(new Gj).apply(this),(new Hj).apply(this),(new qj).apply(this)}},{key:"setImageLoader",value:function(e){this.imageLoader=e}},{key:"getCustomData",value:function(e){return this.customStore.get(e)}},{key:"setCustomData",value:function(e,t){return this.customStore.set(e,t)}},{key:"getMetadata",value:function(e){return this.metadataStore.get(e)}},{key:"setMetadata",value:function(e,t){return this.metadataStore.set(e,t)}},{key:"createStore",value:function(e){var t=e.type,r=void 0===t?"sync":t,n=e.tableName,i=e.dbName;return"sync"===r?new Fj:i&&n?new Dj(i,n):null}},{key:"loadSource",value:function(e,t){if(yj(e))return[];var r=e.data;if(!_j(r))return[];var n=[];return GF(r).call(r,(function(e){e.uid=wj(),n.push(e.uid)})),Tj(t)&&t(n),this.hooks.beforeLoadSource.emit(e),this.hooks.loadSource.emit(e),this.hooks.afterLoadSource.emit(e),n}},{key:"removeSource",value:function(e){var t=!(arguments.length>1&&arguments[1]!==undefined)||arguments[1];Ij(e)&&(e=[e]);var r={removedUids:e,docUid:"",trigger:this.uid,operation:"remove"};return this.hooks.beforeRemoveSource.emit(r),this.hooks.removeSource.emit(r),t&&this.hooks.afterRemoveSource.emit(r),!0}},{key:"updateSource",value:function(e,t){var r={modifiedUid:e,data:t,revoke:!(arguments.length>2&&arguments[2]!==undefined)||arguments[2],operation:"modify"};return this.hooks.beforeUpdateSource.emit(r),this.hooks.updateSource.emit(r),this.hooks.afterUpdateSource.emit(r),!0}},{key:"getSource",value:function(e){return this.store.get(e)}},{key:"openDefault",value:function(e){var t={node:this.defaultFile,type:"default",config:e};this.hooks.openDoc.emit(t)}},{key:"createFile",value:function(e){return this.dir.createFile(e)}},{key:"removeFile",value:function(e){return this.dir.removeFile(e)}},{key:"renameFile",value:function(e,t){return this.dir.renameFile(e,t)}},{key:"openFile",value:function(e,t){var r=this.getFile(e);if(!r)return!1;var n={node:r,type:"file",config:t};return this.hooks.openDoc.emit(n),!0}},{key:"movePagesToFile",value:function(e,t,r,n){var i=this,o=this.getFile(e),a=this.getFile(r);if(!o||!a)return!1;for(var s=0;s<t.length;s++)if(t[s]<0||t[s]>=o.children.length)return!1;if(n<0)return!1;var u=ML(t).call(t,(function(e){return o.children[e]}));GF(u).call(u,(function(e){var t=i.statusStore.get(e);t&&t.ownerFiles.remove(o.uid)})),this.dir.removeChildFromFile(o.uid,u),this.hooks.removeFromDoc.emit({docUid:o.uid,sourceUids:u}),n>a.children.length&&(n=a.children.length);var c=this.dir.appendChildrenToFile(r,u,n),l={docUid:c.uid,sourceUids:u,type:"file",index:n,isSameDoc:e===r};return GF(u).call(u,(function(e){var t=i.statusStore.get(e);t&&t.ownerFiles.append(c.uid)})),this.hooks.loadToDoc.emit(l),!0}},{key:"getFile",value:function(e){return this.dir.getFile(e)}},{key:"getFileList",value:function(){return this.dir.getCurrentFileList()}},{key:"isFileExisted",value:function(e){return this.dir.isFileExist(e)}},{key:"createTag",value:function(e){return this.tag.createTag(e)}},{key:"removeTag",value:function(e){for(var t=this.getTag(e).children||[],r=0;r<t.length;r++)this.store.get(t[r]).then((function(t){var r,n,i=TM(r=(null==t?void 0:t.tags)||[]).call(r,e);-1!==i&&HM(n=t.tags).call(n,i,1)}));return this.tag.removeTag(e)}},{key:"renameTag",value:function(e,t){var r=this.getTag(e).children||[],n=this.tag.renameTag(e,t);if(n)for(var i=0;i<r.length;i++)this.store.get(r[i]).then((function(r){var n,i,o=TM(n=(null==r?void 0:r.tags)||[]).call(n,e);-1!==o&&HM(i=r.tags).call(i,o,1,t)}));return n}},{key:"openTag",value:function(e,t){var r=this.getTag(e);if(!r)return!1;var n={node:r,type:"tag",config:t};return this.hooks.openDoc.emit(n),!0}},{key:"getTag",value:function(e){return this.tag.getTag(e)}},{key:"getTagList",value:function(){return this.tag.getTagList()}},{key:"setDefaultTag",value:function(e){return this.tag.setDefaultTag(e)}},{key:"getDefaultTag",value:function(){return this.tag.getDefaultTag()}},{key:"isTagExisted",value:function(e){return this.tag.isTagExisted(e)}},{key:"addTagToSource",value:function(e,t){if(this.statusStore.get(e)){Ij(t)&&(t=[t]);for(var r=0;r<t.length;r++)if(!this.addSourceToTag(t[r],e))return!1;return!0}return!1}},{key:"removeTagFromSource",value:function(e,t){if(this.statusStore.get(e)){var r;yj(t)?t=ML(r=this.tag.tags).call(r,(function(e){return e.name})):Ij(t)&&(t=[t]);for(var n=0;n<t.length;n++)if(!this.removeSourceFromTag(t[n],e))return!1;return!0}return!1}},{key:"addSourceToTag",value:function(e,t){var r=this.tag.getTag(e);if(r&&this.tag.appendChildToTag(e,t)){Ij(t)&&(t=[t]);for(var n=0;n<t.length;n++)this.store.get(t[n]).then((function(t){var r;oB(r=t.tags).call(r,e)||t.tags.push(e)}));var i={sourceUids:t,docUid:r.uid,type:"tag"};return this.hooks.loadToDoc.emit(i),!0}return!1}},{key:"removeSourceFromTag",value:function(e,t){var r=this.tag.getTag(e);if(r){this.tag.removeChildFromTag(e,t),Ij(t)&&(t=[t]);for(var n=0;n<t.length;n++)this.store.get(t[n]).then((function(t){var r,n,i=TM(r=(null==t?void 0:t.tags)||[]).call(r,e);-1!==i&&HM(n=t.tags).call(n,i,1)}));var i={docUid:r.uid,sourceUids:t,type:"tag"};return this.hooks.removeFromDoc.emit(i),!0}return!1}},{key:"getSourceTags",value:function(e){var t,r=this,n=this.statusStore.get(e);return n?ML(t=n.ownerTags.children).call(t,(function(e){return r.tag.getTagByUid(e).name})):[]}},{key:"switch",value:function(e){var t=e.one,r=e.other,n=e.type,i=e.docUid,o=e.emit,a=this.getDocNode(i,n);if(a){if(a["switch"](t,r),o||yj(o)){var s={one:t,other:r,docUid:i,type:a.type,trigger:this.uid,operation:"shift"};this.hooks["switch"].emit(s)}return!0}return!1}},{key:"move",value:function(e){var t=e.from,r=e.to,n=e.type,i=e.docUid,o=e.emit,a=this.getDocNode(i,n);if(a){if(a.move(t,r),o||yj(o)){var s={from:t,to:r,docUid:i,type:a.type,trigger:this.uid,operation:"shift"};this.hooks.move.emit(s)}return!0}return!1}},{key:"reorder",value:function(e){var t=e.indexes,r=e.type,n=e.docUid,i=e.emit,o=this.getDocNode(n,r);if(o&&(o.reorder(t),i||yj(i))){var a={indexes:t,docUid:n,type:o.type,trigger:this.uid,operation:"shift"};this.hooks.move.emit(a)}}},{key:"getDocNode",value:function(e,t){switch(t){case"default":return this.defaultFile;case"file":return this.dir.getFileByUid(e);case"tag":return this.tag.getTagByUid(e);default:return e===this.defaultFile.uid?this.defaultFile:this.tag.getTagByUid(e)||(this.dir.getFileByUid(e)||null)}}}]),r}(kj),Xj={Successful:{errorCode:0,errorString:"Successful."},InvalidIndex:{errorCode:-1033,errorString:"Invalid index."},InvalidValue:{errorCode:-1034,errorString:"Invalid value."},NoImage:{errorCode:-1035,errorString:"There is no image."},UnBindViewer:{errorCode:-2210,errorString:"You cannot call this method on this WebTwain instance because it does not use the default viewer."},AlReadyBindViewer:{errorCode:-2211,errorString:"The element is already bound to the viewer."},ParameterCannotEmpty:{errorCode:-2314,errorString:"The parameter cannot be empty."},IndicesNotArray:{errorCode:-2358,errorString:"The type of the parameter indices must be an Array."},IndexOutOfRange:{errorCode:-2359,errorString:"The index is out of range."},InvalidTagName:{errorCode:-2394,errorString:"Invalid tag name."},InvalidLeftOrTopOrRightOrBottom:{errorCode:-2417,errorString:"The left or top or right or bottom you entered is invalid."},InvalidWidth:{errorCode:-2418,errorString:"The width you entered is invalid."},InvalidHeight:{errorCode:-2419,errorString:"The height you entered is invalid."},WidthOrHeightOutOfImageSize:{errorCode:-2420,errorString:"The width or height is out of image size."},MobileServer_InvalidIndex:{errorCode:-2423,errorString:"The index is invalid."},ImageEditorExist:{errorCode:-2500,errorString:"An ImageEditor already exists."},ThumbnailViewerExist:{errorCode:-2501,errorString:"A ThumbnailViewer already exists."},CustomElementExist:{errorCode:-2502,errorString:"A CustomElement already exists."},ImageEditorDispose:{errorCode:-2504,errorString:"The ImageEditor object has been disposed."},ThumbnailViewerNotExist:{errorCode:-2505,errorString:"This ThumbnailViewer doesn't exist."},ThumbnailViewerDispose:{errorCode:-2506,errorString:"The ThumbnailViewer object has been disposed."},CallbackNotAFunction:{errorCode:-2510,errorString:"The callback is not a function."},ElementRequired:{errorCode:-2511,errorString:"Parameter 'element' is required."},ElementNotExist:{errorCode:-2512,errorString:"Parameter 'element' doesn't instanceof HTMLDivElement."},InvalidPropertyValue:{errorCode:-2514,errorString:"Invalid property value."},CursorInvalidMode:{errorCode:-2519,errorString:"The current mode does not support setting the cursor to zoom."},OldTagNameRequired:{errorCode:-2517,errorString:"Old tag name is required."},NewTagNameRequired:{errorCode:-2518,errorString:"New tag name is required."},FileNameCannotEmpty:{errorCode:-2530,errorString:"Document name cannot be empty."},FileNameNotString:{errorCode:-2531,errorString:"Document name is not a string."},FileNotExist:{errorCode:-2540,errorString:"The document does not exist."},FileExist:{errorCode:-2541,errorString:"The document already exists."},CustomElementDispose:{errorCode:-2508,errorString:"The CustomElement object has been disposed."},CustomElementNotExist:{errorCode:-2507,errorString:"This CustomElement doesn't exist."},ParameterOutRange:{errorCode:80002,errorString:"The parameter is out of range."},TagNotExist:{errorCode:80009,errorString:"Tag does not exist."},TagExist:{errorCode:80010,errorString:"The tag already exists."},OperationError:{errorCode:80022,errorString:"The operation mode is wrong."}};(Mj=Oj||(Oj={}))[Mj.Normal=0]="Normal",Mj[Mj.Balance=1]="Balance";var Zj=function(){function e(t){var r=this;sF(this,e),fF(this,"space",void 0),fF(this,"webViewer",void 0),fF(this,"isActiveFile",!1),fF(this,"isActiveTag",!1),fF(this,"currentFileName",""),fF(this,"currentTagName",""),fF(this,"bufferConfig",null),fF(this,"currentSelected",[]),fF(this,"lastCurrentSelected",[]),this.space=new Yj,t&&(this.bufferConfig=t),this.space.on("bufferChanged",(function(e,t){var n;if(!r.webViewer&&Tj(null===(n=r.bufferConfig)||void 0===n?void 0:n.bufferChanged)){var i,o,a,s,u,c,l=[],d=[],f=r.getCurrentDataSet().children;GF(i=r.currentSelected).call(i,(function(e){f&&f[e]&&l.push(f[e])})),GF(o=r.lastCurrentSelected).call(o,(function(e){f&&f[e]&&d.push(f[e])}));var h={afterStatus:{uids:e.afterStatus.uids,selectedUids:l,modifiedUid:(null==e||null===(a=e.afterStatus)||void 0===a?void 0:a.modifiedUid)||"",removedUids:(null==e||null===(s=e.afterStatus)||void 0===s?void 0:s.removedUids)||[],currentUid:e.afterStatus.uids[e.afterStatus.uids.length-1]||""},beforeStatus:{uids:e.beforeStatus.uids,selectedUids:d,removedUids:(null==e||null===(u=e.beforeStatus)||void 0===u?void 0:u.removedUids)||[],modifiedUid:(null==e||null===(c=e.beforeStatus)||void 0===c?void 0:c.modifiedUid)||"",currentUid:e.beforeStatus.uids[e.beforeStatus.uids.length-1]||""},operation:e.operation,docUid:e.docUid,total:e.afterStatus.uids.length,curIndex:e.afterStatus.uids.length-1};r.lastCurrentSelected=aF(r.currentSelected),r.bufferConfig.bufferChanged(h,t)}}))}return dF(e,[{key:"e",value:function(){this.setError("Successful")}},{key:"IsFileNameExist",value:function(e){var t=this.space.getFileList();if("dynamsoft-default-document"===e)return!0;if(t)for(var r=0;r<t.length;r++)if(t[r].name===e)return!0;return!1}},{key:"getCurrentDataSet",value:function(){if(this.webViewer){var e=this.webViewer.myViewer.getCurrentTab();if(void 0===e)return!1;var t=e.type;this.isActiveFile="file"===t,this.isActiveTag="tag"===t}if(this.isActiveFile){var r=this.getCurrentFileName(),n=this.space.getFile(r);if(n)return n}if(this.isActiveTag){var i=this.space.getTag(this.currentTagName);if(i)return i}return!1}},{key:"setError",value:function(e){var t;if("Default"!==e){if(this.webViewer)this.webViewer.setError(e);else if(this.bufferConfig&&this.bufferConfig.viewerError){var r=Xj[e],n=r.errorCode,i=r.errorString;this.bufferConfig.viewerError.setError(n,i)}}else null==this||null===(t=this.webViewer)||void 0===t||t.setDefaultError()}},{key:"emitViewerEvent",value:function(){var e,t;this.webViewer&&0===this.getHowManyImagesInBuffer()&&(null===(e=this.webViewer)||void 0===e||null===(t=e.myViewer)||void 0===t||t.emit("pageRendered",-1))}},{key:"bindViewer",value:function(e){this.webViewer=e}},{key:"getCurrentTag",value:function(){return this.currentTagName}},{key:"getCurrentDocument",value:function(){return this.currentFileName}},{key:"getCurrentFileName",value:function(){var e=this,t=this.space.getFileList(),r="";return t&&GF(t).call(t,(function(t){t.name===e.currentFileName&&(r=e.currentFileName)})),r}},{key:"getCurrentIndex",value:function(){if(this.webViewer)return this.webViewer.getCurrentIndex();var e=this.getSelectedImagesIndices().length;if(e<=0){var t=this.getCurrentDataSet();return!!t&&t.children.length-1}return this.getSelectedImagesIndices()[e-1]}},{key:"getHowManyImagesInBuffer",value:function(){if(this.webViewer)return this.webViewer.getHowManyImagesInBuffer();var e=this.getCurrentDataSet();return e?e.children.length:0}},{key:"getSelectedImagesIndices",value:function(){return this.webViewer?this.webViewer.getSelectedImagesIndices():this.currentSelected}},{key:"getIndexByUid",value:function(e){if(!Ij(e)||!e)return this.setError("InvalidValue"),!1;if(this.webViewer)return this.webViewer.myViewer.getIndexByUid(e);var t=this.getCurrentDataSet(),r=t.children;return!!(t&&r&&_j(r))&&TM(r).call(r,e)}},{key:"getUidByIndex",value:function(e){if(e<0||e>=this.getHowManyImagesInBuffer())return this.setError("IndexOutOfRange"),!1;if(this.webViewer)return this.webViewer.myViewer.getUidByIndex(e);var t=this.getCurrentDataSet().children;return!(t&&t.length<e)&&t[e]}},{key:"getDataByUid",value:function(e){return this.space.getSource(e)}},{key:"updateDataByUid",value:function(e,t){return this.space.store.set(e,t)}},{key:"setCustomDataByUid",value:function(e,t){return Ij(e)&&""!==e?this.space.setCustomData(e,t):(this.setError("InvalidValue"),!1)}},{key:"getCustomDataByUid",value:function(e){return this.space.getCustomData(e)}},{key:"setMetadataByUid",value:function(e,t){return Ij(e)&&""!==e?this.space.setMetadata(e,t):(this.setError("InvalidValue"),!1)}},{key:"getMetadataByUid",value:function(e){return this.space.getMetadata(e)}},{key:"addImage",value:function(e,t,r){var n,i,o={},a=this.currentFileName,s="";!yj(r)&&Ij(r)?(this.IsFileNameExist(r)||this.createDocument(r),s=r):yj(a)||""===a?(this.space.isFileExisted("dynamsoft-default-document")||this.createDocument("dynamsoft-default-document"),this.webViewer&&(this.webViewer.bEmitBufferChanged=!1),this.openDocument("dynamsoft-default-document"),this.webViewer&&(this.webViewer.bEmitBufferChanged=!0),s="dynamsoft-default-document"):s=a,t&&(delete(i=pj({},t)).oriBlobData,t.oriBlobData&&(n=t.oriBlobData));var u=e.imageUrl,c=e.minImageUrl,l=e.imageId,d=e.serverId,f=e.uidFromServer,h=e.index;n&&(o=pj({},n)),l&&(o.imageId=l),d&&(o.serverId=d),f&&(o.uidFromServer=f);var g=this.getDocumentContents(s).length;!yj(h)&&bj(h)?h>=g&&(h=g):h=g,this.isActiveFile&&(this.currentSelected=[h]);var m=this.space.loadSource({data:[{oriData:u,minData:c,metadata:i,customData:o}],filename:s,index:h},(function(t){var r=oF(t,1)[0];e.uuid=r})),p=this.getHowManyImagesInBuffer();return this.isActiveTag&&(this.currentSelected=p>0?[p-1]:[]),m}},{key:"insertImage",value:function(e,t,r){var n;if(r&&r>=0)this.currentSelected=[r],n=this.space.loadSource({data:[e],filename:t,index:r});else{n=this.space.loadSource({data:[e],filename:t});var i=this.getHowManyImagesInBuffer();this.currentSelected=i>0?[i-1]:[]}return n[0]}},{key:"updateImage",value:function(e,t){var r=e.imageUrl,n=e.minImageUrl,i=e.imageId,o=e.serverId,a=e.uidFromServer,s=e.uuid,u=pj({},t);return s&&""!==s&&-1!==s?(this.space.updateSource(s,{oriData:r,minData:n,metadata:u,customData:{imageId:i,serverId:o,uidFromServer:a}}),s):(this.setError("IndexOutOfRange"),!1)}},{key:"removeImageByUid",value:function(e){if(this.e(),this.webViewer){var t=this.webViewer.removePageByUid(e);return this.webViewer.resized(),this.emitViewerEvent(),t}return this.space.removeSource(e)}},{key:"removeImageByIndex",value:function(e){if(this.e(),e<0||e>=this.getHowManyImagesInBuffer())return this.setError("IndexOutOfRange"),!1;var t=this.getCurrentIndex(),r=!1;if(this.currentSelected=e===t&&0===e?this.getHowManyImagesInBuffer()>0?[0]:[]:e<=t?[t-1]:[t],this.webViewer)r=this.webViewer.removePageByIndexes(e),this.webViewer.resized(),this.emitViewerEvent();else{var n=this.getCurrentDataSet();if(!n)return!1;r=this.space.removeSource(n.children[e])}return r||this.setError("Default"),r}},{key:"removeSelectedImages",value:function(e){this.e();var t=this.getSelectedImagesIndices();_j(e)&&e.length>0&&(t=e);var r=!1;if(this.webViewer)r=this.webViewer.removePageByIndexes(t),this.webViewer.resized(),this.emitViewerEvent();else{var n=[],i=this.getCurrentDataSet();if(!i)return!1;GF(t).call(t,(function(e){i.children[e]&&i.children[e]&&n.push(i.children[e])})),r=this.space.removeSource(n)}r||this.setError("Default");var o=this.getHowManyImagesInBuffer();return this.currentSelected=o>0?[o-1]:[],r}},{key:"removeImageByIndexArr",value:function(e){if(this.e(),!_j(e))return!1;var t=this.getCurrentDataSet();if(!t)return!1;var r,n=[];GF(e).call(e,(function(e){var r=t.children[e];r&&n.push(r)})),(r=this.space.removeSource(n))||this.setError("Default"),this.webViewer&&(this.webViewer.resized(),this.emitViewerEvent());var i=this.getHowManyImagesInBuffer();return this.currentSelected=i>0?[i-1]:[],r}},{key:"removeAllImages",value:function(){this.e();var e=!1;if(this.currentSelected=[],this.webViewer)e=this.webViewer.removeAllPages(),this.webViewer.resized(),this.emitViewerEvent();else{var t=this.getCurrentDataSet();t&&(e=this.space.removeSource(aF(t.children)))}return e||this.setError("Default"),e}},{key:"tagImages",value:function(e,t){this.e();var r=this.getHowManyImagesInBuffer();if(!_j(e))return this.setError("IndicesNotArray"),!1;if(!Ij(t)||""===t)return this.setError("InvalidTagName"),!1;for(var n=0;n<r;n++){var i=e[n];if(JF(i)||i<0||i>=r)return this.setError("IndexOutOfRange"),!1}this.space.createTag(t);for(var o=0;o<e.length;o++){var a=e[o];if(a>=0){var s=this.getUidByIndex(a);s&&""!==s&&-1!==kB(s,10)&&this.space.addTagToSource(s,t)}}return!0}},{key:"removeImageTag",value:function(e,t){if(this.e(),!bj(e))return this.setError("InvalidValue"),!1;if(e<0||e>this.getHowManyImagesInBuffer())return this.setError("IndexOutOfRange"),!1;var r=this.getUidByIndex(e),n=!1;return r&&""!==r&&-1!==r&&(n=this.space.removeTagFromSource(r,t)),n||this.setError("Default"),n}},{key:"getDefaultTag",value:function(){return this.space.getDefaultTag()}},{key:"setDefaultTag",value:function(e){if(this.e(),!Ij(e))return this.setError("InvalidValue"),!1;if(""===e)return this.space.setDefaultTag(null),!0;var t;return this.space.createTag(e),(t=this.space.setDefaultTag(e))||this.setError("Default"),t}},{key:"removeTag",value:function(e,t){var r=this;if(this.e(),!Ij(e))return this.setError("InvalidValue"),!1;if(!yj(t)&&!_j(t))return this.setError("IndicesNotArray"),!1;if(!this.space.isTagExisted(e))return this.setError("TagNotExist"),!1;var n=this.currentTagName,i=!1,o=!1;if(n&&(i=n===e),yj(t))o=this.space.removeTag(e),i&&this.clearFilter();else{var a=[];GF(t).call(t,(function(e){var t=r.getUidByIndex(e);-1!==t&&a.push(t)}));for(var s=0;s<(null==a?void 0:a.length);s++)if(!(o=this.space.removeTagFromSource(a[s],e)))return!1}return o||this.webViewer.setDefaultError(),o}},{key:"renameTag",value:function(e,t){if(this.e(),yj(e)||""===e)return this.setError("OldTagNameRequired"),!1;if(yj(t)||""===t)return this.setError("NewTagNameRequired"),!1;if(!this.space.isTagExisted(e))return this.setError("TagNotExist"),!1;if(this.space.isTagExisted(t))return this.setError("TagExist"),!1;var r;return e===this.currentTagName&&(this.currentTagName=t),(r=this.space.renameTag(e,t))?this.space.setDefaultTag(t):this.setError("Default"),r}},{key:"getTagContents",value:function(e){return this.e(),e&&Ij(e)&&""!==e?this.space.getTag(e).children:[]}},{key:"getTagList",value:function(){var e=this;this.e();var t=this.space.getTagList(),r=[];return t?GF(t).call(t,(function(t){var n,i=[];GF(n=t.children).call(n,(function(t){var r=e.getCustomDataByUid(t);if(r){var n=r.uidFromServer;i.push(n)}})),r.push({name:t.name,imageIds:i})})):r=[],r}},{key:"getTagListByIndex",value:function(e){if(!bj(e))return!1;var t=this.getUidByIndex(e);return this.space.getSourceTags(t)}},{key:"clearFilter",value:function(){this.e(),this.currentTagName="";var e,t=this.getCurrentFileName();return""===t&&(t="dynamsoft-default-document"),(e=this.openDocument(t))||this.setError("Default"),e}},{key:"filterImagesByTag",value:function(e,t,r){this.e();var n=!1;if(yj(e)||null===e||""===e){this.currentTagName="";var i=this.getCurrentFileName();""===i&&(i="dynamsoft-default-document"),(n=this.openDocument(i))?Tj(t)&&t():(this.setError("Default"),Tj(r)&&r())}else{var o,a;if(!this.space.isTagExisted(e))return this.setError("TagNotExist"),Tj(r)&&r(),!1;if(this.isActiveTag=!0,this.isActiveFile=!1,this.currentTagName=e,this.setDefaultTag(e),n=this.space.openTag(e,null==this||null===(o=this.webViewer)||void 0===o||null===(a=o.myViewer)||void 0===a?void 0:a.uid)){var s=this.space.getTag(e);if(s){var u,c=(null==s||null===(u=s.children)||void 0===u?void 0:u.length)||0;this.currentSelected=c>0?[c-1]:[]}Tj(t)&&t()}else this.setError("Default"),Tj(r)&&r()}return this.webViewer&&this.webViewer.render(),n}},{key:"createDocument",value:function(e){if(this.e(),!e||""===e){var t=bj(e)?"FileNameNotString":"FileNameCannotEmpty";return this.setError(t),!1}return Ij(e)?this.space.isFileExisted(e)?(this.setError("FileExist"),!1):!!this.space.createFile(e)||(this.setError("Default"),!1):(this.setError("FileNameNotString"),!1)}},{key:"openDocument",value:function(e,t){var r,n;if(this.e(),!e||""===e){var i=bj(e)?"FileNameNotString":"FileNameCannotEmpty";return this.setError(i),!1}if(!Ij(e))return this.setError("FileNameNotString"),!1;if(!this.space.isFileExisted(e))return this.setError("FileNotExist"),!1;var o=t&&""!==t?t:null==this||null===(r=this.webViewer)||void 0===r||null===(n=r.myViewer)||void 0===n?void 0:n.uid,a=this.space.getFile(e);if(a){var s,u=null==a||null===(s=a.children)||void 0===s?void 0:s.length;this.currentSelected=u>0?[u-1]:[]}return this.space.openFile(e,{viewerUid:o})?(this.currentFileName=e,this.isActiveFile=!0,this.isActiveTag=!1,!0):(this.setError("Default"),!1)}},{key:"getDocumentContents",value:function(e){return this.e(),e&&Ij(e)&&""!==e?this.space.getFile(e).children:[]}},{key:"renameDocument",value:function(e,t){return this.e(),Ij(e)&&Ij(t)?(e&&""!==e&&t&&""!==t||this.setError("FileNameCannotEmpty"),this.space.isFileExisted(e)?this.space.isFileExisted(t)?(this.setError("FileExist"),!1):this.space.renameFile(e,t)?(this.currentFileName===e&&(this.currentFileName=t),!0):(this.setError("Default"),!1):(this.setError("FileNotExist"),!1)):(this.setError("FileNameNotString"),!1)}},{key:"removeDocument",value:function(e){if(this.e(),!e||!Ij(e))return this.setError("FileNameNotString"),!1;if(!this.space.isFileExisted(e))return this.setError("FileNotExist"),!1;var t=this.space.removeFile(e);return t?(t&&this.webViewer&&this.webViewer.resized(),this.currentFileName===e&&(this.currentFileName=""),!0):(this.setError("Default"),!1)}},{key:"getDocumentInfoList",value:function(){var e=this;this.e();var t=this.space.getFileList(),r=[];return t?(GF(t).call(t,(function(t){if(t.children){for(var n=[],i=0;i<t.children.length;i++){var o=t.children[i],a=e.getCustomDataByUid(o);if(a){var s=a.uidFromServer;n.push(s)}}r.push({imageIds:n,name:t.name})}})),r):[]}},{key:"getDocumentInfo",value:function(e){this.e();var t=this.space.getFile(e);if(!t)return{imageIds:[],length:0};for(var r=[],n=0;n<t.children.length;n++){var i=t.children[n],o=this.getCustomDataByUid(i);if(o){var a=o.uidFromServer;r.push(a)}}return{imageIds:r,length:r.length}}},{key:"selectImages",value:function(e){this.e();var t=!0;if(!e||!_j(e))return!1;if(this.webViewer){var r=this.webViewer.getIfAutoScroll();!1===r&&this.webViewer.setIfAutoScroll(!0),t=this.webViewer.selectPages(e),!1===r&&this.webViewer.setIfAutoScroll(!1)}else{for(var n=this.getHowManyImagesInBuffer(),i=0;i<e.length;i++)if(!bj(e[i])||e[i]<0||e[i]>=n)return this.setError("ParameterOutRange"),!1;t=!0}return t?this.currentSelected=e:this.setError("Default"),t}},{key:"selectAllImages",value:function(){this.e();var e=!0;if(this.webViewer)e=this.webViewer.myViewer.selectAll(),this.currentSelected=this.webViewer.getSelectedImagesIndices();else{var t,r=this.getCurrentDataSet();this.currentSelected=AB(MB(t=new Array(r.children.length)).call(t))}return e||this.setError("Default"),e}},{key:"moveImage",value:function(e,t){this.e();var r=kB(e,10),n=kB(t,10);if(JF(e)||JF(t))return this.setError("InvalidIndex"),!1;var i=this.getHowManyImagesInBuffer();if(r<0||r>=i||n<0||n>i)return this.setError("IndexOutOfRange"),!1;var o=!1;if(this.webViewer)o=this.webViewer.myViewer.movePage(e,t);else{var a=this.getCurrentDataSet();if(!a)return!1;a.children.length>t&&(this.currentSelected=[t]),o=this.space.move({docUid:a.uid,type:a.type,from:e,to:t})}return o||this.setError("Default"),o}},{key:"switchImage",value:function(e,t){this.e();var r=kB(e,10),n=kB(t,10);if(JF(e)||JF(t))return this.setError("InvalidIndex"),!1;var i=this.getHowManyImagesInBuffer(),o=this.getCurrentIndex();if(r<0||r>=i||n<0||n>i)return this.setError("IndexOutOfRange"),!1;var a=!1;if(this.webViewer)a=this.webViewer.myViewer.switchPage(e,t);else{var s=this.getCurrentDataSet();if(!s)return!1;a=this.space["switch"]({docUid:s.uid,type:s.type,one:e,other:t})}a||this.setError("Default");var u=o;return r===o?u=n:n===o&&(u=r),this.currentSelected=[u],a}},{key:"moveImageToFile",value:function(e,t,r,n){if(!this.space.isFileExisted(e)||!this.space.isFileExisted(r))return this.setError("FileNotExist"),!1;t=aF(new hj(t));var i=this.getDocumentInfo(e).length;if(!_j(t)||t.length>i)return this.setError("ParameterOutRange"),!1;var o=this.getDocumentInfo(r).length,a=this.space.movePagesToFile(e,t,r,n);if(!this.webViewer&&this.isActiveFile){var s=this.getHowManyImagesInBuffer();e===this.currentFileName&&(this.currentSelected=s>0?[s-1]:[]),r===this.currentFileName&&(bj(n)&&n<o&&n>=0?this.currentSelected=[n+t.length-1]:this.currentSelected=s>0?[s-1]:[])}return a}}]),e}();HTMLCanvasElement.prototype.toBlob||gj(HTMLCanvasElement.prototype,"toBlob",{value:function(e,t,r){for(var n=atob(this.toDataURL(t,r).split(",")[1]),i=n.length,o=new Uint8Array(i),a=0;a<i;a++)o[a]=n.charCodeAt(a);e(new Blob([o],{type:t||"image/png"}))}});var $j=function(e){function t(e){var r;if(o(this,t),r=i(this,t),e)r._baseUrl=e._baseUrl,r._buffer=e._buffer,r._serverIdMap=e._serverIdMap,r._uidMap=e._uidMap;else{var n=r,a={bufferChanged:function(e,t){n.fire("bufferChanged",[e,t])},viewerError:{setError:function(e,t){n._error={code:e,message:t},n.fire("error",n._error)}}};r._baseUrl="",r._buffer=new Zj(a),r._serverIdMap={},r._uidMap={}}return r}return f(t,e),s(t,[{key:"getError",value:function(){return this._error}},{key:"BaseUrl",get:function(){return this._baseUrl}},{key:"getImageUrl",value:function(e){var t=this.convertClientIndexToServerId(e),r=Date.now();return pl.getImageUrl(this._baseUrl,t,-1,-1,r)}},{key:"getMinImageUrl",value:function(e,t,r){var n=this.convertClientIndexToServerId(e),i=Date.now();return n&&t&&r?pl.getImageUrl(this._baseUrl,n,parseInt(t),parseInt(r),i):""}},{key:"append",value:function(e,t,r,n,i){var o,a,s,u,c=Date.now(),l=t,d=r;if(o={imageId:l,serverId:t,uidFromServer:d,imageUrl:s=pl.getImageUrl(this._baseUrl,l,-1,-1,c),minImageUrl:a=n&&n.controlWidth&&n.controlWidth>0&&n.controlHeight&&n.controlHeight>0?rr.navInfoSync.bMobile?pl.getImageUrl(this._baseUrl,l,Math.round(n.controlWidth*devicePixelRatio),Math.round(n.controlHeight*devicePixelRatio),c):pl.getImageUrl(this._baseUrl,l,parseInt(n.controlWidth),parseInt(n.controlHeight),c):s},u=n.currentFileName.length>0?this._buffer.addImage(o,n,n.currentFileName):this._buffer.addImage(o,n)){var f=p(u,1)[0],h=this._buffer.getCustomDataByUid(f);return h.serverId=l,h.uidFromServer=d,this._innerInsertModel(l,d,f,s,a),f}return!1}},{key:"insertBefore",value:function(e,t,r,n,i){var o,a,s,u=Date.now(),c=r,l=n;o={index:e,imageId:c,serverId:c,uidFromServer:l,imageUrl:s=pl.getImageUrl(this._baseUrl,c,-1,-1,u),minImageUrl:a=i&&i.controlWidth&&i.controlWidth>0&&i.controlHeight&&i.controlHeight>0?rr.navInfoSync.bMobile?pl.getImageUrl(this._baseUrl,c,Math.round(i.controlWidth*devicePixelRatio),Math.round(i.controlHeight*devicePixelRatio),u):pl.getImageUrl(this._baseUrl,c,parseInt(i.controlWidth),parseInt(i.controlHeight),u):s};var d=this._buffer.addImage(o);if(d){var f=p(d,1)[0],h=this._buffer.getCustomDataByUid(f);return h.serverId=c,h.uidFromServer=l,this._innerInsertModel(c,l,f,s,a),this._buffer.openDocument(this.getCurrentFileName()),f}return!1}},{key:"_innerInsertModel",value:function(e,t,r,n,i){var o=new Pf;o.serverId=e,o.uidFromServer=t,o.uuid=r,o.imageUrl=n,o.minImageUrl=i,this._serverIdMap[e]=o,this._uidMap[t]=o}},{key:"refresh",value:function(e,t,r,n){var i=1*e;if(r){var o=this.count();if(i<0||i>o)return!1;this._setDataImageControl(i,n)}return!0}},{key:"refreshByImageId",value:function(e,t,r){var n=e;return t&&this._setDataImageControl(n,r,!0),!0}},{key:"_setDataImageControl",value:function(e,t,r){var n,i,o,a,s,u,c=this,l=c._baseUrl;if(r)s=e;else if(s=(a=c.getCustomDataByIndex(e)).serverId,u=a.uidFromServer,s<=0)return!1;if((n=c.getImageIdMap(s))||((n=new Pf).serverId=s,n.uidFromServer=u,c._serverIdMap[s]=n,c._uidMap[u]=n),l){null!=n&&(n.ticks=Date.now()),i=pl.getImageUrl(l,s,-1,-1,n.ticks),o=t&&t.controlWidth&&t.controlWidth>0&&t.controlHeight&&t.controlHeight>0?rr.navInfoSync.bMobile?pl.getImageUrl(l,s,Math.round(t.controlWidth*devicePixelRatio),Math.round(t.controlHeight*devicePixelRatio),n.ticks):pl.getImageUrl(l,s,parseInt(t.controlWidth),parseInt(t.controlHeight),n.ticks):i,n.imageUrl=i,n.minImageUrl=o,t&&(t.height&&(n.height=t.height),t.width&&(n.width=t.width));var d=Zt.clone(n);d.imageId=s,c._buffer.updateImage(d,t)}return!0}},{key:"convertIndicesToServerIds",value:function(e){var t,r=e.length,n=[];for(t=0;t<r;t++){var i=this.convertClientIndexToServerId(e[t]);-1!=i&&n.push(i)}return n}},{key:"removeImagesByServerId",value:function(e,t){var r=this,n=null!=t?t:this._buffer.getCurrentDocument(),i=[];return Zt.each(e,(function(e,t){var o=parseInt(e);r._removeMapModelImageControlByServerId(o);var a=-1;return a=r._buffer.isActiveFile?r._convertServerIdToIndexInFile(n,o):r._convertServerIdToIndex(o),!isNaN(a)&&(!(a<0||a>=r.count())&&void i.push(a))})),i.length>0&&r._buffer.removeImageByIndexArr(i)}},{key:"removeByServerId",value:function(e,t,r){var n=this,i=null!=r?r:this._buffer.getCurrentDocument();n._removeMapModelImageControlByServerId(e);var o=-1;return o=this._buffer.isActiveFile?this._convertServerIdToIndexInFile(i,e):t,!isNaN(o)&&(!(o<0||o>=n.count())&&n._buffer.removeImageByIndex(o))}},{key:"exists",value:function(e){if(this._serverIdMap[e])return!0;var t=-1;if(this._buffer.isActiveFile){var r=this.getCurrentFileName();t=this._convertServerIdToIndexInFile(r,e)}else t=this._convertServerIdToIndex(e);return t>-1}},{key:"removeImages",value:function(e){var t,r,n;for(n=e.length,t=0;t<n;t++)r=this.convertClientIndexToServerId(e[t]),this._removeMapModelImageControlByServerId(r);return this._buffer.removeSelectedImages(e)}},{key:"clear",value:function(){var e,t,r,n=this;for(r=n.count(),e=0;e<r;e++)t=n.convertClientIndexToServerId(e),this._removeMapModelImageControlByServerId(t);return r==Object.keys(n._serverIdMap).length&&(n._serverIdMap={},n._uidMap={}),n._buffer.removeAllImages()}},{key:"_uidFromServer2index",value:function(e){var t,r,n,i=this;if((n=i._uidMap[e])&&(r=n.uuid),r&&-1!=r)t=i._buffer.getIndexByUid(r);else if(i._buffer.isActiveFile){var o=this.getCurrentFileName();t=this._convertUidFromServerToIndexInFile(o,e)}else t=this._convertUidFromServerToIndex(e);return Zt.isNumber(t)||(t=-1),t}},{key:"_serverId2uidFromServer",value:function(e){if(e&&e>0){var t,r,n;if((n=this._serverIdMap[e])&&(r=n.uidFromServer))return r;if((t=this.convertServerIdToClientIndex(e))>=0)return this._index2uidFromServer(t)}return-1}},{key:"_uidFromServer2ServerId",value:function(e){if(e){var t,r,n;if((n=this._uidMap[e])&&(r=n.serverId))return r;if((t=this._uidFromServer2index(e))>=0)return this.convertClientIndexToServerId(t)}return-1}},{key:"_index2uidFromServer",value:function(e){var t=this.getCustomDataByIndex(e);return t?t.uidFromServer:-1}},{key:"convertServerIdToClientIndex",value:function(e){var t,r,n,i=this;if((n=i._serverIdMap[e])&&(r=n.uuid),r&&-1!=r)t=i._buffer.getIndexByUid(r);else if(i._buffer.isActiveFile){var o=this.getCurrentFileName();t=this._convertServerIdToIndexInFile(o,e)}else t=this._convertServerIdToIndex(e);return Zt.isNumber(t)||(t=-1),t}},{key:"getIndexByUid",value:function(e){var t;return!1===(t=this._buffer.getIndexByUid(e))?-1:t}},{key:"getUidByIndex",value:function(e){return this._buffer.getUidByIndex(e)}},{key:"convertClientIndexToServerId",value:function(e){var t=this.getCustomDataByIndex(e);return t?t.serverId:-1}},{key:"getCurrentImageIndex",value:function(){var e=this._buffer.getCurrentIndex();return Zt.isBoolean(e)?-1:e}},{key:"setCurrentImageIndex",value:function(e){return this._buffer.selectImages([e])}},{key:"getCurrentFileName",value:function(){return this._buffer.getCurrentFileName()}},{key:"setDefaultTag",value:function(e){return this._buffer.setDefaultTag(e)}},{key:"getDefaultTag",value:function(){return this._buffer.getDefaultTag()}},{key:"count",value:function(){return this._buffer.getHowManyImagesInBuffer()}},{key:"getCountByDocumentName",value:function(e){return this._buffer.getDocumentInfo(e).length}},{key:"dispose",value:function(){this.clear()}},{key:"getImageData",value:function(e){var t=this._buffer.getUidByIndex(e);return t?this._buffer.getDataByUid(t):Qt.Promise.resolve(null)}},{key:"getCustomDataByIndex",value:function(e){return this._buffer.getCustomDataByUid(this._buffer.getUidByIndex(e))}},{key:"getMetadataByIndex",value:function(e){return this._buffer.getMetadataByUid(this._buffer.getUidByIndex(e))}},{key:"setCustomData",value:function(e,t){var r=this._buffer.getUidByIndex(e);return!(!r||!t)&&this._buffer.setCustomDataByUid(r,t)}},{key:"openDocument",value:function(e){return this._buffer.openDocument(e)}},{key:"createDocument",value:function(e){return this._buffer.createDocument(e)}},{key:"getImageIdMap",value:function(e){return this._serverIdMap[e]}},{key:"_removeMapModelImageControlByServerId",value:function(e){var t=this;if(e>0&&t._serverIdMap[e]){var r=t._serverIdMap[e],n=r.uidFromServer;r.Clear(),delete t._serverIdMap[e],delete t._uidMap[n]}}},{key:"_convertServerIdToIndexInFile",value:function(e,t){var r,n,i=-1;for(r=this._buffer.getDocumentContents(e),n=0;n<r.length;n++){var o=r[n];if(o){var a=this._buffer.getCustomDataByUid(o);if(a&&a.serverId==t){i=n;break}}}return i}},{key:"_convertServerIdToIndex",value:function(e){var t,r=-1;for(t=0;t<this.count();t++){var n=this._buffer.getUidByIndex(t);if(n){var i=this._buffer.getCustomDataByUid(n);if(i&&i.serverId==e){r=t;break}}}return r}},{key:"_convertUidFromServerToIndexInFile",value:function(e,t){var r,n,i=-1;for(r=this._buffer.getDocumentContents(e),n=0;n<r.length;n++){var o=r[n];if(o){var a=this._buffer.getCustomDataByUid(o);if(a&&a.uidFromServer==t){i=n;break}}}return i}},{key:"_convertUidFromServerToIndex",value:function(e){var t,r=-1;for(t=0;t<this.count();t++){var n=this._buffer.getUidByIndex(t);if(n){var i=this._buffer.getCustomDataByUid(n);if(i&&i.uidFromServer==e){r=t;break}}}return r}},{key:"convertUUIDToServerId",value:function(e){var t=this._buffer.getCustomDataByUid(e);return t&&-1!=t.serverId?t.serverId:-1}},{key:"UpdateImage",value:function(e,t){return this._buffer.updateImage(e,t),!0}}],[{key:"_setBaseUrl",value:function(e,t){e._baseUrl=t}},{key:"_getBuffer",value:function(e){return e._buffer}}])}(Vc),eG=function(e){function t(e){var r;o(this,t);var n=r=i(this,t,[e]);r.__IfAppendImage=fi,r.__maxImagesInBuffer=32767,r.__insertingIndex=-1,r._aryBitmapCache=[],r._imageBufferWrapper=new $j,r._imageBufferWrapper.on("bufferChanged",(function(e){if(Zt.isFunction(n.__OnBufferChanged)){var t,r=e[0],i=[],o=-1,a=[];r.operation&&(r.action=r.operation);for(var s=0;s<n._imageBufferWrapper.count();s++)(t=n._imageBufferWrapper.getCustomDataByIndex(s))&&t.serverId&&i.push(n._imageBufferWrapper._serverId2uidFromServer(t.serverId));if(r.imageIds=i,r.curIndex>=0&&(t=n._imageBufferWrapper.getCustomDataByIndex(r.curIndex))&&t.serverId&&(o=n._imageBufferWrapper._serverId2uidFromServer(t.serverId)),r.currentId=o,"modify"==r.operation&&""!=r.afterStatus.modifiedUid){var u=n._imageBufferWrapper.getIndexByUid(r.afterStatus.modifiedUid);u>=0&&(t=n._imageBufferWrapper.getCustomDataByIndex(u))&&t.serverId&&(r.modifiedId=n._imageBufferWrapper._serverId2uidFromServer(t.serverId))}if(r.afterStatus.selectedUids)for(var c=0;c<r.afterStatus.selectedUids.length;c++){var l=r.afterStatus.selectedUids[c];if(l&&-1!=l){var d=n._imageBufferWrapper.getIndexByUid(r.afterStatus.selectedUids[c]);d>=0&&(t=n._imageBufferWrapper.getCustomDataByIndex(d))&&t.serverId&&a.push(n._imageBufferWrapper._serverId2uidFromServer(t.serverId))}}r.selectedIds=a,Zt.mix(r,{}),delete r.uids,delete r.currentUid,delete r.selectedUids,delete r.afterStatus,delete r.beforeStatus,delete r.operation,delete r.curIndex,delete r.docUid;try{return n.__OnBufferChanged(r)}catch(f){Ho(f)}}})),r._imageBufferWrapper.on("error",(function(e){n._errorCode=e.code,n._errorString=e.message}));var a=Zd.getServerImageUrlPrefix(r);return $j._setBaseUrl(r._imageBufferWrapper,a),r}return f(t,e),s(t,[{key:"_OnActiveUIClearBuffer",value:function(){var e=this.__OnBufferChanged;this.__OnBufferChanged=null,this._imageBufferWrapper.clear(),this.__OnBufferChanged=e}},{key:"_registerMultiEvent",value:function(e,t){var r=this;if(r._resetErr(),!r._isValid())return!1;var n=["_$",e].join("");r[n]||(r[n]={});var i=r[n],o=Zt.guid();return i[o]=t,o}},{key:"_unregisterMultiEvent",value:function(e,t){var r=this;if(r._resetErr(),!r._isValid())return!1;var n=["_$",e].join(""),i=r[n];if(t){var o;if(Zt.isString(t))return delete i[t],fi;if(Zt.isFunction(t))for(o=0;o<i.length;o++)if(t==i[o])return i.splice(o,1),fi}return r[n]=null,fi}},{key:"_getMetadata",value:function(e){return this._imageBufferWrapper.getMetadataByIndex(e)}},{key:"_updateImage",value:function(e,t,r){var n,i,o,a,s=xd.Auto,u=this;return r&&(undefined!=r.width&&(o=parseInt(r.width)),undefined!=r.height&&(a=parseInt(r.height)),s=Zt.isNumber(o)&&Zt.isNumber(a)&&t.byteLength===o*a*4?xd.RGBA:xd.Auto),n={imageId:e,serverId:e,bufferLen:t.byteLength,imageType:s},r&&s==xd.RGBA&&(n.width=o,n.height=a,undefined!=r.bitDepth&&(n.bit=r.bitDepth),undefined!=r.resolutionX&&(n.xres=parseInt(r.resolutionX)),undefined!=r.resolutionY&&(n.yres=parseInt(r.resolutionY)),undefined!=r.uid&&(n.uidFromServer=r.uid)),i=Zt.stringify([Zt.stringify(n)]),new Qt.Promise((function(e,r){u._innerSendBlobByWS("UpdateImage",i,t,(function(t){Zt.log("UpdateImage success."),e(t)}),(function(e){Zt.log("UpdateImage failed."),Zt.error(e),r({code:u._errorCode,message:u._errorString})}))}))}},{key:"_removeImages",value:function(e){return this._imageBufferWrapper.removeImages(e)}},{key:"_getCurrentDocumentName",value:function(){var e="";return this._imageBufferWrapper&&(e=this._imageBufferWrapper.getCurrentFileName()),e}},{key:"_getCurrentDefaultTagName",value:function(){var e="";return this._imageBufferWrapper&&(e=this._imageBufferWrapper.getDefaultTag()||""),e}},{key:"_innerRefreshUI",value:function(e,t,r,n,i){var o=this;return r&&o._imageBufferWrapper.refresh(e,o._imageBufferWrapper.count(),!0,n),Zt.isFunction(o.__OnRefreshUI)&&o.__OnRefreshUI(o._imageBufferWrapper.getCurrentImageIndex(),o._imageBufferWrapper.count()),!0}},{key:"_innerRefreshUIByImageId",value:function(e,t,r,n){var i=this;return t&&i._imageBufferWrapper.refreshByImageId(e,!0,r),Zt.isFunction(i.__OnRefreshUI)&&i.__OnRefreshUI(i._imageBufferWrapper.getCurrentImageIndex(),i._imageBufferWrapper.count()),!0}},{key:"_getHowManyImagesInBuffer",value:function(){return this._isValid()?this._imageBufferWrapper.count():0}},{key:"_OnBitmapChanged",value:function(e,t,r){var n,i,o,a=this,s="m1"==e[0],u="c1"==e[0],c="c2"==e[0],l=u||c||s,d=e[1].split(","),f=e[2],h=e[3],g=a.__maxImagesInBuffer,m=-1,p=!1,v=[];if(r&&(n=r.document,i=r.tag,r.bNeedClearTag&&(o=r.bNeedClearTag)),Zt.log("_OnBitmapChanged.currentFileName="+n+", tag="+i),n?n!=a._getCurrentDocumentName()&&(p=!0):n=a._getCurrentDocumentName(),a._imageBufferWrapper&&(i?(a._imageBufferWrapper.setDefaultTag(i),Zt.log("metaDataObj.currentTag="+i)):o&&(a._imageBufferWrapper.setDefaultTag(""),Zt.log("metaDataObj.currentTag=''"))),s);else if(c)e.length>5&&(v=e[5]),Zt.isArray(v)||(v=[]);else{var _={};if(e.length>5&&(_.width=e[5]),e.length>6&&(_.height=e[6]),e.length>7&&(_.bitDepth=e[7]),e.length>8&&(_.resolutionX=e[8]),e.length>9&&(_.resolutionY=e[9]),e.length>10&&(m=e[10]),e.length>11&&Zt.isString(e[11])&&(_.uidFromServer=e[11]),v.push(_),m>-1&&a._canConsume()&&(f==df.enumBCAppend||f==df.enumBCInsert)){var y=rr.DWT.lgct(m);Zt.isFunction(a.__OnLtsverify)&&a.__OnLtsverify(y,1)}}if(Zt.log("OnBitmapChanged:"+e),f==df.enumBCInsert||f==df.enumBCAppend&&!a.__IfAppendImage||r&&f==df.enumBCAppend&&r.index>=0)Zt.each(d,(function(e,t){var i,o,s=parseInt(e),u=a._imageBufferWrapper.getCurrentImageIndex();if(t<v.length&&v[t]?(i=(o=v[t]).uidFromServer,delete o.uidFromServer):o={},o.currentFileName=n,isNaN(s)||s<0)return!0;if(l)a._aryBitmapCache.push(s);else for(var c=0;c<a._aryBitmapCache.length;c++)if(a._aryBitmapCache[c]==s)return a._aryBitmapCache.splice(c,1),!0;if(a._imageBufferWrapper.exists(s))return!0;a.__insertingIndex>-1&&(u=a.__insertingIndex),o.controlWidth=400,o.controlHeight=400,a._controlWidth&&a._controlWidth>400&&(o.controlWidth=a._controlWidth),a._controlHeight&&a._controlHeight>400&&(o.controlHeight=a._controlHeight),-1==u&&(u=0),r.index>=0&&(u=r.index),a._imageBufferWrapper.insertBefore(u,g,s,i,o),a.__insertingIndex>-1&&(a.__insertingIndex=a.__insertingIndex+1),r.index++})),Zt.isFunction(a.__OnRefreshUI)&&a.__OnRefreshUI(a._imageBufferWrapper.getCurrentImageIndex(),a._imageBufferWrapper.count());else if(f==df.enumBCAppend&&a.__IfAppendImage)Zt.each(d,(function(e,t){var r,i,o=parseInt(e);if(isNaN(o)||o<0)return!0;if(t<v.length&&v[t]?(r=(i=v[t]).uidFromServer,delete i.uidFromServer):i={},i.currentFileName=n,Zt.log("metaDataObj.currentFileName="+n),l)a._aryBitmapCache.push(o);else for(var s=0;s<a._aryBitmapCache.length;s++)if(a._aryBitmapCache[s]==o)return a._aryBitmapCache.splice(s,1),!0;if(a._imageBufferWrapper.exists(o))return!0;i.controlWidth=400,i.controlHeight=400,a._controlWidth&&a._controlWidth>400&&(i.controlWidth=a._controlWidth),a._controlHeight&&a._controlHeight>400&&(i.controlHeight=a._controlHeight),p?a._imageBufferWrapper.append(g,o,r,i,n):a._imageBufferWrapper.append(g,o,r,i)})),Zt.isFunction(a.__OnRefreshUI)&&a.__OnRefreshUI(a._imageBufferWrapper.getCurrentImageIndex(),a._imageBufferWrapper.count());else if(f==df.enumBCRemove&&l){var S=!1;if(1==d.length&&-1==d[0]&&(S=!0),S)a._imageBufferWrapper.clear();else{var I=[];Zt.each(d,(function(e,t){var r=parseInt(e);if(isNaN(r)||r<0)return!0;I.push(r)})),a._imageBufferWrapper.removeImagesByServerId(I,n)}Zt.isFunction(a.__OnRefreshUI)&&a.__OnRefreshUI(a._imageBufferWrapper.getCurrentImageIndex(),a._imageBufferWrapper.count())}else if(f==df.enumBCEdit||f==df.enumBCUpdate)Zt.each(d,(function(e,t){var i,o=parseInt(e);if(isNaN(o)||o<0)return!0;if(t<v.length&&v[t]?delete(i=v[t]).uidFromServer:i={},i.currentFileName=n,o>=0&&!a.__bLoadingImage){var s=a._imageBufferWrapper.convertServerIdToClientIndex(o);s>-1?a._innerRefreshUI(s,a._imageBufferWrapper.count(),!0,i,f):r.bNeedRefresh&&a._innerRefreshUIByImageId(o,!0,i,f)}}));else if(f==df.enumBCIndexChange){var b;if(h>=0&&!a.__bLoadingImage)(b=0<v.length&&v[0]?v[0]:{}).currentFileName=n,0==a.__IfAppendImage&&a._innerRefreshUI(h,a._imageBufferWrapper.count(),!0,b,f),a._imageBufferWrapper.refresh(h,a._imageBufferWrapper.count(),!1,b)}if(Zt.isFunction(a.__OnBitmapChanged)){if(!s)if(l){if(f==df.enumBCRemove);else if(!de.bFirefox&&l)return!0}else{if(f==df.enumBCRemove)return!0;if(de.bFirefox&&!l)return!0}var T=[];Zt.each(d,(function(e){var t,r=parseInt(e);if(isNaN(r)||r<0)return!0;(t=a._imageBufferWrapper.convertServerIdToClientIndex(r))>-1&&T.push(t)}));var C=a._imageBufferWrapper.getCurrentImageIndex(),w=f;f==df.enumBCAppend&&(w=a.__IfAppendImage?df.enumBCAppend:df.enumBCInsert),a.__OnBitmapChanged(T,w,C,a._imageBufferWrapper.count())}}},{key:"_removeImageAsync",value:(a=n(g().mark((function u(e,t){var r,n,i;return g().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(r=this,n=parseInt(t),Cf(r,n)){e.next=4;break}return e.abrupt("return",!1);case 4:return i=r._imageBufferWrapper.convertClientIndexToServerId(n),e.next=7,r._removeImageByIdAsync(i);case 7:return e.abrupt("return",e.sent);case 8:case"end":return e.stop()}}),u,this)}))),function(e,t){return a.apply(this,arguments)})},{key:"_removeImageByIdAsync",value:(r=n(g().mark((function c(e){var t,r;return g().wrap((function(n){for(;;)switch(n.prev=n.next){case 0:if(t=this,-1!=e){n.next=4;break}return Ka(t),n.abrupt("return",!1);case 4:return n.next=6,t._innerFunV2("RemoveImage",Il(e));case 6:return((r=n.sent)||-1033==t._errorCode)&&t._OnBitmapChanged(["c1",""+e,3,t._imageBufferWrapper.getCurrentImageIndex(),t._imageBufferWrapper.count()]),n.abrupt("return",r);case 9:case"end":return n.stop()}}),c,this)}))),function(e){return r.apply(this,arguments)})}]);var r,a}(Zd),tG=function(e){return e.Text=0,e.Blob=1,e.ArrayBuffer=2,e.XML=3,e.JSON=4,e.UserDefined=5,e}({}),rG=function(e){return e.Other=0,e.HTTPUpload=1,e.HTTPDownload=2,e.FTPUpload=3,e.FTPDownload=4,e.Scan=5,e.LoadImage=6,e.ConvertToBlob=7,e.HTTPPut=8,e}({}),nG={not_string:/[^s]/,not_bool:/[^t]/,not_type:/[^T]/,not_primitive:/[^v]/,number:/[diefg]/,numeric_arg:/[bcdiefguxX]/,json:/[j]/,not_json:/[^j]/,text:/^[^\x25]+/,modulo:/^\x25{2}/,placeholder:/^\x25(?:([1-9]\d*)\$|\(([^)]+)\))?(\+)?(0|'[^$])?(-)?(\d+)?(?:\.(\d+))?([b-gijostTuvxX])/,key:/^([a-z_][a-z_\d]*)/i,key_access:/^\.([a-z_][a-z_\d]*)/i,index_access:/^\[(\d+)\]/,sign:/^[+-]/};function iG(e,t){if(Zt.isFunction("_".repeat))return e.repeat(t);for(var r=0,n=[];r<t;r++)n.push(e);return n.join("")}var oG=Object.create?Object.create(null):{};function aG(e,t,r,n){return function(e,t){var r,n,i,o,a,s,u,c,l,d=1,f=e.length,h="";for(n=0;n<f;n++)if("string"==typeof e[n])h+=e[n];else if("object"===_(e[n])){if((o=e[n]).keys)for(r=t[d],i=0;i<o.keys.length;i++){if(r==undefined)throw new Error(aG('[sprintf] Cannot access property "%s" of undefined value "%s"',o.keys[i],o.keys[i-1]));r=r[o.keys[i]]}else r=o.param_no?t[o.param_no]:t[d++];if(nG.not_type.test(o.type)&&nG.not_primitive.test(o.type)&&r instanceof Function&&(r=r()),nG.numeric_arg.test(o.type)&&"number"!=typeof r&&isNaN(r))throw new TypeError(aG("[sprintf] expecting number but found %T",r));switch(nG.number.test(o.type)&&(c=r>=0),o.type){case"b":r=parseInt(r,10).toString(2);break;case"c":r=String.fromCharCode(parseInt(r,10));break;case"d":case"i":r=parseInt(r,10);break;case"j":r=Zt.stringify(r,null,o.width?parseInt(o.width):0);break;case"e":r=o.precision?parseFloat(r).toExponential(o.precision):parseFloat(r).toExponential();break;case"f":r=o.precision?parseFloat(r).toFixed(o.precision):parseFloat(r);break;case"g":r=o.precision?String(Number(r.toPrecision(o.precision))):parseFloat(r);break;case"o":r=(parseInt(r,10)>>>0).toString(8);break;case"s":r=String(r),r=o.precision?r.substring(0,o.precision):r;break;case"t":r=String(!!r),r=o.precision?r.substring(0,o.precision):r;break;case"T":r=Object.prototype.toString.call(r).slice(8,-1).toLowerCase(),r=o.precision?r.substring(0,o.precision):r;break;case"u":r=parseInt(r,10)>>>0;break;case"v":r=r.valueOf(),r=o.precision?r.substring(0,o.precision):r;break;case"x":r=(parseInt(r,10)>>>0).toString(16);break;case"X":r=(parseInt(r,10)>>>0).toString(16).toUpperCase()}nG.json.test(o.type)?h+=r:(!nG.number.test(o.type)||c&&!o.sign?l="":(l=c?"+":"-",r=r.toString().replace(nG.sign,"")),s=o.pad_char?"0"===o.pad_char?"0":o.pad_char.charAt(1):" ",u=o.width-(l+r).length,a=o.width&&u>0?iG(s,u):"",h+=o.align?l+r+a:"0"===s?l+a+r:a+l+r)}return h}(function(e){if(oG[e])return oG[e];for(var t,r=e,n=[],i=0;r;){if(null!==(t=nG.text.exec(r)))n.push(t[0]);else if(null!==(t=nG.modulo.exec(r)))n.push("%");else{if(null===(t=nG.placeholder.exec(r)))throw new SyntaxError("[sprintf] unexpected placeholder");if(t[2]){i|=1;var o=[],a=t[2],s=[];if(null===(s=nG.key.exec(a)))throw new SyntaxError("[sprintf] failed to parse named argument key");for(o.push(s[1]);""!==(a=a.substring(s[0].length));)if(null!==(s=nG.key_access.exec(a)))o.push(s[1]);else{if(null===(s=nG.index_access.exec(a)))throw new SyntaxError("[sprintf] failed to parse named argument key");o.push(s[1])}t[2]=o}else i|=2;if(3===i)throw new Error("[sprintf] mixing positional and named placeholders is not (yet) supported");n.push({placeholder:t[0],param_no:t[1],keys:t[2],sign:t[3],pad_char:t[4],align:t[5],width:t[6],precision:t[7],type:t[8]})}r=r.substring(t[0].length)}return oG[e]=n,n}(e),arguments)}function sG(e,t){if(Zt.isString(e)){var r,n,i,o,a,s=e.indexOf("<%");if(-1==s)return e;if(n=e.substring(0,s),!(s+2<(r=e.indexOf(">",n))))return e;i=e.substring(s+1,r),o=e.substring(r+1);try{a=aG(i,t)}catch(jj){a=""}return[n,a,o].join("")}return""}function uG(e,t){var r,n=e.substring(e.lastIndexOf(".")).toLowerCase();if(t==rr.DWT.EnumDWT_ImageType.IT_BMP){if(".bmp"==n||".dib"==n)return e;r=[e,".bmp"].join("")}else if(t==rr.DWT.EnumDWT_ImageType.IT_JPG){if(".jpg"==n||".jpe"==n||".jpeg"==n||".jfif"==n)return e;r=[e,".jpg"].join("")}else if(t==rr.DWT.EnumDWT_ImageType.IT_PNG){if(".png"==n)return e;r=[e,".png"].join("")}else if(t==rr.DWT.EnumDWT_ImageType.IT_TIF){if(".tif"==n||".tiff"==n)return e;r=[e,".tif"].join("")}else if(t==rr.DWT.EnumDWT_ImageType.IT_PDF){if(".pdf"==n)return e;r=[e,".pdf"].join("")}else if(t==rr.DWT.EnumDWT_ImageType.IT_J2K){if(".jp2"==n)return e;r=[e,".jp2"].join("")}return r}function cG(e,t,r,n){var i,o,a,s,u=t.url,c=t.headers,l=t.retry,d=t.httpFormData,f=t.bOnlyResponseEmptyIsOK,h=t.bAsync,g=(o=t.responseType)==tG.Text?"text":o==tG.JSON?"json":o==tG.Blob?"blob":o==tG.ArrayBuffer?"arraybuffer":o==tG.XML?"xml":5==o?"user-defined":"text",m=e.IfShowProgressBar,p=e.IfShowCancelDialogWhenImageTransfer,v=e.objUploadStatus;(i=t.content)&&(i.remoteFilename||(i.remoteFilename=t.remoteFilename),i.fileName||(i.fileName=t.fileName||i.name),i.name||(i.name=t.fileName||i.fileName));var _,y=new ul({action:u,data:d,async:h,retry:l,bOnlyResponseEmptyIsOK:f,dataType:g});if(p&&Qt.progressContext&&(_=Qt.progressContext.on("cancel",(function(){y.abort(),y=null}))),(a=y._uploadType)&&(s=a.get("ajaxConfig"),c&&s&&s.headers&&c&&Zt.mix(s.headers,c),e.HTTPRequestswithCredentials&&Zt.mix(s.xhrFields,{withCredentials:!0}),s=null),y.on(ul.event.SUCCESS,(function(n){if(t.content=null,y=null,_&&Qt.progressContext.off("cancel",_),n?e.HTTPPostResponse=n.response:t.responseType==tG.ArrayBuffer?e.HTTPPostResponse=[]:t.responseType==tG.Blob?e.HTTPPostResponse=new Blob([]):t.responseType==tG.JSON?e.HTTPPostResponse={}:e.HTTPPostResponse="",Zt.isFunction(e.onHttpUploadStatus)){var i;i={fileName:n.name,percentage:100,statusCode:200,responseString:e.HTTPPostResponse},e.onHttpUploadStatus(i)}Zt.isFunction(r)&&r(e.HTTPPostResponse)})),y.on(ul.event.ERROR,(function(r){t.content=null,y=null;var i=r&&r.canceled;r&&r.timeout;var o="",a=0;_&&Qt.progressContext.off("cancel",_),r&&Zt.isString(r.response)?e.HTTPPostResponse=r.response:e.HTTPPostResponse="",i||(r&&r.msg&&(o=r.msg),r&&r.httpStatus&&(a=r.httpStatus));var s,u={};(xa(u,i,o,a),Zt.isFunction(e.onHttpUploadStatus))&&(s={fileName:r.name,percentage:100,statusCode:a,responseString:e.HTTPPostResponse},e.onHttpUploadStatus(s));Zt.isFunction(n)&&n(u._errorCode,u._errorString,e.HTTPPostResponse,a)})),(m||Zt.isFunction(e.onHttpUploadStatus))&&(y.on(ul.event.PROGRESS,(function(t){!de.bSafari&&t&&(delete t.totalSize,delete t.position);var r=0===t.total?100:Math.round(100*t.loaded/t.total);if([t.loaded," / ",t.total].join(""),Zt.isFunction(e.onHttpUploadStatus)){var n;n={fileName:t.name,percentage:r,statusCode:0,responseString:""},e.onHttpUploadStatus(n)}e.onPercent([0,r,"","http",t.name])})),e.onPercent([0,-1,hl.Uploading,"http"]),Zt.isFunction(e.onHttpUploadStatus))){var S="";Zt.isArray(i)&&i.length>0||(i&&i.name&&""!=i.name?S=i.name:i&&i.fileName&&(S=i.fileName)),!S&&t.fileName&&(S=t.fileName),e.onHttpUploadStatus({fileName:S,percentage:0,statusCode:0,responseString:""})}if(v&&v.bCancel){v.st=2;var I={};return ps(I),t.content=null,Zt.isFunction(n)&&n(I._errorCode,I._errorString),!1}var b=y.upload(i);return i=null,b}function lG(e,t,r,n){var i,o,a=e.MaxUploadImageSize,s=0,u=t.content;if(!u||!Zt.isArray(u)||u.length<=0){t.content=null;var c={};return Wa(c),Zt.isFunction(n)&&n(c._errorCode,c._errorString),di}for(i=0;i<u.length;i++){var l=u[i];if(!l||l.size<=0){var d={};return Wa(d),Zt.isFunction(n)&&n(d._errorCode,d._errorString),di}var f=l.size,h=l.type;if(s+=f,""===h||h&&h!=t.contentType){var g=l.slice||l.webkitSlice||l.mozSlice,m=l.name,p=g.call(l,0,f,t.contentType);Zt.isString(m)&&""!=m||(m=l.fileName),p.name=sG(m,i+1),u[i]=p}u[i].remoteFilename=sG(t.remoteFilename,i+1),l=null}if(s>a&&-1!=a){var v={};return Na(v),Zt.isFunction(n)&&n(v._errorCode,v._errorString),di}for(Qt.cancelFrom=rG.HTTPUpload,o=cG(e,t,r,n),t=null,i=0;i<u.length;i++)u[i]=null;return u=null,o}function dG(e){Qt.dlgRef<=0||0==Qt.dialogShowStatus||zs(e)}Qt.setBtnCancelVisibleForProgress=zs;var fG=function(){return s((function e(){o(this,e)}),[{key:"_onProgress",value:function(e,t,r){var n=0===r.total?100:Math.round(100*r.loaded/r.total);[r.loaded," / ",r.total].join(""),e.onPercent([0,n,"","http",t])}},{key:"_uploadBlobFragment",value:function(e,t,r,n){var i=t.fileName,o=t.blockSize,a=0;t.method;var s,u,c,l=t.offset,d=this,f=function(e,r){t.content=null,Zt.isFunction(n)&&n(e,r)};if((s=t.content).size<=0){var h={};return Wa(h),f(h._errorCode,h._errorString),di}if(a=s.size,(u=a-l)>0){var g;if(u>=o&&o>0?(u-=o,c=o):(c=u,u=0),!(g=0==l&&c==a?s:s.slice(l,l+c))){var m={};Wa(m),f(m._errorCode,m._errorString)}if(!e.IfShowProgressBar||e.IfShowProgressBar&&Qt.dlgRef>0){g.name=i,dG(e.IfShowCancelDialogWhenImageTransfer),t.headers["Content-Range"]=["bytes ",l,"-",l+g.size-1,"/",a].join(""),d._onProgress(e,i,{total:a,loaded:l});var p=Zt.clone(t);return p.content=g,p.offset=0,d.httpPostUpload(e,p,(function(n){0==u&&(Qt.needShowTwiceShowDialog=!1),d._onProgress(e,i,{total:a,loaded:l+c}),0==u?(t.content=null,Zt.isFunction(r)&&kf(r,n)):(t.offset=t.offset+c,setTimeout((function(){d._uploadBlobFragment(e,t,r,f)}),100))}),f),!0}var v={};return ps(v),f(v._errorCode,v._errorString),!1}return Qt.needShowTwiceShowDialog=!1,t.content=null,Zt.isFunction(r)&&r(""),!0}},{key:"httpPostUploadFragment",value:function(e,t,r,n){var i;if(!(i=t.content)){var o={};return Wa(o),Zt.isFunction(n)&&n(o._errorCode,o._errorString),di}if(Zt.isString(i)){if(""==i){var a={};return Wa(a),Zt.isFunction(n)&&n(a._errorCode,a._errorString),di}var s=new Blob([i],{type:"text/plain"}),u=t.fileName;s.name=u,t.content=s,s=null}return Qt.cancelFrom=rG.HTTPUpload,this._uploadBlobFragment(e,t,r,n)}},{key:"httpPostUpload",value:function(e,t,r,n){var i,o,a=t.bAsync,s=function(e,r,i,o){return t.content=null,t=null,Zt.isFunction(n)&&n(e,r,i,o),!1};if(!(i=t.content)){var u={};return Wa(u),s(u._errorCode,u._errorString),!!a&&void 0}if(Zt.isString(i)){var c,l=t.fileName;if(""==i){var d={};return Wa(d),s(d._errorCode,d._errorString),!!a&&void 0}if(c=e.MaxUploadImageSize,i.length>c&&-1!=c){var f={};return Na(f),s(f._errorCode,f._errorString),!!a&&void 0}(o=new Blob([i],{type:"text/plain"})).name=l,i=null}else if(i instanceof Blob&&(o=i,i=null,o.size<=0)){var h={};return Wa(h),s(h._errorCode,h._errorString),!!a&&void 0}if(o){var g,m,p=e.MaxUploadImageSize,v=o.size,_=o.type;if(v>p&&-1!=p){var y={};return Na(y),s(y._errorCode,y._errorString),!!a&&void 0}if(""===_||_&&_!=t.contentType)(g=(o.slice||o.webkitSlice||o.mozSlice).call(o,0,v,t.contentType))instanceof File?(m=g.fileName,g.name=m):g.name=o.name||o.fileName;else g=o;o=null,g&&(t.content=g),g=null}dG(e.IfShowCancelDialogWhenImageTransfer),Qt.cancelFrom=rG.HTTPUpload;var S=cG(e,t,(function(e){return t.content=null,t=null,Zt.isFunction(r)&&r(e),e=null,!0}),s);return a?void 0:!!S}}])}(),hG=s((function jJ(){o(this,jJ),this.method="",this.httpMethod="POST",this.contentType="application/octet-stream",this.remoteFilename="RemoteFile",this.blockSize=0,this.offset=0,this.retry=0,this.bOnlyResponseEmptyIsOK=!0,this.bAsync=!0,this.responseType=tG.Text})),gG=s((function GJ(){o(this,GJ),this.IfShowProgressBar=!1,this.IfShowCancelDialogWhenImageTransfer=!0})),mG=function(e){return e.URL=0,e.Blob=1,e.Base64=2,e}({}),pG=window.SparkMD5,vG=function(){return s((function e(t,r,n,i){o(this,e);var a=this;a._md5=n,a._length=r,a._content=i}),[{key:"getLength",value:function(){return this._length}},{key:"getMD5",value:function(){return this._md5}},{key:"getData",value:function(e,t){var r=this,n=t;return Zt.isNumber(e)&&Zt.isNumber(t)?e<0||t<=0?"":0==e&&n==r._length?r._content:(e+n>r._length&&(n=r._length-e),r._content.substr(e,n)):""}}])}();Qt.html5.Base64Result=vG;var _G=function(e){function t(e){var r;return o(this,t),(r=i(this,t,[e])).__maxUploadImageSize=-1,r._strHttpContentTypeFieldValue="application/octet-stream",r}return f(t,e),s(t,[{key:"_saveBlob",value:(k=n(g().mark((function A(e,t){var r,n;return g().wrap((function(i){for(;;)switch(i.prev=i.next){case 0:if(r=this,!rr.navInfo.bIE){i.next=7;break}return i.next=5,r._innerSaveLocal(e,t);case 5:i.next=11;break;case 7:return n=URL.createObjectURL(e),i.next=10,r._innerSaveLocal(n,t);case 10:URL.revokeObjectURL(n);case 11:e=null;case 12:case"end":return i.stop()}}),A,this)}))),function(e,t){return k.apply(this,arguments)})},{key:"_saveImages",value:(E=n(g().mark((function x(e,t,r,n){var i,o,a,s,u,c;return g().wrap((function(l){for(;;)switch(l.prev=l.next){case 0:return i=this,o=uG(t,n),a=Ef(i,r),Qt.cancelFrom=rG.Other,l.next=5,i._innerConvertToArrayBufferWithUIAsync(e,n,a);case 5:return s=l.sent,u=vf.getBlobTypeByImageType(n),c=new Blob([s],{type:u}),l.next=10,i._saveBlob(c,o);case 10:c=null;case 11:case"end":return l.stop()}}),x,this)}))),function(e,t,r,n){return E.apply(this,arguments)})},{key:"_innerSaveLocal",value:(w=n(g().mark((function P(e,t){return g().wrap((function(r){for(;;)switch(r.prev=r.next){case 0:return r.abrupt("return",new Qt.Promise((function(r,n){var i=window,o=rr.navInfo,a=i.requestFileSystem||i.webkitRequestFileSystem||i.mozRequestFileSystem;if(!o.biPad&&!o.biPhone||a||!(de.bSafari&&parseFloat(de.strBrowserVersion)<13)&&de.bSafari){var s=document.createElementNS("http://www.w3.org/1999/xhtml","a");if(s.href=e,s.download=t,s.target="_blank",document.body.appendChild(s),o.bEdge)s.click(),e=null,s.href=null;else if(o.bIE){var u;(u=window.navigator)&&"msSaveOrOpenBlob"in u&&u.msSaveOrOpenBlob(e,t)}else{var c=document.createEvent("MouseEvents");c.initMouseEvent("click",!0,!1),s.dispatchEvent(c)}setTimeout((function(){document.body.removeChild(s),s=null,r()}),6e3)}else{var l=i.open(e,"","",!1);setTimeout((function(){l.document.title=t,r()}),6e3)}})));case 1:case"end":return r.stop()}}),P)}))),function(e,t){return w.apply(this,arguments)})},{key:"_OnPostTransferAsync",value:function(e,t,r){var n,i=this;if(e&&e.length>=2)try{var o=String(e[1]).replace(/\\/g,"\\\\");n=Zt.parse(o),!r&&n.imageId&&(n.imageId=i._serverId2uidFromServer(n.imageId))}catch(s){Zt.log(e)}n||(n={imageId:""});var a=!1;if(Zt.isFunction(i.__OnPostTransferAsync))try{a=i.__OnPostTransferAsync(n)}catch(u){Ho(u)}if(Zt.isFunction(i.__OnPostTransferAsync2))try{i.__OnPostTransferAsync2(n)}catch(u){Ho(u)}return a}},{key:"_checkIndices",value:function(e,t){return SG(e,!Zt.isUndefined(t)&&t>=0?t:this._imageBufferWrapper.count(),this)}},{key:"_acquireImageForSendTo",value:(C=n(g().mark((function D(e,t,r,i){var o,a,s,u,c,l,d,f;return g().wrap((function(h){for(;;)switch(h.prev=h.next){case 0:if(o=this,a=r?Zt.clone(r):{},u=s=i,o._resetErr(),o._isValid()){h.next=4;break}throw{code:o._errorCode,message:o._errorString};case 4:if(Zt.isString(s._id)){h.next=6;break}throw{code:-2602,message:'The parameter "SendTo" is invalid.'};case 6:if(!o.__bAcquireImageNow){h.next=9;break}throw Ta(o),{code:o._errorCode,message:o._getErrorString()};case 9:if(o.__bAcquireImageNow=!0,Wl(e,u),c=Qt.Promise.resolve(),l=rr.DWT.RemoteScanConfig,d=xo(),h.prev=13,uf(a),l&&Po(l.keepAwake),Wc.checkProductKey(o,{Core:!0})&&o._isValid()){h.next=18;break}throw{code:o._errorCode,message:o._errorString};case 18:return Zd._innerSendHeartBeat(s,!1),f=function(){var e=n(g().mark((function t(e){return g().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:c=c.then((function(){return new Qt.Promise((function(t,r){var i=[o._uidFromServer2ServerId(e.imageId)],a=rr.DWT.EnumDWT_ImageType.IT_PNG;Qt.cancelFrom=rG.Scan,o._innerConvertToArrayBufferAsync(a,i).then((function(i){s._bltsCopyImage=!0,s.__LoadImageFromBytesV2(i,a,"",!0,0,0,!1,0,function(){var r=n(g().mark((function i(r,n){var a;return g().wrap((function(r){for(;;)switch(r.prev=r.next){case 0:return a=o._uidFromServer2ServerId(e.imageId),n?(Zt.log("LoadImageFromBinary success"),s._bltsCopyImage=!1,e.imageId=s._uidFromServer2ServerId(n.ids),Zt.isFunction(s._OnPostTransferAsync)&&s._OnPostTransferAsync([!0,Zt.stringify(e)],null,!0)):Zt.log("LoadImageFromBinary return null."),t(),r.next=5,o._removeImageByIdAsync(a);case 5:case"end":return r.stop()}}),i)})));return function(e,t){return r.apply(this,arguments)}}(),(function(e,t){Zt.log(t),s._bltsCopyImage=!1,r({code:e,message:t})}))}),(function(e){e&&e.message&&Zt.log(e.message),r(e)}))}))}));case 1:case"end":return t.stop()}}),t)})));return function(t){return e.apply(this,arguments)}}(),o._registerEvent("OnPostTransferAsync2",f),null!=t&&(a.Device=t.strDevice,a.DeviceMatchField=kd.SMF_NAME),h.next=24,o._acquireImageFromServiceAsync(a);case 24:h.next=29;break;case 26:throw h.prev=26,h.t0=h["catch"](13),h.t0;case 29:return h.prev=29,h.prev=30,h.next=33,c;case 33:h.next=37;break;case 35:h.prev=35,h.t1=h["catch"](30);case 37:return o._unregisterEvent("OnPostTransferAsync2"),o.__bAcquireImageNow=!1,Rl(e),Po(d),h.finish(29);case 42:case"end":return h.stop()}}),D,this,[[13,26,29,42],[30,35]])}))),function(e,t,r,n){return C.apply(this,arguments)})},{key:"_uidFromServer2index",value:function(e){var t,r=this;return r._resetErr(),!!r._isValid()&&(Zt.isString(e)?(-1==(t=r._imageBufferWrapper._uidFromServer2index(e))&&Ns(r),t):(ts(r),-1))}},{key:"_index2uidFromServer",value:function(e){var t=this;if(t._resetErr(),!t._isValid())return!1;var r=parseInt(e);return isNaN(r)?(ya(t),""):r<0||r>=this._imageBufferWrapper.count()?(Ka(t),""):t._imageBufferWrapper._index2uidFromServer(e)}},{key:"__LoadImageFromBytesV2",value:function(e,t,r,n,i,o,a,s,u,c){var l,d=this,f=t||3,h=0,g=e.name,m=!0,p=1;if(e)if(e instanceof Blob)h=e.size;else if(bl(e))h=e.byteLength;else if(e instanceof Array)h=e.length;else{var v=e;h=v.size||v.byteLength||v.length}!isNaN(i)&&i>=0&&!isNaN(o)&&o>0?p=0:(i=0,o=0),l=["[",h,",",0,",",f,',"',r,'",',i,",",o,",",s,",",p,",",a?"true":"false","]"].join("");var _=function(){if(d.__bLoadingImage=!1,m){var e=d._imageBufferWrapper.getCurrentImageIndex();e>=0&&d._innerRefreshUI(e)}return Zt.isFunction(c)&&c(d._errorCode,d._getErrorString(),g),!1};return Wc.checkProductKey(d,{Core:!0})||de.bWin&&Wc.checkProductKey(d,{Webcam:!0},!0)?Wc.checkPDFProductKeyWhenNeeds(d,t)?0===h?(ha(d,-2312,"The file length is empty."),m=!1,_()):this._innerSendBlob("LoadImageFromBytes",l,e,n,p,(function(e){if(d.__bLoadingImage=!1,d._isBindViewer()){var t=d._imageBufferWrapper.getCurrentImageIndex();n&&t>=0&&d._innerRefreshUI(t)}if(Zt.isFunction(u)){var r=e;if(Zt.isArray(r)&&(r=r.length>0?r[0]:{}),n)setTimeout((function(){u(g,r)}),30);else try{u(g,r)}catch(i){Zt.error(i.message)}}return d._canConsume()&&rr.DWT.lcvrf(d),!0}),_):(m=!1,_()):(Wc.checkProductKey(d,{Core:!0},!1),m=!1,_())}},{key:"_innerSendBlob",value:function(e,t,r,n,i,o,a){var s=this;if(Zd.isServerInvalid(s))return s._waitForConnect().then((function(){s._innerSendBlob(e,t,r,n,i,o,a)}));if(n)return s._innerSendBlobByWS(e,t,r,o,a),!0;var u,c,l,d;return s._resetErr(),!!s._isValid()&&(c=[s._httpUrl,"f/",e].join(""),l=rf(s._clientId,e,t,0,s._bScanForProxyRemote),l+="\r\n\r\n",d={method:"POST",url:c,processData:!1,data:l+=Zt.base64.encodeArray(r),async:!1,onSuccess:function(e,t,n){var o=!1,a=!1;try{o=Zt.isString(e)&&da(n.getResponseHeader("content-type"))?Zt.parse(e):e}catch(Mj){}if(o!==undefined&&null!==o&&(eu(o)?(s._errorCode=o.exception,s._errorString=o.description):s._resetErr(),(u=o.result)&&Zt.isArray(u)&&u.length>=1))if(i){var c,l=u[0];l&&Zt.isObject(l)&&(c=l.imageInfos,0==s._errorCode&&Zt.isString(c)&&s._handleOnBitmapChangedEvent({result:["c1",c]},{document:r.currentFileName,tag:r.currentTagName}),a=!0)}else{var d=u.join(",");0==s._errorCode&&d.length>0&&s._OnBitmapChanged(["c1",d,1,s._imageBufferWrapper.getCurrentImageIndex(),s._imageBufferWrapper.count()],null,{document:r.currentFileName,tag:r.currentTagName}),a=!0}a||(Aa(s),u="")},onError:function(){ka(s),u=""}},Zt.mix(d,{headers:{"X-Requested-With":!1}}),de.bFileSystem&&(d.crossDomain=!1),Vi(d),0==s._errorCode?Zt.isFunction(o)&&o():Zt.isFunction(a)&&a(),u)}},{key:"_convertToBase64ByServerIdsWithUI",value:function(e,t,r,n,i,o,a){this._convertToBase64ByServerIdsWithUIAsync(e,r,t,n).then((function(e){Zt.isFunction(o)&&kf(o,e)}),(function(){Zt.isFunction(a)&&a()}))}},{key:"_OnPercentDone",value:function(e){var t,r,n,i,o,a=this,s=!1,u=!1,c=0;Zt.isArray(e)&&e.length>2&&(r=e[0],c=e[1],n=e[2],e.length>3&&(i=e[3]),e.length>4&&(o=e[4]),e.length>5&&e[5],t=c,c<0?t=0:c>100&&(t=100),t=Math.floor(t),Qt.cancelFrom!=rG.HTTPUpload&&Qt.cancelFrom!=rG.HTTPDownload&&Qt.cancelFrom!=rG.Scan&&Qt.cancelFrom!=rG.HTTPPut||(u=o)),(a._bServerPercentDone||0==r)&&((c>0||0==c)&&(Qt.cancelFrom!=rG.HTTPUpload&&Qt.cancelFrom!=rG.HTTPDownload&&Qt.cancelFrom!=rG.FTPUpload&&Qt.cancelFrom!=rG.FTPDownload&&Qt.cancelFrom!=rG.HTTPPut||(s=!0)),a.IfShowProgressBar&&Qt.progressBarOnPercentDone(c,n,i,t,u,this._containerElement),1==s&&(Zt.isFunction(a.__OnInternetTransferPercentage)&&a.__OnInternetTransferPercentage(t,!1),Zt.isFunction(a.__OnInternetTransferPercentageEx)&&a.__OnInternetTransferPercentageEx(t,!1)),Zt.isFunction(a.__OnPercentDone)&&a.__OnPercentDone())}},{key:"IfShowProgressBar",get:function(){return this._bIfShowProgressBar},set:function(e){this._resetErr(),Zt.isBoolean(e)?this._bIfShowProgressBar=e:Sa(this)}},{key:"IfShowCancelDialogWhenImageTransfer",get:function(){return this.__IfShowCancelDialogWhenImageTransfer},set:function(e){this._resetErr(),Zt.isBoolean(e)?this.__IfShowCancelDialogWhenImageTransfer=e:Sa(this)}},{key:"_getLogLevel",value:function(){return this._logLevel}},{key:"_setLogLevel",value:(T=n(g().mark((function F(e){return g().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return this._logLevel=e,t.next=3,this._innerFunV2("LogLevel",Il(e));case 3:case"end":return t.stop()}}),F,this)}))),function(e){return T.apply(this,arguments)})},{key:"MaxUploadImageSize",get:function(){return this.__maxUploadImageSize},set:function(e){var t=this;t._resetErr();var r=1*e;!Zt.isNumber(r)||isNaN(r)?Sa(t):t.__maxUploadImageSize=r}},{key:"HTTPRequestswithCredentials",get:function(){return this._resetErr(),this._bWithCredentials},set:function(e){this._resetErr(),Zt.isBoolean(e)?this._bWithCredentials=e:Sa(this)}},{key:"cancelableObj",get:function(){return this._cancelableObj},set:function(e){this._cancelableObj=e}},{key:"_getProfile",value:(b=n(g().mark((function W(e){var t,r;return g().wrap((function(n){for(;;)switch(n.prev=n.next){case 0:if((t=this)._resetErr(),t._isValid()){n.next=4;break}throw{code:t._errorCode,message:t._errorString};case 4:return e&&(r=Zt.stringify([e.strDevice])),n.abrupt("return",t._innerFunV2("GetCustomDSDataEx",r));case 6:case"end":return n.stop()}}),W,this)}))),function(e){return b.apply(this,arguments)})},{key:"_setProfile",value:(I=n(g().mark((function R(e,t){var r,n;return g().wrap((function(i){for(;;)switch(i.prev=i.next){case 0:if((r=this)._resetErr(),r._isValid()){i.next=4;break}throw{code:r._errorCode,message:r._errorString};case 4:return n=e?Zt.stringify([t,e.strDevice]):Il(t),i.abrupt("return",this._innerFunV2("SetCustomDSDataEx",n));case 6:case"end":return i.stop()}}),R,this)}))),function(e,t){return I.apply(this,arguments)})},{key:"_removeAllImagesAsync",value:(S=n(g().mark((function N(e,t){var r,n,i,o,a,s;return g().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if((r=this)._resetErr(),r._isValid()){e.next=4;break}throw{code:r._errorCode,message:r._errorString};case 4:for(i=[],a=r._getHowManyImagesInBuffer(),o=a-1;o>=0;o--)(s=r._imageBufferWrapper.convertClientIndexToServerId(o))>-1&&i.push(s);if(0!=i.length){e.next=13;break}return e.next=10,r._innerFunV2("RemoveAllImages");case 10:n=e.sent,e.next=23;break;case 13:if(!t){e.next=19;break}return e.next=16,r._innerFunV2("RemoveAllImages",Il(i.join(",")));case 16:n=e.sent,e.next=22;break;case 19:return e.next=21,r._innerFunV2("RemoveAllImages");case 21:n=e.sent;case 22:(n||-1033==r._errorCode)&&r._OnBitmapChanged(["c1",i.join(","),3,r._imageBufferWrapper.getCurrentImageIndex(),r._imageBufferWrapper.count()]);case 23:return e.abrupt("return",n);case 24:case"end":return e.stop()}}),N,this)}))),function(e,t){return S.apply(this,arguments)})},{key:"__OnRecieveMsg",value:function(e,r){var n=this,i=null==r?void 0:r.cmd;if(e.event)return l(d(t.prototype),"__OnRecieveMsg",this).call(this,e,r);if(eu(e)?(n._errorCode=e.exception,n._errorString=e.description):"StartScan"!=i&&"GetAddOnVersion"!=i&&(n._errorCode=0,n._errorString=""),"ReadBarcode"==i||"OCRRecognize"==i||e.request&&"OCRProRecognize"==e.request.method)return r.sFun?(r.sFun(e),!0):(r.fFun&&r.fFun(e),!0);if("SetCapabilities"==i||"GetSkewAngleFromBinary"==i||"UpdateImage"==i)return"exception"in e&&"0"!=e.exception?(e.result.errorCode&&e.result.errorString?(n._errorCode=e.result.errorCode,n._errorString=e.result.errorString):(n._errorCode=e.exception,n._errorString=e.description),r.fFun&&r.fFun(e.result),e=null,!0):(r.sFun&&r.sFun(e.result),e=null,!0);if(e.result&&e.result.length&&("1"==e.result[0]||1==e.result[0]||"ok"==e.result[0]))return(r.sFun||r.sFun)&&r.sFun(e.result),!0;if(!e.exception)return r.sFun&&r.sFun(e.result),e=null,!0;var o=!1;return r.fFun&&(o=r.fFun(n._errorString)),!o&&e.exception&&e.exception<0&&-2115!=e.exception&&Zt.isFunction(n.__OnPrintMsg)&&n.__OnPrintMsg(n._errorString),!0}},{key:"_convertServerIdToGuid",value:function(e){return this._serverId2uidFromServer(e)}},{key:"_convertGuidToServerId",value:function(e){return this._uidFromServer2ServerId(e)}},{key:"_serverId2uidFromServer",value:function(e){return this._imageBufferWrapper._serverId2uidFromServer(e)}},{key:"_uidFromServer2ServerId",value:function(e){return this._imageBufferWrapper._uidFromServer2ServerId(e)}},{key:"_innerConvertToBlobWithUI",value:function(e,t,r,n,i,o){var a=this,s=arguments,u=function(e){if(Qt.needShowTwiceShowDialog=!1,Zt.isFunction(o)){var t=[];Zt.isArray(r)&&Zt.each(r,(function(e){var r=a._imageBufferWrapper.convertServerIdToClientIndex(e);r>-1&&t.push(r)})),e&&(a._errorCode=e.code,a._errorString=e.message),o(t)}return!1};a._innerConvertToArrayBufferWithUIAsync(e,t,r,n).then((function(e){if(!e||e.byteLength<=0)return es(a),u();var n=a.__maxUploadImageSize;if(e.byteLength>n&&-1!=n)return Na(a),u();if(Qt.needShowTwiceShowDialog=!1,Zt.isFunction(i)){var o=[];Zt.isArray(r)&&Zt.each(r,(function(e){var t=a._imageBufferWrapper.convertServerIdToClientIndex(e);t>-1&&o.push(t)}));var c=vf.getBlobTypeByImageType(t),l=new Blob([e],{type:c});try{i(l,o,s)}catch(d){}l=null}return!0}),u)}},{key:"convertToBlob",value:(y=n(g().mark((function O(e,t,r){var n,i,o,a;return g().wrap((function(s){for(;;)switch(s.prev=s.next){case 0:return i=Ef(n=this,t),Qt.cancelFrom=rG.ConvertToBlob,s.next=4,n._innerConvertToArrayBufferWithUIAsync("convertToBlob",e,i,r);case 4:return o=s.sent,a=vf.getBlobTypeByImageType(e),s.abrupt("return",new Blob([o],{type:a}));case 7:case"end":return s.stop()}}),O,this)}))),function(e,t,r){return y.apply(this,arguments)})},{key:"_innerConvertToArrayBufferWithUIAsync",value:(_=n(g().mark((function M(e,t,r,n,i){var o,a,s,u;return g().wrap((function(c){for(;;)switch(c.prev=c.next){case 0:return a=this,u=null===(o=Qt.progressContext)||void 0===o?void 0:o.IfShowCancelDialogWhenImageTransfer,c.prev=2,a.IfShowProgressBar?Qt.showProgress(a,e,!1):Qt.hideProgress(),a._OnPercentDone([0,-1,hl.Encoding]),Qt.progressContext&&(Qt.progressContext.IfShowCancelDialogWhenImageTransfer=!1),c.next=8,this._innerConvertToArrayBufferAsync(t,r,n,i);case 8:s=c.sent;case 9:return c.prev=9,Qt.progressContext&&(Qt.progressContext.IfShowCancelDialogWhenImageTransfer=u),a.IfShowProgressBar&&Qt.closeProgress(null,e),c.finish(9);case 13:return c.abrupt("return",s);case 14:case"end":return c.stop()}}),M,this,[[2,,9,13]])}))),function(e,t,r,n,i){return _.apply(this,arguments)})},{key:"_innerConvertToBase64Async",value:(v=n(g().mark((function L(e,t,r){var n,i,o,a,s,u,c,l,d;return g().wrap((function(f){for(;;)switch(f.prev=f.next){case 0:return n=this,i=r,Zt.isString(i)&&""!=i||(i="{}"),o=["[",e,',"',t.join(","),'",',i,",1]"].join(""),f.next=5,n._sendDataByHttpAsync("ConvertToBase64",o,"text",!0);case 5:if(a=f.sent,s=0,u="",c="",l=a&&a.result,0==n._errorCode){f.next=9;break}throw{code:n._errorCode,message:n._errorString};case 9:if(!l||!Zt.isArray(l)||3!=l.length){f.next=17;break}return c=l[0],s=l[1],u=l[2],d=new vG(null,s,u,c),f.abrupt("return",d);case 17:throw ha(n,-2366,"Converting images to a base64 string failed."),{code:n._errorCode,message:n._errorString};case 19:case"end":return f.stop()}}),L,this)}))),function(e,t,r){return v.apply(this,arguments)})},{key:"_convertToBase64ByServerIdsWithUIAsync",value:(p=n(g().mark((function B(e,t,r,n){var i,o,a;return g().wrap((function(s){for(;;)switch(s.prev=s.next){case 0:return o=this,a=null===(i=Qt.progressContext)||void 0===i?void 0:i.IfShowCancelDialogWhenImageTransfer,s.prev=2,o.IfShowProgressBar?Qt.showProgress(o,e,!1):Qt.hideProgress(),o._OnPercentDone([0,-1,hl.Encoding]),Qt.progressContext&&(Qt.progressContext.IfShowCancelDialogWhenImageTransfer=o.IfShowCancelDialogWhenImageTransfer),s.next=8,this._innerConvertToBase64Async(t,r,n);case 8:return s.abrupt("return",s.sent);case 9:return s.prev=9,Qt.progressContext&&(Qt.progressContext.IfShowCancelDialogWhenImageTransfer=a),o.IfShowProgressBar&&Qt.closeProgress(null,e),s.finish(9);case 13:case"end":return s.stop()}}),B,this,[[2,,9,13]])}))),function(e,t,r,n){return p.apply(this,arguments)})},{key:"_convertToBlobForUpload",value:function(e,t,r,n,i,o,a){var s=this,u=arguments;if(rr.DWT.ConnectWithSocket){var c=r,l=",";Zt.isString(c)&&""!=c||(c="",l="");var d=["[",e,',"',t.join(","),'"',l,c,"]"].join("");return Qt.cancelFrom=rG.ConvertToBlob,Qt.progressContext&&(Qt.progressContext.IfShowCancelDialogWhenImageTransfer=!1),s._sendData("ConvertToBlob",d,!0,(function(e){s._resetErr();var t=e;if(t){if(t instanceof Blob||bl(t))return void i(t,"",u);eu(t)&&(s._errorCode=t.exception,s._errorString=t.description)}}),(function(e){s._errorCode=e.code,s._errorString=e.message,o(e)})),!0}s._innerConvertToArrayBufferAsync(e,t,r,"arraybuffer").then((function(e){var t=s._strHttpContentTypeFieldValue,r=new Blob([e],{type:t});if(rr.DWT.IfAddMD5InUploadHeader){var n=new pG.ArrayBuffer;n.append(e),Zt.isFunction(i)&&i(r,n.end(),u)}else Zt.isFunction(i)&&i(r,"",u);r=null}),(function(e){o(e.code,e.message)}))}},{key:"dispose",value:function(){return this.__unload()}},{key:"_innerDisposeWSClient",value:function(){return this._isValid()?this._sendData("dispose",null,!0,(function(){}),(function(){})):Qt.Promise.reject()}},{key:"__unload",value:(m=n(g().mark((function U(){var e,t;return g().wrap((function(r){for(;;)switch(r.prev=r.next){case 0:if(!(e=this)._bReady||Qt.page.bUnload){r.next=10;break}if(!e._wsClient){r.next=10;break}return r.prev=3,r.next=6,e._innerDisposeWSClient();case 6:r.next=10;break;case 8:r.prev=8,r.t0=r["catch"](3);case 10:if(!e._wsClient){r.next=24;break}return e._wsClient.removeEvent("close",e._clientId),e._wsClient.removeEvent("error",e._clientId),e._wsClient.removeEvent("timeout",e._clientId),r.prev=14,r.next=17,e._wsClient.dispose();case 17:r.next=22;break;case 19:r.prev=19,r.t1=r["catch"](14),t=r.t1;case 22:delete e._wsClient,e._wsClient=null;case 24:if(this._imageBufferWrapper.dispose(),this._bReady=di,this._destroy=fi,!t){r.next=29;break}throw t;case 29:case"end":return r.stop()}}),U,this,[[3,8],[14,19]])}))),function(){return m.apply(this,arguments)})},{key:"_getImages",value:(h=n(g().mark((function V(e,t,r,n){var i,o,a,s;return g().wrap((function(u){for(;;)switch(u.prev=u.next){case 0:if((i=this)._checkIndices(t)){u.next=3;break}throw{code:this._errorCode,message:this._errorString};case 3:if(n!=mG.URL){u.next=9;break}if(!(t.length>1)){u.next=7;break}throw ha(this,-2619,"Only single index selection is allowed when enumImageFormatType is set to url."),{code:this._errorCode,message:this._errorString};case 7:u.next=13;break;case 9:if(r!=rr.DWT.EnumDWT_ImageType.IT_BMP&&r!=rr.DWT.EnumDWT_ImageType.IT_JPG&&r!=rr.DWT.EnumDWT_ImageType.IT_PNG){u.next=13;break}if(!(t.length>1)){u.next=13;break}throw _s(this),{code:this._errorCode,message:this._errorString};case 13:if(n!=mG.URL){u.next=17;break}return u.abrupt("return",this._imageBufferWrapper.getImageUrl(t[0]));case 17:if(Qt.cancelFrom=rG.Other,o=Ef(i,t),n!=mG.Blob){u.next=27;break}return u.next=22,this._innerConvertToArrayBufferWithUIAsync(e,r,o);case 22:return a=u.sent,s=vf.getBlobTypeByImageType(r),u.abrupt("return",new Blob([a],{type:s}));case 27:if(n!=mG.Base64){u.next=31;break}return u.next=30,this._convertToBase64ByServerIdsWithUIAsync(e,r,o);case 30:return u.abrupt("return",u.sent);case 31:throw vs(this),{code:this._errorCode,message:this._errorString};case 33:case"end":return u.stop()}}),V,this)}))),function(e,t,r,n){return h.apply(this,arguments)})},{key:"_LicensePromptExpired",value:function(){var e=this,t=e.__licenseInfo.bTrial,r="";e.__licenseInfo&&e.__licenseInfo.ExpireDate&&(r=e.__licenseInfo.ExpireDate);var n=Bc(r);n<=0&&(t||Ho(e._getErrorString()),Zt.isFunction(rr.OnLicenseExpiredWarning)&&rr.OnLicenseExpiredWarning(r,n,t))}},{key:"__saveToViewerAfterUpdate",value:function(e,t){var r=this,n=this._imageBufferWrapper.getIndexByUid(e),i=this._imageBufferWrapper.convertClientIndexToServerId(n),o=pl.getUrlByAct(this._imageBufferWrapper.BaseUrl,i,2);return new Qt.Promise((function(e,a){Vi({method:"GET",xhrFields:{withCredentials:!0},url:o,onSuccess:function(o){var a,s=r._imageBufferWrapper.getMetadataByIndex(n);s||(s={}),s.width=t.width,s.height=t.height,a=rr.navInfoSync.bMobile?r._imageBufferWrapper.getMinImageUrl(n,Math.round(s.controlWidth*devicePixelRatio),Math.round(s.controlHeight*devicePixelRatio)):r._imageBufferWrapper.getMinImageUrl(n,s.controlWidth,s.controlHeight);var u=r._imageBufferWrapper.getImageIdMap(i);if(u){u.ticks=Date.now(),u.imageUrl=r._imageBufferWrapper.getImageUrl(n),u.minImageUrl=a,u.width=t.width,u.height=t.height;var c=Zt.clone(u);c.imageId=i,r._imageBufferWrapper.UpdateImage(c,s)}e()},onError:function(){e(),Rl("save")}})}))}},{key:"RunCommandAsync",value:(c=n(g().mark((function j(e){var t,r,n,i,o,a;return g().wrap((function(s){for(;;)switch(s.prev=s.next){case 0:if(t=this,e&&Zt.isString(e.command)&&e.parameter){s.next=4;break}throw rs(t),{code:t._errorCode,message:t._errorString};case 4:if("Invert"!=e.command){s.next=6;break}return s.abrupt("return",t._invert(e.parameter.index));case 6:if(r=e.parameter.index,!Zt.isNumber(r)){s.next=13;break}if(!(isNaN(r)||!Zt.isNumber(r)||r<0||r>=t._imageBufferWrapper.count())){s.next=11;break}throw Ka(t),{code:t._errorCode,message:t._errorString};case 11:n=t._imageBufferWrapper.convertClientIndexToServerId(r),e.parameter.index=n;case 13:return i=["[",Zt.stringify(e),"]"].join(""),s.next=16,t._innerFunRawV3("runCommand",i);case 16:if(o=s.sent,!de.bIE){s.next=21;break}if(!Zt.isString(o)){s.next=20;break}return s.abrupt("return",Zt.parse(o));case 20:return s.abrupt("return",o);case 21:if(!da(a=o.headers.get("content-type"))){s.next=28;break}return s.next=25,o.json();case 25:return s.abrupt("return",s.sent);case 28:if("text/plain"!=a&&"text/html"!=a){s.next=32;break}return s.next=31,o.text();case 31:return s.abrupt("return",s.sent);case 32:return s.next=34,o.blob();case 34:return s.abrupt("return",s.sent);case 35:case"end":return s.stop()}}),j,this)}))),function(e){return c.apply(this,arguments)})},{key:"_innerFunRawV3",value:(u=n(g().mark((function G(e,t){var r,n,i;return g().wrap((function(o){for(;;)switch(o.prev=o.next){case 0:if(i="fa/",(r=this)._resetErr(),r._isValid()){o.next=4;break}throw{code:r._errorCode,message:r._errorString};case 4:if(!Zd.isServerInvalid(r)){o.next=7;break}return o.abrupt("return",r._waitForConnect().then((function(){return r._innerFunRawV3(e,t)})));case 7:return n={method:"post",body:rf(r._clientId,e,t,0,r._bScanForProxyRemote),fetchRaw:!0},o.next=10,Hs([r._httpUrl,i,e].join(""),n);case 10:return o.abrupt("return",o.sent);case 11:case"end":return o.stop()}}),G,this)}))),function(e,t){return u.apply(this,arguments)})},{key:"_invert",value:(a=n(g().mark((function H(e){var t,r,n,i,o;return g().wrap((function(a){for(;;)switch(a.prev=a.next){case 0:if(t=this,r=parseInt(e),t._resetErr(),t._isValid()){a.next=4;break}throw{code:t._errorCode,message:t._errorString};case 4:if(!isNaN(r)){a.next=7;break}throw ya(t),{code:t._errorCode,message:t._errorString};case 7:if(!(r<0||r>=t._imageBufferWrapper.count())){a.next=10;break}throw Ka(t),{code:t._errorCode,message:t._errorString};case 10:if(-1!=(n=t._imageBufferWrapper.convertClientIndexToServerId(r))){a.next=14;break}throw Ka(t),{code:t._errorCode,message:t._errorString};case 14:return a.next=16,t._innerFunV2("Invert",Il(n),!0);case 16:if(i=a.sent,!(o=1==i)){a.next=22;break}vf.refreshImageAfterInvokeFun(t,r),a.next=23;break;case 22:throw{code:t._errorCode,message:t._errorString};case 23:return a.abrupt("return",o);case 24:case"end":return a.stop()}}),H,this)}))),function(e){return a.apply(this,arguments)})}],[{key:"create",value:(r=n(g().mark((function z(e){var r;return g().wrap((function(n){for(;;)switch(n.prev=n.next){case 0:return r=new t(e),n.next=3,Zd.STwainConnectToServer(r);case 3:return n.abrupt("return",r);case 4:case"end":return n.stop()}}),z)}))),function(e){return r.apply(this,arguments)})}]);var r,a,u,c,h,m,p,v,_,y,S,I,b,T,C,w,E,k}(eG);function yG(e){var t=e,r="",n=!1;if(t.__licenseInfo&&(t.__licenseInfo.ExpireDate&&(r=t.__licenseInfo.ExpireDate),n=t.__licenseInfo.bTrial),n&&!rr.DWT.HideTrialMessage){var i=Bc(r);i<=5&&(Zt.isFunction(rr.OnLicenseExpiredWarning)&&rr.OnLicenseExpiredWarning(r,i,!0),rr.DWT.HideTrialMessage=!0)}}function SG(e,t,r){var n;if(!Zt.isArray(e))return za(r),!1;if(0==e.length)return ha(r,-2350,"The indices cannot be empty."),!1;if(rr.DWT.ConnectWithSocket)return!0;for(n=0;n<e.length;n++){var i=e[n];if(Zt.isUndefined(i)||null===i)return Ja(r),!1;if(i=parseInt(i),isNaN(i))return ya(r),!1;if(i<0||i>=t)return Ga(r),!1}return!0}var IG={changeImageUISize:function(e,t,r){var n,i,o,a,s=t,u=r,c=di;n=ci.one(e._containerElement),Zt.isString(t)&&t.indexOf("%")>=0?(0==(o=ci.css(n,"width"))&&(n[0].style.width="100%"),o=ci.css(n,"width")*parseInt(t)/100,c=fi):s=[(o=parseInt(t))+2,"px"].join(""),Zt.isString(r)&&r.indexOf("%")>=0?(0==(a=ci.css(n,"height"))&&(n[0].style.height="100%"),a=ci.css(n,"height")*parseInt(r)/100,c=fi):u=[(a=parseInt(r))+2,"px"].join(""),n&&(i=ci.one(".dynamsoft-dwt-container-box",n))&&i.getEL()&&(i.style("width",s),i.style("height",u)),c?(e.__funResize||(e.__funResize=function(){if(e._ImgManager&&e._containerElement){var t=IG.__innerGetUIViewRealSize(e._containerElement,e._width,e._height);return e._UIView.ChangeSize(t.width,t.height)}return fi}),Zt.removeEventListener(window,"resize",e.__funResize),Zt.addEventListener(window,"resize",e.__funResize)):e.__funResize&&(Zt.removeEventListener(window,"resize",e.__funResize),e.__funResize=di);var l=IG.__innerGetUIViewRealSize(e._containerElement,o,a);return e._ImgManager?e._UIView.ChangeSize(l.width,l.height):fi},__innerGetUIViewRealSize:function(e,t,r){var n,i=-1,o=-1;return n=ci.one(e),Zt.isString(t)&&t.indexOf("%")>=0&&(i=ci.css(n,"width")*parseInt(t)/100),i<0&&t&&(i=parseInt(t)),Zt.isString(r)&&r.indexOf("%")>=0&&(o=ci.css(n,"height")*parseInt(r)/100),o<0&&r&&(o=parseInt(r)),{width:i,height:o}},bindUIViewEvents:function(e,t){var r=e;t.onSelected=function(e){if(!r._isNoViewer()){var t,n=e.length;n>0&&(r._ImgManager.SetSelectedImageCount(n),t=e[n-1],Zt.isFunction(r.__OnRefreshUI)&&r.__OnRefreshUI(t))}},t.onRefreshUI=function(e){r._isNoViewer()||IG.__innerRefreshFromUIView(r,e)},t.onResetCurrentIndex=function(e){if(!r._isNoViewer()){var t=r._ImgManager.getCurrentImageIndex();if(e>=0&&e<r._ImgManager.count()&&t!=e&&Zt.isFunction(r.__OnIndexChangeDuringDragDrop))try{r.__OnIndexChangeDuringDragDrop(t,e)}catch(n){Ho(n)}}},t.onMouseMove=function(e){if(!r._isNoViewer()){var t=e.index;if(e){var n=e.x,i=e.y;r.__MouseX=n,r.__MouseY=i}if(Zt.isFunction(r.__OnMouseMove))try{r.__OnMouseMove(t)}catch(o){Ho(o)}}},t.onMouseClick=function(e){if(!r._isNoViewer()){var t=e.index;if(e){var n=e.x,i=e.y;r.__MouseX=n,r.__MouseY=i}if(Zt.isFunction(r.__OnMouseClick))try{r.__OnMouseClick(t)}catch(o){Ho(o)}}},t.onMouseDoubleClick=function(e){if(!r._isNoViewer()){var t=e.index;if(Zt.isFunction(r.__OnMouseDoubleClick))try{r.__OnMouseDoubleClick(t)}catch(n){Ho(n)}}},t.onMouseRightClick=function(e){if(!r._isNoViewer()){var t=e.index;if(e){var n=e.x,i=e.y;r.__MouseX=n,r.__MouseY=i}if(Zt.isFunction(r.__OnMouseRightClick))try{return r.__OnMouseRightClick(t)}catch(o){Ho(o)}return fi}},t.onImageAreaSelected=function(e){if(!r._isNoViewer()&&Zt.isFunction(r.__OnImageAreaSelected))try{r.__OnImageAreaSelected(e.index,e.left,e.top,e.right,e.bottom,e.areaIndex)}catch(t){Ho(t)}},t.onImageAreaDeSelected=function(e){if(!r._isNoViewer()&&Zt.isFunction(r.__OnImageAreaDeSelected))try{r.__OnImageAreaDeSelected(e)}catch(t){Ho(t)}},t.onBufferChanged=function(e){if(Zt.isFunction(r.__OnBufferChanged))try{r.__OnBufferChanged(e)}catch(t){Ho(t)}}},__innerRefreshFromUIView:function(e,t){var r=e;Zt.isFunction(r.__OnRefreshUI)&&r.__OnRefreshUI(t)}};function bG(e,t,r){t in e||Object.defineProperty(e,t,r)}var TG=function(){return s((function e(t){o(this,e);var r=this;r._parent=t,bG(r,"width",{get:function(){return this._parent._width},set:function(e){this.SetSize(e,!1)}}),bG(r,"height",{get:function(){return this._parent._height},set:function(e){this.SetSize(!1,e)}})}),[{key:"SetSize",value:function(e,t){var r,n=this._parent,i=!1,o=!1;return!!n._isBindViewer()&&(Zt.isString(e)&&e.length>0&&"%"===e.charAt(e.length-1)&&(i=e),!i&&e&&(r=parseInt(e))&&(i=r+"px"),Zt.isString(t)&&t.length>0&&"%"===t.charAt(t.length-1)&&(o=t),!o&&t&&(r=parseInt(t))&&(o=r+"px"),i&&(n._width=i),o&&(n._height=o),IG.changeImageUISize(n,i,o))}}])}();function CG(e){var t,r,n,i,o=e._config;Qt.dlgProgress||Qt.initProgress(e),o.bNoViewer?e._containerElement=null:(o.container?e._containerElement=o.container:o.containerId&&(e._containerElement=Zt.get(o.containerId)),e._width=o.width,e._height=o.height,t=ci.one(e._containerElement)),function(e,t){var r={Stwain:e},n=di;if(t){var i,o=e._width,a=e._height;i=ci.one(e._containerElement),Zt.isString(o)&&o.indexOf("%")>=0?(o=ci.css(i,"width")*parseInt(o)/100,n=fi):o=parseInt(o),Zt.isString(a)&&a.indexOf("%")>=0?(a=ci.css(i,"height")*parseInt(a)/100,n=fi):a=parseInt(a),r={Stwain:e,Container:t,Width:o,Height:a}}IG.bindUIViewEvents(e,r),e._UIView?e._UIView._Init(r):e._UIView=new Qt.UI.ImageUIView(e,r),e.Width<=0&&(e.Width=270),e.Height<=0&&(e.Height=350),n&&IG.changeImageUISize(e,e._width,e._height)}(e,t),e._isBindViewer()&&(r=e,n=e._config,i=n||{},r.__OnImageAreaDeSelected=i.onImageAreaDeSelected||"",r.__OnImageAreaSelected=i.onImageAreaSelected||"",r.__OnMouseClick=i.onMouseClick||"",r.__OnMouseDoubleClick=i.onMouseDoubleClick||"",r.__OnMouseMove=i.onMouseMove||"",r.__OnMouseRightClick=i.onMouseRightClick||"",r.__OnTopImageInTheViewChanged=i.onTopImageInTheViewChanged||"",r.__OnBufferChanged=i.onBufferChanged||"",e.__OnMouseClick=o.onMouseClick||"",e.__OnThumbnailMouseClick="",e.__OnKeyDown=o.onKeyDown||"",e.__OnMouseWheel=o.onMouseWheel||"",e.__OnMouseDoubleClick=o.onMouseDoubleClick||"",e.__OnMouseRightClick=o.onMouseRightClick||"",e.__OnMouseMove=o.onMouseMove||"",e.__OnImageAreaSelected=o.onImageAreaSelected||"",e.__OnImageAreaDeSelected=o.onImageAreaDeSelected||"",e.__OnRefreshUI=o.onRefreshUI||"",e.__OnBufferChanged=o.onBufferChanged||"",e.__MouseX=0,e.__MouseY=0,e.__style=new TG(e),e.__fSelectionRectAspectRatio=0)}Qt.install={_divDWTNonInstallContainerID:"dwt-NonInstallContainerID",_divDWTemessageContainer:"",_dlgInstall:!1},Qt.install._strNonInstallDIV=['<div style="text-align:center;" id="',Qt.install._divDWTNonInstallContainerID,'"></div>'].join("");var wG=rr.DWT;wG.CloseDialog=function(){var e=Qt.install._dlgInstall;if(e){var t=Zt.sizzle(".dynamsoft-dialog-close");Zt.each(t,(function(e,t){Zt.removeEventListener(e,"click",wG.CloseDialog)})),e.open&&e.close(),document.body.removeChild(e),Qt.install._dlgInstall=!1}},wG.ShowDialog=function(e,t,r,n,i){if(!1!==r){var o,a={width:e,height:t,position:"absolute"};n?(o=['<div class="dynamsoft-dwt-dialog-body">',r,"</div>"].join(""),a.closeButton=!1):o=['<div class="ds-dwt-ui-showdlg">','<div class="dynamsoft-dwt-dialog-body">','<div class="dynamsoft-dwt-dlg-header">',i?"":'<div class="dynamsoft-dialog-close"></div>',"</div>",r,"</div>","</div>"].join(""),i&&(a.closeButton=!1),wG.ShowMessage(o,a)}},wG.ShowMessage=function(e,t){var r,n,i,o,a,s=Qt.install,u="ds-dwt-ui-dlg",c="ds-dwt-ui-dlg-wrap",l=screen.width,d=!0,f=0,h=!0,g=!0,m=0,p="fixed",v="Error",_=ia.bActiveXEdition,y=!1,S=null;if(t&&(r=t.width,n=t.height,t.seconds&&(f=t.seconds),t.headerStyle&&(m=t.headerStyle),1==t.backgroundStyle&&(y=!0),!1===t.closeButton&&(h=!1),t.bAutoClose&&(i=t.bAutoClose,h=!0),0==t.bReadyClosed&&(d=!1),t.position&&(p=t.position),t.caption&&(v=t.caption),Zt.isFunction(t.onClose)&&(S=t.onClose)),r?!de.bMobile&&r>l-10&&(r=l-10):r=l>600?600:l-10,n||(n="100%"),1==m?e=['<div class="dynamsoft-dialog">','<div class="dynamsoft-dwt-dialog-body">','<div class="dynamsoft-dwt-dlg-header">',h?'<div class="dynamsoft-dialog-close"></div>':"","</div>",e,"</div></div>"].join(""):2==m&&(e=['<div class="dynamsoft-dialog">','<div class="dynamsoft-dwt-ltsdlg-header"><span style="color:#FFF;line-height:35px;margin-left:15px">',v,"</span>",h?'<div class="dynamsoft-dialog-close"></div>':"","</div>",'<div class="dynamsoft-dwt-ltsdlg-body" style="padding:25px 40px 20px 40px;">',e,"</div></div>"].join("")),0==Zt.sizzle("."+u).length){var I=document.createElement("div"),b=document.createElement("div"),T=document.createElement("div");if(I.className=u,b.className=c,b.style.margin="auto",b.style.zIndex="9999",b.style.position="relative",b.style.border="0",i&&((o=document.createElement("div")).className="dynamsoft-dialog-close",b.insertBefore(o,b.firstElementChild),(a=document.createElement("div")).className="dynamsoft-dialog-closeTimer",a.style.width="100%",a.style.height="2px",a.style.marginTop="-2px",a.style.backgroundColor="#fe8e14",b.insertBefore(a,b.firstElementChild)),b.appendChild(T),EG(T,e),I.appendChild(b),document.body.appendChild(I),S){var C=ci.one(".dynamsoft-dialog-close",ci.one(I));C&&((C=C[0]).onClose=function(){Zt.removeEventListener(C,"click",C.onClose),C.onClose=null,S()},Zt.addEventListener(C,"click",C.onClose))}if(y?ci.setBackOpacity({opacity:.4,grayHex:0}):ci.setBackOpacity({}),I.bTopmost=!0,s._dlgInstall=I,ci.dialog.setup(s._dlgInstall,!1),de.bIE){var w=document.createElement("iframe");w.frameborder="0",w.marginheight="0",w.marginwidth="0",w.style.border="0",w.style.backgroundColor="transparent",w.style.position="absolute",w.style.left=0,w.style.top=0,w.style.width="100%",w.style.height=document.body.clientHeight+"px",w.style.margin="0 auto",w.style.zIndex="10000",w.src=["javas","cript:",'""'].join("");var E=ci.one(".dynamsoft-backdrop");if(E&&E.length>0){for(var k=E[0];k.firstChild;)k.removeChild(k.firstChild);k.style.zIndex="10000",k.appendChild(w)}}}else g=!1;var A=ci.one("."+c);if(A&&A.getEL()&&(A[0].style.width=r+"px",Zt.isNumber(n)&&n>0?A[0].style.height=n+"px":A[0].style.height="100%",g||Zt.each(A[0].childNodes,(function(t){if("DIV"==t.tagName&&"dynamsoft-dialog-close"!=t.className&&"dynamsoft-dialog-closeTimer"!=t.className)return EG(t,e),!1}))),_){var x=ci.one(".dynamsoft-dialog");x&&x.getEL()&&(x.getEL().style.border="1px solid #999")}if(s._dlgInstall.open&&s._dlgInstall.close(),s._dlgInstall.showModal({position:p}),s._dlgInstall.bReadyClosed=d,y&&ci.setBackOpacity({}),h){var P=Zt.sizzle(".dynamsoft-dialog-close");Zt.each(P,(function(e,t){Zt.addEventListener(e,"click",wG.CloseDialog)})),P.length>0&&i&&f>0&&setTimeout(Qt._zdgb_xkz_dhk,100)}},wG.OnWebTwainPreExecute||(wG.OnWebTwainPreExecute=function(e,t){var r,n,i=rr.DWT.IfConfineMaskWithinTheViewer;if(i&&(e&&(n=e._containerElement),n||rr.DWT.Containers&&rr.DWT.Containers.length>0&&rr.DWT.Containers[0].ContainerId&&(n=Zt.get(rr.DWT.Containers[0].ContainerId)),n)){r=n.getBoundingClientRect();for(var o=0;o<n.children.length;o++){var a=n.children[o];if(a&&"dvs-root dvs-web-viewer"==a.className){for(a=a.firstElementChild;a;){if(Zt.isFunction(a.getBoundingClientRect)){r=a.getBoundingClientRect();break}a=a.nextSibling}n=a;break}}}(n===document.body||r==undefined||rr.DWT.Containers&&rr.DWT.Containers.length>1||rr.DWT.Containers&&1==rr.DWT.Containers.length&&(0==r.width||0==r.height))&&(i=!1,n=null);var s=null!=t?t:{};i&&(s={confined:i,wrapperEl:n}),Qt.showMask(s)}),wG.OnWebTwainPostExecute||(wG.OnWebTwainPostExecute=function(){ci.hideMask()});function EG(e,t){document.body&&ci.setHtml(e,t)}function kG(e,t){(function(e,t){if(t.has(e))throw new TypeError("Cannot initialize the same private elements twice on an object")})(e,t),t.add(e)}function AG(e,t,r){if("function"==typeof e?e===t:e.has(t))return arguments.length<3?t:r;throw new TypeError("Private element is not present on this object")}window.DCP_DWT_OnClickCloseInstall=function(e,t){t||rr.DWT.CloseDialog();var r=Zt.get(Qt.install._divDWTNonInstallContainerID);if(r&&r.parentNode&&r.parentNode.removeChild(r),e&&Zt.isDOM(e)&&Zt.show(e),e&&Zt.isString(e))Zt.show(e);else{var n=rr.DWT.WebTwainIdMap;if(n){var i,o,a=Object.keys(n);for(i=0;i<a.length;i++)n[o=a[i]]._containerElement&&Zt.show(n[o]._containerElement)}}""!=Qt.install._divDWTemessageContainer&&Zt.show(Qt.install._divDWTemessageContainer)},Qt._zdgb_xkz_dhk=function(){var e=Qt.install._dlgInstall;if(e){var t=Zt.sizzle(".dynamsoft-dialog-closeTimer",e);if(t.length>0){var r=t[0],n=parseInt(r.style.width);(n-=1)<=0?rr.DWT.CloseDialog():(r.style.width=n+"%",setTimeout(Qt._zdgb_xkz_dhk,100))}}},Qt.ShowLicenseDialog=rr.DWT.ShowMessage,Qt.createLoadingBarContent=function(){};var xG=new WeakSet,PG=function(e){function t(e){var r;return o(this,t),kG(r=i(this,t,[e]),xG),r}return f(t,e),s(t,[{key:"_getWSContextData",value:function(){return{document:this._getCurrentDocumentName(),tag:this._getCurrentDefaultTagName(),bNeedClearTag:!1}}},{key:"_getErrorString",value:function(){var e=this;return-2207==e._errorCode&&e._bMustUpgradeService&&Ca(e),0!=e._errorCode?e._errorString:"Successful."}},{key:"_getWebTwainId",value:function(){return this._id}},{key:"_isTwainServiceType",value:function(){return!0}},{key:"_isPC",value:function(){return de.bWin||de.bMac||de.bLinux}},{key:"_serviceSyncMethodNotSupport",value:function(e){var t=this;return ha(t,-2605,'The synchronized method "'+e+'" is not supported under the current settings.'),{code:t._errorCode,message:t._getErrorString()}}},{key:"_serviceAsyncMethodNotSupport",value:function(e){var t=this;return ha(t,-2606,'The asynchronized method "'+e+'" is not supported under the current settings.'),{code:t._errorCode,message:t._getErrorString()}}},{key:"_serviceNotSupportAsync",value:function(e){var t=this;return ha(t,-2397,e+" doesn't work under current settings."),ci.Promise.reject({code:t._errorCode,message:t._getErrorString()})}},{key:"_nouiNotSupport",value:function(e,t){var r=this;return ha(r,-2210,"You cannot call this method on this WebTwain instance because it does not use the default viewer."),Zt.isFunction(t)&&t(r._errorCode,r._getErrorString()),!1}},{key:"_innerFunRaw",value:function(e,t,r,n,i,o,a){var s,u,c,l,d=this,f="f/",h=r;if(h&&(f="fa/"),rr.DWT.ConnectWithSocket)this._sendData(e,t,!1,o,a);else{if(d._resetErr(),!d._isValid())return!!h&&void 0;var g=Zd.isServerInvalid(d);if(h&&g)return d._waitForConnect().then((function(){return d._innerFunRaw(e,t,h,n,i,o,a)}));if(!h&&g)return fs(d),!1;if(c={method:"POST",url:s=[d._httpUrl,f,e].join(""),data:u=rf(d._clientId,e,t,0,d._bScanForProxyRemote),async:h,onSuccess:function(e,t,r){var n=!1;try{n=Zt.isString(e)&&da(r.getResponseHeader("content-type"))?Zt.parse(e):e}catch(Mj){}n?(eu(n)?(d._errorCode=n.exception,d._errorString=n.description):d._resetErr(),l=i?n:n.result):(Aa(d),l=""),Zt.isFunction(o)&&o(l),h&&(l=null)},onError:function(){ka(d),l="",!Qt.page.bUnload&&Zt.isFunction(a)&&a()}},!h&&n)de.bIE?(c.dataType="arraybuffer",c.onSuccess=function(e,t,r){var n,i,a,s=!1;r.responseHeadersString&&(la(r.responseHeadersString)&&(s=!0));if(n=r.responseData,d._resetErr(),l=!1,n&&(i=new Uint8Array(n),s?n=String.fromCharCode.apply(null,i):(l=new Blob([i],{type:d._strHttpContentTypeFieldValue}),(a=new pG.ArrayBuffer).append(i),l.md5=a.end())),!n||s){var u,c=!1;if((u=s?n:r.responseText).length>0){if("{"==u.charAt(0))try{c=Zt.parse(u),s=!0}catch(f){Zt.log(u)}s?eu(c)?(d._errorCode=c.exception,d._errorString=c.description,l=!1):l=!0:(i=new Uint8Array(u),l=new Blob([i],{type:d._strHttpContentTypeFieldValue}),(a=new pG.ArrayBuffer).append(i),l.md5=a.end())}}Zt.isFunction(o)&&o(l)}):(h||(c.dataType="text",c.contentType="text/plain; charset=x-user-defined",c.mimeType="text/plain; charset=x-user-defined"),c.onSuccess=function(e,t,r){var n,i,a;if(d._resetErr(),(i=(n=r.responseText).length)>0){var s,u=!1;if("{"==n.charAt(0))try{s=Zt.parse(n),u=!0}catch(h){Zt.log(n)}if(u)eu(s)?(d._errorCode=s.exception,d._errorString=s.description,l=!1):l=!0;else{a=new Uint8Array(i);for(var c=0;c<i;c++)a[c]=n.charCodeAt(c);l=new Blob([a],{type:d._strHttpContentTypeFieldValue});var f=new pG.ArrayBuffer;f.append(a),l.md5=f.end()}}else l="";Zt.isFunction(o)&&o(l)});else if(h&&n){c={method:"POST",body:u},de.bIE?c.dataType="arraybuffer":c.fetchRaw=!0;var m=Hs(s,c);return de.bIE||(m=m.then((function(e){var t=e.headers.get("content-type");return t.indexOf("image/")>=0||t.indexOf("application/octet-stream")>=0?e.arrayBuffer():e.json()}))),m=m.then((function(e){if(d._resetErr(),bl(e))return Zt.isFunction(o)&&o(e),void(e=null);if(Zt.isObject(e)){var t=e;if(eu(t))d._errorCode=t.exception,d._errorString=t.description,Zt.isFunction(a)&&a();else{var r="";t.result&&(r=t.result),Zt.isFunction(o)&&o(r)}}else ka(d),!Qt.page.bUnload&&Zt.isFunction(a)&&a()}),(function(e){ka(d),!Qt.page.bUnload&&Zt.isFunction(a)&&a()})),!0}if(h||Zt.mix(c,{headers:{"X-Requested-With":!1}}),de.bFileSystem&&(c.crossDomain=!1),Vi(c),!h)return l}}},{key:"_innerSendCmd",value:function(e,t){this._innerFunRaw(e,t,!0,!1,!0)}},{key:"_innerFun",value:function(e,t){var r;return r=this._innerFunRaw(e,t,!1,!1,!1),Zt.isArray(r)?r[0]:r}},{key:"__OnRecieveMsg",value:function(e,r){var n=this,i=null==r?void 0:r.cmd;if(e.event)return l(d(t.prototype),"__OnRecieveMsg",this).call(this,e,r);if(rr.DWT.ConnectWithSocket)return l(d(t.prototype),"__OnRecieveMsg",this).call(this,e,r);if(eu(e)?(n._errorCode=e.exception,n._errorString=e.description):"StartScan"!=i&&"GetAddOnVersion"!=i&&(n._errorCode=0,n._errorString=""),"ReadBarcode"==i||"OCRRecognize"==i||e.request&&"OCRProRecognize"==e.request.method)return r.sFun?r.sFun(e):r.fFun&&r.fFun(e),!0;if("ActiveUI"==i||"VersionInfo"==i||"ConvertToBase64"==i||"SaveSelectedImagesToBase64Binary"==i||"ConvertToBlob"==i||"BeginSaveMem"==i)return r.sFun&&Zt.isArray(e.result)&&e.result.length>0?r.sFun(e.result):r.fFun&&r.fFun(e.result),!0;if("ShowFileDialog"==i||"SplitTiff"==i||"SplitPDF"==i||"EncodeAsBase64"==i||"ProductKey"==i||"GetSourceNames"==i||"GetSkewAngle"==i||"GetImageInfo"==i||"GetSkewAngleFromBinary"==i)return r.sFun?r.sFun(e.result):r.fFun&&r.fFun(e.result),!0;if("SetCapabilities"==i)return l(d(t.prototype),"__OnRecieveMsg",this).call(this,e,r);if(e.result&&e.result.length&&("1"==e.result[0]||1==e.result[0]||"ok"==e.result[0]))(r.sFun||r.sFun)&&r.sFun(r.rawData?e:e.result);else{if(!e.exception)return r.sFun&&r.sFun(e.result),e=null,!0;var o=!1;r.fFun&&(o=r.fFun(n._errorString)),!o&&e.exception&&e.exception<0&&-2115!=e.exception&&Zt.isFunction(n.__OnPrintMsg)&&n.__OnPrintMsg(n._errorString)}return!0}},{key:"OnRefreshUI",value:function(e,t,r,n){return this._innerRefreshUI(e,t,r,n)}},{key:"GetCurrentDocumentName",value:function(){return this._resetErr(),!!this._isValid()&&this._getCurrentDocumentName()}},{key:"RegisterEvent",value:function(e,t){return!!this.registerEvent(e,t)}},{key:"UnregisterEvent",value:function(e,t){return this.unregisterEvent(e,t)}},{key:"onEvent",value:function(e,t){this.registerEvent(e,t)}},{key:"on",value:function(e,t){this.registerEvent(e,t)}},{key:"_OnConsumed",value:function(e){}},{key:"_OnPostLoad",value:function(e,t){var r,n,i,o,a=this;t!==undefined&&t.exception!==undefined&&t.description!==undefined&&(a._errorCode=t.exception,a._errorString=t.description),Zt.log("OnPostLoad Results:"),n=e[1].split(","),r=Zt.base64.decode(n[0]),i=Zt.base64.decode(n[1]),Zt.log(r),Zt.log(i),Zt.log(n[2]),RG(a,"On PostLoad"),(o=a._ImgManager.getCurrentImageIndex())>=0&&a._innerRefreshUI(o),Zt.isFunction(a.__OnPostLoad)&&a.__OnPostLoad(r,i,n[2])}},{key:"_OnPostTransfer",value:function(e){var t=this;if(Zt.log("On PostTransfer Results:"+e),RG(t,"On PostTransfer"),Zt.isFunction(t.__OnPostTransfer))try{t.__OnPostTransfer()}catch(r){Ho(r)}}},{key:"_OnPreAllTransfersAsync",value:function(e){var t=this;if(Zt.isFunction(t.__OnPreAllTransfersAsync)){var r={event:"beforeAcquire",result:{}};try{Zt.isArray(e)&&e.length>1&&(r=Zt.parse(e[1]))}catch(jj){}setTimeout((function(){try{t.__OnPreAllTransfersAsync(r)}catch(e){Ho(e)}}),10)}}},{key:"_OnPostAllTransfers",value:function(e){var t=this;if(e.length>=2&&0==t._errorCode&&(t._errorCode=e[1],t._errorString=e[2]),Zt.log("On PostAllTransfers Results:"+e),t.__bLoadingImage=!1,t.__bAcquireImageNow=!1,t.__closeRemoteScanUI(!0),Zt.isFunction(t.__OnPostAllTransfers))try{t.__OnPostAllTransfers()}catch(r){Ho(r)}}},{key:"_OnResult",value:function(e){var t=e[1];if(Zt.isFunction(this.__OnResult))try{this.__OnResult(t)}catch(r){Ho(r)}}},{key:"_OnTransferCancelled",value:function(e){var t=this;if(t._ImgManager.getCurrentImageIndex(),t._ImgManager.count(),t.__bLoadingImage=!1,t.__bAcquireImageNow=!1,Zt.isFunction(t.__OnTransferCancelled))try{t.__OnTransferCancelled()}catch(r){Ho(r)}}},{key:"_OnTransferError",value:function(e){if(Zt.isFunction(this.__OnTransferError))try{this.__OnTransferError()}catch(t){Ho(t)}}},{key:"_OnSourceUIClose",value:function(e){var t=this;if(t.__closeRemoteScanUI(!0),Zt.isFunction(t.__OnSourceUIClose))try{t.__OnSourceUIClose()}catch(r){Ho(r)}}},{key:"_OnPreTransfer",value:function(e){if(Zt.isFunction(this.__OnPreTransfer))try{this.__OnPreTransfer()}catch(t){Ho(t)}}},{key:"_OnPreAllTransfers",value:function(e){if(Zt.isFunction(this.__OnPreAllTransfers))try{this.__OnPreAllTransfers()}catch(t){Ho(t)}}},{key:"_OnGetFilePath",value:function(e){var t,r,n,i=this;if(t=e[1].split(","),Zt.log("On GetFilePath Results:"+e),r=Zt.base64.decode(t[3]),n=Zt.base64.decode(t[4]),"-1032"==t[2]&&(t[2]="-1",r=n=""),Zt.isFunction(i.__OnGetFilePath))try{i.__OnGetFilePath(1*t[0]>0,1*t[1],1*t[2],r,n)}catch(o){Ho(o)}i.__bOpenFileNow=!1}},{key:"_OnDiskExceedLimit",value:function(){Zt.isFunction(this.__OnDiskExceedLimit)&&this.__OnDiskExceedLimit()}},{key:"__GetLoadEventsNum",value:function(){var e=0;return Zt.isFunction(this.__OnPostLoad)&&(e|=1),Zt.isFunction(this.__OnGetFilePath)&&(e|=2),e}},{key:"_innerSend",value:function(e,t,r,n,i){var o=this;if(rr.DWT.ConnectWithSocket||"SaveSelectedImagesToBytes"!=e&&"ConvertToBlob"!=e)return this._sendData(e,t,r,n,i);var a=Pl(),s=rf(o._clientId,e,t,a,o._bScanForProxyRemote);return o._innerFunRaw(e,s,!0,!0,!0,n,i),ci.Promise.resolve(!0)}},{key:"_convertToBlobByIndices",value:function(e,t,r,n,i,o){var a=this,s=!1,u=function(e){Zt.isFunction(o)&&xf(o,a,e,t,n),e=null};if(Zt.isFunction(i)&&(s=!0),a._resetErr(),!a._isValid())return u(e),!!s&&void 0;var c=parseInt(t);if(!Wc.checkProductKey(a,{Core:!0}))return u(e),!!s&&void 0;if(!a._checkIndices(e))return u(e),!!s&&void 0;if(c==rr.DWT.EnumDWT_ImageType.IT_BMP||c==rr.DWT.EnumDWT_ImageType.IT_JPG||c==rr.DWT.EnumDWT_ImageType.IT_PNG||c==rr.DWT.EnumDWT_ImageType.IT_J2K){if(e.length>1)return ha(a,-2372,"You cannot convert more than one image to binary when the format is BMP, JPG or PNG."),u(e),!!s&&void 0}else if(c!=rr.DWT.EnumDWT_ImageType.IT_TIF&&c!=rr.DWT.EnumDWT_ImageType.IT_PDF)return Qa(a),u(e),!!s&&void 0;var l=Ef(a,e);return 0==l.length?(ya(a),u(e),!!s&&void 0):s?(Qt.cancelFrom=rG.ConvertToBlob,void a._innerConvertToBlobWithUI("ConvertToBlob",c,l,r,(function(e,r){Zt.isFunction(i)&&kf(i,e,r,t,n),e=r=null}),u)):AG(xG,a,DG).call(a,l,c,r)}},{key:"_getDefaultDevice",value:function(){var e=this;if(e._resetErr(),!e._isValid())return null;var t="",r=Tl.TWAINSCANNER,n=e._innerFun("GetDefaultSourceName");if(n.length>0)try{var i=JSON.parse(n);r=i.type,t=Zt.base64.decode(i.ProductName)}catch(a){t=""}var o=new Id;return o.name=t,o.deviceType=r,o.isSystemDefaultPrinter=!1,Cd(o),o}},{key:"_OnCurrentDeviceSelected",value:function(e,t){var r,n,i=this;if(e&&e.length>=2)try{n=parseInt(e[0]);var o=String(e[1]);(r=Td(this,o)).strDevice=o,i._curDevice=r}catch(s){Zt.error(s)}var a=!1;if(Zt.isFunction(i.__OnCurrentDeviceSelected))try{a=i.__OnCurrentDeviceSelected(r,n)}catch(u){Ho(u)}return a}},{key:"_getDefaultDeviceAsync",value:(_=n(g().mark((function y(){var e,t,r,n,i,o;return g().wrap((function(a){for(;;)switch(a.prev=a.next){case 0:if((e=this)._resetErr(),e._isValid()){a.next=4;break}return a.abrupt("return",null);case 4:return t="",r=Tl.TWAINSCANNER,a.next=8,e._sendDataByHttpAsync("GetDefaultSourceName");case 8:if((n=a.sent).length>0)try{i=JSON.parse(n),r=i.type,t=Zt.base64.decode(i.ProductName)}catch(s){t=""}return(o=new Id).name=t,o.deviceType=r,o.isSystemDefaultPrinter=!1,r==Tl.TWAINX64SCANNER&&t.length>0?o.displayName="Twain64-"+t:r==Tl.ICASCANNER&&this.__serverPlatform==Lo.enumMac&&t.length>0?o.displayName="ICA-"+t:o.displayName=t,a.abrupt("return",o);case 16:case"end":return a.stop()}}),y,this)}))),function(){return _.apply(this,arguments)})},{key:"_getSources",value:function(e,t,r){return bd(this,this._innerFun("GetSources",Il(e,null!=t&&t,null!=r&&r)))}},{key:"_getSourceCountAsync",value:(v=n(g().mark((function S(e){var t,r,n,i,o,a,s;return g().wrap((function(u){for(;;)switch(u.prev=u.next){case 0:if((t=this)._resetErr(),t._isValid()){u.next=4;break}return u.abrupt("return",ci.Promise.reject({code:t._errorCode,message:t._errorString}));case 4:return AG(xG,t,FG).call(t),Wl("GetSourceCountAsync",t),r=[],u.prev=7,e&&(t._driverType=e),n=di,i=di,o=di,a=di,t._bRemoteMode?t.__serverPlatform==Lo.enumWindow?o=!0:t.__serverPlatform==Lo.enumLinux?i=!0:t.__serverPlatform==Lo.enumMac?n=!0:t.__serverPlatform==Lo.enumAndroid&&(a=!0):(n=de.bMac,i=de.bLinux,o=de.bWin,a=de.bAndroid),s=_f(t._driverType,o,i,n,a),u.next=15,this._getDevices(s,!0,void 0);case 15:r=u.sent,u.next=21;break;case 18:throw u.prev=18,u.t0=u["catch"](7),u.t0;case 21:return u.prev=21,Rl("GetSourceCountAsync"),u.finish(21);case 24:return u.abrupt("return",t._setDevices(r));case 25:case"end":return u.stop()}}),S,this,[[7,18,21,24]])}))),function(e){return v.apply(this,arguments)})},{key:"_setDevices",value:function(e){var t,r=this;return r.__devices=e,t=e.length,r.__sourceCount=t,t<=0?(r.__defaultSourceName="",r.__sourceCount=0,0):t}},{key:"_getSourceNameByIndex",value:function(e){var t=this.__devices.length;return e<0||e>=t?"":this.__devices[e].displayName}},{key:"_dwtConvertToBlobSync",value:function(e,t,r,n,i,o){var a=this,s=r,u=",";Zt.isString(s)&&""!=s||(s="",u="");var c=["[",e,',"',t.join(","),'"',u,s,"]"].join(""),l=a._innerFunRaw("ConvertToBlob",c,!1,!0,!1),d="";if(0==a._errorCode){l&&"md5"in l&&(d=l.md5);var f=!0;return Zt.isFunction(n)&&(f=n(l,d,o)),f}return Zt.isFunction(i)&&Af(i,a),!1}},{key:"_getSourceCountSync",value:function(){var e,t=this,r=di,n=di,i=di,o=di;if(t._bRemoteMode?t.__serverPlatform==Lo.enumWindow?i=!0:t.__serverPlatform==Lo.enumLinux?n=!0:t.__serverPlatform==Lo.enumMac?r=!0:t.__serverPlatform==Lo.enumAndroid&&(o=!0):(r=de.bMac,n=de.bLinux,i=de.bWin,o=de.bAndroid),e=_f(this._driverType,i,n,r,o),t._resetErr(),!t._isValid())return 0;if(!Wc.checkProductKey(t,{Core:!0}))return 0;AG(xG,t,FG).call(t);var a=t._getSources(e,true,undefined);return t._setDevices(a)}},{key:"_OnActiveUI",value:(p=n(g().mark((function I(e){var r;return g().wrap((function(n){for(;;)switch(n.prev=n.next){case 0:return r=this,e&&e.length>2&&(r.__strProductName=e[2]),n.next=4,l(d(t.prototype),"_OnActiveUI",this).call(this,e);case 4:return n.next=6,r._setConvertModeAsync(r._pdfConvertMode)["catch"]((function(){}));case 6:case"end":return n.stop()}}),I,this)}))),function(e){return p.apply(this,arguments)})},{key:"_OnReady",value:(m=n(g().mark((function b(){var e,r,n,i,o;return g().wrap((function(a){for(;;)switch(a.prev=a.next){case 0:return ca((e=this)._serverInfo.server)&&(Dd.item("DWT_port",e._serverInfo.port),Dd.item("DWT_ssl",e._serverInfo.ssl?"true":"false")),e._bNoMask||Wl("OnReady",e),a.prev=3,a.next=6,l(d(t.prototype),"_OnReady",this).call(this);case 6:if(!ua()){a.next=12;break}if(e._uuidForActiveUI){a.next=12;break}return a.next=10,rr.DWT.lgcuid(rr.DWT.lgdt(),"");case 10:r=a.sent,e._uuidForActiveUI=r;case 12:return a.next=14,e._innerActiveUI(e._uuidForActiveUI);case 14:return n=a.sent,a.next=17,e._OnActiveUI(n);case 17:if(Xu("Changing Map..."),(i=e._id)&&!rr.DWT.WebTwainIdMap[i]&&(rr.DWT.WebTwainIdMap[i]=e),CG(e),o=!1,e._bRemoteMode||(o=Qt.attachAddon(e)),rr.DWT.IfDisableDefaultSettings){a.next=29;break}return Xu("Configuring the WebTwain instance..."),a.next=27,NG(e);case 27:a.next=32;break;case 29:if(!o){a.next=32;break}return a.next=32,new ci.Promise((function(e){setTimeout(e,300)}));case 32:a.next=39;break;case 34:throw a.prev=34,a.t0=a["catch"](3),a.t0&&(e._errorCode=a.t0.code,e._errorString=a.t0.message),e.dispose(),a.t0;case 39:return a.prev=39,e._bNoMask||Rl("OnReady"),a.finish(39);case 42:case"end":return a.stop()}}),b,this,[[3,34,39,42]])}))),function(){return m.apply(this,arguments)})},{key:"_OnWSClose",value:function(e){l(d(t.prototype),"_OnWSClose",this).call(this,e),Qt.detect.bOK=!1;this.__bAcquireImageNow=!1}},{key:"_OnWSTimeout",value:function(e){l(d(t.prototype),"_OnWSTimeout",this).call(this,e),Qt.detect.bOK=!1}},{key:"_setConvertModeAsync",value:function(e){var t,r=this,n=1*e;return isNaN(n)?(Ws(r),ci.Promise.reject({code:r._errorCode,message:r._errorString})):r._checkConvertModeInner(n)?(t=this._mixSavedPdfReaderOptions({convertMode:n,renderOptions:{renderAnnotations:!!r._pdfOptions.renderOptions.renderAnnotations}}),r._resetPdfOptionsWhenSetConvertMode(t),AG(xG,r,WG).call(r,t,n)):ci.Promise.reject({code:r._errorCode,message:r._errorString})}},{key:"_OnReconnected",value:(h=n(g().mark((function T(){var e;return g().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return e=this,t.next=3,AG(xG,e,WG).call(e,e._pdfOptions);case 3:case"end":return t.stop()}}),T,this)}))),function(){return h.apply(this,arguments)})},{key:"_getConvertMode",value:function(){return this._pdfConvertMode}},{key:"_setConvertMode",value:function(e){var t,r=this,n=1*e;if(isNaN(n))return Ws(r),!1;if(!r._checkConvertModeInner(n))return!1;t=this._mixSavedPdfReaderOptions({convertMode:n,renderOptions:{renderAnnotations:!!r._pdfOptions.renderOptions.renderAnnotations}}),r._resetPdfOptionsWhenSetConvertMode(t);var i=r._setReaderOptions(t,!1);return i&&(r._pdfConvertMode=n,r._pdfOptions.convertMode=t.convertMode,r._pdfOptions.renderOptions.renderAnnotations=t.renderOptions.renderAnnotations,r._pdfOptions.convertMode==nc.CM_IMAGEONLY&&r._pdfConvertMode==nc.CM_RENDERALL||r._pdfOptions.convertMode==nc.CM_IMAGEONLY&&r._pdfConvertMode==nc.CM_RENDERALLWITHANNOTATION)?(r._pdfConvertMode=nc.CM_IMAGEONLY,Va(r),!1):i}},{key:"_checkConvertModeInner",value:function(e){var t=this;return!!Wc.checkProductKey(t,{Core:!0})&&(t._resetErr(),!!t._isValid()&&(e==nc.CM_RENDERALL||e==nc.CM_IMAGEONLY||e==nc.CM_AUTO||e==nc.CM_RENDERALLWITHANNOTATION||(Ws(t),!1)))}},{key:"_resetPdfOptionsWhenSetConvertMode",value:function(e){var t=e.convertMode;t==nc.CM_IMAGEONLY||Wc.hasPDFRProductKey(this)?e.convertMode=t:e.convertMode=nc.CM_IMAGEONLY,e.convertMode==nc.CM_IMAGEONLY||e.convertMode==nc.CM_RENDERALL?e.renderOptions.renderAnnotations=!1:e.convertMode==nc.CM_RENDERALLWITHANNOTATION&&(e.renderOptions.renderAnnotations=!0)}},{key:"_checkPDFPasswordValue",value:function(e){if(!Zt.isUndefined(e)){if(!Zt.isString(e))return ha(this,-2852,"The password is not a string."),!1;if(e.length>32)return function(e){ha(e,-2851,"The password must not exceed 32 characters in length.")}(this),!1}return!0}},{key:"_mixSavedPdfReaderOptions",value:function(e){var t;return t=Zt.clone(this._pdfOptions),e||(e={}),e.convertMode&&(t.convertMode=e.convertMode),Zt.isString(e.password)?t.password=e.password:Zt.isNumber(e.password)&&(t.password=""+e.password),e.renderOptions&&(t.renderOptions=Zt.mix(this._pdfOptions.renderOptions,e.renderOptions)),t}},{key:"_setReaderOptions",value:function(e,t){var r,n,i=this,o=-1;if(i._resetErr(),e&&e.renderOptions){var a=e.renderOptions.resolution,s=e.renderOptions.maxWidth,u=e.renderOptions.maxHeight,c=e.renderOptions.renderGrayscale;if(!Zt.isUndefined(a)&&(!rr.Lib.isNumber(a)||a<=0))return ha(i,-2830,"The PDF resolution must be a positive number."),!1;if(!Zt.isUndefined(s)&&(!rr.Lib.isNumber(s)||s<0))return function(e){ha(e,-2831,"The PDF max width must be a positive number.")}(i),!1;if(!Zt.isUndefined(u)&&(!rr.Lib.isNumber(u)||u<0))return function(e){ha(e,-2832,"The PDF max height must be a positive number.")}(i),!1;if(!Zt.isUndefined(c)&&!rr.Lib.isBoolean(c))return function(e){ha(e,-2833,"The PDF render grayscale must be a boolean.")}(i),!1}if(t){r={},e||(e={}),e.convertMode?r.convertMode=e.convertMode:r.convertMode=nc.CM_AUTO,o=r.convertMode,Zt.isString(e.password)?r.password=e.password:Zt.isNumber(e.password)?r.password=""+e.password:r.password="",r.renderOptions=Zt.mix({renderAnnotations:!1,resolution:200,maxWidth:0,maxHeight:0,renderGrayscale:!1},e.renderOptions);var l=r.renderOptions.renderAnnotations;Zt.isBoolean(l)||Zt.isString(l)&&(r.renderOptions.renderAnnotations="true"==l.toLowerCase());var d=r.renderOptions.renderGrayscale;if(Zt.isBoolean(d)||Zt.isString(d)&&(r.renderOptions.renderGrayscale="true"==d.toLowerCase()),Zt.isNumber(r.convertMode)){if(!i._checkConvertModeInner(r.convertMode))return!1;Wc.hasPDFRProductKey(i)||(r.convertMode=nc.CM_IMAGEONLY),r.convertMode==nc.CM_IMAGEONLY?r.renderOptions.renderAnnotations=!1:r.convertMode==nc.CM_RENDERALLWITHANNOTATION&&(r.renderOptions.renderAnnotations=!0)}}else{if(Zt.isUndefined(e))return function(e){ha(e,-2834,"The PDF reader options is invalid.")}(i),!1;if(r=e,Zt.isString(e.password)||Zt.isUndefined(e.password));else{if(!Zt.isNumber(e.password))return function(e){ha(e,-2829,"The type of the PDF password must be a string.")}(i),!1;e.password=""+e.password}}var f=i._getPdfDllname();n=["[",Zt.stringify(r),',"',f,'"',"]"].join("");var h=i._innerFun("SetPDFReaderOptions",n);return h&&t&&(i._pdfOptions=Zt.clone(r),Zt.isNumber(r.convertMode)&&(r.convertMode==nc.CM_RENDERALL&&r.renderOptions.renderAnnotations&&(r.convertMode=nc.CM_RENDERALLWITHANNOTATION),i._pdfConvertMode=r.convertMode,i._pdfOptions.convertMode==nc.CM_IMAGEONLY&&o==nc.CM_RENDERALL||i._pdfOptions.convertMode==nc.CM_IMAGEONLY&&o==nc.CM_RENDERALLWITHANNOTATION))?(i._pdfConvertMode=nc.CM_IMAGEONLY,Va(i),!1):h}},{key:"_getPdfDllname",value:function(){var e=this,t=!1,r=!1;return e._bRemoteMode?e.__serverPlatform==Lo.enumWindow||(e.__serverPlatform==Lo.enumLinux?r=!0:e.__serverPlatform==Lo.enumMac&&(t=!0)):(t=de.bMac,r=de.bLinux,de.bWin),t?e._b64bit?"libDynamicPdfCorex64_"+Jo.PdfVersion+".dylib":"libDynamicPdfCore_"+Jo.PdfVersion+".dylib":r?"libDynamicPdfCore_"+Jo.PdfVersion+".so":e._b64bit?"DynamicPdfCorex64_"+Jo.PdfVersion+".dll":"DynamicPdfCore_"+Jo.PdfVersion+".dll"}},{key:"_unload_viewer",value:function(){}},{key:"__innerDeleteInMap",value:function(){return this._id,delete rr.DWT.WebTwainIdMap[this._id],fi}},{key:"__unload",value:(c=n(g().mark((function C(){var e,t,r,n;return g().wrap((function(i){for(;;)switch(i.prev=i.next){case 0:if(e=this,t=Zt.clone(rr.DWT.licenseException),e.__closeRemoteScanUI(!0),!e._destroy&&!e._destroying){i.next=5;break}return i.abrupt("return");case 5:if(e._destroying=!0,this.__innerDeleteInMap(),e.__addon&&e.__addon.Camera&&e.__addon.Camera._viewer&&(""!=e.__addon.Camera.getStatus()&&e.__addon.Camera.closeSource()["catch"]((function(){})),e.__addon.Camera._viewer.dispose(),e.__addon.Camera._viewer=null),e._unload_viewer(),e._containerElement=null,e._ImgManager&&e._ImgManager.clear(),!e._bReady||Qt.page.bUnload){i.next=20;break}if(!e._wsClient){i.next=20;break}return i.prev=13,i.next=16,e._innerDisposeWSClient();case 16:i.next=20;break;case 18:i.prev=18,i.t0=i["catch"](13);case 20:if(!e._wsClient){i.next=34;break}return e._wsClient.removeEvent("close",e._clientId),e._wsClient.removeEvent("error",e._clientId),e._wsClient.removeEvent("timeout",e._clientId),i.prev=24,i.next=27,e._wsClient.dispose();case 27:i.next=32;break;case 29:i.prev=29,i.t1=i["catch"](24),r=i.t1;case 32:delete e._wsClient,e._wsClient=null;case 34:if(e._bReady=!1,rr.DWT.lremoveDWTObj(e),e.__bAcquireImageNow=!1,e._destroying=!1,e._destroy=!0,(n=rr.DWT.licenseException).code=t.code,n.message=t.message,n.fromLTS=t.fromLTS,!r){i.next=45;break}throw r;case 45:case"end":return i.stop()}}),C,this,[[13,18],[24,29]])}))),function(){return c.apply(this,arguments)})},{key:"_setIfShowUI",value:function(e){this._resetErr(),this._isValid()&&(Zt.isBoolean(e)?this._innerFun("IfShowUI",Il(e)):Sa(self))}},{key:"_setIfShowFileDialog",value:function(e){this._resetErr(),this._isValid()&&(Zt.isBoolean(e)?this._innerFun("IfShowFileDialog",Il(e)):Sa(self))}},{key:"_getDevicesAsync",value:(u=n(g().mark((function w(e,t,r,n){var i,o,a,s,u;return g().wrap((function(c){for(;;)switch(c.prev=c.next){case 0:if(i=this,o=[],!t||Zt.isNumber(t)){c.next=4;break}return rs(i),c.abrupt("return",ci.Promise.reject({code:i._errorCode,message:i._errorString}));case 4:if(a=i._bRemoteMode?wl:de.bAndroid?kl:wl,s=null!=t?t:a,i._resetErr(),i._isValid()){c.next=8;break}return c.abrupt("return",ci.Promise.reject({code:i._errorCode,message:i._errorString}));case 8:return Wl(e,i),c.prev=9,c.next=12,i._getDevices(s,r,n);case 12:u=c.sent,Zt.isArray(u)&&u.length>0&&(o=o.concat(u)),c.next=19;break;case 16:throw c.prev=16,c.t0=c["catch"](9),c.t0;case 19:return c.prev=19,Rl(e),c.finish(19);case 22:return o.length>0&&this._setDevices(o),c.abrupt("return",o);case 24:case"end":return c.stop()}}),w,this,[[9,16,19,22]])}))),function(e,t,r,n){return u.apply(this,arguments)})},{key:"_openSourceAsync",value:function(e){var t=this;return t._resetErr(),t._isValid()?(t._bRemoteMode&&t._initRemoteDiv(),t._innerFunV2("OpenSource").then((function(e){return t.__closeRemoteScanUI(!0),e}),(function(e){return t.__closeRemoteScanUI(!0),ci.Promise.reject(e)}))):ci.Promise.reject({code:t._errorCode,message:t._errorString})}},{key:"_closeSourceAsync",value:function(e){var t=this;return t._resetErr(),t._isValid()?t._innerFunV2("CloseSource").then((function(){return t._curDevice=null,!0})):ci.Promise.reject({code:t._errorCode,message:t._errorString})}},{key:"_selectSourceAsync",value:function(e,t,r){var n=this;return n._resetErr(),n._isValid()?n._getDevicesAsync(e,t).then((function(t){var i,o,a=document,s=t?t.length:0;ci.dialog.selectsourcedlg&&(ci.dialog.selectsourcedlg.close(),document.body.removeChild(ci.dialog.selectsourcedlg),ci.dialog.selectsourcedlg=!1);var u,c,l,d,f=-1;for((o=a.createElement("dialog")).className="dynamsoft-dialog-selectsource",de.bIE&&(o.style.width="300px"),o.setAttribute("closed","closed"),(u=[]).push('<ul id="dynamsoft-dialog-selectsource-sourcelist-ul">'),i=0;i<s;i++){var h="",g=n._getSourceNameByIndex(i);(""==n.__defaultSourceName&&0==i||n.__defaultSourceName==g)&&(h=" dynamsoft-dialog-selectsource-sourcelist-li-selected",f=i),u.push('<li class="dynamsoft-dialog-selectsource-item'+h+'" sourceindex="'+i+'">'+g+"</li>")}return u.push("</ul>"),u=u.join(""),Zt.isArray(r)&&r.length>=3?(c=r[0],l=r[1],d=r[2]):(c="Select Source:",l="Select",d="Cancel"),EG(o,["<p>",c,"</p>",'<div id="dynamsoft-dialog-selectsource-sourcelist">',u,"</div>",'<div><input type="button" value="',l,'" class="dynamsoft-dialog-selectsource-button-select" />','<input type="button" value="',d,'" class="dynamsoft-dialog-selectsource-button-cancel" /></div>'].join("")),ci.dialog.selectsourcedlg=o,a.body.appendChild(ci.dialog.selectsourcedlg),Zt.each(Zt.sizzle(".dynamsoft-dialog-selectsource-item"),(function(e,t){Zt.addEventListener(e,"click",(function(e){for(var t=e.target,r=t.getAttribute("sourceindex"),n=t.parentElement.children,i=0;i<n.length;i++)n[i].className="dynamsoft-dialog-selectsource-item";t.className="dynamsoft-dialog-selectsource-item dynamsoft-dialog-selectsource-sourcelist-li-selected",Zt.get("dynamsoft-dialog-selectsource-sourcelist-ul").setAttribute("selectedSourceIndex",r)}))})),Zt.get("dynamsoft-dialog-selectsource-sourcelist-ul").setAttribute("selectedSourceIndex",f.toString()),ci.dialog.setup(ci.dialog.selectsourcedlg),ci.dialog.selectsourcedlg&&ci.dialog.selectsourcedlg.showModal(),"CSS1Compat"==a.compatMode?a.documentElement.scrollTop:a.body.scrollTop,new ci.Promise((function(t,r){Zt.removeEventListener(ci.one(".dynamsoft-dialog-selectsource-button-select")[0],"click"),Zt.removeEventListener(ci.one(".dynamsoft-dialog-selectsource-button-cancel")[0],"click"),s>0&&Zt.addEventListener(ci.one(".dynamsoft-dialog-selectsource-button-select")[0],"click",(function(){var r=parseInt(Zt.get("dynamsoft-dialog-selectsource-sourcelist-ul").getAttribute("selectedSourceIndex"));r<0||n._selectSourceByIndexAsync(e,r).then((function(){ci.dialog.selectsourcedlg&&(ci.dialog.selectsourcedlg.close(),document.body.removeChild(ci.dialog.selectsourcedlg),ci.dialog.selectsourcedlg=!1),t(r)}))})),Zt.addEventListener(ci.one(".dynamsoft-dialog-selectsource-button-cancel")[0],"click",(function(){ci.dialog.selectsourcedlg&&(ci.dialog.selectsourcedlg.close(),document.body.removeChild(ci.dialog.selectsourcedlg),ci.dialog.selectsourcedlg=!1);var e={};ps(e),r({code:e._errorCode,message:e._errorString})}))}))})):ci.Promise.reject({code:n._errorCode,message:n._errorString})}},{key:"_dwtGetCapabilities",value:function(e,t,r){var n=this,i=null,o=function(){Zt.isFunction(r)&&r(n._errorCode,n._errorString)};if(e){if(!Zt.isArray(e))return rs(n),void o();if(0==e.length)return void(Zt.isFunction(t)&&t([]));if(!1===function(e,t){var r,n,i,o;for(o=0;o<t.length;o++){if(r=t[o],n=!1,i=!1,Zt.isString(r)){var a=r;r=parseInt(r),(Zt.isNaN(r)||r!=a)&&(n=!0)}if(0==n&&Zt.isNumber(r)?(r<1||r>65535)&&(i=!0):n=!0,n)return rs(e),!1;if(i)return Rs(e),!1}return!0}(n,e))return void o();i=Il(e)}n._sendDataByHttpAsync("GetCapabilities",i).then((function(e){try{var r,i;e.length>0&&(i=e[0]),Zt.isString(i)?(i=Qt.removeNonPrintableChar(i),i=Zt.replaceAll(i,"\\\\","\\\\"),0==(r=JSON.parse(i)).errorCode?Zt.isFunction(t)&&t(r.response):(n._errorCode=r.errorCode,n._errorString=r.errorString,o())):(Cs(n),o())}catch(a){n._errorCode=-2302,n._errorString=a,o()}}),o)}},{key:"_dwtSetCapabilities",value:function(e,t,r){var n=this;if(!Zt.isObject(e)||Zt.isArray(e))return rs(n),Zt.isFunction(r)&&r(n._errorCode,n._getErrorString()),!1;var i=["[",Zt.stringify(e),"]"].join("");return n._innerSend("SetCapabilities",i,0,(function(e){Zt.isFunction(t)&&t(e)}),r),!0}},{key:"_selectDeviceAsync",value:(a=n(g().mark((function E(e,r,n){var i,o;return g().wrap((function(a){for(;;)switch(a.prev=a.next){case 0:return i=this,Wl(e,this),a.prev=2,a.next=5,l(d(t.prototype),"_innerSelectDeviceAsync",this).call(this,r,n);case 5:(o=a.sent)&&(i._curDevice=r,i._bSelectedSourceByServer=!1),a.next=12;break;case 9:throw a.prev=9,a.t0=a["catch"](2),a.t0;case 12:return a.prev=12,Rl(e),a.finish(12);case 15:return a.abrupt("return",o);case 16:case"end":return a.stop()}}),E,this,[[2,9,12,15]])}))),function(e,t,r){return a.apply(this,arguments)})},{key:"_selectSourceByIndexAsync",value:(r=n(g().mark((function k(e,t){var r,n,i;return g().wrap((function(o){for(;;)switch(o.prev=o.next){case 0:if(n=1*t,(r=this)._resetErr(),r._isValid()){o.next=4;break}return o.abrupt("return",ci.Promise.reject({code:r._errorCode,message:r._errorString}));case 4:if(!Zt.isNaN(n)){o.next=7;break}return ya(r),o.abrupt("return",ci.Promise.reject({code:r._errorCode,message:r._errorString}));case 7:if(r.__devices){o.next=10;break}return o.next=10,r._getDevicesAsync(e,null);case 10:if(!(n<0||n>=r.__devices.length)){o.next=13;break}return Ka(r),o.abrupt("return",ci.Promise.reject({code:r._errorCode,message:r._errorString}));case 13:return i=r.__devices[n],o.abrupt("return",r._selectDeviceAsync(e,i));case 15:case"end":return o.stop()}}),k,this)}))),function(e,t){return r.apply(this,arguments)})},{key:"_removeAllImages",value:function(e){var t=this,r=!0;if(t._resetErr(),!t._isValid())return!1;var n,i=[];for(n=t._getHowManyImagesInBuffer()-1;n>=0;n--){var o=t._imageBufferWrapper.convertClientIndexToServerId(n);o>-1&&i.push(o)}if(i.length>0){if(t._OnBitmapChanged(["c1",i.join(","),3,t._ImgManager.getCurrentImageIndex(),t._ImgManager.count()]),r=t._innerFunRaw("RemoveAllImages",Il(i.join(",")),!1,!1,!1,(function(){}),(function(){})),Zt.isArray(r))return r[0]}else r=!0;return r}},{key:"_removeImage",value:function(e,t){var r,n=this,i=parseInt(t);if(!Cf(n,i))return!1;var o=n._ImgManager.convertClientIndexToServerId(i);return-1==o?(Ka(n),!1):(((r=n._innerFun("RemoveImage",Il(o)))||-1033==n._errorCode)&&n._OnBitmapChanged(["c1",""+o,3,n._ImgManager.getCurrentImageIndex(),n._ImgManager.count()]),r)}},{key:"__innerAcquireOrLoadImageAsync",value:function(e,t,r,n){var i=this;return new ci.Promise((function(r,n){var o="LoadImage"==e||"LoadImageEx"==e||"GenerateURLForUploadData"==e,a=o||"LoadDibFromClipboard"==e;o?Qt.showProgress(i,e,!1):Wl(e,i),i._innerSend(e,t,!0,(function(t){if(i.__bLoadingImage=!1,i.__bOpenFileNow=!1,i.__closeRemoteScanUI(!0),o){if(Qt.closeProgress(null,e),i._isBindViewer()){var n=i._ImgManager.getCurrentImageIndex();n>=0&&i._innerRefreshUI(n)}}else Rl(e);a&&i._canConsume()&&rr.DWT.lcvrf(i),Zt.isFunction(r)&&r(t)}),(function(t){o?Qt.closeProgress(null,""):Rl(e),i.__bLoadingImage=!1,i.__bAcquireImageNow=!1,i.__bOpenFileNow=!1,i.__closeRemoteScanUI(!0);var r=i._ImgManager.getCurrentImageIndex();r>=0&&i._innerRefreshUI(r),tu(i._errorCode)&&Va(i),Zt.isFunction(n)&&n({code:i._errorCode,message:i._getErrorString()}),o?Qt.closeProgress(null,e):Rl(e),t&&Zt.error(t)}))}))}},{key:"_innerLoadImageFromBinary",value:function(e,t,r,n,i,o){var a,s,u=this,c=t;if(!Wc.checkProductKey(u,{Core:!0}))return Zt.isFunction(o)&&o(u._errorCode,u._getErrorString()),!1;if(!e||""==e)return Oa(u),Zt.isFunction(o)&&o(u._errorCode,u._getErrorString()),!1;if(Zt.isString(e))return rs(u),Zt.isFunction(o)&&o(u._errorCode,u._getErrorString()),!1;if(e instanceof Blob)s=e.size;else if(bl(e))s=e.byteLength;else if(e instanceof Array)s=e.length;else{var l=e;s=l.size||l.byteLength||l.length}if(!s||""==s)return rs(u),Zt.isFunction(o)&&o(u._errorCode,u._getErrorString()),!1;var d=e.currentFileName;d||(d=u._getCurrentDocumentName());var f,h=e.currentTagName;if(h||!Zt.isUndefined(e.bNeedClearCurrentTagName)&&e.bNeedClearCurrentTagName||(h=u._getCurrentDefaultTagName()),e instanceof FileList){if(1==e.length)return e[0].currentFileName=d,e[0].currentTagName=h,u._innerLoadImageFromBinary(e[0],c,r,i,o);if(e.length>1){var g;for(Zt.asyncQueue.stop(),g=0;g<e.length;g++)e[g].currentFileName=d,e[g].currentTagName=h,g==e.length-1?Zt.asyncQueue.pushToDo(u,"_innerLoadImageFromBinary",[e[g],c,r,i,o]):Zt.asyncQueue.pushToDo(u,"_innerLoadImageFromBinary",[e[g],c,r,null,o]);return Zt.asyncQueue.start(),!0}return Oa(u),Zt.isFunction(o)&&o(u._errorCode,u._getErrorString()),!1}if(window.ReadableStream&&e instanceof ReadableStream?a=new Response(e):window.Response&&e instanceof Response&&(a=e),a)a.arrayBuffer().then((function(t){var a;(a=new Blob([t])).currentFileName=e.currentFileName,a.currentTagName=e.currentTagName;var s=n,c=0;r&&(c=u.__GetLoadEventsNum()),u.__LoadImageFromBytesV1(a,-1,"",c,s,i,o)}));else{var m=e;n&&bl(m)&&((m=new Blob([e])).currentFileName=e.currentFileName,m.currentTagName=e.currentTagName);var p=-1,v=n,_=rr.DWT.EnumDWT_ImageType;Zt.isString(m.type)&&("application/pdf"==m.type?p=_.IT_PDF:"image/png"==m.type?p=_.IT_PNG:"image/jpeg"==m.type||"image/jpg"==m.type?p=_.IT_JPG:"image/bmp"==m.type?p=_.IT_BMP:"image/tiff"==m.type||"image/tif"==m.type?p=_.IT_TIF:"image/jp2"==m.type&&(p=_.IT_J2K));var y=0;r&&(y=u.__GetLoadEventsNum()),f=u.__LoadImageFromBytesV1(m,p,"",y,v,i,o)}return!!n||f}},{key:"__LoadImageFromBytes",value:function(e,t,r,n,i,o,a,s){var u=this.__LoadImageFromBytesV2(e,t,r,n,a,s,!1,0,i,o);return n?u:0==this._errorCode}},{key:"__LoadImageFromBytesV1",value:function(e,t,r,n,i,o,a){var s=this.__LoadImageFromBytesV2(e,t,r,i,0,0,!1,n,o,a);return i?s:0==this._errorCode}},{key:"_isMobileMode",value:function(){return!1}},{key:"ErrorCode",get:function(){return this._errorCode}},{key:"ErrorString",get:function(){return this._getErrorString()}},{key:"HowManyImagesInBuffer",get:function(){return this._getHowManyImagesInBuffer()}},{key:"_OnActiveUIClearBuffer",value:function(){var e=this.__OnBufferChanged;this.__OnBufferChanged=null,this._ImgManager.clear(),this.__OnBufferChanged=e}}]);var r,a,u,c,h,m,p,v,_}(_G);function DG(e,t,r){var n=this;return n._dwtConvertToBlobSync(t,e,r,(function(e){if(!e||e.size<=0)return es(n),!1;var t=n.__maxUploadImageSize;return e.size>t&&-1!=t?(Na(n),!1):e}),(function(e){return!1}))}function FG(){this.__defaultSourceName="",this.__sourceCount=0}function WG(e,t){var r=this,n=r._getPdfDllname(),i=["[",Zt.stringify(e),',"',n,'"',"]"].join("");return r._innerFunV2("SetPDFReaderOptions",i).then((function(){if(Zt.isNumber(t)&&(r._pdfConvertMode=t),r._pdfOptions.convertMode=e.convertMode,r._pdfOptions.renderOptions.renderAnnotations=e.renderOptions.renderAnnotations,r._pdfOptions.convertMode==nc.CM_IMAGEONLY&&r._pdfConvertMode==nc.CM_RENDERALL||r._pdfOptions.convertMode==nc.CM_IMAGEONLY&&r._pdfConvertMode==nc.CM_RENDERALLWITHANNOTATION)throw r._pdfConvertMode=nc.CM_IMAGEONLY,Va(r),{code:r._errorCode,message:r._errorString};return!0}))}var RG=function(e,t){if(ko.bDiscardBlankImage){var r=e._ImgManager.getCurrentImageIndex();e.IsBlankImage(r)&&e.RemoveImage(r);var n=["Blank Discard (",t,"): ",e.ErrorString].join("");Zt.isFunction(e.__OnPrintMsg)&&e.__OnPrintMsg(n)}};function NG(e){return OG.apply(this,arguments)}function OG(){return(OG=n(g().mark((function e(t){var r,n,i,o;return g().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(r=t,!rr.DWT.ConnectWithSocket){e.next=6;break}return e.next=4,new ci.Promise((function(e,t){r._sendData("IfDisableSourceAfterAcquire","[1]",!1,e,t)}));case 4:e.next=8;break;case 6:return e.next=8,t._innerFunV2("IfDisableSourceAfterAcquire","[1]");case 8:n=pf.TWAIN,i=!1,o=!1,r._bRemoteMode?r.__serverPlatform==Lo.enumWindow||(r.__serverPlatform==Lo.enumLinux?o=!0:r.__serverPlatform==Lo.enumMac&&(i=!0)):(i=de.bMac,o=de.bLinux,de.bWin),i?n=pf.TWAIN_AND_ICA:o&&(n=pf.SANE),t._driverType=n,t._bRemoteMode&&(t._setIfShowUI(!1),t._setIfShowFileDialog(!1));case 13:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function MG(e,t){(function(e,t){if(t.has(e))throw new TypeError("Cannot initialize the same private elements twice on an object")})(e,t),t.add(e)}function LG(e,t,r){if("function"==typeof e?e===t:e.has(t))return arguments.length<3?t:r;throw new TypeError("Private element is not present on this object")}var BG=new WeakSet,UG=function(e){function t(){var e;o(this,t);for(var r=arguments.length,n=new Array(r),a=0;a<r;a++)n[a]=arguments[a];return MG(e=i(this,t,[].concat(n)),BG),e}return f(t,e),s(t,[{key:"SaveAsGIF",value:function(e,t,r,n){var i=this,o=!1;if(Zt.isFunction(r)&&(o=!0),i._resetErr(),!i._isValid())return Zt.isFunction(n)&&Af(n,i),!!o&&void 0;if(!(Wc.checkProductKey(i,{Core:!0})||de.bWin&&Wc.checkProductKey(i,{Webcam:!0},!0)))return Wc.checkProductKey(i,{Core:!0},!1),Zt.isFunction(n)&&n(i._errorCode,i._getErrorString()),!!o&&void 0;var a,s=vf.replaceLocalFilename(e);if(!If(i,t,n))return!!o&&void 0;if(-1==(a=i._ImgManager.convertClientIndexToServerId(t)))return Ka(i),Zt.isFunction(n)&&Af(n,i),!!o&&void 0;var u=i.__GetLoadEventsNum(),c=i.__innerSaveImage("SaveAsGIF",Il(s,a,u),r,n);return o?void 0:c}},{key:"SaveSelectedImagesToBase64Binary",value:function(e,t){var r=this,n=!1;if(Zt.isFunction(e)&&(n=!0),r._resetErr(),!r._isValid())return Zt.isFunction(t)&&Af(t,r),!!n&&void 0;if(!(Wc.checkProductKey(r,{Core:!0})||de.bWin&&Wc.checkProductKey(r,{Webcam:!0},!0)))return Wc.checkProductKey(r,{Core:!0},!1),Zt.isFunction(t)&&t(r._errorCode,r._getErrorString()),!!n&&void 0;var i=bf(r);return 0==i.length?(Ia(r),Zt.isFunction(t)&&Af(t,r),!!n&&void 0):n?void r._innerSend("SaveSelectedImagesToBase64Binary",Il(i.join(",")),!0,e,t):r._innerFun("SaveSelectedImagesToBase64Binary",Il(i.join(",")))}},{key:"ShowFileDialog",value:function(e,t,r,n,i,o,a,s){var u=this;if(u._resetErr(),!u._isValid())return!1;var c,l=vf.replaceLocalFilename(i);return c=u.__GetLoadEventsNum(),u._innerSend("ShowFileDialog",Il(e,t,r,n,l,o,a,s,c),!0),!0}},{key:"FTPDownload",value:function(e,t,r,n){var i=this,o=!1;if(Zt.isFunction(r)&&(o=!0),i._resetErr(),!i._isValid())return Zt.isFunction(n)&&Af(n,i),!!o&&void 0;if(!e)return rs(i),Zt.isFunction(n)&&Af(n,i),!!o&&void 0;var a=vf.getImageType(t);return LG(BG,i,zG).call(i,"FTPDownload",Il(e,t),a,r,n)}},{key:"FTPDownloadEx",value:function(e,t,r,n,i){var o=this,a=!1;return Zt.isFunction(n)&&(a=!0),o._resetErr(),o._isValid()?e?LG(BG,o,zG).call(o,"FTPDownloadEx",Il(e,t,r),r,n,i):(rs(o),Zt.isFunction(i)&&Af(i,o),!!a&&void 0):(Zt.isFunction(i)&&Af(i,o),!!a&&void 0)}},{key:"FTPUpload",value:function(e,t,r,n,i){var o=this,a=!1;if(Zt.isFunction(n)&&(a=!0),o._resetErr(),!o._isValid())return Zt.isFunction(i)&&Af(i,o),!!a&&void 0;if(!If(o,t,i))return!!a&&void 0;var s=o._ImgManager.convertClientIndexToServerId(t);if(-1==s)return Ka(o),Zt.isFunction(i)&&Af(i,o),!!a&&void 0;var u=o.__innerFTPUpload("FTPUpload",Il(e,s,r),n,i);return a?void 0:u}},{key:"FTPUploadEx",value:function(e,t,r,n,i,o){var a,s=this,u=!1;if(Zt.isFunction(i)&&(u=!0),s._resetErr(),!s._isValid())return Zt.isFunction(o)&&Af(o,s),!!u&&void 0;if(!If(s,t,o))return!!u&&void 0;if(-1==(a=s._ImgManager.convertClientIndexToServerId(t)))return Ka(s),Zt.isFunction(o)&&Af(o,s),!!u&&void 0;var c=s.__innerFTPUpload("FTPUploadEx",Il(e,a,r,n),i,o);return u?void 0:c}},{key:"FTPUploadAllAsMultiPageTIFF",value:function(e,t,r,n){var i=this,o=!1;if(Zt.isFunction(r)&&(o=!0),i._resetErr(),!i._isValid())return Zt.isFunction(n)&&Af(n,i),!!o&&void 0;var a=[];yf(i,a);var s=i.__innerFTPUpload("FTPUploadAsMultiPageTIFF",Il(e,t,a.join(",")),r,n);return o?void 0:s}},{key:"FTPUploadAllAsPDF",value:function(e,t,r,n){var i=this,o=!1;if(Zt.isFunction(r)&&(o=!0),i._resetErr(),!i._isValid())return Zt.isFunction(n)&&Af(n,i),!!o&&void 0;var a=[];yf(i,a);var s=i.__innerFTPUpload("FTPUploadAsMultiPagePDF",Il(e,t,a.join(",")),r,n);return o?void 0:s}},{key:"FTPUploadAsMultiPagePDF",value:function(e,t,r,n){var i=this,o=!1;if(Zt.isFunction(r)&&(o=!0),i._resetErr(),!i._isValid())return Zt.isFunction(n)&&Af(n,i),!!o&&void 0;var a=bf(i),s=i.__innerFTPUpload("FTPUploadAsMultiPagePDF",Il(e,t,a.join(",")),r,n);return o?void 0:s}},{key:"FTPUploadAsMultiPageTIFF",value:function(e,t,r,n){var i=this,o=!1;if(Zt.isFunction(r)&&(o=!0),i._resetErr(),!i._isValid())return Zt.isFunction(n)&&Af(n,i),!!o&&void 0;var a=bf(i),s=i.__innerFTPUpload("FTPUploadAsMultiPageTIFF",Il(e,t,a.join(",")),r,n);return o?void 0:s}},{key:"HTTPDownloadDirectly",value:function(e,t,r,n,i){var o,a=this,s=!1;if(Zt.isFunction(n)&&(s=!0),a._resetErr(),!a._isValid())return Zt.isFunction(i)&&Af(i,a),!!s&&void 0;if(!Wc.checkProductKey(a,{Core:!0}))return Zt.isFunction(i)&&Af(i,a),!!s&&void 0;var u,c,l=a._GetHttpHeadersAndClear(),d=vf.combineUrl(a,e,t);if(d===undefined)return Oa(a),Zt.isFunction(i)&&Af(i,a),!!s&&void 0;if(!r||""==r)return function(e,t){ha(e,-2309,"The LocalFile is empty in the name "+t+" Function.")}(a,"HTTPDownloadDirectly"),Zt.isFunction(i)&&Af(i,a),!!s&&void 0;if(u=vf.getImageType(r),!Wc.checkPDFProductKeyWhenNeeds(a,u))return Zt.isFunction(i)&&Af(i,a),!!s&&void 0;Qt.cancelFrom=rG.HTTPDownload,c=vf.replaceLocalFilename(r),a.IfShowProgressBar?Qt.showProgress(a,"HTTPDownloadDirectly",!1):Qt.hideProgress();var f=null===(o=Qt.progressContext)||void 0===o?void 0:o.IfShowCancelDialogWhenImageTransfer,h=function(){return a.IfShowProgressBar&&Qt.closeProgress(null,"HTTPDownloadDirectly"),Zt.isFunction(n)&&n(),!0},g=function(){return Qt.progressContext&&(Qt.progressContext.IfShowCancelDialogWhenImageTransfer=f),a.IfShowProgressBar&&Qt.closeProgress(null,"HTTPDownloadDirectly"),Zt.isFunction(i)&&Af(i,a),!1};a._OnPercentDone([0,-1,hl.Downloading,"http"]),Qt.progressContext&&(Qt.progressContext.IfShowCancelDialogWhenImageTransfer=!0);var m=vf.loadHttpBlob(a,"get",d,s,(function(e){Qt.progressContext&&(Qt.progressContext.IfShowCancelDialogWhenImageTransfer=f),a._OnPercentDone([0,-1,hl.Loading]);var t=a.__GetLoadEventsNum();return a.__LoadImageFromBytesV1(e,3,c,t,s,h,g)}),g,(function(e){var t=0===e.total?100:Math.round(100*e.loaded/e.total);[e.loaded," / ",e.total].join(""),t>=100&&e.loaded<e.total&&(t=99),a._OnPercentDone([0,t,"","http"])}),l);return s?void 0:!!m}},{key:"HTTPUploadThroughPostDirectly",value:function(e,t,r,n,i,o){var a=this,s=!1,u=function(){Zt.isFunction(o)&&Af(o,a,a.__HTTPPostResponseString)};if(Zt.isFunction(i)&&(s=!0),a._resetErr(),a.__HTTPPostResponseString="",!a._isValid())return u(),!!s&&void 0;var c=vf.combineUrl(a,e,r);if(!t)return Ma(a),u(),!!s&&void 0;if(!e)return Ea(a),u(),!!s&&void 0;var l=this.IfShowProgressBar;return a._innerUploadDirectly(c,t,n,l,!1,0,!0,!1,i,u)}},{key:"_innerUploadDirectly",value:function(e,t,r,n,i,o,a,s,u,c){var l,d,f=this,h=f._GetHttpHeadersAndClear(),g="HTTPUploadThroughPostDirectly",m=!1;if(Zt.isFunction(u)&&(m=!0),e===undefined||!1===e||""===e)return Oa(f),Zt.isFunction(c)&&Af(c,f),!!m&&void 0;if(!Wc.checkProductKey(f,{Core:!0}))return Zt.isFunction(c)&&Af(c,f),!!m&&void 0;Qt.cancelFrom=rG.HTTPUpload;var p=function(e,t,r){return 0!=e&&t&&(f._errorCode=e,f._errorString=t),r&&(f.__HTTPPostResponseString=r),Qt.needShowTwiceShowDialog=!1,n&&Qt.closeProgress(null,g),Zt.isFunction(c)&&Af(c,f),!1};return Qt.needShowTwiceShowDialog=!0,n?Qt.showProgress(f,g,!1):Qt.hideProgress(),(l=vf.replaceLocalFilename(t))&&""!=l?s&&s.bCancel?(s.st=2,ps(f),p(f._errorCode,f._errorString),!!m&&void 0):(d=LG(BG,f,jG).call(f,l,m,i,(function(t){if(Qt.needShowTwiceShowDialog=!1,s&&s.bCancel)return s.st=2,ps(f),p(f._errorCode,f._errorString),!1;if(t&&(!n||n&&Qt.dlgRef>0||0==m)){t instanceof File?t.fileName=r:t.name=r,n&&dG(f.__IfShowCancelDialogWhenImageTransfer);var i=new fG,c=f._createHttpUploaderConfig(),l=new hG;return f.__remoteFilename&&""!=f.__remoteFilename&&(l.remoteFilename=f.__remoteFilename),c.objUploadStatus=s,l.url=e,l.method=g,l.content=t,t=null,l.contentType=f._strHttpContentTypeFieldValue,l.headers=h,l.bAsync=m,l.httpFormData=JG(f.httpFormFields),l.retry=o,l.bOnlyResponseEmptyIsOK=a,l.blockSize=f._moduleSize,i.httpPostUpload(c,l,(function(e){return n&&Qt.closeProgress(null,g),Zt.isFunction(u)&&kf(u,e),!0}),p)}return Ma(f),p(f._errorCode,f._errorString),!1}),p),m?void 0:!!d):(Ma(f),p(f._errorCode,f._errorString),!!m&&void 0)}},{key:"_innerUploadFilesDirectly",value:function(e,t,r,n,i,o,a,s,u){var c,l=this,d=l._GetHttpHeadersAndClear(),f="HTTPUploadThroughPostDirectly",h=!1,g=[];if(Zt.isFunction(s)&&(h=!0),!1===e||""===e)return Oa(l),Zt.isFunction(u)&&u({code:l._errorCode,message:l._getErrorString(),files:t}),!1;if(!Wc.checkProductKey(l,{Core:!0}))return Zt.isFunction(u)&&u({code:l._errorCode,message:l._getErrorString(),files:t}),!1;Qt.cancelFrom=rG.HTTPUpload;var m=function(e,r,i){return 0!=e&&r&&(l._errorCode=e,l._errorString=r),i&&(l.__HTTPPostResponseString=i),Qt.needShowTwiceShowDialog=!1,n&&Qt.closeProgress(null,f),Zt.isFunction(u)&&u({code:l._errorCode,message:l._errorString,response:i,files:t}),!1};Qt.needShowTwiceShowDialog=!0,n?Qt.showProgress(l,f,!1):Qt.hideProgress(),Zt.each(t,(function(e){var t=vf.replaceLocalFilename(e);if(!t||""==t)return Ma(l),m(l._errorCode,l._errorString),!1;g.push(t)}));var p=[],v=g.length,_=0;return Zt.each(g,(function(t,u){c=LG(BG,l,jG).call(l,t,h,i,(function(t){if(Qt.needShowTwiceShowDialog=!1,!t||n&&!(n&&Qt.dlgRef>0)&&0!=h)return n&&Qt.closeProgress(null,f),xa(l),Zt.isFunction(m)&&m(l._errorCode,l._errorString),!1;var i=sG(r,u+1);if(t instanceof File?t.fileName=i:t.name=i,p[u]=t,t=null,++_==v){n&&dG(l.__IfShowCancelDialogWhenImageTransfer);var c=l._createHttpUploaderConfig(),g=new hG;l.__remoteFilename&&""!=l.__remoteFilename&&(g.remoteFilename=l.__remoteFilename),g.url=e,g.method=f,g.content=p,p=null,g.contentType=l._strHttpContentTypeFieldValue,g.headers=d,g.bAsync=h,g.httpFormData=JG(l.httpFormFields),g.retry=o,g.bOnlyResponseEmptyIsOK=a,g.blockSize=l._moduleSize;var y=lG(c,g,(function(e){return n&&Qt.closeProgress(null,f),Zt.isFunction(s)&&kf(s,e),!0}),(function(e,t,r){return n&&Qt.closeProgress(null,f),Zt.isFunction(m)&&m(e,t,r),!1}));return h?void 0:y}}),(function(){return n&&Qt.closeProgress(null,f),Zt.isFunction(m)&&m(),!1}))})),h?void 0:!!c}},{key:"_createHttpUploaderConfig",value:function(){var e=this,t=new gG;return t.IfShowProgressBar=e.IfShowProgressBar,t.IfShowCancelDialogWhenImageTransfer=e.__IfShowCancelDialogWhenImageTransfer,t.MaxUploadImageSize=e.MaxUploadImageSize,t.HTTPRequestswithCredentials=e.HTTPRequestswithCredentials,t.onPercent=function(t){e._OnPercentDone(t)},t.onHttpUploadStatus=function(t){Zt.isFunction(e.__OnHttpUploadStatus)&&e.__OnHttpUploadStatus(t)},t}},{key:"SetUploadSegment",value:function(e,t){var r=this;return r._resetErr(),!!r._isValid()&&(!Zt.isNumber(e)||e<0?(ha(r,-2367,"Invalid value for the parameter segmentUploadThreshold."),!1):!Zt.isNumber(t)||t<=0?(function(e){ha(e,-2368,"Invalid value for the parameter moduleSize.")}(r),!1):(r._segementUploadThreshold=1024*e*1024,r._moduleSize=1024*t,!0))}},{key:"ConvertToBase64",value:function(e,t,r,n){var i,o=this,a=arguments,s=!1;if(Zt.isFunction(r)&&(s=!0),o._resetErr(),!o._isValid())return Zt.isFunction(n)&&xf(n,o,e,t,a),!!s&&void 0;var u=parseInt(t);if(!Wc.checkProductKey(o,{Core:!0}))return Zt.isFunction(n)&&xf(n,o,e,t,a),!!s&&void 0;if(!o._checkIndices(e))return Zt.isFunction(n)&&xf(n,o,e,t,a),!!s&&void 0;if(u==rr.DWT.EnumDWT_ImageType.IT_BMP||u==rr.DWT.EnumDWT_ImageType.IT_JPG||u==rr.DWT.EnumDWT_ImageType.IT_PNG){if(e.length>1)return ha(o,-2361,"You cannot convert more than one image to base64 string when the format is BMP, JPG or PNG."),Zt.isFunction(n)&&xf(n,o,e,t,a),!!s&&void 0}else if(u!=rr.DWT.EnumDWT_ImageType.IT_TIF&&u!=rr.DWT.EnumDWT_ImageType.IT_PDF)return Qa(o),Zt.isFunction(n)&&xf(n,o,e,t,a),!!s&&void 0;if(0==(i=Ef(o,e)).length)return ya(o),Zt.isFunction(n)&&xf(n,o,e,t,a),!!s&&void 0;Qt.cancelFrom=rG.ConvertToBlob,o._convertToBase64ByServerIdsWithUI("ConvertToBase64",i,u,!1,3,(function(e){var n=[];Zt.isArray(i)&&Zt.each(i,(function(e){var t=o._ImgManager.convertServerIdToClientIndex(e);t>-1&&n.push(t)})),Zt.isFunction(r)&&kf(r,e,n,t,a)}),(function(){var e=[];Zt.isArray(i)&&Zt.each(i,(function(t){var r=o._ImgManager.convertServerIdToClientIndex(t);r>-1&&e.push(r)})),Zt.isFunction(n)&&xf(n,o,e,t,a)}))}},{key:"ClearAllHTTPFormField",value:function(){var e=this;return e._resetErr(),!!e._isValid()&&(e.httpFormFields={},!0)}},{key:"SetHTTPFormField",value:function(e,t,r){var n=this;if(n._resetErr(),!n._isValid())return!1;var i=e;return Zt.isString(i)||(i=""+i),t instanceof Blob&&(t.name=r),n.httpFormFields[i]=t,!0}},{key:"HTTPDownloadThroughPost",value:function(e,t,r,n,i,o){var a,s,u=this,c=u._GetHttpHeadersAndClear(),l=vf.combineUrl(u,e,t),d=!1;if(Zt.isFunction(n)&&(d=!0),l===undefined)return Oa(u),Zt.isFunction(i)&&Af(i,u,""),!!d&&void 0;if(!Wc.checkProductKey(u,{Core:!0}))return Zt.isFunction(i)&&Af(i,u,""),!!d&&void 0;if(!Wc.checkPDFProductKeyWhenNeeds(u,r))return Zt.isFunction(i)&&Af(i,u,""),!!d&&void 0;Qt.cancelFrom=rG.HTTPDownload,u.IfShowProgressBar?Qt.showProgress(u,"HttpDownloadThroughPost",!1):Qt.hideProgress();u._OnPercentDone([0,-1,hl.Downloading,"http"]);var f=null===(a=Qt.progressContext)||void 0===a?void 0:a.IfShowCancelDialogWhenImageTransfer,h=function(){return u.IfShowProgressBar&&Qt.closeProgress(null,"HttpDownloadThroughPost"),Zt.isFunction(n)&&n(),!0},g=function(){return Qt.progressContext&&(Qt.progressContext.IfShowCancelDialogWhenImageTransfer=f),u.IfShowProgressBar&&Qt.closeProgress(null,"HttpDownloadThroughPost"),Zt.isFunction(i)&&Af(i,u,u.__HTTPPostResponseString),!1};return Qt.progressContext&&(Qt.progressContext.IfShowCancelDialogWhenImageTransfer=!0),s=vf.loadHttpBlob(u,"post",l,d,(function(e){Qt.progressContext&&(Qt.progressContext.IfShowCancelDialogWhenImageTransfer=f),u._OnPercentDone([0,-1,hl.Loading]);var t=r;t!=rr.DWT.EnumDWT_ImageType.IT_BMP&&t!=rr.DWT.EnumDWT_ImageType.IT_JPG&&t!=rr.DWT.EnumDWT_ImageType.IT_TIF&&t!=rr.DWT.EnumDWT_ImageType.IT_PNG&&t!=rr.DWT.EnumDWT_ImageType.IT_PDF&&t!=rr.DWT.EnumDWT_ImageType.IT_J2K&&(t=-1);var n=u.__GetLoadEventsNum();return u.__LoadImageFromBytesV1(e,t,"",n,d,h,g)}),g,(function(e){var t=0===e.total?100:Math.round(100*e.loaded/e.total);[e.loaded," / ",e.total].join(""),t>=100&&e.loaded<e.total&&(t=99),u._OnPercentDone([0,t,"","http"])}),c),d?void 0:!!s}},{key:"HTTPDownloadThroughGet",value:function(e,t,r,n,i){return this._innerHTTPDownloadThroughGet("HTTPDownload",e,t,r,n,i)}},{key:"HTTPUploadThroughPut",value:function(e,t,r,n,i){var o=vf.getImageType(r);return this.HTTPUploadThroughPutEx(e,t,r,o,n,i)}},{key:"HTTPUploadThroughPutEx",value:function(e,t,r,n,i,o){var a=this,s=a._GetHttpHeadersAndClear(),u="HTTPUploadThroughPutEx",c=vf.combineUrl(a,e,r),l=!1,d=[],f=!1,h=this.IfShowProgressBar;if(Zt.isFunction(i)&&(l=!0),c===undefined)return Oa(a),Zt.isFunction(o)&&xf(o,a,"",[t],r,n),!!l&&void 0;Qt.cancelFrom=rG.HTTPPut;var g,m=function(){Qt.needShowTwiceShowDialog=!1,h&&Qt.closeProgress(null,u),Zt.isFunction(o)&&xf(o,a,a.__HTTPPostResponseString,d,r,n)};switch(Qt.needShowTwiceShowDialog=!0,h?Qt.showProgress(a,u,!1):Qt.hideProgress(),t){case-1:for(var p=0;p<a._ImgManager.count();p++)d.push(p);break;case-2:d=a._ImgManager.getSelectedClientIndexArray();break;default:if(d.push(t),!(t>=0))return Ka(a),m(),!!l&&void 0}if(""===e)return Ea(a),m(),!!l&&void 0;var v=[];Zt.isArray(d)&&Zt.each(d,(function(e){var t=a._ImgManager.convertClientIndexToServerId(e);-1!=t&&v.push(t)}));var _=!1;a._OnPercentDone([0,-1,hl.Encoding,"http"]);var y=function(e,t,o){if(rr.DWT.IfAddMD5InUploadHeader&&t&&""!=t&&(s["dwt-md5"]=t),Qt.needShowTwiceShowDialog=!1,e&&(!h||h&&Qt.dlgRef>0||0==l)){var d=a.__maxUploadImageSize;return e.size>d&&-1!=d?(Na(a),m(),!!l&&void 0):(g=function(e){var t=0===e.total?100:Math.round(100*e.loaded/e.total);[e.loaded," / ",e.total].join(""),t>=100&&e.loaded<e.total&&(t=99),a._OnPercentDone([0,t,"","http"])},a._OnPercentDone([0,-1,hl.Uploading,"http"]),h&&dG(a.__IfShowCancelDialogWhenImageTransfer),Qt.cancelFrom=rG.HTTPPut,f=vf.httpPutImage(a,c,e,l,(function(e){if(e&&(a.__HTTPPostResponseString=e),h&&Qt.closeProgress(null,u),Zt.isFunction(i)){var t=[];Zt.isArray(v)&&Zt.each(v,(function(e){var r=a._ImgManager.convertServerIdToClientIndex(e);r>-1&&t.push(r)})),kf(i,a.__HTTPPostResponseString,t,r,n)}return!0}),m,g),e=null,l?void 0:!!f)}return e=null,h&&Qt.closeProgress(null,u),!!l&&void 0};if(!l)return a._dwtConvertToBlobSync(n,v,_,y,m);a._convertToBlobForUpload(n,v,_,4,y,m)}},{key:"HTTPUploadAllThroughPutAsMultiPageTIFF",value:function(e,t,r,n){return this.HTTPUploadThroughPutEx(e,-1,t,2,r,n)}},{key:"HTTPUploadThroughPutAsMultiPageTIFF",value:function(e,t,r,n){return this.HTTPUploadThroughPutEx(e,-2,t,2,r,n)}},{key:"HTTPUploadAllThroughPutAsPDF",value:function(e,t,r,n){return this.HTTPUploadThroughPutEx(e,-1,t,4,r,n)}},{key:"HTTPUploadThroughPutAsMultiPagePDF",value:function(e,t,r,n){return this.HTTPUploadThroughPutEx(e,-2,t,4,r,n)}},{key:"GetSelectedImagesSize",value:function(e){var t=this;if(t._resetErr(),!t._isValid())return!1;var r=bf(t);return t._innerFun("GetSelectedImagesSize",Il(e,r.join(",")))}},{key:"SetHTTPHeader",value:function(e,t){var r=this;if(r._resetErr(),!r._isValid())return!1;var n,i,o=e;if(r.__httpHeaderMap||(r.__httpHeaderMap={}),!o||!Zt.isString(o))return Zt.isUndefined(o)?ha(r,-2356,"The header name cannot be undefined."):""===o?function(e){ha(e,-2354,"The header name cannot be empty.")}(r):null===o?function(e){ha(e,-2355,"The header name cannot be null.")}(r):function(e){ha(e,-2357,"The header name you entered is invalid.")}(r),!1;for(n=["if-none-match","if-range","range","accept-charset","accept-encoding","access-control-request-headers","access-control-request-method","connection","content-length","cookie","cookie2","date","dnt","expect","host","keep-alive","origin","referer","te","trailer","transfer-encoding","upgrade","user-agent","via"],o=o.toLowerCase(),i=0;i<n.length;i++)if(n[i]==o)return Ha(r),!1;return Zt.isUndefined(t)||null===t||""===t?(e in r.__httpHeaderMap&&delete r.__httpHeaderMap[e],!0):(Zt.isNumber(t)&&(t=""+t),r.__httpHeaderMap[e]=t,!0)}},{key:"ConvertToBlob",value:function(e,t,r,n,i){var o=arguments;return this._convertToBlobByIndices(e,t,!1,o,r,n)}},{key:"_asyncUploadFilesCmd",value:function(e,t,r,n,i,o,a,s,u,c,l,d){var f=this,h=parseInt(i),g="HTTPUpload",m=e,p=[];f.__HTTPPostResponseString="",Qt.cancelFrom=rG.HTTPUpload;var v=function(e,r,n){var i=[];if(Zt.isArray(t)&&Zt.each(t,(function(e){var t=f._ImgManager.convertServerIdToClientIndex(e);t>-1&&i.push(t)})),0!=e&&r&&(f._errorCode=e,f._errorString=r),n&&(f.__HTTPPostResponseString=n),f._bServerPercentDone=!0,Qt.needShowTwiceShowDialog=!1,s&&Qt.closeProgress(null,g),p.slice(0),p=null,Zt.isFunction(d))try{d({code:f._errorCode,message:f._errorString,response:n,indices:i})}catch(o){}};Qt.needShowTwiceShowDialog=!0,s?Qt.showProgress(f,g,!1):Qt.hideProgress();var _=t.length,y=0,S=0,I="";f._bServerPercentDone=!1,f._OnPercentDone([0,-1,hl.Encoding,"http"]),Zt.each(t,(function(e,i){f._convertToBlobForUpload(h,[e],a,4,(function(e,a,d){if(!e||e.size<=0)return Wa(f),v(f._errorCode,f._errorString);var h=f.__maxUploadImageSize;if(e.size>h&&-1!=h)return Na(f),v(f._errorCode,f._errorString);var b=sG(o,i+1);if(S=(y+1)/_*100,I=[y+1,"/",_].join(""),f._OnPercentDone([0,S,I,"http",b]),e.name=b,p.push(e),++y>=_){rr.DWT.IfAddMD5InUploadHeader&&a&&""!=a&&(r["dwt-md5"]=a);var T=f._createHttpUploaderConfig(),C=new hG;f.__remoteFilename&&""!=f.__remoteFilename&&(C.remoteFilename=f.__remoteFilename),C.url=m,C.method=g,C.content=p,C.contentType=f._strHttpContentTypeFieldValue,C.headers=r,C.httpFormData=n,C.retry=u,C.bOnlyResponseEmptyIsOK=c,C.blockSize=f._moduleSize,lG(T,C,(function(e){f.__HTTPPostResponseString=T.HTTPPostResponse,function(e){if(f._bServerPercentDone=!0,Qt.needShowTwiceShowDialog=!1,s&&Qt.closeProgress(null,g),p.slice(0),p=null,Zt.isFunction(l)){var r=[];Zt.isArray(t)&&Zt.each(t,(function(e){var t=f._ImgManager.convertServerIdToClientIndex(e);t>-1&&r.push(t)})),kf(l,e,r)}}(e)}),v)}e=null}),v,[e,i])}))}},{key:"_getVersionInfoAsync",value:function(){return oa.versionInfoFromServer?ci.Promise.resolve(oa.versionInfoFromServer):this._innerFunV2("VersionInfo")}},{key:"__innerLoadImage",value:function(e,t,r,n,i,o,a){var s=this,u=!1;if((Zt.isFunction(o)||rr.DWT.ConnectWithSocket)&&(u=!0),!Wc.checkProductKey(s,{Core:!0}))return Zt.isFunction(a)&&a({code:s._errorCode,message:s._getErrorString()}),!!u&&void 0;if(!Wc.checkPDFProductKeyWhenNeeds(s,r))return Zt.isFunction(a)&&a({code:s._errorCode,message:s._getErrorString()}),!!u&&void 0;if(u){if(s._bRemoteMode&&s._getIfShowFileDialog())return gs(s),void(Zt.isFunction(a)&&a({code:s._errorCode,message:s._getErrorString()}));var c=s.IfShowCancelDialogWhenImageTransfer;return s.IfShowCancelDialogWhenImageTransfer=!1,void s.__innerAcquireOrLoadImageAsync(e,t,n,!0).then((function(){s.IfShowCancelDialogWhenImageTransfer=c,Zt.isFunction(o)&&o()}),(function(e){s.IfShowCancelDialogWhenImageTransfer=c,s._errorCode=e.code,s._errorString=e.message,Zt.isFunction(a)&&a(e)}))}if(s._bRemoteMode&&s._getIfShowFileDialog())return gs(s),!1;var l=s._getCurrentDocumentName(),d=s._getCurrentDefaultTagName();return s.__innerLoadImageFun(e,t,i,l,d)}},{key:"__innerLoadImageFun",value:function(e,t,r,n,i){var o,a=this,s=!0;if(o=a._innerFunRaw(e,t,!1,!1,!0),a.__bOpenFileNow=!1,0!=a._errorCode)return!1;if(o&&Zt.isArray(o.result)&&o.result.length>0){if(r){var u;if("FTPDownload"==e||"FTPDownloadEx"==e)u=JSON.stringify(o.result);else{var c=o.result[0];Zt.isObject(c)?u=c.imageInfos:-1!=c||"LoadImage"!=e&&"LoadImageEx"!=e&&"LoadImageFromBase64Binary"!=e&&"LoadDibFromClipboard"!=e||(s=!1)}Zt.isString(u)&&a._handleOnBitmapChangedEvent({result:["c1",u]},{document:n,tag:i})}else{var l=o.result.join(",");a._OnBitmapChanged(["c1",l,1,a._ImgManager.getCurrentImageIndex(),a._ImgManager.count()],null,{document:n,tag:i})}if(s)return a._canConsume()&&rr.DWT.lcvrf(a),!0}return tu(a._errorCode)&&Va(a),!1}},{key:"__innerSaveImage",value:function(e,t,r,n){var i,o=this,a=!1;if(Zt.isFunction(r)&&(a=!0),a&&o._OnPercentDone([0,-1,hl.Encoding]),o._bRemoteMode||(rr.DWT.IfAlwaysFocusOnPopupWindow?o._OnPageFocus(!0):o._OnPageBlur(!0)),0==a)return o._bRemoteMode?o._serviceSyncMethodNotSupport(e):this._innerFun(e,t);if(o._bRemoteMode&&o._getIfShowFileDialog())return gs(o),void(Zt.isFunction(n)&&n(o._errorCode,o._getErrorString()));var s=null===(i=Qt.progressContext)||void 0===i?void 0:i.IfShowCancelDialogWhenImageTransfer;o.IfShowProgressBar?Qt.showProgress(o,e,!1):Qt.hideProgress(),Qt.progressContext&&(Qt.progressContext.IfShowCancelDialogWhenImageTransfer=!1),o._innerSend(e,t,!0,(function(){Qt.progressContext&&(Qt.progressContext.IfShowCancelDialogWhenImageTransfer=s),Qt.closeProgress(null,e),Zt.isFunction(r)&&r()}),(function(t){return Qt.progressContext&&(Qt.progressContext.IfShowCancelDialogWhenImageTransfer=s),Zt.isFunction(n)&&n(o._errorCode,o._getErrorString()),Qt.closeProgress(null,e),t&&Zt.error(t),!1}))}},{key:"__captureImage",value:function(e,t,r,n){var i=this.__GetLoadEventsNum();return this.__LoadImageFromBytesV2(e,t,"",!0,0,0,!0,i,r,n)}},{key:"_getIfShowFileDialog",value:function(){return this._resetErr(),this._isValid()?this._innerFun("IfShowFileDialog"):di}},{key:"SaveAsBMP",value:function(e,t,r,n){var i=this,o=!1;if((Zt.isFunction(r)||de.bAndroid)&&(o=!0),i._resetErr(),!i._isValid())return Zt.isFunction(n)&&Af(n,i),!!o&&void 0;if(!(Wc.checkProductKey(i,{Core:!0})||de.bWin&&Wc.checkProductKey(i,{Webcam:!0},!0)))return Wc.checkProductKey(i,{Core:!0},!1),Zt.isFunction(n)&&Af(n,i),!!o&&void 0;var a,s=vf.replaceLocalFilename(e);if(!If(i,t,n))return!!o&&void 0;if(de.bAndroid){if(0==i._ImgManager.count())return Ia(i),void(Zt.isFunction(n)&&Af(n,i));var u=[];return u.push(t),void i._saveImages("SaveAsBMP",s,u,Ad.IT_BMP).then((function(){Zt.isFunction(r)&&r()}))["catch"]((function(e){Zt.isFunction(n)&&n(e.code,e.message)}))}if(-1==(a=i._ImgManager.convertClientIndexToServerId(t)))return Ka(i),Zt.isFunction(n)&&Af(n,i),!!o&&void 0;var c=i.__GetLoadEventsNum(),l=i.__innerSaveImage("SaveAsBMP",Il(s,a,c),r,n);return o?void 0:l}},{key:"SaveAsJPEG",value:function(e,t,r,n){var i=this,o=!1;if((Zt.isFunction(r)||de.bAndroid)&&(o=!0),i._resetErr(),!i._isValid())return Zt.isFunction(n)&&Af(n,i),!!o&&void 0;if(!(Wc.checkProductKey(i,{Core:!0})||de.bWin&&Wc.checkProductKey(i,{Webcam:!0},!0)))return Wc.checkProductKey(i,{Core:!0},!1),Zt.isFunction(n)&&Af(n,i),!!o&&void 0;if(!If(i,t,n))return!!o&&void 0;var a,s=vf.replaceLocalFilename(e);if(de.bAndroid){if(0==i._ImgManager.count())return Ia(i),void(Zt.isFunction(n)&&Af(n,i));var u=[];return u.push(t),void i._saveImages("SaveAsJPEG",s,u,Ad.IT_JPG).then((function(){Zt.isFunction(r)&&r()}))["catch"]((function(e){Zt.isFunction(n)&&n(e.code,e.message)}))}if(-1==(a=i._ImgManager.convertClientIndexToServerId(t)))return Ka(i),Zt.isFunction(n)&&Af(n,i),!!o&&void 0;var c=i.__GetLoadEventsNum(),l=i.__innerSaveImage("SaveAsJPEG",Il(s,a,c),r,n);return o?void 0:l}},{key:"SaveAsPDF",value:function(e,t,r,n){var i=this,o=!1;if((Zt.isFunction(r)||de.bAndroid)&&(o=!0),i._resetErr(),!i._isValid())return Zt.isFunction(n)&&Af(n,i),!!o&&void 0;if(!(Wc.checkProductKey(i,{Core:!0})||de.bWin&&Wc.checkProductKey(i,{Webcam:!0},!0)))return Wc.checkProductKey(i,{Core:!0},!1),Zt.isFunction(n)&&Af(n,i),!!o&&void 0;if(!If(i,t,n))return!!o&&void 0;var a,s=vf.replaceLocalFilename(e);if(de.bAndroid){if(0==i._ImgManager.count())return Ia(i),void(Zt.isFunction(n)&&Af(n,i));var u=[];return u.push(t),void i._saveImages("SaveAsPDF",s,u,Ad.IT_PDF).then((function(){Zt.isFunction(r)&&r()}))["catch"]((function(e){Zt.isFunction(n)&&n(e.code,e.message)}))}if(-1==(a=i._ImgManager.convertClientIndexToServerId(t)))return Ka(i),Zt.isFunction(n)&&Af(n,i),!!o&&void 0;var c=i.__GetLoadEventsNum(),l=i.__innerSaveImage("SaveAsPDF",Il(s,a,c),r,n);return o?void 0:l}},{key:"SaveAsPNG",value:function(e,t,r,n){var i=this,o=!1;if((Zt.isFunction(r)||de.bAndroid)&&(o=!0),i._resetErr(),!i._isValid())return Zt.isFunction(n)&&Af(n,i),!!o&&void 0;if(!(Wc.checkProductKey(i,{Core:!0})||de.bWin&&Wc.checkProductKey(i,{Webcam:!0},!0)))return Wc.checkProductKey(i,{Core:!0},!1),Zt.isFunction(n)&&Af(n,i),!!o&&void 0;if(!If(i,t,n))return!!o&&void 0;var a,s=vf.replaceLocalFilename(e);if(de.bAndroid){if(0==i._ImgManager.count())return Ia(i),void(Zt.isFunction(n)&&Af(n,i));var u=[];return u.push(t),void i._saveImages("SaveAsPNG",s,u,Ad.IT_PNG).then((function(){Zt.isFunction(r)&&r()}))["catch"]((function(e){Zt.isFunction(n)&&n(e.code,e.message)}))}if(-1==(a=i._ImgManager.convertClientIndexToServerId(t)))return Ka(i),Zt.isFunction(n)&&Af(n,i),!!o&&void 0;var c=i.__GetLoadEventsNum(),l=i.__innerSaveImage("SaveAsPNG",Il(s,a,c),r,n);return o?void 0:l}},{key:"SaveAsTIFF",value:function(e,t,r,n){var i=this,o=!1;if((Zt.isFunction(r)||de.bAndroid)&&(o=!0),i._resetErr(),!i._isValid())return Zt.isFunction(n)&&Af(n,i),!!o&&void 0;if(!(Wc.checkProductKey(i,{Core:!0})||de.bWin&&Wc.checkProductKey(i,{Webcam:!0},!0)))return Wc.checkProductKey(i,{Core:!0},!1),Zt.isFunction(n)&&Af(n,i),!!o&&void 0;if(!If(i,t,n))return!!o&&void 0;var a,s=vf.replaceLocalFilename(e);if(de.bAndroid){if(0==i._ImgManager.count())return Ia(i),void(Zt.isFunction(n)&&Af(n,i));var u=[];return u.push(t),void i._saveImages("SaveAsTIFF",s,u,Ad.IT_TIF).then((function(){Zt.isFunction(r)&&r()}))["catch"]((function(e){Zt.isFunction(n)&&n(e.code,e.message)}))}if(-1==(a=i._ImgManager.convertClientIndexToServerId(t)))return Ka(i),Zt.isFunction(n)&&Af(n,i),!!o&&void 0;var c=i.__GetLoadEventsNum(),l=i.__innerSaveImage("SaveAsTIFF",Il(s,a,c),r,n);return o?void 0:l}},{key:"SaveSelectedImagesAsMultiPagePDF",value:function(e,t,r){var n=this,i=!1;if((Zt.isFunction(t)||de.bAndroid)&&(i=!0),n._resetErr(),!n._isValid())return Zt.isFunction(r)&&Af(r,n),!!i&&void 0;if(!(Wc.checkProductKey(n,{Core:!0})||de.bWin&&Wc.checkProductKey(n,{Webcam:!0},!0)))return Wc.checkProductKey(n,{Core:!0},!1),Zt.isFunction(r)&&Af(r,n),!!i&&void 0;var o=vf.replaceLocalFilename(e);if(!de.bAndroid){var a=bf(n);if(0==a.length)return Ia(n),Zt.isFunction(r)&&Af(r,n),!!i&&void 0;var s=n.__GetLoadEventsNum(),u=n.__innerSaveImage("SaveSelectedImagesAsMultiPagePDF",Il(o,a.join(","),s),t,r);return i?void 0:u}if(0==n._ImgManager.count())return Ia(n),void(Zt.isFunction(r)&&Af(r,n));var c=Tf(n);n._saveImages("SaveSelectedImagesAsMultiPagePDF",o,c,Ad.IT_PDF).then((function(){Zt.isFunction(t)&&t()}))["catch"]((function(e){Zt.isFunction(r)&&r(e.code,e.message)}))}},{key:"SaveSelectedImagesAsMultiPageTIFF",value:function(e,t,r){var n=this,i=!1;if((Zt.isFunction(t)||de.bAndroid)&&(i=!0),n._resetErr(),!n._isValid())return Zt.isFunction(r)&&Af(r,n),!!i&&void 0;if(!(Wc.checkProductKey(n,{Core:!0})||de.bWin&&Wc.checkProductKey(n,{Webcam:!0},!0)))return Wc.checkProductKey(n,{Core:!0},!1),Zt.isFunction(r)&&Af(r,n),!!i&&void 0;var o=vf.replaceLocalFilename(e);if(!de.bAndroid){var a=bf(n);if(0==a.length)return Ia(n),Zt.isFunction(r)&&Af(r,n),!!i&&void 0;var s=n.__GetLoadEventsNum(),u=n.__innerSaveImage("SaveSelectedImagesAsMultiPageTIFF",Il(o,a.join(","),s),t,r);return i?void 0:u}if(0==n._ImgManager.count())return Ia(n),void(Zt.isFunction(r)&&Af(r,n));var c=Tf(n);n._saveImages("SaveSelectedImagesAsMultiPageTIFF",o,c,Ad.IT_TIF).then((function(){Zt.isFunction(t)&&t()}))["catch"]((function(e){Zt.isFunction(r)&&r(e.code,e.message)}))}},{key:"SaveAllAsMultiPageTIFF",value:function(e,t,r){var n=this,i=!1;if((Zt.isFunction(t)||de.bAndroid)&&(i=!0),n._resetErr(),!n._isValid())return Zt.isFunction(r)&&Af(r,n),!!i&&void 0;if(!(Wc.checkProductKey(n,{Core:!0})||de.bWin&&Wc.checkProductKey(n,{Webcam:!0},!0)))return Wc.checkProductKey(n,{Core:!0},!1),Zt.isFunction(r)&&Af(r,n),!!i&&void 0;if(!Sf(n,r))return!!i&&void 0;var o=[],a=vf.replaceLocalFilename(e);if(!de.bAndroid){if(yf(n,o),0==o.length)return Ia(n),Zt.isFunction(r)&&Af(r,n),!!i&&void 0;var s=n.__GetLoadEventsNum(),u=n.__innerSaveImage("SaveSelectedImagesAsMultiPageTIFF",Il(a,o.join(","),s),t,r);return i?void 0:u}if(0==n._ImgManager.count())return Ia(n),void(Zt.isFunction(r)&&Af(r,n));for(var c=[],l=0;l<this._ImgManager.count();l++)c.push(l);n._saveImages("SaveAllAsMultiPageTIFF",a,c,Ad.IT_TIF).then((function(){Zt.isFunction(t)&&t()}))["catch"]((function(e){Zt.isFunction(r)&&r(e.code,e.message)}))}},{key:"SaveAllAsPDF",value:function(e,t,r){var n=this,i=!1;if((Zt.isFunction(t)||de.bAndroid)&&(i=!0),n._resetErr(),!n._isValid())return Zt.isFunction(r)&&Af(r,n),!!i&&void 0;if(!(Wc.checkProductKey(n,{Core:!0})||de.bWin&&Wc.checkProductKey(n,{Webcam:!0},!0)))return Wc.checkProductKey(n,{Core:!0},!1),Zt.isFunction(r)&&Af(r,n),!!i&&void 0;if(!Sf(n,r))return!!i&&void 0;var o=[],a=vf.replaceLocalFilename(e);if(!de.bAndroid){if(yf(n,o),0==o.length)return Ia(n),Zt.isFunction(r)&&Af(r,n),!!i&&void 0;var s=n.__GetLoadEventsNum(),u=n.__innerSaveImage("SaveSelectedImagesAsMultiPagePDF",Il(a,o.join(","),s),t,r);return i?void 0:u}if(0==n._ImgManager.count())return Ia(n),void(Zt.isFunction(r)&&Af(r,n));for(var c=[],l=0;l<this._ImgManager.count();l++)c.push(l);n._saveImages("SaveAllAsPDF",a,c,Ad.IT_PDF).then((function(){Zt.isFunction(t)&&t()}))["catch"]((function(e){Zt.isFunction(r)&&r(e.code,e.message)}))}},{key:"HTTPUpload",value:function(e,t,r,n,i,o,a){var s=this,u=null!=i?i:"RemoteFile",c=s._GetHttpHeadersAndClear(),l=o,d=a;if(s._resetErr(),arguments.length<=3)return l=t,d=r,void this._innerFormFieldHTTPUpload(e,c,l,d);if(Zt.isFunction(arguments[4])&&Zt.isFunction(arguments[5])&&(u="RemoteFile",l=arguments[4],arguments.length>5&&(d=arguments[5])),s._isValid()){var f,h=arguments,g=function(e){Zt.isFunction(d)&&xf(d,s,s.__HTTPPostResponseString,e,h)};if(Zt.isUndefined(e)||""===e)return Oa(s),void(g&&g(t));if(!Zt.isString(e))return Ya(s),void(g&&g(t));if(s._checkIndices(t)){var m=Ef(s,t);if(0==m.length)return ya(s),void(g&&g(t));if(Zt.isUndefined(r))return Qa(s),void(g&&g(t));if(r==rr.DWT.EnumDWT_ImageType.IT_BMP||r==rr.DWT.EnumDWT_ImageType.IT_JPG||r==rr.DWT.EnumDWT_ImageType.IT_PNG){if(m.length>1)return ja(s),void g(t)}else if(r!=rr.DWT.EnumDWT_ImageType.IT_TIF&&r!=rr.DWT.EnumDWT_ImageType.IT_PDF)return Qa(s),void g(t);if(Zt.isUndefined(n)||n!=rr.DWT.EnumDWT_UploadDataFormat.Binary&&n!=rr.DWT.EnumDWT_UploadDataFormat.Base64)return qa(s),void g(t);f={method:"HTTPUpload",url:e,serverIds:m,headers:c,formData:JG(s.httpFormFields),enumImageType:r,saveSetup:!1,dataFormat:n,fileName:u,retry:0,bOnlyResponseEmptyIsOK:!0,objUploadFileStatus:!1,asyncSuccessFunc:function(e,t){Zt.isFunction(l)&&kf(l,s.__HTTPPostResponseString,t,h)},asyncFailureFunc:g},this._asyncUploadCmd(f)}else g&&g(t)}else Zt.isFunction(d)&&Af(d,s,"")}},{key:"_innerFormFieldHTTPUpload",value:function(e,t,r,n){var i,o=this,a="HTTPUpload",s=e,u=o.IfShowProgressBar;if(o._isValid()){if(Zt.isUndefined(s)||""===s)return Oa(o),void(Zt.isFunction(n)&&Af(n,o,""));if(!Zt.isString(s))return Ya(o),void(Zt.isFunction(n)&&Af(n,o,""));0!=s.indexOf("http://")&&0!=s.indexOf("https://")&&(s=Qt.detect.ssl?"https://"+s:"http://"+s),o.__HTTPPostResponseString="",Qt.cancelFrom=rG.HTTPUpload,i=function(e,t,r){0!=e&&t&&(o._errorCode=e,o._errorString=t),r&&(o.__HTTPPostResponseString=r),Qt.needShowTwiceShowDialog=!1,Qt.closeProgress(null,a),Zt.isFunction(n)&&Af(n,o,o.__HTTPPostResponseString)},u?Qt.showProgress(o,a,!1):Qt.hideProgress(),Qt.needShowTwiceShowDialog=!0,o._OnPercentDone([0,-1,hl.Uploading,"http"]);var c=o._createHttpUploaderConfig(),l=new hG;o.__remoteFilename&&""!=o.__remoteFilename&&(l.remoteFilename=o.__remoteFilename),l.url=s,l.method=a,l.content=[],l.headers=t,l.httpFormData=JG(o.httpFormFields),l.blockSize=o._moduleSize,(new fG).httpPostUpload(c,l,(function(t){Qt.needShowTwiceShowDialog=!1,Qt.closeProgress(null,a),Zt.isFunction(r)&&kf(r,t,e,[e,r,n])}),i)}else Zt.isFunction(n)&&Af(n,o,"")}},{key:"HTTPUploadThroughPost",value:function(e,t,r,n,i,o,a){var s=this,u=!1;if(Zt.isFunction(i)&&(u=!0),s._resetErr(),!s._isValid())return!!u&&void 0;var c=vf.getImageType(n),l=arguments,d=!1,f=function(e){return Zt.isFunction(o)&&xf(o,s,s.__HTTPPostResponseString,e,l),!1};return Zt.isString(n)&&""!=n?(i&&Zt.isFunction(i)&&(d=function(e,t){return kf(i,s.__HTTPPostResponseString,t,l),!0}),KG(s,t,c,f)?LG(BG,s,VG).call(s,e,t,r,n,c,d,f,a):!!u&&void 0):(Wa(s),f(),!!u&&void 0)}},{key:"HTTPUploadThroughPostEx",value:function(e,t,r,n,i,o,a,s){var u=this,c=!1;if(Zt.isFunction(o)&&(c=!0),u._resetErr(),!u._isValid())return Zt.isFunction(a)&&xf(a,u,""),!!c&&void 0;var l=arguments,d=!1,f=function(e){Zt.isFunction(a)&&xf(a,u,u.__HTTPPostResponseString,e,l)};return Zt.isString(n)&&""!=n?(o&&Zt.isFunction(o)&&(d=function(e,t){kf(o,u.__HTTPPostResponseString,t,l)}),KG(u,t,i,f)?LG(BG,u,VG).call(u,e,t,r,n,i,d,f,s):!!c&&void 0):(Wa(u),f(),!!c&&void 0)}},{key:"HTTPUploadAllThroughPostAsMultiPageTIFF",value:function(e,t,r,n,i,o){var a=this,s=!1;if(Zt.isFunction(n)&&(s=!0),a._resetErr(),!a._isValid())return Zt.isFunction(i)&&xf(i,a,""),!!s&&void 0;var u=arguments,c=!1,l=function(e){Zt.isFunction(i)&&xf(i,a,a.__HTTPPostResponseString,e,u)};return Zt.isString(r)&&""!=r?(s&&(c=function(e,t){kf(n,a.__HTTPPostResponseString,t,u)}),LG(BG,a,VG).call(a,e,-1,t,r,2,c,l,o)):(Wa(a),l(),!!s&&void 0)}},{key:"HTTPUploadAllThroughPostAsPDF",value:function(e,t,r,n,i,o){var a=this,s=!1;if(Zt.isFunction(n)&&(s=!0),a._resetErr(),!a._isValid())return Zt.isFunction(i)&&Af(i,a,""),!!s&&void 0;var u=arguments,c=!1,l=function(e){return Zt.isFunction(i)&&xf(i,a,a.__HTTPPostResponseString,e,u),!1};return Zt.isString(r)&&""!=r?(s&&(c=function(e,t){kf(n,a.__HTTPPostResponseString,t,u)}),LG(BG,a,VG).call(a,e,-1,t,r,4,c,l,o)):(Wa(a),l())}},{key:"HTTPUploadThroughPostAsMultiPagePDF",value:function(e,t,r,n,i,o){var a=this,s=!1;if(Zt.isFunction(n)&&(s=!0),a._resetErr(),!a._isValid())return Zt.isFunction(i)&&Af(i,a,""),!!s&&void 0;var u=arguments,c=!1,l=function(e){Zt.isFunction(i)&&xf(i,a,a.__HTTPPostResponseString,e,u)};return Zt.isString(r)&&""!=r?(s&&(c=function(e,t){kf(n,a.__HTTPPostResponseString,t,u)}),LG(BG,a,VG).call(a,e,-2,t,r,4,c,l,o)):(Wa(a),l(),!!s&&void 0)}},{key:"HTTPUploadThroughPostAsMultiPageTIFF",value:function(e,t,r,n,i,o){var a=this,s=!1;if(Zt.isFunction(n)&&(s=!0),a._resetErr(),!a._isValid())return Zt.isFunction(i)&&Af(i,a,""),!!s&&void 0;var u=arguments,c=!1,l=function(e){Zt.isFunction(i)&&xf(i,a,a.__HTTPPostResponseString,e,u)};return Zt.isString(r)&&""!=r?(s&&(c=function(e,t){kf(n,a.__HTTPPostResponseString,t,u)}),LG(BG,a,VG).call(a,e,-2,t,r,2,c,l,o)):(Wa(a),l(),!!s&&void 0)}},{key:"_innerHTTPDownloadThroughGet",value:function(e,t,r,n,i,o){var a,s,u=this,c=u._GetHttpHeadersAndClear(),l=u.IfShowProgressBar,d=vf.combineUrl(u,t,r),f=!1;if(Zt.isFunction(i)&&(f=!0),d===undefined)return Oa(u),Zt.isFunction(o)&&Af(o,u),!!f&&void 0;if(!Wc.checkProductKey(u,{Core:!0}))return Zt.isFunction(o)&&Af(o,u),!!f&&void 0;if(!Wc.checkPDFProductKeyWhenNeeds(u,n))return Zt.isFunction(o)&&Af(o,u),!!f&&void 0;Qt.cancelFrom=rG.HTTPDownload;var h=null===(a=Qt.progressContext)||void 0===a?void 0:a.IfShowCancelDialogWhenImageTransfer,g=u._getCurrentDocumentName(),m=u._getCurrentDefaultTagName();return Zt.log("_innerHTTPDownloadThroughGet.currentFileName:"+g+", tag="+m),l&&f?(u.__IfShowCancelDialogWhenImageTransfer&&(Qt.progressContext.__cancelBeforObjectCreated=!0),Qt.showProgress(u,e,u.__IfShowCancelDialogWhenImageTransfer)):f&&Qt.hideProgress(),u._OnPercentDone([0,-1,hl.Downloading,"http"]),s=vf.loadHttpBlob(u,"get",d,f,(function(t){Qt.progressContext&&(Qt.progressContext.IfShowCancelDialogWhenImageTransfer=h),l&&f&&dG(!1),u._OnPercentDone([0,-1,hl.Loading]);var r=n;r!=rr.DWT.EnumDWT_ImageType.IT_BMP&&r!=rr.DWT.EnumDWT_ImageType.IT_JPG&&r!=rr.DWT.EnumDWT_ImageType.IT_TIF&&r!=rr.DWT.EnumDWT_ImageType.IT_PNG&&r!=rr.DWT.EnumDWT_ImageType.IT_PDF&&r!=rr.DWT.EnumDWT_ImageType.IT_J2K&&(r=-1),t.currentFileName=g,t.currentTagName=m;var a=u.__GetLoadEventsNum();return u.__LoadImageFromBytesV1(t,r,"",a,f,(function(){return l&&f&&Qt.closeProgress(null,e),Zt.isFunction(i)&&i(),!0}),(function(){return l&&f&&Qt.closeProgress(null,e),Zt.isFunction(o)&&Af(o,u),!1}))}),(function(){return Qt.progressContext&&(Qt.progressContext.IfShowCancelDialogWhenImageTransfer=h),l&&f&&Qt.closeProgress(null,e),Zt.isFunction(o)&&Af(o,u),!1}),(function(e){var t=0===e.total?100:Math.round(100*e.loaded/e.total);[e.loaded," / ",e.total].join(""),t>=100&&e.loaded<e.total&&(t=99),u._OnPercentDone([0,t,"","http"])}),c),f?void 0:!!s}},{key:"LoadImage",value:function(e,t,r){var n=this,i=!1;if(Zt.isFunction(t)&&(i=!0),n._resetErr(),!n._isValid())return Zt.isFunction(r)&&Af(r,n),!!i&&void 0;var o,a,s,u=vf.replaceLocalFilename(e),c=vf.getImageType(u);t&&Zt.isFunction(t)&&(a=function(e){t()}),r&&Zt.isFunction(r)&&(s=function(e){r(e.code,e.message)}),o=n.__GetLoadEventsNum(),""==u&&(n.__bOpenFileNow=!0);var l=n._getCurrentDocumentName(),d=n._getCurrentDefaultTagName();return n.__innerLoadImage("LoadImage",Il(u,o,1,l,d),c,!0,1,a,s)}},{key:"LoadImageEx",value:function(e,t,r,n){var i=this,o=!1;if(Zt.isFunction(r)&&(o=!0),i._resetErr(),!i._isValid())return Zt.isFunction(n)&&Af(n,i),!!o&&void 0;var a,s,u,c=vf.replaceLocalFilename(e),l=t;if(r&&Zt.isFunction(r)&&(s=function(e){r()}),n&&Zt.isFunction(n)&&(u=function(e){n(e.code,e.message)}),!de.bAndroid){l==rr.DWT.EnumDWT_ImageType.IT_ALL&&(l=-1),a=i.__GetLoadEventsNum(),""==c&&(i.__bOpenFileNow=!0);var d=i._getCurrentDocumentName(),f=i._getCurrentDefaultTagName();return i.__innerLoadImage("LoadImageEx",Il(c,l,a,1,d,f),l,!0,1,s,u)}var h=ci.one(".d-loadImage");if(0==h.length){var g=document.createElement("input");g._stwain=i,g.setAttribute("type","file"),g.setAttribute("multiple","multiple"),g.style.position="absolute",g.style.top="-9999px",g.style.left="-9999px",g.style.width="1px",g.style.height="1px",g.className="d-loadImage",t==rr.DWT.EnumDWT_ImageType.IT_BMP?g.setAttribute("accept","image/bmp"):t==rr.DWT.EnumDWT_ImageType.IT_JPG?g.setAttribute("accept","image/jpeg"):t==rr.DWT.EnumDWT_ImageType.IT_TIF?g.setAttribute("accept","image/tiff"):t==rr.DWT.EnumDWT_ImageType.IT_PNG?g.setAttribute("accept","image/png"):t==rr.DWT.EnumDWT_ImageType.IT_PDF?g.setAttribute("accept",".pdf"):t==rr.DWT.EnumDWT_ImageType.IT_J2K?g.setAttribute("accept",".jp2,.j2k,.j2c"):ko.bMobile?g.setAttribute("accept","image/jpeg,image/png,image/tiff,image/tif"):g.setAttribute("accept","image/*,.pdf,.jp2,.j2k,.j2c"),g.ondoubleclick=function(){this.files.length>0&&this._stwain.LoadImageFromBinary(this.files,s,u),this.value="",this._stwain=null,g&&g.parentElement.removeChild(g)},g.onchange=function(){this.files.length>0&&this._stwain.LoadImageFromBinary(this.files,s,u),this.value="",this._stwain=null,g&&g.parentElement.removeChild(g)},document.body.appendChild(g),g.click()}else t==rr.DWT.EnumDWT_ImageType.IT_BMP?h[0].setAttribute("accept","image/bmp"):t==rr.DWT.EnumDWT_ImageType.IT_JPG?h[0].setAttribute("accept","image/jpeg"):t==rr.DWT.EnumDWT_ImageType.IT_TIF?h[0].setAttribute("accept","image/tiff"):t==rr.DWT.EnumDWT_ImageType.IT_PNG?h[0].setAttribute("accept","image/png"):t==rr.DWT.EnumDWT_ImageType.IT_PDF?h[0].setAttribute("accept",".pdf"):t==rr.DWT.EnumDWT_ImageType.IT_J2K?h[0].setAttribute("accept",".jp2,.j2k,.j2c"):ko.bMobile?h[0].setAttribute("accept","image/jpeg,image/png,image/tiff,image/tif"):h[0].setAttribute("accept","image/*,.pdf,.jp2,.j2k,.j2c"),h[0].value="",h[0]._stwain=i,h[0].click()}},{key:"HTTPDownload",value:function(e,t,r,n){var i=this,o=!1;if(Zt.isFunction(r)&&(o=!0),i._resetErr(),!i._isValid())return Zt.isFunction(n)&&Af(n,i),!!o&&void 0;var a=vf.getImageType(t);return i._innerHTTPDownloadThroughGet("HTTPDownload",e,t,a,r,n)}},{key:"HTTPDownloadEx",value:function(e,t,r,n,i){var o=this,a=!1;return Zt.isFunction(n)&&(a=!0),o._resetErr(),o._isValid()?o._innerHTTPDownloadThroughGet("HTTPDownloadEx",e,t,r,n,i):(Zt.isFunction(i)&&Af(i,o),!!a&&void 0)}},{key:"getFormateDate",value:function(){var e=new Date,t=e.getFullYear(),r=e.getMonth()+1,n=e.getDate(),i=e.getHours(),o=e.getMinutes(),a=e.getSeconds();return r<=9&&(r="0"+r),n<=9&&(n="0"+n),i<=9&&(i="0"+i),o<=9&&(o="0"+o),a<=9&&(a="0"+a),{currentTime_title:t+"-"+r+"-"+n+" "+i+":"+o+":"+a,currentTime_info:r+"/"+n+"/"+t+" "+i+":"+o+":"+a}}},{key:"__shareImagesInner",value:function(e,t,r,n){var i=navigator;i.canShare&&i.canShare({files:e})&&i.share({files:e,title:t,text:this.getFormateDate().currentTime_info}).then((function(){Zt.isFunction(r)&&r()}))["catch"]((function(e){Zt.isFunction(n)&&n(e)}))}},{key:"ShareImages",value:(r=n(g().mark((function a(e,t,r){var n,i,o,s,u,c,l,d,f;return g().wrap((function(a){for(;;)switch(a.prev=a.next){case 0:if(n=this,!de.bAndroid){a.next=38;break}if(r!=Ad.IT_ALL&&r!=Ad.IT_MULTIPAGE_PDF&&r!=Ad.IT_MULTIPAGE_TIF){a.next=5;break}throw Is(n),{code:n._errorCode,message:n._errorString};case 5:if(i=t.sort((function(e,t){return e-t})),!(i.length>0)){a.next=36;break}if(o="IMAGE File",r==Ad.IT_PDF&&(o="PDF File"),s=uG(e,r),Zt.isUndefined(s)&&(s=e),r!=Ad.IT_PDF&&r!=Ad.IT_TIF){a.next=15;break}return a.abrupt("return",new ci.Promise((function(e,t){n.ConvertToBlob(i,r,(function(r,i,a){var u=[new File([r],s,{type:r.type})];n.__shareImagesInner(u,o,(function(){e()}),(function(e){t({code:0!=e.code?e.code:2201,message:e.message})}))}),(function(){t({code:n._errorCode,message:n._errorString})}))})));case 15:u=[],c=s,a.t0=r,a.next=a.t0===Ad.IT_BMP?20:a.t0===Ad.IT_JPG?22:a.t0===Ad.IT_PNG?24:26;break;case 20:return l=".bmp",a.abrupt("break",27);case 22:return l=".jpg",a.abrupt("break",27);case 24:return l=".png",a.abrupt("break",27);case 26:l=".jpg";case 27:s&&s.lastIndexOf(".")>0&&(c=s.substring(0,s.lastIndexOf(".")),l=s.substring(s.lastIndexOf("."),s.length)),d=g().mark((function h(e){return g().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,new ci.Promise((function(t,o){n.ConvertToBlob([i[e]],r,(function(r,n,i){0==e?u.push(new File([r],c+l,{type:r.type})):u.push(new File([r],c+e+l,{type:r.type})),t()}),(function(){o({code:n._errorCode,message:n._errorString})}))}));case 2:case"end":return t.stop()}}),h)})),f=0;case 30:if(!(f<i.length)){a.next=35;break}return a.delegateYield(d(f),"t1",32);case 32:f++,a.next=30;break;case 35:n.__shareImagesInner(u,o);case 36:a.next=40;break;case 38:throw ha(n,-2617,"ShareImages is only supported on Android devices."),{code:n._errorCode,message:n._errorString};case 40:case"end":return a.stop()}}),a,this)}))),function(e,t,n){return r.apply(this,arguments)})},{key:"Addon",get:function(){return this.__addon}},{key:"LoadDibFromClipboard",value:function(e,t){var r,n,i=this,o=!1;if(Zt.isFunction(e)&&(o=!0),i._resetErr(),!i._isValid())return Zt.isFunction(t)&&Af(t,i),!!o&&void 0;if(i._bRemoteMode)return ha(i,-2609,"LoadDibFromClipboard is not supported when Object is created by CreateRemoteScanObjectAsync."),Zt.isFunction(t)&&Af(t,i),!!o&&void 0;e&&Zt.isFunction(e)&&(r=function(t){e()}),t&&Zt.isFunction(t)&&(n=function(e){t(e.code,e.message)});var a;return a=i.__GetLoadEventsNum(),i.__innerLoadImage("LoadDibFromClipboard",Il(a,1),-1,!0,1,r,n)}},{key:"__innerGetBarcodeResultAsyncFunction",value:function(e){var t=Qt.NewBarcodeResult();return e&&(t._errorCode=e.exception,t._errorString=e.description,t._resultlist=e.result,t._Count=e.result.length),t}},{key:"__innerGetOCRResultAsyncFunction",value:function(e){var t=Qt.NewOCRResult(this);return e&&(t._errorCode=e.exception,t._errorString=e.description,t._resultlist=e.result),t}},{key:"__innerFTPUpload",value:function(e,t,r,n){return Qt.cancelFrom=rG.FTPUpload,LG(BG,this,HG).call(this,e,t,!0,r,n)}},{key:"_GetHttpHeadersAndClear",value:function(){var e=this.__httpHeaderMap;return this.__httpHeaderMap={},e||(e={}),e}},{key:"_asyncUploadCmd",value:function(e){var r,n=this,i=e.url,o=e.asyncSuccessFunc,a=e.asyncFailureFunc,s=n.IfShowCancelDialogWhenImageTransfer,u=null===(r=Qt.progressContext)||void 0===r?void 0:r.IfShowCancelDialogWhenImageTransfer,c=e.method,l=e.serverIds,d=e.headers,f=e.formData,h=e.enumImageType,g=e.dataFormat,m=e.fileName,p=e.saveSetup,v=e.retry,_=e.bOnlyResponseEmptyIsOK,y=e.objUploadFileStatus,S=function(e,t,r,i){n.IfShowCancelDialogWhenImageTransfer=s,Qt.progressContext&&(Qt.progressContext.IfShowCancelDialogWhenImageTransfer=u);var o=[];if(Zt.isArray(l)&&Zt.each(l,(function(e){var t=n._ImgManager.convertServerIdToClientIndex(e);t>-1&&o.push(t)})),0!=e&&t&&(n._errorCode=e,n._errorString=t),r&&(n.__HTTPPostResponseString=r),Zt.isFunction(a))try{a(o)}catch(c){}return!1};return Zt.isNumber(v)&&v>0||(v=0),0!=n._errorCode?S(n._errorCode,n._errorString,n.__HTTPPostResponseString):(n.__HTTPPostResponseString="",n.IfShowCancelDialogWhenImageTransfer=!0,Qt.progressContext.IfShowCancelDialogWhenImageTransfer=n.IfShowCancelDialogWhenImageTransfer,t._innerHTTPUpload(n,c,i,d,f,l,h,g,m,p,v,_,y,(function(e){if(n.IfShowCancelDialogWhenImageTransfer=s,Qt.progressContext&&(Qt.progressContext.IfShowCancelDialogWhenImageTransfer=u),Zt.isFunction(o)){var t=[];Zt.isArray(l)&&Zt.each(l,(function(e){var r=n._ImgManager.convertServerIdToClientIndex(e);r>-1&&t.push(r)}));try{kf(o,e,t)}catch(r){}e=null}return!0}),S))}}],[{key:"_innerHTTPUpload",value:function(e,t,r,n,i,o,a,s,u,c,l,d,f,h,g){var m=parseInt(a),p=parseInt(s),v=u,_=r,y=e._segementUploadThreshold;if(Zt.isUndefined(a))return Qa(e),Zt.isFunction(g)&&g(e._errorCode,e._errorString,""),!1;e._resetErr(),Qt.cancelFrom=rG.HTTPUpload;var S,I=function(r,n,i,o){return 0!=r&&n&&(e._errorCode=r,e._errorString=n),i&&(e.__HTTPPostResponseString=i),Qt.needShowTwiceShowDialog=!1,e.IfShowProgressBar&&Qt.closeProgress(null,t),Zt.isFunction(g)&&g(e._errorCode,e._errorString,e.__HTTPPostResponseString,o),!1},b=e._createHttpUploaderConfig();if(b.objUploadStatus=f,v=uG(v,m),Qt.needShowTwiceShowDialog=!0,e.IfShowProgressBar?(Qt.showProgress(e,t,!1),Qt.progressContext&&(Qt.progressContext._onPercent=function(e){var t=0;if(e){var r,n;r=e.loaded,n=e.total,(t=Math.floor(r/n*100))>100&&(t=100)}Qt.progressBarOnPercentDone(-1,"Transferring...","",t,"")})):Qt.hideProgress(),p==rr.DWT.EnumDWT_UploadDataFormat.Binary){if(f&&f.bCancel)return f.st=2,ps(e),I(e._errorCode,e._errorString);e._OnPercentDone([0,-1,hl.Encoding,"http"]),e._convertToBlobForUpload(m,o,c,4,(function(r,o,a){if(S=function(r){return Qt.needShowTwiceShowDialog=!1,e.IfShowProgressBar&&Qt.closeProgress(null,t),Zt.isFunction(h)&&kf(h,r),!0},f&&f.bCancel)return f.st=2,ps(e),I(e._errorCode,e._errorString);if(!r||r.size<=0)return Wa(e),I(e._errorCode,e._errorString);var s=e.__maxUploadImageSize;if(r.size>s&&-1!=s)return Na(e),I(e._errorCode,e._errorString);if(0!=e._errorCode)return I(e._errorCode,e._errorString);if(rr.DWT.IfAddMD5InUploadHeader&&o&&""!=o&&(n["dwt-md5"]=o),y>0&&r.size>y){e._OnPercentDone([0,-1,hl.Uploading,"http",v]);var u=new fG,c=new hG;return e.__remoteFilename&&""!=e.__remoteFilename&&(c.remoteFilename=e.__remoteFilename),c.url=_,c.method=t,c.content=r,r=null,c.contentType=e._strHttpContentTypeFieldValue,c.headers=n,c.fileName=v,c.httpFormData=i,c.retry=l,c.bOnlyResponseEmptyIsOK=d,c.blockSize=e._moduleSize,u.httpPostUploadFragment(b,c,S,I)}var g=new fG,m=new hG;e.__remoteFilename&&""!=e.__remoteFilename&&(m.remoteFilename=e.__remoteFilename),m.url=_,m.method=t,m.content=r,r=null,m.contentType=e._strHttpContentTypeFieldValue,m.headers=n,m.fileName=v,m.httpFormData=i,m.retry=l,m.bOnlyResponseEmptyIsOK=d,m.blockSize=e._moduleSize,b.objUploadStatus=f,g.httpPostUpload(b,m,S,I)}),I)}else if(p==rr.DWT.EnumDWT_UploadDataFormat.Base64){e._convertToBase64ByServerIdsWithUI(t,o,m,c,4,(function(r){var o;if(!r||r.getLength()<=0)return Wa(e),I(e._errorCode,e._errorString);if(S=function(){return Qt.needShowTwiceShowDialog=!1,e.IfShowProgressBar&&Qt.closeProgress(null,t),Zt.isFunction(h)&&kf(h,r),!0},y>0&&r.getLength()>y){o=r.getMD5(),rr.DWT.IfAddMD5InUploadHeader&&(n["dwt-md5"]=o),e._OnPercentDone([0,-1,hl.Uploading,"http"]);var a=new hG;e.__remoteFilename&&""!=e.__remoteFilename&&(a.remoteFilename=e.__remoteFilename),a.url=_,a.method=t,a.content=r.getData(0,r.getLength()),a.headers=n,a.fileName=v,a.httpFormData=i,a.retry=l,a.bOnlyResponseEmptyIsOK=d,a.blockSize=e._moduleSize,a.offset=0,(new fG).httpPostUploadFragment(b,a,S,I)}else{var s;if(o=r.getMD5(),rr.DWT.IfAddMD5InUploadHeader&&(n["dwt-md5"]=o),!(s=r.getData(0,r.getLength()))||""==s)return Wa(e),I(e._errorCode,e._errorString);var u=new hG;e.__remoteFilename&&""!=e.__remoteFilename&&(u.remoteFilename=e.__remoteFilename),u.url=_,u.method=t,u.content=s,u.headers=n,u.fileName=v,u.httpFormData=i,u.retry=l,u.bOnlyResponseEmptyIsOK=d,u.blockSize=e._moduleSize,(new fG).httpPostUpload(b,u,S,I)}}),I)}}}]);var r}(PG);function VG(e,t,r,n,i,o,a,s){var u,c,l=this,d="HTTPUploadThroughPostEx",f=l._GetHttpHeadersAndClear(),h=vf.combineUrl(l,e,r),g=[],m=function(e){Zt.isFunction(a)&&a(e)},p=!1,v=!1;if(Zt.isFunction(o)&&(v=!0),l.__HTTPPostResponseString="",Zt.isNumber(t)){if(t<-2)return Ka(l),m(t),!!v&&void 0}else if(!Zt.isArray(t))return Ka(l),m(t),!!v&&void 0;if(!Zt.isString(n)||""==n)return Wa(l),m(),!!v&&void 0;if(Zt.isUndefined(i))return Qa(l),m(t),!!v&&void 0;if(i==rr.DWT.EnumDWT_ImageType.IT_BMP||i==rr.DWT.EnumDWT_ImageType.IT_JPG||i==rr.DWT.EnumDWT_ImageType.IT_PNG||i==rr.DWT.EnumDWT_ImageType.IT_J2K){if(-1==t&&l._ImgManager.count()>1||Zt.isArray(t)&&t.length>1)return ja(l),m(t),!!v&&void 0;Zt.isArray(t)?g.push(t[0]):-1==t?g.push(0):g.push(t)}else{if(i!=rr.DWT.EnumDWT_ImageType.IT_TIF&&i!=rr.DWT.EnumDWT_ImageType.IT_PDF)return Qa(l),m(t),!!v&&void 0;if(-1==t){if(0==l._ImgManager.count())return Ia(l),m(),!!v&&void 0;for(c=0;c<l._ImgManager.count();c++)g.push(c)}else if(-2==t)g=l._ImgManager.getSelectedClientIndexArray();else if(Zt.isArray(t))for(c=0;c<t.length;c++)g.push(t[c]);else g.push(t)}if(""===e)return Ea(l),m(g),!!v&&void 0;if(Zt.isUndefined(h)||""===h)return Oa(l),m(g),!!v&&void 0;if(!Zt.isString(h))return Ya(l),m(g),!!v&&void 0;if(0!=h.indexOf("http://")&&0!=h.indexOf("https://")&&(h=Qt.detect.ssl?"https://"+h:"http://"+h),!l._checkIndices(g)&&-1!=g)return m(g),!!v&&void 0;var _=[];if(Zt.isArray(g)&&Zt.each(g,(function(e){var t=l._ImgManager.convertClientIndexToServerId(e);-1!=t&&_.push(t)})),l._resetErr(),!l._isValid())return m(g),!!v&&void 0;if(!v){Qt.cancelFrom=rG.HTTPUpload;var y=this.IfShowProgressBar,S=function(e,t,r){return 0!=e&&t&&(l._errorCode=e,l._errorString=t),r&&(l.__HTTPPostResponseString=r),Qt.needShowTwiceShowDialog=!1,y&&Qt.closeProgress(null,d),m(g),!1};return Qt.needShowTwiceShowDialog=!0,y?Qt.showProgress(l,d,!1):Qt.hideProgress(),l._OnPercentDone([0,-1,hl.Encoding,"http"]),l._dwtConvertToBlobSync(i,_,p,(function(e,t){if(Qt.needShowTwiceShowDialog=!1,e){var r=l.__maxUploadImageSize;if(e.size>r&&-1!=r)return Na(l),S(l._errorCode,l._errorString),!1;rr.DWT.IfAddMD5InUploadHeader&&t&&""!=t&&(f["dwt-md5"]=t),e instanceof File?e.fileName=n:e.name=n,y&&dG(l.__IfShowCancelDialogWhenImageTransfer);var i=l._createHttpUploaderConfig(),o=new hG;return l.__remoteFilename&&""!=l.__remoteFilename&&(o.remoteFilename=l.__remoteFilename),o.url=h,o.method=d,o.content=e,o.contentType=l._strHttpContentTypeFieldValue,o.headers=f,o.bAsync=!1,o.httpFormData=JG(l.httpFormFields),o.blockSize=l._moduleSize,(new fG).httpPostUpload(i,o,(function(e){return y&&Qt.closeProgress(null,d),e}),S)}var a={};return xa(a),S(a._errorCode,a._errorString),!1}),S)}u={method:"HTTPUploadThroughPostEx",url:h,serverIds:_,headers:f,formData:JG(l.httpFormFields),enumImageType:i,saveSetup:p,fileName:n,retry:0,bOnlyResponseEmptyIsOK:!0,objUploadFileStatus:!1,dataFormat:rr.DWT.EnumDWT_UploadDataFormat.Binary,asyncSuccessFunc:o,asyncFailureFunc:m},this._asyncUploadCmd(u)}function jG(e,t,r,n,i){var o=this,a=!0;if(t)return o._innerFunRaw("SaveSelectedImagesToBytes",Il(0,0,e,r),t,a,!0,(function(e){if(Zt.isFunction(n)){var t=new Blob([e],{type:o._strHttpContentTypeFieldValue});n(t),t=null}}),i),!0;var s=o._innerFunRaw("SaveSelectedImagesToBytes",Il(0,0,e,r),t,a,!1);if(0==o._errorCode){var u=n(s);return s=null,u}return s=null,i(),!1}function GG(){return this._resetErr(),!!this._isValid()&&(this._innerSend("SetCancel",null,!0),!0)}function HG(e,t,r,n,i){var o=this;if(!Zt.isFunction(n))return this._innerFun(e,t);o.IfShowProgressBar?(Qt.showProgress(o,e,r),r&&Qt.progressContext&&Qt.progressContext.on("cancel",(function(){LG(BG,o,GG).call(o)}))):Qt.hideProgress(),this._innerSend(e,t,!0,(function(){Qt.closeProgress(null,e),Zt.isFunction(n)&&n()}),(function(t){Zt.isFunction(i)&&i(o._errorCode,o._getErrorString()),Qt.closeProgress(null,e),t&&Zt.error(t)}))}function zG(e,t,r,n,i){var o,a=this,s=!1;if(Zt.isFunction(n)&&(s=!0),!Wc.checkProductKey(a,{Core:!0}))return Zt.isFunction(i)&&Af(i,a),!!s&&void 0;if(!Wc.checkPDFProductKeyWhenNeeds(a,r))return Zt.isFunction(i)&&Af(i,a),!!s&&void 0;if(Qt.cancelFrom=rG.FTPDownload,!s){var u=a._getCurrentDocumentName(),c=a._getCurrentDefaultTagName();(o=a.__innerLoadImageFun(e,t,1,u,c))&&a._canConsume()&&rr.DWT.lcvrf(a);var l=a._ImgManager.getCurrentImageIndex();return l>=0&&a._innerRefreshUI(l),o}LG(BG,a,HG).call(a,e,t,!0,(function(){var e=a._ImgManager.getCurrentImageIndex();e>=0&&a._innerRefreshUI(e),a._canConsume()&&rr.DWT.lcvrf(a),Zt.isFunction(n)&&n()}),i)}function KG(e,t,r,n){if(0==e._ImgManager.count())return Ia(e),Zt.isFunction(n)&&n(t),!1;if(Zt.isNumber(t)){if(isNaN(t)||t<-2||t>=e._ImgManager.count())return Ka(e),Zt.isFunction(n)&&n(t),!1}else{if(!Zt.isArray(t))return Ka(e),Zt.isFunction(n)&&n(t),!1;var i;for(i=0;i<t.length;i++){var o=t[i];if(isNaN(o)||!Zt.isNumber(o)||o<0||o>=e._ImgManager.count())return Ga(e),Zt.isFunction(n)&&n(t),!1}}if(r==rr.DWT.EnumDWT_ImageType.IT_BMP||r==rr.DWT.EnumDWT_ImageType.IT_JPG||r==rr.DWT.EnumDWT_ImageType.IT_PNG||r==rr.DWT.EnumDWT_ImageType.IT_J2K)(-1==t&&e._ImgManager.count()>1||Zt.isArray(t)&&t.length>1)&&(ja(e),Zt.isFunction(n)&&n(t));else if(r!=rr.DWT.EnumDWT_ImageType.IT_TIF&&r!=rr.DWT.EnumDWT_ImageType.IT_PDF)return Qa(e),Zt.isFunction(n)&&n(t),!1;return!0}function JG(e){var t;return e&&(t=new FormData,Zt.each(e,(function(e,r){if(e instanceof Blob){var n=e.name;t.append(r,e,n)}else t.append(r,e)}))),t}var QG=function(e){function t(){return o(this,t),i(this,t,arguments)}return f(t,e),s(t,[{key:"Viewer",get:function(){return this._viewer}},{key:"BindViewer",value:function(e){var t=this,r=e;return rr.DWT.UseDefaultViewer?(Zt.isString(e)&&(r=Zt.get(e),Zt.show(r)),t._config.container!=r&&(t._config.container=r,CG(t)),t._UIView.BindView(e)):(ha(t,-2439,"You cannot call the method bindViewer() when Dynamsoft.DWT.UseDefaultViewer is set to false."),!1)}},{key:"UnbindViewer",value:function(){return this._innerUnbindViewer(!1)}},{key:"AddText",value:function(e,t,r,n,i,o,a,s){var u=this,c=parseInt(e);if(!Cf(u,c))return!1;var l=li.RGB2BGR(i),d=li.RGB2BGR(o),f=u._ImgManager.convertClientIndexToServerId(c);return-1==f?(Ka(u),!1):u._innerFun("AddText",Il(f,t,r,n,l,d,a,s))}},{key:"CreateTextFont",value:function(e,t,r,n,i,o,a,s,u,c,l,d,f,h){return this._resetErr(),!!this._isValid()&&this._innerFun("CreateTextFont",Il(e,t,r,n,i,o,a,s,u,c,l,d,f,h))}},{key:"CopyToClipboard",value:function(e){var t=parseInt(e);return!!Cf(this,t)&&qG(this,"CopyToClipboard",t,null,null,!1,!1)}},{key:"CopyToClipboardAsync",value:function(e){var t=this;if(t._resetErr(),!t._isValid())return ci.Promise.reject({code:t._errorCode,message:t._errorString});var r=parseInt(e);return isNaN(r)?(ya(t),ci.Promise.reject({code:t._errorCode,message:t._errorString})):r<0||r>=t._ImgManager.count()?(Ka(t),ci.Promise.reject({code:t._errorCode,message:t._errorString})):function(e,t,r){var n=e._ImgManager.convertClientIndexToServerId(r);if(-1==n)return Ka(e),ci.Promise.reject({code:e._errorCode,message:e._errorString});return e._innerFunV2(t,Il(n))}(t,"CopyToClipboard",r)}},{key:"getView",value:function(){return this._UIView}},{key:"Erase",value:function(e,t,r,n,i,o,a){var s=this;if(!Zt.isFunction(o)){var u,c=parseInt(e);if(!Cf(s,c,a))return!1;var l=s._ImgManager.convertClientIndexToServerId(c);return-1==l?(Ka(s),Zt.isFunction(a)&&a(s._errorCode,s._getErrorString()),!1):(s.getView().ClearSelectedAreas(),(u=1==s._innerFun("Erase",Il(l,t,r,n,i)))?Zt.isFunction(o)&&o():Zt.isFunction(a)&&a(s._errorCode,s._getErrorString()),u)}s.EraseAsync(e,t,r,n,i).then(o,(function(e){s._wrappeAsyncFailed(s,e,a)}))}},{key:"EraseAsync",value:function(e,t,r,n,i){var o=this;if(o._resetErr(),!o._isValid())return ci.Promise.reject({code:o._errorCode,message:o._errorString});var a=parseInt(e);if(isNaN(a))return ya(o),ci.Promise.reject({code:o._errorCode,message:o._errorString});if(a<0||a>=o._ImgManager.count())return Ka(o),ci.Promise.reject({code:o._errorCode,message:o._errorString});var s=o._ImgManager.convertClientIndexToServerId(a);return-1==s?(Ka(o),ci.Promise.reject({code:o._errorCode,message:o._errorString})):(o.getView().ClearSelectedAreas(),o._innerFunV2("Erase",Il(s,t,r,n,i),!0).then((function(e){if(1!=e)throw{code:o._errorCode,message:o._errorString}})))}},{key:"GetImageBitDepth",value:function(e){var t=this,r=parseInt(e);if(!Cf(t,r))return!1;var n=t._ImgManager.convertClientIndexToServerId(r);return-1==n?(Ka(t),!1):t._innerFun("GetImageBitDepth",Il(n))}},{key:"GetImageWidth",value:function(e){var t=this;if(t._resetErr(),!t._isValid())return!1;var r=parseInt(e);if(isNaN(r))return ya(t),-1;if(r<0||r>=t._ImgManager.count())return Ka(t),-1;var n=t._ImgManager.convertClientIndexToServerId(r);return-1==n?(Ka(t),-1):t._innerFun("GetImageWidth",Il(n))}},{key:"GetImageHeight",value:function(e){var t=this;if(t._resetErr(),!t._isValid())return!1;var r=parseInt(e);if(isNaN(r))return ya(t),-1;if(r<0||r>=t._ImgManager.count())return Ka(t),-1;var n=t._ImgManager.convertClientIndexToServerId(r);return-1==n?(Ka(t),-1):t._innerFun("GetImageHeight",Il(n))}},{key:"GetImageSize",value:function(e,t,r){var n=this;if(n._resetErr(),!n._isValid())return!1;var i=parseInt(e);if(isNaN(i))return ya(n),-1;if(i<0||i>=n._ImgManager.count())return Ka(n),-1;var o=n._ImgManager.convertClientIndexToServerId(i);return-1==o?(Ka(n),-1):n._innerFun("GetImageSize",Il(o,t,r))}},{key:"GetImageSizeWithSpecifiedType",value:function(e,t){var r=this;if(r._resetErr(),!r._isValid())return!1;var n=parseInt(e);if(isNaN(n))return ya(r),-1;if(n<0||n>=r._ImgManager.count())return Ka(r),-1;var i=r._ImgManager.convertClientIndexToServerId(n);return-1==i?(Ka(r),-1):r._innerFun("GetImageSizeWithSpecifiedType",Il(i,t))}},{key:"GetImageXResolution",value:function(e){var t=this,r=parseInt(e);if(!Cf(t,r))return!1;var n=t._ImgManager.convertClientIndexToServerId(r);return-1==n?(Ka(t),!1):t._innerFun("GetImageXResolution",Il(n))}},{key:"GetImageYResolution",value:function(e){var t=this,r=parseInt(e);if(!Cf(t,r))return!1;var n=t._ImgManager.convertClientIndexToServerId(r);return-1==n?(Ka(t),!1):t._innerFun("GetImageYResolution",Il(n))}},{key:"SelectAllImages",value:function(){var e,t=this,r=t._getHowManyImagesInBuffer(),n=[];if(t._resetErr(),!t._isValid())return!1;for(e=0;e<r;e++)n.push(e);return t._ImgManager.setSelectedClientIndexArray(n),n}},{key:"SelectImages",value:function(e){var t=this;return t._resetErr(),!!t._isValid()&&t._ImgManager.setSelectedClientIndexArray(e)}},{key:"GetSkewAngle",value:function(e,t,r){var n,i=this;if(!Zt.isFunction(t)){var o=parseInt(e);return!!Cf(i,o,r)&&(n=qG(i,"GetSkewAngle",o,t,r,!0,!1),0==i._errorCode?(vf.refreshImageAfterInvokeFun(i,o),n):0)}i.GetSkewAngleAsync(e).then(t,(function(e){i._wrappeAsyncFailed(i,e,r)}))}},{key:"GetSkewAngleAsync",value:function(e){var t=this;if(t._resetErr(),!t._isValid())return ci.Promise.reject({code:t._errorCode,message:t._errorString});var r=parseInt(e);if(isNaN(r))return ya(t),ci.Promise.reject({code:t._errorCode,message:t._errorString});if(r<0||r>=t._ImgManager.count())return Ka(t),ci.Promise.reject({code:t._errorCode,message:t._errorString});var n=t._ImgManager.convertClientIndexToServerId(r);return-1==n?(Ka(t),ci.Promise.reject({code:t._errorCode,message:t._errorString})):t._innerFunV2("GetSkewAngle",Il(n),!0).then((function(e){var n=e;return Zt.isArray(e)&&(n=e.length>0?e[0]:0),vf.refreshImageAfterInvokeFun(t,r),n}))}},{key:"GetSkewAngleEx",value:function(e,t,r,n,i){var o=this,a=parseInt(e);if(!Cf(o,a))return!1;var s=o._ImgManager.convertClientIndexToServerId(a);return-1==s?(Ka(o),!1):o._innerFun("GetSkewAngleEx",Il(s,t,r,n,i))}},{key:"GetSkewAngleFromBinaryAsync",value:function(e,t,r,n){var i=this;if(i._resetErr(),!i._isValid())return ci.Promise.reject({code:i._errorCode,message:i._errorString});var o=this._imageBufferWrapper.getCustomDataByIndex(e),a=this._imageBufferWrapper.getMetadataByIndex(e),s=this._ImgManager.convertClientIndexToServerId(e),u={imageId:s,serverId:s,bufferLen:t.size,imageType:Ad.IT_BMP,width:a.width,height:a.height,bit:a.bitDepth,xres:a.resolutionX,yres:a.resolutionY,uidFromServer:o.uidFromServer},c=Zt.stringify([Zt.stringify(u)]);return this._innerSendBlob("GetSkewAngleFromBinary",c,t,!0,!0,r,n)}},{key:"IsBlankImageEx",value:function(e,t,r,n,i,o){var a,s=this;if(!Cf(s,a=parseInt(e)))return!1;var u=s._ImgManager.convertClientIndexToServerId(a);return-1==u?(Ka(s),!1):s._innerFun("IsBlankImageEx",Il(u,t,r,n,i,o))}},{key:"MirrorAsync",value:function(e){var t=this;if(t._resetErr(),!t._isValid())return ci.Promise.reject({code:t._errorCode,message:t._errorString});var r=parseInt(e);if(isNaN(r))return ya(t),ci.Promise.reject({code:t._errorCode,message:t._errorString});if(r<0||r>=t._ImgManager.count())return Ka(t),ci.Promise.reject({code:t._errorCode,message:t._errorString});var n=t._ImgManager.convertClientIndexToServerId(r);return-1==n?(Ka(t),ci.Promise.reject({code:t._errorCode,message:t._errorString})):t._innerFunV2("Mirror",Il(n),!0).then((function(e){if(1!=e)throw{code:t._errorCode,message:t._errorString};vf.refreshImageAfterInvokeFun(t,r),t.getView().ClearSelectedAreas()}))}},{key:"Mirror",value:function(e,t,r){var n=this;if(!Zt.isFunction(t)){var i=parseInt(e);return!!Cf(n,i,r)&&qG(n,"Mirror",i,t,r,!1,!0)}n.MirrorAsync(e).then(t,(function(e){n._wrappeAsyncFailed(n,e,r)}))}},{key:"RemoveAllImages",value:function(){return this._removeAllImages("RemoveAllImages")}},{key:"RemoveAllImagesAsync",value:function(){return this._removeAllImagesAsync("RemoveAllImagesAsync",!0)}},{key:"RemoveImageAsync",value:function(e){var t=this;if(t._resetErr(),!t._isValid())return ci.Promise.reject({code:t._errorCode,message:t._errorString});var r=parseInt(e);if(isNaN(r))return ya(t),ci.Promise.reject({code:t._errorCode,message:t._errorString});if(r<0||r>=t._ImgManager.count())return Ka(t),ci.Promise.reject({code:t._errorCode,message:t._errorString});var n=t._ImgManager.convertClientIndexToServerId(r);return-1==n?(Ka(t),ci.Promise.reject({code:t._errorCode,message:t._errorString})):t._innerFunV2("RemoveImage",Il(n),!0).then((function(e){return!(!e&&-1033!=t._errorCode)&&(t._OnBitmapChanged(["c1",""+n,3,t._ImgManager.getCurrentImageIndex(),t._ImgManager.count()]),!0)}))}},{key:"Rotate",value:function(e,t,r,n,i){return this.RotateEx(e,t,r,-1,n,i)}},{key:"_wrappeAsyncFailed",value:function(e,t,r){t&&(e._errorCode=t.code,e._errorString=t.message),Zt.isFunction(r)&&r(e._errorCode,e._getErrorString())}},{key:"RotateEx",value:function(e,t,r,n,i,o){var a=this;if(!Zt.isFunction(i)){if(a._resetErr(),!a._isValid())return!1;var s,u=parseInt(e);if(isNaN(u))return ya(a),Zt.isFunction(o)&&o(a._errorCode,a._getErrorString()),!1;if(u<0||u>=a._ImgManager.count())return Ka(a),Zt.isFunction(o)&&o(a._errorCode,a._getErrorString()),!1;var c=a._ImgManager.convertClientIndexToServerId(u);return-1==c?(Ka(a),Zt.isFunction(o)&&o(a._errorCode,a._getErrorString()),!1):((s=1==a._innerFun("RotateEx",Il(c,t,r,n)))?(vf.refreshImageAfterInvokeFun(a,u),a.getView().ClearSelectedAreas(),Zt.isFunction(i)&&i()):Zt.isFunction(o)&&o(a._errorCode,a._getErrorString()),s)}a.RotateExAsync(e,t,r,n).then(i,(function(e){a._wrappeAsyncFailed(a,e,o)}))}},{key:"RotateLeft",value:function(e,t,r){return this.RotateEx(e,-90,!0,-1,t,r)}},{key:"RotateRight",value:function(e,t,r){return this.RotateEx(e,90,!0,-1,t,r)}},{key:"RotateAsync",value:function(e,t,r){return this.RotateExAsync(e,t,r,-1)}},{key:"RotateExAsync",value:function(e,t,r,n){var i=this;if(i._resetErr(),!i._isValid())return ci.Promise.reject({code:i._errorCode,message:i._errorString});var o=parseInt(e);if(isNaN(o))return ya(i),ci.Promise.reject({code:i._errorCode,message:i._errorString});if(o<0||o>=i._ImgManager.count())return Ka(i),ci.Promise.reject({code:i._errorCode,message:i._errorString});var a=i._ImgManager.convertClientIndexToServerId(o);return-1==a?(Ka(i),ci.Promise.reject({code:i._errorCode,message:i._errorString})):i._innerFunV2("RotateEx",Il(a,t,r,n),!0).then((function(e){if(1!=e&&1!=e)throw{code:i._errorCode,message:i._errorString};vf.refreshImageAfterInvokeFun(i,o),i.getView().ClearSelectedAreas()}))}},{key:"RotateLeftAsync",value:function(e){return this.RotateExAsync(e,-90,!0,-1)}},{key:"RotateRightAsync",value:function(e){return this.RotateExAsync(e,90,!0,-1)}},{key:"ChangeImageSize",value:function(e,t,r,n,i,o){var a=this;if(!Zt.isFunction(i)){var s,u=parseInt(e),c=1*t,l=1*r;if(!Cf(a,u,o))return!1;if(c<=0||l<=0)return Ra(a),Zt.isFunction(o)&&o(a._errorCode,a._getErrorString()),!1;var d=a._ImgManager.convertClientIndexToServerId(u);return-1==d?(Ka(a),Zt.isFunction(o)&&o(a._errorCode,a._getErrorString()),!1):((s=1==a._innerFun("ChangeImageSize",Il(d,c,l,n)))?(vf.refreshImageAfterInvokeFun(a,u),Zt.isFunction(i)&&i()):Zt.isFunction(o)&&o(a._errorCode,a._getErrorString()),s)}a.ChangeImageSizeAsync(e,t,r,n).then(i,(function(e){a._wrappeAsyncFailed(a,e,o)}))}},{key:"ChangeImageSizeAsync",value:function(e,t,r,n){var i=this,o=parseInt(e),a=1*t,s=1*r;if(i._resetErr(),!i._isValid())return ci.Promise.reject({code:i._errorCode,message:i._errorString});if(isNaN(o))return ya(i),ci.Promise.reject({code:i._errorCode,message:i._errorString});if(o<0||o>=i._ImgManager.count())return Ka(i),ci.Promise.reject({code:i._errorCode,message:i._errorString});if(a<=0||s<=0)return Ra(i),ci.Promise.reject({code:i._errorCode,message:i._errorString});var u=i._ImgManager.convertClientIndexToServerId(o);return-1==u?(Ka(i),ci.Promise.reject({code:i._errorCode,message:i._errorString})):i._innerFunV2("ChangeImageSize",Il(u,a,s,n),!0).then((function(e){if(1!=e)throw{code:i._errorCode,message:i._errorString};vf.refreshImageAfterInvokeFun(i,o)}))}},{key:"Flip",value:function(e,t,r){var n=this;if(!Zt.isFunction(t)){var i=parseInt(e);return!!Cf(n,i,r)&&qG(n,"Flip",i,t,r,!1,!0)}n.FlipAsync(e).then(t,(function(e){n._wrappeAsyncFailed(n,e,r)}))}},{key:"FlipAsync",value:function(e){var t=this;if(t._resetErr(),!t._isValid())return ci.Promise.reject({code:t._errorCode,message:t._errorString});var r=parseInt(e);if(isNaN(r))return ya(t),ci.Promise.reject({code:t._errorCode,message:t._errorString});if(r<0||r>=t._ImgManager.count())return Ka(t),ci.Promise.reject({code:t._errorCode,message:t._errorString});var n=t._ImgManager.convertClientIndexToServerId(r);return-1==n?(Ka(t),ci.Promise.reject({code:t._errorCode,message:t._errorString})):t._innerFunV2("Flip",Il(n),!0).then((function(e){if(1!=e)throw{code:t._errorCode,message:t._errorString};vf.refreshImageAfterInvokeFun(t,r),t.getView().ClearSelectedAreas()}))}},{key:"OutputSelectedAreaAsync",value:(c=n(g().mark((function l(e,t,r,n){var i,o,a,s,u,c,d,f,h,m,p,v,_,y;return g().wrap((function(l){for(;;)switch(l.prev=l.next){case 0:if(a="OutputSelectedArea",(o=this)._resetErr(),o._isValid()){l.next=4;break}throw{code:o._errorCode,message:o._errorString};case 4:if(s=0,u=0,c=0,d=0,!isNaN(e)){l.next=8;break}throw ya(o),{code:o._errorCode,message:o._errorString};case 8:if(r==Ad.IT_BMP||r==Ad.IT_JPG||r==Ad.IT_TIF||r==Ad.IT_PNG||r==Ad.IT_PDF){l.next=11;break}throw rs(o),{code:o._errorCode,message:o._errorString};case 11:if(n==mG.Blob||n==mG.Base64){l.next=14;break}throw rs(o),{code:o._errorCode,message:o._errorString};case 14:if(!(e<0||e>=o._ImgManager.count())){l.next=17;break}throw Ka(o),{code:o._errorCode,message:o._errorString};case 17:if(-1!=(f=o._ImgManager.convertClientIndexToServerId(e))){l.next=21;break}throw Ka(o),{code:o._errorCode,message:o._errorString};case 21:return h=n==mG.Base64,m=h?"text":"arraybuffer",t&&(Qt.isNumber(t.x)&&(s=t.x),Qt.isNumber(t.y)&&(u=t.y),Qt.isNumber(t.width)&&(c=t.width),Qt.isNumber(t.height)&&(d=t.height)),v=Zt.stringify([{index:f,left:s,top:u,width:c,height:d}]),_="["+v+","+r+","+n+"]",y=null===(i=Qt.progressContext)||void 0===i?void 0:i.IfShowCancelDialogWhenImageTransfer,l.prev=27,o.IfShowProgressBar?Qt.showProgress(o,a,!1):Qt.hideProgress(),h?o._OnPercentDone([0,-1,hl.ConvertingToBase64]):o._OnPercentDone([0,-1,hl.ConvertingToBlob]),Qt.progressContext&&(Qt.progressContext.IfShowCancelDialogWhenImageTransfer=!1),l.next=33,o._sendDataByHttpAsync(a,_,m,!0);case 33:p=l.sent;case 34:return l.prev=34,Qt.progressContext&&(Qt.progressContext.IfShowCancelDialogWhenImageTransfer=y),o.IfShowProgressBar&&Qt.closeProgress(null,a),l.finish(34);case 38:if(!h){l.next=51;break}if(!p){l.next=48;break}if(!eu(p)){l.next=44;break}return o._errorCode=p.exception,o._errorString=p.description,l.abrupt("return","");case 44:if(!(Zt.isArray(p.result)&&p.result.length>0&&Zt.isString(p.result[0]))){l.next=46;break}return l.abrupt("return",p.result[0]);case 46:l.next=49;break;case 48:return l.abrupt("return","");case 49:l.next=52;break;case 51:return l.abrupt("return",new Blob([p],{type:Pd(r)}));case 52:case"end":return l.stop()}}),l,this,[[27,,34,38]])}))),function(e,t,r,n){return c.apply(this,arguments)})},{key:"Crop",value:function(e,t,r,n,i,o,a){var s=this;if(!Zt.isFunction(o)){var u,c=parseInt(e);if(!Cf(s,c,a))return!1;var l,d,f=s._ImgManager.convertClientIndexToServerId(c);return-1==f?(Ka(s),Zt.isFunction(a)&&a(s._errorCode,s._getErrorString()),!1):(u=1==s._innerFun("Crop",Il(f,t,r,n,i)),l=s._errorCode,d=s._getErrorString(),s.getView().ClearSelectedAreas(),s._errorCode=l,s._errorString=d,u?(vf.refreshImageAfterInvokeFun(s,c),Zt.isFunction(o)&&o()):Zt.isFunction(a)&&a(l,d),u)}s.CropAsync(e,t,r,n,i).then(o,(function(e){s._wrappeAsyncFailed(s,e,a)}))}},{key:"CropAsync",value:function(e,t,r,n,i){var o=this;if(o._resetErr(),!o._isValid())return ci.Promise.reject({code:o._errorCode,message:o._errorString});var a=parseInt(e);if(isNaN(a))return ya(o),ci.Promise.reject({code:o._errorCode,message:o._errorString});if(a<0||a>=o._ImgManager.count())return Ka(o),ci.Promise.reject({code:o._errorCode,message:o._errorString});var s=o._ImgManager.convertClientIndexToServerId(a);return-1==s?(Ka(o),ci.Promise.reject({code:o._errorCode,message:o._errorString})):o._innerFunV2("Crop",Il(s,t,r,n,i),!0).then((function(e){var t,r;if(t=o._errorCode,r=o._getErrorString(),o.getView().ClearSelectedAreas(),o._errorCode=t,o._errorString=r,1!=e)throw{code:o._errorCode,message:o._errorString};return vf.refreshImageAfterInvokeFun(o,a),!0}))}},{key:"CropToClipboard",value:function(e,t,r,n,i){var o,a=this,s=parseInt(e);if(!Cf(a,s))return!1;var u=a._ImgManager.convertClientIndexToServerId(s);return-1==u?(Ka(a),!1):(a.getView().ClearSelectedAreas(),(o=1==a._innerFun("CropToClipboard",Il(u,t,r,n,i)))&&vf.refreshImageAfterInvokeFun(a,s),o)}},{key:"CutFrameToClipboard",value:function(e,t,r,n,i){var o,a=this,s=parseInt(e);if(!Cf(a,s))return!1;var u=a._ImgManager.convertClientIndexToServerId(s);return-1==u?(Ka(a),!1):(a.getView().ClearSelectedAreas(),(o=1==a._innerFun("CutFrameToClipboard",Il(u,t,r,n,i)))&&vf.refreshImageAfterInvokeFun(a,s),o)}},{key:"CutToClipboard",value:function(e){var t,r=this,n=parseInt(e);if(!Cf(r,n))return!1;var i=r._ImgManager.convertClientIndexToServerId(n);return-1==i?(Ka(r),!1):((t=1==r._innerFun("CutToClipboard",Il(i)))&&r._OnBitmapChanged(["c1",""+i,3,r._ImgManager.getCurrentImageIndex(),r._ImgManager.count()]),t)}},{key:"CutFrameToClipboardAsync",value:function(e,t,r,n,i){var o=this;if(o._resetErr(),!o._isValid())return ci.Promise.reject({code:o._errorCode,message:o._errorString});var a=parseInt(e);if(isNaN(a))return ya(o),ci.Promise.reject({code:o._errorCode,message:o._errorString});if(a<0||a>=o._ImgManager.count())return Ka(o),ci.Promise.reject({code:o._errorCode,message:o._errorString});var s=o._ImgManager.convertClientIndexToServerId(a);return-1==s?(Ka(o),ci.Promise.reject({code:o._errorCode,message:o._errorString})):o._innerFunV2("CutFrameToClipboard",Il(s,t,r,n,i)).then((function(e){var t=1==e;if(!t)throw{code:o._errorCode,message:o._errorString};return vf.refreshImageAfterInvokeFun(o,a),t}))}},{key:"CropToClipboardAsync",value:function(e,t,r,n,i){var o=this;if(o._resetErr(),!o._isValid())return ci.Promise.reject({code:o._errorCode,message:o._errorString});var a=parseInt(e);if(isNaN(a))return ya(o),ci.Promise.reject({code:o._errorCode,message:o._errorString});if(a<0||a>=o._ImgManager.count())return Ka(o),ci.Promise.reject({code:o._errorCode,message:o._errorString});var s=o._ImgManager.convertClientIndexToServerId(a);return-1==s?(Ka(o),ci.Promise.reject({code:o._errorCode,message:o._errorString})):o._innerFunV2("CropToClipboard",Il(s,t,r,n,i)).then((function(e){var t=1==e;if(!t)throw{code:o._errorCode,message:o._errorString};return vf.refreshImageAfterInvokeFun(o,a),t}))}},{key:"CutToClipboardAsync",value:function(e){var t=this;if(t._resetErr(),!t._isValid())return ci.Promise.reject({code:t._errorCode,message:t._errorString});var r=parseInt(e);if(isNaN(r))return ya(t),ci.Promise.reject({code:t._errorCode,message:t._errorString});if(r<0||r>=t._ImgManager.count())return Ka(t),ci.Promise.reject({code:t._errorCode,message:t._errorString});var n=t._ImgManager.convertClientIndexToServerId(r);return-1==n?(Ka(t),ci.Promise.reject({code:t._errorCode,message:t._errorString})):t._innerFunV2("CutToClipboard",Il(n)).then((function(e){var r=1==e;if(!r)throw{code:t._errorCode,message:t._errorString};return t._OnBitmapChanged(["c1",""+n,3,t._ImgManager.getCurrentImageIndex(),t._ImgManager.count()]),r}))}},{key:"SetDPI",value:function(e,t,r,n,i,o,a){var s,u=this,c=!1;Zt.isFunction(o)&&(c=!0);var l=parseInt(e);if(!Cf(u,l,a))return!!c&&void 0;var d=u._ImgManager.convertClientIndexToServerId(l);return-1==d?(Ka(u),Zt.isFunction(a)&&a(u._errorCode,u._getErrorString()),!!c&&void 0):((s=1==u._innerFun("SetDPI",Il(d,t,r,n,i)))?Zt.isFunction(o)&&o():Zt.isFunction(a)&&a(u._errorCode,u._getErrorString()),c?void 0:s)}},{key:"MoveImage",value:function(e,t){var r=this;if(r._resetErr(),!r._isValid())return!1;var n=parseInt(e),i=parseInt(t);return isNaN(n)||isNaN(i)?(ya(r),!1):n<0||n>=r._ImgManager.count()||i<0||i>=r._ImgManager.count()?(Ka(r),!1):r._ImgManager.moveImage(n,i)}},{key:"SwitchImage",value:function(e,t){var r=this;if(r._resetErr(),!r._isValid())return!1;var n=parseInt(e),i=parseInt(t);return isNaN(n)||isNaN(i)?(ya(r),!1):n<0||n>=r._ImgManager.count()||i<0||i>=r._ImgManager.count()?(Ka(r),!1):r._ImgManager.switchImage(n,i)}},{key:"CloseWorkingProcess",value:function(){var e=this;return e._resetErr(),!!e._isValid()&&e._innerFun("CloseWorkerProcess")}},{key:"RemoveAllSelectedImages",value:function(){var e=this;if(e._resetErr(),!e._isValid())return!1;var t=!0,r=e._ImgManager.getCurrentImageIndex(),n=e._ImgManager.getSelectedClientIndexArray(),i=[];if(Zt.isArray(n)&&Zt.each(n,(function(t){var r=e._ImgManager.convertClientIndexToServerId(t);-1!=r&&i.push(r)})),0==i.length&&r>=0){var o=e._ImgManager.convertClientIndexToServerId(r);i.push(o)}return i.length>0&&(t=e._innerFun("RemoveAllSelectedImages",Il(i.join(",")))),t&&Zt.each(i,(function(t){e._OnBitmapChanged(["c1",""+t,3,e._ImgManager.getCurrentImageIndex(),e._ImgManager.count()])})),t}},{key:"RemoveAllSelectedImagesAsync",value:function(){var e=this;if(e._resetErr(),!e._isValid())return ci.Promise.reject({code:e._errorCode,message:e._errorString});var t=e._ImgManager.getCurrentImageIndex(),r=e._ImgManager.getSelectedClientIndexArray(),n=[];if(Zt.isArray(r)&&Zt.each(r,(function(t){var r=e._ImgManager.convertClientIndexToServerId(t);-1!=r&&n.push(r)})),0==n.length&&t>=0){var i=e._ImgManager.convertClientIndexToServerId(t);n.push(i)}return n.length>0?e._innerFunV2("RemoveAllSelectedImages",Il(n.join(","),!0)).then((function(t){t&&Zt.each(n,(function(t){e._OnBitmapChanged(["c1",""+t,3,e._ImgManager.getCurrentImageIndex(),e._ImgManager.count()])}))})):ci.Promise.resolve()}},{key:"TagImages",value:function(e,t){var r=this;if(r._resetErr(),!r._isValid())return!1;var n=!0,i=r._ImgManager.count();return Zt.isArray(e)?Zt.isString(t)&&""!=t?(Zt.each(e,(function(e){if(isNaN(e)||e<0||e>=i)return Ka(r),n=!1})),n?r._ImgManager.addImageTag(e,t):n):(ha(r,-2394,"Invalid tag name."),!1):(za(r),!1)}},{key:"ClearImageTags",value:function(e){var t=this;return t._resetErr(),!!t._isValid()&&(-1==e||e>=t._getHowManyImagesInBuffer()?(Ka(t),!1):t._ImgManager.removeImageTag(e))}},{key:"SetDefaultTag",value:function(e){var t=this;return t._resetErr(),!!t._isValid()&&t._ImgManager.setDefaultTag(e)}},{key:"FilterImagesByTag",value:function(e,t,r){var n,i=this,o=!1;if(Zt.isFunction(t)&&(o=!0),i._resetErr(),!i._isValid())return!!o&&void 0;Zt.isFunction(r)&&(n=function(){r({code:i._errorCode,message:i._errorString})});var a=i._ImgManager.showImagesByFilter(e,t,n);return o?void 0:a}},{key:"ClearFilter",value:function(){var e=this;return e._resetErr(),!!e._isValid()&&e._ImgManager.clearFilter()}},{key:"CreateDocument",value:function(e){var t=this;return t._resetErr(),!!t._isValid()&&(e&&""!=e?Zt.isString(e)?t._ImgManager.CreateFile(e):(ss(t),!1):(Zt.isNumber(e)?ss(t):as(t),!1))}},{key:"OpenDocument",value:function(e){var t=this;return t._resetErr(),!!t._isValid()&&(e&&""!=e?Zt.isString(e)?t._ImgManager.OpenFile(e):(ss(t),!1):(Zt.isNumber(e)?ss(t):as(t),!1))}},{key:"RemoveDocument",value:function(e){var t=this;if(t._resetErr(),!t._isValid())return!1;var r=t._ImgManager.GetServerIdsByFileName(e);return r.length>0&&t._innerFun("RemoveAllSelectedImages",Il(r.join(","))),t._ImgManager.RemoveFile(e)}},{key:"RenameDocument",value:function(e,t){var r=this;return r._resetErr(),!!r._isValid()&&(Zt.isString(e)&&Zt.isString(t)?e&&""!=e&&t&&""!=t?r._ImgManager.RenameFile(e,t):(as(r),!1):(ss(r),!1))}},{key:"GetDocumentInfoList",value:function(){var e=this;return e._resetErr(),!!e._isValid()&&e._ImgManager.GetFileInfoList()}},{key:"MoveToDocumentAsync",value:(u=n(g().mark((function d(e,t,r,n){var i,o,a,s,u,c,l,f,h,m;return g().wrap((function(d){for(;;)switch(d.prev=d.next){case 0:if((i=this)._resetErr(),i._isValid()){d.next=4;break}throw{code:i._errorCode,message:i._errorString};case 4:if(!Zt.isUndefined(e)&&0!=e.length){d.next=7;break}throw Ls(i),{code:i._errorCode,message:i._errorString};case 7:if(!Zt.isUndefined(t)&&0!=t.length){d.next=10;break}throw Bs(i),{code:i._errorCode,message:i._errorString};case 10:o=i._ImgManager.GetFileInfoList(),u=0;case 12:if(!(u<o.length)){d.next=20;break}if(o[u].name!=e){d.next=17;break}return a=o[u],d.abrupt("break",20);case 17:u++,d.next=12;break;case 20:c=0;case 21:if(!(c<o.length)){d.next=29;break}if(o[c].name!=t){d.next=26;break}return s=o[c],d.abrupt("break",29);case 26:c++,d.next=21;break;case 29:if(!Zt.isUndefined(a)){d.next=32;break}throw Ls(i),{code:i._errorCode,message:i._errorString};case 32:if(!Zt.isUndefined(s)){d.next=35;break}throw Bs(i),{code:i._errorCode,message:i._errorString};case 35:if(l=[],!Zt.isUndefined(r)){d.next=40;break}if(a.imageIds.length>0)for(h=0;h<a.imageIds.length;h++)l.push(h);d.next=60;break;case 40:if(!Zt.isArray(r)){d.next=53;break}if(i._checkIndices(r,a.imageIds.length)){d.next=43;break}throw{code:i._errorCode,message:i._errorString};case 43:if(l=r,Zt.isUndefined(n)){d.next=51;break}if(!Zt.isNumber(n)){d.next=49;break}n<0?f=0:s.imageIds.length>n&&(f=n),d.next=51;break;case 49:throw rs(i),{code:i._errorCode,message:i._errorString};case 51:d.next=60;break;case 53:if(!Zt.isNumber(r)){d.next=58;break}if(a.imageIds.length>0)for(m=0;m<a.imageIds.length;m++)l.push(m);r<0?f=0:s.imageIds.length>r&&(f=r),d.next=60;break;case 58:throw rs(i),{code:i._errorCode,message:i._errorString};case 60:return d.abrupt("return",new ci.Promise((function(r,n){0==l.length||i._ImgManager.MoveImageToFile(e,l,t,f)?r():n({code:i._errorCode,message:i._errorString})})));case 61:case"end":return d.stop()}}),d,this)}))),function(e,t,r,n){return u.apply(this,arguments)})},{key:"CopyToDocumentAsync",value:(a=n(g().mark((function h(e,t,r,n){var i,o,a,s,u,c,l,d;return g().wrap((function(f){for(;;)switch(f.prev=f.next){case 0:if((i=this)._resetErr(),i._isValid()){f.next=4;break}throw{code:i._errorCode,message:i._errorString};case 4:if(!Zt.isUndefined(e)&&0!=e.length){f.next=7;break}throw Ls(i),{code:i._errorCode,message:i._errorString};case 7:if(!Zt.isUndefined(t)&&0!=t.length){f.next=10;break}throw Bs(i),{code:i._errorCode,message:i._errorString};case 10:o=i._ImgManager.GetFileInfoList(),u=0;case 12:if(!(u<o.length)){f.next=20;break}if(o[u].name!=e){f.next=17;break}return a=o[u],f.abrupt("break",20);case 17:u++,f.next=12;break;case 20:c=0;case 21:if(!(c<o.length)){f.next=29;break}if(o[c].name!=t){f.next=26;break}return s=o[c],f.abrupt("break",29);case 26:c++,f.next=21;break;case 29:if(!Zt.isUndefined(a)){f.next=32;break}throw Ls(i),{code:i._errorCode,message:i._errorString};case 32:if(!Zt.isUndefined(s)){f.next=35;break}throw Bs(i),{code:i._errorCode,message:i._errorString};case 35:if(l=[],!Zt.isUndefined(r)){f.next=40;break}a.imageIds.length>0&&Zt.isArray(a.imageIds)&&Zt.each(a.imageIds,(function(e){var t=i._uidFromServer2ServerId(e);-1!=t&&l.push(t)})),f.next=60;break;case 40:if(!Zt.isArray(r)){f.next=53;break}if(i._checkIndices(r,a.imageIds.length)){f.next=43;break}throw{code:i._errorCode,message:i._errorString};case 43:if(Zt.each(r,(function(e){var t=i._uidFromServer2ServerId(a.imageIds[e]);-1!=t&&l.push(t)})),Zt.isUndefined(n)){f.next=51;break}if(!Zt.isNumber(n)){f.next=49;break}n<0?d=0:s.imageIds.length>n&&(d=n),f.next=51;break;case 49:throw rs(i),{code:i._errorCode,message:i._errorString};case 51:f.next=60;break;case 53:if(!Zt.isNumber(r)){f.next=58;break}a.imageIds.length>0&&Zt.isArray(a.imageIds)&&Zt.each(a.imageIds,(function(e){var t=i._uidFromServer2ServerId(e);-1!=t&&l.push(t)})),r<0?d=0:s.imageIds.length>r&&(d=r),f.next=60;break;case 58:throw rs(i),{code:i._errorCode,message:i._errorString};case 60:return f.abrupt("return",new ci.Promise((function(e,r){var n="copyToDocument";if(s.imageIds.length,0==l.length)e();else{i.IfShowProgressBar?zs(!1):Qt.hideProgress();var o=i.IfShowCancelDialogWhenImageTransfer;Qt.cancelFrom=rG.LoadImage,i.IfShowCancelDialogWhenImageTransfer=!1,Qt.progressContext&&(Qt.progressContext.IfShowCancelDialogWhenImageTransfer=!1),Qt.cancelFrom=rG.Other,i._innerConvertToBlobWithUI(n,rr.DWT.EnumDWT_ImageType.IT_PDF,l,!1,(function(a,s){var u;a.currentFileName=t,a.currentTagName="",a.bNeedClearCurrentTagName=!0,a.index=d,i.IfShowProgressBar?(zs(!1),Qt.showProgress(i,n,!1),Qt.progressContext&&(Qt.progressContext.IfShowCancelDialogWhenImageTransfer=!1)):Qt.hideProgress(),Qt.cancelFrom=rG.LoadImage,i.Addon&&i.Addon.PDF&&(u=i.Addon.PDF.GetReaderOptions(),i.Addon.PDF.SetReaderOptions({convertMode:rr.DWT.EnumDWT_ConvertMode.CM_IMAGEONLY})),i._innerLoadImageFromBinary(a,0,!0,!0,(function(){i.Addon&&i.Addon.PDF&&u&&i.Addon.PDF.SetReaderOptions(u),i.IfShowCancelDialogWhenImageTransfer=o,i.IfShowProgressBar&&Qt.closeProgress(null,n),e()}),(function(){i.Addon&&i.Addon.PDF&&u&&i.Addon.PDF.SetReaderOptions(u),i.IfShowCancelDialogWhenImageTransfer=o,i.IfShowProgressBar&&Qt.closeProgress(null,n),r({code:i._errorCode,message:i._errorString})}))}),(function(){i.IfShowCancelDialogWhenImageTransfer=o,r({code:i._errorCode,message:i._errorString})}))}})));case 61:case"end":return f.stop()}}),h,this)}))),function(e,t,r,n){return a.apply(this,arguments)})},{key:"Invert",value:function(e,t,r){var n=this,i=!1;if(Zt.isFunction(t)&&(i=!0),!i){var o=parseInt(e);return!!Cf(n,o,r)&&qG(n,"Invert",o,t,r,!1,!0)}n.InvertAsync(e).then(t,(function(e){n._wrappeAsyncFailed(n,e,r)}))}},{key:"InvertAsync",value:function(e){return this._invert(e)}},{key:"RenameTag",value:function(e,t){var r=this;return r._resetErr(),!!r._isValid()&&(Zt.isUndefined(e)?(Oa(r),!1):0==e.length?(ha(r,-2517,"Old tag name is required."),!1):Zt.isUndefined(t)||0==t.length?(function(e){ha(e,-2518,"New tag name is required.")}(r),!1):r._ImgManager.renameTag(e,t))}},{key:"RemoveTag",value:function(e,t){var r=this;return r._resetErr(),!!r._isValid()&&(Zt.isUndefined(e)||0==e.length?(Oa(r),!1):Zt.isUndefined(t)||Zt.isArray(t)?r._ImgManager.removeTag(e,t):(za(r),!1))}},{key:"GetTagList",value:function(){var e=this;return e._resetErr(),!!e._isValid()&&e._ImgManager.getTagList()}},{key:"GetTagListByIndex",value:function(e){var t=this;if(t._resetErr(),!t._isValid())return[];var r=parseInt(e);return isNaN(r)?(ya(t),[]):r<0||r>=t._ImgManager.count()||-1==t._ImgManager.convertClientIndexToServerId(r)?(Ka(t),[]):t._ImgManager.getTagListByIndex(r)}},{key:"GetImageBitDepthAsync",value:function(e){var t=this;if(t._resetErr(),!t._isValid())return ci.Promise.reject({code:t._errorCode,message:t._errorString});var r=parseInt(e);if(isNaN(r))return ya(t),ci.Promise.reject({code:t._errorCode,message:t._errorString});if(r<0||r>=t._ImgManager.count())return Ka(t),ci.Promise.reject({code:t._errorCode,message:t._errorString});var n=t._ImgManager.convertClientIndexToServerId(r);return-1==n?(Ka(t),ci.Promise.reject({code:t._errorCode,message:t._errorString})):t._innerFunV2("GetImageBitDepth",Il(n))}},{key:"GetImageWidthAsync",value:function(e){var t=this;if(t._resetErr(),!t._isValid())return ci.Promise.reject({code:t._errorCode,message:t._errorString});var r=parseInt(e);if(isNaN(r))return ya(t),ci.Promise.reject({code:t._errorCode,message:t._errorString});if(r<0||r>=t._ImgManager.count())return Ka(t),ci.Promise.reject({code:t._errorCode,message:t._errorString});var n=t._ImgManager.convertClientIndexToServerId(r);return-1==n?(Ka(t),ci.Promise.reject({code:t._errorCode,message:t._errorString})):t._innerFunV2("GetImageWidth",Il(n))}},{key:"GetImageHeightAsync",value:function(e){var t=this;if(t._resetErr(),!t._isValid())return ci.Promise.reject({code:t._errorCode,message:t._errorString});var r=parseInt(e);if(isNaN(r))return ya(t),ci.Promise.reject({code:t._errorCode,message:t._errorString});if(r<0||r>=t._ImgManager.count())return Ka(t),ci.Promise.reject({code:t._errorCode,message:t._errorString});var n=t._ImgManager.convertClientIndexToServerId(r);return-1==n?(Ka(t),ci.Promise.reject({code:t._errorCode,message:t._errorString})):t._innerFunV2("GetImageHeight",Il(n))}},{key:"GetImageSizeAsync",value:function(e,t,r){var n=this;if(n._resetErr(),!n._isValid())return ci.Promise.reject({code:n._errorCode,message:n._errorString});var i=parseInt(e);if(isNaN(i))return ya(n),ci.Promise.reject({code:n._errorCode,message:n._errorString});if(i<0||i>=n._ImgManager.count())return Ka(n),ci.Promise.reject({code:n._errorCode,message:n._errorString});var o=n._ImgManager.convertClientIndexToServerId(i);return-1==o?(Ka(n),ci.Promise.reject({code:n._errorCode,message:n._errorString})):n._innerFunV2("GetImageSize",Il(o,t,r))}},{key:"GetImageSizeWithSpecifiedTypeAsync",value:function(e,t){var r=this;if(r._resetErr(),!r._isValid())return ci.Promise.reject({code:r._errorCode,message:r._errorString});var n=parseInt(e);if(isNaN(n))return ya(r),ci.Promise.reject({code:r._errorCode,message:r._errorString});if(n<0||n>=r._ImgManager.count())return Ka(r),ci.Promise.reject({code:r._errorCode,message:r._errorString});var i=r._ImgManager.convertClientIndexToServerId(n);return-1==i?(Ka(r),ci.Promise.reject({code:r._errorCode,message:r._errorString})):r._innerFunV2("GetImageSizeWithSpecifiedType",Il(i,t))}},{key:"GetImageXResolutionAsync",value:function(e){var t=this;if(t._resetErr(),!t._isValid())return ci.Promise.reject({code:t._errorCode,message:t._errorString});var r=parseInt(e);if(isNaN(r))return ya(t),ci.Promise.reject({code:t._errorCode,message:t._errorString});if(r<0||r>=t._ImgManager.count())return Ka(t),ci.Promise.reject({code:t._errorCode,message:t._errorString});var n=t._ImgManager.convertClientIndexToServerId(r);return-1==n?(Ka(t),ci.Promise.reject({code:t._errorCode,message:t._errorString})):t._innerFunV2("GetImageXResolution",Il(n))}},{key:"GetImageYResolutionAsync",value:function(e){var t=this;if(t._resetErr(),!t._isValid())return ci.Promise.reject({code:t._errorCode,message:t._errorString});var r=parseInt(e);if(isNaN(r))return ya(t),ci.Promise.reject({code:t._errorCode,message:t._errorString});if(r<0||r>=t._ImgManager.count())return Ka(t),ci.Promise.reject({code:t._errorCode,message:t._errorString});var n=t._ImgManager.convertClientIndexToServerId(r);return-1==n?(Ka(t),ci.Promise.reject({code:t._errorCode,message:t._errorString})):t._innerFunV2("GetImageYResolution",Il(n))}},{key:"ChangeBrightnessAsync",value:function(e,t){var r=this,n=parseInt(e);if(!r._isValid())return ci.Promise.reject({code:r._errorCode,message:r._errorString});if(t<-1e3||t>1e3)return Sa(r),ci.Promise.reject({code:r._errorCode,message:r._errorString});var i=r._ImgManager.convertClientIndexToServerId(n);return-1==i?(Ka(r),ci.Promise.reject({code:r._errorCode,message:r._errorString})):r._innerFunV2("ChangeBrightness",Il(i,t))}},{key:"ChangeContrastAsnyc",value:function(e,t){var r=this,n=parseInt(e);if(!r._isValid())return ci.Promise.reject({code:r._errorCode,message:r._errorString});if(t<-1e3||t>1e3)return Sa(r),ci.Promise.reject({code:r._errorCode,message:r._errorString});var i=r._ImgManager.convertClientIndexToServerId(n);return-1==i?(Ka(r),ci.Promise.reject({code:r._errorCode,message:r._errorString})):r._innerFunV2("ChangeContrast",Il(i,t))}},{key:"GetImageAsync",value:function(e,t,r,n,i){var o=this;if(o._resetErr(),!o._isValid())return ci.Promise.reject({code:o._errorCode,message:o._errorString});var a=parseInt(e);if(isNaN(a))return ya(o),ci.Promise.reject({code:o._errorCode,message:o._errorString});if(a<0||a>=o._ImgManager.count())return Ka(o),ci.Promise.reject({code:o._errorCode,message:o._errorString});var s,u=o._ImgManager.convertClientIndexToServerId(a);return-1==u?(Ka(o),ci.Promise.reject({code:o._errorCode,message:o._errorString})):(Zt.isNumber(t)?s=Il(u,t):Zt.isNumber(r)&&Zt.isNumber(n)?s=Il(u,r,n):Zt.isNumber(i)&&(s=Il(u,-1,-1,i)),o._sendDataByHttpAsync("GetImageByIndex",s,"blob"))}},{key:"GetImageInfoAsync",value:function(e){var t=this;if(t._resetErr(),!t._isValid())return ci.Promise.reject({code:t._errorCode,message:t._errorString});var r=parseInt(e);if(isNaN(r))return ya(t),ci.Promise.reject({code:t._errorCode,message:t._errorString});if(r<0||r>=t._ImgManager.count())return Ka(t),ci.Promise.reject({code:t._errorCode,message:t._errorString});var n=t._ImgManager.convertClientIndexToServerId(r);return-1==n?(Ka(t),ci.Promise.reject({code:t._errorCode,message:t._errorString})):t._innerFunV2("GetImageInfo",Il(n)).then((function(e){var t=0,r=0,n=e;if(Zt.isArray(e)&&1==e.length&&(n=e[0]),Zt.isString(n)){var i=n.split(",");t=parseInt(i[0]),r=parseInt(i[1])}return{width:t,height:r}}))}},{key:"IfShowUI",get:function(){return this._resetErr(),this._isValid()?this._innerFun("IfShowUI"):di},set:function(e){this._setIfShowUI(e)}},{key:"IfShowFileDialog",get:function(){return this._getIfShowFileDialog()},set:function(e){this._setIfShowFileDialog(e)}},{key:"checkErrorString",value:function(){var e=this._errorCode;if(-2115===e)return!0;if(-2003===e&&!rr.DWT.IfHttpPostErrorNoWindow){var t=window.open("","ErrorMessage","height=500,width=750,top=0,left=0,toolbar=no,menubar=no,scrollbars=no, resizable=no,location=no, status=no");null==t||t.document.writeln(this.__HTTPPostResponseString)}return 0===e}},{key:"OverlayRectangle",value:function(e,t,r,n,i,o,a){var s,u=this;return u._resetErr(),!!u._isValid()&&(u._isNoViewer()?u._nouiNotSupport("OverlayRectangle"):t>n||r>i||t==n&&r==i?(ha(u,-2375,"The left or top or right or bottom you entered is invalid."),!1):(s=Zt.isNumber(o)?li.getColor(o):o,u._UIView.OverlayRectangle(e,t,r,n,i,s,a)))}},{key:"SetViewMode",value:function(e,t){var r=this;if(r._resetErr(),!r._isValid())return!1;if(r._isNoViewer())return r._nouiNotSupport("SetViewMode");if(Zt.isString(e)||Zt.isString(t)||e<-1&&t<-1)return Sa(r),di;var n=Math.floor(e),i=Math.floor(t);return r._UIView.SetViewMode(n,i),!0}},{key:"ShowImageEditor",value:function(e,t,r,n){var i=this;return i._resetErr(),!!i._isValid()&&(i._isNoViewer()?i._nouiNotSupport("ShowImageEditor"):Zd.isServerInvalid(i)?di:i._UIView.GetWebViewer().webViewer.imageEditor?i.ShowImageEditorEx(-1,-1,-1,-1,3):e&&t&&r?i.ShowImageEditorEx(-1,-1,t,r,0,!0,e,n):i.ShowImageEditorEx(-1,-1,-1,-1,0,!1))}},{key:"ShowImageEditorEx",value:function(e,t,r,n,i,o,a,s){var u=this;return u._resetErr(),!!u._isValid()&&(u._isNoViewer()?u._nouiNotSupport("ShowImageEditorEx"):u._UIView.ShowImageEditorEx(e,t,r,n,i,o,a,s))}},{key:"SetSelectedImageArea",value:function(e,t,r,n,i){var o=this;if(o._resetErr(),!o._isValid())return!1;if(o._isNoViewer())return o._nouiNotSupport("SetSelectedImageArea");var a=parseInt(e);return isNaN(a)||a<0||a>=o._ImgManager.count()?(Ka(o),!1):!Zd.isServerInvalid(o)&&o._UIView.SetSelectedImageArea(t,r,n,i)}},{key:"first",value:function(){var e=this,t=e._ImgManager.count();return e._resetErr(),!!e._isValid()&&(e._isNoViewer()?e._nouiNotSupport("first"):(t>0&&(e._UIView.Go(0),IG.__innerRefreshFromUIView(e,e._ImgManager.getCurrentImageIndex())),fi))}},{key:"previous",value:function(){var e=this,t=e._ImgManager.count();return e._resetErr(),!!e._isValid()&&(e._isNoViewer()?e._nouiNotSupport("previous"):(t>0&&(e._UIView.__Previous(),IG.__innerRefreshFromUIView(e,e._ImgManager.getCurrentImageIndex())),fi))}},{key:"next",value:function(){var e=this,t=e._ImgManager.count();return e._resetErr(),!!e._isValid()&&(e._isNoViewer()?e._nouiNotSupport("next"):(t>0&&(e._UIView.__Next(),IG.__innerRefreshFromUIView(e,e._ImgManager.getCurrentImageIndex())),fi))}},{key:"last",value:function(){var e=this,t=e._ImgManager.count();return e._resetErr(),!!e._isValid()&&(e._isNoViewer()?e._nouiNotSupport("last"):(t>0&&(e._UIView.Go(t-1),IG.__innerRefreshFromUIView(e,e._ImgManager.getCurrentImageIndex())),fi))}},{key:"_isBindViewer",value:function(){return!(!this._viewer||!this._viewer.webViewer)&&this._viewer.webViewer.bindViewUI}},{key:"_isNoViewer",value:function(){return!this._isBindViewer()}},{key:"_innerUnbindViewer",value:function(e){var t=this;t.__funResize&&(Zt.removeEventListener(window,"resize",t.__funResize),t.__funResize=di),t._viewer&&(e?t._viewer.webViewer.dispose():t._viewer.unbind()),t._config.container=null}},{key:"_unload_viewer",value:function(){var e=this;if(e._isBindViewer())e._innerUnbindViewer(!0);else{var t,r=null===(t=e._containerElement)||void 0===t?void 0:t.id;r&&delete rr.DWT.ContainerMap[r]}e._ImgManager&&(e._ImgManager.dispose(),e._ImgManager=null),e._UIView&&(e._UIView.dispose(),e._UIView=null),e._viewer=null}},{key:"_innerRefreshUI",value:function(e,t,r,n,i){var o=this;return 4==i&&o._isBindViewer()&&(0==o._ImgManager.bImageJustChangedInEditor?o._ImgManager.bImageChangedInViewer=!0:(o._ImgManager.bImageJustChangedInEditor=!1,o._ImgManager.bImageChangedInViewer=!1)),r&&o._ImgManager.refresh(e,o._ImgManager.count(),!0,n),Zt.isFunction(o.__OnRefreshUI)&&o.__OnRefreshUI(o._ImgManager.getCurrentImageIndex(),o._ImgManager.count()),!0}},{key:"updateImage",value:(r=n(g().mark((function m(e,t){var r,n,i,o;return g().wrap((function(a){for(;;)switch(a.prev=a.next){case 0:if(n=this,xd.Auto,!Zt.isUndefined(e)&&0!=e.length){a.next=7;break}throw ha(n,-2853,"The imageId cannot be empty."),{code:n._errorCode,message:n._errorString};case 7:if(Zt.isString(e)){a.next=10;break}throw ts(n),{code:n._errorCode,message:n._errorString};case 10:if(-1!=(i=n._uidFromServer2ServerId(e))){a.next=14;break}throw Ns(n),{code:n._errorCode,message:n._errorString};case 14:if(!Zt.isUndefined(t)){a.next=19;break}throw Os(n),{code:n._errorCode,message:n._errorString};case 19:if(t instanceof Blob){a.next=22;break}throw Ms(n),{code:n._errorCode,message:n._errorString};case 22:return a.next=24,YG(t);case 24:return o=a.sent,a.next=27,n._updateImage(i,o);case 27:null===(r=n._UIView.GetWebViewer())||void 0===r||null===(r=r.webViewer)||void 0===r||r.resetImageEditorButton();case 28:case"end":return a.stop()}}),m,this)}))),function(e,t){return r.apply(this,arguments)})}],[{key:"ProcessGetBlobByQueue",value:function(){if(t._getblob_queue.length>0&&!t._processing_getblob_queue){t._processing_getblob_queue=!0;var e=t._getblob_queue.shift(),r=e[0],n=e[1],i=e[2];r._convertToBlobForUpload(rr.DWT.EnumDWT_ImageType.IT_PNG,[n],!1,4,(function(e,n,o){var a=o[1][0],s=r._ImgManager.getImageIdMap(a);if(s){var u={imageId:a,serverId:a,uidFromServer:s.uidFromServer,uuid:s.uuid,imageUrl:URL.createObjectURL(e),minImageUrl:URL.createObjectURL(e)};e=null,r._ImgManager.UpdateImage(u,i)}t._processing_getblob_queue=!1,setTimeout(t.ProcessGetBlobByQueue,0)}),(function(e){t._processing_getblob_queue=!1,setTimeout(t.ProcessGetBlobByQueue,0)}))}}},{key:"_getContainer",value:function(e){return e._containerElement}},{key:"_setContainer",value:function(e,t){return e._containerElement=t}},{key:"_closeImageEditorUI",value:function(e){if(Zt.isFunction(e.__CloseImageEditorUI))try{e.__CloseImageEditorUI()}catch(t){Ho(t)}}}]);var r,a,u,c}(UG);function qG(e,t,r,n,i,o,a){var s,u=e._ImgManager.convertClientIndexToServerId(r);if(-1==u)return Ka(e),Zt.isFunction(i)&&i(e._errorCode,e._errorString),!1;if(s=e._innerFun(t,Il(u)),o)return s;var c=1==s;return c?(a&&(vf.refreshImageAfterInvokeFun(e,r),e.getView().ClearSelectedAreas()),Zt.isFunction(n)&&n()):Zt.isFunction(i)&&i(e._errorCode,e._errorString),c}function YG(e){return Zt.isFunction(e.arrayBuffer)?e.arrayBuffer():new Qt.Promise((function(t,r){if(rr.navInfoSync.bIE||rr.navInfoSync.bSafari){var n=new FileReader;n.onload=function(){t(n.result)},n.onerror=function(e){r(e)},n.readAsArrayBuffer(e)}else{var i;ha(i={},-2856,"Cannot convert blob to array buffer."),r({code:i._errorCode,message:i._errorString})}}))}c(QG,"_processing_getblob_queue",!1),c(QG,"_getblob_queue",[]);var XG=function(e){return e.normal=0,e.balance=1,e}({}),ZG="data:image/gif;base64,R0lGODlhZABkAKUAAPyOFPzKjPyuVPzmxPy+dPyeNPzarPz27PzSnPy2ZPymRPzGhPyWJPzu3PzixPzOnPyyZPzChPyiRPzevPz+/PzWrPy6dPyqVPzOlPyyXPzq1PzCfPyiPPzetPz69PzWpPy6bPyqTPyaLPySHPzKlPyuXPzmzPy+fPyePPzatPz29PzSpPy2bPymTPzGjPyWLPzy5P///wAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAACH/C05FVFNDQVBFMi4wAwEAAAAh+QQJCQAxACwAAAAAZABkAAAG/sCYcEgsGo/IpHLJbDqf0Kh0Sq1ar9hslXI4aEwHFUVLLicpjUBrBACMFKTG2Ewne1Khtl4fSnnqgFYUFSJ7hgAiFXOBjE8mDIeHIyaNlUweGZGRGX+WnkYTL5qHIhOfp0MubKN7Iy6oUhQwDSYmDTBPHiyshyydsEwUJgslCiIFCgkPcpcJvIYJv8BJBy4okW8r0kceIM97LIvTRw0Cq5ojBNtGqt9uC08qGisnBA9g4loHAt8jESpKJhT6VqqJMALn3AiYsE7QAneIFCVRkelbiYZFKDhooanAinxWHFyDKABXEhMJ0VFiAkMBqwITQE6hEAGinhRKBg3UlEim/pENzwQcyAKDn00AJ3wKucMxUogKGIsc2DlqhIMsGjgcBRBC6dI0Cla9IaHBKxEHKTWRyGKCqjsUZpeqOFArTFwiK9JGIsDW7TcOd7FU0HuIL5asWwVELfPo2wOiELYuCHzFQ4FnIzRkoYCBsCYGVz3lZZVuMRQNLiGyGOrpQORRClZuHv2tgAPKWNBA0KvgdhkPJzzrYfDBNB0uKwowYDCCQYETMHA78RDB7x6P42J4MFFhhQPWgA4YKJGWAQgHxrObkdXhhAAOHDK4wKd+GgUKHu5Lr8+/v///AAYo4IAEAgODBhNoYFKBdVCgAQkKMDdCcwq40EB6DDoBAwbW/rUhwgMLZlhFA7vxMkICmolIxQEhCLeHUCpK4YEzNvkiIhomOGACDKYNdhQDFWR4wAMCiMKAAA+AZ8QBFR2VgZIBwsACJHswwEKIRAi0FSKmDEjBLtiEYwQFJGzZBgb7eWICabIN4QEBZiKFISxAsRLBkmBumQCU/pXASwZL0rjlagMaNQqgRbwZpzoDnsDLnRmVaSYJaVoygGeTHKHlVgV5mWcvMjG5JQR8/icllcOBgCURKaDqDgM4MXgAAgJAciQCpbopqDs2ZugBDDnaYhwMF7jYxggwxihFAxm4OAIEKSq77AMdIoJBA9JW4UEDLkQ4IYUWzpmtEgcmuOq4/uimq+66/qHhwAQfVDABGOxGodECFyjnBgMoZBAAM/UuAcMJl6HDAQniZiuMVt9AAHDAQ1AwAcPuCIAtxENo0JRNECTs664QjUApxg7EycHFp/x64XpNbjVCAJVS4cAGJQhggR9kaFCtRecCsqmHk2mxgqtbFdAmIw5Y94EWNcUJAKyWeFDnISF4fIQFTrcRZCUw+BmJCNFagXXWWzdSFE9HUzG1mQwYYIkKYx+iQK5RPGAsKyKEVkkK1r2SRdJOh4ByIx48ZEgJdEfhwcYuJ/UJBSu0UIAIEriQuBQVxFnAALBsR68ZBzBuEwExC0hBBzt31LMRKqRAAAEpAESgYgfU2sSB3kscsOueBXqQnDshxOTECocsXeDpokeCImWv7QFBhlxUEIIIEx7LgAgQoBeF13sgeqMJD7gAAgEurPAwFHYb8hjGT4iqB6nsPyELkSWAWHr8+Oev//789+8/u0EAACH5BAkJADEALAAAAABkAGQAAAb+wJhwSCwaj8ikcslsOp/QqHRKrVqv2Kx2y+0uPY1JJ+XQeLxob2OhYAAAjNaika5fKYPL6M0HjC4DFHaDUSYofYgAKCaEjUweAomJAmeOlkYOe5J9Iw6Xn0MEm4kEoJ8UCqOICoKmUB4aJiYNrU4UHKp9HLWuSwcBAhwoBQolFZVMFC25fC28vUceFQWSIyEOz0gWzG8W0EoeLm6jIilNmdyeUBQNsg3IXhXjqhyMX5G5lK8uF8IKJ3S8HKDGjQU8JA5wjeKgzkmDEprejECBrYsLbm/KJXOgJ9Gfik5g4EtUwJ4WSBjfLDiIpEGENm8YKIgQ0NaKiKRYVtGgEGP+Ahi2NExIkWKChmy+QKgKUROLA4IYBTQddCCEqpJbBhxKKQCoowMXVC3aokFCSgAsDljycELVhalWUKZ0gTQNBQPzEI2IUJdKBZxiB3xSsQHwm65dPFhlNmKDzkEwXIjowwAC3CxPmbXwCspDCgICLrBYoRYNhRRQPba4bImChwMHPPTVYoLFZEQcInD+tjbFAgglSrAgYeIxb0KvYcA4MPu48+fQo0ufTr269evYs1t3DaOBdxiytXOB8VnBixEiJJwwsFt8lQEl8vJhUEKweyoUKvTcxMFA8/tG5HdbLiJU8B+AQzSwXy4csDYdBTBoAMOBF521gHYutcBBCBv+OCgEDANiVEB70lHgQAs4tRBIEvKcBUcF1x1QgiQllHbEAi6+EcF16HjUkBHb5OiNdRiMgkESSgl5HQmjkJAEji7uxaNhfvxYRItnMQCjdQeM1IcANhoBoosjXodHKn2oOBuUKV2YXQMnhCBBCAAxoWBKDYoHoYQHCshNgQciKER+CybCgYGCRuFAfJLQZ2WiIVVAgAQijPCCBARUQCKktnjQ3XfhcSrqqKSWauqpqBbhqSwTppqMCScoUIAIBRTQAgm0uGqEBw5AQCUcAAWaKAUPpLaJAiClSsEKL2AkwaOknmZsLkyl2oCXGFkgrHb5/aoKAx7aQcG2T3gwY47+ALgAigoYXCBHuFIc4G0urDThGmyhTqHCYm+gYJ8WDqD7RgHhHjABBhFYAEIEGEwQ5hMBJFICuUoYIDAAIpi06wolTFtACSsYF80yej1sRQUXZ3wEOyHIhwgDTAXqAZqImFzFBBcTvOsEhW6CwgSBioIbxUnAcLEEB5loFp7JKqHBVhkhelLP3IAgJrbcXGDzEb3uEUIKIktBAQnzbjLCv0NEIPCOnXqQ7xYN0JwSBM+Mia4Im4JCrMtXPfpA2aOM8IBzB5wAeEYrPENBAhcDkADRaHhAAN+IFBCymCQLvNlzKjygwK8jCJACUnderAC8l7CDweecQKBpXWU1zoFdBiWCYUIFKZgQ22xxN346qR6EdbEAKpQqtMCllDrB4dVMYCoF/LoYAuTVpUD5t+acKnmOJ4QtKAwgMD8CC3mPWvj180WwdakeIICi2S0g4P2o7KwgAE6hr5ArKEEAACH5BAkJADAALAAAAABkAGQAhfyOFPzKjPyuVPzmxPyeNPzarPy+dPz27PzSnPymRPy2ZPzGhPyWJPzu3PzixPzOnPyiRPzevPzChPz+/PzWrPyqVPy6dPzOlPyyXPzq1PyiPPzetPzCfPz69PzWpPyqTPy6bPyaLPySHPzKlPyuXPzmzPyePPzatPy+fPz29PzSpPymTPy2bPzGjPyWLPzy5P///wAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAb+QJhwSCwaj8ikcslsOp/QqHRKrVqv2Kx2y+16v+CweAydRCyVjyUyIbujkwYGQK9jGu23Xtkg1f8AJA17hEYdLSKAdSItHYWPMA0Jin8Jg5CEA4mUdCIlmIQRnH8OoGUvJSUHeVAlm5yepkwTLyMaIrgMCQWrT5KjAJaySh0OK5QiGBmsS4evgCIBjsNHZhrAApdNfZyCVRPTYS/HwAAszEq0JM8iguhNcQYrGiwO71oj5XQMEWURIAIqrLk36wSDPyIWhNsy4Zo+ACgIisngEGG/Lg0OPqxwoFCAZ3a8OAA5StieDhY4aViYxdXDYNreTDDACQJLLC806hPQkdD+A5IAQHiZ8OGhCAkSxZFDmOELBaCAQjR91KCCRhEJ2Hw5oKAcI1AHEKBA8QAPmAkZKowSAaInqAlJtcRhobNOiBYvqOkxY0FAghUCUMTUK/NAhgYp4hJezLix48eQI0ueTLmy5cuYM397kaFEhheKNS+Z4ICDAA0mNAjgYE/0lA4oQigSEQLFTdd8BJTLhrvJCxZQF7HI2zvJBA/B/zBQEVov3OYHILwM5jZyBw8QQkDwcLuIg+l0SklOseBVwhRL8oEfMdmB7D8ELiahCd6A5AkXKD1IigI8APuRTfCAfkkF4B97kkXwnl3yIfEdeOJFdoAE5klQ3REHTPJSAhf+PnZddtt1R8QEKtQ1ynLNUQNOir8lB4AIwxW3RAO6YTOYjEd0YMCCf9QmIo5EFCOBABBoAIEAEjjwI5BF0JJKCaAxKeWUVFZp5ZVYPgHOCy8kluURL5yAAgYkCICBAWWN8VwHHcAFSgoPJGDiiyZIEGUXHTSgAgYmMMCABiBEcKceHZSgITAhULBkFAdcIN1sHyi61wmP6sPAA4s68ducPbaQ4hUlVPRQCB58ikQHfujDSKZXZOgfAARESEUHC0yXqKlwGPgqABiwikQJJoAnAHFgvFCpf7HMKgGyJ4hBAacvcVBFA0X5ZwGuTsy0ax0QYAtDCTy+tBIYB8yxLaz+Nzox0qsMZFqMCi20oIKSS7yg1rkhfDLFusj+SIstDOCSiwYjDFoEjecCkC8VA7jwKgESdUCBqIpowB2GqW4bQrrbHDqdAgR18AC0yu1nSErnjjvFASC8ylw1Jb7kQqlGjOAiMBhYcUK45ZjUpAPBTmdCa0RkQMC5DUrRQcsvMXDBPSnQVx9L2u66gq9INHAsMCx0KEQGPOvjwo0NhF0OAxR4S4ShXmFArBEIbIuAESTejBAKXk/RAAhhi0CABOglwcK2LOT4gNmzWZA3FSkUYEECIYjAQAgfJLlkta9WcKoKR59t4Rd5luCAAyWYxcRS/q1g3AAKBFfBCVi7kbFpfyQ0U0ILkIcQAgH0OODlYhxsK20THXAGZeyhbJt0cS9Q/JAGb8sooN2LmCzlC+a+pED0QJaw9SgQTEVlHB8kJ8IKplv5ggS3zKaBnV/CUOgICiRAAAEJKDBCCcj3NsEBDThMA3qBiSAAACH5BAkJAC8ALAAAAABkAGQAhfyOFPzKjPyuVPzmxPyeNPy+dPzarPz27PzSnPymRPy2ZPzGhPyWJPzu3PzOnPyiRPzChPzixPz+/PzWrPyqVPy6dPzOlPyyXPzq1PyiPPzCfPzevPz69PzWpPyqTPy6bPyaLPySHPzKlPyuXPzmzPyePPy+fPzatPz29PzSpPymTPy2bPzGjPyWLPzy5P///wAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAb+wJdwSCwaj8ikcslsOp/QqHRKrVqv2Kx2y+16v+CweEwum4sS1yYg2rgk53gzIgDYQ5SIfI9sJOyAAAkNfIVCEgWBgSZwhnsNKoqAKoSOchh/koIYlnKQmoKVnU4SHByNUoghmoyjTRwRDiwBKSSoUA0PkoOuTC4VBKsAIRkWKFN0gHh6vUouI5ohEAepaiIBbreppdpeHB+gww7dcQ0LCSUFtmERBOEAKtSFB3WADwNgEg7vw5yFKZJWkMPCYQE/ABsMXZAEYuAVDiwOJiwETlEJh1YkpBAGKoSoPScktfpCIsM7AfL4cFgRiMLHLhJEMAAFYgNGMhIiFKgwISX+GBQaOAICkYJDszIHHCQQFmLEBqNHy0g4QGJDhAYHbkbdyrWr169gw4odS7as2bNow3BwgcEF1LRVOJwoQCHBgwQUCpx4C7fJ1BPBopXoqRWuBAwrhEZbgaEw1QEkfH5t4EFxRw8v0TQokAGE5wcFGhR2hKLeQUAjJA9BkcKdJAIpVPfiUMAyvxAF+AopaPvOAt29NoA4zXDiEAkTZr5r0WF0HBQmeh80wZfyacxRG5gkLimDKAknpAcKccK5mQjcoxmXYJD4AvNlEKTXlGLISu4rgFuKOF9RAPsVnfaBfo6I0J8iLBwHAXcQEGgIQAcCUt8h4Z1GHnxkoBfhMMz+CGHdQS5lt92B3hGBXAv8MIchGSgkEqEJkvEWTgi/cSXcgQQYRwRrrikC2zFc0dZfCBUQKMFmnXmWQWgrxnEABfN5IFsRLpAQAQkujPXhQSF44E9fSByW2G2MNSmWBChMUIJtIQyWFZhOyEVXAhngpZeDcCpxAFsuTJnnn4AGKuigUJRyAgsfrLDABG+MUYoLDTTgliMSkGCCcoooEAGQXhyQQgEjJKDCBRA8pVIKI2oCwjQwRTACpoAQ8EFmY3AgAoq3KYBnFBykMFw4GXSIkwOwvhMCdVqcUKwmJdBKUgnpMdAcFgek+s6AZHBgQn8jZHmFBdzVRMYBy3Kp4xT+B0TCHbJiTPCimS+Q0ONp3Y6x4IEe7LrEjdzxIkaA82WgrxIn/Eqcv0uU0kAEKaRw1SlMsHRgCQMn0U56FHjrzAkCCBWCACf4KcS2+FaMhAuZEFeByC808EG5ADAwqxIQ9odtFYhwx0AKGLmggnjwaGxEAxFOAG/LBvOTmp6m8YNSmAvNl8CXVlgANAAgCGuErVffIcJA/BIXgggmKwGdeAwggNGW1zl7NncXCH3FASIkrUwGey1RIXfkJeGCAl2X2EUDJqhQAggElOCBBXIfAVF/LDhIG8x2MHCBs1hMNcAGG5DA6RLf9FekEr2+KkkICYjQeCcoSJzeCiynsYFdBgJkUIIABUzQQNlnCDkfu0yUYoopR4uhT3/jDBqB3fxkTegBUROnAMtwXXxajoQe4sDVISSf/QsQUR5z5N/bd4IKyzKgQt7lE+GpAnXhpUBs7YcJKQYH8F6/IUEAACH5BAkJADAALAAAAABkAGQAhfyOFPzKjPyuVPzmxPy+dPyeNPzarPz27Py2ZPymRPzSnPzGhPyWJPzu3PzixPzOnPyyZPzChPyiRPzevPz+/Py6dPyqVPzOlPyyXPzq1PzCfPyiPPzetPz69Py6bPyqTPzWrPyaLPySHPzKlPyuXPzmzPy+fPyePPzatPz29Py2bPymTPzSpPzGjPyWLPzy5P///wAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAb+QJhwSCwaj8ikcslsOp/QqHRKrVqv2Kx2y+16v+CweEwum5EUynkd7Uwuo0mHTVemTCEAIGRK1f9FFyJ6eiIjUhQdBygBJgQLIA0daoBPFAWEhCeUTm4qDJmFJCAHnJVKBy6hAAwHTwcLeauEDCoNp0yXq5tOLxWDs6EfGbhLI8CFh00HHsHBw6bFRAd4enyuuQHOzirYXB0ZICgN0VEHb3FzTS+y26sMIOVWvgUMLgUt8lBpUC3uzgLUZWmAKRQGb2QObPjn7FaWDghmGdLnxUE7hqFYaMlwMROJF2ZAgMK4SoMWFKpmJSBW5gEykoRUaOEwctVKMw9qwtTjQQv+wWAQEIoRuTPTAi0UTMxiwIJilxIdYYLY0gGCThcBnHbp8KGoHgYgtxx4IGBDAggG6LDwCkCFQKQvSmQoRUdh0RATtErbR5SkiAhv92LpkBOjiApCBWMZqzPY4bCKvxk4sS1EgMSRs1AYKyCECwagQyRoQS6zGAoZULB4AKKEH9OwY8ueTbu27duyOzRAYQJDAgwmxgXGHYVCgxYFQ+ErTbz4BAHuBOS1xM82BQ7JtxWYroTCCwcXTDxw8EJvsRIpGYYo0X0CBmQMMHCH3YHETgzDh6DITqgAB9koNPYPAyggwY4zIUAWGUReITAcBRq4o4F5dWQggVc3FXHACu7+rIBZMRNEpd4ERmSw0DYbsBSZAenB5EJaRZjozgkqKhagVwzAOE0C7iTwIS4heoWXERC6YwKFdGTAY1EZFnFgMAnSB0GD+cGw3ywFFBjbjTDBkwQF7tUU33ymHWAfTCRUKYR3DoygwQjkIVlJCQIiyF4TaciJC5j8BbOdnriBacFLoYhgAZnN4dnAAn0CsBygicKgGwe9/RbcC2pGqummnHbq6aeghlpcnqJa8p0CLWjwwASSkKFbBhmUd8oLCghA6AYBZAApniAgkIAEG6ygwp11NGCVYxY4sOuXDRBA6B6XLUtFA0tWxoG0RVDgQLWzfLTGC2f+E4JDWbxgwT/+BGBrSWEYEZApFC7944IDZrwAHUknDPBQo7OooG4TEzzrTj5YZCCwSgqCQcEDRXnwmhUoHLzKBsSGQUEERXl7RcQYUYyInEllnPAUJUgcSgLkMnFACRMowAIHJfxIBAUjFNXNYiLOAsG7QnTggAonIHOCB3IwEfBOC/DcRAUMiaAREx2MwO8JF7wrI0khaInFT9Hp1UEEJgMAWHcthJ3JzkiBwK8eTSrBsTsi/KdEBueO+A0HXa0iggoD6HVA3v98IDOYOWcyURfe4SHC4gwUwAJdTIDQ4jYvLsFnZSMoTYXPE0xQApJFkjSh5RlU0GcIGCibWQcqwORWEz4HUAFdBhioAMnDkaUQEUkOWpLCCy8coDkgFDBNUgX/mnaMYQGUOgRUGK3n/JqtM+TB8IkesDYhG4wsKpjc2oSo8xSUAMGzIkBQAvabJsIB0CGEcIIKciTf3AHeT69/qUEAACH5BAkJADAALAAAAABkAGQAhfyOFPzKjPyuVPzmxPy+dPzarPyeNPz27PzSnPy2ZPymRPzGhPyWJPzu3PzixPzOnPyyZPzChPzevPyiRPz+/PzWrPy6dPzOlPyyXPzq1PzCfPzetPyiPPz69PzWpPy6bPyqTPyaLPySHPzKlPyuXPzmzPy+fPzatPyePPz29PzSpPy2bPymTPzGjPyWLPzy5P///wAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAb+QJhwSCwaj0gk5dDYPBaRx6ZxoCSv2Kx2yx2mThYDYExGfU6prnrN5r5WIbKcHFq92vg8m1ICzf9kLCVWeoWGRnwTgIsACoOHkIYHAoyMAgeRmXgPlZUPmqBdL3GdiyF3oalXDyKliyKfqrJFFBiujBiEs7MvLLeLLKhYFMS6u2olHL+AHCVXFC8lJw8PFQ4NxsdZJSjLfyjOSC8qGKRjDCAB2Npayd5zzUgZAgyvCifZ7EYvCu9yCsKGUHAgphODB/n0CbTlbwyEbIluicCnEAmnhrCMHFjR6haLBqAodMjQoEPCfea8nTIiod4vEQE6ZDrQwqUBFSeLXPSWkVb+gncfI1Fo0fGcBC0HSLy7ZKSDi3cMHERK4VIOiZwCSyj6pcBBvgYNcUIqwQxkFj5+SolwlJCsvxFY1WRgFhDLm5R/6tQl4vbdhbhdOhSUswIwkQMbLCiDZ+EEpiQvGlYwvIWCh6IAGJjtsiSDhCcLpGSogkXwuxBShUrAwGHChwwKKUR4h2HvoRePKw7AaxBhxVkdZv8SYPu3phckMDMyANv4rgYClP/hcNT5sQYmeJ9b8cj6sQ4lIgwGECKBBNLe2RE7kCHDC5Pp48ufT7++/fv48+vfn17kAfj8aQKNBAGY8IEJI2zwAmUBnlWBAE/J4QIJHsjUYB4paFDVHwz+RJDbhWq88FMpdmxxgAMbOFCcfR0Q5YoILViYBAUFgGBACAYIQNF+DWhnymZHdPBAhGQcJCN+wv2iwRUlaBdCOPh10M0yKBxZRAuMtKBfBj4yEkJzRyi1CAn6ObChK1ElwRAgGJR5ZilpIoHlIlrmx6VKYBrRJCBP6ielN1UmISSRY7jwgJX2aeDNks8UIMCNKAhQAIPO9fhLCEBC5oAEKjbYonSAwIgoiFgckACocohQIqlqZPhmkRp8yCoXFKgA4RwuCCDWrHu8sMEIBByY4IK86uEfgMUmq+yyzDbr7LPQRqveqNIicYAEF0SgwQgnZFotER2sFkJRISiAQBr+qXQQzQMqjEZpJiks8CoAqq6jyQEBTDnGPejq08ECpdR2nAWAMDCCrLtsMO8cdULy6SIM7HjMAWt2shIkBFWiAMKqnNDlHw0XQsEIpUA5y8ioAvLQIR0QUEoF2gS3DAj96tEBwZ2oELOiv4DAMRsdBFBKaruMvMxVkLRUiQErItGBA9kucIEE1B5RwcJ/RBDJARBUMkLVR5RQTkciGICByVc00M+LaBfSQFpziGBB00V04IGPIagA9hCsuFKYJhlAkJIBC9BNBAUeLy2xoCuUokCeW//6gQUPOLB33WtrfDkMDVT8R1fvqtFBCshyccItJ2gBTQvjxv1a6No07ndgFw2MgAEIIJCwQHf3UZB5JwqEnsLP9VGwWCkcwH4hJa6Q+S0Mc5YSsrQZpEyGCJBHS8EHpVigPIgvQICqCBAY3mwDFrzJgAXZP39ABQmQUkcFxH/r3wH4l/78/vz3T0QQACH5BAkJADAALAAAAABkAGQAhfyOFPzKjPyuVPzmxPy+dPzarPyeNPz27PzSnPy2ZPymRPzGhPyWJPzu3PzixPzOnPyyZPzChPzevPz+/PzWrPy6dPyqVPzOlPyyXPzq1PzCfPzetPyiPPz69PzWpPy6bPyqTPyaLPySHPzKlPyuXPzmzPy+fPzatPyePPz29PzSpPy2bPymTPzGjPyWLPzy5P///wAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAb+QJhwSCwaj8ikcslsOp9QZad08lBOpUN0y+1CDyoMx8UQhVAYldbLbnMnDpAIQK/TRSDJxM3vIzsUDHaDdQwUHX6JfRMUIYSPACEUe4qVXSUKkJAKJZaeUB0EmpoEiJ+nShkuo5AMGahsGRQBEREXFGtLCKyaKrBREx0nJCFlcyIMKCslpkgQvJAQv09wAnOaIgQNlEYc0I8c003CBt8CA9xEjt+DBuMlFA8PHg4pihMn5ewsr0Yo7IPCKZlQYgUHYwwMWDiRjg0cfQBZ5BqCAaAdDEoORBD0SESCbW5SWLBYR0NDFSTp+EJyQBQrCw3cFEhJx0AnIhk4AnSFZML+iGusEjR7I4AmABER0nWoQJKAvSMlvEETcYJNiXU0BcTEKfUbpz8RAIKYGEWFzpQoBhRhhJWVpIZDGoAAaMCBlwVAUzLYYATQ2VaHkmRoy4vBSi4mjN6hcGSCBBZ57YhgoUdJicisRIzwklixiAJJwGBAYcwFBxJqmJT4m3lzlwCYAbqQsOQAFQoeTgx4yiQDRGiGvARSzOGmpRdF2RX30uA3SQxkE/mMDWnFUGAJjIp4ADdRAxbfGKhl44A6Lw5bP00owPpR0jYdVqTc3l1Rhwft62SLzqVBcnYirFBfJcIoEBsHI/DWBhzgfSMCBun9MkEDD5BgAAMJWRBBCQP+vpFBJrwECJI4QkzwQgYllJDBiJUcsAAK1DHAgQodkojKBBksIMAYyITAQQIPsGjjkEO8UIIEJ5wgQQkKEunkk1BGKeWUVFZp5ZVYZvlGCjVq6UcHDrTwAQQftODAdV76QRAGIQBlBgYcpplIBwWYZwiacr5xAmGEhFBAlyUaKWSe30HDQoQ9NbAChgysMKiWEwTAzgg1vlDRRS/kCcMBXZ3X5FoqRCYCjXm+YB4hImSaRAedDWICnleWYJFxR4TySCl5ZmBRPz2ZNYhhgEZpKoCqJvECCYOQUGyaKYAIjQL8EWFiBYxW8EKwUU7QwqSATujAtZrG1SArh4brxXr+fA7iJ6zmjjMcYOy228SabZkBQZzytpFCmBWQ2YIEn+br0AHxCmzwwQgnrPDCDDfs8MMQRywxlPhoAAEGBKQ28R8SyCGZASoU7EYHDaQI7pMdqJDuURFEy0cDC4DAAQcCjCDyJxKsTAcDNltygMf6vUrkBHOxYgCifMTXEaVDnnBqHRFUchUkAiw7jQlP06FAJe8SshyJE1xaGLZO+PqITTaGHR7ZTTiwMghIw8IUNAIlcsB/kkVwsyIUZA0AAZasRgjcRB7gXEd2VUKQAMUwEEICLg/UwAgGiqDACI8qEeooIgjtyb5WMPOGA+PWwYID2HawESQiQBC3lRkUTQhgP1+MwGfnr1fJ6iieO0FyBCxgyIEJZ+b6jyYo8LoxDOVxnvjyzPPy/PKCa8IArRsjN0rV0AtxX34McNe9EAd8gJkIH0QesbYw3oFCC2wzjOMDC0TwQAbxj6///vz3v38QACH5BAkJADAALAAAAABkAGQAhfyOFPzKjPyuVPzmxPy+dPyeNPzarPz27Py2ZPymRPzSpPzGhPyWJPzu3PzixPzOnPyyZPzChPyiRPzevPz+/Py6dPyqVPzOlPyyXPzq1PzCfPyiPPzetPz69Py6bPyqTPzWpPyaLPySHPzKlPyuXPzmzPy+fPyePPzatPz29Py2bPymTPzGjPyWLPzy5PzWrP///wAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAb+QJhwSCwaj8ikcslsOp/QqHRKrUI7pcmk1LF6v9ZOxlNgmBmFSqYLbruRjQgDQK/TGZrGe/92YeyAdCIkLnyGYRWBigAVbIePThQXc4uADBcUkJpLDR+Vih96m6NGKJSfdgwopFMUHQcZEw4NBx2ZSx0LqIoLjqxMFA0KAiKpHigut0gHCLuBCAe/TR0vFsWKDBgOSgckzoAk0dJKFAstuxsoykXM33bQTi4vASwKa3wdLNe7IS/rQx0iuKvTawmFEipEFFMoIsEEX14ogDjnbkMJJKYGqsKloMAiBgsKgWmwYiAdBP+EdBoYasmLEJ9EsIDY6sE+dyIyHKEw4ub+JwYjUhJx4REVgwlfOpQ0SccEkg4evnmgSYSCiW8JhEI54NPdCqowXJDoameQyCQulu4ScdFKCaZ1Cpw10kDDKUsmRClxUHTtAy8c4NIpoDOJGBVlzhTwUEJrkZfuFniZIBgA4SYHsmwR5wQFTGcyvWSofGKuoRInvolQ4OXAXZaO2xzwBFovlQ7N4F4YZdOZii8UXrx2xsD2oxS0PxVo60UsUw2x3zhIXamFArBRKPAdKMA4JAoZMAwHcOIF9ikGPu/6wJxVBwUWToQIUWCFBtNggm/YJaDxOCEHDIACCrNEV8VBHpAFQAgRePcfKeAtsMIJBRRwwgcKNGDgg5r+UOBCA7RsyOGIJJZoIoQUiHjiHh5OcMECESwwwgTJrDiKCyYkEMI+IoSQgAn42ejGARf0pUiPF3AmZBsuRAVaBUEuOcUBEJgEj5RhaKBgJSJocJ6JWJiwwgYrmOAAWMGpN1AL/mB5kDeAiNBfSgf8IRgGStpYwn6LWGTEBFuuhdSSDViASndFEFAZHQQsmU+gAIiwwDrUVbYBoQk4s4JtkK6lIikTUGTUNkMsWkeeJaLgziqlmgoAqiSq+g2rQnSKighfjuPAeIGEQKoQfJJGqFqfJGBbIos2KuSjt7KwDqCViTCokA0IcKhxdVaGJ5YDBBvIBgMYkSZc/Xz6y0H+xMQ55xEB2VpWBLmS2IEDJnywwQdmntfOQCrAimUUDSQImgcO/ivFASMYGUiPI/hr8BQuaLBCCKcwEEKZDj9MhYccPMDCAiw8gIy5GkORIsklp6zyyiy37PLLMMcs88wcvvKhC7bQLAV4ERQVQgUToCyFGA3E26EDxNIRggJCR4KCAAVsgEFhHGaQHCAFcPAIBQrcxADV43SgwScCRPlFCgoDgIDRfBxQqSIhTLvHW98WvEkDkL5wCGWBXPZfA7uwZohrgQjA9h4uqBkIA1obUk6cckvTAbKLtHTIASxQUgDTHFIwgeJ1iBDUdwfIckDTQlBwwOkbd7S4CaifW0JlACp4EIB/Oz/9GQMfjJ7yC2+XV4ULE7wAAgpFq7wdICG0pzMuuT1z+MwNZKqIsc83kYEEi0gAdvbLXG2HBRmDL4Q+C7NgPhPOAVL2+kwEzEAxDBAMfzxamH3//vz37///AFxREAAAO2l6MlNnMjJPaEJTY1lvVkpORFI0dmF6ek1tK1ZrditmL1VXWmxseUxSc0NPYk4vVU5kVVRWeThHRmlpUWNqNWQ=",$G={loaderBarClassName:"ds-dwt-loaderBar",loaderBarBackgroundColor:"",loaderBarSource:de.bIE?ZG:Qt.loaderBarSource,loaderBarSourceIE:ZG,loaderBarWidth:120,loaderBarHeight:120,errorMessages:{limitReachedForZoomIn:"Error: You have reached the limit for zooming in",limitReachedForZoomOut:"Error: You have reached the limit for zooming out",insufficientParas:"Error: Not enough parameters.",invalidAngle:"Error: The angle you entered is invalid.",invalidIndex:"Error: The index you entered is invalid.",invalidHeightOrWidth:"Error: The height or width you entered is invalid.",imageNotChanged:"Error: You have not changed the current image."},generalMessages:{checkingDWTVersion:"Checking WebTwain version ...",updatingDService:"Dynamsoft Service is updating ...",downloadingDWTModule:"Downloading the Dynamic Web TWAIN module.",refreshNeeded:"Please REFRESH your browser.",downloadNeeded:"Please download and install the Dynamic Web TWAIN.",DWTmoduleLoaded:"The Dynamic Web TWAIN module is loaded."},customProgressText:{upload:"Uploading...",download:"Downloading...",load:"Loading...",decode:"Processing...",decodeTIFF:"Processing tiff...",decodePDF:"Processing pdf...",encode:"Processing...",encodeTIFF:"Processing tiff...",encodePDF:"Processing pdf...",transfer:"Transferring...",canvasLoading:"Loading ..."},buttons:{titles:{previous:"Previous Image",next:"Next Image",print:"Print Image",scan:"Acquire new Image(s)",load:"Load local Image(s)",rotateleft:"Rotate Left",rotate:"Rotate",rotateright:"Rotate Right",deskew:"Deskew",crop:"Crop Selected Area",cut:"Cut Selected Area",changeimagesize:"Change Image Size",flip:"Flip Image",mirror:"Mirror Image",zoomin:"Zoom In",originalsize:"Show Original Size",zoomout:"Zoom Out",stretch:"Stretch Mode",fit:"Fit Window",fitw:"Fit Horizontally",fith:"Fit Vertically",hand:"Hand Mode",rectselect:"Select Mode",zoom:"Click to Zoom In",restore:"Restore Original Image",save:"Save Changes",close:"Close the Editor",removeall:"Remove All Images",removeselected:"Remove All Selected Images"},bShowAllButtons:!0,visibility:{scan:!0,load:!0,print:!0,removeall:!0,removeselected:!0,rotateleft:!0,rotate:!0,rotateright:!0,deskew:!0,crop:!0,cut:!0,changeimagesize:!0,flip:!0,mirror:!0,zoomin:!0,originalsize:!0,zoomout:!0,stretch:!0,fit:!0,fitw:!0,fith:!0,hand:!0,rectselect:!0,zoom:!0,restore:!0,save:!0,close:!0}},dialogText:{dlgRotateAnyAngle:["Angle :","Interpolation:","Keep size"," OK ","Cancel"],dlgChangeImageSize:["New Height :","New Width :","Interpolation:"," OK ","Cancel"],saveChangedImage:["You have changed the image, do you want to keep the change(s)?"," Yes "," No "],selectSource:["Select Source:","Select","Cancel","There is no source available!"]}},eH=Zt.mix({},$G);function tH(){var e;rr.DWT&&(e=rr.DWT.CustomizableDisplayInfo),e&&(Zt.isString(e.loaderBarSource)&&""!=e.loaderBarSource?Qt.loaderBarSource=e.loaderBarSource:de.bIE?(Qt.loaderBarSource=$G.loaderBarSourceIE,Qt.loaderBarSourceIE=$G.loaderBarSourceIE):Qt.loaderBarSource=$G.loaderBarSource,Zt.isString(e.loaderBarClassName)&&""!=e.loaderBarClassName?Qt.loaderBarClassName=e.loaderBarClassName:Qt.loaderBarClassName=$G.loaderBarClassName,Zt.isString(e.loaderBarBackgroundColor)?Qt.loaderBarBackgroundColor=e.loaderBarBackgroundColor:Qt.loaderBarBackgroundColor=$G.loaderBarBackgroundColor,e.loaderBarWidth?Qt.loaderBarWidth=e.loaderBarWidth:Qt.loaderBarWidth=$G.loaderBarWidth,e.loaderBarHeight?Qt.loaderBarHeight=e.loaderBarHeight:Qt.loaderBarHeight=$G.loaderBarHeight)}var rH=!0;function nH(){var e;rH&&(eH=Zt.mix({},$G),rr.DWT&&(e=rr.DWT.CustomizableDisplayInfo),e&&(e.errorMessages&&Zt.mix(eH.errorMessages,e.errorMessages),e.generalMessages&&Zt.mix(eH.generalMessages,e.generalMessages),e.customProgressText&&Zt.mix(eH.customProgressText,e.customProgressText),e.buttons&&(e.buttons.titles&&Zt.mix(eH.buttons.titles,e.buttons.titles),e.buttons.bShowAllButtons&&Zt.mix(eH.buttons.bShowAllButtons,e.buttons.bShowAllButtons),e.buttons.visibility&&Zt.mix(eH.buttons.visibility,e.buttons.visibility)),e.dialogText&&Zt.mix(eH.dialogText,e.dialogText)),tH(),rH=!1)}function iH(e){var t=e,r=window;if(r.ShadowRoot)for(;t;){if(t instanceof r.ShadowRoot)return t;t=t.parentNode}return null}function oH(e){var t=window;return!!(t.ShadowRoot&&e instanceof t.ShadowRoot)}Qt._funsAfterConfigLoaded=[],Qt._safePromptCustomMsg=function(e){e&&e()};var aH=pl;rr.DWT;var sH,uH={background:"#434246",topMenuBorder:"",innerBorder:"",promptToSaveChange:!0,buttons:eH.buttons,dialogText:eH.dialogText},cH=function(){return s((function t(e,r){o(this,t);var n=this;n._stwain=e,n._ImgManager=e._ImgManager,n.zoomInStep=1.2,n.zoomOutStep=.8,n.MIN_ZOOM=.02,n.MAX_ZOOM=65,n.MAX_ROWS=128,n.MAX_COLUMNS=128,n.__MousewheelValue=0,this._Init(r)}),[{key:"_Init",value:function(e){var t=this;if(t.borderWidth=Zt.isUndefined(e.borderWidth)?1:e.borderWidth,e.BackgroundColor?t.BackgroundColorByDefault=e.BackgroundColor:t.BackgroundColorByDefault="#FFFFFF",e.BackgroundColor=t.BackgroundColorByDefault,t.BackgroundFillColor=t.BackgroundColorByDefault,e.onTopImageInTheViewChanged=function(e){Zt.isFunction(t._stwain.__OnTopImageInTheViewChanged)&&t._stwain.__OnTopImageInTheViewChanged(e.index,e.bByScrollBar)},e.onGetImageInfo=function(e){return{width:t._stwain.GetImageWidth(e),height:-1}},!t._stwain._viewer&&rr.DWT.UseDefaultViewer){var r={viewerContainer:{},viewerEvents:{topPageChanged:function(e,r){t.__topPageChanged(e,r,t)},click:function(e){t.__click(e,t)},rightclick:function(e){t.__rightclick(e,t)},dblclick:function(e){t.__dblclick(e,t)},mousemove:function(e){t.__mousemove(e,t)},pageAreaSelected:function(e,r){t.__pageAreaSelected(e,r,t)},pageAreaUnselected:function(e){t.__pageAreaUnselected(e,t)},dragdone:function(e){t.__dragdone(e,t)},onDrop:function(e){t.__onDrop(e,t)},pageChange:function(e){t.__pageChange(e,t)},bufferChanged:function(e,r){t.__bufferChanged(t,e,r)},onBind:function(e){t.__onBindViewer(e)},onUnBind:function(e){t.__onUnBindViewer(e)},save:function(e,r,n,i){return t.__save(t,e,r,n,i)}},viewerError:{setError:function(e,r){t.__setError(e,r,t)}},imageEditorEvents:{acquire:function(e){t.__acquire(t,e)},loadImage:function(){t.__loadImage(t)},deskew:function(e,r){t.__deskew(t,e,r)},removeImage:function(){t.__remove(t)},removeAllImage:function(){t.__removeAll(t)},close:function(){t.__close(t)}},imageEditorServerCallback:{rotateRight:function(){t.__rotateRightForServer(t)},rotate:function(e,r,n){t.__rotateForServer(t,e,r,n)},rotateLeft:function(){t.__rotateLeftForServer(t)},deskew:function(e){t.__deskewForServer(t)},crop:function(e){t.__cropForServer(t,e)},erase:function(e){t.__eraseForServer(t,e)},changeImageSize:function(e,r,n){t.__changeImageSizeForServer(t,e,r,n)},flip:function(){t.__flipForServer(t)},mirror:function(){t.__mirrorForServer(t)},restore:function(e){t.__restoreForServer(t,e)},save:function(e){return t.__saveForServer(t,e)}},beforeImageEditorCreated:function(e){t.__beforeImageEditorCreated(e)}};e.Container&&(ci.isNodeList(e.Container)||Zt.isArray(e.Container)&&e.Container.length>0)&&(r.viewerContainer={container:e.Container[0],width:nr(e.Width),height:nr(e.Height)}),t._stwain._viewer=new rr.DWTViewer($j._getBuffer(t._ImgManager),r)}else e.Container&&(ci.isNodeList(e.Container)||Zt.isArray(e.Container)&&e.Container.length>0)&&t.__onBindViewer(e.Container[0]);t.__InitEvents(e)}},{key:"dispose",value:function(){this._stwain._viewer}},{key:"__InitEvents",value:function(e){var t=this;Zt.isFunction(e.onTopImageInTheViewChanged)&&(t.onTopImageInTheViewChanged=e.onTopImageInTheViewChanged),Zt.isFunction(e.onGetImageInfo)&&(t.onGetImageInfo=e.onGetImageInfo),Zt.isFunction(e.onZoomChanged)&&(t.onZoomChanged=e.onZoomChanged),Zt.isFunction(e.onMouseMove)&&(t.onMouseMove=e.onMouseMove),Zt.isFunction(e.onMouseClick)&&(t.onMouseClick=e.onMouseClick),Zt.isFunction(e.onMouseRightClick)&&(t.onMouseRightClick=e.onMouseRightClick),Zt.isFunction(e.onMouseDoubleClick)&&(t.onMouseDoubleClick=e.onMouseDoubleClick),Zt.isFunction(e.onImageAreaDeSelected)&&(t.onImageAreaDeSelected=e.onImageAreaDeSelected),Zt.isFunction(e.onImageAreaSelected)&&(t.onImageAreaSelected=e.onImageAreaSelected),Zt.isFunction(e.onBufferChanged)&&(t.onBufferChanged=e.onBufferChanged),Zt.isFunction(e.onSelected)&&(t.onSelected=e.onSelected),Zt.isFunction(e.onRefreshUI)&&(t.onRefreshUI=e.onRefreshUI),Zt.isFunction(e.onResetCurrentIndex)&&(t.onResetCurrentIndex=e.onResetCurrentIndex)}},{key:"GetWebViewer",value:function(){return this._stwain._viewer}},{key:"SetSelectedImageArea",value:function(e,t,r,n){if(null!=this.GetWebViewer()){var i=[],o={};return o.left=e,o.top=t,o.right=r,o.bottom=n,i.push(o),this.GetWebViewer().setSelectedAreas(i)}return!1}},{key:"OverlayRectangle",value:function(e,t,r,n,i,o,a){var s=this;return!!s._stwain._isNoViewer()||null!=s.GetWebViewer()&&s.GetWebViewer().webViewer.overlayRectangle(e,t,r,n,i,o,a)}},{key:"ChangeImageViewSize",value:function(e,t){var r=this;return e>=0&&(r.GetWebViewer().width,r.GetWebViewer().width=e),t>=0&&(r.GetWebViewer().height,r.GetWebViewer().height=t),!0}},{key:"ChangeSize",value:function(e,t){var r=this;return r.GetWidth()!=e&&r.SetWidth(e),r.GetHeight()!=t&&r.SetHeight(t),!0}},{key:"GetWidth",value:function(){return this.GetWebViewer().width}},{key:"SetWidth",value:function(e){var t=e;return this._stwain._isNoViewer()||(this.GetWebViewer().width=t),!0}},{key:"GetHeight",value:function(){return this.GetWebViewer().height}},{key:"SetHeight",value:function(e){var t=e;return this._stwain._isNoViewer()||(this.GetWebViewer().height=t),!0}},{key:"SetViewMode",value:function(e,t){var r=this;return r._stwain._isNoViewer()?r._stwain._nouiNotSupport("SetViewMode"):r.GetWebViewer().setViewMode(e,t)}},{key:"SetIfFitWindowAndType",value:function(e){var t;if(null!=this.GetWebViewer()){switch(e){case 1:t="height";break;case 2:t="width";break;default:t="window"}this.GetWebViewer().fitWindow(t)}return!0}},{key:"GetAllowMultiSelect",value:function(){return!this._stwain._isNoViewer()&&this.GetWebViewer().selectionMode}},{key:"SetAllowMultiSelect",value:function(e){var t=this;return t._stwain._isNoViewer()||(t.GetWebViewer().selectionMode=e?1:0),!0}},{key:"GetFitWindowType",value:function(){return this._stwain._isNoViewer(),0}},{key:"SetSelectionRectAspectRatio",value:function(e){return this.GetWebViewer().selectionRectAspectRatio=e,!0}},{key:"GetSelectionRectAspectRatio",value:function(){return this.GetWebViewer().selectionRectAspectRatio}},{key:"SetFitWindowType",value:function(e){return this._stwain._isNoViewer()||this.SetIfFitWindowAndType(e),!0}},{key:"GetIfFitWindow",value:function(){return this._stwain._isNoViewer(),!0}},{key:"SetIfFitWindow",value:function(e){var t=this;return t._stwain._isNoViewer()||(e?t.GetWebViewer().fitWindow("window"):t.GetWebViewer().zoom=1),!0}},{key:"GetImageMargin",value:function(){return this._stwain._isNoViewer()?0:this.GetWebViewer().pageMargin}},{key:"SetImageMargin",value:function(e){return this._stwain._isNoViewer()||(this.GetWebViewer().pageMargin=e),!0}},{key:"GetSelectionImageBorderColor",value:function(){return this.GetWebViewer().selectedPageBorder}},{key:"SetSelectionImageBorderColor",value:function(e){var t=e;return Zt.isNumber(t)&&(t=li.getColor(t)),-1==t.indexOf("1px solid")&&(t="1px solid "+t),this.GetWebViewer().selectedPageBorder=t,!0}},{key:"GetZoom",value:function(){return this.GetWebViewer().zoom}},{key:"SetZoom",value:function(e,t,r){var n=this;return e<n.MIN_ZOOM&&(e=n.MIN_ZOOM),e>n.MAX_ZOOM&&(e=n.MAX_ZOOM),null!=n.GetWebViewer()&&(n.GetWebViewer().zoom=e),!0}},{key:"ZoomIn",value:function(e,t){var r=this,n=r._ImgManager.getImageIdMap(r._ImgManager.convertClientIndexToServerId(r._ImgManager.getCurrentImageIndex()));if(!n)return!1;var i=r.GetWebViewer().zoom,o=Math.floor(100*i*r.zoomInStep)+1;return 1<o&&o<2501?nr(n.imageWidth*i)>15e3||nr(n.imageHeight*i)>15e3?(pl.output(r,eH.errorMessages.limitReachedForZoomIn),alert(eH.errorMessages.limitReachedForZoomIn),!1):(r.SetZoom(o/100,e,t),!0):(pl.output(r,eH.errorMessages.limitReachedForZoomIn),alert(eH.errorMessages.limitReachedForZoomIn),!1)}},{key:"ZoomOut",value:function(){var e=this,t=e.GetWebViewer().zoom,r=Math.floor(100*t*e.zoomOutStep)-1;return 1<r&&r<6501?(e.SetZoom(r/100),!0):(pl.output(e,eH.errorMessages.limitReachedForZoomOut),alert(eH.errorMessages.limitReachedForZoomOut),!1)}},{key:"GetMouseShape",value:function(){return this._stwain._isNoViewer()?0:"crosshair"!=this.GetWebViewer().cursor}},{key:"SetMouseShape",value:function(e){var t=this;return t._stwain._isNoViewer()||(t.GetWebViewer().cursor=e?"pointer":"crosshair"),!0}},{key:"GetShowPageNumber",value:function(){return!this._stwain._isNoViewer()&&this.GetWebViewer().showPageNumber}},{key:"SetShowPageNumber",value:function(e){return this._stwain._isNoViewer()||(this.GetWebViewer().showPageNumber=e),!0}},{key:"SetBackgroundFillColor",value:function(e){var t=e;return this.BackgroundFillColor=t,!0}},{key:"GetBackgroundColor",value:function(){return this.GetWebViewer().background}},{key:"SetBackgroundColor",value:function(e){var t=e;return this._stwain._isNoViewer()||(this.GetWebViewer().background=t),!0}},{key:"Go",value:function(e){return this.GetWebViewer().gotoPage(e)}},{key:"__Previous",value:function(){return this.Go(this._ImgManager.getCurrentImageIndex()-1),!0}},{key:"__Next",value:function(){return this.Go(this._ImgManager.getCurrentImageIndex()+1),!0}},{key:"__fireEvent",value:function(e,t){if(Zt.isFunction(this[e]))try{return this[e](t)}catch(r){Ho(r)}return!0}},{key:"GetIfAutoScroll",value:function(){return this.GetWebViewer().ifAutoScroll}},{key:"SetIfAutoScroll",value:function(e){return this.GetWebViewer().ifAutoScroll=e,!0}},{key:"BindView",value:function(e){var t,r=e;return Zt.isString(e)?r=Zt.get(e):Zt.isDOM(r)&&(r.id&&""!=r.id||(r.id=["dwt_",Zt.getRandom()].join(""))),(t=this.GetWebViewer().bind(r))&&this.GetWebViewer().show(),t}},{key:"GetIfShowVideoContainer",value:function(){var e=this,t=e.GetWebViewer();return Zt.isUndefined(t)?(rr.DWT.UseDefaultViewer?cs(e._stwain):us(e._stwain),!1):t.webViewer.getIfShowVideoContainer()}},{key:"ShowVideoContainer",value:function(e){var t=this,r=t.GetWebViewer();return Zt.isUndefined(r)?(rr.DWT.UseDefaultViewer?cs(t._stwain):us(t._stwain),!1):r.webViewer.showVideoContainer(e)}},{key:"UpdateVideoContainer",value:function(e){var t=this,r=t.GetWebViewer();return Zt.isUndefined(r)?(rr.DWT.UseDefaultViewer?cs(t._stwain):us(t._stwain),!1):r.webViewer.updateVideoImage(e)}},{key:"ClearSelectedAreas",value:function(){var e=this.GetWebViewer();if(e)return e.clearSelectedAreas()}},{key:"OnCloseImageEditor",value:function(){return!!this.GetWebViewer().webViewer.imageEditor&&(this.GetWebViewer().createImageEditor().dispose(),!0)}},{key:"ShowImageEditorEx",value:function(e,t,r,n,i,o,a,s){var u=this;if(this._stwain._isNoViewer())return u._stwain._nouiNotSupport("ShowImageEditorEx");switch(i){case 0:case 1:case 2:break;case 3:if(u.OnCloseImageEditor())return!0}var c,l=document;if(QG._getContainer(u._stwain)==a&&(o=!1),a){var d=rr.DWT.ContainerMap;if(d){var f,h=Object.keys(d);for(f=0;f<h.length;f++)if(h[f]==a.id){o=!1;break}}}if(o&&a&&(Zt.isDOM(a)?c=a:oH(a)?(c=document.createElement("div"),a.appendChild(c)):(c=l.getElementById(a))&&"DIV"!=c.nodeName&&(o=!1)),o&&a&&Zt.isDOM(a)){var g=iH(a);if(g){if(rr.DWT.IfLoadResources){var m,p,v="";!de.bFileSystem&&rr.DWT.IfResourcesAddTimestamp&&(v=Qt.timestamp),(m=l.createElement("link")).href=[Oo(),"/src/dynamsoft.webtwain.viewer.css",v].join(""),m.rel="stylesheet",m.async=!0,(p=l.createElement("link")).href=[Oo(),"/src/dynamsoft.webtwain.css",v].join(""),p.rel="stylesheet",p.async=!0,Zt.scriptOnload(m,(function(){Zt.scriptOnload(p,(function(){return u.ShowImageEditor(c,o,r,n)})),g.appendChild(p)})),g.appendChild(m)}return!0}}return u.ShowImageEditor(c,o,r,n)}},{key:"ShowImageEditor",value:function(e,t,r,n){var i=this;return e&&r&&n?(uH.element=e,uH.width=r,uH.height=n):(uH.element=undefined,uH.width=undefined,uH.height=undefined),uH.border=i.GetWebViewer().border,uH.selectionRectAspectRatio=i.GetWebViewer().selectionRectAspectRatio,uH.workMode=XG.normal,i.GetWebViewer().createImageEditor(uH),0!=i._stwain.ErrorCode&&(i.GetWebViewer().webViewer.imageEditor&&i.GetWebViewer().webViewer.imageEditor.dispose(),i.GetWebViewer().createImageEditor(uH)),i.GetWebViewer().webViewer.imageEditor&&i.GetWebViewer().webViewer.imageEditor.show(),!0}},{key:"__beforeImageEditorCreated",value:function(e){var t=rr.DWT.CustomizableDisplayInfo;if(!Zt.isUndefined(t)){if(!Zt.isUndefined(t.buttons)){var r=t.buttons.titles;Zt.isUndefined(r)||(Zt.isUndefined(r.previous)||(e.buttons.titles.previous=r.previous),Zt.isUndefined(r.next)||(e.buttons.titles.next=r.next),Zt.isUndefined(r.print)||(e.buttons.titles.print=r.print),Zt.isUndefined(r.scan)||(e.buttons.titles.scan=r.scan),Zt.isUndefined(r.load)||(e.buttons.titles.load=r.load),Zt.isUndefined(r.rotateleft)||(e.buttons.titles.rotateleft=r.rotateleft),Zt.isUndefined(r.rotate)||(e.buttons.titles.rotate=r.rotate),Zt.isUndefined(r.rotateright)||(e.buttons.titles.rotateright=r.rotateright),Zt.isUndefined(r.deskew)||(e.buttons.titles.deskew=r.deskew),Zt.isUndefined(r.crop)||(e.buttons.titles.crop=r.crop),Zt.isUndefined(r.cut)||(e.buttons.titles.cut=r.cut),Zt.isUndefined(r.changeimagesize)||(e.buttons.titles.changeimagesize=r.changeimagesize),Zt.isUndefined(r.flip)||(e.buttons.titles.flip=r.flip),Zt.isUndefined(r.mirror)||(e.buttons.titles.mirror=r.mirror),Zt.isUndefined(r.zoomin)||(e.buttons.titles.zoomin=r.zoomin),Zt.isUndefined(r.originalsize)||(e.buttons.titles.originalsize=r.originalsize),Zt.isUndefined(r.zoomout)||(e.buttons.titles.zoomout=r.zoomout),Zt.isUndefined(r.stretch)||(e.buttons.titles.stretch=r.stretch),Zt.isUndefined(r.fit)||(e.buttons.titles.fit=r.fit),Zt.isUndefined(r.fitw)||(e.buttons.titles.fitw=r.fitw),Zt.isUndefined(r.fith)||(e.buttons.titles.fith=r.fith),Zt.isUndefined(r.hand)||(e.buttons.titles.hand=r.hand),Zt.isUndefined(r.rectselect)||(e.buttons.titles.rectselect=r.rectselect),Zt.isUndefined(r.zoom)||(e.buttons.titles.zoom=r.zoom),Zt.isUndefined(r.restore)||(e.buttons.titles.restore=r.restore),Zt.isUndefined(r.save)||(e.buttons.titles.save=r.save),Zt.isUndefined(r.close)||(e.buttons.titles.close=r.close),Zt.isUndefined(r.removeall)||(e.buttons.titles.removeall=r.removeall),Zt.isUndefined(r.removeselected)||(e.buttons.titles.removeselected=r.removeselected));var n=t.buttons.bShowAllButtons;Zt.isUndefined(n)||(e.buttons.bShowAllButtons=n);var i=t.buttons.visibility;Zt.isUndefined(i)||(Zt.isUndefined(i.scan)||(e.buttons.visibility.scan=i.scan),Zt.isUndefined(i.load)||(e.buttons.visibility.load=i.load),Zt.isUndefined(i.print)||(e.buttons.visibility.print=i.print),Zt.isUndefined(i.removeall)||(e.buttons.visibility.removeall=i.removeall),Zt.isUndefined(i.removeselected)||(e.buttons.visibility.removeselected=i.removeselected),Zt.isUndefined(i.rotateleft)||(e.buttons.visibility.rotateleft=i.rotateleft),Zt.isUndefined(i.rotate)||(e.buttons.visibility.rotate=i.rotate),Zt.isUndefined(i.rotateright)||(e.buttons.visibility.rotateright=i.rotateright),Zt.isUndefined(i.deskew)||(e.buttons.visibility.deskew=i.deskew),Zt.isUndefined(i.crop)||(e.buttons.visibility.crop=i.crop),Zt.isUndefined(i.cut)||(e.buttons.visibility.cut=i.cut),Zt.isUndefined(i.changeimagesize)||(e.buttons.visibility.changeimagesize=i.changeimagesize),Zt.isUndefined(i.flip)||(e.buttons.visibility.flip=i.flip),Zt.isUndefined(i.mirror)||(e.buttons.visibility.mirror=i.mirror),Zt.isUndefined(i.zoomin)||(e.buttons.visibility.zoomin=i.zoomin),Zt.isUndefined(i.originalsize)||(e.buttons.visibility.originalsize=i.originalsize),Zt.isUndefined(i.zoomout)||(e.buttons.visibility.zoomout=i.zoomout),Zt.isUndefined(i.stretch)||(e.buttons.visibility.stretch=i.stretch),Zt.isUndefined(i.fit)||(e.buttons.visibility.fit=i.fit),Zt.isUndefined(i.fitw)||(e.buttons.visibility.fitw=i.fitw),Zt.isUndefined(i.fith)||(e.buttons.visibility.fith=i.fith),Zt.isUndefined(i.hand)||(e.buttons.visibility.hand=i.hand),Zt.isUndefined(i.rectselect)||(e.buttons.visibility.rectselect=i.rectselect),Zt.isUndefined(i.zoom)||(e.buttons.visibility.zoom=i.zoom))}var o=t.dialogText;Zt.isUndefined(o)||(Zt.isUndefined(o.dlgRotateAnyAngle)||(e.dialogText.dlgRotateAnyAngle=o.dlgRotateAnyAngle),Zt.isUndefined(o.dlgChangeImageSize)||(e.dialogText.dlgChangeImageSize=o.dlgChangeImageSize),Zt.isUndefined(o.saveChangedImage)||(e.dialogText.saveChangedImage=o.saveChangedImage),Zt.isUndefined(o.selectSource)||(e.dialogText.selectSource=o.selectSource))}}},{key:"__topPageChanged",value:function(e,t,r){r.__fireEvent("onTopImageInTheViewChanged",{index:e,bByScrollBar:t})}},{key:"__click",value:function(e,t){var r=t;r.__fireEvent("onMouseClick",{e:e,x:e.imageX,y:e.imageY,index:r._ImgManager.getCurrentImageIndex()})}},{key:"__rightclick",value:function(e,t){var r=t;r.__fireEvent("onMouseRightClick",{e:e,x:e.imageX,y:e.imageY,index:r._ImgManager.getCurrentImageIndex()})}},{key:"__dblclick",value:function(e,t){var r=t;r.__fireEvent("onMouseDoubleClick",{e:e,x:e.imageX,y:e.imageY,index:r._ImgManager.getCurrentImageIndex()})}},{key:"__mousemove",value:function(e,t){var r=t;r.__fireEvent("onMouseMove",{e:e,x:e.imageX,y:e.imageY,index:r._ImgManager.getCurrentImageIndex()})}},{key:"__pageAreaSelected",value:function(e,t,r){var n=r,i=1;if(t&&t.length>0){var o=t[t.length-1];o.index&&(i=nr(o.index)+1),n.__fireEvent("onImageAreaSelected",{index:e,left:nr(o.x),top:nr(o.y),right:nr(o.x+o.width),bottom:nr(o.y+o.height),areaIndex:i})}}},{key:"__pageAreaUnselected",value:function(e,t){t.__fireEvent("onImageAreaDeSelected",e)}},{key:"__dragdone",value:function(e,t){var r=t;Zt.isFunction(r._stwain.__OnIndexChangeDragDropDone)&&r._stwain.__OnIndexChangeDragDropDone(e)}},{key:"__onDrop",value:function(e,t){var r=t;r.GetWebViewer().webViewer.acceptDrop&&r.__dropEvent(e,r)}},{key:"__dropEvent",value:function(e,t){var r,n,i=t,o=function(e){i._stwain._bIfShowProgressBar&&Qt.closeProgress(null),e&&pl.output(null,e+" was loaded successfully!")},a=function(e,t,r){i._stwain._bIfShowProgressBar&&Qt.closeProgress(null),i._stwain._errorCode=e,i._stwain._errorString=t,sd({code:e,message:t}),r&&pl.output(null,r+" failed to load. Error code: "+e+"Error String: "+t)};try{for(var s=e.dataTransfer.files,u=0;u<s.length;u++){if(0==(r=s[u]).type.length){var c=void 0,l=r.name.indexOf(".");switch(l>0&&(c=r.name.substring(l+1)),c){case"bmp":n=rr.DWT.EnumDWT_ImageType.IT_BMP;break;case"jpg":case"jpeg":n=rr.DWT.EnumDWT_ImageType.IT_JPG;break;case"tif":case"tiff":n=rr.DWT.EnumDWT_ImageType.IT_TIF;break;case"png":n=rr.DWT.EnumDWT_ImageType.IT_PNG;break;case"pdf":n=rr.DWT.EnumDWT_ImageType.IT_PDF;break;case"jp2":case"j2k":case"j2c":n=rr.DWT.EnumDWT_ImageType.IT_J2K;break;default:pl.output(null,r.name+" failed to load because the file type is not supported!"),n=-1,ba(i._stwain)}}else switch(r.type){case"image/bmp":n=rr.DWT.EnumDWT_ImageType.IT_BMP;break;case"image/jpg":case"image/jpeg":n=rr.DWT.EnumDWT_ImageType.IT_JPG;break;case"image/tif":case"image/tiff":n=rr.DWT.EnumDWT_ImageType.IT_TIF;break;case"image/png":n=rr.DWT.EnumDWT_ImageType.IT_PNG;break;case"application/pdf":n=rr.DWT.EnumDWT_ImageType.IT_PDF;break;case"image/jp2":n=rr.DWT.EnumDWT_ImageType.IT_J2K;break;default:pl.output(null,r.name+" failed to load because the file type is not supported!"),n=-1,ba(i._stwain)}if(-1!=n){if(i._stwain._bIfShowProgressBar?Qt.showProgress(i._stwain,"DropLoading",i._stwain.IfShowCancelDialogWhenImageTransfer):Qt.hideProgress(),i._stwain._OnPercentDone([0,-1,hl.Loading]),i._stwain.Addon&&i._stwain.Addon.PDF){Wc.checkProductKey(i._stwain,{PDFRasterizer:!0},!0)}!function(e){var t=new FileReader;t.readAsDataURL(e),t.onload=function(){var t=i._stwain.__GetLoadEventsNum();i._stwain.__LoadImageFromBytesV2(e,n,"",!0,0,e.size,!1,t,o,a)},t.onerror=function(e){Ma(i._stwain),i._stwain._errorString=this.error,a(i._stwain._errorCode,i._stwain._getErrorString())}}(s[u])}}}catch(d){Zt.error(d.stack||d,"error"),setTimeout((function(){throw d}),0)}}},{key:"__pageChange",value:function(e,t){var r,n=t,i=n._ImgManager.count();if(Zt.log("OnPagination"),i<=0)Ia(n._stwain);else if(1!=i){!/^\d+$/.test(e)||e<=0?alert(eH.errorMessages.invalidIndex):((r=nr(e)-1)<0?r=0:r>=i&&(r=i-1),r!=n._ImgManager.getCurrentImageIndex()&&n.GetWebViewer().gotoPage(r))}}},{key:"__bufferChanged",value:function(e,t,r){var n,i=e,o=[],a=-1,s=[];t.operation&&(t.action=t.operation);for(var u=0;u<i._ImgManager.count();u++)(n=i._ImgManager.getCustomDataByIndex(u))&&n.serverId&&o.push(this._ImgManager._serverId2uidFromServer(n.serverId));if(t.imageIds=o,t.curIndex>=0&&(n=i._ImgManager.getCustomDataByIndex(t.curIndex))&&n.serverId&&(a=this._ImgManager._serverId2uidFromServer(n.serverId)),t.currentId=a,"modify"==t.operation&&""!=t.afterStatus.modifiedUid){var c=i._ImgManager.getIndexByUid(t.afterStatus.modifiedUid);c>=0&&(n=i._ImgManager.getCustomDataByIndex(c))&&n.serverId&&(t.modifiedId=this._ImgManager._serverId2uidFromServer(n.serverId))}if(t.afterStatus.selectedUids)for(var l=0;l<t.afterStatus.selectedUids.length;l++){var d=t.afterStatus.selectedUids[l];if(d&&-1!=d){var f=i._ImgManager.getIndexByUid(t.afterStatus.selectedUids[l]);f>=0&&(n=i._ImgManager.getCustomDataByIndex(f))&&n.serverId&&s.push(this._ImgManager._serverId2uidFromServer(n.serverId))}}t.selectedIds=s,Zt.mix(t,{}),delete t.uids,delete t.currentUid,delete t.selectedUids,delete t.afterStatus,delete t.beforeStatus,delete t.operation,delete t.curIndex,delete t.docUid,i.__fireEvent("onBufferChanged",t)}},{key:"__setError",value:function(e,t,r){var n=r;n._stwain._errorCode=e,n._stwain._errorString=t}},{key:"__acquire",value:function(e,t){var r=e;try{var n=!1;1==rr.DWT.IfConfineMaskWithinTheViewer&&(rr.DWT.IfConfineMaskWithinTheViewer=!1,n=!0);var i;i=Zt.isArray(t)&&t.length>=3?t:eH.dialogText.selectSource,r._stwain._selectSourceAsync("SelectSourceAsync",null,i).then((function(){return r._stwain.AcquireImageAsync({IfShowUI:!0,IfCloseSourceAfterAcquire:!0})})).then((function(){n&&(rr.DWT.IfConfineMaskWithinTheViewer=!0)}))["catch"]((function(e){Zt.log("User did not select a source"),n&&(rr.DWT.IfConfineMaskWithinTheViewer=!0)}))}catch(o){}}},{key:"__loadImage",value:function(e){try{var t=e,r=null;rr.DWT.IfConfineMaskWithinTheViewer&&(r=!0,rr.DWT.IfConfineMaskWithinTheViewer=!1),t._stwain._containerElement=undefined;if(t._stwain.IfShowFileDialog=!0,t._stwain.Addon&&t._stwain.Addon.PDF){Wc.checkProductKey(t._stwain,{PDFRasterizer:!0},!0)}t._stwain.LoadImageEx("",5,(function(){Zt.log("Loaded an image successfully."),null!=r&&(rr.DWT.IfConfineMaskWithinTheViewer=r)}),(function(e,t){Zt.log("Loading failed with the error: "+t),null!=r&&(rr.DWT.IfConfineMaskWithinTheViewer=r)}))}catch(n){}}},{key:"__print",value:function(e){var t=e;ls(t._stwain),t._ImgManager.getCurrentImageIndex()<0||t._ImgManager.PrintCurrentImage()}},{key:"__save",value:(e=n(g().mark((function r(e,t,n,i,o){var a,s,u,c,l;return g().wrap((function(r){for(;;)switch(r.prev=r.next){case 0:if(s="save",ls((a=e)._stwain),!(a._ImgManager.count()<=0||a._ImgManager.getCurrentImageIndex()<0)){r.next=4;break}return r.abrupt("return");case 4:return a._stwain._containerElement=undefined,u=a.__getViewerElement(a,o),Wl(s,u),r.prev=7,c=this._ImgManager.getIndexByUid(t),l=this._ImgManager.convertClientIndexToServerId(c),r.next=12,a._stwain._updateImage(l,n,i);case 12:r.sent,r.next=17;break;case 15:r.prev=15,r.t0=r["catch"](7);case 17:return r.prev=17,n=null,Rl(s),r.finish(17);case 21:return r.abrupt("return",void 0);case 22:case"end":return r.stop()}}),r,this,[[7,15,17,21]])}))),function(t,r,n,i,o){return e.apply(this,arguments)})},{key:"__getViewerElement",value:function(e,t){var r,n=e;if(t)if(n.GetWebViewer().webViewer.imageEditor){var i=n.GetWebViewer().createImageEditor();r="dwt-viewer-imageEditor-fullScreen"==i.inner.containerElement.className?{_containerElement:document.body}:{_containerElement:i.inner.containerElement}}else r=n._stwain;else r=n._stwain;return r}},{key:"__deskew",value:function(e,t,r){var n=this,i="deskew";ls(n._stwain);var o=n._ImgManager.getCurrentImageIndex();if(n._ImgManager.count()<=0||o<0)aH.output(n,"No image in Buffer");else{var a=n.__getViewerElement(n,!0);Wl(i,a);n._stwain.GetSkewAngleFromBinaryAsync(o,t,(function(e){r(e[0]),Rl(i)}),(function(){Rl(i)}))}}},{key:"__remove",value:function(e){var t=this;ls(t._stwain),t._ImgManager.count()<=0||t._ImgManager.getCurrentImageIndex()<0?aH.output(t,"No image in Buffer"):t._stwain.RemoveAllSelectedImages()}},{key:"__removeAll",value:function(e){var t=this;ls(t._stwain),t._ImgManager.count()<=0||t._ImgManager.getCurrentImageIndex()<0?aH.output(t,"No image in Buffer"):t._stwain.RemoveAllImages()}},{key:"__onBindViewer",value:function(e){e&&(QG._setContainer(this._stwain,e),e.id&&(rr.DWT.ContainerMap[e.id]=this._stwain))}},{key:"__onUnBindViewer",value:function(e){if(e){var t=QG._getContainer(this._stwain);if(t)for(;t.firstChild;)t.removeChild(t.firstChild);if(QG._setContainer(this._stwain,null),e.id){var r=rr.DWT.ContainerMap;e.id in r&&delete rr.DWT.ContainerMap[e.id]}}}},{key:"__close",value:function(e){ls(this._stwain),QG._closeImageEditorUI(this._stwain)}},{key:"__rotateRightForServer",value:function(e){var t=this;ls(t._stwain);var r=t._ImgManager.getCurrentImageIndex();t._ImgManager.count()<=0||r<0?aH.output(t,"No image in Buffer"):t._stwain.RotateRight(r)}},{key:"__rotateForServer",value:function(e,t,r,n){var i=this;ls(i._stwain);var o=i._ImgManager.getCurrentImageIndex();i._ImgManager.count()<=0||o<0?aH.output(i,"No image in Buffer"):i._stwain.RotateEx(o,t,n,r)}},{key:"__rotateLeftForServer",value:function(e){var t=this;ls(t._stwain);var r=t._ImgManager.getCurrentImageIndex();t._ImgManager.count()<=0||r<0?aH.output(t,"No image in Buffer"):t._stwain.RotateLeft(r)}},{key:"__deskewForServer",value:function(e){var t=this;ls(t._stwain);var r=t._ImgManager.getCurrentImageIndex();t._ImgManager.count()<=0||r<0?aH.output(t,"No image in Buffer"):t._stwain.GetSkewAngleAsync(r).then((function(e){t._stwain.RotateEx(r,e,!0,5,(function(){}),(function(){}))}))}},{key:"__cropForServer",value:function(e,t){var r=this;ls(r._stwain);var n=r._ImgManager.getCurrentImageIndex();if(r._ImgManager.count()<=0||n<0)aH.output(r,"No image in Buffer");else{var i=t.left,o=t.top,a=i+t.width,s=o+t.height;r._stwain.Crop(n,nr(i),nr(o),nr(a),nr(s))}}},{key:"__eraseForServer",value:function(e,t){var r=this;ls(r._stwain);var n=r._ImgManager.getCurrentImageIndex();if(r._ImgManager.count()<=0||n<0)aH.output(r,"No image in Buffer");else{var i=t.left,o=t.top,a=i+t.width,s=o+t.height;r._stwain.CutFrameToClipboard(n,nr(i),nr(o),nr(a),nr(s))}}},{key:"__changeImageSizeForServer",value:function(e,t,r,n){var i=this;ls(i._stwain);var o=i._ImgManager.getCurrentImageIndex();i._ImgManager.count()<=0||o<0?aH.output(i,"No image in Buffer"):i._stwain.ChangeImageSize(o,t,r,n)}},{key:"__flipForServer",value:function(e){var t=this;ls(t._stwain);var r=t._ImgManager.getCurrentImageIndex();t._ImgManager.count()<=0||r<0?aH.output(t,"No image in Buffer"):t._stwain.Flip(r)}},{key:"__mirrorForServer",value:function(e){var t=this;ls(t._stwain);var r=t._ImgManager.getCurrentImageIndex();t._ImgManager.count()<=0||r<0?aH.output(t,"No image in Buffer"):t._stwain.Mirror(r)}},{key:"__restoreForServer",value:function(e,t){var r=e;if(ls(r._stwain),r._ImgManager.count()<=0||r._ImgManager.getCurrentImageIndex()<0)aH.output(r,"No image in Buffer");else{var n=r._ImgManager.getIndexByUid(t);n>=0&&r.__RestoreImageInner(r,n)}}},{key:"__saveForServer",value:function(e,t){var r=e;return new ci.Promise((function(e,n){ls(r._stwain),(r._ImgManager.count()<=0||r._ImgManager.getCurrentImageIndex()<0)&&(aH.output(r,"No image in Buffer"),e());var i=r._ImgManager.getIndexByUid(t);i>=0?r.__SaveImageInner(r,i,!0,(function(){e()})):e()}))}},{key:"__RestoreImageInner",value:function(e,t,r){var n=e,i=n._ImgManager.getImageIdMap(n._ImgManager.convertClientIndexToServerId(t));i&&n.__OnGetImageFromServerForEdit(i,t,1,(function(e,t,i){if(e){Zt.log("__RestoreImageInner: "+[e.uuid].join(","));var o=Zt.clone(e);o.imageId=e.serverId,n._ImgManager.UpdateImage(o,i)}if(-1==(e&&e.serverId))return r&&r(),!1;r&&r()}))}},{key:"__SaveImageInner",value:function(e,t,r,n){var i=e,o=i._ImgManager.getImageIdMap(i._ImgManager.convertClientIndexToServerId(t));return o&&i.__OnGetImageFromServerForEdit(o,t,2,(function(e,t,o){if(e){if(1==r&&(Zt.log("__SaveImageInner: "+[e.uuid].join(",")),i._ImgManager.getCurrentImageIndex()==t)){var a=Zt.clone(e);a.imageId=e.serverId,i._ImgManager.UpdateImage(a,o)}if(-1==e.serverId)return n&&n(),!1}return n&&n(),!0})),!0}},{key:"__OnGetImageFromServerForEdit",value:function(e,t,r,n){var i=this;if(n&&i._ImgManager.getBaseUrl){var o=i._ImgManager.convertClientIndexToServerId(t);if(-1==o)return!1;rr.DWT.ConnectWithSocket?n():Vi({method:"GET",xhrFields:{withCredentials:!0},url:pl.getUrlByAct(i._ImgManager.getBaseUrl,o,r),onSuccess:function(r){var a;e.ticks=Date.now(),a=rr.navInfoSync.bMobile?pl.getImageUrl(i._ImgManager.getBaseUrl,o,Math.round(e.iImageControlWidth*devicePixelRatio),Math.round(e.iImageControlHeight*devicePixelRatio),e.ticks):pl.getImageUrl(i._ImgManager.getBaseUrl,o,nr(e.iImageControlWidth),nr(e.iImageControlHeight),e.ticks),e.imageUrl=pl.getImageUrl(i._ImgManager.getBaseUrl,o,-1,-1,e.ticks),e.minImageUrl=a;var s=i._ImgManager.GetMetaDataByIndex(t);if(s){var u=i._ImgManager.getImageIdMap(o);u&&u.width?s.width=u.width:s.width=i._stwain.GetImageWidth(t),u&&u.height?s.height=u.height:s.height=i._stwain.GetImageHeight(t)}n(e,t,s)},onError:function(){}})}return!0}}]);var e}(),lH=function(e){function t(e,r){var n;o(this,t);var a=n=i(this,t,[r]);return a._stwain=e,a.bImageJustChangedInEditor=!1,a.bImageChangedInViewer=!1,n}return f(t,e),s(t,[{key:"getUidByIndex",value:function(e){return this._buffer.getUidByIndex(e)}},{key:"dispose",value:function(){return!0}},{key:"append",value:function(e,t,r,n,i){var o,a,s,u,c,l=this;(this._buffer.isActiveFile||!Zt.isUndefined(i))&&n.currentFileName&&n.currentFileName.length>0?c=a=l.getCountByDocumentName(n.currentFileName):(a=l.count(),c=l.getCountByDocumentName(l.GetCurrentFileName())),s=l.getCurrentImageIndex();for(var d=a-1;d>=e;d--)u=l.convertClientIndexToServerId(d),l.removeByServerId(u,d);return a<e?(o=c,l._updateUIAfterAdd(o,t,r,n,!0)):(o=s>=a-1?0:s+1,u=l.convertClientIndexToServerId(o),l.removeByServerId(u,o),o==e-1?l._updateUIAfterAdd(o,t,r,n,!0):l._updateUIAfterAdd(o,t,r,n,!1))}},{key:"insertBefore",value:function(e,t,r,n,i){var o,a=1*e;return(a<0||a>t)&&(a=-1),a>=(o=this.count())&&(a=o),this._updateUIAfterAdd(a,r,n,i,!1)}},{key:"exists",value:function(e){return!Zt.isUndefined(this.getImageIdMap(e))}},{key:"insert",value:function(e,t,r,n,i){var o,a=1*e;return(a<0||a>t)&&(a=-1),a>=(o=this.count())&&(a=o),this._updateUIAfterAdd(a,r,n,i,!1)}},{key:"moveImage",value:function(e,t,r){return this._buffer.moveImage(e,t)}},{key:"switchImage",value:function(e,t){return this._buffer.switchImage(e,t)}},{key:"setSelectedClientIndexArray",value:function(e){return this._buffer.selectImages(e)}},{key:"getSelectedClientIndexArray",value:function(e){return this._buffer.getSelectedImagesIndices()}},{key:"showImagesByFilter",value:function(e,t,r){return this._buffer.filterImagesByTag(e,t,r)}},{key:"clearFilter",value:function(){return this._buffer.clearFilter()}},{key:"removeImageTag",value:function(e){return this._buffer.removeImageTag(e)}},{key:"addImageTag",value:function(e,t){return this._buffer.tagImages(e,t)}},{key:"getCurrentTag",value:function(){var e;return 0==(e=this._buffer.getCurrentTag())?"":e}},{key:"renameTag",value:function(e,t){return this._buffer.renameTag(e,t)}},{key:"removeTag",value:function(e,t){return this._buffer.removeTag(e,t)}},{key:"getTagList",value:function(){return this._buffer.getTagList()}},{key:"getTagListByIndex",value:function(e){return this._buffer.getTagListByIndex(e)}},{key:"OpenFile",value:function(e){return this._buffer.openDocument(e)}},{key:"CreateFile",value:function(e){return this._buffer.createDocument(e)}},{key:"GetCurrentFileName",value:function(){return this._buffer.getCurrentFileName()}},{key:"RemoveFile",value:function(e){return this._buffer.removeDocument(e)}},{key:"RenameFile",value:function(e,t){return this._buffer.renameDocument(e,t)}},{key:"GetFileInfoList",value:function(){return this._buffer.getDocumentInfoList()}},{key:"MoveImageToFile",value:function(e,t,r,n){return this._buffer.moveImageToFile(e,t,r,n)}},{key:"GetServerIdsByFileName",value:function(e){var t,r=this,n=[];return(t=r.GetFileInfoList())?Zt.each(t,(function(t){if(e==t.name){if(t.imageIds)for(var i=0;i<t.imageIds.length;i++){var o=t.imageIds[i];if(o&&-1!=o){var a=r._stwain._uidFromServer2ServerId(o);a>0&&n.push(a)}}return!1}})):n=[],n}},{key:"insertImage",value:function(e,t,r){this._buffer.insertImage(t,e,r)}},{key:"GetMetaDataByIndex",value:function(e){return this._buffer.getMetadataByUid(this._buffer.getUidByIndex(e))}},{key:"RefreshAllImages",value:function(e,t){for(var r,n,i,o=this,a=0;a<o.count();a++){r=o.convertClientIndexToServerId(a);var s=o.getImageIdMap(r);if(s){i=o.GetMetaDataByIndex(a),n=rr.navInfoSync.bMobile?pl.getImageUrl(o._baseUrl,r,Math.round(e*devicePixelRatio),Math.round(t*devicePixelRatio),Date.now()):pl.getImageUrl(o._baseUrl,r,e,t,Date.now());var u=Zt.clone(s);u.imageId=r,u.minImageUrl=n,o._buffer.updateImage(u,i)}}}},{key:"UpdateData",value:function(e,t){var r=e,n=this.getImageIdMap(r);if(n){var i=Zt.clone(n);i.imageId=e,this._buffer.updateImage(i,t)}return!0}},{key:"UpdateImage",value:function(e,t){return this._buffer.updateImage(e,t),!0}},{key:"_setDataImageControl",value:function(e,t,r){var n,i,o,a,s=this;if(r)o=e;else if(o=(i=s.getCustomDataByIndex(e)).serverId,a=i.uidFromServer,o<=0)return!1;return(n=s.getImageIdMap(o))||((n=new Pf).serverId=o,n.uidFromServer=a,t&&(t.height&&(n.height=t.height),t.width&&(n.width=t.width)),s._serverIdMap[o]=n,s._uidMap[a]=n),t&&(t.height&&(n.height=t.height),t.width&&(n.width=t.width)),null!=n&&(n.bIsDirty=!0),s.__GetImageAndAttach(n,o,!0,!1,!1,e,t),!0}},{key:"__AttachImages",value:function(){var e,t,r,n=this;t=n.count();for(var i=0;i<t;i++)(e=n.convertClientIndexToServerId(i))>=0&&(r=n.getImageIdMap(e))&&n.__GetImageAndAttach(r,e,!0,!1,!1,0)}},{key:"AddImage",value:function(e,t,r,n,i){var o,a=this,s=1*e;return!(t<=0)&&((o=new Pf).bIsDirty=!0,o.serverId=t,o.uidFromServer=r,a._serverIdMap[t]=o,a._uidMap[r]=o,t>=0&&a.__GetImageAndAttach(o,t,!1,!0,i,s,n),!0)}},{key:"OnGetImageByURL",value:function(e,t,r,n,i,o,a,s){return t.imageUrl&&""!=t.imageUrl?(t.iImageControlWidth=r,t.iImageControlHeight=n,t.bAddImage=i,t.bAppendImage=o,t.index=a,this._attachImagesForControl(t,s),!0):this.OnGetImageFromServer(e,t,r,n,i,o,a,s)}},{key:"OnGetImageFromServer",value:function(e,t,r,n,i,o,a,s){var u,c,l=this,d=l._baseUrl;if(d){if(e<=0)return!1;t.bIsDirty&&(t.ticks=Date.now()),Zt.isUndefined(r)&&(r=-1),Zt.isUndefined(n)&&(n=-1),t.iImageControlWidth=r,t.iImageControlHeight=n,t.bAddImage=i,t.bAppendImage=o,t.index=a,rr.DWT.ConnectWithSocket&&l._stwain._isBindViewer()?(l._attachImagesForControl(t,s),QG._getblob_queue.push([l._stwain,e,s]),QG.ProcessGetBlobByQueue()):(u=pl.getImageUrl(d,e,-1,-1,t.ticks),c=rr.navInfoSync.bMobile?pl.getImageUrl(d,e,Math.round(r*devicePixelRatio),Math.round(n*devicePixelRatio),t.ticks):pl.getImageUrl(d,e,r,n,t.ticks),t.imageUrl=u,t.minImageUrl=c,l._attachImagesForControl(t,s))}return!0}},{key:"getBaseUrl",get:function(){return this._baseUrl}},{key:"_attachImagesForControl",value:function(e,t){var r,n,i=this;if((n=Zt.clone(e)).imageId=n.serverId,n.bAddImage){if(r=t.currentFileName.length>0?i._buffer.addImage(n,t,t.currentFileName):i._buffer.addImage(n,t)){var o=p(r,1)[0],a=this.getImageIdMap(n.serverId);a&&(a.uuid=o);var s=this._buffer.getCustomDataByUid(o);s&&(s.serverId&&n&&n.serverId&&(s.serverId=n.serverId),s.uidFromServer&&(s.uidFromServer=n.uidFromServer))}}else i._buffer.updateImage(n,t);return!0}},{key:"_updateUIAfterAdd",value:function(e,t,r,n,i){return!(t<0)&&this.AddImage(e,t,r,n,i)}},{key:"__GetImageAndAttach",value:function(e,t,r,n,i,o,a){var s,u,c,l=this;l._stwain._isBindViewer()?(c=l._stwain.Viewer.height>=400?l._stwain.Viewer.height:400,u=l._stwain.Viewer.width>=400?l._stwain.Viewer.width:400):(u=-1,c=-1);var d=!1;d=!!r||1==e.bIsDirty;var f=null===(s=l.getImageIdMap(t))||void 0===s?void 0:s.uuid;f&&-1!=f&&e.iImageControlWidth==u&&e.iImageControlHeight==c&&0==e.bIsDirty||l.__SetArrayControlLoadImage(t,e,u,c,d,n,i,o,a)}},{key:"__SetArrayControlLoadImage",value:function(e,t,r,n,i,o,a,s,u){i?this.OnGetImageFromServer(e,t,r,n,o,a,s,u):this.OnGetImageByURL(e,t,r,n,o,a,s,u)}},{key:"GetServerIdList",value:function(){var e,t,r,n=this,i=[];if(e=n._buffer.getDocumentContents(n._buffer.getCurrentDocument()))for(var o=0;o<e.length;o++)(t=e[o])&&-1!=t&&(r=n._buffer.getCustomDataByUid(t))&&i.push(r.serverId);return i}}])}($j);function dH(){var e=window.Dynamsoft.Lib.Promise;if(sH)return e.resolve(sH);var t,r,n=navigator;if(n&&"userAgentData"in n){var i=navigator.userAgentData;if(i.platform&&""!=i.platform){var o=[];if("brands"in i&&Zt.isArray(i.brands)&&i.brands.length>0?o=i.brands:"uaList"in i&&Zt.isArray(i.uaList)&&i.uaList.length>0&&(o=i.uaList),o.length>0)return(r=function(e){var t=de,r=e.architecture.toLowerCase(),n="64"==e.bitness,i=r.indexOf("arm")>-1,o=r.indexOf("mips")>-1;return{bUseUserAgent:!1,bWin:t.bWin,bMac:t.bMac,bLinux:t.bLinux,bAndroid:t.bAndroid,bMobile:t.bMobile,bPad:t.bPad,bChromeOS:t.bChromeOS,bHarmonyOS:t.bHarmonyOS,bArm64:i,bMips64:o,bEmbed:i||o,bOSx64:n,bIE:!1,bEdge:t.bEdge,bChrome:t.bChrome,bFirefox:t.bFirefox,bSafari:t.bSafari,bOpera:t.bOpera,bGecko:!0,bHuaWeiBrowser:!1,bHTML5Edition:!0,strBrowserVersion:t.strBrowserVersion,IEMode:0}},t?window.Dynamsoft.Lib.Promise.resolve((function(){return r(t)})):navigator.userAgentData.getHighEntropyValues(["platform","platformVersion","architecture","bitness"]).then(r)).then((function(e){return sH=e,e}))}}return sH=de,e.resolve(sH)}var fH=0,hH=[],gH=!(!document||!document.addEventListener),mH="DOMContentLoaded",pH="readystatechange",vH="load",_H="complete",yH=gH?function(e,t,r){e.addEventListener(t,r,!1)}:function(e,t,r){e.attachEvent("on"+t,r)},SH=gH?function(e,t,r){e.removeEventListener(t,r,!1)}:function(e,t,r){e.detachEvent("on"+t,r)};function IH(){fH||(fH=1,dH().then((function(){document&&SH(window,vH,IH),function(){for(var e=function(){try{hH[t]()}catch(Mj){Zt.log(Mj,"error"),setTimeout((function(){throw Mj}),0)}},t=0;t<hH.length;t++)e()}()})))}function bH(e){if(fH)try{e()}catch(Mj){Zt.log(Mj,"error"),setTimeout((function(){throw Mj}),0)}else hH.push(e);return this}var TH=function(e){var t=e||window.event,r=!0;return Zt.each(ci.Events.registedObjs,(function(e){Zt.each(ci.Events.registedClass,(function(n){if(e instanceof n&&e.bFocus&&e.handlerKeyDown&&!(r=e.handlerKeyDown(t)))return!1}))})),r};function CH(e,t){for(var r in t)t.hasOwnProperty(r)&&!Zt.isUndefined(t[r])&&(e.hasOwnProperty(r)&&!Zt.isUndefined(e[r])||(e[r]=t[r]));return e}bH((function(){Zt.addEventListener(document.documentElement,"keydown",TH)})),CH(rr.DWT,Jo),CH(rr.DWT,Qo),rr.DWT.CertificateConfig?CH(rr.DWT.CertificateConfig,Xo):rr.DWT.CertificateConfig=Xo,rr.DWT.RegisterEvent=function(e,t){if(Zt.isUndefined(e))throw{code:-2314,message:"The parameter cannot be empty."};if(!Zt.isString(e)||Zt.isString(e)&&0==e.trim().length||Zt.isUndefined(t)||!Zt.isFunction(t))throw{code:-2416,message:"Invalid parameter."};return Zt.isFunction(t)&&(rr.DWT[e]=t),!0};var wH=function(e){return e.CAP_NONE=0,e.CAP_XFERCOUNT=1,e.ICAP_COMPRESSION=256,e.ICAP_PIXELTYPE=257,e.ICAP_UNITS=258,e.ICAP_XFERMECH=259,e.CAP_AUTHOR=4096,e.CAP_CAPTION=4097,e.CAP_FEEDERENABLED=4098,e.CAP_FEEDERLOADED=4099,e.CAP_TIMEDATE=4100,e.CAP_SUPPORTEDCAPS=4101,e.CAP_EXTENDEDCAPS=4102,e.CAP_AUTOFEED=4103,e.CAP_CLEARPAGE=4104,e.CAP_FEEDPAGE=4105,e.CAP_REWINDPAGE=4106,e.CAP_INDICATORS=4107,e.CAP_SUPPORTEDCAPSEXT=4108,e.CAP_PAPERDETECTABLE=4109,e.CAP_UICONTROLLABLE=4110,e.CAP_DEVICEONLINE=4111,e.CAP_AUTOSCAN=4112,e.CAP_THUMBNAILSENABLED=4113,e.CAP_DUPLEX=4114,e.CAP_DUPLEXENABLED=4115,e.CAP_ENABLEDSUIONLY=4116,e.CAP_CUSTOMDSDATA=4117,e.CAP_ENDORSER=4118,e.CAP_ALARMS=4120,e.CAP_ALARMVOLUME=4121,e.CAP_AUTOMATICCAPTURE=4122,e.CAP_TIMEBEFOREFIRSTCAPTURE=4123,e.CAP_TIMEBETWEENCAPTURES=4124,e.CAP_CLEARBUFFERS=4125,e.CAP_MAXBATCHBUFFERS=4126,e.CAP_DEVICETIMEDATE=4127,e.CAP_POWERSUPPLY=4128,e.CAP_CAMERAPREVIEWUI=4129,e.CAP_SERIALNUMBER=4132,e.CAP_PRINTER=4134,e.CAP_PRINTERENABLED=4135,e.CAP_PRINTERINDEX=4136,e.CAP_PRINTERMODE=4137,e.CAP_PRINTERSTRING=4138,e.CAP_PRINTERSUFFIX=4139,e.CAP_LANGUAGE=4140,e.CAP_FEEDERALIGNMENT=4141,e.CAP_FEEDERORDER=4142,e.CAP_REACQUIREALLOWED=4144,e.CAP_BATTERYMINUTES=4146,e.CAP_BATTERYPERCENTAGE=4147,e.CAP_CAMERASIDE=4148,e.CAP_SEGMENTED=4149,e.CAP_CAMERAENABLED=4150,e.CAP_CAMERAORDER=4151,e.CAP_MICRENABLED=4152,e.CAP_FEEDERPREP=4153,e.CAP_FEEDERPOCKET=4154,e.CAP_AUTOMATICSENSEMEDIUM=4155,e.CAP_CUSTOMINTERFACEGUID=4156,e.ICAP_AUTOBRIGHT=4352,e.ICAP_BRIGHTNESS=4353,e.ICAP_CONTRAST=4355,e.ICAP_CUSTHALFTONE=4356,e.ICAP_EXPOSURETIME=4357,e.ICAP_FILTER=4358,e.ICAP_FLASHUSED=4359,e.ICAP_GAMMA=4360,e.ICAP_HALFTONES=4361,e.ICAP_HIGHLIGHT=4362,e.ICAP_IMAGEFILEFORMAT=4364,e.ICAP_LAMPSTATE=4365,e.ICAP_LIGHTSOURCE=4366,e.ICAP_ORIENTATION=4368,e.ICAP_PHYSICALWIDTH=4369,e.ICAP_PHYSICALHEIGHT=4370,e.ICAP_SHADOW=4371,e.ICAP_FRAMES=4372,e.ICAP_XNATIVERESOLUTION=4374,e.ICAP_YNATIVERESOLUTION=4375,e.ICAP_XRESOLUTION=4376,e.ICAP_YRESOLUTION=4377,e.ICAP_MAXFRAMES=4378,e.ICAP_TILES=4379,e.ICAP_BITORDER=4380,e.ICAP_CCITTKFACTOR=4381,e.ICAP_LIGHTPATH=4382,e.ICAP_PIXELFLAVOR=4383,e.ICAP_PLANARCHUNKY=4384,e.ICAP_ROTATION=4385,e.ICAP_SUPPORTEDSIZES=4386,e.ICAP_THRESHOLD=4387,e.ICAP_XSCALING=4388,e.ICAP_YSCALING=4389,e.ICAP_BITORDERCODES=4390,e.ICAP_PIXELFLAVORCODES=4391,e.ICAP_JPEGPIXELTYPE=4392,e.ICAP_TIMEFILL=4394,e.ICAP_BITDEPTH=4395,e.ICAP_BITDEPTHREDUCTION=4396,e.ICAP_UNDEFINEDIMAGESIZE=4397,e.ICAP_EXTIMAGEINFO=4399,e.ICAP_MINIMUMHEIGHT=4400,e.ICAP_MINIMUMWIDTH=4401,e.ICAP_AUTODISCARDBLANKPAGES=4404,e.ICAP_FLIPROTATION=4406,e.ICAP_BARCODEDETECTIONENABLED=4407,e.ICAP_SUPPORTEDBARCODETYPES=4408,e.ICAP_BARCODEMAXSEARCHPRIORITIES=4409,e.ICAP_BARCODESEARCHPRIORITIES=4410,e.ICAP_BARCODESEARCHMODE=4411,e.ICAP_BARCODEMAXRETRIES=4412,e.ICAP_BARCODETIMEOUT=4413,e.ICAP_ZOOMFACTOR=4414,e.ICAP_PATCHCODEDETECTIONENABLED=4415,e.ICAP_SUPPORTEDPATCHCODETYPES=4416,e.ICAP_PATCHCODEMAXSEARCHPRIORITIES=4417,e.ICAP_PATCHCODESEARCHPRIORITIES=4418,e.ICAP_PATCHCODESEARCHMODE=4419,e.ICAP_PATCHCODEMAXRETRIES=4420,e.ICAP_PATCHCODETIMEOUT=4421,e.ICAP_FLASHUSED2=4422,e.ICAP_IMAGEFILTER=4423,e.ICAP_NOISEFILTER=4424,e.ICAP_OVERSCAN=4425,e.ICAP_AUTOMATICBORDERDETECTION=4432,e.ICAP_AUTOMATICDESKEW=4433,e.ICAP_AUTOMATICROTATE=4434,e.ICAP_JPEGQUALITY=4435,e.ICAP_FEEDERTYPE=4436,e.ICAP_ICCPROFILE=4437,e.ICAP_AUTOSIZE=4438,e.ICAP_AUTOMATICCROPUSESFRAME=4439,e.ICAP_AUTOMATICLENGTHDETECTION=4440,e.ICAP_AUTOMATICCOLORENABLED=4441,e.ICAP_AUTOMATICCOLORNONCOLORPIXELTYPE=4442,e.ICAP_COLORMANAGEMENTENABLED=4443,e.ICAP_IMAGEMERGE=4444,e.ICAP_IMAGEMERGEHEIGHTTHRESHOLD=4445,e.ICAP_SUPPORTEDEXTIMAGEINFO=4446,e}({}),EH=function(e){return e.TWLG_DAN=0,e.TWLG_DUT=1,e.TWLG_ENG=2,e.TWLG_FCF=3,e.TWLG_FIN=4,e.TWLG_FRN=5,e.TWLG_GER=6,e.TWLG_ICE=7,e.TWLG_ITN=8,e.TWLG_NOR=9,e.TWLG_POR=10,e.TWLG_SPA=11,e.TWLG_SWE=12,e.TWLG_USA=13,e.TWLG_USERLOCALE=-1,e.TWLG_AFRIKAANS=14,e.TWLG_ALBANIA=15,e.TWLG_ARABIC=16,e.TWLG_ARABIC_ALGERIA=17,e.TWLG_ARABIC_BAHRAIN=18,e.TWLG_ARABIC_EGYPT=19,e.TWLG_ARABIC_IRAQ=20,e.TWLG_ARABIC_JORDAN=21,e.TWLG_ARABIC_KUWAIT=22,e.TWLG_ARABIC_LEBANON=23,e.TWLG_ARABIC_LIBYA=24,e.TWLG_ARABIC_MOROCCO=25,e.TWLG_ARABIC_OMAN=26,e.TWLG_ARABIC_QATAR=27,e.TWLG_ARABIC_SAUDIARABIA=28,e.TWLG_ARABIC_SYRIA=29,e.TWLG_ARABIC_TUNISIA=30,e.TWLG_ARABIC_UAE=31,e.TWLG_ARABIC_YEMEN=32,e.TWLG_BASQUE=33,e.TWLG_BYELORUSSIAN=34,e.TWLG_BULGARIAN=35,e.TWLG_CATALAN=36,e.TWLG_CHINESE=37,e.TWLG_CHINESE_HONGKONG=38,e.TWLG_CHINESE_PRC=39,e.TWLG_CHINESE_SINGAPORE=40,e.TWLG_CHINESE_SIMPLIFIED=41,e.TWLG_CHINESE_TAIWAN=42,e.TWLG_CHINESE_TRADITIONAL=43,e.TWLG_CROATIA=44,e.TWLG_CZECH=45,e.TWLG_DANISH=0,e.TWLG_DUTCH=1,e.TWLG_DUTCH_BELGIAN=46,e.TWLG_ENGLISH=2,e.TWLG_ENGLISH_AUSTRALIAN=47,e.TWLG_ENGLISH_CANADIAN=48,e.TWLG_ENGLISH_IRELAND=49,e.TWLG_ENGLISH_NEWZEALAND=50,e.TWLG_ENGLISH_SOUTHAFRICA=51,e.TWLG_ENGLISH_UK=52,e.TWLG_ENGLISH_USA=13,e.TWLG_ESTONIAN=53,e.TWLG_FAEROESE=54,e.TWLG_FARSI=55,e.TWLG_FINNISH=4,e.TWLG_FRENCH=5,e.TWLG_FRENCH_BELGIAN=56,e.TWLG_FRENCH_CANADIAN=3,e.TWLG_FRENCH_LUXEMBOURG=57,e.TWLG_FRENCH_SWISS=58,e.TWLG_GERMAN=6,e.TWLG_GERMAN_AUSTRIAN=59,e.TWLG_GERMAN_LUXEMBOURG=60,e.TWLG_GERMAN_LIECHTENSTEIN=61,e.TWLG_GERMAN_SWISS=62,e.TWLG_GREEK=63,e.TWLG_HEBREW=64,e.TWLG_HUNGARIAN=65,e.TWLG_ICELANDIC=7,e.TWLG_INDONESIAN=66,e.TWLG_ITALIAN=8,e.TWLG_ITALIAN_SWISS=67,e.TWLG_JAPANESE=68,e.TWLG_KOREAN=69,e.TWLG_KOREAN_JOHAB=70,e.TWLG_LATVIAN=71,e.TWLG_LITHUANIAN=72,e.TWLG_NORWEGIAN=9,e.TWLG_NORWEGIAN_BOKMAL=73,e.TWLG_NORWEGIAN_NYNORSK=74,e.TWLG_POLISH=75,e.TWLG_PORTUGUESE=10,e.TWLG_PORTUGUESE_BRAZIL=76,e.TWLG_ROMANIAN=77,e.TWLG_RUSSIAN=78,e.TWLG_SERBIAN_LATIN=79,e.TWLG_SLOVAK=80,e.TWLG_SLOVENIAN=81,e.TWLG_SPANISH=11,e.TWLG_SPANISH_MEXICAN=82,e.TWLG_SPANISH_MODERN=83,e.TWLG_SWEDISH=12,e.TWLG_THAI=84,e.TWLG_TURKISH=85,e.TWLG_UKRANIAN=86,e.TWLG_ASSAMESE=87,e.TWLG_BENGALI=88,e.TWLG_BIHARI=89,e.TWLG_BODO=90,e.TWLG_DOGRI=91,e.TWLG_GUJARATI=92,e.TWLG_HARYANVI=93,e.TWLG_HINDI=94,e.TWLG_KANNADA=95,e.TWLG_KASHMIRI=96,e.TWLG_MALAYALAM=97,e.TWLG_MARATHI=98,e.TWLG_MARWARI=99,e.TWLG_MEGHALAYAN=100,e.TWLG_MIZO=101,e.TWLG_NAGA=102,e.TWLG_ORISSI=103,e.TWLG_PUNJABI=104,e.TWLG_PUSHTU=105,e.TWLG_SERBIAN_CYRILLIC=106,e.TWLG_SIKKIMI=107,e.TWLG_SWEDISH_FINLAND=108,e.TWLG_TAMIL=109,e.TWLG_TELUGU=110,e.TWLG_TRIPURI=111,e.TWLG_URDU=112,e.TWLG_VIETNAMESE=113,e}({}),kH=function(e){return e.TWSS_NONE=0,e.TWSS_A4LETTER=1,e.TWSS_B5LETTER=2,e.TWSS_USLETTER=3,e.TWSS_USLEGAL=4,e.TWSS_A5=5,e.TWSS_B4=6,e.TWSS_B6=7,e.TWSS_USLEDGER=9,e.TWSS_USEXECUTIVE=10,e.TWSS_A3=11,e.TWSS_B3=12,e.TWSS_A6=13,e.TWSS_C4=14,e.TWSS_C5=15,e.TWSS_C6=16,e.TWSS_4A0=17,e.TWSS_2A0=18,e.TWSS_A0=19,e.TWSS_A1=20,e.TWSS_A2=21,e.TWSS_A4=1,e.TWSS_A7=22,e.TWSS_A8=23,e.TWSS_A9=24,e.TWSS_A10=25,e.TWSS_ISOB0=26,e.TWSS_ISOB1=27,e.TWSS_ISOB2=28,e.TWSS_ISOB3=12,e.TWSS_ISOB4=6,e.TWSS_ISOB5=29,e.TWSS_ISOB6=7,e.TWSS_ISOB7=30,e.TWSS_ISOB8=31,e.TWSS_ISOB9=32,e.TWSS_ISOB10=33,e.TWSS_JISB0=34,e.TWSS_JISB1=35,e.TWSS_JISB2=36,e.TWSS_JISB3=37,e.TWSS_JISB4=38,e.TWSS_JISB5=2,e.TWSS_JISB6=39,e.TWSS_JISB7=40,e.TWSS_JISB8=41,e.TWSS_JISB9=42,e.TWSS_JISB10=43,e.TWSS_C0=44,e.TWSS_C1=45,e.TWSS_C2=46,e.TWSS_C3=47,e.TWSS_C7=48,e.TWSS_C8=49,e.TWSS_C9=50,e.TWSS_C10=51,e.TWSS_USSTATEMENT=52,e.TWSS_BUSINESSCARD=53,e.TWSS_MAXSIZE=54,e}({}),AH=function(e){return e.TWON_NONE=0,e.TWON_ARRAY=3,e.TWON_ENUMERATION=4,e.TWON_ONEVALUE=5,e.TWON_RANGE=6,e}({}),xH=function(e){return e.TWTY_INT8=0,e.TWTY_INT16=1,e.TWTY_INT32=2,e.TWTY_UINT8=3,e.TWTY_UINT16=4,e.TWTY_int=5,e.TWTY_BOOL=6,e.TWTY_FIX32=7,e.TWTY_FRAME=8,e.TWTY_STR32=9,e.TWTY_STR64=10,e.TWTY_STR128=11,e.TWTY_STR255=12,e}({}),PH=function(e){return e.TWFA_NONE=0,e.TWFA_LEFT=1,e.TWFA_CENTER=2,e.TWFA_RIGHT=3,e}({}),DH=function(e){return e.TWFO_FIRSTPAGEFIRST=0,e.TWFO_LASTPAGEFIRST=1,e}({}),FH=function(e){return e.TWPR_IMPRINTERTOPBEFORE=0,e.TWPR_IMPRINTERTOPAFTER=1,e.TWPR_IMPRINTERBOTTOMBEFORE=2,e.TWPR_IMPRINTERBOTTOMAFTER=3,e.TWPR_ENDORSERTOPBEFORE=4,e.TWPR_ENDORSERTOPAFTER=5,e.TWPR_ENDORSERBOTTOMBEFORE=6,e.TWPR_ENDORSERBOTTOMAFTER=7,e}({}),WH=function(e){return e.TWPM_SINGLESTRING=0,e.TWPM_MULTISTRING=1,e.TWPM_COMPOUNDSTRING=2,e}({}),RH=function(e){return e.TWBR_THRESHOLD=0,e.TWBR_HALFTONE=1,e.TWBR_CUSTHALFTONE=2,e.TWBR_DIFFUSION=3,e}({}),NH=function(e){return e.TWBO_LSBFIRST=0,e.TWBO_MSBFIRST=1,e}({}),OH=function(e){return e.TWFT_RED=0,e.TWFT_GREEN=1,e.TWFT_BLUE=2,e.TWFT_NONE=3,e.TWFT_WHITE=4,e.TWFT_CYAN=5,e.TWFT_MAGENTA=6,e.TWFT_YELLOW=7,e.TWFT_BLACK=8,e}({}),MH=function(e){return e.TWFL_NONE=0,e.TWFL_OFF=1,e.TWFL_ON=2,e.TWFL_AUTO=3,e.TWFL_REDEYE=4,e}({}),LH=function(e){return e.TWFR_BOOK=0,e.TWFR_FANFOLD=1,e}({}),BH=function(e){return e.TWIF_NONE=0,e.TWIF_AUTO=1,e.TWIF_LOWPASS=2,e.TWIF_BANDPASS=3,e.TWIF_HIGHPASS=4,e.TWIF_TEXT=3,e.TWIF_FINELINE=4,e}({}),UH=function(e){return e.TWLP_REFLECTIVE=0,e.TWLP_TRANSMISSIVE=1,e}({}),VH=function(e){return e.TWLS_RED=0,e.TWLS_GREEN=1,e.TWLS_BLUE=2,e.TWLS_NONE=3,e.TWLS_WHITE=4,e.TWLS_UV=5,e.TWLS_IR=6,e}({}),jH=function(e){return e.TWNF_NONE=0,e.TWNF_AUTO=1,e.TWNF_LONEPIXEL=2,e.TWNF_MAJORITYRULE=3,e}({}),GH=function(e){return e.TWOR_ROT0=0,e.TWOR_ROT90=1,e.TWOR_ROT180=2,e.TWOR_ROT270=3,e.TWOR_PORTRAIT=0,e.TWOR_LANDSCAPE=3,e.TWOR_AUTO=4,e.TWOR_AUTOTEXT=5,e.TWOR_AUTOPICTURE=6,e}({}),HH=function(e){return e.TWOV_NONE=0,e.TWOV_AUTO=1,e.TWOV_TOPBOTTOM=2,e.TWOV_LEFTRIGHT=3,e.TWOV_ALL=4,e}({}),zH=function(e){return e.TWPF_CHOCOLATE=0,e.TWPF_VANILLA=1,e}({}),KH=function(e){return e.TWPC_CHUNKY=0,e.TWPC_PLANAR=1,e}({}),JH=function(e){return e.Info=1,e.Error=2,e.NotInstalledError=3,e}({}),QH=function(e){return e.Binary=0,e.Base64=1,e}({}),qH=function(e){return e.TWPT_BW=0,e.TWPT_GRAY=1,e.TWPT_RGB=2,e.TWPT_PALLETE=3,e.TWPT_CMY=4,e.TWPT_CMYK=5,e.TWPT_YUV=6,e.TWPT_YUVK=7,e.TWPT_CIEXYZ=8,e.TWPT_LAB=9,e.TWPT_SRGB=10,e.TWPT_SCRGB=11,e.TWPT_INFRARED=16,e}(qH||{}),YH=function(e){return e.TWUN_INCHES=0,e.TWUN_CENTIMETERS=1,e.TWUN_PICAS=2,e.TWUN_POINTS=3,e.TWUN_TWIPS=4,e.TWUN_PIXELS=5,e.TWUN_MILLIMETERS=6,e}(YH||{});Zt.mix(rr.DWT,{EnumDWT_DeviceType:Tl,EnumDWT_Cap:wH,EnumDWT_CapLanguage:EH,EnumDWT_CapSupportedSizes:kH,EnumDWT_CapType:AH,EnumDWT_CapValueType:xH,EnumDWT_CapFeederAlignment:PH,EnumDWT_CapFeederOrder:DH,EnumDWT_CapPrinter:FH,EnumDWT_CapPrinterMode:WH,EnumDWT_CapBitdepthReduction:RH,EnumDWT_CapBitOrder:NH,EnumDWT_CapFilterType:OH,EnumDWT_CapFlash:MH,EnumDWT_CapFlipRotation:LH,EnumDWT_CapImageFilter:BH,EnumDWT_CapLightPath:UH,EnumDWT_CapLightSource:VH,EnumDWT_CapNoiseFilter:jH,EnumDWT_CapORientation:GH,EnumDWT_CapOverscan:HH,EnumDWT_CapPixelFlavor:zH,EnumDWT_CapPlanarChunky:KH,EnumDWT_ImageType:Ad,EnumDWT_ImageFormatType:mG,EnumDWT_ResponseType:tG,EnumDWT_SourceMatchField:kd,EnumDWT_UploadDataFormat:QH,EnumDWT_WorkMode:XG,EnumDWT_ConvertMode:nc,EnumDWT_PixelType:qH,EnumDWT_UnitType:YH});var XH=rr.DWT;XH.EnumPDF_Page={Page_Default:0,Page_Custom:1,Page_A4:2,Page_A4_Reverse:3,Page_A3:4,Page_A3_Reverse:5,Page_Letter:6,Page_Letter_Reverse:7,Page_Legal:8,Page_Legal_Reverse:9},XH.EnumDWT_BorderStyle={TWBS_NONE:0,TWBS_SINGLEFLAT:1,TWBS_SINGLE3D:2},XH.EnumDWT_MessageType={TWQC_GET:1,TWQC_SET:2,TWQC_GETDEFAULT:4,TWQC_GETCURRENT:8,TWQC_RESET:16},XH.EnumDWT_TransferMode={TWSX_NATIVE:0,TWSX_FILE:1,TWSX_MEMORY:2},XH.EnumDWT_FileFormat={TWFF_TIFF:0,TWFF_PICT:1,TWFF_BMP:2,TWFF_XBM:3,TWFF_JFIF:4,TWFF_FPX:5,TWFF_TIFFMULTI:6,TWFF_PNG:7,TWFF_SPIFF:8,TWFF_EXIF:9,TWFF_PDF:10,TWFF_JP2:11,TWFF_JPN:12,TWFF_JPX:13,TWFF_DEJAVU:14,TWFF_PDFA:15,TWFF_PDFA2:16},XH.EnumDWT_TIFFCompressionType={TIFF_AUTO:0,TIFF_NONE:1,TIFF_RLE:2,TIFF_FAX3:3,TIFF_T4:3,TIFF_FAX4:4,TIFF_T6:4,TIFF_LZW:5,TIFF_JPEG:7,TIFF_PACKBITS:32773},XH.EnumDWT_InterpolationMethod={IM_NEARESTNEIGHBOUR:1,IM_BILINEAR:2,IM_BICUBIC:3,IM_BESTQUALITY:5},XH.EnumDWT_PDFCompressionType={PDF_AUTO:0,PDF_FAX3:1,PDF_FAX4:2,PDF_LZW:3,PDF_RLE:4,PDF_JPEG:5,PDF_JP2000:6,PDF_JBIG2:7},XH.EnumDWT_ShowMode={SW_ACTIVE:0,SW_MAX:1,SW_MIN:2,SW_CLOSE:3,SW_IFLIVE:4},XH.EnumDWT_DUPLEX={TWDX_NONE:0,TWDX_1PASSDUPLEX:1,TWDX_2PASSDUPLEX:2},XH.EnumDWT_MagType={TWMD_MICR:0,TWMD_RAW:1,TWMD_INVALID:2},XH.EnumDWT_DataSourceStatus={TWDSS_CLOSED:0,TWDSS_OPENED:1,TWDSS_ENABLED:2,TWDSS_ACQUIRING:3};var ZH=function(e){return e.enumFitWindow=0,e.enumFitWindowHeight=1,e.enumFitWindowWidth=2,e}(ZH||{});XH.EnumDWT_FitWindowType={enumFitWindow:ZH.enumFitWindow,enumFitWindowHeight:ZH.enumFitWindowHeight,enumFitWindowWidth:ZH.enumFitWindowWidth},XH.EnumDWT_PlatformType={enumUnknown:Lo.enumUnknown,enumWindow:Lo.enumWindow,enumMac:Lo.enumMac,enumLinux:Lo.enumLinux,enumEmbed:Lo.enumEmbed,enumChromeOS:Lo.enumChromeOS,enumHarmonyOS:Lo.enumHarmonyOS,enumAndroid:Lo.enumAndroid,enumiOS:Lo.enumiOS};var $H=function(e){return e.Default=0,e.Hand=1,e.Crosshair=2,e.Zoom=3,e.NWResize=4,e.EResize=5,e.NResize=6,e.Resize=7,e.Move=8,e}($H||{});XH.EnumDWT_MouseShape={Default:$H.Default,Hand:$H.Hand,Crosshair:$H.Crosshair,Zoom:$H.Zoom,NWResize:$H.NWResize,EResize:$H.EResize,NResize:$H.NResize,Resize:$H.Resize,Move:$H.Move},XH.EnumDWT_Language={English:0,French:1,Arabic:2,Spanish:3,Portuguese:4,German:5,Italian:6,Russian:7,Chinese:8},XH.EnumDWT_InitMsg={Info:JH.Info,Error:JH.Error,NotInstalledError:JH.NotInstalledError},XH.EnumDWT_Driver={TWAIN:pf.TWAIN,ICA:pf.ICA,SANE:pf.SANE,TWAIN_AND_ICA:pf.TWAIN_AND_ICA,TWAIN_AND_TWAIN64:pf.TWAIN_AND_TWAIN64,TWAIN64:pf.TWAIN64},XH.EnumDWT_CompressionType={TWCP_NONE:0,TWCP_PACKBITS:1,TWCP_GROUP31D:2,TWCP_GROUP31DEOL:3,TWCP_GROUP32D:4,TWCP_GROUP4:5,TWCP_JPEG:6,TWCP_LZW:7,TWCP_JBIG:8,TWCP_PNG:9,TWCP_RLE4:10,TWCP_RLE8:11,TWCP_BITFIELDS:12,TWCP_ZIP:13,TWCP_JPEG2000:14};var ez=function(e){return e.Single=0,e.Multiple=1,e}(ez||{});XH.EnumDWT_SelectionMode={Single:ez.Single,Multiple:ez.Multiple},XH.EnumDWT_ConfirmExitType={Cancel:0,Exit:1,SaveAndExit:2},XH.EnumDWT_WebsocketReadyState={CONNECTING:gd.CONNECTING,OPEN:gd.OPEN,CLOSING:gd.CLOSING,CLOSED:gd.CLOSED};var tz=function(e){return e.TwainService=1,e}(tz||{});XH.EnumDWT_ServiceType={TwainService:tz.TwainService};var rz,nz=function(e){return e["default"]=0,e.standard=1,e.supported=2,e}(nz||{});XH.EnumDWT_ExtImageInfo={"default":nz["default"],standard:nz.standard,supported:nz.supported};var iz=20230506,oz=function(){if(rr.dcp){var e=rr.dcp.dcpJSVer;if(Zt.isNumber(e))return e>=iz}return!1};if(oz())oz=rz,iz=rz;else{var az=na.detect,sz={_checkService:function(e,t){az.dcpStatus=az.EnumDCP_DetectStatus.CheckingServiceVer,uz(null,"DSVersion").then(e,t)},_checkUpdateFile:function(e,t){uz(null,"CheckUpdateFile").then(e,t)},_updateService:function(e,t){uz(null,"UpdateService").then(e,t)},_getDSUpdateZipUrl:function(){var e,t,r="";return e="Win",de.bMac?e="Mac":de.bLinux&&(e="Linux"),t=de.bFileSystem?"":"?t="+Zt.now(),de.bWin&&na.b64bit&&(r="_x64"),[Oo(),"/dist/serviceupdate/",e,"DSUpdate_",lo().join("."),r,".zip",t].join("")},getPorts:function(e,t){var r="GetPorts",n="dwasm2_"+go();return cz(e,r,{id:Zt.guid(),method:r,version:n,parameter:[t]},aa())},_getStatusString:function(e,t){var r,n,i="";return e==az.EnumDCP_DetectStatus.Init?"Getting manager version":e==az.EnumDCP_DetectStatus.Connected?(t&&(i=t),"Getting manager version succeeded and the version is "+i):e==az.EnumDCP_DetectStatus.CheckingManagerVer?"Getting manager version":e==az.EnumDCP_DetectStatus.CheckingServiceVer?"Getting service version":e==az.EnumDCP_DetectStatus.NotInstalled?"Dynamsoft Service Not Installed":e==az.EnumDCP_DetectStatus.UpdateSkipped?"Update skipped":e==az.EnumDCP_DetectStatus.CheckedService?(t&&(i=t),"Getting service version succeeded and the version is "+i):e==az.EnumDCP_DetectStatus.VerifyingZip?"Verifying the update package":e==az.EnumDCP_DetectStatus.VerifiedZip?"Update package verified":e==az.EnumDCP_DetectStatus.UpdatingService?"Updating the service":e==az.EnumDCP_DetectStatus.UpdateSucceed?"Update succeeded":e==az.EnumDCP_DetectStatus.UpdateFailed?(n=".",t&&t.length>0?("."==t.slice(t.length-1)&&(n=""),r=" with the error: "+t):r="","The update failed"+r+n):""},_sendStatusEvent:function(e,t){var r=!!e,n=window;Zt.isFunction(n.OnGetServiceUpdateStatus)&&n.OnGetServiceUpdateStatus(r,az.dcpStatus,sz._getStatusString(az.dcpStatus,t))},_getErr:function(e){var t,r="";try{Zt.isString(e)?(t=e.replace(/\0/g,""),t=Zt.parse(t)):e&&(t=e),"description"in t&&(r=t.description)}catch(n){}return r},_funShowUpgradeDialogWhenUpdateFailed:function(e,t){return az.bConnected=!0,az.dcpStatus=az.EnumDCP_DetectStatus.UpdateFailed,e&&e(),t&&t(),sz._sendStatusEvent(!0),!0},_funUpdateFailed:function(e,t,r,n){var i,o;return az.bConnected=!0,az.dcpStatus=az.EnumDCP_DetectStatus.UpdateFailed,e&&e(),200==n?(i="The update failed.",o=sz._getStatusString(az.dcpStatus,sz._getErr(r))):o=i="The update failed. The error code is "+n,t&&t(!0,i),sz._sendStatusEvent(!0,o),!0},getDSPath:function(e,t){return Uo.getDSPath(t)},getLinuxHTML5DebPath:function(){return Uo.getDSPath(".deb")},getLinuxHTML5RpmPath:function(){return Uo.getDSPath(".rpm")},getBinaryFileInfo:function(e,t){var r="GetBinaryFileInfo",n={id:Zt.guid(),method:r,version:"dwasm2_"+go(),parameter:[]},i=Zt.stringify(n),o=function(r,n,i){var o;r&&(o=Zt.parse(r)),o?e(o):t(r,n,i)};if(rr.DWT.ConnectWithSocket&&de.bHTML5Edition){var a=_d.getWsUrl(rr.DWT.Host,de.bSSL?na.SSLPort:na.Port);return _d.postStringDataByWSUrl(a,i).then(o,t),!0}var s=[ho(),"/",r,"?type=1&dsver=",fo().join(""),"&ts=",Zt.now()].join("");ju.getHttpClientForDcp().request(i,s,{},500).then(o,t)}};Zt.mix(na,sz),rr.dcp=na,rr.dcp.dcpJSVer=iz,oz=rz,iz=rz}function uz(e,t,r,n){var i;return i={id:Zt.guid(),method:t,version:"dwasm2_"+go(),parameter:[]},"VersionInfo"==t&&(i.version="dwasm2_"+oa.getVersionStrForCheck()),Wc.isLongKey(r)&&(i.productKey=r),cz(e,t,i,aa(),n)}function cz(e,t,r,n,i){return lz.apply(this,arguments)}function lz(){return lz=n(g().mark((function e(t,r,n,i,o){var a,s,u,c,l,d,f,h,m;return g().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return a=Zt.stringify(n),na.detect.bConnected=!1,s=[ho(),"/",r,"?type=1&dsver=",fo().join(""),"&ts=",Zt.now()].join(""),c=de.bSSL,l=c?na.SSLPort:na.Port,u=ju.getHttpClient(t,l,c),d={},o&&!de.bSSL&&(d.redirect="manual"),e.prev=8,e.next=11,u.request(a,s,d,i);case 11:f=e.sent,e.next=21;break;case 14:if(e.prev=14,e.t0=e["catch"](8),!o||de.bSSL){e.next=20;break}if((e.t0&&e.t0.code)!=_a.HTTPRedirected){e.next=20;break}throw Ps();case 20:throw e.t0;case 21:if(f&&(h=Zt.parse(f)),!(h&&"exception"in h&&"description"in h)){e.next=24;break}throw{code:h.exception,message:h.description};case 24:if(!h||!("result"in h)){e.next=30;break}if(!na.detect.bConnected){e.next=27;break}return e.abrupt("return",h.result);case 27:return na.detect.bConnected=!0,na.detect.dcpStatus=na.detect.EnumDCP_DetectStatus.Connected,e.abrupt("return",h.result);case 30:throw Cs(m={}),$s(m);case 33:case"end":return e.stop()}}),e,null,[[8,14]])}))),lz.apply(this,arguments)}function dz(e){var t=Date.parse(e+"T00:00:00");return""!=e&&!isNaN(t)&&(!!rr.DWT.CheckCertExpired&&(new Date).getTime()>=t-864e5*rr.DWT.CertificateConfig.UpdateDaysBeforeExpired)}rr.DWT.__innerCheckCertDate=function(e){dz(e)&&(Zt.isFunction(rr.OnCertExpired)&&rr.OnCertExpired(e),setTimeout((function(){rr.DWT.UpdateCert(rr.DWT.CertificateConfig.URL,rr.OnUpdateCertSuccess,rr.OnUpdateCertFailure)}),5e3))},rr.DWT.__innerUpdateCert=function(e,t,r,n){var i=[ho(),"/LoadZipFromBytes?type=",4,"&dsver=",fo().join(""),"&ts=",Zt.now()].join("");ju.getHttpClientForDcp(null,t).request(e,i,{},3e4).then(r,(function(e){Zt.isFunction(n)&&n(e)}))},rr.DWT.__innerReboot=function(e,t){var r=[ho(),"/admin?ts=",Zt.now()].join(""),n='{"id":"'+(new Date).getTime().toString()+'","method":"Reboot","parameter":[],"version":"dwasm2_'+go()+'"}';ju.getHttpClientForDcp().request(n,r,{},3e4).then(e,t)},rr.DWT.UpdateCert=function(e,t,r){Zt.isString(e)&&""!=e?Hs(e,{mode:"cors",dataType:"arraybuffer"}).then((function(e){rr.DWT.__innerUpdateCert(e,!1,(function(e){var n;try{var i=Qt.parse(e);i.description&&(n={code:i.exception,message:i.description})}catch(a){var o;Cs(o={}),o=$s(o)}n?Qt.isFunction(r)&&r(n):(rr.DWT.CheckCertExpired=!1,Zt.isFunction(t)&&t())}),(function(n){de.bSSL?rr.DWT.__innerUpdateCert(e,!0,t,r):Zt.isFunction(r)&&r(n)}))}),r):Zt.isFunction(r)&&r()};var fz={Errors:{FilePathSyntaxIncorrect:function(e){e._errorCode=-3123,e._errorString="The filename, directory name, or volume label syntax is incorrect."}},checkFilePath:function(e,t){return Zt.isString(t)&&0!=t.length?Zt.startsWith(t,"http://")||Zt.startsWith(t,"https://")||Zt.startsWith(t,"ftp://")?(Qt.File.Errors.FilePathSyntaxIncorrect(e),di):fi:(Ma(e),di)}};fz.checkFolder=fz.checkFilePath,Qt.File=fz,Qt.showProgress=function(){},Qt.closeProgress=function(){};var hz,gz=document.location.protocol,mz=location.hostname,pz=de.bSSL,vz={detect:{ssl:pz,dcpStatus:0,dcpCallbackType:0,arySTwains:[],bFirst:fi,bOK:di,__dialog:di,cssLoaded:di,viewerScriptLoaded:di,bNoControlEvent:di,bNeedUpgradeEvent:di,bPromptJSOrServerOutdated:di,detectType:pz?1:"http:"===gz||""===mz?0:-1,tryTimes:0,ports:[{port:rr.DWT.SSLPort,ssl:fi},{port:rr.DWT.Port,ssl:di}],cUrlIndex:0,urls:[],onNoControl:di,needUpgrade:di,OnDetectNext:di,OnCreatWS:di,bMaskShow:di},page:{bUnload:di}};function _z(){var e=Xo;if(rr.DWT.CertificateConfig){var t=rr.DWT.CertificateConfig;Zt.isString(t.URL)||(t.URL=e.URL),(!Zt.isNumber(t.UpdateDaysBeforeExpired)||t.UpdateDaysBeforeExpired<=0)&&(t.UpdateDaysBeforeExpired=e.UpdateDaysBeforeExpired)}else rr.DWT.CertificateConfig=e;nH(),Zt.isString(rr.DWT.ProductKey)&&(rr.DWT.ProductKey=Zt.trim(rr.DWT.ProductKey)),rr.navInfo&&(de.bMac||de.bWin)&&(rr.navInfo.bEmbed=!1,rr.navInfo.bArm64=!1,rr.navInfo.bMips64=!1),rr.DWT.Debug&&(Zt.debug=!0)}function yz(){return yz=n(g().mark((function e(){var t,r,n;return g().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(!Qt.detect.cssLoaded){e.next=2;break}return e.abrupt("return");case 2:if(rr.DWT.IfLoadResources){e.next=5;break}return Qt.detect.cssLoaded=fi,e.abrupt("return");case 5:return t=Oo(),r="",!de.bFileSystem&&rr.DWT.IfResourcesAddTimestamp&&(r=Qt.timestamp),n=[[t,"/src/dynamsoft.webtwain.css",r].join("")],ia.bHTML5Edition&&rr.DWT.UseDefaultViewer&&n.push([t,"/src/dynamsoft.webtwain.viewer.css",r].join("")),Qt.detect.cssLoaded=fi,e.prev=10,e.next=13,new Qt.Promise((function(e,t){if(de.bSafari){var r=!1;if(Zt.addAllCss(n,!1,(function(e){e||(r=!0)})),r)t({code:-2804,message:"Loading the WebTwain css files failed."});else e()}else Zt.addAllCss(n,!1,(function(r){r?e():t({code:-2804,message:"Loading the WebTwain css files failed."})}))}));case 13:if(!ia.bHTML5Edition||de.bFileSystem||!rr.DWT.IfCheckCssFiles){e.next=16;break}return e.next=16,Sz(n);case 16:e.next=21;break;case 18:e.prev=18,e.t0=e["catch"](10),sd(e.t0);case 21:case"end":return e.stop()}}),e,null,[[10,18]])}))),yz.apply(this,arguments)}function Sz(e){return Iz.apply(this,arguments)}function Iz(){return(Iz=n(g().mark((function e(t){var r,n;return g().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:r=!0,e.prev=1,n=0,n=0;case 4:if(!(n<t.length)){e.next=15;break}return e.next=7,Qt.fetch(t[n]);case 7:if(!(e.sent.indexOf("* Author: Dynamsoft Support Team")>0)){e.next=10;break}return e.abrupt("continue",12);case 10:return r=!1,e.abrupt("break",15);case 12:n++,e.next=4;break;case 15:e.next=20;break;case 17:e.prev=17,e.t0=e["catch"](1),r=!1;case 20:if(r){e.next=22;break}throw{code:-2804,message:"Loading the WebTwain css files failed."};case 22:return e.abrupt("return",r);case 23:case"end":return e.stop()}}),e,null,[[1,17]])})))).apply(this,arguments)}function bz(){if(ia.loadResourcePath||!ia.loadingResourcePath)return hz&&hz(),void(hz=null);setTimeout(bz,100)}function Tz(e){if(Xu("Loading css..."),_z(),ia.loadResourcePath||ia.loadingResourcePath)return ia.loadResourcePath||!ia.loadingResourcePath?Qt.Promise.resolve():(hz=null,new Qt.Promise((function(e){hz=e,setTimeout(bz,100)})));ia.loadingResourcePath=!0,(rr.DWT.Port>0||rr.DWT.SSLPort>0)&&(Qt.detect.ports=[{port:rr.DWT.Port,ssl:!1},{port:rr.DWT.SSLPort,ssl:!0}],Dd.removeItem("DWT_port"),Dd.removeItem("DWT_ssl")),Zt.each(Qt._funsAfterConfigLoaded,(function(e){try{Zt.isFunction(e)&&e()}catch(t){}}));var t=Zt.sizzle(".dynamsoft_waiting");if(t&&t.length>0){var r=t[0];r.parentNode&&r.parentNode.removeChild(r)}var n=Oo(),i="";!de.bFileSystem&&rr.DWT.IfResourcesAddTimestamp&&(i=Qt.timestamp);var o=fi,a=[];return de.bSafari&&(o=di),a.push([n,"/dynamsoft.webtwain.install.js",i].join("")),rr.DWT.bNpm&&(a=[]),ia.bHTML5Edition&&rr.DWT.UseDefaultViewer&&(Xu("Loading the viewer script..."),a.push([n,"/src/dynamsoft.webtwain.viewer.js",i].join(""))),rr.DWT.IfLoadResources||(a=[]),function(){yz.apply(this,arguments)}(),0==a.length?(Cz(),ia.loadResourcePath=!0,void(ia.loadingResourcePath=!1)):new Qt.Promise((function(e,t){Zt.addScripts(a,o,!1,(function(r){var n=r;if(ia.bHTML5Edition&&rr.DWT.UseDefaultViewer&&!Zt.isFunction(rr.DWTViewer)&&(n=!1),de.bIE&&ia.bActiveXEdition&&(Zt.isFunction(rr.DWT._innerLoad)||(n=!1)),!n)return ia.loadingResourcePath=!1,void t({code:-2803,message:"Loading the WebTwain JavaScript source files failed."});Cz(),ia.loadResourcePath=!0,ia.loadingResourcePath=!1,rr.DWT.OnWebTwainWillInit&&rr.DWT.OnWebTwainWillInit(),e()}))}))}function Cz(){if(Qt.bNode||de.bJSDom);else if(Zt.isArray(rr.aryAddonReadyFun)){for(var e=0,t=function(){var t=rr.aryAddonReadyFun[e];if(Zt.isFunction(t))try{t(Qt)}catch(Mj){Zt.log(Mj.stack||Mj,"error"),setTimeout((function(){throw Mj}),0)}};e<rr.aryAddonReadyFun.length;e++)t();rr.aryAddonReadyFun=[]}}Zt.mix(Qt,vz),Qt.Addon_Events=[],Qt.Addon_Sendback_Events=[];var wz=[],Ez=[];function kz(){var e,t=wz.length;for(e=0;e<t;e++)wz[e]();wz.splice(0),Ez.splice(0),Dz=0}function Az(){if(Dz>0&&(new Date).getTime()-Dz>Pz){var e,t={code:-2802,message:"The file dynamsoft.webtwain.config.js timed out while loading."},r=rr.DWT.Containers;r&&0!==r.length||(Ss(e={}),t={code:e._errorCode,message:e._errorString}),function(e){var t,r=Ez.length;for(t=0;t<r;t++)Ez[t](e);wz.splice(0),Ez.splice(0),Dz=0}(t)}else if(rr.DWT.Containers||rr.DWT.ProductKey||rr.DWT.licenseServer||rr.DWT.organizationID||rr.DWT.handshakeCode||rr.DWT.bNpm||0==rr.DWT.AutoLoad){if(ia.dwtConfigLoading)return;if(ia.dwtConfigLoaded)return void kz();ia.dwtConfigLoading=!0;var n=Oo();if(Zt.isArray(rr.DWT.Containers)||(rr.DWT.Containers=[]),de.bIE){var i=de.IEVersion;if((""===i||i>=10)&&rr.DWT.IfUseActiveXForIE10Plus){var o=di;de.bHTML5Edition=o,ia.bHTML5Edition=o,ia.bActiveXEdition=!0,ia.bChromeEdition=ia.bHTML5Edition}}if(ia.bActiveXEdition&&rr.DWT.IfLoadResources){var a="";!de.bFileSystem&&rr.DWT.IfResourcesAddTimestamp&&(a=Qt.timestamp),Zt.addScript([n,"/src/dynamsoft.webtwain.activex.js",a].join(""),!0,!1,(function(){ia.dwtConfigLoaded=!0,ia.dwtConfigLoading=!1,kz()}))}else ia.dwtConfigLoaded=!0,ia.dwtConfigLoading=!1,kz()}else setTimeout(Az,100)}var xz,Pz=3e3,Dz=0;function Fz(e){return Xu("Loading the config script..."),ia.dwtConfigLoaded?Qt.Promise.resolve():(e&&(Pz=1e3*parseInt(e))<1&&(Pz=1),new Qt.Promise((function(e,t){wz.push(e),Ez.push(t),bH((function(){Dz=(new Date).getTime(),setTimeout(Az,100)}))})))}function Wz(){var e;(e=rr.DWT.WebTwainIdMap)&&Zt.each(e,(function(e,t){e&&e._OnPageBlur&&e._OnPageBlur()}))}if(ia.bActiveXEdition){var Rz=function(){var e,t,r,n,i;if(rr.DWT.lunload(),Qt.closeAll&&Qt.closeAll(),n=rr.DWT.ContainerMap)for(i=Object.keys(n),e=0;e<i.length;e++)(r=i[e])&&r in n&&(t=n[r])&&(t.__unload(),delete n[r]);if(n=rr.DWT.WebTwainIdMap)for(i=Object.keys(n),e=0;e<i.length;e++)(r=i[e])&&r in n&&(t=n[r])&&(t.__unload(),delete n[r]);for(e=0;e<Qt.product.unloadQueue.length;e++){var o=Qt.product.unloadQueue[e];Qt.isFunction(o)&&o()}return Qt.product.unloadQueue.splice(0),Qt.detect.arySTwains.splice(0),Qt.Promise.resolve()},Nz=!1;rr.DWT.Unload=function(){Rz();try{rr.DWT.CloseDialog(),Qt._zdgb_xkz_dhk(),Qt.closeProgress(null,""),Qt.hideMask()}catch(PJ){}},rr.DWT.Load=function(){if(!Qt.product.bDWTLoading)return Qt.product.bDWTLoading=true,Qt.detect.axAutoLoadDone=!1,Fz().then(Tz).then(Rz).then((function(){return rr.DWT._innerLoad()})).then((function(){Qt.product.bDWTLoading=!1,Qt.detect.axAutoLoadDone=!0}),(function(e){Qt.product.bDWTLoading=!1,Qt.detect.axAutoLoadDone=!1,ad(e)}))},rr.DWT.ConnectToTheService=rr.DWT.Load,rr.DWT.CheckConnectToTheService=function(e,t,r,n){Qt.product.bActiveXEdition?Qt.isFunction(n)&&n():Qt.isFunction(r)&&r()},rr.DWT.CreateDWTObject=function(e,t,r,n,i,o){return Qt._safePromptCustomMsg((function(){o&&o(Gi)})),Nz},rr.DWT.CreateDWTObjectEx=function(e,t,r){return Qt._safePromptCustomMsg((function(){r&&r(Gi)})),Nz},rr.DWT.CreateRemoteScanObjectAsync=function(){var e={};return ha(e,-2433,"The ActiveX edition does not support this method or property."),Qt.Promise.reject({code:e._errorCode,message:e._errorString})},rr.DWT.DeleteDWTObject=function(e){return Nz}}function Oz(){return!(function(e){if(Zt.isString(e)){if("localhost"==e||"127.0.0.1"==e)return!0;var t=e.split(".");if(4==t.length&&/^(([1-9]?\d|1\d{2}|2[0-4]\d|25[0-5])\.){3}([1-9]?\d|1\d{2}|2[0-4]\d|25[0-5])$/.test(e)){var r=parseInt(t[0]),n=parseInt(t[1]);if(127==r||10==r||169==r&&254==n||172==r&&n>=16&&n<=31||192==r&&168==n)return!0}}return!1}(location.hostname)||de.bSSL||de.bFileSystem||!((de.bChrome||de.bEdge)&&parseInt(de.strBrowserVersion)>=94))}function Mz(e,t,r,n){return Lz.apply(this,arguments)}function Lz(){return Lz=n(g().mark((function e(t,r,n,i){var o,a;return g().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(r!=ru.GET_TASKID){e.next=4;break}return e.abrupt("return",i.taskId);case 4:if(r!=ru.ONMESSAGE_PROCESS_DATA){e.next=8;break}return e.abrupt("return",Zt.parse(t));case 8:if(r!=ru.ONMESSAGE_GET_TASKID){e.next=13;break}if(!i||!i.client){e.next=11;break}return e.abrupt("return",i.client.getRequestTaskId());case 11:e.next=20;break;case 13:if(r!=ru.HANDLE_RAW_MESSAGE){e.next=20;break}if(o=null==i?void 0:i.userData){e.next=17;break}return e.abrupt("return",!1);case 17:return(a=t).indexOf("Version not found")>=0||a.indexOf("Function not found")>=0?Zt.isFunction(o.fFun)&&o.fFun():Zt.isFunction(o.sFun)&&o.sFun(a),e.abrupt("return",a);case 20:case"end":return e.stop()}}),e)}))),Lz.apply(this,arguments)}function Bz(){ia.loadResourcePath?(Xu(Zu),xz()):setTimeout(Bz,100)}function Uz(){return ia.loadResourcePath?(Xu(Zu),Qt.Promise.resolve()):new Qt.Promise((function(e,t){xz=e,setTimeout(Bz,100)}))}function Vz(e){var t,r,n=e.WebTwainId,i=e.Host,o=e.Port,a=e.SSLPort;return r={},Zt.isString(n)&&""!==n?r.id=n:r.id=n=Dl(),Zt.isDOM(e.Container)?(t=e.Container,Zt.isString(t.id)&&""!==t.id||(t.id=["dwt_node_",Zt.getRandom()].join("")),r.container=t,r.bNoViewer=!1):r.bNoViewer=!0,r.bNoViewer?(r.width=0,r.height=0):(Zt.isUndefined(e.Width)?t.style.width?r.width=t.style.width:r.width=300:r.width=e.Width,Zt.isUndefined(e.Height)?t.style.height?r.height=t.style.height:r.height=300:r.height=e.Height),r.dmService=e.dmService,Zt.isString(i)&&""!=i||(i=qo()),r.host=i,o||(o=rr.DWT.Port),r.port=o,a||(a=rr.DWT.SSLPort),r.sslPort=a,r}function jz(e,t,r){if(e){var n=null!=t?t:270,i=null!=r?r:350;n<=0&&(n=270),i<=0&&(i=350),ci.one(e).before(Qt.install._strNonInstallDIV);var o=Zt.get(Qt.install._divDWTNonInstallContainerID);o&&(o.style.width=n,o.style.height=i),Zt.show(Qt.install._divDWTNonInstallContainerID)}}function Gz(e){var t=Uo.getDSPath();if(""!=Qt.install._divDWTemessageContainer&&Zt.hide(Qt.install._divDWTemessageContainer),de.bMac)e?Zt.isFunction(rr.OnWebTwainNeedUpgradeCallback)&&rr.OnWebTwainNeedUpgradeCallback(ia.name,{"default":t},ia.bHTML5Edition,Lo.enumMac,de.bIE,de.bSafari,Qt.detect.ssl,ko.strIEVersion):Zt.isFunction(rr.OnWebTwainNotFoundOnMacCallback)&&rr.OnWebTwainNotFoundOnMacCallback(ia.name,t,ia.bHTML5Edition,de.bIE,de.bSafari,Qt.detect.ssl,ko.strIEVersion);else if(de.bLinux||rr.navInfo.bEmbed||de.bChromeOS||ko.bMobile){var r,n,i=Uo.getEnumPlatform();if(rr.navInfo.bEmbed||de.bAndroid||de.bChromeOS||de.bHarmonyOS?r=t:(r=Uo.getLinuxHTML5DebPath(),n=Uo.getLinuxHTML5RpmPath()),e){if(de.bAndroid)Zt.isFunction(rr.OnWebTwainNeedUpgradeOnAndroidCallback)&&rr.OnWebTwainNeedUpgradeOnAndroidCallback(ia.name,t,Qt.detect.ssl);else if(Zt.isFunction(rr.OnWebTwainNeedUpgradeCallback)){var o={"default":r};de.bLinux&&(o.deb=r,o.rpm=n),rr.OnWebTwainNeedUpgradeCallback(ia.name,o,ia.bHTML5Edition,i,de.bIE,de.bSafari,Qt.detect.ssl,ko.strIEVersion)}}else de.bAndroid?Zt.isFunction(rr.OnWebTwainNotFoundOnAndroidCallback)&&rr.OnWebTwainNotFoundOnAndroidCallback(ia.name,t,Qt.detect.ssl,!1):!oa.bFullEdition&&ko.bMobile?Zt.isFunction(rr.OnMobileNotSupportCallback)&&rr.OnMobileNotSupportCallback():Zt.isFunction(rr.OnWebTwainNotFoundOnLinuxCallback)&&rr.OnWebTwainNotFoundOnLinuxCallback(ia.name,r,n,ia.bHTML5Edition,de.bIE,de.bSafari,Qt.detect.ssl,ko.strIEVersion,i)}else if(de.bChrome||de.bSafari||de.bFirefox||de.bOpera||rr.DWT.IfUseActiveXForIE10Plus==ae||!rr.DWT.ActiveXInstallWithCAB&&de.bIE)if(e){if(Zt.isFunction(rr.OnWebTwainNeedUpgradeCallback)){var a={"default":t};rr.OnWebTwainNeedUpgradeCallback(ia.name,a,ia.bHTML5Edition,Lo.enumWindow,de.bIE,de.bSafari,Qt.detect.ssl,ko.strIEVersion)}}else Zt.isFunction(rr.OnWebTwainNotFoundOnWindowsCallback)&&rr.OnWebTwainNotFoundOnWindowsCallback(ia.name,t,ia.bHTML5Edition,de.bIE,de.bSafari,Qt.detect.ssl,ko.strIEVersion)}rr.DWT.GetWebTwain=rr.DWT.GetWebTwainEx=function(e){var t=e,r=rr.DWT.WebTwainIdMap;if(!t){var n=Object.keys(r);return n.length>0?r[t=n[0]]:void 0}if(t in r)return r[t];var i=rr.DWT.ContainerMap;return t in i?i[t]:void 0},rr.DWT.NeedCheckWebTwainBySocket=Oz,rr.DWT.CheckWebTwainBySocket=function(e,t,r){var n,i,o,a=Qt.detect.urls;if(a&&a.length>0){var s=a[0];n=s.host||qo(),i=s.port,o=s.ssl}else ca(n=qo())?(o=!(!de.bSSL||!de.bSafari),n=oa.hostForCheckCert):o=de.bSSL,i=o?rr.DWT.SSLPort:rr.DWT.Port;!function(e,t,r,n){var i,o=Zt.now(),a=Zt.guid(),s={id:a,method:"VersionInfo",version:[ia.getDWTPrefix(),oa.getVersionStrForCheck()].join("")},u=Mz,c={cmdId:a,cmd:null,sFun:t,fFun:r,rawData:!0},l=sa();i={client:e,userData:c,taskId:o},e.setRetry(0),e.request(Zt.stringify(s),u,i,l).then((function(t){return e.dispose(),t}),(function(){Zt.isFunction(n)&&n(),e.dispose()}))}(ju.getWsClient(n,i,o,!0),e,t,r)},rr.DWT.IsLocalServiceConnected=function(){return new Qt.Promise((function(e,t){var r,n=qo();Zt.each(Qt.detect.ports,(function(e){de.bSSL?e.ssl&&(r=e.port):e.ssl||(r=e.port)})),rr.DWT.CheckConnectToTheService(n,r,(function(t,r,n){e(!0)}),(function(){t(!1)}))}))},Qt.detect.onNoControl=function(e,t,r,n){n&&n._bRemoteMode&&!n._bNotShowMessage?Zt.isFunction(rr.OnRemoteWebTwainNotFoundCallback)&&rr.OnRemoteWebTwainNotFoundCallback(ia.name,n._serverInfo.server,n._serverInfo.port,n._serverInfo.ssl,ko.bMobile):(jz(e,t,r),Gz(!1))};var Hz=!1;function zz(e,t){ca(e)&&(Dd.item("DWT_port",t),Dd.item("DWT_ssl",de.bSSL?"true":"false"))}function Kz(e,t,r,n,i){return Jz.apply(this,arguments)}function Jz(){return(Jz=n(g().mark((function e(t,r,n,i,o){var a,s,u,c,l,d,f,h,m,p,v,_,y,S,I,b,T,C,w,E,k,A,x,P,D,F;return g().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(rr.DWT.OnWebTwainInitMessage&&rr.DWT.OnWebTwainInitMessage("Checking WebTwain version ...",JH.Info),s=!1,u=!1,c=!1,l=rr.DWT.ConnectWithSocket,o&&(o.bRemoteServer&&(c=!0),o.bConnectWithSocket&&(l=!0),o.bCheckCert&&(u=!0)),d=Zt.now(),f=['{"id":"',Zt.guid(),'","method":"VersionInfo","version":"',ia.getDWTPrefix(),oa.getVersionStrForCheck(),'"}'].join(""),h=!l&&!de.bSSL,e.prev=6,!l){e.next=18;break}return p=Zt.now(),v=Mz,_={client:m,userData:{cmdId:p,cmd:null,sFun:null,fFun:null,rawData:!0},taskId:p},(m=ju.getWsClient(t,r,n)).setRetry(0),e.next=14,m.request(f,v,_,i);case 14:a=e.sent,s=!0,e.next=25;break;case 18:return y="fa/VersionInfo?v=1&ts="+d,S=ju.getHttpClient(t,r,n),I={},h&&(I.redirect="manual"),e.next=24,S.request(f,y,I,i);case 24:a=e.sent;case 25:e.next=42;break;case 27:if(e.prev=27,e.t0=e["catch"](6),Zt.log(["check DWT Version failed",Zt.stringify(e.t0)]),!s){e.next=34;break}e.next=42;break;case 34:if(!h){e.next=38;break}if((e.t0&&e.t0.code)!=_a.HTTPRedirected){e.next=38;break}throw Ps();case 38:throw Ts(b={}),rr.DWT.OnWebTwainInitMessage&&rr.DWT.OnWebTwainInitMessage(b._errorString,JH.Error),{code:b._errorCode,message:b._errorString};case 42:if(T="",C="",w={},E=!1,a&&(k=Zt.parse(a)),!k||!("exception"in k)){e.next=49;break}eu(k)?(w._errorCode=k.exception,w._errorString=k.description):w._errorCode=_a.CommonError,e.next=91;break;case 49:if(!k||!("result"in k)){e.next=90;break}if(k=k.result,!(Zt.isArray(k)&&k.length>0)){e.next=87;break}if(A=k[0],T=k.length>1?k[1]:"",x=k.length>2?k[2]:0,P=k.length>3?k[3]:"",C=k.length>4?k[4]:"",""!==T){e.next=84;break}if(D="The WebTwain version is: "+A,rr.DWT.OnWebTwainInitMessage&&rr.DWT.OnWebTwainInitMessage(D,JH.Info),"32"==x&&ca(t)&&(na.b64bit=!1),ca(t)&&(rr.DWT.li({instanceMode:rr.DWT.lgdt()},"")||""!=P&&(rr.DWT.lsmid(P,""),rr.DWT.lsmid2b(P))),(Zt.isFunction(rr.DWT.OnSSLCertInfo)||Zt.isFunction(rr.OnSSLCertInfo))&&(""!=C&&(F=Date.parse(C+"T00:00:00"),F=isNaN(F)?null:new Date(F)),Hz||(Zt.isFunction(rr.DWT.OnSSLCertInfo)?rr.DWT.OnSSLCertInfo(F):Zt.isFunction(rr.OnSSLCertInfo)&&rr.OnSSLCertInfo(F)),Hz=!0),!u){e.next=71;break}if(""!=C){e.next=68;break}throw{code:_a.SSLCertInvalid,message:"The Dynamsoft Service SSL certificate is invalid."};case 68:if(!dz(C)){e.next=71;break}throw{code:_a.SSLCertExpired,message:"The Dynamsoft Service SSL certificate has expired."};case 71:if(!Zt.isString(A)||""==A){e.next=81;break}if(Xu("Checking the WebTwain version..."),!c&&!Od(A,ia.getServerVersionInfo(!0))){e.next=77;break}return e.abrupt("return",{host:t,port:r,bSSL:n,version:A,certExpiredDate:F});case 77:Xu(ec),Ca(w);case 79:e.next=82;break;case 81:E=!0;case 82:e.next=85;break;case 84:"Version not found"===T?Ca(w):Es(w,T);case 85:e.next=88;break;case 87:E=!0;case 88:e.next=91;break;case 90:E=!0;case 91:throw E&&Cs(w),rr.DWT.OnWebTwainInitMessage&&rr.DWT.OnWebTwainInitMessage(w._errorString,JH.Error),{code:w._errorCode,message:w._errorString};case 94:case"end":return e.stop()}}),e,null,[[6,27]])})))).apply(this,arguments)}function Qz(e,t,r){return qz.apply(this,arguments)}function qz(){return qz=n(g().mark((function e(t,r,n){var i,o,a,s,u,c;return g().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(!ia.bDWTChecked){e.next=2;break}return e.abrupt("return");case 2:return a=de.bSSL?n:r,i=de.bSSL?n:r,o=de.bSSL,e.prev=5,e.next=8,Yz(t,i,o,fi);case 8:s=e.sent,e.next=18;break;case 11:if(e.prev=11,e.t0=e["catch"](5),e.t0.code!=_a.MustUpgrade){e.next=16;break}throw Gz(!0),e.t0;case 16:return e.next=18,eK(t,r,n);case 18:if(!Oz()||rr.DWT.ConnectWithSocket){e.next=21;break}return e.next=21,rK(t,a);case 21:return u=s.host,c=s.port,Qt.detect.dcpStatus=2,zz(u,c),e.next=26,Rc(!1,!0);case 26:if(!ua()||!ca(t)){e.next=30;break}if(rr.DWT.li({instanceMode:rr.DWT.lgdt()},"")){e.next=30;break}throw{code:-2827,message:"Failed to get Machine ID."};case 30:ia.bDWTChecked=!0;case 31:case"end":return e.stop()}}),e,null,[[5,11]])}))),qz.apply(this,arguments)}function Yz(e,t,r,n){return Xz.apply(this,arguments)}function Xz(){return(Xz=n(g().mark((function e(t,r,n,i){var o;return g().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return Xu("Checking the WebTwain module..."),r||Zt.each(Qt.detect.ports,(function(e){de.bSSL?e.ssl&&(r=e.port):e.ssl||(r=e.port)})),e.prev=2,e.next=5,Kz(t,r,n,i?sa():aa(),{bConnectWithSocket:i});case 5:o=e.sent,e.next=12;break;case 8:throw e.prev=8,e.t0=e["catch"](2),Qt.detect.dcpStatus=3,e.t0;case 12:return Xu("Check the WebTwain version successfully."),!oa.versionInfoFromServer&&ca(o.host)&&(oa.versionInfoFromServer=o.version),e.abrupt("return",o);case 15:case"end":return e.stop()}}),e,null,[[2,8]])})))).apply(this,arguments)}function Zz(e,t,r,n,i){$z(e,t,{bRemoteServer:!0,bConnectWithSocket:r},n,i)}function $z(e,t,r,n,i){var o=0,a=e,s=t,u=Qt.detect.ssl,c=n,l=i;if(Zt.isFunction(a)&&Zt.isFunction(s))for(c=a,l=s,a=qo(),o=0;o<Qt.detect.ports.length;o++)if(de.bSSL&&Qt.detect.ports[o].ssl||!de.bSSL&&!Qt.detect.ports[o].ssl){s=Qt.detect.ports[o].port,u=de.bSSL;break}a||(a=qo()),Kz(a,s,u,aa(),r).then((function(e){var t=e.host,r=e.port,n=e.version;Zt.isFunction(c)&&c(t,r,n)}),(function(e){Zt.isFunction(l)&&l(e)}))}function eK(e,t,r){return tK.apply(this,arguments)}function tK(){return tK=n(g().mark((function e(t,r,n){var i,o,a,s,u,c,l;return g().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(i=de.bSSL?n:r,!de.bSSL||de.bSafari||de.bMobile||de.bAndroid){e.next=45;break}if(e.prev=2,!rr.DWT.ConnectWithSocket&&1==rr.DWT.IfCheckCORS){e.next=7;break}throw Ts(o={}),{code:o._errorCode,message:o._errorString};case 7:return e.next=9,iK(t,i,!1);case 9:e.next=43;break;case 11:if(e.prev=11,e.t0=e["catch"](2),(a=e.t0.code)!=_a.CORSErrorFromService&&a!=_a.SSLCertExpired&&a!=_a.SSLCertInvalid){e.next=18;break}throw e.t0;case 18:if(a!=_a.MustUpgrade){e.next=21;break}throw Gz(!0),e.t0;case 21:if(e.prev=21,1==rr.DWT.IfCheckCert){e.next=26;break}throw Ts(s={}),{code:s._errorCode,message:s._errorString};case 26:return e.next=28,Kz(Ko,r,!1,sa(),{bConnectWithSocket:!0,bCheckCert:!0});case 28:e.sent,e.next=43;break;case 31:if(e.prev=31,e.t1=e["catch"](21),(u=e.t1.code)!=_a.CORSErrorFromService&&u!=_a.SSLCertExpired&&u!=_a.SSLCertInvalid){e.next=38;break}throw e.t1;case 38:if(u!=_a.MustUpgrade){e.next=41;break}throw Gz(!0),e.t1;case 41:throw ca(t)?Gz(!1):Zt.isFunction(rr.OnRemoteWebTwainNotFoundCallback)&&rr.OnRemoteWebTwainNotFoundCallback(ia.name,t,i,de.bSSL,ko.bMobile),e.t1;case 43:case 52:e.next=66;break;case 45:if(e.prev=45,!rr.DWT.ConnectWithSocket&&0!=rr.DWT.IfCheckCORS){e.next=50;break}throw Ts(c={}),{code:c._errorCode,message:c._errorString};case 50:return e.next=52,iK(t,i,!1);case 54:if(e.prev=54,e.t2=e["catch"](45),(l=e.t2.code)!=_a.CORSErrorFromService&&l!=_a.SSLCertExpired&&l!=_a.SSLCertInvalid){e.next=61;break}throw e.t2;case 61:if(l!=_a.MustUpgrade){e.next=64;break}throw Gz(!0),e.t2;case 64:throw ca(t)?Gz(!1):Zt.isFunction(rr.OnRemoteWebTwainNotFoundCallback)&&rr.OnRemoteWebTwainNotFoundCallback(ia.name,t,i,de.bSSL,ko.bMobile),e.t2;case 66:throw Ds();case 67:case"end":return e.stop()}}),e,null,[[2,11],[21,31],[45,54]])}))),tK.apply(this,arguments)}function rK(e,t){return nK.apply(this,arguments)}function nK(){return(nK=n(g().mark((function e(t,r){return g().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",iK(t,r,!0));case 1:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function iK(e,t,r){return oK.apply(this,arguments)}function oK(){return(oK=n(g().mark((function e(t,r,n){var i,o,a;return g().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(e.prev=0,rr.DWT.ConnectWithSocket){e.next=5;break}return e.next=4,Yz(t,r,de.bSSL,di);case 4:i=e.sent;case 5:e.next=14;break;case 7:throw e.prev=7,e.t0=e["catch"](0),o=e.t0,(a=e.t0.code)==_a.ResponseDataTypeError||a==_a.HTSTError||a==_a.CORSError||a==_a.SSLCertExpired||a==_a.SSLCertInvalid||a==_a.MustUpgrade||(a==_a.CORSErrorFromService?Zt.isFunction(rr.OnCorsConfigError)&&rr.OnCorsConfigError(e.t0.message):ca(t)&&n&&Oz()&&(o={code:_a.CORSError,message:'The Connection from the insecure (HTTP) web page to the local "Dynamsoft Service" failed!'},a=o.code)),a==_a.CORSError&&Zt.isFunction(rr.OnHTTPCorsError)&&rr.OnHTTPCorsError(o.message),o;case 14:return e.abrupt("return",i);case 15:case"end":return e.stop()}}),e,null,[[0,7]])})))).apply(this,arguments)}function aK(e,t){(function(e,t){if(t.has(e))throw new TypeError("Cannot initialize the same private elements twice on an object")})(e,t),t.add(e)}function sK(e,t,r){if("function"==typeof e?e===t:e.has(t))return arguments.length<3?t:r;throw new TypeError("Private element is not present on this object")}var uK=new WeakSet,cK=function(e){function t(){var e;o(this,t);for(var r=arguments.length,n=new Array(r),a=0;a<r;a++)n[a]=arguments[a];return aK(e=i(this,t,[].concat(n)),uK),e}return f(t,e),s(t,[{key:"SetCookie",value:function(e){return this._cookie=e,document.cookie=e,fi}},{key:"LoadImageFromBase64Binary",value:function(e,t,r,n){var i=this,o=!1;if(Zt.isFunction(r)&&(o=!0),i._resetErr(),!i._isValid())return Zt.isFunction(n)&&Af(n,i),!!o&&void 0;if(!e)return rs(i),Zt.isFunction(n)&&Af(n,i),!!o&&void 0;var a,s,u,c,l,d=e,f="LoadImageFromBase64Binary",h=t,g=1;if(d instanceof vG&&Zt.isFunction(d.getLength)&&Zt.isFunction(d.getData)&&(d=d.getData(0,d.getLength())),Zt.isString(d))if(-1!=d.indexOf("data:image/bmp"))h=0;else if(-1!=d.indexOf("data:image/jpeg"))h=1;else if(-1!=d.indexOf("data:image/tif"))h=2;else if(-1!=d.indexOf("data:image/png"))h=3;else if(-1!=d.indexOf("data:application/pdf"))h=4;else if(-1!=d.indexOf("data:image/jp2"))h=14;else{var m=d.substr(0,64),p=Zt.base64.decode(m,!0);u=p,c=rr.DWT.EnumDWT_ImageType,l=u,(u instanceof ArrayBuffer||u instanceof Array)&&(l=new Uint8Array(u.slice(0,12))),h=function(e){return 37==e[0]&&80==e[1]&&68==e[2]&&70==e[3]}(l)?c.IT_PDF:function(e){return 73==e[0]&&73==e[1]&&42==e[2]&&0==e[3]||77==e[0]&&77==e[1]&&0==e[2]&&42==e[3]}(l)?c.IT_TIF:function(e){return 137==e[0]&&80==e[1]&&78==e[2]&&71==e[3]}(l)?c.IT_PNG:function(e){return 255==e[0]&&216==e[1]}(l)?c.IT_JPG:function(e){return 66==e[0]&&77==e[1]}(l)?c.IT_BMP:function(e){return 0==e[0]&&0==e[1]&&0==e[2]&&12==e[3]&&106==e[4]&&80==e[5]&&32==e[6]&&32==e[7]||255==e[0]&&79==e[1]&&255==e[2]&&81==e[3]}(l)?c.IT_J2K:c.IT_PNG}if(h!=rr.DWT.EnumDWT_ImageType.IT_BMP&&h!=rr.DWT.EnumDWT_ImageType.IT_JPG&&h!=rr.DWT.EnumDWT_ImageType.IT_TIF&&h!=rr.DWT.EnumDWT_ImageType.IT_PNG&&h!=rr.DWT.EnumDWT_ImageType.IT_PDF&&h!=rr.DWT.EnumDWT_ImageType.IT_J2K&&(h=-1),!Wc.checkProductKey(i,{Core:!0}))return Zt.isFunction(n)&&Af(n,i),!!o&&void 0;if(!Wc.checkPDFProductKeyWhenNeeds(i,h))return Zt.isFunction(n)&&Af(n,i),!!o&&void 0;if(Zt.isString(d)&&-1!=d.indexOf("base64,")&&(d=d.substr(d.indexOf("base64,")+7)),s=i.__GetLoadEventsNum(),!o){var v=i._getCurrentDocumentName(),_=i._getCurrentDefaultTagName();return(a=i.__innerLoadImageFun(f,Il(d,h,s,g),g,v,_))&&i._canConsume()&&rr.DWT.lcvrf(i),a}Qt.cancelFrom=rG.LoadImage,i.IfShowProgressBar?Qt.showProgress(i,f,i.__IfShowCancelDialogWhenImageTransfer):Qt.hideProgress(),i.__bLoadingImage=!0,g=0,i._innerSend(f,Il(d,h,s,g),!0,(function(){if(Qt.closeProgress(null,f),i.__bLoadingImage=!1,i._isBindViewer()){var e=i._ImgManager.getCurrentImageIndex();e>=0&&i._innerRefreshUI(e)}i._canConsume()&&rr.DWT.lcvrf(i),r&&r(d,t)}),(function(){Qt.closeProgress(null,f),i.__bLoadingImage=!1,Zt.isFunction(n)&&n(i._errorCode,i._getErrorString(),d,t)}))}},{key:"SaveSelectedImagesToBytes",value:function(e,t){return wa(this),di}},{key:"LoadImageFromBytes",value:function(e,t,r){return wa(this),di}},{key:"SetImageWidth",value:function(e,t,r,n){var i,o=this,a=!1;if(Zt.isFunction(r)&&(a=!0),o._resetErr(),!o._isValid())return!!a&&void 0;var s=parseInt(e);if(isNaN(s))return ya(o),Zt.isFunction(n)&&n(o._errorCode,o._getErrorString()),!!a&&void 0;if(s<0||s>=o._ImgManager.count())return Ka(o),Zt.isFunction(n)&&n(o._errorCode,o._getErrorString()),!!a&&void 0;if(Zt.isUndefined(t))return rs(o),Zt.isFunction(n)&&n(o._errorCode,o._getErrorString()),!!a&&void 0;var u=o._ImgManager.convertClientIndexToServerId(s);return-1==u?(Ka(o),Zt.isFunction(n)&&n(o._errorCode,o._getErrorString()),!!a&&void 0):((i=1==o._innerFun("SetImageWidth",Il(u,t)))?Zt.isFunction(r)&&r():Zt.isFunction(n)&&n(o._errorCode,o._getErrorString()),a?void 0:i)}},{key:"HTTPDownloadStreamThroughPost",value:function(e,t){return wa(this),di}},{key:"HTTPUploadStreamThroughPost",value:function(e,t,r,n,i){return wa(this),di}},{key:"HTTPUploadThroughPutDirectly",value:function(e,t,r,n,i){return wa(this),!1}},{key:"SetCustomDSDataEx",value:function(e){return this._resetErr(),!!this._isValid()&&this._innerFun("SetCustomDSDataEx",Il(e))}},{key:"SetCustomDSData",value:function(e){if(this._resetErr(),!this._isValid())return!1;var t=vf.replaceLocalFilename(e);return this._innerFun("SetCustomDSData",Il(t))}},{key:"GetCustomDSDataEx",value:function(){var e=this;return e._resetErr(),!!e._isValid()&&e._innerFun("GetCustomDSDataEx")}},{key:"GetCustomDSData",value:function(e){var t=this;if(t._resetErr(),!t._isValid())return!1;var r=vf.replaceLocalFilename(e);return t._innerFun("GetCustomDSData",Il(r))}},{key:"on",value:function(e,t){return this.registerEvent(e,t)}},{key:"off",value:function(e,t){return this.unregisterEvent(e,t)}},{key:"ConvertToBW",value:function(e,t,r){var n=this,i=!1;if(Zt.isFunction(t)&&(i=!0),n._resetErr(),!n._isValid())return!!i&&void 0;if(!Wc.checkProductKey(n,{Core:!0}))return Zt.isFunction(r)&&r(n._errorCode,n._getErrorString()),!!i&&void 0;var o=parseInt(e);if(isNaN(o))return ya(n),Zt.isFunction(r)&&r(n._errorCode,n._getErrorString()),!!i&&void 0;if(o<0||o>=n._ImgManager.count())return Ka(n),Zt.isFunction(r)&&r(n._errorCode,n._getErrorString()),!!i&&void 0;var a=n._ImgManager.convertClientIndexToServerId(o);if(-1==a)return Ka(n),!1;var s=n._innerFun("ConvertToBW",Il(a));return s?Zt.isFunction(t)&&t():Zt.isFunction(r)&&r(n._errorCode,n._getErrorString()),i?void 0:s}},{key:"LoadImageFromBinary",value:function(e,t,r){var n,i,o=this,a="LoadImageFromBinary",s=!1;Zt.isFunction(t)&&(s=!0);var u=null===(n=Qt.progressContext)||void 0===n?void 0:n.IfShowCancelDialogWhenImageTransfer;s&&(o.IfShowProgressBar?(Qt.showProgress(o,a,!1),Qt.progressContext&&(Qt.progressContext.IfShowCancelDialogWhenImageTransfer=!1)):Qt.hideProgress());return i=o._innerLoadImageFromBinary(e,0,!0,s,(function(){Qt.progressContext&&(Qt.progressContext.IfShowCancelDialogWhenImageTransfer=u),Zt.isFunction(t)&&(o.IfShowProgressBar&&Qt.closeProgress(null,a),t())}),(function(e,n){Qt.progressContext&&(Qt.progressContext.IfShowCancelDialogWhenImageTransfer=u),Zt.isFunction(t)&&o.IfShowProgressBar&&Qt.closeProgress(null,a),Zt.isFunction(r)&&r(e,n)})),s?void 0:i}},{key:"EnableSourceUI",value:function(e,t){var r=this;return r._resetErr(),!!r._isValid()&&(r._innerSend("EnableSourceUI",null,!0,e,t),!0)}},{key:"GetIfShowVideoContainer",value:function(){return this._UIView.GetIfShowVideoContainer()}},{key:"ShowVideoContainer",value:function(e){return this._UIView.ShowVideoContainer(e)}},{key:"UpdateVideoContainer",value:function(e){return this._UIView.UpdateVideoContainer(e)}},{key:"ChangeBitDepth",value:function(e,t,r){var n,i=this;if(i._resetErr(),!i._isValid())return!1;if(n=parseInt(e),isNaN(n))return ya(i),!1;if(n<0||n>=i._ImgManager.count())return Ka(i),!1;var o=i._ImgManager.convertClientIndexToServerId(n);return-1==o?(Ka(i),!1):i._innerFun("ChangeBitDepth",Il(o,t,r))}},{key:"ConvertToGrayScale",value:function(e,t,r){var n,i=this,o=!1;if(Zt.isFunction(t)&&(o=!0),i._resetErr(),!i._isValid())return!!o&&void 0;var a=parseInt(e);if(isNaN(a))return ya(i),Zt.isFunction(r)&&r(i._errorCode,i._getErrorString()),!!o&&void 0;if(a<0||a>=i._ImgManager.count())return Ka(i),Zt.isFunction(r)&&r(i._errorCode,i._getErrorString()),!!o&&void 0;var s=i._ImgManager.convertClientIndexToServerId(a);return-1==s?(Ka(i),Zt.isFunction(r)&&r(i._errorCode,i._getErrorString()),!!o&&void 0):((n=1==i._innerFun("ConvertToGrayScale",Il(s)))?(vf.refreshImageAfterInvokeFun(i,a),Zt.isFunction(t)&&t()):Zt.isFunction(r)&&r(i._errorCode,i._getErrorString()),o?void 0:n)}},{key:"ClearTiffCustomTag",value:function(){var e=this;return e._resetErr(),!!e._isValid()&&(e._aryTiffTag.splice(0,e._aryTiffTag.length),e._innerFun("ClearTiffCustomTag"))}},{key:"SetTiffCustomTag",value:function(e,t,r){var n=this;if(n._resetErr(),!n._isValid())return!1;if(Zt.isUndefined(e)||Zt.isUndefined(t))return rs(n),!1;var i,o=1*e;if(i=Zt.isString(t)?Zt.replaceAll(t,'"','\\"'):t,o<=0||o>2147483647)return ha(n,-2378,"Invalid value for the tiff tag code."),!1;var a,s=0,u=!1,c=n._aryTiffTag.length;for(s=0;s<c;s++)(a=n._aryTiffTag[s]).tag==o&&(a.Content=t,a.UseBase64Encoding=r,u=!0);return!u&&c>=32?(function(e){ha(e,-2428,"Tiff tag count has exceeded the limit.")}(n),!1):n._innerFun("SetTiffCustomTag",Il(o,i,r))}},{key:"IsBlankImage",value:function(e){var t,r=this;if(r._resetErr(),!r._isValid())return!1;if(t=parseInt(e),isNaN(t))return ya(r),!1;if(t<0||t>=r._ImgManager.count())return Ka(r),!1;var n=r._ImgManager.convertClientIndexToServerId(t);return-1==n?(Ka(r),!1):r._innerFun("IsBlankImage",Il(n,di))}},{key:"IsBlankImageExpress",value:function(e){var t=this;if(t._resetErr(),!t._isValid())return!1;var r=parseInt(e);if(isNaN(r))return ya(t),!1;if(r<0||r>=t._ImgManager.count())return Ka(t),!1;var n=t._ImgManager.convertClientIndexToServerId(r);return-1==n?(Ka(t),!1):t._innerFun("IsBlankImage",Il(n,fi))}},{key:"SetOpenSourceTimeout",value:function(e){var t=this;return t._resetErr(),!!t._isValid()&&t._innerFun("SetOpenSourceTimeout",Il(e))}},{key:"GetImageURL",value:function(e,t,r,n,i){var o=this;if(o._resetErr(),!o._isValid())return!1;var a,s,u,c,l=e,d=parseInt(t),f=parseInt(r);if(n?(a="",s="dwt://"):(a=o._httpUrl,s="dwt/"),c=o._bScanForProxyRemote?oa.getVersionStrForCheck():ia.getServerVersionInfo(),u=[a,s,ia.getDWTPrefix(),c,"/img?id=",o._clientId],Zt.isUndefined(l)||null===l)return Ja(o),"";if(i)u.push("&index=-1&width=-1&height=-1&webcam="),u.push(i);else{if(l=parseInt(l),isNaN(l))return ya(o),"";if(l<-1||l>=o._ImgManager.count())return Ka(o),"";var h=o._ImgManager.convertClientIndexToServerId(l);if(-1==h)return"";u.push("&index="),u.push(h),d>0&&f>0?(u.push("&width="),u.push(d),u.push("&height="),u.push(f)):u.push("&width=-1&height=-1"),ko.bMobile&&u.push("&type=1&quality=85")}if(u.push("&t="),u.push((new Date).getTime()),u=u.join(""),de.bFileSystem&&u.indexOf("dwt://")<0){var g=new Image;g.crossOrigin="anonymous",g.src=u,g=null}return u}},{key:"GetImagePartURL",value:function(e,t,r){var n=this;if(n._resetErr(),!n._isValid())return!1;var i=parseInt(e);return isNaN(i)?(ya(n),""):i<0||i>=n._ImgManager.count()?(Ka(n),""):this.GetImageURL(i,t,r,!0)}},{key:"SetLanguage",value:function(e){var t=this;return t._resetErr(),!!t._isValid()&&t._innerFun("SetLanguageForSecurity",Il(e))}},{key:"GetLicenseInfo",value:function(e,t){var r=this;if(r.__licenseInfo)Zt.isFunction(e)&&e(r.__licenseInfo);else{r._innerFunRaw("GetLicenseInfo",Il(0),fi,di,fi,(function(n){n?n.exception?Zt.isFunction(t)&&t(n.exception):(Zt.isArray(n.result)&&n.result.length>0&&od(r,n.result[0]),Zt.isFunction(e)&&e(r.__licenseInfo)):Zt.isFunction(t)&&t()}),t)}}},{key:"SetProductKeyAsync",value:function(e){return this._setProductKeyAsync(e)}},{key:"GetVersionInfoAsync",value:function(){return ci.Promise.resolve(oa.versionInfoFromServer)}},{key:"isUsingActiveX",value:function(){return!1}},{key:"SetLTSLicenseAsync",value:function(e){return this._setLTSLicenseAsync(e)}},{key:"Print",value:function(e){var t=this;if(t._resetErr(),!t._isValid())return!1;if(t._isNoViewer())return t._nouiNotSupport("Print");if(e){return t._innerSend("PrintEx",Il(!0),!0,(function(){}),(function(){})),!0}return t._ImagePrint.Print(),!0}},{key:"PrintEx",value:function(e){var t=this;return t._resetErr(),!!t._isValid()&&(!!t._checkIndices(e)&&(t._isNoViewer()?t._nouiNotSupport("Print"):(t._ImagePrint.PrintEx(e),!0)))}},{key:"IsBlankImageAsync",value:(h=n(g().mark((function m(e,t){var r,n,i,o;return g().wrap((function(a){for(;;)switch(a.prev=a.next){case 0:if(r=this,Uo.getEnumPlatform()==Lo.enumWindow){a.next=5;break}throw ha(r,-2905,"This API is not supported on the current operating system. Please contact your system administrator."),{code:this._errorCode,message:this._getErrorString()};case 5:return i={minBlockHeight:20,maxBlockHeight:30},t&&(Zt.isNumber(t.minBlockHeight)&&t.minBlockHeight>=0&&(i.minBlockHeight=t.minBlockHeight),Zt.isNumber(t.maxBlockHeight)&&t.maxBlockHeight>=0&&(i.maxBlockHeight=t.maxBlockHeight)),n={command:"isBlankImage",parameter:{index:e,minHeight:i.minBlockHeight,maxHeight:i.maxBlockHeight}},a.next=10,r.RunCommandAsync(n);case 10:if(!((o=a.sent)&&Qt.isArray(o.result)&&o.result.length>0)){a.next=13;break}return a.abrupt("return",o.result[0]);case 13:return a.abrupt("return",!1);case 14:case"end":return a.stop()}}),m,this)}))),function(e,t){return h.apply(this,arguments)})},{key:"httpUploadBlob",value:function(e,t,r,n){var i=this,o="httpUploadBlob",a=t,s=r,u=null,c=null,l=tG.Text;if(i._resetErr(),!i._isValid())return Qt.Promise.reject({code:i._errorCode,message:i._errorString});if(Zt.isUndefined(e)||""===e)return Oa(i),Qt.Promise.reject({code:i._errorCode,message:i._errorString});if(!Zt.isString(e))return Ya(i),Qt.Promise.reject({code:i._errorCode,message:i._errorString});if(!(a instanceof Blob))return rs(i),Qt.Promise.reject({code:i._errorCode,message:i._errorString});var d=a.type.toLocaleLowerCase();if("image/jpeg"!=d&&"image/jpg"!=d&&"image/png"!=d&&"image/bmp"!=d&&"application/pdf"!=d&&"image/tiff"!=d&&"image/tif"!=d)return ha(i,-2845,"Only Blob of JPEG, PNG, BMP, TIFF and PDF image types can be uploaded."),Qt.Promise.reject({code:i._errorCode,message:i._errorString});n&&(u=new FormData,Zt.each(n.formFields,(function(e,t){var r=e.name,n=e.value;Zt.isString(r)&&(n instanceof Blob?u.append(r,n,e.fileName):u.append(r,n))})),c={},Zt.each(n.headers,(function(e,t){Zt.isString(e.name)&&(c[e.name]=e.value)})),n.responseType&&(l=n.responseType));var f=i._createHttpUploaderConfig(),h=new fG,g=new hG;return g.url=e,g.method=o,g.content=a,a=null,g.contentType=i._strHttpContentTypeFieldValue,g.headers=c,g.fileName=s,g.httpFormData=u,i.__remoteFilename&&""!=i.__remoteFilename&&(g.remoteFilename=i.__remoteFilename),g.retry=1,g.bOnlyResponseEmptyIsOK=!1,g.responseType=l,f.objUploadStatus=undefined,i.IfShowProgressBar&&Qt.showProgress(i,o,!1),new Qt.Promise((function(e,t){h.httpPostUpload(f,g,(function(t){i.IfShowProgressBar&&Qt.closeProgress(i,o,!1),e(t)}),(function(e,r){i.IfShowProgressBar&&Qt.closeProgress(i,o,!1),t({code:e,message:r})}))}))}},{key:"saveBlob",value:(d=n(g().mark((function p(e,t){var r,n,i,o,a;return g().wrap((function(s){for(;;)switch(s.prev=s.next){case 0:if(i=e,(r=this)._resetErr(),r._isValid()){s.next=4;break}throw{code:r._errorCode,message:r._errorString};case 4:if(!Zt.isString(e)&&null!==e&&e!==undefined){s.next=8;break}s.next=10;break;case 8:case 23:throw rs(r),{code:r._errorCode,message:r._errorString};case 10:if(!(t instanceof Blob)){s.next=23;break}if("image/jpeg"!=(a=t.type.toLocaleLowerCase())&&"image/jpg"!=a&&"image/png"!=a&&"image/bmp"!=a&&"application/pdf"!=a&&"image/tiff"!=a&&"image/tif"!=a){s.next=16;break}s.next=18;break;case 16:throw ha(r,-2844,"Only Blob of JPEG, PNG, BMP, TIFF and PDF image types can be saved."),{code:r._errorCode,message:r._errorString};case 18:return s.next=20,YG(t);case 20:o=s.sent,s.next=25;break;case 25:return i||(i=""),i=vf.replaceLocalFilename(i),n=Il(i),s.next=30,new Qt.Promise((function(e,t){r._innerSendBlobByWS("SaveBlobToFile",n,o,(function(t){e(t)}),(function(e){t({code:r._errorCode,message:r._errorString})}))}));case 30:case"end":return s.stop()}}),p,this)}))),function(e,t){return d.apply(this,arguments)})},{key:"createLocalStorage",value:(l=n(g().mark((function v(e){var t,r,n,i,o;return g().wrap((function(a){for(;;)switch(a.prev=a.next){case 0:if((t=this)._resetErr(),t._isValid()){a.next=4;break}throw{code:t._errorCode,message:t._errorString};case 4:if(n="CreateLocalStorage",i=null,!e){a.next=12;break}if(o=e.password,!1!==sK(uK,this,lK).call(this,o)){a.next=9;break}throw{code:t._errorCode,message:t._errorString};case 9:i=JSON.stringify([JSON.stringify(e)]),a.next=13;break;case 12:i='["{}"]';case 13:return a.next=15,new Qt.Promise((function(e,r){t._innerSend(n,i,!1,(function(n){if(Zt.isArray(n)&&n.length>0){var i=n[0];i&&Zt.isString(i.uid)&&e(i.uid)}else Cs(t),r({code:t._errorCode,message:t._errorString})}),(function(){r({code:t._errorCode,message:t._errorString})}))}));case 15:return r=a.sent,a.abrupt("return",r);case 17:case"end":return a.stop()}}),v,this)}))),function(e){return l.apply(this,arguments)})},{key:"localStorageExist",value:(c=n(g().mark((function _(e){var t,r,n;return g().wrap((function(i){for(;;)switch(i.prev=i.next){case 0:if(r="LocalStorageExist",(t=this)._resetErr(),t._isValid()){i.next=4;break}throw{code:t._errorCode,message:t._errorString};case 4:if(0!=sK(uK,t,dK).call(t,e)){i.next=6;break}throw{code:t._errorCode,message:t._errorString};case 6:return i.next=8,new Qt.Promise((function(n,i){t._innerSend(r,Il(e),!1,(function(e){if(Zt.isArray(e)&&e.length>0){var r=e[0];(Zt.isBoolean(r)||Zt.isNumber(r))&&n(!!r)}else Cs(t),i({code:t._errorCode,message:t._errorString})}),(function(){i({code:t._errorCode,message:t._errorString})}))}));case 8:return n=i.sent,i.abrupt("return",n);case 10:case"end":return i.stop()}}),_,this)}))),function(e){return c.apply(this,arguments)})},{key:"saveToLocalStorage",value:(u=n(g().mark((function y(e){var t,r,n,i;return g().wrap((function(o){for(;;)switch(o.prev=o.next){case 0:if(r="SaveToLocalStorage",n=null,(t=this)._resetErr(),t._isValid()){o.next=4;break}throw{code:t._errorCode,message:t._errorString};case 4:if(Zt.isObject(e)){o.next=7;break}throw rs(t),{code:t._errorCode,message:t._errorString};case 7:if(!1!==sK(uK,t,dK).call(t,e.uid)&&!1!==sK(uK,this,lK).call(this,e.password)){o.next=9;break}throw{code:t._errorCode,message:t._errorString};case 9:if(!Zt.isUndefined(e.indices)){o.next=13;break}e.indices=wf(t),o.next=20;break;case 13:if(!Zt.isArray(e.indices)||0!=e.indices.length){o.next=17;break}o.next=20;break;case 17:if(t._checkIndices(e.indices)){o.next=19;break}throw{code:t._errorCode,message:t._errorString};case 19:e.indices=Ef(t,e.indices);case 20:return n=JSON.stringify([JSON.stringify(e)]),o.next=23,new Qt.Promise((function(e,i){t._innerSend(r,n,!1,(function(r){if(Zt.isArray(r)&&r.length>0){var n=r[0];n&&n.imageIds&&e(n.imageIds)}else Cs(t),i({code:t._errorCode,message:t._errorString})}),(function(){i({code:t._errorCode,message:t._errorString})}))}));case 23:return i=o.sent,o.abrupt("return",i);case 25:case"end":return o.stop()}}),y,this)}))),function(e){return u.apply(this,arguments)})},{key:"loadFromLocalStorage",value:(a=n(g().mark((function S(e){var t,r,n,i,o;return g().wrap((function(a){for(;;)switch(a.prev=a.next){case 0:if(r="LoadFromLocalStorage",n=null,(t=this)._resetErr(),t._isValid()){a.next=4;break}throw{code:t._errorCode,message:t._errorString};case 4:if(Zt.isObject(e)){a.next=7;break}throw rs(t),{code:t._errorCode,message:t._errorString};case 7:if(!1!==sK(uK,t,dK).call(t,e.uid)&&!1!==sK(uK,this,lK).call(this,e.password)){a.next=9;break}throw{code:t._errorCode,message:t._errorString};case 9:return(o=Zt.clone(e)).documentName=t._getCurrentDocumentName(),o.tagName=t._getCurrentDefaultTagName(),n=JSON.stringify([JSON.stringify(o)]),Qt.showProgress(t,r,!1),Qt.progressBarOnPercentDone(-1,"Processing...","",0,""),a.next=17,new Qt.Promise((function(e,i){t._innerSend(r,n,!1,(function(n){var o;Qt.closeProgress(null,r),Zt.isArray(n)&&n.length>0?(o=n[0])&&o.mapImageIds&&e(o.mapImageIds):(!1===o&&0!=t._errorCode||Cs(t),i({code:t._errorCode,message:t._errorString}))}),(function(){Qt.closeProgress(null,r),i({code:t._errorCode,message:t._errorString})}))}));case 17:return i=a.sent,a.abrupt("return",i);case 19:case"end":return a.stop()}}),S,this)}))),function(e){return a.apply(this,arguments)})},{key:"removeLocalStorage",value:(r=n(g().mark((function I(e){var t,r,n,i;return g().wrap((function(o){for(;;)switch(o.prev=o.next){case 0:if(r="RemoveLocalStorage",n=null,(t=this)._resetErr(),t._isValid()){o.next=4;break}throw{code:t._errorCode,message:t._errorString};case 4:if(Zt.isObject(e)){o.next=7;break}throw rs(t),{code:t._errorCode,message:t._errorString};case 7:if(!1!==sK(uK,t,dK).call(t,e.uid)&&!1!==sK(uK,this,lK).call(this,e.password)){o.next=9;break}throw{code:t._errorCode,message:t._errorString};case 9:return e&&(n=JSON.stringify([JSON.stringify(e)])),o.next=12,new Qt.Promise((function(e,i){t._innerSend(r,n,!1,(function(r){if(Zt.isArray(r)&&r.length>0){var n=r[0];(Zt.isBoolean(n)||Zt.isNumber(n))&&e(!!n)}else Cs(t),i({code:t._errorCode,message:t._errorString})}),(function(){i({code:t._errorCode,message:t._errorString})}))}));case 12:return i=o.sent,o.abrupt("return",i);case 14:case"end":return o.stop()}}),I,this)}))),function(e){return r.apply(this,arguments)})}]);var r,a,u,c,l,d,h}(QG);function lK(e){if(!Zt.isUndefined(e)){if(!Zt.isString(e))return ha(this,-2850,"The password is not a string."),!1;if(e.length>32)return function(e){ha(e,-2849,"The password must not exceed 32 characters in length.")}(this),!1}return!0}function dK(e){return Zt.isUndefined(e)||""==e?(ha(this,-2846,"The uid cannot be empty."),!1):!!Zt.isString(e)||(function(e){ha(e,-2847,"The uid is invalid.")}(this),!1)}function fK(e,t,r,n){var i;0!==r&&1!==r?i=r:(i={},r&&(i.set=1==n?function(r){var n=1*r;return!Zt.isNumber(n)||isNaN(n)?(Sa(e),di):(e._resetErr(),!!e._isValid()&&e._innerFun(t,Il(n)))}:2==n?function(r){return Zt.isBoolean(r)?(e._resetErr(),!!e._isValid()&&e._innerFun(t,Il(r))):(Sa(e),di)}:function(r){return Zt.isString(r)?(e._resetErr(),!!e._isValid()&&e._innerFun(t,Il(r))):(Sa(e),di)})),i.get||(i.get=function(){return e._resetErr(),!!e._isValid()&&e._innerFun(t)}),t in e||Object.defineProperty(e,t,i)}function hK(e,t){(function(e,t){if(t.has(e))throw new TypeError("Cannot initialize the same private elements twice on an object")})(e,t),t.add(e)}function gK(e,t,r){return(t=function(e){var t=function(e,t){if("object"!=_(e)||!e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var n=r.call(e,t||"default");if("object"!=_(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==_(t)?t:t+""}(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function mK(e,t,r){if("function"==typeof e?e===t:e.has(t))return arguments.length<3?t:r;throw new TypeError("Private element is not present on this object")}var pK=new WeakSet,vK=function(){return s((function r(e,t,n,i){o(this,r),hK(this,pK),gK(this,"serverUrl",undefined),this.serverUrl=e,this.bLocal=ca(e),this.clientId=null!=n?n:Zt.guid(),this.bGlobal=t,this.serverName=i,this.bLicenseOK=!1}),[{key:"checkSource",value:function(e){if(!e)throw{code:-1003,message:"Source Manager unable to find the specified Source"}}},{key:"parseResultDefault",value:function(e){var t;if(Zt.isObject(e)&&e.exception&&0!=e.exception)throw{code:e.exception,message:null!==(t=e.description)&&void 0!==t?t:"general error"};if(e&&Zt.isArray(e.result)&&e.result.length>0){var r=e.result[e.result.length-1];try{return JSON.parse(r)}catch(Mj){return r}}throw e}},{key:"_requestAsync",value:(t=n(g().mark((function i(e,t,r){var n,o,a,s,u,c,l,d,f,h;return g().wrap((function(i){for(;;)switch(i.prev=i.next){case 0:if(!rr.DWT.ConnectWithSocket){i.next=12;break}return i.next=3,mK(pK,this,_K).call(this);case 3:return n=i.sent,o=0,e&&(o=e.cmdId),a={client:n,userData:{command:e},taskId:o},s=bK,i.next=9,n.request(Zt.stringify(e),s,a);case 9:return u=i.sent,Zt.isString(u)&&(u=Zt.parse(u)),i.abrupt("return",u);case 12:return c=[Qu(),"/",e.method].join(""),t&&(d=t),f=(h=this).serverUrl?_d.getDDMUrl(h.serverUrl,h.bGlobal,[Ku,e.method].join("")):_d.getModuleUrl(c),i.prev=16,i.next=19,Hs(f,{method:"post",dataType:"json",body:Zt.stringify(e),fetchRaw:null!=r&&r,timeout:d});case 19:l=i.sent,i.next=25;break;case 22:throw i.prev=22,i.t0=i["catch"](16),i.t0;case 25:return i.abrupt("return",l);case 26:case"end":return i.stop()}}),i,this,[[16,22]])}))),function(e,r,n){return t.apply(this,arguments)})},{key:"_resetLicense",value:(e=n(g().mark((function a(e,t,r){return g().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:case"end":return e.stop()}}),a)}))),function(t,r,n){return e.apply(this,arguments)})}]);var e,t}();function _K(){return yK.apply(this,arguments)}function yK(){return(yK=n(g().mark((function e(){var t,r,n,i,o,a,s,u,c;return g().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if((t=this)._wsClient){e.next=10;break}return r=new Js,(n=this.serverUrl)?(i=Qt.detect.ssl,a="/",o=i?"ddm/18626/":"ddm/18625/",Zt.endsWith(n,"/")&&(a=""),Zt.startsWith(n,"https://")||Zt.startsWith(n,"wss://")?(r.ssl=!0,s=Zt.startsWith(n,"https://")?Zt.replaceAll(n,"https://",""):Zt.replaceAll(n,"wss://",""),n=s+a+o):Zt.startsWith(n,"http://")||Zt.startsWith(n,"ws://")?(r.ssl=!1,u=Zt.startsWith(n,"http://")?Zt.replaceAll(n,"http://",""):Zt.replaceAll(n,"ws://",""),n=u+a+o):(r.ssl=Qt.detect.ssl,r.port=r.ssl?na.SSLPort:na.Port),r.server=n):(r.ssl=Qt.detect.ssl,r.server=qo(),r.port=r.ssl?na.SSLPort:na.Port),r.useWS=!0,r.protocol=na.wsProtocol,c=Bu.Instance.getClient(r),e.next=9,c.testConnection();case 9:t._wsClient=c;case 10:return e.abrupt("return",t._wsClient);case 11:case"end":return e.stop()}}),e,this)})))).apply(this,arguments)}gK(vK,"logLevel",-1);var SK=function(e){function t(){var e;o(this,t);for(var r=arguments.length,n=new Array(r),a=0;a<r;a++)n[a]=arguments[a];return c(e=i(this,t,[].concat(n)),"_bInited",!1),e}return f(t,e),s(t,[{key:"getDynamsoftService",value:(r=n(g().mark((function a(e,t,r,n){var i,o,s,c,l,d,f,h,m,p,v,_,y,S,I;return g().wrap((function(a){for(;;)switch(a.prev=a.next){case 0:return r=null!==(i=r)&&void 0!==i&&i,n=null!==(o=n)&&void 0!==o?o:30,s={id:this.clientId,cmdId:Zt.guid(),method:"SearchScanner",parameter:[1,"_privet._tcp.local.",!1,!0,r,n,e,t],version:Ju},a.prev=5,a.next=8,this._requestAsync(s,3e4,!1);case 8:c=a.sent,this._bInited=!0,a.next=19;break;case 12:if(a.prev=12,a.t0=a["catch"](5),!this.bLocal){a.next=18;break}throw ms(l={}),{code:l._errorCode,message:l._errorString};case 18:throw{code:-2604,message:"Failed to connect to the Proxy Service. Please make sure the Proxy Service is configured successfully, Dynamsoft Service is running, or the certificate is valid."};case 19:d=[],f=this.parseResultDefault(c),h=u(f),a.prev=22,h.s();case 24:if((m=h.n()).done){a.next=40;break}if(!((p=m.value).service_type&&p.service_type==yd.ST_UNKNOWN||p.type&&"dynamsoft_private_cloud_scan"!=p.type&&"twaindirect"!=p.type)){a.next=30;break}return a.abrupt("continue",38);case 30:if(!p.service_type){a.next=38;break}a.t1=p.service_type,a.next=a.t1===yd.ST_DYNAMSOFT_SERVICE?34:38;break;case 34:return(v=p.modules)&&Zt.isArray(v)&&Zt.isString(v[0])&&(_=v[0].split(",")).length>=3&&_[0]>=1&&_[1]>=8&&_[2]>0&&(p.bGlobalFind=!0,y=IK(this.serverUrl,p),d.push(y)),p.bGlobalFind||(I=null!==(S=null==p?void 0:p.ty)&&void 0!==S?S:"",Zt.warn(["The Dynamsoft Service on [",I,"] is old version."].join(""))),a.abrupt("break",38);case 38:a.next=24;break;case 40:a.next=45;break;case 42:a.prev=42,a.t2=a["catch"](22),h.e(a.t2);case 45:return a.prev=45,h.f(),a.finish(45);case 48:return a.abrupt("return",d);case 49:case"end":return a.stop()}}),a,this,[[5,12],[22,42,45,48]])}))),function(e,t,n,i){return r.apply(this,arguments)})},{key:"dispose",value:function(){var e={id:this.clientId,cmdId:Zt.guid(),method:"dispose",version:Ju};this._requestAsync(e,500)}}]);var r}(vK);function IK(e,t){var r=new fd;return r.server=e,r.attrs=t,r}function bK(e,t,r,n){return TK.apply(this,arguments)}function TK(){return TK=n(g().mark((function e(t,r,n,i){var o,a;return g().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(r!=ru.GET_TASKID){e.next=4;break}return e.abrupt("return",i.taskId);case 4:if(r!=ru.ONMESSAGE_PROCESS_DATA){e.next=8;break}return e.abrupt("return",Zt.parse(t));case 8:if(r!=ru.ONMESSAGE_GET_TASKID){e.next=13;break}if(!i||!i.client){e.next=11;break}return e.abrupt("return",i.client.getRequestTaskId());case 11:e.next=20;break;case 13:if(r!=ru.HANDLE_RAW_MESSAGE){e.next=20;break}if(o=null==i?void 0:i.userData){e.next=17;break}return e.abrupt("return",!1);case 17:return(a=t).indexOf("Version not found")>=0||a.indexOf("Function not found")>=0?Zt.isFunction(o.fFun)&&o.fFun():Zt.isFunction(o.sFun)&&o.sFun(a),e.abrupt("return",a);case 20:case"end":return e.stop()}}),e)}))),TK.apply(this,arguments)}function CK(e,t,r){return(t=function(e){var t=function(e,t){if("object"!=_(e)||!e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var n=r.call(e,t||"default");if("object"!=_(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==_(t)?t:t+""}(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function wK(e,t){(function(e,t){if(t.has(e))throw new TypeError("Cannot initialize the same private elements twice on an object")})(e,t),t.add(e)}function EK(e,t,r){if("function"==typeof e?e===t:e.has(t))return arguments.length<3?t:r;throw new TypeError("Private element is not present on this object")}function kK(e){var t,r=yd.ST_UNKNOWN;return e==Tl.ESCLSCANNER?r=yd.ST_ESCL:e==Tl.WIFIDIRECTSCANNER?r=yd.ST_WIFI_DIRECT:((t=e)==Tl.TWAINSCANNER||t==Tl.WIATWAINSCANNER||t==Tl.TWAINX64SCANNER||t==Tl.ICASCANNER||t==Tl.SANESCANNER)&&(r=yd.ST_DYNAMSOFT_SERVICE),r}var AK=new WeakSet,xK=function(e){function t(){var e;o(this,t);for(var r=arguments.length,n=new Array(r),a=0;a<r;a++)n[a]=arguments[a];return wK(e=i(this,t,[].concat(n)),AK),CK(e,"_bInited",!1),CK(e,"_currentDevice",undefined),e}return f(t,e),s(t,[{key:"getSources",value:(p=n(g().mark((function v(e,t,r){var n,i,o,a,s,c,l,d,f,h,m,p,_,y;return g().wrap((function(g){for(;;)switch(g.prev=g.next){case 0:if(o="",a=!1,s=[],c=!1,((l=null!=e?e:kl)&Tl.ESCLSCANNER)==Tl.ESCLSCANNER&&(o="_uscan._tcp.local."),(l&Tl.WIFIDIRECTSCANNER)==Tl.WIFIDIRECTSCANNER&&(a=!0),0!=o.length||a){g.next=9;break}return g.abrupt("return",[]);case 9:return t=null!==(n=t)&&void 0!==n&&n,r=null!==(i=r)&&void 0!==i?i:30,d={id:this.clientId,cmdId:Zt.guid(),method:"SearchScanner",parameter:[1,o,a,c,t,r],version:Ju},g.next=14,this._requestAsync(d,3e4,!1);case 14:if(f=g.sent,this._bInited=!0,h=this.parseResultDefault(f),Zt.isArray(h)){g.next=19;break}throw{code:-2612,message:"The devices must be an Array."};case 19:m=u(h),g.prev=20,m.s();case 22:if((p=m.n()).done){g.next=48;break}if(!((_=p.value).service_type&&_.service_type==yd.ST_UNKNOWN||_.type&&"dynamsoft_private_cloud_scan"!=_.type&&"twaindirect"!=_.type)){g.next=28;break}return g.abrupt("continue",46);case 28:if(!_.service_type){g.next=46;break}g.t0=_.service_type,g.next=g.t0===yd.ST_DYNAMSOFT_SERVICE?32:g.t0===yd.ST_ESCL||g.t0===yd.ST_WIFI_DIRECT?33:46;break;case 32:return g.abrupt("break",46);case 33:return(y=new Id).name="",y.displayName="",y.deviceType=0,y.isSystemDefaultPrinter=!1,_.service_type==yd.ST_ESCL?y.deviceType=Tl.ESCLSCANNER:_.service_type==yd.ST_WIFI_DIRECT&&(y.deviceType=Tl.WIFIDIRECTSCANNER),y.name=_.ty,_.hostname&&_.hostname.length>_.ty.length&&(y.name=_.hostname),y.displayName=(_.service_type==yd.ST_ESCL?"eSCL-":"")+y.name,this.bGlobal||(_.url=this.serverUrl,this.serverName&&(y.displayName=y.displayName+" on ["+this.serverName+"]")),y.serviceInfo=IK(this.serverUrl,_),s.push(y),g.abrupt("break",46);case 46:g.next=22;break;case 48:g.next=53;break;case 50:g.prev=50,g.t1=g["catch"](20),m.e(g.t1);case 53:return g.prev=53,m.f(),g.finish(53);case 56:return g.abrupt("return",s);case 57:case"end":return g.stop()}}),v,this,[[20,50,53,56]])}))),function(e,t,r){return p.apply(this,arguments)})},{key:"getCapabilitiesAsync",value:(m=n(g().mark((function _(e){var t,r,n;return g().wrap((function(i){for(;;)switch(i.prev=i.next){case 0:return this.checkSource(e),(e.deviceType&Tl.ESCLSCANNER)!=Tl.ESCLSCANNER&&(e.deviceType&Tl.WIFIDIRECTSCANNER)!=Tl.WIFIDIRECTSCANNER||(this._currentDevice=e),t=kK(e.deviceType),r={id:this.clientId,cmdId:Zt.guid(),method:"SendRequestToScanner",parameter:["getCapabilities",Zt.stringify({UUID:e.serviceInfo.attrs.UUID,service_type:t,ty:e.name})],version:Ju},i.next=6,this._requestAsync(r,0);case 6:return n=i.sent,i.abrupt("return",this.parseResultDefault(n));case 8:case"end":return i.stop()}}),_,this)}))),function(e){return m.apply(this,arguments)})},{key:"selectSourceAsync",value:(h=n(g().mark((function y(e){var t;return g().wrap((function(r){for(;;)switch(r.prev=r.next){case 0:return r.next=2,this.getCapabilitiesAsync(e);case 2:if(!(t=r.sent)&&""!=t){r.next=5;break}return r.abrupt("return",!0);case 5:case"end":return r.stop()}}),y,this)}))),function(e){return h.apply(this,arguments)})},{key:"versionInfo",value:(d=n(g().mark((function S(){var e,t;return g().wrap((function(r){for(;;)switch(r.prev=r.next){case 0:return e={id:this.clientId,cmdId:Zt.guid(),method:"VersionInfo",version:Ju},r.next=3,this._requestAsync(e,5e3);case 3:return t=r.sent,this._bInited=!0,r.abrupt("return",t);case 6:case"end":return r.stop()}}),S,this)}))),function(){return d.apply(this,arguments)})},{key:"getLicenseInfo",value:function(e,t,r){return this._resetLicense(e,t,r)}},{key:"getImageAsArrayBuffer",value:(l=n(g().mark((function I(e,t){return g().wrap((function(r){for(;;)switch(r.prev=r.next){case 0:return r.abrupt("return",EK(AK,this,PK).call(this,e,t));case 1:case"end":return r.stop()}}),I,this)}))),function(e,t){return l.apply(this,arguments)})},{key:"getImageToDWT",value:(c=n(g().mark((function b(e,t,r){return g().wrap((function(n){for(;;)switch(n.prev=n.next){case 0:return n.abrupt("return",EK(AK,this,PK).call(this,e,t,r));case 1:case"end":return n.stop()}}),b,this)}))),function(e,t,r){return c.apply(this,arguments)})},{key:"acquireImage",value:(a=n(g().mark((function T(e,t,r){var n,i,o,a,s,u,c,l;return g().wrap((function(r){for(;;)switch(r.prev=r.next){case 0:e=null!==(n=e)&&void 0!==n?n:this._currentDevice,this.checkSource(e),this._currentDevice=e,i=kK(e.deviceType),o=["scan",Zt.stringify({UUID:e.serviceInfo.attrs.UUID,service_type:i})],a=EK(AK,this,FK).call(this,t),o[2]=Zt.stringify(a),s={id:this.clientId,cmdId:Zt.guid(),method:"SendRequestToScanner",parameter:o,version:Ju},u=0;case 9:if(!(u<5)){r.next=32;break}return r.prev=10,r.next=13,this._requestAsync(s,0);case 13:return l=r.sent,c=this.parseResultDefault(l),Zt.isObject(c)&&(c.device=e,c.scanOptions=a),r.abrupt("break",32);case 19:if(r.prev=19,r.t0=r["catch"](10),-1004!=r.t0.code&&-1001!=r.t0.code){r.next=28;break}if(!(u>=4)){r.next=24;break}throw r.t0;case 24:return r.next=26,new Qt.Promise((function(e,t){setTimeout(e,2e3)}));case 26:r.next=29;break;case 28:throw r.t0;case 29:u++,r.next=9;break;case 32:return r.abrupt("return",c);case 33:case"end":return r.stop()}}),T,this,[[10,19]])}))),function(e,t,r){return a.apply(this,arguments)})},{key:"_resetLicense",value:(r=n(g().mark((function C(e,r,n){var i,o,a,s;return g().wrap((function(u){for(;;)switch(u.prev=u.next){case 0:return this.longKeyOrShortkey=e,this.cu=r,WK(),i=null!=r?r:"",o={id:this.clientId,cmdId:Zt.guid(),method:"GetLicenseInfo",parameter:[e,t.logLevel,i,n],version:Ju},u.prev=5,u.next=8,this._requestAsync(o,1e4);case 8:return a=u.sent,this._bInited=!0,u.abrupt("return",this.parseResultDefault(a));case 13:if(u.prev=13,u.t0=u["catch"](5),!this.bLocal){u.next=19;break}throw ms(s={}),{code:s._errorCode,message:s._errorString};case 19:throw{code:-2604,message:"Failed to connect to the Proxy Service. Please make sure the Proxy Service is configured successfully, Dynamsoft Service is running, or the certificate is valid."};case 20:case"end":return u.stop()}}),C,this,[[5,13]])}))),function(e,t,n){return r.apply(this,arguments)})}]);var r,a,c,l,d,h,m,p}(SK);function PK(e,t,r){return DK.apply(this,arguments)}function DK(){return(DK=n(g().mark((function e(t,r,n){var i,o,a,s,u,c;return g().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(null!=t&&t.device){e.next=2;break}throw{code:-1011,message:"Operation out of expected sequence"};case 2:return n=null!==(i=n)&&void 0!==i?i:{ver:"",clientId:""},(o=["getImage",Zt.stringify({UUID:t.device.serviceInfo.attrs.UUID,service_type:r})])[2]=Zt.stringify(t.scanOptions),o[3]=t.scanJobs,o[4]=t.scanId,o[5]=n._clientId,o[6]=n._ver,a={id:this.clientId,cmdId:Zt.guid(),method:"SendRequestToScanner",parameter:o,version:Ju},e.next=12,this._requestAsync(a,0,!0);case 12:if(s=e.sent,!(s.headers.get("content-type").indexOf("image/")>=0)){e.next=20;break}return e.next=17,s.arrayBuffer();case 17:return e.abrupt("return",e.sent);case 20:return e.next=22,s.json();case 22:if(u=e.sent,"boolean"!=typeof(c=this.parseResultDefault(u))){e.next=28;break}return e.abrupt("return",null);case 28:return e.abrupt("return",c);case 29:case"end":return e.stop()}}),e,this)})))).apply(this,arguments)}function FK(e){var t=[];if(e){Zt.isNumber(e.PixelType)&&(t.push({capability:wH.ICAP_PIXELTYPE,curValue:e.PixelType}),rr.DWT.EnumDWT_PixelType.TWPT_BW==e.PixelType&&(t.push({capability:32771,curValue:"application/octet-stream"}),t.push({capability:32772,curValue:"application/octet-stream"})));var r=e.Resolution;r||(r=300),t.push({capability:wH.ICAP_XRESOLUTION,curValue:r}),t.push({capability:wH.ICAP_YRESOLUTION,curValue:r}),e.Brightness!==undefined&&t.push({capability:wH.ICAP_BRIGHTNESS,curValue:e.Brightness}),e.XferCount!==undefined&&t.push({capability:wH.CAP_XFERCOUNT,curValue:e.XferCount}),e.Contrast!==undefined&&t.push({capability:wH.ICAP_CONTRAST,curValue:e.Contrast}),e.TransferMode!==undefined&&t.push({capability:wH.ICAP_XFERMECH,curValue:e.TransferMode}),e.IfFeederEnabled!==undefined&&t.push({capability:wH.CAP_FEEDERENABLED,curValue:e.IfFeederEnabled?1:0}),e.IfDuplexEnabled!==undefined&&t.push({capability:wH.CAP_DUPLEXENABLED,curValue:e.IfDuplexEnabled?1:0})}return t}function WK(){var e=xK.logLevel;Zt.isNumber(e)||(xK.logLevel=-1)}Qt.removeNonPrintableChar;var RK=function(e,t,r){2==r&&Zt.each(t,(function(t,r){bG(e,t,{get:function(){return e._resetErr(),e._isValid()?fi:di},set:function(t){return e._resetErr(),e._isValid()?fi:di}})}))},NK=function(e,t){Zt.each(t,(function(t,r){fK(e,t,1,2)}))},OK=function(e,t){Zt.each(t,(function(t,r){fK(e,t,1,1)}))},MK=function(e,t){Zt.each(t,(function(t,r){fK(e,t,0)}))},LK=function(e,t){Zt.each(t,(function(t,r){fK(e,t,1)}))};function BK(e){var t=e;if(!t._bRemoteMode){bG(t,"ProductKey",{get:function(){return rr.DWT.ProductKey},set:function(e){return Zt.isString(e)?(t._resetErr(),!!t._isValid()&&t._setProductKey(e,!1)):(Sa(t),di)}}),bG(t,"ProductName",{get:function(){return t.__strProductName}}),bG(t,"VersionInfo",{get:function(){return Jo.JSVersion}}),bG(t,"DefaultSourceName",{get:function(){var e=t._getDefaultDevice();return e?e.displayName:""}}),bG(t,"ImageCaptureDriverType",{get:function(){return t._resetErr(),t._isValid()?t._driverType:0},set:function(e){var r=!1,n=!1,i=!1;if(t._bRemoteMode?t.__serverPlatform==Lo.enumWindow?i=!0:t.__serverPlatform==Lo.enumLinux?n=!0:t.__serverPlatform==Lo.enumMac&&(r=!0):(r=de.bMac,n=de.bLinux,i=de.bWin),t._resetErr(),!t._isValid())return!1;if(""!==e){var o=1*e,a=!1;if(o<pf.TWAIN||o>pf.TWAIN64)return Za(t),di;if(i){if(o===pf.TWAIN_AND_TWAIN64)t._b64bit&&(t._driverType=o);else if(o!=pf.TWAIN&&o!=pf.TWAIN64)return Za(t),di;t._b64bit||(o=pf.TWAIN),t._driverType=o,a=!0}else if(n)o=pf.SANE,t._driverType=o,a=!0;else if(r){if(o===pf.TWAIN_AND_ICA);else if(o!=pf.ICA&&o!=pf.TWAIN&&o!=pf.TWAIN64)return Za(t),di;t._driverType=o,a=!0}return a&&(t._curDevice=null,t.__devices=null),!0}return Za(t),di}}),bG(t,"HTTPPostResponseString",{get:function(){return t._resetErr(),t._isValid()&&t.__HTTPPostResponseString?t.__HTTPPostResponseString:""}}),bG(t,"IfAppendImage",{get:function(){return t._resetErr(),!!t._isValid()&&t.__IfAppendImage},set:function(e){return t._resetErr(),!!t._isValid()&&(Zt.isBoolean(e)?t.__IfAppendImage=e:(Sa(t),di))}}),bG(t,"FTPPort",{get:function(){return t._resetErr(),t._isValid()?t._innerFun("FTPPort"):0},set:function(e){if(t._resetErr(),!t._isValid())return!1;if(""!==e){var r=1*e;return t._innerFun("FTPPort",Il(r))}}}),bG(t,"JPEGQuality",{get:function(){return t._resetErr(),t._isValid()?t._innerFun("JPEGQuality"):0},set:function(e){var r=1*e;return r>=100?r=100:r<0&&(r=0),t._resetErr(),!!t._isValid()&&t._innerFun("JPEGQuality",Il(r))}}),fK(t,"TIFFCompressionType",1,1),fK(t,"BufferMemoryLimit",1,1),bG(t,"LogLevel",{get:function(){return t._resetErr(),t._isValid()?t._innerFun("LogLevel"):0},set:function(e){if(t._resetErr(),!t._isValid())return!1;var r=1*e;return t._logLevel=r,xK.logLevel=t._logLevel,t._innerFun("LogLevel",Il(r))}}),bG(t,"HttpContentTypeFieldValue",{get:function(){return t._resetErr(),t._isValid()?t._strHttpContentTypeFieldValue:""},set:function(e){return t._resetErr(),!!t._isValid()&&(t._strHttpContentTypeFieldValue=e,e)}}),bG(t,"BrokerProcessType",{get:function(){return t._resetErr(),t._isValid()?1:0},set:function(e){return t._resetErr(),!!t._isValid()}}),bG(t,"BorderStyle",{get:function(){return t._resetErr(),!!t._isValid()&&0},set:function(e){return t._resetErr(),t._isValid(),!1}}),bG(t,"HttpFieldNameOfUploadedImage",{get:function(){return t._resetErr(),t._isValid()?t.__remoteFilename:""},set:function(e){return t._resetErr(),t._isValid()?t.__remoteFilename=e:""}}),bG(t,"style",{get:function(){return t._isValid()?t.__style:""}}),bG(t,"ScaleDownThreshold",{get:function(){return t._resetErr(),t._isValid()?t._scaleDownThreshold:0},set:function(e){var r=1*e;return!Zt.isNumber(r)||isNaN(r)?(Sa(self),di):(t._resetErr(),!!t._isValid()&&(t._scaleDownThreshold=e))}}),bG(t,"CurrentImageIndexInBuffer",{get:function(){return t._isValid()&&t._ImgManager?t._ImgManager.getCurrentImageIndex():0},set:function(e){var r=1*e;return t._resetErr(),!!t._isValid()&&(r>=0&&r<t._ImgManager.count()&&(t._ImgManager.setSelectedClientIndexArray([r]),t._isBindViewer()&&IG.__innerRefreshFromUIView(t,t._ImgManager.getCurrentImageIndex())),!0)}}),bG(t,"SelectedImagesIndices",{get:function(){return t._resetErr(),t._isValid()?t._ImgManager.count()<=0?[]:t._ImgManager.getSelectedClientIndexArray():[]}}),bG(t,"MaxImagesInBuffer",{get:function(){return t._resetErr(),t._isValid()?t.__maxImagesInBuffer:0},set:function(e){var r=1*e;return t._resetErr(),!!t._isValid()&&(r>0&&r<32768?t.__maxImagesInBuffer=r:ha(t,-1010,"Data parameter out of supported range."),t.__maxImagesInBuffer)}}),bG(t,"IfSSL",{get:function(){return t._bSSL},set:function(e){return t._bSSL=e,t._innerFun("IfSSL",Il(e)),!0}}),fK(t,"IfAllowLocalCache",1,2),bG(t,"UseLocalService",{get:function(){return!0}}),bG(t,"PDFCompressionType",{get:function(){return t._resetErr(),!!t._isValid()&&t._innerFun("PDFCompressionType")},set:function(e){var r=1*e;return r==rr.DWT.EnumDWT_PDFCompressionType.PDF_FAX3&&(r=rr.DWT.EnumDWT_PDFCompressionType.PDF_FAX4),t._resetErr(),!!t._isValid()&&t._innerFun("PDFCompressionType",Il(r))}}),t._setProductKey=function(e,r,n,i){var o=!0,a=e,s=function(e){e||(t.__licenseInfo=undefined);var r=!0;return i||(r=Wc.checkProductKey(t,{Core:!0})),Zt.isFunction(n)&&n(),r};if(t._resetErr(),!t._isValid())return!1;if(ia.bUseDynamsoftLicenseManager||t._blts)return Us(t),!1;if(a=Zt.isString(a)?Zt.trim(a):"",rr.DWT.ProductKey=a,""==a)o=!1,s();else{Wc.reparseProductKey();var u=rr.DWT.licenseException;if(0!=u.code)return t.__licenseInfo=undefined,t._errorCode=u.code,t._errorString=u.message,Zt.isFunction(n)&&n(),!1;t._innerFunRaw("ProductKey",Il(a),r,!1,!1,(function(e){var n=!1;n=Zt.isArray(e)?e[0]:e,Zt.isArray(e)&&e.length>=3&&"1"===e[1]&&Zt.isFunction(rr.DWT.ShowMessage)&&rr.DWT.ShowMessage(e[2],{width:510,height:272,headerStyle:1,seconds:10}),r||(o=n),t.__licenseInfo=undefined,t.GetLicenseInfo((function(){t._setConvertMode(t._pdfConvertMode),s(!0)}),s)}),(function(){r||(o=!1),s()}))}return o},LK(t,["ProxyServer"]);LK(t,["CapValueString","CapDescription","FTPPassword","FTPUserName","PDFAuthor","PDFCreationDate","PDFCreator","PDFKeywords","PDFModifiedDate","PDFProducer","PDFSubject","PDFTitle","PDFVersion"]),MK(t,["Manufacturer","ProductFamily","ImageBitsPerPixel","ImageLength","ImageWidth","ImageXResolution","ImageYResolution"]);MK(t,["BlankImageCurrentStdDev","CapDefaultIndex","CapDefaultValue","DataSourceStatus","Duplex","PendingXfers","ImageLayoutDocumentNumber","ImageLayoutFrameBottom","ImageLayoutFrameLeft","ImageLayoutFrameNumber","ImageLayoutFrameRight","ImageLayoutFrameTop","ImageLayoutPageNumber","ImagePixelType","MagData","MagType","IfFeederLoaded","IfPaperDetectable","IfUIControllable"]),NK(t,["AllowPluginAuthentication","IfModalUI","IfScanInNewThread","_AutoCropMethod","IfSortBySelectionOrder"]);NK(t,["IfDisableSourceAfterAcquire","IfDuplexEnabled","IfFeederEnabled","IfPASVMode","IfAutoBright","IfAutoDiscardBlankpages","IfAutoFeed","IfAutomaticBorderDetection","IfAutomaticDeskew","IfAutoScan","IfShowIndicator","IfUseTwainDSM","IfTiffMultiPage"]),OK(t,["MaxInternetTransferThreads"]);OK(t,["BlankImageMaxStdDev","BlankImageThreshold","BitDepth","Brightness","PageSize","PixelType","Resolution","Capability","CapCurrentIndex","CapCurrentValue","CapMaxValue","CapMinValue","CapNumItems","CapStepSize","CapType","CapValue","CapValueType","Contrast","PixelFlavor","TransferMode","Unit","XferCount"]),RK(t,["AsyncMode","EnableInteractiveZoom","IfThrowException","ImageEditorIfEnableEnumerator","ImageEditorIfReadonly","ImageEditorIfModal","ImageEditorWindowTitle","IfShowPrintUI","VScrollBar"],2);RK(t,["IfOpenImageWithGDIPlus"])}}Qt.DynamicLoadAddonFuns=[],Qt.attachAddon=function(e){var t=!1;return Zt.each(Qt.DynamicLoadAddonFuns,(function(r){Zt.isFunction(r)&&(r(e),t=!0)})),!oa.bFullEdition&&e.__addon&&delete e.__addon.Camera,t};var UK=s((function HJ(e,t,r){o(this,HJ),this.Url=e,this.Width=t,this.Height=r})),VK=function(){return s((function t(e){o(this,t),this._stwain=e,this._ImgManager=e._ImgManager}),[{key:"Print",value:function(){var e=this;if(e.count()<=0)return!1;var t,r=[];for(t=0;t<e.count();t++)r.push(t);return e.PrintEx(r)}},{key:"PrintCurrentImage",value:function(){var e,t,r,n=this;if(!((e=n._ImgManager.getCurrentImageIndex())<0))return-1==(r=n._ImgManager.convertClientIndexToServerId(e))?(Ka(n),!1):(t=pl.getImageUrl(n._ImgManager.getBaseUrl,r,-1,-1),n.__PrintInner(t,r,e))}},{key:"PrintEx",value:function(e){var t=this;if(!(t.count()<=0)){var r=[];return rr.DWT.ConnectWithSocket?t.__GetPrintUrlforSocket(e,r):t.__GetPrintUrlforHttp(e,r),!0}}},{key:"__PrintInner",value:function(e,t,r){var n=this,i=n._ImgManager.getImageIdMap(t),o=[];if(!i)return!1;var a=Zt.clone(i),s=a.width;(Zt.isUndefined(a.width)||a.width<=0)&&(a.width=n.getImageWidthFromServer(r));var u=a.height;(Zt.isUndefined(a.height)||a.height<=0)&&(a.height=n.getImageHeightFromServer(r));var c=new UK(e,a.width,a.height);return o.push(c),a.width=s,a.height=u,pl.print(o),!0}},{key:"__GetPrintUrl",value:function(e,t,r){var n,i,o=this,a=0,s=0;return(n=o._ImgManager.getImageIdMap(t))&&(!n.width||n.width<=0?n.width=o.getImageWidthFromServer(r):a=n.width,!n.height||n.height<=0?n.height=o.getImageHeightFromServer(r):s=n.height,i=new UK(e,n.width,n.height),n.width=a,n.height=s),i}},{key:"__GetPrintUrlforHttp",value:(e=n(g().mark((function r(e,t){var n,i,o,a,s,u,c,l,d,f;return g().wrap((function(r){for(;;)switch(r.prev=r.next){case 0:n=this,i=0;case 2:if(!(i<e.length)){r.next=23;break}if(o=e[i],-1==(a=n._ImgManager.convertClientIndexToServerId(o))){r.next=20;break}if(s=void 0,!(rr.navInfoSync.bMac&&rr.navInfoSync.bSafari||rr.navInfoSync.bFirefox)){r.next=17;break}if(!(u=n._stwain._ImgManager.getImageIdMap(a))){r.next=17;break}if(!(c=u.uuid)||-1==c){r.next=17;break}return r.next=14,n._stwain.Viewer.webViewer.myDvs.getImageData(c,{type:"blob"});case 14:l=r.sent,d=window.URL||window.webkitURL,s=d.createObjectURL(l);case 17:s||(s=pl.getImageUrl(n._ImgManager.getBaseUrl,a,-1,-1)),f=n.__GetPrintUrl(s,a,o),t.push(f);case 20:i++,r.next=2;break;case 23:pl.print(t);case 24:case"end":return r.stop()}}),r,this)}))),function(t,r){return e.apply(this,arguments)})},{key:"__GetPrintUrlforSocket",value:function(e,t){var r,n=this,i=ci.Promise.resolve(0),o=0;return Zt.each(e,(function(a){i=i.then((function(){var i=n._ImgManager.convertClientIndexToServerId(a);-1!=i&&n._ImgManager.getImageData(a).then((function(s){if(o++,!s){var u={};return ya(u),void Ho(u._errorString)}r=bl(s.oriData)?URL.createObjectURL(new Blob([s.oriData])):s.oriData instanceof Blob?URL.createObjectURL(s.oriData):s.oriData;var c=n.__GetPrintUrl(r,i,a);t.push(c),e.length==o&&pl.print(t)}))}))})),!0}},{key:"__GetPrintUrlforMobileEx",value:function(e,t){var r,n=this,i=ci.Promise.resolve(0),o=0;return Zt.each(e,(function(a){i=i.then((function(){var i=n._ImgManager.convertClientIndexToServerId(a);-1!=i&&n._ImgManager.getImageData(a).then((function(s){if(o++,!s){var u={};return ya(u),void Ho(u._errorString)}r=bl(s.oriData)?URL.createObjectURL(new Blob([s.oriData])):s.oriData instanceof Blob?URL.createObjectURL(s.oriData):s.oriData;var c=n.__GetPrintUrl(r,i,a);t.push(c),e.length==o&&pl.print(t)}))}))})),!0}},{key:"count",value:function(){return this._ImgManager.count()}},{key:"getImageHeightFromServer",value:function(e){var t,r,n,i=this,o=1*e;return t=i.count(),o<0||o>t?0:(n=i._ImgManager.convertClientIndexToServerId(o),(r=i._ImgManager.getImageIdMap(n))&&r.imageHeight?r.imageHeight:i._stwain.GetImageHeight(o))}},{key:"getImageWidthFromServer",value:function(e){var t,r,n,i=this,o=1*e;return t=i.count(),o<0||o>t?0:(n=i._ImgManager.convertClientIndexToServerId(o),(r=i._ImgManager.getImageIdMap(n))&&r.imageWidth?r.imageWidth:i._stwain.GetImageWidth(o))}}]);var e}();function jK(e,t){(function(e,t){if(t.has(e))throw new TypeError("Cannot initialize the same private elements twice on an object")})(e,t),t.add(e)}function GK(e,t,r){if("function"==typeof e?e===t:e.has(t))return arguments.length<3?t:r;throw new TypeError("Private element is not present on this object")}Qt.detect.viewerScriptLoaded=fi;var HK=new WeakSet,zK=function(e){function t(e){var r,n,a;return o(this,t),jK(r=i(this,t,[e]),HK),r._ImgManager=new lH(r,r._imageBufferWrapper),r._imageBufferWrapper=r._ImgManager,r._ImagePrint=new VK(r),n=e||{},r._config=n,r._destroying=di,r._iServiceType=tz.TwainService,r.__addon={},r._bNoMask=di,r._bNotShowMessage=di,r._bSelectedSourceByServer=di,r._bKeepAwake=di,r._bAx=di,n.container&&(r._containerElement=n.container),r.__IfShowCancelDialogWhenImageTransfer=fi,r._errorCode=0,r._errorString="",r.__bLoadingImage=di,r.__bAcquireImageNow=di,r.__bOpenFileNow=di,r.__defaultSourceName="",r.__sourceCount=0,r._bConnecting=di,r.__licenseInfo=undefined,r.__strProductName=rr.DWT.ProductName,r.__productKey="",r._moduleSize=1048576,r._driverType=pf.TWAIN,r.__maxUploadImageSize=-1,r._bServerPercentDone=fi,r._bSSL=de.bSSL,r._bRegistedLoad=!1,r._logLevel=0,r._scaleDownThreshold=0,r._pdfWriteSetting={},r.__serverPlatform=Lo.enumUnknown,r._reconnectTimeSpan=oa.LocaleReconnectTimeSpan,r._bRemoteMode||(r.httpFormFields={},r.HTTPPassword="",r.HTTPPort=Qt.detect.ssl?443:80,r.HTTPUserName="",r.__HTTPPostResponseString="",r.__remoteFilename="RemoteFile",r.__httpHeaderMap=di,r._b64bit?r._segementUploadThreshold=4294967296:r._segementUploadThreshold=524288e3,r._aryTiffTag=[],r._tiffCompressionType=rr.DWT.EnumDWT_TIFFCompressionType.TIFF_AUTO,r._jpgQuality=80,r._pdfConvertMode=3,r._pdfOptions={convertMode:nc.CM_AUTO,password:"",renderOptions:{renderAnnotations:!1,resolution:200,maxWidth:0,maxHeight:0,renderGrayscale:!1}}),BK(r),bG(a=r,"Width",{get:function(){return a._resetErr(),a._isValid()?a._isNoViewer()?(a._nouiNotSupport("Width"),""):a._UIView.GetWidth():""},set:function(e){return a._resetErr(),!!a._isValid()&&(a._isNoViewer()?a._nouiNotSupport("Width"):a._UIView.SetWidth(e))}}),bG(a,"Height",{get:function(){return a._resetErr(),a._isValid()?a._isNoViewer()?(a._nouiNotSupport("Height"),""):a._UIView.GetHeight():""},set:function(e){return a._resetErr(),!!a._isValid()&&(a._isNoViewer()?a._nouiNotSupport("Height"):a._UIView.SetHeight(e))}}),bG(a,"AllowMultiSelect",{get:function(){return a._resetErr(),a._isValid()?a._isNoViewer()?a._nouiNotSupport("AllowMultiSelect"):a._UIView.GetAllowMultiSelect():""},set:function(e){return a._resetErr(),!!a._isValid()&&(a._isNoViewer()?a._nouiNotSupport("AllowMultiSelect"):void a._UIView.SetAllowMultiSelect(e))}}),bG(a,"BackgroundColor",{get:function(){return a._resetErr(),a._isValid()?a._isNoViewer()?(a._nouiNotSupport("BackgroundColor"),""):a._UIView.GetBackgroundColor():""},set:function(e){return a._resetErr(),!!a._isValid()&&(a._isNoViewer()?a._nouiNotSupport("BackgroundColor"):a._UIView.SetBackgroundColor(e))}}),bG(a,"BackgroundFillColor",{get:function(){if(a._resetErr(),!a._isValid())return"";if(a._isNoViewer())return a._nouiNotSupport("BackgroundFillColor"),"";var e=a._innerFun("BackgroundFillColor");return li.BGR2RGB(e)},set:function(e){if(a._resetErr(),!a._isValid())return!1;if(a._isNoViewer())return a._nouiNotSupport("BackgroundFillColor");var t,r=1*e;return!Zt.isNumber(r)||Zt.isNaN(r)?(Sa(a),di):(t=li.RGB2BGR(r),a._innerFun("BackgroundFillColor",Il(t)))}}),bG(a,"FitWindowType",{get:function(){return a._resetErr(),!!a._isValid()&&(a._isNoViewer()?(a._nouiNotSupport("FitWindowType"),0):a._UIView.GetFitWindowType())},set:function(e){if(a._resetErr(),!a._isValid())return!1;if(a._isNoViewer())return a._nouiNotSupport("FitWindowType");var t=1*e;return a._UIView.SetFitWindowType(t)}}),bG(a,"IfFitWindow",{get:function(){return a._resetErr(),!!a._isValid()&&(a._isNoViewer()?a._nouiNotSupport("IfFitWindow"):a._UIView.GetIfFitWindow())},set:function(e){return a._resetErr(),!!a._isValid()&&(a._isNoViewer()?a._nouiNotSupport("IfFitWindow"):e?a._UIView.SetIfFitWindow(!0):a._UIView.SetIfFitWindow(!1))}}),bG(a,"ImageMargin",{get:function(){return a._resetErr(),a._isValid()?a._isNoViewer()?(a._nouiNotSupport("ImageMargin"),0):a._UIView.GetImageMargin():0},set:function(e){if(a._resetErr(),!a._isValid())return!1;if(a._isNoViewer())return a._nouiNotSupport("ImageMargin");var t=parseInt(e);return!isNaN(t)&&a._UIView.SetImageMargin(t)}}),bG(a,"MouseX",{get:function(){return a._resetErr(),a._isValid()?a._isNoViewer()?(a._nouiNotSupport("MouseX"),0):a.__MouseX:0}}),bG(a,"MouseY",{get:function(){return a._resetErr(),a._isValid()?a._isNoViewer()?(a._nouiNotSupport("MouseY"),0):a.__MouseY:0}}),bG(a,"SelectionImageBorderColor",{get:function(){return a._resetErr(),a._isValid()?a._isNoViewer()?(a._nouiNotSupport("SelectionImageBorderColor"),""):a._UIView.GetSelectionImageBorderColor():""},set:function(e){return a._resetErr(),!!a._isValid()&&(a._isNoViewer()?a._nouiNotSupport("SelectionImageBorderColor"):a._UIView.SetSelectionImageBorderColor(e))}}),bG(a,"Zoom",{get:function(){return a._resetErr(),a._isValid()?a._isNoViewer()?(a._nouiNotSupport("Zoom"),0):a._UIView.GetZoom():0},set:function(e){return a._resetErr(),!!a._isValid()&&(a._isNoViewer()?a._nouiNotSupport("Zoom"):a._UIView.SetZoom(e))}}),bG(a,"MouseShape",{get:function(){return a._resetErr(),!!a._isValid()&&(a._isNoViewer()?a._nouiNotSupport("MouseShape"):a._UIView.GetMouseShape())},set:function(e){return a._resetErr(),!!a._isValid()&&(a._isNoViewer()?a._nouiNotSupport("MouseShape"):a._UIView.SetMouseShape(e))}}),bG(a,"SelectionRectAspectRatio",{get:function(){return a._resetErr(),a._isValid()?a._isNoViewer()?(a._nouiNotSupport("SelectionRectAspectRatio"),0):a._UIView.GetSelectionRectAspectRatio():0},set:function(e){if(a._resetErr(),!a._isValid())return!1;if(a._isNoViewer())return a._nouiNotSupport("SelectionRectAspectRatio");var t=parseFloat(e);return t>=0&&(a._UIView.SetSelectionRectAspectRatio(t),!0)}}),bG(a,"ShowPageNumber",{get:function(){return a._resetErr(),!!a._isValid()&&(a._isNoViewer()?a._nouiNotSupport("ShowPageNumber"):a._UIView.GetShowPageNumber())},set:function(e){return a._resetErr(),!!a._isValid()&&(a._isNoViewer()?a._nouiNotSupport("ShowPageNumber"):a._UIView.SetShowPageNumber(e))}}),bG(a,"IfAutoScroll",{get:function(){return a._resetErr(),!!a._isValid()&&(a._isNoViewer()?a._nouiNotSupport("IfAutoScroll"):a._UIView.GetIfAutoScroll())},set:function(e){return a._resetErr(),!!a._isValid()&&(a._isNoViewer()?a._nouiNotSupport("IfAutoScroll"):a._UIView.SetIfAutoScroll(e))}}),r._innerInitEvents(n),r}return f(t,e),s(t,[{key:"GetImageDataAsync",value:function(e){return this._ImgManager.getImageData(e)}},{key:"SetCustomDataAsync",value:function(e,t){return this._ImgManager.setCustomData(e,t)}},{key:"style",get:function(){return this.__style}},{key:"GetSourceNamesAsync",value:(a=n(g().mark((function u(e){var t;return g().wrap((function(r){for(;;)switch(r.prev=r.next){case 0:if((t=this)._resetErr(),t._isValid()){r.next=4;break}throw{code:t._errorCode,message:t._errorString};case 4:return Wl("GetSourceNamesAsync",t),r.prev=5,r.next=8,t._getSourceCountAsync(t._driverType);case 8:r.next=13;break;case 10:throw r.prev=10,r.t0=r["catch"](5),r.t0;case 13:return r.prev=13,Rl("GetSourceNamesAsync"),r.finish(13);case 16:if(!e){r.next=20;break}return r.abrupt("return",GK(HK,t,KK).call(t));case 20:return r.abrupt("return",GK(HK,t,JK).call(t));case 21:case"end":return r.stop()}}),u,this,[[5,10,13,16]])}))),function(e){return a.apply(this,arguments)})},{key:"SelectSourceAsync",value:function(e){var t;return t=eH.dialogText.selectSource,this._selectSourceAsync("SelectSourceAsync",e,t)}},{key:"SelectSourceByIndexAsync",value:function(e){return this._selectSourceByIndexAsync("SelectSourceByIndex",e)}},{key:"OpenSourceAsync",value:function(){return this._openSourceAsync("OpenSourceAsync")}},{key:"CloseSourceAsync",value:function(){return this._closeSourceAsync("CloseSourceAsync")}},{key:"OpenSourceManagerAsync",value:function(){var e=this;return e._resetErr(),e._isValid()?e._innerFunV2("OpenSourceManager"):Qt.Promise.reject({code:e._errorCode,message:e._errorString})}},{key:"CloseSourceManagerAsync",value:function(){var e=this;return e._resetErr(),e._isValid()?e._innerFunV2("CloseSourceManager"):Qt.Promise.reject({code:e._errorCode,message:e._errorString})}},{key:"AcquireImage",value:function(e,t,r){var n,i=this,o=null,a=null;return i._resetErr(),!!i._isValid()&&(Zt.isUndefined(r)&&(Zt.isFunction(e)&&Zt.isFunction(t)||Zt.isFunction(e)&&Zt.isUndefined(t)||Zt.isFunction(e)&&null==t||null==e&&Zt.isFunction(t))?(n={},Zt.isFunction(e)&&(o=e),Zt.isFunction(t)&&(a=function(e){e&&e.code&&(i._errorCode=e.code,i._errorString=e.message),t(i._errorCode,i._errorString)})):(n=Zt.isUndefined(e)||null==e?{}:Zt.clone(e),Zt.isFunction(t)&&(o=function(){t(n)}),Zt.isFunction(r)&&(a=function(e){e&&e.code&&(i._errorCode=e.code,i._errorString=e.message),r(n,i._errorCode,i._errorString)})),o||(o=function(){}),a||(a=function(e){e&&e.code&&(i._errorCode=e.code,i._errorString=e.message)}),i.AcquireImageAsync(n).then(o,a),!Zd.isServerInvalid(i))}},{key:"GetDevicesAsync",value:function(e,t,r){return this._getDevicesAsync("GetDevicesAsync",e,t,r)}},{key:"SelectDeviceAsync",value:function(e,t){var r=this;return r._resetErr(),r._isValid()?this._selectDeviceAsync("SelectDeviceAsync",e,t):Qt.Promise.reject({code:r._errorCode,message:r._errorString})}},{key:"AcquireImageAsync",value:function(e){return l(d(t.prototype),"_acquireImage",this).call(this,this._curDevice,e)}},{key:"ImageIDToIndex",value:function(e){return this._uidFromServer2index(e)}},{key:"IndexToImageID",value:function(e){return this._index2uidFromServer(e)}},{key:"RemoveImage",value:function(e){return this._removeImage("RemoveImage",e)}},{key:"_innerGetSourceNamesSync",value:function(e){var t=this;return t._getSourceCountSync(),e?GK(HK,t,KK).call(t):GK(HK,t,JK).call(t)}},{key:"getCapabilities",value:function(e,t,r){var n,i,o,a=this;if(Qt.isFunction(e)?(i=e,o=t):(n=e,i=t,o=r),!Zt.isUndefined(n)){if(!Zt.isArray(n))return rs(a),void(Zt.isFunction(o)&&o(a._errorCode,a._getErrorString()));if(Zt.isArray(n)&&n.indexOf(null)>=0)return rs(a),void(Zt.isFunction(o)&&o(a._errorCode,a._getErrorString()));if(Zt.isString(n)&&0==n.trim().length)return rs(a),void(Zt.isFunction(o)&&o(a._errorCode,a._getErrorString()))}return this._dwtGetCapabilities(n,i,o)}},{key:"setCapabilities",value:function(e,t,r){return this._dwtSetCapabilities(e,t,r)}},{key:"CancelAllPendingTransfers",value:function(){return this._resetErr(),!!this._isValid()&&this._innerFun("CancelAllPendingTransfers")}},{key:"CloseSource",value:function(){var e=this;if(e._resetErr(),!e._isValid())return!1;var t=e._innerFun("CloseSource");return t&&(e._curDevice=null),t}},{key:"CloseSourceManager",value:function(){var e=this;return e._resetErr(),!!e._isValid()&&e._innerFun("CloseSourceManager")}},{key:"SelectDevice",value:function(e,t){var r,n=this;if(e&&e.deviceType,n._resetErr(),rr.DWT.ConnectWithSocket)return ha(n,-2400,"SelectDevice"+" doesn't work under current settings."),!1;var i,o=null===(r=this._dmService.attrs)||void 0===r?void 0:r.UUID;if(o)if((null===(i=e.serviceInfo.attrs)||void 0===i?void 0:i.UUID)==o);else{var a,s=(null===(a=e.serviceInfo.attrs)||void 0===a?void 0:a.url)||e.serviceInfo.server;if(!(s&&s.indexOf(o)>-1))return hs(n),!1}var u=!1;try{(u=GK(HK,this,QK).call(this,e.strDevice,t))&&(this._curDevice=e,this._bSelectedSourceByServer=!1)}catch(c){u=!1,this._errorCode=_a.CommonError,c&&c.message&&(this._errorString=c.message)}return u}},{key:"DisableSource",value:function(){var e=this;return e._resetErr(),!!e._isValid()&&e._innerFun("DisableSource")}},{key:"FeedPage",value:function(){var e=this;return e._resetErr(),!!e._isValid()&&e._innerFun("FeedPage")}},{key:"GetDeviceType",value:function(){var e=this;return e._resetErr(),!!e._isValid()&&e._innerFun("GetDeviceType")}},{key:"GetSourceNameItems",value:function(e){var t=this;return t._resetErr(),!!t._isValid()&&(t.__sourceCount<0&&(t.__sourceCount=0),e<t.__sourceCount&&e>=0?t._getSourceNameByIndex(e):"")}},{key:"SourceNameItems",value:function(e){var t=this;return t._resetErr(),!!t._isValid()&&t.GetSourceNameItems(e)}},{key:"GetSourceNames",value:function(e){return this._innerGetSourceNamesSync(e)}},{key:"getSourceCount",value:function(e){return this._getSourceCountAsync(e)}},{key:"GetSourceCountAsync",value:function(e){return this._getSourceCountAsync(e)}},{key:"GetSourceType",value:function(e){var t=this,r=parseInt(e);if(t._resetErr(),isNaN(r))return rs(t),!1;if(null==t.__devices&&t.GetSourceNames(!1),r>=t.__devices.length||r<0)return Ka(t),!1;var n,i,o,a=t.__devices[r];return n=a.deviceType,i=pf.TWAIN,(o=n&El)==Tl.TWAINSCANNER||o==Tl.WIATWAINSCANNER||(o==Tl.TWAINX64SCANNER?i=pf.TWAIN64:o==Tl.ICASCANNER?i=pf.ICA:o==Tl.SANESCANNER?i=pf.SANE:(o&Tl.TWAINX64SCANNER)==Tl.TWAINX64SCANNER?(o&Tl.TWAINSCANNER)!=Tl.TWAINSCANNER&&(o&Tl.WIATWAINSCANNER)!=Tl.WIATWAINSCANNER||(i=pf.TWAIN_AND_TWAIN64):(o&Tl.ICASCANNER)==Tl.ICASCANNER&&((o&Tl.TWAINSCANNER)!=Tl.TWAINSCANNER&&(o&Tl.WIATWAINSCANNER)!=Tl.WIATWAINSCANNER||(i=pf.TWAIN_AND_ICA))),i}},{key:"OpenSource",value:function(){var e=this;return e._resetErr(),!!e._isValid()&&(e._bRemoteMode?(ha(e,-2610,"OpenSource is not supported when Object is created by CreateRemoteScanObjectAsync. Please use OpenSourceAsync instead."),!1):e._innerFun("OpenSource"))}},{key:"OpenSourceManager",value:function(){var e=this;return e._resetErr(),!!e._isValid()&&e._innerFun("OpenSourceManager")}},{key:"ResetImageLayout",value:function(){var e=this;return e._resetErr(),!!e._isValid()&&e._innerFun("ResetImageLayout")}},{key:"RewindPage",value:function(){var e=this;return e._resetErr(),!!e._isValid()&&e._innerFun("RewindPage")}},{key:"SelectSource",value:function(e,t){var r=this,n=!1;if(Zt.isFunction(e)&&(n=!0),r._resetErr(),!r._isValid())return!!n&&void 0;var i=pf.TWAIN;if(!n){if(r._bRemoteMode)return ha(r,-2438,"SelectSource cannot be used synchronously when Object is created by CreateRemoteScanObjectAsync. Please use SelectSourceAsync instead."),!1;if(r._driverType==pf.TWAIN_AND_TWAIN64)return function(e){ha(e,-2429,"The method SelectSource() must be invoked asynchronously (i.e. with callback functions) when ImageCaptureDriverType is set to TWAIN_AND_ICA or TWAIN_AND_TWAIN64.")}(r),!1;r._driverType!=pf.ICA&&r._driverType!=pf.SANE&&r._driverType!=pf.TWAIN64||(i=r._driverType);var o=de.bMac,a=de.bLinux,s=_f(i,de.bWin,a,o,de.bAndroid);return r._bSelectedSourceByServer=!0,r._curDevice=null,r._innerFun("SelectSource",Il(s))}r._driverType!=pf.ICA&&r._driverType!=pf.SANE&&r._driverType!=pf.TWAIN64&&r._driverType!=pf.TWAIN_AND_TWAIN64||(i=r._driverType);var u=de.bMac,c=de.bLinux,l=_f(i,de.bWin,c,u,de.bAndroid);r.SelectSourceAsync(l).then((function(){Zt.isFunction(e)&&e()}),(function(e){e&&e.code&&(r._errorCode=e.code,r._errorString=e.message),Zt.isFunction(t)&&t(r._errorCode,r._getErrorString())}))}},{key:"GetSourceTypeAsync",value:function(e){var t=this,r=1*e;return t._resetErr(),t._isValid()?Qt.Promise.resolve(t.GetSourceType(r)):Qt.Promise.reject({code:t._errorCode,message:t._errorString})}},{key:"SetFileXferInfo",value:function(e,t){var r,n,i=this;return i._resetErr(),!!i._isValid()&&(r=de.bFileSystem?e.replace(/<%/g,"<%25"):e,n=vf.replaceLocalFilename(r),i._innerFun("SetFileXferInfo",Il(n,t)))}},{key:"SetImageLayout",value:function(e,t,r,n){var i=this;return i._resetErr(),!!i._isValid()&&i._innerFun("SetImageLayout",Il(e,t,r,n))}},{key:"CapGet",value:function(){return this._resetErr(),!!this._isValid()&&this._innerFun("CapGet")}},{key:"CapGetCurrent",value:function(){return this._resetErr(),!!this._isValid()&&this._innerFun("CapGetCurrent")}},{key:"CapGetDefault",value:function(){return this._resetErr(),!!this._isValid()&&this._innerFun("CapGetDefault")}},{key:"CapGetFrameBottom",value:function(e){return this._resetErr(),!!this._isValid()&&this._innerFun("CapGetFrameBottom",Il(e))}},{key:"CapGetFrameLeft",value:function(e){return this._resetErr(),!!this._isValid()&&this._innerFun("CapGetFrameLeft",Il(e))}},{key:"CapGetFrameRight",value:function(e){return this._resetErr(),!!this._isValid()&&this._innerFun("CapGetFrameRight",Il(e))}},{key:"CapGetFrameTop",value:function(e){return this._resetErr(),!!this._isValid()&&this._innerFun("CapGetFrameTop",Il(e))}},{key:"CapGetHelp",value:function(){return this._resetErr(),!!this._isValid()&&this._innerFun("CapGetHelp")}},{key:"CapGetLabel",value:function(){return this._resetErr(),!!this._isValid()&&this._innerFun("CapGetLabel")}},{key:"CapGetLabels",value:function(){return this._resetErr(),!!this._isValid()&&this._innerFun("CapGetLabels")}},{key:"CapIfSupported",value:function(e){return this._resetErr(),!!this._isValid()&&this._innerFun("CapIfSupported",Il(e))}},{key:"CapReset",value:function(){return this._resetErr(),!!this._isValid()&&this._innerFun("CapReset")}},{key:"CapSet",value:function(){return this._resetErr(),!!this._isValid()&&this._innerFun("CapSet")}},{key:"CapSetFrame",value:function(e,t,r,n,i){return this._resetErr(),!!this._isValid()&&this._innerFun("CapSetFrame",Il(e,t,r,n,i))}},{key:"GetCapItems",value:function(e){return this._resetErr(),!!this._isValid()&&this._innerFun("GetCapItems",Il(e))}},{key:"GetCapItemsString",value:function(e){return this._resetErr(),!!this._isValid()&&this._innerFun("GetCapItemsString",Il(e))}},{key:"SetCapItems",value:function(e,t){return this._resetErr(),!!this._isValid()&&this._innerFun("SetCapItems",Il(e,t))}},{key:"SetCapItemsString",value:function(e,t){return this._resetErr(),!!this._isValid()&&this._innerFun("SetCapItemsString",Il(e,t))}},{key:"GenerateURLForUploadData",value:function(e,t,r,n,i){var o=this,a=[];if(t==rr.DWT.EnumDWT_ImageType.IT_BMP||t==rr.DWT.EnumDWT_ImageType.IT_JPG||t==rr.DWT.EnumDWT_ImageType.IT_PNG){if(!Zt.isArray(e))return za(o),Zt.isFunction(n)&&n(o._errorCode,o._getErrorString(),"",e,t),"";if(e.length>1)return ja(o),Zt.isFunction(n)&&n(o._errorCode,o._getErrorString(),"",e,t),"";if(!o._checkIndices(e))return n(o._errorCode,o._getErrorString(),"",e,t),!1;var s=o._ImgManager.convertClientIndexToServerId(e[0]);-1!=s&&a.push(s)}else{if(t!=rr.DWT.EnumDWT_ImageType.IT_TIF&&t!=rr.DWT.EnumDWT_ImageType.IT_PDF)return Zt.isArray(e)?Qa(o):za(o),Zt.isFunction(n)&&n(o._errorCode,o._getErrorString(),o.__HTTPPostResponseString,e,t),"";var u,c;if(Zt.isArray(e)){if(!o._checkIndices(e))return n(o._errorCode,o._getErrorString(),"",e,t),!1;u=e}else{if(-1!=e)return za(o),Zt.isFunction(n)&&n(o._errorCode,o._getErrorString(),o.__HTTPPostResponseString,e,t),"";for(u=[],c=0;c<o._ImgManager.count();c++)u.push(c)}Zt.each(u,(function(e){var t=o._ImgManager.convertClientIndexToServerId(e);-1!=t&&a.push(t)}))}if(Zt.isFunction(r)&&Zt.isFunction(n)){return o._asyncGenerateURLForUploadData(a,t,i,r,(function(e){n(o._errorCode,o._getErrorString(),o.__HTTPPostResponseString,e,t)})),!0}return this._syncGenerateURLForUploadData(a,t,i)}},{key:"_syncGenerateURLForUploadData",value:function(e,t,r){var n,i=this,o=!1,a=na.managerVersion.join(""),s=r,u=",";Zt.isString(s)&&""!=s||(s="",u="");var c=["[",'"dcp","dwasm_'+a,'",',t,',"',e.join(","),'"',u,s,"]"].join("");if((n=this._innerFunRaw("GenerateURLForUploadData",c,!1,!1,!0))&&Zt.isArray(n.result)&&n.result.length>1){var l=n.result[0],d=n.result[1];1==l&&(o=["dcp://dwasm_",a,"/file/",d].join(""))}return Zt.isArray(e)&&Zt.each(e,(function(e){i._ImgManager.convertServerIdToClientIndex(e)})),0==o?(Xa(i),""):o}},{key:"_asyncGenerateURLForUploadData",value:function(e,t,r,n,i){var o=this,a=t,s=function(){if(Zt.isFunction(i)){var t=[];Zt.isArray(e)&&Zt.each(e,(function(e){var r=o._ImgManager.convertServerIdToClientIndex(e);r>-1&&t.push(r)})),i(t)}return""},u=",";if(a==rr.DWT.EnumDWT_ImageType.IT_BMP||a==rr.DWT.EnumDWT_ImageType.IT_JPG||a==rr.DWT.EnumDWT_ImageType.IT_PNG){if(e.length>1)return ja(o),s(),""}else if(a!=rr.DWT.EnumDWT_ImageType.IT_TIF&&a!=rr.DWT.EnumDWT_ImageType.IT_PDF)return Qa(o),s(),"";var c=!1,l=na.managerVersion.join(""),d=r;Zt.isString(d)&&""!=d||(d="",u="");var f=["[",'"dcp","dwasm_'+l,'",',a,',"',e.join(","),'"',u,d,"]"].join("");return this._innerFunRaw("GenerateURLForUploadData",f,!0,!1,!0,(function(r){if(r&&Zt.isArray(r.result)&&r.result.length>0)if(1==r.result[0]&&r.result.length>1){var i=r.result[1];c=["dcp://dwasm_",l,"/file/",i].join("")}else r.exception!==undefined&&r.description!==undefined?(o._errorCode=r.exception,o._errorString=r.description):Xa(o);else Xa(o);if(0==c)return s(),"";if(Zt.isFunction(n)){var a=[];Zt.isArray(e)&&Zt.each(e,(function(e){var t=o._ImgManager.convertServerIdToClientIndex(e);t>-1&&a.push(t)})),n(c,a,t)}return c}),s)}},{key:"SelectSourceByIndex",value:function(e){var t=this,r=parseInt(e);if(t._resetErr(),isNaN(r))return rs(t),!1;if(null==t.__devices&&t.GetSourceNames(!1),r>=t.__devices.length||r<0)return Ka(t),!1;var n=t.__devices[r];return t.SelectDevice(n)}},{key:"EnableSource",value:function(e,t,r){var n=this;return n._resetErr(),!!n._isValid()&&n.AcquireImage(e,t,r)}},{key:"SourceCount",get:function(){return this._getSourceCountSync()}},{key:"CurrentSourceName",get:function(){return this._curDevice?this._curDevice.displayName:""}},{key:"checkStartScanParams",value:function(e,t){var r=this;if(!e)return ha(r,-2381,"scanSetup is invalid."),!1;if(!Zt.isUndefined(t.transferMode)&&0!=e.transferMode&&1!=e.transferMode&&2!=e.transferMode)return function(e){ha(e,-2382,"Scanner setup error: Invalid Transfer Mode.")}(r),!1;if(e.transferMode==rr.DWT.EnumDWT_TransferMode.TWSX_FILE){if(!e.fileXfer)return function(e){ha(e,-2383,"Scanner setup error: fileXfer is invalid.")}(r),!1;if(!Zt.isString(e.fileXfer.fileName)||""==e.fileXfer.fileName)return function(e){ha(e,-2384,"Scanner setup error: Invalid fileName in fileXfer.")}(r),!1;if(!Zt.isNumber(e.fileXfer.fileFormat)||e.fileXfer.fileFormat<0||e.fileXfer.fileFormat>16)return function(e){ha(e,-2385,"Scanner setup error: Invalid fileFormat in fileXfer.")}(r),!1}if(t){if(!Zt.isString(t.type)||""==t.type)return function(e){ha(e,-2387,"Output setup error: Invalid type in outputSetup.")}(r),!1;if(!t.httpParams)return function(e){ha(e,-2386,"Output setup error: Invalid httpParams in outputSetup.")}(r),!1;if(e.transferMode!=rr.DWT.EnumDWT_TransferMode.TWSX_FILE&&Zt.isUndefined(t.format))return function(e){ha(e,-2390,"Output setup error: Invalid format in outputSetup.")}(r),!1;if(!Zt.isString(t.httpParams.url)||""==t.httpParams.url)return function(e){ha(e,-2388,"Output setup error: Invalid url in outputSetup.httpParams.")}(r),!1;if(!Zt.isString(t.httpParams.fileName)||""==t.httpParams.fileName)return function(e){ha(e,-2389,"Output setup error: Invalid fileName in outputSetup.httpParams.")}(r),!1}return!0}},{key:"startScan",value:function(e){var t,r=this,n=e;if(r._resetErr(),!r._isValid())return!1;if(1==r._startScanFlag)return ha(t={},-2432,"Operation in progress, please try again when the current operation has finished."),Qt.Promise.reject({code:t._errorCode,message:t._errorString});r._startScanFlag=!0,Zt.isObject(n)||(n={});var i,o,a,s=!1,u=!1,c=!0,l=!0,d=!0,f=!1,h=n.onFinally,g=[],m=[],p=0,v=1,_=[],y={type:"http",format:rr.DWT.EnumDWT_ImageType.IT_PDF,reTries:3,useUploader:!1,singlePost:!0,showProgressBar:!0,removeAfterOutput:!0,httpParams:{url:"",headers:{},formFields:{},remoteName:"RemoteFile",fileName:""}},S=Zt.clone(n),I=n;if(a=S.funcScanStatus,delete S.funcScanStatus,Zt.isFunction(a)?S.bfuncScanStatus=!0:S.bfuncScanStatus=!1,S.outputSetup){var b={pdfSetup:{},tiffSetup:{}};$K(S.outputSetup,y),o=S.outputSetup,delete S.outputSetup,o.pdfSetup&&(o.format!=rr.DWT.EnumDWT_ImageType.IT_MULTIPAGE_PDF&&o.format!=rr.DWT.EnumDWT_ImageType.IT_PDF||Zt.mix(b.pdfSetup,o.pdfSetup)),o.tiffSetup&&(o.format!=rr.DWT.EnumDWT_ImageType.IT_MULTIPAGE_TIF&&o.format!=rr.DWT.EnumDWT_ImageType.IT_TIF||Zt.mix(b.tiffSetup,o.tiffSetup)),o.format!=rr.DWT.EnumDWT_ImageType.IT_MULTIPAGE_PDF&&o.format!=rr.DWT.EnumDWT_ImageType.IT_MULTIPAGE_TIF||(o.singlePost=!0),o.httpParams&&Zt.isNumber(o.httpParams.threads)&&(v=o.httpParams.threads),s=Zt.stringify(b),u=r.checkStartScanParams(S,o)}else(o=y).type="",u=r.checkStartScanParams(S,!1);if(!u)return new Qt.Promise((function(e,t){c&&(t({code:r._errorCode,message:r._getErrorString(),response:""}),c=!1,r._startScanFlag=!1)}));o.funcHttpUploadStatus&&(f=o.funcHttpUploadStatus);var T,C,w,E,k,A,x=r.__remoteFilename,P=r.MaxUploadImageSize,D=r.IfShowProgressBar,F=r.__OnPostTransferAsync,W=r.__OnPostAllTransfers,R=r.__OnHttpUploadStatus,N=r.__insertingIndex,O=r.__IfAppendImage,M=r.httpFormFields,L=r._tiffCompressionType,B=!1,U=o.showProgressBar;if((T=function(e){var t=!0;Zt.each(_,(function(e,r){-1==e.st&&(t=!1)})),t?C(e):setTimeout((function(){T(e)}),200)},C=function(e){e.__OnPostTransferAsync=F,e.__OnPostAllTransfers=W,e.__OnHttpUploadStatus=R,e.__remoteFilename=x,e.__maxUploadImageSize=P,e.IfShowProgressBar=D,e.__insertingIndex=N,e.__IfAppendImage=O,e.httpFormFields=M,e._tiffCompressionType=L,rr.FileUploader&&(rr.FileUploader.nextLoopTime=600),e._startScanFlag=!1},w=function(e,t,r){l?(t(r),T(e)):setTimeout((function(){w(e,t,r)}),200)},E=function(e,t){B=!0,c&&(c=!1,l||r._innerSendCmd("CancelAllPendingTransfers"),w(r,e,t))},k=function(e,t,r,n){if(Zt.isFunction(f)){var i,o=t,a=0;Zt.isNumber(n)&&n>0&&(a=n),i={fileName:o,percentage:r,statusCode:a,responseString:e.__HTTPPostResponseString},setTimeout((function(){f(i)}),10)}},r.__HTTPPostResponseString="",r.IfShowProgressBar=U,Zt.isNumber(S.insertingIndex)&&S.insertingIndex>-1&&(r.__insertingIndex=S.insertingIndex,r.__IfAppendImage=!1),Zt.isFunction(f)?r.__OnHttpUploadStatus=f:r.__OnHttpUploadStatus=!1,o.useUploader)&&!rr.FileUploader)return new Qt.Promise((function(e,t){ha(r,-2380,"Please make sure the Uploader Module has been installed.");var n={code:r._errorCode,message:r._getErrorString(),response:""};l=!0,E(t,n)}));if(i=o.reTries,o.useUploader){if(o.httpParams&&(A=o.httpParams.url),!Zt.startsWith(A,"http://")&&!Zt.startsWith(A,"https://")){var V=window.location.href,j=V.lastIndexOf("/");V=V.substring(0,j+1),o.httpParams.url=V+A}}else o.httpParams&&(Zt.each(o.httpParams.headers,(function(e,t){r.SetHTTPHeader(t,e)})),Zt.each(o.httpParams.formFields,(function(e,t){r.SetHTTPFormField(t,e)})));return o.httpParams&&""!==o.httpParams.remoteName&&(r.__remoteFilename=o.httpParams.remoteName),new Qt.Promise((function(e,t){o.useUploader?rr.FileUploader.Init(0,(function(t){e({uploadManager:t})}),(function(e,n){r._errorCode=e,r._errorString=n;var i={code:e,message:n,response:r.__HTTPPostResponseString};l=!0,E(t,i)})):e({})})).then((function(e){return new Qt.Promise((function(t,n){var u=function(){(S.transferMode==rr.DWT.EnumDWT_TransferMode.TWSX_FILE?p==m.length:p==g.length)?(Qt.closeProgress(null,"Scan Upload"),B=!0,t(I),C(r)):setTimeout(u,100)};a&&Zt.isFunction(a)&&(r.__OnPreAllTransfersAsync=function(e){a(e)}),r.registerEvent("OnPostTransferAsync",(function(t){var u,c,h,y,I,b,T=o.httpParams&&o.httpParams.url,C=r._uidFromServer2ServerId(t.imageId),w=o.singlePost,A=S.transferMode==rr.DWT.EnumDWT_TransferMode.TWSX_FILE,x=o.removeAfterOutput,P=0;if(d&&(l=!1,d=!1),A?(P=m.length,m.push(t.path)):(P=g.length,g.push(C)),a&&Zt.isFunction(a)){var D={event:"postTransfer",bScanCompleted:!1,result:{currentPageNum:P+1}};setTimeout((function(){a(D)}),10)}if(B)return!1;if("http"==o.type)if(o.httpParams&&(c=sG(o.httpParams.fileName,P+1),h=sG(o.httpParams.remoteName,P+1)),w||"http"!=o.type)!w&&o.type;else if(o.httpParams&&Zt.isNumber(o.httpParams.maxSizeLimit)&&(r.__maxUploadImageSize=o.httpParams.maxSizeLimit),o.useUploader){U?(rr.FileUploader.nextLoopTime=300,Qt.showProgress(r,"Scan Upload",r.__IfShowCancelDialogWhenImageTransfer)):Qt.hideProgress(),y=function(e,t){return r.__HTTPPostResponseString=t,k(r,e._fileName,100,200),r._OnPercentDone([0,100,"","http",e._fileName]),U&&Qt.closeProgress(null,"Scan Upload"),!A&&o.removeAfterOutput?setTimeout((function(){r._ImgManager.convertServerIdToClientIndex(C)>-1?GK(HK,r,YK).call(r,C,(function(){p++}),(function(){p++})):p++}),100):p++,!0};var F,W=e.uploadManager;if(I=function(){if(U){var e,t=0;for(t=A?m.length:g.length,e=0;e<t;e++)Qt.closeProgress(null,"Scan Upload")}!A&&o.removeAfterOutput&&setTimeout((function(){r._ImgManager.convertServerIdToClientIndex(C)>-1&&GK(HK,r,YK).call(r,C)}),100),W.CancelAllUpload();var i={code:r._errorCode,message:r._getErrorString(),response:r.__HTTPPostResponseString};return E(n,i),!1},b=function(e,t,n,i){var o=303;t==ZK.TRANS_SERVICE_ERROR_404?o=404:t==ZK.TRANS_SERVICE_ERROR_500?o=500:t==ZK.TRANS_SERVICE_ERROR_503&&(o=503),r._errorCode=t,r._errorString=n,r.__HTTPPostResponseString=i,k(r,c,100,o),I()},F=function(){r.__HTTPPostResponseString="",k(r,c,100,303),I()},A){var R=W.CreateJob(),N=R.FormField;o.httpParams&&(Zt.each(o.httpParams.headers,(function(e,t){R.HttpHeader[t]=e})),Zt.each(o.httpParams.formFields,(function(e,t){N.Add(t,e)}))),R.ServerUrl=T,R.bDeleteFile=x,R.reTries=i,o.httpParams&&Zt.isNumber(o.httpParams.maxSizeLimit)&&(R.maxSizeLimit=o.httpParams.maxSizeLimit),R._fileName=c,R.SourceValue.Add(t.path,c,h),R.ImageType=S.fileXfer.fileFormat,R.ThreadNum=v,R.OnRunSuccess=y,R.OnRunFailure=b,(U||Zt.isFunction(f))&&(R.OnUploadTransferPercentage=function(e,t){t>0&&t<=100&&(r._OnPercentDone([0,t,"","http",e._fileName]),Zt.isFunction(f)&&k(r,e._fileName,t,0))},Qt.cancelFrom=rG.Scan,U&&GK(HK,r,XK).call(r,I),r._OnPercentDone([0,-1,hl.Uploading,"http",c]),k(r,c,0,0)),W.Run(R)}else(u=o.format)==rr.DWT.EnumDWT_ImageType.IT_MULTIPAGE_PDF?u=rr.DWT.EnumDWT_ImageType.IT_PDF:u==rr.DWT.EnumDWT_ImageType.IT_MULTIPAGE_TIF&&(u=rr.DWT.EnumDWT_ImageType.IT_TIF),Qt.cancelFrom=rG.Scan,U&&GK(HK,r,XK).call(r,I),r._OnPercentDone([0,-1,hl.Encoding,"http",c]),r._asyncGenerateURLForUploadData([C],u,s,(function(e){var t=W.CreateJob(),n=t.FormField;o.httpParams&&(Zt.each(o.httpParams.headers,(function(e,r){t.HttpHeader[r]=e})),Zt.each(o.httpParams.formFields,(function(e,t){n.Add(t,e)}))),t.ServerUrl=T,t.bDeleteFile=x,t.reTries=i,o.httpParams&&Zt.isNumber(o.httpParams.maxSizeLimit)&&(t.maxSizeLimit=o.httpParams.maxSizeLimit),t._fileName=c,t.SourceValue.Add(e,c,h),t.ImageType=u,t.ThreadNum=v,t.OnRunSuccess=y,t.OnRunFailure=b,(U||Zt.isFunction(f))&&(t.OnUploadTransferPercentage=function(e,t){t>0&&t<=100&&(r._OnPercentDone([0,t,"","http",e._fileName]),Zt.isFunction(f)&&k(r,e._fileName,t,0))},r._OnPercentDone([0,-1,hl.Uploading,"http",c]),k(r,c,0,0)),W.Run(t)}),F)}else{var O={id:C,st:-1,bCancel:!1};if(_.push(O),0==P&&(U?Qt.showProgress(r,"Scan Upload",r.__IfShowCancelDialogWhenImageTransfer):Qt.hideProgress()),A)y=function(e){return O.st=0,!A&&o.removeAfterOutput?setTimeout((function(){r._ImgManager.convertServerIdToClientIndex(C)>-1?GK(HK,r,YK).call(r,C,(function(){p++}),(function(){p++})):p++}),100):p++,!0},I=function(){!A&&o.removeAfterOutput&&setTimeout((function(){r._ImgManager.convertServerIdToClientIndex(C)>-1&&GK(HK,r,YK).call(r,C)}),100);var e={code:r._errorCode,message:r._getErrorString(),response:r.__HTTPPostResponseString};return Qt.closeProgress(null,"Scan Upload"),2==O.st||(O.st=1,Zt.each(_,(function(e,t){-1==e.st&&(e.bCancel=!0)})),E(n,e)),!1},r._innerUploadDirectly(T,t.path,c,U,x,i,!1,O,y,I);else{if(y=function(e,t){return O.st=0,!A&&o.removeAfterOutput?setTimeout((function(){r._ImgManager.convertServerIdToClientIndex(C)>-1?GK(HK,r,YK).call(r,C,(function(){p++}),(function(){p++})):p++}),100):p++,!0},I=function(e){!A&&o.removeAfterOutput&&setTimeout((function(){r._ImgManager.convertServerIdToClientIndex(C)>-1&&GK(HK,r,YK).call(r,C)}),100);var t={code:r._errorCode,message:r._getErrorString(),response:r.__HTTPPostResponseString};return Qt.closeProgress(null,"Scan Upload"),2==O.st||(O.st=1,Zt.each(_,(function(e,t){-1==e.st&&(e.bCancel=!0)})),E(n,t)),!1},u=o.format,Zt.isUndefined(u)){var M=r._ImgManager.convertServerIdToClientIndex(C);return Qa(r),I([M]),!1}u==rr.DWT.EnumDWT_ImageType.IT_MULTIPAGE_PDF?u=rr.DWT.EnumDWT_ImageType.IT_PDF:u==rr.DWT.EnumDWT_ImageType.IT_MULTIPAGE_TIF&&(u=rr.DWT.EnumDWT_ImageType.IT_TIF);var L={method:"startScan",url:T,serverIds:[C],headers:r._GetHttpHeadersAndClear(),formData:JG(r.httpFormFields),enumImageType:u,saveSetup:s,fileName:c,dataFormat:QH.Binary,retry:i,bOnlyResponseEmptyIsOK:!1,objUploadFileStatus:O,asyncSuccessFunc:y,asyncFailureFunc:I};r._asyncUploadCmd(L)}}})),r.__OnPostAllTransfers=function(){var c,d,_=-1,y=QH.Binary,b=o.httpParams.url,T=o.singlePost,w=S.transferMode==rr.DWT.EnumDWT_TransferMode.TWSX_FILE,A=o.removeAfterOutput;a&&Zt.isFunction(a)&&(_=w?m.length:g.length,d={event:"postTransfer",bScanCompleted:!0,result:{currentPageNum:_}},setTimeout((function(){a(d)}),10));if(0==_)return function(e){ha(e,-1029,"Source has nothing to capture.")}(r),void setTimeout((function(){l=!0,h&&Zt.isFunction(h)&&h();var e={code:r._errorCode,message:r._getErrorString(),response:r.__HTTPPostResponseString};E(n,e)}),1e3);if(_>0&&-1029==r._errorCode)r._errorCode=0;else if(0!=r._errorCode){l=!0,h&&Zt.isFunction(h)&&h();var x={code:r._errorCode,message:r._getErrorString(),response:r.__HTTPPostResponseString};return void E(n,x)}if("http"==o.type){if(T&&"http"==o.type){var P,D,F,W=g;if(o.httpParams&&Zt.isNumber(o.httpParams.maxSizeLimit)&&(r.__maxUploadImageSize=o.httpParams.maxSizeLimit),o.useUploader){var R,N=e.uploadManager,O=N.CreateJob(),M=O.FormField;if(U?(rr.FileUploader.nextLoopTime=300,Qt.showProgress(r,"Scan Upload",r.__IfShowCancelDialogWhenImageTransfer)):Qt.hideProgress(),P=function(e,n){var i=e._fileName;return i||(i=""),r._bServerPercentDone=!0,r.__HTTPPostResponseString=n,k(r,i,100,200),r._OnPercentDone([0,100,"","http"]),U&&Qt.closeProgress(null,"Scan Upload"),!w&&o.removeAfterOutput?setTimeout((function(){p=0,Zt.each(W,(function(e){r._ImgManager.convertServerIdToClientIndex(e)>-1?GK(HK,r,YK).call(r,e,(function(){p++}),(function(){p++})):p++})),setTimeout(u,100)}),100):(B=!0,t(I),C(r)),!0},D=function(){U&&Qt.closeProgress(null,"Scan Upload"),N.CancelAllUpload(),r._bServerPercentDone=!0;var e={code:r._errorCode,message:r._getErrorString(),response:r.__HTTPPostResponseString};return E(n,e),!w&&o.removeAfterOutput&&setTimeout((function(){Zt.each(W,(function(e){r._ImgManager.convertServerIdToClientIndex(e)>-1&&GK(HK,r,YK).call(r,e)}))}),100),!1},F=function(e,t,n,i){var o=303;t==ZK.TRANS_SERVICE_ERROR_404?o=404:t==ZK.TRANS_SERVICE_ERROR_500?o=500:t==ZK.TRANS_SERVICE_ERROR_503&&(o=503),r._errorCode=t,r._errorString=n,r.__HTTPPostResponseString=i,k(r,"",100,o),D()},R=function(){r.__HTTPPostResponseString="",k(r,"",100,303),D()},U&&(Qt.cancelFrom=rG.Scan,GK(HK,r,XK).call(r,D)),w)o.httpParams&&(Zt.each(o.httpParams.headers,(function(e,t){O.HttpHeader[t]=e})),Zt.each(o.httpParams.formFields,(function(e,t){M.Add(t,e)}))),O.ServerUrl=b,O.bDeleteFile=A,O.reTries=i,o.httpParams&&Zt.isNumber(o.httpParams.maxSizeLimit)&&(O.maxSizeLimit=o.httpParams.maxSizeLimit),Zt.each(m,(function(e,t){var r,n;o.httpParams&&(r=sG(o.httpParams.fileName,t+1),n=sG(o.httpParams.remoteName,t+1)),O.SourceValue.Add(e,r,n)})),O.ImageType=S.fileXfer.fileFormat,O.ThreadNum=v,O.OnRunSuccess=P,O.OnRunFailure=F,(U||Zt.isFunction(f))&&(O.OnUploadTransferPercentage=function(e,t){t>0&&t<=100&&(r._OnPercentDone([0,t,"","http"]),Zt.isFunction(f)&&k(r,"",t,0))},r._OnPercentDone([0,-1,hl.Uploading,"http"]),k(r,"",0,0)),N.Run(O);else if((c=o.format)==rr.DWT.EnumDWT_ImageType.IT_MULTIPAGE_PDF||c==rr.DWT.EnumDWT_ImageType.IT_MULTIPAGE_TIF)c==rr.DWT.EnumDWT_ImageType.IT_MULTIPAGE_PDF?c=rr.DWT.EnumDWT_ImageType.IT_PDF:c==rr.DWT.EnumDWT_ImageType.IT_MULTIPAGE_TIF&&(c=rr.DWT.EnumDWT_ImageType.IT_TIF),r._OnPercentDone([0,-1,hl.Encoding,"http"]),r._asyncGenerateURLForUploadData(W,c,s,(function(e){var t,n;o.httpParams&&(Zt.each(o.httpParams.headers,(function(e,t){O.HttpHeader[t]=e})),Zt.each(o.httpParams.formFields,(function(e,t){M.Add(t,e)}))),O.ServerUrl=b,O.bDeleteFile=A,O.reTries=i,o.httpParams&&Zt.isNumber(o.httpParams.maxSizeLimit)&&(O.maxSizeLimit=o.httpParams.maxSizeLimit),o.httpParams&&(t=sG(o.httpParams.fileName,1),n=sG(o.httpParams.remoteName,1)),O._fileName=t,O.SourceValue.Add(e,t,n),O.ImageType=c,O.ThreadNum=v,O.OnRunSuccess=P,O.OnRunFailure=F,(U||Zt.isFunction(f))&&(O.OnUploadTransferPercentage=function(e,n){n>0&&n<=100&&(r._OnPercentDone([0,n,"","http",t]),Zt.isFunction(f)&&k(r,t,n,0))},r._OnPercentDone([0,-1,hl.Uploading,"http",t])),N.Run(O)}),R);else{var L=W.length,V=0,j=0,G="";U&&(r._bServerPercentDone=!1),r._OnPercentDone([0,-1,hl.Encoding,"http"]),Zt.each(W,(function(e,t){var n,a;o.httpParams&&(n=sG(o.httpParams.fileName,t+1),a=sG(o.httpParams.remoteName,t+1)),r._asyncGenerateURLForUploadData([e],c,s,(function(e){j=(V+1)/L*100,G=[V+1,"/",L].join(""),r._OnPercentDone([0,j,G,"http"]),O.SourceValue.Add(e,n,a),++V>=L&&(U&&(r._bServerPercentDone=!0),o.httpParams&&(Zt.each(o.httpParams.headers,(function(e,t){O.HttpHeader[t]=e})),Zt.each(o.httpParams.formFields,(function(e,t){M.Add(t,e)}))),O.ServerUrl=b,O.bDeleteFile=A,O.reTries=i,o.httpParams&&Zt.isNumber(o.httpParams.maxSizeLimit)&&(O.maxSizeLimit=o.httpParams.maxSizeLimit),O.ImageType=c,O.ThreadNum=v,O.OnRunSuccess=P,O.OnRunFailure=F,(U||Zt.isFunction(f))&&(O.OnUploadTransferPercentage=function(e,t){t>0&&t<=100&&(r._OnPercentDone([0,t,"","http"]),Zt.isFunction(f)&&k(r,"",t,0))},r._OnPercentDone([0,-1,hl.Uploading,"http"])),N.Run(O))}),R)}))}}else if(w)P=function(e){return r._bServerPercentDone=!0,!w&&o.removeAfterOutput?setTimeout((function(){p=0,Zt.each(W,(function(e){r._ImgManager.convertServerIdToClientIndex(e)>-1?GK(HK,r,YK).call(r,e,(function(){p++}),(function(){p++})):p++})),setTimeout(u,100)}),100):(B=!0,t(I),C(r)),!0},D=function(e){r._bServerPercentDone=!0;var t={code:r._errorCode,message:r._getErrorString(),response:r.__HTTPPostResponseString};return E(n,t),!w&&o.removeAfterOutput&&setTimeout((function(){Zt.each(W,(function(e){r._ImgManager.convertServerIdToClientIndex(e)>-1&&GK(HK,r,YK).call(r,e)}))}),100),!1},r._innerUploadFilesDirectly(b,m,o.httpParams&&o.httpParams.fileName,U,A,i,!1,P,D);else{P=function(e,n){return r._bServerPercentDone=!0,!w&&o.removeAfterOutput?setTimeout((function(){p=0,Zt.each(W,(function(e){r._ImgManager.convertServerIdToClientIndex(e)>-1?GK(HK,r,YK).call(r,e,(function(){p++}),(function(){p++})):p++})),setTimeout(u,100)}),100):(B=!0,t(I),C(r)),!0},D=function(e){r._bServerPercentDone=!0;var t={code:r._errorCode,message:r._getErrorString(),response:r.__HTTPPostResponseString};return E(n,t),!w&&o.removeAfterOutput&&setTimeout((function(){Zt.each(W,(function(e){r._ImgManager.convertServerIdToClientIndex(e)>-1&&GK(HK,r,YK).call(r,e)}))}),100),!1},c=o.format;var H=r._GetHttpHeadersAndClear(),z=JG(r.httpFormFields);if(c==rr.DWT.EnumDWT_ImageType.IT_MULTIPAGE_PDF||c==rr.DWT.EnumDWT_ImageType.IT_MULTIPAGE_TIF){var K;c==rr.DWT.EnumDWT_ImageType.IT_MULTIPAGE_PDF?c=rr.DWT.EnumDWT_ImageType.IT_PDF:c==rr.DWT.EnumDWT_ImageType.IT_MULTIPAGE_TIF&&(c=rr.DWT.EnumDWT_ImageType.IT_TIF),o.httpParams&&(K=sG(o.httpParams.fileName,1),sG(o.httpParams.remoteName,1));var J={method:"startScan",url:b,headers:H,formData:z,serverIds:W,enumImageType:c,saveSetup:s,fileName:K,dataFormat:y,retry:i,bOnlyResponseEmptyIsOK:!1,objUploadFileStatus:!1,asyncSuccessFunc:P,asyncFailureFunc:D};r._asyncUploadCmd(J)}else W.length>0&&r._asyncUploadFilesCmd(b,W,H,z,c,o.httpParams&&o.httpParams.fileName,s,U,i,!1,P,D)}}T&&o.type}l=!0,h&&Zt.isFunction(h)&&h()};var c=function(){if("http"!=o.type)return B=!0,t(I),void C(r);o.singlePost?setTimeout((function(){if(!l&&r._startScanFlag)return B=!0,t(I),void C(r)}),300):setTimeout(u,100)};GK(HK,r,qK).call(r,S,c,(function(e){if(-1029==r._errorCode){if(S.transferMode==rr.DWT.EnumDWT_TransferMode.TWSX_FILE?m.length>0:g.length>0)return r._errorCode=0,c()}var t={code:r._errorCode,message:r._getErrorString(),response:r.__HTTPPostResponseString};E(n,t)}))}))}))}},{key:"_innerInitEvents",value:function(e){this.__OnWSReconnect=e.onWSReconnect||null,this.__OnWSClose=e.onWSClose||null,this.__OnWSMessage=e.onWSMessage||null,this.__OnWSError=e.onWSError||null,this.__OnPercentDone=e.onPercentDone||"",this.__OnPrintMsg=e.onPrintMsg||"",this.__OnResult=e.onResult||"",this.__OnAfterOperate=e.onAfterOperate||"",this.__OnBeforeOperate=e.onBeforeOperate||"",this.__OnOperateStatus=e.onOperateStatus||"",this.__OnBitmapChanged=e.onBitmapChanged||"",this.__OnGetFilePath=e.onGetFilePath||"",this.__OnPreAllTransfers=e.onPreAllTransfers||"",this.__OnPreTransfer=e.onPreTransfer||"",this.__OnPostLoad=e.onPostLoad||"",this.__OnPostTransfer=e.onPostTransfer||"",this.__OnPostAllTransfers=e.onPostAllTransfers||"",this.__OnSourceUIClose=e.onSourceUIClose||"",this.__OnTransferCancelled=e.onTransferCancelled||"",this.__OnTransferError=e.onTransferError||"",this.__OnInternetTransferPercentage=e.onInternetTransferPercentage||"",this.__OnInternetTransferPercentageEx=e.onInternetTransferPercentageEx||"",this.__OnRemoteScanStatusAsync=e.onRemoteScanStatusAsync||""}}],[{key:"create",value:(r=n(g().mark((function c(e){var r;return g().wrap((function(n){for(;;)switch(n.prev=n.next){case 0:return r=new t(e),n.next=3,Zd.STwainConnectToServer(r);case 3:return n.abrupt("return",r);case 4:case"end":return n.stop()}}),c)}))),function(e){return r.apply(this,arguments)})}]);var r,a}(cK);function KK(){var e,t,r=[],n=this.__devices.length;for(e=0;e<n;e++){var i=this.__devices[e],o=i.deviceType,a={ProductName:"",DeviceInfo:{},DriverType:"",IsCurrentSource:!1,IsDefaultSource:!1,Manufacturer:"",ProductFamily:"",ProtocolMajor:0,ProtocolMinor:0,SupportedGroups:0,Version:{Country:0,Info:"",Language:0,MajorNum:0,MinorNum:0}},s=void 0,u=Zt.clone(i.deviceInfo);(t=o)==Tl.TWAINSCANNER||t==Tl.WIATWAINSCANNER||t==Tl.TWAINX64SCANNER?(o==Tl.TWAINSCANNER?s="TWAIN":o==Tl.WIATWAINSCANNER?s="WIATWAIN":o==Tl.TWAINX64SCANNER&&(s="TWAIN64"),a.Manufacturer=u.Manufacturer,a.ProductFamily=u.ProductFamily,a.ProtocolMajor=u.ProtocolMajor,a.ProtocolMinor=u.ProtocolMinor,a.SupportedGroups=u.SupportedGroups,a.Version=u.Version):o==Tl.SANESCANNER?(s="SANE",a.DeviceInfo=u):o==Tl.ICASCANNER?(s="ICA",a.DeviceInfo=u):o==Tl.ESCLSCANNER?(s="eSCL",a.DeviceInfo=u):o==Tl.WIFIDIRECTSCANNER?(s="WiFiScanner",a.DeviceInfo=u):o==Tl.WIASCANNER&&(s="WIA",a.DeviceInfo=u),a.ProductName=i.displayName,a.DriverType=s,r.push(a)}return r}function JK(){var e,t=this,r=[],n=0;for(t.__devices&&(n=t.__devices.length),e=0;e<n;e++){var i=t.__devices[e];r.push(i.displayName)}return r}function QK(e,t){var r=["[",e,",",null!=t?t:kd.SMF_NAME,"]"].join("");return this._innerFun("SelectSourceEx",r)}function qK(e,t,r){var n,i,o=this,a=null,s=null;if(i=Zt.isUndefined(e)||null==e?{}:e,o._resetErr(),!o._isValid())return!1;if(Zt.isFunction(t)&&(a=function(){t(i)}),Zt.isFunction(r)&&(s=function(e,t){r(e,t,i)}),!Wc.checkProductKey(o,{Core:!0}))return Zt.isFunction(s)&&s(o._errorCode,o._errorString),!1;for(var u=0,c=0;c<lf.length;c++){var l=["__",lf[c]].join("");Zt.isFunction(o[l])&&(u|=1<<c)}if(i.EnableEvents=u,i.scanner){var d=i.scanner;Zt.isString(d)||Zt.isString(d.strDevice)&&(i.device=d.strDevice,delete i.scanner)}return n=["[",Zt.stringify(i),"]"].join(""),o.__bAcquireImageNow=!0,o.__innerAcquireOrLoadImageAsync("StartScan",n,!1,!0).then(a,(function(e){o._errorCode=e.code,o._errorString=e.message,Zt.isFunction(s)&&s(e.code,e.message)})),!0}function YK(e,t,r){var n=this;return n._innerFunRaw("RemoveImage",Il(e),!0,!1,!0,(function(){n._OnBitmapChanged(["c1",""+e,3,n._ImgManager.getCurrentImageIndex(),n._ImgManager.count()]),Zt.isFunction(t)&&t()}),r)}function XK(e){var t=this;t.IfShowCancelDialogWhenImageTransfer?(Qt.progressContext&&Qt.progressContext.on("cancel",(function(){ps(t),e()})),dG(!0)):dG(!1)}var ZK={TRANS_SERVICE_ERROR_404:12,TRANS_SERVICE_ERROR_500:13,TRANS_SERVICE_ERROR_503:14},$K=function(e,t){if(!Zt.isUndefined(e)&&!Zt.isUndefined(t)&&null!=e&&null!=t){for(var r in t)e.hasOwnProperty(r)?"object"===_(e[r])&&$K(e[r],t[r]):e[r]=t[r];return e}};function eJ(e){return tJ.apply(this,arguments)}function tJ(){return tJ=n(g().mark((function e(t){var r,n,i,o,a,s,u,c,l;return g().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(o=t.id,a=null===(r=t.container)||void 0===r?void 0:r.id,s=window,!(n=rr.DWT.GetWebTwain(o))&&a&&(i=rr.DWT.GetWebTwain(a)),!n&&!i){e.next=8;break}throw u={},n?ks(u):As(u),{code:u._errorCode,message:u._errorString};case 8:return rr.DWT.UseDefaultViewer||(t.container=null),((d=t.container)&&!Zt.isString(d)?fi:di)?t.bNoViewer=!1:t.bNoViewer=!0,e.prev=10,e.next=13,zK.create(t);case 13:c=e.sent,e.next=22;break;case 16:throw e.prev=16,e.t0=e["catch"](10),(l=e.t0&&e.t0.code)==_a.ResponseDataTypeError||l==_a.HTSTError||l==_a.CORSError||l==_a.CORSErrorFromService||l==_a.SSLCertExpired||l==_a.SSLCertInvalid||(l==_a.MustUpgrade?Gz(!0):l==_a.ModuleNotExists&&oJ(c)),c&&c.dispose(),e.t0;case 22:return e.prev=22,s.DCP_DWT_OnClickCloseInstall&&s.DCP_DWT_OnClickCloseInstall(!1,!0),e.finish(22);case 25:return nJ(c),e.abrupt("return",c);case 27:case"end":return e.stop()}var d}),e,null,[[10,16,22,25]])}))),tJ.apply(this,arguments)}function rJ(e,t){if(Zt.isFunction(rr.OnWebTwainNeedUpgradeCallback)){var r,n,i={};if(n=Uo.getDSPath(),de.bWin)r=Lo.enumWindow;else if(rr.navInfo.bEmbed||de.bAndroid||de.bChromeOS||de.bHarmonyOS||de.biPhone||de.biPad)de.bAndroid?r=Lo.enumAndroid:(i.deb=n,r=de.biPhone||de.biPad?Lo.enumiOS:de.bChromeOS?Lo.enumChromeOS:de.bHarmonyOS?Lo.enumHarmonyOS:Lo.enumEmbed);else if(de.bLinux){var o=Uo.getLinuxHTML5DebPath(),a=Uo.getLinuxHTML5RpmPath();n=o,i.deb=o,i.rpm=a,r=Lo.enumLinux}else r=Lo.enumMac;i["default"]=n;var s=ci.one(".dynamsoft-dialog-license");s&&s.getEL()&&(s.getEL().style.display="none"),Qt.detect.needUpgrade=fi,rr.OnWebTwainNeedUpgradeCallback(ia.name,i,ia.bHTML5Edition,r,de.bIE,de.bSafari,Qt.detect.ssl,ko.strIEVersion,Qt.detect.bPromptJSOrServerOutdated,e,t)}}function nJ(e){return iJ.apply(this,arguments)}function iJ(){return(iJ=n(g().mark((function e(t){var r,n,i;return g().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(t&&!t._blts){e.next=2;break}return e.abrupt("return");case 2:if(-2207==t.ErrorCode&&(Qt.detect.bPromptJSOrServerOutdated=fi,Zt.isFunction(rr.DWT.OnWebTwainNeedUpgradeWebJavascript)&&rr.DWT.OnWebTwainNeedUpgradeWebJavascript(t.ErrorString)),!oa.versionInfoFromServer){e.next=7;break}r=oa.versionInfoFromServer,e.next=10;break;case 7:return e.next=9,t._getVersionInfoAsync();case 9:r=e.sent;case 10:if(Qt.detect.bNeedUpgradeEvent||Rd(r)){e.next=19;break}if(Qt.detect.bNeedUpgradeEvent=fi,!Zt.isFunction(rr.DWT.OnWebTwainNeedUpgrade)){e.next=15;break}if(!rr.DWT.OnWebTwainNeedUpgrade()){e.next=15;break}return e.abrupt("return");case 15:if(!t._bRemoteMode){e.next=18;break}return Zt.isFunction(rr.OnRemoteWebTwainNeedUpgradeCallback)&&(n=t._serverInfo.port,rr.OnRemoteWebTwainNeedUpgradeCallback(ia.name,t._serverInfo.server,n,t._serverInfo.ssl)),e.abrupt("return");case 18:(ia.bHTML5Edition&&t._isBindViewer()||!ia.bHTML5Edition)&&((i=t._containerElement)&&(ci.one(i).before(Qt.install._strNonInstallDIV),Zt.show(Qt.install._divDWTNonInstallContainerID)),""!=Qt.install._divDWTemessageContainer&&Zt.hide(Qt.install._divDWTemessageContainer),rJ());case 19:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function oJ(e){if(!Qt.detect.bNoControlEvent){var t,r=0,n=0;e&&(r=e._width,n=e._height,t=e._containerElement),e&&e._bRemoteMode?e._bNotShowMessage||Zt.isFunction(rr.OnRemoteWebTwainNotFoundCallback)&&rr.OnRemoteWebTwainNotFoundCallback(ia.name,e._serverInfo.server,e._serverInfo.port,e._serverInfo.ssl,ko.bMobile):(jz(t,r,n),Gz(!1)),Qt.detect.bNoControlEvent=!0}}var aJ=function(e){function t(e){var r;o(this,t),(r=i(this,t,[e]))._bServerPercentDone=!0,r._bScanForProxyRemote=fi;var n=Zd.getServerImageUrlPrefix(r);return $j._setBaseUrl(r._imageBufferWrapper,n),r}return f(t,e),s(t,[{key:"getDevices",value:function(e,t,r){return this._getDevices(e,t,r)}},{key:"_connnect",value:(y=n(g().mark((function S(){var e;return g().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return e=this,t.abrupt("return",new Qt.Promise((function(t,r){Zz(e._serverInfo.server,e._serverInfo.port,void 0,(function(r,n,i){e._strRemoteServiceVer=i,t()}),r)})));case 2:case"end":return t.stop()}}),S,this)}))),function(){return y.apply(this,arguments)})},{key:"acquireImage",value:function(e,r){return l(d(t.prototype),"_acquireImage",this).call(this,e,r)}},{key:"_acquireImageForSendTo",value:function(e,r,n,i){return l(d(t.prototype),"_acquireImageForSendTo",this).call(this,e,r,n,i)}},{key:"getCapabilities",value:function(e,t,r){return this._getCapabilities(e,t,r)}},{key:"setCapabilities",value:function(e,t,r){return this._setCapabilities(e,t,r)}},{key:"closeSource",value:function(){return this._closeSource()}},{key:"setBufferMemoryLimit",value:(_=n(g().mark((function I(e){var t,r;return g().wrap((function(n){for(;;)switch(n.prev=n.next){case 0:if(t=this,Zt.isNumber(e)&&!isNaN(e)){n.next=4;break}throw Sa(t),{code:t._errorCode,message:t._errorString};case 4:if(t._resetErr(),t._isValid()){n.next=7;break}throw{code:t._errorCode,message:t._errorString};case 7:return n.next=9,t._innerFunV2("BufferMemoryLimit",Il(e));case 9:return r=n.sent,n.abrupt("return",r);case 11:case"end":return n.stop()}}),I,this)}))),function(e){return _.apply(this,arguments)})},{key:"setIfAllowLocalCache",value:(v=n(g().mark((function b(e){var t,r;return g().wrap((function(n){for(;;)switch(n.prev=n.next){case 0:if(t=this,Zt.isBoolean(e)){n.next=4;break}throw Sa(self),{code:t._errorCode,message:t._errorString};case 4:if(t._resetErr(),t._isValid()){n.next=7;break}throw{code:t._errorCode,message:t._errorString};case 7:return n.next=9,t._innerFunV2("IfAllowLocalCache",Il(e));case 9:return r=n.sent,n.abrupt("return",r);case 11:case"end":return n.stop()}}),b,this)}))),function(e){return v.apply(this,arguments)})},{key:"howManyImagesInBuffer",get:function(){return this._imageBufferWrapper.count()}},{key:"currentImageIndexInBuffer",get:function(){return this._imageBufferWrapper.getCurrentImageIndex()},set:function(e){this._imageBufferWrapper.setCurrentImageIndex(e)}},{key:"saveImages",value:(p=n(g().mark((function T(e,t,r,n){var i;return g().wrap((function(o){for(;;)switch(o.prev=o.next){case 0:if(i="saveImages",this._checkIndices(t)){o.next=3;break}throw{code:this._errorCode,message:this._getErrorString()};case 3:return this._containerElement=n,o.next=6,this._saveImages(i,e,t,r);case 6:case"end":return o.stop()}}),T,this)}))),function(e,t,r,n){return p.apply(this,arguments)})},{key:"getImages",value:function(e,t,r,n){if(!this._checkIndices(e))throw{code:this._errorCode,message:this._getErrorString()};return this._containerElement=n,this._getImages("getImages",e,t,r)}},{key:"removeImages",value:(m=n(g().mark((function C(e){var t,r,n,i,o;return g().wrap((function(a){for(;;)switch(a.prev=a.next){case 0:if(this._checkIndices(e)){a.next=2;break}throw{code:this._errorCode,message:this._getErrorString()};case 2:for(t=e.sort((function(e,t){return t-e})),r=[],n=0;n<t.length;n++)i=t[n],(o=this._imageBufferWrapper.convertClientIndexToServerId(i))>0&&r.push(o);if(0!=r.length){a.next=7;break}return a.abrupt("return");case 7:return a.next=9,this._innerFunV2("RemoveAllImages",Il(r.join(",")));case 9:if(!a.sent&&-1033!=this._errorCode){a.next=16;break}if(this._imageBufferWrapper.removeImages(t)){a.next=14;break}throw this._imageBufferWrapper.getError();case 14:a.next=17;break;case 16:throw{code:this._errorCode,message:this._errorString};case 17:case"end":return a.stop()}}),C,this)}))),function(e){return m.apply(this,arguments)})},{key:"updateImage",value:function(e,r,n){var i=this._imageBufferWrapper.getIndexByUid(e),o=this._imageBufferWrapper.convertClientIndexToServerId(i);return l(d(t.prototype),"_updateImage",this).call(this,o,r,n)}},{key:"getSkewAngleFromBinaryAsync",value:function(e,t,r,n){var i=this;if(i._resetErr(),!i._isValid())return Qt.Promise.reject({code:i._errorCode,message:i._errorString});var o=this._imageBufferWrapper.getCustomDataByIndex(e),a=this._imageBufferWrapper.getMetadataByIndex(e),s=this._imageBufferWrapper.convertClientIndexToServerId(e),u={imageId:s,serverId:s,bufferLen:t.size,imageType:Ad.IT_BMP,width:a.width,height:a.height,bit:a.bitDepth,xres:a.resolutionX,yres:a.resolutionY,uidFromServer:o.uidFromServer},c=Zt.stringify([Zt.stringify(u)]);return this._innerSendBlob("GetSkewAngleFromBinary",c,t,!0,!0,r,n)}},{key:"httpUpload",value:(h=n(g().mark((function w(e,r,n,i,o,a,s){var u,c;return g().wrap((function(l){for(;;)switch(l.prev=l.next){case 0:if((u=this)._resetErr(),u._isValid()){l.next=4;break}throw{code:u._errorCode,message:u._errorString};case 4:if(!Zt.isUndefined(e)&&""!==e){l.next=9;break}throw Oa(u),{code:u._errorCode,message:u._errorString};case 9:if(Zt.isString(e)){l.next=12;break}throw Ya(u),{code:u._errorCode,message:u._errorString};case 12:if(u._checkIndices(r)){l.next=14;break}throw{code:u._errorCode,message:u._errorString};case 14:if(0!=(c=Ef(u,r)).length){l.next=18;break}throw ya(u),{code:u._errorCode,message:u._errorString};case 18:if(!Zt.isUndefined(n)){l.next=21;break}throw Qa(u),{code:u._errorCode,message:u._errorString};case 21:if(n!=rr.DWT.EnumDWT_ImageType.IT_BMP&&n!=rr.DWT.EnumDWT_ImageType.IT_JPG&&n!=rr.DWT.EnumDWT_ImageType.IT_PNG){l.next=27;break}if(!(c.length>1)){l.next=25;break}throw ja(u),{code:u._errorCode,message:u._errorString};case 25:l.next=33;break;case 27:if(n!=rr.DWT.EnumDWT_ImageType.IT_TIF&&n!=rr.DWT.EnumDWT_ImageType.IT_PDF){l.next=31;break}l.next=33;break;case 31:throw Qa(u),{code:u._errorCode,message:u._errorString};case 33:if(!(Zt.isUndefined(i)||i!=rr.DWT.EnumDWT_UploadDataFormat.Binary&&i!=rr.DWT.EnumDWT_UploadDataFormat.Base64)){l.next=36;break}throw qa(u),{code:u._errorCode,message:u._errorString};case 36:return l.next=38,new Qt.Promise((function(r,l){var d,f,h=parseInt(n),g=parseInt(i);null!=a&&a.formFields&&(d=new FormData,Zt.each(null==a?void 0:a.formFields,(function(e,t){var r=e.name,n=e.value;Zt.isString(r)&&(n instanceof Blob?d.append(r,n,e.fileName):d.append(r,n))}))),null!=a&&a.headers&&(f={},Zt.each(null==a?void 0:a.headers,(function(e,t){Zt.isString(e.name)&&(f[e.name]=e.value)}))),u._containerElement=s,t._innerHTTPUpload(u,"httpUpload",e,null==a?void 0:a.responseType,f,d,c,h,g,o,void 0,0,!1,void 0,(function(e){if(Zt.isFunction(r)){var t=[];Zt.isArray(c)&&Zt.each(c,(function(e){var r=u._imageBufferWrapper.convertServerIdToClientIndex(e);r>-1&&t.push(r)}));try{kf(r,e,t)}catch(n){}}return e=null,!0}),(function(e){if(Zt.isFunction(l))try{l(e)}catch(t){}return!1}))}));case 38:return l.abrupt("return",l.sent);case 39:case"end":return l.stop()}}),w,this)}))),function(e,t,r,n,i,o,a){return h.apply(this,arguments)})},{key:"getCustomDataByIndex",value:function(e){return this._imageBufferWrapper.getCustomDataByIndex(e)}},{key:"getIndexByUid",value:function(e){return this._imageBufferWrapper.getIndexByUid(e)}},{key:"getProfile",value:function(e){return l(d(t.prototype),"_getProfile",this).call(this,e)}},{key:"setProfile",value:function(e,r){return l(d(t.prototype),"_setProfile",this).call(this,e,r)}},{key:"imageIDToIndex",value:function(e){return this._uidFromServer2index(e)}},{key:"indexToImageID",value:function(e){return this._index2uidFromServer(e)}},{key:"rotate",value:function(e,t,r,n){var i=this;if(i._resetErr(),!i._isValid())return Qt.Promise.reject({code:i._errorCode,message:i._errorString});var o=parseInt(e);if(isNaN(o))return ya(i),Qt.Promise.reject({code:i._errorCode,message:i._errorString});if(o<0||o>=i.howManyImagesInBuffer)return Ka(i),Qt.Promise.reject({code:i._errorCode,message:i._errorString});var a=i._imageBufferWrapper.convertClientIndexToServerId(o);return-1==a?(Ka(i),Qt.Promise.reject({code:i._errorCode,message:i._errorString})):i._innerFunV2("RotateEx",Il(a,t,r,n),!0).then((function(e){}))}},{key:"crop",value:function(e,t){var r=this;if(r._resetErr(),!r._isValid())return Qt.Promise.reject({code:r._errorCode,message:r._errorString});var n=parseInt(e);if(isNaN(n))return ya(r),Qt.Promise.reject({code:r._errorCode,message:r._errorString});if(n<0||n>=r.howManyImagesInBuffer)return Ka(r),Qt.Promise.reject({code:r._errorCode,message:r._errorString});var i=r._imageBufferWrapper.convertClientIndexToServerId(n);if(-1==i)return Ka(r),Qt.Promise.reject({code:r._errorCode,message:r._errorString});var o=t.x,a=t.y,s=t.x+t.width,u=t.y+t.height;return r._innerFunV2("Crop",Il(i,o,a,s,u),!0).then((function(e){}))}},{key:"_createHttpUploaderConfig",value:function(){var e=this,t=new gG;return t.IfShowProgressBar=e.IfShowProgressBar,t.IfShowCancelDialogWhenImageTransfer=e.IfShowCancelDialogWhenImageTransfer,t.MaxUploadImageSize=e.MaxUploadImageSize,t.HTTPRequestswithCredentials=e.HTTPRequestswithCredentials,t.onPercent=function(t){e._OnPercentDone(t)},t.onHttpUploadStatus=function(e){},t}},{key:"_OnReady",value:(c=n(g().mark((function E(){var e,r,n;return g().wrap((function(i){for(;;)switch(i.prev=i.next){case 0:return ca((e=this)._serverInfo.server)&&(Dd.item("DWT_port",e._serverInfo.port),Dd.item("DWT_ssl",e._serverInfo.ssl?"true":"false")),e._bNoMask||Wl("OnReady",e),i.prev=3,i.next=6,l(d(t.prototype),"_OnReady",this).call(this);case 6:return i.next=8,e._innerActiveUI(e._uuidForActiveUI);case 8:return r=i.sent,i.next=11,e._OnActiveUI(r);case 11:(n=e._id)&&!rr.DWT.WebTwainIdMap[n]&&(rr.DWT.WebTwainIdMap[n]=e),i.next=20;break;case 15:throw i.prev=15,i.t0=i["catch"](3),i.t0&&(e._errorCode=i.t0.code,e._errorString=i.t0.message),e.dispose(),i.t0;case 20:return i.prev=20,e._bNoMask||Rl("OnReady"),i.finish(20);case 23:case"end":return i.stop()}}),E,this,[[3,15,20,23]])}))),function(){return c.apply(this,arguments)})},{key:"_isBindViewer",value:function(){return this._bBindViewer}},{key:"_isNoViewer",value:function(){return!this._isBindViewer()}},{key:"getServiceInfo",value:function(){return l(d(t.prototype),"getServiceInfo",this).call(this)}},{key:"setViewerInfo",value:function(e){this._bBindViewer=e}},{key:"setViewerControlInfo",value:function(e){this._controlWidth=e.width,this._controlHeight=e.height}}],[{key:"create",value:(u=n(g().mark((function k(e){var r;return g().wrap((function(n){for(;;)switch(n.prev=n.next){case 0:return r=new t(e),n.next=3,Zd.STwainConnectToServer(r);case 3:return n.abrupt("return",r);case 4:case"end":return n.stop()}}),k)}))),function(e){return u.apply(this,arguments)})},{key:"_getBuffer",value:function(e){return $j._getBuffer(e._imageBufferWrapper)}},{key:"_setError",value:function(e,t,r){e._errorCode=t,e._errorString=r}},{key:"createByServiceInfo",value:(a=n(g().mark((function A(e,r,n){var i,o,a;return g().wrap((function(s){for(;;)switch(s.prev=s.next){case 0:return o={id:Zt.guid(),dmService:r,bNoViewer:!0,bNoMask:null==r||null===(i=r.attrs)||void 0===i?void 0:i.bNoMask,bNotShowMessage:!0},(a=new t(o))._uuidForActiveUI=e,a._bLicenseErrorDispose=!1,n&&(a._containerElement=n),s.next=7,a._connnect();case 7:return s.next=9,Zd.STwainConnectToServer(a);case 9:return s.abrupt("return",a);case 10:case"end":return s.stop()}}),A)}))),function(e,t,r){return a.apply(this,arguments)})},{key:"checkOnlineByServiceInfo",value:(r=n(g().mark((function x(e){var r,n;return g().wrap((function(i){for(;;)switch(i.prev=i.next){case 0:return r={id:Zt.guid(),dmService:e,bNoViewer:!0,bNoMask:!0,bNotShowMessage:!0},i.prev=1,n=new t(r),i.next=5,n._connnect();case 5:return n._bReady=!0,n._wsClient||(n._wsClient=new bu(null)),n.dispose(),i.abrupt("return",!0);case 11:return i.prev=11,i.t0=i["catch"](1),Zt.warn(i.t0),i.abrupt("return",!1);case 15:case"end":return i.stop()}}),x,null,[[1,11]])}))),function(e){return r.apply(this,arguments)})},{key:"_isReady",value:function(e){return e._bReady}},{key:"_innerHTTPUpload",value:function(e,t,r,n,i,o,a,s,u,c,l,d,f,h,g,m){var p=c,v=r;if(Zt.isUndefined(s))return Qa(e),void(Zt.isFunction(m)&&m({code:e._errorCode,message:e._errorString}));Qt.cancelFrom=rG.HTTPUpload;var _,y=function(r,n,i,o){Qt.needShowTwiceShowDialog=!1,e.IfShowProgressBar&&Qt.closeProgress(null,t),Zt.isFunction(m)&&m({code:r,message:n,response:i,httpCode:o})},S=e._createHttpUploaderConfig();if(S.objUploadStatus=h,p=uG(p,s),Qt.needShowTwiceShowDialog=!0,e.IfShowProgressBar?(Qt.showProgress(e,t,!1),Qt.progressContext&&(Qt.progressContext._onPercent=function(e){var t=0;if(e){var r,n;r=e.loaded,n=e.total,(t=Math.floor(r/n*100))>100&&(t=100)}Qt.progressBarOnPercentDone(-1,"Transferring...","",t,"")})):Qt.hideProgress(),u==rr.DWT.EnumDWT_UploadDataFormat.Binary){if(h&&h.bCancel)return h.st=2,ps(e),void y(e._errorCode,e._errorString);S.onPercent([0,-1,hl.Encoding,"http"]),e._convertToBlobForUpload(s,a,l,4,(function(r,a,s){if(_=function(r){return Qt.needShowTwiceShowDialog=!1,e.IfShowProgressBar&&Qt.closeProgress(null,t),Zt.isFunction(g)&&kf(g,r),r=null,!0},h&&h.bCancel)return h.st=2,ps(e),y(e._errorCode,e._errorString);if(!r||r.size<=0)return Wa(e),y(e._errorCode,e._errorString);var u=e.__maxUploadImageSize;if(r.size>u&&-1!=u)return Na(e),y(e._errorCode,e._errorString);if(0!=e._errorCode)return y(e._errorCode,e._errorString);rr.DWT.IfAddMD5InUploadHeader&&a&&""!=a&&(i["dwt-md5"]=a);var c=new fG,l=new hG;l.url=v,l.method=t,l.content=r,r=null,l.contentType=e._strHttpContentTypeFieldValue,l.headers=i,l.fileName=p,l.httpFormData=o,l.retry=d,l.bOnlyResponseEmptyIsOK=f,l.responseType=n,S.objUploadStatus=h,c.httpPostUpload(S,l,_,y)}),y)}else if(u==rr.DWT.EnumDWT_UploadDataFormat.Base64){e._convertToBase64ByServerIdsWithUI(t,a,s,l,4,(function(r){var a,s;if(!r||r.getLength()<=0)return Wa(e),y(e._errorCode,e._errorString);if(_=function(r){return Qt.needShowTwiceShowDialog=!1,e.IfShowProgressBar&&Qt.closeProgress(null,t),Zt.isFunction(g)&&kf(g,r),!0},a=r.getMD5(),rr.DWT.IfAddMD5InUploadHeader&&(i["dwt-md5"]=a),!(s=r.getData(0,r.getLength()))||""==s)return Wa(e),y(e._errorCode,e._errorString);var u=new hG;u.url=v,u.method=t,u.content=s,s=null,u.headers=i,u.fileName=p,u.httpFormData=o,u.retry=d,u.bOnlyResponseEmptyIsOK=f,u.responseType=n,(new fG).httpPostUpload(S,u,_,y)}),y)}}}]);var r,a,u,c,h,m,p,v,_,y}(_G),sJ=pl,uJ=function(){return s((function A(e){var t=this;if(o(this,A),this._serverUrl=e,this._defaultDSScanClient=null,this._dsScanClientsMap={},this._serviceInfos=null,this._id=Zt.guid(),this.onBufferChanged=null,this.onPostTransferAsync=null,this._errorCode=0,this._errorString="",this._bDispose=!1,this._needSetLogLevel=!1,this._logLevel=-1,this._showProgressBar=!0,this._checkServerUrl(),this._id&&!rr.DWT.RemoteScanIdMap[this._id]&&(rr.DWT.RemoteScanIdMap[this._id]=this),this._uuidForRemoteScanObject="",Qt.dlgProgress||Qt.initProgress(null),rr.DWT.UseDefaultViewer){var r={viewerEvents:{bufferChanged:function(e,r){t.__bufferChanged(t,e,r)},save:function(e,r,n,i){return t.__save(e,r,n,i)},rotate:function(e,r,n){return t.__rotate(e,r,n)},crop:function(e,r,n,i,o){return t.__crop(e,{x:r,y:n,width:i,height:o})}},viewerError:{setError:function(e,r){t._defaultDSScanClient?aJ._setError(t._defaultDSScanClient,e,r):0==e&&""==r||(t._errorCode=e,t._errorString=r)}},imageEditorEvents:{deskew:function(e,r){t.__deskew(t,e,r)},removeImage:function(){t.__remove(t)},removeAllImage:function(){t.__removeAll(t)},close:function(){t.__close(t)}},imageEditorUiConfig:{buttons:{visibility:{scan:!1,load:!1}}},beforeImageEditorCreated:function(e){t.__beforeImageEditorCreated(e)}};this._viewer=new rr.DWTViewerEx(null,r)}else this._viewer=null}),[{key:"Viewer",get:function(){return this._viewer}},{key:"_disposeDSClientByKey",value:(k=n(g().mark((function x(e){var t;return g().wrap((function(r){for(;;)switch(r.prev=r.next){case 0:if(!(t=this._dsScanClientsMap[e])){r.next=10;break}if(t.isDestroy){r.next=9;break}if(!t.__unload){r.next=8;break}return r.next=6,t.__unload();case 6:r.next=9;break;case 8:t.dispose();case 9:delete this._dsScanClientsMap[e];case 10:case"end":return r.stop()}}),x,this)}))),function(e){return k.apply(this,arguments)})},{key:"_checkServerUrl",value:function(){var e=this._serverUrl;if(e&&Zt.isString(e)&&Zt.startsWith(location.href,"https://")&&Zt.startsWith(e,"http://")){var t={};throw function(e,t,r){ha(e,-2436,'Mixed Content: The page at "'+t+'" was loaded over HTTPS, but requested an insecure resource "'+r+'/ddm/18625/ddm/SearchScanner". This request has been blocked; the content must be served over HTTPS.')}(t,location.href,e),$s(t)}if(!Zt.isString(e)||""==e){var r={};throw ha(r,-2545,"The proxy server URL is invalid."),$s(r)}}},{key:"getDynamsoftService",value:(E=n(g().mark((function P(e){var t,r,n,i,o,a,s,u,c,l,d,f,h,m,p,v,_,y,S;return g().wrap((function(g){for(;;)switch(g.prev=g.next){case 0:if(!this._bDispose){g.next=4;break}throw ys(t={}),$s(t);case 4:if(r=this._serverUrl,this._checkServerUrl(),n=new xK(r,!0),Wl("getDynamsoftService",this.getViewerElement()),g.prev=8,!e&&this._serviceInfos){g.next=68;break}if(i=null,o=this._serviceInfos,this._serviceInfos=[],a="",s="",!ua()){g.next=30;break}return g.next=16,this._setRemoteUuid();case 16:return g.prev=16,g.next=19,$l(rr.DWT.lgdt(),"");case 19:(u=g.sent)&&(a=u.ar,s=this._uuidForRemoteScanObject),g.next=28;break;case 23:throw g.prev=23,g.t0=g["catch"](16),id(c={},g.t0),{code:c._errorCode,message:c._errorString};case 28:g.next=31;break;case 30:a=ia.refProductKey;case 31:return g.next=33,n.getDynamsoftService(a,s,e);case 33:if(!(i=g.sent)){g.next=68;break}d=[],l=0;case 37:if(!(l<i.length)){g.next=65;break}return m=hd(i[l]),p=null!==(f=null==m||null===(h=m.attrs)||void 0===h?void 0:h.ty)&&void 0!==f?f:"",g.next=42,aJ.checkOnlineByServiceInfo(m);case 42:if(!g.sent){g.next=60;break}if(m.attrs=m.attrs||{},m.attrs.bNoMask=!0,m.attrs.bNotShowMessage=!0,!o){g.next=57;break}v=void 0,v=0;case 50:if(!(v<o.length)){g.next=57;break}if(!this.isSameService(m,o[v])){g.next=54;break}return o.splice(v,1),g.abrupt("break",57);case 54:v++,g.next=50;break;case 57:this._serviceInfos.push(m),g.next=61;break;case 60:p+="(x)";case 61:d.push(p);case 62:l++,g.next=37;break;case 65:if(Zt.log("Find Dynamsoft Services:"),Zt.log(d.join(", ")),o)for(_=0;_<o.length;_++)(S=null===(y=o[_])||void 0===y||null===(y=y.attrs)||void 0===y?void 0:y.UUID)&&this._disposeDSClientByKey(S);case 68:this._needSetLogLevel&&-1!=this._logLevel&&this.setLogLevel(this._logLevel),g.next=74;break;case 71:throw g.prev=71,g.t1=g["catch"](8),g.t1;case 74:g.prev=74,Rl("getDynamsoftService");try{n._bInited&&n.dispose()}catch(PJ){}return g.finish(74);case 78:return g.abrupt("return",this._serviceInfos);case 79:case"end":return g.stop()}}),P,this,[[8,71,74,78],[16,23]])}))),function(e){return E.apply(this,arguments)})},{key:"getDefaultDynamsoftService",value:function(){if(this._bDispose){var e={};throw ys(e),$s(e)}return this._defaultDSScanClient?this._defaultDSScanClient.getServiceInfo():null}},{key:"setDefaultDynamsoftService",value:(w=n(g().mark((function D(e){var t,r,n,i;return g().wrap((function(o){for(;;)switch(o.prev=o.next){case 0:if(!this._bDispose){o.next=4;break}throw ys(t={}),$s(t);case 4:if(null!==e){o.next=7;break}return this._defaultDSScanClient=null,o.abrupt("return");case 7:if(e&&e instanceof fd){o.next=11;break}throw rs(r={}),{code:r._errorCode,message:r._errorString};case 11:return n=this.getViewerElement(),o.next=14,this._createDSClientByServiceInfo(e,!0,n._containerElement);case 14:if(!(i=o.sent)){o.next=18;break}return o.next=18,this._innerSetDefault(i);case 18:case"end":return o.stop()}}),D,this)}))),function(e){return w.apply(this,arguments)})},{key:"_innerSetDefault",value:(C=n(g().mark((function F(e){var t,r,n;return g().wrap((function(i){for(;;)switch(i.prev=i.next){case 0:if(!e){i.next=11;break}if(aJ._isReady(e)){i.next=5;break}throw n=null!==(t=null===(r=e.getServiceInfo())||void 0===r||null===(r=r.attrs)||void 0===r?void 0:r.name)&&void 0!==t?t:"",ms(e,n),{code:e._getErrorCode(),message:e._getErrorString()};case 5:this._defaultDSScanClient=e,this._defaultDSScanClient.IfShowProgressBar=this._showProgressBar,this.Viewer&&this.Viewer.webViewer&&this.Viewer.webViewer.bindViewUI&&this._defaultDSScanClient.setViewerInfo(this.Viewer.webViewer.bindViewUI),this.__setViewerControlInfo(),this._registEventToDefaultDS(),this._viewer&&this._viewer.webViewer.setBufferService(aJ._getBuffer(this._defaultDSScanClient));case 11:case"end":return i.stop()}}),F,this)}))),function(e){return C.apply(this,arguments)})},{key:"__setViewerControlInfo",value:function(){this.Viewer.webViewer.bindViewUI&&this.Viewer.width&&this.Viewer.width>0&&this.Viewer.height&&this.Viewer.height>0&&this._defaultDSScanClient.setViewerControlInfo({width:this.Viewer.width,height:this.Viewer.height})}},{key:"__beforeImageEditorCreated",value:function(e){var t=rr.DWT.CustomizableDisplayInfo;if(!Zt.isUndefined(t)){if(!Zt.isUndefined(t.buttons)){var r=t.buttons.titles;Zt.isUndefined(r)||(Zt.isUndefined(r.previous)||(e.buttons.titles.previous=r.previous),Zt.isUndefined(r.next)||(e.buttons.titles.next=r.next),Zt.isUndefined(r.print)||(e.buttons.titles.print=r.print),Zt.isUndefined(r.scan)||(e.buttons.titles.scan=r.scan),Zt.isUndefined(r.load)||(e.buttons.titles.load=r.load),Zt.isUndefined(r.rotateleft)||(e.buttons.titles.rotateleft=r.rotateleft),Zt.isUndefined(r.rotate)||(e.buttons.titles.rotate=r.rotate),Zt.isUndefined(r.rotateright)||(e.buttons.titles.rotateright=r.rotateright),Zt.isUndefined(r.deskew)||(e.buttons.titles.deskew=r.deskew),Zt.isUndefined(r.crop)||(e.buttons.titles.crop=r.crop),Zt.isUndefined(r.cut)||(e.buttons.titles.cut=r.cut),Zt.isUndefined(r.changeimagesize)||(e.buttons.titles.changeimagesize=r.changeimagesize),Zt.isUndefined(r.flip)||(e.buttons.titles.flip=r.flip),Zt.isUndefined(r.mirror)||(e.buttons.titles.mirror=r.mirror),Zt.isUndefined(r.zoomin)||(e.buttons.titles.zoomin=r.zoomin),Zt.isUndefined(r.originalsize)||(e.buttons.titles.originalsize=r.originalsize),Zt.isUndefined(r.zoomout)||(e.buttons.titles.zoomout=r.zoomout),Zt.isUndefined(r.stretch)||(e.buttons.titles.stretch=r.stretch),Zt.isUndefined(r.fit)||(e.buttons.titles.fit=r.fit),Zt.isUndefined(r.fitw)||(e.buttons.titles.fitw=r.fitw),Zt.isUndefined(r.fith)||(e.buttons.titles.fith=r.fith),Zt.isUndefined(r.hand)||(e.buttons.titles.hand=r.hand),Zt.isUndefined(r.rectselect)||(e.buttons.titles.rectselect=r.rectselect),Zt.isUndefined(r.zoom)||(e.buttons.titles.zoom=r.zoom),Zt.isUndefined(r.restore)||(e.buttons.titles.restore=r.restore),Zt.isUndefined(r.save)||(e.buttons.titles.save=r.save),Zt.isUndefined(r.close)||(e.buttons.titles.close=r.close),Zt.isUndefined(r.removeall)||(e.buttons.titles.removeall=r.removeall),Zt.isUndefined(r.removeselected)||(e.buttons.titles.removeselected=r.removeselected));var n=t.buttons.bShowAllButtons;Zt.isUndefined(n)||(e.buttons.bShowAllButtons=n);var i=t.buttons.visibility;Zt.isUndefined(i)||(Zt.isUndefined(i.scan)||(e.buttons.visibility.scan=i.scan),Zt.isUndefined(i.load)||(e.buttons.visibility.load=i.load),Zt.isUndefined(i.print)||(e.buttons.visibility.print=i.print),Zt.isUndefined(i.removeall)||(e.buttons.visibility.removeall=i.removeall),Zt.isUndefined(i.removeselected)||(e.buttons.visibility.removeselected=i.removeselected),Zt.isUndefined(i.rotateleft)||(e.buttons.visibility.rotateleft=i.rotateleft),Zt.isUndefined(i.rotate)||(e.buttons.visibility.rotate=i.rotate),Zt.isUndefined(i.rotateright)||(e.buttons.visibility.rotateright=i.rotateright),Zt.isUndefined(i.deskew)||(e.buttons.visibility.deskew=i.deskew),Zt.isUndefined(i.crop)||(e.buttons.visibility.crop=i.crop),Zt.isUndefined(i.cut)||(e.buttons.visibility.cut=i.cut),Zt.isUndefined(i.changeimagesize)||(e.buttons.visibility.changeimagesize=i.changeimagesize),Zt.isUndefined(i.flip)||(e.buttons.visibility.flip=i.flip),Zt.isUndefined(i.mirror)||(e.buttons.visibility.mirror=i.mirror),Zt.isUndefined(i.zoomin)||(e.buttons.visibility.zoomin=i.zoomin),Zt.isUndefined(i.originalsize)||(e.buttons.visibility.originalsize=i.originalsize),Zt.isUndefined(i.zoomout)||(e.buttons.visibility.zoomout=i.zoomout),Zt.isUndefined(i.stretch)||(e.buttons.visibility.stretch=i.stretch),Zt.isUndefined(i.fit)||(e.buttons.visibility.fit=i.fit),Zt.isUndefined(i.fitw)||(e.buttons.visibility.fitw=i.fitw),Zt.isUndefined(i.fith)||(e.buttons.visibility.fith=i.fith),Zt.isUndefined(i.hand)||(e.buttons.visibility.hand=i.hand),Zt.isUndefined(i.rectselect)||(e.buttons.visibility.rectselect=i.rectselect),Zt.isUndefined(i.zoom)||(e.buttons.visibility.zoom=i.zoom))}var o=t.dialogText;Zt.isUndefined(o)||(Zt.isUndefined(o.dlgRotateAnyAngle)||(e.dialogText.dlgRotateAnyAngle=o.dlgRotateAnyAngle),Zt.isUndefined(o.dlgChangeImageSize)||(e.dialogText.dlgChangeImageSize=o.dlgChangeImageSize),Zt.isUndefined(o.saveChangedImage)||(e.dialogText.saveChangedImage=o.saveChangedImage),Zt.isUndefined(o.selectSource)||(e.dialogText.selectSource=o.selectSource))}}},{key:"__bufferChanged",value:function(e,t,r){var n,i=e,o=[],a=-1,s=[];t.operation&&(t.action=t.operation);for(var u=0;u<i.howManyImagesInBuffer;u++)(n=i._defaultDSScanClient.getCustomDataByIndex(u))&&n.uidFromServer&&o.push(n.uidFromServer);if(t.imageIds=o,t.curIndex>=0&&(n=i._defaultDSScanClient.getCustomDataByIndex(t.curIndex))&&n.uidFromServer&&(a=n.uidFromServer),t.currentId=a,t.afterStatus.selectedUids)for(var c=0;c<t.afterStatus.selectedUids.length;c++){var l=t.afterStatus.selectedUids[c];if(l&&-1!=l){var d=i._defaultDSScanClient.getIndexByUid(t.afterStatus.selectedUids[c]);d>=0&&(n=i._defaultDSScanClient.getCustomDataByIndex(d))&&n.serverId&&s.push(n.uidFromServer)}}t.selectedIds=s,Zt.mix(t,{}),delete t.uids,delete t.currentUid,delete t.selectedUids,delete t.afterStatus,delete t.beforeStatus,delete t.operation,delete t.curIndex,delete t.docUid,i.__fireEvent("onBufferChanged",t)}},{key:"__acquire",value:function(e,t){var r=e;r._stwain.SelectSource((function(){r._stwain.CloseSource(),r._stwain.OpenSource(),r._stwain.IfShowUI=!0,1==rr.DWT.IfConfineMaskWithinTheViewer?(rr.DWT.IfConfineMaskWithinTheViewer=!1,r._stwain.AcquireImage({},(function(){rr.DWT.IfConfineMaskWithinTheViewer=!0}),(function(){}))):r._stwain.AcquireImage()}),(function(){Zt.log("User did not select a source")}))}},{key:"__remove",value:(T=n(g().mark((function W(e){var t,r;return g().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(t=this,!this._defaultDSScanClient){e.next=10;break}if(ls(this._defaultDSScanClient),!(t.howManyImagesInBuffer<=0||t.currentImageIndexInBuffer<0)){e.next=6;break}return sJ.output(t,"No image in Buffer"),e.abrupt("return",!0);case 6:return r=aJ._getBuffer(this._defaultDSScanClient),e.next=9,this._defaultDSScanClient.removeImages(r.getSelectedImagesIndices());case 9:return e.abrupt("return",e.sent);case 10:return e.abrupt("return",!1);case 11:case"end":return e.stop()}}),W,this)}))),function(e){return T.apply(this,arguments)})},{key:"__removeAll",value:(b=n(g().mark((function R(e){return g().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(!this._defaultDSScanClient){e.next=4;break}return ls(this._defaultDSScanClient),e.next=4,this._defaultDSScanClient._removeAllImagesAsync("removeAllImages",!0);case 4:return e.abrupt("return",!1);case 5:case"end":return e.stop()}}),R,this)}))),function(e){return b.apply(this,arguments)})},{key:"__save",value:(I=n(g().mark((function N(e,t,r,n){var i,o,a;return g().wrap((function(s){for(;;)switch(s.prev=s.next){case 0:if(o="save",a=(i=this).__getViewerElementForViewer(i,n),Wl(o,a),s.prev=3,ls(i._defaultDSScanClient),!(i.howManyImagesInBuffer<=0||i.currentImageIndexInBuffer<0)){s.next=8;break}return sJ.output(i,"No image in Buffer"),s.abrupt("return");case 8:return s.next=10,i._defaultDSScanClient.updateImage(e,t,r);case 10:return s.sent,s.next=13,i._defaultDSScanClient.__saveToViewerAfterUpdate(e,r);case 13:s.next=17;break;case 15:s.prev=15,s.t0=s["catch"](3);case 17:return s.prev=17,Rl(o),s.finish(17);case 20:case"end":return s.stop()}}),N,this,[[3,15,17,20]])}))),function(e,t,r,n){return I.apply(this,arguments)})},{key:"__getViewerElementForViewer",value:function(e,t){var r,n=e;if(t)if(n._viewer.webViewer.imageEditor){var i=n._viewer.createImageEditor();r="dwt-viewer-imageEditor-fullScreen"==i.inner.containerElement.className?{_containerElement:document.body}:{_containerElement:i.inner.containerElement}}else r=n.getViewerElement();else r=n.getViewerElement();return r}},{key:"__close",value:function(e){var t=e;if(Zt.isFunction(t.__CloseImageEditorUI))try{t.__CloseImageEditorUI()}catch(r){Ho(r)}}},{key:"__deskew",value:function(e,t,r){var n=this,i="deskew";if(ls(n._defaultDSScanClient),n.howManyImagesInBuffer<=0||n.currentImageIndexInBuffer<0)sJ.output(n,"No image in Buffer");else{var o=n.__getViewerElementForViewer(n,!0);Wl(i,o);n._defaultDSScanClient.getSkewAngleFromBinaryAsync(n.currentImageIndexInBuffer,t,(function(e){r(e[0]),Rl(i)}),(function(){Rl(i)}))}}},{key:"__rotate",value:(S=n(g().mark((function O(e,t,r){var n;return g().wrap((function(i){for(;;)switch(i.prev=i.next){case 0:return ls(this._defaultDSScanClient),i.next=4,this._makeSureDefaultServiceInfo();case 4:if(this._defaultDSScanClient){i.next=6;break}throw{code:-2825,message:"Failed to setup the Default Dynamsoft Service."};case 6:return i.next=8,this._defaultDSScanClient.rotate(e,t,r,-1);case 8:return n=i.sent,i.abrupt("return",n);case 10:case"end":return i.stop()}}),O,this)}))),function(e,t,r){return S.apply(this,arguments)})},{key:"__crop",value:(y=n(g().mark((function M(e,t){var r;return g().wrap((function(n){for(;;)switch(n.prev=n.next){case 0:return ls(this._defaultDSScanClient),n.next=4,this._makeSureDefaultServiceInfo();case 4:if(this._defaultDSScanClient){n.next=6;break}throw{code:-2825,message:"Failed to setup the Default Dynamsoft Service."};case 6:return n.next=8,this._defaultDSScanClient.crop(e,t);case 8:return r=n.sent,n.abrupt("return",r);case 10:case"end":return n.stop()}}),M,this)}))),function(e,t){return y.apply(this,arguments)})},{key:"__fireEvent",value:function(e,t){return!Zt.isFunction(this[e])||this[e](t)}},{key:"getDevices",value:(_=n(g().mark((function L(e){var t,r,n,i,o,a,s,u,c,l,d,f,h,m,p,v,_,y,S,I,b,T,C;return g().wrap((function(g){for(;;)switch(g.prev=g.next){case 0:if(!this._bDispose){g.next=4;break}throw ys(r={}),$s(r);case 4:if(n=[],i="getDevices",o=this.getViewerElement(),a=!1,u=null==e?void 0:e.serviceInfo,c=null!==(t=null==e?void 0:e.deviceType)&&void 0!==t?t:wl,Wl(i,o),g.prev=6,d=!1,f=[],this._serviceInfos){g.next=12;break}return g.next=12,this.getDynamsoftService();case 12:if(!u){g.next=25;break}return g.next=15,this._createDSClientByServiceInfo(u,!0);case 15:if(!(m=g.sent)){g.next=21;break}f.push(m),d=!1,g.next=23;break;case 21:throw Fs(null==u||null===(p=u.attrs)||void 0===p?void 0:p.ty);case 23:g.next=37;break;case 25:if(!this._serviceInfos){g.next=37;break}h=0;case 27:if(!(h<this._serviceInfos.length)){g.next=36;break}return v=this._serviceInfos[h],g.next=31,this._createDSClientByServiceInfo(v);case 31:(_=g.sent)&&f.push(_);case 33:h++,g.next=27;break;case 36:d=!0;case 37:h=0;case 38:if(!(h<f.length)){g.next=59;break}return y=void 0,g.prev=40,g.next=43,f[h].getDevices(c,null==e?void 0:e.refresh,a);case 43:if(y=g.sent,Zt.isArray(y)&&y.length>0)for(s=0;s<y.length;s++)n.push(y[s]);g.next=51;break;case 47:g.prev=47,g.t0=g["catch"](40),l=g.t0;case 51:return g.prev=51,S=null,this._defaultDSScanClient&&(S=null===(I=this._defaultDSScanClient.getServiceInfo())||void 0===I||null===(I=I.attrs)||void 0===I?void 0:I.UUID,this._defaultDSScanClient.isDestroy&&(this._disposeDSClientByKey(S),this._defaultDSScanClient=null,S=null)),d&&(T=f[h].getServiceInfo(),(C=null==T||null===(b=T.attrs)||void 0===b?void 0:b.UUID)&&C!=S&&this._disposeDSClientByKey(C)),g.finish(51);case 56:h++,g.next=38;break;case 59:g.next=64;break;case 61:throw g.prev=61,g.t1=g["catch"](6),g.t1;case 64:return g.prev=64,Rl(i),l&&rr.DWT.lsetException(l.code,l.message),g.finish(64);case 68:return g.abrupt("return",n);case 69:case"end":return g.stop()}}),L,this,[[6,61,64,68],[40,47,51,56]])}))),function(e){return _.apply(this,arguments)})},{key:"acquireImage",value:(v=n(g().mark((function B(e,t){var r,n,i,o,a,s,u,c,l,d,f,h,m,p;return g().wrap((function(g){for(;;)switch(g.prev=g.next){case 0:if(!(r=this)._bDispose){g.next=5;break}throw ys(n={}),$s(n);case 5:if(e&&e instanceof Id){g.next=9;break}throw rs(i={}),{code:i._errorCode,message:i._errorString};case 9:return a="acquireImage",s=r.getViewerElement(),u=[],Wl(a,s),g.prev=12,Zt.isUndefined(t)&&(t={}),Zt.isUndefined(t.IfShowUI)&&(t.IfShowUI=!1),Zt.isUndefined(t.IfCloseSourceAfterAcquire)&&(t.IfCloseSourceAfterAcquire=!0),c=e.serviceInfo,g.next=19,this._createDSClientByServiceInfo(c,!0);case 19:if(!(o=g.sent)){g.next=47;break}if(r._defaultDSScanClient){g.next=24;break}return g.next=24,r._innerSetDefault(o);case 24:u.push(o),o!=r._defaultDSScanClient&&u.push(r._defaultDSScanClient),l=0;case 27:if(!(l<u.length)){g.next=36;break}if(d=u[l],aJ._isReady(d)){g.next=33;break}throw m=null!==(f=null===(h=d.getServiceInfo())||void 0===h||null===(h=h.attrs)||void 0===h?void 0:h.name)&&void 0!==f?f:"",ms(d,m),{code:d._getErrorCode(),message:d._getErrorString()};case 33:l++,g.next=27;break;case 36:if(r.onPostTransferAsync?o.registerEvent("OnPostTransferAsync",r.onPostTransferAsync):o.unregisterEvent("OnPostTransferAsync"),this.__setViewerControlInfo(),o!=r._defaultDSScanClient){g.next=43;break}return g.next=41,o.acquireImage(e,t);case 41:g.next=45;break;case 43:return g.next=45,o._acquireImageForSendTo(a,e,t,r._defaultDSScanClient);case 45:g.next=49;break;case 47:throw ds(null==c||null===(p=c.attrs)||void 0===p?void 0:p.name);case 49:g.next=54;break;case 51:throw g.prev=51,g.t0=g["catch"](12),g.t0;case 54:return g.prev=54,o&&o.__closeRemoteScanUI(!0),Rl(a),g.finish(54);case 58:case"end":return g.stop()}}),B,this,[[12,51,54,58]])}))),function(e,t){return v.apply(this,arguments)})},{key:"_waitForDSValid",value:function(e,t){for(var r=0,n=e.length,i=this;r<n;r++)if(!aJ._isReady(e[r]))return void setTimeout((function(){i._waitForDSValid(e,t)}),oa.RemoteReconnectTimeSpan);Zt.isFunction(i[t.command])&&i[t.command].apply(i,t.parmas)}},{key:"getCapabilities",value:(p=n(g().mark((function U(e){var t,r,n,i,o,a,s;return g().wrap((function(u){for(;;)switch(u.prev=u.next){case 0:if(!this._bDispose){u.next=4;break}throw ys(t={}),$s(t);case 4:if(e&&e instanceof Id){u.next=8;break}throw rs(r={}),$s(r);case 8:return i="getCapabilities",o=[],a=this.getViewerElement(),Wl(i,a),u.prev=10,s=e.serviceInfo,u.next=14,this._createDSClientByServiceInfo(s,!0);case 14:if(n=u.sent,!(n=this._findDSClientByServiceInfo(s))){u.next=20;break}return u.next=19,n.getCapabilities(e);case 19:o=u.sent;case 20:u.next=25;break;case 22:throw u.prev=22,u.t0=u["catch"](10),u.t0;case 25:return u.prev=25,n&&n.__closeRemoteScanUI(!0),Rl(i),u.finish(25);case 29:return u.abrupt("return",o);case 30:case"end":return u.stop()}}),U,this,[[10,22,25,29]])}))),function(e){return p.apply(this,arguments)})},{key:"setCapabilities",value:(m=n(g().mark((function V(e,t){var r,n,i,o,a,s;return g().wrap((function(u){for(;;)switch(u.prev=u.next){case 0:if(!this._bDispose){u.next=4;break}throw ys(r={}),$s(r);case 4:if(e&&e instanceof Id){u.next=8;break}throw rs(n={}),$s(n);case 8:return o="setCapabilities",a=this.getViewerElement(),Wl(o,a),u.prev=10,s=e.serviceInfo,u.next=14,this._createDSClientByServiceInfo(s,!0);case 14:if(!(i=u.sent)){u.next=18;break}return u.next=18,i.setCapabilities(e,t);case 18:u.next=23;break;case 20:throw u.prev=20,u.t0=u["catch"](10),u.t0;case 23:return u.prev=23,i&&i.__closeRemoteScanUI(!0),Rl(o),u.finish(23);case 27:case"end":return u.stop()}}),V,this,[[10,20,23,27]])}))),function(e,t){return m.apply(this,arguments)})},{key:"closeSource",value:(h=n(g().mark((function j(e){var t,r,n,i,o,a;return g().wrap((function(s){for(;;)switch(s.prev=s.next){case 0:if(!this._bDispose){s.next=4;break}throw ys(t={}),$s(t);case 4:if(e&&e instanceof Id){s.next=8;break}throw rs(r={}),$s(r);case 8:return n="closeSource",i=this.getViewerElement(),Wl(n,i),s.prev=10,o=e.serviceInfo,a=this._findDSClientByServiceInfo(o),s.next=15,a.closeSource();case 15:s.next=20;break;case 17:throw s.prev=17,s.t0=s["catch"](10),s.t0;case 20:return s.prev=20,Rl(n),s.finish(20);case 23:case"end":return s.stop()}}),j,this,[[10,17,20,23]])}))),function(e){return h.apply(this,arguments)})},{key:"_putDSClientToMap",value:function(e,t){var r,n=null==e||null===(r=e.attrs)||void 0===r?void 0:r.UUID;n&&(this._dsScanClientsMap[n]=t)}},{key:"_getDSClientFromMap",value:function(e){var t,r=null==e||null===(t=e.attrs)||void 0===t?void 0:t.UUID;return r?this._dsScanClientsMap[r]:null}},{key:"_createDSClientByServiceInfo",value:(f=n(g().mark((function G(e,t,r){var n,i,o,a;return g().wrap((function(s){for(;;)switch(s.prev=s.next){case 0:if(this._serviceInfos){s.next=3;break}return s.next=3,this.getDynamsoftService();case 3:if(n=this._findDSClientByServiceInfo(e)){s.next=20;break}return s.next=7,this._setRemoteUuid();case 7:return s.prev=7,s.next=10,aJ.createByServiceInfo(this._uuidForRemoteScanObject,e,r);case 10:(n=s.sent)&&this._putDSClientToMap(e,n),s.next=20;break;case 14:if(s.prev=14,s.t0=s["catch"](7),s.t0.code==_a.MustUpgrade&&(o=null==e||null===(i=e.attrs)||void 0===i?void 0:i.ty)&&(Ca(a={},o),s.t0.message=a._errorString),!t){s.next=19;break}throw s.t0;case 19:Zt.warn(s.t0);case 20:return s.abrupt("return",n);case 21:case"end":return s.stop()}}),G,this,[[7,14]])}))),function(e,t,r){return f.apply(this,arguments)})},{key:"_makeSureDefaultServiceInfo",value:(d=n(g().mark((function H(){var e;return g().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(this._serviceInfos){t.next=3;break}return t.next=3,this.getDynamsoftService();case 3:if(!(this._serviceInfos&&this._serviceInfos.length>0)){t.next=8;break}return e=this._serviceInfos[0],t.next=7,this._createDSClientByServiceInfo(e);case 7:return t.abrupt("return",t.sent);case 8:return t.abrupt("return",null);case 9:case"end":return t.stop()}}),H,this)}))),function(){return d.apply(this,arguments)})},{key:"httpUpload",value:(l=n(g().mark((function z(e,t,r,n,i,o){var a,s,u,c;return g().wrap((function(l){for(;;)switch(l.prev=l.next){case 0:if(!this._bDispose){l.next=4;break}return ys(a={}),l.abrupt("return",Qt.Promise.reject($s(a)));case 4:return u=this.getViewerElement(),c=u._containerElement,l.next=7,this._makeSureDefaultServiceInfo();case 7:if(this._defaultDSScanClient){l.next=9;break}throw{code:-2825,message:"Failed to setup the Default Dynamsoft Service."};case 9:return l.next=11,this._defaultDSScanClient.httpUpload(e,t,r,n,i,o,c);case 11:return s=l.sent,l.abrupt("return",s);case 13:case"end":return l.stop()}}),z,this)}))),function(e,t,r,n,i,o){return l.apply(this,arguments)})},{key:"runCommand",value:function(e){return this._defaultDSScanClient.RunCommandAsync(e)}},{key:"removeImages",value:(c=n(g().mark((function K(e){var t,r,n,i,o;return g().wrap((function(a){for(;;)switch(a.prev=a.next){case 0:if(!this._bDispose){a.next=4;break}return ys(t={}),a.abrupt("return",Qt.Promise.reject($s(t)));case 4:return r="removeImages",i=this.getViewerElement(),Wl(r,i),a.prev=6,a.next=9,this._makeSureDefaultServiceInfo();case 9:if(this._defaultDSScanClient){a.next=11;break}throw{code:-2825,message:"Failed to setup the Default Dynamsoft Service."};case 11:if(!this._defaultDSScanClient){a.next=17;break}return a.next=14,this._defaultDSScanClient.removeImages(e);case 14:n=a.sent,a.next=21;break;case 17:if(0!=this.howManyImagesInBuffer){a.next=21;break}if(o={},SG(e,this.howManyImagesInBuffer,o)){a.next=21;break}throw{code:o._errorCode,message:o._errorString};case 21:a.next=26;break;case 23:throw a.prev=23,a.t0=a["catch"](6),a.t0;case 26:return a.prev=26,Rl(r),a.finish(26);case 29:return a.abrupt("return",n);case 30:case"end":return a.stop()}}),K,this,[[6,23,26,29]])}))),function(e){return c.apply(this,arguments)})},{key:"saveImages",value:(u=n(g().mark((function J(e,t,r){var n,i,o,a;return g().wrap((function(s){for(;;)switch(s.prev=s.next){case 0:if(n={},!this._bDispose){s.next=4;break}return ys(n),s.abrupt("return",Qt.Promise.reject($s(n)));case 4:if(0!=this.howManyImagesInBuffer){s.next=7;break}return Ia(n),s.abrupt("return",Qt.Promise.reject($s(n)));case 7:if(Zt.isNumber(r)){s.next=10;break}return rs(n),s.abrupt("return",Qt.Promise.reject($s(n)));case 10:if(r!=Ad.IT_BMP&&r!=Ad.IT_JPG&&r!=Ad.IT_PNG){s.next=16;break}if(!(t.length>1)){s.next=14;break}return ha(n,-2623,"Saving multiple images is not allowable when the selected output format is BMP, JPG or PNG."),s.abrupt("return",Qt.Promise.reject($s(n)));case 14:s.next=27;break;case 16:if(r!=Ad.IT_TIF&&r!=Ad.IT_PDF){s.next=20;break}s.next=27;break;case 20:if(r!=Ad.IT_ALL&&r!=Ad.IT_MULTIPAGE_PDF&&r!=Ad.IT_MULTIPAGE_TIF){s.next=25;break}return Is(n),s.abrupt("return",Qt.Promise.reject($s(n)));case 25:return Qa(n),s.abrupt("return",Qt.Promise.reject($s(n)));case 27:return o=this.getViewerElement(),a=o._containerElement,s.next=30,this._makeSureDefaultServiceInfo();case 30:if(this._defaultDSScanClient){s.next=32;break}throw{code:-2825,message:"Failed to setup the Default Dynamsoft Service."};case 32:return s.next=34,this._defaultDSScanClient.saveImages(e,t,r,a);case 34:return i=s.sent,s.abrupt("return",i);case 36:case"end":return s.stop()}}),J,this)}))),function(e,t,r){return u.apply(this,arguments)})},{key:"getImages",value:(a=n(g().mark((function Q(e,t,r){var n,i,o,a;return g().wrap((function(s){for(;;)switch(s.prev=s.next){case 0:if(n={},!this._bDispose){s.next=4;break}return ys(n),s.abrupt("return",Qt.Promise.reject($s(n)));case 4:if(0!=this.howManyImagesInBuffer){s.next=7;break}return Ia(n),s.abrupt("return",Qt.Promise.reject($s(n)));case 7:if(Zt.isNumber(t)&&Zt.isNumber(r)){s.next=10;break}return rs(n),s.abrupt("return",Qt.Promise.reject($s(n)));case 10:return o=this.getViewerElement(),a=o._containerElement,s.next=13,this._makeSureDefaultServiceInfo();case 13:if(this._defaultDSScanClient){s.next=15;break}throw{code:-2825,message:"Failed to setup the Default Dynamsoft Service."};case 15:return s.next=17,this._defaultDSScanClient.getImages(e,t,r,a);case 17:return i=s.sent,s.abrupt("return",i);case 19:case"end":return s.stop()}}),Q,this)}))),function(e,t,r){return a.apply(this,arguments)})},{key:"__unload",value:(i=n(g().mark((function q(){var e,t,r,n;return g().wrap((function(i){for(;;)switch(i.prev=i.next){case 0:if(this._viewer&&this._viewer.unbind(),!this._dsScanClientsMap){i.next=12;break}t=this._dsScanClientsMap,r=Object.keys(t),e=0;case 5:if(!(e<r.length)){i.next=12;break}return n=r[e],i.next=9,this._disposeDSClientByKey(n);case 9:e++,i.next=5;break;case 12:this._dsScanClientsMap=null,this._bDispose=!0;case 14:case"end":return i.stop()}}),q,this)}))),function(){return i.apply(this,arguments)})},{key:"dispose",value:function(){return this.__unload()}},{key:"setLogLevel",value:function(e){var t,r=this._dsScanClientsMap;if(r){var n=Object.keys(r);for(t=0;t<n.length;t++)r[n[t]]._setLogLevel(e);this._needSetLogLevel=!1,this._logLevel=-1}else this._needSetLogLevel=!0,this._logLevel=e;return!0}},{key:"getProfile",value:(r=n(g().mark((function Y(e){var t,r,n,i;return g().wrap((function(o){for(;;)switch(o.prev=o.next){case 0:if(t="",e&&e instanceof Id){o.next=5;break}throw rs(r={}),{code:r._errorCode,message:r._errorString};case 5:return o.prev=5,n=e.serviceInfo,o.next=9,this._createDSClientByServiceInfo(n,!0);case 9:if(!(i=o.sent)){o.next=14;break}return o.next=13,i.getProfile(e);case 13:t=o.sent;case 14:o.next=19;break;case 16:throw o.prev=16,o.t0=o["catch"](5),o.t0;case 19:return o.abrupt("return",t);case 20:case"end":return o.stop()}}),Y,this,[[5,16]])}))),function(e){return r.apply(this,arguments)})},{key:"setProfile",value:(t=n(g().mark((function X(e,t){var r,n,i,o;return g().wrap((function(a){for(;;)switch(a.prev=a.next){case 0:if(r="",e&&e instanceof Id){a.next=5;break}throw rs(n={}),{code:n._errorCode,message:n._errorString};case 5:return a.prev=5,i=e.serviceInfo,a.next=9,this._createDSClientByServiceInfo(i,!0);case 9:if(!(o=a.sent)){a.next=14;break}return a.next=13,o.setProfile(e,t);case 13:r=a.sent;case 14:a.next=19;break;case 16:throw a.prev=16,a.t0=a["catch"](5),a.t0;case 19:return a.abrupt("return",r);case 20:case"end":return a.stop()}}),X,this,[[5,16]])}))),function(e,r){return t.apply(this,arguments)})},{key:"imageIDToIndex",value:function(e){return this._defaultDSScanClient?this._defaultDSScanClient.imageIDToIndex(e):0}},{key:"indexToImageID",value:function(e){return this._defaultDSScanClient?this._defaultDSScanClient.indexToImageID(e):""}},{key:"howManyImagesInBuffer",get:function(){return this._defaultDSScanClient?this._defaultDSScanClient.howManyImagesInBuffer:0}},{key:"currentImageIndexInBuffer",get:function(){return this._defaultDSScanClient?this._defaultDSScanClient.currentImageIndexInBuffer:-1},set:function(e){this._defaultDSScanClient&&(this._defaultDSScanClient.currentImageIndexInBuffer=e)}},{key:"showProgressBar",get:function(){return this._defaultDSScanClient?this._defaultDSScanClient.IfShowProgressBar:this._showProgressBar},set:function(e){this._defaultDSScanClient?(this._showProgressBar=e,this._defaultDSScanClient.IfShowProgressBar=e):this._showProgressBar}},{key:"registerEvent",value:function(e,t){if(this._bDispose){var r={};return ys(r),Qt.Promise.reject($s(r))}if(!Zt.isFunction(t)){var n={};return is(n),Qt.Promise.reject($s(n))}if("onBufferChanged"==e||"OnBufferChanged"==e)this.onBufferChanged=t;else{if("onPostTransferAsync"!=e&&"OnPostTransferAsync"!=e){var i={};return $a(i),Qt.Promise.reject($s(i))}this.onPostTransferAsync=t}return this._registEventToDefaultDS(),!0}},{key:"unregisterEvent",value:function(e,t){if(this._bDispose){var r={};return ys(r),Qt.Promise.reject($s(r))}if("onBufferChanged"==e||"OnBufferChanged"==e){if(this.onBufferChanged=null,this._defaultDSScanClient)return this._defaultDSScanClient.unregisterEvent("OnBufferChanged",t)}else{if("onPostTransferAsync"!=e&&"OnPostTransferAsync"!=e){var n={};return $a(n),Qt.Promise.reject($s(n))}if(this.onPostTransferAsync=null,this._defaultDSScanClient)return this._defaultDSScanClient.unregisterEvent("OnPostTransferAsync",t)}}},{key:"getViewerElement",value:function(){return this.Viewer&&this.Viewer.webViewer&&this.Viewer.webViewer.containerElement?{_containerElement:this.Viewer.webViewer.containerElement}:{_containerElement:document.body}}},{key:"isSameService",value:function(e,t){return!(!e||!t)&&(e.server==t.server&&e.attrs.UUID==t.attrs.UUID&&e.attrs.accessmode==t.attrs.accessmode&&e.attrs.name==t.attrs.name&&e.attrs.os==t.attrs.os&&e.attrs.service_type==t.attrs.service_type&&e.attrs.tags==t.attrs.tags&&e.attrs.ty==t.attrs.ty&&e.attrs.type==t.attrs.type&&e.attrs.txtvers==t.attrs.txtvers)}},{key:"_findDSClientByServiceInfo",value:function(e){var t,r=this._serviceInfos;if(r)for(t=0;t<r.length;t++){var n=r[t];if(this.isSameService(e,n)){var i=this._getDSClientFromMap(n);if(i){var o;if(aJ._isReady(i))return i;i.isDestroy||i.dispose();var a=null==n||null===(o=n.attrs)||void 0===o?void 0:o.UUID;a&&delete this._dsScanClientsMap[a]}break}}return null}},{key:"_setRemoteUuid",value:(e=n(g().mark((function Z(){var e;return g().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(!ua()){t.next=6;break}if(this._uuidForRemoteScanObject){t.next=6;break}return t.next=4,rr.DWT.lgcuid(rr.DWT.lgdt(),"");case 4:e=t.sent,this._uuidForRemoteScanObject=e;case 6:case"end":return t.stop()}}),Z,this)}))),function(){return e.apply(this,arguments)})},{key:"_registEventToDefaultDS",value:function(){this._defaultDSScanClient&&(this.onBufferChanged&&this._defaultDSScanClient.registerEvent("OnBufferChanged",this.onBufferChanged),this.onPostTransferAsync&&this._defaultDSScanClient.registerEvent("OnPostTransferAsync",this.onPostTransferAsync))}}]);var e,t,r,i,a,u,c,l,d,f,h,m,p,v,_,y,S,I,b,T,C,w,E,k}(),cJ=!1;function lJ(e,t){return dJ.apply(this,arguments)}function dJ(){return dJ=n(g().mark((function e(t,r){var n,i;return g().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return r&&Xu("Checking Product Key format..."),e.next=3,Wc.preParseProductKey(r);case 3:if(0==(n=rr.DWT.licenseException).code){e.next=7;break}throw t&&ld(n),{code:n.code,message:n.message};case 7:if(cJ){e.next=15;break}if(i=!1,de.bIE&&(i=de.IEVersion<=7),i||!ua()){e.next=15;break}if(rr.DWT.IfLoadResources){e.next=14;break}return cJ=!0,e.abrupt("return");case 14:return e.abrupt("return",new Qt.Promise((function(e,t){var r=Oo(),n="";!de.bFileSystem&&rr.DWT.IfResourcesAddTimestamp&&(n=Qt.timestamp),Zt.addScript([r,"/src/dynamsoft.lts.js",n].join(""),!0,!1,(function(r){if(rr.LTS&&rr.LTS._)return cJ=!0,void e();if(r){if(de.bIE)return void t({code:-2822,message:"The WebTwain JavaScript lts.js load failed."});if("error"==r.type)return void t({code:-2822,message:"The WebTwain JavaScript lts.js load failed."})}cJ=!0,e()}))})));case 15:case"end":return e.stop()}}),e)}))),dJ.apply(this,arguments)}function fJ(e,t,r){return hJ.apply(this,arguments)}function hJ(){return hJ=n(g().mark((function e(t,r,n){var i,o,a,s,u,c,l,d,f,h,m;return g().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:i=rr.DWT.Containers,o=0;case 2:if(!(o<i.length)){e.next=53;break}if(!(a=Zt.clone(i[o])).ContainerId){e.next=8;break}if(!rr.DWT.ContainerMap[a.ContainerId]){e.next=8;break}return e.abrupt("continue",50);case 8:if(!a.WebTwainId){e.next=12;break}if(!rr.DWT.WebTwainIdMap[a.WebTwainId]){e.next=12;break}return e.abrupt("continue",50);case 12:if(a.Host=t,a.SSLPort=n,a.Port=r,!Zt.isDOM(a.Container)){e.next=19;break}e.next=26;break;case 19:if(!a.ContainerId){e.next=26;break}if(c=a.ContainerId,Zt.isString(c)){e.next=23;break}throw{code:-2806,message:'Error: The argument passed to the parameter "conatinerId" is not a string.'};case 23:if(a.Container=Zt.get(c),a.Container){e.next=26;break}throw ws(c);case 26:if(!oH(a.Container)){e.next=33;break}return l=document.createElement("div"),a.Container.appendChild(l),a.Container=l,d=iH(l),e.next=33,Wo(d);case 33:return Ao(f=Vz(a)),h=void 0,e.prev=36,e.next=39,zK.create(f);case 39:h=e.sent,e.next=46;break;case 42:throw e.prev=42,e.t0=e["catch"](36),h&&h.dispose(),e.t0;case 46:if(0===(u=rr.DWT.licenseException).code){e.next=49;break}throw{code:u.code,message:u.message};case 49:s=h;case 50:o++,e.next=2;break;case 53:m=window,s&&(m.DCP_DWT_OnClickCloseInstall&&m.DCP_DWT_OnClickCloseInstall(!1,!0),nJ(s),yG(s)),setTimeout((function(){try{Zt.isFunction(rr.DWT.OnWebTwainReady)?rr.DWT.OnWebTwainReady():Zt.isFunction(m.Dynamsoft_OnReady)&&m.Dynamsoft_OnReady()}catch(e){Ho(e)}}),100);case 56:case"end":return e.stop()}}),e,null,[[36,42]])}))),hJ.apply(this,arguments)}function gJ(){return mJ.apply(this,arguments)}function mJ(){return mJ=n(g().mark((function e(){var t,r,n,i,o,a,s,u,c,l,d,f,h,m;return g().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(Qt.page.bUnload=di,ia.bHTML5Edition){e.next=3;break}return e.abrupt("return",rr.DWT._innerLoad());case 3:return e.next=5,lJ(!0,!0);case 5:if((t=rr.DWT.Containers)&&0!==t.length){e.next=10;break}throw Ss(r={}),{code:r._errorCode,message:r._errorString};case 10:o=!1,a=[],s=[],n=0;case 12:if(!(n<t.length)){e.next=37;break}if(!(i=t[n])){e.next=32;break}if(Zt.isObject(i)){e.next=18;break}return o=!0,e.abrupt("break",37);case 18:if(!Zt.isString(i.WebTwainId)||""==i.WebTwainId){e.next=24;break}if(!No(a,i.WebTwainId)){e.next=23;break}throw ks(r={}),{code:r._errorCode,message:r._errorString};case 23:a.push(i.WebTwainId);case 24:if(!Zt.isString(i.ContainerId)||""==i.ContainerId){e.next=30;break}if(!No(s,i.ContainerId)){e.next=29;break}throw As(r={}),{code:r._errorCode,message:r._errorString};case 29:s.push(i.ContainerId);case 30:e.next=34;break;case 32:return o=!0,e.abrupt("break",37);case 34:n++,e.next=12;break;case 37:if(!o){e.next=41;break}throw bs(u={}),{code:u._errorCode,message:u._errorString};case 41:return c=qo(),l=rr.DWT.Port,d=rr.DWT.SSLPort,e.next=44,Qz(c,l,d);case 44:if(!rr.DWT.IfCheckDCP){e.next=65;break}return f=de.bSSL?d:l,e.next=48,Ld(c,l,d);case 48:if(!(h=e.sent)){e.next=54;break}l=h.port,d=h.sslPort,e.next=57;break;case 54:throw Cs(m={}),$s(m);case 57:if(!rr.dcp.bEnhancedMode){e.next=65;break}return e.prev=58,e.next=61,ju.closeWsClient(c,f,de.bSSL);case 61:e.next=65;break;case 63:e.prev=63,e.t0=e["catch"](58);case 65:return Xu("Creating WebTwain from Dynamsoft.DWT.Containers..."),e.next=68,fJ(c,l,d);case 68:case"end":return e.stop()}}),e,null,[[58,63]])}))),mJ.apply(this,arguments)}var pJ=new(function(){return s((function e(){o(this,e)}),[{key:"InvalidValue",value:function(e){Sa(e)}},{key:"ParameterCannotEmpty",value:function(e){Oa(e)}},{key:"Webcam_InvalidIndex",value:function(e,t){ha(e,-2315,"The index is out of range.")}},{key:"Webcam_InvalidRemoteFilename",value:function(e){ha(e,-2316,"The RemoteFile field is empty in the Webcam Download Function.")}},{key:"InvalidDestination",value:function(e){ha(e,-2318,"Invalid destination file.")}},{key:"InvalidSourceFile",value:function(e){ha(e,-2319,"Invalid source file.")}},{key:"InvalidFile",value:function(e){Ma(e)}},{key:"OCR_InvalidIndex",value:function(e,t){ha(e,-2321,"The index is out of range.")}},{key:"OCR_InvalidLeftOrTopOrRightOrBottom",value:function(e){ha(e,-2322,"The left or top or right or bottom you entered is invalid.")}},{key:"OCR_InvalidOutputFormat",value:function(e){ha(e,-2323,"The OCR output format is not supported.")}},{key:"OCR_InvalidPageSetMode",value:function(e){ha(e,-2324,"The OCR page set mode is not supported.")}},{key:"IndexOutOfRange",value:function(e){Ka(e)}},{key:"OCR_InvalidRemoteFilename",value:function(e){ha(e,-2379,"The RemoteFile field is empty in the OCR Download Function.")}},{key:"ImageEditorOpenCannotPlayVideo",value:function(e){ha(e,-2437,"The video can not be played while the Image Editor is open.")}},{key:"EventNotExist",value:function(e){ha(e,-2509,"The specified event doesn't exist.")}},{key:"CallbackNotAFunction",value:function(e){is(e)}},{key:"WasmNotLoaded",value:function(e){ha(e,-2537,"The wasm not loaded.")}},{key:"WasmNotLoaded_UseWasmFalse",value:function(e){ha(e,-2538,"The wasm not loaded when Dynamsoft.DWT.UseCameraAddonWasm is set to false.")}},{key:"CannotDoWhenNoViewerJS",value:function(e){us(e)}},{key:"LicenseNoDbr",value:function(e){ha(e,-2611,"The license for the Barcode module is invalid."),ga(e)}}])}());if(ia.bHTML5Edition){var vJ=function(){var e=n(g().mark((function t(e){var r,n,i,o,a,s,u,c;return g().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return _z(),t.next=3,lJ(!0,!1);case 3:if(rr.DWT.UseDefaultViewer||(e.Container=null),!oH(e.Container)){t.next=11;break}return n=document.createElement("div"),e.Container.appendChild(n),e.Container=n,i=iH(n),t.next=11,Wo(i);case 11:return r=Vz(e),t.next=14,Tz();case 14:return t.next=16,Uz();case 16:o=3,a=0;case 18:if(!(a<o)){t.next=35;break}return t.prev=19,t.next=22,Qz(r.host,r.port,r.sslPort);case 22:return t.abrupt("break",35);case 25:if(t.prev=25,t.t0=t["catch"](19),!(a<o-1&&t.t0.code==_a.DWTPortNotReady)){t.next=31;break}return t.next=30,new Qt.Promise((function(e,t){setTimeout((function(){e()}),300)}));case 30:return t.abrupt("continue",32);case 31:throw t.t0;case 32:a++,t.next=18;break;case 35:if(!rr.DWT.IfCheckDCP){t.next=47;break}return t.next=38,Ld(r.host,r.port,r.sslPort);case 38:if(!(s=t.sent)){t.next=44;break}r.port=s.port,r.sslPort=s.sslPort,t.next=47;break;case 44:throw Cs(u={}),$s(u);case 47:return Xu("Creating a WebTwain instance..."),t.next=50,eJ(r);case 50:return c=t.sent,t.abrupt("return",c);case 52:case"end":return t.stop()}}),t,null,[[19,25]])})));return function(t){return e.apply(this,arguments)}}(),_J=window;rr.DWT.OnBeforeUnload=function(e){},_J.addEventListener("beforeunload",(function(e){if(Qt.isFunction(rr.DWT.OnBeforeUnload))return rr.DWT.OnBeforeUnload(e)})),rr.DWT.Unload=n(g().mark((function e(){var t;return g().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(!ia.bDWTLoading&&!ia.bDWTUnloading){e.next=2;break}return e.abrupt("return");case 2:return ia.bDWTUnloading=!0,e.prev=3,e.next=6,yJ(!1,!0);case 6:e.next=11;break;case 8:e.prev=8,e.t0=e["catch"](3),t=e.t0;case 11:try{bJ(),rr.DWT.CloseDialog(),Qt._zdgb_xkz_dhk(),Qt.closeProgress(null,""),Qt.hideMask(),Fo()}catch(PJ){}if(ia.bDWTLoading=!1,ia.bDWTUnloading=!1,ia.loadResourcePath=!1,ia.loadingResourcePath=!1,!t){e.next=18;break}throw t;case 18:case"end":return e.stop()}}),e,null,[[3,8]])}))),rr.DWT.Load=n(g().mark((function t(){var e,r;return g().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(!ia.bDWTLoading){t.next=2;break}return t.abrupt("return");case 2:if(!ia.bDWTUnloading){t.next=5;break}return setTimeout(rr.DWT.Load,500),t.abrupt("return");case 5:return ia.bDWTLoading=!0,IJ(),t.prev=7,t.prev=8,t.next=11,Fz();case 11:return t.next=13,Tz();case 13:return t.next=15,Uz();case 15:t.next=21;break;case 17:throw t.prev=17,t.t0=t["catch"](8),ad(t.t0),t.t0;case 21:return t.prev=21,rr.Lib.closeProgress(),t.next=25,yJ(!0,!0);case 25:t.next=31;break;case 27:return t.prev=27,t.t1=t["catch"](21),t.next=31,yJ();case 31:t.prev=31,rr.DWT.CloseDialog(),e=3,r=0;case 35:if(!(r<e)){t.next=52;break}return t.prev=36,t.next=39,gJ();case 39:return t.abrupt("break",52);case 42:if(t.prev=42,t.t2=t["catch"](36),!(r<e-1&&t.t2.code==_a.DWTPortNotReady)){t.next=48;break}return t.next=47,new Qt.Promise((function(e,t){setTimeout((function(){e()}),300)}));case 47:return t.abrupt("continue",49);case 48:throw t.t2;case 49:r++,t.next=35;break;case 52:t.next=66;break;case 54:return t.prev=54,t.t3=t["catch"](31),ud(t.t3.code)||Qt.detect.bOK||Zt.asyncQueue.pushToDo(null,rr.DWT.Load),ad(t.t3),t.prev=59,t.next=62,yJ();case 62:t.next=66;break;case 64:t.prev=64,t.t4=t["catch"](59);case 66:return t.prev=66,ia.bDWTLoading=!1,bJ(),t.finish(66);case 70:case"end":return t.stop()}}),t,null,[[7,,66,70],[8,17],[21,27],[31,54],[36,42],[59,64]])}))),rr.DWT.CheckConnectToTheService=function(e,t,r,n){$z(e,t,null,r,n)},rr.DWT.ConnectToTheService=function(){Zt.asyncQueue.start()},rr.DWT.CreateDWTObject=function(e,t,r,n,i,o){var a,s=i,u=o;Zt.isFunction(t)&&Zt.isFunction(r)?(s=t,u=r,a={}):a={Host:t,Port:r,SSLPort:n};var c,l=e;if(Zt.isString(l)&&!(l=Zt.get(l)))return function(e){ha(e,-2813,Ki)}(c={}),u&&u({code:c._errorCode,message:c._errorString}),di;if(Zt.isDOM(l))a.Container=l;else{if(!Zt.isString(e)){var d={code:-2806,message:'Error: The argument passed to the parameter "conatinerId" is not a string.'};return Zt.isFunction(u)&&u(d),di}if(!Zt.get(e)){var f=ws(e);return Zt.isFunction(u)&&u(f),di}}return a.WebTwainId=Dl(),rr.DWT.CreateDWTObjectEx(a,s,u)},rr.DWT.CreateDWTObjectEx=function(e,t,r){var n=arguments,i=!!e.bLoadingDialogOpened;return ia.loadResourcePath?Zt.isString(e.WebTwainId)?(i||IJ(),delete e.bLoadingDialogOpened,vJ(e).then((function(e){bJ(),yG(e),Zt.isFunction(t)&&t(e)}),(function(e){if(bJ(),!Qt.detect.bOK){var t=e&&e.code,i=rr.DWT.licenseException;(t&&!ud(t)||0==i.code)&&(Zt.asyncQueue.stop(),Zt.asyncQueue.pushToDo(null,rr.DWT.CreateDWTObjectEx,n))}Zt.isFunction(r)&&r(e)})),!0):(i&&bJ(),r&&r({code:-2805,message:'Error: The "WebTwainId" is not a string.'}),di):(i||(IJ(),e.bLoadingDialogOpened=!0),void Fz().then(Tz).then((function(){setTimeout((function(){rr.DWT.CreateDWTObjectEx(e,t,r)}),100)}),(function(e){bJ(),r(e)})))},rr.DWT.CreateRemoteScanObjectAsync=function(){var e=n(g().mark((function t(e){var r,n;return g().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(r=null,e){t.next=5;break}throw rs(n={}),{code:n._errorCode,message:n._errorString};case 5:return ia.bDWTLoading=!0,IJ(),t.prev=7,t.next=10,Tz();case 10:return t.next=12,Uz();case 12:return t.next=14,lJ(!1,!1);case 14:r=new uJ(e),Object.preventExtensions(r);case 16:return t.prev=16,ia.bDWTLoading=!1,bJ(),t.finish(16);case 20:return t.abrupt("return",r);case 21:case"end":return t.stop()}}),t,null,[[7,,16,20]])})));return function(t){return e.apply(this,arguments)}}(),rr.DWT.DeleteDWTObject=function(e){var t,r=e;return ia.bHTML5Edition&&r?!!(t=Zt.isString(r)?rr.DWT.GetWebTwain(r):r)&&(t.dispose(),!0):di}}function yJ(e,t){return SJ.apply(this,arguments)}function SJ(){return SJ=n(g().mark((function e(t,r){var n,i,o,a,s,u,c;return g().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(t&&Xu("Unload..."),!r){e.next=4;break}return e.next=4,rr.DWT.lunload();case 4:if(Qt.dlgProgress=!1,Qt.detect.bOK=!1,Qt.detect.bFirst=!0,!(a=rr.DWT.WebTwainIdMap)){e.next=32;break}s=Object.keys(a),n=0;case 11:if(!(n<s.length)){e.next=32;break}if(!(o=s[n])||!(o in a)){e.next=29;break}if(!(i=a[o])){e.next=29;break}if(e.prev=16,!i.__unload){e.next=22;break}return e.next=20,i.__unload();case 20:e.next=24;break;case 22:return e.next=24,i.dispose();case 24:e.next=29;break;case 26:e.prev=26,e.t0=e["catch"](16),u=e.t0;case 29:n++,e.next=11;break;case 32:if(!(a=rr.DWT.ContainerMap)){e.next=57;break}s=Object.keys(a),n=0;case 36:if(!(n<s.length)){e.next=57;break}if(!(o=s[n])||!(o in a)){e.next=54;break}if(!(i=a[o])){e.next=54;break}if(e.prev=41,!i.__unload){e.next=47;break}return e.next=45,i.__unload();case 45:e.next=49;break;case 47:return e.next=49,i.dispose();case 49:e.next=54;break;case 51:e.prev=51,e.t1=e["catch"](41),u=e.t1;case 54:n++,e.next=36;break;case 57:if(!(a=rr.DWT.RemoteScanIdMap)){e.next=82;break}s=Object.keys(a),n=0;case 61:if(!(n<s.length)){e.next=82;break}if(!(o=s[n])||!(o in a)){e.next=79;break}if(!(i=a[o])){e.next=79;break}if(e.prev=66,!i.__unload){e.next=72;break}return e.next=70,i.__unload();case 70:e.next=74;break;case 72:return e.next=74,i.dispose();case 74:e.next=79;break;case 76:e.prev=76,e.t2=e["catch"](66),u=e.t2;case 79:n++,e.next=61;break;case 82:for(n=0;n<ia.unloadQueue.length;n++)c=ia.unloadQueue[n],Zt.isFunction(c)&&c();if(ia.unloadQueue.splice(0),!u){e.next=86;break}throw u;case 86:case"end":return e.stop()}}),e,null,[[16,26],[41,51],[66,76]])}))),SJ.apply(this,arguments)}function IJ(){ia.bHTML5Edition&&(tH(),Wl("openLoadingMsg",null,{width:Qt.loaderBarWidth+"px"}))}function bJ(){ia.bHTML5Edition&&Rl("closeLoadingMsg:")}function TJ(e,t){var r,n=this,i=0;(r=Zt.isString(e)?document.getElementById(e):e).style.backgroundColor="transparent",n.isLoaded=!1,n.displayType=0,n.progress=0,n.progressPosition=0,n.borderWidth={left:0,right:0,top:0,bottom:0},n.orientation=t.orientation||TJ.Orientation.Horizontal,n.direction=t.direction||TJ.Direction.LeftToRight,n.creationType=t.creationType||TJ.CreationType.Replace,n.value=0,n.initialValue=t.value||0,n.minValue=t.minValue||0,n.maxValue=t.maxValue||100,n.showLabel="undefined"==typeof t.showLabel||t.showLabel,n.labelText=t.labelText||"",n.width=t.width||"100%",n.height=t.height||20,n.borderRadius=t.borderRadius||10,n.orientation==TJ.Orientation.Horizontal&&n.borderRadius>n.height/2&&(n.borderRadius=Math.round(n.height/2)),Zt.isNumber(n.width)&&n.orientation==TJ.Orientation.Vertical&&n.borderRadius>n.width/2&&(n.borderRadius=Math.round(n.width/2)),n.backColor=t.backColor||"",n.color=t.color||"#50a8e1",n.animationStyle=0,n.animationInterval=t.animationInterval||100;var o=["parent","background","wrapper","left","middle","right","horizontalText","verticalText","marker"];for(n.extraClassName={},i=0;i<o.length;i++)t.extraClassName?"string"==typeof t.extraClassName?n.extraClassName[o[i]]=t.extraClassName:n.extraClassName[o[i]]=t.extraClassName[o[i]]||"":n.extraClassName[o[i]]="";n.onLoad=t.onLoad||null,n.onValueChanged=t.onValueChanged||null,n.onAnimate=t.onAnimate||null,n.creationType==TJ.CreationType.Replace?n.parentElement=r:(n.parentElement=document.createElement("DIV"),r.appendChild(n.parentElement)),n.finishLoading()}Qt.Errors=pJ,bH(n(g().mark((function zJ(){var e,t,r,n;return g().wrap((function(i){for(;;)switch(i.prev=i.next){case 0:if((e=window)&&(Zt.addEventListener(e,"focus",(function(){var e;(e=rr.DWT.WebTwainIdMap)&&Zt.each(e,(function(e,t){e&&e._OnPageFocus&&e._OnPageFocus()}))})),Zt.addEventListener(e,"blur",(function(){de.bWin&&Wz()})),t=e.document,Zt.addEventListener(t,"visibilitychange",(function(){de.bWin&&"hidden"==t.visibilityState&&Wz()}))),rr.navInfo){i.next=11;break}return i.prev=3,i.next=6,dH();case 6:rr.navInfo=i.sent,i.next=11;break;case 9:i.prev=9,i.t0=i["catch"](3);case 11:if(!1!==rr.DWT.AutoLoad&&!ia.bDWTLoading){i.next=13;break}return i.abrupt("return");case 13:return i.prev=13,i.next=16,Fz();case 16:if(!(rr.DWT.Containers&&rr.DWT.Containers.length>0&&rr.DWT.AutoLoad)||ia.bDWTLoading){i.next=48;break}return ia.bDWTLoading=!0,IJ(),i.prev=20,i.next=23,Tz();case 23:return i.next=25,Uz();case 25:r=3,n=0;case 27:if(!(n<r)){i.next=44;break}return i.prev=28,i.next=31,gJ();case 31:return i.abrupt("break",44);case 34:if(i.prev=34,i.t1=i["catch"](28),!(n<r-1&&i.t1.code==_a.DWTPortNotReady)){i.next=40;break}return i.next=39,new Qt.Promise((function(e,t){setTimeout((function(){e()}),300)}));case 39:return i.abrupt("continue",41);case 40:throw i.t1;case 41:n++,i.next=27;break;case 44:return i.prev=44,ia.bDWTLoading=!1,bJ(),i.finish(44);case 48:i.next=62;break;case 50:return i.prev=50,i.t2=i["catch"](13),ud(i.t2.code)||Qt.detect.bOK||Zt.asyncQueue.pushToDo(null,rr.DWT.Load),ad(i.t2),i.prev=55,i.next=58,yJ();case 58:i.next=62;break;case 60:i.prev=60,i.t3=i["catch"](55);case 62:case"end":return i.stop()}}),zJ,null,[[3,9],[13,50],[20,,44,48],[28,34],[55,60]])})))),TJ.Orientation={Horizontal:0,Vertical:1},TJ.Direction={LeftToRight:0,RightToLeft:1,TopToBottom:0,BottomToTop:1},TJ.CreationType={Replace:0,AppendChild:1},TJ.AnimationStyle={None:0,Static:1,StaticFull:2,Custom:3,CustomFull:4,Flickering1:10,Flickering2:11,Flickering3:12,LeftToRight1:20,LeftToRight2:21,RightToLeft1:22,RightToLeft2:23,TwoWay:24},TJ.prototype.finishLoading=function(){var e,t=this;t.wrapperElement=null,t.backgroundElement=null,t.valueElement=null,t.leftElement=null,t.middleElement=null,t.rightElement=null,t.backgroundElement=document.createElement("DIV"),t.backgroundElement.className="progressbar_background"+(t.extraClassName.background?" ":"")+t.extraClassName.background,t.backgroundElement.style.cssText=t.backgroundElement.style.cssText+TJ._createBorderRadiusCss(t.borderRadius),t.parentElement.appendChild(t.backgroundElement);var r=["border-radius","border-bottom-right-radius"],n=0,i="";for(n=0;n<r.length&&(!(i=TJ._elementCurrentStyle(t.backgroundElement,r[n]))&&"string"!=typeof i);n++);""!=i&&TJ._parseInt(i)!=t.borderRadius&&(t.borderRadius=TJ._parseInt(i)),t.orientation==TJ.Orientation.Horizontal||t.orientation==TJ.Orientation.Vertical?t.displayType=0:t.displayType=1,t.parentElement.className=(""!=t.parentElement.className?" ":"")+"progressbar_parent dynamsoft-progressBar"+(t.extraClassName.parent?" ":"")+t.extraClassName.parent,0==t.displayType?((e=t.wrapperElement=document.createElement("DIV")).style.border="1px solid #A0A0A0",e.style.cssFloat="left",e.style.display="inline-block",e.style.width=Zt.isNumber(t.width)?t.width+"px":t.width,e.style.height=t.height+"px",e.style.left="0px",e.style.top=-t.height+"px",e.style.backgroundColor=t.backColor,e.style.backgroundRepeat="no-repeat",e.style.position="relative",e.style.cssText=e.style.cssText+TJ._createBorderRadiusCss(t.borderRadius),t.parentElement.appendChild(e),t.borderWidth={left:TJ._parseInt(TJ._elementCurrentStyle(e,"border-left-width")),right:TJ._parseInt(TJ._elementCurrentStyle(e,"border-right-width")),top:TJ._parseInt(TJ._elementCurrentStyle(e,"border-top-width")),bottom:TJ._parseInt(TJ._elementCurrentStyle(e,"border-bottom-width"))}):1==t.displayType&&(t.orientation==TJ.Orientation.Horizontal?Zt.isNumber(t.width)&&t.borderRadius>t.width/2&&(t.borderRadius=t.width):t.orientation==TJ.Orientation.Vertical&&t.borderRadius>t.height/2&&(t.borderRadius=t.height),t.valueElement=document.createElement("DIV"),t.valueElement.className="",t.leftElement=document.createElement("DIV"),t.middleElement=document.createElement("DIV"),t.rightElement=document.createElement("DIV"),t.leftElement.style.border="1px solid #A0A0A0",t.leftElement.style.cssFloat="left",t.leftElement.style.display="inline-block",t.leftElement.style.backgroundColor=t.backColor,t.leftElement.style.backgroundRepeat="no-repeat",t.leftElement.style.position="relative",t.rightElement.style.border="1px solid #A0A0A0",t.rightElement.style.cssFloat="left",t.rightElement.style.display="inline-block",t.rightElement.style.backgroundColor=t.backColor,t.rightElement.style.backgroundRepeat="no-repeat",t.rightElement.style.position="relative",t.middleElement.style.border="1px solid #A0A0A0",t.middleElement.style.cssFloat="left",t.middleElement.style.display="inline-block",t.middleElement.style.overflow="hidden",t.middleElement.style.position="relative",t.valueElement.style.backgroundColor=t.backColor,t.valueElement.style.position="relative",t.orientation==TJ.Orientation.Horizontal?(t.leftElement.style.width=t.borderRadius+"px",t.leftElement.style.height=t.height+"px",t.leftElement.style.top=-t.height+"px",t.leftElement.style.left="0px",t.leftElement.style.borderRight="none",t.leftElement.style.cssText=t.leftElement.style.cssText+TJ._createBorderRadiusCss(t.borderRadius,0,0,t.borderRadius),t.rightElement.style.width=t.borderRadius+"px",t.rightElement.style.height=t.height+"px",t.rightElement.style.top=-t.height+"px",t.rightElement.style.borderLeft="none",t.rightElement.style.cssText=t.rightElement.style.cssText+TJ._createBorderRadiusCss(0,t.borderRadius,t.borderRadius,0),t.middleElement.style.width=Zt.isNumber(t.width)?t.width-2*t.borderRadius+"px":t.width,t.middleElement.style.height=t.height+"px",t.middleElement.style.top=-t.height+"px",t.middleElement.style.borderLeft="none",t.middleElement.style.borderRight="none",t.valueElement.style.width="0px",t.valueElement.style.height=t.height+"px"):t.orientation==TJ.Orientation.Vertical&&(t.leftElement.style.width=Zt.isNumber(t.width)?t.width+"px":t.width,t.leftElement.style.height=t.borderRadius+"px",t.leftElement.style.top=-t.height+"px",t.leftElement.style.left="0px",t.leftElement.style.borderBottom="none",t.leftElement.style.cssText=t.leftElement.style.cssText+TJ._createBorderRadiusCss(t.borderRadius,t.borderRadius,0,0),t.rightElement.style.width=Zt.isNumber(t.width)?t.width+"px":t.width,t.rightElement.style.height=t.borderRadius+"px",t.rightElement.style.top=-t.height+"px",t.rightElement.style.left="0px",t.rightElement.style.borderTop="none",t.rightElement.style.cssText=t.rightElement.style.cssText+TJ._createBorderRadiusCss(0,0,t.borderRadius,t.borderRadius),t.middleElement.style.width=Zt.isNumber(t.width)?t.width+"px":t.width,t.middleElement.style.height=t.height-2*t.borderRadius+"px",t.middleElement.style.top=-t.height+"px",t.middleElement.style.left="0px",t.middleElement.style.borderTop="none",t.middleElement.style.borderBottom="none",t.valueElement.style.width=Zt.isNumber(t.width)?t.width+"px":t.width,t.valueElement.style.height="0px"),t.middleElement.appendChild(t.valueElement),t.parentElement.appendChild(t.leftElement),t.parentElement.appendChild(t.middleElement),t.parentElement.appendChild(t.rightElement),t.orientation==TJ.Orientation.Horizontal?t.borderWidth={left:TJ._parseInt(TJ._elementCurrentStyle(t.leftElement,"border-left-width")),right:TJ._parseInt(TJ._elementCurrentStyle(t.rightElement,"border-right-width")),top:TJ._parseInt(TJ._elementCurrentStyle(t.middleElement,"border-top-width")),bottom:TJ._parseInt(TJ._elementCurrentStyle(t.middleElement,"border-bottom-width"))}:t.orientation==TJ.Orientation.Vertical&&(t.borderWidth={left:TJ._parseInt(TJ._elementCurrentStyle(t.middleElement,"border-left-width")),right:TJ._parseInt(TJ._elementCurrentStyle(t.middleElement,"border-right-width")),top:TJ._parseInt(TJ._elementCurrentStyle(t.leftElement,"border-top-width")),bottom:TJ._parseInt(TJ._elementCurrentStyle(t.rightElement,"border-bottom-width"))})),Zt.isNumber(t.width)&&(t.parentElement.style.width=t.width+t.borderWidth.left+t.borderWidth.right+"px"),t.parentElement.style.height=t.height+t.borderWidth.top+t.borderWidth.bottom+"px",t.backgroundElement.style.cssFloat="left",t.backgroundElement.style.display="inline-block",Zt.isNumber(t.width)&&(t.backgroundElement.style.width=t.width+t.borderWidth.left+t.borderWidth.right+"px"),t.backgroundElement.style.height=t.height+"px",t.backgroundElement.style.backgroundColor="#FFFFFF",t.backgroundElement.style.position="relative",0==t.displayType&&Zt.isNumber(t.width)&&(t.backgroundElement.style.width=t.width+t.borderWidth.left+t.borderWidth.right+"px"),t.backgroundElement.style.top=t.borderWidth.top+"px",t.markerElement=document.createElement("DIV"),t.markerElement.style.display="inline-block",t.markerElement.style.zoom="1.0",t.markerElement.style.width=Zt.isNumber(t.width)?t.width+"px":t.width,t.markerElement.style.height=t.height+"px",t.markerElement.style.top=2*-t.height-t.borderWidth.top+"px",t.markerElement.style.left=t.borderWidth.left+"px",t.markerElement.style.backgroundColor=t.color,t.markerElement.style.lineHeight=t.height+"px",t.markerElement.style.position="relative",t.parentElement.appendChild(t.markerElement),t.isLoaded=!0,t.setValue(t.initialValue),null!=t.onLoad&&t.onLoad()},TJ.prototype.setValue=function(e){var t=this;if(null!==e&&e<t.minValue&&(e=t.minValue),null!==e&&e>t.maxValue&&(e=t.maxValue),null===e||(t.value=e),t.isLoaded){var r,n=0,i=t.width;if(Zt.isString(i)){var o=ci.one(".dynamsoft-progressBar");o&&o.getEL()&&(i=o.getEL().offsetWidth)}if(t.orientation==TJ.Orientation.Horizontal){n=t.value/t.maxValue*i,t.progressPosition=n,0==t.displayType||1==t.displayType&&(t.direction==TJ.Direction.LeftToRight?n<=t.borderRadius?t.valueElement.style.width="0px":n>=i-t.borderRadius?t.valueElement.style.width=t.middleElement.style.width:t.valueElement.style.width=n-t.borderRadius+"px":n<=t.borderRadius?t.valueElement.style.width="0px":n>=i-t.borderRadius?(t.valueElement.style.left="0px",t.valueElement.style.width=t.middleElement.style.width):(t.valueElement.style.left=i-n-t.borderRadius+"px",t.valueElement.style.width=n-t.borderRadius+"px")),n>0?(t.animationStyle!=TJ.AnimationStyle.StaticFull&&t.animationStyle!=TJ.AnimationStyle.CustomFull?t.markerElement.style.width=n+"px":t.markerElement.style.width=i+"px",t.markerElement.style.visibility="visible"):(t.markerElement.style.width=i+"px",t.animationStyle!=TJ.AnimationStyle.StaticFull&&t.animationStyle!=TJ.AnimationStyle.CustomFull&&(t.markerElement.style.visibility="hidden")),t.animationStyle!=TJ.AnimationStyle.StaticFull&&t.animationStyle!=TJ.AnimationStyle.CustomFull?t.direction==TJ.Direction.LeftToRight?t.markerElement.style.left=t.borderWidth.left+"px":t.markerElement.style.left=i-n+t.borderWidth.left+"px":t.markerElement.style.left=t.borderWidth.left+"px";var a=2*-t.height-t.borderWidth.top;if(0==n||i==n)t.markerElement.style.top=a+"px",t.markerElement.style.height=t.height+"px",t.markerElement.style.cssText=t.markerElement.style.cssText+TJ._createBorderRadiusCss(t.borderRadius);else if(n<t.borderRadius){var s=t.height-2.25*(t.borderRadius-Math.sqrt(Math.pow(t.borderRadius,2)-Math.pow(t.borderRadius-n,2))),u=a+t.height/2-s/2;t.markerElement.style.top=u+"px",t.markerElement.style.height=s+"px",t.direction==TJ.Direction.LeftToRight?t.markerElement.style.cssText=t.markerElement.style.cssText+TJ._createBorderRadiusCss(t.borderRadius,0,0,t.borderRadius):t.markerElement.style.cssText=t.markerElement.style.cssText+TJ._createBorderRadiusCss(0,t.borderRadius,t.borderRadius,0)}else i-n<t.borderRadius?(r=(2*(t.borderRadius-(i-n))+(t.borderRadius-Math.sqrt(Math.pow(t.borderRadius,2)-Math.pow(t.borderRadius-(i-n),2))))/3,t.direction==TJ.Direction.LeftToRight?t.markerElement.style.cssText=t.markerElement.style.cssText+TJ._createBorderRadiusCss(t.borderRadius,r,r,t.borderRadius):t.markerElement.style.cssText=t.markerElement.style.cssText+TJ._createBorderRadiusCss(r,t.borderRadius,t.borderRadius,r)):(t.markerElement.style.top=a+"px",t.markerElement.style.height=t.height+"px",t.direction==TJ.Direction.LeftToRight?t.markerElement.style.cssText=t.markerElement.style.cssText+TJ._createBorderRadiusCss(t.borderRadius,0,0,t.borderRadius):t.markerElement.style.cssText=t.markerElement.style.cssText+TJ._createBorderRadiusCss(0,t.borderRadius,t.borderRadius,0))}else if(t.orientation==TJ.Orientation.Vertical){n=t.value/t.maxValue*t.height,t.progressPosition=n,0==t.displayType||1==t.displayType&&(t.direction==TJ.Direction.TopToBottom?n<=t.borderRadius?t.valueElement.style.height="0px":n>=t.height-t.borderRadius?t.valueElement.style.height=t.middleElement.style.height:t.valueElement.style.height=n-t.borderRadius+"px":n<=t.borderRadius?t.valueElement.style.height="0px":n>=t.height-t.borderRadius?(t.valueElement.style.top="0px",t.valueElement.style.height=t.middleElement.style.height):(t.valueElement.style.top=t.height-n-t.borderRadius+"px",t.valueElement.style.height=n+2*t.borderRadius+"px")),n>0?(t.animationStyle!=TJ.AnimationStyle.StaticFull&&t.animationStyle!=TJ.AnimationStyle.CustomFull?t.markerElement.style.height=n+"px":(t.markerElement.style.height=t.height+"px",t.markerElement.style.cssText=t.markerElement.style.cssText+TJ._createBorderRadiusCss(t.borderRadius)),t.markerElement.style.visibility="visible"):(t.markerElement.style.height="0px",t.animationStyle!=TJ.AnimationStyle.StaticFull&&t.animationStyle!=TJ.AnimationStyle.CustomFull&&(t.markerElement.style.visibility="hidden"));var c=t.borderWidth.left;if(0==n||t.height==n)t.markerElement.style.left=c+"px",t.markerElement.style.width=i+"px",t.markerElement.style.cssText=t.markerElement.style.cssText+TJ._createBorderRadiusCss(t.borderRadius);else if(n<t.borderRadius){var l=2.5*n;l>i&&(l=i);var d=c+i/2-l/2;t.markerElement.style.left=d+"px",t.markerElement.style.width=l+"px",t.direction==TJ.Direction.BottomToTop?t.markerElement.style.cssText=t.markerElement.style.cssText+TJ._createBorderRadiusCss(0,0,t.borderRadius,t.borderRadius):t.markerElement.style.cssText=t.markerElement.style.cssText+TJ._createBorderRadiusCss(t.borderRadius,t.borderRadius,0,0)}else t.height-n<t.borderRadius?(r=(2*(t.borderRadius-(t.height-n))+(t.borderRadius-Math.sqrt(Math.pow(t.borderRadius,2)-Math.pow(t.borderRadius-(t.height-n),2))))/3,t.direction==TJ.Direction.BottomToTop?t.markerElement.style.cssText=t.markerElement.style.cssText+TJ._createBorderRadiusCss(r,r,t.borderRadius,t.borderRadius):t.markerElement.style.cssText=t.markerElement.style.cssText+TJ._createBorderRadiusCss(t.borderRadius,t.borderRadius,r,r)):(t.markerElement.style.left=c+"px",t.markerElement.style.width=i+"px",t.direction==TJ.Direction.BottomToTop?t.markerElement.style.cssText=t.markerElement.style.cssText+TJ._createBorderRadiusCss(0,0,t.borderRadius,t.borderRadius):t.markerElement.style.cssText=t.markerElement.style.cssText+TJ._createBorderRadiusCss(t.borderRadius,t.borderRadius,0,0));t.animationStyle!=TJ.AnimationStyle.StaticFull&&t.animationStyle!=TJ.AnimationStyle.CustomFull?t.direction==TJ.Direction.TopToBottom?t.markerElement.style.top=2*-t.height-t.borderWidth.top+"px":t.markerElement.style.top=-t.height-n-t.borderWidth.top+"px":t.markerElement.style.top=2*-t.height-t.borderWidth.top+"px"}t.progress=t.value/t.maxValue}null!=t.onValueChanged&&t.onValueChanged()},TJ._elementCurrentStyle=function(e,t){if(e.currentStyle){var r=0,n="",i=!1;for(r=0;r<t.length;r++)"-"!=t[r].toString()?(n+=i?t[r].toString().toUpperCase():t[r].toString(),i=!1):i=!0;return t=n,e.currentStyle[t]}return getComputedStyle(e,null).getPropertyValue(t)},TJ._parseInt=function(e){var t=parseInt(e);return isNaN(t)&&(t=0),t},TJ._createBorderRadiusCss=function(e,t,r,n){return null!=e&&null==t&&null==r&&null==n?";-ms-border-radius: "+e+"px;border-radius:"+e+"px;":";-ms-border-radius:"+(e=e||0)+"px "+(t=t||0)+"px "+(r=r||0)+"px "+(n=n||0)+"px;border-radius:"+e+"px "+t+"px "+r+"px "+n+"px;"};var CJ=function(){return s((function e(){o(this,e),c(this,"handlers",{})}),[{key:"on",value:function(e,t){var r=Zt.guid();return this.handlers[e]||(this.handlers[e]=[]),this.handlers[e].push({id:r,handler:t}),r}},{key:"off",value:function(e,t){if(this.handlers[e]){var r,n=this.handlers[e];if(t){for(r=0;r<n.length;r++)if(n[r].id==t){n.splice(r,1);break}}else n.splice(0)}}},{key:"fire",value:function(e){if(this.handlers[e]){var t,r=this.handlers[e];for(t=0;t<r.length;t++)r[t].handler();return r.length}return 0}},{key:"clear",value:function(){this.handlers={}}}])}(),wJ=rr.DWT;Qt.ProgressBar=TJ,Qt.progressMessage="",Qt.dialogShowStatus=!1,Qt.needShowTwiceShowDialog=!1,Qt.dlgProgress=!1,Qt.cancelFrom=rG.Other,Qt.dlgRef=0,Qt.initProgress=function(e){var t,r;if(!Qt.dlgProgress){(r=[]).push('<dialog class="dynamsoft-dwt-dialogProgress" closed="closed" style="top:30%"><div class="ds-dwt-progressWrap">'),r.push('<h3 class="dynamsoft-finalMessage"> </h3>'),r.push('<p class="dynamsoft-desc"></p><p class="dynamsoft-status">0%</p>'),de.bIE?r.push('<div class="dynamsoft-progressBar" value="" max="100"></div>'):r.push('<progress class="dynamsoft-progressBar" value="" max="100"></progress>'),r.push('<div style="width:100%;text-align:center;margin:5px 0;"><button class="dynamsoft-btnCancel" value="cancel" autofcus>cancel</button></div>'),r.push("</div></dialog>"),(t=ci.one(".dynamsoft-dwt-dialogProgress"))&&t.getEL()&&t.remove();var n=Qt.parseHTML(r.join(""));if(n&&n.length>0&&document.body.appendChild(n[0]),de.bIE){var i=ci.one(".dynamsoft-progressBar"),o=i&&i.getEL();o&&(o.objProgressBar=new TJ(o,{height:20}));var a=ci.one(".ds-dwt-progressWrap").getEL();a&&(a.style.boxSizing="content-box")}(t=ci.one(".dynamsoft-dwt-dialogProgress"))&&t.getEL()&&(Qt.dlgProgress=t[0],ci.dialog.setup(Qt.dlgProgress)),Qt.dlgRef=0,Qt.dialogShowStatus=!1,Qt.cancelFrom=rG.Other}},Qt.showProgressMsg=function(){};var EJ=function(e){function t(){return o(this,t),i(this,t,arguments)}return f(t,e),s(t)}(CJ);Qt.progressContext=new EJ;var kJ=function(){var e=Qt.progressContext;if(e){var t,r=e.fire("cancel");if(r>=1)for(t=0;t<r;t++)Qt.closeProgress(null,"");else e.__cancelBeforObjectCreated&&(Qt.closeProgress(null,""),e.__clickCancel=!0)}};Qt.hideProgress=function(){var e=Qt.progressContext;e&&(e.IfShowProgressBar=!1,e.IfShowCancelDialogWhenImageTransfer=!1,e.off("cancel"),e._onPercent=null)},Qt.showProgress=function(e,t,r){var n,i=e;if(i.IfShowProgressBar)if(Qt.progressContext&&(Qt.progressContext.IfShowProgressBar=!0,Qt.progressContext.IfShowCancelDialogWhenImageTransfer=i.IfShowCancelDialogWhenImageTransfer),Qt.dlgRef>0)Qt.dlgRef++;else{var o;if((n=rr.DWT.IfConfineMaskWithinTheViewer)?i._isNoViewer&&i._isNoViewer()?o=document.body:i._containerElement?o=i._containerElement:rr.DWT.Containers&&rr.DWT.Containers.length>0&&rr.DWT.Containers[0].ContainerId&&(o=Zt.get(rr.DWT.Containers[0].ContainerId))||(o=document.body):o=document.body,o&&o!==document.body){var a=!1,s=o.firstElementChild;if(s&&s!==Qt.dlgProgress&&"dvs-root dvs-web-viewer"==s.className&&(o=s,a=!0),0==a)for(var u=0;u<o.children.length;u++)if((s=o.children[u])&&s!==Qt.dlgProgress&&"dvs-root dvs-web-viewer"==s.className){o=s;break}var c=Qt.progressContext;""!==o.style.position&&"static"!==o.style.position||(o.style.position="relative",c.progressContainer={el:o})}Zt.log("showProgress:"+t+",bCancel:"+r),Qt.dlgProgress&&o.appendChild(Qt.dlgProgress),zs(r);var l=ci.one(".dynamsoft-btnCancel");if(l&&l.getEL()&&(Zt.removeEventListener(l[0],"click",kJ),Zt.addEventListener(l[0],"click",kJ)),0==Qt.dialogShowStatus){Qt.dlgProgress&&(n&&o&&o!==document.body?ci.dialog.setup(Qt.dlgProgress,!0):ci.dialog.setup(Qt.dlgProgress),Qt.dlgProgress.showModal()),Qt.dialogShowStatus=!0;var d=ci.one(".dynamsoft-finalMessage"),f=ci.one(".dynamsoft-progressBar"),h=f&&f.getEL(),g=ci.one(".dynamsoft-status");d&&d.getEL()&&d.html(""),g&&g.getEL()&&g.html("0%"),h&&(de.bIE&&h.objProgressBar?h.objProgressBar.setValue(0):h.value=0)}Qt.dlgRef++}else Qt.hideProgress()},Qt.closeProgress=function(e,t){var r=Qt.progressContext;Zt.log("closeProgress:"+t),r&&r.IfShowProgressBar?(Qt.dlgRef--,Qt.dlgRef<=0&&(Qt.dlgRef=0)):Qt.dlgRef=0,0==Qt.dlgRef&&(r.off("cancel"),r._onPercent=null,1==Qt.dialogShowStatus&&(Qt.dlgProgress&&(Qt.dlgProgress.close(),Qt.dlgProgress&&document.body.appendChild(Qt.dlgProgress),r&&r.progressContainer&&r.progressContainer.el&&(r.progressContainer.el.style.position="",r.progressContainer=null)),Qt.dialogShowStatus=!1),Qt.cancelFrom=rG.Other)},wJ.RemoveAllAuthorizations=function(){var e=Dd.item("DWT_port"),t="http://";return"true"==Dd.item("DWT_ssl")&&(t="https://"),Vi({method:"GET",xhrFields:{withCredentials:!0},url:[t,qo(),":",e,"/dwt/",ia.getDWTPrefix(),ia.getServerVersionInfo(),"/RemoveAllAuthorizations?t=",Zt.now()].join(""),async:!0}),!0};var AJ={upload:"Uploading...",download:"Downloading...",load:"Processing...",decode:"Processing...",decodeTIFF:"Processing tiff...",decodePDF:"Processing pdf...",encodeTIFF:"Processing tiff...",encodePDF:"Processing pdf...",encode:"Processing...",transfer:"Transferring..."};Qt.progressBarOnPercentDone=function(e,t,r,n,i,o){var a,s=ci.one(".dynamsoft-progressBar"),u=ci.one(".dynamsoft-status"),c=ci.one(".dynamsoft-finalMessage"),l=ci.one(".dynamsoft-desc");if(rr.DWT.UseDefaultViewer&&rr.DWT.IfConfineMaskWithinTheViewer&&o&&(s=ci.one(".dynamsoft-progressBar",o),u=ci.one(".dynamsoft-status",o),c=ci.one(".dynamsoft-finalMessage",o),l=ci.one(".dynamsoft-desc",o)),Qt.cancelFrom==rG.FTPUpload||Qt.cancelFrom==rG.FTPDownload){var d=r;0==d?Qt.setBtnCancelVisibleForProgress(!1):1==d&&Qt.setBtnCancelVisibleForProgress(!0)}else Qt.cancelFrom==rG.HTTPUpload||Qt.cancelFrom==rG.LoadImage||Qt.cancelFrom==rG.HTTPPut?"Processing..."==t&&Qt.setBtnCancelVisibleForProgress(!1):Qt.cancelFrom==rG.ConvertToBlob&&(-1==e||Qt.setBtnCancelVisibleForProgress(!1),100==n&&(t="",Qt.progressMessage="Processing..."));if(e<0?(Qt.progressMessage=t,a=Qt.progressMessage):a=""!=t&&"1/1"!=t?Qt.progressMessage+"("+t+")":Qt.progressMessage,c&&c.getEL()){var f="",h="";a.indexOf(" ...")&&(a=a.replace(" ...","...")),-1!=a.indexOf("(")?(f=a.substr(0,a.indexOf("(")),h=a.substr(a.indexOf("("))):f=a,Zt.each(AJ,(function(e,t){-1!=e.indexOf(f)&&(a=eH.customProgressText[t]+h)})),""==a&&(a=" "),c.html(a)}if(i?""==i||Zt.isUndefined(i)?(i=" ",l&&l.hide&&l.hide()):(Zt.isString(i)&&i.length>30&&(i=i.substring(0,30)+"..."),l&&(l.show&&l.show(),l.html(i))):l&&l.hide&&l.hide(),(n||0===n)&&(u&&u.getEL()&&u.html(n+"%"),s&&s.getEL())){var g=n;g>99&&(g=99),de.bIE?s[0].objProgressBar?s[0].objProgressBar.setValue(g):s[0].value=g:de.bEdge?(s[0].style.display="",s[0].value=g):s[0].value=g}Qt.dlgRef<=0&&setTimeout((function(){s&&s.getEL()&&(de.bIE?s[0].objProgressBar?s[0].objProgressBar.setValue(0):s[0].value=0:de.bEdge?(s[0].style.display="none",s[0].value=0):s[0].value=0)}),1e3)},(Qt.__ver||0)<$t&&(Zt.mix(Qt,ci),Qt.__ver=$t),Qt.bNode=er,Qt._defaultAgent="Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/103.0.0.0 Safari/537.36",Qt._defaultPlatform="Win64",Qt.timestamp="?t=20241010102903",Zt.mix(Qt,li),Qt.ajax=Vi,Qt.fetch=Hs,Qt.detect.showMask=gl,Qt.detect.hideMask=ml,Qt.env=ko,Qt.product=ia,Qt.scannerInfo=oa,Qt.License=Wc,Qt.BIO=ul,Qt.UI.ImageUIView=cH,Qt.UI.ImageManager=lH,rr.MSG=hl,Qt.domReady=bH,function KJ(){if(!window||document&&document.body){var e=document;if(e.readyState!==_H)if(yH(window,vH,IH),gH){var t=function(){SH(e,mH,t),IH()};yH(e,mH,t)}else{var r,n,i,o=function(){e.readyState===_H&&(SH(e,pH,o),IH())};yH(e,pH,o),n=e&&e.documentElement,i=n&&n.doScroll;try{r=null===window.frameElement}catch(Mj){r=!1}if(i&&r){var a=function(){try{i("left"),setTimeout(IH,30)}catch(e){setTimeout(a,40)}};a()}}else IH()}else setTimeout(KJ,100)}(),bH((function(){if(rr.DWT.CustomizableDisplayInfo||(rr.DWT.CustomizableDisplayInfo=eH),de.bIE){rr.DWT.CustomizableDisplayInfo.loaderBarSourceIE||(rr.DWT.CustomizableDisplayInfo.loaderBarSourceIE=$G.loaderBarSourceIE);try{document.execCommand("BackgroundImageCache",!1,!0)}catch(Mj){}}})),rr.Ready=function(e){if(!rr.navInfo)return dH().then((function(t){rr.navInfo=t;try{e()}catch(Mj){throw Zt.log(Mj.stack||Mj,"error"),Mj}}));try{e()}catch(Mj){throw Zt.log(Mj.stack||Mj,"error"),Mj}}}({mapPackageRegister:null,CoreModule:null});
}