!function(t,e){"object"==typeof exports&&"object"==typeof module?module.exports=e():"function"==typeof define&&define.amd?define([],e):"object"==typeof exports?exports.Tesseract=e():t.Tesseract=e()}(window,function(){return function(t){var e={};function r(i){if(e[i])return e[i].exports;var n=e[i]={i:i,l:!1,exports:{}};return t[i].call(n.exports,n,n.exports,r),n.l=!0,n.exports}return r.m=t,r.c=e,r.d=function(t,e,i){r.o(t,e)||Object.defineProperty(t,e,{enumerable:!0,get:i})},r.r=function(t){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},r.t=function(t,e){if(1&e&&(t=r(t)),8&e)return t;if(4&e&&"object"==typeof t&&t&&t.__esModule)return t;var i=Object.create(null);if(r.r(i),Object.defineProperty(i,"default",{enumerable:!0,value:t}),2&e&&"string"!=typeof t)for(var n in t)r.d(i,n,function(e){return t[e]}.bind(null,n));return i},r.n=function(t){var e=t&&t.__esModule?function(){return t.default}:function(){return t};return r.d(e,"a",e),e},r.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},r.p="",r(r.s=5)}([function(t,e,r){"use strict";(function(t){ /*! * The buffer module from node.js, for the browser. * * @author Feross Aboukhadijeh * @license MIT */ var i=r(16),n=r(17),s=r(18);function o(){return h.TYPED_ARRAY_SUPPORT?2147483647:1073741823}function a(t,e){if(o()=o())throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+o().toString(16)+" bytes");return 0|t}function d(t,e){if(h.isBuffer(t))return t.length;if("undefined"!=typeof ArrayBuffer&&"function"==typeof ArrayBuffer.isView&&(ArrayBuffer.isView(t)||t instanceof ArrayBuffer))return t.byteLength;"string"!=typeof t&&(t=""+t);var r=t.length;if(0===r)return 0;for(var i=!1;;)switch(e){case"ascii":case"latin1":case"binary":return r;case"utf8":case"utf-8":case void 0:return Y(t).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return 2*r;case"hex":return r>>>1;case"base64":return N(t).length;default:if(i)return Y(t).length;e=(""+e).toLowerCase(),i=!0}}function m(t,e,r){var i=t[e];t[e]=t[r],t[r]=i}function y(t,e,r,i,n){if(0===t.length)return-1;if("string"==typeof r?(i=r,r=0):r>2147483647?r=2147483647:r<-2147483648&&(r=-2147483648),r=+r,isNaN(r)&&(r=n?0:t.length-1),r<0&&(r=t.length+r),r>=t.length){if(n)return-1;r=t.length-1}else if(r<0){if(!n)return-1;r=0}if("string"==typeof e&&(e=h.from(e,i)),h.isBuffer(e))return 0===e.length?-1:g(t,e,r,i,n);if("number"==typeof e)return e&=255,h.TYPED_ARRAY_SUPPORT&&"function"==typeof Uint8Array.prototype.indexOf?n?Uint8Array.prototype.indexOf.call(t,e,r):Uint8Array.prototype.lastIndexOf.call(t,e,r):g(t,[e],r,i,n);throw new TypeError("val must be string, number or Buffer")}function g(t,e,r,i,n){var s,o=1,a=t.length,h=e.length;if(void 0!==i&&("ucs2"===(i=String(i).toLowerCase())||"ucs-2"===i||"utf16le"===i||"utf-16le"===i)){if(t.length<2||e.length<2)return-1;o=2,a/=2,h/=2,r/=2}function f(t,e){return 1===o?t[e]:t.readUInt16BE(e*o)}if(n){var u=-1;for(s=r;sa&&(r=a-h),s=r;s>=0;s--){for(var c=!0,l=0;ln&&(i=n):i=n;var s=e.length;if(s%2!=0)throw new TypeError("Invalid hex string");i>s/2&&(i=s/2);for(var o=0;o>8,n=r%256,s.push(n),s.push(i);return s}(e,t.length-r),t,r,i)}function U(t,e,r){return 0===e&&r===t.length?i.fromByteArray(t):i.fromByteArray(t.slice(e,r))}function _(t,e,r){r=Math.min(t.length,r);for(var i=[],n=e;n239?4:f>223?3:f>191?2:1;if(n+c<=r)switch(c){case 1:f<128&&(u=f);break;case 2:128==(192&(s=t[n+1]))&&(h=(31&f)<<6|63&s)>127&&(u=h);break;case 3:s=t[n+1],o=t[n+2],128==(192&s)&&128==(192&o)&&(h=(15&f)<<12|(63&s)<<6|63&o)>2047&&(h<55296||h>57343)&&(u=h);break;case 4:s=t[n+1],o=t[n+2],a=t[n+3],128==(192&s)&&128==(192&o)&&128==(192&a)&&(h=(15&f)<<18|(63&s)<<12|(63&o)<<6|63&a)>65535&&h<1114112&&(u=h)}null===u?(u=65533,c=1):u>65535&&(u-=65536,i.push(u>>>10&1023|55296),u=56320|1023&u),i.push(u),n+=c}return function(t){var e=t.length;if(e<=k)return String.fromCharCode.apply(String,t);var r="",i=0;for(;ithis.length)return"";if((void 0===r||r>this.length)&&(r=this.length),r<=0)return"";if((r>>>=0)<=(e>>>=0))return"";for(t||(t="utf8");;)switch(t){case"hex":return T(this,e,r);case"utf8":case"utf-8":return _(this,e,r);case"ascii":return I(this,e,r);case"latin1":case"binary":return P(this,e,r);case"base64":return U(this,e,r);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return B(this,e,r);default:if(i)throw new TypeError("Unknown encoding: "+t);t=(t+"").toLowerCase(),i=!0}}.apply(this,arguments)},h.prototype.equals=function(t){if(!h.isBuffer(t))throw new TypeError("Argument must be a Buffer");return this===t||0===h.compare(this,t)},h.prototype.inspect=function(){var t="",r=e.INSPECT_MAX_BYTES;return this.length>0&&(t=this.toString("hex",0,r).match(/.{2}/g).join(" "),this.length>r&&(t+=" ... ")),""},h.prototype.compare=function(t,e,r,i,n){if(!h.isBuffer(t))throw new TypeError("Argument must be a Buffer");if(void 0===e&&(e=0),void 0===r&&(r=t?t.length:0),void 0===i&&(i=0),void 0===n&&(n=this.length),e<0||r>t.length||i<0||n>this.length)throw new RangeError("out of range index");if(i>=n&&e>=r)return 0;if(i>=n)return-1;if(e>=r)return 1;if(this===t)return 0;for(var s=(n>>>=0)-(i>>>=0),o=(r>>>=0)-(e>>>=0),a=Math.min(s,o),f=this.slice(i,n),u=t.slice(e,r),c=0;cn)&&(r=n),t.length>0&&(r<0||e<0)||e>this.length)throw new RangeError("Attempt to write outside buffer bounds");i||(i="utf8");for(var s=!1;;)switch(i){case"hex":return b(this,t,e,r);case"utf8":case"utf-8":return w(this,t,e,r);case"ascii":return v(this,t,e,r);case"latin1":case"binary":return x(this,t,e,r);case"base64":return A(this,t,e,r);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return E(this,t,e,r);default:if(s)throw new TypeError("Unknown encoding: "+i);i=(""+i).toLowerCase(),s=!0}},h.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};var k=4096;function I(t,e,r){var i="";r=Math.min(t.length,r);for(var n=e;ni)&&(r=i);for(var n="",s=e;sr)throw new RangeError("Trying to access beyond buffer length")}function R(t,e,r,i,n,s){if(!h.isBuffer(t))throw new TypeError('"buffer" argument must be a Buffer instance');if(e>n||et.length)throw new RangeError("Index out of range")}function j(t,e,r,i){e<0&&(e=65535+e+1);for(var n=0,s=Math.min(t.length-r,2);n>>8*(i?n:1-n)}function L(t,e,r,i){e<0&&(e=4294967295+e+1);for(var n=0,s=Math.min(t.length-r,4);n>>8*(i?n:3-n)&255}function O(t,e,r,i,n,s){if(r+i>t.length)throw new RangeError("Index out of range");if(r<0)throw new RangeError("Index out of range")}function C(t,e,r,i,s){return s||O(t,0,r,4),n.write(t,e,r,i,23,4),r+4}function D(t,e,r,i,s){return s||O(t,0,r,8),n.write(t,e,r,i,52,8),r+8}h.prototype.slice=function(t,e){var r,i=this.length;if((t=~~t)<0?(t+=i)<0&&(t=0):t>i&&(t=i),(e=void 0===e?i:~~e)<0?(e+=i)<0&&(e=0):e>i&&(e=i),e0&&(n*=256);)i+=this[t+--e]*n;return i},h.prototype.readUInt8=function(t,e){return e||S(t,1,this.length),this[t]},h.prototype.readUInt16LE=function(t,e){return e||S(t,2,this.length),this[t]|this[t+1]<<8},h.prototype.readUInt16BE=function(t,e){return e||S(t,2,this.length),this[t]<<8|this[t+1]},h.prototype.readUInt32LE=function(t,e){return e||S(t,4,this.length),(this[t]|this[t+1]<<8|this[t+2]<<16)+16777216*this[t+3]},h.prototype.readUInt32BE=function(t,e){return e||S(t,4,this.length),16777216*this[t]+(this[t+1]<<16|this[t+2]<<8|this[t+3])},h.prototype.readIntLE=function(t,e,r){t|=0,e|=0,r||S(t,e,this.length);for(var i=this[t],n=1,s=0;++s=(n*=128)&&(i-=Math.pow(2,8*e)),i},h.prototype.readIntBE=function(t,e,r){t|=0,e|=0,r||S(t,e,this.length);for(var i=e,n=1,s=this[t+--i];i>0&&(n*=256);)s+=this[t+--i]*n;return s>=(n*=128)&&(s-=Math.pow(2,8*e)),s},h.prototype.readInt8=function(t,e){return e||S(t,1,this.length),128&this[t]?-1*(255-this[t]+1):this[t]},h.prototype.readInt16LE=function(t,e){e||S(t,2,this.length);var r=this[t]|this[t+1]<<8;return 32768&r?4294901760|r:r},h.prototype.readInt16BE=function(t,e){e||S(t,2,this.length);var r=this[t+1]|this[t]<<8;return 32768&r?4294901760|r:r},h.prototype.readInt32LE=function(t,e){return e||S(t,4,this.length),this[t]|this[t+1]<<8|this[t+2]<<16|this[t+3]<<24},h.prototype.readInt32BE=function(t,e){return e||S(t,4,this.length),this[t]<<24|this[t+1]<<16|this[t+2]<<8|this[t+3]},h.prototype.readFloatLE=function(t,e){return e||S(t,4,this.length),n.read(this,t,!0,23,4)},h.prototype.readFloatBE=function(t,e){return e||S(t,4,this.length),n.read(this,t,!1,23,4)},h.prototype.readDoubleLE=function(t,e){return e||S(t,8,this.length),n.read(this,t,!0,52,8)},h.prototype.readDoubleBE=function(t,e){return e||S(t,8,this.length),n.read(this,t,!1,52,8)},h.prototype.writeUIntLE=function(t,e,r,i){(t=+t,e|=0,r|=0,i)||R(this,t,e,r,Math.pow(2,8*r)-1,0);var n=1,s=0;for(this[e]=255&t;++s=0&&(s*=256);)this[e+n]=t/s&255;return e+r},h.prototype.writeUInt8=function(t,e,r){return t=+t,e|=0,r||R(this,t,e,1,255,0),h.TYPED_ARRAY_SUPPORT||(t=Math.floor(t)),this[e]=255&t,e+1},h.prototype.writeUInt16LE=function(t,e,r){return t=+t,e|=0,r||R(this,t,e,2,65535,0),h.TYPED_ARRAY_SUPPORT?(this[e]=255&t,this[e+1]=t>>>8):j(this,t,e,!0),e+2},h.prototype.writeUInt16BE=function(t,e,r){return t=+t,e|=0,r||R(this,t,e,2,65535,0),h.TYPED_ARRAY_SUPPORT?(this[e]=t>>>8,this[e+1]=255&t):j(this,t,e,!1),e+2},h.prototype.writeUInt32LE=function(t,e,r){return t=+t,e|=0,r||R(this,t,e,4,4294967295,0),h.TYPED_ARRAY_SUPPORT?(this[e+3]=t>>>24,this[e+2]=t>>>16,this[e+1]=t>>>8,this[e]=255&t):L(this,t,e,!0),e+4},h.prototype.writeUInt32BE=function(t,e,r){return t=+t,e|=0,r||R(this,t,e,4,4294967295,0),h.TYPED_ARRAY_SUPPORT?(this[e]=t>>>24,this[e+1]=t>>>16,this[e+2]=t>>>8,this[e+3]=255&t):L(this,t,e,!1),e+4},h.prototype.writeIntLE=function(t,e,r,i){if(t=+t,e|=0,!i){var n=Math.pow(2,8*r-1);R(this,t,e,r,n-1,-n)}var s=0,o=1,a=0;for(this[e]=255&t;++s>0)-a&255;return e+r},h.prototype.writeIntBE=function(t,e,r,i){if(t=+t,e|=0,!i){var n=Math.pow(2,8*r-1);R(this,t,e,r,n-1,-n)}var s=r-1,o=1,a=0;for(this[e+s]=255&t;--s>=0&&(o*=256);)t<0&&0===a&&0!==this[e+s+1]&&(a=1),this[e+s]=(t/o>>0)-a&255;return e+r},h.prototype.writeInt8=function(t,e,r){return t=+t,e|=0,r||R(this,t,e,1,127,-128),h.TYPED_ARRAY_SUPPORT||(t=Math.floor(t)),t<0&&(t=255+t+1),this[e]=255&t,e+1},h.prototype.writeInt16LE=function(t,e,r){return t=+t,e|=0,r||R(this,t,e,2,32767,-32768),h.TYPED_ARRAY_SUPPORT?(this[e]=255&t,this[e+1]=t>>>8):j(this,t,e,!0),e+2},h.prototype.writeInt16BE=function(t,e,r){return t=+t,e|=0,r||R(this,t,e,2,32767,-32768),h.TYPED_ARRAY_SUPPORT?(this[e]=t>>>8,this[e+1]=255&t):j(this,t,e,!1),e+2},h.prototype.writeInt32LE=function(t,e,r){return t=+t,e|=0,r||R(this,t,e,4,2147483647,-2147483648),h.TYPED_ARRAY_SUPPORT?(this[e]=255&t,this[e+1]=t>>>8,this[e+2]=t>>>16,this[e+3]=t>>>24):L(this,t,e,!0),e+4},h.prototype.writeInt32BE=function(t,e,r){return t=+t,e|=0,r||R(this,t,e,4,2147483647,-2147483648),t<0&&(t=4294967295+t+1),h.TYPED_ARRAY_SUPPORT?(this[e]=t>>>24,this[e+1]=t>>>16,this[e+2]=t>>>8,this[e+3]=255&t):L(this,t,e,!1),e+4},h.prototype.writeFloatLE=function(t,e,r){return C(this,t,e,!0,r)},h.prototype.writeFloatBE=function(t,e,r){return C(this,t,e,!1,r)},h.prototype.writeDoubleLE=function(t,e,r){return D(this,t,e,!0,r)},h.prototype.writeDoubleBE=function(t,e,r){return D(this,t,e,!1,r)},h.prototype.copy=function(t,e,r,i){if(r||(r=0),i||0===i||(i=this.length),e>=t.length&&(e=t.length),e||(e=0),i>0&&i=this.length)throw new RangeError("sourceStart out of bounds");if(i<0)throw new RangeError("sourceEnd out of bounds");i>this.length&&(i=this.length),t.length-e=0;--n)t[n+e]=this[n+r];else if(s<1e3||!h.TYPED_ARRAY_SUPPORT)for(n=0;n>>=0,r=void 0===r?this.length:r>>>0,t||(t=0),"number"==typeof t)for(s=e;s55295&&r<57344){if(!n){if(r>56319){(e-=3)>-1&&s.push(239,191,189);continue}if(o+1===i){(e-=3)>-1&&s.push(239,191,189);continue}n=r;continue}if(r<56320){(e-=3)>-1&&s.push(239,191,189),n=r;continue}r=65536+(n-55296<<10|r-56320)}else n&&(e-=3)>-1&&s.push(239,191,189);if(n=null,r<128){if((e-=1)<0)break;s.push(r)}else if(r<2048){if((e-=2)<0)break;s.push(r>>6|192,63&r|128)}else if(r<65536){if((e-=3)<0)break;s.push(r>>12|224,r>>6&63|128,63&r|128)}else{if(!(r<1114112))throw new Error("Invalid code point");if((e-=4)<0)break;s.push(r>>18|240,r>>12&63|128,r>>6&63|128,63&r|128)}}return s}function N(t){return i.toByteArray(function(t){if((t=function(t){return t.trim?t.trim():t.replace(/^\s+|\s+$/g,"")}(t).replace(M,"")).length<2)return"";for(;t.length%4!=0;)t+="=";return t}(t))}function q(t,e,r,i){for(var n=0;n=e.length||n>=t.length);++n)e[n+r]=t[n];return n}}).call(this,r(15))},function(t,e){var r,i,n=t.exports={};function s(){throw new Error("setTimeout has not been defined")}function o(){throw new Error("clearTimeout has not been defined")}function a(t){if(r===setTimeout)return setTimeout(t,0);if((r===s||!r)&&setTimeout)return r=setTimeout,setTimeout(t,0);try{return r(t,0)}catch(e){try{return r.call(null,t,0)}catch(e){return r.call(this,t,0)}}}!function(){try{r="function"==typeof setTimeout?setTimeout:s}catch(t){r=s}try{i="function"==typeof clearTimeout?clearTimeout:o}catch(t){i=o}}();var h,f=[],u=!1,c=-1;function l(){u&&h&&(u=!1,h.length?f=h.concat(f):c=-1,f.length&&p())}function p(){if(!u){var t=a(l);u=!0;for(var e=f.length;e;){for(h=f,f=[];++c1)for(var r=1;rd&&te}function A(t,e){return w(t)&&t=e}function U(t,e){return w(t)&&t<=e}function _(t){return"string"==typeof t}function k(t){return _(t)&&""!==t}function I(t){return"[object Object]"===Object.prototype.toString.call(t)}function P(t,e){try{return t instanceof e}catch(t){return!1}}function T(t,e){var r;for(r in e)if(e.hasOwnProperty(r)){if(!1===t.hasOwnProperty(r)||typeof t[r]!=typeof e[r])return!1;if(I(t[r])&&!1===T(t[r],e[r]))return!1}return!0}function B(t){return y(t)}function S(t){return b(t)&&E(t.length,0)}function R(t){return"function"==typeof t}function j(t,e){var r;for(r=0;rr}},{n:"greaterOrEqual",f:E},{n:"lessOrEqual",f:U},{n:"inRange",f:function(t,e,r){if(e=r}},{n:"positive",f:function(t){return x(t,0)}},{n:"negative",f:function(t){return A(t,0)}},{n:"string",f:_,s:"s"},{n:"emptyString",f:function(t){return""===t},s:"s"},{n:"nonEmptyString",f:k,s:"s"},{n:"contains",f:function(t,e){return _(t)&&-1!==t.indexOf(e)},s:"s"},{n:"match",f:function(t,e){return _(t)&&!!t.match(e)},s:"s"},{n:"boolean",f:function(t){return!1===t||!0===t},s:"b"},{n:"object",f:I,s:"o"},{n:"emptyObject",f:function(t){return I(t)&&0===Object.keys(t).length},s:"o"},{n:"nonEmptyObject",f:function(t){return I(t)&&Object.keys(t).length>0},s:"o"},{n:"instanceStrict",f:P,s:"t"},{n:"instance",f:function(t,e){try{return P(t,e)||t.constructor.name===e.name||Object.prototype.toString.call(t)==="[object "+e.name+"]"}catch(t){return!1}},s:"t"},{n:"like",f:T,s:"t"},{n:"array",f:B,s:"a"},{n:"emptyArray",f:function(t){return B(t)&&0===t.length},s:"a"},{n:"nonEmptyArray",f:function(t){return B(t)&&x(t.length,0)},s:"a"},{n:"arrayLike",f:S,s:"al"},{n:"iterable",f:function(t){if(!g)return S(t);return b(t)&&R(t[Symbol.iterator])},s:"i"},{n:"date",f:function(t){return P(t,Date)&&v(t.getTime())},s:"d"},{n:"function",f:R,s:"f"},{n:"hasLength",f:function(t,e){return b(t)&&t.length===e},s:"l"}].map(function(t){var e=t.n;o[e]="Invalid "+s[t.s||"n"],a[e]=t.f}),h={apply:function(t,e){if(f.array(t),R(e))return t.map(function(t){return e(t)});return f.array(e),f.hasLength(t,e.length),t.map(function(t,r){return e[r](t)})},map:function(t,e){if(f.object(t),R(e))return function(t,e){var r={};return Object.keys(t).forEach(function(i){r[i]=e(t[i])}),r}(t,e);return f.object(e),function t(e,r){var i={};return Object.keys(r).forEach(function(n){var s=r[n];R(s)?u.assigned(e)?i[n]=!!s.m:i[n]=s(e[n]):I(s)&&(i[n]=t(e[n],s))}),i}(t,e)},all:function(t){if(B(t))return j(t,!1);return f.object(t),L(t,!1)},any:function(t){if(B(t))return j(t,!0);return f.object(t),L(t,!0)}},l=["array","arrayLike","iterable","object"],p=Array.prototype.slice,d=Number.NEGATIVE_INFINITY,m=Number.POSITIVE_INFINITY,y=Array.isArray,g="function"==typeof Symbol,h=O(h,a),f=N(C,D),u=N(M,z),c=N(function(t){var e=function(){return!!u.assigned(arguments[0])||t.apply(null,arguments)};return e.l=t.length,e.m=!0,e},function(t){if(!1===b(t))return!0;return t}),f.not=F(C,u),f.maybe=F(C,c),l.forEach(function(t){a[t].of=q([Y.bind(null,null),a[t],a,null])}),$(f,C),$(u,M),l.forEach(function(t){c[t].of=q([Y.bind(null,"maybe"),a[t],a,null]),f.maybe[t].of=F(C,c[t].of),f.not[t].of=F(C,u[t].of)}),function(n){void 0===(i=function(){return n}.call(e,r,e,t))||(t.exports=i)}(O(h,{assert:f,not:u,maybe:c}))}()},function(t,e,r){(function(t){const i=r(3),n=r(2),{defaultOptions:s}=r(25),{version:o}=r(26),a=(t,e)=>{const r=new FileReader;r.onload=(()=>{e(r.result)}),r.readAsArrayBuffer(t)},h=t=>{if(i.string(t))return fetch(n(t)).then(t=>t.arrayBuffer());if(i.instance(t,HTMLElement)){if("IMG"===t.tagName)return h(t.src);if("VIDEO"===t.tagName)return h(t.poster);if("CANVAS"===t.tagName)return new Promise(e=>{t.toBlob(t=>{a(t,e)})})}return i.instance(t,File)?new Promise(e=>{a(t,e)}):Promise.reject()};e.defaultOptions={...s,workerPath:"development"===t.env.TESS_ENV?n(`/dist/worker.dev.js?nocache=${Math.random().toString(36).slice(3)}`):`https://cdn.jsdelivr.net/gh/naptha/tesseract.js@v${o}/dist/worker.min.js`,corePath:`https://cdn.jsdelivr.net/gh/naptha/tesseract.js-core@v2.0.0-beta.5/tesseract-core${"object"==typeof WebAssembly?"":".asm"}.js`},e.spawnWorker=((t,{workerPath:e})=>{let r;if(window.Blob&&window.URL){const t=new Blob([`importScripts("${e}");`]);r=new Worker(window.URL.createObjectURL(t))}else r=new Worker(e);return r.onmessage=(({data:e})=>{t.recv(e)}),r}),e.terminateWorker=(t=>{t.worker.terminate()}),e.sendPacket=((t,e)=>{const r={...e};h(r.payload.image).then(t=>new Uint8Array(t)).then(e=>{r.payload.image=Array.from(e),t.worker.postMessage(r)})})}).call(this,r(1))},function(t,e,r){const i=r(6),n=r(24);t.exports={TesseractWorker:n,utils:i}},function(t,e,r){const i=r(7);t.exports={loadLang:r(9)({fetch:r(11),gunzip:r(13),resolveURL:r(2),...i}),readImage:r(19),cache:i}},function(t,e,r){const{set:i,get:n,del:s}=r(8);t.exports={readCache:n,writeCache:i,deleteCache:s,checkCache:t=>n(t).then(t=>void 0!==t)}},function(t,e,r){"use strict";r.r(e),r.d(e,"Store",function(){return i}),r.d(e,"get",function(){return o}),r.d(e,"set",function(){return a}),r.d(e,"del",function(){return h}),r.d(e,"clear",function(){return f}),r.d(e,"keys",function(){return u});class i{constructor(t="keyval-store",e="keyval"){this.storeName=e,this._dbp=new Promise((r,i)=>{const n=indexedDB.open(t,1);n.onerror=(()=>i(n.error)),n.onsuccess=(()=>r(n.result)),n.onupgradeneeded=(()=>{n.result.createObjectStore(e)})})}_withIDBStore(t,e){return this._dbp.then(r=>new Promise((i,n)=>{const s=r.transaction(this.storeName,t);s.oncomplete=(()=>i()),s.onabort=s.onerror=(()=>n(s.error)),e(s.objectStore(this.storeName))}))}}let n;function s(){return n||(n=new i),n}function o(t,e=s()){let r;return e._withIDBStore("readonly",e=>{r=e.get(t)}).then(()=>r.result)}function a(t,e,r=s()){return r._withIDBStore("readwrite",r=>{r.put(e,t)})}function h(t,e=s()){return e._withIDBStore("readwrite",e=>{e.delete(t)})}function f(t=s()){return t._withIDBStore("readwrite",t=>{t.clear()})}function u(t=s()){const e=[];return t._withIDBStore("readonly",t=>{(t.openKeyCursor||t.openCursor).call(t).onsuccess=function(){this.result&&(e.push(this.result.key),this.result.continue())}}).then(()=>e)}},function(t,e,r){(function(e){const i=r(10),n=t=>({TessModule:e,dataPath:r,cachePath:i,cacheMethod:n,lang:s})=>o=>{if(e){if(r)try{e.FS.mkdir(r)}catch(t){}e.FS.writeFile(`${r||"."}/${s}.traineddata`,o)}return["write","refresh",void 0].includes(n)?t.writeCache(`${i||"."}/${s}.traineddata`,o).then(()=>o):o};t.exports=(t=>({lang:r,...s})=>Promise.all(r.split("+").map((t=>({langPath:r,cachePath:s,cacheMethod:o,...a})=>h=>{let{readCache:f}=t;return["refresh","none"].includes(o)&&(f=(()=>Promise.resolve())),f(`${s||"."}/${h}.traineddata`).then(e=>void 0===e?Promise.reject():n(t)({cachePath:s,cacheMethod:o,lang:h,...a})(e)).catch(()=>{const f=e=>t.fetch(`${e}/${h}.traineddata.gz`).then(t=>t.arrayBuffer()).then(e=>t.gunzip(new Uint8Array(e))).then(n(t)({cachePath:s,cacheMethod:o,lang:h,...a}));return i(r)?f(r):e.browser?f(t.resolveURL(r)):t.readCache(`${r}/${h}.traineddata.gz`).then(e=>t.gunzip(new Uint8Array(e))).then(n(t)({cachePath:s,cacheMethod:o,lang:h,...a}))})})(t)(s))))}).call(this,r(1))},function(t,e){t.exports=function(t){if("string"!=typeof t)return!1;var e=t.match(r);if(!e)return!1;var s=e[1];if(!s)return!1;if(i.test(s)||n.test(s))return!0;return!1};var r=/^(?:\w+:)?\/\/(\S+)$/,i=/^localhost[\:?\d]*(?:[^\:?\d]\S*)?$/,n=/^[^\s\.]+\.\S{2,}$/},function(t,e,r){const{fetch:i}=r(12);t.exports=i},function(t,e,r){"use strict";r.r(e),r.d(e,"Headers",function(){return f}),r.d(e,"Request",function(){return y}),r.d(e,"Response",function(){return b}),r.d(e,"DOMException",function(){return v}),r.d(e,"fetch",function(){return x});var i={searchParams:"URLSearchParams"in self,iterable:"Symbol"in self&&"iterator"in Symbol,blob:"FileReader"in self&&"Blob"in self&&function(){try{return new Blob,!0}catch(t){return!1}}(),formData:"FormData"in self,arrayBuffer:"ArrayBuffer"in self};if(i.arrayBuffer)var n=["[object Int8Array]","[object Uint8Array]","[object Uint8ClampedArray]","[object Int16Array]","[object Uint16Array]","[object Int32Array]","[object Uint32Array]","[object Float32Array]","[object Float64Array]"],s=ArrayBuffer.isView||function(t){return t&&n.indexOf(Object.prototype.toString.call(t))>-1};function o(t){if("string"!=typeof t&&(t=String(t)),/[^a-z0-9\-#$%&'*+.^_`|~]/i.test(t))throw new TypeError("Invalid character in header field name");return t.toLowerCase()}function a(t){return"string"!=typeof t&&(t=String(t)),t}function h(t){var e={next:function(){var e=t.shift();return{done:void 0===e,value:e}}};return i.iterable&&(e[Symbol.iterator]=function(){return e}),e}function f(t){this.map={},t instanceof f?t.forEach(function(t,e){this.append(e,t)},this):Array.isArray(t)?t.forEach(function(t){this.append(t[0],t[1])},this):t&&Object.getOwnPropertyNames(t).forEach(function(e){this.append(e,t[e])},this)}function u(t){if(t.bodyUsed)return Promise.reject(new TypeError("Already read"));t.bodyUsed=!0}function c(t){return new Promise(function(e,r){t.onload=function(){e(t.result)},t.onerror=function(){r(t.error)}})}function l(t){var e=new FileReader,r=c(e);return e.readAsArrayBuffer(t),r}function p(t){if(t.slice)return t.slice(0);var e=new Uint8Array(t.byteLength);return e.set(new Uint8Array(t)),e.buffer}function d(){return this.bodyUsed=!1,this._initBody=function(t){var e;this._bodyInit=t,t?"string"==typeof t?this._bodyText=t:i.blob&&Blob.prototype.isPrototypeOf(t)?this._bodyBlob=t:i.formData&&FormData.prototype.isPrototypeOf(t)?this._bodyFormData=t:i.searchParams&&URLSearchParams.prototype.isPrototypeOf(t)?this._bodyText=t.toString():i.arrayBuffer&&i.blob&&((e=t)&&DataView.prototype.isPrototypeOf(e))?(this._bodyArrayBuffer=p(t.buffer),this._bodyInit=new Blob([this._bodyArrayBuffer])):i.arrayBuffer&&(ArrayBuffer.prototype.isPrototypeOf(t)||s(t))?this._bodyArrayBuffer=p(t):this._bodyText=t=Object.prototype.toString.call(t):this._bodyText="",this.headers.get("content-type")||("string"==typeof t?this.headers.set("content-type","text/plain;charset=UTF-8"):this._bodyBlob&&this._bodyBlob.type?this.headers.set("content-type",this._bodyBlob.type):i.searchParams&&URLSearchParams.prototype.isPrototypeOf(t)&&this.headers.set("content-type","application/x-www-form-urlencoded;charset=UTF-8"))},i.blob&&(this.blob=function(){var t=u(this);if(t)return t;if(this._bodyBlob)return Promise.resolve(this._bodyBlob);if(this._bodyArrayBuffer)return Promise.resolve(new Blob([this._bodyArrayBuffer]));if(this._bodyFormData)throw new Error("could not read FormData body as blob");return Promise.resolve(new Blob([this._bodyText]))},this.arrayBuffer=function(){return this._bodyArrayBuffer?u(this)||Promise.resolve(this._bodyArrayBuffer):this.blob().then(l)}),this.text=function(){var t,e,r,i=u(this);if(i)return i;if(this._bodyBlob)return t=this._bodyBlob,e=new FileReader,r=c(e),e.readAsText(t),r;if(this._bodyArrayBuffer)return Promise.resolve(function(t){for(var e=new Uint8Array(t),r=new Array(e.length),i=0;i-1?i:r),this.mode=e.mode||this.mode||null,this.signal=e.signal||this.signal,this.referrer=null,("GET"===this.method||"HEAD"===this.method)&&n)throw new TypeError("Body not allowed for GET or HEAD requests");this._initBody(n)}function g(t){var e=new FormData;return t.trim().split("&").forEach(function(t){if(t){var r=t.split("="),i=r.shift().replace(/\+/g," "),n=r.join("=").replace(/\+/g," ");e.append(decodeURIComponent(i),decodeURIComponent(n))}}),e}function b(t,e){e||(e={}),this.type="default",this.status=void 0===e.status?200:e.status,this.ok=this.status>=200&&this.status<300,this.statusText="statusText"in e?e.statusText:"OK",this.headers=new f(e.headers),this.url=e.url||"",this._initBody(t)}y.prototype.clone=function(){return new y(this,{body:this._bodyInit})},d.call(y.prototype),d.call(b.prototype),b.prototype.clone=function(){return new b(this._bodyInit,{status:this.status,statusText:this.statusText,headers:new f(this.headers),url:this.url})},b.error=function(){var t=new b(null,{status:0,statusText:""});return t.type="error",t};var w=[301,302,303,307,308];b.redirect=function(t,e){if(-1===w.indexOf(e))throw new RangeError("Invalid status code");return new b(null,{status:e,headers:{location:t}})};var v=self.DOMException;try{new v}catch(t){(v=function(t,e){this.message=t,this.name=e;var r=Error(t);this.stack=r.stack}).prototype=Object.create(Error.prototype),v.prototype.constructor=v}function x(t,e){return new Promise(function(r,n){var s=new y(t,e);if(s.signal&&s.signal.aborted)return n(new v("Aborted","AbortError"));var o=new XMLHttpRequest;function a(){o.abort()}o.onload=function(){var t,e,i={status:o.status,statusText:o.statusText,headers:(t=o.getAllResponseHeaders()||"",e=new f,t.replace(/\r?\n[\t ]+/g," ").split(/\r?\n/).forEach(function(t){var r=t.split(":"),i=r.shift().trim();if(i){var n=r.join(":").trim();e.append(i,n)}}),e)};i.url="responseURL"in o?o.responseURL:i.headers.get("X-Request-URL");var n="response"in o?o.response:o.responseText;r(new b(n,i))},o.onerror=function(){n(new TypeError("Network request failed"))},o.ontimeout=function(){n(new TypeError("Network request failed"))},o.onabort=function(){n(new v("Aborted","AbortError"))},o.open(s.method,s.url,!0),"include"===s.credentials?o.withCredentials=!0:"omit"===s.credentials&&(o.withCredentials=!1),"responseType"in o&&i.blob&&(o.responseType="blob"),s.headers.forEach(function(t,e){o.setRequestHeader(e,t)}),s.signal&&(s.signal.addEventListener("abort",a),o.onreadystatechange=function(){4===o.readyState&&s.signal.removeEventListener("abort",a)}),o.send(void 0===s._bodyInit?null:s._bodyInit)})}x.polyfill=!0,self.fetch||(self.fetch=x,self.Headers=f,self.Request=y,self.Response=b)},function(t,e,r){t.exports=r(14).gunzipSync},function(t,e,r){(function(t,r){/** @license zlib.js 2012 - imaya [ https://github.com/imaya/zlib.js ] The MIT License */(function(){"use strict";function i(t){throw t}var n=void 0,s=!0,o="undefined"!=typeof Uint8Array&&"undefined"!=typeof Uint16Array&&"undefined"!=typeof Uint32Array&&"undefined"!=typeof DataView;function a(t,e){this.index="number"==typeof e?e:0,this.m=0,this.buffer=t instanceof(o?Uint8Array:Array)?t:new(o?Uint8Array:Array)(32768),2*this.buffer.length<=this.index&&i(Error("invalid index")),this.buffer.length<=this.index&&this.f()}a.prototype.f=function(){var t,e=this.buffer,r=e.length,i=new(o?Uint8Array:Array)(r<<1);if(o)i.set(e);else for(t=0;t>>8&255]<<16|p[t>>>16&255]<<8|p[t>>>24&255])>>32-e:p[t]>>8-e),8>e+o)a=a<>e-i-1&1,8==++o&&(o=0,n[s++]=p[a],a=0,s===n.length&&(n=this.f()));n[s]=a,this.buffer=n,this.m=o,this.index=s},a.prototype.finish=function(){var t,e=this.buffer,r=this.index;return 0h;++h){for(var u=l=h,c=7,l=l>>>1;l;l>>>=1)u<<=1,u|=1&l,--c;f[h]=(u<>>0}var p=f;function d(t,e,r){var i,n="number"==typeof e?e:e=0,s="number"==typeof r?r:t.length;for(i=-1,n=7&s;n--;++e)i=i>>>8^y[255&(i^t[e])];for(n=s>>3;n--;e+=8)i=(i=(i=(i=(i=(i=(i=(i=i>>>8^y[255&(i^t[e])])>>>8^y[255&(i^t[e+1])])>>>8^y[255&(i^t[e+2])])>>>8^y[255&(i^t[e+3])])>>>8^y[255&(i^t[e+4])])>>>8^y[255&(i^t[e+5])])>>>8^y[255&(i^t[e+6])])>>>8^y[255&(i^t[e+7])];return(4294967295^i)>>>0}var m=[0,1996959894,3993919788,2567524794,124634137,1886057615,3915621685,2657392035,249268274,2044508324,3772115230,2547177864,162941995,2125561021,3887607047,2428444049,498536548,1789927666,4089016648,2227061214,450548861,1843258603,4107580753,2211677639,325883990,1684777152,4251122042,2321926636,335633487,1661365465,4195302755,2366115317,997073096,1281953886,3579855332,2724688242,1006888145,1258607687,3524101629,2768942443,901097722,1119000684,3686517206,2898065728,853044451,1172266101,3705015759,2882616665,651767980,1373503546,3369554304,3218104598,565507253,1454621731,3485111705,3099436303,671266974,1594198024,3322730930,2970347812,795835527,1483230225,3244367275,3060149565,1994146192,31158534,2563907772,4023717930,1907459465,112637215,2680153253,3904427059,2013776290,251722036,2517215374,3775830040,2137656763,141376813,2439277719,3865271297,1802195444,476864866,2238001368,4066508878,1812370925,453092731,2181625025,4111451223,1706088902,314042704,2344532202,4240017532,1658658271,366619977,2362670323,4224994405,1303535960,984961486,2747007092,3569037538,1256170817,1037604311,2765210733,3554079995,1131014506,879679996,2909243462,3663771856,1141124467,855842277,2852801631,3708648649,1342533948,654459306,3188396048,3373015174,1466479909,544179635,3110523913,3462522015,1591671054,702138776,2966460450,3352799412,1504918807,783551873,3082640443,3233442989,3988292384,2596254646,62317068,1957810842,3939845945,2647816111,81470997,1943803523,3814918930,2489596804,225274430,2053790376,3826175755,2466906013,167816743,2097651377,4027552580,2265490386,503444072,1762050814,4150417245,2154129355,426522225,1852507879,4275313526,2312317920,282753626,1742555852,4189708143,2394877945,397917763,1622183637,3604390888,2714866558,953729732,1340076626,3518719985,2797360999,1068828381,1219638859,3624741850,2936675148,906185462,1090812512,3747672003,2825379669,829329135,1181335161,3412177804,3160834842,628085408,1382605366,3423369109,3138078467,570562233,1426400815,3317316542,2998733608,733239954,1555261956,3268935591,3050360625,752459403,1541320221,2607071920,3965973030,1969922972,40735498,2617837225,3943577151,1913087877,83908371,2512341634,3803740692,2075208622,213261112,2463272603,3855990285,2094854071,198958881,2262029012,4057260610,1759359992,534414190,2176718541,4139329115,1873836001,414664567,2282248934,4279200368,1711684554,285281116,2405801727,4167216745,1634467795,376229701,2685067896,3608007406,1308918612,956543938,2808555105,3495958263,1231636301,1047427035,2932959818,3654703836,1088359270,936918e3,2847714899,3736837829,1202900863,817233897,3183342108,3401237130,1404277552,615818150,3134207493,3453421203,1423857449,601450431,3009837614,3294710456,1567103746,711928724,3020668471,3272380065,1510334235,755167117],y=o?new Uint32Array(m):m;function g(){}function b(t){this.buffer=new(o?Uint16Array:Array)(2*t),this.length=0}function w(t){var e,r,i,n,s,a,h,f,u,c,l=t.length,p=0,d=Number.POSITIVE_INFINITY;for(f=0;fp&&(p=t[f]),t[f]>=1;for(c=i<<16|f,u=a;us[i]);)n=s[r],s[r]=s[i],s[i]=n,n=s[r+1],s[r+1]=s[i+1],s[i+1]=n,r=i;return this.length},b.prototype.pop=function(){var t,e,r,i,n,s=this.buffer;for(e=s[0],t=s[1],this.length-=2,s[0]=s[this.length],s[1]=s[this.length+1],n=0;!((i=2*n+2)>=this.length)&&(i+2s[i]&&(i+=2),s[i]>s[n]);)r=s[n],s[n]=s[i],s[i]=r,r=s[n+1],s[n+1]=s[i+1],s[i+1]=r,n=i;return{index:t,value:e,length:this.length}};var x,A=2,E={NONE:0,L:1,t:A,X:3},U=[];for(x=0;288>x;x++)switch(s){case 143>=x:U.push([x+48,8]);break;case 255>=x:U.push([x-144+400,9]);break;case 279>=x:U.push([x-256+0,7]);break;case 287>=x:U.push([x-280+192,8]);break;default:i("invalid literal: "+x)}function _(t,e){this.length=t,this.N=e}v.prototype.h=function(){var t,e,r,h,f=this.input;switch(this.k){case 0:for(r=0,h=f.length;r>>8&255,g[b++]=255&l,g[b++]=l>>>8&255,o)g.set(p,b),b+=p.length,g=g.subarray(0,b);else{for(m=0,y=p.length;mW)for(;0W?W:138)>W-3&&Z=Z?(rt[X++]=17,rt[X++]=Z-3,it[17]++):(rt[X++]=18,rt[X++]=Z-11,it[18]++),W-=Z;else if(rt[X++]=et[H],it[et[H]]++,3>--W)for(;0W?W:6)>W-3&&Zq;q++)G[q]=M[J[q]];for(j=19;4=t:return[265,t-11,1];case 14>=t:return[266,t-13,1];case 16>=t:return[267,t-15,1];case 18>=t:return[268,t-17,1];case 22>=t:return[269,t-19,2];case 26>=t:return[270,t-23,2];case 30>=t:return[271,t-27,2];case 34>=t:return[272,t-31,2];case 42>=t:return[273,t-35,3];case 50>=t:return[274,t-43,3];case 58>=t:return[275,t-51,3];case 66>=t:return[276,t-59,3];case 82>=t:return[277,t-67,4];case 98>=t:return[278,t-83,4];case 114>=t:return[279,t-99,4];case 130>=t:return[280,t-115,4];case 162>=t:return[281,t-131,5];case 194>=t:return[282,t-163,5];case 226>=t:return[283,t-195,5];case 257>=t:return[284,t-227,5];case 258===t:return[285,t-258,0];default:i("invalid length: "+t)}}var e,r,n=[];for(e=3;258>=e;e++)r=t(e),n[e]=r[2]<<24|r[1]<<16|r[0];return n}(),I=o?new Uint32Array(k):k;function P(t,e){function r(t,e){var r,n,o,a,h=t.N,f=[],u=0;switch(r=I[t.length],f[u++]=65535&r,f[u++]=r>>16&255,f[u++]=r>>24,s){case 1===h:n=[0,h-1,0];break;case 2===h:n=[1,h-2,0];break;case 3===h:n=[2,h-3,0];break;case 4===h:n=[3,h-4,0];break;case 6>=h:n=[4,h-5,1];break;case 8>=h:n=[5,h-7,1];break;case 12>=h:n=[6,h-9,2];break;case 16>=h:n=[7,h-13,2];break;case 24>=h:n=[8,h-17,3];break;case 32>=h:n=[9,h-25,3];break;case 48>=h:n=[10,h-33,4];break;case 64>=h:n=[11,h-49,4];break;case 96>=h:n=[12,h-65,5];break;case 128>=h:n=[13,h-97,5];break;case 192>=h:n=[14,h-129,6];break;case 256>=h:n=[15,h-193,6];break;case 384>=h:n=[16,h-257,7];break;case 512>=h:n=[17,h-385,7];break;case 768>=h:n=[18,h-513,8];break;case 1024>=h:n=[19,h-769,8];break;case 1536>=h:n=[20,h-1025,9];break;case 2048>=h:n=[21,h-1537,9];break;case 3072>=h:n=[22,h-2049,10];break;case 4096>=h:n=[23,h-3073,10];break;case 6144>=h:n=[24,h-4097,11];break;case 8192>=h:n=[25,h-6145,11];break;case 12288>=h:n=[26,h-8193,12];break;case 16384>=h:n=[27,h-12289,12];break;case 24576>=h:n=[28,h-16385,13];break;case 32768>=h:n=[29,h-24577,13];break;default:i("invalid distance")}for(r=n,f[u++]=r[0],f[u++]=r[1],f[u++]=r[2],o=0,a=f.length;o=f;)v[f++]=0;for(f=0;29>=f;)x[f++]=0}for(v[256]=1,a=0,h=e.length;a=h){for(d&&r(d,-1),f=0,u=h-a;fs&&e+sf&&(n=i,f=s),258===s)break}return new _(f,e-n)}function B(t,e){var r,i,n,s,a,h=t.length,f=new b(572),u=new(o?Uint8Array:Array)(h);if(!o)for(s=0;s2*u[s-1]+c[s]&&(u[s]=2*u[s-1]+c[s]),p[s]=Array(u[s]),d[s]=Array(u[s]);for(n=0;nt[n]?(p[s][a]=h,d[s][a]=e,f+=2):(p[s][a]=t[n],d[s][a]=n,++n);m[s]=0,1===c[s]&&i(s)}return l}(i,i.length,e),s=0,a=r.length;s>>=1;return s}function R(t,e){this.input=t,this.b=this.c=0,this.g={},e&&(e.flags&&(this.g=e.flags),"string"==typeof e.filename&&(this.filename=e.filename),"string"==typeof e.comment&&(this.w=e.comment),e.deflateOptions&&(this.l=e.deflateOptions)),this.l||(this.l={})}R.prototype.h=function(){var t,e,r,i,s,a,h,f,u=new(o?Uint8Array:Array)(32768),c=0,l=this.input,p=this.c,m=this.filename,y=this.w;if(u[c++]=31,u[c++]=139,u[c++]=8,t=0,this.g.fname&&(t|=O),this.g.fcomment&&(t|=C),this.g.fhcrc&&(t|=L),u[c++]=t,e=(Date.now?Date.now():+new Date)/1e3|0,u[c++]=255&e,u[c++]=e>>>8&255,u[c++]=e>>>16&255,u[c++]=e>>>24&255,u[c++]=0,u[c++]=j,this.g.fname!==n){for(h=0,f=m.length;h>>8&255),u[c++]=255&a;u[c++]=0}if(this.g.comment){for(h=0,f=y.length;h>>8&255),u[c++]=255&a;u[c++]=0}return this.g.fhcrc&&(r=65535&d(u,0,c),u[c++]=255&r,u[c++]=r>>>8&255),this.l.outputBuffer=u,this.l.outputIndex=c,u=(s=new v(l,this.l)).h(),c=s.b,o&&(c+8>u.buffer.byteLength?(this.a=new Uint8Array(c+8),this.a.set(new Uint8Array(u.buffer)),u=this.a):u=new Uint8Array(u.buffer)),i=d(l,n,n),u[c++]=255&i,u[c++]=i>>>8&255,u[c++]=i>>>16&255,u[c++]=i>>>24&255,f=l.length,u[c++]=255&f,u[c++]=f>>>8&255,u[c++]=f>>>16&255,u[c++]=f>>>24&255,this.c=p,o&&c>>=1){case 0:var e=this.input,r=this.c,a=this.a,h=this.b,f=e.length,u=n,c=a.length,l=n;switch(this.e=this.j=0,r+1>=f&&i(Error("invalid uncompressed block header: LEN")),u=e[r++]|e[r++]<<8,r+1>=f&&i(Error("invalid uncompressed block header: NLEN")),u===~(e[r++]|e[r++]<<8)&&i(Error("invalid uncompressed block header: length verify")),r+u>e.length&&i(Error("input buffer is broken")),this.q){case M:for(;h+u>a.length;){if(u-=l=c-h,o)a.set(e.subarray(r,r+l),h),h+=l,r+=l;else for(;l--;)a[h++]=e[r++];this.b=h,a=this.f(),h=this.b}break;case z:for(;h+u>a.length;)a=this.f({B:2});break;default:i(Error("invalid inflate mode"))}if(o)a.set(e.subarray(r,r+u),h),h+=u,r+=u;else for(;u--;)a[h++]=e[r++];this.c=r,this.b=h,this.a=a;break;case 1:this.r(et,it);break;case 2:var p,d,m,y,g=nt(this,5)+257,b=nt(this,5)+1,v=nt(this,4)+4,x=new(o?Uint8Array:Array)(F.length),A=n,E=n,U=n,_=n,k=n;for(k=0;k=Y?8:255>=Y?9:279>=Y?7:8;var Q,tt,et=w(Z),rt=new(o?Uint8Array:Array)(30);for(Q=0,tt=rt.length;Q=h&&i(Error("input buffer is broken")),n|=o[a++]<>>e,t.e=s-e,t.c=a,r}function st(t,e){for(var r,n,s=t.j,o=t.e,a=t.input,h=t.c,f=a.length,u=e[0],c=e[1];o=f);)s|=a[h++]<>>16)>o&&i(Error("invalid code length: "+n)),t.j=s>>n,t.e=o-n,t.c=h,65535&r}function ot(t){this.input=t,this.c=0,this.G=[],this.R=!1}function at(t){if("string"==typeof t){var e,r,i=t.split("");for(e=0,r=i.length;e>>0;t=i}for(var n,s=1,o=0,a=t.length,h=0;0>>0}function ht(t,e){var r,n;switch(this.input=t,this.c=0,!e&&(e={})||(e.index&&(this.c=e.index),e.verify&&(this.V=e.verify)),r=t[this.c++],n=t[this.c++],15&r){case ft:this.method=ft;break;default:i(Error("unsupported compression method"))}0!=((r<<8)+n)%31&&i(Error("invalid fcheck flag:"+((r<<8)+n)%31)),32&n&&i(Error("fdict flag is not supported")),this.J=new D(t,{index:this.c,bufferSize:e.bufferSize,bufferType:e.bufferType,resize:e.resize})}D.prototype.r=function(t,e){var r=this.a,i=this.b;this.A=t;for(var n,s,o,a,h=r.length-258;256!==(n=st(this,t));)if(256>n)i>=h&&(this.b=i,r=this.f(),i=this.b),r[i++]=n;else for(a=J[s=n-257],0=h&&(this.b=i,r=this.f(),i=this.b);a--;)r[i]=r[i++-o];for(;8<=this.e;)this.e-=8,this.c--;this.b=i},D.prototype.Q=function(t,e){var r=this.a,i=this.b;this.A=t;for(var n,s,o,a,h=r.length;256!==(n=st(this,t));)if(256>n)i>=h&&(h=(r=this.f()).length),r[i++]=n;else for(a=J[s=n-257],0h&&(h=(r=this.f()).length);a--;)r[i]=r[i++-o];for(;8<=this.e;)this.e-=8,this.c--;this.b=i},D.prototype.f=function(){var t,e,r=new(o?Uint8Array:Array)(this.b-32768),i=this.b-32768,n=this.a;if(o)r.set(n.subarray(32768,r.length));else for(t=0,e=r.length;tt;++t)n[t]=n[i+t];return this.b=32768,n},D.prototype.S=function(t){var e,r,i,n=this.input.length/this.c+1|0,s=this.input,a=this.a;return t&&("number"==typeof t.B&&(n=t.B),"number"==typeof t.M&&(n+=t.M)),2>n?r=(i=(s.length-this.c)/this.A[2]/2*258|0)e&&(this.a.length=e),t=this.a),this.buffer=t},ot.prototype.i=function(){for(var t=this.input.length;this.c>>0,d(e,n,n)!==m&&i(Error("invalid CRC-32 checksum: 0x"+d(e,n,n).toString(16)+" / 0x"+m.toString(16))),a.Z=h=(y[b++]|y[b++]<<8|y[b++]<<16|y[b++]<<24)>>>0,(4294967295&e.length)!==h&&i(Error("invalid input size: "+(4294967295&e.length)+" / "+h)),this.G.push(a),this.c=b}this.R=s;var w,v,x,A=this.G,E=0,U=0;for(w=0,v=A.length;w>>0!==at(t)&&i(Error("invalid adler-32 checksum"))),t};var ft=8;function ut(t,e){this.input=t,this.a=new(o?Uint8Array:Array)(32768),this.k=ct.t;var r,i={};for(r in!e&&(e={})||"number"!=typeof e.compressionType||(this.k=e.compressionType),e)i[r]=e[r];i.outputBuffer=this.a,this.I=new v(this.input,i)}var ct=E;function lt(t,e){var r;return r=new ut(t).h(),e||(e={}),e.H?r:yt(r)}function pt(t,e){var r;return t.subarray=t.slice,r=new ht(t).i(),e||(e={}),e.noBuffer?r:yt(r)}function dt(t,e){var r;return t.subarray=t.slice,r=new R(t).h(),e||(e={}),e.H?r:yt(r)}function mt(t,e){var r;return t.subarray=t.slice,r=new ot(t).i(),e||(e={}),e.H?r:yt(r)}function yt(t){var e,i,n=new r(t.length);for(e=0,i=t.length;e>24&255,h[f++]=a>>16&255,h[f++]=a>>8&255,h[f++]=255&a,h},e.deflate=function(e,r,i){t.nextTick(function(){var t,n;try{n=lt(e,i)}catch(e){t=e}r(t,n)})},e.deflateSync=lt,e.inflate=function(e,r,i){t.nextTick(function(){var t,n;try{n=pt(e,i)}catch(e){t=e}r(t,n)})},e.inflateSync=pt,e.gzip=function(e,r,i){t.nextTick(function(){var t,n;try{n=dt(e,i)}catch(e){t=e}r(t,n)})},e.gzipSync=dt,e.gunzip=function(e,r,i){t.nextTick(function(){var t,n;try{n=mt(e,i)}catch(e){t=e}r(t,n)})},e.gunzipSync=mt}).call(this)}).call(this,r(1),r(0).Buffer)},function(t,e){var r;r=function(){return this}();try{r=r||Function("return this")()||(0,eval)("this")}catch(t){"object"==typeof window&&(r=window)}t.exports=r},function(t,e,r){"use strict";e.byteLength=function(t){return 3*t.length/4-f(t)},e.toByteArray=function(t){var e,r,i,o,a,h=t.length;o=f(t),a=new s(3*h/4-o),r=o>0?h-4:h;var u=0;for(e=0;e>16&255,a[u++]=i>>8&255,a[u++]=255&i;2===o?(i=n[t.charCodeAt(e)]<<2|n[t.charCodeAt(e+1)]>>4,a[u++]=255&i):1===o&&(i=n[t.charCodeAt(e)]<<10|n[t.charCodeAt(e+1)]<<4|n[t.charCodeAt(e+2)]>>2,a[u++]=i>>8&255,a[u++]=255&i);return a},e.fromByteArray=function(t){for(var e,r=t.length,n=r%3,s="",o=[],a=0,h=r-n;ah?h:a+16383));1===n?(e=t[r-1],s+=i[e>>2],s+=i[e<<4&63],s+="=="):2===n&&(e=(t[r-2]<<8)+t[r-1],s+=i[e>>10],s+=i[e>>4&63],s+=i[e<<2&63],s+="=");return o.push(s),o.join("")};for(var i=[],n=[],s="undefined"!=typeof Uint8Array?Uint8Array:Array,o="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",a=0,h=o.length;a0)throw new Error("Invalid string. Length must be a multiple of 4");return"="===t[e-2]?2:"="===t[e-1]?1:0}function u(t,e,r){for(var n,s,o=[],a=e;a>18&63]+i[s>>12&63]+i[s>>6&63]+i[63&s]);return o.join("")}n["-".charCodeAt(0)]=62,n["_".charCodeAt(0)]=63},function(t,e){e.read=function(t,e,r,i,n){var s,o,a=8*n-i-1,h=(1<>1,u=-7,c=r?n-1:0,l=r?-1:1,p=t[e+c];for(c+=l,s=p&(1<<-u)-1,p>>=-u,u+=a;u>0;s=256*s+t[e+c],c+=l,u-=8);for(o=s&(1<<-u)-1,s>>=-u,u+=i;u>0;o=256*o+t[e+c],c+=l,u-=8);if(0===s)s=1-f;else{if(s===h)return o?NaN:1/0*(p?-1:1);o+=Math.pow(2,i),s-=f}return(p?-1:1)*o*Math.pow(2,s-i)},e.write=function(t,e,r,i,n,s){var o,a,h,f=8*s-n-1,u=(1<>1,l=23===n?Math.pow(2,-24)-Math.pow(2,-77):0,p=i?0:s-1,d=i?1:-1,m=e<0||0===e&&1/e<0?1:0;for(e=Math.abs(e),isNaN(e)||e===1/0?(a=isNaN(e)?1:0,o=u):(o=Math.floor(Math.log(e)/Math.LN2),e*(h=Math.pow(2,-o))<1&&(o--,h*=2),(e+=o+c>=1?l/h:l*Math.pow(2,1-c))*h>=2&&(o++,h/=2),o+c>=u?(a=0,o=u):o+c>=1?(a=(e*h-1)*Math.pow(2,n),o+=c):(a=e*Math.pow(2,c-1)*Math.pow(2,n),o=0));n>=8;t[r+p]=255&a,p+=d,a/=256,n-=8);for(o=o<0;t[r+p]=255&o,p+=d,o/=256,f-=8);t[r+p-d]|=128*m}},function(t,e){var r={}.toString;t.exports=Array.isArray||function(t){return"[object Array]"==r.call(t)}},function(t,e,r){(function(e){const i=r(20),n=r(23);t.exports=((t,r,s=70)=>{const o=e.from(r),a=n(o);let h=0,f=null,u=null,c=0,l=0;if(a&&"image/bmp"===a.mime){const e=i.decode(o);f=t._malloc(e.data.length*Uint8Array.BYTES_PER_ELEMENT),t.HEAPU8.set(e.data,f),c=e.width,l=e.height,h=4}else{const e=t._malloc(o.length*Uint8Array.BYTES_PER_ELEMENT);t.HEAPU8.set(o,e),u=t._pixReadMem(e,o.length),0===t.getValue(u+28,"i32")&&t.setValue(u+28,s,"i32"),[c,l]=Array(2).fill(0).map((e,r)=>t.getValue(u+4*r,"i32"))}return{w:c,h:l,bytesPerPixel:h,data:f,pix:u}})}).call(this,r(0).Buffer)},function(t,e,r){var i=r(21),n=r(22);t.exports={encode:i,decode:n}},function(t,e,r){(function(e){function r(t){this.buffer=t.data,this.width=t.width,this.height=t.height,this.extraBytes=this.width%4,this.rgbSize=this.height*(3*this.width+this.extraBytes),this.headerInfoSize=40,this.data=[],this.flag="BM",this.reserved=0,this.offset=54,this.fileSize=this.rgbSize+this.offset,this.planes=1,this.bitPP=24,this.compress=0,this.hr=0,this.vr=0,this.colors=0,this.importantColors=0}r.prototype.encode=function(){var t=new e(this.offset+this.rgbSize);this.pos=0,t.write(this.flag,this.pos,2),this.pos+=2,t.writeUInt32LE(this.fileSize,this.pos),this.pos+=4,t.writeUInt32LE(this.reserved,this.pos),this.pos+=4,t.writeUInt32LE(this.offset,this.pos),this.pos+=4,t.writeUInt32LE(this.headerInfoSize,this.pos),this.pos+=4,t.writeUInt32LE(this.width,this.pos),this.pos+=4,t.writeInt32LE(-this.height,this.pos),this.pos+=4,t.writeUInt16LE(this.planes,this.pos),this.pos+=2,t.writeUInt16LE(this.bitPP,this.pos),this.pos+=2,t.writeUInt32LE(this.compress,this.pos),this.pos+=4,t.writeUInt32LE(this.rgbSize,this.pos),this.pos+=4,t.writeUInt32LE(this.hr,this.pos),this.pos+=4,t.writeUInt32LE(this.vr,this.pos),this.pos+=4,t.writeUInt32LE(this.colors,this.pos),this.pos+=4,t.writeUInt32LE(this.importantColors,this.pos),this.pos+=4;for(var r=0,i=3*this.width+this.extraBytes,n=0;n0){var a=this.pos+n*i+3*this.width;t.fill(0,a,a+this.extraBytes)}}return t},t.exports=function(t,e){return void 0===e&&(e=100),{data:new r(t).encode(),width:t.width,height:t.height}}}).call(this,r(0).Buffer)},function(t,e,r){(function(e){function r(t,e){if(this.pos=0,this.buffer=t,this.is_with_alpha=!!e,this.bottom_up=!0,this.flag=this.buffer.toString("utf-8",0,this.pos+=2),"BM"!=this.flag)throw new Error("Invalid BMP File");this.parseHeader(),this.parseRGBA()}r.prototype.parseHeader=function(){if(this.fileSize=this.buffer.readUInt32LE(this.pos),this.pos+=4,this.reserved=this.buffer.readUInt32LE(this.pos),this.pos+=4,this.offset=this.buffer.readUInt32LE(this.pos),this.pos+=4,this.headerSize=this.buffer.readUInt32LE(this.pos),this.pos+=4,this.width=this.buffer.readUInt32LE(this.pos),this.pos+=4,this.height=this.buffer.readInt32LE(this.pos),this.pos+=4,this.planes=this.buffer.readUInt16LE(this.pos),this.pos+=2,this.bitPP=this.buffer.readUInt16LE(this.pos),this.pos+=2,this.compress=this.buffer.readUInt32LE(this.pos),this.pos+=4,this.rawSize=this.buffer.readUInt32LE(this.pos),this.pos+=4,this.hr=this.buffer.readUInt32LE(this.pos),this.pos+=4,this.vr=this.buffer.readUInt32LE(this.pos),this.pos+=4,this.colors=this.buffer.readUInt32LE(this.pos),this.pos+=4,this.importantColors=this.buffer.readUInt32LE(this.pos),this.pos+=4,16===this.bitPP&&this.is_with_alpha&&(this.bitPP=15),this.bitPP<15){var t=0===this.colors?1<=0?this.height-1:-this.height;for(r=this.height-1;r>=0;r--){for(var i=this.bottom_up?r:this.height-1-r,n=0;n>7-a&1];this.data[o+4*a]=0,this.data[o+4*a+1]=h.blue,this.data[o+4*a+2]=h.green,this.data[o+4*a+3]=h.red}0!=e&&(this.pos+=4-e)}},r.prototype.bit4=function(){if(2==this.compress){this.data.fill(255);for(var t=0,e=this.bottom_up?this.height-1:0,r=!1;t>4),1&h&&h+1>1&1)&&this.pos++}}else for(h=0;h>4),r=!r}function f(e){var r=this.palette[e];this.data[t]=0,this.data[t+1]=r.blue,this.data[t+2]=r.green,this.data[t+3]=r.red,t+=4}}else{var u=Math.ceil(this.width/2),c=u%4;for(o=this.height-1;o>=0;o--){var l=this.bottom_up?o:this.height-1-o;for(s=0;s>4,d=15&n,m=this.palette[p];if(this.data[t]=0,this.data[t+1]=m.blue,this.data[t+2]=m.green,this.data[t+3]=m.red,2*s+1>=this.width)break;m=this.palette[d],this.data[t+4]=0,this.data[t+4+1]=m.blue,this.data[t+4+2]=m.green,this.data[t+4+3]=m.red}0!=c&&(this.pos+=4-c)}}},r.prototype.bit8=function(){if(1==this.compress){this.data.fill(255);for(var t=0,e=this.bottom_up?this.height-1:0;t=0;s--){var u=this.bottom_up?s:this.height-1-s;for(n=0;n=0;r--){for(var i=this.bottom_up?r:this.height-1-r,n=0;n>5&e)/e*255|0,h=(s>>10&e)/e*255|0,f=s>>15?255:0,u=i*this.width*4+4*n;this.data[u]=f,this.data[u+1]=o,this.data[u+2]=a,this.data[u+3]=h}this.pos+=t}},r.prototype.bit16=function(){var t=this.width%2*2;this.maskRed=31744,this.maskGreen=992,this.maskBlue=31,this.mask0=0,3==this.compress&&(this.maskRed=this.buffer.readUInt32LE(this.pos),this.pos+=4,this.maskGreen=this.buffer.readUInt32LE(this.pos),this.pos+=4,this.maskBlue=this.buffer.readUInt32LE(this.pos),this.pos+=4,this.mask0=this.buffer.readUInt32LE(this.pos),this.pos+=4);for(var e=[0,0,0],r=0;r<16;r++)this.maskRed>>r&1&&e[0]++,this.maskGreen>>r&1&&e[1]++,this.maskBlue>>r&1&&e[2]++;e[1]+=e[0],e[2]+=e[1],e[0]=8-e[0],e[1]-=8,e[2]-=8;for(var i=this.height-1;i>=0;i--){for(var n=this.bottom_up?i:this.height-1-i,s=0;s>e[1],f=(o&this.maskRed)>>e[2],u=n*this.width*4+4*s;this.data[u]=0,this.data[u+1]=a,this.data[u+2]=h,this.data[u+3]=f}this.pos+=t}},r.prototype.bit24=function(){for(var t=this.height-1;t>=0;t--){for(var e=this.bottom_up?t:this.height-1-t,r=0;r=0;t--)for(var e=this.bottom_up?t:this.height-1-t,r=0;r=0;t--)for(e=this.bottom_up?t:this.height-1-t,r=0;r[...t].map(t=>t.charCodeAt(0)),i=r("META-INF/mozilla.rsa"),n=r("[Content_Types].xml"),s=r("_rels/.rels");function o(t,e=0){let r=t[e],i=1,n=0;for(;++n<8;)i*=256,r+=t[e+n]*i;return r}t.exports=(t=>{if(!(t instanceof Uint8Array||e.isBuffer(t)))throw new TypeError(`Expected the \`input\` argument to be of type \`Uint8Array\` or \`Buffer\`, got \`${typeof t}\``);const a=t instanceof Uint8Array?t:new Uint8Array(t);if(!(a&&a.length>1))return null;const h=(t,e)=>{e=Object.assign({offset:0},e);for(let r=0;rh(r(t),e);if(h([255,216,255]))return{ext:"jpg",mime:"image/jpeg"};if(h([137,80,78,71,13,10,26,10]))return{ext:"png",mime:"image/png"};if(h([71,73,70]))return{ext:"gif",mime:"image/gif"};if(h([87,69,66,80],{offset:8}))return{ext:"webp",mime:"image/webp"};if(h([70,76,73,70]))return{ext:"flif",mime:"image/flif"};if((h([73,73,42,0])||h([77,77,0,42]))&&h([67,82],{offset:8}))return{ext:"cr2",mime:"image/x-canon-cr2"};if(h([73,73,42,0])||h([77,77,0,42]))return{ext:"tif",mime:"image/tiff"};if(h([66,77]))return{ext:"bmp",mime:"image/bmp"};if(h([73,73,188]))return{ext:"jxr",mime:"image/vnd.ms-photo"};if(h([56,66,80,83]))return{ext:"psd",mime:"image/vnd.adobe.photoshop"};if(h([80,75,3,4])){if(h([109,105,109,101,116,121,112,101,97,112,112,108,105,99,97,116,105,111,110,47,101,112,117,98,43,122,105,112],{offset:30}))return{ext:"epub",mime:"application/epub+zip"};if(h(i,{offset:30}))return{ext:"xpi",mime:"application/x-xpinstall"};if(f("mimetypeapplication/vnd.oasis.opendocument.text",{offset:30}))return{ext:"odt",mime:"application/vnd.oasis.opendocument.text"};if(f("mimetypeapplication/vnd.oasis.opendocument.spreadsheet",{offset:30}))return{ext:"ods",mime:"application/vnd.oasis.opendocument.spreadsheet"};if(f("mimetypeapplication/vnd.oasis.opendocument.presentation",{offset:30}))return{ext:"odp",mime:"application/vnd.oasis.opendocument.presentation"};const t=(t,e=0)=>t.findIndex((t,r,i)=>r>=e&&80===i[r]&&75===i[r+1]&&3===i[r+2]&&4===i[r+3]);let e=0,r=!1,o=null;do{const i=e+30;if(r||(r=h(n,{offset:i})||h(s,{offset:i})),o||(f("word/",{offset:i})?o={ext:"docx",mime:"application/vnd.openxmlformats-officedocument.wordprocessingml.document"}:f("ppt/",{offset:i})?o={ext:"pptx",mime:"application/vnd.openxmlformats-officedocument.presentationml.presentation"}:f("xl/",{offset:i})&&(o={ext:"xlsx",mime:"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"})),r&&o)return o;e=t(a,i)}while(e>=0);if(o)return o}if(h([80,75])&&(3===a[2]||5===a[2]||7===a[2])&&(4===a[3]||6===a[3]||8===a[3]))return{ext:"zip",mime:"application/zip"};if(h([117,115,116,97,114],{offset:257}))return{ext:"tar",mime:"application/x-tar"};if(h([82,97,114,33,26,7])&&(0===a[6]||1===a[6]))return{ext:"rar",mime:"application/x-rar-compressed"};if(h([31,139,8]))return{ext:"gz",mime:"application/gzip"};if(h([66,90,104]))return{ext:"bz2",mime:"application/x-bzip2"};if(h([55,122,188,175,39,28]))return{ext:"7z",mime:"application/x-7z-compressed"};if(h([120,1]))return{ext:"dmg",mime:"application/x-apple-diskimage"};if(h([51,103,112,53])||h([0,0,0])&&h([102,116,121,112],{offset:4})&&(h([109,112,52,49],{offset:8})||h([109,112,52,50],{offset:8})||h([105,115,111,109],{offset:8})||h([105,115,111,50],{offset:8})||h([109,109,112,52],{offset:8})||h([77,52,86],{offset:8})||h([100,97,115,104],{offset:8})))return{ext:"mp4",mime:"video/mp4"};if(h([77,84,104,100]))return{ext:"mid",mime:"audio/midi"};if(h([26,69,223,163])){const t=a.subarray(4,4100),e=t.findIndex((t,e,r)=>66===r[e]&&130===r[e+1]);if(-1!==e){const r=e+3,i=e=>[...e].every((e,i)=>t[r+i]===e.charCodeAt(0));if(i("matroska"))return{ext:"mkv",mime:"video/x-matroska"};if(i("webm"))return{ext:"webm",mime:"video/webm"}}}if(h([0,0,0,20,102,116,121,112,113,116,32,32])||h([102,114,101,101],{offset:4})||h([102,116,121,112,113,116,32,32],{offset:4})||h([109,100,97,116],{offset:4})||h([109,111,111,118],{offset:4})||h([119,105,100,101],{offset:4}))return{ext:"mov",mime:"video/quicktime"};if(h([82,73,70,70])){if(h([65,86,73],{offset:8}))return{ext:"avi",mime:"video/vnd.avi"};if(h([87,65,86,69],{offset:8}))return{ext:"wav",mime:"audio/vnd.wave"};if(h([81,76,67,77],{offset:8}))return{ext:"qcp",mime:"audio/qcelp"}}if(h([48,38,178,117,142,102,207,17,166,217])){let t=30;do{const e=o(a,t+16);if(h([145,7,220,183,183,169,207,17,142,230,0,192,12,32,83,101],{offset:t})){if(h([64,158,105,248,77,91,207,17,168,253,0,128,95,92,68,43],{offset:t+24}))return{ext:"wma",mime:"audio/x-ms-wma"};if(h([192,239,25,188,77,91,207,17,168,253,0,128,95,92,68,43],{offset:t+24}))return{ext:"wmv",mime:"video/x-ms-asf"};break}t+=e}while(t+24<=a.length);return{ext:"asf",mime:"application/vnd.ms-asf"}}if(h([0,0,1,186])||h([0,0,1,179]))return{ext:"mpg",mime:"video/mpeg"};if(h([102,116,121,112,51,103],{offset:4}))return{ext:"3gp",mime:"video/3gpp"};for(let t=0;t<2&&tt,s=r(4),o=r(27),a=r(28);t.exports=class{constructor(t={}){this.worker=null,this.options={...s.defaultOptions,...t},["corePath","workerPath","langPath"].forEach(e=>{i.not.undefined(t[e])&&(this.options={...this.options,[e]:n(t[e])})}),this._currentJob=null,this._queue=[]}recognize(t,e="eng",r={}){return this._sendJob("recognize",t,e,r)}detect(t,e={}){return this._sendJob("detect",t,"osd",e)}recv(t){this._currentJob.id===t.jobId?this._currentJob.handle({...t,data:"resolve"===t.status&&"recognize"===t.action?o(t.data):t.data}):console.warn(`Job ID ${t.jobId} not known.`)}dequeue(){this._currentJob=null,this._queue.length&&this._queue[0]()}terminate(){this.worker&&s.terminateWorker(this),this.worker=null,this._currentJob=null,this._queue=[]}_sendJob(t,e,r,i){return this._delay(n=>{n.send(t,{image:e,lang:r,params:i,options:this.options})})}_delay(t){i.null(this.worker)&&(this.worker=s.spawnWorker(this,this.options));const e=new a(this);return this._queue.push(()=>{this._queue.shift(),this._currentJob=e,t(e)}),i.null(this._currentJob)&&this.dequeue(),e}}}).call(this,r(1))},function(t,e){t.exports={defaultOptions:{langPath:"https://tessdata.projectnaptha.com/4.0.0"}}},function(t){t.exports={name:"tesseract.js",version:"2.0.0-alpha.1",description:"Pure Javascript Multilingual OCR",main:"src/index.js",scripts:{start:"node scripts/server.js",build:"webpack --config scripts/webpack.config.prod.js",prepublishOnly:"npm run build",test:"npm run test:node","test:node":"nyc mocha --exit --bail --require ./scripts/test-helper.js ./tests/*.test.js",lint:"eslint src"},browser:{"./src/node/index.js":"./src/browser/index.js"},author:"",contributors:["jeromewu"],license:"Apache-2.0",devDependencies:{eslint:"^5.9.0","eslint-config-airbnb":"^17.1.0","eslint-plugin-import":"^2.14.0","eslint-plugin-jsx-a11y":"^6.1.2","eslint-plugin-react":"^7.11.1","expect.js":"^0.3.1",express:"^4.16.4",mocha:"^5.2.0",nyc:"^13.1.0",webpack:"^4.26.0","webpack-cli":"^3.1.2","webpack-dev-middleware":"^3.4.0"},dependencies:{"check-types":"^7.4.0","is-url":"1.2.2","node-fetch":"^2.3.0","resolve-url":"^0.2.1","tesseract.js-core":"^2.0.0-beta.5","tesseract.js-utils":"^1.0.0-beta.4"},repository:{type:"git",url:"https://github.com/naptha/tesseract.js.git"},bugs:{url:"https://github.com/naptha/tesseract.js/issues"},homepage:"https://github.com/naptha/tesseract.js"}},function(t,e){t.exports=(t=>{const e={...t,paragraphs:[],lines:[],words:[],symbols:[]};return e.blocks.forEach(t=>{const r={...t,page:e,lines:[],words:[],symbols:[]};r.paragraphs.forEach(t=>{const i={...t,block:r,page:e,words:[],symbols:[]};i.lines.forEach(t=>{const n={...t,paragraph:i,block:r,page:e,symbols:[]};n.words.forEach(t=>{const s={...t,line:n,paragraph:i,block:r,page:e};s.symbols.forEach(t=>{const o={...t,word:s,line:n,paragraph:i,block:r,page:e};o.line.symbols.push(o),o.paragraph.symbols.push(o),o.block.symbols.push(o),o.page.symbols.push(o)}),s.paragraph.words.push(s),s.block.words.push(s),s.page.words.push(s)}),n.block.lines.push(n),n.page.lines.push(n)}),i.page.paragraphs.push(i)})}),e})},function(t,e,r){const i=r(4);let n=0;t.exports=class{constructor(t){n+=1,this.id=`Job-${n}-${Math.random().toString(16).slice(3,8)}`,this._worker=t,this._resolve=[],this._reject=[],this._progress=[],this._finally=[]}then(t,e){return this._resolve.push?this._resolve.push(t):t(this._resolve),e&&this.catch(e),this}catch(t){return this._reject.push?this._reject.push(t):t(this._reject),this}progress(t){return this._progress.push(t),this}finally(t){return this._finally.push(t),this}send(t,e){i.sendPacket(this._worker,{jobId:this.id,action:t,payload:e})}handle(t){const{data:e}=t;let r=!1;"resolve"===t.status?(0===this._resolve.length&&console.log(e),this._resolve.forEach(t=>{const r=t(e);r&&"function"==typeof r.then&&console.warn("TesseractJob instances do not chain like ES6 Promises. To convert it into a real promise, use Promise.resolve.")}),this._resolve=e,this._worker.dequeue(),r=!0):"reject"===t.status?(0===this._reject.length&&console.error(e),this._reject.forEach(t=>t(e)),this._reject=e,this._worker.dequeue(),r=!0):"progress"===t.status?this._progress.forEach(t=>t(e)):console.warn("Message type unknown",t.status),r&&this._finally.forEach(t=>t(e))}}}])}); //# sourceMappingURL=tesseract.min.js.map