/*! 20251210194900 - 20230504
* Dynamsoft JavaScript Library
* Product: Dynamic Web TWAIN
* Web Site: https://www.dynamsoft.com
*
* Copyright 2025, Dynamsoft Corporation
* Author: Dynamsoft Support Team
* Version: 19.3
*/
var _gThis=(function(){if(typeof globalThis!=='undefined')return globalThis;if(typeof self!=='undefined')return self;if(typeof window!=='undefined')return window;if(typeof global!=='undefined')return global;return {}})(),Dynamsoft=_gThis.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={}}_gThis.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}}})(_gThis);

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&&lt.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:E(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 k(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 E(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=x(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 x(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,x(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 A(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(A,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(k.prototype),c(k.prototype,s,function(){return this}),t.AsyncIterator=k,t.async=function(e,r,n,i,o){void 0===o&&(o=Promise);var a=new k(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 k="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{};function E(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e["default"]:e}var x={exports:{}},A={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}(A);var P=A.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:A(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(N([])));w&&w!==o&&a.call(w,c)&&(T=w);var k=b.prototype=S.prototype=Object.create(T);function E(e){["next","throw","return"].forEach(function(t){f(e,t,function(e){return this._invoke(t,e)})})}function x(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 A(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 N(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(k,"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(k),e},i.awrap=function(e){return{__await:e}},E(x.prototype),f(x.prototype,l,function(){return this}),i.AsyncIterator=x,i.async=function(e,t,r,n,o){void 0===o&&(o=Promise);var a=new x(h(e,t,r,n),o);return i.isGeneratorFunction(t)?a:a.next().then(function(e){return e.done?e.value:a.next()})},E(k),f(k,d,"Generator"),f(k,c,function(){return this}),f(k,"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=N,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:N(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}(x);var D=(0,x.exports)(),F=D;try{regeneratorRuntime=D}catch(GQ){"object"===("undefined"==typeof globalThis?"undefined":_(globalThis))?globalThis.regeneratorRuntime=D:Function("r","regeneratorRuntime = r")(D)}var W,N,O=E(F);function R(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===N}function L(e){return e!==N}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=R((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=R((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=R((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=R((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=R((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(TH){}ie.timer=setTimeout(ie.doNext,0)},n[n.length-1]=function(){try{a.apply(t,arguments)}catch(TH){}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(TH){ee(TH)}})},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),k=!w&&!C&&!a,E=k&&/win32|win64|windows/.test(i),x=E&&/win64|x64/.test(n),A=k&&/mac68k|macppc|macintosh|macintel/.test(n),P=k&&/linux/.test(i),D="win64"==i||/wow64|x86_64|win64|x64/.test(n)||S||I,F=/wow64/g.test(n),N=ae,O=/opera|opr/g.test(n),R=/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||O||H||b||T)&&/chrome|crios/g.test(n),K=!1,J=le,Q=0,q=0,Y=le;if(E&&!H&&!j&&!z){var X=n.indexOf("msie "),Z=n.indexOf("trident"),$=n.indexOf("rv:");K=-1!=X||-1!=Z||-1!=$}if(!(A||u||d||E||p||g||h)||f||O||H||K||j||(r=n.match(/version\/([\d.]+).*safari\//))&&(p||g||h||(N=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(N)(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(O)(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))}(A||P)&&(D=!0,A&&(r=n.match(/mac os x (\d+)(_|\.)(\d+)/))&&r.length>3&&(10==r[1]&&r[3]<14||r[1]<10)&&(D=!1)),E||A||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:E,bMac:A,bLinux:P,bMobile:w,bPad:C,bChromeOS:a,bHarmonyOS:o,bArm64:S,bMips64:I,bEmbed:S||I,bAndroid:s,biPhone:u,biPad:d,bWin64:x,bWOW64:F,bOSx64:D,bIE:K,bEdge:H,bChrome:z,bFirefox:j,bSafari:N,bOpera:O,bNexus:h,bUC:f,b360SE:R,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,ke,Ee,xe,Ae=W.document,Pe=[],De=Pe.push,Fe=Pe.slice,We=/^(?:#([\w-]+)|(\w+)|\.([\w-]+))$/,Ne=function(){ke()};function Oe(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:Ae)!==Ee&&ke(t),t=t||Ee,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))&&xe(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(Ae.childNodes),Ae.childNodes),ke=Oe.setDocument=function(e){var t,r=e?e.ownerDocument||e:Ae;return r!==Ee&&9===r.nodeType&&r.documentElement?(Ae!==(Ee=r)&&(t=Ee.defaultView)&&t.top!==t&&(t.addEventListener?t.addEventListener("unload",Ne,!1):t.attachEvent&&t.attachEvent("onunload",Ne)),xe=function(e,t){if(t)for(;t=t.parentNode;)if(t===e)return!0;return!1},Ee):Ee},Oe.contains=function(e,t){return(e.ownerDocument||e)!==Ee&&ke(e),xe(e,t)},Oe.error=function(e){throw new Error("Syntax error: "+e)},we=Oe.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},ke();var Re={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(Re.encodeChars.charAt(t>>2)),o.push(Re.encodeChars.charAt((3&t)<<4)),o.push("==");break}if(r=i.charCodeAt(a++),a==s){o.push(Re.encodeChars.charAt(t>>2)),o.push(Re.encodeChars.charAt((3&t)<<4|(240&r)>>4)),o.push(Re.encodeChars.charAt((15&r)<<2)),o.push("=");break}n=i.charCodeAt(a++),o.push(Re.encodeChars.charAt(t>>2)),o.push(Re.encodeChars.charAt((3&t)<<4|(240&r)>>4)),o.push(Re.encodeChars.charAt((15&r)<<2|(192&n)>>6)),o.push(Re.encodeChars.charAt(63&n))}return o.join("")},encodeArray:function(e){if(window.ArrayBuffer&&window.Uint8Array&&e instanceof window.ArrayBuffer){var t=new window.Uint8Array(e);return this.encodeArray(t)}for(var r,n,i,o=[],a=0,s=e.length;a<s;){if(r=255&e[a++],a==s){o.push(Re.encodeChars.charAt(r>>2)),o.push(Re.encodeChars.charAt((3&r)<<4)),o.push("==");break}if(n=255&e[a++],a==s){o.push(Re.encodeChars.charAt(r>>2)),o.push(Re.encodeChars.charAt((3&r)<<4|(240&n)>>4)),o.push(Re.encodeChars.charAt((15&n)<<2)),o.push("=");break}i=255&e[a++],o.push(Re.encodeChars.charAt(r>>2)),o.push(Re.encodeChars.charAt((3&r)<<4|(240&n)>>4)),o.push(Re.encodeChars.charAt((15&n)<<2|(192&i)>>6)),o.push(Re.encodeChars.charAt(63&i))}return o.join("")},decode:function(e,t){for(var r,n,i,o,a=this,s=[],u=0,c=e.length;u<c;){do{r=Re.decodeChars[255&e.charCodeAt(u++)]}while(u<c&&-1==r);if(-1==r)break;do{n=Re.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=Re.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=Re.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=Re.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=Re.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)if(t.hasOwnProperty(r)){if("__proto__"===r||"constructor"===r)continue;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(TH){o(TH)}}function s(e){try{u(n["throw"](e))}catch(TH){o(TH)}}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,O.mark(function e(){return O.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(TH){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 kt(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 Et(e){if(e)for(;e.firstChild;)e.removeChild(e.firstChild)}function xt(e){return encodeURIComponent(String(e))}function At(e){return decodeURIComponent(e.replace(/\+/g," "))}if(window.trustedTypes){try{St=window.trustedTypes.createPolicy("d-create-script",{createScriptURL:function(e){return e}})}catch(HQ){}}function Pt(e){return St?St.createScriptURL(e):e}var Dt=!0,Ft=document,Wt=Ft&&Ft.documentElement,Nt=Ft.getElementsByTagName("head")[0]||Wt,Ot=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 Rt(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",Ot(i,a),r?Nt.appendChild(i):Nt.insertBefore(i,Nt.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&&Ot(n,i),t?Nt.appendChild(n):Nt.insertBefore(n,Nt.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=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=R,this.getRandom=Je,this.guid=He,this.get=Tt,this.show=wt,this.hide=Ct,this.toggle=kt,this.empty=Et,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=Oe,this.toggleWakeLock=Ze,this.getWakeLock=$e,this.urlEncode=xt,this.urlDecode=At,this.scriptOnload=Ot,this.addAllCss=Gt,this.getAllCss=jt,this.addCss=Vt,this.getCss=Ut,this.addScripts=Bt,this.getScripts=Lt,this.addScript=Mt,this.getScript=Rt,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}}])}(),Xt=new Yt,Zt=20241120,$t="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:"undefined"!=typeof window?window:"undefined"!=typeof global?global:{},er=!!("object"==("undefined"==typeof global?"undefined":_(global))&&global.process&&global.process.release&&global.process.release.name&&"undefined"==typeof HTMLCanvasElement),tr=$t.Dynamsoft;function rr(e){return Math.floor(e)}function nr(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 ir(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 or(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 ar(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 sr(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 ur(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}tr?tr.Lib||(tr.Lib={}):(tr={Lib:{},DWT:{}},$t.Dynamsoft=tr),tr.navInfoSync=de,Qt=Xt.mix(tr.Lib,Xt),function(e){e.DWT||(e.DWT={}),e.DWT.LTS||(e.DWT.LTS={}),e.Lib.UI||(e.Lib.UI={}),e.Lib.html5||(e.Lib.html5={})}(tr),String.prototype.trim||(String.prototype.trim=function(){return this.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,le)}),qt={registedClass:[],registedObjs:[]};var cr={LEFT:0,MIDDLE:1,RIGHT:2};function lr(e){var t=e||window.event;return null==t.which?t.button<2?cr.LEFT:4==t.button?cr.MIDDLE:cr.RIGHT:t.which<2?cr.LEFT:2==t.which?cr.MIDDLE:cr.RIGHT}var dr,fr,hr=/[\-#$\^*()+\[\]{}|\\,.?\s]/g,gr={"&amp;":"&","&gt;":">","&lt;":"<","&nbsp;":" ","&#x60;":"`","&#x2F;":"/","&quot;":'"',"&#x27;":"'"},mr={};function pr(e){return e.replace(/\\u([a-f\d]{4})/gi,function(e,t){return String.fromCharCode(parseInt(t,16))})}function vr(e){return(e+"").replace(function(){if(dr)return dr;var e=le;return Xt.each(gr,function(t){e+=t+"|"}),e=e.slice(0,-1),dr=new RegExp(e,"g")}(),function(e){return mr[e]})}function _r(e){return e.replace(hr,"\\$&")}function yr(e){return e.replace(function(){if(fr)return fr;var e=le;return Xt.each(mr,function(t){e+=t+"|"}),e+="&#(\\d{1,5});",fr=new RegExp(e,"g")}(),function(e,t){return gr[e]||String.fromCharCode(+t)})}Xt.each(gr,function(e,t){mr[e]=t});var Sr,Ir,br=window;br&&Xt.isFunction(br.__zone_symbol__Promise)&&(Ir=br.__zone_symbol__Promise);var Tr=w(function zQ(){I(this,zQ)});function Cr(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 wr(e,t){return e.currentStyle?e.currentStyle[t]:window.getComputedStyle?document.defaultView.getComputedStyle(e,null)[t]:null}Sr=self&&self.Promise?self.Promise:br&&br.Promise?br.Promise:Tr,Ir||(Ir=Sr);function kr(e){var t=b(e);return null==e||"object"!==t&&"function"!==t}function Er(e,t,r,n){t=t||"&",r=r||"=",Xt.isUndefined(n)&&(n=oe);var i=[];return Xt.each(e,function(e,o){var a=Xt.urlEncode(o);kr(e)?(i.push(a),Xt.isDef(e)&&i.push(r,Xt.urlEncode(e+le)),i.push(t)):Xt.isArray(e)&&e.length&&Xt.each(e,function(e){kr(e)&&(i.push(a,n?Xt.urlEncode("[]"):le),Xt.isDef(e)&&i.push(r,Xt.urlEncode(e+le)),i.push(t))})}),i.pop(),i.join(le)}function xr(e,t,r){if(!Xt.isString(e)||!(e=Xt.trim(e)))return{};t=t||"&",r=r||"=";for(var n,i,o,a={},s=Xt.urlDecode,u=e.split(t),c=0,l=u.length;c<l;++c){if(-1===(n=Xt.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(TH){Xt.error("decodeURIComponent error : "+o),Xt.error(TH)}Xt.endsWith(i,"[]")&&(i=i.substring(0,i.length-2))}i in a?Xt.isArray(a[i])?a[i].push(o):a[i]=[a[i],o]:a[i]=o}return a}Xt.each({"&amp;":"&","&gt;":">","&lt;":"<","&#x60;":"`","&#x2F;":"/","&quot;":'"',"&#x27;":"'"},function(e,t){});var Ar,Pr=w(function KQ(e){I(this,KQ),nr(this,"tagName",void 0),nr(this,"attr",void 0),nr(this,"childNodes",void 0),this.tagName=e,this.attr={},this.childNodes=[]}),Dr=w(function JQ(e){I(this,JQ),nr(this,"value",void 0),this.value=e||""}),Fr=new WeakSet,Wr=function(){return w(function e(){I(this,e),ir(this,Fr),nr(this,"stack",void 0),nr(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 Pr(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):"readonly"!==i&&"disabled"!==i&&"checked"!==i||(t[t.length-1].attr[i]=i)}else if("text"===e.type)t.length?t[t.length-1].childNodes.push(new Dr(e.value)):this.stacks.push(new Dr(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=or(Fr,this,Mr).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=or(Fr,this,Nr).call(this,o)]=a)}}return t}function Rr(e,t){var r=or(Fr,this,Or).call(this,t);for(var n in r)e.style[n]=r[n]}function Mr(e){if(e instanceof Pr){var t=document.createElement(e.tagName);for(var r in e.attr)""!==r&&""!==e.attr[r]&&("style"===r?or(Fr,this,Rr).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(or(Fr,this,Mr).call(this,i))}return t}if(e instanceof Dr)return document.createTextNode(yr(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"}(Ar||(Ar={}));var Lr,Br=w(function QQ(e,t){I(this,QQ),nr(this,"allChars",void 0),nr(this,"curIndex",void 0),nr(this,"state",void 0),nr(this,"attrStatus",void 0),nr(this,"attrQuoteChar",void 0),this.allChars=e,this.curIndex=0,this.state=t,this.attrStatus=Ar.None,this.attrQuoteChar=""}),Ur=new WeakSet,Vr=function(){return w(function e(t,r){I(this,e),ir(this,Ur),nr(this,"token",void 0),nr(this,"tokens",void 0),nr(this,"htmlString",void 0),nr(this,"tokenHandler",void 0),nr(this,"thisStartTagName",void 0),nr(this,"attrStatus",void 0),this.token=[],this.tokens=[],this.attrStatus=Ar.None,this.thisStartTagName=null,Xt.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?(or(Ur,this,jr).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),or(Ur,this,jr).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 or(Ur,this,jr).call(this,"endTag",this.thisStartTagName),this.token=[],e.state=this.start,e.curIndex+=2,e}return e.attrQuoteChar="",e.attrStatus=Ar.None,e.state=this.attrState,e}return">"===n?(this.thisStartTagName=this.token.join("").substring(1),or(Ur,this,jr).call(this,"startTag",this.thisStartTagName.toLowerCase()),this.token=[],e.state=this.start,or(Ur,this,Gr).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==Ar.AttrSplite?n.match(/[0-9|^<&;#]/)&&(i=!0):e.attrStatus!=Ar.AttrKey&&e.attrStatus!=Ar.AttrKeyQuoteStart||(n.match(/[0-9]/)||"."===n||"-"===n)&&(o=!0),n.match(/[:|a-z|A-Z|_]/)||i||o){if(e.attrStatus==Ar.None||e.attrStatus==Ar.AttrKey||e.attrStatus==Ar.AttrKeyQuoteStart)return this.token.push(n),e.state=this.attrState,e.attrStatus==Ar.None&&(e.attrStatus=Ar.AttrKey),e;if(e.attrStatus==Ar.AttrSpace){var a=this.token.join("");return"readonly"!==a&&"disabled"!==a&&"checked"!==a||or(Ur,this,jr).call(this,"attr",a),this.token=[n],e.state=this.attrState,e.attrStatus=Ar.AttrKey,e}var s;if(e.attrStatus==Ar.AttrSplite)for(s=t;s<r.length;s++)if(this.token.push(r[s]),s+1<r.length){var u=r[s+1],c=!1,l=!1;if(" "===u||">"===u)c=!0;else if("/"===u){if(s+2<r.length)">"===r[s+2]&&(c=!0,l=!0)}if(c)return e.curIndex=s,e.attrStatus=Ar.None,e.attrQuoteChar="",or(Ur,this,jr).call(this,"attr",this.token.join("")),this.token=[],e.state=this.attrState,">"===u&&or(Ur,this,Gr).call(this)&&(this.token=[],e.curIndex++,e.state=this.start),l&&(or(Ur,this,jr).call(this,"endTag",this.thisStartTagName),this.token=[],e.curIndex+=2,e.state=this.start),e}}if("="===n&&(e.attrStatus==Ar.AttrKey||e.attrStatus==Ar.AttrKeyQuoteEnd||e.attrStatus==Ar.AttrSpace))return this.token.push(n),e.state=this.attrState,e.attrStatus=Ar.AttrSplite,e;if(n.match(/['"]/)){if(e.attrStatus==Ar.AttrValueQuoteStart||e.attrStatus==Ar.AttrKeyQuoteStart){if(n===e.attrQuoteChar)return e.attrStatus==Ar.AttrValueQuoteStart?(this.token.push(n),or(Ur,this,jr).call(this,"attr",this.token.join("")),this.token=[],e.attrStatus=Ar.None):e.attrStatus=Ar.AttrKeyQuoteEnd,e.attrQuoteChar="",e.state=this.attrState,e;this.token.push(n)}else e.attrStatus==Ar.None?e.attrStatus=Ar.AttrKeyQuoteStart:e.attrStatus==Ar.AttrSplite&&(e.attrStatus=Ar.AttrValueQuoteStart,this.token.push(n)),e.attrQuoteChar=n;return e.state=this.attrState,e}if(e.attrStatus==Ar.AttrValueQuoteStart){if(this.token.push(n),"\\"===n&&t<r.length-1){var d=r[t+1];this.token.push(d),e.curIndex++}return e.state=this.attrState,e}if(" "===n){if(e.attrStatus==Ar.AttrKey||e.attrStatus==Ar.AttrKeyQuoteEnd)return e.attrStatus=Ar.AttrSpace,e.state=this.attrState,e;if(e.attrStatus==Ar.None||e.attrStatus==Ar.AttrSplite||e.attrStatus==Ar.AttrSpace)return e.state=this.attrState,e}if("/"===n){if(t<r.length-1)if(">"===r[t+1])return or(Ur,this,jr).call(this,"attr",this.token.join("")),or(Ur,this,jr).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?(or(Ur,this,jr).call(this,"attr",this.token.join("")),this.token=[],or(Ur,this,Gr).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("</",""),or(Ur,this,jr).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 Br(e,this.start);do{t.state.bind(this)(t),t.curIndex++}while(t.curIndex<e.length)}}},{key:"getTokens",value:function(){return this.tokens}}])}();function jr(e,t){var r={type:e,value:t};"attr"==e&&""===t||(this.tokens.push(r),this.tokenHandler&&this.tokenHandler(r))}function Gr(){if(this.thisStartTagName){if("img"==this.thisStartTagName)return or(Ur,this,jr).call(this,"endTag","img"),!0;if("input"==this.thisStartTagName)return or(Ur,this,jr).call(this,"endTag","input"),!0}return!1}function Hr(e,t){if(document.body)if(de.bIE)e.innerHTML=t;else{var r=new Wr;new Vr(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 zr="ds-dwt-loaderBar",Kr="data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0iVVRGLTgiIHN0YW5kYWxvbmU9Im5vIj8+PHN2ZyB4bWxuczpzdmc9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIiB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHhtbG5zOnhsaW5rPSJodHRwOi8vd3d3LnczLm9yZy8xOTk5L3hsaW5rIiB2ZXJzaW9uPSIxLjAiIHdpZHRoPSIxMDBweCIgaGVpZ2h0PSIxMDBweCIgdmlld0JveD0iMCAwIDEyOCAxMjgiIHhtbDpzcGFjZT0icHJlc2VydmUiPjxnPjxjaXJjbGUgY3g9IjE2IiBjeT0iNjQiIHI9IjE2IiBmaWxsPSIjZmU4ZTE0Ii8+PGNpcmNsZSBjeD0iMTYiIGN5PSI2NCIgcj0iMTQuMzQ0IiBmaWxsPSIjZmU4ZTE0IiB0cmFuc2Zvcm09InJvdGF0ZSg0NSA2NCA2NCkiLz48Y2lyY2xlIGN4PSIxNiIgY3k9IjY0IiByPSIxMi41MzEiIGZpbGw9IiNmZThlMTQiIHRyYW5zZm9ybT0icm90YXRlKDkwIDY0IDY0KSIvPjxjaXJjbGUgY3g9IjE2IiBjeT0iNjQiIHI9IjEwLjc1IiBmaWxsPSIjZmU4ZTE0IiB0cmFuc2Zvcm09InJvdGF0ZSgxMzUgNjQgNjQpIi8+PGNpcmNsZSBjeD0iMTYiIGN5PSI2NCIgcj0iMTAuMDYzIiBmaWxsPSIjZmU4ZTE0IiB0cmFuc2Zvcm09InJvdGF0ZSgxODAgNjQgNjQpIi8+PGNpcmNsZSBjeD0iMTYiIGN5PSI2NCIgcj0iOC4wNjMiIGZpbGw9IiNmZThlMTQiIHRyYW5zZm9ybT0icm90YXRlKDIyNSA2NCA2NCkiLz48Y2lyY2xlIGN4PSIxNiIgY3k9IjY0IiByPSI2LjQzOCIgZmlsbD0iI2ZlOGUxNCIgdHJhbnNmb3JtPSJyb3RhdGUoMjcwIDY0IDY0KSIvPjxjaXJjbGUgY3g9IjE2IiBjeT0iNjQiIHI9IjUuMzc1IiBmaWxsPSIjZmU4ZTE0IiB0cmFuc2Zvcm09InJvdGF0ZSgzMTUgNjQgNjQpIi8+PGFuaW1hdGVUcmFuc2Zvcm0gYXR0cmlidXRlTmFtZT0idHJhbnNmb3JtIiB0eXBlPSJyb3RhdGUiIHZhbHVlcz0iNDUgNjQgNjQ7OTAgNjQgNjQ7MTM1IDY0IDY0OzE4MCA2NCA2NDsyMjUgNjQgNjQ7MjcwIDY0IDY0OzMxNSA2NCA2NDswIDY0IDY0IiBjYWxjTW9kZT0iZGlzY3JldGUiIGR1cj0iNzIwbXMiIHJlcGVhdENvdW50PSJpbmRlZmluaXRlIj48L2FuaW1hdGVUcmFuc2Zvcm0+PC9nPjwvc3ZnPg==";function Jr(e){var t,r="",n="230px",i="240px",o=0,a="",s=0,u="",c="px";return e&&(e.unix&&"rem"===(c=e.unix)&&(n="14.375rem",i="15rem"),e.background&&(r=";background:"+e.background),e.width&&(n=e.width),e.height&&(i=e.height),e.imageSource&&(t=e.imageSource)),t||(t=Kr),"px"===c?(s=parseInt(n)/2,Xt.isNumber(s)&&s>0&&(u=";width:"+s+"px"),o=parseInt(i)/2,Xt.isNumber(o)&&o>0&&(a=";height:"+o+"px")):(u=";width:"+n,a=";height:"+i),['<div align="center" ','class="',zr,'" ','style="margin:0 auto;max-width:',n,";max-height:",i,";line-height:",i,r,'"><img style="user-select:none',a,u,";max-width:",n,";max-height:",i,';vertical-align:middle" src="',t,'" draggable="false" /></div>'].join("")}var Qr,qr=window,Yr=document,Xr=5e5;function Zr(e,t){for(var r=0;r<e.length;++r)if(e[r]==t)return oe;return ae}function $r(e){var t;return qr.getComputedStyle?t=qr.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<Yr.styleSheets.length;++t){var r=Yr.styleSheets[t],n=void 0,i=void 0,o=void 0,a=void 0;try{n=r.cssRules,i=Yr.querySelectorAll}catch(TH){}if(n&&i)for(var s=0;s<n.length;++s){o=n[s],a=ae;try{a=i(o.selectorText)}catch(TH){}if(a&&Zr(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 en(e){var t=Yr.createEvent("MouseEvents");return null==t||t.initMouseEvent(e.type,e.bubbles,e.cancelable,qr,e.detail,e.screenX,e.screenY,e.clientX,e.clientY,e.ctrlKey,e.altKey,e.shiftKey,e.metaKey,e.button,e.relatedTarget),t}function tn(e){var t;null===(t=Yr.body)||void 0===t||t.dispatchEvent(en(e))}function rn(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 nn(e,t){Qr===Lr?function(e,t){if(Qr=Yr.createElement("div")){var r=Qr.style;if(r.position="fixed",r.display="block",r.left=r.top=r.margin=r.padding=0,rn(e,t),r.zIndex=Xr,r.width=r.height="100%",de.bIE&&de.IEVersion<10){var n=Yr.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)}Yr.createEvent&&Xt.addEventListener(Qr,"click",tn)}}(e,t):rn(e,t),Yr.body&&!Yr.body.contains(Qr)&&Yr.body.appendChild(Qr)}var on,an,sn={pendingDialogStack:[],pendingDialogTopmostStack:[],opacity:.1,grayHex:128,_updateStacking:function(e){var t,r;0!=(t=this.pendingDialogStack).length?(1!=e&&nn(sn.opacity,sn.grayHex),r=Xr,Xt.each(t,function(e){r++,e._dlgInfo.mask&&(e._dlgInfo.mask.style.zIndex=r++),e.style.zIndex=r})):Qr!==Lr&&(Xt.removeEventListener(Qr,"click",tn),Yr&&Yr.body&&Yr.body.removeChild(Qr),Qr=Lr)},pushDialog:function(e,t){var r,n,i=this;if(e.getBoundingClientRect(),(n=e.bTopmost?i.pendingDialogTopmostStack:i.pendingDialogStack).length>=1e3)Xt.error("Too many modal dialogs.");else{if((r=Yr.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"),Yr.createEvent&&Xt.addEventListener(r,"click",function(t){if(e.dispatchEvent){var r=en(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=Xt.isArray(n)?Xt.indexOf(e,n):-1)&&(n.splice(t,1),(r=e._dlgInfo.mask).parentNode&&r.parentNode.removeChild(r),e._dlgInfo.mask=null,i._updateStacking())}};function un(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;Xt.isString(p.position)&&(l=p.position,c=!1),(Xt.isString(p.left)||Xt.isNumber(p.left))&&(f=p.left,c=!1),(Xt.isString(p.top)||Xt.isNumber(p.top))&&(d=p.top,c=!1),(Xt.isString(p.width)||Xt.isNumber(p.width))&&(h=p.width,c=!1),(Xt.isString(p.height)||Xt.isNumber(p.height))&&(g=p.height,c=!1),Xt.isString(p.transform)&&(m=p.transform,c=!1)}u.opened?Xt.error("showDialog called on open dialog."):(u.opened=oe,u.removeAttribute("closed"),u.setAttribute("opened","true"),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"),Xt.mix(u.style,r),$r(u)&&(n=u,s=((null===(i=Yr.body)||void 0===i?void 0:i.scrollTop)||(null===(o=Yr.documentElement)||void 0===o?void 0:o.scrollTop)||0)+((qr.innerHeight?qr.innerHeight:null===(a=Yr.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,sn.pushDialog(u,t)))}function cn(e){var t=this;return t.opened||Xt.error("closeDialog called on closed dialog."),t.opened=ae,t.removeAttribute("opened"),t.setAttribute("closed","closed"),t.style.display="none",void 0!==e&&(t.returnValue=e),t._dlgInfo.isTopOverridden&&(t.style.top="auto"),t._dlgInfo.modal&&sn.removeDialog(t),t.returnValue}function ln(e){Xt.isNumber(e.opacity)?sn.opacity=e.opacity:sn.opacity=.1,Xt.isNumber(e.grayHex)?sn.grayHex=e.grayHex:sn.grayHex=128}function dn(e){var t,r,n,i;if(!an.dlgMask){var o,a,s,u,c=!1;if(e){if(u={},(Xt.isString(e.top)||Xt.isNumber(e.top))&&(u.top=e.top),(Xt.isString(e.left)||Xt.isNumber(e.left))&&(u.left=e.left),Xt.isString(e.position)&&(u.position=e.position),e.confined)document.getElementsByClassName("dwt-viewer-imageEditor-fullScreen")[0]||(c=e.confined);(Xt.isString(e.width)||Xt.isNumber(e.width))&&(t=e.width),(Xt.isString(e.height)||Xt.isNumber(e.height))&&(r=e.height),Xt.isString(e.background)&&(n=e.background),Xt.isString(e.imageSource)&&(i=e.imageSource),ln(e),c&&e.wrapperEl&&(a=e.wrapperEl,Xt.isString(a)&&(a=Yr.getElementById(a)))}if(!i){var l;if(window&&window.Dynamsoft){var d=window.Dynamsoft.DWT;d&&d.CustomizableDisplayInfo&&(l=d.CustomizableDisplayInfo)}l?(de.bIE&&Xt.isString(l.loaderBarSourceIE)&&""!=l.loaderBarSourceIE&&(i=l.loaderBarSourceIE),!i&&Xt.isString(l.loaderBarSource)&&""!=l.loaderBarSource&&(i=l.loaderBarSource)):i=Kr}if(a&&(s=a.getBoundingClientRect(),a.style.position="relative"),o=Yr.createElement("div")){var f;if(o.className="dynamsoft-dialog-wrap",Hr(o,Jr({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=Yr.body)||void 0===f||f.appendChild(o);c&&s&&(window.onresize?an.preOnresize=window.onresize:an.preOnresize=!1,window.onscroll?an.preOnscroll=window.onscroll:an.preOnscroll=!1),an.dlgMask=o,on.setup(o,c),u&&(o._dlgInfo.styleConfig=u),a&&(o._dlgInfo.wrapperEl=a),o.showModal()}}}function fn(){var e=an.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=Yr.body)||void 0===t||t.removeChild(e);an.dlgMask=!1}an.preOnresize?window.onresize=an.preOnresize:window.onresize=null,an.preOnresize=!1,an.preOnscroll?window.onscroll=an.preOnscroll:window.onscroll=null,an.preOnscroll=!1}on={setup:function(e,t){e.show=un.bind(e,ae,t),e.showModal=un.bind(e,oe,t),e.close=cn.bind(e),e._dlgInfo={}}},an={dlgMask:!1,preOnresize:!1,preOnscroll:!1};var hn=function(){return w(function e(t){I(this,e),nr(this,"div",void 0),nr(this,"container",void 0),nr(this,"docElem",void 0),nr(this,"opacity",void 0),nr(this,"cssFloat",void 0),nr(this,"clearCloneStyle",void 0),nr(this,"boxSizing",void 0),nr(this,"pixelPositionVal",void 0),nr(this,"pixelMarginRightVal",void 0),nr(this,"boxSizingReliableVal",void 0),nr(this,"pixelBoxStylesVal",void 0),nr(this,"reliableHiddenOffsetsVal",void 0),nr(this,"reliableMarginRightVal",void 0),nr(this,"reliableMarginLeftVal",void 0),nr(this,"leadingWhitespace",void 0),nr(this,"tbody",void 0),nr(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}}])}(),gn=new hn(document),mn=gn.docElem;Xt.sizzle;var pn,vn,_n=/^(top|right|bottom|left)$/,yn=/[+-]?(?:\d*\.|)\d+(?:[eE][+-]?\d+|)/.source,Sn=new RegExp("^("+yn+")(?!px)[a-z%]+$","i"),In=new RegExp("^("+yn+")(.*)$","i");window.getComputedStyle?pn=function(e){var t,r;return(r=(t=Xt.isFunction(e.getEL)?e.getEL():e).ownerDocument.defaultView)&&r.opener||(r=window),r.getComputedStyle(t)}:mn&&mn.currentStyle&&(pn=function(e){return e.currentStyle});var bn=/^--/,Tn="[\\x20\\t\\r\\n\\f]",Cn=new RegExp("^"+Tn+"+|((?:^|[^\\\\])(?:\\\\.)*)"+Tn+"+$","g"),wn=["Top","Right","Bottom","Left"],kn=new RegExp(wn.join("|"),"i");window.getComputedStyle?vn=function(e,t,r){var n,i,o,a,s=bn.test(t),u=e.style;return(r=r||pn(e))&&(a=r.getPropertyValue(t)||r[t],s&&a&&(a=a.replace(Cn,"$1")||undefined),""!==a||function(e){return jn.contains(e.ownerDocument,e)}(e)||(a=Jn(e,t)),!gn.pixelBoxStyles()&&Sn.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+""}:mn&&mn.currentStyle&&(vn=function(e,t,r){var n,i,o,a,s=e.style;return null==(a=(r=r||pn(e))?r[t]:undefined)&&s&&s[t]&&(a=s[t]),Sn.test(a)&&!_n.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 En,xn=/<([\w:-]+)/,An=/<|&#?\w+;/,Pn=/^-ms-/,Dn=/-([\da-z])/gi,Fn=/^(none|table(?!-c[ea]).+)/,Wn=/^<([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"},Rn={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:gn.htmlSerialize?[0,"",""]:[1,"X<div>","</div>"]},Mn=document.createElement("div");En=Mn.style,gn.cssFloat=!!Mn.style.cssFloat;var Ln=function(e,t){return t.toUpperCase()},Bn=["Webkit","Moz","ms"],Un={};function Vn(e){var t=jn.cssProps[e]||Un[e];return t||(e in En?e:Un[e]=function(e){if(e in En)return e;var t=e.charAt(0).toUpperCase()+e.slice(1),r=Bn.length;for(;r--;)if((e=Bn[r]+t)in En)return e}(e)||e)}var jn={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(Pn,"ms-").replace(Dn,Ln)},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}},Gn=["flo","at"].join("");jn.cssProps[Gn]=gn.cssFloat?"cssFloat":"styleFloat";function Hn(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+wn[o],!0,i)),n?("content"===r&&(a-=Qn(e,"padding"+wn[o],!0,i)),"margin"!==r&&(a-=Qn(e,"border"+wn[o]+"Width",!0,i))):(a+=Qn(e,"padding"+wn[o],!0,i),"padding"!==r&&(a+=Qn(e,"border"+wn[o]+"Width",!0,i)));return a}function zn(e,t,r){var n=!0,i="width"===t?e.offsetWidth:e.offsetHeight,o=pn(e),a=gn.boxSizing&&"border-box"===Qn(e,"boxSizing",!1,o);if(i<=0||null==i){if(((i=vn(e,t,o))<0||null==i)&&(i=e.style[t]),Sn.test(i))return i;n=a&&(gn.boxSizingReliable()||i===e.style[t]),i=parseFloat(i)||0}return i+Hn(e,t,r||(a?"border":"content"),n,o)}function Kn(e){return new RegExp("^(?:([+-])=|)("+yn+")([a-z%]*)$","i").exec(e)}function Jn(e,t,r,n){if(e&&3!==e.nodeType&&8!==e.nodeType&&e.style){var i,o,a,s=jn.camelCase(t),u=bn.test(t),c=e.style;if(u||(t=Vn(s)),a=jn.cssHooks[t]||jn.cssHooks[s],r===undefined)return a&&"get"in a&&(i=a.get(e,!1,n))!==undefined?i:c[t];"string"===(o=b(r))&&(i=Kn(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]||(jn.cssNumber[t]?"":"px"),l=(jn.cssNumber[t]||"px"!==c&&+u)&&Kn(Qn(e,t));if(l&&l[3]!==c){c=c||l[3],r=r||[],l=+u||1;do{Jn(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]||(jn.cssNumber[s]?"":"px")),gn.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=jn.camelCase(t);return bn.test(t)||(t=Vn(s)),(a=jn.cssHooks[t]||jn.cssHooks[s])&&"get"in a&&(i=a.get(e,!0,r)),i===undefined&&(i=vn(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 qn(e,t){if(!e||"string"!=typeof e)return[];if("boolean"==typeof t&&(t=!1),!t)if(gn.createHTMLDocument){var r=(t=document.implementation.createHTMLDocument("")).createElement("base");r.href=document.location.href,t.head.appendChild(r)}else t=document;var n=Wn.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"===Xt.type(r))jn.merge(u,r.nodeType?[r]:r);else if(An.test(r)){for(n=n||s.appendChild(t.createElement("div")),i=(xn.exec(r)||["",""])[1].toLowerCase(),Hr(n,(o=Rn[i]||Rn._default)[1]+r+o[2]),a=o[0];a--;)n=n.lastChild;jn.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),jn.merge([],n.childNodes))}Xt.each(["height","width"],function(e,t){jn.cssHooks[e]={get:function(t,r,n){if(r)return Fn.test(Qn(t,"display"))&&0===t.offsetWidth?function(e,t,r,n){var i,o={};return Xt.each(t,function(r,n){o[n]=e.style[n],e.style[n]=t[n]}),i=r.apply(e,n||[]),Xt.each(t,function(t,r){e.style[r]=o[r]}),i}(t,Nn,function(){return zn(t,e,n)}):zn(t,e,n)},set:function(t,r,n){var i=n&&pn(t);return function(e,t,r){var n=In.exec(t);return n?Math.max(0,parseInt(n[1])-(r||0))+(n[2]||"px"):t}(0,r,n?Hn(t,e,n,gn.boxSizing&&"border-box"===Qn(t,"boxSizing",!1,i),i):0)}}});var Yn,Xn=Array.prototype.slice,Zn=" ",$n=de.bIE&&de.IEMode<10,ei=/[\n\t\r\.]/g,ti=function(){function e(t,r,n){I(this,e),nr(this,"isNodeList",!0),nr(this,"length",0);var i=this;return!t||Xt.isString(t)?i:Xt.isArray(t)||t.isNodeList?(Array.prototype.push.apply(i,Xt.makeArray(t)),i):(i[0]=t,i.length=1,i)}return w(e,[{key:"item",value:function(t){return Xt.isNumber(t)?t>=this.length?null:new e(this[t]):new e(t)}},{key:"slice",value:function(){return new e(Xn.apply(this,arguments))}},{key:"getDOMNodes",value:function(){return Xn.call(this)}},{key:"each",value:function(t,r){var n=this;return Xt.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?oi(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(Xt.isUndefined(t))return"readonly"===e?r.readOnly?"readonly":"":("style"!==e&&$n?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=ni(a),n=a,i=0;i<s;i++)o=ii(t[i]),r.indexOf(Zn+o+Zn)<0&&(n+=Zn+o);n=Xt.trim(n)}else n=t.join(" ");e.className=n}(t,e.split(Zn))}},{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=ni(o),n=0;n<a;n++)for(i=Zn+ii(t[n])+Zn;r.indexOf(i)>=0;)r=r.replace(i,Zn);e.className=Xt.trim(r)}}(t,e.split(Zn))}},{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=ni(o),n=0;n<a;n++)if(i=Zn+ii(t[n])+Zn,r.indexOf(i)<0)return ae;return oe}return ae}(t,e.split(Zn))}},{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 Xt.DOM.getElDimensions(e,oe)}},{key:"before",value:function(e){var t=this.getEL(),r=[e];t&&(ri(e)&&(r=qn(e)),Xt.each(r,function(e){t.insertBefore(e,t.childNodes[0])}))}},{key:"append",value:function(e){var t=this.getEL(),r=[e];t&&(ri(e)&&(r=qn(e)),Xt.each(r,function(e){t.appendChild(e)}))}},{key:"html",value:function(e){var t=this.getEL();if(t){if(Xt.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);Xt.each(qn(e),function(e){t.appendChild(e)})}}},{key:"style",value:function(e,t){var r=this.getEL();if(r)return Jn(r,e,t)}},{key:"css",value:function(e){Xt.each(this,function(t){Xt.each(e,function(e,r){Jn(t,r,e)})})}},{key:"show",value:function(){Xt.each(this,function(e){e.style.display=""})}},{key:"hide",value:function(){Xt.each(this,function(e){e.style.display="none"})}}])}();function ri(e){return Xt.isString(e)&&(e=Xt.trim(e))&&e.length>=3&&Xt.startsWith(e,"<")&&Xt.endsWith(e,">")}function ni(e){return(Zn+e+Zn).replace(ei,Zn)}function ii(e){return e.replace(ei,"")}function oi(e,t){var r=t;return r&&r.isNodeList&&(r=r.getEL()),Xt.isString(e)?(ri(e)&&Xt.error("Err 4002."),new ti(Xt.sizzle(e,r))):e.isNodeList?e:new ti(e)}function ai(e,t){var r=oi(e,t);return r.length?r.slice(0,1):r}function si(e){return e instanceof ti}(Yn=self||{}).Map||(Yn.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 ui=new(w(function qQ(){I(this,qQ),nr(this,"__ver",20230516),nr(this,"Events",qt),nr(this,"EnumMouseButton",cr),nr(this,"detectButton",lr),nr(this,"getWheelDelta",ur),nr(this,"fromUnicode",pr),nr(this,"escapeHtml",vr),nr(this,"escapeRegExp",_r),nr(this,"unEscapeHtml",yr),nr(this,"param",Er),nr(this,"unparam",xr),nr(this,"colorStrToInt",ar),nr(this,"IntToColorStr",sr),nr(this,"currentStyle",wr),nr(this,"parseHTML",qn),nr(this,"setHtml",Hr),nr(this,"css",Qn),nr(this,"style",Jn),nr(this,"support",gn),nr(this,"all",oi),nr(this,"one",ai),nr(this,"isNodeList",si),nr(this,"Promise",Sr),nr(this,"nativePromise",Ir),nr(this,"loaderBarClassName",zr),nr(this,"loaderBarSource",Kr),nr(this,"createShowMaskContent",Jr),nr(this,"switchEvent",Cr),nr(this,"setBackOpacity",ln),nr(this,"showMask",dn),nr(this,"hideMask",fn),nr(this,"dialog",on),nr(this,"mask",an)})),ci={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,["#",ci.getHex(n),ci.getHex(r),ci.getHex(t)].join("")},RGB2BGR:function(e){return(255&e)<<16|65280&e|e>>16}};ci.BGR2RGB=ci.RGB2BGR;var li=!1,di=!0,fi=/[#\/\?@]/g,hi=/[#\?]/g,gi={scheme:1,userInfo:2,hostname:3,port:4,path:5},mi=new RegExp("^(?:([\\w\\d+.-]+):)?(?://(?:([^/?#@]*)@)?([\\w\\d\\-\\u0100-\\uffff.+%]*|\\[[^\\]]+\\])(?::([0-9]+))?)?(.+)?$");function pi(e,t){return Xt.isString(e)&&Xt.isString(t)?e.toLowerCase()===t.toLowerCase():e===t}function vi(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 _i,yi=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 Xt.clone(t);e.getComponents(t,this)}return s(e,[{key:"clone",value:function(){var t=new e,r=this;return Xt.each(gi,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 pi(t.hostname,e.hostname)&&pi(t.scheme,e.scheme)&&pi(t.port,e.port)}},{key:"toString",value:function(e){var t,r,n,i,o,a=[],s=this;return(t=s.scheme)&&(a.push(vi(t,fi)),a.push(":")),(r=s.hostname)&&(a.push("//"),(o=s.userInfo)&&(a.push(vi(o,fi)),a.push("@")),a.push(encodeURIComponent(r)),(i=s.port)&&(a.push(":"),a.push(i))),(n=s.path)&&(r&&!Xt.startsWith(n,"/")&&(n="/"+n),a.push(vi(n,hi))),a.join("")}}],[{key:"getComponents",value:function(e,t){var r=(e=e||le).match(mi)||[],n=t||{};return Xt.each(gi,function(e,t){n[t]=r[e]}),n}}])}(),Si=Xt.each,Ii=Xt.error,bi=Xt.isFunction,Ti=Xt.isString,Ci=de.bIE&&de.IEVersion<=9,wi=de.bIE&&de.IEVersion<=10,ki=window,Ei=new yi(location.href),xi=Ei&&/^(?:about|app|app\-storage|.+\-extension|file|widget)$/.test(Ei.getScheme()),Ai=!1,Pi=function(){try{return new ki.XMLHttpRequest}catch(TH){}},Di=function(){try{var e=li;return Si(["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),li}catch(TH){Ii("new xhr error: "+TH.message)}}),e}catch(TH){}},Fi=!(xi||!ki.XMLHttpRequest)&&"withCredentials"in(Pi()||[]),Wi=ki.ActiveXObject?function(e){return Ci?Di():!xi&&Pi()||Di()}:Pi,Ni=function(e){return Ai},Oi=/^(?:GET|HEAD)$/,Ri=/^(.*?):[ \t]*([^\r\n]*)\r?$/gm,Mi={xml:"application/xml, text/xml",html:"text/html",text:"text/plain",json:"application/json, text/javascript","*":"*/*"},Li=_i;wi&&(Li=Xt.noop);var Bi=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=Ri.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(TH){Ii(TH,"error"),t=TH.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),Si([e?this.onSuccess:this.onError,this.onComplete],function(e){bi(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(Ci){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?Xt.parse(r.responseText):Xt.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(TH){}}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,Ti(r)&&(r=r.toUpperCase()),o=t.contentType,n=t.url,i=t.dataType,u=t.mimeType,Ti(n)&&(this.nativeXhr=a=Wi(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(TH){}}catch(h){return void(this.state<2?(Ii(h,"error"),this._ioReady(-1,"open error: "+(Xt.isNumber(h.number)?"("+h.number+")":"")+(h.message||""))):Ii(h))}"withCredentials"in(s=t.xhrFields||{})&&(Fi||delete s.withCredentials),Si(s,function(e,t){try{a[t]=e}catch(TH){Ii(TH)}}),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&&Mi[i]?Mi[i]+("*"===i?"":", */*; q=0.01"):Mi["*"]),Si(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&&Ci&&(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,bi(this.beforeSend))if(!1===this.beforeSend(a,f))return void this.abort("cancel");a.send(d),d=null,t.data=null,bi(this.afterSend)&&this.afterSend(f)}catch(TH){this.state<2?(Ii(TH,"error"),this._ioReady(-1,"send error: "+(TH.message||""))):Ii(TH)}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=Li),t)4!==n.readyState&&n.abort();else{Ni()||(this.responseHeadersString=n.getAllResponseHeaders());var i,o=n.status;try{i=n.statusText}catch(TH){Ii("xhr statusText error: "),Ii(TH),i=""}r=this._ioReady(o,i)}}catch(TH){Ii(TH,"error"),n.onreadystatechange=Li,t||this._ioReady(-1,TH.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,Xt.startsWith(o,"//")&&(t.url=o="http:"+o),(Xt.startsWith(o,"http://")||Xt.startsWith(o,"https://"))&&(a=new yi(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(Ei)),i=t.headers)Vi(i[n])&&delete i[n];Xt.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 Ui(e){if(e&&Ti(e.url)){var t=new Bi;return e.async?(e.async=!0,t.sendInternal(e),t):(e.async=!1,t.sendInternal(e))}Xt.log("the url is error.")}function Vi(e){return e===_i}var ji="Please make sure the Dynamic Web TWAIN 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="19",Qi="3",qi="0",Yi="1028",Xi="3",Zi="0",$i="".concat(Ji,",").concat(Qi,",").concat(qi,",").concat(Yi),eo="".concat(Ji,",").concat(Xi,",").concat(Zi,",").concat("1028"),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,9,2,Yi],uo=[1,9,2,Yi],co=[1,9,2,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=function(e){return e.NONE=0,e.TRACE=1,e.DEBUG=2,e.INFO=4,e.WARN=8,e.ERROR=16,e}({}),po=Xt.getLogger(),vo=(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 mo.DEBUG:po.debug(t);break;case mo.ERROR:po.error(t);break;case mo.INFO:po.info(t);break;case mo.WARN:po.warn(t);break;case mo.TRACE:po.trace(t)}}},{key:"trace",value:function(e){this.all(mo.TRACE,e)}},{key:"debug",value:function(e){this.all(mo.DEBUG,e)}},{key:"info",value:function(e){this.all(mo.INFO,e)}},{key:"warn",value:function(e){this.all(mo.WARN,e)}},{key:"error",value:function(e){this.all(mo.ERROR,e)}}])}(),c(S,"_logLevel",mo.ERROR),c(S,"_logFunc",undefined),S);function _o(e){var t;window.console&&(e instanceof Error||Xt.isString(e)?(t=e,tr.navInfoSync.bIE&&(t=Xt.stringify(e))):t=Xt.stringify(e),window.console.error(t))}var yo,So="127.0.0.1";de.bAndroid&&de.bSSL&&(So="local.dynamsoft.com"),yo="0"==Zi.toLowerCase()?"Dynamic Web TWAIN "+[Ji,Xi].join("."):"Dynamic Web TWAIN "+[Ji,Xi,Zi].join(".");var Io={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"},bo={ProductName:yo,Containers:undefined,ContainerMap:{},WebTwainIdMap:{},RemoteScanIdMap:{},Trial:!1,ResourcesPath:"Resources",Debug:!1,IfUpdateService:!1,AutoLoad:!0,ReConnectToService:!0,OnWebTwainReady:!1,OnWebTwainError:function(e){_o(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:So,DeviceFriendlyName:"",LocalHosts:["127.0.0.1","localhost","local.dynamsoft.com"],IfCheckCORS:!1,IfCheckCert:!0,IfChromeExtension:!1,IfLoadResources:!0,IfResourcesAddTimestamp:!0,IfCheckCssFiles:!0,EnableLocalNetworkMixedContent:!1};function To(){var e=tr.DWT.Host;return Xt.isString(e)&&""!=e||(tr.DWT.Host=e=So),e}function Co(){var e=300,t=tr.DWT.RemoteScanConfig;return t&&Xt.isNumber(t.sessionTimeout)&&t.sessionTimeout>0&&(e=t.sessionTimeout),e}var wo={URL:"",UpdateDaysBeforeExpired:30},ko=de.bWin,Eo=de.bMac,xo=de.bLinux,Ao=de.bSafari,Po=de.bFirefox,Do=de.bChrome,Fo=location.hostname,Wo=location.pathname,No=0,Oo=de.bMobile,Ro=parseFloat(de.strBrowserVersion);if(de.bWin||de.bMac||de.bLinux||de.bChromeOS){if(tr.navInfo){var Mo=tr.navInfo;Oo=Oo||Mo.bAndroid||Mo.bPad||Mo.biPhone||Mo.biPad}}else Oo=!0;""===Fo?ko&&Wo.lastIndexOf("\\")>1?Wo=Wo.substring(1,Wo.lastIndexOf("\\")).replace(/%20/g," "):(No=1,Wo=Wo.substring(1,Wo.lastIndexOf("/")).replace(/%20/g," ")):(No=1,Wo=Wo.substring(0,Wo.lastIndexOf("/")));var Lo={bChrome:Do,bFirefox:Po,bSafari:Ao,bIE:de.bIE,bEdge:de.bEdge,bWin:ko,bMac:Eo,bLinux:xo,iPluginLength:0,bFileSystem:de.bFileSystem,bMobile:Oo,strIEVersion:de.IEVersion,strChromeVersion:de.bChrome?Ro:"",strFirefoxVersion:de.bFirefox?Ro:"",basePath:Wo,pathType:No,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:li},Bo=!0,Uo=!1,Vo=de.bHTML5Edition,jo=0,Go=Uo;de.bIE&&(""===(jo=de.IEVersion)||jo>=10?tr.DWT.IfUseActiveXForIE10Plus?(Vo=Uo,Go=Bo,de.bHTML5Edition=Vo):Vo=Bo:(Vo=Uo,jo>=9&&(Go=Bo))),Go||Vo||(Vo=Bo);var Ho={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:{}};function zo(e){var t=Ko(),r=e;return r||(r=de.bWin?".msi":de.bMac?".pkg":tr.navInfo.bArm64?"-arm64.deb":tr.navInfo.bMips64?"-mips64el.deb":tr.navInfo.bAndroid?".apk":de.bLinux||de.bChromeOS||de.bHarmonyOS?".deb":".msi"),[t,"DynamicWebTWAINServiceSetup",r].join("")}function Ko(){var t,r,n=Qo.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&&(Xt.isString(t)||Xt.isString(t.serviceInstallerLocation)&&(n=t.serviceInstallerLocation),Xt.isString(n)))if(Xt.startsWith(n,"https://")||Xt.startsWith(n,"http://"));else if(r&&Xt.isString(r)&&r.length>0){var o="";"/"==r.charAt(r.length-1)||(o="/"),n=[r,o,n].join("")}if(Xt.isString(n)||(n=tr.DWT.ServiceInstallerLocation||""),Xt.isString(n)&&n.length>0)"/"!=n[n.length-1]&&(n+="/");else{var a=Jo();if(Xt.isString(a)&&a.length>0){var s="";"/"==a.charAt(a.length-1)||(s="/"),n=[a,s,"dist/"].join("")}else n="Resources/dist/"}Qo.refServiceInstallerLocation=n}return n}function Jo(){var t=Qo.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&&(Xt.isString(r)?t=r:Xt.isString(r.resourcesPath)&&(t=r.resourcesPath),Xt.isString(t)))if(Xt.startsWith(t,"https://")||Xt.startsWith(t,"http://"));else if(n&&Xt.isString(n)&&n.length>0){var o="";"/"==n.charAt(n.length-1)||(o="/"),t=[n,o,t].join("")}if(Xt.isString(t)||(t=tr.DWT.ResourcesPath||""),!de.bFileSystem){void 0!==t&&""!=t||(t=Lo.basePath||""),t.length>0&&"/"==t.charAt(t.length-1)&&(t=t.substr(0,t.length-1)),Qo.refResourcesPath=t}}return t}var Qo={name:"Dynamic Web TWAIN",bHTML5Edition:Vo,bActiveXEdition:Go,_iImageCaptureDriverType:3,_iBrokerProcessType:1,getChromeEditionPath:zo,getPKGPath:function(){return Ko()+"DynamicWebTWAINMacEdition.pkg"},getMSIPath:function(){return Ko()+"DynamicWebTWAINPlugIn.msi"},getActiveXCABx86Path:function(){return Ko()+"DynamicWebTWAIN.cab"},getActiveXCABx64Path:function(){return Ko()+"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=Io.ServerVersionInfo;return de.bWin||(de.bMac?t=Io.ServerMacVersionInfo:de.bAndroid?t=Io.ServerAndroidVersionInfo:(de.bLinux||de.bChromeOS||de.bHarmonyOS)&&(t=Io.ServerLinuxVersionInfo)),e?t:Xt.replaceAll(t,",","")},getDWTPrefix:function(){return!0===tr.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:Vo,bIgnoreHttpsMixedContent:!1,bPortChanged:!1},qo={bFullEdition:!1,getVersionStrForCheck:function(){return"".concat(Ji,"000000")},versionInfoFromServer:"",hostForCheckCert:So,RemoteReconnectMaxTimes:200,RemoteReconnectTimeSpan:5e3,LocalReconnectMaxTimes:60,LocaleReconnectTimeSpan:3e3,HttpConnectTimeout:de.bSSL?3e3:1e3,WebSocketConnectTimeout:de.bSSL?1e3:600};function Yo(){return qo.HttpConnectTimeout}function Xo(){return qo.WebSocketConnectTimeout}function Zo(e){return function(e){return"localhost"==e||"127.0.0.1"==e}(e)?(Qo.bIgnoreHttpsMixedContent||!de.bSSL||!tr.DWT.EnableLocalNetworkMixedContent)&&de.bSSL:de.bSSL}function $o(){return Zo(tr.DWT.Host)}function ea(){return Qo.bUseDynamsoftLicenseManager?Xt.isString(Qo.refProductKey)&&(Xt.startsWith(Qo.refProductKey,"DLS2")||""===Qo.refProductKey):Xt.isString(Qo.handshakeCode)||Xt.isString(Qo.organizationID)||Qo.bPublicLTS||Xt.isString(tr.DWT.ProductKey)&&Xt.startsWith(tr.DWT.ProductKey,"DLS2")}function ta(e){if(e===undefined)return!0;var t;if(e)for(t=0;t<tr.DWT.LocalHosts.length;t++)if(e===tr.DWT.LocalHosts[t])return!0;return!1}function ra(e){return-1!=e.indexOf("text/json")||-1!=e.indexOf("application/json")}function na(e){return"text/json"===e||"application/json"===e}var ia=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 oa(e,t,r){e._errorCode=t,e._errorString=r}function aa(e){var t=tr.DWT.licenseException;t.code=e._errorCode,t.message=e._errorString,t.fromLTS=!1}function sa(){return tr.DWT.IfChromeExtension?"":"Please contact the site administrator."}tr.DWT.EnumDWT_LicenseErrorCode=ia;var ua=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.ChromeLNADenied=-2909,e}({});function ca(e){oa(e,-1033,"Invalid index.")}function la(e){oa(e,-1034,"Invalid value.")}function da(e){oa(e,-1035,"There is no image.")}function fa(e){oa(e,-1110,"Unrecognized file extension.")}function ha(e){oa(e,-2007,"The system is busy, some operations are not completed. Please try later.")}function ga(e,t){var r=t?["[",t,"]"].join(""):"your device";oa(e,ua.MustUpgrade,"The Dynamic Web TWAIN Service installed on "+r+" is outdated and no longer works with the JavaScript code on the website.")}function ma(e){oa(e,-2209,"The HTML5 edition does not support this method or property.")}function pa(e){oa(e,-2300,"Http upload error: the HTTP Server name/ip cannot be empty.")}function va(e){oa(e,-2301,"Network error.")}function _a(e){oa(e,-2302,"The result format is invalid.")}function ya(e,t,r,n){if(t)vs(e);else if(e._errorCode=-2003,n&&n>0||r){var i;i=n&&n>=200&&n<300?["HTTP process: "]:["HTTP process error: "],r&&(r.indexOf("HTTP process error: ")>=0&&(i=[""]),i.push(r)),n&&n>0&&(i.push(" ("+n+")"),n>=300&&(e._errorCode=ua.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 Sa(e){oa(e,-2304,"Http download error: the url is invalid.")}function Ia(e,t,r,n){if(t)oa(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=ua.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 ba(e,t,r,n){if(t)oa(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 Ta(e){oa(e,-2306,"Upload Error: the upload file cannot be empty.")}function Ca(e){oa(e,-2307,"The width or height you entered is invalid.")}function wa(e){oa(e,-2313,"The size of the images you are about to upload has exceeded the limit.")}function ka(e){oa(e,-2314,"The parameter cannot be empty.")}function Ea(e){oa(e,-2320,"Invalid file.")}function xa(e){oa(e,ia.LicenseInvalid,ea()?"The license is invalid.":"The current product key is empty or invalid."),aa(e)}var Aa,Pa,Da=["January","February","March","April","May","June","July","August","September","October","November","December"];function Fa(e){if(tr.DWT&&Xt.isFunction(tr.DWT.GetFormatedDate))return tr.DWT.GetFormatedDate(e);var t,r,n=e;n=n.replace(/-/g,"/"),t=Date.parse(n),isNaN(t)&&(t=0);var i=(r=new Date(t)).getFullYear(),o=Da[r.getMonth()],a=r.getDate();return"".concat(o," ").concat(a,", ").concat(i)}function Wa(e,t,r){e._errorCode=ia.LicenseExpired;var n="",i=r?"Dynamic Web TWAIN":"document scanning SDK";if(t&&""!=t&&(-1==t.indexOf("on")&&(n=" on "+Fa(t)),e.__licenseInfo&&(e.__licenseInfo.ExpireDate=t)),ea()){var o,a,s,u;if(o=tr.DWT.lgdt(),e._bRemoteMode)a=null!==(s=null===(u=e._dmService)||void 0===u||null===(u=u.attrs)||void 0===u?void 0:u.UUID)&&void 0!==s?s:"";else a="";e._errorString="The "+i+" license expired"+n+". Please contact the website developer for further assistance.",tr.DWT.lcexp(o,a).then(function(){e._errorString=tr.DWT.licenseException.message})}else e._errorString="The "+i+" product key expired"+n+". Please contact the website developer for further assistance.",aa(e)}function Na(e,t){ea()?111==t?(e._errorCode=ia.LicenseExpiredForDLS,e._errorString="The license for v"+Ji+" Service Core Module has expired."):(e._errorCode=ia.LicenseNoCoreForDLS,e._errorString="The license for v"+Ji+" Service Core Module is not found."):(e._errorCode=ia.LicenseNoCore,e._errorString="The product key for the current operating system is missing the Service Core license. "+sa()),aa(e)}function Oa(e){e._errorCode=-2339,ea()?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. "+sa(),aa(e)}function Ra(e){oa(e,-2350,"The indices cannot be empty.")}function Ma(e){oa(e,-2351,"You cannot upload more than one image when the format is BMP, JPG or PNG")}function La(e){oa(e,-2352,"The indices are out of range.")}function Ba(e){oa(e,-2353,"The header name being used is a protected keyword and is not allowed.")}function Ua(e){oa(e,-2358,"The type of the parameter indices must be an Array.")}function Va(e){oa(e,-2359,"The index is out of range.")}function ja(e){oa(e,-2360,"The index is null or undefined.")}function Ga(e){oa(e,-2362,"The image type is not supported.")}function Ha(e){oa(e,-2363,"The data format is not supported.")}function za(e){oa(e,-2365,"The url is invalid.")}function Ka(e){oa(e,-2366,"Converting images to a base64 string failed.")}function Ja(e){oa(e,-2376,"The generate url failed.")}function Qa(e){oa(e,-2377,"Failed to set Image Capture Driver Type.")}function qa(e){oa(e,-2391,"Invalid event name.")}function Ya(e){oa(e,-2393,"Failed to convert the data to blob.")}function Xa(e){oa(e,-2399,"Invalid imageId.")}function Za(e,t){oa(e,-2401,"Failed to load image: "+function(e){return Xt.isString(e)?e:("errorMessage"in e&&(t=e.errorMessage),"message"in e&&(t=e.message),Xt.isString(t)||(t="message"in t?t.message:""),"errorCode"in e&&-1==t.indexOf("(")&&(t+="("+e.errorCode+")"),"code"in e&&-1==t.indexOf("(")&&(t+="("+e.code+")"),t);var t}(t))}function $a(e){oa(e,-2416,"Invalid parameter.")}function es(e){oa(e,-2426,"You have used a full license with a trial license which is not permitted. Please check and update Dynamsoft.DWT.ProductKey.")}function ts(e){oa(e,-2510,"The callback is not a function.")}function rs(e){oa(e,-2513,"The WebTwain instance has been destroyed and can not be used anymore.")}function ns(e){oa(e,-2530,"Document name cannot be empty.")}function is(e){oa(e,-2531,"Document name is not a string.")}function os(e){oa(e,-2548,"You cannot call this function when Dynamsoft.DWT.UseDefaultViewer is set to false.")}function as(e){oa(e,-2549,"You cannot call this function when there is no ui binding.")}function ss(e){oa(e,0,"")}function us(e){var t=e;return t||(t="[]"),{code:-2601,message:"Failed to connect to the Dynamic Web TWAIN Service on "+t+". Please make sure Dynamic Web TWAIN Service is running or the certificate is valid."}}function cs(){return{code:-2602,message:'The parameter "SendTo" is invalid.'}}function ls(){return{code:-2604,message:"Failed to connect to the Proxy Service. Please make sure the Proxy Service is configured successfully, Dynamic Web TWAIN Service is running, or the certificate is valid."}}function ds(e){var t;return e._bRemoteMode?us(null===(t=e._dmService)||void 0===t||null===(t=t.attrs)||void 0===t?void 0:t.name).message:"The Dynamic Web TWAIN Service has been stopped."}function fs(e){oa(e,-2607,"The device selected was not found under the current service object.")}function hs(e){oa(e,-2608,"IfShowFileDialog cannot be set to true when Object is created by CreateRemoteScanObjectAsync.")}function gs(){return{code:-2612,message:"The devices must be an Array."}}function ms(e,t){Xt.isString(t)&&""!=t?oa(e,ua.RemoteDynamsoftServiceStopped,"The Dynamic Web TWAIN Service on ["+t+"] has been stopped."):oa(e,-2308,"The Dynamic Web TWAIN Service has been stopped.")}function ps(e){oa(e,-2614,"The Dynamic Web TWAIN Service has been restarted.")}function vs(e){oa(e,-2615,"User cancelled the operation.")}function _s(e){oa(e,-2616,"Invalid image format type.")}function ys(e){oa(e,-2617,"ShareImages is only supported on Android devices.")}function Ss(e){oa(e,-2618,"Only single index selection is allowed when enumImageType is set to BMP, JPG or PNG.")}function Is(e){oa(e,-2619,"Only single index selection is allowed when enumImageFormatType is set to url.")}function bs(e){oa(e,-2620,"The RemoteScan object has been disposed.")}function Ts(e){oa(e,-2621,"Dynamsoft.DWT.Containers was not set.")}function Cs(e){oa(e,-2622,'Please do not set enumImageType to "IT_MULTIPAGE_PDF", "IT_MULTIPAGE_TIF" or "IT_ALL".')}function ws(e){oa(e,-2623,"Saving multiple images is not allowable when the selected output format is BMP, JPG or PNG.")}function ks(e){oa(e,-2624,"The element within Dynamsoft.DWT.Containers should be a valid object.")}function Es(e){oa(e,-2800,ji)}function xs(e){oa(e,ua.ResponseDataTypeError,"Invalid response data was returned from the Dynamic Web TWAIN Service.")}function As(){return{code:-2806,message:'Error: The argument passed to the parameter "conatinerId" is not a string.'}}function Ps(e){return{code:-2807,message:'Error: The element specified by the id "'+e+"\" doesn't exist."}}function Ds(e,t){oa(e,-2811,t)}function Fs(e){oa(e,-2812,zi)}function Ws(e){oa(e,-2815,Hi)}function Ns(e,t,r){oa(e,-2816,["HTTP process error: ",r," (",t,")."].join(""))}function Os(){return{code:ua.HTSTError,message:"The Connection from the insecure (HTTP) web page failed for HTST."}}function Rs(){return{code:ua.SSLCertExpired,message:"The Dynamic Web TWAIN Service SSL certificate has expired."}}function Ms(){return{code:ua.SSLCertInvalid,message:"The Dynamic Web TWAIN Service SSL certificate is invalid."}}function Ls(){return{code:ua.CORSError,message:'The Connection from the insecure (HTTP) web page to the local "Dynamic Web TWAIN Service" failed!'}}function Bs(){return{code:ua.DWTPortNotReady,message:"The Dynamic Web TWAIN Service is not ready, please try again later."}}function Us(){return{code:-2825,message:"Failed to setup the Default Dynamic Web TWAIN Service."}}function Vs(e){return{code:-2826,message:"Failed to connect the Dynamic Web TWAIN Service on ["+e+"]."}}function js(){return{code:-2827,message:"Failed to get Machine ID."}}function Gs(e){oa(e,-2828,"Invalid PDF Convert Mode Value.")}function Hs(e){oa(e,-2844,"Only Blob of JPEG, PNG, BMP, TIFF and PDF image types can be saved.")}function zs(e){oa(e,-2848,"The capability value is out of range.")}function Ks(e){oa(e,-2853,"The imageId cannot be empty.")}function Js(e){oa(e,-2854,"The imageId does not exist.")}function Qs(e){oa(e,-2855,"The blob cannot be empty.")}function qs(e){oa(e,-2857,"Invalid blob value.")}function Ys(e){oa(e,-2901,"Source document does not exist. Please check the document name or create the document before performing this operation.")}function Xs(e){oa(e,-2902,"Target document does not exist. Please check the document name or create the document before performing this operation.")}function Zs(e){oa(e,-2906,"After initialization, the product key cannot be changed.")}function $s(e){oa(e,-2909,"Local network access is blocked.")}var eu=de.bIE&&de.IEVersion<=9;Aa=self&&self.fetch?self.fetch:window.fetch;var tu=0;function ru(e,t){var r,n=!1;return tu=t,Aa?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=Aa(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?(iu(!0),a=e.on("cancel",function(){n=!0})):iu(!1);var s=r.headers.get("Content-Length"),u=0;e._onPercent&&tu==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&&tu==t&&e._onPercent({loaded:u,total:s});try{return r.enqueue(l),i()}catch(d){Xt.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:ua.HTTPRedirected,message:"The http url redirected."};var f;throw Ns(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 na(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 na(e.headers.get("content-type"))?e.json():e.arrayBuffer()}):l.then(function(e){return e.text()})).then(function(e){var t;if(n)throw vs(t={}),{code:t._errorCode,message:t._errorString};return e})}:(eu&&Xt.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&&(ra(r.responseHeadersString)&&(Xt.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;Ns(n={},r.status,t),o({code:n._errorCode,message:n._errorString,httpCode:r.status})},dataType:"text",method:Pa,data:Pa,headers:Pa,contentType:Pa,mimeType:Pa},n&&(n.method&&(a.method=n.method),n.body&&(a.data=n.body),n.headers&&(a.headers||(a.headers={}),Xt.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),Xt.isNumber(n.timeout)&&n.timeout>0&&(a.timeout=n.timeout)),s&&(a.contentType=!1),"blob"==a.dataType&&eu&&(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&&tu==t&&e._onPercent(r)},!1)}),e.IfShowCancelDialogWhenImageTransfer?iu(!0):iu(!1));var u=Ui(a);e&&e.IfShowCancelDialogWhenImageTransfer&&e.on("cancel",function(){u.abort()})})}),r}var nu=ru(null,0);function iu(e){var t=Xt.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 ou=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}},au=s(function YQ(e,t,r,n,i){o(this,YQ),this.server=e,this.port=t,this.ssl=r,this.useWS=n,this.protocol=i});function su(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 uu=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}({}),cu=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}({}),lu=function(){return s(function e(){o(this,e)},null,[{key:"message",value:function(e){return this._errorMessage[e]}},{key:"init",value:function(){this._errorMessage[uu.OK]="Successful.",this._errorMessage[uu.WS_DISCONN]=cu.WS_DISCONN,this._errorMessage[uu.JSON_REQUIRED]=cu.JSON_REQUIRED,this._errorMessage[uu.OBJECT_DISPOSED]=cu.OBJECT_DISPOSED,this._errorMessage[uu.INVALID_TASK]=cu.INVALID_TASK,this._errorMessage[uu.OBJECT_DISPOSING]=cu.OBJECT_DISPOSING}}])}();c(lu,"_errorMessage",Object.create(null)),lu.init();var du=function(){return s(function e(t,r){o(this,e),c(this,"_code",uu.OK),this.name="DSError",this.message=null!=r?r:"string"==typeof t?t:lu.message(t),this._code="string"==typeof t?uu.Custom:t},[{key:"code",get:function(){return this._code}}])}();function fu(e){return{code:e._errorCode,message:e._errorString}}function hu(e){return"exception"in e&&"description"in e&&0!=e.exception&&""!=e.description}function gu(e){return e&&"cause"in e?e.cause:null}function mu(e){return-1416==e}var pu=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}({}),vu=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 vo.error("requestSync should be implemented in child class"),undefined}},{key:"request",value:function(e,t,r,n){return vo.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:vo.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 vo.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 _u(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 yu(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 Su,Iu=Xt.getLogger(),bu=new WeakSet,Tu=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 _u(e=i(this,t,[].concat(n)),bu),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:Iu.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 yu(bu,this,wu).call(this,e,t,r,undefined,undefined,n)}},{key:"testConnection",value:function(e,t,r,n){return yu(bu,this,wu).call(this,undefined,undefined,e,t,r,n)}}]);var r}(vu);function Cu(e){var t=this.serverInfo,r="";return r=t.ssl?"https://":"http://",r+=t.server,t.port&&(r+=":",r+=t.port),e&&(Xt.startsWith(e,"/")||Xt.endsWith(r,"/")||(r+="/"),Xt.endsWith(e,"/")?r+=e.slice(0,-1):r+=e),r}function wu(e,t,r,n,i,o){return ku.apply(this,arguments)}function ku(){return ku=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=yu(bu,this,Cu).call(this,r),Iu.debug("HTTP URL: "+u),e.next=9,nu(u,s);case 9:return e.abrupt("return",e.sent);case 12:if(e.prev=12,e.t0=e["catch"](0),!(e.t0 instanceof du||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 du(e.t0.message);case 20:case"end":return e.stop()}},e,this,[[0,12]])})),ku.apply(this,arguments)}function Eu(e){try{return"object"===_(e)?e:(e="string"!=typeof e?Xt.stringify(e):e,Xt.parse(e))}catch(t){throw t instanceof du?t:new du(uu.JSON_REQUIRED)}}function xu(e){return Math.random().toString(16).substring(2,2+e)}function Au(e){var t=[xu(8),"-",xu(4),"-",xu(4),"-",xu(4),"-",xu(8)];return e&&t.unshift(e),t.join("")}function Pu(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 Du(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 Fu(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 Wu,Nu,Ou=Xt.getLogger(),Ru=new WeakSet,Mu=function(e){function t(e){var r;return o(this,t),Pu(r=i(this,t,[e]),Ru),Du(r,"_defaultRetries",1),Du(r,"_ws",Wu),Du(r,"_events",{}),Du(r,"_bHeartBeatStarted",!1),Du(r,"_heartBeatTicks",6e4),r._ws=Wu,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 Ou.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,pu.GET_TASKID,n._requestTaskId,r);case 6:i=s.sent;case 7:if(o=n._tasks[i]){s.next=11;break}throw Ou.error("invalid task id: "+i),new du(uu.INVALID_TASK);case 11:return s.next=13,Fu(Ru,n,Hu).call(n,!1);case 13:return s.next=15,Fu(Ru,n,Ku).call(n,e,t,r,o);case 15:Ou.debug("begin to send data "+i),n.disposed||n._ws.send(e),e=null,Ou.debug("end to send data "+i),s.next=27;break;case 21:s.prev=21,s.t0=s["catch"](1),Ou.debug("failed to send data."),Ou.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:Fu(Ru,this,ju),a=null!=r?r:{client:this,userData:this};return Fu(Ru,this,Qu).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 Fu(Ru,this,Hu).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 Ou.debug("terminate WSClient"),this.fireEvent("disposed"),e=!1,this._tasks)this._tasks[t]!==undefined&&this._tasks[t].resolver&&(e=!0);if(this._lic_callback=Wu,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=Wu,this._tasks=Object.create(null),!e){r.next=12;break}throw new du(uu.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]),Xt.isString(t)&&Xt.isFunction(r)&&(n[t]=r)}},{key:"removeEvent",value:function(e,t){var r=this._events[e];r&&Xt.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++)Xt.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}(vu);function Lu(e){var t="";return t=e.ssl?"wss://":"ws://",t+=e.server,e.port&&(t+=":",t+=e.port),t}function Bu(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 du("createWebSocket timed out.");Ou.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 du("websocket error")),c=null,l=null)},s.onmessage=function(t){Fu(Ru,e,Uu).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 du("websocket error")):c(t),c=null,l=null)}}catch(m){if(m instanceof du||m&&m.code&&m.message)throw m;if(m.message)throw new du(m.message)}})}function Uu(e,t){return Vu.apply(this,arguments)}function Vu(){return Vu=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=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){Su._preBlobResolv=e,Su._waitForPreBlob(n)});case 8:Su._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&&Xt.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,pu.ONMESSAGE_PROCESS_DATA,n._requestTaskId,a);case 23:return u=e.sent,c=!1,e.next=27,n._cbToGetTaskId(u,pu.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,pu.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&&Ou.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 d=i.cb?i.cb:n._cbToGetTaskId,e.next=51,d({rawData:r,jsonData:u},pu.HANDLE_RAW_MESSAGE,n._requestTaskId,i.ctx);case 51:if((l=e.sent)!==undefined){e.next=56;break}return e.next=55,d(u,pu.HANDLE_PROCESSED_MESSAGE,n._requestTaskId,i.ctx);case 55:l=e.sent;case 56:l&&!c&&(i.tmid&&clearTimeout(i.tmid),delete n._tasks[o],i.resolver&&i.resolver.resolve(l)),e.next=65;break;case 59:e.prev=59,e.t0=e["catch"](1),Ou.debug("failed to handle message."),e.t0 instanceof Error?Ou.error(e.t0):Ou.error(Xt.stringify(e.t0)),delete n._tasks[o],null===(f=i)||void 0===f||null===(f=f.resolver)||void 0===f||f.reject(e.t0.message);case 65:case"end":return e.stop()}},e,null,[[1,59]])})),Vu.apply(this,arguments)}function ju(e,t,r){return Gu.apply(this,arguments)}function Gu(){return Gu=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===pu.GET_TASKID?3:e.t0===pu.HANDLE_RAW_MESSAGE?7:9;break;case 3:return(o=Eu(t)).cmdId=null!==(i=o.cmdId)&&void 0!==i?i:Au(),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()}},e)})),Gu.apply(this,arguments)}function Hu(e,t,r,n){return zu.apply(this,arguments)}function zu(){return zu=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(!this.connected&&!this.disposed){e.next=2;break}return e.abrupt("return");case 2:if(!(o=this)._connectPromise){e.next=7;break}return e.next=6,o._connectPromise;case 6:return e.abrupt("return");case 7:return r=null!=r?r:this._defaultRetries,n=null!=n?n:100,a=Fu(Ru,o,Lu).call(o,o.serverInfo),Ou.debug("WebSocket URL: "+a+", try to create websocket "+r+"/"+n),o._connectPromise=new Qt.Promise(function(e,t){var s=function(n){Fu(Ru,o,Bu).call(o,o,a,o.serverInfo.protocol,i).then(function(t){e(t)})["catch"](function(e){Ou.debug("create websocket failed: "+e.message),n<r?u(n):t(e)})};function u(e,t,r){setTimeout(function(){s(++e)},n)}s(0)}),e.prev=12,e.next=15,o._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,o._connectPromise=null,e.finish(20);case 23:case"end":return e.stop()}},e,this,[[12,17,20,23]])})),zu.apply(this,arguments)}function Ku(e,t,r,n){return Ju.apply(this,arguments)}function Ju(){return Ju=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,pu.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)})),Ju.apply(this,arguments)}function Qu(e,t,r,n,i,o,a){return qu.apply(this,arguments)}function qu(){return qu=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,Fu(Ru,u,Hu).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,pu.GET_TASKID,null,n);case 15:c=e.sent;case 16:return c===undefined&&Ou.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,cb:r},u._tasks[c]=d,u._requestTaskId=c,e.next=24,Fu(Ru,u,Ku).call(u,t,r,n,d);case 24:return u._cbToGetTaskId=r,s&&(d.tmid=setTimeout(function(){Ou.debug("ws request time out."),d.timedout=!0,d.resolver.reject("request timed out.")},s)),u.disposed||u._ws.send(t),Ou.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 du||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 du(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]])})),qu.apply(this,arguments)}function Yu(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 Xu(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 Zu(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")}Su=Mu;var $u=new WeakSet,ec=function(){function e(){o(this,e),Yu(this,$u),Xu(this,"_maxWebSocketCon",10),Xu(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?Zu($u,this,rc).call(this,e,t):new Tu(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(!su((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){try{e.dispose()}catch(t){}})}}],[{key:"Instance",get:function(){return this._gClientPool||(this._gClientPool=new e),this._gClientPool}}]);var t}();function tc(e){this.removeTerminatedWSClient();var t,r=u(this._wsClients);try{for(r.s();!(t=r.n()).done;){var n=t.value;if(su(n.serverInfo,e)&&!n.disposed)return n.addRef(),n}}catch(i){r.e(i)}finally{r.f()}return null}function rc(e,t){var r;return t||(r=Zu($u,this,tc).call(this,e)),r||(this._wsClients.length<this._maxWebSocketCon?((r=new Mu(e)).addEvent("disposed","1",function(){Nu.Instance.removeTerminatedWSClient()}),this._wsClients.push(r),r):null)}Nu=ec,Xu(ec,"_gClientPool",null);var nc=function(){function e(){o(this,e)}return s(e,null,[{key:"getHttpClientForDcp",value:function(t,r){var n,i=tr.dcp,o=$o();if(r||!o?(n=i.Port,o=!1):(n=i.SSLPort,o=!0),Xt.isString(t)){var a=new au;return Xt.startsWith(t,"https://")?(a.ssl=!0,a.server=t.substring(8)):Xt.startsWith(t,"http://")?(a.ssl=!1,a.server=t.substring(7)):(a.ssl=$o(),a.server=t),ec.Instance.getClient(a)}return e.getHttpClient(null,n,o)}},{key:"getHttpClient",value:function(e,t,r){var n=r?"https":"http",i=new au(e||To(),t,r,!1,n);return ec.Instance.getClient(i)}},{key:"getWsClient",value:function(e,t,r,n){var i=new au(e||To(),t,r,!0,Ho.wsProtocol);return ec.Instance.getClient(i,n)}},{key:"closeWsClient",value:function(e,t,r){var n=new au(e||To(),t,r,!0,Ho.wsProtocol);return ec.Instance.closeClient(n)}}])}();Qt.ClientPool=ec;var ic=parseInt(Ji),oc=parseInt(Qi),ac=parseInt(qi),sc="ddm/",uc="ddm_"+[ic,oc,ac,Yi].join("");function cc(){return sc+uc}function lc(e){return dc.apply(this,arguments)}function dc(){return(dc=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=Yo(),n=[cc(),"/VersionInfo?","ts=",Xt.now()].join(""),i=['{"id":"',Xt.guid(),'","method":"VersionInfo"}'].join(""),o=nc.getHttpClientForDcp(t),e.abrupt("return",o.request(i,n,{dataType:"json"},r));case 4:case"end":return e.stop()}},e)}))).apply(this,arguments)}function fc(e){Xt.log(e)}var hc=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}({}),gc=function(e){return zo(e)},mc=function(){return zo(".deb")},pc=function(){return zo(".rpm")},vc=function(){return de.bAndroid?hc.enumAndroid:de.bMac?hc.enumMac:de.bChromeOS?hc.enumChromeOS:de.bHarmonyOS?hc.enumHarmonyOS:tr.navInfo.bEmbed?hc.enumEmbed:de.bLinux?hc.enumLinux:de.biPhone||de.biPad?hc.enumiOS:hc.enumWindow},_c="Getting the WebTwain port...",yc="The WebTwain version not compatible.",Sc="Decoding the license...",Ic="Checking the license...",bc=function(e){return e.CM_RENDERALL=1,e.CM_IMAGEONLY=2,e.CM_AUTO=3,e.CM_RENDERALLWITHANNOTATION=4,e}({});function Tc(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 Cc(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 wc(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 kc=Ji+".",Ec=parseInt(Ji),xc=0,Ac=1,Pc=2,Dc=3,Fc=4,Wc=7,Nc=8,Oc=9,Rc=10,Mc=50,Lc=51,Bc=52;function Uc(e){return Xt.isString(e)?Xt.trim(e):e}var Vc=new WeakSet,jc=function(){return s(function r(){o(this,r),Tc(this,Vc),Cc(this,"isLTS",ea)},[{key:"isLongKey",value:function(e){if(Xt.isString(e)&&e.length>0){var t=e.charAt(0);if("f"==t||"t"==t)return!0;if(Xt.startsWith(e,"DLS"))return!1;if(Xt.isNumber(e))return!1;var r=parseInt(e)+"-";return!Xt.startsWith(e,r)}return!1}},{key:"isLicenseMixed",value:function(e,t){var r,n=!1,i=e||tr.DWT.ProductKey;(tr.DWT.lclex(),t)&&((Uc(tr.DWT.organizationID)||Uc(tr.DWT.handshakeCode))&&i&&(n=!0,oa(r={},-2444,"A license can only be specified once and has already been set using the ProductKey API.")));if(!n&&Xt.isString(i))if(i=Xt.trim(i),Xt.startsWith(i,"f")||Xt.startsWith(i,"t"));else if(""==i);else if(Xt.startsWith(i,"DLS2"))try{wc(Vc,this,Hc).call(this,i)}catch(a){n=!0,oa(r={},-2440,""),r._errorString=a.message}else{wc(Vc,this,Gc).call(this,i).LTS||(n=!0,function(e){oa(e,ia.LicenseParseFailed,"The license is invalid.")}(r={}))}if(n&&r){aa(r);var o=tr.DWT.licenseException;Xt.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(Xt.isString(n))return n=Xt.trim(n)}return null}},{key:"_initAR",value:function(e){var t,r;e&&(e.pk||(t=e.ar,r=e.u,t&&r&&(Qo.bUseDynamsoftLicenseManager=!0,tr.DWT.lsdt(tr.DWT.EnumInstance.dwt_browser),tr.DWT.lsmid(r,""),tr.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(),!Xt.isString(r)){i.next=32;break}if(""===r||!this.isLongKey(r)){i.next=8;break}return this.isLicenseMixed(r,!1)||(this._innerResetLicense(),Qo.bPublicLTS=!1,Qo.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(),Qo.refProductKey="",Qo.bPublicLTS=!0,Qo.handshakeCode="200001",i.abrupt("return");case 26:if(!a.pk){i.next=31;break}return this.isLicenseMixed(a.pk,!1)||(this._innerResetLicense(),Qo.bPublicLTS=!1,Qo.refProductKey=a.pk),i.abrupt("return");case 31:Qo.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&&fc("Parsing Product Key...");var t=this.getLicenseFromDynamsoftCore(),r=!1;if(null===t||""===t){var n=Uc(tr.DWT.organizationID),i=Uc(tr.DWT.handshakeCode),o=n||i;if(t=Xt.trim(tr.DWT.ProductKey),!o){var a=wc(Vc,this,Gc).call(this,t);a.LTS&&(i=Uc(a.handshakeCode),o=(n=Uc(a.organizationID))||i)}if(o)return this._innerResetLicense(),Xt.isNumber(t)&&(n=t),Qo.handshakeCode=i,Qo.organizationID=n,Qo.licenseServer=tr.DWT.licenseServer,Qo.sessionPassword=tr.DWT.sessionPassword,void(Qo.bPublicLTS=wc(Vc,this,zc).call(this,Qo.licenseServer,o))}if(Qo.refProductKey!==t&&(this._innerResetLicense(),Xt.isString(t)&&t.length>0&&(Qo.refProductKey=t,r=!0)),r)if(this.isLongKey(Qo.refProductKey))Qo.bPublicLTS=!1;else{var s,u={_pLoad:{isEmpty:di},_license:Qo.refProductKey,_licenseServer:[]};try{s=ou(u)}catch(l){Xt.error(l),s=!1}if(s&&Xt.isString(s.l)){var c=Xt.trim(s.l);""==c?(c="200001",Qo.organizationID=c,Qo.handshakeCode=c):(-1!=c.indexOf("-")||(Qo.organizationID=c),Qo.handshakeCode=c),Xt.isArray(s.ls)&&s.ls.length>0&&(Qo.licenseServer=s.ls),Qo.bPublicLTS=wc(Vc,this,zc).call(this,Qo.licenseServer,c),Qo.sessionPassword=s.sp}else Qo.bPublicLTS=!1,s&&Xt.isNumber(s.l)&&(Qo.handshakeCode=""+s.l)}}},{key:"_innerResetLicense",value:function(){Qo.refProductKey="",Qo.handshakeCode=undefined,Qo.organizationID=undefined,Qo.licenseServer=undefined,Qo.sessionPassword="",Qo.bPublicLTS=!0}},{key:"checkOSForAllowCore",value:function(e,t,r){if(Qo.bHTML5Edition){if(e)return wc(Vc,this,Xc).call(this,t);var n=r._bRemoteMode,i=r.__serverPlatform;return this.isOSOK(t,n,i)}return di}},{key:"checkLocalPlatformForRemoteService",value:function(e){var t,r,n,i=e.__licenseInfo,o=vc(),a=!1;for(t=0;t<i.Detail.length;t++)if(r=i.Detail[t],(n=wc(Vc,this,qc).call(this,r.EnumLicenseType,r.LicenseType)).Core&&Xt.isString(r.Version)&&0==r.Version.indexOf(kc)){if(a=wc(Vc,this,Xc).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==hc.enumWindow?function(e){oa(e,-2344,"The current product key does not support Windows OS. "+sa()),aa(e)}(e):o==hc.enumLinux?function(e){oa(e,-2346,"The current product key does not support Linux OS. "+sa()),aa(e)}(e):o==hc.enumMac?function(e){oa(e,-2345,"The current product key does not support MAC OS. "+sa()),aa(e)}(e):function(e){oa(e,-2347,"The current product key does not support your OS. "+sa()),aa(e)}(e)),a}},{key:"checkProductKey",value:function(e,t,r){var n,i=tr.DWT.licenseException;return!t.Camera&&(e.__licenseInfo||(e.__licenseInfo={}),(n=wc(Vc,this,Jc).call(this,e,e.__licenseInfo,li,t,r))||(i.code=e._errorCode,i.message=e._getErrorString(),i.fromLTS=!1),n)}},{key:"isBindDomainOK",value:function(e){if(Xt.isUndefined(e)||null==e||""==e||"*"==e||"*.*"==e)return di;var t=location.hostname,r=li;if(""==t)return di;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=di;break}var u=s.split("."),c=u.length;if(c>0&&c-1<=i){for(var l=di,d=c-1;d>0;d--){if(u[d].indexOf("*")>-1){r=di;break}if(d+i-c>=0){if(n[d+i-c]!=u[d]){l=li;break}}else if("*"!=u[d]){l=li;break}}if(l&&("*"==u[0]||i>=c&&n[i-c]==u[0])){r=di;break}}}return r}},{key:"isExpiredOrFuture",value:function(e,t){if(""==e)return li;if(!t){var r=e.length;if(r>2&&"/"==e[r-2]&&"0"==e[r-1])return li}var n=nl(e),i=(new Date).getTime(),o=i+5184e6;return n.getTime()<i||t&&n.getTime()>o?di:li}},{key:"willTrialExpire",value:function(e){if(""==e)return li;var t=nl(e),r=(new Date).getTime();return t.getTime()<r+432e6&&t.getTime()>r?di:li}},{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?di:(t?r==hc.enumWindow?o=!0:r==hc.enumLinux?i=!0:r==hc.enumMac?n=!0:r==hc.enumEmbed?s=!0:r==hc.enumChromeOS?u=!0:r==hc.enumAndroid?c=!0:r==hc.enumHarmonyOS?l=!0:r==hc.enumiOS&&(a=!0):(n=de.bMac,i=de.bLinux,o=de.bWin,a=de.biPhone||de.biPad,u=de.bChromeOS,s=tr.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?di:li)}},{key:"isBrowserOK",value:function(e){if(Xt.isString(e)){if(""==e||"0"==e)return di;var t=(e=e.toLowerCase()).split(";"),r=li;return Xt.each(t,function(e){("chrome"==Xt.trim(e)&&(de.bChrome||de.bSafari||de.bOpera||de.bEdge)||"ie"==Xt.trim(e)&&de.bIE||"firefox"==Xt.trim(e)&&de.bFirefox)&&(r=di)}),r}return li}},{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.OCRKit?e.OCRKit:t.OCRPro?e.OCRPro:t.OCR?e.OCR:e.Core}},{key:"setNoAllowedLicenseTypeError",value:function(e,t,r){r.Core?Na(e):r.Webcam||r.Camera?t||r.Camera?function(e){e._errorCode=-2431,ea()?e._errorString="The license for the Camera Addon is not found or has expired.":oa(e,-2431,"The current product key does not support Camera Addon. "+sa()),aa(e)}(e):function(e){e._errorCode=-2338,ea()?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. "+sa(),aa(e)}(e):r.PDFRasterizer?t?function(e){e._errorCode=-2370,ea()?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. "+sa(),aa(e)}(e):Oa(e):r.OCRKit?function(e){e._errorCode=-2340,ea()?e._errorString="The license for the module OCR Kit is not found or has expired.":e._errorString="The current product key does not support OCR Kit. "+sa(),aa(e)}(e):r.OCRPro?function(e){e._errorCode=-2341,ea()?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. "+sa(),aa(e)}(e):r.OCR?function(e){e._errorCode=-2340,ea()?e._errorString="The license for the module OCR is not found or has expired.":e._errorString="The current product key does not support OCR. "+sa(),aa(e)}(e):xa(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==tr.DWT.EnumDWT_ImageType.IT_PDF||t==tr.DWT.EnumDWT_ImageType.IT_MULTIPAGE_PDF)&&(Qo.bHTML5Edition?e.__addon&&e.__addon.PDF&&(r=e._getConvertMode()):e.Addon&&e.Addon.PDF&&(r=e._getConvertMode()),r==bc.CM_RENDERALL||r==bc.CM_RENDERALLWITHANNOTATION))return this.checkProductKey(e,{PDFRasterizer:!0},!0);return di}},{key:"getPublicLicenseContent",value:function(e){var t=[],r=e;if(!Xt.isString(r)){if(Xt.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 Qo.bPublicLTS?"":Qo.handshakeCode||Qo.organizationID}}]);var t}();function Gc(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=di),r}function Hc(e){ou({_pLoad:{isEmpty:di},_license:e,_licenseServer:[]})}function zc(e,t){var r=!0;if(Xt.isArray(e)&&e.length>0){var n=e[0];if(Xt.isString(n)&&""!=n)"mlts.dynamsoft.com"!==new yi(n).getHostname()&&(r=!1)}return r&&(!t||"200001"===t||Xt.startsWith(t,"200001-"))}function Kc(e,t,r){return this.checkOSForAllowCore(e,t,r)}function Jc(e,t,r,n,i){var o,a=!1;if(Qo.bHTML5Edition&&Xt.isFunction(e._needCheckProxyRemoteScanLicense)&&(a=e._needCheckProxyRemoteScanLicense()),t&&t.LTS){if(!t||!Xt.isArray(t.Detail)||0==t.Detail.length)return this.isLTS()?Na(e):xa(e),li}else if(!t||!Xt.isArray(t.Detail)||0==t.Detail.length)return this.isLTS()?Na(e):xa(e),li;var s,u,c,l,d=0,f=0,h=[],g=[],m=li,p=li,v=li,_=li,y=li,S=li,I=li,b=li;if(!this.isBindDomainOK(t.Domain))return function(e){oa(e,-2342,"The domain of your current site does not match the domain bound in the current product key. "+sa()),aa(e)}(e),li;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 es(e),li;if(t.bTrial=o,n.Core||n.Webcam){var T=[],C=!1;for(u=0;u<t.Detail.length;u++)if(c=t.Detail[u],l=wc(Vc,this,qc).call(this,c.EnumLicenseType,c.LicenseType),n.Core&&l.Core&&this.checkOSForAllowCore(r,c.OS,e)||n.Core&&l.Core&&Qo.bActiveXEdition&&l.ActiveX||n.Webcam&&l.Webcam&&!r){if(t.LTS);else if(!Xt.isString(c.Version)||0!=c.Version.indexOf(kc)){T.push(c);continue}if(Qo.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)}C=!0}if(!C&&T.length>0)return T.splice(0),function(e,t){var r=sa();oa(e,ia.LicenseVersionNotCurrent,"The current product key is not for version ".concat(t,". ").concat(r)),aa(e)}(e,"0"==qi.toString()?[Ji,Qi].join("."):[Ji,Qi,qi].join(".")),!1;T.splice(0)}else g=t.Detail;for(u=0;u<g.length;u++){var w=di;if(c=g[u],l=wc(Vc,this,qc).call(this,c.EnumLicenseType,c.LicenseType),n.Core&&l.Core||this.isAllowLicenseType(l,n)){s=c.ExpireDate.replace(/-/g,"/");var k="FALSE"!=c.Trial;if(this.isExpiredOrFuture(s,k))h.push(s);else if(k&&l.Core&&this.willTrialExpire(s)&&(t.ExpireDate=s),t.LTS||l.Core&&Qo.bHTML5Edition&&parseInt(c.Version)>=Ec||l.Core&&Qo.bActiveXEdition||!l.Core){var E=!1;if(l.Core)(this.checkOSForAllowCore(r,c.OS,e)||Qo.bActiveXEdition&&l.ActiveX)&&(E=!0);else{var x=r;n.Camera&&(x=!0),wc(Vc,this,Kc).call(this,x,c.OS,e)&&(E=!0)}E?this.isBrowserOK(c.Browser)||i?(d++,w=li):p=di:n.Core?m=di:n.PDFRasterizer?_=di:n.Webcam||n.Camera?y=di:n.OCRKit?I=di:n.OCRPro?b=di:n.OCR&&(S=di)}else v=di;w&&f++}}if(d>0)return di;if(0==f)return this.setNoAllowedLicenseTypeError(e,r,n),li;if(h.length>0){var A,P=0,D=1e20,F="",W=(new Date).getTime();for(s="",u=0;u<h.length;u++)(A=nl(h[u])).getTime()<W&&A.getTime()>P?(P=A.getTime(),s=h[u]):A.getTime()>W&&A.getTime()<D&&(D=A.getTime(),F=h[u]);return""!=s?(A=nl(s),Wa(e,s=this.getLicenseDateString(A),o)):""!=F?(A=nl(F),F=this.getLicenseDateString(A),function(e){oa(e,ia.LicenseIsFuture,"The current product key is invalid. "+sa()),aa(e)}(e)):Wa(e,"",o),li}return v?(function(e){oa(e,-2348,"The current product key is invalid because it's generated with the licenses of a different major version."),aa(e)}(e),li):p?(de.bEdge?function(e){oa(e,-2330,"The current product key does not support Edge. "+sa()),aa(e)}(e):de.bChrome?function(e){oa(e,-2327,"The current product key does not support Chrome. "+sa()),aa(e)}(e):de.bFirefox?function(e){oa(e,-2328,"The current product key does not support Firefox. "+sa()),aa(e)}(e):de.bIE?function(e){oa(e,-2329,"The current product key does not support IE. "+sa()),aa(e)}(e):de.bSafari?function(e){oa(e,-2392,"The current product key does not support Safari. "+sa()),aa(e)}(e):function(e){oa(e,-2343,"The current product key does not support your browser. "+sa()),aa(e)}(e),li):m?(this.setNoAllowedLicenseTypeError(e,r,{Core:!0}),li):_?(this.setNoAllowedLicenseTypeError(e,r,{PDFRasterizer:!0}),li):y?(this.setNoAllowedLicenseTypeError(e,r,{Webcam:!0}),li):I?(this.setNoAllowedLicenseTypeError(e,r,{OCRKit:!0}),li):b?(this.setNoAllowedLicenseTypeError(e,r,{OCRPro:!0}),li):S?(this.setNoAllowedLicenseTypeError(e,r,{OCR:!0}),li):(xa(e),li)}function Qc(e){var t=li,r=li,n=li,i=li,o=li,a=li,s=li,u=li,c=li;return Xt.isString(e)&&""!=e&&Xt.each(e.split(";"),function(e){var l=1*e;l==Pc||l==Dc||l==xc||l==Ac?t=di:l==Fc?r=di:l==Mc?n=di:l==Lc?i=di:l==Bc?o=di:l==Wc?a=di:l==Nc?s=di:l==Oc?u=di:l==Rc&&(c=di)}),{Core:t,PDFRasterizer:u,Webcam:s,barcode1D:r,QR:n,PDF417:i,DataMatrix:o,OCR:a,OCRPro:c,OCRKit:false}}function qc(e,t){var r=wc(Vc,this,Qc).call(this,e),n=wc(Vc,this,Yc).call(this,t);return Xt.each(["Core","Html5","RemoteScan","LocalScan","ActiveX","PDFRasterizer","Webcam","barcode1D","QR","PDF417","DataMatrix","OCR","OCRPro","OCRKit"],function(e){r[e]=r[e]||n[e]}),r}function Yc(e){var t=li,r=li,n=li,i=li,o=li,a=li,s=li,u=li,c=li,l=li,d=li,f=li,h=li,g=li;return e&&""!=e&&((e=e.toLowerCase()).indexOf("html5")>-1||"win=(aph) or mac=(ph) or linux(h)"==e?(t=di,e.indexOf("html5;activex;oldie")>-1?i=di:e.indexOf("html5;activex")>-1?(r=di,h=di,i=di):(r=di,h=di),e.indexOf(";remotescan")>-1&&(r=di,f=di,e.indexOf(";onlyremote")>-1&&(h=li))):"1d barcode reader"==e?n=di:"2d barcode reader(qrcode)"==e?o=di:"2d barcode reader(pdf417)"==e?a=di:"2d barcode reader(data matrix)"==e?s=di:"webcam"==e?c=di:"pdf rasterizer"==e?l=di:"proocr"==e?d=di:e.indexOf("ocr")>-1&&(e.indexOf("ocr kit")>-1&&(g=di),u=di)),{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,OCRKit:g}}function Xc(e){var t=e.toLowerCase();return t.indexOf("wasm")>-1||t.indexOf("mobile")>-1}var Zc=new jc;function $c(e,t){return el.apply(this,arguments)}function el(){return(el=n(g().mark(function e(t,r){var n;return g().wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if(ea()){e.next=2;break}return e.abrupt("return");case 2:if(e.prev=2,tr.DWT.li({instanceMode:tr.DWT.lgdt()},"")){e.next=17;break}return r&&fc("Getting Machine ID."),e.prev=6,e.next=9,lc();case 9:return n=e.sent,e.next=12,tl(n);case 12:e.next=17;break;case 14:e.prev=14,e.t0=e["catch"](6),Xt.log(e.t0);case 17:e.next=22;break;case 19:e.prev=19,e.t1=e["catch"](2),Xt.log(e.t1);case 22:case"end":return e.stop()}},e,null,[[2,19],[6,14]])}))).apply(this,arguments)}function tl(e){return rl.apply(this,arguments)}function rl(){return(rl=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(!(Xt.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:Xt.isString(r)&&""!=r&&(tr.DWT.lsmid(r,""),tr.DWT.lsmid2b(r));case 8:case"end":return e.stop()}},e)}))).apply(this,arguments)}function nl(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 il(e){if(""==e)return 65536;var t=nl(e),r=(new Date).getTime(),n=(t.getTime()-r)/864e5;return t.getTime()<r?0:Math.ceil(n)}tr.DWT.isPublicLicense=function(){return Qo.bPublicLTS};var ol,al=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),Xt.each(n._exec[e]||[],function(e){var t=e.f,i=e.c||n;try{t.apply(i,r)}catch(TH){Xt.error(TH)}})}},{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 sl(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 ul(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 cl(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 ll,dl="[bio]: ",fl=window,hl=fl&&fl.FormData,gl=new WeakSet,ml=function(e){function t(e){var r;return o(this,t),sl(r=i(this,t),gl),ul(r,"_attrs",{}),Xt.mix(r._attrs,{action:"",data:{},bChunkedSendData:di,ajaxConfig:{value:{},type:"post",processData:li,cache:li,dataType:"text",async:di,contentType:li,retry:0,headers:{"X-Requested-With":li}},ajax:"",formData:"",CORS:li,bOnlyResponseEmptyIsOK:di}),Xt.mix(r._attrs,e),cl(gl,r,pl).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 cl(gl,this,vl).call(this,e)}},{key:"uploadToServer",value:function(e){var r=this,n=r.get("ajaxConfig");cl(gl,r,_l).call(r),e&&e.size>0&&(cl(gl,r,yl).call(r,e),Xt.isString(e.name)&&""!=e.name?r.name=e.name:r.name=e.fileName,e=null),Xt.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(Xt.mix(n,{method:"POST",async:i,onSuccess:function(e,n,i){bl(r.get(t.PROP.data)),bl(r.get(t.PROP.formData));var o=r.get(t.PROP.ajax);Xt.isFunction(o.dispose)&&o.dispose(),r.set(t.PROP.data,null),r.set(t.PROP.formData,null),r.set(t.PROP.ajax,null);var a=cl(gl,r,Il).call(r,e,i);r.fire(t.event.SUCCESS,a)},onError:function(e,n,i){var o;bl(r.get(t.PROP.data)),bl(r.get(t.PROP.formData));var a,s,u=r.get(t.PROP.ajax);Xt.isFunction(u.dispose)&&u.dispose(),r.set(t.PROP.data,null),r.set(t.PROP.formData,null),r.set(t.PROP.ajax,null),e&&Xt.isArray(e)&&e.length>2?(o=e[0],a=e[1],s=e[2]):(o=e,a=n,s=i),cl(gl,r,Sl).call(r,s,a,o)}}),i){var o=Ui(n);return r.set(t.PROP.ajax,o),!0}return Ui(n)}},{key:"abort",value:function(){var e=this,t=e.get("ajax");return Xt.isObject(t)?(t.abort(),e.set("ajax",!1),e):(Xt.log(dl+"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}}])}(al);function pl(){this.get("CORS");var e=this.get("ajaxConfig");return Xt.mix(e,{xhrFields:{withCredentials:!1}}),e}function vl(e){var t=this,r=t.get(ol.PROP.ajaxConfig),n=[];if(cl(gl,t,_l).call(t),Xt.each(e,function(e){e&&e.size>0?(cl(gl,t,yl).call(t,e),Xt.isString(e.name)&&""!=e.name?n.push(e.name):n.push(e.fileName)):n.push("")}),Xt.mix(r,{data:t.get(ol.PROP.formData),url:t.get(ol.PROP.action),beforeSend:function(e,r,n){e.upload.addEventListener("progress",function(e){t.fire(ol.event.PROGRESS,{loaded:e.loaded,total:e.total,name:""})},!1)}}),Xt.mix(r,{method:"POST",async:t.get("async"),onSuccess:function(e,r,i){var o="";n=[],e&&(e&&Xt.isArray(e)&&e.length>1?o=e[0]:Xt.isString(e)&&(o=e)),o=cl(gl,t,Il).call(t,o,i),t.fire(ol.event.SUCCESS,o)},onError:function(e,r,i){var o,a;n=[],e&&Xt.isArray(e)&&e.length>2?(o=e[1],a=e[2]):(o=r,a=i),cl(gl,t,Sl).call(t,a,o)}}),t.name="",t.get("async")){var i=Ui(r);return t.set(ol.PROP.formData,null),t.set(ol.PROP.ajax,i),!0}var o=Ui(r);return t.set(ol.PROP.formData,null),o}function _l(){var e,t=this,r=t.get("data");if(hl)if(r instanceof hl)t.set(ol.PROP.formData,r);else{e=new hl;try{Xt.each(r,function(t,r){e.append(r,t)}),t.set(ol.PROP.formData,e)}catch(TH){Xt.log(dl+"something error when reset FormData.")}}else Xt.log(dl+"the browser does not support ajax.")}function yl(e){if(!Xt.isObject(e))return Xt.log(dl+"_addFileData(), file parameter invalid!"),!1;var t=this.get(ol.PROP.formData),r=e.name,n=e.remoteFilename;return n||(n="RemoteFile"),t.append(n,e,r),this.set(ol.PROP.formData,t),e=null,t}function Sl(e,t,r){var n=ol.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 Il(e,t){var r,n,i,o=!1,a=this.name,s=ol.status.SUCCESS,u=ol.event.ERROR,c=t?t.status:0;if(Xt.log("Response from server: "+e),!this.get("bOnlyResponseEmptyIsOK"))return{status:s,msg:!1,json:!1,response:e,name:a,httpStatus:c};if(Xt.isUndefined(e)||""===e)r={status:s,msg:!1,json:!1,response:"",name:a,httpStatus:c};else if(Xt.isString(e)){try{for(n=0;n<e.length&&!(n>10);n++){if("{"==(i=e[n])){o=!0;break}if(" "!=i&&"\r"!=i&&"\n"!=i&&"\t"!=i)break}if(o){var l=Xt.parse(e);r=1==l.status?{status:s,msg:!1,json:l,response:e,name:a,httpStatus:c}:{status:u,msg:!1,json:l,response:e,name:a,httpStatus:c}}}catch(TH){o=!1,Xt.log(TH)}if(!o){var d=String(e);r=""==(d=d.replace(/( |\t|\r|\n)/g,""))?{status:s,msg:!1,json:!1,response:e,name:a,httpStatus:c}:{status:u,msg:!1,json:!1,response:e,name:a,httpStatus:c}}}else r={status:s,msg:!1,json:!1,response:"",name:a,httpStatus:c};return r}function bl(e){e&&e instanceof hl&&e.forEach&&e.forEach(function(t,r){r&&e["delete"](r)})}function Tl(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 Cl(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 wl(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")}ol=ml,ul(ml,"event",{SUCCESS:"success",ERROR:"error",PROGRESS:"progress"}),ul(ml,"status",{SUCCESS:"success",ERROR:"error"}),ul(ml,"PROP",{action:"action",data:"data",bChunkedSendData:"bChunkedSendData",ajaxConfig:"ajaxConfig",ajax:"ajax",formData:"formData",CORS:"CORS",bOnlyResponseEmptyIsOK:"bOnlyResponseEmptyIsOK"});var kl=new WeakSet,El=function(e){function t(e){var r;return o(this,t),Tl(r=i(this,t),kl),r._attrs={action:"",retry:0,timeout:0,CORS:li,async:di,dataType:"text",fileStatus:"",data:{},bOnlyResponseEmptyIsOK:di},Xt.mix(r._attrs,e),wl(kl,r,Al).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(Xt.isArray(e))return t=this._uploadType.uploadFilesToServer(e),e=null,t;if(Xt.isObject(e)){var r=e;return r.size?(r.id||(r.id=Xt.guid("file-")),r.size&&(r.textSize=wl(kl,this,xl).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)}}])}(al);function xl(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 Al(){var e=this,t={async:e.get(ll.PROP.async),action:e.get(ll.PROP.action),data:e.get(ll.PROP.data),CORS:e.get(ll.PROP.CORS),bOnlyResponseEmptyIsOK:e.get(ll.PROP.bOnlyResponseEmptyIsOK)};this._uploadType=new ml(t);var r=this._uploadType.get(ml.PROP.ajaxConfig);return r&&(r.dataType=e.get(ll.PROP.dataType),r.async=e.get(ll.PROP.async),r.retry=e.get(ll.PROP.retry)),this._uploadType.on(ml.event.SUCCESS,wl(kl,e,Dl),e),this._uploadType.on(ml.event.ERROR,wl(kl,e,Dl),e),this._uploadType.on(ml.event.PROGRESS,wl(kl,e,Pl),e),this._uploadType}function Pl(e){this.fire(ll.event.PROGRESS,e)}function Dl(e){var t=this,r=e.status,n=e.msg,i=t.get("file");if(Xt.mix(e,{file:i}),"success"===r)t.fire(ll.event.SUCCESS,e);else{if(!1===n||("abort"===n?Xt.mix(e,{canceled:!0}):"timeout"===n&&Xt.mix(e,{timeout:!0})),!n){var o=e.httpStatus;o&&o>=200&&o<300&&(200==o?n="OK":201==o?n="Created":202==o?n="Accepted":203==o?n="Non-Authoritative":204==o?n="No Content":205==o?n="Reset Content":206==o?n="Partial Content":207==o&&(n="Multi-Status"),e.msg=n)}t.fire(ll.event.ERROR,e)}}ll=El,Cl(El,"event",{SUCCESS:"success",ERROR:"error",PROGRESS:"progress"}),Cl(El,"PROP",{action:"action",retry:"retry",timeout:"timeout",CORS:"CORS",async:"async",dataType:"dataType",fileStatus:"fileStatus",data:"data",bOnlyResponseEmptyIsOK:"bOnlyResponseEmptyIsOK"});var Fl={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 Wl(e,t){Qt.detect.bMaskShow=!0,tr.DWT.ScanDirectly||Xt.isFunction(tr.DWT.OnWebTwainPreExecute)&&tr.DWT.OnWebTwainPreExecute(e,t)}function Nl(){Qt.detect.bMaskShow=!1,tr.DWT.ScanDirectly||Xt.isFunction(tr.DWT.OnWebTwainPostExecute)&&tr.DWT.OnWebTwainPostExecute()}function Ol(e){var t=e||{};t.basePath&&(Lo.basePath=t.basePath),t.pathType&&(Lo.pathType=t.pathType),Xt.isUndefined(t.bDiscardBlankImage)||(Lo.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=tr.DWT.RemoteScanConfig;r||(r={sessionTimeout:300,keepAwake:!0},tr.DWT.RemoteScanConfig=r),r.keepAwake===undefined&&(r.keepAwake=!0)}function Rl(){return!!Xt.getWakeLock()}function Ml(e){return Ll.apply(this,arguments)}function Ll(){return(Ll=n(g().mark(function e(t){var r;return g().wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if(r=Xt.getWakeLock(),!t){e.next=7;break}if(null!=r){e.next=5;break}return e.next=5,Xt.toggleWakeLock();case 5:e.next=10;break;case 7:if(!r){e.next=10;break}return e.next=10,Xt.toggleWakeLock();case 10:case"end":return e.stop()}},e)}))).apply(this,arguments)}function Bl(e){return e&&!Xt.isString(e)?di:li}function Ul(e){return Vl.apply(this,arguments)}function Vl(){return(Vl=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("',Gl(),"/src/dynamsoft.webtwain.viewer.css",Qt.timestamp,'")'].join(""),t.appendChild(r));case 1:case"end":return e.stop()}},e)}))).apply(this,arguments)}function jl(e,t){var r;for(r=0;r<e.length;r++)if(e[r]==t)return!0;return!1}function Gl(){return Jo()}var Hl=function(){return s(function e(t){o(this,e),this._funIsLoading=t,this._resolveJSLoads=[],this._bFirstWaitForLoaded=!0},[{key:"_loopForCheckingJSLoaded",value:function(){var e=this;e._funIsLoading()?setTimeout(function(){e._loopForCheckingJSLoaded()},100):(Xt.each(this._resolveJSLoads,function(e){e()}),this._resolveJSLoads=[])}},{key:"asyncWaitingJSLoaded",value:function(){var e=this;return new Qt.Promise(function(t){e._funIsLoading()?(e._resolveJSLoads.push(t),e._bFirstWaitForLoaded&&(e._bFirstWaitForLoaded=!1,setTimeout(function(){e._loopForCheckingJSLoaded()},100))):t()})}}])}(),zl=function(){return s(function e(){o(this,e),this.queue=[],this.doNextStarted=!1,this.timer=null},[{key:"stop",value:function(){clearTimeout(this.timer),this.timer=null,this.doNextStarted=!1,this.queue=[]}},{key:"start",value:function(){var e=this;this.doNextStarted||(this.doNextStarted=!0,this.timer=setTimeout(function(){e.doNext()},0))}},{key:"pushToDo",value:function(e,t,r){return this.queue.push({obj:e,method:t,args:r}),!0}},{key:"doNext",value:function(){var e=this;if(this.doNextStarted)if(0!=this.queue.length){var t=this.queue[0],r=t.obj,n=t.method,i=t.args;if(this.queue.splice(0,1),r&&Xt.isFunction(r[n])){var o=!1;if(i.length>2){var a=i[i.length-2],s=i[i.length-1];Xt.isFunction(a)&&Xt.isFunction(s)&&(i[i.length-2]=function(){try{a.apply(r,arguments)}catch(TH){}e.timer=setTimeout(function(){e.doNext()},0)},i[i.length-1]=function(){try{s.apply(r,arguments)}catch(TH){}e.timer=setTimeout(function(){e.doNext()},0)},o=!0)}try{r[n].apply(r,i)}catch(u){}o||(e.timer=setTimeout(function(){e.doNext()},0))}else if(null===r&&Xt.isFunction(n)){try{n.apply(null,i)}catch(c){}this.timer=setTimeout(function(){e.doNext()},0)}else this.timer=setTimeout(function(){e.doNext()},0)}else this.stop();else this.stop()}}])}(),Kl=new zl,Jl={getImageUrl:function(e,t,r,n,i){var o,a=[e];if(Xt.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),Lo.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){Xt.debug&&Xt.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=Gl()+"/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(),Xt.log("print image...ok")}:Xt.log("cannot find image"))}};Qt.html5.Funs2=Jl;var Ql=Xt.isString,ql=Xt.isArray,Yl=Xt.each;function Xl(e,t){if(Ql(t))e.push('"'),e.push(t),e.push('"');else if(ql(t)){var r=di;e.push("["),Yl(t,function(t){r?r=li:e.push(","),Xl(e,t)}),e.push("]")}else t===undefined?e.push('""'):e.push(t)}function Zl(){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("["),Xl(e,i),e.push("]")}else if(2===r.length){var o=r[0],a=r[1];e.push("["),Xl(e,o),e.push(","),Xl(e,a),e.push("]")}else Xl(e,Array.prototype.slice.call(r));return e.join("")}function $l(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 ed=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}(ed||{}),td=ed.TWAINSCANNER|ed.WIASCANNER|ed.TWAINX64SCANNER|ed.ICASCANNER|ed.SANESCANNER|ed.ESCLSCANNER|ed.WIFIDIRECTSCANNER|ed.WIATWAINSCANNER,rd=ed.TWAINSCANNER|ed.WIASCANNER|ed.TWAINX64SCANNER|ed.ICASCANNER|ed.SANESCANNER,nd=ed.TWAINSCANNER|ed.WIATWAINSCANNER|ed.TWAINX64SCANNER|ed.ICASCANNER|ed.SANESCANNER;ed.TWAINSCANNER,ed.WIASCANNER,ed.WIATWAINSCANNER;var id=ed.ESCLSCANNER|ed.WIFIDIRECTSCANNER,od=ed.TWAINSCANNER|ed.WIATWAINSCANNER,ad=1;function sd(){return(++ad).toString()}function ud(){return["dwt_",Xt.getRandom()].join("")}var cd=0;function ld(e,t,r){if(Xt.log("showMask:"+e+"--"+cd),0==cd)if(t){Wl(t);var n=Qt.mask.dlgMask;if(n){n.style.zIndex="10000";var i=Xt.sizzle(".dynamsoft-backdrop",n.parentNode);i&&i.length>0&&(i[0].style.zIndex="10000")}}else Wl(r||{});cd++}function dd(e){Xt.log("hideMask:"+e+"--"+cd),cd>1?cd--:cd<=1&&(Nl(),cd=0)}var fd=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==tr.DWT.EnumInstance.dwt_desktop?(this.m_deploymentType="desktop",this.m_server=r):t==tr.DWT.EnumInstance.dwt_browser?(this.m_deploymentType="browser",this.m_server=r):t==tr.DWT.EnumInstance.dbr&&(this.m_deploymentType="browser",this.m_server="")},[{key:"clearData",value:function(){this.m_iUsingTime=0,this.m_jvUsingTime=Xt.nil,this.m_countMap={},this.m_newConsum=!1,this.m_mapSavedToDb=!1,this.m_minExpiredTime=Xt.nil,this.m_maxExpiredTime=Xt.nil,this.m_cu=Xt.nil,this.m_ar=Xt.nil,this.m_ltsInstance=Xt.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 hd=tr.DWT;hd.LTS=hd.LTS||{},hd.licenseException={code:0,message:"",fromLTS:!1},hd.bLTSOnline=!0,hd.axInstance=undefined,hd.lOnUpdateDWObj=[],hd.EnumInstance={dwt_desktop:0,dwt_browser:1,dbr:2};var gd,md=0,pd={},vd=!1,_d=!1,yd=!1,Sd=!1,Id=!1;function bd(){var e=Qo.handshakeCode;return Xt.isString(e)||(e=""),e}function Td(){var e=Qo.organizationID;return Xt.isNumber(e)?e=""+e:Xt.isString(e)||(e=""),e}function Cd(){return Xt.replaceAll(Io.JSVersion,",",".")}function wd(e,t){var r=e;return r===Xt.nil&&(r=tr.DWT.lgdt()),r==hd.EnumInstance.dbr?(hd._dbrLicense||(hd._dbrLicense=new fd(r,"")),hd._dbrLicense):(hd._dwtDLicense||(hd._dwtDLicense=new fd(r,"")),hd._dwtDLicense)}hd.lupverfy=function(){wd(hd.lgdt()).get_ltsInstance(xd),wd(hd.EnumInstance.dbr).get_ltsInstance(xd)};var kd=hd.EnumInstance.dwt_desktop;hd.lsdt=function(e,t){kd=e},hd.lgdt=function(e){return kd},hd.lsmid=function(e,t){wd(hd.lgdt()).set_cu(e)},hd.lsar=function(e,t){wd(hd.lgdt()).set_ar(e)},hd.lsmid2b=function(e){wd(hd.lgdt("")).set_cu(e)},hd.lgar=function(e,t){return wd(e).get_ar()},hd.laddDWTObj=function(e){var t=!1;Xt.each(hd.lOnUpdateDWObj,function(r){if(r==e)return t=!0,!1}),t||hd.lOnUpdateDWObj.push(e)},hd.lremoveDWTObj=function(e){Xt.each(hd.lOnUpdateDWObj,function(t,r){if(t==e)return hd.lOnUpdateDWObj.splice(r,1),!1})},hd.lsendUpdateEvt=function(e,t){var r=[];if(Xt.each(hd.lOnUpdateDWObj,function(t){e==hd.EnumInstance.dwt_desktop&&r.push(t)}),0==r.length)return Qt.Promise.resolve();var n,i=r[0];return i._bAx?(Xt.each(r,function(t){t.SetLTSInfo(wd(e).get_ar(),wd(e).get_cu())}),i.GetLicenseInfo().then(function(r){r&&Xt.isArray(r.Detail)&&r.Detail.length>0&&hd.lsexp(e,r.Detail[0].ExpireDate,t)})):(n=i.SetLTSLicenseAsync(wd(e).get_ar()).then(function(r){r&&Xt.isArray(r.Detail)&&r.Detail.length>0&&hd.lsexp(e,r.Detail[0].ExpireDate,t)}),Xt.each(r,function(t,r){0!=r&&t.SetLTSLicenseAsync(wd(e).get_ar())}),n)},hd.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"):Lo.bMobile?e.push("Mobile OS"):tr.navInfo.bEmbed&&e.push("Embed OS"),e.join(" ")};var Ed={NetworkError:-2440,Timedout:-2441,JsonError:-2442,CorsError:-2443,Expired:-2445,LtsJsLoadError:-2446,UUIDError:-2447};function xd(e){var t,r,n=Qo.licenseServer;if(n&&n.length>0)for(t=0;t<n.length;t++)r=n[t],Xt.endsWith(r,"/")||(n[t]=r+"/");var i=wd(e),o={bd:Qt.ltsDebug,dm:location.origin?Xt.startsWith(location.origin,"http")?location.origin:"https://localhost":Xt.startsWith(location.href,"http")?location.href:"https://localhost",hs:Qt.product.handshakeCode||"",pd:hd.lgpd(e),vm:Ji,dt:i.get_enumDeploymentType(),btoa:Xt.btoa,atob:Xt.atob,fol:hd.OnFirstOffline,sutlcb:function(){Xt.isFunction(hd.lonsend)&&hd.lonsend()},lf:Qt.localforage,updl:function(t){i.set_ar(t.ar),i.get_cu()||i.set_cu(t.cu),hd.lsendUpdateEvt(e,"")},mnet:function(){return i.get_maxExpiredTime()},mxet:function(){return i.get_minExpiredTime()},dwt:!0};if(e==hd.EnumInstance.dwt_browser||e==hd.EnumInstance.dbr?o.feab=hd.lfeab_wasm:o.feab=hd.lfeab_ax,!de.bIE&&Qo.ltsDebug&&(o.log=console.log),tr.LTS&&tr.LTS._)return tr.LTS._.createLtsInstance(o);var a={},s=function(){return Qt.Promise.reject({code:Ed.LtsJsLoadError,message:"The dynamsoft.lts.js load failed."})};return a.i=s,a.s=s,a.u=s,a.caret=s,a}hd.lgpd=function(e){return e==hd.EnumInstance.dwt_desktop?"dwt|dbr|ddv":"dwt|ddv"};var Ad=!1;function Pd(e,t){return Dd.apply(this,arguments)}function Dd(){return Dd=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=wd(t),a=o.get_enumDeploymentType(),hd.lclex(),!o.get_ar()||!o.get_cu()){e.next=10;break}if(Ad){e.next=9;break}return i=o.get_ltsInstance(xd),e.next=8,i.ih();case 8:Ad=!0;case 9:return e.abrupt("return",Qt.Promise.resolve({ar:o.get_ar(),cu:o.get_cu()}));case 10:if((s={pd:hd.lgpd(t),v:Cd(),os:hd.lgcb(),fn:hd.DeviceFriendlyName||"",ls:Qo.licenseServer,sp:Qo.sessionPassword,l:Zc.getLTSLicense(),mnet:function(){return o.get_maxExpiredTime()},mxet:function(){return o.get_minExpiredTime()},fol:hd.OnFirstOffline}).dt=o.get_deploymentType(),a!=hd.EnumInstance.dwt_desktop){e.next=20;break}if(""!=o.get_cu()){e.next=17;break}return xa(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==hd.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),hd.lsendUpdateEvt(a,n)});case 21:return e.prev=21,i=o.get_ltsInstance(xd),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(),Xt.isString(e.t0)?(d=Nd(e.t0),hd.lsetException(d,e.t0,!0),l=hd.licenseException):(Od(f={},e.t0),l={code:f._errorCode,message:f._errorString}),l;case 36:case"end":return e.stop()}},e,null,[[21,31]])})),Dd.apply(this,arguments)}function Fd(){return Date.now()}function Wd(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=Ed.NetworkError;return e.indexOf("timed out")>-1||e.indexOf("timeout")>-1?t=Ed.Timedout:(e.indexOf("access-control-allow-origin")>-1||e.indexOf("cors")>-1)&&(t=Ed.CorsError),t}function Od(e,t){if(t){var r=t.code||t.ltsErrorCode,n=t.message;111==r||106==r||108==r?(Na(e,r),e._errorString=n):(e._errorCode=r,e._errorString=n),tr.DWT.lsetException(e._errorCode,e._errorString,!0)}}function Rd(e,t){e.__licenseInfo=t,function(e){e.__calic||(e.__calic=e.__licenseInfo)}(e)}function Md(e){var t=tr.DWT.licenseException;t.code=e.code,t.message=e.message,e&&(Ld(e),e instanceof Error?Xt.error(e):Xt.error(Xt.stringify(e)))}function Ld(e){Xt.isFunction(tr.DWT.OnWebTwainError)?tr.DWT.OnWebTwainError(e):Xt.isFunction(window.Dynamsoft_OnError)&&window.Dynamsoft_OnError(e)}function Bd(e){return e==ia.LicenseExpiredForDLS||e==ia.LicenseNoCoreForDLS||e==ia.LicenseNoCore||e==ia.LicenseInvalid||e==ia.LicenseExpired||e==ia.LicenseParseFailed||e==ia.LicenseIsFuture||e==ia.LicenseVersionNotCurrent}function Ud(e){return e==ia.LicenseExpired}function Vd(e){var t=0,r=e.message;Xt.isNumber(e.code)?t=e.code:Xt.isString(r)&&(t=-1),0!=t&&function(e,t){Xt.isFunction(tr.OnLicenseError)&&tr.OnLicenseError(t,e)}(t,r)}function jd(e){Vd(fu(e))}hd.lglic=Pd,hd.lgbuuid=function(){return""},hd.lshow=function(){return{t:gd,t2:md,m:Xt.stringify(pd)}},hd.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""},hd.lcvrf=function(e){e&&(e._canConsume&&!e._canConsume()||setTimeout(function(){hd.lcvrf_(e)},1))},hd.lcvrf_=function(e){var t;t=hd.lgdt();var r,n=hd.DeviceFriendlyName||"",i=hd.lgcb(),o=wd(t),a={hs:bd(),og:Td(),cu:o.get_cu(),fn:n,cw:"",os:i,v:Cd(),dt:o.get_deploymentType(),ed:"js"},s=function(e,t){var r,n,i=0;if(Xt.isString(e)&&""!=e&&"{}"!=e&&t&&Xt.isArray(t)&&!(t.length<1)){if(n=wd(t[0]),r=Xt.parse(e),hd.lclex(),0==md){var o=Fd(),a="";md=o,gd=Wd(o),pd={},i=0,Xt.each(r,function(e,t){(t<i||0==i)&&(i=t,a=e)}),i>0&&n.get_ltsInstance(xd).s(Qo.licenseServer,a,i,!0).then(function(){},function(e){})}Xt.each(r,function(e,t){var r=!1,o=parseInt(t);o>0&&o!=i&&(o+18e4<Fd()&&(r=!0),n.get_ltsInstance(xd).s(Qo.licenseServer,e,t,r).then(function(){},function(e){}))})}};if(a.pd=hd.lgpd(t),r=Xt.stringify(a),!e._bAx){var u="GetBuffer",c=Zl(Xt.replaceAll(r,'"','\\"')),l={cmd:u,cmdId:sd(),sFun:s,fFun:function(){},params:[t]};return e._innerSendByWS(u,c,l,null,!0)}s(e.GetBuffer(r),[t,""])},hd.lavrf=function(e,t,r,n){var i=1;if(""!=e){t>1&&(i=t);var o=Fd();if(md>0&&md+18e4<o){_d?(pd={},hd.lavrf__unload()):hd.lavrf__(!0,r,n);var a=Fd()+1;md=a,gd=Wd(a),pd={}}vd=!0,_d=!1,pd[e]?pd[e]+=i:pd[e]=i,0==md&&hd.lavrf__(!0,r,n)}},hd.lavrf_=function(e,t,r){if(vd){var n=1;e&&(n=e),setTimeout(function(){hd.lavrf__(!1,t,r)},n)}},hd.lavrf__=function(e,t,r){var n,i,o,a=Fd(),s=!1,u=!!e,c=0,l=t;Xt.isUndefined(l)&&(l=hd.lgdt()),o=wd(l),vd=!1,0==md&&(s=!0,md=a,gd=Wd(a)),n=md,i=gd;var d={};d.ut=i;var f={};if(Xt.each(pd,function(e,t){f[t]=e,e>0&&c++}),d.cts=f,u||n+18e4<a){u=!0;var h=Fd()+1;if(md=h,gd=Wd(h),pd={},_d=!1,0==c)return}else{if(0==c)return;_d=!0}d.dur=s?1:180;var g,m=hd.DeviceFriendlyName||"",p=hd.lgcb(),v={hs:bd(),og:Td(),cu:o.get_cu(),fn:m,cw:"",os:p,v:Cd(),dt:o.get_deploymentType(),ed:"js",rcs:[d]};v.product=hd.lgpd(t),g=Xt.stringify(v),Qo.ltsDebug&&Wd(),hd.lclex(),o.get_ltsInstance(xd).s(Qo.licenseServer,g,""+n,u).then(function(){},function(e){})},hd.lavrf__unload=n(g().mark(function XQ(){var e,t,r,n,i,o,a;return g().wrap(function(s){for(;;)switch(s.prev=s.next){case 0:if(e=Fd(),t=!0,n=!1,i=wd(hd.lgdt()),o=wd(hd.EnumInstance.dbr),vd=!1,0==md&&(md=e,gd=Wd(e)),r=md,a=Fd()+1,md=a,gd=Wd(a),pd={},_d=!1,r+=1,hd.lclex(),!i.inited_ltsInstance()){s.next=20;break}return s.prev=13,s.next=16,i.get_ltsInstance(xd).s(Qo.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(xd).s(Qo.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()}},XQ,null,[[13,18],[21,26]])})),hd.lclex=function(){var e=hd.licenseException;e.code=0,e.message="",e.httpResponse="",e.fromLTS=!1},hd.li=function(e,t){var r;if(e.axInstance&&(hd.axInstance=e.axInstance,hd.axInstance))return r=hd.axInstance.GetUUID(),Qo.ltsDebug&&Xt.log("ActiveX cu: "+r),wd(e.instanceMode).set_cu(r),r;return wd(e.instanceMode).get_cu()},hd.lfeab_ax=function(e){return new Qt.Promise(function(t,r){var n="";if(hd.axInstance)try{n=hd.axInstance.Encrypt(e,0)}catch(kH){}t(n)})},hd.lfeab_wasm=function(e){return Qt.Promise.resolve("")},hd.lwsproc=function(e,t){"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)},hd.lsexp=function(e,t,r){var n,i=t;if(3==(n=(i=Xt.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("");wd(e).set_minExpiredTime(u),wd(e).set_maxExpiredTime(u)},hd.lunload=n(g().mark(function ZQ(){return g().wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,hd.lavrf__unload();case 2:md=0,gd=Xt.nil,pd={},_d=!1,vd=!1,yd=!1,Sd=!1,Id=!1,hd.lclex(),hd.bLTSOnline=!0,hd.axInstance=Xt.nil,hd.lOnUpdateDWObj=[];case 14:case"end":return e.stop()}},ZQ)})),hd.lcexp=function(e,t){return wd(e).get_ltsInstance(xd).caret().then(function(){return!1},function(e){var t=hd.licenseException,r="";return e instanceof Error||"message"in e?r=e.message:Xt.isString(e)&&(r=e),hd.lsetException(Ed.Expired,r,!1),Sd||(Sd=!0,Xt.error(r),tr.OnLTSLicenseError&&tr.OnLTSLicenseError(Zc.getPublicLicenseContent(t.message),t.code)),!0})},hd.OnLicenseException=function(){var e=hd.licenseException,t=e.message;if(Xt.isString(t)&&(t.indexOf("Error Code")>-1?t=Xt.replaceAll(t,"Error Code","error code"):t.indexOf("Error code")>-1&&(t=Xt.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=Xt.replaceAll(r,"error code:",""),n=Xt.replaceAll(n,"message: ",""),hd.lsetException(parseInt(r),n,!0),Xt.error(n),tr.OnLTSLicenseError&&tr.OnLTSLicenseError(Zc.getPublicLicenseContent(t),e.code)}else{if(!e.code){var i=Nd(t);hd.lsetException(i,t,!0)}if(Xt.error(e.message),e.code==Ed.LtsJsLoadError)return;tr.OnLTSLicenseError&&tr.OnLTSLicenseError(Zc.getPublicLicenseContent(e.message),e.code)}},hd.lol=function(){return hd.bLTSOnline},hd.OnFirstOffline=function(e){hd.bLTSOnline=!1},hd.lpubdlg=function(e,t){if(Xt.isString(e)&&""!=e){if(e=Xt.atob(e),console&&console.warn&&!yd&&Qo.bUseDynamsoftLicenseManager,1==t)return yd||Qo.bUseDynamsoftLicenseManager||(yd=!0,tr.OnLTSPublicLicenseWarning&&tr.OnLTSPublicLicenseWarning(Zc.getPublicLicenseContent(e))),!0;2==t&&(yd||(yd=!0))}return!1},hd.lcheckLic=function(e,t,r){var n=!1;if(t){if(Xt.isArray(t.Detail)&&t.Detail.length>0){var i=t.Detail[0].ExpireDate;return hd.lsexp(e,i,r),hd.lcexp(e,r).then(function(e){var r=!1;e?r=!0:1!=t.Trial&&2!=t.Trial||(r=hd.lpubdlg(t.Message,t.Trial)),r||hd.bLTSOnline||Id||(Id=!0,tr.OnLTSConnectionWarning&&tr.OnLTSConnectionWarning())})}1!=t.Trial&&2!=t.Trial||(n=hd.lpubdlg(t.Message,t.Trial))}return n||hd.bLTSOnline||Id||(Id=!0,tr.OnLTSConnectionWarning&&tr.OnLTSConnectionWarning()),Qt.Promise.resolve()},hd.lisValidID=function(e){if(Xt.isString(e)&&""!=e)return!0;var t,r=hd.licenseException;return hd.lsetException(Ed.UUIDError,"Failed to generate an ID for your device to license it: not enough permission.",!0),Xt.error(r.message),t=r.message,tr.OnLTSLicenseError&&tr.OnLTSLicenseError(t,r.code),!1},hd.lsetException=function(e,t,r){var n=hd.licenseException;n.code=e,n.message=t,r?n.fromLTS=!0:r in n&&delete n.fromLTS},hd.lgcuid=function(e){var t=tr.DWT.li({instanceMode:e},"");return t?Qt.Promise.resolve(t):wd(e).get_ltsInstance(xd).u().then(function(e){return tr.DWT.lsmid(e,""),tr.DWT.lsmid2b(e),e})},hd.lts_unload=function(){tr.DWT._dbrLicense.clearData(),tr.DWT._dbrLicense=null,tr.DWT._dwtDLicense.clearData(),tr.DWT._dwtDLicense=null};var Gd=s(function $Q(){o(this,$Q)});function Hd(e){var t=new Gd;return t.server=e.server,t.normal=!0,e.attrs&&(t.attrs=Xt.clone(e.attrs)),t}var zd=function(e){return e.CONNECTING=0,e.OPEN=1,e.CLOSING=2,e.CLOSED=3,e}({});function Kd(e,t,r){if(Xt.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){Xt.log(n),r&&r()}n=null,e=null}}function Jd(e,t){e&&e.readyState!=zd.CLOSING&&e.readyState!=zd.CLOSED?e.readyState==zd.CONNECTING?(e.onerror=function(t){t&&Xt.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==zd.OPEN?(e.onopen=null,e.send(t)):e.readyState==zd.CONNECTING&&(e.onopen?setTimeout(e.onopen,100):e._reject&&(e._reject(),e._reject=null))}):e.readyState==zd.OPEN&&(e.onopen=null,e.send(t)):e._reject&&(e._reject({closed:!0}),e._reject=null)}function Qd(e,t,r,n){var i,o=n;return o||(tr.DWT.ConnectWithSocket?Xt.startsWith(e,"wss://")||Xt.startsWith(e,"ws://")||(o=r?"wss://":"ws://"):Xt.startsWith(e,"https://")||Xt.startsWith(e,"http://")||(o=r?"https://":"http://")),t?(Xt.endsWith(e,"/")&&(e=e.substring(0,e.length-1)),i=":"+t+"/"):Xt.endsWith(e,"/")||(i="/"),[o,e,i].join("")}var qd=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){Kd(t,function(t){r(t),e.close(),e=null},function(){n(),e.close(),e=null})},e._reject=n,Jd(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){Kd(e,function(e){n(e),o.close(),o=null},function(e){i(e),o.close(),o=null})},o._reject=i,Jd(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){Kd(e,function(e){n(e),o.close(),o=null},function(e){i(e),o.close(),o=null})},o._reject=i,Jd(o,r)})}),n}},{key:"newWebsocket",value:function(e,t){var r,n=Ho.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=Zo(e)),Qd(e,t,n,n?"wss://":"ws://")}},{key:"getDDMUrl",value:function(e,t,r){var n,i,o="/";return Xt.startsWith(e,"https://")?n=!0:Xt.startsWith(e,"http://")?n=!1:e=(n=$o())?"https://"+e:"http://"+e,i=n?tr.dcp.SSLPort+"/":tr.dcp.Port+"/",Xt.endsWith(e,"/")&&(o=""),t?[e,o,"ddm/",i,r].join(""):[e,o,r].join("")}},{key:"getModuleUrl",value:function(e){var t,r=To(),n=Zo(r);return t=Qd(r,n?Ho.SSLPort:Ho.Port,n),e?t+e:t}},{key:"getModuleUrlForRemoteScan",value:function(e){var t,r=de.bSSL;return t=Qd(To(),r?Ho.SSLPort:Ho.Port,r),e?t+e:t}}])}();tr.DWT.NetManager=qd;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}({}),Xd=function(){return s(function r(e){o(this,r);var t=this;if(t._id=e.id,t._clientId=Xt.getRandom(),t._uuidForActiveUI=null,t._bReady=li,t._destroy=li,t._bMustUpgradeService=li,t._wsClient=null,t._wsRetry=0,t._wsFailedTimes=0,t._bConnecting=li,t._bNoMask=li,t._bNotShowMessage=li,t.__serverPlatform=hc.enumWindow,t.__productKey="",t.__licenseInfo=null,t._reconnectTimeSpan=qo.RemoteReconnectTimeSpan,t._reconnectShortSpan=300,t._reconnectShortSpanTimes=5,t._bIfShowProgressBar=di,t.__IfShowCancelDialogWhenImageTransfer=di,t._bLicenseErrorDispose=!0,t.__bServerOnPostLoadFired=!1,e.dmService){var n,i,a,s,u,c,l=Hd(e.dmService),d="/",f="";i=l.server;var h=new yi(e.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=Xt.replaceAll(i,"wss://","")):"ws"==g?(n=!1,a=i,i=Xt.replaceAll(i,"ws://","")):(a=i,i=(n=$o())?"https://"+i:"http://"+i),ta(h.hostname||h.scheme)?t._bRemoteMode=li:t._bRemoteMode=di,Xt.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]),Xt.endsWith(u,"/")&&(d=""),f=[s,"/",u,"/"].join(""),_>=12&&(t._dmServiceDWTVersion=m.modules[11])}}else m={UUID:"",service_type:Yd.ST_DYNAMSOFT_SERVICE};c=[i,d,f].join(""),m.url=c,t._serverInfo=new au([a,d,f].join(""),null,n,!0,Ho.wsProtocol),t._httpUrl=c,t._dmService=l}else{var S,I=$o(),b=e.port,T=e.sslPort;ta(S=e.host?e.host:To())?t._bRemoteMode=!1:t._bRemoteMode=!0,b||(b=tr.DWT.Port),T||(T=tr.DWT.SSLPort),t._serverInfo=new au(S,I?T:b,I,!0,Ho.wsProtocol),t._httpUrl=function(e){var t=e.server;if(t){if(Xt.startsWith(t,"wss://")||Xt.startsWith(t,"ws://"))return t}else t=To();return e.ssl?["https://",t,":",e.port,"/"].join(""):["http://",t,":",e.port,"/"].join("")}(t._serverInfo),t._dmService={server:t._httpUrl,attrs:{url:t._httpUrl,UUID:"",service_type:Yd.ST_DYNAMSOFT_SERVICE},normal:!0}}t._dmServiceDWTVersion||(t._dmServiceDWTVersion=[Qo.getDWTPrefix(),Qo.getServerVersionInfo()].join(""))},[{key:"_resetErr",value:function(){var e=this;e._errorCode=0,e._errorString="",e._errorCause=null,e.__bServerOnPostLoadFired=!1;var t=tr.DWT.licenseException;t.code=0,t.message=""}},{key:"dispose",value:(t=n(g().mark(function i(){return g().wrap(function(e){for(;;)switch(e.prev=e.next){case 0:this.__unload();case 1:case"end":return e.stop()}},i,this)})),function(){return t.apply(this,arguments)})},{key:"__unload",value:(e=n(g().mark(function a(){return g().wrap(function(e){for(;;)switch(e.prev=e.next){case 0:this._bReady=li,this._destroy=di;case 2:case"end":return e.stop()}},a,this)})),function(){return e.apply(this,arguments)})},{key:"isDestroy",get:function(){return this._destroy}}]);var e,t}(),Zd=s(function eq(){o(this,eq)});function $d(e,t){var r,n=[],i=t;if(Xt.isString(i)&&(i=Xt.parse(i)),Xt.isArray(i))for(r=0;r<i.length;r++){var o=nf(i[r]);n.push(o)}for(r=0;r<n.length;r++){var a=n[r],s=a.deviceType;a.name&&(a.name=Xt.base64.decode(a.name)),s&td&&a.deviceInfo&&rf(a.deviceInfo),a.serviceInfo=null==e?void 0:e._dmService,tf(a,null==e?void 0:e._dmService),Xt.isBoolean(a.isSystemDefaultPrinter)||(a.isSystemDefaultPrinter=!1)}return n}function ef(e,t){return function(e,t){var r=t.deviceType;t.name&&(t.name=Xt.base64.decode(t.name));r&td&&t.deviceInfo&&rf(t.deviceInfo);t.serviceInfo=null==e?void 0:e._dmService,tf(t,null==e?void 0:e._dmService),Xt.isBoolean(t.isSystemDefaultPrinter)||(t.isSystemDefaultPrinter=!1);return t}(e,Xt.parse(t))}function tf(e,t){var r,n=e.name,i="",o=e.deviceType;o==ed.TWAINSCANNER?r="":o==ed.TWAINX64SCANNER?r="Twain64-":o==ed.WIASCANNER?r="WIA-":o==ed.WIATWAINSCANNER?(n=Xt.replaceAll(n,"WIA-",""),r="WIATWAIN-"):r=o==ed.ICASCANNER?"ICA-":o==ed.SANESCANNER?"Sane-":o==ed.ESCLSCANNER?"eSCL-":(ed.WIFIDIRECTSCANNER,""),t&&t.attrs&&t.attrs.ty&&(i=" on ["+t.attrs.ty+"]"),e.displayName=[r,n,i].join("")}function rf(e){if(e.ProductName){var t=e.ProductName;e.ProductName=Xt.base64.decode(t)}if(e.ProductFamily){var r=e.ProductFamily;e.ProductFamily=Xt.base64.decode(r)}if(e.Manufacturer){var n=e.Manufacturer;e.Manufacturer=Xt.base64.decode(n)}if(e.Version&&e.Version.Info){var i=e.Version.Info;e.Version.Info=Xt.base64.decode(i)}}function nf(e){var t=new Zd;return t.strDevice=Xt.stringify(e),e.deviceInfo&&(t.deviceInfo=Xt.clone(e.deviceInfo)),e.deviceType&&(t.deviceType=Xt.clone(e.deviceType)),e.displayName&&(t.displayName=Xt.clone(e.displayName)),e.name&&(t.name=Xt.clone(e.name)),e.serviceInfo&&(t.serviceInfo=Hd(e.serviceInfo)),Xt.isBoolean(e.isSystemDefaultPrinter)?t.isSystemDefaultPrinter=e.isSystemDefaultPrinter:t.isSystemDefaultPrinter=!1,t}Qt.removeNonPrintableChar;var of=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}({}),af=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}({}),sf=function(e){return e.RGBA=15,e.Auto=16,e}({});function uf(e){var t="application/octet-stream";switch(e){case af.IT_BMP:t="image/bmp";break;case af.IT_JPG:t="image/jpeg";break;case af.IT_TIF:t="image/tiff";break;case af.IT_PNG:t="image/png";break;case af.IT_PDF:t="application/pdf";break;case af.IT_J2K:t="image/jp2"}return t}var cf={isSupportLS:function(){var e=!1;if(de.bEdge&&de.bFileSystem);else try{e=!!window.localStorage}catch(TH){}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)}},lf=!0,df=!1;function ff(e){if(Xt.isUndefined(e))return df;var t,r,n,i=e.toString().toLowerCase(),o=(n=i.toLowerCase().replace(Qo.name.toLowerCase()+" ",""),(n=Xt.replaceAll(n,"[.]",",")).split(","));t=Qo.bActiveXEdition?Io.ActiveXVersion:Qo.getServerVersionInfo(!0),r=(t=Xt.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 df;if(parseInt(o[s])>parseInt(r[s]))return lf}return lf}function hf(e,t){var r=e.split(","),n=t.split(",");return r.length>1&&Xt.trim(r[0])==n[0]}function gf(e,t){var r=e.split(","),n=t.split(",");return r.length>3&&Xt.trim(r[0])==n[0]&&(Xt.trim(r[1])>n[1]||Xt.trim(r[1])==n[1]&&Xt.trim(r[2])>n[2]||Xt.trim(r[1])==n[1]&&Xt.trim(r[2])==n[2]&&parseInt(Xt.trim(r[3]))>=parseInt(n[3]))}function mf(e,t){var r=$o();Qt.detect.urls.splice(0),Qt.detect.urls.push({port:r?t:e,ssl:r}),Qt.detect.ports=[{port:r?t:e,ssl:r}],Qt.detect.cUrlIndex=0,Ho.detect.dwtPort=e,Ho.detect.dwtSSLPort=t,tr.DWT.Port=e,tr.DWT.SSLPort=t}function pf(e,t,r){return vf.apply(this,arguments)}function vf(){return(vf=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(!Qo.bDCPChecked){e.next=2;break}return e.abrupt("return",{host:t,port:tr.DWT.Port,sslPort:tr.DWT.SSLPort});case 2:return fc("Initializing the service..."),e.prev=3,e.next=6,bf(t);case 6:i=e.sent,e.next=13;break;case 9:throw e.prev=9,e.t0=e["catch"](3),Xt.log(e.t0),Bs();case 13:if(!Ho.bEnhancedMode){e.next=29;break}if(fc("Checking the service enhanced module..."),o=Qt.install._dlgInstall,a=500,o||(a=0),"true"==o.getAttribute("opened")||(a=0),!(i.port<=0||i.sslPort<=0)){e.next=27;break}if(!(a>0)){e.next=23;break}return e.next=23,new Qt.Promise(function(e,t){setTimeout(function(){e()},a)});case 23:return fc(_c),e.next=26,_f(t);case 26:i=e.sent;case 27:e.next=30;break;case 29:i={host:t,port:r,sslPort:n};case 30:return Qo.bDCPChecked=!0,e.abrupt("return",i);case 32:case"end":return e.stop()}},e,null,[[3,9]])}))).apply(this,arguments)}function _f(e){return yf.apply(this,arguments)}function yf(){return yf=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),fc(_c),e.prev=6,e.next=9,Sf(t);case 9:o=e.sent,e.next=14;break;case 12:e.prev=12,e.t0=e["catch"](6);case 14:if(!(Xt.isNumber(o.port)&&o.port>0&&Xt.isNumber(o.sslPort)&&o.sslPort>0)){e.next=17;break}return mf(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,Bs();case 25:case"end":return e.stop()}},e,null,[[6,12]])})),yf.apply(this,arguments)}function Sf(e){return If.apply(this,arguments)}function If(){return If=n(g().mark(function e(t){var r,n,i,o,a,s,u,c,l,d;return g().wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return r=$o(),n=Qo.refProductKey,Xt.startsWith(t,"wss://")||Xt.startsWith(t,"ws://")?o=t:(a=r?Ho.SSLPort:Ho.Port,o=qd.getWsUrl(t,a,r)),s={id:Xt.guid(),method:"GetPorts",version:"dwasm2_"+go(),parameter:[Ho.strSID]},Zc.isLongKey(n)&&(s.productKey=n),e.next=7,qd.postStringDataByWSUrl(o,Xt.stringify(s));case 7:if(u=e.sent,!Xt.isString(u)){e.next=20;break}if(e.prev=9,(c=Xt.parse(u))&&"result"in c&&(i=c.result),!(Xt.isArray(i)&&i.length>1&&i[1])){e.next=16;break}if(!(l=i[1]).dwt){e.next=16;break}return e.abrupt("return",{host:t,port:l.dwt.port,sslPort:l.dwt.sslPort});case 16:e.next=20;break;case 18:e.prev=18,e.t0=e["catch"](9);case 20:throw xs(d={}),fu(d);case 23:case"end":return e.stop()}},e,null,[[9,18]])})),If.apply(this,arguments)}function bf(e){return Tf.apply(this,arguments)}function Tf(){return(Tf=n(g().mark(function e(t){var r,n;return g().wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return Ho.detect.bConnected=!1,e.prev=1,e.next=4,Cf(t);case 4:return kf(e.sent),Ho.detect.bConnected=!0,e.abrupt("return",{host:t,port:Ho.detect.dwtPort,sslPort:Ho.detect.dwtSSLPort});case 10:if(e.prev=10,e.t0=e["catch"](1),!e.t0){e.next=21;break}if(r=e.t0.code,!Xt.isNumber(r)){e.next=21;break}if(r!=ua.ResponseDataTypeError&&r!=ua.HTSTError&&r!=ua.CORSError&&r!=ua.CORSErrorFromService&&r!=ua.SSLCertExpired&&r!=ua.SSLCertInvalid){e.next=19;break}throw e.t0;case 19:if(r!=ua.MustUpgrade){e.next=21;break}throw e.t0;case 21:throw Ho.detect.dcpStatus=Ho.detect.EnumDCP_DetectStatus.NotInstalled,tr.dcp._sendStatusEvent(),Es(n={}),{code:n._errorCode,message:n._errorString};case 26:case"end":return e.stop()}},e,null,[[1,10]])}))).apply(this,arguments)}function Cf(e){return wf.apply(this,arguments)}function wf(){return(wf=n(g().mark(function e(t){var r,n,i,o,a,s,u,c,l,d;return g().wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return r=$o(),n=Qo.refProductKey,Xt.startsWith(t,"wss://")||Xt.startsWith(t,"ws://")?o=t:(a=r?Ho.SSLPort:Ho.Port,o=qd.getWsUrl(t,a,r)),s={id:Xt.guid(),method:"VersionInfo",version:"dwasm2_"+qo.getVersionStrForCheck(),parameter:[]},Zc.isLongKey(n)&&(s.productKey=n),e.next=7,qd.postStringDataByWSUrl(o,Xt.stringify(s));case 7:if(u=e.sent,Xt.isString(u))try{(c=Xt.parse(u))&&"result"in c&&(i=c.result)}catch(f){}if(l={},!(Xt.isArray(i)&&i.length>0&&i[0])){e.next=22;break}if(d=i[0],!Xt.isString(d)||""==d){e.next=22;break}if(!hf(d,Qo.getServerVersionInfo(!0))){e.next=19;break}return Ho.detect.dcpStatus=Ho.detect.EnumDCP_DetectStatus.UpdateSkipped,tr.dcp._sendStatusEvent(),e.abrupt("return",i);case 19:throw fc(yc),ga(l),fu(l);case 22:throw xs(l),fu(l);case 24:case"end":return e.stop()}},e)}))).apply(this,arguments)}function kf(e){var t="",r=!1,n=!1,i={};if(e.length>4&&(t=Xt.isString(e[2])?e[2]:"",r=Xt.isString(e[3])&&"true"===e[3],n=Xt.isString(e[4])&&"64"===e[4]),e.length>5&&(i=e[5]),Ho.detect.connectedResult=e,Ho.strSID=t,Ho.bEnhancedMode=r,Ho.b64bit=n,Ho.objEnhancedPorts=i,r&&i){if(i.dcp){var o=i.dcp;Ho.SSLPort=o.sslPort,Ho.Port=o.port}if(i.ddm){var a=i.ddm;if(a){var s=$o();Ho.detect.ddmPort=s?a.sslPort:a.port}else Ho.detect.ddmPort=0}if(tr.DWT.Port=0,tr.DWT.SSLPort=0,i.dwt){var u=i.dwt;u&&u.port>0&&u.sslPort>0&&mf(u.port,u.sslPort)}}}function Ef(){return xf.apply(this,arguments)}function xf(){return(xf=n(g().mark(function e(){return g().wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if(!navigator.permissions||!navigator.permissions.query){e.next=9;break}return e.prev=1,e.next=4,navigator.permissions.query({name:"local-network-access"});case 4:return e.abrupt("return",e.sent);case 7:e.prev=7,e.t0=e["catch"](1);case 9:return e.abrupt("return",{state:"other"});case 10:case"end":return e.stop()}},e,null,[[1,7]])}))).apply(this,arguments)}function Af(e){if(Xt.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}function Pf(){return Df.apply(this,arguments)}function Df(){return(Df=n(g().mark(function e(){return g().wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if(!navigator.permissions||!navigator.permissions.query){e.next=9;break}return e.prev=1,e.next=4,navigator.permissions.query({name:"local-network-access"});case 4:return e.abrupt("return",!0);case 7:e.prev=7,e.t0=e["catch"](1);case 9:return e.abrupt("return",!1);case 10:case"end":return e.stop()}},e,null,[[1,7]])}))).apply(this,arguments)}function Ff(){return Wf.apply(this,arguments)}function Wf(){return Wf=n(g().mark(function e(){var t;return g().wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return t=location.hostname,e.next=3,Pf();case 3:if(e.t1=e.sent,!e.t1){e.next=6;break}e.t1=!Af(t);case 6:if(e.t0=e.t1,!e.t0){e.next=9;break}e.t0=!de.bFileSystem;case 9:return e.abrupt("return",e.t0);case 10:case"end":return e.stop()}},e)})),Wf.apply(this,arguments)}function Nf(){var e=location.hostname;return!(!((de.bChrome||de.bEdge)&&parseInt(de.strBrowserVersion)>=94)||Af(e)||de.bSSL||de.bFileSystem)}function Of(e,t,r,n){return Rf.apply(this,arguments)}function Rf(){return Rf=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!=pu.GET_TASKID){e.next=4;break}return e.abrupt("return",i.taskId);case 4:if(r!=pu.ONMESSAGE_PROCESS_DATA){e.next=8;break}return e.abrupt("return",Xt.parse(t));case 8:if(r!=pu.ONMESSAGE_GET_TASKID){e.next=15;break}if(!t||!t.cmdId){e.next=11;break}return e.abrupt("return",t.cmdId);case 11:if(!i||!i.client){e.next=13;break}return e.abrupt("return",i.client.getRequestTaskId());case 13:e.next=23;break;case 15:if(r!=pu.HANDLE_RAW_MESSAGE){e.next=23;break}if(a=t.rawData,t.jsonData,o=null==i?void 0:i.userData){e.next=21;break}return e.abrupt("return",!1);case 21:return a.indexOf("Version not found")>=0||a.indexOf("Function not found")>=0?Xt.isFunction(o.fFun)&&o.fFun():Xt.isFunction(o.sFun)&&o.sFun(a),e.abrupt("return",a);case 23:case"end":return e.stop()}},e)})),Rf.apply(this,arguments)}function Mf(e){var t,r,n=e.WebTwainId,i=e.Host,o=e.Port,a=e.SSLPort;return r={},Xt.isString(n)&&""!==n?r.id=n:r.id=n=ud(),Xt.isDOM(e.Container)?(t=e.Container,Xt.isString(t.id)&&""!==t.id||(t.id=["dwt_node_",Xt.getRandom()].join("")),r.container=t,r.bNoViewer=!1):r.bNoViewer=!0,r.bNoViewer?(r.width=0,r.height=0):(Xt.isUndefined(e.Width)?t.style.width?r.width=t.style.width:r.width=300:r.width=e.Width,Xt.isUndefined(e.Height)?t.style.height?r.height=t.style.height:r.height=300:r.height=e.Height),r.dmService=e.dmService,Xt.isString(i)&&""!=i||(i=To()),r.host=i,o||(o=tr.DWT.Port),r.port=o,a||(a=tr.DWT.SSLPort),r.sslPort=a,r}tr.DWT.NetManager.checkModuleManager=function(e,t){bf(To()).then(e,t)},tr.DWT.NeedCheckWebTwainBySocket=Nf,tr.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||To(),i=s.port,o=s.ssl}else o=Zo(n=To()),ta(n)&&(o=!(!o||!de.bSafari),n=qo.hostForCheckCert),i=o?tr.DWT.SSLPort:tr.DWT.Port;!function(e,t,r,n){var i,o=Xt.now(),a=o,s={id:o,cmdId:o,method:"VersionInfo",version:[Qo.getDWTPrefix(),qo.getVersionStrForCheck()].join("")},u=Of,c={cmdId:a,cmd:null,sFun:t,fFun:r,rawData:!0},l=Xo();i={client:e,userData:c,taskId:o},e.setRetry(0),e.request(Xt.stringify(s),u,i,l).then(function(t){return e.dispose(),t},function(){Xt.isFunction(n)&&n(),e.dispose()})}(nc.getWsClient(n,i,o,!0),e,t,r)},tr.DWT.IsLocalServiceConnected=function(){return new Qt.Promise(function(e,t){var r,n=To(),i=Zo(n);Xt.each(Qt.detect.ports,function(e){i?e.ssl&&(r=e.port):e.ssl||(r=e.port)}),tr.DWT.CheckConnectToTheService(n,r,i,function(t,r,n){e(!0)},function(){t(!1)})})};var Lf=function(e){return e.Info=1,e.Error=2,e.NotInstalledError=3,e}({});function Bf(e){var t=Date.parse(e+"T00:00:00");return""!=e&&!isNaN(t)&&(!!tr.DWT.CheckCertExpired&&(new Date).getTime()>=t-864e5*tr.DWT.CertificateConfig.UpdateDaysBeforeExpired)}function Uf(e,t,r){if(e){var n=null!=t?t:270,i=null!=r?r:350;n<=0&&(n=270),i<=0&&(i=350),ui.one(e).before(Qt.install._strNonInstallDIV);var o=Xt.get(Qt.install._divDWTNonInstallContainerID);o&&(o.style.width=n,o.style.height=i),Xt.show(Qt.install._divDWTNonInstallContainerID)}}function Vf(e){var t=gc(),r=$o();if(""!=Qt.install._divDWTemessageContainer&&Xt.hide(Qt.install._divDWTemessageContainer),de.bMac)e?Xt.isFunction(tr.OnWebTwainNeedUpgradeCallback)&&tr.OnWebTwainNeedUpgradeCallback(Qo.name,{"default":t},Qo.bHTML5Edition,hc.enumMac,de.bIE,de.bSafari,r,Lo.strIEVersion):Xt.isFunction(tr.OnWebTwainNotFoundOnMacCallback)&&tr.OnWebTwainNotFoundOnMacCallback(Qo.name,t,Qo.bHTML5Edition,de.bIE,de.bSafari,r,Lo.strIEVersion);else if(de.bLinux||tr.navInfo.bEmbed||de.bChromeOS||Lo.bMobile){var n,i,o=vc();if(tr.navInfo.bEmbed||de.bAndroid||de.bChromeOS||de.bHarmonyOS?n=t:(n=mc(),i=pc()),e){if(de.bAndroid)Xt.isFunction(tr.OnWebTwainNeedUpgradeOnAndroidCallback)&&tr.OnWebTwainNeedUpgradeOnAndroidCallback(Qo.name,t,r);else if(Xt.isFunction(tr.OnWebTwainNeedUpgradeCallback)){var a={"default":n};de.bLinux&&(a.deb=n,a.rpm=i),tr.OnWebTwainNeedUpgradeCallback(Qo.name,a,Qo.bHTML5Edition,o,de.bIE,de.bSafari,r,Lo.strIEVersion)}}else de.bAndroid?Xt.isFunction(tr.OnWebTwainNotFoundOnAndroidCallback)&&tr.OnWebTwainNotFoundOnAndroidCallback(Qo.name,t,r,!1):!qo.bFullEdition&&Lo.bMobile?Xt.isFunction(tr.OnMobileNotSupportCallback)&&tr.OnMobileNotSupportCallback():Xt.isFunction(tr.OnWebTwainNotFoundOnLinuxCallback)&&tr.OnWebTwainNotFoundOnLinuxCallback(Qo.name,n,i,Qo.bHTML5Edition,de.bIE,de.bSafari,r,Lo.strIEVersion,o)}else if(de.bChrome||de.bSafari||de.bFirefox||de.bOpera||tr.DWT.IfUseActiveXForIE10Plus==ae||!tr.DWT.ActiveXInstallWithCAB&&de.bIE)if(e){if(Xt.isFunction(tr.OnWebTwainNeedUpgradeCallback)){var s={"default":t};tr.OnWebTwainNeedUpgradeCallback(Qo.name,s,Qo.bHTML5Edition,hc.enumWindow,de.bIE,de.bSafari,r,Lo.strIEVersion)}}else Xt.isFunction(tr.OnWebTwainNotFoundOnWindowsCallback)&&tr.OnWebTwainNotFoundOnWindowsCallback(Qo.name,t,Qo.bHTML5Edition,de.bIE,de.bSafari,r,Lo.strIEVersion)}var jf=!1;function Gf(e,t,r){ta(e)&&(cf.item("DWT_port",t),cf.item("DWT_ssl",r?"true":"false"))}function Hf(e,t,r,n,i){return zf.apply(this,arguments)}function zf(){return(zf=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,k,E,x,A,P,D,F,W,N,O,R,M,L,B,U,V,j,G;return g().wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if(u=!1,c=!1,l=!1,d=tr.DWT.ConnectWithSocket,f=!0,o&&(o.bRemoteServer&&(l=!0),o.bConnectWithSocket&&(d=!0),o.bCheckCert&&(c=!0),!1===o.bShowInitMessage&&(f=!1)),f&&tr.DWT.OnWebTwainInitMessage&&tr.DWT.OnWebTwainInitMessage("Checking WebTwain version ...",Lf.Info),h=Xt.now(),p=['{"id":"',m=h,'","cmdId":"',m,'","method":"VersionInfo","version":"',Qo.getDWTPrefix(),qo.getVersionStrForCheck(),'"}'].join(""),v=!d&&!de.bSSL,e.prev=7,!d){e.next=23;break}return _=Of,y={client:a,userData:{cmdId:m,cmd:null,sFun:null,fFun:null,rawData:!0},taskId:m},(a=nc.getWsClient(t,r,n,!0)).setRetry(0),e.next=15,a.request(p,_,y,i);case 15:if(s=e.sent,!a){e.next=20;break}return e.next=19,a.dispose();case 19:a=null;case 20:u=!0,e.next=31;break;case 23:return S="fa/VersionInfo?v=1&ts="+h,I=nc.getHttpClient(t,r,n),b={},ta(t)&&(b.targetAddressSpace="loopback"),v&&(b.redirect="manual"),e.next=30,I.request(p,S,b,i);case 30:s=e.sent;case 31:e.next=52;break;case 33:if(e.prev=33,e.t0=e["catch"](7),Xt.log(["check DWT Version failed",Xt.stringify(e.t0)]),!a){e.next=40;break}return e.next=39,a.dispose();case 39:a=null;case 40:if(!u){e.next=44;break}e.next=52;break;case 44:if(!v){e.next=48;break}if((e.t0&&e.t0.code)!=ua.HTTPRedirected){e.next=48;break}throw Os();case 48:throw Es(T={}),f&&tr.DWT.OnWebTwainInitMessage&&tr.DWT.OnWebTwainInitMessage(T._errorString,Lf.Error),{code:T._errorCode,message:T._errorString};case 52:if(C="",w="",k={},E=!1,s&&(x=Xt.parse(s)),!x||!("exception"in x)){e.next=59;break}hu(x)?(k._errorCode=x.exception,k._errorString=x.description,k._errorCause=gu(x)):k._errorCode=ua.CommonError,e.next=138;break;case 59:if(!x||!("result"in x)){e.next=100;break}if(x=x.result,!(Xt.isArray(x)&&x.length>0)){e.next=97;break}if(A=x[0],C=x.length>1?x[1]:"",P=x.length>2?x[2]:0,D=x.length>3?x[3]:"",w=x.length>4?x[4]:"",""!==C){e.next=94;break}if(F="The WebTwain version is: "+A,f&&tr.DWT.OnWebTwainInitMessage&&tr.DWT.OnWebTwainInitMessage(F,Lf.Info),"32"==P&&ta(t)&&(Ho.b64bit=!1),ta(t)&&(tr.DWT.li({instanceMode:tr.DWT.lgdt()},"")||""!=D&&(tr.DWT.lsmid(D,""),tr.DWT.lsmid2b(D))),(Xt.isFunction(tr.DWT.OnSSLCertInfo)||Xt.isFunction(tr.OnSSLCertInfo))&&(""!=w&&(W=Date.parse(w+"T00:00:00"),W=isNaN(W)?null:new Date(W)),jf||(Xt.isFunction(tr.DWT.OnSSLCertInfo)?tr.DWT.OnSSLCertInfo(W):Xt.isFunction(tr.OnSSLCertInfo)&&tr.OnSSLCertInfo(W)),jf=!0),!c){e.next=81;break}if(""!=w){e.next=78;break}throw Ms();case 78:if(!Bf(w)){e.next=81;break}throw Rs();case 81:if(!Xt.isString(A)||""==A){e.next=91;break}if(fc("Checking the WebTwain version..."),!l&&!gf(A,Qo.getServerVersionInfo(!0))){e.next=87;break}return e.abrupt("return",{host:t,port:r,bSSL:n,version:A,certExpiredDate:W});case 87:fc(yc),ga(k);case 89:e.next=92;break;case 91:E=!0;case 92:e.next=95;break;case 94:"Version not found"===C?ga(k):Ds(k,C);case 95:e.next=98;break;case 97:E=!0;case 98:e.next=138;break;case 100:if(!x||!("ports"in x)){e.next=137;break}if(N=x.ports,O=[],!(Xt.isArray(N)&&N.length>0)){e.next=134;break}if(Xt.each(N,function(e){Xt.isArray(e)&&3===e.length&&e[0]&&O.push(e)}),1!=O.length){e.next=110;break}L=O[0],M=L[2],R=L[1],e.next=132;break;case 110:if(!(O.length>1)){e.next=132;break}o.bShowInitMessage=!1,o.bConnectWithSocket=!0,B=0;case 114:if(!(B<O.length)){e.next=132;break}if(U=O[B],!Xt.isArray(U)||3!==U.length){e.next=129;break}if(!U[0]){e.next=129;break}return V=U[2],j=U[1],G=n?V:j,e.prev=119,e.next=122,Hf(t,G,n,i,o);case 122:return R=j,M=V,e.abrupt("break",132);case 127:e.prev=127,e.t1=e["catch"](119);case 129:B++,e.next=114;break;case 132:if(!R||!M){e.next=134;break}return e.abrupt("return",{bPortsChanged:!0,port:R,sslPort:M});case 134:Es(k),e.next=138;break;case 137:E=!0;case 138:throw E&&xs(k),f&&tr.DWT.OnWebTwainInitMessage&&tr.DWT.OnWebTwainInitMessage(k._errorString,Lf.Error),{code:k._errorCode,message:k._errorString};case 141:case"end":return e.stop()}},e,null,[[7,33],[119,127]])}))).apply(this,arguments)}var Kf=!1,Jf=new Hl(function(){return Kf});function Qf(e){return qf.apply(this,arguments)}function qf(){return(qf=n(g().mark(function e(t){var r;return g().wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.prev=0,e.next=3,t();case 3:case 14:r=e.sent,e.next=18;break;case 6:if(e.prev=6,e.t0=e["catch"](0),e.t0.code!=ua.MustUpgrade){e.next=10;break}throw e.t0;case 10:if(!de.bSSL||!tr.DWT.EnableLocalNetworkMixedContent){e.next=17;break}return tr.DWT.EnableLocalNetworkMixedContent=!1,e.next=14,t();case 17:throw e.t0;case 18:return e.abrupt("return",r);case 19:case"end":return e.stop()}},e,null,[[0,6]])}))).apply(this,arguments)}function Yf(e){return Xf.apply(this,arguments)}function Xf(){return(Xf=n(g().mark(function e(t){var r,i,o,a,s;return g().wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if(!(tr.DWT.EnableLocalNetworkMixedContent&&de.bSSL||Qo.bPortChanged)){e.next=4;break}e.next=6;break;case 4:if(!Qo.bDWTChecked||!t.bFromLoadInit){e.next=6;break}return e.abrupt("return");case 6:if(Kf){e.next=10;break}Kf=!0,e.next=13;break;case 10:return e.next=12,Jf.asyncWaitingJSLoaded();case 12:return e.abrupt("return",e.sent);case 13:return r=t.host,i=tr.DWT.EnableLocalNetworkMixedContent,e.prev=14,e.prev=15,e.next=19,Qf(n(g().mark(function u(){var e;return g().wrap(function(r){for(;;)switch(r.prev=r.next){case 0:return r.next=2,Zf(t,true);case 2:return gh(e=r.sent,t),r.abrupt("return",e);case 5:case"end":return r.stop()}},u)})));case 19:return o=e.sent,e.next=22,Ef();case 22:if(!(a=e.sent)){e.next=41;break}if(s=!0,"denied"!=a.state){e.next=28;break}e.next=38;break;case 28:if("prompt"!=a.state){e.next=37;break}return e.next=31,Ff();case 31:if(!e.sent){e.next=34;break}e.next=35;break;case 34:s=!1;case 35:e.next=38;break;case 37:s=!1;case 38:if(!s){e.next=41;break}return e.next=41,hh(t);case 41:e.next=51;break;case 43:if(e.prev=43,e.t0=e["catch"](15),e.t0.code!=ua.MustUpgrade){e.next=48;break}throw Vf(!0),e.t0;case 48:return e.next=50,Qf(n(g().mark(function c(){var e;return g().wrap(function(r){for(;;)switch(r.prev=r.next){case 0:return r.next=2,nh(t);case 2:return gh(e=r.sent,t),r.abrupt("return",e);case 5:case"end":return r.stop()}},c)})));case 50:o=e.sent;case 51:if(de.bSSL||!Nf()||tr.DWT.ConnectWithSocket){e.next=55;break}return e.next=54,Qf(n(g().mark(function l(){var e;return g().wrap(function(r){for(;;)switch(r.prev=r.next){case 0:return r.next=2,oh(t);case 2:return gh(e=r.sent,t),r.abrupt("return",e);case 5:case"end":return r.stop()}},l)})));case 54:o=e.sent;case 55:return i&&!1===tr.DWT.EnableLocalNetworkMixedContent&&(Qo.bIgnoreHttpsMixedContent=!0,tr.DWT.EnableLocalNetworkMixedContent=i),Qt.detect.dcpStatus=2,Gf(t.host,o.port,o.bSSL),e.next=60,$c(!1,!0);case 60:if(!ea()||!ta(r)){e.next=64;break}if(tr.DWT.li({instanceMode:tr.DWT.lgdt()},"")){e.next=64;break}throw js();case 64:e.next=70;break;case 66:throw e.prev=66,e.t1=e["catch"](14),Kf=!1,e.t1;case 70:Qo.bDWTChecked=!0,Kf=!1;case 72:case"end":return e.stop()}},e,null,[[14,66],[15,43]])}))).apply(this,arguments)}function Zf(e,t,r){return $f.apply(this,arguments)}function $f(){return $f=n(g().mark(function e(t,r,n){var i,o,a,s,u,c,l,d,f;return g().wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return fc("Checking the WebTwain module..."),i=t.host,o=t.port,a=t.sslPort,s=$o(),(u=s?a:o)||Xt.each(Qt.detect.ports,function(e){s?e.ssl&&(u=e.port):e.ssl||(u=e.port)}),l=!0,!1!==n&&n!==li||(l=!1),e.prev=5,e.next=8,Hf(i,u,s,r?Xo():Yo(),{bConnectWithSocket:r,bShowInitMessage:l});case 8:if(!(c=e.sent).bPortsChanged){e.next=19;break}return d=c.port,f=c.sslPort,u=s?f:d,t.port=d,t.sslPort=f,e.next=17,Hf(i,u,s,r?Xo():Yo(),{bConnectWithSocket:r,bShowInitMessage:l});case 17:(c=e.sent).bPortsChanged=!0;case 19:e.next=25;break;case 21:throw e.prev=21,e.t0=e["catch"](5),Qt.detect.dcpStatus=3,e.t0;case 25:return fc("Check the WebTwain version successfully."),!qo.versionInfoFromServer&&ta(c.host)&&(qo.versionInfoFromServer=c.version),e.abrupt("return",c);case 28:case"end":return e.stop()}},e,null,[[5,21]])})),$f.apply(this,arguments)}function eh(e,t,r,n,i,o){rh(e,t,r,{bRemoteServer:!0,bConnectWithSocket:n},i,o)}function th(e,t,r,n,i){if(Xt.isString(e)&&Xt.isString(t))rh(e,t,r,null,n,i);else{var o=e,a=t,s=tr.DWT.Host,u=Zo(s);rh(s,u?tr.DWT.SSLPort:tr.DWT.Port,u,null,o,a)}}function rh(e,t,r,n,i,o){var a=0,s=e,u=t,c=r,l=i,d=o;if(Xt.isFunction(s)&&Xt.isFunction(u))for(l=s,d=u,s=To(),a=0;a<Qt.detect.ports.length;a++)if(c&&Qt.detect.ports[a].ssl||!c&&!Qt.detect.ports[a].ssl){u=Qt.detect.ports[a].port;break}s||(s=To()),Hf(s,u,c,Yo(),n).then(function(e){var t=e.host,r=e.port,n=e.version;Xt.isFunction(l)&&l(t,r,n)},function(e){Xt.isFunction(d)&&d(e)})}function nh(e){return ih.apply(this,arguments)}function ih(){return(ih=n(g().mark(function e(t){var r,n,i,o,a,s,u,c,l,d,f;return g().wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if(r=t.port,n=t.sslPort,i=$o(),o=i?n:r,!i||de.bSafari||de.bMobile||de.bAndroid){e.next=56;break}if(e.prev=2,!tr.DWT.ConnectWithSocket&&1==tr.DWT.IfCheckCORS){e.next=7;break}throw Es(a={}),{code:a._errorCode,message:a._errorString};case 7:return e.next=9,sh(t,!1);case 9:e.next=54;break;case 11:if(e.prev=11,e.t0=e["catch"](2),(s=e.t0.code)!=ua.CORSErrorFromService&&s!=ua.SSLCertExpired&&s!=ua.SSLCertInvalid){e.next=18;break}throw e.t0;case 18:if(s!=ua.MustUpgrade){e.next=23;break}throw Vf(!0),e.t0;case 23:if(!de.bSSL||!tr.DWT.EnableLocalNetworkMixedContent){e.next=25;break}throw e.t0;case 25:if(e.prev=25,1==tr.DWT.IfCheckCert){e.next=30;break}throw Es(u={}),{code:u._errorCode,message:u._errorString};case 30:return e.next=32,Hf(So,r,!1,Xo(),{bConnectWithSocket:!0,bCheckCert:!0});case 32:if(!(c=e.sent).bPortsChanged){e.next=40;break}return r=c.port,n=c.sslPort,o=i?n:r,e.next=39,Hf(So,o,!1,Xo(),{bConnectWithSocket:!0,bCheckCert:!0});case 39:c=e.sent;case 40:e.next=54;break;case 42:if(e.prev=42,e.t1=e["catch"](25),(l=e.t1.code)!=ua.CORSErrorFromService&&l!=ua.SSLCertExpired&&l!=ua.SSLCertInvalid){e.next=49;break}throw e.t1;case 49:if(l!=ua.MustUpgrade){e.next=52;break}throw Vf(!0),e.t1;case 52:throw ta(t.host)?Vf(!1):Xt.isFunction(tr.OnRemoteWebTwainNotFoundCallback)&&tr.OnRemoteWebTwainNotFoundCallback(Qo.name,t.host,o,i,Lo.bMobile),e.t1;case 54:e.next=81;break;case 56:if(e.prev=56,!tr.DWT.ConnectWithSocket&&0!=tr.DWT.IfCheckCORS){e.next=61;break}throw Es(d={}),{code:d._errorCode,message:d._errorString};case 61:return e.next=63,sh(t,!1);case 63:e.next=81;break;case 65:if(e.prev=65,e.t2=e["catch"](56),(f=e.t2.code)!=ua.CORSErrorFromService&&f!=ua.SSLCertExpired&&f!=ua.SSLCertInvalid){e.next=72;break}throw e.t2;case 72:if(f!=ua.MustUpgrade){e.next=77;break}throw Vf(!0),e.t2;case 77:if(!de.bSSL||!tr.DWT.EnableLocalNetworkMixedContent){e.next=79;break}throw e.t2;case 79:throw ta(t.host)?Vf(!1):Xt.isFunction(tr.OnRemoteWebTwainNotFoundCallback)&&tr.OnRemoteWebTwainNotFoundCallback(Qo.name,t.host,o,i,Lo.bMobile),e.t2;case 81:throw Bs();case 82:case"end":return e.stop()}},e,null,[[2,11],[25,42],[56,65]])}))).apply(this,arguments)}function oh(e){return ah.apply(this,arguments)}function ah(){return(ah=n(g().mark(function e(t){return g().wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",sh(t,!0));case 1:case"end":return e.stop()}},e)}))).apply(this,arguments)}function sh(e,t){return uh.apply(this,arguments)}function uh(){return(uh=n(g().mark(function e(t,r){var n,i,o;return g().wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if(e.prev=0,tr.DWT.ConnectWithSocket){e.next=5;break}return e.next=4,Zf(t,li);case 4:n=e.sent;case 5:e.next=14;break;case 7:throw e.prev=7,e.t0=e["catch"](0),i=e.t0,(o=e.t0.code)==ua.ResponseDataTypeError||o==ua.HTSTError||o==ua.CORSError||o==ua.SSLCertExpired||o==ua.SSLCertInvalid||o==ua.MustUpgrade||(o==ua.CORSErrorFromService?Xt.isFunction(tr.OnCorsConfigError)&&tr.OnCorsConfigError(e.t0.message):ta(t.host)&&r&&Nf()&&(i=Ls(),o=i.code)),o==ua.CORSError&&Xt.isFunction(tr.OnHTTPCorsError)&&tr.OnHTTPCorsError(i.message),i;case 14:return e.abrupt("return",n);case 15:case"end":return e.stop()}},e,null,[[0,7]])}))).apply(this,arguments)}var ch,lh=li;function dh(e){return fh.apply(this,arguments)}function fh(){return(fh=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 e.next=2,Ef();case 2:if(!(r=e.sent)){e.next=26;break}if("denied"!=(n=r.state)&&"prompt"!=n){e.next=24;break}return e.prev=6,e.next=9,Zf(t,li,li);case 9:(i=e.sent)&&i.port&&(t.Port=i.port),lh&&tr.DWT.CloseDialog(),ch(),e.next=22;break;case 15:e.prev=15,e.t0=e["catch"](6),$s(o={}),tr.DWT.OnWebTwainInitMessage&&tr.DWT.OnWebTwainInitMessage(o._errorString,Lf.Error),"denied"==n&&tr.OnBrowserLNADenied&&(tr.OnBrowserLNADenied(o._errorString),lh=!0),setTimeout(function(){dh(t)},2e3);case 22:e.next=26;break;case 24:lh&&tr.DWT.CloseDialog(),ch();case 26:case"end":return e.stop()}},e,null,[[6,15]])}))).apply(this,arguments)}function hh(e){return ch=null,new Qt.Promise(function(t,r){ch=t,dh(e)})}function gh(e,t){e&&e.bPortsChanged&&(tr.dcp.Port=t.port,tr.dcp.SSLPort=t.sslPort,tr.DWT.Port=t.port,tr.DWT.SSLPort=t.sslPort,Qo.bPortChanged=!0)}function mh(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 ph(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 vh=new WeakSet,_h=function(e){function t(e){var r;return o(this,t),mh(r=i(this,t,[e]),vh),r._acquireDivEL=null,r.__serverId="",r.__bAcquireImageNow=li,r._blts=ea(),r._bltsCopyImage=!1,r._b64bit=Ho.b64bit,r._logLevel=0,r._bServerAlwaysFocusOnPopupWindow=di,r._bPageFocus=di,r.__bOpenFileNow=li,r._bScanForProxyRemote=li,r._loadImageBytesFileCount=0,r._evt_ids=[],r}return f(t,e),s(t,[{key:"_isValid",value:function(){return!this._destroy||(rs(this),!1)}},{key:"_connnect",value:(x=n(g().mark(function A(){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){th(e._serverInfo.server,e._serverInfo.port,e._serverInfo.ssl,t,r)}));case 2:case"end":return t.stop()}},A,this)})),function(){return x.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,Ch(e)})}},{key:"_getWSCallback",value:function(){return wh}},{key:"_getWSContextData",value:function(){return{}}},{key:"_additionalWSCallback",value:function(e,t,r,n){"ConvertToBlob"==e&&t._blob_callbacks.push(function(e){return r(e,pu.HANDLE_RAW_MESSAGE,"0",n)})}},{key:"_innerSendBlobByWS",value:function(e,t,r,n,i){var o={cmd:e,cmdId:sd(),sFun:function(e){Xt.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=Th(c._clientId,o),u=Th(c._clientId,""),this._evt_ids.push(s)):(o=0,s=0,u=0);var d=bh(c._clientId,e,t,o,c._bScanForProxyRemote?c._dmServiceDWTVersion:""),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){var b;try{b=f.request(d,l,a)}catch(TH){Xt.log(TH),b=Qt.Promise.reject(TH)}return b}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 T=n;I=T.size||T.byteLength||T.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=Xt.isString(e)?Xt.parse(e):e}catch(TH){}if(i._resetErr(),t){if(t instanceof Blob||$l(t))return void r(t);hu(t)&&(i._errorCode=t.exception,i._errorString=t.description,i._errorCause=gu(t))}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("SendEventToScannerUI"!=e&&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(tr.DWT.ConnectWithSocket)return s._sendDataConnectWithSocket(e,r,n,i);a={method:"post",async:!0,body:bh(s._clientId,e,r,0,s._bScanForProxyRemote?s._dmServiceDWTVersion:""),dataType:null!=n?n:"text"};var u=null,c=Xt.guid();return s._bIfShowProgressBar&&(u=Qt.progressContext),ru(u,c)([s._httpUrl,"fa/",e].join(""),a).then(function(t){var r=!1;try{r=Xt.isString(t)?Xt.parse(t):t}catch(TH){}if(r){if(r instanceof Blob||$l(r))return r;if(!hu(r))return"SendEventToScannerUI"!=e&&s._resetErr(),i?r:r.result;s._errorCode=r.exception,s._errorString=r.description,s._errorCause=gu(r)}else _a(s),s._errorCause=null;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){Xt.isFunction(o)&&o(e.code,e.message)});var d;Xt.isFunction(i)&&(u=i),Xt.isFunction(o)&&(s=o),d="ConvertToBlob"==e||"Heartbeat"==e?0:sd();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:(E=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)&&!Xt.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&&Xt.isArray(i)&&i.length>0)){a.next=12;break}return a.abrupt("return",i[0]);case 12:if(!(i&&Xt.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 E.apply(this,arguments)})},{key:"_OnReady",value:(k=n(g().mark(function D(){var e,t,r;return g().wrap(function(n){for(;;)switch(n.prev=n.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)){n.next=9;break}return n.abrupt("return");case 9:t.onopen=null,r=Th(e._clientId,""),this._evt_ids.push(r),e._wsClient.addEvent("close",e._clientId,function(t){t&&Xt.log("websocket close: "+t),e.__bAcquireImageNow=!1,e._OnWSClose(t)}),e._wsClient.addEvent("error",e._clientId,function(t){t&&Xt.log("websocket error: "+t),e.__bAcquireImageNow=!1,e._OnWSError(t)}),e._wsClient.addEvent("timeout",e._clientId,function(t){t&&Xt.log("websocket timeout: "+t),e._OnWSTimeout(t)});case 15:case"end":return n.stop()}},D,this)})),function(){return k.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){Xt.log("hideMask:"+e+"--"+cd),Nl(),cd=0}("websocket close"),o.__OnWSClose&&o.__OnWSClose();var a=o._bRemoteMode?qo.RemoteReconnectMaxTimes:qo.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?qo.RemoteReconnectMaxTimes:qo.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(hu(e)?(r._errorCode=e.exception,r._errorString=e.description,r._errorCause=gu(e)):(r._errorCode=0,r._errorString="",r._errorCause=null),tr.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&&Xt.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&&Xt.isArray(e.result)&&e.result.length>0?(t.sFun(e.result),!0):(t.fFun&&t.fFun(e.result),!1):(n=t.rawData?e:Xt.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&&Xt.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&&Xt.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(Xt.isString(y)){var S=JSON.parse(y);r=Xt.isArray(S)?S:[S]}else Xt.isArray(y)&&(r=y);if(Xt.isArray(r))for(v=t||{},m=0;m<r.length;m++)if(p=r[m],Xt.isArray(p.images))if(n=p.consumeType,i=p.curImageId,o=p.type,a=p.images.length,o!=Ah.enumBCAppend&&o!=Ah.enumBCInsert||(!v.document&&p.document&&(v.document=p.document),!v.tag&&p.tag&&(v.tag=p.tag)),o==Ah.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){_o(C)}return di}},{key:"_handleEvent",value:function(e,t){var r=this,n=e.result[0],i=li;return"OnBitmapChanged"==e.event?r._handleOnBitmapChangedEvent(e,t):(Xt.each(Ph,function(t,n){if(e.event===t){var o=["_",t].join("");return i=di,Xt.isFunction(r[o])&&r[o](e.result,e),li}}),i?(Xt.log("handled event:"+e.event),Xt.each(Dh,function(t,i){if(e.event===t)return Xt.log("sendback event:"+e.event),r._innerSendByWS(e.event,Zl(n),null,null,di),li})):(Xt.each(Qt.Addon_Events,function(t,n){if(e.event===t){var o=["_",t].join("");return i=di,Xt.isFunction(r[o])&&r[o](e.result),li}}),i&&(Xt.log("handled addon event:"+e.event),Xt.each(Qt.Addon_Sendback_Events,function(t,i){if(e.event===t)return Xt.log("sendback addon event:"+e.event),r._innerSendByWS(e.event,Zl(n),null,null,di),li}))),i)}},{key:"_setProductKeyAsync",value:function(e){var t=this,r=e;return t._resetErr(),t._isValid()?Qo.bUseDynamsoftLicenseManager||t._blts?(Zs(t),Qt.Promise.reject({code:t._errorCode,message:t._getErrorString()})):Xt.isString(r)?Zc.isLicenseMixed(r,!1)?Qt.Promise.reject(tr.DWT.licenseException):Zc.isLongKey(r)?ph(vh,t,yh).call(t,r).then(function(e){var r=e;if(!r||r.message)throw xa(t),r&&r.message&&(t._errorString=r.message),{code:t._errorCode,message:t._getErrorString()};return Rd(t,r),r}):(xa(t),Qt.Promise.reject({code:t._errorCode,message:t._getErrorString()})):(xa(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()&&(Xt.isString(r)?t._sendDataByHttpAsync("LTSLicense",Zl(r),null,!0).then(function(e){if(e){if(hu(e))throw t._errorCode=e.exception,t._errorString=e.description,t._errorCause=gu(e),{code:t._errorCode,message:t._getErrorString(),ErrorCause:t._errorCause};return t._innerFunV2("GetLicenseInfo",Zl(0))}throw xa(t),{code:t._errorCode,message:t._getErrorString()}}):(xa(t),Qt.Promise.reject({code:t._errorCode,message:t._getErrorString()})))}},{key:"_setLTSLicenseAsync",value:function(e){var t=this;return t._resetErr(),t._isValid()?Xt.isString(e)?t._setLTSLic(e).then(function(e){var r=e;if(!r||r.message)throw xa(t),r&&r.message&&(t._errorString=r.message),{code:t._errorCode,message:t._getErrorString()};return Rd(t,r),t.__licenseInfo&&(t.__licenseInfo.LTS=!0),r}):(xa(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=$o(),n=Co(),t._bRemoteMode||(n=5),i="",t._blts&&(i=null!=e?e:""),a.next=6,new Qt.Promise(function(e,o){t._sendData("ActiveUI",Zl(Lo.WSVersion,Lo.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()}ps(r)}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,Pd(tr.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=Qo.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&&Na(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 N(){return g().wrap(function(e){for(;;)switch(e.prev=e.next){case 0:case"end":return e.stop()}},N)})),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=this,n=bh(r._clientId,e.cmd,null,e.cmdId,r._bScanForProxyRemote?r._dmServiceDWTVersion:""),i=n.length,o=i,a=new ArrayBuffer(12+o),s=new DataView(a);for(t=0;t<8&&o;t++)s.setUint8(t,o%256),o=Math.floor(o/256);for(t=0;t<4&&i;t++)s.setUint8(8+t,i%256),i=Math.floor(i/256);for(t=0;t<n.length;t++)s.setUint8(12+t,n.charCodeAt(t));return a}},{key:"__closeRemoteScanUI",value:function(e){var t=this;if(t._acquireDivEL){var r=Xt.sizzle(".ds-img-screen");t._acquireDivEL.evtFun?(r&&r.length>0&&Xt.removeEventListener(r[0],"mouseup",t._acquireDivEL.evtFun),t._acquireDivEL.evtFun=null):r&&r.length>0&&Xt.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 O(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",Zl(e));case 6:return r.abrupt("return",r.sent);case 7:case"end":return r.stop()}},O,this)})),function(e){return b.apply(this,arguments)})},{key:"_removeAllImagesAsync",value:(I=n(g().mark(function R(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()}},R,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,Xt.isString(n)&&("win"==n?r.__serverPlatform=hc.enumWindow:"linux"==n?r.__serverPlatform=hc.enumLinux:"mac"==n?r.__serverPlatform=hc.enumMac:"embed"==n?r.__serverPlatform=hc.enumEmbed:"chromeos"==n&&(r.__serverPlatform=hc.enumChromeOS))):i=!0,r._bMustUpgradeService=i,i){g.next=67;break}if(fc("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,Pd(tr.DWT.lgdt(),l);case 13:c=g.sent,g.next=27;break;case 16:if(g.prev=16,g.t0=g["catch"](10),Od(r,g.t0),h=Ud(r._errorCode),!r._bLicenseErrorDispose){g.next=25;break}throw r._bRemoteMode||(h?this._LicensePromptExpired():jd(r)),{code:r._errorCode,message:r._errorString};case 25:h||Xt.warn(r._errorString),c=null;case 27:if(fc(Sc),!c){g.next=41;break}return g.next=31,r._setLTSLicenseAsync(c.ar);case 31:return m=g.sent,tr.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:""),fc(Ic),g.next=38,tr.DWT.lcheckLic(tr.DWT.lgdt(),m,l);case 38:u=0==tr.DWT.licenseException.code,g.next=42;break;case 41:u=!1;case 42:g.next=62;break;case 44:return fc(Sc),_=Qo.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||Bd(g.t1.code)&&Vd(g.t1),g.t1;case 60:Xt.warn(g.t1.message);case 61:u=!1;case 62:if(u&&(fc(Ic),Zc.checkProductKey(r,{Core:!0})||(y={code:r._errorCode,message:r._getErrorString()},r._resetErr(),tr.DWT.lclex(),de.bWin&&Zc.checkProductKey(r,{Webcam:!0},!0)||(r._errorCode=y.code,r._errorString=y.message))),0==r._errorCode){g.next=67;break}if(r._bRemoteMode||(Ud(r._errorCode)?this._LicensePromptExpired():jd(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=",",Xt.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=af.IT_PNG,i.next=3,this._innerConvertToArrayBufferAsync(t,[e],void 0,void 0);case 3:return r=i.sent,n=uf(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",Zl(e,null!=t&&t,null!=r&&r));case 3:return i=o.sent,o.abrupt("return",$d(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?rd:de.bAndroid?id:rd,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||ld(o,n),c.prev=6,c.next=9,n._getSourcesAsync(s,t,r);case 9:u=c.sent,Xt.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||dd(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=Xt.clone(e),!Zc.checkProductKey(o,{Core:!0}))return Xt.isFunction(r)&&r(o._errorCode,o._getErrorString()),!1;var a=o._bRemoteMode?di:li;i.RemoteScan=a?1:0,o._bRemoteMode&&(Xt.isFunction(o.__OnRemoteScanStatusAsync)||(o.__OnRemoteScanStatusAsync=function(){}),Xt.isFunction(o.__OnSourceUIClose)||(o.__OnSourceUIClose=function(){}));for(var s=0,u=0;u<xh.length;u++){var c=["__",xh[u]].join("");Xt.isFunction(o[c])&&(s|=1<<u)}return i.EnableEvents=s,a&&o._isBindViewer()&&o._initRemoteDiv(),o._bRemoteMode||(o._bPageFocus&&tr.DWT.IfAlwaysFocusOnPopupWindow?o._bServerAlwaysFocusOnPopupWindow||o._OnPageFocus(!0):o._bServerAlwaysFocusOnPopupWindow&&o._OnPageBlur(!0)),n=["[",Xt.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()&&tr.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?Xt.clone(t):{},i="acuqireImage",r._resetErr(),r._isValid()){s.next=4;break}throw{code:r._errorCode,message:r._getErrorString()};case 4:if(Zc.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 ha(r),{code:r._errorCode,message:r._getErrorString()};case 9:return r.__bAcquireImageNow=!0,r._bNoMask||ld(i,r),o=tr.DWT.RemoteScanConfig,a=Rl(),s.prev=12,Eh(n),o&&Ml(o.keepAwake),null!=e&&(n.Device=e.strDevice,n.DeviceMatchField=of.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||dd(i),Ml(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,ph(vh,n=this,Sh).call(n,e),n._initRemoteDiv(),t.next=5,n._innerSelectDeviceAsync(e);case 5:return Xt.isArray(r)&&(i=Zl(r)),t.next=8,n._sendDataByHttpAsync("GetCapabilities",i);case 8:if(o=t.sent,t.prev=9,o.length>0&&(s=o[0]),!Xt.isString(s)){t.next=23;break}if(s=Qt.removeNonPrintableChar(s),0!=(a=JSON.parse(s)).errorCode){t.next=16;break}return t.abrupt("return",a.response);case 16:throw n._errorCode=a.errorCode,n._errorString=a.errorString,n._errorCause=gu(a),{code:n._errorCode,message:n._getErrorString()};case 23:throw xs(n),{code:n._errorCode,message:n._getErrorString()};case 25:t.next=32;break;case 27:throw t.prev=27,t.t0=t["catch"](9),n._errorCode=-2302,n._errorString=t.t0,{code:n._errorCode,message:n._getErrorString()};case 32:case"end":return t.stop()}},G,this,[[9,27]])})),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(ph(vh,n=this,Sh).call(n,e),Xt.isObject(t)&&!Xt.isArray(t)){r.next=5;break}throw $a(n),{code:n._errorCode,message:n._getErrorString()};case 5:return n._initRemoteDiv(),r.next=8,n._innerSelectDeviceAsync(e);case 8:return i=["[",Xt.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 Zd){l.next=4;break}throw $a(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 fs(n),{code:n._errorCode,message:n._errorString};case 17:return u=null!=t?t:of.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 Xt.isUndefined(e)?(ka(this),!1):!Xt.isString(e)||Xt.isString(e)&&0==e.trim().length||Xt.isUndefined(t)||!Xt.isFunction(t)?($a(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,di)}},{key:"_OnPageFocus",value:function(e){var t=this;if(t._bPageFocus=!0,t._bReady&&de.bWin&&tr.DWT.IfAlwaysFocusOnPopupWindow){var r=Xt.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(HQ){}}}}},{key:"_OnPageBlur",value:function(e){var t=this;if(de.bWin&&t._bReady){var r=Xt.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(HQ){}}}}},{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=Xt.parse(c)}catch(d){Xt.error(d.message),Xt.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,Xt.isString(s)&&""!=s&&(o=n.wnd),i&&o){var l=Xt.sizzle(".ds-img-screen");l&&l.length>0&&u._acquireDivEL&&(u._acquireDivEL.evtFun&&(Xt.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=Xt.stringify({sequence:i,wnds:a,wnd:o+"",type:2,x:e.offsetX,y:e.offsetY});u._sendDataByHttpAsync("SendEventToScannerUI",["[",t,"]"].join(""))},Xt.addEventListener(l[0],"mouseup",u._acquireDivEL.evtFun))}}else u.__closeRemoteScanUI(!1);return Xt.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==Ah.enumBCAppend||u==Ah.enumBCInsert)){var d=tr.DWT.lgct(l);Xt.isFunction(n.__OnLtsverify)&&n.__OnLtsverify(d,1)}if((u==Ah.enumBCAppend||u==Ah.enumBCInsert)&&Xt.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=Xt.parse(o)}catch(s){Xt.error(s)}n||(n={imageId:""});var a=!1;if(Xt.isFunction(i.__OnPostTransferAsync))try{a=i.__OnPostTransferAsync(n)}catch(u){_o(u)}if(Xt.isFunction(i.__OnPostTransferAsync2))try{i.__OnPostTransferAsync2(n)}catch(u){_o(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 Xt.trim(t[0])>r[0]||t.length>1&&Xt.trim(t[0])==r[0]&&Xt.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?ga(e):e.isDestroy&&rs(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,!tr.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=ec.Instance.getClient(e._serverInfo)).setRetry(0),e._bNoMask||ld("",e),n.prev=11,n.next=14,$c(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&&(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||dd(""),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=sd(),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,s;return g().wrap(function(u){for(;;)switch(u.prev=u.next){case 0:if(u.prev=0,!e._destroy){u.next=3;break}return u.abrupt("return");case 3:if(r=e._serverInfo,!(Ho.bEnhancedMode&&r&&r.port)){u.next=25;break}return Qo.bDCPChecked=!1,u.prev=6,u.next=9,pf(To(),tr.DWT.Port,tr.DWT.SSLPort);case 9:if(!(n=u.sent)){u.next=15;break}i=$o(),e._serverInfo.port=i?n.sslPort:n.port,u.next=17;break;case 15:throw xs(e),fu(e);case 17:u.next=25;break;case 19:return u.prev=19,u.t0=u["catch"](6),e._wsFailedTimes++,o=e._bRemoteMode?qo.RemoteReconnectMaxTimes:qo.LocalReconnectMaxTimes,e._wsFailedTimes<o&&(a=e._reconnectTimeSpan,e._wsFailedTimes<e._reconnectShortSpanTimes&&(a=e._reconnectShortSpan),e._heartBeatTimer=setTimeout(function(){t.startDWTReconnect(e)},a)),u.abrupt("return");case 25:return e._bConnecting=!0,(s=ec.Instance.getClient(e._serverInfo)).setRetry(0),u.next=31,s.testConnection(void 0,0,void 0,3e4);case 31:return e._wsClient=s,e._wsClient.bReady=!0,e._wsRetry=0,u.next=36,e._reconnected(s);case 36:u.next=41;break;case 38:u.prev=38,u.t1=u["catch"](0),e._wsFailedTimes++;case 41:return u.prev=41,e._bConnecting=!1,u.finish(41);case 44:case"end":return u.stop()}},q,null,[[0,38,41,44],[6,19]])})),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){return[e._httpUrl,"dwt/",e._bScanForProxyRemote?e._dmServiceDWTVersion:[Qo.getDWTPrefix(),Qo.getServerVersionInfo()].join(""),"/img?id=",e._clientId].join("")}}]);var r,a,u,c,l,d,h,m,p,v,_,y,S,I,b,T,C,w,k,E,x}(Xd);function yh(e){var t,r=this,n=e;return r._resetErr(),r._isValid()?Qo.bUseDynamsoftLicenseManager||r._blts?(Zs(r),Qt.Promise.reject({code:r._errorCode,message:r._getErrorString()})):(n=Xt.isString(n)?Xt.trim(n):"",t=r._sendDataConnectWithSocket("ProductKey",Zl(n),"json",!0),r.__productKey=n,t=t.then(function(e){if(Xt.isArray(e)&&e.length>0){if(0!=r._errorCode)throw r.__productKey="",{code:r._errorCode,message:r._getErrorString()};tr.DWT.ProductKey=r.__productKey,Zc.reparseProductKey();return r._innerFunV2("GetLicenseInfo",Zl(0))}throw xa(r),t.context=null,{code:r._errorCode,message:r._getErrorString()}})):Qt.Promise.reject({code:r._errorCode,message:r._getErrorString()})}function Sh(e){return Ih.apply(this,arguments)}function Ih(){return(Ih=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 Zd){e.next=7;break}throw $a(r),{code:r._errorCode,message:r._errorString};case 7:case"end":return e.stop()}},e,this)}))).apply(this,arguments)}function bh(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||[Qo.getDWTPrefix(),Qo.getServerVersionInfo()].join(""),a.push(o),a.push('"'),r!==undefined&&null!==r&&(a.push(',"parameter":'),Xt.isArray(r)?a.push(Xt.stringify(r)):a.push(r)),a.push("}"),a.join("")}function Th(e,t){return["evt",e,t].join("_")}function Ch(e){if(e._bReady)e._wsCheckResolve();else{if(tr.DWT.bConnectCanceled)return Xt.asyncQueue.stop(),Kl.stop(),vs(e),void e._wsCheckReject({code:e._errorCode,message:e._getErrorString()});if(e._wsRetry>10)return ds(e),void e._wsCheckReject({code:e._errorCode,message:e._getErrorString()});e._wsRetry++,setTimeout(function(){Ch(e)},1100)}}function wh(e,t,r,n){return kh.apply(this,arguments)}function kh(){return kh=n(g().mark(function e(t,r,n,i){var o,a,s,u,c,l,d,f;return g().wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if(r!=pu.GET_TASKID){e.next=4;break}return e.abrupt("return",i.taskId);case 4:if(r!=pu.GET_EVENT_TASKID){e.next=8;break}return e.abrupt("return",i.eventTaskId);case 8:if(r!=pu.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",Xt.parse(t));case 17:if(r!=pu.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!=pu.ONMESSAGE_GET_EVENT_TASKID){e.next=31;break}if(!t||!t.event){e.next=28;break}return e.abrupt("return",Th(t.id,t.cmdId));case 28:return e.abrupt("return",0);case 31:if(r!=pu.HANDLE_RAW_MESSAGE){e.next=59;break}if(c=t.rawData,l=t.jsonData,o=null==i?void 0:i.userData){e.next=36;break}return e.abrupt("return",!1);case 36:if(a=o.stwain,s=o.command){e.next=40;break}return e.abrupt("return",!1);case 40:if(a&&Xt.isFunction(a.__OnWSMessage)&&a.__OnWSMessage(t),"object"!==_(t)){e.next=45;break}if(!tr.DWT.ConnectWithSocket){e.next=45;break}return"ConvertToBlob"!=s.cmd&&"GetImageByIndex"!=s.cmd||s.sFun(t),e.abrupt("return",!0);case 45:if("Heartbeat"!=l.method){e.next=47;break}return e.abrupt("return",!0);case 47:if("EnableBuffer"!=l.method&&"GetBuffer"!=l.method){e.next=50;break}return tr.DWT.lwsproc(l,s),e.abrupt("return",!0);case 50:if(Xt.isString(c)&&(d=c.replace(/\0/g,"")),!(d&&d.indexOf("Exception:")>=0||0==d.indexOf("Error"))){e.next=57;break}return f=!1,Xt.log(d+"@"+s.cmd),s.fFun&&(f=s.fFun(d)),!f&&a&&Xt.isFunction(a.__OnPrintMsg)&&a.__OnPrintMsg(d),e.abrupt("return",!0);case 57:e.next=70;break;case 59:if(r!=pu.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)})),kh.apply(this,arguments)}function Eh(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 xh=["OnPreAllTransfers","OnPreTransfer","OnPostTransfer","OnPostTransferAsync"],Ah=function(e){return e.enumBCAppend=1,e.enumBCInsert=2,e.enumBCRemove=3,e.enumBCEdit=4,e.enumBCIndexChange=5,e.enumBCUpdate=6,e}({}),Ph=["OnPostAllTransfers","OnPostTransfer","OnPostLoad","OnPreTransfer","OnPreAllTransfers","OnResult","OnTransferCancelled","OnTransferError","OnSourceUIClose","OnGetFilePath","OnPercentDone","OnPostTransferAsync","OnPreAllTransfersAsync","OnRemoteScanStatusAsync","OnConsumed","OnDiskExceedLimit","OnCurrentDeviceSelected"],Dh=["OnPreAllTransfers","OnPreTransfer","OnPostTransfer","OnGetFilePath","OnPostLoad"];Xt.each;var Fh=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}({});var Wh={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=li;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=Xt.guid();return Qt.progressContext&&(Qt.progressContext._onPercent=a),void ru(Qt.progressContext,d)(r,c).then(function(t){var r=t.type;if("text/plain"==r||"text/html"==r||na(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?ba(e,!1,t.message,t.httpCode):Sa(e),Xt.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||na(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)},Xt.isFunction(a)&&(c.beforeSend=function(e){e.addEventListener("progress",function(e){!de.bSafari&&e&&(delete e.totalSize,delete e.position),a(e)},li)})}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=di}):(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=di}),c.headers?Xt.mix(c.headers,{"X-Requested-With":li}):c.headers={"X-Requested-With":li};if("post"==t){var f,h=e.httpFormFields;if(h)try{f=new FormData,Xt.each(h,function(e,t){if(e instanceof Blob){var r=e.name;f.append(t,e,r)}else f.append(t,e)}),Xt.mix(c,{data:f,processData:li,contentType:li})}catch(TH){}}u=function(t,r,n){var i,a;if(t&&Xt.isArray(t)&&t.length>2?(i=t[1],a=t[2]):(i=r,a=n),2!=a.state&&3!=a.state||0!=a.status)ba(e,li,i,a.status);else if("abort"===a.statusText){ba(e,true)}else Sa(e);Xt.isFunction(o)&&o()},c.url=r,c.async=n,c.onError=u,c.onComplete=function(){e._cancelableObj=null};var g=Ui(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;if(i===undefined||r===undefined)return undefined;if(Xt.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){var o=$o();e.HTTPPort||(e.HTTPPort=o?443:80),(!o&&80!=e.HTTPPort||o&&443!=e.HTTPPort)&&(n.push(":"),n.push(e.HTTPPort))}return 0!==r.indexOf("/")&&n.push("/"),n.push(r),n.join("")},httpPutImage:function(e,t,r,n,i,o,a){var s=di,u={method:"PUT",url:t,hasContent:di,processData:li,async:n,data:r,onSuccess:i,onError:function(t,r,n){var i,a;if(s=li,t&&Xt.isArray(t)&&t.length>2?(i=t[1],a=t[2]):(i=r,a=n),2!=a.state&&3!=a.state||0!=a.status)Ia(e,li,i,a.status);else if("abort"===a.statusText){Ia(e,true)}else!function(e){oa(e,-2304,"Http put error: the url is invalid.")}(e);Xt.isFunction(o)&&o()},onComplete:function(){e._cancelableObj=null},beforeSend:function(e){Xt.isFunction(a)&&e.upload.addEventListener("progress",function(e){!de.bSafari&&e&&(delete e.totalSize,delete e.position),a(e)},li)}};""!=e.HTTPUserName&&(u.username=e.HTTPUserName,u.password=e.HTTPPassword),n||Xt.mix(u,{headers:{"X-Requested-With":li}});var c=Ui(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?(Va(e),!1):e._innerFun("GetImageInfo",Zl(r))},getBlobTypeByImageType:uf,callbacks:[],pushCallback:function(e,t,r){var n={method:e,callback:t,ticks:r};Wh.callbacks.push(n)},refreshUIRef:0,isServerInvalid:function(e){_h.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?tr.DWT.EnumDWT_ImageType.IT_BMP:".jpg"===r||".jpe"===r||".jpeg"===r||".jfif"===r?tr.DWT.EnumDWT_ImageType.IT_JPG:".tif"===r||".tiff"===r?tr.DWT.EnumDWT_ImageType.IT_TIF:".png"===r?tr.DWT.EnumDWT_ImageType.IT_PNG:".pdf"===r?tr.DWT.EnumDWT_ImageType.IT_PDF:".jp2"===r||".j2k"===r||".j2c"===r?tr.DWT.EnumDWT_ImageType.IT_J2K:-1},makeParams:Zl,showMask:ld,hideMask:dd,getFileName:function(e){var t=e,r=t.lastIndexOf("/");return(r>-1||de.bWin&&(r=t.lastIndexOf("\\"))>-1)&&(t=t.substring(r+1)),t},getFilePath:function(e){var t=e,r=t.lastIndexOf("/");return(r>-1||de.bWin&&(r=t.lastIndexOf("\\"))>-1)&&(t=t.substring(0,r)),t}};function Nh(e,t,r,n,i){var o=0;return e==Fh.TWAIN&&(o=od),e==Fh.TWAIN64?o=ed.TWAINX64SCANNER:e==Fh.ICA?r?o=ed.SANESCANNER:n?o=ed.ICASCANNER:(t||i)&&(o=od):e==Fh.TWAIN_AND_TWAIN64&&(r?o=od|ed.SANESCANNER:n?o=od|ed.ICASCANNER:t?o=od|ed.TWAINX64SCANNER:i&&(o=od)),o}function Oh(e,t){for(var r=e.HowManyImagesInBuffer,n=0;n<r;n++)t.push(e._ImgManager.convertClientIndexToServerId(n))}function Rh(e,t){return 0!=e._ImgManager.count()||(da(e),Xt.isFunction(t)&&t(e._errorCode,e._getErrorString()),!1)}function Mh(e,t,r){return!!Rh(e,r)&&(!(isNaN(t)||!Xt.isNumber(t)||t<0||t>=e._ImgManager.count())||(Va(e),Xt.isFunction(r)&&r(e._errorCode,e._getErrorString()),!1))}function Lh(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(),Xt.isArray(n)&&Xt.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 Bh(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 Uh(e,t,r){return e._resetErr(),!!e._isValid()&&(isNaN(t)?(ca(e),Xt.isFunction(r)&&r(e._errorCode,e.ErrorString),li):t<0||t>=e._ImgManager.count()?(Va(e),Xt.isFunction(r)&&r(e._errorCode,e.ErrorString),li):di)}function Vh(e){return e==ed.TWAINSCANNER||e==ed.WIATWAINSCANNER||e==ed.TWAINX64SCANNER}function jh(e){var t,r=[],n=e.HowManyImagesInBuffer;for(t=0;t<n;t++)r.push(t);return e._imageBufferWrapper.convertIndicesToServerIds(r)}function Gh(e,t){return e._imageBufferWrapper.convertIndicesToServerIds(t)}function Hh(e,t,r,n,i){try{e(t,r,n,i)}catch(o){}t=r=n=i=null}function zh(e,t,r){try{e(t._errorCode,t._getErrorString(),r)}catch(n){}t=r=null}function Kh(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=Wh;var Jh=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=[]}}])}(),Qh=function(e){return e&&e.Math===Math&&e},qh=Qh("object"==("undefined"==typeof globalThis?"undefined":_(globalThis))&&globalThis)||Qh("object"==("undefined"==typeof window?"undefined":_(window))&&window)||Qh("object"==("undefined"==typeof self?"undefined":_(self))&&self)||Qh("object"==_(k)&&k)||Qh("object"==_(k)&&k)||function(){return this}()||Function("return this")(),Yh=function(e){try{return!!e()}catch(Ii){return!0}},Xh=!Yh(function(){var e=function(){}.bind();return"function"!=typeof e||e.hasOwnProperty("prototype")}),Zh=Xh,$h=Function.prototype,eg=$h.apply,tg=$h.call,rg="object"==("undefined"==typeof Reflect?"undefined":_(Reflect))&&Reflect.apply||(Zh?tg.bind(eg):function(){return tg.apply(eg,arguments)}),ng=Xh,ig=Function.prototype,og=ig.call,ag=ng&&ig.bind.bind(og,og),sg=ng?ag:function(e){return function(){return og.apply(e,arguments)}},ug=sg,cg=ug({}.toString),lg=ug("".slice),dg=function(e){return lg(cg(e),8,-1)},fg=dg,hg=sg,gg=function(e){if("Function"===fg(e))return hg(e)},mg="object"==("undefined"==typeof document?"undefined":_(document))&&document.all,pg=void 0===mg&&mg!==undefined?function(e){return"function"==typeof e||e===mg}:function(e){return"function"==typeof e},vg={},_g=!Yh(function(){return 7!==Object.defineProperty({},1,{get:function(){return 7}})[1]}),yg=Xh,Sg=Function.prototype.call,Ig=yg?Sg.bind(Sg):function(){return Sg.apply(Sg,arguments)},bg={},Tg={}.propertyIsEnumerable,Cg=Object.getOwnPropertyDescriptor,wg=Cg&&!Tg.call({1:2},1);bg.f=wg?function(e){var t=Cg(this,e);return!!t&&t.enumerable}:Tg;var kg,Eg,xg=function(e,t){return{enumerable:!(1&e),configurable:!(2&e),writable:!(4&e),value:t}},Ag=Yh,Pg=dg,Dg=Object,Fg=sg("".split),Wg=Ag(function(){return!Dg("z").propertyIsEnumerable(0)})?function(e){return"String"===Pg(e)?Fg(e,""):Dg(e)}:Dg,Ng=function(e){return null===e||e===undefined},Og=Ng,Rg=TypeError,Mg=function(e){if(Og(e))throw new Rg("Can't call method on "+e);return e},Lg=Wg,Bg=Mg,Ug=function(e){return Lg(Bg(e))},Vg=pg,jg=function(e){return"object"==_(e)?null!==e:Vg(e)},Gg={},Hg=Gg,zg=qh,Kg=pg,Jg=function(e){return Kg(e)?e:undefined},Qg=function(e,t){return arguments.length<2?Jg(Hg[e])||Jg(zg[e]):Hg[e]&&Hg[e][t]||zg[e]&&zg[e][t]},qg=sg({}.isPrototypeOf),Yg=qh.navigator,Xg=Yg&&Yg.userAgent,Zg=Xg?String(Xg):"",$g=qh,em=Zg,tm=$g.process,rm=$g.Deno,nm=tm&&tm.versions||rm&&rm.version,im=nm&&nm.v8;im&&(Eg=(kg=im.split("."))[0]>0&&kg[0]<4?1:+(kg[0]+kg[1])),!Eg&&em&&(!(kg=em.match(/Edge\/(\d+)/))||kg[1]>=74)&&(kg=em.match(/Chrome\/(\d+)/))&&(Eg=+kg[1]);var om=Eg,am=om,sm=Yh,um=qh.String,cm=!!Object.getOwnPropertySymbols&&!sm(function(){var e=Symbol("symbol detection");return!um(e)||!(Object(e)instanceof Symbol)||!Symbol.sham&&am&&am<41}),lm=cm&&!Symbol.sham&&"symbol"==_(Symbol.iterator),dm=Qg,fm=pg,hm=qg,gm=Object,mm=lm?function(e){return"symbol"==_(e)}:function(e){var t=dm("Symbol");return fm(t)&&hm(t.prototype,gm(e))},pm=String,vm=function(e){try{return pm(e)}catch(Ii){return"Object"}},_m=pg,ym=vm,Sm=TypeError,Im=function(e){if(_m(e))return e;throw new Sm(ym(e)+" is not a function")},bm=Im,Tm=Ng,Cm=function(e,t){var r=e[t];return Tm(r)?undefined:bm(r)},wm=Ig,km=pg,Em=jg,xm=TypeError,Am={exports:{}},Pm=!0,Dm=qh,Fm=Object.defineProperty,Wm=qh,Nm=function(e,t){try{Fm(Dm,e,{value:t,configurable:!0,writable:!0})}catch(Ii){Dm[e]=t}return t},Om="__core-js_shared__",Rm=Am.exports=Wm[Om]||Nm(Om,{});(Rm.versions||(Rm.versions=[])).push({version:"3.47.0",mode:"pure",copyright:"© 2014-2025 Denis Pushkarev (zloirock.ru), 2025 CoreJS Company (core-js.io)",license:"https://github.com/zloirock/core-js/blob/v3.47.0/LICENSE",source:"https://github.com/zloirock/core-js"});var Mm=Am.exports,Lm=Mm,Bm=function(e,t){return Lm[e]||(Lm[e]=t||{})},Um=Mg,Vm=Object,jm=function(e){return Vm(Um(e))},Gm=jm,Hm=sg({}.hasOwnProperty),zm=Object.hasOwn||function(e,t){return Hm(Gm(e),t)},Km=sg,Jm=0,Qm=Math.random(),qm=Km(1.1.toString),Ym=function(e){return"Symbol("+(e===undefined?"":e)+")_"+qm(++Jm+Qm,36)},Xm=Bm,Zm=zm,$m=Ym,ep=cm,tp=lm,rp=qh.Symbol,np=Xm("wks"),ip=tp?rp["for"]||rp:rp&&rp.withoutSetter||$m,op=function(e){return Zm(np,e)||(np[e]=ep&&Zm(rp,e)?rp[e]:ip("Symbol."+e)),np[e]},ap=Ig,sp=jg,up=mm,cp=Cm,lp=function(e,t){var r,n;if("string"===t&&km(r=e.toString)&&!Em(n=wm(r,e)))return n;if(km(r=e.valueOf)&&!Em(n=wm(r,e)))return n;if("string"!==t&&km(r=e.toString)&&!Em(n=wm(r,e)))return n;throw new xm("Can't convert object to primitive value")},dp=TypeError,fp=op("toPrimitive"),hp=function(e,t){if(!sp(e)||up(e))return e;var r,n=cp(e,fp);if(n){if(t===undefined&&(t="default"),r=ap(n,e,t),!sp(r)||up(r))return r;throw new dp("Can't convert object to primitive value")}return t===undefined&&(t="number"),lp(e,t)},gp=mm,mp=function(e){var t=hp(e,"string");return gp(t)?t:t+""},pp=jg,vp=qh.document,_p=pp(vp)&&pp(vp.createElement),yp=function(e){return _p?vp.createElement(e):{}},Sp=yp,Ip=!_g&&!Yh(function(){return 7!==Object.defineProperty(Sp("div"),"a",{get:function(){return 7}}).a}),bp=_g,Tp=Ig,Cp=bg,wp=xg,kp=Ug,Ep=mp,xp=zm,Ap=Ip,Pp=Object.getOwnPropertyDescriptor;vg.f=bp?Pp:function(e,t){if(e=kp(e),t=Ep(t),Ap)try{return Pp(e,t)}catch(Ii){}if(xp(e,t))return wp(!Tp(Cp.f,e,t),e[t])};var Dp=Yh,Fp=pg,Wp=/#|\.prototype\./,Np=function(e,t){var r=Rp[Op(e)];return r===Lp||r!==Mp&&(Fp(t)?Dp(t):!!t)},Op=Np.normalize=function(e){return String(e).replace(Wp,".").toLowerCase()},Rp=Np.data={},Mp=Np.NATIVE="N",Lp=Np.POLYFILL="P",Bp=Np,Up=Im,Vp=Xh,jp=gg(gg.bind),Gp=function(e,t){return Up(e),t===undefined?e:Vp?jp(e,t):function(){return e.apply(t,arguments)}},Hp={},zp=_g&&Yh(function(){return 42!==Object.defineProperty(function(){},"prototype",{value:42,writable:!1}).prototype}),Kp=jg,Jp=String,Qp=TypeError,qp=function(e){if(Kp(e))return e;throw new Qp(Jp(e)+" is not an object")},Yp=_g,Xp=Ip,Zp=zp,$p=qp,ev=mp,tv=TypeError,rv=Object.defineProperty,nv=Object.getOwnPropertyDescriptor,iv="enumerable",ov="configurable",av="writable";Hp.f=Yp?Zp?function(e,t,r){if($p(e),t=ev(t),$p(r),"function"==typeof e&&"prototype"===t&&"value"in r&&av in r&&!r[av]){var n=nv(e,t);n&&n[av]&&(e[t]=r.value,r={configurable:ov in r?r[ov]:n[ov],enumerable:iv in r?r[iv]:n[iv],writable:!1})}return rv(e,t,r)}:rv:function(e,t,r){if($p(e),t=ev(t),$p(r),Xp)try{return rv(e,t,r)}catch(Ii){}if("get"in r||"set"in r)throw new tv("Accessors not supported");return"value"in r&&(e[t]=r.value),e};var sv=Hp,uv=xg,cv=_g?function(e,t,r){return sv.f(e,t,uv(1,r))}:function(e,t,r){return e[t]=r,e},lv=qh,dv=rg,fv=gg,hv=pg,gv=vg.f,mv=Bp,pv=Gg,vv=Gp,_v=cv,yv=zm,Sv=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 dv(e,this,arguments)};return t.prototype=e.prototype,t},Iv=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?lv:h?lv[d]:lv[d]&&lv[d].prototype,p=f?pv:pv[d]||_v(pv,d,{})[d],v=p.prototype;for(o in t)n=!(r=mv(f?o:d+(h?".":"#")+o,e.forced))&&m&&yv(m,o),s=p[o],n&&(u=e.dontCallGetSet?(l=gv(m,o))&&l.value:m[o]),a=n&&u?u:t[o],(r||g||_(s)!=_(a))&&(c=e.bind&&n?vv(a,lv):e.wrap&&n?Sv(a):g&&hv(a)?fv(a):a,(e.sham||a&&a.sham||s&&s.sham)&&_v(c,"sham",!0),_v(p,o,c),g&&(yv(pv,i=d+"Prototype")||_v(pv,i,{}),_v(pv[i],o,a),e.real&&v&&(r||!v[o])&&_v(v,o,a)))},bv=sg([].slice),Tv=sg,Cv=Im,wv=jg,kv=zm,Ev=bv,xv=Xh,Av=Function,Pv=Tv([].concat),Dv=Tv([].join),Fv={},Wv=xv?Av.bind:function(e){var t=Cv(this),r=t.prototype,n=Ev(arguments,1),i=function(){var r=Pv(n,Ev(arguments));return this instanceof i?function(e,t,r){if(!kv(Fv,t)){for(var n=[],i=0;i<t;i++)n[i]="a["+i+"]";Fv[t]=Av("C,a","return new C("+Dv(n,",")+")")}return Fv[t](e,r)}(t,r.length,r):t.apply(e,r)};return wv(r)&&(i.prototype=r),i},Nv={};Nv[op("toStringTag")]="z";var Ov="[object z]"===String(Nv),Rv=Ov,Mv=pg,Lv=dg,Bv=op("toStringTag"),Uv=Object,Vv="Arguments"===Lv(function(){return arguments}()),jv=Rv?Lv:function(e){var t,r,n;return e===undefined?"Undefined":null===e?"Null":"string"==typeof(r=function(e,t){try{return e[t]}catch(Ii){}}(t=Uv(e),Bv))?r:Vv?Lv(t):"Object"===(n=Lv(t))&&Mv(t.callee)?"Arguments":n},Gv=pg,Hv=Mm,zv=sg(Function.toString);Gv(Hv.inspectSource)||(Hv.inspectSource=function(e){return zv(e)});var Kv=Hv.inspectSource,Jv=sg,Qv=Yh,qv=pg,Yv=jv,Xv=Kv,Zv=function(){},$v=Qg("Reflect","construct"),e_=/^\s*(?:class|function)\b/,t_=Jv(e_.exec),r_=!e_.test(Zv),n_=function(e){if(!qv(e))return!1;try{return $v(Zv,[],e),!0}catch(Ii){return!1}},i_=function(e){if(!qv(e))return!1;switch(Yv(e)){case"AsyncFunction":case"GeneratorFunction":case"AsyncGeneratorFunction":return!1}try{return r_||!!t_(e_,Xv(e))}catch(Ii){return!0}};i_.sham=!0;var o_=!$v||Qv(function(){var e;return n_(n_.call)||!n_(Object)||!n_(function(){e=!0})||e})?i_:n_,a_=o_,s_=vm,u_=TypeError,c_=function(e){if(a_(e))return e;throw new u_(s_(e)+" is not a constructor")},l_={},d_=Math.ceil,f_=Math.floor,h_=Math.trunc||function(e){var t=+e;return(t>0?f_:d_)(t)},g_=function(e){var t=+e;return t!=t||0===t?0:h_(t)},m_=g_,p_=Math.max,v_=Math.min,__=function(e,t){var r=m_(e);return r<0?p_(r+t,0):v_(r,t)},y_=g_,S_=Math.min,I_=function(e){var t=y_(e);return t>0?S_(t,9007199254740991):0},b_=function(e){return I_(e.length)},T_=Ug,C_=__,w_=b_,k_=function(e){return function(t,r,n){var i=T_(t),o=w_(i);if(0===o)return!e&&-1;var a,s=C_(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}},E_={includes:k_(!0),indexOf:k_(!1)},x_={},A_=zm,P_=Ug,D_=E_.indexOf,F_=x_,W_=sg([].push),N_=function(e,t){var r,n=P_(e),i=0,o=[];for(r in n)!A_(F_,r)&&A_(n,r)&&W_(o,r);for(;t.length>i;)A_(n,r=t[i++])&&(~D_(o,r)||W_(o,r));return o},O_=["constructor","hasOwnProperty","isPrototypeOf","propertyIsEnumerable","toLocaleString","toString","valueOf"],R_=N_,M_=O_,L_=Object.keys||function(e){return R_(e,M_)},B_=_g,U_=zp,V_=Hp,j_=qp,G_=Ug,H_=L_;l_.f=B_&&!U_?Object.defineProperties:function(e,t){j_(e);for(var r,n=G_(t),i=H_(t),o=i.length,a=0;o>a;)V_.f(e,r=i[a++],n[r]);return e};var z_,K_=Qg("document","documentElement"),J_=Ym,Q_=Bm("keys"),q_=function(e){return Q_[e]||(Q_[e]=J_(e))},Y_=qp,X_=l_,Z_=O_,$_=x_,ey=K_,ty=yp,ry="prototype",ny="script",iy=q_("IE_PROTO"),oy=function(){},ay=function(e){return"<"+ny+">"+e+"</"+ny+">"},sy=function(e){e.write(ay("")),e.close();var t=e.parentWindow.Object;return e=null,t},uy=function(){try{z_=new ActiveXObject("htmlfile")}catch(Ii){}var e,t,r;uy="undefined"!=typeof document?document.domain&&z_?sy(z_):(t=ty("iframe"),r="java"+ny+":",t.style.display="none",ey.appendChild(t),t.src=String(r),(e=t.contentWindow.document).open(),e.write(ay("document.F=Object")),e.close(),e.F):sy(z_);for(var n=Z_.length;n--;)delete uy[ry][Z_[n]];return uy()};$_[iy]=!0;var cy=Object.create||function(e,t){var r;return null!==e?(oy[ry]=Y_(e),r=new oy,oy[ry]=null,r[iy]=e):r=uy(),t===undefined?r:X_.f(r,t)},ly=Iv,dy=rg,fy=Wv,hy=c_,gy=qp,my=jg,py=cy,vy=Yh,_y=Qg("Reflect","construct"),yy=Object.prototype,Sy=[].push,Iy=vy(function(){function e(){}return!(_y(function(){},[],e)instanceof e)}),by=!vy(function(){_y(function(){})}),Ty=Iy||by;ly({target:"Reflect",stat:!0,forced:Ty,sham:Ty},{construct:function(e,t){hy(e),gy(t);var r=arguments.length<3?e:hy(arguments[2]);if(by&&!Iy)return _y(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 dy(Sy,n,t),new(dy(fy,e,n))}var i=r.prototype,o=py(my(i)?i:yy),a=dy(e,o,t);return my(a)?a:o}});var Cy=E(Gg.Reflect.construct),wy=jv,ky=String,Ey=function(e){if("Symbol"===wy(e))throw new TypeError("Cannot convert a Symbol value to a string");return ky(e)},xy={},Ay=N_,Py=O_.concat("length","prototype");xy.f=Object.getOwnPropertyNames||function(e){return Ay(e,Py)};var Dy={},Fy=dg,Wy=Ug,Ny=xy.f,Oy=bv,Ry="object"==("undefined"==typeof window?"undefined":_(window))&&window&&Object.getOwnPropertyNames?Object.getOwnPropertyNames(window):[];Dy.f=function(e){return Ry&&"Window"===Fy(e)?function(e){try{return Ny(e)}catch(Ii){return Oy(Ry)}}(e):Ny(Wy(e))};var My={};My.f=Object.getOwnPropertySymbols;var Ly=cv,By=function(e,t,r,n){return n&&n.enumerable?e[t]=r:Ly(e,t,r),e},Uy=Hp,Vy=function(e,t,r){return Uy.f(e,t,r)},jy={},Gy=op;jy.f=Gy;var Hy,zy,Ky,Jy=Gg,Qy=zm,qy=jy,Yy=Hp.f,Xy=function(e){var t=Jy.Symbol||(Jy.Symbol={});Qy(t,e)||Yy(t,e,{value:qy.f(e)})},Zy=Ig,$y=Qg,eS=op,tS=By,rS=function(){var e=$y("Symbol"),t=e&&e.prototype,r=t&&t.valueOf,n=eS("toPrimitive");t&&!t[n]&&tS(t,n,function(e){return Zy(r,this)},{arity:1})},nS=jv,iS=Ov?{}.toString:function(){return"[object "+nS(this)+"]"},oS=Ov,aS=Hp.f,sS=cv,uS=zm,cS=iS,lS=op("toStringTag"),dS=function(e,t,r,n){var i=r?e:e&&e.prototype;i&&(uS(i,lS)||aS(i,lS,{configurable:!0,value:t}),n&&!oS&&sS(i,"toString",cS))},fS=pg,hS=qh.WeakMap,gS=fS(hS)&&/native code/.test(String(hS)),mS=qh,pS=jg,vS=cv,_S=zm,yS=Mm,SS=q_,IS=x_,bS="Object already initialized",TS=mS.TypeError,CS=mS.WeakMap;if(gS||yS.state){var wS=yS.state||(yS.state=new CS);wS.get=wS.get,wS.has=wS.has,wS.set=wS.set,Hy=function(e,t){if(wS.has(e))throw new TS(bS);return t.facade=e,wS.set(e,t),t},zy=function(e){return wS.get(e)||{}},Ky=function(e){return wS.has(e)}}else{var kS=SS("state");IS[kS]=!0,Hy=function(e,t){if(_S(e,kS))throw new TS(bS);return t.facade=e,vS(e,kS,t),t},zy=function(e){return _S(e,kS)?e[kS]:{}},Ky=function(e){return _S(e,kS)}}var ES={set:Hy,get:zy,has:Ky,enforce:function(e){return Ky(e)?zy(e):Hy(e,{})},getterFor:function(e){return function(t){var r;if(!pS(t)||(r=zy(t)).type!==e)throw new TS("Incompatible receiver, "+e+" required");return r}}},xS=dg,AS=Array.isArray||function(e){return"Array"===xS(e)},PS=AS,DS=o_,FS=jg,WS=op("species"),NS=Array,OS=function(e){var t;return PS(e)&&(t=e.constructor,(DS(t)&&(t===NS||PS(t.prototype))||FS(t)&&null===(t=t[WS]))&&(t=undefined)),t===undefined?NS:t},RS=function(e,t){return new(OS(e))(0===t?0:t)},MS=Gp,LS=Wg,BS=jm,US=b_,VS=RS,jS=sg([].push),GS=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=BS(u),m=LS(g),p=US(m),v=MS(c,l),_=0,y=d||VS,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:jS(S,f)}else switch(e){case 4:return!1;case 7:jS(S,f)}return o?-1:n||i?i:S}},HS={forEach:GS(0),map:GS(1),filter:GS(2),some:GS(3),every:GS(4),find:GS(5),findIndex:GS(6),filterReject:GS(7)},zS=Iv,KS=qh,JS=Ig,QS=sg,qS=_g,YS=cm,XS=Yh,ZS=zm,$S=qg,eI=qp,tI=Ug,rI=mp,nI=Ey,iI=xg,oI=cy,aI=L_,sI=xy,uI=Dy,cI=My,lI=vg,dI=Hp,fI=l_,hI=bg,gI=By,mI=Vy,pI=Bm,vI=x_,_I=Ym,yI=op,SI=jy,II=Xy,bI=rS,TI=dS,CI=ES,wI=HS.forEach,kI=q_("hidden"),EI="Symbol",xI="prototype",AI=CI.set,PI=CI.getterFor(EI),DI=Object[xI],FI=KS.Symbol,WI=FI&&FI[xI],NI=KS.RangeError,OI=KS.TypeError,RI=KS.QObject,MI=lI.f,LI=dI.f,BI=uI.f,UI=hI.f,VI=QS([].push),jI=pI("symbols"),GI=pI("op-symbols"),HI=pI("wks"),zI=!RI||!RI[xI]||!RI[xI].findChild,KI=function(e,t,r){var n=MI(DI,t);n&&delete DI[t],LI(e,t,r),n&&e!==DI&&LI(DI,t,n)},JI=qS&&XS(function(){return 7!==oI(LI({},"a",{get:function(){return LI(this,"a",{value:7}).a}})).a})?KI:LI,QI=function(e,t){var r=jI[e]=oI(WI);return AI(r,{type:EI,tag:e,description:t}),qS||(r.description=t),r},qI=function(e,t,r){e===DI&&qI(GI,t,r),eI(e);var n=rI(t);return eI(r),ZS(jI,n)?(r.enumerable?(ZS(e,kI)&&e[kI][n]&&(e[kI][n]=!1),r=oI(r,{enumerable:iI(0,!1)})):(ZS(e,kI)||LI(e,kI,iI(1,oI(null))),e[kI][n]=!0),JI(e,n,r)):LI(e,n,r)},YI=function(e,t){eI(e);var r=tI(t),n=aI(r).concat(eb(r));return wI(n,function(t){qS&&!JS(XI,r,t)||qI(e,t,r[t])}),e},XI=function(e){var t=rI(e),r=JS(UI,this,t);return!(this===DI&&ZS(jI,t)&&!ZS(GI,t))&&(!(r||!ZS(this,t)||!ZS(jI,t)||ZS(this,kI)&&this[kI][t])||r)},ZI=function(e,t){var r=tI(e),n=rI(t);if(r!==DI||!ZS(jI,n)||ZS(GI,n)){var i=MI(r,n);return!i||!ZS(jI,n)||ZS(r,kI)&&r[kI][n]||(i.enumerable=!0),i}},$I=function(e){var t=BI(tI(e)),r=[];return wI(t,function(e){ZS(jI,e)||ZS(vI,e)||VI(r,e)}),r},eb=function(e){var t=e===DI,r=BI(t?GI:tI(e)),n=[];return wI(r,function(e){!ZS(jI,e)||t&&!ZS(DI,e)||VI(n,jI[e])}),n};YS||(FI=function(){if($S(WI,this))throw new OI("Symbol is not a constructor");var e=arguments.length&&arguments[0]!==undefined?nI(arguments[0]):undefined,t=_I(e),r=function(e){var n=this===undefined?KS:this;n===DI&&JS(r,GI,e),ZS(n,kI)&&ZS(n[kI],t)&&(n[kI][t]=!1);var i=iI(1,e);try{JI(n,t,i)}catch(Ii){if(!(Ii instanceof NI))throw Ii;KI(n,t,i)}};return qS&&zI&&JI(DI,t,{configurable:!0,set:r}),QI(t,e)},gI(WI=FI[xI],"toString",function(){return PI(this).tag}),gI(FI,"withoutSetter",function(e){return QI(_I(e),e)}),hI.f=XI,dI.f=qI,fI.f=YI,lI.f=ZI,sI.f=uI.f=$I,cI.f=eb,SI.f=function(e){return QI(yI(e),e)},qS&&mI(WI,"description",{configurable:!0,get:function(){return PI(this).description}})),zS({global:!0,constructor:!0,wrap:!0,forced:!YS,sham:!YS},{Symbol:FI}),wI(aI(HI),function(e){II(e)}),zS({target:EI,stat:!0,forced:!YS},{useSetter:function(){zI=!0},useSimple:function(){zI=!1}}),zS({target:"Object",stat:!0,forced:!YS,sham:!qS},{create:function(e,t){return t===undefined?oI(e):YI(oI(e),t)},defineProperty:qI,defineProperties:YI,getOwnPropertyDescriptor:ZI}),zS({target:"Object",stat:!0,forced:!YS},{getOwnPropertyNames:$I}),bI(),TI(FI,EI),vI[kI]=!0;var tb=cm&&!!Symbol["for"]&&!!Symbol.keyFor,rb=Iv,nb=Qg,ib=zm,ob=Ey,ab=Bm,sb=tb,ub=ab("string-to-symbol-registry"),cb=ab("symbol-to-string-registry");rb({target:"Symbol",stat:!0,forced:!sb},{"for":function(e){var t=ob(e);if(ib(ub,t))return ub[t];var r=nb("Symbol")(t);return ub[t]=r,cb[r]=t,r}});var lb=Iv,db=zm,fb=mm,hb=vm,gb=tb,mb=Bm("symbol-to-string-registry");lb({target:"Symbol",stat:!0,forced:!gb},{keyFor:function(e){if(!fb(e))throw new TypeError(hb(e)+" is not a symbol");if(db(mb,e))return mb[e]}});var pb=jg,vb=ES.get,_b=sg,yb=zm,Sb=SyntaxError,Ib=parseInt,bb=String.fromCharCode,Tb=_b("".charAt),Cb=_b("".slice),wb=_b(/./.exec),kb={'\\"':'"',"\\\\":"\\","\\/":"/","\\b":"\b","\\f":"\f","\\n":"\n","\\r":"\r","\\t":"\t"},Eb=/^[\da-f]{4}$/i,xb=/^[\u0000-\u001F]$/,Ab=!Yh(function(){var e="9007199254740993",t=JSON.rawJSON(e);return!JSON.isRawJSON(t)||JSON.stringify(t)!==e}),Pb=Iv,Db=Qg,Fb=rg,Wb=Ig,Nb=sg,Ob=Yh,Rb=AS,Mb=pg,Lb=function(e){if(!pb(e))return!1;var t=vb(e);return!!t&&"RawJSON"===t.type},Bb=mm,Ub=dg,Vb=Ey,jb=bv,Gb=function(e,t){for(var r=!0,n="";t<e.length;){var i=Tb(e,t);if("\\"===i){var o=Cb(e,t,t+2);if(yb(kb,o))n+=kb[o],t+=2;else{if("\\u"!==o)throw new Sb('Unknown escape sequence: "'+o+'"');var a=Cb(e,t+=2,t+4);if(!wb(Eb,a))throw new Sb("Bad Unicode escape at: "+t);n+=bb(Ib(a,16)),t+=4}}else{if('"'===i){r=!1,t++;break}if(wb(xb,i))throw new Sb("Bad control character in string literal at: "+t);n+=i,t++}}if(r)throw new Sb("Unterminated string at: "+t);return{value:n,end:t}},Hb=Ym,zb=cm,Kb=Ab,Jb=String,Qb=Db("JSON","stringify"),qb=Nb(/./.exec),Yb=Nb("".charAt),Xb=Nb("".charCodeAt),Zb=Nb("".replace),$b=Nb("".slice),eT=Nb([].push),tT=Nb(1.1.toString),rT=/[\uD800-\uDFFF]/g,nT=/^[\uD800-\uDBFF]$/,iT=/^[\uDC00-\uDFFF]$/,oT=Hb(),aT=oT.length,sT=!zb||Ob(function(){var e=Db("Symbol")("stringify detection");return"[null]"!==Qb([e])||"{}"!==Qb({a:e})||"{}"!==Qb(Object(e))}),uT=Ob(function(){return'"\\udf06\\ud834"'!==Qb("\udf06\ud834")||'"\\udead"'!==Qb("\udead")}),cT=sT?function(e,t){var r=jb(arguments),n=dT(t);if(Mb(n)||e!==undefined&&!Bb(e))return r[1]=function(e,t){if(Mb(n)&&(t=Wb(n,this,Jb(e),t)),!Bb(t))return t},Fb(Qb,null,r)}:Qb,lT=function(e,t,r){var n=Yb(r,t-1),i=Yb(r,t+1);return qb(nT,e)&&!qb(iT,i)||qb(iT,e)&&!qb(nT,n)?"\\u"+tT(Xb(e,0),16):e},dT=function(e){if(Mb(e))return e;if(Rb(e)){for(var t=e.length,r=[],n=0;n<t;n++){var i=e[n];"string"==typeof i?eT(r,i):"number"!=typeof i&&"Number"!==Ub(i)&&"String"!==Ub(i)||eT(r,Vb(i))}var o=r.length,a=!0;return function(e,t){if(a)return a=!1,t;if(Rb(this))return t;for(var n=0;n<o;n++)if(r[n]===e)return t}}};Qb&&Pb({target:"JSON",stat:!0,arity:3,forced:sT||uT||!Kb},{stringify:function(e,t,r){var n=dT(t),i=[],o=cT(e,function(e,t){var r=Mb(n)?Wb(n,this,Jb(e),t):t;return!Kb&&Lb(r)?oT+(eT(i,r.rawJSON)-1):r},r);if("string"!=typeof o)return o;if(uT&&(o=Zb(o,rT,lT)),Kb)return o;for(var a="",s=o.length,u=0;u<s;u++){var c=Yb(o,u);if('"'===c){var l=Gb(o,++u).end-1,d=$b(o,u,l);a+=$b(d,0,aT)===oT?i[$b(d,aT)]:'"'+d+'"',u=l}else a+=c}return a}});var fT=My,hT=jm;Iv({target:"Object",stat:!0,forced:!cm||Yh(function(){fT.f(1)})},{getOwnPropertySymbols:function(e){var t=fT.f;return t?t(hT(e)):[]}});var gT=E(Gg.Object.getOwnPropertySymbols),mT={exports:{}},pT=Iv,vT=Yh,_T=Ug,yT=vg.f,ST=_g;pT({target:"Object",stat:!0,forced:!ST||vT(function(){yT(1)}),sham:!ST},{getOwnPropertyDescriptor:function(e,t){return yT(_T(e),t)}});var IT=Gg.Object,bT=mT.exports=function(e,t){return IT.getOwnPropertyDescriptor(e,t)};IT.getOwnPropertyDescriptor.sham&&(bT.sham=!0);var TT=mT.exports,CT=E(TT),wT=Qg,kT=xy,ET=My,xT=qp,AT=sg([].concat),PT=wT("Reflect","ownKeys")||function(e){var t=kT.f(xT(e)),r=ET.f;return r?AT(t,r(e)):t},DT=_g,FT=Hp,WT=xg,NT=function(e,t,r){DT?FT.f(e,t,WT(0,r)):e[t]=r},OT=PT,RT=Ug,MT=vg,LT=NT;Iv({target:"Object",stat:!0,sham:!_g},{getOwnPropertyDescriptors:function(e){for(var t,r,n=RT(e),i=MT.f,o=OT(n),a={},s=0;o.length>s;)(r=i(n,t=o[s++]))!==undefined&&LT(a,t,r);return a}});var BT=E(Gg.Object.getOwnPropertyDescriptors),UT={exports:{}},VT=Iv,jT=_g,GT=l_.f;VT({target:"Object",stat:!0,forced:Object.defineProperties!==GT,sham:!jT},{defineProperties:GT});var HT=Gg.Object,zT=UT.exports=function(e,t){return HT.defineProperties(e,t)};HT.defineProperties.sham&&(zT.sham=!0);var KT=E(UT.exports),JT=!Yh(function(){function e(){}return e.prototype.constructor=null,Object.getPrototypeOf(new e)!==e.prototype}),QT=zm,qT=pg,YT=jm,XT=JT,ZT=q_("IE_PROTO"),$T=Object,eC=$T.prototype,tC=XT?$T.getPrototypeOf:function(e){var t=YT(e);if(QT(t,ZT))return t[ZT];var r=t.constructor;return qT(r)&&t instanceof r?r.prototype:t instanceof $T?eC:null},rC=sg,nC=Im,iC=jg,oC=function(e){return iC(e)||null===e},aC=String,sC=TypeError,uC=function(e,t,r){try{return rC(nC(Object.getOwnPropertyDescriptor(e,t)[r]))}catch(Ii){}},cC=jg,lC=Mg,dC=function(e){if(oC(e))return e;throw new sC("Can't set "+aC(e)+" as a prototype")},fC=Object.setPrototypeOf||("__proto__"in{}?function(){var e,t=!1,r={};try{(e=uC(Object.prototype,"__proto__","set"))(r,[]),t=r instanceof Array}catch(Ii){}return function(r,n){return lC(r),dC(n),cC(r)?(t?e(r,n):r.__proto__=n,r):r}}():undefined),hC=zm,gC=PT,mC=vg,pC=Hp,vC=jg,_C=cv,yC=Error,SC=sg("".replace),IC=String(new yC("zxcasd").stack),bC=/\n\s*at [^:]*:[^\n]*/,TC=bC.test(IC),CC=xg,wC=!Yh(function(){var e=new Error("a");return!("stack"in e)||(Object.defineProperty(e,"stack",CC(1,7)),7!==e.stack)}),kC=cv,EC=function(e,t){if(TC&&"string"==typeof e&&!yC.prepareStackTrace)for(;t--;)e=SC(e,bC,"");return e},xC=wC,AC=Error.captureStackTrace,PC={},DC=PC,FC=op("iterator"),WC=Array.prototype,NC=function(e){return e!==undefined&&(DC.Array===e||WC[FC]===e)},OC=jv,RC=Cm,MC=Ng,LC=PC,BC=op("iterator"),UC=function(e){if(!MC(e))return RC(e,BC)||RC(e,"@@iterator")||LC[OC(e)]},VC=Ig,jC=Im,GC=qp,HC=vm,zC=UC,KC=TypeError,JC=function(e,t){var r=arguments.length<2?zC(e):t;if(jC(r))return GC(VC(r,e));throw new KC(HC(e)+" is not iterable")},QC=Ig,qC=qp,YC=Cm,XC=function(e,t,r){var n,i;qC(e);try{if(!(n=YC(e,"return"))){if("throw"===t)throw r;return r}n=QC(n,e)}catch(Ii){i=!0,n=Ii}if("throw"===t)throw r;if(i)throw n;return qC(n),r},ZC=Gp,$C=Ig,ew=qp,tw=vm,rw=NC,nw=b_,iw=qg,ow=JC,aw=UC,sw=XC,uw=TypeError,cw=function(e,t){this.stopped=e,this.result=t},lw=cw.prototype,dw=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=ZC(t,l),p=function(e){return n&&sw(n,"normal"),new cw(!0,e)},v=function(e){return d?(ew(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=aw(e)))throw new uw(tw(e)+" is not iterable");if(rw(i)){for(o=0,a=nw(e);a>o;o++)if((s=v(e[o]))&&iw(lw,s))return s;return new cw(!1)}n=ow(e,i)}for(u=f?e.next:n.next;!(c=$C(u,n)).done;){try{s=v(c.value)}catch(Ii){sw(n,"throw",Ii)}if("object"==_(s)&&s&&iw(lw,s))return s}return new cw(!1)},fw=Ey,hw=Iv,gw=qg,mw=tC,pw=fC,vw=function(e,t,r){for(var n=gC(t),i=pC.f,o=mC.f,a=0;a<n.length;a++){var s=n[a];hC(e,s)||r&&hC(r,s)||i(e,s,o(t,s))}},_w=cy,yw=cv,Sw=xg,Iw=function(e,t){vC(t)&&"cause"in t&&_C(e,"cause",t.cause)},bw=function(e,t,r,n){xC&&(AC?AC(e,t):kC(e,"stack",EC(r,n)))},Tw=dw,Cw=function(e,t){return e===undefined?arguments.length<2?"":t:fw(e)},ww=op("toStringTag"),kw=Error,Ew=[].push,xw=function(e,t){var r,n=gw(Aw,this);pw?r=pw(new kw,n?mw(this):Aw):(r=n?this:_w(Aw),yw(r,ww,"Error")),t!==undefined&&yw(r,"message",Cw(t)),bw(r,xw,r.stack,1),arguments.length>2&&Iw(r,arguments[2]);var i=[];return Tw(e,Ew,{that:i}),yw(r,"errors",i),r};pw?pw(xw,kw):vw(xw,kw,{name:!0});var Aw=xw.prototype=_w(kw.prototype,{constructor:Sw(1,xw),message:Sw(1,""),name:Sw(1,"AggregateError")});hw({global:!0,constructor:!0,arity:2},{AggregateError:xw});var Pw,Dw,Fw,Ww=_g,Nw=zm,Ow=Function.prototype,Rw=Ww&&Object.getOwnPropertyDescriptor,Mw=Nw(Ow,"name"),Lw={EXISTS:Mw,PROPER:Mw&&"something"===function(){}.name,CONFIGURABLE:Mw&&(!Ww||Ww&&Rw(Ow,"name").configurable)},Bw=Yh,Uw=pg,Vw=jg,jw=cy,Gw=tC,Hw=By,zw=op("iterator"),Kw=!1;[].keys&&("next"in(Fw=[].keys())?(Dw=Gw(Gw(Fw)))!==Object.prototype&&(Pw=Dw):Kw=!0);var Jw=!Vw(Pw)||Bw(function(){var e={};return Pw[zw].call(e)!==e});Uw((Pw=Jw?{}:jw(Pw))[zw])||Hw(Pw,zw,function(){return this});var Qw={IteratorPrototype:Pw,BUGGY_SAFARI_ITERATORS:Kw},qw=Qw.IteratorPrototype,Yw=cy,Xw=xg,Zw=dS,$w=PC,ek=function(){return this},tk=function(e,t,r,n){var i=t+" Iterator";return e.prototype=Yw(qw,{next:Xw(+!n,r)}),Zw(e,i,!1,!0),$w[i]=ek,e},rk=Iv,nk=Ig,ik=tk,ok=tC,ak=dS,sk=By,uk=PC,ck=Lw.PROPER,lk=Qw.BUGGY_SAFARI_ITERATORS,dk=op("iterator"),fk="keys",hk="values",gk="entries",mk=function(){return this},pk=function(e,t,r,n,i,o,a){ik(r,t,n);var s,u,c,l=function(e){if(e===i&&m)return m;if(!lk&&e&&e in h)return h[e];switch(e){case fk:case hk:case gk:return function(){return new r(this,e)}}return function(){return new r(this)}},d=t+" Iterator",f=!1,h=e.prototype,g=h[dk]||h["@@iterator"]||i&&h[i],m=!lk&&g||l(i),p="Array"===t&&h.entries||g;if(p&&(s=ok(p.call(new e)))!==Object.prototype&&s.next&&(ak(s,d,!0,!0),uk[d]=mk),ck&&i===hk&&g&&g.name!==hk&&(f=!0,m=function(){return nk(g,this)}),i)if(u={values:l(hk),keys:o?m:l(fk),entries:l(gk)},a)for(c in u)(lk||f||!(c in h))&&sk(h,c,u[c]);else rk({target:t,proto:!0,forced:lk||f},u);return a&&h[dk]!==m&&sk(h,dk,m,{name:i}),uk[t]=m,u},vk=function(e,t){return{value:e,done:t}},_k=Ug,yk=PC,Sk=ES;Hp.f;var Ik=pk,bk=vk,Tk="Array Iterator",Ck=Sk.set,wk=Sk.getterFor(Tk);Ik(Array,"Array",function(e,t){Ck(this,{type:Tk,target:_k(e),index:0,kind:t})},function(){var e=wk(this),t=e.target,r=e.index++;if(!t||r>=t.length)return e.target=null,bk(undefined,!0);switch(e.kind){case"keys":return bk(r,!1);case"values":return bk(t[r],!1)}return bk([r,t[r]],!1)},"values"),yk.Arguments=yk.Array;var kk,Ek,xk,Ak,Pk=qh,Dk=Zg,Fk=dg,Wk=function(e){return Dk.slice(0,e.length)===e},Nk=Wk("Bun/")?"BUN":Wk("Cloudflare-Workers")?"CLOUDFLARE":Wk("Deno/")?"DENO":Wk("Node.js/")?"NODE":Pk.Bun&&"string"==typeof Bun.version?"BUN":Pk.Deno&&"object"==_(Deno.version)?"DENO":"process"===Fk(Pk.process)?"NODE":Pk.window&&Pk.document?"BROWSER":"REST",Ok="NODE"===Nk,Rk=Qg,Mk=Vy,Lk=_g,Bk=op("species"),Uk=function(e){var t=Rk(e);Lk&&t&&!t[Bk]&&Mk(t,Bk,{configurable:!0,get:function(){return this}})},Vk=qg,jk=TypeError,Gk=function(e,t){if(Vk(t,e))return e;throw new jk("Incorrect invocation")},Hk=qp,zk=c_,Kk=Ng,Jk=op("species"),Qk=function(e,t){var r,n=Hk(e).constructor;return n===undefined||Kk(r=Hk(n)[Jk])?t:zk(r)},qk=TypeError,Yk=function(e,t){if(e<t)throw new qk("Not enough arguments");return e},Xk=/(?:ipad|iphone|ipod).*applewebkit/i.test(Zg),Zk=qh,$k=rg,eE=Gp,tE=pg,rE=zm,nE=Yh,iE=K_,oE=bv,aE=yp,sE=Yk,uE=Xk,cE=Ok,lE=Zk.setImmediate,dE=Zk.clearImmediate,fE=Zk.process,hE=Zk.Dispatch,gE=Zk.Function,mE=Zk.MessageChannel,pE=Zk.String,vE=0,_E={},yE="onreadystatechange";nE(function(){kk=Zk.location});var SE=function(e){if(rE(_E,e)){var t=_E[e];delete _E[e],t()}},IE=function(e){return function(){SE(e)}},bE=function(e){SE(e.data)},TE=function(e){Zk.postMessage(pE(e),kk.protocol+"//"+kk.host)};lE&&dE||(lE=function(e){sE(arguments.length,1);var t=tE(e)?e:gE(e),r=oE(arguments,1);return _E[++vE]=function(){$k(t,undefined,r)},Ek(vE),vE},dE=function(e){delete _E[e]},cE?Ek=function(e){fE.nextTick(IE(e))}:hE&&hE.now?Ek=function(e){hE.now(IE(e))}:mE&&!uE?(Ak=(xk=new mE).port2,xk.port1.onmessage=bE,Ek=eE(Ak.postMessage,Ak)):Zk.addEventListener&&tE(Zk.postMessage)&&!Zk.importScripts&&kk&&"file:"!==kk.protocol&&!nE(TE)?(Ek=TE,Zk.addEventListener("message",bE,!1)):Ek=yE in aE("script")?function(e){iE.appendChild(aE("script"))[yE]=function(){iE.removeChild(this),SE(e)}}:function(e){setTimeout(IE(e),0)});var CE={set:lE,clear:dE},wE=qh,kE=_g,EE=Object.getOwnPropertyDescriptor,xE=function(e){if(!kE)return wE[e];var t=EE(wE,e);return t&&t.value},AE=function(){this.head=null,this.tail=null};AE.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 PE,DE,FE,WE,NE,OE=AE,RE=/ipad|iphone|ipod/i.test(Zg)&&"undefined"!=typeof Pebble,ME=/web0s(?!.*chrome)/i.test(Zg),LE=qh,BE=xE,UE=Gp,VE=CE.set,jE=OE,GE=Xk,HE=RE,zE=ME,KE=Ok,JE=LE.MutationObserver||LE.WebKitMutationObserver,QE=LE.document,qE=LE.process,YE=LE.Promise,XE=BE("queueMicrotask");if(!XE){var ZE=new jE,$E=function(){var e,t;for(KE&&(e=qE.domain)&&e.exit();t=ZE.get();)try{t()}catch(Ii){throw ZE.head&&PE(),Ii}e&&e.enter()};GE||KE||zE||!JE||!QE?!HE&&YE&&YE.resolve?((WE=YE.resolve(undefined)).constructor=YE,NE=UE(WE.then,WE),PE=function(){NE($E)}):KE?PE=function(){qE.nextTick($E)}:(VE=UE(VE,LE),PE=function(){VE($E)}):(DE=!0,FE=QE.createTextNode(""),new JE($E).observe(FE,{characterData:!0}),PE=function(){FE.data=DE=!DE}),XE=function(e){ZE.head||PE(),ZE.add(e)}}var ex=XE,tx=function(e){try{return{error:!1,value:e()}}catch(Ii){return{error:!0,value:Ii}}},rx=qh.Promise,nx=qh,ix=rx,ox=pg,ax=Bp,sx=Kv,ux=op,cx=Nk,lx=om,dx=ix&&ix.prototype,fx=ux("species"),hx=!1,gx=ox(nx.PromiseRejectionEvent),mx=ax("Promise",function(){var e=sx(ix),t=e!==String(ix);if(!t&&66===lx)return!0;if(!dx["catch"]||!dx["finally"])return!0;if(!lx||lx<51||!/native code/.test(e)){var r=new ix(function(e){e(1)}),n=function(e){e(function(){},function(){})};if((r.constructor={})[fx]=n,!(hx=r.then(function(){})instanceof n))return!0}return!(t||"BROWSER"!==cx&&"DENO"!==cx||gx)}),px={CONSTRUCTOR:mx,REJECTION_EVENT:gx,SUBCLASSING:hx},vx={},_x=Im,yx=TypeError,Sx=function(e){var t,r;this.promise=new e(function(e,n){if(t!==undefined||r!==undefined)throw new yx("Bad Promise constructor");t=e,r=n}),this.resolve=_x(t),this.reject=_x(r)};vx.f=function(e){return new Sx(e)};var Ix,bx,Tx,Cx=Iv,wx=Ok,kx=qh,Ex=Gg,xx=Ig,Ax=By,Px=dS,Dx=Uk,Fx=Im,Wx=pg,Nx=jg,Ox=Gk,Rx=Qk,Mx=CE.set,Lx=ex,Bx=function(e,t){},Ux=tx,Vx=OE,jx=ES,Gx=rx,Hx=vx,zx="Promise",Kx=px.CONSTRUCTOR,Jx=px.REJECTION_EVENT,Qx=jx.getterFor(zx),qx=jx.set,Yx=Gx&&Gx.prototype,Xx=Gx,Zx=Yx,$x=kx.TypeError,eA=kx.document,tA=kx.process,rA=Hx.f,nA=rA,iA=!!(eA&&eA.createEvent&&kx.dispatchEvent),oA="unhandledrejection",aA=function(e){var t;return!(!Nx(e)||!Wx(t=e.then))&&t},sA=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&&fA(t),t.rejection=1),!0===s?r=o:(l&&l.enter(),r=s(o),l&&(l.exit(),i=!0)),r===e.promise?c(new $x("Promise-chain cycle")):(n=aA(r))?xx(n,r,u,c):u(r)):c(o)}catch(Ii){l&&!i&&l.exit(),c(Ii)}},uA=function(e,t){e.notified||(e.notified=!0,Lx(function(){for(var r,n=e.reactions;r=n.get();)sA(r,e);e.notified=!1,t&&!e.rejection&&lA(e)}))},cA=function(e,t,r){var n,i;iA?((n=eA.createEvent("Event")).promise=t,n.reason=r,n.initEvent(e,!1,!0),kx.dispatchEvent(n)):n={promise:t,reason:r},!Jx&&(i=kx["on"+e])?i(n):e===oA&&Bx("Unhandled promise rejection",r)},lA=function(e){xx(Mx,kx,function(){var t,r=e.facade,n=e.value;if(dA(e)&&(t=Ux(function(){wx?tA.emit("unhandledRejection",n,r):cA(oA,r,n)}),e.rejection=wx||dA(e)?2:1,t.error))throw t.value})},dA=function(e){return 1!==e.rejection&&!e.parent},fA=function(e){xx(Mx,kx,function(){var t=e.facade;wx?tA.emit("rejectionHandled",t):cA("rejectionhandled",t,e.value)})},hA=function(e,t,r){return function(n){e(t,n,r)}},gA=function(e,t,r){e.done||(e.done=!0,r&&(e=r),e.value=t,e.state=2,uA(e,!0))},mA=function(e,t,r){if(!e.done){e.done=!0,r&&(e=r);try{if(e.facade===t)throw new $x("Promise can't be resolved itself");var n=aA(t);n?Lx(function(){var r={done:!1};try{xx(n,t,hA(mA,r,e),hA(gA,r,e))}catch(Ii){gA(r,Ii,e)}}):(e.value=t,e.state=1,uA(e,!1))}catch(Ii){gA({done:!1},Ii,e)}}};Kx&&(Zx=(Xx=function(e){Ox(this,Zx),Fx(e),xx(Ix,this);var t=Qx(this);try{e(hA(mA,t),hA(gA,t))}catch(Ii){gA(t,Ii)}}).prototype,(Ix=function(e){qx(this,{type:zx,done:!1,notified:!1,parent:!1,reactions:new Vx,rejection:!1,state:0,value:null})}).prototype=Ax(Zx,"then",function(e,t){var r=Qx(this),n=rA(Rx(this,Xx));return r.parent=!0,n.ok=!Wx(e)||e,n.fail=Wx(t)&&t,n.domain=wx?tA.domain:undefined,0===r.state?r.reactions.add(n):Lx(function(){sA(n,r)}),n.promise}),bx=function(){var e=new Ix,t=Qx(e);this.promise=e,this.resolve=hA(mA,t),this.reject=hA(gA,t)},Hx.f=rA=function(e){return e===Xx||e===Tx?new bx(e):nA(e)}),Cx({global:!0,constructor:!0,wrap:!0,forced:Kx},{Promise:Xx}),Tx=Ex.Promise,Px(Xx,zx,!1,!0),Dx(zx);var pA=op("iterator"),vA=!1;try{var _A=0,yA={next:function(){return{done:!!_A++}},"return":function(){vA=!0}};yA[pA]=function(){return this},Array.from(yA,function(){throw 2})}catch(Ii){}var SA=function(e,t){try{if(!t&&!vA)return!1}catch(Ii){return!1}var r=!1;try{var n={};n[pA]=function(){return{next:function(){return{done:r=!0}}}},e(n)}catch(Ii){}return r},IA=rx,bA=px.CONSTRUCTOR||!SA(function(e){IA.all(e).then(undefined,function(){})}),TA=Ig,CA=Im,wA=vx,kA=tx,EA=dw;Iv({target:"Promise",stat:!0,forced:bA},{all:function(e){var t=this,r=wA.f(t),n=r.resolve,i=r.reject,o=kA(function(){var r=CA(t.resolve),o=[],a=0,s=1;EA(e,function(e){var u=a++,c=!1;s++,TA(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 xA=Iv,AA=px.CONSTRUCTOR;rx&&rx.prototype,xA({target:"Promise",proto:!0,forced:AA,real:!0},{"catch":function(e){return this.then(undefined,e)}});var PA=Ig,DA=Im,FA=vx,WA=tx,NA=dw;Iv({target:"Promise",stat:!0,forced:bA},{race:function(e){var t=this,r=FA.f(t),n=r.reject,i=WA(function(){var i=DA(t.resolve);NA(e,function(e){PA(i,t,e).then(r.resolve,n)})});return i.error&&n(i.value),r.promise}});var OA=vx;Iv({target:"Promise",stat:!0,forced:px.CONSTRUCTOR},{reject:function(e){var t=OA.f(this);return(0,t.reject)(e),t.promise}});var RA=qp,MA=jg,LA=vx,BA=function(e,t){if(RA(e),MA(t)&&t.constructor===e)return t;var r=LA.f(e);return(0,r.resolve)(t),r.promise},UA=Iv,VA=rx,jA=px.CONSTRUCTOR,GA=BA,HA=Qg("Promise"),zA=!jA;UA({target:"Promise",stat:!0,forced:true},{resolve:function(e){return GA(zA&&this===HA?VA:this,e)}});var KA=Ig,JA=Im,QA=vx,qA=tx,YA=dw;Iv({target:"Promise",stat:!0,forced:bA},{allSettled:function(e){var t=this,r=QA.f(t),n=r.resolve,i=r.reject,o=qA(function(){var r=JA(t.resolve),i=[],o=0,a=1;YA(e,function(e){var s=o++,u=!1;a++,KA(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 XA=Ig,ZA=Im,$A=Qg,eP=vx,tP=tx,rP=dw,nP="No one promise resolved";Iv({target:"Promise",stat:!0,forced:bA},{any:function(e){var t=this,r=$A("AggregateError"),n=eP.f(t),i=n.resolve,o=n.reject,a=tP(function(){var n=ZA(t.resolve),a=[],s=0,u=1,c=!1;rP(e,function(e){var l=s++,d=!1;u++,XA(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,nP)))})}),--u||o(new r(a,nP))});return a.error&&o(a.value),n.promise}});var iP=Iv,oP=rg,aP=bv,sP=vx,uP=Im,cP=tx,lP=qh.Promise,dP=!1;iP({target:"Promise",stat:!0,forced:!lP||!lP["try"]||cP(function(){lP["try"](function(e){dP=8===e},8)}).error||!dP},{"try":function(e){var t=arguments.length>1?aP(arguments,1):[],r=sP.f(this),n=cP(function(){return oP(uP(e),undefined,t)});return(n.error?r.reject:r.resolve)(n.value),r.promise}});var fP=vx;Iv({target:"Promise",stat:!0},{withResolvers:function(){var e=fP.f(this);return{promise:e.promise,resolve:e.resolve,reject:e.reject}}});var hP=Iv,gP=rx,mP=Yh,pP=Qg,vP=pg,_P=Qk,yP=BA,SP=gP&&gP.prototype;hP({target:"Promise",proto:!0,real:!0,forced:!!gP&&mP(function(){SP["finally"].call({then:function(){}},function(){})})},{"finally":function(e){var t=_P(this,pP("Promise")),r=vP(e);return this.then(r?function(r){return yP(t,e()).then(function(){return r})}:e,r?function(r){return yP(t,e()).then(function(){throw r})}:e)}});var IP=sg,bP=g_,TP=Ey,CP=Mg,wP=IP("".charAt),kP=IP("".charCodeAt),EP=IP("".slice),xP=function(e){return function(t,r){var n,i,o=TP(CP(t)),a=bP(r),s=o.length;return a<0||a>=s?e?"":undefined:(n=kP(o,a))<55296||n>56319||a+1===s||(i=kP(o,a+1))<56320||i>57343?e?wP(o,a):n:e?EP(o,a,a+2):i-56320+(n-55296<<10)+65536}},AP={codeAt:xP(!1),charAt:xP(!0)},PP=AP.charAt,DP=Ey,FP=ES,WP=pk,NP=vk,OP="String Iterator",RP=FP.set,MP=FP.getterFor(OP);WP(String,"String",function(e){RP(this,{type:OP,string:DP(e),index:0})},function(){var e,t=MP(this),r=t.string,n=t.index;return n>=r.length?NP(undefined,!0):(e=PP(r,n),t.index+=e.length,NP(e,!1))});var LP=Gg.Promise,BP={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},UP=qh,VP=dS,jP=PC;for(var GP in BP)VP(UP[GP],GP),jP[GP]=jP.Array;var HP=LP,zP=HP,KP=E(zP);function JP(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):KP.resolve(u).then(n,i)}function QP(e){return function(){var t=this,r=arguments;return new KP(function(n,i){var o=e.apply(t,r);function a(e){JP(o,n,i,a,s,"next",e)}function s(e){JP(o,n,i,a,s,"throw",e)}a(void 0)})}}function qP(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}var YP=zm,XP=Ig,ZP=jg,$P=qp,eD=function(e){return e!==undefined&&(YP(e,"value")||YP(e,"writable"))},tD=vg,rD=tC;Iv({target:"Reflect",stat:!0},{get:function tq(e,t){var r,n,i=arguments.length<3?e:arguments[2];return $P(e)===i?e[t]:(r=tD.f(e,t))?eD(r)?r.value:r.get===undefined?undefined:XP(r.get,i):ZP(n=rD(e))?tq(n,t,i):void 0}});var nD=E(Gg.Reflect.get),iD=Wv;Iv({target:"Function",proto:!0,forced:Function.bind!==iD},{bind:iD});var oD=qh,aD=Gg,sD=function(e,t){var r=aD[e+"Prototype"],n=r&&r[t];if(n)return n;var i=oD[e],o=i&&i.prototype;return o&&o[t]},uD=sD("Function","bind"),cD=qg,lD=uD,dD=Function.prototype,fD=function(e){var t=e.bind;return e===dD||cD(dD,e)&&t===dD.bind?lD:t},hD=E(fD),gD=E(TT);Iv({target:"Object",stat:!0},{setPrototypeOf:fC});var mD=Gg.Object.setPrototypeOf,pD=E(mD),vD=jm,_D=tC,yD=JT;Iv({target:"Object",stat:!0,forced:Yh(function(){_D(1)}),sham:!yD},{getPrototypeOf:function(e){return _D(vD(e))}});var SD=Gg.Object.getPrototypeOf,ID=E(SD);function bD(e){var t;return bD=pD?hD(t=ID).call(t):function(e){return e.__proto__||ID(e)},bD(e)}function TD(){var e;return TD="undefined"!=typeof Reflect&&nD?hD(e=nD).call(e):function(e,t,r){var n=function(e,t){for(;!{}.hasOwnProperty.call(e,t)&&null!==(e=bD(e)););return e}(e,t);if(n){var i=gD(n,t);return i.get?i.get.call(arguments.length<3?e:r):i.value}},TD.apply(null,arguments)}Iv({target:"Object",stat:!0,sham:!_g},{create:cy});var CD=Gg.Object,wD=function(e,t){return CD.create(e,t)},kD=E(wD),ED={exports:{}},xD=Iv,AD=_g,PD=Hp.f;xD({target:"Object",stat:!0,forced:Object.defineProperty!==PD,sham:!AD},{defineProperty:PD});var DD=Gg.Object,FD=ED.exports=function(e,t,r){return DD.defineProperty(e,t,r)};DD.defineProperty.sham&&(FD.sham=!0);var WD=ED.exports,ND=WD,OD=E(ND);function RD(e,t){var r;return RD=pD?hD(r=pD).call(r):function(e,t){return e.__proto__=t,e},RD(e,t)}function MD(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=kD(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),OD(e,"prototype",{writable:!1}),t&&RD(e,t)}var LD=TypeError,BD=function(e){if(e>9007199254740991)throw LD("Maximum allowed index exceeded");return e},UD=Yh,VD=om,jD=op("species"),GD=function(e){return VD>=51||!UD(function(){var t=[];return(t.constructor={})[jD]=function(){return{foo:1}},1!==t[e](Boolean).foo})},HD=Iv,zD=Yh,KD=AS,JD=jg,QD=jm,qD=b_,YD=BD,XD=NT,ZD=RS,$D=GD,eF=om,tF=op("isConcatSpreadable"),rF=eF>=51||!zD(function(){var e=[];return e[tF]=!1,e.concat()[0]!==e}),nF=function(e){if(!JD(e))return!1;var t=e[tF];return t!==undefined?!!t:KD(e)};HD({target:"Array",proto:!0,arity:1,forced:!rF||!$D("concat")},{concat:function(e){var t,r,n,i,o,a=QD(this),s=ZD(a,0),u=0;for(t=-1,n=arguments.length;t<n;t++)if(nF(o=-1===t?a:arguments[t]))for(i=qD(o),YD(u+i),r=0;r<i;r++,u++)r in o&&XD(s,u,o[r]);else YD(u+1),XD(s,u++,o);return s.length=u,s}}),Xy("asyncDispose"),Xy("asyncIterator"),Xy("dispose"),Xy("hasInstance"),Xy("isConcatSpreadable"),Xy("iterator"),Xy("match"),Xy("matchAll"),Xy("replace"),Xy("search"),Xy("species"),Xy("split");var iF=rS;Xy("toPrimitive"),iF();var oF=Qg,aF=dS;Xy("toStringTag"),aF(oF("Symbol"),"Symbol"),Xy("unscopables"),dS(qh.JSON,"JSON",!0);var sF=Gg.Symbol,uF=op,cF=Hp.f,lF=uF("metadata"),dF=Function.prototype;dF[lF]===undefined&&cF(dF,lF,{value:null}),Xy("metadata");var fF=sF,hF=sg,gF=Qg("Symbol"),mF=gF.keyFor,pF=hF(gF.prototype.valueOf),vF=gF.isRegisteredSymbol||function(e){try{return mF(pF(e))!==undefined}catch(Ii){return!1}};Iv({target:"Symbol",stat:!0},{isRegisteredSymbol:vF});for(var _F=Bm,yF=Qg,SF=sg,IF=mm,bF=op,TF=yF("Symbol"),CF=TF.isWellKnownSymbol,wF=yF("Object","getOwnPropertyNames"),kF=SF(TF.prototype.valueOf),EF=_F("wks"),xF=0,AF=wF(TF),PF=AF.length;xF<PF;xF++)try{var DF=AF[xF];IF(TF[DF])&&bF(DF)}catch(Ii){}var FF=function(e){if(CF&&CF(e))return!0;try{for(var t=kF(e),r=0,n=wF(EF),i=n.length;r<i;r++)if(EF[n[r]]==t)return!0}catch(Ii){}return!1};Iv({target:"Symbol",stat:!0,forced:!0},{isWellKnownSymbol:FF}),Xy("customMatcher"),Xy("observable"),Iv({target:"Symbol",stat:!0,name:"isRegisteredSymbol"},{isRegistered:vF}),Iv({target:"Symbol",stat:!0,name:"isWellKnownSymbol",forced:!0},{isWellKnown:FF}),Xy("matcher"),Xy("metadataKey"),Xy("patternMatch"),Xy("replaceAll");var WF=fF,NF=E(WF),OF=jy.f("iterator"),RF=E(OF);function MF(e){return MF="function"==typeof NF&&"symbol"==typeof RF?function(e){return typeof e}:function(e){return e&&"function"==typeof NF&&e.constructor===NF&&e!==NF.prototype?"symbol":typeof e},MF(e)}Iv({target:"Array",stat:!0},{isArray:AS});var LF=Gg.Array.isArray,BF=E(LF);var UF=E(UC),VF=_g,jF=AS,GF=TypeError,HF=Object.getOwnPropertyDescriptor,zF=VF&&!function(){if(this!==undefined)return!0;try{Object.defineProperty([],"length",{writable:!1}).length=1}catch(Ii){return Ii instanceof TypeError}}()?function(e,t){if(jF(e)&&!HF(e,"length").writable)throw new GF("Cannot set read only .length");return e.length=t}:function(e,t){return e.length=t},KF=jm,JF=b_,QF=zF,qF=BD;Iv({target:"Array",proto:!0,arity:1,forced:Yh(function(){return 4294967297!==[].push.call({length:4294967296},1)})||!function(){try{Object.defineProperty([],"length",{writable:!1}).push()}catch(Ii){return Ii instanceof TypeError}}()},{push:function(e){var t=KF(this),r=JF(t),n=arguments.length;qF(r+n);for(var i=0;i<n;i++)t[r]=arguments[i],r++;return QF(t,r),r}});var YF=sD("Array","push"),XF=qg,ZF=YF,$F=Array.prototype,eW=function(e){var t=e.push;return e===$F||XF($F,e)&&t===$F.push?ZF:t},tW=eW,rW=E(tW);var nW=Iv,iW=AS,oW=o_,aW=jg,sW=__,uW=b_,cW=Ug,lW=NT,dW=op,fW=bv,hW=GD("slice"),gW=dW("species"),mW=Array,pW=Math.max;nW({target:"Array",proto:!0,forced:!hW},{slice:function(e,t){var r,n,i,o=cW(this),a=uW(o),s=sW(e,a),u=sW(t===undefined?a:t,a);if(iW(o)&&(r=o.constructor,(oW(r)&&(r===mW||iW(r.prototype))||aW(r)&&null===(r=r[gW]))&&(r=undefined),r===mW||r===undefined))return fW(o,s,u);for(n=new(r===undefined?mW:r)(pW(u-s,0)),i=0;s<u;s++,i++)s in o&&lW(n,i,o[s]);return n.length=i,n}});var vW=sD("Array","slice"),_W=qg,yW=vW,SW=Array.prototype,IW=function(e){var t=e.slice;return e===SW||_W(SW,e)&&t===SW.slice?yW:t},bW=IW,TW=bW,CW=E(TW),wW=qp,kW=XC,EW=Gp,xW=Ig,AW=jm,PW=function(e,t,r,n){try{return n?t(wW(r)[0],r[1]):t(r)}catch(Ii){kW(e,"throw",Ii)}},DW=NC,FW=o_,WW=b_,NW=NT,OW=JC,RW=UC,MW=Array,LW=function(e){var t=AW(e),r=FW(this),n=arguments.length,i=n>1?arguments[1]:undefined,o=i!==undefined;o&&(i=EW(i,n>2?arguments[2]:undefined));var a,s,u,c,l,d,f=RW(t),h=0;if(!f||this===MW&&DW(f))for(a=WW(t),s=r?new this(a):MW(a);a>h;h++)d=o?i(t[h],h):t[h],NW(s,h,d);else for(s=r?new this:[],l=(c=OW(t,f)).next;!(u=xW(l,c)).done;h++)d=o?PW(c,i,[u.value,h],!0):u.value,NW(s,h,d);return s.length=h,s},BW=LW;Iv({target:"Array",stat:!0,forced:!SA(function(e){Array.from(e)})},{from:BW});var UW=Gg.Array.from,VW=E(UW);function jW(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 GW(e,t){if(e){var r;if("string"==typeof e)return jW(e,t);var n=CW(r={}.toString.call(e)).call(r,8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?VW(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?jW(e,t):void 0}}function HW(e,t){return function(e){if(BF(e))return e}(e)||function(e,t){var r=null==e?null:void 0!==NF&&UF(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)&&(rW(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)||GW(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 zW(e){return function(e){if(BF(e))return jW(e)}(e)||function(e){if(void 0!==NF&&null!=UF(e)||null!=e["@@iterator"])return VW(e)}(e)||GW(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 KW(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}var JW=E(jy.f("toPrimitive"));function QW(e){var t=function(e,t){if("object"!=MF(e)||!e)return e;var r=e[JW];if(void 0!==r){var n=r.call(e,t||"default");if("object"!=MF(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==MF(t)?t:t+""}function qW(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),OD(e,QW(n.key),n)}}function YW(e,t,r){return t&&qW(e.prototype,t),r&&qW(e,r),OD(e,"prototype",{writable:!1}),e}function XW(e,t,r){return(t=QW(t))in e?OD(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}var ZW={exports:{}},$W={exports:{}};!function(e){var t=WF,r=OF;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}($W);var eN=$W.exports,tN=Yh,rN=function(e,t){var r=[][e];return!!r&&tN(function(){r.call(null,t||function(){return 1},1)})},nN=HS.forEach,iN=rN("forEach")?[].forEach:function(e){return nN(this,e,arguments.length>1?arguments[1]:undefined)};Iv({target:"Array",proto:!0,forced:[].forEach!==iN},{forEach:iN});var oN=sD("Array","forEach"),aN=jv,sN=zm,uN=qg,cN=oN,lN=Array.prototype,dN={DOMTokenList:!0,NodeList:!0},fN=function(e){var t=e.forEach;return e===lN||uN(lN,e)&&t===lN.forEach||sN(dN,aN(e))?cN:t},hN=fN,gN=Iv,mN=AS,pN=sg([].reverse),vN=[1,2];gN({target:"Array",proto:!0,forced:String(vN)===String(vN.reverse())},{reverse:function(){return mN(this)&&(this.length=this.length),pN(this)}});var _N=sD("Array","reverse"),yN=qg,SN=_N,IN=Array.prototype,bN=function(e){var t=e.reverse;return e===IN||yN(IN,e)&&t===IN.reverse?SN:t},TN=bN;!function(e){var t=eN["default"],r=ND,n=WF,i=wD,o=SD,a=hN,s=tW,u=mD,c=zP,l=TN,d=TW;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",k="suspendedYield",E="executing",x="completed",A={};function P(){}function D(){}function F(){}var W={};b(W,y,function(){return this});var N=o&&o(o(G([])));N&&N!==m&&p.call(N,y)&&(W=N);var O=F.prototype=P.prototype=i(W);function R(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===E)throw Error("Generator is already running");if(n===x){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===A)continue;return s}}if("next"===r.method)r.sent=r._sent=r.arg;else if("throw"===r.method){if(n===w)throw n=x,r.arg;r.dispatchException(r.arg)}else"return"===r.method&&r.abrupt("return",r.arg);n=E;var u=C(e,t,r);if("normal"===u.type){if(n=r.done?x:k,u.arg===A)continue;return{value:u.arg,done:r.done}}"throw"===u.type&&(n=x,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")),A;var i=C(n,e.iterator,t.arg);if("throw"===i.type)return t.method="throw",t.arg=i.arg,t.delegate=null,A;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,A):o:(t.method="throw",t.arg=new TypeError("iterator result is not an object"),t.delegate=null,A)}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(O,"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(O),e},g.awrap=function(e){return{__await:e}},R(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()})},R(O),b(O,I,"Generator"),b(O,y,function(){return this}),b(O,"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,A):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),A},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),A}},"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),A}},g}e.exports=f,e.exports.__esModule=!0,e.exports["default"]=e.exports}(ZW);var CN=(0,ZW.exports)(),wN=CN;try{regeneratorRuntime=CN}catch(GQ){"object"===("undefined"==typeof globalThis?"undefined":_(globalThis))?globalThis.regeneratorRuntime=CN:Function("r","regeneratorRuntime = r")(CN)}var kN=E(wN),EN=E(LF),xN=E(fN),AN=jm,PN=L_;Iv({target:"Object",stat:!0,forced:Yh(function(){PN(1)})},{keys:function(e){return PN(AN(e))}});var DN=E(Gg.Object.keys);Iv({target:"Number",stat:!0},{isNaN:function(e){return e!=e}});var FN=E(Gg.Number.isNaN),WN=sD("Array","concat"),NN=qg,ON=WN,RN=Array.prototype,MN=function(e){var t=e.concat;return e===RN||NN(RN,e)&&t===RN.concat?ON:t},LN=E(MN),BN=Iv,UN=sg,VN=__,jN=RangeError,GN=String.fromCharCode,HN=String.fromCodePoint,zN=UN([].join);BN({target:"String",stat:!0,arity:1,forced:!!HN&&1!==HN.length},{fromCodePoint:function(e){for(var t,r=[],n=arguments.length,i=0;n>i;){if(t=+arguments[i++],VN(t,1114111)!==t)throw new jN(t+" is not a valid code point");r[i]=t<65536?GN(t):GN(55296+((t-=65536)>>10),t%1024+56320)}return zN(r,"")}});var KN=Yh,JN=Pm,QN=op("iterator"),qN=!KN(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&&JN||!t.sort||"https://a/c%20d?a=1&c=3"!==e.href||"3"!==t.get("c")||"a=1"!==String(new URLSearchParams("?a=1"))||!t[QN]||"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}),YN=By,XN=function(e,t,r){for(var n in t)r&&r.unsafe&&e[n]?e[n]=t[n]:YN(e,n,t[n],r);return e},ZN=bv,$N=Math.floor,eO=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=$N(r/2),s=eO(ZN(e,0,a),t),u=eO(ZN(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},tO=Iv,rO=qh,nO=xE,iO=Qg,oO=Ig,aO=sg,sO=_g,uO=qN,cO=By,lO=Vy,dO=XN,fO=dS,hO=tk,gO=ES,mO=Gk,pO=pg,vO=zm,_O=Gp,yO=jv,SO=qp,IO=jg,bO=Ey,TO=cy,CO=xg,wO=JC,kO=UC,EO=vk,xO=Yk,AO=eO,PO=op("iterator"),DO="URLSearchParams",FO=DO+"Iterator",WO=gO.set,NO=gO.getterFor(DO),OO=gO.getterFor(FO),RO=nO("fetch"),MO=nO("Request"),LO=nO("Headers"),BO=MO&&MO.prototype,UO=LO&&LO.prototype,VO=rO.TypeError,jO=rO.encodeURIComponent,GO=String.fromCharCode,HO=iO("String","fromCodePoint"),zO=parseInt,KO=aO("".charAt),JO=aO([].join),QO=aO([].push),qO=aO("".replace),YO=aO([].shift),XO=aO([].splice),ZO=aO("".split),$O=aO("".slice),eR=aO(/./.exec),tR=/\+/g,rR=/^[0-9a-f]+$/i,nR=function(e,t){var r=$O(e,t,t+2);return eR(rR,r)?zO(r,16):NaN},iR=function(e){for(var t=0,r=128;r>0&&0!==(e&r);r>>=1)t++;return t},oR=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},aR=function(e){for(var t=(e=qO(e,tR," ")).length,r="",n=0;n<t;){var i=KO(e,n);if("%"===i){if("%"===KO(e,n+1)||n+3>t){r+="%",n++;continue}var o=nR(e,n+1);if(o!=o){r+=i,n++;continue}n+=2;var a=iR(o);if(0===a)i=GO(o);else{if(1===a||a>4){r+="�",n++;continue}for(var s=[o],u=1;u<a&&!(++n+3>t||"%"!==KO(e,n));){var c=nR(e,n+1);if(c!=c){n+=3;break}if(c>191||c<128)break;QO(s,c),n+=2,u++}if(s.length!==a){r+="�";continue}var l=oR(s);null===l?r+="�":i=HO(l)}}r+=i,n++}return r},sR=/[!'()~]|%20/g,uR={"!":"%21","'":"%27","(":"%28",")":"%29","~":"%7E","%20":"+"},cR=function(e){return uR[e]},lR=function(e){return qO(jO(e),sR,cR)},dR=hO(function(e,t){WO(this,{type:FO,target:NO(e).entries,index:0,kind:t})},DO,function(){var e=OO(this),t=e.target,r=e.index++;if(!t||r>=t.length)return e.target=null,EO(undefined,!0);var n=t[r];switch(e.kind){case"keys":return EO(n.key,!1);case"values":return EO(n.value,!1)}return EO([n.key,n.value],!1)},!0),fR=function(e){this.entries=[],this.url=null,e!==undefined&&(IO(e)?this.parseObject(e):this.parseQuery("string"==typeof e?"?"===KO(e,0)?$O(e,1):e:bO(e)))};fR.prototype={type:DO,bindURL:function(e){this.url=e,this.update()},parseObject:function(e){var t,r,n,i,o,a,s,u=this.entries,c=kO(e);if(c)for(r=(t=wO(e,c)).next;!(n=oO(r,t)).done;){if(o=(i=wO(SO(n.value))).next,(a=oO(o,i)).done||(s=oO(o,i)).done||!oO(o,i).done)throw new VO("Expected sequence with length 2");QO(u,{key:bO(a.value),value:bO(s.value)})}else for(var l in e)vO(e,l)&&QO(u,{key:l,value:bO(e[l])})},parseQuery:function(e){if(e)for(var t,r,n=this.entries,i=ZO(e,"&"),o=0;o<i.length;)(t=i[o++]).length&&(r=ZO(t,"="),QO(n,{key:aR(YO(r)),value:aR(JO(r,"="))}))},serialize:function(){for(var e,t=this.entries,r=[],n=0;n<t.length;)e=t[n++],QO(r,lR(e.key)+"="+lR(e.value));return JO(r,"&")},update:function(){this.entries.length=0,this.parseQuery(this.url.query)},updateURL:function(){this.url&&this.url.update()}};var hR=function(){mO(this,gR);var e=arguments.length>0?arguments[0]:undefined,t=WO(this,new fR(e));sO||(this.size=t.entries.length)},gR=hR.prototype;if(dO(gR,{append:function(e,t){var r=NO(this);xO(arguments.length,2),QO(r.entries,{key:bO(e),value:bO(t)}),sO||this.size++,r.updateURL()},"delete":function(e){for(var t=NO(this),r=xO(arguments.length,1),n=t.entries,i=bO(e),o=r<2?undefined:arguments[1],a=o===undefined?o:bO(o),s=0;s<n.length;){var u=n[s];if(u.key!==i||a!==undefined&&u.value!==a)s++;else if(XO(n,s,1),a!==undefined)break}sO||(this.size=n.length),t.updateURL()},get:function(e){var t=NO(this).entries;xO(arguments.length,1);for(var r=bO(e),n=0;n<t.length;n++)if(t[n].key===r)return t[n].value;return null},getAll:function(e){var t=NO(this).entries;xO(arguments.length,1);for(var r=bO(e),n=[],i=0;i<t.length;i++)t[i].key===r&&QO(n,t[i].value);return n},has:function(e){for(var t=NO(this).entries,r=xO(arguments.length,1),n=bO(e),i=r<2?undefined:arguments[1],o=i===undefined?i:bO(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=NO(this);xO(arguments.length,1);for(var n,i=r.entries,o=!1,a=bO(e),s=bO(t),u=0;u<i.length;u++)(n=i[u]).key===a&&(o?XO(i,u--,1):(o=!0,n.value=s));o||QO(i,{key:a,value:s}),sO||(this.size=i.length),r.updateURL()},sort:function(){var e=NO(this);AO(e.entries,function(e,t){return e.key>t.key?1:-1}),e.updateURL()},forEach:function(e){for(var t,r=NO(this).entries,n=_O(e,arguments.length>1?arguments[1]:undefined),i=0;i<r.length;)n((t=r[i++]).value,t.key,this)},keys:function(){return new dR(this,"keys")},values:function(){return new dR(this,"values")},entries:function(){return new dR(this,"entries")}},{enumerable:!0}),cO(gR,PO,gR.entries,{name:"entries"}),cO(gR,"toString",function(){return NO(this).serialize()},{enumerable:!0}),sO&&lO(gR,"size",{get:function(){return NO(this).entries.length},configurable:!0,enumerable:!0}),fO(hR,DO),tO({global:!0,constructor:!0,forced:!uO},{URLSearchParams:hR}),!uO&&pO(LO)){var mR=aO(UO.has),pR=aO(UO.set),vR=function(e){if(IO(e)){var t,r=e.body;if(yO(r)===DO)return t=e.headers?new LO(e.headers):new LO,mR(t,"content-type")||pR(t,"content-type","application/x-www-form-urlencoded;charset=UTF-8"),TO(e,{body:CO(0,bO(r)),headers:CO(0,t)})}return e};if(pO(RO)&&tO({global:!0,enumerable:!0,dontCallGetSet:!0,forced:!0},{fetch:function(e){return RO(e,arguments.length>1?vR(arguments[1]):{})}}),pO(MO)){var _R=function(e){return mO(this,BO),new MO(e,arguments.length>1?vR(arguments[1]):{})};BO.constructor=_R,_R.prototype=BO,tO({global:!0,constructor:!0,dontCallGetSet:!0,forced:!0},{Request:_R})}}var yR,SR={URLSearchParams:hR,getState:NO},IR=_g,bR=sg,TR=Ig,CR=Yh,wR=L_,kR=My,ER=bg,xR=jm,AR=Wg,PR=Object.assign,DR=Object.defineProperty,FR=bR([].concat),WR=!PR||CR(function(){if(IR&&1!==PR({b:1},PR(DR({},"a",{enumerable:!0,get:function(){DR(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!==PR({},e)[r]||wR(PR({},t)).join("")!==n})?function(e,t){for(var r=xR(e),n=arguments.length,i=1,o=kR.f,a=ER.f;n>i;)for(var s,u=AR(arguments[i++]),c=o?FR(wR(u),o(u)):wR(u),l=c.length,d=0;l>d;)s=c[d++],IR&&!TR(a,u,s)||(r[s]=u[s]);return r}:PR,NR=sg,OR=2147483647,RR=/[^\0-\u007E]/,MR=/[.\u3002\uFF0E\uFF61]/g,LR="Overflow: input needs wider integers to process",BR=RangeError,UR=NR(MR.exec),VR=Math.floor,jR=String.fromCharCode,GR=NR("".charCodeAt),HR=NR([].join),zR=NR([].push),KR=NR("".replace),JR=NR("".split),QR=NR("".toLowerCase),qR=function(e){return e+22+75*(e<26)},YR=function(e,t,r){var n=0;for(e=r?VR(e/700):e>>1,e+=VR(e/t);e>455;)e=VR(e/35),n+=36;return VR(n+36*e/(e+38))},XR=function(e){var t=[];e=function(e){for(var t=[],r=0,n=e.length;r<n;){var i=GR(e,r++);if(i>=55296&&i<=56319&&r<n){var o=GR(e,r++);56320==(64512&o)?zR(t,((1023&i)<<10)+(1023&o)+65536):(zR(t,i),r--)}else zR(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&&zR(t,jR(n));var u=t.length,c=u;for(u&&zR(t,"-");c<i;){var l=OR;for(r=0;r<e.length;r++)(n=e[r])>=o&&n<l&&(l=n);var d=c+1;if(l-o>VR((OR-a)/d))throw new BR(LR);for(a+=(l-o)*d,o=l,r=0;r<e.length;r++){if((n=e[r])<o&&++a>OR)throw new BR(LR);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;zR(t,jR(qR(g+m%p))),f=VR(m/p),h+=36}zR(t,jR(qR(f))),s=YR(a,d,c===u),a=0,c++}}a++,o++}return HR(t,"")},ZR=Iv,$R=_g,eM=qN,tM=qh,rM=Gp,nM=sg,iM=By,oM=Vy,aM=Gk,sM=zm,uM=WR,cM=LW,lM=bv,dM=AP.codeAt,fM=function(e){var t,r,n=[],i=JR(KR(QR(e),MR,"."),".");for(t=0;t<i.length;t++)r=i[t],zR(n,UR(RR,r)?"xn--"+XR(r):r);return HR(n,".")},hM=Ey,gM=dS,mM=Yk,pM=SR,vM=ES,_M=vM.set,yM=vM.getterFor("URL"),SM=pM.URLSearchParams,IM=pM.getState,bM=tM.URL,TM=tM.TypeError,CM=tM.parseInt,wM=Math.floor,kM=Math.pow,EM=nM("".charAt),xM=nM(/./.exec),AM=nM([].join),PM=nM(1.1.toString),DM=nM([].pop),FM=nM([].push),WM=nM("".replace),NM=nM([].shift),OM=nM("".split),RM=nM("".slice),MM=nM("".toLowerCase),LM=nM([].unshift),BM="Invalid scheme",UM="Invalid host",VM="Invalid port",jM=/[a-z]/i,GM=/[\d+-.a-z]/i,HM=/\d/,zM=/^0x/i,KM=/^[0-7]+$/,JM=/^\d+$/,QM=/^[\da-f]+$/i,qM=/[\0\t\n\r #%/:<>?@[\\\]^|]/,YM=/[\0\t\n\r #/:<>?@[\\\]^|]/,XM=/^[\u0000-\u0020]+/,ZM=/(^|[^\u0000-\u0020])[\u0000-\u0020]+$/,$M=/[\t\n\r]/g,eL=function(e){var t,r,n,i;if("number"==typeof e){for(t=[],r=0;r<4;r++)LM(t,e%256),e=wM(e/256);return AM(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+=PM(e[r],16),r<7&&(t+=":")));return"["+t+"]"}return e},tL={},rL=uM({},tL,{" ":1,'"':1,"<":1,">":1,"`":1}),nL=uM({},rL,{"#":1,"?":1,"{":1,"}":1}),iL=uM({},nL,{"/":1,":":1,";":1,"=":1,"@":1,"[":1,"\\":1,"]":1,"^":1,"|":1}),oL=function(e,t){var r=dM(e,0);return r>32&&r<127&&!sM(t,e)?e:encodeURIComponent(e)},aL={ftp:21,file:null,http:80,https:443,ws:80,wss:443},sL=function(e,t){var r;return 2===e.length&&xM(jM,EM(e,0))&&(":"===(r=EM(e,1))||!t&&"|"===r)},uL=function(e){var t;return e.length>1&&sL(RM(e,0,2))&&(2===e.length||"/"===(t=EM(e,2))||"\\"===t||"?"===t||"#"===t)},cL=function(e){return"."===e||"%2e"===MM(e)},lL=function(e){return".."===(e=MM(e))||"%2e."===e||".%2e"===e||"%2e%2e"===e},dL={},fL={},hL={},gL={},mL={},pL={},vL={},_L={},yL={},SL={},IL={},bL={},TL={},CL={},wL={},kL={},EL={},xL={},AL={},PL={},DL={},FL=function(e,t,r){var n,i,o,a=hM(e);if(t){if(i=this.parse(a))throw new TM(i);this.searchParams=null}else{if(r!==undefined&&(n=new FL(r,!0)),i=this.parse(a,null,n))throw new TM(i);(o=IM(new SM)).bindURL(this),this.searchParams=o}};FL.prototype={type:"URL",parse:function(e,t,r){var n,i,o,a,s=this,u=t||dL,c=0,l="",d=!1,f=!1,h=!1;for(e=hM(e),t||(s.scheme="",s.username="",s.password="",s.host=null,s.port=null,s.path=[],s.query=null,s.fragment=null,s.cannotBeABaseURL=!1,e=WM(e,XM,""),e=WM(e,ZM,"$1")),e=WM(e,$M,""),n=cM(e);c<=n.length;){switch(i=n[c],u){case dL:if(!i||!xM(jM,i)){if(t)return BM;u=hL;continue}l+=MM(i),u=fL;break;case fL:if(i&&(xM(GM,i)||"+"===i||"-"===i||"."===i))l+=MM(i);else{if(":"!==i){if(t)return BM;l="",u=hL,c=0;continue}if(t&&(s.isSpecial()!==sM(aL,l)||"file"===l&&(s.includesCredentials()||null!==s.port)||"file"===s.scheme&&!s.host))return;if(s.scheme=l,t)return void(s.isSpecial()&&aL[s.scheme]===s.port&&(s.port=null));l="","file"===s.scheme?u=CL:s.isSpecial()&&r&&r.scheme===s.scheme?u=gL:s.isSpecial()?u=_L:"/"===n[c+1]?(u=mL,c++):(s.cannotBeABaseURL=!0,FM(s.path,""),u=AL)}break;case hL:if(!r||r.cannotBeABaseURL&&"#"!==i)return BM;if(r.cannotBeABaseURL&&"#"===i){s.scheme=r.scheme,s.path=lM(r.path),s.query=r.query,s.fragment="",s.cannotBeABaseURL=!0,u=DL;break}u="file"===r.scheme?CL:pL;continue;case gL:if("/"!==i||"/"!==n[c+1]){u=pL;continue}u=yL,c++;break;case mL:if("/"===i){u=SL;break}u=xL;continue;case pL:if(s.scheme=r.scheme,i===yR)s.username=r.username,s.password=r.password,s.host=r.host,s.port=r.port,s.path=lM(r.path),s.query=r.query;else if("/"===i||"\\"===i&&s.isSpecial())u=vL;else if("?"===i)s.username=r.username,s.password=r.password,s.host=r.host,s.port=r.port,s.path=lM(r.path),s.query="",u=PL;else{if("#"!==i){s.username=r.username,s.password=r.password,s.host=r.host,s.port=r.port,s.path=lM(r.path),s.path.length--,u=xL;continue}s.username=r.username,s.password=r.password,s.host=r.host,s.port=r.port,s.path=lM(r.path),s.query=r.query,s.fragment="",u=DL}break;case vL:if(!s.isSpecial()||"/"!==i&&"\\"!==i){if("/"!==i){s.username=r.username,s.password=r.password,s.host=r.host,s.port=r.port,u=xL;continue}u=SL}else u=yL;break;case _L:if(u=yL,"/"!==i||"/"!==EM(l,c+1))continue;c++;break;case yL:if("/"!==i&&"\\"!==i){u=SL;continue}break;case SL:if("@"===i){d&&(l="%40"+l),d=!0,o=cM(l);for(var g=0;g<o.length;g++){var m=o[g];if(":"!==m||h){var p=oL(m,iL);h?s.password+=p:s.username+=p}else h=!0}l=""}else if(i===yR||"/"===i||"?"===i||"#"===i||"\\"===i&&s.isSpecial()){if(d&&""===l)return"Invalid authority";c-=cM(l).length+1,l="",u=IL}else l+=i;break;case IL:case bL:if(t&&"file"===s.scheme){u=kL;continue}if(":"!==i||f){if(i===yR||"/"===i||"?"===i||"#"===i||"\\"===i&&s.isSpecial()){if(s.isSpecial()&&""===l)return UM;if(t&&""===l&&(s.includesCredentials()||null!==s.port))return;if(a=s.parseHost(l))return a;if(l="",u=EL,t)return;continue}"["===i?f=!0:"]"===i&&(f=!1),l+=i}else{if(""===l)return UM;if(a=s.parseHost(l))return a;if(l="",u=TL,t===bL)return}break;case TL:if(!xM(HM,i)){if(i===yR||"/"===i||"?"===i||"#"===i||"\\"===i&&s.isSpecial()||t){if(""!==l){var v=CM(l,10);if(v>65535)return VM;s.port=s.isSpecial()&&v===aL[s.scheme]?null:v,l=""}if(t)return;u=EL;continue}return VM}l+=i;break;case CL:if(s.scheme="file","/"===i||"\\"===i)u=wL;else{if(!r||"file"!==r.scheme){u=xL;continue}switch(i){case yR:s.host=r.host,s.path=lM(r.path),s.query=r.query;break;case"?":s.host=r.host,s.path=lM(r.path),s.query="",u=PL;break;case"#":s.host=r.host,s.path=lM(r.path),s.query=r.query,s.fragment="",u=DL;break;default:uL(AM(lM(n,c),""))||(s.host=r.host,s.path=lM(r.path),s.shortenPath()),u=xL;continue}}break;case wL:if("/"===i||"\\"===i){u=kL;break}r&&"file"===r.scheme&&!uL(AM(lM(n,c),""))&&(sL(r.path[0],!0)?FM(s.path,r.path[0]):s.host=r.host),u=xL;continue;case kL:if(i===yR||"/"===i||"\\"===i||"?"===i||"#"===i){if(!t&&sL(l))u=xL;else if(""===l){if(s.host="",t)return;u=EL}else{if(a=s.parseHost(l))return a;if("localhost"===s.host&&(s.host=""),t)return;l="",u=EL}continue}l+=i;break;case EL:if(s.isSpecial()){if(u=xL,"/"!==i&&"\\"!==i)continue}else if(t||"?"!==i)if(t||"#"!==i){if(i!==yR&&(u=xL,"/"!==i))continue}else s.fragment="",u=DL;else s.query="",u=PL;break;case xL:if(i===yR||"/"===i||"\\"===i&&s.isSpecial()||!t&&("?"===i||"#"===i)){if(lL(l)?(s.shortenPath(),"/"===i||"\\"===i&&s.isSpecial()||FM(s.path,"")):cL(l)?"/"===i||"\\"===i&&s.isSpecial()||FM(s.path,""):("file"===s.scheme&&!s.path.length&&sL(l)&&(s.host&&(s.host=""),l=EM(l,0)+":"),FM(s.path,l)),l="","file"===s.scheme&&(i===yR||"?"===i||"#"===i))for(;s.path.length>1&&""===s.path[0];)NM(s.path);"?"===i?(s.query="",u=PL):"#"===i&&(s.fragment="",u=DL)}else l+=oL(i,nL);break;case AL:"?"===i?(s.query="",u=PL):"#"===i?(s.fragment="",u=DL):i!==yR&&(s.path[0]+=oL(i,tL));break;case PL:t||"#"!==i?i!==yR&&("'"===i&&s.isSpecial()?s.query+="%27":s.query+="#"===i?"%23":oL(i,tL)):(s.fragment="",u=DL);break;case DL:i!==yR&&(s.fragment+=oL(i,rL))}c++}},parseHost:function(e){var t,r,n;if("["===EM(e,0)){if("]"!==EM(e,e.length-1))return UM;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 EM(e,d)};if(":"===f()){if(":"!==EM(e,1))return;d+=2,l=++c}for(;f();){if(8===c)return;if(":"!==f()){for(t=r=0;r<4&&xM(QM,f());)t=16*t+CM(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(!xM(HM,f()))return;for(;xM(HM,f());){if(o=CM(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}(RM(e,1,-1)),!t)return UM;this.host=t}else if(this.isSpecial()){if(e=fM(e),xM(qM,e))return UM;if(t=function(e){var t,r,n,i,o,a,s,u=OM(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"===EM(i,0)&&(o=xM(zM,i)?16:8,i=RM(i,8===o?1:2)),""===i)a=0;else{if(!xM(10===o?JM:8===o?KM:QM,i))return e;a=CM(i,o)}FM(r,a)}for(n=0;n<t;n++)if(a=r[n],n===t-1){if(a>=kM(256,5-t))return null}else if(a>255)return null;for(s=DM(r),n=0;n<r.length;n++)s+=r[n]*kM(256,3-n);return s}(e),null===t)return UM;this.host=t}else{if(xM(YM,e))return UM;for(t="",r=cM(e),n=0;n<r.length;n++)t+=oL(r[n],tL);this.host=t}},cannotHaveUsernamePasswordPort:function(){return!this.host||this.cannotBeABaseURL||"file"===this.scheme},includesCredentials:function(){return""!==this.username||""!==this.password},isSpecial:function(){return sM(aL,this.scheme)},shortenPath:function(){var e=this.path,t=e.length;!t||"file"===this.scheme&&1===t&&sL(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+=eL(i),null!==o&&(c+=":"+o)):"file"===t&&(c+="//"),c+=e.cannotBeABaseURL?a[0]:a.length?"/"+AM(a,"/"):"",null!==s&&(c+="?"+s),null!==u&&(c+="#"+u),c},setHref:function(e){var t=this.parse(e);if(t)throw new TM(t);this.searchParams.update()},getOrigin:function(){var e=this.scheme,t=this.port;if("blob"===e)try{return new WL(e.path[0]).origin}catch(Ii){return"null"}return"file"!==e&&this.isSpecial()?e+"://"+eL(this.host)+(null!==t?":"+t:""):"null"},getProtocol:function(){return this.scheme+":"},setProtocol:function(e){this.parse(hM(e)+":",dL)},getUsername:function(){return this.username},setUsername:function(e){var t=cM(hM(e));if(!this.cannotHaveUsernamePasswordPort()){this.username="";for(var r=0;r<t.length;r++)this.username+=oL(t[r],iL)}},getPassword:function(){return this.password},setPassword:function(e){var t=cM(hM(e));if(!this.cannotHaveUsernamePasswordPort()){this.password="";for(var r=0;r<t.length;r++)this.password+=oL(t[r],iL)}},getHost:function(){var e=this.host,t=this.port;return null===e?"":null===t?eL(e):eL(e)+":"+t},setHost:function(e){this.cannotBeABaseURL||this.parse(e,IL)},getHostname:function(){var e=this.host;return null===e?"":eL(e)},setHostname:function(e){this.cannotBeABaseURL||this.parse(e,bL)},getPort:function(){var e=this.port;return null===e?"":hM(e)},setPort:function(e){this.cannotHaveUsernamePasswordPort()||(""===(e=hM(e))?this.port=null:this.parse(e,TL))},getPathname:function(){var e=this.path;return this.cannotBeABaseURL?e[0]:e.length?"/"+AM(e,"/"):""},setPathname:function(e){this.cannotBeABaseURL||(this.path=[],this.parse(e,EL))},getSearch:function(){var e=this.query;return e?"?"+e:""},setSearch:function(e){""===(e=hM(e))?this.query=null:("?"===EM(e,0)&&(e=RM(e,1)),this.query="",this.parse(e,PL)),this.searchParams.update()},getSearchParams:function(){return this.searchParams.facade},getHash:function(){var e=this.fragment;return e?"#"+e:""},setHash:function(e){""!==(e=hM(e))?("#"===EM(e,0)&&(e=RM(e,1)),this.fragment="",this.parse(e,DL)):this.fragment=null},update:function(){this.query=this.searchParams.serialize()||null}};var WL=function(e){var t=aM(this,NL),r=mM(arguments.length,1)>1?arguments[1]:undefined,n=_M(t,new FL(e,!1,r));$R||(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())},NL=WL.prototype,OL=function(e,t){return{get:function(){return yM(this)[e]()},set:t&&function(e){return yM(this)[t](e)},configurable:!0,enumerable:!0}};if($R&&(oM(NL,"href",OL("serialize","setHref")),oM(NL,"origin",OL("getOrigin")),oM(NL,"protocol",OL("getProtocol","setProtocol")),oM(NL,"username",OL("getUsername","setUsername")),oM(NL,"password",OL("getPassword","setPassword")),oM(NL,"host",OL("getHost","setHost")),oM(NL,"hostname",OL("getHostname","setHostname")),oM(NL,"port",OL("getPort","setPort")),oM(NL,"pathname",OL("getPathname","setPathname")),oM(NL,"search",OL("getSearch","setSearch")),oM(NL,"searchParams",OL("getSearchParams")),oM(NL,"hash",OL("getHash","setHash"))),iM(NL,"toJSON",function(){return yM(this).serialize()},{enumerable:!0}),iM(NL,"toString",function(){return yM(this).serialize()},{enumerable:!0}),bM){var RL=bM.createObjectURL,ML=bM.revokeObjectURL;RL&&iM(WL,"createObjectURL",rM(RL,bM)),ML&&iM(WL,"revokeObjectURL",rM(ML,bM))}gM(WL,"URL"),ZR({global:!0,constructor:!0,forced:!eM,sham:!$R},{URL:WL});var LL=Iv,BL=Yh,UL=Yk,VL=Ey,jL=qN,GL=Qg("URL"),HL=jL&&BL(function(){GL.canParse()}),zL=BL(function(){return 1!==GL.canParse.length});LL({target:"URL",stat:!0,forced:!HL||zL},{canParse:function(e){var t=UL(arguments.length,1),r=VL(e),n=t<2||arguments[1]===undefined?undefined:VL(arguments[1]);try{return!!new GL(r,n)}catch(Ii){return!1}}});var KL=Iv,JL=Yk,QL=Ey,qL=qN,YL=Qg("URL");KL({target:"URL",stat:!0,forced:!qL},{parse:function(e){var t=JL(arguments.length,1),r=QL(e),n=t<2||arguments[1]===undefined?undefined:QL(arguments[1]);try{return new YL(r,n)}catch(Ii){return null}}});var XL=E(Gg.URL),ZL=E(bW),$L=Iv,eB=E_.indexOf,tB=rN,rB=gg([].indexOf),nB=!!rB&&1/rB([1],1,-0)<0;$L({target:"Array",proto:!0,forced:nB||!tB("indexOf")},{indexOf:function(e){var t=arguments.length>1?arguments[1]:undefined;return nB?rB(this,e,t)||0:eB(this,e,t)}});var iB=sD("Array","indexOf"),oB=qg,aB=iB,sB=Array.prototype,uB=function(e){var t=e.indexOf;return e===sB||oB(sB,e)&&t===sB.indexOf?aB:t},cB=E(uB),lB=vm,dB=TypeError,fB=Iv,hB=jm,gB=__,mB=g_,pB=b_,vB=zF,_B=BD,yB=RS,SB=NT,IB=function(e,t){if(!delete e[t])throw new dB("Cannot delete property "+lB(t)+" of "+lB(e))},bB=GD("splice"),TB=Math.max,CB=Math.min;fB({target:"Array",proto:!0,forced:!bB},{splice:function(e,t){var r,n,i,o,a,s,u=hB(this),c=pB(u),l=gB(e,c),d=arguments.length;for(0===d?r=n=0:1===d?(r=0,n=c-l):(r=d-2,n=CB(TB(mB(t),0),c-l)),_B(c+r-n),i=yB(u,n),o=0;o<n;o++)(a=l+o)in u&&SB(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]:IB(u,s);for(o=c;o>c-n+r;o--)IB(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]:IB(u,s);for(o=0;o<r;o++)u[o+l]=arguments[o+2];return vB(u,c-n+r),i}});var wB=sD("Array","splice"),kB=qg,EB=wB,xB=Array.prototype,AB=function(e){var t=e.splice;return e===xB||kB(xB,e)&&t===xB.splice?EB:t},PB=E(AB),DB=Iv,FB=HS.findIndex,WB="findIndex",NB=!0;WB in[]&&Array(1)[WB](function(){NB=!1}),DB({target:"Array",proto:!0,forced:NB},{findIndex:function(e){return FB(this,e,arguments.length>1?arguments[1]:undefined)}});var OB=sD("Array","findIndex"),RB=qg,MB=OB,LB=Array.prototype,BB=function(e){var t=e.findIndex;return e===LB||RB(LB,e)&&t===LB.findIndex?MB:t},UB=E(BB),VB=_g,jB=Yh,GB=sg,HB=tC,zB=L_,KB=Ug,JB=GB(bg.f),QB=GB([].push),qB=VB&&jB(function(){var e=Object.create(null);return e[2]=2,!JB(e,2)}),YB=function(e){return function(t){for(var r,n=KB(t),i=zB(n),o=qB&&null===HB(n),a=i.length,s=0,u=[];a>s;)r=i[s++],VB&&!(o?r in n:JB(n,r))||QB(u,e?[r,n[r]]:n[r]);return u}},XB={entries:YB(!0),values:YB(!1)}.entries;Iv({target:"Object",stat:!0},{entries:function(e){return XB(e)}});var ZB=E(Gg.Object.entries),$B=E(HP),eU=Iv,tU=HS.find,rU="find",nU=!0;rU in[]&&Array(1)[rU](function(){nU=!1}),eU({target:"Array",proto:!0,forced:nU},{find:function(e){return tU(this,e,arguments.length>1?arguments[1]:undefined)}});var iU=sD("Array","find"),oU=qg,aU=iU,sU=Array.prototype,uU=function(e){var t=e.find;return e===sU||oU(sU,e)&&t===sU.find?aU:t},cU=E(uU),lU=HS.filter;Iv({target:"Array",proto:!0,forced:!GD("filter")},{filter:function(e){return lU(this,e,arguments.length>1?arguments[1]:undefined)}});var dU=sD("Array","filter"),fU=qg,hU=dU,gU=Array.prototype,mU=function(e){var t=e.filter;return e===gU||fU(gU,e)&&t===gU.filter?hU:t},pU=E(mU),vU=HS.map;Iv({target:"Array",proto:!0,forced:!GD("map")},{map:function(e){return vU(this,e,arguments.length>1?arguments[1]:undefined)}});var _U=sD("Array","map"),yU=qg,SU=_U,IU=Array.prototype,bU=function(e){var t=e.map;return e===IU||yU(IU,e)&&t===IU.map?SU:t},TU=E(bU),CU=E_.includes;Iv({target:"Array",proto:!0,forced:Yh(function(){return!Array(1).includes()})},{includes:function(e){return CU(this,e,arguments.length>1?arguments[1]:undefined)}});var wU=sD("Array","includes"),kU=jg,EU=dg,xU=op("match"),AU=function(e){var t;return kU(e)&&((t=e[xU])!==undefined?!!t:"RegExp"===EU(e))},PU=TypeError,DU=op("match"),FU=Iv,WU=function(e){if(AU(e))throw new PU("The method doesn't accept regular expressions");return e},NU=Mg,OU=Ey,RU=function(e){var t=/./;try{"/./"[e](t)}catch(r){try{return t[DU]=!1,"/./"[e](t)}catch(n){}}return!1},MU=sg("".indexOf);FU({target:"String",proto:!0,forced:!RU("includes")},{includes:function(e){return!!~MU(OU(NU(this)),OU(WU(e)),arguments.length>1?arguments[1]:undefined)}});var LU=sD("String","includes"),BU=qg,UU=wU,VU=LU,jU=Array.prototype,GU=String.prototype,HU=function(e){var t=e.includes;return e===jU||BU(jU,e)&&t===jU.includes?UU:"string"==typeof e||e===GU||BU(GU,e)&&t===GU.includes?VU:t},zU=E(HU),KU="\t\n\x0B\f\r                　\u2028\u2029\ufeff",JU=Mg,QU=Ey,qU=KU,YU=sg("".replace),XU=RegExp("^["+qU+"]+"),ZU=RegExp("(^|[^"+qU+"])["+qU+"]+$"),$U=function(e){return function(t){var r=QU(JU(t));return 1&e&&(r=YU(r,XU,"")),2&e&&(r=YU(r,ZU,"$1")),r}},eV={start:$U(1),end:$U(2),trim:$U(3)},tV=qh,rV=Yh,nV=sg,iV=Ey,oV=eV.trim,aV=KU,sV=tV.parseInt,uV=tV.Symbol,cV=uV&&uV.iterator,lV=/^[+-]?0x/i,dV=nV(lV.exec),fV=8!==sV(aV+"08")||22!==sV(aV+"0x16")||cV&&!rV(function(){sV(Object(cV))})?function(e,t){var r=oV(iV(e));return sV(r,t>>>0||(dV(lV,r)?16:10))}:sV;Iv({global:!0,forced:parseInt!==fV},{parseInt:fV});var hV=E(Gg.parseInt),gV=E(UW),mV=sD("Array","keys"),pV=jv,vV=zm,_V=qg,yV=mV,SV=Array.prototype,IV={DOMTokenList:!0,NodeList:!0},bV=function(e){var t=e.keys;return e===SV||_V(SV,e)&&t===SV.keys||vV(IV,pV(e))?yV:t},TV=E(bV),CV={exports:{}},wV=Yh(function(){if("function"==typeof ArrayBuffer){var e=new ArrayBuffer(8);Object.isExtensible(e)&&Object.defineProperty(e,"a",{value:8})}}),kV=Yh,EV=jg,xV=dg,AV=wV,PV=Object.isExtensible,DV=kV(function(){PV(1)})||AV?function(e){return!!EV(e)&&((!AV||"ArrayBuffer"!==xV(e))&&(!PV||PV(e)))}:PV,FV=!Yh(function(){return Object.isExtensible(Object.preventExtensions({}))}),WV=Iv,NV=sg,OV=x_,RV=jg,MV=zm,LV=Hp.f,BV=xy,UV=Dy,VV=DV,jV=FV,GV=!1,HV=Ym("meta"),zV=0,KV=function(e){LV(e,HV,{value:{objectID:"O"+zV++,weakData:{}}})},JV=CV.exports={enable:function(){JV.enable=function(){},GV=!0;var e=BV.f,t=NV([].splice),r={};r[HV]=1,e(r).length&&(BV.f=function(r){for(var n=e(r),i=0,o=n.length;i<o;i++)if(n[i]===HV){t(n,i,1);break}return n},WV({target:"Object",stat:!0,forced:!0},{getOwnPropertyNames:UV.f}))},fastKey:function(e,t){if(!RV(e))return"symbol"==_(e)?e:("string"==typeof e?"S":"P")+e;if(!MV(e,HV)){if(!VV(e))return"F";if(!t)return"E";KV(e)}return e[HV].objectID},getWeakData:function(e,t){if(!MV(e,HV)){if(!VV(e))return!0;if(!t)return!1;KV(e)}return e[HV].weakData},onFreeze:function(e){return jV&&GV&&VV(e)&&!MV(e,HV)&&KV(e),e}};OV[HV]=!0;var QV=CV.exports,qV=Iv,YV=qh,XV=QV,ZV=Yh,$V=cv,ej=dw,tj=Gk,rj=pg,nj=jg,ij=Ng,oj=dS,aj=Hp.f,sj=HS.forEach,uj=_g,cj=ES.set,lj=ES.getterFor,dj=cy,fj=Vy,hj=XN,gj=Gp,mj=Gk,pj=Ng,vj=dw,_j=pk,yj=vk,Sj=Uk,Ij=_g,bj=QV.fastKey,Tj=ES.set,Cj=ES.getterFor,wj={getConstructor:function(e,t,r,n){var i=e(function(e,i){mj(e,o),Tj(e,{type:t,index:dj(null),first:null,last:null,size:0}),Ij||(e.size=0),pj(i)||vj(i,e[n],{that:e,AS_ENTRIES:r})}),o=i.prototype,a=Cj(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=bj(t,!0),key:t,value:r,previous:n=o.last,next:null,removed:!1},o.first||(o.first=s),n&&(n.next=s),Ij?o.size++:e.size++,"F"!==i&&(o.index[i]=s)),e},u=function(e,t){var r,n=a(e),i=bj(t);if("F"!==i)return n.index[i];for(r=n.first;r;r=r.next)if(r.key===t)return r};return hj(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=dj(null),Ij?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),Ij?r.size--:t.size--}return!!n},forEach:function(e){for(var t,r=a(this),n=gj(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)}}),hj(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)}}),Ij&&fj(o,"size",{configurable:!0,get:function(){return a(this).size}}),i},setStrong:function(e,t,r){var n=t+" Iterator",i=Cj(t),o=Cj(n);_j(e,t,function(e,t){Tj(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)?yj("keys"===t?r.key:"values"===t?r.value:[r.key,r.value],!1):(e.target=null,yj(undefined,!0))},r?"entries":"values",!r,!0),Sj(t)}},kj=function(e,t,r){var n,i=-1!==e.indexOf("Map"),o=-1!==e.indexOf("Weak"),a=i?"set":"add",s=YV[e],u=s&&s.prototype,c={};if(uj&&rj(s)&&(o||u.forEach&&!ZV(function(){(new s).entries().next()}))){var l=(n=t(function(t,r){cj(tj(t,l),{type:e,collection:new s}),ij(r)||ej(r,t[a],{that:t,AS_ENTRIES:i})})).prototype,d=lj(e);sj(["add","clear","delete","forEach","get","has","set","keys","values","entries"],function(e){var t="add"===e||"set"===e;!(e in u)||o&&"clear"===e||$V(l,e,function(r,n){var i=d(this).collection;if(!t&&o&&!nj(r))return"get"===e&&undefined;var a=i[e](0===r?0:r,n);return t?this:a})}),o||aj(l,"size",{configurable:!0,get:function(){return d(this).collection.size}})}else n=r.getConstructor(t,e,i,a),XV.enable();return oj(n,e,!1,!0),c[e]=n,qV({global:!0,forced:!0},c),o||r.setStrong(n,e,i),n};kj("Set",function(e){return function(){return e(this,arguments.length?arguments[0]:undefined)}},wj);var Ej=vm,xj=TypeError,Aj=function(e){if("object"==_(e)&&"size"in e&&"has"in e&&"add"in e&&"delete"in e&&"keys"in e)return e;throw new xj(Ej(e)+" is not a set")},Pj=function(e,t){return 1===t?function(t,r){return t[e](r)}:function(t,r,n){return t[e](r,n)}},Dj=Qg("Set"),Fj=Dj.prototype,Wj={Set:Dj,add:Pj("add",1),has:Pj("has",1),remove:Pj("delete",1),proto:Fj},Nj=Ig,Oj=function(e,t,r){for(var n,i,o=r?e:e.iterator,a=e.next;!(n=Nj(a,o)).done;)if((i=t(n.value))!==undefined)return i},Rj=Oj,Mj=function(e,t,r){return r?Rj(e.keys(),t,!0):e.forEach(t)},Lj=Mj,Bj=Wj.Set,Uj=Wj.add,Vj=function(e){var t=new Bj;return Lj(e,function(e){Uj(t,e)}),t},jj=function(e){return e.size},Gj=Im,Hj=qp,zj=Ig,Kj=g_,Jj=function(e){return{iterator:e,next:e.next,done:!1}},Qj="Invalid size",qj=RangeError,Yj=TypeError,Xj=Math.max,Zj=function(e,t){this.set=e,this.size=Xj(t,0),this.has=Gj(e.has),this.keys=Gj(e.keys)};Zj.prototype={getIterator:function(){return Jj(Hj(zj(this.keys,this.set)))},includes:function(e){return zj(this.has,this.set,e)}};var $j=function(e){Hj(e);var t=+e.size;if(t!=t)throw new Yj(Qj);var r=Kj(t);if(r<0)throw new qj(Qj);return new Zj(e,r)},eG=Aj,tG=Vj,rG=jj,nG=$j,iG=Mj,oG=Oj,aG=Wj.has,sG=Wj.remove,uG=function(){return!1},cG=function(e){var t=eG(this),r=nG(e),n=tG(t);return rG(t)<=r.size?iG(t,function(e){r.includes(e)&&sG(n,e)}):oG(r.getIterator(),function(e){aG(n,e)&&sG(n,e)}),n};Iv({target:"Set",proto:!0,real:!0,forced:!uG()},{difference:cG});var lG=Aj,dG=jj,fG=$j,hG=Mj,gG=Oj,mG=Wj.Set,pG=Wj.add,vG=Wj.has,_G=function(e){var t=lG(this),r=fG(e),n=new mG;return dG(t)>r.size?gG(r.getIterator(),function(e){vG(t,e)&&pG(n,e)}):hG(t,function(e){r.includes(e)&&pG(n,e)}),n};Iv({target:"Set",proto:!0,real:!0,forced:!uG()},{intersection:_G});var yG=Aj,SG=Wj.has,IG=jj,bG=$j,TG=Mj,CG=Oj,wG=XC,kG=function(e){var t=yG(this),r=bG(e);if(IG(t)<=r.size)return!1!==TG(t,function(e){if(r.includes(e))return!1},!0);var n=r.getIterator();return!1!==CG(n,function(e){if(SG(t,e))return wG(n,"normal",!1)})};Iv({target:"Set",proto:!0,real:!0,forced:!uG()},{isDisjointFrom:kG});var EG=Aj,xG=jj,AG=Mj,PG=$j,DG=function(e){var t=EG(this),r=PG(e);return!(xG(t)>r.size)&&!1!==AG(t,function(e){if(!r.includes(e))return!1},!0)};Iv({target:"Set",proto:!0,real:!0,forced:!uG()},{isSubsetOf:DG});var FG=Aj,WG=Wj.has,NG=jj,OG=$j,RG=Oj,MG=XC,LG=function(e){var t=FG(this),r=OG(e);if(NG(t)<r.size)return!1;var n=r.getIterator();return!1!==RG(n,function(e){if(!WG(t,e))return MG(n,"normal",!1)})};Iv({target:"Set",proto:!0,real:!0,forced:!uG()},{isSupersetOf:LG});var BG=Aj,UG=Vj,VG=$j,jG=Oj,GG=Wj.add,HG=Wj.has,zG=Wj.remove,KG=function(e){var t=BG(this),r=VG(e).getIterator(),n=UG(t);return jG(r,function(e){HG(t,e)?zG(n,e):GG(n,e)}),n};Iv({target:"Set",proto:!0,real:!0,forced:!uG()},{symmetricDifference:KG});var JG=Aj,QG=Wj.add,qG=Vj,YG=$j,XG=Oj,ZG=function(e){var t=JG(this),r=YG(e).getIterator(),n=qG(t);return XG(r,function(e){QG(n,e)}),n};Iv({target:"Set",proto:!0,real:!0,forced:!uG()},{union:ZG});var $G=E(Gg.Set),eH=E(WD);function tH(e,t){var r=DN(e);if(gT){var n=gT(e);t&&(n=pU(n).call(n,function(t){return CT(e,t).enumerable})),r.push.apply(r,n)}return r}function rH(e){for(var t=1;t<arguments.length;t++){var r,n,i=null!=arguments[t]?arguments[t]:{};t%2?xN(r=tH(Object(i),!0)).call(r,function(t){XW(e,t,i[t])}):BT?KT(e,BT(i)):xN(n=tH(Object(i))).call(n,function(t){eH(e,t,CT(i,t))})}return e}function nH(e){var t=function(){if("undefined"==typeof Reflect||!Cy)return!1;if(Cy.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Cy(Boolean,[],function(){})),!0}catch(TH){return!1}}();return function(){var r,n=bD(e);if(t){var i=bD(this).constructor;r=Cy(n,arguments,i)}else r=n.apply(this,arguments);return function(e,t){if(t&&("object"==MF(t)||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return qP(e)}(this,r)}}var iH=function(e){return EN?EN(e):"[object Array]"===function(e){return Object.prototype.toString.call(e)}(e)},oH=function(e){return void 0===e},aH=function(e,t){var r,n;e=null!==(r=e)&&void 0!==r?r:"yyyy-MM-dd hh:mm:ss";var i=oH(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))),xN(n=DN(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},sH=function(e){return"string"==typeof e},uH=function(e){return"number"==typeof e&&!FN(e)},cH=function(e){return"function"==typeof e},lH=0,dH=function(){var e;return lH+=1,LN(e="".concat((new Date).getTime().toString(36))).call(e,lH.toString(36))};!function(e,t){for(var r=DN(e),n=0;n<r.length;n++){var i=r[n];if(!1===t.call(null,e[i],i,e))break}}({"&amp;":"&","&gt;":">","&lt;":"<","&nbsp;":" ","&quot;":'"',"&#x27;":"'"},function(e,t){}),function(e,t){for(var r=DN(e),n=0;n<r.length;n++){var i=r[n];if(!1===t.call(null,e[i],i,e))break}}({"&amp;":"&","&gt;":">","&lt;":"<","&nbsp;":" ","&quot;":'"',"&#x27;":"'"},function(e,t){});var fH=function(e){var t=XL||window.webkitURL;/^blob:/.test(e)&&t.revokeObjectURL(e)},hH=function(){function e(){var t=arguments.length>0&&arguments[0]!==undefined?arguments[0]:"",r=arguments.length>1&&arguments[1]!==undefined?arguments[1]:"";KW(this,e),XW(this,"prefix",void 0),XW(this,"postfix",void 0),XW(this,"isDestroyed",!1),XW(this,"uid",dH()),XW(this,"cacheEvents",void 0),XW(this,"events",void 0),XW(this,"isCached",void 0),this.cacheEvents=[],this.events={},this.isCached=!1,this.prefix=t,this.postfix=r}return YW(e,[{key:"save",value:function(){this.isCached=!0}},{key:"restore",value:function(){var e,t=this;this.isCached=!1,xN(e=this.cacheEvents).call(e,function(e){var r,n=e.eventName,i=e.param;t.emit.apply(t,LN(r=[n]).call(r,zW(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&&xN(r=ZL(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:dH(),context:r,once:i,fn:t};return o[e]||(o[e]=[]),cB(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||(xN(t=ZL(s).call(s)).call(t,function(e){var t,r=e.fn,n=e.context;r.call.apply(r,LN(t=[n||null]).call(t,o))}),xN(r=ZL(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||PB(i).call(i,o,1)}return!0}},{key:"removeAllEventListeners",value:function(e){if(e){var t,r;e=this.format(e);var n=UB(t=this.cacheEvents).call(t,function(t){return t.eventName===e});n>-1&&PB(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 LN(t=LN(r="".concat(this.prefix||"")).call(r,e)).call(t,this.postfix||"")}}],[{key:"create",value:function(t,r){return new e(t,r)}}]),e}(),gH="default",mH=function(){function e(){KW(this,e),XW(this,"emitter",new hH)}return YW(e,[{key:"on",value:function(e){this.emitter.on(gH,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,LN(t=[gH]).call(t,n))}},{key:"off",value:function(e){this.emitter.off(gH,e)}}],[{key:"create",value:function(){return new e}}]),e}(),pH=function(){function e(t){KW(this,e),XW(this,"uid",void 0),XW(this,"children",void 0),this.uid=t.uid,this.children=t.children||[]}return YW(e,[{key:"append",value:function(e){var t=this.children;return cB(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),PB(r).call(r,t,0,e),0))}},{key:"remove",value:function(e){var t=this.children,r=cB(t).call(t,e);return!(r<0||(PB(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=HW(PB(r).call(r,e,1),1)[0];return PB(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}(),vH=function(){function e(t,r){KW(this,e),XW(this,"isDestroyed",!1),XW(this,"data",void 0),XW(this,"table",["database","table","item"]),XW(this,"dbName",void 0),XW(this,"tableName",void 0),this.data={},this.dbName=t,this.tableName=r,this.createDatabase(t,r)}return YW(e,[{key:"destroy",value:function(){if(!this.isDestroyed){for(var e=0,t=ZB(this.data);e<t.length;e++){var r=HW(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 $B(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 $B(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 $B(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 $B(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 LN(r="The ".concat(this.table[e]," ")).call(r,t," does not exist.")}}]),e}(),_H=function(){function e(){KW(this,e),XW(this,"isDestroyed",!1),XW(this,"data",void 0),this.data={}}return YW(e,[{key:"destroy",value:function(){if(!this.isDestroyed){for(var e=0,t=ZB(this.data);e<t.length;e++){var r,n=HW(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}(),yH=function(e){MD(r,e);var t=nH(r);function r(e){var n;return KW(this,r),XW(qP(n=t.call(this,e)),"name",void 0),XW(qP(n),"type",void 0),XW(qP(n),"fileType",void 0),XW(qP(n),"createdDate",void 0),XW(qP(n),"modifiedDate",void 0),XW(qP(n),"parent",void 0),XW(qP(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=aH(),n.modifiedDate=n.createdDate,n}return YW(r,[{key:"updateDate",value:function(){this.modifiedDate=aH()}},{key:"setName",value:function(e){this.name=e}},{key:"reorder",value:function(e){var t=this.type;return("file"===t||"default"===t)&&TD(bD(r.prototype),"reorder",this).call(this,e)}}]),r}(pH),SH=function(){function e(){KW(this,e),XW(this,"root",void 0),XW(this,"currentNode",void 0),XW(this,"selectedUid",void 0),XW(this,"defaultNode",void 0),XW(this,"hooks",{fileChanged:mH.create(),beforeRemoveFile:mH.create(),removeFile:mH.create(),afterRemoveFile:mH.create(),afterRenameFile:mH.create(),destroy:mH.create()}),this.root=new yH({uid:dH(),children:[],name:"root",type:"file",fileType:"folder",parent:void 0,isRoot:!0}),this.defaultNode=this.root,this.currentNode=this.root}return YW(e,[{key:"appendChildrenToFile",value:function(e,t,r){var n=r,i=IH(this.defaultNode,e);return i||(i=this.createFile(e),this.hooks.fileChanged.emit(this.defaultNode)),xN(t).call(t,function(e){oH(n)?i.append(e):(i.insert(e,n),n+=1)}),i}},{key:"removeChildFromFile",value:function(e,t){sH(t)&&(t=[t]);var r=this.getFileByUid(e);r&&xN(t).call(t,function(e){r.remove(e)})}},{key:"findChild",value:function(e,t){var r;return cU(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=IH(t,e);return r&&"file"===r.type||(r=new yH({uid:dH(),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),PB(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 cU(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=cU(this).call(this,e,r[i]);if(o)return o}}return null}}]),e}();function IH(e,t){var r,n=pU(r=e.children).call(r,function(e){return e.name===t});return 0===n.length?null:n[0]}var bH,TH,CH=function(e){MD(r,e);var t=nH(r);function r(e){var n;return KW(this,r),XW(qP(n=t.call(this,e)),"name",void 0),XW(qP(n),"type","tag"),n.name=e.name,n.uid=e.uid||dH(),n.type="tag",n}return YW(r)}(pH),wH=function(){function e(){KW(this,e),XW(this,"tags",void 0),XW(this,"defaultName",void 0),XW(this,"defaultUid",void 0),XW(this,"selectedUid",void 0),XW(this,"emptyItem",void 0),XW(this,"hooks",{beforeRemoveTag:mH.create(),afterRenameTag:mH.create(),destroy:mH.create(),load:mH.create()}),this.tags=[],this.defaultName=null,this.defaultUid=null,this.selectedUid=null,this.emptyItem=new CH({name:"defaultTag",children:[]})}return YW(e,[{key:"appendChildToTag",value:function(e,t){var r=this.createTag(e);sH(t)&&(t=[t]);var n=!1;return xN(t).call(t,function(e){r.append(e)&&(n=!0)}),n}},{key:"removeChildFromTag",value:function(e,t){var r=this.getTag(e);return!!r&&(sH(t)&&(t=[t]),xN(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 CH({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=UB(t=this.tags).call(t,function(t){return t.name===e});return e===this.defaultName&&(this.defaultName=null,this.selectedUid=null),PB(r=this.tags).call(r,i,1),!0}},{key:"renameTag",value:function(e,t){if(!sH(e)||!sH(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 cU(t=this.tags).call(t,function(t){return t.name===e})}},{key:"getTagByUid",value:function(e){var t;return cU(t=this.tags).call(t,function(t){return t.uid===e})}},{key:"getTagList",value:function(){var e;return ZL(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}(),kH=function(){function e(){KW(this,e)}return YW(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",rH({},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}(),EH=function(){function e(){KW(this,e)}return YW(e,[{key:"apply",value:function(e){var t=e.hooks;e.customStore=new _H;var r=function(t){var r=t.data;xN(r).call(r,function(t){var r=t.customData;r||(r={}),e.customStore.set(t.uid,r)})},n=function(t){var r=t.removedUids;xN(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}(),xH=function(e){MD(r,e);var t=nH(r);function r(){var e;return KW(this,r),XW(qP(e=t.call(this,{uid:dH(),children:[]})),"name","dvs-default"),XW(qP(e),"isDestroyed",!1),XW(qP(e),"type",void 0),e}return YW(r,[{key:"destroy",value:function(){this.isDestroyed||(this.isDestroyed=!0)}}]),r}(pH),AH=function(){function e(){KW(this,e)}return YW(e,[{key:"apply",value:function(e){e.defaultFile=new xH;var t=e.hooks,r=function(t){var r,n,i,o=t.filename,a=t.index,s=t.data;if(oH(o)){var u=TU(s).call(s,function(e){return e.uid});void 0===a?(r=e.defaultFile.children).push.apply(r,zW(u)):PB(n=e.defaultFile.children).apply(n,LN(i=[a,0]).call(i,zW(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=[];xN(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}(),PH=function(){function e(){KW(this,e)}return YW(e,[{key:"apply",value:function(e){e.dir=new SH,this.listenDirectoryHooks(e),this.listenSpaceHooks(e)}},{key:"listenDirectoryHooks",value:function(e){var t=e.dir.hooks,r=function(t){var r;xN(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(!oH(n)){var o=e.dir.getFile(n);e.hooks.beforeBufferChanged.emit({docType:"file",docUid:null==o?void 0:o.uid,uids:zW((null==o?void 0:o.children)||[]),operation:"add"});var a=TU(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:zW((null==s?void 0:s.children)||[]),operation:"add"})}},n=function(t){var r=t.removedUids,n={};xN(r).call(r,function(t){var r,i,o=e.statusStore.get(t);o&&xN(r=ZL(i=o.ownerFiles.children).call(i)).call(r,function(e){n[e]||(n[e]=[]),n[e].push(t)})});for(var i=0,o=ZB(n);i<o.length;i++){var a=HW(o[i],2),s=a[0],u=a[1],c=e.dir.getFileByUid(s);c&&(e.hooks.beforeBufferChanged.emit({docUid:s,uids:zW(c.children),removedUids:zW(u),operation:"remove"}),e.dir.removeChildFromFile(s,u),e.hooks.afterBufferChanged.emit({docType:"file",docName:c.name,docUid:s,uids:zW(c.children),removedUids:zW(u),operation:"remove"})),e.hooks.removeFromDoc.emit({docUid:s,sourceUids:u})}},i=function(t){var r,n,i=e.statusStore.get(t.modifiedUid);i&&xN(r=ZL(n=i.ownerFiles.children).call(n)).call(r,function(r){var n=e.dir.getFileByUid(r);n&&(e.hooks.beforeBufferChanged.emit({uids:zW(n.children),modifiedUid:t.modifiedUid,operation:"modify"}),e.hooks.afterBufferChanged.emit({docType:"file",docName:n.name,docUid:r,uids:zW(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}(),DH=function(){function e(){KW(this,e)}return YW(e,[{key:"apply",value:function(e){var t=e.hooks;e.metadataStore=new _H;var r=function(t){var r=t.data;xN(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;xN(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}(),FH=function(){function e(t){KW(this,e),XW(this,"uid",null),XW(this,"minData",null),XW(this,"oriData",null),XW(this,"customData",{}),XW(this,"activeOri",!1),XW(this,"activeMin",!1),XW(this,"minTask",null),XW(this,"oriTask",null),XW(this,"load",!1),XW(this,"preload",[]),XW(this,"visible",[]),XW(this,"overlays",[]),XW(this,"img",null),XW(this,"minImg",null),XW(this,"imageScale",1),XW(this,"owners",[]),XW(this,"oriType",null),XW(this,"minType",null),XW(this,"metadata",null),XW(this,"realTimeWidth",0),XW(this,"realTimeHeight",0),XW(this,"isFromFile",!1),XW(this,"isCached",!1),XW(this,"isDestroyed",!1),XW(this,"isLoading",!1),XW(this,"isMinLoading",!1),XW(this,"isSaving",!1),XW(this,"annotations",void 0),XW(this,"ownerFiles",new pH({children:[]})),XW(this,"ownerTags",new pH({children:[]})),XW(this,"ownerDefaultFile",void 0),XW(this,"operations",[]),XW(this,"useFillColor",!1),this.uid=t.uid,this.metadata=rH({},t.metadata),this.setRealTimeSize(this.metadata.width,this.metadata.height)}return YW(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;cB(t).call(t,e)<0&&t.push(e)}},{key:"removeOwner",value:function(e){var t=this.owners,r=cB(t).call(t,e);r>-1&&PB(t).call(t,r,1)}},{key:"removeViewer",value:function(e){var t=this.owners,r=cB(t).call(t,e);r>-1&&PB(t).call(t,r,1)}},{key:"setVisible",value:function(e){var t;cB(t=this.visible).call(t,e)<0&&this.visible.push(e)}},{key:"cancelVisible",value:function(e){var t,r,n=cB(t=this.visible).call(t,e);n>-1&&PB(r=this.visible).call(r,n,1)}},{key:"setPreload",value:function(e){var t;cB(t=this.preload).call(t,e)<0&&this.preload.push(e)}},{key:"cancelPreload",value:function(e){var t,r,n=cB(t=this.preload).call(t,e);n>-1&&PB(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}(),WH=function(){function e(){KW(this,e)}return YW(e,[{key:"apply",value:function(e){var t=e.hooks;e.statusStore=new _H;var r=function(t){var r=t.data;t.filename,t.index,xN(r).call(r,function(t){var r=new FH(t);e.statusStore.set(t.uid,r)})},n=function(t){var r=t.removedUids;xN(r).call(r,function(t){var r,n,i=e.statusStore.get(t);i&&(fH(i.minData),fH(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=rH({},a),o.setRealTimeSize(a.width,a.height)),i&&(fH(o.oriData),fH(o.minData)),o.reset(),e.statusStore.update(r,o)}},o=function(t){var r;xN(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;xN(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;xN(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}(),NH=function(){function e(){KW(this,e)}return YW(e,[{key:"apply",value:function(e){var t=e.hooks;e.store=new vH("space_db","space_doc");var r=function(t){var r=t.data;r&&xN(r).call(r,function(t){e.store.set(t.uid,t)})},n=function(t){var r;xN(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}(),OH=function(){function e(){KW(this,e)}return YW(e,[{key:"apply",value:function(e){e.tag=new wH,this.listenSpaceHooks(e),this.listenTagHooks(e)}},{key:"listenTagHooks",value:function(e){var t=e.tag.hooks,r=function(t){var r;xN(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;xN(r).call(r,function(e){var t;(e.tags||(e.tags=[]),n)&&(cB(t=e.tags).call(t,n)<0&&e.tags.push(n))})},n=function(t){var r=t.data;xN(r).call(r,function(t){var r;null===(r=t.tags)||void 0===r||xN(r).call(r,function(r){var n=e.tag.getTag(r);e.hooks.beforeBufferChanged.emit({uids:zW((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:zW((null==i?void 0:i.children)||[]),operation:"add"})})})},i=function(t){var r=t.removedUids,n={};xN(r).call(r,function(t){var r,i,o=e.statusStore.get(t);o&&xN(r=ZL(i=o.ownerTags.children).call(i)).call(r,function(e){n[e]||(n[e]=[]),n[e].push(t)})});for(var i=0,o=ZB(n);i<o.length;i++){var a=HW(o[i],2),s=a[0],u=a[1],c=e.tag.getTagByUid(s);c&&(e.hooks.beforeBufferChanged.emit({uids:zW(c.children),removedUids:zW(u),operation:"remove"}),e.tag.removeChildFromTag(c.name,u),e.hooks.afterBufferChanged.emit({docType:"tag",docName:c.name,docUid:s,uids:zW(c.children),removedUids:zW(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&&xN(n).call(n,function(){var t=QP(kN.mark(function r(t){var n,o;return kN.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&&cB(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&&xN(n).call(n,function(){var t=QP(kN.mark(function r(t){var n,o,a,s;return kN.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=cB(o=n.tags).call(o,i.name))>-1&&PB(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&&xN(r=ZL(n=i.ownerTags.children).call(n)).call(r,function(r){var n=e.tag.getTagByUid(r);n&&(e.hooks.beforeBufferChanged.emit({uids:zW(n.children),modifiedUid:t.modifiedUid,operation:"modify"}),e.hooks.afterBufferChanged.emit({docType:"tag",docName:n.name,docUid:r,uids:zW(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}(),RH=function(e){MD(r,e);var t=nH(r);function r(){var e;return KW(this,r),XW(qP(e=t.call(this)),"uid",dH()),XW(qP(e),"hooks",{init:mH.create(),destroy:mH.create(),beforeLoadSource:mH.create(),loadSource:mH.create(),afterLoadSource:mH.create(),beforeRemoveSource:mH.create(),removeSource:mH.create(),afterRemoveSource:mH.create(),beforeUpdateSource:mH.create(),updateSource:mH.create(),afterUpdateSource:mH.create(),beforeBufferChanged:mH.create(),afterBufferChanged:mH.create(),directoryChanged:mH.create(),tagChanged:mH.create(),openDoc:mH.create(),loadToDoc:mH.create(),removeFromDoc:mH.create(),removeDoc:mH.create(),renameDoc:mH.create(),move:mH.create(),afterMove:mH.create(),"switch":mH.create(),afterSwitch:mH.create(),reorder:mH.create(),afterReorder:mH.create()}),XW(qP(e),"dir",void 0),XW(qP(e),"tag",void 0),XW(qP(e),"store",void 0),XW(qP(e),"customStore",void 0),XW(qP(e),"metadataStore",void 0),XW(qP(e),"statusStore",void 0),XW(qP(e),"defaultFile",void 0),XW(qP(e),"plugins",[]),XW(qP(e),"imageLoader",void 0),e.initPlugins(),e.hooks.init.emit(),e}return YW(r,[{key:"destroy",value:function(){this.hooks.destroy.emit()}},{key:"initPlugins",value:function(){(new NH).apply(this),(new WH).apply(this),(new EH).apply(this),(new DH).apply(this),(new kH).apply(this),(new AH).apply(this),(new PH).apply(this),(new OH).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 _H:i&&n?new vH(i,n):null}},{key:"loadSource",value:function(e,t){if(oH(e))return[];var r=e.data;if(!iH(r))return[];var n=[];return xN(r).call(r,function(e){e.uid=dH(),n.push(e.uid)}),cH(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];sH(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=TU(t).call(t,function(e){return o.children[e]});xN(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 xN(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=cB(r=(null==t?void 0:t.tags)||[]).call(r,e);-1!==i&&PB(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=cB(n=(null==r?void 0:r.tags)||[]).call(n,e);-1!==o&&PB(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)){sH(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;oH(t)?t=TU(r=this.tag.tags).call(r,function(e){return e.name}):sH(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)){sH(t)&&(t=[t]);for(var n=0;n<t.length;n++)this.store.get(t[n]).then(function(t){var r;zU(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),sH(t)&&(t=[t]);for(var n=0;n<t.length;n++)this.store.get(t[n]).then(function(t){var r,n,i=cB(r=(null==t?void 0:t.tags)||[]).call(r,e);-1!==i&&PB(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?TU(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||oH(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||oH(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||oH(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}(hH),MH={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."}};(TH=bH||(bH={}))[TH.Normal=0]="Normal",TH[TH.Balance=1]="Balance";var LH=function(){function e(t){var r=this;KW(this,e),XW(this,"space",void 0),XW(this,"webViewer",void 0),XW(this,"isActiveFile",!1),XW(this,"isActiveTag",!1),XW(this,"currentFileName",""),XW(this,"currentTagName",""),XW(this,"bufferConfig",null),XW(this,"currentSelected",[]),XW(this,"lastCurrentSelected",[]),this.space=new RH,t&&(this.bufferConfig=t),this.space.on("bufferChanged",function(e,t){var n;if(!r.webViewer&&cH(null===(n=r.bufferConfig)||void 0===n?void 0:n.bufferChanged)){var i,o,a,s,u,c,l,d=[],f=[],h=r.getCurrentDataSet().children;xN(i=r.currentSelected).call(i,function(e){h&&h[e]&&d.push(h[e])}),xN(o=r.lastCurrentSelected).call(o,function(e){h&&h[e]&&f.push(h[e])});var g={afterStatus:{uids:e.afterStatus.uids,selectedUids:d,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:f,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,docName:(null===(l=r.space.dir.getFileByUid(e.docUid))||void 0===l?void 0:l.name)||"",total:e.afterStatus.uids.length,curIndex:e.afterStatus.uids.length-1};r.lastCurrentSelected=zW(r.currentSelected),r.bufferConfig.bufferChanged(g,t)}})}return YW(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=MH[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&&xN(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(!sH(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&&iH(r))&&cB(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 sH(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 sH(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="";!oH(r)&&sH(r)?(this.IsFileNameExist(r)||this.createDocument(r),s=r):oH(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=rH({},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=rH({},n)),l&&(o.imageId=l),d&&(o.serverId=d),f&&(o.uidFromServer=f);var g=this.getDocumentContents(s).length;!oH(h)&&uH(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=HW(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=rH({},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();iH(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;xN(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(),!iH(e))return!1;var t=this.getCurrentDataSet();if(!t)return!1;var r,n=[];xN(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(zW(t.children)))}return e||this.setError("Default"),e}},{key:"tagImages",value:function(e,t){this.e();var r=this.getHowManyImagesInBuffer();if(!iH(e))return this.setError("IndicesNotArray"),!1;if(!sH(t)||""===t)return this.setError("InvalidTagName"),!1;for(var n=0;n<r;n++){var i=e[n];if(FN(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!==hV(s,10)&&this.space.addTagToSource(s,t)}}return!0}},{key:"removeImageTag",value:function(e,t){if(this.e(),!uH(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(),!sH(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(),!sH(e))return this.setError("InvalidValue"),!1;if(!oH(t)&&!iH(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),oH(t))o=this.space.removeTag(e),i&&this.clearFilter();else{var a=[];xN(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(),oH(e)||""===e)return this.setError("OldTagNameRequired"),!1;if(oH(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&&sH(e)&&""!==e?this.space.getTag(e).children:[]}},{key:"getTagList",value:function(){var e=this;this.e();var t=this.space.getTagList(),r=[];return t?xN(t).call(t,function(t){var n,i=[];xN(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(!uH(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(oH(e)||null===e||""===e){this.currentTagName="";var i=this.getCurrentFileName();""===i&&(i="dynamsoft-default-document"),(n=this.openDocument(i))?cH(t)&&t():(this.setError("Default"),cH(r)&&r())}else{var o,a;if(!this.space.isTagExisted(e))return this.setError("TagNotExist"),cH(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]:[]}cH(t)&&t()}else this.setError("Default"),cH(r)&&r()}return this.webViewer&&this.webViewer.render(),n}},{key:"createDocument",value:function(e){if(this.e(),!e||""===e){var t=uH(e)?"FileNameNotString":"FileNameCannotEmpty";return this.setError(t),!1}return sH(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=uH(e)?"FileNameNotString":"FileNameCannotEmpty";return this.setError(i),!1}if(!sH(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&&sH(e)&&""!==e?this.space.isFileExisted(e)?this.space.getFile(e).children:(this.setError("FileNotExist"),[]):[]}},{key:"renameDocument",value:function(e,t){return this.e(),sH(e)&&sH(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||!sH(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?(xN(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 this.setError("FileNotExist"),{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||!iH(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(!uH(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=gV(TV(t=new Array(r.children.length)).call(t))}return e||this.setError("Default"),e}},{key:"moveImage",value:function(e,t){this.e();var r=hV(e,10),n=hV(t,10);if(FN(e)||FN(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=hV(e,10),n=hV(t,10);if(FN(e)||FN(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=zW(new $G(t));var i=this.getDocumentInfo(e).length;if(!iH(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&&(uH(n)&&n<o&&n>=0?this.currentSelected=[n+t.length-1]:this.currentSelected=s>0?[s-1]:[])}return a}}]),e}();HTMLCanvasElement.prototype.toBlob||eH(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 BH=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 LH(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 Jl.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?Jl.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=Jl.getImageUrl(this._baseUrl,l,-1,-1,c),minImageUrl:a=n&&n.controlWidth&&n.controlWidth>0&&n.controlHeight&&n.controlHeight>0?tr.navInfoSync.bMobile?Jl.getImageUrl(this._baseUrl,l,Math.round(n.controlWidth*devicePixelRatio),Math.round(n.controlHeight*devicePixelRatio),c):Jl.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=Jl.getImageUrl(this._baseUrl,c,-1,-1,u),minImageUrl:a=i&&i.controlWidth&&i.controlWidth>0&&i.controlHeight&&i.controlHeight>0?tr.navInfoSync.bMobile?Jl.getImageUrl(this._baseUrl,c,Math.round(i.controlWidth*devicePixelRatio),Math.round(i.controlHeight*devicePixelRatio),u):Jl.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 Jh;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 Jh).serverId=s,n.uidFromServer=u,c._serverIdMap[s]=n,c._uidMap[u]=n),l){null!=n&&(n.ticks=Date.now()),i=Jl.getImageUrl(l,s,-1,-1,n.ticks),o=t&&t.controlWidth&&t.controlWidth>0&&t.controlHeight&&t.controlHeight>0?tr.navInfoSync.bMobile?Jl.getImageUrl(l,s,Math.round(t.controlWidth*devicePixelRatio),Math.round(t.controlHeight*devicePixelRatio),n.ticks):Jl.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=Xt.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 Xt.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 Xt.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 Xt.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 Xt.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(),this._buffer=null,this._baseUrl=null,this._serverIdMap=null,this._uidMap=null,this._error=null}},{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}}])}(al),UH=function(e){function t(e){var r;o(this,t);var n=r=i(this,t,[e]);r.__IfAppendImage=di,r.__maxImagesInBuffer=32767,r.__insertingIndex=-1,r._aryBitmapCache=[],r._imageBufferWrapper=new BH,r._imageBufferWrapper.on("bufferChanged",function(e){if(Xt.isFunction(n.__OnBufferChanged)){var t,r,i,o=e[0],a=[],s=-1,u=[];for(o.operation&&(o.action=o.operation),r=0;r<n._imageBufferWrapper.count();r++)(t=n._imageBufferWrapper.getCustomDataByIndex(r))&&t.serverId&&a.push(n._imageBufferWrapper._serverId2uidFromServer(t.serverId));if(o.imageIds=a,o.curIndex>=0&&(t=n._imageBufferWrapper.getCustomDataByIndex(o.curIndex))&&t.serverId&&(s=n._imageBufferWrapper._serverId2uidFromServer(t.serverId)),o.currentId=s,"modify"==o.operation&&""!=o.afterStatus.modifiedUid){var c=n._imageBufferWrapper.getIndexByUid(o.afterStatus.modifiedUid);c>=0&&(t=n._imageBufferWrapper.getCustomDataByIndex(c))&&t.serverId&&(o.modifiedId=n._imageBufferWrapper._serverId2uidFromServer(t.serverId))}if(o.afterStatus.selectedUids)for(i=0;i<o.afterStatus.selectedUids.length;i++){var l=o.afterStatus.selectedUids[i];if(l&&-1!=l){var d=n._imageBufferWrapper.getIndexByUid(o.afterStatus.selectedUids[i]);d>=0&&(t=n._imageBufferWrapper.getCustomDataByIndex(d))&&t.serverId&&u.push(n._imageBufferWrapper._serverId2uidFromServer(t.serverId))}}o.selectedIds=u,Xt.mix(o,{}),delete o.uids,delete o.currentUid,delete o.selectedUids,delete o.afterStatus,delete o.beforeStatus,delete o.operation,delete o.curIndex,delete o.docUid;try{return n.__OnBufferChanged(o)}catch(f){_o(f)}}}),r._imageBufferWrapper.on("error",function(e){n._errorCode=e.code,n._errorString=e.message});var a=_h.getServerImageUrlPrefix(r);return BH._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=Xt.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(Xt.isString(t))return delete i[t],di;if(Xt.isFunction(t))for(o=0;o<i.length;o++)if(t==i[o])return i.splice(o,1),di}return r[n]=null,di}},{key:"_getMetadata",value:function(e){return this._imageBufferWrapper.getMetadataByIndex(e)}},{key:"_updateImage",value:function(e,t,r){var n,i,o,a,s=sf.Auto,u=this;return r&&(undefined!=r.width&&(o=parseInt(r.width)),undefined!=r.height&&(a=parseInt(r.height)),s=Xt.isNumber(o)&&Xt.isNumber(a)&&t.byteLength===o*a*4?sf.RGBA:sf.Auto),n={imageId:e,serverId:e,bufferLen:t.byteLength,imageType:s},r&&s==sf.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=Xt.stringify([Xt.stringify(n)]),new Qt.Promise(function(e,r){u._innerSendBlobByWS("UpdateImage",i,t,function(t){Xt.log("UpdateImage success."),e(t)},function(e){Xt.log("UpdateImage failed."),Xt.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),Xt.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),Xt.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)),Xt.log("_OnBitmapChanged.currentFileName="+n+", tag="+i),n?n!=a._getCurrentDocumentName()&&(p=!0):n=a._getCurrentDocumentName(),a._imageBufferWrapper&&(i?(a._imageBufferWrapper.setDefaultTag(i),Xt.log("metaDataObj.currentTag="+i)):o&&(a._imageBufferWrapper.setDefaultTag(""),Xt.log("metaDataObj.currentTag=''"))),s);else if(c)e.length>5&&(v=e[5]),Xt.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&&Xt.isString(e[11])&&(_.uidFromServer=e[11]),v.push(_),m>-1&&a._canConsume()&&(f==Ah.enumBCAppend||f==Ah.enumBCInsert)){var y=tr.DWT.lgct(m);Xt.isFunction(a.__OnLtsverify)&&a.__OnLtsverify(y,1)}}if(Xt.log("OnBitmapChanged:"+e),f==Ah.enumBCInsert||f==Ah.enumBCAppend&&!a.__IfAppendImage||r&&f==Ah.enumBCAppend&&r.index>=0)Xt.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++}),Xt.isFunction(a.__OnRefreshUI)&&a.__OnRefreshUI(a._imageBufferWrapper.getCurrentImageIndex(),a._imageBufferWrapper.count());else if(f==Ah.enumBCAppend&&a.__IfAppendImage)Xt.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,Xt.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)}),Xt.isFunction(a.__OnRefreshUI)&&a.__OnRefreshUI(a._imageBufferWrapper.getCurrentImageIndex(),a._imageBufferWrapper.count());else if(f==Ah.enumBCRemove&&l){var S=!1;if(1==d.length&&-1==d[0]&&(S=!0),S)a._imageBufferWrapper.clear();else{var I=[];Xt.each(d,function(e,t){var r=parseInt(e);if(isNaN(r)||r<0)return!0;I.push(r)}),a._imageBufferWrapper.removeImagesByServerId(I,n)}Xt.isFunction(a.__OnRefreshUI)&&a.__OnRefreshUI(a._imageBufferWrapper.getCurrentImageIndex(),a._imageBufferWrapper.count())}else if(f==Ah.enumBCEdit||f==Ah.enumBCUpdate)Xt.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==Ah.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(Xt.isFunction(a.__OnBitmapChanged)){if(!s)if(l){if(f!=Ah.enumBCRemove)return!0}else if(f==Ah.enumBCRemove)return!0;var T=[];Xt.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==Ah.enumBCAppend&&(w=a.__IfAppendImage?Ah.enumBCAppend:Ah.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),Uh(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 Va(t),n.abrupt("return",!1);case 4:return n.next=6,t._innerFunV2("RemoveImage",Zl(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}(_h),VH=function(e){return e.Text=0,e.Blob=1,e.ArrayBuffer=2,e.XML=3,e.JSON=4,e.UserDefined=5,e}({}),jH=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}({}),GH={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 HH(e,t){if(Xt.isFunction("_".repeat))return e.repeat(t);for(var r=0,n=[];r<t;r++)n.push(e);return n.join("")}var zH=Object.create?Object.create(null):{};function KH(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(KH('[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(GH.not_type.test(o.type)&&GH.not_primitive.test(o.type)&&r instanceof Function&&(r=r()),GH.numeric_arg.test(o.type)&&"number"!=typeof r&&isNaN(r))throw new TypeError(KH("[sprintf] expecting number but found %T",r));switch(GH.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=Xt.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()}GH.json.test(o.type)?h+=r:(!GH.number.test(o.type)||c&&!o.sign?l="":(l=c?"+":"-",r=r.toString().replace(GH.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?HH(s,u):"",h+=o.align?l+r+a:"0"===s?l+a+r:a+l+r)}return h}(function(e){if(zH[e])return zH[e];for(var t,r=e,n=[],i=0;r;){if(null!==(t=GH.text.exec(r)))n.push(t[0]);else if(null!==(t=GH.modulo.exec(r)))n.push("%");else{if(null===(t=GH.placeholder.exec(r)))throw new SyntaxError("[sprintf] unexpected placeholder");if(t[2]){i|=1;var o=[],a=t[2],s=[];if(null===(s=GH.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=GH.key_access.exec(a)))o.push(s[1]);else{if(null===(s=GH.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 zH[e]=n,n}(e),arguments)}function JH(e,t){if(Xt.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=KH(i,t)}catch(kH){a=""}return[n,a,o].join("")}return""}function QH(e,t){var r,n=e.substring(e.lastIndexOf(".")).toLowerCase();if(t==tr.DWT.EnumDWT_ImageType.IT_BMP){if(".bmp"==n||".dib"==n)return e;r=[e,".bmp"].join("")}else if(t==tr.DWT.EnumDWT_ImageType.IT_JPG){if(".jpg"==n||".jpe"==n||".jpeg"==n||".jfif"==n)return e;r=[e,".jpg"].join("")}else if(t==tr.DWT.EnumDWT_ImageType.IT_PNG){if(".png"==n)return e;r=[e,".png"].join("")}else if(t==tr.DWT.EnumDWT_ImageType.IT_TIF){if(".tif"==n||".tiff"==n)return e;r=[e,".tif"].join("")}else if(t==tr.DWT.EnumDWT_ImageType.IT_PDF){if(".pdf"==n)return e;r=[e,".pdf"].join("")}else if(t==tr.DWT.EnumDWT_ImageType.IT_J2K){if(".jp2"==n)return e;r=[e,".jp2"].join("")}return r}function qH(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)==VH.Text?"text":o==VH.JSON?"json":o==VH.Blob?"blob":o==VH.ArrayBuffer?"arraybuffer":o==VH.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 El({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&&Xt.mix(s.headers,c),e.HTTPRequestswithCredentials&&Xt.mix(s.xhrFields,{withCredentials:!0}),s=null),y.on(El.event.SUCCESS,function(n){if(t.content=null,y=null,_&&Qt.progressContext.off("cancel",_),n?e.HTTPPostResponse=n.response:t.responseType==VH.ArrayBuffer?e.HTTPPostResponse=[]:t.responseType==VH.Blob?e.HTTPPostResponse=new Blob([]):t.responseType==VH.JSON?e.HTTPPostResponse={}:e.HTTPPostResponse="",Xt.isFunction(e.onHttpUploadStatus)){var i;i={fileName:n.name,percentage:100,statusCode:200,responseString:e.HTTPPostResponse},e.onHttpUploadStatus(i)}Xt.isFunction(r)&&r(e.HTTPPostResponse)}),y.on(El.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&&Xt.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={};(ya(u,i,o,a),Xt.isFunction(e.onHttpUploadStatus))&&(s={fileName:r.name,percentage:100,statusCode:a,responseString:e.HTTPPostResponse},e.onHttpUploadStatus(s));Xt.isFunction(n)&&n(u._errorCode,u._errorString,e.HTTPPostResponse,a)}),(m||Xt.isFunction(e.onHttpUploadStatus))&&(y.on(El.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(""),Xt.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,Fl.Uploading,"http"]),Xt.isFunction(e.onHttpUploadStatus))){var S="";Xt.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 vs(I),t.content=null,Xt.isFunction(n)&&n(I._errorCode,I._errorString),!1}var b=y.upload(i);return i=null,b}function YH(e,t,r,n){var i,o,a=e.MaxUploadImageSize,s=0,u=t.content;if(!u||!Xt.isArray(u)||u.length<=0){t.content=null;var c={};return Ta(c),Xt.isFunction(n)&&n(c._errorCode,c._errorString),li}for(i=0;i<u.length;i++){var l=u[i];if(!l||l.size<=0){var d={};return Ta(d),Xt.isFunction(n)&&n(d._errorCode,d._errorString),li}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);Xt.isString(m)&&""!=m||(m=l.fileName),p.name=JH(m,i+1),u[i]=p}u[i].remoteFilename=JH(t.remoteFilename,i+1),l=null}if(s>a&&-1!=a){var v={};return wa(v),Xt.isFunction(n)&&n(v._errorCode,v._errorString),li}for(Qt.cancelFrom=jH.HTTPUpload,o=qH(e,t,r,n),t=null,i=0;i<u.length;i++)u[i]=null;return u=null,o}function XH(e){Qt.dlgRef<=0||0==Qt.dialogShowStatus||iu(e)}Qt.setBtnCancelVisibleForProgress=iu;var ZH=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,Xt.isFunction(n)&&n(e,r)};if((s=t.content).size<=0){var h={};return Ta(h),f(h._errorCode,h._errorString),li}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={};Ta(m),f(m._errorCode,m._errorString)}if(!e.IfShowProgressBar||e.IfShowProgressBar&&Qt.dlgRef>0){g.name=i,XH(e.IfShowCancelDialogWhenImageTransfer),t.headers["Content-Range"]=["bytes ",l,"-",l+g.size-1,"/",a].join(""),d._onProgress(e,i,{total:a,loaded:l});var p=Xt.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,Xt.isFunction(r)&&Hh(r,n)):(t.offset=t.offset+c,setTimeout(function(){d._uploadBlobFragment(e,t,r,f)},100))},f),!0}var v={};return vs(v),f(v._errorCode,v._errorString),!1}return Qt.needShowTwiceShowDialog=!1,t.content=null,Xt.isFunction(r)&&r(""),!0}},{key:"httpPostUploadFragment",value:function(e,t,r,n){var i;if(!(i=t.content)){var o={};return Ta(o),Xt.isFunction(n)&&n(o._errorCode,o._errorString),li}if(Xt.isString(i)){if(""==i){var a={};return Ta(a),Xt.isFunction(n)&&n(a._errorCode,a._errorString),li}var s=new Blob([i],{type:"text/plain"}),u=t.fileName;s.name=u,t.content=s,s=null}return Qt.cancelFrom=jH.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,Xt.isFunction(n)&&n(e,r,i,o),!1};if(!(i=t.content)){var u={};return Ta(u),s(u._errorCode,u._errorString),!!a&&void 0}if(Xt.isString(i)){var c,l=t.fileName;if(""==i){var d={};return Ta(d),s(d._errorCode,d._errorString),!!a&&void 0}if(c=e.MaxUploadImageSize,i.length>c&&-1!=c){var f={};return wa(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 Ta(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 wa(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}XH(e.IfShowCancelDialogWhenImageTransfer),Qt.cancelFrom=jH.HTTPUpload;var S=qH(e,t,function(e){return t.content=null,t=null,Xt.isFunction(r)&&r(e),e=null,!0},s);return a?void 0:!!S}}])}(),$H=s(function rq(){o(this,rq),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=VH.Text}),ez=s(function nq(){o(this,nq),this.IfShowProgressBar=!1,this.IfShowCancelDialogWhenImageTransfer=!0}),tz=function(e){return e.URL=0,e.Blob=1,e.Base64=2,e}({}),rz=window.SparkMD5,nz=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 Xt.isNumber(e)&&Xt.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=nz;var iz=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:(x=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,!tr.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 x.apply(this,arguments)})},{key:"_saveImages",value:(E=n(g().mark(function P(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=QH(t,n),a=Gh(i,r),Qt.cancelFrom=jH.Other,l.next=5,i._innerConvertToArrayBufferWithUIAsync(e,n,a);case 5:return s=l.sent,u=Wh.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()}},P,this)})),function(e,t,r,n){return E.apply(this,arguments)})},{key:"_innerSaveLocal",value:(k=n(g().mark(function D(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=tr.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()}},D)})),function(e,t){return k.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=Xt.parse(o),!r&&n.imageId&&(n.imageId=i._serverId2uidFromServer(n.imageId))}catch(s){Xt.log(e)}n||(n={imageId:""});var a=!1;if(Xt.isFunction(i.__OnPostTransferAsync))try{a=i.__OnPostTransferAsync(n)}catch(u){_o(u)}if(Xt.isFunction(i.__OnPostTransferAsync2))try{i.__OnPostTransferAsync2(n)}catch(u){_o(u)}return a}},{key:"_checkIndices",value:function(e,t){return az(e,!Xt.isUndefined(t)&&t>=0?t:this._imageBufferWrapper.count(),this)}},{key:"_acquireImageForSendTo",value:(w=n(g().mark(function F(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?Xt.clone(r):{},u=s=i,o._resetErr(),o._isValid()){h.next=4;break}throw{code:o._errorCode,message:o._errorString};case 4:if(Xt.isString(s._id)){h.next=6;break}throw cs();case 6:if(!o.__bAcquireImageNow){h.next=9;break}throw ha(o),{code:o._errorCode,message:o._getErrorString()};case 9:if(o.__bAcquireImageNow=!0,ld(e,u),c=Qt.Promise.resolve(),l=tr.DWT.RemoteScanConfig,d=Rl(),h.prev=13,Eh(a),l&&Ml(l.keepAwake),Zc.checkProductKey(o,{Core:!0})&&o._isValid()){h.next=18;break}throw{code:o._errorCode,message:o._errorString};case 18:return _h._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=tr.DWT.EnumDWT_ImageType.IT_PNG;Qt.cancelFrom=jH.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?(Xt.log("LoadImageFromBinary success"),s._bltsCopyImage=!1,e.imageId=s._uidFromServer2ServerId(n.ids),Xt.isFunction(s._OnPostTransferAsync)&&s._OnPostTransferAsync([!0,Xt.stringify(e)],null,!0)):Xt.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){Xt.log(t),s._bltsCopyImage=!1,r({code:e,message:t})})},function(e){e&&e.message&&Xt.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=of.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,dd(e),Ml(d),h.finish(29);case 42:case"end":return h.stop()}},F,this,[[13,26,29,42],[30,35]])})),function(e,t,r,n){return w.apply(this,arguments)})},{key:"_uidFromServer2index",value:function(e){var t,r=this;return r._resetErr(),!!r._isValid()&&(Xt.isString(e)?(-1==(t=r._imageBufferWrapper._uidFromServer2index(e))&&-2540!=r._errorCode&&Js(r),t):(Xa(r),-1))}},{key:"_index2uidFromServer",value:function(e){var t=this;if(t._resetErr(),!t._isValid())return!1;var r=parseInt(e);return isNaN(r)?(ca(t),""):r<0||r>=this._imageBufferWrapper.count()?(Va(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($l(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 Xt.isFunction(c)&&c(d._errorCode,d._getErrorString(),g),!1};return Zc.checkProductKey(d,{Core:!0})||de.bWin&&Zc.checkProductKey(d,{Webcam:!0},!0)?Zc.checkPDFProductKeyWhenNeeds(d,t)?0===h?(oa(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(Xt.isFunction(u)){var r=e;if(Xt.isArray(r)&&(r=r.length>0?r[0]:{}),n)setTimeout(function(){u(g,r)},30);else try{u(g,r)}catch(i){Xt.error(i.message)}}return d._canConsume()&&tr.DWT.lcvrf(d),!0},_):(m=!1,_()):(Zc.checkProductKey(d,{Core:!0},!1),m=!1,_())}},{key:"_innerSendBlob",value:function(e,t,r,n,i,o,a){var s=this;if(_h.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=bh(s._clientId,e,t,0,s._bScanForProxyRemote?s._dmServiceDWTVersion:""),l+="\r\n\r\n",d={method:"POST",url:c,processData:!1,data:l+=Xt.base64.encodeArray(r),async:!1,onSuccess:function(e,t,n){var o=!1,a=!1;try{o=Xt.isString(e)&&na(n.getResponseHeader("content-type"))?Xt.parse(e):e}catch(TH){}if(o!==undefined&&null!==o&&(hu(o)?(s._errorCode=o.exception,s._errorString=o.description,s._errorCause=gu(o)):s._resetErr(),(u=o.result)&&Xt.isArray(u)&&u.length>=1))if(i){var c,l=u[0];l&&Xt.isObject(l)&&(c=l.imageInfos,0==s._errorCode&&Xt.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||(_a(s),u="")},onError:function(){va(s),u=""}},Xt.mix(d,{headers:{"X-Requested-With":!1}}),de.bFileSystem&&(d.crossDomain=!1),Ui(d),0==s._errorCode?Xt.isFunction(o)&&o():Xt.isFunction(a)&&a(),u)}},{key:"_convertToBase64ByServerIdsWithUI",value:function(e,t,r,n,i,o,a){this._convertToBase64ByServerIdsWithUIAsync(e,r,t,n).then(function(e){Xt.isFunction(o)&&Hh(o,e)},function(){Xt.isFunction(a)&&a()})}},{key:"_OnPercentDone",value:function(e){var t,r,n,i,o,a=this,s=!1,u=!1,c=0;Xt.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!=jH.HTTPUpload&&Qt.cancelFrom!=jH.HTTPDownload&&Qt.cancelFrom!=jH.Scan&&Qt.cancelFrom!=jH.HTTPPut||(u=o)),(a._bServerPercentDone||0==r)&&((c>0||0==c)&&(Qt.cancelFrom!=jH.HTTPUpload&&Qt.cancelFrom!=jH.HTTPDownload&&Qt.cancelFrom!=jH.FTPUpload&&Qt.cancelFrom!=jH.FTPDownload&&Qt.cancelFrom!=jH.HTTPPut||(s=!0)),a.IfShowProgressBar&&Qt.progressBarOnPercentDone(c,n,i,t,u,this._containerElement),1==s&&(Xt.isFunction(a.__OnInternetTransferPercentage)&&a.__OnInternetTransferPercentage(t,!1),Xt.isFunction(a.__OnInternetTransferPercentageEx)&&a.__OnInternetTransferPercentageEx(t,!1)),Xt.isFunction(a.__OnPercentDone)&&a.__OnPercentDone())}},{key:"IfShowProgressBar",get:function(){return this._bIfShowProgressBar},set:function(e){this._resetErr(),Xt.isBoolean(e)?this._bIfShowProgressBar=e:la(this)}},{key:"IfShowCancelDialogWhenImageTransfer",get:function(){return this.__IfShowCancelDialogWhenImageTransfer},set:function(e){Xt.isBoolean(e)?this.__IfShowCancelDialogWhenImageTransfer=e:(this._resetErr(),la(this))}},{key:"_getLogLevel",value:function(){return this._logLevel}},{key:"_setLogLevel",value:(C=n(g().mark(function W(e){return g().wrap(function(t){for(;;)switch(t.prev=t.next){case 0:return this._logLevel=e,t.next=3,this._innerFunV2("LogLevel",Zl(e));case 3:case"end":return t.stop()}},W,this)})),function(e){return C.apply(this,arguments)})},{key:"MaxUploadImageSize",get:function(){return this.__maxUploadImageSize},set:function(e){var t=this;t._resetErr();var r=1*e;!Xt.isNumber(r)||isNaN(r)?la(t):t.__maxUploadImageSize=r}},{key:"HTTPRequestswithCredentials",get:function(){return this._resetErr(),this._bWithCredentials},set:function(e){this._resetErr(),Xt.isBoolean(e)?this._bWithCredentials=e:la(this)}},{key:"cancelableObj",get:function(){return this._cancelableObj},set:function(e){this._cancelableObj=e}},{key:"_getProfile",value:(T=n(g().mark(function N(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=Xt.stringify([e.strDevice])),n.abrupt("return",t._innerFunV2("GetCustomDSDataEx",r));case 6:case"end":return n.stop()}},N,this)})),function(e){return T.apply(this,arguments)})},{key:"_setProfile",value:(b=n(g().mark(function O(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?Xt.stringify([t,e.strDevice]):Zl(t),i.abrupt("return",this._innerFunV2("SetCustomDSDataEx",n));case 6:case"end":return i.stop()}},O,this)})),function(e,t){return b.apply(this,arguments)})},{key:"_removeAllImagesAsync",value:(I=n(g().mark(function R(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",Zl(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()}},R,this)})),function(e,t){return I.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(hu(e)?(n._errorCode=e.exception,n._errorString=e.description,n._errorCause=gu(e)):"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&&Xt.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,Xt.isFunction(o)){var t=[];Xt.isArray(r)&&Xt.each(r,function(e){var r=a._imageBufferWrapper.convertServerIdToClientIndex(e);r>-1&&t.push(r)}),e&&(a._errorCode=e.code,a._errorString=e.message,e.errorCause&&(a._errorCause=e.errorCause)),o(t)}return!1};a._innerConvertToArrayBufferWithUIAsync(e,t,r,n).then(function(e){if(!e||e.byteLength<=0)return Ya(a),u();var n=a.__maxUploadImageSize;if(e.byteLength>n&&-1!=n)return wa(a),u();if(Qt.needShowTwiceShowDialog=!1,Xt.isFunction(i)){var o=[];Xt.isArray(r)&&Xt.each(r,function(e){var t=a._imageBufferWrapper.convertServerIdToClientIndex(e);t>-1&&o.push(t)});var c=Wh.getBlobTypeByImageType(t),l=new Blob([e],{type:c});try{i(l,o,s)}catch(d){}l=null}return!0},u)}},{key:"convertToBlob",value:(S=n(g().mark(function M(e,t,r){var n,i,o,a;return g().wrap(function(s){for(;;)switch(s.prev=s.next){case 0:return i=Gh(n=this,t),Qt.cancelFrom=jH.ConvertToBlob,s.next=4,n._innerConvertToArrayBufferWithUIAsync("convertToBlob",e,i,r);case 4:return o=s.sent,a=Wh.getBlobTypeByImageType(e),s.abrupt("return",new Blob([o],{type:a}));case 7:case"end":return s.stop()}},M,this)})),function(e,t,r){return S.apply(this,arguments)})},{key:"_innerConvertToArrayBufferWithUIAsync",value:(y=n(g().mark(function L(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,Fl.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()}},L,this,[[2,,9,13]])})),function(e,t,r,n,i){return y.apply(this,arguments)})},{key:"_innerConvertToBase64Async",value:(_=n(g().mark(function B(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,Xt.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=10;break}throw{code:n._errorCode,message:n._getErrorString()};case 10:if(!l||!Xt.isArray(l)||3!=l.length){f.next=18;break}return c=l[0],s=l[1],u=l[2],d=new nz(null,s,u,c),f.abrupt("return",d);case 18:throw Ka(n),{code:n._errorCode,message:n._errorString};case 20:case"end":return f.stop()}},B,this)})),function(e,t,r){return _.apply(this,arguments)})},{key:"_convertToBase64ByServerIdsWithUIAsync",value:(v=n(g().mark(function U(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,Fl.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()}},U,this,[[2,,9,13]])})),function(e,t,r,n){return v.apply(this,arguments)})},{key:"_convertToBlobForUpload",value:function(e,t,r,n,i,o,a){var s=this,u=arguments;if(tr.DWT.ConnectWithSocket){var c=r,l=",";Xt.isString(c)&&""!=c||(c="",l="");var d=["[",e,',"',t.join(","),'"',l,c,"]"].join("");return Qt.cancelFrom=jH.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||$l(t))return void i(t,"",u);hu(t)&&(s._errorCode=t.exception,s._errorString=t.description,s._errorCause=gu(t))}},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(tr.DWT.IfAddMD5InUploadHeader){var n=new rz.ArrayBuffer;n.append(e),Xt.isFunction(i)&&i(r,n.end(),u)}else Xt.isFunction(i)&&i(r,"",u);r=null},function(e){o(e.code,e.message)})}},{key:"dispose",value:(p=n(g().mark(function V(){return g().wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",this.__unload());case 1:case"end":return e.stop()}},V,this)})),function(){return p.apply(this,arguments)})},{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 j(){var e,t,r,n,i;return g().wrap(function(o){for(;;)switch(o.prev=o.next){case 0:if(!(e=this)._bReady||Qt.page.bUnload){o.next=10;break}if(!e._wsClient){o.next=10;break}return o.prev=3,o.next=6,e._innerDisposeWSClient();case 6:o.next=10;break;case 8:o.prev=8,o.t0=o["catch"](3);case 10:if(!(r=e._wsClient)){o.next=26;break}r.removeEvent("close",e._clientId),r.removeEvent("error",e._clientId),r.removeEvent("timeout",e._clientId);try{for(;e._evt_ids.length>0;)(n=e._evt_ids.pop())in r._tasks&&(i=r._tasks[n])&&(i.resolver&&(i.resolver.promise=null,i.resolver.resolve=null,i.resolver.reject=null,delete i.resolver),i.ctx&&(i.ctx.client=null,i.ctx.userData&&(i.ctx.userData.stwain=null,i.ctx.userData.command=null,delete i.ctx.userData),delete i.ctx),delete r._tasks[n])}catch(a){}return o.prev=16,o.next=19,r.dispose();case 19:o.next=24;break;case 21:o.prev=21,o.t1=o["catch"](16),t=o.t1;case 24:delete e._wsClient,e._wsClient=null;case 26:if(this._imageBufferWrapper.dispose(),this._bReady=li,this._destroy=di,this._cancelableObj=null,this._containerElement=null,this.__OnInternetTransferPercentage=null,this.__OnInternetTransferPercentageEx=null,this.__OnPercentDone=null,this.__licenseInfo=null,this._wsCheckResolve=null,this._wsCheckReject=null,this._heartBeatTimer=null,this._serverInfo=null,this._dmService=null,this.__OnPostTransferAsync=null,this.__OnPostTransferAsync2=null,this.__OnBitmapChanged=null,this.__OnCurrentDeviceSelected=null,this.__OnPrintMsg=null,this.__OnWSReconnect=null,this.__OnWSClose=null,this.__OnWSMessage=null,this.__OnWSError=null,this._imageBufferWrapper=null,this._aryBitmapCache=null,this._acquireDivEL=null,this.__OnRefreshUI=null,this.__OnLtsverify=null,this.__OnRemoteScanStatusAsync=null,this.__OnBufferChanged=null,!t){o.next=58;break}throw t;case 58:case"end":return o.stop()}},j,this,[[3,8],[16,21]])})),function(){return m.apply(this,arguments)})},{key:"_getImages",value:(h=n(g().mark(function G(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!=tz.URL){u.next=9;break}if(!(t.length>1)){u.next=7;break}throw Is(this),{code:this._errorCode,message:this._errorString};case 7:u.next=13;break;case 9:if(r!=tr.DWT.EnumDWT_ImageType.IT_BMP&&r!=tr.DWT.EnumDWT_ImageType.IT_JPG&&r!=tr.DWT.EnumDWT_ImageType.IT_PNG){u.next=13;break}if(!(t.length>1)){u.next=13;break}throw Ss(this),{code:this._errorCode,message:this._errorString};case 13:if(n!=tz.URL){u.next=17;break}return u.abrupt("return",this._imageBufferWrapper.getImageUrl(t[0]));case 17:if(Qt.cancelFrom=jH.Other,o=Gh(i,t),n!=tz.Blob){u.next=27;break}return u.next=22,this._innerConvertToArrayBufferWithUIAsync(e,r,o);case 22:return a=u.sent,s=Wh.getBlobTypeByImageType(r),u.abrupt("return",new Blob([a],{type:s}));case 27:if(n!=tz.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 _s(this),{code:this._errorCode,message:this._errorString};case 33:case"end":return u.stop()}},G,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=il(r);n<=0&&(t||_o(e._getErrorString()),Xt.isFunction(tr.OnLicenseExpiredWarning)&&tr.OnLicenseExpiredWarning(Fa(r),n,t))}},{key:"__saveToViewerAfterUpdate",value:function(e,t){var r=this,n=this._imageBufferWrapper.getIndexByUid(e),i=this._imageBufferWrapper.convertClientIndexToServerId(n),o=Jl.getUrlByAct(this._imageBufferWrapper.BaseUrl,i,2);return new Qt.Promise(function(e,a){Ui({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=tr.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=Xt.clone(u);c.imageId=i,r._imageBufferWrapper.UpdateImage(c,s)}e()},onError:function(){e(),dd("save")}})})}},{key:"RunCommandAsync",value:(c=n(g().mark(function H(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&&Xt.isString(e.command)&&e.parameter){s.next=4;break}throw $a(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,!Xt.isNumber(r)){s.next=13;break}if(!(isNaN(r)||!Xt.isNumber(r)||r<0||r>=t._imageBufferWrapper.count())){s.next=11;break}throw Va(t),{code:t._errorCode,message:t._errorString};case 11:n=t._imageBufferWrapper.convertClientIndexToServerId(r),e.parameter.index=n;case 13:return i=["[",Xt.stringify(e),"]"].join(""),s.next=16,t._innerFunRawV3("runCommand",i);case 16:if(o=s.sent,!de.bIE){s.next=21;break}if(!Xt.isString(o)){s.next=20;break}return s.abrupt("return",Xt.parse(o));case 20:return s.abrupt("return",o);case 21:if(!na(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()}},H,this)})),function(e){return c.apply(this,arguments)})},{key:"_innerFunRawV3",value:(u=n(g().mark(function z(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(!_h.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:bh(r._clientId,e,t,0,r._bScanForProxyRemote?r._dmServiceDWTVersion:""),fetchRaw:!0},o.next=10,nu([r._httpUrl,i,e].join(""),n);case 10:return o.abrupt("return",o.sent);case 11:case"end":return o.stop()}},z,this)})),function(e,t){return u.apply(this,arguments)})},{key:"_invert",value:(a=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(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 ca(t),{code:t._errorCode,message:t._errorString};case 7:if(!(r<0||r>=t._imageBufferWrapper.count())){a.next=10;break}throw Va(t),{code:t._errorCode,message:t._errorString};case 10:if(-1!=(n=t._imageBufferWrapper.convertClientIndexToServerId(r))){a.next=14;break}throw Va(t),{code:t._errorCode,message:t._errorString};case 14:return a.next=16,t._innerFunV2("Invert",Zl(n),!0);case 16:if(i=a.sent,!(o=1==i)){a.next=22;break}Wh.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()}},K,this)})),function(e){return a.apply(this,arguments)})}],[{key:"create",value:(r=n(g().mark(function J(e){var r;return g().wrap(function(n){for(;;)switch(n.prev=n.next){case 0:return r=new t(e),n.next=3,_h.STwainConnectToServer(r);case 3:return n.abrupt("return",r);case 4:case"end":return n.stop()}},J)})),function(e){return r.apply(this,arguments)})}]);var r,a,u,c,h,m,p,v,_,y,S,I,b,T,C,w,k,E,x}(UH);function oz(e){var t=e,r="",n=!1;if(t&&t.__licenseInfo&&(t.__licenseInfo.ExpireDate&&(r=t.__licenseInfo.ExpireDate),n=t.__licenseInfo.bTrial),n&&!tr.DWT.HideTrialMessage){var i=il(r);i<=5&&(Xt.isFunction(tr.OnLicenseExpiredWarning)&&tr.OnLicenseExpiredWarning(Fa(r),i,!0),tr.DWT.HideTrialMessage=!0)}}function az(e,t,r){var n;if(!Xt.isArray(e))return Ua(r),!1;if(0==e.length)return Ra(r),!1;if(tr.DWT.ConnectWithSocket)return!0;for(n=0;n<e.length;n++){var i=e[n];if(Xt.isUndefined(i)||null===i)return ja(r),!1;if(i=parseInt(i),isNaN(i))return ca(r),!1;if(i<0||i>=t)return La(r),!1}return!0}var sz={changeImageUISize:function(e){if(!tr.DWT.UseDefaultViewer||!e._containerElement)return di;var t,r,n,i,o=e._width,a=e._height,s=li;if(t=ui.one(e._containerElement),Xt.isString(o)&&(o.indexOf("%")>0||o.indexOf("rem")>0))n=o,s=di;else{var u=o;Xt.isString(o)&&o.indexOf("px")>0&&(u=parseInt(o)),Xt.isNumber(u)?n=[(u=parseInt(o))+2,"px"].join(""):Xt.isString(u)&&(n=u)}if(Xt.isString(a)&&(a.indexOf("%")>0||a.indexOf("rem")>0))i=a,s=di;else{var c=a;Xt.isString(a)&&a.indexOf("px")>0&&(c=parseInt(a)),Xt.isNumber(c)?i=[(c=parseInt(a))+2,"px"].join(""):Xt.isString(c)&&(i=c)}return t&&(r=ui.one(".dynamsoft-dwt-container-box",t))&&r.getEL()&&(Xt.isString(n)&&r.style("width",n),Xt.isString(i)&&r.style("height",i)),s?(e.__funResize||(e.__funResize=function(){return e._ImgManager&&e._UIView&&e._containerElement?e._UIView.ChangeSize(e._width,e._height):di}),Xt.removeEventListener(window,"resize",e.__funResize),Xt.addEventListener(window,"resize",e.__funResize)):e.__funResize&&(Xt.removeEventListener(window,"resize",e.__funResize),e.__funResize=li),e._ImgManager&&e._UIView&&e._containerElement?e._UIView.ChangeSize(n,i):di},__innerGetUIViewRealSize:function(e,t,r){var n,i=-1,o=-1;return n=ui.one(e),Xt.isString(t)&&t.indexOf("%")>0&&(i=ui.css(n,"width")*parseInt(t)/100),i<0&&t&&(i=parseInt(t)),Xt.isString(r)&&r.indexOf("%")>0&&(o=ui.css(n,"height")*parseInt(r)/100),o<0&&r&&(o=parseInt(r)),{width:i,height:o}},bindUIViewEvents:function(e,t){var r=e;t.onBufferChanged=function(e){if(Xt.isFunction(r.__OnBufferChanged))try{r.__OnBufferChanged(e)}catch(t){_o(t)}},tr.DWT.UseDefaultViewer&&(t.onSelected=function(e){if(!r._isNoViewer()){var t,n=e.length;n>0&&(r._ImgManager.SetSelectedImageCount(n),t=e[n-1],Xt.isFunction(r.__OnRefreshUI)&&r.__OnRefreshUI(t))}},t.onRefreshUI=function(e){r._isNoViewer()||sz.__innerRefreshFromUIView(r,e)},t.onResetCurrentIndex=function(e){if(!r._isNoViewer()){var t=r._ImgManager.getCurrentImageIndex();if(e>=0&&e<r._ImgManager.count()&&t!=e&&Xt.isFunction(r.__OnIndexChangeDuringDragDrop))try{r.__OnIndexChangeDuringDragDrop(t,e)}catch(n){_o(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(Xt.isFunction(r.__OnMouseMove))try{r.__OnMouseMove(t)}catch(o){_o(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(Xt.isFunction(r.__OnMouseClick))try{r.__OnMouseClick(t)}catch(o){_o(o)}}},t.onMouseDoubleClick=function(e){if(!r._isNoViewer()){var t=e.index;if(Xt.isFunction(r.__OnMouseDoubleClick))try{r.__OnMouseDoubleClick(t)}catch(n){_o(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(Xt.isFunction(r.__OnMouseRightClick))try{return r.__OnMouseRightClick(t)}catch(o){_o(o)}return di}},t.onImageAreaSelected=function(e){if(!r._isNoViewer()&&Xt.isFunction(r.__OnImageAreaSelected))try{r.__OnImageAreaSelected(e.index,e.left,e.top,e.right,e.bottom,e.areaIndex)}catch(t){_o(t)}},t.onImageAreaDeSelected=function(e){if(!r._isNoViewer()&&Xt.isFunction(r.__OnImageAreaDeSelected))try{r.__OnImageAreaDeSelected(e)}catch(t){_o(t)}})},__innerRefreshFromUIView:function(e,t){var r=e;Xt.isFunction(r.__OnRefreshUI)&&r.__OnRefreshUI(t)}};function uz(e,t,r){t in e||Object.defineProperty(e,t,r)}var cz=function(){return s(function e(t){o(this,e);var r=this;r._parent=t,uz(r,"width",{get:function(){return this._parent._width},set:function(e){this.SetSize(e,!1)}}),uz(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()&&(Xt.isString(e)&&e.length>0&&"%"===e.charAt(e.length-1)&&(i=e),!i&&e&&(r=parseInt(e))&&(i=r+"px"),Xt.isString(t)&&t.length>0&&"%"===t.charAt(t.length-1)&&(o=t),!o&&t&&(r=parseInt(t))&&(o=r+"px"),!1!==i&&(n._width=i),!1!==o&&(n._height=o),sz.changeImageUISize(n))}}])}();function lz(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=Xt.get(o.containerId)),e._width=o.width,e._height=o.height,t=ui.one(e._containerElement)),function(e,t){var r={Stwain:e};if(t){var n=e._width,i=e._height;Xt.isString(n)&&n.indexOf("px")>0&&(n=parseInt(n)),Xt.isString(i)&&i.indexOf("px")>0&&(i=parseInt(i)),r={Stwain:e,Container:t,Width:n,Height:i}}sz.bindUIViewEvents(e,r),e._UIView?e._UIView._Init(r):e._UIView=new Qt.UI.ImageUIView(e,r),tr.DWT.UseDefaultViewer&&(Xt.isNumber(e.Width)&&e.Width<=0&&(e.Width=270),Xt.isNumber(e.Height)&&e.Height<=0&&(e.Height=350),e._containerElement&&sz.changeImageUISize(e))}(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 cz(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 dz=tr.DWT;dz.CloseDialog=function(){var e=Qt.install._dlgInstall;if(e){var t=Xt.sizzle(".dynamsoft-dialog-close");Xt.each(t,function(e,t){Xt.removeEventListener(e,"click",dz.CloseDialog)}),"true"==e.getAttribute("opened")&&e.close(),document.body.removeChild(e),Qt.install._dlgInstall=!1}},dz.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),dz.ShowMessage(o,a)}},dz.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",_=Qo.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),Xt.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==Xt.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),fz(T,e),I.appendChild(b),document.body.appendChild(I),S){var C=ui.one(".dynamsoft-dialog-close",ui.one(I));C&&((C=C[0]).onClose=function(){Xt.removeEventListener(C,"click",C.onClose),C.onClose=null,S()},Xt.addEventListener(C,"click",C.onClose))}if(y?ui.setBackOpacity({opacity:.4,grayHex:0}):ui.setBackOpacity({}),I.bTopmost=!0,s._dlgInstall=I,ui.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 k=ui.one(".dynamsoft-backdrop");if(k&&k.length>0){for(var E=k[0];E.firstChild;)E.removeChild(E.firstChild);E.style.zIndex="10000",E.appendChild(w)}}}else g=!1;var x=ui.one("."+c);if(x&&x.getEL()&&(x[0].style.width=r+"px",Xt.isNumber(n)&&n>0?x[0].style.height=n+"px":x[0].style.height="100%",g||Xt.each(x[0].childNodes,function(t){if("DIV"==t.tagName&&"dynamsoft-dialog-close"!=t.className&&"dynamsoft-dialog-closeTimer"!=t.className)return fz(t,e),!1})),_){var A=ui.one(".dynamsoft-dialog");A&&A.getEL()&&(A.getEL().style.border="1px solid #999")}if("true"==s._dlgInstall.getAttribute("opened")&&s._dlgInstall.close(),s._dlgInstall.showModal({position:p}),s._dlgInstall.bReadyClosed=d,y&&ui.setBackOpacity({}),h){var P=Xt.sizzle(".dynamsoft-dialog-close");Xt.each(P,function(e,t){Xt.addEventListener(e,"click",dz.CloseDialog)}),P.length>0&&i&&f>0&&setTimeout(Qt._zdgb_xkz_dhk,100)}},dz.OnWebTwainPreExecute||(dz.OnWebTwainPreExecute=function(e,t){var r,n,i,o=tr.DWT.IfConfineMaskWithinTheViewer;if(o&&(e&&(n=e._containerElement),n||tr.DWT.Containers&&tr.DWT.Containers.length>0&&tr.DWT.Containers[0].ContainerId&&(n=Xt.get(tr.DWT.Containers[0].ContainerId)),n))for(r=n.getBoundingClientRect(),i=0;i<n.children.length;i++){var a=n.children[i];if(a&&"dvs-root dvs-web-viewer"==a.className){for(a=a.firstElementChild;a;){if(Xt.isFunction(a.getBoundingClientRect)){r=a.getBoundingClientRect();break}a=a.nextSibling}n=a;break}}(n===document.body||r==undefined||tr.DWT.Containers&&tr.DWT.Containers.length>1||tr.DWT.Containers&&1==tr.DWT.Containers.length&&(0==r.width||0==r.height))&&(o=!1,n=null);var s=null!=t?t:{};o&&(s={confined:o,wrapperEl:n}),Qt.showMask(s)}),dz.OnWebTwainPostExecute||(dz.OnWebTwainPostExecute=function(){ui.hideMask()});function fz(e,t){document.body&&ui.setHtml(e,t)}function hz(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 gz(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||tr.DWT.CloseDialog();var r=Xt.get(Qt.install._divDWTNonInstallContainerID);if(r&&r.parentNode&&r.parentNode.removeChild(r),e&&Xt.isDOM(e)&&Xt.show(e),e&&Xt.isString(e))Xt.show(e);else{var n=tr.DWT.WebTwainIdMap;if(n){var i,o,a=Object.keys(n);for(i=0;i<a.length;i++)n[o=a[i]]._containerElement&&Xt.show(n[o]._containerElement)}}""!=Qt.install._divDWTemessageContainer&&Xt.show(Qt.install._divDWTemessageContainer)},Qt._zdgb_xkz_dhk=function(){var e=Qt.install._dlgInstall;if(e){var t=Xt.sizzle(".dynamsoft-dialog-closeTimer",e);if(t.length>0){var r=t[0],n=parseInt(r.style.width);(n-=1)<=0?tr.DWT.CloseDialog():(r.style.width=n+"%",setTimeout(Qt._zdgb_xkz_dhk,100))}}},Qt.ShowLicenseDialog=tr.DWT.ShowMessage,Qt.createLoadingBarContent=function(){};var mz=new WeakSet,pz=function(e){function t(e){var r;return o(this,t),hz(r=i(this,t,[e]),mz),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&&ga(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 oa(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 oa(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 oa(t,-2397,e+" doesn't work under current settings."),ui.Promise.reject({code:t._errorCode,message:t._getErrorString()})}},{key:"_nouiNotSupport",value:function(e,t){var r=this;return oa(r,-2210,"You cannot call this method on this WebTwain instance because it does not use the default viewer."),Xt.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/"),tr.DWT.ConnectWithSocket)this._sendData(e,t,!1,o,a);else{if(d._resetErr(),!d._isValid())return!!h&&void 0;var g=_h.isServerInvalid(d);if(h&&g)return d._waitForConnect().then(function(){return d._innerFunRaw(e,t,h,n,i,o,a)});if(!h&&g)return ds(d),!1;if(c={method:"POST",url:s=[d._httpUrl,f,e].join(""),data:u=bh(d._clientId,e,t,0,d._bScanForProxyRemote?d._dmServiceDWTVersion:""),async:h,onSuccess:function(e,t,r){var n=!1;try{n=Xt.isString(e)&&na(r.getResponseHeader("content-type"))?Xt.parse(e):e}catch(TH){}n?(hu(n)?(d._errorCode=n.exception,d._errorString=n.description,d._errorCause=gu(n)):d._resetErr(),l=i?n:n.result):(_a(d),l=""),Xt.isFunction(o)&&o(l),h&&(l=null)},onError:function(){va(d),l="",!Qt.page.bUnload&&Xt.isFunction(a)&&a()}},!h&&n)de.bIE?(c.dataType="arraybuffer",c.onSuccess=function(e,t,r){var n,i,a,s=!1;r.responseHeadersString&&(ra(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 rz.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=Xt.parse(u),s=!0}catch(f){Xt.log(u)}s?hu(c)?(d._errorCode=c.exception,d._errorString=c.description,d._errorCause=gu(c),l=!1):l=!0:(i=new Uint8Array(u),l=new Blob([i],{type:d._strHttpContentTypeFieldValue}),(a=new rz.ArrayBuffer).append(i),l.md5=a.end())}}Xt.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=Xt.parse(n),u=!0}catch(h){Xt.log(n)}if(u)hu(s)?(d._errorCode=s.exception,d._errorString=s.description,d._errorCause=gu(s),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 rz.ArrayBuffer;f.append(a),l.md5=f.end()}}else l="";Xt.isFunction(o)&&o(l)});else if(h&&n){c={method:"POST",body:u},de.bIE?c.dataType="arraybuffer":c.fetchRaw=!0;var m=nu(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(),$l(e))return Xt.isFunction(o)&&o(e),void(e=null);if(Xt.isObject(e)){var t=e;if(hu(t))d._errorCode=t.exception,d._errorString=t.description,d._errorCause=gu(t),Xt.isFunction(a)&&a();else{var r="";t.result&&(r=t.result),Xt.isFunction(o)&&o(r)}}else va(d),!Qt.page.bUnload&&Xt.isFunction(a)&&a()},function(e){va(d),!Qt.page.bUnload&&Xt.isFunction(a)&&a()}),!0}if(h||Xt.mix(c,{headers:{"X-Requested-With":!1}}),de.bFileSystem&&(c.crossDomain=!1),Ui(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),Xt.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(tr.DWT.ConnectWithSocket)return l(d(t.prototype),"__OnRecieveMsg",this).call(this,e,r);if(hu(e)?(n._errorCode=e.exception,n._errorString=e.description,n._errorCause=gu(e)):"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&&Xt.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&&Xt.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),Xt.log("OnPostLoad Results:"),Sz(a,"On PostLoad"),(r=a._ImgManager.getCurrentImageIndex())>=0&&a._innerRefreshUI(r),0==a._loadImageBytesFileCount&&Xt.isFunction(a.__OnPostLoad))&&(n=e[1].split(","),i=Xt.base64.decode(n[0]),o=Xt.base64.decode(n[1]),Xt.log([i,o,n[2]]),""!=i&&""!=o&&(a.__bServerOnPostLoadFired=!0,setTimeout(function(){a.__OnPostLoad(i,o,n[2])},200)))}},{key:"_OnPostTransfer",value:function(e){var t=this;if(Xt.log("On PostTransfer Results:"+e),Sz(t,"On PostTransfer"),Xt.isFunction(t.__OnPostTransfer))try{t.__OnPostTransfer()}catch(r){_o(r)}}},{key:"_OnPreAllTransfersAsync",value:function(e){var t=this;if(Xt.isFunction(t.__OnPreAllTransfersAsync)){var r={event:"beforeAcquire",result:{}};try{Xt.isArray(e)&&e.length>1&&(r=Xt.parse(e[1]))}catch(kH){}setTimeout(function(){try{t.__OnPreAllTransfersAsync(r)}catch(e){_o(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]),Xt.log("On PostAllTransfers Results:"+e),t.__bLoadingImage=!1,t.__bAcquireImageNow=!1,t.__closeRemoteScanUI(!0),Xt.isFunction(t.__OnPostAllTransfers))try{t.__OnPostAllTransfers()}catch(r){_o(r)}}},{key:"_OnResult",value:function(e){var t=e[1];if(Xt.isFunction(this.__OnResult))try{this.__OnResult(t)}catch(r){_o(r)}}},{key:"_OnTransferCancelled",value:function(e){var t=this;if(t._ImgManager.getCurrentImageIndex(),t._ImgManager.count(),t.__bLoadingImage=!1,t.__bAcquireImageNow=!1,Xt.isFunction(t.__OnTransferCancelled))try{t.__OnTransferCancelled()}catch(r){_o(r)}}},{key:"_OnTransferError",value:function(e){if(Xt.isFunction(this.__OnTransferError))try{this.__OnTransferError()}catch(t){_o(t)}}},{key:"_OnSourceUIClose",value:function(e){var t=this;if(t.__closeRemoteScanUI(!0),Xt.isFunction(t.__OnSourceUIClose))try{t.__OnSourceUIClose()}catch(r){_o(r)}}},{key:"_OnPreTransfer",value:function(e){if(Xt.isFunction(this.__OnPreTransfer))try{this.__OnPreTransfer()}catch(t){_o(t)}}},{key:"_OnPreAllTransfers",value:function(e){if(Xt.isFunction(this.__OnPreAllTransfers))try{this.__OnPreAllTransfers()}catch(t){_o(t)}}},{key:"_OnGetFilePath",value:function(e){var t,r,n,i=this;if(t=e[1].split(","),Xt.log("On GetFilePath Results:"+e),r=Xt.base64.decode(t[3]),n=Xt.base64.decode(t[4]),"-1032"==t[2]&&(t[2]="-1",r=n=""),Xt.isFunction(i.__OnGetFilePath))try{i.__OnGetFilePath(1*t[0]>0,1*t[1],1*t[2],r,n)}catch(o){_o(o)}i.__bOpenFileNow=!1}},{key:"_OnDiskExceedLimit",value:function(){Xt.isFunction(this.__OnDiskExceedLimit)&&this.__OnDiskExceedLimit()}},{key:"__GetLoadEventsNum",value:function(){var e=0;return Xt.isFunction(this.__OnPostLoad)&&(e|=1),Xt.isFunction(this.__OnGetFilePath)&&(e|=2),e}},{key:"_innerSend",value:function(e,t,r,n,i){var o=this;if(tr.DWT.ConnectWithSocket||"SaveSelectedImagesToBytes"!=e&&"ConvertToBlob"!=e)return this._sendData(e,t,r,n,i);var a=sd(),s=bh(o._clientId,e,t,a,o._bScanForProxyRemote?o._dmServiceDWTVersion:"");return o._innerFunRaw(e,s,!0,!0,!0,n,i),ui.Promise.resolve(!0)}},{key:"_convertToBlobByIndices",value:function(e,t,r,n,i,o){var a=this,s=!1,u=function(e){Xt.isFunction(o)&&Kh(o,a,e,t,n),e=null};if(Xt.isFunction(i)&&(s=!0),a._resetErr(),!a._isValid())return u(e),!!s&&void 0;var c=parseInt(t);if(!Zc.checkProductKey(a,{Core:!0}))return u(e),!!s&&void 0;if(!a._checkIndices(e))return u(e),!!s&&void 0;if(c==tr.DWT.EnumDWT_ImageType.IT_BMP||c==tr.DWT.EnumDWT_ImageType.IT_JPG||c==tr.DWT.EnumDWT_ImageType.IT_PNG||c==tr.DWT.EnumDWT_ImageType.IT_J2K){if(e.length>1)return oa(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!=tr.DWT.EnumDWT_ImageType.IT_TIF&&c!=tr.DWT.EnumDWT_ImageType.IT_PDF)return Ga(a),u(e),!!s&&void 0;var l=Gh(a,e);return 0==l.length?(ca(a),u(e),!!s&&void 0):s?(Qt.cancelFrom=jH.ConvertToBlob,void a._innerConvertToBlobWithUI("ConvertToBlob",c,l,r,function(e,r){Xt.isFunction(i)&&Hh(i,e,r,t,n),e=r=null},u)):gz(mz,a,vz).call(a,l,c,r)}},{key:"_getDefaultDevice",value:function(){var e=this;if(e._resetErr(),!e._isValid())return null;var t="",r=ed.TWAINSCANNER,n=e._innerFun("GetDefaultSourceName");if(n.length>0)try{var i=JSON.parse(n);r=i.type,t=Xt.base64.decode(i.ProductName)}catch(a){t=""}var o=new Zd;return o.name=t,o.deviceType=r,o.isSystemDefaultPrinter=!1,tf(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=ef(this,o)).strDevice=o,i._curDevice=r}catch(s){Xt.error(s)}var a=!1;if(Xt.isFunction(i.__OnCurrentDeviceSelected))try{a=i.__OnCurrentDeviceSelected(r,n)}catch(u){_o(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=ed.TWAINSCANNER,a.next=8,e._sendDataByHttpAsync("GetDefaultSourceName");case 8:if((n=a.sent).length>0)try{i=JSON.parse(n),r=i.type,t=Xt.base64.decode(i.ProductName)}catch(s){t=""}return(o=new Zd).name=t,o.deviceType=r,o.isSystemDefaultPrinter=!1,r==ed.TWAINX64SCANNER&&t.length>0?o.displayName="Twain64-"+t:r==ed.ICASCANNER&&this.__serverPlatform==hc.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 $d(this,this._innerFun("GetSources",Zl(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",ui.Promise.reject({code:t._errorCode,message:t._errorString}));case 4:return gz(mz,t,_z).call(t),ld("GetSourceCountAsync",t),r=[],u.prev=7,e&&(t._driverType=e),n=li,i=li,o=li,a=li,t._bRemoteMode?t.__serverPlatform==hc.enumWindow?o=!0:t.__serverPlatform==hc.enumLinux?i=!0:t.__serverPlatform==hc.enumMac?n=!0:t.__serverPlatform==hc.enumAndroid&&(a=!0):(n=de.bMac,i=de.bLinux,o=de.bWin,a=de.bAndroid),s=Nh(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,dd("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=",";Xt.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 Xt.isFunction(n)&&(f=n(l,d,o)),f}return Xt.isFunction(i)&&zh(i,a),!1}},{key:"_getSourceCountSync",value:function(){var e,t=this,r=li,n=li,i=li,o=li;if(t._bRemoteMode?t.__serverPlatform==hc.enumWindow?i=!0:t.__serverPlatform==hc.enumLinux?n=!0:t.__serverPlatform==hc.enumMac?r=!0:t.__serverPlatform==hc.enumAndroid&&(o=!0):(r=de.bMac,n=de.bLinux,i=de.bWin,o=de.bAndroid),e=Nh(this._driverType,i,n,r,o),t._resetErr(),!t._isValid())return 0;if(!Zc.checkProductKey(t,{Core:!0}))return 0;gz(mz,t,_z).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 ta((e=this)._serverInfo.server)&&(cf.item("DWT_port",e._serverInfo.port),cf.item("DWT_ssl",e._serverInfo.ssl?"true":"false")),e._bNoMask||ld("OnReady",e),a.prev=3,a.next=6,l(d(t.prototype),"_OnReady",this).call(this);case 6:if(!ea()){a.next=12;break}if(e._uuidForActiveUI){a.next=12;break}return a.next=10,tr.DWT.lgcuid(tr.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(fc("Changing Map..."),(i=e._id)&&!tr.DWT.WebTwainIdMap[i]&&(tr.DWT.WebTwainIdMap[i]=e),lz(e),o=!1,e._bRemoteMode||(o=Qt.attachAddon(e)),tr.DWT.IfDisableDefaultSettings){a.next=29;break}return fc("Configuring the WebTwain instance..."),a.next=27,Iz(e);case 27:a.next=32;break;case 29:if(!o){a.next=32;break}return a.next=32,new ui.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||dd("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)?(Gs(r),ui.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),gz(mz,r,yz).call(r,t,n)):ui.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,gz(mz,e,yz).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 Gs(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==bc.CM_IMAGEONLY&&r._pdfConvertMode==bc.CM_RENDERALL||r._pdfOptions.convertMode==bc.CM_IMAGEONLY&&r._pdfConvertMode==bc.CM_RENDERALLWITHANNOTATION)?(r._pdfConvertMode=bc.CM_IMAGEONLY,Oa(r),!1):i}},{key:"_checkConvertModeInner",value:function(e){var t=this;return!!Zc.checkProductKey(t,{Core:!0})&&(t._resetErr(),!!t._isValid()&&(e==bc.CM_RENDERALL||e==bc.CM_IMAGEONLY||e==bc.CM_AUTO||e==bc.CM_RENDERALLWITHANNOTATION||(Gs(t),!1)))}},{key:"_resetPdfOptionsWhenSetConvertMode",value:function(e){var t=e.convertMode;t==bc.CM_IMAGEONLY||Zc.hasPDFRProductKey(this)?e.convertMode=t:e.convertMode=bc.CM_IMAGEONLY,e.convertMode==bc.CM_IMAGEONLY||e.convertMode==bc.CM_RENDERALL?e.renderOptions.renderAnnotations=!1:e.convertMode==bc.CM_RENDERALLWITHANNOTATION&&(e.renderOptions.renderAnnotations=!0)}},{key:"_checkPDFPasswordValue",value:function(e){if(!Xt.isUndefined(e)){if(!Xt.isString(e))return oa(this,-2852,"The password is not a string."),!1;if(e.length>32)return function(e){oa(e,-2851,"The password must not exceed 32 characters in length.")}(this),!1}return!0}},{key:"_mixSavedPdfReaderOptions",value:function(e){var t;return t=Xt.clone(this._pdfOptions),e||(e={}),e.convertMode&&(t.convertMode=e.convertMode),Xt.isString(e.password)?t.password=e.password:Xt.isNumber(e.password)&&(t.password=""+e.password),Xt.isBoolean(e.preserveUnmodifiedOnSave)&&(t.preserveUnmodifiedOnSave=e.preserveUnmodifiedOnSave),e.renderOptions&&(t.renderOptions=Xt.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(!Xt.isUndefined(a)&&(!tr.Lib.isNumber(a)||a<=0))return oa(i,-2830,"The PDF resolution must be a positive number."),!1;if(!Xt.isUndefined(s)&&(!tr.Lib.isNumber(s)||s<0))return function(e){oa(e,-2831,"The PDF max width must be a positive number.")}(i),!1;if(!Xt.isUndefined(u)&&(!tr.Lib.isNumber(u)||u<0))return function(e){oa(e,-2832,"The PDF max height must be a positive number.")}(i),!1;if(!Xt.isUndefined(c)&&!tr.Lib.isBoolean(c))return function(e){oa(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=bc.CM_AUTO,o=r.convertMode,Xt.isString(e.password)?r.password=e.password:Xt.isNumber(e.password)?r.password=""+e.password:r.password="",e.preserveUnmodifiedOnSave?r.preserveUnmodifiedOnSave=!0:r.preserveUnmodifiedOnSave=!1,r.renderOptions=Xt.mix({renderAnnotations:!1,resolution:200,maxWidth:0,maxHeight:0,renderGrayscale:!1},e.renderOptions);var l=r.renderOptions.renderAnnotations;Xt.isBoolean(l)||Xt.isString(l)&&(r.renderOptions.renderAnnotations="true"==l.toLowerCase());var d=r.renderOptions.renderGrayscale;if(Xt.isBoolean(d)||Xt.isString(d)&&(r.renderOptions.renderGrayscale="true"==d.toLowerCase()),Xt.isNumber(r.convertMode)){if(!i._checkConvertModeInner(r.convertMode))return!1;Zc.hasPDFRProductKey(i)||(r.convertMode=bc.CM_IMAGEONLY),r.convertMode==bc.CM_IMAGEONLY?r.renderOptions.renderAnnotations=!1:r.convertMode==bc.CM_RENDERALLWITHANNOTATION&&(r.renderOptions.renderAnnotations=!0)}}else{if(Xt.isUndefined(e))return function(e){oa(e,-2834,"The PDF reader options is invalid.")}(i),!1;if(r=e,Xt.isString(e.password)||Xt.isUndefined(e.password));else{if(!Xt.isNumber(e.password))return function(e){oa(e,-2829,"The type of the PDF password must be a string.")}(i),!1;e.password=""+e.password}}var f=i._getPdfDllname();n=["[",Xt.stringify(r),',"',f,'"',"]"].join("");var h=i._innerFun("SetPDFReaderOptions",n);return h&&t&&(i._pdfOptions=Xt.clone(r),Xt.isNumber(r.convertMode)&&(r.convertMode==bc.CM_RENDERALL&&r.renderOptions.renderAnnotations&&(r.convertMode=bc.CM_RENDERALLWITHANNOTATION),i._pdfConvertMode=r.convertMode,i._pdfOptions.convertMode==bc.CM_IMAGEONLY&&o==bc.CM_RENDERALL||i._pdfOptions.convertMode==bc.CM_IMAGEONLY&&o==bc.CM_RENDERALLWITHANNOTATION))?(i._pdfConvertMode=bc.CM_IMAGEONLY,Oa(i),!1):h}},{key:"_getPdfDllname",value:function(){var e=this,t=!1,r=!1;return e._bRemoteMode?e.__serverPlatform==hc.enumWindow||(e.__serverPlatform==hc.enumLinux?r=!0:e.__serverPlatform==hc.enumMac&&(t=!0)):(t=de.bMac,r=de.bLinux,de.bWin),t?e._b64bit?"libDMCodecx64.dylib":"libDMCodec.dylib":r?"libDMCodec.so":e._b64bit?"DMCodecx64.dll":"DMCodec.dll"}},{key:"_unload_viewer",value:function(){}},{key:"__innerDeleteInMap",value:function(){return this._id,delete tr.DWT.WebTwainIdMap[this._id],di}},{key:"__unload",value:(c=n(g().mark(function C(){var e,r,n,i;return g().wrap(function(o){for(;;)switch(o.prev=o.next){case 0:if(e=this,r=Xt.clone(tr.DWT.licenseException),e.__closeRemoteScanUI(!0),!e._destroy&&!e._destroying){o.next=5;break}return o.abrupt("return");case 5:return 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(),tr.DWT.lremoveDWTObj(e),o.prev=12,o.next=15,l(d(t.prototype),"__unload",this).call(this);case 15:o.next=20;break;case 17:o.prev=17,o.t0=o["catch"](12),n=o.t0;case 20:if(e.__bAcquireImageNow=!1,e._destroying=!1,e._destroy=!0,(i=tr.DWT.licenseException).code=r.code,i.message=r.message,i.fromLTS=r.fromLTS,!n){o.next=29;break}throw n;case 29:case"end":return o.stop()}},C,this,[[12,17]])})),function(){return c.apply(this,arguments)})},{key:"_setIfShowUI",value:function(e){this._resetErr(),this._isValid()&&(Xt.isBoolean(e)?this._innerFun("IfShowUI",Zl(e)):la(self))}},{key:"_setIfShowFileDialog",value:function(e){this._resetErr(),this._isValid()&&(Xt.isBoolean(e)?this._innerFun("IfShowFileDialog",Zl(e)):la(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||Xt.isNumber(t)){c.next=4;break}return $a(i),c.abrupt("return",ui.Promise.reject({code:i._errorCode,message:i._errorString}));case 4:if(a=i._bRemoteMode?rd:de.bAndroid?id:rd,s=null!=t?t:a,i._resetErr(),i._isValid()){c.next=8;break}return c.abrupt("return",ui.Promise.reject({code:i._errorCode,message:i._errorString}));case 8:return ld(e,i),c.prev=9,c.next=12,i._getDevices(s,r,n);case 12:u=c.sent,Xt.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,dd(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),ui.Promise.reject(e)})):ui.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}):ui.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;ui.dialog.selectsourcedlg&&(ui.dialog.selectsourcedlg.close(),document.body.removeChild(ui.dialog.selectsourcedlg),ui.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(""),Xt.isArray(r)&&r.length>=3?(c=r[0],l=r[1],d=r[2]):(c="Select Source:",l="Select",d="Cancel"),fz(o,["<p>",c,"</p>",'<div id="dynamsoft-dialog-selectsource-sourcelist">',u,"</div>",'<div><button class="dynamsoft-dialog-selectsource-button-select" >',l,"</button>",'<button class="dynamsoft-dialog-selectsource-button-cancel" >',d,"</button></div>"].join("")),ui.dialog.selectsourcedlg=o,a.body.appendChild(ui.dialog.selectsourcedlg),Xt.each(Xt.sizzle(".dynamsoft-dialog-selectsource-item"),function(e,t){Xt.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",Xt.get("dynamsoft-dialog-selectsource-sourcelist-ul").setAttribute("selectedSourceIndex",r)})}),Xt.get("dynamsoft-dialog-selectsource-sourcelist-ul").setAttribute("selectedSourceIndex",f.toString()),ui.dialog.setup(ui.dialog.selectsourcedlg),ui.dialog.selectsourcedlg&&ui.dialog.selectsourcedlg.showModal(),"CSS1Compat"==a.compatMode?a.documentElement.scrollTop:a.body.scrollTop,new ui.Promise(function(t,r){Xt.removeEventListener(ui.one(".dynamsoft-dialog-selectsource-button-select")[0],"click"),Xt.removeEventListener(ui.one(".dynamsoft-dialog-selectsource-button-cancel")[0],"click"),s>0&&Xt.addEventListener(ui.one(".dynamsoft-dialog-selectsource-button-select")[0],"click",function(){var r=parseInt(Xt.get("dynamsoft-dialog-selectsource-sourcelist-ul").getAttribute("selectedSourceIndex"));r<0||n._selectSourceByIndexAsync(e,r).then(function(){ui.dialog.selectsourcedlg&&(ui.dialog.selectsourcedlg.close(),document.body.removeChild(ui.dialog.selectsourcedlg),ui.dialog.selectsourcedlg=!1),t(r)})}),Xt.addEventListener(ui.one(".dynamsoft-dialog-selectsource-button-cancel")[0],"click",function(){ui.dialog.selectsourcedlg&&(ui.dialog.selectsourcedlg.close(),document.body.removeChild(ui.dialog.selectsourcedlg),ui.dialog.selectsourcedlg=!1);var e={};vs(e),r({code:e._errorCode,message:e._errorString})})})}):ui.Promise.reject({code:n._errorCode,message:n._errorString})}},{key:"_dwtGetCapabilities",value:function(e,t,r){var n=this,i=null,o=function(){Xt.isFunction(r)&&r(n._errorCode,n._errorString)};if(e){if(!Xt.isArray(e))return $a(n),void o();if(0==e.length)return void(Xt.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,Xt.isString(r)){var a=r;r=parseInt(r),(Xt.isNaN(r)||r!=a)&&(n=!0)}if(0==n&&Xt.isNumber(r)?(r<1||r>65535)&&(i=!0):n=!0,n)return $a(e),!1;if(i)return zs(e),!1}return!0}(n,e))return void o();i=Zl(e)}n._sendDataByHttpAsync("GetCapabilities",i).then(function(e){try{var r,i;e.length>0&&(i=e[0]),Xt.isString(i)?(i=Qt.removeNonPrintableChar(i),0==(r=JSON.parse(i)).errorCode?Xt.isFunction(t)&&t(r.response):(n._errorCode=r.errorCode,n._errorString=r.errorString,o())):(xs(n),o())}catch(a){n._errorCode=-2302,n._errorString=a,o()}},o)}},{key:"_dwtSetCapabilities",value:function(e,t,r){var n=this;if(!Xt.isObject(e)||Xt.isArray(e))return $a(n),Xt.isFunction(r)&&r(n._errorCode,n._getErrorString()),!1;var i=["[",Xt.stringify(e),"]"].join("");return n._innerSend("SetCapabilities",i,0,function(e){Xt.isFunction(t)&&t(e)},r),!0}},{key:"_selectDeviceAsync",value:(a=n(g().mark(function k(e,r,n){var i,o;return g().wrap(function(a){for(;;)switch(a.prev=a.next){case 0:return i=this,ld(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,dd(e),a.finish(12);case 15:return a.abrupt("return",o);case 16:case"end":return a.stop()}},k,this,[[2,9,12,15]])})),function(e,t,r){return a.apply(this,arguments)})},{key:"_selectSourceByIndexAsync",value:(r=n(g().mark(function E(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",ui.Promise.reject({code:r._errorCode,message:r._errorString}));case 4:if(!Xt.isNaN(n)){o.next=7;break}return ca(r),o.abrupt("return",ui.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 Va(r),o.abrupt("return",ui.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()}},E,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",Zl(i.join(",")),!1,!1,!1,function(){},function(){}),Xt.isArray(r))return r[0]}else r=!0;return r}},{key:"_removeImage",value:function(e,t){var r,n=this,i=parseInt(t);if(!Uh(n,i))return!1;var o=n._ImgManager.convertClientIndexToServerId(i);return-1==o?(Va(n),!1):(((r=n._innerFun("RemoveImage",Zl(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 ui.Promise(function(r,n){var o="LoadImage"==e||"LoadImageEx"==e||"GenerateURLForUploadData"==e,a=o||"LoadDibFromClipboard"==e;o?Qt.showProgress(i,e,!1):ld(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 dd(e);a&&i._canConsume()&&tr.DWT.lcvrf(i),Xt.isFunction(r)&&r(t)},function(t){o?Qt.closeProgress(null,""):dd(e),i.__bLoadingImage=!1,i.__bAcquireImageNow=!1,i.__bOpenFileNow=!1,i.__closeRemoteScanUI(!0);var r=i._ImgManager.getCurrentImageIndex();r>=0&&i._innerRefreshUI(r),mu(i._errorCode)&&Oa(i),Xt.isFunction(n)&&n({code:i._errorCode,message:i._getErrorString()}),o?Qt.closeProgress(null,e):dd(e),t&&Xt.error(t)})})}},{key:"_innerLoadImageFromBinary",value:function(e,t,r,n,i,o){var a,s,u=this,c=t;if(!Zc.checkProductKey(u,{Core:!0}))return Xt.isFunction(o)&&o(u._errorCode,u._getErrorString()),!1;if(!e||""==e)return ka(u),Xt.isFunction(o)&&o(u._errorCode,u._getErrorString()),!1;if(Xt.isString(e))return $a(u),Xt.isFunction(o)&&o(u._errorCode,u._getErrorString()),!1;if(e instanceof Blob)s=e.size;else if($l(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 $a(u),Xt.isFunction(o)&&o(u._errorCode,u._getErrorString()),!1;var d=e.currentFileName;d||(d=u._getCurrentDocumentName());var f,h=e.currentTagName;if(h||!Xt.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(Xt.asyncQueue.stop(),Kl.stop(),g=0;g<e.length;g++)e[g].currentFileName=d,e[g].currentTagName=h,g==e.length-1?Xt.asyncQueue.pushToDo(u,"_innerLoadImageFromBinary",[e[g],c,r,i,o]):Xt.asyncQueue.pushToDo(u,"_innerLoadImageFromBinary",[e[g],c,r,null,o]);return Xt.asyncQueue.start(),!0}return ka(u),Xt.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&&$l(m)&&((m=new Blob([e])).currentFileName=e.currentFileName,m.currentTagName=e.currentTagName);var p=-1,v=n,_=tr.DWT.EnumDWT_ImageType;Xt.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:"ErrorCause",get:function(){return this._errorCause}},{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,_}(iz);function vz(e,t,r){var n=this;return n._dwtConvertToBlobSync(t,e,r,function(e){if(!e||e.size<=0)return Ya(n),!1;var t=n.__maxUploadImageSize;return e.size>t&&-1!=t?(wa(n),!1):e},function(e){return!1})}function _z(){this.__defaultSourceName="",this.__sourceCount=0}function yz(e,t){var r=this,n=r._getPdfDllname(),i=["[",Xt.stringify(e),',"',n,'"',"]"].join("");return r._innerFunV2("SetPDFReaderOptions",i).then(function(){if(Xt.isNumber(t)&&(r._pdfConvertMode=t),r._pdfOptions.convertMode=e.convertMode,r._pdfOptions.renderOptions.renderAnnotations=e.renderOptions.renderAnnotations,r._pdfOptions.preserveUnmodifiedOnSave=e.preserveUnmodifiedOnSave,r._pdfOptions.convertMode==bc.CM_IMAGEONLY&&r._pdfConvertMode==bc.CM_RENDERALL||r._pdfOptions.convertMode==bc.CM_IMAGEONLY&&r._pdfConvertMode==bc.CM_RENDERALLWITHANNOTATION)throw r._pdfConvertMode=bc.CM_IMAGEONLY,Oa(r),{code:r._errorCode,message:r._errorString};return!0})}var Sz=function(e,t){if(Lo.bDiscardBlankImage){var r=e._ImgManager.getCurrentImageIndex();e.IsBlankImage(r)&&e.RemoveImage(r);var n=["Blank Discard (",t,"): ",e.ErrorString].join("");Xt.isFunction(e.__OnPrintMsg)&&e.__OnPrintMsg(n)}};function Iz(e){return bz.apply(this,arguments)}function bz(){return(bz=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,!tr.DWT.ConnectWithSocket){e.next=6;break}return e.next=4,new ui.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=Fh.TWAIN,i=!1,o=!1,r._bRemoteMode?r.__serverPlatform==hc.enumWindow||(r.__serverPlatform==hc.enumLinux?o=!0:r.__serverPlatform==hc.enumMac&&(i=!0)):(i=de.bMac,o=de.bLinux,de.bWin),i?n=Fh.TWAIN_AND_ICA:o&&(n=Fh.SANE),t._driverType=n,t._bRemoteMode&&(t._setIfShowUI(!1),t._setIfShowFileDialog(!1));case 13:case"end":return e.stop()}},e)}))).apply(this,arguments)}function Tz(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 Cz(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 wz=new WeakSet,kz=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 Tz(e=i(this,t,[].concat(n)),wz),e}return f(t,e),s(t,[{key:"SaveAsGIF",value:function(e,t,r,n){var i=this,o=!1;if(Xt.isFunction(r)&&(o=!0),i._resetErr(),!i._isValid())return Xt.isFunction(n)&&zh(n,i),!!o&&void 0;if(!(Zc.checkProductKey(i,{Core:!0})||de.bWin&&Zc.checkProductKey(i,{Webcam:!0},!0)))return Zc.checkProductKey(i,{Core:!0},!1),Xt.isFunction(n)&&n(i._errorCode,i._getErrorString()),!!o&&void 0;var a,s=Wh.replaceLocalFilename(e);if(!Mh(i,t,n))return!!o&&void 0;if(-1==(a=i._ImgManager.convertClientIndexToServerId(t)))return Va(i),Xt.isFunction(n)&&zh(n,i),!!o&&void 0;var u=i.__GetLoadEventsNum(),c=i.__innerSaveImage("SaveAsGIF",Zl(s,a,u),r,n);return o?void 0:c}},{key:"SaveSelectedImagesToBase64Binary",value:function(e,t){var r=this,n=!1;if(Xt.isFunction(e)&&(n=!0),r._resetErr(),!r._isValid())return Xt.isFunction(t)&&zh(t,r),!!n&&void 0;if(!(Zc.checkProductKey(r,{Core:!0})||de.bWin&&Zc.checkProductKey(r,{Webcam:!0},!0)))return Zc.checkProductKey(r,{Core:!0},!1),Xt.isFunction(t)&&t(r._errorCode,r._getErrorString()),!!n&&void 0;var i=Lh(r);return 0==i.length?(da(r),Xt.isFunction(t)&&zh(t,r),!!n&&void 0):n?void r._innerSend("SaveSelectedImagesToBase64Binary",Zl(i.join(",")),!0,e,t):r._innerFun("SaveSelectedImagesToBase64Binary",Zl(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=Wh.replaceLocalFilename(i);return c=u.__GetLoadEventsNum(),u._innerSend("ShowFileDialog",Zl(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(Xt.isFunction(r)&&(o=!0),i._resetErr(),!i._isValid())return Xt.isFunction(n)&&zh(n,i),!!o&&void 0;if(!e)return $a(i),Xt.isFunction(n)&&zh(n,i),!!o&&void 0;var a=Wh.getImageType(t);return Cz(wz,i,Dz).call(i,"FTPDownload",[e,t],a,r,n)}},{key:"FTPDownloadEx",value:function(e,t,r,n,i){var o=this,a=!1;return Xt.isFunction(n)&&(a=!0),o._resetErr(),o._isValid()?e?Cz(wz,o,Dz).call(o,"FTPDownloadEx",[e,t,r],r,n,i):($a(o),Xt.isFunction(i)&&zh(i,o),!!a&&void 0):(Xt.isFunction(i)&&zh(i,o),!!a&&void 0)}},{key:"FTPUpload",value:function(e,t,r,n,i){var o=this,a=!1;if(Xt.isFunction(n)&&(a=!0),o._resetErr(),!o._isValid())return Xt.isFunction(i)&&zh(i,o),!!a&&void 0;if(!Mh(o,t,i))return!!a&&void 0;var s=o._ImgManager.convertClientIndexToServerId(t);if(-1==s)return Va(o),Xt.isFunction(i)&&zh(i,o),!!a&&void 0;var u=o.__innerFTPUpload("FTPUpload",Zl(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(Xt.isFunction(i)&&(u=!0),s._resetErr(),!s._isValid())return Xt.isFunction(o)&&zh(o,s),!!u&&void 0;if(!Mh(s,t,o))return!!u&&void 0;if(-1==(a=s._ImgManager.convertClientIndexToServerId(t)))return Va(s),Xt.isFunction(o)&&zh(o,s),!!u&&void 0;var c=s.__innerFTPUpload("FTPUploadEx",Zl(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(Xt.isFunction(r)&&(o=!0),i._resetErr(),!i._isValid())return Xt.isFunction(n)&&zh(n,i),!!o&&void 0;var a=[];Oh(i,a);var s=i.__innerFTPUpload("FTPUploadAsMultiPageTIFF",Zl(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(Xt.isFunction(r)&&(o=!0),i._resetErr(),!i._isValid())return Xt.isFunction(n)&&zh(n,i),!!o&&void 0;var a=[];Oh(i,a);var s=i.__innerFTPUpload("FTPUploadAsMultiPagePDF",Zl(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(Xt.isFunction(r)&&(o=!0),i._resetErr(),!i._isValid())return Xt.isFunction(n)&&zh(n,i),!!o&&void 0;var a=Lh(i),s=i.__innerFTPUpload("FTPUploadAsMultiPagePDF",Zl(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(Xt.isFunction(r)&&(o=!0),i._resetErr(),!i._isValid())return Xt.isFunction(n)&&zh(n,i),!!o&&void 0;var a=Lh(i),s=i.__innerFTPUpload("FTPUploadAsMultiPageTIFF",Zl(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(Xt.isFunction(n)&&(s=!0),a._resetErr(),!a._isValid())return Xt.isFunction(i)&&zh(i,a),!!s&&void 0;if(!Zc.checkProductKey(a,{Core:!0}))return Xt.isFunction(i)&&zh(i,a),!!s&&void 0;var u,c,l=a._GetHttpHeadersAndClear(),d=Wh.combineUrl(a,e,t);if(d===undefined)return ka(a),Xt.isFunction(i)&&zh(i,a),!!s&&void 0;if(!r||""==r)return function(e,t){oa(e,-2309,"The LocalFile is empty in the name "+t+" Function.")}(a,"HTTPDownloadDirectly"),Xt.isFunction(i)&&zh(i,a),!!s&&void 0;if(u=Wh.getImageType(r),!Zc.checkPDFProductKeyWhenNeeds(a,u))return Xt.isFunction(i)&&zh(i,a),!!s&&void 0;Qt.cancelFrom=jH.HTTPDownload,c=Wh.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"),Xt.isFunction(n)&&n(),!0},g=function(){return Qt.progressContext&&(Qt.progressContext.IfShowCancelDialogWhenImageTransfer=f),a.IfShowProgressBar&&Qt.closeProgress(null,"HTTPDownloadDirectly"),Xt.isFunction(i)&&zh(i,a),!1};a._OnPercentDone([0,-1,Fl.Downloading,"http"]),Qt.progressContext&&(Qt.progressContext.IfShowCancelDialogWhenImageTransfer=!0);var m=Wh.loadHttpBlob(a,"get",d,s,function(e){Qt.progressContext&&(Qt.progressContext.IfShowCancelDialogWhenImageTransfer=f),a._OnPercentDone([0,-1,Fl.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(){Xt.isFunction(o)&&zh(o,a,a.__HTTPPostResponseString)};if(Xt.isFunction(i)&&(s=!0),a._resetErr(),a.__HTTPPostResponseString="",!a._isValid())return u(),!!s&&void 0;var c=Wh.combineUrl(a,e,r);if(!t)return Ea(a),u(),!!s&&void 0;if(!e)return pa(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(Xt.isFunction(u)&&(m=!0),e===undefined||!1===e||""===e)return ka(f),Xt.isFunction(c)&&zh(c,f),!!m&&void 0;if(!Zc.checkProductKey(f,{Core:!0}))return Xt.isFunction(c)&&zh(c,f),!!m&&void 0;Qt.cancelFrom=jH.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),Xt.isFunction(c)&&zh(c,f),!1};return Qt.needShowTwiceShowDialog=!0,n?Qt.showProgress(f,g,!1):Qt.hideProgress(),(l=Wh.replaceLocalFilename(t))&&""!=l?s&&s.bCancel?(s.st=2,vs(f),p(f._errorCode,f._errorString),!!m&&void 0):(d=Cz(wz,f,xz).call(f,l,m,i,function(t){if(Qt.needShowTwiceShowDialog=!1,s&&s.bCancel)return s.st=2,vs(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&&XH(f.__IfShowCancelDialogWhenImageTransfer);var i=new ZH,c=f._createHttpUploaderConfig(),l=new $H;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=Wz(f.httpFormFields),l.retry=o,l.bOnlyResponseEmptyIsOK=a,l.blockSize=f._moduleSize,i.httpPostUpload(c,l,function(e){return n&&Qt.closeProgress(null,g),Xt.isFunction(u)&&Hh(u,e),!0},p)}return Ea(f),p(f._errorCode,f._errorString),!1},p),m?void 0:!!d):(Ea(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(Xt.isFunction(s)&&(h=!0),!1===e||""===e)return ka(l),Xt.isFunction(u)&&u({code:l._errorCode,message:l._getErrorString(),files:t}),!1;if(!Zc.checkProductKey(l,{Core:!0}))return Xt.isFunction(u)&&u({code:l._errorCode,message:l._getErrorString(),files:t}),!1;Qt.cancelFrom=jH.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),Xt.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(),Xt.each(t,function(e){var t=Wh.replaceLocalFilename(e);if(!t||""==t)return Ea(l),m(l._errorCode,l._errorString),!1;g.push(t)});var p=[],v=g.length,_=0;return Xt.each(g,function(t,u){c=Cz(wz,l,xz).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),ya(l),Xt.isFunction(m)&&m(l._errorCode,l._errorString),!1;var i=JH(r,u+1);if(t instanceof File?t.fileName=i:t.name=i,p[u]=t,t=null,++_==v){n&&XH(l.__IfShowCancelDialogWhenImageTransfer);var c=l._createHttpUploaderConfig(),g=new $H;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=Wz(l.httpFormFields),g.retry=o,g.bOnlyResponseEmptyIsOK=a,g.blockSize=l._moduleSize;var y=YH(c,g,function(e){return n&&Qt.closeProgress(null,f),Xt.isFunction(s)&&Hh(s,e),!0},function(e,t,r){return n&&Qt.closeProgress(null,f),Xt.isFunction(m)&&m(e,t,r),!1});return h?void 0:y}},function(){return n&&Qt.closeProgress(null,f),Xt.isFunction(m)&&m(),!1})}),h?void 0:!!c}},{key:"_createHttpUploaderConfig",value:function(){var e=this,t=new ez;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){Xt.isFunction(e.__OnHttpUploadStatus)&&e.__OnHttpUploadStatus(t)},t}},{key:"SetUploadSegment",value:function(e,t){var r=this;return r._resetErr(),!!r._isValid()&&(!Xt.isNumber(e)||e<0?(oa(r,-2367,"Invalid value for the parameter segmentUploadThreshold."),!1):!Xt.isNumber(t)||t<=0?(function(e){oa(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(Xt.isFunction(r)&&(s=!0),o._resetErr(),!o._isValid())return Xt.isFunction(n)&&Kh(n,o,e,t,a),!!s&&void 0;var u=parseInt(t);if(!Zc.checkProductKey(o,{Core:!0}))return Xt.isFunction(n)&&Kh(n,o,e,t,a),!!s&&void 0;if(!o._checkIndices(e))return Xt.isFunction(n)&&Kh(n,o,e,t,a),!!s&&void 0;if(u==tr.DWT.EnumDWT_ImageType.IT_BMP||u==tr.DWT.EnumDWT_ImageType.IT_JPG||u==tr.DWT.EnumDWT_ImageType.IT_PNG){if(e.length>1)return oa(o,-2361,"You cannot convert more than one image to base64 string when the format is BMP, JPG or PNG."),Xt.isFunction(n)&&Kh(n,o,e,t,a),!!s&&void 0}else if(u!=tr.DWT.EnumDWT_ImageType.IT_TIF&&u!=tr.DWT.EnumDWT_ImageType.IT_PDF)return Ga(o),Xt.isFunction(n)&&Kh(n,o,e,t,a),!!s&&void 0;if(0==(i=Gh(o,e)).length)return ca(o),Xt.isFunction(n)&&Kh(n,o,e,t,a),!!s&&void 0;Qt.cancelFrom=jH.ConvertToBlob,o._convertToBase64ByServerIdsWithUI("ConvertToBase64",i,u,!1,3,function(e){var n=[];Xt.isArray(i)&&Xt.each(i,function(e){var t=o._ImgManager.convertServerIdToClientIndex(e);t>-1&&n.push(t)}),Xt.isFunction(r)&&Hh(r,e,n,t,a)},function(){var e=[];Xt.isArray(i)&&Xt.each(i,function(t){var r=o._ImgManager.convertServerIdToClientIndex(t);r>-1&&e.push(r)}),Xt.isFunction(n)&&Kh(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 Xt.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=Wh.combineUrl(u,e,t),d=!1;if(Xt.isFunction(n)&&(d=!0),l===undefined)return ka(u),Xt.isFunction(i)&&zh(i,u,""),!!d&&void 0;if(!Zc.checkProductKey(u,{Core:!0}))return Xt.isFunction(i)&&zh(i,u,""),!!d&&void 0;if(!Zc.checkPDFProductKeyWhenNeeds(u,r))return Xt.isFunction(i)&&zh(i,u,""),!!d&&void 0;Qt.cancelFrom=jH.HTTPDownload,u.IfShowProgressBar?Qt.showProgress(u,"HttpDownloadThroughPost",!1):Qt.hideProgress();u._OnPercentDone([0,-1,Fl.Downloading,"http"]);var f=null===(a=Qt.progressContext)||void 0===a?void 0:a.IfShowCancelDialogWhenImageTransfer,h=function(){return u.IfShowProgressBar&&Qt.closeProgress(null,"HttpDownloadThroughPost"),Xt.isFunction(n)&&n(),!0},g=function(){return Qt.progressContext&&(Qt.progressContext.IfShowCancelDialogWhenImageTransfer=f),u.IfShowProgressBar&&Qt.closeProgress(null,"HttpDownloadThroughPost"),Xt.isFunction(i)&&zh(i,u,u.__HTTPPostResponseString),!1};return Qt.progressContext&&(Qt.progressContext.IfShowCancelDialogWhenImageTransfer=!0),s=Wh.loadHttpBlob(u,"post",l,d,function(e){Qt.progressContext&&(Qt.progressContext.IfShowCancelDialogWhenImageTransfer=f),u._OnPercentDone([0,-1,Fl.Loading]);var t=r;t!=tr.DWT.EnumDWT_ImageType.IT_BMP&&t!=tr.DWT.EnumDWT_ImageType.IT_JPG&&t!=tr.DWT.EnumDWT_ImageType.IT_TIF&&t!=tr.DWT.EnumDWT_ImageType.IT_PNG&&t!=tr.DWT.EnumDWT_ImageType.IT_PDF&&t!=tr.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=Wh.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=Wh.combineUrl(a,e,r),l=!1,d=[],f=!1,h=this.IfShowProgressBar;if(Xt.isFunction(i)&&(l=!0),c===undefined)return ka(a),Xt.isFunction(o)&&Kh(o,a,"",[t],r,n),!!l&&void 0;Qt.cancelFrom=jH.HTTPPut;var g,m=function(){Qt.needShowTwiceShowDialog=!1,h&&Qt.closeProgress(null,u),Xt.isFunction(o)&&Kh(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 Va(a),m(),!!l&&void 0}if(""===e)return pa(a),m(),!!l&&void 0;var v=[];Xt.isArray(d)&&Xt.each(d,function(e){var t=a._ImgManager.convertClientIndexToServerId(e);-1!=t&&v.push(t)});var _=!1;a._OnPercentDone([0,-1,Fl.Encoding,"http"]);var y=function(e,t,o){if(tr.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?(wa(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,Fl.Uploading,"http"]),h&&XH(a.__IfShowCancelDialogWhenImageTransfer),Qt.cancelFrom=jH.HTTPPut,f=Wh.httpPutImage(a,c,e,l,function(e){if(e&&(a.__HTTPPostResponseString=e),h&&Qt.closeProgress(null,u),Xt.isFunction(i)){var t=[];Xt.isArray(v)&&Xt.each(v,function(e){var r=a._ImgManager.convertServerIdToClientIndex(e);r>-1&&t.push(r)}),Hh(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=Lh(t);return t._innerFun("GetSelectedImagesSize",Zl(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||!Xt.isString(o))return Xt.isUndefined(o)?oa(r,-2356,"The header name cannot be undefined."):""===o?function(e){oa(e,-2354,"The header name cannot be empty.")}(r):null===o?function(e){oa(e,-2355,"The header name cannot be null.")}(r):function(e){oa(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 Ba(r),!1;return Xt.isUndefined(t)||null===t||""===t?(e in r.__httpHeaderMap&&delete r.__httpHeaderMap[e],!0):(Xt.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=jH.HTTPUpload;var v=function(e,r,n){var i=[];if(Xt.isArray(t)&&Xt.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,Xt.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,Fl.Encoding,"http"]),Xt.each(t,function(e,i){f._convertToBlobForUpload(h,[e],a,4,function(e,a,d){if(!e||e.size<=0)return Ta(f),v(f._errorCode,f._errorString);var h=f.__maxUploadImageSize;if(e.size>h&&-1!=h)return wa(f),v(f._errorCode,f._errorString);var b=JH(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>=_){tr.DWT.IfAddMD5InUploadHeader&&a&&""!=a&&(r["dwt-md5"]=a);var T=f._createHttpUploaderConfig(),C=new $H;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,YH(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,Xt.isFunction(l)){var r=[];Xt.isArray(t)&&Xt.each(t,function(e){var t=f._ImgManager.convertServerIdToClientIndex(e);t>-1&&r.push(t)}),Hh(l,e,r)}}(e)},v)}e=null},v,[e,i])})}},{key:"_getVersionInfoAsync",value:function(){return qo.versionInfoFromServer?ui.Promise.resolve(qo.versionInfoFromServer):this._innerFunV2("VersionInfo")}},{key:"__innerLoadImage",value:function(e,t,r,n,i,o,a,s){var u,c=this,l=!1;if((Xt.isFunction(a)||tr.DWT.ConnectWithSocket)&&(l=!0),!Zc.checkProductKey(c,{Core:!0}))return Xt.isFunction(s)&&s({code:c._errorCode,message:c._getErrorString()}),l?void 0:(t=null,!1);if(!Zc.checkPDFProductKeyWhenNeeds(c,n))return Xt.isFunction(s)&&s({code:c._errorCode,message:c._getErrorString()}),l?void 0:(t=null,!1);if(n==af.IT_MULTIPAGE_PDF||n==af.IT_MULTIPAGE_TIF)return Ga(c),Xt.isFunction(s)&&s({code:c._errorCode,message:c._getErrorString()}),l?void 0:(t=null,!1);if(u=t,l){if(c._bRemoteMode&&c._getIfShowFileDialog())return u=null,t=null,hs(c),void(Xt.isFunction(s)&&s({code:c._errorCode,message:c._getErrorString()}));var d=tr.DWT.IfConfineMaskWithinTheViewer;c.Viewer&&c.Viewer.webViewer&&c.Viewer.webViewer.imageEditor&&c.Viewer.webViewer.imageEditor.inner&&1==c.Viewer.webViewer.imageEditor.inner.bShowImageEditor&&c.Viewer.webViewer.imageEditor.inner.bShowImageEditor&&(tr.DWT.IfConfineMaskWithinTheViewer=!1);var f=c.IfShowCancelDialogWhenImageTransfer;return c.IfShowCancelDialogWhenImageTransfer=!1,void c.__innerAcquireOrLoadImageAsync(e,r,i,!0).then(function(){c.IfShowCancelDialogWhenImageTransfer=f,tr.DWT.IfConfineMaskWithinTheViewer=d,u=null,t=null,Xt.isFunction(a)&&a()},function(r){if(c.IfShowCancelDialogWhenImageTransfer=f,tr.DWT.IfConfineMaskWithinTheViewer=d,c._errorCode=r.code,c._errorString=r.message,("LoadImage"==e||"LoadImageEx"==e)&&c.__OnPostLoad&&!c.__bServerOnPostLoadFired){var i=Wh.getFilePath(u),o=Wh.getFileName(u);c.__OnPostLoad(i,o,""+n)}u=null,t=null,Xt.isFunction(s)&&s(r)})}if(c._bRemoteMode&&c._getIfShowFileDialog())return u=null,t=null,hs(c),!1;var h=c._getCurrentDocumentName(),g=c._getCurrentDefaultTagName(),m=c.__innerLoadImageFun(e,r,o,h,g);if(m&&Xt.isString(u)&&""!=u&&c.__OnPostLoad&&!c.__bServerOnPostLoadFired){var p=Wh.getFilePath(u),v=Wh.getFileName(u);setTimeout(function(){c.__bServerOnPostLoadFired||c.__OnPostLoad(p,v,""+n)},10)}return u=null,t=null,m}},{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&&Xt.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];Xt.isObject(c)?u=c.imageInfos:-1!=c||"LoadImage"!=e&&"LoadImageEx"!=e&&"LoadImageFromBase64Binary"!=e&&"LoadDibFromClipboard"!=e||(s=!1)}Xt.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()&&tr.DWT.lcvrf(a),!0}return mu(a._errorCode)&&Oa(a),!1}},{key:"__innerSaveImage",value:function(e,t,r,n){var i,o=this,a=!1;if(Xt.isFunction(r)&&(a=!0),a&&o._OnPercentDone([0,-1,Fl.Encoding]),o._bRemoteMode||(tr.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 hs(o),void(Xt.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(){a&&("SaveAsPNG"!=e&&"SaveAsJPEG"!=e&&"SaveAsBMP"!=e&&"SaveAsBMP"!=e||o._OnPercentDone([0,100,"","http"])),Qt.progressContext&&(Qt.progressContext.IfShowCancelDialogWhenImageTransfer=s),setTimeout(function(){Qt.closeProgress(null,e)},0),Xt.isFunction(r)&&r()},function(t){return Qt.progressContext&&(Qt.progressContext.IfShowCancelDialogWhenImageTransfer=s),Xt.isFunction(n)&&n(o._errorCode,o._getErrorString()),Qt.closeProgress(null,e),t&&Xt.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"):li}},{key:"SaveAsBMP",value:function(e,t,r,n){var i=this,o=!1;if((Xt.isFunction(r)||de.bAndroid)&&(o=!0),i._resetErr(),!i._isValid())return Xt.isFunction(n)&&zh(n,i),!!o&&void 0;if(!(Zc.checkProductKey(i,{Core:!0})||de.bWin&&Zc.checkProductKey(i,{Webcam:!0},!0)))return Zc.checkProductKey(i,{Core:!0},!1),Xt.isFunction(n)&&zh(n,i),!!o&&void 0;var a,s=Wh.replaceLocalFilename(e);if(!Mh(i,t,n))return!!o&&void 0;if(de.bAndroid){if(0==i._ImgManager.count())return da(i),void(Xt.isFunction(n)&&zh(n,i));var u=[];return u.push(t),void i._saveImages("SaveAsBMP",s,u,af.IT_BMP).then(function(){Xt.isFunction(r)&&r()})["catch"](function(e){Xt.isFunction(n)&&n(e.code,e.message)})}if(-1==(a=i._ImgManager.convertClientIndexToServerId(t)))return Va(i),Xt.isFunction(n)&&zh(n,i),!!o&&void 0;var c=i.__GetLoadEventsNum(),l=i.__innerSaveImage("SaveAsBMP",Zl(s,a,c),r,n);return o?void 0:l}},{key:"SaveAsJPEG",value:function(e,t,r,n){var i=this,o=!1;if((Xt.isFunction(r)||de.bAndroid)&&(o=!0),i._resetErr(),!i._isValid())return Xt.isFunction(n)&&zh(n,i),!!o&&void 0;if(!(Zc.checkProductKey(i,{Core:!0})||de.bWin&&Zc.checkProductKey(i,{Webcam:!0},!0)))return Zc.checkProductKey(i,{Core:!0},!1),Xt.isFunction(n)&&zh(n,i),!!o&&void 0;if(!Mh(i,t,n))return!!o&&void 0;var a,s=Wh.replaceLocalFilename(e);if(de.bAndroid){if(0==i._ImgManager.count())return da(i),void(Xt.isFunction(n)&&zh(n,i));var u=[];return u.push(t),void i._saveImages("SaveAsJPEG",s,u,af.IT_JPG).then(function(){Xt.isFunction(r)&&r()})["catch"](function(e){Xt.isFunction(n)&&n(e.code,e.message)})}if(-1==(a=i._ImgManager.convertClientIndexToServerId(t)))return Va(i),Xt.isFunction(n)&&zh(n,i),!!o&&void 0;var c=i.__GetLoadEventsNum(),l=i.__innerSaveImage("SaveAsJPEG",Zl(s,a,c),r,n);return o?void 0:l}},{key:"SaveAsPDF",value:function(e,t,r,n){var i=this,o=!1;if((Xt.isFunction(r)||de.bAndroid)&&(o=!0),i._resetErr(),!i._isValid())return Xt.isFunction(n)&&zh(n,i),!!o&&void 0;if(!(Zc.checkProductKey(i,{Core:!0})||de.bWin&&Zc.checkProductKey(i,{Webcam:!0},!0)))return Zc.checkProductKey(i,{Core:!0},!1),Xt.isFunction(n)&&zh(n,i),!!o&&void 0;if(!Mh(i,t,n))return!!o&&void 0;var a,s=Wh.replaceLocalFilename(e);if(de.bAndroid){if(0==i._ImgManager.count())return da(i),void(Xt.isFunction(n)&&zh(n,i));var u=[];return u.push(t),void i._saveImages("SaveSelectedImagesAsMultiPagePDF",s,u,af.IT_PDF).then(function(){Xt.isFunction(r)&&r()})["catch"](function(e){Xt.isFunction(n)&&n(e.code,e.message)})}if(-1==(a=i._ImgManager.convertClientIndexToServerId(t)))return Va(i),Xt.isFunction(n)&&zh(n,i),!!o&&void 0;var c=[a],l=i.__GetLoadEventsNum(),d=i.__innerSaveImage("SaveSelectedImagesAsMultiPagePDF",Zl(s,c.join(","),l),r,n);return o?void 0:d}},{key:"SaveAsPNG",value:function(e,t,r,n){var i=this,o=!1;if((Xt.isFunction(r)||de.bAndroid)&&(o=!0),i._resetErr(),!i._isValid())return Xt.isFunction(n)&&zh(n,i),!!o&&void 0;if(!(Zc.checkProductKey(i,{Core:!0})||de.bWin&&Zc.checkProductKey(i,{Webcam:!0},!0)))return Zc.checkProductKey(i,{Core:!0},!1),Xt.isFunction(n)&&zh(n,i),!!o&&void 0;if(!Mh(i,t,n))return!!o&&void 0;var a,s=Wh.replaceLocalFilename(e);if(de.bAndroid){if(0==i._ImgManager.count())return da(i),void(Xt.isFunction(n)&&zh(n,i));var u=[];return u.push(t),void i._saveImages("SaveAsPNG",s,u,af.IT_PNG).then(function(){Xt.isFunction(r)&&r()})["catch"](function(e){Xt.isFunction(n)&&n(e.code,e.message)})}if(-1==(a=i._ImgManager.convertClientIndexToServerId(t)))return Va(i),Xt.isFunction(n)&&zh(n,i),!!o&&void 0;var c=i.__GetLoadEventsNum(),l=i.__innerSaveImage("SaveAsPNG",Zl(s,a,c),r,n);return o?void 0:l}},{key:"SaveAsTIFF",value:function(e,t,r,n){var i=this,o=!1;if((Xt.isFunction(r)||de.bAndroid)&&(o=!0),i._resetErr(),!i._isValid())return Xt.isFunction(n)&&zh(n,i),!!o&&void 0;if(!(Zc.checkProductKey(i,{Core:!0})||de.bWin&&Zc.checkProductKey(i,{Webcam:!0},!0)))return Zc.checkProductKey(i,{Core:!0},!1),Xt.isFunction(n)&&zh(n,i),!!o&&void 0;if(!Mh(i,t,n))return!!o&&void 0;var a,s=Wh.replaceLocalFilename(e);if(de.bAndroid){if(0==i._ImgManager.count())return da(i),void(Xt.isFunction(n)&&zh(n,i));var u=[];return u.push(t),void i._saveImages("SaveAsTIFF",s,u,af.IT_TIF).then(function(){Xt.isFunction(r)&&r()})["catch"](function(e){Xt.isFunction(n)&&n(e.code,e.message)})}if(-1==(a=i._ImgManager.convertClientIndexToServerId(t)))return Va(i),Xt.isFunction(n)&&zh(n,i),!!o&&void 0;var c=i.__GetLoadEventsNum(),l=i.__innerSaveImage("SaveAsTIFF",Zl(s,a,c),r,n);return o?void 0:l}},{key:"SaveSelectedImagesAsMultiPagePDF",value:function(e,t,r){var n=this,i=!1;if((Xt.isFunction(t)||de.bAndroid)&&(i=!0),n._resetErr(),!n._isValid())return Xt.isFunction(r)&&zh(r,n),!!i&&void 0;if(!(Zc.checkProductKey(n,{Core:!0})||de.bWin&&Zc.checkProductKey(n,{Webcam:!0},!0)))return Zc.checkProductKey(n,{Core:!0},!1),Xt.isFunction(r)&&zh(r,n),!!i&&void 0;var o=Wh.replaceLocalFilename(e);if(!de.bAndroid){var a=Lh(n);if(0==a.length)return da(n),Xt.isFunction(r)&&zh(r,n),!!i&&void 0;var s=n.__GetLoadEventsNum(),u=n.__innerSaveImage("SaveSelectedImagesAsMultiPagePDF",Zl(o,a.join(","),s),t,r);return i?void 0:u}if(0==n._ImgManager.count())return da(n),void(Xt.isFunction(r)&&zh(r,n));var c=Bh(n);n._saveImages("SaveSelectedImagesAsMultiPagePDF",o,c,af.IT_PDF).then(function(){Xt.isFunction(t)&&t()})["catch"](function(e){Xt.isFunction(r)&&r(e.code,e.message)})}},{key:"SaveSelectedImagesAsMultiPageTIFF",value:function(e,t,r){var n=this,i=!1;if((Xt.isFunction(t)||de.bAndroid)&&(i=!0),n._resetErr(),!n._isValid())return Xt.isFunction(r)&&zh(r,n),!!i&&void 0;if(!(Zc.checkProductKey(n,{Core:!0})||de.bWin&&Zc.checkProductKey(n,{Webcam:!0},!0)))return Zc.checkProductKey(n,{Core:!0},!1),Xt.isFunction(r)&&zh(r,n),!!i&&void 0;var o=Wh.replaceLocalFilename(e);if(!de.bAndroid){var a=Lh(n);if(0==a.length)return da(n),Xt.isFunction(r)&&zh(r,n),!!i&&void 0;var s=n.__GetLoadEventsNum(),u=n.__innerSaveImage("SaveSelectedImagesAsMultiPageTIFF",Zl(o,a.join(","),s),t,r);return i?void 0:u}if(0==n._ImgManager.count())return da(n),void(Xt.isFunction(r)&&zh(r,n));var c=Bh(n);n._saveImages("SaveSelectedImagesAsMultiPageTIFF",o,c,af.IT_TIF).then(function(){Xt.isFunction(t)&&t()})["catch"](function(e){Xt.isFunction(r)&&r(e.code,e.message)})}},{key:"SaveAllAsMultiPageTIFF",value:function(e,t,r){var n=this,i=!1;if((Xt.isFunction(t)||de.bAndroid)&&(i=!0),n._resetErr(),!n._isValid())return Xt.isFunction(r)&&zh(r,n),!!i&&void 0;if(!(Zc.checkProductKey(n,{Core:!0})||de.bWin&&Zc.checkProductKey(n,{Webcam:!0},!0)))return Zc.checkProductKey(n,{Core:!0},!1),Xt.isFunction(r)&&zh(r,n),!!i&&void 0;if(!Rh(n,r))return!!i&&void 0;var o=[],a=Wh.replaceLocalFilename(e);if(!de.bAndroid){if(Oh(n,o),0==o.length)return da(n),Xt.isFunction(r)&&zh(r,n),!!i&&void 0;var s=n.__GetLoadEventsNum(),u=n.__innerSaveImage("SaveSelectedImagesAsMultiPageTIFF",Zl(a,o.join(","),s),t,r);return i?void 0:u}if(0==n._ImgManager.count())return da(n),void(Xt.isFunction(r)&&zh(r,n));for(var c=[],l=0;l<this._ImgManager.count();l++)c.push(l);n._saveImages("SaveAllAsMultiPageTIFF",a,c,af.IT_TIF).then(function(){Xt.isFunction(t)&&t()})["catch"](function(e){Xt.isFunction(r)&&r(e.code,e.message)})}},{key:"SaveAllAsPDF",value:function(e,t,r){var n=this,i=!1;if((Xt.isFunction(t)||de.bAndroid)&&(i=!0),n._resetErr(),!n._isValid())return Xt.isFunction(r)&&zh(r,n),!!i&&void 0;if(!(Zc.checkProductKey(n,{Core:!0})||de.bWin&&Zc.checkProductKey(n,{Webcam:!0},!0)))return Zc.checkProductKey(n,{Core:!0},!1),Xt.isFunction(r)&&zh(r,n),!!i&&void 0;if(!Rh(n,r))return!!i&&void 0;var o=[],a=Wh.replaceLocalFilename(e);if(!de.bAndroid){if(Oh(n,o),0==o.length)return da(n),Xt.isFunction(r)&&zh(r,n),!!i&&void 0;var s=n.__GetLoadEventsNum(),u=n.__innerSaveImage("SaveSelectedImagesAsMultiPagePDF",Zl(a,o.join(","),s),t,r);return i?void 0:u}if(0==n._ImgManager.count())return da(n),void(Xt.isFunction(r)&&zh(r,n));for(var c=[],l=0;l<this._ImgManager.count();l++)c.push(l);n._saveImages("SaveAllAsPDF",a,c,af.IT_PDF).then(function(){Xt.isFunction(t)&&t()})["catch"](function(e){Xt.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(Xt.isFunction(arguments[4])&&Xt.isFunction(arguments[5])&&(u="RemoteFile",l=arguments[4],arguments.length>5&&(d=arguments[5])),s._isValid()){var f,h=arguments,g=function(e){Xt.isFunction(d)&&Kh(d,s,s.__HTTPPostResponseString,e,h)};if(Xt.isUndefined(e)||""===e)return ka(s),void(g&&g(t));if(!Xt.isString(e))return za(s),void(g&&g(t));if(s._checkIndices(t)){var m=Gh(s,t);if(0==m.length)return ca(s),void(g&&g(t));if(Xt.isUndefined(r))return Ga(s),void(g&&g(t));if(r==tr.DWT.EnumDWT_ImageType.IT_BMP||r==tr.DWT.EnumDWT_ImageType.IT_JPG||r==tr.DWT.EnumDWT_ImageType.IT_PNG){if(m.length>1)return Ma(s),void g(t)}else if(r!=tr.DWT.EnumDWT_ImageType.IT_TIF&&r!=tr.DWT.EnumDWT_ImageType.IT_PDF)return Ga(s),void g(t);if(Xt.isUndefined(n)||n!=tr.DWT.EnumDWT_UploadDataFormat.Binary&&n!=tr.DWT.EnumDWT_UploadDataFormat.Base64)return Ha(s),void g(t);f={method:"HTTPUpload",url:e,serverIds:m,headers:c,formData:Wz(s.httpFormFields),enumImageType:r,saveSetup:!1,dataFormat:n,fileName:u,retry:0,bOnlyResponseEmptyIsOK:!0,objUploadFileStatus:!1,asyncSuccessFunc:function(e,t){Xt.isFunction(l)&&Hh(l,s.__HTTPPostResponseString,t,h)},asyncFailureFunc:g},this._asyncUploadCmd(f)}else g&&g(t)}else Xt.isFunction(d)&&zh(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(Xt.isUndefined(s)||""===s)return ka(o),void(Xt.isFunction(n)&&zh(n,o,""));if(!Xt.isString(s))return za(o),void(Xt.isFunction(n)&&zh(n,o,""));0!=s.indexOf("http://")&&0!=s.indexOf("https://")&&(s=$o()?"https://"+s:"http://"+s),o.__HTTPPostResponseString="",Qt.cancelFrom=jH.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),Xt.isFunction(n)&&zh(n,o,o.__HTTPPostResponseString)},u?Qt.showProgress(o,a,!1):Qt.hideProgress(),Qt.needShowTwiceShowDialog=!0,o._OnPercentDone([0,-1,Fl.Uploading,"http"]);var c=o._createHttpUploaderConfig(),l=new $H;o.__remoteFilename&&""!=o.__remoteFilename&&(l.remoteFilename=o.__remoteFilename),l.url=s,l.method=a,l.content=[],l.headers=t,l.httpFormData=Wz(o.httpFormFields),l.blockSize=o._moduleSize,(new ZH).httpPostUpload(c,l,function(t){Qt.needShowTwiceShowDialog=!1,Qt.closeProgress(null,a),Xt.isFunction(r)&&Hh(r,t,e,[e,r,n])},i)}else Xt.isFunction(n)&&zh(n,o,"")}},{key:"HTTPUploadThroughPost",value:function(e,t,r,n,i,o,a){var s=this,u=!1;if(Xt.isFunction(i)&&(u=!0),s._resetErr(),!s._isValid())return!!u&&void 0;var c=Wh.getImageType(n),l=arguments,d=!1,f=function(e){return Xt.isFunction(o)&&Kh(o,s,s.__HTTPPostResponseString,e,l),!1};return Xt.isString(n)&&""!=n?(i&&Xt.isFunction(i)&&(d=function(e,t){return Hh(i,s.__HTTPPostResponseString,t,l),!0}),Fz(s,t,c,f)?Cz(wz,s,Ez).call(s,e,t,r,n,c,d,f,a):!!u&&void 0):(Ta(s),f(),!!u&&void 0)}},{key:"HTTPUploadThroughPostEx",value:function(e,t,r,n,i,o,a,s){var u=this,c=!1;if(Xt.isFunction(o)&&(c=!0),u._resetErr(),!u._isValid())return Xt.isFunction(a)&&Kh(a,u,""),!!c&&void 0;var l=arguments,d=!1,f=function(e){Xt.isFunction(a)&&Kh(a,u,u.__HTTPPostResponseString,e,l)};return Xt.isString(n)&&""!=n?(o&&Xt.isFunction(o)&&(d=function(e,t){Hh(o,u.__HTTPPostResponseString,t,l)}),Fz(u,t,i,f)?Cz(wz,u,Ez).call(u,e,t,r,n,i,d,f,s):!!c&&void 0):(Ta(u),f(),!!c&&void 0)}},{key:"HTTPUploadAllThroughPostAsMultiPageTIFF",value:function(e,t,r,n,i,o){var a=this,s=!1;if(Xt.isFunction(n)&&(s=!0),a._resetErr(),!a._isValid())return Xt.isFunction(i)&&Kh(i,a,""),!!s&&void 0;var u=arguments,c=!1,l=function(e){Xt.isFunction(i)&&Kh(i,a,a.__HTTPPostResponseString,e,u)};return Xt.isString(r)&&""!=r?(s&&(c=function(e,t){Hh(n,a.__HTTPPostResponseString,t,u)}),Cz(wz,a,Ez).call(a,e,-1,t,r,2,c,l,o)):(Ta(a),l(),!!s&&void 0)}},{key:"HTTPUploadAllThroughPostAsPDF",value:function(e,t,r,n,i,o){var a=this,s=!1;if(Xt.isFunction(n)&&(s=!0),a._resetErr(),!a._isValid())return Xt.isFunction(i)&&zh(i,a,""),!!s&&void 0;var u=arguments,c=!1,l=function(e){return Xt.isFunction(i)&&Kh(i,a,a.__HTTPPostResponseString,e,u),!1};return Xt.isString(r)&&""!=r?(s&&(c=function(e,t){Hh(n,a.__HTTPPostResponseString,t,u)}),Cz(wz,a,Ez).call(a,e,-1,t,r,4,c,l,o)):(Ta(a),l())}},{key:"HTTPUploadThroughPostAsMultiPagePDF",value:function(e,t,r,n,i,o){var a=this,s=!1;if(Xt.isFunction(n)&&(s=!0),a._resetErr(),!a._isValid())return Xt.isFunction(i)&&zh(i,a,""),!!s&&void 0;var u=arguments,c=!1,l=function(e){Xt.isFunction(i)&&Kh(i,a,a.__HTTPPostResponseString,e,u)};return Xt.isString(r)&&""!=r?(s&&(c=function(e,t){Hh(n,a.__HTTPPostResponseString,t,u)}),Cz(wz,a,Ez).call(a,e,-2,t,r,4,c,l,o)):(Ta(a),l(),!!s&&void 0)}},{key:"HTTPUploadThroughPostAsMultiPageTIFF",value:function(e,t,r,n,i,o){var a=this,s=!1;if(Xt.isFunction(n)&&(s=!0),a._resetErr(),!a._isValid())return Xt.isFunction(i)&&zh(i,a,""),!!s&&void 0;var u=arguments,c=!1,l=function(e){Xt.isFunction(i)&&Kh(i,a,a.__HTTPPostResponseString,e,u)};return Xt.isString(r)&&""!=r?(s&&(c=function(e,t){Hh(n,a.__HTTPPostResponseString,t,u)}),Cz(wz,a,Ez).call(a,e,-2,t,r,2,c,l,o)):(Ta(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=Wh.combineUrl(u,t,r),f=!1;if(Xt.isFunction(i)&&(f=!0),d===undefined)return ka(u),Xt.isFunction(o)&&zh(o,u),!!f&&void 0;if(!Zc.checkProductKey(u,{Core:!0}))return Xt.isFunction(o)&&zh(o,u),!!f&&void 0;if(!Zc.checkPDFProductKeyWhenNeeds(u,n))return Xt.isFunction(o)&&zh(o,u),!!f&&void 0;Qt.cancelFrom=jH.HTTPDownload;var h=null===(a=Qt.progressContext)||void 0===a?void 0:a.IfShowCancelDialogWhenImageTransfer,g=u._getCurrentDocumentName(),m=u._getCurrentDefaultTagName();return Xt.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,Fl.Downloading,"http"]),s=Wh.loadHttpBlob(u,"get",d,f,function(t){Qt.progressContext&&(Qt.progressContext.IfShowCancelDialogWhenImageTransfer=h),l&&f&&XH(!1),u._OnPercentDone([0,-1,Fl.Loading]);var a=n;a!=tr.DWT.EnumDWT_ImageType.IT_BMP&&a!=tr.DWT.EnumDWT_ImageType.IT_JPG&&a!=tr.DWT.EnumDWT_ImageType.IT_TIF&&a!=tr.DWT.EnumDWT_ImageType.IT_PNG&&a!=tr.DWT.EnumDWT_ImageType.IT_PDF&&a!=tr.DWT.EnumDWT_ImageType.IT_J2K&&(a=-1);var s=u.__GetLoadEventsNum(),c=Wh.getFileName(r);return t.currentFileName=g,t.currentTagName=m,t.name=c,u._loadImageBytesFileCount+=1,u.__LoadImageFromBytesV1(t,a,"",s,f,function(){if(l&&f&&Qt.closeProgress(null,e),u._loadImageBytesFileCount-=1,u.__OnPostLoad&&!u.__bServerOnPostLoadFired){var t=Wh.getFilePath(d);u.__OnPostLoad(t,c,""+a)}return c=null,Xt.isFunction(i)&&i(),!0},function(){if(l&&f&&Qt.closeProgress(null,e),u._loadImageBytesFileCount-=1,u.__OnPostLoad&&!u.__bServerOnPostLoadFired){var t=Wh.getFilePath(d);u.__OnPostLoad(t,c,""+a)}return c=null,Xt.isFunction(o)&&zh(o,u),!1})},function(){Qt.progressContext&&(Qt.progressContext.IfShowCancelDialogWhenImageTransfer=h),l&&f&&Qt.closeProgress(null,e);var t=Wh.getFileName(r);if(u.__OnPostLoad&&!u.__bServerOnPostLoadFired){var i=Wh.getFilePath(d);u.__OnPostLoad(i,t,""+n)}return Xt.isFunction(o)&&zh(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,o=n.__bServerOnPostLoadFired;if(n._resetErr(),!Xt.isFunction(t)||(i=!0,!o)){if(!n._isValid())return Xt.isFunction(r)&&zh(r,n),!!i&&void 0;var a,s,u,c=Wh.replaceLocalFilename(e),l=Wh.getImageType(c);t&&Xt.isFunction(t)&&(s=function(e){t()}),r&&Xt.isFunction(r)&&(u=function(e){r(e.code,e.message)}),a=n.__GetLoadEventsNum(),""==c&&(n.__bOpenFileNow=!0);var d=n._getCurrentDocumentName(),f=n._getCurrentDefaultTagName();return n.__innerLoadImage("LoadImage",e,Zl(c,a,1,d,f),l,!0,1,s,u)}setTimeout(function(){n.LoadImage(e,t,r)},10)}},{key:"LoadImageEx",value:function(e,t,r,n){var i=this,o=!1,a=i.__bServerOnPostLoadFired;if(i._resetErr(),Xt.isFunction(r)&&(o=!0,a))setTimeout(function(){i.LoadImageEx(e,t,r,n)},10);else{if(!i._isValid())return Xt.isFunction(n)&&zh(n,i),!!o&&void 0;var s,u,c,l=Wh.replaceLocalFilename(e),d=t;if(r&&Xt.isFunction(r)&&(u=function(e){r()}),n&&Xt.isFunction(n)&&(c=function(e){n(e.code,e.message)}),!de.bAndroid){d==tr.DWT.EnumDWT_ImageType.IT_ALL&&(d=-1),s=i.__GetLoadEventsNum(),""==l&&(i.__bOpenFileNow=!0);var f=i._getCurrentDocumentName(),h=i._getCurrentDefaultTagName();return i.__innerLoadImage("LoadImageEx",e,Zl(l,d,s,1,f,h),d,!0,1,u,c)}var g=ui.one(".d-loadImage");if(0==g.length){var m=document.createElement("input");m._stwain=i,m.setAttribute("type","file"),m.setAttribute("multiple","multiple"),m.style.position="absolute",m.style.top="-9999px",m.style.left="-9999px",m.style.width="1px",m.style.height="1px",m.className="d-loadImage",t==tr.DWT.EnumDWT_ImageType.IT_BMP?m.setAttribute("accept","image/bmp"):t==tr.DWT.EnumDWT_ImageType.IT_JPG?m.setAttribute("accept","image/jpeg"):t==tr.DWT.EnumDWT_ImageType.IT_TIF?m.setAttribute("accept","image/tiff"):t==tr.DWT.EnumDWT_ImageType.IT_PNG?m.setAttribute("accept","image/png"):t==tr.DWT.EnumDWT_ImageType.IT_PDF?m.setAttribute("accept",".pdf"):t==tr.DWT.EnumDWT_ImageType.IT_J2K?m.setAttribute("accept",".jp2,.j2k,.j2c"):Lo.bMobile?m.setAttribute("accept","image/jpeg,image/png,image/tiff,image/tif"):m.setAttribute("accept","image/*,.pdf,.jp2,.j2k,.j2c"),m.ondoubleclick=function(){this.files.length>0&&this._stwain.LoadImageFromBinary(this.files,u,c),this.value="",this._stwain=null,m&&m.parentElement.removeChild(m)},m.onchange=function(){this.files.length>0&&this._stwain.LoadImageFromBinary(this.files,u,c),this.value="",this._stwain=null,m&&m.parentElement.removeChild(m)},document.body.appendChild(m),m.click()}else t==tr.DWT.EnumDWT_ImageType.IT_BMP?g[0].setAttribute("accept","image/bmp"):t==tr.DWT.EnumDWT_ImageType.IT_JPG?g[0].setAttribute("accept","image/jpeg"):t==tr.DWT.EnumDWT_ImageType.IT_TIF?g[0].setAttribute("accept","image/tiff"):t==tr.DWT.EnumDWT_ImageType.IT_PNG?g[0].setAttribute("accept","image/png"):t==tr.DWT.EnumDWT_ImageType.IT_PDF?g[0].setAttribute("accept",".pdf"):t==tr.DWT.EnumDWT_ImageType.IT_J2K?g[0].setAttribute("accept",".jp2,.j2k,.j2c"):Lo.bMobile?g[0].setAttribute("accept","image/jpeg,image/png,image/tiff,image/tif"):g[0].setAttribute("accept","image/*,.pdf,.jp2,.j2k,.j2c"),g[0].value="",g[0]._stwain=i,g[0].click()}}},{key:"HTTPDownload",value:function(e,t,r,n){var i=this,o=!1;if(Xt.isFunction(r)&&(o=!0),i._resetErr(),!i._isValid())return Xt.isFunction(n)&&zh(n,i),!!o&&void 0;var a=Wh.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 Xt.isFunction(n)&&(a=!0),o._resetErr(),o._isValid()?o._innerHTTPDownloadThroughGet("HTTPDownloadEx",e,t,r,n,i):(Xt.isFunction(i)&&zh(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(){Xt.isFunction(r)&&r()})["catch"](function(e){Xt.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!=af.IT_ALL&&r!=af.IT_MULTIPAGE_PDF&&r!=af.IT_MULTIPAGE_TIF){a.next=5;break}throw Cs(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==af.IT_PDF&&(o="PDF File"),s=QH(e,r),Xt.isUndefined(s)&&(s=e),r!=af.IT_PDF&&r!=af.IT_TIF){a.next=15;break}return a.abrupt("return",new ui.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===af.IT_BMP?20:a.t0===af.IT_JPG?22:a.t0===af.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 ui.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 ys(n),{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=this,n=!1,i=r.__bServerOnPostLoadFired;if(r._resetErr(),!Xt.isFunction(e)||(n=!0,!i)){if(!r._isValid())return Xt.isFunction(t)&&zh(t,r),!!n&&void 0;if(r._bRemoteMode)return oa(r,-2609,"LoadDibFromClipboard is not supported when Object is created by CreateRemoteScanObjectAsync."),Xt.isFunction(t)&&zh(t,r),!!n&&void 0;var o,a;e&&Xt.isFunction(e)&&(o=function(t){e()}),t&&Xt.isFunction(t)&&(a=function(e){t(e.code,e.message)});var s;return s=r.__GetLoadEventsNum(),r.__innerLoadImage("LoadDibFromClipboard","",Zl(s,1),-1,!0,1,o,a)}setTimeout(function(){r.LoadDibFromClipboard(e,t)},10)}},{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=jH.FTPUpload,Cz(wz,this,Pz).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(Xt.isArray(l)&&Xt.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),Xt.isFunction(a))try{a(o)}catch(c){}return!1};return Xt.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),Xt.isFunction(o)){var t=[];Xt.isArray(l)&&Xt.each(l,function(e){var r=n._ImgManager.convertServerIdToClientIndex(e);r>-1&&t.push(r)});try{Hh(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(Xt.isUndefined(a))return Ga(e),Xt.isFunction(g)&&g(e._errorCode,e._errorString,""),!1;e._resetErr(),Qt.cancelFrom=jH.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),Xt.isFunction(g)&&g(e._errorCode,e._errorString,e.__HTTPPostResponseString,o),!1},b=e._createHttpUploaderConfig();if(b.objUploadStatus=f,v=QH(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==tr.DWT.EnumDWT_UploadDataFormat.Binary){if(f&&f.bCancel)return f.st=2,vs(e),I(e._errorCode,e._errorString);e._OnPercentDone([0,-1,Fl.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),Xt.isFunction(h)&&Hh(h,r),!0},f&&f.bCancel)return f.st=2,vs(e),I(e._errorCode,e._errorString);if(!r||r.size<=0)return Ta(e),I(e._errorCode,e._errorString);var s=e.__maxUploadImageSize;if(r.size>s&&-1!=s)return wa(e),I(e._errorCode,e._errorString);if(0!=e._errorCode)return I(e._errorCode,e._errorString);if(tr.DWT.IfAddMD5InUploadHeader&&o&&""!=o&&(n["dwt-md5"]=o),y>0&&r.size>y){e._OnPercentDone([0,-1,Fl.Uploading,"http",v]);var u=new ZH,c=new $H;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 ZH,m=new $H;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==tr.DWT.EnumDWT_UploadDataFormat.Base64){e._convertToBase64ByServerIdsWithUI(t,o,m,c,4,function(r){var o;if(!r||r.getLength()<=0)return Ta(e),I(e._errorCode,e._errorString);if(S=function(){return Qt.needShowTwiceShowDialog=!1,e.IfShowProgressBar&&Qt.closeProgress(null,t),Xt.isFunction(h)&&Hh(h,r),!0},y>0&&r.getLength()>y){o=r.getMD5(),tr.DWT.IfAddMD5InUploadHeader&&(n["dwt-md5"]=o),e._OnPercentDone([0,-1,Fl.Uploading,"http"]);var a=new $H;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 ZH).httpPostUploadFragment(b,a,S,I)}else{var s;if(o=r.getMD5(),tr.DWT.IfAddMD5InUploadHeader&&(n["dwt-md5"]=o),!(s=r.getData(0,r.getLength()))||""==s)return Ta(e),I(e._errorCode,e._errorString);var u=new $H;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 ZH).httpPostUpload(b,u,S,I)}},I)}}}]);var r}(pz);function Ez(e,t,r,n,i,o,a,s){var u,c,l=this,d="HTTPUploadThroughPostEx",f=l._GetHttpHeadersAndClear(),h=Wh.combineUrl(l,e,r),g=[],m=function(e){Xt.isFunction(a)&&a(e)},p=!1,v=!1;if(Xt.isFunction(o)&&(v=!0),l.__HTTPPostResponseString="",Xt.isNumber(t)){if(t<-2)return Va(l),m(t),!!v&&void 0}else if(!Xt.isArray(t))return Va(l),m(t),!!v&&void 0;if(!Xt.isString(n)||""==n)return Ta(l),m(),!!v&&void 0;if(Xt.isUndefined(i))return Ga(l),m(t),!!v&&void 0;if(i==tr.DWT.EnumDWT_ImageType.IT_BMP||i==tr.DWT.EnumDWT_ImageType.IT_JPG||i==tr.DWT.EnumDWT_ImageType.IT_PNG||i==tr.DWT.EnumDWT_ImageType.IT_J2K){if(-1==t&&l._ImgManager.count()>1||Xt.isArray(t)&&t.length>1)return Ma(l),m(t),!!v&&void 0;Xt.isArray(t)?g.push(t[0]):-1==t?g.push(0):g.push(t)}else{if(i!=tr.DWT.EnumDWT_ImageType.IT_TIF&&i!=tr.DWT.EnumDWT_ImageType.IT_PDF)return Ga(l),m(t),!!v&&void 0;if(-1==t){if(0==l._ImgManager.count())return da(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(Xt.isArray(t))for(c=0;c<t.length;c++)g.push(t[c]);else g.push(t)}if(""===e)return pa(l),m(g),!!v&&void 0;if(Xt.isUndefined(h)||""===h)return ka(l),m(g),!!v&&void 0;if(!Xt.isString(h))return za(l),m(g),!!v&&void 0;if(0!=h.indexOf("http://")&&0!=h.indexOf("https://")&&(h=$o()?"https://"+h:"http://"+h),!l._checkIndices(g)&&-1!=g)return m(g),!!v&&void 0;var _=[];if(Xt.isArray(g)&&Xt.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=jH.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,Fl.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 wa(l),S(l._errorCode,l._errorString),!1;tr.DWT.IfAddMD5InUploadHeader&&t&&""!=t&&(f["dwt-md5"]=t),e instanceof File?e.fileName=n:e.name=n,y&&XH(l.__IfShowCancelDialogWhenImageTransfer);var i=l._createHttpUploaderConfig(),o=new $H;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=Wz(l.httpFormFields),o.blockSize=l._moduleSize,(new ZH).httpPostUpload(i,o,function(e){return y&&Qt.closeProgress(null,d),e},S)}var a={};return ya(a),S(a._errorCode,a._errorString),!1},S)}u={method:"HTTPUploadThroughPostEx",url:h,serverIds:_,headers:f,formData:Wz(l.httpFormFields),enumImageType:i,saveSetup:p,fileName:n,retry:0,bOnlyResponseEmptyIsOK:!0,objUploadFileStatus:!1,dataFormat:tr.DWT.EnumDWT_UploadDataFormat.Binary,asyncSuccessFunc:o,asyncFailureFunc:m},this._asyncUploadCmd(u)}function xz(e,t,r,n,i){var o=this,a=!0;if(t)return o._innerFunRaw("SaveSelectedImagesToBytes",Zl(0,0,e,r),t,a,!0,function(e){if(Xt.isFunction(n)){var t=new Blob([e],{type:o._strHttpContentTypeFieldValue});n(t),t=null}},i),!0;var s=o._innerFunRaw("SaveSelectedImagesToBytes",Zl(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 Az(){return this._resetErr(),!!this._isValid()&&(this._innerSend("SetCancel",null,!0),!0)}function Pz(e,t,r,n,i){var o=this;if(!Xt.isFunction(n))return this._innerFun(e,t);o.IfShowProgressBar?(Qt.showProgress(o,e,r),r&&Qt.progressContext&&Qt.progressContext.on("cancel",function(){Cz(wz,o,Az).call(o)})):Qt.hideProgress(),this._innerSend(e,t,!0,function(){Qt.closeProgress(null,e),Xt.isFunction(n)&&n()},function(t){Xt.isFunction(i)&&i(o._errorCode,o._getErrorString()),Qt.closeProgress(null,e),t&&Xt.error(t)})}function Dz(e,t,r,n,i){var o,a,s=this,u=!1;if(Xt.isFunction(n)&&(u=!0),!Zc.checkProductKey(s,{Core:!0}))return Xt.isFunction(i)&&zh(i,s),!!u&&void 0;if(!Zc.checkPDFProductKeyWhenNeeds(s,r))return Xt.isFunction(i)&&zh(i,s),!!u&&void 0;Qt.cancelFrom=jH.FTPDownload;var c,l="";if(t&&t.length>=2){var d=t[0],f=t[1];0==d.toLowerCase().indexOf("ftp://")&&(d=d.substring(6,d.length)),d&&d.length>1&&"/"==d[d.length-1]&&(d=d.substring(0,d.length-1)),f&&f.length>0&&"/"!=f[0]&&(f="/"+f);var h=["ftp://",d,f].join("");c=Wh.getFilePath(h),l=Wh.getFileName(h),o=2==t.length?Zl(d,f):Zl(d,f,t[2])}if(!u){var g=s._getCurrentDocumentName(),m=s._getCurrentDefaultTagName();(a=s.__innerLoadImageFun(e,o,1,g,m))&&s.__OnPostLoad&&!s.__bServerOnPostLoadFired&&setTimeout(function(){s.__bServerOnPostLoadFired||s.__OnPostLoad(c,l,""+r)},10);var p=s._ImgManager.getCurrentImageIndex();return p>=0&&s._innerRefreshUI(p),a}Cz(wz,s,Pz).call(s,e,o,!0,function(){var e=s._ImgManager.getCurrentImageIndex();e>=0&&s._innerRefreshUI(e),s._canConsume()&&tr.DWT.lcvrf(s),s.__OnPostLoad&&!s.__bServerOnPostLoadFired&&s.__OnPostLoad(c,l,""+r),Xt.isFunction(n)&&n()},function(){s.__OnPostLoad&&!s.__bServerOnPostLoadFired&&s.__OnPostLoad(c,l,""+r),Xt.isFunction(i)&&zh(i,s)})}function Fz(e,t,r,n){if(0==e._ImgManager.count())return da(e),Xt.isFunction(n)&&n(t),!1;if(Xt.isNumber(t)){if(isNaN(t)||t<-2||t>=e._ImgManager.count())return Va(e),Xt.isFunction(n)&&n(t),!1}else{if(!Xt.isArray(t))return Va(e),Xt.isFunction(n)&&n(t),!1;var i;for(i=0;i<t.length;i++){var o=t[i];if(isNaN(o)||!Xt.isNumber(o)||o<0||o>=e._ImgManager.count())return La(e),Xt.isFunction(n)&&n(t),!1}}if(r==tr.DWT.EnumDWT_ImageType.IT_BMP||r==tr.DWT.EnumDWT_ImageType.IT_JPG||r==tr.DWT.EnumDWT_ImageType.IT_PNG||r==tr.DWT.EnumDWT_ImageType.IT_J2K)(-1==t&&e._ImgManager.count()>1||Xt.isArray(t)&&t.length>1)&&(Ma(e),Xt.isFunction(n)&&n(t));else if(r!=tr.DWT.EnumDWT_ImageType.IT_TIF&&r!=tr.DWT.EnumDWT_ImageType.IT_PDF)return Ga(e),Xt.isFunction(n)&&n(t),!1;return!0}function Wz(e){var t;return e&&(t=new FormData,Xt.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 Nz=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 tr.DWT.UseDefaultViewer?(Xt.isString(e)&&(r=Xt.get(e),Xt.show(r)),t._config.container!=r&&(t._config.container=r,lz(t)),t._UIView.BindView(e)):(oa(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(!Uh(u,c))return!1;var l=ci.RGB2BGR(i),d=ci.RGB2BGR(o),f=u._ImgManager.convertClientIndexToServerId(c);return-1==f?(Va(u),!1):u._innerFun("AddText",Zl(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",Zl(e,t,r,n,i,o,a,s,u,c,l,d,f,h))}},{key:"CopyToClipboard",value:function(e){var t=parseInt(e);return!!Uh(this,t)&&Oz(this,"CopyToClipboard",t,null,null,!1,!1)}},{key:"CopyToClipboardAsync",value:function(e){var t=this;if(t._resetErr(),!t._isValid())return ui.Promise.reject({code:t._errorCode,message:t._errorString});var r=parseInt(e);return isNaN(r)?(ca(t),ui.Promise.reject({code:t._errorCode,message:t._errorString})):r<0||r>=t._ImgManager.count()?(Va(t),ui.Promise.reject({code:t._errorCode,message:t._errorString})):function(e,t,r){var n=e._ImgManager.convertClientIndexToServerId(r);if(-1==n)return Va(e),ui.Promise.reject({code:e._errorCode,message:e._errorString});return e._innerFunV2(t,Zl(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(!Xt.isFunction(o)){var u,c=parseInt(e);if(!Uh(s,c,a))return!1;var l=s._ImgManager.convertClientIndexToServerId(c);return-1==l?(Va(s),Xt.isFunction(a)&&a(s._errorCode,s._getErrorString()),!1):(s.getView().ClearSelectedAreas(),(u=1==s._innerFun("Erase",Zl(l,t,r,n,i)))?Xt.isFunction(o)&&o():Xt.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 ui.Promise.reject({code:o._errorCode,message:o._errorString});var a=parseInt(e);if(isNaN(a))return ca(o),ui.Promise.reject({code:o._errorCode,message:o._errorString});if(a<0||a>=o._ImgManager.count())return Va(o),ui.Promise.reject({code:o._errorCode,message:o._errorString});var s=o._ImgManager.convertClientIndexToServerId(a);return-1==s?(Va(o),ui.Promise.reject({code:o._errorCode,message:o._errorString})):(o.getView().ClearSelectedAreas(),o._innerFunV2("Erase",Zl(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(!Uh(t,r))return!1;var n=t._ImgManager.convertClientIndexToServerId(r);return-1==n?(Va(t),!1):t._innerFun("GetImageBitDepth",Zl(n))}},{key:"GetImageWidth",value:function(e){var t=this;if(t._resetErr(),!t._isValid())return!1;var r=parseInt(e);if(isNaN(r))return ca(t),-1;if(r<0||r>=t._ImgManager.count())return Va(t),-1;var n=t._ImgManager.convertClientIndexToServerId(r);return-1==n?(Va(t),-1):t._innerFun("GetImageWidth",Zl(n))}},{key:"GetImageHeight",value:function(e){var t=this;if(t._resetErr(),!t._isValid())return!1;var r=parseInt(e);if(isNaN(r))return ca(t),-1;if(r<0||r>=t._ImgManager.count())return Va(t),-1;var n=t._ImgManager.convertClientIndexToServerId(r);return-1==n?(Va(t),-1):t._innerFun("GetImageHeight",Zl(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 ca(n),-1;if(i<0||i>=n._ImgManager.count())return Va(n),-1;var o=n._ImgManager.convertClientIndexToServerId(i);return-1==o?(Va(n),-1):n._innerFun("GetImageSize",Zl(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 ca(r),-1;if(n<0||n>=r._ImgManager.count())return Va(r),-1;var i=r._ImgManager.convertClientIndexToServerId(n);return-1==i?(Va(r),-1):r._innerFun("GetImageSizeWithSpecifiedType",Zl(i,t))}},{key:"GetImageXResolution",value:function(e){var t=this,r=parseInt(e);if(!Uh(t,r))return!1;var n=t._ImgManager.convertClientIndexToServerId(r);return-1==n?(Va(t),!1):t._innerFun("GetImageXResolution",Zl(n))}},{key:"GetImageYResolution",value:function(e){var t=this,r=parseInt(e);if(!Uh(t,r))return!1;var n=t._ImgManager.convertClientIndexToServerId(r);return-1==n?(Va(t),!1):t._innerFun("GetImageYResolution",Zl(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(!Xt.isFunction(t)){var o=parseInt(e);return!!Uh(i,o,r)&&(n=Oz(i,"GetSkewAngle",o,t,r,!0,!1),0==i._errorCode?(Wh.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 ui.Promise.reject({code:t._errorCode,message:t._errorString});var r=parseInt(e);if(isNaN(r))return ca(t),ui.Promise.reject({code:t._errorCode,message:t._errorString});if(r<0||r>=t._ImgManager.count())return Va(t),ui.Promise.reject({code:t._errorCode,message:t._errorString});var n=t._ImgManager.convertClientIndexToServerId(r);return-1==n?(Va(t),ui.Promise.reject({code:t._errorCode,message:t._errorString})):t._innerFunV2("GetSkewAngle",Zl(n),!0).then(function(e){var n=e;return Xt.isArray(e)&&(n=e.length>0?e[0]:0),Wh.refreshImageAfterInvokeFun(t,r),n})}},{key:"GetSkewAngleEx",value:function(e,t,r,n,i){var o=this,a=parseInt(e);if(!Uh(o,a))return!1;var s=o._ImgManager.convertClientIndexToServerId(a);return-1==s?(Va(o),!1):o._innerFun("GetSkewAngleEx",Zl(s,t,r,n,i))}},{key:"GetSkewAngleFromBinaryAsync",value:function(e,t,r,n){var i=this;if(i._resetErr(),!i._isValid())return ui.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:af.IT_BMP,width:a.width,height:a.height,bit:a.bitDepth,xres:a.resolutionX,yres:a.resolutionY,uidFromServer:o.uidFromServer},c=Xt.stringify([Xt.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(!Uh(s,a=parseInt(e)))return!1;var u=s._ImgManager.convertClientIndexToServerId(a);return-1==u?(Va(s),!1):s._innerFun("IsBlankImageEx",Zl(u,t,r,n,i,o))}},{key:"MirrorAsync",value:function(e){var t=this;if(t._resetErr(),!t._isValid())return ui.Promise.reject({code:t._errorCode,message:t._errorString});var r=parseInt(e);if(isNaN(r))return ca(t),ui.Promise.reject({code:t._errorCode,message:t._errorString});if(r<0||r>=t._ImgManager.count())return Va(t),ui.Promise.reject({code:t._errorCode,message:t._errorString});var n=t._ImgManager.convertClientIndexToServerId(r);return-1==n?(Va(t),ui.Promise.reject({code:t._errorCode,message:t._errorString})):t._innerFunV2("Mirror",Zl(n),!0).then(function(e){if(1!=e)throw{code:t._errorCode,message:t._errorString};Wh.refreshImageAfterInvokeFun(t,r),t.getView().ClearSelectedAreas()})}},{key:"Mirror",value:function(e,t,r){var n=this;if(!Xt.isFunction(t)){var i=parseInt(e);return!!Uh(n,i,r)&&Oz(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 ui.Promise.reject({code:t._errorCode,message:t._errorString});var r=parseInt(e);if(isNaN(r))return ca(t),ui.Promise.reject({code:t._errorCode,message:t._errorString});if(r<0||r>=t._ImgManager.count())return Va(t),ui.Promise.reject({code:t._errorCode,message:t._errorString});var n=t._ImgManager.convertClientIndexToServerId(r);return-1==n?(Va(t),ui.Promise.reject({code:t._errorCode,message:t._errorString})):t._innerFunV2("RemoveImage",Zl(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),Xt.isFunction(r)&&r(e._errorCode,e._getErrorString())}},{key:"RotateEx",value:function(e,t,r,n,i,o){var a=this;if(!Xt.isFunction(i)){if(a._resetErr(),!a._isValid())return!1;var s,u=parseInt(e);if(isNaN(u))return ca(a),Xt.isFunction(o)&&o(a._errorCode,a._getErrorString()),!1;if(u<0||u>=a._ImgManager.count())return Va(a),Xt.isFunction(o)&&o(a._errorCode,a._getErrorString()),!1;var c=a._ImgManager.convertClientIndexToServerId(u);return-1==c?(Va(a),Xt.isFunction(o)&&o(a._errorCode,a._getErrorString()),!1):((s=1==a._innerFun("RotateEx",Zl(c,t,r,n)))?(Wh.refreshImageAfterInvokeFun(a,u),a.getView().ClearSelectedAreas(),Xt.isFunction(i)&&i()):Xt.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 ui.Promise.reject({code:i._errorCode,message:i._errorString});var o=parseInt(e);if(isNaN(o))return ca(i),ui.Promise.reject({code:i._errorCode,message:i._errorString});if(o<0||o>=i._ImgManager.count())return Va(i),ui.Promise.reject({code:i._errorCode,message:i._errorString});var a=i._ImgManager.convertClientIndexToServerId(o);return-1==a?(Va(i),ui.Promise.reject({code:i._errorCode,message:i._errorString})):i._innerFunV2("RotateEx",Zl(a,t,r,n),!0).then(function(e){if(1!=e&&1!=e)throw{code:i._errorCode,message:i._errorString};Wh.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(!Xt.isFunction(i)){var s,u=parseInt(e),c=1*t,l=1*r;if(!Uh(a,u,o))return!1;if(c<=0||l<=0)return Ca(a),Xt.isFunction(o)&&o(a._errorCode,a._getErrorString()),!1;var d=a._ImgManager.convertClientIndexToServerId(u);return-1==d?(Va(a),Xt.isFunction(o)&&o(a._errorCode,a._getErrorString()),!1):((s=1==a._innerFun("ChangeImageSize",Zl(d,c,l,n)))?(Wh.refreshImageAfterInvokeFun(a,u),Xt.isFunction(i)&&i()):Xt.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 ui.Promise.reject({code:i._errorCode,message:i._errorString});if(isNaN(o))return ca(i),ui.Promise.reject({code:i._errorCode,message:i._errorString});if(o<0||o>=i._ImgManager.count())return Va(i),ui.Promise.reject({code:i._errorCode,message:i._errorString});if(a<=0||s<=0)return Ca(i),ui.Promise.reject({code:i._errorCode,message:i._errorString});var u=i._ImgManager.convertClientIndexToServerId(o);return-1==u?(Va(i),ui.Promise.reject({code:i._errorCode,message:i._errorString})):i._innerFunV2("ChangeImageSize",Zl(u,a,s,n),!0).then(function(e){if(1!=e)throw{code:i._errorCode,message:i._errorString};Wh.refreshImageAfterInvokeFun(i,o)})}},{key:"Flip",value:function(e,t,r){var n=this;if(!Xt.isFunction(t)){var i=parseInt(e);return!!Uh(n,i,r)&&Oz(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 ui.Promise.reject({code:t._errorCode,message:t._errorString});var r=parseInt(e);if(isNaN(r))return ca(t),ui.Promise.reject({code:t._errorCode,message:t._errorString});if(r<0||r>=t._ImgManager.count())return Va(t),ui.Promise.reject({code:t._errorCode,message:t._errorString});var n=t._ImgManager.convertClientIndexToServerId(r);return-1==n?(Va(t),ui.Promise.reject({code:t._errorCode,message:t._errorString})):t._innerFunV2("Flip",Zl(n),!0).then(function(e){if(1!=e)throw{code:t._errorCode,message:t._errorString};Wh.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 ca(o),{code:o._errorCode,message:o._errorString};case 8:if(r==af.IT_BMP||r==af.IT_JPG||r==af.IT_TIF||r==af.IT_PNG||r==af.IT_PDF){l.next=11;break}throw $a(o),{code:o._errorCode,message:o._errorString};case 11:if(n==tz.Blob||n==tz.Base64){l.next=14;break}throw $a(o),{code:o._errorCode,message:o._errorString};case 14:if(!(e<0||e>=o._ImgManager.count())){l.next=17;break}throw Va(o),{code:o._errorCode,message:o._errorString};case 17:if(-1!=(f=o._ImgManager.convertClientIndexToServerId(e))){l.next=21;break}throw Va(o),{code:o._errorCode,message:o._errorString};case 21:return h=n==tz.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=Xt.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,Fl.ConvertingToBase64]):o._OnPercentDone([0,-1,Fl.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=52;break}if(!p){l.next=49;break}if(!hu(p)){l.next=45;break}return o._errorCode=p.exception,o._errorString=p.description,o._errorCause=gu(p),l.abrupt("return","");case 45:if(!(Xt.isArray(p.result)&&p.result.length>0&&Xt.isString(p.result[0]))){l.next=47;break}return l.abrupt("return",p.result[0]);case 47:l.next=50;break;case 49:return l.abrupt("return","");case 50:l.next=53;break;case 52:return l.abrupt("return",new Blob([p],{type:uf(r)}));case 53: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(!Xt.isFunction(o)){var u,c=parseInt(e);if(!Uh(s,c,a))return!1;var l,d,f=s._ImgManager.convertClientIndexToServerId(c);return-1==f?(Va(s),Xt.isFunction(a)&&a(s._errorCode,s._getErrorString()),!1):(u=1==s._innerFun("Crop",Zl(f,t,r,n,i)),l=s._errorCode,d=s._getErrorString(),s.getView().ClearSelectedAreas(),s._errorCode=l,s._errorString=d,u?(Wh.refreshImageAfterInvokeFun(s,c),Xt.isFunction(o)&&o()):Xt.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 ui.Promise.reject({code:o._errorCode,message:o._errorString});var a=parseInt(e);if(isNaN(a))return ca(o),ui.Promise.reject({code:o._errorCode,message:o._errorString});if(a<0||a>=o._ImgManager.count())return Va(o),ui.Promise.reject({code:o._errorCode,message:o._errorString});var s=o._ImgManager.convertClientIndexToServerId(a);return-1==s?(Va(o),ui.Promise.reject({code:o._errorCode,message:o._errorString})):o._innerFunV2("Crop",Zl(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 Wh.refreshImageAfterInvokeFun(o,a),!0})}},{key:"CropToClipboard",value:function(e,t,r,n,i){var o,a=this,s=parseInt(e);if(!Uh(a,s))return!1;var u=a._ImgManager.convertClientIndexToServerId(s);return-1==u?(Va(a),!1):(a.getView().ClearSelectedAreas(),(o=1==a._innerFun("CropToClipboard",Zl(u,t,r,n,i)))&&Wh.refreshImageAfterInvokeFun(a,s),o)}},{key:"CutFrameToClipboard",value:function(e,t,r,n,i){var o,a=this,s=parseInt(e);if(!Uh(a,s))return!1;var u=a._ImgManager.convertClientIndexToServerId(s);return-1==u?(Va(a),!1):(a.getView().ClearSelectedAreas(),(o=1==a._innerFun("CutFrameToClipboard",Zl(u,t,r,n,i)))&&Wh.refreshImageAfterInvokeFun(a,s),o)}},{key:"CutToClipboard",value:function(e){var t,r=this,n=parseInt(e);if(!Uh(r,n))return!1;var i=r._ImgManager.convertClientIndexToServerId(n);return-1==i?(Va(r),!1):((t=1==r._innerFun("CutToClipboard",Zl(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 ui.Promise.reject({code:o._errorCode,message:o._errorString});var a=parseInt(e);if(isNaN(a))return ca(o),ui.Promise.reject({code:o._errorCode,message:o._errorString});if(a<0||a>=o._ImgManager.count())return Va(o),ui.Promise.reject({code:o._errorCode,message:o._errorString});var s=o._ImgManager.convertClientIndexToServerId(a);return-1==s?(Va(o),ui.Promise.reject({code:o._errorCode,message:o._errorString})):o._innerFunV2("CutFrameToClipboard",Zl(s,t,r,n,i)).then(function(e){var t=1==e;if(!t)throw{code:o._errorCode,message:o._errorString};return Wh.refreshImageAfterInvokeFun(o,a),t})}},{key:"CropToClipboardAsync",value:function(e,t,r,n,i){var o=this;if(o._resetErr(),!o._isValid())return ui.Promise.reject({code:o._errorCode,message:o._errorString});var a=parseInt(e);if(isNaN(a))return ca(o),ui.Promise.reject({code:o._errorCode,message:o._errorString});if(a<0||a>=o._ImgManager.count())return Va(o),ui.Promise.reject({code:o._errorCode,message:o._errorString});var s=o._ImgManager.convertClientIndexToServerId(a);return-1==s?(Va(o),ui.Promise.reject({code:o._errorCode,message:o._errorString})):o._innerFunV2("CropToClipboard",Zl(s,t,r,n,i)).then(function(e){var t=1==e;if(!t)throw{code:o._errorCode,message:o._errorString};return Wh.refreshImageAfterInvokeFun(o,a),t})}},{key:"CutToClipboardAsync",value:function(e){var t=this;if(t._resetErr(),!t._isValid())return ui.Promise.reject({code:t._errorCode,message:t._errorString});var r=parseInt(e);if(isNaN(r))return ca(t),ui.Promise.reject({code:t._errorCode,message:t._errorString});if(r<0||r>=t._ImgManager.count())return Va(t),ui.Promise.reject({code:t._errorCode,message:t._errorString});var n=t._ImgManager.convertClientIndexToServerId(r);return-1==n?(Va(t),ui.Promise.reject({code:t._errorCode,message:t._errorString})):t._innerFunV2("CutToClipboard",Zl(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;Xt.isFunction(o)&&(c=!0);var l=parseInt(e);if(!Uh(u,l,a))return!!c&&void 0;var d=u._ImgManager.convertClientIndexToServerId(l);return-1==d?(Va(u),Xt.isFunction(a)&&a(u._errorCode,u._getErrorString()),!!c&&void 0):((s=1==u._innerFun("SetDPI",Zl(d,t,r,n,i)))?Xt.isFunction(o)&&o():Xt.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)?(ca(r),!1):n<0||n>=r._ImgManager.count()||i<0||i>=r._ImgManager.count()?(Va(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)?(ca(r),!1):n<0||n>=r._ImgManager.count()||i<0||i>=r._ImgManager.count()?(Va(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(Xt.isArray(n)&&Xt.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",Zl(i.join(",")))),t&&e._OnBitmapChanged(["c1",i.join(","),3,e._ImgManager.getCurrentImageIndex(),e._ImgManager.count()]),t}},{key:"RemoveAllSelectedImagesAsync",value:function(){var e=this;if(e._resetErr(),!e._isValid())return ui.Promise.reject({code:e._errorCode,message:e._errorString});var t=e._ImgManager.getCurrentImageIndex(),r=e._ImgManager.getSelectedClientIndexArray(),n=[];if(Xt.isArray(r)&&Xt.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",Zl(n.join(","),!0)).then(function(t){t&&e._OnBitmapChanged(["c1",n.join(","),3,e._ImgManager.getCurrentImageIndex(),e._ImgManager.count()])}):ui.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 Xt.isArray(e)?Xt.isString(t)&&""!=t?(Xt.each(e,function(e){if(isNaN(e)||e<0||e>=i)return Va(r),n=!1}),n?r._ImgManager.addImageTag(e,t):n):(oa(r,-2394,"Invalid tag name."),!1):(Ua(r),!1)}},{key:"ClearImageTags",value:function(e){var t=this;return t._resetErr(),!!t._isValid()&&(-1==e||e>=t._getHowManyImagesInBuffer()?(Va(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(Xt.isFunction(t)&&(o=!0),i._resetErr(),!i._isValid())return!!o&&void 0;Xt.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?Xt.isString(e)?t._ImgManager.CreateFile(e):(is(t),!1):(Xt.isNumber(e)?is(t):ns(t),!1))}},{key:"OpenDocument",value:function(e){var t=this;return t._resetErr(),!!t._isValid()&&(e&&""!=e?Xt.isString(e)?t._ImgManager.OpenFile(e):(is(t),!1):(Xt.isNumber(e)?is(t):ns(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",Zl(r.join(","))),t._ImgManager.RemoveFile(e)}},{key:"RenameDocument",value:function(e,t){var r=this;return r._resetErr(),!!r._isValid()&&(Xt.isString(e)&&Xt.isString(t)?e&&""!=e&&t&&""!=t?r._ImgManager.RenameFile(e,t):(ns(r),!1):(is(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(!Xt.isUndefined(e)&&0!=e.length){d.next=7;break}throw Ys(i),{code:i._errorCode,message:i._errorString};case 7:if(!Xt.isUndefined(t)&&0!=t.length){d.next=10;break}throw Xs(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(!Xt.isUndefined(a)){d.next=32;break}throw Ys(i),{code:i._errorCode,message:i._errorString};case 32:if(!Xt.isUndefined(s)){d.next=35;break}throw Xs(i),{code:i._errorCode,message:i._errorString};case 35:if(l=[],!Xt.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(!Xt.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,Xt.isUndefined(n)){d.next=51;break}if(!Xt.isNumber(n)){d.next=49;break}n<0?f=0:s.imageIds.length>n&&(f=n),d.next=51;break;case 49:throw $a(i),{code:i._errorCode,message:i._errorString};case 51:d.next=60;break;case 53:if(!Xt.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 $a(i),{code:i._errorCode,message:i._errorString};case 60:return d.abrupt("return",new ui.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(!Xt.isUndefined(e)&&0!=e.length){f.next=7;break}throw Ys(i),{code:i._errorCode,message:i._errorString};case 7:if(!Xt.isUndefined(t)&&0!=t.length){f.next=10;break}throw Xs(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(!Xt.isUndefined(a)){f.next=32;break}throw Ys(i),{code:i._errorCode,message:i._errorString};case 32:if(!Xt.isUndefined(s)){f.next=35;break}throw Xs(i),{code:i._errorCode,message:i._errorString};case 35:if(l=[],!Xt.isUndefined(r)){f.next=40;break}a.imageIds.length>0&&Xt.isArray(a.imageIds)&&Xt.each(a.imageIds,function(e){var t=i._uidFromServer2ServerId(e);-1!=t&&l.push(t)}),f.next=60;break;case 40:if(!Xt.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(Xt.each(r,function(e){var t=i._uidFromServer2ServerId(a.imageIds[e]);-1!=t&&l.push(t)}),Xt.isUndefined(n)){f.next=51;break}if(!Xt.isNumber(n)){f.next=49;break}n<0?d=0:s.imageIds.length>n&&(d=n),f.next=51;break;case 49:throw $a(i),{code:i._errorCode,message:i._errorString};case 51:f.next=60;break;case 53:if(!Xt.isNumber(r)){f.next=58;break}a.imageIds.length>0&&Xt.isArray(a.imageIds)&&Xt.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 $a(i),{code:i._errorCode,message:i._errorString};case 60:return f.abrupt("return",new ui.Promise(function(e,r){var n="copyToDocument";if(s.imageIds.length,0==l.length)e();else{i.IfShowProgressBar?iu(!1):Qt.hideProgress();var o=i.IfShowCancelDialogWhenImageTransfer;Qt.cancelFrom=jH.LoadImage,i.IfShowCancelDialogWhenImageTransfer=!1,Qt.progressContext&&(Qt.progressContext.IfShowCancelDialogWhenImageTransfer=!1),Qt.cancelFrom=jH.Other,i._innerConvertToBlobWithUI(n,tr.DWT.EnumDWT_ImageType.IT_PDF,l,!1,function(a,s){a.currentFileName=t,a.currentTagName="",a.bNeedClearCurrentTagName=!0,a.index=d,i.IfShowProgressBar?(iu(!1),Qt.showProgress(i,n,!1),Qt.progressContext&&(Qt.progressContext.IfShowCancelDialogWhenImageTransfer=!1)):Qt.hideProgress(),Qt.cancelFrom=jH.LoadImage,i._innerLoadImageFromBinary(a,0,!0,!0,function(){i.IfShowCancelDialogWhenImageTransfer=o,i.IfShowProgressBar&&Qt.closeProgress(null,n),e()},function(){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(Xt.isFunction(t)&&(i=!0),!i){var o=parseInt(e);return!!Uh(n,o,r)&&Oz(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()&&(Xt.isUndefined(e)?(ka(r),!1):0==e.length?(oa(r,-2517,"Old tag name is required."),!1):Xt.isUndefined(t)||0==t.length?(function(e){oa(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()&&(Xt.isUndefined(e)||0==e.length?(ka(r),!1):Xt.isUndefined(t)||Xt.isArray(t)?r._ImgManager.removeTag(e,t):(Ua(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)?(ca(t),[]):r<0||r>=t._ImgManager.count()||-1==t._ImgManager.convertClientIndexToServerId(r)?(Va(t),[]):t._ImgManager.getTagListByIndex(r)}},{key:"GetImageBitDepthAsync",value:function(e){var t=this;if(t._resetErr(),!t._isValid())return ui.Promise.reject({code:t._errorCode,message:t._errorString});var r=parseInt(e);if(isNaN(r))return ca(t),ui.Promise.reject({code:t._errorCode,message:t._errorString});if(r<0||r>=t._ImgManager.count())return Va(t),ui.Promise.reject({code:t._errorCode,message:t._errorString});var n=t._ImgManager.convertClientIndexToServerId(r);return-1==n?(Va(t),ui.Promise.reject({code:t._errorCode,message:t._errorString})):t._innerFunV2("GetImageBitDepth",Zl(n))}},{key:"GetImageWidthAsync",value:function(e){var t=this;if(t._resetErr(),!t._isValid())return ui.Promise.reject({code:t._errorCode,message:t._errorString});var r=parseInt(e);if(isNaN(r))return ca(t),ui.Promise.reject({code:t._errorCode,message:t._errorString});if(r<0||r>=t._ImgManager.count())return Va(t),ui.Promise.reject({code:t._errorCode,message:t._errorString});var n=t._ImgManager.convertClientIndexToServerId(r);return-1==n?(Va(t),ui.Promise.reject({code:t._errorCode,message:t._errorString})):t._innerFunV2("GetImageWidth",Zl(n))}},{key:"GetImageHeightAsync",value:function(e){var t=this;if(t._resetErr(),!t._isValid())return ui.Promise.reject({code:t._errorCode,message:t._errorString});var r=parseInt(e);if(isNaN(r))return ca(t),ui.Promise.reject({code:t._errorCode,message:t._errorString});if(r<0||r>=t._ImgManager.count())return Va(t),ui.Promise.reject({code:t._errorCode,message:t._errorString});var n=t._ImgManager.convertClientIndexToServerId(r);return-1==n?(Va(t),ui.Promise.reject({code:t._errorCode,message:t._errorString})):t._innerFunV2("GetImageHeight",Zl(n))}},{key:"GetImageSizeAsync",value:function(e,t,r){var n=this;if(n._resetErr(),!n._isValid())return ui.Promise.reject({code:n._errorCode,message:n._errorString});var i=parseInt(e);if(isNaN(i))return ca(n),ui.Promise.reject({code:n._errorCode,message:n._errorString});if(i<0||i>=n._ImgManager.count())return Va(n),ui.Promise.reject({code:n._errorCode,message:n._errorString});var o=n._ImgManager.convertClientIndexToServerId(i);return-1==o?(Va(n),ui.Promise.reject({code:n._errorCode,message:n._errorString})):n._innerFunV2("GetImageSize",Zl(o,t,r))}},{key:"GetImageSizeWithSpecifiedTypeAsync",value:function(e,t){var r=this;if(r._resetErr(),!r._isValid())return ui.Promise.reject({code:r._errorCode,message:r._errorString});var n=parseInt(e);if(isNaN(n))return ca(r),ui.Promise.reject({code:r._errorCode,message:r._errorString});if(n<0||n>=r._ImgManager.count())return Va(r),ui.Promise.reject({code:r._errorCode,message:r._errorString});var i=r._ImgManager.convertClientIndexToServerId(n);return-1==i?(Va(r),ui.Promise.reject({code:r._errorCode,message:r._errorString})):r._innerFunV2("GetImageSizeWithSpecifiedType",Zl(i,t))}},{key:"GetImageXResolutionAsync",value:function(e){var t=this;if(t._resetErr(),!t._isValid())return ui.Promise.reject({code:t._errorCode,message:t._errorString});var r=parseInt(e);if(isNaN(r))return ca(t),ui.Promise.reject({code:t._errorCode,message:t._errorString});if(r<0||r>=t._ImgManager.count())return Va(t),ui.Promise.reject({code:t._errorCode,message:t._errorString});var n=t._ImgManager.convertClientIndexToServerId(r);return-1==n?(Va(t),ui.Promise.reject({code:t._errorCode,message:t._errorString})):t._innerFunV2("GetImageXResolution",Zl(n))}},{key:"GetImageYResolutionAsync",value:function(e){var t=this;if(t._resetErr(),!t._isValid())return ui.Promise.reject({code:t._errorCode,message:t._errorString});var r=parseInt(e);if(isNaN(r))return ca(t),ui.Promise.reject({code:t._errorCode,message:t._errorString});if(r<0||r>=t._ImgManager.count())return Va(t),ui.Promise.reject({code:t._errorCode,message:t._errorString});var n=t._ImgManager.convertClientIndexToServerId(r);return-1==n?(Va(t),ui.Promise.reject({code:t._errorCode,message:t._errorString})):t._innerFunV2("GetImageYResolution",Zl(n))}},{key:"ChangeBrightnessAsync",value:function(e,t){var r=this,n=parseInt(e);if(!r._isValid())return ui.Promise.reject({code:r._errorCode,message:r._errorString});if(t<-1e3||t>1e3)return la(r),ui.Promise.reject({code:r._errorCode,message:r._errorString});var i=r._ImgManager.convertClientIndexToServerId(n);return-1==i?(Va(r),ui.Promise.reject({code:r._errorCode,message:r._errorString})):r._innerFunV2("ChangeBrightness",Zl(i,t))}},{key:"ChangeContrastAsync",value:function(e,t){var r=this,n=parseInt(e);if(!r._isValid())return ui.Promise.reject({code:r._errorCode,message:r._errorString});if(t<-1e3||t>1e3)return la(r),ui.Promise.reject({code:r._errorCode,message:r._errorString});var i=r._ImgManager.convertClientIndexToServerId(n);return-1==i?(Va(r),ui.Promise.reject({code:r._errorCode,message:r._errorString})):r._innerFunV2("ChangeContrast",Zl(i,t))}},{key:"GetImageAsync",value:function(e,t,r,n,i){var o=this;if(o._resetErr(),!o._isValid())return ui.Promise.reject({code:o._errorCode,message:o._errorString});var a=parseInt(e);if(isNaN(a))return ca(o),ui.Promise.reject({code:o._errorCode,message:o._errorString});if(a<0||a>=o._ImgManager.count())return Va(o),ui.Promise.reject({code:o._errorCode,message:o._errorString});var s,u=o._ImgManager.convertClientIndexToServerId(a);return-1==u?(Va(o),ui.Promise.reject({code:o._errorCode,message:o._errorString})):(Xt.isNumber(t)?s=Zl(u,t):Xt.isNumber(r)&&Xt.isNumber(n)?s=Zl(u,r,n):Xt.isNumber(i)&&(s=Zl(u,-1,-1,i)),o._sendDataByHttpAsync("GetImageByIndex",s,"blob"))}},{key:"GetImageInfoAsync",value:function(e){var t=this;if(t._resetErr(),!t._isValid())return ui.Promise.reject({code:t._errorCode,message:t._errorString});var r=parseInt(e);if(isNaN(r))return ca(t),ui.Promise.reject({code:t._errorCode,message:t._errorString});if(r<0||r>=t._ImgManager.count())return Va(t),ui.Promise.reject({code:t._errorCode,message:t._errorString});var n=t._ImgManager.convertClientIndexToServerId(r);return-1==n?(Va(t),ui.Promise.reject({code:t._errorCode,message:t._errorString})):t._innerFunV2("GetImageInfo",Zl(n)).then(function(e){var t=0,r=0,n=e;if(Xt.isArray(e)&&1==e.length&&(n=e[0]),Xt.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"):li},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&&!tr.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?(oa(u,-2375,"The left or top or right or bottom you entered is invalid."),!1):(s=Xt.isNumber(o)?ci.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(Xt.isString(e)||Xt.isString(t)||e<-1&&t<-1)return la(r),li;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"):_h.isServerInvalid(i)?li: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()?(Va(o),!1):!_h.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),sz.__innerRefreshFromUIView(e,e._ImgManager.getCurrentImageIndex())),di))}},{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(),sz.__innerRefreshFromUIView(e,e._ImgManager.getCurrentImageIndex())),di))}},{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(),sz.__innerRefreshFromUIView(e,e._ImgManager.getCurrentImageIndex())),di))}},{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),sz.__innerRefreshFromUIView(e,e._ImgManager.getCurrentImageIndex())),di))}},{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&&(Xt.removeEventListener(window,"resize",t.__funResize),t.__funResize=li),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 tr.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),Xt.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,sf.Auto,!Xt.isUndefined(e)&&0!=e.length){a.next=7;break}throw Ks(n),{code:n._errorCode,message:n._errorString};case 7:if(Xt.isString(e)){a.next=10;break}throw Xa(n),{code:n._errorCode,message:n._errorString};case 10:if(-1!=(i=n._uidFromServer2ServerId(e))){a.next=14;break}throw Js(n),{code:n._errorCode,message:n._errorString};case 14:if(!Xt.isUndefined(t)){a.next=19;break}throw Qs(n),{code:n._errorCode,message:n._errorString};case 19:if(t instanceof Blob){a.next=22;break}throw qs(n),{code:n._errorCode,message:n._errorString};case 22:return a.next=24,Rz(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(tr.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(Xt.isFunction(e.__CloseImageEditorUI))try{e.__CloseImageEditorUI()}catch(t){_o(t)}}}]);var r,a,u,c}(kz);function Oz(e,t,r,n,i,o,a){var s,u=e._ImgManager.convertClientIndexToServerId(r);if(-1==u)return Va(e),Xt.isFunction(i)&&i(e._errorCode,e._errorString),!1;if(s=e._innerFun(t,Zl(u)),o)return s;var c=1==s;return c?(a&&(Wh.refreshImageAfterInvokeFun(e,r),e.getView().ClearSelectedAreas()),Xt.isFunction(n)&&n()):Xt.isFunction(i)&&i(e._errorCode,e._errorString),c}function Rz(e){return Xt.isFunction(e.arrayBuffer)?e.arrayBuffer():new Qt.Promise(function(t,r){if(tr.navInfoSync.bIE||tr.navInfoSync.bSafari){var n=new FileReader;n.onload=function(){t(n.result)},n.onerror=function(e){r(e)},n.readAsArrayBuffer(e)}else{var i;oa(i={},-2856,"Cannot convert blob to array buffer."),r({code:i._errorCode,message:i._errorString})}})}c(Nz,"_processing_getblob_queue",!1),c(Nz,"_getblob_queue",[]);var Mz=function(e){return e.normal=0,e.balance=1,e}({}),Lz="data:image/gif;base64, ",Bz={loaderBarClassName:"ds-dwt-loaderBar",loaderBarBackgroundColor:"",loaderBarSource:de.bIE?Lz:Qt.loaderBarSource,loaderBarSourceIE:Lz,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:"Dynamic Web TWAIN 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!"]}},Uz=Xt.mix({},Bz);function Vz(){var e;tr.DWT&&(e=tr.DWT.CustomizableDisplayInfo),e&&(Xt.isString(e.loaderBarSource)&&""!=e.loaderBarSource?Qt.loaderBarSource=e.loaderBarSource:de.bIE?(Qt.loaderBarSource=Bz.loaderBarSourceIE,Qt.loaderBarSourceIE=Bz.loaderBarSourceIE):Qt.loaderBarSource=Bz.loaderBarSource,Xt.isString(e.loaderBarClassName)&&""!=e.loaderBarClassName?Qt.loaderBarClassName=e.loaderBarClassName:Qt.loaderBarClassName=Bz.loaderBarClassName,Xt.isString(e.loaderBarBackgroundColor)?Qt.loaderBarBackgroundColor=e.loaderBarBackgroundColor:Qt.loaderBarBackgroundColor=Bz.loaderBarBackgroundColor,e.loaderBarWidth?Qt.loaderBarWidth=e.loaderBarWidth:Qt.loaderBarWidth=Bz.loaderBarWidth,e.loaderBarHeight?Qt.loaderBarHeight=e.loaderBarHeight:Qt.loaderBarHeight=Bz.loaderBarHeight)}var jz=!0;function Gz(){var e;jz&&(Uz=Xt.mix({},Bz),tr.DWT&&(e=tr.DWT.CustomizableDisplayInfo),e&&(e.errorMessages&&Xt.mix(Uz.errorMessages,e.errorMessages),e.generalMessages&&Xt.mix(Uz.generalMessages,e.generalMessages),e.customProgressText&&Xt.mix(Uz.customProgressText,e.customProgressText),e.buttons&&(e.buttons.titles&&Xt.mix(Uz.buttons.titles,e.buttons.titles),e.buttons.bShowAllButtons&&Xt.mix(Uz.buttons.bShowAllButtons,e.buttons.bShowAllButtons),e.buttons.visibility&&Xt.mix(Uz.buttons.visibility,e.buttons.visibility)),e.dialogText&&Xt.mix(Uz.dialogText,e.dialogText)),Vz(),jz=!1)}function Hz(e){var t=e,r=window;if(r.ShadowRoot)for(;t;){if(t instanceof r.ShadowRoot)return t;t=t.parentNode}return null}function zz(e){var t=window;return!!(t.ShadowRoot&&e instanceof t.ShadowRoot)}Qt._funsAfterConfigLoaded=[],Qt._safePromptCustomMsg=function(e){e&&e()};var Kz=Jl;tr.DWT;var Jz,Qz={background:"#434246",topMenuBorder:"",innerBorder:"",promptToSaveChange:!0,buttons:Uz.buttons,dialogText:Uz.dialogText},qz=function(){return s(function r(e,t){o(this,r);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(t)},[{key:"_Init",value:function(e){var t=this;if(t.borderWidth=Xt.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){Xt.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&&tr.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)},removeBtnClick:function(e){t.__removePage(t,e)}},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&&(ui.isNodeList(e.Container)||Xt.isArray(e.Container)&&e.Container.length>0)&&(r.viewerContainer={container:e.Container[0],width:rr(e.Width),height:rr(e.Height)}),t._stwain._viewer=new tr.DWTViewer(BH._getBuffer(t._ImgManager),r)}else e.Container&&(ui.isNodeList(e.Container)||Xt.isArray(e.Container)&&e.Container.length>0)&&t.__onBindViewer(e.Container[0]);t.__InitEvents(e)}},{key:"dispose",value:function(){}},{key:"__InitEvents",value:function(e){var t=this;Xt.isFunction(e.onTopImageInTheViewChanged)&&(t.onTopImageInTheViewChanged=e.onTopImageInTheViewChanged),Xt.isFunction(e.onGetImageInfo)&&(t.onGetImageInfo=e.onGetImageInfo),Xt.isFunction(e.onZoomChanged)&&(t.onZoomChanged=e.onZoomChanged),Xt.isFunction(e.onMouseMove)&&(t.onMouseMove=e.onMouseMove),Xt.isFunction(e.onMouseClick)&&(t.onMouseClick=e.onMouseClick),Xt.isFunction(e.onMouseRightClick)&&(t.onMouseRightClick=e.onMouseRightClick),Xt.isFunction(e.onMouseDoubleClick)&&(t.onMouseDoubleClick=e.onMouseDoubleClick),Xt.isFunction(e.onImageAreaDeSelected)&&(t.onImageAreaDeSelected=e.onImageAreaDeSelected),Xt.isFunction(e.onImageAreaSelected)&&(t.onImageAreaSelected=e.onImageAreaSelected),Xt.isFunction(e.onBufferChanged)&&(t.onBufferChanged=e.onBufferChanged),Xt.isFunction(e.onSelected)&&(t.onSelected=e.onSelected),Xt.isFunction(e.onRefreshUI)&&(t.onRefreshUI=e.onRefreshUI),Xt.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,n=r.GetWebViewer();return r._stwain._isNoViewer()||!n||(r.GetWidth()!=e&&r.SetWidth(e),r.GetHeight()!=t&&r.SetHeight(t)),!0}},{key:"GetWidth",value:function(){var e=this.GetWebViewer();return e?e.width:0}},{key:"SetWidth",value:function(e){var t=this,r=t.GetWebViewer(),n=e;return!(t._stwain._isNoViewer()||!r)&&(!(!Xt.isString(n)&&!Xt.isNumber(n))&&(t.GetWebViewer().width=n,!0))}},{key:"GetHeight",value:function(){var e=this.GetWebViewer();return e?e.height:0}},{key:"SetHeight",value:function(e){var t=this,r=t.GetWebViewer(),n=e;return!(t._stwain._isNoViewer()||!r)&&(!(!Xt.isString(n)&&!Xt.isNumber(n))&&(t.GetWebViewer().height=n,!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 Xt.isNumber(t)&&(t=ci.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?rr(n.imageWidth*i)>15e3||rr(n.imageHeight*i)>15e3?(Jl.output(r,Uz.errorMessages.limitReachedForZoomIn),alert(Uz.errorMessages.limitReachedForZoomIn),!1):(r.SetZoom(o/100,e,t),!0):(Jl.output(r,Uz.errorMessages.limitReachedForZoomIn),alert(Uz.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):(Jl.output(e,Uz.errorMessages.limitReachedForZoomOut),alert(Uz.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(Xt.isFunction(this[e]))try{return this[e](t)}catch(r){_o(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 Xt.isString(e)?r=Xt.get(e):Xt.isDOM(r)&&(r.id&&""!=r.id||(r.id=["dwt_",Xt.getRandom()].join(""))),(t=this.GetWebViewer().bind(r))&&this.GetWebViewer().show(),t}},{key:"GetIfShowVideoContainer",value:function(){var e=this,t=e.GetWebViewer();return Xt.isUndefined(t)?(tr.DWT.UseDefaultViewer?as(e._stwain):os(e._stwain),!1):t.webViewer.getIfShowVideoContainer()}},{key:"ShowVideoContainer",value:function(e){var t=this,r=t.GetWebViewer();return Xt.isUndefined(r)?(tr.DWT.UseDefaultViewer?as(t._stwain):os(t._stwain),!1):r.webViewer.showVideoContainer(e)}},{key:"UpdateVideoContainer",value:function(e){var t=this,r=t.GetWebViewer();return Xt.isUndefined(r)?(tr.DWT.UseDefaultViewer?as(t._stwain):os(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(Nz._getContainer(u._stwain)==a&&(o=!1),a){var d=tr.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&&(Xt.isDOM(a)?c=a:zz(a)?(c=document.createElement("div"),a.appendChild(c)):(c=l.getElementById(a))&&"DIV"!=c.nodeName&&(o=!1)),o&&a&&Xt.isDOM(a)){var g=Hz(a);if(g){if(tr.DWT.IfLoadResources){var m,p,v="";!de.bFileSystem&&tr.DWT.IfResourcesAddTimestamp&&(v=Qt.timestamp),(m=l.createElement("link")).href=[Gl(),"/src/dynamsoft.webtwain.viewer.css",v].join(""),m.rel="stylesheet",m.async=!0,(p=l.createElement("link")).href=[Gl(),"/src/dynamsoft.webtwain.css",v].join(""),p.rel="stylesheet",p.async=!0,Xt.scriptOnload(m,function(){Xt.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?(Qz.element=e,Qz.width=r,Qz.height=n):(Qz.element=undefined,Qz.width=undefined,Qz.height=undefined),Qz.border=i.GetWebViewer().border,Qz.selectionRectAspectRatio=i.GetWebViewer().selectionRectAspectRatio,Qz.workMode=Mz.normal,i.GetWebViewer().createImageEditor(Qz),0!=i._stwain.ErrorCode&&(i.GetWebViewer().webViewer.imageEditor&&i.GetWebViewer().webViewer.imageEditor.dispose(),i.GetWebViewer().createImageEditor(Qz)),i.GetWebViewer().webViewer.imageEditor&&i.GetWebViewer().webViewer.imageEditor.show(),!0}},{key:"__beforeImageEditorCreated",value:function(e){var t=tr.DWT.CustomizableDisplayInfo;if(!Xt.isUndefined(t)){if(!Xt.isUndefined(t.buttons)){var r=t.buttons.titles;Xt.isUndefined(r)||(Xt.isUndefined(r.previous)||(e.buttons.titles.previous=r.previous),Xt.isUndefined(r.next)||(e.buttons.titles.next=r.next),Xt.isUndefined(r.print)||(e.buttons.titles.print=r.print),Xt.isUndefined(r.scan)||(e.buttons.titles.scan=r.scan),Xt.isUndefined(r.load)||(e.buttons.titles.load=r.load),Xt.isUndefined(r.rotateleft)||(e.buttons.titles.rotateleft=r.rotateleft),Xt.isUndefined(r.rotate)||(e.buttons.titles.rotate=r.rotate),Xt.isUndefined(r.rotateright)||(e.buttons.titles.rotateright=r.rotateright),Xt.isUndefined(r.deskew)||(e.buttons.titles.deskew=r.deskew),Xt.isUndefined(r.crop)||(e.buttons.titles.crop=r.crop),Xt.isUndefined(r.cut)||(e.buttons.titles.cut=r.cut),Xt.isUndefined(r.changeimagesize)||(e.buttons.titles.changeimagesize=r.changeimagesize),Xt.isUndefined(r.flip)||(e.buttons.titles.flip=r.flip),Xt.isUndefined(r.mirror)||(e.buttons.titles.mirror=r.mirror),Xt.isUndefined(r.zoomin)||(e.buttons.titles.zoomin=r.zoomin),Xt.isUndefined(r.originalsize)||(e.buttons.titles.originalsize=r.originalsize),Xt.isUndefined(r.zoomout)||(e.buttons.titles.zoomout=r.zoomout),Xt.isUndefined(r.stretch)||(e.buttons.titles.stretch=r.stretch),Xt.isUndefined(r.fit)||(e.buttons.titles.fit=r.fit),Xt.isUndefined(r.fitw)||(e.buttons.titles.fitw=r.fitw),Xt.isUndefined(r.fith)||(e.buttons.titles.fith=r.fith),Xt.isUndefined(r.hand)||(e.buttons.titles.hand=r.hand),Xt.isUndefined(r.rectselect)||(e.buttons.titles.rectselect=r.rectselect),Xt.isUndefined(r.zoom)||(e.buttons.titles.zoom=r.zoom),Xt.isUndefined(r.restore)||(e.buttons.titles.restore=r.restore),Xt.isUndefined(r.save)||(e.buttons.titles.save=r.save),Xt.isUndefined(r.close)||(e.buttons.titles.close=r.close),Xt.isUndefined(r.removeall)||(e.buttons.titles.removeall=r.removeall),Xt.isUndefined(r.removeselected)||(e.buttons.titles.removeselected=r.removeselected));var n=t.buttons.bShowAllButtons;Xt.isUndefined(n)||(e.buttons.bShowAllButtons=n);var i=t.buttons.visibility;Xt.isUndefined(i)||(Xt.isUndefined(i.scan)||(e.buttons.visibility.scan=i.scan),Xt.isUndefined(i.load)||(e.buttons.visibility.load=i.load),Xt.isUndefined(i.print)||(e.buttons.visibility.print=i.print),Xt.isUndefined(i.removeall)||(e.buttons.visibility.removeall=i.removeall),Xt.isUndefined(i.removeselected)||(e.buttons.visibility.removeselected=i.removeselected),Xt.isUndefined(i.rotateleft)||(e.buttons.visibility.rotateleft=i.rotateleft),Xt.isUndefined(i.rotate)||(e.buttons.visibility.rotate=i.rotate),Xt.isUndefined(i.rotateright)||(e.buttons.visibility.rotateright=i.rotateright),Xt.isUndefined(i.deskew)||(e.buttons.visibility.deskew=i.deskew),Xt.isUndefined(i.crop)||(e.buttons.visibility.crop=i.crop),Xt.isUndefined(i.cut)||(e.buttons.visibility.cut=i.cut),Xt.isUndefined(i.changeimagesize)||(e.buttons.visibility.changeimagesize=i.changeimagesize),Xt.isUndefined(i.flip)||(e.buttons.visibility.flip=i.flip),Xt.isUndefined(i.mirror)||(e.buttons.visibility.mirror=i.mirror),Xt.isUndefined(i.zoomin)||(e.buttons.visibility.zoomin=i.zoomin),Xt.isUndefined(i.originalsize)||(e.buttons.visibility.originalsize=i.originalsize),Xt.isUndefined(i.zoomout)||(e.buttons.visibility.zoomout=i.zoomout),Xt.isUndefined(i.stretch)||(e.buttons.visibility.stretch=i.stretch),Xt.isUndefined(i.fit)||(e.buttons.visibility.fit=i.fit),Xt.isUndefined(i.fitw)||(e.buttons.visibility.fitw=i.fitw),Xt.isUndefined(i.fith)||(e.buttons.visibility.fith=i.fith),Xt.isUndefined(i.hand)||(e.buttons.visibility.hand=i.hand),Xt.isUndefined(i.rectselect)||(e.buttons.visibility.rectselect=i.rectselect),Xt.isUndefined(i.zoom)||(e.buttons.visibility.zoom=i.zoom))}var o=t.dialogText;Xt.isUndefined(o)||(Xt.isUndefined(o.dlgRotateAnyAngle)||(e.dialogText.dlgRotateAnyAngle=o.dlgRotateAnyAngle),Xt.isUndefined(o.dlgChangeImageSize)||(e.dialogText.dlgChangeImageSize=o.dlgChangeImageSize),Xt.isUndefined(o.saveChangedImage)||(e.dialogText.saveChangedImage=o.saveChangedImage),Xt.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=rr(o.index)+1),n.__fireEvent("onImageAreaSelected",{index:e,left:rr(o.x),top:rr(o.y),right:rr(o.x+o.width),bottom:rr(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;Xt.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:(t=n(g().mark(function i(e,t){var r,n,o,a,s,u,c,l,d,f,h;return g().wrap(function(i){for(;;)switch(i.prev=i.next){case 0:r=t,a=function(e){e&&Jl.output(null,e+" was loaded successfully!")},s=function(e,t,n){r._stwain._errorCode=e,r._stwain._errorString=t,n&&Jl.output(null,n+" failed to load. Error code: "+e+"Error String: "+t)},c=e.dataTransfer.files,r._stwain._loadImageBytesFileCount+=c.length,l=0;case 6:if(!(l<c.length)){i.next=75;break}if(0!=(n=c[l]).type.length){i.next=31;break}d=void 0,(f=n.name.indexOf("."))>0&&(d=n.name.substring(f+1)),i.t0=d,i.next="bmp"===i.t0?14:"jpg"===i.t0||"jpeg"===i.t0?16:"tif"===i.t0||"tiff"===i.t0?18:"png"===i.t0?20:"pdf"===i.t0?22:"jp2"===i.t0||"j2k"===i.t0||"j2c"===i.t0?24:26;break;case 14:return o=tr.DWT.EnumDWT_ImageType.IT_BMP,i.abrupt("break",29);case 16:return o=tr.DWT.EnumDWT_ImageType.IT_JPG,i.abrupt("break",29);case 18:return o=tr.DWT.EnumDWT_ImageType.IT_TIF,i.abrupt("break",29);case 20:return o=tr.DWT.EnumDWT_ImageType.IT_PNG,i.abrupt("break",29);case 22:return o=tr.DWT.EnumDWT_ImageType.IT_PDF,i.abrupt("break",29);case 24:return o=tr.DWT.EnumDWT_ImageType.IT_J2K,i.abrupt("break",29);case 26:Jl.output(null,n.name+" failed to load because the file type is not supported!"),o=-1,fa(r._stwain);case 29:i.next=49;break;case 31:i.t1=n.type,i.next="image/bmp"===i.t1?34:"image/jpg"===i.t1||"image/jpeg"===i.t1?36:"image/tif"===i.t1||"image/tiff"===i.t1?38:"image/png"===i.t1?40:"application/pdf"===i.t1?42:"image/jp2"===i.t1?44:46;break;case 34:return o=tr.DWT.EnumDWT_ImageType.IT_BMP,i.abrupt("break",49);case 36:return o=tr.DWT.EnumDWT_ImageType.IT_JPG,i.abrupt("break",49);case 38:return o=tr.DWT.EnumDWT_ImageType.IT_TIF,i.abrupt("break",49);case 40:return o=tr.DWT.EnumDWT_ImageType.IT_PNG,i.abrupt("break",49);case 42:return o=tr.DWT.EnumDWT_ImageType.IT_PDF,i.abrupt("break",49);case 44:return o=tr.DWT.EnumDWT_ImageType.IT_J2K,i.abrupt("break",49);case 46:Jl.output(null,n.name+" failed to load because the file type is not supported!"),o=-1,fa(r._stwain);case 49:if(u=n.name,-1==o){i.next=68;break}return r._stwain._bIfShowProgressBar?(h=r._stwain.IfShowCancelDialogWhenImageTransfer,r._stwain.IfShowCancelDialogWhenImageTransfer=!1,Qt.showProgress(r._stwain,"DropLoading",r._stwain.IfShowCancelDialogWhenImageTransfer),r._stwain.IfShowCancelDialogWhenImageTransfer=h):Qt.hideProgress(),r._stwain._OnPercentDone([0,-1,Fl.Loading]),r._stwain.Addon&&r._stwain.Addon.PDF&&Zc.checkProductKey(r._stwain,{PDFRasterizer:!0},!0),i.prev=54,i.next=57,new Qt.Promise(function(e,t){var i=new FileReader;i.readAsDataURL(n),i.onload=function(){var i=r._stwain.__GetLoadEventsNum();Qt.cancelFrom=jH.LoadImage,r._stwain.__LoadImageFromBytesV2(n,o,"",!0,0,n.size,!1,i,function(){r._stwain._loadImageBytesFileCount-=1,r._stwain.__OnPostLoad&&r._stwain.__OnPostLoad("",u||"",""+o),a(n.name),e()},function(i,a){-1119==i&&a.indexOf("correct password is not provided")>-1&&c.length>1?(s(i,a,n.name),r._stwain._loadImageBytesFileCount-=1,r._stwain.__OnPostLoad&&r._stwain.__OnPostLoad("",u||"",""+o),e()):t({code:i,message:a})})},i.onerror=function(e){Ea(r._stwain),t({code:r._stwain._errorCode,message:e})}});case 57:i.next=65;break;case 59:i.prev=59,i.t2=i["catch"](54),r._stwain._bIfShowProgressBar&&Qt.closeProgress(null),i.t2&&"code"in i.t2&&"message"in i.t2?s(i.t2.code,i.t2.message,u):Za(r._stwain,i.t2),r._stwain._loadImageBytesFileCount-=1,r._stwain.__OnPostLoad&&r._stwain.__OnPostLoad("",u||"",""+o);case 65:r._stwain._bIfShowProgressBar&&Qt.closeProgress(null),i.next=71;break;case 68:_s(r._stwain),r._stwain._loadImageBytesFileCount-=1,r._stwain.__OnPostLoad&&r._stwain.__OnPostLoad("",u||"",""+o);case 71:n=null;case 72:l++,i.next=6;break;case 75:case"end":return i.stop()}},i,null,[[54,59]])})),function(e,r){return t.apply(this,arguments)})},{key:"__pageChange",value:function(e,t){var r,n=t,i=n._ImgManager.count();if(Xt.log("OnPagination"),i<=0)da(n._stwain);else if(1!=i){!/^\d+$/.test(e)||e<=0?alert(Uz.errorMessages.invalidIndex):((r=rr(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,Xt.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,delete t.docName,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==tr.DWT.IfConfineMaskWithinTheViewer&&(tr.DWT.IfConfineMaskWithinTheViewer=!1,n=!0);var i;i=Xt.isArray(t)&&t.length>=3?t:Uz.dialogText.selectSource,r._stwain._selectSourceAsync("SelectSourceAsync",null,i).then(function(){return r._stwain.AcquireImageAsync({IfShowUI:!0,IfCloseSourceAfterAcquire:!0})}).then(function(){n&&(tr.DWT.IfConfineMaskWithinTheViewer=!0)})["catch"](function(e){Xt.log("User did not select a source"),n&&(tr.DWT.IfConfineMaskWithinTheViewer=!0)})}catch(o){}}},{key:"__loadImage",value:function(e){if(e){var t=e._stwain._containerElement;try{var r=e,n=null;tr.DWT.IfConfineMaskWithinTheViewer&&(n=!0,tr.DWT.IfConfineMaskWithinTheViewer=!1),r._stwain._containerElement=undefined;if(r._stwain.IfShowFileDialog=!0,r._stwain.Addon&&r._stwain.Addon.PDF){Zc.checkProductKey(r._stwain,{PDFRasterizer:!0},!0)}r._stwain.LoadImageEx("",5,function(){t&&(r._stwain._containerElement=t),Xt.log("Loaded an image successfully."),null!=n&&(tr.DWT.IfConfineMaskWithinTheViewer=n)},function(e,i){t&&(r._stwain._containerElement=t),Xt.log("Loading failed with the error: "+i),null!=n&&(tr.DWT.IfConfineMaskWithinTheViewer=n)})}catch(i){t&&(e._stwain._containerElement=t)}}}},{key:"__print",value:function(e){var t=e;ss(t._stwain),t._ImgManager.getCurrentImageIndex()<0||t._ImgManager.PrintCurrentImage()}},{key:"__save",value:(e=n(g().mark(function a(e,t,r,n,i){var o,s,u,c,l,d;return g().wrap(function(a){for(;;)switch(a.prev=a.next){case 0:if(o=e,s="save",e){a.next=3;break}return a.abrupt("return");case 3:if(ss(o._stwain),!(o._ImgManager.count()<=0||o._ImgManager.getCurrentImageIndex()<0)){a.next=6;break}return a.abrupt("return");case 6:return u=e._stwain._containerElement,o._stwain._containerElement=undefined,c=o.__getViewerElement(o,i),ld(s,c),a.prev=10,l=this._ImgManager.getIndexByUid(t),d=this._ImgManager.convertClientIndexToServerId(l),a.next=15,o._stwain._updateImage(d,r,n);case 15:a.sent,a.next=20;break;case 18:a.prev=18,a.t0=a["catch"](10);case 20:return a.prev=20,u&&(e._stwain._containerElement=u),r=null,dd(s),a.finish(20);case 25:return a.abrupt("return",void 0);case 26:case"end":return a.stop()}},a,this,[[10,18,20,25]])})),function(t,r,n,i,o){return e.apply(this,arguments)})},{key:"__removePage",value:function(e,t){var r=e;e&&(r._ImgManager.count()<=0||r._ImgManager.getCurrentImageIndex()<0||r._stwain.RemoveImage(t))}},{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";ss(n._stwain);var o=n._ImgManager.getCurrentImageIndex();if(n._ImgManager.count()<=0||o<0)Kz.output(n,"No image in Buffer");else{var a=n.__getViewerElement(n,!0);ld(i,a);n._stwain.GetSkewAngleFromBinaryAsync(o,t,function(e){r(e[0]),dd(i)},function(){dd(i)})}}},{key:"__remove",value:function(e){var t=this;ss(t._stwain),t._ImgManager.count()<=0||t._ImgManager.getCurrentImageIndex()<0?Kz.output(t,"No image in Buffer"):t._stwain.RemoveAllSelectedImages()}},{key:"__removeAll",value:function(e){var t=this;ss(t._stwain),t._ImgManager.count()<=0||t._ImgManager.getCurrentImageIndex()<0?Kz.output(t,"No image in Buffer"):t._stwain.RemoveAllImages()}},{key:"__onBindViewer",value:function(e){e&&(Nz._setContainer(this._stwain,e),e.id&&(tr.DWT.ContainerMap[e.id]=this._stwain))}},{key:"__onUnBindViewer",value:function(e){if(e){var t=Nz._getContainer(this._stwain);if(t)for(;t.firstChild;)t.removeChild(t.firstChild);if(Nz._setContainer(this._stwain,null),e.id){var r=tr.DWT.ContainerMap;e.id in r&&delete tr.DWT.ContainerMap[e.id]}}}},{key:"__close",value:function(e){ss(this._stwain),Nz._closeImageEditorUI(this._stwain)}},{key:"__rotateRightForServer",value:function(e){var t=this;ss(t._stwain);var r=t._ImgManager.getCurrentImageIndex();t._ImgManager.count()<=0||r<0?Kz.output(t,"No image in Buffer"):t._stwain.RotateRight(r)}},{key:"__rotateForServer",value:function(e,t,r,n){var i=this;ss(i._stwain);var o=i._ImgManager.getCurrentImageIndex();i._ImgManager.count()<=0||o<0?Kz.output(i,"No image in Buffer"):i._stwain.RotateEx(o,t,n,r)}},{key:"__rotateLeftForServer",value:function(e){var t=this;ss(t._stwain);var r=t._ImgManager.getCurrentImageIndex();t._ImgManager.count()<=0||r<0?Kz.output(t,"No image in Buffer"):t._stwain.RotateLeft(r)}},{key:"__deskewForServer",value:function(e){var t=this;ss(t._stwain);var r=t._ImgManager.getCurrentImageIndex();t._ImgManager.count()<=0||r<0?Kz.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;ss(r._stwain);var n=r._ImgManager.getCurrentImageIndex();if(r._ImgManager.count()<=0||n<0)Kz.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,rr(i),rr(o),rr(a),rr(s))}}},{key:"__eraseForServer",value:function(e,t){var r=this;ss(r._stwain);var n=r._ImgManager.getCurrentImageIndex();if(r._ImgManager.count()<=0||n<0)Kz.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,rr(i),rr(o),rr(a),rr(s))}}},{key:"__changeImageSizeForServer",value:function(e,t,r,n){var i=this;ss(i._stwain);var o=i._ImgManager.getCurrentImageIndex();i._ImgManager.count()<=0||o<0?Kz.output(i,"No image in Buffer"):i._stwain.ChangeImageSize(o,t,r,n)}},{key:"__flipForServer",value:function(e){var t=this;ss(t._stwain);var r=t._ImgManager.getCurrentImageIndex();t._ImgManager.count()<=0||r<0?Kz.output(t,"No image in Buffer"):t._stwain.Flip(r)}},{key:"__mirrorForServer",value:function(e){var t=this;ss(t._stwain);var r=t._ImgManager.getCurrentImageIndex();t._ImgManager.count()<=0||r<0?Kz.output(t,"No image in Buffer"):t._stwain.Mirror(r)}},{key:"__restoreForServer",value:function(e,t){var r=e;if(ss(r._stwain),r._ImgManager.count()<=0||r._ImgManager.getCurrentImageIndex()<0)Kz.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 ui.Promise(function(e,n){ss(r._stwain),(r._ImgManager.count()<=0||r._ImgManager.getCurrentImageIndex()<0)&&(Kz.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){Xt.log("__RestoreImageInner: "+[e.uuid].join(","));var o=Xt.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&&(Xt.log("__SaveImageInner: "+[e.uuid].join(",")),i._ImgManager.getCurrentImageIndex()==t)){var a=Xt.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;tr.DWT.ConnectWithSocket?n():Ui({method:"GET",xhrFields:{withCredentials:!0},url:Jl.getUrlByAct(i._ImgManager.getBaseUrl,o,r),onSuccess:function(r){var a;e.ticks=Date.now(),a=tr.navInfoSync.bMobile?Jl.getImageUrl(i._ImgManager.getBaseUrl,o,Math.round(e.iImageControlWidth*devicePixelRatio),Math.round(e.iImageControlHeight*devicePixelRatio),e.ticks):Jl.getImageUrl(i._ImgManager.getBaseUrl,o,rr(e.iImageControlWidth),rr(e.iImageControlHeight),e.ticks),e.imageUrl=Jl.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,t}(),Yz=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 this._stwain=null,!0}},{key:"append",value:function(e,t,r,n,i){var o,a,s,u,c,l=this;(this._buffer.isActiveFile||!Xt.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!Xt.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())?Xt.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=tr.navInfoSync.bMobile?Jl.getImageUrl(o._baseUrl,r,Math.round(e*devicePixelRatio),Math.round(t*devicePixelRatio),Date.now()):Jl.getImageUrl(o._baseUrl,r,e,t,Date.now());var u=Xt.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=Xt.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 Jh).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 Jh).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()),Xt.isUndefined(r)&&(r=-1),Xt.isUndefined(n)&&(n=-1),t.iImageControlWidth=r,t.iImageControlHeight=n,t.bAddImage=i,t.bAppendImage=o,t.index=a,tr.DWT.ConnectWithSocket&&l._stwain._isBindViewer()?(l._attachImagesForControl(t,s),Nz._getblob_queue.push([l._stwain,e,s]),Nz.ProcessGetBlobByQueue()):(u=Jl.getImageUrl(d,e,-1,-1,t.ticks),c=tr.navInfoSync.bMobile?Jl.getImageUrl(d,e,Math.round(r*devicePixelRatio),Math.round(n*devicePixelRatio),t.ticks):Jl.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=Xt.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}}])}(BH);function Xz(){var e=window.Dynamsoft.Lib.Promise;if(Jz)return e.resolve(Jz);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&&Xt.isArray(i.brands)&&i.brands.length>0?o=i.brands:"uaList"in i&&Xt.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 Jz=e,e})}}return Jz=de,e.resolve(Jz)}var Zz=0,$z=[],eK=!(!document||!document.addEventListener),tK="DOMContentLoaded",rK="readystatechange",nK="load",iK="complete",oK=eK?function(e,t,r){e.addEventListener(t,r,!1)}:function(e,t,r){e.attachEvent("on"+t,r)},aK=eK?function(e,t,r){e.removeEventListener(t,r,!1)}:function(e,t,r){e.detachEvent("on"+t,r)};function sK(){Zz||(Zz=1,Xz().then(function(){document&&aK(window,nK,sK),function(){for(var e=function(){try{$z[t]()}catch(TH){Xt.log(TH,"error"),setTimeout(function(){throw TH},0)}},t=0;t<$z.length;t++)e()}()}))}function uK(e){if(Zz)try{e()}catch(TH){Xt.log(TH,"error"),setTimeout(function(){throw TH},0)}else $z.push(e);return this}var cK=function(e){var t=e||window.event,r=!0;return Xt.each(ui.Events.registedObjs,function(e){Xt.each(ui.Events.registedClass,function(n){if(e instanceof n&&e.bFocus&&e.handlerKeyDown&&!(r=e.handlerKeyDown(t)))return!1})}),r};function lK(e,t){for(var r in t)t.hasOwnProperty(r)&&!Xt.isUndefined(t[r])&&(e.hasOwnProperty(r)&&!Xt.isUndefined(e[r])||(e[r]=t[r]));return e}uK(function(){Xt.addEventListener(document.documentElement,"keydown",cK)}),lK(tr.DWT,Io),lK(tr.DWT,bo),tr.DWT.CertificateConfig?lK(tr.DWT.CertificateConfig,wo):tr.DWT.CertificateConfig=wo,tr.DWT.RegisterEvent=function(e,t){if(Xt.isUndefined(e))throw{code:-2314,message:"The parameter cannot be empty."};if(!Xt.isString(e)||Xt.isString(e)&&0==e.trim().length||Xt.isUndefined(t)||!Xt.isFunction(t))throw{code:-2416,message:"Invalid parameter."};return Xt.isFunction(t)&&(tr.DWT[e]=t),!0};var dK=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}({}),fK=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}({}),hK=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}({}),gK=function(e){return e.TWON_NONE=0,e.TWON_ARRAY=3,e.TWON_ENUMERATION=4,e.TWON_ONEVALUE=5,e.TWON_RANGE=6,e}({}),mK=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}({}),pK=function(e){return e.TWFA_NONE=0,e.TWFA_LEFT=1,e.TWFA_CENTER=2,e.TWFA_RIGHT=3,e}({}),vK=function(e){return e.TWFO_FIRSTPAGEFIRST=0,e.TWFO_LASTPAGEFIRST=1,e}({}),_K=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}({}),yK=function(e){return e.TWPM_SINGLESTRING=0,e.TWPM_MULTISTRING=1,e.TWPM_COMPOUNDSTRING=2,e}({}),SK=function(e){return e.TWBR_THRESHOLD=0,e.TWBR_HALFTONE=1,e.TWBR_CUSTHALFTONE=2,e.TWBR_DIFFUSION=3,e}({}),IK=function(e){return e.TWBO_LSBFIRST=0,e.TWBO_MSBFIRST=1,e}({}),bK=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}({}),TK=function(e){return e.TWFL_NONE=0,e.TWFL_OFF=1,e.TWFL_ON=2,e.TWFL_AUTO=3,e.TWFL_REDEYE=4,e}({}),CK=function(e){return e.TWFR_BOOK=0,e.TWFR_FANFOLD=1,e}({}),wK=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}({}),kK=function(e){return e.TWLP_REFLECTIVE=0,e.TWLP_TRANSMISSIVE=1,e}({}),EK=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}({}),xK=function(e){return e.TWNF_NONE=0,e.TWNF_AUTO=1,e.TWNF_LONEPIXEL=2,e.TWNF_MAJORITYRULE=3,e}({}),AK=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}({}),PK=function(e){return e.TWOV_NONE=0,e.TWOV_AUTO=1,e.TWOV_TOPBOTTOM=2,e.TWOV_LEFTRIGHT=3,e.TWOV_ALL=4,e}({}),DK=function(e){return e.TWPF_CHOCOLATE=0,e.TWPF_VANILLA=1,e}({}),FK=function(e){return e.TWPC_CHUNKY=0,e.TWPC_PLANAR=1,e}({}),WK=function(e){return e.Binary=0,e.Base64=1,e}({}),NK=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}(NK||{}),OK=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}(OK||{});Xt.mix(tr.DWT,{EnumDWT_DeviceType:ed,EnumDWT_Cap:dK,EnumDWT_CapLanguage:fK,EnumDWT_CapSupportedSizes:hK,EnumDWT_CapType:gK,EnumDWT_CapValueType:mK,EnumDWT_CapFeederAlignment:pK,EnumDWT_CapFeederOrder:vK,EnumDWT_CapPrinter:_K,EnumDWT_CapPrinterMode:yK,EnumDWT_CapBitdepthReduction:SK,EnumDWT_CapBitOrder:IK,EnumDWT_CapFilterType:bK,EnumDWT_CapFlash:TK,EnumDWT_CapFlipRotation:CK,EnumDWT_CapImageFilter:wK,EnumDWT_CapLightPath:kK,EnumDWT_CapLightSource:EK,EnumDWT_CapNoiseFilter:xK,EnumDWT_CapORientation:AK,EnumDWT_CapOverscan:PK,EnumDWT_CapPixelFlavor:DK,EnumDWT_CapPlanarChunky:FK,EnumDWT_ImageType:af,EnumDWT_ImageFormatType:tz,EnumDWT_ResponseType:VH,EnumDWT_SourceMatchField:of,EnumDWT_UploadDataFormat:WK,EnumDWT_WorkMode:Mz,EnumDWT_ConvertMode:bc,EnumDWT_PixelType:NK,EnumDWT_UnitType:OK});var RK=tr.DWT;RK.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},RK.EnumDWT_BorderStyle={TWBS_NONE:0,TWBS_SINGLEFLAT:1,TWBS_SINGLE3D:2},RK.EnumDWT_MessageType={TWQC_GET:1,TWQC_SET:2,TWQC_GETDEFAULT:4,TWQC_GETCURRENT:8,TWQC_RESET:16},RK.EnumDWT_TransferMode={TWSX_NATIVE:0,TWSX_FILE:1,TWSX_MEMORY:2},RK.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},RK.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},RK.EnumDWT_InterpolationMethod={IM_NEARESTNEIGHBOUR:1,IM_BILINEAR:2,IM_BICUBIC:3,IM_BESTQUALITY:5},RK.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},RK.EnumDWT_ShowMode={SW_ACTIVE:0,SW_MAX:1,SW_MIN:2,SW_CLOSE:3,SW_IFLIVE:4},RK.EnumDWT_DUPLEX={TWDX_NONE:0,TWDX_1PASSDUPLEX:1,TWDX_2PASSDUPLEX:2},RK.EnumDWT_MagType={TWMD_MICR:0,TWMD_RAW:1,TWMD_INVALID:2},RK.EnumDWT_DataSourceStatus={TWDSS_CLOSED:0,TWDSS_OPENED:1,TWDSS_ENABLED:2,TWDSS_ACQUIRING:3};var MK=function(e){return e.enumFitWindow=0,e.enumFitWindowHeight=1,e.enumFitWindowWidth=2,e}(MK||{});RK.EnumDWT_FitWindowType={enumFitWindow:MK.enumFitWindow,enumFitWindowHeight:MK.enumFitWindowHeight,enumFitWindowWidth:MK.enumFitWindowWidth},RK.EnumDWT_PlatformType={enumUnknown:hc.enumUnknown,enumWindow:hc.enumWindow,enumMac:hc.enumMac,enumLinux:hc.enumLinux,enumEmbed:hc.enumEmbed,enumChromeOS:hc.enumChromeOS,enumHarmonyOS:hc.enumHarmonyOS,enumAndroid:hc.enumAndroid,enumiOS:hc.enumiOS};var LK=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}(LK||{});RK.EnumDWT_MouseShape={Default:LK.Default,Hand:LK.Hand,Crosshair:LK.Crosshair,Zoom:LK.Zoom,NWResize:LK.NWResize,EResize:LK.EResize,NResize:LK.NResize,Resize:LK.Resize,Move:LK.Move},RK.EnumDWT_Language={English:0,French:1,Arabic:2,Spanish:3,Portuguese:4,German:5,Italian:6,Russian:7,Chinese:8},RK.EnumDWT_InitMsg={Info:Lf.Info,Error:Lf.Error,NotInstalledError:Lf.NotInstalledError},RK.EnumDWT_Driver={TWAIN:Fh.TWAIN,ICA:Fh.ICA,SANE:Fh.SANE,TWAIN_AND_ICA:Fh.TWAIN_AND_ICA,TWAIN_AND_TWAIN64:Fh.TWAIN_AND_TWAIN64,TWAIN64:Fh.TWAIN64},RK.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 BK=function(e){return e.Single=0,e.Multiple=1,e}(BK||{});RK.EnumDWT_SelectionMode={Single:BK.Single,Multiple:BK.Multiple},RK.EnumDWT_ConfirmExitType={Cancel:0,Exit:1,SaveAndExit:2},RK.EnumDWT_WebsocketReadyState={CONNECTING:zd.CONNECTING,OPEN:zd.OPEN,CLOSING:zd.CLOSING,CLOSED:zd.CLOSED};var UK=function(e){return e.TwainService=1,e}(UK||{});RK.EnumDWT_ServiceType={TwainService:UK.TwainService};var VK,jK=function(e){return e["default"]=0,e.standard=1,e.supported=2,e}(jK||{});RK.EnumDWT_ExtImageInfo={"default":jK["default"],standard:jK.standard,supported:jK.supported};var GK=20230506,HK=function(){if(tr.dcp){var e=tr.dcp.dcpJSVer;if(Xt.isNumber(e))return e>=GK}return!1};if(HK())HK=VK,GK=VK;else{var zK=Ho.detect,KK={_checkService:function(e,t){zK.dcpStatus=zK.EnumDCP_DetectStatus.CheckingServiceVer,JK(null,"DSVersion").then(e,t)},_checkUpdateFile:function(e,t){JK(null,"CheckUpdateFile").then(e,t)},_updateService:function(e,t){JK(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="+Xt.now(),de.bWin&&Ho.b64bit&&(r="_x64"),[Gl(),"/dist/serviceupdate/",e,"DSUpdate_",lo().join("."),r,".zip",t].join("")},getPorts:function(e,t){var r="GetPorts",n="dwasm2_"+go();return QK(e,r,{id:Xt.guid(),method:r,version:n,parameter:[t]},Yo())},_getStatusString:function(e,t){var r,n,i="";return e==zK.EnumDCP_DetectStatus.Init?"Getting manager version":e==zK.EnumDCP_DetectStatus.Connected?(t&&(i=t),"Getting manager version succeeded and the version is "+i):e==zK.EnumDCP_DetectStatus.CheckingManagerVer?"Getting manager version":e==zK.EnumDCP_DetectStatus.CheckingServiceVer?"Getting service version":e==zK.EnumDCP_DetectStatus.NotInstalled?"Dynamic Web TWAIN Service Not Installed":e==zK.EnumDCP_DetectStatus.UpdateSkipped?"Update skipped":e==zK.EnumDCP_DetectStatus.CheckedService?(t&&(i=t),"Getting service version succeeded and the version is "+i):e==zK.EnumDCP_DetectStatus.VerifyingZip?"Verifying the update package":e==zK.EnumDCP_DetectStatus.VerifiedZip?"Update package verified":e==zK.EnumDCP_DetectStatus.UpdatingService?"Updating the service":e==zK.EnumDCP_DetectStatus.UpdateSucceed?"Update succeeded":e==zK.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;Xt.isFunction(n.OnGetServiceUpdateStatus)&&n.OnGetServiceUpdateStatus(r,zK.dcpStatus,KK._getStatusString(zK.dcpStatus,t))},_getErr:function(e){var t,r="";try{Xt.isString(e)?(t=e.replace(/\0/g,""),t=Xt.parse(t)):e&&(t=e),"description"in t&&(r=t.description)}catch(n){}return r},_funShowUpgradeDialogWhenUpdateFailed:function(e,t){return zK.bConnected=!0,zK.dcpStatus=zK.EnumDCP_DetectStatus.UpdateFailed,e&&e(),t&&t(),KK._sendStatusEvent(!0),!0},_funUpdateFailed:function(e,t,r,n){var i,o;return zK.bConnected=!0,zK.dcpStatus=zK.EnumDCP_DetectStatus.UpdateFailed,e&&e(),200==n?(i="The update failed.",o=KK._getStatusString(zK.dcpStatus,KK._getErr(r))):o=i="The update failed. The error code is "+n,t&&t(!0,i),KK._sendStatusEvent(!0,o),!0},getDSPath:function(e,t){return gc(t)},getLinuxHTML5DebPath:function(){return gc(".deb")},getLinuxHTML5RpmPath:function(){return gc(".rpm")},getBinaryFileInfo:function(e,t){var r="GetBinaryFileInfo",n={id:Xt.guid(),method:r,version:"dwasm2_"+go(),parameter:[]},i=Xt.stringify(n),o=function(r,n,i){var o;r&&(o=Xt.parse(r)),o?e(o):t(r,n,i)};if(tr.DWT.ConnectWithSocket&&de.bHTML5Edition){var a=tr.DWT.Host,s=qd.getWsUrl(tr.DWT.Host,Zo(a)?Ho.SSLPort:Ho.Port);return qd.postStringDataByWSUrl(s,i).then(o,t),!0}var u=[ho(),"/",r,"?type=1&dsver=",fo().join(""),"&ts=",Xt.now()].join("");nc.getHttpClientForDcp().request(i,u,{},500).then(o,t)}};Xt.mix(Ho,KK),tr.dcp=Ho,tr.dcp.dcpJSVer=GK,HK=VK,GK=VK}function JK(e,t,r,n){var i;return i={id:Xt.guid(),method:t,version:"dwasm2_"+go(),parameter:[]},"VersionInfo"==t&&(i.version="dwasm2_"+qo.getVersionStrForCheck()),Zc.isLongKey(r)&&(i.productKey=r),QK(e,t,i,Yo(),n)}function QK(e,t,r,n,i){return qK.apply(this,arguments)}function qK(){return qK=n(g().mark(function e(t,r,n,i,o){var a,s,u,c,l,d,f,h,m,p,v;return g().wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return a=Xt.stringify(n),Ho.detect.bConnected=!1,s=[ho(),"/",r,"?type=1&dsver=",fo().join(""),"&ts=",Xt.now()].join(""),c=$o(),l=c?Ho.SSLPort:Ho.Port,u=nc.getHttpClient(t,l,c),d={},o&&!c&&(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||c){e.next=20;break}if((e.t0&&e.t0.code)!=ua.HTTPRedirected){e.next=20;break}throw Os();case 20:throw e.t0;case 21:if(f&&(h=Xt.parse(f)),!(h&&"exception"in h&&"description"in h)){e.next=27;break}throw m={code:h.exception,message:h.description},(p=gu(h))&&(m.errorCause=p),m;case 27:if(!h||!("result"in h)){e.next=33;break}if(!Ho.detect.bConnected){e.next=30;break}return e.abrupt("return",h.result);case 30:return Ho.detect.bConnected=!0,Ho.detect.dcpStatus=Ho.detect.EnumDCP_DetectStatus.Connected,e.abrupt("return",h.result);case 33:throw xs(v={}),fu(v);case 36:case"end":return e.stop()}},e,null,[[8,14]])})),qK.apply(this,arguments)}tr.DWT.__innerCheckCertDate=function(e){Bf(e)&&(Xt.isFunction(tr.OnCertExpired)&&tr.OnCertExpired(e),setTimeout(function(){tr.DWT.UpdateCert(tr.DWT.CertificateConfig.URL,tr.OnUpdateCertSuccess,tr.OnUpdateCertFailure)},5e3))},tr.DWT.__innerUpdateCert=function(e,t,r,n){var i=[ho(),"/LoadZipFromBytes?type=",4,"&dsver=",fo().join(""),"&ts=",Xt.now()].join("");nc.getHttpClientForDcp(null,t).request(e,i,{},3e4).then(r,function(e){Xt.isFunction(n)&&n(e)})},tr.DWT.__innerReboot=function(e,t){var r=[ho(),"/admin?ts=",Xt.now()].join(""),n='{"id":"'+(new Date).getTime().toString()+'","method":"Reboot","parameter":[],"version":"dwasm2_'+go()+'"}';nc.getHttpClientForDcp().request(n,r,{},3e4).then(e,t)},tr.DWT.UpdateCert=function(e,t,r){Xt.isString(e)&&""!=e?nu(e,{mode:"cors",dataType:"arraybuffer"}).then(function(e){tr.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;xs(o={}),o=fu(o)}n?Qt.isFunction(r)&&r(n):(tr.DWT.CheckCertExpired=!1,Xt.isFunction(t)&&t())},function(n){$o()?tr.DWT.__innerUpdateCert(e,!0,t,r):Xt.isFunction(r)&&r(n)})},r):Xt.isFunction(r)&&r()};var YK={Errors:{FilePathSyntaxIncorrect:function(e){e._errorCode=-3123,e._errorString="The filename, directory name, or volume label syntax is incorrect."}},checkFilePath:function(e,t){return Xt.isString(t)&&0!=t.length?Xt.startsWith(t,"http://")||Xt.startsWith(t,"https://")||Xt.startsWith(t,"ftp://")?(Qt.File.Errors.FilePathSyntaxIncorrect(e),li):di:(Ea(e),li)}};YK.checkFolder=YK.checkFilePath,Qt.File=YK,Qt.showProgress=function(){},Qt.closeProgress=function(){};var XK=document.location.protocol,ZK=location.hostname,$K=$o(),eJ={detect:{ssl:$K,dcpStatus:0,dcpCallbackType:0,arySTwains:[],bFirst:di,bOK:li,__dialog:li,cssLoaded:li,viewerScriptLoaded:li,bNoControlEvent:li,bNeedUpgradeEvent:li,bPromptJSOrServerOutdated:li,detectType:$K?1:"http:"===XK||""===ZK?0:-1,tryTimes:0,ports:[{port:tr.DWT.SSLPort,ssl:di},{port:tr.DWT.Port,ssl:li}],cUrlIndex:0,urls:[],onNoControl:li,needUpgrade:li,OnDetectNext:li,OnCreatWS:li,bMaskShow:li},page:{bUnload:li}};function tJ(){var e=wo;if(tr.DWT.CertificateConfig){var t=tr.DWT.CertificateConfig;Xt.isString(t.URL)||(t.URL=e.URL),(!Xt.isNumber(t.UpdateDaysBeforeExpired)||t.UpdateDaysBeforeExpired<=0)&&(t.UpdateDaysBeforeExpired=e.UpdateDaysBeforeExpired)}else tr.DWT.CertificateConfig=e;Gz(),Xt.isString(tr.DWT.ProductKey)&&(tr.DWT.ProductKey=Xt.trim(tr.DWT.ProductKey)),tr.navInfo&&(de.bMac||de.bWin)&&(tr.navInfo.bEmbed=!1,tr.navInfo.bArm64=!1,tr.navInfo.bMips64=!1),tr.DWT.Debug&&(Xt.debug=!0)}function rJ(){return nJ.apply(this,arguments)}function nJ(){return nJ=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(tr.DWT.IfLoadResources){e.next=5;break}return Qt.detect.cssLoaded=di,e.abrupt("return");case 5:return t=Gl(),r="",!de.bFileSystem&&tr.DWT.IfResourcesAddTimestamp&&(r=Qt.timestamp),n=[[t,"/src/dynamsoft.webtwain.css",r].join("")],Qo.bHTML5Edition&&tr.DWT.UseDefaultViewer&&n.push([t,"/src/dynamsoft.webtwain.viewer.css",r].join("")),Qt.detect.cssLoaded=di,e.prev=10,e.next=13,new Qt.Promise(function(e,t){if(de.bSafari){var r=!1;if(Xt.addAllCss(n,!1,function(e){e||(r=!0)}),r)t({code:-2804,message:"Loading the WebTwain css files failed."});else e()}else Xt.addAllCss(n,!1,function(r){r?e():t({code:-2804,message:"Loading the WebTwain css files failed."})})});case 13:Qo.bHTML5Edition&&!de.bFileSystem&&tr.DWT.IfCheckCssFiles&&(de.bSafari?setTimeout(function(){try{iJ(n)}catch(e){Ld(e)}},1e3):iJ()),e.next=19;break;case 16:e.prev=16,e.t0=e["catch"](10),Ld(e.t0);case 19:case"end":return e.stop()}},e,null,[[10,16]])})),nJ.apply(this,arguments)}function iJ(e){var t=document.createElement("div"),r=!1;if(t.style.display="none",document.body.appendChild(t),t.className="dynamsoft-dwt-dlg-button","rgb(254, 142, 20)"===getComputedStyle(t).backgroundColor&&(tr.DWT.UseDefaultViewer?(t.className="dvs-imageEditor-mask",r="rgb(220, 226, 241)"===getComputedStyle(t).backgroundColor):r=!0),document.body.removeChild(t),0==r)throw{code:-2804,message:"Loading the WebTwain css files failed."}}Xt.mix(Qt,eJ),Qt.Addon_Events=[],Qt.Addon_Sendback_Events=[];var oJ=new Hl(function(){return Qo.loadingResourcePath});function aJ(e){return sJ.apply(this,arguments)}function sJ(){return sJ=n(g().mark(function e(t){var r,n,i,o,a,s;return g().wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if(fc("Loading css..."),tJ(),!Qo.loadResourcePath){e.next=4;break}return e.abrupt("return",Qt.Promise.resolve());case 4:if(!Qo.loadingResourcePath){e.next=6;break}return e.abrupt("return",oJ.asyncWaitingJSLoaded());case 6:if(Qo.loadingResourcePath=!0,(tr.DWT.Port>0||tr.DWT.SSLPort>0)&&(Qt.detect.ports=[{port:tr.DWT.Port,ssl:!1},{port:tr.DWT.SSLPort,ssl:!0}],cf.removeItem("DWT_port"),cf.removeItem("DWT_ssl")),Xt.each(Qt._funsAfterConfigLoaded,function(e){try{Xt.isFunction(e)&&e()}catch(t){}}),(r=Xt.sizzle(".dynamsoft_waiting"))&&r.length>0&&(n=r[0]).parentNode&&n.parentNode.removeChild(n),i=Gl(),o="",!de.bFileSystem&&tr.DWT.IfResourcesAddTimestamp&&(o=Qt.timestamp),a=di,s=[],de.bSafari&&(a=li),s.push([i,"/dynamsoft.webtwain.install.js",o].join("")),tr.DWT.bNpm&&(s=[]),Qo.bHTML5Edition&&tr.DWT.UseDefaultViewer&&(fc("Loading the viewer script..."),s.push([i,"/src/dynamsoft.webtwain.viewer.js",o].join(""))),tr.DWT.IfLoadResources||(s=[]),rJ(),0!=s.length){e.next=25;break}return uJ(),Qo.loadResourcePath=!0,Qo.loadingResourcePath=!1,e.abrupt("return");case 25:return e.abrupt("return",new Qt.Promise(function(e,t){Xt.addScripts(s,a,!1,function(r){var n=r;if(Qo.bHTML5Edition&&tr.DWT.UseDefaultViewer&&!Xt.isFunction(tr.DWTViewer)&&(n=!1),de.bIE&&Qo.bActiveXEdition&&(Xt.isFunction(tr.DWT._innerLoad)||(n=!1)),!n)return Qo.loadingResourcePath=!1,void t({code:-2803,message:"Loading the WebTwain JavaScript source files failed."});uJ(),Qo.loadResourcePath=!0,Qo.loadingResourcePath=!1,tr.DWT.OnWebTwainWillInit&&tr.DWT.OnWebTwainWillInit(),e()})}));case 26:case"end":return e.stop()}},e)})),sJ.apply(this,arguments)}function uJ(){if(Qt.bNode||de.bJSDom);else if(Xt.isArray(tr.aryAddonReadyFun)){for(var e=0,t=function(){var t=tr.aryAddonReadyFun[e];if(Xt.isFunction(t))try{t(Qt)}catch(TH){Xt.log(TH.stack||TH,"error"),setTimeout(function(){throw TH},0)}};e<tr.aryAddonReadyFun.length;e++)t();tr.aryAddonReadyFun=[]}}var cJ=[],lJ=[];function dJ(){var e,t=cJ.length;for(e=0;e<t;e++)cJ[e]();cJ.splice(0),lJ.splice(0),gJ=0}function fJ(){if(gJ>0&&(new Date).getTime()-gJ>hJ){var e,t={code:-2802,message:"The file dynamsoft.webtwain.config.js timed out while loading."},r=tr.DWT.Containers;r&&0!==r.length||(Ts(e={}),t={code:e._errorCode,message:e._errorString}),function(e){var t,r=lJ.length;for(t=0;t<r;t++)lJ[t](e);cJ.splice(0),lJ.splice(0),gJ=0}(t)}else if(tr.DWT.Containers||tr.DWT.ProductKey||tr.DWT.licenseServer||tr.DWT.organizationID||tr.DWT.handshakeCode||tr.DWT.bNpm||0==tr.DWT.AutoLoad){if(Qo.dwtConfigLoading)return;if(Qo.dwtConfigLoaded)return void dJ();Qo.dwtConfigLoading=!0;var n=Gl();if(Xt.isArray(tr.DWT.Containers)||(tr.DWT.Containers=[]),de.bIE){var i=de.IEVersion;if((""===i||i>=10)&&tr.DWT.IfUseActiveXForIE10Plus){var o=li;de.bHTML5Edition=o,Qo.bHTML5Edition=o,Qo.bActiveXEdition=!0,Qo.bChromeEdition=Qo.bHTML5Edition}}if(Qo.bActiveXEdition&&tr.DWT.IfLoadResources){var a="";!de.bFileSystem&&tr.DWT.IfResourcesAddTimestamp&&(a=Qt.timestamp),Xt.addScript([n,"/src/dynamsoft.webtwain.activex.js",a].join(""),!0,!1,function(){Qo.dwtConfigLoaded=!0,Qo.dwtConfigLoading=!1,dJ()})}else Qo.dwtConfigLoaded=!0,Qo.dwtConfigLoading=!1,dJ()}else setTimeout(fJ,100)}var hJ=3e3,gJ=0;function mJ(e){return fc("Loading the config script..."),Qo.dwtConfigLoaded?Qt.Promise.resolve():(e&&(hJ=1e3*parseInt(e))<1&&(hJ=1),new Qt.Promise(function(e,t){cJ.push(e),lJ.push(t),uK(function(){gJ=(new Date).getTime(),setTimeout(fJ,100)})}))}function pJ(){var e;(e=tr.DWT.WebTwainIdMap)&&Xt.each(e,function(e,t){e&&e._OnPageBlur&&e._OnPageBlur()})}if(Qo.bActiveXEdition){var vJ=function(){var e,t,r,n,i;if(tr.DWT.lunload(),Qt.closeAll&&Qt.closeAll(),n=tr.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=tr.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()},_J=!1;tr.DWT.Unload=function(){vJ();try{tr.DWT.CloseDialog(),Qt._zdgb_xkz_dhk(),Qt.closeProgress(null,""),Qt.hideMask()}catch(HQ){}},tr.DWT.Load=function(){if(!Qt.product.bDWTLoading)return Qt.product.bDWTLoading=true,Qt.detect.axAutoLoadDone=!1,mJ().then(aJ).then(vJ).then(function(){return tr.DWT._innerLoad()}).then(function(){Qt.product.bDWTLoading=!1,Qt.detect.axAutoLoadDone=!0},function(e){Qt.product.bDWTLoading=!1,Qt.detect.axAutoLoadDone=!1,Md(e)})},tr.DWT.ConnectToTheService=tr.DWT.Load,tr.DWT.CheckConnectToTheService=function(e,t,r,n,i){Qt.product.bActiveXEdition?Qt.isFunction(i)&&i():Qt.isFunction(n)&&n()},tr.DWT.CreateDWTObject=function(e,t,r,n,i,o){return Qt._safePromptCustomMsg(function(){o&&o(Gi)}),_J},tr.DWT.CreateDWTObjectEx=function(e,t,r){return Qt._safePromptCustomMsg(function(){r&&r(Gi)}),_J},tr.DWT.CreateRemoteScanObjectAsync=function(){var e={};return oa(e,-2433,"The ActiveX edition does not support this method or property."),Qt.Promise.reject({code:e._errorCode,message:e._errorString})},tr.DWT.DeleteDWTObject=function(e){return _J}}function yJ(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 SJ(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")}tr.DWT.GetWebTwain=tr.DWT.GetWebTwainEx=function(e){var t=e,r=tr.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=tr.DWT.ContainerMap;return t in i?i[t]:void 0};var IJ=new WeakSet,bJ=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 yJ(e=i(this,t,[].concat(n)),IJ),e}return f(t,e),s(t,[{key:"SetCookie",value:function(e){return this._cookie=e,document.cookie=e,di}},{key:"LoadImageFromBase64Binary",value:function(e,t,r,n){var i=this,o=!1;if(Xt.isFunction(r)&&(o=!0),i._resetErr(),!i._isValid())return Xt.isFunction(n)&&zh(n,i),!!o&&void 0;if(!e)return $a(i),Xt.isFunction(n)&&zh(n,i),!!o&&void 0;var a,s,u,c,l,d=e,f="LoadImageFromBase64Binary",h=t,g=1;if(d instanceof nz&&Xt.isFunction(d.getLength)&&Xt.isFunction(d.getData)&&(d=d.getData(0,d.getLength())),Xt.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=Xt.base64.decode(m,!0);u=p,c=tr.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!=tr.DWT.EnumDWT_ImageType.IT_BMP&&h!=tr.DWT.EnumDWT_ImageType.IT_JPG&&h!=tr.DWT.EnumDWT_ImageType.IT_TIF&&h!=tr.DWT.EnumDWT_ImageType.IT_PNG&&h!=tr.DWT.EnumDWT_ImageType.IT_PDF&&h!=tr.DWT.EnumDWT_ImageType.IT_J2K&&(h=-1),!Zc.checkProductKey(i,{Core:!0}))return Xt.isFunction(n)&&zh(n,i),!!o&&void 0;if(!Zc.checkPDFProductKeyWhenNeeds(i,h))return Xt.isFunction(n)&&zh(n,i),!!o&&void 0;if(Xt.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,Zl(d,h,s,g),g,v,_))&&i.__OnPostLoad&&!i.__bServerOnPostLoadFired&&setTimeout(function(){i.__bServerOnPostLoadFired||i.__OnPostLoad("","",""+h)},10),a}Qt.cancelFrom=jH.LoadImage,i.IfShowProgressBar?Qt.showProgress(i,f,i.__IfShowCancelDialogWhenImageTransfer):Qt.hideProgress(),i.__bLoadingImage=!0,g=0,i._innerSend(f,Zl(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()&&tr.DWT.lcvrf(i),r&&r(d,t)},function(){Qt.closeProgress(null,f),i.__bLoadingImage=!1,Xt.isFunction(n)&&n(i._errorCode,i._getErrorString(),d,t)})}},{key:"SaveSelectedImagesToBytes",value:function(e,t){return ma(this),li}},{key:"LoadImageFromBytes",value:function(e,t,r){return ma(this),li}},{key:"SetImageWidth",value:function(e,t,r,n){var i,o=this,a=!1;if(Xt.isFunction(r)&&(a=!0),o._resetErr(),!o._isValid())return!!a&&void 0;var s=parseInt(e);if(isNaN(s))return ca(o),Xt.isFunction(n)&&n(o._errorCode,o._getErrorString()),!!a&&void 0;if(s<0||s>=o._ImgManager.count())return Va(o),Xt.isFunction(n)&&n(o._errorCode,o._getErrorString()),!!a&&void 0;if(Xt.isUndefined(t))return $a(o),Xt.isFunction(n)&&n(o._errorCode,o._getErrorString()),!!a&&void 0;var u=o._ImgManager.convertClientIndexToServerId(s);return-1==u?(Va(o),Xt.isFunction(n)&&n(o._errorCode,o._getErrorString()),!!a&&void 0):((i=1==o._innerFun("SetImageWidth",Zl(u,t)))?Xt.isFunction(r)&&r():Xt.isFunction(n)&&n(o._errorCode,o._getErrorString()),a?void 0:i)}},{key:"HTTPDownloadStreamThroughPost",value:function(e,t){return ma(this),li}},{key:"HTTPUploadStreamThroughPost",value:function(e,t,r,n,i){return ma(this),li}},{key:"HTTPUploadThroughPutDirectly",value:function(e,t,r,n,i){return ma(this),!1}},{key:"SetCustomDSDataEx",value:function(e){return this._resetErr(),!!this._isValid()&&this._innerFun("SetCustomDSDataEx",Zl(e))}},{key:"SetCustomDSData",value:function(e){if(this._resetErr(),!this._isValid())return!1;var t=Wh.replaceLocalFilename(e);return this._innerFun("SetCustomDSData",Zl(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=Wh.replaceLocalFilename(e);return t._innerFun("GetCustomDSData",Zl(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(Xt.isFunction(t)&&(i=!0),n._resetErr(),!n._isValid())return!!i&&void 0;if(!Zc.checkProductKey(n,{Core:!0}))return Xt.isFunction(r)&&r(n._errorCode,n._getErrorString()),!!i&&void 0;var o=parseInt(e);if(isNaN(o))return ca(n),Xt.isFunction(r)&&r(n._errorCode,n._getErrorString()),!!i&&void 0;if(o<0||o>=n._ImgManager.count())return Va(n),Xt.isFunction(r)&&r(n._errorCode,n._getErrorString()),!!i&&void 0;var a=n._ImgManager.convertClientIndexToServerId(o);if(-1==a)return Va(n),!1;var s=n._innerFun("ConvertToBW",Zl(a));return s?Xt.isFunction(t)&&t():Xt.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;if(!Xt.isFunction(t))return $a(o),!1;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),Xt.isFunction(t)&&(o.IfShowProgressBar&&Qt.closeProgress(null,a),t())},function(e,n){Qt.progressContext&&(Qt.progressContext.IfShowCancelDialogWhenImageTransfer=u),Xt.isFunction(t)&&o.IfShowProgressBar&&Qt.closeProgress(null,a),Xt.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 ca(i),!1;if(n<0||n>=i._ImgManager.count())return Va(i),!1;var o=i._ImgManager.convertClientIndexToServerId(n);return-1==o?(Va(i),!1):i._innerFun("ChangeBitDepth",Zl(o,t,r))}},{key:"ConvertToGrayScale",value:function(e,t,r){var n,i=this,o=!1;if(Xt.isFunction(t)&&(o=!0),i._resetErr(),!i._isValid())return!!o&&void 0;var a=parseInt(e);if(isNaN(a))return ca(i),Xt.isFunction(r)&&r(i._errorCode,i._getErrorString()),!!o&&void 0;if(a<0||a>=i._ImgManager.count())return Va(i),Xt.isFunction(r)&&r(i._errorCode,i._getErrorString()),!!o&&void 0;var s=i._ImgManager.convertClientIndexToServerId(a);return-1==s?(Va(i),Xt.isFunction(r)&&r(i._errorCode,i._getErrorString()),!!o&&void 0):((n=1==i._innerFun("ConvertToGrayScale",Zl(s)))?(Wh.refreshImageAfterInvokeFun(i,a),Xt.isFunction(t)&&t()):Xt.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(Xt.isUndefined(e)||Xt.isUndefined(t))return $a(n),!1;var i,o=1*e;if(i=Xt.isString(t)?Xt.replaceAll(t,'"','\\"'):t,o<=0||o>2147483647)return oa(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){oa(e,-2428,"Tiff tag count has exceeded the limit.")}(n),!1):n._innerFun("SetTiffCustomTag",Zl(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 ca(r),!1;if(t<0||t>=r._ImgManager.count())return Va(r),!1;var n=r._ImgManager.convertClientIndexToServerId(t);return-1==n?(Va(r),!1):r._innerFun("IsBlankImage",Zl(n,li))}},{key:"IsBlankImageExpress",value:function(e){var t=this;if(t._resetErr(),!t._isValid())return!1;var r=parseInt(e);if(isNaN(r))return ca(t),!1;if(r<0||r>=t._ImgManager.count())return Va(t),!1;var n=t._ImgManager.convertClientIndexToServerId(r);return-1==n?(Va(t),!1):t._innerFun("IsBlankImage",Zl(n,di))}},{key:"SetOpenSourceTimeout",value:function(e){var t=this;return t._resetErr(),!!t._isValid()&&t._innerFun("SetOpenSourceTimeout",Zl(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=e,l=parseInt(t),d=parseInt(r);if(n?(a="",s="dwt://"):(a=o._httpUrl,s="dwt/"),u=[a,s,o._bScanForProxyRemote?o._dmServiceDWTVersion:[Qo.getDWTPrefix(),Qo.getServerVersionInfo()].join(""),"/img?id=",o._clientId],Xt.isUndefined(c)||null===c)return ja(o),"";if(i)u.push("&index=-1&width=-1&height=-1&webcam="),u.push(i),de.bIE||u.push("&type=6000");else{if(c=parseInt(c),isNaN(c))return ca(o),"";if(c<-1||c>=o._ImgManager.count())return Va(o),"";var f=o._ImgManager.convertClientIndexToServerId(c);if(-1==f)return"";u.push("&index="),u.push(f),l>0&&d>0?(u.push("&width="),u.push(l),u.push("&height="),u.push(d)):u.push("&width=-1&height=-1"),Lo.bMobile&&u.push("&type=1&quality=85")}if(u.push("&t="),u.push((new Date).getTime()),u=u.join(""),de.bFileSystem&&!i&&u.indexOf("dwt://")<0){var h=new Image;h.crossOrigin="anonymous",h.src=u,h=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)?(ca(n),""):i<0||i>=n._ImgManager.count()?(Va(n),""):this.GetImageURL(i,t,r,!0)}},{key:"SetLanguage",value:function(e){var t=this;return t._resetErr(),!!t._isValid()&&t._innerFun("SetLanguageForSecurity",Zl(e))}},{key:"GetLicenseInfo",value:function(e,t){var r=this;if(r.__licenseInfo)Xt.isFunction(e)&&e(r.__licenseInfo);else{r._innerFunRaw("GetLicenseInfo",Zl(0),di,li,di,function(n){n?n.exception?Xt.isFunction(t)&&t(n.exception):(Xt.isArray(n.result)&&n.result.length>0&&Rd(r,n.result[0]),Xt.isFunction(e)&&e(r.__licenseInfo)):Xt.isFunction(t)&&t()},t)}}},{key:"SetProductKeyAsync",value:function(e){return this._setProductKeyAsync(e)}},{key:"GetVersionInfoAsync",value:function(){return ui.Promise.resolve(qo.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",Zl(!0),!0,function(){},function(){}),!0}return t._ImagePrint&&t._ImagePrint.Print(),!0}},{key:"PrintEx",value:function(e,t){var r=this;if(r._resetErr(),!r._isValid())return!1;if(!r._checkIndices(e))return!1;if(r._isNoViewer())return r._nouiNotSupport("Print");if(t&&t.mode&&"os"==t.mode.toLowerCase()){if(de.bMac||de.bLinux)return oa(r,-2910,"The OS print functionality is not supported on the current operating system."),!1;var n=!0;Xt.isUndefined(t.osPrintOptions)||Xt.isUndefined(t.osPrintOptions.showPrintDialog)||(n=t.osPrintOptions.showPrintDialog);var i=[];return Xt.each(e,function(e){var t=r._ImgManager.convertClientIndexToServerId(e);i.push(t)}),r._innerSend("PrintEx",Zl(n,i.join(",")),!0,function(){},function(){}),!0}return r._ImagePrint&&r._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:return r=this,i={minBlockHeight:20,maxBlockHeight:30},t&&(Xt.isNumber(t.minBlockHeight)&&t.minBlockHeight>=0&&(i.minBlockHeight=t.minBlockHeight),Xt.isNumber(t.maxBlockHeight)&&t.maxBlockHeight>=0&&(i.maxBlockHeight=t.maxBlockHeight)),n={command:"isBlankImage",parameter:{index:e,minHeight:i.minBlockHeight,maxHeight:i.maxBlockHeight}},a.next=6,r.RunCommandAsync(n);case 6:if(!((o=a.sent)&&Qt.isArray(o.result)&&o.result.length>0)){a.next=9;break}return a.abrupt("return",o.result[0]);case 9:return a.abrupt("return",!1);case 10: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=VH.Text;if(i._resetErr(),!i._isValid())return Qt.Promise.reject({code:i._errorCode,message:i._errorString});if(Xt.isUndefined(e)||""===e)return ka(i),Qt.Promise.reject({code:i._errorCode,message:i._errorString});if(!Xt.isString(e))return za(i),Qt.Promise.reject({code:i._errorCode,message:i._errorString});if(!(a instanceof Blob))return $a(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 oa(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,Xt.each(n.formFields,function(e,t){var r=e.name,n=e.value;Xt.isString(r)&&(n instanceof Blob?u.append(r,n,e.fileName):u.append(r,n))}),c={},Xt.each(n.headers,function(e,t){Xt.isString(e.name)&&(c[e.name]=e.value)}),n.responseType&&(l=n.responseType));var f=i._createHttpUploaderConfig(),h=new ZH,g=new $H;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(!Xt.isString(e)&&null!==e&&e!==undefined){s.next=8;break}s.next=10;break;case 8:case 23:throw $a(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 Hs(r),{code:r._errorCode,message:r._errorString};case 18:return s.next=20,Rz(t);case 20:o=s.sent,s.next=25;break;case 25:return i||(i=""),i=Wh.replaceLocalFilename(i),n=Zl(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!==SJ(IJ,this,TJ).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(Xt.isArray(n)&&n.length>0){var i=n[0];i&&Xt.isString(i.uid)&&e(i.uid)}else xs(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!=SJ(IJ,t,CJ).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,Zl(e),!1,function(e){if(Xt.isArray(e)&&e.length>0){var r=e[0];(Xt.isBoolean(r)||Xt.isNumber(r))&&n(!!r)}else xs(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(Xt.isObject(e)){o.next=7;break}throw $a(t),{code:t._errorCode,message:t._errorString};case 7:if(!1!==SJ(IJ,t,CJ).call(t,e.uid)&&!1!==SJ(IJ,this,TJ).call(this,e.password)){o.next=9;break}throw{code:t._errorCode,message:t._errorString};case 9:if(!Xt.isUndefined(e.indices)){o.next=13;break}e.indices=jh(t),o.next=20;break;case 13:if(!Xt.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=Gh(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(Xt.isArray(r)&&r.length>0){var n=r[0];n&&n.imageIds&&e(n.imageIds)}else xs(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(Xt.isObject(e)){a.next=7;break}throw $a(t),{code:t._errorCode,message:t._errorString};case 7:if(!1!==SJ(IJ,t,CJ).call(t,e.uid)&&!1!==SJ(IJ,this,TJ).call(this,e.password)){a.next=9;break}throw{code:t._errorCode,message:t._errorString};case 9:return(o=Xt.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),Xt.isArray(n)&&n.length>0?(o=n[0])&&o.mapImageIds&&e(o.mapImageIds):(!1===o&&0!=t._errorCode||xs(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(Xt.isObject(e)){o.next=7;break}throw $a(t),{code:t._errorCode,message:t._errorString};case 7:if(!1!==SJ(IJ,t,CJ).call(t,e.uid)&&!1!==SJ(IJ,this,TJ).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(Xt.isArray(r)&&r.length>0){var n=r[0];(Xt.isBoolean(n)||Xt.isNumber(n))&&e(!!n)}else xs(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}(Nz);function TJ(e){if(!Xt.isUndefined(e)){if(!Xt.isString(e))return oa(this,-2850,"The password is not a string."),!1;if(e.length>32)return function(e){oa(e,-2849,"The password must not exceed 32 characters in length.")}(this),!1}return!0}function CJ(e){return Xt.isUndefined(e)||""==e?(oa(this,-2846,"The uid cannot be empty."),!1):!!Xt.isString(e)||(function(e){oa(e,-2847,"The uid is invalid.")}(this),!1)}function wJ(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!Xt.isNumber(n)||isNaN(n)?(la(e),li):(e._resetErr(),!!e._isValid()&&e._innerFun(t,Zl(n)))}:2==n?function(r){return Xt.isBoolean(r)?(e._resetErr(),!!e._isValid()&&e._innerFun(t,Zl(r))):(la(e),li)}:function(r){return Xt.isString(r)?(e._resetErr(),!!e._isValid()&&e._innerFun(t,Zl(r))):(la(e),li)})),i.get||(i.get=function(){return e._resetErr(),!!e._isValid()&&e._innerFun(t)}),t in e||Object.defineProperty(e,t,i)}function kJ(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 EJ(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 xJ(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 AJ=new WeakSet,PJ=function(){return s(function r(e,t,n,i){o(this,r),kJ(this,AJ),EJ(this,"serverUrl",undefined),this.serverUrl=e,this.bLocal=ta(e),this.clientId=null!=n?n:Xt.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(Xt.isObject(e)&&e.exception&&0!=e.exception)throw{code:e.exception,message:null!==(t=e.description)&&void 0!==t?t:"general error"};if(e&&Xt.isArray(e.result)&&e.result.length>0){var r=e.result[e.result.length-1];try{return JSON.parse(r)}catch(TH){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(!tr.DWT.ConnectWithSocket){i.next=12;break}return i.next=3,xJ(AJ,this,DJ).call(this);case 3:return n=i.sent,o=0,e&&(o=e.cmdId),a={client:n,userData:{command:e},taskId:o},s=OJ,i.next=9,n.request(Xt.stringify(e),s,a);case 9:return u=i.sent,Xt.isString(u)&&(u=Xt.parse(u)),i.abrupt("return",u);case 12:return c=[cc(),"/",e.method].join(""),t&&(d=t),f=(h=this).serverUrl?qd.getDDMUrl(h.serverUrl,h.bGlobal,[sc,e.method].join("")):qd.getModuleUrlForRemoteScan(c),i.prev=16,i.next=19,nu(f,{method:"post",dataType:"json",body:Xt.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 DJ(){return FJ.apply(this,arguments)}function FJ(){return(FJ=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,r=de.bSSL,t._wsClient){e.next=10;break}return n=new au,(i=this.serverUrl)?(a="/",o=r?"ddm/"+tr.dcp.SSLPort+"/":"ddm/"+tr.dcp.Port+"/",Xt.endsWith(i,"/")&&(a=""),Xt.startsWith(i,"https://")||Xt.startsWith(i,"wss://")?(n.ssl=!0,s=Xt.startsWith(i,"https://")?Xt.replaceAll(i,"https://",""):Xt.replaceAll(i,"wss://",""),i=s+a+o):Xt.startsWith(i,"http://")||Xt.startsWith(i,"ws://")?(n.ssl=!1,u=Xt.startsWith(i,"http://")?Xt.replaceAll(i,"http://",""):Xt.replaceAll(i,"ws://",""),i=u+a+o):(n.ssl=r,n.port=n.ssl?Ho.SSLPort:Ho.Port),n.server=i):(n.ssl=r,n.server=To(),n.port=n.ssl?Ho.SSLPort:Ho.Port),n.useWS=!0,n.protocol=Ho.wsProtocol,c=ec.Instance.getClient(n),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)}EJ(PJ,"logLevel",-1);var WJ=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:"getServices",value:(r=n(g().mark(function a(e,t,r,n){var i,o,s,c,l,d,f,h,m,p,v,_,y;return g().wrap(function(a){for(;;)switch(a.prev=a.next){case 0:return r=null!=r&&r,n=null!=n?n:30,i={id:this.clientId,cmdId:Xt.guid(),method:"SearchScanner",parameter:[1,"_privet._tcp.local.",!1,!0,r,n,e,t],version:uc},a.prev=5,a.next=8,this._requestAsync(i,3e4,!1);case 8:o=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(s={}),{code:s._errorCode,message:s._errorString};case 18:throw ls();case 19:c=[],l=this.parseResultDefault(o),d=u(l),a.prev=22,d.s();case 24:if((f=d.n()).done){a.next=40;break}if(!((h=f.value).service_type&&h.service_type==Yd.ST_UNKNOWN||h.type&&"dynamsoft_private_cloud_scan"!=h.type&&"twaindirect"!=h.type)){a.next=30;break}return a.abrupt("continue",38);case 30:if(!h.service_type){a.next=38;break}a.t1=h.service_type,a.next=a.t1===Yd.ST_DYNAMSOFT_SERVICE?34:38;break;case 34:return(m=h.modules)&&Xt.isArray(m)&&Xt.isString(m[0])&&(p=m[0].split(",")).length>=3&&(p[0]>=1&&p[1]>=9||p[0]>=1&&p[1]>=8&&p[2]>0)&&(h.bGlobalFind=!0,v=NJ(this.serverUrl,h),c.push(v)),h.bGlobalFind||(y=null!==(_=null==h?void 0:h.ty)&&void 0!==_?_:"",Xt.warn(["The Dynamic Web TWAIN Service on [",y,"] 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),d.e(a.t2);case 45:return a.prev=45,d.f(),a.finish(45);case 48:return a.abrupt("return",c);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:Xt.guid(),method:"dispose",version:uc};this._requestAsync(e,500)}}]);var r}(PJ);function NJ(e,t){var r=new Gd;return r.server=e,r.attrs=t,r}function OJ(e,t,r,n){return RJ.apply(this,arguments)}function RJ(){return RJ=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!=pu.GET_TASKID){e.next=4;break}return e.abrupt("return",i.taskId);case 4:if(r!=pu.ONMESSAGE_PROCESS_DATA){e.next=8;break}return e.abrupt("return",Xt.parse(t));case 8:if(r!=pu.ONMESSAGE_GET_TASKID){e.next=15;break}if(!t||!t.cmdId){e.next=11;break}return e.abrupt("return",t.cmdId);case 11:if(!i||!i.client){e.next=13;break}return e.abrupt("return",i.client.getRequestTaskId());case 13:e.next=23;break;case 15:if(r!=pu.HANDLE_RAW_MESSAGE){e.next=23;break}if(a=t.rawData,t.jsonData,o=null==i?void 0:i.userData){e.next=21;break}return e.abrupt("return",!1);case 21:return a.indexOf("Version not found")>=0||a.indexOf("Function not found")>=0?Xt.isFunction(o.fFun)&&o.fFun():Xt.isFunction(o.sFun)&&o.sFun(a),e.abrupt("return",a);case 23:case"end":return e.stop()}},e)})),RJ.apply(this,arguments)}function MJ(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 LJ(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 BJ(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 UJ(e){var t,r=Yd.ST_UNKNOWN;return e==ed.ESCLSCANNER?r=Yd.ST_ESCL:e==ed.WIFIDIRECTSCANNER?r=Yd.ST_WIFI_DIRECT:((t=e)==ed.TWAINSCANNER||t==ed.WIATWAINSCANNER||t==ed.TWAINX64SCANNER||t==ed.ICASCANNER||t==ed.SANESCANNER)&&(r=Yd.ST_DYNAMSOFT_SERVICE),r}var VJ=new WeakSet,jJ=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 LJ(e=i(this,t,[].concat(n)),VJ),MJ(e,"_bInited",!1),MJ(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;return g().wrap(function(g){for(;;)switch(g.prev=g.next){case 0:if(n="",i=!1,o=[],a=!1,((s=null!=e?e:id)&ed.ESCLSCANNER)==ed.ESCLSCANNER&&(n="_uscan._tcp.local."),(s&ed.WIFIDIRECTSCANNER)==ed.WIFIDIRECTSCANNER&&(i=!0),0!=n.length||i){g.next=9;break}return g.abrupt("return",[]);case 9:return t=null!=t&&t,r=null!=r?r:30,c={id:this.clientId,cmdId:Xt.guid(),method:"SearchScanner",parameter:[1,n,i,a,t,r],version:uc},g.next=14,this._requestAsync(c,3e4,!1);case 14:if(l=g.sent,this._bInited=!0,d=this.parseResultDefault(l),Xt.isArray(d)){g.next=19;break}throw gs();case 19:f=u(d),g.prev=20,f.s();case 22:if((h=f.n()).done){g.next=48;break}if(!((m=h.value).service_type&&m.service_type==Yd.ST_UNKNOWN||m.type&&"dynamsoft_private_cloud_scan"!=m.type&&"twaindirect"!=m.type)){g.next=28;break}return g.abrupt("continue",46);case 28:if(!m.service_type){g.next=46;break}g.t0=m.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(p=new Zd).name="",p.displayName="",p.deviceType=0,p.isSystemDefaultPrinter=!1,m.service_type==Yd.ST_ESCL?p.deviceType=ed.ESCLSCANNER:m.service_type==Yd.ST_WIFI_DIRECT&&(p.deviceType=ed.WIFIDIRECTSCANNER),p.name=m.ty,m.hostname&&m.hostname.length>m.ty.length&&(p.name=m.hostname),p.displayName=(m.service_type==Yd.ST_ESCL?"eSCL-":"")+p.name,this.bGlobal||(m.url=this.serverUrl,this.serverName&&(p.displayName=p.displayName+" on ["+this.serverName+"]")),p.serviceInfo=NJ(this.serverUrl,m),o.push(p),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),f.e(g.t1);case 53:return g.prev=53,f.f(),g.finish(53);case 56:return g.abrupt("return",o);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&ed.ESCLSCANNER)!=ed.ESCLSCANNER&&(e.deviceType&ed.WIFIDIRECTSCANNER)!=ed.WIFIDIRECTSCANNER||(this._currentDevice=e),t=UJ(e.deviceType),r={id:this.clientId,cmdId:Xt.guid(),method:"SendRequestToScanner",parameter:["getCapabilities",Xt.stringify({UUID:e.serviceInfo.attrs.UUID,service_type:t,ty:e.name})],version:uc},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:Xt.guid(),method:"VersionInfo",version:uc},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",BJ(VJ,this,GJ).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",BJ(VJ,this,GJ).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;return g().wrap(function(r){for(;;)switch(r.prev=r.next){case 0:e=null!=e?e:this._currentDevice,this.checkSource(e),this._currentDevice=e,n=UJ(e.deviceType),i=["scan",Xt.stringify({UUID:e.serviceInfo.attrs.UUID,service_type:n})],o=BJ(VJ,this,zJ).call(this,t),i[2]=Xt.stringify(o),a={id:this.clientId,cmdId:Xt.guid(),method:"SendRequestToScanner",parameter:i,version:uc},s=0;case 9:if(!(s<5)){r.next=32;break}return r.prev=10,r.next=13,this._requestAsync(a,0);case 13:return c=r.sent,u=this.parseResultDefault(c),Xt.isObject(u)&&(u.device=e,u.scanOptions=o),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(!(s>=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:s++,r.next=9;break;case 32:return r.abrupt("return",u);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,KJ(),i=null!=r?r:"",o={id:this.clientId,cmdId:Xt.guid(),method:"GetLicenseInfo",parameter:[e,t.logLevel,i,n],version:uc},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 ls();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}(WJ);function GJ(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;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!=n?n:{ver:"",clientId:""},(i=["getImage",Xt.stringify({UUID:t.device.serviceInfo.attrs.UUID,service_type:r})])[2]=Xt.stringify(t.scanOptions),i[3]=t.scanJobs,i[4]=t.scanId,i[5]=n._clientId,i[6]=n._ver,o={id:this.clientId,cmdId:Xt.guid(),method:"SendRequestToScanner",parameter:i,version:uc},e.next=12,this._requestAsync(o,0,!0);case 12:if(a=e.sent,!(a.headers.get("content-type").indexOf("image/")>=0)){e.next=20;break}return e.next=17,a.arrayBuffer();case 17:return e.abrupt("return",e.sent);case 20:return e.next=22,a.json();case 22:if(s=e.sent,"boolean"!=typeof(u=this.parseResultDefault(s))){e.next=28;break}return e.abrupt("return",null);case 28:return e.abrupt("return",u);case 29:case"end":return e.stop()}},e,this)}))).apply(this,arguments)}function zJ(e){var t=[];if(e){Xt.isNumber(e.PixelType)&&(t.push({capability:dK.ICAP_PIXELTYPE,curValue:e.PixelType}),tr.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:dK.ICAP_XRESOLUTION,curValue:r}),t.push({capability:dK.ICAP_YRESOLUTION,curValue:r}),e.Brightness!==undefined&&t.push({capability:dK.ICAP_BRIGHTNESS,curValue:e.Brightness}),e.XferCount!==undefined&&t.push({capability:dK.CAP_XFERCOUNT,curValue:e.XferCount}),e.Contrast!==undefined&&t.push({capability:dK.ICAP_CONTRAST,curValue:e.Contrast}),e.TransferMode!==undefined&&t.push({capability:dK.ICAP_XFERMECH,curValue:e.TransferMode}),e.IfFeederEnabled!==undefined&&t.push({capability:dK.CAP_FEEDERENABLED,curValue:e.IfFeederEnabled?1:0}),e.IfDuplexEnabled!==undefined&&t.push({capability:dK.CAP_DUPLEXENABLED,curValue:e.IfDuplexEnabled?1:0})}return t}function KJ(){var e=jJ.logLevel;Xt.isNumber(e)||(jJ.logLevel=-1)}Qt.removeNonPrintableChar;var JJ=function(e,t,r){2==r&&Xt.each(t,function(t,r){uz(e,t,{get:function(){return e._resetErr(),e._isValid()?di:li},set:function(t){return e._resetErr(),e._isValid()?di:li}})})},QJ=function(e,t){Xt.each(t,function(t,r){wJ(e,t,1,2)})},qJ=function(e,t){Xt.each(t,function(t,r){wJ(e,t,1,1)})},YJ=function(e,t){Xt.each(t,function(t,r){wJ(e,t,0)})},XJ=function(e,t){Xt.each(t,function(t,r){wJ(e,t,1)})};function ZJ(e){var t=e;if(!t._bRemoteMode){uz(t,"ProductKey",{get:function(){return tr.DWT.ProductKey},set:function(e){return Xt.isString(e)?(t._resetErr(),!!t._isValid()&&t._setProductKey(e,!1)):(la(t),li)}}),uz(t,"ProductName",{get:function(){return t.__strProductName}}),uz(t,"VersionInfo",{get:function(){return Io.JSVersion}}),uz(t,"DefaultSourceName",{get:function(){var e=t._getDefaultDevice();return e?e.displayName:""}}),uz(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==hc.enumWindow?i=!0:t.__serverPlatform==hc.enumLinux?n=!0:t.__serverPlatform==hc.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<Fh.TWAIN||o>Fh.TWAIN64)return Qa(t),li;if(i){if(o===Fh.TWAIN_AND_TWAIN64)t._b64bit&&(t._driverType=o);else if(o!=Fh.TWAIN&&o!=Fh.TWAIN64)return Qa(t),li;t._b64bit||(o=Fh.TWAIN),t._driverType=o,a=!0}else if(n)o=Fh.SANE,t._driverType=o,a=!0;else if(r){if(o===Fh.TWAIN_AND_ICA);else if(o!=Fh.ICA&&o!=Fh.TWAIN&&o!=Fh.TWAIN64)return Qa(t),li;t._driverType=o,a=!0}return a&&(t._curDevice=null,t.__devices=null),!0}return Qa(t),li}}),uz(t,"HTTPPostResponseString",{get:function(){return t._resetErr(),t._isValid()&&t.__HTTPPostResponseString?t.__HTTPPostResponseString:""}}),uz(t,"IfAppendImage",{get:function(){return t._resetErr(),!!t._isValid()&&t.__IfAppendImage},set:function(e){return t._resetErr(),!!t._isValid()&&(Xt.isBoolean(e)?t.__IfAppendImage=e:(la(t),li))}}),uz(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",Zl(r))}}}),uz(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",Zl(r))}}),wJ(t,"TIFFCompressionType",1,1),wJ(t,"BufferMemoryLimit",1,1),uz(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,jJ.logLevel=t._logLevel,t._innerFun("LogLevel",Zl(r))}}),uz(t,"HttpContentTypeFieldValue",{get:function(){return t._resetErr(),t._isValid()?t._strHttpContentTypeFieldValue:""},set:function(e){return t._resetErr(),!!t._isValid()&&(t._strHttpContentTypeFieldValue=e,e)}}),uz(t,"BrokerProcessType",{get:function(){return t._resetErr(),t._isValid()?1:0},set:function(e){return t._resetErr(),!!t._isValid()}}),uz(t,"BorderStyle",{get:function(){return t._resetErr(),!!t._isValid()&&0},set:function(e){return t._resetErr(),t._isValid(),!1}}),uz(t,"HttpFieldNameOfUploadedImage",{get:function(){return t._resetErr(),t._isValid()?t.__remoteFilename:""},set:function(e){return t._resetErr(),t._isValid()?t.__remoteFilename=e:""}}),uz(t,"style",{get:function(){return t._isValid()?t.__style:""}}),uz(t,"ScaleDownThreshold",{get:function(){return t._resetErr(),t._isValid()?t._scaleDownThreshold:0},set:function(e){var r=1*e;return!Xt.isNumber(r)||isNaN(r)?(la(self),li):(t._resetErr(),!!t._isValid()&&(t._scaleDownThreshold=e))}}),uz(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()&&sz.__innerRefreshFromUIView(t,t._ImgManager.getCurrentImageIndex())),!0)}}),uz(t,"SelectedImagesIndices",{get:function(){return t._resetErr(),t._isValid()?t._ImgManager.count()<=0?[]:t._ImgManager.getSelectedClientIndexArray():[]}}),uz(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:oa(t,-1010,"Data parameter out of supported range."),t.__maxImagesInBuffer)}}),uz(t,"IfSSL",{get:function(){return t._bSSL},set:function(e){return t._bSSL=e,t._innerFun("IfSSL",Zl(e)),!0}}),wJ(t,"IfAllowLocalCache",1,2),uz(t,"UseLocalService",{get:function(){return!0}}),uz(t,"PDFCompressionType",{get:function(){return t._resetErr(),!!t._isValid()&&t._innerFun("PDFCompressionType")},set:function(e){var r=1*e;return r==tr.DWT.EnumDWT_PDFCompressionType.PDF_FAX3&&(r=tr.DWT.EnumDWT_PDFCompressionType.PDF_FAX4),t._resetErr(),!!t._isValid()&&t._innerFun("PDFCompressionType",Zl(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=Zc.checkProductKey(t,{Core:!0})),Xt.isFunction(n)&&n(),r};if(t._resetErr(),!t._isValid())return!1;if(Qo.bUseDynamsoftLicenseManager||t._blts)return Zs(t),!1;if(a=Xt.isString(a)?Xt.trim(a):"",tr.DWT.ProductKey=a,""==a)o=!1,s();else{Zc.reparseProductKey();var u=tr.DWT.licenseException;if(0!=u.code)return t.__licenseInfo=undefined,t._errorCode=u.code,t._errorString=u.message,Xt.isFunction(n)&&n(),!1;t._innerFunRaw("ProductKey",Zl(a),r,!1,!1,function(e){var n=!1;n=Xt.isArray(e)?e[0]:e,Xt.isArray(e)&&e.length>=3&&"1"===e[1]&&Xt.isFunction(tr.DWT.ShowMessage)&&tr.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},XJ(t,["ProxyServer"]);XJ(t,["CapValueString","CapDescription","FTPPassword","FTPUserName","PDFAuthor","PDFCreationDate","PDFCreator","PDFKeywords","PDFModifiedDate","PDFProducer","PDFSubject","PDFTitle","PDFVersion"]),YJ(t,["Manufacturer","ProductFamily","ImageBitsPerPixel","ImageLength","ImageWidth","ImageXResolution","ImageYResolution"]);YJ(t,["BlankImageCurrentStdDev","CapDefaultIndex","CapDefaultValue","DataSourceStatus","Duplex","PendingXfers","ImageLayoutDocumentNumber","ImageLayoutFrameBottom","ImageLayoutFrameLeft","ImageLayoutFrameNumber","ImageLayoutFrameRight","ImageLayoutFrameTop","ImageLayoutPageNumber","ImagePixelType","MagData","MagType","IfFeederLoaded","IfPaperDetectable","IfUIControllable"]),QJ(t,["AllowPluginAuthentication","IfModalUI","IfScanInNewThread","_AutoCropMethod","IfSortBySelectionOrder"]);QJ(t,["IfDisableSourceAfterAcquire","IfDuplexEnabled","IfFeederEnabled","IfPASVMode","IfAutoBright","IfAutoDiscardBlankpages","IfAutoFeed","IfAutomaticBorderDetection","IfAutomaticDeskew","IfAutoScan","IfShowIndicator","IfUseTwainDSM","IfTiffMultiPage"]),qJ(t,["MaxInternetTransferThreads"]);qJ(t,["BlankImageMaxStdDev","BlankImageThreshold","BitDepth","Brightness","PageSize","PixelType","Resolution","Capability","CapCurrentIndex","CapCurrentValue","CapMaxValue","CapMinValue","CapNumItems","CapStepSize","CapType","CapValue","CapValueType","Contrast","PixelFlavor","TransferMode","Unit","XferCount"]),JJ(t,["AsyncMode","EnableInteractiveZoom","IfThrowException","ImageEditorIfEnableEnumerator","ImageEditorIfReadonly","ImageEditorIfModal","ImageEditorWindowTitle","IfShowPrintUI","VScrollBar"],2);JJ(t,["IfOpenImageWithGDIPlus"])}}Qt.DynamicLoadAddonFuns=[],Qt.attachAddon=function(e){var t=!1;return Xt.each(Qt.DynamicLoadAddonFuns,function(r){Xt.isFunction(r)&&(r(e),t=!0)}),!qo.bFullEdition&&e.__addon&&delete e.__addon.Camera,t};var $J=s(function iq(e,t,r){o(this,iq),this.Url=e,this.Width=t,this.Height=r}),eQ=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))?(Va(n),!1):(t=Jl.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 tr.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=Xt.clone(i),s=a.width;(Xt.isUndefined(a.width)||a.width<=0)&&(a.width=n.getImageWidthFromServer(r));var u=a.height;(Xt.isUndefined(a.height)||a.height<=0)&&(a.height=n.getImageHeightFromServer(r));var c=new $J(e,a.width,a.height);return o.push(c),a.width=s,a.height=u,Jl.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 $J(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,!(tr.navInfoSync.bMac&&tr.navInfoSync.bSafari||tr.navInfoSync.bFirefox||tr.navInfoSync.bChrome)){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=Jl.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:Jl.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=ui.Promise.resolve(0),o=0;return Xt.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 ca(u),void _o(u._errorString)}r=$l(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&&Jl.print(t)})})}),!0}},{key:"__GetPrintUrlforMobileEx",value:function(e,t){var r,n=this,i=ui.Promise.resolve(0),o=0;return Xt.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 ca(u),void _o(u._errorString)}r=$l(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&&Jl.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))}},{key:"dispose",value:function(){this._stwain=null,this._ImgManager=null}}]);var e}();function tQ(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 rQ(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=di;var nQ=new WeakSet,iQ=function(e){function t(e){var r,n,a;return o(this,t),tQ(r=i(this,t,[e]),nQ),r._ImgManager=new Yz(r,r._imageBufferWrapper),r._imageBufferWrapper=r._ImgManager,r._ImagePrint=new eQ(r),n=e||{},r._config=n,r._destroying=li,r._iServiceType=UK.TwainService,r.__addon={},r._bNoMask=li,r._bNotShowMessage=li,r._bSelectedSourceByServer=li,r._bKeepAwake=li,r._bAx=li,n.container&&(r._containerElement=n.container),r.__IfShowCancelDialogWhenImageTransfer=di,r._errorCode=0,r._errorString="",r.__bLoadingImage=li,r.__bAcquireImageNow=li,r.__bOpenFileNow=li,r.__defaultSourceName="",r.__sourceCount=0,r._bConnecting=li,r.__licenseInfo=undefined,r.__strProductName=tr.DWT.ProductName,r.__productKey="",r._moduleSize=1048576,r._driverType=Fh.TWAIN,r.__maxUploadImageSize=-1,r._bServerPercentDone=di,r._bSSL=$o(),r._bRegistedLoad=!1,r._logLevel=0,r._scaleDownThreshold=0,r._pdfWriteSetting={},r.__serverPlatform=hc.enumUnknown,r._reconnectTimeSpan=qo.LocaleReconnectTimeSpan,r._bRemoteMode||(r.httpFormFields={},r.HTTPPassword="",r.HTTPPort=$o()?443:80,r.HTTPUserName="",r.__HTTPPostResponseString="",r.__remoteFilename="RemoteFile",r.__httpHeaderMap=li,r._b64bit?r._segementUploadThreshold=4294967296:r._segementUploadThreshold=524288e3,r._aryTiffTag=[],r._tiffCompressionType=tr.DWT.EnumDWT_TIFFCompressionType.TIFF_AUTO,r._jpgQuality=80,r._pdfConvertMode=3,r._pdfOptions={convertMode:bc.CM_AUTO,password:"",renderOptions:{renderAnnotations:!1,resolution:200,maxWidth:0,maxHeight:0,renderGrayscale:!1},preserveUnmodifiedOnSave:!1}),ZJ(r),uz(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)&&(a._width=e,!0))}}),uz(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)&&(a._height=e,!0))}}),uz(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))}}),uz(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))}}),uz(a,"BackgroundFillColor",{get:function(){if(a._resetErr(),!a._isValid())return"";if(a._isNoViewer())return a._nouiNotSupport("BackgroundFillColor"),"";var e=a._innerFun("BackgroundFillColor");return ci.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!Xt.isNumber(r)||Xt.isNaN(r)?(la(a),li):(t=ci.RGB2BGR(r),a._innerFun("BackgroundFillColor",Zl(t)))}}),uz(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)}}),uz(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))}}),uz(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)}}),uz(a,"MouseX",{get:function(){return a._resetErr(),a._isValid()?a._isNoViewer()?(a._nouiNotSupport("MouseX"),0):a.__MouseX:0}}),uz(a,"MouseY",{get:function(){return a._resetErr(),a._isValid()?a._isNoViewer()?(a._nouiNotSupport("MouseY"),0):a.__MouseY:0}}),uz(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))}}),uz(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))}}),uz(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))}}),uz(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)}}),uz(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))}}),uz(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:"dispose",value:(c=n(g().mark(function h(){return g().wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",this.__unload());case 1:case"end":return e.stop()}},h,this)})),function(){return c.apply(this,arguments)})},{key:"__unload",value:(u=n(g().mark(function m(){var e;return g().wrap(function(r){for(;;)switch(r.prev=r.next){case 0:return(e=this)._ImagePrint&&e._ImagePrint.dispose(),r.next=4,l(d(t.prototype),"__unload",this).call(this);case 4:e._ImagePrint=null,e.__OnTopImageInTheViewChanged=null,e.__CloseImageEditorUI=null,e._config=null;case 8:case"end":return r.stop()}},m,this)})),function(){return u.apply(this,arguments)})},{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 p(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 ld("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,dd("GetSourceNamesAsync"),r.finish(13);case 16:if(!e){r.next=20;break}return r.abrupt("return",rQ(nQ,t,oQ).call(t));case 20:return r.abrupt("return",rQ(nQ,t,aQ).call(t));case 21:case"end":return r.stop()}},p,this,[[5,10,13,16]])})),function(e){return a.apply(this,arguments)})},{key:"SelectSourceAsync",value:function(e){var t;return t=Uz.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()&&(Xt.isUndefined(r)&&(Xt.isFunction(e)&&Xt.isFunction(t)||Xt.isFunction(e)&&Xt.isUndefined(t)||Xt.isFunction(e)&&null==t||null==e&&Xt.isFunction(t))?(n={},Xt.isFunction(e)&&(o=e),Xt.isFunction(t)&&(a=function(e){e&&e.code&&(i._errorCode=e.code,i._errorString=e.message),t(i._errorCode,i._errorString)})):(n=Xt.isUndefined(e)||null==e?{}:Xt.clone(e),Xt.isFunction(t)&&(o=function(){t(n)}),Xt.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),!_h.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?rQ(nQ,t,oQ).call(t):rQ(nQ,t,aQ).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),!Xt.isUndefined(n)){if(!Xt.isArray(n))return $a(a),void(Xt.isFunction(o)&&o(a._errorCode,a._getErrorString()));if(Xt.isArray(n)&&n.indexOf(null)>=0)return $a(a),void(Xt.isFunction(o)&&o(a._errorCode,a._getErrorString()));if(Xt.isString(n)&&0==n.trim().length)return $a(a),void(Xt.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(),tr.DWT.ConnectWithSocket)return oa(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 fs(n),!1}var u=!1;try{(u=rQ(nQ,this,sQ).call(this,e.strDevice,t))&&(this._curDevice=e,this._bSelectedSourceByServer=!1)}catch(c){u=!1,this._errorCode=ua.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 $a(t),!1;if(null==t.__devices&&t.GetSourceNames(!1),r>=t.__devices.length||r<0)return Va(t),!1;var n,i,o,a=t.__devices[r];return n=a.deviceType,i=Fh.TWAIN,(o=n&nd)==ed.TWAINSCANNER||o==ed.WIATWAINSCANNER||(o==ed.TWAINX64SCANNER?i=Fh.TWAIN64:o==ed.ICASCANNER?i=Fh.ICA:o==ed.SANESCANNER?i=Fh.SANE:(o&ed.TWAINX64SCANNER)==ed.TWAINX64SCANNER?(o&ed.TWAINSCANNER)!=ed.TWAINSCANNER&&(o&ed.WIATWAINSCANNER)!=ed.WIATWAINSCANNER||(i=Fh.TWAIN_AND_TWAIN64):(o&ed.ICASCANNER)==ed.ICASCANNER&&((o&ed.TWAINSCANNER)!=ed.TWAINSCANNER&&(o&ed.WIATWAINSCANNER)!=ed.WIATWAINSCANNER||(i=Fh.TWAIN_AND_ICA))),i}},{key:"OpenSource",value:function(){var e=this;return e._resetErr(),!!e._isValid()&&(e._bRemoteMode?(oa(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(Xt.isFunction(e)&&(n=!0),r._resetErr(),!r._isValid())return!!n&&void 0;var i=Fh.TWAIN;if(!n){if(r._bRemoteMode)return oa(r,-2438,"SelectSource cannot be used synchronously when Object is created by CreateRemoteScanObjectAsync. Please use SelectSourceAsync instead."),!1;if(r._driverType==Fh.TWAIN_AND_TWAIN64)return function(e){oa(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!=Fh.ICA&&r._driverType!=Fh.SANE&&r._driverType!=Fh.TWAIN64||(i=r._driverType);var o=de.bMac,a=de.bLinux,s=Nh(i,de.bWin,a,o,de.bAndroid);return r._bSelectedSourceByServer=!0,r._curDevice=null,r._innerFun("SelectSource",Zl(s))}r._driverType!=Fh.ICA&&r._driverType!=Fh.SANE&&r._driverType!=Fh.TWAIN64&&r._driverType!=Fh.TWAIN_AND_TWAIN64||(i=r._driverType);var u=de.bMac,c=de.bLinux,l=Nh(i,de.bWin,c,u,de.bAndroid);r.SelectSourceAsync(l).then(function(){Xt.isFunction(e)&&e()},function(e){e&&e.code&&(r._errorCode=e.code,r._errorString=e.message),Xt.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=Wh.replaceLocalFilename(r),i._innerFun("SetFileXferInfo",Zl(n,t)))}},{key:"SetImageLayout",value:function(e,t,r,n){var i=this;return i._resetErr(),!!i._isValid()&&i._innerFun("SetImageLayout",Zl(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",Zl(e))}},{key:"CapGetFrameLeft",value:function(e){return this._resetErr(),!!this._isValid()&&this._innerFun("CapGetFrameLeft",Zl(e))}},{key:"CapGetFrameRight",value:function(e){return this._resetErr(),!!this._isValid()&&this._innerFun("CapGetFrameRight",Zl(e))}},{key:"CapGetFrameTop",value:function(e){return this._resetErr(),!!this._isValid()&&this._innerFun("CapGetFrameTop",Zl(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",Zl(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",Zl(e,t,r,n,i))}},{key:"GetCapItems",value:function(e){return this._resetErr(),!!this._isValid()&&this._innerFun("GetCapItems",Zl(e))}},{key:"GetCapItemsString",value:function(e){return this._resetErr(),!!this._isValid()&&this._innerFun("GetCapItemsString",Zl(e))}},{key:"SetCapItems",value:function(e,t){return this._resetErr(),!!this._isValid()&&this._innerFun("SetCapItems",Zl(e,t))}},{key:"SetCapItemsString",value:function(e,t){return this._resetErr(),!!this._isValid()&&this._innerFun("SetCapItemsString",Zl(e,t))}},{key:"GenerateURLForUploadData",value:function(e,t,r,n,i){var o=this,a=[];if(t==tr.DWT.EnumDWT_ImageType.IT_BMP||t==tr.DWT.EnumDWT_ImageType.IT_JPG||t==tr.DWT.EnumDWT_ImageType.IT_PNG){if(!Xt.isArray(e))return Ua(o),Xt.isFunction(n)&&n(o._errorCode,o._getErrorString(),"",e,t),"";if(e.length>1)return Ma(o),Xt.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!=tr.DWT.EnumDWT_ImageType.IT_TIF&&t!=tr.DWT.EnumDWT_ImageType.IT_PDF)return Xt.isArray(e)?Ga(o):Ua(o),Xt.isFunction(n)&&n(o._errorCode,o._getErrorString(),o.__HTTPPostResponseString,e,t),"";var u,c;if(Xt.isArray(e)){if(!o._checkIndices(e))return n(o._errorCode,o._getErrorString(),"",e,t),!1;u=e}else{if(-1!=e)return Ua(o),Xt.isFunction(n)&&n(o._errorCode,o._getErrorString(),o.__HTTPPostResponseString,e,t),"";for(u=[],c=0;c<o._ImgManager.count();c++)u.push(c)}Xt.each(u,function(e){var t=o._ImgManager.convertClientIndexToServerId(e);-1!=t&&a.push(t)})}if(Xt.isFunction(r)&&Xt.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=Ho.managerVersion.join(""),s=r,u=",";Xt.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))&&Xt.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 Xt.isArray(e)&&Xt.each(e,function(e){i._ImgManager.convertServerIdToClientIndex(e)}),0==o?(Ja(i),""):o}},{key:"_asyncGenerateURLForUploadData",value:function(e,t,r,n,i){var o=this,a=t,s=function(){if(Xt.isFunction(i)){var t=[];Xt.isArray(e)&&Xt.each(e,function(e){var r=o._ImgManager.convertServerIdToClientIndex(e);r>-1&&t.push(r)}),i(t)}return""},u=",";if(a==tr.DWT.EnumDWT_ImageType.IT_BMP||a==tr.DWT.EnumDWT_ImageType.IT_JPG||a==tr.DWT.EnumDWT_ImageType.IT_PNG){if(e.length>1)return Ma(o),s(),""}else if(a!=tr.DWT.EnumDWT_ImageType.IT_TIF&&a!=tr.DWT.EnumDWT_ImageType.IT_PDF)return Ga(o),s(),"";var c=!1,l=Ho.managerVersion.join(""),d=r;Xt.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&&Xt.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):Ja(o);else Ja(o);if(0==c)return s(),"";if(Xt.isFunction(n)){var a=[];Xt.isArray(e)&&Xt.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 $a(t),!1;if(null==t.__devices&&t.GetSourceNames(!1),r>=t.__devices.length||r<0)return Va(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 oa(r,-2381,"scanSetup is invalid."),!1;if(!Xt.isUndefined(t.transferMode)&&0!=e.transferMode&&1!=e.transferMode&&2!=e.transferMode)return function(e){oa(e,-2382,"Scanner setup error: Invalid Transfer Mode.")}(r),!1;if(e.transferMode==tr.DWT.EnumDWT_TransferMode.TWSX_FILE){if(!e.fileXfer)return function(e){oa(e,-2383,"Scanner setup error: fileXfer is invalid.")}(r),!1;if(!Xt.isString(e.fileXfer.fileName)||""==e.fileXfer.fileName)return function(e){oa(e,-2384,"Scanner setup error: Invalid fileName in fileXfer.")}(r),!1;if(!Xt.isNumber(e.fileXfer.fileFormat)||e.fileXfer.fileFormat<0||e.fileXfer.fileFormat>16)return function(e){oa(e,-2385,"Scanner setup error: Invalid fileFormat in fileXfer.")}(r),!1}if(t){if(!Xt.isString(t.type)||""==t.type)return function(e){oa(e,-2387,"Output setup error: Invalid type in outputSetup.")}(r),!1;if(!t.httpParams)return function(e){oa(e,-2386,"Output setup error: Invalid httpParams in outputSetup.")}(r),!1;if(e.transferMode!=tr.DWT.EnumDWT_TransferMode.TWSX_FILE&&Xt.isUndefined(t.format))return function(e){oa(e,-2390,"Output setup error: Invalid format in outputSetup.")}(r),!1;if(!Xt.isString(t.httpParams.url)||""==t.httpParams.url)return function(e){oa(e,-2388,"Output setup error: Invalid url in outputSetup.httpParams.")}(r),!1;if(!Xt.isString(t.httpParams.fileName)||""==t.httpParams.fileName)return function(e){oa(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 oa(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,Xt.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:tr.DWT.EnumDWT_ImageType.IT_PDF,reTries:3,useUploader:!1,singlePost:!0,showProgressBar:!0,removeAfterOutput:!0,httpParams:{url:"",headers:{},formFields:{},remoteName:"RemoteFile",fileName:""}},S=Xt.clone(n),I=n;if(a=S.funcScanStatus,delete S.funcScanStatus,Xt.isFunction(a)?S.bfuncScanStatus=!0:S.bfuncScanStatus=!1,S.outputSetup){var b={pdfSetup:{},tiffSetup:{}};hQ(S.outputSetup,y),o=S.outputSetup,delete S.outputSetup,o.pdfSetup&&(o.format!=tr.DWT.EnumDWT_ImageType.IT_MULTIPAGE_PDF&&o.format!=tr.DWT.EnumDWT_ImageType.IT_PDF||Xt.mix(b.pdfSetup,o.pdfSetup)),o.tiffSetup&&(o.format!=tr.DWT.EnumDWT_ImageType.IT_MULTIPAGE_TIF&&o.format!=tr.DWT.EnumDWT_ImageType.IT_TIF||Xt.mix(b.tiffSetup,o.tiffSetup)),o.format!=tr.DWT.EnumDWT_ImageType.IT_MULTIPAGE_PDF&&o.format!=tr.DWT.EnumDWT_ImageType.IT_MULTIPAGE_TIF||(o.singlePost=!0),o.httpParams&&Xt.isNumber(o.httpParams.threads)&&(v=o.httpParams.threads),s=Xt.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,k,E,x,A=r.__remoteFilename,P=r.MaxUploadImageSize,D=r.IfShowProgressBar,F=r.__OnPostTransferAsync,W=r.__OnPostAllTransfers,N=r.__OnHttpUploadStatus,O=r.__insertingIndex,R=r.__IfAppendImage,M=r.httpFormFields,L=r._tiffCompressionType,B=!1,U=o.showProgressBar;if((T=function(e){var t=!0;Xt.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=N,e.__remoteFilename=A,e.__maxUploadImageSize=P,e.IfShowProgressBar=D,e.__insertingIndex=O,e.__IfAppendImage=R,e.httpFormFields=M,e._tiffCompressionType=L,tr.FileUploader&&(tr.FileUploader.nextLoopTime=600),e._startScanFlag=!1},w=function(e,t,r){l?(t(r),T(e)):setTimeout(function(){w(e,t,r)},200)},k=function(e,t){B=!0,c&&(c=!1,l||r._innerSendCmd("CancelAllPendingTransfers"),w(r,e,t))},E=function(e,t,r,n){if(Xt.isFunction(f)){var i,o=t,a=0;Xt.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,Xt.isNumber(S.insertingIndex)&&S.insertingIndex>-1&&(r.__insertingIndex=S.insertingIndex,r.__IfAppendImage=!1),Xt.isFunction(f)?r.__OnHttpUploadStatus=f:r.__OnHttpUploadStatus=!1,o.useUploader)&&!tr.FileUploader)return new Qt.Promise(function(e,t){oa(r,-2380,"Please make sure the Uploader Module has been installed.");var n={code:r._errorCode,message:r._getErrorString(),response:""};l=!0,k(t,n)});if(i=o.reTries,o.useUploader){if(o.httpParams&&(x=o.httpParams.url),!Xt.startsWith(x,"http://")&&!Xt.startsWith(x,"https://")){var V=window.location.href,j=V.lastIndexOf("/");V=V.substring(0,j+1),o.httpParams.url=V+x}}else o.httpParams&&(Xt.each(o.httpParams.headers,function(e,t){r.SetHTTPHeader(t,e)}),Xt.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?tr.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,k(t,i)}):e({})}).then(function(e){return new Qt.Promise(function(t,n){var u=function(){(S.transferMode==tr.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&&Xt.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,x=S.transferMode==tr.DWT.EnumDWT_TransferMode.TWSX_FILE,A=o.removeAfterOutput,P=0;if(d&&(l=!1,d=!1),x?(P=m.length,m.push(t.path)):(P=g.length,g.push(C)),a&&Xt.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=JH(o.httpParams.fileName,P+1),h=JH(o.httpParams.remoteName,P+1)),w||"http"!=o.type)!w&&o.type;else if(o.httpParams&&Xt.isNumber(o.httpParams.maxSizeLimit)&&(r.__maxUploadImageSize=o.httpParams.maxSizeLimit),o.useUploader){U?(tr.FileUploader.nextLoopTime=300,Qt.showProgress(r,"Scan Upload",r.__IfShowCancelDialogWhenImageTransfer)):Qt.hideProgress(),y=function(e,t){return r.__HTTPPostResponseString=t,E(r,e._fileName,100,200),r._OnPercentDone([0,100,"","http",e._fileName]),U&&Qt.closeProgress(null,"Scan Upload"),!x&&o.removeAfterOutput?setTimeout(function(){r._ImgManager.convertServerIdToClientIndex(C)>-1?rQ(nQ,r,cQ).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=x?m.length:g.length,e=0;e<t;e++)Qt.closeProgress(null,"Scan Upload")}!x&&o.removeAfterOutput&&setTimeout(function(){r._ImgManager.convertServerIdToClientIndex(C)>-1&&rQ(nQ,r,cQ).call(r,C)},100),W.CancelAllUpload();var i={code:r._errorCode,message:r._getErrorString(),response:r.__HTTPPostResponseString};return k(n,i),!1},b=function(e,t,n,i){var o=303;t==fQ.TRANS_SERVICE_ERROR_404?o=404:t==fQ.TRANS_SERVICE_ERROR_500?o=500:t==fQ.TRANS_SERVICE_ERROR_503&&(o=503),r._errorCode=t,r._errorString=n,r.__HTTPPostResponseString=i,E(r,c,100,o),I()},F=function(){r.__HTTPPostResponseString="",E(r,c,100,303),I()},x){var N=W.CreateJob(),O=N.FormField;o.httpParams&&(Xt.each(o.httpParams.headers,function(e,t){N.HttpHeader[t]=e}),Xt.each(o.httpParams.formFields,function(e,t){O.Add(t,e)})),N.ServerUrl=T,N.bDeleteFile=A,N.reTries=i,o.httpParams&&Xt.isNumber(o.httpParams.maxSizeLimit)&&(N.maxSizeLimit=o.httpParams.maxSizeLimit),N._fileName=c,N.SourceValue.Add(t.path,c,h),N.ImageType=S.fileXfer.fileFormat,N.ThreadNum=v,N.OnRunSuccess=y,N.OnRunFailure=b,(U||Xt.isFunction(f))&&(N.OnUploadTransferPercentage=function(e,t){t>0&&t<=100&&(r._OnPercentDone([0,t,"","http",e._fileName]),Xt.isFunction(f)&&E(r,e._fileName,t,0))},Qt.cancelFrom=jH.Scan,U&&rQ(nQ,r,lQ).call(r,I),r._OnPercentDone([0,-1,Fl.Uploading,"http",c]),E(r,c,0,0)),W.Run(N)}else(u=o.format)==tr.DWT.EnumDWT_ImageType.IT_MULTIPAGE_PDF?u=tr.DWT.EnumDWT_ImageType.IT_PDF:u==tr.DWT.EnumDWT_ImageType.IT_MULTIPAGE_TIF&&(u=tr.DWT.EnumDWT_ImageType.IT_TIF),Qt.cancelFrom=jH.Scan,U&&rQ(nQ,r,lQ).call(r,I),r._OnPercentDone([0,-1,Fl.Encoding,"http",c]),r._asyncGenerateURLForUploadData([C],u,s,function(e){var t=W.CreateJob(),n=t.FormField;o.httpParams&&(Xt.each(o.httpParams.headers,function(e,r){t.HttpHeader[r]=e}),Xt.each(o.httpParams.formFields,function(e,t){n.Add(t,e)})),t.ServerUrl=T,t.bDeleteFile=A,t.reTries=i,o.httpParams&&Xt.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||Xt.isFunction(f))&&(t.OnUploadTransferPercentage=function(e,t){t>0&&t<=100&&(r._OnPercentDone([0,t,"","http",e._fileName]),Xt.isFunction(f)&&E(r,e._fileName,t,0))},r._OnPercentDone([0,-1,Fl.Uploading,"http",c]),E(r,c,0,0)),W.Run(t)},F)}else{var R={id:C,st:-1,bCancel:!1};if(_.push(R),0==P&&(U?Qt.showProgress(r,"Scan Upload",r.__IfShowCancelDialogWhenImageTransfer):Qt.hideProgress()),x)y=function(e){return R.st=0,!x&&o.removeAfterOutput?setTimeout(function(){r._ImgManager.convertServerIdToClientIndex(C)>-1?rQ(nQ,r,cQ).call(r,C,function(){p++},function(){p++}):p++},100):p++,!0},I=function(){!x&&o.removeAfterOutput&&setTimeout(function(){r._ImgManager.convertServerIdToClientIndex(C)>-1&&rQ(nQ,r,cQ).call(r,C)},100);var e={code:r._errorCode,message:r._getErrorString(),response:r.__HTTPPostResponseString};return Qt.closeProgress(null,"Scan Upload"),2==R.st||(R.st=1,Xt.each(_,function(e,t){-1==e.st&&(e.bCancel=!0)}),k(n,e)),!1},r._innerUploadDirectly(T,t.path,c,U,A,i,!1,R,y,I);else{if(y=function(e,t){return R.st=0,!x&&o.removeAfterOutput?setTimeout(function(){r._ImgManager.convertServerIdToClientIndex(C)>-1?rQ(nQ,r,cQ).call(r,C,function(){p++},function(){p++}):p++},100):p++,!0},I=function(e){!x&&o.removeAfterOutput&&setTimeout(function(){r._ImgManager.convertServerIdToClientIndex(C)>-1&&rQ(nQ,r,cQ).call(r,C)},100);var t={code:r._errorCode,message:r._getErrorString(),response:r.__HTTPPostResponseString};return Qt.closeProgress(null,"Scan Upload"),2==R.st||(R.st=1,Xt.each(_,function(e,t){-1==e.st&&(e.bCancel=!0)}),k(n,t)),!1},u=o.format,Xt.isUndefined(u)){var M=r._ImgManager.convertServerIdToClientIndex(C);return Ga(r),I([M]),!1}u==tr.DWT.EnumDWT_ImageType.IT_MULTIPAGE_PDF?u=tr.DWT.EnumDWT_ImageType.IT_PDF:u==tr.DWT.EnumDWT_ImageType.IT_MULTIPAGE_TIF&&(u=tr.DWT.EnumDWT_ImageType.IT_TIF);var L={method:"startScan",url:T,serverIds:[C],headers:r._GetHttpHeadersAndClear(),formData:Wz(r.httpFormFields),enumImageType:u,saveSetup:s,fileName:c,dataFormat:WK.Binary,retry:i,bOnlyResponseEmptyIsOK:!1,objUploadFileStatus:R,asyncSuccessFunc:y,asyncFailureFunc:I};r._asyncUploadCmd(L)}}}),r.__OnPostAllTransfers=function(){var c,d,_=-1,y=WK.Binary,b=o.httpParams.url,T=o.singlePost,w=S.transferMode==tr.DWT.EnumDWT_TransferMode.TWSX_FILE,x=o.removeAfterOutput;a&&Xt.isFunction(a)&&(_=w?m.length:g.length,d={event:"postTransfer",bScanCompleted:!0,result:{currentPageNum:_}},setTimeout(function(){a(d)},10));if(0==_)return function(e){oa(e,-1029,"Source has nothing to capture.")}(r),void setTimeout(function(){l=!0,h&&Xt.isFunction(h)&&h();var e={code:r._errorCode,message:r._getErrorString(),response:r.__HTTPPostResponseString};k(n,e)},1e3);if(_>0&&-1029==r._errorCode)r._errorCode=0;else if(0!=r._errorCode){l=!0,h&&Xt.isFunction(h)&&h();var A={code:r._errorCode,message:r._getErrorString(),response:r.__HTTPPostResponseString};return void k(n,A)}if("http"==o.type){if(T&&"http"==o.type){var P,D,F,W=g;if(o.httpParams&&Xt.isNumber(o.httpParams.maxSizeLimit)&&(r.__maxUploadImageSize=o.httpParams.maxSizeLimit),o.useUploader){var N,O=e.uploadManager,R=O.CreateJob(),M=R.FormField;if(U?(tr.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,E(r,i,100,200),r._OnPercentDone([0,100,"","http"]),U&&Qt.closeProgress(null,"Scan Upload"),!w&&o.removeAfterOutput?setTimeout(function(){p=0,Xt.each(W,function(e){r._ImgManager.convertServerIdToClientIndex(e)>-1?rQ(nQ,r,cQ).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"),O.CancelAllUpload(),r._bServerPercentDone=!0;var e={code:r._errorCode,message:r._getErrorString(),response:r.__HTTPPostResponseString};return k(n,e),!w&&o.removeAfterOutput&&setTimeout(function(){Xt.each(W,function(e){r._ImgManager.convertServerIdToClientIndex(e)>-1&&rQ(nQ,r,cQ).call(r,e)})},100),!1},F=function(e,t,n,i){var o=303;t==fQ.TRANS_SERVICE_ERROR_404?o=404:t==fQ.TRANS_SERVICE_ERROR_500?o=500:t==fQ.TRANS_SERVICE_ERROR_503&&(o=503),r._errorCode=t,r._errorString=n,r.__HTTPPostResponseString=i,E(r,"",100,o),D()},N=function(){r.__HTTPPostResponseString="",E(r,"",100,303),D()},U&&(Qt.cancelFrom=jH.Scan,rQ(nQ,r,lQ).call(r,D)),w)o.httpParams&&(Xt.each(o.httpParams.headers,function(e,t){R.HttpHeader[t]=e}),Xt.each(o.httpParams.formFields,function(e,t){M.Add(t,e)})),R.ServerUrl=b,R.bDeleteFile=x,R.reTries=i,o.httpParams&&Xt.isNumber(o.httpParams.maxSizeLimit)&&(R.maxSizeLimit=o.httpParams.maxSizeLimit),Xt.each(m,function(e,t){var r,n;o.httpParams&&(r=JH(o.httpParams.fileName,t+1),n=JH(o.httpParams.remoteName,t+1)),R.SourceValue.Add(e,r,n)}),R.ImageType=S.fileXfer.fileFormat,R.ThreadNum=v,R.OnRunSuccess=P,R.OnRunFailure=F,(U||Xt.isFunction(f))&&(R.OnUploadTransferPercentage=function(e,t){t>0&&t<=100&&(r._OnPercentDone([0,t,"","http"]),Xt.isFunction(f)&&E(r,"",t,0))},r._OnPercentDone([0,-1,Fl.Uploading,"http"]),E(r,"",0,0)),O.Run(R);else if((c=o.format)==tr.DWT.EnumDWT_ImageType.IT_MULTIPAGE_PDF||c==tr.DWT.EnumDWT_ImageType.IT_MULTIPAGE_TIF)c==tr.DWT.EnumDWT_ImageType.IT_MULTIPAGE_PDF?c=tr.DWT.EnumDWT_ImageType.IT_PDF:c==tr.DWT.EnumDWT_ImageType.IT_MULTIPAGE_TIF&&(c=tr.DWT.EnumDWT_ImageType.IT_TIF),r._OnPercentDone([0,-1,Fl.Encoding,"http"]),r._asyncGenerateURLForUploadData(W,c,s,function(e){var t,n;o.httpParams&&(Xt.each(o.httpParams.headers,function(e,t){R.HttpHeader[t]=e}),Xt.each(o.httpParams.formFields,function(e,t){M.Add(t,e)})),R.ServerUrl=b,R.bDeleteFile=x,R.reTries=i,o.httpParams&&Xt.isNumber(o.httpParams.maxSizeLimit)&&(R.maxSizeLimit=o.httpParams.maxSizeLimit),o.httpParams&&(t=JH(o.httpParams.fileName,1),n=JH(o.httpParams.remoteName,1)),R._fileName=t,R.SourceValue.Add(e,t,n),R.ImageType=c,R.ThreadNum=v,R.OnRunSuccess=P,R.OnRunFailure=F,(U||Xt.isFunction(f))&&(R.OnUploadTransferPercentage=function(e,n){n>0&&n<=100&&(r._OnPercentDone([0,n,"","http",t]),Xt.isFunction(f)&&E(r,t,n,0))},r._OnPercentDone([0,-1,Fl.Uploading,"http",t])),O.Run(R)},N);else{var L=W.length,V=0,j=0,G="";U&&(r._bServerPercentDone=!1),r._OnPercentDone([0,-1,Fl.Encoding,"http"]),Xt.each(W,function(e,t){var n,a;o.httpParams&&(n=JH(o.httpParams.fileName,t+1),a=JH(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"]),R.SourceValue.Add(e,n,a),++V>=L&&(U&&(r._bServerPercentDone=!0),o.httpParams&&(Xt.each(o.httpParams.headers,function(e,t){R.HttpHeader[t]=e}),Xt.each(o.httpParams.formFields,function(e,t){M.Add(t,e)})),R.ServerUrl=b,R.bDeleteFile=x,R.reTries=i,o.httpParams&&Xt.isNumber(o.httpParams.maxSizeLimit)&&(R.maxSizeLimit=o.httpParams.maxSizeLimit),R.ImageType=c,R.ThreadNum=v,R.OnRunSuccess=P,R.OnRunFailure=F,(U||Xt.isFunction(f))&&(R.OnUploadTransferPercentage=function(e,t){t>0&&t<=100&&(r._OnPercentDone([0,t,"","http"]),Xt.isFunction(f)&&E(r,"",t,0))},r._OnPercentDone([0,-1,Fl.Uploading,"http"])),O.Run(R))},N)})}}else if(w)P=function(e){return r._bServerPercentDone=!0,!w&&o.removeAfterOutput?setTimeout(function(){p=0,Xt.each(W,function(e){r._ImgManager.convertServerIdToClientIndex(e)>-1?rQ(nQ,r,cQ).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 k(n,t),!w&&o.removeAfterOutput&&setTimeout(function(){Xt.each(W,function(e){r._ImgManager.convertServerIdToClientIndex(e)>-1&&rQ(nQ,r,cQ).call(r,e)})},100),!1},r._innerUploadFilesDirectly(b,m,o.httpParams&&o.httpParams.fileName,U,x,i,!1,P,D);else{P=function(e,n){return r._bServerPercentDone=!0,!w&&o.removeAfterOutput?setTimeout(function(){p=0,Xt.each(W,function(e){r._ImgManager.convertServerIdToClientIndex(e)>-1?rQ(nQ,r,cQ).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 k(n,t),!w&&o.removeAfterOutput&&setTimeout(function(){Xt.each(W,function(e){r._ImgManager.convertServerIdToClientIndex(e)>-1&&rQ(nQ,r,cQ).call(r,e)})},100),!1},c=o.format;var H=r._GetHttpHeadersAndClear(),z=Wz(r.httpFormFields);if(c==tr.DWT.EnumDWT_ImageType.IT_MULTIPAGE_PDF||c==tr.DWT.EnumDWT_ImageType.IT_MULTIPAGE_TIF){var K;c==tr.DWT.EnumDWT_ImageType.IT_MULTIPAGE_PDF?c=tr.DWT.EnumDWT_ImageType.IT_PDF:c==tr.DWT.EnumDWT_ImageType.IT_MULTIPAGE_TIF&&(c=tr.DWT.EnumDWT_ImageType.IT_TIF),o.httpParams&&(K=JH(o.httpParams.fileName,1),JH(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&&Xt.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)};rQ(nQ,r,uQ).call(r,S,c,function(e){if(-1029==r._errorCode){if(S.transferMode==tr.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};k(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 v(e){var r;return g().wrap(function(n){for(;;)switch(n.prev=n.next){case 0:return r=new t(e),n.next=3,_h.STwainConnectToServer(r);case 3:return n.abrupt("return",r);case 4:case"end":return n.stop()}},v)})),function(e){return r.apply(this,arguments)})}]);var r,a,u,c}(bJ);function oQ(){var e,t=[],r=this.__devices.length;for(e=0;e<r;e++){var n=this.__devices[e],i=n.deviceType,o=dQ(),a=void 0,s=Xt.clone(n.deviceInfo);Vh(i)?(i==ed.TWAINSCANNER?a="TWAIN":i==ed.WIATWAINSCANNER?a="WIATWAIN":i==ed.TWAINX64SCANNER&&(a="TWAIN64"),o.Manufacturer=s.Manufacturer,o.ProductFamily=s.ProductFamily,o.ProtocolMajor=s.ProtocolMajor,o.ProtocolMinor=s.ProtocolMinor,o.SupportedGroups=s.SupportedGroups,o.Version=s.Version):i==ed.SANESCANNER?(a="SANE",o.DeviceInfo=s):i==ed.ICASCANNER?(a="ICA",o.DeviceInfo=s):i==ed.ESCLSCANNER?(a="eSCL",o.DeviceInfo=s):i==ed.WIFIDIRECTSCANNER?(a="WiFiScanner",o.DeviceInfo=s):i==ed.WIASCANNER&&(a="WIA",o.DeviceInfo=s),o.ProductName=n.displayName,o.DriverType=a,t.push(o)}return t}function aQ(){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 sQ(e,t){var r=["[",e,",",null!=t?t:of.SMF_NAME,"]"].join("");return this._innerFun("SelectSourceEx",r)}function uQ(e,t,r){var n,i,o=this,a=null,s=null;if(i=Xt.isUndefined(e)||null==e?{}:e,o._resetErr(),!o._isValid())return!1;if(Xt.isFunction(t)&&(a=function(){t(i)}),Xt.isFunction(r)&&(s=function(e,t){r(e,t,i)}),!Zc.checkProductKey(o,{Core:!0}))return Xt.isFunction(s)&&s(o._errorCode,o._errorString),!1;for(var u=0,c=0;c<xh.length;c++){var l=["__",xh[c]].join("");Xt.isFunction(o[l])&&(u|=1<<c)}if(i.EnableEvents=u,i.scanner){var d=i.scanner;Xt.isString(d)||Xt.isString(d.strDevice)&&(i.device=d.strDevice,delete i.scanner)}return n=["[",Xt.stringify(i),"]"].join(""),o.__bAcquireImageNow=!0,o.__innerAcquireOrLoadImageAsync("StartScan",n,!1,!0).then(a,function(e){o._errorCode=e.code,o._errorString=e.message,Xt.isFunction(s)&&s(e.code,e.message)}),!0}function cQ(e,t,r){var n=this;return n._innerFunRaw("RemoveImage",Zl(e),!0,!1,!0,function(){n._OnBitmapChanged(["c1",""+e,3,n._ImgManager.getCurrentImageIndex(),n._ImgManager.count()]),Xt.isFunction(t)&&t()},r)}function lQ(e){var t=this;t.IfShowCancelDialogWhenImageTransfer?(Qt.progressContext&&Qt.progressContext.on("cancel",function(){vs(t),e()}),XH(!0)):XH(!1)}function dQ(){return{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}}}var fQ={TRANS_SERVICE_ERROR_404:12,TRANS_SERVICE_ERROR_500:13,TRANS_SERVICE_ERROR_503:14},hQ=function(e,t){if(!Xt.isUndefined(e)&&!Xt.isUndefined(t)&&null!=e&&null!=t){for(var r in t)e.hasOwnProperty(r)?"object"===_(e[r])&&hQ(e[r],t[r]):e[r]=t[r];return e}};function gQ(e){return mQ.apply(this,arguments)}function mQ(){return mQ=n(g().mark(function e(t){var r,n,i;return g().wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return r=window,tr.DWT.UseDefaultViewer||(t.container=null),Bl(t.container)?t.bNoViewer=!1:t.bNoViewer=!0,e.prev=3,e.next=6,iQ.create(t);case 6:n=e.sent,e.next=15;break;case 9:throw e.prev=9,e.t0=e["catch"](3),(i=e.t0&&e.t0.code)==ua.ResponseDataTypeError||i==ua.HTSTError||i==ua.CORSError||i==ua.CORSErrorFromService||i==ua.SSLCertExpired||i==ua.SSLCertInvalid||(i==ua.MustUpgrade?Vf(!0):i==ua.ModuleNotExists&&yQ(n)),n&&n.dispose(),e.t0;case 15:return e.prev=15,r.DCP_DWT_OnClickCloseInstall&&r.DCP_DWT_OnClickCloseInstall(!1,!0),e.finish(15);case 18:return vQ(n),e.abrupt("return",n);case 20:case"end":return e.stop()}},e,null,[[3,9,15,18]])})),mQ.apply(this,arguments)}function pQ(e,t){if(Xt.isFunction(tr.OnWebTwainNeedUpgradeCallback)){var r,n,i={};if(n=gc(),de.bWin)r=hc.enumWindow;else if(tr.navInfo.bEmbed||de.bAndroid||de.bChromeOS||de.bHarmonyOS||de.biPhone||de.biPad)de.bAndroid?r=hc.enumAndroid:(i.deb=n,r=de.biPhone||de.biPad?hc.enumiOS:de.bChromeOS?hc.enumChromeOS:de.bHarmonyOS?hc.enumHarmonyOS:hc.enumEmbed);else if(de.bLinux){var o=mc(),a=pc();n=o,i.deb=o,i.rpm=a,r=hc.enumLinux}else r=hc.enumMac;i["default"]=n;var s=ui.one(".dynamsoft-dialog-license");s&&s.getEL()&&(s.getEL().style.display="none"),Qt.detect.needUpgrade=di,tr.OnWebTwainNeedUpgradeCallback(Qo.name,i,Qo.bHTML5Edition,r,de.bIE,de.bSafari,$o(),Lo.strIEVersion,Qt.detect.bPromptJSOrServerOutdated,e,t)}}function vQ(e){return _Q.apply(this,arguments)}function _Q(){return(_Q=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=di,Xt.isFunction(tr.DWT.OnWebTwainNeedUpgradeWebJavascript)&&tr.DWT.OnWebTwainNeedUpgradeWebJavascript(t.ErrorString)),!qo.versionInfoFromServer){e.next=7;break}r=qo.versionInfoFromServer,e.next=10;break;case 7:return e.next=9,t._getVersionInfoAsync();case 9:r=e.sent;case 10:if(Qt.detect.bNeedUpgradeEvent||ff(r)){e.next=19;break}if(Qt.detect.bNeedUpgradeEvent=di,!Xt.isFunction(tr.DWT.OnWebTwainNeedUpgrade)){e.next=15;break}if(!tr.DWT.OnWebTwainNeedUpgrade()){e.next=15;break}return e.abrupt("return");case 15:if(!t._bRemoteMode){e.next=18;break}return Xt.isFunction(tr.OnRemoteWebTwainNeedUpgradeCallback)&&(n=t._serverInfo.port,tr.OnRemoteWebTwainNeedUpgradeCallback(Qo.name,t._serverInfo.server,n,t._serverInfo.ssl)),e.abrupt("return");case 18:(Qo.bHTML5Edition&&t._isBindViewer()||!Qo.bHTML5Edition)&&((i=t._containerElement)&&(ui.one(i).before(Qt.install._strNonInstallDIV),Xt.show(Qt.install._divDWTNonInstallContainerID)),""!=Qt.install._divDWTemessageContainer&&Xt.hide(Qt.install._divDWTemessageContainer),pQ());case 19:case"end":return e.stop()}},e)}))).apply(this,arguments)}function yQ(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||Xt.isFunction(tr.OnRemoteWebTwainNotFoundCallback)&&tr.OnRemoteWebTwainNotFoundCallback(Qo.name,e._serverInfo.server,e._serverInfo.port,e._serverInfo.ssl,Lo.bMobile):(Uf(t,r,n),Vf(!1)),Qt.detect.bNoControlEvent=!0}}var SQ=function(e){function t(e){var r;o(this,t),(r=i(this,t,[e]))._bServerPercentDone=!0,r._bScanForProxyRemote=di;var n=_h.getServerImageUrlPrefix(r);return BH._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){eh(e._serverInfo.server,e._serverInfo.port,e._serverInfo.ssl,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,Xt.isNumber(e)&&!isNaN(e)){n.next=4;break}throw la(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",Zl(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,Xt.isBoolean(e)){n.next=4;break}throw la(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",Zl(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",Zl(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:af.IT_BMP,width:a.width,height:a.height,bit:a.bitDepth,xres:a.resolutionX,yres:a.resolutionY,uidFromServer:o.uidFromServer},c=Xt.stringify([Xt.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(!Xt.isUndefined(e)&&""!==e){l.next=9;break}throw ka(u),{code:u._errorCode,message:u._errorString};case 9:if(Xt.isString(e)){l.next=12;break}throw za(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=Gh(u,r)).length){l.next=18;break}throw ca(u),{code:u._errorCode,message:u._errorString};case 18:if(!Xt.isUndefined(n)){l.next=21;break}throw Ga(u),{code:u._errorCode,message:u._errorString};case 21:if(n!=tr.DWT.EnumDWT_ImageType.IT_BMP&&n!=tr.DWT.EnumDWT_ImageType.IT_JPG&&n!=tr.DWT.EnumDWT_ImageType.IT_PNG){l.next=27;break}if(!(c.length>1)){l.next=25;break}throw Ma(u),{code:u._errorCode,message:u._errorString};case 25:l.next=33;break;case 27:if(n!=tr.DWT.EnumDWT_ImageType.IT_TIF&&n!=tr.DWT.EnumDWT_ImageType.IT_PDF){l.next=31;break}l.next=33;break;case 31:throw Ga(u),{code:u._errorCode,message:u._errorString};case 33:if(!(Xt.isUndefined(i)||i!=tr.DWT.EnumDWT_UploadDataFormat.Binary&&i!=tr.DWT.EnumDWT_UploadDataFormat.Base64)){l.next=36;break}throw Ha(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,Xt.each(null==a?void 0:a.formFields,function(e,t){var r=e.name,n=e.value;Xt.isString(r)&&(n instanceof Blob?d.append(r,n,e.fileName):d.append(r,n))})),null!=a&&a.headers&&(f={},Xt.each(null==a?void 0:a.headers,function(e,t){Xt.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(Xt.isFunction(r)){var t=[];Xt.isArray(c)&&Xt.each(c,function(e){var r=u._imageBufferWrapper.convertServerIdToClientIndex(e);r>-1&&t.push(r)});try{Hh(r,e,t)}catch(n){}}return e=null,!0},function(e){if(Xt.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 ca(i),Qt.Promise.reject({code:i._errorCode,message:i._errorString});if(o<0||o>=i.howManyImagesInBuffer)return Va(i),Qt.Promise.reject({code:i._errorCode,message:i._errorString});var a=i._imageBufferWrapper.convertClientIndexToServerId(o);return-1==a?(Va(i),Qt.Promise.reject({code:i._errorCode,message:i._errorString})):i._innerFunV2("RotateEx",Zl(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 ca(r),Qt.Promise.reject({code:r._errorCode,message:r._errorString});if(n<0||n>=r.howManyImagesInBuffer)return Va(r),Qt.Promise.reject({code:r._errorCode,message:r._errorString});var i=r._imageBufferWrapper.convertClientIndexToServerId(n);if(-1==i)return Va(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",Zl(i,o,a,s,u),!0).then(function(e){})}},{key:"_createHttpUploaderConfig",value:function(){var e=this,t=new ez;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 k(){var e,r,n;return g().wrap(function(i){for(;;)switch(i.prev=i.next){case 0:return ta((e=this)._serverInfo.server)&&(cf.item("DWT_port",e._serverInfo.port),cf.item("DWT_ssl",e._serverInfo.ssl?"true":"false")),e._bNoMask||ld("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)&&!tr.DWT.WebTwainIdMap[n]&&(tr.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||dd("OnReady"),i.finish(20);case 23:case"end":return i.stop()}},k,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 E(e){var r;return g().wrap(function(n){for(;;)switch(n.prev=n.next){case 0:return r=new t(e),n.next=3,_h.STwainConnectToServer(r);case 3:return n.abrupt("return",r);case 4:case"end":return n.stop()}},E)})),function(e){return u.apply(this,arguments)})},{key:"_getBuffer",value:function(e){return BH._getBuffer(e._imageBufferWrapper)}},{key:"_setError",value:function(e,t,r){e._errorCode=t,e._errorString=r}},{key:"createByServiceInfo",value:(a=n(g().mark(function x(e,r,n){var i,o,a;return g().wrap(function(s){for(;;)switch(s.prev=s.next){case 0:return o={id:Xt.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,_h.STwainConnectToServer(a);case 9:return s.abrupt("return",a);case 10:case"end":return s.stop()}},x)})),function(e,t,r){return a.apply(this,arguments)})},{key:"checkOnlineByServiceInfo",value:(r=n(g().mark(function A(e){var r,n;return g().wrap(function(i){for(;;)switch(i.prev=i.next){case 0:return r={id:Xt.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 Mu(null)),n.dispose(),i.abrupt("return",!0);case 11:return i.prev=11,i.t0=i["catch"](1),Xt.warn(i.t0),i.abrupt("return",!1);case 15:case"end":return i.stop()}},A,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(Xt.isUndefined(s))return Ga(e),void(Xt.isFunction(m)&&m({code:e._errorCode,message:e._errorString}));Qt.cancelFrom=jH.HTTPUpload;var _,y=function(r,n,i,o){Qt.needShowTwiceShowDialog=!1,e.IfShowProgressBar&&Qt.closeProgress(null,t),Xt.isFunction(m)&&m({code:r,message:n,response:i,httpCode:o})},S=e._createHttpUploaderConfig();if(S.objUploadStatus=h,p=QH(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==tr.DWT.EnumDWT_UploadDataFormat.Binary){if(h&&h.bCancel)return h.st=2,vs(e),void y(e._errorCode,e._errorString);S.onPercent([0,-1,Fl.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),Xt.isFunction(g)&&Hh(g,r),r=null,!0},h&&h.bCancel)return h.st=2,vs(e),y(e._errorCode,e._errorString);if(!r||r.size<=0)return Ta(e),y(e._errorCode,e._errorString);var u=e.__maxUploadImageSize;if(r.size>u&&-1!=u)return wa(e),y(e._errorCode,e._errorString);if(0!=e._errorCode)return y(e._errorCode,e._errorString);tr.DWT.IfAddMD5InUploadHeader&&a&&""!=a&&(i["dwt-md5"]=a);var c=new ZH,l=new $H;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==tr.DWT.EnumDWT_UploadDataFormat.Base64){e._convertToBase64ByServerIdsWithUI(t,a,s,l,4,function(r){var a,s;if(!r||r.getLength()<=0)return Ta(e),y(e._errorCode,e._errorString);if(_=function(r){return Qt.needShowTwiceShowDialog=!1,e.IfShowProgressBar&&Qt.closeProgress(null,t),Xt.isFunction(g)&&Hh(g,r),!0},a=r.getMD5(),tr.DWT.IfAddMD5InUploadHeader&&(i["dwt-md5"]=a),!(s=r.getData(0,r.getLength()))||""==s)return Ta(e),y(e._errorCode,e._errorString);var u=new $H;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 ZH).httpPostUpload(S,u,_,y)},y)}}}]);var r,a,u,c,h,m,p,v,_,y}(iz),IQ=Jl,bQ=function(){return s(function x(e){var t=this;if(o(this,x),this._serverUrl=e,this._defaultDSScanClient=null,this._dsScanClientsMap={},this._serviceInfos=null,this._id=Xt.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&&!tr.DWT.RemoteScanIdMap[this._id]&&(tr.DWT.RemoteScanIdMap[this._id]=this),this._uuidForRemoteScanObject="",Qt.dlgProgress||Qt.initProgress(null),tr.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?SQ._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 tr.DWTViewerEx(null,r)}else this._viewer=null},[{key:"Viewer",get:function(){return this._viewer}},{key:"_disposeDSClientByKey",value:(E=n(g().mark(function A(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()}},A,this)})),function(e){return E.apply(this,arguments)})},{key:"_checkServerUrl",value:function(){var e=this._serverUrl;if(e&&Xt.isString(e)&&Xt.startsWith(location.href,"https://")&&Xt.startsWith(e,"http://")){var t={};throw function(e,t,r){oa(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),fu(t)}if(!Xt.isString(e)||""==e){var r={};throw oa(r,-2545,"The  proxy server URL is invalid."),fu(r)}}},{key:"getServices",value:(k=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 bs(t={}),fu(t);case 4:if(r=this._serverUrl,this._checkServerUrl(),n=new jJ(r,!0),ld("getServices",this.getViewerElement()),g.prev=8,!e&&this._serviceInfos){g.next=68;break}if(i=null,o=this._serviceInfos,this._serviceInfos=[],a="",s="",!ea()){g.next=30;break}return g.next=16,this._setRemoteUuid();case 16:return g.prev=16,g.next=19,Pd(tr.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),Od(c={},g.t0),{code:c._errorCode,message:c._errorString};case 28:g.next=31;break;case 30:a=Qo.refProductKey;case 31:return g.next=33,n.getServices(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,SQ.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(Xt.log("Find Dynamic Web TWAIN Services:"),Xt.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,dd("getServices");try{n._bInited&&n.dispose()}catch(HQ){}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 k.apply(this,arguments)})},{key:"getDefaultService",value:function(){if(this._bDispose){var e={};throw bs(e),fu(e)}return this._defaultDSScanClient?this._defaultDSScanClient.getServiceInfo():null}},{key:"setDefaultService",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 bs(t={}),fu(t);case 4:if(null!==e){o.next=7;break}return this._defaultDSScanClient=null,o.abrupt("return");case 7:if(e&&e instanceof Gd){o.next=11;break}throw $a(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(SQ._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(SQ._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=tr.DWT.CustomizableDisplayInfo;if(!Xt.isUndefined(t)){if(!Xt.isUndefined(t.buttons)){var r=t.buttons.titles;Xt.isUndefined(r)||(Xt.isUndefined(r.previous)||(e.buttons.titles.previous=r.previous),Xt.isUndefined(r.next)||(e.buttons.titles.next=r.next),Xt.isUndefined(r.print)||(e.buttons.titles.print=r.print),Xt.isUndefined(r.scan)||(e.buttons.titles.scan=r.scan),Xt.isUndefined(r.load)||(e.buttons.titles.load=r.load),Xt.isUndefined(r.rotateleft)||(e.buttons.titles.rotateleft=r.rotateleft),Xt.isUndefined(r.rotate)||(e.buttons.titles.rotate=r.rotate),Xt.isUndefined(r.rotateright)||(e.buttons.titles.rotateright=r.rotateright),Xt.isUndefined(r.deskew)||(e.buttons.titles.deskew=r.deskew),Xt.isUndefined(r.crop)||(e.buttons.titles.crop=r.crop),Xt.isUndefined(r.cut)||(e.buttons.titles.cut=r.cut),Xt.isUndefined(r.changeimagesize)||(e.buttons.titles.changeimagesize=r.changeimagesize),Xt.isUndefined(r.flip)||(e.buttons.titles.flip=r.flip),Xt.isUndefined(r.mirror)||(e.buttons.titles.mirror=r.mirror),Xt.isUndefined(r.zoomin)||(e.buttons.titles.zoomin=r.zoomin),Xt.isUndefined(r.originalsize)||(e.buttons.titles.originalsize=r.originalsize),Xt.isUndefined(r.zoomout)||(e.buttons.titles.zoomout=r.zoomout),Xt.isUndefined(r.stretch)||(e.buttons.titles.stretch=r.stretch),Xt.isUndefined(r.fit)||(e.buttons.titles.fit=r.fit),Xt.isUndefined(r.fitw)||(e.buttons.titles.fitw=r.fitw),Xt.isUndefined(r.fith)||(e.buttons.titles.fith=r.fith),Xt.isUndefined(r.hand)||(e.buttons.titles.hand=r.hand),Xt.isUndefined(r.rectselect)||(e.buttons.titles.rectselect=r.rectselect),Xt.isUndefined(r.zoom)||(e.buttons.titles.zoom=r.zoom),Xt.isUndefined(r.restore)||(e.buttons.titles.restore=r.restore),Xt.isUndefined(r.save)||(e.buttons.titles.save=r.save),Xt.isUndefined(r.close)||(e.buttons.titles.close=r.close),Xt.isUndefined(r.removeall)||(e.buttons.titles.removeall=r.removeall),Xt.isUndefined(r.removeselected)||(e.buttons.titles.removeselected=r.removeselected));var n=t.buttons.bShowAllButtons;Xt.isUndefined(n)||(e.buttons.bShowAllButtons=n);var i=t.buttons.visibility;Xt.isUndefined(i)||(Xt.isUndefined(i.scan)||(e.buttons.visibility.scan=i.scan),Xt.isUndefined(i.load)||(e.buttons.visibility.load=i.load),Xt.isUndefined(i.print)||(e.buttons.visibility.print=i.print),Xt.isUndefined(i.removeall)||(e.buttons.visibility.removeall=i.removeall),Xt.isUndefined(i.removeselected)||(e.buttons.visibility.removeselected=i.removeselected),Xt.isUndefined(i.rotateleft)||(e.buttons.visibility.rotateleft=i.rotateleft),Xt.isUndefined(i.rotate)||(e.buttons.visibility.rotate=i.rotate),Xt.isUndefined(i.rotateright)||(e.buttons.visibility.rotateright=i.rotateright),Xt.isUndefined(i.deskew)||(e.buttons.visibility.deskew=i.deskew),Xt.isUndefined(i.crop)||(e.buttons.visibility.crop=i.crop),Xt.isUndefined(i.cut)||(e.buttons.visibility.cut=i.cut),Xt.isUndefined(i.changeimagesize)||(e.buttons.visibility.changeimagesize=i.changeimagesize),Xt.isUndefined(i.flip)||(e.buttons.visibility.flip=i.flip),Xt.isUndefined(i.mirror)||(e.buttons.visibility.mirror=i.mirror),Xt.isUndefined(i.zoomin)||(e.buttons.visibility.zoomin=i.zoomin),Xt.isUndefined(i.originalsize)||(e.buttons.visibility.originalsize=i.originalsize),Xt.isUndefined(i.zoomout)||(e.buttons.visibility.zoomout=i.zoomout),Xt.isUndefined(i.stretch)||(e.buttons.visibility.stretch=i.stretch),Xt.isUndefined(i.fit)||(e.buttons.visibility.fit=i.fit),Xt.isUndefined(i.fitw)||(e.buttons.visibility.fitw=i.fitw),Xt.isUndefined(i.fith)||(e.buttons.visibility.fith=i.fith),Xt.isUndefined(i.hand)||(e.buttons.visibility.hand=i.hand),Xt.isUndefined(i.rectselect)||(e.buttons.visibility.rectselect=i.rectselect),Xt.isUndefined(i.zoom)||(e.buttons.visibility.zoom=i.zoom))}var o=t.dialogText;Xt.isUndefined(o)||(Xt.isUndefined(o.dlgRotateAnyAngle)||(e.dialogText.dlgRotateAnyAngle=o.dlgRotateAnyAngle),Xt.isUndefined(o.dlgChangeImageSize)||(e.dialogText.dlgChangeImageSize=o.dlgChangeImageSize),Xt.isUndefined(o.saveChangedImage)||(e.dialogText.saveChangedImage=o.saveChangedImage),Xt.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,Xt.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,delete t.docName,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==tr.DWT.IfConfineMaskWithinTheViewer?(tr.DWT.IfConfineMaskWithinTheViewer=!1,r._stwain.AcquireImage({},function(){tr.DWT.IfConfineMaskWithinTheViewer=!0},function(){})):r._stwain.AcquireImage()},function(){Xt.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(ss(this._defaultDSScanClient),!(t.howManyImagesInBuffer<=0||t.currentImageIndexInBuffer<0)){e.next=6;break}return IQ.output(t,"No image in Buffer"),e.abrupt("return",!0);case 6:return r=SQ._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 N(e){return g().wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if(!this._defaultDSScanClient){e.next=4;break}return ss(this._defaultDSScanClient),e.next=4,this._defaultDSScanClient._removeAllImagesAsync("removeAllImages",!0);case 4:return e.abrupt("return",!1);case 5:case"end":return e.stop()}},N,this)})),function(e){return b.apply(this,arguments)})},{key:"__save",value:(I=n(g().mark(function O(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),ld(o,a),s.prev=3,ss(i._defaultDSScanClient),!(i.howManyImagesInBuffer<=0||i.currentImageIndexInBuffer<0)){s.next=8;break}return IQ.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,dd(o),s.finish(17);case 20:case"end":return s.stop()}},O,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(Xt.isFunction(t.__CloseImageEditorUI))try{t.__CloseImageEditorUI()}catch(r){_o(r)}}},{key:"__deskew",value:function(e,t,r){var n=this,i="deskew";if(ss(n._defaultDSScanClient),n.howManyImagesInBuffer<=0||n.currentImageIndexInBuffer<0)IQ.output(n,"No image in Buffer");else{var o=n.__getViewerElementForViewer(n,!0);ld(i,o);n._defaultDSScanClient.getSkewAngleFromBinaryAsync(n.currentImageIndexInBuffer,t,function(e){r(e[0]),dd(i)},function(){dd(i)})}}},{key:"__rotate",value:(S=n(g().mark(function R(e,t,r){var n;return g().wrap(function(i){for(;;)switch(i.prev=i.next){case 0:return ss(this._defaultDSScanClient),i.next=4,this._makeSureDefaultServiceInfo();case 4:if(this._defaultDSScanClient){i.next=6;break}throw Us();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()}},R,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 ss(this._defaultDSScanClient),n.next=4,this._makeSureDefaultServiceInfo();case 4:if(this._defaultDSScanClient){n.next=6;break}throw Us();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!Xt.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 bs(r={}),fu(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:rd,ld(i,o),g.prev=6,d=!1,f=[],this._serviceInfos){g.next=12;break}return g.next=12,this.getServices();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 Vs(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,Xt.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,dd(i),l&&tr.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 bs(n={}),fu(n);case 5:if(e&&e instanceof Zd){g.next=9;break}throw $a(i={}),{code:i._errorCode,message:i._errorString};case 9:return a="acquireImage",s=r.getViewerElement(),u=[],ld(a,s),g.prev=12,Xt.isUndefined(t)&&(t={}),Xt.isUndefined(t.IfShowUI)&&(t.IfShowUI=!1),Xt.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],SQ._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 us(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),dd(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(!SQ._isReady(e[r]))return void setTimeout(function(){i._waitForDSValid(e,t)},qo.RemoteReconnectTimeSpan);Xt.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 bs(t={}),fu(t);case 4:if(e&&e instanceof Zd){u.next=8;break}throw $a(r={}),fu(r);case 8:return i="getCapabilities",o=[],a=this.getViewerElement(),ld(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),dd(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 bs(r={}),fu(r);case 4:if(e&&e instanceof Zd){u.next=8;break}throw $a(n={}),fu(n);case 8:return o="setCapabilities",a=this.getViewerElement(),ld(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),dd(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 bs(t={}),fu(t);case 4:if(e&&e instanceof Zd){s.next=8;break}throw $a(r={}),fu(r);case 8:return n="closeSource",i=this.getViewerElement(),ld(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,dd(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.getServices();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,SQ.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==ua.MustUpgrade&&(o=null==e||null===(i=e.attrs)||void 0===i?void 0:i.ty)&&(ga(a={},o),s.t0.message=a._errorString),!t){s.next=19;break}throw s.t0;case 19:Xt.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.getServices();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 bs(a={}),l.abrupt("return",Qt.Promise.reject(fu(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 Us();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 bs(t={}),a.abrupt("return",Qt.Promise.reject(fu(t)));case 4:return r="removeImages",i=this.getViewerElement(),ld(r,i),a.prev=6,a.next=9,this._makeSureDefaultServiceInfo();case 9:if(this._defaultDSScanClient){a.next=11;break}throw Us();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={},az(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,dd(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 bs(n),s.abrupt("return",Qt.Promise.reject(fu(n)));case 4:if(0!=this.howManyImagesInBuffer){s.next=7;break}return da(n),s.abrupt("return",Qt.Promise.reject(fu(n)));case 7:if(Xt.isNumber(r)){s.next=10;break}return $a(n),s.abrupt("return",Qt.Promise.reject(fu(n)));case 10:if(r!=af.IT_BMP&&r!=af.IT_JPG&&r!=af.IT_PNG){s.next=16;break}if(!(t.length>1)){s.next=14;break}return ws(n),s.abrupt("return",Qt.Promise.reject(fu(n)));case 14:s.next=27;break;case 16:if(r!=af.IT_TIF&&r!=af.IT_PDF){s.next=20;break}s.next=27;break;case 20:if(r!=af.IT_ALL&&r!=af.IT_MULTIPAGE_PDF&&r!=af.IT_MULTIPAGE_TIF){s.next=25;break}return Cs(n),s.abrupt("return",Qt.Promise.reject(fu(n)));case 25:return Ga(n),s.abrupt("return",Qt.Promise.reject(fu(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 Us();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 bs(n),s.abrupt("return",Qt.Promise.reject(fu(n)));case 4:if(0!=this.howManyImagesInBuffer){s.next=7;break}return da(n),s.abrupt("return",Qt.Promise.reject(fu(n)));case 7:if(Xt.isNumber(t)&&Xt.isNumber(r)){s.next=10;break}return $a(n),s.abrupt("return",Qt.Promise.reject(fu(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 Us();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 Zd){o.next=5;break}throw $a(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 Zd){a.next=5;break}throw $a(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 bs(r),Qt.Promise.reject(fu(r))}if(!Xt.isFunction(t)){var n={};return ts(n),Qt.Promise.reject(fu(n))}if("onBufferChanged"==e||"OnBufferChanged"==e)this.onBufferChanged=t;else{if("onPostTransferAsync"!=e&&"OnPostTransferAsync"!=e){var i={};return qa(i),Qt.Promise.reject(fu(i))}this.onPostTransferAsync=t}return this._registEventToDefaultDS(),!0}},{key:"unregisterEvent",value:function(e,t){if(this._bDispose){var r={};return bs(r),Qt.Promise.reject(fu(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 qa(n),Qt.Promise.reject(fu(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(SQ._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(!ea()){t.next=6;break}if(this._uuidForRemoteScanObject){t.next=6;break}return t.next=4,tr.DWT.lgcuid(tr.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,k,E}(),TQ=!1;function CQ(e,t){return wQ.apply(this,arguments)}function wQ(){return wQ=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&&fc("Checking Product Key format..."),e.next=3,Zc.preParseProductKey(r);case 3:if(0==(n=tr.DWT.licenseException).code){e.next=7;break}throw t&&Vd(n),{code:n.code,message:n.message};case 7:if(TQ){e.next=15;break}if(i=!1,de.bIE&&(i=de.IEVersion<=7),i||!ea()){e.next=15;break}if(tr.DWT.IfLoadResources){e.next=14;break}return TQ=!0,e.abrupt("return");case 14:return e.abrupt("return",new Qt.Promise(function(e,t){var r=Gl(),n="";!de.bFileSystem&&tr.DWT.IfResourcesAddTimestamp&&(n=Qt.timestamp),Xt.addScript([r,"/src/dynamsoft.lts.js",n].join(""),!0,!1,function(r){if(tr.LTS&&tr.LTS._)return TQ=!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."})}TQ=!0,e()})}));case 15:case"end":return e.stop()}},e)})),wQ.apply(this,arguments)}function kQ(e,t,r){return EQ.apply(this,arguments)}function EQ(){return EQ=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=tr.DWT.Containers,o=0;case 2:if(!(o<i.length)){e.next=53;break}if(!(a=Xt.clone(i[o])).ContainerId){e.next=8;break}if(!tr.DWT.ContainerMap[a.ContainerId]){e.next=8;break}return e.abrupt("continue",50);case 8:if(!a.WebTwainId){e.next=12;break}if(!tr.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,!Xt.isDOM(a.Container)){e.next=19;break}e.next=26;break;case 19:if(!a.ContainerId){e.next=26;break}if(c=a.ContainerId,Xt.isString(c)){e.next=23;break}throw As();case 23:if(a.Container=Xt.get(c),a.Container){e.next=26;break}throw Ps(c);case 26:if(!zz(a.Container)){e.next=33;break}return l=document.createElement("div"),a.Container.appendChild(l),a.Container=l,d=Hz(l),e.next=33,Ul(d);case 33:return Ol(f=Mf(a)),h=void 0,e.prev=36,e.next=39,iQ.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=tr.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),vQ(s),oz(s)),setTimeout(function(){try{var e=0,t=tr.DWT.ContainerMap;if(t&&(e=Object.keys(t).length),0==e&&(t=tr.DWT.WebTwainIdMap)&&(e=Object.keys(t).length),0==e)return;Xt.isFunction(tr.DWT.OnWebTwainReady)?tr.DWT.OnWebTwainReady():Xt.isFunction(m.Dynamsoft_OnReady)&&m.Dynamsoft_OnReady()}catch(r){_o(r)}},10);case 56:case"end":return e.stop()}},e,null,[[36,42]])})),EQ.apply(this,arguments)}function xQ(){return AQ.apply(this,arguments)}function AQ(){return AQ=n(g().mark(function e(){var t,r,n,i,o,a,s,u,c,l,d,f,h;return g().wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if(Qt.page.bUnload=li,Qo.bHTML5Edition){e.next=3;break}return e.abrupt("return",tr.DWT._innerLoad());case 3:return e.next=5,CQ(!0,!0);case 5:if((t=tr.DWT.Containers)&&0!==t.length){e.next=10;break}throw Ts(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(Xt.isObject(i)){e.next=18;break}return o=!0,e.abrupt("break",37);case 18:if(!Xt.isString(i.WebTwainId)||""==i.WebTwainId){e.next=24;break}if(!jl(a,i.WebTwainId)){e.next=23;break}throw Fs(r={}),{code:r._errorCode,message:r._errorString};case 23:a.push(i.WebTwainId);case 24:if(!Xt.isString(i.ContainerId)||""==i.ContainerId){e.next=30;break}if(!jl(s,i.ContainerId)){e.next=29;break}throw Ws(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 ks(u={}),{code:u._errorCode,message:u._errorString};case 41:return c={host:To(),port:tr.DWT.Port,sslPort:tr.DWT.SSLPort,bFromLoadInit:!0},e.next=44,Yf(c);case 44:if(!tr.DWT.IfCheckDCP){e.next=68;break}return l=$o(),d=l?c.sslPort:c.port,e.next=49,pf(c.host,c.port,c.sslPort);case 49:if(!(f=e.sent)){e.next=56;break}c.port=f.port,c.sslPort=f.sslPort,d=l?c.sslPort:c.port,e.next=59;break;case 56:throw xs(h={}),fu(h);case 59:if(!tr.dcp.bEnhancedMode){e.next=68;break}return e.prev=60,l=$o(),e.next=64,nc.closeWsClient(c.host,d,l);case 64:e.next=68;break;case 66:e.prev=66,e.t0=e["catch"](60);case 68:return fc("Creating WebTwain from Dynamsoft.DWT.Containers..."),e.next=71,kQ(c.host,c.port,c.sslPort);case 71:case"end":return e.stop()}},e,null,[[60,66]])})),AQ.apply(this,arguments)}var PQ=new(function(){return s(function e(){o(this,e)},[{key:"InvalidValue",value:function(e){la(e)}},{key:"ParameterCannotEmpty",value:function(e){ka(e)}},{key:"ParameterNotDWTObject",value:function(e){oa(e,-2908,"The parameter is not a Dynamic Web TWAIN object.")}},{key:"Webcam_InvalidIndex",value:function(e,t){oa(e,-2315,"The index is out of range.")}},{key:"Webcam_InvalidRemoteFilename",value:function(e){oa(e,-2316,"The RemoteFile field is empty in the Webcam Download Function.")}},{key:"InvalidDestination",value:function(e){oa(e,-2318,"Invalid destination file.")}},{key:"InvalidSourceFile",value:function(e){oa(e,-2319,"Invalid source file.")}},{key:"InvalidFile",value:function(e){Ea(e)}},{key:"OCR_InvalidIndex",value:function(e,t){oa(e,-2321,"The index is out of range.")}},{key:"OCR_InvalidLeftOrTopOrRightOrBottom",value:function(e){oa(e,-2322,"The left or top or right or bottom you entered is invalid.")}},{key:"OCR_InvalidOutputFormat",value:function(e){oa(e,-2323,"The OCR output format is not supported.")}},{key:"OCR_InvalidPageSetMode",value:function(e){oa(e,-2324,"The OCR page set mode is not supported.")}},{key:"IndexOutOfRange",value:function(e){Va(e)}},{key:"IndicesNotArray",value:function(e){Ua(e)}},{key:"InvalidParameter",value:function(e){$a(e)}},{key:"IndicesCannotEmpty",value:function(e){Ra(e)}},{key:"IndexNullOrUndefined",value:function(e){ja(e)}},{key:"InvalidIndex",value:function(e){ca(e)}},{key:"IndicesOutOfRange",value:function(e){La(e)}},{key:"OCR_InvalidRemoteFilename",value:function(e){oa(e,-2379,"The RemoteFile field is empty in the OCR Download Function.")}},{key:"ImageEditorOpenCannotPlayVideo",value:function(e){oa(e,-2437,"The video can not be played while the Image Editor is open.")}},{key:"EventNotExist",value:function(e){oa(e,-2509,"The specified event doesn't exist.")}},{key:"CallbackNotAFunction",value:function(e){ts(e)}},{key:"WasmNotLoaded",value:function(e){oa(e,-2537,"The wasm not loaded.")}},{key:"WasmNotLoaded_UseWasmFalse",value:function(e){oa(e,-2538,"The wasm not loaded when Dynamsoft.DWT.UseCameraAddonWasm is set to false.")}},{key:"CannotDoWhenNoViewerJS",value:function(e){os(e)}},{key:"LicenseNoDbr",value:function(e){oa(e,-2611,"The license for the Barcode module is invalid."),aa(e)}},{key:"OCR_InvalidSupportedPlatforms",value:function(e){oa(e,-2701,"The OCR Kit feature is only supported on x64 versions of Windows.")}},{key:"OCRKit_InvalidFilename",value:function(e){oa(e,-2702,"Invalid filename.")}}])}());if(Qo.bHTML5Edition){var DQ=function(){var e=n(g().mark(function t(e){var r,n,i,o,a,s,u,c,l,d,f,h,m,p;return g().wrap(function(t){for(;;)switch(t.prev=t.next){case 0:return tJ(),t.next=3,CQ(!0,!1);case 3:if(tr.DWT.UseDefaultViewer||(e.Container=null),!zz(e.Container)){t.next=11;break}return n=document.createElement("div"),e.Container.appendChild(n),e.Container=n,i=Hz(n),t.next=11,Ul(i);case 11:return(r=Mf(e)).bFromLoadInit=!1,t.next=15,aJ();case 15:if(!tr.DWT.UseDefaultViewer){t.next=23;break}if(u=r.id,c=null===(o=r.container)||void 0===o?void 0:o.id,!(a=tr.DWT.GetWebTwain(u))&&c&&(s=tr.DWT.GetWebTwain(c)),!a&&!s){t.next=23;break}throw l={},a?Fs(l):Ws(l),{code:l._errorCode,message:l._errorString};case 23:d=3,f=0;case 25:if(!(f<d)){t.next=42;break}return t.prev=26,t.next=29,Yf(r);case 29:return t.abrupt("break",42);case 32:if(t.prev=32,t.t0=t["catch"](26),!(f<d-1&&t.t0.code==ua.DWTPortNotReady)){t.next=38;break}return t.next=37,new Qt.Promise(function(e,t){setTimeout(function(){e()},300)});case 37:return t.abrupt("continue",39);case 38:throw t.t0;case 39:f++,t.next=25;break;case 42:if(!tr.DWT.IfCheckDCP){t.next=54;break}return t.next=45,pf(r.host,r.port,r.sslPort);case 45:if(!(h=t.sent)){t.next=51;break}r.port=h.port,r.sslPort=h.sslPort,t.next=54;break;case 51:throw xs(m={}),fu(m);case 54:return fc("Creating a WebTwain instance..."),t.next=57,gQ(r);case 57:return p=t.sent,t.abrupt("return",p);case 59:case"end":return t.stop()}},t,null,[[26,32]])}));return function(t){return e.apply(this,arguments)}}(),FQ=window;tr.DWT.OnBeforeUnload=function(e){},FQ.addEventListener("beforeunload",function(e){if(Qt.isFunction(tr.DWT.OnBeforeUnload))return tr.DWT.OnBeforeUnload(e)}),tr.DWT.Unload=n(g().mark(function e(){var t;return g().wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if(!Qo.bDWTLoading&&!Qo.bDWTUnloading){e.next=2;break}return e.abrupt("return");case 2:return Qo.bDWTUnloading=!0,e.prev=3,e.next=6,WQ(!1,!0);case 6:e.next=11;break;case 8:e.prev=8,e.t0=e["catch"](3),t=e.t0;case 11:try{RQ(),tr.DWT.CloseDialog(),Qt._zdgb_xkz_dhk(),Qt.unloadProgress(),Qt.hideMask(),tr.DWT.lts_unload()}catch(HQ){}if(Qo.bDWTLoading=!1,Qo.bDWTUnloading=!1,Qo.loadingResourcePath=!1,!t){e.next=17;break}throw t;case 17:case"end":return e.stop()}},e,null,[[3,8]])})),tr.DWT.Load=n(g().mark(function t(){var e,r;return g().wrap(function(t){for(;;)switch(t.prev=t.next){case 0:if(!Qo.bDWTLoading){t.next=2;break}return t.abrupt("return");case 2:if(!Qo.bDWTUnloading){t.next=5;break}return setTimeout(tr.DWT.Load,500),t.abrupt("return");case 5:return Qo.bDWTLoading=!0,OQ(),t.prev=7,t.prev=8,t.next=11,mJ();case 11:return t.next=13,aJ();case 13:t.next=19;break;case 15:throw t.prev=15,t.t0=t["catch"](8),Md(t.t0),t.t0;case 19:return t.prev=19,tr.Lib.closeProgress(),t.next=23,WQ(!0,!0);case 23:t.next=29;break;case 25:return t.prev=25,t.t1=t["catch"](19),t.next=29,WQ();case 29:t.prev=29,tr.DWT.CloseDialog(),e=3,r=0;case 33:if(!(r<e)){t.next=50;break}return t.prev=34,t.next=37,xQ();case 37:return t.abrupt("break",50);case 40:if(t.prev=40,t.t2=t["catch"](34),!(r<e-1&&t.t2.code==ua.DWTPortNotReady)){t.next=46;break}return t.next=45,new Qt.Promise(function(e,t){setTimeout(function(){e()},300)});case 45:return t.abrupt("continue",47);case 46:throw t.t2;case 47:r++,t.next=33;break;case 50:t.next=64;break;case 52:return t.prev=52,t.t3=t["catch"](29),Bd(t.t3.code)||Qt.detect.bOK||Kl.pushToDo(null,tr.DWT.Load),Md(t.t3),t.prev=57,t.next=60,WQ();case 60:t.next=64;break;case 62:t.prev=62,t.t4=t["catch"](57);case 64:return t.prev=64,Qo.bDWTLoading=!1,RQ(),t.finish(64);case 68:case"end":return t.stop()}},t,null,[[7,,64,68],[8,15],[19,25],[29,52],[34,40],[57,62]])})),tr.DWT.CheckConnectToTheService=th,Qo.loadqueue=Kl,tr.DWT.ConnectToTheService=function(){Kl.start()},tr.DWT.CreateDWTObject=function(e,t,r,n,i,o){var a,s=i,u=o;Xt.isFunction(t)&&Xt.isFunction(r)?(s=t,u=r,a={}):a={Host:t,Port:r,SSLPort:n};var c,l=e;if(Xt.isString(l)&&!(l=Xt.get(l)))return function(e){oa(e,-2813,Ki)}(c={}),u&&u({code:c._errorCode,message:c._errorString}),li;if(Xt.isDOM(l))a.Container=l;else{if(!Xt.isString(e)){var d={code:-2806,message:'Error: The argument passed to the parameter "conatinerId" is not a string.'};return Xt.isFunction(u)&&u(d),li}if(!Xt.get(e)){var f=Ps(e);return Xt.isFunction(u)&&u(f),li}}return a.WebTwainId=ud(),tr.DWT.CreateDWTObjectEx(a,s,u)},tr.DWT.CreateDWTObjectEx=function(e,t,r){Kl.pushToDo(tr.DWT,"_QueuedCreateDWTObject",[e,t,r]),Kl.start()},tr.DWT._QueuedCreateDWTObject=function(e,t,r){var n=arguments,i=!!e.bLoadingDialogOpened;return Qo.loadResourcePath?Xt.isString(e.WebTwainId)?(i||OQ(),delete e.bLoadingDialogOpened,DQ(e).then(function(e){RQ(),oz(e),Xt.isFunction(t)&&t(e)},function(e){if(RQ(),!Qt.detect.bOK){var t=e&&e.code,i=tr.DWT.licenseException;(t&&!Bd(t)||0==i.code)&&(Kl.stop(),setTimeout(function(){Kl.pushToDo(tr.DWT,"_QueuedCreateDWTObject",n)},100))}Xt.isFunction(r)&&r(e)}),!0):(i&&RQ(),r&&r({code:-2805,message:'Error: The "WebTwainId" is not a string.'}),li):(i||(OQ(),e.bLoadingDialogOpened=!0),void mJ().then(aJ).then(function(){setTimeout(function(){tr.DWT._QueuedCreateDWTObject(e,t,r)},100)},function(e){RQ(),r(e)}))},tr.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 $a(n={}),{code:n._errorCode,message:n._errorString};case 5:return Qo.bDWTLoading=!0,OQ(),t.prev=7,t.next=10,aJ(!0);case 10:return t.next=12,CQ(!1,!1);case 12:r=new bQ(e),Object.preventExtensions(r);case 14:return t.prev=14,Qo.bDWTLoading=!1,RQ(),t.finish(14);case 18:return t.abrupt("return",r);case 19:case"end":return t.stop()}},t,null,[[7,,14,18]])}));return function(t){return e.apply(this,arguments)}}(),tr.DWT.DeleteDWTObject=function(e){var t,r=e;return Qo.bHTML5Edition&&r?!!(t=Xt.isString(r)?tr.DWT.GetWebTwain(r):r)&&(t.dispose(),!0):li}}function WQ(e,t){return NQ.apply(this,arguments)}function NQ(){return NQ=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&&fc("Unload..."),!r){e.next=4;break}return e.next=4,tr.DWT.lunload();case 4:if(Qt.dlgProgress=!1,Qt.detect.bOK=!1,Qt.detect.bFirst=!0,!(a=tr.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=tr.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=tr.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<Qo.unloadQueue.length;n++)c=Qo.unloadQueue[n],Xt.isFunction(c)&&c();if(Qo.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]])})),NQ.apply(this,arguments)}function OQ(){Qo.bHTML5Edition&&(Vz(),ld("openLoadingMsg",null,{width:Qt.loaderBarWidth+"px"}))}function RQ(){Qo.bHTML5Edition&&dd("closeLoadingMsg:")}function MQ(e,t){var r,n=this,i=0;(r=Xt.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||MQ.Orientation.Horizontal,n.direction=t.direction||MQ.Direction.LeftToRight,n.creationType=t.creationType||MQ.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==MQ.Orientation.Horizontal&&n.borderRadius>n.height/2&&(n.borderRadius=Math.round(n.height/2)),Xt.isNumber(n.width)&&n.orientation==MQ.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==MQ.CreationType.Replace?n.parentElement=r:(n.parentElement=document.createElement("DIV"),r.appendChild(n.parentElement)),n.finishLoading()}Qt.Errors=PQ,uK(n(g().mark(function oq(){var e,t,r,n;return g().wrap(function(i){for(;;)switch(i.prev=i.next){case 0:if((e=window)&&(Xt.addEventListener(e,"focus",function(){var e;(e=tr.DWT.WebTwainIdMap)&&Xt.each(e,function(e,t){e&&e._OnPageFocus&&e._OnPageFocus()})}),Xt.addEventListener(e,"blur",function(){de.bWin&&pJ()}),t=e.document,Xt.addEventListener(t,"visibilitychange",function(){de.bWin&&"hidden"==t.visibilityState&&pJ()})),tr.navInfo){i.next=11;break}return i.prev=3,i.next=6,Xz();case 6:tr.navInfo=i.sent,i.next=11;break;case 9:i.prev=9,i.t0=i["catch"](3);case 11:if(!1!==tr.DWT.AutoLoad&&!Qo.bDWTLoading){i.next=13;break}return i.abrupt("return");case 13:return i.prev=13,i.next=16,mJ();case 16:if(!(tr.DWT.Containers&&tr.DWT.Containers.length>0&&tr.DWT.AutoLoad)||Qo.bDWTLoading){i.next=46;break}return Qo.bDWTLoading=!0,OQ(),i.prev=20,i.next=23,aJ(!0);case 23:r=3,n=0;case 25:if(!(n<r)){i.next=42;break}return i.prev=26,i.next=29,xQ();case 29:return i.abrupt("break",42);case 32:if(i.prev=32,i.t1=i["catch"](26),!(n<r-1&&i.t1.code==ua.DWTPortNotReady)){i.next=38;break}return i.next=37,new Qt.Promise(function(e,t){setTimeout(function(){e()},300)});case 37:return i.abrupt("continue",39);case 38:throw i.t1;case 39:n++,i.next=25;break;case 42:return i.prev=42,Qo.bDWTLoading=!1,RQ(),i.finish(42);case 46:i.next=60;break;case 48:return i.prev=48,i.t2=i["catch"](13),Bd(i.t2.code)||Qt.detect.bOK||Kl.pushToDo(null,tr.DWT.Load),Md(i.t2),i.prev=53,i.next=56,WQ();case 56:i.next=60;break;case 58:i.prev=58,i.t3=i["catch"](53);case 60:case"end":return i.stop()}},oq,null,[[3,9],[13,48],[20,,42,46],[26,32],[53,58]])}))),MQ.Orientation={Horizontal:0,Vertical:1},MQ.Direction={LeftToRight:0,RightToLeft:1,TopToBottom:0,BottomToTop:1},MQ.CreationType={Replace:0,AppendChild:1},MQ.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},MQ.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+MQ._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=MQ._elementCurrentStyle(t.backgroundElement,r[n]))&&"string"!=typeof i);n++);""!=i&&MQ._parseInt(i)!=t.borderRadius&&(t.borderRadius=MQ._parseInt(i)),t.orientation==MQ.Orientation.Horizontal||t.orientation==MQ.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=Xt.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+MQ._createBorderRadiusCss(t.borderRadius),t.parentElement.appendChild(e),t.borderWidth={left:MQ._parseInt(MQ._elementCurrentStyle(e,"border-left-width")),right:MQ._parseInt(MQ._elementCurrentStyle(e,"border-right-width")),top:MQ._parseInt(MQ._elementCurrentStyle(e,"border-top-width")),bottom:MQ._parseInt(MQ._elementCurrentStyle(e,"border-bottom-width"))}):1==t.displayType&&(t.orientation==MQ.Orientation.Horizontal?Xt.isNumber(t.width)&&t.borderRadius>t.width/2&&(t.borderRadius=t.width):t.orientation==MQ.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==MQ.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+MQ._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+MQ._createBorderRadiusCss(0,t.borderRadius,t.borderRadius,0),t.middleElement.style.width=Xt.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==MQ.Orientation.Vertical&&(t.leftElement.style.width=Xt.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+MQ._createBorderRadiusCss(t.borderRadius,t.borderRadius,0,0),t.rightElement.style.width=Xt.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+MQ._createBorderRadiusCss(0,0,t.borderRadius,t.borderRadius),t.middleElement.style.width=Xt.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=Xt.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==MQ.Orientation.Horizontal?t.borderWidth={left:MQ._parseInt(MQ._elementCurrentStyle(t.leftElement,"border-left-width")),right:MQ._parseInt(MQ._elementCurrentStyle(t.rightElement,"border-right-width")),top:MQ._parseInt(MQ._elementCurrentStyle(t.middleElement,"border-top-width")),bottom:MQ._parseInt(MQ._elementCurrentStyle(t.middleElement,"border-bottom-width"))}:t.orientation==MQ.Orientation.Vertical&&(t.borderWidth={left:MQ._parseInt(MQ._elementCurrentStyle(t.middleElement,"border-left-width")),right:MQ._parseInt(MQ._elementCurrentStyle(t.middleElement,"border-right-width")),top:MQ._parseInt(MQ._elementCurrentStyle(t.leftElement,"border-top-width")),bottom:MQ._parseInt(MQ._elementCurrentStyle(t.rightElement,"border-bottom-width"))})),Xt.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",Xt.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&&Xt.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=Xt.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()},MQ.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(Xt.isString(i)){var o=ui.one(".dynamsoft-progressBar");o&&o.getEL()&&(i=o.getEL().offsetWidth)}if(t.orientation==MQ.Orientation.Horizontal){n=t.value/t.maxValue*i,t.progressPosition=n,0==t.displayType||1==t.displayType&&(t.direction==MQ.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!=MQ.AnimationStyle.StaticFull&&t.animationStyle!=MQ.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!=MQ.AnimationStyle.StaticFull&&t.animationStyle!=MQ.AnimationStyle.CustomFull&&(t.markerElement.style.visibility="hidden")),t.animationStyle!=MQ.AnimationStyle.StaticFull&&t.animationStyle!=MQ.AnimationStyle.CustomFull?t.direction==MQ.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+MQ._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==MQ.Direction.LeftToRight?t.markerElement.style.cssText=t.markerElement.style.cssText+MQ._createBorderRadiusCss(t.borderRadius,0,0,t.borderRadius):t.markerElement.style.cssText=t.markerElement.style.cssText+MQ._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==MQ.Direction.LeftToRight?t.markerElement.style.cssText=t.markerElement.style.cssText+MQ._createBorderRadiusCss(t.borderRadius,r,r,t.borderRadius):t.markerElement.style.cssText=t.markerElement.style.cssText+MQ._createBorderRadiusCss(r,t.borderRadius,t.borderRadius,r)):(t.markerElement.style.top=a+"px",t.markerElement.style.height=t.height+"px",t.direction==MQ.Direction.LeftToRight?t.markerElement.style.cssText=t.markerElement.style.cssText+MQ._createBorderRadiusCss(t.borderRadius,0,0,t.borderRadius):t.markerElement.style.cssText=t.markerElement.style.cssText+MQ._createBorderRadiusCss(0,t.borderRadius,t.borderRadius,0))}else if(t.orientation==MQ.Orientation.Vertical){n=t.value/t.maxValue*t.height,t.progressPosition=n,0==t.displayType||1==t.displayType&&(t.direction==MQ.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!=MQ.AnimationStyle.StaticFull&&t.animationStyle!=MQ.AnimationStyle.CustomFull?t.markerElement.style.height=n+"px":(t.markerElement.style.height=t.height+"px",t.markerElement.style.cssText=t.markerElement.style.cssText+MQ._createBorderRadiusCss(t.borderRadius)),t.markerElement.style.visibility="visible"):(t.markerElement.style.height="0px",t.animationStyle!=MQ.AnimationStyle.StaticFull&&t.animationStyle!=MQ.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+MQ._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==MQ.Direction.BottomToTop?t.markerElement.style.cssText=t.markerElement.style.cssText+MQ._createBorderRadiusCss(0,0,t.borderRadius,t.borderRadius):t.markerElement.style.cssText=t.markerElement.style.cssText+MQ._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==MQ.Direction.BottomToTop?t.markerElement.style.cssText=t.markerElement.style.cssText+MQ._createBorderRadiusCss(r,r,t.borderRadius,t.borderRadius):t.markerElement.style.cssText=t.markerElement.style.cssText+MQ._createBorderRadiusCss(t.borderRadius,t.borderRadius,r,r)):(t.markerElement.style.left=c+"px",t.markerElement.style.width=i+"px",t.direction==MQ.Direction.BottomToTop?t.markerElement.style.cssText=t.markerElement.style.cssText+MQ._createBorderRadiusCss(0,0,t.borderRadius,t.borderRadius):t.markerElement.style.cssText=t.markerElement.style.cssText+MQ._createBorderRadiusCss(t.borderRadius,t.borderRadius,0,0));t.animationStyle!=MQ.AnimationStyle.StaticFull&&t.animationStyle!=MQ.AnimationStyle.CustomFull?t.direction==MQ.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()},MQ._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)},MQ._parseInt=function(e){var t=parseInt(e);return isNaN(t)&&(t=0),t},MQ._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 LQ=function(){return s(function e(){o(this,e),c(this,"handlers",{})},[{key:"on",value:function(e,t){var r=Xt.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={}}}])}(),BQ=tr.DWT;Qt.ProgressBar=MQ,Qt.progressMessage="",Qt.dialogShowStatus=!1,Qt.needShowTwiceShowDialog=!1,Qt.dlgProgress=!1,Qt.cancelFrom=jH.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=ui.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=ui.one(".dynamsoft-progressBar"),o=i&&i.getEL();o&&(o.objProgressBar=new MQ(o,{height:20}));var a=ui.one(".ds-dwt-progressWrap").getEL();a&&(a.style.boxSizing="content-box")}(t=ui.one(".dynamsoft-dwt-dialogProgress"))&&t.getEL()&&(Qt.dlgProgress=t[0],ui.dialog.setup(Qt.dlgProgress)),Qt.dlgRef=0,Qt.dialogShowStatus=!1,Qt.cancelFrom=jH.Other}},Qt.unloadProgress=function(){Qt.closeProgress(null,"");var e=ui.one(".dynamsoft-dwt-dialogProgress");if(e&&e.getEL()){var t=e.getEL();t.show=null,t.showModal=null,t.close=null,t._dlgInfo={},t.parentNode.removeChild(t)}Qt.dlgProgress=null},Qt.showProgressMsg=function(){};var UQ=function(e){function t(){return o(this,t),i(this,t,arguments)}return f(t,e),s(t)}(LQ);Qt.progressContext=new UQ;var VQ=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=tr.DWT.IfConfineMaskWithinTheViewer)?i._isNoViewer&&i._isNoViewer()?o=document.body:i._containerElement?o=i._containerElement:tr.DWT.Containers&&tr.DWT.Containers.length>0&&tr.DWT.Containers[0].ContainerId&&(o=Xt.get(tr.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})}Xt.log("showProgress:"+t+",bCancel:"+r),Qt.dlgProgress&&o.appendChild(Qt.dlgProgress),iu(r);var l=ui.one(".dynamsoft-btnCancel");if(l&&l.getEL()&&(Xt.removeEventListener(l[0],"click",VQ),Xt.addEventListener(l[0],"click",VQ)),0==Qt.dialogShowStatus){Qt.dlgProgress&&(n&&o&&o!==document.body?ui.dialog.setup(Qt.dlgProgress,!0):ui.dialog.setup(Qt.dlgProgress),Qt.dlgProgress.showModal()),Qt.dialogShowStatus=!0;var d=ui.one(".dynamsoft-finalMessage"),f=ui.one(".dynamsoft-progressBar"),h=f&&f.getEL(),g=ui.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;Xt.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=jH.Other)},BQ.RemoveAllAuthorizations=function(){var e=cf.item("DWT_port"),t="http://";return"true"==cf.item("DWT_ssl")&&(t="https://"),Ui({method:"GET",xhrFields:{withCredentials:!0},url:[t,To(),":",e,"/dwt/",Qo.getDWTPrefix(),Qo.getServerVersionInfo(),"/RemoveAllAuthorizations?t=",Xt.now()].join(""),async:!0}),!0};var jQ={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=ui.one(".dynamsoft-progressBar"),u=ui.one(".dynamsoft-status"),c=ui.one(".dynamsoft-finalMessage"),l=ui.one(".dynamsoft-desc");if(tr.DWT.UseDefaultViewer&&tr.DWT.IfConfineMaskWithinTheViewer&&o&&(s=ui.one(".dynamsoft-progressBar",o),u=ui.one(".dynamsoft-status",o),c=ui.one(".dynamsoft-finalMessage",o),l=ui.one(".dynamsoft-desc",o)),Qt.cancelFrom==jH.FTPUpload||Qt.cancelFrom==jH.FTPDownload){var d=r;0==d?Qt.setBtnCancelVisibleForProgress(!1):1==d&&Qt.setBtnCancelVisibleForProgress(!0)}else Qt.cancelFrom==jH.HTTPUpload||Qt.cancelFrom==jH.LoadImage||Qt.cancelFrom==jH.HTTPPut?"Processing..."==t&&Qt.setBtnCancelVisibleForProgress(!1):Qt.cancelFrom==jH.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,Xt.each(jQ,function(e,t){-1!=e.indexOf(f)&&(a=Uz.customProgressText[t]+h)}),""==a&&(a="&nbsp;"),c.html(a)}if(i?""==i||Xt.isUndefined(i)?(i="&nbsp;",l&&l.hide&&l.hide()):(Xt.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>=100&&(g=100),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.detect.onNoControl=function(e,t,r,n){n&&n._bRemoteMode&&!n._bNotShowMessage?Xt.isFunction(tr.OnRemoteWebTwainNotFoundCallback)&&tr.OnRemoteWebTwainNotFoundCallback(Qo.name,n._serverInfo.server,n._serverInfo.port,n._serverInfo.ssl,env.bMobile):(Uf(e,t,r),Vf(!1))},(Qt.__ver||0)<Zt&&(Xt.mix(Qt,ui),Qt.__ver=Zt),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=20251210194900",Xt.mix(Qt,ci),Qt.ajax=Ui,Qt.fetch=nu,Qt.detect.showMask=Wl,Qt.detect.hideMask=Nl,Qt.env=Lo,Qt.product=Qo,Qt.scannerInfo=qo,Qt.License=Zc,Qt.BIO=El,Qt.UI.ImageUIView=qz,Qt.UI.ImageManager=Yz,tr.MSG=Fl,Qt.domReady=uK,function aq(){if(!window||document&&document.body){var e=document;if(e.readyState!==iK)if(oK(window,nK,sK),eK){var t=function(){aK(e,tK,t),sK()};oK(e,tK,t)}else{var r,n,i,o=function(){e.readyState===iK&&(aK(e,rK,o),sK())};oK(e,rK,o),n=e&&e.documentElement,i=n&&n.doScroll;try{r=null===window.frameElement}catch(TH){r=!1}if(i&&r){var a=function(){try{i("left"),setTimeout(sK,30)}catch(e){setTimeout(a,40)}};a()}}else sK()}else setTimeout(aq,100)}(),uK(function(){if(tr.DWT.CustomizableDisplayInfo||(tr.DWT.CustomizableDisplayInfo=Uz),de.bIE){tr.DWT.CustomizableDisplayInfo.loaderBarSourceIE||(tr.DWT.CustomizableDisplayInfo.loaderBarSourceIE=Bz.loaderBarSourceIE);try{document.execCommand("BackgroundImageCache",!1,!0)}catch(TH){}}}),tr.Ready=function(e){if(!tr.navInfo)return Xz().then(function(t){tr.navInfo=t;try{e()}catch(TH){throw Xt.log(TH.stack||TH,"error"),TH}});try{e()}catch(TH){throw Xt.log(TH.stack||TH,"error"),TH}}}({mapPackageRegister:null,CoreModule:null});

}
