UNPKG

apg-exp

Version:

(Deprecated: use apg-js instead.) Pattern-matching alternative to RegExp. Replaces the regular expression syntax with ABNF. Adds APG parser features such as User Defined Terminals (hand-written pattern matchers) and access to the AST.

2 lines 200 kB
!function(e){function t(n){if(r[n])return r[n].exports;var s=r[n]={i:n,l:!1,exports:{}};return e[n].call(s.exports,s,s.exports,t),s.l=!0,s.exports}var r={};return t.m=e,t.c=r,t.i=function(e){return e},t.d=function(e,r,n){t.o(e,r)||Object.defineProperty(e,r,{configurable:!1,enumerable:!0,get:n})},t.n=function(e){var r=e&&e.__esModule?function(){return e.default}:function(){return e};return t.d(r,"a",r),r},t.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},t.p="",t(t.s=35)}([function(e,t,r){"use strict";t.ast=r(36),t.circular=r(8),t.ids=r(1),t.parser=r(37),t.stats=r(38),t.trace=r(39),t.utils=r(2),t.emitcss=r(9),t.style=r(3)},function(e,t,r){"use strict";e.exports={ALT:1,CAT:2,REP:3,RNM:4,TRG:5,TBS:6,TLS:7,UDT:11,AND:12,NOT:13,BKR:14,BKA:15,BKN:16,ABG:17,AEN:18,ACTIVE:100,MATCH:101,EMPTY:102,NOMATCH:103,SEM_PRE:200,SEM_POST:201,SEM_OK:300,SEM_SKIP:301,ATTR_N:400,ATTR_R:401,ATTR_MR:402,ATTR_NMR:403,ATTR_RMR:404,LOOKAROUND_NONE:500,LOOKAROUND_AHEAD:501,LOOKAROUND_BEHIND:502,BKR_MODE_UM:601,BKR_MODE_PM:602,BKR_MODE_CS:603,BKR_MODE_CI:604}},function(e,t,r){"use strict";var n="utilities.js: ",s=r(3),i=r(5).converter,a=this,o=function(e,t,r){for(var n;;){if(e<=0){t=0,n=0;break}if("number"!=typeof t){t=0,n=e;break}if(t>=e){t=e,n=e;break}if("number"!=typeof r){n=e;break}if(n=t+r,n>e){n=e;break}break}return{beg:t,end:n}};t.htmlToPage=function(e,t){var n="utilities.js: ",s=r(9);if("string"!=typeof e)throw new Error(n+"htmlToPage: input HTML is not a string");"string"!=typeof t&&(t="htmlToPage");var i="";return i+="<!DOCTYPE html>\n",i+='<html lang="en">\n',i+="<head>\n",i+='<meta charset="utf-8">\n',i+="<title>"+t+"</title>\n",i+="<style>\n",i+=s(),i+="</style>\n",i+="</head>\n<body>\n",i+="<p>"+new Date+"</p>\n",i+=e,i+="</body>\n</html>\n"},t.parserResultToHtml=function(e,t){var n=r(1),i=null;"string"==typeof t&&""!==t&&(i=t);var a,o;a=e.success===!0?'<span class="'+s.CLASS_MATCH+'">true</span>':'<span class="'+s.CLASS_NOMATCH+'">false</span>',o=e.state===n.EMPTY?'<span class="'+s.CLASS_EMPTY+'">EMPTY</span>':e.state===n.MATCH?'<span class="'+s.CLASS_MATCH+'">MATCH</span>':e.state===n.NOMATCH?'<span class="'+s.CLASS_NOMATCH+'">NOMATCH</span>':'<span class="'+s.CLASS_NOMATCH+'">unrecognized</span>';var l="";return l+='<table class="'+s.CLASS_STATE+'">\n',i&&(l+="<caption>"+i+"</caption>\n"),l+="<tr><th>state item</th><th>value</th><th>description</th></tr>\n",l+="<tr><td>parser success</td><td>"+a+"</td>\n",l+='<td><span class="'+s.CLASS_MATCH+'">true</span> if the parse succeeded,\n',l+=' <span class="'+s.CLASS_NOMATCH+'">false</span> otherwise',l+="<br><i>NOTE: for success, entire string must be matched</i></td></tr>\n",l+="<tr><td>parser state</td><td>"+o+"</td>\n",l+='<td><span class="'+s.CLASS_EMPTY+'">EMPTY</span>, ',l+='<span class="'+s.CLASS_MATCH+'">MATCH</span> or \n',l+='<span class="'+s.CLASS_NOMATCH+'">NOMATCH</span></td></tr>\n',l+="<tr><td>string length</td><td>"+e.length+"</td><td>length of the input (sub)string</td></tr>\n",l+="<tr><td>matched length</td><td>"+e.matched+"</td><td>number of input string characters matched</td></tr>\n",l+="<tr><td>max matched</td><td>"+e.maxMatched+"</td><td>maximum number of input string characters matched</td></tr>\n",l+="<tr><td>max tree depth</td><td>"+e.maxTreeDepth+"</td><td>maximum depth of the parse tree reached</td></tr>\n",l+="<tr><td>node hits</td><td>"+e.nodeHits+"</td><td>number of parse tree node hits (opcode function calls)</td></tr>\n",l+="<tr><td>input length</td><td>"+e.inputLength+"</td><td>length of full input string</td></tr>\n",l+="<tr><td>sub-string begin</td><td>"+e.subBegin+"</td><td>sub-string first character index</td></tr>\n",l+="<tr><td>sub-string end</td><td>"+e.subEnd+"</td><td>sub-string end-of-string index</td></tr>\n",l+="<tr><td>sub-string length</td><td>"+e.subLength+"</td><td>sub-string length</td></tr>\n",l+="</table>\n"},t.charsToString=function(e,t,r){var n=e.slice(t,t+r),s=i.encode("UTF16LE",n);return s.toString("utf16le")},t.stringToChars=function(e){return i.decode("STRING",e)},t.opcodeToString=function(e){var t=r(1),n="unknown";switch(e){case t.ALT:n="ALT";break;case t.CAT:n="CAT";break;case t.RNM:n="RNM";break;case t.UDT:n="UDT";break;case t.AND:n="AND";break;case t.NOT:n="NOT";break;case t.REP:n="REP";break;case t.TRG:n="TRG";break;case t.TBS:n="TBS";break;case t.TLS:n="TLS";break;case t.BKR:n="BKR";break;case t.BKA:n="BKA";break;case t.BKN:n="BKN";break;case t.ABG:n="ABG";break;case t.AEN:n="AEN"}return n},t.asciiChars=["NUL","SOH","STX","ETX","EOT","ENQ","ACK","BEL","BS","TAB","LF","VT","FF","CR","SO","SI","DLE","DC1","DC2","DC3","DC4","NAK","SYN","ETB","CAN","EM","SUB","ESC","FS","GS","RS","US","&nbsp;","!","&#34;","#","$","%","&#38;","&#39;","(",")","*","+",",","-",".","/","0","1","2","3","4","5","6","7","8","9",":",";","&#60;","=","&#62;","?","@","A","B","C","D","E","F","G","H","I","J","K","L","M","N","O","P","Q","R","S","T","U","V","W","X","Y","Z","[","&#92;","]","^","_","`","a","b","c","d","e","f","g","h","i","j","k","l","m","n","o","p","q","r","s","t","u","v","w","x","y","z","{","|","}","~","DEL"],t.charToHex=function(e){var t=e.toString(16).toUpperCase();switch(t.length){case 1:case 3:case 7:t="0"+t;break;case 6:t="00"+t;break;case 5:t="000"+t}return t},t.charsToDec=function(e,t,r){var s="";if(!Array.isArray(e))throw new Error(n+"charsToDec: input must be an array of integers");var i=o(e.length,t,r);if(i.end>i.beg){s+=e[i.beg];for(var a=i.beg+1;a<i.end;a+=1)s+=","+e[a]}return s},t.charsToHex=function(e,t,r){var s="";if(!Array.isArray(e))throw new Error(n+"charsToHex: input must be an array of integers");var i=o(e.length,t,r);if(i.end>i.beg){s+="\\x"+a.charToHex(e[i.beg]);for(var l=i.beg+1;l<i.end;l+=1)s+=",\\x"+a.charToHex(e[l])}return s},t.charsToUnicode=function(e,t,r){var s="";if(!Array.isArray(e))throw new Error(n+"charsToUnicode: input must be an array of integers");var i=o(e.length,t,r);if(i.end>i.beg){s+="U+"+a.charToHex(e[i.beg]);for(var l=i.beg+1;l<i.end;l+=1)s+=",U+"+a.charToHex(e[l])}return s},t.charsToJsUnicode=function(e,t,r){var s="";if(!Array.isArray(e))throw new Error(n+"charsToJsUnicode: input must be an array of integers");var i=o(e.length,t,r);if(i.end>i.beg){s+="\\u"+a.charToHex(e[i.beg]);for(var l=i.beg+1;l<i.end;l+=1)s+=",\\u"+a.charToHex(e[l])}return s},t.charsToAscii=function(e,t,r){var s="";if(!Array.isArray(e))throw new Error(n+"charsToAscii: input must be an array of integers");for(var i=o(e.length,t,r),l=i.beg;l<i.end;l+=1){var c=e[l];s+=c>=32&&c<=126?String.fromCharCode(c):"\\x"+a.charToHex(c)}return s},t.charsToAsciiHtml=function(e,t,r){if(!Array.isArray(e))throw new Error(n+"charsToAsciiHtml: input must be an array of integers");for(var i,l="",c=o(e.length,t,r),h=c.beg;h<c.end;h+=1)i=e[h],l+=i<32||127===i?'<span class="'+s.CLASS_CTRLCHAR+'">'+a.asciiChars[i]+"</span>":i>127?'<span class="'+s.CLASS_CTRLCHAR+'">U+'+a.charToHex(i)+"</span>":a.asciiChars[i];return l},t.stringToAsciiHtml=function(e){var t=i.decode("STRING",e);return this.charsToAsciiHtml(t)}},function(e,t){e.exports={CLASS_MONOSPACE:"apg-mono",CLASS_ACTIVE:"apg-active",CLASS_EMPTY:"apg-empty",CLASS_MATCH:"apg-match",CLASS_NOMATCH:"apg-nomatch",CLASS_LOOKAHEAD:"apg-lh-match",CLASS_LOOKBEHIND:"apg-lb-match",CLASS_REMAINDER:"apg-remainder",CLASS_CTRLCHAR:"apg-ctrl-char",CLASS_LINEEND:"apg-line-end",CLASS_ERROR:"apg-error",CLASS_PHRASE:"apg-phrase",CLASS_EMPTYPHRASE:"apg-empty-phrase",CLASS_STATE:"apg-state",CLASS_STATS:"apg-stats",CLASS_TRACE:"apg-trace",CLASS_GRAMMAR:"apg-grammar",CLASS_RULES:"apg-rules",CLASS_RULESLINK:"apg-rules-link",CLASS_ATTRIBUTES:"apg-attrs"}},function(e,t,r){"use strict";(function(e){function n(){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}}function s(){return a.TYPED_ARRAY_SUPPORT?2147483647:1073741823}function i(e,t){if(s()<t)throw new RangeError("Invalid typed array length");return a.TYPED_ARRAY_SUPPORT?(e=new Uint8Array(t),e.__proto__=a.prototype):(null===e&&(e=new a(t)),e.length=t),e}function a(e,t,r){if(!(a.TYPED_ARRAY_SUPPORT||this instanceof a))return new a(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 h(this,e)}return o(this,e,t,r)}function o(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?d(e,t,r,n):"string"==typeof t?u(e,t,r):f(e,t)}function l(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 c(e,t,r,n){return l(t),t<=0?i(e,t):void 0!==r?"string"==typeof n?i(e,t).fill(r,n):i(e,t).fill(r):i(e,t)}function h(e,t){if(l(t),e=i(e,t<0?0:0|g(t)),!a.TYPED_ARRAY_SUPPORT)for(var r=0;r<t;++r)e[r]=0;return e}function u(e,t,r){if("string"==typeof r&&""!==r||(r="utf8"),!a.isEncoding(r))throw new TypeError('"encoding" must be a valid string encoding');var n=0|b(t,r);e=i(e,n);var s=e.write(t,r);return s!==n&&(e=e.slice(0,s)),e}function p(e,t){var r=t.length<0?0:0|g(t.length);e=i(e,r);for(var n=0;n<r;n+=1)e[n]=255&t[n];return e}function d(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");return t=void 0===r&&void 0===n?new Uint8Array(t):void 0===n?new Uint8Array(t,r):new Uint8Array(t,r,n),a.TYPED_ARRAY_SUPPORT?(e=t,e.__proto__=a.prototype):e=p(e,t),e}function f(e,t){if(a.isBuffer(t)){var r=0|g(t.length);return e=i(e,r),0===e.length?e:(t.copy(e,0,0,r),e)}if(t){if("undefined"!=typeof ArrayBuffer&&t.buffer instanceof ArrayBuffer||"length"in t)return"number"!=typeof t.length||X(t.length)?i(e,0):p(e,t);if("Buffer"===t.type&&Q(t.data))return p(e,t.data)}throw new TypeError("First argument must be a string, Buffer, ArrayBuffer, Array, or array-like object.")}function g(e){if(e>=s())throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+s().toString(16)+" bytes");return 0|e}function m(e){return+e!=e&&(e=0),a.alloc(+e)}function b(e,t){if(a.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 G(e).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return 2*r;case"hex":return r>>>1;case"base64":return q(e).length;default:if(n)return G(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,r<=t)return"";for(e||(e="utf8");;)switch(e){case"hex":return B(this,t,r);case"utf8":case"utf-8":return O(this,t,r);case"ascii":return L(this,t,r);case"latin1":case"binary":return _(this,t,r);case"base64":return M(this,t,r);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return N(this,t,r);default:if(n)throw new TypeError("Unknown encoding: "+e);e=(e+"").toLowerCase(),n=!0}}function x(e,t,r){var n=e[t];e[t]=e[r],e[r]=n}function T(e,t,r,n,s){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=s?0:e.length-1),r<0&&(r=e.length+r),r>=e.length){if(s)return-1;r=e.length-1}else if(r<0){if(!s)return-1;r=0}if("string"==typeof t&&(t=a.from(t,n)),a.isBuffer(t))return 0===t.length?-1:E(e,t,r,n,s);if("number"==typeof t)return t=255&t,a.TYPED_ARRAY_SUPPORT&&"function"==typeof Uint8Array.prototype.indexOf?s?Uint8Array.prototype.indexOf.call(e,t,r):Uint8Array.prototype.lastIndexOf.call(e,t,r):E(e,[t],r,n,s);throw new TypeError("val must be string, number or Buffer")}function E(e,t,r,n,s){function i(e,t){return 1===a?e[t]:e.readUInt16BE(t*a)}var a=1,o=e.length,l=t.length;if(void 0!==n&&(n=String(n).toLowerCase(),"ucs2"===n||"ucs-2"===n||"utf16le"===n||"utf-16le"===n)){if(e.length<2||t.length<2)return-1;a=2,o/=2,l/=2,r/=2}var c;if(s){var h=-1;for(c=r;c<o;c++)if(i(e,c)===i(t,h===-1?0:c-h)){if(h===-1&&(h=c),c-h+1===l)return h*a}else h!==-1&&(c-=c-h),h=-1}else for(r+l>o&&(r=o-l),c=r;c>=0;c--){for(var u=!0,p=0;p<l;p++)if(i(e,c+p)!==i(t,p)){u=!1;break}if(u)return c}return-1}function k(e,t,r,n){r=Number(r)||0;var s=e.length-r;n?(n=Number(n),n>s&&(n=s)):n=s;var i=t.length;if(i%2!==0)throw new TypeError("Invalid hex string");n>i/2&&(n=i/2);for(var a=0;a<n;++a){var o=parseInt(t.substr(2*a,2),16);if(isNaN(o))return a;e[r+a]=o}return a}function A(e,t,r,n){return J(G(t,e.length-r),e,r,n)}function v(e,t,r,n){return J($(t),e,r,n)}function w(e,t,r,n){return v(e,t,r,n)}function S(e,t,r,n){return J(q(t),e,r,n)}function C(e,t,r,n){return J(z(t,e.length-r),e,r,n)}function M(e,t,r){return 0===t&&r===e.length?W.fromByteArray(e):W.fromByteArray(e.slice(t,r))}function O(e,t,r){r=Math.min(e.length,r);for(var n=[],s=t;s<r;){var i=e[s],a=null,o=i>239?4:i>223?3:i>191?2:1;if(s+o<=r){var l,c,h,u;switch(o){case 1:i<128&&(a=i);break;case 2:l=e[s+1],128===(192&l)&&(u=(31&i)<<6|63&l,u>127&&(a=u));break;case 3:l=e[s+1],c=e[s+2],128===(192&l)&&128===(192&c)&&(u=(15&i)<<12|(63&l)<<6|63&c,u>2047&&(u<55296||u>57343)&&(a=u));break;case 4:l=e[s+1],c=e[s+2],h=e[s+3],128===(192&l)&&128===(192&c)&&128===(192&h)&&(u=(15&i)<<18|(63&l)<<12|(63&c)<<6|63&h,u>65535&&u<1114112&&(a=u))}}null===a?(a=65533,o=1):a>65535&&(a-=65536,n.push(a>>>10&1023|55296),a=56320|1023&a),n.push(a),s+=o}return R(n)}function R(e){var t=e.length;if(t<=ee)return String.fromCharCode.apply(String,e);for(var r="",n=0;n<t;)r+=String.fromCharCode.apply(String,e.slice(n,n+=ee));return r}function L(e,t,r){var n="";r=Math.min(e.length,r);for(var s=t;s<r;++s)n+=String.fromCharCode(127&e[s]);return n}function _(e,t,r){var n="";r=Math.min(e.length,r);for(var s=t;s<r;++s)n+=String.fromCharCode(e[s]);return n}function B(e,t,r){var n=e.length;(!t||t<0)&&(t=0),(!r||r<0||r>n)&&(r=n);for(var s="",i=t;i<r;++i)s+=V(e[i]);return s}function N(e,t,r){for(var n=e.slice(t,r),s="",i=0;i<n.length;i+=2)s+=String.fromCharCode(n[i]+256*n[i+1]);return s}function P(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 H(e,t,r,n,s,i){if(!a.isBuffer(e))throw new TypeError('"buffer" argument must be a Buffer instance');if(t>s||t<i)throw new RangeError('"value" argument is out of bounds');if(r+n>e.length)throw new RangeError("Index out of range")}function I(e,t,r,n){t<0&&(t=65535+t+1);for(var s=0,i=Math.min(e.length-r,2);s<i;++s)e[r+s]=(t&255<<8*(n?s:1-s))>>>8*(n?s:1-s)}function D(e,t,r,n){t<0&&(t=4294967295+t+1);for(var s=0,i=Math.min(e.length-r,4);s<i;++s)e[r+s]=t>>>8*(n?s:3-s)&255}function U(e,t,r,n,s,i){if(r+n>e.length)throw new RangeError("Index out of range");if(r<0)throw new RangeError("Index out of range")}function F(e,t,r,n,s){return s||U(e,t,r,4,3.4028234663852886e38,-3.4028234663852886e38),Z.write(e,t,r,n,23,4),r+4}function K(e,t,r,n,s){return s||U(e,t,r,8,1.7976931348623157e308,-1.7976931348623157e308),Z.write(e,t,r,n,52,8),r+8}function Y(e){if(e=j(e).replace(te,""),e.length<2)return"";for(;e.length%4!==0;)e+="=";return e}function j(e){return e.trim?e.trim():e.replace(/^\s+|\s+$/g,"")}function V(e){return e<16?"0"+e.toString(16):e.toString(16)}function G(e,t){t=t||1/0;for(var r,n=e.length,s=null,i=[],a=0;a<n;++a){if(r=e.charCodeAt(a),r>55295&&r<57344){if(!s){if(r>56319){(t-=3)>-1&&i.push(239,191,189);continue}if(a+1===n){(t-=3)>-1&&i.push(239,191,189);continue}s=r;continue}if(r<56320){(t-=3)>-1&&i.push(239,191,189),s=r;continue}r=(s-55296<<10|r-56320)+65536}else s&&(t-=3)>-1&&i.push(239,191,189);if(s=null,r<128){if((t-=1)<0)break;i.push(r)}else if(r<2048){if((t-=2)<0)break;i.push(r>>6|192,63&r|128)}else if(r<65536){if((t-=3)<0)break;i.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;i.push(r>>18|240,r>>12&63|128,r>>6&63|128,63&r|128)}}return i}function $(e){for(var t=[],r=0;r<e.length;++r)t.push(255&e.charCodeAt(r));return t}function z(e,t){for(var r,n,s,i=[],a=0;a<e.length&&!((t-=2)<0);++a)r=e.charCodeAt(a),n=r>>8,s=r%256,i.push(s),i.push(n);return i}function q(e){return W.toByteArray(Y(e))}function J(e,t,r,n){for(var s=0;s<n&&!(s+r>=t.length||s>=e.length);++s)t[s+r]=e[s];return s}function X(e){return e!==e}var W=r(12),Z=r(13),Q=r(14);t.Buffer=a,t.SlowBuffer=m,t.INSPECT_MAX_BYTES=50,a.TYPED_ARRAY_SUPPORT=void 0!==e.TYPED_ARRAY_SUPPORT?e.TYPED_ARRAY_SUPPORT:n(),t.kMaxLength=s(),a.poolSize=8192,a._augment=function(e){return e.__proto__=a.prototype,e},a.from=function(e,t,r){return o(null,e,t,r)},a.TYPED_ARRAY_SUPPORT&&(a.prototype.__proto__=Uint8Array.prototype,a.__proto__=Uint8Array,"undefined"!=typeof Symbol&&Symbol.species&&a[Symbol.species]===a&&Object.defineProperty(a,Symbol.species,{value:null,configurable:!0})),a.alloc=function(e,t,r){return c(null,e,t,r)},a.allocUnsafe=function(e){return h(null,e)},a.allocUnsafeSlow=function(e){return h(null,e)},a.isBuffer=function(e){return!(null==e||!e._isBuffer)},a.compare=function(e,t){if(!a.isBuffer(e)||!a.isBuffer(t))throw new TypeError("Arguments must be Buffers");if(e===t)return 0;for(var r=e.length,n=t.length,s=0,i=Math.min(r,n);s<i;++s)if(e[s]!==t[s]){r=e[s],n=t[s];break}return r<n?-1:n<r?1:0},a.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}},a.concat=function(e,t){if(!Q(e))throw new TypeError('"list" argument must be an Array of Buffers');if(0===e.length)return a.alloc(0);var r;if(void 0===t)for(t=0,r=0;r<e.length;++r)t+=e[r].length;var n=a.allocUnsafe(t),s=0;for(r=0;r<e.length;++r){var i=e[r];if(!a.isBuffer(i))throw new TypeError('"list" argument must be an Array of Buffers');i.copy(n,s),s+=i.length}return n},a.byteLength=b,a.prototype._isBuffer=!0,a.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)x(this,t,t+1);return this},a.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)x(this,t,t+3),x(this,t+1,t+2);return this},a.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)x(this,t,t+7),x(this,t+1,t+6),x(this,t+2,t+5),x(this,t+3,t+4);return this},a.prototype.toString=function(){var e=0|this.length;return 0===e?"":0===arguments.length?O(this,0,e):y.apply(this,arguments)},a.prototype.equals=function(e){if(!a.isBuffer(e))throw new TypeError("Argument must be a Buffer");return this===e||0===a.compare(this,e)},a.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+">"},a.prototype.compare=function(e,t,r,n,s){if(!a.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===s&&(s=this.length),t<0||r>e.length||n<0||s>this.length)throw new RangeError("out of range index");if(n>=s&&t>=r)return 0;if(n>=s)return-1;if(t>=r)return 1;if(t>>>=0,r>>>=0,n>>>=0,s>>>=0,this===e)return 0;for(var i=s-n,o=r-t,l=Math.min(i,o),c=this.slice(n,s),h=e.slice(t,r),u=0;u<l;++u)if(c[u]!==h[u]){i=c[u],o=h[u];break}return i<o?-1:o<i?1:0},a.prototype.includes=function(e,t,r){return this.indexOf(e,t,r)!==-1},a.prototype.indexOf=function(e,t,r){return T(this,e,t,r,!0)},a.prototype.lastIndexOf=function(e,t,r){return T(this,e,t,r,!1)},a.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|t,isFinite(r)?(r=0|r,void 0===n&&(n="utf8")):(n=r,r=void 0)}var s=this.length-t;if((void 0===r||r>s)&&(r=s),e.length>0&&(r<0||t<0)||t>this.length)throw new RangeError("Attempt to write outside buffer bounds");n||(n="utf8");for(var i=!1;;)switch(n){case"hex":return k(this,e,t,r);case"utf8":case"utf-8":return A(this,e,t,r);case"ascii":return v(this,e,t,r);case"latin1":case"binary":return w(this,e,t,r);case"base64":return S(this,e,t,r);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return C(this,e,t,r);default:if(i)throw new TypeError("Unknown encoding: "+n);n=(""+n).toLowerCase(),i=!0}},a.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};var ee=4096;a.prototype.slice=function(e,t){var r=this.length;e=~~e,t=void 0===t?r:~~t,e<0?(e+=r,e<0&&(e=0)):e>r&&(e=r),t<0?(t+=r,t<0&&(t=0)):t>r&&(t=r),t<e&&(t=e);var n;if(a.TYPED_ARRAY_SUPPORT)n=this.subarray(e,t),n.__proto__=a.prototype;else{var s=t-e;n=new a(s,void 0);for(var i=0;i<s;++i)n[i]=this[i+e]}return n},a.prototype.readUIntLE=function(e,t,r){e=0|e,t=0|t,r||P(e,t,this.length);for(var n=this[e],s=1,i=0;++i<t&&(s*=256);)n+=this[e+i]*s;return n},a.prototype.readUIntBE=function(e,t,r){e=0|e,t=0|t,r||P(e,t,this.length);for(var n=this[e+--t],s=1;t>0&&(s*=256);)n+=this[e+--t]*s;return n},a.prototype.readUInt8=function(e,t){return t||P(e,1,this.length),this[e]},a.prototype.readUInt16LE=function(e,t){return t||P(e,2,this.length),this[e]|this[e+1]<<8},a.prototype.readUInt16BE=function(e,t){return t||P(e,2,this.length),this[e]<<8|this[e+1]},a.prototype.readUInt32LE=function(e,t){return t||P(e,4,this.length),(this[e]|this[e+1]<<8|this[e+2]<<16)+16777216*this[e+3]},a.prototype.readUInt32BE=function(e,t){return t||P(e,4,this.length),16777216*this[e]+(this[e+1]<<16|this[e+2]<<8|this[e+3])},a.prototype.readIntLE=function(e,t,r){e=0|e,t=0|t,r||P(e,t,this.length);for(var n=this[e],s=1,i=0;++i<t&&(s*=256);)n+=this[e+i]*s;return s*=128,n>=s&&(n-=Math.pow(2,8*t)),n},a.prototype.readIntBE=function(e,t,r){e=0|e,t=0|t,r||P(e,t,this.length);for(var n=t,s=1,i=this[e+--n];n>0&&(s*=256);)i+=this[e+--n]*s;return s*=128,i>=s&&(i-=Math.pow(2,8*t)),i},a.prototype.readInt8=function(e,t){return t||P(e,1,this.length),128&this[e]?(255-this[e]+1)*-1:this[e]},a.prototype.readInt16LE=function(e,t){t||P(e,2,this.length);var r=this[e]|this[e+1]<<8;return 32768&r?4294901760|r:r},a.prototype.readInt16BE=function(e,t){t||P(e,2,this.length);var r=this[e+1]|this[e]<<8;return 32768&r?4294901760|r:r},a.prototype.readInt32LE=function(e,t){return t||P(e,4,this.length),this[e]|this[e+1]<<8|this[e+2]<<16|this[e+3]<<24},a.prototype.readInt32BE=function(e,t){return t||P(e,4,this.length),this[e]<<24|this[e+1]<<16|this[e+2]<<8|this[e+3]},a.prototype.readFloatLE=function(e,t){return t||P(e,4,this.length),Z.read(this,e,!0,23,4)},a.prototype.readFloatBE=function(e,t){return t||P(e,4,this.length),Z.read(this,e,!1,23,4)},a.prototype.readDoubleLE=function(e,t){return t||P(e,8,this.length),Z.read(this,e,!0,52,8)},a.prototype.readDoubleBE=function(e,t){return t||P(e,8,this.length),Z.read(this,e,!1,52,8)},a.prototype.writeUIntLE=function(e,t,r,n){if(e=+e,t=0|t,r=0|r,!n){var s=Math.pow(2,8*r)-1;H(this,e,t,r,s,0)}var i=1,a=0;for(this[t]=255&e;++a<r&&(i*=256);)this[t+a]=e/i&255;return t+r},a.prototype.writeUIntBE=function(e,t,r,n){if(e=+e,t=0|t,r=0|r,!n){var s=Math.pow(2,8*r)-1;H(this,e,t,r,s,0)}var i=r-1,a=1;for(this[t+i]=255&e;--i>=0&&(a*=256);)this[t+i]=e/a&255;return t+r},a.prototype.writeUInt8=function(e,t,r){return e=+e,t=0|t,r||H(this,e,t,1,255,0),a.TYPED_ARRAY_SUPPORT||(e=Math.floor(e)),this[t]=255&e,t+1},a.prototype.writeUInt16LE=function(e,t,r){return e=+e,t=0|t,r||H(this,e,t,2,65535,0),a.TYPED_ARRAY_SUPPORT?(this[t]=255&e,this[t+1]=e>>>8):I(this,e,t,!0),t+2},a.prototype.writeUInt16BE=function(e,t,r){return e=+e,t=0|t,r||H(this,e,t,2,65535,0),a.TYPED_ARRAY_SUPPORT?(this[t]=e>>>8,this[t+1]=255&e):I(this,e,t,!1),t+2},a.prototype.writeUInt32LE=function(e,t,r){return e=+e,t=0|t,r||H(this,e,t,4,4294967295,0),a.TYPED_ARRAY_SUPPORT?(this[t+3]=e>>>24,this[t+2]=e>>>16,this[t+1]=e>>>8,this[t]=255&e):D(this,e,t,!0),t+4},a.prototype.writeUInt32BE=function(e,t,r){return e=+e,t=0|t,r||H(this,e,t,4,4294967295,0),a.TYPED_ARRAY_SUPPORT?(this[t]=e>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=255&e):D(this,e,t,!1),t+4},a.prototype.writeIntLE=function(e,t,r,n){if(e=+e,t=0|t,!n){var s=Math.pow(2,8*r-1);H(this,e,t,r,s-1,-s)}var i=0,a=1,o=0;for(this[t]=255&e;++i<r&&(a*=256);)e<0&&0===o&&0!==this[t+i-1]&&(o=1),this[t+i]=(e/a>>0)-o&255;return t+r},a.prototype.writeIntBE=function(e,t,r,n){if(e=+e,t=0|t,!n){var s=Math.pow(2,8*r-1);H(this,e,t,r,s-1,-s)}var i=r-1,a=1,o=0;for(this[t+i]=255&e;--i>=0&&(a*=256);)e<0&&0===o&&0!==this[t+i+1]&&(o=1),this[t+i]=(e/a>>0)-o&255;return t+r},a.prototype.writeInt8=function(e,t,r){return e=+e,t=0|t,r||H(this,e,t,1,127,-128),a.TYPED_ARRAY_SUPPORT||(e=Math.floor(e)),e<0&&(e=255+e+1),this[t]=255&e,t+1},a.prototype.writeInt16LE=function(e,t,r){return e=+e,t=0|t,r||H(this,e,t,2,32767,-32768),a.TYPED_ARRAY_SUPPORT?(this[t]=255&e,this[t+1]=e>>>8):I(this,e,t,!0),t+2},a.prototype.writeInt16BE=function(e,t,r){return e=+e,t=0|t,r||H(this,e,t,2,32767,-32768),a.TYPED_ARRAY_SUPPORT?(this[t]=e>>>8,this[t+1]=255&e):I(this,e,t,!1),t+2},a.prototype.writeInt32LE=function(e,t,r){return e=+e,t=0|t,r||H(this,e,t,4,2147483647,-2147483648),a.TYPED_ARRAY_SUPPORT?(this[t]=255&e,this[t+1]=e>>>8,this[t+2]=e>>>16,this[t+3]=e>>>24):D(this,e,t,!0),t+4},a.prototype.writeInt32BE=function(e,t,r){return e=+e,t=0|t,r||H(this,e,t,4,2147483647,-2147483648),e<0&&(e=4294967295+e+1),a.TYPED_ARRAY_SUPPORT?(this[t]=e>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=255&e):D(this,e,t,!1),t+4},a.prototype.writeFloatLE=function(e,t,r){return F(this,e,t,!0,r)},a.prototype.writeFloatBE=function(e,t,r){return F(this,e,t,!1,r)},a.prototype.writeDoubleLE=function(e,t,r){return K(this,e,t,!0,r)},a.prototype.writeDoubleBE=function(e,t,r){return K(this,e,t,!1,r)},a.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 s,i=n-r;if(this===e&&r<t&&t<n)for(s=i-1;s>=0;--s)e[s+t]=this[s+r];else if(i<1e3||!a.TYPED_ARRAY_SUPPORT)for(s=0;s<i;++s)e[s+t]=this[s+r];else Uint8Array.prototype.set.call(e,this.subarray(r,r+i),t);return i},a.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 s=e.charCodeAt(0);s<256&&(e=s)}if(void 0!==n&&"string"!=typeof n)throw new TypeError("encoding must be a string");if("string"==typeof n&&!a.isEncoding(n))throw new TypeError("Unknown encoding: "+n)}else"number"==typeof e&&(e=255&e);if(t<0||this.length<t||this.length<r)throw new RangeError("Out of range index");if(r<=t)return this;t>>>=0,r=void 0===r?this.length:r>>>0,e||(e=0);var i;if("number"==typeof e)for(i=t;i<r;++i)this[i]=e;else{var o=a.isBuffer(e)?e:G(new a(e,n).toString()),l=o.length;for(i=0;i<r-t;++i)this[i+t]=o[i%l]}return this};var te=/[^+\/0-9A-Za-z-_]/g}).call(t,r(11))},function(e,t,r){"use strict";t.converter=r(27),t.transformers=r(6)},function(e,t,r){(function(e){"use strict;";var r=this,n=4294967292,s=4294967293,i=4294967294,a=4294967295,o=[0,1,3,7,15,31,63,127,255,511,1023],l=["00","01","02","03","04","05","06","07","08","09","0A","0B","0C","0D","0E","0F","10","11","12","13","14","15","16","17","18","19","1A","1B","1C","1D","1E","1F","20","21","22","23","24","25","26","27","28","29","2A","2B","2C","2D","2E","2F","30","31","32","33","34","35","36","37","38","39","3A","3B","3C","3D","3E","3F","40","41","42","43","44","45","46","47","48","49","4A","4B","4C","4D","4E","4F","50","51","52","53","54","55","56","57","58","59","5A","5B","5C","5D","5E","5F","60","61","62","63","64","65","66","67","68","69","6A","6B","6C","6D","6E","6F","70","71","72","73","74","75","76","77","78","79","7A","7B","7C","7D","7E","7F","80","81","82","83","84","85","86","87","88","89","8A","8B","8C","8D","8E","8F","90","91","92","93","94","95","96","97","98","99","9A","9B","9C","9D","9E","9F","A0","A1","A2","A3","A4","A5","A6","A7","A8","A9","AA","AB","AC","AD","AE","AF","B0","B1","B2","B3","B4","B5","B6","B7","B8","B9","BA","BB","BC","BD","BE","BF","C0","C1","C2","C3","C4","C5","C6","C7","C8","C9","CA","CB","CC","CD","CE","CF","D0","D1","D2","D3","D4","D5","D6","D7","D8","D9","DA","DB","DC","DD","DE","DF","E0","E1","E2","E3","E4","E5","E6","E7","E8","E9","EA","EB","EC","ED","EE","EF","F0","F1","F2","F3","F4","F5","F6","F7","F8","F9","FA","FB","FC","FD","FE","FF"],c="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=".split(""),h=[];c.forEach(function(e){h.push(e.charCodeAt(0))}),t.utf8={encode:function(t){var r=[];return t.forEach(function(e){if(e>=0&&e<=127)r.push(e);else if(e<=2047)r.push(192+(e>>6&o[5])),r.push(128+(e&o[6]));else if(e<55296||e>57343&&e<=65535)r.push(224+(e>>12&o[4])),r.push(128+(e>>6&o[6])),r.push(128+(e&o[6]));else{if(!(e>=65536&&e<=1114111))throw new RangeError("utf8.encode: character out of range: char: "+e);var t=e>>16&o[5];r.push(240+(t>>2)),r.push(128+((t&o[2])<<4)+(e>>12&o[4])),r.push(128+(e>>6&o[6])),r.push(128+(e&o[6]))}}),e.from(r)},decode:function(e,t){function r(e,t){if(128!==(192&t))return s;var r=((e&o[5])<<6)+(t&o[6]);return r<128?n:r}function l(e,t,r){if(128!==(192&r)||128!==(192&t))return s;var a=((e&o[4])<<12)+((t&o[6])<<6)+(r&o[6]);return a<2048?n:a>=55296&&a<=57343?i:a}function c(e,t,r,a){if(128!==(192&a)||128!==(192&r)||128!==(192&t))return s;var l=(((e&o[3])<<2)+(t>>4&o[2])<<16)+((t&o[4])<<12)+((r&o[6])<<6)+(a&o[6]);return l<65536?n:l>1114111?i:l}for(var h,u,p,d,f,g,m=e.length,b=t?3:0,y=[];b<m;){for(u=e[b],h=a;;){if(u>=0&&u<=127){h=u,g=1;break}if(p=b+1,p<m&&u>=194&&u<=223){h=r(u,e[p]),g=2;break}if(d=b+2,d<m&&u>=224&&u<=239){h=l(u,e[p],e[d]),g=3;break}if(f=b+3,f<m&&u>=240&&u<=244){h=c(u,e[p],e[d],e[f]),g=4;break}break}if(h>1114111){var x="byte["+b+"]";if(h===a)throw new RangeError("utf8.decode: ill-formed UTF8 byte sequence found at: "+x);if(h===s)throw new RangeError("utf8.decode: illegal trailing byte found at: "+x);if(h===i)throw new RangeError("utf8.decode: code point out of range found at: "+x);if(h===n)throw new RangeError("utf8.decode: non-shortest form found at: "+x);throw new RangeError("utf8.decode: unrecognized error found at: "+x)}y.push(h),b+=g}return y}},t.utf16be={encode:function(t){for(var r,n,s,i=[],a=0;a<t.length;a+=1)if(r=t[a],r>=0&&r<=55295||r>=57344&&r<=65535)i.push(r>>8&o[8]),i.push(r&o[8]);else{if(!(r>=65536&&r<=1114111))throw new RangeError("utf16be.encode: UTF16BE value out of range: char["+a+"]: "+r);s=r-65536,n=55296+(s>>10),s=56320+(s&o[10]),i.push(n>>8&o[8]),i.push(n&o[8]),i.push(s>>8&o[8]),i.push(s&o[8])}return e.from(i)},decode:function(e,t){if(e.length%2>0)throw new RangeError("utf16be.decode: data length must be even multiple of 2: length: "+e.length);for(var r,n,s,i,a,o,l=[],c=e.length,h=t?2:0,u=0;h<c;){for(;;){if(s=h+1,s<c){if(a=(e[h]<<8)+e[s],a<55296||a>57343){r=a,n=2;break}if(i=h+3,i<c&&(o=(e[h+2]<<8)+e[i],a<=56319&&o>=56320&&o<=57343)){r=65536+(a-55296<<10)+(o-56320),n=4;break}}throw new RangeError("utf16be.decode: ill-formed UTF16BE byte sequence found: byte["+h+"]")}l[u++]=r,h+=n}return l}},t.utf16le={encode:function(t){for(var r,n,s,i=[],a=0;a<t.length;a+=1)if(r=t[a],r>=0&&r<=55295||r>=57344&&r<=65535)i.push(r&o[8]),i.push(r>>8&o[8]);else{if(!(r>=65536&&r<=1114111))throw new RangeError("utf16le.encode: UTF16LE value out of range: char["+a+"]: "+r);s=r-65536,n=55296+(s>>10), s=56320+(s&o[10]),i.push(n&o[8]),i.push(n>>8&o[8]),i.push(s&o[8]),i.push(s>>8&o[8])}return e.from(i)},decode:function(e,t){if(e.length%2>0)throw new RangeError("utf16le.decode: data length must be even multiple of 2: length: "+e.length);for(var r,n,s,i,a,o,l=[],c=e.length,h=t?2:0,u=0;h<c;){for(;;){if(s=h+1,s<c){if(a=(e[s]<<8)+e[h],a<55296||a>57343){r=a,n=2;break}if(i=h+3,i<c&&(o=(e[i]<<8)+e[h+2],a<=56319&&o>=56320&&o<=57343)){r=65536+(a-55296<<10)+(o-56320),n=4;break}}throw new RangeError("utf16le.decode: ill-formed UTF16LE byte sequence found: byte["+h+"]")}l[u++]=r,h+=n}return l}},t.utf32be={encode:function(t){var r=e.alloc(4*t.length),n=0;return t.forEach(function(e){if(e>=55296&&e<=57343||e>1114111)throw new RangeError("utf32be.encode: UTF32BE character code out of range: char["+n/4+"]: "+e);r[n++]=e>>24&o[8],r[n++]=e>>16&o[8],r[n++]=e>>8&o[8],r[n++]=e&o[8]}),r},decode:function(e,t){if(e.length%4>0)throw new RangeError("utf32be.decode: UTF32BE byte length must be even multiple of 4: length: "+e.length);for(var r=[],n=t?4:0;n<e.length;n+=4){var s=(e[n]<<24)+(e[n+1]<<16)+(e[n+2]<<8)+e[n+3];if(s>=55296&&s<=57343||s>1114111)throw new RangeError("utf32be.decode: UTF32BE character code out of range: char["+n/4+"]: "+s);r.push(s)}return r}},t.utf32le={encode:function(t){var r=e.alloc(4*t.length),n=0;return t.forEach(function(e){if(e>=55296&&e<=57343||e>1114111)throw new RangeError("utf32le.encode: UTF32LE character code out of range: char["+n/4+"]: "+e);r[n++]=e&o[8],r[n++]=e>>8&o[8],r[n++]=e>>16&o[8],r[n++]=e>>24&o[8]}),r},decode:function(e,t){if(e.length%4>0)throw new RangeError("utf32be.decode: UTF32LE byte length must be even multiple of 4: length: "+e.length);for(var r=[],n=t?4:0;n<e.length;n+=4){var s=(e[n+3]<<24)+(e[n+2]<<16)+(e[n+1]<<8)+e[n];if(s>=55296&&s<=57343||s>1114111)throw new RangeError("utf32le.encode: UTF32LE character code out of range: char["+n/4+"]: "+s);r.push(s)}return r}},t.uint7={encode:function(t){for(var r=e.alloc(t.length),n=0;n<t.length;n+=1){if(t[n]>127)throw new RangeError("uint7.encode: UINT7 character code out of range: char["+n+"]: "+t[n]);r[n]=t[n]}return r},decode:function(e){for(var t=[],r=0;r<e.length;r+=1){if(e[r]>127)throw new RangeError("uint7.decode: UINT7 character code out of range: byte["+r+"]: "+e[r]);t[r]=e[r]}return t}},t.uint8={encode:function(t){for(var r=e.alloc(t.length),n=0;n<t.length;n+=1){if(t[n]>255)throw new RangeError("uint8.encode: UINT8 character code out of range: char["+n+"]: "+t[n]);r[n]=t[n]}return r},decode:function(e){for(var t=[],r=0;r<e.length;r+=1)t[r]=e[r];return t}},t.uint16be={encode:function(t){var r=e.alloc(2*t.length),n=0;return t.forEach(function(e){if(e>65535)throw new RangeError("uint16be.encode: UINT16BE character code out of range: char["+n/2+"]: "+e);r[n++]=e>>8&o[8],r[n++]=e&o[8]}),r},decode:function(e){if(e.length%2>0)throw new RangeError("uint16be.decode: UINT16BE byte length must be even multiple of 2: length: "+e.length);for(var t=[],r=0;r<e.length;r+=2)t.push((e[r]<<8)+e[r+1]);return t}},t.uint16le={encode:function(t){var r=e.alloc(2*t.length),n=0;return t.forEach(function(e){if(e>65535)throw new RangeError("uint16le.encode: UINT16LE character code out of range: char["+n/2+"]: "+e);r[n++]=e&o[8],r[n++]=e>>8&o[8]}),r},decode:function(e){if(e.length%2>0)throw new RangeError("uint16le.decode: UINT16LE byte length must be even multiple of 2: length: "+e.length);for(var t=[],r=0;r<e.length;r+=2)t.push((e[r+1]<<8)+e[r]);return t}},t.uint32be={encode:function(t){var r=e.alloc(4*t.length),n=0;return t.forEach(function(e){r[n++]=e>>24&o[8],r[n++]=e>>16&o[8],r[n++]=e>>8&o[8],r[n++]=e&o[8]}),r},decode:function(e){if(e.length%4>0)throw new RangeError("uint32be.decode: UINT32BE byte length must be even multiple of 4: length: "+e.length);for(var t=[],r=0;r<e.length;r+=4)t.push((e[r]<<24)+(e[r+1]<<16)+(e[r+2]<<8)+e[r+3]);return t}},t.uint32le={encode:function(t){var r=e.alloc(4*t.length),n=0;return t.forEach(function(e){r[n++]=e&o[8],r[n++]=e>>8&o[8],r[n++]=e>>16&o[8],r[n++]=e>>24&o[8]}),r},decode:function(e){if(e.length%4>0)throw new RangeError("uint32le.decode: UINT32LE byte length must be even multiple of 4: length: "+e.length);for(var t=[],r=0;r<e.length;r+=4)t.push((e[r+3]<<24)+(e[r+2]<<16)+(e[r+1]<<8)+e[r]);return t}},t.string={encode:function(e){return r.utf16le.encode(e).toString("utf16le")},decode:function(t){return r.utf16le.decode(e.from(t,"utf16le"),0)}},t.escaped={encode:function(t){for(var r=[],n=0;n<t.length;n+=1){var s=t[n];if(96===s)r.push(s),r.push(s);else if(10===s)r.push(s);else if(s>=32&&s<=126)r.push(s);else{var i="";if(s>=0&&s<=31)i+="`x"+l[s];else if(s>=127&&s<=255)i+="`x"+l[s];else if(s>=256&&s<=65535)i+="`u"+l[s>>8&o[8]]+l[s&o[8]];else{if(!(s>=65536&&s<=4294967295))throw new Error("escape.encode(char): char > 0xffffffff not allowed");i+="`u{";var a=s>>24&o[8];a>0&&(i+=l[a]),i+=l[s>>16&o[8]]+l[s>>8&o[8]]+l[s&o[8]]+"}"}var c=e.from(i);c.forEach(function(e){r.push(e)})}}return e.from(r)},decode:function(e){function t(e){return e>=48&&e<=57||e>=65&&e<=70||e>=97&&e<=102}function r(e,r,n){var s={char:null,nexti:e+2,error:!0};if(e+1<r&&t(n[e])&&t(n[e+1])){var i=String.fromCodePoint(n[e],n[e+1]);s.char=parseInt(i,16),isNaN(s.char)||(s.error=!1)}return s}function n(e,r,n){var s={char:null,nexti:e+4,error:!0};if(e+3<r&&t(n[e])&&t(n[e+1])&&t(n[e+2])&&t(n[e+3])){var i=String.fromCodePoint(n[e],n[e+1],n[e+2],n[e+3]);s.char=parseInt(i,16),isNaN(s.char)||(s.error=!1)}return s}function s(e,r,n){for(var s={char:null,nexti:e+4,error:!0},i="";e<r&&t(n[e]);)i+=String.fromCodePoint(n[e]),e+=1;return s.char=parseInt(i,16),125!==n[e]||isNaN(s.char)||(s.error=!1),s.nexti=e+1,s}for(var i,a,o,l=[],c=e.length,h=0;h<c;){for(;;){if(o=!0,96!==e[h]){l.push(e[h]),h+=1,o=!1;break}if(i=h+1,i>=c)break;if(96===e[i]){l.push(96),h+=2,o=!1;break}if(120===e[i]){if(a=r(i+1,c,e),a.error)break;l.push(a.char),h=a.nexti,o=!1;break}if(117===e[i]){if(123===e[i+1]){if(a=s(i+2,c,e),a.error)break;l.push(a.char),h=a.nexti,o=!1;break}if(a=n(i+1,c,e),a.error)break;l.push(a.char),h=a.nexti,o=!1;break}break}if(o)throw new Error("escaped.decode: ill-formed escape sequence at buf["+h+"]")}return l}};var u=13,p=10;t.lineEnds={crlf:function(e){for(var t=[],r=0;r<e.length;)switch(e[r]){case u:r+=r+1<e.length&&e[r+1]===p?2:1,t.push(u),t.push(p);break;case p:t.push(u),t.push(p),r+=1;break;default:t.push(e[r]),r+=1}return t.length>0&&t[t.length-1]!==p&&(t.push(u),t.push(p)),t},lf:function(e){for(var t=[],r=0;r<e.length;)switch(e[r]){case u:r+=r+1<e.length&&e[r+1]===p?2:1,t.push(p);break;case p:t.push(p),r+=1;break;default:t.push(e[r]),r+=1}return t.length>0&&t[t.length-1]!==p&&t.push(p),t}},t.base64={encode:function(t){if(0===t.length)return e.alloc(0);var r,n,s,i=t.length%3;i=i>0?3-i:0;var a=(t.length+i)/3,l=e.alloc(4*a);i>0&&(a-=1),r=0,n=0;for(var c=0;c<a;c+=1)s=t[r++]<<16,s+=t[r++]<<8,s+=t[r++],l[n++]=h[s>>18&o[6]],l[n++]=h[s>>12&o[6]],l[n++]=h[s>>6&o[6]],l[n++]=h[s&o[6]];return 0===i?l:1===i?(s=t[r++]<<16,s+=t[r]<<8,l[n++]=h[s>>18&o[6]],l[n++]=h[s>>12&o[6]],l[n++]=h[s>>6&o[6]],l[n]=h[64],l):2===i?(s=t[r]<<16,l[n++]=h[s>>18&o[6]],l[n++]=h[s>>12&o[6]],l[n++]=h[64],l[n]=h[64],l):void 0},decode:function(t){function r(t){for(var r=[],n=0,s=0;s<t.length;s+=1)for(var i=t[s];;){if(32===i||9===i||10===i||13===i)break;if(i>=65&&i<=90){r.push(i-65);break}if(i>=97&&i<=122){r.push(i-71);break}if(i>=48&&i<=57){r.push(i+4);break}if(43===i){r.push(62);break}if(47===i){r.push(63);break}if(61===i){r.push(64),n+=1;break}throw new RangeError("base64.decode: invalid character buf["+s+"]: "+i)}if(r.length%4>0)throw new RangeError("base64.decode: string length not integral multiple of 4: "+r.length);switch(n){case 0:break;case 1:if(64!==r[r.length-1])throw new RangeError("base64.decode: one tail character found: not last character");break;case 2:if(64!==r[r.length-1]||64!==r[r.length-2])throw new RangeError("base64.decode: two tail characters found: not last characters");break;default:throw new RangeError("base64.decode: more than two tail characters found: "+n)}return{tail:n,buf:e.from(r)}}if(0===t.length)return e.alloc(0);var n,s,i,a=r(t),l=a.tail,c=a.buf,h=c.length/4,u=e.alloc(3*h-l);l>0&&(h-=1),s=0,n=0;for(var p=0;p<h;p+=1)i=c[n++]<<18,i+=c[n++]<<12,i+=c[n++]<<6,i+=c[n++],u[s++]=i>>16&o[8],u[s++]=i>>8&o[8],u[s++]=i&o[8];return 1===l&&(i=c[n++]<<18,i+=c[n++]<<12,i+=c[n]<<6,u[s++]=i>>16&o[8],u[s]=i>>8&o[8]),2===l&&(i=c[n++]<<18,i+=c[n++]<<12,u[s]=i>>16&o[8]),u},toString:function(e){function t(e,t,r,i){switch(s){case 76:n+="\r\n"+e+t+r+i,s=4;break;case 75:n+=e+"\r\n"+t+r+i,s=3;break;case 74:n+=e+t+"\r\n"+r+i,s=2;break;case 73:n+=e+t+r+"\r\n"+i,s=1;break;default:n+=e+t+r+i,s+=4}}function r(e){return e>=65&&e<=90||(e>=97&&e<=122||(e>=48&&e<=57||(43===e||(47===e||61===e))))}if(e.length%4>0)throw new RangeError("base64.toString: input buffer length not multiple of 4: "+e.length);for(var n="",s=0,i=0;i<e.length;i+=4){for(var a=i;a<i+4;a+=1)if(!r(e[a]))throw new RangeError("base64.toString: buf["+a+"]: "+e[a]+" : not valid base64 character code");t(String.fromCharCode(e[i]),String.fromCharCode(e[i+1]),String.fromCharCode(e[i+2]),String.fromCharCode(e[i+3]))}return n}}}).call(t,r(4).Buffer)},function(e,t,r){"use strict;";var n=r(0),s=n.utils,i=n.style,a=16,o=10,l=8,c=32,h=function(e,t){if(""===e)return'<span class="'+i.CLASS_EMPTY+'">&#120634;</span>';if(void 0===e)return'<span class="'+i.CLASS_REMAINDER+'">undefined</span>';var r=i.CLASS_REMAINDER;"string"==typeof t&&("match"===t.toLowerCase()?r=i.CLASS_MATCH:"nomatch"===t.toLowerCase()&&(r=i.CLASS_NOMATCH));var s=n.utils.stringToChars(e),a='<span class="'+r+'">';return a+=n.utils.charsToAsciiHtml(s),a+"</span>"},u=function(e){var t="";t+=" result:\n",t+=" [0]: ",t+=e[0],t+="\n",t+=" input: "+e.input,t+="\n",t+=" index: "+e.index,t+="\n",t+=" length: "+e.length,t+="\n",t+="tree depth: "+e.treeDepth,t+="\n",t+=" node hits: "+e.nodeHits,t+="\n",t+=" rules: ";var r="",n=" : ",s=e.rules;for(var i in s){var a=s[i];if(a)for(var o=0;o<a.length;o+=1){var l=a[o];t+=r+i+" : "+l.index+": ",t+=l.phrase,t+="\n",r=n}else t+=r+i+": ",t+="undefined",t+="\n";r=n}return t},p=function(e){var t="",r="result:";t+='<table class="'+i.CLASS_STATE+'">\n',t+="<caption>"+r+"</caption>\n",t+="<tr>",t+="<th>item</th><th>value</th><th>phrase</th>",t+="</tr>\n",t+="<tr>",t+="<td>[0]</td>",t+="<td>"+e.index+"</td>",t+="<td>"+h(e[0],"match")+"</td>",t+="</tr>\n",t+="<tr>",t+="<td>input</td>",t+="<td>0</td>",t+="<td>"+h(e.input)+"</td>",t+="</tr>\n",t+="<tr>",t+="<td>index</td><td>"+e.index+"</td>",t+="<td></td>",t+="</tr>\n",t+="<tr>",t+="<td>length</td><td>"+e.length+"</td>",t+="<td></td>",t+="</tr>\n",t+="<tr>",t+="<td>tree depth</td><td>"+e.treeDepth+"</td>",t+="<td></td>",t+="</tr>\n",t+="<tr>",t+="<td>node hits</td><td>"+e.nodeHits+"</td>",t+="<td></td>",t+="</tr>\n",t+="<tr>",t+="<th>rules</th><th>index</th><th>phrase</th>",t+="</tr>\n";var n=e.rules;for(var s in n){var a=n[s];if(a)for(var o=0;o<a.length;o+=1){var l=a[o];t+="<tr>",t+="<td>"+s+"</td>",t+="<td>"+l.index+"</td>",t+="<td>"+h(l.phrase,"match")+"</td>",t+="\n"}else t+="<tr>",t+="<td>"+s+"</td>",t+="<td></td>",t+="<td>"+h(void 0)+"</td>",t+="\n"}return t+="</table>\n"},d=function(e){return s.htmlToPage(p(e),"apg-exp result")},f=function(e){var t="";if(t+=" last match:\n",t+=" lastIndex: ",t+=e.lastIndex,t+="\n",t+=' flags: "',t+=e.flags+'"',t+="\n",t+=" global: ",t+=e.global,t+="\n",t+=" sticky: ",t+=e.sticky,t+="\n",t+=" unicode: ",t+=e.unicode,t+="\n",t+=" debug: ",t+=e.debug,t+="\n",void 0===e["$&"])return t+=" last match: undefined",t+="\n";t+=" input: ",t+=e.input,t+="\n",t+=" leftContext: ",t+=e.leftContext,t+="\n",t+=" lastMatch: ",t+=e.lastMatch,t+="\n",t+="rightContext: ",t+=e.rightContext,t+="\n",t+=" rules: ";var r="",n=" : ";for(var s in e.rules)t+=r+s+" : ",t+=e.rules[s],t+="\n",r=n;t+="\n",t+="alias:\n",t+=' ["$_"]: ',t+=e.$_,t+="\n",t+=' ["$`"]: ',t+=e["$`"],t+="\n",t+=' ["$&"]: ',t+=e["$&"],t+="\n",t+=' ["$\'"]: ',t+=e["$'"],t+="\n";for(var s in e.rules)t+=' ["${'+s+'}"]: ',t+=e["${"+s+"}"],t+="\n";return t},g=function(e){var t="",r="last match:";if(t+='<table class="'+i.CLASS_STATE+'">\n',t+="<caption>"+r+"</caption>\n",t+="<tr>",t+="<th>item</th><th>value</th>",t+="</tr>\n",t+="<tr>",t+="<td>lastIndex</td>",t+="<td>"+e.lastIndex+"</td>",t+="</tr>\n",t+="<tr>",t+="<td>flags</td>",t+="<td>&#34;"+e.flags+"&#34;</td>",t+="</tr>\n",t+="<tr>",t+="<td>global</td>",t+="<td>"+e.global+"</td>",t+="</tr>\n",t+="<tr>",t+="<td>sticky</td>",t+="<td>"+e.sticky+"</td>",t+="</tr>\n",t+="<tr>",t+="<td>unicode</td>",t+="<td>"+e.unicode+"</td>",t+="</tr>\n",t+="<tr>",t+="<td>debug</td>",t+="<td>"+e.debug+"</td>",t+="</tr>\n",void 0===e["$&"])return t+="<tr>",t+="<td>lastMatch</td>",t+="<td>"+h(void 0)+"</td>",t+="</tr>\n",t+="</table>\n";t+="<th>item</th><th>phrase</th>",t+="</tr>\n",t+="<tr>",t+="<td>input</td>",t+="<td>"+h(e.input)+"</td>",t+="</tr>\n",t+="<tr>",t+="<td>leftContext</td>",t+="<td>"+h(e.leftContext)+"</td>",t+="</tr>\n",t+="<tr>",t+="<td>lastMatch</td>",t+="<td>"+h(e.lastMatch,"match")+"</td>",t+="</tr>\n",t+="<tr>",t+="<td>rightContext</td>",t+="<td>"+h(e.rightContext)+"</td>",t+="</tr>\n",t+="<tr>",t+="<th>rule</th><th>phrase</th>",t+="</tr>\n";for(var n in e.rules)t+="<tr>",t+="<td>"+n+"</td>",t+="<td>"+h(e.rules[n])+"</td>",t+="</tr>\n";t+="<tr>",t+="<th>alias</th><th>phrase</th>",t+="</tr>\n",t+="<tr>",t+='<td>["$_"]</td>',t+="<td>"+h(e.$_)+"</td>",t+="</tr>\n",t+="<tr>",t+='<td>["$`"]</td>',t+="<td>"+h(e["$`"])+"</td>",t+="</tr>\n",t+="<tr>",t+='<td>["$&"]</td>',t+="<td>"+h(e["$&"],"match")+"</td>",t+="</tr>\n",t+="<tr>",t+='<td>["$\'"]</td>',t+="<td>"+h(e["$'"])+"</td>",t+="</tr>\n";for(var n in e.rules)t+="<tr>",t+='<td>["${'+n+'}"]</td>',t+="<td>"+h(e["${"+n+"}"])+"</td>",t+="</tr>\n";return t+="</table>\n"},m=function(e){return s.htmlToPage(g(e),"apg-exp last result")},b=function(e){var t=l;if("string"==typeof e&&e.length>=3){var r=e.toLowerCase().slice(0,3);"hex"===r?t=a:"dec"===r?t=o:"uni"===r&&(t=c)}return t},y=function(e){var t;switch(e){case l:t="ascii";break;case a:t="hexidecimal";break;case o:t="decimal";break;case c:t="Unicode"}return t},x=function(e){var t=e.toString(16);return t.length%2!==0&&(t="0"+t),t},T=function(e,t){var r="";if(t===l)r+=n.utils.charsToString(e);else if(t===o){if(r+="[",e.length>0){r+=e[0];for(var s=1;s<e.length;s+=1)r+=","+e[s]}r+="]"}else if(t===a){if(r+="[",e.length>0){r+="\\x"+x(e[0]);for(var s=1;s<e.length;s+=1)r+=",\\x"+x(e[s])}r+="]"}else if(t===c){if(r+="[",e.length>0){r+="\\u"+x(e[0]);for(var s=1;s<e.length;s+=1)r+=",\\u"+x(e[s])}r+="]"}return r},E=function(e,t){t=b(t);var r="";r+=" result("+y(t)+")\n",r+=" [0]: ",r+=T(e[0],t),r+="\n",r+=" input: "+T(e.input,t),r+="\n",r+=" index: "+e.index,r+="\n",r+=" length: "+e.length,r+="\n",r+="tree depth: "+e.treeDepth,r+="\n",r+=" node hits: "+e.nodeHits,r+="\n",r+=" rules: ",r+="\n";var n=e.rules;for(var s in n){var i=n[s];if(i)for(var a=0;a<i.length;a+=1){var o=i[a];r+=" :"+s+" : "+o.index+": ",r+=T(o.phrase,t),r+="\n"}else r+=" :"+s+": ",r+="undefined",r+="\n"}return r},k=function(e,t){t=b(t);var r="",n="result:";n+="("+y(t)+")",r+='<table class="'+i.CLASS_STATE+'">\n',r+="<caption>"+n+"</caption>\n",r+="<tr>",r+="<th>item</th><th>value</th><th>phrase</th>",r+="</tr>\n",r+="<tr>",r+="<td>[0]</td>",r+="<td>"+e.index+"</td>",r+="<td>"+h(T(e[0],t),"match")+"</td>",r+="</tr>\n",r+="<tr>",r+="<td>input</td>",r+="<td>0</td>",r+="<td>"+h(T(e.input,t))+"</td>",r+="</tr>\n",r+="<tr>",r+="<td>index</td><td>"+e.index+"</td>",r+="<td></td>",r+="</tr>\n",r+="<tr>",r+="<td>length</td><td>"+e.length+"</td>",r+="<td></td>",r+="</tr>\n",r+="<tr>",r+="<td>tree depth</td><td>"+e.treeDepth+"</td>",r+="<td></td>",r+="</tr>\n",r+="<tr>",r+="<td>node hits</td><td>"+e.nodeHits+"</td>",r+="<td></td>",r+="</tr>\n",r+="<tr>",r+="<th>rules</th><th>index</th><th>phrase</th>",r+="</tr>\n";var s=e.rules;for(var a in s){var o=s[a];if(o)for(var l=0;l<o.length;l+=1){var c=o[l];r+="<tr>",r+="<td>"+a+"</td>",r+="<td>"+c.index+"</td>",r+="<td>"+h(T(c.phrase,t),"match")+"</td>",r+="\n"}else r+="<tr>",r+="<td>"+a+"</td>",r+="<td></td>",r+="<td>"+h(void 0)+"</td>",r+="\n"}return r+="</table>\n"},A=function(e,t){return s.htmlToPage(k(e,t))},v=function(e,t){t=b(t);var r="";if(r+=" last match("+y(t)+")\n",r+=" lastIndex: "+e.lastIndex,r+="\n",r+=' flags: "'+e.flags+'"',r+="\n",r+=" global: "+e.global,r+="\n",r+=" sticky: "+e.sticky,r+="\n",r+=" unicode: "+e.unicode,r+="\n",r+=" debug: "+e.debug,r+="\n",void 0===e["$&"])return r+=" lastMatch: undefined",r+="\n";r+=" input: ",r+=T(e.input,t),r+="\n",r+=" leftContext: ",r+=T(e.leftContext,t),r+="\n",r+=" lastMatch: ",r+=T(e.lastMatch,t),r+="\n",r+="rightContext: ",r+=T(e.rightContext,t),r+="\n",r+=" rules:";var n="",s=" :";for(var i in e.rules)r+=n+i+" : ",r+=e.rules[i]?T(e.rules[i],t):"undefined",r+="\n",n=s;r+="\n",r+=" alias:\n",r+=' ["$_"]: ',r+=T(e.$_,t),r+="\n",r+=' ["$`"]: ',r+=T(e["$`"],t),r+="\n",r+=' ["$&"]: ',r+=T(e["$&"],t),r+="\n",r+=' ["$\'"]: ',r+=T(e["$'"],t),r+="\n";for(var i in e.rules)r+=' ["${'+i+'}"]: ',r+=e["${"+i+"}"]?T(e["${"+i+"}"],t):"undefined",r+="\n";return r},w=function(e,t){t=b(t);var r="",n="last match:";if(n+="("+y(t)+")",r+='<table class="'+i.CLASS_STATE+'">\n',r+="<caption>"+n+"</caption>\n",r+="<tr>",r+="<th>item</th><th>value</th>",r+="</tr>\n",r+="<tr>",r+="<td>lastIndex</td>",r+="<td>"+e.lastIndex+"</td>",r+="</tr>\n",r+="<tr>",r+="<td>flags</td>",r+="<td>&#34;"+e.flags+"&#34;</td>",r+="</tr>\n",r+="<tr>",r+="<td>global</td>",r+="<td>"+e.global+"</td>",r+="</tr>\n",r+="<tr>",r+="<td>sticky</td>",r+="<td>"+e.sticky+"</td>",r+="</tr>\n",r+="<tr>",r+="<td>unicode</td>",r+="<td>"+e.unicode+"</td>",r+="</tr>\n",r+="<tr>",r+="<td>debug</td>",r+="<td>"+e.debug+"</td>",r+="</tr>\n",r+="<tr>",r+="<th>item</th><th>phrase<