@dbt-tools/web 0.5.9 → 0.6.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.
@@ -1 +0,0 @@
1
- (function(){var e=(e,t)=>()=>(t||e((t={exports:{}}).exports,t),t.exports);let t={accent:`#635BFF`,text:`#171C28`,textSoft:`#6B7385`,bg:`#F6F7FB`,bgSoft:`#FFFFFF`,borderDefault:`#D7DCE7`,borderSubtle:`#E6E9F0`,slate:`#64748B`,rose:`#C0352B`,mint:`#0F8A4B`,amber:`#A56315`},n={accent:`#8A7CFF`,text:`#F3F6FC`,textSoft:`#98A3BC`,bg:`#0D1120`,bgSoft:`#151A2E`,borderDefault:`#313A58`,borderSubtle:`#262E47`,slate:`#8690AA`,rose:`#FF8D86`,mint:`#59D38C`,amber:`#F5B95C`};t.mint,t.rose,t.slate,t.rose,t.mint,t.rose,t.amber,t.slate,n.mint,n.rose,n.slate,n.rose,n.mint,n.rose,n.amber,n.slate,t.text,t.textSoft,t.slate,t.accent,n.text,n.textSoft,n.slate,n.accent;let r=new Set([`model`,`seed`,`snapshot`,`source`,`source_freshness`,`test`,`unit_test`,`metric`,`semantic_model`]),i=new Set([`test`,`unit_test`]);[...r].filter(e=>!i.has(e)).sort((e,t)=>e.localeCompare(t));var a=e(((e,t)=>{var n=typeof Reflect==`object`?Reflect:null,r=n&&typeof n.apply==`function`?n.apply:function(e,t,n){return Function.prototype.apply.call(e,t,n)},i=n&&typeof n.ownKeys==`function`?n.ownKeys:Object.getOwnPropertySymbols?function(e){return Object.getOwnPropertyNames(e).concat(Object.getOwnPropertySymbols(e))}:function(e){return Object.getOwnPropertyNames(e)};function a(e){console&&console.warn&&console.warn(e)}var o=Number.isNaN||function(e){return e!==e};function s(){s.init.call(this)}t.exports=s,t.exports.once=y,s.EventEmitter=s,s.prototype._events=void 0,s.prototype._eventsCount=0,s.prototype._maxListeners=void 0;var c=10;function l(e){if(typeof e!=`function`)throw TypeError(`The "listener" argument must be of type Function. Received type `+typeof e)}Object.defineProperty(s,`defaultMaxListeners`,{enumerable:!0,get:function(){return c},set:function(e){if(typeof e!=`number`||e<0||o(e))throw RangeError(`The value of "defaultMaxListeners" is out of range. It must be a non-negative number. Received `+e+`.`);c=e}}),s.init=function(){(this._events===void 0||this._events===Object.getPrototypeOf(this)._events)&&(this._events=Object.create(null),this._eventsCount=0),this._maxListeners=this._maxListeners||void 0},s.prototype.setMaxListeners=function(e){if(typeof e!=`number`||e<0||o(e))throw RangeError(`The value of "n" is out of range. It must be a non-negative number. Received `+e+`.`);return this._maxListeners=e,this};function u(e){return e._maxListeners===void 0?s.defaultMaxListeners:e._maxListeners}s.prototype.getMaxListeners=function(){return u(this)},s.prototype.emit=function(e){for(var t=[],n=1;n<arguments.length;n++)t.push(arguments[n]);var i=e===`error`,a=this._events;if(a!==void 0)i&&=a.error===void 0;else if(!i)return!1;if(i){var o;if(t.length>0&&(o=t[0]),o instanceof Error)throw o;var s=Error(`Unhandled error.`+(o?` (`+o.message+`)`:``));throw s.context=o,s}var c=a[e];if(c===void 0)return!1;if(typeof c==`function`)r(c,this,t);else for(var l=c.length,u=g(c,l),n=0;n<l;++n)r(u[n],this,t);return!0};function d(e,t,n,r){var i,o,s;if(l(n),o=e._events,o===void 0?(o=e._events=Object.create(null),e._eventsCount=0):(o.newListener!==void 0&&(e.emit(`newListener`,t,n.listener?n.listener:n),o=e._events),s=o[t]),s===void 0)s=o[t]=n,++e._eventsCount;else if(typeof s==`function`?s=o[t]=r?[n,s]:[s,n]:r?s.unshift(n):s.push(n),i=u(e),i>0&&s.length>i&&!s.warned){s.warned=!0;var c=Error(`Possible EventEmitter memory leak detected. `+s.length+` `+String(t)+` listeners added. Use emitter.setMaxListeners() to increase limit`);c.name=`MaxListenersExceededWarning`,c.emitter=e,c.type=t,c.count=s.length,a(c)}return e}s.prototype.addListener=function(e,t){return d(this,e,t,!1)},s.prototype.on=s.prototype.addListener,s.prototype.prependListener=function(e,t){return d(this,e,t,!0)};function f(){if(!this.fired)return this.target.removeListener(this.type,this.wrapFn),this.fired=!0,arguments.length===0?this.listener.call(this.target):this.listener.apply(this.target,arguments)}function p(e,t,n){var r={fired:!1,wrapFn:void 0,target:e,type:t,listener:n},i=f.bind(r);return i.listener=n,r.wrapFn=i,i}s.prototype.once=function(e,t){return l(t),this.on(e,p(this,e,t)),this},s.prototype.prependOnceListener=function(e,t){return l(t),this.prependListener(e,p(this,e,t)),this},s.prototype.removeListener=function(e,t){var n,r,i,a,o;if(l(t),r=this._events,r===void 0||(n=r[e],n===void 0))return this;if(n===t||n.listener===t)--this._eventsCount===0?this._events=Object.create(null):(delete r[e],r.removeListener&&this.emit(`removeListener`,e,n.listener||t));else if(typeof n!=`function`){for(i=-1,a=n.length-1;a>=0;a--)if(n[a]===t||n[a].listener===t){o=n[a].listener,i=a;break}if(i<0)return this;i===0?n.shift():_(n,i),n.length===1&&(r[e]=n[0]),r.removeListener!==void 0&&this.emit(`removeListener`,e,o||t)}return this},s.prototype.off=s.prototype.removeListener,s.prototype.removeAllListeners=function(e){var t,n=this._events,r;if(n===void 0)return this;if(n.removeListener===void 0)return arguments.length===0?(this._events=Object.create(null),this._eventsCount=0):n[e]!==void 0&&(--this._eventsCount===0?this._events=Object.create(null):delete n[e]),this;if(arguments.length===0){var i=Object.keys(n),a;for(r=0;r<i.length;++r)a=i[r],a!==`removeListener`&&this.removeAllListeners(a);return this.removeAllListeners(`removeListener`),this._events=Object.create(null),this._eventsCount=0,this}if(t=n[e],typeof t==`function`)this.removeListener(e,t);else if(t!==void 0)for(r=t.length-1;r>=0;r--)this.removeListener(e,t[r]);return this};function m(e,t,n){var r=e._events;if(r===void 0)return[];var i=r[t];return i===void 0?[]:typeof i==`function`?n?[i.listener||i]:[i]:n?v(i):g(i,i.length)}s.prototype.listeners=function(e){return m(this,e,!0)},s.prototype.rawListeners=function(e){return m(this,e,!1)},s.listenerCount=function(e,t){return typeof e.listenerCount==`function`?e.listenerCount(t):h.call(e,t)},s.prototype.listenerCount=h;function h(e){var t=this._events;if(t!==void 0){var n=t[e];if(typeof n==`function`)return 1;if(n!==void 0)return n.length}return 0}s.prototype.eventNames=function(){return this._eventsCount>0?i(this._events):[]};function g(e,t){for(var n=Array(t),r=0;r<t;++r)n[r]=e[r];return n}function _(e,t){for(;t+1<e.length;t++)e[t]=e[t+1];e.pop()}function v(e){for(var t=Array(e.length),n=0;n<t.length;++n)t[n]=e[n].listener||e[n];return t}function y(e,t){return new Promise(function(n,r){function i(n){e.removeListener(t,a),r(n)}function a(){typeof e.removeListener==`function`&&e.removeListener(`error`,i),n([].slice.call(arguments))}x(e,t,a,{once:!0}),t!==`error`&&b(e,i,{once:!0})})}function b(e,t,n){typeof e.on==`function`&&x(e,`error`,t,n)}function x(e,t,n,r){if(typeof e.on==`function`)r.once?e.once(t,n):e.on(t,n);else if(typeof e.addEventListener==`function`)e.addEventListener(t,function i(a){r.once&&e.removeEventListener(t,i),n(a)});else throw TypeError(`The "emitter" argument must be of type EventEmitter. Received type `+typeof e)}}))();function o(){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 s=o;typeof Object.assign==`function`&&(s=Object.assign);function c(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 l(e){return typeof e==`object`&&!!e}function u(e){let t;for(t in e)return!1;return!0}function d(e,t,n){Object.defineProperty(e,t,{enumerable:!1,configurable:!1,writable:!0,value:n})}function f(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 p(e){return!(!l(e)||e.attributes&&!Array.isArray(e.attributes))}function m(){let e=Math.floor(Math.random()*256)&255;return()=>e++}function h(){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 g(){return{[Symbol.iterator](){return this},next(){return{done:!0}}}}var _=class extends Error{constructor(e){super(),this.name=`GraphError`,this.message=e}},v=class e extends _{constructor(t){super(t),this.name=`InvalidArgumentsGraphError`,typeof Error.captureStackTrace==`function`&&Error.captureStackTrace(this,e.prototype.constructor)}},y=class e extends _{constructor(t){super(t),this.name=`NotFoundGraphError`,typeof Error.captureStackTrace==`function`&&Error.captureStackTrace(this,e.prototype.constructor)}},b=class e extends _{constructor(t){super(t),this.name=`UsageGraphError`,typeof Error.captureStackTrace==`function`&&Error.captureStackTrace(this,e.prototype.constructor)}};function x(e,t){this.key=e,this.attributes=t,this.clear()}x.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 ee(e,t){this.key=e,this.attributes=t,this.clear()}ee.prototype.clear=function(){this.inDegree=0,this.outDegree=0,this.directedLoops=0,this.in={},this.out={}};function te(e,t){this.key=e,this.attributes=t,this.clear()}te.prototype.clear=function(){this.undirectedDegree=0,this.undirectedLoops=0,this.undirected={}};function S(e,t,n,r,i){this.key=t,this.attributes=i,this.undirected=e,this.source=n,this.target=r}S.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)},S.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},S.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]},S.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 C(e,t,n,r,i,a,o){let s,c,l,u;if(r=``+r,n===0){if(s=e._nodes.get(r),!s)throw new y(`Graph.${t}: could not find the "${r}" node in the graph.`);l=i,u=a}else if(n===3){if(i=``+i,c=e._edges.get(i),!c)throw new y(`Graph.${t}: could not find the "${i}" edge in the graph.`);let n=c.source.key,d=c.target.key;if(r===n)s=c.target;else if(r===d)s=c.source;else throw new y(`Graph.${t}: the "${r}" node is not attached to the "${i}" edge (${n}, ${d}).`);l=a,u=o}else{if(c=e._edges.get(r),!c)throw new y(`Graph.${t}: could not find the "${r}" edge in the graph.`);s=n===1?c.source:c.target,l=i,u=a}return[s,l,u]}function ne(e,t,n){e.prototype[t]=function(e,r,i){let[a,o]=C(this,t,n,e,r,i);return a.attributes[o]}}function re(e,t,n){e.prototype[t]=function(e,r){let[i]=C(this,t,n,e,r);return i.attributes}}function ie(e,t,n){e.prototype[t]=function(e,r,i){let[a,o]=C(this,t,n,e,r,i);return a.attributes.hasOwnProperty(o)}}function ae(e,t,n){e.prototype[t]=function(e,r,i,a){let[o,s,c]=C(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 oe(e,t,n){e.prototype[t]=function(e,r,i,a){let[o,s,c]=C(this,t,n,e,r,i,a);if(typeof c!=`function`)throw new v(`Graph.${t}: updater should be a function.`);let l=o.attributes;return l[s]=c(l[s]),this.emit(`nodeAttributesUpdated`,{key:o.key,type:`set`,attributes:o.attributes,name:s}),this}}function se(e,t,n){e.prototype[t]=function(e,r,i){let[a,o]=C(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 ce(e,t,n){e.prototype[t]=function(e,r,i){let[a,o]=C(this,t,n,e,r,i);if(!l(o))throw new v(`Graph.${t}: provided attributes are not a plain object.`);return a.attributes=o,this.emit(`nodeAttributesUpdated`,{key:a.key,type:`replace`,attributes:a.attributes}),this}}function le(e,t,n){e.prototype[t]=function(e,r,i){let[a,o]=C(this,t,n,e,r,i);if(!l(o))throw new v(`Graph.${t}: provided attributes are not a plain object.`);return s(a.attributes,o),this.emit(`nodeAttributesUpdated`,{key:a.key,type:`merge`,attributes:a.attributes,data:o}),this}}function ue(e,t,n){e.prototype[t]=function(e,r,i){let[a,o]=C(this,t,n,e,r,i);if(typeof o!=`function`)throw new v(`Graph.${t}: provided updater is not a function.`);return a.attributes=o(a.attributes),this.emit(`nodeAttributesUpdated`,{key:a.key,type:`update`,attributes:a.attributes}),this}}let de=[{name:e=>`get${e}Attribute`,attacher:ne},{name:e=>`get${e}Attributes`,attacher:re},{name:e=>`has${e}Attribute`,attacher:ie},{name:e=>`set${e}Attribute`,attacher:ae},{name:e=>`update${e}Attribute`,attacher:oe},{name:e=>`remove${e}Attribute`,attacher:se},{name:e=>`replace${e}Attributes`,attacher:ce},{name:e=>`merge${e}Attributes`,attacher:le},{name:e=>`update${e}Attributes`,attacher:ue}];function fe(e){de.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 pe(e,t,n){e.prototype[t]=function(e,r){let i;if(this.type!==`mixed`&&n!==`mixed`&&n!==this.type)throw new b(`Graph.${t}: cannot find this type of edges in your ${this.type} graph.`);if(arguments.length>2){if(this.multi)throw new b(`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 a=``+e,o=``+r;if(r=arguments[2],i=c(this,a,o,n),!i)throw new y(`Graph.${t}: could not find an edge for the given path ("${a}" - "${o}").`)}else{if(n!==`mixed`)throw new b(`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,i=this._edges.get(e),!i)throw new y(`Graph.${t}: could not find the "${e}" edge in the graph.`)}return i.attributes[r]}}function me(e,t,n){e.prototype[t]=function(e){let r;if(this.type!==`mixed`&&n!==`mixed`&&n!==this.type)throw new b(`Graph.${t}: cannot find this type of edges in your ${this.type} graph.`);if(arguments.length>1){if(this.multi)throw new b(`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 i=``+e,a=``+arguments[1];if(r=c(this,i,a,n),!r)throw new y(`Graph.${t}: could not find an edge for the given path ("${i}" - "${a}").`)}else{if(n!==`mixed`)throw new b(`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,r=this._edges.get(e),!r)throw new y(`Graph.${t}: could not find the "${e}" edge in the graph.`)}return r.attributes}}function he(e,t,n){e.prototype[t]=function(e,r){let i;if(this.type!==`mixed`&&n!==`mixed`&&n!==this.type)throw new b(`Graph.${t}: cannot find this type of edges in your ${this.type} graph.`);if(arguments.length>2){if(this.multi)throw new b(`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 a=``+e,o=``+r;if(r=arguments[2],i=c(this,a,o,n),!i)throw new y(`Graph.${t}: could not find an edge for the given path ("${a}" - "${o}").`)}else{if(n!==`mixed`)throw new b(`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,i=this._edges.get(e),!i)throw new y(`Graph.${t}: could not find the "${e}" edge in the graph.`)}return i.attributes.hasOwnProperty(r)}}function ge(e,t,n){e.prototype[t]=function(e,r,i){let a;if(this.type!==`mixed`&&n!==`mixed`&&n!==this.type)throw new b(`Graph.${t}: cannot find this type of edges in your ${this.type} graph.`);if(arguments.length>3){if(this.multi)throw new b(`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=``+r;if(r=arguments[2],i=arguments[3],a=c(this,o,s,n),!a)throw new y(`Graph.${t}: could not find an edge for the given path ("${o}" - "${s}").`)}else{if(n!==`mixed`)throw new b(`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 y(`Graph.${t}: could not find the "${e}" edge in the graph.`)}return a.attributes[r]=i,this.emit(`edgeAttributesUpdated`,{key:a.key,type:`set`,attributes:a.attributes,name:r}),this}}function _e(e,t,n){e.prototype[t]=function(e,r,i){let a;if(this.type!==`mixed`&&n!==`mixed`&&n!==this.type)throw new b(`Graph.${t}: cannot find this type of edges in your ${this.type} graph.`);if(arguments.length>3){if(this.multi)throw new b(`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=``+r;if(r=arguments[2],i=arguments[3],a=c(this,o,s,n),!a)throw new y(`Graph.${t}: could not find an edge for the given path ("${o}" - "${s}").`)}else{if(n!==`mixed`)throw new b(`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 y(`Graph.${t}: could not find the "${e}" edge in the graph.`)}if(typeof i!=`function`)throw new v(`Graph.${t}: updater should be a function.`);return a.attributes[r]=i(a.attributes[r]),this.emit(`edgeAttributesUpdated`,{key:a.key,type:`set`,attributes:a.attributes,name:r}),this}}function ve(e,t,n){e.prototype[t]=function(e,r){let i;if(this.type!==`mixed`&&n!==`mixed`&&n!==this.type)throw new b(`Graph.${t}: cannot find this type of edges in your ${this.type} graph.`);if(arguments.length>2){if(this.multi)throw new b(`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 a=``+e,o=``+r;if(r=arguments[2],i=c(this,a,o,n),!i)throw new y(`Graph.${t}: could not find an edge for the given path ("${a}" - "${o}").`)}else{if(n!==`mixed`)throw new b(`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,i=this._edges.get(e),!i)throw new y(`Graph.${t}: could not find the "${e}" edge in the graph.`)}return delete i.attributes[r],this.emit(`edgeAttributesUpdated`,{key:i.key,type:`remove`,attributes:i.attributes,name:r}),this}}function ye(e,t,n){e.prototype[t]=function(e,r){let i;if(this.type!==`mixed`&&n!==`mixed`&&n!==this.type)throw new b(`Graph.${t}: cannot find this type of edges in your ${this.type} graph.`);if(arguments.length>2){if(this.multi)throw new b(`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 a=``+e,o=``+r;if(r=arguments[2],i=c(this,a,o,n),!i)throw new y(`Graph.${t}: could not find an edge for the given path ("${a}" - "${o}").`)}else{if(n!==`mixed`)throw new b(`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,i=this._edges.get(e),!i)throw new y(`Graph.${t}: could not find the "${e}" edge in the graph.`)}if(!l(r))throw new v(`Graph.${t}: provided attributes are not a plain object.`);return i.attributes=r,this.emit(`edgeAttributesUpdated`,{key:i.key,type:`replace`,attributes:i.attributes}),this}}function be(e,t,n){e.prototype[t]=function(e,r){let i;if(this.type!==`mixed`&&n!==`mixed`&&n!==this.type)throw new b(`Graph.${t}: cannot find this type of edges in your ${this.type} graph.`);if(arguments.length>2){if(this.multi)throw new b(`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 a=``+e,o=``+r;if(r=arguments[2],i=c(this,a,o,n),!i)throw new y(`Graph.${t}: could not find an edge for the given path ("${a}" - "${o}").`)}else{if(n!==`mixed`)throw new b(`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,i=this._edges.get(e),!i)throw new y(`Graph.${t}: could not find the "${e}" edge in the graph.`)}if(!l(r))throw new v(`Graph.${t}: provided attributes are not a plain object.`);return s(i.attributes,r),this.emit(`edgeAttributesUpdated`,{key:i.key,type:`merge`,attributes:i.attributes,data:r}),this}}function xe(e,t,n){e.prototype[t]=function(e,r){let i;if(this.type!==`mixed`&&n!==`mixed`&&n!==this.type)throw new b(`Graph.${t}: cannot find this type of edges in your ${this.type} graph.`);if(arguments.length>2){if(this.multi)throw new b(`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 a=``+e,o=``+r;if(r=arguments[2],i=c(this,a,o,n),!i)throw new y(`Graph.${t}: could not find an edge for the given path ("${a}" - "${o}").`)}else{if(n!==`mixed`)throw new b(`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,i=this._edges.get(e),!i)throw new y(`Graph.${t}: could not find the "${e}" edge in the graph.`)}if(typeof r!=`function`)throw new v(`Graph.${t}: provided updater is not a function.`);return i.attributes=r(i.attributes),this.emit(`edgeAttributesUpdated`,{key:i.key,type:`update`,attributes:i.attributes}),this}}let Se=[{name:e=>`get${e}Attribute`,attacher:pe},{name:e=>`get${e}Attributes`,attacher:me},{name:e=>`has${e}Attribute`,attacher:he},{name:e=>`set${e}Attribute`,attacher:ge},{name:e=>`update${e}Attribute`,attacher:_e},{name:e=>`remove${e}Attribute`,attacher:ve},{name:e=>`replace${e}Attributes`,attacher:ye},{name:e=>`merge${e}Attributes`,attacher:be},{name:e=>`update${e}Attributes`,attacher:xe}];function Ce(e){Se.forEach(function({name:t,attacher:n}){n(e,t(`Edge`),`mixed`),n(e,t(`DirectedEdge`),`directed`),n(e,t(`UndirectedEdge`),`undirected`)})}let we=[{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 Te(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 Ee(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 w(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 De(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 Oe(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 T(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 ke(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 E(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 Ae(e,t){if(e.size===0)return g();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 D(e,t,n,r,i,a){let o=t?Ee:Te,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 je(e,t,n,r){let i=[];return D(!1,e,t,n,r,function(e){i.push(e)}),i}function Me(e,t,n){let r=g();return e!==`undirected`&&(t!==`out`&&n.in!==void 0&&(r=h(r,w(n.in))),t!==`in`&&n.out!==void 0&&(r=h(r,w(n.out,t?void 0:n.key)))),e!==`directed`&&n.undirected!==void 0&&(r=h(r,w(n.undirected))),r}function O(e,t,n,r,i,a,o){let s=n?Oe:De,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 Ne(e,t,n,r,i){let a=[];return O(!1,e,t,n,r,i,function(e){a.push(e)}),a}function Pe(e,t,n,r){let i=g();return e!==`undirected`&&(n.in!==void 0&&t!==`out`&&r in n.in&&(i=h(i,T(n.in,r))),n.out!==void 0&&t!==`in`&&r in n.out&&(t||n.key!==r)&&(i=h(i,T(n.out,r)))),e!==`directed`&&n.undirected!==void 0&&r in n.undirected&&(i=h(i,T(n.undirected,r))),i}function Fe(e,t){let{name:n,type:r,direction:i}=t;e.prototype[n]=function(e,t){if(r!==`mixed`&&this.type!==`mixed`&&r!==this.type)return[];if(!arguments.length)return ke(this,r);if(arguments.length===1){e=``+e;let t=this._nodes.get(e);if(t===void 0)throw new y(`Graph.${n}: could not find the "${e}" node in the graph.`);return je(this.multi,r===`mixed`?this.type:r,i,t)}if(arguments.length===2){e=``+e,t=``+t;let a=this._nodes.get(e);if(!a)throw new y(`Graph.${n}: could not find the "${e}" source node in the graph.`);if(!this._nodes.has(t))throw new y(`Graph.${n}: could not find the "${t}" target node in the graph.`);return Ne(r,this.multi,i,a,t)}throw new v(`Graph.${n}: too many arguments (expecting 0, 1 or 2 and got ${arguments.length}).`)}}function Ie(e,t){let{name:n,type:r,direction:i}=t,a=`forEach`+n[0].toUpperCase()+n.slice(1,-1);e.prototype[a]=function(e,t,n){if(!(r!==`mixed`&&this.type!==`mixed`&&r!==this.type)){if(arguments.length===1)return n=e,E(!1,this,r,n);if(arguments.length===2){e=``+e,n=t;let o=this._nodes.get(e);if(o===void 0)throw new y(`Graph.${a}: could not find the "${e}" node in the graph.`);return D(!1,this.multi,r===`mixed`?this.type:r,i,o,n)}if(arguments.length===3){e=``+e,t=``+t;let o=this._nodes.get(e);if(!o)throw new y(`Graph.${a}: could not find the "${e}" source node in the graph.`);if(!this._nodes.has(t))throw new y(`Graph.${a}: could not find the "${t}" target node in the graph.`);return O(!1,r,this.multi,i,o,t,n)}throw new v(`Graph.${a}: too many arguments (expecting 1, 2 or 3 and got ${arguments.length}).`)}};let o=`map`+n[0].toUpperCase()+n.slice(1);e.prototype[o]=function(){let e=Array.prototype.slice.call(arguments),t=e.pop(),n;if(e.length===0){let i=0;r!==`directed`&&(i+=this.undirectedSize),r!==`undirected`&&(i+=this.directedSize),n=Array(i);let a=0;e.push((e,r,i,o,s,c,l)=>{n[a++]=t(e,r,i,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[a].apply(this,e),n};let s=`filter`+n[0].toUpperCase()+n.slice(1);e.prototype[s]=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[a].apply(this,e),n};let c=`reduce`+n[0].toUpperCase()+n.slice(1);e.prototype[c]=function(){let e=Array.prototype.slice.call(arguments);if(e.length<2||e.length>4)throw new v(`Graph.${c}: 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 v(`Graph.${c}: 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,n;e.length===2?(t=e[0],n=e[1],e=[]):e.length===3?(t=e[1],n=e[2],e=[e[0]]):e.length===4&&(t=e[2],n=e[3],e=[e[0],e[1]]);let r=n;return e.push((e,n,i,a,o,s,c)=>{r=t(r,e,n,i,a,o,s,c)}),this[a].apply(this,e),r}}function Le(e,t){let{name:n,type:r,direction:i}=t,a=`find`+n[0].toUpperCase()+n.slice(1,-1);e.prototype[a]=function(e,t,n){if(r!==`mixed`&&this.type!==`mixed`&&r!==this.type)return!1;if(arguments.length===1)return n=e,E(!0,this,r,n);if(arguments.length===2){e=``+e,n=t;let o=this._nodes.get(e);if(o===void 0)throw new y(`Graph.${a}: could not find the "${e}" node in the graph.`);return D(!0,this.multi,r===`mixed`?this.type:r,i,o,n)}if(arguments.length===3){e=``+e,t=``+t;let o=this._nodes.get(e);if(!o)throw new y(`Graph.${a}: could not find the "${e}" source node in the graph.`);if(!this._nodes.has(t))throw new y(`Graph.${a}: could not find the "${t}" target node in the graph.`);return O(!0,r,this.multi,i,o,t,n)}throw new v(`Graph.${a}: too many arguments (expecting 1, 2 or 3 and got ${arguments.length}).`)};let o=`some`+n[0].toUpperCase()+n.slice(1,-1);e.prototype[o]=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[a].apply(this,e)};let s=`every`+n[0].toUpperCase()+n.slice(1,-1);e.prototype[s]=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[a].apply(this,e)}}function Re(e,t){let{name:n,type:r,direction:i}=t,a=n.slice(0,-1)+`Entries`;e.prototype[a]=function(e,t){if(r!==`mixed`&&this.type!==`mixed`&&r!==this.type)return g();if(!arguments.length)return Ae(this,r);if(arguments.length===1){e=``+e;let t=this._nodes.get(e);if(!t)throw new y(`Graph.${a}: could not find the "${e}" node in the graph.`);return Me(r,i,t)}if(arguments.length===2){e=``+e,t=``+t;let n=this._nodes.get(e);if(!n)throw new y(`Graph.${a}: could not find the "${e}" source node in the graph.`);if(!this._nodes.has(t))throw new y(`Graph.${a}: could not find the "${t}" target node in the graph.`);return Pe(r,i,n,t)}throw new v(`Graph.${a}: too many arguments (expecting 0, 1 or 2 and got ${arguments.length}).`)}}function ze(e){we.forEach(t=>{Fe(e,t),Ie(e,t),Le(e,t),Re(e,t)})}let Be=[{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 k(){this.A=null,this.B=null}k.prototype.wrap=function(e){this.A===null?this.A=e:this.B===null&&(this.B=e)},k.prototype.has=function(e){return this.A!==null&&e in this.A||this.B!==null&&e in this.B};function A(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 j(e,t,n,r,i){if(t!==`mixed`){if(t===`undirected`)return A(e,null,r,r.undirected,i);if(typeof n==`string`)return A(e,null,r,r[n],i)}let a=new k,o;if(t!==`undirected`){if(n!==`out`){if(o=A(e,null,r,r.in,i),e&&o)return o;a.wrap(r.in)}if(n!==`in`){if(o=A(e,a,r,r.out,i),e&&o)return o;a.wrap(r.out)}}if(t!==`directed`&&(o=A(e,a,r,r.undirected,i),e&&o))return o}function Ve(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 j(!1,e,t,n,function(e){r.push(e)}),r}function M(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 He(e,t,n){if(e!==`mixed`){if(e===`undirected`)return M(null,n,n.undirected);if(typeof t==`string`)return M(null,n,n[t])}let r=g(),i=new k;return e!==`undirected`&&(t!==`out`&&(r=h(r,M(i,n,n.in))),t!==`in`&&(r=h(r,M(i,n,n.out)))),e!==`directed`&&(r=h(r,M(i,n,n.undirected))),r}function Ue(e,t){let{name:n,type:r,direction:i}=t;e.prototype[n]=function(e){if(r!==`mixed`&&this.type!==`mixed`&&r!==this.type)return[];e=``+e;let t=this._nodes.get(e);if(t===void 0)throw new y(`Graph.${n}: could not find the "${e}" node in the graph.`);return Ve(r===`mixed`?this.type:r,i,t)}}function We(e,t){let{name:n,type:r,direction:i}=t,a=`forEach`+n[0].toUpperCase()+n.slice(1,-1);e.prototype[a]=function(e,t){if(r!==`mixed`&&this.type!==`mixed`&&r!==this.type)return;e=``+e;let n=this._nodes.get(e);if(n===void 0)throw new y(`Graph.${a}: could not find the "${e}" node in the graph.`);j(!1,r===`mixed`?this.type:r,i,n,t)};let o=`map`+n[0].toUpperCase()+n.slice(1);e.prototype[o]=function(e,t){let n=[];return this[a](e,(e,r)=>{n.push(t(e,r))}),n};let s=`filter`+n[0].toUpperCase()+n.slice(1);e.prototype[s]=function(e,t){let n=[];return this[a](e,(e,r)=>{t(e,r)&&n.push(e)}),n};let c=`reduce`+n[0].toUpperCase()+n.slice(1);e.prototype[c]=function(e,t,n){if(arguments.length<3)throw new v(`Graph.${c}: 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=n;return this[a](e,(e,n)=>{r=t(r,e,n)}),r}}function Ge(e,t){let{name:n,type:r,direction:i}=t,a=n[0].toUpperCase()+n.slice(1,-1),o=`find`+a;e.prototype[o]=function(e,t){if(r!==`mixed`&&this.type!==`mixed`&&r!==this.type)return;e=``+e;let n=this._nodes.get(e);if(n===void 0)throw new y(`Graph.${o}: could not find the "${e}" node in the graph.`);return j(!0,r===`mixed`?this.type:r,i,n,t)};let s=`some`+a;e.prototype[s]=function(e,t){return!!this[o](e,t)};let c=`every`+a;e.prototype[c]=function(e,t){return!this[o](e,(e,n)=>!t(e,n))}}function Ke(e,t){let{name:n,type:r,direction:i}=t,a=n.slice(0,-1)+`Entries`;e.prototype[a]=function(e){if(r!==`mixed`&&this.type!==`mixed`&&r!==this.type)return g();e=``+e;let t=this._nodes.get(e);if(t===void 0)throw new y(`Graph.${a}: could not find the "${e}" node in the graph.`);return He(r===`mixed`?this.type:r,i,t)}}function qe(e){Be.forEach(t=>{Ue(e,t),We(e,t),Ge(e,t),Ke(e,t)})}function N(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 Je(e,t){let n={key:e};return u(t.attributes)||(n.attributes=s({},t.attributes)),n}function Ye(e,t,n){let r={key:t,source:n.source.key,target:n.target.key};return u(n.attributes)||(r.attributes=s({},n.attributes)),e===`mixed`&&n.undirected&&(r.undirected=!0),r}function Xe(e){if(!l(e))throw new v(`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 v(`Graph.import: serialized node is missing its key.`);if(`attributes`in e&&(!l(e.attributes)||e.attributes===null))throw new v(`Graph.import: invalid attributes. Attributes should be a plain object, null or omitted.`)}function Ze(e){if(!l(e))throw new v(`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 v(`Graph.import: serialized edge is missing its source.`);if(!(`target`in e))throw new v(`Graph.import: serialized edge is missing its target.`);if(`attributes`in e&&(!l(e.attributes)||e.attributes===null))throw new v(`Graph.import: invalid attributes. Attributes should be a plain object, null or omitted.`);if(`undirected`in e&&typeof e.undirected!=`boolean`)throw new v(`Graph.import: invalid undirectedness information. Undirected should be boolean or omitted.`)}let Qe=m(),$e=new Set([`directed`,`undirected`,`mixed`]),et=new Set([`domain`,`_events`,`_eventsCount`,`_maxListeners`]),tt=[{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`}],nt={allowSelfLoops:!0,multi:!1,type:`mixed`};function rt(e,t,n){if(n&&!l(n))throw new v(`Graph.addNode: invalid attributes. Expecting an object but got "${n}"`);if(t=``+t,n||={},e._nodes.has(t))throw new b(`Graph.addNode: the "${t}" node already exist in the graph.`);let r=new e.NodeDataClass(t,n);return e._nodes.set(t,r),e.emit(`nodeAdded`,{key:t,attributes:n}),r}function P(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 F(e,t,n,r,i,a,o,s){if(!r&&e.type===`undirected`)throw new b(`Graph.${t}: you cannot add a directed edge to an undirected graph. Use the #.addEdge or #.addUndirectedEdge instead.`);if(r&&e.type===`directed`)throw new b(`Graph.${t}: you cannot add an undirected edge to a directed graph. Use the #.addEdge or #.addDirectedEdge instead.`);if(s&&!l(s))throw new v(`Graph.${t}: invalid attributes. Expecting an object but got "${s}"`);if(a=``+a,o=``+o,s||={},!e.allowSelfLoops&&a===o)throw new b(`Graph.${t}: source & target are the same ("${a}"), thus creating a loop explicitly forbidden by this graph 'allowSelfLoops' option set to false.`);let c=e._nodes.get(a),u=e._nodes.get(o);if(!c)throw new y(`Graph.${t}: source node "${a}" not found.`);if(!u)throw new y(`Graph.${t}: target node "${o}" not found.`);let d={key:null,undirected:r,source:a,target:o,attributes:s};if(n)i=e._edgeKeyGenerator();else if(i=``+i,e._edges.has(i))throw new b(`Graph.${t}: the "${i}" edge already exists in the graph.`);if(!e.multi&&(r?c.undirected[o]!==void 0:c.out[o]!==void 0))throw new b(`Graph.${t}: an edge linking "${a}" to "${o}" 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 f=new S(r,i,c,u,s);e._edges.set(i,f);let p=a===o;return r?(c.undirectedDegree++,u.undirectedDegree++,p&&(c.undirectedLoops++,e._undirectedSelfLoopCount++)):(c.outDegree++,u.inDegree++,p&&(c.directedLoops++,e._directedSelfLoopCount++)),e.multi?f.attachMulti():f.attach(),r?e._undirectedSize++:e._directedSize++,d.key=i,e.emit(`edgeAdded`,d),i}function it(e,t,n,r,i,a,o,c,u){if(!r&&e.type===`undirected`)throw new b(`Graph.${t}: you cannot merge/update a directed edge to an undirected graph. Use the #.mergeEdge/#.updateEdge or #.addUndirectedEdge instead.`);if(r&&e.type===`directed`)throw new b(`Graph.${t}: you cannot merge/update an undirected edge to a directed graph. Use the #.mergeEdge/#.updateEdge or #.addDirectedEdge instead.`);if(c){if(u){if(typeof c!=`function`)throw new v(`Graph.${t}: invalid updater function. Expecting a function but got "${c}"`)}else if(!l(c))throw new v(`Graph.${t}: invalid attributes. Expecting an object but got "${c}"`)}a=``+a,o=``+o;let d;if(u&&(d=c,c=void 0),!e.allowSelfLoops&&a===o)throw new b(`Graph.${t}: source & target are the same ("${a}"), thus creating a loop explicitly forbidden by this graph 'allowSelfLoops' option set to false.`);let f=e._nodes.get(a),p=e._nodes.get(o),m,h;if(!n&&(m=e._edges.get(i),m)){if((m.source.key!==a||m.target.key!==o)&&(!r||m.source.key!==o||m.target.key!==a))throw new b(`Graph.${t}: inconsistency detected when attempting to merge the "${i}" edge with "${a}" source & "${o}" target vs. ("${m.source.key}", "${m.target.key}").`);h=m}if(!h&&!e.multi&&f&&(h=r?f.undirected[o]:f.out[o]),h){let t=[h.key,!1,!1,!1];if(u?!d:!c)return t;if(u){let t=h.attributes;h.attributes=d(t),e.emit(`edgeAttributesUpdated`,{type:`replace`,key:h.key,attributes:h.attributes})}else s(h.attributes,c),e.emit(`edgeAttributesUpdated`,{type:`merge`,key:h.key,attributes:h.attributes,data:c});return t}c||={},u&&d&&(c=d(c));let g={key:null,undirected:r,source:a,target:o,attributes:c};if(n)i=e._edgeKeyGenerator();else if(i=``+i,e._edges.has(i))throw new b(`Graph.${t}: the "${i}" edge already exists in the graph.`);let _=!1,y=!1;f||(f=P(e,a,{}),_=!0,a===o&&(p=f,y=!0)),p||(p=P(e,o,{}),y=!0),m=new S(r,i,f,p,c),e._edges.set(i,m);let x=a===o;return r?(f.undirectedDegree++,p.undirectedDegree++,x&&(f.undirectedLoops++,e._undirectedSelfLoopCount++)):(f.outDegree++,p.inDegree++,x&&(f.directedLoops++,e._directedSelfLoopCount++)),e.multi?m.attachMulti():m.attach(),r?e._undirectedSize++:e._directedSize++,g.key=i,e.emit(`edgeAdded`,g),[i,!0,_,y]}function I(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 L=class e extends a.EventEmitter{constructor(e){if(super(),e=s({},nt,e),typeof e.multi!=`boolean`)throw new v(`Graph.constructor: invalid 'multi' option. Expecting a boolean but got "${e.multi}".`);if(!$e.has(e.type))throw new v(`Graph.constructor: invalid 'type' option. Should be one of "mixed", "directed" or "undirected" but got "${e.type}".`);if(typeof e.allowSelfLoops!=`boolean`)throw new v(`Graph.constructor: invalid 'allowSelfLoops' option. Expecting a boolean but got "${e.allowSelfLoops}".`);let t=e.type===`mixed`?x:e.type===`directed`?ee:te;d(this,`NodeDataClass`,t);let n=`geid_`+Qe()+`_`,r=0;d(this,`_attributes`,{}),d(this,`_nodes`,new Map),d(this,`_edges`,new Map),d(this,`_directedSize`,0),d(this,`_undirectedSize`,0),d(this,`_directedSelfLoopCount`,0),d(this,`_undirectedSelfLoopCount`,0),d(this,`_edgeKeyGenerator`,()=>{let e;do e=n+ r++;while(this._edges.has(e));return e}),d(this,`_options`,e),et.forEach(e=>d(this,e,this[e])),f(this,`order`,()=>this._nodes.size),f(this,`size`,()=>this._edges.size),f(this,`directedSize`,()=>this._directedSize),f(this,`undirectedSize`,()=>this._undirectedSize),f(this,`selfLoopCount`,()=>this._directedSelfLoopCount+this._undirectedSelfLoopCount),f(this,`directedSelfLoopCount`,()=>this._directedSelfLoopCount),f(this,`undirectedSelfLoopCount`,()=>this._undirectedSelfLoopCount),f(this,`multi`,this._options.multi),f(this,`type`,this._options.type),f(this,`allowSelfLoops`,this._options.allowSelfLoops),f(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 v(`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 v(`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 v(`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 b(`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 y(`Graph.directedEdge: could not find the "${e}" source node in the graph.`);if(!this._nodes.has(t))throw new y(`Graph.directedEdge: could not find the "${t}" target node in the graph.`);let r=n.out&&n.out[t]||void 0;if(r)return r.key}undirectedEdge(e,t){if(this.type===`directed`)return;if(e=``+e,t=``+t,this.multi)throw new b(`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 y(`Graph.undirectedEdge: could not find the "${e}" source node in the graph.`);if(!this._nodes.has(t))throw new y(`Graph.undirectedEdge: could not find the "${t}" target node in the graph.`);let r=n.undirected&&n.undirected[t]||void 0;if(r)return r.key}edge(e,t){if(this.multi)throw new b(`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 y(`Graph.edge: could not find the "${e}" source node in the graph.`);if(!this._nodes.has(t))throw new y(`Graph.edge: could not find the "${t}" target node in the graph.`);let r=n.out&&n.out[t]||n.undirected&&n.undirected[t]||void 0;if(r)return r.key}areDirectedNeighbors(e,t){e=``+e,t=``+t;let n=this._nodes.get(e);if(!n)throw new y(`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 y(`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 y(`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 y(`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 y(`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 y(`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 y(`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 y(`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 y(`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 y(`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 y(`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 y(`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 y(`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 y(`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 y(`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 y(`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 y(`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 y(`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 y(`Graph.inboundDegreeWithoutSelfLoops: could not find the "${e}" node in the graph.`);let n=0,r=0;return this.type!==`directed`&&(n+=t.undirectedDegree,r+=t.undirectedLoops*2),this.type!==`undirected`&&(n+=t.inDegree,r+=t.directedLoops),n-r}outboundDegreeWithoutSelfLoops(e){e=``+e;let t=this._nodes.get(e);if(!t)throw new y(`Graph.outboundDegreeWithoutSelfLoops: could not find the "${e}" node in the graph.`);let n=0,r=0;return this.type!==`directed`&&(n+=t.undirectedDegree,r+=t.undirectedLoops*2),this.type!==`undirected`&&(n+=t.outDegree,r+=t.directedLoops),n-r}degreeWithoutSelfLoops(e){e=``+e;let t=this._nodes.get(e);if(!t)throw new y(`Graph.degreeWithoutSelfLoops: could not find the "${e}" node in the graph.`);let n=0,r=0;return this.type!==`directed`&&(n+=t.undirectedDegree,r+=t.undirectedLoops*2),this.type!==`undirected`&&(n+=t.inDegree+t.outDegree,r+=t.directedLoops*2),n-r}source(e){e=``+e;let t=this._edges.get(e);if(!t)throw new y(`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 y(`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 y(`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 y(`Graph.opposite: could not find the "${t}" edge in the graph.`);let r=n.source.key,i=n.target.key;if(e===r)return i;if(e===i)return r;throw new y(`Graph.opposite: the "${e}" node is not attached to the "${t}" edge (${r}, ${i}).`)}hasExtremity(e,t){e=``+e,t=``+t;let n=this._edges.get(e);if(!n)throw new y(`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 y(`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 y(`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 y(`Graph.isSelfLoop: could not find the "${e}" edge in the graph.`);return t.source===t.target}addNode(e,t){return rt(this,e,t).key}mergeNode(e,t){if(t&&!l(t))throw new v(`Graph.mergeNode: invalid attributes. Expecting an object but got "${t}"`);e=``+e,t||={};let n=this._nodes.get(e);return n?(t&&(s(n.attributes,t),this.emit(`nodeAttributesUpdated`,{type:`merge`,key:e,attributes:n.attributes,data:t})),[e,!1]):(n=new this.NodeDataClass(e,t),this._nodes.set(e,n),this.emit(`nodeAdded`,{key:e,attributes:t}),[e,!0])}updateNode(e,t){if(t&&typeof t!=`function`)throw new v(`Graph.updateNode: invalid updater function. Expecting a function but got "${t}"`);e=``+e;let n=this._nodes.get(e);if(n){if(t){let r=n.attributes;n.attributes=t(r),this.emit(`nodeAttributesUpdated`,{type:`replace`,key:e,attributes:n.attributes})}return[e,!1]}let r=t?t({}):{};return n=new this.NodeDataClass(e,r),this._nodes.set(e,n),this.emit(`nodeAdded`,{key:e,attributes:r}),[e,!0]}dropNode(e){e=``+e;let t=this._nodes.get(e);if(!t)throw new y(`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 I(this,n),n=n.next;while(n)}for(let e in t.in){n=t.in[e];do I(this,n),n=n.next;while(n)}}if(this.type!==`directed`)for(let e in t.undirected){n=t.undirected[e];do I(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=c(this,e,n,this.type),!t)throw new y(`Graph.dropEdge: could not find the "${e}" -> "${n}" edge in the graph.`)}else if(e=``+e,t=this._edges.get(e),!t)throw new y(`Graph.dropEdge: could not find the "${e}" edge in the graph.`);return I(this,t),this}dropDirectedEdge(e,t){if(arguments.length<2)throw new b(`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 b(`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=c(this,e,t,`directed`);if(!n)throw new y(`Graph.dropDirectedEdge: could not find a "${e}" -> "${t}" edge in the graph.`);return I(this,n),this}dropUndirectedEdge(e,t){if(arguments.length<2)throw new b(`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 b(`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=c(this,e,t,`undirected`);if(!n)throw new y(`Graph.dropUndirectedEdge: could not find a "${e}" -> "${t}" edge in the graph.`);return I(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 v(`Graph.updateAttribute: updater should be a function.`);let n=this._attributes[e];return this._attributes[e]=t(n),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(!l(e))throw new v(`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(!l(e))throw new v(`Graph.mergeAttributes: provided attributes are not a plain object.`);return s(this._attributes,e),this.emit(`attributesUpdated`,{type:`merge`,attributes:this._attributes,data:e}),this}updateAttributes(e){if(typeof e!=`function`)throw new v(`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 v(`Graph.updateEachNodeAttributes: expecting an updater function.`);if(t&&!p(t))throw new v(`Graph.updateEachNodeAttributes: invalid hints. Expecting an object having the following shape: {attributes?: [string]}`);let n=this._nodes.values(),r,i;for(;r=n.next(),r.done!==!0;)i=r.value,i.attributes=e(i.key,i.attributes);this.emit(`eachNodeAttributesUpdated`,{hints:t||null})}updateEachEdgeAttributes(e,t){if(typeof e!=`function`)throw new v(`Graph.updateEachEdgeAttributes: expecting an updater function.`);if(t&&!p(t))throw new v(`Graph.updateEachEdgeAttributes: invalid hints. Expecting an object having the following shape: {attributes?: [string]}`);let n=this._edges.values(),r,i,a,o;for(;r=n.next(),r.done!==!0;)i=r.value,a=i.source,o=i.target,i.attributes=e(i.key,i.attributes,a.key,o.key,a.attributes,o.attributes,i.undirected);this.emit(`eachEdgeAttributesUpdated`,{hints:t||null})}forEachAdjacencyEntry(e){if(typeof e!=`function`)throw new v(`Graph.forEachAdjacencyEntry: expecting a callback.`);N(!1,!1,!1,this,e)}forEachAdjacencyEntryWithOrphans(e){if(typeof e!=`function`)throw new v(`Graph.forEachAdjacencyEntryWithOrphans: expecting a callback.`);N(!1,!1,!0,this,e)}forEachAssymetricAdjacencyEntry(e){if(typeof e!=`function`)throw new v(`Graph.forEachAssymetricAdjacencyEntry: expecting a callback.`);N(!1,!0,!1,this,e)}forEachAssymetricAdjacencyEntryWithOrphans(e){if(typeof e!=`function`)throw new v(`Graph.forEachAssymetricAdjacencyEntryWithOrphans: expecting a callback.`);N(!1,!0,!0,this,e)}nodes(){return Array.from(this._nodes.keys())}forEachNode(e){if(typeof e!=`function`)throw new v(`Graph.forEachNode: expecting a callback.`);let t=this._nodes.values(),n,r;for(;n=t.next(),n.done!==!0;)r=n.value,e(r.key,r.attributes)}findNode(e){if(typeof e!=`function`)throw new v(`Graph.findNode: expecting a callback.`);let t=this._nodes.values(),n,r;for(;n=t.next(),n.done!==!0;)if(r=n.value,e(r.key,r.attributes))return r.key}mapNodes(e){if(typeof e!=`function`)throw new v(`Graph.mapNode: expecting a callback.`);let t=this._nodes.values(),n,r,i=Array(this.order),a=0;for(;n=t.next(),n.done!==!0;)r=n.value,i[a++]=e(r.key,r.attributes);return i}someNode(e){if(typeof e!=`function`)throw new v(`Graph.someNode: expecting a callback.`);let t=this._nodes.values(),n,r;for(;n=t.next(),n.done!==!0;)if(r=n.value,e(r.key,r.attributes))return!0;return!1}everyNode(e){if(typeof e!=`function`)throw new v(`Graph.everyNode: expecting a callback.`);let t=this._nodes.values(),n,r;for(;n=t.next(),n.done!==!0;)if(r=n.value,!e(r.key,r.attributes))return!1;return!0}filterNodes(e){if(typeof e!=`function`)throw new v(`Graph.filterNodes: expecting a callback.`);let t=this._nodes.values(),n,r,i=[];for(;n=t.next(),n.done!==!0;)r=n.value,e(r.key,r.attributes)&&i.push(r.key);return i}reduceNodes(e,t){if(typeof e!=`function`)throw new v(`Graph.reduceNodes: expecting a callback.`);if(arguments.length<2)throw new v(`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 n=t,r=this._nodes.values(),i,a;for(;i=r.next(),i.done!==!0;)a=i.value,n=e(n,a.key,a.attributes);return n}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++]=Je(r,n)});let n=Array(this._edges.size);return t=0,this._edges.forEach((e,r)=>{n[t++]=Ye(this.type,r,e)}),{options:{type:this.type,multi:this.multi,allowSelfLoops:this.allowSelfLoops},attributes:this.getAttributes(),nodes:e,edges:n}}import(t,n=!1){if(t instanceof e)return t.forEachNode((e,t)=>{n?this.mergeNode(e,t):this.addNode(e,t)}),t.forEachEdge((e,t,r,i,a,o,s)=>{n?s?this.mergeUndirectedEdgeWithKey(e,r,i,t):this.mergeDirectedEdgeWithKey(e,r,i,t):s?this.addUndirectedEdgeWithKey(e,r,i,t):this.addDirectedEdgeWithKey(e,r,i,t)}),this;if(!l(t))throw new v(`Graph.import: invalid argument. Expecting a serialized graph or, alternatively, a Graph instance.`);if(t.attributes){if(!l(t.attributes))throw new v(`Graph.import: invalid attributes. Expecting a plain object.`);n?this.mergeAttributes(t.attributes):this.replaceAttributes(t.attributes)}let r,i,a,o,s;if(t.nodes){if(a=t.nodes,!Array.isArray(a))throw new v(`Graph.import: invalid nodes. Expecting an array.`);for(r=0,i=a.length;r<i;r++){o=a[r],Xe(o);let{key:e,attributes:t}=o;n?this.mergeNode(e,t):this.addNode(e,t)}}if(t.edges){let e=!1;if(this.type===`undirected`&&(e=!0),a=t.edges,!Array.isArray(a))throw new v(`Graph.import: invalid edges. Expecting an array.`);for(r=0,i=a.length;r<i;r++){s=a[r],Ze(s);let{source:t,target:i,attributes:o,undirected:c=e}=s,l;`key`in s?(l=n?c?this.mergeUndirectedEdgeWithKey:this.mergeDirectedEdgeWithKey:c?this.addUndirectedEdgeWithKey:this.addDirectedEdgeWithKey,l.call(this,s.key,t,i,o)):(l=n?c?this.mergeUndirectedEdge:this.mergeDirectedEdge:c?this.addUndirectedEdge:this.addDirectedEdge,l.call(this,t,i,o))}}return this}nullCopy(t){let n=new e(s({},this._options,t));return n.replaceAttributes(s({},this.getAttributes())),n}emptyCopy(e){let t=this.nullCopy(e);return this._nodes.forEach((e,n)=>{let r=s({},e.attributes);e=new t.NodeDataClass(n,r),t._nodes.set(n,e)}),t}copy(e){if(e||={},typeof e.type==`string`&&e.type!==this.type&&e.type!==`mixed`)throw new b(`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 b(`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 b(`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 t=this.emptyCopy(e),n=this._edges.values(),r,i;for(;r=n.next(),r.done!==!0;)i=r.value,F(t,`copy`,!1,i.undirected,i.key,i.source.key,i.target.key,s({},i.attributes));return t}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)&&!et.has(e)&&typeof this[e]!=`function`&&typeof e!=`symbol`&&(r[e]=this[e]);return r.attributes=this._attributes,r.nodes=e,r.edges=t,d(r,`constructor`,this.constructor),r}};typeof Symbol<`u`&&(L.prototype[Symbol.for(`nodejs.util.inspect.custom`)]=L.prototype.inspect),tt.forEach(e=>{[`add`,`merge`,`update`].forEach(t=>{let n=e.name(t),r=t===`add`?F:it;e.generateKey?L.prototype[n]=function(i,a,o){return r(this,n,!0,(e.type||this.type)===`undirected`,null,i,a,o,t===`update`)}:L.prototype[n]=function(i,a,o,s){return r(this,n,!1,(e.type||this.type)===`undirected`,i,a,o,s,t===`update`)}})}),fe(L),Ce(L),ze(L),qe(L);var R=class extends L{constructor(e){let t=s({type:`directed`},e);if(`multi`in t&&t.multi!==!1)throw new v(`DirectedGraph.from: inconsistent indication that the graph should be multi in given options!`);if(t.type!==`directed`)throw new v(`DirectedGraph.from: inconsistent "`+t.type+`" type in given options!`);super(t)}},z=class extends L{constructor(e){let t=s({type:`undirected`},e);if(`multi`in t&&t.multi!==!1)throw new v(`UndirectedGraph.from: inconsistent indication that the graph should be multi in given options!`);if(t.type!==`undirected`)throw new v(`UndirectedGraph.from: inconsistent "`+t.type+`" type in given options!`);super(t)}},B=class extends L{constructor(e){let t=s({multi:!0},e);if(`multi`in t&&t.multi!==!0)throw new v(`MultiGraph.from: inconsistent indication that the graph should be simple in given options!`);super(t)}},V=class extends L{constructor(e){let t=s({type:`directed`,multi:!0},e);if(`multi`in t&&t.multi!==!0)throw new v(`MultiDirectedGraph.from: inconsistent indication that the graph should be simple in given options!`);if(t.type!==`directed`)throw new v(`MultiDirectedGraph.from: inconsistent "`+t.type+`" type in given options!`);super(t)}},H=class extends L{constructor(e){let t=s({type:`undirected`,multi:!0},e);if(`multi`in t&&t.multi!==!0)throw new v(`MultiUndirectedGraph.from: inconsistent indication that the graph should be simple in given options!`);if(t.type!==`undirected`)throw new v(`MultiUndirectedGraph.from: inconsistent "`+t.type+`" type in given options!`);super(t)}};function U(e){e.from=function(t,n){let r=new e(s({},t.options,n));return r.import(t),r}}U(L),U(R),U(z),U(B),U(V),U(H),L.Graph=L,L.DirectedGraph=R,L.UndirectedGraph=z,L.MultiGraph=B,L.MultiDirectedGraph=V,L.MultiUndirectedGraph=H,L.InvalidArgumentsGraphError=v,L.NotFoundGraphError=y,L.UsageGraphError=b;var W=e(((e,t)=>{t.exports=function(e){return typeof e==`object`&&!!e&&typeof e.addUndirectedEdgeWithKey==`function`&&typeof e.dropNode==`function`&&typeof e.multi==`boolean`}})),at=e(((e,t)=>{let n=W();t.exports=function(e){if(!n(e))throw Error(`graphology-dag/has-cycle: the given graph is not a valid graphology instance.`);if(e.size===0)return!1;if(e.selfLoopCount!==0)return!0;let t={},r=[];function i(e){let n=t[e];if(n===void 0)r.push(e);else if(n===0)return!0;return!1}return e.someNode(n=>{if(t[n]===1)return!1;for(r.push(n);r.length!==0;){let n=r[r.length-1],a=t[n];if(a!==0){if(t[n]=0,e.someOutboundNeighbor(n,i))return!0}else a===0&&(r.pop(),t[n]=1)}return!1})}})),ot=e(((e,t)=>{let n=W();t.exports=function(e,t,r){if(!n(e))throw Error(`graphology-dag/will-create-cycle: the given graph is not a valid graphology instance.`);if(t=``+t,r=``+r,t===r)return!0;if(!e.hasNode(t)||!e.hasNode(r)||e.hasDirectedEdge(t,r))return!1;if(e.hasDirectedEdge(r,t))return!0;let i=e.outNeighbors(r);function a(e){i.push(e)}for(;i.length!==0;){let n=i.pop();if(n===t)return!0;e.forEachOutNeighbor(n,a)}return!1}})),st=e((e=>{e.ARRAY_BUFFER_SUPPORT=typeof ArrayBuffer<`u`,e.SYMBOL_SUPPORT=typeof Symbol<`u`})),ct=e(((e,t)=>{var n=st(),r=n.ARRAY_BUFFER_SUPPORT,i=n.SYMBOL_SUPPORT;t.exports=function(e,t){var n,a,o,s,c;if(!e)throw Error(`obliterator/forEach: invalid iterable.`);if(typeof t!=`function`)throw Error(`obliterator/forEach: expecting a callback.`);if(Array.isArray(e)||r&&ArrayBuffer.isView(e)||typeof e==`string`||e.toString()===`[object Arguments]`){for(o=0,s=e.length;o<s;o++)t(e[o],o);return}if(typeof e.forEach==`function`){e.forEach(t);return}if(i&&Symbol.iterator in e&&typeof e.next!=`function`&&(e=e[Symbol.iterator]()),typeof e.next==`function`){for(n=e,o=0;c=n.next(),c.done!==!0;)t(c.value,o),o++;return}for(a in e)e.hasOwnProperty(a)&&t(e[a],a)}})),lt=e((e=>{var t=2**8-1,n=2**16-1,r=2**32-1,i=2**7-1,a=2**15-1,o=2**31-1;e.getPointerArray=function(e){var i=e-1;if(i<=t)return Uint8Array;if(i<=n)return Uint16Array;if(i<=r)return Uint32Array;throw Error(`mnemonist: Pointer Array of size > 4294967295 is not supported.`)},e.getSignedPointerArray=function(e){var t=e-1;return t<=i?Int8Array:t<=a?Int16Array:t<=o?Int32Array:Float64Array},e.getNumberType=function(e){return e===(e|0)?Math.sign(e)===-1?e<=127&&e>=-128?Int8Array:e<=32767&&e>=-32768?Int16Array:Int32Array:e<=255?Uint8Array:e<=65535?Uint16Array:Uint32Array:Float64Array};var s={Uint8Array:1,Int8Array:2,Uint16Array:3,Int16Array:4,Uint32Array:5,Int32Array:6,Float32Array:7,Float64Array:8};e.getMinimalRepresentation=function(t,n){var r=null,i=0,a,o,c,l,u;for(l=0,u=t.length;l<u;l++)c=n?n(t[l]):t[l],o=e.getNumberType(c),a=s[o.name],a>i&&(i=a,r=o);return r},e.isTypedArray=function(e){return typeof ArrayBuffer<`u`&&ArrayBuffer.isView(e)},e.concat=function(){var e=0,t,n,r;for(t=0,r=arguments.length;t<r;t++)e+=arguments[t].length;var i=new arguments[0].constructor(e);for(t=0,n=0;t<r;t++)i.set(arguments[t],n),n+=arguments[t].length;return i},e.indices=function(t){for(var n=new(e.getPointerArray(t))(t),r=0;r<t;r++)n[r]=r;return n}})),ut=e((e=>{var t=ct(),n=lt();function r(e){return Array.isArray(e)||n.isTypedArray(e)}function i(e){if(typeof e.length==`number`)return e.length;if(typeof e.size==`number`)return e.size}function a(e){var n=i(e),r=typeof n==`number`?Array(n):[],a=0;return t(e,function(e){r[a++]=e}),r}function o(e){var r=i(e),a=typeof r==`number`?n.getPointerArray(r):Array,o=typeof r==`number`?Array(r):[],s=typeof r==`number`?new a(r):[],c=0;return t(e,function(e){o[c]=e,s[c]=c++}),[o,s]}e.isArrayLike=r,e.guessLength=i,e.toArray=a,e.toArrayWithIndices=o})),dt=e(((e,t)=>{function n(e){if(typeof e!=`function`)throw Error(`obliterator/iterator: expecting a function!`);this.next=e}typeof Symbol<`u`&&(n.prototype[Symbol.iterator]=function(){return this}),n.of=function(){var e=arguments,t=e.length,r=0;return new n(function(){return r>=t?{done:!0}:{done:!1,value:e[r++]}})},n.empty=function(){return new n(function(){return{done:!0}})},n.fromSequence=function(e){var t=0,r=e.length;return new n(function(){return t>=r?{done:!0}:{done:!1,value:e[t++]}})},n.is=function(e){return e instanceof n?!0:typeof e==`object`&&!!e&&typeof e.next==`function`},t.exports=n})),ft=e(((e,t)=>{var n=ut(),r=dt();function i(e,t){if(arguments.length<2)throw Error(`mnemonist/fixed-deque: expecting an Array class and a capacity.`);if(typeof t!=`number`||t<=0)throw Error("mnemonist/fixed-deque: `capacity` should be a positive number.");this.ArrayClass=e,this.capacity=t,this.items=new e(this.capacity),this.clear()}i.prototype.clear=function(){this.start=0,this.size=0},i.prototype.push=function(e){if(this.size===this.capacity)throw Error(`mnemonist/fixed-deque.push: deque capacity (`+this.capacity+`) exceeded!`);var t=this.start+this.size;return t>=this.capacity&&(t-=this.capacity),this.items[t]=e,++this.size},i.prototype.unshift=function(e){if(this.size===this.capacity)throw Error(`mnemonist/fixed-deque.unshift: deque capacity (`+this.capacity+`) exceeded!`);var t=this.start-1;return this.start===0&&(t=this.capacity-1),this.items[t]=e,this.start=t,++this.size},i.prototype.pop=function(){if(this.size!==0){this.size--;var e=this.start+this.size;return e>=this.capacity&&(e-=this.capacity),this.items[e]}},i.prototype.shift=function(){if(this.size!==0){var e=this.start;return this.size--,this.start++,this.start===this.capacity&&(this.start=0),this.items[e]}},i.prototype.peekFirst=function(){if(this.size!==0)return this.items[this.start]},i.prototype.peekLast=function(){if(this.size!==0){var e=this.start+this.size-1;return e>=this.capacity&&(e-=this.capacity),this.items[e]}},i.prototype.get=function(e){if(!(this.size===0||e>=this.capacity))return e=this.start+e,e>=this.capacity&&(e-=this.capacity),this.items[e]},i.prototype.forEach=function(e,t){t=arguments.length>1?t:this;for(var n=this.capacity,r=this.size,i=this.start,a=0;a<r;)e.call(t,this.items[i],a,this),i++,a++,i===n&&(i=0)},i.prototype.toArray=function(){var e=this.start+this.size;if(e<this.capacity)return this.items.slice(this.start,e);for(var t=new this.ArrayClass(this.size),n=this.capacity,r=this.size,i=this.start,a=0;a<r;)t[a]=this.items[i],i++,a++,i===n&&(i=0);return t},i.prototype.values=function(){var e=this.items,t=this.capacity,n=this.size,i=this.start,a=0;return new r(function(){if(a>=n)return{done:!0};var r=e[i];return i++,a++,i===t&&(i=0),{value:r,done:!1}})},i.prototype.entries=function(){var e=this.items,t=this.capacity,n=this.size,i=this.start,a=0;return new r(function(){if(a>=n)return{done:!0};var r=e[i];return i++,i===t&&(i=0),{value:[a++,r],done:!1}})},typeof Symbol<`u`&&(i.prototype[Symbol.iterator]=i.prototype.values),i.prototype.inspect=function(){var e=this.toArray();return e.type=this.ArrayClass.name,e.capacity=this.capacity,Object.defineProperty(e,`constructor`,{value:i,enumerable:!1}),e},typeof Symbol<`u`&&(i.prototype[Symbol.for(`nodejs.util.inspect.custom`)]=i.prototype.inspect),i.from=function(e,t,r){if(arguments.length<3&&(r=n.guessLength(e),typeof r!=`number`))throw Error(`mnemonist/fixed-deque.from: could not guess iterable length. Please provide desired capacity as last argument.`);var a=new i(t,r);if(n.isArrayLike(e)){var o,s;for(o=0,s=e.length;o<s;o++)a.items[o]=e[o];return a.size=s,a}return n.forEach(e,function(e){a.push(e)}),a},t.exports=i})),pt=e((e=>{let t=W(),n=ft();function r(e,t){let n=0;return e.forEachInNeighbor(t,()=>{n++}),n}function i(e,i){if(!t(e))throw Error(`graphology-dag/topological-sort: the given graph is not a valid graphology instance.`);if(e.type===`undirected`||e.undirectedSize!==0)throw Error(`graphology-dag/topological-sort: cannot work if graph is not directed.`);if(e.order===0)return;let a=new n(Array,e.order),o={},s=0;e.forEachNode((t,n)=>{let i=e.multi?r(e,t):e.inDegree(t);i===0?a.push([t,n,0]):(o[t]=i,s+=i)});let c=0;function l(e,t){let n=--o[e];s--,n===0&&a.push([e,t,c+1]),o[e]=n}for(;a.size!==0;){let[t,n,r]=a.shift();c=r,i(t,n,r),e.forEachOutNeighbor(t,l)}if(s!==0)throw Error(`graphology-dag/topological-sort: given graph is not acyclic.`)}function a(e){if(!t(e))throw Error(`graphology-dag/topological-sort: the given graph is not a valid graphology instance.`);let n=Array(e.order),r=0;return i(e,e=>{n[r++]=e}),n}function o(e,n){if(!t(e))throw Error(`graphology-dag/topological-generations: the given graph is not a valid graphology instance.`);if(e.order===0)return;let r=0,a=[];i(e,(e,t,i)=>{i>r&&(n(a),r=i,a=[]),a.push(e)}),n(a)}function s(e){if(!t(e))throw Error(`graphology-dag/topological-generations: the given graph is not a valid graphology instance.`);let n=[];return o(e,e=>{n.push(e)}),n}e.topologicalSort=a,e.forEachNodeInTopologicalOrder=i,e.topologicalGenerations=s,e.forEachTopologicalGeneration=o}));e((e=>{e.hasCycle=at(),e.willCreateCycle=ot();let t=pt();e.forEachNodeInTopologicalOrder=t.forEachNodeInTopologicalOrder,e.topologicalSort=t.topologicalSort,e.topologicalGenerations=t.topologicalGenerations,e.forEachTopologicalGeneration=t.forEachTopologicalGeneration}))();function G(e,t){let n=e[t];if(typeof n==`number`&&Number.isFinite(n))return n;if(typeof n==`string`&&n.trim()!==``){let e=Number(n);if(Number.isFinite(e))return e}}function K(e,t){let n=e[t];if(typeof n==`string`&&n.trim()!==``)return n}function q(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function mt(e){if(!q(e))return{};let t=G(e,`bytes_processed`),n=G(e,`bytes_billed`),r=G(e,`slot_ms`),i=G(e,`rows_affected`),a=K(e,`code`),o=K(e,`_message`),s=K(e,`query_id`)??K(e,`job_id`),c=K(e,`project_id`),l=K(e,`location`);return{...t===void 0?{}:{bytesProcessed:t},...n===void 0?{}:{bytesBilled:n},...r===void 0?{}:{slotMs:r},...i===void 0?{}:{rowsAffected:i},...a===void 0?{}:{adapterCode:a},...o===void 0?{}:{adapterMessage:o},...s===void 0?{}:{queryId:s},...c===void 0?{}:{projectId:c},...l===void 0?{}:{location:l}}}function J(e,t){if(!q(e))return{rawKeys:[]};let n=Object.keys(e).filter(e=>typeof e==`string`);return{...mt(e),...t,rawKeys:n}}let ht={name:`generic`,parse(e){return J(e,{})}},gt={name:`athena`,parse(e){if(!q(e))return{rawKeys:[]};let t=G(e,`data_scanned_in_bytes`);return J(e,{...t===void 0?{}:{bytesProcessed:t}})},canParse(e){return q(e)?`data_scanned_in_bytes`in e:!1}},_t={name:`bigquery`,parse(e){if(!q(e))return{rawKeys:[]};let t=G(e,`bytes_processed`),n=G(e,`bytes_billed`),r=G(e,`slot_ms`),i=K(e,`project_id`),a=K(e,`location`),o=K(e,`query_id`)??K(e,`job_id`);return J(e,{...t===void 0?{}:{bytesProcessed:t},...n===void 0?{}:{bytesBilled:n},...r===void 0?{}:{slotMs:r},...o===void 0?{}:{queryId:o},...i===void 0?{}:{projectId:i},...a===void 0?{}:{location:a}})},canParse(e){return q(e)?`bytes_processed`in e||`bytes_billed`in e||`slot_ms`in e||`job_id`in e||`location`in e:!1}},vt={name:`postgres`,parse(e){return J(e,{})}},yt={name:`redshift`,parse(e){return J(e,{})}},bt={name:`snowflake`,parse(e){if(!q(e))return{rawKeys:[]};let t=G(e,`rows_inserted`),n=G(e,`rows_deleted`),r=G(e,`rows_updated`),i=G(e,`rows_duplicates`);return J(e,{...t===void 0?{}:{rowsInserted:t},...n===void 0?{}:{rowsDeleted:n},...r===void 0?{}:{rowsUpdated:r},...i===void 0?{}:{rowsDuplicated:i}})},canParse(e){return q(e)?`rows_inserted`in e||`rows_deleted`in e||`rows_updated`in e||`rows_duplicates`in e:!1}},xt=new Map([[`athena`,gt],[`bigquery`,_t],[`postgres`,vt],[`redshift`,yt],[`snowflake`,bt],[`spark`,{name:`spark`,parse(e){return J(e,{})}}]]),St=[_t,bt,gt];new class{selectParser(e,t){if(e&&typeof e==`string`){let n=e.toLowerCase().trim(),r=xt.get(n);if(r&&(!r.canParse||r.canParse(t)))return r}for(let e of St)if(e.canParse&&e.canParse(t))return e;return ht}};let Ct={query_id:e=>e.adapterMetrics?.queryId??``,adapter_code:e=>e.adapterMetrics?.adapterCode??``,adapter_message:e=>e.adapterMetrics?.adapterMessage??``,bytes_processed:e=>e.adapterMetrics?.bytesProcessed,bytes_billed:e=>e.adapterMetrics?.bytesBilled,slot_ms:e=>e.adapterMetrics?.slotMs,rows_affected:e=>e.adapterMetrics?.rowsAffected,project_id:e=>e.adapterMetrics?.projectId,location:e=>e.adapterMetrics?.location,rows_inserted:e=>e.adapterMetrics?.rowsInserted,rows_updated:e=>e.adapterMetrics?.rowsUpdated,rows_deleted:e=>e.adapterMetrics?.rowsDeleted,rows_duplicated:e=>e.adapterMetrics?.rowsDuplicated};function wt(e,t){return Ct[t](e)}function Tt(e,t){let n=wt(e,t);return typeof n==`number`&&Number.isFinite(n)?n:0}Object.fromEntries([`bytes_processed`,`bytes_billed`,`slot_ms`,`rows_affected`,`rows_inserted`,`rows_updated`,`rows_deleted`,`rows_duplicated`].map(e=>[`${e}_desc`,t=>Tt(t,e)]));let Et=[{key:`queryId`,label:`Query ID`,shortLabel:`Query ID`,kind:`string`,humanSortKey:`query_id`},{key:`adapterCode`,label:`Adapter code`,shortLabel:`Code`,kind:`string`,humanSortKey:`adapter_code`},{key:`adapterMessage`,label:`Adapter message`,shortLabel:`Message`,kind:`string`,humanSortKey:`adapter_message`},{key:`bytesProcessed`,label:`Bytes processed`,shortLabel:`Bytes processed`,kind:`number`,humanSortKey:`bytes_processed`,summaryTotalKey:`totalBytesProcessed`},{key:`bytesBilled`,label:`Bytes billed`,shortLabel:`Bytes billed`,kind:`number`,humanSortKey:`bytes_billed`,summaryTotalKey:`totalBytesBilled`},{key:`slotMs`,label:`Slot ms`,shortLabel:`Slot ms`,kind:`number`,humanSortKey:`slot_ms`,summaryTotalKey:`totalSlotMs`},{key:`rowsAffected`,label:`Rows affected`,shortLabel:`Rows`,kind:`number`,humanSortKey:`rows_affected`,summaryTotalKey:`totalRowsAffected`},{key:`projectId`,label:`Project ID`,shortLabel:`Project`,kind:`string`,humanSortKey:`project_id`},{key:`location`,label:`Location`,shortLabel:`Location`,kind:`string`,humanSortKey:`location`},{key:`rowsInserted`,label:`Rows inserted`,shortLabel:`Inserted`,kind:`number`,humanSortKey:`rows_inserted`,summaryTotalKey:`totalRowsInserted`},{key:`rowsUpdated`,label:`Rows updated`,shortLabel:`Updated`,kind:`number`,humanSortKey:`rows_updated`,summaryTotalKey:`totalRowsUpdated`},{key:`rowsDeleted`,label:`Rows deleted`,shortLabel:`Deleted`,kind:`number`,humanSortKey:`rows_deleted`,summaryTotalKey:`totalRowsDeleted`},{key:`rowsDuplicated`,label:`Rows duplicated`,shortLabel:`Duplicated`,kind:`number`,humanSortKey:`rows_duplicated`,summaryTotalKey:`totalRowsDuplicated`}];function Dt(e,t){if(e!=null)return e[t]}function Ot(e,t){return t===void 0?`—`:e.kind===`number`&&typeof t==`number`?t.toLocaleString(`en-US`):String(t)}function kt(e){return Et.filter(t=>e.some(e=>Dt(e,t.key)!==void 0))}function At(e){return e.slice(8)}function jt(e){return e.startsWith(`adapter:`)}function Mt(e,t){let n=kt([e.adapterMetrics]).find(e=>e.key===t),r=n?Dt(e.adapterMetrics,n.key):void 0;if(!(n==null||r===void 0))return{displayValue:Ot(n,r),sortValue:typeof r==`number`||typeof r==`string`?r:void 0,isScalar:!0}}function Nt(e){if(jt(e))return`desc`;switch(e){case`attention`:case`duration`:case`start`:return`desc`;default:return`asc`}}function Pt(e,t){return t===`all`?!0:t===`issues`?e.statusTone===`danger`||e.statusTone===`warning`:e.statusTone===t}function Ft(){return{all:0,positive:0,warning:0,danger:0}}function It(){return{all:0,models:0,tests:0,seeds:0,snapshots:0,operations:0,healthy:0,warnings:0,errors:0,issues:0}}function Lt(e){let t=[...(e.adapterResponseFields??[]).flatMap(e=>[e.key,e.displayValue]),...e.adapterMetrics?[e.adapterMetrics.queryId??``,e.adapterMetrics.adapterCode??``,e.adapterMetrics.adapterMessage??``,e.adapterMetrics.projectId??``,e.adapterMetrics.location??``,e.adapterMetrics.rawKeys.join(` `)]:[]],n=e.semantics,r=n?[n.materialization,n.rawMaterialization??``,n.incrementalStrategy??``,n.relationName??``]:[];return[e.name,e.resourceType,e.packageName,e.path??``,e.uniqueId,e.status,e.threadId??``,...r,...t].join(` `).toLowerCase()}function Rt(e){return e.trim().toLowerCase()}function zt(e,t){return Pt(e,t)}function Bt(e){return i.has(e.resourceType)?`tests`:e.resourceType===`seed`?`seeds`:e.resourceType===`snapshot`?`snapshots`:e.resourceType===`operation`||e.resourceType===`sql_operation`||e.resourceType===`macro`?`operations`:`models`}function Vt(e,t){return t===`all`||Bt(e)===t}function Ht(e,t){return t===`all`?!0:t===`fast`?e.executionTime<1:t===`medium`?e.executionTime>=1&&e.executionTime<5:e.executionTime>=5}let Ut={danger:0,warning:1,positive:2,skipped:3,neutral:4};function Wt(e,t){let n=Ut[e.statusTone]-Ut[t.statusTone];return n===0?t.executionTime-e.executionTime:n}function Gt(e,t){let n=e===void 0,r=t===void 0;return n&&r?0:n?1:r?-1:typeof e==`number`&&typeof t==`number`?e-t:String(e).localeCompare(String(t),void 0,{numeric:!0,sensitivity:`base`})}function Y(e,t){return t===`asc`?e:-e}function X(e,t,n,r,i){let a=e.localeCompare(t);return a===0?n.name.localeCompare(r.name):Y(a,i)}function Kt(e,t,n,r){if(!jt(n))return Y(Wt(e,t),r);let i=At(n),a=Mt(e,i),o=Mt(t,i);return!a?.isScalar&&!o?.isScalar?0:a?.isScalar?o?.isScalar?Y(Gt(a.sortValue,o.sortValue),r):-1:1}function qt(e,t,n,r){switch(n){case`duration`:return Y(e.executionTime-t.executionTime,r);case`name`:return Y(e.name.localeCompare(t.name),r);case`status`:return Y(e.status.localeCompare(t.status),r);case`start`:return Y((e.start??0)-(t.start??0),r);case`materialization`:return X(e.semantics?.materialization??`unknown`,t.semantics?.materialization??`unknown`,e,t,r);case`resourceType`:return X(e.resourceType,t.resourceType,e,t,r);case`thread`:return X(e.threadId??``,t.threadId??``,e,t,r);case`attention`:return Y(Wt(e,t),r);default:return Kt(e,t,n,r)}}function Jt(e){let t=Ft(),n=It(),r={},i={};t.all=e.length,n.all=e.length;for(let a of e){let{row:e}=a;e.statusTone===`positive`?(t.positive+=1,n.healthy+=1):e.statusTone===`warning`?(t.warning+=1,n.warnings+=1,n.issues+=1):e.statusTone===`danger`&&(t.danger+=1,n.errors+=1,n.issues+=1),n[Bt(e)]+=1,r[e.resourceType]=(r[e.resourceType]??0)+1,e.threadId&&(i[e.threadId]=(i[e.threadId]??0)+1)}return{status:t,facets:n,resourceTypes:r,threadIds:i}}function Yt(e){let t=e.map(e=>({row:e,searchText:Lt(e)}));return{entries:t,summary:Jt(t)}}function Xt(e,t){let n=Rt(t.query),r=new Set(t.resourceTypes),i=new Set(t.materializationKinds),a=new Set(t.threadIds),o=e.entries.filter(e=>{let{row:o}=e;if(!Vt(o,t.kind)||!zt(o,t.status)||n!==``&&!e.searchText.includes(n)||r.size>0&&!r.has(o.resourceType))return!1;if(i.size>0){let e=o.semantics?.materialization??`unknown`;if(!i.has(e))return!1}return!(a.size>0&&!a.has(o.threadId??``)||!Ht(o,t.durationBand))}),s=t.sortBy??`attention`,c=t.sortDirection??Nt(s);return[...o].sort((e,t)=>qt(e.row,t.row,s,c))}let Z=null,Q=null,$=[];function Zt(e){self.postMessage({type:`error`,message:e})}self.onmessage=e=>{let t=e.data;if(t.type===`init`){Z=Yt(t.rows),Q=null,$=[],self.postMessage({type:`ready`,summary:Z.summary});return}if(Z==null){Zt(`Results worker queried before initialization.`);return}let n=[t.kind,t.status,t.query.trim().toLowerCase(),t.resourceTypes.sort().join(`,`),t.materializationKinds.sort().join(`,`),t.threadIds.sort().join(`,`),t.durationBand,t.sortBy,t.sortDirection].join(`::`);n!==Q&&($=Xt(Z,{kind:t.kind,status:t.status,query:t.query,resourceTypes:t.resourceTypes,materializationKinds:t.materializationKinds,threadIds:t.threadIds,durationBand:t.durationBand,sortBy:t.sortBy,sortDirection:t.sortDirection}),Q=n);let r=$.slice(0,t.limit);self.postMessage({type:`query-result`,requestId:t.requestId,rows:r.map(e=>e.row),totalMatches:$.length,summary:{status:{all:$.length,positive:$.filter(e=>e.row.statusTone===`positive`).length,warning:$.filter(e=>e.row.statusTone===`warning`).length,danger:$.filter(e=>e.row.statusTone===`danger`).length},facets:{all:$.length,models:$.filter(e=>{let t=e.row.resourceType;return t!==`test`&&t!==`unit_test`&&t!==`seed`&&t!==`snapshot`&&t!==`operation`&&t!==`sql_operation`&&t!==`macro`}).length,tests:$.filter(e=>e.row.resourceType===`test`||e.row.resourceType===`unit_test`).length,seeds:$.filter(e=>e.row.resourceType===`seed`).length,snapshots:$.filter(e=>e.row.resourceType===`snapshot`).length,operations:$.filter(e=>[`operation`,`sql_operation`,`macro`].includes(e.row.resourceType)).length,healthy:$.filter(e=>e.row.statusTone===`positive`).length,warnings:$.filter(e=>e.row.statusTone===`warning`).length,errors:$.filter(e=>e.row.statusTone===`danger`).length,issues:$.filter(e=>e.row.statusTone===`danger`||e.row.statusTone===`warning`).length},resourceTypes:Object.fromEntries(Object.entries(r.reduce((e,t)=>(e[t.row.resourceType]=(e[t.row.resourceType]??0)+1,e),{}))),threadIds:Object.fromEntries(Object.entries(r.reduce((e,t)=>(t.row.threadId&&(e[t.row.threadId]=(e[t.row.threadId]??0)+1),e),{})))}})}})();