peggy
Version:
Parser generator for JavaScript
8 lines (7 loc) • 120 kB
JavaScript
// peggy 4.2.0
//
// https://peggyjs.org/
//
// Copyright (c) 2024- the Peggy authors
// Licensed under the MIT License.
!function(e,r){"object"==typeof exports&&"undefined"!=typeof module?module.exports=r():"function"==typeof define&&define.amd?define(r):(e="undefined"!=typeof globalThis?globalThis:e||self).peggy=r()}(this,(function(){"use strict";function getDefaultExportFromCjs(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var grammarLocation,hasRequiredGrammarLocation,grammarError,hasRequiredGrammarError,visitor_1,hasRequiredVisitor,asts_1,hasRequiredAsts,addImportedRules_1,hasRequiredAddImportedRules,fixLibraryNumbers_1,hasRequiredFixLibraryNumbers,opcodes_1,hasRequiredOpcodes,intern,hasRequiredIntern,inferenceMatchResult_1,hasRequiredInferenceMatchResult,generateBytecode_1,hasRequiredGenerateBytecode;function requireGrammarLocation(){if(hasRequiredGrammarLocation)return grammarLocation;hasRequiredGrammarLocation=1;var GrammarLocation=function(){function GrammarLocation(e,r){this.source=e,this.start=r}return GrammarLocation.prototype.toString=function(){return String(this.source)},GrammarLocation.prototype.offset=function(e){return{line:e.line+this.start.line-1,column:1===e.line?e.column+this.start.column-1:e.column,offset:e.offset+this.start.offset}},GrammarLocation.offsetStart=function(e){return e.source&&"function"==typeof e.source.offset?e.source.offset(e.start):e.start},GrammarLocation.offsetEnd=function(e){return e.source&&"function"==typeof e.source.offset?e.source.offset(e.end):e.end},GrammarLocation}();return grammarLocation=GrammarLocation}function requireGrammarError(){if(hasRequiredGrammarError)return grammarError;hasRequiredGrammarError=1;var e,r=grammarError&&grammarError.__extends||(e=function(r,t){return e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,r){e.__proto__=r}||function(e,r){for(var t in r)Object.prototype.hasOwnProperty.call(r,t)&&(e[t]=r[t])},e(r,t)},function(r,t){if("function"!=typeof t&&null!==t)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");function n(){this.constructor=r}e(r,t),r.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)}),GrammarLocation=requireGrammarLocation(),t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,r){e.__proto__=r}||function(e,r){for(var t in r)Object.prototype.hasOwnProperty.call(r,t)&&(e[t]=r[t])},n=function(e){function n(r,u,o){var i=e.call(this,r)||this;return t(i,n.prototype),i.name="GrammarError",i.location=u,void 0===o&&(o=[]),i.diagnostics=o,i.stage=null,i.problems=[["error",r,u,o]],i}return r(n,e),n.prototype.toString=function(){var r=e.prototype.toString.call(this);this.location&&(r+="\n at ",void 0!==this.location.source&&null!==this.location.source&&(r+="".concat(this.location.source,":")),r+="".concat(this.location.start.line,":").concat(this.location.start.column));for(var t=0,n=this.diagnostics;t<n.length;t++){var u=n[t];r+="\n from ",void 0!==u.location.source&&null!==u.location.source&&(r+="".concat(u.location.source,":")),r+="".concat(u.location.start.line,":").concat(u.location.start.column,": ").concat(u.message)}return r},n.prototype.format=function(e){var r=e.map((function(e){var r=e.source,t=e.text;return{source:r,text:null!=t?String(t).split(/\r\n|\n|\r/g):[]}}));function t(e,t,n){void 0===n&&(n="");var u="",o=r.find((function(r){return r.source===e.source})),i=e.start,a=GrammarLocation.offsetStart(e);if(o){var s=e.end,c=o.text[i.line-1],l=(i.line===s.line?s.column:c.length+1)-i.column||1;n&&(u+="\nnote: ".concat(n)),u+="\n --\x3e ".concat(e.source,":").concat(a.line,":").concat(a.column,"\n").concat("".padEnd(t)," |\n").concat(a.line.toString().padStart(t)," | ").concat(c,"\n").concat("".padEnd(t)," | ").concat("".padEnd(i.column-1)).concat("".padEnd(l,"^"))}else u+="\n at ".concat(e.source,":").concat(a.line,":").concat(a.column),n&&(u+=": ".concat(n));return u}function n(e,r,n,u){void 0===u&&(u=[]);var o=-1/0;o=(o=n?u.reduce((function(e,r){var t=r.location;return Math.max(e,GrammarLocation.offsetStart(t).line)}),n.start.line):Math.max.apply(null,u.map((function(e){return e.location.start.line})))).toString().length;var i="".concat(e,": ").concat(r);n&&(i+=t(n,o));for(var a=0,s=u;a<s.length;a++){var c=s[a];i+=t(c.location,o,c.message)}return i}return this.problems.filter((function(e){return"info"!==e[0]})).map((function(e){return n.apply(void 0,e)})).join("\n\n")},n}(Error);return grammarError=n}function requireVisitor(){if(hasRequiredVisitor)return visitor_1;hasRequiredVisitor=1;var e=visitor_1&&visitor_1.__spreadArray||function(e,r,t){if(t||2===arguments.length)for(var n,u=0,o=r.length;u<o;u++)!n&&u in r||(n||(n=Array.prototype.slice.call(r,0,u)),n[u]=r[u]);return e.concat(n||Array.prototype.slice.call(r))},r={build:function(r){function t(t){for(var n=[],u=1;u<arguments.length;u++)n[u-1]=arguments[u];return r[t.type].apply(r,e([t],n,!1))}function n(){}function u(r){for(var n=[],u=1;u<arguments.length;u++)n[u-1]=arguments[u];return t.apply(void 0,e([r.expression],n,!1))}function o(r){return function(n){for(var u=[],o=1;o<arguments.length;o++)u[o-1]=arguments[o];n[r].forEach((function(r){return t.apply(void 0,e([r],u,!1))}))}}var i={grammar:function(r){for(var n=[],u=1;u<arguments.length;u++)n[u-1]=arguments[u];for(var o=0,i=r.imports;o<i.length;o++){var a=i[o];t.apply(void 0,e([a],n,!1))}if(r.topLevelInitializer)if(Array.isArray(r.topLevelInitializer))for(var s=0,c=r.topLevelInitializer;s<c.length;s++){var l=c[s];t.apply(void 0,e([l],n,!1))}else t.apply(void 0,e([r.topLevelInitializer],n,!1));if(r.initializer)if(Array.isArray(r.initializer))for(var p=0,f=r.initializer;p<f.length;p++){var h=f[p];t.apply(void 0,e([h],n,!1))}else t.apply(void 0,e([r.initializer],n,!1));r.rules.forEach((function(r){return t.apply(void 0,e([r],n,!1))}))},grammar_import:n,top_level_initializer:n,initializer:n,rule:u,named:u,choice:o("alternatives"),action:u,sequence:o("elements"),labeled:u,text:u,simple_and:u,simple_not:u,optional:u,zero_or_more:u,one_or_more:u,repeated:function(r){for(var n=[],u=1;u<arguments.length;u++)n[u-1]=arguments[u];return r.delimiter&&t.apply(void 0,e([r.delimiter],n,!1)),t.apply(void 0,e([r.expression],n,!1))},group:u,semantic_and:n,semantic_not:n,rule_ref:n,library_ref:n,literal:n,class:n,any:n};return Object.keys(i).forEach((function(e){Object.prototype.hasOwnProperty.call(r,e)||(r[e]=i[e])})),t}};return visitor_1=r}function requireAsts(){if(hasRequiredAsts)return asts_1;hasRequiredAsts=1;var e=requireVisitor();function r(e,r){if(!e||!r)return e||r;var t=Array.isArray(e)?e:[e];return t.push(r),t}var t={findRule:function(e,r){for(var t=0;t<e.rules.length;t++)if(e.rules[t].name===r)return e.rules[t]},indexOfRule:function(e,r){for(var t=0;t<e.rules.length;t++)if(e.rules[t].name===r)return t;return-1},alwaysConsumesOnSuccess:function(r,n){function u(){return!0}function o(){return!1}var i=e.build({choice:function(e){return e.alternatives.every(i)},sequence:function(e){return e.elements.some(i)},simple_and:o,simple_not:o,optional:o,zero_or_more:o,repeated:function(e){var r=e.min?e.min:e.max;return!("constant"!==r.type||0===r.value||!i(e.expression)&&!(r.value>1&&e.delimiter&&i(e.delimiter)))},semantic_and:o,semantic_not:o,rule_ref:function(e){var n=t.findRule(r,e.name);return n?i(n):void 0},library_ref:function(){return!1},literal:function(e){return""!==e.value},class:u,any:u});return i(n)},combine:function(e){return e.reduce((function(e,t){return e.topLevelInitializer=r(e.topLevelInitializer,t.topLevelInitializer),e.initializer=r(e.initializer,t.initializer),e.rules=e.rules.concat(t.rules),e}))}};return asts_1=t}function requireAddImportedRules(){return hasRequiredAddImportedRules?addImportedRules_1:(hasRequiredAddImportedRules=1,addImportedRules_1=function(e){for(var r=0,t=0,n=e.imports;t<n.length;t++){for(var u=n[t],o=0,i=u.what;o<i.length;o++){var a=i[o],s=void 0;switch(a.type){case"import_binding_all":continue;case"import_binding_default":break;case"import_binding":s=a.binding;break;case"import_binding_rename":s=a.rename;break;default:throw new TypeError("Unknown binding type")}e.rules.push({type:"rule",name:a.binding,nameLocation:a.location,expression:{type:"library_ref",name:s,library:u.from.module,libraryNumber:r,location:a.location},location:u.from.location})}r++}})}function requireFixLibraryNumbers(){if(hasRequiredFixLibraryNumbers)return fixLibraryNumbers_1;hasRequiredFixLibraryNumbers=1;var e=requireVisitor();return fixLibraryNumbers_1=function(r,t,n){var u=e.build({library_ref:function(e){-1===e.libraryNumber&&(e.libraryNumber=function(e,r){for(var t=0,n=0,u=e.imports;n<u.length;n++){for(var o=0,i=u[n].what;o<i.length;o++){var a=i[o];if("import_binding_all"===a.type&&a.binding===r)return t}t++}return-1}(r,e.library),-1===e.libraryNumber&&n.error('Unknown module "'.concat(e.library,'"'),e.location))}});u(r)},fixLibraryNumbers_1}function requireOpcodes(){return hasRequiredOpcodes?opcodes_1:(hasRequiredOpcodes=1,opcodes_1={PUSH:0,PUSH_EMPTY_STRING:35,PUSH_UNDEFINED:1,PUSH_NULL:2,PUSH_FAILED:3,PUSH_EMPTY_ARRAY:4,PUSH_CURR_POS:5,POP:6,POP_CURR_POS:7,POP_N:8,NIP:9,APPEND:10,WRAP:11,TEXT:12,PLUCK:36,IF:13,IF_ERROR:14,IF_NOT_ERROR:15,IF_LT:30,IF_GE:31,IF_LT_DYNAMIC:32,IF_GE_DYNAMIC:33,WHILE_NOT_ERROR:16,MATCH_ANY:17,MATCH_STRING:18,MATCH_STRING_IC:19,MATCH_CHAR_CLASS:20,MATCH_REGEXP:20,ACCEPT_N:21,ACCEPT_STRING:22,FAIL:23,LOAD_SAVED_POS:24,UPDATE_SAVED_POS:25,CALL:26,RULE:27,LIBRARY_RULE:41,SILENT_FAILS_ON:28,SILENT_FAILS_OFF:29,SOURCE_MAP_PUSH:37,SOURCE_MAP_POP:38,SOURCE_MAP_LABEL_PUSH:39,SOURCE_MAP_LABEL_POP:40})}function requireIntern(){if(hasRequiredIntern)return intern;hasRequiredIntern=1;var e=intern&&intern.__assign||function(){return e=Object.assign||function(e){for(var r,t=1,n=arguments.length;t<n;t++)for(var u in r=arguments[t])Object.prototype.hasOwnProperty.call(r,u)&&(e[u]=r[u]);return e},e.apply(this,arguments)},r=function(){function r(r){this.options=e({stringify:String,convert:function(e){return e}},r),this.items=[],this.offsets=Object.create(null)}return r.prototype.add=function(e){var r=this.options.convert(e);if(!r)return-1;var t=this.options.stringify(r),n=this.offsets[t];return void 0===n&&(n=this.items.push(r)-1,this.offsets[t]=n),n},r.prototype.get=function(e){return this.items[e]},r.prototype.map=function(e){return this.items.map(e)},r}();return intern=r}function requireInferenceMatchResult(){if(hasRequiredInferenceMatchResult)return inferenceMatchResult_1;hasRequiredInferenceMatchResult=1;var e=requireVisitor(),r=requireAsts(),t=requireGrammarError(),n=-1;function u(u){function o(e){return e.match=0}function i(e){return c(e.expression),e.match=1}function a(e){return e.match=c(e.expression)}function s(e,r){for(var t=e.length,u=0,o=0,i=0;i<t;++i){var a=c(e[i]);1===a&&++u,a===n&&++o}return u===t?1:r?o===t?n:0:o>0?n:0}var c=e.build({rule:function(e){var r,n=0;if(void 0===e.match){e.match=0;do{if(r=e.match,e.match=c(e.expression),++n>6)throw new t("Infinity cycle detected when trying to evaluate node match result",e.location)}while(r!==e.match)}return e.match},named:a,choice:function(e){return e.match=s(e.alternatives,!0)},action:a,sequence:function(e){return e.match=s(e.elements,!1)},labeled:a,text:a,simple_and:a,simple_not:function(e){return e.match=-c(e.expression)},optional:i,zero_or_more:i,one_or_more:a,repeated:function(e){var r=c(e.expression),t=e.delimiter?c(e.delimiter):n,u=e.min?e.min:e.max;return"constant"!==u.type||"constant"!==e.max.type?e.match=0:0===e.max.value||null!==e.max.value&&u.value>e.max.value?e.match=n:r===n?e.match=0===u.value?1:n:1===r?e.delimiter&&u.value>=2?e.match=t:e.match=1:e.delimiter&&u.value>=2?e.match=t===n?n:0:e.match=0===u.value?1:0},group:a,semantic_and:o,semantic_not:o,rule_ref:function(e){var t=r.findRule(u,e.name);return t?e.match=c(t):0},library_ref:function(){return 0},literal:function(e){var r=0===e.value.length?1:0;return e.match=r},class:function(e){var r=0===e.parts.length?n:0;return e.match=r},any:o});c(u)}return u.ALWAYS_MATCH=1,u.SOMETIMES_MATCH=0,u.NEVER_MATCH=n,inferenceMatchResult_1=u}function requireGenerateBytecode(){if(hasRequiredGenerateBytecode)return generateBytecode_1;hasRequiredGenerateBytecode=1;var e=generateBytecode_1&&generateBytecode_1.__spreadArray||function(e,r,t){if(t||2===arguments.length)for(var n,u=0,o=r.length;u<o;u++)!n&&u in r||(n||(n=Array.prototype.slice.call(r,0,u)),n[u]=r[u]);return e.concat(n||Array.prototype.slice.call(r))},r=requireAsts(),t=requireOpcodes(),n=requireVisitor(),u=requireIntern(),o=requireInferenceMatchResult(),i=o.ALWAYS_MATCH,a=o.SOMETIMES_MATCH,s=o.NEVER_MATCH;return generateBytecode_1=function(o,c){var l=new u,p=new u({stringify:JSON.stringify,convert:function(e){return{value:e.parts,inverted:e.inverted,ignoreCase:e.ignoreCase}}}),f=new u({stringify:JSON.stringify}),h=new u,d=[],g=[];function m(e,r,t){var n={predicate:e,params:r,body:t.code,location:t.codeLocation},u=JSON.stringify(n),o=d.findIndex((function(e){return JSON.stringify(e)===u}));return-1===o?d.push(n)-1:o}function A(e){return g.push(e)-1}function v(e){var r={};return Object.keys(e).forEach((function(t){r[t]=e[t]})),r}function C(e){for(var r=[],t=1;t<arguments.length;t++)r[t-1]=arguments[t];return e.concat.apply(e,r)}function y(e,r,t,n){return e===i?t:e===s?n:r.concat([t.length,n.length],t,n)}function _(e,r,n,u){var o=Object.keys(n).map((function(e){return u-n[e]}));return[t.CALL,e,r,o.length].concat(o)}function E(e,r,n){var u=e.match||0;return C([t.PUSH_CURR_POS],[t.SILENT_FAILS_ON],x(e,{sp:n.sp+1,env:v(n.env),action:null}),[t.SILENT_FAILS_OFF],y(r?-u:u,[r?t.IF_ERROR:t.IF_NOT_ERROR],C([t.POP],[r?t.POP:t.POP_CURR_POS],[t.PUSH_UNDEFINED]),C([t.POP],[r?t.POP_CURR_POS:t.POP],[t.PUSH_FAILED])))}function F(e,r,n){var u=m(!0,Object.keys(n.env),e);return C([t.UPDATE_SAVED_POS],_(u,0,n.env,n.sp),y(e.match||0,[t.IF],C([t.POP],r?[t.PUSH_FAILED]:[t.PUSH_UNDEFINED]),C([t.POP],r?[t.PUSH_UNDEFINED]:[t.PUSH_FAILED])))}function R(e){return r=[t.WHILE_NOT_ERROR],n=C([t.APPEND],e),r.concat([n.length],n);var r,n}function b(e,r,n,u){switch(e.type){case"constant":return{pre:[],post:[],sp:n};case"variable":return e.sp=u+n-r[e.value],{pre:[],post:[],sp:n};case"function":return e.sp=u,{pre:_(m(!0,Object.keys(r),{code:e.value,codeLocation:e.codeLocation}),0,r,n),post:[t.NIP],sp:n+1};default:throw function(e){return new Error('Unknown boundary type "'.concat(e.type,'" for the "repeated" node'))}(e)}}function S(e,r){if(null!==r.value){var n="constant"===r.type?[t.IF_GE,r.value]:[t.IF_GE_DYNAMIC,r.sp||0];return y(a,n,[t.PUSH_FAILED],e)}return e}var P,x=(P={grammar:function(e){e.rules.forEach(x),e.literals=l.items,e.classes=p.items,e.expectations=f.items,e.importedNames=h.items,e.functions=d,e.locations=g},rule:function(e){e.bytecode=x(e.expression,{sp:-1,env:{},pluck:[],action:null})},named:function(e,r){var n=e.match||0,u=n===s?-1:f.add({type:"rule",value:e.name});return C([t.SILENT_FAILS_ON],x(e.expression,r),[t.SILENT_FAILS_OFF],y(n,[t.IF_ERROR],[t.FAIL,u],[]))},choice:function(e,r){return function e(r,n){var u=r[0].match||0,o=x(r[0],{sp:n.sp,env:v(n.env),action:null});return u===i?o:C(o,r.length>1?y(a,[t.IF_ERROR],C([t.POP],e(r.slice(1),n)),[]):[])}(e.alternatives,r)},action:function(e,r){var n=v(r.env),u="sequence"!==e.expression.type||0===e.expression.elements.length,o=x(e.expression,{sp:r.sp+(u?1:0),env:n,action:e}),i=e.expression.match||0,a=u&&i!==s?m(!1,Object.keys(n),e):-1;return u?C([t.PUSH_CURR_POS],o,y(i,[t.IF_NOT_ERROR],C([t.LOAD_SAVED_POS,1],_(a,1,n,r.sp+2)),[]),[t.NIP]):o},sequence:function(e,r){return C([t.PUSH_CURR_POS],function r(n,u){if(n.length>0){var o=e.elements.length-n.length+1;return C(x(n[0],{sp:u.sp,env:u.env,pluck:u.pluck,action:null}),y(n[0].match||0,[t.IF_NOT_ERROR],r(n.slice(1),{sp:u.sp+1,env:u.env,pluck:u.pluck,action:u.action}),C(o>1?[t.POP_N,o]:[t.POP],[t.POP_CURR_POS],[t.PUSH_FAILED])))}if(u.pluck&&u.pluck.length>0)return C([t.PLUCK,e.elements.length+1,u.pluck.length],u.pluck.map((function(e){return u.sp-e})));if(u.action){var i=m(!1,Object.keys(u.env),u.action);return C([t.LOAD_SAVED_POS,e.elements.length],_(i,e.elements.length+1,u.env,u.sp))}return C([t.WRAP,e.elements.length],[t.NIP])}(e.elements,{sp:r.sp+1,env:r.env,pluck:[],action:r.action}))},labeled:function(e,r){var n=r.env,u=e.label,o=r.sp+1;u&&(n=v(r.env),r.env[u]=o),e.pick&&r.pluck.push(o);var i=x(e.expression,{sp:r.sp,env:n,action:null});return u&&e.labelLocation&&c&&"source-and-map"===c.output?C([t.SOURCE_MAP_LABEL_PUSH,o,l.add(u),A(e.labelLocation)],i,[t.SOURCE_MAP_LABEL_POP,o]):i},text:function(e,r){return C([t.PUSH_CURR_POS],x(e.expression,{sp:r.sp+1,env:v(r.env),action:null}),y(e.match||0,[t.IF_NOT_ERROR],C([t.POP],[t.TEXT]),[t.NIP]))},simple_and:function(e,r){return E(e.expression,!1,r)},simple_not:function(e,r){return E(e.expression,!0,r)},optional:function(e,r){return C(x(e.expression,{sp:r.sp,env:v(r.env),action:null}),y(-(e.expression.match||0),[t.IF_ERROR],C([t.POP],[t.PUSH_NULL]),[]))},zero_or_more:function(e,r){var n=x(e.expression,{sp:r.sp+1,env:v(r.env),action:null});return C([t.PUSH_EMPTY_ARRAY],n,R(n),[t.POP])},one_or_more:function(e,r){var n=x(e.expression,{sp:r.sp+1,env:v(r.env),action:null});return C([t.PUSH_EMPTY_ARRAY],n,y(e.expression.match||0,[t.IF_NOT_ERROR],C(R(n),[t.POP]),C([t.POP],[t.POP],[t.PUSH_FAILED])))},repeated:function(e,r){var n=e.min?e.min:e.max,u="constant"!==n.type||n.value>0,o="constant"!==e.max.type&&null!==e.max.value,i=u?2:1,s=e.min?b(e.min,r.env,r.sp,2+("function"===e.max.type?1:0)):{pre:[],post:[],sp:r.sp},c=b(e.max,r.env,s.sp,i),l=x(e.expression,{sp:c.sp+i,env:v(r.env),action:null}),p=null!==e.delimiter?x(e.expression,{sp:c.sp+i+1,env:v(r.env),action:null}):l,f=function(e,r,n,u,o){return e?C([t.PUSH_CURR_POS],x(e,{sp:u.sp+o+1,env:v(u.env),action:null}),y(e.match||0,[t.IF_NOT_ERROR],C([t.POP],n,y(-r,[t.IF_ERROR],[t.POP,t.POP_CURR_POS,t.PUSH_FAILED],[t.NIP])),[t.NIP])):n}(e.delimiter,e.expression.match||0,p,r,i),h=S(f,e.max),d=o?S(l,e.max):l,g=C(u?[t.PUSH_CURR_POS]:[],[t.PUSH_EMPTY_ARRAY],d,R(h),[t.POP]);return C(s.pre,c.pre,u?function(e,r){var n="constant"===r.type?[t.IF_LT,r.value]:[t.IF_LT_DYNAMIC,r.sp||0];return C(e,y(a,n,[t.POP,t.POP_CURR_POS,t.PUSH_FAILED],[t.NIP]))}(g,n):g,c.post,s.post)},group:function(e,r){return x(e.expression,{sp:r.sp,env:v(r.env),action:null})},semantic_and:function(e,r){return F(e,!1,r)},semantic_not:function(e,r){return F(e,!0,r)},rule_ref:function(e){return[t.RULE,r.indexOfRule(o,e.name)]},library_ref:function(e){return[t.LIBRARY_RULE,e.libraryNumber,h.add(e.name)]},literal:function(e){if(e.value.length>0){var r=e.match||0,n=r===a||r===i&&!e.ignoreCase?l.add(e.ignoreCase?e.value.toLowerCase():e.value):-1,u=r!==i?f.add({type:"literal",value:e.value,ignoreCase:e.ignoreCase}):-1;return y(r,e.ignoreCase?[t.MATCH_STRING_IC,n]:[t.MATCH_STRING,n],e.ignoreCase?[t.ACCEPT_N,e.value.length]:[t.ACCEPT_STRING,n],[t.FAIL,u])}return[t.PUSH_EMPTY_STRING]},class:function(e){var r=e.match||0,n=r===a?p.add(e):-1,u=r!==i?f.add({type:"class",value:e.parts,inverted:e.inverted,ignoreCase:e.ignoreCase}):-1;return y(r,[t.MATCH_CHAR_CLASS,n],[t.ACCEPT_N,1],[t.FAIL,u])},any:function(e){var r=e.match||0,n=r!==i?f.add({type:"any"}):-1;return y(r,[t.MATCH_ANY],[t.ACCEPT_N,1],[t.FAIL,n])}},c&&"source-and-map"===c.output&&Object.keys(P).forEach((function(r){var n=P[r];P[r]=function(r){for(var u=[],o=1;o<arguments.length;o++)u[o-1]=arguments[o];var i=n.apply(void 0,e([r],u,!1));return void 0!==i&&r.location?C([t.SOURCE_MAP_PUSH,A(r.location)],i,[t.SOURCE_MAP_POP]):i}})),n.build(P));x(o)},generateBytecode_1}var sourceMap={},sourceMapGenerator={},base64Vlq={},base64={},hasRequiredBase64,hasRequiredBase64Vlq;function requireBase64(){if(hasRequiredBase64)return base64;hasRequiredBase64=1;const e="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/".split("");return base64.encode=function(r){if(0<=r&&r<e.length)return e[r];throw new TypeError("Must be between 0 and 63: "+r)},base64}function requireBase64Vlq(){if(hasRequiredBase64Vlq)return base64Vlq;hasRequiredBase64Vlq=1;const e=requireBase64();return base64Vlq.encode=function(r){let t,n="",u=function(e){return e<0?1+(-e<<1):0+(e<<1)}(r);do{t=31&u,u>>>=5,u>0&&(t|=32),n+=e.encode(t)}while(u>0);return n},base64Vlq}var util={},hasRequiredUtil;function requireUtil(){if(hasRequiredUtil)return util;hasRequiredUtil=1,util.getArg=function(e,r,t){if(r in e)return e[r];if(3===arguments.length)return t;throw new Error('"'+r+'" is a required argument.')};const e=!("__proto__"in Object.create(null));function r(e){return e}function t(e){if(!e)return!1;const r=e.length;if(r<9)return!1;if(95!==e.charCodeAt(r-1)||95!==e.charCodeAt(r-2)||111!==e.charCodeAt(r-3)||116!==e.charCodeAt(r-4)||111!==e.charCodeAt(r-5)||114!==e.charCodeAt(r-6)||112!==e.charCodeAt(r-7)||95!==e.charCodeAt(r-8)||95!==e.charCodeAt(r-9))return!1;for(let t=r-10;t>=0;t--)if(36!==e.charCodeAt(t))return!1;return!0}function n(e,r){return e===r?0:null===e?1:null===r?-1:e>r?1:-1}util.toSetString=e?r:function(e){return t(e)?"$"+e:e},util.fromSetString=e?r:function(e){return t(e)?e.slice(1):e},util.compareByGeneratedPositionsInflated=function(e,r){let t=e.generatedLine-r.generatedLine;return 0!==t?t:(t=e.generatedColumn-r.generatedColumn,0!==t?t:(t=n(e.source,r.source),0!==t?t:(t=e.originalLine-r.originalLine,0!==t?t:(t=e.originalColumn-r.originalColumn,0!==t?t:n(e.name,r.name)))))};const u="http://host";function o(e){return r=>{const t=c(r),n=a(r),u=new URL(r,n);e(u);const o=u.toString();return"absolute"===t?o:"scheme-relative"===t?o.slice(5):"path-absolute"===t?o.slice(11):l(n,o)}}function i(e,r){return new URL(e,r).toString()}function a(e){const r=e.split("..").length-1,t=function(e,r){let t=0;for(;;){const e="p"+t++;if(-1===r.indexOf(e))return e}}(0,e);let n=`${u}/`;for(let e=0;e<r;e++)n+=`${t}/`;return n}const s=/^[A-Za-z0-9\+\-\.]+:/;function c(e){return"/"===e[0]?"/"===e[1]?"scheme-relative":"path-absolute":s.test(e)?"absolute":"path-relative"}function l(e,r){"string"==typeof e&&(e=new URL(e)),"string"==typeof r&&(r=new URL(r));const t=r.pathname.split("/"),n=e.pathname.split("/");for(n.length>0&&!n[n.length-1]&&n.pop();t.length>0&&n.length>0&&t[0]===n[0];)t.shift(),n.shift();return n.map((()=>"..")).concat(t).join("/")+r.search+r.hash}const p=o((e=>{e.pathname=e.pathname.replace(/\/?$/,"/")})),f=o((e=>{}));return util.normalize=f,util.join=function(e,r){const t=c(r),n=c(e);if(e=p(e),"absolute"===t)return i(r,void 0);if("absolute"===n)return i(r,e);if("scheme-relative"===t)return f(r);if("scheme-relative"===n)return i(r,i(e,u)).slice(5);if("path-absolute"===t)return f(r);if("path-absolute"===n)return i(r,i(e,u)).slice(11);const o=a(r+e);return l(o,i(r,i(e,o)))},util.relative=function(e,r){const t=function(e,r){if(c(e)!==c(r))return null;const t=a(e+r),n=new URL(e,t),u=new URL(r,t);try{new URL("",u.toString())}catch(e){return null}return u.protocol!==n.protocol||u.user!==n.user||u.password!==n.password||u.hostname!==n.hostname||u.port!==n.port?null:l(n,u)}(e,r);return"string"==typeof t?t:f(r)},util}var arraySet={},hasRequiredArraySet;function requireArraySet(){if(hasRequiredArraySet)return arraySet;hasRequiredArraySet=1;class e{constructor(){this._array=[],this._set=new Map}static fromArray(r,t){const n=new e;for(let e=0,u=r.length;e<u;e++)n.add(r[e],t);return n}size(){return this._set.size}add(e,r){const t=this.has(e),n=this._array.length;t&&!r||this._array.push(e),t||this._set.set(e,n)}has(e){return this._set.has(e)}indexOf(e){const r=this._set.get(e);if(r>=0)return r;throw new Error('"'+e+'" is not in the set.')}at(e){if(e>=0&&e<this._array.length)return this._array[e];throw new Error("No element indexed by "+e)}toArray(){return this._array.slice()}}return arraySet.ArraySet=e,arraySet}var mappingList={},hasRequiredMappingList,hasRequiredSourceMapGenerator;function requireMappingList(){if(hasRequiredMappingList)return mappingList;hasRequiredMappingList=1;const e=requireUtil();return mappingList.MappingList=class{constructor(){this._array=[],this._sorted=!0,this._last={generatedLine:-1,generatedColumn:0}}unsortedForEach(e,r){this._array.forEach(e,r)}add(r){!function(r,t){const n=r.generatedLine,u=t.generatedLine,o=r.generatedColumn,i=t.generatedColumn;return u>n||u==n&&i>=o||e.compareByGeneratedPositionsInflated(r,t)<=0}(this._last,r)?(this._sorted=!1,this._array.push(r)):(this._last=r,this._array.push(r))}toArray(){return this._sorted||(this._array.sort(e.compareByGeneratedPositionsInflated),this._sorted=!0),this._array}},mappingList}function requireSourceMapGenerator(){if(hasRequiredSourceMapGenerator)return sourceMapGenerator;hasRequiredSourceMapGenerator=1;const e=requireBase64Vlq(),r=requireUtil(),t=requireArraySet().ArraySet,n=requireMappingList().MappingList;class u{constructor(e){e||(e={}),this._file=r.getArg(e,"file",null),this._sourceRoot=r.getArg(e,"sourceRoot",null),this._skipValidation=r.getArg(e,"skipValidation",!1),this._sources=new t,this._names=new t,this._mappings=new n,this._sourcesContents=null}static fromSourceMap(e){const t=e.sourceRoot,n=new u({file:e.file,sourceRoot:t});return e.eachMapping((function(e){const u={generated:{line:e.generatedLine,column:e.generatedColumn}};null!=e.source&&(u.source=e.source,null!=t&&(u.source=r.relative(t,u.source)),u.original={line:e.originalLine,column:e.originalColumn},null!=e.name&&(u.name=e.name)),n.addMapping(u)})),e.sources.forEach((function(u){let o=u;null!=t&&(o=r.relative(t,u)),n._sources.has(o)||n._sources.add(o);const i=e.sourceContentFor(u);null!=i&&n.setSourceContent(u,i)})),n}addMapping(e){const t=r.getArg(e,"generated"),n=r.getArg(e,"original",null);let u=r.getArg(e,"source",null),o=r.getArg(e,"name",null);this._skipValidation||this._validateMapping(t,n,u,o),null!=u&&(u=String(u),this._sources.has(u)||this._sources.add(u)),null!=o&&(o=String(o),this._names.has(o)||this._names.add(o)),this._mappings.add({generatedLine:t.line,generatedColumn:t.column,originalLine:n&&n.line,originalColumn:n&&n.column,source:u,name:o})}setSourceContent(e,t){let n=e;null!=this._sourceRoot&&(n=r.relative(this._sourceRoot,n)),null!=t?(this._sourcesContents||(this._sourcesContents=Object.create(null)),this._sourcesContents[r.toSetString(n)]=t):this._sourcesContents&&(delete this._sourcesContents[r.toSetString(n)],0===Object.keys(this._sourcesContents).length&&(this._sourcesContents=null))}applySourceMap(e,n,u){let o=n;if(null==n){if(null==e.file)throw new Error('SourceMapGenerator.prototype.applySourceMap requires either an explicit source file, or the source map\'s "file" property. Both were omitted.');o=e.file}const i=this._sourceRoot;null!=i&&(o=r.relative(i,o));const a=this._mappings.toArray().length>0?new t:this._sources,s=new t;this._mappings.unsortedForEach((function(t){if(t.source===o&&null!=t.originalLine){const n=e.originalPositionFor({line:t.originalLine,column:t.originalColumn});null!=n.source&&(t.source=n.source,null!=u&&(t.source=r.join(u,t.source)),null!=i&&(t.source=r.relative(i,t.source)),t.originalLine=n.line,t.originalColumn=n.column,null!=n.name&&(t.name=n.name))}const n=t.source;null==n||a.has(n)||a.add(n);const c=t.name;null==c||s.has(c)||s.add(c)}),this),this._sources=a,this._names=s,e.sources.forEach((function(t){const n=e.sourceContentFor(t);null!=n&&(null!=u&&(t=r.join(u,t)),null!=i&&(t=r.relative(i,t)),this.setSourceContent(t,n))}),this)}_validateMapping(e,r,t,n){if(r&&"number"!=typeof r.line&&"number"!=typeof r.column)throw new Error("original.line and original.column are not numbers -- you probably meant to omit the original mapping entirely and only map the generated position. If so, pass null for the original mapping instead of an object with empty or null values.");if(e&&"line"in e&&"column"in e&&e.line>0&&e.column>=0&&!r&&!t&&!n);else if(!(e&&"line"in e&&"column"in e&&r&&"line"in r&&"column"in r&&e.line>0&&e.column>=0&&r.line>0&&r.column>=0&&t))throw new Error("Invalid mapping: "+JSON.stringify({generated:e,source:t,original:r,name:n}))}_serializeMappings(){let t,n,u,o,i=0,a=1,s=0,c=0,l=0,p=0,f="";const h=this._mappings.toArray();for(let d=0,g=h.length;d<g;d++){if(n=h[d],t="",n.generatedLine!==a)for(i=0;n.generatedLine!==a;)t+=";",a++;else if(d>0){if(!r.compareByGeneratedPositionsInflated(n,h[d-1]))continue;t+=","}t+=e.encode(n.generatedColumn-i),i=n.generatedColumn,null!=n.source&&(o=this._sources.indexOf(n.source),t+=e.encode(o-p),p=o,t+=e.encode(n.originalLine-1-c),c=n.originalLine-1,t+=e.encode(n.originalColumn-s),s=n.originalColumn,null!=n.name&&(u=this._names.indexOf(n.name),t+=e.encode(u-l),l=u)),f+=t}return f}_generateSourcesContent(e,t){return e.map((function(e){if(!this._sourcesContents)return null;null!=t&&(e=r.relative(t,e));const n=r.toSetString(e);return Object.prototype.hasOwnProperty.call(this._sourcesContents,n)?this._sourcesContents[n]:null}),this)}toJSON(){const e={version:this._version,sources:this._sources.toArray(),names:this._names.toArray(),mappings:this._serializeMappings()};return null!=this._file&&(e.file=this._file),null!=this._sourceRoot&&(e.sourceRoot=this._sourceRoot),this._sourcesContents&&(e.sourcesContent=this._generateSourcesContent(e.sources,e.sourceRoot)),e}toString(){return JSON.stringify(this.toJSON())}}return u.prototype._version=3,sourceMapGenerator.SourceMapGenerator=u,sourceMapGenerator}var sourceNode={},hasRequiredSourceNode,hasRequiredSourceMap,stack,hasRequiredStack;function requireSourceNode(){if(hasRequiredSourceNode)return sourceNode;hasRequiredSourceNode=1;const e=requireSourceMapGenerator().SourceMapGenerator,r=requireUtil(),t=/(\r?\n)/,n="$$$isSourceNode$$$";class u{constructor(e,r,t,u,o){this.children=[],this.sourceContents={},this.line=null==e?null:e,this.column=null==r?null:r,this.source=null==t?null:t,this.name=null==o?null:o,this[n]=!0,null!=u&&this.add(u)}static fromStringWithSourceMap(e,n,o){const i=new u,a=e.split(t);let s=0;const c=function(){return e()+(e()||"");function e(){return s<a.length?a[s++]:void 0}};let l,p=1,f=0,h=null;return n.eachMapping((function(e){if(null!==h){if(!(p<e.generatedLine)){l=a[s]||"";const r=l.substr(0,e.generatedColumn-f);return a[s]=l.substr(e.generatedColumn-f),f=e.generatedColumn,d(h,r),void(h=e)}d(h,c()),p++,f=0}for(;p<e.generatedLine;)i.add(c()),p++;f<e.generatedColumn&&(l=a[s]||"",i.add(l.substr(0,e.generatedColumn)),a[s]=l.substr(e.generatedColumn),f=e.generatedColumn),h=e}),this),s<a.length&&(h&&d(h,c()),i.add(a.splice(s).join(""))),n.sources.forEach((function(e){const t=n.sourceContentFor(e);null!=t&&(null!=o&&(e=r.join(o,e)),i.setSourceContent(e,t))})),i;function d(e,t){if(null===e||void 0===e.source)i.add(t);else{const n=o?r.join(o,e.source):e.source;i.add(new u(e.originalLine,e.originalColumn,n,t,e.name))}}}add(e){if(Array.isArray(e))e.forEach((function(e){this.add(e)}),this);else{if(!e[n]&&"string"!=typeof e)throw new TypeError("Expected a SourceNode, string, or an array of SourceNodes and strings. Got "+e);e&&this.children.push(e)}return this}prepend(e){if(Array.isArray(e))for(let r=e.length-1;r>=0;r--)this.prepend(e[r]);else{if(!e[n]&&"string"!=typeof e)throw new TypeError("Expected a SourceNode, string, or an array of SourceNodes and strings. Got "+e);this.children.unshift(e)}return this}walk(e){let r;for(let t=0,u=this.children.length;t<u;t++)r=this.children[t],r[n]?r.walk(e):""!==r&&e(r,{source:this.source,line:this.line,column:this.column,name:this.name})}join(e){let r,t;const n=this.children.length;if(n>0){for(r=[],t=0;t<n-1;t++)r.push(this.children[t]),r.push(e);r.push(this.children[t]),this.children=r}return this}replaceRight(e,r){const t=this.children[this.children.length-1];return t[n]?t.replaceRight(e,r):"string"==typeof t?this.children[this.children.length-1]=t.replace(e,r):this.children.push("".replace(e,r)),this}setSourceContent(e,t){this.sourceContents[r.toSetString(e)]=t}walkSourceContents(e){for(let r=0,t=this.children.length;r<t;r++)this.children[r][n]&&this.children[r].walkSourceContents(e);const t=Object.keys(this.sourceContents);for(let n=0,u=t.length;n<u;n++)e(r.fromSetString(t[n]),this.sourceContents[t[n]])}toString(){let e="";return this.walk((function(r){e+=r})),e}toStringWithSourceMap(r){const t={code:"",line:1,column:0},n=new e(r);let u=!1,o=null,i=null,a=null,s=null;return this.walk((function(e,r){t.code+=e,null!==r.source&&null!==r.line&&null!==r.column?(o===r.source&&i===r.line&&a===r.column&&s===r.name||n.addMapping({source:r.source,original:{line:r.line,column:r.column},generated:{line:t.line,column:t.column},name:r.name}),o=r.source,i=r.line,a=r.column,s=r.name,u=!0):u&&(n.addMapping({generated:{line:t.line,column:t.column}}),o=null,u=!1);for(let i=0,a=e.length;i<a;i++)10===e.charCodeAt(i)?(t.line++,t.column=0,i+1===a?(o=null,u=!1):u&&n.addMapping({source:r.source,original:{line:r.line,column:r.column},generated:{line:t.line,column:t.column},name:r.name})):t.column++})),this.walkSourceContents((function(e,r){n.setSourceContent(e,r)})),{code:t.code,map:n}}}return sourceNode.SourceNode=u,sourceNode}function requireSourceMap(){return hasRequiredSourceMap||(hasRequiredSourceMap=1,sourceMap.SourceMapGenerator=requireSourceMapGenerator().SourceMapGenerator,sourceMap.SourceNode=requireSourceNode().SourceNode),sourceMap}function requireStack(){if(hasRequiredStack)return stack;hasRequiredStack=1;var e=requireSourceMap().SourceNode,GrammarLocation=requireGrammarLocation(),r=function(){function r(e,r,t,n){this.sp=-1,this.maxSp=-1,this.varName=r,this.ruleName=e,this.type=t,this.bytecode=n,this.labels={},this.sourceMapStack=[]}return r.prototype.name=function(e){if(e<0)throw new RangeError("Rule '".concat(this.ruleName,"': The variable stack underflow: attempt to use a variable '").concat(this.varName,"<x>' at an index ").concat(e,".\nBytecode: ").concat(this.bytecode));return this.varName+e},r.sourceNode=function(r,t,n){var u=GrammarLocation.offsetStart(r);return new e(u.line,u.column?u.column-1:null,String(r.source),t,n)},r.prototype.push=function(t){++this.sp>this.maxSp&&(this.maxSp=this.sp);var n=this.labels[this.sp],u=[this.name(this.sp)," = ",t,";"];if(n){if(this.sourceMapStack.length){var o=r.sourceNode(n.location,u.splice(0,2),n.label),i=this.sourceMapPopInternal(),a=i.parts,s=i.location,c=s.start.offset<n.location.end.offset?{start:n.location.end,end:s.end,source:s.source}:s,l=r.sourceNode(c,u.concat("\n"));return this.sourceMapStack.push([a,a.length+1,s]),new e(null,null,n.location.source,[o,l])}return r.sourceNode(n.location,u.concat("\n"))}return u.join("")},r.prototype.pop=function(e){var r=this;return void 0!==e?(this.sp-=e,Array.from({length:e},(function(e,t){return r.name(r.sp+1+t)}))):this.name(this.sp--)},r.prototype.top=function(){return this.name(this.sp)},r.prototype.index=function(e){if(e<0)throw new RangeError("Rule '".concat(this.ruleName,"': The variable stack overflow: attempt to get a variable at a negative index ").concat(e,".\nBytecode: ").concat(this.bytecode));return this.name(this.sp-e)},r.prototype.result=function(){if(this.maxSp<0)throw new RangeError("Rule '".concat(this.ruleName,"': The variable stack is empty, can't get the result.\nBytecode: ").concat(this.bytecode));return this.name(0)},r.prototype.defines=function(){var e=this;return this.maxSp<0?"":this.type+" "+Array.from({length:this.maxSp+1},(function(r,t){return e.name(t)})).join(", ")+";"},r.prototype.checkedIf=function(e,r,t){var n=this.sp,u=r();if(!t)return[u];var o=this.sp;this.sp=n;var i=t();if(o!==this.sp)throw new Error("Rule '"+this.ruleName+"', position "+e+": Branches of a condition can't move the stack pointer differently (before: "+n+", after then: "+o+", after else: "+this.sp+"). Bytecode: "+this.bytecode);return[u,i]},r.prototype.checkedLoop=function(e,r){var t=this.sp,n=r();if(t!==this.sp)throw new Error("Rule '"+this.ruleName+"', position "+e+": Body of a loop can't move the stack pointer (before: "+t+", after: "+this.sp+"). Bytecode: "+this.bytecode);return n},r.prototype.sourceMapPush=function(e,r){if(this.sourceMapStack.length){var t=this.sourceMapStack[this.sourceMapStack.length-1];t[2].start.offset===r.start.offset&&t[2].end.offset>r.end.offset&&(t[2]={start:r.end,end:t[2].end,source:t[2].source})}this.sourceMapStack.push([e,e.length,r])},r.prototype.sourceMapPopInternal=function(){var r=this.sourceMapStack.pop();if(!r)throw new RangeError("Rule '".concat(this.ruleName,"': Attempting to pop an empty source map stack.\nBytecode: ").concat(this.bytecode));var t=r[0],n=r[1],u=r[2],o=t.splice(n).map((function(r){return r instanceof e?r:r+"\n"}));if(o.length){var i=GrammarLocation.offsetStart(u);t.push(new e(i.line,i.column-1,String(u.source),o))}return{parts:t,location:u}},r.prototype.sourceMapPop=function(e){var r=this.sourceMapPopInternal().location;if(this.sourceMapStack.length&&r.end.offset<this.sourceMapStack[this.sourceMapStack.length-1][2].end.offset){var t=this.sourceMapPopInternal(),n=t.parts,u=t.location,o=u.start.offset<r.end.offset?{start:r.end,end:u.end,source:u.source}:u;this.sourceMapStack.push([n,n.length+(e||0),o])}},r}();return stack=r}var version={},hasRequiredVersion;function requireVersion(){return hasRequiredVersion||(hasRequiredVersion=1,version.version="4.2.0"),version}var utils={},hasRequiredUtils,parser,hasRequiredParser,generateJs,hasRequiredGenerateJs,removeProxyRules_1,hasRequiredRemoveProxyRules,mergeCharacterClasses_1,hasRequiredMergeCharacterClasses,reportDuplicateImports_1,hasRequiredReportDuplicateImports,reportDuplicateLabels_1,hasRequiredReportDuplicateLabels,reportDuplicateRules_1,hasRequiredReportDuplicateRules,reportInfiniteRecursion_1,hasRequiredReportInfiniteRecursion,reportInfiniteRepetition_1,hasRequiredReportInfiniteRepetition,reportUndefinedRules_1,hasRequiredReportUndefinedRules,reportIncorrectPlucking_1,hasRequiredReportIncorrectPlucking,session,hasRequiredSession,compiler_1,hasRequiredCompiler,peg_1,hasRequiredPeg;function requireUtils(){if(hasRequiredUtils)return utils;function e(e){return e.charCodeAt(0).toString(16).toUpperCase()}return hasRequiredUtils=1,utils.hex=e,utils.stringEscape=function(r){return r.replace(/\\/g,"\\\\").replace(/"/g,'\\"').replace(/\0/g,"\\0").replace(/\x08/g,"\\b").replace(/\t/g,"\\t").replace(/\n/g,"\\n").replace(/\v/g,"\\v").replace(/\f/g,"\\f").replace(/\r/g,"\\r").replace(/[\x00-\x0F]/g,(function(r){return"\\x0"+e(r)})).replace(/[\x10-\x1F\x7F-\xFF]/g,(function(r){return"\\x"+e(r)})).replace(/[\u0100-\u0FFF]/g,(function(r){return"\\u0"+e(r)})).replace(/[\u1000-\uFFFF]/g,(function(r){return"\\u"+e(r)}))},utils.regexpClassEscape=function(r){return r.replace(/\\/g,"\\\\").replace(/\//g,"\\/").replace(/]/g,"\\]").replace(/\^/g,"\\^").replace(/-/g,"\\-").replace(/\0/g,"\\0").replace(/\x08/g,"\\b").replace(/\t/g,"\\t").replace(/\n/g,"\\n").replace(/\v/g,"\\v").replace(/\f/g,"\\f").replace(/\r/g,"\\r").replace(/[\x00-\x0F]/g,(function(r){return"\\x0"+e(r)})).replace(/[\x10-\x1F\x7F-\xFF]/g,(function(r){return"\\x"+e(r)})).replace(/[\u0100-\u0FFF]/g,(function(r){return"\\u0"+e(r)})).replace(/[\u1000-\uFFFF]/g,(function(r){return"\\u"+e(r)}))},utils.base64=function(e){for(var r="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",t=e.length%3,n=e.length-t,u="",o=0;o<n;o+=3)u+=r[e[o]>>2],u+=r[(3&e[o])<<4|e[o+1]>>4],u+=r[(15&e[o+1])<<2|e[o+2]>>6],u+=r[63&e[o+2]];return 1===t?(u+=r[e[n]>>2],u+=r[(3&e[n])<<4],u+="=="):2===t&&(u+=r[e[n]>>2],u+=r[(3&e[n])<<4|e[n+1]>>4],u+=r[(15&e[n+1])<<2],u+="="),u},utils}function requireParser(){if(hasRequiredParser)return parser;hasRequiredParser=1;var e={$:"text","&":"simple_and","!":"simple_not"},r={"?":"optional","*":"zero_or_more","+":"one_or_more"},t={"&":"semantic_and","!":"semantic_not"};function n(e,r,t,u){var o=Error.call(this,e);return Object.setPrototypeOf&&Object.setPrototypeOf(o,n.prototype),o.expected=r,o.found=t,o.location=u,o.name="SyntaxError",o}function u(e,r,t){return t=t||" ",e.length>r?e:(r-=e.length,e+(t+=t.repeat(r)).slice(0,r))}return function(e,r){function t(){this.constructor=e}t.prototype=r.prototype,e.prototype=new t}(n,Error),n.prototype.format=function(e){var r="Error: "+this.message;if(this.location){var t,n=null;for(t=0;t<e.length;t++)if(e[t].source===this.location.source){n=e[t].text.split(/\r\n|\n|\r/g);break}var o=this.location.start,i=this.location.source&&"function"==typeof this.location.source.offset?this.location.source.offset(o):o,a=this.location.source+":"+i.line+":"+i.column;if(n){var s=this.location.end,c=u("",i.line.toString().length," "),l=n[o.line-1],p=(o.line===s.line?s.column:l.length+1)-o.column||1;r+="\n --\x3e "+a+"\n"+c+" |\n"+i.line+" | "+l+"\n"+c+" | "+u("",o.column-1," ")+u("",p,"^")}else r+="\n at "+a}return r},n.buildMessage=function(e,r){var t={literal:function(e){return'"'+u(e.text)+'"'},class:function(e){var r=e.parts.map((function(e){return Array.isArray(e)?o(e[0])+"-"+o(e[1]):o(e)}));return"["+(e.inverted?"^":"")+r.join("")+"]"},any:function(){return"any character"},end:function(){return"end of input"},other:function(e){return e.description}};function n(e){return e.charCodeAt(0).toString(16).toUpperCase()}function u(e){return e.replace(/\\/g,"\\\\").replace(/"/g,'\\"').replace(/\0/g,"\\0").replace(/\t/g,"\\t").replace(/\n/g,"\\n").replace(/\r/g,"\\r").replace(/[\x00-\x0F]/g,(function(e){return"\\x0"+n(e)})).replace(/[\x10-\x1F\x7F-\x9F]/g,(function(e){return"\\x"+n(e)}))}function o(e){return e.replace(/\\/g,"\\\\").replace(/\]/g,"\\]").replace(/\^/g,"\\^").replace(/-/g,"\\-").replace(/\0/g,"\\0").replace(/\t/g,"\\t").replace(/\n/g,"\\n").replace(/\r/g,"\\r").replace(/[\x00-\x0F]/g,(function(e){return"\\x0"+n(e)})).replace(/[\x10-\x1F\x7F-\x9F]/g,(function(e){return"\\x"+n(e)}))}function i(e){return t[e.type](e)}return"Expected "+function(e){var r,t,n=e.map(i);if(n.sort(),n.length>0){for(r=1,t=1;r<n.length;r++)n[r-1]!==n[r]&&(n[t]=n[r],t++);n.length=t}switch(n.length){case 1:return n[0];case 2:return n[0]+" or "+n[1];default:return n.slice(0,-1).join(", ")+", or "+n[n.length-1]}}(e)+" but "+function(e){return e?'"'+u(e)+'"':"end of input"}(r)+" found."},parser={StartRules:["Grammar","ImportsAndSource"],SyntaxError:n,parse:function(u,o){var i,a={},s=(o=void 0!==o?o:{}).grammarSource,c={Grammar:Nt,ImportsAndSource:function(){var e,r,t;return e=bt,r=function(){var e,r;return e=bt,r=bt,Ut(),r=u.substring(r,bt),St=e,br(r)}(),t=function(){var e,r,t,n;for(e=bt,r=bt,t=[],u.length>bt?(n=u.charAt(bt),bt++):(n=a,0===Bt&&Mt(fe));n!==a;)t.push(n),u.length>bt?(n=u.charAt(bt),bt++):(n=a,0===Bt&&Mt(fe));return r=u.substring(r,bt),St=e,Rr(r)}(),St=e,Fr(r,t)}},l=Nt,p="import",f=";",h=",",d="*",g="as",m="{",A="}",v="from",C="=",y="/",_="@",E=":",F="|",R="..",b="(",S=")",P=".",x="\n",D="\r\n",B="/*",L="*/",w="//",q="\\",$="i",O='"',I="'",k="[",M="^",N="]",U="-",T="0",j="b",G="f",H="n",V="r",z="t",Y="v",J="x",W="u",X=/^[!$&]/,K=/^[*-+?]/,Z=/^[!&]/,Q=/^[\t\v-\f \xA0\u1680\u2000-\u200A\u202F\u205F\u3000\uFEFF]/,ee=/^[\n\r\u2028\u2029]/,re=/^[\r\u2028-\u2029]/,te=/^[A-Z_a-z\xAA\xB5\xBA\xC0-\xD6\xD8-\xF6\xF8-\u02C1\u02C6-\u02D1\u02E0-\u02E4\u02EC\u02EE\u0370-\u0374\u0376-\u0377\u037A-\u037D\u037F\u0386\u0388-\u038A\u038C\u038E-\u03A1\u03A3-\u03F5\u03F7-\u0481\u048A-\u052F\u0531-\u0556\u0559\u0561-\u0587\u05D0-\u05EA\u05F0-\u05F2\u0620-\u064A\u066E-\u066F\u0671-\u06D3\u06D5\u06E5-\u06E6\u06EE-\u06EF\u06FA-\u06FC\u06FF\u0710\u0712-\u072F\u074D-\u07A5\u07B1\u07CA-\u07EA\u07F4-\u07F5\u07FA\u0800-\u0815\u081A\u0824\u0828\u0840-\u0858\u08A0-\u08B4\u0904-\u0939\u093D\u0950\u0958-\u0961\u0971-\u0980\u0985-\u098C\u098F-\u0990\u0993-\u09A8\u09AA-\u09B0\u09B2\u09B6-\u09B9\u09BD\u09CE\u09DC-\u09DD\u09DF-\u09E1\u09F0-\u09F1\u0A05-\u0A0A\u0A0F-\u0A10\u0A13-\u0A28\u0A2A-\u0A30\u0A32-\u0A33\u0A35-\u0A36\u0A38-\u0A39\u0A59-\u0A5C\u0A5E\u0A72-\u0A74\u0A85-\u0A8D\u0A8F-\u0A91\u0A93-\u0AA8\u0AAA-\u0AB0\u0AB2-\u0AB3\u0AB5-\u0AB9\u0ABD\u0AD0\u0AE0-\u0AE1\u0AF9\u0B05-\u0B0C\u0B0F-\u0B10\u0B13-\u0B28\u0B2A-\u0B30\u0B32-\u0B33\u0B35-\u0B39\u0B3D\u0B5C-\u0B5D\u0B5F-\u0B61\u0B71\u0B83\u0B85-\u0B8A\u0B8E-\u0B90\u0B92-\u0B95\u0B99-\u0B9A\u0B9C\u0B9E-\u0B9F\u0BA3-\u0BA4\u0BA8-\u0BAA\u0BAE-\u0BB9\u0BD0\u0C05-\u0C0C\u0C0E-\u0C10\u0C12-\u0C28\u0C2A-\u0C39\u0C3D\u0C58-\u0C5A\u0C60-\u0C61\u0C85-\u0C8C\u0C8E-\u0C90\u0C92-\u0CA8\u0CAA-\u0CB3\u0CB5-\u0CB9\u0CBD\u0CDE\u0CE0-\u0CE1\u0CF1-\u0CF2\u0D05-\u0D0C\u0D0E-\u0D10\u0D12-\u0D3A\u0D3D\u0D4E\u0D5F-\u0D61\u0D7A-\u0D7F\u0D85-\u0D96\u0D9A-\u0DB1\u0DB3-\u0DBB\u0DBD\u0DC0-\u0DC6\u0E01-\u0E30\u0E32-\u0E33\u0E40-\u0E46\u0E81-\u0E82\u0E84\u0E87-\u0E88\u0E8A\u0E8D\u0E94-\u0E97\u0E99-\u0E9F\u0EA1-\u0EA3\u0EA5\u0EA7\u0EAA-\u0EAB\u0EAD-\u0EB0\u0EB2-\u0EB3\u0EBD\u0EC0-\u0EC4\u0EC6\u0EDC-\u0EDF\u0F00\u0F40-\u0F47\u0F49-\u0F6C\u0F88-\u0F8C\u1000-\u102A\u103F\u1050-\u1055\u105A-\u105D\u1061\u1065-\u1066\u106E-\u1070\u1075-\u1081\u108E\u10A0-\u10C5\u10C7\u10CD\u10D0-\u10FA\u10FC-\u1248\u124A-\u124D\u1250-\u1256\u1258\u125A-\u125D\u1260-\u1288\u128A-\u128D\u1290-\u12B0\u12B2-\u12B5\u12B8-\u12BE\u12C0\u12C2-\u12C5\u12C8-\u12D6\u12D8-\u1310\u1312-\u1315\u1318-\u135A\u1380-\u138F\u13A0-\u13F5\u13F8-\u13FD\u1401-\u166C\u166F-\u167F\u1681-\u169A\u16A0-\u16EA\u16EE-\u16F8\u1700-\u170C\u170E-\u1711\u1720-\u1731\u1740-\u1751\u1760-\u176C\u176E-\u1770\u1780-\u17B3\u17D7\u17DC\u1820-\u1877\u1880-\u18A8\u18AA\u18B0-\u18F5\u1900-\u191E\u1950-\u196D\u1970-\u1974\u1980-\u19AB\u19B0-\u19C9\u1A00-\u1A16\u1A20-\u1A54\u1AA7\u1B05-\u1B33\u1B45-\u1B4B\u1B83-\u1BA0\u1BAE-\u1BAF\u1BBA-\u1BE5\u1C00-\u1C23\u1C4D-\u1C4F\u1C5A-\u1C7D\u1CE9-\u1CEC\u1CEE-\u1CF1\u1CF5-\u1CF6\u1D00-\u1DBF\u1E00-\u1F15\u1F18-\u1F1D\u1F20-\u1F45\u1F48-\u1F4D\u1F50-\u1F57\u1F59\u1F5B\u1F5D\u1F5F-\u1F7D\u1F80-\u1FB4\u1FB6-\u1FBC\u1FBE\u1FC2-\u1FC4\u1FC6-\u1FCC\u1FD0-\u1FD3\u1FD6-\u1FDB\u1FE0-\u1FEC\u1FF2-\u1FF4\u1FF6-\u1FFC\u2071\u207F\u2090-\u209C\u2102\u2107\u210A-\u2113\u2115\u2119-\u211D\u2124\u2126\u2128\u212A-\u212D\u212F-\u2139\u213C-\u213F\u2145-\u2149\u214E\u2160-\u2188\u2C00-\u2C2E\u2C30-\u2C5E\u2C60-\u2CE4\u2CEB-\u2CEE\u2CF2-\u2CF3\u2D00-\u2D25\u2D27\u2D2D\u2D30-\u2D67\u2D6F\u2D80-\u2D96\u2DA0-\u2DA6\u2DA8-\u2DAE\u2DB0-\u2DB6\u2DB8-\u2DBE\u2DC0-\u2DC6\u2DC8-\u2DCE\u2DD0-\u2DD6\u2DD8-\u2DDE\u2E2F\u3005-\u3007\u3021-\u3029\u3031-\u3035\u3038-\u303C\u3041-\u3096\u309D-\u309F\u30A1-\u30FA\u30FC-\u30FF\u3105-\u312D\u3131-\u318E\u31A0-\u31BA\u31F0-\u31FF\u3400-\u4DB5\u4E00-\u9FD5\uA000-\uA48C\uA4D0-\uA4FD\uA500-\uA60C\uA610-\uA61F\uA62A-\uA62B\uA640-\uA66E\uA67F-\uA69D\uA6A0-\uA6EF\uA717-\uA71F\uA722-\uA788\uA78B-\uA7AD\uA7B0-\uA7B7\uA7F7-\uA801\uA803-\uA805\uA807-\uA80A\uA80C-\uA822\uA840-\uA873\uA882-\uA8B3\uA8F2-\uA8F7\uA8FB\uA8FD\uA90A-\uA925\uA930-\uA946\uA960-\uA97C\uA984-\uA9B2\uA9CF\uA9E0-\uA9E4\uA9E6-\uA9EF\uA9FA-\uA9FE\uAA00-\uAA28\uAA40-\uAA42\uAA44-\uAA4B\uAA60-\uAA76\uAA7A\uAA7E-\uAAAF\uAAB1\uAAB5-\uAAB6\uAAB9-\uAABD\uAAC0\uAAC2\uAADB-\uAADD\uAAE0-\uAAEA\uAAF2-\uAAF4\uAB01-\uAB06\uAB09-\uAB0E\uAB11-\uAB16\uAB20-\uAB26\uAB28-\uAB2E\uAB30-\uAB5A\uAB5C-\uAB65\uAB70-\uABE2\uAC00-\uD7A3\uD7B0-\uD7C6\uD7CB-\uD7FB\uF900-\uFA6D\uFA70-\uFAD9\uFB00-\uFB06\uFB13-\uFB17\uFB1D\uFB1F-\uFB28\uFB2A-\uFB36\uFB38-\uFB3C\uFB3E\uFB40-\uFB41\uFB43-\uFB44\uFB46-\uFBB1\uFBD3-\uFD3D\uFD50-\uFD8F\uFD92-\uFDC7\uFDF0-\uFDFB\uFE70-\uFE74\uFE76-\uFEFC\uFF21-\uFF3A\uFF41-\uFF5A\uFF66-\uFFBE\uFFC2-\uFFC7\uFFCA-\uFFCF\uFFD2-\uFFD7\uFFDA-\uFFDC]/,ne=/^[$0-9_\u0300-\u036F\u0483-\u0487\u0591-\u05BD\u05BF\u05C1-\u05C2\u05C4-\u05C5\u05C7\u0610-\u061A\u064B-\u0669\u0670\u06D6-\u06DC\u06DF-\u06E4\u06E7-\u06E8\u06EA-\u06ED\u06F0-\u06F9\u0711\u0730-\u074A\u07A6-\u07B0\u07C0-\u07C9\u07EB-\u07F3\u0816-\u0819\u081B-\u0823\u0825-\u0827\u0829-\u082D\u0859-\u085B\u08E3-\u0903\u093A-\u093C\u093E-\u094F\u0951-\u0957\u0962-\u0963\u0966-\u096F\u0981-\u0983\u09BC\u09BE-\u09C4\u09C7-\u09C8\u09CB-\u09CD\u09D7\u09E2-\u09E3\u09E6-\u09EF\u0A01-\u0A03\u0A3C\u0A3E-\u0A42\u0A47-\u0A48\u0A4B-\u0A4D\u0A51\u0A66-\u0A71\u0A75\u0A81-\u0A83\u0ABC\u0ABE-\u0AC5\u0AC7-\u0AC9\u0ACB-\u0ACD\u0AE2-\u0AE3\u0AE6-\u0AEF\u0B01-\u0B03\u0B3C\u0B3E-\u0B44\u0B47-\u0B48\u0B4B-\u0B4D\u0B56-\u0B57\u0B62-\u0B63\u0B66-\u0B6F\u0B82\u0BBE-\u0BC2\u0BC6-\u0BC8\u0BCA-\u0BCD\u0BD7\u0BE6-\u0BEF\u0C00-\u0C03\u0C3E-\u0C44\u0C46-\u0C48\u0C4A-\u0C4D\u0C55-\u0C56\u0C62-\u0C63\u0C66-\u0C6F\u0C81-\u0C83\u0CBC\u0CBE-\u0CC4\u0CC6-\u0CC8\u0CCA-\u0CCD\u0CD5-\u0CD6\u0CE2-\u0CE3\u0CE6-\u0CEF\u0D01-\u0D03\u0D3E-\u0D44\u0D46-\u0D48\u0D4A-\u0D4D\u0D57\u0D62-\u0D63\u0D66-\u0D6F\u0D82-\u0D83\u0DCA\u0DCF-\u0DD4\u0DD6\u0DD8-\u0DDF\u0DE6-\u0DEF\u0DF2-\u0DF3\u0E31\u0E34-\u0E3A\u0E47-\u0E4E\u0E50-\u0E59\u0EB1\u0EB4-\u0EB9\u0EBB-\u0EBC\u0EC8-\u0ECD\u0ED0-\u0ED9\u0F18-\u0F19\u0F20-\u0F29\u0F35\u0F37\u0F39\u0F3E-\u0F3F\u0F71-\u0F84\u0F86-\u0F87\u0F8D-\u0F97\u0F99-\u0FBC\u0FC6\u102B-\u103E\u1040-\u1049\u1056-\u1059\u105E-\u1060\u1062-\u1064\u1067-\u106D\u1071-\u1074\u1082-\u108D\u108F-\u109D\u135D-\u135F\u1712-\u1714\u1732-\u1734\u1752-\u1753\u1772-\u1773\u17B4-\u17D3\u17DD\u17E0-\u17E9\u180B-\u180D\u1810-\u1819\u18A9\u1920-\u192B\u1930-\u193B\u1946-\u194F\u19D0-\u19D9\u1A17-\u1A1B\u1A55-\u1A5E\u1A60-\u1A7C\u1A7F-\u1A89\u1A90-\u1A99\u1AB0-\u1ABD\u1B00-\u1B04\u1B34-\u1B44\u1B50-\u1B59\u1B6B-\u1B73\u1B80-\u1B82\u1BA1-\u1BAD\u1BB0-\u1BB9\u1BE6-\u1BF3\u1C24-\u1C37\u1C40-\u1C49\u1C50-\u1C59\u1CD0-\u1CD2\u1CD4-\u1CE8\u1CED\u1CF2-\u1CF4\u1CF8-\u1CF9\u1DC0-\u1DF5\u1DFC-\u1DFF\u200C-\u200D\u203F-\u2040\u2054\u20D0-\u20DC\u20E1\u20E5-\u20F0\u2CEF-\u2CF1\u2D7F\u2DE0-\u2DFF\u302A-\u302F\u3099-\u309A\uA620-\uA629\uA66F\uA674-\uA67D\uA69E-\uA69F\uA6F0-\uA6F1\uA802\uA806\uA80B\uA823-\uA827\uA880-\uA881\uA8B4-\uA8C4\uA8D0-\uA8D9\uA8E0-\uA8F1\uA900-\uA909\uA926-\uA92D\uA947-\uA953\uA980-\uA983\uA9B3-\uA9C0\uA9D0-\uA9D9\uA9E5\uA9F0-\uA9F9\uAA29-\uAA36\uAA43\uAA4C-\uAA4D\uAA50-\uAA59\uAA7B-\uAA7D\uAAB0\uAAB2-\uAAB4\uAAB7-\uAAB8\uAABE-\uAABF\uAAC1\uAAEB-\uAAEF\uAAF5-\uAAF6\uABE3-\uABEA\uABEC-\uABED\uABF0-\uABF9\uFB1E\uFE00-\uFE0F\uFE20-\uFE2F\uFE33-\uFE34\uFE4D-\uFE4F\uFF10-\uFF19\uFF3F]/,ue=/^[\n\r"\\\u2028-\u2029]/,oe=/^[\n\r'\\\u2028-\u2029]/,ie=/^[\n\r\\-\]\u2028-\u2029]/,ae=/^["'\\]/,se=/^[0-9ux]/,ce=/^[0-9]/,le=/^[0-9a-f]/i,pe=/^[{}]/,fe={type:"any"},he=qt("import",!1),de=qt(";",!1),ge=qt(",",!1),me=qt("*"