@likec4/mcp 1.57.0 → 1.59.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/chunks/libs/@chevrotain/cst-dts-gen.mjs +1 -0
- package/dist/chunks/libs/@chevrotain/regexp-to-ast.mjs +1 -1
- package/dist/chunks/libs/@hono/mcp.mjs +6 -6
- package/dist/chunks/libs/@hono/node-server.mjs +3 -1
- package/dist/chunks/libs/@logtape/logtape.mjs +4 -3
- package/dist/chunks/libs/@modelcontextprotocol/sdk.mjs +4 -11
- package/dist/chunks/libs/@ts-graphviz/core.mjs +1 -1
- package/dist/chunks/libs/chevrotain-allstar.mjs +2 -2
- package/dist/chunks/libs/chevrotain.mjs +33 -33
- package/dist/chunks/libs/chokidar.mjs +2 -2
- package/dist/chunks/libs/chroma-js.mjs +2 -2
- package/dist/chunks/libs/eventemitter3.mjs +1 -1
- package/dist/chunks/libs/graphology-dag.mjs +1 -1
- package/dist/chunks/libs/graphology.mjs +1 -1
- package/dist/chunks/libs/hast-util-sanitize.mjs +1 -1
- package/dist/chunks/libs/hast-util-to-html.mjs +2 -2
- package/dist/chunks/libs/hono.mjs +1 -1
- package/dist/chunks/libs/immer.mjs +1 -1
- package/dist/chunks/libs/langium.mjs +9 -22
- package/dist/chunks/libs/markdown-table.mjs +1 -1
- package/dist/chunks/libs/mdast-util-find-and-replace.mjs +1 -1
- package/dist/chunks/libs/mdast-util-from-markdown.mjs +2 -2
- package/dist/chunks/libs/mdast-util-gfm.mjs +5 -5
- package/dist/chunks/libs/mdast-util-to-hast.mjs +2 -2
- package/dist/chunks/libs/merge-error-cause.mjs +2 -2
- package/dist/chunks/libs/micromark-extension-gfm.mjs +1 -1
- package/dist/chunks/libs/mnemonist.mjs +1 -1
- package/dist/chunks/libs/nano-spawn.mjs +2 -2
- package/dist/chunks/libs/p-queue.mjs +1 -1
- package/dist/chunks/libs/picomatch.mjs +1 -0
- package/dist/chunks/libs/pretty-ms.mjs +1 -1
- package/dist/chunks/libs/remark-github-blockquote-alert.mjs +1 -1
- package/dist/chunks/libs/remeda.mjs +1 -1
- package/dist/chunks/libs/ufo.mjs +1 -1
- package/dist/chunks/libs/unified.mjs +1 -1
- package/dist/chunks/libs/unstorage.mjs +1 -1
- package/dist/chunks/rolldown-runtime.mjs +1 -1
- package/dist/chunks/src.mjs +124 -104
- package/dist/cli.mjs +5 -1
- package/package.json +23 -23
- package/dist/chunks/libs/@chevrotain/gast.mjs +0 -1
- package/dist/chunks/libs/@chevrotain/utils.mjs +0 -1
- package/dist/chunks/libs/@lume/kiwi.mjs +0 -1
- package/dist/chunks/libs/bail.mjs +0 -1
- package/dist/chunks/libs/ccount.mjs +0 -1
- package/dist/chunks/libs/character-entities-html4.mjs +0 -1
- package/dist/chunks/libs/character-entities-legacy.mjs +0 -1
- package/dist/chunks/libs/citty.mjs +0 -5
- package/dist/chunks/libs/comma-separated-tokens.mjs +0 -1
- package/dist/chunks/libs/decode-named-character-reference.mjs +0 -1
- package/dist/chunks/libs/defu.mjs +0 -1
- package/dist/chunks/libs/destr.mjs +0 -1
- package/dist/chunks/libs/devlop.mjs +0 -1
- package/dist/chunks/libs/escape-string-regexp.mjs +0 -1
- package/dist/chunks/libs/extend.mjs +0 -1
- package/dist/chunks/libs/fdir.mjs +0 -1
- package/dist/chunks/libs/is-error-instance.mjs +0 -1
- package/dist/chunks/libs/is-plain-obj.mjs +0 -1
- package/dist/chunks/libs/isexe.mjs +0 -1
- package/dist/chunks/libs/json5.mjs +0 -14
- package/dist/chunks/libs/longest-streak.mjs +0 -1
- package/dist/chunks/libs/natural-compare-lite.mjs +0 -9
- package/dist/chunks/libs/ohash.mjs +0 -1
- package/dist/chunks/libs/p-limit.mjs +0 -1
- package/dist/chunks/libs/p-timeout.mjs +0 -1
- package/dist/chunks/libs/parse-ms.mjs +0 -1
- package/dist/chunks/libs/rehype-sanitize.mjs +0 -1
- package/dist/chunks/libs/rehype-stringify.mjs +0 -1
- package/dist/chunks/libs/remark-gfm.mjs +0 -1
- package/dist/chunks/libs/remark-parse.mjs +0 -1
- package/dist/chunks/libs/safe-stringify.mjs +0 -1
- package/dist/chunks/libs/strip-indent.mjs +0 -1
- package/dist/chunks/libs/tinyrainbow.mjs +0 -1
- package/dist/chunks/libs/trough.mjs +0 -1
- package/dist/chunks/libs/ts-graphviz.mjs +0 -1
- package/dist/chunks/libs/unctx.mjs +0 -1
- package/dist/chunks/libs/which.mjs +0 -1
- package/dist/chunks/libs/word-wrap.mjs +0 -12
|
@@ -1 +1 @@
|
|
|
1
|
-
import"../rolldown-runtime.mjs";import{EventEmitter as e}from"node:events";function assignPolyfill(){let e=arguments[0];for(let t=1,n=arguments.length;t<n;t++)if(arguments[t])for(let n in arguments[t])e[n]=arguments[t][n];return e}let t=assignPolyfill;typeof Object.assign==`function`&&(t=Object.assign);function getMatchingEdge(e,t,n,r){let i=e._nodes.get(t),a=null;return i&&(a=r===`mixed`?i.out&&i.out[n]||i.undirected&&i.undirected[n]:r===`directed`?i.out&&i.out[n]:i.undirected&&i.undirected[n]),a}function isPlainObject(e){return typeof e==`object`&&!!e}function isEmpty(e){let t;for(t in e)return!1;return!0}function privateProperty(e,t,n){Object.defineProperty(e,t,{enumerable:!1,configurable:!1,writable:!0,value:n})}function readOnlyProperty(e,t,n){let r={enumerable:!0,configurable:!0};typeof n==`function`?r.get=n:(r.value=n,r.writable=!1),Object.defineProperty(e,t,r)}function validateHints(e){return!(!isPlainObject(e)||e.attributes&&!Array.isArray(e.attributes))}function incrementalIdStartingFromRandomByte(){let e=Math.floor(Math.random()*256)&255;return()=>e++}function chain(){let e=arguments,t=null,n=-1;return{[Symbol.iterator](){return this},next(){let r=null;do{if(t===null){if(n++,n>=e.length)return{done:!0};t=e[n][Symbol.iterator]()}if(r=t.next(),r.done){t=null;continue}break}while(!0);return r}}}function emptyIterator(){return{[Symbol.iterator](){return this},next(){return{done:!0}}}}var GraphError=class extends Error{constructor(e){super(),this.name=`GraphError`,this.message=e}},n=class InvalidArgumentsGraphError extends GraphError{constructor(e){super(e),this.name=`InvalidArgumentsGraphError`,typeof Error.captureStackTrace==`function`&&Error.captureStackTrace(this,InvalidArgumentsGraphError.prototype.constructor)}},r=class NotFoundGraphError extends GraphError{constructor(e){super(e),this.name=`NotFoundGraphError`,typeof Error.captureStackTrace==`function`&&Error.captureStackTrace(this,NotFoundGraphError.prototype.constructor)}},i=class UsageGraphError extends GraphError{constructor(e){super(e),this.name=`UsageGraphError`,typeof Error.captureStackTrace==`function`&&Error.captureStackTrace(this,UsageGraphError.prototype.constructor)}};function MixedNodeData(e,t){this.key=e,this.attributes=t,this.clear()}MixedNodeData.prototype.clear=function(){this.inDegree=0,this.outDegree=0,this.undirectedDegree=0,this.undirectedLoops=0,this.directedLoops=0,this.in={},this.out={},this.undirected={}};function DirectedNodeData(e,t){this.key=e,this.attributes=t,this.clear()}DirectedNodeData.prototype.clear=function(){this.inDegree=0,this.outDegree=0,this.directedLoops=0,this.in={},this.out={}};function UndirectedNodeData(e,t){this.key=e,this.attributes=t,this.clear()}UndirectedNodeData.prototype.clear=function(){this.undirectedDegree=0,this.undirectedLoops=0,this.undirected={}};function EdgeData(e,t,n,r,i){this.key=t,this.attributes=i,this.undirected=e,this.source=n,this.target=r}EdgeData.prototype.attach=function(){let e=`out`,t=`in`;this.undirected&&(e=t=`undirected`);let n=this.source.key,r=this.target.key;this.source[e][r]=this,!(this.undirected&&n===r)&&(this.target[t][n]=this)},EdgeData.prototype.attachMulti=function(){let e=`out`,t=`in`,n=this.source.key,r=this.target.key;this.undirected&&(e=t=`undirected`);let i=this.source[e],a=i[r];if(a===void 0){i[r]=this,this.undirected&&n===r||(this.target[t][n]=this);return}a.previous=this,this.next=a,i[r]=this,this.target[t][n]=this},EdgeData.prototype.detach=function(){let e=this.source.key,t=this.target.key,n=`out`,r=`in`;this.undirected&&(n=r=`undirected`),delete this.source[n][t],delete this.target[r][e]},EdgeData.prototype.detachMulti=function(){let e=this.source.key,t=this.target.key,n=`out`,r=`in`;this.undirected&&(n=r=`undirected`),this.previous===void 0?this.next===void 0?(delete this.source[n][t],delete this.target[r][e]):(this.next.previous=void 0,this.source[n][t]=this.next,this.target[r][e]=this.next):(this.previous.next=this.next,this.next!==void 0&&(this.next.previous=this.previous))};function findRelevantNodeData(e,t,n,i,a,o,s){let c,l,u,d;if(i=``+i,n===0){if(c=e._nodes.get(i),!c)throw new r(`Graph.${t}: could not find the "${i}" node in the graph.`);u=a,d=o}else if(n===3){if(a=``+a,l=e._edges.get(a),!l)throw new r(`Graph.${t}: could not find the "${a}" edge in the graph.`);let n=l.source.key,f=l.target.key;if(i===n)c=l.target;else if(i===f)c=l.source;else throw new r(`Graph.${t}: the "${i}" node is not attached to the "${a}" edge (${n}, ${f}).`);u=o,d=s}else{if(l=e._edges.get(i),!l)throw new r(`Graph.${t}: could not find the "${i}" edge in the graph.`);c=n===1?l.source:l.target,u=a,d=o}return[c,u,d]}function attachNodeAttributeGetter(e,t,n){e.prototype[t]=function(e,r,i){let[a,o]=findRelevantNodeData(this,t,n,e,r,i);return a.attributes[o]}}function attachNodeAttributesGetter(e,t,n){e.prototype[t]=function(e,r){let[i]=findRelevantNodeData(this,t,n,e,r);return i.attributes}}function attachNodeAttributeChecker(e,t,n){e.prototype[t]=function(e,r,i){let[a,o]=findRelevantNodeData(this,t,n,e,r,i);return a.attributes.hasOwnProperty(o)}}function attachNodeAttributeSetter(e,t,n){e.prototype[t]=function(e,r,i,a){let[o,s,c]=findRelevantNodeData(this,t,n,e,r,i,a);return o.attributes[s]=c,this.emit(`nodeAttributesUpdated`,{key:o.key,type:`set`,attributes:o.attributes,name:s}),this}}function attachNodeAttributeUpdater(e,t,r){e.prototype[t]=function(e,i,a,o){let[s,c,l]=findRelevantNodeData(this,t,r,e,i,a,o);if(typeof l!=`function`)throw new n(`Graph.${t}: updater should be a function.`);let u=s.attributes;return u[c]=l(u[c]),this.emit(`nodeAttributesUpdated`,{key:s.key,type:`set`,attributes:s.attributes,name:c}),this}}function attachNodeAttributeRemover(e,t,n){e.prototype[t]=function(e,r,i){let[a,o]=findRelevantNodeData(this,t,n,e,r,i);return delete a.attributes[o],this.emit(`nodeAttributesUpdated`,{key:a.key,type:`remove`,attributes:a.attributes,name:o}),this}}function attachNodeAttributesReplacer(e,t,r){e.prototype[t]=function(e,i,a){let[o,s]=findRelevantNodeData(this,t,r,e,i,a);if(!isPlainObject(s))throw new n(`Graph.${t}: provided attributes are not a plain object.`);return o.attributes=s,this.emit(`nodeAttributesUpdated`,{key:o.key,type:`replace`,attributes:o.attributes}),this}}function attachNodeAttributesMerger(e,r,i){e.prototype[r]=function(e,a,o){let[s,c]=findRelevantNodeData(this,r,i,e,a,o);if(!isPlainObject(c))throw new n(`Graph.${r}: provided attributes are not a plain object.`);return t(s.attributes,c),this.emit(`nodeAttributesUpdated`,{key:s.key,type:`merge`,attributes:s.attributes,data:c}),this}}function attachNodeAttributesUpdater(e,t,r){e.prototype[t]=function(e,i,a){let[o,s]=findRelevantNodeData(this,t,r,e,i,a);if(typeof s!=`function`)throw new n(`Graph.${t}: provided updater is not a function.`);return o.attributes=s(o.attributes),this.emit(`nodeAttributesUpdated`,{key:o.key,type:`update`,attributes:o.attributes}),this}}const a=[{name:e=>`get${e}Attribute`,attacher:attachNodeAttributeGetter},{name:e=>`get${e}Attributes`,attacher:attachNodeAttributesGetter},{name:e=>`has${e}Attribute`,attacher:attachNodeAttributeChecker},{name:e=>`set${e}Attribute`,attacher:attachNodeAttributeSetter},{name:e=>`update${e}Attribute`,attacher:attachNodeAttributeUpdater},{name:e=>`remove${e}Attribute`,attacher:attachNodeAttributeRemover},{name:e=>`replace${e}Attributes`,attacher:attachNodeAttributesReplacer},{name:e=>`merge${e}Attributes`,attacher:attachNodeAttributesMerger},{name:e=>`update${e}Attributes`,attacher:attachNodeAttributesUpdater}];function attachNodeAttributesMethods(e){a.forEach(function({name:t,attacher:n}){n(e,t(`Node`),0),n(e,t(`Source`),1),n(e,t(`Target`),2),n(e,t(`Opposite`),3)})}function attachEdgeAttributeGetter(e,t,n){e.prototype[t]=function(e,a){let o;if(this.type!==`mixed`&&n!==`mixed`&&n!==this.type)throw new i(`Graph.${t}: cannot find this type of edges in your ${this.type} graph.`);if(arguments.length>2){if(this.multi)throw new i(`Graph.${t}: cannot use a {source,target} combo when asking about an edge's attributes in a MultiGraph since we cannot infer the one you want information about.`);let s=``+e,c=``+a;if(a=arguments[2],o=getMatchingEdge(this,s,c,n),!o)throw new r(`Graph.${t}: could not find an edge for the given path ("${s}" - "${c}").`)}else{if(n!==`mixed`)throw new i(`Graph.${t}: calling this method with only a key (vs. a source and target) does not make sense since an edge with this key could have the other type.`);if(e=``+e,o=this._edges.get(e),!o)throw new r(`Graph.${t}: could not find the "${e}" edge in the graph.`)}return o.attributes[a]}}function attachEdgeAttributesGetter(e,t,n){e.prototype[t]=function(e){let a;if(this.type!==`mixed`&&n!==`mixed`&&n!==this.type)throw new i(`Graph.${t}: cannot find this type of edges in your ${this.type} graph.`);if(arguments.length>1){if(this.multi)throw new i(`Graph.${t}: cannot use a {source,target} combo when asking about an edge's attributes in a MultiGraph since we cannot infer the one you want information about.`);let o=``+e,s=``+arguments[1];if(a=getMatchingEdge(this,o,s,n),!a)throw new r(`Graph.${t}: could not find an edge for the given path ("${o}" - "${s}").`)}else{if(n!==`mixed`)throw new i(`Graph.${t}: calling this method with only a key (vs. a source and target) does not make sense since an edge with this key could have the other type.`);if(e=``+e,a=this._edges.get(e),!a)throw new r(`Graph.${t}: could not find the "${e}" edge in the graph.`)}return a.attributes}}function attachEdgeAttributeChecker(e,t,n){e.prototype[t]=function(e,a){let o;if(this.type!==`mixed`&&n!==`mixed`&&n!==this.type)throw new i(`Graph.${t}: cannot find this type of edges in your ${this.type} graph.`);if(arguments.length>2){if(this.multi)throw new i(`Graph.${t}: cannot use a {source,target} combo when asking about an edge's attributes in a MultiGraph since we cannot infer the one you want information about.`);let s=``+e,c=``+a;if(a=arguments[2],o=getMatchingEdge(this,s,c,n),!o)throw new r(`Graph.${t}: could not find an edge for the given path ("${s}" - "${c}").`)}else{if(n!==`mixed`)throw new i(`Graph.${t}: calling this method with only a key (vs. a source and target) does not make sense since an edge with this key could have the other type.`);if(e=``+e,o=this._edges.get(e),!o)throw new r(`Graph.${t}: could not find the "${e}" edge in the graph.`)}return o.attributes.hasOwnProperty(a)}}function attachEdgeAttributeSetter(e,t,n){e.prototype[t]=function(e,a,o){let s;if(this.type!==`mixed`&&n!==`mixed`&&n!==this.type)throw new i(`Graph.${t}: cannot find this type of edges in your ${this.type} graph.`);if(arguments.length>3){if(this.multi)throw new i(`Graph.${t}: cannot use a {source,target} combo when asking about an edge's attributes in a MultiGraph since we cannot infer the one you want information about.`);let c=``+e,l=``+a;if(a=arguments[2],o=arguments[3],s=getMatchingEdge(this,c,l,n),!s)throw new r(`Graph.${t}: could not find an edge for the given path ("${c}" - "${l}").`)}else{if(n!==`mixed`)throw new i(`Graph.${t}: calling this method with only a key (vs. a source and target) does not make sense since an edge with this key could have the other type.`);if(e=``+e,s=this._edges.get(e),!s)throw new r(`Graph.${t}: could not find the "${e}" edge in the graph.`)}return s.attributes[a]=o,this.emit(`edgeAttributesUpdated`,{key:s.key,type:`set`,attributes:s.attributes,name:a}),this}}function attachEdgeAttributeUpdater(e,t,a){e.prototype[t]=function(e,o,s){let c;if(this.type!==`mixed`&&a!==`mixed`&&a!==this.type)throw new i(`Graph.${t}: cannot find this type of edges in your ${this.type} graph.`);if(arguments.length>3){if(this.multi)throw new i(`Graph.${t}: cannot use a {source,target} combo when asking about an edge's attributes in a MultiGraph since we cannot infer the one you want information about.`);let n=``+e,l=``+o;if(o=arguments[2],s=arguments[3],c=getMatchingEdge(this,n,l,a),!c)throw new r(`Graph.${t}: could not find an edge for the given path ("${n}" - "${l}").`)}else{if(a!==`mixed`)throw new i(`Graph.${t}: calling this method with only a key (vs. a source and target) does not make sense since an edge with this key could have the other type.`);if(e=``+e,c=this._edges.get(e),!c)throw new r(`Graph.${t}: could not find the "${e}" edge in the graph.`)}if(typeof s!=`function`)throw new n(`Graph.${t}: updater should be a function.`);return c.attributes[o]=s(c.attributes[o]),this.emit(`edgeAttributesUpdated`,{key:c.key,type:`set`,attributes:c.attributes,name:o}),this}}function attachEdgeAttributeRemover(e,t,n){e.prototype[t]=function(e,a){let o;if(this.type!==`mixed`&&n!==`mixed`&&n!==this.type)throw new i(`Graph.${t}: cannot find this type of edges in your ${this.type} graph.`);if(arguments.length>2){if(this.multi)throw new i(`Graph.${t}: cannot use a {source,target} combo when asking about an edge's attributes in a MultiGraph since we cannot infer the one you want information about.`);let s=``+e,c=``+a;if(a=arguments[2],o=getMatchingEdge(this,s,c,n),!o)throw new r(`Graph.${t}: could not find an edge for the given path ("${s}" - "${c}").`)}else{if(n!==`mixed`)throw new i(`Graph.${t}: calling this method with only a key (vs. a source and target) does not make sense since an edge with this key could have the other type.`);if(e=``+e,o=this._edges.get(e),!o)throw new r(`Graph.${t}: could not find the "${e}" edge in the graph.`)}return delete o.attributes[a],this.emit(`edgeAttributesUpdated`,{key:o.key,type:`remove`,attributes:o.attributes,name:a}),this}}function attachEdgeAttributesReplacer(e,t,a){e.prototype[t]=function(e,o){let s;if(this.type!==`mixed`&&a!==`mixed`&&a!==this.type)throw new i(`Graph.${t}: cannot find this type of edges in your ${this.type} graph.`);if(arguments.length>2){if(this.multi)throw new i(`Graph.${t}: cannot use a {source,target} combo when asking about an edge's attributes in a MultiGraph since we cannot infer the one you want information about.`);let n=``+e,c=``+o;if(o=arguments[2],s=getMatchingEdge(this,n,c,a),!s)throw new r(`Graph.${t}: could not find an edge for the given path ("${n}" - "${c}").`)}else{if(a!==`mixed`)throw new i(`Graph.${t}: calling this method with only a key (vs. a source and target) does not make sense since an edge with this key could have the other type.`);if(e=``+e,s=this._edges.get(e),!s)throw new r(`Graph.${t}: could not find the "${e}" edge in the graph.`)}if(!isPlainObject(o))throw new n(`Graph.${t}: provided attributes are not a plain object.`);return s.attributes=o,this.emit(`edgeAttributesUpdated`,{key:s.key,type:`replace`,attributes:s.attributes}),this}}function attachEdgeAttributesMerger(e,a,o){e.prototype[a]=function(e,s){let c;if(this.type!==`mixed`&&o!==`mixed`&&o!==this.type)throw new i(`Graph.${a}: cannot find this type of edges in your ${this.type} graph.`);if(arguments.length>2){if(this.multi)throw new i(`Graph.${a}: cannot use a {source,target} combo when asking about an edge's attributes in a MultiGraph since we cannot infer the one you want information about.`);let t=``+e,n=``+s;if(s=arguments[2],c=getMatchingEdge(this,t,n,o),!c)throw new r(`Graph.${a}: could not find an edge for the given path ("${t}" - "${n}").`)}else{if(o!==`mixed`)throw new i(`Graph.${a}: calling this method with only a key (vs. a source and target) does not make sense since an edge with this key could have the other type.`);if(e=``+e,c=this._edges.get(e),!c)throw new r(`Graph.${a}: could not find the "${e}" edge in the graph.`)}if(!isPlainObject(s))throw new n(`Graph.${a}: provided attributes are not a plain object.`);return t(c.attributes,s),this.emit(`edgeAttributesUpdated`,{key:c.key,type:`merge`,attributes:c.attributes,data:s}),this}}function attachEdgeAttributesUpdater(e,t,a){e.prototype[t]=function(e,o){let s;if(this.type!==`mixed`&&a!==`mixed`&&a!==this.type)throw new i(`Graph.${t}: cannot find this type of edges in your ${this.type} graph.`);if(arguments.length>2){if(this.multi)throw new i(`Graph.${t}: cannot use a {source,target} combo when asking about an edge's attributes in a MultiGraph since we cannot infer the one you want information about.`);let n=``+e,c=``+o;if(o=arguments[2],s=getMatchingEdge(this,n,c,a),!s)throw new r(`Graph.${t}: could not find an edge for the given path ("${n}" - "${c}").`)}else{if(a!==`mixed`)throw new i(`Graph.${t}: calling this method with only a key (vs. a source and target) does not make sense since an edge with this key could have the other type.`);if(e=``+e,s=this._edges.get(e),!s)throw new r(`Graph.${t}: could not find the "${e}" edge in the graph.`)}if(typeof o!=`function`)throw new n(`Graph.${t}: provided updater is not a function.`);return s.attributes=o(s.attributes),this.emit(`edgeAttributesUpdated`,{key:s.key,type:`update`,attributes:s.attributes}),this}}const o=[{name:e=>`get${e}Attribute`,attacher:attachEdgeAttributeGetter},{name:e=>`get${e}Attributes`,attacher:attachEdgeAttributesGetter},{name:e=>`has${e}Attribute`,attacher:attachEdgeAttributeChecker},{name:e=>`set${e}Attribute`,attacher:attachEdgeAttributeSetter},{name:e=>`update${e}Attribute`,attacher:attachEdgeAttributeUpdater},{name:e=>`remove${e}Attribute`,attacher:attachEdgeAttributeRemover},{name:e=>`replace${e}Attributes`,attacher:attachEdgeAttributesReplacer},{name:e=>`merge${e}Attributes`,attacher:attachEdgeAttributesMerger},{name:e=>`update${e}Attributes`,attacher:attachEdgeAttributesUpdater}];function attachEdgeAttributesMethods(e){o.forEach(function({name:t,attacher:n}){n(e,t(`Edge`),`mixed`),n(e,t(`DirectedEdge`),`directed`),n(e,t(`UndirectedEdge`),`undirected`)})}const s=[{name:`edges`,type:`mixed`},{name:`inEdges`,type:`directed`,direction:`in`},{name:`outEdges`,type:`directed`,direction:`out`},{name:`inboundEdges`,type:`mixed`,direction:`in`},{name:`outboundEdges`,type:`mixed`,direction:`out`},{name:`directedEdges`,type:`directed`},{name:`undirectedEdges`,type:`undirected`}];function forEachSimple(e,t,n,r){let i=!1;for(let a in t){if(a===r)continue;let o=t[a];if(i=n(o.key,o.attributes,o.source.key,o.target.key,o.source.attributes,o.target.attributes,o.undirected),e&&i)return o.key}}function forEachMulti(e,t,n,r){let i,a,o,s=!1;for(let c in t)if(c!==r){i=t[c];do{if(a=i.source,o=i.target,s=n(i.key,i.attributes,a.key,o.key,a.attributes,o.attributes,i.undirected),e&&s)return i.key;i=i.next}while(i!==void 0)}}function createIterator(e,t){let n=Object.keys(e),r=n.length,i,a=0;return{[Symbol.iterator](){return this},next(){do if(i)i=i.next;else{if(a>=r)return{done:!0};let o=n[a++];if(o===t){i=void 0;continue}i=e[o]}while(!i);return{done:!1,value:{edge:i.key,attributes:i.attributes,source:i.source.key,target:i.target.key,sourceAttributes:i.source.attributes,targetAttributes:i.target.attributes,undirected:i.undirected}}}}}function forEachForKeySimple(e,t,n,r){let i=t[n];if(!i)return;let a=i.source,o=i.target;if(r(i.key,i.attributes,a.key,o.key,a.attributes,o.attributes,i.undirected)&&e)return i.key}function forEachForKeyMulti(e,t,n,r){let i=t[n];if(!i)return;let a=!1;do{if(a=r(i.key,i.attributes,i.source.key,i.target.key,i.source.attributes,i.target.attributes,i.undirected),e&&a)return i.key;i=i.next}while(i!==void 0)}function createIteratorForKey(e,t){let n=e[t];if(n.next!==void 0)return{[Symbol.iterator](){return this},next(){if(!n)return{done:!0};let e={edge:n.key,attributes:n.attributes,source:n.source.key,target:n.target.key,sourceAttributes:n.source.attributes,targetAttributes:n.target.attributes,undirected:n.undirected};return n=n.next,{done:!1,value:e}}};let r=!1;return{[Symbol.iterator](){return this},next(){return r===!0?{done:!0}:(r=!0,{done:!1,value:{edge:n.key,attributes:n.attributes,source:n.source.key,target:n.target.key,sourceAttributes:n.source.attributes,targetAttributes:n.target.attributes,undirected:n.undirected}})}}}function createEdgeArray(e,t){if(e.size===0)return[];if(t===`mixed`||t===e.type)return Array.from(e._edges.keys());let n=t===`undirected`?e.undirectedSize:e.directedSize,r=Array(n),i=t===`undirected`,a=e._edges.values(),o=0,s,c;for(;s=a.next(),s.done!==!0;)c=s.value,c.undirected===i&&(r[o++]=c.key);return r}function forEachEdge(e,t,n,r){if(t.size===0)return;let i=n!==`mixed`&&n!==t.type,a=n===`undirected`,o,s,c=!1,l=t._edges.values();for(;o=l.next(),o.done!==!0;){if(s=o.value,i&&s.undirected!==a)continue;let{key:t,attributes:n,source:l,target:u}=s;if(c=r(t,n,l.key,u.key,l.attributes,u.attributes,s.undirected),e&&c)return t}}function createEdgeIterator(e,t){if(e.size===0)return emptyIterator();let n=t!==`mixed`&&t!==e.type,r=t===`undirected`,i=e._edges.values();return{[Symbol.iterator](){return this},next(){let e,t;for(;;){if(e=i.next(),e.done)return e;if(t=e.value,!(n&&t.undirected!==r))break}return{value:{edge:t.key,attributes:t.attributes,source:t.source.key,target:t.target.key,sourceAttributes:t.source.attributes,targetAttributes:t.target.attributes,undirected:t.undirected},done:!1}}}}function forEachEdgeForNode(e,t,n,r,i,a){let o=t?forEachMulti:forEachSimple,s;if(n!==`undirected`&&(r!==`out`&&(s=o(e,i.in,a),e&&s)||r!==`in`&&(s=o(e,i.out,a,r?void 0:i.key),e&&s))||n!==`directed`&&(s=o(e,i.undirected,a),e&&s))return s}function createEdgeArrayForNode(e,t,n,r){let i=[];return forEachEdgeForNode(!1,e,t,n,r,function(e){i.push(e)}),i}function createEdgeIteratorForNode(e,t,n){let r=emptyIterator();return e!==`undirected`&&(t!==`out`&&n.in!==void 0&&(r=chain(r,createIterator(n.in))),t!==`in`&&n.out!==void 0&&(r=chain(r,createIterator(n.out,t?void 0:n.key)))),e!==`directed`&&n.undirected!==void 0&&(r=chain(r,createIterator(n.undirected))),r}function forEachEdgeForPath(e,t,n,r,i,a,o){let s=n?forEachForKeyMulti:forEachForKeySimple,c;if(t!==`undirected`&&(i.in!==void 0&&r!==`out`&&(c=s(e,i.in,a,o),e&&c)||i.out!==void 0&&r!==`in`&&(r||i.key!==a)&&(c=s(e,i.out,a,o),e&&c))||t!==`directed`&&i.undirected!==void 0&&(c=s(e,i.undirected,a,o),e&&c))return c}function createEdgeArrayForPath(e,t,n,r,i){let a=[];return forEachEdgeForPath(!1,e,t,n,r,i,function(e){a.push(e)}),a}function createEdgeIteratorForPath(e,t,n,r){let i=emptyIterator();return e!==`undirected`&&(n.in!==void 0&&t!==`out`&&r in n.in&&(i=chain(i,createIteratorForKey(n.in,r))),n.out!==void 0&&t!==`in`&&r in n.out&&(t||n.key!==r)&&(i=chain(i,createIteratorForKey(n.out,r)))),e!==`directed`&&n.undirected!==void 0&&r in n.undirected&&(i=chain(i,createIteratorForKey(n.undirected,r))),i}function attachEdgeArrayCreator(e,t){let{name:i,type:a,direction:o}=t;e.prototype[i]=function(e,t){if(a!==`mixed`&&this.type!==`mixed`&&a!==this.type)return[];if(!arguments.length)return createEdgeArray(this,a);if(arguments.length===1){e=``+e;let t=this._nodes.get(e);if(t===void 0)throw new r(`Graph.${i}: could not find the "${e}" node in the graph.`);return createEdgeArrayForNode(this.multi,a===`mixed`?this.type:a,o,t)}if(arguments.length===2){e=``+e,t=``+t;let n=this._nodes.get(e);if(!n)throw new r(`Graph.${i}: could not find the "${e}" source node in the graph.`);if(!this._nodes.has(t))throw new r(`Graph.${i}: could not find the "${t}" target node in the graph.`);return createEdgeArrayForPath(a,this.multi,o,n,t)}throw new n(`Graph.${i}: too many arguments (expecting 0, 1 or 2 and got ${arguments.length}).`)}}function attachForEachEdge(e,t){let{name:i,type:a,direction:o}=t,s=`forEach`+i[0].toUpperCase()+i.slice(1,-1);e.prototype[s]=function(e,t,i){if(!(a!==`mixed`&&this.type!==`mixed`&&a!==this.type)){if(arguments.length===1)return i=e,forEachEdge(!1,this,a,i);if(arguments.length===2){e=``+e,i=t;let n=this._nodes.get(e);if(n===void 0)throw new r(`Graph.${s}: could not find the "${e}" node in the graph.`);return forEachEdgeForNode(!1,this.multi,a===`mixed`?this.type:a,o,n,i)}if(arguments.length===3){e=``+e,t=``+t;let n=this._nodes.get(e);if(!n)throw new r(`Graph.${s}: could not find the "${e}" source node in the graph.`);if(!this._nodes.has(t))throw new r(`Graph.${s}: could not find the "${t}" target node in the graph.`);return forEachEdgeForPath(!1,a,this.multi,o,n,t,i)}throw new n(`Graph.${s}: too many arguments (expecting 1, 2 or 3 and got ${arguments.length}).`)}};let c=`map`+i[0].toUpperCase()+i.slice(1);e.prototype[c]=function(){let e=Array.prototype.slice.call(arguments),t=e.pop(),n;if(e.length===0){let r=0;a!==`directed`&&(r+=this.undirectedSize),a!==`undirected`&&(r+=this.directedSize),n=Array(r);let i=0;e.push((e,r,a,o,s,c,l)=>{n[i++]=t(e,r,a,o,s,c,l)})}else n=[],e.push((e,r,i,a,o,s,c)=>{n.push(t(e,r,i,a,o,s,c))});return this[s].apply(this,e),n};let l=`filter`+i[0].toUpperCase()+i.slice(1);e.prototype[l]=function(){let e=Array.prototype.slice.call(arguments),t=e.pop(),n=[];return e.push((e,r,i,a,o,s,c)=>{t(e,r,i,a,o,s,c)&&n.push(e)}),this[s].apply(this,e),n};let u=`reduce`+i[0].toUpperCase()+i.slice(1);e.prototype[u]=function(){let e=Array.prototype.slice.call(arguments);if(e.length<2||e.length>4)throw new n(`Graph.${u}: invalid number of arguments (expecting 2, 3 or 4 and got ${e.length}).`);if(typeof e[e.length-1]==`function`&&typeof e[e.length-2]!=`function`)throw new n(`Graph.${u}: missing initial value. You must provide it because the callback takes more than one argument and we cannot infer the initial value from the first iteration, as you could with a simple array.`);let t,r;e.length===2?(t=e[0],r=e[1],e=[]):e.length===3?(t=e[1],r=e[2],e=[e[0]]):e.length===4&&(t=e[2],r=e[3],e=[e[0],e[1]]);let i=r;return e.push((e,n,r,a,o,s,c)=>{i=t(i,e,n,r,a,o,s,c)}),this[s].apply(this,e),i}}function attachFindEdge(e,t){let{name:i,type:a,direction:o}=t,s=`find`+i[0].toUpperCase()+i.slice(1,-1);e.prototype[s]=function(e,t,i){if(a!==`mixed`&&this.type!==`mixed`&&a!==this.type)return!1;if(arguments.length===1)return i=e,forEachEdge(!0,this,a,i);if(arguments.length===2){e=``+e,i=t;let n=this._nodes.get(e);if(n===void 0)throw new r(`Graph.${s}: could not find the "${e}" node in the graph.`);return forEachEdgeForNode(!0,this.multi,a===`mixed`?this.type:a,o,n,i)}if(arguments.length===3){e=``+e,t=``+t;let n=this._nodes.get(e);if(!n)throw new r(`Graph.${s}: could not find the "${e}" source node in the graph.`);if(!this._nodes.has(t))throw new r(`Graph.${s}: could not find the "${t}" target node in the graph.`);return forEachEdgeForPath(!0,a,this.multi,o,n,t,i)}throw new n(`Graph.${s}: too many arguments (expecting 1, 2 or 3 and got ${arguments.length}).`)};let c=`some`+i[0].toUpperCase()+i.slice(1,-1);e.prototype[c]=function(){let e=Array.prototype.slice.call(arguments),t=e.pop();return e.push((e,n,r,i,a,o,s)=>t(e,n,r,i,a,o,s)),!!this[s].apply(this,e)};let l=`every`+i[0].toUpperCase()+i.slice(1,-1);e.prototype[l]=function(){let e=Array.prototype.slice.call(arguments),t=e.pop();return e.push((e,n,r,i,a,o,s)=>!t(e,n,r,i,a,o,s)),!this[s].apply(this,e)}}function attachEdgeIteratorCreator(e,t){let{name:i,type:a,direction:o}=t,s=i.slice(0,-1)+`Entries`;e.prototype[s]=function(e,t){if(a!==`mixed`&&this.type!==`mixed`&&a!==this.type)return emptyIterator();if(!arguments.length)return createEdgeIterator(this,a);if(arguments.length===1){e=``+e;let t=this._nodes.get(e);if(!t)throw new r(`Graph.${s}: could not find the "${e}" node in the graph.`);return createEdgeIteratorForNode(a,o,t)}if(arguments.length===2){e=``+e,t=``+t;let n=this._nodes.get(e);if(!n)throw new r(`Graph.${s}: could not find the "${e}" source node in the graph.`);if(!this._nodes.has(t))throw new r(`Graph.${s}: could not find the "${t}" target node in the graph.`);return createEdgeIteratorForPath(a,o,n,t)}throw new n(`Graph.${s}: too many arguments (expecting 0, 1 or 2 and got ${arguments.length}).`)}}function attachEdgeIterationMethods(e){s.forEach(t=>{attachEdgeArrayCreator(e,t),attachForEachEdge(e,t),attachFindEdge(e,t),attachEdgeIteratorCreator(e,t)})}const c=[{name:`neighbors`,type:`mixed`},{name:`inNeighbors`,type:`directed`,direction:`in`},{name:`outNeighbors`,type:`directed`,direction:`out`},{name:`inboundNeighbors`,type:`mixed`,direction:`in`},{name:`outboundNeighbors`,type:`mixed`,direction:`out`},{name:`directedNeighbors`,type:`directed`},{name:`undirectedNeighbors`,type:`undirected`}];function CompositeSetWrapper(){this.A=null,this.B=null}CompositeSetWrapper.prototype.wrap=function(e){this.A===null?this.A=e:this.B===null&&(this.B=e)},CompositeSetWrapper.prototype.has=function(e){return this.A!==null&&e in this.A||this.B!==null&&e in this.B};function forEachInObjectOnce(e,t,n,r,i){for(let a in r){let o=r[a],s=o.source,c=o.target,l=s===n?c:s;if(t&&t.has(l.key))continue;let u=i(l.key,l.attributes);if(e&&u)return l.key}}function forEachNeighbor(e,t,n,r,i){if(t!==`mixed`){if(t===`undirected`)return forEachInObjectOnce(e,null,r,r.undirected,i);if(typeof n==`string`)return forEachInObjectOnce(e,null,r,r[n],i)}let a=new CompositeSetWrapper,o;if(t!==`undirected`){if(n!==`out`){if(o=forEachInObjectOnce(e,null,r,r.in,i),e&&o)return o;a.wrap(r.in)}if(n!==`in`){if(o=forEachInObjectOnce(e,a,r,r.out,i),e&&o)return o;a.wrap(r.out)}}if(t!==`directed`&&(o=forEachInObjectOnce(e,a,r,r.undirected,i),e&&o))return o}function createNeighborArrayForNode(e,t,n){if(e!==`mixed`){if(e===`undirected`)return Object.keys(n.undirected);if(typeof t==`string`)return Object.keys(n[t])}let r=[];return forEachNeighbor(!1,e,t,n,function(e){r.push(e)}),r}function createDedupedObjectIterator(e,t,n){let r=Object.keys(n),i=r.length,a=0;return{[Symbol.iterator](){return this},next(){let o=null;do{if(a>=i)return e&&e.wrap(n),{done:!0};let s=n[r[a++]],c=s.source,l=s.target;if(o=c===t?l:c,e&&e.has(o.key)){o=null;continue}}while(o===null);return{done:!1,value:{neighbor:o.key,attributes:o.attributes}}}}}function createNeighborIterator(e,t,n){if(e!==`mixed`){if(e===`undirected`)return createDedupedObjectIterator(null,n,n.undirected);if(typeof t==`string`)return createDedupedObjectIterator(null,n,n[t])}let r=emptyIterator(),i=new CompositeSetWrapper;return e!==`undirected`&&(t!==`out`&&(r=chain(r,createDedupedObjectIterator(i,n,n.in))),t!==`in`&&(r=chain(r,createDedupedObjectIterator(i,n,n.out)))),e!==`directed`&&(r=chain(r,createDedupedObjectIterator(i,n,n.undirected))),r}function attachNeighborArrayCreator(e,t){let{name:n,type:i,direction:a}=t;e.prototype[n]=function(e){if(i!==`mixed`&&this.type!==`mixed`&&i!==this.type)return[];e=``+e;let t=this._nodes.get(e);if(t===void 0)throw new r(`Graph.${n}: could not find the "${e}" node in the graph.`);return createNeighborArrayForNode(i===`mixed`?this.type:i,a,t)}}function attachForEachNeighbor(e,t){let{name:i,type:a,direction:o}=t,s=`forEach`+i[0].toUpperCase()+i.slice(1,-1);e.prototype[s]=function(e,t){if(a!==`mixed`&&this.type!==`mixed`&&a!==this.type)return;e=``+e;let n=this._nodes.get(e);if(n===void 0)throw new r(`Graph.${s}: could not find the "${e}" node in the graph.`);forEachNeighbor(!1,a===`mixed`?this.type:a,o,n,t)};let c=`map`+i[0].toUpperCase()+i.slice(1);e.prototype[c]=function(e,t){let n=[];return this[s](e,(e,r)=>{n.push(t(e,r))}),n};let l=`filter`+i[0].toUpperCase()+i.slice(1);e.prototype[l]=function(e,t){let n=[];return this[s](e,(e,r)=>{t(e,r)&&n.push(e)}),n};let u=`reduce`+i[0].toUpperCase()+i.slice(1);e.prototype[u]=function(e,t,r){if(arguments.length<3)throw new n(`Graph.${u}: missing initial value. You must provide it because the callback takes more than one argument and we cannot infer the initial value from the first iteration, as you could with a simple array.`);let i=r;return this[s](e,(e,n)=>{i=t(i,e,n)}),i}}function attachFindNeighbor(e,t){let{name:n,type:i,direction:a}=t,o=n[0].toUpperCase()+n.slice(1,-1),s=`find`+o;e.prototype[s]=function(e,t){if(i!==`mixed`&&this.type!==`mixed`&&i!==this.type)return;e=``+e;let n=this._nodes.get(e);if(n===void 0)throw new r(`Graph.${s}: could not find the "${e}" node in the graph.`);return forEachNeighbor(!0,i===`mixed`?this.type:i,a,n,t)};let c=`some`+o;e.prototype[c]=function(e,t){return!!this[s](e,t)};let l=`every`+o;e.prototype[l]=function(e,t){return!this[s](e,(e,n)=>!t(e,n))}}function attachNeighborIteratorCreator(e,t){let{name:n,type:i,direction:a}=t,o=n.slice(0,-1)+`Entries`;e.prototype[o]=function(e){if(i!==`mixed`&&this.type!==`mixed`&&i!==this.type)return emptyIterator();e=``+e;let t=this._nodes.get(e);if(t===void 0)throw new r(`Graph.${o}: could not find the "${e}" node in the graph.`);return createNeighborIterator(i===`mixed`?this.type:i,a,t)}}function attachNeighborIterationMethods(e){c.forEach(t=>{attachNeighborArrayCreator(e,t),attachForEachNeighbor(e,t),attachFindNeighbor(e,t),attachNeighborIteratorCreator(e,t)})}function forEachAdjacency(e,t,n,r,i){let a=r._nodes.values(),o=r.type,s,c,l,u,d,f,p;for(;s=a.next(),s.done!==!0;){let r=!1;if(c=s.value,o!==`undirected`)for(l in u=c.out,u){d=u[l];do{if(f=d.target,r=!0,p=i(c.key,f.key,c.attributes,f.attributes,d.key,d.attributes,d.undirected),e&&p)return d;d=d.next}while(d)}if(o!==`directed`){for(l in u=c.undirected,u)if(!(t&&c.key>l)){d=u[l];do{if(f=d.target,f.key!==l&&(f=d.source),r=!0,p=i(c.key,f.key,c.attributes,f.attributes,d.key,d.attributes,d.undirected),e&&p)return d;d=d.next}while(d)}}if(n&&!r&&(p=i(c.key,null,c.attributes,null,null,null,null),e&&p))return null}}function serializeNode(e,n){let r={key:e};return isEmpty(n.attributes)||(r.attributes=t({},n.attributes)),r}function serializeEdge(e,n,r){let i={key:n,source:r.source.key,target:r.target.key};return isEmpty(r.attributes)||(i.attributes=t({},r.attributes)),e===`mixed`&&r.undirected&&(i.undirected=!0),i}function validateSerializedNode(e){if(!isPlainObject(e))throw new n(`Graph.import: invalid serialized node. A serialized node should be a plain object with at least a "key" property.`);if(!(`key`in e))throw new n(`Graph.import: serialized node is missing its key.`);if(`attributes`in e&&(!isPlainObject(e.attributes)||e.attributes===null))throw new n(`Graph.import: invalid attributes. Attributes should be a plain object, null or omitted.`)}function validateSerializedEdge(e){if(!isPlainObject(e))throw new n(`Graph.import: invalid serialized edge. A serialized edge should be a plain object with at least a "source" & "target" property.`);if(!(`source`in e))throw new n(`Graph.import: serialized edge is missing its source.`);if(!(`target`in e))throw new n(`Graph.import: serialized edge is missing its target.`);if(`attributes`in e&&(!isPlainObject(e.attributes)||e.attributes===null))throw new n(`Graph.import: invalid attributes. Attributes should be a plain object, null or omitted.`);if(`undirected`in e&&typeof e.undirected!=`boolean`)throw new n(`Graph.import: invalid undirectedness information. Undirected should be boolean or omitted.`)}const l=incrementalIdStartingFromRandomByte(),u=new Set([`directed`,`undirected`,`mixed`]),d=new Set([`domain`,`_events`,`_eventsCount`,`_maxListeners`]),f=[{name:e=>`${e}Edge`,generateKey:!0},{name:e=>`${e}DirectedEdge`,generateKey:!0,type:`directed`},{name:e=>`${e}UndirectedEdge`,generateKey:!0,type:`undirected`},{name:e=>`${e}EdgeWithKey`},{name:e=>`${e}DirectedEdgeWithKey`,type:`directed`},{name:e=>`${e}UndirectedEdgeWithKey`,type:`undirected`}],p={allowSelfLoops:!0,multi:!1,type:`mixed`};function addNode(e,t,r){if(r&&!isPlainObject(r))throw new n(`Graph.addNode: invalid attributes. Expecting an object but got "${r}"`);if(t=``+t,r||={},e._nodes.has(t))throw new i(`Graph.addNode: the "${t}" node already exist in the graph.`);let a=new e.NodeDataClass(t,r);return e._nodes.set(t,a),e.emit(`nodeAdded`,{key:t,attributes:r}),a}function unsafeAddNode(e,t,n){let r=new e.NodeDataClass(t,n);return e._nodes.set(t,r),e.emit(`nodeAdded`,{key:t,attributes:n}),r}function addEdge(e,t,a,o,s,c,l,u){if(!o&&e.type===`undirected`)throw new i(`Graph.${t}: you cannot add a directed edge to an undirected graph. Use the #.addEdge or #.addUndirectedEdge instead.`);if(o&&e.type===`directed`)throw new i(`Graph.${t}: you cannot add an undirected edge to a directed graph. Use the #.addEdge or #.addDirectedEdge instead.`);if(u&&!isPlainObject(u))throw new n(`Graph.${t}: invalid attributes. Expecting an object but got "${u}"`);if(c=``+c,l=``+l,u||={},!e.allowSelfLoops&&c===l)throw new i(`Graph.${t}: source & target are the same ("${c}"), thus creating a loop explicitly forbidden by this graph 'allowSelfLoops' option set to false.`);let d=e._nodes.get(c),f=e._nodes.get(l);if(!d)throw new r(`Graph.${t}: source node "${c}" not found.`);if(!f)throw new r(`Graph.${t}: target node "${l}" not found.`);let p={key:null,undirected:o,source:c,target:l,attributes:u};if(a)s=e._edgeKeyGenerator();else if(s=``+s,e._edges.has(s))throw new i(`Graph.${t}: the "${s}" edge already exists in the graph.`);if(!e.multi&&(o?d.undirected[l]!==void 0:d.out[l]!==void 0))throw new i(`Graph.${t}: an edge linking "${c}" to "${l}" already exists. If you really want to add multiple edges linking those nodes, you should create a multi graph by using the 'multi' option.`);let m=new EdgeData(o,s,d,f,u);e._edges.set(s,m);let h=c===l;return o?(d.undirectedDegree++,f.undirectedDegree++,h&&(d.undirectedLoops++,e._undirectedSelfLoopCount++)):(d.outDegree++,f.inDegree++,h&&(d.directedLoops++,e._directedSelfLoopCount++)),e.multi?m.attachMulti():m.attach(),o?e._undirectedSize++:e._directedSize++,p.key=s,e.emit(`edgeAdded`,p),s}function mergeEdge(e,r,a,o,s,c,l,u,d){if(!o&&e.type===`undirected`)throw new i(`Graph.${r}: you cannot merge/update a directed edge to an undirected graph. Use the #.mergeEdge/#.updateEdge or #.addUndirectedEdge instead.`);if(o&&e.type===`directed`)throw new i(`Graph.${r}: you cannot merge/update an undirected edge to a directed graph. Use the #.mergeEdge/#.updateEdge or #.addDirectedEdge instead.`);if(u){if(d){if(typeof u!=`function`)throw new n(`Graph.${r}: invalid updater function. Expecting a function but got "${u}"`)}else if(!isPlainObject(u))throw new n(`Graph.${r}: invalid attributes. Expecting an object but got "${u}"`)}c=``+c,l=``+l;let f;if(d&&(f=u,u=void 0),!e.allowSelfLoops&&c===l)throw new i(`Graph.${r}: source & target are the same ("${c}"), thus creating a loop explicitly forbidden by this graph 'allowSelfLoops' option set to false.`);let p=e._nodes.get(c),m=e._nodes.get(l),h,g;if(!a&&(h=e._edges.get(s),h)){if((h.source.key!==c||h.target.key!==l)&&(!o||h.source.key!==l||h.target.key!==c))throw new i(`Graph.${r}: inconsistency detected when attempting to merge the "${s}" edge with "${c}" source & "${l}" target vs. ("${h.source.key}", "${h.target.key}").`);g=h}if(!g&&!e.multi&&p&&(g=o?p.undirected[l]:p.out[l]),g){let n=[g.key,!1,!1,!1];if(d?!f:!u)return n;if(d){let t=g.attributes;g.attributes=f(t),e.emit(`edgeAttributesUpdated`,{type:`replace`,key:g.key,attributes:g.attributes})}else t(g.attributes,u),e.emit(`edgeAttributesUpdated`,{type:`merge`,key:g.key,attributes:g.attributes,data:u});return n}u||={},d&&f&&(u=f(u));let _={key:null,undirected:o,source:c,target:l,attributes:u};if(a)s=e._edgeKeyGenerator();else if(s=``+s,e._edges.has(s))throw new i(`Graph.${r}: the "${s}" edge already exists in the graph.`);let v=!1,y=!1;p||(p=unsafeAddNode(e,c,{}),v=!0,c===l&&(m=p,y=!0)),m||(m=unsafeAddNode(e,l,{}),y=!0),h=new EdgeData(o,s,p,m,u),e._edges.set(s,h);let b=c===l;return o?(p.undirectedDegree++,m.undirectedDegree++,b&&(p.undirectedLoops++,e._undirectedSelfLoopCount++)):(p.outDegree++,m.inDegree++,b&&(p.directedLoops++,e._directedSelfLoopCount++)),e.multi?h.attachMulti():h.attach(),o?e._undirectedSize++:e._directedSize++,_.key=s,e.emit(`edgeAdded`,_),[s,!0,v,y]}function dropEdgeFromData(e,t){e._edges.delete(t.key);let{source:n,target:r,attributes:i}=t,a=t.undirected,o=n===r;a?(n.undirectedDegree--,r.undirectedDegree--,o&&(n.undirectedLoops--,e._undirectedSelfLoopCount--)):(n.outDegree--,r.inDegree--,o&&(n.directedLoops--,e._directedSelfLoopCount--)),e.multi?t.detachMulti():t.detach(),a?e._undirectedSize--:e._directedSize--,e.emit(`edgeDropped`,{key:t.key,attributes:i,source:n.key,target:r.key,undirected:a})}var m=class Graph extends e{constructor(e){if(super(),e=t({},p,e),typeof e.multi!=`boolean`)throw new n(`Graph.constructor: invalid 'multi' option. Expecting a boolean but got "${e.multi}".`);if(!u.has(e.type))throw new n(`Graph.constructor: invalid 'type' option. Should be one of "mixed", "directed" or "undirected" but got "${e.type}".`);if(typeof e.allowSelfLoops!=`boolean`)throw new n(`Graph.constructor: invalid 'allowSelfLoops' option. Expecting a boolean but got "${e.allowSelfLoops}".`);let r=e.type===`mixed`?MixedNodeData:e.type===`directed`?DirectedNodeData:UndirectedNodeData;privateProperty(this,`NodeDataClass`,r);let i=`geid_`+l()+`_`,a=0,edgeKeyGenerator=()=>{let e;do e=i+ a++;while(this._edges.has(e));return e};privateProperty(this,`_attributes`,{}),privateProperty(this,`_nodes`,new Map),privateProperty(this,`_edges`,new Map),privateProperty(this,`_directedSize`,0),privateProperty(this,`_undirectedSize`,0),privateProperty(this,`_directedSelfLoopCount`,0),privateProperty(this,`_undirectedSelfLoopCount`,0),privateProperty(this,`_edgeKeyGenerator`,edgeKeyGenerator),privateProperty(this,`_options`,e),d.forEach(e=>privateProperty(this,e,this[e])),readOnlyProperty(this,`order`,()=>this._nodes.size),readOnlyProperty(this,`size`,()=>this._edges.size),readOnlyProperty(this,`directedSize`,()=>this._directedSize),readOnlyProperty(this,`undirectedSize`,()=>this._undirectedSize),readOnlyProperty(this,`selfLoopCount`,()=>this._directedSelfLoopCount+this._undirectedSelfLoopCount),readOnlyProperty(this,`directedSelfLoopCount`,()=>this._directedSelfLoopCount),readOnlyProperty(this,`undirectedSelfLoopCount`,()=>this._undirectedSelfLoopCount),readOnlyProperty(this,`multi`,this._options.multi),readOnlyProperty(this,`type`,this._options.type),readOnlyProperty(this,`allowSelfLoops`,this._options.allowSelfLoops),readOnlyProperty(this,`implementation`,()=>`graphology`)}_resetInstanceCounters(){this._directedSize=0,this._undirectedSize=0,this._directedSelfLoopCount=0,this._undirectedSelfLoopCount=0}hasNode(e){return this._nodes.has(``+e)}hasDirectedEdge(e,t){if(this.type===`undirected`)return!1;if(arguments.length===1){let t=``+e,n=this._edges.get(t);return!!n&&!n.undirected}else if(arguments.length===2){e=``+e,t=``+t;let n=this._nodes.get(e);return n?n.out.hasOwnProperty(t):!1}throw new n(`Graph.hasDirectedEdge: invalid arity (${arguments.length}, instead of 1 or 2). You can either ask for an edge id or for the existence of an edge between a source & a target.`)}hasUndirectedEdge(e,t){if(this.type===`directed`)return!1;if(arguments.length===1){let t=``+e,n=this._edges.get(t);return!!n&&n.undirected}else if(arguments.length===2){e=``+e,t=``+t;let n=this._nodes.get(e);return n?n.undirected.hasOwnProperty(t):!1}throw new n(`Graph.hasDirectedEdge: invalid arity (${arguments.length}, instead of 1 or 2). You can either ask for an edge id or for the existence of an edge between a source & a target.`)}hasEdge(e,t){if(arguments.length===1){let t=``+e;return this._edges.has(t)}else if(arguments.length===2){e=``+e,t=``+t;let n=this._nodes.get(e);return n?n.out!==void 0&&n.out.hasOwnProperty(t)||n.undirected!==void 0&&n.undirected.hasOwnProperty(t):!1}throw new n(`Graph.hasEdge: invalid arity (${arguments.length}, instead of 1 or 2). You can either ask for an edge id or for the existence of an edge between a source & a target.`)}directedEdge(e,t){if(this.type===`undirected`)return;if(e=``+e,t=``+t,this.multi)throw new i(`Graph.directedEdge: this method is irrelevant with multigraphs since there might be multiple edges between source & target. See #.directedEdges instead.`);let n=this._nodes.get(e);if(!n)throw new r(`Graph.directedEdge: could not find the "${e}" source node in the graph.`);if(!this._nodes.has(t))throw new r(`Graph.directedEdge: could not find the "${t}" target node in the graph.`);let a=n.out&&n.out[t]||void 0;if(a)return a.key}undirectedEdge(e,t){if(this.type===`directed`)return;if(e=``+e,t=``+t,this.multi)throw new i(`Graph.undirectedEdge: this method is irrelevant with multigraphs since there might be multiple edges between source & target. See #.undirectedEdges instead.`);let n=this._nodes.get(e);if(!n)throw new r(`Graph.undirectedEdge: could not find the "${e}" source node in the graph.`);if(!this._nodes.has(t))throw new r(`Graph.undirectedEdge: could not find the "${t}" target node in the graph.`);let a=n.undirected&&n.undirected[t]||void 0;if(a)return a.key}edge(e,t){if(this.multi)throw new i(`Graph.edge: this method is irrelevant with multigraphs since there might be multiple edges between source & target. See #.edges instead.`);e=``+e,t=``+t;let n=this._nodes.get(e);if(!n)throw new r(`Graph.edge: could not find the "${e}" source node in the graph.`);if(!this._nodes.has(t))throw new r(`Graph.edge: could not find the "${t}" target node in the graph.`);let a=n.out&&n.out[t]||n.undirected&&n.undirected[t]||void 0;if(a)return a.key}areDirectedNeighbors(e,t){e=``+e,t=``+t;let n=this._nodes.get(e);if(!n)throw new r(`Graph.areDirectedNeighbors: could not find the "${e}" node in the graph.`);return this.type===`undirected`?!1:t in n.in||t in n.out}areOutNeighbors(e,t){e=``+e,t=``+t;let n=this._nodes.get(e);if(!n)throw new r(`Graph.areOutNeighbors: could not find the "${e}" node in the graph.`);return this.type===`undirected`?!1:t in n.out}areInNeighbors(e,t){e=``+e,t=``+t;let n=this._nodes.get(e);if(!n)throw new r(`Graph.areInNeighbors: could not find the "${e}" node in the graph.`);return this.type===`undirected`?!1:t in n.in}areUndirectedNeighbors(e,t){e=``+e,t=``+t;let n=this._nodes.get(e);if(!n)throw new r(`Graph.areUndirectedNeighbors: could not find the "${e}" node in the graph.`);return this.type===`directed`?!1:t in n.undirected}areNeighbors(e,t){e=``+e,t=``+t;let n=this._nodes.get(e);if(!n)throw new r(`Graph.areNeighbors: could not find the "${e}" node in the graph.`);return this.type!==`undirected`&&(t in n.in||t in n.out)||this.type!==`directed`&&t in n.undirected}areInboundNeighbors(e,t){e=``+e,t=``+t;let n=this._nodes.get(e);if(!n)throw new r(`Graph.areInboundNeighbors: could not find the "${e}" node in the graph.`);return this.type!==`undirected`&&t in n.in||this.type!==`directed`&&t in n.undirected}areOutboundNeighbors(e,t){e=``+e,t=``+t;let n=this._nodes.get(e);if(!n)throw new r(`Graph.areOutboundNeighbors: could not find the "${e}" node in the graph.`);return this.type!==`undirected`&&t in n.out||this.type!==`directed`&&t in n.undirected}inDegree(e){e=``+e;let t=this._nodes.get(e);if(!t)throw new r(`Graph.inDegree: could not find the "${e}" node in the graph.`);return this.type===`undirected`?0:t.inDegree}outDegree(e){e=``+e;let t=this._nodes.get(e);if(!t)throw new r(`Graph.outDegree: could not find the "${e}" node in the graph.`);return this.type===`undirected`?0:t.outDegree}directedDegree(e){e=``+e;let t=this._nodes.get(e);if(!t)throw new r(`Graph.directedDegree: could not find the "${e}" node in the graph.`);return this.type===`undirected`?0:t.inDegree+t.outDegree}undirectedDegree(e){e=``+e;let t=this._nodes.get(e);if(!t)throw new r(`Graph.undirectedDegree: could not find the "${e}" node in the graph.`);return this.type===`directed`?0:t.undirectedDegree}inboundDegree(e){e=``+e;let t=this._nodes.get(e);if(!t)throw new r(`Graph.inboundDegree: could not find the "${e}" node in the graph.`);let n=0;return this.type!==`directed`&&(n+=t.undirectedDegree),this.type!==`undirected`&&(n+=t.inDegree),n}outboundDegree(e){e=``+e;let t=this._nodes.get(e);if(!t)throw new r(`Graph.outboundDegree: could not find the "${e}" node in the graph.`);let n=0;return this.type!==`directed`&&(n+=t.undirectedDegree),this.type!==`undirected`&&(n+=t.outDegree),n}degree(e){e=``+e;let t=this._nodes.get(e);if(!t)throw new r(`Graph.degree: could not find the "${e}" node in the graph.`);let n=0;return this.type!==`directed`&&(n+=t.undirectedDegree),this.type!==`undirected`&&(n+=t.inDegree+t.outDegree),n}inDegreeWithoutSelfLoops(e){e=``+e;let t=this._nodes.get(e);if(!t)throw new r(`Graph.inDegreeWithoutSelfLoops: could not find the "${e}" node in the graph.`);return this.type===`undirected`?0:t.inDegree-t.directedLoops}outDegreeWithoutSelfLoops(e){e=``+e;let t=this._nodes.get(e);if(!t)throw new r(`Graph.outDegreeWithoutSelfLoops: could not find the "${e}" node in the graph.`);return this.type===`undirected`?0:t.outDegree-t.directedLoops}directedDegreeWithoutSelfLoops(e){e=``+e;let t=this._nodes.get(e);if(!t)throw new r(`Graph.directedDegreeWithoutSelfLoops: could not find the "${e}" node in the graph.`);return this.type===`undirected`?0:t.inDegree+t.outDegree-t.directedLoops*2}undirectedDegreeWithoutSelfLoops(e){e=``+e;let t=this._nodes.get(e);if(!t)throw new r(`Graph.undirectedDegreeWithoutSelfLoops: could not find the "${e}" node in the graph.`);return this.type===`directed`?0:t.undirectedDegree-t.undirectedLoops*2}inboundDegreeWithoutSelfLoops(e){e=``+e;let t=this._nodes.get(e);if(!t)throw new r(`Graph.inboundDegreeWithoutSelfLoops: could not find the "${e}" node in the graph.`);let n=0,i=0;return this.type!==`directed`&&(n+=t.undirectedDegree,i+=t.undirectedLoops*2),this.type!==`undirected`&&(n+=t.inDegree,i+=t.directedLoops),n-i}outboundDegreeWithoutSelfLoops(e){e=``+e;let t=this._nodes.get(e);if(!t)throw new r(`Graph.outboundDegreeWithoutSelfLoops: could not find the "${e}" node in the graph.`);let n=0,i=0;return this.type!==`directed`&&(n+=t.undirectedDegree,i+=t.undirectedLoops*2),this.type!==`undirected`&&(n+=t.outDegree,i+=t.directedLoops),n-i}degreeWithoutSelfLoops(e){e=``+e;let t=this._nodes.get(e);if(!t)throw new r(`Graph.degreeWithoutSelfLoops: could not find the "${e}" node in the graph.`);let n=0,i=0;return this.type!==`directed`&&(n+=t.undirectedDegree,i+=t.undirectedLoops*2),this.type!==`undirected`&&(n+=t.inDegree+t.outDegree,i+=t.directedLoops*2),n-i}source(e){e=``+e;let t=this._edges.get(e);if(!t)throw new r(`Graph.source: could not find the "${e}" edge in the graph.`);return t.source.key}target(e){e=``+e;let t=this._edges.get(e);if(!t)throw new r(`Graph.target: could not find the "${e}" edge in the graph.`);return t.target.key}extremities(e){e=``+e;let t=this._edges.get(e);if(!t)throw new r(`Graph.extremities: could not find the "${e}" edge in the graph.`);return[t.source.key,t.target.key]}opposite(e,t){e=``+e,t=``+t;let n=this._edges.get(t);if(!n)throw new r(`Graph.opposite: could not find the "${t}" edge in the graph.`);let i=n.source.key,a=n.target.key;if(e===i)return a;if(e===a)return i;throw new r(`Graph.opposite: the "${e}" node is not attached to the "${t}" edge (${i}, ${a}).`)}hasExtremity(e,t){e=``+e,t=``+t;let n=this._edges.get(e);if(!n)throw new r(`Graph.hasExtremity: could not find the "${e}" edge in the graph.`);return n.source.key===t||n.target.key===t}isUndirected(e){e=``+e;let t=this._edges.get(e);if(!t)throw new r(`Graph.isUndirected: could not find the "${e}" edge in the graph.`);return t.undirected}isDirected(e){e=``+e;let t=this._edges.get(e);if(!t)throw new r(`Graph.isDirected: could not find the "${e}" edge in the graph.`);return!t.undirected}isSelfLoop(e){e=``+e;let t=this._edges.get(e);if(!t)throw new r(`Graph.isSelfLoop: could not find the "${e}" edge in the graph.`);return t.source===t.target}addNode(e,t){return addNode(this,e,t).key}mergeNode(e,r){if(r&&!isPlainObject(r))throw new n(`Graph.mergeNode: invalid attributes. Expecting an object but got "${r}"`);e=``+e,r||={};let i=this._nodes.get(e);return i?(r&&(t(i.attributes,r),this.emit(`nodeAttributesUpdated`,{type:`merge`,key:e,attributes:i.attributes,data:r})),[e,!1]):(i=new this.NodeDataClass(e,r),this._nodes.set(e,i),this.emit(`nodeAdded`,{key:e,attributes:r}),[e,!0])}updateNode(e,t){if(t&&typeof t!=`function`)throw new n(`Graph.updateNode: invalid updater function. Expecting a function but got "${t}"`);e=``+e;let r=this._nodes.get(e);if(r){if(t){let n=r.attributes;r.attributes=t(n),this.emit(`nodeAttributesUpdated`,{type:`replace`,key:e,attributes:r.attributes})}return[e,!1]}let i=t?t({}):{};return r=new this.NodeDataClass(e,i),this._nodes.set(e,r),this.emit(`nodeAdded`,{key:e,attributes:i}),[e,!0]}dropNode(e){e=``+e;let t=this._nodes.get(e);if(!t)throw new r(`Graph.dropNode: could not find the "${e}" node in the graph.`);let n;if(this.type!==`undirected`){for(let e in t.out){n=t.out[e];do dropEdgeFromData(this,n),n=n.next;while(n)}for(let e in t.in){n=t.in[e];do dropEdgeFromData(this,n),n=n.next;while(n)}}if(this.type!==`directed`)for(let e in t.undirected){n=t.undirected[e];do dropEdgeFromData(this,n),n=n.next;while(n)}this._nodes.delete(e),this.emit(`nodeDropped`,{key:e,attributes:t.attributes})}dropEdge(e){let t;if(arguments.length>1){let e=``+arguments[0],n=``+arguments[1];if(t=getMatchingEdge(this,e,n,this.type),!t)throw new r(`Graph.dropEdge: could not find the "${e}" -> "${n}" edge in the graph.`)}else if(e=``+e,t=this._edges.get(e),!t)throw new r(`Graph.dropEdge: could not find the "${e}" edge in the graph.`);return dropEdgeFromData(this,t),this}dropDirectedEdge(e,t){if(arguments.length<2)throw new i(`Graph.dropDirectedEdge: it does not make sense to try and drop a directed edge by key. What if the edge with this key is undirected? Use #.dropEdge for this purpose instead.`);if(this.multi)throw new i(`Graph.dropDirectedEdge: cannot use a {source,target} combo when dropping an edge in a MultiGraph since we cannot infer the one you want to delete as there could be multiple ones.`);e=``+e,t=``+t;let n=getMatchingEdge(this,e,t,`directed`);if(!n)throw new r(`Graph.dropDirectedEdge: could not find a "${e}" -> "${t}" edge in the graph.`);return dropEdgeFromData(this,n),this}dropUndirectedEdge(e,t){if(arguments.length<2)throw new i(`Graph.dropUndirectedEdge: it does not make sense to drop a directed edge by key. What if the edge with this key is undirected? Use #.dropEdge for this purpose instead.`);if(this.multi)throw new i(`Graph.dropUndirectedEdge: cannot use a {source,target} combo when dropping an edge in a MultiGraph since we cannot infer the one you want to delete as there could be multiple ones.`);let n=getMatchingEdge(this,e,t,`undirected`);if(!n)throw new r(`Graph.dropUndirectedEdge: could not find a "${e}" -> "${t}" edge in the graph.`);return dropEdgeFromData(this,n),this}clear(){this._edges.clear(),this._nodes.clear(),this._resetInstanceCounters(),this.emit(`cleared`)}clearEdges(){let e=this._nodes.values(),t;for(;t=e.next(),t.done!==!0;)t.value.clear();this._edges.clear(),this._resetInstanceCounters(),this.emit(`edgesCleared`)}getAttribute(e){return this._attributes[e]}getAttributes(){return this._attributes}hasAttribute(e){return this._attributes.hasOwnProperty(e)}setAttribute(e,t){return this._attributes[e]=t,this.emit(`attributesUpdated`,{type:`set`,attributes:this._attributes,name:e}),this}updateAttribute(e,t){if(typeof t!=`function`)throw new n(`Graph.updateAttribute: updater should be a function.`);let r=this._attributes[e];return this._attributes[e]=t(r),this.emit(`attributesUpdated`,{type:`set`,attributes:this._attributes,name:e}),this}removeAttribute(e){return delete this._attributes[e],this.emit(`attributesUpdated`,{type:`remove`,attributes:this._attributes,name:e}),this}replaceAttributes(e){if(!isPlainObject(e))throw new n(`Graph.replaceAttributes: provided attributes are not a plain object.`);return this._attributes=e,this.emit(`attributesUpdated`,{type:`replace`,attributes:this._attributes}),this}mergeAttributes(e){if(!isPlainObject(e))throw new n(`Graph.mergeAttributes: provided attributes are not a plain object.`);return t(this._attributes,e),this.emit(`attributesUpdated`,{type:`merge`,attributes:this._attributes,data:e}),this}updateAttributes(e){if(typeof e!=`function`)throw new n(`Graph.updateAttributes: provided updater is not a function.`);return this._attributes=e(this._attributes),this.emit(`attributesUpdated`,{type:`update`,attributes:this._attributes}),this}updateEachNodeAttributes(e,t){if(typeof e!=`function`)throw new n(`Graph.updateEachNodeAttributes: expecting an updater function.`);if(t&&!validateHints(t))throw new n(`Graph.updateEachNodeAttributes: invalid hints. Expecting an object having the following shape: {attributes?: [string]}`);let r=this._nodes.values(),i,a;for(;i=r.next(),i.done!==!0;)a=i.value,a.attributes=e(a.key,a.attributes);this.emit(`eachNodeAttributesUpdated`,{hints:t||null})}updateEachEdgeAttributes(e,t){if(typeof e!=`function`)throw new n(`Graph.updateEachEdgeAttributes: expecting an updater function.`);if(t&&!validateHints(t))throw new n(`Graph.updateEachEdgeAttributes: invalid hints. Expecting an object having the following shape: {attributes?: [string]}`);let r=this._edges.values(),i,a,o,s;for(;i=r.next(),i.done!==!0;)a=i.value,o=a.source,s=a.target,a.attributes=e(a.key,a.attributes,o.key,s.key,o.attributes,s.attributes,a.undirected);this.emit(`eachEdgeAttributesUpdated`,{hints:t||null})}forEachAdjacencyEntry(e){if(typeof e!=`function`)throw new n(`Graph.forEachAdjacencyEntry: expecting a callback.`);forEachAdjacency(!1,!1,!1,this,e)}forEachAdjacencyEntryWithOrphans(e){if(typeof e!=`function`)throw new n(`Graph.forEachAdjacencyEntryWithOrphans: expecting a callback.`);forEachAdjacency(!1,!1,!0,this,e)}forEachAssymetricAdjacencyEntry(e){if(typeof e!=`function`)throw new n(`Graph.forEachAssymetricAdjacencyEntry: expecting a callback.`);forEachAdjacency(!1,!0,!1,this,e)}forEachAssymetricAdjacencyEntryWithOrphans(e){if(typeof e!=`function`)throw new n(`Graph.forEachAssymetricAdjacencyEntryWithOrphans: expecting a callback.`);forEachAdjacency(!1,!0,!0,this,e)}nodes(){return Array.from(this._nodes.keys())}forEachNode(e){if(typeof e!=`function`)throw new n(`Graph.forEachNode: expecting a callback.`);let t=this._nodes.values(),r,i;for(;r=t.next(),r.done!==!0;)i=r.value,e(i.key,i.attributes)}findNode(e){if(typeof e!=`function`)throw new n(`Graph.findNode: expecting a callback.`);let t=this._nodes.values(),r,i;for(;r=t.next(),r.done!==!0;)if(i=r.value,e(i.key,i.attributes))return i.key}mapNodes(e){if(typeof e!=`function`)throw new n(`Graph.mapNode: expecting a callback.`);let t=this._nodes.values(),r,i,a=Array(this.order),o=0;for(;r=t.next(),r.done!==!0;)i=r.value,a[o++]=e(i.key,i.attributes);return a}someNode(e){if(typeof e!=`function`)throw new n(`Graph.someNode: expecting a callback.`);let t=this._nodes.values(),r,i;for(;r=t.next(),r.done!==!0;)if(i=r.value,e(i.key,i.attributes))return!0;return!1}everyNode(e){if(typeof e!=`function`)throw new n(`Graph.everyNode: expecting a callback.`);let t=this._nodes.values(),r,i;for(;r=t.next(),r.done!==!0;)if(i=r.value,!e(i.key,i.attributes))return!1;return!0}filterNodes(e){if(typeof e!=`function`)throw new n(`Graph.filterNodes: expecting a callback.`);let t=this._nodes.values(),r,i,a=[];for(;r=t.next(),r.done!==!0;)i=r.value,e(i.key,i.attributes)&&a.push(i.key);return a}reduceNodes(e,t){if(typeof e!=`function`)throw new n(`Graph.reduceNodes: expecting a callback.`);if(arguments.length<2)throw new n(`Graph.reduceNodes: missing initial value. You must provide it because the callback takes more than one argument and we cannot infer the initial value from the first iteration, as you could with a simple array.`);let r=t,i=this._nodes.values(),a,o;for(;a=i.next(),a.done!==!0;)o=a.value,r=e(r,o.key,o.attributes);return r}nodeEntries(){let e=this._nodes.values();return{[Symbol.iterator](){return this},next(){let t=e.next();if(t.done)return t;let n=t.value;return{value:{node:n.key,attributes:n.attributes},done:!1}}}}export(){let e=Array(this._nodes.size),t=0;this._nodes.forEach((n,r)=>{e[t++]=serializeNode(r,n)});let n=Array(this._edges.size);return t=0,this._edges.forEach((e,r)=>{n[t++]=serializeEdge(this.type,r,e)}),{options:{type:this.type,multi:this.multi,allowSelfLoops:this.allowSelfLoops},attributes:this.getAttributes(),nodes:e,edges:n}}import(e,t=!1){if(e instanceof Graph)return e.forEachNode((e,n)=>{t?this.mergeNode(e,n):this.addNode(e,n)}),e.forEachEdge((e,n,r,i,a,o,s)=>{t?s?this.mergeUndirectedEdgeWithKey(e,r,i,n):this.mergeDirectedEdgeWithKey(e,r,i,n):s?this.addUndirectedEdgeWithKey(e,r,i,n):this.addDirectedEdgeWithKey(e,r,i,n)}),this;if(!isPlainObject(e))throw new n(`Graph.import: invalid argument. Expecting a serialized graph or, alternatively, a Graph instance.`);if(e.attributes){if(!isPlainObject(e.attributes))throw new n(`Graph.import: invalid attributes. Expecting a plain object.`);t?this.mergeAttributes(e.attributes):this.replaceAttributes(e.attributes)}let r,i,a,o,s;if(e.nodes){if(a=e.nodes,!Array.isArray(a))throw new n(`Graph.import: invalid nodes. Expecting an array.`);for(r=0,i=a.length;r<i;r++){o=a[r],validateSerializedNode(o);let{key:e,attributes:n}=o;t?this.mergeNode(e,n):this.addNode(e,n)}}if(e.edges){let o=!1;if(this.type===`undirected`&&(o=!0),a=e.edges,!Array.isArray(a))throw new n(`Graph.import: invalid edges. Expecting an array.`);for(r=0,i=a.length;r<i;r++){s=a[r],validateSerializedEdge(s);let{source:e,target:n,attributes:i,undirected:c=o}=s,l;`key`in s?(l=t?c?this.mergeUndirectedEdgeWithKey:this.mergeDirectedEdgeWithKey:c?this.addUndirectedEdgeWithKey:this.addDirectedEdgeWithKey,l.call(this,s.key,e,n,i)):(l=t?c?this.mergeUndirectedEdge:this.mergeDirectedEdge:c?this.addUndirectedEdge:this.addDirectedEdge,l.call(this,e,n,i))}}return this}nullCopy(e){let n=new Graph(t({},this._options,e));return n.replaceAttributes(t({},this.getAttributes())),n}emptyCopy(e){let n=this.nullCopy(e);return this._nodes.forEach((e,r)=>{let i=t({},e.attributes);e=new n.NodeDataClass(r,i),n._nodes.set(r,e)}),n}copy(e){if(e||={},typeof e.type==`string`&&e.type!==this.type&&e.type!==`mixed`)throw new i(`Graph.copy: cannot create an incompatible copy from "${this.type}" type to "${e.type}" because this would mean losing information about the current graph.`);if(typeof e.multi==`boolean`&&e.multi!==this.multi&&e.multi!==!0)throw new i(`Graph.copy: cannot create an incompatible copy by downgrading a multi graph to a simple one because this would mean losing information about the current graph.`);if(typeof e.allowSelfLoops==`boolean`&&e.allowSelfLoops!==this.allowSelfLoops&&e.allowSelfLoops!==!0)throw new i(`Graph.copy: cannot create an incompatible copy from a graph allowing self loops to one that does not because this would mean losing information about the current graph.`);let n=this.emptyCopy(e),r=this._edges.values(),a,o;for(;a=r.next(),a.done!==!0;)o=a.value,addEdge(n,`copy`,!1,o.undirected,o.key,o.source.key,o.target.key,t({},o.attributes));return n}toJSON(){return this.export()}toString(){return`[object Graph]`}inspect(){let e={};this._nodes.forEach((t,n)=>{e[n]=t.attributes});let t={},n={};this._edges.forEach((e,r)=>{let i=e.undirected?`--`:`->`,a=``,o=e.source.key,s=e.target.key,c;e.undirected&&o>s&&(c=o,o=s,s=c);let l=`(${o})${i}(${s})`;r.startsWith(`geid_`)?this.multi&&(n[l]===void 0?n[l]=0:n[l]++,a+=`${n[l]}. `):a+=`[${r}]: `,a+=l,t[a]=e.attributes});let r={};for(let e in this)this.hasOwnProperty(e)&&!d.has(e)&&typeof this[e]!=`function`&&typeof e!=`symbol`&&(r[e]=this[e]);return r.attributes=this._attributes,r.nodes=e,r.edges=t,privateProperty(r,`constructor`,this.constructor),r}};typeof Symbol<`u`&&(m.prototype[Symbol.for(`nodejs.util.inspect.custom`)]=m.prototype.inspect),f.forEach(e=>{[`add`,`merge`,`update`].forEach(t=>{let n=e.name(t),r=t===`add`?addEdge:mergeEdge;e.generateKey?m.prototype[n]=function(i,a,o){return r(this,n,!0,(e.type||this.type)===`undirected`,null,i,a,o,t===`update`)}:m.prototype[n]=function(i,a,o,s){return r(this,n,!1,(e.type||this.type)===`undirected`,i,a,o,s,t===`update`)}})}),attachNodeAttributesMethods(m),attachEdgeAttributesMethods(m),attachEdgeIterationMethods(m),attachNeighborIterationMethods(m);var DirectedGraph=class extends m{constructor(e){let r=t({type:`directed`},e);if(`multi`in r&&r.multi!==!1)throw new n(`DirectedGraph.from: inconsistent indication that the graph should be multi in given options!`);if(r.type!==`directed`)throw new n(`DirectedGraph.from: inconsistent "`+r.type+`" type in given options!`);super(r)}},UndirectedGraph=class extends m{constructor(e){let r=t({type:`undirected`},e);if(`multi`in r&&r.multi!==!1)throw new n(`UndirectedGraph.from: inconsistent indication that the graph should be multi in given options!`);if(r.type!==`undirected`)throw new n(`UndirectedGraph.from: inconsistent "`+r.type+`" type in given options!`);super(r)}},MultiGraph=class extends m{constructor(e){let r=t({multi:!0},e);if(`multi`in r&&r.multi!==!0)throw new n(`MultiGraph.from: inconsistent indication that the graph should be simple in given options!`);super(r)}},MultiDirectedGraph=class extends m{constructor(e){let r=t({type:`directed`,multi:!0},e);if(`multi`in r&&r.multi!==!0)throw new n(`MultiDirectedGraph.from: inconsistent indication that the graph should be simple in given options!`);if(r.type!==`directed`)throw new n(`MultiDirectedGraph.from: inconsistent "`+r.type+`" type in given options!`);super(r)}},MultiUndirectedGraph=class extends m{constructor(e){let r=t({type:`undirected`,multi:!0},e);if(`multi`in r&&r.multi!==!0)throw new n(`MultiUndirectedGraph.from: inconsistent indication that the graph should be simple in given options!`);if(r.type!==`undirected`)throw new n(`MultiUndirectedGraph.from: inconsistent "`+r.type+`" type in given options!`);super(r)}};function attachStaticFromMethod(e){e.from=function(n,r){let i=new e(t({},n.options,r));return i.import(n),i}}attachStaticFromMethod(m),attachStaticFromMethod(DirectedGraph),attachStaticFromMethod(UndirectedGraph),attachStaticFromMethod(MultiGraph),attachStaticFromMethod(MultiDirectedGraph),attachStaticFromMethod(MultiUndirectedGraph),m.Graph=m,m.DirectedGraph=DirectedGraph,m.UndirectedGraph=UndirectedGraph,m.MultiGraph=MultiGraph,m.MultiDirectedGraph=MultiDirectedGraph,m.MultiUndirectedGraph=MultiUndirectedGraph,m.InvalidArgumentsGraphError=n,m.NotFoundGraphError=r,m.UsageGraphError=i;export{m as t};
|
|
1
|
+
import"../rolldown-runtime.mjs";import{EventEmitter as e}from"node:events";function assignPolyfill(){let e=arguments[0];for(let t=1,n=arguments.length;t<n;t++)if(arguments[t])for(let n in arguments[t])e[n]=arguments[t][n];return e}let t=assignPolyfill;typeof Object.assign==`function`&&(t=Object.assign);function getMatchingEdge(e,t,n,r){let i=e._nodes.get(t),a=null;return i&&(a=r===`mixed`?i.out&&i.out[n]||i.undirected&&i.undirected[n]:r===`directed`?i.out&&i.out[n]:i.undirected&&i.undirected[n]),a}function isPlainObject(e){return typeof e==`object`&&!!e}function isEmpty(e){let t;for(t in e)return!1;return!0}function privateProperty(e,t,n){Object.defineProperty(e,t,{enumerable:!1,configurable:!1,writable:!0,value:n})}function readOnlyProperty(e,t,n){let r={enumerable:!0,configurable:!0};typeof n==`function`?r.get=n:(r.value=n,r.writable=!1),Object.defineProperty(e,t,r)}function validateHints(e){return!(!isPlainObject(e)||e.attributes&&!Array.isArray(e.attributes))}function incrementalIdStartingFromRandomByte(){let e=Math.floor(Math.random()*256)&255;return()=>e++}function chain(){let e=arguments,t=null,n=-1;return{[Symbol.iterator](){return this},next(){let r=null;do{if(t===null){if(n++,n>=e.length)return{done:!0};t=e[n][Symbol.iterator]()}if(r=t.next(),r.done){t=null;continue}break}while(!0);return r}}}function emptyIterator(){return{[Symbol.iterator](){return this},next(){return{done:!0}}}}var GraphError=class extends Error{constructor(e){super(),this.name=`GraphError`,this.message=e}},n=class InvalidArgumentsGraphError extends GraphError{constructor(e){super(e),this.name=`InvalidArgumentsGraphError`,typeof Error.captureStackTrace==`function`&&Error.captureStackTrace(this,InvalidArgumentsGraphError.prototype.constructor)}},r=class NotFoundGraphError extends GraphError{constructor(e){super(e),this.name=`NotFoundGraphError`,typeof Error.captureStackTrace==`function`&&Error.captureStackTrace(this,NotFoundGraphError.prototype.constructor)}},i=class UsageGraphError extends GraphError{constructor(e){super(e),this.name=`UsageGraphError`,typeof Error.captureStackTrace==`function`&&Error.captureStackTrace(this,UsageGraphError.prototype.constructor)}};function MixedNodeData(e,t){this.key=e,this.attributes=t,this.clear()}MixedNodeData.prototype.clear=function(){this.inDegree=0,this.outDegree=0,this.undirectedDegree=0,this.undirectedLoops=0,this.directedLoops=0,this.in={},this.out={},this.undirected={}};function DirectedNodeData(e,t){this.key=e,this.attributes=t,this.clear()}DirectedNodeData.prototype.clear=function(){this.inDegree=0,this.outDegree=0,this.directedLoops=0,this.in={},this.out={}};function UndirectedNodeData(e,t){this.key=e,this.attributes=t,this.clear()}UndirectedNodeData.prototype.clear=function(){this.undirectedDegree=0,this.undirectedLoops=0,this.undirected={}};function EdgeData(e,t,n,r,i){this.key=t,this.attributes=i,this.undirected=e,this.source=n,this.target=r}EdgeData.prototype.attach=function(){let e=`out`,t=`in`;this.undirected&&(e=t=`undirected`);let n=this.source.key,r=this.target.key;this.source[e][r]=this,!(this.undirected&&n===r)&&(this.target[t][n]=this)},EdgeData.prototype.attachMulti=function(){let e=`out`,t=`in`,n=this.source.key,r=this.target.key;this.undirected&&(e=t=`undirected`);let i=this.source[e],a=i[r];if(a===void 0){i[r]=this,this.undirected&&n===r||(this.target[t][n]=this);return}a.previous=this,this.next=a,i[r]=this,this.target[t][n]=this},EdgeData.prototype.detach=function(){let e=this.source.key,t=this.target.key,n=`out`,r=`in`;this.undirected&&(n=r=`undirected`),delete this.source[n][t],delete this.target[r][e]},EdgeData.prototype.detachMulti=function(){let e=this.source.key,t=this.target.key,n=`out`,r=`in`;this.undirected&&(n=r=`undirected`),this.previous===void 0?this.next===void 0?(delete this.source[n][t],delete this.target[r][e]):(this.next.previous=void 0,this.source[n][t]=this.next,this.target[r][e]=this.next):(this.previous.next=this.next,this.next!==void 0&&(this.next.previous=this.previous))};function findRelevantNodeData(e,t,n,i,a,o,s){let c,l,u,d;if(i=``+i,n===0){if(c=e._nodes.get(i),!c)throw new r(`Graph.${t}: could not find the "${i}" node in the graph.`);u=a,d=o}else if(n===3){if(a=``+a,l=e._edges.get(a),!l)throw new r(`Graph.${t}: could not find the "${a}" edge in the graph.`);let n=l.source.key,f=l.target.key;if(i===n)c=l.target;else if(i===f)c=l.source;else throw new r(`Graph.${t}: the "${i}" node is not attached to the "${a}" edge (${n}, ${f}).`);u=o,d=s}else{if(l=e._edges.get(i),!l)throw new r(`Graph.${t}: could not find the "${i}" edge in the graph.`);c=n===1?l.source:l.target,u=a,d=o}return[c,u,d]}function attachNodeAttributeGetter(e,t,n){e.prototype[t]=function(e,r,i){let[a,o]=findRelevantNodeData(this,t,n,e,r,i);return a.attributes[o]}}function attachNodeAttributesGetter(e,t,n){e.prototype[t]=function(e,r){let[i]=findRelevantNodeData(this,t,n,e,r);return i.attributes}}function attachNodeAttributeChecker(e,t,n){e.prototype[t]=function(e,r,i){let[a,o]=findRelevantNodeData(this,t,n,e,r,i);return a.attributes.hasOwnProperty(o)}}function attachNodeAttributeSetter(e,t,n){e.prototype[t]=function(e,r,i,a){let[o,s,c]=findRelevantNodeData(this,t,n,e,r,i,a);return o.attributes[s]=c,this.emit(`nodeAttributesUpdated`,{key:o.key,type:`set`,attributes:o.attributes,name:s}),this}}function attachNodeAttributeUpdater(e,t,r){e.prototype[t]=function(e,i,a,o){let[s,c,l]=findRelevantNodeData(this,t,r,e,i,a,o);if(typeof l!=`function`)throw new n(`Graph.${t}: updater should be a function.`);let u=s.attributes;return u[c]=l(u[c]),this.emit(`nodeAttributesUpdated`,{key:s.key,type:`set`,attributes:s.attributes,name:c}),this}}function attachNodeAttributeRemover(e,t,n){e.prototype[t]=function(e,r,i){let[a,o]=findRelevantNodeData(this,t,n,e,r,i);return delete a.attributes[o],this.emit(`nodeAttributesUpdated`,{key:a.key,type:`remove`,attributes:a.attributes,name:o}),this}}function attachNodeAttributesReplacer(e,t,r){e.prototype[t]=function(e,i,a){let[o,s]=findRelevantNodeData(this,t,r,e,i,a);if(!isPlainObject(s))throw new n(`Graph.${t}: provided attributes are not a plain object.`);return o.attributes=s,this.emit(`nodeAttributesUpdated`,{key:o.key,type:`replace`,attributes:o.attributes}),this}}function attachNodeAttributesMerger(e,r,i){e.prototype[r]=function(e,a,o){let[s,c]=findRelevantNodeData(this,r,i,e,a,o);if(!isPlainObject(c))throw new n(`Graph.${r}: provided attributes are not a plain object.`);return t(s.attributes,c),this.emit(`nodeAttributesUpdated`,{key:s.key,type:`merge`,attributes:s.attributes,data:c}),this}}function attachNodeAttributesUpdater(e,t,r){e.prototype[t]=function(e,i,a){let[o,s]=findRelevantNodeData(this,t,r,e,i,a);if(typeof s!=`function`)throw new n(`Graph.${t}: provided updater is not a function.`);return o.attributes=s(o.attributes),this.emit(`nodeAttributesUpdated`,{key:o.key,type:`update`,attributes:o.attributes}),this}}const a=[{name:e=>`get${e}Attribute`,attacher:attachNodeAttributeGetter},{name:e=>`get${e}Attributes`,attacher:attachNodeAttributesGetter},{name:e=>`has${e}Attribute`,attacher:attachNodeAttributeChecker},{name:e=>`set${e}Attribute`,attacher:attachNodeAttributeSetter},{name:e=>`update${e}Attribute`,attacher:attachNodeAttributeUpdater},{name:e=>`remove${e}Attribute`,attacher:attachNodeAttributeRemover},{name:e=>`replace${e}Attributes`,attacher:attachNodeAttributesReplacer},{name:e=>`merge${e}Attributes`,attacher:attachNodeAttributesMerger},{name:e=>`update${e}Attributes`,attacher:attachNodeAttributesUpdater}];function attachNodeAttributesMethods(e){a.forEach(function({name:t,attacher:n}){n(e,t(`Node`),0),n(e,t(`Source`),1),n(e,t(`Target`),2),n(e,t(`Opposite`),3)})}function attachEdgeAttributeGetter(e,t,n){e.prototype[t]=function(e,a){let o;if(this.type!==`mixed`&&n!==`mixed`&&n!==this.type)throw new i(`Graph.${t}: cannot find this type of edges in your ${this.type} graph.`);if(arguments.length>2){if(this.multi)throw new i(`Graph.${t}: cannot use a {source,target} combo when asking about an edge's attributes in a MultiGraph since we cannot infer the one you want information about.`);let s=``+e,c=``+a;if(a=arguments[2],o=getMatchingEdge(this,s,c,n),!o)throw new r(`Graph.${t}: could not find an edge for the given path ("${s}" - "${c}").`)}else{if(n!==`mixed`)throw new i(`Graph.${t}: calling this method with only a key (vs. a source and target) does not make sense since an edge with this key could have the other type.`);if(e=``+e,o=this._edges.get(e),!o)throw new r(`Graph.${t}: could not find the "${e}" edge in the graph.`)}return o.attributes[a]}}function attachEdgeAttributesGetter(e,t,n){e.prototype[t]=function(e){let a;if(this.type!==`mixed`&&n!==`mixed`&&n!==this.type)throw new i(`Graph.${t}: cannot find this type of edges in your ${this.type} graph.`);if(arguments.length>1){if(this.multi)throw new i(`Graph.${t}: cannot use a {source,target} combo when asking about an edge's attributes in a MultiGraph since we cannot infer the one you want information about.`);let o=``+e,s=``+arguments[1];if(a=getMatchingEdge(this,o,s,n),!a)throw new r(`Graph.${t}: could not find an edge for the given path ("${o}" - "${s}").`)}else{if(n!==`mixed`)throw new i(`Graph.${t}: calling this method with only a key (vs. a source and target) does not make sense since an edge with this key could have the other type.`);if(e=``+e,a=this._edges.get(e),!a)throw new r(`Graph.${t}: could not find the "${e}" edge in the graph.`)}return a.attributes}}function attachEdgeAttributeChecker(e,t,n){e.prototype[t]=function(e,a){let o;if(this.type!==`mixed`&&n!==`mixed`&&n!==this.type)throw new i(`Graph.${t}: cannot find this type of edges in your ${this.type} graph.`);if(arguments.length>2){if(this.multi)throw new i(`Graph.${t}: cannot use a {source,target} combo when asking about an edge's attributes in a MultiGraph since we cannot infer the one you want information about.`);let s=``+e,c=``+a;if(a=arguments[2],o=getMatchingEdge(this,s,c,n),!o)throw new r(`Graph.${t}: could not find an edge for the given path ("${s}" - "${c}").`)}else{if(n!==`mixed`)throw new i(`Graph.${t}: calling this method with only a key (vs. a source and target) does not make sense since an edge with this key could have the other type.`);if(e=``+e,o=this._edges.get(e),!o)throw new r(`Graph.${t}: could not find the "${e}" edge in the graph.`)}return o.attributes.hasOwnProperty(a)}}function attachEdgeAttributeSetter(e,t,n){e.prototype[t]=function(e,a,o){let s;if(this.type!==`mixed`&&n!==`mixed`&&n!==this.type)throw new i(`Graph.${t}: cannot find this type of edges in your ${this.type} graph.`);if(arguments.length>3){if(this.multi)throw new i(`Graph.${t}: cannot use a {source,target} combo when asking about an edge's attributes in a MultiGraph since we cannot infer the one you want information about.`);let c=``+e,l=``+a;if(a=arguments[2],o=arguments[3],s=getMatchingEdge(this,c,l,n),!s)throw new r(`Graph.${t}: could not find an edge for the given path ("${c}" - "${l}").`)}else{if(n!==`mixed`)throw new i(`Graph.${t}: calling this method with only a key (vs. a source and target) does not make sense since an edge with this key could have the other type.`);if(e=``+e,s=this._edges.get(e),!s)throw new r(`Graph.${t}: could not find the "${e}" edge in the graph.`)}return s.attributes[a]=o,this.emit(`edgeAttributesUpdated`,{key:s.key,type:`set`,attributes:s.attributes,name:a}),this}}function attachEdgeAttributeUpdater(e,t,a){e.prototype[t]=function(e,o,s){let c;if(this.type!==`mixed`&&a!==`mixed`&&a!==this.type)throw new i(`Graph.${t}: cannot find this type of edges in your ${this.type} graph.`);if(arguments.length>3){if(this.multi)throw new i(`Graph.${t}: cannot use a {source,target} combo when asking about an edge's attributes in a MultiGraph since we cannot infer the one you want information about.`);let n=``+e,l=``+o;if(o=arguments[2],s=arguments[3],c=getMatchingEdge(this,n,l,a),!c)throw new r(`Graph.${t}: could not find an edge for the given path ("${n}" - "${l}").`)}else{if(a!==`mixed`)throw new i(`Graph.${t}: calling this method with only a key (vs. a source and target) does not make sense since an edge with this key could have the other type.`);if(e=``+e,c=this._edges.get(e),!c)throw new r(`Graph.${t}: could not find the "${e}" edge in the graph.`)}if(typeof s!=`function`)throw new n(`Graph.${t}: updater should be a function.`);return c.attributes[o]=s(c.attributes[o]),this.emit(`edgeAttributesUpdated`,{key:c.key,type:`set`,attributes:c.attributes,name:o}),this}}function attachEdgeAttributeRemover(e,t,n){e.prototype[t]=function(e,a){let o;if(this.type!==`mixed`&&n!==`mixed`&&n!==this.type)throw new i(`Graph.${t}: cannot find this type of edges in your ${this.type} graph.`);if(arguments.length>2){if(this.multi)throw new i(`Graph.${t}: cannot use a {source,target} combo when asking about an edge's attributes in a MultiGraph since we cannot infer the one you want information about.`);let s=``+e,c=``+a;if(a=arguments[2],o=getMatchingEdge(this,s,c,n),!o)throw new r(`Graph.${t}: could not find an edge for the given path ("${s}" - "${c}").`)}else{if(n!==`mixed`)throw new i(`Graph.${t}: calling this method with only a key (vs. a source and target) does not make sense since an edge with this key could have the other type.`);if(e=``+e,o=this._edges.get(e),!o)throw new r(`Graph.${t}: could not find the "${e}" edge in the graph.`)}return delete o.attributes[a],this.emit(`edgeAttributesUpdated`,{key:o.key,type:`remove`,attributes:o.attributes,name:a}),this}}function attachEdgeAttributesReplacer(e,t,a){e.prototype[t]=function(e,o){let s;if(this.type!==`mixed`&&a!==`mixed`&&a!==this.type)throw new i(`Graph.${t}: cannot find this type of edges in your ${this.type} graph.`);if(arguments.length>2){if(this.multi)throw new i(`Graph.${t}: cannot use a {source,target} combo when asking about an edge's attributes in a MultiGraph since we cannot infer the one you want information about.`);let n=``+e,c=``+o;if(o=arguments[2],s=getMatchingEdge(this,n,c,a),!s)throw new r(`Graph.${t}: could not find an edge for the given path ("${n}" - "${c}").`)}else{if(a!==`mixed`)throw new i(`Graph.${t}: calling this method with only a key (vs. a source and target) does not make sense since an edge with this key could have the other type.`);if(e=``+e,s=this._edges.get(e),!s)throw new r(`Graph.${t}: could not find the "${e}" edge in the graph.`)}if(!isPlainObject(o))throw new n(`Graph.${t}: provided attributes are not a plain object.`);return s.attributes=o,this.emit(`edgeAttributesUpdated`,{key:s.key,type:`replace`,attributes:s.attributes}),this}}function attachEdgeAttributesMerger(e,a,o){e.prototype[a]=function(e,s){let c;if(this.type!==`mixed`&&o!==`mixed`&&o!==this.type)throw new i(`Graph.${a}: cannot find this type of edges in your ${this.type} graph.`);if(arguments.length>2){if(this.multi)throw new i(`Graph.${a}: cannot use a {source,target} combo when asking about an edge's attributes in a MultiGraph since we cannot infer the one you want information about.`);let t=``+e,n=``+s;if(s=arguments[2],c=getMatchingEdge(this,t,n,o),!c)throw new r(`Graph.${a}: could not find an edge for the given path ("${t}" - "${n}").`)}else{if(o!==`mixed`)throw new i(`Graph.${a}: calling this method with only a key (vs. a source and target) does not make sense since an edge with this key could have the other type.`);if(e=``+e,c=this._edges.get(e),!c)throw new r(`Graph.${a}: could not find the "${e}" edge in the graph.`)}if(!isPlainObject(s))throw new n(`Graph.${a}: provided attributes are not a plain object.`);return t(c.attributes,s),this.emit(`edgeAttributesUpdated`,{key:c.key,type:`merge`,attributes:c.attributes,data:s}),this}}function attachEdgeAttributesUpdater(e,t,a){e.prototype[t]=function(e,o){let s;if(this.type!==`mixed`&&a!==`mixed`&&a!==this.type)throw new i(`Graph.${t}: cannot find this type of edges in your ${this.type} graph.`);if(arguments.length>2){if(this.multi)throw new i(`Graph.${t}: cannot use a {source,target} combo when asking about an edge's attributes in a MultiGraph since we cannot infer the one you want information about.`);let n=``+e,c=``+o;if(o=arguments[2],s=getMatchingEdge(this,n,c,a),!s)throw new r(`Graph.${t}: could not find an edge for the given path ("${n}" - "${c}").`)}else{if(a!==`mixed`)throw new i(`Graph.${t}: calling this method with only a key (vs. a source and target) does not make sense since an edge with this key could have the other type.`);if(e=``+e,s=this._edges.get(e),!s)throw new r(`Graph.${t}: could not find the "${e}" edge in the graph.`)}if(typeof o!=`function`)throw new n(`Graph.${t}: provided updater is not a function.`);return s.attributes=o(s.attributes),this.emit(`edgeAttributesUpdated`,{key:s.key,type:`update`,attributes:s.attributes}),this}}const o=[{name:e=>`get${e}Attribute`,attacher:attachEdgeAttributeGetter},{name:e=>`get${e}Attributes`,attacher:attachEdgeAttributesGetter},{name:e=>`has${e}Attribute`,attacher:attachEdgeAttributeChecker},{name:e=>`set${e}Attribute`,attacher:attachEdgeAttributeSetter},{name:e=>`update${e}Attribute`,attacher:attachEdgeAttributeUpdater},{name:e=>`remove${e}Attribute`,attacher:attachEdgeAttributeRemover},{name:e=>`replace${e}Attributes`,attacher:attachEdgeAttributesReplacer},{name:e=>`merge${e}Attributes`,attacher:attachEdgeAttributesMerger},{name:e=>`update${e}Attributes`,attacher:attachEdgeAttributesUpdater}];function attachEdgeAttributesMethods(e){o.forEach(function({name:t,attacher:n}){n(e,t(`Edge`),`mixed`),n(e,t(`DirectedEdge`),`directed`),n(e,t(`UndirectedEdge`),`undirected`)})}const s=[{name:`edges`,type:`mixed`},{name:`inEdges`,type:`directed`,direction:`in`},{name:`outEdges`,type:`directed`,direction:`out`},{name:`inboundEdges`,type:`mixed`,direction:`in`},{name:`outboundEdges`,type:`mixed`,direction:`out`},{name:`directedEdges`,type:`directed`},{name:`undirectedEdges`,type:`undirected`}];function forEachSimple(e,t,n,r){let i=!1;for(let a in t){if(a===r)continue;let o=t[a];if(i=n(o.key,o.attributes,o.source.key,o.target.key,o.source.attributes,o.target.attributes,o.undirected),e&&i)return o.key}}function forEachMulti(e,t,n,r){let i,a,o,s=!1;for(let c in t)if(c!==r){i=t[c];do{if(a=i.source,o=i.target,s=n(i.key,i.attributes,a.key,o.key,a.attributes,o.attributes,i.undirected),e&&s)return i.key;i=i.next}while(i!==void 0)}}function createIterator(e,t){let n=Object.keys(e),r=n.length,i,a=0;return{[Symbol.iterator](){return this},next(){do if(i)i=i.next;else{if(a>=r)return{done:!0};let o=n[a++];if(o===t){i=void 0;continue}i=e[o]}while(!i);return{done:!1,value:{edge:i.key,attributes:i.attributes,source:i.source.key,target:i.target.key,sourceAttributes:i.source.attributes,targetAttributes:i.target.attributes,undirected:i.undirected}}}}}function forEachForKeySimple(e,t,n,r){let i=t[n];if(!i)return;let a=i.source,o=i.target;if(r(i.key,i.attributes,a.key,o.key,a.attributes,o.attributes,i.undirected)&&e)return i.key}function forEachForKeyMulti(e,t,n,r){let i=t[n];if(!i)return;let a=!1;do{if(a=r(i.key,i.attributes,i.source.key,i.target.key,i.source.attributes,i.target.attributes,i.undirected),e&&a)return i.key;i=i.next}while(i!==void 0)}function createIteratorForKey(e,t){let n=e[t];if(n.next!==void 0)return{[Symbol.iterator](){return this},next(){if(!n)return{done:!0};let e={edge:n.key,attributes:n.attributes,source:n.source.key,target:n.target.key,sourceAttributes:n.source.attributes,targetAttributes:n.target.attributes,undirected:n.undirected};return n=n.next,{done:!1,value:e}}};let r=!1;return{[Symbol.iterator](){return this},next(){return r===!0?{done:!0}:(r=!0,{done:!1,value:{edge:n.key,attributes:n.attributes,source:n.source.key,target:n.target.key,sourceAttributes:n.source.attributes,targetAttributes:n.target.attributes,undirected:n.undirected}})}}}function createEdgeArray(e,t){if(e.size===0)return[];if(t===`mixed`||t===e.type)return Array.from(e._edges.keys());let n=t===`undirected`?e.undirectedSize:e.directedSize,r=Array(n),i=t===`undirected`,a=e._edges.values(),o=0,s,c;for(;s=a.next(),s.done!==!0;)c=s.value,c.undirected===i&&(r[o++]=c.key);return r}function forEachEdge(e,t,n,r){if(t.size===0)return;let i=n!==`mixed`&&n!==t.type,a=n===`undirected`,o,s,c=!1,l=t._edges.values();for(;o=l.next(),o.done!==!0;){if(s=o.value,i&&s.undirected!==a)continue;let{key:t,attributes:n,source:l,target:u}=s;if(c=r(t,n,l.key,u.key,l.attributes,u.attributes,s.undirected),e&&c)return t}}function createEdgeIterator(e,t){if(e.size===0)return emptyIterator();let n=t!==`mixed`&&t!==e.type,r=t===`undirected`,i=e._edges.values();return{[Symbol.iterator](){return this},next(){let e,t;for(;;){if(e=i.next(),e.done)return e;if(t=e.value,!(n&&t.undirected!==r))break}return{value:{edge:t.key,attributes:t.attributes,source:t.source.key,target:t.target.key,sourceAttributes:t.source.attributes,targetAttributes:t.target.attributes,undirected:t.undirected},done:!1}}}}function forEachEdgeForNode(e,t,n,r,i,a){let o=t?forEachMulti:forEachSimple,s;if(n!==`undirected`&&(r!==`out`&&(s=o(e,i.in,a),e&&s)||r!==`in`&&(s=o(e,i.out,a,r?void 0:i.key),e&&s))||n!==`directed`&&(s=o(e,i.undirected,a),e&&s))return s}function createEdgeArrayForNode(e,t,n,r){let i=[];return forEachEdgeForNode(!1,e,t,n,r,function(e){i.push(e)}),i}function createEdgeIteratorForNode(e,t,n){let r=emptyIterator();return e!==`undirected`&&(t!==`out`&&n.in!==void 0&&(r=chain(r,createIterator(n.in))),t!==`in`&&n.out!==void 0&&(r=chain(r,createIterator(n.out,t?void 0:n.key)))),e!==`directed`&&n.undirected!==void 0&&(r=chain(r,createIterator(n.undirected))),r}function forEachEdgeForPath(e,t,n,r,i,a,o){let s=n?forEachForKeyMulti:forEachForKeySimple,c;if(t!==`undirected`&&(i.in!==void 0&&r!==`out`&&(c=s(e,i.in,a,o),e&&c)||i.out!==void 0&&r!==`in`&&(r||i.key!==a)&&(c=s(e,i.out,a,o),e&&c))||t!==`directed`&&i.undirected!==void 0&&(c=s(e,i.undirected,a,o),e&&c))return c}function createEdgeArrayForPath(e,t,n,r,i){let a=[];return forEachEdgeForPath(!1,e,t,n,r,i,function(e){a.push(e)}),a}function createEdgeIteratorForPath(e,t,n,r){let i=emptyIterator();return e!==`undirected`&&(n.in!==void 0&&t!==`out`&&r in n.in&&(i=chain(i,createIteratorForKey(n.in,r))),n.out!==void 0&&t!==`in`&&r in n.out&&(t||n.key!==r)&&(i=chain(i,createIteratorForKey(n.out,r)))),e!==`directed`&&n.undirected!==void 0&&r in n.undirected&&(i=chain(i,createIteratorForKey(n.undirected,r))),i}function attachEdgeArrayCreator(e,t){let{name:i,type:a,direction:o}=t;e.prototype[i]=function(e,t){if(a!==`mixed`&&this.type!==`mixed`&&a!==this.type)return[];if(!arguments.length)return createEdgeArray(this,a);if(arguments.length===1){e=``+e;let t=this._nodes.get(e);if(t===void 0)throw new r(`Graph.${i}: could not find the "${e}" node in the graph.`);return createEdgeArrayForNode(this.multi,a===`mixed`?this.type:a,o,t)}if(arguments.length===2){e=``+e,t=``+t;let n=this._nodes.get(e);if(!n)throw new r(`Graph.${i}: could not find the "${e}" source node in the graph.`);if(!this._nodes.has(t))throw new r(`Graph.${i}: could not find the "${t}" target node in the graph.`);return createEdgeArrayForPath(a,this.multi,o,n,t)}throw new n(`Graph.${i}: too many arguments (expecting 0, 1 or 2 and got ${arguments.length}).`)}}function attachForEachEdge(e,t){let{name:i,type:a,direction:o}=t,s=`forEach`+i[0].toUpperCase()+i.slice(1,-1);e.prototype[s]=function(e,t,i){if(a===`mixed`||this.type===`mixed`||a===this.type){if(arguments.length===1)return i=e,forEachEdge(!1,this,a,i);if(arguments.length===2){e=``+e,i=t;let n=this._nodes.get(e);if(n===void 0)throw new r(`Graph.${s}: could not find the "${e}" node in the graph.`);return forEachEdgeForNode(!1,this.multi,a===`mixed`?this.type:a,o,n,i)}if(arguments.length===3){e=``+e,t=``+t;let n=this._nodes.get(e);if(!n)throw new r(`Graph.${s}: could not find the "${e}" source node in the graph.`);if(!this._nodes.has(t))throw new r(`Graph.${s}: could not find the "${t}" target node in the graph.`);return forEachEdgeForPath(!1,a,this.multi,o,n,t,i)}throw new n(`Graph.${s}: too many arguments (expecting 1, 2 or 3 and got ${arguments.length}).`)}};let c=`map`+i[0].toUpperCase()+i.slice(1);e.prototype[c]=function(){let e=Array.prototype.slice.call(arguments),t=e.pop(),n;if(e.length===0){let r=0;a!==`directed`&&(r+=this.undirectedSize),a!==`undirected`&&(r+=this.directedSize),n=Array(r);let i=0;e.push((e,r,a,o,s,c,l)=>{n[i++]=t(e,r,a,o,s,c,l)})}else n=[],e.push((e,r,i,a,o,s,c)=>{n.push(t(e,r,i,a,o,s,c))});return this[s].apply(this,e),n};let l=`filter`+i[0].toUpperCase()+i.slice(1);e.prototype[l]=function(){let e=Array.prototype.slice.call(arguments),t=e.pop(),n=[];return e.push((e,r,i,a,o,s,c)=>{t(e,r,i,a,o,s,c)&&n.push(e)}),this[s].apply(this,e),n};let u=`reduce`+i[0].toUpperCase()+i.slice(1);e.prototype[u]=function(){let e=Array.prototype.slice.call(arguments);if(e.length<2||e.length>4)throw new n(`Graph.${u}: invalid number of arguments (expecting 2, 3 or 4 and got ${e.length}).`);if(typeof e[e.length-1]==`function`&&typeof e[e.length-2]!=`function`)throw new n(`Graph.${u}: missing initial value. You must provide it because the callback takes more than one argument and we cannot infer the initial value from the first iteration, as you could with a simple array.`);let t,r;e.length===2?(t=e[0],r=e[1],e=[]):e.length===3?(t=e[1],r=e[2],e=[e[0]]):e.length===4&&(t=e[2],r=e[3],e=[e[0],e[1]]);let i=r;return e.push((e,n,r,a,o,s,c)=>{i=t(i,e,n,r,a,o,s,c)}),this[s].apply(this,e),i}}function attachFindEdge(e,t){let{name:i,type:a,direction:o}=t,s=`find`+i[0].toUpperCase()+i.slice(1,-1);e.prototype[s]=function(e,t,i){if(a!==`mixed`&&this.type!==`mixed`&&a!==this.type)return!1;if(arguments.length===1)return i=e,forEachEdge(!0,this,a,i);if(arguments.length===2){e=``+e,i=t;let n=this._nodes.get(e);if(n===void 0)throw new r(`Graph.${s}: could not find the "${e}" node in the graph.`);return forEachEdgeForNode(!0,this.multi,a===`mixed`?this.type:a,o,n,i)}if(arguments.length===3){e=``+e,t=``+t;let n=this._nodes.get(e);if(!n)throw new r(`Graph.${s}: could not find the "${e}" source node in the graph.`);if(!this._nodes.has(t))throw new r(`Graph.${s}: could not find the "${t}" target node in the graph.`);return forEachEdgeForPath(!0,a,this.multi,o,n,t,i)}throw new n(`Graph.${s}: too many arguments (expecting 1, 2 or 3 and got ${arguments.length}).`)};let c=`some`+i[0].toUpperCase()+i.slice(1,-1);e.prototype[c]=function(){let e=Array.prototype.slice.call(arguments),t=e.pop();return e.push((e,n,r,i,a,o,s)=>t(e,n,r,i,a,o,s)),!!this[s].apply(this,e)};let l=`every`+i[0].toUpperCase()+i.slice(1,-1);e.prototype[l]=function(){let e=Array.prototype.slice.call(arguments),t=e.pop();return e.push((e,n,r,i,a,o,s)=>!t(e,n,r,i,a,o,s)),!this[s].apply(this,e)}}function attachEdgeIteratorCreator(e,t){let{name:i,type:a,direction:o}=t,s=i.slice(0,-1)+`Entries`;e.prototype[s]=function(e,t){if(a!==`mixed`&&this.type!==`mixed`&&a!==this.type)return emptyIterator();if(!arguments.length)return createEdgeIterator(this,a);if(arguments.length===1){e=``+e;let t=this._nodes.get(e);if(!t)throw new r(`Graph.${s}: could not find the "${e}" node in the graph.`);return createEdgeIteratorForNode(a,o,t)}if(arguments.length===2){e=``+e,t=``+t;let n=this._nodes.get(e);if(!n)throw new r(`Graph.${s}: could not find the "${e}" source node in the graph.`);if(!this._nodes.has(t))throw new r(`Graph.${s}: could not find the "${t}" target node in the graph.`);return createEdgeIteratorForPath(a,o,n,t)}throw new n(`Graph.${s}: too many arguments (expecting 0, 1 or 2 and got ${arguments.length}).`)}}function attachEdgeIterationMethods(e){s.forEach(t=>{attachEdgeArrayCreator(e,t),attachForEachEdge(e,t),attachFindEdge(e,t),attachEdgeIteratorCreator(e,t)})}const c=[{name:`neighbors`,type:`mixed`},{name:`inNeighbors`,type:`directed`,direction:`in`},{name:`outNeighbors`,type:`directed`,direction:`out`},{name:`inboundNeighbors`,type:`mixed`,direction:`in`},{name:`outboundNeighbors`,type:`mixed`,direction:`out`},{name:`directedNeighbors`,type:`directed`},{name:`undirectedNeighbors`,type:`undirected`}];function CompositeSetWrapper(){this.A=null,this.B=null}CompositeSetWrapper.prototype.wrap=function(e){this.A===null?this.A=e:this.B===null&&(this.B=e)},CompositeSetWrapper.prototype.has=function(e){return this.A!==null&&e in this.A||this.B!==null&&e in this.B};function forEachInObjectOnce(e,t,n,r,i){for(let a in r){let o=r[a],s=o.source,c=o.target,l=s===n?c:s;if(t&&t.has(l.key))continue;let u=i(l.key,l.attributes);if(e&&u)return l.key}}function forEachNeighbor(e,t,n,r,i){if(t!==`mixed`){if(t===`undirected`)return forEachInObjectOnce(e,null,r,r.undirected,i);if(typeof n==`string`)return forEachInObjectOnce(e,null,r,r[n],i)}let a=new CompositeSetWrapper,o;if(t!==`undirected`){if(n!==`out`){if(o=forEachInObjectOnce(e,null,r,r.in,i),e&&o)return o;a.wrap(r.in)}if(n!==`in`){if(o=forEachInObjectOnce(e,a,r,r.out,i),e&&o)return o;a.wrap(r.out)}}if(t!==`directed`&&(o=forEachInObjectOnce(e,a,r,r.undirected,i),e&&o))return o}function createNeighborArrayForNode(e,t,n){if(e!==`mixed`){if(e===`undirected`)return Object.keys(n.undirected);if(typeof t==`string`)return Object.keys(n[t])}let r=[];return forEachNeighbor(!1,e,t,n,function(e){r.push(e)}),r}function createDedupedObjectIterator(e,t,n){let r=Object.keys(n),i=r.length,a=0;return{[Symbol.iterator](){return this},next(){let o=null;do{if(a>=i)return e&&e.wrap(n),{done:!0};let s=n[r[a++]],c=s.source,l=s.target;if(o=c===t?l:c,e&&e.has(o.key)){o=null;continue}}while(o===null);return{done:!1,value:{neighbor:o.key,attributes:o.attributes}}}}}function createNeighborIterator(e,t,n){if(e!==`mixed`){if(e===`undirected`)return createDedupedObjectIterator(null,n,n.undirected);if(typeof t==`string`)return createDedupedObjectIterator(null,n,n[t])}let r=emptyIterator(),i=new CompositeSetWrapper;return e!==`undirected`&&(t!==`out`&&(r=chain(r,createDedupedObjectIterator(i,n,n.in))),t!==`in`&&(r=chain(r,createDedupedObjectIterator(i,n,n.out)))),e!==`directed`&&(r=chain(r,createDedupedObjectIterator(i,n,n.undirected))),r}function attachNeighborArrayCreator(e,t){let{name:n,type:i,direction:a}=t;e.prototype[n]=function(e){if(i!==`mixed`&&this.type!==`mixed`&&i!==this.type)return[];e=``+e;let t=this._nodes.get(e);if(t===void 0)throw new r(`Graph.${n}: could not find the "${e}" node in the graph.`);return createNeighborArrayForNode(i===`mixed`?this.type:i,a,t)}}function attachForEachNeighbor(e,t){let{name:i,type:a,direction:o}=t,s=`forEach`+i[0].toUpperCase()+i.slice(1,-1);e.prototype[s]=function(e,t){if(a!==`mixed`&&this.type!==`mixed`&&a!==this.type)return;e=``+e;let n=this._nodes.get(e);if(n===void 0)throw new r(`Graph.${s}: could not find the "${e}" node in the graph.`);forEachNeighbor(!1,a===`mixed`?this.type:a,o,n,t)};let c=`map`+i[0].toUpperCase()+i.slice(1);e.prototype[c]=function(e,t){let n=[];return this[s](e,(e,r)=>{n.push(t(e,r))}),n};let l=`filter`+i[0].toUpperCase()+i.slice(1);e.prototype[l]=function(e,t){let n=[];return this[s](e,(e,r)=>{t(e,r)&&n.push(e)}),n};let u=`reduce`+i[0].toUpperCase()+i.slice(1);e.prototype[u]=function(e,t,r){if(arguments.length<3)throw new n(`Graph.${u}: missing initial value. You must provide it because the callback takes more than one argument and we cannot infer the initial value from the first iteration, as you could with a simple array.`);let i=r;return this[s](e,(e,n)=>{i=t(i,e,n)}),i}}function attachFindNeighbor(e,t){let{name:n,type:i,direction:a}=t,o=n[0].toUpperCase()+n.slice(1,-1),s=`find`+o;e.prototype[s]=function(e,t){if(i!==`mixed`&&this.type!==`mixed`&&i!==this.type)return;e=``+e;let n=this._nodes.get(e);if(n===void 0)throw new r(`Graph.${s}: could not find the "${e}" node in the graph.`);return forEachNeighbor(!0,i===`mixed`?this.type:i,a,n,t)};let c=`some`+o;e.prototype[c]=function(e,t){return!!this[s](e,t)};let l=`every`+o;e.prototype[l]=function(e,t){return!this[s](e,(e,n)=>!t(e,n))}}function attachNeighborIteratorCreator(e,t){let{name:n,type:i,direction:a}=t,o=n.slice(0,-1)+`Entries`;e.prototype[o]=function(e){if(i!==`mixed`&&this.type!==`mixed`&&i!==this.type)return emptyIterator();e=``+e;let t=this._nodes.get(e);if(t===void 0)throw new r(`Graph.${o}: could not find the "${e}" node in the graph.`);return createNeighborIterator(i===`mixed`?this.type:i,a,t)}}function attachNeighborIterationMethods(e){c.forEach(t=>{attachNeighborArrayCreator(e,t),attachForEachNeighbor(e,t),attachFindNeighbor(e,t),attachNeighborIteratorCreator(e,t)})}function forEachAdjacency(e,t,n,r,i){let a=r._nodes.values(),o=r.type,s,c,l,u,d,f,p;for(;s=a.next(),s.done!==!0;){let r=!1;if(c=s.value,o!==`undirected`)for(l in u=c.out,u){d=u[l];do{if(f=d.target,r=!0,p=i(c.key,f.key,c.attributes,f.attributes,d.key,d.attributes,d.undirected),e&&p)return d;d=d.next}while(d)}if(o!==`directed`){for(l in u=c.undirected,u)if(!(t&&c.key>l)){d=u[l];do{if(f=d.target,f.key!==l&&(f=d.source),r=!0,p=i(c.key,f.key,c.attributes,f.attributes,d.key,d.attributes,d.undirected),e&&p)return d;d=d.next}while(d)}}if(n&&!r&&(p=i(c.key,null,c.attributes,null,null,null,null),e&&p))return null}}function serializeNode(e,n){let r={key:e};return isEmpty(n.attributes)||(r.attributes=t({},n.attributes)),r}function serializeEdge(e,n,r){let i={key:n,source:r.source.key,target:r.target.key};return isEmpty(r.attributes)||(i.attributes=t({},r.attributes)),e===`mixed`&&r.undirected&&(i.undirected=!0),i}function validateSerializedNode(e){if(!isPlainObject(e))throw new n(`Graph.import: invalid serialized node. A serialized node should be a plain object with at least a "key" property.`);if(!(`key`in e))throw new n(`Graph.import: serialized node is missing its key.`);if(`attributes`in e&&(!isPlainObject(e.attributes)||e.attributes===null))throw new n(`Graph.import: invalid attributes. Attributes should be a plain object, null or omitted.`)}function validateSerializedEdge(e){if(!isPlainObject(e))throw new n(`Graph.import: invalid serialized edge. A serialized edge should be a plain object with at least a "source" & "target" property.`);if(!(`source`in e))throw new n(`Graph.import: serialized edge is missing its source.`);if(!(`target`in e))throw new n(`Graph.import: serialized edge is missing its target.`);if(`attributes`in e&&(!isPlainObject(e.attributes)||e.attributes===null))throw new n(`Graph.import: invalid attributes. Attributes should be a plain object, null or omitted.`);if(`undirected`in e&&typeof e.undirected!=`boolean`)throw new n(`Graph.import: invalid undirectedness information. Undirected should be boolean or omitted.`)}const l=incrementalIdStartingFromRandomByte(),u=new Set([`directed`,`undirected`,`mixed`]),d=new Set([`domain`,`_events`,`_eventsCount`,`_maxListeners`]),f=[{name:e=>`${e}Edge`,generateKey:!0},{name:e=>`${e}DirectedEdge`,generateKey:!0,type:`directed`},{name:e=>`${e}UndirectedEdge`,generateKey:!0,type:`undirected`},{name:e=>`${e}EdgeWithKey`},{name:e=>`${e}DirectedEdgeWithKey`,type:`directed`},{name:e=>`${e}UndirectedEdgeWithKey`,type:`undirected`}],p={allowSelfLoops:!0,multi:!1,type:`mixed`};function addNode(e,t,r){if(r&&!isPlainObject(r))throw new n(`Graph.addNode: invalid attributes. Expecting an object but got "${r}"`);if(t=``+t,r||={},e._nodes.has(t))throw new i(`Graph.addNode: the "${t}" node already exist in the graph.`);let a=new e.NodeDataClass(t,r);return e._nodes.set(t,a),e.emit(`nodeAdded`,{key:t,attributes:r}),a}function unsafeAddNode(e,t,n){let r=new e.NodeDataClass(t,n);return e._nodes.set(t,r),e.emit(`nodeAdded`,{key:t,attributes:n}),r}function addEdge(e,t,a,o,s,c,l,u){if(!o&&e.type===`undirected`)throw new i(`Graph.${t}: you cannot add a directed edge to an undirected graph. Use the #.addEdge or #.addUndirectedEdge instead.`);if(o&&e.type===`directed`)throw new i(`Graph.${t}: you cannot add an undirected edge to a directed graph. Use the #.addEdge or #.addDirectedEdge instead.`);if(u&&!isPlainObject(u))throw new n(`Graph.${t}: invalid attributes. Expecting an object but got "${u}"`);if(c=``+c,l=``+l,u||={},!e.allowSelfLoops&&c===l)throw new i(`Graph.${t}: source & target are the same ("${c}"), thus creating a loop explicitly forbidden by this graph 'allowSelfLoops' option set to false.`);let d=e._nodes.get(c),f=e._nodes.get(l);if(!d)throw new r(`Graph.${t}: source node "${c}" not found.`);if(!f)throw new r(`Graph.${t}: target node "${l}" not found.`);let p={key:null,undirected:o,source:c,target:l,attributes:u};if(a)s=e._edgeKeyGenerator();else if(s=``+s,e._edges.has(s))throw new i(`Graph.${t}: the "${s}" edge already exists in the graph.`);if(!e.multi&&(o?d.undirected[l]!==void 0:d.out[l]!==void 0))throw new i(`Graph.${t}: an edge linking "${c}" to "${l}" already exists. If you really want to add multiple edges linking those nodes, you should create a multi graph by using the 'multi' option.`);let m=new EdgeData(o,s,d,f,u);e._edges.set(s,m);let h=c===l;return o?(d.undirectedDegree++,f.undirectedDegree++,h&&(d.undirectedLoops++,e._undirectedSelfLoopCount++)):(d.outDegree++,f.inDegree++,h&&(d.directedLoops++,e._directedSelfLoopCount++)),e.multi?m.attachMulti():m.attach(),o?e._undirectedSize++:e._directedSize++,p.key=s,e.emit(`edgeAdded`,p),s}function mergeEdge(e,r,a,o,s,c,l,u,d){if(!o&&e.type===`undirected`)throw new i(`Graph.${r}: you cannot merge/update a directed edge to an undirected graph. Use the #.mergeEdge/#.updateEdge or #.addUndirectedEdge instead.`);if(o&&e.type===`directed`)throw new i(`Graph.${r}: you cannot merge/update an undirected edge to a directed graph. Use the #.mergeEdge/#.updateEdge or #.addDirectedEdge instead.`);if(u){if(d){if(typeof u!=`function`)throw new n(`Graph.${r}: invalid updater function. Expecting a function but got "${u}"`)}else if(!isPlainObject(u))throw new n(`Graph.${r}: invalid attributes. Expecting an object but got "${u}"`)}c=``+c,l=``+l;let f;if(d&&(f=u,u=void 0),!e.allowSelfLoops&&c===l)throw new i(`Graph.${r}: source & target are the same ("${c}"), thus creating a loop explicitly forbidden by this graph 'allowSelfLoops' option set to false.`);let p=e._nodes.get(c),m=e._nodes.get(l),h,g;if(!a&&(h=e._edges.get(s),h)){if((h.source.key!==c||h.target.key!==l)&&(!o||h.source.key!==l||h.target.key!==c))throw new i(`Graph.${r}: inconsistency detected when attempting to merge the "${s}" edge with "${c}" source & "${l}" target vs. ("${h.source.key}", "${h.target.key}").`);g=h}if(!g&&!e.multi&&p&&(g=o?p.undirected[l]:p.out[l]),g){let n=[g.key,!1,!1,!1];if(d?!f:!u)return n;if(d){let t=g.attributes;g.attributes=f(t),e.emit(`edgeAttributesUpdated`,{type:`replace`,key:g.key,attributes:g.attributes})}else t(g.attributes,u),e.emit(`edgeAttributesUpdated`,{type:`merge`,key:g.key,attributes:g.attributes,data:u});return n}u||={},d&&f&&(u=f(u));let _={key:null,undirected:o,source:c,target:l,attributes:u};if(a)s=e._edgeKeyGenerator();else if(s=``+s,e._edges.has(s))throw new i(`Graph.${r}: the "${s}" edge already exists in the graph.`);let v=!1,y=!1;p||(p=unsafeAddNode(e,c,{}),v=!0,c===l&&(m=p,y=!0)),m||(m=unsafeAddNode(e,l,{}),y=!0),h=new EdgeData(o,s,p,m,u),e._edges.set(s,h);let b=c===l;return o?(p.undirectedDegree++,m.undirectedDegree++,b&&(p.undirectedLoops++,e._undirectedSelfLoopCount++)):(p.outDegree++,m.inDegree++,b&&(p.directedLoops++,e._directedSelfLoopCount++)),e.multi?h.attachMulti():h.attach(),o?e._undirectedSize++:e._directedSize++,_.key=s,e.emit(`edgeAdded`,_),[s,!0,v,y]}function dropEdgeFromData(e,t){e._edges.delete(t.key);let{source:n,target:r,attributes:i}=t,a=t.undirected,o=n===r;a?(n.undirectedDegree--,r.undirectedDegree--,o&&(n.undirectedLoops--,e._undirectedSelfLoopCount--)):(n.outDegree--,r.inDegree--,o&&(n.directedLoops--,e._directedSelfLoopCount--)),e.multi?t.detachMulti():t.detach(),a?e._undirectedSize--:e._directedSize--,e.emit(`edgeDropped`,{key:t.key,attributes:i,source:n.key,target:r.key,undirected:a})}var m=class Graph extends e{constructor(e){if(super(),e=t({},p,e),typeof e.multi!=`boolean`)throw new n(`Graph.constructor: invalid 'multi' option. Expecting a boolean but got "${e.multi}".`);if(!u.has(e.type))throw new n(`Graph.constructor: invalid 'type' option. Should be one of "mixed", "directed" or "undirected" but got "${e.type}".`);if(typeof e.allowSelfLoops!=`boolean`)throw new n(`Graph.constructor: invalid 'allowSelfLoops' option. Expecting a boolean but got "${e.allowSelfLoops}".`);let r=e.type===`mixed`?MixedNodeData:e.type===`directed`?DirectedNodeData:UndirectedNodeData;privateProperty(this,`NodeDataClass`,r);let i=`geid_`+l()+`_`,a=0,edgeKeyGenerator=()=>{let e;do e=i+a++;while(this._edges.has(e));return e};privateProperty(this,`_attributes`,{}),privateProperty(this,`_nodes`,new Map),privateProperty(this,`_edges`,new Map),privateProperty(this,`_directedSize`,0),privateProperty(this,`_undirectedSize`,0),privateProperty(this,`_directedSelfLoopCount`,0),privateProperty(this,`_undirectedSelfLoopCount`,0),privateProperty(this,`_edgeKeyGenerator`,edgeKeyGenerator),privateProperty(this,`_options`,e),d.forEach(e=>privateProperty(this,e,this[e])),readOnlyProperty(this,`order`,()=>this._nodes.size),readOnlyProperty(this,`size`,()=>this._edges.size),readOnlyProperty(this,`directedSize`,()=>this._directedSize),readOnlyProperty(this,`undirectedSize`,()=>this._undirectedSize),readOnlyProperty(this,`selfLoopCount`,()=>this._directedSelfLoopCount+this._undirectedSelfLoopCount),readOnlyProperty(this,`directedSelfLoopCount`,()=>this._directedSelfLoopCount),readOnlyProperty(this,`undirectedSelfLoopCount`,()=>this._undirectedSelfLoopCount),readOnlyProperty(this,`multi`,this._options.multi),readOnlyProperty(this,`type`,this._options.type),readOnlyProperty(this,`allowSelfLoops`,this._options.allowSelfLoops),readOnlyProperty(this,`implementation`,()=>`graphology`)}_resetInstanceCounters(){this._directedSize=0,this._undirectedSize=0,this._directedSelfLoopCount=0,this._undirectedSelfLoopCount=0}hasNode(e){return this._nodes.has(``+e)}hasDirectedEdge(e,t){if(this.type===`undirected`)return!1;if(arguments.length===1){let t=``+e,n=this._edges.get(t);return!!n&&!n.undirected}else if(arguments.length===2){e=``+e,t=``+t;let n=this._nodes.get(e);return n?n.out.hasOwnProperty(t):!1}throw new n(`Graph.hasDirectedEdge: invalid arity (${arguments.length}, instead of 1 or 2). You can either ask for an edge id or for the existence of an edge between a source & a target.`)}hasUndirectedEdge(e,t){if(this.type===`directed`)return!1;if(arguments.length===1){let t=``+e,n=this._edges.get(t);return!!n&&n.undirected}else if(arguments.length===2){e=``+e,t=``+t;let n=this._nodes.get(e);return n?n.undirected.hasOwnProperty(t):!1}throw new n(`Graph.hasDirectedEdge: invalid arity (${arguments.length}, instead of 1 or 2). You can either ask for an edge id or for the existence of an edge between a source & a target.`)}hasEdge(e,t){if(arguments.length===1){let t=``+e;return this._edges.has(t)}else if(arguments.length===2){e=``+e,t=``+t;let n=this._nodes.get(e);return n?n.out!==void 0&&n.out.hasOwnProperty(t)||n.undirected!==void 0&&n.undirected.hasOwnProperty(t):!1}throw new n(`Graph.hasEdge: invalid arity (${arguments.length}, instead of 1 or 2). You can either ask for an edge id or for the existence of an edge between a source & a target.`)}directedEdge(e,t){if(this.type===`undirected`)return;if(e=``+e,t=``+t,this.multi)throw new i(`Graph.directedEdge: this method is irrelevant with multigraphs since there might be multiple edges between source & target. See #.directedEdges instead.`);let n=this._nodes.get(e);if(!n)throw new r(`Graph.directedEdge: could not find the "${e}" source node in the graph.`);if(!this._nodes.has(t))throw new r(`Graph.directedEdge: could not find the "${t}" target node in the graph.`);let a=n.out&&n.out[t]||void 0;if(a)return a.key}undirectedEdge(e,t){if(this.type===`directed`)return;if(e=``+e,t=``+t,this.multi)throw new i(`Graph.undirectedEdge: this method is irrelevant with multigraphs since there might be multiple edges between source & target. See #.undirectedEdges instead.`);let n=this._nodes.get(e);if(!n)throw new r(`Graph.undirectedEdge: could not find the "${e}" source node in the graph.`);if(!this._nodes.has(t))throw new r(`Graph.undirectedEdge: could not find the "${t}" target node in the graph.`);let a=n.undirected&&n.undirected[t]||void 0;if(a)return a.key}edge(e,t){if(this.multi)throw new i(`Graph.edge: this method is irrelevant with multigraphs since there might be multiple edges between source & target. See #.edges instead.`);e=``+e,t=``+t;let n=this._nodes.get(e);if(!n)throw new r(`Graph.edge: could not find the "${e}" source node in the graph.`);if(!this._nodes.has(t))throw new r(`Graph.edge: could not find the "${t}" target node in the graph.`);let a=n.out&&n.out[t]||n.undirected&&n.undirected[t]||void 0;if(a)return a.key}areDirectedNeighbors(e,t){e=``+e,t=``+t;let n=this._nodes.get(e);if(!n)throw new r(`Graph.areDirectedNeighbors: could not find the "${e}" node in the graph.`);return this.type===`undirected`?!1:t in n.in||t in n.out}areOutNeighbors(e,t){e=``+e,t=``+t;let n=this._nodes.get(e);if(!n)throw new r(`Graph.areOutNeighbors: could not find the "${e}" node in the graph.`);return this.type!==`undirected`&&t in n.out}areInNeighbors(e,t){e=``+e,t=``+t;let n=this._nodes.get(e);if(!n)throw new r(`Graph.areInNeighbors: could not find the "${e}" node in the graph.`);return this.type!==`undirected`&&t in n.in}areUndirectedNeighbors(e,t){e=``+e,t=``+t;let n=this._nodes.get(e);if(!n)throw new r(`Graph.areUndirectedNeighbors: could not find the "${e}" node in the graph.`);return this.type!==`directed`&&t in n.undirected}areNeighbors(e,t){e=``+e,t=``+t;let n=this._nodes.get(e);if(!n)throw new r(`Graph.areNeighbors: could not find the "${e}" node in the graph.`);return this.type!==`undirected`&&(t in n.in||t in n.out)||this.type!==`directed`&&t in n.undirected}areInboundNeighbors(e,t){e=``+e,t=``+t;let n=this._nodes.get(e);if(!n)throw new r(`Graph.areInboundNeighbors: could not find the "${e}" node in the graph.`);return this.type!==`undirected`&&t in n.in||this.type!==`directed`&&t in n.undirected}areOutboundNeighbors(e,t){e=``+e,t=``+t;let n=this._nodes.get(e);if(!n)throw new r(`Graph.areOutboundNeighbors: could not find the "${e}" node in the graph.`);return this.type!==`undirected`&&t in n.out||this.type!==`directed`&&t in n.undirected}inDegree(e){e=``+e;let t=this._nodes.get(e);if(!t)throw new r(`Graph.inDegree: could not find the "${e}" node in the graph.`);return this.type===`undirected`?0:t.inDegree}outDegree(e){e=``+e;let t=this._nodes.get(e);if(!t)throw new r(`Graph.outDegree: could not find the "${e}" node in the graph.`);return this.type===`undirected`?0:t.outDegree}directedDegree(e){e=``+e;let t=this._nodes.get(e);if(!t)throw new r(`Graph.directedDegree: could not find the "${e}" node in the graph.`);return this.type===`undirected`?0:t.inDegree+t.outDegree}undirectedDegree(e){e=``+e;let t=this._nodes.get(e);if(!t)throw new r(`Graph.undirectedDegree: could not find the "${e}" node in the graph.`);return this.type===`directed`?0:t.undirectedDegree}inboundDegree(e){e=``+e;let t=this._nodes.get(e);if(!t)throw new r(`Graph.inboundDegree: could not find the "${e}" node in the graph.`);let n=0;return this.type!==`directed`&&(n+=t.undirectedDegree),this.type!==`undirected`&&(n+=t.inDegree),n}outboundDegree(e){e=``+e;let t=this._nodes.get(e);if(!t)throw new r(`Graph.outboundDegree: could not find the "${e}" node in the graph.`);let n=0;return this.type!==`directed`&&(n+=t.undirectedDegree),this.type!==`undirected`&&(n+=t.outDegree),n}degree(e){e=``+e;let t=this._nodes.get(e);if(!t)throw new r(`Graph.degree: could not find the "${e}" node in the graph.`);let n=0;return this.type!==`directed`&&(n+=t.undirectedDegree),this.type!==`undirected`&&(n+=t.inDegree+t.outDegree),n}inDegreeWithoutSelfLoops(e){e=``+e;let t=this._nodes.get(e);if(!t)throw new r(`Graph.inDegreeWithoutSelfLoops: could not find the "${e}" node in the graph.`);return this.type===`undirected`?0:t.inDegree-t.directedLoops}outDegreeWithoutSelfLoops(e){e=``+e;let t=this._nodes.get(e);if(!t)throw new r(`Graph.outDegreeWithoutSelfLoops: could not find the "${e}" node in the graph.`);return this.type===`undirected`?0:t.outDegree-t.directedLoops}directedDegreeWithoutSelfLoops(e){e=``+e;let t=this._nodes.get(e);if(!t)throw new r(`Graph.directedDegreeWithoutSelfLoops: could not find the "${e}" node in the graph.`);return this.type===`undirected`?0:t.inDegree+t.outDegree-t.directedLoops*2}undirectedDegreeWithoutSelfLoops(e){e=``+e;let t=this._nodes.get(e);if(!t)throw new r(`Graph.undirectedDegreeWithoutSelfLoops: could not find the "${e}" node in the graph.`);return this.type===`directed`?0:t.undirectedDegree-t.undirectedLoops*2}inboundDegreeWithoutSelfLoops(e){e=``+e;let t=this._nodes.get(e);if(!t)throw new r(`Graph.inboundDegreeWithoutSelfLoops: could not find the "${e}" node in the graph.`);let n=0,i=0;return this.type!==`directed`&&(n+=t.undirectedDegree,i+=t.undirectedLoops*2),this.type!==`undirected`&&(n+=t.inDegree,i+=t.directedLoops),n-i}outboundDegreeWithoutSelfLoops(e){e=``+e;let t=this._nodes.get(e);if(!t)throw new r(`Graph.outboundDegreeWithoutSelfLoops: could not find the "${e}" node in the graph.`);let n=0,i=0;return this.type!==`directed`&&(n+=t.undirectedDegree,i+=t.undirectedLoops*2),this.type!==`undirected`&&(n+=t.outDegree,i+=t.directedLoops),n-i}degreeWithoutSelfLoops(e){e=``+e;let t=this._nodes.get(e);if(!t)throw new r(`Graph.degreeWithoutSelfLoops: could not find the "${e}" node in the graph.`);let n=0,i=0;return this.type!==`directed`&&(n+=t.undirectedDegree,i+=t.undirectedLoops*2),this.type!==`undirected`&&(n+=t.inDegree+t.outDegree,i+=t.directedLoops*2),n-i}source(e){e=``+e;let t=this._edges.get(e);if(!t)throw new r(`Graph.source: could not find the "${e}" edge in the graph.`);return t.source.key}target(e){e=``+e;let t=this._edges.get(e);if(!t)throw new r(`Graph.target: could not find the "${e}" edge in the graph.`);return t.target.key}extremities(e){e=``+e;let t=this._edges.get(e);if(!t)throw new r(`Graph.extremities: could not find the "${e}" edge in the graph.`);return[t.source.key,t.target.key]}opposite(e,t){e=``+e,t=``+t;let n=this._edges.get(t);if(!n)throw new r(`Graph.opposite: could not find the "${t}" edge in the graph.`);let i=n.source.key,a=n.target.key;if(e===i)return a;if(e===a)return i;throw new r(`Graph.opposite: the "${e}" node is not attached to the "${t}" edge (${i}, ${a}).`)}hasExtremity(e,t){e=``+e,t=``+t;let n=this._edges.get(e);if(!n)throw new r(`Graph.hasExtremity: could not find the "${e}" edge in the graph.`);return n.source.key===t||n.target.key===t}isUndirected(e){e=``+e;let t=this._edges.get(e);if(!t)throw new r(`Graph.isUndirected: could not find the "${e}" edge in the graph.`);return t.undirected}isDirected(e){e=``+e;let t=this._edges.get(e);if(!t)throw new r(`Graph.isDirected: could not find the "${e}" edge in the graph.`);return!t.undirected}isSelfLoop(e){e=``+e;let t=this._edges.get(e);if(!t)throw new r(`Graph.isSelfLoop: could not find the "${e}" edge in the graph.`);return t.source===t.target}addNode(e,t){return addNode(this,e,t).key}mergeNode(e,r){if(r&&!isPlainObject(r))throw new n(`Graph.mergeNode: invalid attributes. Expecting an object but got "${r}"`);e=``+e,r||={};let i=this._nodes.get(e);return i?(r&&(t(i.attributes,r),this.emit(`nodeAttributesUpdated`,{type:`merge`,key:e,attributes:i.attributes,data:r})),[e,!1]):(i=new this.NodeDataClass(e,r),this._nodes.set(e,i),this.emit(`nodeAdded`,{key:e,attributes:r}),[e,!0])}updateNode(e,t){if(t&&typeof t!=`function`)throw new n(`Graph.updateNode: invalid updater function. Expecting a function but got "${t}"`);e=``+e;let r=this._nodes.get(e);if(r){if(t){let n=r.attributes;r.attributes=t(n),this.emit(`nodeAttributesUpdated`,{type:`replace`,key:e,attributes:r.attributes})}return[e,!1]}let i=t?t({}):{};return r=new this.NodeDataClass(e,i),this._nodes.set(e,r),this.emit(`nodeAdded`,{key:e,attributes:i}),[e,!0]}dropNode(e){e=``+e;let t=this._nodes.get(e);if(!t)throw new r(`Graph.dropNode: could not find the "${e}" node in the graph.`);let n;if(this.type!==`undirected`){for(let e in t.out){n=t.out[e];do dropEdgeFromData(this,n),n=n.next;while(n)}for(let e in t.in){n=t.in[e];do dropEdgeFromData(this,n),n=n.next;while(n)}}if(this.type!==`directed`)for(let e in t.undirected){n=t.undirected[e];do dropEdgeFromData(this,n),n=n.next;while(n)}this._nodes.delete(e),this.emit(`nodeDropped`,{key:e,attributes:t.attributes})}dropEdge(e){let t;if(arguments.length>1){let e=``+arguments[0],n=``+arguments[1];if(t=getMatchingEdge(this,e,n,this.type),!t)throw new r(`Graph.dropEdge: could not find the "${e}" -> "${n}" edge in the graph.`)}else if(e=``+e,t=this._edges.get(e),!t)throw new r(`Graph.dropEdge: could not find the "${e}" edge in the graph.`);return dropEdgeFromData(this,t),this}dropDirectedEdge(e,t){if(arguments.length<2)throw new i(`Graph.dropDirectedEdge: it does not make sense to try and drop a directed edge by key. What if the edge with this key is undirected? Use #.dropEdge for this purpose instead.`);if(this.multi)throw new i(`Graph.dropDirectedEdge: cannot use a {source,target} combo when dropping an edge in a MultiGraph since we cannot infer the one you want to delete as there could be multiple ones.`);e=``+e,t=``+t;let n=getMatchingEdge(this,e,t,`directed`);if(!n)throw new r(`Graph.dropDirectedEdge: could not find a "${e}" -> "${t}" edge in the graph.`);return dropEdgeFromData(this,n),this}dropUndirectedEdge(e,t){if(arguments.length<2)throw new i(`Graph.dropUndirectedEdge: it does not make sense to drop a directed edge by key. What if the edge with this key is undirected? Use #.dropEdge for this purpose instead.`);if(this.multi)throw new i(`Graph.dropUndirectedEdge: cannot use a {source,target} combo when dropping an edge in a MultiGraph since we cannot infer the one you want to delete as there could be multiple ones.`);let n=getMatchingEdge(this,e,t,`undirected`);if(!n)throw new r(`Graph.dropUndirectedEdge: could not find a "${e}" -> "${t}" edge in the graph.`);return dropEdgeFromData(this,n),this}clear(){this._edges.clear(),this._nodes.clear(),this._resetInstanceCounters(),this.emit(`cleared`)}clearEdges(){let e=this._nodes.values(),t;for(;t=e.next(),t.done!==!0;)t.value.clear();this._edges.clear(),this._resetInstanceCounters(),this.emit(`edgesCleared`)}getAttribute(e){return this._attributes[e]}getAttributes(){return this._attributes}hasAttribute(e){return this._attributes.hasOwnProperty(e)}setAttribute(e,t){return this._attributes[e]=t,this.emit(`attributesUpdated`,{type:`set`,attributes:this._attributes,name:e}),this}updateAttribute(e,t){if(typeof t!=`function`)throw new n(`Graph.updateAttribute: updater should be a function.`);let r=this._attributes[e];return this._attributes[e]=t(r),this.emit(`attributesUpdated`,{type:`set`,attributes:this._attributes,name:e}),this}removeAttribute(e){return delete this._attributes[e],this.emit(`attributesUpdated`,{type:`remove`,attributes:this._attributes,name:e}),this}replaceAttributes(e){if(!isPlainObject(e))throw new n(`Graph.replaceAttributes: provided attributes are not a plain object.`);return this._attributes=e,this.emit(`attributesUpdated`,{type:`replace`,attributes:this._attributes}),this}mergeAttributes(e){if(!isPlainObject(e))throw new n(`Graph.mergeAttributes: provided attributes are not a plain object.`);return t(this._attributes,e),this.emit(`attributesUpdated`,{type:`merge`,attributes:this._attributes,data:e}),this}updateAttributes(e){if(typeof e!=`function`)throw new n(`Graph.updateAttributes: provided updater is not a function.`);return this._attributes=e(this._attributes),this.emit(`attributesUpdated`,{type:`update`,attributes:this._attributes}),this}updateEachNodeAttributes(e,t){if(typeof e!=`function`)throw new n(`Graph.updateEachNodeAttributes: expecting an updater function.`);if(t&&!validateHints(t))throw new n(`Graph.updateEachNodeAttributes: invalid hints. Expecting an object having the following shape: {attributes?: [string]}`);let r=this._nodes.values(),i,a;for(;i=r.next(),i.done!==!0;)a=i.value,a.attributes=e(a.key,a.attributes);this.emit(`eachNodeAttributesUpdated`,{hints:t||null})}updateEachEdgeAttributes(e,t){if(typeof e!=`function`)throw new n(`Graph.updateEachEdgeAttributes: expecting an updater function.`);if(t&&!validateHints(t))throw new n(`Graph.updateEachEdgeAttributes: invalid hints. Expecting an object having the following shape: {attributes?: [string]}`);let r=this._edges.values(),i,a,o,s;for(;i=r.next(),i.done!==!0;)a=i.value,o=a.source,s=a.target,a.attributes=e(a.key,a.attributes,o.key,s.key,o.attributes,s.attributes,a.undirected);this.emit(`eachEdgeAttributesUpdated`,{hints:t||null})}forEachAdjacencyEntry(e){if(typeof e!=`function`)throw new n(`Graph.forEachAdjacencyEntry: expecting a callback.`);forEachAdjacency(!1,!1,!1,this,e)}forEachAdjacencyEntryWithOrphans(e){if(typeof e!=`function`)throw new n(`Graph.forEachAdjacencyEntryWithOrphans: expecting a callback.`);forEachAdjacency(!1,!1,!0,this,e)}forEachAssymetricAdjacencyEntry(e){if(typeof e!=`function`)throw new n(`Graph.forEachAssymetricAdjacencyEntry: expecting a callback.`);forEachAdjacency(!1,!0,!1,this,e)}forEachAssymetricAdjacencyEntryWithOrphans(e){if(typeof e!=`function`)throw new n(`Graph.forEachAssymetricAdjacencyEntryWithOrphans: expecting a callback.`);forEachAdjacency(!1,!0,!0,this,e)}nodes(){return Array.from(this._nodes.keys())}forEachNode(e){if(typeof e!=`function`)throw new n(`Graph.forEachNode: expecting a callback.`);let t=this._nodes.values(),r,i;for(;r=t.next(),r.done!==!0;)i=r.value,e(i.key,i.attributes)}findNode(e){if(typeof e!=`function`)throw new n(`Graph.findNode: expecting a callback.`);let t=this._nodes.values(),r,i;for(;r=t.next(),r.done!==!0;)if(i=r.value,e(i.key,i.attributes))return i.key}mapNodes(e){if(typeof e!=`function`)throw new n(`Graph.mapNode: expecting a callback.`);let t=this._nodes.values(),r,i,a=Array(this.order),o=0;for(;r=t.next(),r.done!==!0;)i=r.value,a[o++]=e(i.key,i.attributes);return a}someNode(e){if(typeof e!=`function`)throw new n(`Graph.someNode: expecting a callback.`);let t=this._nodes.values(),r,i;for(;r=t.next(),r.done!==!0;)if(i=r.value,e(i.key,i.attributes))return!0;return!1}everyNode(e){if(typeof e!=`function`)throw new n(`Graph.everyNode: expecting a callback.`);let t=this._nodes.values(),r,i;for(;r=t.next(),r.done!==!0;)if(i=r.value,!e(i.key,i.attributes))return!1;return!0}filterNodes(e){if(typeof e!=`function`)throw new n(`Graph.filterNodes: expecting a callback.`);let t=this._nodes.values(),r,i,a=[];for(;r=t.next(),r.done!==!0;)i=r.value,e(i.key,i.attributes)&&a.push(i.key);return a}reduceNodes(e,t){if(typeof e!=`function`)throw new n(`Graph.reduceNodes: expecting a callback.`);if(arguments.length<2)throw new n(`Graph.reduceNodes: missing initial value. You must provide it because the callback takes more than one argument and we cannot infer the initial value from the first iteration, as you could with a simple array.`);let r=t,i=this._nodes.values(),a,o;for(;a=i.next(),a.done!==!0;)o=a.value,r=e(r,o.key,o.attributes);return r}nodeEntries(){let e=this._nodes.values();return{[Symbol.iterator](){return this},next(){let t=e.next();if(t.done)return t;let n=t.value;return{value:{node:n.key,attributes:n.attributes},done:!1}}}}export(){let e=Array(this._nodes.size),t=0;this._nodes.forEach((n,r)=>{e[t++]=serializeNode(r,n)});let n=Array(this._edges.size);return t=0,this._edges.forEach((e,r)=>{n[t++]=serializeEdge(this.type,r,e)}),{options:{type:this.type,multi:this.multi,allowSelfLoops:this.allowSelfLoops},attributes:this.getAttributes(),nodes:e,edges:n}}import(e,t=!1){if(e instanceof Graph)return e.forEachNode((e,n)=>{t?this.mergeNode(e,n):this.addNode(e,n)}),e.forEachEdge((e,n,r,i,a,o,s)=>{t?s?this.mergeUndirectedEdgeWithKey(e,r,i,n):this.mergeDirectedEdgeWithKey(e,r,i,n):s?this.addUndirectedEdgeWithKey(e,r,i,n):this.addDirectedEdgeWithKey(e,r,i,n)}),this;if(!isPlainObject(e))throw new n(`Graph.import: invalid argument. Expecting a serialized graph or, alternatively, a Graph instance.`);if(e.attributes){if(!isPlainObject(e.attributes))throw new n(`Graph.import: invalid attributes. Expecting a plain object.`);t?this.mergeAttributes(e.attributes):this.replaceAttributes(e.attributes)}let r,i,a,o,s;if(e.nodes){if(a=e.nodes,!Array.isArray(a))throw new n(`Graph.import: invalid nodes. Expecting an array.`);for(r=0,i=a.length;r<i;r++){o=a[r],validateSerializedNode(o);let{key:e,attributes:n}=o;t?this.mergeNode(e,n):this.addNode(e,n)}}if(e.edges){let o=!1;if(this.type===`undirected`&&(o=!0),a=e.edges,!Array.isArray(a))throw new n(`Graph.import: invalid edges. Expecting an array.`);for(r=0,i=a.length;r<i;r++){s=a[r],validateSerializedEdge(s);let{source:e,target:n,attributes:i,undirected:c=o}=s,l;`key`in s?(l=t?c?this.mergeUndirectedEdgeWithKey:this.mergeDirectedEdgeWithKey:c?this.addUndirectedEdgeWithKey:this.addDirectedEdgeWithKey,l.call(this,s.key,e,n,i)):(l=t?c?this.mergeUndirectedEdge:this.mergeDirectedEdge:c?this.addUndirectedEdge:this.addDirectedEdge,l.call(this,e,n,i))}}return this}nullCopy(e){let n=new Graph(t({},this._options,e));return n.replaceAttributes(t({},this.getAttributes())),n}emptyCopy(e){let n=this.nullCopy(e);return this._nodes.forEach((e,r)=>{let i=t({},e.attributes);e=new n.NodeDataClass(r,i),n._nodes.set(r,e)}),n}copy(e){if(e||={},typeof e.type==`string`&&e.type!==this.type&&e.type!==`mixed`)throw new i(`Graph.copy: cannot create an incompatible copy from "${this.type}" type to "${e.type}" because this would mean losing information about the current graph.`);if(typeof e.multi==`boolean`&&e.multi!==this.multi&&e.multi!==!0)throw new i(`Graph.copy: cannot create an incompatible copy by downgrading a multi graph to a simple one because this would mean losing information about the current graph.`);if(typeof e.allowSelfLoops==`boolean`&&e.allowSelfLoops!==this.allowSelfLoops&&e.allowSelfLoops!==!0)throw new i(`Graph.copy: cannot create an incompatible copy from a graph allowing self loops to one that does not because this would mean losing information about the current graph.`);let n=this.emptyCopy(e),r=this._edges.values(),a,o;for(;a=r.next(),a.done!==!0;)o=a.value,addEdge(n,`copy`,!1,o.undirected,o.key,o.source.key,o.target.key,t({},o.attributes));return n}toJSON(){return this.export()}toString(){return`[object Graph]`}inspect(){let e={};this._nodes.forEach((t,n)=>{e[n]=t.attributes});let t={},n={};this._edges.forEach((e,r)=>{let i=e.undirected?`--`:`->`,a=``,o=e.source.key,s=e.target.key,c;e.undirected&&o>s&&(c=o,o=s,s=c);let l=`(${o})${i}(${s})`;r.startsWith(`geid_`)?this.multi&&(n[l]===void 0?n[l]=0:n[l]++,a+=`${n[l]}. `):a+=`[${r}]: `,a+=l,t[a]=e.attributes});let r={};for(let e in this)this.hasOwnProperty(e)&&!d.has(e)&&typeof this[e]!=`function`&&typeof e!=`symbol`&&(r[e]=this[e]);return r.attributes=this._attributes,r.nodes=e,r.edges=t,privateProperty(r,`constructor`,this.constructor),r}};typeof Symbol<`u`&&(m.prototype[Symbol.for(`nodejs.util.inspect.custom`)]=m.prototype.inspect),f.forEach(e=>{[`add`,`merge`,`update`].forEach(t=>{let n=e.name(t),r=t===`add`?addEdge:mergeEdge;e.generateKey?m.prototype[n]=function(i,a,o){return r(this,n,!0,(e.type||this.type)===`undirected`,null,i,a,o,t===`update`)}:m.prototype[n]=function(i,a,o,s){return r(this,n,!1,(e.type||this.type)===`undirected`,i,a,o,s,t===`update`)}})}),attachNodeAttributesMethods(m),attachEdgeAttributesMethods(m),attachEdgeIterationMethods(m),attachNeighborIterationMethods(m);var DirectedGraph=class extends m{constructor(e){let r=t({type:`directed`},e);if(`multi`in r&&r.multi!==!1)throw new n(`DirectedGraph.from: inconsistent indication that the graph should be multi in given options!`);if(r.type!==`directed`)throw new n(`DirectedGraph.from: inconsistent "`+r.type+`" type in given options!`);super(r)}},UndirectedGraph=class extends m{constructor(e){let r=t({type:`undirected`},e);if(`multi`in r&&r.multi!==!1)throw new n(`UndirectedGraph.from: inconsistent indication that the graph should be multi in given options!`);if(r.type!==`undirected`)throw new n(`UndirectedGraph.from: inconsistent "`+r.type+`" type in given options!`);super(r)}},MultiGraph=class extends m{constructor(e){let r=t({multi:!0},e);if(`multi`in r&&r.multi!==!0)throw new n(`MultiGraph.from: inconsistent indication that the graph should be simple in given options!`);super(r)}},MultiDirectedGraph=class extends m{constructor(e){let r=t({type:`directed`,multi:!0},e);if(`multi`in r&&r.multi!==!0)throw new n(`MultiDirectedGraph.from: inconsistent indication that the graph should be simple in given options!`);if(r.type!==`directed`)throw new n(`MultiDirectedGraph.from: inconsistent "`+r.type+`" type in given options!`);super(r)}},MultiUndirectedGraph=class extends m{constructor(e){let r=t({type:`undirected`,multi:!0},e);if(`multi`in r&&r.multi!==!0)throw new n(`MultiUndirectedGraph.from: inconsistent indication that the graph should be simple in given options!`);if(r.type!==`undirected`)throw new n(`MultiUndirectedGraph.from: inconsistent "`+r.type+`" type in given options!`);super(r)}};function attachStaticFromMethod(e){e.from=function(n,r){let i=new e(t({},n.options,r));return i.import(n),i}}attachStaticFromMethod(m),attachStaticFromMethod(DirectedGraph),attachStaticFromMethod(UndirectedGraph),attachStaticFromMethod(MultiGraph),attachStaticFromMethod(MultiDirectedGraph),attachStaticFromMethod(MultiUndirectedGraph),m.Graph=m,m.DirectedGraph=DirectedGraph,m.UndirectedGraph=UndirectedGraph,m.MultiGraph=MultiGraph,m.MultiDirectedGraph=MultiDirectedGraph,m.MultiUndirectedGraph=MultiUndirectedGraph,m.InvalidArgumentsGraphError=n,m.NotFoundGraphError=r,m.UsageGraphError=i;export{m as t};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import"../rolldown-runtime.mjs";import{t as e}from"./@ungap/structured-clone.mjs";const t=point(`end`),n=point(`start`);function point(e){return point;function point(t){let n=t&&t.position&&t.position[e]||{};if(typeof n.line==`number`&&n.line>0&&typeof n.column==`number`&&n.column>0)return{line:n.line,column:n.column,offset:typeof n.offset==`number`&&n.offset>-1?n.offset:void 0}}}function position(e){let r=n(e),i=t(e);if(r&&i)return{start:r,end:i}}const r=[`ariaDescribedBy`,`ariaLabel`,`ariaLabelledBy`],i={ancestors:{tbody:[`table`],td:[`table`],th:[`table`],thead:[`table`],tfoot:[`table`],tr:[`table`]},attributes:{a:[...r,`dataFootnoteBackref`,`dataFootnoteRef`,[`className`,`data-footnote-backref`],`href`],blockquote:[`cite`],code:[[`className`,/^language-./]],del:[`cite`],div:[`itemScope`,`itemType`],dl:[...r],h2:[[`className`,`sr-only`]],img:[...r,`longDesc`,`src`],input:[[`disabled`,!0],[`type`,`checkbox`]],ins:[`cite`],li:[[`className`,`task-list-item`]],ol:[...r,[`className`,`contains-task-list`]],q:[`cite`],section:[`dataFootnotes`,[`className`,`footnotes`]],source:[`srcSet`],summary:[...r],table:[...r],ul:[...r,[`className`,`contains-task-list`]],"*":`abbr.accept.acceptCharset.accessKey.action.align.alt.axis.border.cellPadding.cellSpacing.char.charOff.charSet.checked.clear.colSpan.color.cols.compact.coords.dateTime.dir.encType.frame.hSpace.headers.height.hrefLang.htmlFor.id.isMap.itemProp.label.lang.maxLength.media.method.multiple.name.noHref.noShade.noWrap.open.prompt.readOnly.rev.rowSpan.rows.rules.scope.selected.shape.size.span.start.summary.tabIndex.title.useMap.vAlign.value.width`.split(`.`)},clobber:[`ariaDescribedBy`,`ariaLabelledBy`,`id`,`name`],clobberPrefix:`user-content-`,protocols:{cite:[`http`,`https`],href:[`http`,`https`,`irc`,`ircs`,`mailto`,`xmpp`],longDesc:[`http`,`https`],src:[`http`,`https`]},required:{input:{disabled:!0,type:`checkbox`}},strip:[`script`],tagNames:`a.b.blockquote.br.code.dd.del.details.div.dl.dt.em.h1.h2.h3.h4.h5.h6.hr.i.img.input.ins.kbd.li.ol.p.picture.pre.q.rp.rt.ruby.s.samp.section.source.span.strike.strong.sub.summary.sup.table.tbody.td.tfoot.th.thead.tr.tt.ul.var`.split(`.`)},a={}.hasOwnProperty;function sanitize(e,t){let n={type:`root`,children:[]},r=transform({schema:t?{...i,...t}:i,stack:[]},e);return r&&(Array.isArray(r)?r.length===1?n=r[0]:n.children=r:n=r),n}function transform(e,t){if(t&&typeof t==`object`){let n=t;switch(typeof n.type==`string`?n.type:``){case`comment`:return comment(e,n);case`doctype`:return doctype(e,n);case`element`:return element(e,n);case`root`:return root(e,n);case`text`:return text(e,n);default:}}}function comment(e,t){if(e.schema.allowComments){let e=typeof t.value==`string`?t.value:``,n=e.indexOf(`-->`),r={type:`comment`,value:n<0?e:e.slice(0,n)};return patch(r,t),r}}function doctype(e,t){if(e.schema.allowDoctypes){let e={type:`doctype`};return patch(e,t),e}}function element(e,t){let n=typeof t.tagName==`string`?t.tagName:``;e.stack.push(n);let r=children(e,t.children),i=properties(e,t.properties);e.stack.pop();let o=!1;if(n&&n!==`*`&&(!e.schema.tagNames||e.schema.tagNames.includes(n))&&(o=!0,e.schema.ancestors&&a.call(e.schema.ancestors,n))){let t=e.schema.ancestors[n],r=-1;for(o=!1;++r<t.length;)e.stack.includes(t[r])&&(o=!0)}if(!o)return e.schema.strip&&!e.schema.strip.includes(n)?r:void 0;let s={type:`element`,tagName:n,properties:i,children:r};return patch(s,t),s}function root(e,t){let n={type:`root`,children:children(e,t.children)};return patch(n,t),n}function text(e,t){let n={type:`text`,value:typeof t.value==`string`?t.value:``};return patch(n,t),n}function children(e,t){let n=[];if(Array.isArray(t)){let r=t,i=-1;for(;++i<r.length;){let t=transform(e,r[i]);t&&(Array.isArray(t)?n.push(...t):n.push(t))}}return n}function properties(e,t){let n=e.stack[e.stack.length-1],r=e.schema.attributes,i=e.schema.required,o=r&&a.call(r,n)?r[n]:void 0,s=r&&a.call(r,`*`)?r[`*`]:void 0,c=t&&typeof t==`object`?t:{},l={},u;for(u in c)if(a.call(c,u)){let t=c[u],n=propertyValue(e,findDefinition(o,u),u,t);n??=propertyValue(e,findDefinition(s,u),u,t),n!=null&&(l[u]=n)}if(i&&a.call(i,n)){let e=i[n];for(u in e)a.call(e,u)&&!a.call(l,u)&&(l[u]=e[u])}return l}function propertyValue(e,t,n,r){return t?Array.isArray(r)?propertyValueMany(e,t,n,r):propertyValuePrimitive(e,t,n,r):void 0}function propertyValueMany(e,t,n,r){let i=-1,a=[];for(;++i<r.length;){let o=propertyValuePrimitive(e,t,n,r[i]);(typeof o==`number`||typeof o==`string`)&&a.push(o)}return a}function propertyValuePrimitive(e,t,n,r){if(
|
|
1
|
+
import"../rolldown-runtime.mjs";import{t as e}from"./@ungap/structured-clone.mjs";const t=point(`end`),n=point(`start`);function point(e){return point;function point(t){let n=t&&t.position&&t.position[e]||{};if(typeof n.line==`number`&&n.line>0&&typeof n.column==`number`&&n.column>0)return{line:n.line,column:n.column,offset:typeof n.offset==`number`&&n.offset>-1?n.offset:void 0}}}function position(e){let r=n(e),i=t(e);if(r&&i)return{start:r,end:i}}const r=[`ariaDescribedBy`,`ariaLabel`,`ariaLabelledBy`],i={ancestors:{tbody:[`table`],td:[`table`],th:[`table`],thead:[`table`],tfoot:[`table`],tr:[`table`]},attributes:{a:[...r,`dataFootnoteBackref`,`dataFootnoteRef`,[`className`,`data-footnote-backref`],`href`],blockquote:[`cite`],code:[[`className`,/^language-./]],del:[`cite`],div:[`itemScope`,`itemType`],dl:[...r],h2:[[`className`,`sr-only`]],img:[...r,`longDesc`,`src`],input:[[`disabled`,!0],[`type`,`checkbox`]],ins:[`cite`],li:[[`className`,`task-list-item`]],ol:[...r,[`className`,`contains-task-list`]],q:[`cite`],section:[`dataFootnotes`,[`className`,`footnotes`]],source:[`srcSet`],summary:[...r],table:[...r],ul:[...r,[`className`,`contains-task-list`]],"*":`abbr.accept.acceptCharset.accessKey.action.align.alt.axis.border.cellPadding.cellSpacing.char.charOff.charSet.checked.clear.colSpan.color.cols.compact.coords.dateTime.dir.encType.frame.hSpace.headers.height.hrefLang.htmlFor.id.isMap.itemProp.label.lang.maxLength.media.method.multiple.name.noHref.noShade.noWrap.open.prompt.readOnly.rev.rowSpan.rows.rules.scope.selected.shape.size.span.start.summary.tabIndex.title.useMap.vAlign.value.width`.split(`.`)},clobber:[`ariaDescribedBy`,`ariaLabelledBy`,`id`,`name`],clobberPrefix:`user-content-`,protocols:{cite:[`http`,`https`],href:[`http`,`https`,`irc`,`ircs`,`mailto`,`xmpp`],longDesc:[`http`,`https`],src:[`http`,`https`]},required:{input:{disabled:!0,type:`checkbox`}},strip:[`script`],tagNames:`a.b.blockquote.br.code.dd.del.details.div.dl.dt.em.h1.h2.h3.h4.h5.h6.hr.i.img.input.ins.kbd.li.ol.p.picture.pre.q.rp.rt.ruby.s.samp.section.source.span.strike.strong.sub.summary.sup.table.tbody.td.tfoot.th.thead.tr.tt.ul.var`.split(`.`)},a={}.hasOwnProperty;function sanitize(e,t){let n={type:`root`,children:[]},r=transform({schema:t?{...i,...t}:i,stack:[]},e);return r&&(Array.isArray(r)?r.length===1?n=r[0]:n.children=r:n=r),n}function transform(e,t){if(t&&typeof t==`object`){let n=t;switch(typeof n.type==`string`?n.type:``){case`comment`:return comment(e,n);case`doctype`:return doctype(e,n);case`element`:return element(e,n);case`root`:return root(e,n);case`text`:return text(e,n);default:}}}function comment(e,t){if(e.schema.allowComments){let e=typeof t.value==`string`?t.value:``,n=e.indexOf(`-->`),r={type:`comment`,value:n<0?e:e.slice(0,n)};return patch(r,t),r}}function doctype(e,t){if(e.schema.allowDoctypes){let e={type:`doctype`};return patch(e,t),e}}function element(e,t){let n=typeof t.tagName==`string`?t.tagName:``;e.stack.push(n);let r=children(e,t.children),i=properties(e,t.properties);e.stack.pop();let o=!1;if(n&&n!==`*`&&(!e.schema.tagNames||e.schema.tagNames.includes(n))&&(o=!0,e.schema.ancestors&&a.call(e.schema.ancestors,n))){let t=e.schema.ancestors[n],r=-1;for(o=!1;++r<t.length;)e.stack.includes(t[r])&&(o=!0)}if(!o)return e.schema.strip&&!e.schema.strip.includes(n)?r:void 0;let s={type:`element`,tagName:n,properties:i,children:r};return patch(s,t),s}function root(e,t){let n={type:`root`,children:children(e,t.children)};return patch(n,t),n}function text(e,t){let n={type:`text`,value:typeof t.value==`string`?t.value:``};return patch(n,t),n}function children(e,t){let n=[];if(Array.isArray(t)){let r=t,i=-1;for(;++i<r.length;){let t=transform(e,r[i]);t&&(Array.isArray(t)?n.push(...t):n.push(t))}}return n}function properties(e,t){let n=e.stack[e.stack.length-1],r=e.schema.attributes,i=e.schema.required,o=r&&a.call(r,n)?r[n]:void 0,s=r&&a.call(r,`*`)?r[`*`]:void 0,c=t&&typeof t==`object`?t:{},l={},u;for(u in c)if(a.call(c,u)){let t=c[u],n=propertyValue(e,findDefinition(o,u),u,t);n??=propertyValue(e,findDefinition(s,u),u,t),n!=null&&(l[u]=n)}if(i&&a.call(i,n)){let e=i[n];for(u in e)a.call(e,u)&&!a.call(l,u)&&(l[u]=e[u])}return l}function propertyValue(e,t,n,r){return t?Array.isArray(r)?propertyValueMany(e,t,n,r):propertyValuePrimitive(e,t,n,r):void 0}function propertyValueMany(e,t,n,r){let i=-1,a=[];for(;++i<r.length;){let o=propertyValuePrimitive(e,t,n,r[i]);(typeof o==`number`||typeof o==`string`)&&a.push(o)}return a}function propertyValuePrimitive(e,t,n,r){if((typeof r==`boolean`||typeof r==`number`||typeof r==`string`)&&safeProtocol(e,n,r)){if(typeof t==`object`&&t.length>1){let e=!1,n=0;for(;++n<t.length;){let i=t[n];if(i&&typeof i==`object`&&`flags`in i){if(i.test(String(r))){e=!0;break}}else if(i===r){e=!0;break}}if(!e)return}return e.schema.clobber&&e.schema.clobberPrefix&&e.schema.clobber.includes(n)?e.schema.clobberPrefix+r:r}}function safeProtocol(e,t,n){let r=e.schema.protocols&&a.call(e.schema.protocols,t)?e.schema.protocols[t]:void 0;if(!r||r.length===0)return!0;let i=String(n),o=i.indexOf(`:`),s=i.indexOf(`?`),c=i.indexOf(`#`),l=i.indexOf(`/`);if(o<0||l>-1&&o>l||s>-1&&o>s||c>-1&&o>c)return!0;let u=-1;for(;++u<r.length;){let e=r[u];if(o===e.length&&i.slice(0,e.length)===e)return!0}return!1}function patch(t,n){let r=position(n);n.data&&(t.data=e(n.data)),r&&(t.position=r)}function findDefinition(e,t){let n,r=-1;if(e)for(;++r<e.length;){let i=e[r],a=typeof i==`string`?i:i[0];if(a===t)return i;a===`data*`&&(n=i)}if(t.length>4&&t.slice(0,4).toLowerCase()===`data`)return n}export{position as a,n as i,i as n,t as r,sanitize as t};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{i as e,r as t}from"../rolldown-runtime.mjs";import{t as n}from"./character-entities-legacy.mjs";import{t as r}from"./character-entities-html4.mjs";import{t as i}from"./ccount.mjs";import{t as a}from"./comma-separated-tokens.mjs";const o=[`area`,`base`,`basefont`,`bgsound`,`br`,`col`,`command`,`embed`,`frame`,`hr`,`image`,`img`,`input`,`keygen`,`link`,`meta`,`param`,`source`,`track`,`wbr`];var Schema=class{constructor(e,t,n){this.normal=t,this.property=e,n&&(this.space=n)}};Schema.prototype.normal={},Schema.prototype.property={},Schema.prototype.space=void 0;function merge(e,t){let n={},r={};for(let t of e)Object.assign(n,t.property),Object.assign(r,t.normal);return new Schema(n,r,t)}function normalize(e){return e.toLowerCase()}var Info=class{constructor(e,t){this.attribute=t,this.property=e}};Info.prototype.attribute=``,Info.prototype.booleanish=!1,Info.prototype.boolean=!1,Info.prototype.commaOrSpaceSeparated=!1,Info.prototype.commaSeparated=!1,Info.prototype.defined=!1,Info.prototype.mustUseProperty=!1,Info.prototype.number=!1,Info.prototype.overloadedBoolean=!1,Info.prototype.property=``,Info.prototype.spaceSeparated=!1,Info.prototype.space=void 0;var s=t({boolean:()=>l,booleanish:()=>u,commaOrSpaceSeparated:()=>g,commaSeparated:()=>h,number:()=>f,overloadedBoolean:()=>d,spaceSeparated:()=>m});let c=0;const l=increment(),u=increment(),d=increment(),f=increment(),m=increment(),h=increment(),g=increment();function increment(){return 2**++c}const _=Object.keys(s);var DefinedInfo=class extends Info{constructor(e,t,n,r){let i=-1;if(super(e,t),mark(this,`space`,r),typeof n==`number`)for(;++i<_.length;){let e=_[i];mark(this,_[i],(n&s[e])===s[e])}}};DefinedInfo.prototype.defined=!0;function mark(e,t,n){n&&(e[t]=n)}function create(e){let t={},n={};for(let[r,i]of Object.entries(e.properties)){let a=new DefinedInfo(r,e.transform(e.attributes||{},r),i,e.space);e.mustUseProperty&&e.mustUseProperty.includes(r)&&(a.mustUseProperty=!0),t[r]=a,n[normalize(r)]=r,n[normalize(a.attribute)]=r}return new Schema(t,n,e.space)}const v=create({properties:{ariaActiveDescendant:null,ariaAtomic:u,ariaAutoComplete:null,ariaBusy:u,ariaChecked:u,ariaColCount:f,ariaColIndex:f,ariaColSpan:f,ariaControls:m,ariaCurrent:null,ariaDescribedBy:m,ariaDetails:null,ariaDisabled:u,ariaDropEffect:m,ariaErrorMessage:null,ariaExpanded:u,ariaFlowTo:m,ariaGrabbed:u,ariaHasPopup:null,ariaHidden:u,ariaInvalid:null,ariaKeyShortcuts:null,ariaLabel:null,ariaLabelledBy:m,ariaLevel:f,ariaLive:null,ariaModal:u,ariaMultiLine:u,ariaMultiSelectable:u,ariaOrientation:null,ariaOwns:m,ariaPlaceholder:null,ariaPosInSet:f,ariaPressed:u,ariaReadOnly:u,ariaRelevant:null,ariaRequired:u,ariaRoleDescription:m,ariaRowCount:f,ariaRowIndex:f,ariaRowSpan:f,ariaSelected:u,ariaSetSize:f,ariaSort:null,ariaValueMax:f,ariaValueMin:f,ariaValueNow:f,ariaValueText:null,role:null},transform(e,t){return t===`role`?t:`aria-`+t.slice(4).toLowerCase()}});function caseSensitiveTransform(e,t){return t in e?e[t]:t}function caseInsensitiveTransform(e,t){return caseSensitiveTransform(e,t.toLowerCase())}const y=create({attributes:{acceptcharset:`accept-charset`,classname:`class`,htmlfor:`for`,httpequiv:`http-equiv`},mustUseProperty:[`checked`,`multiple`,`muted`,`selected`],properties:{abbr:null,accept:h,acceptCharset:m,accessKey:m,action:null,allow:null,allowFullScreen:l,allowPaymentRequest:l,allowUserMedia:l,alt:null,as:null,async:l,autoCapitalize:null,autoComplete:m,autoFocus:l,autoPlay:l,blocking:m,capture:null,charSet:null,checked:l,cite:null,className:m,cols:f,colSpan:null,content:null,contentEditable:u,controls:l,controlsList:m,coords:f|h,crossOrigin:null,data:null,dateTime:null,decoding:null,default:l,defer:l,dir:null,dirName:null,disabled:l,download:d,draggable:u,encType:null,enterKeyHint:null,fetchPriority:null,form:null,formAction:null,formEncType:null,formMethod:null,formNoValidate:l,formTarget:null,headers:m,height:f,hidden:l,high:f,href:null,hrefLang:null,htmlFor:m,httpEquiv:m,id:null,imageSizes:null,imageSrcSet:null,inert:l,inputMode:null,integrity:null,is:null,isMap:l,itemId:null,itemProp:m,itemRef:m,itemScope:l,itemType:m,kind:null,label:null,lang:null,language:null,list:null,loading:null,loop:l,low:f,manifest:null,max:null,maxLength:f,media:null,method:null,min:null,minLength:f,multiple:l,muted:l,name:null,nonce:null,noModule:l,noValidate:l,onAbort:null,onAfterPrint:null,onAuxClick:null,onBeforeMatch:null,onBeforePrint:null,onBeforeToggle:null,onBeforeUnload:null,onBlur:null,onCancel:null,onCanPlay:null,onCanPlayThrough:null,onChange:null,onClick:null,onClose:null,onContextLost:null,onContextMenu:null,onContextRestored:null,onCopy:null,onCueChange:null,onCut:null,onDblClick:null,onDrag:null,onDragEnd:null,onDragEnter:null,onDragExit:null,onDragLeave:null,onDragOver:null,onDragStart:null,onDrop:null,onDurationChange:null,onEmptied:null,onEnded:null,onError:null,onFocus:null,onFormData:null,onHashChange:null,onInput:null,onInvalid:null,onKeyDown:null,onKeyPress:null,onKeyUp:null,onLanguageChange:null,onLoad:null,onLoadedData:null,onLoadedMetadata:null,onLoadEnd:null,onLoadStart:null,onMessage:null,onMessageError:null,onMouseDown:null,onMouseEnter:null,onMouseLeave:null,onMouseMove:null,onMouseOut:null,onMouseOver:null,onMouseUp:null,onOffline:null,onOnline:null,onPageHide:null,onPageShow:null,onPaste:null,onPause:null,onPlay:null,onPlaying:null,onPopState:null,onProgress:null,onRateChange:null,onRejectionHandled:null,onReset:null,onResize:null,onScroll:null,onScrollEnd:null,onSecurityPolicyViolation:null,onSeeked:null,onSeeking:null,onSelect:null,onSlotChange:null,onStalled:null,onStorage:null,onSubmit:null,onSuspend:null,onTimeUpdate:null,onToggle:null,onUnhandledRejection:null,onUnload:null,onVolumeChange:null,onWaiting:null,onWheel:null,open:l,optimum:f,pattern:null,ping:m,placeholder:null,playsInline:l,popover:null,popoverTarget:null,popoverTargetAction:null,poster:null,preload:null,readOnly:l,referrerPolicy:null,rel:m,required:l,reversed:l,rows:f,rowSpan:f,sandbox:m,scope:null,scoped:l,seamless:l,selected:l,shadowRootClonable:l,shadowRootDelegatesFocus:l,shadowRootMode:null,shape:null,size:f,sizes:null,slot:null,span:f,spellCheck:u,src:null,srcDoc:null,srcLang:null,srcSet:null,start:f,step:null,style:null,tabIndex:f,target:null,title:null,translate:null,type:null,typeMustMatch:l,useMap:null,value:u,width:f,wrap:null,writingSuggestions:null,align:null,aLink:null,archive:m,axis:null,background:null,bgColor:null,border:f,borderColor:null,bottomMargin:f,cellPadding:null,cellSpacing:null,char:null,charOff:null,classId:null,clear:null,code:null,codeBase:null,codeType:null,color:null,compact:l,declare:l,event:null,face:null,frame:null,frameBorder:null,hSpace:f,leftMargin:f,link:null,longDesc:null,lowSrc:null,marginHeight:f,marginWidth:f,noResize:l,noHref:l,noShade:l,noWrap:l,object:null,profile:null,prompt:null,rev:null,rightMargin:f,rules:null,scheme:null,scrolling:u,standby:null,summary:null,text:null,topMargin:f,valueType:null,version:null,vAlign:null,vLink:null,vSpace:f,allowTransparency:null,autoCorrect:null,autoSave:null,disablePictureInPicture:l,disableRemotePlayback:l,prefix:null,property:null,results:f,security:null,unselectable:null},space:`html`,transform:caseInsensitiveTransform}),b=create({attributes:{accentHeight:`accent-height`,alignmentBaseline:`alignment-baseline`,arabicForm:`arabic-form`,baselineShift:`baseline-shift`,capHeight:`cap-height`,className:`class`,clipPath:`clip-path`,clipRule:`clip-rule`,colorInterpolation:`color-interpolation`,colorInterpolationFilters:`color-interpolation-filters`,colorProfile:`color-profile`,colorRendering:`color-rendering`,crossOrigin:`crossorigin`,dataType:`datatype`,dominantBaseline:`dominant-baseline`,enableBackground:`enable-background`,fillOpacity:`fill-opacity`,fillRule:`fill-rule`,floodColor:`flood-color`,floodOpacity:`flood-opacity`,fontFamily:`font-family`,fontSize:`font-size`,fontSizeAdjust:`font-size-adjust`,fontStretch:`font-stretch`,fontStyle:`font-style`,fontVariant:`font-variant`,fontWeight:`font-weight`,glyphName:`glyph-name`,glyphOrientationHorizontal:`glyph-orientation-horizontal`,glyphOrientationVertical:`glyph-orientation-vertical`,hrefLang:`hreflang`,horizAdvX:`horiz-adv-x`,horizOriginX:`horiz-origin-x`,horizOriginY:`horiz-origin-y`,imageRendering:`image-rendering`,letterSpacing:`letter-spacing`,lightingColor:`lighting-color`,markerEnd:`marker-end`,markerMid:`marker-mid`,markerStart:`marker-start`,navDown:`nav-down`,navDownLeft:`nav-down-left`,navDownRight:`nav-down-right`,navLeft:`nav-left`,navNext:`nav-next`,navPrev:`nav-prev`,navRight:`nav-right`,navUp:`nav-up`,navUpLeft:`nav-up-left`,navUpRight:`nav-up-right`,onAbort:`onabort`,onActivate:`onactivate`,onAfterPrint:`onafterprint`,onBeforePrint:`onbeforeprint`,onBegin:`onbegin`,onCancel:`oncancel`,onCanPlay:`oncanplay`,onCanPlayThrough:`oncanplaythrough`,onChange:`onchange`,onClick:`onclick`,onClose:`onclose`,onCopy:`oncopy`,onCueChange:`oncuechange`,onCut:`oncut`,onDblClick:`ondblclick`,onDrag:`ondrag`,onDragEnd:`ondragend`,onDragEnter:`ondragenter`,onDragExit:`ondragexit`,onDragLeave:`ondragleave`,onDragOver:`ondragover`,onDragStart:`ondragstart`,onDrop:`ondrop`,onDurationChange:`ondurationchange`,onEmptied:`onemptied`,onEnd:`onend`,onEnded:`onended`,onError:`onerror`,onFocus:`onfocus`,onFocusIn:`onfocusin`,onFocusOut:`onfocusout`,onHashChange:`onhashchange`,onInput:`oninput`,onInvalid:`oninvalid`,onKeyDown:`onkeydown`,onKeyPress:`onkeypress`,onKeyUp:`onkeyup`,onLoad:`onload`,onLoadedData:`onloadeddata`,onLoadedMetadata:`onloadedmetadata`,onLoadStart:`onloadstart`,onMessage:`onmessage`,onMouseDown:`onmousedown`,onMouseEnter:`onmouseenter`,onMouseLeave:`onmouseleave`,onMouseMove:`onmousemove`,onMouseOut:`onmouseout`,onMouseOver:`onmouseover`,onMouseUp:`onmouseup`,onMouseWheel:`onmousewheel`,onOffline:`onoffline`,onOnline:`ononline`,onPageHide:`onpagehide`,onPageShow:`onpageshow`,onPaste:`onpaste`,onPause:`onpause`,onPlay:`onplay`,onPlaying:`onplaying`,onPopState:`onpopstate`,onProgress:`onprogress`,onRateChange:`onratechange`,onRepeat:`onrepeat`,onReset:`onreset`,onResize:`onresize`,onScroll:`onscroll`,onSeeked:`onseeked`,onSeeking:`onseeking`,onSelect:`onselect`,onShow:`onshow`,onStalled:`onstalled`,onStorage:`onstorage`,onSubmit:`onsubmit`,onSuspend:`onsuspend`,onTimeUpdate:`ontimeupdate`,onToggle:`ontoggle`,onUnload:`onunload`,onVolumeChange:`onvolumechange`,onWaiting:`onwaiting`,onZoom:`onzoom`,overlinePosition:`overline-position`,overlineThickness:`overline-thickness`,paintOrder:`paint-order`,panose1:`panose-1`,pointerEvents:`pointer-events`,referrerPolicy:`referrerpolicy`,renderingIntent:`rendering-intent`,shapeRendering:`shape-rendering`,stopColor:`stop-color`,stopOpacity:`stop-opacity`,strikethroughPosition:`strikethrough-position`,strikethroughThickness:`strikethrough-thickness`,strokeDashArray:`stroke-dasharray`,strokeDashOffset:`stroke-dashoffset`,strokeLineCap:`stroke-linecap`,strokeLineJoin:`stroke-linejoin`,strokeMiterLimit:`stroke-miterlimit`,strokeOpacity:`stroke-opacity`,strokeWidth:`stroke-width`,tabIndex:`tabindex`,textAnchor:`text-anchor`,textDecoration:`text-decoration`,textRendering:`text-rendering`,transformOrigin:`transform-origin`,typeOf:`typeof`,underlinePosition:`underline-position`,underlineThickness:`underline-thickness`,unicodeBidi:`unicode-bidi`,unicodeRange:`unicode-range`,unitsPerEm:`units-per-em`,vAlphabetic:`v-alphabetic`,vHanging:`v-hanging`,vIdeographic:`v-ideographic`,vMathematical:`v-mathematical`,vectorEffect:`vector-effect`,vertAdvY:`vert-adv-y`,vertOriginX:`vert-origin-x`,vertOriginY:`vert-origin-y`,wordSpacing:`word-spacing`,writingMode:`writing-mode`,xHeight:`x-height`,playbackOrder:`playbackorder`,timelineBegin:`timelinebegin`},properties:{about:g,accentHeight:f,accumulate:null,additive:null,alignmentBaseline:null,alphabetic:f,amplitude:f,arabicForm:null,ascent:f,attributeName:null,attributeType:null,azimuth:f,bandwidth:null,baselineShift:null,baseFrequency:null,baseProfile:null,bbox:null,begin:null,bias:f,by:null,calcMode:null,capHeight:f,className:m,clip:null,clipPath:null,clipPathUnits:null,clipRule:null,color:null,colorInterpolation:null,colorInterpolationFilters:null,colorProfile:null,colorRendering:null,content:null,contentScriptType:null,contentStyleType:null,crossOrigin:null,cursor:null,cx:null,cy:null,d:null,dataType:null,defaultAction:null,descent:f,diffuseConstant:f,direction:null,display:null,dur:null,divisor:f,dominantBaseline:null,download:l,dx:null,dy:null,edgeMode:null,editable:null,elevation:f,enableBackground:null,end:null,event:null,exponent:f,externalResourcesRequired:null,fill:null,fillOpacity:f,fillRule:null,filter:null,filterRes:null,filterUnits:null,floodColor:null,floodOpacity:null,focusable:null,focusHighlight:null,fontFamily:null,fontSize:null,fontSizeAdjust:null,fontStretch:null,fontStyle:null,fontVariant:null,fontWeight:null,format:null,fr:null,from:null,fx:null,fy:null,g1:h,g2:h,glyphName:h,glyphOrientationHorizontal:null,glyphOrientationVertical:null,glyphRef:null,gradientTransform:null,gradientUnits:null,handler:null,hanging:f,hatchContentUnits:null,hatchUnits:null,height:null,href:null,hrefLang:null,horizAdvX:f,horizOriginX:f,horizOriginY:f,id:null,ideographic:f,imageRendering:null,initialVisibility:null,in:null,in2:null,intercept:f,k:f,k1:f,k2:f,k3:f,k4:f,kernelMatrix:g,kernelUnitLength:null,keyPoints:null,keySplines:null,keyTimes:null,kerning:null,lang:null,lengthAdjust:null,letterSpacing:null,lightingColor:null,limitingConeAngle:f,local:null,markerEnd:null,markerMid:null,markerStart:null,markerHeight:null,markerUnits:null,markerWidth:null,mask:null,maskContentUnits:null,maskUnits:null,mathematical:null,max:null,media:null,mediaCharacterEncoding:null,mediaContentEncodings:null,mediaSize:f,mediaTime:null,method:null,min:null,mode:null,name:null,navDown:null,navDownLeft:null,navDownRight:null,navLeft:null,navNext:null,navPrev:null,navRight:null,navUp:null,navUpLeft:null,navUpRight:null,numOctaves:null,observer:null,offset:null,onAbort:null,onActivate:null,onAfterPrint:null,onBeforePrint:null,onBegin:null,onCancel:null,onCanPlay:null,onCanPlayThrough:null,onChange:null,onClick:null,onClose:null,onCopy:null,onCueChange:null,onCut:null,onDblClick:null,onDrag:null,onDragEnd:null,onDragEnter:null,onDragExit:null,onDragLeave:null,onDragOver:null,onDragStart:null,onDrop:null,onDurationChange:null,onEmptied:null,onEnd:null,onEnded:null,onError:null,onFocus:null,onFocusIn:null,onFocusOut:null,onHashChange:null,onInput:null,onInvalid:null,onKeyDown:null,onKeyPress:null,onKeyUp:null,onLoad:null,onLoadedData:null,onLoadedMetadata:null,onLoadStart:null,onMessage:null,onMouseDown:null,onMouseEnter:null,onMouseLeave:null,onMouseMove:null,onMouseOut:null,onMouseOver:null,onMouseUp:null,onMouseWheel:null,onOffline:null,onOnline:null,onPageHide:null,onPageShow:null,onPaste:null,onPause:null,onPlay:null,onPlaying:null,onPopState:null,onProgress:null,onRateChange:null,onRepeat:null,onReset:null,onResize:null,onScroll:null,onSeeked:null,onSeeking:null,onSelect:null,onShow:null,onStalled:null,onStorage:null,onSubmit:null,onSuspend:null,onTimeUpdate:null,onToggle:null,onUnload:null,onVolumeChange:null,onWaiting:null,onZoom:null,opacity:null,operator:null,order:null,orient:null,orientation:null,origin:null,overflow:null,overlay:null,overlinePosition:f,overlineThickness:f,paintOrder:null,panose1:null,path:null,pathLength:f,patternContentUnits:null,patternTransform:null,patternUnits:null,phase:null,ping:m,pitch:null,playbackOrder:null,pointerEvents:null,points:null,pointsAtX:f,pointsAtY:f,pointsAtZ:f,preserveAlpha:null,preserveAspectRatio:null,primitiveUnits:null,propagate:null,property:g,r:null,radius:null,referrerPolicy:null,refX:null,refY:null,rel:g,rev:g,renderingIntent:null,repeatCount:null,repeatDur:null,requiredExtensions:g,requiredFeatures:g,requiredFonts:g,requiredFormats:g,resource:null,restart:null,result:null,rotate:null,rx:null,ry:null,scale:null,seed:null,shapeRendering:null,side:null,slope:null,snapshotTime:null,specularConstant:f,specularExponent:f,spreadMethod:null,spacing:null,startOffset:null,stdDeviation:null,stemh:null,stemv:null,stitchTiles:null,stopColor:null,stopOpacity:null,strikethroughPosition:f,strikethroughThickness:f,string:null,stroke:null,strokeDashArray:g,strokeDashOffset:null,strokeLineCap:null,strokeLineJoin:null,strokeMiterLimit:f,strokeOpacity:f,strokeWidth:null,style:null,surfaceScale:f,syncBehavior:null,syncBehaviorDefault:null,syncMaster:null,syncTolerance:null,syncToleranceDefault:null,systemLanguage:g,tabIndex:f,tableValues:null,target:null,targetX:f,targetY:f,textAnchor:null,textDecoration:null,textRendering:null,textLength:null,timelineBegin:null,title:null,transformBehavior:null,type:null,typeOf:g,to:null,transform:null,transformOrigin:null,u1:null,u2:null,underlinePosition:f,underlineThickness:f,unicode:null,unicodeBidi:null,unicodeRange:null,unitsPerEm:f,values:null,vAlphabetic:f,vMathematical:f,vectorEffect:null,vHanging:f,vIdeographic:f,version:null,vertAdvY:f,vertOriginX:f,vertOriginY:f,viewBox:null,viewTarget:null,visibility:null,width:null,widths:null,wordSpacing:null,writingMode:null,x:null,x1:null,x2:null,xChannelSelector:null,xHeight:f,y:null,y1:null,y2:null,yChannelSelector:null,z:null,zoomAndPan:null},space:`svg`,transform:caseSensitiveTransform}),x=create({properties:{xLinkActuate:null,xLinkArcRole:null,xLinkHref:null,xLinkRole:null,xLinkShow:null,xLinkTitle:null,xLinkType:null},space:`xlink`,transform(e,t){return`xlink:`+t.slice(5).toLowerCase()}}),S=create({attributes:{xmlnsxlink:`xmlns:xlink`},properties:{xmlnsXLink:null,xmlns:null},space:`xmlns`,transform:caseInsensitiveTransform}),C=create({properties:{xmlBase:null,xmlLang:null,xmlSpace:null},space:`xml`,transform(e,t){return`xml:`+t.slice(3).toLowerCase()}}),w=/[A-Z]/g,T=/-[a-z]/g,E=/^data[-\w.:]+$/i;function find(e,t){let n=normalize(t),r=t,i=Info;if(n in e.normal)return e.property[e.normal[n]];if(n.length>4&&n.slice(0,4)===`data`&&E.test(t)){if(t.charAt(4)===`-`){let e=t.slice(5).replace(T,camelcase);r=`data`+e.charAt(0).toUpperCase()+e.slice(1)}else{let e=t.slice(4);if(!T.test(e)){let n=e.replace(w,kebab);n.charAt(0)!==`-`&&(n=`-`+n),t=`data`+n}}i=DefinedInfo}return new i(r,t)}function kebab(e){return`-`+e.toLowerCase()}function camelcase(e){return e.charAt(1).toUpperCase()}const D=merge([v,y,x,S,C],`html`),O=merge([v,b,x,S,C],`svg`),k={}.hasOwnProperty;function zwitch(e,t){let n=t||{};function one(t,...n){let r=one.invalid,i=one.handlers;if(t&&k.call(t,e)){let n=String(t[e]);r=k.call(i,n)?i[n]:one.unknown}if(r)return r.call(this,t,...n)}return one.handlers=n.handlers||{},one.invalid=n.invalid,one.unknown=n.unknown,one}const A=/["&'<>`]/g,j=/[\uD800-\uDBFF][\uDC00-\uDFFF]/g,M=/[\x01-\t\v\f\x0E-\x1F\x7F\x81\x8D\x8F\x90\x9D\xA0-\uFFFF]/g,N=/[|\\{}()[\]^$+*?.]/g,P=new WeakMap;function core(e,t){if(e=e.replace(t.subset?charactersToExpressionCached(t.subset):A,basic),t.subset||t.escapeOnly)return e;return e.replace(j,surrogate).replace(M,basic);function surrogate(e,n,r){return t.format((e.charCodeAt(0)-55296)*1024+e.charCodeAt(1)-56320+65536,r.charCodeAt(n+2),t)}function basic(e,n,r){return t.format(e.charCodeAt(0),r.charCodeAt(n+1),t)}}function charactersToExpressionCached(e){let t=P.get(e);return t||(t=charactersToExpression(e),P.set(e,t)),t}function charactersToExpression(e){let t=[],n=-1;for(;++n<e.length;)t.push(e[n].replace(N,`\\$&`));return RegExp(`(?:`+t.join(`|`)+`)`,`g`)}const F=/[\dA-Fa-f]/;function toHexadecimal(e,t,n){let r=`&#x`+e.toString(16).toUpperCase();return n&&t&&!F.test(String.fromCharCode(t))?r:r+`;`}const I=/\d/;function toDecimal(e,t,n){let r=`&#`+String(e);return n&&t&&!I.test(String.fromCharCode(t))?r:r+`;`}const L=[`cent`,`copy`,`divide`,`gt`,`lt`,`not`,`para`,`times`],R={}.hasOwnProperty,z={};let B;for(B in r)R.call(r,B)&&(z[r[B]]=B);const V=/[^\dA-Za-z]/;function toNamed(e,t,r,i){let a=String.fromCharCode(e);if(R.call(z,a)){let e=z[a],o=`&`+e;return r&&n.includes(e)&&!L.includes(e)&&(!i||t&&t!==61&&V.test(String.fromCharCode(t)))?o:o+`;`}return``}function formatSmart(e,t,n){let r=toHexadecimal(e,t,n.omitOptionalSemicolons),i;if((n.useNamedReferences||n.useShortestReferences)&&(i=toNamed(e,t,n.omitOptionalSemicolons,n.attribute)),(n.useShortestReferences||!i)&&n.useShortestReferences){let i=toDecimal(e,t,n.omitOptionalSemicolons);i.length<r.length&&(r=i)}return i&&(!n.useShortestReferences||i.length<r.length)?i:r}function stringifyEntities(e,t){return core(e,Object.assign({format:formatSmart},t))}const H=/^>|^->|<!--|-->|--!>|<!-$/g,U=[`>`],W=[`<`,`>`];function comment(e,t,n,r){return r.settings.bogusComments?`<?`+stringifyEntities(e.value,Object.assign({},r.settings.characterReferences,{subset:U}))+`>`:`<!--`+e.value.replace(H,encode)+`-->`;function encode(e){return stringifyEntities(e,Object.assign({},r.settings.characterReferences,{subset:W}))}}function doctype(e,t,n,r){return`<!`+(r.settings.upperDoctype?`DOCTYPE`:`doctype`)+(r.settings.tightDoctype?``:` `)+`html>`}function stringify(e){return e.join(` `).trim()}const G=/[ \t\n\f\r]/g;function whitespace(e){return typeof e==`object`?e.type===`text`?empty(e.value):!1:empty(e)}function empty(e){return e.replace(G,``)===``}const K=siblings(1),q=siblings(-1),J=[];function siblings(e){return sibling;function sibling(t,n,r){let i=t?t.children:J,a=(n||0)+e,o=i[a];if(!r)for(;o&&whitespace(o);)a+=e,o=i[a];return o}}const Y={}.hasOwnProperty;function omission(e){return omit;function omit(t,n,r){return Y.call(e,t.tagName)&&e[t.tagName](t,n,r)}}const X=omission({body:body$1,caption:headOrColgroupOrCaption,colgroup:headOrColgroupOrCaption,dd,dt,head:headOrColgroupOrCaption,html:html$1,li,optgroup,option,p,rp:rubyElement,rt:rubyElement,tbody:tbody$1,td:cells,tfoot,th:cells,thead,tr});function headOrColgroupOrCaption(e,t,n){let r=K(n,t,!0);return!r||r.type!==`comment`&&!(r.type===`text`&&whitespace(r.value.charAt(0)))}function html$1(e,t,n){let r=K(n,t);return!r||r.type!==`comment`}e(html$1,`html`);function body$1(e,t,n){let r=K(n,t);return!r||r.type!==`comment`}e(body$1,`body`);function p(e,t,n){let r=K(n,t);return r?r.type===`element`&&(r.tagName===`address`||r.tagName===`article`||r.tagName===`aside`||r.tagName===`blockquote`||r.tagName===`details`||r.tagName===`div`||r.tagName===`dl`||r.tagName===`fieldset`||r.tagName===`figcaption`||r.tagName===`figure`||r.tagName===`footer`||r.tagName===`form`||r.tagName===`h1`||r.tagName===`h2`||r.tagName===`h3`||r.tagName===`h4`||r.tagName===`h5`||r.tagName===`h6`||r.tagName===`header`||r.tagName===`hgroup`||r.tagName===`hr`||r.tagName===`main`||r.tagName===`menu`||r.tagName===`nav`||r.tagName===`ol`||r.tagName===`p`||r.tagName===`pre`||r.tagName===`section`||r.tagName===`table`||r.tagName===`ul`):!n||!(n.type===`element`&&(n.tagName===`a`||n.tagName===`audio`||n.tagName===`del`||n.tagName===`ins`||n.tagName===`map`||n.tagName===`noscript`||n.tagName===`video`))}function li(e,t,n){let r=K(n,t);return!r||r.type===`element`&&r.tagName===`li`}function dt(e,t,n){let r=K(n,t);return!!(r&&r.type===`element`&&(r.tagName===`dt`||r.tagName===`dd`))}function dd(e,t,n){let r=K(n,t);return!r||r.type===`element`&&(r.tagName===`dt`||r.tagName===`dd`)}function rubyElement(e,t,n){let r=K(n,t);return!r||r.type===`element`&&(r.tagName===`rp`||r.tagName===`rt`)}function optgroup(e,t,n){let r=K(n,t);return!r||r.type===`element`&&r.tagName===`optgroup`}function option(e,t,n){let r=K(n,t);return!r||r.type===`element`&&(r.tagName===`option`||r.tagName===`optgroup`)}function thead(e,t,n){let r=K(n,t);return!!(r&&r.type===`element`&&(r.tagName===`tbody`||r.tagName===`tfoot`))}function tbody$1(e,t,n){let r=K(n,t);return!r||r.type===`element`&&(r.tagName===`tbody`||r.tagName===`tfoot`)}e(tbody$1,`tbody`);function tfoot(e,t,n){return!K(n,t)}function tr(e,t,n){let r=K(n,t);return!r||r.type===`element`&&r.tagName===`tr`}function cells(e,t,n){let r=K(n,t);return!r||r.type===`element`&&(r.tagName===`td`||r.tagName===`th`)}const Z=omission({body,colgroup,head,html,tbody});function html(e){let t=K(e,-1);return!t||t.type!==`comment`}function head(e){let t=new Set;for(let n of e.children)if(n.type===`element`&&(n.tagName===`base`||n.tagName===`title`)){if(t.has(n.tagName))return!1;t.add(n.tagName)}let n=e.children[0];return!n||n.type===`element`}function body(e){let t=K(e,-1,!0);return!t||t.type!==`comment`&&!(t.type===`text`&&whitespace(t.value.charAt(0)))&&!(t.type===`element`&&(t.tagName===`meta`||t.tagName===`link`||t.tagName===`script`||t.tagName===`style`||t.tagName===`template`))}function colgroup(e,t,n){let r=q(n,t),i=K(e,-1,!0);return n&&r&&r.type===`element`&&r.tagName===`colgroup`&&X(r,n.children.indexOf(r),n)?!1:!!(i&&i.type===`element`&&i.tagName===`col`)}function tbody(e,t,n){let r=q(n,t),i=K(e,-1);return n&&r&&r.type===`element`&&(r.tagName===`thead`||r.tagName===`tbody`)&&X(r,n.children.indexOf(r),n)?!1:!!(i&&i.type===`element`&&i.tagName===`tr`)}const Q={name:[[`
|
|
1
|
+
import{n as e,r as t}from"../rolldown-runtime.mjs";const n=[`area`,`base`,`basefont`,`bgsound`,`br`,`col`,`command`,`embed`,`frame`,`hr`,`image`,`img`,`input`,`keygen`,`link`,`meta`,`param`,`source`,`track`,`wbr`];var Schema=class{constructor(e,t,n){this.normal=t,this.property=e,n&&(this.space=n)}};Schema.prototype.normal={},Schema.prototype.property={},Schema.prototype.space=void 0;function merge(e,t){let n={},r={};for(let t of e)Object.assign(n,t.property),Object.assign(r,t.normal);return new Schema(n,r,t)}function normalize(e){return e.toLowerCase()}var Info=class{constructor(e,t){this.attribute=t,this.property=e}};Info.prototype.attribute=``,Info.prototype.booleanish=!1,Info.prototype.boolean=!1,Info.prototype.commaOrSpaceSeparated=!1,Info.prototype.commaSeparated=!1,Info.prototype.defined=!1,Info.prototype.mustUseProperty=!1,Info.prototype.number=!1,Info.prototype.overloadedBoolean=!1,Info.prototype.property=``,Info.prototype.spaceSeparated=!1,Info.prototype.space=void 0;var r=e({boolean:()=>a,booleanish:()=>o,commaOrSpaceSeparated:()=>d,commaSeparated:()=>u,number:()=>c,overloadedBoolean:()=>s,spaceSeparated:()=>l});let i=0;const a=increment(),o=increment(),s=increment(),c=increment(),l=increment(),u=increment(),d=increment();function increment(){return 2**++i}const f=Object.keys(r);var DefinedInfo=class extends Info{constructor(e,t,n,i){let a=-1;if(super(e,t),mark(this,`space`,i),typeof n==`number`)for(;++a<f.length;){let e=f[a];mark(this,f[a],(n&r[e])===r[e])}}};DefinedInfo.prototype.defined=!0;function mark(e,t,n){n&&(e[t]=n)}function create(e){let t={},n={};for(let[r,i]of Object.entries(e.properties)){let a=new DefinedInfo(r,e.transform(e.attributes||{},r),i,e.space);e.mustUseProperty&&e.mustUseProperty.includes(r)&&(a.mustUseProperty=!0),t[r]=a,n[normalize(r)]=r,n[normalize(a.attribute)]=r}return new Schema(t,n,e.space)}const m=create({properties:{ariaActiveDescendant:null,ariaAtomic:o,ariaAutoComplete:null,ariaBusy:o,ariaChecked:o,ariaColCount:c,ariaColIndex:c,ariaColSpan:c,ariaControls:l,ariaCurrent:null,ariaDescribedBy:l,ariaDetails:null,ariaDisabled:o,ariaDropEffect:l,ariaErrorMessage:null,ariaExpanded:o,ariaFlowTo:l,ariaGrabbed:o,ariaHasPopup:null,ariaHidden:o,ariaInvalid:null,ariaKeyShortcuts:null,ariaLabel:null,ariaLabelledBy:l,ariaLevel:c,ariaLive:null,ariaModal:o,ariaMultiLine:o,ariaMultiSelectable:o,ariaOrientation:null,ariaOwns:l,ariaPlaceholder:null,ariaPosInSet:c,ariaPressed:o,ariaReadOnly:o,ariaRelevant:null,ariaRequired:o,ariaRoleDescription:l,ariaRowCount:c,ariaRowIndex:c,ariaRowSpan:c,ariaSelected:o,ariaSetSize:c,ariaSort:null,ariaValueMax:c,ariaValueMin:c,ariaValueNow:c,ariaValueText:null,role:null},transform(e,t){return t===`role`?t:`aria-`+t.slice(4).toLowerCase()}});function caseSensitiveTransform(e,t){return t in e?e[t]:t}function caseInsensitiveTransform(e,t){return caseSensitiveTransform(e,t.toLowerCase())}const h=create({attributes:{acceptcharset:`accept-charset`,classname:`class`,htmlfor:`for`,httpequiv:`http-equiv`},mustUseProperty:[`checked`,`multiple`,`muted`,`selected`],properties:{abbr:null,accept:u,acceptCharset:l,accessKey:l,action:null,allow:null,allowFullScreen:a,allowPaymentRequest:a,allowUserMedia:a,alt:null,as:null,async:a,autoCapitalize:null,autoComplete:l,autoFocus:a,autoPlay:a,blocking:l,capture:null,charSet:null,checked:a,cite:null,className:l,cols:c,colSpan:null,content:null,contentEditable:o,controls:a,controlsList:l,coords:c|u,crossOrigin:null,data:null,dateTime:null,decoding:null,default:a,defer:a,dir:null,dirName:null,disabled:a,download:s,draggable:o,encType:null,enterKeyHint:null,fetchPriority:null,form:null,formAction:null,formEncType:null,formMethod:null,formNoValidate:a,formTarget:null,headers:l,height:c,hidden:a,high:c,href:null,hrefLang:null,htmlFor:l,httpEquiv:l,id:null,imageSizes:null,imageSrcSet:null,inert:a,inputMode:null,integrity:null,is:null,isMap:a,itemId:null,itemProp:l,itemRef:l,itemScope:a,itemType:l,kind:null,label:null,lang:null,language:null,list:null,loading:null,loop:a,low:c,manifest:null,max:null,maxLength:c,media:null,method:null,min:null,minLength:c,multiple:a,muted:a,name:null,nonce:null,noModule:a,noValidate:a,onAbort:null,onAfterPrint:null,onAuxClick:null,onBeforeMatch:null,onBeforePrint:null,onBeforeToggle:null,onBeforeUnload:null,onBlur:null,onCancel:null,onCanPlay:null,onCanPlayThrough:null,onChange:null,onClick:null,onClose:null,onContextLost:null,onContextMenu:null,onContextRestored:null,onCopy:null,onCueChange:null,onCut:null,onDblClick:null,onDrag:null,onDragEnd:null,onDragEnter:null,onDragExit:null,onDragLeave:null,onDragOver:null,onDragStart:null,onDrop:null,onDurationChange:null,onEmptied:null,onEnded:null,onError:null,onFocus:null,onFormData:null,onHashChange:null,onInput:null,onInvalid:null,onKeyDown:null,onKeyPress:null,onKeyUp:null,onLanguageChange:null,onLoad:null,onLoadedData:null,onLoadedMetadata:null,onLoadEnd:null,onLoadStart:null,onMessage:null,onMessageError:null,onMouseDown:null,onMouseEnter:null,onMouseLeave:null,onMouseMove:null,onMouseOut:null,onMouseOver:null,onMouseUp:null,onOffline:null,onOnline:null,onPageHide:null,onPageShow:null,onPaste:null,onPause:null,onPlay:null,onPlaying:null,onPopState:null,onProgress:null,onRateChange:null,onRejectionHandled:null,onReset:null,onResize:null,onScroll:null,onScrollEnd:null,onSecurityPolicyViolation:null,onSeeked:null,onSeeking:null,onSelect:null,onSlotChange:null,onStalled:null,onStorage:null,onSubmit:null,onSuspend:null,onTimeUpdate:null,onToggle:null,onUnhandledRejection:null,onUnload:null,onVolumeChange:null,onWaiting:null,onWheel:null,open:a,optimum:c,pattern:null,ping:l,placeholder:null,playsInline:a,popover:null,popoverTarget:null,popoverTargetAction:null,poster:null,preload:null,readOnly:a,referrerPolicy:null,rel:l,required:a,reversed:a,rows:c,rowSpan:c,sandbox:l,scope:null,scoped:a,seamless:a,selected:a,shadowRootClonable:a,shadowRootDelegatesFocus:a,shadowRootMode:null,shape:null,size:c,sizes:null,slot:null,span:c,spellCheck:o,src:null,srcDoc:null,srcLang:null,srcSet:null,start:c,step:null,style:null,tabIndex:c,target:null,title:null,translate:null,type:null,typeMustMatch:a,useMap:null,value:o,width:c,wrap:null,writingSuggestions:null,align:null,aLink:null,archive:l,axis:null,background:null,bgColor:null,border:c,borderColor:null,bottomMargin:c,cellPadding:null,cellSpacing:null,char:null,charOff:null,classId:null,clear:null,code:null,codeBase:null,codeType:null,color:null,compact:a,declare:a,event:null,face:null,frame:null,frameBorder:null,hSpace:c,leftMargin:c,link:null,longDesc:null,lowSrc:null,marginHeight:c,marginWidth:c,noResize:a,noHref:a,noShade:a,noWrap:a,object:null,profile:null,prompt:null,rev:null,rightMargin:c,rules:null,scheme:null,scrolling:o,standby:null,summary:null,text:null,topMargin:c,valueType:null,version:null,vAlign:null,vLink:null,vSpace:c,allowTransparency:null,autoCorrect:null,autoSave:null,disablePictureInPicture:a,disableRemotePlayback:a,prefix:null,property:null,results:c,security:null,unselectable:null},space:`html`,transform:caseInsensitiveTransform}),g=create({attributes:{accentHeight:`accent-height`,alignmentBaseline:`alignment-baseline`,arabicForm:`arabic-form`,baselineShift:`baseline-shift`,capHeight:`cap-height`,className:`class`,clipPath:`clip-path`,clipRule:`clip-rule`,colorInterpolation:`color-interpolation`,colorInterpolationFilters:`color-interpolation-filters`,colorProfile:`color-profile`,colorRendering:`color-rendering`,crossOrigin:`crossorigin`,dataType:`datatype`,dominantBaseline:`dominant-baseline`,enableBackground:`enable-background`,fillOpacity:`fill-opacity`,fillRule:`fill-rule`,floodColor:`flood-color`,floodOpacity:`flood-opacity`,fontFamily:`font-family`,fontSize:`font-size`,fontSizeAdjust:`font-size-adjust`,fontStretch:`font-stretch`,fontStyle:`font-style`,fontVariant:`font-variant`,fontWeight:`font-weight`,glyphName:`glyph-name`,glyphOrientationHorizontal:`glyph-orientation-horizontal`,glyphOrientationVertical:`glyph-orientation-vertical`,hrefLang:`hreflang`,horizAdvX:`horiz-adv-x`,horizOriginX:`horiz-origin-x`,horizOriginY:`horiz-origin-y`,imageRendering:`image-rendering`,letterSpacing:`letter-spacing`,lightingColor:`lighting-color`,markerEnd:`marker-end`,markerMid:`marker-mid`,markerStart:`marker-start`,navDown:`nav-down`,navDownLeft:`nav-down-left`,navDownRight:`nav-down-right`,navLeft:`nav-left`,navNext:`nav-next`,navPrev:`nav-prev`,navRight:`nav-right`,navUp:`nav-up`,navUpLeft:`nav-up-left`,navUpRight:`nav-up-right`,onAbort:`onabort`,onActivate:`onactivate`,onAfterPrint:`onafterprint`,onBeforePrint:`onbeforeprint`,onBegin:`onbegin`,onCancel:`oncancel`,onCanPlay:`oncanplay`,onCanPlayThrough:`oncanplaythrough`,onChange:`onchange`,onClick:`onclick`,onClose:`onclose`,onCopy:`oncopy`,onCueChange:`oncuechange`,onCut:`oncut`,onDblClick:`ondblclick`,onDrag:`ondrag`,onDragEnd:`ondragend`,onDragEnter:`ondragenter`,onDragExit:`ondragexit`,onDragLeave:`ondragleave`,onDragOver:`ondragover`,onDragStart:`ondragstart`,onDrop:`ondrop`,onDurationChange:`ondurationchange`,onEmptied:`onemptied`,onEnd:`onend`,onEnded:`onended`,onError:`onerror`,onFocus:`onfocus`,onFocusIn:`onfocusin`,onFocusOut:`onfocusout`,onHashChange:`onhashchange`,onInput:`oninput`,onInvalid:`oninvalid`,onKeyDown:`onkeydown`,onKeyPress:`onkeypress`,onKeyUp:`onkeyup`,onLoad:`onload`,onLoadedData:`onloadeddata`,onLoadedMetadata:`onloadedmetadata`,onLoadStart:`onloadstart`,onMessage:`onmessage`,onMouseDown:`onmousedown`,onMouseEnter:`onmouseenter`,onMouseLeave:`onmouseleave`,onMouseMove:`onmousemove`,onMouseOut:`onmouseout`,onMouseOver:`onmouseover`,onMouseUp:`onmouseup`,onMouseWheel:`onmousewheel`,onOffline:`onoffline`,onOnline:`ononline`,onPageHide:`onpagehide`,onPageShow:`onpageshow`,onPaste:`onpaste`,onPause:`onpause`,onPlay:`onplay`,onPlaying:`onplaying`,onPopState:`onpopstate`,onProgress:`onprogress`,onRateChange:`onratechange`,onRepeat:`onrepeat`,onReset:`onreset`,onResize:`onresize`,onScroll:`onscroll`,onSeeked:`onseeked`,onSeeking:`onseeking`,onSelect:`onselect`,onShow:`onshow`,onStalled:`onstalled`,onStorage:`onstorage`,onSubmit:`onsubmit`,onSuspend:`onsuspend`,onTimeUpdate:`ontimeupdate`,onToggle:`ontoggle`,onUnload:`onunload`,onVolumeChange:`onvolumechange`,onWaiting:`onwaiting`,onZoom:`onzoom`,overlinePosition:`overline-position`,overlineThickness:`overline-thickness`,paintOrder:`paint-order`,panose1:`panose-1`,pointerEvents:`pointer-events`,referrerPolicy:`referrerpolicy`,renderingIntent:`rendering-intent`,shapeRendering:`shape-rendering`,stopColor:`stop-color`,stopOpacity:`stop-opacity`,strikethroughPosition:`strikethrough-position`,strikethroughThickness:`strikethrough-thickness`,strokeDashArray:`stroke-dasharray`,strokeDashOffset:`stroke-dashoffset`,strokeLineCap:`stroke-linecap`,strokeLineJoin:`stroke-linejoin`,strokeMiterLimit:`stroke-miterlimit`,strokeOpacity:`stroke-opacity`,strokeWidth:`stroke-width`,tabIndex:`tabindex`,textAnchor:`text-anchor`,textDecoration:`text-decoration`,textRendering:`text-rendering`,transformOrigin:`transform-origin`,typeOf:`typeof`,underlinePosition:`underline-position`,underlineThickness:`underline-thickness`,unicodeBidi:`unicode-bidi`,unicodeRange:`unicode-range`,unitsPerEm:`units-per-em`,vAlphabetic:`v-alphabetic`,vHanging:`v-hanging`,vIdeographic:`v-ideographic`,vMathematical:`v-mathematical`,vectorEffect:`vector-effect`,vertAdvY:`vert-adv-y`,vertOriginX:`vert-origin-x`,vertOriginY:`vert-origin-y`,wordSpacing:`word-spacing`,writingMode:`writing-mode`,xHeight:`x-height`,playbackOrder:`playbackorder`,timelineBegin:`timelinebegin`},properties:{about:d,accentHeight:c,accumulate:null,additive:null,alignmentBaseline:null,alphabetic:c,amplitude:c,arabicForm:null,ascent:c,attributeName:null,attributeType:null,azimuth:c,bandwidth:null,baselineShift:null,baseFrequency:null,baseProfile:null,bbox:null,begin:null,bias:c,by:null,calcMode:null,capHeight:c,className:l,clip:null,clipPath:null,clipPathUnits:null,clipRule:null,color:null,colorInterpolation:null,colorInterpolationFilters:null,colorProfile:null,colorRendering:null,content:null,contentScriptType:null,contentStyleType:null,crossOrigin:null,cursor:null,cx:null,cy:null,d:null,dataType:null,defaultAction:null,descent:c,diffuseConstant:c,direction:null,display:null,dur:null,divisor:c,dominantBaseline:null,download:a,dx:null,dy:null,edgeMode:null,editable:null,elevation:c,enableBackground:null,end:null,event:null,exponent:c,externalResourcesRequired:null,fill:null,fillOpacity:c,fillRule:null,filter:null,filterRes:null,filterUnits:null,floodColor:null,floodOpacity:null,focusable:null,focusHighlight:null,fontFamily:null,fontSize:null,fontSizeAdjust:null,fontStretch:null,fontStyle:null,fontVariant:null,fontWeight:null,format:null,fr:null,from:null,fx:null,fy:null,g1:u,g2:u,glyphName:u,glyphOrientationHorizontal:null,glyphOrientationVertical:null,glyphRef:null,gradientTransform:null,gradientUnits:null,handler:null,hanging:c,hatchContentUnits:null,hatchUnits:null,height:null,href:null,hrefLang:null,horizAdvX:c,horizOriginX:c,horizOriginY:c,id:null,ideographic:c,imageRendering:null,initialVisibility:null,in:null,in2:null,intercept:c,k:c,k1:c,k2:c,k3:c,k4:c,kernelMatrix:d,kernelUnitLength:null,keyPoints:null,keySplines:null,keyTimes:null,kerning:null,lang:null,lengthAdjust:null,letterSpacing:null,lightingColor:null,limitingConeAngle:c,local:null,markerEnd:null,markerMid:null,markerStart:null,markerHeight:null,markerUnits:null,markerWidth:null,mask:null,maskContentUnits:null,maskUnits:null,mathematical:null,max:null,media:null,mediaCharacterEncoding:null,mediaContentEncodings:null,mediaSize:c,mediaTime:null,method:null,min:null,mode:null,name:null,navDown:null,navDownLeft:null,navDownRight:null,navLeft:null,navNext:null,navPrev:null,navRight:null,navUp:null,navUpLeft:null,navUpRight:null,numOctaves:null,observer:null,offset:null,onAbort:null,onActivate:null,onAfterPrint:null,onBeforePrint:null,onBegin:null,onCancel:null,onCanPlay:null,onCanPlayThrough:null,onChange:null,onClick:null,onClose:null,onCopy:null,onCueChange:null,onCut:null,onDblClick:null,onDrag:null,onDragEnd:null,onDragEnter:null,onDragExit:null,onDragLeave:null,onDragOver:null,onDragStart:null,onDrop:null,onDurationChange:null,onEmptied:null,onEnd:null,onEnded:null,onError:null,onFocus:null,onFocusIn:null,onFocusOut:null,onHashChange:null,onInput:null,onInvalid:null,onKeyDown:null,onKeyPress:null,onKeyUp:null,onLoad:null,onLoadedData:null,onLoadedMetadata:null,onLoadStart:null,onMessage:null,onMouseDown:null,onMouseEnter:null,onMouseLeave:null,onMouseMove:null,onMouseOut:null,onMouseOver:null,onMouseUp:null,onMouseWheel:null,onOffline:null,onOnline:null,onPageHide:null,onPageShow:null,onPaste:null,onPause:null,onPlay:null,onPlaying:null,onPopState:null,onProgress:null,onRateChange:null,onRepeat:null,onReset:null,onResize:null,onScroll:null,onSeeked:null,onSeeking:null,onSelect:null,onShow:null,onStalled:null,onStorage:null,onSubmit:null,onSuspend:null,onTimeUpdate:null,onToggle:null,onUnload:null,onVolumeChange:null,onWaiting:null,onZoom:null,opacity:null,operator:null,order:null,orient:null,orientation:null,origin:null,overflow:null,overlay:null,overlinePosition:c,overlineThickness:c,paintOrder:null,panose1:null,path:null,pathLength:c,patternContentUnits:null,patternTransform:null,patternUnits:null,phase:null,ping:l,pitch:null,playbackOrder:null,pointerEvents:null,points:null,pointsAtX:c,pointsAtY:c,pointsAtZ:c,preserveAlpha:null,preserveAspectRatio:null,primitiveUnits:null,propagate:null,property:d,r:null,radius:null,referrerPolicy:null,refX:null,refY:null,rel:d,rev:d,renderingIntent:null,repeatCount:null,repeatDur:null,requiredExtensions:d,requiredFeatures:d,requiredFonts:d,requiredFormats:d,resource:null,restart:null,result:null,rotate:null,rx:null,ry:null,scale:null,seed:null,shapeRendering:null,side:null,slope:null,snapshotTime:null,specularConstant:c,specularExponent:c,spreadMethod:null,spacing:null,startOffset:null,stdDeviation:null,stemh:null,stemv:null,stitchTiles:null,stopColor:null,stopOpacity:null,strikethroughPosition:c,strikethroughThickness:c,string:null,stroke:null,strokeDashArray:d,strokeDashOffset:null,strokeLineCap:null,strokeLineJoin:null,strokeMiterLimit:c,strokeOpacity:c,strokeWidth:null,style:null,surfaceScale:c,syncBehavior:null,syncBehaviorDefault:null,syncMaster:null,syncTolerance:null,syncToleranceDefault:null,systemLanguage:d,tabIndex:c,tableValues:null,target:null,targetX:c,targetY:c,textAnchor:null,textDecoration:null,textRendering:null,textLength:null,timelineBegin:null,title:null,transformBehavior:null,type:null,typeOf:d,to:null,transform:null,transformOrigin:null,u1:null,u2:null,underlinePosition:c,underlineThickness:c,unicode:null,unicodeBidi:null,unicodeRange:null,unitsPerEm:c,values:null,vAlphabetic:c,vMathematical:c,vectorEffect:null,vHanging:c,vIdeographic:c,version:null,vertAdvY:c,vertOriginX:c,vertOriginY:c,viewBox:null,viewTarget:null,visibility:null,width:null,widths:null,wordSpacing:null,writingMode:null,x:null,x1:null,x2:null,xChannelSelector:null,xHeight:c,y:null,y1:null,y2:null,yChannelSelector:null,z:null,zoomAndPan:null},space:`svg`,transform:caseSensitiveTransform}),_=create({properties:{xLinkActuate:null,xLinkArcRole:null,xLinkHref:null,xLinkRole:null,xLinkShow:null,xLinkTitle:null,xLinkType:null},space:`xlink`,transform(e,t){return`xlink:`+t.slice(5).toLowerCase()}}),v=create({attributes:{xmlnsxlink:`xmlns:xlink`},properties:{xmlnsXLink:null,xmlns:null},space:`xmlns`,transform:caseInsensitiveTransform}),y=create({properties:{xmlBase:null,xmlLang:null,xmlSpace:null},space:`xml`,transform(e,t){return`xml:`+t.slice(3).toLowerCase()}}),b=/[A-Z]/g,x=/-[a-z]/g,S=/^data[-\w.:]+$/i;function find(e,t){let n=normalize(t),r=t,i=Info;if(n in e.normal)return e.property[e.normal[n]];if(n.length>4&&n.slice(0,4)===`data`&&S.test(t)){if(t.charAt(4)===`-`){let e=t.slice(5).replace(x,camelcase);r=`data`+e.charAt(0).toUpperCase()+e.slice(1)}else{let e=t.slice(4);if(!x.test(e)){let n=e.replace(b,kebab);n.charAt(0)!==`-`&&(n=`-`+n),t=`data`+n}}i=DefinedInfo}return new i(r,t)}function kebab(e){return`-`+e.toLowerCase()}function camelcase(e){return e.charAt(1).toUpperCase()}const C=merge([m,h,_,v,y],`html`),w=merge([m,g,_,v,y],`svg`),T={}.hasOwnProperty;function zwitch(e,t){let n=t||{};function one(t,...n){let r=one.invalid,i=one.handlers;if(t&&T.call(t,e)){let n=String(t[e]);r=T.call(i,n)?i[n]:one.unknown}if(r)return r.call(this,t,...n)}return one.handlers=n.handlers||{},one.invalid=n.invalid,one.unknown=n.unknown,one}const E=/["&'<>`]/g,D=/[\uD800-\uDBFF][\uDC00-\uDFFF]/g,O=/[\x01-\t\v\f\x0E-\x1F\x7F\x81\x8D\x8F\x90\x9D\xA0-\uFFFF]/g,k=/[|\\{}()[\]^$+*?.]/g,A=new WeakMap;function core(e,t){if(e=e.replace(t.subset?charactersToExpressionCached(t.subset):E,basic),t.subset||t.escapeOnly)return e;return e.replace(D,surrogate).replace(O,basic);function surrogate(e,n,r){return t.format((e.charCodeAt(0)-55296)*1024+e.charCodeAt(1)-56320+65536,r.charCodeAt(n+2),t)}function basic(e,n,r){return t.format(e.charCodeAt(0),r.charCodeAt(n+1),t)}}function charactersToExpressionCached(e){let t=A.get(e);return t||(t=charactersToExpression(e),A.set(e,t)),t}function charactersToExpression(e){let t=[],n=-1;for(;++n<e.length;)t.push(e[n].replace(k,`\\$&`));return RegExp(`(?:`+t.join(`|`)+`)`,`g`)}const j=/[\dA-Fa-f]/;function toHexadecimal(e,t,n){let r=`&#x`+e.toString(16).toUpperCase();return n&&t&&!j.test(String.fromCharCode(t))?r:r+`;`}const M=/\d/;function toDecimal(e,t,n){let r=`&#`+String(e);return n&&t&&!M.test(String.fromCharCode(t))?r:r+`;`}const N=`AElig.AMP.Aacute.Acirc.Agrave.Aring.Atilde.Auml.COPY.Ccedil.ETH.Eacute.Ecirc.Egrave.Euml.GT.Iacute.Icirc.Igrave.Iuml.LT.Ntilde.Oacute.Ocirc.Ograve.Oslash.Otilde.Ouml.QUOT.REG.THORN.Uacute.Ucirc.Ugrave.Uuml.Yacute.aacute.acirc.acute.aelig.agrave.amp.aring.atilde.auml.brvbar.ccedil.cedil.cent.copy.curren.deg.divide.eacute.ecirc.egrave.eth.euml.frac12.frac14.frac34.gt.iacute.icirc.iexcl.igrave.iquest.iuml.laquo.lt.macr.micro.middot.nbsp.not.ntilde.oacute.ocirc.ograve.ordf.ordm.oslash.otilde.ouml.para.plusmn.pound.quot.raquo.reg.sect.shy.sup1.sup2.sup3.szlig.thorn.times.uacute.ucirc.ugrave.uml.uuml.yacute.yen.yuml`.split(`.`),P={nbsp:`\xA0`,iexcl:`¡`,cent:`¢`,pound:`£`,curren:`¤`,yen:`¥`,brvbar:`¦`,sect:`§`,uml:`¨`,copy:`©`,ordf:`ª`,laquo:`«`,not:`¬`,shy:``,reg:`®`,macr:`¯`,deg:`°`,plusmn:`±`,sup2:`²`,sup3:`³`,acute:`´`,micro:`µ`,para:`¶`,middot:`·`,cedil:`¸`,sup1:`¹`,ordm:`º`,raquo:`»`,frac14:`¼`,frac12:`½`,frac34:`¾`,iquest:`¿`,Agrave:`À`,Aacute:`Á`,Acirc:`Â`,Atilde:`Ã`,Auml:`Ä`,Aring:`Å`,AElig:`Æ`,Ccedil:`Ç`,Egrave:`È`,Eacute:`É`,Ecirc:`Ê`,Euml:`Ë`,Igrave:`Ì`,Iacute:`Í`,Icirc:`Î`,Iuml:`Ï`,ETH:`Ð`,Ntilde:`Ñ`,Ograve:`Ò`,Oacute:`Ó`,Ocirc:`Ô`,Otilde:`Õ`,Ouml:`Ö`,times:`×`,Oslash:`Ø`,Ugrave:`Ù`,Uacute:`Ú`,Ucirc:`Û`,Uuml:`Ü`,Yacute:`Ý`,THORN:`Þ`,szlig:`ß`,agrave:`à`,aacute:`á`,acirc:`â`,atilde:`ã`,auml:`ä`,aring:`å`,aelig:`æ`,ccedil:`ç`,egrave:`è`,eacute:`é`,ecirc:`ê`,euml:`ë`,igrave:`ì`,iacute:`í`,icirc:`î`,iuml:`ï`,eth:`ð`,ntilde:`ñ`,ograve:`ò`,oacute:`ó`,ocirc:`ô`,otilde:`õ`,ouml:`ö`,divide:`÷`,oslash:`ø`,ugrave:`ù`,uacute:`ú`,ucirc:`û`,uuml:`ü`,yacute:`ý`,thorn:`þ`,yuml:`ÿ`,fnof:`ƒ`,Alpha:`Α`,Beta:`Β`,Gamma:`Γ`,Delta:`Δ`,Epsilon:`Ε`,Zeta:`Ζ`,Eta:`Η`,Theta:`Θ`,Iota:`Ι`,Kappa:`Κ`,Lambda:`Λ`,Mu:`Μ`,Nu:`Ν`,Xi:`Ξ`,Omicron:`Ο`,Pi:`Π`,Rho:`Ρ`,Sigma:`Σ`,Tau:`Τ`,Upsilon:`Υ`,Phi:`Φ`,Chi:`Χ`,Psi:`Ψ`,Omega:`Ω`,alpha:`α`,beta:`β`,gamma:`γ`,delta:`δ`,epsilon:`ε`,zeta:`ζ`,eta:`η`,theta:`θ`,iota:`ι`,kappa:`κ`,lambda:`λ`,mu:`μ`,nu:`ν`,xi:`ξ`,omicron:`ο`,pi:`π`,rho:`ρ`,sigmaf:`ς`,sigma:`σ`,tau:`τ`,upsilon:`υ`,phi:`φ`,chi:`χ`,psi:`ψ`,omega:`ω`,thetasym:`ϑ`,upsih:`ϒ`,piv:`ϖ`,bull:`•`,hellip:`…`,prime:`′`,Prime:`″`,oline:`‾`,frasl:`⁄`,weierp:`℘`,image:`ℑ`,real:`ℜ`,trade:`™`,alefsym:`ℵ`,larr:`←`,uarr:`↑`,rarr:`→`,darr:`↓`,harr:`↔`,crarr:`↵`,lArr:`⇐`,uArr:`⇑`,rArr:`⇒`,dArr:`⇓`,hArr:`⇔`,forall:`∀`,part:`∂`,exist:`∃`,empty:`∅`,nabla:`∇`,isin:`∈`,notin:`∉`,ni:`∋`,prod:`∏`,sum:`∑`,minus:`−`,lowast:`∗`,radic:`√`,prop:`∝`,infin:`∞`,ang:`∠`,and:`∧`,or:`∨`,cap:`∩`,cup:`∪`,int:`∫`,there4:`∴`,sim:`∼`,cong:`≅`,asymp:`≈`,ne:`≠`,equiv:`≡`,le:`≤`,ge:`≥`,sub:`⊂`,sup:`⊃`,nsub:`⊄`,sube:`⊆`,supe:`⊇`,oplus:`⊕`,otimes:`⊗`,perp:`⊥`,sdot:`⋅`,lceil:`⌈`,rceil:`⌉`,lfloor:`⌊`,rfloor:`⌋`,lang:`〈`,rang:`〉`,loz:`◊`,spades:`♠`,clubs:`♣`,hearts:`♥`,diams:`♦`,quot:`"`,amp:`&`,lt:`<`,gt:`>`,OElig:`Œ`,oelig:`œ`,Scaron:`Š`,scaron:`š`,Yuml:`Ÿ`,circ:`ˆ`,tilde:`˜`,ensp:` `,emsp:` `,thinsp:` `,zwnj:``,zwj:``,lrm:``,rlm:``,ndash:`–`,mdash:`—`,lsquo:`‘`,rsquo:`’`,sbquo:`‚`,ldquo:`“`,rdquo:`”`,bdquo:`„`,dagger:`†`,Dagger:`‡`,permil:`‰`,lsaquo:`‹`,rsaquo:`›`,euro:`€`},F=[`cent`,`copy`,`divide`,`gt`,`lt`,`not`,`para`,`times`],I={}.hasOwnProperty,L={};let R;for(R in P)I.call(P,R)&&(L[P[R]]=R);const z=/[^\dA-Za-z]/;function toNamed(e,t,n,r){let i=String.fromCharCode(e);if(I.call(L,i)){let e=L[i],a=`&`+e;return n&&N.includes(e)&&!F.includes(e)&&(!r||t&&t!==61&&z.test(String.fromCharCode(t)))?a:a+`;`}return``}function formatSmart(e,t,n){let r=toHexadecimal(e,t,n.omitOptionalSemicolons),i;if((n.useNamedReferences||n.useShortestReferences)&&(i=toNamed(e,t,n.omitOptionalSemicolons,n.attribute)),(n.useShortestReferences||!i)&&n.useShortestReferences){let i=toDecimal(e,t,n.omitOptionalSemicolons);i.length<r.length&&(r=i)}return i&&(!n.useShortestReferences||i.length<r.length)?i:r}function stringifyEntities(e,t){return core(e,Object.assign({format:formatSmart},t))}const B=/^>|^->|<!--|-->|--!>|<!-$/g,V=[`>`],H=[`<`,`>`];function comment(e,t,n,r){return r.settings.bogusComments?`<?`+stringifyEntities(e.value,Object.assign({},r.settings.characterReferences,{subset:V}))+`>`:`<!--`+e.value.replace(B,encode)+`-->`;function encode(e){return stringifyEntities(e,Object.assign({},r.settings.characterReferences,{subset:H}))}}function doctype(e,t,n,r){return`<!`+(r.settings.upperDoctype?`DOCTYPE`:`doctype`)+(r.settings.tightDoctype?``:` `)+`html>`}function ccount(e,t){let n=String(e);if(typeof t!=`string`)throw TypeError(`Expected character`);let r=0,i=n.indexOf(t);for(;i!==-1;)r++,i=n.indexOf(t,i+t.length);return r}function stringify$1(e,t){let n=t||{};return(e[e.length-1]===``?[...e,``]:e).join((n.padRight?` `:``)+`,`+(n.padLeft===!1?``:` `)).trim()}t(stringify$1,`stringify`);function stringify(e){return e.join(` `).trim()}const U=/[ \t\n\f\r]/g;function whitespace(e){return typeof e==`object`?e.type===`text`&&empty(e.value):empty(e)}function empty(e){return e.replace(U,``)===``}const W=siblings(1),G=siblings(-1),K=[];function siblings(e){return sibling;function sibling(t,n,r){let i=t?t.children:K,a=(n||0)+e,o=i[a];if(!r)for(;o&&whitespace(o);)a+=e,o=i[a];return o}}const q={}.hasOwnProperty;function omission(e){return omit;function omit(t,n,r){return q.call(e,t.tagName)&&e[t.tagName](t,n,r)}}const J=omission({body:body$1,caption:headOrColgroupOrCaption,colgroup:headOrColgroupOrCaption,dd,dt,head:headOrColgroupOrCaption,html:html$1,li,optgroup,option,p,rp:rubyElement,rt:rubyElement,tbody:tbody$1,td:cells,tfoot,th:cells,thead,tr});function headOrColgroupOrCaption(e,t,n){let r=W(n,t,!0);return!r||r.type!==`comment`&&!(r.type===`text`&&whitespace(r.value.charAt(0)))}function html$1(e,t,n){let r=W(n,t);return!r||r.type!==`comment`}t(html$1,`html`);function body$1(e,t,n){let r=W(n,t);return!r||r.type!==`comment`}t(body$1,`body`);function p(e,t,n){let r=W(n,t);return r?r.type===`element`&&(r.tagName===`address`||r.tagName===`article`||r.tagName===`aside`||r.tagName===`blockquote`||r.tagName===`details`||r.tagName===`div`||r.tagName===`dl`||r.tagName===`fieldset`||r.tagName===`figcaption`||r.tagName===`figure`||r.tagName===`footer`||r.tagName===`form`||r.tagName===`h1`||r.tagName===`h2`||r.tagName===`h3`||r.tagName===`h4`||r.tagName===`h5`||r.tagName===`h6`||r.tagName===`header`||r.tagName===`hgroup`||r.tagName===`hr`||r.tagName===`main`||r.tagName===`menu`||r.tagName===`nav`||r.tagName===`ol`||r.tagName===`p`||r.tagName===`pre`||r.tagName===`section`||r.tagName===`table`||r.tagName===`ul`):!n||n.type!==`element`||n.tagName!==`a`&&n.tagName!==`audio`&&n.tagName!==`del`&&n.tagName!==`ins`&&n.tagName!==`map`&&n.tagName!==`noscript`&&n.tagName!==`video`}function li(e,t,n){let r=W(n,t);return!r||r.type===`element`&&r.tagName===`li`}function dt(e,t,n){let r=W(n,t);return!!(r&&r.type===`element`&&(r.tagName===`dt`||r.tagName===`dd`))}function dd(e,t,n){let r=W(n,t);return!r||r.type===`element`&&(r.tagName===`dt`||r.tagName===`dd`)}function rubyElement(e,t,n){let r=W(n,t);return!r||r.type===`element`&&(r.tagName===`rp`||r.tagName===`rt`)}function optgroup(e,t,n){let r=W(n,t);return!r||r.type===`element`&&r.tagName===`optgroup`}function option(e,t,n){let r=W(n,t);return!r||r.type===`element`&&(r.tagName===`option`||r.tagName===`optgroup`)}function thead(e,t,n){let r=W(n,t);return!!(r&&r.type===`element`&&(r.tagName===`tbody`||r.tagName===`tfoot`))}function tbody$1(e,t,n){let r=W(n,t);return!r||r.type===`element`&&(r.tagName===`tbody`||r.tagName===`tfoot`)}t(tbody$1,`tbody`);function tfoot(e,t,n){return!W(n,t)}function tr(e,t,n){let r=W(n,t);return!r||r.type===`element`&&r.tagName===`tr`}function cells(e,t,n){let r=W(n,t);return!r||r.type===`element`&&(r.tagName===`td`||r.tagName===`th`)}const Y=omission({body,colgroup,head,html,tbody});function html(e){let t=W(e,-1);return!t||t.type!==`comment`}function head(e){let t=new Set;for(let n of e.children)if(n.type===`element`&&(n.tagName===`base`||n.tagName===`title`)){if(t.has(n.tagName))return!1;t.add(n.tagName)}let n=e.children[0];return!n||n.type===`element`}function body(e){let t=W(e,-1,!0);return!t||t.type!==`comment`&&!(t.type===`text`&&whitespace(t.value.charAt(0)))&&(t.type!==`element`||t.tagName!==`meta`&&t.tagName!==`link`&&t.tagName!==`script`&&t.tagName!==`style`&&t.tagName!==`template`)}function colgroup(e,t,n){let r=G(n,t),i=W(e,-1,!0);return n&&r&&r.type===`element`&&r.tagName===`colgroup`&&J(r,n.children.indexOf(r),n)?!1:!!(i&&i.type===`element`&&i.tagName===`col`)}function tbody(e,t,n){let r=G(n,t),i=W(e,-1);return n&&r&&r.type===`element`&&(r.tagName===`thead`||r.tagName===`tbody`)&&J(r,n.children.indexOf(r),n)?!1:!!(i&&i.type===`element`&&i.tagName===`tr`)}const X={name:[[`
|
|
2
2
|
\f\r &/=>`.split(``),`
|
|
3
3
|
\f\r "&'/=>\``.split(``)],[`\0
|
|
4
4
|
\f\r "&'/<=>`.split(``),`\0
|
|
@@ -6,4 +6,4 @@ import{i as e,r as t}from"../rolldown-runtime.mjs";import{t as n}from"./characte
|
|
|
6
6
|
\f\r &>`.split(``),`\0
|
|
7
7
|
\f\r "&'<=>\``.split(``)],[`\0
|
|
8
8
|
\f\r "&'<=>\``.split(``),`\0
|
|
9
|
-
\f\r "&'<=>\``.split(``)]],single:[[`&'`.split(``),`"&'\``.split(``)],[`\0&'`.split(``),`\0"&'\``.split(``)]],double:[[`"&`.split(``),`"&'\``.split(``)],[`\0"&`.split(``),`\0"&'\``.split(``)]]};function element(e,t,n,r){let i=r.schema,a=i.space
|
|
9
|
+
\f\r "&'<=>\``.split(``)]],single:[[`&'`.split(``),`"&'\``.split(``)],[`\0&'`.split(``),`\0"&'\``.split(``)]],double:[[`"&`.split(``),`"&'\``.split(``)],[`\0"&`.split(``),`\0"&'\``.split(``)]]};function element(e,t,n,r){let i=r.schema,a=i.space!==`svg`&&r.settings.omitOptionalTags,o=i.space===`svg`?r.settings.closeEmptyElements:r.settings.voids.includes(e.tagName.toLowerCase()),s=[],c;i.space===`html`&&e.tagName===`svg`&&(r.schema=w);let l=serializeAttributes(r,e.properties),u=r.all(i.space===`html`&&e.tagName===`template`?e.content:e);return r.schema=i,u&&(o=!1),(l||!a||!Y(e,t,n))&&(s.push(`<`,e.tagName,l?` `+l:``),o&&(i.space===`svg`||r.settings.closeSelfClosing)&&(c=l.charAt(l.length-1),(!r.settings.tightSelfClosing||c===`/`||c&&c!==`"`&&c!==`'`)&&s.push(` `),s.push(`/`)),s.push(`>`)),s.push(u),!o&&(!a||!J(e,t,n))&&s.push(`</`+e.tagName+`>`),s.join(``)}function serializeAttributes(e,t){let n=[],r=-1,i;if(t){for(i in t)if(t[i]!==null&&t[i]!==void 0){let r=serializeAttribute(e,i,t[i]);r&&n.push(r)}}for(;++r<n.length;){let t=e.settings.tightAttributes?n[r].charAt(n[r].length-1):void 0;r!==n.length-1&&t!==`"`&&t!==`'`&&(n[r]+=` `)}return n.join(``)}function serializeAttribute(e,t,n){let r=find(e.schema,t),i=e.settings.allowParseErrors&&e.schema.space===`html`?0:1,a=+!e.settings.allowDangerousCharacters,o=e.quote,s;if(r.overloadedBoolean&&(n===r.attribute||n===``)?n=!0:(r.boolean||r.overloadedBoolean)&&(typeof n!=`string`||n===r.attribute||n===``)&&(n=!!n),n==null||n===!1||typeof n==`number`&&Number.isNaN(n))return``;let c=stringifyEntities(r.attribute,Object.assign({},e.settings.characterReferences,{subset:X.name[i][a]}));return n===!0||(n=Array.isArray(n)?(r.commaSeparated?stringify$1:stringify)(n,{padLeft:!e.settings.tightCommaSeparatedLists}):String(n),e.settings.collapseEmptyAttributes&&!n)?c:(e.settings.preferUnquoted&&(s=stringifyEntities(n,Object.assign({},e.settings.characterReferences,{attribute:!0,subset:X.unquoted[i][a]}))),s!==n&&(e.settings.quoteSmart&&ccount(n,o)>ccount(n,e.alternative)&&(o=e.alternative),s=o+stringifyEntities(n,Object.assign({},e.settings.characterReferences,{subset:(o===`'`?X.single:X.double)[i][a],attribute:!0}))+o),c+(s&&`=`+s))}const Z=[`<`,`&`];function text(e,t,n,r){return n&&n.type===`element`&&(n.tagName===`script`||n.tagName===`style`)?e.value:stringifyEntities(e.value,Object.assign({},r.settings.characterReferences,{subset:Z}))}function raw(e,t,n,r){return r.settings.allowDangerousHtml?e.value:text(e,t,n,r)}function root(e,t,n,r){return r.all(e)}const Q=zwitch(`type`,{invalid,unknown,handlers:{comment,doctype,element,raw,root,text}});function invalid(e){throw Error("Expected node, not `"+e+"`")}function unknown(e){throw Error("Cannot compile unknown node `"+e.type+"`")}const $={},ee={},te=[];function toHtml(e,t){let r=t||$,i=r.quote||`"`,a=i===`"`?`'`:`"`;if(i!==`"`&&i!==`'`)throw Error("Invalid quote `"+i+"`, expected `'` or `\"`");return{one,all,settings:{omitOptionalTags:r.omitOptionalTags||!1,allowParseErrors:r.allowParseErrors||!1,allowDangerousCharacters:r.allowDangerousCharacters||!1,quoteSmart:r.quoteSmart||!1,preferUnquoted:r.preferUnquoted||!1,tightAttributes:r.tightAttributes||!1,upperDoctype:r.upperDoctype||!1,tightDoctype:r.tightDoctype||!1,bogusComments:r.bogusComments||!1,tightCommaSeparatedLists:r.tightCommaSeparatedLists||!1,tightSelfClosing:r.tightSelfClosing||!1,collapseEmptyAttributes:r.collapseEmptyAttributes||!1,allowDangerousHtml:r.allowDangerousHtml||!1,voids:r.voids||n,characterReferences:r.characterReferences||ee,closeSelfClosing:r.closeSelfClosing||!1,closeEmptyElements:r.closeEmptyElements||!1},schema:r.space===`svg`?w:C,quote:i,alternative:a}.one(Array.isArray(e)?{type:`root`,children:e}:e,void 0,void 0)}function one(e,t,n){return Q(e,t,n,this)}function all(e){let t=[],n=e&&e.children||te,r=-1;for(;++r<n.length;)t[r]=this.one(n[r],r,e);return t.join(``)}export{ccount as n,toHtml as t};
|