/**
 * 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=1489)}({0:function(e,t,r){"use strict";(function(e,n,i){r.d(t,"c",(function(){return b})),r.d(t,"d",(function(){return E})),r.d(t,"e",(function(){return B})),r.d(t,"a",(function(){return S}));var o=r(8),a=r.n(o),s=r(11),u=r.n(s),c=r(1),f=r.n(c),l=r(2),h=r.n(l),p=r(24),d=r.n(p),y=r(16),m=r(20),g=r(30),_=r(29),v=function(){function t(){f()(this,t)}var r;return h()(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];w()&&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]),a=i;a<=o;a++)r.push(t.chr(a));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(_.a)(e);case"hex":return Object(m.a)(e);case"decimal":return Object(g.a)(e);case"base64":return Object(y.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(_.a)(e));case"hex":return t.byteArrayToChars(Object(m.a)(e));case"decimal":return t.byteArrayToChars(Object(g.a)(e));case"base64":return t.byteArrayToChars(Object(y.a)(e,null,"byteArray"));case"utf8":return d.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=d.a.encode(e);return e.length!==r.length&&(E()?self.setOption("attemptHighlight",!1):w()&&(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=d.a.encode(e);return e.length!==r.length&&(E()?self.setOption("attemptHighlight",!1):w()&&(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=d.a.decode(r);return r.length!==n.length&&(E()?self.setOption("attemptHighlight",!1):w()&&(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,a=!1,s="",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?(s+=t,o=!1):'"'!==t||a?'"'===t&&a?'"'===r?o=!0:a=!1:!a&&n.indexOf(t)>=0?(u.push(s),s=""):!a&&i.indexOf(t)>=0?(u.push(s),s="",c.push(u),u=[],i.indexOf(r)>=0&&r!==t&&f++):s+=t:a=!0;return u.length&&(u.push(s),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="",a="";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":"",a=e.breakpoint?"/breakpoint":"",r+=`${n}(${i}${o}${a})`,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:(r=u()(a.a.mark((function e(r){var n,i,o,s,c;return a.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:n=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>`},i=function(e,r){if(r.startsWith("image")){var n="data:";return n+=r+";","<img style='max-width: 100%;' src='"+(n+="base64,"+Object(y.b)(e))+"'>"}return`<pre>${t.escapeHtml(t.arrayBufferToStr(e.buffer))}</pre>`},o=function(){var e=u()(a.a.mark((function e(r,n){var o,s,u,c;return a.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,t.readFile(r);case 2:return o=e.sent,s=new Blob([o],{type:r.type||"octet/stream"}),u=URL.createObjectURL(s),c=`<div class='card' style='white-space: normal;'>\n                    <div class='card-header' id='heading${n}'>\n                        <h6 class='mb-0'>\n                            <a class='collapsed'\n                                data-toggle='collapse'\n                                href='#collapse${n}'\n                                aria-expanded='false'\n                                aria-controls='collapse${n}'\n                                title="Show/hide contents of '${t.escapeHtml(r.name)}'">\n                                ${t.escapeHtml(r.name)}</a>\n                            <span class='float-right' style="margin-top: -3px">\n                                ${r.size.toLocaleString()} bytes\n                                <a title="Download ${t.escapeHtml(r.name)}"\n                                    href="${u}"\n                                    download="${t.escapeHtml(r.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="${u}"\n                                    file-name="${t.escapeHtml(r.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${n}' class='collapse' aria-labelledby='heading${n}' data-parent="#files">\n                        <div class='card-body'>\n                            ${i(o,r.type)}\n                        </div>\n                    </div>\n                </div>`,e.abrupt("return",c);case 7:case"end":return e.stop()}}),e)})));return function(t,r){return e.apply(this,arguments)}}(),s=`<div style='padding: 5px; white-space: normal;'>\n                ${r.length} file(s) found\n            </div><div id="files" style="padding: 20px">`,c=0;case 5:if(!(c<r.length)){e.next=17;break}if(!r[c].name.endsWith("/")){e.next=10;break}s+=n(r[c]),e.next=14;break;case 10:return e.t0=s,e.next=13,o(r[c],c);case 13:s=e.t0+=e.sent;case 14:c++,e.next=5;break;case 17:return e.abrupt("return",s+="</div>");case 18:case"end":return e.stop()}}),e)}))),function(e){return r.apply(this,arguments)})},{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 b()?e.from(t).buffer:new Promise((function(e,r){var n=new FileReader,i=new Uint8Array(t.size),o=0,a=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,a()},n.onerror=function(e){r(n.error.message)},a()}))}},{key:"readFileSync",value:function(e){if(!b())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 with comma":/,?0x/g,"0x":/0x/g,"\\x":/\\x/g,None:/\s+/g}[e]}}]),t}();function b(){return void 0!==n&&null!=n.versions&&null!=n.versions.node}function w(){return"object"==typeof window}function E(){return"function"==typeof importScripts}function B(e){E()?self.sendStatusMessage(e):w()?app.alert(e,1e4):b()&&!i.TESTING&&console.debug(e)}t.b=v,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 A={};function S(e,t,r,n,i){return function(){clearTimeout(A[r]),A[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(12).Buffer,r(27),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")}},11:function(e,t){function r(e,t,r,n,i,o,a){try{var s=e[o](a),u=s.value}catch(e){return void r(e)}s.done?t(u):Promise.resolve(u).then(n,i)}e.exports=function(e){return function(){var t=this,n=arguments;return new Promise((function(i,o){var a=e.apply(t,n);function s(e){r(a,i,o,s,u,"next",e)}function u(e){r(a,i,o,s,u,"throw",e)}s(void 0)}))}}},12: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(47),i=r(48),o=r(40);function a(){return u.TYPED_ARRAY_SUPPORT?2147483647:1073741823}function s(e,t){if(a()<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=s(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=s(e,r)).length||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?s(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=s(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=s(e,r);for(var n=0;n<r;n+=1)e[n]=255&t[n];return e}function p(e){if(e>=a())throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+a().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 U(e).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return 2*r;case"hex":return r>>>1;case"base64":return z(e).length;default:if(n)return U(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 O(this,t,r);case"utf8":case"utf-8":return x(this,t,r);case"ascii":return T(this,t,r);case"latin1":case"binary":return N(this,t,r);case"base64":return S(this,t,r);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return k(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,a=1,s=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;a=2,s/=2,u/=2,r/=2}function c(e,t){return 1===a?e[t]:e.readUInt16BE(t*a)}if(i){var f=-1;for(o=r;o<s;o++)if(c(e,o)===c(t,-1===f?0:o-f)){if(-1===f&&(f=o),o-f+1===u)return f*a}else-1!==f&&(o-=o-f),f=-1}else for(r+u>s&&(r=s-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 a=0;a<n;++a){var s=parseInt(t.substr(2*a,2),16);if(isNaN(s))return a;e[r+a]=s}return a}function b(e,t,r,n){return $(U(t,e.length-r),e,r,n)}function w(e,t,r,n){return $(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 $(z(t),e,r,n)}function A(e,t,r,n){return $(function(e,t){for(var r,n,i,o=[],a=0;a<e.length&&!((t-=2)<0);++a)r=e.charCodeAt(a),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,a,s,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],a=e[i+2],128==(192&o)&&128==(192&a)&&(u=(15&c)<<12|(63&o)<<6|63&a)>2047&&(u<55296||u>57343)&&(f=u);break;case 4:o=e[i+1],a=e[i+2],s=e[i+3],128==(192&o)&&128==(192&a)&&128==(192&s)&&(u=(15&c)<<18|(63&o)<<12|(63&a)<<6|63&s)>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<=4096)return String.fromCharCode.apply(String,e);var r="",n=0;for(;n<t;)r+=String.fromCharCode.apply(String,e.slice(n,n+=4096));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=a(),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?s(e,t):void 0!==r?"string"==typeof n?s(e,t).fill(r,n):s(e,t).fill(r):s(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 a=e[r];if(!u.isBuffer(a))throw new TypeError('"list" argument must be an Array of Buffers');a.copy(n,i),i+=a.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),a=(r>>>=0)-(t>>>=0),s=Math.min(o,a),c=this.slice(n,i),f=e.slice(t,r),l=0;l<s;++l)if(c[l]!==f[l]){o=c[l],a=f[l];break}return o<a?-1:a<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)}};function T(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 N(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 O(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+=M(e[o]);return i}function k(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 I(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 F(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 D(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 R(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 C(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 L(e,t,r,n,o){return o||C(e,0,r,4),i.write(e,t,r,n,23,4),r+4}function j(e,t,r,n,o){return o||C(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||I(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||I(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||I(e,1,this.length),this[e]},u.prototype.readUInt16LE=function(e,t){return t||I(e,2,this.length),this[e]|this[e+1]<<8},u.prototype.readUInt16BE=function(e,t){return t||I(e,2,this.length),this[e]<<8|this[e+1]},u.prototype.readUInt32LE=function(e,t){return t||I(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||I(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||I(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||I(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||I(e,1,this.length),128&this[e]?-1*(255-this[e]+1):this[e]},u.prototype.readInt16LE=function(e,t){t||I(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||I(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||I(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||I(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||I(e,4,this.length),i.read(this,e,!0,23,4)},u.prototype.readFloatBE=function(e,t){return t||I(e,4,this.length),i.read(this,e,!1,23,4)},u.prototype.readDoubleLE=function(e,t){return t||I(e,8,this.length),i.read(this,e,!0,52,8)},u.prototype.readDoubleBE=function(e,t){return t||I(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)||F(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)||F(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||F(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||F(this,e,t,2,65535,0),u.TYPED_ARRAY_SUPPORT?(this[t]=255&e,this[t+1]=e>>>8):D(this,e,t,!0),t+2},u.prototype.writeUInt16BE=function(e,t,r){return e=+e,t|=0,r||F(this,e,t,2,65535,0),u.TYPED_ARRAY_SUPPORT?(this[t]=e>>>8,this[t+1]=255&e):D(this,e,t,!1),t+2},u.prototype.writeUInt32LE=function(e,t,r){return e=+e,t|=0,r||F(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):R(this,e,t,!0),t+4},u.prototype.writeUInt32BE=function(e,t,r){return e=+e,t|=0,r||F(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):R(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);F(this,e,t,r,i-1,-i)}var o=0,a=1,s=0;for(this[t]=255&e;++o<r&&(a*=256);)e<0&&0===s&&0!==this[t+o-1]&&(s=1),this[t+o]=(e/a>>0)-s&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);F(this,e,t,r,i-1,-i)}var o=r-1,a=1,s=0;for(this[t+o]=255&e;--o>=0&&(a*=256);)e<0&&0===s&&0!==this[t+o+1]&&(s=1),this[t+o]=(e/a>>0)-s&255;return t+r},u.prototype.writeInt8=function(e,t,r){return e=+e,t|=0,r||F(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||F(this,e,t,2,32767,-32768),u.TYPED_ARRAY_SUPPORT?(this[t]=255&e,this[t+1]=e>>>8):D(this,e,t,!0),t+2},u.prototype.writeInt16BE=function(e,t,r){return e=+e,t|=0,r||F(this,e,t,2,32767,-32768),u.TYPED_ARRAY_SUPPORT?(this[t]=e>>>8,this[t+1]=255&e):D(this,e,t,!1),t+2},u.prototype.writeInt32LE=function(e,t,r){return e=+e,t|=0,r||F(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):R(this,e,t,!0),t+4},u.prototype.writeInt32BE=function(e,t,r){return e=+e,t|=0,r||F(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):R(this,e,t,!1),t+4},u.prototype.writeFloatLE=function(e,t,r){return L(this,e,t,!0,r)},u.prototype.writeFloatBE=function(e,t,r){return L(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 a=u.isBuffer(e)?e:U(new u(e,n).toString()),s=a.length;for(o=0;o<r-t;++o)this[o+t]=a[o%s]}return this};var P=/[^+\/0-9A-Za-z-_]/g;function M(e){return e<16?"0"+e.toString(16):e.toString(16)}function U(e,t){var r;t=t||1/0;for(var n=e.length,i=null,o=[],a=0;a<n;++a){if((r=e.charCodeAt(a))>55295&&r<57344){if(!i){if(r>56319){(t-=3)>-1&&o.push(239,191,189);continue}if(a+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 z(e){return n.toByteArray(function(e){if((e=function(e){return e.trim?e.trim():e.replace(/^\s+|\s+$/g,"")}(e).replace(P,"")).length<2)return"";for(;e.length%4!=0;)e+="=";return e}(e))}function $(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(25))},121: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,a;for(n=0,t=0,r=e.length;t<r;t++)n+=e[t].length;for(a=new Uint8Array(n),i=0,t=0,r=e.length;t<r;t++)o=e[t],a.set(o,i),i+=o.length;return a}},a={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,a))},t.setTyped(n)},127: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(70),a=Object.prototype.hasOwnProperty,s=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,a){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=(a=a||{actual:[],expected:[]}).actual.indexOf(e);return-1!==u&&u===a.expected.indexOf(t)||(a.actual.push(e),a.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),a=v(t);if(i&&!a||!i&&a)return!1;if(i)return e=s.call(e),t=s.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,a))}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 a="string"==typeof n,s=!e&&i&&!r;if((!e&&o.isError(i)&&a&&b(i,r)||s)&&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 a=n.indexOf("\n",o+1);n=n.substring(a+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)a.call(e,r)&&t.push(r);return t}}).call(this,r(25))},13:function(e,t,r){var n=r(49),i=r(50),o=r(51);e.exports=function(e,t){return n(e)||i(e,t)||o()}},134:function(e,t){},135:function(e,t,r){"use strict";var n=r(76).Buffer,i=r(136);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),a=this.head,s=0;a;)t=a.data,r=o,i=s,t.copy(r,i),s+=a.data.length,a=a.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})},136:function(e,t){},137: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(25))},138:function(e,t,r){var n=r(12),i=n.Buffer;function o(e,t){for(var r in e)t[r]=e[r]}function a(e,t,r){return i(e,t,r)}i.from&&i.alloc&&i.allocUnsafe&&i.allocUnsafeSlow?e.exports=n:(o(n,t),t.Buffer=a),o(i,a),a.from=function(e,t,r){if("number"==typeof e)throw new TypeError("Argument must not be a number");return i(e,t,r)},a.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},a.allocUnsafe=function(e){if("number"!=typeof e)throw new TypeError("Argument must be a number");return i(e)},a.allocUnsafeSlow=function(e){if("number"!=typeof e)throw new TypeError("Argument must be a number");return n.SlowBuffer(e)}},139:function(e,t,r){"use strict";e.exports=o;var n=r(99),i=Object.create(r(53));function o(e){if(!(this instanceof o))return new o(e);n.call(this,e)}i.inherits=r(14),i.inherits(o,n),o.prototype._transform=function(e,t,r){r(null,e)}},14: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}}},140:function(e,t,r){e.exports=r(77)},141:function(e,t,r){e.exports=r(39)},142:function(e,t,r){e.exports=r(75).Transform},143:function(e,t,r){e.exports=r(75).PassThrough},1451:function(e,t,r){"use strict";var n=r(1452),i=r(1454),o=r(1455),a=r(320);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},a.copyOwnProperties(n,e.exports)},1452:function(e,t,r){"use strict";var n=r(506);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}},1453: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=a(r,n=o(n,i,c,r,t[15],22,1236535329),i,c,t[1],5,-165796510),c=a(c,r,n,i,t[6],9,-1069501632),i=a(i,c,r,n,t[11],14,643717713),n=a(n,i,c,r,t[0],20,-373897302),r=a(r,n,i,c,t[5],5,-701558691),c=a(c,r,n,i,t[10],9,38016083),i=a(i,c,r,n,t[15],14,-660478335),n=a(n,i,c,r,t[4],20,-405537848),r=a(r,n,i,c,t[9],5,568446438),c=a(c,r,n,i,t[14],9,-1019803690),i=a(i,c,r,n,t[3],14,-187363961),n=a(n,i,c,r,t[8],20,1163531501),r=a(r,n,i,c,t[13],5,-1444681467),c=a(c,r,n,i,t[2],9,-51403784),i=a(i,c,r,n,t[7],14,1735328473),r=s(r,n=a(n,i,c,r,t[12],20,-1926607734),i,c,t[5],4,-378558),c=s(c,r,n,i,t[8],11,-2022574463),i=s(i,c,r,n,t[11],16,1839030562),n=s(n,i,c,r,t[14],23,-35309556),r=s(r,n,i,c,t[1],4,-1530992060),c=s(c,r,n,i,t[4],11,1272893353),i=s(i,c,r,n,t[7],16,-155497632),n=s(n,i,c,r,t[10],23,-1094730640),r=s(r,n,i,c,t[13],4,681279174),c=s(c,r,n,i,t[0],11,-358537222),i=s(i,c,r,n,t[3],16,-722521979),n=s(n,i,c,r,t[6],23,76029189),r=s(r,n,i,c,t[9],4,-640364487),c=s(c,r,n,i,t[12],11,-421815835),i=s(i,c,r,n,t[15],16,530742520),r=u(r,n=s(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,a,s){return i(t&r|~t&n,e,t,o,a,s)}function a(e,t,r,n,o,a,s){return i(t&n|r&~n,e,t,o,a,s)}function s(e,t,r,n,o,a,s){return i(t^r^n,e,t,o,a,s)}function u(e,t,r,n,o,a,s){return i(r^(t|~n),e,t,o,a,s)}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(12).Buffer)},1454:function(e,t,r){"use strict";(function(t,n){var i=r(506),o=r(320),a=r(69),s=r(64),u=r(70),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=new b("",f.forSchema({name:"PingRequest",type:"record",fields:[]},p),f.forSchema(["string"],p),f.forSchema("null",p));function b(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 w(e,t,r,n,i){if("string"!=typeof e)return w.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 E(e,t){t=t||{},a.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&&Y(this._cache$,t.remoteProtocols,e,!0),this._svc$.messages.forEach((function(e){this[e.name]=this._createMessageHandler$(e)}),this)}function B(e,t){t=t||{},a.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&&Y(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 A(e,t){t=t||{},a.EventEmitter.call(this),this.client=e,this.timeout=o.getOption(t,"timeout",e._timeout$),this._endWritable=!!o.getOption(t,"endWritable",!0),this._prefix=G(t.scope);var r=e._cache$,n=e._svc$,i=t.serverHash;i||(i=n.hash);var s=r[i];s||(s=r[i=n.hash]=new R(n,n,i)),this._adapter=s,this._registry=new D(this,16),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 S(e,t,r){A.call(this,e,r),this._writableFactory=t,r&&r.noPing||(l("emitting ping request"),this.ping())}function x(e,r,i,a){A.call(this,e,a),this._readable=r,this._writable=i,this._connected=!(!a||!a.noPing),this._readable.on("end",d),this._writable.on("finish",y);var s,u=this,c=null;function f(e){if(!u.destroyed){s=u._createHandshakeRequest(u._adapter,!e);var t=[g.toBuffer(s),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=U(_,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",s,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"),s=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 T(e,t){t=t||{},a.EventEmitter.call(this),this.server=e,this._endWritable=!!o.getOption(t,"endWritable",!0),this._prefix=G(t.scope);var r=e._cache,n=e.service,i=n.hash;r[i]||(r[i]=new R(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 N(e,r,i){T.call(this,e,i),this._writable=void 0;var o,a=this;function s(e){var t,r=e.id,i=n.concat(e.payload);try{var o=U(g,i),s=o.head,u=a._getAdapter(s)}catch(e){t=V("INVALID_HANDSHAKE_REQUEST",e)}var c=a._createHandshakeResponse(t,s);function f(e){if(!a.destroyed){if(!a._writable)return void a.once("_writable",(function(){f(e)}));a._writable.write({id:r,payload:[_.toBuffer(c),e]})}a._writable&&a._endWritable&&a._writable.end()}a.emit("handshake",s,c),t?f(a._encodeSystemError(t)):a._receive(o.tail,u,f)}function u(){a.destroy()}function c(e){o.removeListener("data",s).removeListener("end",u),a.destroy(e||!0)}t.nextTick((function(){o=r.call(a,(function(e,r){t.nextTick((function(){e?c(e):(a._writable=r.on("finish",c),a.emit("_writable"))}))})).on("data",s).on("end",u)}))}function O(e,t,r,i){T.call(this,e,i),this._adapter=void 0,this._writable=r.on("finish",c),this._readable=t.on("data",a).on("end",u),this.once("_drain",(function(){this._readable.removeListener("data",a).removeListener("data",s).removeListener("end",u)})).once("eot",(function(){this._writable.removeListener("finish",c),this._endWritable&&this._writable.end()}));var o=this;function a(e){var t=e.id;if(o._matchesPrefix(t)){var r,i=n.concat(e.payload);try{var u=U(g,i),c=u.head;o._adapter=o._getAdapter(c)}catch(e){r=V("INVALID_HANDSHAKE_REQUEST",e)}var f=o._createHandshakeResponse(r,c);o.emit("handshake",c,f),r?l(o._encodeSystemError(r)):(o._readable.removeListener("data",a).on("data",s),o._receive(u.tail,o._adapter,l))}function l(e){o.destroyed||o._writable.write({id:t,payload:[_.toBuffer(f),e]})}}function s(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 k(e,t,r){this._msg=e,this.headers=t||{},this.request=r||{}}function I(e,t,r,n){this._msg=e,this.headers=t,this.error=r,this.response=n}function F(e,t){this.channel=t,this.locals={},this.message=e,Object.freeze(this)}function D(e,t){this._ctx=e,this._mask=-1>>>(0|t),this._id=0,this._n=0,this._cbs={}}function R(e,t,r,n){this._clientSvc=e,this._serverSvc=t,this._hash=r,this._isRemote=!!n,this._readers=$(e,t)}function C(){s.Transform.call(this,{readableObjectMode:!0}),this._id=void 0,this._buf=o.newBuffer(0),this._bufs=[],this.on("finish",(function(){this.push(null)}))}function L(){s.Transform.call(this,{writableObjectMode:!0}),this.on("finish",(function(){this.push(null)}))}function j(){s.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 P(){s.Transform.call(this,{writableObjectMode:!0}),this.on("finish",(function(){this.push(null)}))}function M(e){var t=o.newBuffer(4);return t.writeInt32BE(e),t}function U(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 z(e,t){return e.equals(t)?e:e.createResolver(t)}function $(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+"?"]=z(i.requestType,e.requestType),r[n+"*"]=z(e.errorType,i.errorType),r[n+"!"]=z(e.responseType,i.responseType)}catch(e){throw V("INCOMPATIBLE_PROTOCOL",e)}})),r}function Y(e,t,r,n){Object.keys(t).forEach((function(i){var o,a,s=t[i];n?(o=r,a=w.forProtocol(s)):(o=w.forProtocol(s),a=r),e[i]=new R(o,a,i,!0)}))}function H(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 q(e){return!!e&&"[object Error]"===Object.prototype.toString.call(e)}function Z(e,t){var r=new Error(e);return r.cause=t,r}function V(e,t){var r=Z(e.toLowerCase().replace(/_/g," "),t);return r.rpcCode=t&&t.rpcCode?t.rpcCode:e,r}function J(e,t,r){var n,i,o,a=[];for(n=0,i=r.length;n<i;n++)(o=r[n]).type.isValid(t[o.name],{errorHook:c});var s=a.map((function(e){return h("%s = %j but expected %s",e.path,e.value,e.type)})).join(", "),u=new Error(h("%s (%s)",e,s));return u.details=a,u;function c(e,t,r){var n,i,s,u=[];for(n=0,i=e.length;n<i;n++)s=e[n],isNaN(s)?u.push("."+s):u.push("["+s+"]");a.push({path:o.name+u.join(""),value:t,type:r})}}function G(e){return e?o.getHash(e).readInt16BE(0)<<16:0}function W(e,t){return(e^t)>>16==0}function X(e){return!(!e||!e.pipe)}function K(e,t){var r=e.message(t);if(!r)throw new Error(h("unknown message: %s",t));return r}function Q(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(Z("duplicate backward middleware call",t)):(r=t,n=!0,o())}))}else e.onCompletion.call(e.ctx,r)}!function a(s){var u=!1;s<e.fns.length?e.fns[s].apply(e.ctx,n.concat((function(t,n){if(u)e.onError(Z("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),a(++s)}}))):e.onTransition.apply(e.ctx,n.concat((function(n){u?e.onError(Z("duplicate handler call",n)):(u=!0,r=n,t.nextTick(o))})))}(0)}b.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)),a=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 s=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 b(e,a,f.forSchema(["string"].concat(t.errors||[]),r),s,!!t["one-way"],t.doc)},b.prototype.schema=f.prototype.getSchema,b.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(b,["name","errorType","requestType","responseType"]),b.prototype.isOneWay=u.deprecate((function(){return this.oneWay}),"use `.oneWay` directly instead of `.isOneWay()`"),w.Client=E,w.Server=B,w.compatible=function(e,t){try{$(e,t)}catch(e){return!1}return!0},w.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]=b.forSchema(n,e.messages[n],t)}))),new w(n,r,t.registry,e)},w.isService=function(e){return!!e&&e.hasOwnProperty("_hashStr")},w.prototype.createClient=function(e){var r=new E(this,e);return t.nextTick((function(){if(e&&e.server){var t={objectMode:!0},n=[new s.PassThrough(t),new s.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},w.prototype.createServer=function(e){return new B(this,e)},Object.defineProperty(w.prototype,"hash",{enumerable:!0,get:function(){return o.bufferFrom(this._hashStr,"binary")}}),w.prototype.message=function(e){return this._messagesByName[e]},w.prototype.type=function(e){return this._typesByName[e]},w.prototype.inspect=function(){return h("<Service %j>",this.name)},o.addDeprecatedGetters(w,["message","messages","name","type","types"]),w.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()`"),w.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()`"),w.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 E.prototype.emitMessage.call(i,e,t,n&&n.bind(this)),r.getPending()}),"create a client via `.createClient()` to emit messages instead of `.emit()`"),w.prototype.equals=u.deprecate((function(e){return w.isService(e)&&this.getFingerprint().equals(e.getFingerprint())}),"equality testing is deprecated, compare the `.protocol`s instead"),w.prototype.getFingerprint=u.deprecate((function(e){return o.getHash(JSON.stringify(this.protocol),e)}),"use `.hash` instead of `.getFingerprint()`"),w.prototype.getSchema=u.deprecate(f.prototype.getSchema,"use `.protocol` instead of `.getSchema()`"),w.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()`"),w.prototype.subprotocol=u.deprecate((function(){var e=this._server,t={strictTypes:e._strict,cache:e._cache},r=new B(e.service,t);return r._handlers=Object.create(e._handlers),new w(this.name,this._messagesByName,this._typesByName,this.protocol,r)}),"`.subprotocol()` will be removed in 5.1"),w.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(E,a.EventEmitter),E.prototype.activeChannels=function(){return this._channels$.slice()},E.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,i=e((function(e,n){if(e)t(e);else{var i=(new C).once("error",(function(e){r.destroy(e)}));t(null,n.pipe(i))}}));if(i)return n.pipe(i),n},r=new S(this,i,t)}else{var o,a;if(X(e)?o=a=e:(o=e.readable,a=e.writable),!n){var s=new j;o=o.pipe(s);var u=new P;u.pipe(a),a=u}r=new x(this,o,a,t),n||(r.once("eot",(function(){o.unpipe(s),u.unpipe(a)})),s.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},E.prototype.destroyChannels=function(e){this._channels$.forEach((function(t){t.destroy(e&&e.noWait)}))},E.prototype.emitMessage=function(e,t,r,n){var i=new k(K(this._svc$,e),{},t);this._emitMessage$(i,r,n)},E.prototype.remoteProtocols=function(){return H(this._cache$,!0)},Object.defineProperty(E.prototype,"service",{enumerable:!0,get:function(){return this._svc$}}),E.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},E.prototype._emitMessage$=function(e,r,n){n||"function"!=typeof r||(n=r,r=void 0);var i=this,o=this._channels$,a=o.length;if(a){var s;if(void 0===(r=r||{}).timeout&&(r.timeout=this._timeout$),1===a)s=o[0];else if(this._policy$){if(!(s=this._policy$(this._channels$.slice())))return void l("policy returned no channel, skipping call")}else s=o[Math.floor(Math.random()*a)];s._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 a(e);function a(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))),a(e,t.response)):a()}))}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 F(e._msg),u):i.emit("error",u)}))}},E.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(B,a.EventEmitter),B.prototype.activeChannels=function(){return o.objectValues(this._channels)},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 C).once("error",(function(e){r.destroy(e)}));return e((function(e,r){if(e)t(e);else{var n=new L;n.pipe(r),t(null,n)}})).pipe(n)},r=new N(this,i,t)}else{var o,a;if(X(e)?o=a=e:(o=e.readable,a=e.writable),!n){var s=new j;o=o.pipe(s);var u=new P;u.pipe(a),a=u}r=new O(this,o,a,t),n||(r.once("eot",(function(){o.unpipe(s),u.unpipe(a)})),s.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},B.prototype.onMessage=function(e,t){return K(this.service,e),this._handlers[e]=t,this},B.prototype.remoteProtocols=function(){return H(this._cache,!1)},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._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)()},B.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(A,a.EventEmitter),A.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?q(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)},A.prototype.ping=function(e,t){t||"function"!=typeof e||(t=e,e=void 0);var r=this,n=new k(v);this._emit(n,{timeout:e},(function(e){t?t.call(r,e):e&&r.destroy(e)}))},A.prototype._createHandshakeRequest=function(e,t){var r=this.client._svc$;return{clientHash:r.hash,clientProtocol:t?null:JSON.stringify(r.protocol),serverHash:e._hash}},A.prototype._emit=function(e,r,n){var i=e._msg,o=i.oneWay?void 0:new I(i,{}),a=new F(i,this),s=this;function u(e,t,n){var o,a;if(s.destroyed)o=new Error("channel destroyed");else try{a=e.toBuffer()}catch(t){o=J(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:s.timeout,c=s._registry.add(u,(function(e,r,o){if(!e&&!i.oneWay)try{o._decodeResponse(r,t,i)}catch(t){e=t}n(e)}));c|=s._prefix,l("sending message %s",c),s._send(c,a,!!i&&i.oneWay)}}function c(e){s.pending--,n.call(a,e,o),!s.draining||s.destroyed||s.pending||s.destroy()}function f(e){s.client.emit("error",e,s)}this.pending++,t.nextTick((function(){if(i.name){s.emit("outgoingCall",a,r);var t=s.client._fns$;l("starting client middleware chain (%s middleware)",t.length),Q({fns:t,ctx:a,wreq:e,wres:o,onTransition:u,onCompletion:c,onError:f})}else u(e,o,c)}))},A.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=w.forProtocol(i);return n=new R(this.client._svc$,o,t,!0),r[t]=n},A.prototype._matchesPrefix=function(e){return W(e,this._prefix)},A.prototype._send=o.abstractFunction,o.addDeprecatedGetters(A,["pending","timeout"]),A.prototype.getCache=u.deprecate((function(){return this.client._cache$}),"use `.remoteProtocols()` instead of `.getCache()`"),A.prototype.getProtocol=u.deprecate((function(){return this.client._svc$}),"use `.service` instead or `.getProtocol()`"),A.prototype.isDestroyed=u.deprecate((function(){return this.destroyed}),"use `.destroyed` instead of `.isDestroyed`"),u.inherits(S,A),S.prototype._send=function(e,r){var i=this._registry.get(e),o=this._adapter,a=this;return t.nextTick((function s(u){if(a.destroyed)return;var c=a._createHandshakeRequest(o,!u),f=a._writableFactory.call(a,(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=U(_,r),f=u.head;f.serverHash&&(o=a._getAdapter(f))}catch(e){return void i(e)}var h=f.match;l("handshake match: %s",h),a.emit("handshake",c,f),"NONE"===h?t.nextTick((function(){s(!0)})):(a._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]}),a._endWritable&&f.end()})),!0},u.inherits(x,A),x.prototype._emit=function(){if(this._connected||this.draining)A.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)}))}},x.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(T,a.EventEmitter),T.prototype.destroy=function(e){this.draining||(this.draining=!0,this.emit("_drain")),!e&&this.pending||(this.destroyed=!0,q(e)?(l("fatal server channel error: %s",e),this.emit("_eot",this.pending,e)):this.emit("_eot",this.pending))},T.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}},T.prototype._getAdapter=function(e){var t=e.clientHash,r=this.server._cache[t];if(r)return r;if(!e.clientProtocol)throw V("UNKNOWN_PROTOCOL");var n=JSON.parse(e.clientProtocol);return r=new R(w.forProtocol(n),this.server.service,t,!0),this.server._cache[t]=r},T.prototype._matchesPrefix=function(e){return W(e,this._prefix)},T.prototype._receive=function(e,t,r){var n,i=this;try{n=t._decodeRequest(e)}catch(e){return void r(i._encodeSystemError(V("INVALID_REQUEST",e)))}var o=n._msg,a=new I(o,{});if(!o.name)return a.response=null,void r(a.toBuffer(),!1);var s=new F(o,this);i.emit("incomingCall",s);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++,Q({fns:u,ctx:s,wreq:n,wres:a,onTransition:function(e,t,r){var n=i.server._handlers[o.name];if(n){var a=!o.oneWay;try{a?n.call(s,e.request,(function(e,n){a=!1,t.error=e,t.response=n,r()})):(n.call(s,e.request),r())}catch(e){a?(a=!1,r(e)):c(e)}}else{var u=i.server._defaultHandler;if(u)u.call(s,e,t,r);else{var f=new Error(h("no handler for %s",o.name));r(V("NOT_IMPLEMENTED",f))}}},onCompletion:function(e){i.pending--;var t,n=i.server;if(!e){var s=a.error;n._strict||(q(s)?a.error=o.errorType.clone(s.message,{wrapUnions:!0}):null===s&&(s=a.error=void 0),void 0===s&&void 0===a.response&&o.responseType.isValid(null)&&(a.response=null));try{t=a.toBuffer()}catch(t){e=void 0!==a.error?J(h("invalid %j error",o.name),a,[{name:"headers",type:y},{name:"error",type:o.errorType}]):J(h("invalid %j response",o.name),a,[{name:"headers",type:y},{name:"response",type:o.responseType}])}}t?void 0!==s&&n.emit("error",V("APPLICATION_ERROR",s)):t=i._encodeSystemError(e,a.headers);r(t,o.oneWay),i.draining&&!i.pending&&i.destroy()},onError:c})},o.addDeprecatedGetters(T,["pending"]),T.prototype.getCache=u.deprecate((function(){return this.server._cache}),"use `.remoteProtocols()` instead of `.getCache()`"),T.prototype.getProtocol=u.deprecate((function(){return this.server.service}),"use `.service` instead of `.getProtocol()`"),T.prototype.isDestroyed=u.deprecate((function(){return this.destroyed}),"use `.destroyed` instead of `.isDestroyed`"),T.prototype._encodeSystemError=function(e,t){var r,i,a=this.server;if(a.emit("error",e,this),a._sysErrFormatter?r=a._sysErrFormatter.call(this,e):e.rpcCode&&(r=e.message),t)try{i=y.toBuffer(t)}catch(e){a.emit("error",e,this)}return n.concat([i||o.bufferFrom([0]),o.bufferFrom([1,0]),m.toBuffer(r||"internal server error")])},u.inherits(N,T),u.inherits(O,T),k.prototype.toBuffer=function(){var e=this._msg;return n.concat([y.toBuffer(this.headers),m.toBuffer(e.name),e.requestType.toBuffer(this.request)])},I.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)])},D.prototype.get=function(e){return this._cbs[e&this._mask]},D.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))}},D.prototype.clear=function(){Object.keys(this._cbs).forEach((function(e){this._cbs[e](new Error("interrupted"))}),this)},R.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=v,!n.isValid())throw new Error(h("truncated %s request",o||"ping$"));return new k(t,i,r)},R.prototype._decodeResponse=function(e,t,r){var n=new c(e);o.copyOwnProperties(y._read(n),t.headers,!0);var i=d._read(n),a=r.name;if(a){var s=this._readers[a+(i?"*":"!")];if(r=this._clientSvc.message(a),i?t.error=s._read(n):t.response=s._read(n),!n.isValid())throw new Error(h("truncated %s response",a))}else r=v},u.inherits(C,s.Transform),C.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()},C.prototype._flush=function(){if(this._buf.length||this._bufs.length){var e=this._bufs.slice();e.unshift(this._buf);var t=V("TRAILING_DATA");t.trailingData=n.concat(e).toString(),this.emit("error",t)}},u.inherits(L,s.Transform),L.prototype._transform=function(e,t,r){var n,i,o,a=e.payload;for(n=0,i=a.length;n<i;n++)o=a[n],this.push(M(o.length)),this.push(o);this.push(M(0)),r()},u.inherits(j,s.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=C.prototype._flush,u.inherits(P,s.Transform),P.prototype._transform=function(e,t,r){var n,i,a=e.payload,s=a.length;for((n=o.newBuffer(8)).writeInt32BE(e.id,0),n.writeInt32BE(s,4),this.push(n),i=0;i<s;i++)n=a[i],this.push(M(n.length)),this.push(n);r()},e.exports={Adapter:R,HANDSHAKE_REQUEST_TYPE:g,HANDSHAKE_RESPONSE_TYPE:_,Message:b,Registry:D,Service:w,discoverProtocol:function(e,t,r){var n;void 0===r&&"function"==typeof t&&(r=t,t=void 0),new w({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:C,FrameEncoder:L,NettyDecoder:j,NettyEncoder:P}}}).call(this,r(27),r(12).Buffer)},1455:function(e,t,r){"use strict";var n=r(1456),i=r(320),o=r(351),a=r(70).format,s={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){function i(e,r){t.importHook(e,"idl",(function(n,i){if(n)r(n);else if(void 0!==i){try{var o=new c(i,t)._readProtocol(i,t)}catch(n){return n.path=e,void r(n)}s(o.protocol,o.imports,r)}else r()}))}function s(r,n,s){var u=[];!function c(){var f=n.shift();if(!f){u.reverse();try{u.forEach((function(e){!function(e,t){var r=t.types||[];r.reverse(),r.forEach((function(r){e.types||(e.types=[]),void 0===r.namespace&&(r.namespace=h(t)||""),e.types.unshift(r)})),Object.keys(t.messages||{}).forEach((function(r){if(e.messages||(e.messages={}),e.messages[r])throw new Error(a("duplicate message: %s",r));e.messages[r]=t.messages[r]}))}(r,e)}))}catch(e){return void s(e)}return void s(null,r)}var l=o.join(o.dirname(e),f.name);"idl"===f.kind?i(l,(function(e,t){e?s(e):(t&&u.push(t),c())})):t.importHook(l,f.kind,(function(e,t){if(e)s(e);else switch(f.kind){case"protocol":case"schema":if(void 0===t)return void c();try{var r=JSON.parse(t)}catch(e){return e.path=l,void s(e)}var n="schema"===f.kind?{types:[r]}:r;return u.push(n),void c();default:s(new Error(a("invalid import kind: %s",f.kind)))}}))}()}r||"function"!=typeof t||(r=t,t=void 0),(t=t||{}).importHook||(t.importHook=n.createImportHook()),i(e,(function(e,t){if(e)r(e);else if(t){var n=t.types;if(n){var i=h(t)||"";n.forEach((function(e){e.namespace===i&&delete e.namespace}))}r(null,t)}else r(new Error("empty root import"))}))}function c(e,t){t=t||{},this._tk=new f(e),this._ackVoidMessages=!!t.ackVoidMessages,this._implicitTags=!t.delimitedCollections,this._typeRefs=t.typeRefs||s}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")}function h(e){if(e.namespace)return e.namespace;var t=/^(.*)\.[^.]+$/.exec(e.protocol);return t?t[1]:void 0}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={},s=this._readJavadoc();for(void 0!==s&&(o.doc=s),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(a("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,a=JSON.parse(r.next({id:"string"}).val);r.next({val:";"}),e.push({kind:o,name:a}),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,s=o.charAt(i);if(s)if(e&&"json"===e.id?(r.id="json",this.pos=this._endOfJson()):'"'===s?(r.id="string",this.pos=this._endOfString()):/[0-9]/.test(s)?(r.id="number",this.pos=this._endOf(/[0-9]/)):/[`A-Za-z_.]/.test(s)?(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(a("expected ID %s",e.id),r):e&&e.val&&e.val!==r.val&&(t=this.error(a("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,s=1,u=0;for(r=0;r<i;r++)"\n"===o.charAt(r)&&(s++,u=r);var c=n?a("invalid token %j: %s",t,e):e,f=new Error(c);return f.token=n?t:void 0,f.lineNum=s,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}},1456: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()}}},1457:function(e,t,r){"use strict";(function(t,n){var i=r(506),o=r(320),a=r(64),s=r(70),u=r(354),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=s.format,m=o.Tap;function g(e,t){var r=!!(t=t||{}).noDecode;a.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;a.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||{},a.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("typeError",e,t,this._type)}},this._tap=new m(o.newBuffer(t.batchSize||65536)),this.on("typeError",(function(e){this.emit("error",e)}))}function b(e,t){var r;if(t=t||{},a.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){return this.emit("typeError",e,t,this._type),!1}return!0},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)})),this.on("typeError",(function(e){this.emit("error",e)}))}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}s.inherits(g,a.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())},s.inherits(_,a.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 a=this._tap;a.buf=t.concat([a.buf,e]),a.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,a=1;o=E(i);){if(!this._syncMarker.equals(o.sync))return void this.emit("error",new Error("invalid sync marker"));a++,this._decompress(o.data,this._createBlockCallback(o.count,s))}function s(){--a||n()}s()},_.prototype._createBlockCallback=function(e,t){var r=this,n=this._index++;return function(i,o){if(i){var a=new Error(y("%s codec decompression error",r._codec));a.cause=i,r.emit("error",a),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)},s.inherits(v,a.Transform),v.prototype._transform=function(e,t,r){var n=this._tap,i=n.buf,a=n.pos;if(this._writeValue(n,e),!n.isValid()){a&&this.push(function(e,t,r){var n=o.newBuffer(r);return e.copy(n,0,t,t+r),n}(n.buf,0,a));var s=n.pos-a;s>i.length&&(n.buf=o.newBuffer(2*s)),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()},s.inherits(b,a.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,a=!1;if(this._writeValue(n,e)){if(!n.isValid()){i&&(this._flushChunk(i,r),a=!0);var s=n.pos-i;s>this._blockSize&&(this._blockSize=2*s),n.buf=o.newBuffer(this._blockSize),n.pos=0,this._writeValue(n,e)}this._blockCount++}else n.pos=i;a||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 a=new Error(y("%s codec compression error",t._codec));return a.cause=i,void t.emit("error",a)}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(12).Buffer,r(27))},1458: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={},a={};function s(e,t){var r,n,i;return t?(i=0<=(e>>>=0)&&e<256)&&(n=a[e])?n:(r=c(e,(0|e)<0?-1:0,!0),i&&(a[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=s,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,a=0;a<e.length;a+=8){var s=Math.min(8,e.length-a),c=parseInt(e.substring(a,a+s),r);if(s<8){var h=u(f(r,s));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=s(1<<24),g=s(0);n.ZERO=g;var _=s(0,!0);n.UZERO=_;var v=s(1);n.ONE=v;var b=s(1,!0);n.UONE=b;var w=s(-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,a="";;){var s=o.div(i),c=(o.sub(s.mul(i)).toInt()>>>0).toString(e);if((o=s).isZero())return c+a;for(;c.length<6;)c="0"+c;a=""+c+a}},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,a=e.high>>>16,s=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+s)>>>16,f+=t+a,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,a=65535&this.low,s=e.high>>>16,f=65535&e.high,l=e.low>>>16,p=65535&e.low,d=0,y=0,_=0,v=0;return _+=(v+=a*p)>>>16,y+=(_+=o*p)>>>16,_&=65535,y+=(_+=a*l)>>>16,d+=(y+=n*p)>>>16,y&=65535,d+=(y+=o*l)>>>16,y&=65535,d+=(y+=a*f)>>>16,d+=t*p+n*l+o*f+a*s,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 a=Math.ceil(Math.log(t)/Math.LN2),s=a<=48?1:f(2,a-48),l=u(t),p=l.mul(e);p.isNegative()||p.gt(n);)p=(l=u(t-=s,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)}},1489:function(e,t,r){"use strict";r.r(t);var n=r(1),i=r.n(n),o=r(2),a=r.n(o),s=r(4),u=r.n(s),c=r(3),f=r.n(c),l=r(5),h=r.n(l),p=r(9),d=r(7),y=r(816),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),a()(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),a=new m.a.streams.BlockDecoder;a.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)}})),a.write(o),a.end()}))}}]),t}(p.a),_=r(817),v=r(337),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),a()(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=function(e){function t(){var e;return i()(this,t),(e=u()(this,f()(t).call(this))).name="Parse ObjectID timestamp",e.module="Serialise",e.description="Parse timestamp from MongoDB/BSON ObjectID hex string.",e.infoURL="https://docs.mongodb.com/manual/reference/method/ObjectId.getTimestamp/",e.inputType="string",e.outputType="string",e.args=[],e}return h()(t,e),a()(t,[{key:"run",value:function(e,t){try{return new b.a.ObjectID(e).getTimestamp().toISOString()}catch(e){throw new d.a(e)}}}]),t}(p.a),B="undefined"==typeof self?{}:self.OpModules||{};B.Serialise={"Avro to JSON":g,"BSON deserialise":_.a,"BSON serialise":w,"Parse ObjectID timestamp":E};t.default=B},15:function(e,t,r){"use strict";var n=r(8),i=r.n(n),o=r(11),a=r.n(o),s=r(1),u=r.n(s),c=r(2),f=r.n(c),l=r(0),h=r(4),p=r.n(h),d=r(3),y=r.n(d),m=r(23),g=r.n(m),_=r(5),v=r.n(_);
/**
 * 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 b=function(e){function t(){var e;u()(this,t);for(var r=arguments.length,n=new Array(r),i=0;i<r;i++)n[i]=arguments[i];return(e=p()(this,y()(t).call(this,...n))).type="DishError",Error.captureStackTrace&&Error.captureStackTrace(g()(e),t),e}return v()(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)),w=r(17),E=r.n(w),B=r(19),A=r(26),S=r.n(A),x=function(){function e(){u()(this,e)}return f()(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}(),T=function(e){function t(){return u()(this,t),p()(this,y()(t).apply(this,arguments))}return v()(t,e),f()(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}(x),N=function(e){function t(){return u()(this,t),p()(this,y()(t).apply(this,arguments))}return v()(t,e),f()(t,null,[{key:"toArrayBuffer",value:function(){t.checkForValue(this.value),this.value=E.a.isBigNumber(this.value)?l.b.strToArrayBuffer(this.value.toFixed()):new ArrayBuffer}},{key:"fromArrayBuffer",value:function(e){t.checkForValue(this.value);try{this.value=new E.a(l.b.arrayBufferToStr(this.value,!e))}catch(e){this.value=new E.a(NaN)}}}]),t}(x),O=function(e){function t(){return u()(this,t),p()(this,y()(t).apply(this,arguments))}return v()(t,e),f()(t,null,[{key:"toArrayBuffer",value:function(){var e=this;if(t.checkForValue(this.value),!Object(l.c)())return new Promise((function(t,r){l.b.readFile(e.value).then((function(t){return e.value=t.buffer})).then(t).catch(r)}));this.value=l.b.readFileSync(this.value)}},{key:"fromArrayBuffer",value:function(){t.checkForValue(this.value),this.value=new File(this.value,"unknown")}}]),t}(x),k=function(e){function t(){return u()(this,t),p()(this,y()(t).apply(this,arguments))}return v()(t,e),f()(t,null,[{key:"toArrayBuffer",value:function(){t.checkForValue(this.value),this.value=this.value?l.b.strToArrayBuffer(this.value):new ArrayBuffer}},{key:"fromArrayBuffer",value:function(e){t.checkForValue(this.value),this.value=this.value?l.b.arrayBufferToStr(this.value,!e):""}}]),t}(x),I=function(e){function t(){return u()(this,t),p()(this,y()(t).apply(this,arguments))}return v()(t,e),f()(t,null,[{key:"toArrayBuffer",value:function(){t.checkForValue(this.value),this.value=this.value?l.b.strToArrayBuffer(l.b.unescapeHtml(l.b.stripHtmlTags(this.value,!0))):new ArrayBuffer}}]),t}(k),F=function(e){function t(){return u()(this,t),p()(this,y()(t).apply(this,arguments))}return v()(t,e),f()(t,null,[{key:"toArrayBuffer",value:function(){t.checkForValue(this.value),this.value=void 0!==this.value?l.b.strToArrayBuffer(JSON.stringify(this.value,null,4)):new ArrayBuffer}},{key:"fromArrayBuffer",value:function(e){t.checkForValue(this.value),this.value=JSON.parse(l.b.arrayBufferToStr(this.value,!e))}}]),t}(x),D=function(e){function t(){return u()(this,t),p()(this,y()(t).apply(this,arguments))}var r,n;return v()(t,e),f()(t,null,[{key:"toArrayBuffer",value:(n=a()(i.a.mark((function e(){return i.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(t.checkForValue(this.value),!Object(l.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,t.concatenateTypedArraysWithTypedElements(...this.value);case 7:this.value=e.sent;case 8:case"end":return e.stop()}}),e,this)}))),function(){return n.apply(this,arguments)})},{key:"fromArrayBuffer",value:function(){t.checkForValue(this.value),this.value=[new File(this.value,"unknown")]}},{key:"concatenateTypedArraysWithTypedElements",value:(r=a()(i.a.mark((function e(){var t,r,n,o,a,s,u,c,f,h,p,d,y,m=arguments;return i.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:for(t=0,r=m.length,n=new Array(r),o=0;o<r;o++)n[o]=m[o];for(a=0,s=n;a<s.length;a++)u=s[a],t+=u.size;c=new Uint8Array(t),f=0,h=0,p=n;case 6:if(!(h<p.length)){e.next=16;break}return d=p[h],e.next=10,l.b.readFile(d);case 10:y=e.sent,c.set(y,f),f+=y.length;case 13:h++,e.next=6;break;case 16:return e.abrupt("return",c);case 17:case"end":return e.stop()}}),e)}))),function(){return r.apply(this,arguments)})},{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 a=o[i];e+=a.length}for(var s=new Uint8Array(e),u=0,c=0,f=r;c<f.length;c++){var l=f[c];s.set(l,u),u+=l.length}return s}}]),t}(x),R=function(e){function t(){return u()(this,t),p()(this,y()(t).apply(this,arguments))}return v()(t,e),f()(t,null,[{key:"toArrayBuffer",value:function(){t.checkForValue(this.value),this.value="number"==typeof this.value?l.b.strToArrayBuffer(this.value.toString()):new ArrayBuffer}},{key:"fromArrayBuffer",value:function(e){t.checkForValue(this.value),this.value=this.value?parseFloat(l.b.arrayBufferToStr(this.value,!e)):0}}]),t}(x),C=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(u()(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)}}var t;return f()(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(l.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)),S.a.debug("Dish type: "+e.enumLookup(r)),this.value=t,this.type=r,!this.valid()){var n=l.b.truncate(JSON.stringify(this.value),25);throw new b(`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(B.a)(e);return t.length&&t[0].mime&&"text/plain"!==!t[0].mime?t[0].mime:null}},{key:"getTitle",value:(t=a()(i.a.mark((function t(r){var n,o;return i.a.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:n="",t.t0=this.type,t.next=t.t0===e.FILE?4:t.t0===e.LIST_FILE?6:t.t0===e.JSON?8:t.t0===e.NUMBER||t.t0===e.BIG_NUMBER?10:t.t0===e.ARRAY_BUFFER||t.t0===e.BYTE_ARRAY?12:15;break;case 4:return n=this.value.name,t.abrupt("break",26);case 6:return n=`${this.value.length} file(s)`,t.abrupt("break",26);case 8:return n="application/json",t.abrupt("break",26);case 10:return n=this.value.toString(),t.abrupt("break",26);case 12:if(null===(n=this.detectDishType())){t.next=15;break}return t.abrupt("break",26);case 15:return t.prev=15,(o=this.clone()).value=o.value.slice(0,256),t.next=20,o.get(e.STRING);case 20:n=t.sent,t.next=26;break;case 23:t.prev=23,t.t1=t.catch(15),S.a.error(`${e.enumLookup(this.type)} cannot be sliced. ${t.t1}`);case 26:return t.abrupt("return",n.slice(0,r));case 27:case"end":return t.stop()}}),t,this,[[15,23]])}))),function(e){return t.apply(this,arguments)})},{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(E.a.isBigNumber(this.value))return!0;if(Object.keys(this.value).sort().equals(["c","e","s"])){var r=new E.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 b("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(S.a.debug(`Translating Dish from ${e.enumLookup(this.type)} to ${e.enumLookup(t)}`),!Object(l.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(k.toArrayBuffer.bind(t)())},[e.NUMBER]:function(){return Promise.resolve(R.toArrayBuffer.bind(t)())},[e.HTML]:function(){return Promise.resolve(I.toArrayBuffer.bind(t)())},[e.ARRAY_BUFFER]:function(){return Promise.resolve()},[e.BIG_NUMBER]:function(){return Promise.resolve(N.toArrayBuffer.bind(t)())},[e.JSON]:function(){return Promise.resolve(F.toArrayBuffer.bind(t)())},[e.FILE]:function(){return O.toArrayBuffer.bind(t)()},[e.LIST_FILE]:function(){return Promise.resolve(D.toArrayBuffer.bind(t)())},[e.BYTE_ARRAY]:function(){return Promise.resolve(T.toArrayBuffer.bind(t)())}},node:{[e.STRING]:function(){return k.toArrayBuffer.bind(t)()},[e.NUMBER]:function(){return R.toArrayBuffer.bind(t)()},[e.HTML]:function(){return I.toArrayBuffer.bind(t)()},[e.ARRAY_BUFFER]:function(){},[e.BIG_NUMBER]:function(){return N.toArrayBuffer.bind(t)()},[e.JSON]:function(){return F.toArrayBuffer.bind(t)()},[e.FILE]:function(){return O.toArrayBuffer.bind(t)()},[e.LIST_FILE]:function(){return D.toArrayBuffer.bind(t)()},[e.BYTE_ARRAY]:function(){return T.toArrayBuffer.bind(t)()}}};try{return r[Object(l.c)()?"node":"browser"][this.type]()}catch(t){throw new b(`Error translating from ${e.enumLookup(this.type)} to ArrayBuffer: ${t}`)}}},{key:"_fromArrayBuffer",value:function(t,r){var n=this,i={[e.STRING]:function(){return k.fromArrayBuffer.bind(n)(r)},[e.NUMBER]:function(){return R.fromArrayBuffer.bind(n)(r)},[e.HTML]:function(){return I.fromArrayBuffer.bind(n)(r)},[e.ARRAY_BUFFER]:function(){},[e.BIG_NUMBER]:function(){return N.fromArrayBuffer.bind(n)(r)},[e.JSON]:function(){return F.fromArrayBuffer.bind(n)(r)},[e.FILE]:function(){return O.fromArrayBuffer.bind(n)()},[e.LIST_FILE]:function(){return D.fromArrayBuffer.bind(n)()},[e.BYTE_ARRAY]:function(){return T.fromArrayBuffer.bind(n)()}};try{i[t](),this.type=t}catch(r){throw new b(`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 b("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 b("Invalid data type enum. No matching type.")}}}]),e}();C.BYTE_ARRAY=0,C.STRING=1,C.NUMBER=2,C.HTML=3,C.ARRAY_BUFFER=4,C.BIG_NUMBER=5,C.JSON=6,C.FILE=7,C.LIST_FILE=8;t.a=C},16:function(e,t,r){"use strict";r.d(t,"b",(function(){return o})),r.d(t,"a",(function(){return a}));var n=r(0),i=r(7);
/**
 * 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,a,s,u,c,f,l="",h=0;h<e.length;)s=(r=e[h++])>>2,u=(3&r)<<4|(o=e[h++])>>4,c=(15&o)<<2|(a=e[h++])>>6,f=63&a,isNaN(o)?c=f=64:isNaN(a)&&(f=64),l+=t.charAt(s)+t.charAt(u)+t.charAt(c)+t.charAt(f);return l}function a(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 a,s,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;)a=t.indexOf(e.charAt(p++))<<2|(c=-1===(c=t.indexOf(e.charAt(p++)||"="))?64:c)>>4,s=(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(a),64!==f&&h.push(s),64!==l&&h.push(u);return"string"===r?n.b.byteArrayToUtf8(h):h}},17:function(e,t,r){var n;!function(i){"use strict";var o,a=/^-?(?:\d+(?:\.\d*)?|\.\d+)(?:e[+-]?\d+)?$/i,s=Math.ceil,u=Math.floor,c="[BigNumber Error] ",f=c+"Number primitive has more than 15 significant digits: ",l=1e14,h=[1,10,100,1e3,1e4,1e5,1e6,1e7,1e8,1e9,1e10,1e11,1e12,1e13],p=1e9;function d(e){var t=0|e;return e>0||e===t?t:t-1}function y(e){for(var t,r,n=1,i=e.length,o=e[0]+"";n<i;){for(r=14-(t=e[n++]+"").length;r--;t="0"+t);o+=t}for(i=o.length;48===o.charCodeAt(--i););return o.slice(0,i+1||1)}function m(e,t){var r,n,i=e.c,o=t.c,a=e.s,s=t.s,u=e.e,c=t.e;if(!a||!s)return null;if(r=i&&!i[0],n=o&&!o[0],r||n)return r?n?0:-s:a;if(a!=s)return a;if(r=a<0,n=u==c,!i||!o)return n?0:!i^r?1:-1;if(!n)return u>c^r?1:-1;for(s=(u=i.length)<(c=o.length)?u:c,a=0;a<s;a++)if(i[a]!=o[a])return i[a]>o[a]^r?1:-1;return u==c?0:u>c^r?1:-1}function g(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 _(e){var t=e.c.length-1;return d(e.e/14)==t&&e.c[t]%2!=0}function v(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,w,E,B,A,S,x=M.prototype={constructor:M,toString:null,valueOf:null},T=new M(1),N=20,O=4,k=-7,I=21,F=-1e7,D=1e7,R=!1,C=1,L=0,j={prefix:"",groupSize:3,secondaryGroupSize:0,groupSeparator:",",decimalSeparator:".",fractionGroupSize:0,fractionGroupSeparator:" ",suffix:""},P="0123456789abcdefghijklmnopqrstuvwxyz";function M(e,t){var r,o,s,c,l,h,p,d,y=this;if(!(y instanceof M))return new M(e,t);if(null==t){if(e&&!0===e._isBigNumber)return y.s=e.s,void(!e.c||e.e>D?y.c=y.e=null:e.e<F?y.c=[y.e=0]:(y.e=e.e,y.c=e.c.slice()));if((h="number"==typeof e)&&0*e==0){if(y.s=1/e<0?(e=-e,-1):1,e===~~e){for(c=0,l=e;l>=10;l/=10,c++);return void(c>D?y.c=y.e=null:(y.e=c,y.c=[e]))}d=String(e)}else{if(!a.test(d=String(e)))return i(y,d,h);y.s=45==d.charCodeAt(0)?(d=d.slice(1),-1):1}(c=d.indexOf("."))>-1&&(d=d.replace(".","")),(l=d.search(/e/i))>0?(c<0&&(c=l),c+=+d.slice(l+1),d=d.substring(0,l)):c<0&&(c=d.length)}else{if(g(t,2,P.length,"Base"),10==t)return Y(y=new M(e),N+y.e+1,O);if(d=String(e),h="number"==typeof e){if(0*e!=0)return i(y,d,h,t);if(y.s=1/e<0?(d=d.slice(1),-1):1,M.DEBUG&&d.replace(/^0\.0*|\./,"").length>15)throw Error(f+e)}else y.s=45===d.charCodeAt(0)?(d=d.slice(1),-1):1;for(r=P.slice(0,t),c=l=0,p=d.length;l<p;l++)if(r.indexOf(o=d.charAt(l))<0){if("."==o){if(l>c){c=p;continue}}else if(!s&&(d==d.toUpperCase()&&(d=d.toLowerCase())||d==d.toLowerCase()&&(d=d.toUpperCase()))){s=!0,l=-1,c=0;continue}return i(y,String(e),h,t)}h=!1,(c=(d=n(d,t,10,y.s)).indexOf("."))>-1?d=d.replace(".",""):c=d.length}for(l=0;48===d.charCodeAt(l);l++);for(p=d.length;48===d.charCodeAt(--p););if(d=d.slice(l,++p)){if(p-=l,h&&M.DEBUG&&p>15&&(e>9007199254740991||e!==u(e)))throw Error(f+y.s*e);if((c=c-l-1)>D)y.c=y.e=null;else if(c<F)y.c=[y.e=0];else{if(y.e=c,y.c=[],l=(c+1)%14,c<0&&(l+=14),l<p){for(l&&y.c.push(+d.slice(0,l)),p-=14;l<p;)y.c.push(+d.slice(l,l+=14));l=14-(d=d.slice(l)).length}else l-=p;for(;l--;d+="0");y.c.push(+d)}}else y.c=[y.e=0]}function U(e,t,r,n){var i,o,a,s,u;if(null==r?r=O:g(r,0,8),!e.c)return e.toString();if(i=e.c[0],a=e.e,null==t)u=y(e.c),u=1==n||2==n&&(a<=k||a>=I)?v(u,a):b(u,a,"0");else if(o=(e=Y(new M(e),t,r)).e,s=(u=y(e.c)).length,1==n||2==n&&(t<=o||o<=k)){for(;s<t;u+="0",s++);u=v(u,o)}else if(t-=a,u=b(u,o,"0"),o+1>s){if(--t>0)for(u+=".";t--;u+="0");}else if((t+=o-s)>0)for(o+1==s&&(u+=".");t--;u+="0");return e.s<0&&i?"-"+u:u}function z(e,t){for(var r,n=1,i=new M(e[0]);n<e.length;n++){if(!(r=new M(e[n])).s){i=r;break}t.call(i,r)&&(i=r)}return i}function $(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+14*r-1)>D?e.c=e.e=null:r<F?e.c=[e.e=0]:(e.e=r,e.c=t),e}function Y(e,t,r,n){var i,o,a,c,f,p,d,y=e.c,m=h;if(y){e:{for(i=1,c=y[0];c>=10;c/=10,i++);if((o=t-i)<0)o+=14,a=t,d=(f=y[p=0])/m[i-a-1]%10|0;else if((p=s((o+1)/14))>=y.length){if(!n)break e;for(;y.length<=p;y.push(0));f=d=0,i=1,a=(o%=14)-14+1}else{for(f=c=y[p],i=1;c>=10;c/=10,i++);d=(a=(o%=14)-14+i)<0?0:f/m[i-a-1]%10|0}if(n=n||t<0||null!=y[p+1]||(a<0?f:f%m[i-a-1]),n=r<4?(d||n)&&(0==r||r==(e.s<0?3:2)):d>5||5==d&&(4==r||n||6==r&&(o>0?a>0?f/m[i-a]:0:y[p-1])%10&1||r==(e.s<0?8:7)),t<1||!y[0])return y.length=0,n?(t-=e.e+1,y[0]=m[(14-t%14)%14],e.e=-t||0):y[0]=e.e=0,e;if(0==o?(y.length=p,c=1,p--):(y.length=p+1,c=m[14-o],y[p]=a>0?u(f/m[i-a]%m[a])*c:0),n)for(;;){if(0==p){for(o=1,a=y[0];a>=10;a/=10,o++);for(a=y[0]+=c,c=1;a>=10;a/=10,c++);o!=c&&(e.e++,y[0]==l&&(y[0]=1));break}if(y[p]+=c,y[p]!=l)break;y[p--]=0,c=1}for(o=y.length;0===y[--o];y.pop());}e.e>D?e.c=e.e=null:e.e<F&&(e.c=[e.e=0])}return e}function H(e){var t,r=e.e;return null===r?e.toString():(t=y(e.c),t=r<=k||r>=I?v(t,r):b(t,r,"0"),e.s<0?"-"+t:t)}return M.clone=e,M.ROUND_UP=0,M.ROUND_DOWN=1,M.ROUND_CEIL=2,M.ROUND_FLOOR=3,M.ROUND_HALF_UP=4,M.ROUND_HALF_DOWN=5,M.ROUND_HALF_EVEN=6,M.ROUND_HALF_CEIL=7,M.ROUND_HALF_FLOOR=8,M.EUCLID=9,M.config=M.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")&&(g(r=e[t],0,p,t),N=r),e.hasOwnProperty(t="ROUNDING_MODE")&&(g(r=e[t],0,8,t),O=r),e.hasOwnProperty(t="EXPONENTIAL_AT")&&((r=e[t])&&r.pop?(g(r[0],-p,0,t),g(r[1],0,p,t),k=r[0],I=r[1]):(g(r,-p,p,t),k=-(I=r<0?-r:r))),e.hasOwnProperty(t="RANGE"))if((r=e[t])&&r.pop)g(r[0],-p,-1,t),g(r[1],1,p,t),F=r[0],D=r[1];else{if(g(r,-p,p,t),!r)throw Error(c+t+" cannot be zero: "+r);F=-(D=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 R=!r,Error(c+"crypto unavailable");R=r}else R=r}if(e.hasOwnProperty(t="MODULO_MODE")&&(g(r=e[t],0,9,t),C=r),e.hasOwnProperty(t="POW_PRECISION")&&(g(r=e[t],0,p,t),L=r),e.hasOwnProperty(t="FORMAT")){if("object"!=typeof(r=e[t]))throw Error(c+t+" not an object: "+r);j=r}if(e.hasOwnProperty(t="ALPHABET")){if("string"!=typeof(r=e[t])||/^.$|[+-.\s]|(.).*\1/.test(r))throw Error(c+t+" invalid: "+r);P=r}}return{DECIMAL_PLACES:N,ROUNDING_MODE:O,EXPONENTIAL_AT:[k,I],RANGE:[F,D],CRYPTO:R,MODULO_MODE:C,POW_PRECISION:L,FORMAT:j,ALPHABET:P}},M.isBigNumber=function(e){if(!e||!0!==e._isBigNumber)return!1;if(!M.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>=-p&&i<=p&&i===u(i)){if(0===n[0]){if(0===i&&1===n.length)return!0;break e}if((t=(i+1)%14)<1&&(t+=14),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)},M.maximum=M.max=function(){return z(arguments,x.lt)},M.minimum=M.min=function(){return z(arguments,x.gt)},M.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,a,f=0,l=[],d=new M(T);if(null==e?e=N:g(e,0,p),i=s(e/14),R)if(crypto.getRandomValues){for(t=crypto.getRandomValues(new Uint32Array(i*=2));f<i;)(a=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(a%1e14),f+=2);f=i/2}else{if(!crypto.randomBytes)throw R=!1,Error(c+"crypto unavailable");for(t=crypto.randomBytes(i*=7);f<i;)(a=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(a%1e14),f+=7);f=i/7}if(!R)for(;f<i;)(a=o())<9e15&&(l[f++]=a%1e14);for(e%=14,(i=l[--f])&&e&&(a=h[14-e],l[f]=u(i/a)*a);0===l[f];l.pop(),f--);if(f<0)l=[n=0];else{for(n=-1;0===l[0];l.splice(0,1),n-=14);for(f=1,a=l[0];a>=10;a/=10,f++);f<14&&(n-=14-f)}return d.e=n,d.c=l,d}),M.sum=function(){for(var e=1,t=arguments,r=new M(t[0]);e<t.length;)r=r.plus(t[e++]);return r},n=function(){function e(e,t,r,n){for(var i,o,a=[0],s=0,u=e.length;s<u;){for(o=a.length;o--;a[o]*=t);for(a[0]+=n.indexOf(e.charAt(s++)),i=0;i<a.length;i++)a[i]>r-1&&(null==a[i+1]&&(a[i+1]=0),a[i+1]+=a[i]/r|0,a[i]%=r)}return a.reverse()}return function(t,n,i,o,a){var s,u,c,f,l,h,p,d,m=t.indexOf("."),g=N,_=O;for(m>=0&&(f=L,L=0,t=t.replace(".",""),h=(d=new M(n)).pow(t.length-m),L=f,d.c=e(b(y(h.c),h.e,"0"),10,i,"0123456789"),d.e=d.c.length),c=f=(p=e(t,n,i,a?(s=P,"0123456789"):(s="0123456789",P))).length;0==p[--f];p.pop());if(!p[0])return s.charAt(0);if(m<0?--c:(h.c=p,h.e=c,h.s=o,p=(h=r(h,d,g,_,i)).c,l=h.r,c=h.e),m=p[u=c+g+1],f=i/2,l=l||u<0||null!=p[u+1],l=_<4?(null!=m||l)&&(0==_||_==(h.s<0?3:2)):m>f||m==f&&(4==_||l||6==_&&1&p[u-1]||_==(h.s<0?8:7)),u<1||!p[0])t=l?b(s.charAt(1),-g,s.charAt(0)):s.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(m=0,t="";m<=f;t+=s.charAt(p[m++]));t=b(t,c,s.charAt(0))}return t}}(),r=function(){function e(e,t,r){var n,i,o,a,s=0,u=e.length,c=t%1e7,f=t/1e7|0;for(e=e.slice();u--;)s=((i=c*(o=e[u]%1e7)+(n=f*o+(a=e[u]/1e7|0)*c)%1e7*1e7+s)/r|0)+(n/1e7|0)+f*a,e[u]=i%r;return s&&(e=[s].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,a,s){var c,f,h,p,y,m,g,_,v,b,w,E,B,A,S,x,T,N=n.s==i.s?1:-1,O=n.c,k=i.c;if(!(O&&O[0]&&k&&k[0]))return new M(n.s&&i.s&&(O?!k||O[0]!=k[0]:k)?O&&0==O[0]||!k?0*N:N/0:NaN);for(v=(_=new M(N)).c=[],N=o+(f=n.e-i.e)+1,s||(s=l,f=d(n.e/14)-d(i.e/14),N=N/14|0),h=0;k[h]==(O[h]||0);h++);if(k[h]>(O[h]||0)&&f--,N<0)v.push(1),p=!0;else{for(A=O.length,x=k.length,h=0,N+=2,(y=u(s/(k[0]+1)))>1&&(k=e(k,y,s),O=e(O,y,s),x=k.length,A=O.length),B=x,w=(b=O.slice(0,x)).length;w<x;b[w++]=0);T=k.slice(),T=[0].concat(T),S=k[0],k[1]>=s/2&&S++;do{if(y=0,(c=t(k,b,x,w))<0){if(E=b[0],x!=w&&(E=E*s+(b[1]||0)),(y=u(E/S))>1)for(y>=s&&(y=s-1),g=(m=e(k,y,s)).length,w=b.length;1==t(m,b,g,w);)y--,r(m,x<g?T:k,g,s),g=m.length,c=1;else 0==y&&(c=y=1),g=(m=k.slice()).length;if(g<w&&(m=[0].concat(m)),r(b,m,w,s),w=b.length,-1==c)for(;t(k,b,x,w)<1;)y++,r(b,x<w?T:k,w,s),w=b.length}else 0===c&&(y++,b=[0]);v[h++]=y,b[0]?b[w++]=O[B]||0:(b=[O[B]],w=1)}while((B++<A||null!=b[0])&&N--);p=null!=b[0],v[0]||v.splice(0,1)}if(s==l){for(h=1,N=v[0];N>=10;N/=10,h++);Y(_,o+(_.e=h+14*f-1)+1,a,p)}else _.e=f,_.r=+p;return _}}(),w=/^(-?)0([xbo])(?=\w[\w.]*$)/i,E=/^([^.]+)\.$/,B=/^\.([^.]+)$/,A=/^-?(Infinity|NaN)$/,S=/^\s*\+(?=[\w.])|^\s+|\s+$/g,i=function(e,t,r,n){var i,o=r?t:t.replace(S,"");if(A.test(o))e.s=isNaN(o)?null:o<0?-1:1;else{if(!r&&(o=o.replace(w,(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(E,"$1").replace(B,"0.$1")),t!=o))return new M(o,i);if(M.DEBUG)throw Error(c+"Not a"+(n?" base "+n:"")+" number: "+t);e.s=null}e.c=e.e=null},x.absoluteValue=x.abs=function(){var e=new M(this);return e.s<0&&(e.s=1),e},x.comparedTo=function(e,t){return m(this,new M(e,t))},x.decimalPlaces=x.dp=function(e,t){var r,n,i,o=this;if(null!=e)return g(e,0,p),null==t?t=O:g(t,0,8),Y(new M(o),e+o.e+1,t);if(!(r=o.c))return null;if(n=14*((i=r.length-1)-d(this.e/14)),i=r[i])for(;i%10==0;i/=10,n--);return n<0&&(n=0),n},x.dividedBy=x.div=function(e,t){return r(this,new M(e,t),N,O)},x.dividedToIntegerBy=x.idiv=function(e,t){return r(this,new M(e,t),0,1)},x.exponentiatedBy=x.pow=function(e,t){var r,n,i,o,a,f,l,h,p=this;if((e=new M(e)).c&&!e.isInteger())throw Error(c+"Exponent not an integer: "+H(e));if(null!=t&&(t=new M(t)),a=e.e>14,!p.c||!p.c[0]||1==p.c[0]&&!p.e&&1==p.c.length||!e.c||!e.c[0])return h=new M(Math.pow(+H(p),a?2-_(e):+H(e))),t?h.mod(t):h;if(f=e.s<0,t){if(t.c?!t.c[0]:!t.s)return new M(NaN);(n=!f&&p.isInteger()&&t.isInteger())&&(p=p.mod(t))}else{if(e.e>9&&(p.e>0||p.e<-1||(0==p.e?p.c[0]>1||a&&p.c[1]>=24e7:p.c[0]<8e13||a&&p.c[0]<=9999975e7)))return o=p.s<0&&_(e)?-0:0,p.e>-1&&(o=1/o),new M(f?1/o:o);L&&(o=s(L/14+2))}for(a?(r=new M(.5),f&&(e.s=1),l=_(e)):l=(i=Math.abs(+H(e)))%2,h=new M(T);;){if(l){if(!(h=h.times(p)).c)break;o?h.c.length>o&&(h.c.length=o):n&&(h=h.mod(t))}if(i){if(0===(i=u(i/2)))break;l=i%2}else if(Y(e=e.times(r),e.e+1,1),e.e>14)l=_(e);else{if(0===(i=+H(e)))break;l=i%2}p=p.times(p),o?p.c&&p.c.length>o&&(p.c.length=o):n&&(p=p.mod(t))}return n?h:(f&&(h=T.div(h)),t?h.mod(t):o?Y(h,L,O,void 0):h)},x.integerValue=function(e){var t=new M(this);return null==e?e=O:g(e,0,8),Y(t,t.e+1,e)},x.isEqualTo=x.eq=function(e,t){return 0===m(this,new M(e,t))},x.isFinite=function(){return!!this.c},x.isGreaterThan=x.gt=function(e,t){return m(this,new M(e,t))>0},x.isGreaterThanOrEqualTo=x.gte=function(e,t){return 1===(t=m(this,new M(e,t)))||0===t},x.isInteger=function(){return!!this.c&&d(this.e/14)>this.c.length-2},x.isLessThan=x.lt=function(e,t){return m(this,new M(e,t))<0},x.isLessThanOrEqualTo=x.lte=function(e,t){return-1===(t=m(this,new M(e,t)))||0===t},x.isNaN=function(){return!this.s},x.isNegative=function(){return this.s<0},x.isPositive=function(){return this.s>0},x.isZero=function(){return!!this.c&&0==this.c[0]},x.minus=function(e,t){var r,n,i,o,a=this,s=a.s;if(t=(e=new M(e,t)).s,!s||!t)return new M(NaN);if(s!=t)return e.s=-t,a.plus(e);var u=a.e/14,c=e.e/14,f=a.c,h=e.c;if(!u||!c){if(!f||!h)return f?(e.s=-t,e):new M(h?a:NaN);if(!f[0]||!h[0])return h[0]?(e.s=-t,e):new M(f[0]?a:3==O?-0:0)}if(u=d(u),c=d(c),f=f.slice(),s=u-c){for((o=s<0)?(s=-s,i=f):(c=u,i=h),i.reverse(),t=s;t--;i.push(0));i.reverse()}else for(n=(o=(s=f.length)<(t=h.length))?s:t,s=t=0;t<n;t++)if(f[t]!=h[t]){o=f[t]<h[t];break}if(o&&(i=f,f=h,h=i,e.s=-e.s),(t=(n=h.length)-(r=f.length))>0)for(;t--;f[r++]=0);for(t=l-1;n>s;){if(f[--n]<h[n]){for(r=n;r&&!f[--r];f[r]=t);--f[r],f[n]+=l}f[n]-=h[n]}for(;0==f[0];f.splice(0,1),--c);return f[0]?$(e,f,c):(e.s=3==O?-1:1,e.c=[e.e=0],e)},x.modulo=x.mod=function(e,t){var n,i,o=this;return e=new M(e,t),!o.c||!e.s||e.c&&!e.c[0]?new M(NaN):!e.c||o.c&&!o.c[0]?new M(o):(9==C?(i=e.s,e.s=1,n=r(o,e,0,3),e.s=i,n.s*=i):n=r(o,e,0,C),(e=o.minus(n.times(e))).c[0]||1!=C||(e.s=o.s),e)},x.multipliedBy=x.times=function(e,t){var r,n,i,o,a,s,u,c,f,h,p,y,m,g,_=this,v=_.c,b=(e=new M(e,t)).c;if(!(v&&b&&v[0]&&b[0]))return!_.s||!e.s||v&&!v[0]&&!b||b&&!b[0]&&!v?e.c=e.e=e.s=null:(e.s*=_.s,v&&b?(e.c=[0],e.e=0):e.c=e.e=null),e;for(n=d(_.e/14)+d(e.e/14),e.s*=_.s,(u=v.length)<(h=b.length)&&(m=v,v=b,b=m,i=u,u=h,h=i),i=u+h,m=[];i--;m.push(0));for(g=l,1e7,i=h;--i>=0;){for(r=0,p=b[i]%1e7,y=b[i]/1e7|0,o=i+(a=u);o>i;)r=((c=p*(c=v[--a]%1e7)+(s=y*c+(f=v[a]/1e7|0)*p)%1e7*1e7+m[o]+r)/g|0)+(s/1e7|0)+y*f,m[o--]=c%g;m[o]=r}return r?++n:m.splice(0,1),$(e,m,n)},x.negated=function(){var e=new M(this);return e.s=-e.s||null,e},x.plus=function(e,t){var r,n=this,i=n.s;if(t=(e=new M(e,t)).s,!i||!t)return new M(NaN);if(i!=t)return e.s=-t,n.minus(e);var o=n.e/14,a=e.e/14,s=n.c,u=e.c;if(!o||!a){if(!s||!u)return new M(i/0);if(!s[0]||!u[0])return u[0]?e:new M(s[0]?n:0*i)}if(o=d(o),a=d(a),s=s.slice(),i=o-a){for(i>0?(a=o,r=u):(i=-i,r=s),r.reverse();i--;r.push(0));r.reverse()}for((i=s.length)-(t=u.length)<0&&(r=u,u=s,s=r,t=i),i=0;t;)i=(s[--t]=s[t]+u[t]+i)/l|0,s[t]=l===s[t]?0:s[t]%l;return i&&(s=[i].concat(s),++a),$(e,s,a)},x.precision=x.sd=function(e,t){var r,n,i,o=this;if(null!=e&&e!==!!e)return g(e,1,p),null==t?t=O:g(t,0,8),Y(new M(o),e,t);if(!(r=o.c))return null;if(n=14*(i=r.length-1)+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},x.shiftedBy=function(e){return g(e,-9007199254740991,9007199254740991),this.times("1e"+e)},x.squareRoot=x.sqrt=function(){var e,t,n,i,o,a=this,s=a.c,u=a.s,c=a.e,f=N+4,l=new M("0.5");if(1!==u||!s||!s[0])return new M(!u||u<0&&(!s||s[0])?NaN:s?a:1/0);if(0==(u=Math.sqrt(+H(a)))||u==1/0?(((t=y(s)).length+c)%2==0&&(t+="0"),u=Math.sqrt(+t),c=d((c+1)/2)-(c<0||c%2),n=new M(t=u==1/0?"1e"+c:(t=u.toExponential()).slice(0,t.indexOf("e")+1)+c)):n=new M(u+""),n.c[0])for((u=(c=n.e)+f)<3&&(u=0);;)if(o=n,n=l.times(o.plus(r(a,o,f,1))),y(o.c).slice(0,u)===(t=y(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))||(Y(n,n.e+N+2,1),e=!n.times(n).eq(a));break}if(!i&&(Y(o,o.e+N+2,0),o.times(o).eq(a))){n=o;break}f+=4,u+=4,i=1}return Y(n,n.e+N+1,O,e)},x.toExponential=function(e,t){return null!=e&&(g(e,0,p),e++),U(this,e,t,1)},x.toFixed=function(e,t){return null!=e&&(g(e,0,p),e=e+this.e+1),U(this,e,t)},x.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=j;else if("object"!=typeof r)throw Error(c+"Argument not an object: "+r);if(n=i.toFixed(e,t),i.c){var o,a=n.split("."),s=+r.groupSize,u=+r.secondaryGroupSize,f=r.groupSeparator||"",l=a[0],h=a[1],p=i.s<0,d=p?l.slice(1):l,y=d.length;if(u&&(o=s,s=u,u=o,y-=o),s>0&&y>0){for(o=y%s||s,l=d.substr(0,o);o<y;o+=s)l+=f+d.substr(o,s);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||"")},x.toFraction=function(e){var t,n,i,o,a,s,u,f,l,p,d,m,g=this,_=g.c;if(null!=e&&(!(u=new M(e)).isInteger()&&(u.c||1!==u.s)||u.lt(T)))throw Error(c+"Argument "+(u.isInteger()?"out of range: ":"not an integer: ")+H(u));if(!_)return new M(g);for(t=new M(T),l=n=new M(T),i=f=new M(T),m=y(_),a=t.e=m.length-g.e-1,t.c[0]=h[(s=a%14)<0?14+s:s],e=!e||u.comparedTo(t)>0?a>0?t:l:u,s=D,D=1/0,u=new M(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,d=r(l,i,a*=2,O).minus(g).abs().comparedTo(r(f,n,a,O).minus(g).abs())<1?[l,i]:[f,n],D=s,d},x.toNumber=function(){return+H(this)},x.toPrecision=function(e,t){return null!=e&&g(e,1,p),U(this,e,t,2)},x.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<=k||o>=I?v(y(r.c),o):b(y(r.c),o,"0"):10===e?t=b(y((r=Y(new M(r),N+o+1,O)).c),r.e,"0"):(g(e,2,P.length,"Base"),t=n(b(y(r.c),o,"0"),10,e,i,!0)),i<0&&r.c[0]&&(t="-"+t)),t},x.valueOf=x.toJSON=function(){return H(this)},x._isBigNumber=!0,null!=t&&M.set(t),M}()).default=o.BigNumber=o,void 0===(n=function(){return o}.call(t,r,t,e))||(e.exports=n)}()},19:function(e,t,r){"use strict";r.d(t,"a",(function(){return E})),r.d(t,"b",(function(){return B}));var n=r(13),i=r.n(n),o=r(6),a={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"),a=r.readInt(4,"le");return r.moveTo(a+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},{name:"Targa Image",extension:"tga",mime:"image/x-targa",description:"",signature:[{0:84,1:82,2:85,3:69,4:86,5:73,6:83,7:73,8:79,9:78,10:45,11:88,12:70,13:73,14:76,15:69,16:46}],extractor:function(e,t){var r=new o.a(e);r.moveTo(t-8);var n=r.readInt(4,"le"),i=r.readInt(4,"le");function a(e,t){for(var n=0;n<e;n++){r.moveBackwardsBy(1);var i=r.readInt(t,"le")-1;if(r.moveBackwardsBy(t),i===n)break}}r.moveBackwardsBy(8),n||i?n?(a(65535,2),r.moveBackwardsBy(n)):i&&(a(4294967295,4),r.moveBackwardsBy(6),r.moveBackwardsBy(i)):(!function(){r.moveBackwardsBy(5);for(var e=0;e<1048576;e++){if(r.readInt(2,"le")*r.readInt(2,"le")*r.readInt(1)/8===e-1)break;r.moveBackwardsBy(6)}}(),r.moveBackwardsBy(17));return r.carve(r.position,t+18)}}],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 a=r.readInt(4,"be"),s=r.readInt(1);if([8,9,18].indexOf(s)<0){r.moveBackwardsBy(1);break}if(a!==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")+8),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:function(e,t){var r=new o.a(e.slice(t)),n=["free",32e3,4e4,48e3,56e3,64e3,8e4,96e3,112e3,128e3,16e4,192e3,224e3,256e3,32e4,"bad"],i=[44100,48e3,32e3,"reserved"];if(r.getBytes(3).toString()===[73,68,51].toString()){r.moveTo(6);var a=r.readInt(1)<<21|r.readInt(1)<<14|r.readInt(1)<<7|r.readInt(1);r.moveForwardsBy(a)}else r.moveTo(0);for(;r.hasMore();){if(r.getBytes(3)===[84,65,71].toString()){r.moveForwardsBy(125);break}if(r.getBytes(2).toString()!==[255,251].toString()){r.moveBackwardsBy(2);break}var s=r.readInt(1),u=n[s>>4],c=i[(15&s)>>2],f=(2&s)>>1;if("free"===u||"bad"===u||"reserved"===c){r.moveBackwardsBy(1);break}var l=Math.floor(144*u/c+f);if(r.position+l>r.length){r.moveTo(r.length);break}r.moveForwardsBy(l-3)}return r.carve()}},{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:s},{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:s}],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 a=523===r.readInt(2,"le")?112:96;r.moveForwardsBy(a-2),r.moveForwardsBy(32);var s=r.readInt(4,"le"),u=r.readInt(4,"le");if(s>0)return r.moveTo(s+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 a=n?r.readInt(4,i):r.readInt(8,i);r.moveForwardsBy(10);var s=r.readInt(2,i),u=r.readInt(2,i);return r.moveTo(a),r.moveForwardsBy(s*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:s},{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:"Jar Archive",extension:"jar",mime:"application/java-archive",description:"",signature:{0:80,1:75,2:3,3:4,4:20,5:0,6:8,7:0,8:8,9:0},extractor:s},{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:function(e,t){var r=new o.a(e.slice(t)),n=0,i=0;r.moveForwardsBy(9);var a=r.readInt(2,"be");r.moveForwardsBy(6);var s=r.readInt(4,"be");2048&a&&r.moveForwardsBy(4);2&s&&n++;512&s&&n++;1&s&&i++;256&s&&i++;r.moveForwardsBy(8),a>=2368&&r.moveForwardsBy(4);var u=r.readInt(1,"be");if(r.moveForwardsBy(u),64&s){var c=r.readInt(4,"be");r.moveForwardsBy(c)}r.moveForwardsBy(4);for(;r.hasMore();){var f=r.readInt(4,"be");if(0===f)break;var l=r.readInt(4,"be"),h=f===l?i:i+n;r.moveForwardsBy(l+4*h)}return r.carve()}},{name:"Linux deb package",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:function(e,t){var r=new o.a(e.slice(t));r.moveForwardsBy(8);for(;r.hasMore();){r.moveForwardsBy(48);var n="",i=!0,a=!1,s=void 0;try{for(var u,c=r.getBytes(10)[Symbol.iterator]();!(i=(u=c.next()).done);i=!0){var f=u.value;n+=String.fromCharCode(f)}}catch(e){a=!0,s=e}finally{try{i||null==c.return||c.return()}finally{if(a)throw s}}n=parseInt(n.trim(),10),r.moveForwardsBy(2),r.moveForwardsBy(n)}return r.carve()}},{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:function(e,t){var r=new o.a(e.slice(t));return r.moveTo(112),r.moveTo(4096*(r.readInt(4,"le")+1)),r.carve()}},{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:function(e,t){var r=new o.a(e.slice(t));return r.moveTo(12),r.moveTo(r.readInt(4,"be")),r.carve()}},{name:"Windows Prefetch (Win 10)",extension:"pf",mime:"application/x-pf",description:"",signature:{0:77,1:65,2:77,3:4,7:0},extractor:function(e,t){var r=new o.a(e.slice(t));return r.moveTo(r.readInt(4,"be")),r.carve()}},{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:function(e,t){var r=new o.a(e.slice(t));return r.moveTo(52),r.moveTo(r.readInt(4,"le")),r.carve()}},{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 s(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=new o.a(e.slice(t)),n=r.getBytes(4).join("");return r.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 a=e.readInt(4,r);25===a?(e.moveTo(t+48),i+=e.readInt(8,r),e.moveTo(t+4),t+=e.readInt(4,r)):1===a&&(e.moveTo(t+36),i+=e.readInt(4,r),e.moveTo(t+4),t+=e.readInt(4,r))}return i}(e,n,r,i)}(r,function(e){return"207250237254"===e||"254237250207"===e}(n),function(e){return"206250237254"===e||"207250237254"===e}(n)?"le":"be")),r.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,a=e.readBits(4)+4,s=new Uint8Array(p.length),u=0;u<a;u++)s[p[u]]=e.readBits(3);for(var c=_(s),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,a=0,s=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=a,l=0;l<o;l++)c=c<<1|1&f,f>>=1;for(var h=o<<16|u,p=c;p<n;p+=s)i[p]=h;a++}o++,a<<=1,s<<=1}return[i,t,r]}function v(e,t){var r=i()(t,2),n=r[0],o=r[1],a=n[e.readBits(o)&(1<<o)-1],s=a>>>16;if(s>o)throw new Error(`Invalid Huffman Code length while parsing DEFLATE block at pos ${e.position}: ${s}`);return e.moveBackwardsByBits(o-s),65535&a}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(a);if(e instanceof ArrayBuffer&&(e=new Uint8Array(e)),!(e&&e.length>1))return[];var r=[],n={};for(var i in a)t.includes(i)&&(n[i]=a[i]);for(var o in n){var s=n[o];s.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)}},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}},20: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 a}));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="",a="0x"===t||"\\x"===t,s=0;s<e.length;s++){var u=e[s].toString(16).padStart(r,"0");o+=a?t+u:u+t,n&&(o+=n),s!==e.length-1&&(s+1)%i==0&&(o+="\n")}var c=n.length+(a?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 a(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=[],a=0;a<e.length;a+=r)o.push(parseInt(e.substr(a,r),16));return o}["Auto"].concat(["Space","Percent","Comma","Semi-colon","Colon","Line feed","CRLF","0x","0x with comma","\\x","None"])},207:function(e,t,r){"use strict";e.exports=function(e,t,r,n){for(var i=65535&e|0,o=e>>>16&65535|0,a=0;0!==r;){r-=a=r>2e3?2e3:r;do{o=o+(i=i+t[n++]|0)|0}while(--a);i%=65521,o%=65521}return i|o<<16|0}},208: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,a=i+r;e^=-1;for(var s=i;s<a;s++)e=e>>>8^o[255&(e^t[s])];return-1^e}},23: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}},24: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 a(e){if(e>=55296&&e<=57343)throw Error("Lone surrogate U+"+e.toString(16).toUpperCase()+" is not a scalar value")}function s(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)?(a(e),t=i(e>>12&15|224),t+=s(e,6)):0==(4292870144&e)&&(t=i(e>>18&7|240),t+=s(e,12),t+=s(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 a(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 a,s=[];!1!==(a=f());)s.push(a);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}(s)}}(t)},25: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},26:function(e,t,r){var n,i;!function(o,a){"use strict";void 0===(i="function"==typeof(n=function(){var e=function(){},t="undefined"!=typeof window&&void 0!==window.navigator&&/Trident\/|MSIE /.test(window.navigator.userAgent),r=["trace","debug","info","warn","error"];function n(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 i(){console.log&&(console.log.apply?console.log.apply(console,arguments):Function.prototype.apply.apply(console.log,[console,arguments])),console.trace&&console.trace()}function o(r){return"debug"===r&&(r="log"),"undefined"!=typeof console&&("trace"===r&&t?i:void 0!==console[r]?n(console,r):void 0!==console.log?n(console,"log"):e)}function a(t,n){for(var i=0;i<r.length;i++){var o=r[i];this[o]=i<t?e:this.methodFactory(o,t,n)}this.log=this.debug}function s(e,t,r){return function(){"undefined"!=typeof console&&(a.call(this,t,r),this[e].apply(this,arguments))}}function u(e,t,r){return o(e)||s.apply(this,arguments)}function c(e,t,n){var i,o=this,s="loglevel";function c(){var e;if("undefined"!=typeof window){try{e=window.localStorage[s]}catch(e){}if(void 0===e)try{var t=window.document.cookie,r=t.indexOf(encodeURIComponent(s)+"=");-1!==r&&(e=/^([^;]+)/.exec(t.slice(r))[1])}catch(e){}return void 0===o.levels[e]&&(e=void 0),e}}e&&(s+=":"+e),o.name=e,o.levels={TRACE:0,DEBUG:1,INFO:2,WARN:3,ERROR:4,SILENT:5},o.methodFactory=n||u,o.getLevel=function(){return i},o.setLevel=function(t,n){if("string"==typeof t&&void 0!==o.levels[t.toUpperCase()]&&(t=o.levels[t.toUpperCase()]),!("number"==typeof t&&t>=0&&t<=o.levels.SILENT))throw"log.setLevel() called with invalid level: "+t;if(i=t,!1!==n&&function(e){var t=(r[e]||"silent").toUpperCase();if("undefined"!=typeof window){try{return void(window.localStorage[s]=t)}catch(e){}try{window.document.cookie=encodeURIComponent(s)+"="+t+";"}catch(e){}}}(t),a.call(o,t,e),"undefined"==typeof console&&t<o.levels.SILENT)return"No console available for logging"},o.setDefaultLevel=function(e){c()||o.setLevel(e,!1)},o.enableAll=function(e){o.setLevel(o.levels.TRACE,e)},o.disableAll=function(e){o.setLevel(o.levels.SILENT,e)};var f=c();null==f&&(f=null==t?"WARN":t),o.setLevel(f,!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="undefined"!=typeof window?window.log:void 0;return f.noConflict=function(){return"undefined"!=typeof window&&window.log===f&&(window.log=h),f},f.getLoggers=function(){return l},f})?n.call(t,r,t,e):n)||(e.exports=i)}()},27:function(e,t){var r,n,i=e.exports={};function o(){throw new Error("setTimeout has not been defined")}function a(){throw new Error("clearTimeout has not been defined")}function s(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:a}catch(e){n=a}}();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=s(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===a||!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||s(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}},29: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=[],a=0;a<e.length;a+=r)o.push(parseInt(e.substr(a,r),2));return o}},294:function(e,t){e.exports=function(e){return e&&"object"==typeof e&&"function"==typeof e.copy&&"function"==typeof e.fill&&"function"==typeof e.readUInt8}},295: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}},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},30: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}},320:function(e,t,r){"use strict";(function(t){var n=r(1453),i=r(70),o=new c(4096);function a(e){return"function"==typeof t.alloc?t.alloc(e):new t(e)}function s(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=a(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?a(e):(this._pos+e>t&&(this._slab=a(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 s(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,a,s,u,c,f=t>>1,l=0;l<f&&(a=e[l],i=l+1<<1,u=e[n=1+(l<<1)],!(c=e[i])||u.index<=c.index?(s=u,o=n):(s=c,o=i),!(s.index>=a.index));)e[o]=a,e[l]=s,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,a=this.buf;do{t=128&(e=a[this.pos++]),i|=(127&e)<<o,o+=7}while(t&&o<28);if(t){r=i,n=268435456;do{r+=(127&(e=a[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,a,s,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++)(a=e.charCodeAt(i))<128?n[u++]=a:a<2048?(n[u++]=a>>6|192,n[u++]=63&a|128):55296==(64512&a)&&56320==(64512&(s=e.charCodeAt(i+1)))?(a=65536+((1023&a)<<10)+(1023&s),i++,n[u++]=a>>18|240,n[u++]=a>>12&63|128,n[u++]=a>>6&63|128,n[u++]=63&a|128):(n[u++]=a>>12|224,n[u++]=a>>6&63|128,n[u++]=63&a|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),a=e.buf.slice(i,e.pos);return o.compare(a)},h.prototype.unpackLongBytes=function(){var e,t,r=a(8),n=0,i=0,o=6,s=this.buf;for(t=1&(e=s[this.pos++]),r.fill(0),n|=(127&e)>>1;128&e;)n|=(127&(e=s[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,a=3;r?(p(e,8),t=1):t=0;for(var s=[e.readUIntLE(0,3),e.readUIntLE(3,3),e.readUIntLE(6,2)];a&&!s[--a];);for(;o<a;)for(t|=s[o++]<<i,i+=24;i>7;)n[this.pos++]=127&t|128,t>>=7,i-=7;t|=s[a]<<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,a,s=e.prototype;for(r=0,n=t.length;r<n;r++)s[a="get"+u(o=t[r])]=i.deprecate(c(o),"use `."+o+"` instead of `."+a+"()`");function c(e){return function(){var t=this[e];return"function"==typeof t?t.apply(this,arguments):t}}},bufferFrom:s,capitalize:u,copyOwnProperties:function(e,t,r){var n,i,o,a=Object.getOwnPropertyNames(e);for(n=0,i=a.length;n<i;n++)if(o=a[n],!t.hasOwnProperty(o)||r){var s=Object.getOwnPropertyDescriptor(e,o);Object.defineProperty(t,o,s)}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:a,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(12).Buffer)},337: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 globalThis?globalThis:"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),t instanceof Number&&(t=t.valueOf()),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.legacy||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,!0)):_possibleConstructorReturn(this,_getPrototypeOf(t).call(this,e,r,!0)),_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>>>0,i:this.low>>>0}}}}],[{key:"fromInt",value:function(e){return new t(long_1.fromInt(e,!0))}},{key:"fromNumber",value:function(e){return new t(long_1.fromNumber(e,!0))}},{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,!0))}},{key:"fromExtendedJSON",value:function(e){return new t(e.$timestamp.i,e.$timestamp.t)}}]),t}(long_1);Object.defineProperty(Timestamp.prototype,"_bsontype",{value:"Timestamp"}),Timestamp.MAX_VALUE=Timestamp.MAX_UNSIGNED_VALUE;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}})),a=n[r];r<i;a=n[++r])isNull(a)||!isObject(a)?o+=" "+a:o+=" "+inspect(a);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),a=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 s=t.name?": "+t.name:"";return e.stylize("[Function"+s+"]","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,a,o):o.map((function(n){return formatProperty(e,t,r,a,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=[],a=0,s=t.length;a<s;++a)hasOwnProperty(t,String(a))?o.push(formatProperty(e,t,r,n,String(a),!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 a,s,u;if((u=Object.getOwnPropertyDescriptor(t,i)||{value:t[i]}).get?s=u.set?e.stylize("[Getter/Setter]","special"):e.stylize("[Getter]","special"):u.set&&(s=e.stylize("[Setter]","special")),hasOwnProperty(n,i)||(a="["+i+"]"),s||(e.seen.indexOf(u.value)<0?(s=isNull(r)?formatValue(e,u.value,null):formatValue(e,u.value,r-1)).indexOf("\n")>-1&&(s=o?s.split("\n").map((function(e){return"  "+e})).join("\n").substr(2):"\n"+s.split("\n").map((function(e){return"   "+e})).join("\n")):s=e.stylize("[Circular]","special")),isUndefined(a)){if(o&&i.match(/^\d+$/))return s;(a=JSON.stringify(""+i)).match(/^"([a-zA-Z_][a-zA-Z_0-9]*)"$/)?(a=a.substr(1,a.length-2),a=e.stylize(a,"name")):(a=a.replace(/'/g,"\\'").replace(/\\"/g,'"').replace(/(^"|"$)/g,"'"),a=e.stylize(a,"string"))}return a+": "+s}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(e){return(e=e||{}).legacy?{$regex:this.pattern,$options:this.options}:{$regularExpression:{pattern:this.pattern,options:this.options}}}}],[{key:"parseOptions",value:function(e){return e?e.split("").sort().join(""):""}},{key:"fromExtendedJSON",value:function(t){return t.$regex?"BSONRegExp"===t.$regex._bsontype?t:new e(t.$regex,e.parseOptions(t.$options)):new e(t.$regularExpression.pattern,e.parseOptions(t.$regularExpression.options))}}]),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),t instanceof Number&&(t=t.valueOf()),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||e.legacy)?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),a=r.multiply(i),s=r.multiply(o),u=n.multiply(i),c=n.multiply(o);return a=a.add(s.shiftRightUnsigned(32)),s=new long_1(s.getLowBits(),0).add(u).add(c.shiftRightUnsigned(32)),{high:a=a.add(s.shiftRightUnsigned(32)),low:c=s.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,a=0,s=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=a),i=!0,f[h++]=parseInt(e[v],10),l+=1),i&&(s+=1),n&&(u+=1),a+=1,v+=1):(n&&invalidErr(e,"contains multiple periods"),n=!0,v+=1);if(n&&!a)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=s))for(;"0"===e[c+o-1];)o-=1}else p=0,d=0,f[0]=0,s=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<s;){if(0===d&&o<l){y=EXPONENT_MIN,o=0;break}if(l<s?s-=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=a;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,a=0,s=new Array(36),u=0;u<s.length;u++)s[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--)s[9*p+h]=v%10,v=Math.floor(v/10)}if(y)a=1,s[d]=0;else for(a=36;!s[d];)a-=1,d+=1;if((f=a-1+c)>=34||f<=-7||c>0){if(a>34)return g.push(0),c>0?g.push("E+"+c):c<0&&g.push("E"+c),g.join("");g.push(s[d++]),(a-=1)&&g.push(".");for(var w=0;w<a;w++)g.push(s[d++]);g.push("E"),f>0?g.push("+"+f):g.push(f)}else if(c>=0)for(var E=0;E<a;E++)g.push(s[d++]);else{var B=a+c;if(B>0)for(var A=0;A<B;A++)g.push(s[d++]);else g.push("0");for(g.push(".");B++<0;)g.push("0");for(var S=0;S<a-Math.max(B-1,0);S++)g.push(s[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(e){e=e||{};var t={$ref:this.collection,$id:this.oid};return e.legacy?t:(this.db&&(t.$db=this.db),t=Object.assign(t,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(e){e=e||{};var t=Buffer$3.isBuffer(this.buffer)?this.buffer.toString("base64"):Buffer$3.from(this.buffer).toString("base64"),r=Number(this.sub_type).toString(16);return e.legacy?{$binary:t,$type:1===r.length?"0"+r:r}:{$binary:{base64:t,subType:1===r.length?"0"+r:r}}}}],[{key:"fromExtendedJSON",value:function(t,r){var n,i;return(r=r||{}).legacy?(i=t.$type?parseInt(t.$type,16):0,n=Buffer$3.from(t.$binary,"base64")):(i=t.$binary.subType?parseInt(t.$binary.subType,16):0,n=Buffer$3.from(t.$binary.base64,"base64")),new e(n,i)}}]),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,$regex:regexp,$regularExpression:regexp,$timestamp:timestamp};function deserializeValue(e,t,r,n){if("number"==typeof r){if(n.relaxed||n.legacy)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 a=keysToCodecs[i[o]];if(a)return a.fromExtendedJSON(r,n)}if(null!=r.$date){var s=r.$date,u=new Date;return n.legacy?"number"==typeof s?u.setTime(s):"string"==typeof s&&u.setTime(Date.parse(s)):"string"==typeof s?u.setTime(Date.parse(s)):long_1.isLong(s)?u.setTime(s.toNumber()):"number"==typeof s&&n.relaxed&&u.setTime(s),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,legacy:!1},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,legacy:!1},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.legacy?t.relaxed&&n?{$date:e.getTime()}:{$date:getISOString(e)}: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(t)}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 a=BSON_TYPE_MAPPINGS[r];if(!a)throw new TypeError("Unrecognized or invalid _bsontype: "+r);o=a(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,a=null!=r.cacheFunctionsCrc32&&r.cacheFunctionsCrc32;if(!a)var s=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 j=new decimal128(L);m[b]=j.toObject?j.toObject():j}else if(_===constants.BSON_DATA_BINARY){var P=e[t++]|e[t++]<<8|e[t++]<<16|e[t++]<<24,M=P,U=e[t++];if(P<0)throw new Error("Negative binary type element size found");if(P>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((P=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(P>M-4)throw new Error("Binary type with subtype 0x02 contains to long binary size");if(P<M-4)throw new Error("Binary type with subtype 0x02 contains to short binary size")}m[b]=l&&p?e.slice(t,t+P):new binary(e.slice(t,t+P),U)}else{var z="undefined"!=typeof Uint8Array?new Uint8Array(new ArrayBuffer(P)):new Array(P);if(U===binary.SUBTYPE_BYTE_ARRAY){if((P=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(P>M-4)throw new Error("Binary type with subtype 0x02 contains to long binary size");if(P<M-4)throw new Error("Binary type with subtype 0x02 contains to short binary size")}for(v=0;v<P;v++)z[v]=e[t+v];m[b]=l&&p?z:new binary(z,U)}t+=P}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=a?s(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=a?s(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 ae=e[t++]|e[t++]<<8|e[t++]<<16|e[t++]<<24;if(ae<=0||ae>e.length-t||0!==e[t+ae-1])throw new Error("bad string length in bson");if(!validateUtf8$1(e,t,t+ae-1))throw new Error("Invalid UTF-8 string in BSON document");var se=e.toString("utf8",t,t+ae-1);t+=ae;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(se,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,a,s="big"===r,u=8*i-n-1,c=(1<<u)-1,f=c>>1,l=-7,h=s?0:i-1,p=s?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(a=o&(1<<-l)-1,o>>=-l,l+=n;l>0;a=256*a+e[t+h],h+=p,l-=8);if(0===o)o=1-f;else{if(o===c)return a?NaN:1/0*(d?-1:1);a+=Math.pow(2,n),o-=f}return(d?-1:1)*a*Math.pow(2,o-n)}function writeIEEE754(e,t,r,n,i,o){var a,s,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?(s=isNaN(t)?1:0,a=l):(a=Math.floor(Math.log(t)/Math.LN2),t*(u=Math.pow(2,-a))<1&&(a--,u*=2),(t+=a+h>=1?p/u:p*Math.pow(2,1-h))*u>=2&&(a++,u/=2),a+h>=l?(s=0,a=l):a+h>=1?(s=(t*u-1)*Math.pow(2,i),a+=h):(s=t*Math.pow(2,h-1)*Math.pow(2,i),a=0)),isNaN(t)&&(s=0);i>=8;)e[r+d]=255&s,d+=y,s/=256,i-=8;for(a=a<<i|s,isNaN(t)&&(a+=8),f+=i;f>0;)e[r+d]=255&a,d+=y,a/=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 a=e.write(r,n+4,"utf8");return e[n+3]=a+1>>24&255,e[n+2]=a+1>>16&255,e[n+1]=a+1>>8&255,e[n]=a+1&255,n=n+4+a,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),a=o.getLowBits(),s=o.getHighBits();e[n++]=255&a,e[n++]=a>>8&255,e[n++]=a>>16&255,e[n++]=a>>24&255,e[n++]=255&s,e[n++]=s>>8&255,e[n++]=s>>16&255,e[n++]=s>>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()),a=o.getLowBits(),s=o.getHighBits();return e[n++]=255&a,e[n++]=a>>8&255,e[n++]=a>>16&255,e[n++]=a>>24&255,e[n++]=255&s,e[n++]=s>>8&255,e[n++]=s>>16&255,e[n++]=s>>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,a,s,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,a,s,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(),a=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&a,e[n++]=a>>8&255,e[n++]=a>>16&255,e[n++]=a>>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,a){e[n++]=constants.BSON_DATA_CODE,n+=a?e.write(t,n,"ascii"):e.write(t,n,"utf8"),e[n++]=0;var s=normalizedFunctionString$1(r),u=e.write(s,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,a,s,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,a,s);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),a=r.position;return r.sub_type===binary.SUBTYPE_BYTE_ARRAY&&(a+=4),e[n++]=255&a,e[n++]=a>>8&255,e[n++]=a>>16&255,e[n++]=a>>24&255,e[n++]=r.sub_type,r.sub_type===binary.SUBTYPE_BYTE_ARRAY&&(a-=4,e[n++]=255&a,e[n++]=a>>8&255,e[n++]=a>>16&255,e[n++]=a>>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,a){e[n++]=constants.BSON_DATA_OBJECT,n+=a?e.write(t,n,"ascii"):e.write(t,n,"utf8"),e[n++]=0;var s,u=n,c={$ref:r.collection||r.namespace,$id:r.oid};null!=r.db&&(c.$db=r.db);var f=(s=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,s}function serializeInto(e,t,r,n,i,o,a,s){n=n||0,(s=s||[]).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,a,!0,s);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,a,!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===a)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,a,!1,s);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,a);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===a&&(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,a,!1,s);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,a);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)}}s.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 a=serializer(buffer$1,e,r,0,0,n,i,[]),s=Buffer$8.alloc(a);return buffer$1.copy(s,0,0,s.length),s}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,a="number"==typeof r.index?r.index:0,s=serializer(buffer$1,e,n,0,0,i,o);return buffer$1.copy(t,a,0,s),a+s-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 a=t,s=0;s<r;s++){var u=e[a]|e[a+1]<<8|e[a+2]<<16|e[a+3]<<24;o.index=a,n[i+s]=deserializer(e,o),a+=u}return a}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__(1458),__webpack_require__(12))}).call(this,__webpack_require__(25),__webpack_require__(12).Buffer)},351: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 a=o>=0?arguments[o]:e.cwd();if("string"!=typeof a)throw new TypeError("Arguments to path.resolve must be strings");a&&(t=a+"/"+t,i="/"===a.charAt(0))}return(i?"/":"")+(t=r(n(t.split("/"),(function(e){return!!e})),!i).join("/"))||"."},t.normalize=function(e){var o=t.isAbsolute(e),a="/"===i(e,-1);return(e=r(n(e.split("/"),(function(e){return!!e})),!o).join("/"))||o||(e="."),e&&a&&(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("/")),a=Math.min(i.length,o.length),s=a,u=0;u<a;u++)if(i[u]!==o[u]){s=u;break}var c=[];for(u=s;u<i.length;u++)c.push("..");return(c=c.concat(o.slice(s))).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,a=e.length-1;a>=0;--a){var s=e.charCodeAt(a);if(47!==s)-1===n&&(i=!1,n=a+1),46===s?-1===t?t=a:1!==o&&(o=1):-1!==t&&(o=-1);else if(!i){r=a+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(27))},354:function(e,t,r){"use strict";(function(e){var n=r(12).Buffer,i=r(64).Transform,o=r(355),a=r(70),s=r(127).ok,u=r(12).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 a(){for(var t;null!==(t=e.read());)i.push(t),o+=t.length;e.once("readable",a)}function s(){var t,a=null;o>=u?a=new RangeError(c):t=n.concat(i,o),i=[],e.close(),r(a,t)}e.on("error",(function(t){e.removeListener("end",s),e.removeListener("readable",a),r(t)})),e.on("end",s),e.end(t),a()}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 a=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 s=this;this._hadError=!1,this._handle.onerror=function(e,r){N(s),s._hadError=!0;var n=new Error(e);n.errno=r,n.code=t.codes[r],s.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!a._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)},a.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 a=this;this.flush(o.Z_SYNC_FLUSH,(function(){s(a._handle,"zlib binding closed"),a._handle.params(r,n),a._hadError||(a._level=r,a._strategy=n,i&&i())}))}else e.nextTick(i)},T.prototype.reset=function(){return s(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,a=this._writableState;("function"==typeof t||void 0===t&&!r)&&(r=t,t=o.Z_FULL_FLUSH),a.ended?r&&e.nextTick(r):a.ending?r&&this.once("end",r):a.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,a=this._writableState,s=(a.ending||a.ended)&&(!e||a.length===e.length);return null===e||n.isBuffer(e)?this._handle?(s?i=this._finishFlushFlag:(i=this._flushFlag,e.length>=a.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,a=0,f=this,l="function"==typeof r;if(!l){var h,p=[],d=0;this.on("error",(function(e){h=e})),s(this._handle,"zlib binding closed");do{var y=this._handle.writeSync(t,e,a,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}s(this._handle,"zlib binding closed");var g=this._handle.write(t,e,a,i,this._buffer,this._offset,o);function _(u,c){if(this&&(this.buffer=null,this.callback=null),!f._hadError){var h=o-c;if(s(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(a+=i-u,i=u,!l)return!0;var m=f._handle.write(t,e,a,i,f._buffer,f._offset,f._chunkSize);return m.callback=_,void(m.buffer=e)}if(!l)return!1;r()}}g.buffer=e,g.callback=_},a.inherits(v,T),a.inherits(b,T),a.inherits(w,T),a.inherits(E,T),a.inherits(B,T),a.inherits(A,T),a.inherits(S,T)}).call(this,r(27))},355:function(e,t,r){"use strict";(function(e,n){var i=r(127),o=r(356),a=r(357),s=r(360),u=r(363);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?a.deflateEnd(this.strm):this.mode!==t.INFLATE&&this.mode!==t.GUNZIP&&this.mode!==t.INFLATERAW&&this.mode!==t.UNZIP||s.inflateEnd(this.strm),this.mode=t.NONE,this.dictionary=null)},f.prototype.write=function(e,t,r,n,i,o,a){return this._write(!0,e,t,r,n,i,o,a)},f.prototype.writeSync=function(e,t,r,n,i,o,a){return this._write(!1,e,t,r,n,i,o,a)},f.prototype._write=function(r,o,a,s,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==a&&(a=e.alloc(0),u=0,s=0),this.strm.avail_in=u,this.strm.input=a,this.strm.next_in=s,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=a.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=s.inflate(this.strm,this.flush),this.err===t.Z_NEED_DICT&&this.dictionary&&(this.err=s.inflateSetDictionary(this.strm,this.dictionary),this.err===t.Z_OK?this.err=s.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=s.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,a){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,a),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=a.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=s.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=a.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=a.deflateReset(this.strm);break;case t.INFLATE:case t.INFLATERAW:case t.GUNZIP:this.err=s.inflateReset(this.strm)}this.err!==t.Z_OK&&this._error("Failed to reset stream")},t.Zlib=f}).call(this,r(12).Buffer,r(27))},356: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}},357:function(e,t,r){"use strict";var n,i=r(121),o=r(358),a=r(207),s=r(208),u=r(359);function c(e,t){return e.msg=u[t],t}function f(e){return(e<<1)-(e>4?9:0)}function l(e){for(var t=e.length;--t>=0;)e[t]=0}function h(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 p(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,h(e.strm)}function d(e,t){e.pending_buf[e.pending++]=t}function y(e,t){e.pending_buf[e.pending++]=t>>>8&255,e.pending_buf[e.pending++]=255&t}function m(e,t){var r,n,i=e.max_chain_length,o=e.strstart,a=e.prev_length,s=e.nice_match,u=e.strstart>e.w_size-262?e.strstart-(e.w_size-262):0,c=e.window,f=e.w_mask,l=e.prev,h=e.strstart+258,p=c[o+a-1],d=c[o+a];e.prev_length>=e.good_match&&(i>>=2),s>e.lookahead&&(s=e.lookahead);do{if(c[(r=t)+a]===d&&c[r+a-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=258-(h-o),o=h-258,n>a){if(e.match_start=t,a=n,n>=s)break;p=c[o+a-1],d=c[o+a]}}}while((t=l[t&f])>u&&0!=--i);return a<=e.lookahead?a:e.lookahead}function g(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-262)){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=a(c.adler,f,p,l):2===c.state.wrap&&(c.adler=s(c.adler,f,p,l)),c.next_in+=p,c.total_in+=p,p),e.lookahead+=r,e.lookahead+e.insert>=3)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+3-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<3)););}while(e.lookahead<262&&0!==e.strm.avail_in)}function _(e,t){for(var r,n;;){if(e.lookahead<262){if(g(e),e.lookahead<262&&0===t)return 1;if(0===e.lookahead)break}if(r=0,e.lookahead>=3&&(e.ins_h=(e.ins_h<<e.hash_shift^e.window[e.strstart+3-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-262&&(e.match_length=m(e,r)),e.match_length>=3)if(n=o._tr_tally(e,e.strstart-e.match_start,e.match_length-3),e.lookahead-=e.match_length,e.match_length<=e.max_lazy_match&&e.lookahead>=3){e.match_length--;do{e.strstart++,e.ins_h=(e.ins_h<<e.hash_shift^e.window[e.strstart+3-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&&(p(e,!1),0===e.strm.avail_out))return 1}return e.insert=e.strstart<2?e.strstart:2,4===t?(p(e,!0),0===e.strm.avail_out?3:4):e.last_lit&&(p(e,!1),0===e.strm.avail_out)?1:2}function v(e,t){for(var r,n,i;;){if(e.lookahead<262){if(g(e),e.lookahead<262&&0===t)return 1;if(0===e.lookahead)break}if(r=0,e.lookahead>=3&&(e.ins_h=(e.ins_h<<e.hash_shift^e.window[e.strstart+3-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=2,0!==r&&e.prev_length<e.max_lazy_match&&e.strstart-r<=e.w_size-262&&(e.match_length=m(e,r),e.match_length<=5&&(1===e.strategy||3===e.match_length&&e.strstart-e.match_start>4096)&&(e.match_length=2)),e.prev_length>=3&&e.match_length<=e.prev_length){i=e.strstart+e.lookahead-3,n=o._tr_tally(e,e.strstart-1-e.prev_match,e.prev_length-3),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+3-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=2,e.strstart++,n&&(p(e,!1),0===e.strm.avail_out))return 1}else if(e.match_available){if((n=o._tr_tally(e,0,e.window[e.strstart-1]))&&p(e,!1),e.strstart++,e.lookahead--,0===e.strm.avail_out)return 1}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<2?e.strstart:2,4===t?(p(e,!0),0===e.strm.avail_out?3:4):e.last_lit&&(p(e,!1),0===e.strm.avail_out)?1:2}function b(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 w(){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=8,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(1146),this.dyn_dtree=new i.Buf16(122),this.bl_tree=new i.Buf16(78),l(this.dyn_ltree),l(this.dyn_dtree),l(this.bl_tree),this.l_desc=null,this.d_desc=null,this.bl_desc=null,this.bl_count=new i.Buf16(16),this.heap=new i.Buf16(573),l(this.heap),this.heap_len=0,this.heap_max=0,this.depth=new i.Buf16(573),l(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 E(e){var t;return e&&e.state?(e.total_in=e.total_out=0,e.data_type=2,(t=e.state).pending=0,t.pending_out=0,t.wrap<0&&(t.wrap=-t.wrap),t.status=t.wrap?42:113,e.adler=2===t.wrap?0:1,t.last_flush=0,o._tr_init(t),0):c(e,-2)}function B(e){var t,r=E(e);return 0===r&&((t=e.state).window_size=2*t.w_size,l(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=2,t.match_available=0,t.ins_h=0),r}function A(e,t,r,n,o,a){if(!e)return-2;var s=1;if(-1===t&&(t=6),n<0?(s=0,n=-n):n>15&&(s=2,n-=16),o<1||o>9||8!==r||n<8||n>15||t<0||t>9||a<0||a>4)return c(e,-2);8===n&&(n=9);var u=new w;return e.state=u,u.strm=e,u.wrap=s,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+3-1)/3),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=a,u.method=r,B(e)}n=[new b(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(g(e),0===e.lookahead&&0===t)return 1;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,p(e,!1),0===e.strm.avail_out))return 1;if(e.strstart-e.block_start>=e.w_size-262&&(p(e,!1),0===e.strm.avail_out))return 1}return e.insert=0,4===t?(p(e,!0),0===e.strm.avail_out?3:4):(e.strstart>e.block_start&&(p(e,!1),e.strm.avail_out),1)})),new b(4,4,8,4,_),new b(4,5,16,8,_),new b(4,6,32,32,_),new b(4,4,16,16,v),new b(8,16,32,32,v),new b(8,16,128,128,v),new b(8,32,128,256,v),new b(32,128,258,1024,v),new b(32,258,258,4096,v)],t.deflateInit=function(e,t){return A(e,t,8,15,8,0)},t.deflateInit2=A,t.deflateReset=B,t.deflateResetKeep=E,t.deflateSetHeader=function(e,t){return e&&e.state?2!==e.state.wrap?-2:(e.state.gzhead=t,0):-2},t.deflate=function(e,t){var r,i,a,u;if(!e||!e.state||t>5||t<0)return e?c(e,-2):-2;if(i=e.state,!e.output||!e.input&&0!==e.avail_in||666===i.status&&4!==t)return c(e,0===e.avail_out?-5:-2);if(i.strm=e,r=i.last_flush,i.last_flush=t,42===i.status)if(2===i.wrap)e.adler=0,d(i,31),d(i,139),d(i,8),i.gzhead?(d(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)),d(i,255&i.gzhead.time),d(i,i.gzhead.time>>8&255),d(i,i.gzhead.time>>16&255),d(i,i.gzhead.time>>24&255),d(i,9===i.level?2:i.strategy>=2||i.level<2?4:0),d(i,255&i.gzhead.os),i.gzhead.extra&&i.gzhead.extra.length&&(d(i,255&i.gzhead.extra.length),d(i,i.gzhead.extra.length>>8&255)),i.gzhead.hcrc&&(e.adler=s(e.adler,i.pending_buf,i.pending,0)),i.gzindex=0,i.status=69):(d(i,0),d(i,0),d(i,0),d(i,0),d(i,0),d(i,9===i.level?2:i.strategy>=2||i.level<2?4:0),d(i,3),i.status=113);else{var m=8+(i.w_bits-8<<4)<<8;m|=(i.strategy>=2||i.level<2?0:i.level<6?1:6===i.level?2:3)<<6,0!==i.strstart&&(m|=32),m+=31-m%31,i.status=113,y(i,m),0!==i.strstart&&(y(i,e.adler>>>16),y(i,65535&e.adler)),e.adler=1}if(69===i.status)if(i.gzhead.extra){for(a=i.pending;i.gzindex<(65535&i.gzhead.extra.length)&&(i.pending!==i.pending_buf_size||(i.gzhead.hcrc&&i.pending>a&&(e.adler=s(e.adler,i.pending_buf,i.pending-a,a)),h(e),a=i.pending,i.pending!==i.pending_buf_size));)d(i,255&i.gzhead.extra[i.gzindex]),i.gzindex++;i.gzhead.hcrc&&i.pending>a&&(e.adler=s(e.adler,i.pending_buf,i.pending-a,a)),i.gzindex===i.gzhead.extra.length&&(i.gzindex=0,i.status=73)}else i.status=73;if(73===i.status)if(i.gzhead.name){a=i.pending;do{if(i.pending===i.pending_buf_size&&(i.gzhead.hcrc&&i.pending>a&&(e.adler=s(e.adler,i.pending_buf,i.pending-a,a)),h(e),a=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,d(i,u)}while(0!==u);i.gzhead.hcrc&&i.pending>a&&(e.adler=s(e.adler,i.pending_buf,i.pending-a,a)),0===u&&(i.gzindex=0,i.status=91)}else i.status=91;if(91===i.status)if(i.gzhead.comment){a=i.pending;do{if(i.pending===i.pending_buf_size&&(i.gzhead.hcrc&&i.pending>a&&(e.adler=s(e.adler,i.pending_buf,i.pending-a,a)),h(e),a=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,d(i,u)}while(0!==u);i.gzhead.hcrc&&i.pending>a&&(e.adler=s(e.adler,i.pending_buf,i.pending-a,a)),0===u&&(i.status=103)}else i.status=103;if(103===i.status&&(i.gzhead.hcrc?(i.pending+2>i.pending_buf_size&&h(e),i.pending+2<=i.pending_buf_size&&(d(i,255&e.adler),d(i,e.adler>>8&255),e.adler=0,i.status=113)):i.status=113),0!==i.pending){if(h(e),0===e.avail_out)return i.last_flush=-1,0}else if(0===e.avail_in&&f(t)<=f(r)&&4!==t)return c(e,-5);if(666===i.status&&0!==e.avail_in)return c(e,-5);if(0!==e.avail_in||0!==i.lookahead||0!==t&&666!==i.status){var _=2===i.strategy?function(e,t){for(var r;;){if(0===e.lookahead&&(g(e),0===e.lookahead)){if(0===t)return 1;break}if(e.match_length=0,r=o._tr_tally(e,0,e.window[e.strstart]),e.lookahead--,e.strstart++,r&&(p(e,!1),0===e.strm.avail_out))return 1}return e.insert=0,4===t?(p(e,!0),0===e.strm.avail_out?3:4):e.last_lit&&(p(e,!1),0===e.strm.avail_out)?1:2}(i,t):3===i.strategy?function(e,t){for(var r,n,i,a,s=e.window;;){if(e.lookahead<=258){if(g(e),e.lookahead<=258&&0===t)return 1;if(0===e.lookahead)break}if(e.match_length=0,e.lookahead>=3&&e.strstart>0&&(n=s[i=e.strstart-1])===s[++i]&&n===s[++i]&&n===s[++i]){a=e.strstart+258;do{}while(n===s[++i]&&n===s[++i]&&n===s[++i]&&n===s[++i]&&n===s[++i]&&n===s[++i]&&n===s[++i]&&n===s[++i]&&i<a);e.match_length=258-(a-i),e.match_length>e.lookahead&&(e.match_length=e.lookahead)}if(e.match_length>=3?(r=o._tr_tally(e,1,e.match_length-3),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&&(p(e,!1),0===e.strm.avail_out))return 1}return e.insert=0,4===t?(p(e,!0),0===e.strm.avail_out?3:4):e.last_lit&&(p(e,!1),0===e.strm.avail_out)?1:2}(i,t):n[i.level].func(i,t);if(3!==_&&4!==_||(i.status=666),1===_||3===_)return 0===e.avail_out&&(i.last_flush=-1),0;if(2===_&&(1===t?o._tr_align(i):5!==t&&(o._tr_stored_block(i,0,0,!1),3===t&&(l(i.head),0===i.lookahead&&(i.strstart=0,i.block_start=0,i.insert=0))),h(e),0===e.avail_out))return i.last_flush=-1,0}return 4!==t?0:i.wrap<=0?1:(2===i.wrap?(d(i,255&e.adler),d(i,e.adler>>8&255),d(i,e.adler>>16&255),d(i,e.adler>>24&255),d(i,255&e.total_in),d(i,e.total_in>>8&255),d(i,e.total_in>>16&255),d(i,e.total_in>>24&255)):(y(i,e.adler>>>16),y(i,65535&e.adler)),h(e),i.wrap>0&&(i.wrap=-i.wrap),0!==i.pending?0:1)},t.deflateEnd=function(e){var t;return e&&e.state?42!==(t=e.state.status)&&69!==t&&73!==t&&91!==t&&103!==t&&113!==t&&666!==t?c(e,-2):(e.state=null,113===t?c(e,-3):0):-2},t.deflateSetDictionary=function(e,t){var r,n,o,s,u,c,f,h,p=t.length;if(!e||!e.state)return-2;if(2===(s=(r=e.state).wrap)||1===s&&42!==r.status||r.lookahead)return-2;for(1===s&&(e.adler=a(e.adler,t,p,0)),r.wrap=0,p>=r.w_size&&(0===s&&(l(r.head),r.strstart=0,r.block_start=0,r.insert=0),h=new i.Buf8(r.w_size),i.arraySet(h,t,p-r.w_size,r.w_size,0),t=h,p=r.w_size),u=e.avail_in,c=e.next_in,f=e.input,e.avail_in=p,e.next_in=0,e.input=t,g(r);r.lookahead>=3;){n=r.strstart,o=r.lookahead-2;do{r.ins_h=(r.ins_h<<r.hash_shift^r.window[n+3-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=2,g(r)}return r.strstart+=r.lookahead,r.block_start=r.strstart,r.insert=r.lookahead,r.lookahead=0,r.match_length=r.prev_length=2,r.match_available=0,e.next_in=c,e.input=f,e.avail_in=u,r.wrap=s,0},t.deflateInfo="pako deflate (from Nodeca project)"},358:function(e,t,r){"use strict";var n=r(121);function i(e){for(var t=e.length;--t>=0;)e[t]=0}var o=[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],a=[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],s=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,3,7],u=[16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15],c=new Array(576);i(c);var f=new Array(60);i(f);var l=new Array(512);i(l);var h=new Array(256);i(h);var p=new Array(29);i(p);var d,y,m,g=new Array(30);function _(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 v(e,t){this.dyn_tree=e,this.max_code=0,this.stat_desc=t}function b(e){return e<256?l[e]:l[256+(e>>>7)]}function w(e,t){e.pending_buf[e.pending++]=255&t,e.pending_buf[e.pending++]=t>>>8&255}function E(e,t,r){e.bi_valid>16-r?(e.bi_buf|=t<<e.bi_valid&65535,w(e,e.bi_buf),e.bi_buf=t>>16-e.bi_valid,e.bi_valid+=r-16):(e.bi_buf|=t<<e.bi_valid&65535,e.bi_valid+=r)}function B(e,t,r){E(e,r[2*t],r[2*t+1])}function A(e,t){var r=0;do{r|=1&e,e>>>=1,r<<=1}while(--t>0);return r>>>1}function S(e,t,r){var n,i,o=new Array(16),a=0;for(n=1;n<=15;n++)o[n]=a=a+r[n-1]<<1;for(i=0;i<=t;i++){var s=e[2*i+1];0!==s&&(e[2*i]=A(o[s]++,s))}}function x(e){var t;for(t=0;t<286;t++)e.dyn_ltree[2*t]=0;for(t=0;t<30;t++)e.dyn_dtree[2*t]=0;for(t=0;t<19;t++)e.bl_tree[2*t]=0;e.dyn_ltree[512]=1,e.opt_len=e.static_len=0,e.last_lit=e.matches=0}function T(e){e.bi_valid>8?w(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 N(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 O(e,t,r){for(var n=e.heap[r],i=r<<1;i<=e.heap_len&&(i<e.heap_len&&N(t,e.heap[i+1],e.heap[i],e.depth)&&i++,!N(t,n,e.heap[i],e.depth));)e.heap[r]=e.heap[i],r=i,i<<=1;e.heap[r]=n}function k(e,t,r){var n,i,s,u,c=0;if(0!==e.last_lit)do{n=e.pending_buf[e.d_buf+2*c]<<8|e.pending_buf[e.d_buf+2*c+1],i=e.pending_buf[e.l_buf+c],c++,0===n?B(e,i,t):(B(e,(s=h[i])+256+1,t),0!==(u=o[s])&&E(e,i-=p[s],u),B(e,s=b(--n),r),0!==(u=a[s])&&E(e,n-=g[s],u))}while(c<e.last_lit);B(e,256,t)}function I(e,t){var r,n,i,o=t.dyn_tree,a=t.stat_desc.static_tree,s=t.stat_desc.has_stree,u=t.stat_desc.elems,c=-1;for(e.heap_len=0,e.heap_max=573,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--,s&&(e.static_len-=a[2*i+1]);for(t.max_code=c,r=e.heap_len>>1;r>=1;r--)O(e,o,r);i=u;do{r=e.heap[1],e.heap[1]=e.heap[e.heap_len--],O(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++,O(e,o,1)}while(e.heap_len>=2);e.heap[--e.heap_max]=e.heap[1],function(e,t){var r,n,i,o,a,s,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<=15;o++)e.bl_count[o]=0;for(u[2*e.heap[e.heap_max]+1]=0,r=e.heap_max+1;r<573;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]++,a=0,n>=p&&(a=h[n-p]),s=u[2*n],e.opt_len+=s*(o+a),l&&(e.static_len+=s*(f[2*n+1]+a)));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),S(o,c,e.bl_count)}function F(e,t,r){var n,i,o=-1,a=t[1],s=0,u=7,c=4;for(0===a&&(u=138,c=3),t[2*(r+1)+1]=65535,n=0;n<=r;n++)i=a,a=t[2*(n+1)+1],++s<u&&i===a||(s<c?e.bl_tree[2*i]+=s:0!==i?(i!==o&&e.bl_tree[2*i]++,e.bl_tree[32]++):s<=10?e.bl_tree[34]++:e.bl_tree[36]++,s=0,o=i,0===a?(u=138,c=3):i===a?(u=6,c=3):(u=7,c=4))}function D(e,t,r){var n,i,o=-1,a=t[1],s=0,u=7,c=4;for(0===a&&(u=138,c=3),n=0;n<=r;n++)if(i=a,a=t[2*(n+1)+1],!(++s<u&&i===a)){if(s<c)do{B(e,i,e.bl_tree)}while(0!=--s);else 0!==i?(i!==o&&(B(e,i,e.bl_tree),s--),B(e,16,e.bl_tree),E(e,s-3,2)):s<=10?(B(e,17,e.bl_tree),E(e,s-3,3)):(B(e,18,e.bl_tree),E(e,s-11,7));s=0,o=i,0===a?(u=138,c=3):i===a?(u=6,c=3):(u=7,c=4)}}i(g);var R=!1;function C(e,t,r,i){E(e,0+(i?1:0),3),function(e,t,r,i){T(e),i&&(w(e,r),w(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){R||(!function(){var e,t,r,n,i,u=new Array(16);for(r=0,n=0;n<28;n++)for(p[n]=r,e=0;e<1<<o[n];e++)h[r++]=n;for(h[r-1]=n,i=0,n=0;n<16;n++)for(g[n]=i,e=0;e<1<<a[n];e++)l[i++]=n;for(i>>=7;n<30;n++)for(g[n]=i<<7,e=0;e<1<<a[n]-7;e++)l[256+i++]=n;for(t=0;t<=15;t++)u[t]=0;for(e=0;e<=143;)c[2*e+1]=8,e++,u[8]++;for(;e<=255;)c[2*e+1]=9,e++,u[9]++;for(;e<=279;)c[2*e+1]=7,e++,u[7]++;for(;e<=287;)c[2*e+1]=8,e++,u[8]++;for(S(c,287,u),e=0;e<30;e++)f[2*e+1]=5,f[2*e]=A(e,5);d=new _(c,o,257,286,15),y=new _(f,a,0,30,15),m=new _(new Array(0),s,0,19,7)}(),R=!0),e.l_desc=new v(e.dyn_ltree,d),e.d_desc=new v(e.dyn_dtree,y),e.bl_desc=new v(e.bl_tree,m),e.bi_buf=0,e.bi_valid=0,x(e)},t._tr_stored_block=C,t._tr_flush_block=function(e,t,r,n){var i,o,a=0;e.level>0?(2===e.strm.data_type&&(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 0;if(0!==e.dyn_ltree[18]||0!==e.dyn_ltree[20]||0!==e.dyn_ltree[26])return 1;for(t=32;t<256;t++)if(0!==e.dyn_ltree[2*t])return 1;return 0}(e)),I(e,e.l_desc),I(e,e.d_desc),a=function(e){var t;for(F(e,e.dyn_ltree,e.l_desc.max_code),F(e,e.dyn_dtree,e.d_desc.max_code),I(e,e.bl_desc),t=18;t>=3&&0===e.bl_tree[2*u[t]+1];t--);return e.opt_len+=3*(t+1)+5+5+4,t}(e),i=e.opt_len+3+7>>>3,(o=e.static_len+3+7>>>3)<=i&&(i=o)):i=o=r+5,r+4<=i&&-1!==t?C(e,t,r,n):4===e.strategy||o===i?(E(e,2+(n?1:0),3),k(e,c,f)):(E(e,4+(n?1:0),3),function(e,t,r,n){var i;for(E(e,t-257,5),E(e,r-1,5),E(e,n-4,4),i=0;i<n;i++)E(e,e.bl_tree[2*u[i]+1],3);D(e,e.dyn_ltree,t-1),D(e,e.dyn_dtree,r-1)}(e,e.l_desc.max_code+1,e.d_desc.max_code+1,a+1),k(e,e.dyn_ltree,e.dyn_dtree)),x(e),n&&T(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*(h[r]+256+1)]++,e.dyn_dtree[2*b(t)]++),e.last_lit===e.lit_bufsize-1},t._tr_align=function(e){E(e,2,3),B(e,256,c),function(e){16===e.bi_valid?(w(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)}},359: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"}},360:function(e,t,r){"use strict";var n=r(121),i=r(207),o=r(208),a=r(361),s=r(362);function u(e){return(e>>>24&255)+(e>>>8&65280)+((65280&e)<<8)+((255&e)<<24)}function c(){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 f(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=1,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(852),t.distcode=t.distdyn=new n.Buf32(592),t.sane=1,t.back=-1,0):-2}function l(e){var t;return e&&e.state?((t=e.state).wsize=0,t.whave=0,t.wnext=0,f(e)):-2}function h(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)?-2:(null!==n.window&&n.wbits!==t&&(n.window=null),n.wrap=r,n.wbits=t,l(e))):-2}function p(e,t){var r,n;return e?(n=new c,e.state=n,n.window=null,0!==(r=h(e,t))&&(e.state=null),r):-2}var d,y,m=!0;function g(e){if(m){var t;for(d=new n.Buf32(512),y=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(s(1,e.lens,0,288,d,0,e.work,{bits:9}),t=0;t<32;)e.lens[t++]=5;s(2,e.lens,0,32,y,0,e.work,{bits:5}),m=!1}e.lencode=d,e.lenbits=9,e.distcode=y,e.distbits=5}function _(e,t,r,i){var o,a=e.state;return null===a.window&&(a.wsize=1<<a.wbits,a.wnext=0,a.whave=0,a.window=new n.Buf8(a.wsize)),i>=a.wsize?(n.arraySet(a.window,t,r-a.wsize,a.wsize,0),a.wnext=0,a.whave=a.wsize):((o=a.wsize-a.wnext)>i&&(o=i),n.arraySet(a.window,t,r-i,o,a.wnext),(i-=o)?(n.arraySet(a.window,t,r-i,i,0),a.wnext=i,a.whave=a.wsize):(a.wnext+=o,a.wnext===a.wsize&&(a.wnext=0),a.whave<a.wsize&&(a.whave+=o))),0}t.inflateReset=l,t.inflateReset2=h,t.inflateResetKeep=f,t.inflateInit=function(e){return p(e,15)},t.inflateInit2=p,t.inflate=function(e,t){var r,c,f,l,h,p,d,y,m,v,b,w,E,B,A,S,x,T,N,O,k,I,F,D,R=0,C=new n.Buf8(4),L=[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-2;12===(r=e.state).mode&&(r.mode=13),h=e.next_out,f=e.output,d=e.avail_out,l=e.next_in,c=e.input,p=e.avail_in,y=r.hold,m=r.bits,v=p,b=d,I=0;e:for(;;)switch(r.mode){case 1:if(0===r.wrap){r.mode=13;break}for(;m<16;){if(0===p)break e;p--,y+=c[l++]<<m,m+=8}if(2&r.wrap&&35615===y){r.check=0,C[0]=255&y,C[1]=y>>>8&255,r.check=o(r.check,C,2,0),y=0,m=0,r.mode=2;break}if(r.flags=0,r.head&&(r.head.done=!1),!(1&r.wrap)||(((255&y)<<8)+(y>>8))%31){e.msg="incorrect header check",r.mode=30;break}if(8!=(15&y)){e.msg="unknown compression method",r.mode=30;break}if(m-=4,k=8+(15&(y>>>=4)),0===r.wbits)r.wbits=k;else if(k>r.wbits){e.msg="invalid window size",r.mode=30;break}r.dmax=1<<k,e.adler=r.check=1,r.mode=512&y?10:12,y=0,m=0;break;case 2:for(;m<16;){if(0===p)break e;p--,y+=c[l++]<<m,m+=8}if(r.flags=y,8!=(255&r.flags)){e.msg="unknown compression method",r.mode=30;break}if(57344&r.flags){e.msg="unknown header flags set",r.mode=30;break}r.head&&(r.head.text=y>>8&1),512&r.flags&&(C[0]=255&y,C[1]=y>>>8&255,r.check=o(r.check,C,2,0)),y=0,m=0,r.mode=3;case 3:for(;m<32;){if(0===p)break e;p--,y+=c[l++]<<m,m+=8}r.head&&(r.head.time=y),512&r.flags&&(C[0]=255&y,C[1]=y>>>8&255,C[2]=y>>>16&255,C[3]=y>>>24&255,r.check=o(r.check,C,4,0)),y=0,m=0,r.mode=4;case 4:for(;m<16;){if(0===p)break e;p--,y+=c[l++]<<m,m+=8}r.head&&(r.head.xflags=255&y,r.head.os=y>>8),512&r.flags&&(C[0]=255&y,C[1]=y>>>8&255,r.check=o(r.check,C,2,0)),y=0,m=0,r.mode=5;case 5:if(1024&r.flags){for(;m<16;){if(0===p)break e;p--,y+=c[l++]<<m,m+=8}r.length=y,r.head&&(r.head.extra_len=y),512&r.flags&&(C[0]=255&y,C[1]=y>>>8&255,r.check=o(r.check,C,2,0)),y=0,m=0}else r.head&&(r.head.extra=null);r.mode=6;case 6:if(1024&r.flags&&((w=r.length)>p&&(w=p),w&&(r.head&&(k=r.head.extra_len-r.length,r.head.extra||(r.head.extra=new Array(r.head.extra_len)),n.arraySet(r.head.extra,c,l,w,k)),512&r.flags&&(r.check=o(r.check,c,w,l)),p-=w,l+=w,r.length-=w),r.length))break e;r.length=0,r.mode=7;case 7:if(2048&r.flags){if(0===p)break e;w=0;do{k=c[l+w++],r.head&&k&&r.length<65536&&(r.head.name+=String.fromCharCode(k))}while(k&&w<p);if(512&r.flags&&(r.check=o(r.check,c,w,l)),p-=w,l+=w,k)break e}else r.head&&(r.head.name=null);r.length=0,r.mode=8;case 8:if(4096&r.flags){if(0===p)break e;w=0;do{k=c[l+w++],r.head&&k&&r.length<65536&&(r.head.comment+=String.fromCharCode(k))}while(k&&w<p);if(512&r.flags&&(r.check=o(r.check,c,w,l)),p-=w,l+=w,k)break e}else r.head&&(r.head.comment=null);r.mode=9;case 9:if(512&r.flags){for(;m<16;){if(0===p)break e;p--,y+=c[l++]<<m,m+=8}if(y!==(65535&r.check)){e.msg="header crc mismatch",r.mode=30;break}y=0,m=0}r.head&&(r.head.hcrc=r.flags>>9&1,r.head.done=!0),e.adler=r.check=0,r.mode=12;break;case 10:for(;m<32;){if(0===p)break e;p--,y+=c[l++]<<m,m+=8}e.adler=r.check=u(y),y=0,m=0,r.mode=11;case 11:if(0===r.havedict)return e.next_out=h,e.avail_out=d,e.next_in=l,e.avail_in=p,r.hold=y,r.bits=m,2;e.adler=r.check=1,r.mode=12;case 12:if(5===t||6===t)break e;case 13:if(r.last){y>>>=7&m,m-=7&m,r.mode=27;break}for(;m<3;){if(0===p)break e;p--,y+=c[l++]<<m,m+=8}switch(r.last=1&y,m-=1,3&(y>>>=1)){case 0:r.mode=14;break;case 1:if(g(r),r.mode=20,6===t){y>>>=2,m-=2;break e}break;case 2:r.mode=17;break;case 3:e.msg="invalid block type",r.mode=30}y>>>=2,m-=2;break;case 14:for(y>>>=7&m,m-=7&m;m<32;){if(0===p)break e;p--,y+=c[l++]<<m,m+=8}if((65535&y)!=(y>>>16^65535)){e.msg="invalid stored block lengths",r.mode=30;break}if(r.length=65535&y,y=0,m=0,r.mode=15,6===t)break e;case 15:r.mode=16;case 16:if(w=r.length){if(w>p&&(w=p),w>d&&(w=d),0===w)break e;n.arraySet(f,c,l,w,h),p-=w,l+=w,d-=w,h+=w,r.length-=w;break}r.mode=12;break;case 17:for(;m<14;){if(0===p)break e;p--,y+=c[l++]<<m,m+=8}if(r.nlen=257+(31&y),y>>>=5,m-=5,r.ndist=1+(31&y),y>>>=5,m-=5,r.ncode=4+(15&y),y>>>=4,m-=4,r.nlen>286||r.ndist>30){e.msg="too many length or distance symbols",r.mode=30;break}r.have=0,r.mode=18;case 18:for(;r.have<r.ncode;){for(;m<3;){if(0===p)break e;p--,y+=c[l++]<<m,m+=8}r.lens[L[r.have++]]=7&y,y>>>=3,m-=3}for(;r.have<19;)r.lens[L[r.have++]]=0;if(r.lencode=r.lendyn,r.lenbits=7,F={bits:r.lenbits},I=s(0,r.lens,0,19,r.lencode,0,r.work,F),r.lenbits=F.bits,I){e.msg="invalid code lengths set",r.mode=30;break}r.have=0,r.mode=19;case 19:for(;r.have<r.nlen+r.ndist;){for(;S=(R=r.lencode[y&(1<<r.lenbits)-1])>>>16&255,x=65535&R,!((A=R>>>24)<=m);){if(0===p)break e;p--,y+=c[l++]<<m,m+=8}if(x<16)y>>>=A,m-=A,r.lens[r.have++]=x;else{if(16===x){for(D=A+2;m<D;){if(0===p)break e;p--,y+=c[l++]<<m,m+=8}if(y>>>=A,m-=A,0===r.have){e.msg="invalid bit length repeat",r.mode=30;break}k=r.lens[r.have-1],w=3+(3&y),y>>>=2,m-=2}else if(17===x){for(D=A+3;m<D;){if(0===p)break e;p--,y+=c[l++]<<m,m+=8}m-=A,k=0,w=3+(7&(y>>>=A)),y>>>=3,m-=3}else{for(D=A+7;m<D;){if(0===p)break e;p--,y+=c[l++]<<m,m+=8}m-=A,k=0,w=11+(127&(y>>>=A)),y>>>=7,m-=7}if(r.have+w>r.nlen+r.ndist){e.msg="invalid bit length repeat",r.mode=30;break}for(;w--;)r.lens[r.have++]=k}}if(30===r.mode)break;if(0===r.lens[256]){e.msg="invalid code -- missing end-of-block",r.mode=30;break}if(r.lenbits=9,F={bits:r.lenbits},I=s(1,r.lens,0,r.nlen,r.lencode,0,r.work,F),r.lenbits=F.bits,I){e.msg="invalid literal/lengths set",r.mode=30;break}if(r.distbits=6,r.distcode=r.distdyn,F={bits:r.distbits},I=s(2,r.lens,r.nlen,r.ndist,r.distcode,0,r.work,F),r.distbits=F.bits,I){e.msg="invalid distances set",r.mode=30;break}if(r.mode=20,6===t)break e;case 20:r.mode=21;case 21:if(p>=6&&d>=258){e.next_out=h,e.avail_out=d,e.next_in=l,e.avail_in=p,r.hold=y,r.bits=m,a(e,b),h=e.next_out,f=e.output,d=e.avail_out,l=e.next_in,c=e.input,p=e.avail_in,y=r.hold,m=r.bits,12===r.mode&&(r.back=-1);break}for(r.back=0;S=(R=r.lencode[y&(1<<r.lenbits)-1])>>>16&255,x=65535&R,!((A=R>>>24)<=m);){if(0===p)break e;p--,y+=c[l++]<<m,m+=8}if(S&&0==(240&S)){for(T=A,N=S,O=x;S=(R=r.lencode[O+((y&(1<<T+N)-1)>>T)])>>>16&255,x=65535&R,!(T+(A=R>>>24)<=m);){if(0===p)break e;p--,y+=c[l++]<<m,m+=8}y>>>=T,m-=T,r.back+=T}if(y>>>=A,m-=A,r.back+=A,r.length=x,0===S){r.mode=26;break}if(32&S){r.back=-1,r.mode=12;break}if(64&S){e.msg="invalid literal/length code",r.mode=30;break}r.extra=15&S,r.mode=22;case 22:if(r.extra){for(D=r.extra;m<D;){if(0===p)break e;p--,y+=c[l++]<<m,m+=8}r.length+=y&(1<<r.extra)-1,y>>>=r.extra,m-=r.extra,r.back+=r.extra}r.was=r.length,r.mode=23;case 23:for(;S=(R=r.distcode[y&(1<<r.distbits)-1])>>>16&255,x=65535&R,!((A=R>>>24)<=m);){if(0===p)break e;p--,y+=c[l++]<<m,m+=8}if(0==(240&S)){for(T=A,N=S,O=x;S=(R=r.distcode[O+((y&(1<<T+N)-1)>>T)])>>>16&255,x=65535&R,!(T+(A=R>>>24)<=m);){if(0===p)break e;p--,y+=c[l++]<<m,m+=8}y>>>=T,m-=T,r.back+=T}if(y>>>=A,m-=A,r.back+=A,64&S){e.msg="invalid distance code",r.mode=30;break}r.offset=x,r.extra=15&S,r.mode=24;case 24:if(r.extra){for(D=r.extra;m<D;){if(0===p)break e;p--,y+=c[l++]<<m,m+=8}r.offset+=y&(1<<r.extra)-1,y>>>=r.extra,m-=r.extra,r.back+=r.extra}if(r.offset>r.dmax){e.msg="invalid distance too far back",r.mode=30;break}r.mode=25;case 25:if(0===d)break e;if(w=b-d,r.offset>w){if((w=r.offset-w)>r.whave&&r.sane){e.msg="invalid distance too far back",r.mode=30;break}w>r.wnext?(w-=r.wnext,E=r.wsize-w):E=r.wnext-w,w>r.length&&(w=r.length),B=r.window}else B=f,E=h-r.offset,w=r.length;w>d&&(w=d),d-=w,r.length-=w;do{f[h++]=B[E++]}while(--w);0===r.length&&(r.mode=21);break;case 26:if(0===d)break e;f[h++]=r.length,d--,r.mode=21;break;case 27:if(r.wrap){for(;m<32;){if(0===p)break e;p--,y|=c[l++]<<m,m+=8}if(b-=d,e.total_out+=b,r.total+=b,b&&(e.adler=r.check=r.flags?o(r.check,f,b,h-b):i(r.check,f,b,h-b)),b=d,(r.flags?y:u(y))!==r.check){e.msg="incorrect data check",r.mode=30;break}y=0,m=0}r.mode=28;case 28:if(r.wrap&&r.flags){for(;m<32;){if(0===p)break e;p--,y+=c[l++]<<m,m+=8}if(y!==(4294967295&r.total)){e.msg="incorrect length check",r.mode=30;break}y=0,m=0}r.mode=29;case 29:I=1;break e;case 30:I=-3;break e;case 31:return-4;case 32:default:return-2}return e.next_out=h,e.avail_out=d,e.next_in=l,e.avail_in=p,r.hold=y,r.bits=m,(r.wsize||b!==e.avail_out&&r.mode<30&&(r.mode<27||4!==t))&&_(e,e.output,e.next_out,b-e.avail_out)?(r.mode=31,-4):(v-=e.avail_in,b-=e.avail_out,e.total_in+=v,e.total_out+=b,r.total+=b,r.wrap&&b&&(e.adler=r.check=r.flags?o(r.check,f,b,e.next_out-b):i(r.check,f,b,e.next_out-b)),e.data_type=r.bits+(r.last?64:0)+(12===r.mode?128:0)+(20===r.mode||15===r.mode?256:0),(0===v&&0===b||4===t)&&0===I&&(I=-5),I)},t.inflateEnd=function(e){if(!e||!e.state)return-2;var t=e.state;return t.window&&(t.window=null),e.state=null,0},t.inflateGetHeader=function(e,t){var r;return e&&e.state?0==(2&(r=e.state).wrap)?-2:(r.head=t,t.done=!1,0):-2},t.inflateSetDictionary=function(e,t){var r,n=t.length;return e&&e.state?0!==(r=e.state).wrap&&11!==r.mode?-2:11===r.mode&&i(1,t,n,0)!==r.check?-3:_(e,t,n,n)?(r.mode=31,-4):(r.havedict=1,0):-2},t.inflateInfo="pako inflate (from Nodeca project)"},361:function(e,t,r){"use strict";e.exports=function(e,t){var r,n,i,o,a,s,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,a=o-(t-e.avail_out),s=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-a)){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<s);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<s?s-o+257:257-(o-s),r.hold=p,r.bits=d}},362:function(e,t,r){"use strict";var n=r(121),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],a=[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],s=[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),j=null,P=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=j=l,_=19):1===e?(D=i,R-=257,j=o,P-=257,_=256):(D=a,j=s,_=-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=j[P+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}},363: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}},39:function(e,t,r){"use strict";var n=r(59),i=Object.keys||function(e){var t=[];for(var r in e)t.push(r);return t};e.exports=l;var o=Object.create(r(53));o.inherits=r(14);var a=r(96),s=r(77);o.inherits(l,a);for(var u=i(s.prototype),c=0;c<u.length;c++){var f=u[c];l.prototype[f]||(l.prototype[f]=s.prototype[f])}function l(e){if(!(this instanceof l))return new l(e);a.call(this,e),s.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)}},4:function(e,t,r){var n=r(44),i=r(23);e.exports=function(e,t){return!t||"object"!==n(t)&&"function"!=typeof t?i(e):t}},40:function(e,t){var r={}.toString;e.exports=Array.isArray||function(e){return"[object Array]"==r.call(e)}},44: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},45:function(e,t,r){var n=function(e){"use strict";var t=Object.prototype,r=t.hasOwnProperty,n="function"==typeof Symbol?Symbol:{},i=n.iterator||"@@iterator",o=n.asyncIterator||"@@asyncIterator",a=n.toStringTag||"@@toStringTag";function s(e,t,r,n){var i=t&&t.prototype instanceof f?t:f,o=Object.create(i.prototype),a=new E(n||[]);return o._invoke=function(e,t,r){var n="suspendedStart";return function(i,o){if("executing"===n)throw new Error("Generator is already running");if("completed"===n){if("throw"===i)throw o;return A()}for(r.method=i,r.arg=o;;){var a=r.delegate;if(a){var s=v(a,r);if(s){if(s===c)continue;return s}}if("next"===r.method)r.sent=r._sent=r.arg;else if("throw"===r.method){if("suspendedStart"===n)throw n="completed",r.arg;r.dispatchException(r.arg)}else"return"===r.method&&r.abrupt("return",r.arg);n="executing";var f=u(e,t,r);if("normal"===f.type){if(n=r.done?"completed":"suspendedYield",f.arg===c)continue;return{value:f.arg,done:r.done}}"throw"===f.type&&(n="completed",r.method="throw",r.arg=f.arg)}}}(e,r,a),o}function u(e,t,r){try{return{type:"normal",arg:e.call(t,r)}}catch(e){return{type:"throw",arg:e}}}e.wrap=s;var c={};function f(){}function l(){}function h(){}var p={};p[i]=function(){return this};var d=Object.getPrototypeOf,y=d&&d(d(B([])));y&&y!==t&&r.call(y,i)&&(p=y);var m=h.prototype=f.prototype=Object.create(p);function g(e){["next","throw","return"].forEach((function(t){e[t]=function(e){return this._invoke(t,e)}}))}function _(e,t){var n;this._invoke=function(i,o){function a(){return new t((function(n,a){!function n(i,o,a,s){var c=u(e[i],e,o);if("throw"!==c.type){var f=c.arg,l=f.value;return l&&"object"==typeof l&&r.call(l,"__await")?t.resolve(l.__await).then((function(e){n("next",e,a,s)}),(function(e){n("throw",e,a,s)})):t.resolve(l).then((function(e){f.value=e,a(f)}),(function(e){return n("throw",e,a,s)}))}s(c.arg)}(i,o,n,a)}))}return n=n?n.then(a,a):a()}}function v(e,t){var r=e.iterator[t.method];if(void 0===r){if(t.delegate=null,"throw"===t.method){if(e.iterator.return&&(t.method="return",t.arg=void 0,v(e,t),"throw"===t.method))return c;t.method="throw",t.arg=new TypeError("The iterator does not provide a 'throw' method")}return c}var n=u(r,e.iterator,t.arg);if("throw"===n.type)return t.method="throw",t.arg=n.arg,t.delegate=null,c;var i=n.arg;return i?i.done?(t[e.resultName]=i.value,t.next=e.nextLoc,"return"!==t.method&&(t.method="next",t.arg=void 0),t.delegate=null,c):i:(t.method="throw",t.arg=new TypeError("iterator result is not an object"),t.delegate=null,c)}function b(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 w(e){var t=e.completion||{};t.type="normal",delete t.arg,e.completion=t}function E(e){this.tryEntries=[{tryLoc:"root"}],e.forEach(b,this),this.reset(!0)}function B(e){if(e){var t=e[i];if(t)return t.call(e);if("function"==typeof e.next)return e;if(!isNaN(e.length)){var n=-1,o=function t(){for(;++n<e.length;)if(r.call(e,n))return t.value=e[n],t.done=!1,t;return t.value=void 0,t.done=!0,t};return o.next=o}}return{next:A}}function A(){return{value:void 0,done:!0}}return l.prototype=m.constructor=h,h.constructor=l,h[a]=l.displayName="GeneratorFunction",e.isGeneratorFunction=function(e){var t="function"==typeof e&&e.constructor;return!!t&&(t===l||"GeneratorFunction"===(t.displayName||t.name))},e.mark=function(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,h):(e.__proto__=h,a in e||(e[a]="GeneratorFunction")),e.prototype=Object.create(m),e},e.awrap=function(e){return{__await:e}},g(_.prototype),_.prototype[o]=function(){return this},e.AsyncIterator=_,e.async=function(t,r,n,i,o){void 0===o&&(o=Promise);var a=new _(s(t,r,n,i),o);return e.isGeneratorFunction(r)?a:a.next().then((function(e){return e.done?e.value:a.next()}))},g(m),m[a]="Generator",m[i]=function(){return this},m.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=B,E.prototype={constructor:E,reset:function(e){if(this.prev=0,this.next=0,this.sent=this._sent=void 0,this.done=!1,this.delegate=null,this.method="next",this.arg=void 0,this.tryEntries.forEach(w),!e)for(var t in this)"t"===t.charAt(0)&&r.call(this,t)&&!isNaN(+t.slice(1))&&(this[t]=void 0)},stop:function(){this.done=!0;var e=this.tryEntries[0].completion;if("throw"===e.type)throw e.arg;return this.rval},dispatchException:function(e){if(this.done)throw e;var t=this;function n(r,n){return a.type="throw",a.arg=e,t.next=r,n&&(t.method="next",t.arg=void 0),!!n}for(var i=this.tryEntries.length-1;i>=0;--i){var o=this.tryEntries[i],a=o.completion;if("root"===o.tryLoc)return n("end");if(o.tryLoc<=this.prev){var s=r.call(o,"catchLoc"),u=r.call(o,"finallyLoc");if(s&&u){if(this.prev<o.catchLoc)return n(o.catchLoc,!0);if(this.prev<o.finallyLoc)return n(o.finallyLoc)}else if(s){if(this.prev<o.catchLoc)return n(o.catchLoc,!0)}else{if(!u)throw new Error("try statement without catch or finally");if(this.prev<o.finallyLoc)return n(o.finallyLoc)}}}},abrupt:function(e,t){for(var n=this.tryEntries.length-1;n>=0;--n){var i=this.tryEntries[n];if(i.tryLoc<=this.prev&&r.call(i,"finallyLoc")&&this.prev<i.finallyLoc){var o=i;break}}o&&("break"===e||"continue"===e)&&o.tryLoc<=t&&t<=o.finallyLoc&&(o=null);var a=o?o.completion:{};return a.type=e,a.arg=t,o?(this.method="next",this.next=o.finallyLoc,c):this.complete(a)},complete:function(e,t){if("throw"===e.type)throw e.arg;return"break"===e.type||"continue"===e.type?this.next=e.arg:"return"===e.type?(this.rval=this.arg=e.arg,this.method="return",this.next="end"):"normal"===e.type&&t&&(this.next=t),c},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),w(r),c}},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;w(r)}return i}}throw new Error("illegal catch attempt")},delegateYield:function(e,t,r){return this.delegate={iterator:B(e),resultName:t,nextLoc:r},"next"===this.method&&(this.arg=void 0),c}},e}(e.exports);try{regeneratorRuntime=n}catch(e){Function("r","regeneratorRuntime = r")(n)}},46: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},47: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){var t,r,n=c(e),a=n[0],s=n[1],u=new o(function(e,t,r){return 3*(t+r)/4-r}(0,a,s)),f=0,l=s>0?a-4:a;for(r=0;r<l;r+=4)t=i[e.charCodeAt(r)]<<18|i[e.charCodeAt(r+1)]<<12|i[e.charCodeAt(r+2)]<<6|i[e.charCodeAt(r+3)],u[f++]=t>>16&255,u[f++]=t>>8&255,u[f++]=255&t;2===s&&(t=i[e.charCodeAt(r)]<<2|i[e.charCodeAt(r+1)]>>4,u[f++]=255&t);1===s&&(t=i[e.charCodeAt(r)]<<10|i[e.charCodeAt(r+1)]<<4|i[e.charCodeAt(r+2)]>>2,u[f++]=t>>8&255,u[f++]=255&t);return u},t.fromByteArray=function(e){for(var t,r=e.length,i=r%3,o=[],a=0,s=r-i;a<s;a+=16383)o.push(f(e,a,a+16383>s?s:a+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,a="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",s=0,u=a.length;s<u;++s)n[s]=a[s],i[a.charCodeAt(s)]=s;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,a=[],s=t;s<r;s+=3)i=(e[s]<<16&16711680)+(e[s+1]<<8&65280)+(255&e[s+2]),a.push(n[(o=i)>>18&63]+n[o>>12&63]+n[o>>6&63]+n[63&o]);return a.join("")}i["-".charCodeAt(0)]=62,i["_".charCodeAt(0)]=63},48:function(e,t){t.read=function(e,t,r,n,i){var o,a,s=8*i-n-1,u=(1<<s)-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+=s;f>0;o=256*o+e[t+l],l+=h,f-=8);for(a=o&(1<<-f)-1,o>>=-f,f+=n;f>0;a=256*a+e[t+l],l+=h,f-=8);if(0===o)o=1-c;else{if(o===u)return a?NaN:1/0*(p?-1:1);a+=Math.pow(2,n),o-=c}return(p?-1:1)*a*Math.pow(2,o-n)},t.write=function(e,t,r,n,i,o){var a,s,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?(s=isNaN(t)?1:0,a=f):(a=Math.floor(Math.log(t)/Math.LN2),t*(u=Math.pow(2,-a))<1&&(a--,u*=2),(t+=a+l>=1?h/u:h*Math.pow(2,1-l))*u>=2&&(a++,u/=2),a+l>=f?(s=0,a=f):a+l>=1?(s=(t*u-1)*Math.pow(2,i),a+=l):(s=t*Math.pow(2,l-1)*Math.pow(2,i),a=0));i>=8;e[r+p]=255&s,p+=d,s/=256,i-=8);for(a=a<<i|s,c+=i;c>0;e[r+p]=255&a,p+=d,a/=256,c-=8);e[r+p-d]|=128*y}},49:function(e,t){e.exports=function(e){if(Array.isArray(e))return e}},5:function(e,t,r){var n=r(46);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)}},50: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 a,s=e[Symbol.iterator]();!(n=(a=s.next()).done)&&(r.push(a.value),!t||r.length!==t);n=!0);}catch(e){i=!0,o=e}finally{try{n||null==s.return||s.return()}finally{if(i)throw o}}return r}}},506:function(e,t,r){"use strict";(function(t){var n=r(320),i=r(12),o=r(70),a=n.Tap,s=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 a(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 j,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 j(){this.str=void 0}function P(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,a={};Object.keys(t.registry).forEach((function(e){a[e]=t.registry[e]}));try{return s("instantiating logical type for %s",e.logicalType),new i(e,t)}catch(r){if(s("failed to instantiate logical type for %s",e.logicalType),t.assertLogicalTypes)throw r;p=null,t.namespace=o,t.registry=a}}}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 a,s=t.wrapUnions;t.wrapUnions=!0;try{a=y.forSchema(Object.keys(o).map((function(e){return o[e]})),t)}catch(e){throw t.wrapUnions=s,e}return t.wrapUnions=s,a}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"],a=-1,s=null;for(t=0,r=e.length;t<r;t++)n=e[t],(i=o.indexOf(n.typeName))>a&&(a=i,s=n);return s}(r);case"string":return function(e,t){var r,n,i,o,a={};for(r=0,n=e.length;r<n;r++){if("string"===(i=e[r]).typeName)return i;var s,u;for(o=i.symbols,s=0,u=o.length;s<u;s++)a[o[s]]=!0}return y.forSchema({type:"enum",symbols:Object.keys(a)},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,a,s=[],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,s.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,s.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))}a=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,a=r.types.slice();for(i=0,o=a.length;i<o&&!a[i].isValid(n);i++);if(i>0){var s=a[0];a[0]=a[i],a[i]=s,r=y.forSchema(a,t)}}return{name:e,type:r,default:c[e]}}))}:{type:"map",values:y.forTypes(s,t)};return y.forSchema(a,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){s("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 a(e),new a(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 a(e,t),i=P(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 a(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 a(e),i=P(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 a(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 a=this.types[r];if(null===e||3===i)return a._copy(e,t);switch(n){case 3:var s={};return s[a.branchName]=a._copy(e,t),s;default:return a._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 a=o[0],s=this._branchIndices[a];if(void 0!==s)return r?(n.push(a),i=this.types[s]._check(e[a],t,r,n),n.pop(),i):this.types[s]._check(e[a],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,a;for(n=0,i=this.types.length;n<i;n++){try{o=this.types[n].createResolver(t,r)}catch(e){continue}return a=this.types[n]._branchConstructor,void(e._read=a?function(e){return new a(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 a=this.types[0];return null===e&&"null"===a.typeName?null:new a._branchConstructor(a._copy(e,t))}if(null===e&&void 0!==this._branchIndices.null)return null;if("object"==typeof e){var s=Object.keys(e);if(1===s.length){var u,c,f=s[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,a,s,u=Object.keys(e),c=!0;if(r){for(a=n.length,n.push(""),i=0,o=u.length;i<o;i++)s=n[a]=u[i],this.valuesType._check(e[s],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),a=o.length;if(a)for(e.writeLong(a),r=0;r<a;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,a=Object.keys(e),s={};for(r=0,n=a.length;r<n;r++)s[i=a[r]]=o._copy(e[i],t);return s}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,a,s=!0;if(r){for(a=n.length,n.push(""),i=0,o=e.length;i<o;i++)n[a]=""+i,this.itemsType._check(e[i],t,r,n)||(s=!1);n.pop()}else for(i=0,o=e.length;i<o;i++)if(!this.itemsType._check(e[i],t))return!1;return s},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,a=e.length,s=t.length;for(r=0,i=Math.min(a,s);r<i;r++)if(o=this.itemsType.compare(e[r],t[r]))return o;return n.compare(a,s)},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,a,s,u,c=[],f=[],l=[],h="";for(t=0,r=this.fields.length;t<r;t++)s=void 0!==(a=(n=this.fields[t]).defaultValue)(),i=n.name,e&&this._isError&&"stack"===i&&y.isType(n.type,"string")&&!s&&(u=n),f.push("v"+t),h+="  ",s?(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(a)):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",a=[];for(e=0,t=this.fields.length;e<t;e++)r=this.fields[e],i.push("t"+e),a.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),a.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,a)},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,a,s,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(a=h[i]),f=[],o=0;o<c.length;o++)d[s=c[o]]&&f.push(s);if(f.length>1)throw new Error(u("ambiguous aliasing for %s.%s (%s)",t.name,a.name,f));if(f.length)s=f[0],l={resolver:a.type.createResolver(d[s].type,r),name:"_"+a.name},m[s]?m[s].push(l):m[s]=[l],y.push(l.name);else{if(void 0===a.defaultValue())throw new Error(u("no matching field for default-less %s.%s",t.name,a.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[s=(a=t.fields[i]).name])w+=~g&&i>=g?"    ":"  ",v.push("r"+i),b.push(a.type),w+="r"+i+"._skip(t);\n";else for(o=m[s].length;o--;)w+=~g&&i>=g?"    ":"  ",v.push("r"+i+"f"+o),l=m[s][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,a,s=this.fields;for(r=0,n=s.length;r<n;r++)if(o=(i=s[r])._order,a=i.type,o){if(o*=a._match(e,t))return o}else a._skip(e),a._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,a=t&&t.fieldHook,s=[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)),a&&(o=a(i,o,this)),s.push(o);var u=this.recordConstructor;return new(u.bind.apply(u,s))},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 a=e.aliases;a.length&&(n.aliases=a);var s=e.doc;void 0!==s&&(n.doc=s)}return n}))},F.prototype.compare=function(e,t){var r,n,i,o,a,s,u=this.fields;for(r=0,n=u.length;r<n;r++)if(o=(i=u[r]).name,a=i._order,s=i.type,a&&(a*=s.compare(e[o],t[o])))return a;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(12).Buffer)},51:function(e,t){e.exports=function(){throw new TypeError("Invalid attempt to destructure non-iterable instance")}},53: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(12).Buffer)},59: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,a,s=arguments.length;switch(s){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(s-1),a=0;a<o.length;)o[a++]=arguments[a];return t.nextTick((function(){e.apply(null,o)}))}}}:e.exports=t}).call(this,r(27))},6:function(e,t,r){"use strict";r.d(t,"a",(function(){return s}));var n=r(1),i=r.n(n),o=r(2),a=r.n(o),s=function(){function e(t){i()(this,e),this.bytes=t,this.length=this.bytes.length,this.position=0,this.bitPos=0}return a()(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(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0,t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:this.position;return this.bitPos>0&&t++,this.bytes.slice(e,t)}}]),e}()},64:function(e,t,r){e.exports=i;var n=r(69).EventEmitter;function i(){n.call(this)}r(14)(i,n),i.Readable=r(75),i.Writable=r(140),i.Duplex=r(141),i.Transform=r(142),i.PassThrough=r(143),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",s),r.on("close",u));var a=!1;function s(){a||(a=!0,e.end())}function u(){a||(a=!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",s),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}},69: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 a=Number.isNaN||function(e){return e!=e};function s(){s.init.call(this)}e.exports=s,s.EventEmitter=s,s.prototype._events=void 0,s.prototype._eventsCount=0,s.prototype._maxListeners=void 0;var u=10;function c(e){if("function"!=typeof e)throw new TypeError('The "listener" argument must be of type Function. Received type '+typeof e)}function f(e){return void 0===e._maxListeners?s.defaultMaxListeners:e._maxListeners}function l(e,t,r,n){var i,o,a,s;if(c(r),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),a=o[t]),void 0===a)a=o[t]=r,++e._eventsCount;else if("function"==typeof a?a=o[t]=n?[r,a]:[a,r]:n?a.unshift(r):a.push(r),(i=f(e))>0&&a.length>i&&!a.warned){a.warned=!0;var u=new Error("Possible EventEmitter memory leak detected. "+a.length+" "+String(t)+" listeners added. Use emitter.setMaxListeners() to increase limit");u.name="MaxListenersExceededWarning",u.emitter=e,u.type=t,u.count=a.length,s=u,console&&console.warn&&console.warn(s)}return e}function h(){if(!this.fired)return this.target.removeListener(this.type,this.wrapFn),this.fired=!0,0===arguments.length?this.listener.call(this.target):this.listener.apply(this.target,arguments)}function p(e,t,r){var n={fired:!1,wrapFn:void 0,target:e,type:t,listener:r},i=h.bind(n);return i.listener=r,n.wrapFn=i,i}function d(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):m(i,i.length)}function y(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 m(e,t){for(var r=new Array(t),n=0;n<t;++n)r[n]=e[n];return r}Object.defineProperty(s,"defaultMaxListeners",{enumerable:!0,get:function(){return u},set:function(e){if("number"!=typeof e||e<0||a(e))throw new RangeError('The value of "defaultMaxListeners" is out of range. It must be a non-negative number. Received '+e+".");u=e}}),s.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},s.prototype.setMaxListeners=function(e){if("number"!=typeof e||e<0||a(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},s.prototype.getMaxListeners=function(){return f(this)},s.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 a;if(t.length>0&&(a=t[0]),a instanceof Error)throw a;var s=new Error("Unhandled error."+(a?" ("+a.message+")":""));throw s.context=a,s}var u=i[e];if(void 0===u)return!1;if("function"==typeof u)o(u,this,t);else{var c=u.length,f=m(u,c);for(r=0;r<c;++r)o(f[r],this,t)}return!0},s.prototype.addListener=function(e,t){return l(this,e,t,!1)},s.prototype.on=s.prototype.addListener,s.prototype.prependListener=function(e,t){return l(this,e,t,!0)},s.prototype.once=function(e,t){return c(t),this.on(e,p(this,e,t)),this},s.prototype.prependOnceListener=function(e,t){return c(t),this.prependListener(e,p(this,e,t)),this},s.prototype.removeListener=function(e,t){var r,n,i,o,a;if(c(t),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){a=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,a||t)}return this},s.prototype.off=s.prototype.removeListener,s.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},s.prototype.listeners=function(e){return d(this,e,!0)},s.prototype.rawListeners=function(e){return d(this,e,!1)},s.listenerCount=function(e,t){return"function"==typeof e.listenerCount?e.listenerCount(t):y.call(e,t)},s.prototype.listenerCount=y,s.prototype.eventNames=function(){return this._eventsCount>0?n(this._events):[]}},7:function(e,t,r){"use strict";var n=r(1),i=r.n(n),o=r(4),a=r.n(o),s=r(3),u=r.n(s),c=r(23),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=a()(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},70: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(s(arguments[r]));return t.join(" ")}r=1;for(var n=arguments,o=n.length,a=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)?a+=" "+u:a+=" "+s(u);return a},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,a={};function s(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=s.styles[t];return r?"["+s.colors[r][0]+"m"+e+"["+s.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 a=Object.keys(r),s=function(e){var t={};return e.forEach((function(e,r){t[e]=!0})),t}(a);if(e.showHidden&&(a=Object.getOwnPropertyNames(r)),E(r)&&(a.indexOf("message")>=0||a.indexOf("description")>=0))return l(r);if(0===a.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!==a.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=[],a=0,s=t.length;a<s;++a)N(t,String(a))?o.push(h(e,t,r,n,String(a),!0)):o.push("");return i.forEach((function(i){i.match(/^\d+$/)||o.push(h(e,t,r,n,i,!0))})),o}(e,r,n,s,a):a.map((function(t){return h(e,r,n,s,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 a,s,u;if((u=Object.getOwnPropertyDescriptor(t,i)||{value:t[i]}).get?s=u.set?e.stylize("[Getter/Setter]","special"):e.stylize("[Getter]","special"):u.set&&(s=e.stylize("[Setter]","special")),N(n,i)||(a="["+i+"]"),s||(e.seen.indexOf(u.value)<0?(s=y(r)?f(e,u.value,null):f(e,u.value,r-1)).indexOf("\n")>-1&&(s=o?s.split("\n").map((function(e){return"  "+e})).join("\n").substr(2):"\n"+s.split("\n").map((function(e){return"   "+e})).join("\n")):s=e.stylize("[Circular]","special")),_(a)){if(o&&i.match(/^\d+$/))return s;(a=JSON.stringify(""+i)).match(/^"([a-zA-Z_][a-zA-Z_0-9]*)"$/)?(a=a.substr(1,a.length-2),a=e.stylize(a,"name")):(a=a.replace(/'/g,"\\'").replace(/\\"/g,'"').replace(/(^"|"$)/g,"'"),a=e.stylize(a,"string"))}return a+": "+s}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(),!a[r])if(new RegExp("\\b"+r+"\\b","i").test(o)){var n=e.pid;a[r]=function(){var e=t.format.apply(t,arguments);console.error("%s %d: %s",r,n,e)}}else a[r]=function(){};return a[r]},t.inspect=s,s.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]},s.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(294);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(295),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,a=function(){return i.apply(o,arguments)};t.apply(this,r).then((function(t){e.nextTick(a,null,t)}),(function(t){e.nextTick(k,t,a)}))}return Object.setPrototypeOf(r,Object.getPrototypeOf(t)),Object.defineProperties(r,n(t)),r}}).call(this,r(27))},75:function(e,t,r){(t=e.exports=r(96)).Stream=t,t.Readable=t,t.Writable=r(77),t.Duplex=r(39),t.Transform=r(99),t.PassThrough=r(139)},76:function(e,t,r){var n=r(12),i=n.Buffer;function o(e,t){for(var r in e)t[r]=e[r]}function a(e,t,r){return i(e,t,r)}i.from&&i.alloc&&i.allocUnsafe&&i.allocUnsafeSlow?e.exports=n:(o(n,t),t.Buffer=a),o(i,a),a.from=function(e,t,r){if("number"==typeof e)throw new TypeError("Argument must not be a number");return i(e,t,r)},a.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},a.allocUnsafe=function(e){if("number"!=typeof e)throw new TypeError("Argument must be a number");return i(e)},a.allocUnsafeSlow=function(e){if("number"!=typeof e)throw new TypeError("Argument must be a number");return n.SlowBuffer(e)}},77:function(e,t,r){"use strict";(function(t){var n=r(59);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,a=n.nextTick;m.WritableState=y;var s=Object.create(r(53));s.inherits=r(14);var u={deprecate:r(137)},c=r(97),f=r(76).Buffer,l=t.Uint8Array||function(){};var h,p=r(98);function d(){}function y(e,t){o=o||r(39),e=e||{};var s=t instanceof o;this.objectMode=!!e.objectMode,s&&(this.objectMode=this.objectMode||!!e.writableObjectMode);var u=e.highWaterMark,c=e.writableHighWaterMark,f=this.objectMode?16:16384;this.highWaterMark=u||0===u?u:s&&(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 s=b(r);s||r.corked||r.bufferProcessing||!r.bufferedRequest||v(e,r),i?a(_,e,r,s,o):_(e,r,s,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(39),!(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,a){t.writelen=n,t.writecb=a,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),a=t.corkedRequestsFree;a.entry=r;for(var s=0,u=!0;r;)o[s]=r,r.isBuf||(u=!1),r=r.next,s+=1;o.allBuffers=u,g(e,t,!0,t.length,o,"",a.finish),t.pendingcb++,t.lastBufferedRequest=null,a.next?(t.corkedRequestsFree=a.next,a.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}s.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,a=!1,s=!o.objectMode&&(i=e,f.isBuffer(i)||i instanceof l);return s&&!f.isBuffer(e)&&(e=function(e){return f.from(e)}(e)),"function"==typeof t&&(r=t,t=null),s?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):(s||function(e,t,r,i){var o=!0,a=!1;return null===r?a=new TypeError("May not write null values to stream"):"string"==typeof r||void 0===r||t.objectMode||(a=new TypeError("Invalid non-string/buffer chunk")),a&&(e.emit("error",a),n.nextTick(i,a),o=!1),o}(this,o,e,r))&&(o.pendingcb++,a=function(e,t,r,n,i,o){if(!r){var a=function(e,t,r){e.objectMode||!1===e.decodeStrings||"string"!=typeof t||(t=f.from(t,r));return t}(t,n,i);n!==a&&(r=!0,i="buffer",n=a)}var s=t.objectMode?1:n.length;t.length+=s;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,s,n,i,o);return u}(this,o,s,e,t,r)),a},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(25))},8:function(e,t,r){e.exports=r(45)},816:function(e,t,r){"use strict";var n=r(1451),i=r(1457),o=r(320),a=r(64),s=r(70);function u(e,t){a.Readable.call(this),t=t||{},this._batchSize=t.batchSize||65536,this._blob=e,this._pos=0}function c(){a.Transform.call(this,{readableObjectMode:!0}),this._bufs=[]}s.inherits(u,a.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)}},s.inherits(c,a.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 a.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)},817:function(e,t,r){"use strict";(function(e){var n=r(1),i=r.n(n),o=r(2),a=r.n(o),s=r(4),u=r.n(s),c=r(3),f=r.n(c),l=r(5),h=r.n(l),p=r(9),d=r(337),y=r.n(d),m=r(7),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),a()(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(12).Buffer)},85:function(e,t,r){"use strict";var n=r(138).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=s,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 a(e){return e<=127?0:e>>5==6?2:e>>4==14?3:e>>3==30?4:e>>6==2?-1:-2}function s(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=a(t[n]);if(i>=0)return i>0&&(e.lastNeed=i-1),i;if(--n<r||-2===i)return 0;if((i=a(t[n]))>=0)return i>0&&(e.lastNeed=i-2),i;if(--n<r||-2===i)return 0;if((i=a(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),a=r.n(o),s=r(15),u=r(0),c=r(20),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 a()(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 a()(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=s.a.typeEnum(e)},get:function(){return s.a.enumLookup(this._inputType)}},{key:"outputType",set:function(e){this._outputType=s.a.typeEnum(e),this._presentType<0&&(this._presentType=this._outputType)},get:function(){return s.a.enumLookup(this._outputType)}},{key:"presentType",set:function(e){this._presentType=s.a.typeEnum(e)},get:function(){return s.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},96:function(e,t,r){"use strict";(function(t,n){var i=r(59);e.exports=v;var o,a=r(40);v.ReadableState=_;r(69).EventEmitter;var s=function(e,t){return e.listeners(t).length},u=r(97),c=r(76).Buffer,f=t.Uint8Array||function(){};var l=Object.create(r(53));l.inherits=r(14);var h=r(134),p=void 0;p=h&&h.debuglog?h.debuglog("stream"):function(){};var d,y=r(135),m=r(98);l.inherits(v,u);var g=["error","close","destroy","pause","resume"];function _(e,t){e=e||{};var n=t instanceof(o=o||r(39));this.objectMode=!!e.objectMode,n&&(this.objectMode=this.objectMode||!!e.readableObjectMode);var i=e.highWaterMark,a=e.readableHighWaterMark,s=this.objectMode?16:16384;this.highWaterMark=i||0===i?i:n&&(a||0===a)?a:s,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(85).StringDecoder),this.decoder=new d(e.encoding),this.encoding=e.encoding)}function v(e){if(o=o||r(39),!(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,a=e._readableState;null===t?(a.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,B(e)}(e,a)):(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}(a,t)),o?e.emit("error",o):a.objectMode||t&&t.length>0?("string"==typeof t||a.objectMode||Object.getPrototypeOf(t)===c.prototype||(t=function(e){return c.from(e)}(t)),n?a.endEmitted?e.emit("error",new Error("stream.unshift() after end event")):w(e,a,t,!0):a.ended?e.emit("error",new Error("stream.push() after EOF")):(a.reading=!1,a.decoder&&!r?(t=a.decoder.write(t),a.objectMode||0!==t.length?w(e,a,t,!1):S(e,a)):w(e,a,t,!1))):n||(a.reading=!1));return function(e){return!e.ended&&(e.needReadable||e.length<e.highWaterMark||0===e.length)}(a)}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&&B(e)),S(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(85).StringDecoder),this._readableState.decoder=new d(e),this._readableState.encoding=e,this};function E(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>=8388608?e=8388608:(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 B(e){var t=e._readableState;t.needReadable=!1,t.emittedReadable||(p("emitReadable",t.flowing),t.emittedReadable=!0,t.sync?i.nextTick(A,e):A(e))}function A(e){p("emit readable"),e.emit("readable"),O(e)}function S(e,t){t.readingMore||(t.readingMore=!0,i.nextTick(x,e,t))}function x(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 T(e){p("readable nexttick read 0"),e.read(0)}function N(e,t){t.reading||(p("resume read 0"),e.read(0)),t.resumeScheduled=!1,t.awaitDrain=0,e.emit("resume"),O(e),t.flowing&&!t.reading&&e.read(0)}function O(e){var t=e._readableState;for(p("flow",t.flowing);t.flowing&&null!==e.read(););}function k(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,a=e>o.length?o.length:e;if(a===o.length?i+=o:i+=o.slice(0,e),0===(e-=a)){a===o.length?(++n,r.next?t.head=r.next:t.head=t.tail=null):(t.head=r,r.data=o.slice(a));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,a=e>o.length?o.length:e;if(o.copy(r,r.length-e,0,a),0===(e-=a)){a===o.length?(++i,n.next?t.head=n.next:t.head=t.tail=null):(t.head=n,n.data=o.slice(a));break}++i}return t.length-=i,r}(e,t);return n}(e,t.buffer,t.decoder),r);var r}function I(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(F,t,e))}function F(e,t){e.endEmitted||0!==e.length||(e.endEmitted=!0,t.readable=!1,t.emit("end"))}function D(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?I(this):B(this),null;if(0===(e=E(e,t))&&t.ended)return 0===t.length&&I(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=E(r,t))),null===(n=e>0?k(e,t):null)?(t.needReadable=!0,e=0):t.length-=e,0===t.length&&(t.ended||(t.needReadable=!0),r!==e&&t.ended&&I(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&&s(e,"data")&&(t.flowing=!0,O(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!==D(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===s(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]?a(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||(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 a=D(t.pipes,e);return-1===a||(t.pipes.splice(a,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&&B(this):i.nextTick(T,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(N,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=k}).call(this,r(25),r(27))},97:function(e,t,r){e.exports=r(69).EventEmitter},98:function(e,t,r){"use strict";var n=r(59);function i(e,t){e.emit("error",t)}e.exports={destroy:function(e,t){var r=this,o=this._readableState&&this._readableState.destroyed,a=this._writableState&&this._writableState.destroyed;return o||a?(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)}}},99:function(e,t,r){"use strict";e.exports=a;var n=r(39),i=Object.create(r(53));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 a(e){if(!(this instanceof a))return new a(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",s)}function s(){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(14),i.inherits(a,n),a.prototype.push=function(e,t){return this._transformState.needTransform=!1,n.prototype.push.call(this,e,t)},a.prototype._transform=function(e,t,r){throw new Error("_transform() is not implemented")},a.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)}},a.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},a.prototype._destroy=function(e,t){var r=this;n.prototype._destroy.call(this,e,(function(e){t(e),r.emit("close")}))}}});