Pure Javascript OCR for more than 100 Languages 📖🎉🖥
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 

9 lines
63 KiB

!function(t,e){if("object"==typeof exports&&"object"==typeof module)module.exports=e();else if("function"==typeof define&&define.amd)define([],e);else{var r=e();for(var n in r)("object"==typeof exports?exports:t)[n]=r[n]}}(window,function(){return function(t){var e={};function r(n){if(e[n])return e[n].exports;var i=e[n]={i:n,l:!1,exports:{}};return t[n].call(i.exports,i,i.exports,r),i.l=!0,i.exports}return r.m=t,r.c=e,r.d=function(t,e,n){r.o(t,e)||Object.defineProperty(t,e,{enumerable:!0,get:n})},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 n=Object.create(null);if(r.r(n),Object.defineProperty(n,"default",{enumerable:!0,value:t}),2&e&&"string"!=typeof t)for(var i in t)r.d(n,i,function(e){return t[e]}.bind(null,i));return n},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=1)}([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){(function(t){const e=r(2);t.addEventListener("message",({data:t})=>{e.dispatchHandlers(t,t=>postMessage(t))}),e.setAdapter({getCore:(e,r)=>(t.TesseractCore||(r.progress({status:"loading tesseract core",progress:0}),t.importScripts(e.workerOptions.corePath),t.TesseractCore="object"==typeof WebAssembly?t.TesseractCoreWASM:t.TesseractCoreASM,r.progress({status:"loading tesseract core",progress:1})),t.TesseractCore)})}).call(this,r(0))},function(t,e,r){const{readImage:n,loadLang:i}=r(3),o=r(17);let s,a,h,f={};const u=(t,e)=>{let r=100663296;if(["chi_sim","chi_tra","jpn"].includes(t.options.lang)&&(r=167772160),!s||s.TOTAL_MEMORY<r){const r=f.getCore(t,e);return e.progress({status:"initializing tesseract",progress:0}),r({TesseractProgress(t){h.progress({status:"recognizing text",progress:Math.max(0,(t-30)/70)})}}).then(t=>{a=new(s=t).TessBaseAPI,e.progress({status:"initialized tesseract",progress:1})})}return new Promise},c=t=>{const{w:e,h:r,data:i}=n(s,Array.from(t));return a.SetImage(i),a.SetRectangle(0,0,e,r),i},l=(t,e,r)=>{const{options:{lang:n},workerOptions:{langPath:o}}=t;return i({langs:n,tessModule:s,langURI:o,cache:!0}).then(r)};e.dispatchHandlers=((t,e)=>{const r=(r,n)=>{e({jobId:t.jobId,status:r,action:t.action,data:n})};r.resolve=r.bind(this,"resolve"),r.reject=r.bind(this,"reject"),r.progress=r.bind(this,"progress"),h=r;try{"recognize"===t.action?((t,e)=>{u(t,e).then(()=>{l(t,0,()=>{const{options:r}=t,n=t=>{e.progress({status:"initializing api",progress:t})};n(0),a.Init(null,r.lang),n(.3),Object.keys(r).forEach(t=>{a.SetVariable(t,r[t])}),n(.6);const i=c(t.image);n(1),a.Recognize(null);const h=o(s,a);a.End(),s._free(i),e.resolve(h)})})})(t.payload,r):"detect"===t.action&&((t,e)=>{u(t,e).then(()=>{t.options.lang="osd",l(t,0,()=>{a.Init(null,"osd"),a.SetPageSegMode(s.PSM_OSD_ONLY);const r=c(t.image),n=new s.OSResults;if(a.DetectOS(n)){const t=n.get_best_result(),i=t.get_orientation_id(),o=t.get_script_id();a.End(),s._free(r),e.resolve({tesseract_script_id:o,script:n.get_unicharset().get_script_from_script_id(o),script_confidence:t.get_sconfidence(),orientation_degrees:[0,270,180,90][i],orientation_confidence:t.get_oconfidence()})}else a.End(),s._free(r),e.reject("Failed to detect OS")})})})(t.payload,r)}catch(t){r.reject(t.toString())}}),e.setAdapter=(t=>{f=t})},function(t,e,r){t.exports={loadLang:r(4)({fetch:r(5),gunzip:r(7),...r(14)}),readImage:r(16)}},function(t,e){const r=t=>({tessModule:e,dataPath:r,cachePath:n,cache:i,lang:o})=>s=>{if(e){if(r)try{e.FS.mkdir(r)}catch(t){}e.FS.writeFile(`${r||"."}/${o}.traineddata`,s)}return i&&t.writeCache(`${n||"."}/${o}.traineddata`,s),s};t.exports=(t=>({langs:e,...n})=>Promise.all(e.split("+").map((t=>({langURI:e,cachePath:n,...i})=>o=>t.readCache(`${n||"."}/${o}.traineddata`).then(e=>void 0===e?Promise.reject():r(t)({cachePath:n,lang:o,...i})(e)).catch(()=>t.fetch(`${e}/${o}.traineddata.gz`).then(t=>t.arrayBuffer()).then(e=>t.gunzip(new Uint8Array(e))).then(r(t)({cachePath:n,lang:o,...i}))))(t)(n))))},function(t,e,r){const{fetch:n}=r(6);t.exports=n},function(t,e,r){"use strict";r.r(e),r.d(e,"Headers",function(){return f}),r.d(e,"Request",function(){return g}),r.d(e,"Response",function(){return w}),r.d(e,"DOMException",function(){return m}),r.d(e,"fetch",function(){return A});var n={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(n.arrayBuffer)var i=["[object Int8Array]","[object Uint8Array]","[object Uint8ClampedArray]","[object Int16Array]","[object Uint16Array]","[object Int32Array]","[object Uint32Array]","[object Float32Array]","[object Float64Array]"],o=ArrayBuffer.isView||function(t){return t&&i.indexOf(Object.prototype.toString.call(t))>-1};function s(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 n.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 y(){return this.bodyUsed=!1,this._initBody=function(t){var e;this._bodyInit=t,t?"string"==typeof t?this._bodyText=t:n.blob&&Blob.prototype.isPrototypeOf(t)?this._bodyBlob=t:n.formData&&FormData.prototype.isPrototypeOf(t)?this._bodyFormData=t:n.searchParams&&URLSearchParams.prototype.isPrototypeOf(t)?this._bodyText=t.toString():n.arrayBuffer&&n.blob&&((e=t)&&DataView.prototype.isPrototypeOf(e))?(this._bodyArrayBuffer=p(t.buffer),this._bodyInit=new Blob([this._bodyArrayBuffer])):n.arrayBuffer&&(ArrayBuffer.prototype.isPrototypeOf(t)||o(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):n.searchParams&&URLSearchParams.prototype.isPrototypeOf(t)&&this.headers.set("content-type","application/x-www-form-urlencoded;charset=UTF-8"))},n.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,n=u(this);if(n)return n;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),n=0;n<e.length;n++)r[n]=String.fromCharCode(e[n]);return r.join("")}(this._bodyArrayBuffer));if(this._bodyFormData)throw new Error("could not read FormData body as text");return Promise.resolve(this._bodyText)},n.formData&&(this.formData=function(){return this.text().then(b)}),this.json=function(){return this.text().then(JSON.parse)},this}f.prototype.append=function(t,e){t=s(t),e=a(e);var r=this.map[t];this.map[t]=r?r+", "+e:e},f.prototype.delete=function(t){delete this.map[s(t)]},f.prototype.get=function(t){return t=s(t),this.has(t)?this.map[t]:null},f.prototype.has=function(t){return this.map.hasOwnProperty(s(t))},f.prototype.set=function(t,e){this.map[s(t)]=a(e)},f.prototype.forEach=function(t,e){for(var r in this.map)this.map.hasOwnProperty(r)&&t.call(e,this.map[r],r,this)},f.prototype.keys=function(){var t=[];return this.forEach(function(e,r){t.push(r)}),h(t)},f.prototype.values=function(){var t=[];return this.forEach(function(e){t.push(e)}),h(t)},f.prototype.entries=function(){var t=[];return this.forEach(function(e,r){t.push([r,e])}),h(t)},n.iterable&&(f.prototype[Symbol.iterator]=f.prototype.entries);var d=["DELETE","GET","HEAD","OPTIONS","POST","PUT"];function g(t,e){var r,n,i=(e=e||{}).body;if(t instanceof g){if(t.bodyUsed)throw new TypeError("Already read");this.url=t.url,this.credentials=t.credentials,e.headers||(this.headers=new f(t.headers)),this.method=t.method,this.mode=t.mode,this.signal=t.signal,i||null==t._bodyInit||(i=t._bodyInit,t.bodyUsed=!0)}else this.url=String(t);if(this.credentials=e.credentials||this.credentials||"same-origin",!e.headers&&this.headers||(this.headers=new f(e.headers)),this.method=(r=e.method||this.method||"GET",n=r.toUpperCase(),d.indexOf(n)>-1?n:r),this.mode=e.mode||this.mode||null,this.signal=e.signal||this.signal,this.referrer=null,("GET"===this.method||"HEAD"===this.method)&&i)throw new TypeError("Body not allowed for GET or HEAD requests");this._initBody(i)}function b(t){var e=new FormData;return t.trim().split("&").forEach(function(t){if(t){var r=t.split("="),n=r.shift().replace(/\+/g," "),i=r.join("=").replace(/\+/g," ");e.append(decodeURIComponent(n),decodeURIComponent(i))}}),e}function w(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)}g.prototype.clone=function(){return new g(this,{body:this._bodyInit})},y.call(g.prototype),y.call(w.prototype),w.prototype.clone=function(){return new w(this._bodyInit,{status:this.status,statusText:this.statusText,headers:new f(this.headers),url:this.url})},w.error=function(){var t=new w(null,{status:0,statusText:""});return t.type="error",t};var v=[301,302,303,307,308];w.redirect=function(t,e){if(-1===v.indexOf(e))throw new RangeError("Invalid status code");return new w(null,{status:e,headers:{location:t}})};var m=self.DOMException;try{new m}catch(t){(m=function(t,e){this.message=t,this.name=e;var r=Error(t);this.stack=r.stack}).prototype=Object.create(Error.prototype),m.prototype.constructor=m}function A(t,e){return new Promise(function(r,i){var o=new g(t,e);if(o.signal&&o.signal.aborted)return i(new m("Aborted","AbortError"));var s=new XMLHttpRequest;function a(){s.abort()}s.onload=function(){var t,e,n={status:s.status,statusText:s.statusText,headers:(t=s.getAllResponseHeaders()||"",e=new f,t.replace(/\r?\n[\t ]+/g," ").split(/\r?\n/).forEach(function(t){var r=t.split(":"),n=r.shift().trim();if(n){var i=r.join(":").trim();e.append(n,i)}}),e)};n.url="responseURL"in s?s.responseURL:n.headers.get("X-Request-URL");var i="response"in s?s.response:s.responseText;r(new w(i,n))},s.onerror=function(){i(new TypeError("Network request failed"))},s.ontimeout=function(){i(new TypeError("Network request failed"))},s.onabort=function(){i(new m("Aborted","AbortError"))},s.open(o.method,o.url,!0),"include"===o.credentials?s.withCredentials=!0:"omit"===o.credentials&&(s.withCredentials=!1),"responseType"in s&&n.blob&&(s.responseType="blob"),o.headers.forEach(function(t,e){s.setRequestHeader(e,t)}),o.signal&&(o.signal.addEventListener("abort",a),s.onreadystatechange=function(){4===s.readyState&&o.signal.removeEventListener("abort",a)}),s.send(void 0===o._bodyInit?null:o._bodyInit)})}A.polyfill=!0,self.fetch||(self.fetch=A,self.Headers=f,self.Request=g,self.Response=w)},function(t,e,r){t.exports=r(8).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 n(t){throw t}var i=void 0,o=!0,s="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(s?Uint8Array:Array)?t:new(s?Uint8Array:Array)(32768),2*this.buffer.length<=this.index&&n(Error("invalid index")),this.buffer.length<=this.index&&this.f()}a.prototype.f=function(){var t,e=this.buffer,r=e.length,n=new(s?Uint8Array:Array)(r<<1);if(s)n.set(e);else for(t=0;t<r;++t)n[t]=e[t];return this.buffer=n},a.prototype.d=function(t,e,r){var n,i=this.buffer,o=this.index,s=this.m,a=i[o];if(r&&1<e&&(t=8<e?(p[255&t]<<24|p[t>>>8&255]<<16|p[t>>>16&255]<<8|p[t>>>24&255])>>32-e:p[t]>>8-e),8>e+s)a=a<<e|t,s+=e;else for(n=0;n<e;++n)a=a<<1|t>>e-n-1&1,8==++s&&(s=0,i[o++]=p[a],a=0,o===i.length&&(i=this.f()));i[o]=a,this.buffer=i,this.m=s,this.index=o},a.prototype.finish=function(){var t,e=this.buffer,r=this.index;return 0<this.m&&(e[r]<<=8-this.m,e[r]=p[e[r]],r++),s?t=e.subarray(0,r):(e.length=r,t=e),t};var h,f=new(s?Uint8Array:Array)(256);for(h=0;256>h;++h){for(var u=l=h,c=7,l=l>>>1;l;l>>>=1)u<<=1,u|=1&l,--c;f[h]=(u<<c&255)>>>0}var p=f;function y(t,e,r){var n,i="number"==typeof e?e:e=0,o="number"==typeof r?r:t.length;for(n=-1,i=7&o;i--;++e)n=n>>>8^g[255&(n^t[e])];for(i=o>>3;i--;e+=8)n=(n=(n=(n=(n=(n=(n=(n=n>>>8^g[255&(n^t[e])])>>>8^g[255&(n^t[e+1])])>>>8^g[255&(n^t[e+2])])>>>8^g[255&(n^t[e+3])])>>>8^g[255&(n^t[e+4])])>>>8^g[255&(n^t[e+5])])>>>8^g[255&(n^t[e+6])])>>>8^g[255&(n^t[e+7])];return(4294967295^n)>>>0}var d=[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],g=s?new Uint32Array(d):d;function b(){}function w(t){this.buffer=new(s?Uint16Array:Array)(2*t),this.length=0}function v(t){var e,r,n,i,o,a,h,f,u,c,l=t.length,p=0,y=Number.POSITIVE_INFINITY;for(f=0;f<l;++f)t[f]>p&&(p=t[f]),t[f]<y&&(y=t[f]);for(e=1<<p,r=new(s?Uint32Array:Array)(e),n=1,i=0,o=2;n<=p;){for(f=0;f<l;++f)if(t[f]===n){for(a=0,h=i,u=0;u<n;++u)a=a<<1|1&h,h>>=1;for(c=n<<16|f,u=a;u<e;u+=o)r[u]=c;++i}++n,i<<=1,o<<=1}return[r,p,y]}function m(t,e){this.k=_,this.F=0,this.input=s&&t instanceof Array?new Uint8Array(t):t,this.b=0,e&&(e.lazy&&(this.F=e.lazy),"number"==typeof e.compressionType&&(this.k=e.compressionType),e.outputBuffer&&(this.a=s&&e.outputBuffer instanceof Array?new Uint8Array(e.outputBuffer):e.outputBuffer),"number"==typeof e.outputIndex&&(this.b=e.outputIndex)),this.a||(this.a=new(s?Uint8Array:Array)(32768))}w.prototype.getParent=function(t){return 2*((t-2)/4|0)},w.prototype.push=function(t,e){var r,n,i,o=this.buffer;for(r=this.length,o[this.length++]=e,o[this.length++]=t;0<r&&(n=this.getParent(r),o[r]>o[n]);)i=o[r],o[r]=o[n],o[n]=i,i=o[r+1],o[r+1]=o[n+1],o[n+1]=i,r=n;return this.length},w.prototype.pop=function(){var t,e,r,n,i,o=this.buffer;for(e=o[0],t=o[1],this.length-=2,o[0]=o[this.length],o[1]=o[this.length+1],i=0;!((n=2*i+2)>=this.length)&&(n+2<this.length&&o[n+2]>o[n]&&(n+=2),o[n]>o[i]);)r=o[i],o[i]=o[n],o[n]=r,r=o[i+1],o[i+1]=o[n+1],o[n+1]=r,i=n;return{index:t,value:e,length:this.length}};var A,_=2,E={NONE:0,L:1,t:_,X:3},T=[];for(A=0;288>A;A++)switch(o){case 143>=A:T.push([A+48,8]);break;case 255>=A:T.push([A-144+400,9]);break;case 279>=A:T.push([A-256+0,7]);break;case 287>=A:T.push([A-280+192,8]);break;default:n("invalid literal: "+A)}function B(t,e){this.length=t,this.N=e}m.prototype.h=function(){var t,e,r,h,f=this.input;switch(this.k){case 0:for(r=0,h=f.length;r<h;){var u,c,l,p=e=s?f.subarray(r,r+65535):f.slice(r,r+65535),y=(r+=e.length)===h,d=i,g=i,b=this.a,w=this.b;if(s){for(b=new Uint8Array(this.a.buffer);b.length<=w+p.length+5;)b=new Uint8Array(b.length<<1);b.set(this.a)}if(u=y?1:0,b[w++]=0|u,l=65536+~(c=p.length)&65535,b[w++]=255&c,b[w++]=c>>>8&255,b[w++]=255&l,b[w++]=l>>>8&255,s)b.set(p,w),w+=p.length,b=b.subarray(0,w);else{for(d=0,g=p.length;d<g;++d)b[w++]=p[d];b.length=w}this.b=w,this.a=b}break;case 1:var v=new a(s?new Uint8Array(this.a.buffer):this.a,this.b);v.d(1,1,o),v.d(1,2,o);var m,A,E,B=P(this,f);for(m=0,A=B.length;m<A;m++)if(E=B[m],a.prototype.d.apply(v,T[E]),256<E)v.d(B[++m],B[++m],o),v.d(B[++m],5),v.d(B[++m],B[++m],o);else if(256===E)break;this.a=v.finish(),this.b=this.a.length;break;case _:var R,U,I,k,O,L,C,D,M,Y,j,N,F,z,G,H=new a(s?new Uint8Array(this.a.buffer):this.a,this.b),V=[16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15],W=Array(19);for(R=_,H.d(1,1,o),H.d(R,2,o),U=P(this,f),C=x(L=S(this.U,15)),M=x(D=S(this.T,7)),I=286;257<I&&0===L[I-1];I--);for(k=30;1<k&&0===D[k-1];k--);var q,$,K,X,J,Q,Z=I,tt=k,et=new(s?Uint32Array:Array)(Z+tt),rt=new(s?Uint32Array:Array)(316),nt=new(s?Uint8Array:Array)(19);for(q=$=0;q<Z;q++)et[$++]=L[q];for(q=0;q<tt;q++)et[$++]=D[q];if(!s)for(q=0,X=nt.length;q<X;++q)nt[q]=0;for(q=J=0,X=et.length;q<X;q+=$){for($=1;q+$<X&&et[q+$]===et[q];++$);if(K=$,0===et[q])if(3>K)for(;0<K--;)rt[J++]=0,nt[0]++;else for(;0<K;)(Q=138>K?K:138)>K-3&&Q<K&&(Q=K-3),10>=Q?(rt[J++]=17,rt[J++]=Q-3,nt[17]++):(rt[J++]=18,rt[J++]=Q-11,nt[18]++),K-=Q;else if(rt[J++]=et[q],nt[et[q]]++,3>--K)for(;0<K--;)rt[J++]=et[q],nt[et[q]]++;else for(;0<K;)(Q=6>K?K:6)>K-3&&Q<K&&(Q=K-3),rt[J++]=16,rt[J++]=Q-3,nt[16]++,K-=Q}for(t=s?rt.subarray(0,J):rt.slice(0,J),Y=S(nt,7),z=0;19>z;z++)W[z]=Y[V[z]];for(O=19;4<O&&0===W[O-1];O--);for(j=x(Y),H.d(I-257,5,o),H.d(k-1,5,o),H.d(O-4,4,o),z=0;z<O;z++)H.d(W[z],3,o);for(z=0,G=t.length;z<G;z++)if(N=t[z],H.d(j[N],Y[N],o),16<=N){switch(z++,N){case 16:F=2;break;case 17:F=3;break;case 18:F=7;break;default:n("invalid code: "+N)}H.d(t[z],F,o)}var it,ot,st,at,ht,ft,ut,ct,lt=[C,L],pt=[M,D];for(ht=lt[0],ft=lt[1],ut=pt[0],ct=pt[1],it=0,ot=U.length;it<ot;++it)if(st=U[it],H.d(ht[st],ft[st],o),256<st)H.d(U[++it],U[++it],o),at=U[++it],H.d(ut[at],ct[at],o),H.d(U[++it],U[++it],o);else if(256===st)break;this.a=H.finish(),this.b=this.a.length;break;default:n("invalid compression type")}return this.a};var R=function(){function t(t){switch(o){case 3===t:return[257,t-3,0];case 4===t:return[258,t-4,0];case 5===t:return[259,t-5,0];case 6===t:return[260,t-6,0];case 7===t:return[261,t-7,0];case 8===t:return[262,t-8,0];case 9===t:return[263,t-9,0];case 10===t:return[264,t-10,0];case 12>=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:n("invalid length: "+t)}}var e,r,i=[];for(e=3;258>=e;e++)r=t(e),i[e]=r[2]<<24|r[1]<<16|r[0];return i}(),U=s?new Uint32Array(R):R;function P(t,e){function r(t,e){var r,i,s,a,h=t.N,f=[],u=0;switch(r=U[t.length],f[u++]=65535&r,f[u++]=r>>16&255,f[u++]=r>>24,o){case 1===h:i=[0,h-1,0];break;case 2===h:i=[1,h-2,0];break;case 3===h:i=[2,h-3,0];break;case 4===h:i=[3,h-4,0];break;case 6>=h:i=[4,h-5,1];break;case 8>=h:i=[5,h-7,1];break;case 12>=h:i=[6,h-9,2];break;case 16>=h:i=[7,h-13,2];break;case 24>=h:i=[8,h-17,3];break;case 32>=h:i=[9,h-25,3];break;case 48>=h:i=[10,h-33,4];break;case 64>=h:i=[11,h-49,4];break;case 96>=h:i=[12,h-65,5];break;case 128>=h:i=[13,h-97,5];break;case 192>=h:i=[14,h-129,6];break;case 256>=h:i=[15,h-193,6];break;case 384>=h:i=[16,h-257,7];break;case 512>=h:i=[17,h-385,7];break;case 768>=h:i=[18,h-513,8];break;case 1024>=h:i=[19,h-769,8];break;case 1536>=h:i=[20,h-1025,9];break;case 2048>=h:i=[21,h-1537,9];break;case 3072>=h:i=[22,h-2049,10];break;case 4096>=h:i=[23,h-3073,10];break;case 6144>=h:i=[24,h-4097,11];break;case 8192>=h:i=[25,h-6145,11];break;case 12288>=h:i=[26,h-8193,12];break;case 16384>=h:i=[27,h-12289,12];break;case 24576>=h:i=[28,h-16385,13];break;case 32768>=h:i=[29,h-24577,13];break;default:n("invalid distance")}for(r=i,f[u++]=r[0],f[u++]=r[1],f[u++]=r[2],s=0,a=f.length;s<a;++s)b[w++]=f[s];m[f[0]]++,A[f[3]]++,v=t.length+e-1,y=null}var a,h,f,u,c,l,p,y,d,g={},b=s?new Uint16Array(2*e.length):[],w=0,v=0,m=new(s?Uint32Array:Array)(286),A=new(s?Uint32Array:Array)(30),_=t.F;if(!s){for(f=0;285>=f;)m[f++]=0;for(f=0;29>=f;)A[f++]=0}for(m[256]=1,a=0,h=e.length;a<h;++a){for(f=c=0,u=3;f<u&&a+f!==h;++f)c=c<<8|e[a+f];if(g[c]===i&&(g[c]=[]),l=g[c],!(0<v--)){for(;0<l.length&&32768<a-l[0];)l.shift();if(a+3>=h){for(y&&r(y,-1),f=0,u=h-a;f<u;++f)d=e[a+f],b[w++]=d,++m[d];break}0<l.length?(p=I(e,a,l),y?y.length<p.length?(d=e[a-1],b[w++]=d,++m[d],r(p,0)):r(y,-1):p.length<_?y=p:r(p,0)):y?r(y,-1):(d=e[a],b[w++]=d,++m[d])}l.push(a)}return b[w++]=256,m[256]++,t.U=m,t.T=A,s?b.subarray(0,w):b}function I(t,e,r){var n,i,o,s,a,h,f=0,u=t.length;s=0,h=r.length;t:for(;s<h;s++){if(n=r[h-s-1],o=3,3<f){for(a=f;3<a;a--)if(t[n+a-1]!==t[e+a-1])continue t;o=f}for(;258>o&&e+o<u&&t[n+o]===t[e+o];)++o;if(o>f&&(i=n,f=o),258===o)break}return new B(f,e-i)}function S(t,e){var r,n,i,o,a,h=t.length,f=new w(572),u=new(s?Uint8Array:Array)(h);if(!s)for(o=0;o<h;o++)u[o]=0;for(o=0;o<h;++o)0<t[o]&&f.push(o,t[o]);if(r=Array(f.length/2),n=new(s?Uint32Array:Array)(f.length/2),1===r.length)return u[f.pop().index]=1,u;for(o=0,a=f.length/2;o<a;++o)r[o]=f.pop(),n[o]=r[o].value;for(i=function(t,e,r){function n(t){var r=y[t][d[t]];r===e?(n(t+1),n(t+1)):--l[r],++d[t]}var i,o,a,h,f,u=new(s?Uint16Array:Array)(r),c=new(s?Uint8Array:Array)(r),l=new(s?Uint8Array:Array)(e),p=Array(r),y=Array(r),d=Array(r),g=(1<<r)-e,b=1<<r-1;for(u[r-1]=e,o=0;o<r;++o)g<b?c[o]=0:(c[o]=1,g-=b),g<<=1,u[r-2-o]=(u[r-1-o]/2|0)+e;for(u[0]=c[0],p[0]=Array(u[0]),y[0]=Array(u[0]),o=1;o<r;++o)u[o]>2*u[o-1]+c[o]&&(u[o]=2*u[o-1]+c[o]),p[o]=Array(u[o]),y[o]=Array(u[o]);for(i=0;i<e;++i)l[i]=r;for(a=0;a<u[r-1];++a)p[r-1][a]=t[a],y[r-1][a]=a;for(i=0;i<r;++i)d[i]=0;for(1===c[r-1]&&(--l[0],++d[r-1]),o=r-2;0<=o;--o){for(h=i=0,f=d[o+1],a=0;a<u[o];a++)(h=p[o+1][f]+p[o+1][f+1])>t[i]?(p[o][a]=h,y[o][a]=e,f+=2):(p[o][a]=t[i],y[o][a]=i,++i);d[o]=0,1===c[o]&&n(o)}return l}(n,n.length,e),o=0,a=r.length;o<a;++o)u[r[o].index]=i[o];return u}function x(t){var e,r,n,i,o=new(s?Uint16Array:Array)(t.length),a=[],h=[],f=0;for(e=0,r=t.length;e<r;e++)a[t[e]]=1+(0|a[t[e]]);for(e=1,r=16;e<=r;e++)h[e]=f,f+=0|a[e],f<<=1;for(e=0,r=t.length;e<r;e++)for(f=h[t[e]],h[t[e]]+=1,n=o[e]=0,i=t[e];n<i;n++)o[e]=o[e]<<1|1&f,f>>>=1;return o}function k(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={})}k.prototype.h=function(){var t,e,r,n,o,a,h,f,u=new(s?Uint8Array:Array)(32768),c=0,l=this.input,p=this.c,d=this.filename,g=this.w;if(u[c++]=31,u[c++]=139,u[c++]=8,t=0,this.g.fname&&(t|=C),this.g.fcomment&&(t|=D),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++]=O,this.g.fname!==i){for(h=0,f=d.length;h<f;++h)255<(a=d.charCodeAt(h))&&(u[c++]=a>>>8&255),u[c++]=255&a;u[c++]=0}if(this.g.comment){for(h=0,f=g.length;h<f;++h)255<(a=g.charCodeAt(h))&&(u[c++]=a>>>8&255),u[c++]=255&a;u[c++]=0}return this.g.fhcrc&&(r=65535&y(u,0,c),u[c++]=255&r,u[c++]=r>>>8&255),this.l.outputBuffer=u,this.l.outputIndex=c,u=(o=new m(l,this.l)).h(),c=o.b,s&&(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)),n=y(l,i,i),u[c++]=255&n,u[c++]=n>>>8&255,u[c++]=n>>>16&255,u[c++]=n>>>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,s&&c<u.length&&(this.a=u=u.subarray(0,c)),u};var O=255,L=2,C=8,D=16;function M(t,e){switch(this.o=[],this.p=32768,this.e=this.j=this.c=this.s=0,this.input=s?new Uint8Array(t):t,this.u=!1,this.q=j,this.K=!1,!e&&(e={})||(e.index&&(this.c=e.index),e.bufferSize&&(this.p=e.bufferSize),e.bufferType&&(this.q=e.bufferType),e.resize&&(this.K=e.resize)),this.q){case Y:this.b=32768,this.a=new(s?Uint8Array:Array)(32768+this.p+258);break;case j:this.b=0,this.a=new(s?Uint8Array:Array)(this.p),this.f=this.S,this.z=this.O,this.r=this.Q;break;default:n(Error("invalid inflate mode"))}}var Y=0,j=1;M.prototype.i=function(){for(;!this.u;){var t=it(this,3);switch(1&t&&(this.u=o),t>>>=1){case 0:var e=this.input,r=this.c,a=this.a,h=this.b,f=e.length,u=i,c=a.length,l=i;switch(this.e=this.j=0,r+1>=f&&n(Error("invalid uncompressed block header: LEN")),u=e[r++]|e[r++]<<8,r+1>=f&&n(Error("invalid uncompressed block header: NLEN")),u===~(e[r++]|e[r++]<<8)&&n(Error("invalid uncompressed block header: length verify")),r+u>e.length&&n(Error("input buffer is broken")),this.q){case Y:for(;h+u>a.length;){if(u-=l=c-h,s)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 j:for(;h+u>a.length;)a=this.f({B:2});break;default:n(Error("invalid inflate mode"))}if(s)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,nt);break;case 2:var p,y,d,g,b=it(this,5)+257,w=it(this,5)+1,m=it(this,4)+4,A=new(s?Uint8Array:Array)(G.length),_=i,E=i,T=i,B=i,R=i;for(R=0;R<m;++R)A[G[R]]=it(this,3);if(!s)for(R=m,m=A.length;R<m;++R)A[G[R]]=0;for(p=v(A),_=new(s?Uint8Array:Array)(b+w),R=0,g=b+w;R<g;)switch(E=ot(this,p),E){case 16:for(B=3+it(this,2);B--;)_[R++]=T;break;case 17:for(B=3+it(this,3);B--;)_[R++]=0;T=0;break;case 18:for(B=11+it(this,7);B--;)_[R++]=0;T=0;break;default:T=_[R++]=E}y=v(s?_.subarray(0,b):_.slice(0,b)),d=v(s?_.subarray(b):_.slice(b)),this.r(y,d);break;default:n(Error("unknown BTYPE: "+t))}}return this.z()};var N,F,z=[16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15],G=s?new Uint16Array(z):z,H=[3,4,5,6,7,8,9,10,11,13,15,17,19,23,27,31,35,43,51,59,67,83,99,115,131,163,195,227,258,258,258],V=s?new Uint16Array(H):H,W=[0,0,0,0,0,0,0,0,1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,0,0,0],q=s?new Uint8Array(W):W,$=[1,2,3,4,5,7,9,13,17,25,33,49,65,97,129,193,257,385,513,769,1025,1537,2049,3073,4097,6145,8193,12289,16385,24577],K=s?new Uint16Array($):$,X=[0,0,0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8,9,9,10,10,11,11,12,12,13,13],J=s?new Uint8Array(X):X,Q=new(s?Uint8Array:Array)(288);for(N=0,F=Q.length;N<F;++N)Q[N]=143>=N?8:255>=N?9:279>=N?7:8;var Z,tt,et=v(Q),rt=new(s?Uint8Array:Array)(30);for(Z=0,tt=rt.length;Z<tt;++Z)rt[Z]=5;var nt=v(rt);function it(t,e){for(var r,i=t.j,o=t.e,s=t.input,a=t.c,h=s.length;o<e;)a>=h&&n(Error("input buffer is broken")),i|=s[a++]<<o,o+=8;return r=i&(1<<e)-1,t.j=i>>>e,t.e=o-e,t.c=a,r}function ot(t,e){for(var r,i,o=t.j,s=t.e,a=t.input,h=t.c,f=a.length,u=e[0],c=e[1];s<c&&!(h>=f);)o|=a[h++]<<s,s+=8;return(i=(r=u[o&(1<<c)-1])>>>16)>s&&n(Error("invalid code length: "+i)),t.j=o>>i,t.e=s-i,t.c=h,65535&r}function st(t){this.input=t,this.c=0,this.G=[],this.R=!1}function at(t){if("string"==typeof t){var e,r,n=t.split("");for(e=0,r=n.length;e<r;e++)n[e]=(255&n[e].charCodeAt(0))>>>0;t=n}for(var i,o=1,s=0,a=t.length,h=0;0<a;){a-=i=1024<a?1024:a;do{s+=o+=t[h++]}while(--i);o%=65521,s%=65521}return(s<<16|o)>>>0}function ht(t,e){var r,i;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++],i=t[this.c++],15&r){case ft:this.method=ft;break;default:n(Error("unsupported compression method"))}0!=((r<<8)+i)%31&&n(Error("invalid fcheck flag:"+((r<<8)+i)%31)),32&i&&n(Error("fdict flag is not supported")),this.J=new M(t,{index:this.c,bufferSize:e.bufferSize,bufferType:e.bufferType,resize:e.resize})}M.prototype.r=function(t,e){var r=this.a,n=this.b;this.A=t;for(var i,o,s,a,h=r.length-258;256!==(i=ot(this,t));)if(256>i)n>=h&&(this.b=n,r=this.f(),n=this.b),r[n++]=i;else for(a=V[o=i-257],0<q[o]&&(a+=it(this,q[o])),i=ot(this,e),s=K[i],0<J[i]&&(s+=it(this,J[i])),n>=h&&(this.b=n,r=this.f(),n=this.b);a--;)r[n]=r[n++-s];for(;8<=this.e;)this.e-=8,this.c--;this.b=n},M.prototype.Q=function(t,e){var r=this.a,n=this.b;this.A=t;for(var i,o,s,a,h=r.length;256!==(i=ot(this,t));)if(256>i)n>=h&&(h=(r=this.f()).length),r[n++]=i;else for(a=V[o=i-257],0<q[o]&&(a+=it(this,q[o])),i=ot(this,e),s=K[i],0<J[i]&&(s+=it(this,J[i])),n+a>h&&(h=(r=this.f()).length);a--;)r[n]=r[n++-s];for(;8<=this.e;)this.e-=8,this.c--;this.b=n},M.prototype.f=function(){var t,e,r=new(s?Uint8Array:Array)(this.b-32768),n=this.b-32768,i=this.a;if(s)r.set(i.subarray(32768,r.length));else for(t=0,e=r.length;t<e;++t)r[t]=i[t+32768];if(this.o.push(r),this.s+=r.length,s)i.set(i.subarray(n,n+32768));else for(t=0;32768>t;++t)i[t]=i[n+t];return this.b=32768,i},M.prototype.S=function(t){var e,r,n,i=this.input.length/this.c+1|0,o=this.input,a=this.a;return t&&("number"==typeof t.B&&(i=t.B),"number"==typeof t.M&&(i+=t.M)),2>i?r=(n=(o.length-this.c)/this.A[2]/2*258|0)<a.length?a.length+n:a.length<<1:r=a.length*i,s?(e=new Uint8Array(r)).set(a):e=a,this.a=e},M.prototype.z=function(){var t,e,r,n,i,o=0,a=this.a,h=this.o,f=new(s?Uint8Array:Array)(this.s+(this.b-32768));if(0===h.length)return s?this.a.subarray(32768,this.b):this.a.slice(32768,this.b);for(e=0,r=h.length;e<r;++e)for(n=0,i=(t=h[e]).length;n<i;++n)f[o++]=t[n];for(e=32768,r=this.b;e<r;++e)f[o++]=a[e];return this.o=[],this.buffer=f},M.prototype.O=function(){var t,e=this.b;return s?this.K?(t=new Uint8Array(e)).set(this.a.subarray(0,e)):t=this.a.subarray(0,e):(this.a.length>e&&(this.a.length=e),t=this.a),this.buffer=t},st.prototype.i=function(){for(var t=this.input.length;this.c<t;){var e,r,a=new b,h=i,f=i,u=i,c=i,l=i,p=i,d=i,g=this.input,w=this.c;switch(a.C=g[w++],a.D=g[w++],(31!==a.C||139!==a.D)&&n(Error("invalid file signature:"+a.C+","+a.D)),a.v=g[w++],a.v){case 8:break;default:n(Error("unknown compression method: "+a.v))}if(a.n=g[w++],r=g[w++]|g[w++]<<8|g[w++]<<16|g[w++]<<24,a.$=new Date(1e3*r),a.ba=g[w++],a.aa=g[w++],0<(4&a.n)&&(a.W=g[w++]|g[w++]<<8,w+=a.W),0<(a.n&C)){for(p=[],l=0;0<(c=g[w++]);)p[l++]=String.fromCharCode(c);a.name=p.join("")}if(0<(a.n&D)){for(p=[],l=0;0<(c=g[w++]);)p[l++]=String.fromCharCode(c);a.w=p.join("")}0<(a.n&L)&&(a.P=65535&y(g,0,w),a.P!==(g[w++]|g[w++]<<8)&&n(Error("invalid header crc16"))),h=g[g.length-4]|g[g.length-3]<<8|g[g.length-2]<<16|g[g.length-1]<<24,g.length-w-4-4<512*h&&(u=h),f=new M(g,{index:w,bufferSize:u}),a.data=e=f.i(),w=f.c,a.Y=d=(g[w++]|g[w++]<<8|g[w++]<<16|g[w++]<<24)>>>0,y(e,i,i)!==d&&n(Error("invalid CRC-32 checksum: 0x"+y(e,i,i).toString(16)+" / 0x"+d.toString(16))),a.Z=h=(g[w++]|g[w++]<<8|g[w++]<<16|g[w++]<<24)>>>0,(4294967295&e.length)!==h&&n(Error("invalid input size: "+(4294967295&e.length)+" / "+h)),this.G.push(a),this.c=w}this.R=o;var v,m,A,_=this.G,E=0,T=0;for(v=0,m=_.length;v<m;++v)T+=_[v].data.length;if(s)for(A=new Uint8Array(T),v=0;v<m;++v)A.set(_[v].data,E),E+=_[v].data.length;else{for(A=[],v=0;v<m;++v)A[v]=_[v].data;A=Array.prototype.concat.apply([],A)}return A},ht.prototype.i=function(){var t,e=this.input;return t=this.J.i(),this.c=this.J.c,this.V&&((e[this.c++]<<24|e[this.c++]<<16|e[this.c++]<<8|e[this.c++])>>>0!==at(t)&&n(Error("invalid adler-32 checksum"))),t};var ft=8;function ut(t,e){this.input=t,this.a=new(s?Uint8Array:Array)(32768),this.k=ct.t;var r,n={};for(r in!e&&(e={})||"number"!=typeof e.compressionType||(this.k=e.compressionType),e)n[r]=e[r];n.outputBuffer=this.a,this.I=new m(this.input,n)}var ct=E;function lt(t,e){var r;return r=new ut(t).h(),e||(e={}),e.H?r:gt(r)}function pt(t,e){var r;return t.subarray=t.slice,r=new ht(t).i(),e||(e={}),e.noBuffer?r:gt(r)}function yt(t,e){var r;return t.subarray=t.slice,r=new k(t).h(),e||(e={}),e.H?r:gt(r)}function dt(t,e){var r;return t.subarray=t.slice,r=new st(t).i(),e||(e={}),e.H?r:gt(r)}function gt(t){var e,n,i=new r(t.length);for(e=0,n=t.length;e<n;++e)i[e]=t[e];return i}ut.prototype.h=function(){var t,e,r,i,o,a,h,f=0;switch(h=this.a,t=ft){case ft:e=Math.LOG2E*Math.log(32768)-8;break;default:n(Error("invalid compression method"))}switch(r=e<<4|t,h[f++]=r,t){case ft:switch(this.k){case ct.NONE:o=0;break;case ct.L:o=1;break;case ct.t:o=2;break;default:n(Error("unsupported compression type"))}break;default:n(Error("invalid compression method"))}return i=o<<6|0,h[f++]=i|31-(256*r+i)%31,a=at(this.input),this.I.b=f,f=(h=this.I.h()).length,s&&((h=new Uint8Array(h.buffer)).length<=f+4&&(this.a=new Uint8Array(h.length+4),this.a.set(h),h=this.a),h=h.subarray(0,f+4)),h[f++]=a>>24&255,h[f++]=a>>16&255,h[f++]=a>>8&255,h[f++]=255&a,h},e.deflate=function(e,r,n){t.nextTick(function(){var t,i;try{i=lt(e,n)}catch(e){t=e}r(t,i)})},e.deflateSync=lt,e.inflate=function(e,r,n){t.nextTick(function(){var t,i;try{i=pt(e,n)}catch(e){t=e}r(t,i)})},e.inflateSync=pt,e.gzip=function(e,r,n){t.nextTick(function(){var t,i;try{i=yt(e,n)}catch(e){t=e}r(t,i)})},e.gzipSync=yt,e.gunzip=function(e,r,n){t.nextTick(function(){var t,i;try{i=dt(e,n)}catch(e){t=e}r(t,i)})},e.gunzipSync=dt}).call(this)}).call(this,r(9),r(10).Buffer)},function(t,e){var r,n,i=t.exports={};function o(){throw new Error("setTimeout has not been defined")}function s(){throw new Error("clearTimeout has not been defined")}function a(t){if(r===setTimeout)return setTimeout(t,0);if((r===o||!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:o}catch(t){r=o}try{n="function"==typeof clearTimeout?clearTimeout:s}catch(t){n=s}}();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=[];++c<e;)h&&h[c].run();c=-1,e=f.length}h=null,u=!1,function(t){if(n===clearTimeout)return clearTimeout(t);if((n===s||!n)&&clearTimeout)return n=clearTimeout,clearTimeout(t);try{n(t)}catch(e){try{return n.call(null,t)}catch(e){return n.call(this,t)}}}(t)}}function y(t,e){this.fun=t,this.array=e}function d(){}i.nextTick=function(t){var e=new Array(arguments.length-1);if(arguments.length>1)for(var r=1;r<arguments.length;r++)e[r-1]=arguments[r];f.push(new y(t,e)),1!==f.length||u||a(p)},y.prototype.run=function(){this.fun.apply(null,this.array)},i.title="browser",i.browser=!0,i.env={},i.argv=[],i.version="",i.versions={},i.on=d,i.addListener=d,i.once=d,i.off=d,i.removeListener=d,i.removeAllListeners=d,i.emit=d,i.prependListener=d,i.prependOnceListener=d,i.listeners=function(t){return[]},i.binding=function(t){throw new Error("process.binding is not supported")},i.cwd=function(){return"/"},i.chdir=function(t){throw new Error("process.chdir is not supported")},i.umask=function(){return 0}},function(t,e,r){"use strict";(function(t){
/*!
* The buffer module from node.js, for the browser.
*
* @author Feross Aboukhadijeh <feross@feross.org> <http://feross.org>
* @license MIT
*/
var n=r(11),i=r(12),o=r(13);function s(){return h.TYPED_ARRAY_SUPPORT?2147483647:1073741823}function a(t,e){if(s()<e)throw new RangeError("Invalid typed array length");return h.TYPED_ARRAY_SUPPORT?(t=new Uint8Array(e)).__proto__=h.prototype:(null===t&&(t=new h(e)),t.length=e),t}function h(t,e,r){if(!(h.TYPED_ARRAY_SUPPORT||this instanceof h))return new h(t,e,r);if("number"==typeof t){if("string"==typeof e)throw new Error("If encoding is specified then the first argument must be a string");return c(this,t)}return f(this,t,e,r)}function f(t,e,r,n){if("number"==typeof e)throw new TypeError('"value" argument must not be a number');return"undefined"!=typeof ArrayBuffer&&e instanceof ArrayBuffer?function(t,e,r,n){if(e.byteLength,r<0||e.byteLength<r)throw new RangeError("'offset' is out of bounds");if(e.byteLength<r+(n||0))throw new RangeError("'length' is out of bounds");e=void 0===r&&void 0===n?new Uint8Array(e):void 0===n?new Uint8Array(e,r):new Uint8Array(e,r,n);h.TYPED_ARRAY_SUPPORT?(t=e).__proto__=h.prototype:t=l(t,e);return t}(t,e,r,n):"string"==typeof e?function(t,e,r){"string"==typeof r&&""!==r||(r="utf8");if(!h.isEncoding(r))throw new TypeError('"encoding" must be a valid string encoding');var n=0|y(e,r),i=(t=a(t,n)).write(e,r);i!==n&&(t=t.slice(0,i));return t}(t,e,r):function(t,e){if(h.isBuffer(e)){var r=0|p(e.length);return 0===(t=a(t,r)).length?t:(e.copy(t,0,0,r),t)}if(e){if("undefined"!=typeof ArrayBuffer&&e.buffer instanceof ArrayBuffer||"length"in e)return"number"!=typeof e.length||(n=e.length)!=n?a(t,0):l(t,e);if("Buffer"===e.type&&o(e.data))return l(t,e.data)}var n;throw new TypeError("First argument must be a string, Buffer, ArrayBuffer, Array, or array-like object.")}(t,e)}function u(t){if("number"!=typeof t)throw new TypeError('"size" argument must be a number');if(t<0)throw new RangeError('"size" argument must not be negative')}function c(t,e){if(u(e),t=a(t,e<0?0:0|p(e)),!h.TYPED_ARRAY_SUPPORT)for(var r=0;r<e;++r)t[r]=0;return t}function l(t,e){var r=e.length<0?0:0|p(e.length);t=a(t,r);for(var n=0;n<r;n+=1)t[n]=255&e[n];return t}function p(t){if(t>=s())throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+s().toString(16)+" bytes");return 0|t}function y(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 n=!1;;)switch(e){case"ascii":case"latin1":case"binary":return r;case"utf8":case"utf-8":case void 0:return N(t).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return 2*r;case"hex":return r>>>1;case"base64":return F(t).length;default:if(n)return N(t).length;e=(""+e).toLowerCase(),n=!0}}function d(t,e,r){var n=t[e];t[e]=t[r],t[r]=n}function g(t,e,r,n,i){if(0===t.length)return-1;if("string"==typeof r?(n=r,r=0):r>2147483647?r=2147483647:r<-2147483648&&(r=-2147483648),r=+r,isNaN(r)&&(r=i?0:t.length-1),r<0&&(r=t.length+r),r>=t.length){if(i)return-1;r=t.length-1}else if(r<0){if(!i)return-1;r=0}if("string"==typeof e&&(e=h.from(e,n)),h.isBuffer(e))return 0===e.length?-1:b(t,e,r,n,i);if("number"==typeof e)return e&=255,h.TYPED_ARRAY_SUPPORT&&"function"==typeof Uint8Array.prototype.indexOf?i?Uint8Array.prototype.indexOf.call(t,e,r):Uint8Array.prototype.lastIndexOf.call(t,e,r):b(t,[e],r,n,i);throw new TypeError("val must be string, number or Buffer")}function b(t,e,r,n,i){var o,s=1,a=t.length,h=e.length;if(void 0!==n&&("ucs2"===(n=String(n).toLowerCase())||"ucs-2"===n||"utf16le"===n||"utf-16le"===n)){if(t.length<2||e.length<2)return-1;s=2,a/=2,h/=2,r/=2}function f(t,e){return 1===s?t[e]:t.readUInt16BE(e*s)}if(i){var u=-1;for(o=r;o<a;o++)if(f(t,o)===f(e,-1===u?0:o-u)){if(-1===u&&(u=o),o-u+1===h)return u*s}else-1!==u&&(o-=o-u),u=-1}else for(r+h>a&&(r=a-h),o=r;o>=0;o--){for(var c=!0,l=0;l<h;l++)if(f(t,o+l)!==f(e,l)){c=!1;break}if(c)return o}return-1}function w(t,e,r,n){r=Number(r)||0;var i=t.length-r;n?(n=Number(n))>i&&(n=i):n=i;var o=e.length;if(o%2!=0)throw new TypeError("Invalid hex string");n>o/2&&(n=o/2);for(var s=0;s<n;++s){var a=parseInt(e.substr(2*s,2),16);if(isNaN(a))return s;t[r+s]=a}return s}function v(t,e,r,n){return z(N(e,t.length-r),t,r,n)}function m(t,e,r,n){return z(function(t){for(var e=[],r=0;r<t.length;++r)e.push(255&t.charCodeAt(r));return e}(e),t,r,n)}function A(t,e,r,n){return m(t,e,r,n)}function _(t,e,r,n){return z(F(e),t,r,n)}function E(t,e,r,n){return z(function(t,e){for(var r,n,i,o=[],s=0;s<t.length&&!((e-=2)<0);++s)r=t.charCodeAt(s),n=r>>8,i=r%256,o.push(i),o.push(n);return o}(e,t.length-r),t,r,n)}function T(t,e,r){return 0===e&&r===t.length?n.fromByteArray(t):n.fromByteArray(t.slice(e,r))}function B(t,e,r){r=Math.min(t.length,r);for(var n=[],i=e;i<r;){var o,s,a,h,f=t[i],u=null,c=f>239?4:f>223?3:f>191?2:1;if(i+c<=r)switch(c){case 1:f<128&&(u=f);break;case 2:128==(192&(o=t[i+1]))&&(h=(31&f)<<6|63&o)>127&&(u=h);break;case 3:o=t[i+1],s=t[i+2],128==(192&o)&&128==(192&s)&&(h=(15&f)<<12|(63&o)<<6|63&s)>2047&&(h<55296||h>57343)&&(u=h);break;case 4:o=t[i+1],s=t[i+2],a=t[i+3],128==(192&o)&&128==(192&s)&&128==(192&a)&&(h=(15&f)<<18|(63&o)<<12|(63&s)<<6|63&a)>65535&&h<1114112&&(u=h)}null===u?(u=65533,c=1):u>65535&&(u-=65536,n.push(u>>>10&1023|55296),u=56320|1023&u),n.push(u),i+=c}return function(t){var e=t.length;if(e<=R)return String.fromCharCode.apply(String,t);var r="",n=0;for(;n<e;)r+=String.fromCharCode.apply(String,t.slice(n,n+=R));return r}(n)}e.Buffer=h,e.SlowBuffer=function(t){+t!=t&&(t=0);return h.alloc(+t)},e.INSPECT_MAX_BYTES=50,h.TYPED_ARRAY_SUPPORT=void 0!==t.TYPED_ARRAY_SUPPORT?t.TYPED_ARRAY_SUPPORT:function(){try{var t=new Uint8Array(1);return t.__proto__={__proto__:Uint8Array.prototype,foo:function(){return 42}},42===t.foo()&&"function"==typeof t.subarray&&0===t.subarray(1,1).byteLength}catch(t){return!1}}(),e.kMaxLength=s(),h.poolSize=8192,h._augment=function(t){return t.__proto__=h.prototype,t},h.from=function(t,e,r){return f(null,t,e,r)},h.TYPED_ARRAY_SUPPORT&&(h.prototype.__proto__=Uint8Array.prototype,h.__proto__=Uint8Array,"undefined"!=typeof Symbol&&Symbol.species&&h[Symbol.species]===h&&Object.defineProperty(h,Symbol.species,{value:null,configurable:!0})),h.alloc=function(t,e,r){return function(t,e,r,n){return u(e),e<=0?a(t,e):void 0!==r?"string"==typeof n?a(t,e).fill(r,n):a(t,e).fill(r):a(t,e)}(null,t,e,r)},h.allocUnsafe=function(t){return c(null,t)},h.allocUnsafeSlow=function(t){return c(null,t)},h.isBuffer=function(t){return!(null==t||!t._isBuffer)},h.compare=function(t,e){if(!h.isBuffer(t)||!h.isBuffer(e))throw new TypeError("Arguments must be Buffers");if(t===e)return 0;for(var r=t.length,n=e.length,i=0,o=Math.min(r,n);i<o;++i)if(t[i]!==e[i]){r=t[i],n=e[i];break}return r<n?-1:n<r?1:0},h.isEncoding=function(t){switch(String(t).toLowerCase()){case"hex":case"utf8":case"utf-8":case"ascii":case"latin1":case"binary":case"base64":case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return!0;default:return!1}},h.concat=function(t,e){if(!o(t))throw new TypeError('"list" argument must be an Array of Buffers');if(0===t.length)return h.alloc(0);var r;if(void 0===e)for(e=0,r=0;r<t.length;++r)e+=t[r].length;var n=h.allocUnsafe(e),i=0;for(r=0;r<t.length;++r){var s=t[r];if(!h.isBuffer(s))throw new TypeError('"list" argument must be an Array of Buffers');s.copy(n,i),i+=s.length}return n},h.byteLength=y,h.prototype._isBuffer=!0,h.prototype.swap16=function(){var t=this.length;if(t%2!=0)throw new RangeError("Buffer size must be a multiple of 16-bits");for(var e=0;e<t;e+=2)d(this,e,e+1);return this},h.prototype.swap32=function(){var t=this.length;if(t%4!=0)throw new RangeError("Buffer size must be a multiple of 32-bits");for(var e=0;e<t;e+=4)d(this,e,e+3),d(this,e+1,e+2);return this},h.prototype.swap64=function(){var t=this.length;if(t%8!=0)throw new RangeError("Buffer size must be a multiple of 64-bits");for(var e=0;e<t;e+=8)d(this,e,e+7),d(this,e+1,e+6),d(this,e+2,e+5),d(this,e+3,e+4);return this},h.prototype.toString=function(){var t=0|this.length;return 0===t?"":0===arguments.length?B(this,0,t):function(t,e,r){var n=!1;if((void 0===e||e<0)&&(e=0),e>this.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 I(this,e,r);case"utf8":case"utf-8":return B(this,e,r);case"ascii":return U(this,e,r);case"latin1":case"binary":return P(this,e,r);case"base64":return T(this,e,r);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return S(this,e,r);default:if(n)throw new TypeError("Unknown encoding: "+t);t=(t+"").toLowerCase(),n=!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+=" ... ")),"<Buffer "+t+">"},h.prototype.compare=function(t,e,r,n,i){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===n&&(n=0),void 0===i&&(i=this.length),e<0||r>t.length||n<0||i>this.length)throw new RangeError("out of range index");if(n>=i&&e>=r)return 0;if(n>=i)return-1;if(e>=r)return 1;if(this===t)return 0;for(var o=(i>>>=0)-(n>>>=0),s=(r>>>=0)-(e>>>=0),a=Math.min(o,s),f=this.slice(n,i),u=t.slice(e,r),c=0;c<a;++c)if(f[c]!==u[c]){o=f[c],s=u[c];break}return o<s?-1:s<o?1:0},h.prototype.includes=function(t,e,r){return-1!==this.indexOf(t,e,r)},h.prototype.indexOf=function(t,e,r){return g(this,t,e,r,!0)},h.prototype.lastIndexOf=function(t,e,r){return g(this,t,e,r,!1)},h.prototype.write=function(t,e,r,n){if(void 0===e)n="utf8",r=this.length,e=0;else if(void 0===r&&"string"==typeof e)n=e,r=this.length,e=0;else{if(!isFinite(e))throw new Error("Buffer.write(string, encoding, offset[, length]) is no longer supported");e|=0,isFinite(r)?(r|=0,void 0===n&&(n="utf8")):(n=r,r=void 0)}var i=this.length-e;if((void 0===r||r>i)&&(r=i),t.length>0&&(r<0||e<0)||e>this.length)throw new RangeError("Attempt to write outside buffer bounds");n||(n="utf8");for(var o=!1;;)switch(n){case"hex":return w(this,t,e,r);case"utf8":case"utf-8":return v(this,t,e,r);case"ascii":return m(this,t,e,r);case"latin1":case"binary":return A(this,t,e,r);case"base64":return _(this,t,e,r);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return E(this,t,e,r);default:if(o)throw new TypeError("Unknown encoding: "+n);n=(""+n).toLowerCase(),o=!0}},h.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};var R=4096;function U(t,e,r){var n="";r=Math.min(t.length,r);for(var i=e;i<r;++i)n+=String.fromCharCode(127&t[i]);return n}function P(t,e,r){var n="";r=Math.min(t.length,r);for(var i=e;i<r;++i)n+=String.fromCharCode(t[i]);return n}function I(t,e,r){var n=t.length;(!e||e<0)&&(e=0),(!r||r<0||r>n)&&(r=n);for(var i="",o=e;o<r;++o)i+=j(t[o]);return i}function S(t,e,r){for(var n=t.slice(e,r),i="",o=0;o<n.length;o+=2)i+=String.fromCharCode(n[o]+256*n[o+1]);return i}function x(t,e,r){if(t%1!=0||t<0)throw new RangeError("offset is not uint");if(t+e>r)throw new RangeError("Trying to access beyond buffer length")}function k(t,e,r,n,i,o){if(!h.isBuffer(t))throw new TypeError('"buffer" argument must be a Buffer instance');if(e>i||e<o)throw new RangeError('"value" argument is out of bounds');if(r+n>t.length)throw new RangeError("Index out of range")}function O(t,e,r,n){e<0&&(e=65535+e+1);for(var i=0,o=Math.min(t.length-r,2);i<o;++i)t[r+i]=(e&255<<8*(n?i:1-i))>>>8*(n?i:1-i)}function L(t,e,r,n){e<0&&(e=4294967295+e+1);for(var i=0,o=Math.min(t.length-r,4);i<o;++i)t[r+i]=e>>>8*(n?i:3-i)&255}function C(t,e,r,n,i,o){if(r+n>t.length)throw new RangeError("Index out of range");if(r<0)throw new RangeError("Index out of range")}function D(t,e,r,n,o){return o||C(t,0,r,4),i.write(t,e,r,n,23,4),r+4}function M(t,e,r,n,o){return o||C(t,0,r,8),i.write(t,e,r,n,52,8),r+8}h.prototype.slice=function(t,e){var r,n=this.length;if((t=~~t)<0?(t+=n)<0&&(t=0):t>n&&(t=n),(e=void 0===e?n:~~e)<0?(e+=n)<0&&(e=0):e>n&&(e=n),e<t&&(e=t),h.TYPED_ARRAY_SUPPORT)(r=this.subarray(t,e)).__proto__=h.prototype;else{var i=e-t;r=new h(i,void 0);for(var o=0;o<i;++o)r[o]=this[o+t]}return r},h.prototype.readUIntLE=function(t,e,r){t|=0,e|=0,r||x(t,e,this.length);for(var n=this[t],i=1,o=0;++o<e&&(i*=256);)n+=this[t+o]*i;return n},h.prototype.readUIntBE=function(t,e,r){t|=0,e|=0,r||x(t,e,this.length);for(var n=this[t+--e],i=1;e>0&&(i*=256);)n+=this[t+--e]*i;return n},h.prototype.readUInt8=function(t,e){return e||x(t,1,this.length),this[t]},h.prototype.readUInt16LE=function(t,e){return e||x(t,2,this.length),this[t]|this[t+1]<<8},h.prototype.readUInt16BE=function(t,e){return e||x(t,2,this.length),this[t]<<8|this[t+1]},h.prototype.readUInt32LE=function(t,e){return e||x(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||x(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||x(t,e,this.length);for(var n=this[t],i=1,o=0;++o<e&&(i*=256);)n+=this[t+o]*i;return n>=(i*=128)&&(n-=Math.pow(2,8*e)),n},h.prototype.readIntBE=function(t,e,r){t|=0,e|=0,r||x(t,e,this.length);for(var n=e,i=1,o=this[t+--n];n>0&&(i*=256);)o+=this[t+--n]*i;return o>=(i*=128)&&(o-=Math.pow(2,8*e)),o},h.prototype.readInt8=function(t,e){return e||x(t,1,this.length),128&this[t]?-1*(255-this[t]+1):this[t]},h.prototype.readInt16LE=function(t,e){e||x(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||x(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||x(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||x(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||x(t,4,this.length),i.read(this,t,!0,23,4)},h.prototype.readFloatBE=function(t,e){return e||x(t,4,this.length),i.read(this,t,!1,23,4)},h.prototype.readDoubleLE=function(t,e){return e||x(t,8,this.length),i.read(this,t,!0,52,8)},h.prototype.readDoubleBE=function(t,e){return e||x(t,8,this.length),i.read(this,t,!1,52,8)},h.prototype.writeUIntLE=function(t,e,r,n){(t=+t,e|=0,r|=0,n)||k(this,t,e,r,Math.pow(2,8*r)-1,0);var i=1,o=0;for(this[e]=255&t;++o<r&&(i*=256);)this[e+o]=t/i&255;return e+r},h.prototype.writeUIntBE=function(t,e,r,n){(t=+t,e|=0,r|=0,n)||k(this,t,e,r,Math.pow(2,8*r)-1,0);var i=r-1,o=1;for(this[e+i]=255&t;--i>=0&&(o*=256);)this[e+i]=t/o&255;return e+r},h.prototype.writeUInt8=function(t,e,r){return t=+t,e|=0,r||k(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||k(this,t,e,2,65535,0),h.TYPED_ARRAY_SUPPORT?(this[e]=255&t,this[e+1]=t>>>8):O(this,t,e,!0),e+2},h.prototype.writeUInt16BE=function(t,e,r){return t=+t,e|=0,r||k(this,t,e,2,65535,0),h.TYPED_ARRAY_SUPPORT?(this[e]=t>>>8,this[e+1]=255&t):O(this,t,e,!1),e+2},h.prototype.writeUInt32LE=function(t,e,r){return t=+t,e|=0,r||k(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||k(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,n){if(t=+t,e|=0,!n){var i=Math.pow(2,8*r-1);k(this,t,e,r,i-1,-i)}var o=0,s=1,a=0;for(this[e]=255&t;++o<r&&(s*=256);)t<0&&0===a&&0!==this[e+o-1]&&(a=1),this[e+o]=(t/s>>0)-a&255;return e+r},h.prototype.writeIntBE=function(t,e,r,n){if(t=+t,e|=0,!n){var i=Math.pow(2,8*r-1);k(this,t,e,r,i-1,-i)}var o=r-1,s=1,a=0;for(this[e+o]=255&t;--o>=0&&(s*=256);)t<0&&0===a&&0!==this[e+o+1]&&(a=1),this[e+o]=(t/s>>0)-a&255;return e+r},h.prototype.writeInt8=function(t,e,r){return t=+t,e|=0,r||k(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||k(this,t,e,2,32767,-32768),h.TYPED_ARRAY_SUPPORT?(this[e]=255&t,this[e+1]=t>>>8):O(this,t,e,!0),e+2},h.prototype.writeInt16BE=function(t,e,r){return t=+t,e|=0,r||k(this,t,e,2,32767,-32768),h.TYPED_ARRAY_SUPPORT?(this[e]=t>>>8,this[e+1]=255&t):O(this,t,e,!1),e+2},h.prototype.writeInt32LE=function(t,e,r){return t=+t,e|=0,r||k(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||k(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 D(this,t,e,!0,r)},h.prototype.writeFloatBE=function(t,e,r){return D(this,t,e,!1,r)},h.prototype.writeDoubleLE=function(t,e,r){return M(this,t,e,!0,r)},h.prototype.writeDoubleBE=function(t,e,r){return M(this,t,e,!1,r)},h.prototype.copy=function(t,e,r,n){if(r||(r=0),n||0===n||(n=this.length),e>=t.length&&(e=t.length),e||(e=0),n>0&&n<r&&(n=r),n===r)return 0;if(0===t.length||0===this.length)return 0;if(e<0)throw new RangeError("targetStart out of bounds");if(r<0||r>=this.length)throw new RangeError("sourceStart out of bounds");if(n<0)throw new RangeError("sourceEnd out of bounds");n>this.length&&(n=this.length),t.length-e<n-r&&(n=t.length-e+r);var i,o=n-r;if(this===t&&r<e&&e<n)for(i=o-1;i>=0;--i)t[i+e]=this[i+r];else if(o<1e3||!h.TYPED_ARRAY_SUPPORT)for(i=0;i<o;++i)t[i+e]=this[i+r];else Uint8Array.prototype.set.call(t,this.subarray(r,r+o),e);return o},h.prototype.fill=function(t,e,r,n){if("string"==typeof t){if("string"==typeof e?(n=e,e=0,r=this.length):"string"==typeof r&&(n=r,r=this.length),1===t.length){var i=t.charCodeAt(0);i<256&&(t=i)}if(void 0!==n&&"string"!=typeof n)throw new TypeError("encoding must be a string");if("string"==typeof n&&!h.isEncoding(n))throw new TypeError("Unknown encoding: "+n)}else"number"==typeof t&&(t&=255);if(e<0||this.length<e||this.length<r)throw new RangeError("Out of range index");if(r<=e)return this;var o;if(e>>>=0,r=void 0===r?this.length:r>>>0,t||(t=0),"number"==typeof t)for(o=e;o<r;++o)this[o]=t;else{var s=h.isBuffer(t)?t:N(new h(t,n).toString()),a=s.length;for(o=0;o<r-e;++o)this[o+e]=s[o%a]}return this};var Y=/[^+\/0-9A-Za-z-_]/g;function j(t){return t<16?"0"+t.toString(16):t.toString(16)}function N(t,e){var r;e=e||1/0;for(var n=t.length,i=null,o=[],s=0;s<n;++s){if((r=t.charCodeAt(s))>55295&&r<57344){if(!i){if(r>56319){(e-=3)>-1&&o.push(239,191,189);continue}if(s+1===n){(e-=3)>-1&&o.push(239,191,189);continue}i=r;continue}if(r<56320){(e-=3)>-1&&o.push(239,191,189),i=r;continue}r=65536+(i-55296<<10|r-56320)}else i&&(e-=3)>-1&&o.push(239,191,189);if(i=null,r<128){if((e-=1)<0)break;o.push(r)}else if(r<2048){if((e-=2)<0)break;o.push(r>>6|192,63&r|128)}else if(r<65536){if((e-=3)<0)break;o.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;o.push(r>>18|240,r>>12&63|128,r>>6&63|128,63&r|128)}}return o}function F(t){return n.toByteArray(function(t){if((t=function(t){return t.trim?t.trim():t.replace(/^\s+|\s+$/g,"")}(t).replace(Y,"")).length<2)return"";for(;t.length%4!=0;)t+="=";return t}(t))}function z(t,e,r,n){for(var i=0;i<n&&!(i+r>=e.length||i>=t.length);++i)e[i+r]=t[i];return i}}).call(this,r(0))},function(t,e,r){"use strict";e.byteLength=function(t){return 3*t.length/4-f(t)},e.toByteArray=function(t){var e,r,n,s,a,h=t.length;s=f(t),a=new o(3*h/4-s),r=s>0?h-4:h;var u=0;for(e=0;e<r;e+=4)n=i[t.charCodeAt(e)]<<18|i[t.charCodeAt(e+1)]<<12|i[t.charCodeAt(e+2)]<<6|i[t.charCodeAt(e+3)],a[u++]=n>>16&255,a[u++]=n>>8&255,a[u++]=255&n;2===s?(n=i[t.charCodeAt(e)]<<2|i[t.charCodeAt(e+1)]>>4,a[u++]=255&n):1===s&&(n=i[t.charCodeAt(e)]<<10|i[t.charCodeAt(e+1)]<<4|i[t.charCodeAt(e+2)]>>2,a[u++]=n>>8&255,a[u++]=255&n);return a},e.fromByteArray=function(t){for(var e,r=t.length,i=r%3,o="",s=[],a=0,h=r-i;a<h;a+=16383)s.push(u(t,a,a+16383>h?h:a+16383));1===i?(e=t[r-1],o+=n[e>>2],o+=n[e<<4&63],o+="=="):2===i&&(e=(t[r-2]<<8)+t[r-1],o+=n[e>>10],o+=n[e>>4&63],o+=n[e<<2&63],o+="=");return s.push(o),s.join("")};for(var n=[],i=[],o="undefined"!=typeof Uint8Array?Uint8Array:Array,s="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",a=0,h=s.length;a<h;++a)n[a]=s[a],i[s.charCodeAt(a)]=a;function f(t){var e=t.length;if(e%4>0)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 i,o,s=[],a=e;a<r;a+=3)i=(t[a]<<16)+(t[a+1]<<8)+t[a+2],s.push(n[(o=i)>>18&63]+n[o>>12&63]+n[o>>6&63]+n[63&o]);return s.join("")}i["-".charCodeAt(0)]=62,i["_".charCodeAt(0)]=63},function(t,e){e.read=function(t,e,r,n,i){var o,s,a=8*i-n-1,h=(1<<a)-1,f=h>>1,u=-7,c=r?i-1:0,l=r?-1:1,p=t[e+c];for(c+=l,o=p&(1<<-u)-1,p>>=-u,u+=a;u>0;o=256*o+t[e+c],c+=l,u-=8);for(s=o&(1<<-u)-1,o>>=-u,u+=n;u>0;s=256*s+t[e+c],c+=l,u-=8);if(0===o)o=1-f;else{if(o===h)return s?NaN:1/0*(p?-1:1);s+=Math.pow(2,n),o-=f}return(p?-1:1)*s*Math.pow(2,o-n)},e.write=function(t,e,r,n,i,o){var s,a,h,f=8*o-i-1,u=(1<<f)-1,c=u>>1,l=23===i?Math.pow(2,-24)-Math.pow(2,-77):0,p=n?0:o-1,y=n?1:-1,d=e<0||0===e&&1/e<0?1:0;for(e=Math.abs(e),isNaN(e)||e===1/0?(a=isNaN(e)?1:0,s=u):(s=Math.floor(Math.log(e)/Math.LN2),e*(h=Math.pow(2,-s))<1&&(s--,h*=2),(e+=s+c>=1?l/h:l*Math.pow(2,1-c))*h>=2&&(s++,h/=2),s+c>=u?(a=0,s=u):s+c>=1?(a=(e*h-1)*Math.pow(2,i),s+=c):(a=e*Math.pow(2,c-1)*Math.pow(2,i),s=0));i>=8;t[r+p]=255&a,p+=y,a/=256,i-=8);for(s=s<<i|a,f+=i;f>0;t[r+p]=255&s,p+=y,s/=256,f-=8);t[r+p-y]|=128*d}},function(t,e){var r={}.toString;t.exports=Array.isArray||function(t){return"[object Array]"==r.call(t)}},function(t,e,r){const{set:n,get:i}=r(15);t.exports={readCache:i,writeCache:n}},function(t,e,r){"use strict";r.r(e),r.d(e,"Store",function(){return n}),r.d(e,"get",function(){return s}),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 n{constructor(t="keyval-store",e="keyval"){this.storeName=e,this._dbp=new Promise((r,n)=>{const i=indexedDB.open(t,1);i.onerror=(()=>n(i.error)),i.onsuccess=(()=>r(i.result)),i.onupgradeneeded=(()=>{i.result.createObjectStore(e)})})}_withIDBStore(t,e){return this._dbp.then(r=>new Promise((n,i)=>{const o=r.transaction(this.storeName,t);o.oncomplete=(()=>n()),o.onabort=o.onerror=(()=>i(o.error)),e(o.objectStore(this.storeName))}))}}let i;function o(){return i||(i=new n),i}function s(t,e=o()){let r;return e._withIDBStore("readonly",e=>{r=e.get(t)}).then(()=>r.result)}function a(t,e,r=o()){return r._withIDBStore("readwrite",r=>{r.put(e,t)})}function h(t,e=o()){return e._withIDBStore("readwrite",e=>{e.delete(t)})}function f(t=o()){return t._withIDBStore("readwrite",t=>{t.clear()})}function u(t=o()){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){t.exports=((t,e)=>{const r=t._malloc(e.length*Uint8Array.BYTES_PER_ELEMENT);t.HEAPU8.set(e,r);const n=t._pixReadMem(r,e.length);0===t.getValue(n+28,"i32")&&t.setValue(n+28,70,"i32");const[i,o,s,a,h,f,u,c,l,p]=Array(10).fill(0).map((e,r)=>t.getValue(n+4*r,"i32"));return{w:i,h:o,d:s,spp:a,wpl:h,refcount:f,xres:u,yres:c,informat:l,special:p,data:n}})},function(t,e){t.exports=((t,e)=>{const r=e.GetIterator(),n=[];let i,o,s,a,h;const f=(e,r)=>Object.keys(t).filter(t=>t.substr(0,r.length+1)===`${r}_`).filter(r=>t[r]===e).map(t=>t.slice(r.length+1))[0];r.Begin();do{if(r.IsAtBeginningOf(t.RIL_BLOCK)){const e=r.BlockPolygon();let o=null;if(t.getPointer(e)>0){const r=e.get_n(),n=e.get_x(),i=e.get_y();o=[];for(let t=0;t<r;t+=1)o.push([n.getValue(t),i.getValue(t)]);t._ptaDestroy(t.getPointer(e))}i={paragraphs:[],text:r.GetUTF8Text(t.RIL_BLOCK),confidence:r.Confidence(t.RIL_BLOCK),baseline:r.getBaseline(t.RIL_BLOCK),bbox:r.getBoundingBox(t.RIL_BLOCK),blocktype:f(r.BlockType(),"PT"),polygon:o},n.push(i)}if(r.IsAtBeginningOf(t.RIL_PARA)&&(o={lines:[],text:r.GetUTF8Text(t.RIL_PARA),confidence:r.Confidence(t.RIL_PARA),baseline:r.getBaseline(t.RIL_PARA),bbox:r.getBoundingBox(t.RIL_PARA),is_ltr:!!r.ParagraphIsLtr()},i.paragraphs.push(o)),r.IsAtBeginningOf(t.RIL_TEXTLINE)&&(s={words:[],text:r.GetUTF8Text(t.RIL_TEXTLINE),confidence:r.Confidence(t.RIL_TEXTLINE),baseline:r.getBaseline(t.RIL_TEXTLINE),bbox:r.getBoundingBox(t.RIL_TEXTLINE)},o.lines.push(s)),r.IsAtBeginningOf(t.RIL_WORD)){const e=r.getWordFontAttributes(),n=r.WordDirection();a={symbols:[],choices:[],text:r.GetUTF8Text(t.RIL_WORD),confidence:r.Confidence(t.RIL_WORD),baseline:r.getBaseline(t.RIL_WORD),bbox:r.getBoundingBox(t.RIL_WORD),is_numeric:!!r.WordIsNumeric(),in_dictionary:!!r.WordIsFromDictionary(),direction:f(n,"DIR"),language:r.WordRecognitionLanguage(),is_bold:e.is_bold,is_italic:e.is_italic,is_underlined:e.is_underlined,is_monospace:e.is_monospace,is_serif:e.is_serif,is_smallcaps:e.is_smallcaps,font_size:e.pointsize,font_id:e.font_id,font_name:e.font_name};const i=new t.WordChoiceIterator(r);do{a.choices.push({text:i.GetUTF8Text(),confidence:i.Confidence()})}while(i.Next());t.destroy(i),s.words.push(a)}if(r.IsAtBeginningOf(t.RIL_SYMBOL)){h={choices:[],image:null,text:r.GetUTF8Text(t.RIL_SYMBOL),confidence:r.Confidence(t.RIL_SYMBOL),baseline:r.getBaseline(t.RIL_SYMBOL),bbox:r.getBoundingBox(t.RIL_SYMBOL),is_superscript:!!r.SymbolIsSuperscript(),is_subscript:!!r.SymbolIsSubscript(),is_dropcap:!!r.SymbolIsDropcap()},a.symbols.push(h);const e=new t.ChoiceIterator(r);do{h.choices.push({text:e.GetUTF8Text(),confidence:e.Confidence()})}while(e.Next())}}while(r.Next(t.RIL_SYMBOL));return t.destroy(r),{text:e.GetUTF8Text(),html:(t=>{const e=t.split("\n");if(" "===e[0].substring(0,2))for(let t=0;t<e.length;t+=1)" "===e[t].substring(0,2)&&(e[t]=e[t].slice(2));return e.join("\n")})(e.GetHOCRText()),confidence:e.MeanTextConf(),blocks:n,psm:f(e.GetPageSegMode(),"PSM"),oem:f(e.oem(),"OEM"),version:e.Version()}})}])});
//# sourceMappingURL=worker.min.js.map