/**
 * CyberChef - The Cyber Swiss Army Knife
 *
 * @copyright Crown Copyright 2016
 * @license Apache-2.0
 *
 *   Copyright 2016 Crown Copyright
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */!function(e){var t={};function r(n){if(t[n])return t[n].exports;var i=t[n]={i:n,l:!1,exports:{}};return e[n].call(i.exports,i,i.exports,r),i.l=!0,i.exports}r.m=e,r.c=t,r.d=function(e,t,n){r.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:n})},r.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},r.t=function(e,t){if(1&t&&(e=r(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var n=Object.create(null);if(r.r(n),Object.defineProperty(n,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var i in e)r.d(n,i,function(t){return e[t]}.bind(null,i));return n},r.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return r.d(t,"a",t),t},r.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},r.p="",r(r.s=1424)}({0:function(e,t,r){"use strict";(function(e,n){r.d(t,"c",(function(){return g})),r.d(t,"d",(function(){return v})),r.d(t,"e",(function(){return b})),r.d(t,"a",(function(){return E}));var i=r(6),o=r.n(i),s=r(1),a=r.n(s),u=r(2),c=r.n(u),f=r(23),l=r.n(f),h=r(15),p=r(16),d=r(28),y=r(27),m=function(){function t(){a()(this,t)}return c()(t,null,[{key:"chr",value:function(e){if(e>65535){e-=65536;var t=String.fromCharCode(e>>>10&1023|55296);return e=56320|1023&e,t+String.fromCharCode(e)}return String.fromCharCode(e)}},{key:"ord",value:function(e){if(2===e.length){var t=e.charCodeAt(0),r=e.charCodeAt(1);if(t>=55296&&t<56320&&r>=56320&&r<57344)return 1024*(t-55296)+r-56320+65536}return e.charCodeAt(0)}},{key:"padBytesRight",value:function(e,t){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0,n=new Array(t);return n.fill(r),[...e].forEach((function(e,t){n[t]=e})),n}},{key:"truncate",value:function(e,t){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"...";return e.length>t&&(e=e.slice(0,t-r.length)+r),e}},{key:"hex",value:function(e){var r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:2;return(e="string"==typeof e?t.ord(e):e).toString(16).padStart(r,"0")}},{key:"bin",value:function(e){var r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:8;return(e="string"==typeof e?t.ord(e):e).toString(2).padStart(r,"0")}},{key:"printable",value:function(e){var r=arguments.length>1&&void 0!==arguments[1]&&arguments[1];_()&&window.app&&!window.app.options.treatAsUtf8&&(e=t.byteArrayToChars(t.strToByteArray(e)));var n=/[\0-\x08\x0B-\x0C\x0E-\x1F\x7F-\x9F\xAD\u0378\u0379\u037F-\u0383\u038B\u038D\u03A2\u0528-\u0530\u0557\u0558\u0560\u0588\u058B-\u058E\u0590\u05C8-\u05CF\u05EB-\u05EF\u05F5-\u0605\u061C\u061D\u06DD\u070E\u070F\u074B\u074C\u07B2-\u07BF\u07FB-\u07FF\u082E\u082F\u083F\u085C\u085D\u085F-\u089F\u08A1\u08AD-\u08E3\u08FF\u0978\u0980\u0984\u098D\u098E\u0991\u0992\u09A9\u09B1\u09B3-\u09B5\u09BA\u09BB\u09C5\u09C6\u09C9\u09CA\u09CF-\u09D6\u09D8-\u09DB\u09DE\u09E4\u09E5\u09FC-\u0A00\u0A04\u0A0B-\u0A0E\u0A11\u0A12\u0A29\u0A31\u0A34\u0A37\u0A3A\u0A3B\u0A3D\u0A43-\u0A46\u0A49\u0A4A\u0A4E-\u0A50\u0A52-\u0A58\u0A5D\u0A5F-\u0A65\u0A76-\u0A80\u0A84\u0A8E\u0A92\u0AA9\u0AB1\u0AB4\u0ABA\u0ABB\u0AC6\u0ACA\u0ACE\u0ACF\u0AD1-\u0ADF\u0AE4\u0AE5\u0AF2-\u0B00\u0B04\u0B0D\u0B0E\u0B11\u0B12\u0B29\u0B31\u0B34\u0B3A\u0B3B\u0B45\u0B46\u0B49\u0B4A\u0B4E-\u0B55\u0B58-\u0B5B\u0B5E\u0B64\u0B65\u0B78-\u0B81\u0B84\u0B8B-\u0B8D\u0B91\u0B96-\u0B98\u0B9B\u0B9D\u0BA0-\u0BA2\u0BA5-\u0BA7\u0BAB-\u0BAD\u0BBA-\u0BBD\u0BC3-\u0BC5\u0BC9\u0BCE\u0BCF\u0BD1-\u0BD6\u0BD8-\u0BE5\u0BFB-\u0C00\u0C04\u0C0D\u0C11\u0C29\u0C34\u0C3A-\u0C3C\u0C45\u0C49\u0C4E-\u0C54\u0C57\u0C5A-\u0C5F\u0C64\u0C65\u0C70-\u0C77\u0C80\u0C81\u0C84\u0C8D\u0C91\u0CA9\u0CB4\u0CBA\u0CBB\u0CC5\u0CC9\u0CCE-\u0CD4\u0CD7-\u0CDD\u0CDF\u0CE4\u0CE5\u0CF0\u0CF3-\u0D01\u0D04\u0D0D\u0D11\u0D3B\u0D3C\u0D45\u0D49\u0D4F-\u0D56\u0D58-\u0D5F\u0D64\u0D65\u0D76-\u0D78\u0D80\u0D81\u0D84\u0D97-\u0D99\u0DB2\u0DBC\u0DBE\u0DBF\u0DC7-\u0DC9\u0DCB-\u0DCE\u0DD5\u0DD7\u0DE0-\u0DF1\u0DF5-\u0E00\u0E3B-\u0E3E\u0E5C-\u0E80\u0E83\u0E85\u0E86\u0E89\u0E8B\u0E8C\u0E8E-\u0E93\u0E98\u0EA0\u0EA4\u0EA6\u0EA8\u0EA9\u0EAC\u0EBA\u0EBE\u0EBF\u0EC5\u0EC7\u0ECE\u0ECF\u0EDA\u0EDB\u0EE0-\u0EFF\u0F48\u0F6D-\u0F70\u0F98\u0FBD\u0FCD\u0FDB-\u0FFF\u10C6\u10C8-\u10CC\u10CE\u10CF\u1249\u124E\u124F\u1257\u1259\u125E\u125F\u1289\u128E\u128F\u12B1\u12B6\u12B7\u12BF\u12C1\u12C6\u12C7\u12D7\u1311\u1316\u1317\u135B\u135C\u137D-\u137F\u139A-\u139F\u13F5-\u13FF\u169D-\u169F\u16F1-\u16FF\u170D\u1715-\u171F\u1737-\u173F\u1754-\u175F\u176D\u1771\u1774-\u177F\u17DE\u17DF\u17EA-\u17EF\u17FA-\u17FF\u180F\u181A-\u181F\u1878-\u187F\u18AB-\u18AF\u18F6-\u18FF\u191D-\u191F\u192C-\u192F\u193C-\u193F\u1941-\u1943\u196E\u196F\u1975-\u197F\u19AC-\u19AF\u19CA-\u19CF\u19DB-\u19DD\u1A1C\u1A1D\u1A5F\u1A7D\u1A7E\u1A8A-\u1A8F\u1A9A-\u1A9F\u1AAE-\u1AFF\u1B4C-\u1B4F\u1B7D-\u1B7F\u1BF4-\u1BFB\u1C38-\u1C3A\u1C4A-\u1C4C\u1C80-\u1CBF\u1CC8-\u1CCF\u1CF7-\u1CFF\u1DE7-\u1DFB\u1F16\u1F17\u1F1E\u1F1F\u1F46\u1F47\u1F4E\u1F4F\u1F58\u1F5A\u1F5C\u1F5E\u1F7E\u1F7F\u1FB5\u1FC5\u1FD4\u1FD5\u1FDC\u1FF0\u1FF1\u1FF5\u1FFF\u200B-\u200F\u202A-\u202E\u2060-\u206F\u2072\u2073\u208F\u209D-\u209F\u20BB-\u20CF\u20F1-\u20FF\u218A-\u218F\u23F4-\u23FF\u2427-\u243F\u244B-\u245F\u2700\u2B4D-\u2B4F\u2B5A-\u2BFF\u2C2F\u2C5F\u2CF4-\u2CF8\u2D26\u2D28-\u2D2C\u2D2E\u2D2F\u2D68-\u2D6E\u2D71-\u2D7E\u2D97-\u2D9F\u2DA7\u2DAF\u2DB7\u2DBF\u2DC7\u2DCF\u2DD7\u2DDF\u2E3C-\u2E7F\u2E9A\u2EF4-\u2EFF\u2FD6-\u2FEF\u2FFC-\u2FFF\u3040\u3097\u3098\u3100-\u3104\u312E-\u3130\u318F\u31BB-\u31BF\u31E4-\u31EF\u321F\u32FF\u4DB6-\u4DBF\u9FCD-\u9FFF\uA48D-\uA48F\uA4C7-\uA4CF\uA62C-\uA63F\uA698-\uA69E\uA6F8-\uA6FF\uA78F\uA794-\uA79F\uA7AB-\uA7F7\uA82C-\uA82F\uA83A-\uA83F\uA878-\uA87F\uA8C5-\uA8CD\uA8DA-\uA8DF\uA8FC-\uA8FF\uA954-\uA95E\uA97D-\uA97F\uA9CE\uA9DA-\uA9DD\uA9E0-\uA9FF\uAA37-\uAA3F\uAA4E\uAA4F\uAA5A\uAA5B\uAA7C-\uAA7F\uAAC3-\uAADA\uAAF7-\uAB00\uAB07\uAB08\uAB0F\uAB10\uAB17-\uAB1F\uAB27\uAB2F-\uABBF\uABEE\uABEF\uABFA-\uABFF\uD7A4-\uD7AF\uD7C7-\uD7CA\uD7FC-\uD7FF\uE000-\uF8FF\uFA6E\uFA6F\uFADA-\uFAFF\uFB07-\uFB12\uFB18-\uFB1C\uFB37\uFB3D\uFB3F\uFB42\uFB45\uFBC2-\uFBD2\uFD40-\uFD4F\uFD90\uFD91\uFDC8-\uFDEF\uFDFE\uFDFF\uFE1A-\uFE1F\uFE27-\uFE2F\uFE53\uFE67\uFE6C-\uFE6F\uFE75\uFEFD-\uFF00\uFFBF-\uFFC1\uFFC8\uFFC9\uFFD0\uFFD1\uFFD8\uFFD9\uFFDD-\uFFDF\uFFE7\uFFEF-\uFFFB\uFFFE\uFFFF]/g,i=/[\x09-\x10\x0D\u2028\u2029]/g;return e=e.replace(n,"."),r||(e=e.replace(i,".")),e}},{key:"parseEscapedChars",value:function(e){return e.replace(/\\([bfnrtv'"]|[0-3][0-7]{2}|[0-7]{1,2}|x[\da-fA-F]{2}|u[\da-fA-F]{4}|u\{[\da-fA-F]{1,6}\}|\\)/g,(function(e,t){switch(t[0]){case"\\":return"\\";case"0":case"1":case"2":case"3":case"4":case"5":case"6":case"7":return String.fromCharCode(parseInt(t,8));case"b":return"\b";case"t":return"\t";case"n":return"\n";case"v":return"\v";case"f":return"\f";case"r":return"\r";case'"':return'"';case"'":return"'";case"x":return String.fromCharCode(parseInt(t.substr(1),16));case"u":return"{"===t[1]?String.fromCodePoint(parseInt(t.slice(2,-1),16)):String.fromCharCode(parseInt(t.substr(1),16))}}))}},{key:"escapeRegex",value:function(e){return e.replace(/([.*+?^=!:${}()|[\]/\\])/g,"\\$1")}},{key:"expandAlphRange",value:function(e){for(var r=[],n=0;n<e.length;n++)if(n<e.length-2&&"-"===e[n+1]&&"\\"!==e[n]){for(var i=t.ord(e[n]),o=t.ord(e[n+2]),s=i;s<=o;s++)r.push(t.chr(s));n+=2}else n<e.length-2&&"\\"===e[n]&&"-"===e[n+1]?(r.push("-"),n++):r.push(e[n]);return r}},{key:"convertToByteArray",value:function(e,r){switch(r.toLowerCase()){case"binary":return Object(y.a)(e);case"hex":return Object(p.a)(e);case"decimal":return Object(d.a)(e);case"base64":return Object(h.a)(e,null,"byteArray");case"utf8":return t.strToUtf8ByteArray(e);case"latin1":default:return t.strToByteArray(e)}}},{key:"convertToByteString",value:function(e,r){switch(r.toLowerCase()){case"binary":return t.byteArrayToChars(Object(y.a)(e));case"hex":return t.byteArrayToChars(Object(p.a)(e));case"decimal":return t.byteArrayToChars(Object(d.a)(e));case"base64":return t.byteArrayToChars(Object(h.a)(e,null,"byteArray"));case"utf8":return l.a.encode(e);case"latin1":default:return e}}},{key:"strToArrayBuffer",value:function(e){for(var r,n=new Uint8Array(e.length),i=e.length;i--;)if(r=e.charCodeAt(i),n[i]=r,r>255)return t.strToUtf8ArrayBuffer(e);return n.buffer}},{key:"strToUtf8ArrayBuffer",value:function(e){var r=l.a.encode(e);return e.length!==r.length&&(v()?self.setOption("attemptHighlight",!1):_()&&(window.app.options.attemptHighlight=!1)),t.strToArrayBuffer(r)}},{key:"strToByteArray",value:function(e){for(var r,n=new Array(e.length),i=e.length;i--;)if(r=e.charCodeAt(i),n[i]=r,r>255)return t.strToUtf8ByteArray(e);return n}},{key:"strToUtf8ByteArray",value:function(e){var r=l.a.encode(e);return e.length!==r.length&&(v()?self.setOption("attemptHighlight",!1):_()&&(window.app.options.attemptHighlight=!1)),t.strToByteArray(r)}},{key:"strToCharcode",value:function(e){for(var r=[],n=0;n<e.length;n++){var i=e.charCodeAt(n);if(n<e.length-1&&i>=55296&&i<56320){var o=e[n+1].charCodeAt(0);o>=56320&&o<57344&&(i=t.ord(e[n]+e[++n]))}r.push(i)}return r}},{key:"byteArrayToUtf8",value:function(e){var r=t.byteArrayToChars(e);try{var n=l.a.decode(r);return r.length!==n.length&&(v()?self.setOption("attemptHighlight",!1):_()&&(window.app.options.attemptHighlight=!1)),n}catch(e){return r}}},{key:"byteArrayToChars",value:function(e){if(!e)return"";for(var t="",r=0;r<e.length;)t+=String.fromCharCode(e[r++]);return t}},{key:"arrayBufferToStr",value:function(e){var r=!(arguments.length>1&&void 0!==arguments[1])||arguments[1],n=new Uint8Array(e);return r?t.byteArrayToUtf8(n):t.byteArrayToChars(n)}},{key:"calculateShannonEntropy",value:function(e){e instanceof ArrayBuffer&&(e=new Uint8Array(e));var t,r=[],n=new Array(256).fill(0);for(t=0;t<e.length;t++)n[e[t]]++;for(t=0;t<n.length;t++)n[t]>0&&r.push(n[t]/e.length);var i,o=0;for(t=0;t<r.length;t++)o+=(i=r[t])*Math.log(i)/Math.log(2);return-o}},{key:"parseCSV",value:function(e){var t,r,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[","],i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:["\n","\r"],o=!1,s=!1,a="",u=[],c=[];e.length&&"\ufeff"===e[0]&&(e=e.substr(1));for(var f=0;f<e.length;f++)t=e[f],r=e[f+1]||"",o?(a+=t,o=!1):'"'!==t||s?'"'===t&&s?'"'===r?o=!0:s=!1:!s&&n.indexOf(t)>=0?(u.push(a),a=""):!s&&i.indexOf(t)>=0?(u.push(a),a="",c.push(u),u=[],i.indexOf(r)>=0&&r!==t&&f++):a+=t:s=!0;return u.length&&(u.push(a),c.push(u)),c}},{key:"stripHtmlTags",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]&&arguments[1];return t&&(e=e.replace(/<(script|style)[^>]*>.*<\/(script|style)>/gim,"")),e.replace(/<[^>]+>/g,"")}},{key:"escapeHtml",value:function(e){var t={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#x27;","/":"&#x2F;","`":"&#x60;"};return e.replace(/[&<>"'/`]/g,(function(e){return t[e]}))}},{key:"unescapeHtml",value:function(e){var t={"&amp;":"&","&lt;":"<","&gt;":">","&quot;":'"',"&#x27;":"'","&#x2F;":"/","&#x60;":"`"};return e.replace(/&#?x?[a-z0-9]{2,4};/gi,(function(e){return t[e]||e}))}},{key:"encodeURIFragment",value:function(e){var t={"%2D":"-","%2E":".","%5F":"_","%7E":"~","%21":"!","%24":"$","%27":"'","%28":"(","%29":")","%2A":"*","%2C":",","%3B":";","%3A":":","%40":"@","%2F":"/","%3F":"?"};return(e=encodeURIComponent(e)).replace(/%[0-9A-F]{2}/g,(function(e){return t[e]||e}))}},{key:"generatePrettyRecipe",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]&&arguments[1],r="",n="",i="",o="",s="";return e.forEach((function(e){n=e.op.replace(/ /g,"_"),i=JSON.stringify(e.args).slice(1,-1).replace(/'/g,"\\'").replace(/"((?:[^"\\]|\\.)*)"/g,"'$1'").replace(/\\"/g,'"'),o=e.disabled?"/disabled":"",s=e.breakpoint?"/breakpoint":"",r+=`${n}(${i}${o}${s})`,t&&(r+="\n")})),r}},{key:"parseRecipeConfig",value:function(e){if(0===(e=e.trim()).length)return[];if("["===e[0])return JSON.parse(e);var t,r;e=e.replace(/\n/g,"");for(var n=/([^(]+)\(((?:'[^'\\]*(?:\\.[^'\\]*)*'|[^)/'])*)(\/[^)]+)?\)/g,i=[];t=n.exec(e);){r="["+(r=t[2].replace(/"/g,'\\"').replace(/(^|,|{|:)'/g,'$1"').replace(/([^\\]|(?:\\\\)+)'(,|:|}|$)/g,'$1"$2').replace(/\\'/g,"'"))+"]";var o={op:t[1].replace(/_/g," "),args:JSON.parse(r)};t[3]&&t[3].indexOf("disabled")>0&&(o.disabled=!0),t[3]&&t[3].indexOf("breakpoint")>0&&(o.breakpoint=!0),i.push(o)}return i}},{key:"displayFilesAsHTML",value:function(e){var r,n,i,s,a;return o.a.async((function(u){for(;;)switch(u.prev=u.next){case 0:r=function(e){return`<div class='card' style='white-space: normal;'>\n                    <div class='card-header'>\n                        <h6 class="mb-0">\n                            ${t.escapeHtml(e.name)}\n                        </h6>\n                    </div>\n                </div>`},n=function(e,r){if(r.startsWith("image")){var n="data:";return n+=r+";","<img style='max-width: 100%;' src='"+(n+="base64,"+Object(h.b)(e))+"'>"}return`<pre>${t.escapeHtml(t.arrayBufferToStr(e.buffer))}</pre>`},i=function(e,r){var i,s,a,u;return o.a.async((function(c){for(;;)switch(c.prev=c.next){case 0:return c.next=2,o.a.awrap(t.readFile(e));case 2:return i=c.sent,s=new Blob([i],{type:e.type||"octet/stream"}),a=URL.createObjectURL(s),u=`<div class='card' style='white-space: normal;'>\n                    <div class='card-header' id='heading${r}'>\n                        <h6 class='mb-0'>\n                            <a class='collapsed'\n                                data-toggle='collapse'\n                                href='#collapse${r}'\n                                aria-expanded='false'\n                                aria-controls='collapse${r}'\n                                title="Show/hide contents of '${t.escapeHtml(e.name)}'">\n                                ${t.escapeHtml(e.name)}</a>\n                            <span class='float-right' style="margin-top: -3px">\n                                ${e.size.toLocaleString()} bytes\n                                <a title="Download ${t.escapeHtml(e.name)}"\n                                    href="${a}"\n                                    download="${t.escapeHtml(e.name)}"\n                                    data-toggle="tooltip">\n                                    <i class="material-icons" style="vertical-align: bottom">save</i>\n                                </a>\n                                <a title="Move to input"\n                                    href="#"\n                                    blob-url="${a}"\n                                    file-name="${t.escapeHtml(e.name)}"\n                                    class="extract-file"\n                                    data-toggle="tooltip">\n                                    <i class="material-icons" style="vertical-align: bottom">open_in_browser</i>\n                                </a>\n                            </span>\n                        </h6>\n                    </div>\n                    <div id='collapse${r}' class='collapse' aria-labelledby='heading${r}' data-parent="#files">\n                        <div class='card-body'>\n                            ${n(i,e.type)}\n                        </div>\n                    </div>\n                </div>`,c.abrupt("return",u);case 7:case"end":return c.stop()}}))},s=`<div style='padding: 5px; white-space: normal;'>\n                ${e.length} file(s) found\n            </div><div id="files" style="padding: 20px">`,a=0;case 5:if(!(a<e.length)){u.next=17;break}if(!e[a].name.endsWith("/")){u.next=10;break}s+=r(e[a]),u.next=14;break;case 10:return u.t0=s,u.next=13,o.a.awrap(i(e[a],a));case 13:s=u.t0+=u.sent;case 14:a++,u.next=5;break;case 17:return u.abrupt("return",s+="</div>");case 18:case"end":return u.stop()}}))}},{key:"parseURIParams",value:function(e){if(""===e)return{};"?"!==e[0]&&"#"!==e[0]||(e=e.substr(1));for(var t=e.split("&"),r={},n=0;n<t.length;n++){var i=t[n].split("=");2!==i.length?r[t[n]]=!0:r[i[0]]=decodeURIComponent(i[1].replace(/\+/g," "))}return r}},{key:"readFile",value:function(t){return g()?e.from(t).buffer:new Promise((function(e,r){var n=new FileReader,i=new Uint8Array(t.size),o=0,s=function(){if(o>=t.size)e(i);else{var r=t.slice(o,o+10485760);n.readAsArrayBuffer(r)}};n.onload=function(e){i.set(new Uint8Array(n.result),o),o+=10485760,s()},n.onerror=function(e){r(n.error.message)},s()}))}},{key:"readFileSync",value:function(e){if(!g())throw new TypeError("Browser environment cannot support readFileSync");return Uint8Array.from(e.data).buffer}},{key:"mod",value:function(e,t){return(e%t+t)%t}},{key:"gcd",value:function(e,r){return r?t.gcd(r,e%r):e}},{key:"modInv",value:function(e,t){e%=t;for(var r=1;r<t;r++)if(e*r%26==1)return r}},{key:"charRep",value:function(e){return{Space:" ",Percent:"%",Comma:",","Semi-colon":";",Colon:":",Tab:"\t","Line feed":"\n",CRLF:"\r\n","Forward slash":"/",Backslash:"\\","0x":"0x","\\x":"\\x","Nothing (separate chars)":"",None:""}[e]}},{key:"regexRep",value:function(e){return{Space:/\s+/g,Percent:/%/g,Comma:/,/g,"Semi-colon":/;/g,Colon:/:/g,"Line feed":/\n/g,CRLF:/\r\n/g,"Forward slash":/\//g,Backslash:/\\/g,"0x":/0x/g,"\\x":/\\x/g,None:/\s+/g}[e]}}]),t}();function g(){return void 0!==n&&null!=n.versions&&null!=n.versions.node}function _(){return"object"==typeof window}function v(){return"function"==typeof importScripts}function b(e){v()?self.sendStatusMessage(e):_()?app.alert(e,1e4):g()&&console.debug(e)}t.b=m,Array.prototype.unique=function(){for(var e={},t=[],r=0,n=this.length;r<n;r++)Object.prototype.hasOwnProperty.call(e,this[r])||(t.push(this[r]),e[this[r]]=1);return t},Array.prototype.max=function(){return Math.max.apply(null,this)},Array.prototype.min=function(){return Math.min.apply(null,this)},Array.prototype.sum=function(){return this.reduce((function(e,t){return e+t}),0)},Array.prototype.equals=function(e){if(!e)return!1;var t=this.length;if(t!==e.length)return!1;for(;t--;)if(this[t]!==e[t])return!1;return!0},String.prototype.count=function(e){return this.split(e).length-1};var w={};function E(e,t,r,n,i){return function(){clearTimeout(w[r]),w[r]=setTimeout((function(){e.apply(n,i)}),t)}}String.prototype.padStart||(String.prototype.padStart=function(e,t){return e>>=0,t=String(void 0!==t?t:" "),this.length>e?String(this):((e-=this.length)>t.length&&(t+=t.repeat(e/t.length)),t.slice(0,e)+String(this))}),String.prototype.padEnd||(String.prototype.padEnd=function(e,t){return e>>=0,t=String(void 0!==t?t:" "),this.length>e?String(this):((e-=this.length)>t.length&&(t+=t.repeat(e/t.length)),String(this)+t.slice(0,e))})}).call(this,r(11).Buffer,r(25))},1:function(e,t){e.exports=function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}},100:function(e,t,r){"use strict";(function(t,n){var i=r(63);e.exports=v;var o,s=r(145);v.ReadableState=_;r(74).EventEmitter;var a=function(e,t){return e.listeners(t).length},u=r(101),c=r(21).Buffer,f=t.Uint8Array||function(){};var l=r(56);l.inherits=r(17);var h=r(146),p=void 0;p=h&&h.debuglog?h.debuglog("stream"):function(){};var d,y=r(147),m=r(102);l.inherits(v,u);var g=["error","close","destroy","pause","resume"];function _(e,t){e=e||{};var n=t instanceof(o=o||r(47));this.objectMode=!!e.objectMode,n&&(this.objectMode=this.objectMode||!!e.readableObjectMode);var i=e.highWaterMark,s=e.readableHighWaterMark,a=this.objectMode?16:16384;this.highWaterMark=i||0===i?i:n&&(s||0===s)?s:a,this.highWaterMark=Math.floor(this.highWaterMark),this.buffer=new y,this.length=0,this.pipes=null,this.pipesCount=0,this.flowing=null,this.ended=!1,this.endEmitted=!1,this.reading=!1,this.sync=!0,this.needReadable=!1,this.emittedReadable=!1,this.readableListening=!1,this.resumeScheduled=!1,this.destroyed=!1,this.defaultEncoding=e.defaultEncoding||"utf8",this.awaitDrain=0,this.readingMore=!1,this.decoder=null,this.encoding=null,e.encoding&&(d||(d=r(86).StringDecoder),this.decoder=new d(e.encoding),this.encoding=e.encoding)}function v(e){if(o=o||r(47),!(this instanceof v))return new v(e);this._readableState=new _(e,this),this.readable=!0,e&&("function"==typeof e.read&&(this._read=e.read),"function"==typeof e.destroy&&(this._destroy=e.destroy)),u.call(this)}function b(e,t,r,n,i){var o,s=e._readableState;null===t?(s.reading=!1,function(e,t){if(t.ended)return;if(t.decoder){var r=t.decoder.end();r&&r.length&&(t.buffer.push(r),t.length+=t.objectMode?1:r.length)}t.ended=!0,A(e)}(e,s)):(i||(o=function(e,t){var r;n=t,c.isBuffer(n)||n instanceof f||"string"==typeof t||void 0===t||e.objectMode||(r=new TypeError("Invalid non-string/buffer chunk"));var n;return r}(s,t)),o?e.emit("error",o):s.objectMode||t&&t.length>0?("string"==typeof t||s.objectMode||Object.getPrototypeOf(t)===c.prototype||(t=function(e){return c.from(e)}(t)),n?s.endEmitted?e.emit("error",new Error("stream.unshift() after end event")):w(e,s,t,!0):s.ended?e.emit("error",new Error("stream.push() after EOF")):(s.reading=!1,s.decoder&&!r?(t=s.decoder.write(t),s.objectMode||0!==t.length?w(e,s,t,!1):x(e,s)):w(e,s,t,!1))):n||(s.reading=!1));return function(e){return!e.ended&&(e.needReadable||e.length<e.highWaterMark||0===e.length)}(s)}function w(e,t,r,n){t.flowing&&0===t.length&&!t.sync?(e.emit("data",r),e.read(0)):(t.length+=t.objectMode?1:r.length,n?t.buffer.unshift(r):t.buffer.push(r),t.needReadable&&A(e)),x(e,t)}Object.defineProperty(v.prototype,"destroyed",{get:function(){return void 0!==this._readableState&&this._readableState.destroyed},set:function(e){this._readableState&&(this._readableState.destroyed=e)}}),v.prototype.destroy=m.destroy,v.prototype._undestroy=m.undestroy,v.prototype._destroy=function(e,t){this.push(null),t(e)},v.prototype.push=function(e,t){var r,n=this._readableState;return n.objectMode?r=!0:"string"==typeof e&&((t=t||n.defaultEncoding)!==n.encoding&&(e=c.from(e,t),t=""),r=!0),b(this,e,t,!1,r)},v.prototype.unshift=function(e){return b(this,e,null,!0,!1)},v.prototype.isPaused=function(){return!1===this._readableState.flowing},v.prototype.setEncoding=function(e){return d||(d=r(86).StringDecoder),this._readableState.decoder=new d(e),this._readableState.encoding=e,this};var E=8388608;function B(e,t){return e<=0||0===t.length&&t.ended?0:t.objectMode?1:e!=e?t.flowing&&t.length?t.buffer.head.data.length:t.length:(e>t.highWaterMark&&(t.highWaterMark=function(e){return e>=E?e=E:(e--,e|=e>>>1,e|=e>>>2,e|=e>>>4,e|=e>>>8,e|=e>>>16,e++),e}(e)),e<=t.length?e:t.ended?t.length:(t.needReadable=!0,0))}function A(e){var t=e._readableState;t.needReadable=!1,t.emittedReadable||(p("emitReadable",t.flowing),t.emittedReadable=!0,t.sync?i.nextTick(S,e):S(e))}function S(e){p("emit readable"),e.emit("readable"),k(e)}function x(e,t){t.readingMore||(t.readingMore=!0,i.nextTick(T,e,t))}function T(e,t){for(var r=t.length;!t.reading&&!t.flowing&&!t.ended&&t.length<t.highWaterMark&&(p("maybeReadMore read 0"),e.read(0),r!==t.length);)r=t.length;t.readingMore=!1}function N(e){p("readable nexttick read 0"),e.read(0)}function O(e,t){t.reading||(p("resume read 0"),e.read(0)),t.resumeScheduled=!1,t.awaitDrain=0,e.emit("resume"),k(e),t.flowing&&!t.reading&&e.read(0)}function k(e){var t=e._readableState;for(p("flow",t.flowing);t.flowing&&null!==e.read(););}function I(e,t){return 0===t.length?null:(t.objectMode?r=t.buffer.shift():!e||e>=t.length?(r=t.decoder?t.buffer.join(""):1===t.buffer.length?t.buffer.head.data:t.buffer.concat(t.length),t.buffer.clear()):r=function(e,t,r){var n;e<t.head.data.length?(n=t.head.data.slice(0,e),t.head.data=t.head.data.slice(e)):n=e===t.head.data.length?t.shift():r?function(e,t){var r=t.head,n=1,i=r.data;e-=i.length;for(;r=r.next;){var o=r.data,s=e>o.length?o.length:e;if(s===o.length?i+=o:i+=o.slice(0,e),0===(e-=s)){s===o.length?(++n,r.next?t.head=r.next:t.head=t.tail=null):(t.head=r,r.data=o.slice(s));break}++n}return t.length-=n,i}(e,t):function(e,t){var r=c.allocUnsafe(e),n=t.head,i=1;n.data.copy(r),e-=n.data.length;for(;n=n.next;){var o=n.data,s=e>o.length?o.length:e;if(o.copy(r,r.length-e,0,s),0===(e-=s)){s===o.length?(++i,n.next?t.head=n.next:t.head=t.tail=null):(t.head=n,n.data=o.slice(s));break}++i}return t.length-=i,r}(e,t);return n}(e,t.buffer,t.decoder),r);var r}function F(e){var t=e._readableState;if(t.length>0)throw new Error('"endReadable()" called on non-empty stream');t.endEmitted||(t.ended=!0,i.nextTick(D,t,e))}function D(e,t){e.endEmitted||0!==e.length||(e.endEmitted=!0,t.readable=!1,t.emit("end"))}function R(e,t){for(var r=0,n=e.length;r<n;r++)if(e[r]===t)return r;return-1}v.prototype.read=function(e){p("read",e),e=parseInt(e,10);var t=this._readableState,r=e;if(0!==e&&(t.emittedReadable=!1),0===e&&t.needReadable&&(t.length>=t.highWaterMark||t.ended))return p("read: emitReadable",t.length,t.ended),0===t.length&&t.ended?F(this):A(this),null;if(0===(e=B(e,t))&&t.ended)return 0===t.length&&F(this),null;var n,i=t.needReadable;return p("need readable",i),(0===t.length||t.length-e<t.highWaterMark)&&p("length less than watermark",i=!0),t.ended||t.reading?p("reading or ended",i=!1):i&&(p("do read"),t.reading=!0,t.sync=!0,0===t.length&&(t.needReadable=!0),this._read(t.highWaterMark),t.sync=!1,t.reading||(e=B(r,t))),null===(n=e>0?I(e,t):null)?(t.needReadable=!0,e=0):t.length-=e,0===t.length&&(t.ended||(t.needReadable=!0),r!==e&&t.ended&&F(this)),null!==n&&this.emit("data",n),n},v.prototype._read=function(e){this.emit("error",new Error("_read() is not implemented"))},v.prototype.pipe=function(e,t){var r=this,o=this._readableState;switch(o.pipesCount){case 0:o.pipes=e;break;case 1:o.pipes=[o.pipes,e];break;default:o.pipes.push(e)}o.pipesCount+=1,p("pipe count=%d opts=%j",o.pipesCount,t);var u=(!t||!1!==t.end)&&e!==n.stdout&&e!==n.stderr?f:v;function c(t,n){p("onunpipe"),t===r&&n&&!1===n.hasUnpiped&&(n.hasUnpiped=!0,p("cleanup"),e.removeListener("close",g),e.removeListener("finish",_),e.removeListener("drain",l),e.removeListener("error",m),e.removeListener("unpipe",c),r.removeListener("end",f),r.removeListener("end",v),r.removeListener("data",y),h=!0,!o.awaitDrain||e._writableState&&!e._writableState.needDrain||l())}function f(){p("onend"),e.end()}o.endEmitted?i.nextTick(u):r.once("end",u),e.on("unpipe",c);var l=function(e){return function(){var t=e._readableState;p("pipeOnDrain",t.awaitDrain),t.awaitDrain&&t.awaitDrain--,0===t.awaitDrain&&a(e,"data")&&(t.flowing=!0,k(e))}}(r);e.on("drain",l);var h=!1;var d=!1;function y(t){p("ondata"),d=!1,!1!==e.write(t)||d||((1===o.pipesCount&&o.pipes===e||o.pipesCount>1&&-1!==R(o.pipes,e))&&!h&&(p("false write response, pause",r._readableState.awaitDrain),r._readableState.awaitDrain++,d=!0),r.pause())}function m(t){p("onerror",t),v(),e.removeListener("error",m),0===a(e,"error")&&e.emit("error",t)}function g(){e.removeListener("finish",_),v()}function _(){p("onfinish"),e.removeListener("close",g),v()}function v(){p("unpipe"),r.unpipe(e)}return r.on("data",y),function(e,t,r){if("function"==typeof e.prependListener)return e.prependListener(t,r);e._events&&e._events[t]?s(e._events[t])?e._events[t].unshift(r):e._events[t]=[r,e._events[t]]:e.on(t,r)}(e,"error",m),e.once("close",g),e.once("finish",_),e.emit("pipe",r),o.flowing||(p("pipe resume"),r.resume()),e},v.prototype.unpipe=function(e){var t=this._readableState,r={hasUnpiped:!1};if(0===t.pipesCount)return this;if(1===t.pipesCount)return e&&e!==t.pipes?this:(e||(e=t.pipes),t.pipes=null,t.pipesCount=0,t.flowing=!1,e&&e.emit("unpipe",this,r),this);if(!e){var n=t.pipes,i=t.pipesCount;t.pipes=null,t.pipesCount=0,t.flowing=!1;for(var o=0;o<i;o++)n[o].emit("unpipe",this,r);return this}var s=R(t.pipes,e);return-1===s?this:(t.pipes.splice(s,1),t.pipesCount-=1,1===t.pipesCount&&(t.pipes=t.pipes[0]),e.emit("unpipe",this,r),this)},v.prototype.on=function(e,t){var r=u.prototype.on.call(this,e,t);if("data"===e)!1!==this._readableState.flowing&&this.resume();else if("readable"===e){var n=this._readableState;n.endEmitted||n.readableListening||(n.readableListening=n.needReadable=!0,n.emittedReadable=!1,n.reading?n.length&&A(this):i.nextTick(N,this))}return r},v.prototype.addListener=v.prototype.on,v.prototype.resume=function(){var e=this._readableState;return e.flowing||(p("resume"),e.flowing=!0,function(e,t){t.resumeScheduled||(t.resumeScheduled=!0,i.nextTick(O,e,t))}(this,e)),this},v.prototype.pause=function(){return p("call pause flowing=%j",this._readableState.flowing),!1!==this._readableState.flowing&&(p("pause"),this._readableState.flowing=!1,this.emit("pause")),this},v.prototype.wrap=function(e){var t=this,r=this._readableState,n=!1;for(var i in e.on("end",(function(){if(p("wrapped end"),r.decoder&&!r.ended){var e=r.decoder.end();e&&e.length&&t.push(e)}t.push(null)})),e.on("data",(function(i){(p("wrapped data"),r.decoder&&(i=r.decoder.write(i)),r.objectMode&&null==i)||(r.objectMode||i&&i.length)&&(t.push(i)||(n=!0,e.pause()))})),e)void 0===this[i]&&"function"==typeof e[i]&&(this[i]=function(t){return function(){return e[t].apply(e,arguments)}}(i));for(var o=0;o<g.length;o++)e.on(g[o],this.emit.bind(this,g[o]));return this._read=function(t){p("wrapped _read",t),n&&(n=!1,e.resume())},this},Object.defineProperty(v.prototype,"readableHighWaterMark",{enumerable:!1,get:function(){return this._readableState.highWaterMark}}),v._fromList=I}).call(this,r(26),r(25))},101:function(e,t,r){e.exports=r(74).EventEmitter},102:function(e,t,r){"use strict";var n=r(63);function i(e,t){e.emit("error",t)}e.exports={destroy:function(e,t){var r=this,o=this._readableState&&this._readableState.destroyed,s=this._writableState&&this._writableState.destroyed;return o||s?(t?t(e):!e||this._writableState&&this._writableState.errorEmitted||n.nextTick(i,this,e),this):(this._readableState&&(this._readableState.destroyed=!0),this._writableState&&(this._writableState.destroyed=!0),this._destroy(e||null,(function(e){!t&&e?(n.nextTick(i,r,e),r._writableState&&(r._writableState.errorEmitted=!0)):t&&t(e)})),this)},undestroy:function(){this._readableState&&(this._readableState.destroyed=!1,this._readableState.reading=!1,this._readableState.ended=!1,this._readableState.endEmitted=!1),this._writableState&&(this._writableState.destroyed=!1,this._writableState.ended=!1,this._writableState.ending=!1,this._writableState.finished=!1,this._writableState.errorEmitted=!1)}}},103:function(e,t,r){"use strict";e.exports=s;var n=r(47),i=r(56);function o(e,t){var r=this._transformState;r.transforming=!1;var n=r.writecb;if(!n)return this.emit("error",new Error("write callback called multiple times"));r.writechunk=null,r.writecb=null,null!=t&&this.push(t),n(e);var i=this._readableState;i.reading=!1,(i.needReadable||i.length<i.highWaterMark)&&this._read(i.highWaterMark)}function s(e){if(!(this instanceof s))return new s(e);n.call(this,e),this._transformState={afterTransform:o.bind(this),needTransform:!1,transforming:!1,writecb:null,writechunk:null,writeencoding:null},this._readableState.needReadable=!0,this._readableState.sync=!1,e&&("function"==typeof e.transform&&(this._transform=e.transform),"function"==typeof e.flush&&(this._flush=e.flush)),this.on("prefinish",a)}function a(){var e=this;"function"==typeof this._flush?this._flush((function(t,r){u(e,t,r)})):u(this,null,null)}function u(e,t,r){if(t)return e.emit("error",t);if(null!=r&&e.push(r),e._writableState.length)throw new Error("Calling transform done when ws.length != 0");if(e._transformState.transforming)throw new Error("Calling transform done when still transforming");return e.push(null)}i.inherits=r(17),i.inherits(s,n),s.prototype.push=function(e,t){return this._transformState.needTransform=!1,n.prototype.push.call(this,e,t)},s.prototype._transform=function(e,t,r){throw new Error("_transform() is not implemented")},s.prototype._write=function(e,t,r){var n=this._transformState;if(n.writecb=r,n.writechunk=e,n.writeencoding=t,!n.transforming){var i=this._readableState;(n.needTransform||i.needReadable||i.length<i.highWaterMark)&&this._read(i.highWaterMark)}},s.prototype._read=function(e){var t=this._transformState;null!==t.writechunk&&t.writecb&&!t.transforming?(t.transforming=!0,this._transform(t.writechunk,t.writeencoding,t.afterTransform)):t.needTransform=!0},s.prototype._destroy=function(e,t){var r=this;n.prototype._destroy.call(this,e,(function(e){t(e),r.emit("close")}))}},108:function(e,t,r){"use strict";var n="undefined"!=typeof Uint8Array&&"undefined"!=typeof Uint16Array&&"undefined"!=typeof Int32Array;function i(e,t){return Object.prototype.hasOwnProperty.call(e,t)}t.assign=function(e){for(var t=Array.prototype.slice.call(arguments,1);t.length;){var r=t.shift();if(r){if("object"!=typeof r)throw new TypeError(r+"must be non-object");for(var n in r)i(r,n)&&(e[n]=r[n])}}return e},t.shrinkBuf=function(e,t){return e.length===t?e:e.subarray?e.subarray(0,t):(e.length=t,e)};var o={arraySet:function(e,t,r,n,i){if(t.subarray&&e.subarray)e.set(t.subarray(r,r+n),i);else for(var o=0;o<n;o++)e[i+o]=t[r+o]},flattenChunks:function(e){var t,r,n,i,o,s;for(n=0,t=0,r=e.length;t<r;t++)n+=e[t].length;for(s=new Uint8Array(n),i=0,t=0,r=e.length;t<r;t++)o=e[t],s.set(o,i),i+=o.length;return s}},s={arraySet:function(e,t,r,n,i){for(var o=0;o<n;o++)e[i+o]=t[r+o]},flattenChunks:function(e){return[].concat.apply([],e)}};t.setTyped=function(e){e?(t.Buf8=Uint8Array,t.Buf16=Uint16Array,t.Buf32=Int32Array,t.assign(t,o)):(t.Buf8=Array,t.Buf16=Array,t.Buf32=Array,t.assign(t,s))},t.setTyped(n)},11:function(e,t,r){"use strict";(function(e){
/*!
 * The buffer module from node.js, for the browser.
 *
 * @author   Feross Aboukhadijeh <http://feross.org>
 * @license  MIT
 */
var n=r(40),i=r(41),o=r(42);function s(){return u.TYPED_ARRAY_SUPPORT?2147483647:1073741823}function a(e,t){if(s()<t)throw new RangeError("Invalid typed array length");return u.TYPED_ARRAY_SUPPORT?(e=new Uint8Array(t)).__proto__=u.prototype:(null===e&&(e=new u(t)),e.length=t),e}function u(e,t,r){if(!(u.TYPED_ARRAY_SUPPORT||this instanceof u))return new u(e,t,r);if("number"==typeof e){if("string"==typeof t)throw new Error("If encoding is specified then the first argument must be a string");return l(this,e)}return c(this,e,t,r)}function c(e,t,r,n){if("number"==typeof t)throw new TypeError('"value" argument must not be a number');return"undefined"!=typeof ArrayBuffer&&t instanceof ArrayBuffer?function(e,t,r,n){if(t.byteLength,r<0||t.byteLength<r)throw new RangeError("'offset' is out of bounds");if(t.byteLength<r+(n||0))throw new RangeError("'length' is out of bounds");t=void 0===r&&void 0===n?new Uint8Array(t):void 0===n?new Uint8Array(t,r):new Uint8Array(t,r,n);u.TYPED_ARRAY_SUPPORT?(e=t).__proto__=u.prototype:e=h(e,t);return e}(e,t,r,n):"string"==typeof t?function(e,t,r){"string"==typeof r&&""!==r||(r="utf8");if(!u.isEncoding(r))throw new TypeError('"encoding" must be a valid string encoding');var n=0|d(t,r),i=(e=a(e,n)).write(t,r);i!==n&&(e=e.slice(0,i));return e}(e,t,r):function(e,t){if(u.isBuffer(t)){var r=0|p(t.length);return 0===(e=a(e,r)).length?e:(t.copy(e,0,0,r),e)}if(t){if("undefined"!=typeof ArrayBuffer&&t.buffer instanceof ArrayBuffer||"length"in t)return"number"!=typeof t.length||(n=t.length)!=n?a(e,0):h(e,t);if("Buffer"===t.type&&o(t.data))return h(e,t.data)}var n;throw new TypeError("First argument must be a string, Buffer, ArrayBuffer, Array, or array-like object.")}(e,t)}function f(e){if("number"!=typeof e)throw new TypeError('"size" argument must be a number');if(e<0)throw new RangeError('"size" argument must not be negative')}function l(e,t){if(f(t),e=a(e,t<0?0:0|p(t)),!u.TYPED_ARRAY_SUPPORT)for(var r=0;r<t;++r)e[r]=0;return e}function h(e,t){var r=t.length<0?0:0|p(t.length);e=a(e,r);for(var n=0;n<r;n+=1)e[n]=255&t[n];return e}function p(e){if(e>=s())throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+s().toString(16)+" bytes");return 0|e}function d(e,t){if(u.isBuffer(e))return e.length;if("undefined"!=typeof ArrayBuffer&&"function"==typeof ArrayBuffer.isView&&(ArrayBuffer.isView(e)||e instanceof ArrayBuffer))return e.byteLength;"string"!=typeof e&&(e=""+e);var r=e.length;if(0===r)return 0;for(var n=!1;;)switch(t){case"ascii":case"latin1":case"binary":return r;case"utf8":case"utf-8":case void 0:return z(e).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return 2*r;case"hex":return r>>>1;case"base64":return $(e).length;default:if(n)return z(e).length;t=(""+t).toLowerCase(),n=!0}}function y(e,t,r){var n=!1;if((void 0===t||t<0)&&(t=0),t>this.length)return"";if((void 0===r||r>this.length)&&(r=this.length),r<=0)return"";if((r>>>=0)<=(t>>>=0))return"";for(e||(e="utf8");;)switch(e){case"hex":return k(this,t,r);case"utf8":case"utf-8":return x(this,t,r);case"ascii":return N(this,t,r);case"latin1":case"binary":return O(this,t,r);case"base64":return S(this,t,r);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return I(this,t,r);default:if(n)throw new TypeError("Unknown encoding: "+e);e=(e+"").toLowerCase(),n=!0}}function m(e,t,r){var n=e[t];e[t]=e[r],e[r]=n}function g(e,t,r,n,i){if(0===e.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:e.length-1),r<0&&(r=e.length+r),r>=e.length){if(i)return-1;r=e.length-1}else if(r<0){if(!i)return-1;r=0}if("string"==typeof t&&(t=u.from(t,n)),u.isBuffer(t))return 0===t.length?-1:_(e,t,r,n,i);if("number"==typeof t)return t&=255,u.TYPED_ARRAY_SUPPORT&&"function"==typeof Uint8Array.prototype.indexOf?i?Uint8Array.prototype.indexOf.call(e,t,r):Uint8Array.prototype.lastIndexOf.call(e,t,r):_(e,[t],r,n,i);throw new TypeError("val must be string, number or Buffer")}function _(e,t,r,n,i){var o,s=1,a=e.length,u=t.length;if(void 0!==n&&("ucs2"===(n=String(n).toLowerCase())||"ucs-2"===n||"utf16le"===n||"utf-16le"===n)){if(e.length<2||t.length<2)return-1;s=2,a/=2,u/=2,r/=2}function c(e,t){return 1===s?e[t]:e.readUInt16BE(t*s)}if(i){var f=-1;for(o=r;o<a;o++)if(c(e,o)===c(t,-1===f?0:o-f)){if(-1===f&&(f=o),o-f+1===u)return f*s}else-1!==f&&(o-=o-f),f=-1}else for(r+u>a&&(r=a-u),o=r;o>=0;o--){for(var l=!0,h=0;h<u;h++)if(c(e,o+h)!==c(t,h)){l=!1;break}if(l)return o}return-1}function v(e,t,r,n){r=Number(r)||0;var i=e.length-r;n?(n=Number(n))>i&&(n=i):n=i;var o=t.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(t.substr(2*s,2),16);if(isNaN(a))return s;e[r+s]=a}return s}function b(e,t,r,n){return Y(z(t,e.length-r),e,r,n)}function w(e,t,r,n){return Y(function(e){for(var t=[],r=0;r<e.length;++r)t.push(255&e.charCodeAt(r));return t}(t),e,r,n)}function E(e,t,r,n){return w(e,t,r,n)}function B(e,t,r,n){return Y($(t),e,r,n)}function A(e,t,r,n){return Y(function(e,t){for(var r,n,i,o=[],s=0;s<e.length&&!((t-=2)<0);++s)r=e.charCodeAt(s),n=r>>8,i=r%256,o.push(i),o.push(n);return o}(t,e.length-r),e,r,n)}function S(e,t,r){return 0===t&&r===e.length?n.fromByteArray(e):n.fromByteArray(e.slice(t,r))}function x(e,t,r){r=Math.min(e.length,r);for(var n=[],i=t;i<r;){var o,s,a,u,c=e[i],f=null,l=c>239?4:c>223?3:c>191?2:1;if(i+l<=r)switch(l){case 1:c<128&&(f=c);break;case 2:128==(192&(o=e[i+1]))&&(u=(31&c)<<6|63&o)>127&&(f=u);break;case 3:o=e[i+1],s=e[i+2],128==(192&o)&&128==(192&s)&&(u=(15&c)<<12|(63&o)<<6|63&s)>2047&&(u<55296||u>57343)&&(f=u);break;case 4:o=e[i+1],s=e[i+2],a=e[i+3],128==(192&o)&&128==(192&s)&&128==(192&a)&&(u=(15&c)<<18|(63&o)<<12|(63&s)<<6|63&a)>65535&&u<1114112&&(f=u)}null===f?(f=65533,l=1):f>65535&&(f-=65536,n.push(f>>>10&1023|55296),f=56320|1023&f),n.push(f),i+=l}return function(e){var t=e.length;if(t<=T)return String.fromCharCode.apply(String,e);var r="",n=0;for(;n<t;)r+=String.fromCharCode.apply(String,e.slice(n,n+=T));return r}(n)}t.Buffer=u,t.SlowBuffer=function(e){+e!=e&&(e=0);return u.alloc(+e)},t.INSPECT_MAX_BYTES=50,u.TYPED_ARRAY_SUPPORT=void 0!==e.TYPED_ARRAY_SUPPORT?e.TYPED_ARRAY_SUPPORT:function(){try{var e=new Uint8Array(1);return e.__proto__={__proto__:Uint8Array.prototype,foo:function(){return 42}},42===e.foo()&&"function"==typeof e.subarray&&0===e.subarray(1,1).byteLength}catch(e){return!1}}(),t.kMaxLength=s(),u.poolSize=8192,u._augment=function(e){return e.__proto__=u.prototype,e},u.from=function(e,t,r){return c(null,e,t,r)},u.TYPED_ARRAY_SUPPORT&&(u.prototype.__proto__=Uint8Array.prototype,u.__proto__=Uint8Array,"undefined"!=typeof Symbol&&Symbol.species&&u[Symbol.species]===u&&Object.defineProperty(u,Symbol.species,{value:null,configurable:!0})),u.alloc=function(e,t,r){return function(e,t,r,n){return f(t),t<=0?a(e,t):void 0!==r?"string"==typeof n?a(e,t).fill(r,n):a(e,t).fill(r):a(e,t)}(null,e,t,r)},u.allocUnsafe=function(e){return l(null,e)},u.allocUnsafeSlow=function(e){return l(null,e)},u.isBuffer=function(e){return!(null==e||!e._isBuffer)},u.compare=function(e,t){if(!u.isBuffer(e)||!u.isBuffer(t))throw new TypeError("Arguments must be Buffers");if(e===t)return 0;for(var r=e.length,n=t.length,i=0,o=Math.min(r,n);i<o;++i)if(e[i]!==t[i]){r=e[i],n=t[i];break}return r<n?-1:n<r?1:0},u.isEncoding=function(e){switch(String(e).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}},u.concat=function(e,t){if(!o(e))throw new TypeError('"list" argument must be an Array of Buffers');if(0===e.length)return u.alloc(0);var r;if(void 0===t)for(t=0,r=0;r<e.length;++r)t+=e[r].length;var n=u.allocUnsafe(t),i=0;for(r=0;r<e.length;++r){var s=e[r];if(!u.isBuffer(s))throw new TypeError('"list" argument must be an Array of Buffers');s.copy(n,i),i+=s.length}return n},u.byteLength=d,u.prototype._isBuffer=!0,u.prototype.swap16=function(){var e=this.length;if(e%2!=0)throw new RangeError("Buffer size must be a multiple of 16-bits");for(var t=0;t<e;t+=2)m(this,t,t+1);return this},u.prototype.swap32=function(){var e=this.length;if(e%4!=0)throw new RangeError("Buffer size must be a multiple of 32-bits");for(var t=0;t<e;t+=4)m(this,t,t+3),m(this,t+1,t+2);return this},u.prototype.swap64=function(){var e=this.length;if(e%8!=0)throw new RangeError("Buffer size must be a multiple of 64-bits");for(var t=0;t<e;t+=8)m(this,t,t+7),m(this,t+1,t+6),m(this,t+2,t+5),m(this,t+3,t+4);return this},u.prototype.toString=function(){var e=0|this.length;return 0===e?"":0===arguments.length?x(this,0,e):y.apply(this,arguments)},u.prototype.equals=function(e){if(!u.isBuffer(e))throw new TypeError("Argument must be a Buffer");return this===e||0===u.compare(this,e)},u.prototype.inspect=function(){var e="",r=t.INSPECT_MAX_BYTES;return this.length>0&&(e=this.toString("hex",0,r).match(/.{2}/g).join(" "),this.length>r&&(e+=" ... ")),"<Buffer "+e+">"},u.prototype.compare=function(e,t,r,n,i){if(!u.isBuffer(e))throw new TypeError("Argument must be a Buffer");if(void 0===t&&(t=0),void 0===r&&(r=e?e.length:0),void 0===n&&(n=0),void 0===i&&(i=this.length),t<0||r>e.length||n<0||i>this.length)throw new RangeError("out of range index");if(n>=i&&t>=r)return 0;if(n>=i)return-1;if(t>=r)return 1;if(this===e)return 0;for(var o=(i>>>=0)-(n>>>=0),s=(r>>>=0)-(t>>>=0),a=Math.min(o,s),c=this.slice(n,i),f=e.slice(t,r),l=0;l<a;++l)if(c[l]!==f[l]){o=c[l],s=f[l];break}return o<s?-1:s<o?1:0},u.prototype.includes=function(e,t,r){return-1!==this.indexOf(e,t,r)},u.prototype.indexOf=function(e,t,r){return g(this,e,t,r,!0)},u.prototype.lastIndexOf=function(e,t,r){return g(this,e,t,r,!1)},u.prototype.write=function(e,t,r,n){if(void 0===t)n="utf8",r=this.length,t=0;else if(void 0===r&&"string"==typeof t)n=t,r=this.length,t=0;else{if(!isFinite(t))throw new Error("Buffer.write(string, encoding, offset[, length]) is no longer supported");t|=0,isFinite(r)?(r|=0,void 0===n&&(n="utf8")):(n=r,r=void 0)}var i=this.length-t;if((void 0===r||r>i)&&(r=i),e.length>0&&(r<0||t<0)||t>this.length)throw new RangeError("Attempt to write outside buffer bounds");n||(n="utf8");for(var o=!1;;)switch(n){case"hex":return v(this,e,t,r);case"utf8":case"utf-8":return b(this,e,t,r);case"ascii":return w(this,e,t,r);case"latin1":case"binary":return E(this,e,t,r);case"base64":return B(this,e,t,r);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return A(this,e,t,r);default:if(o)throw new TypeError("Unknown encoding: "+n);n=(""+n).toLowerCase(),o=!0}},u.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};var T=4096;function N(e,t,r){var n="";r=Math.min(e.length,r);for(var i=t;i<r;++i)n+=String.fromCharCode(127&e[i]);return n}function O(e,t,r){var n="";r=Math.min(e.length,r);for(var i=t;i<r;++i)n+=String.fromCharCode(e[i]);return n}function k(e,t,r){var n=e.length;(!t||t<0)&&(t=0),(!r||r<0||r>n)&&(r=n);for(var i="",o=t;o<r;++o)i+=U(e[o]);return i}function I(e,t,r){for(var n=e.slice(t,r),i="",o=0;o<n.length;o+=2)i+=String.fromCharCode(n[o]+256*n[o+1]);return i}function F(e,t,r){if(e%1!=0||e<0)throw new RangeError("offset is not uint");if(e+t>r)throw new RangeError("Trying to access beyond buffer length")}function D(e,t,r,n,i,o){if(!u.isBuffer(e))throw new TypeError('"buffer" argument must be a Buffer instance');if(t>i||t<o)throw new RangeError('"value" argument is out of bounds');if(r+n>e.length)throw new RangeError("Index out of range")}function R(e,t,r,n){t<0&&(t=65535+t+1);for(var i=0,o=Math.min(e.length-r,2);i<o;++i)e[r+i]=(t&255<<8*(n?i:1-i))>>>8*(n?i:1-i)}function C(e,t,r,n){t<0&&(t=4294967295+t+1);for(var i=0,o=Math.min(e.length-r,4);i<o;++i)e[r+i]=t>>>8*(n?i:3-i)&255}function L(e,t,r,n,i,o){if(r+n>e.length)throw new RangeError("Index out of range");if(r<0)throw new RangeError("Index out of range")}function P(e,t,r,n,o){return o||L(e,0,r,4),i.write(e,t,r,n,23,4),r+4}function j(e,t,r,n,o){return o||L(e,0,r,8),i.write(e,t,r,n,52,8),r+8}u.prototype.slice=function(e,t){var r,n=this.length;if((e=~~e)<0?(e+=n)<0&&(e=0):e>n&&(e=n),(t=void 0===t?n:~~t)<0?(t+=n)<0&&(t=0):t>n&&(t=n),t<e&&(t=e),u.TYPED_ARRAY_SUPPORT)(r=this.subarray(e,t)).__proto__=u.prototype;else{var i=t-e;r=new u(i,void 0);for(var o=0;o<i;++o)r[o]=this[o+e]}return r},u.prototype.readUIntLE=function(e,t,r){e|=0,t|=0,r||F(e,t,this.length);for(var n=this[e],i=1,o=0;++o<t&&(i*=256);)n+=this[e+o]*i;return n},u.prototype.readUIntBE=function(e,t,r){e|=0,t|=0,r||F(e,t,this.length);for(var n=this[e+--t],i=1;t>0&&(i*=256);)n+=this[e+--t]*i;return n},u.prototype.readUInt8=function(e,t){return t||F(e,1,this.length),this[e]},u.prototype.readUInt16LE=function(e,t){return t||F(e,2,this.length),this[e]|this[e+1]<<8},u.prototype.readUInt16BE=function(e,t){return t||F(e,2,this.length),this[e]<<8|this[e+1]},u.prototype.readUInt32LE=function(e,t){return t||F(e,4,this.length),(this[e]|this[e+1]<<8|this[e+2]<<16)+16777216*this[e+3]},u.prototype.readUInt32BE=function(e,t){return t||F(e,4,this.length),16777216*this[e]+(this[e+1]<<16|this[e+2]<<8|this[e+3])},u.prototype.readIntLE=function(e,t,r){e|=0,t|=0,r||F(e,t,this.length);for(var n=this[e],i=1,o=0;++o<t&&(i*=256);)n+=this[e+o]*i;return n>=(i*=128)&&(n-=Math.pow(2,8*t)),n},u.prototype.readIntBE=function(e,t,r){e|=0,t|=0,r||F(e,t,this.length);for(var n=t,i=1,o=this[e+--n];n>0&&(i*=256);)o+=this[e+--n]*i;return o>=(i*=128)&&(o-=Math.pow(2,8*t)),o},u.prototype.readInt8=function(e,t){return t||F(e,1,this.length),128&this[e]?-1*(255-this[e]+1):this[e]},u.prototype.readInt16LE=function(e,t){t||F(e,2,this.length);var r=this[e]|this[e+1]<<8;return 32768&r?4294901760|r:r},u.prototype.readInt16BE=function(e,t){t||F(e,2,this.length);var r=this[e+1]|this[e]<<8;return 32768&r?4294901760|r:r},u.prototype.readInt32LE=function(e,t){return t||F(e,4,this.length),this[e]|this[e+1]<<8|this[e+2]<<16|this[e+3]<<24},u.prototype.readInt32BE=function(e,t){return t||F(e,4,this.length),this[e]<<24|this[e+1]<<16|this[e+2]<<8|this[e+3]},u.prototype.readFloatLE=function(e,t){return t||F(e,4,this.length),i.read(this,e,!0,23,4)},u.prototype.readFloatBE=function(e,t){return t||F(e,4,this.length),i.read(this,e,!1,23,4)},u.prototype.readDoubleLE=function(e,t){return t||F(e,8,this.length),i.read(this,e,!0,52,8)},u.prototype.readDoubleBE=function(e,t){return t||F(e,8,this.length),i.read(this,e,!1,52,8)},u.prototype.writeUIntLE=function(e,t,r,n){(e=+e,t|=0,r|=0,n)||D(this,e,t,r,Math.pow(2,8*r)-1,0);var i=1,o=0;for(this[t]=255&e;++o<r&&(i*=256);)this[t+o]=e/i&255;return t+r},u.prototype.writeUIntBE=function(e,t,r,n){(e=+e,t|=0,r|=0,n)||D(this,e,t,r,Math.pow(2,8*r)-1,0);var i=r-1,o=1;for(this[t+i]=255&e;--i>=0&&(o*=256);)this[t+i]=e/o&255;return t+r},u.prototype.writeUInt8=function(e,t,r){return e=+e,t|=0,r||D(this,e,t,1,255,0),u.TYPED_ARRAY_SUPPORT||(e=Math.floor(e)),this[t]=255&e,t+1},u.prototype.writeUInt16LE=function(e,t,r){return e=+e,t|=0,r||D(this,e,t,2,65535,0),u.TYPED_ARRAY_SUPPORT?(this[t]=255&e,this[t+1]=e>>>8):R(this,e,t,!0),t+2},u.prototype.writeUInt16BE=function(e,t,r){return e=+e,t|=0,r||D(this,e,t,2,65535,0),u.TYPED_ARRAY_SUPPORT?(this[t]=e>>>8,this[t+1]=255&e):R(this,e,t,!1),t+2},u.prototype.writeUInt32LE=function(e,t,r){return e=+e,t|=0,r||D(this,e,t,4,4294967295,0),u.TYPED_ARRAY_SUPPORT?(this[t+3]=e>>>24,this[t+2]=e>>>16,this[t+1]=e>>>8,this[t]=255&e):C(this,e,t,!0),t+4},u.prototype.writeUInt32BE=function(e,t,r){return e=+e,t|=0,r||D(this,e,t,4,4294967295,0),u.TYPED_ARRAY_SUPPORT?(this[t]=e>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=255&e):C(this,e,t,!1),t+4},u.prototype.writeIntLE=function(e,t,r,n){if(e=+e,t|=0,!n){var i=Math.pow(2,8*r-1);D(this,e,t,r,i-1,-i)}var o=0,s=1,a=0;for(this[t]=255&e;++o<r&&(s*=256);)e<0&&0===a&&0!==this[t+o-1]&&(a=1),this[t+o]=(e/s>>0)-a&255;return t+r},u.prototype.writeIntBE=function(e,t,r,n){if(e=+e,t|=0,!n){var i=Math.pow(2,8*r-1);D(this,e,t,r,i-1,-i)}var o=r-1,s=1,a=0;for(this[t+o]=255&e;--o>=0&&(s*=256);)e<0&&0===a&&0!==this[t+o+1]&&(a=1),this[t+o]=(e/s>>0)-a&255;return t+r},u.prototype.writeInt8=function(e,t,r){return e=+e,t|=0,r||D(this,e,t,1,127,-128),u.TYPED_ARRAY_SUPPORT||(e=Math.floor(e)),e<0&&(e=255+e+1),this[t]=255&e,t+1},u.prototype.writeInt16LE=function(e,t,r){return e=+e,t|=0,r||D(this,e,t,2,32767,-32768),u.TYPED_ARRAY_SUPPORT?(this[t]=255&e,this[t+1]=e>>>8):R(this,e,t,!0),t+2},u.prototype.writeInt16BE=function(e,t,r){return e=+e,t|=0,r||D(this,e,t,2,32767,-32768),u.TYPED_ARRAY_SUPPORT?(this[t]=e>>>8,this[t+1]=255&e):R(this,e,t,!1),t+2},u.prototype.writeInt32LE=function(e,t,r){return e=+e,t|=0,r||D(this,e,t,4,2147483647,-2147483648),u.TYPED_ARRAY_SUPPORT?(this[t]=255&e,this[t+1]=e>>>8,this[t+2]=e>>>16,this[t+3]=e>>>24):C(this,e,t,!0),t+4},u.prototype.writeInt32BE=function(e,t,r){return e=+e,t|=0,r||D(this,e,t,4,2147483647,-2147483648),e<0&&(e=4294967295+e+1),u.TYPED_ARRAY_SUPPORT?(this[t]=e>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=255&e):C(this,e,t,!1),t+4},u.prototype.writeFloatLE=function(e,t,r){return P(this,e,t,!0,r)},u.prototype.writeFloatBE=function(e,t,r){return P(this,e,t,!1,r)},u.prototype.writeDoubleLE=function(e,t,r){return j(this,e,t,!0,r)},u.prototype.writeDoubleBE=function(e,t,r){return j(this,e,t,!1,r)},u.prototype.copy=function(e,t,r,n){if(r||(r=0),n||0===n||(n=this.length),t>=e.length&&(t=e.length),t||(t=0),n>0&&n<r&&(n=r),n===r)return 0;if(0===e.length||0===this.length)return 0;if(t<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),e.length-t<n-r&&(n=e.length-t+r);var i,o=n-r;if(this===e&&r<t&&t<n)for(i=o-1;i>=0;--i)e[i+t]=this[i+r];else if(o<1e3||!u.TYPED_ARRAY_SUPPORT)for(i=0;i<o;++i)e[i+t]=this[i+r];else Uint8Array.prototype.set.call(e,this.subarray(r,r+o),t);return o},u.prototype.fill=function(e,t,r,n){if("string"==typeof e){if("string"==typeof t?(n=t,t=0,r=this.length):"string"==typeof r&&(n=r,r=this.length),1===e.length){var i=e.charCodeAt(0);i<256&&(e=i)}if(void 0!==n&&"string"!=typeof n)throw new TypeError("encoding must be a string");if("string"==typeof n&&!u.isEncoding(n))throw new TypeError("Unknown encoding: "+n)}else"number"==typeof e&&(e&=255);if(t<0||this.length<t||this.length<r)throw new RangeError("Out of range index");if(r<=t)return this;var o;if(t>>>=0,r=void 0===r?this.length:r>>>0,e||(e=0),"number"==typeof e)for(o=t;o<r;++o)this[o]=e;else{var s=u.isBuffer(e)?e:z(new u(e,n).toString()),a=s.length;for(o=0;o<r-t;++o)this[o+t]=s[o%a]}return this};var M=/[^+\/0-9A-Za-z-_]/g;function U(e){return e<16?"0"+e.toString(16):e.toString(16)}function z(e,t){var r;t=t||1/0;for(var n=e.length,i=null,o=[],s=0;s<n;++s){if((r=e.charCodeAt(s))>55295&&r<57344){if(!i){if(r>56319){(t-=3)>-1&&o.push(239,191,189);continue}if(s+1===n){(t-=3)>-1&&o.push(239,191,189);continue}i=r;continue}if(r<56320){(t-=3)>-1&&o.push(239,191,189),i=r;continue}r=65536+(i-55296<<10|r-56320)}else i&&(t-=3)>-1&&o.push(239,191,189);if(i=null,r<128){if((t-=1)<0)break;o.push(r)}else if(r<2048){if((t-=2)<0)break;o.push(r>>6|192,63&r|128)}else if(r<65536){if((t-=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((t-=4)<0)break;o.push(r>>18|240,r>>12&63|128,r>>6&63|128,63&r|128)}}return o}function $(e){return n.toByteArray(function(e){if((e=function(e){return e.trim?e.trim():e.replace(/^\s+|\s+$/g,"")}(e).replace(M,"")).length<2)return"";for(;e.length%4!=0;)e+="=";return e}(e))}function Y(e,t,r,n){for(var i=0;i<n&&!(i+r>=t.length||i>=e.length);++i)t[i+r]=e[i];return i}}).call(this,r(26))},112:function(e,t,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
 */
function n(e,t){if(e===t)return 0;for(var r=e.length,n=t.length,i=0,o=Math.min(r,n);i<o;++i)if(e[i]!==t[i]){r=e[i],n=t[i];break}return r<n?-1:n<r?1:0}function i(e){return t.Buffer&&"function"==typeof t.Buffer.isBuffer?t.Buffer.isBuffer(e):!(null==e||!e._isBuffer)}var o=r(64),s=Object.prototype.hasOwnProperty,a=Array.prototype.slice,u="foo"===function(){}.name;function c(e){return Object.prototype.toString.call(e)}function f(e){return!i(e)&&("function"==typeof t.ArrayBuffer&&("function"==typeof ArrayBuffer.isView?ArrayBuffer.isView(e):!!e&&(e instanceof DataView||!!(e.buffer&&e.buffer instanceof ArrayBuffer))))}var l=e.exports=g,h=/\s*function\s+([^\(\s]*)\s*/;function p(e){if(o.isFunction(e)){if(u)return e.name;var t=e.toString().match(h);return t&&t[1]}}function d(e,t){return"string"==typeof e?e.length<t?e:e.slice(0,t):e}function y(e){if(u||!o.isFunction(e))return o.inspect(e);var t=p(e);return"[Function"+(t?": "+t:"")+"]"}function m(e,t,r,n,i){throw new l.AssertionError({message:r,actual:e,expected:t,operator:n,stackStartFunction:i})}function g(e,t){e||m(e,!0,t,"==",l.ok)}function _(e,t,r,s){if(e===t)return!0;if(i(e)&&i(t))return 0===n(e,t);if(o.isDate(e)&&o.isDate(t))return e.getTime()===t.getTime();if(o.isRegExp(e)&&o.isRegExp(t))return e.source===t.source&&e.global===t.global&&e.multiline===t.multiline&&e.lastIndex===t.lastIndex&&e.ignoreCase===t.ignoreCase;if(null!==e&&"object"==typeof e||null!==t&&"object"==typeof t){if(f(e)&&f(t)&&c(e)===c(t)&&!(e instanceof Float32Array||e instanceof Float64Array))return 0===n(new Uint8Array(e.buffer),new Uint8Array(t.buffer));if(i(e)!==i(t))return!1;var u=(s=s||{actual:[],expected:[]}).actual.indexOf(e);return-1!==u&&u===s.expected.indexOf(t)||(s.actual.push(e),s.expected.push(t),function(e,t,r,n){if(null==e||null==t)return!1;if(o.isPrimitive(e)||o.isPrimitive(t))return e===t;if(r&&Object.getPrototypeOf(e)!==Object.getPrototypeOf(t))return!1;var i=v(e),s=v(t);if(i&&!s||!i&&s)return!1;if(i)return e=a.call(e),t=a.call(t),_(e,t,r);var u,c,f=E(e),l=E(t);if(f.length!==l.length)return!1;for(f.sort(),l.sort(),c=f.length-1;c>=0;c--)if(f[c]!==l[c])return!1;for(c=f.length-1;c>=0;c--)if(u=f[c],!_(e[u],t[u],r,n))return!1;return!0}(e,t,r,s))}return r?e===t:e==t}function v(e){return"[object Arguments]"==Object.prototype.toString.call(e)}function b(e,t){if(!e||!t)return!1;if("[object RegExp]"==Object.prototype.toString.call(t))return t.test(e);try{if(e instanceof t)return!0}catch(e){}return!Error.isPrototypeOf(t)&&!0===t.call({},e)}function w(e,t,r,n){var i;if("function"!=typeof t)throw new TypeError('"block" argument must be a function');"string"==typeof r&&(n=r,r=null),i=function(e){var t;try{e()}catch(e){t=e}return t}(t),n=(r&&r.name?" ("+r.name+").":".")+(n?" "+n:"."),e&&!i&&m(i,r,"Missing expected exception"+n);var s="string"==typeof n,a=!e&&i&&!r;if((!e&&o.isError(i)&&s&&b(i,r)||a)&&m(i,r,"Got unwanted exception"+n),e&&i&&r&&!b(i,r)||!e&&i)throw i}l.AssertionError=function(e){this.name="AssertionError",this.actual=e.actual,this.expected=e.expected,this.operator=e.operator,e.message?(this.message=e.message,this.generatedMessage=!1):(this.message=function(e){return d(y(e.actual),128)+" "+e.operator+" "+d(y(e.expected),128)}(this),this.generatedMessage=!0);var t=e.stackStartFunction||m;if(Error.captureStackTrace)Error.captureStackTrace(this,t);else{var r=new Error;if(r.stack){var n=r.stack,i=p(t),o=n.indexOf("\n"+i);if(o>=0){var s=n.indexOf("\n",o+1);n=n.substring(s+1)}this.stack=n}}},o.inherits(l.AssertionError,Error),l.fail=m,l.ok=g,l.equal=function(e,t,r){e!=t&&m(e,t,r,"==",l.equal)},l.notEqual=function(e,t,r){e==t&&m(e,t,r,"!=",l.notEqual)},l.deepEqual=function(e,t,r){_(e,t,!1)||m(e,t,r,"deepEqual",l.deepEqual)},l.deepStrictEqual=function(e,t,r){_(e,t,!0)||m(e,t,r,"deepStrictEqual",l.deepStrictEqual)},l.notDeepEqual=function(e,t,r){_(e,t,!1)&&m(e,t,r,"notDeepEqual",l.notDeepEqual)},l.notDeepStrictEqual=function e(t,r,n){_(t,r,!0)&&m(t,r,n,"notDeepStrictEqual",e)},l.strictEqual=function(e,t,r){e!==t&&m(e,t,r,"===",l.strictEqual)},l.notStrictEqual=function(e,t,r){e===t&&m(e,t,r,"!==",l.notStrictEqual)},l.throws=function(e,t,r){w(!0,e,t,r)},l.doesNotThrow=function(e,t,r){w(!1,e,t,r)},l.ifError=function(e){if(e)throw e};var E=Object.keys||function(e){var t=[];for(var r in e)s.call(e,r)&&t.push(r);return t}}).call(this,r(26))},12:function(e,t,r){var n=r(44),i=r(45),o=r(46);e.exports=function(e,t){return n(e)||i(e,t)||o()}},13:function(e,t,r){"use strict";var n=r(6),i=r.n(n),o=r(1),s=r.n(o),a=r(2),u=r.n(a),c=r(0),f=r(4),l=r.n(f),h=r(3),p=r.n(h),d=r(22),y=r.n(d),m=r(5),g=r.n(m);
/**
 * Custom error type for handling Dish type errors.
 * i.e. where the Dish cannot be successfully translated between types
 *
 * @author n1474335 [n1474335@gmail.com]
 * @copyright Crown Copyright 2018
 * @license Apache-2.0
 */
var _=function(e){function t(){var e;s()(this,t);for(var r=arguments.length,n=new Array(r),i=0;i<r;i++)n[i]=arguments[i];return(e=l()(this,p()(t).call(this,...n))).type="DishError",Error.captureStackTrace&&Error.captureStackTrace(y()(e),t),e}return g()(t,e),t}(function(e){function t(){var t=Reflect.construct(e,Array.from(arguments));return Object.setPrototypeOf(t,Object.getPrototypeOf(this)),t}return t.prototype=Object.create(e.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),Object.setPrototypeOf?Object.setPrototypeOf(t,e):t.__proto__=e,t}(Error)),v=r(14),b=r.n(v),w=r(18),E=r(24),B=r.n(E),A=function(){function e(){s()(this,e)}return u()(e,null,[{key:"checkForValue",value:function(e){if(void 0===e)throw new Error("only use translation methods with .bind")}},{key:"toArrayBuffer",value:function(){throw new Error("toArrayBuffer has not been implemented")}},{key:"fromArrayBuffer",value:function(){arguments.length>0&&void 0!==arguments[0]&&arguments[0];throw new Error("fromArrayBuffer has not been implemented")}}]),e}(),S=function(e){function t(){return s()(this,t),l()(this,p()(t).apply(this,arguments))}return g()(t,e),u()(t,null,[{key:"toArrayBuffer",value:function(){t.checkForValue(this.value),this.value=new Uint8Array(this.value).buffer}},{key:"fromArrayBuffer",value:function(){t.checkForValue(this.value),this.value=Array.prototype.slice.call(new Uint8Array(this.value))}}]),t}(A),x=function(e){function t(){return s()(this,t),l()(this,p()(t).apply(this,arguments))}return g()(t,e),u()(t,null,[{key:"toArrayBuffer",value:function(){t.checkForValue(this.value),this.value=b.a.isBigNumber(this.value)?c.b.strToArrayBuffer(this.value.toFixed()):new ArrayBuffer}},{key:"fromArrayBuffer",value:function(e){t.checkForValue(this.value);try{this.value=new b.a(c.b.arrayBufferToStr(this.value,!e))}catch(e){this.value=new b.a(NaN)}}}]),t}(A),T=function(e){function t(){return s()(this,t),l()(this,p()(t).apply(this,arguments))}return g()(t,e),u()(t,null,[{key:"toArrayBuffer",value:function(){var e=this;if(t.checkForValue(this.value),!Object(c.c)())return new Promise((function(t,r){c.b.readFile(e.value).then((function(t){return e.value=t.buffer})).then(t).catch(r)}));this.value=c.b.readFileSync(this.value)}},{key:"fromArrayBuffer",value:function(){t.checkForValue(this.value),this.value=new File(this.value,"unknown")}}]),t}(A),N=function(e){function t(){return s()(this,t),l()(this,p()(t).apply(this,arguments))}return g()(t,e),u()(t,null,[{key:"toArrayBuffer",value:function(){t.checkForValue(this.value),this.value=this.value?c.b.strToArrayBuffer(this.value):new ArrayBuffer}},{key:"fromArrayBuffer",value:function(e){t.checkForValue(this.value),this.value=this.value?c.b.arrayBufferToStr(this.value,!e):""}}]),t}(A),O=function(e){function t(){return s()(this,t),l()(this,p()(t).apply(this,arguments))}return g()(t,e),u()(t,null,[{key:"toArrayBuffer",value:function(){t.checkForValue(this.value),this.value=this.value?c.b.strToArrayBuffer(c.b.unescapeHtml(c.b.stripHtmlTags(this.value,!0))):new ArrayBuffer}}]),t}(N),k=function(e){function t(){return s()(this,t),l()(this,p()(t).apply(this,arguments))}return g()(t,e),u()(t,null,[{key:"toArrayBuffer",value:function(){t.checkForValue(this.value),this.value=this.value?c.b.strToArrayBuffer(JSON.stringify(this.value,null,4)):new ArrayBuffer}},{key:"fromArrayBuffer",value:function(e){t.checkForValue(this.value),this.value=JSON.parse(c.b.arrayBufferToStr(this.value,!e))}}]),t}(A),I=function(e){function t(){return s()(this,t),l()(this,p()(t).apply(this,arguments))}return g()(t,e),u()(t,null,[{key:"toArrayBuffer",value:function(){return i.a.async((function(e){for(;;)switch(e.prev=e.next){case 0:if(t.checkForValue(this.value),!Object(c.c)()){e.next=5;break}this.value=this.value.map((function(e){return Uint8Array.from(e.data)})),e.next=8;break;case 5:return e.next=7,i.a.awrap(t.concatenateTypedArraysWithTypedElements(...this.value));case 7:this.value=e.sent;case 8:case"end":return e.stop()}}),null,this)}},{key:"fromArrayBuffer",value:function(){t.checkForValue(this.value),this.value=[new File(this.value,"unknown")]}},{key:"concatenateTypedArraysWithTypedElements",value:function(){var e,t,r,n,o,s,a,u,f,l,h,p,d,y=arguments;return i.a.async((function(m){for(;;)switch(m.prev=m.next){case 0:for(e=0,t=y.length,r=new Array(t),n=0;n<t;n++)r[n]=y[n];for(o=0,s=r;o<s.length;o++)a=s[o],e+=a.size;u=new Uint8Array(e),f=0,l=0,h=r;case 6:if(!(l<h.length)){m.next=16;break}return p=h[l],m.next=10,i.a.awrap(c.b.readFile(p));case 10:d=m.sent,u.set(d,f),f+=d.length;case 13:l++,m.next=6;break;case 16:return m.abrupt("return",u);case 17:case"end":return m.stop()}}))}},{key:"concatenateTypedArrays",value:function(){for(var e=0,t=arguments.length,r=new Array(t),n=0;n<t;n++)r[n]=arguments[n];for(var i=0,o=r;i<o.length;i++){var s=o[i];e+=s.length}for(var a=new Uint8Array(e),u=0,c=0,f=r;c<f.length;c++){var l=f[c];a.set(l,u),u+=l.length}return a}}]),t}(A),F=function(e){function t(){return s()(this,t),l()(this,p()(t).apply(this,arguments))}return g()(t,e),u()(t,null,[{key:"toArrayBuffer",value:function(){t.checkForValue(this.value),this.value="number"==typeof this.value?c.b.strToArrayBuffer(this.value.toString()):new ArrayBuffer}},{key:"fromArrayBuffer",value:function(e){t.checkForValue(this.value),this.value=this.value?parseFloat(c.b.arrayBufferToStr(this.value,!e)):0}}]),t}(A),D=function(){function e(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:null,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null;if(s()(this,e),this.value=new ArrayBuffer(0),this.type=e.ARRAY_BUFFER,t&&Object.prototype.hasOwnProperty.call(t,"value")&&Object.prototype.hasOwnProperty.call(t,"type"))this.set(t.value,t.type);else if(t&&null!==r)this.set(t,r);else if(t){var n=e.typeEnum(t.constructor.name);this.set(t,n)}}return u()(e,[{key:"get",value:function(t){var r=this,n=arguments.length>1&&void 0!==arguments[1]&&arguments[1];return"string"==typeof t&&(t=e.typeEnum(t)),this.type!==t?Object(c.c)()?(this._translate(t,n),this.value):new Promise((function(e,i){r._translate(t,n).then((function(){e(r.value)})).catch(i)})):this.value}},{key:"set",value:function(t,r){if("string"==typeof r&&(r=e.typeEnum(r)),B.a.debug("Dish type: "+e.enumLookup(r)),this.value=t,this.type=r,!this.valid()){var n=c.b.truncate(JSON.stringify(this.value),25);throw new _(`Data is not a valid ${e.enumLookup(r)}: ${n}`)}}},{key:"presentAs",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]&&arguments[1],r=this.clone();return r.get(e,t)}},{key:"detectDishType",value:function(){var e=new Uint8Array(this.value.slice(0,2048)),t=Object(w.a)(e);return t.length&&t[0].mime&&"text/plain"!==!t[0].mime?t[0].mime:null}},{key:"getTitle",value:function(t){var r,n;return i.a.async((function(o){for(;;)switch(o.prev=o.next){case 0:r="",o.t0=this.type,o.next=o.t0===e.FILE?4:o.t0===e.LIST_FILE?6:o.t0===e.JSON?8:o.t0===e.NUMBER?10:o.t0===e.BIG_NUMBER?10:o.t0===e.ARRAY_BUFFER?12:o.t0===e.BYTE_ARRAY?12:15;break;case 4:return r=this.value.name,o.abrupt("break",26);case 6:return r=`${this.value.length} file(s)`,o.abrupt("break",26);case 8:return r="application/json",o.abrupt("break",26);case 10:return r=this.value.toString(),o.abrupt("break",26);case 12:if(null===(r=this.detectDishType())){o.next=15;break}return o.abrupt("break",26);case 15:return o.prev=15,(n=this.clone()).value=n.value.slice(0,256),o.next=20,i.a.awrap(n.get(e.STRING));case 20:r=o.sent,o.next=26;break;case 23:o.prev=23,o.t1=o.catch(15),B.a.error(`${e.enumLookup(this.type)} cannot be sliced. ${o.t1}`);case 26:return o.abrupt("return",r.slice(0,t));case 27:case"end":return o.stop()}}),null,this,[[15,23]])}},{key:"valid",value:function(){switch(this.type){case e.BYTE_ARRAY:if(!(this.value instanceof Uint8Array||this.value instanceof Array))return!1;for(var t=0;t<this.value.length;t++)if("number"!=typeof this.value[t]||this.value[t]<0||this.value[t]>255)return!1;return!0;case e.STRING:case e.HTML:return"string"==typeof this.value;case e.NUMBER:return"number"==typeof this.value;case e.ARRAY_BUFFER:return this.value instanceof ArrayBuffer;case e.BIG_NUMBER:if(b.a.isBigNumber(this.value))return!0;if(Object.keys(this.value).sort().equals(["c","e","s"])){var r=new b.a;return r.c=this.value.c,r.e=this.value.e,r.s=this.value.s,this.value=r,!0}return!1;case e.JSON:return!0;case e.FILE:return this.value instanceof File;case e.LIST_FILE:return this.value instanceof Array&&this.value.reduce((function(e,t){return e&&t instanceof File}),!0);default:return!1}}},{key:"clone",value:function(){var t=new e;switch(this.type){case e.STRING:case e.HTML:case e.NUMBER:case e.BIG_NUMBER:t.set(this.value,this.type);break;case e.BYTE_ARRAY:case e.JSON:t.set(JSON.parse(JSON.stringify(this.value)),this.type);break;case e.ARRAY_BUFFER:t.set(this.value.slice(0),this.type);break;case e.FILE:t.set(new File([this.value],this.value.name,{type:this.value.type,lastModified:this.value.lastModified}),this.type);break;case e.LIST_FILE:t.set(this.value.map((function(e){return new File([e],e.name,{type:e.type,lastModified:e.lastModified})})),this.type);break;default:throw new _("Cannot clone Dish, unknown type")}return t}},{key:"_translate",value:function(t){var r=this,n=arguments.length>1&&void 0!==arguments[1]&&arguments[1];if(B.a.debug(`Translating Dish from ${e.enumLookup(this.type)} to ${e.enumLookup(t)}`),!Object(c.c)())return new Promise((function(n,i){r._toArrayBuffer().then((function(){return r.type=e.ARRAY_BUFFER})).then((function(){r._fromArrayBuffer(t),n()})).catch(i)}));this._toArrayBuffer(),this.type=e.ARRAY_BUFFER,this._fromArrayBuffer(t,n)}},{key:"_toArrayBuffer",value:function(){var t=this,r={browser:{[e.STRING]:function(){return Promise.resolve(N.toArrayBuffer.bind(t)())},[e.NUMBER]:function(){return Promise.resolve(F.toArrayBuffer.bind(t)())},[e.HTML]:function(){return Promise.resolve(O.toArrayBuffer.bind(t)())},[e.ARRAY_BUFFER]:function(){return Promise.resolve()},[e.BIG_NUMBER]:function(){return Promise.resolve(x.toArrayBuffer.bind(t)())},[e.JSON]:function(){return Promise.resolve(k.toArrayBuffer.bind(t)())},[e.FILE]:function(){return T.toArrayBuffer.bind(t)()},[e.LIST_FILE]:function(){return Promise.resolve(I.toArrayBuffer.bind(t)())},[e.BYTE_ARRAY]:function(){return Promise.resolve(S.toArrayBuffer.bind(t)())}},node:{[e.STRING]:function(){return N.toArrayBuffer.bind(t)()},[e.NUMBER]:function(){return F.toArrayBuffer.bind(t)()},[e.HTML]:function(){return O.toArrayBuffer.bind(t)()},[e.ARRAY_BUFFER]:function(){},[e.BIG_NUMBER]:function(){return x.toArrayBuffer.bind(t)()},[e.JSON]:function(){return k.toArrayBuffer.bind(t)()},[e.FILE]:function(){return T.toArrayBuffer.bind(t)()},[e.LIST_FILE]:function(){return I.toArrayBuffer.bind(t)()},[e.BYTE_ARRAY]:function(){return S.toArrayBuffer.bind(t)()}}};try{return r[Object(c.c)()?"node":"browser"][this.type]()}catch(t){throw new _(`Error translating from ${e.enumLookup(this.type)} to ArrayBuffer: ${t}`)}}},{key:"_fromArrayBuffer",value:function(t,r){var n=this,i={[e.STRING]:function(){return N.fromArrayBuffer.bind(n)(r)},[e.NUMBER]:function(){return F.fromArrayBuffer.bind(n)(r)},[e.HTML]:function(){return O.fromArrayBuffer.bind(n)(r)},[e.ARRAY_BUFFER]:function(){},[e.BIG_NUMBER]:function(){return x.fromArrayBuffer.bind(n)(r)},[e.JSON]:function(){return k.fromArrayBuffer.bind(n)(r)},[e.FILE]:function(){return T.fromArrayBuffer.bind(n)()},[e.LIST_FILE]:function(){return I.fromArrayBuffer.bind(n)()},[e.BYTE_ARRAY]:function(){return S.fromArrayBuffer.bind(n)()}};try{i[t](),this.type=t}catch(r){throw new _(`Error translating from ArrayBuffer to ${e.enumLookup(t)}: ${r}`)}}},{key:"size",get:function(){switch(this.type){case e.BYTE_ARRAY:case e.STRING:case e.HTML:return this.value.length;case e.NUMBER:case e.BIG_NUMBER:return this.value.toString().length;case e.ARRAY_BUFFER:return this.value.byteLength;case e.JSON:return JSON.stringify(this.value).length;case e.FILE:return this.value.size;case e.LIST_FILE:return this.value.reduce((function(e,t){return e+t.size}),0);default:return-1}}}],[{key:"typeEnum",value:function(t){switch(t.toLowerCase()){case"bytearray":case"byte array":return e.BYTE_ARRAY;case"string":return e.STRING;case"number":return e.NUMBER;case"html":return e.HTML;case"arraybuffer":case"array buffer":return e.ARRAY_BUFFER;case"bignumber":case"big number":return e.BIG_NUMBER;case"json":case"object":return e.JSON;case"file":return e.FILE;case"list<file>":return e.LIST_FILE;default:throw new _("Invalid data type string. No matching enum.")}}},{key:"enumLookup",value:function(t){switch(t){case e.BYTE_ARRAY:return"byteArray";case e.STRING:return"string";case e.NUMBER:return"number";case e.HTML:return"html";case e.ARRAY_BUFFER:return"ArrayBuffer";case e.BIG_NUMBER:return"BigNumber";case e.JSON:return"JSON";case e.FILE:return"File";case e.LIST_FILE:return"List<File>";default:throw new _("Invalid data type enum. No matching type.")}}}]),e}();D.BYTE_ARRAY=0,D.STRING=1,D.NUMBER=2,D.HTML=3,D.ARRAY_BUFFER=4,D.BIG_NUMBER=5,D.JSON=6,D.FILE=7,D.LIST_FILE=8;t.a=D},1382:function(e,t,r){"use strict";var n=r(1383),i=r(1385),o=r(1386),s=r(243);e.exports={Service:i.Service,assembleProtocol:o.assembleProtocol,discoverProtocol:i.discoverProtocol,parse:function(e,t){var r=o.read(e);return r.protocol?i.Service.forProtocol(r,t):n.Type.forSchema(r,t)},readProtocol:o.readProtocol,readSchema:o.readSchema},s.copyOwnProperties(n,e.exports)},1383:function(e,t,r){"use strict";var n=r(484);e.exports={Type:n.Type,parse:function(e,t){var r;if("string"==typeof e)try{r=JSON.parse(e)}catch(t){r=e}else r=e;return n.Type.forSchema(r,t)},types:n.builtins,combine:n.Type.forTypes,infer:n.Type.forValue}},1384:function(e,t,r){"use strict";(function(t){function r(){this.data=void 0}function n(e,t){var r=e[0],n=e[1],i=e[2],c=e[3];r=o(r,n,i,c,t[0],7,-680876936),c=o(c,r,n,i,t[1],12,-389564586),i=o(i,c,r,n,t[2],17,606105819),n=o(n,i,c,r,t[3],22,-1044525330),r=o(r,n,i,c,t[4],7,-176418897),c=o(c,r,n,i,t[5],12,1200080426),i=o(i,c,r,n,t[6],17,-1473231341),n=o(n,i,c,r,t[7],22,-45705983),r=o(r,n,i,c,t[8],7,1770035416),c=o(c,r,n,i,t[9],12,-1958414417),i=o(i,c,r,n,t[10],17,-42063),n=o(n,i,c,r,t[11],22,-1990404162),r=o(r,n,i,c,t[12],7,1804603682),c=o(c,r,n,i,t[13],12,-40341101),i=o(i,c,r,n,t[14],17,-1502002290),r=s(r,n=o(n,i,c,r,t[15],22,1236535329),i,c,t[1],5,-165796510),c=s(c,r,n,i,t[6],9,-1069501632),i=s(i,c,r,n,t[11],14,643717713),n=s(n,i,c,r,t[0],20,-373897302),r=s(r,n,i,c,t[5],5,-701558691),c=s(c,r,n,i,t[10],9,38016083),i=s(i,c,r,n,t[15],14,-660478335),n=s(n,i,c,r,t[4],20,-405537848),r=s(r,n,i,c,t[9],5,568446438),c=s(c,r,n,i,t[14],9,-1019803690),i=s(i,c,r,n,t[3],14,-187363961),n=s(n,i,c,r,t[8],20,1163531501),r=s(r,n,i,c,t[13],5,-1444681467),c=s(c,r,n,i,t[2],9,-51403784),i=s(i,c,r,n,t[7],14,1735328473),r=a(r,n=s(n,i,c,r,t[12],20,-1926607734),i,c,t[5],4,-378558),c=a(c,r,n,i,t[8],11,-2022574463),i=a(i,c,r,n,t[11],16,1839030562),n=a(n,i,c,r,t[14],23,-35309556),r=a(r,n,i,c,t[1],4,-1530992060),c=a(c,r,n,i,t[4],11,1272893353),i=a(i,c,r,n,t[7],16,-155497632),n=a(n,i,c,r,t[10],23,-1094730640),r=a(r,n,i,c,t[13],4,681279174),c=a(c,r,n,i,t[0],11,-358537222),i=a(i,c,r,n,t[3],16,-722521979),n=a(n,i,c,r,t[6],23,76029189),r=a(r,n,i,c,t[9],4,-640364487),c=a(c,r,n,i,t[12],11,-421815835),i=a(i,c,r,n,t[15],16,530742520),r=u(r,n=a(n,i,c,r,t[2],23,-995338651),i,c,t[0],6,-198630844),c=u(c,r,n,i,t[7],10,1126891415),i=u(i,c,r,n,t[14],15,-1416354905),n=u(n,i,c,r,t[5],21,-57434055),r=u(r,n,i,c,t[12],6,1700485571),c=u(c,r,n,i,t[3],10,-1894986606),i=u(i,c,r,n,t[10],15,-1051523),n=u(n,i,c,r,t[1],21,-2054922799),r=u(r,n,i,c,t[8],6,1873313359),c=u(c,r,n,i,t[15],10,-30611744),i=u(i,c,r,n,t[6],15,-1560198380),n=u(n,i,c,r,t[13],21,1309151649),r=u(r,n,i,c,t[4],6,-145523070),c=u(c,r,n,i,t[11],10,-1120210379),i=u(i,c,r,n,t[2],15,718787259),n=u(n,i,c,r,t[9],21,-343485551),e[0]=f(r,e[0]),e[1]=f(n,e[1]),e[2]=f(i,e[2]),e[3]=f(c,e[3])}function i(e,t,r,n,i,o){return t=f(f(t,e),f(n,o)),f(t<<i|t>>>32-i,r)}function o(e,t,r,n,o,s,a){return i(t&r|~t&n,e,t,o,s,a)}function s(e,t,r,n,o,s,a){return i(t&n|r&~n,e,t,o,s,a)}function a(e,t,r,n,o,s,a){return i(t^r^n,e,t,o,s,a)}function u(e,t,r,n,o,s,a){return i(r^(t|~n),e,t,o,s,a)}function c(e){var t,r=[];for(t=0;t<64;t+=4)r[t>>2]=e.charCodeAt(t)+(e.charCodeAt(t+1)<<8)+(e.charCodeAt(t+2)<<16)+(e.charCodeAt(t+3)<<24);return r}function f(e,t){return e+t&4294967295}r.prototype.end=function(e){this.data=e},r.prototype.read=function(){return function(e){var r,i=function(e){var t,r=e.length,i=[1732584193,-271733879,-1732584194,271733878];for(t=64;t<=e.length;t+=64)n(i,c(e.substring(t-64,t)));e=e.substring(t-64);var o=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0];for(t=0;t<e.length;t++)o[t>>2]|=e.charCodeAt(t)<<(t%4<<3);if(o[t>>2]|=128<<(t%4<<3),t>55)for(n(i,o),t=0;t<16;t++)o[t]=0;return o[14]=8*r,n(i,o),i}(e),o=t.alloc?t.alloc(16):new t(16);for(r=0;r<4;r++)o.writeIntLE(i[r],4*r,4);return o}(this.data)},e.exports={createHash:function(e){if("md5"!==e)throw new Error("only md5 is supported in the browser");return new r}}}).call(this,r(11).Buffer)},1385:function(e,t,r){"use strict";(function(t,n){var i=r(484),o=r(243),s=r(74),a=r(68),u=r(64),c=o.Tap,f=i.Type,l=u.debuglog("avsc:services"),h=u.format,p={namespace:"org.apache.avro.ipc"},d=f.forSchema("boolean",p),y=f.forSchema({type:"map",values:"bytes"},p),m=f.forSchema("string",p),g=f.forSchema({name:"HandshakeRequest",type:"record",fields:[{name:"clientHash",type:{name:"MD5",type:"fixed",size:16}},{name:"clientProtocol",type:["null","string"],default:null},{name:"serverHash",type:"MD5"},{name:"meta",type:["null",y],default:null}]},p),_=f.forSchema({name:"HandshakeResponse",type:"record",fields:[{name:"match",type:{name:"HandshakeMatch",type:"enum",symbols:["BOTH","CLIENT","NONE"]}},{name:"serverProtocol",type:["null","string"],default:null},{name:"serverHash",type:["null","MD5"],default:null},{name:"meta",type:["null",y],default:null}]},p),v=16,b=new w("",f.forSchema({name:"PingRequest",type:"record",fields:[]},p),f.forSchema(["string"],p),f.forSchema("null",p));function w(e,t,r,n,i,o){if(this.name=e,!f.isType(t,"record"))throw new Error("invalid request type");if(this.requestType=t,!f.isType(r,"union")||!f.isType(r.getTypes()[0],"string"))throw new Error("invalid error type");if(this.errorType=r,i&&(!f.isType(n,"null")||r.getTypes().length>1))throw new Error("inapplicable one-way parameter");this.responseType=n,this.oneWay=!!i,this.doc=void 0!==o?""+o:void 0,Object.freeze(this)}function E(e,t,r,n,i){if("string"!=typeof e)return E.forProtocol(e,t);this.name=e,this._messagesByName=t||{},this.messages=Object.freeze(o.objectValues(this._messagesByName)),this._typesByName=r||{},this.types=Object.freeze(o.objectValues(this._typesByName)),this.protocol=n,this._hashStr=o.getHash(JSON.stringify(n)).toString("binary"),this.doc=n.doc?""+n.doc:void 0,this._server=i||this.createServer({silent:!0}),Object.freeze(this)}function B(e,t){t=t||{},s.EventEmitter.call(this),this._svc$=e,this._channels$=[],this._fns$=[],this._buffering$=!!t.buffering,this._cache$=t.cache||{},this._policy$=t.channelPolicy,this._strict$=!!t.strictTypes,this._timeout$=o.getOption(t,"timeout",1e4),t.remoteProtocols&&H(this._cache$,t.remoteProtocols,e,!0),this._svc$.messages.forEach((function(e){this[e.name]=this._createMessageHandler$(e)}),this)}function A(e,t){t=t||{},s.EventEmitter.call(this),this.service=e,this._handlers={},this._fns=[],this._channels={},this._nextChannelId=1,this._cache=t.cache||{},this._defaultHandler=t.defaultHandler,this._sysErrFormatter=t.systemErrorFormatter,this._silent=!!t.silent,this._strict=!!t.strictTypes,t.remoteProtocols&&H(this._cache,t.remoteProtocols,e,!1),e.messages.forEach((function(e){var r=e.name;t.noCapitalize||(r=o.capitalize(r)),this["on"+r]=this._createMessageHandler(e)}),this)}function S(e,t){t=t||{},s.EventEmitter.call(this),this.client=e,this.timeout=o.getOption(t,"timeout",e._timeout$),this._endWritable=!!o.getOption(t,"endWritable",!0),this._prefix=W(t.scope);var r=e._cache$,n=e._svc$,i=t.serverHash;i||(i=n.hash);var a=r[i];a||(a=r[i=n.hash]=new C(n,n,i)),this._adapter=a,this._registry=new R(this,v),this.pending=0,this.destroyed=!1,this.draining=!1,this.once("_eot",(function(e,t){l("client channel EOT"),this.destroyed=!0,this.emit("eot",e,t)}))}function x(e,t,r){S.call(this,e,r),this._writableFactory=t,r&&r.noPing||(l("emitting ping request"),this.ping())}function T(e,r,i,s){S.call(this,e,s),this._readable=r,this._writable=i,this._connected=!(!s||!s.noPing),this._readable.on("end",d),this._writable.on("finish",y);var a,u=this,c=null;function f(e){if(!u.destroyed){a=u._createHandshakeRequest(u._adapter,!e);var t=[g.toBuffer(a),o.bufferFrom([0,0])];u._writable.write({id:u._prefix,payload:t})}}function h(e){if(u._matchesPrefix(e.id)){var r=n.concat(e.payload);try{var i=z(_,r).head;i.serverHash&&(u._adapter=u._getAdapter(i))}catch(e){return void u.destroy(e)}var o=i.match;l("handshake match: %s",o),u.emit("handshake",a,i),"NONE"===o?t.nextTick((function(){f(!0)})):(l("successfully connected"),c&&(clearTimeout(c),c=null),u._readable.removeListener("data",h).on("data",p),u._connected=!0,u.emit("_ready"),a=null)}else l("discarding unscoped response %s (still connecting)",e.id)}function p(e){var r=e.id;if(u._matchesPrefix(r)){var i=u._registry.get(r);i&&t.nextTick((function(){l("received message %s",r),i(null,n.concat(e.payload),u._adapter)}))}else l("discarding unscoped message %s",r)}function d(){u.destroy(!0)}function y(){u.destroy()}this.once("eot",(function(){c&&(clearTimeout(c),c=null),u._connected||u.emit("_ready"),this._writable.removeListener("finish",y),this._endWritable&&(l("ending transport"),this._writable.end()),this._readable.removeListener("data",h).removeListener("data",p).removeListener("end",d)})),this._connected?this._readable.on("data",p):(this._readable.on("data",h),t.nextTick(f),u.timeout&&(c=setTimeout((function(){u.destroy(new Error("timeout"))}),u.timeout)))}function N(e,t){t=t||{},s.EventEmitter.call(this),this.server=e,this._endWritable=!!o.getOption(t,"endWritable",!0),this._prefix=W(t.scope);var r=e._cache,n=e.service,i=n.hash;r[i]||(r[i]=new C(n,n,i)),this._adapter=null,this.destroyed=!1,this.draining=!1,this.pending=0,this.once("_eot",(function(e,t){l("server channel EOT"),this.emit("eot",e,t)}))}function O(e,r,i){N.call(this,e,i),this._writable=void 0;var o,s=this;function a(e){var t,r=e.id,i=n.concat(e.payload);try{var o=z(g,i),a=o.head,u=s._getAdapter(a)}catch(e){t=J("INVALID_HANDSHAKE_REQUEST",e)}var c=s._createHandshakeResponse(t,a);function f(e){if(!s.destroyed){if(!s._writable)return void s.once("_writable",(function(){f(e)}));s._writable.write({id:r,payload:[_.toBuffer(c),e]})}s._writable&&s._endWritable&&s._writable.end()}s.emit("handshake",a,c),t?f(s._encodeSystemError(t)):s._receive(o.tail,u,f)}function u(){s.destroy()}function c(e){o.removeListener("data",a).removeListener("end",u),s.destroy(e||!0)}t.nextTick((function(){o=r.call(s,(function(e,r){t.nextTick((function(){e?c(e):(s._writable=r.on("finish",c),s.emit("_writable"))}))})).on("data",a).on("end",u)}))}function k(e,t,r,i){N.call(this,e,i),this._adapter=void 0,this._writable=r.on("finish",c),this._readable=t.on("data",s).on("end",u),this.once("_drain",(function(){this._readable.removeListener("data",s).removeListener("data",a).removeListener("end",u)})).once("eot",(function(){this._writable.removeListener("finish",c),this._endWritable&&this._writable.end()}));var o=this;function s(e){var t=e.id;if(o._matchesPrefix(t)){var r,i=n.concat(e.payload);try{var u=z(g,i),c=u.head;o._adapter=o._getAdapter(c)}catch(e){r=J("INVALID_HANDSHAKE_REQUEST",e)}var f=o._createHandshakeResponse(r,c);o.emit("handshake",c,f),r?l(o._encodeSystemError(r)):(o._readable.removeListener("data",s).on("data",a),o._receive(u.tail,o._adapter,l))}function l(e){o.destroyed||o._writable.write({id:t,payload:[_.toBuffer(f),e]})}}function a(e){var t=e.id;if(o._matchesPrefix(t)){var r=n.concat(e.payload);o._receive(r,o._adapter,(function(e,r){o.destroyed||r||o._writable.write({id:t,payload:[e]})}))}}function u(){o.destroy()}function c(){o.destroy(!0)}}function I(e,t,r){this._msg=e,this.headers=t||{},this.request=r||{}}function F(e,t,r,n){this._msg=e,this.headers=t,this.error=r,this.response=n}function D(e,t){this.channel=t,this.locals={},this.message=e,Object.freeze(this)}function R(e,t){this._ctx=e,this._mask=-1>>>(0|t),this._id=0,this._n=0,this._cbs={}}function C(e,t,r,n){this._clientSvc=e,this._serverSvc=t,this._hash=r,this._isRemote=!!n,this._readers=Y(e,t)}function L(){a.Transform.call(this,{readableObjectMode:!0}),this._id=void 0,this._buf=o.newBuffer(0),this._bufs=[],this.on("finish",(function(){this.push(null)}))}function P(){a.Transform.call(this,{writableObjectMode:!0}),this.on("finish",(function(){this.push(null)}))}function j(){a.Transform.call(this,{readableObjectMode:!0}),this._id=void 0,this._frameCount=0,this._buf=o.newBuffer(0),this._bufs=[],this.on("finish",(function(){this.push(null)}))}function M(){a.Transform.call(this,{writableObjectMode:!0}),this.on("finish",(function(){this.push(null)}))}function U(e){var t=o.newBuffer(4);return t.writeInt32BE(e),t}function z(e,t){var r=new c(t),n=e._read(r);if(!r.isValid())throw new Error(h("truncated %j",e.schema()));return{head:n,tail:r.buf.slice(r.pos)}}function $(e,t){return e.equals(t)?e:e.createResolver(t)}function Y(e,t){var r={};return e.messages.forEach((function(e){var n=e.name,i=t.message(n);try{if(!i)throw new Error(h("missing server message: %s",n));if(i.oneWay!==e.oneWay)throw new Error(h("inconsistent one-way message: %s",n));r[n+"?"]=$(i.requestType,e.requestType),r[n+"*"]=$(e.errorType,i.errorType),r[n+"!"]=$(e.responseType,i.responseType)}catch(e){throw J("INCOMPATIBLE_PROTOCOL",e)}})),r}function H(e,t,r,n){Object.keys(t).forEach((function(i){var o,s,a=t[i];n?(o=r,s=E.forProtocol(a)):(o=E.forProtocol(a),s=r),e[i]=new C(o,s,i,!0)}))}function q(e,t){var r={};return Object.keys(e).forEach((function(n){var i=e[n];if(i._isRemote){var o=t?i._serverSvc:i._clientSvc;r[n]=o.protocol}})),r}function Z(e){return!!e&&"[object Error]"===Object.prototype.toString.call(e)}function V(e,t){var r=new Error(e);return r.cause=t,r}function J(e,t){var r=V(e.toLowerCase().replace(/_/g," "),t);return r.rpcCode=t&&t.rpcCode?t.rpcCode:e,r}function G(e,t,r){var n,i,o,s=[];for(n=0,i=r.length;n<i;n++)(o=r[n]).type.isValid(t[o.name],{errorHook:c});var a=s.map((function(e){return h("%s = %j but expected %s",e.path,e.value,e.type)})).join(", "),u=new Error(h("%s (%s)",e,a));return u.details=s,u;function c(e,t,r){var n,i,a,u=[];for(n=0,i=e.length;n<i;n++)a=e[n],isNaN(a)?u.push("."+a):u.push("["+a+"]");s.push({path:o.name+u.join(""),value:t,type:r})}}function W(e){return e?o.getHash(e).readInt16BE(0)<<32-v:0}function X(e,t){return(e^t)>>32-v==0}function K(e){return!(!e||!e.pipe)}function Q(e,t){var r=e.message(t);if(!r)throw new Error(h("unknown message: %s",t));return r}function ee(e){var r,n=[e.wreq,e.wres],i=[];function o(){var t=i.pop();if(t){var n=!1;t.call(e.ctx,r,(function(t){n?e.onError(V("duplicate backward middleware call",t)):(r=t,n=!0,o())}))}else e.onCompletion.call(e.ctx,r)}!function s(a){var u=!1;a<e.fns.length?e.fns[a].apply(e.ctx,n.concat((function(t,n){if(u)e.onError(V("duplicate forward middleware call",t));else{if(u=!0,t||e.wres&&(void 0!==e.wres.error||void 0!==e.wres.response))return r=t,void o();n&&i.push(n),s(++a)}}))):e.onTransition.apply(e.ctx,n.concat((function(n){u?e.onError(V("duplicate handler call",n)):(u=!0,r=n,t.nextTick(o))})))}(0)}w.forSchema=function(e,t,r){if(r=r||{},!i.isValidName(e))throw new Error(h("invalid message name: %s",e));if(!Array.isArray(t.request))throw new Error(h("invalid message request: %s",e));var n=h("%s.%sRequest",p.namespace,o.capitalize(e)),s=f.forSchema({name:n,type:"record",namespace:r.namespace||"",fields:t.request},r);if(delete r.registry[n],!t.response)throw new Error(h("invalid message response: %s",e));var a=f.forSchema(t.response,r);if(void 0!==t.errors&&!Array.isArray(t.errors))throw new Error(h("invalid message errors: %s",e));return new w(e,s,f.forSchema(["string"].concat(t.errors||[]),r),a,!!t["one-way"],t.doc)},w.prototype.schema=f.prototype.getSchema,w.prototype._attrs=function(e){var t={request:this.requestType._attrs(e).fields,response:this.responseType._attrs(e)},r=this.doc;void 0!==r&&(t.doc=r);var n=this.errorType._attrs(e);return n.length>1&&(t.errors=n.slice(1)),this.oneWay&&(t["one-way"]=!0),t},o.addDeprecatedGetters(w,["name","errorType","requestType","responseType"]),w.prototype.isOneWay=u.deprecate((function(){return this.oneWay}),"use `.oneWay` directly instead of `.isOneWay()`"),E.Client=B,E.Server=A,E.compatible=function(e,t){try{Y(e,t)}catch(e){return!1}return!0},E.forProtocol=function(e,t){t=t||{};var r,n=e.protocol;if(!n)throw new Error("missing protocol name");if(void 0!==e.namespace)t.namespace=e.namespace;else{var o=/^(.*)\.[^.]+$/.exec(n);o&&(t.namespace=o[1])}return n=i.qualify(n,t.namespace),e.types&&e.types.forEach((function(e){f.forSchema(e,t)})),e.messages&&(r={},Object.keys(e.messages).forEach((function(n){r[n]=w.forSchema(n,e.messages[n],t)}))),new E(n,r,t.registry,e)},E.isService=function(e){return!!e&&e.hasOwnProperty("_hashStr")},E.prototype.createClient=function(e){var r=new B(this,e);return t.nextTick((function(){if(e&&e.server){var t={objectMode:!0},n=[new a.PassThrough(t),new a.PassThrough(t)];e.server.createChannel({readable:n[0],writable:n[1]},t),r.createChannel({readable:n[1],writable:n[0]},t)}else e&&e.transport&&r.createChannel(e.transport)})),r},E.prototype.createServer=function(e){return new A(this,e)},Object.defineProperty(E.prototype,"hash",{enumerable:!0,get:function(){return o.bufferFrom(this._hashStr,"binary")}}),E.prototype.message=function(e){return this._messagesByName[e]},E.prototype.type=function(e){return this._typesByName[e]},E.prototype.inspect=function(){return h("<Service %j>",this.name)},o.addDeprecatedGetters(E,["message","messages","name","type","types"]),E.prototype.createEmitter=u.deprecate((function(e,t){t=t||{};var r,n,i=this.createClient({cache:t.cache,buffering:!1,strictTypes:t.strictErrors,timeout:t.timeout}),o=i.createChannel(e,t);return n=o,(r=i).on("error",(function(e){n.emit("error",e,r)})),o}),"use `.createClient()` instead of `.createEmitter()`"),E.prototype.createListener=u.deprecate((function(e,t){if(t&&t.strictErrors)throw new Error("use `.createServer()` to support strict errors");return this._server.createChannel(e,t)}),"use `.createServer().createChannel()` instead of `.createListener()`"),E.prototype.emit=u.deprecate((function(e,t,r,n){if(!r||!this.equals(r.client._svc$))throw new Error("invalid emitter");var i=r.client;return B.prototype.emitMessage.call(i,e,t,n&&n.bind(this)),r.getPending()}),"create a client via `.createClient()` to emit messages instead of `.emit()`"),E.prototype.equals=u.deprecate((function(e){return E.isService(e)&&this.getFingerprint().equals(e.getFingerprint())}),"equality testing is deprecated, compare the `.protocol`s instead"),E.prototype.getFingerprint=u.deprecate((function(e){return o.getHash(JSON.stringify(this.protocol),e)}),"use `.hash` instead of `.getFingerprint()`"),E.prototype.getSchema=u.deprecate(f.prototype.getSchema,"use `.protocol` instead of `.getSchema()`"),E.prototype.on=u.deprecate((function(e,t){var r=this;return this._server.onMessage(e,(function(e,n){return t.call(r,e,this.channel,n)})),this}),"use `.createServer().onMessage()` instead of `.on()`"),E.prototype.subprotocol=u.deprecate((function(){var e=this._server,t={strictTypes:e._strict,cache:e._cache},r=new A(e.service,t);return r._handlers=Object.create(e._handlers),new E(this.name,this._messagesByName,this._typesByName,this.protocol,r)}),"`.subprotocol()` will be removed in 5.1"),E.prototype._attrs=function(e){var t={protocol:this.name},r=[];this.types.forEach((function(t){if(void 0!==t.getName()){var n=t._attrs(e);"string"!=typeof n&&r.push(n)}})),r.length&&(t.types=r);var n=Object.keys(this._messagesByName);return n.length&&(t.messages={},n.forEach((function(r){t.messages[r]=this._messagesByName[r]._attrs(e)}),this)),e&&e.exportAttrs&&void 0!==this.doc&&(t.doc=this.doc),t},u.inherits(B,s.EventEmitter),B.prototype.activeChannels=function(){return this._channels$.slice()},B.prototype.createChannel=function(e,t){var r,n=t&&t.objectMode;if("function"==typeof e){var i;i=n?e:function(t){var n=new P,i=e((function(e,n){if(e)t(e);else{var i=(new L).once("error",(function(e){r.destroy(e)}));t(null,n.pipe(i))}}));if(i)return n.pipe(i),n},r=new x(this,i,t)}else{var o,s;if(K(e)?o=s=e:(o=e.readable,s=e.writable),!n){var a=new j;o=o.pipe(a);var u=new M;u.pipe(s),s=u}r=new T(this,o,s,t),n||(r.once("eot",(function(){o.unpipe(a),u.unpipe(s)})),a.once("error",(function(e){r.destroy(e)})))}var c=this._channels$;return c.push(r),r.once("_drain",(function(){c.splice(c.indexOf(this),1)})),this._buffering$=!1,this.emit("channel",r),r},B.prototype.destroyChannels=function(e){this._channels$.forEach((function(t){t.destroy(e&&e.noWait)}))},B.prototype.emitMessage=function(e,t,r,n){var i=new I(Q(this._svc$,e),{},t);this._emitMessage$(i,r,n)},B.prototype.remoteProtocols=function(){return q(this._cache$,!0)},Object.defineProperty(B.prototype,"service",{enumerable:!0,get:function(){return this._svc$}}),B.prototype.use=function(){var e,t,r;for(e=0,t=arguments.length;e<t;e++)r=arguments[e],this._fns$.push(r.length<3?r(this):r);return this},B.prototype._emitMessage$=function(e,r,n){n||"function"!=typeof r||(n=r,r=void 0);var i=this,o=this._channels$,s=o.length;if(s){var a;if(void 0===(r=r||{}).timeout&&(r.timeout=this._timeout$),1===s)a=o[0];else if(this._policy$){if(!(a=this._policy$(this._channels$.slice())))return void l("policy returned no channel, skipping call")}else a=o[Math.floor(Math.random()*s)];a._emit(e,r,(function(e,t){var r=this,o=r.message.errorType;if(e)return i._strict$&&(e=o.clone(e.message,{wrapUnions:!0})),void s(e);function s(e,t){n?n.call(r,e,t):e&&i.emit("error",e)}t?(e=t.error,i._strict$||(void 0===e?e=null:f.isType(o,"union:unwrapped")?"string"==typeof e&&(e=new Error(e)):e&&e.string&&"string"==typeof e.string&&(e=new Error(e.string))),s(e,t.response)):s()}))}else if(this._buffering$)l("no active client channels, buffering call"),this.once("channel",(function(){this._emitMessage$(e,r,n)}));else{var u=new Error("no active channels");t.nextTick((function(){n?n.call(new D(e._msg),u):i.emit("error",u)}))}},B.prototype._createMessageHandler$=function(e){var t=e.requestType.getFields().map((function(e){return e.getName()})),r="return function "+e.name+"(";return t.length&&(r+=t.join(", ")+", "),r+="opts, cb) {\n",r+="  var req = {",r+=t.map((function(e){return e+": "+e})).join(", "),r+="};\n",r+="  return this.emitMessage('"+e.name+"', req, opts, cb);\n",r+="};",new Function(r)()},u.inherits(A,s.EventEmitter),A.prototype.activeChannels=function(){return o.objectValues(this._channels)},A.prototype.createChannel=function(e,t){var r,n=t&&t.objectMode;if("function"==typeof e){var i;i=n?e:function(t){var n=(new L).once("error",(function(e){r.destroy(e)}));return e((function(e,r){if(e)t(e);else{var n=new P;n.pipe(r),t(null,n)}})).pipe(n)},r=new O(this,i,t)}else{var o,s;if(K(e)?o=s=e:(o=e.readable,s=e.writable),!n){var a=new j;o=o.pipe(a);var u=new M;u.pipe(s),s=u}r=new k(this,o,s,t),n||(r.once("eot",(function(){o.unpipe(a),u.unpipe(s)})),a.once("error",(function(e){r.destroy(e)})))}this.listeners("error").length||this.on("error",this._onError);var c=this._nextChannelId++,f=this._channels;return f[c]=r.once("eot",(function(){delete f[c]})),this.emit("channel",r),r},A.prototype.onMessage=function(e,t){return Q(this.service,e),this._handlers[e]=t,this},A.prototype.remoteProtocols=function(){return q(this._cache,!1)},A.prototype.use=function(){var e,t,r;for(e=0,t=arguments.length;e<t;e++)r=arguments[e],this._fns.push(r.length<3?r(this):r);return this},A.prototype._createMessageHandler=function(e){var t=e.name,r=e.requestType.fields,n=r.length,i=r.length?", "+r.map((function(e){return"req."+e.name})).join(", "):"",o="return function (handler) {\n";return o+="  if (handler.length > "+n+") {\n",o+="    return this.onMessage('"+t+"', function (req, cb) {\n",o+="      return handler.call(this"+i+", cb);\n",o+="    });\n",o+="  } else {\n",o+="    return this.onMessage('"+t+"', function (req) {\n",o+="      return handler.call(this"+i+");\n",o+="    });\n",o+="  }\n",o+="};\n",new Function(o)()},A.prototype._onError=function(e){this._silent||"UNKNOWN_PROTOCOL"===e.rpcCode||(console.error(),e.rpcCode?(console.error(e.rpcCode),console.error(e.cause)):(console.error("INTERNAL_SERVER_ERROR"),console.error(e)))},u.inherits(S,s.EventEmitter),S.prototype.destroy=function(e){l("destroying client channel"),this.draining||(this.draining=!0,this.emit("_drain"));var t=this._registry,r=this.pending;e&&t.clear(),e||!r?Z(e)?(l("fatal client channel error: %s",e),this.emit("_eot",r,e)):this.emit("_eot",r):l("client channel entering drain mode (%s pending)",r)},S.prototype.ping=function(e,t){t||"function"!=typeof e||(t=e,e=void 0);var r=this,n=new I(b);this._emit(n,{timeout:e},(function(e){t?t.call(r,e):e&&r.destroy(e)}))},S.prototype._createHandshakeRequest=function(e,t){var r=this.client._svc$;return{clientHash:r.hash,clientProtocol:t?null:JSON.stringify(r.protocol),serverHash:e._hash}},S.prototype._emit=function(e,r,n){var i=e._msg,o=i.oneWay?void 0:new F(i,{}),s=new D(i,this),a=this;function u(e,t,n){var o,s;if(a.destroyed)o=new Error("channel destroyed");else try{s=e.toBuffer()}catch(t){o=G(h("invalid %j request",i.name),e,[{name:"headers",type:y},{name:"request",type:i.requestType}])}if(o)n(o);else{var u=r&&void 0!==r.timeout?r.timeout:a.timeout,c=a._registry.add(u,(function(e,r,o){if(!e&&!i.oneWay)try{o._decodeResponse(r,t,i)}catch(t){e=t}n(e)}));c|=a._prefix,l("sending message %s",c),a._send(c,s,!!i&&i.oneWay)}}function c(e){a.pending--,n.call(s,e,o),!a.draining||a.destroyed||a.pending||a.destroy()}function f(e){a.client.emit("error",e,a)}this.pending++,t.nextTick((function(){if(i.name){a.emit("outgoingCall",s,r);var t=a.client._fns$;l("starting client middleware chain (%s middleware)",t.length),ee({fns:t,ctx:s,wreq:e,wres:o,onTransition:u,onCompletion:c,onError:f})}else u(e,o,c)}))},S.prototype._getAdapter=function(e){var t=e.serverHash,r=this.client._cache$,n=r[t];if(n)return n;var i=JSON.parse(e.serverProtocol),o=E.forProtocol(i);return n=new C(this.client._svc$,o,t,!0),r[t]=n},S.prototype._matchesPrefix=function(e){return X(e,this._prefix)},S.prototype._send=o.abstractFunction,o.addDeprecatedGetters(S,["pending","timeout"]),S.prototype.getCache=u.deprecate((function(){return this.client._cache$}),"use `.remoteProtocols()` instead of `.getCache()`"),S.prototype.getProtocol=u.deprecate((function(){return this.client._svc$}),"use `.service` instead or `.getProtocol()`"),S.prototype.isDestroyed=u.deprecate((function(){return this.destroyed}),"use `.destroyed` instead of `.isDestroyed`"),u.inherits(x,S),x.prototype._send=function(e,r){var i=this._registry.get(e),o=this._adapter,s=this;return t.nextTick((function a(u){if(s.destroyed)return;var c=s._createHandshakeRequest(o,!u),f=s._writableFactory.call(s,(function(e,r){e?i(e):r.on("data",(function(e){l("received response %s",e.id);var r=n.concat(e.payload);try{var u=z(_,r),f=u.head;f.serverHash&&(o=s._getAdapter(f))}catch(e){return void i(e)}var h=f.match;l("handshake match: %s",h),s.emit("handshake",c,f),"NONE"===h?t.nextTick((function(){a(!0)})):(s._adapter=o,i(null,u.tail,o))}))}));if(!f)return void i(new Error("invalid writable stream"));f.write({id:e,payload:[g.toBuffer(c),r]}),s._endWritable&&f.end()})),!0},u.inherits(T,S),T.prototype._emit=function(){if(this._connected||this.draining)S.prototype._emit.apply(this,arguments);else{l("queuing request");var e,t,r=[];for(e=0,t=arguments.length;e<t;e++)r.push(arguments[e]);this.once("_ready",(function(){this._emit.apply(this,r)}))}},T.prototype._send=function(e,r,n){if(n){var i=this;t.nextTick((function(){i._registry.get(e)(null,o.bufferFrom([0,0,0]),i._adapter)}))}return this._writable.write({id:e,payload:[r]})},u.inherits(N,s.EventEmitter),N.prototype.destroy=function(e){this.draining||(this.draining=!0,this.emit("_drain")),!e&&this.pending||(this.destroyed=!0,Z(e)?(l("fatal server channel error: %s",e),this.emit("_eot",this.pending,e)):this.emit("_eot",this.pending))},N.prototype._createHandshakeResponse=function(e,t){var r=this.server.service,n=r.hash,i=t&&t.serverHash.equals(n);return{match:e?"NONE":i?"BOTH":"CLIENT",serverProtocol:i?null:JSON.stringify(r.protocol),serverHash:i?null:n}},N.prototype._getAdapter=function(e){var t=e.clientHash,r=this.server._cache[t];if(r)return r;if(!e.clientProtocol)throw J("UNKNOWN_PROTOCOL");var n=JSON.parse(e.clientProtocol);return r=new C(E.forProtocol(n),this.server.service,t,!0),this.server._cache[t]=r},N.prototype._matchesPrefix=function(e){return X(e,this._prefix)},N.prototype._receive=function(e,t,r){var n,i=this;try{n=t._decodeRequest(e)}catch(e){return void r(i._encodeSystemError(J("INVALID_REQUEST",e)))}var o=n._msg,s=new F(o,{});if(!o.name)return s.response=null,void r(s.toBuffer(),!1);var a=new D(o,this);i.emit("incomingCall",a);var u=this.server._fns;function c(e){i.server.emit("error",e,i)}l("starting server middleware chain (%s middleware)",u.length),i.pending++,ee({fns:u,ctx:a,wreq:n,wres:s,onTransition:function(e,t,r){var n=i.server._handlers[o.name];if(n){var s=!o.oneWay;try{s?n.call(a,e.request,(function(e,n){s=!1,t.error=e,t.response=n,r()})):(n.call(a,e.request),r())}catch(e){s?(s=!1,r(e)):c(e)}}else{var u=i.server._defaultHandler;if(u)u.call(a,e,t,r);else{var f=new Error(h("no handler for %s",o.name));r(J("NOT_IMPLEMENTED",f))}}},onCompletion:function(e){i.pending--;var t,n=i.server;if(!e){var a=s.error;n._strict||(Z(a)?s.error=o.errorType.clone(a.message,{wrapUnions:!0}):null===a&&(a=s.error=void 0),void 0===a&&void 0===s.response&&o.responseType.isValid(null)&&(s.response=null));try{t=s.toBuffer()}catch(t){e=void 0!==s.error?G(h("invalid %j error",o.name),s,[{name:"headers",type:y},{name:"error",type:o.errorType}]):G(h("invalid %j response",o.name),s,[{name:"headers",type:y},{name:"response",type:o.responseType}])}}t?void 0!==a&&n.emit("error",J("APPLICATION_ERROR",a)):t=i._encodeSystemError(e,s.headers);r(t,o.oneWay),i.draining&&!i.pending&&i.destroy()},onError:c})},o.addDeprecatedGetters(N,["pending"]),N.prototype.getCache=u.deprecate((function(){return this.server._cache}),"use `.remoteProtocols()` instead of `.getCache()`"),N.prototype.getProtocol=u.deprecate((function(){return this.server.service}),"use `.service` instead of `.getProtocol()`"),N.prototype.isDestroyed=u.deprecate((function(){return this.destroyed}),"use `.destroyed` instead of `.isDestroyed`"),N.prototype._encodeSystemError=function(e,t){var r,i,s=this.server;if(s.emit("error",e,this),s._sysErrFormatter?r=s._sysErrFormatter.call(this,e):e.rpcCode&&(r=e.message),t)try{i=y.toBuffer(t)}catch(e){s.emit("error",e,this)}return n.concat([i||o.bufferFrom([0]),o.bufferFrom([1,0]),m.toBuffer(r||"internal server error")])},u.inherits(O,N),u.inherits(k,N),I.prototype.toBuffer=function(){var e=this._msg;return n.concat([y.toBuffer(this.headers),m.toBuffer(e.name),e.requestType.toBuffer(this.request)])},F.prototype.toBuffer=function(){var e=y.toBuffer(this.headers),t=void 0!==this.error;return n.concat([e,d.toBuffer(t),t?this._msg.errorType.toBuffer(this.error):this._msg.responseType.toBuffer(this.response)])},R.prototype.get=function(e){return this._cbs[e&this._mask]},R.prototype.add=function(e,t){this._id=this._id+1&this._mask;var r,n=this,i=this._id;return e>0&&(r=setTimeout((function(){o(new Error("timeout"))}),e)),this._cbs[i]=o,this._n++,i;function o(){n._cbs[i]&&(delete n._cbs[i],n._n--,r&&clearTimeout(r),t.apply(n._ctx,arguments))}},R.prototype.clear=function(){Object.keys(this._cbs).forEach((function(e){this._cbs[e](new Error("interrupted"))}),this)},C.prototype._decodeRequest=function(e){var t,r,n=new c(e),i=y._read(n),o=m._read(n);if(o?(t=this._serverSvc.message(o),r=this._readers[o+"?"]._read(n)):t=b,!n.isValid())throw new Error(h("truncated %s request",o||"ping$"));return new I(t,i,r)},C.prototype._decodeResponse=function(e,t,r){var n=new c(e);o.copyOwnProperties(y._read(n),t.headers,!0);var i=d._read(n),s=r.name;if(s){var a=this._readers[s+(i?"*":"!")];if(r=this._clientSvc.message(s),i?t.error=a._read(n):t.response=a._read(n),!n.isValid())throw new Error(h("truncated %s response",s))}else r=b},u.inherits(L,a.Transform),L.prototype._transform=function(e,t,r){var i;for(e=n.concat([this._buf,e]);e.length>=4&&e.length>=(i=e.readInt32BE(0))+4;){if(i)this._bufs.push(e.slice(4,i+4));else{var o=this._bufs;this._bufs=[],this.push({id:null,payload:o})}e=e.slice(i+4)}this._buf=e,r()},L.prototype._flush=function(){if(this._buf.length||this._bufs.length){var e=this._bufs.slice();e.unshift(this._buf);var t=J("TRAILING_DATA");t.trailingData=n.concat(e).toString(),this.emit("error",t)}},u.inherits(P,a.Transform),P.prototype._transform=function(e,t,r){var n,i,o,s=e.payload;for(n=0,i=s.length;n<i;n++)o=s[n],this.push(U(o.length)),this.push(o);this.push(U(0)),r()},u.inherits(j,a.Transform),j.prototype._transform=function(e,t,r){for(e=n.concat([this._buf,e]);;){if(void 0===this._id){if(e.length<8)return this._buf=e,void r();this._id=e.readInt32BE(0),this._frameCount=e.readInt32BE(4),e=e.slice(8)}for(var i;this._frameCount&&e.length>=4&&e.length>=(i=e.readInt32BE(0))+4;)this._frameCount--,this._bufs.push(e.slice(4,i+4)),e=e.slice(i+4);if(this._frameCount)return this._buf=e,void r();var o={id:this._id,payload:this._bufs};this._bufs=[],this._id=void 0,this.push(o)}},j.prototype._flush=L.prototype._flush,u.inherits(M,a.Transform),M.prototype._transform=function(e,t,r){var n,i,s=e.payload,a=s.length;for((n=o.newBuffer(8)).writeInt32BE(e.id,0),n.writeInt32BE(a,4),this.push(n),i=0;i<a;i++)n=s[i],this.push(U(n.length)),this.push(n);r()},e.exports={Adapter:C,HANDSHAKE_REQUEST_TYPE:g,HANDSHAKE_RESPONSE_TYPE:_,Message:w,Registry:R,Service:E,discoverProtocol:function(e,t,r){var n;void 0===r&&"function"==typeof t&&(r=t,t=void 0),new E({protocol:"Empty"},p).createClient({timeout:t&&t.timeout}).createChannel(e,{scope:t&&t.scope,endWritable:"function"==typeof e}).once("handshake",(function(e,t){n=t.serverProtocol,this.destroy(!0)})).once("eot",(function(e,t){t&&!/interrupted/.test(t)?r(t):r(null,JSON.parse(n))}))},streams:{FrameDecoder:L,FrameEncoder:P,NettyDecoder:j,NettyEncoder:M}}}).call(this,r(25),r(11).Buffer)},1386:function(e,t,r){"use strict";var n=r(1387),i=r(243),o=r(273),s=r(64).format,a={date:{type:"int",logicalType:"date"},decimal:{type:"bytes",logicalType:"decimal"},time_ms:{type:"long",logicalType:"time-millis"},timestamp_ms:{type:"long",logicalType:"timestamp-millis"}};function u(e,t,r){r||"function"!=typeof t||(r=t,t=void 0),(t=t||{}).importHook||(t.importHook=n.createImportHook());var i,a,f=[];function l(){var n=a.shift();if(n){var c=o.join(o.dirname(e),n.name);"idl"===n.kind?u(c,t,h):t.importHook(c,n.kind,(function(e,t){if(e)r(e);else switch(n.kind){case"protocol":case"schema":if(void 0===t)return void h(null,{});try{var i=JSON.parse(t)}catch(e){return e.path=c,void r(e)}h(null,"schema"===n.kind?{types:[i]}:i);break;default:r(new Error(s("invalid import kind: %s",n.kind)))}}))}else f.length&&(i.types=i.types?f.concat(i.types):f),r(null,i)}function h(e,t){if(e)r(e);else{(t.types||[]).forEach((function(e){if(void 0===e.namespace){var r=t.namespace;if(!r){var n=/^(.*)\.[^.]+$/.exec(t.protocol);n&&(r=n[1])}e.namespace=r||""}f.push(e)}));try{Object.keys(t.messages||{}).forEach((function(e){if(i.messages||(i.messages={}),i.messages[e])throw new Error(s("duplicate message: %s",e));i.messages[e]=t.messages[e]}))}catch(e){return void r(e)}l()}}t.importHook(e,"idl",(function(n,o){if(n)r(n);else if(void 0!==o){try{var s=new c(o,t)._readProtocol(o,t)}catch(n){return n.path=e,void r(n)}i=s.protocol,a=s.imports,l()}else r(null,{})}))}function c(e,t){t=t||{},this._tk=new f(e),this._ackVoidMessages=!!t.ackVoidMessages,this._implicitTags=!t.delimitedCollections,this._typeRefs=t.typeRefs||a}function f(e){this._str=e,this.pos=0}function l(e){for(var t=e.replace(/^[ \t]+|[ \t]+$/g,"").split("\n").map((function(e,t){return t?e.replace(/^\s*\*\s?/,""):e}));!t[0];)t.shift();for(;!t[t.length-1];)t.pop();return t.join("\n")}c.readProtocol=function(e,t){var r=new c(e,t)._readProtocol();if(r.imports.length)throw new Error("unresolvable import");return r.protocol},c.readSchema=function(e,t){var r=new c(e,t),n=r._readJavadoc(),i=r._readType(void 0===n?{}:{doc:n},!0);return r._tk.next({id:"(eof)"}),i},c.prototype._readProtocol=function(){var e,t=this._tk,r=[],n=[],i={};this._readImports(r);var o={},a=this._readJavadoc();for(void 0!==a&&(o.doc=a),this._readAnnotations(o),t.next({val:"protocol"}),t.next({val:"{",silent:!0})||(o.protocol=t.next({id:"name"}).val,t.next({val:"{"}));!t.next({val:"}",silent:!0});)if(!this._readImports(r)){var u=this._readJavadoc(),c=this._readType({},!0),f=this._readImports(r,!0),l=void 0;if(e=t.pos,!f&&(l=this._readMessage(c))){void 0!==u&&void 0===l.schema.doc&&(l.schema.doc=u);var h=!1;if("void"!==l.schema.response&&"void"!==l.schema.response.type||(h=!this._ackVoidMessages&&!l.schema.errors,"void"===l.schema.response?l.schema.response="null":l.schema.response.type="null"),h&&(l.schema["one-way"]=!0),i[l.name])throw new Error(s("duplicate message: %s",l.name));i[l.name]=l.schema}else u&&("string"==typeof c?c={doc:u,type:c}:void 0===c.doc&&(c.doc=u)),n.push(c),t.pos=e,t.next({val:";",silent:!0});u=void 0}return t.next({id:"(eof)"}),n.length&&(o.types=n),Object.keys(i).length&&(o.messages=i),{protocol:o,imports:r}},c.prototype._readAnnotations=function(e){for(var t=this._tk;t.next({val:"@",silent:!0});){for(var r=[];!t.next({val:"(",silent:!0});)r.push(t.next().val);e[r.join("")]=t.next({id:"json"}).val,t.next({val:")"})}},c.prototype._readMessage=function(e){var t=this._tk,r={request:[],response:e};this._readAnnotations(r);var n=t.next().val;if("("===t.next().val){if(!t.next({val:")",silent:!0}))do{r.request.push(this._readField())}while(!t.next({val:")",silent:!0})&&t.next({val:","}));var i=t.next();switch(i.val){case"throws":r.errors=[];do{r.errors.push(this._readType())}while(!t.next({val:";",silent:!0})&&t.next({val:","}));break;case"oneway":r["one-way"]=!0,t.next({val:";"});break;case";":break;default:throw t.error("invalid message suffix",i)}return{name:n,schema:r}}},c.prototype._readJavadoc=function(){var e=this._tk.next({id:"javadoc",emitJavadoc:!0,silent:!0});if(e)return e.val},c.prototype._readField=function(){var e=this._tk,t=this._readJavadoc(),r={type:this._readType()};return void 0!==t&&void 0===r.doc&&(r.doc=t),this._readAnnotations(r),r.name=e.next({id:"name"}).val,e.next({val:"=",silent:!0})&&(r.default=e.next({id:"json"}).val),r},c.prototype._readType=function(e,t){switch(e=e||{},this._readAnnotations(e),e.type=this._tk.next({id:"name"}).val,e.type){case"record":case"error":return this._readRecord(e);case"fixed":return this._readFixed(e);case"enum":return this._readEnum(e,t);case"map":return this._readMap(e);case"array":return this._readArray(e);case"union":if(Object.keys(e).length>1)throw new Error("union annotations are not supported");return this._readUnion();default:var r=this._typeRefs[e.type];return r&&(delete e.type,i.copyOwnProperties(r,e)),Object.keys(e).length>1?e:e.type}},c.prototype._readFixed=function(e){var t=this._tk;return t.next({val:"(",silent:!0})||(e.name=t.next({id:"name"}).val,t.next({val:"("})),e.size=parseInt(t.next({id:"number"}).val),t.next({val:")"}),e},c.prototype._readMap=function(e){var t=this._tk,r=this._implicitTags,n=void 0===t.next({val:"<",silent:r});return e.values=this._readType(),t.next({val:">",silent:n}),e},c.prototype._readArray=function(e){var t=this._tk,r=this._implicitTags,n=void 0===t.next({val:"<",silent:r});return e.items=this._readType(),t.next({val:">",silent:n}),e},c.prototype._readEnum=function(e,t){var r=this._tk;r.next({val:"{",silent:!0})||(e.name=r.next({id:"name"}).val,r.next({val:"{"})),e.symbols=[];do{e.symbols.push(r.next().val)}while(!r.next({val:"}",silent:!0})&&r.next({val:","}));return t&&r.next({val:"=",silent:!0})&&(e.default=r.next().val,r.next({val:";"})),e},c.prototype._readUnion=function(){var e=this._tk,t=[];e.next({val:"{"});do{t.push(this._readType())}while(!e.next({val:"}",silent:!0})&&e.next({val:","}));return t},c.prototype._readRecord=function(e){var t=this._tk;for(t.next({val:"{",silent:!0})||(e.name=t.next({id:"name"}).val,t.next({val:"{"})),e.fields=[];!t.next({val:"}",silent:!0});)e.fields.push(this._readField()),t.next({val:";"});return e},c.prototype._readImports=function(e,t){for(var r=this._tk,n=0,i=r.pos;r.next({val:"import",silent:!0});){if(!n&&t&&r.next({val:"(",silent:!0}))return void(r.pos=i);var o=r.next({id:"name"}).val,s=JSON.parse(r.next({id:"string"}).val);r.next({val:";"}),e.push({kind:o,name:s}),n++}return n},f.prototype.next=function(e){var t,r={pos:this.pos,id:void 0,val:void 0},n=this._skip(e&&e.emitJavadoc);if(n)r.id="javadoc",r.val=n;else{var i=this.pos,o=this._str,a=o.charAt(i);if(a)if(e&&"json"===e.id?(r.id="json",this.pos=this._endOfJson()):'"'===a?(r.id="string",this.pos=this._endOfString()):/[0-9]/.test(a)?(r.id="number",this.pos=this._endOf(/[0-9]/)):/[`A-Za-z_.]/.test(a)?(r.id="name",this.pos=this._endOf(/[`A-Za-z0-9_.]/)):(r.id="operator",this.pos=i+1),r.val=o.slice(i,this.pos),"json"===r.id)try{r.val=JSON.parse(r.val)}catch(t){throw this.error("invalid JSON",r)}else"name"===r.id&&(r.val=r.val.replace(/`/g,""));else r.id="(eof)"}if(e&&e.id&&e.id!==r.id?t=this.error(s("expected ID %s",e.id),r):e&&e.val&&e.val!==r.val&&(t=this.error(s("expected value %s",e.val),r)),t){if(e&&e.silent)return void(this.pos=r.pos);throw t}return r},f.prototype.error=function(e,t){var r,n="number"!=typeof t,i=n?t.pos:t,o=this._str,a=1,u=0;for(r=0;r<i;r++)"\n"===o.charAt(r)&&(a++,u=r);var c=n?s("invalid token %j: %s",t,e):e,f=new Error(c);return f.token=n?t:void 0,f.lineNum=a,f.colNum=i-u,f},f.prototype._skip=function(e){for(var t,r,n=this._str,i=!1;(r=n.charAt(this.pos))&&/\s/.test(r);)this.pos++;if(t=this.pos,"/"===r)switch(n.charAt(this.pos+1)){case"/":for(this.pos+=2;(r=n.charAt(this.pos))&&"\n"!==r;)this.pos++;return this._skip(e);case"*":for(this.pos+=2,"*"===n.charAt(this.pos)&&(i=!0);r=n.charAt(this.pos++);)if("*"===r&&"/"===n.charAt(this.pos))return this.pos++,i&&e?l(n.slice(t+3,this.pos-2)):this._skip(e);throw this.error("unterminated comment",t)}},f.prototype._endOf=function(e){for(var t=this.pos,r=this._str;e.test(r.charAt(t));)t++;return t},f.prototype._endOfString=function(){for(var e,t=this.pos+1,r=this._str;e=r.charAt(t);){if('"'===e)return t+1;"\\"===e?t+=2:t++}throw this.error("unterminated string",t-1)},f.prototype._endOfJson=function(){var e=i.jsonEnd(this._str,this.pos);if(e<0)throw this.error("invalid JSON",e);return e},e.exports={Tokenizer:f,assembleProtocol:u,read:function(e){var t;if("string"==typeof e&&~e.indexOf(o.sep)&&n.existsSync(e)){var r=n.readFileSync(e,{encoding:"utf8"});try{return JSON.parse(r)}catch(i){u(e,{importHook:n.createSyncImportHook()},(function(e,n){t=e?r:n}))}}else t=e;if("string"!=typeof t||"null"===t)return t;try{return JSON.parse(t)}catch(e){try{return c.readProtocol(t)}catch(e){try{return c.readSchema(t)}catch(e){return t}}}},readProtocol:c.readProtocol,readSchema:c.readSchema}},1387:function(e,t,r){"use strict";function n(){return new Error("unsupported in the browser")}e.exports={createImportHook:function(){return function(e,t,r){r(n())}},createSyncImportHook:function(){return function(){throw n()}},existsSync:function(){return!1},readFileSync:function(){throw n()}}},1388:function(e,t,r){"use strict";(function(t,n){var i=r(484),o=r(243),s=r(68),a=r(64),u=r(342),c={namespace:"org.apache.avro.file"},f=i.Type.forSchema("long",c),l=i.Type.forSchema({type:"map",values:"bytes"},c),h=i.Type.forSchema({name:"Header",type:"record",fields:[{name:"magic",type:{type:"fixed",name:"Magic",size:4}},{name:"meta",type:l},{name:"sync",type:{type:"fixed",name:"Sync",size:16}}]},c),p=i.Type.forSchema({name:"Block",type:"record",fields:[{name:"count",type:"long"},{name:"data",type:"bytes"},{name:"sync",type:"Sync"}]},c),d=o.bufferFrom("Obj"),y=a.format,m=o.Tap;function g(e,t){var r=!!(t=t||{}).noDecode;s.Duplex.call(this,{readableObjectMode:!r,allowHalfOpen:!1}),this._type=i.Type.forSchema(e),this._tap=new m(o.newBuffer(0)),this._writeCb=null,this._needPush=!1,this._readValue=B(r,this._type),this._finished=!1,this.on("finish",(function(){this._finished=!0,this._read()}))}function _(e){var t=!!(e=e||{}).noDecode;s.Duplex.call(this,{allowHalfOpen:!0,readableObjectMode:!t}),this._rType=void 0!==e.readerSchema?i.Type.forSchema(e.readerSchema):void 0,this._wType=null,this._codecs=e.codecs,this._codec=void 0,this._parseHook=e.parseHook,this._tap=new m(o.newBuffer(0)),this._blockTap=new m(o.newBuffer(0)),this._syncMarker=null,this._readValue=null,this._noDecode=t,this._queue=new o.OrderedQueue,this._decompress=null,this._index=0,this._remaining=void 0,this._needPush=!1,this._finished=!1,this.on("finish",(function(){this._finished=!0,this._needPush&&this._read()}))}function v(e,t){t=t||{},s.Transform.call(this,{writableObjectMode:!0,allowHalfOpen:!1}),this._type=i.Type.forSchema(e),this._writeValue=function(e,t){try{this._type._write(e,t)}catch(e){this.emit("error",e)}},this._tap=new m(o.newBuffer(t.batchSize||65536))}function b(e,t){var r;if(t=t||{},s.Duplex.call(this,{allowHalfOpen:!0,writableObjectMode:!0}),i.Type.isType(e)?(r=e,e=void 0):r=i.Type.forSchema(e),this._schema=e,this._type=r,this._writeValue=function(e,t){try{this._type._write(e,t)}catch(e){this.emit("error",e)}},this._blockSize=t.blockSize||65536,this._tap=new m(o.newBuffer(this._blockSize)),this._codecs=t.codecs,this._codec=t.codec||"null",this._blockCount=0,this._syncMarker=t.syncMarker||(new o.Lcg).nextBuffer(16),this._queue=new o.OrderedQueue,this._pending=0,this._finished=!1,this._needHeader=!1,this._needPush=!1,this._metadata=t.metadata||{},!l.isValid(this._metadata))throw new Error("invalid metadata");var n=this._codec;if(this._compress=(this._codecs||b.getDefaultCodecs())[n],!this._compress)throw new Error(y("unsupported codec: %s",n));switch(void 0!==t.omitHeader&&(t.writeHeader=t.omitHeader?"never":"auto"),t.writeHeader){case!1:case"never":break;case void 0:case"auto":this._needHeader=!0;break;default:this._writeHeader()}this.on("finish",(function(){this._finished=!0,this._blockCount?this._flushChunk():this._finished&&this._needPush&&this.push(null)}))}function w(e,t,r,n){this.index=e,this.buf=t,this.cb=r,this.count=0|n}function E(e){var t=e.pos,r=p._read(e);return e.isValid()?r:(e.pos=t,null)}function B(e,t,r){if(e)return i=t._skip,function(e){var t=e.pos;return i(e),e.buf.slice(t,e.pos)};if(r){var n=r.createResolver(t);return function(e){return n._read(e)}}return function(e){return t._read(e)};var i}a.inherits(g,s.Duplex),g.prototype._write=function(e,r,n){this._writeCb=n;var i=this._tap;i.buf=t.concat([i.buf.slice(i.pos),e]),i.pos=0,this._needPush&&(this._needPush=!1,this._read())},g.prototype._read=function(){this._needPush=!1;var e=this._tap,t=e.pos,r=this._readValue(e);e.isValid()?this.push(r):this._finished?this.push(null):(e.pos=t,this._needPush=!0,this._writeCb&&this._writeCb())},a.inherits(_,s.Duplex),_.defaultCodecs=function(){return{null:function(e,t){t(null,e)},deflate:u.inflateRaw}},_.getDefaultCodecs=_.defaultCodecs,_.prototype._decodeHeader=function(){var e=this._tap;if(e.buf.length<d.length)return!1;if(!d.equals(e.buf.slice(0,d.length)))return this.emit("error",new Error("invalid magic bytes")),!1;var t=h._read(e);if(!e.isValid())return!1;this._codec=(t.meta["avro.codec"]||"null").toString();var r=this._codecs||_.getDefaultCodecs();if(this._decompress=r[this._codec],this._decompress){try{var n=JSON.parse(t.meta["avro.schema"].toString());this._parseHook&&(n=this._parseHook(n)),this._wType=i.Type.forSchema(n)}catch(e){return void this.emit("error",e)}try{this._readValue=B(this._noDecode,this._wType,this._rType)}catch(e){return void this.emit("error",e)}return this._syncMarker=t.sync,this.emit("metadata",this._wType,this._codec,t),!0}this.emit("error",new Error(y("unknown codec: %s",this._codec)))},_.prototype._write=function(e,r,i){var s=this._tap;s.buf=t.concat([s.buf,e]),s.pos=0,this._decodeHeader()?(this._write=this._writeChunk,this._write(o.newBuffer(0),r,i)):n.nextTick(i)},_.prototype._writeChunk=function(e,r,n){var i=this._tap;i.buf=t.concat([i.buf.slice(i.pos),e]),i.pos=0;for(var o,s=1;o=E(i);){if(!this._syncMarker.equals(o.sync))return void this.emit("error",new Error("invalid sync marker"));s++,this._decompress(o.data,this._createBlockCallback(o.count,a))}function a(){--s||n()}a()},_.prototype._createBlockCallback=function(e,t){var r=this,n=this._index++;return function(i,o){if(i){var s=new Error(y("%s codec decompression error",r._codec));s.cause=i,r.emit("error",s),t()}else r._queue.push(new w(n,o,t,e)),r._needPush&&r._read()}},_.prototype._read=function(){this._needPush=!1;var e,t=this._blockTap;if(!this._remaining){var r=this._queue.pop();if(!r||!r.count)return this._finished?this.push(null):this._needPush=!0,void(r&&r.cb());r.cb(),this._remaining=r.count,t.buf=r.buf,t.pos=0}this._remaining--;try{if(e=this._readValue(t),!t.isValid())throw new Error("truncated block")}catch(e){return this._remaining=0,void this.emit("error",e)}this.push(e)},a.inherits(v,s.Transform),v.prototype._transform=function(e,t,r){var n=this._tap,i=n.buf,s=n.pos;if(this._writeValue(n,e),!n.isValid()){s&&this.push(function(e,t,r){var n=o.newBuffer(r);return e.copy(n,0,t,t+r),n}(n.buf,0,s));var a=n.pos-s;a>i.length&&(n.buf=o.newBuffer(2*a)),n.pos=0,this._writeValue(n,e)}r()},v.prototype._flush=function(e){var t=this._tap,r=t.pos;r&&this.push(t.buf.slice(0,r)),e()},a.inherits(b,s.Duplex),b.defaultCodecs=function(){return{null:function(e,t){t(null,e)},deflate:u.deflateRaw}},b.getDefaultCodecs=b.defaultCodecs,b.prototype._writeHeader=function(){var e=JSON.stringify(this._schema?this._schema:this._type.getSchema({exportAttrs:!0})),t=o.copyOwnProperties(this._metadata,{"avro.schema":o.bufferFrom(e),"avro.codec":o.bufferFrom(this._codec)},!0),r=new(h.getRecordConstructor())(d,t,this._syncMarker);this.push(r.toBuffer())},b.prototype._write=function(e,t,r){this._needHeader&&(this._writeHeader(),this._needHeader=!1);var n=this._tap,i=n.pos,s=!1;if(this._writeValue(n,e),!n.isValid()){i&&(this._flushChunk(i,r),s=!0);var a=n.pos-i;a>this._blockSize&&(this._blockSize=2*a),n.buf=o.newBuffer(this._blockSize),n.pos=0,this._writeValue(n,e)}this._blockCount++,s||r()},b.prototype._flushChunk=function(e,t){var r=this._tap;e=e||r.pos,this._compress(r.buf.slice(0,e),this._createBlockCallback(t)),this._blockCount=0},b.prototype._read=function(){var e=this,t=this._queue.pop();t?(this.push(f.toBuffer(t.count,!0)),this.push(f.toBuffer(t.buf.length,!0)),this.push(t.buf),this.push(this._syncMarker),this._finished||t.cb()):this._finished&&!this._pending?n.nextTick((function(){e.push(null)})):this._needPush=!0},b.prototype._createBlockCallback=function(e){var t=this,r=this._index++,n=this._blockCount;return this._pending++,function(i,o){if(i){var s=new Error(y("%s codec compression error",t._codec));return s.cause=i,void t.emit("error",s)}t._pending--,t._queue.push(new w(r,o,e,n)),t._needPush&&(t._needPush=!1,t._read())}},e.exports={BLOCK_TYPE:p,HEADER_TYPE:h,MAGIC_BYTES:d,streams:{BlockDecoder:_,BlockEncoder:b,RawDecoder:g,RawEncoder:v}}}).call(this,r(11).Buffer,r(25))},1389:function(e,t){e.exports=n;var r=null;try{r=new WebAssembly.Instance(new WebAssembly.Module(new Uint8Array([0,97,115,109,1,0,0,0,1,13,2,96,0,1,127,96,4,127,127,127,127,1,127,3,7,6,0,1,1,1,1,1,6,6,1,127,1,65,0,11,7,50,6,3,109,117,108,0,1,5,100,105,118,95,115,0,2,5,100,105,118,95,117,0,3,5,114,101,109,95,115,0,4,5,114,101,109,95,117,0,5,8,103,101,116,95,104,105,103,104,0,0,10,191,1,6,4,0,35,0,11,36,1,1,126,32,0,173,32,1,173,66,32,134,132,32,2,173,32,3,173,66,32,134,132,126,34,4,66,32,135,167,36,0,32,4,167,11,36,1,1,126,32,0,173,32,1,173,66,32,134,132,32,2,173,32,3,173,66,32,134,132,127,34,4,66,32,135,167,36,0,32,4,167,11,36,1,1,126,32,0,173,32,1,173,66,32,134,132,32,2,173,32,3,173,66,32,134,132,128,34,4,66,32,135,167,36,0,32,4,167,11,36,1,1,126,32,0,173,32,1,173,66,32,134,132,32,2,173,32,3,173,66,32,134,132,129,34,4,66,32,135,167,36,0,32,4,167,11,36,1,1,126,32,0,173,32,1,173,66,32,134,132,32,2,173,32,3,173,66,32,134,132,130,34,4,66,32,135,167,36,0,32,4,167,11])),{}).exports}catch(e){}function n(e,t,r){this.low=0|e,this.high=0|t,this.unsigned=!!r}function i(e){return!0===(e&&e.__isLong__)}n.prototype.__isLong__,Object.defineProperty(n.prototype,"__isLong__",{value:!0}),n.isLong=i;var o={},s={};function a(e,t){var r,n,i;return t?(i=0<=(e>>>=0)&&e<256)&&(n=s[e])?n:(r=c(e,(0|e)<0?-1:0,!0),i&&(s[e]=r),r):(i=-128<=(e|=0)&&e<128)&&(n=o[e])?n:(r=c(e,e<0?-1:0,!1),i&&(o[e]=r),r)}function u(e,t){if(isNaN(e))return t?_:g;if(t){if(e<0)return _;if(e>=d)return B}else{if(e<=-y)return A;if(e+1>=y)return E}return e<0?u(-e,t).neg():c(e%p|0,e/p|0,t)}function c(e,t,r){return new n(e,t,r)}n.fromInt=a,n.fromNumber=u,n.fromBits=c;var f=Math.pow;function l(e,t,r){if(0===e.length)throw Error("empty string");if("NaN"===e||"Infinity"===e||"+Infinity"===e||"-Infinity"===e)return g;if("number"==typeof t?(r=t,t=!1):t=!!t,(r=r||10)<2||36<r)throw RangeError("radix");var n;if((n=e.indexOf("-"))>0)throw Error("interior hyphen");if(0===n)return l(e.substring(1),t,r).neg();for(var i=u(f(r,8)),o=g,s=0;s<e.length;s+=8){var a=Math.min(8,e.length-s),c=parseInt(e.substring(s,s+a),r);if(a<8){var h=u(f(r,a));o=o.mul(h).add(u(c))}else o=(o=o.mul(i)).add(u(c))}return o.unsigned=t,o}function h(e,t){return"number"==typeof e?u(e,t):"string"==typeof e?l(e,t):c(e.low,e.high,"boolean"==typeof t?t:e.unsigned)}n.fromString=l,n.fromValue=h;var p=4294967296,d=p*p,y=d/2,m=a(1<<24),g=a(0);n.ZERO=g;var _=a(0,!0);n.UZERO=_;var v=a(1);n.ONE=v;var b=a(1,!0);n.UONE=b;var w=a(-1);n.NEG_ONE=w;var E=c(-1,2147483647,!1);n.MAX_VALUE=E;var B=c(-1,-1,!0);n.MAX_UNSIGNED_VALUE=B;var A=c(0,-2147483648,!1);n.MIN_VALUE=A;var S=n.prototype;S.toInt=function(){return this.unsigned?this.low>>>0:this.low},S.toNumber=function(){return this.unsigned?(this.high>>>0)*p+(this.low>>>0):this.high*p+(this.low>>>0)},S.toString=function(e){if((e=e||10)<2||36<e)throw RangeError("radix");if(this.isZero())return"0";if(this.isNegative()){if(this.eq(A)){var t=u(e),r=this.div(t),n=r.mul(t).sub(this);return r.toString(e)+n.toInt().toString(e)}return"-"+this.neg().toString(e)}for(var i=u(f(e,6),this.unsigned),o=this,s="";;){var a=o.div(i),c=(o.sub(a.mul(i)).toInt()>>>0).toString(e);if((o=a).isZero())return c+s;for(;c.length<6;)c="0"+c;s=""+c+s}},S.getHighBits=function(){return this.high},S.getHighBitsUnsigned=function(){return this.high>>>0},S.getLowBits=function(){return this.low},S.getLowBitsUnsigned=function(){return this.low>>>0},S.getNumBitsAbs=function(){if(this.isNegative())return this.eq(A)?64:this.neg().getNumBitsAbs();for(var e=0!=this.high?this.high:this.low,t=31;t>0&&0==(e&1<<t);t--);return 0!=this.high?t+33:t+1},S.isZero=function(){return 0===this.high&&0===this.low},S.eqz=S.isZero,S.isNegative=function(){return!this.unsigned&&this.high<0},S.isPositive=function(){return this.unsigned||this.high>=0},S.isOdd=function(){return 1==(1&this.low)},S.isEven=function(){return 0==(1&this.low)},S.equals=function(e){return i(e)||(e=h(e)),(this.unsigned===e.unsigned||this.high>>>31!=1||e.high>>>31!=1)&&(this.high===e.high&&this.low===e.low)},S.eq=S.equals,S.notEquals=function(e){return!this.eq(e)},S.neq=S.notEquals,S.ne=S.notEquals,S.lessThan=function(e){return this.comp(e)<0},S.lt=S.lessThan,S.lessThanOrEqual=function(e){return this.comp(e)<=0},S.lte=S.lessThanOrEqual,S.le=S.lessThanOrEqual,S.greaterThan=function(e){return this.comp(e)>0},S.gt=S.greaterThan,S.greaterThanOrEqual=function(e){return this.comp(e)>=0},S.gte=S.greaterThanOrEqual,S.ge=S.greaterThanOrEqual,S.compare=function(e){if(i(e)||(e=h(e)),this.eq(e))return 0;var t=this.isNegative(),r=e.isNegative();return t&&!r?-1:!t&&r?1:this.unsigned?e.high>>>0>this.high>>>0||e.high===this.high&&e.low>>>0>this.low>>>0?-1:1:this.sub(e).isNegative()?-1:1},S.comp=S.compare,S.negate=function(){return!this.unsigned&&this.eq(A)?A:this.not().add(v)},S.neg=S.negate,S.add=function(e){i(e)||(e=h(e));var t=this.high>>>16,r=65535&this.high,n=this.low>>>16,o=65535&this.low,s=e.high>>>16,a=65535&e.high,u=e.low>>>16,f=0,l=0,p=0,d=0;return p+=(d+=o+(65535&e.low))>>>16,l+=(p+=n+u)>>>16,f+=(l+=r+a)>>>16,f+=t+s,c((p&=65535)<<16|(d&=65535),(f&=65535)<<16|(l&=65535),this.unsigned)},S.subtract=function(e){return i(e)||(e=h(e)),this.add(e.neg())},S.sub=S.subtract,S.multiply=function(e){if(this.isZero())return g;if(i(e)||(e=h(e)),r)return c(r.mul(this.low,this.high,e.low,e.high),r.get_high(),this.unsigned);if(e.isZero())return g;if(this.eq(A))return e.isOdd()?A:g;if(e.eq(A))return this.isOdd()?A:g;if(this.isNegative())return e.isNegative()?this.neg().mul(e.neg()):this.neg().mul(e).neg();if(e.isNegative())return this.mul(e.neg()).neg();if(this.lt(m)&&e.lt(m))return u(this.toNumber()*e.toNumber(),this.unsigned);var t=this.high>>>16,n=65535&this.high,o=this.low>>>16,s=65535&this.low,a=e.high>>>16,f=65535&e.high,l=e.low>>>16,p=65535&e.low,d=0,y=0,_=0,v=0;return _+=(v+=s*p)>>>16,y+=(_+=o*p)>>>16,_&=65535,y+=(_+=s*l)>>>16,d+=(y+=n*p)>>>16,y&=65535,d+=(y+=o*l)>>>16,y&=65535,d+=(y+=s*f)>>>16,d+=t*p+n*l+o*f+s*a,c((_&=65535)<<16|(v&=65535),(d&=65535)<<16|(y&=65535),this.unsigned)},S.mul=S.multiply,S.divide=function(e){if(i(e)||(e=h(e)),e.isZero())throw Error("division by zero");var t,n,o;if(r)return this.unsigned||-2147483648!==this.high||-1!==e.low||-1!==e.high?c((this.unsigned?r.div_u:r.div_s)(this.low,this.high,e.low,e.high),r.get_high(),this.unsigned):this;if(this.isZero())return this.unsigned?_:g;if(this.unsigned){if(e.unsigned||(e=e.toUnsigned()),e.gt(this))return _;if(e.gt(this.shru(1)))return b;o=_}else{if(this.eq(A))return e.eq(v)||e.eq(w)?A:e.eq(A)?v:(t=this.shr(1).div(e).shl(1)).eq(g)?e.isNegative()?v:w:(n=this.sub(e.mul(t)),o=t.add(n.div(e)));if(e.eq(A))return this.unsigned?_:g;if(this.isNegative())return e.isNegative()?this.neg().div(e.neg()):this.neg().div(e).neg();if(e.isNegative())return this.div(e.neg()).neg();o=g}for(n=this;n.gte(e);){t=Math.max(1,Math.floor(n.toNumber()/e.toNumber()));for(var s=Math.ceil(Math.log(t)/Math.LN2),a=s<=48?1:f(2,s-48),l=u(t),p=l.mul(e);p.isNegative()||p.gt(n);)p=(l=u(t-=a,this.unsigned)).mul(e);l.isZero()&&(l=v),o=o.add(l),n=n.sub(p)}return o},S.div=S.divide,S.modulo=function(e){return i(e)||(e=h(e)),r?c((this.unsigned?r.rem_u:r.rem_s)(this.low,this.high,e.low,e.high),r.get_high(),this.unsigned):this.sub(this.div(e).mul(e))},S.mod=S.modulo,S.rem=S.modulo,S.not=function(){return c(~this.low,~this.high,this.unsigned)},S.and=function(e){return i(e)||(e=h(e)),c(this.low&e.low,this.high&e.high,this.unsigned)},S.or=function(e){return i(e)||(e=h(e)),c(this.low|e.low,this.high|e.high,this.unsigned)},S.xor=function(e){return i(e)||(e=h(e)),c(this.low^e.low,this.high^e.high,this.unsigned)},S.shiftLeft=function(e){return i(e)&&(e=e.toInt()),0==(e&=63)?this:e<32?c(this.low<<e,this.high<<e|this.low>>>32-e,this.unsigned):c(0,this.low<<e-32,this.unsigned)},S.shl=S.shiftLeft,S.shiftRight=function(e){return i(e)&&(e=e.toInt()),0==(e&=63)?this:e<32?c(this.low>>>e|this.high<<32-e,this.high>>e,this.unsigned):c(this.high>>e-32,this.high>=0?0:-1,this.unsigned)},S.shr=S.shiftRight,S.shiftRightUnsigned=function(e){if(i(e)&&(e=e.toInt()),0===(e&=63))return this;var t=this.high;return e<32?c(this.low>>>e|t<<32-e,t>>>e,this.unsigned):c(32===e?t:t>>>e-32,0,this.unsigned)},S.shru=S.shiftRightUnsigned,S.shr_u=S.shiftRightUnsigned,S.toSigned=function(){return this.unsigned?c(this.low,this.high,!1):this},S.toUnsigned=function(){return this.unsigned?this:c(this.low,this.high,!0)},S.toBytes=function(e){return e?this.toBytesLE():this.toBytesBE()},S.toBytesLE=function(){var e=this.high,t=this.low;return[255&t,t>>>8&255,t>>>16&255,t>>>24,255&e,e>>>8&255,e>>>16&255,e>>>24]},S.toBytesBE=function(){var e=this.high,t=this.low;return[e>>>24,e>>>16&255,e>>>8&255,255&e,t>>>24,t>>>16&255,t>>>8&255,255&t]},n.fromBytes=function(e,t,r){return r?n.fromBytesLE(e,t):n.fromBytesBE(e,t)},n.fromBytesLE=function(e,t){return new n(e[0]|e[1]<<8|e[2]<<16|e[3]<<24,e[4]|e[5]<<8|e[6]<<16|e[7]<<24,t)},n.fromBytesBE=function(e,t){return new n(e[4]<<24|e[5]<<16|e[6]<<8|e[7],e[0]<<24|e[1]<<16|e[2]<<8|e[3],t)}},14:function(e,t,r){var n;!function(i){"use strict";var o,s=/^-?(?:\d+(?:\.\d*)?|\.\d+)(?:e[+-]?\d+)?$/i,a=Math.ceil,u=Math.floor,c="[BigNumber Error] ",f=c+"Number primitive has more than 15 significant digits: ",l=1e14,h=14,p=9007199254740991,d=[1,10,100,1e3,1e4,1e5,1e6,1e7,1e8,1e9,1e10,1e11,1e12,1e13],y=1e7,m=1e9;function g(e){var t=0|e;return e>0||e===t?t:t-1}function _(e){for(var t,r,n=1,i=e.length,o=e[0]+"";n<i;){for(t=e[n++]+"",r=h-t.length;r--;t="0"+t);o+=t}for(i=o.length;48===o.charCodeAt(--i););return o.slice(0,i+1||1)}function v(e,t){var r,n,i=e.c,o=t.c,s=e.s,a=t.s,u=e.e,c=t.e;if(!s||!a)return null;if(r=i&&!i[0],n=o&&!o[0],r||n)return r?n?0:-a:s;if(s!=a)return s;if(r=s<0,n=u==c,!i||!o)return n?0:!i^r?1:-1;if(!n)return u>c^r?1:-1;for(a=(u=i.length)<(c=o.length)?u:c,s=0;s<a;s++)if(i[s]!=o[s])return i[s]>o[s]^r?1:-1;return u==c?0:u>c^r?1:-1}function b(e,t,r,n){if(e<t||e>r||e!==u(e))throw Error(c+(n||"Argument")+("number"==typeof e?e<t||e>r?" out of range: ":" not an integer: ":" not a primitive number: ")+String(e))}function w(e){var t=e.c.length-1;return g(e.e/h)==t&&e.c[t]%2!=0}function E(e,t){return(e.length>1?e.charAt(0)+"."+e.slice(1):e)+(t<0?"e":"e+")+t}function B(e,t,r){var n,i;if(t<0){for(i=r+".";++t;i+=r);e=i+e}else if(++t>(n=e.length)){for(i=r,t-=n;--t;i+=r);e+=i}else t<n&&(e=e.slice(0,t)+"."+e.slice(t));return e}(o=function e(t){var r,n,i,o,A,S,x,T,N,O=$.prototype={constructor:$,toString:null,valueOf:null},k=new $(1),I=20,F=4,D=-7,R=21,C=-1e7,L=1e7,P=!1,j=1,M=0,U={prefix:"",groupSize:3,secondaryGroupSize:0,groupSeparator:",",decimalSeparator:".",fractionGroupSize:0,fractionGroupSeparator:" ",suffix:""},z="0123456789abcdefghijklmnopqrstuvwxyz";function $(e,t){var r,o,a,c,l,d,y,m,g=this;if(!(g instanceof $))return new $(e,t);if(null==t){if(e&&!0===e._isBigNumber)return g.s=e.s,void(!e.c||e.e>L?g.c=g.e=null:e.e<C?g.c=[g.e=0]:(g.e=e.e,g.c=e.c.slice()));if((d="number"==typeof e)&&0*e==0){if(g.s=1/e<0?(e=-e,-1):1,e===~~e){for(c=0,l=e;l>=10;l/=10,c++);return void(c>L?g.c=g.e=null:(g.e=c,g.c=[e]))}m=String(e)}else{if(!s.test(m=String(e)))return i(g,m,d);g.s=45==m.charCodeAt(0)?(m=m.slice(1),-1):1}(c=m.indexOf("."))>-1&&(m=m.replace(".","")),(l=m.search(/e/i))>0?(c<0&&(c=l),c+=+m.slice(l+1),m=m.substring(0,l)):c<0&&(c=m.length)}else{if(b(t,2,z.length,"Base"),10==t)return Z(g=new $(e),I+g.e+1,F);if(m=String(e),d="number"==typeof e){if(0*e!=0)return i(g,m,d,t);if(g.s=1/e<0?(m=m.slice(1),-1):1,$.DEBUG&&m.replace(/^0\.0*|\./,"").length>15)throw Error(f+e)}else g.s=45===m.charCodeAt(0)?(m=m.slice(1),-1):1;for(r=z.slice(0,t),c=l=0,y=m.length;l<y;l++)if(r.indexOf(o=m.charAt(l))<0){if("."==o){if(l>c){c=y;continue}}else if(!a&&(m==m.toUpperCase()&&(m=m.toLowerCase())||m==m.toLowerCase()&&(m=m.toUpperCase()))){a=!0,l=-1,c=0;continue}return i(g,String(e),d,t)}d=!1,(c=(m=n(m,t,10,g.s)).indexOf("."))>-1?m=m.replace(".",""):c=m.length}for(l=0;48===m.charCodeAt(l);l++);for(y=m.length;48===m.charCodeAt(--y););if(m=m.slice(l,++y)){if(y-=l,d&&$.DEBUG&&y>15&&(e>p||e!==u(e)))throw Error(f+g.s*e);if((c=c-l-1)>L)g.c=g.e=null;else if(c<C)g.c=[g.e=0];else{if(g.e=c,g.c=[],l=(c+1)%h,c<0&&(l+=h),l<y){for(l&&g.c.push(+m.slice(0,l)),y-=h;l<y;)g.c.push(+m.slice(l,l+=h));l=h-(m=m.slice(l)).length}else l-=y;for(;l--;m+="0");g.c.push(+m)}}else g.c=[g.e=0]}function Y(e,t,r,n){var i,o,s,a,u;if(null==r?r=F:b(r,0,8),!e.c)return e.toString();if(i=e.c[0],s=e.e,null==t)u=_(e.c),u=1==n||2==n&&(s<=D||s>=R)?E(u,s):B(u,s,"0");else if(o=(e=Z(new $(e),t,r)).e,a=(u=_(e.c)).length,1==n||2==n&&(t<=o||o<=D)){for(;a<t;u+="0",a++);u=E(u,o)}else if(t-=s,u=B(u,o,"0"),o+1>a){if(--t>0)for(u+=".";t--;u+="0");}else if((t+=o-a)>0)for(o+1==a&&(u+=".");t--;u+="0");return e.s<0&&i?"-"+u:u}function H(e,t){for(var r,n=1,i=new $(e[0]);n<e.length;n++){if(!(r=new $(e[n])).s){i=r;break}t.call(i,r)&&(i=r)}return i}function q(e,t,r){for(var n=1,i=t.length;!t[--i];t.pop());for(i=t[0];i>=10;i/=10,n++);return(r=n+r*h-1)>L?e.c=e.e=null:r<C?e.c=[e.e=0]:(e.e=r,e.c=t),e}function Z(e,t,r,n){var i,o,s,c,f,p,y,m=e.c,g=d;if(m){e:{for(i=1,c=m[0];c>=10;c/=10,i++);if((o=t-i)<0)o+=h,s=t,y=(f=m[p=0])/g[i-s-1]%10|0;else if((p=a((o+1)/h))>=m.length){if(!n)break e;for(;m.length<=p;m.push(0));f=y=0,i=1,s=(o%=h)-h+1}else{for(f=c=m[p],i=1;c>=10;c/=10,i++);y=(s=(o%=h)-h+i)<0?0:f/g[i-s-1]%10|0}if(n=n||t<0||null!=m[p+1]||(s<0?f:f%g[i-s-1]),n=r<4?(y||n)&&(0==r||r==(e.s<0?3:2)):y>5||5==y&&(4==r||n||6==r&&(o>0?s>0?f/g[i-s]:0:m[p-1])%10&1||r==(e.s<0?8:7)),t<1||!m[0])return m.length=0,n?(t-=e.e+1,m[0]=g[(h-t%h)%h],e.e=-t||0):m[0]=e.e=0,e;if(0==o?(m.length=p,c=1,p--):(m.length=p+1,c=g[h-o],m[p]=s>0?u(f/g[i-s]%g[s])*c:0),n)for(;;){if(0==p){for(o=1,s=m[0];s>=10;s/=10,o++);for(s=m[0]+=c,c=1;s>=10;s/=10,c++);o!=c&&(e.e++,m[0]==l&&(m[0]=1));break}if(m[p]+=c,m[p]!=l)break;m[p--]=0,c=1}for(o=m.length;0===m[--o];m.pop());}e.e>L?e.c=e.e=null:e.e<C&&(e.c=[e.e=0])}return e}function V(e){var t,r=e.e;return null===r?e.toString():(t=_(e.c),t=r<=D||r>=R?E(t,r):B(t,r,"0"),e.s<0?"-"+t:t)}return $.clone=e,$.ROUND_UP=0,$.ROUND_DOWN=1,$.ROUND_CEIL=2,$.ROUND_FLOOR=3,$.ROUND_HALF_UP=4,$.ROUND_HALF_DOWN=5,$.ROUND_HALF_EVEN=6,$.ROUND_HALF_CEIL=7,$.ROUND_HALF_FLOOR=8,$.EUCLID=9,$.config=$.set=function(e){var t,r;if(null!=e){if("object"!=typeof e)throw Error(c+"Object expected: "+e);if(e.hasOwnProperty(t="DECIMAL_PLACES")&&(b(r=e[t],0,m,t),I=r),e.hasOwnProperty(t="ROUNDING_MODE")&&(b(r=e[t],0,8,t),F=r),e.hasOwnProperty(t="EXPONENTIAL_AT")&&((r=e[t])&&r.pop?(b(r[0],-m,0,t),b(r[1],0,m,t),D=r[0],R=r[1]):(b(r,-m,m,t),D=-(R=r<0?-r:r))),e.hasOwnProperty(t="RANGE"))if((r=e[t])&&r.pop)b(r[0],-m,-1,t),b(r[1],1,m,t),C=r[0],L=r[1];else{if(b(r,-m,m,t),!r)throw Error(c+t+" cannot be zero: "+r);C=-(L=r<0?-r:r)}if(e.hasOwnProperty(t="CRYPTO")){if((r=e[t])!==!!r)throw Error(c+t+" not true or false: "+r);if(r){if("undefined"==typeof crypto||!crypto||!crypto.getRandomValues&&!crypto.randomBytes)throw P=!r,Error(c+"crypto unavailable");P=r}else P=r}if(e.hasOwnProperty(t="MODULO_MODE")&&(b(r=e[t],0,9,t),j=r),e.hasOwnProperty(t="POW_PRECISION")&&(b(r=e[t],0,m,t),M=r),e.hasOwnProperty(t="FORMAT")){if("object"!=typeof(r=e[t]))throw Error(c+t+" not an object: "+r);U=r}if(e.hasOwnProperty(t="ALPHABET")){if("string"!=typeof(r=e[t])||/^.$|[+-.\s]|(.).*\1/.test(r))throw Error(c+t+" invalid: "+r);z=r}}return{DECIMAL_PLACES:I,ROUNDING_MODE:F,EXPONENTIAL_AT:[D,R],RANGE:[C,L],CRYPTO:P,MODULO_MODE:j,POW_PRECISION:M,FORMAT:U,ALPHABET:z}},$.isBigNumber=function(e){if(!e||!0!==e._isBigNumber)return!1;if(!$.DEBUG)return!0;var t,r,n=e.c,i=e.e,o=e.s;e:if("[object Array]"=={}.toString.call(n)){if((1===o||-1===o)&&i>=-m&&i<=m&&i===u(i)){if(0===n[0]){if(0===i&&1===n.length)return!0;break e}if((t=(i+1)%h)<1&&(t+=h),String(n[0]).length==t){for(t=0;t<n.length;t++)if((r=n[t])<0||r>=l||r!==u(r))break e;if(0!==r)return!0}}}else if(null===n&&null===i&&(null===o||1===o||-1===o))return!0;throw Error(c+"Invalid BigNumber: "+e)},$.maximum=$.max=function(){return H(arguments,O.lt)},$.minimum=$.min=function(){return H(arguments,O.gt)},$.random=(o=9007199254740992*Math.random()&2097151?function(){return u(9007199254740992*Math.random())}:function(){return 8388608*(1073741824*Math.random()|0)+(8388608*Math.random()|0)},function(e){var t,r,n,i,s,f=0,l=[],p=new $(k);if(null==e?e=I:b(e,0,m),i=a(e/h),P)if(crypto.getRandomValues){for(t=crypto.getRandomValues(new Uint32Array(i*=2));f<i;)(s=131072*t[f]+(t[f+1]>>>11))>=9e15?(r=crypto.getRandomValues(new Uint32Array(2)),t[f]=r[0],t[f+1]=r[1]):(l.push(s%1e14),f+=2);f=i/2}else{if(!crypto.randomBytes)throw P=!1,Error(c+"crypto unavailable");for(t=crypto.randomBytes(i*=7);f<i;)(s=281474976710656*(31&t[f])+1099511627776*t[f+1]+4294967296*t[f+2]+16777216*t[f+3]+(t[f+4]<<16)+(t[f+5]<<8)+t[f+6])>=9e15?crypto.randomBytes(7).copy(t,f):(l.push(s%1e14),f+=7);f=i/7}if(!P)for(;f<i;)(s=o())<9e15&&(l[f++]=s%1e14);for(i=l[--f],e%=h,i&&e&&(s=d[h-e],l[f]=u(i/s)*s);0===l[f];l.pop(),f--);if(f<0)l=[n=0];else{for(n=-1;0===l[0];l.splice(0,1),n-=h);for(f=1,s=l[0];s>=10;s/=10,f++);f<h&&(n-=h-f)}return p.e=n,p.c=l,p}),$.sum=function(){for(var e=1,t=arguments,r=new $(t[0]);e<t.length;)r=r.plus(t[e++]);return r},n=function(){function e(e,t,r,n){for(var i,o,s=[0],a=0,u=e.length;a<u;){for(o=s.length;o--;s[o]*=t);for(s[0]+=n.indexOf(e.charAt(a++)),i=0;i<s.length;i++)s[i]>r-1&&(null==s[i+1]&&(s[i+1]=0),s[i+1]+=s[i]/r|0,s[i]%=r)}return s.reverse()}return function(t,n,i,o,s){var a,u,c,f,l,h,p,d,y=t.indexOf("."),m=I,g=F;for(y>=0&&(f=M,M=0,t=t.replace(".",""),h=(d=new $(n)).pow(t.length-y),M=f,d.c=e(B(_(h.c),h.e,"0"),10,i,"0123456789"),d.e=d.c.length),c=f=(p=e(t,n,i,s?(a=z,"0123456789"):(a="0123456789",z))).length;0==p[--f];p.pop());if(!p[0])return a.charAt(0);if(y<0?--c:(h.c=p,h.e=c,h.s=o,p=(h=r(h,d,m,g,i)).c,l=h.r,c=h.e),y=p[u=c+m+1],f=i/2,l=l||u<0||null!=p[u+1],l=g<4?(null!=y||l)&&(0==g||g==(h.s<0?3:2)):y>f||y==f&&(4==g||l||6==g&&1&p[u-1]||g==(h.s<0?8:7)),u<1||!p[0])t=l?B(a.charAt(1),-m,a.charAt(0)):a.charAt(0);else{if(p.length=u,l)for(--i;++p[--u]>i;)p[u]=0,u||(++c,p=[1].concat(p));for(f=p.length;!p[--f];);for(y=0,t="";y<=f;t+=a.charAt(p[y++]));t=B(t,c,a.charAt(0))}return t}}(),r=function(){function e(e,t,r){var n,i,o,s,a=0,u=e.length,c=t%y,f=t/y|0;for(e=e.slice();u--;)a=((i=c*(o=e[u]%y)+(n=f*o+(s=e[u]/y|0)*c)%y*y+a)/r|0)+(n/y|0)+f*s,e[u]=i%r;return a&&(e=[a].concat(e)),e}function t(e,t,r,n){var i,o;if(r!=n)o=r>n?1:-1;else for(i=o=0;i<r;i++)if(e[i]!=t[i]){o=e[i]>t[i]?1:-1;break}return o}function r(e,t,r,n){for(var i=0;r--;)e[r]-=i,i=e[r]<t[r]?1:0,e[r]=i*n+e[r]-t[r];for(;!e[0]&&e.length>1;e.splice(0,1));}return function(n,i,o,s,a){var c,f,p,d,y,m,_,v,b,w,E,B,A,S,x,T,N,O=n.s==i.s?1:-1,k=n.c,I=i.c;if(!(k&&k[0]&&I&&I[0]))return new $(n.s&&i.s&&(k?!I||k[0]!=I[0]:I)?k&&0==k[0]||!I?0*O:O/0:NaN);for(b=(v=new $(O)).c=[],O=o+(f=n.e-i.e)+1,a||(a=l,f=g(n.e/h)-g(i.e/h),O=O/h|0),p=0;I[p]==(k[p]||0);p++);if(I[p]>(k[p]||0)&&f--,O<0)b.push(1),d=!0;else{for(S=k.length,T=I.length,p=0,O+=2,(y=u(a/(I[0]+1)))>1&&(I=e(I,y,a),k=e(k,y,a),T=I.length,S=k.length),A=T,E=(w=k.slice(0,T)).length;E<T;w[E++]=0);N=I.slice(),N=[0].concat(N),x=I[0],I[1]>=a/2&&x++;do{if(y=0,(c=t(I,w,T,E))<0){if(B=w[0],T!=E&&(B=B*a+(w[1]||0)),(y=u(B/x))>1)for(y>=a&&(y=a-1),_=(m=e(I,y,a)).length,E=w.length;1==t(m,w,_,E);)y--,r(m,T<_?N:I,_,a),_=m.length,c=1;else 0==y&&(c=y=1),_=(m=I.slice()).length;if(_<E&&(m=[0].concat(m)),r(w,m,E,a),E=w.length,-1==c)for(;t(I,w,T,E)<1;)y++,r(w,T<E?N:I,E,a),E=w.length}else 0===c&&(y++,w=[0]);b[p++]=y,w[0]?w[E++]=k[A]||0:(w=[k[A]],E=1)}while((A++<S||null!=w[0])&&O--);d=null!=w[0],b[0]||b.splice(0,1)}if(a==l){for(p=1,O=b[0];O>=10;O/=10,p++);Z(v,o+(v.e=p+f*h-1)+1,s,d)}else v.e=f,v.r=+d;return v}}(),A=/^(-?)0([xbo])(?=\w[\w.]*$)/i,S=/^([^.]+)\.$/,x=/^\.([^.]+)$/,T=/^-?(Infinity|NaN)$/,N=/^\s*\+(?=[\w.])|^\s+|\s+$/g,i=function(e,t,r,n){var i,o=r?t:t.replace(N,"");if(T.test(o))e.s=isNaN(o)?null:o<0?-1:1;else{if(!r&&(o=o.replace(A,(function(e,t,r){return i="x"==(r=r.toLowerCase())?16:"b"==r?2:8,n&&n!=i?e:t})),n&&(i=n,o=o.replace(S,"$1").replace(x,"0.$1")),t!=o))return new $(o,i);if($.DEBUG)throw Error(c+"Not a"+(n?" base "+n:"")+" number: "+t);e.s=null}e.c=e.e=null},O.absoluteValue=O.abs=function(){var e=new $(this);return e.s<0&&(e.s=1),e},O.comparedTo=function(e,t){return v(this,new $(e,t))},O.decimalPlaces=O.dp=function(e,t){var r,n,i,o=this;if(null!=e)return b(e,0,m),null==t?t=F:b(t,0,8),Z(new $(o),e+o.e+1,t);if(!(r=o.c))return null;if(n=((i=r.length-1)-g(this.e/h))*h,i=r[i])for(;i%10==0;i/=10,n--);return n<0&&(n=0),n},O.dividedBy=O.div=function(e,t){return r(this,new $(e,t),I,F)},O.dividedToIntegerBy=O.idiv=function(e,t){return r(this,new $(e,t),0,1)},O.exponentiatedBy=O.pow=function(e,t){var r,n,i,o,s,f,l,p,d=this;if((e=new $(e)).c&&!e.isInteger())throw Error(c+"Exponent not an integer: "+V(e));if(null!=t&&(t=new $(t)),s=e.e>14,!d.c||!d.c[0]||1==d.c[0]&&!d.e&&1==d.c.length||!e.c||!e.c[0])return p=new $(Math.pow(+V(d),s?2-w(e):+V(e))),t?p.mod(t):p;if(f=e.s<0,t){if(t.c?!t.c[0]:!t.s)return new $(NaN);(n=!f&&d.isInteger()&&t.isInteger())&&(d=d.mod(t))}else{if(e.e>9&&(d.e>0||d.e<-1||(0==d.e?d.c[0]>1||s&&d.c[1]>=24e7:d.c[0]<8e13||s&&d.c[0]<=9999975e7)))return o=d.s<0&&w(e)?-0:0,d.e>-1&&(o=1/o),new $(f?1/o:o);M&&(o=a(M/h+2))}for(s?(r=new $(.5),f&&(e.s=1),l=w(e)):l=(i=Math.abs(+V(e)))%2,p=new $(k);;){if(l){if(!(p=p.times(d)).c)break;o?p.c.length>o&&(p.c.length=o):n&&(p=p.mod(t))}if(i){if(0===(i=u(i/2)))break;l=i%2}else if(Z(e=e.times(r),e.e+1,1),e.e>14)l=w(e);else{if(0===(i=+V(e)))break;l=i%2}d=d.times(d),o?d.c&&d.c.length>o&&(d.c.length=o):n&&(d=d.mod(t))}return n?p:(f&&(p=k.div(p)),t?p.mod(t):o?Z(p,M,F,void 0):p)},O.integerValue=function(e){var t=new $(this);return null==e?e=F:b(e,0,8),Z(t,t.e+1,e)},O.isEqualTo=O.eq=function(e,t){return 0===v(this,new $(e,t))},O.isFinite=function(){return!!this.c},O.isGreaterThan=O.gt=function(e,t){return v(this,new $(e,t))>0},O.isGreaterThanOrEqualTo=O.gte=function(e,t){return 1===(t=v(this,new $(e,t)))||0===t},O.isInteger=function(){return!!this.c&&g(this.e/h)>this.c.length-2},O.isLessThan=O.lt=function(e,t){return v(this,new $(e,t))<0},O.isLessThanOrEqualTo=O.lte=function(e,t){return-1===(t=v(this,new $(e,t)))||0===t},O.isNaN=function(){return!this.s},O.isNegative=function(){return this.s<0},O.isPositive=function(){return this.s>0},O.isZero=function(){return!!this.c&&0==this.c[0]},O.minus=function(e,t){var r,n,i,o,s=this,a=s.s;if(t=(e=new $(e,t)).s,!a||!t)return new $(NaN);if(a!=t)return e.s=-t,s.plus(e);var u=s.e/h,c=e.e/h,f=s.c,p=e.c;if(!u||!c){if(!f||!p)return f?(e.s=-t,e):new $(p?s:NaN);if(!f[0]||!p[0])return p[0]?(e.s=-t,e):new $(f[0]?s:3==F?-0:0)}if(u=g(u),c=g(c),f=f.slice(),a=u-c){for((o=a<0)?(a=-a,i=f):(c=u,i=p),i.reverse(),t=a;t--;i.push(0));i.reverse()}else for(n=(o=(a=f.length)<(t=p.length))?a:t,a=t=0;t<n;t++)if(f[t]!=p[t]){o=f[t]<p[t];break}if(o&&(i=f,f=p,p=i,e.s=-e.s),(t=(n=p.length)-(r=f.length))>0)for(;t--;f[r++]=0);for(t=l-1;n>a;){if(f[--n]<p[n]){for(r=n;r&&!f[--r];f[r]=t);--f[r],f[n]+=l}f[n]-=p[n]}for(;0==f[0];f.splice(0,1),--c);return f[0]?q(e,f,c):(e.s=3==F?-1:1,e.c=[e.e=0],e)},O.modulo=O.mod=function(e,t){var n,i,o=this;return e=new $(e,t),!o.c||!e.s||e.c&&!e.c[0]?new $(NaN):!e.c||o.c&&!o.c[0]?new $(o):(9==j?(i=e.s,e.s=1,n=r(o,e,0,3),e.s=i,n.s*=i):n=r(o,e,0,j),(e=o.minus(n.times(e))).c[0]||1!=j||(e.s=o.s),e)},O.multipliedBy=O.times=function(e,t){var r,n,i,o,s,a,u,c,f,p,d,m,_,v,b,w=this,E=w.c,B=(e=new $(e,t)).c;if(!(E&&B&&E[0]&&B[0]))return!w.s||!e.s||E&&!E[0]&&!B||B&&!B[0]&&!E?e.c=e.e=e.s=null:(e.s*=w.s,E&&B?(e.c=[0],e.e=0):e.c=e.e=null),e;for(n=g(w.e/h)+g(e.e/h),e.s*=w.s,(u=E.length)<(p=B.length)&&(_=E,E=B,B=_,i=u,u=p,p=i),i=u+p,_=[];i--;_.push(0));for(v=l,b=y,i=p;--i>=0;){for(r=0,d=B[i]%b,m=B[i]/b|0,o=i+(s=u);o>i;)r=((c=d*(c=E[--s]%b)+(a=m*c+(f=E[s]/b|0)*d)%b*b+_[o]+r)/v|0)+(a/b|0)+m*f,_[o--]=c%v;_[o]=r}return r?++n:_.splice(0,1),q(e,_,n)},O.negated=function(){var e=new $(this);return e.s=-e.s||null,e},O.plus=function(e,t){var r,n=this,i=n.s;if(t=(e=new $(e,t)).s,!i||!t)return new $(NaN);if(i!=t)return e.s=-t,n.minus(e);var o=n.e/h,s=e.e/h,a=n.c,u=e.c;if(!o||!s){if(!a||!u)return new $(i/0);if(!a[0]||!u[0])return u[0]?e:new $(a[0]?n:0*i)}if(o=g(o),s=g(s),a=a.slice(),i=o-s){for(i>0?(s=o,r=u):(i=-i,r=a),r.reverse();i--;r.push(0));r.reverse()}for((i=a.length)-(t=u.length)<0&&(r=u,u=a,a=r,t=i),i=0;t;)i=(a[--t]=a[t]+u[t]+i)/l|0,a[t]=l===a[t]?0:a[t]%l;return i&&(a=[i].concat(a),++s),q(e,a,s)},O.precision=O.sd=function(e,t){var r,n,i,o=this;if(null!=e&&e!==!!e)return b(e,1,m),null==t?t=F:b(t,0,8),Z(new $(o),e,t);if(!(r=o.c))return null;if(n=(i=r.length-1)*h+1,i=r[i]){for(;i%10==0;i/=10,n--);for(i=r[0];i>=10;i/=10,n++);}return e&&o.e+1>n&&(n=o.e+1),n},O.shiftedBy=function(e){return b(e,-p,p),this.times("1e"+e)},O.squareRoot=O.sqrt=function(){var e,t,n,i,o,s=this,a=s.c,u=s.s,c=s.e,f=I+4,l=new $("0.5");if(1!==u||!a||!a[0])return new $(!u||u<0&&(!a||a[0])?NaN:a?s:1/0);if(0==(u=Math.sqrt(+V(s)))||u==1/0?(((t=_(a)).length+c)%2==0&&(t+="0"),u=Math.sqrt(+t),c=g((c+1)/2)-(c<0||c%2),n=new $(t=u==1/0?"1e"+c:(t=u.toExponential()).slice(0,t.indexOf("e")+1)+c)):n=new $(u+""),n.c[0])for((u=(c=n.e)+f)<3&&(u=0);;)if(o=n,n=l.times(o.plus(r(s,o,f,1))),_(o.c).slice(0,u)===(t=_(n.c)).slice(0,u)){if(n.e<c&&--u,"9999"!=(t=t.slice(u-3,u+1))&&(i||"4999"!=t)){+t&&(+t.slice(1)||"5"!=t.charAt(0))||(Z(n,n.e+I+2,1),e=!n.times(n).eq(s));break}if(!i&&(Z(o,o.e+I+2,0),o.times(o).eq(s))){n=o;break}f+=4,u+=4,i=1}return Z(n,n.e+I+1,F,e)},O.toExponential=function(e,t){return null!=e&&(b(e,0,m),e++),Y(this,e,t,1)},O.toFixed=function(e,t){return null!=e&&(b(e,0,m),e=e+this.e+1),Y(this,e,t)},O.toFormat=function(e,t,r){var n,i=this;if(null==r)null!=e&&t&&"object"==typeof t?(r=t,t=null):e&&"object"==typeof e?(r=e,e=t=null):r=U;else if("object"!=typeof r)throw Error(c+"Argument not an object: "+r);if(n=i.toFixed(e,t),i.c){var o,s=n.split("."),a=+r.groupSize,u=+r.secondaryGroupSize,f=r.groupSeparator||"",l=s[0],h=s[1],p=i.s<0,d=p?l.slice(1):l,y=d.length;if(u&&(o=a,a=u,u=o,y-=o),a>0&&y>0){for(o=y%a||a,l=d.substr(0,o);o<y;o+=a)l+=f+d.substr(o,a);u>0&&(l+=f+d.slice(o)),p&&(l="-"+l)}n=h?l+(r.decimalSeparator||"")+((u=+r.fractionGroupSize)?h.replace(new RegExp("\\d{"+u+"}\\B","g"),"$&"+(r.fractionGroupSeparator||"")):h):l}return(r.prefix||"")+n+(r.suffix||"")},O.toFraction=function(e){var t,n,i,o,s,a,u,f,l,p,y,m,g=this,v=g.c;if(null!=e&&(!(u=new $(e)).isInteger()&&(u.c||1!==u.s)||u.lt(k)))throw Error(c+"Argument "+(u.isInteger()?"out of range: ":"not an integer: ")+V(u));if(!v)return new $(g);for(t=new $(k),l=n=new $(k),i=f=new $(k),m=_(v),s=t.e=m.length-g.e-1,t.c[0]=d[(a=s%h)<0?h+a:a],e=!e||u.comparedTo(t)>0?s>0?t:l:u,a=L,L=1/0,u=new $(m),f.c[0]=0;p=r(u,t,0,1),1!=(o=n.plus(p.times(i))).comparedTo(e);)n=i,i=o,l=f.plus(p.times(o=l)),f=o,t=u.minus(p.times(o=t)),u=o;return o=r(e.minus(n),i,0,1),f=f.plus(o.times(l)),n=n.plus(o.times(i)),f.s=l.s=g.s,y=r(l,i,s*=2,F).minus(g).abs().comparedTo(r(f,n,s,F).minus(g).abs())<1?[l,i]:[f,n],L=a,y},O.toNumber=function(){return+V(this)},O.toPrecision=function(e,t){return null!=e&&b(e,1,m),Y(this,e,t,2)},O.toString=function(e){var t,r=this,i=r.s,o=r.e;return null===o?i?(t="Infinity",i<0&&(t="-"+t)):t="NaN":(null==e?t=o<=D||o>=R?E(_(r.c),o):B(_(r.c),o,"0"):10===e?t=B(_((r=Z(new $(r),I+o+1,F)).c),r.e,"0"):(b(e,2,z.length,"Base"),t=n(B(_(r.c),o,"0"),10,e,i,!0)),i<0&&r.c[0]&&(t="-"+t)),t},O.valueOf=O.toJSON=function(){return V(this)},O._isBigNumber=!0,null!=t&&$.set(t),$}()).default=o.BigNumber=o,void 0===(n=function(){return o}.call(t,r,t,e))||(e.exports=n)}()},1424:function(e,t,r){"use strict";r.r(t);var n=r(1),i=r.n(n),o=r(2),s=r.n(o),a=r(4),u=r.n(a),c=r(3),f=r.n(c),l=r(5),h=r.n(l),p=r(9),d=r(8),y=r(786),m=r.n(y),g=function(e){function t(){var e;return i()(this,t),(e=u()(this,f()(t).call(this))).name="Avro to JSON",e.module="Serialise",e.description="Converts Avro encoded data into JSON.",e.infoURL="https://wikipedia.org/wiki/Apache_Avro",e.inputType="ArrayBuffer",e.outputType="string",e.args=[{name:"Force Valid JSON",type:"boolean",value:!0}],e}return h()(t,e),s()(t,[{key:"run",value:function(e,t){if(e.byteLength<=0)throw new d.a("Please provide an input.");var r=t[0];return new Promise((function(t,n){var i=[],o=new Uint8Array(e),s=new m.a.streams.BlockDecoder;s.on("data",(function(e){i.push(e)})).on("error",(function(){n(new d.a("Error parsing Avro file."))})).on("end",(function(){if(r)t(1===i.length?JSON.stringify(i[0],null,4):JSON.stringify(i,null,4));else{var e=i.reduce((function(e,t){return e+JSON.stringify(t)+"\n"}),"");t(e)}})),s.write(o),s.end()}))}}]),t}(p.a),_=r(787),v=r(413),b=r.n(v),w=function(e){function t(){var e;return i()(this,t),(e=u()(this,f()(t).call(this))).name="BSON serialise",e.module="Serialise",e.description="BSON is a computer data interchange format used mainly as a data storage and network transfer format in the MongoDB database. It is a binary form for representing simple data structures, associative arrays (called objects or documents in MongoDB), and various data types of specific interest to MongoDB. The name 'BSON' is based on the term JSON and stands for 'Binary JSON'.<br><br>Input data should be valid JSON.",e.infoURL="https://wikipedia.org/wiki/BSON",e.inputType="string",e.outputType="ArrayBuffer",e.args=[],e}return h()(t,e),s()(t,[{key:"run",value:function(e,t){if(!e)return new ArrayBuffer;try{var r=JSON.parse(e);return b.a.serialize(r).buffer}catch(e){throw new d.a(e.toString())}}}]),t}(p.a),E="undefined"==typeof self?{}:self.OpModules||{};E.Serialise={"Avro to JSON":g,"BSON deserialise":_.a,"BSON serialise":w};t.default=E},145:function(e,t){var r={}.toString;e.exports=Array.isArray||function(e){return"[object Array]"==r.call(e)}},146:function(e,t){},147:function(e,t,r){"use strict";var n=r(21).Buffer,i=r(148);e.exports=function(){function e(){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this.head=null,this.tail=null,this.length=0}return e.prototype.push=function(e){var t={data:e,next:null};this.length>0?this.tail.next=t:this.head=t,this.tail=t,++this.length},e.prototype.unshift=function(e){var t={data:e,next:this.head};0===this.length&&(this.tail=t),this.head=t,++this.length},e.prototype.shift=function(){if(0!==this.length){var e=this.head.data;return 1===this.length?this.head=this.tail=null:this.head=this.head.next,--this.length,e}},e.prototype.clear=function(){this.head=this.tail=null,this.length=0},e.prototype.join=function(e){if(0===this.length)return"";for(var t=this.head,r=""+t.data;t=t.next;)r+=e+t.data;return r},e.prototype.concat=function(e){if(0===this.length)return n.alloc(0);if(1===this.length)return this.head.data;for(var t,r,i,o=n.allocUnsafe(e>>>0),s=this.head,a=0;s;)t=s.data,r=o,i=a,t.copy(r,i),a+=s.data.length,s=s.next;return o},e}(),i&&i.inspect&&i.inspect.custom&&(e.exports.prototype[i.inspect.custom]=function(){var e=i.inspect({length:this.length});return this.constructor.name+" "+e})},148:function(e,t){},149:function(e,t,r){(function(t){function r(e){try{if(!t.localStorage)return!1}catch(e){return!1}var r=t.localStorage[e];return null!=r&&"true"===String(r).toLowerCase()}e.exports=function(e,t){if(r("noDeprecation"))return e;var n=!1;return function(){if(!n){if(r("throwDeprecation"))throw new Error(t);r("traceDeprecation")?console.trace(t):console.warn(t),n=!0}return e.apply(this,arguments)}}}).call(this,r(26))},15:function(e,t,r){"use strict";r.d(t,"b",(function(){return o})),r.d(t,"a",(function(){return s}));var n=r(0),i=r(8);
/**
 * Base64 functions.
 *
 * @author n1474335 [n1474335@gmail.com]
 * @copyright Crown Copyright 2016
 * @license Apache-2.0
 */
function o(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"A-Za-z0-9+/=";if(!e)return"";if(e instanceof ArrayBuffer&&(e=new Uint8Array(e)),"string"==typeof e&&(e=n.b.strToByteArray(e)),64!==(t=n.b.expandAlphRange(t).join("")).length&&65!==t.length)throw new i.a(`Invalid Base64 alphabet length (${t.length}): ${t}`);for(var r,o,s,a,u,c,f,l="",h=0;h<e.length;)a=(r=e[h++])>>2,u=(3&r)<<4|(o=e[h++])>>4,c=(15&o)<<2|(s=e[h++])>>6,f=63&s,isNaN(o)?c=f=64:isNaN(s)&&(f=64),l+=t.charAt(a)+t.charAt(u)+t.charAt(c)+t.charAt(f);return l}function s(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"A-Za-z0-9+/=",r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"string",o=!(arguments.length>3&&void 0!==arguments[3])||arguments[3];if(!e)return"string"===r?"":[];if(t=t||"A-Za-z0-9+/=",64!==(t=n.b.expandAlphRange(t).join("")).length&&65!==t.length)throw new i.a(`Invalid Base64 alphabet length (${t.length}): ${t}`);var s,a,u,c,f,l,h=[],p=0;if(o){var d=new RegExp("[^"+t.replace(/[[\]\\\-^$]/g,"\\$&")+"]","g");e=e.replace(d,"")}for(;p<e.length;)s=t.indexOf(e.charAt(p++))<<2|(c=-1===(c=t.indexOf(e.charAt(p++)||"="))?64:c)>>4,a=(15&c)<<4|(f=-1===(f=t.indexOf(e.charAt(p++)||"="))?64:f)>>2,u=(3&f)<<6|(l=-1===(l=t.indexOf(e.charAt(p++)||"="))?64:l),h.push(s),64!==f&&h.push(a),64!==l&&h.push(u);return"string"===r?n.b.byteArrayToUtf8(h):h}},150:function(e,t,r){var n=r(11),i=n.Buffer;function o(e,t){for(var r in e)t[r]=e[r]}function s(e,t,r){return i(e,t,r)}i.from&&i.alloc&&i.allocUnsafe&&i.allocUnsafeSlow?e.exports=n:(o(n,t),t.Buffer=s),s.prototype=Object.create(i.prototype),o(i,s),s.from=function(e,t,r){if("number"==typeof e)throw new TypeError("Argument must not be a number");return i(e,t,r)},s.alloc=function(e,t,r){if("number"!=typeof e)throw new TypeError("Argument must be a number");var n=i(e);return void 0!==t?"string"==typeof r?n.fill(t,r):n.fill(t):n.fill(0),n},s.allocUnsafe=function(e){if("number"!=typeof e)throw new TypeError("Argument must be a number");return i(e)},s.allocUnsafeSlow=function(e){if("number"!=typeof e)throw new TypeError("Argument must be a number");return n.SlowBuffer(e)}},151:function(e,t,r){"use strict";e.exports=o;var n=r(103),i=r(56);function o(e){if(!(this instanceof o))return new o(e);n.call(this,e)}i.inherits=r(17),i.inherits(o,n),o.prototype._transform=function(e,t,r){r(null,e)}},152:function(e,t,r){e.exports=r(81)},153:function(e,t,r){e.exports=r(47)},154:function(e,t,r){e.exports=r(80).Transform},155:function(e,t,r){e.exports=r(80).PassThrough},16:function(e,t,r){"use strict";r.d(t,"b",(function(){return i})),r.d(t,"c",(function(){return o})),r.d(t,"a",(function(){return s}));var n=r(0);
/**
 * Hexadecimal functions.
 *
 * @author n1474335 [n1474335@gmail.com]
 * @copyright Crown Copyright 2016
 * @license Apache-2.0
 */function i(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:" ",r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:2,n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:"",i=arguments.length>4&&void 0!==arguments[4]?arguments[4]:0;if(!e)return"";e instanceof ArrayBuffer&&(e=new Uint8Array(e));for(var o="",s="0x"===t||"\\x"===t,a=0;a<e.length;a++){var u=e[a].toString(16).padStart(r,"0");o+=s?t+u:u+t,n&&(o+=n),a!==e.length-1&&(a+1)%i==0&&(o+="\n")}var c=n.length+(s?0:t.length);return c?o.slice(0,-c):o}function o(e){if(!e)return"";e instanceof ArrayBuffer&&(e=new Uint8Array(e));for(var t=[],r=0;r<e.length;r++)t.push((e[r]>>>4).toString(16)),t.push((15&e[r]).toString(16));return t.join("")}function s(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"Auto",r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:2;if("None"!==t){var i="Auto"===t?/[^a-f\d]|(0x)/gi:n.b.regexRep(t);e=e.replace(i,"")}for(var o=[],s=0;s<e.length;s+=r)o.push(parseInt(e.substr(s,r),16));return o}["Auto"].concat(["Space","Percent","Comma","Semi-colon","Colon","Line feed","CRLF","0x","0x with comma","\\x","None"])},17:function(e,t){"function"==typeof Object.create?e.exports=function(e,t){t&&(e.super_=t,e.prototype=Object.create(t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}))}:e.exports=function(e,t){if(t){e.super_=t;var r=function(){};r.prototype=t.prototype,e.prototype=new r,e.prototype.constructor=e}}},18:function(e,t,r){"use strict";var n=r(12),i=r.n(n),o=r(7),s={Images:[{name:"Joint Photographic Experts Group image",extension:"jpg,jpeg,jpe,thm,mpo",mime:"image/jpeg",description:"",signature:{0:255,1:216,2:255,3:[192,196,219,221,224,225,226,227,228,229,231,232,234,235,236,237,238,254]},extractor:function(e,t){var r=new o.a(e.slice(t));for(;r.hasMore();){var n=r.getBytes(2);if(255!==n[0])throw new Error(`Invalid marker while parsing JPEG at pos ${r.position}: ${n}`);var i=0;switch(n[1]){case 216:case 1:break;case 217:return r.carve();case 192:case 193:case 194:case 195:case 196:case 197:case 198:case 199:case 200:case 201:case 202:case 203:case 204:case 205:case 206:case 207:case 219:case 222:case 224:case 225:case 226:case 227:case 228:case 229:case 230:case 231:case 232:case 233:case 234:case 235:case 236:case 237:case 238:case 239:case 254:i=r.readInt(2,"be"),r.position+=i-2;break;case 223:r.position++;break;case 220:case 221:r.position+=2;break;case 218:i=r.readInt(2,"be"),r.position+=i-2,r.continueUntil(255);break;case 0:case 208:case 209:case 210:case 211:case 212:case 213:case 214:case 215:default:r.continueUntil(255)}}throw new Error("Unable to parse JPEG successfully")}},{name:"Graphics Interchange Format image",extension:"gif",mime:"image/gif",description:"",signature:{0:71,1:73,2:70,3:56,4:[55,57],5:97},extractor:function(e,t){var r=new o.a(e.slice(t));r.continueUntil([33,255]),r.continueUntil([33,249]),r.moveForwardsBy(2);for(;r.hasMore();){for(r.moveForwardsBy(r.readInt(1)+1),r.moveForwardsBy(11);r.getBytes(2)!==[33,249]&&(r.moveBackwardsBy(2),r.moveForwardsBy(r.readInt(1)),r.readInt(1));)r.moveBackwardsBy(1);if(59===r.readInt(1))break;r.moveForwardsBy(1)}return r.carve()}},{name:"Portable Network Graphics image",extension:"png",mime:"image/png",description:"",signature:{0:137,1:80,2:78,3:71,4:13,5:10,6:26,7:10},extractor:function(e,t){var r=new o.a(e.slice(t));r.moveForwardsBy(8);var n=0,i="";for(;"IEND"!==i;)n=r.readInt(4,"be"),i=r.readString(4),r.moveForwardsBy(n+4);return r.carve()}},{name:"WEBP Image",extension:"webp",mime:"image/webp",description:"",signature:{8:87,9:69,10:66,11:80},extractor:null},{name:"Camera Image File Format",extension:"crw",mime:"image/x-canon-crw",description:"",signature:{6:72,7:69,8:65,9:80,10:67,11:67,12:68,13:82},extractor:null},{name:"Canon CR2 raw image",extension:"cr2",mime:"image/x-canon-cr2",description:"",signature:[{0:73,1:73,2:42,3:0,8:67,9:82},{0:77,1:77,2:0,3:42,8:67,9:82}],extractor:null},{name:"Tagged Image File Format image",extension:"tif",mime:"image/tiff",description:"",signature:[{0:73,1:73,2:42,3:0},{0:77,1:77,2:0,3:42}],extractor:null},{name:"Bitmap image",extension:"bmp",mime:"image/bmp",description:"",signature:{0:66,1:77,7:0,9:0,14:[12,40,56,64,108,124],15:0,16:0,17:0},extractor:function(e,t){var r=new o.a(e.slice(t));r.moveForwardsBy(2);var n=r.readInt(4,"le");return r.moveForwardsBy(n-6),r.carve()}},{name:"JPEG Extended Range image",extension:"jxr",mime:"image/vnd.ms-photo",description:"",signature:{0:73,1:73,2:188},extractor:null},{name:"Photoshop image",extension:"psd",mime:"image/vnd.adobe.photoshop",description:"",signature:{0:56,1:66,2:80,3:83,4:0,5:1,6:0,7:0,8:0,9:0,10:0,11:0},extractor:null},{name:"Photoshop Large Document",extension:"psb",mime:"application/x-photoshop",description:"",signature:{0:56,1:66,2:80,3:83,4:0,5:2,6:0,7:0,8:0,9:0,10:0,11:0,12:0},extractor:null},{name:"Paint Shop Pro image",extension:"psp",mime:"image/psp",description:"",signature:[{0:80,1:97,2:105,3:110,4:116,5:32,6:83,7:104,8:111,9:112,10:32,11:80,12:114,13:111,14:32,15:73,16:109},{0:126,1:66,2:75,3:0}],extractor:null},{name:"The GIMP image",extension:"xcf",mime:"image/x-xcf",description:"",signature:{0:103,1:105,2:109,3:112,4:32,5:120,6:99,7:102,8:32,9:[102,118],10:[105,48],11:[108,48],12:[101,49,50,51]},extractor:null},{name:"Icon image",extension:"ico",mime:"image/x-icon",description:"",signature:{0:0,1:0,2:1,3:0,4:[1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21],5:0,6:[16,32,48,64,128],7:[16,32,48,64,128],9:0,10:[0,1]},extractor:function(e,t){var r=new o.a(e.slice(t));r.moveTo(4);var n=r.readInt(2,"le");r.moveForwardsBy(8+16*(n-1));var i=r.readInt(4,"le"),s=r.readInt(4,"le");return r.moveTo(s+i),r.carve()}},{name:"Radiance High Dynamic Range image",extension:"hdr",mime:"image/vnd.radiance",description:"",signature:{0:35,1:63,2:82,3:65,4:68,5:73,6:65,7:78,8:67,9:69,10:10},extractor:null},{name:"Sony ARW image",extension:"arw",mime:"image/x-raw",description:"",signature:{0:5,1:0,2:0,3:0,4:65,5:87,6:49,7:46},extractor:null},{name:"Fujifilm Raw Image",extension:"raf",mime:"image/x-raw",description:"",signature:{0:70,1:85,2:74,3:73,4:70,5:73,6:76,7:77,8:67,9:67,10:68,11:45,12:82,13:65,14:87},extractor:null},{name:"Minolta RAW image",extension:"mrw",mime:"image/x-raw",description:"",signature:{0:0,1:77,2:82,3:77},extractor:null},{name:"Adobe Bridge Thumbnail Cache",extension:"bct",mime:"application/octet-stream",description:"",signature:{0:108,1:110,2:98,3:116,4:2,5:0,6:0,7:0},extractor:null},{name:"Microsoft Document Imaging",extension:"mdi",mime:"image/vnd.ms-modi",description:"",signature:{0:69,1:80,2:42,3:0},extractor:null},{name:"Joint Photographic Experts Group image (under Base64)",extension:"B64",mime:"application/octet-stream",description:"",signature:{0:47,1:57,2:106,3:47,4:52},extractor:null},{name:"Portable Network Graphics image (under Base64)",extension:"B64",mime:"application/octet-stream",description:"",signature:{0:105,1:86,2:66,3:79,4:82,5:119,6:48},extractor:null},{name:"AutoCAD Drawing",extension:"dwg,123d",mime:"application/acad",description:"",signature:{0:65,1:67,2:49,3:48,4:[48,49],5:[48,49,50,51,52,53],6:0},extractor:null},{name:"AutoCAD Drawing",extension:"dwg,dwt",mime:"application/acad",description:"",signature:[{0:65,1:67,2:49,3:48,4:49,5:56,6:0},{0:65,1:67,2:49,3:48,4:50,5:52,6:0},{0:65,1:67,2:49,3:48,4:50,5:55,6:0}],extractor:null}],Video:[{name:"Matroska Multimedia Container",extension:"mkv",mime:"video/x-matroska",description:"",signature:{31:109,32:97,33:116,34:114,35:111,36:115,37:107,38:97},extractor:null},{name:"WEBM video",extension:"webm",mime:"video/webm",description:"",signature:{0:26,1:69,2:223,3:163},extractor:null},{name:"Flash MP4 video",extension:"f4v",mime:"video/mp4",description:"",signature:{4:102,5:116,6:121,7:112,8:[102,70],9:52,10:[118,86],11:32},extractor:null},{name:"MPEG-4 video",extension:"mp4",mime:"video/mp4",description:"",signature:[{0:0,1:0,2:0,3:[24,32],4:102,5:116,6:121,7:112},{0:51,1:103,2:112,3:53},{0:0,1:0,2:0,3:28,4:102,5:116,6:121,7:112,8:109,9:112,10:52,11:50,16:109,17:112,18:52,19:49,20:109,21:112,22:52,23:50,24:105,25:115,26:111,27:109}],extractor:null},{name:"M4V video",extension:"m4v",mime:"video/x-m4v",description:"",signature:{0:0,1:0,2:0,3:28,4:102,5:116,6:121,7:112,8:77,9:52,10:86},extractor:null},{name:"Quicktime video",extension:"mov",mime:"video/quicktime",description:"",signature:{0:0,1:0,2:0,3:20,4:102,5:116,6:121,7:112},extractor:null},{name:"Audio Video Interleave",extension:"avi",mime:"video/x-msvideo",description:"",signature:{0:82,1:73,2:70,3:70,8:65,9:86,10:73},extractor:null},{name:"Windows Media Video",extension:"wmv",mime:"video/x-ms-wmv",description:"",signature:{0:48,1:38,2:178,3:117,4:142,5:102,6:207,7:17,8:166,9:217},extractor:null},{name:"MPEG video",extension:"mpg",mime:"video/mpeg",description:"",signature:{0:0,1:0,2:1,3:186},extractor:null},{name:"Flash Video",extension:"flv",mime:"video/x-flv",description:"",signature:{0:70,1:76,2:86,3:1},extractor:function(e,t){var r=new o.a(e.slice(t));r.moveForwardsBy(5);var n=r.readInt(4,"be");r.moveForwardsBy(n-9);var i=-11;for(;r.hasMore();){var s=r.readInt(4,"be"),a=r.readInt(1);if([8,9,18].indexOf(a)<0){r.moveBackwardsBy(1);break}if(s!==i+11){r.moveBackwardsBy(i+11+5);break}i=r.readInt(3,"be"),r.moveForwardsBy(7+i)}return r.carve()}},{name:"OGG Video",extension:"ogv,ogm,opus,ogx",mime:"video/ogg",description:"",signature:[{0:79,1:103,2:103,3:83,4:0,5:2,28:1,29:118,30:105,31:100,32:101,33:111},{0:79,1:103,2:103,3:83,4:0,5:2,28:128,29:116,30:104,31:101,32:111,33:114,34:97},{0:79,1:103,2:103,3:83,4:0,5:2,28:102,29:105,30:115,31:104,32:101,33:97,34:100}],extractor:null}],Audio:[{name:"Waveform Audio",extension:"wav",mime:"audio/x-wav",description:"",signature:{0:82,1:73,2:70,3:70,8:87,9:65,10:86,11:69},extractor:function(e,t){var r=new o.a(e.slice(t));return r.moveTo(4),r.moveTo(r.readInt(4,"le")),r.carve()}},{name:"OGG audio",extension:"ogg",mime:"audio/ogg",description:"",signature:{0:79,1:103,2:103,3:83},extractor:null},{name:"Musical Instrument Digital Interface audio",extension:"midi",mime:"audio/midi",description:"",signature:{0:77,1:84,2:104,3:100},extractor:null},{name:"MPEG-3 audio",extension:"mp3",mime:"audio/mpeg",description:"",signature:[{0:73,1:68,2:51},{0:255,1:251}],extractor:null},{name:"MPEG-4 Part 14 audio",extension:"m4a",mime:"audio/m4a",description:"",signature:[{4:102,5:116,6:121,7:112,8:77,9:52,10:65},{0:77,1:52,2:65,3:32}],extractor:null},{name:"Free Lossless Audio Codec",extension:"flac",mime:"audio/x-flac",description:"",signature:{0:102,1:76,2:97,3:67},extractor:null},{name:"Adaptive Multi-Rate audio codec",extension:"amr",mime:"audio/amr",description:"",signature:{0:35,1:33,2:65,3:77,4:82,5:10},extractor:null},{name:"Audacity",extension:"au",mime:"audio/x-au",description:"",signature:{0:100,1:110,2:115,3:46,24:65,25:117,26:100,27:97,28:99,29:105,30:116,31:121,32:66,33:108,34:111,35:99,36:107,37:70,38:105,39:108,40:101},extractor:null},{name:"Audacity Block",extension:"auf",mime:"application/octet-stream",description:"",signature:{0:65,1:117,2:100,3:97,4:99,5:105,6:116,7:121,8:66,9:108,10:111,11:99,12:107,13:70,14:105,15:108,16:101},extractor:null},{name:"Audio Interchange File",extension:"aif",mime:"audio/x-aiff",description:"",signature:{0:70,1:79,2:82,3:77,8:65,9:73,10:70,11:70},extractor:null},{name:"Audio Interchange File (compressed)",extension:"aifc",mime:"audio/x-aifc",description:"",signature:{0:70,1:79,2:82,3:77,8:65,9:73,10:70,11:67},extractor:null}],Documents:[{name:"Portable Document Format",extension:"pdf",mime:"application/pdf",description:"",signature:{0:37,1:80,2:68,3:70},extractor:function(e,t){var r=new o.a(e.slice(t));return r.continueUntil([37,37,69,79,70]),r.moveForwardsBy(5),r.consumeIf(13),r.consumeIf(10),r.carve()}},{name:"Portable Document Format (under Base64)",extension:"B64",mime:"application/octet-stream",description:"",signature:{0:65,1:74,2:86,3:66,4:69,5:82,6:105},extractor:null},{name:"Adobe PostScript",extension:"ps,eps,ai,pfa",mime:"application/postscript",description:"",signature:{0:37,1:33,2:80,3:83,4:45,5:65,6:100,7:111,8:98,9:101},extractor:null},{name:"PostScript",extension:"ps",mime:"application/postscript",description:"",signature:{0:37,1:33},extractor:null},{name:"Encapsulated PostScript",extension:"eps,ai",mime:"application/eps",description:"",signature:{0:197,1:208,2:211,3:198},extractor:null},{name:"Rich Text Format",extension:"rtf",mime:"application/rtf",description:"",signature:{0:123,1:92,2:114,3:116},extractor:function(e,t){var r=new o.a(e.slice(t)),n=0;if(123!==r.readInt(1))throw new Error("Not a valid RTF file");n++;for(;n>0&&r.hasMore();)switch(r.readInt(1)){case 123:n++;break;case 125:n--;break;case 92:r.consumeIf(92),r.position++}return r.carve()}},{name:"Microsoft Office document/OLE2",extension:"ole2,doc,xls,dot,ppt,xla,ppa,pps,pot,msi,sdw,db,vsd,msg",mime:"application/msword,application/vnd.ms-excel,application/vnd.ms-powerpoint",description:"Microsoft Office documents",signature:{0:208,1:207,2:17,3:224,4:161,5:177,6:26,7:225},extractor:null},{name:"Microsoft Office document/OLE2 (under Base64)",extension:"B64",mime:"application/octet-stream",description:"",signature:{0:48,1:77,2:56,3:82,4:52,5:75,6:71,7:120},extractor:null},{name:"Microsoft Office 2007+ document",extension:"docx,xlsx,pptx",mime:"application/vnd.openxmlformats-officedocument.wordprocessingml.document,application/vnd.openxmlformats-officedocument.spreadsheetml.sheet,application/vnd.openxmlformats-officedocument.presentationml.presentation",description:"",signature:{38:95,39:84,40:121,41:112,42:101,43:115,44:93,45:46,46:120,47:109,48:108},extractor:a},{name:"Microsoft Access database",extension:"mdb,mda,mde,mdt,fdb,psa",mime:"application/msaccess",description:"",signature:{0:0,1:1,2:0,3:0,4:83,5:116,6:97,7:110,8:100,9:97,10:114,11:100,12:32,13:74,14:101,15:116},extractor:null},{name:"Microsoft Access 2007+ database",extension:"accdb,accde,accda,accdu",mime:"application/msaccess",description:"",signature:{0:0,1:1,2:0,3:0,4:83,5:116,6:97,7:110,8:100,9:97,10:114,11:100,12:32,13:65,14:67,15:69,16:32},extractor:null},{name:"Microsoft OneNote document",extension:"one",mime:"application/onenote",description:"",signature:{0:228,1:82,2:92,3:123,4:140,5:216,6:167,7:77,8:174,9:177,10:83,11:120,12:208,13:41,14:150,15:211},extractor:null},{name:"Outlook Express database",extension:"dbx",mime:"application/octet-stream",description:"",signature:{0:207,1:173,2:18,3:254,4:[48,197,198,199],11:17},extractor:null},{name:"Personal Storage Table (Outlook)",extension:"pst,ost,fdb,pab",mime:"application/octet-stream",description:"",signature:{0:33,1:66,2:68,3:78},extractor:null},{name:"Microsoft Exchange Database",extension:"edb",mime:"application/octet-stream",description:"",signature:{4:239,5:205,6:171,7:137,8:[32,35],9:6,10:0,11:0,12:[0,1],13:0,14:0,15:0},extractor:null},{name:"WordPerfect document",extension:"wpd,wp,wp5,wp6,wpp,bk!,wcm",mime:"application/wordperfect",description:"",signature:{0:255,1:87,2:80,3:67,7:[0,1,2],8:1,9:10},extractor:null},{name:"EPUB e-book",extension:"epub",mime:"application/epub+zip",description:"",signature:{0:80,1:75,2:3,3:4,30:109,31:105,32:109,33:101,34:116,35:121,36:112,37:101,38:97,39:112,40:112,41:108,42:105,43:99,44:97,45:116,46:105,47:111,48:110,49:47,50:101,51:112,52:117,53:98,54:43,55:122,56:105,57:112},extractor:a}],Applications:[{name:"Windows Portable Executable",extension:"exe,dll,drv,vxd,sys,ocx,vbx,com,fon,scr",mime:"application/vnd.microsoft.portable-executable",description:"",signature:{0:77,1:90,3:[0,1,2],5:[0,1,2]},extractor:function(e,t){var r=new o.a(e.slice(t));r.moveTo(60);var n=r.readInt(4,"le");r.moveTo(n),r.moveForwardsBy(6);var i=r.readInt(2,"le");r.moveForwardsBy(16);var s=523===r.readInt(2,"le")?112:96;r.moveForwardsBy(s-2),r.moveForwardsBy(32);var a=r.readInt(4,"le"),u=r.readInt(4,"le");if(a>0)return r.moveTo(a+u),r.carve();r.moveForwardsBy(88),r.moveForwardsBy(40*(i-1)),r.moveForwardsBy(16);var c=r.readInt(4,"le"),f=r.readInt(4,"le");return r.moveTo(f+c),r.carve()}},{name:"Executable and Linkable Format",extension:"elf,bin,axf,o,prx,so",mime:"application/x-executable",description:"Executable and Linkable Format file. No standard file extension.",signature:{0:127,1:69,2:76,3:70},extractor:function(e,t){var r=new o.a(e.slice(t));r.moveForwardsBy(4);var n=1===r.readInt(1),i=1===r.readInt(1)?"le":"be";r.moveForwardsBy(n?26:34);var s=n?r.readInt(4,i):r.readInt(8,i);r.moveForwardsBy(10);var a=r.readInt(2,i),u=r.readInt(2,i);return r.moveTo(s),r.moveForwardsBy(a*u),r.carve()}},{name:"MacOS Mach-O object",extension:"dylib",mime:"application/octet-stream",description:"",signature:[{0:202,1:254,2:186,3:190,4:0,5:0,6:0,7:[1,2,3]},{0:206,1:250,2:237,3:254,4:7,5:0,6:0,7:0,8:[1,2,3]}],extractor:u},{name:"MacOS Mach-O 64-bit object",extension:"dylib",mime:"application/octet-stream",description:"",signature:{0:207,1:250,2:237,3:254},extractor:u},{name:"Adobe Flash",extension:"swf",mime:"application/x-shockwave-flash",description:"",signature:{0:[67,70],1:87,2:83},extractor:null},{name:"Java Class",extension:"class",mime:"application/java-vm",description:"",signature:{0:202,1:254,2:186,3:190},extractor:null},{name:"Dalvik Executable",extension:"dex",mime:"application/octet-stream",description:"Dalvik Executable as used by Android",signature:{0:100,1:101,2:120,3:10,4:48,5:51,6:53,7:0},extractor:null},{name:"Google Chrome Extension",extension:"crx",mime:"application/crx",description:"Google Chrome extension or packaged app",signature:{0:67,1:114,2:50,3:52},extractor:null}],Archives:[{name:"PKZIP archive",extension:"zip",mime:"application/zip",description:"",signature:{0:80,1:75,2:[3,5,7],3:[4,6,8]},extractor:a},{name:"PKZIP archive (under Base64)",extension:"B64",mime:"application/octet-stream",description:"",signature:{0:85,1:69,2:115,3:68,4:66,5:66},extractor:null},{name:"TAR archive",extension:"tar",mime:"application/x-tar",description:"",signature:{257:117,258:115,259:116,260:97,261:114},extractor:function(e,t){var r=new o.a(e.slice(t));for(;r.hasMore();){if(r.moveForwardsBy(257),r.getBytes(5).join("")!==[117,115,116,97,114].join("")){r.moveBackwardsBy(262);break}r.moveBackwardsBy(138);var n=0;r.getBytes(11).forEach((function(e,t){n+=(e-48).toString()})),n=512*Math.ceil(parseInt(n,8)/512),r.moveForwardsBy(n+377)}return r.consumeWhile(0),r.carve()}},{name:"Roshal Archive",extension:"rar",mime:"application/x-rar-compressed",description:"",signature:{0:82,1:97,2:114,3:33,4:26,5:7,6:[0,1]},extractor:null},{name:"Gzip",extension:"gz",mime:"application/gzip",description:"",signature:{0:31,1:139,2:8},extractor:function(e,t){var r=new o.a(e.slice(t));r.moveForwardsBy(3);var n=r.readInt(1);if(r.moveForwardsBy(4),r.readInt(1),r.moveForwardsBy(1),4&n){var i=r.readInt(2,"le");r.moveForwardsby(i)}8&n&&(r.continueUntil(0),r.moveForwardsBy(1));16&n&&(r.continueUntil(0),r.moveForwardsBy(1));2&n&&r.moveForwardsBy(2);return d(r),r.moveForwardsBy(8),r.carve()}},{name:"Bzip2",extension:"bz2",mime:"application/x-bzip2",description:"",signature:{0:66,1:90,2:104},extractor:function(e,t){for(var r=new o.a(e.slice(t)),n=[[119,36,83,133,9],[238,72,167,10,18],[220,145,78,20,36],[185,34,156,40,72],[114,69,56,80,144],[187,146,41,194,132],[93,201,20,225,66],[46,228,138,112,161],[23,114,69,56,80]],i=0;i<n.length&&(r.continueUntil(n[i]),r.getBytes(5).join("")!==n[i].join(""));i++)r.moveTo(0);return r.moveForwardsBy(4),r.carve()}},{name:"7zip",extension:"7z",mime:"application/x-7z-compressed",description:"",signature:{0:55,1:122,2:188,3:175,4:39,5:28},extractor:null},{name:"Zlib Deflate",extension:"zlib",mime:"application/x-deflate",description:"",signature:{0:120,1:[1,156,218,94]},extractor:function(e,t){var r=new o.a(e.slice(t));r.moveForwardsBy(1),32&r.readInt(1)&&r.moveForwardsBy(4);return d(r),r.moveForwardsBy(4),r.carve()}},{name:"xz compression",extension:"xz",mime:"application/x-xz",description:"",signature:{0:253,1:55,2:122,3:88,4:90,5:0},extractor:function(e,t){var r=new o.a(e.slice(t));return r.continueUntil([0,0,0,0,4,89,90]),r.moveForwardsBy(7),r.carve()}},{name:"Tarball",extension:"tar.z",mime:"application/x-gtar",description:"",signature:{0:31,1:[157,160]},extractor:null},{name:"ISO disk image",extension:"iso",mime:"application/octet-stream",description:"ISO 9660 CD/DVD image file",signature:[{32769:67,32770:68,32771:48,32772:48,32773:49},{34817:67,34818:68,34819:48,34820:48,34821:49},{36865:67,36866:68,36867:48,36868:48,36869:49}],extractor:null},{name:"Virtual Machine Disk",extension:"vmdk",mime:"application/vmdk,application/x-virtualbox-vmdk",description:"",signature:{0:75,1:68,2:77,3:86,5:0,6:0,7:0},extractor:null},{name:"Virtual Hard Drive",extension:"vhd",mime:"application/x-vhd",description:"",signature:{0:99,1:111,2:110,3:101,4:99,5:116,6:105,7:120},extractor:null},{name:"Macintosh disk image",extension:"dmf,dmg",mime:"application/octet-stream",description:"",signature:{0:120,1:1,2:115,3:13,4:98,5:98,6:96,7:96},extractor:null},{name:"ARJ Archive",extension:"arj",mime:"application/x-arj-compressed",description:"",signature:{0:96,1:234,8:[0,16,20],9:0,10:2},extractor:null},{name:"WinAce Archive",extension:"ace",mime:"application/x-ace-compressed",description:"",signature:{7:42,8:42,9:65,10:67,11:69,12:42,13:42},extractor:null},{name:"Macintosh BinHex Encoded File",extension:"hqx",mime:"application/mac-binhex",description:"",signature:{11:109,12:117,13:115,14:116,15:32,16:98,17:101,18:32,19:99,20:111,21:110,22:118,23:101,24:114,25:116,26:101,27:100,28:32,29:119,30:105,31:116,32:104,33:32,34:66,35:105,36:110,37:72,38:101,39:120},extractor:null},{name:"ALZip Archive",extension:"alz",mime:"application/octet-stream",description:"",signature:{0:65,1:76,2:90,3:1,4:10,5:0,6:0,7:0},extractor:null},{name:"KGB Compressed Archive",extension:"kgb",mime:"application/x-kgb-compressed",description:"",signature:{0:75,1:71,2:66,3:95,4:97,5:114,6:99,7:104,8:32,9:45},extractor:null},{name:"Microsoft Cabinet",extension:"cab",mime:"vnd.ms-cab-compressed",description:"",signature:{0:77,1:83,2:67,3:70,4:0,5:0,6:0,7:0},extractor:null},{name:"Jar Archive",extension:"jar",mime:"application/java-archive",description:"",signature:{0:95,1:39,2:168,3:137},extractor:null},{name:"lzop compressed",extension:"lzop,lzo",mime:"application/x-lzop",description:"",signature:{0:137,1:76,2:90,3:79,4:0,5:13,6:10,7:26},extractor:null},{name:"Linux deb",extension:"deb",mime:"application/vnd.debian.binary-package",description:"",signature:{0:33,1:60,2:97,3:114,4:99,5:104,6:62},extractor:null},{name:"Apple Disk Image",extension:"dmg",mime:"application/x-apple-diskimage",description:"",signature:{0:120,1:1,2:115,3:13,4:98,5:98,6:96},extractor:null}],Miscellaneous:[{name:"UTF-8 text",extension:"txt",mime:"text/plain",description:"UTF-8 encoded Unicode byte order mark, commonly but not exclusively seen in text files.",signature:{0:239,1:187,2:191},extractor:null},{name:"UTF-32 LE text",extension:"utf32le",mime:"charset/utf32le",description:"Little-endian UTF-32 encoded Unicode byte order mark.",signature:{0:255,1:254,2:0,3:0},extractor:null},{name:"UTF-16 LE text",extension:"utf16le",mime:"charset/utf16le",description:"Little-endian UTF-16 encoded Unicode byte order mark.",signature:{0:255,1:254},extractor:null},{name:"Web Open Font Format",extension:"woff",mime:"application/font-woff",description:"",signature:{0:119,1:79,2:70,3:70,4:0,5:1,6:0,7:0},extractor:null},{name:"Web Open Font Format 2",extension:"woff2",mime:"application/font-woff",description:"",signature:{0:119,1:79,2:70,3:50,4:0,5:1,6:0,7:0},extractor:null},{name:"Embedded OpenType font",extension:"eot",mime:"application/octet-stream",description:"",signature:[{8:2,9:0,10:1,34:76,35:80},{8:1,9:0,10:0,34:76,35:80},{8:2,9:0,10:2,34:76,35:80}],extractor:null},{name:"TrueType Font",extension:"ttf",mime:"application/font-sfnt",description:"",signature:{0:0,1:1,2:0,3:0,4:0},extractor:null},{name:"OpenType Font",extension:"otf",mime:"application/font-sfnt",description:"",signature:{0:79,1:84,2:84,3:79,4:0},extractor:null},{name:"SQLite",extension:"sqlite",mime:"application/x-sqlite3",description:"",signature:{0:83,1:81,2:76,3:105},extractor:function(e,t){var r=new o.a(e.slice(t));r.moveTo(16);var n=r.readInt(2);r.moveTo(28);var i=r.readInt(4);return r.moveTo(n*i),r.carve()}},{name:"BitTorrent link",extension:"torrent",mime:"application/x-bittorrent",description:"",signature:[{0:100,1:56,2:58,3:97,4:110,5:110,6:111,7:117,8:110,9:99,10:101,11:35,12:35,13:58},{0:100,1:52,2:58,3:105,4:110,5:102,6:111,7:100,8:[52,53,54],9:58}],extractor:null},{name:"Cryptocurrency wallet",extension:"wallet",mime:"application/octet-stream",description:"",signature:{0:0,1:0,2:0,3:0,4:1,5:0,6:0,7:0,8:0,9:0,10:0,11:0,12:98,13:49,14:5,15:0},extractor:null},{name:"Registry fragment",extension:"hbin",mime:"application/octet-stream",description:"",signature:{0:104,1:98,2:105,3:110,4:0},extractor:null},{name:"Registry script",extension:"rgs",mime:"application/octet-stream",description:"",signature:{0:72,1:75,2:67,3:82,4:13,5:10,6:92,7:123},extractor:null},{name:"WinNT Registry Hive",extension:"registry",mime:"application/octet-stream",description:"",signature:{0:114,1:101,2:103,3:102},extractor:null},{name:"Windows Event Log",extension:"evt",mime:"application/octet-stream",description:"",signature:{0:48,1:0,2:0,3:0,4:76,5:102,6:76,7:101},extractor:function(e,t){var r=new o.a(e.slice(t));r.moveTo(20);var n=r.readInt(4,"le");r.moveTo(n);var i=r.readInt(4,"le");return r.moveForwardsBy(i-4),r.carve()}},{name:"Windows Event Log",extension:"evtx",mime:"application/octet-stream",description:"",signature:{0:69,1:108,2:102,3:70,4:105,5:108,6:101},extractor:function(e,t){var r=new o.a(e.slice(t));r.moveTo(40);var n=r.readInt(4,"le")-44;r.moveForwardsBy(n);for(;r.hasMore()&&r.getBytes(7).join("")===[69,108,102,67,104,110,107].join("");)r.moveForwardsBy(65529);return r.consumeWhile(0),r.carve()}},{name:"Windows Pagedump",extension:"dmp",mime:"application/octet-stream",description:"",signature:{0:80,1:65,2:71,3:69,4:68,5:85,6:[77,54],7:[80,52]},extractor:null},{name:"Windows Prefetch",extension:"pf",mime:"application/x-pf",description:"",signature:{0:[17,23,26],1:0,2:0,3:0,4:83,5:67,6:67,7:65},extractor:null},{name:"Windows Prefetch (Win 10)",extension:"pf",mime:"application/x-pf",description:"",signature:{0:77,1:65,2:77,3:4,7:0},extractor:null},{name:"PList (XML)",extension:"plist",mime:"application/xml",description:"",signature:{39:60,40:33,41:68,42:79,43:67,44:84,45:89,46:80,47:69,48:32,49:112,50:108,51:105,52:115,53:116},extractor:function(e,t){var r=new o.a(e.slice(t)),n=0;r.continueUntil([60,112,108,105,115,116]),r.moveForwardsBy(6),n++;for(;n>0&&r.hasMore();)60===r.readInt(1)&&(r.getBytes(5).join("")===[112,108,105,115,116].join("")?n++:r.moveBackwardsBy(5),r.getBytes(7).join("")===[47,112,108,105,115,116,62].join("")?n--:r.moveBackwardsBy(7));return r.consumeIf(10),r.carve()}},{name:"PList (binary)",extension:"bplist,plist,ipmeta,abcdp,mdbackup,mdinfo,strings,nib,ichat,qtz,webbookmark,webhistory",mime:"application/x-plist",description:"",signature:{0:98,1:112,2:108,3:105,4:115,5:116,6:48,7:48},extractor:null},{name:"MacOS X Keychain",extension:"keychain",mime:"application/octet-stream",description:"",signature:{0:107,1:121,2:99,3:104,4:0,5:1},extractor:null},{name:"TCP Packet",extension:"tcp",mime:"application/tcp",description:"",signature:{12:8,13:0,14:69,15:0,21:0,22:function(e){return e>=1&&e<=128},23:6},extractor:null},{name:"UDP Packet",extension:"udp",mime:"application/udp",description:"",signature:{12:8,13:0,14:69,15:0,16:[0,1,2,3,4,5],22:function(e){return e>=1&&e<=128},23:17},extractor:null},{name:"Compiled HTML",extension:"chm,chw,chi",mime:"application/vnd.ms-htmlhelp",description:"",signature:{0:73,1:84,2:83,3:70,4:3,5:0,6:0,7:0},extractor:null},{name:"Windows Password",extension:"pwl",mime:"application/octet-stream",description:"",signature:{0:227,1:130,2:133,3:150},extractor:null},{name:"Bitlocker recovery key",extension:"bitlocker",mime:"application/octet-stream",description:"",signature:{0:255,1:254,2:66,3:0,4:105,5:0,6:116,7:0,8:76,9:0,10:111,11:0,12:99,13:0,14:107,15:0,16:101,17:0,18:114,19:0,20:32,21:0},extractor:null},{name:"Certificate",extension:"cer,cat,p7b,p7c,p7m,p7s,swz,rsa,crl,crt,der",mime:"application/pkix-cert",description:"",signature:{0:48,1:130,4:[6,10,48]},extractor:null},{name:"Certificate",extension:"cat,swz,p7m",mime:"application/vnd.ms-pki.seccat",description:"",signature:{0:48,1:131,2:function(e){return 0!==e},5:6,6:9},extractor:null},{name:"PGP pubring",extension:"pkr,gpg",mime:"application/pgp-keys",description:"",signature:{0:153,1:1,2:[13,162],3:4},extractor:null},{name:"PGP secring",extension:"skr",mime:"application/pgp-keys",description:"",signature:[{0:149,1:1,2:207,3:4},{0:149,1:3,2:198,3:4}],extractor:null},{name:"PGP Safe",extension:"pgd",mime:"application/pgp-keys",description:"",signature:{0:80,1:71,2:80,3:100,4:77,5:65,6:73,7:78,8:96,9:1,10:0},extractor:null},{name:"Task Scheduler",extension:"job",mime:"application/octet-stream",description:"",signature:{0:[0,1,2,3],1:[5,6],2:1,3:0,20:70,21:0},extractor:null},{name:"Windows Shortcut",extension:"lnk",mime:"application/x-ms-shortcut",description:"",signature:{0:76,1:0,2:0,3:0,4:1,5:20,6:2,7:0,8:0,9:0,10:0,11:0,12:192,13:0,14:0,15:0,16:0,17:0,18:0,19:70},extractor:null},{name:"Bash",extension:"bash",mime:"application/bash",description:"",signature:{0:35,1:33,2:47,3:98,4:105,5:110,6:47,7:98,8:97,9:115,10:104},extractor:null},{name:"Shell",extension:"sh",mime:"application/sh",description:"",signature:{0:35,1:33,2:47,3:98,4:105,5:110,6:47,7:115,8:104},extractor:null},{name:"Python",extension:"py,pyc,pyd,pyo,pyw,pyz",mime:"application/python",description:"",signature:{0:35,1:33,2:47,3:117,4:115,5:114,6:47,7:98,8:105,9:110,10:47,11:112,12:121,13:116,14:104,15:111,16:110,17:[50,51,10,13]},extractor:null},{name:"Ruby",extension:"rb",mime:"application/ruby",description:"",signature:{0:35,1:33,2:47,3:117,4:115,5:114,6:47,7:98,8:105,9:110,10:47,11:114,12:117,13:98,14:121},extractor:null},{name:"perl",extension:"pl,pm,t,pod",mime:"application/perl",description:"",signature:{0:35,1:33,2:47,3:117,4:115,5:114,6:47,7:98,8:105,9:110,10:47,11:112,12:101,13:114,14:108},extractor:null},{name:"php",extension:"php,phtml,php3,php4,php5,php7,phps,php-s,pht,phar",mime:"application/php",description:"",signature:{0:60,1:63,2:112,3:104,4:112},extractor:null},{name:"Smile",extension:"sml",mime:"\tapplication/x-jackson-smile",description:"",signature:{0:58,1:41,2:10},extractor:null},{name:"Lua Bytecode",extension:"luac",mime:"application/x-lua",description:"",signature:{0:27,1:76,2:117,3:97},extractor:null},{name:"WebAssembly binary",extension:"wasm",mime:"application/octet-stream",description:"",signature:{0:0,1:97,2:115,3:109},extractor:null}]};function a(e,t){var r=new o.a(e.slice(t));r.continueUntil([80,75,5,6]),r.moveForwardsBy(20);var n=r.readInt(2,"le");return r.moveForwardsBy(n),r.carve()}function u(e,t){var r="207250237254",n="254237250207",i="206250237254";var s=new o.a(e.slice(t)),a=s.getBytes(4).join("");return s.moveTo(function(e,t,r){var n=28;t&&(n+=4),e.moveTo(16);var i=e.readInt(4,r);return function(e,t,r,n){for(var i=0,o=0;o<n;o++){e.moveTo(t);var s=e.readInt(4,r);25===s?(e.moveTo(t+48),i+=e.readInt(8,r),e.moveTo(t+4),t+=e.readInt(4,r)):1===s&&(e.moveTo(t+36),i+=e.readInt(4,r),e.moveTo(t+4),t+=e.readInt(4,r))}return i}(e,n,r,i)}(s,function(e){return e===r||e===n}(a),function(e){return e===i||e===r}(a)?"le":"be")),s.carve()}for(var c=new Array(288),f=0;f<c.length;f++)c[f]=f<=143?8:f<=255?9:f<=279?7:8;var l=_(c),h=_(new Array(30).fill(5)),p=[16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15];function d(e){for(var t=0;!t;){t=e.readBits(1);var r=e.readBits(2);if(0===r){e.moveForwardsBy(1);var n=e.readInt(2,"le");e.moveForwardsBy(2+n)}else if(1===r)g(e,l,h);else{if(2!==r)throw new Error(`Invalid block type while parsing DEFLATE stream at pos ${e.position}`);for(var i=e.readBits(5)+257,o=e.readBits(5)+1,s=e.readBits(4)+4,a=new Uint8Array(p.length),u=0;u<s;u++)a[p[u]]=e.readBits(3);for(var c=_(a),f=new Uint8Array(i+o),d=void 0,y=void 0,m=void 0,b=0;b<i+o;)switch(d=v(e,c)){case 16:for(y=3+e.readBits(2);y--;)f[b++]=m;break;case 17:for(y=3+e.readBits(3);y--;)f[b++]=0;m=0;break;case 18:for(y=11+e.readBits(7);y--;)f[b++]=0;m=0;break;default:f[b++]=d,m=d}g(e,_(f.subarray(0,i)),_(f.subarray(i)))}}e.bitPos>0&&e.moveForwardsBy(1)}var y=[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],m=[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];function g(e,t,r){for(var n,i=0;(n=v(e,t))&&256!==n;){if(++i>1e4)throw new Error("Caught in probable infinite loop while parsing Huffman Block");n<256||(e.readBits(y[n-257]),n=v(e,r),e.readBits(m[n]))}}function _(e){for(var t=Math.max.apply(Math,e),r=Math.min.apply(Math,e),n=1<<t,i=new Uint32Array(n),o=1,s=0,a=2;o<=t;){for(var u=0;u<e.length;u++)if(e[u]===o){var c=void 0,f=void 0,l=void 0;for(c=0,f=s,l=0;l<o;l++)c=c<<1|1&f,f>>=1;for(var h=o<<16|u,p=c;p<n;p+=a)i[p]=h;s++}o++,s<<=1,a<<=1}return[i,t,r]}function v(e,t){var r=i()(t,2),n=r[0],o=r[1],s=n[e.readBits(o)&(1<<o)-1],a=s>>>16;if(a>o)throw new Error(`Invalid Huffman Code length while parsing DEFLATE block at pos ${e.position}: ${a}`);return e.moveBackwardsByBits(o-a),65535&s}r(0);
/**
 * File type functions
 *
 * @author n1474335 [n1474335@gmail.com]
 * @copyright Crown Copyright 2018
 * @license Apache-2.0
 *
 */
function b(e,t){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0;if(e.length){for(var n=0;n<e.length;n++)if(w(e[n],t,r))return!0;return!1}return w(e,t,r)}function w(e,t){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0;for(var n in e){var i=parseInt(n,10)+r;switch(typeof e[n]){case"number":if(t[i]!==e[n])return!1;break;case"object":if(e[n].indexOf(t[i])<0)return!1;break;case"function":if(!e[n](t[i]))return!1;break;default:throw new Error(`Unrecognised signature type at offset ${n}`)}}return!0}function E(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:Object.keys(s);if(e instanceof ArrayBuffer&&(e=new Uint8Array(e)),!(e&&e.length>1))return[];var r=[],n={};for(var i in s)t.includes(i)&&(n[i]=s[i]);for(var o in n){n[o].forEach((function(t){b(t.signature,e)&&r.push(t)}))}return r}function B(e){return function(e,t){var r=E(t);if(!r||!r.length)return!1;if("string"==typeof e)return r.reduce((function(t,r){var n=!!r.mime.startsWith(e)&&r.mime;return t||n}),!1);if(e instanceof RegExp)return r.reduce((function(t,r){var n=!!e.test(r.mime)&&r.mime;return t||n}),!1);throw new Error("Invalid type input.")}("image",e)}r.d(t,"a",(function(){return E})),r.d(t,"b",(function(){return B}))},198:function(e,t,r){"use strict";e.exports=function(e,t,r,n){for(var i=65535&e|0,o=e>>>16&65535|0,s=0;0!==r;){r-=s=r>2e3?2e3:r;do{o=o+(i=i+t[n++]|0)|0}while(--s);i%=65521,o%=65521}return i|o<<16|0}},199:function(e,t,r){"use strict";var n=function(){for(var e,t=[],r=0;r<256;r++){e=r;for(var n=0;n<8;n++)e=1&e?3988292384^e>>>1:e>>>1;t[r]=e}return t}();e.exports=function(e,t,r,i){var o=n,s=i+r;e^=-1;for(var a=i;a<s;a++)e=e>>>8^o[255&(e^t[a])];return-1^e}},2:function(e,t){function r(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}e.exports=function(e,t,n){return t&&r(e.prototype,t),n&&r(e,n),e}},21:function(e,t,r){var n=r(11),i=n.Buffer;function o(e,t){for(var r in e)t[r]=e[r]}function s(e,t,r){return i(e,t,r)}i.from&&i.alloc&&i.allocUnsafe&&i.allocUnsafeSlow?e.exports=n:(o(n,t),t.Buffer=s),o(i,s),s.from=function(e,t,r){if("number"==typeof e)throw new TypeError("Argument must not be a number");return i(e,t,r)},s.alloc=function(e,t,r){if("number"!=typeof e)throw new TypeError("Argument must be a number");var n=i(e);return void 0!==t?"string"==typeof r?n.fill(t,r):n.fill(t):n.fill(0),n},s.allocUnsafe=function(e){if("number"!=typeof e)throw new TypeError("Argument must be a number");return i(e)},s.allocUnsafeSlow=function(e){if("number"!=typeof e)throw new TypeError("Argument must be a number");return n.SlowBuffer(e)}},217:function(e,t){e.exports=function(e){return e&&"object"==typeof e&&"function"==typeof e.copy&&"function"==typeof e.fill&&"function"==typeof e.readUInt8}},218:function(e,t){"function"==typeof Object.create?e.exports=function(e,t){e.super_=t,e.prototype=Object.create(t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}})}:e.exports=function(e,t){e.super_=t;var r=function(){};r.prototype=t.prototype,e.prototype=new r,e.prototype.constructor=e}},22:function(e,t){e.exports=function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}},23:function(e,t,r){!function(e){var t,r,n,i=String.fromCharCode;function o(e){for(var t,r,n=[],i=0,o=e.length;i<o;)(t=e.charCodeAt(i++))>=55296&&t<=56319&&i<o?56320==(64512&(r=e.charCodeAt(i++)))?n.push(((1023&t)<<10)+(1023&r)+65536):(n.push(t),i--):n.push(t);return n}function s(e){if(e>=55296&&e<=57343)throw Error("Lone surrogate U+"+e.toString(16).toUpperCase()+" is not a scalar value")}function a(e,t){return i(e>>t&63|128)}function u(e){if(0==(4294967168&e))return i(e);var t="";return 0==(4294965248&e)?t=i(e>>6&31|192):0==(4294901760&e)?(s(e),t=i(e>>12&15|224),t+=a(e,6)):0==(4292870144&e)&&(t=i(e>>18&7|240),t+=a(e,12),t+=a(e,6)),t+=i(63&e|128)}function c(){if(n>=r)throw Error("Invalid byte index");var e=255&t[n];if(n++,128==(192&e))return 63&e;throw Error("Invalid continuation byte")}function f(){var e,i;if(n>r)throw Error("Invalid byte index");if(n==r)return!1;if(e=255&t[n],n++,0==(128&e))return e;if(192==(224&e)){if((i=(31&e)<<6|c())>=128)return i;throw Error("Invalid continuation byte")}if(224==(240&e)){if((i=(15&e)<<12|c()<<6|c())>=2048)return s(i),i;throw Error("Invalid continuation byte")}if(240==(248&e)&&(i=(7&e)<<18|c()<<12|c()<<6|c())>=65536&&i<=1114111)return i;throw Error("Invalid UTF-8 detected")}e.version="3.0.0",e.encode=function(e){for(var t=o(e),r=t.length,n=-1,i="";++n<r;)i+=u(t[n]);return i},e.decode=function(e){t=o(e),r=t.length,n=0;for(var s,a=[];!1!==(s=f());)a.push(s);return function(e){for(var t,r=e.length,n=-1,o="";++n<r;)(t=e[n])>65535&&(o+=i((t-=65536)>>>10&1023|55296),t=56320|1023&t),o+=i(t);return o}(a)}}(t)},24:function(e,t,r){var n,i;!function(o,s){"use strict";void 0===(i="function"==typeof(n=function(){var e=function(){},t="undefined",r=typeof window!==t&&/Trident\/|MSIE /.test(window.navigator.userAgent),n=["trace","debug","info","warn","error"];function i(e,t){var r=e[t];if("function"==typeof r.bind)return r.bind(e);try{return Function.prototype.bind.call(r,e)}catch(t){return function(){return Function.prototype.apply.apply(r,[e,arguments])}}}function o(){console.log&&(console.log.apply?console.log.apply(console,arguments):Function.prototype.apply.apply(console.log,[console,arguments])),console.trace&&console.trace()}function s(t,r){for(var i=0;i<n.length;i++){var o=n[i];this[o]=i<t?e:this.methodFactory(o,t,r)}this.log=this.debug}function a(e,r,n){return function(){typeof console!==t&&(s.call(this,r,n),this[e].apply(this,arguments))}}function u(n,s,u){return function(n){return"debug"===n&&(n="log"),typeof console!==t&&("trace"===n&&r?o:void 0!==console[n]?i(console,n):void 0!==console.log?i(console,"log"):e)}(n)||a.apply(this,arguments)}function c(e,r,i){var o,a=this,c="loglevel";function f(){var e;if(typeof window!==t){try{e=window.localStorage[c]}catch(e){}if(typeof e===t)try{var r=window.document.cookie,n=r.indexOf(encodeURIComponent(c)+"=");-1!==n&&(e=/^([^;]+)/.exec(r.slice(n))[1])}catch(e){}return void 0===a.levels[e]&&(e=void 0),e}}e&&(c+=":"+e),a.name=e,a.levels={TRACE:0,DEBUG:1,INFO:2,WARN:3,ERROR:4,SILENT:5},a.methodFactory=i||u,a.getLevel=function(){return o},a.setLevel=function(r,i){if("string"==typeof r&&void 0!==a.levels[r.toUpperCase()]&&(r=a.levels[r.toUpperCase()]),!("number"==typeof r&&r>=0&&r<=a.levels.SILENT))throw"log.setLevel() called with invalid level: "+r;if(o=r,!1!==i&&function(e){var r=(n[e]||"silent").toUpperCase();if(typeof window!==t){try{return void(window.localStorage[c]=r)}catch(e){}try{window.document.cookie=encodeURIComponent(c)+"="+r+";"}catch(e){}}}(r),s.call(a,r,e),typeof console===t&&r<a.levels.SILENT)return"No console available for logging"},a.setDefaultLevel=function(e){f()||a.setLevel(e,!1)},a.enableAll=function(e){a.setLevel(a.levels.TRACE,e)},a.disableAll=function(e){a.setLevel(a.levels.SILENT,e)};var l=f();null==l&&(l=null==r?"WARN":r),a.setLevel(l,!1)}var f=new c,l={};f.getLogger=function(e){if("string"!=typeof e||""===e)throw new TypeError("You must supply a name when creating a logger.");var t=l[e];return t||(t=l[e]=new c(e,f.getLevel(),f.methodFactory)),t};var h=typeof window!==t?window.log:void 0;return f.noConflict=function(){return typeof window!==t&&window.log===f&&(window.log=h),f},f.getLoggers=function(){return l},f})?n.call(t,r,t,e):n)||(e.exports=i)}()},243:function(e,t,r){"use strict";(function(t){var n=r(1384),i=r(64),o=new c(4096);function s(e){return"function"==typeof t.alloc?t.alloc(e):new t(e)}function a(e,r){return"function"==typeof t.from?t.from(e,r):new t(e,r)}function u(e){return e.charAt(0).toUpperCase()+e.slice(1)}function c(e){this._len=0|e,this._pos=0,this._slab=s(this._len)}function f(e){var t=Math.pow(2,31),r=Math.floor(e||Math.random()*(t-1));this._max=t,this._nextInt=function(){return r=(1103515245*r+12345)%t}}function l(){this._index=0,this._items=[]}function h(e,t){if(this.buf=e,this.pos=0|t,this.pos<0)throw new Error("negative offset")}function p(e,t){for(;t--;)e[t]=~e[t]}c.prototype.alloc=function(e){if(e<0)throw new Error("negative length");var t=this._len;return e>t?s(e):(this._pos+e>t&&(this._slab=s(t),this._pos=0),this._slab.slice(this._pos,this._pos+=e))},f.prototype.nextBoolean=function(){return!!(this._nextInt()%2)},f.prototype.nextInt=function(e,t){return void 0===t&&(t=e,e=0),t=void 0===t?this._max:t,e+Math.floor(this.nextFloat()*(t-e))},f.prototype.nextFloat=function(e,t){return void 0===t&&(t=e,e=0),e+((t=void 0===t?1:t)-e)*this._nextInt()/this._max},f.prototype.nextString=function(e,t){e|=0;var r="";(t=t||"aA").indexOf("a")>-1&&(r+="abcdefghijklmnopqrstuvwxyz"),t.indexOf("A")>-1&&(r+="ABCDEFGHIJKLMNOPQRSTUVWXYZ"),t.indexOf("#")>-1&&(r+="0123456789"),t.indexOf("!")>-1&&(r+="~`!@#$%^&*()_+-={}[]:\";'<>?,./|\\");for(var n=[],i=0;i<e;i++)n.push(this.choice(r));return n.join("")},f.prototype.nextBuffer=function(e){var t,r=[];for(t=0;t<e;t++)r.push(this.nextInt(256));return a(r)},f.prototype.choice=function(e){var t=e.length;if(!t)throw new Error("choosing from empty array");return e[this.nextInt(t)]},l.prototype.push=function(e){var t,r=this._items,n=0|r.length;for(r.push(e);n>0&&r[n].index<r[t=n-1>>1].index;)e=r[n],r[n]=r[t],r[t]=e,n=t},l.prototype.pop=function(){var e=this._items,t=e.length-1|0,r=e[0];if(!r||r.index>this._index)return null;if(this._index++,!t)return e.pop(),r;e[0]=e.pop();for(var n,i,o,s,a,u,c,f=t>>1,l=0;l<f&&(s=e[l],i=l+1<<1,u=e[n=1+(l<<1)],!(c=e[i])||u.index<=c.index?(a=u,o=n):(a=c,o=i),!(a.index>=s.index));)e[o]=s,e[l]=a,l=o;return r},h.prototype.isValid=function(){return this.pos<=this.buf.length},h.prototype._invalidate=function(){this.pos=this.buf.length+1},h.prototype.readBoolean=function(){return!!this.buf[this.pos++]},h.prototype.skipBoolean=function(){this.pos++},h.prototype.writeBoolean=function(e){this.buf[this.pos++]=!!e},h.prototype.readInt=h.prototype.readLong=function(){var e,t,r,n,i=0,o=0,s=this.buf;do{t=128&(e=s[this.pos++]),i|=(127&e)<<o,o+=7}while(t&&o<28);if(t){r=i,n=268435456;do{r+=(127&(e=s[this.pos++]))*n,n*=128}while(128&e);return(r%2?-(r+1):r)/2}return i>>1^-(1&i)},h.prototype.skipInt=h.prototype.skipLong=function(){for(var e=this.buf;128&e[this.pos++];);},h.prototype.writeInt=h.prototype.writeLong=function(e){var t,r,n=this.buf;if(e>=-1073741824&&e<1073741824){r=e>=0?e<<1:~e<<1|1;do{n[this.pos]=127&r,r>>=7}while(r&&(n[this.pos++]|=128))}else{t=e>=0?2*e:2*-e-1;do{n[this.pos]=127&t,t/=128}while(t>=1&&(n[this.pos++]|=128))}this.pos++},h.prototype.readFloat=function(){var e=this.buf,t=this.pos;return this.pos+=4,this.pos>e.length?0:this.buf.readFloatLE(t)},h.prototype.skipFloat=function(){this.pos+=4},h.prototype.writeFloat=function(e){var t=this.buf,r=this.pos;if(this.pos+=4,!(this.pos>t.length))return this.buf.writeFloatLE(e,r)},h.prototype.readDouble=function(){var e=this.buf,t=this.pos;return this.pos+=8,this.pos>e.length?0:this.buf.readDoubleLE(t)},h.prototype.skipDouble=function(){this.pos+=8},h.prototype.writeDouble=function(e){var t=this.buf,r=this.pos;if(this.pos+=8,!(this.pos>t.length))return this.buf.writeDoubleLE(e,r)},h.prototype.readFixed=function(e){var t=this.pos;if(this.pos+=e,!(this.pos>this.buf.length)){var r=o.alloc(e);return this.buf.copy(r,0,t,t+e),r}},h.prototype.skipFixed=function(e){this.pos+=e},h.prototype.writeFixed=function(e,t){t=t||e.length;var r=this.pos;this.pos+=t,this.pos>this.buf.length||e.copy(this.buf,r,0,t)},h.prototype.readBytes=function(){var e=this.readLong();if(!(e<0))return this.readFixed(e);this._invalidate()},h.prototype.skipBytes=function(){var e=this.readLong();e<0?this._invalidate():this.pos+=e},h.prototype.writeBytes=function(e){var t=e.length;this.writeLong(t),this.writeFixed(e,t)},"function"==typeof t.prototype.utf8Slice?h.prototype.readString=function(){var e=this.readLong();if(e<0)return this._invalidate(),"";var t=this.pos,r=this.buf;return this.pos+=e,this.pos>r.length?void 0:this.buf.utf8Slice(t,t+e)}:h.prototype.readString=function(){var e=this.readLong();if(e<0)return this._invalidate(),"";var t=this.pos,r=this.buf;return this.pos+=e,this.pos>r.length?void 0:this.buf.slice(t,t+e).toString()},h.prototype.skipString=function(){var e=this.readLong();e<0?this._invalidate():this.pos+=e},h.prototype.writeString=function(e){var r=t.byteLength(e),n=this.buf;this.writeLong(r);var i,o,s,a,u=this.pos;if(this.pos+=r,!(this.pos>n.length))if(r>64&&"function"==typeof t.prototype.utf8Write)n.utf8Write(e,u,r);else for(i=0,o=r;i<o;i++)(s=e.charCodeAt(i))<128?n[u++]=s:s<2048?(n[u++]=s>>6|192,n[u++]=63&s|128):55296==(64512&s)&&56320==(64512&(a=e.charCodeAt(i+1)))?(s=65536+((1023&s)<<10)+(1023&a),i++,n[u++]=s>>18|240,n[u++]=s>>12&63|128,n[u++]=s>>6&63|128,n[u++]=63&s|128):(n[u++]=s>>12|224,n[u++]=s>>6&63|128,n[u++]=63&s|128)},"function"==typeof t.prototype.latin1Write?h.prototype.writeBinary=function(e,t){var r=this.pos;this.pos+=t,this.pos>this.buf.length||this.buf.latin1Write(e,r,t)}:"function"==typeof t.prototype.binaryWrite?h.prototype.writeBinary=function(e,t){var r=this.pos;this.pos+=t,this.pos>this.buf.length||this.buf.binaryWrite(e,r,t)}:h.prototype.writeBinary=function(e,t){var r=this.pos;this.pos+=t,this.pos>this.buf.length||this.buf.write(e,r,t,"binary")},h.prototype.matchBoolean=function(e){return this.buf[this.pos++]-e.buf[e.pos++]},h.prototype.matchInt=h.prototype.matchLong=function(e){var t=this.readLong(),r=e.readLong();return t===r?0:t<r?-1:1},h.prototype.matchFloat=function(e){var t=this.readFloat(),r=e.readFloat();return t===r?0:t<r?-1:1},h.prototype.matchDouble=function(e){var t=this.readDouble(),r=e.readDouble();return t===r?0:t<r?-1:1},h.prototype.matchFixed=function(e,t){return this.readFixed(t).compare(e.readFixed(t))},h.prototype.matchBytes=h.prototype.matchString=function(e){var t=this.readLong(),r=this.pos;this.pos+=t;var n=e.readLong(),i=e.pos;e.pos+=n;var o=this.buf.slice(r,this.pos),s=e.buf.slice(i,e.pos);return o.compare(s)},h.prototype.unpackLongBytes=function(){var e,t,r=s(8),n=0,i=0,o=6,a=this.buf;for(t=1&(e=a[this.pos++]),r.fill(0),n|=(127&e)>>1;128&e;)n|=(127&(e=a[this.pos++]))<<o,(o+=7)>=8&&(o-=8,r[i++]=n,n>>=8);return r[i]=n,t&&p(r,8),r},h.prototype.packLongBytes=function(e){var t,r=(128&e[7])>>7,n=this.buf,i=1,o=0,s=3;r?(p(e,8),t=1):t=0;for(var a=[e.readUIntLE(0,3),e.readUIntLE(3,3),e.readUIntLE(6,2)];s&&!a[--s];);for(;o<s;)for(t|=a[o++]<<i,i+=24;i>7;)n[this.pos++]=127&t|128,t>>=7,i-=7;t|=a[s]<<i;do{n[this.pos]=127&t,t>>=7}while(t&&(n[this.pos++]|=128));this.pos++,r&&p(e,8)},e.exports={abstractFunction:function(){throw new Error("abstract")},addDeprecatedGetters:function(e,t){var r,n,o,s,a=e.prototype;for(r=0,n=t.length;r<n;r++)a[s="get"+u(o=t[r])]=i.deprecate(c(o),"use `."+o+"` instead of `."+s+"()`");function c(e){return function(){var t=this[e];return"function"==typeof t?t.apply(this,arguments):t}}},bufferFrom:a,capitalize:u,copyOwnProperties:function(e,t,r){var n,i,o,s=Object.getOwnPropertyNames(e);for(n=0,i=s.length;n<i;n++)if(o=s[n],!t.hasOwnProperty(o)||r){var a=Object.getOwnPropertyDescriptor(e,o);Object.defineProperty(t,o,a)}return t},getHash:function(e,t){t=t||"md5";var r=n.createHash(t);return r.end(e),r.read()},compare:function(e,t){return e===t?0:e<t?-1:1},getOption:function(e,t,r){var n=e[t];return void 0===n?r:n},jsonEnd:function(e,t){t|=0;var r=e.charAt(t++);if(/[\d-]/.test(r)){for(;/[eE\d.+-]/.test(e.charAt(t));)t++;return t}if(/true|null/.test(e.slice(t-1,t+3)))return t+3;if(/false/.test(e.slice(t-1,t+4)))return t+4;var n=0,i=!1;do{switch(r){case"{":case"[":i||n++;break;case"}":case"]":if(!i&&!--n)return t;break;case'"':if(i=!i,!n&&!i)return t;break;case"\\":t++}}while(r=e.charAt(t++));return-1},newBuffer:s,objectValues:function(e){return Object.keys(e).map((function(t){return e[t]}))},toMap:function(e,t){var r,n,i={};for(r=0;r<e.length;r++)i[t(n=e[r])]=n;return i},singleIndexOf:function(e,t){var r,n,i=-1;if(!e)return-1;for(r=0,n=e.length;r<n;r++)if(e[r]===t){if(i>=0)return-2;i=r}return i},hasDuplicates:function(e,t){var r,n,i,o=Object.create(null);for(r=0,n=e.length;r<n;r++){if(i=e[r],t&&(i=t(i)),o[i])return!0;o[i]=!0}return!1},BufferPool:c,Lcg:f,OrderedQueue:l,Tap:h}}).call(this,r(11).Buffer)},25:function(e,t){var r,n,i=e.exports={};function o(){throw new Error("setTimeout has not been defined")}function s(){throw new Error("clearTimeout has not been defined")}function a(e){if(r===setTimeout)return setTimeout(e,0);if((r===o||!r)&&setTimeout)return r=setTimeout,setTimeout(e,0);try{return r(e,0)}catch(t){try{return r.call(null,e,0)}catch(t){return r.call(this,e,0)}}}!function(){try{r="function"==typeof setTimeout?setTimeout:o}catch(e){r=o}try{n="function"==typeof clearTimeout?clearTimeout:s}catch(e){n=s}}();var u,c=[],f=!1,l=-1;function h(){f&&u&&(f=!1,u.length?c=u.concat(c):l=-1,c.length&&p())}function p(){if(!f){var e=a(h);f=!0;for(var t=c.length;t;){for(u=c,c=[];++l<t;)u&&u[l].run();l=-1,t=c.length}u=null,f=!1,function(e){if(n===clearTimeout)return clearTimeout(e);if((n===s||!n)&&clearTimeout)return n=clearTimeout,clearTimeout(e);try{n(e)}catch(t){try{return n.call(null,e)}catch(t){return n.call(this,e)}}}(e)}}function d(e,t){this.fun=e,this.array=t}function y(){}i.nextTick=function(e){var t=new Array(arguments.length-1);if(arguments.length>1)for(var r=1;r<arguments.length;r++)t[r-1]=arguments[r];c.push(new d(e,t)),1!==c.length||f||a(p)},d.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=y,i.addListener=y,i.once=y,i.off=y,i.removeListener=y,i.removeAllListeners=y,i.emit=y,i.prependListener=y,i.prependOnceListener=y,i.listeners=function(e){return[]},i.binding=function(e){throw new Error("process.binding is not supported")},i.cwd=function(){return"/"},i.chdir=function(e){throw new Error("process.chdir is not supported")},i.umask=function(){return 0}},26:function(e,t){var r;r=function(){return this}();try{r=r||new Function("return this")()}catch(e){"object"==typeof window&&(r=window)}e.exports=r},27:function(e,t,r){"use strict";r.d(t,"a",(function(){return i}));var n=r(0);
/**
 * Binary functions.
 *
 * @author n1474335 [n1474335@gmail.com]
 * @copyright Crown Copyright 2018
 * @license Apache-2.0
 */function i(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"Space",r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:8,i=n.b.regexRep(t);e=e.replace(i,"");for(var o=[],s=0;s<e.length;s+=r)o.push(parseInt(e.substr(s,r),2));return o}},273:function(e,t,r){(function(e){function r(e,t){for(var r=0,n=e.length-1;n>=0;n--){var i=e[n];"."===i?e.splice(n,1):".."===i?(e.splice(n,1),r++):r&&(e.splice(n,1),r--)}if(t)for(;r--;r)e.unshift("..");return e}function n(e,t){if(e.filter)return e.filter(t);for(var r=[],n=0;n<e.length;n++)t(e[n],n,e)&&r.push(e[n]);return r}t.resolve=function(){for(var t="",i=!1,o=arguments.length-1;o>=-1&&!i;o--){var s=o>=0?arguments[o]:e.cwd();if("string"!=typeof s)throw new TypeError("Arguments to path.resolve must be strings");s&&(t=s+"/"+t,i="/"===s.charAt(0))}return(i?"/":"")+(t=r(n(t.split("/"),(function(e){return!!e})),!i).join("/"))||"."},t.normalize=function(e){var o=t.isAbsolute(e),s="/"===i(e,-1);return(e=r(n(e.split("/"),(function(e){return!!e})),!o).join("/"))||o||(e="."),e&&s&&(e+="/"),(o?"/":"")+e},t.isAbsolute=function(e){return"/"===e.charAt(0)},t.join=function(){var e=Array.prototype.slice.call(arguments,0);return t.normalize(n(e,(function(e,t){if("string"!=typeof e)throw new TypeError("Arguments to path.join must be strings");return e})).join("/"))},t.relative=function(e,r){function n(e){for(var t=0;t<e.length&&""===e[t];t++);for(var r=e.length-1;r>=0&&""===e[r];r--);return t>r?[]:e.slice(t,r-t+1)}e=t.resolve(e).substr(1),r=t.resolve(r).substr(1);for(var i=n(e.split("/")),o=n(r.split("/")),s=Math.min(i.length,o.length),a=s,u=0;u<s;u++)if(i[u]!==o[u]){a=u;break}var c=[];for(u=a;u<i.length;u++)c.push("..");return(c=c.concat(o.slice(a))).join("/")},t.sep="/",t.delimiter=":",t.dirname=function(e){if("string"!=typeof e&&(e+=""),0===e.length)return".";for(var t=e.charCodeAt(0),r=47===t,n=-1,i=!0,o=e.length-1;o>=1;--o)if(47===(t=e.charCodeAt(o))){if(!i){n=o;break}}else i=!1;return-1===n?r?"/":".":r&&1===n?"/":e.slice(0,n)},t.basename=function(e,t){var r=function(e){"string"!=typeof e&&(e+="");var t,r=0,n=-1,i=!0;for(t=e.length-1;t>=0;--t)if(47===e.charCodeAt(t)){if(!i){r=t+1;break}}else-1===n&&(i=!1,n=t+1);return-1===n?"":e.slice(r,n)}(e);return t&&r.substr(-1*t.length)===t&&(r=r.substr(0,r.length-t.length)),r},t.extname=function(e){"string"!=typeof e&&(e+="");for(var t=-1,r=0,n=-1,i=!0,o=0,s=e.length-1;s>=0;--s){var a=e.charCodeAt(s);if(47!==a)-1===n&&(i=!1,n=s+1),46===a?-1===t?t=s:1!==o&&(o=1):-1!==t&&(o=-1);else if(!i){r=s+1;break}}return-1===t||-1===n||0===o||1===o&&t===n-1&&t===r+1?"":e.slice(t,n)};var i="b"==="ab".substr(-1)?function(e,t,r){return e.substr(t,r)}:function(e,t,r){return t<0&&(t=e.length+t),e.substr(t,r)}}).call(this,r(25))},28:function(e,t,r){"use strict";r.d(t,"a",(function(){return i}));var n=r(0);
/**
 * Decimal functions.
 *
 * @author n1474335 [n1474335@gmail.com]
 * @copyright Crown Copyright 2018
 * @license Apache-2.0
 */function i(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"Auto";t=n.b.charRep(t);var r=[],i=e.split(t);""===i[i.length-1]&&(i=i.slice(0,i.length-1));for(var o=0;o<i.length;o++)r[o]=parseInt(i[o],10);return r}},3:function(e,t){function r(t){return e.exports=r=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)},r(t)}e.exports=r},342:function(e,t,r){"use strict";(function(e){var n=r(11).Buffer,i=r(68).Transform,o=r(343),s=r(64),a=r(112).ok,u=r(11).kMaxLength,c="Cannot create final Buffer. It would be larger than 0x"+u.toString(16)+" bytes";o.Z_MIN_WINDOWBITS=8,o.Z_MAX_WINDOWBITS=15,o.Z_DEFAULT_WINDOWBITS=15,o.Z_MIN_CHUNK=64,o.Z_MAX_CHUNK=1/0,o.Z_DEFAULT_CHUNK=16384,o.Z_MIN_MEMLEVEL=1,o.Z_MAX_MEMLEVEL=9,o.Z_DEFAULT_MEMLEVEL=8,o.Z_MIN_LEVEL=-1,o.Z_MAX_LEVEL=9,o.Z_DEFAULT_LEVEL=o.Z_DEFAULT_COMPRESSION;for(var f=Object.keys(o),l=0;l<f.length;l++){var h=f[l];h.match(/^Z/)&&Object.defineProperty(t,h,{enumerable:!0,value:o[h],writable:!1})}for(var p={Z_OK:o.Z_OK,Z_STREAM_END:o.Z_STREAM_END,Z_NEED_DICT:o.Z_NEED_DICT,Z_ERRNO:o.Z_ERRNO,Z_STREAM_ERROR:o.Z_STREAM_ERROR,Z_DATA_ERROR:o.Z_DATA_ERROR,Z_MEM_ERROR:o.Z_MEM_ERROR,Z_BUF_ERROR:o.Z_BUF_ERROR,Z_VERSION_ERROR:o.Z_VERSION_ERROR},d=Object.keys(p),y=0;y<d.length;y++){var m=d[y];p[p[m]]=m}function g(e,t,r){var i=[],o=0;function s(){for(var t;null!==(t=e.read());)i.push(t),o+=t.length;e.once("readable",s)}function a(){var t,s=null;o>=u?s=new RangeError(c):t=n.concat(i,o),i=[],e.close(),r(s,t)}e.on("error",(function(t){e.removeListener("end",a),e.removeListener("readable",s),r(t)})),e.on("end",a),e.end(t),s()}function _(e,t){if("string"==typeof t&&(t=n.from(t)),!n.isBuffer(t))throw new TypeError("Not a string or buffer");var r=e._finishFlushFlag;return e._processChunk(t,r)}function v(e){if(!(this instanceof v))return new v(e);T.call(this,e,o.DEFLATE)}function b(e){if(!(this instanceof b))return new b(e);T.call(this,e,o.INFLATE)}function w(e){if(!(this instanceof w))return new w(e);T.call(this,e,o.GZIP)}function E(e){if(!(this instanceof E))return new E(e);T.call(this,e,o.GUNZIP)}function B(e){if(!(this instanceof B))return new B(e);T.call(this,e,o.DEFLATERAW)}function A(e){if(!(this instanceof A))return new A(e);T.call(this,e,o.INFLATERAW)}function S(e){if(!(this instanceof S))return new S(e);T.call(this,e,o.UNZIP)}function x(e){return e===o.Z_NO_FLUSH||e===o.Z_PARTIAL_FLUSH||e===o.Z_SYNC_FLUSH||e===o.Z_FULL_FLUSH||e===o.Z_FINISH||e===o.Z_BLOCK}function T(e,r){var s=this;if(this._opts=e=e||{},this._chunkSize=e.chunkSize||t.Z_DEFAULT_CHUNK,i.call(this,e),e.flush&&!x(e.flush))throw new Error("Invalid flush flag: "+e.flush);if(e.finishFlush&&!x(e.finishFlush))throw new Error("Invalid flush flag: "+e.finishFlush);if(this._flushFlag=e.flush||o.Z_NO_FLUSH,this._finishFlushFlag=void 0!==e.finishFlush?e.finishFlush:o.Z_FINISH,e.chunkSize&&(e.chunkSize<t.Z_MIN_CHUNK||e.chunkSize>t.Z_MAX_CHUNK))throw new Error("Invalid chunk size: "+e.chunkSize);if(e.windowBits&&(e.windowBits<t.Z_MIN_WINDOWBITS||e.windowBits>t.Z_MAX_WINDOWBITS))throw new Error("Invalid windowBits: "+e.windowBits);if(e.level&&(e.level<t.Z_MIN_LEVEL||e.level>t.Z_MAX_LEVEL))throw new Error("Invalid compression level: "+e.level);if(e.memLevel&&(e.memLevel<t.Z_MIN_MEMLEVEL||e.memLevel>t.Z_MAX_MEMLEVEL))throw new Error("Invalid memLevel: "+e.memLevel);if(e.strategy&&e.strategy!=t.Z_FILTERED&&e.strategy!=t.Z_HUFFMAN_ONLY&&e.strategy!=t.Z_RLE&&e.strategy!=t.Z_FIXED&&e.strategy!=t.Z_DEFAULT_STRATEGY)throw new Error("Invalid strategy: "+e.strategy);if(e.dictionary&&!n.isBuffer(e.dictionary))throw new Error("Invalid dictionary: it should be a Buffer instance");this._handle=new o.Zlib(r);var a=this;this._hadError=!1,this._handle.onerror=function(e,r){N(a),a._hadError=!0;var n=new Error(e);n.errno=r,n.code=t.codes[r],a.emit("error",n)};var u=t.Z_DEFAULT_COMPRESSION;"number"==typeof e.level&&(u=e.level);var c=t.Z_DEFAULT_STRATEGY;"number"==typeof e.strategy&&(c=e.strategy),this._handle.init(e.windowBits||t.Z_DEFAULT_WINDOWBITS,u,e.memLevel||t.Z_DEFAULT_MEMLEVEL,c,e.dictionary),this._buffer=n.allocUnsafe(this._chunkSize),this._offset=0,this._level=u,this._strategy=c,this.once("end",this.close),Object.defineProperty(this,"_closed",{get:function(){return!s._handle},configurable:!0,enumerable:!0})}function N(t,r){r&&e.nextTick(r),t._handle&&(t._handle.close(),t._handle=null)}function O(e){e.emit("close")}Object.defineProperty(t,"codes",{enumerable:!0,value:Object.freeze(p),writable:!1}),t.Deflate=v,t.Inflate=b,t.Gzip=w,t.Gunzip=E,t.DeflateRaw=B,t.InflateRaw=A,t.Unzip=S,t.createDeflate=function(e){return new v(e)},t.createInflate=function(e){return new b(e)},t.createDeflateRaw=function(e){return new B(e)},t.createInflateRaw=function(e){return new A(e)},t.createGzip=function(e){return new w(e)},t.createGunzip=function(e){return new E(e)},t.createUnzip=function(e){return new S(e)},t.deflate=function(e,t,r){return"function"==typeof t&&(r=t,t={}),g(new v(t),e,r)},t.deflateSync=function(e,t){return _(new v(t),e)},t.gzip=function(e,t,r){return"function"==typeof t&&(r=t,t={}),g(new w(t),e,r)},t.gzipSync=function(e,t){return _(new w(t),e)},t.deflateRaw=function(e,t,r){return"function"==typeof t&&(r=t,t={}),g(new B(t),e,r)},t.deflateRawSync=function(e,t){return _(new B(t),e)},t.unzip=function(e,t,r){return"function"==typeof t&&(r=t,t={}),g(new S(t),e,r)},t.unzipSync=function(e,t){return _(new S(t),e)},t.inflate=function(e,t,r){return"function"==typeof t&&(r=t,t={}),g(new b(t),e,r)},t.inflateSync=function(e,t){return _(new b(t),e)},t.gunzip=function(e,t,r){return"function"==typeof t&&(r=t,t={}),g(new E(t),e,r)},t.gunzipSync=function(e,t){return _(new E(t),e)},t.inflateRaw=function(e,t,r){return"function"==typeof t&&(r=t,t={}),g(new A(t),e,r)},t.inflateRawSync=function(e,t){return _(new A(t),e)},s.inherits(T,i),T.prototype.params=function(r,n,i){if(r<t.Z_MIN_LEVEL||r>t.Z_MAX_LEVEL)throw new RangeError("Invalid compression level: "+r);if(n!=t.Z_FILTERED&&n!=t.Z_HUFFMAN_ONLY&&n!=t.Z_RLE&&n!=t.Z_FIXED&&n!=t.Z_DEFAULT_STRATEGY)throw new TypeError("Invalid strategy: "+n);if(this._level!==r||this._strategy!==n){var s=this;this.flush(o.Z_SYNC_FLUSH,(function(){a(s._handle,"zlib binding closed"),s._handle.params(r,n),s._hadError||(s._level=r,s._strategy=n,i&&i())}))}else e.nextTick(i)},T.prototype.reset=function(){return a(this._handle,"zlib binding closed"),this._handle.reset()},T.prototype._flush=function(e){this._transform(n.alloc(0),"",e)},T.prototype.flush=function(t,r){var i=this,s=this._writableState;("function"==typeof t||void 0===t&&!r)&&(r=t,t=o.Z_FULL_FLUSH),s.ended?r&&e.nextTick(r):s.ending?r&&this.once("end",r):s.needDrain?r&&this.once("drain",(function(){return i.flush(t,r)})):(this._flushFlag=t,this.write(n.alloc(0),"",r))},T.prototype.close=function(t){N(this,t),e.nextTick(O,this)},T.prototype._transform=function(e,t,r){var i,s=this._writableState,a=(s.ending||s.ended)&&(!e||s.length===e.length);return null===e||n.isBuffer(e)?this._handle?(a?i=this._finishFlushFlag:(i=this._flushFlag,e.length>=s.length&&(this._flushFlag=this._opts.flush||o.Z_NO_FLUSH)),void this._processChunk(e,i,r)):r(new Error("zlib binding closed")):r(new Error("invalid input"))},T.prototype._processChunk=function(e,t,r){var i=e&&e.length,o=this._chunkSize-this._offset,s=0,f=this,l="function"==typeof r;if(!l){var h,p=[],d=0;this.on("error",(function(e){h=e})),a(this._handle,"zlib binding closed");do{var y=this._handle.writeSync(t,e,s,i,this._buffer,this._offset,o)}while(!this._hadError&&_(y[0],y[1]));if(this._hadError)throw h;if(d>=u)throw N(this),new RangeError(c);var m=n.concat(p,d);return N(this),m}a(this._handle,"zlib binding closed");var g=this._handle.write(t,e,s,i,this._buffer,this._offset,o);function _(u,c){if(this&&(this.buffer=null,this.callback=null),!f._hadError){var h=o-c;if(a(h>=0,"have should not go down"),h>0){var y=f._buffer.slice(f._offset,f._offset+h);f._offset+=h,l?f.push(y):(p.push(y),d+=y.length)}if((0===c||f._offset>=f._chunkSize)&&(o=f._chunkSize,f._offset=0,f._buffer=n.allocUnsafe(f._chunkSize)),0===c){if(s+=i-u,i=u,!l)return!0;var m=f._handle.write(t,e,s,i,f._buffer,f._offset,f._chunkSize);return m.callback=_,void(m.buffer=e)}if(!l)return!1;r()}}g.buffer=e,g.callback=_},s.inherits(v,T),s.inherits(b,T),s.inherits(w,T),s.inherits(E,T),s.inherits(B,T),s.inherits(A,T),s.inherits(S,T)}).call(this,r(25))},343:function(e,t,r){"use strict";(function(e,n){var i=r(112),o=r(344),s=r(345),a=r(348),u=r(351);for(var c in u)t[c]=u[c];t.NONE=0,t.DEFLATE=1,t.INFLATE=2,t.GZIP=3,t.GUNZIP=4,t.DEFLATERAW=5,t.INFLATERAW=6,t.UNZIP=7;function f(e){if("number"!=typeof e||e<t.DEFLATE||e>t.UNZIP)throw new TypeError("Bad argument");this.dictionary=null,this.err=0,this.flush=0,this.init_done=!1,this.level=0,this.memLevel=0,this.mode=e,this.strategy=0,this.windowBits=0,this.write_in_progress=!1,this.pending_close=!1,this.gzip_id_bytes_read=0}f.prototype.close=function(){this.write_in_progress?this.pending_close=!0:(this.pending_close=!1,i(this.init_done,"close before init"),i(this.mode<=t.UNZIP),this.mode===t.DEFLATE||this.mode===t.GZIP||this.mode===t.DEFLATERAW?s.deflateEnd(this.strm):this.mode!==t.INFLATE&&this.mode!==t.GUNZIP&&this.mode!==t.INFLATERAW&&this.mode!==t.UNZIP||a.inflateEnd(this.strm),this.mode=t.NONE,this.dictionary=null)},f.prototype.write=function(e,t,r,n,i,o,s){return this._write(!0,e,t,r,n,i,o,s)},f.prototype.writeSync=function(e,t,r,n,i,o,s){return this._write(!1,e,t,r,n,i,o,s)},f.prototype._write=function(r,o,s,a,u,c,f,l){if(i.equal(arguments.length,8),i(this.init_done,"write before init"),i(this.mode!==t.NONE,"already finalized"),i.equal(!1,this.write_in_progress,"write already in progress"),i.equal(!1,this.pending_close,"close is pending"),this.write_in_progress=!0,i.equal(!1,void 0===o,"must provide flush value"),this.write_in_progress=!0,o!==t.Z_NO_FLUSH&&o!==t.Z_PARTIAL_FLUSH&&o!==t.Z_SYNC_FLUSH&&o!==t.Z_FULL_FLUSH&&o!==t.Z_FINISH&&o!==t.Z_BLOCK)throw new Error("Invalid flush value");if(null==s&&(s=e.alloc(0),u=0,a=0),this.strm.avail_in=u,this.strm.input=s,this.strm.next_in=a,this.strm.avail_out=l,this.strm.output=c,this.strm.next_out=f,this.flush=o,!r)return this._process(),this._checkError()?this._afterSync():void 0;var h=this;return n.nextTick((function(){h._process(),h._after()})),this},f.prototype._afterSync=function(){var e=this.strm.avail_out,t=this.strm.avail_in;return this.write_in_progress=!1,[t,e]},f.prototype._process=function(){var e=null;switch(this.mode){case t.DEFLATE:case t.GZIP:case t.DEFLATERAW:this.err=s.deflate(this.strm,this.flush);break;case t.UNZIP:switch(this.strm.avail_in>0&&(e=this.strm.next_in),this.gzip_id_bytes_read){case 0:if(null===e)break;if(31!==this.strm.input[e]){this.mode=t.INFLATE;break}if(this.gzip_id_bytes_read=1,e++,1===this.strm.avail_in)break;case 1:if(null===e)break;139===this.strm.input[e]?(this.gzip_id_bytes_read=2,this.mode=t.GUNZIP):this.mode=t.INFLATE;break;default:throw new Error("invalid number of gzip magic number bytes read")}case t.INFLATE:case t.GUNZIP:case t.INFLATERAW:for(this.err=a.inflate(this.strm,this.flush),this.err===t.Z_NEED_DICT&&this.dictionary&&(this.err=a.inflateSetDictionary(this.strm,this.dictionary),this.err===t.Z_OK?this.err=a.inflate(this.strm,this.flush):this.err===t.Z_DATA_ERROR&&(this.err=t.Z_NEED_DICT));this.strm.avail_in>0&&this.mode===t.GUNZIP&&this.err===t.Z_STREAM_END&&0!==this.strm.next_in[0];)this.reset(),this.err=a.inflate(this.strm,this.flush);break;default:throw new Error("Unknown mode "+this.mode)}},f.prototype._checkError=function(){switch(this.err){case t.Z_OK:case t.Z_BUF_ERROR:if(0!==this.strm.avail_out&&this.flush===t.Z_FINISH)return this._error("unexpected end of file"),!1;break;case t.Z_STREAM_END:break;case t.Z_NEED_DICT:return null==this.dictionary?this._error("Missing dictionary"):this._error("Bad dictionary"),!1;default:return this._error("Zlib error"),!1}return!0},f.prototype._after=function(){if(this._checkError()){var e=this.strm.avail_out,t=this.strm.avail_in;this.write_in_progress=!1,this.callback(t,e),this.pending_close&&this.close()}},f.prototype._error=function(e){this.strm.msg&&(e=this.strm.msg),this.onerror(e,this.err),this.write_in_progress=!1,this.pending_close&&this.close()},f.prototype.init=function(e,r,n,o,s){i(4===arguments.length||5===arguments.length,"init(windowBits, level, memLevel, strategy, [dictionary])"),i(e>=8&&e<=15,"invalid windowBits"),i(r>=-1&&r<=9,"invalid compression level"),i(n>=1&&n<=9,"invalid memlevel"),i(o===t.Z_FILTERED||o===t.Z_HUFFMAN_ONLY||o===t.Z_RLE||o===t.Z_FIXED||o===t.Z_DEFAULT_STRATEGY,"invalid strategy"),this._init(r,e,n,o,s),this._setDictionary()},f.prototype.params=function(){throw new Error("deflateParams Not supported")},f.prototype.reset=function(){this._reset(),this._setDictionary()},f.prototype._init=function(e,r,n,i,u){switch(this.level=e,this.windowBits=r,this.memLevel=n,this.strategy=i,this.flush=t.Z_NO_FLUSH,this.err=t.Z_OK,this.mode!==t.GZIP&&this.mode!==t.GUNZIP||(this.windowBits+=16),this.mode===t.UNZIP&&(this.windowBits+=32),this.mode!==t.DEFLATERAW&&this.mode!==t.INFLATERAW||(this.windowBits=-1*this.windowBits),this.strm=new o,this.mode){case t.DEFLATE:case t.GZIP:case t.DEFLATERAW:this.err=s.deflateInit2(this.strm,this.level,t.Z_DEFLATED,this.windowBits,this.memLevel,this.strategy);break;case t.INFLATE:case t.GUNZIP:case t.INFLATERAW:case t.UNZIP:this.err=a.inflateInit2(this.strm,this.windowBits);break;default:throw new Error("Unknown mode "+this.mode)}this.err!==t.Z_OK&&this._error("Init error"),this.dictionary=u,this.write_in_progress=!1,this.init_done=!0},f.prototype._setDictionary=function(){if(null!=this.dictionary){switch(this.err=t.Z_OK,this.mode){case t.DEFLATE:case t.DEFLATERAW:this.err=s.deflateSetDictionary(this.strm,this.dictionary)}this.err!==t.Z_OK&&this._error("Failed to set dictionary")}},f.prototype._reset=function(){switch(this.err=t.Z_OK,this.mode){case t.DEFLATE:case t.DEFLATERAW:case t.GZIP:this.err=s.deflateReset(this.strm);break;case t.INFLATE:case t.INFLATERAW:case t.GUNZIP:this.err=a.inflateReset(this.strm)}this.err!==t.Z_OK&&this._error("Failed to reset stream")},t.Zlib=f}).call(this,r(11).Buffer,r(25))},344:function(e,t,r){"use strict";e.exports=function(){this.input=null,this.next_in=0,this.avail_in=0,this.total_in=0,this.output=null,this.next_out=0,this.avail_out=0,this.total_out=0,this.msg="",this.state=null,this.data_type=2,this.adler=0}},345:function(e,t,r){"use strict";var n,i=r(108),o=r(346),s=r(198),a=r(199),u=r(347),c=0,f=1,l=3,h=4,p=5,d=0,y=1,m=-2,g=-3,_=-5,v=-1,b=1,w=2,E=3,B=4,A=0,S=2,x=8,T=9,N=15,O=8,k=286,I=30,F=19,D=2*k+1,R=15,C=3,L=258,P=L+C+1,j=32,M=42,U=69,z=73,$=91,Y=103,H=113,q=666,Z=1,V=2,J=3,G=4,W=3;function X(e,t){return e.msg=u[t],t}function K(e){return(e<<1)-(e>4?9:0)}function Q(e){for(var t=e.length;--t>=0;)e[t]=0}function ee(e){var t=e.state,r=t.pending;r>e.avail_out&&(r=e.avail_out),0!==r&&(i.arraySet(e.output,t.pending_buf,t.pending_out,r,e.next_out),e.next_out+=r,t.pending_out+=r,e.total_out+=r,e.avail_out-=r,t.pending-=r,0===t.pending&&(t.pending_out=0))}function te(e,t){o._tr_flush_block(e,e.block_start>=0?e.block_start:-1,e.strstart-e.block_start,t),e.block_start=e.strstart,ee(e.strm)}function re(e,t){e.pending_buf[e.pending++]=t}function ne(e,t){e.pending_buf[e.pending++]=t>>>8&255,e.pending_buf[e.pending++]=255&t}function ie(e,t){var r,n,i=e.max_chain_length,o=e.strstart,s=e.prev_length,a=e.nice_match,u=e.strstart>e.w_size-P?e.strstart-(e.w_size-P):0,c=e.window,f=e.w_mask,l=e.prev,h=e.strstart+L,p=c[o+s-1],d=c[o+s];e.prev_length>=e.good_match&&(i>>=2),a>e.lookahead&&(a=e.lookahead);do{if(c[(r=t)+s]===d&&c[r+s-1]===p&&c[r]===c[o]&&c[++r]===c[o+1]){o+=2,r++;do{}while(c[++o]===c[++r]&&c[++o]===c[++r]&&c[++o]===c[++r]&&c[++o]===c[++r]&&c[++o]===c[++r]&&c[++o]===c[++r]&&c[++o]===c[++r]&&c[++o]===c[++r]&&o<h);if(n=L-(h-o),o=h-L,n>s){if(e.match_start=t,s=n,n>=a)break;p=c[o+s-1],d=c[o+s]}}}while((t=l[t&f])>u&&0!=--i);return s<=e.lookahead?s:e.lookahead}function oe(e){var t,r,n,o,u,c,f,l,h,p,d=e.w_size;do{if(o=e.window_size-e.lookahead-e.strstart,e.strstart>=d+(d-P)){i.arraySet(e.window,e.window,d,d,0),e.match_start-=d,e.strstart-=d,e.block_start-=d,t=r=e.hash_size;do{n=e.head[--t],e.head[t]=n>=d?n-d:0}while(--r);t=r=d;do{n=e.prev[--t],e.prev[t]=n>=d?n-d:0}while(--r);o+=d}if(0===e.strm.avail_in)break;if(c=e.strm,f=e.window,l=e.strstart+e.lookahead,h=o,p=void 0,(p=c.avail_in)>h&&(p=h),r=0===p?0:(c.avail_in-=p,i.arraySet(f,c.input,c.next_in,p,l),1===c.state.wrap?c.adler=s(c.adler,f,p,l):2===c.state.wrap&&(c.adler=a(c.adler,f,p,l)),c.next_in+=p,c.total_in+=p,p),e.lookahead+=r,e.lookahead+e.insert>=C)for(u=e.strstart-e.insert,e.ins_h=e.window[u],e.ins_h=(e.ins_h<<e.hash_shift^e.window[u+1])&e.hash_mask;e.insert&&(e.ins_h=(e.ins_h<<e.hash_shift^e.window[u+C-1])&e.hash_mask,e.prev[u&e.w_mask]=e.head[e.ins_h],e.head[e.ins_h]=u,u++,e.insert--,!(e.lookahead+e.insert<C)););}while(e.lookahead<P&&0!==e.strm.avail_in)}function se(e,t){for(var r,n;;){if(e.lookahead<P){if(oe(e),e.lookahead<P&&t===c)return Z;if(0===e.lookahead)break}if(r=0,e.lookahead>=C&&(e.ins_h=(e.ins_h<<e.hash_shift^e.window[e.strstart+C-1])&e.hash_mask,r=e.prev[e.strstart&e.w_mask]=e.head[e.ins_h],e.head[e.ins_h]=e.strstart),0!==r&&e.strstart-r<=e.w_size-P&&(e.match_length=ie(e,r)),e.match_length>=C)if(n=o._tr_tally(e,e.strstart-e.match_start,e.match_length-C),e.lookahead-=e.match_length,e.match_length<=e.max_lazy_match&&e.lookahead>=C){e.match_length--;do{e.strstart++,e.ins_h=(e.ins_h<<e.hash_shift^e.window[e.strstart+C-1])&e.hash_mask,r=e.prev[e.strstart&e.w_mask]=e.head[e.ins_h],e.head[e.ins_h]=e.strstart}while(0!=--e.match_length);e.strstart++}else e.strstart+=e.match_length,e.match_length=0,e.ins_h=e.window[e.strstart],e.ins_h=(e.ins_h<<e.hash_shift^e.window[e.strstart+1])&e.hash_mask;else n=o._tr_tally(e,0,e.window[e.strstart]),e.lookahead--,e.strstart++;if(n&&(te(e,!1),0===e.strm.avail_out))return Z}return e.insert=e.strstart<C-1?e.strstart:C-1,t===h?(te(e,!0),0===e.strm.avail_out?J:G):e.last_lit&&(te(e,!1),0===e.strm.avail_out)?Z:V}function ae(e,t){for(var r,n,i;;){if(e.lookahead<P){if(oe(e),e.lookahead<P&&t===c)return Z;if(0===e.lookahead)break}if(r=0,e.lookahead>=C&&(e.ins_h=(e.ins_h<<e.hash_shift^e.window[e.strstart+C-1])&e.hash_mask,r=e.prev[e.strstart&e.w_mask]=e.head[e.ins_h],e.head[e.ins_h]=e.strstart),e.prev_length=e.match_length,e.prev_match=e.match_start,e.match_length=C-1,0!==r&&e.prev_length<e.max_lazy_match&&e.strstart-r<=e.w_size-P&&(e.match_length=ie(e,r),e.match_length<=5&&(e.strategy===b||e.match_length===C&&e.strstart-e.match_start>4096)&&(e.match_length=C-1)),e.prev_length>=C&&e.match_length<=e.prev_length){i=e.strstart+e.lookahead-C,n=o._tr_tally(e,e.strstart-1-e.prev_match,e.prev_length-C),e.lookahead-=e.prev_length-1,e.prev_length-=2;do{++e.strstart<=i&&(e.ins_h=(e.ins_h<<e.hash_shift^e.window[e.strstart+C-1])&e.hash_mask,r=e.prev[e.strstart&e.w_mask]=e.head[e.ins_h],e.head[e.ins_h]=e.strstart)}while(0!=--e.prev_length);if(e.match_available=0,e.match_length=C-1,e.strstart++,n&&(te(e,!1),0===e.strm.avail_out))return Z}else if(e.match_available){if((n=o._tr_tally(e,0,e.window[e.strstart-1]))&&te(e,!1),e.strstart++,e.lookahead--,0===e.strm.avail_out)return Z}else e.match_available=1,e.strstart++,e.lookahead--}return e.match_available&&(n=o._tr_tally(e,0,e.window[e.strstart-1]),e.match_available=0),e.insert=e.strstart<C-1?e.strstart:C-1,t===h?(te(e,!0),0===e.strm.avail_out?J:G):e.last_lit&&(te(e,!1),0===e.strm.avail_out)?Z:V}function ue(e,t,r,n,i){this.good_length=e,this.max_lazy=t,this.nice_length=r,this.max_chain=n,this.func=i}function ce(){this.strm=null,this.status=0,this.pending_buf=null,this.pending_buf_size=0,this.pending_out=0,this.pending=0,this.wrap=0,this.gzhead=null,this.gzindex=0,this.method=x,this.last_flush=-1,this.w_size=0,this.w_bits=0,this.w_mask=0,this.window=null,this.window_size=0,this.prev=null,this.head=null,this.ins_h=0,this.hash_size=0,this.hash_bits=0,this.hash_mask=0,this.hash_shift=0,this.block_start=0,this.match_length=0,this.prev_match=0,this.match_available=0,this.strstart=0,this.match_start=0,this.lookahead=0,this.prev_length=0,this.max_chain_length=0,this.max_lazy_match=0,this.level=0,this.strategy=0,this.good_match=0,this.nice_match=0,this.dyn_ltree=new i.Buf16(2*D),this.dyn_dtree=new i.Buf16(2*(2*I+1)),this.bl_tree=new i.Buf16(2*(2*F+1)),Q(this.dyn_ltree),Q(this.dyn_dtree),Q(this.bl_tree),this.l_desc=null,this.d_desc=null,this.bl_desc=null,this.bl_count=new i.Buf16(R+1),this.heap=new i.Buf16(2*k+1),Q(this.heap),this.heap_len=0,this.heap_max=0,this.depth=new i.Buf16(2*k+1),Q(this.depth),this.l_buf=0,this.lit_bufsize=0,this.last_lit=0,this.d_buf=0,this.opt_len=0,this.static_len=0,this.matches=0,this.insert=0,this.bi_buf=0,this.bi_valid=0}function fe(e){var t;return e&&e.state?(e.total_in=e.total_out=0,e.data_type=S,(t=e.state).pending=0,t.pending_out=0,t.wrap<0&&(t.wrap=-t.wrap),t.status=t.wrap?M:H,e.adler=2===t.wrap?0:1,t.last_flush=c,o._tr_init(t),d):X(e,m)}function le(e){var t,r=fe(e);return r===d&&((t=e.state).window_size=2*t.w_size,Q(t.head),t.max_lazy_match=n[t.level].max_lazy,t.good_match=n[t.level].good_length,t.nice_match=n[t.level].nice_length,t.max_chain_length=n[t.level].max_chain,t.strstart=0,t.block_start=0,t.lookahead=0,t.insert=0,t.match_length=t.prev_length=C-1,t.match_available=0,t.ins_h=0),r}function he(e,t,r,n,o,s){if(!e)return m;var a=1;if(t===v&&(t=6),n<0?(a=0,n=-n):n>15&&(a=2,n-=16),o<1||o>T||r!==x||n<8||n>15||t<0||t>9||s<0||s>B)return X(e,m);8===n&&(n=9);var u=new ce;return e.state=u,u.strm=e,u.wrap=a,u.gzhead=null,u.w_bits=n,u.w_size=1<<u.w_bits,u.w_mask=u.w_size-1,u.hash_bits=o+7,u.hash_size=1<<u.hash_bits,u.hash_mask=u.hash_size-1,u.hash_shift=~~((u.hash_bits+C-1)/C),u.window=new i.Buf8(2*u.w_size),u.head=new i.Buf16(u.hash_size),u.prev=new i.Buf16(u.w_size),u.lit_bufsize=1<<o+6,u.pending_buf_size=4*u.lit_bufsize,u.pending_buf=new i.Buf8(u.pending_buf_size),u.d_buf=1*u.lit_bufsize,u.l_buf=3*u.lit_bufsize,u.level=t,u.strategy=s,u.method=r,le(e)}n=[new ue(0,0,0,0,(function(e,t){var r=65535;for(r>e.pending_buf_size-5&&(r=e.pending_buf_size-5);;){if(e.lookahead<=1){if(oe(e),0===e.lookahead&&t===c)return Z;if(0===e.lookahead)break}e.strstart+=e.lookahead,e.lookahead=0;var n=e.block_start+r;if((0===e.strstart||e.strstart>=n)&&(e.lookahead=e.strstart-n,e.strstart=n,te(e,!1),0===e.strm.avail_out))return Z;if(e.strstart-e.block_start>=e.w_size-P&&(te(e,!1),0===e.strm.avail_out))return Z}return e.insert=0,t===h?(te(e,!0),0===e.strm.avail_out?J:G):(e.strstart>e.block_start&&(te(e,!1),e.strm.avail_out),Z)})),new ue(4,4,8,4,se),new ue(4,5,16,8,se),new ue(4,6,32,32,se),new ue(4,4,16,16,ae),new ue(8,16,32,32,ae),new ue(8,16,128,128,ae),new ue(8,32,128,256,ae),new ue(32,128,258,1024,ae),new ue(32,258,258,4096,ae)],t.deflateInit=function(e,t){return he(e,t,x,N,O,A)},t.deflateInit2=he,t.deflateReset=le,t.deflateResetKeep=fe,t.deflateSetHeader=function(e,t){return e&&e.state?2!==e.state.wrap?m:(e.state.gzhead=t,d):m},t.deflate=function(e,t){var r,i,s,u;if(!e||!e.state||t>p||t<0)return e?X(e,m):m;if(i=e.state,!e.output||!e.input&&0!==e.avail_in||i.status===q&&t!==h)return X(e,0===e.avail_out?_:m);if(i.strm=e,r=i.last_flush,i.last_flush=t,i.status===M)if(2===i.wrap)e.adler=0,re(i,31),re(i,139),re(i,8),i.gzhead?(re(i,(i.gzhead.text?1:0)+(i.gzhead.hcrc?2:0)+(i.gzhead.extra?4:0)+(i.gzhead.name?8:0)+(i.gzhead.comment?16:0)),re(i,255&i.gzhead.time),re(i,i.gzhead.time>>8&255),re(i,i.gzhead.time>>16&255),re(i,i.gzhead.time>>24&255),re(i,9===i.level?2:i.strategy>=w||i.level<2?4:0),re(i,255&i.gzhead.os),i.gzhead.extra&&i.gzhead.extra.length&&(re(i,255&i.gzhead.extra.length),re(i,i.gzhead.extra.length>>8&255)),i.gzhead.hcrc&&(e.adler=a(e.adler,i.pending_buf,i.pending,0)),i.gzindex=0,i.status=U):(re(i,0),re(i,0),re(i,0),re(i,0),re(i,0),re(i,9===i.level?2:i.strategy>=w||i.level<2?4:0),re(i,W),i.status=H);else{var g=x+(i.w_bits-8<<4)<<8;g|=(i.strategy>=w||i.level<2?0:i.level<6?1:6===i.level?2:3)<<6,0!==i.strstart&&(g|=j),g+=31-g%31,i.status=H,ne(i,g),0!==i.strstart&&(ne(i,e.adler>>>16),ne(i,65535&e.adler)),e.adler=1}if(i.status===U)if(i.gzhead.extra){for(s=i.pending;i.gzindex<(65535&i.gzhead.extra.length)&&(i.pending!==i.pending_buf_size||(i.gzhead.hcrc&&i.pending>s&&(e.adler=a(e.adler,i.pending_buf,i.pending-s,s)),ee(e),s=i.pending,i.pending!==i.pending_buf_size));)re(i,255&i.gzhead.extra[i.gzindex]),i.gzindex++;i.gzhead.hcrc&&i.pending>s&&(e.adler=a(e.adler,i.pending_buf,i.pending-s,s)),i.gzindex===i.gzhead.extra.length&&(i.gzindex=0,i.status=z)}else i.status=z;if(i.status===z)if(i.gzhead.name){s=i.pending;do{if(i.pending===i.pending_buf_size&&(i.gzhead.hcrc&&i.pending>s&&(e.adler=a(e.adler,i.pending_buf,i.pending-s,s)),ee(e),s=i.pending,i.pending===i.pending_buf_size)){u=1;break}u=i.gzindex<i.gzhead.name.length?255&i.gzhead.name.charCodeAt(i.gzindex++):0,re(i,u)}while(0!==u);i.gzhead.hcrc&&i.pending>s&&(e.adler=a(e.adler,i.pending_buf,i.pending-s,s)),0===u&&(i.gzindex=0,i.status=$)}else i.status=$;if(i.status===$)if(i.gzhead.comment){s=i.pending;do{if(i.pending===i.pending_buf_size&&(i.gzhead.hcrc&&i.pending>s&&(e.adler=a(e.adler,i.pending_buf,i.pending-s,s)),ee(e),s=i.pending,i.pending===i.pending_buf_size)){u=1;break}u=i.gzindex<i.gzhead.comment.length?255&i.gzhead.comment.charCodeAt(i.gzindex++):0,re(i,u)}while(0!==u);i.gzhead.hcrc&&i.pending>s&&(e.adler=a(e.adler,i.pending_buf,i.pending-s,s)),0===u&&(i.status=Y)}else i.status=Y;if(i.status===Y&&(i.gzhead.hcrc?(i.pending+2>i.pending_buf_size&&ee(e),i.pending+2<=i.pending_buf_size&&(re(i,255&e.adler),re(i,e.adler>>8&255),e.adler=0,i.status=H)):i.status=H),0!==i.pending){if(ee(e),0===e.avail_out)return i.last_flush=-1,d}else if(0===e.avail_in&&K(t)<=K(r)&&t!==h)return X(e,_);if(i.status===q&&0!==e.avail_in)return X(e,_);if(0!==e.avail_in||0!==i.lookahead||t!==c&&i.status!==q){var v=i.strategy===w?function(e,t){for(var r;;){if(0===e.lookahead&&(oe(e),0===e.lookahead)){if(t===c)return Z;break}if(e.match_length=0,r=o._tr_tally(e,0,e.window[e.strstart]),e.lookahead--,e.strstart++,r&&(te(e,!1),0===e.strm.avail_out))return Z}return e.insert=0,t===h?(te(e,!0),0===e.strm.avail_out?J:G):e.last_lit&&(te(e,!1),0===e.strm.avail_out)?Z:V}(i,t):i.strategy===E?function(e,t){for(var r,n,i,s,a=e.window;;){if(e.lookahead<=L){if(oe(e),e.lookahead<=L&&t===c)return Z;if(0===e.lookahead)break}if(e.match_length=0,e.lookahead>=C&&e.strstart>0&&(n=a[i=e.strstart-1])===a[++i]&&n===a[++i]&&n===a[++i]){s=e.strstart+L;do{}while(n===a[++i]&&n===a[++i]&&n===a[++i]&&n===a[++i]&&n===a[++i]&&n===a[++i]&&n===a[++i]&&n===a[++i]&&i<s);e.match_length=L-(s-i),e.match_length>e.lookahead&&(e.match_length=e.lookahead)}if(e.match_length>=C?(r=o._tr_tally(e,1,e.match_length-C),e.lookahead-=e.match_length,e.strstart+=e.match_length,e.match_length=0):(r=o._tr_tally(e,0,e.window[e.strstart]),e.lookahead--,e.strstart++),r&&(te(e,!1),0===e.strm.avail_out))return Z}return e.insert=0,t===h?(te(e,!0),0===e.strm.avail_out?J:G):e.last_lit&&(te(e,!1),0===e.strm.avail_out)?Z:V}(i,t):n[i.level].func(i,t);if(v!==J&&v!==G||(i.status=q),v===Z||v===J)return 0===e.avail_out&&(i.last_flush=-1),d;if(v===V&&(t===f?o._tr_align(i):t!==p&&(o._tr_stored_block(i,0,0,!1),t===l&&(Q(i.head),0===i.lookahead&&(i.strstart=0,i.block_start=0,i.insert=0))),ee(e),0===e.avail_out))return i.last_flush=-1,d}return t!==h?d:i.wrap<=0?y:(2===i.wrap?(re(i,255&e.adler),re(i,e.adler>>8&255),re(i,e.adler>>16&255),re(i,e.adler>>24&255),re(i,255&e.total_in),re(i,e.total_in>>8&255),re(i,e.total_in>>16&255),re(i,e.total_in>>24&255)):(ne(i,e.adler>>>16),ne(i,65535&e.adler)),ee(e),i.wrap>0&&(i.wrap=-i.wrap),0!==i.pending?d:y)},t.deflateEnd=function(e){var t;return e&&e.state?(t=e.state.status)!==M&&t!==U&&t!==z&&t!==$&&t!==Y&&t!==H&&t!==q?X(e,m):(e.state=null,t===H?X(e,g):d):m},t.deflateSetDictionary=function(e,t){var r,n,o,a,u,c,f,l,h=t.length;if(!e||!e.state)return m;if(2===(a=(r=e.state).wrap)||1===a&&r.status!==M||r.lookahead)return m;for(1===a&&(e.adler=s(e.adler,t,h,0)),r.wrap=0,h>=r.w_size&&(0===a&&(Q(r.head),r.strstart=0,r.block_start=0,r.insert=0),l=new i.Buf8(r.w_size),i.arraySet(l,t,h-r.w_size,r.w_size,0),t=l,h=r.w_size),u=e.avail_in,c=e.next_in,f=e.input,e.avail_in=h,e.next_in=0,e.input=t,oe(r);r.lookahead>=C;){n=r.strstart,o=r.lookahead-(C-1);do{r.ins_h=(r.ins_h<<r.hash_shift^r.window[n+C-1])&r.hash_mask,r.prev[n&r.w_mask]=r.head[r.ins_h],r.head[r.ins_h]=n,n++}while(--o);r.strstart=n,r.lookahead=C-1,oe(r)}return r.strstart+=r.lookahead,r.block_start=r.strstart,r.insert=r.lookahead,r.lookahead=0,r.match_length=r.prev_length=C-1,r.match_available=0,e.next_in=c,e.input=f,e.avail_in=u,r.wrap=a,d},t.deflateInfo="pako deflate (from Nodeca project)"},346:function(e,t,r){"use strict";var n=r(108),i=4,o=0,s=1,a=2;function u(e){for(var t=e.length;--t>=0;)e[t]=0}var c=0,f=1,l=2,h=29,p=256,d=p+1+h,y=30,m=19,g=2*d+1,_=15,v=16,b=7,w=256,E=16,B=17,A=18,S=[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],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],T=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,3,7],N=[16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15],O=new Array(2*(d+2));u(O);var k=new Array(2*y);u(k);var I=new Array(512);u(I);var F=new Array(256);u(F);var D=new Array(h);u(D);var R,C,L,P=new Array(y);function j(e,t,r,n,i){this.static_tree=e,this.extra_bits=t,this.extra_base=r,this.elems=n,this.max_length=i,this.has_stree=e&&e.length}function M(e,t){this.dyn_tree=e,this.max_code=0,this.stat_desc=t}function U(e){return e<256?I[e]:I[256+(e>>>7)]}function z(e,t){e.pending_buf[e.pending++]=255&t,e.pending_buf[e.pending++]=t>>>8&255}function $(e,t,r){e.bi_valid>v-r?(e.bi_buf|=t<<e.bi_valid&65535,z(e,e.bi_buf),e.bi_buf=t>>v-e.bi_valid,e.bi_valid+=r-v):(e.bi_buf|=t<<e.bi_valid&65535,e.bi_valid+=r)}function Y(e,t,r){$(e,r[2*t],r[2*t+1])}function H(e,t){var r=0;do{r|=1&e,e>>>=1,r<<=1}while(--t>0);return r>>>1}function q(e,t,r){var n,i,o=new Array(_+1),s=0;for(n=1;n<=_;n++)o[n]=s=s+r[n-1]<<1;for(i=0;i<=t;i++){var a=e[2*i+1];0!==a&&(e[2*i]=H(o[a]++,a))}}function Z(e){var t;for(t=0;t<d;t++)e.dyn_ltree[2*t]=0;for(t=0;t<y;t++)e.dyn_dtree[2*t]=0;for(t=0;t<m;t++)e.bl_tree[2*t]=0;e.dyn_ltree[2*w]=1,e.opt_len=e.static_len=0,e.last_lit=e.matches=0}function V(e){e.bi_valid>8?z(e,e.bi_buf):e.bi_valid>0&&(e.pending_buf[e.pending++]=e.bi_buf),e.bi_buf=0,e.bi_valid=0}function J(e,t,r,n){var i=2*t,o=2*r;return e[i]<e[o]||e[i]===e[o]&&n[t]<=n[r]}function G(e,t,r){for(var n=e.heap[r],i=r<<1;i<=e.heap_len&&(i<e.heap_len&&J(t,e.heap[i+1],e.heap[i],e.depth)&&i++,!J(t,n,e.heap[i],e.depth));)e.heap[r]=e.heap[i],r=i,i<<=1;e.heap[r]=n}function W(e,t,r){var n,i,o,s,a=0;if(0!==e.last_lit)do{n=e.pending_buf[e.d_buf+2*a]<<8|e.pending_buf[e.d_buf+2*a+1],i=e.pending_buf[e.l_buf+a],a++,0===n?Y(e,i,t):(Y(e,(o=F[i])+p+1,t),0!==(s=S[o])&&$(e,i-=D[o],s),Y(e,o=U(--n),r),0!==(s=x[o])&&$(e,n-=P[o],s))}while(a<e.last_lit);Y(e,w,t)}function X(e,t){var r,n,i,o=t.dyn_tree,s=t.stat_desc.static_tree,a=t.stat_desc.has_stree,u=t.stat_desc.elems,c=-1;for(e.heap_len=0,e.heap_max=g,r=0;r<u;r++)0!==o[2*r]?(e.heap[++e.heap_len]=c=r,e.depth[r]=0):o[2*r+1]=0;for(;e.heap_len<2;)o[2*(i=e.heap[++e.heap_len]=c<2?++c:0)]=1,e.depth[i]=0,e.opt_len--,a&&(e.static_len-=s[2*i+1]);for(t.max_code=c,r=e.heap_len>>1;r>=1;r--)G(e,o,r);i=u;do{r=e.heap[1],e.heap[1]=e.heap[e.heap_len--],G(e,o,1),n=e.heap[1],e.heap[--e.heap_max]=r,e.heap[--e.heap_max]=n,o[2*i]=o[2*r]+o[2*n],e.depth[i]=(e.depth[r]>=e.depth[n]?e.depth[r]:e.depth[n])+1,o[2*r+1]=o[2*n+1]=i,e.heap[1]=i++,G(e,o,1)}while(e.heap_len>=2);e.heap[--e.heap_max]=e.heap[1],function(e,t){var r,n,i,o,s,a,u=t.dyn_tree,c=t.max_code,f=t.stat_desc.static_tree,l=t.stat_desc.has_stree,h=t.stat_desc.extra_bits,p=t.stat_desc.extra_base,d=t.stat_desc.max_length,y=0;for(o=0;o<=_;o++)e.bl_count[o]=0;for(u[2*e.heap[e.heap_max]+1]=0,r=e.heap_max+1;r<g;r++)(o=u[2*u[2*(n=e.heap[r])+1]+1]+1)>d&&(o=d,y++),u[2*n+1]=o,n>c||(e.bl_count[o]++,s=0,n>=p&&(s=h[n-p]),a=u[2*n],e.opt_len+=a*(o+s),l&&(e.static_len+=a*(f[2*n+1]+s)));if(0!==y){do{for(o=d-1;0===e.bl_count[o];)o--;e.bl_count[o]--,e.bl_count[o+1]+=2,e.bl_count[d]--,y-=2}while(y>0);for(o=d;0!==o;o--)for(n=e.bl_count[o];0!==n;)(i=e.heap[--r])>c||(u[2*i+1]!==o&&(e.opt_len+=(o-u[2*i+1])*u[2*i],u[2*i+1]=o),n--)}}(e,t),q(o,c,e.bl_count)}function K(e,t,r){var n,i,o=-1,s=t[1],a=0,u=7,c=4;for(0===s&&(u=138,c=3),t[2*(r+1)+1]=65535,n=0;n<=r;n++)i=s,s=t[2*(n+1)+1],++a<u&&i===s||(a<c?e.bl_tree[2*i]+=a:0!==i?(i!==o&&e.bl_tree[2*i]++,e.bl_tree[2*E]++):a<=10?e.bl_tree[2*B]++:e.bl_tree[2*A]++,a=0,o=i,0===s?(u=138,c=3):i===s?(u=6,c=3):(u=7,c=4))}function Q(e,t,r){var n,i,o=-1,s=t[1],a=0,u=7,c=4;for(0===s&&(u=138,c=3),n=0;n<=r;n++)if(i=s,s=t[2*(n+1)+1],!(++a<u&&i===s)){if(a<c)do{Y(e,i,e.bl_tree)}while(0!=--a);else 0!==i?(i!==o&&(Y(e,i,e.bl_tree),a--),Y(e,E,e.bl_tree),$(e,a-3,2)):a<=10?(Y(e,B,e.bl_tree),$(e,a-3,3)):(Y(e,A,e.bl_tree),$(e,a-11,7));a=0,o=i,0===s?(u=138,c=3):i===s?(u=6,c=3):(u=7,c=4)}}u(P);var ee=!1;function te(e,t,r,i){$(e,(c<<1)+(i?1:0),3),function(e,t,r,i){V(e),i&&(z(e,r),z(e,~r)),n.arraySet(e.pending_buf,e.window,t,r,e.pending),e.pending+=r}(e,t,r,!0)}t._tr_init=function(e){ee||(!function(){var e,t,r,n,i,o=new Array(_+1);for(r=0,n=0;n<h-1;n++)for(D[n]=r,e=0;e<1<<S[n];e++)F[r++]=n;for(F[r-1]=n,i=0,n=0;n<16;n++)for(P[n]=i,e=0;e<1<<x[n];e++)I[i++]=n;for(i>>=7;n<y;n++)for(P[n]=i<<7,e=0;e<1<<x[n]-7;e++)I[256+i++]=n;for(t=0;t<=_;t++)o[t]=0;for(e=0;e<=143;)O[2*e+1]=8,e++,o[8]++;for(;e<=255;)O[2*e+1]=9,e++,o[9]++;for(;e<=279;)O[2*e+1]=7,e++,o[7]++;for(;e<=287;)O[2*e+1]=8,e++,o[8]++;for(q(O,d+1,o),e=0;e<y;e++)k[2*e+1]=5,k[2*e]=H(e,5);R=new j(O,S,p+1,d,_),C=new j(k,x,0,y,_),L=new j(new Array(0),T,0,m,b)}(),ee=!0),e.l_desc=new M(e.dyn_ltree,R),e.d_desc=new M(e.dyn_dtree,C),e.bl_desc=new M(e.bl_tree,L),e.bi_buf=0,e.bi_valid=0,Z(e)},t._tr_stored_block=te,t._tr_flush_block=function(e,t,r,n){var u,c,h=0;e.level>0?(e.strm.data_type===a&&(e.strm.data_type=function(e){var t,r=4093624447;for(t=0;t<=31;t++,r>>>=1)if(1&r&&0!==e.dyn_ltree[2*t])return o;if(0!==e.dyn_ltree[18]||0!==e.dyn_ltree[20]||0!==e.dyn_ltree[26])return s;for(t=32;t<p;t++)if(0!==e.dyn_ltree[2*t])return s;return o}(e)),X(e,e.l_desc),X(e,e.d_desc),h=function(e){var t;for(K(e,e.dyn_ltree,e.l_desc.max_code),K(e,e.dyn_dtree,e.d_desc.max_code),X(e,e.bl_desc),t=m-1;t>=3&&0===e.bl_tree[2*N[t]+1];t--);return e.opt_len+=3*(t+1)+5+5+4,t}(e),u=e.opt_len+3+7>>>3,(c=e.static_len+3+7>>>3)<=u&&(u=c)):u=c=r+5,r+4<=u&&-1!==t?te(e,t,r,n):e.strategy===i||c===u?($(e,(f<<1)+(n?1:0),3),W(e,O,k)):($(e,(l<<1)+(n?1:0),3),function(e,t,r,n){var i;for($(e,t-257,5),$(e,r-1,5),$(e,n-4,4),i=0;i<n;i++)$(e,e.bl_tree[2*N[i]+1],3);Q(e,e.dyn_ltree,t-1),Q(e,e.dyn_dtree,r-1)}(e,e.l_desc.max_code+1,e.d_desc.max_code+1,h+1),W(e,e.dyn_ltree,e.dyn_dtree)),Z(e),n&&V(e)},t._tr_tally=function(e,t,r){return e.pending_buf[e.d_buf+2*e.last_lit]=t>>>8&255,e.pending_buf[e.d_buf+2*e.last_lit+1]=255&t,e.pending_buf[e.l_buf+e.last_lit]=255&r,e.last_lit++,0===t?e.dyn_ltree[2*r]++:(e.matches++,t--,e.dyn_ltree[2*(F[r]+p+1)]++,e.dyn_dtree[2*U(t)]++),e.last_lit===e.lit_bufsize-1},t._tr_align=function(e){$(e,f<<1,3),Y(e,w,O),function(e){16===e.bi_valid?(z(e,e.bi_buf),e.bi_buf=0,e.bi_valid=0):e.bi_valid>=8&&(e.pending_buf[e.pending++]=255&e.bi_buf,e.bi_buf>>=8,e.bi_valid-=8)}(e)}},347:function(e,t,r){"use strict";e.exports={2:"need dictionary",1:"stream end",0:"","-1":"file error","-2":"stream error","-3":"data error","-4":"insufficient memory","-5":"buffer error","-6":"incompatible version"}},348:function(e,t,r){"use strict";var n=r(108),i=r(198),o=r(199),s=r(349),a=r(350),u=0,c=1,f=2,l=4,h=5,p=6,d=0,y=1,m=2,g=-2,_=-3,v=-4,b=-5,w=8,E=1,B=2,A=3,S=4,x=5,T=6,N=7,O=8,k=9,I=10,F=11,D=12,R=13,C=14,L=15,P=16,j=17,M=18,U=19,z=20,$=21,Y=22,H=23,q=24,Z=25,V=26,J=27,G=28,W=29,X=30,K=31,Q=32,ee=852,te=592,re=15;function ne(e){return(e>>>24&255)+(e>>>8&65280)+((65280&e)<<8)+((255&e)<<24)}function ie(){this.mode=0,this.last=!1,this.wrap=0,this.havedict=!1,this.flags=0,this.dmax=0,this.check=0,this.total=0,this.head=null,this.wbits=0,this.wsize=0,this.whave=0,this.wnext=0,this.window=null,this.hold=0,this.bits=0,this.length=0,this.offset=0,this.extra=0,this.lencode=null,this.distcode=null,this.lenbits=0,this.distbits=0,this.ncode=0,this.nlen=0,this.ndist=0,this.have=0,this.next=null,this.lens=new n.Buf16(320),this.work=new n.Buf16(288),this.lendyn=null,this.distdyn=null,this.sane=0,this.back=0,this.was=0}function oe(e){var t;return e&&e.state?(t=e.state,e.total_in=e.total_out=t.total=0,e.msg="",t.wrap&&(e.adler=1&t.wrap),t.mode=E,t.last=0,t.havedict=0,t.dmax=32768,t.head=null,t.hold=0,t.bits=0,t.lencode=t.lendyn=new n.Buf32(ee),t.distcode=t.distdyn=new n.Buf32(te),t.sane=1,t.back=-1,d):g}function se(e){var t;return e&&e.state?((t=e.state).wsize=0,t.whave=0,t.wnext=0,oe(e)):g}function ae(e,t){var r,n;return e&&e.state?(n=e.state,t<0?(r=0,t=-t):(r=1+(t>>4),t<48&&(t&=15)),t&&(t<8||t>15)?g:(null!==n.window&&n.wbits!==t&&(n.window=null),n.wrap=r,n.wbits=t,se(e))):g}function ue(e,t){var r,n;return e?(n=new ie,e.state=n,n.window=null,(r=ae(e,t))!==d&&(e.state=null),r):g}var ce,fe,le=!0;function he(e){if(le){var t;for(ce=new n.Buf32(512),fe=new n.Buf32(32),t=0;t<144;)e.lens[t++]=8;for(;t<256;)e.lens[t++]=9;for(;t<280;)e.lens[t++]=7;for(;t<288;)e.lens[t++]=8;for(a(c,e.lens,0,288,ce,0,e.work,{bits:9}),t=0;t<32;)e.lens[t++]=5;a(f,e.lens,0,32,fe,0,e.work,{bits:5}),le=!1}e.lencode=ce,e.lenbits=9,e.distcode=fe,e.distbits=5}function pe(e,t,r,i){var o,s=e.state;return null===s.window&&(s.wsize=1<<s.wbits,s.wnext=0,s.whave=0,s.window=new n.Buf8(s.wsize)),i>=s.wsize?(n.arraySet(s.window,t,r-s.wsize,s.wsize,0),s.wnext=0,s.whave=s.wsize):((o=s.wsize-s.wnext)>i&&(o=i),n.arraySet(s.window,t,r-i,o,s.wnext),(i-=o)?(n.arraySet(s.window,t,r-i,i,0),s.wnext=i,s.whave=s.wsize):(s.wnext+=o,s.wnext===s.wsize&&(s.wnext=0),s.whave<s.wsize&&(s.whave+=o))),0}t.inflateReset=se,t.inflateReset2=ae,t.inflateResetKeep=oe,t.inflateInit=function(e){return ue(e,re)},t.inflateInit2=ue,t.inflate=function(e,t){var r,ee,te,re,ie,oe,se,ae,ue,ce,fe,le,de,ye,me,ge,_e,ve,be,we,Ee,Be,Ae,Se,xe=0,Te=new n.Buf8(4),Ne=[16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15];if(!e||!e.state||!e.output||!e.input&&0!==e.avail_in)return g;(r=e.state).mode===D&&(r.mode=R),ie=e.next_out,te=e.output,se=e.avail_out,re=e.next_in,ee=e.input,oe=e.avail_in,ae=r.hold,ue=r.bits,ce=oe,fe=se,Be=d;e:for(;;)switch(r.mode){case E:if(0===r.wrap){r.mode=R;break}for(;ue<16;){if(0===oe)break e;oe--,ae+=ee[re++]<<ue,ue+=8}if(2&r.wrap&&35615===ae){r.check=0,Te[0]=255&ae,Te[1]=ae>>>8&255,r.check=o(r.check,Te,2,0),ae=0,ue=0,r.mode=B;break}if(r.flags=0,r.head&&(r.head.done=!1),!(1&r.wrap)||(((255&ae)<<8)+(ae>>8))%31){e.msg="incorrect header check",r.mode=X;break}if((15&ae)!==w){e.msg="unknown compression method",r.mode=X;break}if(ue-=4,Ee=8+(15&(ae>>>=4)),0===r.wbits)r.wbits=Ee;else if(Ee>r.wbits){e.msg="invalid window size",r.mode=X;break}r.dmax=1<<Ee,e.adler=r.check=1,r.mode=512&ae?I:D,ae=0,ue=0;break;case B:for(;ue<16;){if(0===oe)break e;oe--,ae+=ee[re++]<<ue,ue+=8}if(r.flags=ae,(255&r.flags)!==w){e.msg="unknown compression method",r.mode=X;break}if(57344&r.flags){e.msg="unknown header flags set",r.mode=X;break}r.head&&(r.head.text=ae>>8&1),512&r.flags&&(Te[0]=255&ae,Te[1]=ae>>>8&255,r.check=o(r.check,Te,2,0)),ae=0,ue=0,r.mode=A;case A:for(;ue<32;){if(0===oe)break e;oe--,ae+=ee[re++]<<ue,ue+=8}r.head&&(r.head.time=ae),512&r.flags&&(Te[0]=255&ae,Te[1]=ae>>>8&255,Te[2]=ae>>>16&255,Te[3]=ae>>>24&255,r.check=o(r.check,Te,4,0)),ae=0,ue=0,r.mode=S;case S:for(;ue<16;){if(0===oe)break e;oe--,ae+=ee[re++]<<ue,ue+=8}r.head&&(r.head.xflags=255&ae,r.head.os=ae>>8),512&r.flags&&(Te[0]=255&ae,Te[1]=ae>>>8&255,r.check=o(r.check,Te,2,0)),ae=0,ue=0,r.mode=x;case x:if(1024&r.flags){for(;ue<16;){if(0===oe)break e;oe--,ae+=ee[re++]<<ue,ue+=8}r.length=ae,r.head&&(r.head.extra_len=ae),512&r.flags&&(Te[0]=255&ae,Te[1]=ae>>>8&255,r.check=o(r.check,Te,2,0)),ae=0,ue=0}else r.head&&(r.head.extra=null);r.mode=T;case T:if(1024&r.flags&&((le=r.length)>oe&&(le=oe),le&&(r.head&&(Ee=r.head.extra_len-r.length,r.head.extra||(r.head.extra=new Array(r.head.extra_len)),n.arraySet(r.head.extra,ee,re,le,Ee)),512&r.flags&&(r.check=o(r.check,ee,le,re)),oe-=le,re+=le,r.length-=le),r.length))break e;r.length=0,r.mode=N;case N:if(2048&r.flags){if(0===oe)break e;le=0;do{Ee=ee[re+le++],r.head&&Ee&&r.length<65536&&(r.head.name+=String.fromCharCode(Ee))}while(Ee&&le<oe);if(512&r.flags&&(r.check=o(r.check,ee,le,re)),oe-=le,re+=le,Ee)break e}else r.head&&(r.head.name=null);r.length=0,r.mode=O;case O:if(4096&r.flags){if(0===oe)break e;le=0;do{Ee=ee[re+le++],r.head&&Ee&&r.length<65536&&(r.head.comment+=String.fromCharCode(Ee))}while(Ee&&le<oe);if(512&r.flags&&(r.check=o(r.check,ee,le,re)),oe-=le,re+=le,Ee)break e}else r.head&&(r.head.comment=null);r.mode=k;case k:if(512&r.flags){for(;ue<16;){if(0===oe)break e;oe--,ae+=ee[re++]<<ue,ue+=8}if(ae!==(65535&r.check)){e.msg="header crc mismatch",r.mode=X;break}ae=0,ue=0}r.head&&(r.head.hcrc=r.flags>>9&1,r.head.done=!0),e.adler=r.check=0,r.mode=D;break;case I:for(;ue<32;){if(0===oe)break e;oe--,ae+=ee[re++]<<ue,ue+=8}e.adler=r.check=ne(ae),ae=0,ue=0,r.mode=F;case F:if(0===r.havedict)return e.next_out=ie,e.avail_out=se,e.next_in=re,e.avail_in=oe,r.hold=ae,r.bits=ue,m;e.adler=r.check=1,r.mode=D;case D:if(t===h||t===p)break e;case R:if(r.last){ae>>>=7&ue,ue-=7&ue,r.mode=J;break}for(;ue<3;){if(0===oe)break e;oe--,ae+=ee[re++]<<ue,ue+=8}switch(r.last=1&ae,ue-=1,3&(ae>>>=1)){case 0:r.mode=C;break;case 1:if(he(r),r.mode=z,t===p){ae>>>=2,ue-=2;break e}break;case 2:r.mode=j;break;case 3:e.msg="invalid block type",r.mode=X}ae>>>=2,ue-=2;break;case C:for(ae>>>=7&ue,ue-=7&ue;ue<32;){if(0===oe)break e;oe--,ae+=ee[re++]<<ue,ue+=8}if((65535&ae)!=(ae>>>16^65535)){e.msg="invalid stored block lengths",r.mode=X;break}if(r.length=65535&ae,ae=0,ue=0,r.mode=L,t===p)break e;case L:r.mode=P;case P:if(le=r.length){if(le>oe&&(le=oe),le>se&&(le=se),0===le)break e;n.arraySet(te,ee,re,le,ie),oe-=le,re+=le,se-=le,ie+=le,r.length-=le;break}r.mode=D;break;case j:for(;ue<14;){if(0===oe)break e;oe--,ae+=ee[re++]<<ue,ue+=8}if(r.nlen=257+(31&ae),ae>>>=5,ue-=5,r.ndist=1+(31&ae),ae>>>=5,ue-=5,r.ncode=4+(15&ae),ae>>>=4,ue-=4,r.nlen>286||r.ndist>30){e.msg="too many length or distance symbols",r.mode=X;break}r.have=0,r.mode=M;case M:for(;r.have<r.ncode;){for(;ue<3;){if(0===oe)break e;oe--,ae+=ee[re++]<<ue,ue+=8}r.lens[Ne[r.have++]]=7&ae,ae>>>=3,ue-=3}for(;r.have<19;)r.lens[Ne[r.have++]]=0;if(r.lencode=r.lendyn,r.lenbits=7,Ae={bits:r.lenbits},Be=a(u,r.lens,0,19,r.lencode,0,r.work,Ae),r.lenbits=Ae.bits,Be){e.msg="invalid code lengths set",r.mode=X;break}r.have=0,r.mode=U;case U:for(;r.have<r.nlen+r.ndist;){for(;ge=(xe=r.lencode[ae&(1<<r.lenbits)-1])>>>16&255,_e=65535&xe,!((me=xe>>>24)<=ue);){if(0===oe)break e;oe--,ae+=ee[re++]<<ue,ue+=8}if(_e<16)ae>>>=me,ue-=me,r.lens[r.have++]=_e;else{if(16===_e){for(Se=me+2;ue<Se;){if(0===oe)break e;oe--,ae+=ee[re++]<<ue,ue+=8}if(ae>>>=me,ue-=me,0===r.have){e.msg="invalid bit length repeat",r.mode=X;break}Ee=r.lens[r.have-1],le=3+(3&ae),ae>>>=2,ue-=2}else if(17===_e){for(Se=me+3;ue<Se;){if(0===oe)break e;oe--,ae+=ee[re++]<<ue,ue+=8}ue-=me,Ee=0,le=3+(7&(ae>>>=me)),ae>>>=3,ue-=3}else{for(Se=me+7;ue<Se;){if(0===oe)break e;oe--,ae+=ee[re++]<<ue,ue+=8}ue-=me,Ee=0,le=11+(127&(ae>>>=me)),ae>>>=7,ue-=7}if(r.have+le>r.nlen+r.ndist){e.msg="invalid bit length repeat",r.mode=X;break}for(;le--;)r.lens[r.have++]=Ee}}if(r.mode===X)break;if(0===r.lens[256]){e.msg="invalid code -- missing end-of-block",r.mode=X;break}if(r.lenbits=9,Ae={bits:r.lenbits},Be=a(c,r.lens,0,r.nlen,r.lencode,0,r.work,Ae),r.lenbits=Ae.bits,Be){e.msg="invalid literal/lengths set",r.mode=X;break}if(r.distbits=6,r.distcode=r.distdyn,Ae={bits:r.distbits},Be=a(f,r.lens,r.nlen,r.ndist,r.distcode,0,r.work,Ae),r.distbits=Ae.bits,Be){e.msg="invalid distances set",r.mode=X;break}if(r.mode=z,t===p)break e;case z:r.mode=$;case $:if(oe>=6&&se>=258){e.next_out=ie,e.avail_out=se,e.next_in=re,e.avail_in=oe,r.hold=ae,r.bits=ue,s(e,fe),ie=e.next_out,te=e.output,se=e.avail_out,re=e.next_in,ee=e.input,oe=e.avail_in,ae=r.hold,ue=r.bits,r.mode===D&&(r.back=-1);break}for(r.back=0;ge=(xe=r.lencode[ae&(1<<r.lenbits)-1])>>>16&255,_e=65535&xe,!((me=xe>>>24)<=ue);){if(0===oe)break e;oe--,ae+=ee[re++]<<ue,ue+=8}if(ge&&0==(240&ge)){for(ve=me,be=ge,we=_e;ge=(xe=r.lencode[we+((ae&(1<<ve+be)-1)>>ve)])>>>16&255,_e=65535&xe,!(ve+(me=xe>>>24)<=ue);){if(0===oe)break e;oe--,ae+=ee[re++]<<ue,ue+=8}ae>>>=ve,ue-=ve,r.back+=ve}if(ae>>>=me,ue-=me,r.back+=me,r.length=_e,0===ge){r.mode=V;break}if(32&ge){r.back=-1,r.mode=D;break}if(64&ge){e.msg="invalid literal/length code",r.mode=X;break}r.extra=15&ge,r.mode=Y;case Y:if(r.extra){for(Se=r.extra;ue<Se;){if(0===oe)break e;oe--,ae+=ee[re++]<<ue,ue+=8}r.length+=ae&(1<<r.extra)-1,ae>>>=r.extra,ue-=r.extra,r.back+=r.extra}r.was=r.length,r.mode=H;case H:for(;ge=(xe=r.distcode[ae&(1<<r.distbits)-1])>>>16&255,_e=65535&xe,!((me=xe>>>24)<=ue);){if(0===oe)break e;oe--,ae+=ee[re++]<<ue,ue+=8}if(0==(240&ge)){for(ve=me,be=ge,we=_e;ge=(xe=r.distcode[we+((ae&(1<<ve+be)-1)>>ve)])>>>16&255,_e=65535&xe,!(ve+(me=xe>>>24)<=ue);){if(0===oe)break e;oe--,ae+=ee[re++]<<ue,ue+=8}ae>>>=ve,ue-=ve,r.back+=ve}if(ae>>>=me,ue-=me,r.back+=me,64&ge){e.msg="invalid distance code",r.mode=X;break}r.offset=_e,r.extra=15&ge,r.mode=q;case q:if(r.extra){for(Se=r.extra;ue<Se;){if(0===oe)break e;oe--,ae+=ee[re++]<<ue,ue+=8}r.offset+=ae&(1<<r.extra)-1,ae>>>=r.extra,ue-=r.extra,r.back+=r.extra}if(r.offset>r.dmax){e.msg="invalid distance too far back",r.mode=X;break}r.mode=Z;case Z:if(0===se)break e;if(le=fe-se,r.offset>le){if((le=r.offset-le)>r.whave&&r.sane){e.msg="invalid distance too far back",r.mode=X;break}le>r.wnext?(le-=r.wnext,de=r.wsize-le):de=r.wnext-le,le>r.length&&(le=r.length),ye=r.window}else ye=te,de=ie-r.offset,le=r.length;le>se&&(le=se),se-=le,r.length-=le;do{te[ie++]=ye[de++]}while(--le);0===r.length&&(r.mode=$);break;case V:if(0===se)break e;te[ie++]=r.length,se--,r.mode=$;break;case J:if(r.wrap){for(;ue<32;){if(0===oe)break e;oe--,ae|=ee[re++]<<ue,ue+=8}if(fe-=se,e.total_out+=fe,r.total+=fe,fe&&(e.adler=r.check=r.flags?o(r.check,te,fe,ie-fe):i(r.check,te,fe,ie-fe)),fe=se,(r.flags?ae:ne(ae))!==r.check){e.msg="incorrect data check",r.mode=X;break}ae=0,ue=0}r.mode=G;case G:if(r.wrap&&r.flags){for(;ue<32;){if(0===oe)break e;oe--,ae+=ee[re++]<<ue,ue+=8}if(ae!==(4294967295&r.total)){e.msg="incorrect length check",r.mode=X;break}ae=0,ue=0}r.mode=W;case W:Be=y;break e;case X:Be=_;break e;case K:return v;case Q:default:return g}return e.next_out=ie,e.avail_out=se,e.next_in=re,e.avail_in=oe,r.hold=ae,r.bits=ue,(r.wsize||fe!==e.avail_out&&r.mode<X&&(r.mode<J||t!==l))&&pe(e,e.output,e.next_out,fe-e.avail_out)?(r.mode=K,v):(ce-=e.avail_in,fe-=e.avail_out,e.total_in+=ce,e.total_out+=fe,r.total+=fe,r.wrap&&fe&&(e.adler=r.check=r.flags?o(r.check,te,fe,e.next_out-fe):i(r.check,te,fe,e.next_out-fe)),e.data_type=r.bits+(r.last?64:0)+(r.mode===D?128:0)+(r.mode===z||r.mode===L?256:0),(0===ce&&0===fe||t===l)&&Be===d&&(Be=b),Be)},t.inflateEnd=function(e){if(!e||!e.state)return g;var t=e.state;return t.window&&(t.window=null),e.state=null,d},t.inflateGetHeader=function(e,t){var r;return e&&e.state?0==(2&(r=e.state).wrap)?g:(r.head=t,t.done=!1,d):g},t.inflateSetDictionary=function(e,t){var r,n=t.length;return e&&e.state?0!==(r=e.state).wrap&&r.mode!==F?g:r.mode===F&&i(1,t,n,0)!==r.check?_:pe(e,t,n,n)?(r.mode=K,v):(r.havedict=1,d):g},t.inflateInfo="pako inflate (from Nodeca project)"},349:function(e,t,r){"use strict";e.exports=function(e,t){var r,n,i,o,s,a,u,c,f,l,h,p,d,y,m,g,_,v,b,w,E,B,A,S,x;r=e.state,n=e.next_in,S=e.input,i=n+(e.avail_in-5),o=e.next_out,x=e.output,s=o-(t-e.avail_out),a=o+(e.avail_out-257),u=r.dmax,c=r.wsize,f=r.whave,l=r.wnext,h=r.window,p=r.hold,d=r.bits,y=r.lencode,m=r.distcode,g=(1<<r.lenbits)-1,_=(1<<r.distbits)-1;e:do{d<15&&(p+=S[n++]<<d,d+=8,p+=S[n++]<<d,d+=8),v=y[p&g];t:for(;;){if(p>>>=b=v>>>24,d-=b,0===(b=v>>>16&255))x[o++]=65535&v;else{if(!(16&b)){if(0==(64&b)){v=y[(65535&v)+(p&(1<<b)-1)];continue t}if(32&b){r.mode=12;break e}e.msg="invalid literal/length code",r.mode=30;break e}w=65535&v,(b&=15)&&(d<b&&(p+=S[n++]<<d,d+=8),w+=p&(1<<b)-1,p>>>=b,d-=b),d<15&&(p+=S[n++]<<d,d+=8,p+=S[n++]<<d,d+=8),v=m[p&_];r:for(;;){if(p>>>=b=v>>>24,d-=b,!(16&(b=v>>>16&255))){if(0==(64&b)){v=m[(65535&v)+(p&(1<<b)-1)];continue r}e.msg="invalid distance code",r.mode=30;break e}if(E=65535&v,d<(b&=15)&&(p+=S[n++]<<d,(d+=8)<b&&(p+=S[n++]<<d,d+=8)),(E+=p&(1<<b)-1)>u){e.msg="invalid distance too far back",r.mode=30;break e}if(p>>>=b,d-=b,E>(b=o-s)){if((b=E-b)>f&&r.sane){e.msg="invalid distance too far back",r.mode=30;break e}if(B=0,A=h,0===l){if(B+=c-b,b<w){w-=b;do{x[o++]=h[B++]}while(--b);B=o-E,A=x}}else if(l<b){if(B+=c+l-b,(b-=l)<w){w-=b;do{x[o++]=h[B++]}while(--b);if(B=0,l<w){w-=b=l;do{x[o++]=h[B++]}while(--b);B=o-E,A=x}}}else if(B+=l-b,b<w){w-=b;do{x[o++]=h[B++]}while(--b);B=o-E,A=x}for(;w>2;)x[o++]=A[B++],x[o++]=A[B++],x[o++]=A[B++],w-=3;w&&(x[o++]=A[B++],w>1&&(x[o++]=A[B++]))}else{B=o-E;do{x[o++]=x[B++],x[o++]=x[B++],x[o++]=x[B++],w-=3}while(w>2);w&&(x[o++]=x[B++],w>1&&(x[o++]=x[B++]))}break}}break}}while(n<i&&o<a);n-=w=d>>3,p&=(1<<(d-=w<<3))-1,e.next_in=n,e.next_out=o,e.avail_in=n<i?i-n+5:5-(n-i),e.avail_out=o<a?a-o+257:257-(o-a),r.hold=p,r.bits=d}},350:function(e,t,r){"use strict";var n=r(108),i=[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,0,0],o=[16,16,16,16,16,16,16,16,17,17,17,17,18,18,18,18,19,19,19,19,20,20,20,20,21,21,21,21,16,72,78],s=[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,0,0],a=[16,16,16,16,17,17,18,18,19,19,20,20,21,21,22,22,23,23,24,24,25,25,26,26,27,27,28,28,29,29,64,64];e.exports=function(e,t,r,u,c,f,l,h){var p,d,y,m,g,_,v,b,w,E=h.bits,B=0,A=0,S=0,x=0,T=0,N=0,O=0,k=0,I=0,F=0,D=null,R=0,C=new n.Buf16(16),L=new n.Buf16(16),P=null,j=0;for(B=0;B<=15;B++)C[B]=0;for(A=0;A<u;A++)C[t[r+A]]++;for(T=E,x=15;x>=1&&0===C[x];x--);if(T>x&&(T=x),0===x)return c[f++]=20971520,c[f++]=20971520,h.bits=1,0;for(S=1;S<x&&0===C[S];S++);for(T<S&&(T=S),k=1,B=1;B<=15;B++)if(k<<=1,(k-=C[B])<0)return-1;if(k>0&&(0===e||1!==x))return-1;for(L[1]=0,B=1;B<15;B++)L[B+1]=L[B]+C[B];for(A=0;A<u;A++)0!==t[r+A]&&(l[L[t[r+A]]++]=A);if(0===e?(D=P=l,_=19):1===e?(D=i,R-=257,P=o,j-=257,_=256):(D=s,P=a,_=-1),F=0,A=0,B=S,g=f,N=T,O=0,y=-1,m=(I=1<<T)-1,1===e&&I>852||2===e&&I>592)return 1;for(;;){v=B-O,l[A]<_?(b=0,w=l[A]):l[A]>_?(b=P[j+l[A]],w=D[R+l[A]]):(b=96,w=0),p=1<<B-O,S=d=1<<N;do{c[g+(F>>O)+(d-=p)]=v<<24|b<<16|w|0}while(0!==d);for(p=1<<B-1;F&p;)p>>=1;if(0!==p?(F&=p-1,F+=p):F=0,A++,0==--C[B]){if(B===x)break;B=t[r+l[A]]}if(B>T&&(F&m)!==y){for(0===O&&(O=T),g+=S,k=1<<(N=B-O);N+O<x&&!((k-=C[N+O])<=0);)N++,k<<=1;if(I+=1<<N,1===e&&I>852||2===e&&I>592)return 1;c[y=F&m]=T<<24|N<<16|g-f|0}}return 0!==F&&(c[g+F]=B-O<<24|64<<16|0),h.bits=T,0}},351:function(e,t,r){"use strict";e.exports={Z_NO_FLUSH:0,Z_PARTIAL_FLUSH:1,Z_SYNC_FLUSH:2,Z_FULL_FLUSH:3,Z_FINISH:4,Z_BLOCK:5,Z_TREES:6,Z_OK:0,Z_STREAM_END:1,Z_NEED_DICT:2,Z_ERRNO:-1,Z_STREAM_ERROR:-2,Z_DATA_ERROR:-3,Z_BUF_ERROR:-5,Z_NO_COMPRESSION:0,Z_BEST_SPEED:1,Z_BEST_COMPRESSION:9,Z_DEFAULT_COMPRESSION:-1,Z_FILTERED:1,Z_HUFFMAN_ONLY:2,Z_RLE:3,Z_FIXED:4,Z_DEFAULT_STRATEGY:0,Z_BINARY:0,Z_TEXT:1,Z_UNKNOWN:2,Z_DEFLATED:8}},38:function(e,t){function r(t){return"function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?e.exports=r=function(e){return typeof e}:e.exports=r=function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},r(t)}e.exports=r},39:function(e,t){function r(t,n){return e.exports=r=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e},r(t,n)}e.exports=r},4:function(e,t,r){var n=r(38),i=r(22);e.exports=function(e,t){return!t||"object"!==n(t)&&"function"!=typeof t?i(e):t}},40:function(e,t,r){"use strict";t.byteLength=function(e){var t=c(e),r=t[0],n=t[1];return 3*(r+n)/4-n},t.toByteArray=function(e){for(var t,r=c(e),n=r[0],s=r[1],a=new o(function(e,t,r){return 3*(t+r)/4-r}(0,n,s)),u=0,f=s>0?n-4:n,l=0;l<f;l+=4)t=i[e.charCodeAt(l)]<<18|i[e.charCodeAt(l+1)]<<12|i[e.charCodeAt(l+2)]<<6|i[e.charCodeAt(l+3)],a[u++]=t>>16&255,a[u++]=t>>8&255,a[u++]=255&t;2===s&&(t=i[e.charCodeAt(l)]<<2|i[e.charCodeAt(l+1)]>>4,a[u++]=255&t);1===s&&(t=i[e.charCodeAt(l)]<<10|i[e.charCodeAt(l+1)]<<4|i[e.charCodeAt(l+2)]>>2,a[u++]=t>>8&255,a[u++]=255&t);return a},t.fromByteArray=function(e){for(var t,r=e.length,i=r%3,o=[],s=0,a=r-i;s<a;s+=16383)o.push(f(e,s,s+16383>a?a:s+16383));1===i?(t=e[r-1],o.push(n[t>>2]+n[t<<4&63]+"==")):2===i&&(t=(e[r-2]<<8)+e[r-1],o.push(n[t>>10]+n[t>>4&63]+n[t<<2&63]+"="));return o.join("")};for(var n=[],i=[],o="undefined"!=typeof Uint8Array?Uint8Array:Array,s="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",a=0,u=s.length;a<u;++a)n[a]=s[a],i[s.charCodeAt(a)]=a;function c(e){var t=e.length;if(t%4>0)throw new Error("Invalid string. Length must be a multiple of 4");var r=e.indexOf("=");return-1===r&&(r=t),[r,r===t?0:4-r%4]}function f(e,t,r){for(var i,o,s=[],a=t;a<r;a+=3)i=(e[a]<<16&16711680)+(e[a+1]<<8&65280)+(255&e[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},41:function(e,t){t.read=function(e,t,r,n,i){var o,s,a=8*i-n-1,u=(1<<a)-1,c=u>>1,f=-7,l=r?i-1:0,h=r?-1:1,p=e[t+l];for(l+=h,o=p&(1<<-f)-1,p>>=-f,f+=a;f>0;o=256*o+e[t+l],l+=h,f-=8);for(s=o&(1<<-f)-1,o>>=-f,f+=n;f>0;s=256*s+e[t+l],l+=h,f-=8);if(0===o)o=1-c;else{if(o===u)return s?NaN:1/0*(p?-1:1);s+=Math.pow(2,n),o-=c}return(p?-1:1)*s*Math.pow(2,o-n)},t.write=function(e,t,r,n,i,o){var s,a,u,c=8*o-i-1,f=(1<<c)-1,l=f>>1,h=23===i?Math.pow(2,-24)-Math.pow(2,-77):0,p=n?0:o-1,d=n?1:-1,y=t<0||0===t&&1/t<0?1:0;for(t=Math.abs(t),isNaN(t)||t===1/0?(a=isNaN(t)?1:0,s=f):(s=Math.floor(Math.log(t)/Math.LN2),t*(u=Math.pow(2,-s))<1&&(s--,u*=2),(t+=s+l>=1?h/u:h*Math.pow(2,1-l))*u>=2&&(s++,u/=2),s+l>=f?(a=0,s=f):s+l>=1?(a=(t*u-1)*Math.pow(2,i),s+=l):(a=t*Math.pow(2,l-1)*Math.pow(2,i),s=0));i>=8;e[r+p]=255&a,p+=d,a/=256,i-=8);for(s=s<<i|a,c+=i;c>0;e[r+p]=255&s,p+=d,s/=256,c-=8);e[r+p-d]|=128*y}},413:function(module,exports,__webpack_require__){(function(global,Buffer){var factory;factory=function(exports,long,buffer){"use strict";long=long&&long.hasOwnProperty("default")?long.default:long,buffer=buffer&&buffer.hasOwnProperty("default")?buffer.default:buffer;var commonjsGlobal="undefined"!=typeof window?window:void 0!==global?global:"undefined"!=typeof self?self:{};function createCommonjsModule(e,t){return e(t={exports:{}},t.exports),t.exports}function getCjsExportFromNamespace(e){return e&&e.default||e}var map=createCommonjsModule((function(e){if(void 0!==commonjsGlobal.Map)e.exports=commonjsGlobal.Map,e.exports.Map=commonjsGlobal.Map;else{var t=function(e){this._keys=[],this._values={};for(var t=0;t<e.length;t++)if(null!=e[t]){var r=e[t],n=r[0],i=r[1];this._keys.push(n),this._values[n]={v:i,i:this._keys.length-1}}};t.prototype.clear=function(){this._keys=[],this._values={}},t.prototype.delete=function(e){var t=this._values[e];return null!=t&&(delete this._values[e],this._keys.splice(t.i,1),!0)},t.prototype.entries=function(){var e=this,t=0;return{next:function(){var r=e._keys[t++];return{value:void 0!==r?[r,e._values[r].v]:void 0,done:void 0===r}}}},t.prototype.forEach=function(e,t){t=t||this;for(var r=0;r<this._keys.length;r++){var n=this._keys[r];e.call(t,this._values[n].v,n,t)}},t.prototype.get=function(e){return this._values[e]?this._values[e].v:void 0},t.prototype.has=function(e){return null!=this._values[e]},t.prototype.keys=function(){var e=this,t=0;return{next:function(){var r=e._keys[t++];return{value:void 0!==r?r:void 0,done:void 0===r}}}},t.prototype.set=function(e,t){return this._values[e]?(this._values[e].v=t,this):(this._keys.push(e),this._values[e]={v:t,i:this._keys.length-1},this)},t.prototype.values=function(){var e=this,t=0;return{next:function(){var r=e._keys[t++];return{value:void 0!==r?e._values[r].v:void 0,done:void 0===r}}}},Object.defineProperty(t.prototype,"size",{enumerable:!0,get:function(){return this._keys.length}}),e.exports=t}})),map_1=map.Map;long.prototype.toExtendedJSON=function(e){return e&&e.relaxed?this.toNumber():{$numberLong:this.toString()}},long.fromExtendedJSON=function(e,t){var r=long.fromString(e.$numberLong);return t&&t.relaxed?r.toNumber():r},Object.defineProperty(long.prototype,"_bsontype",{value:"Long"});var long_1=long;function _classCallCheck(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function _defineProperties(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}function _createClass(e,t,r){return t&&_defineProperties(e.prototype,t),r&&_defineProperties(e,r),e}var Double=function(){function e(t){_classCallCheck(this,e),this.value=t}return _createClass(e,[{key:"valueOf",value:function(){return this.value}},{key:"toJSON",value:function(){return this.value}},{key:"toExtendedJSON",value:function(e){return e&&e.relaxed&&isFinite(this.value)?this.value:{$numberDouble:this.value.toString()}}}],[{key:"fromExtendedJSON",value:function(t,r){return r&&r.relaxed?parseFloat(t.$numberDouble):new e(parseFloat(t.$numberDouble))}}]),e}();Object.defineProperty(Double.prototype,"_bsontype",{value:"Double"});var double_1=Double;function _typeof(e){return(_typeof="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function _classCallCheck$1(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function _defineProperties$1(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}function _createClass$1(e,t,r){return t&&_defineProperties$1(e.prototype,t),r&&_defineProperties$1(e,r),e}function _possibleConstructorReturn(e,t){return!t||"object"!==_typeof(t)&&"function"!=typeof t?_assertThisInitialized(e):t}function _assertThisInitialized(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function _getPrototypeOf(e){return(_getPrototypeOf=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function _inherits(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&_setPrototypeOf(e,t)}function _setPrototypeOf(e,t){return(_setPrototypeOf=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}var Timestamp=function(e){function t(e,r){var n;return _classCallCheck$1(this,t),n=long_1.isLong(e)?_possibleConstructorReturn(this,_getPrototypeOf(t).call(this,e.low,e.high)):_possibleConstructorReturn(this,_getPrototypeOf(t).call(this,e,r)),_possibleConstructorReturn(n)}return _inherits(t,e),_createClass$1(t,[{key:"toJSON",value:function(){return{$timestamp:this.toString()}}},{key:"toExtendedJSON",value:function(){return{$timestamp:{t:this.high,i:this.low}}}}],[{key:"fromInt",value:function(e){return new t(long_1.fromInt(e))}},{key:"fromNumber",value:function(e){return new t(long_1.fromNumber(e))}},{key:"fromBits",value:function(e,r){return new t(e,r)}},{key:"fromString",value:function(e,r){return new t(long_1.fromString(e,r))}},{key:"fromExtendedJSON",value:function(e){return new t(e.$timestamp.i,e.$timestamp.t)}}]),t}(long_1);Object.defineProperty(Timestamp.prototype,"_bsontype",{value:"Timestamp"});var timestamp=Timestamp,empty={},empty$1=Object.freeze({default:empty}),require$$0=getCjsExportFromNamespace(empty$1);function normalizedFunctionString(e){return e.toString().replace("function(","function (")}function insecureRandomBytes(e){for(var t=new Uint8Array(e),r=0;r<e;++r)t[r]=Math.floor(256*Math.random());return t}var randomBytes=insecureRandomBytes;if("undefined"!=typeof window&&window.crypto&&window.crypto.getRandomValues)randomBytes=function(e){return window.crypto.getRandomValues(new Uint8Array(e))};else{try{randomBytes=require$$0.randomBytes}catch(e){}null==randomBytes&&(randomBytes=insecureRandomBytes)}var utils={normalizedFunctionString:normalizedFunctionString,randomBytes:randomBytes};function defaultSetTimout(){throw new Error("setTimeout has not been defined")}function defaultClearTimeout(){throw new Error("clearTimeout has not been defined")}var cachedSetTimeout=defaultSetTimout,cachedClearTimeout=defaultClearTimeout;function runTimeout(e){if(cachedSetTimeout===setTimeout)return setTimeout(e,0);if((cachedSetTimeout===defaultSetTimout||!cachedSetTimeout)&&setTimeout)return cachedSetTimeout=setTimeout,setTimeout(e,0);try{return cachedSetTimeout(e,0)}catch(t){try{return cachedSetTimeout.call(null,e,0)}catch(t){return cachedSetTimeout.call(this,e,0)}}}function runClearTimeout(e){if(cachedClearTimeout===clearTimeout)return clearTimeout(e);if((cachedClearTimeout===defaultClearTimeout||!cachedClearTimeout)&&clearTimeout)return cachedClearTimeout=clearTimeout,clearTimeout(e);try{return cachedClearTimeout(e)}catch(t){try{return cachedClearTimeout.call(null,e)}catch(t){return cachedClearTimeout.call(this,e)}}}"function"==typeof global.setTimeout&&(cachedSetTimeout=setTimeout),"function"==typeof global.clearTimeout&&(cachedClearTimeout=clearTimeout);var queue=[],draining=!1,currentQueue,queueIndex=-1;function cleanUpNextTick(){draining&&currentQueue&&(draining=!1,currentQueue.length?queue=currentQueue.concat(queue):queueIndex=-1,queue.length&&drainQueue())}function drainQueue(){if(!draining){var e=runTimeout(cleanUpNextTick);draining=!0;for(var t=queue.length;t;){for(currentQueue=queue,queue=[];++queueIndex<t;)currentQueue&&currentQueue[queueIndex].run();queueIndex=-1,t=queue.length}currentQueue=null,draining=!1,runClearTimeout(e)}}function nextTick(e){var t=new Array(arguments.length-1);if(arguments.length>1)for(var r=1;r<arguments.length;r++)t[r-1]=arguments[r];queue.push(new Item(e,t)),1!==queue.length||draining||runTimeout(drainQueue)}function Item(e,t){this.fun=e,this.array=t}Item.prototype.run=function(){this.fun.apply(null,this.array)};var title="browser",platform="browser",browser=!0,env={},argv=[],version="",versions={},release={},config={};function noop(){}var on=noop,addListener=noop,once=noop,off=noop,removeListener=noop,removeAllListeners=noop,emit=noop;function binding(e){throw new Error("process.binding is not supported")}function cwd(){return"/"}function chdir(e){throw new Error("process.chdir is not supported")}function umask(){return 0}var performance=global.performance||{},performanceNow=performance.now||performance.mozNow||performance.msNow||performance.oNow||performance.webkitNow||function(){return(new Date).getTime()};function hrtime(e){var t=.001*performanceNow.call(performance),r=Math.floor(t),n=Math.floor(t%1*1e9);return e&&(r-=e[0],(n-=e[1])<0&&(r--,n+=1e9)),[r,n]}var startTime=new Date;function uptime(){return(new Date-startTime)/1e3}var process={nextTick:nextTick,title:title,browser:browser,env:env,argv:argv,version:version,versions:versions,on:on,addListener:addListener,once:once,off:off,removeListener:removeListener,removeAllListeners:removeAllListeners,emit:emit,binding:binding,cwd:cwd,chdir:chdir,umask:umask,hrtime:hrtime,platform:platform,release:release,config:config,uptime:uptime},inherits;inherits="function"==typeof Object.create?function(e,t){e.super_=t,e.prototype=Object.create(t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}})}:function(e,t){e.super_=t;var r=function(){};r.prototype=t.prototype,e.prototype=new r,e.prototype.constructor=e};var inherits$1=inherits;function _typeof$1(e){return(_typeof$1="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}var formatRegExp=/%[sdj%]/g;function format(e){if(!isString(e)){for(var t=[],r=0;r<arguments.length;r++)t.push(inspect(arguments[r]));return t.join(" ")}r=1;for(var n=arguments,i=n.length,o=String(e).replace(formatRegExp,(function(e){if("%%"===e)return"%";if(r>=i)return e;switch(e){case"%s":return String(n[r++]);case"%d":return Number(n[r++]);case"%j":try{return JSON.stringify(n[r++])}catch(e){return"[Circular]"}default:return e}})),s=n[r];r<i;s=n[++r])isNull(s)||!isObject(s)?o+=" "+s:o+=" "+inspect(s);return o}function deprecate(e,t){if(isUndefined(global.process))return function(){return deprecate(e,t).apply(this,arguments)};var r=!1;return function(){return r||(console.error(t),r=!0),e.apply(this,arguments)}}var debugs={},debugEnviron;function debuglog(e){return isUndefined(debugEnviron)&&(debugEnviron=process.env.NODE_DEBUG||""),e=e.toUpperCase(),debugs[e]||(new RegExp("\\b"+e+"\\b","i").test(debugEnviron)?debugs[e]=function(){var t=format.apply(null,arguments);console.error("%s %d: %s",e,0,t)}:debugs[e]=function(){}),debugs[e]}function inspect(e,t){var r={seen:[],stylize:stylizeNoColor};return arguments.length>=3&&(r.depth=arguments[2]),arguments.length>=4&&(r.colors=arguments[3]),isBoolean(t)?r.showHidden=t:t&&_extend(r,t),isUndefined(r.showHidden)&&(r.showHidden=!1),isUndefined(r.depth)&&(r.depth=2),isUndefined(r.colors)&&(r.colors=!1),isUndefined(r.customInspect)&&(r.customInspect=!0),r.colors&&(r.stylize=stylizeWithColor),formatValue(r,e,r.depth)}function stylizeWithColor(e,t){var r=inspect.styles[t];return r?"["+inspect.colors[r][0]+"m"+e+"["+inspect.colors[r][1]+"m":e}function stylizeNoColor(e,t){return e}function arrayToHash(e){var t={};return e.forEach((function(e,r){t[e]=!0})),t}function formatValue(e,t,r){if(e.customInspect&&t&&isFunction(t.inspect)&&t.inspect!==inspect&&(!t.constructor||t.constructor.prototype!==t)){var n=t.inspect(r,e);return isString(n)||(n=formatValue(e,n,r)),n}var i=formatPrimitive(e,t);if(i)return i;var o=Object.keys(t),s=arrayToHash(o);if(e.showHidden&&(o=Object.getOwnPropertyNames(t)),isError(t)&&(o.indexOf("message")>=0||o.indexOf("description")>=0))return formatError(t);if(0===o.length){if(isFunction(t)){var a=t.name?": "+t.name:"";return e.stylize("[Function"+a+"]","special")}if(isRegExp(t))return e.stylize(RegExp.prototype.toString.call(t),"regexp");if(isDate(t))return e.stylize(Date.prototype.toString.call(t),"date");if(isError(t))return formatError(t)}var u,c="",f=!1,l=["{","}"];return isArray(t)&&(f=!0,l=["[","]"]),isFunction(t)&&(c=" [Function"+(t.name?": "+t.name:"")+"]"),isRegExp(t)&&(c=" "+RegExp.prototype.toString.call(t)),isDate(t)&&(c=" "+Date.prototype.toUTCString.call(t)),isError(t)&&(c=" "+formatError(t)),0!==o.length||f&&0!=t.length?r<0?isRegExp(t)?e.stylize(RegExp.prototype.toString.call(t),"regexp"):e.stylize("[Object]","special"):(e.seen.push(t),u=f?formatArray(e,t,r,s,o):o.map((function(n){return formatProperty(e,t,r,s,n,f)})),e.seen.pop(),reduceToSingleString(u,c,l)):l[0]+c+l[1]}function formatPrimitive(e,t){if(isUndefined(t))return e.stylize("undefined","undefined");if(isString(t)){var r="'"+JSON.stringify(t).replace(/^"|"$/g,"").replace(/'/g,"\\'").replace(/\\"/g,'"')+"'";return e.stylize(r,"string")}return isNumber(t)?e.stylize(""+t,"number"):isBoolean(t)?e.stylize(""+t,"boolean"):isNull(t)?e.stylize("null","null"):void 0}function formatError(e){return"["+Error.prototype.toString.call(e)+"]"}function formatArray(e,t,r,n,i){for(var o=[],s=0,a=t.length;s<a;++s)hasOwnProperty(t,String(s))?o.push(formatProperty(e,t,r,n,String(s),!0)):o.push("");return i.forEach((function(i){i.match(/^\d+$/)||o.push(formatProperty(e,t,r,n,i,!0))})),o}function formatProperty(e,t,r,n,i,o){var s,a,u;if((u=Object.getOwnPropertyDescriptor(t,i)||{value:t[i]}).get?a=u.set?e.stylize("[Getter/Setter]","special"):e.stylize("[Getter]","special"):u.set&&(a=e.stylize("[Setter]","special")),hasOwnProperty(n,i)||(s="["+i+"]"),a||(e.seen.indexOf(u.value)<0?(a=isNull(r)?formatValue(e,u.value,null):formatValue(e,u.value,r-1)).indexOf("\n")>-1&&(a=o?a.split("\n").map((function(e){return"  "+e})).join("\n").substr(2):"\n"+a.split("\n").map((function(e){return"   "+e})).join("\n")):a=e.stylize("[Circular]","special")),isUndefined(s)){if(o&&i.match(/^\d+$/))return a;(s=JSON.stringify(""+i)).match(/^"([a-zA-Z_][a-zA-Z_0-9]*)"$/)?(s=s.substr(1,s.length-2),s=e.stylize(s,"name")):(s=s.replace(/'/g,"\\'").replace(/\\"/g,'"').replace(/(^"|"$)/g,"'"),s=e.stylize(s,"string"))}return s+": "+a}function reduceToSingleString(e,t,r){return e.reduce((function(e,t){return t.indexOf("\n"),e+t.replace(/\u001b\[\d\d?m/g,"").length+1}),0)>60?r[0]+(""===t?"":t+"\n ")+" "+e.join(",\n  ")+" "+r[1]:r[0]+t+" "+e.join(", ")+" "+r[1]}function isArray(e){return Array.isArray(e)}function isBoolean(e){return"boolean"==typeof e}function isNull(e){return null===e}function isNullOrUndefined(e){return null==e}function isNumber(e){return"number"==typeof e}function isString(e){return"string"==typeof e}function isSymbol(e){return"symbol"===_typeof$1(e)}function isUndefined(e){return void 0===e}function isRegExp(e){return isObject(e)&&"[object RegExp]"===objectToString(e)}function isObject(e){return"object"===_typeof$1(e)&&null!==e}function isDate(e){return isObject(e)&&"[object Date]"===objectToString(e)}function isError(e){return isObject(e)&&("[object Error]"===objectToString(e)||e instanceof Error)}function isFunction(e){return"function"==typeof e}function isPrimitive(e){return null===e||"boolean"==typeof e||"number"==typeof e||"string"==typeof e||"symbol"===_typeof$1(e)||void 0===e}function isBuffer(e){return Buffer.isBuffer(e)}function objectToString(e){return Object.prototype.toString.call(e)}function pad(e){return e<10?"0"+e.toString(10):e.toString(10)}inspect.colors={bold:[1,22],italic:[3,23],underline:[4,24],inverse:[7,27],white:[37,39],grey:[90,39],black:[30,39],blue:[34,39],cyan:[36,39],green:[32,39],magenta:[35,39],red:[31,39],yellow:[33,39]},inspect.styles={special:"cyan",number:"yellow",boolean:"yellow",undefined:"grey",null:"bold",string:"green",date:"magenta",regexp:"red"};var months=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"];function timestamp$1(){var e=new Date,t=[pad(e.getHours()),pad(e.getMinutes()),pad(e.getSeconds())].join(":");return[e.getDate(),months[e.getMonth()],t].join(" ")}function log(){console.log("%s - %s",timestamp$1(),format.apply(null,arguments))}function _extend(e,t){if(!t||!isObject(t))return e;for(var r=Object.keys(t),n=r.length;n--;)e[r[n]]=t[r[n]];return e}function hasOwnProperty(e,t){return Object.prototype.hasOwnProperty.call(e,t)}var util={inherits:inherits$1,_extend:_extend,log:log,isBuffer:isBuffer,isPrimitive:isPrimitive,isFunction:isFunction,isError:isError,isDate:isDate,isObject:isObject,isRegExp:isRegExp,isUndefined:isUndefined,isSymbol:isSymbol,isString:isString,isNumber:isNumber,isNullOrUndefined:isNullOrUndefined,isNull:isNull,isBoolean:isBoolean,isArray:isArray,inspect:inspect,deprecate:deprecate,format:format,debuglog:debuglog},util$1=Object.freeze({format:format,deprecate:deprecate,debuglog:debuglog,inspect:inspect,isArray:isArray,isBoolean:isBoolean,isNull:isNull,isNullOrUndefined:isNullOrUndefined,isNumber:isNumber,isString:isString,isSymbol:isSymbol,isUndefined:isUndefined,isRegExp:isRegExp,isObject:isObject,isDate:isDate,isError:isError,isFunction:isFunction,isPrimitive:isPrimitive,isBuffer:isBuffer,log:log,inherits:inherits$1,_extend:_extend,default:util}),util$2=getCjsExportFromNamespace(util$1);function _classCallCheck$2(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function _defineProperties$2(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}function _createClass$2(e,t,r){return t&&_defineProperties$2(e.prototype,t),r&&_defineProperties$2(e,r),e}var Buffer$1=buffer.Buffer,randomBytes$1=utils.randomBytes,deprecate$1=util$2.deprecate,PROCESS_UNIQUE=randomBytes$1(5),checkForHexRegExp=new RegExp("^[0-9a-fA-F]{24}$"),hasBufferType=!1;try{Buffer$1&&Buffer$1.from&&(hasBufferType=!0)}catch(e){hasBufferType=!1}for(var hexTable=[],_i=0;_i<256;_i++)hexTable[_i]=(_i<=15?"0":"")+_i.toString(16);for(var decodeLookup=[],i=0;i<10;)decodeLookup[48+i]=i++;for(;i<16;)decodeLookup[55+i]=decodeLookup[87+i]=i++;var _Buffer=Buffer$1;function convertToHex(e){return e.toString("hex")}function makeObjectIdError(e,t){var r=e[t];return new TypeError('ObjectId string "'.concat(e,'" contains invalid character "').concat(r,'" with character code (').concat(e.charCodeAt(t),"). All character codes for a non-hex string must be less than 256."))}var ObjectId=function(){function e(t){if(_classCallCheck$2(this,e),t instanceof e)return t;if(null==t||"number"==typeof t)return this.id=e.generate(t),void(e.cacheHexString&&(this.__id=this.toString("hex")));var r=e.isValid(t);if(!r&&null!=t)throw new TypeError("Argument passed in must be a single String of 12 bytes or a string of 24 hex characters");if(r&&"string"==typeof t&&24===t.length&&hasBufferType)return new e(Buffer$1.from(t,"hex"));if(r&&"string"==typeof t&&24===t.length)return e.createFromHexString(t);if(null==t||12!==t.length){if(null!=t&&t.toHexString)return e.createFromHexString(t.toHexString());throw new TypeError("Argument passed in must be a single String of 12 bytes or a string of 24 hex characters")}this.id=t,e.cacheHexString&&(this.__id=this.toString("hex"))}return _createClass$2(e,[{key:"toHexString",value:function(){if(e.cacheHexString&&this.__id)return this.__id;var t="";if(!this.id||!this.id.length)throw new TypeError("invalid ObjectId, ObjectId.id must be either a string or a Buffer, but is ["+JSON.stringify(this.id)+"]");if(this.id instanceof _Buffer)return t=convertToHex(this.id),e.cacheHexString&&(this.__id=t),t;for(var r=0;r<this.id.length;r++){var n=hexTable[this.id.charCodeAt(r)];if("string"!=typeof n)throw makeObjectIdError(this.id,r);t+=n}return e.cacheHexString&&(this.__id=t),t}},{key:"toString",value:function(e){return this.id&&this.id.copy?this.id.toString("string"==typeof e?e:"hex"):this.toHexString()}},{key:"toJSON",value:function(){return this.toHexString()}},{key:"equals",value:function(t){return t instanceof e?this.toString()===t.toString():"string"==typeof t&&e.isValid(t)&&12===t.length&&this.id instanceof _Buffer?t===this.id.toString("binary"):"string"==typeof t&&e.isValid(t)&&24===t.length?t.toLowerCase()===this.toHexString():"string"==typeof t&&e.isValid(t)&&12===t.length?t===this.id:!(null==t||!(t instanceof e||t.toHexString))&&t.toHexString()===this.toHexString()}},{key:"getTimestamp",value:function(){var e=new Date,t=this.id.readUInt32BE(0);return e.setTime(1e3*Math.floor(t)),e}},{key:"toExtendedJSON",value:function(){return this.toHexString?{$oid:this.toHexString()}:{$oid:this.toString("hex")}}}],[{key:"getInc",value:function(){return e.index=(e.index+1)%16777215}},{key:"generate",value:function(t){"number"!=typeof t&&(t=~~(Date.now()/1e3));var r=e.getInc(),n=Buffer$1.alloc(12);return n[3]=255&t,n[2]=t>>8&255,n[1]=t>>16&255,n[0]=t>>24&255,n[4]=PROCESS_UNIQUE[0],n[5]=PROCESS_UNIQUE[1],n[6]=PROCESS_UNIQUE[2],n[7]=PROCESS_UNIQUE[3],n[8]=PROCESS_UNIQUE[4],n[11]=255&r,n[10]=r>>8&255,n[9]=r>>16&255,n}},{key:"createPk",value:function(){return new e}},{key:"createFromTime",value:function(t){var r=Buffer$1.from([0,0,0,0,0,0,0,0,0,0,0,0]);return r[3]=255&t,r[2]=t>>8&255,r[1]=t>>16&255,r[0]=t>>24&255,new e(r)}},{key:"createFromHexString",value:function(t){if(void 0===t||null!=t&&24!==t.length)throw new TypeError("Argument passed in must be a single String of 12 bytes or a string of 24 hex characters");if(hasBufferType)return new e(Buffer$1.from(t,"hex"));for(var r=new _Buffer(12),n=0,i=0;i<24;)r[n++]=decodeLookup[t.charCodeAt(i++)]<<4|decodeLookup[t.charCodeAt(i++)];return new e(r)}},{key:"isValid",value:function(t){return null!=t&&("number"==typeof t||("string"==typeof t?12===t.length||24===t.length&&checkForHexRegExp.test(t):t instanceof e||t instanceof _Buffer&&12===t.length||!!t.toHexString&&(12===t.id.length||24===t.id.length&&checkForHexRegExp.test(t.id))))}},{key:"fromExtendedJSON",value:function(t){return new e(t.$oid)}}]),e}();ObjectId.get_inc=deprecate$1((function(){return ObjectId.getInc()}),"Please use the static `ObjectId.getInc()` instead"),ObjectId.prototype.get_inc=deprecate$1((function(){return ObjectId.getInc()}),"Please use the static `ObjectId.getInc()` instead"),ObjectId.prototype.getInc=deprecate$1((function(){return ObjectId.getInc()}),"Please use the static `ObjectId.getInc()` instead"),ObjectId.prototype.generate=deprecate$1((function(e){return ObjectId.generate(e)}),"Please use the static `ObjectId.generate(time)` instead"),Object.defineProperty(ObjectId.prototype,"generationTime",{enumerable:!0,get:function(){return this.id[3]|this.id[2]<<8|this.id[1]<<16|this.id[0]<<24},set:function(e){this.id[3]=255&e,this.id[2]=e>>8&255,this.id[1]=e>>16&255,this.id[0]=e>>24&255}}),ObjectId.prototype[util$2.inspect.custom||"inspect"]=ObjectId.prototype.toString,ObjectId.index=~~(16777215*Math.random()),Object.defineProperty(ObjectId.prototype,"_bsontype",{value:"ObjectID"});var objectid=ObjectId;function _classCallCheck$3(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function _defineProperties$3(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}function _createClass$3(e,t,r){return t&&_defineProperties$3(e.prototype,t),r&&_defineProperties$3(e,r),e}function alphabetize(e){return e.split("").sort().join("")}var BSONRegExp=function(){function e(t,r){_classCallCheck$3(this,e),this.pattern=t||"",this.options=r?alphabetize(r):"";for(var n=0;n<this.options.length;n++)if("i"!==this.options[n]&&"m"!==this.options[n]&&"x"!==this.options[n]&&"l"!==this.options[n]&&"s"!==this.options[n]&&"u"!==this.options[n])throw new Error("The regular expression option [".concat(this.options[n],"] is not supported"))}return _createClass$3(e,[{key:"toExtendedJSON",value:function(){return{$regularExpression:{pattern:this.pattern,options:this.options}}}}],[{key:"fromExtendedJSON",value:function(t){return new e(t.$regularExpression.pattern,t.$regularExpression.options.split("").sort().join(""))}}]),e}();Object.defineProperty(BSONRegExp.prototype,"_bsontype",{value:"BSONRegExp"});var regexp=BSONRegExp;function _classCallCheck$4(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function _defineProperties$4(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}function _createClass$4(e,t,r){return t&&_defineProperties$4(e.prototype,t),r&&_defineProperties$4(e,r),e}var BSONSymbol=function(){function e(t){_classCallCheck$4(this,e),this.value=t}return _createClass$4(e,[{key:"valueOf",value:function(){return this.value}},{key:"toString",value:function(){return this.value}},{key:"inspect",value:function(){return this.value}},{key:"toJSON",value:function(){return this.value}},{key:"toExtendedJSON",value:function(){return{$symbol:this.value}}}],[{key:"fromExtendedJSON",value:function(t){return new e(t.$symbol)}}]),e}();Object.defineProperty(BSONSymbol.prototype,"_bsontype",{value:"Symbol"});var symbol=BSONSymbol;function _classCallCheck$5(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function _defineProperties$5(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}function _createClass$5(e,t,r){return t&&_defineProperties$5(e.prototype,t),r&&_defineProperties$5(e,r),e}var Int32=function(){function e(t){_classCallCheck$5(this,e),this.value=t}return _createClass$5(e,[{key:"valueOf",value:function(){return this.value}},{key:"toJSON",value:function(){return this.value}},{key:"toExtendedJSON",value:function(e){return e&&e.relaxed?this.value:{$numberInt:this.value.toString()}}}],[{key:"fromExtendedJSON",value:function(t,r){return r&&r.relaxed?parseInt(t.$numberInt,10):new e(t.$numberInt)}}]),e}();Object.defineProperty(Int32.prototype,"_bsontype",{value:"Int32"});var int_32=Int32;function _classCallCheck$6(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function _defineProperties$6(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}function _createClass$6(e,t,r){return t&&_defineProperties$6(e.prototype,t),r&&_defineProperties$6(e,r),e}var Code=function(){function e(t,r){_classCallCheck$6(this,e),this.code=t,this.scope=r}return _createClass$6(e,[{key:"toJSON",value:function(){return{scope:this.scope,code:this.code}}},{key:"toExtendedJSON",value:function(){return this.scope?{$code:this.code,$scope:this.scope}:{$code:this.code}}}],[{key:"fromExtendedJSON",value:function(t){return new e(t.$code,t.$scope)}}]),e}();Object.defineProperty(Code.prototype,"_bsontype",{value:"Code"});var code=Code,Buffer$2=buffer.Buffer,PARSE_STRING_REGEXP=/^(\+|-)?(\d+|(\d*\.\d*))?(E|e)?([-+])?(\d+)?$/,PARSE_INF_REGEXP=/^(\+|-)?(Infinity|inf)$/i,PARSE_NAN_REGEXP=/^(\+|-)?NaN$/i,EXPONENT_MAX=6111,EXPONENT_MIN=-6176,EXPONENT_BIAS=6176,MAX_DIGITS=34,NAN_BUFFER=[124,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0].reverse(),INF_NEGATIVE_BUFFER=[248,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0].reverse(),INF_POSITIVE_BUFFER=[120,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0].reverse(),EXPONENT_REGEX=/^([-+])?(\d+)?$/;function isDigit(e){return!isNaN(parseInt(e,10))}function divideu128(e){var t=long_1.fromNumber(1e9),r=long_1.fromNumber(0);if(!(e.parts[0]||e.parts[1]||e.parts[2]||e.parts[3]))return{quotient:e,rem:r};for(var n=0;n<=3;n++)r=(r=r.shiftLeft(32)).add(new long_1(e.parts[n],0)),e.parts[n]=r.div(t).low,r=r.modulo(t);return{quotient:e,rem:r}}function multiply64x2(e,t){if(!e&&!t)return{high:long_1.fromNumber(0),low:long_1.fromNumber(0)};var r=e.shiftRightUnsigned(32),n=new long_1(e.getLowBits(),0),i=t.shiftRightUnsigned(32),o=new long_1(t.getLowBits(),0),s=r.multiply(i),a=r.multiply(o),u=n.multiply(i),c=n.multiply(o);return s=s.add(a.shiftRightUnsigned(32)),a=new long_1(a.getLowBits(),0).add(u).add(c.shiftRightUnsigned(32)),{high:s=s.add(a.shiftRightUnsigned(32)),low:c=a.shiftLeft(32).add(new long_1(c.getLowBits(),0))}}function lessThan(e,t){var r=e.high>>>0,n=t.high>>>0;return r<n||r===n&&e.low>>>0<t.low>>>0}function invalidErr(e,t){throw new TypeError('"'.concat(e,'" is not a valid Decimal128 string - ').concat(t))}function Decimal128(e){this.bytes=e}Decimal128.fromString=function(e){var t,r=!1,n=!1,i=!1,o=0,s=0,a=0,u=0,c=0,f=[0],l=0,h=0,p=0,d=0,y=0,m=0,g=[0,0],_=[0,0],v=0;if(e.length>=7e3)throw new TypeError(e+" not a valid Decimal128 string");var b=e.match(PARSE_STRING_REGEXP),w=e.match(PARSE_INF_REGEXP),E=e.match(PARSE_NAN_REGEXP);if(!b&&!w&&!E||0===e.length)throw new TypeError(e+" not a valid Decimal128 string");if(b){var B=b[2],A=b[4],S=b[5],x=b[6];A&&void 0===x&&invalidErr(e,"missing exponent power"),A&&void 0===B&&invalidErr(e,"missing exponent base"),void 0===A&&(S||x)&&invalidErr(e,"missing e before exponent")}if("+"!==e[v]&&"-"!==e[v]||(r="-"===e[v++]),!isDigit(e[v])&&"."!==e[v]){if("i"===e[v]||"I"===e[v])return new Decimal128(Buffer$2.from(r?INF_NEGATIVE_BUFFER:INF_POSITIVE_BUFFER));if("N"===e[v])return new Decimal128(Buffer$2.from(NAN_BUFFER))}for(;isDigit(e[v])||"."===e[v];)"."!==e[v]?(l<34&&("0"!==e[v]||i)&&(i||(c=s),i=!0,f[h++]=parseInt(e[v],10),l+=1),i&&(a+=1),n&&(u+=1),s+=1,v+=1):(n&&invalidErr(e,"contains multiple periods"),n=!0,v+=1);if(n&&!s)throw new TypeError(e+" not a valid Decimal128 string");if("e"===e[v]||"E"===e[v]){var T=e.substr(++v).match(EXPONENT_REGEX);if(!T||!T[2])return new Decimal128(Buffer$2.from(NAN_BUFFER));y=parseInt(T[0],10),v+=T[0].length}if(e[v])return new Decimal128(Buffer$2.from(NAN_BUFFER));if(p=0,l){if(d=l-1,1!==(o=a))for(;"0"===e[c+o-1];)o-=1}else p=0,d=0,f[0]=0,a=1,l=1,o=0;for(y<=u&&u-y>16384?y=EXPONENT_MIN:y-=u;y>EXPONENT_MAX;){if((d+=1)-p>MAX_DIGITS){if(f.join("").match(/^0+$/)){y=EXPONENT_MAX;break}invalidErr(e,"overflow")}y-=1}for(;y<EXPONENT_MIN||l<a;){if(0===d&&o<l){y=EXPONENT_MIN,o=0;break}if(l<a?a-=1:d-=1,y<EXPONENT_MAX)y+=1;else{if(f.join("").match(/^0+$/)){y=EXPONENT_MAX;break}invalidErr(e,"overflow")}}if(d-p+1<o){var N=s;n&&(c+=1,N+=1),r&&(c+=1,N+=1);var O=parseInt(e[c+d+1],10),k=0;if(O>=5&&(k=1,5===O))for(k=f[d]%2==1,m=c+d+2;m<N;m++)if(parseInt(e[m],10)){k=1;break}if(k)for(var I=d;I>=0;I--)if(++f[I]>9&&(f[I]=0,0===I)){if(!(y<EXPONENT_MAX))return new Decimal128(Buffer$2.from(r?INF_NEGATIVE_BUFFER:INF_POSITIVE_BUFFER));y+=1,f[I]=1}}if(g=long_1.fromNumber(0),_=long_1.fromNumber(0),0===o)g=long_1.fromNumber(0),_=long_1.fromNumber(0);else if(d-p<17){var F=p;for(_=long_1.fromNumber(f[F++]),g=new long_1(0,0);F<=d;F++)_=(_=_.multiply(long_1.fromNumber(10))).add(long_1.fromNumber(f[F]))}else{var D=p;for(g=long_1.fromNumber(f[D++]);D<=d-17;D++)g=(g=g.multiply(long_1.fromNumber(10))).add(long_1.fromNumber(f[D]));for(_=long_1.fromNumber(f[D++]);D<=d;D++)_=(_=_.multiply(long_1.fromNumber(10))).add(long_1.fromNumber(f[D]))}var R=multiply64x2(g,long_1.fromString("100000000000000000"));R.low=R.low.add(_),lessThan(R.low,_)&&(R.high=R.high.add(long_1.fromNumber(1))),t=y+EXPONENT_BIAS;var C={low:long_1.fromNumber(0),high:long_1.fromNumber(0)};R.high.shiftRightUnsigned(49).and(long_1.fromNumber(1)).equals(long_1.fromNumber(1))?(C.high=C.high.or(long_1.fromNumber(3).shiftLeft(61)),C.high=C.high.or(long_1.fromNumber(t).and(long_1.fromNumber(16383).shiftLeft(47))),C.high=C.high.or(R.high.and(long_1.fromNumber(0x7fffffffffff)))):(C.high=C.high.or(long_1.fromNumber(16383&t).shiftLeft(49)),C.high=C.high.or(R.high.and(long_1.fromNumber(562949953421311)))),C.low=R.low,r&&(C.high=C.high.or(long_1.fromString("9223372036854775808")));var L=Buffer$2.alloc(16);return v=0,L[v++]=255&C.low.low,L[v++]=C.low.low>>8&255,L[v++]=C.low.low>>16&255,L[v++]=C.low.low>>24&255,L[v++]=255&C.low.high,L[v++]=C.low.high>>8&255,L[v++]=C.low.high>>16&255,L[v++]=C.low.high>>24&255,L[v++]=255&C.high.low,L[v++]=C.high.low>>8&255,L[v++]=C.high.low>>16&255,L[v++]=C.high.low>>24&255,L[v++]=255&C.high.high,L[v++]=C.high.high>>8&255,L[v++]=C.high.high>>16&255,L[v++]=C.high.high>>24&255,new Decimal128(L)};var COMBINATION_MASK=31,EXPONENT_MASK=16383,COMBINATION_INFINITY=30,COMBINATION_NAN=31;Decimal128.prototype.toString=function(){for(var e,t,r,n,i,o,s=0,a=new Array(36),u=0;u<a.length;u++)a[u]=0;var c,f,l,h,p,d=0,y=!1,m={parts:new Array(4)},g=[];d=0;var _=this.bytes;if(n=_[d++]|_[d++]<<8|_[d++]<<16|_[d++]<<24,r=_[d++]|_[d++]<<8|_[d++]<<16|_[d++]<<24,t=_[d++]|_[d++]<<8|_[d++]<<16|_[d++]<<24,e=_[d++]|_[d++]<<8|_[d++]<<16|_[d++]<<24,d=0,(new long_1(n,r),new long_1(t,e)).lessThan(long_1.ZERO)&&g.push("-"),(i=e>>26&COMBINATION_MASK)>>3==3){if(i===COMBINATION_INFINITY)return g.join("")+"Infinity";if(i===COMBINATION_NAN)return"NaN";o=e>>15&EXPONENT_MASK,l=8+(e>>14&1)}else l=e>>14&7,o=e>>17&EXPONENT_MASK;if(c=o-EXPONENT_BIAS,m.parts[0]=(16383&e)+((15&l)<<14),m.parts[1]=t,m.parts[2]=r,m.parts[3]=n,0===m.parts[0]&&0===m.parts[1]&&0===m.parts[2]&&0===m.parts[3])y=!0;else for(p=3;p>=0;p--){var v=0,b=divideu128(m);if(m=b.quotient,v=b.rem.low)for(h=8;h>=0;h--)a[9*p+h]=v%10,v=Math.floor(v/10)}if(y)s=1,a[d]=0;else for(s=36;!a[d];)s-=1,d+=1;if((f=s-1+c)>=34||f<=-7||c>0){if(s>34)return g.push(0),c>0?g.push("E+"+c):c<0&&g.push("E"+c),g.join("");g.push(a[d++]),(s-=1)&&g.push(".");for(var w=0;w<s;w++)g.push(a[d++]);g.push("E"),f>0?g.push("+"+f):g.push(f)}else if(c>=0)for(var E=0;E<s;E++)g.push(a[d++]);else{var B=s+c;if(B>0)for(var A=0;A<B;A++)g.push(a[d++]);else g.push("0");for(g.push(".");B++<0;)g.push("0");for(var S=0;S<s-Math.max(B-1,0);S++)g.push(a[d++])}return g.join("")},Decimal128.prototype.toJSON=function(){return{$numberDecimal:this.toString()}},Decimal128.prototype.toExtendedJSON=function(){return{$numberDecimal:this.toString()}},Decimal128.fromExtendedJSON=function(e){return Decimal128.fromString(e.$numberDecimal)},Object.defineProperty(Decimal128.prototype,"_bsontype",{value:"Decimal128"});var decimal128=Decimal128;function _classCallCheck$7(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function _defineProperties$7(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}function _createClass$7(e,t,r){return t&&_defineProperties$7(e.prototype,t),r&&_defineProperties$7(e,r),e}var MinKey=function(){function e(){_classCallCheck$7(this,e)}return _createClass$7(e,[{key:"toExtendedJSON",value:function(){return{$minKey:1}}}],[{key:"fromExtendedJSON",value:function(){return new e}}]),e}();Object.defineProperty(MinKey.prototype,"_bsontype",{value:"MinKey"});var min_key=MinKey;function _classCallCheck$8(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function _defineProperties$8(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}function _createClass$8(e,t,r){return t&&_defineProperties$8(e.prototype,t),r&&_defineProperties$8(e,r),e}var MaxKey=function(){function e(){_classCallCheck$8(this,e)}return _createClass$8(e,[{key:"toExtendedJSON",value:function(){return{$maxKey:1}}}],[{key:"fromExtendedJSON",value:function(){return new e}}]),e}();Object.defineProperty(MaxKey.prototype,"_bsontype",{value:"MaxKey"});var max_key=MaxKey;function _classCallCheck$9(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function _defineProperties$9(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}function _createClass$9(e,t,r){return t&&_defineProperties$9(e.prototype,t),r&&_defineProperties$9(e,r),e}var DBRef=function(){function e(t,r,n,i){_classCallCheck$9(this,e);var o=t.split(".");2===o.length&&(n=o.shift(),t=o.shift()),this.collection=t,this.oid=r,this.db=n,this.fields=i||{}}return _createClass$9(e,[{key:"toJSON",value:function(){var e=Object.assign({$ref:this.collection,$id:this.oid},this.fields);return null!=this.db&&(e.$db=this.db),e}},{key:"toExtendedJSON",value:function(){var e={$ref:this.collection,$id:this.oid};return this.db&&(e.$db=this.db),e=Object.assign(e,this.fields)}}],[{key:"fromExtendedJSON",value:function(t){var r=Object.assign({},t);return["$ref","$id","$db"].forEach((function(e){return delete r[e]})),new e(t.$ref,t.$id,t.$db,r)}}]),e}();Object.defineProperty(DBRef.prototype,"_bsontype",{value:"DBRef"}),Object.defineProperty(DBRef.prototype,"namespace",{get:function(){return this.collection},set:function(e){this.collection=e},configurable:!1});var db_ref=DBRef;function _classCallCheck$a(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function _defineProperties$a(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}function _createClass$a(e,t,r){return t&&_defineProperties$a(e.prototype,t),r&&_defineProperties$a(e,r),e}var Buffer$3=buffer.Buffer,Binary=function(){function e(t,r){if(_classCallCheck$a(this,e),!(null==t||"string"==typeof t||Buffer$3.isBuffer(t)||t instanceof Uint8Array||Array.isArray(t)))throw new TypeError("only String, Buffer, Uint8Array or Array accepted");if(this.sub_type=null==r?BSON_BINARY_SUBTYPE_DEFAULT:r,this.position=0,null==t||t instanceof Number)void 0!==Buffer$3?this.buffer=Buffer$3.alloc(e.BUFFER_SIZE):"undefined"!=typeof Uint8Array?this.buffer=new Uint8Array(new ArrayBuffer(e.BUFFER_SIZE)):this.buffer=new Array(e.BUFFER_SIZE);else{if("string"==typeof t)if(void 0!==Buffer$3)this.buffer=Buffer$3.from(t);else{if("undefined"==typeof Uint8Array&&!Array.isArray(t))throw new TypeError("only String, Buffer, Uint8Array or Array accepted");this.buffer=writeStringToArray(t)}else this.buffer=t;this.position=t.length}}return _createClass$a(e,[{key:"put",value:function(t){if(null!=t.length&&"number"!=typeof t&&1!==t.length)throw new TypeError("only accepts single character String, Uint8Array or Array");if("number"!=typeof t&&t<0||t>255)throw new TypeError("only accepts number in a valid unsigned byte range 0-255");var r=null;if(r="string"==typeof t?t.charCodeAt(0):null!=t.length?t[0]:t,this.buffer.length>this.position)this.buffer[this.position++]=r;else if(void 0!==Buffer$3&&Buffer$3.isBuffer(this.buffer)){var n=Buffer$3.alloc(e.BUFFER_SIZE+this.buffer.length);this.buffer.copy(n,0,0,this.buffer.length),this.buffer=n,this.buffer[this.position++]=r}else{var i=null;i=isUint8Array(this.buffer)?new Uint8Array(new ArrayBuffer(e.BUFFER_SIZE+this.buffer.length)):new Array(e.BUFFER_SIZE+this.buffer.length);for(var o=0;o<this.buffer.length;o++)i[o]=this.buffer[o];this.buffer=i,this.buffer[this.position++]=r}}},{key:"write",value:function(e,t){if(t="number"==typeof t?t:this.position,this.buffer.length<t+e.length){var r=null;if(void 0!==Buffer$3&&Buffer$3.isBuffer(this.buffer))r=Buffer$3.alloc(this.buffer.length+e.length),this.buffer.copy(r,0,0,this.buffer.length);else if(isUint8Array(this.buffer)){r=new Uint8Array(new ArrayBuffer(this.buffer.length+e.length));for(var n=0;n<this.position;n++)r[n]=this.buffer[n]}this.buffer=r}if(void 0!==Buffer$3&&Buffer$3.isBuffer(e)&&Buffer$3.isBuffer(this.buffer))e.copy(this.buffer,t,0,e.length),this.position=t+e.length>this.position?t+e.length:this.position;else if(void 0!==Buffer$3&&"string"==typeof e&&Buffer$3.isBuffer(this.buffer))this.buffer.write(e,t,"binary"),this.position=t+e.length>this.position?t+e.length:this.position;else if(isUint8Array(e)||Array.isArray(e)&&"string"!=typeof e){for(var i=0;i<e.length;i++)this.buffer[t++]=e[i];this.position=t>this.position?t:this.position}else if("string"==typeof e){for(var o=0;o<e.length;o++)this.buffer[t++]=e.charCodeAt(o);this.position=t>this.position?t:this.position}}},{key:"read",value:function(e,t){if(t=t&&t>0?t:this.position,this.buffer.slice)return this.buffer.slice(e,e+t);for(var r="undefined"!=typeof Uint8Array?new Uint8Array(new ArrayBuffer(t)):new Array(t),n=0;n<t;n++)r[n]=this.buffer[e++];return r}},{key:"value",value:function(e){if((e=null!=e&&e)&&void 0!==Buffer$3&&Buffer$3.isBuffer(this.buffer)&&this.buffer.length===this.position)return this.buffer;if(void 0!==Buffer$3&&Buffer$3.isBuffer(this.buffer))return e?this.buffer.slice(0,this.position):this.buffer.toString("binary",0,this.position);if(e){if(null!=this.buffer.slice)return this.buffer.slice(0,this.position);for(var t=isUint8Array(this.buffer)?new Uint8Array(new ArrayBuffer(this.position)):new Array(this.position),r=0;r<this.position;r++)t[r]=this.buffer[r];return t}return convertArraytoUtf8BinaryString(this.buffer,0,this.position)}},{key:"length",value:function(){return this.position}},{key:"toJSON",value:function(){return null!=this.buffer?this.buffer.toString("base64"):""}},{key:"toString",value:function(e){return null!=this.buffer?this.buffer.slice(0,this.position).toString(e):""}},{key:"toExtendedJSON",value:function(){var e=Buffer$3.isBuffer(this.buffer)?this.buffer.toString("base64"):Buffer$3.from(this.buffer).toString("base64"),t=Number(this.sub_type).toString(16);return{$binary:{base64:e,subType:1===t.length?"0"+t:t}}}}],[{key:"fromExtendedJSON",value:function(t){var r=t.$binary.subType?parseInt(t.$binary.subType,16):0;return new e(Buffer$3.from(t.$binary.base64,"base64"),r)}}]),e}(),BSON_BINARY_SUBTYPE_DEFAULT=0;function isUint8Array(e){return"[object Uint8Array]"===Object.prototype.toString.call(e)}function writeStringToArray(e){for(var t="undefined"!=typeof Uint8Array?new Uint8Array(new ArrayBuffer(e.length)):new Array(e.length),r=0;r<e.length;r++)t[r]=e.charCodeAt(r);return t}function convertArraytoUtf8BinaryString(e,t,r){for(var n="",i=t;i<r;i++)n+=String.fromCharCode(e[i]);return n}Binary.BUFFER_SIZE=256,Binary.SUBTYPE_DEFAULT=0,Binary.SUBTYPE_FUNCTION=1,Binary.SUBTYPE_BYTE_ARRAY=2,Binary.SUBTYPE_UUID_OLD=3,Binary.SUBTYPE_UUID=4,Binary.SUBTYPE_MD5=5,Binary.SUBTYPE_USER_DEFINED=128,Object.defineProperty(Binary.prototype,"_bsontype",{value:"Binary"});var binary=Binary,constants={BSON_INT32_MAX:2147483647,BSON_INT32_MIN:-2147483648,BSON_INT64_MAX:Math.pow(2,63)-1,BSON_INT64_MIN:-Math.pow(2,63),JS_INT_MAX:9007199254740992,JS_INT_MIN:-9007199254740992,BSON_DATA_NUMBER:1,BSON_DATA_STRING:2,BSON_DATA_OBJECT:3,BSON_DATA_ARRAY:4,BSON_DATA_BINARY:5,BSON_DATA_UNDEFINED:6,BSON_DATA_OID:7,BSON_DATA_BOOLEAN:8,BSON_DATA_DATE:9,BSON_DATA_NULL:10,BSON_DATA_REGEXP:11,BSON_DATA_DBPOINTER:12,BSON_DATA_CODE:13,BSON_DATA_SYMBOL:14,BSON_DATA_CODE_W_SCOPE:15,BSON_DATA_INT:16,BSON_DATA_TIMESTAMP:17,BSON_DATA_LONG:18,BSON_DATA_DECIMAL128:19,BSON_DATA_MIN_KEY:255,BSON_DATA_MAX_KEY:127,BSON_BINARY_SUBTYPE_DEFAULT:0,BSON_BINARY_SUBTYPE_FUNCTION:1,BSON_BINARY_SUBTYPE_BYTE_ARRAY:2,BSON_BINARY_SUBTYPE_UUID:3,BSON_BINARY_SUBTYPE_MD5:4,BSON_BINARY_SUBTYPE_USER_DEFINED:128};function _typeof$2(e){return(_typeof$2="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}var keysToCodecs={$oid:objectid,$binary:binary,$symbol:symbol,$numberInt:int_32,$numberDecimal:decimal128,$numberDouble:double_1,$numberLong:long_1,$minKey:min_key,$maxKey:max_key,$regularExpression:regexp,$timestamp:timestamp};function deserializeValue(e,t,r,n){if("number"==typeof r){if(n.relaxed)return r;if(Math.floor(r)===r){if(r>=BSON_INT32_MIN&&r<=BSON_INT32_MAX)return new int_32(r);if(r>=BSON_INT64_MIN&&r<=BSON_INT64_MAX)return new long_1.fromNumber(r)}return new double_1(r)}if(null==r||"object"!==_typeof$2(r))return r;if(r.$undefined)return null;for(var i=Object.keys(r).filter((function(e){return e.startsWith("$")&&null!=r[e]})),o=0;o<i.length;o++){var s=keysToCodecs[i[o]];if(s)return s.fromExtendedJSON(r,n)}if(null!=r.$date){var a=r.$date,u=new Date;return"string"==typeof a?u.setTime(Date.parse(a)):long_1.isLong(a)?u.setTime(a.toNumber()):"number"==typeof a&&n.relaxed&&u.setTime(a),u}if(null!=r.$code){var c=Object.assign({},r);return r.$scope&&(c.$scope=deserializeValue(e,null,r.$scope)),code.fromExtendedJSON(r)}if(null!=r.$ref||null!=r.$dbPointer){var f=r.$ref?r:r.$dbPointer;if(f instanceof db_ref)return f;var l=Object.keys(f).filter((function(e){return e.startsWith("$")})),h=!0;if(l.forEach((function(e){-1===["$ref","$id","$db"].indexOf(e)&&(h=!1)})),h)return db_ref.fromExtendedJSON(f)}return r}function parse(e,t){var r=this;return"boolean"==typeof(t=Object.assign({},{relaxed:!0},t)).relaxed&&(t.strict=!t.relaxed),"boolean"==typeof t.strict&&(t.relaxed=!t.strict),JSON.parse(e,(function(e,n){return deserializeValue(r,e,n,t)}))}var BSON_INT32_MAX=2147483647,BSON_INT32_MIN=-2147483648,BSON_INT64_MAX=0x8000000000000000,BSON_INT64_MIN=-0x8000000000000000;function stringify(e,t,r,n){null!=r&&"object"===_typeof$2(r)&&(n=r,r=0),null==t||"object"!==_typeof$2(t)||Array.isArray(t)||(n=t,t=null,r=0),n=Object.assign({},{relaxed:!0},n);var i=Array.isArray(e)?serializeArray(e,n):serializeDocument(e,n);return JSON.stringify(i,t,r)}function serialize(e,t){return t=t||{},JSON.parse(stringify(e,t))}function deserialize(e,t){return t=t||{},parse(JSON.stringify(e),t)}function serializeArray(e,t){return e.map((function(e){return serializeValue(e,t)}))}function getISOString(e){var t=e.toISOString();return 0!==e.getUTCMilliseconds()?t:t.slice(0,-5)+"Z"}function serializeValue(e,t){if(Array.isArray(e))return serializeArray(e,t);if(void 0===e)return null;if(e instanceof Date){var r=e.getTime(),n=r>-1&&r<2534023188e5;return t.relaxed&&n?{$date:getISOString(e)}:{$date:{$numberLong:e.getTime().toString()}}}if("number"==typeof e&&!t.relaxed){if(Math.floor(e)===e){var i=e>=BSON_INT64_MIN&&e<=BSON_INT64_MAX;if(e>=BSON_INT32_MIN&&e<=BSON_INT32_MAX)return{$numberInt:e.toString()};if(i)return{$numberLong:e.toString()}}return{$numberDouble:e.toString()}}if(e instanceof RegExp){var o=e.flags;return void 0===o&&(o=e.toString().match(/[gimuy]*$/)[0]),new regexp(e.source,o).toExtendedJSON()}return null!=e&&"object"===_typeof$2(e)?serializeDocument(e,t):e}var BSON_TYPE_MAPPINGS={Binary:function(e){return new binary(e.value(),e.subtype)},Code:function(e){return new code(e.code,e.scope)},DBRef:function(e){return new db_ref(e.collection||e.namespace,e.oid,e.db,e.fields)},Decimal128:function(e){return new decimal128(e.bytes)},Double:function(e){return new double_1(e.value)},Int32:function(e){return new int_32(e.value)},Long:function(e){return long_1.fromBits(null!=e.low?e.low:e.low_,null!=e.low?e.high:e.high_,null!=e.low?e.unsigned:e.unsigned_)},MaxKey:function(){return new max_key},MinKey:function(){return new min_key},ObjectID:function(e){return new objectid(e)},ObjectId:function(e){return new objectid(e)},BSONRegExp:function(e){return new regexp(e.pattern,e.options)},Symbol:function(e){return new symbol(e.value)},Timestamp:function(e){return timestamp.fromBits(e.low,e.high)}};function serializeDocument(e,t){if(null==e||"object"!==_typeof$2(e))throw new Error("not an object instance");var r=e._bsontype;if(void 0===r){var n={};for(var i in e)n[i]=serializeValue(e[i],t);return n}if("string"==typeof r){var o=e;if("function"!=typeof o.toExtendedJSON){var s=BSON_TYPE_MAPPINGS[r];if(!s)throw new TypeError("Unrecognized or invalid _bsontype: "+r);o=s(o)}return"Code"===r&&o.scope?o=new code(o.code,serializeValue(o.scope,t)):"DBRef"===r&&o.oid&&(o=new db_ref(o.collection,serializeValue(o.oid,t),o.db,o.fields)),o.toExtendedJSON(t)}throw new Error("_bsontype must be a string, but was: "+_typeof$2(r))}var extended_json={parse:parse,deserialize:deserialize,serialize:serialize,stringify:stringify},FIRST_BIT=128,FIRST_TWO_BITS=192,FIRST_THREE_BITS=224,FIRST_FOUR_BITS=240,FIRST_FIVE_BITS=248,TWO_BIT_CHAR=192,THREE_BIT_CHAR=224,FOUR_BIT_CHAR=240,CONTINUING_CHAR=128;function validateUtf8(e,t,r){for(var n=0,i=t;i<r;i+=1){var o=e[i];if(n){if((o&FIRST_TWO_BITS)!==CONTINUING_CHAR)return!1;n-=1}else if(o&FIRST_BIT)if((o&FIRST_THREE_BITS)===TWO_BIT_CHAR)n=1;else if((o&FIRST_FOUR_BITS)===THREE_BIT_CHAR)n=2;else{if((o&FIRST_FIVE_BITS)!==FOUR_BIT_CHAR)return!1;n=3}}return!n}var validateUtf8_1=validateUtf8,validate_utf8={validateUtf8:validateUtf8_1},Buffer$4=buffer.Buffer,validateUtf8$1=validate_utf8.validateUtf8,JS_INT_MAX_LONG=long_1.fromNumber(constants.JS_INT_MAX),JS_INT_MIN_LONG=long_1.fromNumber(constants.JS_INT_MIN),functionCache={};function deserialize$1(e,t,r){var n=(t=null==t?{}:t)&&t.index?t.index:0,i=e[n]|e[n+1]<<8|e[n+2]<<16|e[n+3]<<24;if(i<5)throw new Error("bson size must be >= 5, is ".concat(i));if(t.allowObjectSmallerThanBufferSize&&e.length<i)throw new Error("buffer length ".concat(e.length," must be >= bson size ").concat(i));if(!t.allowObjectSmallerThanBufferSize&&e.length!==i)throw new Error("buffer length ".concat(e.length," must === bson size ").concat(i));if(i+n>e.length)throw new Error("(bson size ".concat(i," + options.index ").concat(n," must be <= buffer length ").concat(Buffer$4.byteLength(e),")"));if(0!==e[n+i-1])throw new Error("One object, sized correctly, with a spot for an EOO, but the EOO isn't 0x00");return deserializeObject(e,n,t,r)}function deserializeObject(e,t,r,n){var i=null!=r.evalFunctions&&r.evalFunctions,o=null!=r.cacheFunctions&&r.cacheFunctions,s=null!=r.cacheFunctionsCrc32&&r.cacheFunctionsCrc32;if(!s)var a=null;var u=null==r.fieldsAsRaw?null:r.fieldsAsRaw,c=null!=r.raw&&r.raw,f="boolean"==typeof r.bsonRegExp&&r.bsonRegExp,l=null!=r.promoteBuffers&&r.promoteBuffers,h=null==r.promoteLongs||r.promoteLongs,p=null==r.promoteValues||r.promoteValues,d=t;if(e.length<5)throw new Error("corrupt bson message < 5 bytes long");var y=e[t++]|e[t++]<<8|e[t++]<<16|e[t++]<<24;if(y<5||y>e.length)throw new Error("corrupt bson message");for(var m=n?[]:{},g=0;;){var _=e[t++];if(0===_)break;for(var v=t;0!==e[v]&&v<e.length;)v++;if(v>=Buffer$4.byteLength(e))throw new Error("Bad BSON Document: illegal CString");var b=n?g++:e.toString("utf8",t,v);if(t=v+1,_===constants.BSON_DATA_STRING){var w=e[t++]|e[t++]<<8|e[t++]<<16|e[t++]<<24;if(w<=0||w>e.length-t||0!==e[t+w-1])throw new Error("bad string length in bson");if(!validateUtf8$1(e,t,t+w-1))throw new Error("Invalid UTF-8 string in BSON document");var E=e.toString("utf8",t,t+w-1);m[b]=E,t+=w}else if(_===constants.BSON_DATA_OID){var B=Buffer$4.alloc(12);e.copy(B,0,t,t+12),m[b]=new objectid(B),t+=12}else if(_===constants.BSON_DATA_INT&&!1===p)m[b]=new int_32(e[t++]|e[t++]<<8|e[t++]<<16|e[t++]<<24);else if(_===constants.BSON_DATA_INT)m[b]=e[t++]|e[t++]<<8|e[t++]<<16|e[t++]<<24;else if(_===constants.BSON_DATA_NUMBER&&!1===p)m[b]=new double_1(e.readDoubleLE(t)),t+=8;else if(_===constants.BSON_DATA_NUMBER)m[b]=e.readDoubleLE(t),t+=8;else if(_===constants.BSON_DATA_DATE){var A=e[t++]|e[t++]<<8|e[t++]<<16|e[t++]<<24,S=e[t++]|e[t++]<<8|e[t++]<<16|e[t++]<<24;m[b]=new Date(new long_1(A,S).toNumber())}else if(_===constants.BSON_DATA_BOOLEAN){if(0!==e[t]&&1!==e[t])throw new Error("illegal boolean type value");m[b]=1===e[t++]}else if(_===constants.BSON_DATA_OBJECT){var x=t,T=e[t]|e[t+1]<<8|e[t+2]<<16|e[t+3]<<24;if(T<=0||T>e.length-t)throw new Error("bad embedded document length in bson");m[b]=c?e.slice(t,t+T):deserializeObject(e,x,r,!1),t+=T}else if(_===constants.BSON_DATA_ARRAY){var N=t,O=e[t]|e[t+1]<<8|e[t+2]<<16|e[t+3]<<24,k=r,I=t+O;if(u&&u[b]){for(var F in k={},r)k[F]=r[F];k.raw=!0}if(m[b]=deserializeObject(e,N,k,!0),0!==e[(t+=O)-1])throw new Error("invalid array terminator byte");if(t!==I)throw new Error("corrupted array bson")}else if(_===constants.BSON_DATA_UNDEFINED)m[b]=void 0;else if(_===constants.BSON_DATA_NULL)m[b]=null;else if(_===constants.BSON_DATA_LONG){var D=e[t++]|e[t++]<<8|e[t++]<<16|e[t++]<<24,R=e[t++]|e[t++]<<8|e[t++]<<16|e[t++]<<24,C=new long_1(D,R);m[b]=h&&!0===p&&C.lessThanOrEqual(JS_INT_MAX_LONG)&&C.greaterThanOrEqual(JS_INT_MIN_LONG)?C.toNumber():C}else if(_===constants.BSON_DATA_DECIMAL128){var L=Buffer$4.alloc(16);e.copy(L,0,t,t+16),t+=16;var P=new decimal128(L);m[b]=P.toObject?P.toObject():P}else if(_===constants.BSON_DATA_BINARY){var j=e[t++]|e[t++]<<8|e[t++]<<16|e[t++]<<24,M=j,U=e[t++];if(j<0)throw new Error("Negative binary type element size found");if(j>Buffer$4.byteLength(e))throw new Error("Binary type size larger than document size");if(null!=e.slice){if(U===binary.SUBTYPE_BYTE_ARRAY){if((j=e[t++]|e[t++]<<8|e[t++]<<16|e[t++]<<24)<0)throw new Error("Negative binary type element size found for subtype 0x02");if(j>M-4)throw new Error("Binary type with subtype 0x02 contains to long binary size");if(j<M-4)throw new Error("Binary type with subtype 0x02 contains to short binary size")}m[b]=l&&p?e.slice(t,t+j):new binary(e.slice(t,t+j),U)}else{var z="undefined"!=typeof Uint8Array?new Uint8Array(new ArrayBuffer(j)):new Array(j);if(U===binary.SUBTYPE_BYTE_ARRAY){if((j=e[t++]|e[t++]<<8|e[t++]<<16|e[t++]<<24)<0)throw new Error("Negative binary type element size found for subtype 0x02");if(j>M-4)throw new Error("Binary type with subtype 0x02 contains to long binary size");if(j<M-4)throw new Error("Binary type with subtype 0x02 contains to short binary size")}for(v=0;v<j;v++)z[v]=e[t+v];m[b]=l&&p?z:new binary(z,U)}t+=j}else if(_===constants.BSON_DATA_REGEXP&&!1===f){for(v=t;0!==e[v]&&v<e.length;)v++;if(v>=e.length)throw new Error("Bad BSON Document: illegal CString");var $=e.toString("utf8",t,v);for(v=t=v+1;0!==e[v]&&v<e.length;)v++;if(v>=e.length)throw new Error("Bad BSON Document: illegal CString");var Y=e.toString("utf8",t,v);t=v+1;var H=new Array(Y.length);for(v=0;v<Y.length;v++)switch(Y[v]){case"m":H[v]="m";break;case"s":H[v]="g";break;case"i":H[v]="i"}m[b]=new RegExp($,H.join(""))}else if(_===constants.BSON_DATA_REGEXP&&!0===f){for(v=t;0!==e[v]&&v<e.length;)v++;if(v>=e.length)throw new Error("Bad BSON Document: illegal CString");var q=e.toString("utf8",t,v);for(v=t=v+1;0!==e[v]&&v<e.length;)v++;if(v>=e.length)throw new Error("Bad BSON Document: illegal CString");var Z=e.toString("utf8",t,v);t=v+1,m[b]=new regexp(q,Z)}else if(_===constants.BSON_DATA_SYMBOL){var V=e[t++]|e[t++]<<8|e[t++]<<16|e[t++]<<24;if(V<=0||V>e.length-t||0!==e[t+V-1])throw new Error("bad string length in bson");m[b]=e.toString("utf8",t,t+V-1),t+=V}else if(_===constants.BSON_DATA_TIMESTAMP){var J=e[t++]|e[t++]<<8|e[t++]<<16|e[t++]<<24,G=e[t++]|e[t++]<<8|e[t++]<<16|e[t++]<<24;m[b]=new timestamp(J,G)}else if(_===constants.BSON_DATA_MIN_KEY)m[b]=new min_key;else if(_===constants.BSON_DATA_MAX_KEY)m[b]=new max_key;else if(_===constants.BSON_DATA_CODE){var W=e[t++]|e[t++]<<8|e[t++]<<16|e[t++]<<24;if(W<=0||W>e.length-t||0!==e[t+W-1])throw new Error("bad string length in bson");var X=e.toString("utf8",t,t+W-1);if(i)if(o){var K=s?a(X):X;m[b]=isolateEvalWithHash(functionCache,K,X,m)}else m[b]=isolateEval(X);else m[b]=new code(X);t+=W}else if(_===constants.BSON_DATA_CODE_W_SCOPE){var Q=e[t++]|e[t++]<<8|e[t++]<<16|e[t++]<<24;if(Q<13)throw new Error("code_w_scope total size shorter minimum expected length");var ee=e[t++]|e[t++]<<8|e[t++]<<16|e[t++]<<24;if(ee<=0||ee>e.length-t||0!==e[t+ee-1])throw new Error("bad string length in bson");var te=e.toString("utf8",t,t+ee-1),re=t+=ee,ne=e[t]|e[t+1]<<8|e[t+2]<<16|e[t+3]<<24,ie=deserializeObject(e,re,r,!1);if(t+=ne,Q<8+ne+ee)throw new Error("code_w_scope total size is to short, truncating scope");if(Q>8+ne+ee)throw new Error("code_w_scope total size is to long, clips outer document");if(i){if(o){var oe=s?a(te):te;m[b]=isolateEvalWithHash(functionCache,oe,te,m)}else m[b]=isolateEval(te);m[b].scope=ie}else m[b]=new code(te,ie)}else{if(_!==constants.BSON_DATA_DBPOINTER)throw new Error("Detected unknown BSON type "+_.toString(16)+' for fieldname "'+b+'", are you using the latest BSON parser?');var se=e[t++]|e[t++]<<8|e[t++]<<16|e[t++]<<24;if(se<=0||se>e.length-t||0!==e[t+se-1])throw new Error("bad string length in bson");if(!validateUtf8$1(e,t,t+se-1))throw new Error("Invalid UTF-8 string in BSON document");var ae=e.toString("utf8",t,t+se-1);t+=se;var ue=Buffer$4.alloc(12);e.copy(ue,0,t,t+12);var ce=new objectid(ue);t+=12,m[b]=new db_ref(ae,ce)}}if(y!==t-d){if(n)throw new Error("corrupt array bson");throw new Error("corrupt object bson")}var fe=Object.keys(m).filter((function(e){return e.startsWith("$")})),le=!0;if(fe.forEach((function(e){-1===["$ref","$id","$db"].indexOf(e)&&(le=!1)})),!le)return m;if(null!=m.$id&&null!=m.$ref){var he=Object.assign({},m);return delete he.$ref,delete he.$id,delete he.$db,new db_ref(m.$ref,m.$id,m.$db||null,he)}return m}function isolateEvalWithHash(functionCache,hash,functionString,object){var value=null;return null==functionCache[hash]&&(eval("value = "+functionString),functionCache[hash]=value),functionCache[hash].bind(object)}function isolateEval(functionString){var value=null;return eval("value = "+functionString),value}var deserializer=deserialize$1;function readIEEE754(e,t,r,n,i){var o,s,a="big"===r,u=8*i-n-1,c=(1<<u)-1,f=c>>1,l=-7,h=a?0:i-1,p=a?1:-1,d=e[t+h];for(h+=p,o=d&(1<<-l)-1,d>>=-l,l+=u;l>0;o=256*o+e[t+h],h+=p,l-=8);for(s=o&(1<<-l)-1,o>>=-l,l+=n;l>0;s=256*s+e[t+h],h+=p,l-=8);if(0===o)o=1-f;else{if(o===c)return s?NaN:1/0*(d?-1:1);s+=Math.pow(2,n),o-=f}return(d?-1:1)*s*Math.pow(2,o-n)}function writeIEEE754(e,t,r,n,i,o){var s,a,u,c="big"===n,f=8*o-i-1,l=(1<<f)-1,h=l>>1,p=23===i?Math.pow(2,-24)-Math.pow(2,-77):0,d=c?o-1:0,y=c?-1:1,m=t<0||0===t&&1/t<0?1:0;for(t=Math.abs(t),isNaN(t)||t===1/0?(a=isNaN(t)?1:0,s=l):(s=Math.floor(Math.log(t)/Math.LN2),t*(u=Math.pow(2,-s))<1&&(s--,u*=2),(t+=s+h>=1?p/u:p*Math.pow(2,1-h))*u>=2&&(s++,u/=2),s+h>=l?(a=0,s=l):s+h>=1?(a=(t*u-1)*Math.pow(2,i),s+=h):(a=t*Math.pow(2,h-1)*Math.pow(2,i),s=0)),isNaN(t)&&(a=0);i>=8;)e[r+d]=255&a,d+=y,a/=256,i-=8;for(s=s<<i|a,isNaN(t)&&(s+=8),f+=i;f>0;)e[r+d]=255&s,d+=y,s/=256,f-=8;e[r+d-y]|=128*m}var float_parser={readIEEE754:readIEEE754,writeIEEE754:writeIEEE754};function _typeof$3(e){return(_typeof$3="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}var Buffer$5=buffer.Buffer,writeIEEE754$1=float_parser.writeIEEE754,normalizedFunctionString$1=utils.normalizedFunctionString,regexp$1=/\x00/,ignoreKeys=new Set(["$db","$ref","$id","$clusterTime"]),isDate$1=function(e){return"object"===_typeof$3(e)&&"[object Date]"===Object.prototype.toString.call(e)},isRegExp$1=function(e){return"[object RegExp]"===Object.prototype.toString.call(e)};function serializeString(e,t,r,n,i){e[n++]=constants.BSON_DATA_STRING;var o=i?e.write(t,n,"ascii"):e.write(t,n,"utf8");e[(n=n+o+1)-1]=0;var s=e.write(r,n+4,"utf8");return e[n+3]=s+1>>24&255,e[n+2]=s+1>>16&255,e[n+1]=s+1>>8&255,e[n]=s+1&255,n=n+4+s,e[n++]=0,n}function serializeNumber(e,t,r,n,i){if(Math.floor(r)===r&&r>=constants.JS_INT_MIN&&r<=constants.JS_INT_MAX)if(r>=constants.BSON_INT32_MIN&&r<=constants.BSON_INT32_MAX)e[n++]=constants.BSON_DATA_INT,n+=i?e.write(t,n,"ascii"):e.write(t,n,"utf8"),e[n++]=0,e[n++]=255&r,e[n++]=r>>8&255,e[n++]=r>>16&255,e[n++]=r>>24&255;else if(r>=constants.JS_INT_MIN&&r<=constants.JS_INT_MAX)e[n++]=constants.BSON_DATA_NUMBER,n+=i?e.write(t,n,"ascii"):e.write(t,n,"utf8"),e[n++]=0,writeIEEE754$1(e,r,n,"little",52,8),n+=8;else{e[n++]=constants.BSON_DATA_LONG,n+=i?e.write(t,n,"ascii"):e.write(t,n,"utf8"),e[n++]=0;var o=long_1.fromNumber(r),s=o.getLowBits(),a=o.getHighBits();e[n++]=255&s,e[n++]=s>>8&255,e[n++]=s>>16&255,e[n++]=s>>24&255,e[n++]=255&a,e[n++]=a>>8&255,e[n++]=a>>16&255,e[n++]=a>>24&255}else e[n++]=constants.BSON_DATA_NUMBER,n+=i?e.write(t,n,"ascii"):e.write(t,n,"utf8"),e[n++]=0,writeIEEE754$1(e,r,n,"little",52,8),n+=8;return n}function serializeNull(e,t,r,n,i){return e[n++]=constants.BSON_DATA_NULL,n+=i?e.write(t,n,"ascii"):e.write(t,n,"utf8"),e[n++]=0,n}function serializeBoolean(e,t,r,n,i){return e[n++]=constants.BSON_DATA_BOOLEAN,n+=i?e.write(t,n,"ascii"):e.write(t,n,"utf8"),e[n++]=0,e[n++]=r?1:0,n}function serializeDate(e,t,r,n,i){e[n++]=constants.BSON_DATA_DATE,n+=i?e.write(t,n,"ascii"):e.write(t,n,"utf8"),e[n++]=0;var o=long_1.fromNumber(r.getTime()),s=o.getLowBits(),a=o.getHighBits();return e[n++]=255&s,e[n++]=s>>8&255,e[n++]=s>>16&255,e[n++]=s>>24&255,e[n++]=255&a,e[n++]=a>>8&255,e[n++]=a>>16&255,e[n++]=a>>24&255,n}function serializeRegExp(e,t,r,n,i){if(e[n++]=constants.BSON_DATA_REGEXP,n+=i?e.write(t,n,"ascii"):e.write(t,n,"utf8"),e[n++]=0,r.source&&null!=r.source.match(regexp$1))throw Error("value "+r.source+" must not contain null bytes");return n+=e.write(r.source,n,"utf8"),e[n++]=0,r.ignoreCase&&(e[n++]=105),r.global&&(e[n++]=115),r.multiline&&(e[n++]=109),e[n++]=0,n}function serializeBSONRegExp(e,t,r,n,i){if(e[n++]=constants.BSON_DATA_REGEXP,n+=i?e.write(t,n,"ascii"):e.write(t,n,"utf8"),e[n++]=0,null!=r.pattern.match(regexp$1))throw Error("pattern "+r.pattern+" must not contain null bytes");return n+=e.write(r.pattern,n,"utf8"),e[n++]=0,n+=e.write(r.options.split("").sort().join(""),n,"utf8"),e[n++]=0,n}function serializeMinMax(e,t,r,n,i){return null===r?e[n++]=constants.BSON_DATA_NULL:"MinKey"===r._bsontype?e[n++]=constants.BSON_DATA_MIN_KEY:e[n++]=constants.BSON_DATA_MAX_KEY,n+=i?e.write(t,n,"ascii"):e.write(t,n,"utf8"),e[n++]=0,n}function serializeObjectId(e,t,r,n,i){if(e[n++]=constants.BSON_DATA_OID,n+=i?e.write(t,n,"ascii"):e.write(t,n,"utf8"),e[n++]=0,"string"==typeof r.id)e.write(r.id,n,"binary");else{if(!r.id||!r.id.copy)throw new TypeError("object ["+JSON.stringify(r)+"] is not a valid ObjectId");r.id.copy(e,n,0,12)}return n+12}function serializeBuffer(e,t,r,n,i){e[n++]=constants.BSON_DATA_BINARY,n+=i?e.write(t,n,"ascii"):e.write(t,n,"utf8"),e[n++]=0;var o=r.length;return e[n++]=255&o,e[n++]=o>>8&255,e[n++]=o>>16&255,e[n++]=o>>24&255,e[n++]=constants.BSON_BINARY_SUBTYPE_DEFAULT,r.copy(e,n,0,o),n+=o}function serializeObject(e,t,r,n,i,o,s,a,u,c){for(var f=0;f<c.length;f++)if(c[f]===r)throw new Error("cyclic dependency detected");c.push(r),e[n++]=Array.isArray(r)?constants.BSON_DATA_ARRAY:constants.BSON_DATA_OBJECT,n+=u?e.write(t,n,"ascii"):e.write(t,n,"utf8"),e[n++]=0;var l=serializeInto(e,r,i,n,o+1,s,a,c);return c.pop(),l}function serializeDecimal128(e,t,r,n,i){return e[n++]=constants.BSON_DATA_DECIMAL128,n+=i?e.write(t,n,"ascii"):e.write(t,n,"utf8"),e[n++]=0,r.bytes.copy(e,n,0,16),n+16}function serializeLong(e,t,r,n,i){e[n++]="Long"===r._bsontype?constants.BSON_DATA_LONG:constants.BSON_DATA_TIMESTAMP,n+=i?e.write(t,n,"ascii"):e.write(t,n,"utf8"),e[n++]=0;var o=r.getLowBits(),s=r.getHighBits();return e[n++]=255&o,e[n++]=o>>8&255,e[n++]=o>>16&255,e[n++]=o>>24&255,e[n++]=255&s,e[n++]=s>>8&255,e[n++]=s>>16&255,e[n++]=s>>24&255,n}function serializeInt32(e,t,r,n,i){return e[n++]=constants.BSON_DATA_INT,n+=i?e.write(t,n,"ascii"):e.write(t,n,"utf8"),e[n++]=0,e[n++]=255&r,e[n++]=r>>8&255,e[n++]=r>>16&255,e[n++]=r>>24&255,n}function serializeDouble(e,t,r,n,i){return e[n++]=constants.BSON_DATA_NUMBER,n+=i?e.write(t,n,"ascii"):e.write(t,n,"utf8"),e[n++]=0,writeIEEE754$1(e,r.value,n,"little",52,8),n+=8}function serializeFunction(e,t,r,n,i,o,s){e[n++]=constants.BSON_DATA_CODE,n+=s?e.write(t,n,"ascii"):e.write(t,n,"utf8"),e[n++]=0;var a=normalizedFunctionString$1(r),u=e.write(a,n+4,"utf8")+1;return e[n]=255&u,e[n+1]=u>>8&255,e[n+2]=u>>16&255,e[n+3]=u>>24&255,n=n+4+u-1,e[n++]=0,n}function serializeCode(e,t,r,n,i,o,s,a,u){if(r.scope&&"object"===_typeof$3(r.scope)){e[n++]=constants.BSON_DATA_CODE_W_SCOPE,n+=u?e.write(t,n,"ascii"):e.write(t,n,"utf8"),e[n++]=0;var c=n,f="string"==typeof r.code?r.code:r.code.toString();n+=4;var l=e.write(f,n+4,"utf8")+1;e[n]=255&l,e[n+1]=l>>8&255,e[n+2]=l>>16&255,e[n+3]=l>>24&255,e[n+4+l-1]=0,n=n+l+4;var h=serializeInto(e,r.scope,i,n,o+1,s,a);n=h-1;var p=h-c;e[c++]=255&p,e[c++]=p>>8&255,e[c++]=p>>16&255,e[c++]=p>>24&255,e[n++]=0}else{e[n++]=constants.BSON_DATA_CODE,n+=u?e.write(t,n,"ascii"):e.write(t,n,"utf8"),e[n++]=0;var d=r.code.toString(),y=e.write(d,n+4,"utf8")+1;e[n]=255&y,e[n+1]=y>>8&255,e[n+2]=y>>16&255,e[n+3]=y>>24&255,n=n+4+y-1,e[n++]=0}return n}function serializeBinary(e,t,r,n,i){e[n++]=constants.BSON_DATA_BINARY,n+=i?e.write(t,n,"ascii"):e.write(t,n,"utf8"),e[n++]=0;var o=r.value(!0),s=r.position;return r.sub_type===binary.SUBTYPE_BYTE_ARRAY&&(s+=4),e[n++]=255&s,e[n++]=s>>8&255,e[n++]=s>>16&255,e[n++]=s>>24&255,e[n++]=r.sub_type,r.sub_type===binary.SUBTYPE_BYTE_ARRAY&&(s-=4,e[n++]=255&s,e[n++]=s>>8&255,e[n++]=s>>16&255,e[n++]=s>>24&255),o.copy(e,n,0,r.position),n+=r.position}function serializeSymbol(e,t,r,n,i){e[n++]=constants.BSON_DATA_SYMBOL,n+=i?e.write(t,n,"ascii"):e.write(t,n,"utf8"),e[n++]=0;var o=e.write(r.value,n+4,"utf8")+1;return e[n]=255&o,e[n+1]=o>>8&255,e[n+2]=o>>16&255,e[n+3]=o>>24&255,n=n+4+o-1,e[n++]=0,n}function serializeDBRef(e,t,r,n,i,o,s){e[n++]=constants.BSON_DATA_OBJECT,n+=s?e.write(t,n,"ascii"):e.write(t,n,"utf8"),e[n++]=0;var a,u=n,c={$ref:r.collection||r.namespace,$id:r.oid};null!=r.db&&(c.$db=r.db);var f=(a=serializeInto(e,c=Object.assign(c,r.fields),!1,n,i+1,o))-u;return e[u++]=255&f,e[u++]=f>>8&255,e[u++]=f>>16&255,e[u++]=f>>24&255,a}function serializeInto(e,t,r,n,i,o,s,a){n=n||0,(a=a||[]).push(t);var u=n+4;if(Array.isArray(t))for(var c=0;c<t.length;c++){var f=""+c,l=t[c];if(l&&l.toBSON){if("function"!=typeof l.toBSON)throw new TypeError("toBSON is not a function");l=l.toBSON()}var h=_typeof$3(l);if("string"===h)u=serializeString(e,f,l,u,!0);else if("number"===h)u=serializeNumber(e,f,l,u,!0);else if("boolean"===h)u=serializeBoolean(e,f,l,u,!0);else if(l instanceof Date||isDate$1(l))u=serializeDate(e,f,l,u,!0);else if(void 0===l)u=serializeNull(e,f,l,u,!0);else if(null===l)u=serializeNull(e,f,l,u,!0);else if("ObjectId"===l._bsontype||"ObjectID"===l._bsontype)u=serializeObjectId(e,f,l,u,!0);else if(Buffer$5.isBuffer(l))u=serializeBuffer(e,f,l,u,!0);else if(l instanceof RegExp||isRegExp$1(l))u=serializeRegExp(e,f,l,u,!0);else if("object"===h&&null==l._bsontype)u=serializeObject(e,f,l,u,r,i,o,s,!0,a);else if("object"===h&&"Decimal128"===l._bsontype)u=serializeDecimal128(e,f,l,u,!0);else if("Long"===l._bsontype||"Timestamp"===l._bsontype)u=serializeLong(e,f,l,u,!0);else if("Double"===l._bsontype)u=serializeDouble(e,f,l,u,!0);else if("function"==typeof l&&o)u=serializeFunction(e,f,l,u,r,i,o,!0);else if("Code"===l._bsontype)u=serializeCode(e,f,l,u,r,i,o,s,!0);else if("Binary"===l._bsontype)u=serializeBinary(e,f,l,u,!0);else if("Symbol"===l._bsontype)u=serializeSymbol(e,f,l,u,!0);else if("DBRef"===l._bsontype)u=serializeDBRef(e,f,l,u,i,o,!0);else if("BSONRegExp"===l._bsontype)u=serializeBSONRegExp(e,f,l,u,!0);else if("Int32"===l._bsontype)u=serializeInt32(e,f,l,u,!0);else if("MinKey"===l._bsontype||"MaxKey"===l._bsontype)u=serializeMinMax(e,f,l,u,!0);else if(void 0!==l._bsontype)throw new TypeError("Unrecognized or invalid _bsontype: "+l._bsontype)}else if(t instanceof map)for(var p=t.entries(),d=!1;!d;){var y=p.next();if(!(d=y.done)){var m=y.value[0],g=y.value[1],_=_typeof$3(g);if("string"==typeof m&&!ignoreKeys.has(m)){if(null!=m.match(regexp$1))throw Error("key "+m+" must not contain null bytes");if(r){if("$"===m[0])throw Error("key "+m+" must not start with '$'");if(~m.indexOf("."))throw Error("key "+m+" must not contain '.'")}}if("string"===_)u=serializeString(e,m,g,u);else if("number"===_)u=serializeNumber(e,m,g,u);else if("boolean"===_)u=serializeBoolean(e,m,g,u);else if(g instanceof Date||isDate$1(g))u=serializeDate(e,m,g,u);else if(null===g||void 0===g&&!1===s)u=serializeNull(e,m,g,u);else if("ObjectId"===g._bsontype||"ObjectID"===g._bsontype)u=serializeObjectId(e,m,g,u);else if(Buffer$5.isBuffer(g))u=serializeBuffer(e,m,g,u);else if(g instanceof RegExp||isRegExp$1(g))u=serializeRegExp(e,m,g,u);else if("object"===_&&null==g._bsontype)u=serializeObject(e,m,g,u,r,i,o,s,!1,a);else if("object"===_&&"Decimal128"===g._bsontype)u=serializeDecimal128(e,m,g,u);else if("Long"===g._bsontype||"Timestamp"===g._bsontype)u=serializeLong(e,m,g,u);else if("Double"===g._bsontype)u=serializeDouble(e,m,g,u);else if("Code"===g._bsontype)u=serializeCode(e,m,g,u,r,i,o,s);else if("function"==typeof g&&o)u=serializeFunction(e,m,g,u,r,i,o);else if("Binary"===g._bsontype)u=serializeBinary(e,m,g,u);else if("Symbol"===g._bsontype)u=serializeSymbol(e,m,g,u);else if("DBRef"===g._bsontype)u=serializeDBRef(e,m,g,u,i,o);else if("BSONRegExp"===g._bsontype)u=serializeBSONRegExp(e,m,g,u);else if("Int32"===g._bsontype)u=serializeInt32(e,m,g,u);else if("MinKey"===g._bsontype||"MaxKey"===g._bsontype)u=serializeMinMax(e,m,g,u);else if(void 0!==g._bsontype)throw new TypeError("Unrecognized or invalid _bsontype: "+g._bsontype)}}else{if(t.toBSON){if("function"!=typeof t.toBSON)throw new TypeError("toBSON is not a function");if(null!=(t=t.toBSON())&&"object"!==_typeof$3(t))throw new TypeError("toBSON function did not return an object")}for(var v in t){var b=t[v];if(b&&b.toBSON){if("function"!=typeof b.toBSON)throw new TypeError("toBSON is not a function");b=b.toBSON()}var w=_typeof$3(b);if("string"==typeof v&&!ignoreKeys.has(v)){if(null!=v.match(regexp$1))throw Error("key "+v+" must not contain null bytes");if(r){if("$"===v[0])throw Error("key "+v+" must not start with '$'");if(~v.indexOf("."))throw Error("key "+v+" must not contain '.'")}}if("string"===w)u=serializeString(e,v,b,u);else if("number"===w)u=serializeNumber(e,v,b,u);else if("boolean"===w)u=serializeBoolean(e,v,b,u);else if(b instanceof Date||isDate$1(b))u=serializeDate(e,v,b,u);else if(void 0===b)!1===s&&(u=serializeNull(e,v,b,u));else if(null===b)u=serializeNull(e,v,b,u);else if("ObjectId"===b._bsontype||"ObjectID"===b._bsontype)u=serializeObjectId(e,v,b,u);else if(Buffer$5.isBuffer(b))u=serializeBuffer(e,v,b,u);else if(b instanceof RegExp||isRegExp$1(b))u=serializeRegExp(e,v,b,u);else if("object"===w&&null==b._bsontype)u=serializeObject(e,v,b,u,r,i,o,s,!1,a);else if("object"===w&&"Decimal128"===b._bsontype)u=serializeDecimal128(e,v,b,u);else if("Long"===b._bsontype||"Timestamp"===b._bsontype)u=serializeLong(e,v,b,u);else if("Double"===b._bsontype)u=serializeDouble(e,v,b,u);else if("Code"===b._bsontype)u=serializeCode(e,v,b,u,r,i,o,s);else if("function"==typeof b&&o)u=serializeFunction(e,v,b,u,r,i,o);else if("Binary"===b._bsontype)u=serializeBinary(e,v,b,u);else if("Symbol"===b._bsontype)u=serializeSymbol(e,v,b,u);else if("DBRef"===b._bsontype)u=serializeDBRef(e,v,b,u,i,o);else if("BSONRegExp"===b._bsontype)u=serializeBSONRegExp(e,v,b,u);else if("Int32"===b._bsontype)u=serializeInt32(e,v,b,u);else if("MinKey"===b._bsontype||"MaxKey"===b._bsontype)u=serializeMinMax(e,v,b,u);else if(void 0!==b._bsontype)throw new TypeError("Unrecognized or invalid _bsontype: "+b._bsontype)}}a.pop(),e[u++]=0;var E=u-n;return e[n++]=255&E,e[n++]=E>>8&255,e[n++]=E>>16&255,e[n++]=E>>24&255,u}var serializer=serializeInto;function _typeof$4(e){return(_typeof$4="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}var Buffer$6=buffer.Buffer,normalizedFunctionString$2=utils.normalizedFunctionString;function isDate$2(e){return"object"===_typeof$4(e)&&"[object Date]"===Object.prototype.toString.call(e)}function calculateObjectSize(e,t,r){var n=5;if(Array.isArray(e))for(var i=0;i<e.length;i++)n+=calculateElement(i.toString(),e[i],t,!0,r);else for(var o in e.toBSON&&(e=e.toBSON()),e)n+=calculateElement(o,e[o],t,!1,r);return n}function calculateElement(e,t,r,n,i){switch(t&&t.toBSON&&(t=t.toBSON()),_typeof$4(t)){case"string":return 1+Buffer$6.byteLength(e,"utf8")+1+4+Buffer$6.byteLength(t,"utf8")+1;case"number":return Math.floor(t)===t&&t>=constants.JS_INT_MIN&&t<=constants.JS_INT_MAX&&t>=constants.BSON_INT32_MIN&&t<=constants.BSON_INT32_MAX?(null!=e?Buffer$6.byteLength(e,"utf8")+1:0)+5:(null!=e?Buffer$6.byteLength(e,"utf8")+1:0)+9;case"undefined":return n||!i?(null!=e?Buffer$6.byteLength(e,"utf8")+1:0)+1:0;case"boolean":return(null!=e?Buffer$6.byteLength(e,"utf8")+1:0)+2;case"object":if(null==t||"MinKey"===t._bsontype||"MaxKey"===t._bsontype)return(null!=e?Buffer$6.byteLength(e,"utf8")+1:0)+1;if("ObjectId"===t._bsontype||"ObjectID"===t._bsontype)return(null!=e?Buffer$6.byteLength(e,"utf8")+1:0)+13;if(t instanceof Date||isDate$2(t))return(null!=e?Buffer$6.byteLength(e,"utf8")+1:0)+9;if(void 0!==Buffer$6&&Buffer$6.isBuffer(t))return(null!=e?Buffer$6.byteLength(e,"utf8")+1:0)+6+t.length;if("Long"===t._bsontype||"Double"===t._bsontype||"Timestamp"===t._bsontype)return(null!=e?Buffer$6.byteLength(e,"utf8")+1:0)+9;if("Decimal128"===t._bsontype)return(null!=e?Buffer$6.byteLength(e,"utf8")+1:0)+17;if("Code"===t._bsontype)return null!=t.scope&&Object.keys(t.scope).length>0?(null!=e?Buffer$6.byteLength(e,"utf8")+1:0)+1+4+4+Buffer$6.byteLength(t.code.toString(),"utf8")+1+calculateObjectSize(t.scope,r,i):(null!=e?Buffer$6.byteLength(e,"utf8")+1:0)+1+4+Buffer$6.byteLength(t.code.toString(),"utf8")+1;if("Binary"===t._bsontype)return t.sub_type===binary.SUBTYPE_BYTE_ARRAY?(null!=e?Buffer$6.byteLength(e,"utf8")+1:0)+(t.position+1+4+1+4):(null!=e?Buffer$6.byteLength(e,"utf8")+1:0)+(t.position+1+4+1);if("Symbol"===t._bsontype)return(null!=e?Buffer$6.byteLength(e,"utf8")+1:0)+Buffer$6.byteLength(t.value,"utf8")+4+1+1;if("DBRef"===t._bsontype){var o=Object.assign({$ref:t.collection,$id:t.oid},t.fields);return null!=t.db&&(o.$db=t.db),(null!=e?Buffer$6.byteLength(e,"utf8")+1:0)+1+calculateObjectSize(o,r,i)}return t instanceof RegExp||"[object RegExp]"===Object.prototype.toString.call(t)?(null!=e?Buffer$6.byteLength(e,"utf8")+1:0)+1+Buffer$6.byteLength(t.source,"utf8")+1+(t.global?1:0)+(t.ignoreCase?1:0)+(t.multiline?1:0)+1:"BSONRegExp"===t._bsontype?(null!=e?Buffer$6.byteLength(e,"utf8")+1:0)+1+Buffer$6.byteLength(t.pattern,"utf8")+1+Buffer$6.byteLength(t.options,"utf8")+1:(null!=e?Buffer$6.byteLength(e,"utf8")+1:0)+calculateObjectSize(t,r,i)+1;case"function":if(t instanceof RegExp||"[object RegExp]"===Object.prototype.toString.call(t)||"[object RegExp]"===String.call(t))return(null!=e?Buffer$6.byteLength(e,"utf8")+1:0)+1+Buffer$6.byteLength(t.source,"utf8")+1+(t.global?1:0)+(t.ignoreCase?1:0)+(t.multiline?1:0)+1;if(r&&null!=t.scope&&Object.keys(t.scope).length>0)return(null!=e?Buffer$6.byteLength(e,"utf8")+1:0)+1+4+4+Buffer$6.byteLength(normalizedFunctionString$2(t),"utf8")+1+calculateObjectSize(t.scope,r,i);if(r)return(null!=e?Buffer$6.byteLength(e,"utf8")+1:0)+1+4+Buffer$6.byteLength(normalizedFunctionString$2(t),"utf8")+1}return 0}var calculate_size=calculateObjectSize,Buffer$7=buffer.Buffer,ensure_buffer=function(e){if(e instanceof Buffer$7)return e;if(e instanceof Uint8Array)return Buffer$7.from(e.buffer);throw new TypeError("Must use either Buffer or Uint8Array")},Buffer$8=buffer.Buffer,MAXSIZE=17825792,buffer$1=Buffer$8.alloc(MAXSIZE);function setInternalBufferSize(e){buffer$1.length<e&&(buffer$1=Buffer$8.alloc(e))}function serialize$1(e,t){var r="boolean"==typeof(t=t||{}).checkKeys&&t.checkKeys,n="boolean"==typeof t.serializeFunctions&&t.serializeFunctions,i="boolean"!=typeof t.ignoreUndefined||t.ignoreUndefined,o="number"==typeof t.minInternalBufferSize?t.minInternalBufferSize:MAXSIZE;buffer$1.length<o&&(buffer$1=Buffer$8.alloc(o));var s=serializer(buffer$1,e,r,0,0,n,i,[]),a=Buffer$8.alloc(s);return buffer$1.copy(a,0,0,a.length),a}function serializeWithBufferAndIndex(e,t,r){var n="boolean"==typeof(r=r||{}).checkKeys&&r.checkKeys,i="boolean"==typeof r.serializeFunctions&&r.serializeFunctions,o="boolean"!=typeof r.ignoreUndefined||r.ignoreUndefined,s="number"==typeof r.index?r.index:0,a=serializer(buffer$1,e,n,0,0,i,o);return buffer$1.copy(t,s,0,a),s+a-1}function deserialize$2(e,t){return e=ensure_buffer(e),deserializer(e,t)}function calculateObjectSize$1(e,t){var r="boolean"==typeof(t=t||{}).serializeFunctions&&t.serializeFunctions,n="boolean"!=typeof t.ignoreUndefined||t.ignoreUndefined;return calculate_size(e,r,n)}function deserializeStream(e,t,r,n,i,o){o=Object.assign({allowObjectSmallerThanBufferSize:!0},o),e=ensure_buffer(e);for(var s=t,a=0;a<r;a++){var u=e[s]|e[s+1]<<8|e[s+2]<<16|e[s+3]<<24;o.index=s,n[i+a]=deserializer(e,o),s+=u}return s}var bson={BSON_INT32_MAX:constants.BSON_INT32_MAX,BSON_INT32_MIN:constants.BSON_INT32_MIN,BSON_INT64_MAX:constants.BSON_INT64_MAX,BSON_INT64_MIN:constants.BSON_INT64_MIN,JS_INT_MAX:constants.JS_INT_MAX,JS_INT_MIN:constants.JS_INT_MIN,BSON_DATA_NUMBER:constants.BSON_DATA_NUMBER,BSON_DATA_STRING:constants.BSON_DATA_STRING,BSON_DATA_OBJECT:constants.BSON_DATA_OBJECT,BSON_DATA_ARRAY:constants.BSON_DATA_ARRAY,BSON_DATA_BINARY:constants.BSON_DATA_BINARY,BSON_DATA_UNDEFINED:constants.BSON_DATA_UNDEFINED,BSON_DATA_OID:constants.BSON_DATA_OID,BSON_DATA_BOOLEAN:constants.BSON_DATA_BOOLEAN,BSON_DATA_DATE:constants.BSON_DATA_DATE,BSON_DATA_NULL:constants.BSON_DATA_NULL,BSON_DATA_REGEXP:constants.BSON_DATA_REGEXP,BSON_DATA_DBPOINTER:constants.BSON_DATA_DBPOINTER,BSON_DATA_CODE:constants.BSON_DATA_CODE,BSON_DATA_SYMBOL:constants.BSON_DATA_SYMBOL,BSON_DATA_CODE_W_SCOPE:constants.BSON_DATA_CODE_W_SCOPE,BSON_DATA_INT:constants.BSON_DATA_INT,BSON_DATA_TIMESTAMP:constants.BSON_DATA_TIMESTAMP,BSON_DATA_LONG:constants.BSON_DATA_LONG,BSON_DATA_DECIMAL128:constants.BSON_DATA_DECIMAL128,BSON_DATA_MIN_KEY:constants.BSON_DATA_MIN_KEY,BSON_DATA_MAX_KEY:constants.BSON_DATA_MAX_KEY,BSON_BINARY_SUBTYPE_DEFAULT:constants.BSON_BINARY_SUBTYPE_DEFAULT,BSON_BINARY_SUBTYPE_FUNCTION:constants.BSON_BINARY_SUBTYPE_FUNCTION,BSON_BINARY_SUBTYPE_BYTE_ARRAY:constants.BSON_BINARY_SUBTYPE_BYTE_ARRAY,BSON_BINARY_SUBTYPE_UUID:constants.BSON_BINARY_SUBTYPE_UUID,BSON_BINARY_SUBTYPE_MD5:constants.BSON_BINARY_SUBTYPE_MD5,BSON_BINARY_SUBTYPE_USER_DEFINED:constants.BSON_BINARY_SUBTYPE_USER_DEFINED,Code:code,Map:map,BSONSymbol:symbol,DBRef:db_ref,Binary:binary,ObjectId:objectid,Long:long_1,Timestamp:timestamp,Double:double_1,Int32:int_32,MinKey:min_key,MaxKey:max_key,BSONRegExp:regexp,Decimal128:decimal128,serialize:serialize$1,serializeWithBufferAndIndex:serializeWithBufferAndIndex,deserialize:deserialize$2,calculateObjectSize:calculateObjectSize$1,deserializeStream:deserializeStream,setInternalBufferSize:setInternalBufferSize,ObjectID:objectid,EJSON:extended_json},bson_1=bson.BSON_INT32_MAX,bson_2=bson.BSON_INT32_MIN,bson_3=bson.BSON_INT64_MAX,bson_4=bson.BSON_INT64_MIN,bson_5=bson.JS_INT_MAX,bson_6=bson.JS_INT_MIN,bson_7=bson.BSON_DATA_NUMBER,bson_8=bson.BSON_DATA_STRING,bson_9=bson.BSON_DATA_OBJECT,bson_10=bson.BSON_DATA_ARRAY,bson_11=bson.BSON_DATA_BINARY,bson_12=bson.BSON_DATA_UNDEFINED,bson_13=bson.BSON_DATA_OID,bson_14=bson.BSON_DATA_BOOLEAN,bson_15=bson.BSON_DATA_DATE,bson_16=bson.BSON_DATA_NULL,bson_17=bson.BSON_DATA_REGEXP,bson_18=bson.BSON_DATA_DBPOINTER,bson_19=bson.BSON_DATA_CODE,bson_20=bson.BSON_DATA_SYMBOL,bson_21=bson.BSON_DATA_CODE_W_SCOPE,bson_22=bson.BSON_DATA_INT,bson_23=bson.BSON_DATA_TIMESTAMP,bson_24=bson.BSON_DATA_LONG,bson_25=bson.BSON_DATA_DECIMAL128,bson_26=bson.BSON_DATA_MIN_KEY,bson_27=bson.BSON_DATA_MAX_KEY,bson_28=bson.BSON_BINARY_SUBTYPE_DEFAULT,bson_29=bson.BSON_BINARY_SUBTYPE_FUNCTION,bson_30=bson.BSON_BINARY_SUBTYPE_BYTE_ARRAY,bson_31=bson.BSON_BINARY_SUBTYPE_UUID,bson_32=bson.BSON_BINARY_SUBTYPE_MD5,bson_33=bson.BSON_BINARY_SUBTYPE_USER_DEFINED,bson_34=bson.Code,bson_35=bson.BSONSymbol,bson_36=bson.DBRef,bson_37=bson.Binary,bson_38=bson.ObjectId,bson_39=bson.Long,bson_40=bson.Timestamp,bson_41=bson.Double,bson_42=bson.Int32,bson_43=bson.MinKey,bson_44=bson.MaxKey,bson_45=bson.BSONRegExp,bson_46=bson.Decimal128,bson_47=bson.serialize,bson_48=bson.serializeWithBufferAndIndex,bson_49=bson.deserialize,bson_50=bson.calculateObjectSize,bson_51=bson.deserializeStream,bson_52=bson.setInternalBufferSize,bson_53=bson.ObjectID,bson_54=bson.EJSON;exports.default=bson,exports.BSON_INT32_MAX=bson_1,exports.BSON_INT32_MIN=bson_2,exports.BSON_INT64_MAX=bson_3,exports.BSON_INT64_MIN=bson_4,exports.JS_INT_MAX=bson_5,exports.JS_INT_MIN=bson_6,exports.BSON_DATA_NUMBER=bson_7,exports.BSON_DATA_STRING=bson_8,exports.BSON_DATA_OBJECT=bson_9,exports.BSON_DATA_ARRAY=bson_10,exports.BSON_DATA_BINARY=bson_11,exports.BSON_DATA_UNDEFINED=bson_12,exports.BSON_DATA_OID=bson_13,exports.BSON_DATA_BOOLEAN=bson_14,exports.BSON_DATA_DATE=bson_15,exports.BSON_DATA_NULL=bson_16,exports.BSON_DATA_REGEXP=bson_17,exports.BSON_DATA_DBPOINTER=bson_18,exports.BSON_DATA_CODE=bson_19,exports.BSON_DATA_SYMBOL=bson_20,exports.BSON_DATA_CODE_W_SCOPE=bson_21,exports.BSON_DATA_INT=bson_22,exports.BSON_DATA_TIMESTAMP=bson_23,exports.BSON_DATA_LONG=bson_24,exports.BSON_DATA_DECIMAL128=bson_25,exports.BSON_DATA_MIN_KEY=bson_26,exports.BSON_DATA_MAX_KEY=bson_27,exports.BSON_BINARY_SUBTYPE_DEFAULT=bson_28,exports.BSON_BINARY_SUBTYPE_FUNCTION=bson_29,exports.BSON_BINARY_SUBTYPE_BYTE_ARRAY=bson_30,exports.BSON_BINARY_SUBTYPE_UUID=bson_31,exports.BSON_BINARY_SUBTYPE_MD5=bson_32,exports.BSON_BINARY_SUBTYPE_USER_DEFINED=bson_33,exports.Code=bson_34,exports.BSONSymbol=bson_35,exports.DBRef=bson_36,exports.Binary=bson_37,exports.ObjectId=bson_38,exports.Long=bson_39,exports.Timestamp=bson_40,exports.Double=bson_41,exports.Int32=bson_42,exports.MinKey=bson_43,exports.MaxKey=bson_44,exports.BSONRegExp=bson_45,exports.Decimal128=bson_46,exports.serialize=bson_47,exports.serializeWithBufferAndIndex=bson_48,exports.deserialize=bson_49,exports.calculateObjectSize=bson_50,exports.deserializeStream=bson_51,exports.setInternalBufferSize=bson_52,exports.ObjectID=bson_53,exports.EJSON=bson_54,Object.defineProperty(exports,"__esModule",{value:!0})},factory(exports,__webpack_require__(1389),__webpack_require__(11))}).call(this,__webpack_require__(26),__webpack_require__(11).Buffer)},42:function(e,t){var r={}.toString;e.exports=Array.isArray||function(e){return"[object Array]"==r.call(e)}},43:function(e,t,r){var n=function(e){"use strict";var t,r=Object.prototype,n=r.hasOwnProperty,i="function"==typeof Symbol?Symbol:{},o=i.iterator||"@@iterator",s=i.asyncIterator||"@@asyncIterator",a=i.toStringTag||"@@toStringTag";function u(e,t,r,n){var i=t&&t.prototype instanceof y?t:y,o=Object.create(i.prototype),s=new T(n||[]);return o._invoke=function(e,t,r){var n=f;return function(i,o){if(n===h)throw new Error("Generator is already running");if(n===p){if("throw"===i)throw o;return O()}for(r.method=i,r.arg=o;;){var s=r.delegate;if(s){var a=A(s,r);if(a){if(a===d)continue;return a}}if("next"===r.method)r.sent=r._sent=r.arg;else if("throw"===r.method){if(n===f)throw n=p,r.arg;r.dispatchException(r.arg)}else"return"===r.method&&r.abrupt("return",r.arg);n=h;var u=c(e,t,r);if("normal"===u.type){if(n=r.done?p:l,u.arg===d)continue;return{value:u.arg,done:r.done}}"throw"===u.type&&(n=p,r.method="throw",r.arg=u.arg)}}}(e,r,s),o}function c(e,t,r){try{return{type:"normal",arg:e.call(t,r)}}catch(e){return{type:"throw",arg:e}}}e.wrap=u;var f="suspendedStart",l="suspendedYield",h="executing",p="completed",d={};function y(){}function m(){}function g(){}var _={};_[o]=function(){return this};var v=Object.getPrototypeOf,b=v&&v(v(N([])));b&&b!==r&&n.call(b,o)&&(_=b);var w=g.prototype=y.prototype=Object.create(_);function E(e){["next","throw","return"].forEach((function(t){e[t]=function(e){return this._invoke(t,e)}}))}function B(e){var t;this._invoke=function(r,i){function o(){return new Promise((function(t,o){!function t(r,i,o,s){var a=c(e[r],e,i);if("throw"!==a.type){var u=a.arg,f=u.value;return f&&"object"==typeof f&&n.call(f,"__await")?Promise.resolve(f.__await).then((function(e){t("next",e,o,s)}),(function(e){t("throw",e,o,s)})):Promise.resolve(f).then((function(e){u.value=e,o(u)}),(function(e){return t("throw",e,o,s)}))}s(a.arg)}(r,i,t,o)}))}return t=t?t.then(o,o):o()}}function A(e,r){var n=e.iterator[r.method];if(n===t){if(r.delegate=null,"throw"===r.method){if(e.iterator.return&&(r.method="return",r.arg=t,A(e,r),"throw"===r.method))return d;r.method="throw",r.arg=new TypeError("The iterator does not provide a 'throw' method")}return d}var i=c(n,e.iterator,r.arg);if("throw"===i.type)return r.method="throw",r.arg=i.arg,r.delegate=null,d;var o=i.arg;return o?o.done?(r[e.resultName]=o.value,r.next=e.nextLoc,"return"!==r.method&&(r.method="next",r.arg=t),r.delegate=null,d):o:(r.method="throw",r.arg=new TypeError("iterator result is not an object"),r.delegate=null,d)}function S(e){var t={tryLoc:e[0]};1 in e&&(t.catchLoc=e[1]),2 in e&&(t.finallyLoc=e[2],t.afterLoc=e[3]),this.tryEntries.push(t)}function x(e){var t=e.completion||{};t.type="normal",delete t.arg,e.completion=t}function T(e){this.tryEntries=[{tryLoc:"root"}],e.forEach(S,this),this.reset(!0)}function N(e){if(e){var r=e[o];if(r)return r.call(e);if("function"==typeof e.next)return e;if(!isNaN(e.length)){var i=-1,s=function r(){for(;++i<e.length;)if(n.call(e,i))return r.value=e[i],r.done=!1,r;return r.value=t,r.done=!0,r};return s.next=s}}return{next:O}}function O(){return{value:t,done:!0}}return m.prototype=w.constructor=g,g.constructor=m,g[a]=m.displayName="GeneratorFunction",e.isGeneratorFunction=function(e){var t="function"==typeof e&&e.constructor;return!!t&&(t===m||"GeneratorFunction"===(t.displayName||t.name))},e.mark=function(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,g):(e.__proto__=g,a in e||(e[a]="GeneratorFunction")),e.prototype=Object.create(w),e},e.awrap=function(e){return{__await:e}},E(B.prototype),B.prototype[s]=function(){return this},e.AsyncIterator=B,e.async=function(t,r,n,i){var o=new B(u(t,r,n,i));return e.isGeneratorFunction(r)?o:o.next().then((function(e){return e.done?e.value:o.next()}))},E(w),w[a]="Generator",w[o]=function(){return this},w.toString=function(){return"[object Generator]"},e.keys=function(e){var t=[];for(var r in e)t.push(r);return t.reverse(),function r(){for(;t.length;){var n=t.pop();if(n in e)return r.value=n,r.done=!1,r}return r.done=!0,r}},e.values=N,T.prototype={constructor:T,reset:function(e){if(this.prev=0,this.next=0,this.sent=this._sent=t,this.done=!1,this.delegate=null,this.method="next",this.arg=t,this.tryEntries.forEach(x),!e)for(var r in this)"t"===r.charAt(0)&&n.call(this,r)&&!isNaN(+r.slice(1))&&(this[r]=t)},stop:function(){this.done=!0;var e=this.tryEntries[0].completion;if("throw"===e.type)throw e.arg;return this.rval},dispatchException:function(e){if(this.done)throw e;var r=this;function i(n,i){return a.type="throw",a.arg=e,r.next=n,i&&(r.method="next",r.arg=t),!!i}for(var o=this.tryEntries.length-1;o>=0;--o){var s=this.tryEntries[o],a=s.completion;if("root"===s.tryLoc)return i("end");if(s.tryLoc<=this.prev){var u=n.call(s,"catchLoc"),c=n.call(s,"finallyLoc");if(u&&c){if(this.prev<s.catchLoc)return i(s.catchLoc,!0);if(this.prev<s.finallyLoc)return i(s.finallyLoc)}else if(u){if(this.prev<s.catchLoc)return i(s.catchLoc,!0)}else{if(!c)throw new Error("try statement without catch or finally");if(this.prev<s.finallyLoc)return i(s.finallyLoc)}}}},abrupt:function(e,t){for(var r=this.tryEntries.length-1;r>=0;--r){var i=this.tryEntries[r];if(i.tryLoc<=this.prev&&n.call(i,"finallyLoc")&&this.prev<i.finallyLoc){var o=i;break}}o&&("break"===e||"continue"===e)&&o.tryLoc<=t&&t<=o.finallyLoc&&(o=null);var s=o?o.completion:{};return s.type=e,s.arg=t,o?(this.method="next",this.next=o.finallyLoc,d):this.complete(s)},complete:function(e,t){if("throw"===e.type)throw e.arg;return"break"===e.type||"continue"===e.type?this.next=e.arg:"return"===e.type?(this.rval=this.arg=e.arg,this.method="return",this.next="end"):"normal"===e.type&&t&&(this.next=t),d},finish:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var r=this.tryEntries[t];if(r.finallyLoc===e)return this.complete(r.completion,r.afterLoc),x(r),d}},catch:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var r=this.tryEntries[t];if(r.tryLoc===e){var n=r.completion;if("throw"===n.type){var i=n.arg;x(r)}return i}}throw new Error("illegal catch attempt")},delegateYield:function(e,r,n){return this.delegate={iterator:N(e),resultName:r,nextLoc:n},"next"===this.method&&(this.arg=t),d}},e}(e.exports);try{regeneratorRuntime=n}catch(e){Function("r","regeneratorRuntime = r")(n)}},44:function(e,t){e.exports=function(e){if(Array.isArray(e))return e}},45:function(e,t){e.exports=function(e,t){if(Symbol.iterator in Object(e)||"[object Arguments]"===Object.prototype.toString.call(e)){var r=[],n=!0,i=!1,o=void 0;try{for(var s,a=e[Symbol.iterator]();!(n=(s=a.next()).done)&&(r.push(s.value),!t||r.length!==t);n=!0);}catch(e){i=!0,o=e}finally{try{n||null==a.return||a.return()}finally{if(i)throw o}}return r}}},46:function(e,t){e.exports=function(){throw new TypeError("Invalid attempt to destructure non-iterable instance")}},47:function(e,t,r){"use strict";var n=r(63),i=Object.keys||function(e){var t=[];for(var r in e)t.push(r);return t};e.exports=l;var o=r(56);o.inherits=r(17);var s=r(100),a=r(81);o.inherits(l,s);for(var u=i(a.prototype),c=0;c<u.length;c++){var f=u[c];l.prototype[f]||(l.prototype[f]=a.prototype[f])}function l(e){if(!(this instanceof l))return new l(e);s.call(this,e),a.call(this,e),e&&!1===e.readable&&(this.readable=!1),e&&!1===e.writable&&(this.writable=!1),this.allowHalfOpen=!0,e&&!1===e.allowHalfOpen&&(this.allowHalfOpen=!1),this.once("end",h)}function h(){this.allowHalfOpen||this._writableState.ended||n.nextTick(p,this)}function p(e){e.end()}Object.defineProperty(l.prototype,"writableHighWaterMark",{enumerable:!1,get:function(){return this._writableState.highWaterMark}}),Object.defineProperty(l.prototype,"destroyed",{get:function(){return void 0!==this._readableState&&void 0!==this._writableState&&(this._readableState.destroyed&&this._writableState.destroyed)},set:function(e){void 0!==this._readableState&&void 0!==this._writableState&&(this._readableState.destroyed=e,this._writableState.destroyed=e)}}),l.prototype._destroy=function(e,t){this.push(null),this.end(),n.nextTick(t,e)}},484:function(e,t,r){"use strict";(function(t){var n=r(243),i=r(11),o=r(64),s=n.Tap,a=o.debuglog("avsc:types"),u=o.format,c={array:I,boolean:_,bytes:A,double:E,enum:N,error:F,fixed:O,float:w,int:v,long:b,map:k,null:g,record:F,string:B},f=/^[A-Za-z_][A-Za-z0-9_]*$/,l=new n.Lcg,h=new s(new i.SlowBuffer(1024)),p=null,d=[];function y(e,t){var r;if(p?(r=p,d.push([p,this]),p=null):r=this,this._hash=new P,this.name=void 0,this.aliases=void 0,this.doc=e&&e.doc?""+e.doc:void 0,e){var n=e.name,i=void 0===e.namespace?t&&t.namespace:e.namespace;if(void 0!==n){if($(n=U(n,i)))throw new Error(u("cannot rename primitive type: %j",n));var o=t&&t.registry;if(o){if(void 0!==o[n])throw new Error(u("duplicate type name: %s",n));o[n]=r}}else if(t&&t.noAnonymousTypes)throw new Error(u("missing name property in schema: %j",e));this.name=n,this.aliases=e.aliases?e.aliases.map((function(e){return U(e,i)})):[]}}function m(e){y.call(this),this._branchConstructor=this._createBranchConstructor(),e||Object.freeze(this)}function g(){m.call(this)}function _(){m.call(this)}function v(){m.call(this)}function b(){m.call(this)}function w(){m.call(this)}function E(){m.call(this)}function B(){m.call(this)}function A(){m.call(this)}function S(e,t){if(y.call(this),!Array.isArray(e))throw new Error(u("non-array union schema: %j",e));if(!e.length)throw new Error("empty union");this.types=Object.freeze(e.map((function(e){return y.forSchema(e,t)}))),this._branchIndices={},this.types.forEach((function(e,t){if(y.isType(e,"union"))throw new Error("unions cannot be directly nested");var r=e.branchName;if(void 0!==this._branchIndices[r])throw new Error(u("duplicate union branch name: %j",r));this._branchIndices[r]=t}),this)}function x(e,t){S.call(this,e,t),this._dynamicBranches=null,this._bucketIndices={},this.types.forEach((function(e,t){if(y.isType(e,"abstract","logical"))this._dynamicBranches||(this._dynamicBranches=[]),this._dynamicBranches.push({index:t,type:e});else{var r=G(e);if(void 0!==this._bucketIndices[r])throw new Error(u("ambiguous unwrapped union: %j",this));this._bucketIndices[r]=t}}),this),Object.freeze(this)}function T(e,t){S.call(this,e,t),Object.freeze(this)}function N(e,t){if(y.call(this,e,t),!Array.isArray(e.symbols)||!e.symbols.length)throw new Error(u("invalid enum symbols: %j",e.symbols));this.symbols=Object.freeze(e.symbols.slice()),this._indices={},this.symbols.forEach((function(e,t){if(!V(e))throw new Error(u("invalid %s symbol: %j",this,e));if(void 0!==this._indices[e])throw new Error(u("duplicate %s symbol: %j",this,e));this._indices[e]=t}),this),this._branchConstructor=this._createBranchConstructor(),Object.freeze(this)}function O(e,t){if(y.call(this,e,t),e.size!==(0|e.size)||e.size<1)throw new Error(u("invalid %s size",this.branchName));this.size=0|e.size,this._branchConstructor=this._createBranchConstructor(),Object.freeze(this)}function k(e,t){if(y.call(this),!e.values)throw new Error(u("missing map values: %j",e));this.valuesType=y.forSchema(e.values,t),this._branchConstructor=this._createBranchConstructor(),Object.freeze(this)}function I(e,t){if(y.call(this),!e.items)throw new Error(u("missing array items: %j",e));this.itemsType=y.forSchema(e.items,t),this._branchConstructor=this._createBranchConstructor(),Object.freeze(this)}function F(e,t){var r=(t=t||{}).namespace;if(void 0!==e.namespace)t.namespace=e.namespace;else if(e.name){var i=/^(.*)\.[^.]+$/.exec(e.name);i&&(t.namespace=i[1])}if(y.call(this,e,t),!Array.isArray(e.fields))throw new Error(u("non-array record fields: %j",e.fields));if(n.hasDuplicates(e.fields,(function(e){return e.name})))throw new Error(u("duplicate field name: %j",e.fields));this._fieldsByName={},this.fields=Object.freeze(e.fields.map((function(e){var r=new C(e,t);return this._fieldsByName[r.name]=r,r}),this)),this._branchConstructor=this._createBranchConstructor(),this._isError="error"===e.type,this.recordConstructor=this._createConstructor(t.errorStackTraces),this._read=this._createReader(),this._skip=this._createSkipper(),this._write=this._createWriter(),this._check=this._createChecker(),t.namespace=r,Object.freeze(this)}function D(e,t){this._logicalTypeName=e.logicalType,y.call(this),p=this;try{this._underlyingType=y.forSchema(e,t)}finally{p=null;var r=d.length;r&&d[r-1][0]===this&&d.pop()}y.isType(this.underlyingType,"union")?this._branchConstructor=this.underlyingType._branchConstructor:this._branchConstructor=this.underlyingType._createBranchConstructor()}function R(e){this._concreteTypeName="long",m.call(this,!0),this._noUnpack=!!e}function C(e,t){var r=e.name;if("string"!=typeof r||!V(r))throw new Error(u("invalid field name: %s",r));this.name=r,this.type=y.forSchema(e.type,t),this.aliases=e.aliases||[],this.doc=void 0!==e.doc?""+e.doc:void 0,this._order=function(e){switch(e){case"ascending":return 1;case"descending":return-1;case"ignore":return 0;default:throw new Error(u("invalid order: %j",e))}}(void 0===e.order?"ascending":e.order);var n=e.default;if(void 0!==n){var i=this.type,o=i._copy(n,{coerce:2,wrap:2});$(i.typeName)&&"bytes"!==i.typeName?this.defaultValue=function(){return o}:this.defaultValue=function(){return i._copy(o)}}Object.freeze(this)}function L(e){this._readerType=e,this._read=null,this.itemsType=null,this.size=0,this.symbols=null,this.valuesType=null}function P(){this.str=void 0}function j(e,t,r,n){if(r){if(r._readerType!==e)throw new Error("invalid resolver");return r._read(t,n)}return e._read(t)}function M(e){var t=e.split(".");return t[t.length-1]}function U(e,t){~e.indexOf(".")?e=e.replace(/^\./,""):t&&(e=t+"."+e),e.split(".").forEach((function(t){if(!V(t))throw new Error(u("invalid name: %j",e))}));var r=M(e);return $(r)?r:e}function z(e){var t={};e.name&&(t[e.name]=!0);var r,n,i=e.aliases;for(r=0,n=i.length;r<n;r++)t[i[r]]=!0;return Object.keys(t)}function $(e){var t=c[e];return t&&t.prototype instanceof m}function Y(e){if("error"===e)e="record";else{var t=/^([^:]+):(.*)$/.exec(e);t&&(e="union"===t[1]?t[2]+"Union":t[1])}return n.capitalize(e)+"Type"}function H(e){var t=e.readLong();return t<0&&(t=-t,e.skipLong()),t}function q(e){return e>=-9007199254740990&&e<=9007199254740990}function Z(e){return e&&"Buffer"===e.type&&Array.isArray(e.data)}function V(e){return f.test(e)}function J(e,t){throw new Error(u("invalid %j: %j",t.schema(),e))}function G(e){var t=e.typeName;switch(t){case"double":case"float":case"int":case"long":return"number";case"bytes":case"fixed":return"buffer";case"enum":return"string";case"map":case"error":case"record":return"object";default:return t}}function W(e){if(null===e)return"null";var r=typeof e;if("object"===r){if(Array.isArray(e))return"array";if(t.isBuffer(e))return"buffer"}return r}y.forSchema=function(e,t){(t=t||{}).registry=t.registry||{};var r,n=function(e){switch(!0===e?e="always":!1===e?e="never":void 0===e?e="auto":"string"==typeof e&&(e=e.toLowerCase()),e){case"always":return T;case"never":return x;case"auto":return;default:throw new Error(u("invalid wrap unions option: %j",e))}}(t.wrapUnions);if(null===e)throw new Error('invalid type: null (did you mean "null"?)');if(y.isType(e))return e;if(t.typeHook&&(r=t.typeHook(e,t))){if(!y.isType(r))throw new Error(u("invalid typehook return value: %j",r));return r}if("string"==typeof e){if(e=U(e,t.namespace),r=t.registry[e])return r;if($(e))return t.registry[e]=y.forSchema({type:e},t);throw new Error(u("undefined type name: %s",e))}if(e.logicalType&&t.logicalTypes&&!p){var i=t.logicalTypes[e.logicalType];if(i){var o=t.namespace,s={};Object.keys(t.registry).forEach((function(e){s[e]=t.registry[e]}));try{return a("instantiating logical type for %s",e.logicalType),new i(e,t)}catch(r){if(a("failed to instantiate logical type for %s",e.logicalType),t.assertLogicalTypes)throw r;p=null,t.namespace=o,t.registry=s}}}if(Array.isArray(e)){var f=p;p=null;var l=e.map((function(e){return y.forSchema(e,t)}));n||(n=function(e){var t,r,n,i,o={};for(t=0,r=e.length;t<r;t++)if(i=e[t],!y.isType(i,"logical")){if(n=G(i),o[n])return!0;o[n]=!0}return!1}(l)?T:x),p=f,r=new n(l,t)}else r=function(r){var n=c[r];if(void 0===n)throw new Error(u("unknown type: %j",r));return new n(e,t)}(e.type);return r},y.forValue=function(e,r){if((r=r||{}).emptyArrayType=r.emptyArrayType||y.forSchema({type:"array",items:"null"}),r.valueHook){var n=r.valueHook(e,r);if(void 0!==n){if(!y.isType(n))throw new Error(u("invalid value hook return value: %j",n));return n}}switch(typeof e){case"string":return y.forSchema("string",r);case"boolean":return y.forSchema("boolean",r);case"number":return(0|e)===e?y.forSchema("int",r):Math.abs(e)<9007199254740991?y.forSchema("float",r):y.forSchema("double",r);case"object":if(null===e)return y.forSchema("null",r);if(Array.isArray(e))return e.length?y.forSchema({type:"array",items:y.forTypes(e.map((function(e){return y.forValue(e,r)})),r)},r):r.emptyArrayType;if(t.isBuffer(e))return y.forSchema("bytes",r);var i=Object.keys(e);return i.some((function(e){return!V(e)}))?y.forSchema({type:"map",values:y.forTypes(i.map((function(t){return y.forValue(e[t],r)})),r)},r):y.forSchema({type:"record",fields:i.map((function(t){return{name:t,type:y.forValue(e[t],r)}}))},r);default:throw new Error(u("cannot infer type from: %j",e))}},y.forTypes=function(e,t){if(!e.length)throw new Error("no types to combine");if(1===e.length)return e[0];t=t||{};var r=[],n=0,i=!0;if(e.forEach((function(e){switch(e.typeName){case"union:unwrapped":i=!1,r=r.concat(e.types);break;case"union:wrapped":n++,r=r.concat(e.types);break;case"null":r.push(e);break;default:i=!1,r.push(e)}})),n){if(!i)throw new Error("cannot combine wrapped union");var o={};r.forEach((function(e){var t=e.branchName,r=o[t];if(r){if(!e.equals(r))throw new Error("inconsistent branch type")}else o[t]=e}));var s,a=t.wrapUnions;t.wrapUnions=!0;try{s=y.forSchema(Object.keys(o).map((function(e){return o[e]})),t)}catch(e){throw t.wrapUnions=a,e}return t.wrapUnions=a,s}var u={};r.forEach((function(e){var t=G(e),r=u[t];r||(u[t]=r=[]),r.push(e)}));var c=Object.keys(u).map((function(e){var r=u[e];if(1===r.length)return r[0];switch(e){case"null":case"boolean":return r[0];case"number":return function(e){var t,r,n,i,o=["int","long","float","double"],s=-1,a=null;for(t=0,r=e.length;t<r;t++)n=e[t],(i=o.indexOf(n.typeName))>s&&(s=i,a=n);return a}(r);case"string":return function(e,t){var r,n,i,o,s={};for(r=0,n=e.length;r<n;r++){if("string"===(i=e[r]).typeName)return i;var a,u;for(o=i.symbols,a=0,u=o.length;a<u;a++)s[o[a]]=!0}return y.forSchema({type:"enum",symbols:Object.keys(s)},t)}(r,t);case"buffer":return function(e,t){var r,n,i,o=-1;for(r=0,n=e.length;r<n;r++){if("bytes"===(i=e[r]).typeName)return i;-1===o?o=i.size:i.size!==o&&(o=-2)}return o<0?y.forSchema("bytes",t):e[0]}(r,t);case"array":return(r=r.filter((function(e){return e!==t.emptyArrayType}))).length?y.forSchema({type:"array",items:y.forTypes(r.map((function(e){return e.itemsType})),t)},t):t.emptyArrayType;default:return function(e,t){var r,n,i,o,s,a=[],u={},c={},f=!0;for(r=0,n=e.length;r<n;r++){var l,h,p,d,m,g;if("map"===(i=e[r]).typeName)f=!1,a.push(i.valuesType);else for(o=i.fields,l=0,h=o.length;l<h;l++)p=o[l],m=p.name,g=p.type,a.push(g),f&&(u[m]||(u[m]=[]),u[m].push(g),void 0!==(d=p.defaultValue())&&(c[m]=d))}if(f){var _=Object.keys(u);for(r=0,n=_.length;r<n;r++)m=_[r],u[m].length<e.length&&void 0===c[m]&&(t&&t.strictDefaults?f=!1:(u[m].unshift(y.forSchema("null",t)),c[m]=null))}s=f?{type:"record",fields:_.map((function(e){var r=y.forTypes(u[e],t),n=c[e];if(void 0!==n&&~r.typeName.indexOf("union")){var i,o,s=r.types.slice();for(i=0,o=s.length;i<o&&!s[i].isValid(n);i++);if(i>0){var a=s[0];s[0]=s[i],s[i]=a,r=y.forSchema(s,t)}}return{name:e,type:r,default:c[e]}}))}:{type:"map",values:y.forTypes(a,t)};return y.forSchema(s,t)}(r,t)}}));return 1===c.length?c[0]:y.forSchema(c,t)},y.isType=function(){var e=arguments.length;if(!e)return!1;var t=arguments[0];if(!t||"function"!=typeof t._update||"function"!=typeof t.fingerprint)return!1;if(1===e)return!0;var r,n=t.typeName;for(r=1;r<e;r++)if(0===n.indexOf(arguments[r]))return!0;return!1},y.__reset=function(e){a("resetting type buffer to %d",e),h.buf=new i.SlowBuffer(e)},Object.defineProperty(y.prototype,"branchName",{enumerable:!0,get:function(){if(this.name)return this.name;var e=y.isType(this,"logical")?this.underlyingType:this;return y.isType(e,"abstract")?e._concreteTypeName:y.isType(e,"union")?void 0:e.typeName}}),y.prototype.clone=function(e,t){return t?(t={coerce:0|!!t.coerceBuffers,fieldHook:t.fieldHook,qualifyNames:!!t.qualifyNames,skip:!!t.skipMissingFields,wrap:0|!!t.wrapUnions},this._copy(e,t)):this.fromBuffer(this.toBuffer(e))},y.prototype.compare=n.abstractFunction,y.prototype.compareBuffers=function(e,t){return this._match(new s(e),new s(t))},y.prototype.createResolver=function(e,t){if(!y.isType(e))throw new Error(u("not a type: %j",e));if(!y.isType(this,"union","logical")&&y.isType(e,"logical"))return this.createResolver(e.underlyingType,t);var r,n;if((t=t||{}).registry=t.registry||{},y.isType(this,"record","error")&&y.isType(e,"record","error")&&(n=this.name+":"+e.name,r=t.registry[n]))return r;if(r=new L(this),n&&(t.registry[n]=r),y.isType(e,"union")){var i=e.types.map((function(e){return this.createResolver(e,t)}),this);r._read=function(e){var t=e.readLong();if(void 0===i[t])throw new Error(u("invalid union index: %s",t));return i[t]._read(e)}}else this._update(r,e,t);if(!r._read)throw new Error(u("cannot read %s as %s",e,this));return Object.freeze(r)},y.prototype.decode=function(e,t,r){var n=new s(e,t),i=j(this,n,r);return n.isValid()?{value:i,offset:n.pos}:{value:void 0,offset:-1}},y.prototype.encode=function(e,t,r){var n=new s(t,r);return this._write(n,e),n.isValid()?n.pos:t.length-n.pos},y.prototype.equals=function(e){return y.isType(e)&&this.fingerprint().equals(e.fingerprint())},y.prototype.fingerprint=function(e){if(e)return n.getHash(JSON.stringify(this.schema()),e);if(!this._hash.str){var t=JSON.stringify(this.schema());this._hash.str=n.getHash(t).toString("binary")}return n.bufferFrom(this._hash.str,"binary")},y.prototype.fromBuffer=function(e,t,r){var n=new s(e),i=j(this,n,t,r);if(!n.isValid())throw new Error("truncated buffer");if(!r&&n.pos<e.length)throw new Error("trailing data");return i},y.prototype.fromString=function(e){return this._copy(JSON.parse(e),{coerce:2})},y.prototype.inspect=function(){var e=this.typeName,t=Y(e);if($(e))return u("<%s>",t);var r=this.schema({exportAttrs:!0,noDeref:!0});return"object"!=typeof r||y.isType(this,"logical")||(r.type=void 0),u("<%s %j>",t,r)},y.prototype.isValid=function(e,t){var r,n,i=0|(t&&t.noUndeclaredFields),o=t&&t.errorHook;return o&&(n=[],r=function(t,r){o.call(this,n.slice(),t,r,e)}),this._check(e,i,r,n)},y.prototype.random=n.abstractFunction,y.prototype.schema=function(e){return this._attrs({exportAttrs:!(!e||!e.exportAttrs),noDeref:!(!e||!e.noDeref)})},y.prototype.toBuffer=function(e){h.pos=0,this._write(h,e);var t=n.newBuffer(h.pos);return h.isValid()?h.buf.copy(t,0,0,h.pos):this._write(new s(t),e),t},y.prototype.toJSON=function(){return this.schema({exportAttrs:!0})},y.prototype.toString=function(e){return void 0===e?JSON.stringify(this.schema({noDeref:!0})):JSON.stringify(this._copy(e,{coerce:3}))},y.prototype.wrap=function(e){var t=this._branchConstructor;return null===t?null:new t(e)},y.prototype._attrs=function(e){e.derefed=e.derefed||{};var t=this.name;if(void 0!==t){if(e.noDeref||e.derefed[t])return t;e.derefed[t]=!0}var r={};void 0!==this.name&&(r.name=t),r.type=this.typeName;var n=this._deref(r,e);return void 0!==n&&(r=n),e.exportAttrs&&(this.aliases&&this.aliases.length&&(r.aliases=this.aliases),void 0!==this.doc&&(r.doc=this.doc)),r},y.prototype._createBranchConstructor=function(){var e=this.branchName;if("null"===e)return null;var t=~e.indexOf(".")?"this['"+e+"']":"this."+e,r=new Function("return function Branch$(val) { "+t+" = val; };")();return r.type=this,r.prototype.unwrap=new Function("return "+t+";"),r.prototype.unwrapped=r.prototype.unwrap,r},y.prototype._peek=function(e){var t=e.pos,r=this._read(e);return e.pos=t,r},y.prototype._check=n.abstractFunction,y.prototype._copy=n.abstractFunction,y.prototype._deref=n.abstractFunction,y.prototype._match=n.abstractFunction,y.prototype._read=n.abstractFunction,y.prototype._skip=n.abstractFunction,y.prototype._update=n.abstractFunction,y.prototype._write=n.abstractFunction,y.prototype.getAliases=function(){return this.aliases},y.prototype.getFingerprint=y.prototype.fingerprint,y.prototype.getName=function(e){return this.name||!e?this.name:this.branchName},y.prototype.getSchema=y.prototype.schema,y.prototype.getTypeName=function(){return this.typeName},o.inherits(m,y),m.prototype._update=function(e,t){t.typeName===this.typeName&&(e._read=this._read)},m.prototype._copy=function(e){return this._check(e,void 0,J),e},m.prototype._deref=function(){return this.typeName},m.prototype.compare=n.compare,o.inherits(g,m),g.prototype._check=function(e,t,r){var n=null===e;return!n&&r&&r(e,this),n},g.prototype._read=function(){return null},g.prototype._skip=function(){},g.prototype._write=function(e,t){null!==t&&J(t,this)},g.prototype._match=function(){return 0},g.prototype.compare=g.prototype._match,g.prototype.typeName="null",g.prototype.random=g.prototype._read,o.inherits(_,m),_.prototype._check=function(e,t,r){var n="boolean"==typeof e;return!n&&r&&r(e,this),n},_.prototype._read=function(e){return e.readBoolean()},_.prototype._skip=function(e){e.skipBoolean()},_.prototype._write=function(e,t){"boolean"!=typeof t&&J(t,this),e.writeBoolean(t)},_.prototype._match=function(e,t){return e.matchBoolean(t)},_.prototype.typeName="boolean",_.prototype.random=function(){return l.nextBoolean()},o.inherits(v,m),v.prototype._check=function(e,t,r){var n=e===(0|e);return!n&&r&&r(e,this),n},v.prototype._read=function(e){return e.readInt()},v.prototype._skip=function(e){e.skipInt()},v.prototype._write=function(e,t){t!==(0|t)&&J(t,this),e.writeInt(t)},v.prototype._match=function(e,t){return e.matchInt(t)},v.prototype.typeName="int",v.prototype.random=function(){return 0|l.nextInt(1e3)},o.inherits(b,m),b.prototype._check=function(e,t,r){var n="number"==typeof e&&e%1==0&&q(e);return!n&&r&&r(e,this),n},b.prototype._read=function(e){var t=e.readLong();if(!q(t))throw new Error("potential precision loss");return t},b.prototype._skip=function(e){e.skipLong()},b.prototype._write=function(e,t){("number"!=typeof t||t%1||!q(t))&&J(t,this),e.writeLong(t)},b.prototype._match=function(e,t){return e.matchLong(t)},b.prototype._update=function(e,t){switch(t.typeName){case"int":e._read=t._read;break;case"abstract:long":case"long":e._read=this._read}},b.prototype.typeName="long",b.prototype.random=function(){return l.nextInt()},b.__with=function(e,t){e=e||{};var r={toBuffer:"_toBuffer",fromBuffer:"_fromBuffer",fromJSON:"_fromJSON",toJSON:"_toJSON",isValid:"_isValid",compare:"compare"},n=new R(t);return Object.keys(r).forEach((function(t){if(void 0===e[t])throw new Error(u("missing method implementation: %s",t));n[r[t]]=e[t]})),Object.freeze(n)},o.inherits(w,m),w.prototype._check=function(e,t,r){var n="number"==typeof e;return!n&&r&&r(e,this),n},w.prototype._read=function(e){return e.readFloat()},w.prototype._skip=function(e){e.skipFloat()},w.prototype._write=function(e,t){"number"!=typeof t&&J(t,this),e.writeFloat(t)},w.prototype._match=function(e,t){return e.matchFloat(t)},w.prototype._update=function(e,t){switch(t.typeName){case"float":case"int":e._read=t._read;break;case"abstract:long":case"long":e._read=function(e){return e.readLong()}}},w.prototype.typeName="float",w.prototype.random=function(){return l.nextFloat(1e3)},o.inherits(E,m),E.prototype._check=function(e,t,r){var n="number"==typeof e;return!n&&r&&r(e,this),n},E.prototype._read=function(e){return e.readDouble()},E.prototype._skip=function(e){e.skipDouble()},E.prototype._write=function(e,t){"number"!=typeof t&&J(t,this),e.writeDouble(t)},E.prototype._match=function(e,t){return e.matchDouble(t)},E.prototype._update=function(e,t){switch(t.typeName){case"double":case"float":case"int":e._read=t._read;break;case"abstract:long":case"long":e._read=function(e){return e.readLong()}}},E.prototype.typeName="double",E.prototype.random=function(){return l.nextFloat()},o.inherits(B,m),B.prototype._check=function(e,t,r){var n="string"==typeof e;return!n&&r&&r(e,this),n},B.prototype._read=function(e){return e.readString()},B.prototype._skip=function(e){e.skipString()},B.prototype._write=function(e,t){"string"!=typeof t&&J(t,this),e.writeString(t)},B.prototype._match=function(e,t){return e.matchString(t)},B.prototype._update=function(e,t){switch(t.typeName){case"bytes":case"string":e._read=this._read}},B.prototype.typeName="string",B.prototype.random=function(){return l.nextString(l.nextInt(32))},o.inherits(A,m),A.prototype._check=function(e,r,n){var i=t.isBuffer(e);return!i&&n&&n(e,this),i},A.prototype._read=function(e){return e.readBytes()},A.prototype._skip=function(e){e.skipBytes()},A.prototype._write=function(e,r){t.isBuffer(r)||J(r,this),e.writeBytes(r)},A.prototype._match=function(e,t){return e.matchBytes(t)},A.prototype._update=B.prototype._update,A.prototype._copy=function(e,t){var r;switch(0|(t&&t.coerce)){case 3:return this._check(e,void 0,J),e.toString("binary");case 2:if("string"!=typeof e)throw new Error(u("cannot coerce to buffer: %j",e));return r=n.bufferFrom(e,"binary"),this._check(r,void 0,J),r;case 1:if(!Z(e))throw new Error(u("cannot coerce to buffer: %j",e));return r=n.bufferFrom(e.data),this._check(r,void 0,J),r;default:return this._check(e,void 0,J),n.bufferFrom(e)}},A.prototype.compare=t.compare,A.prototype.typeName="bytes",A.prototype.random=function(){return l.nextBuffer(l.nextInt(32))},o.inherits(S,y),S.prototype._branchConstructor=function(){throw new Error("unions cannot be directly wrapped")},S.prototype._skip=function(e){this.types[e.readLong()]._skip(e)},S.prototype._match=function(e,t){var r=e.readLong(),n=t.readLong();return r===n?this.types[r]._match(e,t):r<n?-1:1},S.prototype._deref=function(e,t){return this.types.map((function(e){return e._attrs(t)}))},S.prototype.getTypes=function(){return this.types},o.inherits(x,S),x.prototype._getIndex=function(e){var t=this._bucketIndices[W(e)];return this._dynamicBranches&&(t=this._getBranchIndex(e,t)),t},x.prototype._getBranchIndex=function(e,t){var r,n,i,o=this._dynamicBranches;for(r=0,n=o.length;r<n;r++)if((i=o[r]).type._check(e)){if(void 0!==t)throw new Error("ambiguous conversion");t=i.index}return t},x.prototype._check=function(e,t,r,n){var i=this._getIndex(e),o=void 0!==i;return o?this.types[i]._check(e,t,r,n):(r&&r(e,this),o)},x.prototype._read=function(e){var t=e.readLong(),r=this.types[t];if(r)return r._read(e);throw new Error(u("invalid union index: %s",t))},x.prototype._write=function(e,t){var r=this._getIndex(t);void 0===r&&J(t,this),e.writeLong(r),null!==t&&this.types[r]._write(e,t)},x.prototype._update=function(e,t,r){var n,i,o;for(n=0,i=this.types.length;n<i;n++){try{o=this.types[n].createResolver(t,r)}catch(e){continue}return void(e._read=function(e){return o._read(e)})}},x.prototype._copy=function(e,t){var r,n=t&&0|t.coerce,i=t&&0|t.wrap;if(2===i)r=0;else{switch(n){case 1:r=Z(e)&&void 0!==this._bucketIndices.buffer?this._bucketIndices.buffer:this._getIndex(e);break;case 2:if(null===e)r=this._bucketIndices.null;else if("object"==typeof e){var o=Object.keys(e);1===o.length&&(r=this._branchIndices[o[0]],e=e[o[0]])}break;default:r=this._getIndex(e)}void 0===r&&J(e,this)}var s=this.types[r];if(null===e||3===i)return s._copy(e,t);switch(n){case 3:var a={};return a[s.branchName]=s._copy(e,t),a;default:return s._copy(e,t)}},x.prototype.compare=function(e,t){var r=this._getIndex(e),i=this._getIndex(t);if(void 0===r)J(e,this);else{if(void 0!==i)return r===i?this.types[r].compare(e,t):n.compare(r,i);J(t,this)}},x.prototype.typeName="union:unwrapped",x.prototype.random=function(){var e=l.nextInt(this.types.length);return this.types[e].random()},o.inherits(T,S),T.prototype._check=function(e,t,r,n){var i=!1;if(null===e)i=void 0!==this._branchIndices.null;else if("object"==typeof e){var o=Object.keys(e);if(1===o.length){var s=o[0],a=this._branchIndices[s];if(void 0!==a)return r?(n.push(s),i=this.types[a]._check(e[s],t,r,n),n.pop(),i):this.types[a]._check(e[s],t)}}return!i&&r&&r(e,this),i},T.prototype._read=function(e){var t=this.types[e.readLong()];if(!t)throw new Error(u("invalid union index"));var r=t._branchConstructor;return null===r?null:new r(t._read(e))},T.prototype._write=function(e,t){var r,n,i;null===t?(void 0===(r=this._branchIndices.null)&&J(t,this),e.writeLong(r)):(1===(n=Object.keys(t)).length&&(i=n[0],r=this._branchIndices[i]),void 0===r&&J(t,this),e.writeLong(r),this.types[r]._write(e,t[i]))},T.prototype._update=function(e,t,r){var n,i,o,s;for(n=0,i=this.types.length;n<i;n++){try{o=this.types[n].createResolver(t,r)}catch(e){continue}return s=this.types[n]._branchConstructor,void(e._read=s?function(e){return new s(o._read(e))}:function(){return null})}},T.prototype._copy=function(e,t){var r,n,i,o=t&&0|t.wrap;if(2===o){var s=this.types[0];return null===e&&"null"===s.typeName?null:new s._branchConstructor(s._copy(e,t))}if(null===e&&void 0!==this._branchIndices.null)return null;if("object"==typeof e){var a=Object.keys(e);if(1===a.length){var u,c,f=a[0];if(void 0===(r=this._branchIndices[f])&&t.qualifyNames)for(u=0,n=this.types.length;u<n;u++)if((c=this.types[u]).name&&f===M(c.name)){r=u;break}void 0!==r&&(i=this.types[r]._copy(e[f],t))}}if(1===o&&void 0===i)for(r=0,n=this.types.length;r<n&&void 0===i;)try{i=this.types[r]._copy(e,t)}catch(e){r++}if(void 0!==i)return 3===o?i:new this.types[r]._branchConstructor(i);J(e,this)},T.prototype.compare=function(e,t){var r=null===e?"null":Object.keys(e)[0],i=null===t?"null":Object.keys(t)[0],o=this._branchIndices[r];return r===i?"null"===r?0:this.types[o].compare(e[r],t[r]):n.compare(o,this._branchIndices[i])},T.prototype.typeName="union:wrapped",T.prototype.random=function(){var e=l.nextInt(this.types.length),t=this.types[e],r=t._branchConstructor;return r?new r(t.random()):null},o.inherits(N,y),N.prototype._check=function(e,t,r){var n=void 0!==this._indices[e];return!n&&r&&r(e,this),n},N.prototype._read=function(e){var t=e.readLong(),r=this.symbols[t];if(void 0===r)throw new Error(u("invalid %s enum index: %s",this.name,t));return r},N.prototype._skip=function(e){e.skipLong()},N.prototype._write=function(e,t){var r=this._indices[t];void 0===r&&J(t,this),e.writeLong(r)},N.prototype._match=function(e,t){return e.matchLong(t)},N.prototype.compare=function(e,t){return n.compare(this._indices[e],this._indices[t])},N.prototype._update=function(e,t){var r=this.symbols;"enum"!==t.typeName||t.name&&!~z(this).indexOf(t.name)||!t.symbols.every((function(e){return~r.indexOf(e)}))||(e.symbols=t.symbols,e._read=t._read)},N.prototype._copy=function(e){return this._check(e,void 0,J),e},N.prototype._deref=function(e){e.symbols=this.symbols},N.prototype.getSymbols=function(){return this.symbols},N.prototype.typeName="enum",N.prototype.random=function(){return l.choice(this.symbols)},o.inherits(O,y),O.prototype._check=function(e,r,n){var i=t.isBuffer(e)&&e.length===this.size;return!i&&n&&n(e,this),i},O.prototype._read=function(e){return e.readFixed(this.size)},O.prototype._skip=function(e){e.skipFixed(this.size)},O.prototype._write=function(e,r){t.isBuffer(r)&&r.length===this.size||J(r,this),e.writeFixed(r,this.size)},O.prototype._match=function(e,t){return e.matchFixed(t,this.size)},O.prototype.compare=t.compare,O.prototype._update=function(e,t){"fixed"!==t.typeName||this.size!==t.size||t.name&&!~z(this).indexOf(t.name)||(e.size=this.size,e._read=this._read)},O.prototype._copy=A.prototype._copy,O.prototype._deref=function(e){e.size=this.size},O.prototype.getSize=function(){return this.size},O.prototype.typeName="fixed",O.prototype.random=function(){return l.nextBuffer(this.size)},o.inherits(k,y),k.prototype._check=function(e,t,r,n){if(!e||"object"!=typeof e||Array.isArray(e))return r&&r(e,this),!1;var i,o,s,a,u=Object.keys(e),c=!0;if(r){for(s=n.length,n.push(""),i=0,o=u.length;i<o;i++)a=n[s]=u[i],this.valuesType._check(e[a],t,r,n)||(c=!1);n.pop()}else for(i=0,o=u.length;i<o;i++)if(!this.valuesType._check(e[u[i]],t))return!1;return c},k.prototype._read=function(e){for(var t,r=this.valuesType,n={};t=H(e);)for(;t--;){n[e.readString()]=r._read(e)}return n},k.prototype._skip=function(e){for(var t,r,n=this.valuesType;r=e.readLong();)if(r<0)t=e.readLong(),e.pos+=t;else for(;r--;)e.skipString(),n._skip(e)},k.prototype._write=function(e,t){t&&"object"==typeof t&&!Array.isArray(t)||J(t,this);var r,n,i=this.valuesType,o=Object.keys(t),s=o.length;if(s)for(e.writeLong(s),r=0;r<s;r++)n=o[r],e.writeString(n),i._write(e,t[n]);e.writeLong(0)},k.prototype._match=function(){throw new Error("maps cannot be compared")},k.prototype._update=function(e,t,r){"map"===t.typeName&&(e.valuesType=this.valuesType.createResolver(t.valuesType,r),e._read=this._read)},k.prototype._copy=function(e,t){if(e&&"object"==typeof e&&!Array.isArray(e)){var r,n,i,o=this.valuesType,s=Object.keys(e),a={};for(r=0,n=s.length;r<n;r++)a[i=s[r]]=o._copy(e[i],t);return a}J(e,this)},k.prototype.compare=k.prototype._match,k.prototype.typeName="map",k.prototype.getValuesType=function(){return this.valuesType},k.prototype.random=function(){var e,t,r={};for(e=0,t=l.nextInt(10);e<t;e++)r[l.nextString(l.nextInt(20))]=this.valuesType.random();return r},k.prototype._deref=function(e,t){e.values=this.valuesType._attrs(t)},o.inherits(I,y),I.prototype._check=function(e,t,r,n){if(!Array.isArray(e))return r&&r(e,this),!1;var i,o,s,a=!0;if(r){for(s=n.length,n.push(""),i=0,o=e.length;i<o;i++)n[s]=""+i,this.itemsType._check(e[i],t,r,n)||(a=!1);n.pop()}else for(i=0,o=e.length;i<o;i++)if(!this.itemsType._check(e[i],t))return!1;return a},I.prototype._read=function(e){for(var t,r=this.itemsType,n=[];t=e.readLong();)for(t<0&&(t=-t,e.skipLong());t--;)n.push(r._read(e));return n},I.prototype._skip=function(e){for(var t,r;r=e.readLong();)if(r<0)t=e.readLong(),e.pos+=t;else for(;r--;)this.itemsType._skip(e)},I.prototype._write=function(e,t){Array.isArray(t)||J(t,this);var r,n=t.length;if(n)for(e.writeLong(n),r=0;r<n;r++)this.itemsType._write(e,t[r]);e.writeLong(0)},I.prototype._match=function(e,t){for(var r,i=e.readLong(),o=t.readLong();i&&o;){if(r=this.itemsType._match(e,t))return r;--i||(i=H(e)),--o||(o=H(t))}return n.compare(i,o)},I.prototype._update=function(e,t,r){"array"===t.typeName&&(e.itemsType=this.itemsType.createResolver(t.itemsType,r),e._read=this._read)},I.prototype._copy=function(e,t){Array.isArray(e)||J(e,this);var r,n,i=new Array(e.length);for(r=0,n=e.length;r<n;r++)i[r]=this.itemsType._copy(e[r],t);return i},I.prototype._deref=function(e,t){e.items=this.itemsType._attrs(t)},I.prototype.compare=function(e,t){var r,i,o,s=e.length,a=t.length;for(r=0,i=Math.min(s,a);r<i;r++)if(o=this.itemsType.compare(e[r],t[r]))return o;return n.compare(s,a)},I.prototype.getItemsType=function(){return this.itemsType},I.prototype.typeName="array",I.prototype.random=function(){var e,t,r=[];for(e=0,t=l.nextInt(10);e<t;e++)r.push(this.itemsType.random());return r},o.inherits(F,y),F.prototype._getConstructorName=function(){return this.name?M(this.name):this._isError?"Error$":"Record$"},F.prototype._createConstructor=function(e){var t,r,n,i,s,a,u,c=[],f=[],l=[],h="";for(t=0,r=this.fields.length;t<r;t++)a=void 0!==(s=(n=this.fields[t]).defaultValue)(),i=n.name,e&&this._isError&&"stack"===i&&y.isType(n.type,"string")&&!a&&(u=n),f.push("v"+t),h+="  ",a?(h+="if (v"+t+" === undefined) { ",h+="this."+i+" = d"+l.length+"(); ",h+="} else { this."+i+" = v"+t+"; }\n",c.push("d"+l.length),l.push(s)):h+="this."+i+" = v"+t+";\n";u&&(h+="  if (this.stack === undefined) { ","function"==typeof Error.captureStackTrace?h+="Error.captureStackTrace(this, this.constructor);":h+="this.stack = Error().stack;",h+=" }\n");var p="return function "+this._getConstructorName()+"(";p+=f.join()+") {\n"+h+"};";var d=new Function(c.join(),p).apply(void 0,l),m=this;return d.getType=function(){return m},d.type=m,this._isError&&(o.inherits(d,Error),d.prototype.name=this._getConstructorName()),d.prototype.clone=function(e){return m.clone(this,e)},d.prototype.compare=function(e){return m.compare(this,e)},d.prototype.isValid=function(e){return m.isValid(this,e)},d.prototype.toBuffer=function(){return m.toBuffer(this)},d.prototype.toString=function(){return m.toString(this)},d.prototype.wrap=function(){return m.wrap(this)},d.prototype.wrapped=d.prototype.wrap,d},F.prototype._createChecker=function(){var e=[],t=[],r="return function check"+this._getConstructorName()+"(v, f, h, p) {\n";if(r+="  if (\n",r+="    v === null ||\n",r+="    typeof v != 'object' ||\n",r+="    (f && !this._checkFields(v))\n",r+="  ) {\n",r+="    if (h) { h(v, this); }\n",r+="    return false;\n",r+="  }\n",this.fields.length){for(n=0,i=this.fields.length;n<i;n++)o=this.fields[n],e.push("t"+n),t.push(o.type),void 0!==o.defaultValue()&&(r+="  var v"+n+" = v."+o.name+";\n");var n,i,o;for(r+="  if (h) {\n",r+="    var b = 1;\n",r+="    var j = p.length;\n",r+="    p.push('');\n",n=0,i=this.fields.length;n<i;n++)r+="    p[j] = '"+(o=this.fields[n]).name+"';\n",r+="    b &= ",void 0===o.defaultValue()?r+="t"+n+"._check(v."+o.name+", f, h, p);\n":(r+="v"+n+" === undefined || ",r+="t"+n+"._check(v"+n+", f, h, p);\n");r+="    p.pop();\n",r+="    return !!b;\n",r+="  } else {\n    return (\n      ",r+=this.fields.map((function(e,t){return void 0===e.defaultValue()?"t"+t+"._check(v."+e.name+", f)":"(v"+t+" === undefined || t"+t+"._check(v"+t+", f))"})).join(" &&\n      "),r+="\n    );\n  }\n"}else r+="  return true;\n";return r+="};",new Function(e.join(),r).apply(void 0,t)},F.prototype._createReader=function(){var e,t,r=[],n=[this.recordConstructor];for(e=0,t=this.fields.length;e<t;e++)r.push("t"+e),n.push(this.fields[e].type);var i=this._getConstructorName(),o="return function read"+i+"(t) {\n";return o+="  return new "+i+"(\n    ",o+=r.map((function(e){return e+"._read(t)"})).join(",\n    "),o+="\n  );\n};",r.unshift(i),new Function(r.join(),o).apply(void 0,n)},F.prototype._createSkipper=function(){var e,t,r=[],n="return function skip"+this._getConstructorName()+"(t) {\n",i=[];for(e=0,t=this.fields.length;e<t;e++)r.push("t"+e),i.push(this.fields[e].type),n+="  t"+e+"._skip(t);\n";return n+="}",new Function(r.join(),n).apply(void 0,i)},F.prototype._createWriter=function(){var e,t,r,n,i=[],o="return function write"+this._getConstructorName()+"(t, v) {\n",s=[];for(e=0,t=this.fields.length;e<t;e++)r=this.fields[e],i.push("t"+e),s.push(r.type),o+="  ",void 0===r.defaultValue()?o+="t"+e+"._write(t, v."+r.name+");\n":(n=r.type.toBuffer(r.defaultValue()).toString("binary"),i.push("d"+e),s.push(n),o+="var v"+e+" = v."+r.name+";\n",o+="if (v"+e+" === undefined) {\n",o+="    t.writeBinary(d"+e+", "+n.length+");\n",o+="  } else {\n    t"+e+"._write(t, v"+e+");\n  }\n");return o+="}",new Function(i.join(),o).apply(void 0,s)},F.prototype._update=function(e,t,r){if(t.name&&!~z(this).indexOf(t.name))throw new Error(u("no alias found for %s",t.name));var i,o,s,a,c,f,l,h=this.fields,p=t.fields,d=n.toMap(p,(function(e){return e.name})),y=[],m={};for(i=0;i<h.length;i++){for(c=z(s=h[i]),f=[],o=0;o<c.length;o++)d[a=c[o]]&&f.push(a);if(f.length>1)throw new Error(u("ambiguous aliasing for %s.%s (%s)",t.name,s.name,f));if(f.length)a=f[0],l={resolver:s.type.createResolver(d[a].type,r),name:"_"+s.name},m[a]?m[a].push(l):m[a]=[l],y.push(l.name);else{if(void 0===s.defaultValue())throw new Error(u("no matching field for default-less %s.%s",t.name,s.name));y.push("undefined")}}var g=-1;for(i=p.length;i&&void 0===m[p[--i].name];)g=i;var _=this._getConstructorName(),v=[_],b=[this.recordConstructor],w="  return function read"+_+"(t, b) {\n";for(i=0;i<p.length;i++)if(i===g&&(w+="  if (!b) {\n"),void 0===m[a=(s=t.fields[i]).name])w+=~g&&i>=g?"    ":"  ",v.push("r"+i),b.push(s.type),w+="r"+i+"._skip(t);\n";else for(o=m[a].length;o--;)w+=~g&&i>=g?"    ":"  ",v.push("r"+i+"f"+o),l=m[a][o],b.push(l.resolver),w+="var "+l.name+" = ",w+="r"+i+"f"+o+"._"+(o?"peek":"read")+"(t);\n";~g&&(w+="  }\n"),w+="  return new "+_+"("+y.join()+");\n};",e._read=new Function(v.join(),w).apply(void 0,b)},F.prototype._match=function(e,t){var r,n,i,o,s,a=this.fields;for(r=0,n=a.length;r<n;r++)if(o=(i=a[r])._order,s=i.type,o){if(o*=s._match(e,t))return o}else s._skip(e),s._skip(t);return 0},F.prototype._checkFields=function(e){var t,r,n=Object.keys(e);for(t=0,r=n.length;t<r;t++)if(!this._fieldsByName[n[t]])return!1;return!0},F.prototype._copy=function(e,t){var r,n,i,o,s=t&&t.fieldHook,a=[void 0];for(r=0,n=this.fields.length;r<n;r++)void 0===(o=e[(i=this.fields[r]).name])&&i.hasOwnProperty("defaultValue")&&(o=i.defaultValue()),(t&&!t.skip||void 0!==o)&&(o=i.type._copy(o,t)),s&&(o=s(i,o,this)),a.push(o);var u=this.recordConstructor;return new(u.bind.apply(u,a))},F.prototype._deref=function(e,t){e.fields=this.fields.map((function(e){var r=e.type,n={name:e.name,type:r._attrs(t)};if(t.exportAttrs){var i=e.defaultValue();void 0!==i&&(n.default=r._copy(i,{coerce:3,wrap:3}));var o=e.order;"ascending"!==o&&(n.order=o);var s=e.aliases;s.length&&(n.aliases=s);var a=e.doc;void 0!==a&&(n.doc=a)}return n}))},F.prototype.compare=function(e,t){var r,n,i,o,s,a,u=this.fields;for(r=0,n=u.length;r<n;r++)if(o=(i=u[r]).name,s=i._order,a=i.type,s&&(s*=a.compare(e[o],t[o])))return s;return 0},F.prototype.random=function(){var e=this.fields.map((function(e){return e.type.random()}));e.unshift(void 0);var t=this.recordConstructor;return new(t.bind.apply(t,e))},F.prototype.field=function(e){return this._fieldsByName[e]},F.prototype.getField=F.prototype.field,F.prototype.getFields=function(){return this.fields},F.prototype.getRecordConstructor=function(){return this.recordConstructor},Object.defineProperty(F.prototype,"typeName",{enumerable:!0,get:function(){return this._isError?"error":"record"}}),o.inherits(D,y),Object.defineProperty(D.prototype,"typeName",{enumerable:!0,get:function(){return"logical:"+this._logicalTypeName}}),Object.defineProperty(D.prototype,"underlyingType",{enumerable:!0,get:function(){if(this._underlyingType)return this._underlyingType;var e,t,r;for(e=0,t=d.length;e<t;e++)if((r=d[e])[0]===this)return r[1]}}),D.prototype.getUnderlyingType=function(){return this.underlyingType},D.prototype._read=function(e){return this._fromValue(this.underlyingType._read(e))},D.prototype._write=function(e,t){this.underlyingType._write(e,this._toValue(t))},D.prototype._check=function(e,t,r,n){try{var i=this._toValue(e)}catch(e){}return void 0===i?(r&&r(e,this),!1):this.underlyingType._check(i,t,r,n)},D.prototype._copy=function(e,t){var r=this.underlyingType;switch(t&&t.coerce){case 3:return r._copy(this._toValue(e),t);case 2:return this._fromValue(r._copy(e,t));default:return this._fromValue(r._copy(this._toValue(e),t))}},D.prototype._update=function(e,t,r){var n=this._resolve(t,r);n&&(e._read=function(e){return n(t._read(e))})},D.prototype.compare=function(e,t){var r=this._toValue(e),n=this._toValue(t);return this.underlyingType.compare(r,n)},D.prototype.random=function(){return this._fromValue(this.underlyingType.random())},D.prototype._deref=function(e,t){var r=this.underlyingType,n=void 0!==r.name&&t.derefed[r.name];return e=r._attrs(t),!n&&t.exportAttrs&&("string"==typeof e&&(e={type:e}),e.logicalType=this._logicalTypeName,this._export(e)),e},D.prototype._skip=function(e){this.underlyingType._skip(e)},D.prototype._export=function(){},D.prototype._fromValue=n.abstractFunction,D.prototype._toValue=n.abstractFunction,D.prototype._resolve=n.abstractFunction,o.inherits(R,b),R.prototype.typeName="abstract:long",R.prototype._check=function(e,t,r){var n=this._isValid(e);return!n&&r&&r(e,this),n},R.prototype._read=function(e){var t,r;if(this._noUnpack?(r=e.pos,e.skipLong(),t=e.buf.slice(r,e.pos)):t=e.unpackLongBytes(e),e.isValid())return this._fromBuffer(t)},R.prototype._write=function(e,t){this._isValid(t)||J(t,this);var r=this._toBuffer(t);this._noUnpack?e.writeFixed(r):e.packLongBytes(r)},R.prototype._copy=function(e,t){switch(t&&t.coerce){case 3:return this._toJSON(e);case 2:return this._fromJSON(e);default:return this._fromJSON(this._toJSON(e))}},R.prototype._deref=function(){return"long"},R.prototype._update=function(e,t){var r=this;switch(t.typeName){case"int":e._read=function(e){return r._fromJSON(t._read(e))};break;case"abstract:long":case"long":e._read=function(e){return r._read(e)}}},R.prototype.random=function(){return this._fromJSON(b.prototype.random())},R.prototype._fromBuffer=n.abstractFunction,R.prototype._toBuffer=n.abstractFunction,R.prototype._fromJSON=n.abstractFunction,R.prototype._toJSON=n.abstractFunction,R.prototype._isValid=n.abstractFunction,R.prototype.compare=n.abstractFunction,C.prototype.defaultValue=function(){},Object.defineProperty(C.prototype,"order",{enumerable:!0,get:function(){return["descending","ignore","ascending"][this._order+1]}}),C.prototype.getAliases=function(){return this.aliases},C.prototype.getDefault=C.prototype.defaultValue,C.prototype.getName=function(){return this.name},C.prototype.getOrder=function(){return this.order},C.prototype.getType=function(){return this.type},L.prototype._peek=y.prototype._peek,L.prototype.inspect=function(){return"<Resolver>"},e.exports={Type:y,getTypeBucket:G,getValueBucket:W,isPrimitive:$,isValidName:V,qualify:U,builtins:function(){var e,t,r,n={LogicalType:D,UnwrappedUnionType:x,WrappedUnionType:T},i=Object.keys(c);for(e=0,t=i.length;e<t;e++)n[Y(r=i[e])]=c[r];return n}()}}).call(this,r(11).Buffer)},5:function(e,t,r){var n=r(39);e.exports=function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&n(e,t)}},56:function(e,t,r){(function(e){function r(e){return Object.prototype.toString.call(e)}t.isArray=function(e){return Array.isArray?Array.isArray(e):"[object Array]"===r(e)},t.isBoolean=function(e){return"boolean"==typeof e},t.isNull=function(e){return null===e},t.isNullOrUndefined=function(e){return null==e},t.isNumber=function(e){return"number"==typeof e},t.isString=function(e){return"string"==typeof e},t.isSymbol=function(e){return"symbol"==typeof e},t.isUndefined=function(e){return void 0===e},t.isRegExp=function(e){return"[object RegExp]"===r(e)},t.isObject=function(e){return"object"==typeof e&&null!==e},t.isDate=function(e){return"[object Date]"===r(e)},t.isError=function(e){return"[object Error]"===r(e)||e instanceof Error},t.isFunction=function(e){return"function"==typeof e},t.isPrimitive=function(e){return null===e||"boolean"==typeof e||"number"==typeof e||"string"==typeof e||"symbol"==typeof e||void 0===e},t.isBuffer=e.isBuffer}).call(this,r(11).Buffer)},6:function(e,t,r){e.exports=r(43)},63:function(e,t,r){"use strict";(function(t){void 0===t||!t.version||0===t.version.indexOf("v0.")||0===t.version.indexOf("v1.")&&0!==t.version.indexOf("v1.8.")?e.exports={nextTick:function(e,r,n,i){if("function"!=typeof e)throw new TypeError('"callback" argument must be a function');var o,s,a=arguments.length;switch(a){case 0:case 1:return t.nextTick(e);case 2:return t.nextTick((function(){e.call(null,r)}));case 3:return t.nextTick((function(){e.call(null,r,n)}));case 4:return t.nextTick((function(){e.call(null,r,n,i)}));default:for(o=new Array(a-1),s=0;s<o.length;)o[s++]=arguments[s];return t.nextTick((function(){e.apply(null,o)}))}}}:e.exports=t}).call(this,r(25))},64:function(e,t,r){(function(e){var n=Object.getOwnPropertyDescriptors||function(e){for(var t=Object.keys(e),r={},n=0;n<t.length;n++)r[t[n]]=Object.getOwnPropertyDescriptor(e,t[n]);return r},i=/%[sdj%]/g;t.format=function(e){if(!g(e)){for(var t=[],r=0;r<arguments.length;r++)t.push(a(arguments[r]));return t.join(" ")}r=1;for(var n=arguments,o=n.length,s=String(e).replace(i,(function(e){if("%%"===e)return"%";if(r>=o)return e;switch(e){case"%s":return String(n[r++]);case"%d":return Number(n[r++]);case"%j":try{return JSON.stringify(n[r++])}catch(e){return"[Circular]"}default:return e}})),u=n[r];r<o;u=n[++r])y(u)||!b(u)?s+=" "+u:s+=" "+a(u);return s},t.deprecate=function(r,n){if(void 0!==e&&!0===e.noDeprecation)return r;if(void 0===e)return function(){return t.deprecate(r,n).apply(this,arguments)};var i=!1;return function(){if(!i){if(e.throwDeprecation)throw new Error(n);e.traceDeprecation?console.trace(n):console.error(n),i=!0}return r.apply(this,arguments)}};var o,s={};function a(e,r){var n={seen:[],stylize:c};return arguments.length>=3&&(n.depth=arguments[2]),arguments.length>=4&&(n.colors=arguments[3]),d(r)?n.showHidden=r:r&&t._extend(n,r),_(n.showHidden)&&(n.showHidden=!1),_(n.depth)&&(n.depth=2),_(n.colors)&&(n.colors=!1),_(n.customInspect)&&(n.customInspect=!0),n.colors&&(n.stylize=u),f(n,e,n.depth)}function u(e,t){var r=a.styles[t];return r?"["+a.colors[r][0]+"m"+e+"["+a.colors[r][1]+"m":e}function c(e,t){return e}function f(e,r,n){if(e.customInspect&&r&&B(r.inspect)&&r.inspect!==t.inspect&&(!r.constructor||r.constructor.prototype!==r)){var i=r.inspect(n,e);return g(i)||(i=f(e,i,n)),i}var o=function(e,t){if(_(t))return e.stylize("undefined","undefined");if(g(t)){var r="'"+JSON.stringify(t).replace(/^"|"$/g,"").replace(/'/g,"\\'").replace(/\\"/g,'"')+"'";return e.stylize(r,"string")}if(m(t))return e.stylize(""+t,"number");if(d(t))return e.stylize(""+t,"boolean");if(y(t))return e.stylize("null","null")}(e,r);if(o)return o;var s=Object.keys(r),a=function(e){var t={};return e.forEach((function(e,r){t[e]=!0})),t}(s);if(e.showHidden&&(s=Object.getOwnPropertyNames(r)),E(r)&&(s.indexOf("message")>=0||s.indexOf("description")>=0))return l(r);if(0===s.length){if(B(r)){var u=r.name?": "+r.name:"";return e.stylize("[Function"+u+"]","special")}if(v(r))return e.stylize(RegExp.prototype.toString.call(r),"regexp");if(w(r))return e.stylize(Date.prototype.toString.call(r),"date");if(E(r))return l(r)}var c,b="",A=!1,S=["{","}"];(p(r)&&(A=!0,S=["[","]"]),B(r))&&(b=" [Function"+(r.name?": "+r.name:"")+"]");return v(r)&&(b=" "+RegExp.prototype.toString.call(r)),w(r)&&(b=" "+Date.prototype.toUTCString.call(r)),E(r)&&(b=" "+l(r)),0!==s.length||A&&0!=r.length?n<0?v(r)?e.stylize(RegExp.prototype.toString.call(r),"regexp"):e.stylize("[Object]","special"):(e.seen.push(r),c=A?function(e,t,r,n,i){for(var o=[],s=0,a=t.length;s<a;++s)N(t,String(s))?o.push(h(e,t,r,n,String(s),!0)):o.push("");return i.forEach((function(i){i.match(/^\d+$/)||o.push(h(e,t,r,n,i,!0))})),o}(e,r,n,a,s):s.map((function(t){return h(e,r,n,a,t,A)})),e.seen.pop(),function(e,t,r){if(e.reduce((function(e,t){return t.indexOf("\n")>=0&&0,e+t.replace(/\u001b\[\d\d?m/g,"").length+1}),0)>60)return r[0]+(""===t?"":t+"\n ")+" "+e.join(",\n  ")+" "+r[1];return r[0]+t+" "+e.join(", ")+" "+r[1]}(c,b,S)):S[0]+b+S[1]}function l(e){return"["+Error.prototype.toString.call(e)+"]"}function h(e,t,r,n,i,o){var s,a,u;if((u=Object.getOwnPropertyDescriptor(t,i)||{value:t[i]}).get?a=u.set?e.stylize("[Getter/Setter]","special"):e.stylize("[Getter]","special"):u.set&&(a=e.stylize("[Setter]","special")),N(n,i)||(s="["+i+"]"),a||(e.seen.indexOf(u.value)<0?(a=y(r)?f(e,u.value,null):f(e,u.value,r-1)).indexOf("\n")>-1&&(a=o?a.split("\n").map((function(e){return"  "+e})).join("\n").substr(2):"\n"+a.split("\n").map((function(e){return"   "+e})).join("\n")):a=e.stylize("[Circular]","special")),_(s)){if(o&&i.match(/^\d+$/))return a;(s=JSON.stringify(""+i)).match(/^"([a-zA-Z_][a-zA-Z_0-9]*)"$/)?(s=s.substr(1,s.length-2),s=e.stylize(s,"name")):(s=s.replace(/'/g,"\\'").replace(/\\"/g,'"').replace(/(^"|"$)/g,"'"),s=e.stylize(s,"string"))}return s+": "+a}function p(e){return Array.isArray(e)}function d(e){return"boolean"==typeof e}function y(e){return null===e}function m(e){return"number"==typeof e}function g(e){return"string"==typeof e}function _(e){return void 0===e}function v(e){return b(e)&&"[object RegExp]"===A(e)}function b(e){return"object"==typeof e&&null!==e}function w(e){return b(e)&&"[object Date]"===A(e)}function E(e){return b(e)&&("[object Error]"===A(e)||e instanceof Error)}function B(e){return"function"==typeof e}function A(e){return Object.prototype.toString.call(e)}function S(e){return e<10?"0"+e.toString(10):e.toString(10)}t.debuglog=function(r){if(_(o)&&(o=e.env.NODE_DEBUG||""),r=r.toUpperCase(),!s[r])if(new RegExp("\\b"+r+"\\b","i").test(o)){var n=e.pid;s[r]=function(){var e=t.format.apply(t,arguments);console.error("%s %d: %s",r,n,e)}}else s[r]=function(){};return s[r]},t.inspect=a,a.colors={bold:[1,22],italic:[3,23],underline:[4,24],inverse:[7,27],white:[37,39],grey:[90,39],black:[30,39],blue:[34,39],cyan:[36,39],green:[32,39],magenta:[35,39],red:[31,39],yellow:[33,39]},a.styles={special:"cyan",number:"yellow",boolean:"yellow",undefined:"grey",null:"bold",string:"green",date:"magenta",regexp:"red"},t.isArray=p,t.isBoolean=d,t.isNull=y,t.isNullOrUndefined=function(e){return null==e},t.isNumber=m,t.isString=g,t.isSymbol=function(e){return"symbol"==typeof e},t.isUndefined=_,t.isRegExp=v,t.isObject=b,t.isDate=w,t.isError=E,t.isFunction=B,t.isPrimitive=function(e){return null===e||"boolean"==typeof e||"number"==typeof e||"string"==typeof e||"symbol"==typeof e||void 0===e},t.isBuffer=r(217);var x=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"];function T(){var e=new Date,t=[S(e.getHours()),S(e.getMinutes()),S(e.getSeconds())].join(":");return[e.getDate(),x[e.getMonth()],t].join(" ")}function N(e,t){return Object.prototype.hasOwnProperty.call(e,t)}t.log=function(){console.log("%s - %s",T(),t.format.apply(t,arguments))},t.inherits=r(218),t._extend=function(e,t){if(!t||!b(t))return e;for(var r=Object.keys(t),n=r.length;n--;)e[r[n]]=t[r[n]];return e};var O="undefined"!=typeof Symbol?Symbol("util.promisify.custom"):void 0;function k(e,t){if(!e){var r=new Error("Promise was rejected with a falsy value");r.reason=e,e=r}return t(e)}t.promisify=function(e){if("function"!=typeof e)throw new TypeError('The "original" argument must be of type Function');if(O&&e[O]){var t;if("function"!=typeof(t=e[O]))throw new TypeError('The "util.promisify.custom" argument must be of type Function');return Object.defineProperty(t,O,{value:t,enumerable:!1,writable:!1,configurable:!0}),t}function t(){for(var t,r,n=new Promise((function(e,n){t=e,r=n})),i=[],o=0;o<arguments.length;o++)i.push(arguments[o]);i.push((function(e,n){e?r(e):t(n)}));try{e.apply(this,i)}catch(e){r(e)}return n}return Object.setPrototypeOf(t,Object.getPrototypeOf(e)),O&&Object.defineProperty(t,O,{value:t,enumerable:!1,writable:!1,configurable:!0}),Object.defineProperties(t,n(e))},t.promisify.custom=O,t.callbackify=function(t){if("function"!=typeof t)throw new TypeError('The "original" argument must be of type Function');function r(){for(var r=[],n=0;n<arguments.length;n++)r.push(arguments[n]);var i=r.pop();if("function"!=typeof i)throw new TypeError("The last argument must be of type Function");var o=this,s=function(){return i.apply(o,arguments)};t.apply(this,r).then((function(t){e.nextTick(s,null,t)}),(function(t){e.nextTick(k,t,s)}))}return Object.setPrototypeOf(r,Object.getPrototypeOf(t)),Object.defineProperties(r,n(t)),r}}).call(this,r(25))},68:function(e,t,r){e.exports=i;var n=r(74).EventEmitter;function i(){n.call(this)}r(17)(i,n),i.Readable=r(80),i.Writable=r(152),i.Duplex=r(153),i.Transform=r(154),i.PassThrough=r(155),i.Stream=i,i.prototype.pipe=function(e,t){var r=this;function i(t){e.writable&&!1===e.write(t)&&r.pause&&r.pause()}function o(){r.readable&&r.resume&&r.resume()}r.on("data",i),e.on("drain",o),e._isStdio||t&&!1===t.end||(r.on("end",a),r.on("close",u));var s=!1;function a(){s||(s=!0,e.end())}function u(){s||(s=!0,"function"==typeof e.destroy&&e.destroy())}function c(e){if(f(),0===n.listenerCount(this,"error"))throw e}function f(){r.removeListener("data",i),e.removeListener("drain",o),r.removeListener("end",a),r.removeListener("close",u),r.removeListener("error",c),e.removeListener("error",c),r.removeListener("end",f),r.removeListener("close",f),e.removeListener("close",f)}return r.on("error",c),e.on("error",c),r.on("end",f),r.on("close",f),e.on("close",f),e.emit("pipe",r),e}},7:function(e,t,r){"use strict";r.d(t,"a",(function(){return a}));var n=r(1),i=r.n(n),o=r(2),s=r.n(o),a=function(){function e(t){i()(this,e),this.bytes=t,this.length=this.bytes.length,this.position=0,this.bitPos=0}return s()(e,[{key:"getBytes",value:function(e){if(!(this.position>this.length)){var t=this.position+e,r=this.bytes.slice(this.position,t);return this.position=t,this.bitPos=0,r}}},{key:"readString",value:function(e){if(!(this.position>this.length)){for(var t="",r=this.position;r<this.position+e;r++){var n=this.bytes[r];if(0===n)break;t+=String.fromCharCode(n)}return this.position+=e,this.bitPos=0,t}}},{key:"readInt",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"be";if(!(this.position>this.length)){var r=0;if("be"===t)for(var n=this.position;n<this.position+e;n++)r<<=8,r|=this.bytes[n];else for(var i=this.position+e-1;i>=this.position;i--)r<<=8,r|=this.bytes[i];return this.position+=e,this.bitPos=0,r}}},{key:"readBits",value:function(e){if(!(this.position>this.length)){var t=0,r=0;for(t=(this.bytes[this.position++]&256-(1<<this.bitPos))>>>this.bitPos,r=8-this.bitPos,this.bitPos=0;r<e;)t|=this.bytes[this.position++]<<r,r+=8;if(r>e){var n=r-e;t&=(1<<e)-1,r-=n,this.position--,this.bitPos=8-n}return t}}},{key:"continueUntil",value:function(e){if(!(this.position>this.length))if(this.bitPos=0,"number"!=typeof e){var t=e.length,r=e[t-1];this.position=t;for(var n=function(e,t){var r=new Array;return e.forEach((function(e,n){r[e]=t-n})),r}(e,t),i=!0;this.position<this.length;){for(;this.position<this.length&&this.bytes[this.position++]!==r;);i=!0;for(var o=t-1;o>=0;o--)if(this.bytes[this.position-t+o]!==e[o]){i=!1,this.position+=n[e[o]];break}if(i){this.position-=t;break}}}else for(;++this.position<this.length&&this.bytes[this.position]!==e;);}},{key:"consumeWhile",value:function(e){for(;this.position<this.length&&this.bytes[this.position]===e;)this.position++;this.bitPos=0}},{key:"consumeIf",value:function(e){this.bytes[this.position]===e&&(this.position++,this.bitPos=0)}},{key:"moveForwardsBy",value:function(e){var t=this.position+e;if(t<0||t>this.length)throw new Error("Cannot move to position "+t+" in stream. Out of bounds.");this.position=t,this.bitPos=0}},{key:"moveBackwardsBy",value:function(e){var t=this.position-e;if(t<0||t>this.length)throw new Error("Cannot move to position "+t+" in stream. Out of bounds.");this.position=t,this.bitPos=0}},{key:"moveBackwardsByBits",value:function(e){if(e<=this.bitPos)this.bitPos-=e;else for(this.bitPos>0&&(e-=this.bitPos,this.bitPos=0);e>0;)this.moveBackwardsBy(1),this.bitPos=8,this.moveBackwardsByBits(e),e-=8}},{key:"moveTo",value:function(e){if(e<0||e>this.length)throw new Error("Cannot move to position "+e+" in stream. Out of bounds.");this.position=e,this.bitPos=0}},{key:"hasMore",value:function(){return this.position<this.length}},{key:"carve",value:function(){return this.bitPos>0&&this.position++,this.bytes.slice(0,this.position)}}]),e}()},74:function(e,t,r){"use strict";var n,i="object"==typeof Reflect?Reflect:null,o=i&&"function"==typeof i.apply?i.apply:function(e,t,r){return Function.prototype.apply.call(e,t,r)};n=i&&"function"==typeof i.ownKeys?i.ownKeys:Object.getOwnPropertySymbols?function(e){return Object.getOwnPropertyNames(e).concat(Object.getOwnPropertySymbols(e))}:function(e){return Object.getOwnPropertyNames(e)};var s=Number.isNaN||function(e){return e!=e};function a(){a.init.call(this)}e.exports=a,a.EventEmitter=a,a.prototype._events=void 0,a.prototype._eventsCount=0,a.prototype._maxListeners=void 0;var u=10;function c(e){return void 0===e._maxListeners?a.defaultMaxListeners:e._maxListeners}function f(e,t,r,n){var i,o,s,a;if("function"!=typeof r)throw new TypeError('The "listener" argument must be of type Function. Received type '+typeof r);if(void 0===(o=e._events)?(o=e._events=Object.create(null),e._eventsCount=0):(void 0!==o.newListener&&(e.emit("newListener",t,r.listener?r.listener:r),o=e._events),s=o[t]),void 0===s)s=o[t]=r,++e._eventsCount;else if("function"==typeof s?s=o[t]=n?[r,s]:[s,r]:n?s.unshift(r):s.push(r),(i=c(e))>0&&s.length>i&&!s.warned){s.warned=!0;var u=new Error("Possible EventEmitter memory leak detected. "+s.length+" "+String(t)+" listeners added. Use emitter.setMaxListeners() to increase limit");u.name="MaxListenersExceededWarning",u.emitter=e,u.type=t,u.count=s.length,a=u,console&&console.warn&&console.warn(a)}return e}function l(){for(var e=[],t=0;t<arguments.length;t++)e.push(arguments[t]);this.fired||(this.target.removeListener(this.type,this.wrapFn),this.fired=!0,o(this.listener,this.target,e))}function h(e,t,r){var n={fired:!1,wrapFn:void 0,target:e,type:t,listener:r},i=l.bind(n);return i.listener=r,n.wrapFn=i,i}function p(e,t,r){var n=e._events;if(void 0===n)return[];var i=n[t];return void 0===i?[]:"function"==typeof i?r?[i.listener||i]:[i]:r?function(e){for(var t=new Array(e.length),r=0;r<t.length;++r)t[r]=e[r].listener||e[r];return t}(i):y(i,i.length)}function d(e){var t=this._events;if(void 0!==t){var r=t[e];if("function"==typeof r)return 1;if(void 0!==r)return r.length}return 0}function y(e,t){for(var r=new Array(t),n=0;n<t;++n)r[n]=e[n];return r}Object.defineProperty(a,"defaultMaxListeners",{enumerable:!0,get:function(){return u},set:function(e){if("number"!=typeof e||e<0||s(e))throw new RangeError('The value of "defaultMaxListeners" is out of range. It must be a non-negative number. Received '+e+".");u=e}}),a.init=function(){void 0!==this._events&&this._events!==Object.getPrototypeOf(this)._events||(this._events=Object.create(null),this._eventsCount=0),this._maxListeners=this._maxListeners||void 0},a.prototype.setMaxListeners=function(e){if("number"!=typeof e||e<0||s(e))throw new RangeError('The value of "n" is out of range. It must be a non-negative number. Received '+e+".");return this._maxListeners=e,this},a.prototype.getMaxListeners=function(){return c(this)},a.prototype.emit=function(e){for(var t=[],r=1;r<arguments.length;r++)t.push(arguments[r]);var n="error"===e,i=this._events;if(void 0!==i)n=n&&void 0===i.error;else if(!n)return!1;if(n){var s;if(t.length>0&&(s=t[0]),s instanceof Error)throw s;var a=new Error("Unhandled error."+(s?" ("+s.message+")":""));throw a.context=s,a}var u=i[e];if(void 0===u)return!1;if("function"==typeof u)o(u,this,t);else{var c=u.length,f=y(u,c);for(r=0;r<c;++r)o(f[r],this,t)}return!0},a.prototype.addListener=function(e,t){return f(this,e,t,!1)},a.prototype.on=a.prototype.addListener,a.prototype.prependListener=function(e,t){return f(this,e,t,!0)},a.prototype.once=function(e,t){if("function"!=typeof t)throw new TypeError('The "listener" argument must be of type Function. Received type '+typeof t);return this.on(e,h(this,e,t)),this},a.prototype.prependOnceListener=function(e,t){if("function"!=typeof t)throw new TypeError('The "listener" argument must be of type Function. Received type '+typeof t);return this.prependListener(e,h(this,e,t)),this},a.prototype.removeListener=function(e,t){var r,n,i,o,s;if("function"!=typeof t)throw new TypeError('The "listener" argument must be of type Function. Received type '+typeof t);if(void 0===(n=this._events))return this;if(void 0===(r=n[e]))return this;if(r===t||r.listener===t)0==--this._eventsCount?this._events=Object.create(null):(delete n[e],n.removeListener&&this.emit("removeListener",e,r.listener||t));else if("function"!=typeof r){for(i=-1,o=r.length-1;o>=0;o--)if(r[o]===t||r[o].listener===t){s=r[o].listener,i=o;break}if(i<0)return this;0===i?r.shift():function(e,t){for(;t+1<e.length;t++)e[t]=e[t+1];e.pop()}(r,i),1===r.length&&(n[e]=r[0]),void 0!==n.removeListener&&this.emit("removeListener",e,s||t)}return this},a.prototype.off=a.prototype.removeListener,a.prototype.removeAllListeners=function(e){var t,r,n;if(void 0===(r=this._events))return this;if(void 0===r.removeListener)return 0===arguments.length?(this._events=Object.create(null),this._eventsCount=0):void 0!==r[e]&&(0==--this._eventsCount?this._events=Object.create(null):delete r[e]),this;if(0===arguments.length){var i,o=Object.keys(r);for(n=0;n<o.length;++n)"removeListener"!==(i=o[n])&&this.removeAllListeners(i);return this.removeAllListeners("removeListener"),this._events=Object.create(null),this._eventsCount=0,this}if("function"==typeof(t=r[e]))this.removeListener(e,t);else if(void 0!==t)for(n=t.length-1;n>=0;n--)this.removeListener(e,t[n]);return this},a.prototype.listeners=function(e){return p(this,e,!0)},a.prototype.rawListeners=function(e){return p(this,e,!1)},a.listenerCount=function(e,t){return"function"==typeof e.listenerCount?e.listenerCount(t):d.call(e,t)},a.prototype.listenerCount=d,a.prototype.eventNames=function(){return this._eventsCount>0?n(this._events):[]}},786:function(e,t,r){"use strict";var n=r(1382),i=r(1388),o=r(243),s=r(68),a=r(64);function u(e,t){s.Readable.call(this),t=t||{},this._batchSize=t.batchSize||65536,this._blob=e,this._pos=0}function c(){s.Transform.call(this,{readableObjectMode:!0}),this._bufs=[]}a.inherits(u,s.Readable),u.prototype._read=function(){var e=this._pos;if(e>=this._blob.size)this.push(null);else{this._pos+=this._batchSize;var t=this._blob.slice(e,this._pos,this._blob.type),r=new FileReader,n=this;r.addEventListener("loadend",(function e(t){r.removeEventListener("loadend",e,!1),t.error?n.emit("error",t.error):n.push(o.bufferFrom(r.result))}),!1),r.readAsArrayBuffer(t)}},a.inherits(c,s.Transform),c.prototype._transform=function(e,t,r){this._bufs.push(e),r()},c.prototype._flush=function(e){this.push(new Blob(this._bufs,{type:"application/octet-binary"})),e()},e.exports={createBlobDecoder:function(e,t){return new u(e).pipe(new i.streams.BlockDecoder(t))},createBlobEncoder:function(e,t){var r=new i.streams.BlockEncoder(e,t),n=new c;return r.pipe(n),new s.Duplex({objectMode:!0,read:function(){var e=n.read();e?r(e):n.once("readable",r);var t=this;function r(e){t.push(e||n.read()),t.push(null)}},write:function(e,t,n){return r.write(e,t,n)}}).on("finish",(function(){r.end()}))},streams:i.streams},o.copyOwnProperties(n,e.exports)},787:function(e,t,r){"use strict";(function(e){var n=r(1),i=r.n(n),o=r(2),s=r.n(o),a=r(4),u=r.n(a),c=r(3),f=r.n(c),l=r(5),h=r.n(l),p=r(9),d=r(413),y=r.n(d),m=r(8),g=function(t){function r(){var e;return i()(this,r),(e=u()(this,f()(r).call(this))).name="BSON deserialise",e.module="Serialise",e.description="BSON is a computer data interchange format used mainly as a data storage and network transfer format in the MongoDB database. It is a binary form for representing simple data structures, associative arrays (called objects or documents in MongoDB), and various data types of specific interest to MongoDB. The name 'BSON' is based on the term JSON and stands for 'Binary JSON'.<br><br>Input data should be in a raw bytes format.",e.infoURL="https://wikipedia.org/wiki/BSON",e.inputType="ArrayBuffer",e.outputType="string",e.args=[],e}return h()(r,t),s()(r,[{key:"run",value:function(t,r){if(!t.byteLength)return"";try{var n=y.a.deserialize(new e(t));return JSON.stringify(n,null,2)}catch(e){throw new m.a(e.toString())}}}]),r}(p.a);t.a=g}).call(this,r(11).Buffer)},8:function(e,t,r){"use strict";var n=r(1),i=r.n(n),o=r(4),s=r.n(o),a=r(3),u=r.n(a),c=r(22),f=r.n(c),l=r(5),h=r.n(l);
/**
 * Custom error type for handling operation input errors.
 * i.e. where the operation can handle the error and print a message to the screen.
 *
 * @author d98762625 [d98762625@gmail.com]
 * @copyright Crown Copyright 2018
 * @license Apache-2.0
 */
var p=function(e){function t(){var e;i()(this,t);for(var r=arguments.length,n=new Array(r),o=0;o<r;o++)n[o]=arguments[o];return(e=s()(this,u()(t).call(this,...n))).type="OperationError",Error.captureStackTrace&&Error.captureStackTrace(f()(e),t),e}return h()(t,e),t}(function(e){function t(){var t=Reflect.construct(e,Array.from(arguments));return Object.setPrototypeOf(t,Object.getPrototypeOf(this)),t}return t.prototype=Object.create(e.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),Object.setPrototypeOf?Object.setPrototypeOf(t,e):t.__proto__=e,t}(Error));t.a=p},80:function(e,t,r){(t=e.exports=r(100)).Stream=t,t.Readable=t,t.Writable=r(81),t.Duplex=r(47),t.Transform=r(103),t.PassThrough=r(151)},81:function(e,t,r){"use strict";(function(t){var n=r(63);function i(e){var t=this;this.next=null,this.entry=null,this.finish=function(){!function(e,t,r){var n=e.entry;e.entry=null;for(;n;){var i=n.callback;t.pendingcb--,i(r),n=n.next}t.corkedRequestsFree?t.corkedRequestsFree.next=e:t.corkedRequestsFree=e}(t,e)}}e.exports=m;var o,s=n.nextTick;m.WritableState=y;var a=r(56);a.inherits=r(17);var u={deprecate:r(149)},c=r(101),f=r(21).Buffer,l=t.Uint8Array||function(){};var h,p=r(102);function d(){}function y(e,t){o=o||r(47),e=e||{};var a=t instanceof o;this.objectMode=!!e.objectMode,a&&(this.objectMode=this.objectMode||!!e.writableObjectMode);var u=e.highWaterMark,c=e.writableHighWaterMark,f=this.objectMode?16:16384;this.highWaterMark=u||0===u?u:a&&(c||0===c)?c:f,this.highWaterMark=Math.floor(this.highWaterMark),this.finalCalled=!1,this.needDrain=!1,this.ending=!1,this.ended=!1,this.finished=!1,this.destroyed=!1;var l=!1===e.decodeStrings;this.decodeStrings=!l,this.defaultEncoding=e.defaultEncoding||"utf8",this.length=0,this.writing=!1,this.corked=0,this.sync=!0,this.bufferProcessing=!1,this.onwrite=function(e){!function(e,t){var r=e._writableState,i=r.sync,o=r.writecb;if(function(e){e.writing=!1,e.writecb=null,e.length-=e.writelen,e.writelen=0}(r),t)!function(e,t,r,i,o){--t.pendingcb,r?(n.nextTick(o,i),n.nextTick(E,e,t),e._writableState.errorEmitted=!0,e.emit("error",i)):(o(i),e._writableState.errorEmitted=!0,e.emit("error",i),E(e,t))}(e,r,i,t,o);else{var a=b(r);a||r.corked||r.bufferProcessing||!r.bufferedRequest||v(e,r),i?s(_,e,r,a,o):_(e,r,a,o)}}(t,e)},this.writecb=null,this.writelen=0,this.bufferedRequest=null,this.lastBufferedRequest=null,this.pendingcb=0,this.prefinished=!1,this.errorEmitted=!1,this.bufferedRequestCount=0,this.corkedRequestsFree=new i(this)}function m(e){if(o=o||r(47),!(h.call(m,this)||this instanceof o))return new m(e);this._writableState=new y(e,this),this.writable=!0,e&&("function"==typeof e.write&&(this._write=e.write),"function"==typeof e.writev&&(this._writev=e.writev),"function"==typeof e.destroy&&(this._destroy=e.destroy),"function"==typeof e.final&&(this._final=e.final)),c.call(this)}function g(e,t,r,n,i,o,s){t.writelen=n,t.writecb=s,t.writing=!0,t.sync=!0,r?e._writev(i,t.onwrite):e._write(i,o,t.onwrite),t.sync=!1}function _(e,t,r,n){r||function(e,t){0===t.length&&t.needDrain&&(t.needDrain=!1,e.emit("drain"))}(e,t),t.pendingcb--,n(),E(e,t)}function v(e,t){t.bufferProcessing=!0;var r=t.bufferedRequest;if(e._writev&&r&&r.next){var n=t.bufferedRequestCount,o=new Array(n),s=t.corkedRequestsFree;s.entry=r;for(var a=0,u=!0;r;)o[a]=r,r.isBuf||(u=!1),r=r.next,a+=1;o.allBuffers=u,g(e,t,!0,t.length,o,"",s.finish),t.pendingcb++,t.lastBufferedRequest=null,s.next?(t.corkedRequestsFree=s.next,s.next=null):t.corkedRequestsFree=new i(t),t.bufferedRequestCount=0}else{for(;r;){var c=r.chunk,f=r.encoding,l=r.callback;if(g(e,t,!1,t.objectMode?1:c.length,c,f,l),r=r.next,t.bufferedRequestCount--,t.writing)break}null===r&&(t.lastBufferedRequest=null)}t.bufferedRequest=r,t.bufferProcessing=!1}function b(e){return e.ending&&0===e.length&&null===e.bufferedRequest&&!e.finished&&!e.writing}function w(e,t){e._final((function(r){t.pendingcb--,r&&e.emit("error",r),t.prefinished=!0,e.emit("prefinish"),E(e,t)}))}function E(e,t){var r=b(t);return r&&(!function(e,t){t.prefinished||t.finalCalled||("function"==typeof e._final?(t.pendingcb++,t.finalCalled=!0,n.nextTick(w,e,t)):(t.prefinished=!0,e.emit("prefinish")))}(e,t),0===t.pendingcb&&(t.finished=!0,e.emit("finish"))),r}a.inherits(m,c),y.prototype.getBuffer=function(){for(var e=this.bufferedRequest,t=[];e;)t.push(e),e=e.next;return t},function(){try{Object.defineProperty(y.prototype,"buffer",{get:u.deprecate((function(){return this.getBuffer()}),"_writableState.buffer is deprecated. Use _writableState.getBuffer instead.","DEP0003")})}catch(e){}}(),"function"==typeof Symbol&&Symbol.hasInstance&&"function"==typeof Function.prototype[Symbol.hasInstance]?(h=Function.prototype[Symbol.hasInstance],Object.defineProperty(m,Symbol.hasInstance,{value:function(e){return!!h.call(this,e)||this===m&&(e&&e._writableState instanceof y)}})):h=function(e){return e instanceof this},m.prototype.pipe=function(){this.emit("error",new Error("Cannot pipe, not readable"))},m.prototype.write=function(e,t,r){var i,o=this._writableState,s=!1,a=!o.objectMode&&(i=e,f.isBuffer(i)||i instanceof l);return a&&!f.isBuffer(e)&&(e=function(e){return f.from(e)}(e)),"function"==typeof t&&(r=t,t=null),a?t="buffer":t||(t=o.defaultEncoding),"function"!=typeof r&&(r=d),o.ended?function(e,t){var r=new Error("write after end");e.emit("error",r),n.nextTick(t,r)}(this,r):(a||function(e,t,r,i){var o=!0,s=!1;return null===r?s=new TypeError("May not write null values to stream"):"string"==typeof r||void 0===r||t.objectMode||(s=new TypeError("Invalid non-string/buffer chunk")),s&&(e.emit("error",s),n.nextTick(i,s),o=!1),o}(this,o,e,r))&&(o.pendingcb++,s=function(e,t,r,n,i,o){if(!r){var s=function(e,t,r){e.objectMode||!1===e.decodeStrings||"string"!=typeof t||(t=f.from(t,r));return t}(t,n,i);n!==s&&(r=!0,i="buffer",n=s)}var a=t.objectMode?1:n.length;t.length+=a;var u=t.length<t.highWaterMark;u||(t.needDrain=!0);if(t.writing||t.corked){var c=t.lastBufferedRequest;t.lastBufferedRequest={chunk:n,encoding:i,isBuf:r,callback:o,next:null},c?c.next=t.lastBufferedRequest:t.bufferedRequest=t.lastBufferedRequest,t.bufferedRequestCount+=1}else g(e,t,!1,a,n,i,o);return u}(this,o,a,e,t,r)),s},m.prototype.cork=function(){this._writableState.corked++},m.prototype.uncork=function(){var e=this._writableState;e.corked&&(e.corked--,e.writing||e.corked||e.finished||e.bufferProcessing||!e.bufferedRequest||v(this,e))},m.prototype.setDefaultEncoding=function(e){if("string"==typeof e&&(e=e.toLowerCase()),!(["hex","utf8","utf-8","ascii","binary","base64","ucs2","ucs-2","utf16le","utf-16le","raw"].indexOf((e+"").toLowerCase())>-1))throw new TypeError("Unknown encoding: "+e);return this._writableState.defaultEncoding=e,this},Object.defineProperty(m.prototype,"writableHighWaterMark",{enumerable:!1,get:function(){return this._writableState.highWaterMark}}),m.prototype._write=function(e,t,r){r(new Error("_write() is not implemented"))},m.prototype._writev=null,m.prototype.end=function(e,t,r){var i=this._writableState;"function"==typeof e?(r=e,e=null,t=null):"function"==typeof t&&(r=t,t=null),null!=e&&this.write(e,t),i.corked&&(i.corked=1,this.uncork()),i.ending||i.finished||function(e,t,r){t.ending=!0,E(e,t),r&&(t.finished?n.nextTick(r):e.once("finish",r));t.ended=!0,e.writable=!1}(this,i,r)},Object.defineProperty(m.prototype,"destroyed",{get:function(){return void 0!==this._writableState&&this._writableState.destroyed},set:function(e){this._writableState&&(this._writableState.destroyed=e)}}),m.prototype.destroy=p.destroy,m.prototype._undestroy=p.undestroy,m.prototype._destroy=function(e,t){this.end(),t(e)}}).call(this,r(26))},86:function(e,t,r){"use strict";var n=r(150).Buffer,i=n.isEncoding||function(e){switch((e=""+e)&&e.toLowerCase()){case"hex":case"utf8":case"utf-8":case"ascii":case"binary":case"base64":case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":case"raw":return!0;default:return!1}};function o(e){var t;switch(this.encoding=function(e){var t=function(e){if(!e)return"utf8";for(var t;;)switch(e){case"utf8":case"utf-8":return"utf8";case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return"utf16le";case"latin1":case"binary":return"latin1";case"base64":case"ascii":case"hex":return e;default:if(t)return;e=(""+e).toLowerCase(),t=!0}}(e);if("string"!=typeof t&&(n.isEncoding===i||!i(e)))throw new Error("Unknown encoding: "+e);return t||e}(e),this.encoding){case"utf16le":this.text=u,this.end=c,t=4;break;case"utf8":this.fillLast=a,t=4;break;case"base64":this.text=f,this.end=l,t=3;break;default:return this.write=h,void(this.end=p)}this.lastNeed=0,this.lastTotal=0,this.lastChar=n.allocUnsafe(t)}function s(e){return e<=127?0:e>>5==6?2:e>>4==14?3:e>>3==30?4:e>>6==2?-1:-2}function a(e){var t=this.lastTotal-this.lastNeed,r=function(e,t,r){if(128!=(192&t[0]))return e.lastNeed=0,"�";if(e.lastNeed>1&&t.length>1){if(128!=(192&t[1]))return e.lastNeed=1,"�";if(e.lastNeed>2&&t.length>2&&128!=(192&t[2]))return e.lastNeed=2,"�"}}(this,e);return void 0!==r?r:this.lastNeed<=e.length?(e.copy(this.lastChar,t,0,this.lastNeed),this.lastChar.toString(this.encoding,0,this.lastTotal)):(e.copy(this.lastChar,t,0,e.length),void(this.lastNeed-=e.length))}function u(e,t){if((e.length-t)%2==0){var r=e.toString("utf16le",t);if(r){var n=r.charCodeAt(r.length-1);if(n>=55296&&n<=56319)return this.lastNeed=2,this.lastTotal=4,this.lastChar[0]=e[e.length-2],this.lastChar[1]=e[e.length-1],r.slice(0,-1)}return r}return this.lastNeed=1,this.lastTotal=2,this.lastChar[0]=e[e.length-1],e.toString("utf16le",t,e.length-1)}function c(e){var t=e&&e.length?this.write(e):"";if(this.lastNeed){var r=this.lastTotal-this.lastNeed;return t+this.lastChar.toString("utf16le",0,r)}return t}function f(e,t){var r=(e.length-t)%3;return 0===r?e.toString("base64",t):(this.lastNeed=3-r,this.lastTotal=3,1===r?this.lastChar[0]=e[e.length-1]:(this.lastChar[0]=e[e.length-2],this.lastChar[1]=e[e.length-1]),e.toString("base64",t,e.length-r))}function l(e){var t=e&&e.length?this.write(e):"";return this.lastNeed?t+this.lastChar.toString("base64",0,3-this.lastNeed):t}function h(e){return e.toString(this.encoding)}function p(e){return e&&e.length?this.write(e):""}t.StringDecoder=o,o.prototype.write=function(e){if(0===e.length)return"";var t,r;if(this.lastNeed){if(void 0===(t=this.fillLast(e)))return"";r=this.lastNeed,this.lastNeed=0}else r=0;return r<e.length?t?t+this.text(e,r):this.text(e,r):t||""},o.prototype.end=function(e){var t=e&&e.length?this.write(e):"";return this.lastNeed?t+"�":t},o.prototype.text=function(e,t){var r=function(e,t,r){var n=t.length-1;if(n<r)return 0;var i=s(t[n]);if(i>=0)return i>0&&(e.lastNeed=i-1),i;if(--n<r||-2===i)return 0;if((i=s(t[n]))>=0)return i>0&&(e.lastNeed=i-2),i;if(--n<r||-2===i)return 0;if((i=s(t[n]))>=0)return i>0&&(2===i?i=0:e.lastNeed=i-3),i;return 0}(this,e,t);if(!this.lastNeed)return e.toString("utf8",t);this.lastTotal=r;var n=e.length-(r-this.lastNeed);return e.copy(this.lastChar,0,n),e.toString("utf8",t,n)},o.prototype.fillLast=function(e){if(this.lastNeed<=e.length)return e.copy(this.lastChar,this.lastTotal-this.lastNeed,0,this.lastNeed),this.lastChar.toString(this.encoding,0,this.lastTotal);e.copy(this.lastChar,this.lastTotal-this.lastNeed,0,e.length),this.lastNeed-=e.length}},9:function(e,t,r){"use strict";var n=r(1),i=r.n(n),o=r(2),s=r.n(o),a=r(13),u=r(0),c=r(16),f=function(){function e(t){i()(this,e),this.name="",this.type="",this._value=null,this.disabled=!1,this.hint="",this.rows=0,this.toggleValues=[],this.target=null,this.defaultIndex=0,this.min=null,this.max=null,this.step=1,t&&this._parseConfig(t)}return s()(e,[{key:"_parseConfig",value:function(e){this.name=e.name,this.type=e.type,this.defaultValue=e.value,this.disabled=!!e.disabled,this.hint=e.hint||!1,this.rows=e.rows||!1,this.toggleValues=e.toggleValues,this.target=void 0!==e.target?e.target:null,this.defaultIndex=void 0!==e.defaultIndex?e.defaultIndex:0,this.min=e.min,this.max=e.max,this.step=e.step}},{key:"config",get:function(){return this._value}},{key:"value",set:function(t){this._value=e.prepare(t,this.type)},get:function(){return this._value}}],[{key:"prepare",value:function(e,t){var r;switch(t){case"binaryString":case"binaryShortString":case"editableOption":case"editableOptionShort":return u.b.parseEscapedChars(e);case"byteArray":return"string"==typeof e?(e=e.replace(/\s+/g,""),Object(c.a)(e)):e;case"number":if(null===e)return e;if(r=parseFloat(e),isNaN(r))throw"Invalid ingredient value. Not a number: "+u.b.truncate(e.toString(),10);return r;default:return e}}}]),e}(),l=function(){function e(){i()(this,e),this._inputType=-1,this._outputType=-1,this._presentType=-1,this._breakpoint=!1,this._disabled=!1,this._flowControl=!1,this._manualBake=!1,this._ingList=[],this.name="",this.module="",this.description="",this.infoURL=null}return s()(e,[{key:"run",value:function(e,t){return e}},{key:"highlight",value:function(e,t){return!1}},{key:"highlightReverse",value:function(e,t){return!1}},{key:"present",value:function(e,t){return e}},{key:"addIngredient",value:function(e){this._ingList.push(e)}},{key:"inputType",set:function(e){this._inputType=a.a.typeEnum(e)},get:function(){return a.a.enumLookup(this._inputType)}},{key:"outputType",set:function(e){this._outputType=a.a.typeEnum(e),this._presentType<0&&(this._presentType=this._outputType)},get:function(){return a.a.enumLookup(this._outputType)}},{key:"presentType",set:function(e){this._presentType=a.a.typeEnum(e)},get:function(){return a.a.enumLookup(this._presentType)}},{key:"args",set:function(e){var t=this;e.forEach((function(e){var r=new f(e);t.addIngredient(r)}))},get:function(){return this._ingList.map((function(e){var t={name:e.name,type:e.type,value:e.defaultValue};return e.toggleValues&&(t.toggleValues=e.toggleValues),e.hint&&(t.hint=e.hint),e.rows&&(t.rows=e.rows),e.disabled&&(t.disabled=e.disabled),e.target&&(t.target=e.target),e.defaultIndex&&(t.defaultIndex=e.defaultIndex),"number"==typeof e.min&&(t.min=e.min),"number"==typeof e.max&&(t.max=e.max),e.step&&(t.step=e.step),t}))}},{key:"config",get:function(){return{op:this.name,args:this._ingList.map((function(e){return e.config}))}}},{key:"ingValues",set:function(e){var t=this;e.forEach((function(e,r){t._ingList[r].value=e}))},get:function(){return this._ingList.map((function(e){return e.value}))}},{key:"breakpoint",set:function(e){this._breakpoint=!!e},get:function(){return this._breakpoint}},{key:"disabled",set:function(e){this._disabled=!!e},get:function(){return this._disabled}},{key:"flowControl",get:function(){return this._flowControl},set:function(e){this._flowControl=!!e}},{key:"manualBake",get:function(){return this._manualBake},set:function(e){this._manualBake=!!e}}]),e}();t.a=l}});