@gram-data/d3-gram
Advanced tools
Comparing version 0.1.16 to 0.1.17
@@ -1,2 +0,2 @@ | ||
!function(e,r){"object"==typeof exports&&"undefined"!=typeof module?r(exports,require("@gram-data/gram-parse"),require("@gram-data/gram-ops"),require("@gram-data/gram-ast")):"function"==typeof define&&define.amd?define(["exports","@gram-data/gram-parse","@gram-data/gram-ops","@gram-data/gram-ast"],r):r((e=e||self)["@gram-data/d3-gram"]={},e.gramParse,e.gramOps,e.gramAst)}(this,(function(e,r,a,n){"use strict";var t="__missing_id__",d=function(e,r,a){return{id:e||t,labels:r||[],record:a||{}}},i=function(e,r,a,n,d){return{id:a||t,labels:n||[],record:d||{},source:e,target:r}},o=function(e){var n=r.toAST(e);return{nodes:a.nodes(n).map(u),links:n.children.reduce((function(e,r){return e.concat(a.edges(r).map(m))}),[]),paths:[]}},u=function(e){return n.isGramNode(e)?d(e.id,e.labels,e.record):d("random")},m=function(e){return i(function(e){return"left"===e.kind?e.children[1].id||t:e.children[0].id||t}(e),function(e){return"left"===e.kind?e.children[0].id||t:e.children[1].id||t}(e),e.id,e.labels,e.record)};e.MISSING_ID=t,e.d3Gram=o,e.default=o,e.edgeToD3=m,e.isGramNodeDatum=function(e){return void 0!==e.id},e.makeGramLinkDatum=i,e.makeGramNodeDatum=d,e.nodeToD3=u,Object.defineProperty(e,"__esModule",{value:!0})})); | ||
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports):"function"==typeof define&&define.amd?define(["exports"],t):t(((e=e||self).gram=e.gram||{},e.gram.d3={}))}(this,(function(e){"use strict";var t=function(e){if(e)throw e},n=Object.prototype.hasOwnProperty,r=Object.prototype.toString,o=Object.defineProperty,i=Object.getOwnPropertyDescriptor,s=function(e){return"function"==typeof Array.isArray?Array.isArray(e):"[object Array]"===r.call(e)},a=function(e){if(!e||"[object Object]"!==r.call(e))return!1;var t,o=n.call(e,"constructor"),i=e.constructor&&e.constructor.prototype&&n.call(e.constructor.prototype,"isPrototypeOf");if(e.constructor&&!o&&!i)return!1;for(t in e);return void 0===t||n.call(e,t)},l=function(e,t){o&&"__proto__"===t.name?o(e,t.name,{enumerable:!0,configurable:!0,value:t.newValue,writable:!0}):e[t.name]=t.newValue},u=function(e,t){if("__proto__"===t){if(!n.call(e,t))return;if(i)return i(e,t).value}return e[t]},c=function e(){var t,n,r,o,i,c,f=arguments[0],p=1,h=arguments.length,d=!1;for("boolean"==typeof f&&(d=f,f=arguments[1]||{},p=2),(null==f||"object"!=typeof f&&"function"!=typeof f)&&(f={});p<h;++p)if(null!=(t=arguments[p]))for(n in t)r=u(f,n),f!==(o=u(t,n))&&(d&&o&&(a(o)||(i=s(o)))?(i?(i=!1,c=r&&s(r)?r:[]):c=r&&a(r)?r:{},l(f,{name:n,newValue:e(d,c,o)})):void 0!==o&&l(f,{name:n,newValue:o}));return f},f=e=>{if("[object Object]"!==Object.prototype.toString.call(e))return!1;const t=Object.getPrototypeOf(e);return null===t||t===Object.prototype},p=[].slice,h=function(e,t){var n;return function(){var t,i=p.call(arguments,0),s=e.length>i.length;s&&i.push(r);try{t=e.apply(null,i)}catch(e){if(s&&n)throw e;return r(e)}s||(t&&"function"==typeof t.then?t.then(o,r):t instanceof Error?r(t):o(t))};function r(){n||(n=!0,t.apply(null,arguments))}function o(e){r(null,e)}},d=y;y.wrap=h;var m=[].slice;function y(){var e=[],t={run:function(){var t=-1,n=m.call(arguments,0,-1),r=arguments[arguments.length-1];if("function"!=typeof r)throw new Error("Expected function as last argument, not "+r);function o(i){var s=e[++t],a=m.call(arguments,0),l=a.slice(1),u=n.length,c=-1;if(i)r(i);else{for(;++c<u;)null==l[c]&&(l[c]=n[c]);n=l,s?h(s,o).apply(null,n):r.apply(null,[null].concat(n))}}o.apply(null,[null].concat(n))},use:function(n){if("function"!=typeof n)throw new Error("Expected `fn` to be a function, not "+n);return e.push(n),t}};return t}var b={}.hasOwnProperty,g=function(e){return e&&"object"==typeof e?b.call(e,"position")||b.call(e,"type")?w(e.position):b.call(e,"start")||b.call(e,"end")?w(e):b.call(e,"line")||b.call(e,"column")?v(e):"":""};function v(e){return e&&"object"==typeof e||(e={}),x(e.line)+":"+x(e.column)}function w(e){return e&&"object"==typeof e||(e={}),v(e.start)+"-"+v(e.end)}function x(e){return e&&"number"==typeof e?e:1}var S=E;function k(){}k.prototype=Error.prototype;var $=E.prototype=new k;function E(e,t,n){var r,o,i;"string"==typeof t&&(n=t,t=null),r=function(e){var t,n=[null,null];return"string"==typeof e&&(-1===(t=e.indexOf(":"))?n[1]=e:(n[0]=e.slice(0,t),n[1]=e.slice(t+1))),n}(n),o=g(t)||"1:1",i={start:{line:null,column:null},end:{line:null,column:null}},t&&t.position&&(t=t.position),t&&(t.start?(i=t,t=t.start):i.start=t),e.stack&&(this.stack=e.stack,e=e.message),this.message=e,this.name=o,this.reason=e,this.line=t?t.line:null,this.column=t?t.column:null,this.location=i,this.source=r[0],this.ruleId=r[1]}$.file="",$.name="",$.reason="",$.message="",$.stack="",$.fatal=null,$.column=null,$.line=null;var P="undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{};function _(e,t){for(var n=0,r=e.length-1;r>=0;r--){var o=e[r];"."===o?e.splice(r,1):".."===o?(e.splice(r,1),n++):n&&(e.splice(r,1),n--)}if(t)for(;n--;n)e.unshift("..");return e}"function"==typeof P.setTimeout&&setTimeout,"function"==typeof P.clearTimeout&&clearTimeout,new Date;var O=/^(\/?|)([\s\S]*?)((?:\.{1,2}|[^\/]+?|)(\.[^.\/]*|))(?:[\/]*)$/,A=function(e){return O.exec(e).slice(1)};function j(){for(var e="",t=!1,n=arguments.length-1;n>=-1&&!t;n--){var r=n>=0?arguments[n]:"/";if("string"!=typeof r)throw new TypeError("Arguments to path.resolve must be strings");r&&(e=r+"/"+e,t="/"===r.charAt(0))}return(t?"/":"")+(e=_(B(e.split("/"),(function(e){return!!e})),!t).join("/"))||"."}function T(e){var t=L(e),n="/"===M(e,-1);return(e=_(B(e.split("/"),(function(e){return!!e})),!t).join("/"))||t||(e="."),e&&n&&(e+="/"),(t?"/":"")+e}function L(e){return"/"===e.charAt(0)}function C(){var e=Array.prototype.slice.call(arguments,0);return T(B(e,(function(e,t){if("string"!=typeof e)throw new TypeError("Arguments to path.join must be strings");return e})).join("/"))}function q(e,t){function n(e){for(var t=0;t<e.length&&""===e[t];t++);for(var n=e.length-1;n>=0&&""===e[n];n--);return t>n?[]:e.slice(t,n-t+1)}e=j(e).substr(1),t=j(t).substr(1);for(var r=n(e.split("/")),o=n(t.split("/")),i=Math.min(r.length,o.length),s=i,a=0;a<i;a++)if(r[a]!==o[a]){s=a;break}var l=[];for(a=s;a<r.length;a++)l.push("..");return(l=l.concat(o.slice(s))).join("/")}function R(e){var t=A(e),n=t[0],r=t[1];return n||r?(r&&(r=r.substr(0,r.length-1)),n+r):"."}function N(e,t){var n=A(e)[2];return t&&n.substr(-1*t.length)===t&&(n=n.substr(0,n.length-t.length)),n}function I(e){return A(e)[3]}var G={extname:I,basename:N,dirname:R,sep:"/",delimiter:":",relative:q,join:C,isAbsolute:L,normalize:T,resolve:j};function B(e,t){if(e.filter)return e.filter(t);for(var n=[],r=0;r<e.length;r++)t(e[r],r,e)&&n.push(e[r]);return n}var M="b"==="ab".substr(-1)?function(e,t,n){return e.substr(t,n)}:function(e,t,n){return t<0&&(t=e.length+t),e.substr(t,n)},V="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{};function D(e,t){return e(t={exports:{}},t.exports),t.exports}var z,F=(z={__proto__:null,resolve:j,normalize:T,isAbsolute:L,join:C,relative:q,sep:"/",delimiter:":",dirname:R,basename:N,extname:I,default:G})&&z.default||z,U=function(e){return null!=e&&null!=e.constructor&&"function"==typeof e.constructor.isBuffer&&e.constructor.isBuffer(e)},Q=K,H={}.hasOwnProperty,J=K.prototype,Z=["history","path","basename","stem","extname","dirname"];function K(e){var t,n,r;if(e){if("string"==typeof e||U(e))e={contents:e};else if("message"in e&&"messages"in e)return e}else e={};if(!(this instanceof K))return new K(e);for(this.data={},this.messages=[],this.history=[],this.cwd="/",n=-1,r=Z.length;++n<r;)H.call(e,t=Z[n])&&(this[t]=e[t]);for(t in e)-1===Z.indexOf(t)&&(this[t]=e[t])}function Y(e,t){if(-1!==e.indexOf(F.sep))throw new Error("`"+t+"` cannot be a path: did not expect `"+F.sep+"`")}function W(e,t){if(!e)throw new Error("`"+t+"` cannot be empty")}function X(e,t){if(!e)throw new Error("Setting `"+t+"` requires `path` to be set too")}J.toString=function(e){var t=this.contents||"";return U(t)?t.toString(e):String(t)},Object.defineProperty(J,"path",{get:function(){return this.history[this.history.length-1]},set:function(e){W(e,"path"),e!==this.path&&this.history.push(e)}}),Object.defineProperty(J,"dirname",{get:function(){return"string"==typeof this.path?F.dirname(this.path):void 0},set:function(e){X(this.path,"dirname"),this.path=F.join(e||"",this.basename)}}),Object.defineProperty(J,"basename",{get:function(){return"string"==typeof this.path?F.basename(this.path):void 0},set:function(e){W(e,"basename"),Y(e,"basename"),this.path=F.join(this.dirname||"",e)}}),Object.defineProperty(J,"extname",{get:function(){return"string"==typeof this.path?F.extname(this.path):void 0},set:function(e){var t=e||"";if(Y(t,"extname"),X(this.path,"extname"),t){if("."!==t.charAt(0))throw new Error("`extname` must start with `.`");if(-1!==t.indexOf(".",1))throw new Error("`extname` cannot contain multiple dots")}this.path=function(e,t){if("string"!=typeof e)return e;if(0===e.length)return e;var n=F.basename(e,F.extname(e))+t;return F.join(F.dirname(e),n)}(this.path,t)}}),Object.defineProperty(J,"stem",{get:function(){return"string"==typeof this.path?F.basename(this.path,this.extname):void 0},set:function(e){W(e,"stem"),Y(e,"stem"),this.path=F.join(this.dirname||"",e+(this.extname||""))}});var ee=Q,te=Q.prototype;te.message=function(e,t,n){var r=this.path,o=new S(e,t,n);return r&&(o.name=r+":"+o.name,o.file=r),o.fatal=!1,this.messages.push(o),o},te.info=function(){var e=this.message.apply(this,arguments);return e.fatal=null,e},te.fail=function(){var e=this.message.apply(this,arguments);throw e.fatal=!0,e};var ne=function e(){var n=[],r=d(),o={},i=!1,s=-1;return a.data=function(e,t){return"string"==typeof e?2===arguments.length?(ue("data",i),o[e]=t,a):oe.call(o,e)&&o[e]||null:e?(ue("data",i),o=e,a):o},a.freeze=l,a.attachers=n,a.use=function(e){var t;if(ue("use",i),null==e);else if("function"==typeof e)p.apply(null,arguments);else{if("object"!=typeof e)throw new Error("Expected usable value, not `"+e+"`");"length"in e?l(e):r(e)}return t&&(o.settings=c(o.settings||{},t)),a;function r(e){l(e.plugins),e.settings&&(t=c(t||{},e.settings))}function s(e){if("function"==typeof e)p(e);else{if("object"!=typeof e)throw new Error("Expected usable value, not `"+e+"`");"length"in e?p.apply(null,e):r(e)}}function l(e){var t,n;if(null==e);else{if("object"!=typeof e||!("length"in e))throw new Error("Expected a list of plugins, not `"+e+"`");for(t=e.length,n=-1;++n<t;)s(e[n])}}function p(e,t){var r=u(e);r?(f(r[1])&&f(t)&&(t=c(r[1],t)),r[1]=t):n.push(re.call(arguments))}},a.parse=function(e){var t,n=ee(e);return l(),ae("parse",t=a.Parser),se(t,"parse")?new t(String(n),n).parse():t(String(n),n)},a.stringify=function(e,t){var n,r=ee(t);return l(),le("stringify",n=a.Compiler),ce(e),se(n,"compile")?new n(e,r).compile():n(e,r)},a.run=p,a.runSync=function(e,n){var r,o=!1;return p(e,n,(function(e,n){o=!0,t(e),r=n})),fe("runSync","run",o),r},a.process=h,a.processSync=function(e){var n,r=!1;return l(),ae("processSync",a.Parser),le("processSync",a.Compiler),h(n=ee(e),(function(e){r=!0,t(e)})),fe("processSync","process",r),n},a;function a(){for(var t=e(),r=n.length,i=-1;++i<r;)t.use.apply(null,n[i]);return t.data(c(!0,{},o)),t}function l(){var e,t,o,l;if(i)return a;for(;++s<n.length;)t=(e=n[s])[0],!1!==(o=e[1])&&(!0===o&&(e[1]=void 0),"function"==typeof(l=t.apply(a,e.slice(1)))&&r.use(l));return i=!0,s=Infinity,a}function u(e){for(var t,r=n.length,o=-1;++o<r;)if((t=n[o])[0]===e)return t}function p(e,t,n){if(ce(e),l(),n||"function"!=typeof t||(n=t,t=null),!n)return new Promise(o);function o(o,i){r.run(e,ee(t),(function(t,r,s){r=r||e,t?i(t):o?o(r):n(null,r,s)}))}o(null,n)}function h(e,t){if(l(),ae("process",a.Parser),le("process",a.Compiler),!t)return new Promise(n);function n(n,r){var o=ee(e);ie.run(a,{file:o},(function(e){e?r(e):n?n(o):t(null,o)}))}n(null,t)}}().freeze(),re=[].slice,oe={}.hasOwnProperty,ie=d().use((function(e,t){t.tree=e.parse(t.file)})).use((function(e,t,n){e.run(t.tree,t.file,(function(e,r,o){e?n(e):(t.tree=r,t.file=o,n())}))})).use((function(e,t){var n,r=e.stringify(t.tree,t.file),o=t.file;null==r||("string"==typeof r||null!=(n=r)&&null!=n.constructor&&"function"==typeof n.constructor.isBuffer&&n.constructor.isBuffer(n)?o.contents=r:o.result=r)}));function se(e,t){return"function"==typeof e&&e.prototype&&(function(e){var t;for(t in e)return!0;return!1}(e.prototype)||t in e.prototype)}function ae(e,t){if("function"!=typeof t)throw new Error("Cannot `"+e+"` without `Parser`")}function le(e,t){if("function"!=typeof t)throw new Error("Cannot `"+e+"` without `Compiler`")}function ue(e,t){if(t)throw new Error("Cannot invoke `"+e+"` on a frozen processor.\nCreate a new processor first, by invoking it: use `processor()` instead of `processor`.")}function ce(e){if(!e||"string"!=typeof e.type)throw new Error("Expected node, got `"+e+"`")}function fe(e,t,n){if(!n)throw new Error("`"+e+"` finished async. Use `"+t+"` instead")}var pe=D((function(e){var t,n;t=V,n=function(){function e(t,n,r){return this.id=++e.highestId,this.name=t,this.symbols=n,this.postprocess=r,this}function t(e,t,n,r){this.rule=e,this.dot=t,this.reference=n,this.data=[],this.wantedBy=r,this.isComplete=this.dot===e.symbols.length}function n(e,t){this.grammar=e,this.index=t,this.states=[],this.wants={},this.scannable=[],this.completed={}}function r(e,t){this.rules=e,this.start=t||this.rules[0].name;var n=this.byName={};this.rules.forEach((function(e){n.hasOwnProperty(e.name)||(n[e.name]=[]),n[e.name].push(e)}))}function o(){this.reset("")}function i(e,t,i){if(e instanceof r){var s=e;i=t}else s=r.fromCompiled(e,t);for(var a in this.grammar=s,this.options={keepHistory:!1,lexer:s.lexer||new o},i||{})this.options[a]=i[a];this.lexer=this.options.lexer,this.lexerState=void 0;var l=new n(s,0);this.table=[l],l.wants[s.start]=[],l.predict(s.start),l.process(),this.current=0}function s(e){var t=typeof e;if("string"===t)return e;if("object"===t){if(e.literal)return JSON.stringify(e.literal);if(e instanceof RegExp)return e.toString();if(e.type)return"%"+e.type;if(e.test)return"<"+String(e.test)+">";throw new Error("Unknown symbol type: "+e)}}return e.highestId=0,e.prototype.toString=function(e){var t=void 0===e?this.symbols.map(s).join(" "):this.symbols.slice(0,e).map(s).join(" ")+" ● "+this.symbols.slice(e).map(s).join(" ");return this.name+" → "+t},t.prototype.toString=function(){return"{"+this.rule.toString(this.dot)+"}, from: "+(this.reference||0)},t.prototype.nextState=function(e){var n=new t(this.rule,this.dot+1,this.reference,this.wantedBy);return n.left=this,n.right=e,n.isComplete&&(n.data=n.build(),n.right=void 0),n},t.prototype.build=function(){var e=[],t=this;do{e.push(t.right.data),t=t.left}while(t.left);return e.reverse(),e},t.prototype.finish=function(){this.rule.postprocess&&(this.data=this.rule.postprocess(this.data,this.reference,i.fail))},n.prototype.process=function(e){for(var t=this.states,n=this.wants,r=this.completed,o=0;o<t.length;o++){var s=t[o];if(s.isComplete){if(s.finish(),s.data!==i.fail){for(var a=s.wantedBy,l=a.length;l--;)this.complete(a[l],s);s.reference===this.index&&(this.completed[u=s.rule.name]=this.completed[u]||[]).push(s)}}else{var u;if("string"!=typeof(u=s.rule.symbols[s.dot])){this.scannable.push(s);continue}if(n[u]){if(n[u].push(s),r.hasOwnProperty(u)){var c=r[u];for(l=0;l<c.length;l++)this.complete(s,c[l])}}else n[u]=[s],this.predict(u)}}},n.prototype.predict=function(e){for(var n=this.grammar.byName[e]||[],r=0;r<n.length;r++){var o=new t(n[r],0,this.index,this.wants[e]);this.states.push(o)}},n.prototype.complete=function(e,t){var n=e.nextState(t);this.states.push(n)},r.fromCompiled=function(t,n){var o=t.Lexer;t.ParserStart&&(n=t.ParserStart,t=t.ParserRules);var i=new r(t=t.map((function(t){return new e(t.name,t.symbols,t.postprocess)})),n);return i.lexer=o,i},o.prototype.reset=function(e,t){this.buffer=e,this.index=0,this.line=t?t.line:1,this.lastLineBreak=t?-t.col:0},o.prototype.next=function(){if(this.index<this.buffer.length){var e=this.buffer[this.index++];return"\n"===e&&(this.line+=1,this.lastLineBreak=this.index),{value:e}}},o.prototype.save=function(){return{line:this.line,col:this.index-this.lastLineBreak}},o.prototype.formatError=function(e,t){var n=this.buffer;if("string"==typeof n){var r=n.split("\n").slice(Math.max(0,this.line-5),this.line),o=n.indexOf("\n",this.index);-1===o&&(o=n.length);var i=this.index-this.lastLineBreak,s=String(this.line).length;return t+=" at line "+this.line+" col "+i+":\n\n",(t+=r.map((function(e,t){return a(this.line-r.length+t+1,s)+" "+e}),this).join("\n"))+"\n"+a("",s+i)+"^\n"}return t+" at index "+(this.index-1);function a(e,t){var n=String(e);return Array(t-n.length+1).join(" ")+n}},i.fail={},i.prototype.feed=function(e){var t,r=this.lexer;for(r.reset(e,this.lexerState);;){try{if(!(t=r.next()))break}catch(e){var i=new n(this.grammar,this.current+1);throw this.table.push(i),(l=new Error(this.reportLexerError(e))).offset=this.current,l.token=e.token,l}var s=this.table[this.current];this.options.keepHistory||delete this.table[this.current-1];var a=this.current+1;i=new n(this.grammar,a),this.table.push(i);for(var l,u=void 0!==t.text?t.text:t.value,c=r.constructor===o?t.value:t,f=s.scannable,p=f.length;p--;){var h=f[p],d=h.rule.symbols[h.dot];if(d.test?d.test(c):d.type?d.type===t.type:d.literal===u){var m=h.nextState({data:c,token:t,isToken:!0,reference:a-1});i.states.push(m)}}if(i.process(),0===i.states.length)throw(l=new Error(this.reportError(t))).offset=this.current,l.token=t,l;this.options.keepHistory&&(s.lexerState=r.save()),this.current++}return s&&(this.lexerState=r.save()),this.results=this.finish(),this},i.prototype.reportLexerError=function(e){var t,n,r=e.token;return r?(t="input "+JSON.stringify(r.text[0])+" (lexer error)",n=this.lexer.formatError(r,"Syntax error")):(t="input (lexer error)",n=e.message),this.reportErrorCommon(n,t)},i.prototype.reportError=function(e){var t=(e.type?e.type+" token: ":"")+JSON.stringify(void 0!==e.value?e.value:e),n=this.lexer.formatError(e,"Syntax error");return this.reportErrorCommon(n,t)},i.prototype.reportErrorCommon=function(e,t){var n=[];n.push(e);var r=this.table[this.table.length-2],o=r.states.filter((function(e){var t=e.rule.symbols[e.dot];return t&&"string"!=typeof t}));return 0===o.length?(n.push("Unexpected "+t+". I did not expect any more input. Here is the state of my parse table:\n"),this.displayStateStack(r.states,n)):(n.push("Unexpected "+t+". Instead, I was expecting to see one of the following:\n"),o.map((function(e){return this.buildFirstStateStack(e,[])||[e]}),this).forEach((function(e){var t=e[0],r=this.getSymbolDisplay(t.rule.symbols[t.dot]);n.push("A "+r+" based on:"),this.displayStateStack(e,n)}),this)),n.push(""),n.join("\n")},i.prototype.displayStateStack=function(e,t){for(var n,r=0,o=0;o<e.length;o++){var i=e[o],s=i.rule.toString(i.dot);s===n?r++:(r>0&&t.push(" ^ "+r+" more lines identical to this"),r=0,t.push(" "+s)),n=s}},i.prototype.getSymbolDisplay=function(e){return function(e){var t=typeof e;if("string"===t)return e;if("object"===t){if(e.literal)return JSON.stringify(e.literal);if(e instanceof RegExp)return"character matching "+e;if(e.type)return e.type+" token";if(e.test)return"token matching "+String(e.test);throw new Error("Unknown symbol type: "+e)}}(e)},i.prototype.buildFirstStateStack=function(e,t){if(-1!==t.indexOf(e))return null;if(0===e.wantedBy.length)return[e];var n=e.wantedBy[0],r=[e].concat(t),o=this.buildFirstStateStack(n,r);return null===o?null:[e].concat(o)},i.prototype.save=function(){var e=this.table[this.current];return e.lexerState=this.lexerState,e},i.prototype.restore=function(e){var t=e.index;this.current=t,this.table[t]=e,this.table.splice(t+1),this.lexerState=e.lexerState,this.results=this.finish()},i.prototype.rewind=function(e){if(!this.options.keepHistory)throw new Error("set option `keepHistory` to enable rewinding");this.restore(this.table[e])},i.prototype.finish=function(){var e=[],t=this.grammar.start;return this.table[this.table.length-1].states.forEach((function(n){n.rule.name===t&&n.dot===n.rule.symbols.length&&0===n.reference&&n.data!==i.fail&&e.push(n)})),e.map((function(e){return e.data}))},{Parser:i,Grammar:r,Rule:e}},e.exports?e.exports=n():t.nearley=n()})),he=D((function(e){var t,n;t=V,n=function(){var e=Object.prototype.hasOwnProperty,t=Object.prototype.toString,n="boolean"==typeof(new RegExp).sticky;function r(e){return e&&"[object RegExp]"===t.call(e)}function o(e){return e&&"object"==typeof e&&!r(e)&&!Array.isArray(e)}function i(e){return e.length?"(?:"+e.map((function(e){return"(?:"+e+")"})).join("|")+")":"(?!)"}function s(e){if("string"==typeof e)return"(?:"+e.replace(/[-\/\\^$*+?.()|[\]{}]/g,"\\$&")+")";if(r(e)){if(e.ignoreCase)throw new Error("RegExp /i flag not allowed");if(e.global)throw new Error("RegExp /g flag is implied");if(e.sticky)throw new Error("RegExp /y flag is implied");if(e.multiline)throw new Error("RegExp /m flag is implied");return e.source}throw new Error("Not a pattern: "+e)}function a(t,n){if(o(n)||(n={match:n}),n.include)throw new Error("Matching rules cannot also include states");var i={defaultType:t,lineBreaks:!!n.error||!!n.fallback,pop:!1,next:null,push:null,error:!1,fallback:!1,value:null,type:null,shouldThrow:!1};for(var s in n)e.call(n,s)&&(i[s]=n[s]);if("string"==typeof i.type&&t!==i.type)throw new Error("Type transform cannot be a string (type '"+i.type+"' for token '"+t+"')");var a=i.match;return i.match=Array.isArray(a)?a:a?[a]:[],i.match.sort((function(e,t){return r(e)&&r(t)?0:r(t)?-1:r(e)?1:t.length-e.length})),i}function l(e){return Array.isArray(e)?function(e){for(var t=[],n=0;n<e.length;n++){var r=e[n];if(r.include)for(var o=[].concat(r.include),i=0;i<o.length;i++)t.push({include:o[i]});else{if(!r.type)throw new Error("Rule has no type: "+JSON.stringify(r));t.push(a(r.type,r))}}return t}(e):function(e){for(var t=Object.getOwnPropertyNames(e),n=[],r=0;r<t.length;r++){var i=t[r],s=[].concat(e[i]);if("include"!==i){var l=[];s.forEach((function(e){o(e)?(l.length&&n.push(a(i,l)),n.push(a(i,e)),l=[]):l.push(e)})),l.length&&n.push(a(i,l))}else for(var u=0;u<s.length;u++)n.push({include:s[u]})}return n}(e)}var u=a("error",{lineBreaks:!0,shouldThrow:!0});function c(e,t){for(var o=null,a=Object.create(null),l=!0,c=null,f=[],p=[],h=0;h<e.length;h++)e[h].fallback&&(l=!1);for(h=0;h<e.length;h++){var d=e[h];if(d.include)throw new Error("Inheritance is not allowed in stateless lexers");if(d.error||d.fallback){if(o)throw!d.fallback==!o.fallback?new Error("Multiple "+(d.fallback?"fallback":"error")+" rules not allowed (for token '"+d.defaultType+"')"):new Error("fallback and error are mutually exclusive (for token '"+d.defaultType+"')");o=d}var m=d.match.slice();if(l)for(;m.length&&"string"==typeof m[0]&&1===m[0].length;)a[m.shift().charCodeAt(0)]=d;if(d.pop||d.push||d.next){if(!t)throw new Error("State-switching options are not allowed in stateless lexers (for token '"+d.defaultType+"')");if(d.fallback)throw new Error("State-switching options are not allowed on fallback tokens (for token '"+d.defaultType+"')")}if(0!==m.length){l=!1,f.push(d);for(var y=0;y<m.length;y++){var b=m[y];if(r(b))if(null===c)c=b.unicode;else if(c!==b.unicode&&!1===d.fallback)throw new Error("If one rule is /u then all must be")}var g=i(m.map(s)),v=new RegExp(g);if(v.test(""))throw new Error("RegExp matches empty string: "+v);if(new RegExp("|"+g).exec("").length-1>0)throw new Error("RegExp has capture groups: "+v+"\nUse (?: … ) instead");if(!d.lineBreaks&&v.test("\n"))throw new Error("Rule should declare lineBreaks: "+v);p.push("("+g+")")}}var w=o&&o.fallback,x=n&&!w?"ym":"gm",S=n||w?"":"|";return!0===c&&(x+="u"),{regexp:new RegExp(i(p)+S,x),groups:f,fast:a,error:o||u}}function f(e,t,n){var r=e&&(e.push||e.next);if(r&&!n[r])throw new Error("Missing state '"+r+"' (in token '"+e.defaultType+"' of state '"+t+"')");if(e&&e.pop&&1!=+e.pop)throw new Error("pop must be 1 (in token '"+e.defaultType+"' of state '"+t+"')")}var p=function(e,t){this.startState=t,this.states=e,this.buffer="",this.stack=[],this.reset()};p.prototype.reset=function(e,t){return this.buffer=e||"",this.index=0,this.line=t?t.line:1,this.col=t?t.col:1,this.queuedToken=t?t.queuedToken:null,this.queuedThrow=t?t.queuedThrow:null,this.setState(t?t.state:this.startState),this.stack=t&&t.stack?t.stack.slice():[],this},p.prototype.save=function(){return{line:this.line,col:this.col,state:this.state,stack:this.stack.slice(),queuedToken:this.queuedToken,queuedThrow:this.queuedThrow}},p.prototype.setState=function(e){if(e&&this.state!==e){this.state=e;var t=this.states[e];this.groups=t.groups,this.error=t.error,this.re=t.regexp,this.fast=t.fast}},p.prototype.popState=function(){this.setState(this.stack.pop())},p.prototype.pushState=function(e){this.stack.push(this.state),this.setState(e)};var h=n?function(e,t){return e.exec(t)}:function(e,t){var n=e.exec(t);return 0===n[0].length?null:n};function d(){return this.value}if(p.prototype._getGroup=function(e){for(var t=this.groups.length,n=0;n<t;n++)if(void 0!==e[n+1])return this.groups[n];throw new Error("Cannot find token type for matched text")},p.prototype.next=function(){var e=this.index;if(this.queuedGroup){var t=this._token(this.queuedGroup,this.queuedText,e);return this.queuedGroup=null,this.queuedText="",t}var n=this.buffer;if(e!==n.length){if(s=this.fast[n.charCodeAt(e)])return this._token(s,n.charAt(e),e);var r=this.re;r.lastIndex=e;var o=h(r,n),i=this.error;if(null==o)return this._token(i,n.slice(e,n.length),e);var s=this._getGroup(o),a=o[0];return i.fallback&&o.index!==e?(this.queuedGroup=s,this.queuedText=a,this._token(i,n.slice(e,o.index),e)):this._token(s,a,e)}},p.prototype._token=function(e,t,n){var r=0;if(e.lineBreaks){var o=/\n/g,i=1;if("\n"===t)r=1;else for(;o.exec(t);)r++,i=o.lastIndex}var s={type:"function"==typeof e.type&&e.type(t)||e.defaultType,value:"function"==typeof e.value?e.value(t):t,text:t,toString:d,offset:n,lineBreaks:r,line:this.line,col:this.col},a=t.length;if(this.index+=a,this.line+=r,0!==r?this.col=a-i+1:this.col+=a,e.shouldThrow)throw new Error(this.formatError(s,"invalid syntax"));return e.pop?this.popState():e.push?this.pushState(e.push):e.next&&this.setState(e.next),s},"undefined"!=typeof Symbol&&Symbol.iterator){var m=function(e){this.lexer=e};m.prototype.next=function(){var e=this.lexer.next();return{value:e,done:!e}},m.prototype[Symbol.iterator]=function(){return this},p.prototype[Symbol.iterator]=function(){return new m(this)}}return p.prototype.formatError=function(e,t){if(null==e){var n=this.buffer.slice(this.index);e={text:n,offset:this.index,lineBreaks:-1===n.indexOf("\n")?0:1,line:this.line,col:this.col}}var r=Math.max(0,e.offset-e.col+1),o=e.lineBreaks?e.text.indexOf("\n"):e.text.length,i=this.buffer.substring(r,e.offset+o);return t+=" at line "+e.line+" col "+e.col+":\n\n",(t+=" "+i+"\n")+" "+Array(e.col).join(" ")+"^"},p.prototype.clone=function(){return new p(this.states,this.state)},p.prototype.has=function(e){return!0},{compile:function(e){var t=c(l(e));return new p({start:t},"start")},states:function(e,t){var n=e.$all?l(e.$all):[];delete e.$all;var r=Object.getOwnPropertyNames(e);t||(t=r[0]);for(var o=Object.create(null),i=0;i<r.length;i++)o[v=r[i]]=l(e[v]).concat(n);for(i=0;i<r.length;i++)for(var s=o[v=r[i]],a=Object.create(null),u=0;u<s.length;u++){var h=s[u];if(h.include){var d=[u,1];if(h.include!==v&&!a[h.include]){a[h.include]=!0;var m=o[h.include];if(!m)throw new Error("Cannot include nonexistent state '"+h.include+"' (in state '"+v+"')");for(var y=0;y<m.length;y++){var b=m[y];-1===s.indexOf(b)&&d.push(b)}}s.splice.apply(s,d),u--}}var g=Object.create(null);for(i=0;i<r.length;i++){var v;g[v=r[i]]=c(o[v],!0)}for(i=0;i<r.length;i++){var w=r[i],x=g[w],S=x.groups;for(u=0;u<S.length;u++)f(S[u],w,g);var k=Object.getOwnPropertyNames(x.fast);for(u=0;u<k.length;u++)f(x.fast[k[u]],w,g)}return new p(g,t)},error:Object.freeze({error:!0}),fallback:Object.freeze({fallback:!0}),keywords:function(e){for(var t=Object.create(null),n=Object.create(null),r=Object.getOwnPropertyNames(e),o=0;o<r.length;o++){var i=r[o],s=e[i];(Array.isArray(s)?s:[s]).forEach((function(e){if((n[e.length]=n[e.length]||[]).push(e),"string"!=typeof e)throw new Error("keyword must be string (in keyword '"+i+"')");t[e]=i}))}function a(e){return JSON.stringify(e)}var l="";for(var u in l+="switch (value.length) {\n",n)l+="case "+u+":\n",l+="switch (value) {\n",n[u].forEach((function(e){var n=t[e];l+="case "+a(e)+": return "+a(n)+"\n"})),l+="}\n";return l+="}\n",Function("value",l)}}},e.exports?e.exports=n():t.moo=n()})),de=/[0-9a-zA-Z_@]+\b@*/,me=new RegExp("^"+de.source+"$"),ye={__proto__:null,boolean:/true|false|TRUE|FALSE\b(?!@)/,hexadecimal:/-?0x(?:[0-9a-fA-F]+)\b(?!@)/,octal:/-?0(?:[0-7]+)\b(?!@)/,measurement:/-?(?:[0-9]|[1-9][0-9]+)(?:\.[0-9]+)?[a-zA-Z]+\b(?!@)/,decimal:/-?(?:[0-9]|[1-9][0-9]+)\.[0-9]+(?:[eE][-+]?[0-9]+)?\b(?!@)/,integer:/-?(?:[0-9]|[1-9][0-9]+)(?:[eE][-+]?[0-9]+)?\b(?!@)/,taggedString:/[a-zA-Z][0-9a-zA-Z_@]*`(?:\\[`bfnrt/\\]|\\u[a-fA-F0-9]{4}|[^`\\])*`/,doubleQuotedString:/"(?:\\["bfnrt/\\]|\\u[a-fA-F0-9]{4}|[^"\\])*"/,singleQuotedString:/'(?:\\['bfnrt/\\]|\\u[a-fA-F0-9]{4}|[^'\\])*'/,tickedString:/`(?:\\[`bfnrt/\\]|\\u[a-fA-F0-9]{4}|[^`\\])*`/,symbol:/[a-zA-Z_][0-9a-zA-Z_]*\b(?!@)/,identifier:de,isValidIdentifier:function(e){return e&&me.test(e)}},be=function(e){return!!e.type&&"path"===e.type},ge=function(e){return be(e)&&"ø"===e.id},ve=function(e){return be(e)&&e.children&&0===e.children.length&&"ø"!==e.id};function we(){return(we=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e}).apply(this,arguments)}function xe(e){return Array.isArray(e)?e:e instanceof Function?xe(e()):void 0===e?[]:[e]}var Se=function(e,t,n,r){return we({type:"seq",id:t},n&&{labels:n},r&&{record:r},{children:xe(e)})},ke=function(e,t){return void 0===e&&(e="pair"),t.length>1?t.slice(0,t.length-1).reduceRight((function(t,n){return $e([n,t],{kind:e})}),t[t.length-1]):t[0]},$e=function(e,t){void 0===t&&(t={});var n=we({type:"path"},t.id&&{id:t.id},t.labels&&{labels:t.labels},t.record&&{record:t.record});if(void 0===e)return n.id&&"ø"!==n.id?(n.children=[],n):(n.children=void 0,Ee);if(0===e.length)return"ø"===n.id?Ee:(n.children=[],n);if(1===e.length){var r=e[0];return ge(r)?(n.children=[],n):(n.children=[r],n)}if(2===e.length){if(t.kind&&"pair"!==t.kind&&ve(e[0])&&ve(e[1]))return n.kind=t.kind,n.children=[e[0],e[1]],n;if(ge(e[0])&&ge(e[1]))return n.kind=t.kind,n.children=[],n;n.children=[e[0],e[1]]}return n.kind=t.kind||"pair",n},Ee={type:"path",id:"ø",labels:void 0,record:void 0,children:[]},Pe=function(){return Ee},_e=function(e,t,n){return we({type:"path"},e&&{id:e},t&&{labels:t},n&&{record:n},{children:[]})},Oe=function(e,t,n,r,o){return we({type:"path",id:n},r&&{labels:r},o&&{record:o},{kind:t,children:e})},Ae=function(e,t,n,r,o){return we({type:"path",kind:e,id:n},r&&{labels:r},o&&{record:o},{children:t})},je=function(e,t,n,r){return Ae("pair",e,t,n,r)},Te=function(e){return e.reduce((function(e,t){return e[t.name]=t.value,e}),{})},Le=function(e){return Object.entries(e).reduce((function(e,t){return e.push(Ce(t[0],t[1])),e}),[])},Ce=function(e,t){return{type:"property",name:e,value:t}},qe=function(e){return{type:"boolean",value:e?"true":"false"}},Re=function(e){return{type:"string",value:e}},Ne=function(e,t){return{type:"tagged",value:t,tag:e}},Ie=function(e){return{type:"integer",value:String(e)}},Ge=function(e){return{type:"decimal",value:String(e)}},Be=function(e){return{type:"hexadecimal",value:"number"==typeof e?e.toString(16):e}},Me=function(e){return{type:"octal",value:"number"==typeof e?e.toString(8):e}},Ve=function(e,t){return{type:"measurement",value:String(t),unit:e}},De=function(e){return Ne("date",e instanceof Date?e.toISOString().slice(0,10):e)},ze=function(e){return Ne("time",e instanceof Date?e.toTimeString():e)},Fe=function(e){return Ne("duration",e instanceof Date?"P"+(e.getUTCFullYear()-1970)+"Y"+e.getUTCMonth()+"M"+e.getUTCDate()+"DT"+e.getUTCHours()+"H"+e.getUTCMinutes()+"M"+e.getUTCMilliseconds()/1e3+"S":e)},Ue=function(e,t){return void 0===t&&(t=1),e.flat(t).filter((function(e){return null!==e}))},Qe={__proto__:null,seq:Se,listToPath:ke,cons:$e,empty:Pe,node:_e,edge:Oe,path:Ae,pair:je,recordToMap:Te,mapToRecord:Le,pluck:function(e,t){return e.reduce((function(e,n){return n.name===t?n:e}))},property:Ce,boolean:qe,string:Re,tagged:Ne,integer:Ie,decimal:Ge,hexadecimal:Be,octal:Me,measurement:Ve,year:function(e){return Ne("date",e instanceof Date?e.getFullYear().toString():e)},date:De,dayOfMonth:function(e){return Ne("date",e instanceof Date?"--"+e.toISOString().slice(5,10):e)},time:ze,duration:Fe,flatten:Ue,default:{seq:Se,empty:Pe,cons:$e,pair:je,listToPath:ke,node:_e,edge:Oe,property:Ce,boolean:qe,string:Re,tagged:Ne,integer:Ie,decimal:Ge,hexadecimal:Be,octal:Me,measurement:Ve,date:De,time:ze,duration:Fe,flatten:Ue,recordToMap:Te,mapToRecord:Le}};function He(){return(He=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e}).apply(this,arguments)}function Je(e){return e[0]}var Ze=he.compile({whitespace:{match:/\s+/,lineBreaks:!0},lineComment:{match:/\/\/.*?\n?$/},hexadecimal:ye.hexadecimal,octal:ye.octal,measurement:ye.measurement,decimal:ye.decimal,integer:ye.integer,taggedString:{match:ye.taggedString},boolean:["true","TRUE","True","false","FALSE","False"],symbol:ye.symbol,identifier:ye.identifier,doubleQuotedString:{match:ye.doubleQuotedString,value:function(e){return e.slice(1,-1)}},singleQuotedString:{match:ye.singleQuotedString,value:function(e){return e.slice(1,-1)}},tickedString:{match:ye.tickedString,value:function(e){return e.slice(1,-1)}},"--\x3e":"--\x3e","--":"--","<--":"<--","-[]->":"-[]->","-[]-":"-[]-","<-[]-":"<-[]-","<-[":"<-[","]->":"]->","-[":"-[","]-":"]-","{":"{","}":"}","[":"[","]":"]","(":"(",")":")",",":",",":":":","`":"`","'":"'","ø":"ø"}),Ke=function(){return null},Ye=function(e){return e[0].text},We={Lexer:Ze,ParserRules:[{name:"GramSeq$ebnf$1$subexpression$1",symbols:["Path","_"],postprocess:function(e){return e[0]}},{name:"GramSeq$ebnf$1",symbols:["GramSeq$ebnf$1$subexpression$1"]},{name:"GramSeq$ebnf$1$subexpression$2",symbols:["Path","_"],postprocess:function(e){return e[0]}},{name:"GramSeq$ebnf$1",symbols:["GramSeq$ebnf$1","GramSeq$ebnf$1$subexpression$2"],postprocess:function(e){return e[0].concat([e[1]])}},{name:"GramSeq$ebnf$2",symbols:["EOL"],postprocess:Je},{name:"GramSeq$ebnf$2",symbols:[],postprocess:function(){return null}},{name:"GramSeq",symbols:["GramSeq$ebnf$1","GramSeq$ebnf$2"],postprocess:function(e){return Qe.seq(Qe.flatten(e[0]))}},{name:"Path",symbols:["NodePattern"],postprocess:Je},{name:"Path",symbols:["PathComposition"],postprocess:Je},{name:"Path",symbols:["PathPair"],postprocess:Je},{name:"NodePattern",symbols:["Node","_","Edge","_","NodePattern"],postprocess:function(e){var t=e[2];return Qe.cons([e[0],e[4]],{kind:t.kind,id:t.id,labels:t.labels,record:t.record})}},{name:"NodePattern",symbols:["Node"],postprocess:Je},{name:"Node",symbols:[{literal:"("},"_","Attributes","_",{literal:")"}],postprocess:function(e){var t=e[2];return Qe.node(t.id,t.labels,t.record)}},{name:"Edge",symbols:[{literal:"-["},"_","Attributes",{literal:"]->"}],postprocess:function(e){return He({kind:"right"},e[2])}},{name:"Edge",symbols:[{literal:"-["},"_","Attributes",{literal:"]-"}],postprocess:function(e){return He({kind:"either"},e[2])}},{name:"Edge",symbols:[{literal:"<-["},"_","Attributes",{literal:"]-"}],postprocess:function(e){return He({kind:"left"},e[2])}},{name:"Edge",symbols:[{literal:"-[]->"}],postprocess:function(){return{kind:"right"}}},{name:"Edge",symbols:[{literal:"-[]-"}],postprocess:function(){return{kind:"either"}}},{name:"Edge",symbols:[{literal:"<-[]-"}],postprocess:function(){return{kind:"left"}}},{name:"Edge",symbols:[{literal:"--\x3e"}],postprocess:function(){return{kind:"right"}}},{name:"Edge",symbols:[{literal:"--"}],postprocess:function(){return{kind:"either"}}},{name:"Edge",symbols:[{literal:"<--"}],postprocess:function(){return{kind:"left"}}},{name:"PathComposition",symbols:["PathPoint"],postprocess:Je},{name:"PathComposition",symbols:["PathAnnotation"],postprocess:Je},{name:"PathComposition",symbols:["PathExpression"],postprocess:Je},{name:"PathPoint",symbols:[{literal:"["},"_","Attributes","_",{literal:"]"}],postprocess:function(e){var t=e[2];return(t.id||t.labels||t.record)&&"ø"!==t.id?Qe.node(t.id,t.labels,t.record):Qe.empty()}},{name:"PathAnnotation",symbols:[{literal:"["},"_","Attributes","_","Path",{literal:"]"}],postprocess:function(e){var t=e[2];return Qe.cons([e[4]],{id:t.id,labels:t.labels,record:t.record})}},{name:"PathExpression$ebnf$1",symbols:["Kind"],postprocess:Je},{name:"PathExpression$ebnf$1",symbols:[],postprocess:function(){return null}},{name:"PathExpression",symbols:[{literal:"["},"_","Attributes","_","PathExpression$ebnf$1","_","Path","_","Path","_",{literal:"]"}],postprocess:function(e){var t=e[2];return Qe.cons([e[6],e[8]],{kind:e[4],id:t.id,labels:t.labels,record:t.record})}},{name:"PathPair$subexpression$1",symbols:["NodePattern"]},{name:"PathPair$subexpression$1",symbols:["PathComposition"]},{name:"PathPair",symbols:["PathPair$subexpression$1","_",{literal:","},"_","Path"],postprocess:function(e){return Qe.pair([e[0][0],e[4]])}},{name:"Kind",symbols:[{literal:","}],postprocess:function(){return"pair"}},{name:"Kind",symbols:[{literal:"--\x3e"}],postprocess:function(){return"right"}},{name:"Kind",symbols:[{literal:"--"}],postprocess:function(){return"either"}},{name:"Kind",symbols:[{literal:"<--"}],postprocess:function(){return"left"}},{name:"Attributes$ebnf$1",symbols:["Identity"],postprocess:Je},{name:"Attributes$ebnf$1",symbols:[],postprocess:function(){return null}},{name:"Attributes$ebnf$2$subexpression$1",symbols:["_","LabelList"],postprocess:function(e){return e[1]}},{name:"Attributes$ebnf$2",symbols:["Attributes$ebnf$2$subexpression$1"],postprocess:Je},{name:"Attributes$ebnf$2",symbols:[],postprocess:function(){return null}},{name:"Attributes$ebnf$3$subexpression$1",symbols:["_","Record"],postprocess:function(e){return e[1]}},{name:"Attributes$ebnf$3",symbols:["Attributes$ebnf$3$subexpression$1"],postprocess:Je},{name:"Attributes$ebnf$3",symbols:[],postprocess:function(){return null}},{name:"Attributes",symbols:["Attributes$ebnf$1","Attributes$ebnf$2","Attributes$ebnf$3"],postprocess:function(e){return{id:e[0],labels:e[1],record:e[2]}}},{name:"LabelList$ebnf$1",symbols:["Label"]},{name:"LabelList$ebnf$1",symbols:["LabelList$ebnf$1","Label"],postprocess:function(e){return e[0].concat([e[1]])}},{name:"LabelList",symbols:["LabelList$ebnf$1"],postprocess:function(e){return e[0]}},{name:"Label",symbols:[{literal:":"},"Symbol"],postprocess:function(e){return e[1]}},{name:"Identity",symbols:[Ze.has("identifier")?{type:"identifier"}:identifier],postprocess:Ye},{name:"Identity",symbols:[{literal:"ø"}],postprocess:Ye},{name:"Identity",symbols:[Ze.has("symbol")?{type:"symbol"}:symbol],postprocess:Ye},{name:"Identity",symbols:[Ze.has("integer")?{type:"integer"}:integer],postprocess:Ye},{name:"Identity",symbols:[Ze.has("octal")?{type:"octal"}:octal],postprocess:Ye},{name:"Identity",symbols:[Ze.has("hexadecimal")?{type:"hexadecimal"}:hexadecimal],postprocess:Ye},{name:"Identity",symbols:[Ze.has("measurement")?{type:"measurement"}:measurement],postprocess:Ye},{name:"Identity",symbols:[Ze.has("tickedString")?{type:"tickedString"}:tickedString],postprocess:function(e){return e[0].text.slice(1,-1)}},{name:"Symbol",symbols:[Ze.has("symbol")?{type:"symbol"}:symbol],postprocess:Ye},{name:"Symbol",symbols:[Ze.has("tickedString")?{type:"tickedString"}:tickedString],postprocess:function(e){return e[0].text.slice(1,-1)}},{name:"Record",symbols:[{literal:"{"},"_",{literal:"}"}],postprocess:Ke},{name:"Record$ebnf$1",symbols:[]},{name:"Record$ebnf$1$subexpression$1",symbols:["_",{literal:","},"_","Property"]},{name:"Record$ebnf$1",symbols:["Record$ebnf$1","Record$ebnf$1$subexpression$1"],postprocess:function(e){return e[0].concat([e[1]])}},{name:"Record",symbols:[{literal:"{"},"_","Property","Record$ebnf$1","_",{literal:"}"}],postprocess:function(e){return[e[2]].concat(e[3].map((function(e){return e[3]})))}},{name:"Property",symbols:["Symbol","_",{literal:":"},"_","Value"],postprocess:function(e){return Qe.property(e[0],e[4])}},{name:"Value",symbols:["StringLiteral"],postprocess:Je},{name:"Value",symbols:["NumericLiteral"],postprocess:Je},{name:"Value",symbols:[Ze.has("boolean")?{type:"boolean"}:boolean],postprocess:function(e){return Qe.boolean(JSON.parse(e[0].value.toLowerCase()))}},{name:"Value$ebnf$1",symbols:[]},{name:"Value$ebnf$1$subexpression$1",symbols:["_",{literal:","},"_","Value"]},{name:"Value$ebnf$1",symbols:["Value$ebnf$1","Value$ebnf$1$subexpression$1"],postprocess:function(e){return e[0].concat([e[1]])}},{name:"Value",symbols:[{literal:"["},"_","Value","Value$ebnf$1",{literal:"]"}],postprocess:function(e){return[e[2]].concat(e[3].map((function(e){return e[3]})))}},{name:"StringLiteral",symbols:[Ze.has("singleQuotedString")?{type:"singleQuotedString"}:singleQuotedString],postprocess:function(e){return Qe.string(e[0].value)}},{name:"StringLiteral",symbols:[Ze.has("doubleQuotedString")?{type:"doubleQuotedString"}:doubleQuotedString],postprocess:function(e){return Qe.string(e[0].value)}},{name:"StringLiteral",symbols:[Ze.has("tickedString")?{type:"tickedString"}:tickedString],postprocess:function(e){return Qe.string(e[0].value)}},{name:"StringLiteral",symbols:[Ze.has("taggedString")?{type:"taggedString"}:taggedString],postprocess:function(e){var t=function(e){var t=e.match(/([^`]+)`(.+)`$/);if(null==t)throw Error("Malformed tagged string: "+e);return{tag:t[1],value:t[2]}}(e[0].value);return Qe.tagged(t.tag,t.value)}},{name:"NumericLiteral",symbols:[Ze.has("integer")?{type:"integer"}:integer],postprocess:function(e){return Qe.integer(e[0].value)}},{name:"NumericLiteral",symbols:[Ze.has("decimal")?{type:"decimal"}:decimal],postprocess:function(e){return Qe.decimal(e[0].value)}},{name:"NumericLiteral",symbols:[Ze.has("hexadecimal")?{type:"hexadecimal"}:hexadecimal],postprocess:function(e){return Qe.hexadecimal(e[0].value)}},{name:"NumericLiteral",symbols:[Ze.has("octal")?{type:"octal"}:octal],postprocess:function(e){return Qe.octal(e[0].value)}},{name:"NumericLiteral",symbols:[Ze.has("measurement")?{type:"measurement"}:measurement],postprocess:function(e){var t=function(e){var t=e.match(/(-?[0-9.]+)([a-zA-Z]+)/);if(null==t)throw Error("Malformed measurement : "+e);return{value:t[1],unit:t[2]}}(e[0].value);return Qe.measurement(t.unit,t.value)}},{name:"_",symbols:[]},{name:"_",symbols:[Ze.has("whitespace")?{type:"whitespace"}:whitespace],postprocess:Ke},{name:"Comment",symbols:[Ze.has("lineComment")?{type:"lineComment"}:lineComment],postprocess:Ke},{name:"EOL",symbols:[{literal:"\n"}],postprocess:Ke}],ParserStart:"GramSeq"},Xe=function(e,t){var n,r,o=new pe.Parser(pe.Grammar.fromCompiled(We));try{var i=o.feed(e);if(void 0===i.results[0]&&i.lexerState){var s={line:(r=i.lexerState).line,column:r.col};t.fail("Incomplete parse.",s)}return i.results.length>1&&t.info("[WARN] parsing is ambiguous"),i.results[0]||{type:"error"}}catch(e){var a=e.token?{line:(n=e.token).line,column:n.col}:{line:0,column:0};t.fail(e.message,a)}},et=function(){this.Parser=Xe},tt=function e(t){return void 0===t.children||0===t.children.length?t:e(t.children[0])},nt=function e(t){return void 0===t.children||0===t.children.length?t:e(t.children[t.children.length-1])},rt=function e(t){if(ve(t))return[t];if((n=t).type&&"seq"===n.type)return e(t.children);var n;if(Array.isArray(t)){var r=t.map(e).flat().reduce((function(e,t){return t.id&&(e.has(t.id)?e.set(t.id,Object.assign(e.get(t.id),t)):e.set(t.id,t)),e}),new Map);return Array.from(r.values())}return e(t.children)},ot="__missing_id__",it=function(e,t,n){return{id:e||ot,labels:t||[],record:n||{}}},st=function(e,t,n,r,o){return{id:n||ot,labels:r||[],record:o||{},source:e,target:t}},at=function(e){var t=function(e){return ne().use(et).freeze().parse(e)}(e);return{nodes:rt(t).map(lt),links:t.children.reduce((function(e,t){return e.concat(function e(t){return void 0===t||void 0===t.children||0===t.children.length?[]:2===t.children.length?[].concat(e(t.children[0]),void 0!==t.kind&&"pair"!==t.kind?[Oe([nt(t.children[0]),tt(t.children[1])],t.kind,t.id,t.labels,t.record)]:[],e(t.children[1])):t.children.reduce((function(t,n){return[].concat(t,e(n))}),[])}(t).map(ut))}),[]),paths:[]}},lt=function(e){return ve(e)?it(e.id,e.labels,e.record):it("random")},ut=function(e){return st(function(e){return"left"===e.kind?e.children[1].id||ot:e.children[0].id||ot}(e),function(e){return"left"===e.kind?e.children[0].id||ot:e.children[1].id||ot}(e),e.id,e.labels,e.record)};e.MISSING_ID=ot,e.d3Gram=at,e.default=at,e.edgeToD3=ut,e.isGramNodeDatum=function(e){return void 0!==e.id},e.makeGramLinkDatum=st,e.makeGramNodeDatum=it,e.nodeToD3=lt,Object.defineProperty(e,"__esModule",{value:!0})})); | ||
//# sourceMappingURL=d3-gram.umd.production.min.js.map |
@@ -15,3 +15,3 @@ { | ||
}, | ||
"version": "0.1.16", | ||
"version": "0.1.17", | ||
"author": "Andreas Kollegger", | ||
@@ -68,2 +68,3 @@ "license": "MIT", | ||
"rollup-plugin-node-builtins": "^2.1.2", | ||
"rollup-plugin-node-globals": "^1.4.0", | ||
"serve": "^11.3.2", | ||
@@ -70,0 +71,0 @@ "shx": "^0.3.3", |
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Minified code
QualityThis package contains minified code. This may be harmless in some cases where minified code is included in packaged libraries, however packages on npm should not minify code.
Found 1 instance in 1 package
627208
4208
2
18
1