@phren/cli 0.1.23 → 0.1.26
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/cli/session-tool-hook.d.ts +1 -1
- package/dist/cli/session-tool-hook.js +53 -18
- package/dist/cli-hooks-prompt.d.ts +1 -1
- package/dist/cli-hooks-prompt.js +54 -18
- package/dist/content/citation.d.ts +2 -0
- package/dist/content/citation.js +6 -0
- package/dist/content/learning.d.ts +3 -1
- package/dist/content/learning.js +8 -5
- package/dist/core/finding.d.ts +7 -0
- package/dist/core/finding.js +15 -1
- package/dist/data/access.d.ts +4 -0
- package/dist/data/access.js +6 -1
- package/dist/data/tasks.js +14 -5
- package/dist/finding/journal.d.ts +2 -2
- package/dist/finding/journal.js +9 -4
- package/dist/generated/memory-ui-graph.browser.js +1 -1
- package/dist/link/doctor.js +99 -0
- package/dist/machine-identity.d.ts +1 -0
- package/dist/machine-identity.js +9 -2
- package/dist/memory-ui-graph.runtime.js +1 -1
- package/dist/shared/index.js +5 -1
- package/dist/task/lifecycle.d.ts +1 -0
- package/dist/task/lifecycle.js +38 -0
- package/dist/tools/finding.js +13 -4
- package/dist/tools/search.js +3 -2
- package/package.json +4 -4
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use strict";(()=>{var Br=Object.create;var vt=Object.defineProperty;var Cr=Object.getOwnPropertyDescriptor;var wr=Object.getOwnPropertyNames;var cr=Object.getPrototypeOf,fr=Object.prototype.hasOwnProperty;var KA=(i,e)=>()=>(e||i((e={exports:{}}).exports,e),e.exports);var hr=(i,e,A,t)=>{if(e&&typeof e=="object"||typeof e=="function")for(let r of wr(e))!fr.call(i,r)&&r!==A&&vt(i,r,{get:()=>e[r],enumerable:!(t=Cr(e,r))||t.enumerable});return i};var jA=(i,e,A)=>(A=i!=null?Br(cr(i)):{},hr(e||!i||!i.__esModule?vt(A,"default",{value:i,enumerable:!0}):A,i));var Ee=KA((Yg,Te)=>{"use strict";var TA=typeof Reflect=="object"?Reflect:null,It=TA&&typeof TA.apply=="function"?TA.apply:function(e,A,t){return Function.prototype.apply.call(e,A,t)},ue;TA&&typeof TA.ownKeys=="function"?ue=TA.ownKeys:Object.getOwnPropertySymbols?ue=function(e){return Object.getOwnPropertyNames(e).concat(Object.getOwnPropertySymbols(e))}:ue=function(e){return Object.getOwnPropertyNames(e)};function Qr(i){console&&console.warn&&console.warn(i)}var Ft=Number.isNaN||function(e){return e!==e};function K(){K.init.call(this)}Te.exports=K;Te.exports.once=Er;K.EventEmitter=K;K.prototype._events=void 0;K.prototype._eventsCount=0;K.prototype._maxListeners=void 0;var Mt=10;function de(i){if(typeof i!="function")throw new TypeError('The "listener" argument must be of type Function. Received type '+typeof i)}Object.defineProperty(K,"defaultMaxListeners",{enumerable:!0,get:function(){return Mt},set:function(i){if(typeof i!="number"||i<0||Ft(i))throw new RangeError('The value of "defaultMaxListeners" is out of range. It must be a non-negative number. Received '+i+".");Mt=i}});K.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};K.prototype.setMaxListeners=function(e){if(typeof e!="number"||e<0||Ft(e))throw new RangeError('The value of "n" is out of range. It must be a non-negative number. Received '+e+".");return this._maxListeners=e,this};function Gt(i){return i._maxListeners===void 0?K.defaultMaxListeners:i._maxListeners}K.prototype.getMaxListeners=function(){return Gt(this)};K.prototype.emit=function(e){for(var A=[],t=1;t<arguments.length;t++)A.push(arguments[t]);var r=e==="error",n=this._events;if(n!==void 0)r=r&&n.error===void 0;else if(!r)return!1;if(r){var o;if(A.length>0&&(o=A[0]),o instanceof Error)throw o;var g=new Error("Unhandled error."+(o?" ("+o.message+")":""));throw g.context=o,g}var s=n[e];if(s===void 0)return!1;if(typeof s=="function")It(s,this,A);else for(var B=s.length,C=pt(s,B),t=0;t<B;++t)It(C[t],this,A);return!0};function Pt(i,e,A,t){var r,n,o;if(de(A),n=i._events,n===void 0?(n=i._events=Object.create(null),i._eventsCount=0):(n.newListener!==void 0&&(i.emit("newListener",e,A.listener?A.listener:A),n=i._events),o=n[e]),o===void 0)o=n[e]=A,++i._eventsCount;else if(typeof o=="function"?o=n[e]=t?[A,o]:[o,A]:t?o.unshift(A):o.push(A),r=Gt(i),r>0&&o.length>r&&!o.warned){o.warned=!0;var g=new Error("Possible EventEmitter memory leak detected. "+o.length+" "+String(e)+" listeners added. Use emitter.setMaxListeners() to increase limit");g.name="MaxListenersExceededWarning",g.emitter=i,g.type=e,g.count=o.length,Qr(g)}return i}K.prototype.addListener=function(e,A){return Pt(this,e,A,!1)};K.prototype.on=K.prototype.addListener;K.prototype.prependListener=function(e,A){return Pt(this,e,A,!0)};function Dr(){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 mt(i,e,A){var t={fired:!1,wrapFn:void 0,target:i,type:e,listener:A},r=Dr.bind(t);return r.listener=A,t.wrapFn=r,r}K.prototype.once=function(e,A){return de(A),this.on(e,mt(this,e,A)),this};K.prototype.prependOnceListener=function(e,A){return de(A),this.prependListener(e,mt(this,e,A)),this};K.prototype.removeListener=function(e,A){var t,r,n,o,g;if(de(A),r=this._events,r===void 0)return this;if(t=r[e],t===void 0)return this;if(t===A||t.listener===A)--this._eventsCount===0?this._events=Object.create(null):(delete r[e],r.removeListener&&this.emit("removeListener",e,t.listener||A));else if(typeof t!="function"){for(n=-1,o=t.length-1;o>=0;o--)if(t[o]===A||t[o].listener===A){g=t[o].listener,n=o;break}if(n<0)return this;n===0?t.shift():ur(t,n),t.length===1&&(r[e]=t[0]),r.removeListener!==void 0&&this.emit("removeListener",e,g||A)}return this};K.prototype.off=K.prototype.removeListener;K.prototype.removeAllListeners=function(e){var A,t,r;if(t=this._events,t===void 0)return this;if(t.removeListener===void 0)return arguments.length===0?(this._events=Object.create(null),this._eventsCount=0):t[e]!==void 0&&(--this._eventsCount===0?this._events=Object.create(null):delete t[e]),this;if(arguments.length===0){var n=Object.keys(t),o;for(r=0;r<n.length;++r)o=n[r],o!=="removeListener"&&this.removeAllListeners(o);return this.removeAllListeners("removeListener"),this._events=Object.create(null),this._eventsCount=0,this}if(A=t[e],typeof A=="function")this.removeListener(e,A);else if(A!==void 0)for(r=A.length-1;r>=0;r--)this.removeListener(e,A[r]);return this};function Yt(i,e,A){var t=i._events;if(t===void 0)return[];var r=t[e];return r===void 0?[]:typeof r=="function"?A?[r.listener||r]:[r]:A?dr(r):pt(r,r.length)}K.prototype.listeners=function(e){return Yt(this,e,!0)};K.prototype.rawListeners=function(e){return Yt(this,e,!1)};K.listenerCount=function(i,e){return typeof i.listenerCount=="function"?i.listenerCount(e):yt.call(i,e)};K.prototype.listenerCount=yt;function yt(i){var e=this._events;if(e!==void 0){var A=e[i];if(typeof A=="function")return 1;if(A!==void 0)return A.length}return 0}K.prototype.eventNames=function(){return this._eventsCount>0?ue(this._events):[]};function pt(i,e){for(var A=new Array(e),t=0;t<e;++t)A[t]=i[t];return A}function ur(i,e){for(;e+1<i.length;e++)i[e]=i[e+1];i.pop()}function dr(i){for(var e=new Array(i.length),A=0;A<e.length;++A)e[A]=i[A].listener||i[A];return e}function Er(i,e){return new Promise(function(A,t){function r(o){i.removeListener(e,n),t(o)}function n(){typeof i.removeListener=="function"&&i.removeListener("error",r),A([].slice.call(arguments))}Lt(i,e,n,{once:!0}),e!=="error"&&lr(i,r,{once:!0})})}function lr(i,e,A){typeof i.on=="function"&&Lt(i,"error",e,A)}function Lt(i,e,A,t){if(typeof i.on=="function")t.once?i.once(e,A):i.on(e,A);else if(typeof i.addEventListener=="function")i.addEventListener(e,function r(n){t.once&&i.removeEventListener(e,r),A(n)});else throw new TypeError('The "emitter" argument must be of type EventEmitter. Received type '+typeof i)}});var pe=KA((Ug,di)=>{di.exports=function(e){return e!==null&&typeof e=="object"&&typeof e.addUndirectedEdgeWithKey=="function"&&typeof e.dropNode=="function"&&typeof e.multi=="boolean"}});var Ui=KA(Ue=>{function No(i){return typeof i!="number"||isNaN(i)?1:i}function Uo(i,e){var A={},t=function(o){return typeof o>"u"?e:o};typeof e=="function"&&(t=e);var r=function(o){return t(o[i])},n=function(){return t(void 0)};return typeof i=="string"?(A.fromAttributes=r,A.fromGraph=function(o,g){return r(o.getNodeAttributes(g))},A.fromEntry=function(o,g){return r(g)}):typeof i=="function"?(A.fromAttributes=function(){throw new Error("graphology-utils/getters/createNodeValueGetter: irrelevant usage.")},A.fromGraph=function(o,g){return t(i(g,o.getNodeAttributes(g)))},A.fromEntry=function(o,g){return t(i(o,g))}):(A.fromAttributes=n,A.fromGraph=n,A.fromEntry=n),A}function Ni(i,e){var A={},t=function(o){return typeof o>"u"?e:o};typeof e=="function"&&(t=e);var r=function(o){return t(o[i])},n=function(){return t(void 0)};return typeof i=="string"?(A.fromAttributes=r,A.fromGraph=function(o,g){return r(o.getEdgeAttributes(g))},A.fromEntry=function(o,g){return r(g)},A.fromPartialEntry=A.fromEntry,A.fromMinimalEntry=A.fromEntry):typeof i=="function"?(A.fromAttributes=function(){throw new Error("graphology-utils/getters/createEdgeValueGetter: irrelevant usage.")},A.fromGraph=function(o,g){var s=o.extremities(g);return t(i(g,o.getEdgeAttributes(g),s[0],s[1],o.getNodeAttributes(s[0]),o.getNodeAttributes(s[1]),o.isUndirected(g)))},A.fromEntry=function(o,g,s,B,C,w,c){return t(i(o,g,s,B,C,w,c))},A.fromPartialEntry=function(o,g,s,B){return t(i(o,g,s,B))},A.fromMinimalEntry=function(o,g){return t(i(o,g))}):(A.fromAttributes=n,A.fromGraph=n,A.fromEntry=n,A.fromMinimalEntry=n),A}Ue.createNodeValueGetter=Uo;Ue.createEdgeValueGetter=Ni;Ue.createEdgeWeightGetter=function(i){return Ni(i,No)}});var Si=KA((rs,Ti)=>{var T=0,N=1,b=2,H=3,GA=4,PA=5,x=6,Ri=7,Re=8,Oi=9,Ro=0,Oo=1,jo=2,W=0,wA=1,tA=2,UA=3,pA=4,O=5,nA=6,dA=7,EA=8,ji=3,uA=10,To=3,_=9,ft=10;Ti.exports=function(e,A,t){var r,n,o,g,s,B,C,w,c,f,D=A.length,h=t.length,d=e.adjustSizes,P=e.barnesHutTheta*e.barnesHutTheta,v,E,I,Y,L,M,m,u=[];for(o=0;o<D;o+=uA)A[o+GA]=A[o+b],A[o+PA]=A[o+H],A[o+b]=0,A[o+H]=0;if(e.outboundAttractionDistribution){for(v=0,o=0;o<D;o+=uA)v+=A[o+x];v/=D/uA}if(e.barnesHutOptimize){var U=1/0,j=-1/0,R=1/0,iA=-1/0,J,V,gA;for(o=0;o<D;o+=uA)U=Math.min(U,A[o+T]),j=Math.max(j,A[o+T]),R=Math.min(R,A[o+N]),iA=Math.max(iA,A[o+N]);var lA=j-U,fA=iA-R;for(lA>fA?(R-=(lA-fA)/2,iA=R+lA):(U-=(fA-lA)/2,j=U+fA),u[0+W]=-1,u[0+wA]=(U+j)/2,u[0+tA]=(R+iA)/2,u[0+UA]=Math.max(j-U,iA-R),u[0+pA]=-1,u[0+O]=-1,u[0+nA]=0,u[0+dA]=0,u[0+EA]=0,r=1,o=0;o<D;o+=uA)for(n=0,gA=ji;;)if(u[n+O]>=0){A[o+T]<u[n+wA]?A[o+N]<u[n+tA]?J=u[n+O]:J=u[n+O]+_:A[o+N]<u[n+tA]?J=u[n+O]+_*2:J=u[n+O]+_*3,u[n+dA]=(u[n+dA]*u[n+nA]+A[o+T]*A[o+x])/(u[n+nA]+A[o+x]),u[n+EA]=(u[n+EA]*u[n+nA]+A[o+N]*A[o+x])/(u[n+nA]+A[o+x]),u[n+nA]+=A[o+x],n=J;continue}else if(u[n+W]<0){u[n+W]=o;break}else{if(u[n+O]=r*_,w=u[n+UA]/2,c=u[n+O],u[c+W]=-1,u[c+wA]=u[n+wA]-w,u[c+tA]=u[n+tA]-w,u[c+UA]=w,u[c+pA]=c+_,u[c+O]=-1,u[c+nA]=0,u[c+dA]=0,u[c+EA]=0,c+=_,u[c+W]=-1,u[c+wA]=u[n+wA]-w,u[c+tA]=u[n+tA]+w,u[c+UA]=w,u[c+pA]=c+_,u[c+O]=-1,u[c+nA]=0,u[c+dA]=0,u[c+EA]=0,c+=_,u[c+W]=-1,u[c+wA]=u[n+wA]+w,u[c+tA]=u[n+tA]-w,u[c+UA]=w,u[c+pA]=c+_,u[c+O]=-1,u[c+nA]=0,u[c+dA]=0,u[c+EA]=0,c+=_,u[c+W]=-1,u[c+wA]=u[n+wA]+w,u[c+tA]=u[n+tA]+w,u[c+UA]=w,u[c+pA]=u[n+pA],u[c+O]=-1,u[c+nA]=0,u[c+dA]=0,u[c+EA]=0,r+=4,A[u[n+W]+T]<u[n+wA]?A[u[n+W]+N]<u[n+tA]?J=u[n+O]:J=u[n+O]+_:A[u[n+W]+N]<u[n+tA]?J=u[n+O]+_*2:J=u[n+O]+_*3,u[n+nA]=A[u[n+W]+x],u[n+dA]=A[u[n+W]+T],u[n+EA]=A[u[n+W]+N],u[J+W]=u[n+W],u[n+W]=-1,A[o+T]<u[n+wA]?A[o+N]<u[n+tA]?V=u[n+O]:V=u[n+O]+_:A[o+N]<u[n+tA]?V=u[n+O]+_*2:V=u[n+O]+_*3,J===V)if(gA--){n=J;continue}else{gA=ji;break}u[V+W]=o;break}}if(e.barnesHutOptimize)for(E=e.scalingRatio,o=0;o<D;o+=uA)for(n=0;;)if(u[n+O]>=0)if(M=Math.pow(A[o+T]-u[n+dA],2)+Math.pow(A[o+N]-u[n+EA],2),f=u[n+UA],4*f*f/M<P){if(I=A[o+T]-u[n+dA],Y=A[o+N]-u[n+EA],d===!0?M>0?(m=E*A[o+x]*u[n+nA]/M,A[o+b]+=I*m,A[o+H]+=Y*m):M<0&&(m=-E*A[o+x]*u[n+nA]/Math.sqrt(M),A[o+b]+=I*m,A[o+H]+=Y*m):M>0&&(m=E*A[o+x]*u[n+nA]/M,A[o+b]+=I*m,A[o+H]+=Y*m),n=u[n+pA],n<0)break;continue}else{n=u[n+O];continue}else{if(B=u[n+W],B>=0&&B!==o&&(I=A[o+T]-A[B+T],Y=A[o+N]-A[B+N],M=I*I+Y*Y,d===!0?M>0?(m=E*A[o+x]*A[B+x]/M,A[o+b]+=I*m,A[o+H]+=Y*m):M<0&&(m=-E*A[o+x]*A[B+x]/Math.sqrt(M),A[o+b]+=I*m,A[o+H]+=Y*m):M>0&&(m=E*A[o+x]*A[B+x]/M,A[o+b]+=I*m,A[o+H]+=Y*m)),n=u[n+pA],n<0)break;continue}else for(E=e.scalingRatio,g=0;g<D;g+=uA)for(s=0;s<g;s+=uA)I=A[g+T]-A[s+T],Y=A[g+N]-A[s+N],d===!0?(M=Math.sqrt(I*I+Y*Y)-A[g+Re]-A[s+Re],M>0?(m=E*A[g+x]*A[s+x]/M/M,A[g+b]+=I*m,A[g+H]+=Y*m,A[s+b]-=I*m,A[s+H]-=Y*m):M<0&&(m=100*E*A[g+x]*A[s+x],A[g+b]+=I*m,A[g+H]+=Y*m,A[s+b]-=I*m,A[s+H]-=Y*m)):(M=Math.sqrt(I*I+Y*Y),M>0&&(m=E*A[g+x]*A[s+x]/M/M,A[g+b]+=I*m,A[g+H]+=Y*m,A[s+b]-=I*m,A[s+H]-=Y*m));for(c=e.gravity/e.scalingRatio,E=e.scalingRatio,o=0;o<D;o+=uA)m=0,I=A[o+T],Y=A[o+N],M=Math.sqrt(Math.pow(I,2)+Math.pow(Y,2)),e.strongGravityMode?M>0&&(m=E*A[o+x]*c):M>0&&(m=E*A[o+x]*c/M),A[o+b]-=I*m,A[o+H]-=Y*m;for(E=1*(e.outboundAttractionDistribution?v:1),C=0;C<h;C+=To)g=t[C+Ro],s=t[C+Oo],w=t[C+jo],L=Math.pow(w,e.edgeWeightInfluence),I=A[g+T]-A[s+T],Y=A[g+N]-A[s+N],d===!0?(M=Math.sqrt(I*I+Y*Y)-A[g+Re]-A[s+Re],e.linLogMode?e.outboundAttractionDistribution?M>0&&(m=-E*L*Math.log(1+M)/M/A[g+x]):M>0&&(m=-E*L*Math.log(1+M)/M):e.outboundAttractionDistribution?M>0&&(m=-E*L/A[g+x]):M>0&&(m=-E*L)):(M=Math.sqrt(Math.pow(I,2)+Math.pow(Y,2)),e.linLogMode?e.outboundAttractionDistribution?M>0&&(m=-E*L*Math.log(1+M)/M/A[g+x]):M>0&&(m=-E*L*Math.log(1+M)/M):e.outboundAttractionDistribution?(M=1,m=-E*L/A[g+x]):(M=1,m=-E*L)),M>0&&(A[g+b]+=I*m,A[g+H]+=Y*m,A[s+b]-=I*m,A[s+H]-=Y*m);var sA,rA,oA,hA,$,OA;if(d===!0)for(o=0;o<D;o+=uA)A[o+Oi]!==1&&(sA=Math.sqrt(Math.pow(A[o+b],2)+Math.pow(A[o+H],2)),sA>ft&&(A[o+b]=A[o+b]*ft/sA,A[o+H]=A[o+H]*ft/sA),rA=A[o+x]*Math.sqrt((A[o+GA]-A[o+b])*(A[o+GA]-A[o+b])+(A[o+PA]-A[o+H])*(A[o+PA]-A[o+H])),oA=Math.sqrt((A[o+GA]+A[o+b])*(A[o+GA]+A[o+b])+(A[o+PA]+A[o+H])*(A[o+PA]+A[o+H]))/2,hA=.1*Math.log(1+oA)/(1+Math.sqrt(rA)),$=A[o+T]+A[o+b]*(hA/e.slowDown),A[o+T]=$,OA=A[o+N]+A[o+H]*(hA/e.slowDown),A[o+N]=OA);else for(o=0;o<D;o+=uA)A[o+Oi]!==1&&(rA=A[o+x]*Math.sqrt((A[o+GA]-A[o+b])*(A[o+GA]-A[o+b])+(A[o+PA]-A[o+H])*(A[o+PA]-A[o+H])),oA=Math.sqrt((A[o+GA]+A[o+b])*(A[o+GA]+A[o+b])+(A[o+PA]+A[o+H])*(A[o+PA]+A[o+H]))/2,hA=A[o+Ri]*Math.log(1+oA)/(1+Math.sqrt(rA)),A[o+Ri]=Math.min(1,Math.sqrt(hA*(Math.pow(A[o+b],2)+Math.pow(A[o+H],2))/(1+Math.sqrt(rA)))),$=A[o+T]+A[o+b]*(hA/e.slowDown),A[o+T]=$,OA=A[o+N]+A[o+H]*(hA/e.slowDown),A[o+N]=OA);return{}}});var Xi=KA(LA=>{var ce=10,zi=3;LA.assign=function(i){i=i||{};var e=Array.prototype.slice.call(arguments).slice(1),A,t,r;for(A=0,r=e.length;A<r;A++)if(e[A])for(t in e[A])i[t]=e[A][t];return i};LA.validateSettings=function(i){return"linLogMode"in i&&typeof i.linLogMode!="boolean"?{message:"the `linLogMode` setting should be a boolean."}:"outboundAttractionDistribution"in i&&typeof i.outboundAttractionDistribution!="boolean"?{message:"the `outboundAttractionDistribution` setting should be a boolean."}:"adjustSizes"in i&&typeof i.adjustSizes!="boolean"?{message:"the `adjustSizes` setting should be a boolean."}:"edgeWeightInfluence"in i&&typeof i.edgeWeightInfluence!="number"?{message:"the `edgeWeightInfluence` setting should be a number."}:"scalingRatio"in i&&!(typeof i.scalingRatio=="number"&&i.scalingRatio>=0)?{message:"the `scalingRatio` setting should be a number >= 0."}:"strongGravityMode"in i&&typeof i.strongGravityMode!="boolean"?{message:"the `strongGravityMode` setting should be a boolean."}:"gravity"in i&&!(typeof i.gravity=="number"&&i.gravity>=0)?{message:"the `gravity` setting should be a number >= 0."}:"slowDown"in i&&!(typeof i.slowDown=="number"||i.slowDown>=0)?{message:"the `slowDown` setting should be a number >= 0."}:"barnesHutOptimize"in i&&typeof i.barnesHutOptimize!="boolean"?{message:"the `barnesHutOptimize` setting should be a boolean."}:"barnesHutTheta"in i&&!(typeof i.barnesHutTheta=="number"&&i.barnesHutTheta>=0)?{message:"the `barnesHutTheta` setting should be a number >= 0."}:null};LA.graphToByteArrays=function(i,e){var A=i.order,t=i.size,r={},n,o=new Float32Array(A*ce),g=new Float32Array(t*zi);return n=0,i.forEachNode(function(s,B){r[s]=n,o[n]=B.x,o[n+1]=B.y,o[n+2]=0,o[n+3]=0,o[n+4]=0,o[n+5]=0,o[n+6]=1,o[n+7]=1,o[n+8]=B.size||1,o[n+9]=B.fixed?1:0,n+=ce}),n=0,i.forEachEdge(function(s,B,C,w,c,f,D){var h=r[C],d=r[w],P=e(s,B,C,w,c,f,D);o[h+6]+=P,o[d+6]+=P,g[n]=h,g[n+1]=d,g[n+2]=P,n+=zi}),{nodes:o,edges:g}};LA.assignLayoutChanges=function(i,e,A){var t=0;i.updateEachNodeAttributes(function(r,n){return n.x=e[t],n.y=e[t+1],t+=ce,A?A(r,n):n})};LA.readGraphPositions=function(i,e){var A=0;i.forEachNode(function(t,r){e[A]=r.x,e[A+1]=r.y,A+=ce})};LA.collectLayoutChanges=function(i,e,A){for(var t=i.nodes(),r={},n=0,o=0,g=e.length;n<g;n+=ce){if(A){var s=Object.assign({},i.getNodeAttributes(t[o]));s.x=e[n],s.y=e[n+1],s=A(t[o],s),r[t[o]]={x:s.x,y:s.y}}else r[t[o]]={x:e[n],y:e[n+1]};o++}return r};LA.createWorker=function(e){var A=window.URL||window.webkitURL,t=e.toString(),r=A.createObjectURL(new Blob(["("+t+").call(this);"],{type:"text/javascript"})),n=new Worker(r);return A.revokeObjectURL(r),n}});var Wi=KA((os,Vi)=>{Vi.exports={linLogMode:!1,outboundAttractionDistribution:!1,adjustSizes:!1,edgeWeightInfluence:1,scalingRatio:1,strongGravityMode:!1,gravity:1,slowDown:1,barnesHutOptimize:!1,barnesHutTheta:.5}});var _i=KA((gs,Zi)=>{var So=pe(),zo=Ui().createEdgeWeightGetter,Xo=Si(),fe=Xi(),Vo=Wi();function qi(i,e,A){if(!So(e))throw new Error("graphology-layout-forceatlas2: the given graph is not a valid graphology instance.");typeof A=="number"&&(A={iterations:A});var t=A.iterations;if(typeof t!="number")throw new Error("graphology-layout-forceatlas2: invalid number of iterations.");if(t<=0)throw new Error("graphology-layout-forceatlas2: you should provide a positive number of iterations.");var r=zo("getEdgeWeight"in A?A.getEdgeWeight:"weight").fromEntry,n=typeof A.outputReducer=="function"?A.outputReducer:null,o=fe.assign({},Vo,A.settings),g=fe.validateSettings(o);if(g)throw new Error("graphology-layout-forceatlas2: "+g.message);var s=fe.graphToByteArrays(e,r),B;for(B=0;B<t;B++)Xo(o,s.nodes,s.edges);if(i){fe.assignLayoutChanges(e,s.nodes,n);return}return fe.collectLayoutChanges(e,s.nodes)}function Wo(i){var e=typeof i=="number"?i:i.order;return{barnesHutOptimize:e>2e3,strongGravityMode:!0,gravity:.05,scalingRatio:10,slowDown:1+Math.log(e)}}var ht=qi.bind(null,!1);ht.assign=qi.bind(null,!0);ht.inferSettings=Wo;Zi.exports=ht});var Kt=jA(Ee(),1);function vr(){let i=arguments[0];for(let e=1,A=arguments.length;e<A;e++)if(arguments[e])for(let t in arguments[e])i[t]=arguments[e][t];return i}var S=vr;typeof Object.assign=="function"&&(S=Object.assign);function BA(i,e,A,t){let r=i._nodes.get(e),n=null;return r&&(t==="mixed"?n=r.out&&r.out[A]||r.undirected&&r.undirected[A]:t==="directed"?n=r.out&&r.out[A]:n=r.undirected&&r.undirected[A]),n}function q(i){return typeof i=="object"&&i!==null}function kt(i){let e;for(e in i)return!1;return!0}function aA(i,e,A){Object.defineProperty(i,e,{enumerable:!1,configurable:!1,writable:!0,value:A})}function QA(i,e,A){let t={enumerable:!0,configurable:!0};typeof A=="function"?t.get=A:(t.value=A,t.writable=!1),Object.defineProperty(i,e,t)}function bt(i){return!(!q(i)||i.attributes&&!Array.isArray(i.attributes))}function Ir(){let i=Math.floor(Math.random()*256)&255;return()=>i++}function vA(){let i=arguments,e=null,A=-1;return{[Symbol.iterator](){return this},next(){let t=null;do{if(e===null){if(A++,A>=i.length)return{done:!0};e=i[A][Symbol.iterator]()}if(t=e.next(),t.done){e=null;continue}break}while(!0);return t}}}function zA(){return{[Symbol.iterator](){return this},next(){return{done:!0}}}}var ge=class extends Error{constructor(e){super(),this.name="GraphError",this.message=e}},G=class i extends ge{constructor(e){super(e),this.name="InvalidArgumentsGraphError",typeof Error.captureStackTrace=="function"&&Error.captureStackTrace(this,i.prototype.constructor)}},F=class i extends ge{constructor(e){super(e),this.name="NotFoundGraphError",typeof Error.captureStackTrace=="function"&&Error.captureStackTrace(this,i.prototype.constructor)}},p=class i extends ge{constructor(e){super(e),this.name="UsageGraphError",typeof Error.captureStackTrace=="function"&&Error.captureStackTrace(this,i.prototype.constructor)}};function Jt(i,e){this.key=i,this.attributes=e,this.clear()}Jt.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 Nt(i,e){this.key=i,this.attributes=e,this.clear()}Nt.prototype.clear=function(){this.inDegree=0,this.outDegree=0,this.directedLoops=0,this.in={},this.out={}};function Ut(i,e){this.key=i,this.attributes=e,this.clear()}Ut.prototype.clear=function(){this.undirectedDegree=0,this.undirectedLoops=0,this.undirected={}};function XA(i,e,A,t,r){this.key=e,this.attributes=r,this.undirected=i,this.source=A,this.target=t}XA.prototype.attach=function(){let i="out",e="in";this.undirected&&(i=e="undirected");let A=this.source.key,t=this.target.key;this.source[i][t]=this,!(this.undirected&&A===t)&&(this.target[e][A]=this)};XA.prototype.attachMulti=function(){let i="out",e="in",A=this.source.key,t=this.target.key;this.undirected&&(i=e="undirected");let r=this.source[i],n=r[t];if(typeof n>"u"){r[t]=this,this.undirected&&A===t||(this.target[e][A]=this);return}n.previous=this,this.next=n,r[t]=this,this.target[e][A]=this};XA.prototype.detach=function(){let i=this.source.key,e=this.target.key,A="out",t="in";this.undirected&&(A=t="undirected"),delete this.source[A][e],delete this.target[t][i]};XA.prototype.detachMulti=function(){let i=this.source.key,e=this.target.key,A="out",t="in";this.undirected&&(A=t="undirected"),this.previous===void 0?this.next===void 0?(delete this.source[A][e],delete this.target[t][i]):(this.next.previous=void 0,this.source[A][e]=this.next,this.target[t][i]=this.next):(this.previous.next=this.next,this.next!==void 0&&(this.next.previous=this.previous))};var Rt=0,Ot=1,Mr=2,jt=3;function IA(i,e,A,t,r,n,o){let g,s,B,C;if(t=""+t,A===Rt){if(g=i._nodes.get(t),!g)throw new F(`Graph.${e}: could not find the "${t}" node in the graph.`);B=r,C=n}else if(A===jt){if(r=""+r,s=i._edges.get(r),!s)throw new F(`Graph.${e}: could not find the "${r}" edge in the graph.`);let w=s.source.key,c=s.target.key;if(t===w)g=s.target;else if(t===c)g=s.source;else throw new F(`Graph.${e}: the "${t}" node is not attached to the "${r}" edge (${w}, ${c}).`);B=n,C=o}else{if(s=i._edges.get(t),!s)throw new F(`Graph.${e}: could not find the "${t}" edge in the graph.`);A===Ot?g=s.source:g=s.target,B=r,C=n}return[g,B,C]}function Fr(i,e,A){i.prototype[e]=function(t,r,n){let[o,g]=IA(this,e,A,t,r,n);return o.attributes[g]}}function Gr(i,e,A){i.prototype[e]=function(t,r){let[n]=IA(this,e,A,t,r);return n.attributes}}function Pr(i,e,A){i.prototype[e]=function(t,r,n){let[o,g]=IA(this,e,A,t,r,n);return o.attributes.hasOwnProperty(g)}}function mr(i,e,A){i.prototype[e]=function(t,r,n,o){let[g,s,B]=IA(this,e,A,t,r,n,o);return g.attributes[s]=B,this.emit("nodeAttributesUpdated",{key:g.key,type:"set",attributes:g.attributes,name:s}),this}}function Yr(i,e,A){i.prototype[e]=function(t,r,n,o){let[g,s,B]=IA(this,e,A,t,r,n,o);if(typeof B!="function")throw new G(`Graph.${e}: updater should be a function.`);let C=g.attributes,w=B(C[s]);return C[s]=w,this.emit("nodeAttributesUpdated",{key:g.key,type:"set",attributes:g.attributes,name:s}),this}}function yr(i,e,A){i.prototype[e]=function(t,r,n){let[o,g]=IA(this,e,A,t,r,n);return delete o.attributes[g],this.emit("nodeAttributesUpdated",{key:o.key,type:"remove",attributes:o.attributes,name:g}),this}}function pr(i,e,A){i.prototype[e]=function(t,r,n){let[o,g]=IA(this,e,A,t,r,n);if(!q(g))throw new G(`Graph.${e}: provided attributes are not a plain object.`);return o.attributes=g,this.emit("nodeAttributesUpdated",{key:o.key,type:"replace",attributes:o.attributes}),this}}function Lr(i,e,A){i.prototype[e]=function(t,r,n){let[o,g]=IA(this,e,A,t,r,n);if(!q(g))throw new G(`Graph.${e}: provided attributes are not a plain object.`);return S(o.attributes,g),this.emit("nodeAttributesUpdated",{key:o.key,type:"merge",attributes:o.attributes,data:g}),this}}function br(i,e,A){i.prototype[e]=function(t,r,n){let[o,g]=IA(this,e,A,t,r,n);if(typeof g!="function")throw new G(`Graph.${e}: provided updater is not a function.`);return o.attributes=g(o.attributes),this.emit("nodeAttributesUpdated",{key:o.key,type:"update",attributes:o.attributes}),this}}var Hr=[{name:i=>`get${i}Attribute`,attacher:Fr},{name:i=>`get${i}Attributes`,attacher:Gr},{name:i=>`has${i}Attribute`,attacher:Pr},{name:i=>`set${i}Attribute`,attacher:mr},{name:i=>`update${i}Attribute`,attacher:Yr},{name:i=>`remove${i}Attribute`,attacher:yr},{name:i=>`replace${i}Attributes`,attacher:pr},{name:i=>`merge${i}Attributes`,attacher:Lr},{name:i=>`update${i}Attributes`,attacher:br}];function xr(i){Hr.forEach(function({name:e,attacher:A}){A(i,e("Node"),Rt),A(i,e("Source"),Ot),A(i,e("Target"),Mr),A(i,e("Opposite"),jt)})}function Kr(i,e,A){i.prototype[e]=function(t,r){let n;if(this.type!=="mixed"&&A!=="mixed"&&A!==this.type)throw new p(`Graph.${e}: cannot find this type of edges in your ${this.type} graph.`);if(arguments.length>2){if(this.multi)throw new p(`Graph.${e}: 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=""+t,g=""+r;if(r=arguments[2],n=BA(this,o,g,A),!n)throw new F(`Graph.${e}: could not find an edge for the given path ("${o}" - "${g}").`)}else{if(A!=="mixed")throw new p(`Graph.${e}: 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(t=""+t,n=this._edges.get(t),!n)throw new F(`Graph.${e}: could not find the "${t}" edge in the graph.`)}return n.attributes[r]}}function kr(i,e,A){i.prototype[e]=function(t){let r;if(this.type!=="mixed"&&A!=="mixed"&&A!==this.type)throw new p(`Graph.${e}: cannot find this type of edges in your ${this.type} graph.`);if(arguments.length>1){if(this.multi)throw new p(`Graph.${e}: 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=""+t,o=""+arguments[1];if(r=BA(this,n,o,A),!r)throw new F(`Graph.${e}: could not find an edge for the given path ("${n}" - "${o}").`)}else{if(A!=="mixed")throw new p(`Graph.${e}: 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(t=""+t,r=this._edges.get(t),!r)throw new F(`Graph.${e}: could not find the "${t}" edge in the graph.`)}return r.attributes}}function Jr(i,e,A){i.prototype[e]=function(t,r){let n;if(this.type!=="mixed"&&A!=="mixed"&&A!==this.type)throw new p(`Graph.${e}: cannot find this type of edges in your ${this.type} graph.`);if(arguments.length>2){if(this.multi)throw new p(`Graph.${e}: 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=""+t,g=""+r;if(r=arguments[2],n=BA(this,o,g,A),!n)throw new F(`Graph.${e}: could not find an edge for the given path ("${o}" - "${g}").`)}else{if(A!=="mixed")throw new p(`Graph.${e}: 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(t=""+t,n=this._edges.get(t),!n)throw new F(`Graph.${e}: could not find the "${t}" edge in the graph.`)}return n.attributes.hasOwnProperty(r)}}function Nr(i,e,A){i.prototype[e]=function(t,r,n){let o;if(this.type!=="mixed"&&A!=="mixed"&&A!==this.type)throw new p(`Graph.${e}: cannot find this type of edges in your ${this.type} graph.`);if(arguments.length>3){if(this.multi)throw new p(`Graph.${e}: 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 g=""+t,s=""+r;if(r=arguments[2],n=arguments[3],o=BA(this,g,s,A),!o)throw new F(`Graph.${e}: could not find an edge for the given path ("${g}" - "${s}").`)}else{if(A!=="mixed")throw new p(`Graph.${e}: 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(t=""+t,o=this._edges.get(t),!o)throw new F(`Graph.${e}: could not find the "${t}" edge in the graph.`)}return o.attributes[r]=n,this.emit("edgeAttributesUpdated",{key:o.key,type:"set",attributes:o.attributes,name:r}),this}}function Ur(i,e,A){i.prototype[e]=function(t,r,n){let o;if(this.type!=="mixed"&&A!=="mixed"&&A!==this.type)throw new p(`Graph.${e}: cannot find this type of edges in your ${this.type} graph.`);if(arguments.length>3){if(this.multi)throw new p(`Graph.${e}: 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 g=""+t,s=""+r;if(r=arguments[2],n=arguments[3],o=BA(this,g,s,A),!o)throw new F(`Graph.${e}: could not find an edge for the given path ("${g}" - "${s}").`)}else{if(A!=="mixed")throw new p(`Graph.${e}: 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(t=""+t,o=this._edges.get(t),!o)throw new F(`Graph.${e}: could not find the "${t}" edge in the graph.`)}if(typeof n!="function")throw new G(`Graph.${e}: updater should be a function.`);return o.attributes[r]=n(o.attributes[r]),this.emit("edgeAttributesUpdated",{key:o.key,type:"set",attributes:o.attributes,name:r}),this}}function Rr(i,e,A){i.prototype[e]=function(t,r){let n;if(this.type!=="mixed"&&A!=="mixed"&&A!==this.type)throw new p(`Graph.${e}: cannot find this type of edges in your ${this.type} graph.`);if(arguments.length>2){if(this.multi)throw new p(`Graph.${e}: 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=""+t,g=""+r;if(r=arguments[2],n=BA(this,o,g,A),!n)throw new F(`Graph.${e}: could not find an edge for the given path ("${o}" - "${g}").`)}else{if(A!=="mixed")throw new p(`Graph.${e}: 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(t=""+t,n=this._edges.get(t),!n)throw new F(`Graph.${e}: could not find the "${t}" edge in the graph.`)}return delete n.attributes[r],this.emit("edgeAttributesUpdated",{key:n.key,type:"remove",attributes:n.attributes,name:r}),this}}function Or(i,e,A){i.prototype[e]=function(t,r){let n;if(this.type!=="mixed"&&A!=="mixed"&&A!==this.type)throw new p(`Graph.${e}: cannot find this type of edges in your ${this.type} graph.`);if(arguments.length>2){if(this.multi)throw new p(`Graph.${e}: 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=""+t,g=""+r;if(r=arguments[2],n=BA(this,o,g,A),!n)throw new F(`Graph.${e}: could not find an edge for the given path ("${o}" - "${g}").`)}else{if(A!=="mixed")throw new p(`Graph.${e}: 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(t=""+t,n=this._edges.get(t),!n)throw new F(`Graph.${e}: could not find the "${t}" edge in the graph.`)}if(!q(r))throw new G(`Graph.${e}: provided attributes are not a plain object.`);return n.attributes=r,this.emit("edgeAttributesUpdated",{key:n.key,type:"replace",attributes:n.attributes}),this}}function jr(i,e,A){i.prototype[e]=function(t,r){let n;if(this.type!=="mixed"&&A!=="mixed"&&A!==this.type)throw new p(`Graph.${e}: cannot find this type of edges in your ${this.type} graph.`);if(arguments.length>2){if(this.multi)throw new p(`Graph.${e}: 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=""+t,g=""+r;if(r=arguments[2],n=BA(this,o,g,A),!n)throw new F(`Graph.${e}: could not find an edge for the given path ("${o}" - "${g}").`)}else{if(A!=="mixed")throw new p(`Graph.${e}: 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(t=""+t,n=this._edges.get(t),!n)throw new F(`Graph.${e}: could not find the "${t}" edge in the graph.`)}if(!q(r))throw new G(`Graph.${e}: provided attributes are not a plain object.`);return S(n.attributes,r),this.emit("edgeAttributesUpdated",{key:n.key,type:"merge",attributes:n.attributes,data:r}),this}}function Tr(i,e,A){i.prototype[e]=function(t,r){let n;if(this.type!=="mixed"&&A!=="mixed"&&A!==this.type)throw new p(`Graph.${e}: cannot find this type of edges in your ${this.type} graph.`);if(arguments.length>2){if(this.multi)throw new p(`Graph.${e}: 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=""+t,g=""+r;if(r=arguments[2],n=BA(this,o,g,A),!n)throw new F(`Graph.${e}: could not find an edge for the given path ("${o}" - "${g}").`)}else{if(A!=="mixed")throw new p(`Graph.${e}: 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(t=""+t,n=this._edges.get(t),!n)throw new F(`Graph.${e}: could not find the "${t}" edge in the graph.`)}if(typeof r!="function")throw new G(`Graph.${e}: provided updater is not a function.`);return n.attributes=r(n.attributes),this.emit("edgeAttributesUpdated",{key:n.key,type:"update",attributes:n.attributes}),this}}var Sr=[{name:i=>`get${i}Attribute`,attacher:Kr},{name:i=>`get${i}Attributes`,attacher:kr},{name:i=>`has${i}Attribute`,attacher:Jr},{name:i=>`set${i}Attribute`,attacher:Nr},{name:i=>`update${i}Attribute`,attacher:Ur},{name:i=>`remove${i}Attribute`,attacher:Rr},{name:i=>`replace${i}Attributes`,attacher:Or},{name:i=>`merge${i}Attributes`,attacher:jr},{name:i=>`update${i}Attributes`,attacher:Tr}];function zr(i){Sr.forEach(function({name:e,attacher:A}){A(i,e("Edge"),"mixed"),A(i,e("DirectedEdge"),"directed"),A(i,e("UndirectedEdge"),"undirected")})}var Xr=[{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 Vr(i,e,A,t){let r=!1;for(let n in e){if(n===t)continue;let o=e[n];if(r=A(o.key,o.attributes,o.source.key,o.target.key,o.source.attributes,o.target.attributes,o.undirected),i&&r)return o.key}}function Wr(i,e,A,t){let r,n,o,g=!1;for(let s in e)if(s!==t){r=e[s];do{if(n=r.source,o=r.target,g=A(r.key,r.attributes,n.key,o.key,n.attributes,o.attributes,r.undirected),i&&g)return r.key;r=r.next}while(r!==void 0)}}function Se(i,e){let A=Object.keys(i),t=A.length,r,n=0;return{[Symbol.iterator](){return this},next(){do if(r)r=r.next;else{if(n>=t)return{done:!0};let o=A[n++];if(o===e){r=void 0;continue}r=i[o]}while(!r);return{done:!1,value:{edge:r.key,attributes:r.attributes,source:r.source.key,target:r.target.key,sourceAttributes:r.source.attributes,targetAttributes:r.target.attributes,undirected:r.undirected}}}}}function qr(i,e,A,t){let r=e[A];if(!r)return;let n=r.source,o=r.target;if(t(r.key,r.attributes,n.key,o.key,n.attributes,o.attributes,r.undirected)&&i)return r.key}function Zr(i,e,A,t){let r=e[A];if(!r)return;let n=!1;do{if(n=t(r.key,r.attributes,r.source.key,r.target.key,r.source.attributes,r.target.attributes,r.undirected),i&&n)return r.key;r=r.next}while(r!==void 0)}function ze(i,e){let A=i[e];if(A.next!==void 0)return{[Symbol.iterator](){return this},next(){if(!A)return{done:!0};let r={edge:A.key,attributes:A.attributes,source:A.source.key,target:A.target.key,sourceAttributes:A.source.attributes,targetAttributes:A.target.attributes,undirected:A.undirected};return A=A.next,{done:!1,value:r}}};let t=!1;return{[Symbol.iterator](){return this},next(){return t===!0?{done:!0}:(t=!0,{done:!1,value:{edge:A.key,attributes:A.attributes,source:A.source.key,target:A.target.key,sourceAttributes:A.source.attributes,targetAttributes:A.target.attributes,undirected:A.undirected}})}}}function _r(i,e){if(i.size===0)return[];if(e==="mixed"||e===i.type)return Array.from(i._edges.keys());let A=e==="undirected"?i.undirectedSize:i.directedSize,t=new Array(A),r=e==="undirected",n=i._edges.values(),o=0,g,s;for(;g=n.next(),g.done!==!0;)s=g.value,s.undirected===r&&(t[o++]=s.key);return t}function Tt(i,e,A,t){if(e.size===0)return;let r=A!=="mixed"&&A!==e.type,n=A==="undirected",o,g,s=!1,B=e._edges.values();for(;o=B.next(),o.done!==!0;){if(g=o.value,r&&g.undirected!==n)continue;let{key:C,attributes:w,source:c,target:f}=g;if(s=t(C,w,c.key,f.key,c.attributes,f.attributes,g.undirected),i&&s)return C}}function $r(i,e){if(i.size===0)return zA();let A=e!=="mixed"&&e!==i.type,t=e==="undirected",r=i._edges.values();return{[Symbol.iterator](){return this},next(){let n,o;for(;;){if(n=r.next(),n.done)return n;if(o=n.value,!(A&&o.undirected!==t))break}return{value:{edge:o.key,attributes:o.attributes,source:o.source.key,target:o.target.key,sourceAttributes:o.source.attributes,targetAttributes:o.target.attributes,undirected:o.undirected},done:!1}}}}function Xe(i,e,A,t,r,n){let o=e?Wr:Vr,g;if(A!=="undirected"&&(t!=="out"&&(g=o(i,r.in,n),i&&g)||t!=="in"&&(g=o(i,r.out,n,t?void 0:r.key),i&&g))||A!=="directed"&&(g=o(i,r.undirected,n),i&&g))return g}function An(i,e,A,t){let r=[];return Xe(!1,i,e,A,t,function(n){r.push(n)}),r}function en(i,e,A){let t=zA();return i!=="undirected"&&(e!=="out"&&typeof A.in<"u"&&(t=vA(t,Se(A.in))),e!=="in"&&typeof A.out<"u"&&(t=vA(t,Se(A.out,e?void 0:A.key)))),i!=="directed"&&typeof A.undirected<"u"&&(t=vA(t,Se(A.undirected))),t}function Ve(i,e,A,t,r,n,o){let g=A?Zr:qr,s;if(e!=="undirected"&&(typeof r.in<"u"&&t!=="out"&&(s=g(i,r.in,n,o),i&&s)||typeof r.out<"u"&&t!=="in"&&(t||r.key!==n)&&(s=g(i,r.out,n,o),i&&s))||e!=="directed"&&typeof r.undirected<"u"&&(s=g(i,r.undirected,n,o),i&&s))return s}function tn(i,e,A,t,r){let n=[];return Ve(!1,i,e,A,t,r,function(o){n.push(o)}),n}function rn(i,e,A,t){let r=zA();return i!=="undirected"&&(typeof A.in<"u"&&e!=="out"&&t in A.in&&(r=vA(r,ze(A.in,t))),typeof A.out<"u"&&e!=="in"&&t in A.out&&(e||A.key!==t)&&(r=vA(r,ze(A.out,t)))),i!=="directed"&&typeof A.undirected<"u"&&t in A.undirected&&(r=vA(r,ze(A.undirected,t))),r}function nn(i,e){let{name:A,type:t,direction:r}=e;i.prototype[A]=function(n,o){if(t!=="mixed"&&this.type!=="mixed"&&t!==this.type)return[];if(!arguments.length)return _r(this,t);if(arguments.length===1){n=""+n;let g=this._nodes.get(n);if(typeof g>"u")throw new F(`Graph.${A}: could not find the "${n}" node in the graph.`);return An(this.multi,t==="mixed"?this.type:t,r,g)}if(arguments.length===2){n=""+n,o=""+o;let g=this._nodes.get(n);if(!g)throw new F(`Graph.${A}: could not find the "${n}" source node in the graph.`);if(!this._nodes.has(o))throw new F(`Graph.${A}: could not find the "${o}" target node in the graph.`);return tn(t,this.multi,r,g,o)}throw new G(`Graph.${A}: too many arguments (expecting 0, 1 or 2 and got ${arguments.length}).`)}}function on(i,e){let{name:A,type:t,direction:r}=e,n="forEach"+A[0].toUpperCase()+A.slice(1,-1);i.prototype[n]=function(B,C,w){if(!(t!=="mixed"&&this.type!=="mixed"&&t!==this.type)){if(arguments.length===1)return w=B,Tt(!1,this,t,w);if(arguments.length===2){B=""+B,w=C;let c=this._nodes.get(B);if(typeof c>"u")throw new F(`Graph.${n}: could not find the "${B}" node in the graph.`);return Xe(!1,this.multi,t==="mixed"?this.type:t,r,c,w)}if(arguments.length===3){B=""+B,C=""+C;let c=this._nodes.get(B);if(!c)throw new F(`Graph.${n}: could not find the "${B}" source node in the graph.`);if(!this._nodes.has(C))throw new F(`Graph.${n}: could not find the "${C}" target node in the graph.`);return Ve(!1,t,this.multi,r,c,C,w)}throw new G(`Graph.${n}: too many arguments (expecting 1, 2 or 3 and got ${arguments.length}).`)}};let o="map"+A[0].toUpperCase()+A.slice(1);i.prototype[o]=function(){let B=Array.prototype.slice.call(arguments),C=B.pop(),w;if(B.length===0){let c=0;t!=="directed"&&(c+=this.undirectedSize),t!=="undirected"&&(c+=this.directedSize),w=new Array(c);let f=0;B.push((D,h,d,P,v,E,I)=>{w[f++]=C(D,h,d,P,v,E,I)})}else w=[],B.push((c,f,D,h,d,P,v)=>{w.push(C(c,f,D,h,d,P,v))});return this[n].apply(this,B),w};let g="filter"+A[0].toUpperCase()+A.slice(1);i.prototype[g]=function(){let B=Array.prototype.slice.call(arguments),C=B.pop(),w=[];return B.push((c,f,D,h,d,P,v)=>{C(c,f,D,h,d,P,v)&&w.push(c)}),this[n].apply(this,B),w};let s="reduce"+A[0].toUpperCase()+A.slice(1);i.prototype[s]=function(){let B=Array.prototype.slice.call(arguments);if(B.length<2||B.length>4)throw new G(`Graph.${s}: invalid number of arguments (expecting 2, 3 or 4 and got ${B.length}).`);if(typeof B[B.length-1]=="function"&&typeof B[B.length-2]!="function")throw new G(`Graph.${s}: 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 C,w;B.length===2?(C=B[0],w=B[1],B=[]):B.length===3?(C=B[1],w=B[2],B=[B[0]]):B.length===4&&(C=B[2],w=B[3],B=[B[0],B[1]]);let c=w;return B.push((f,D,h,d,P,v,E)=>{c=C(c,f,D,h,d,P,v,E)}),this[n].apply(this,B),c}}function gn(i,e){let{name:A,type:t,direction:r}=e,n="find"+A[0].toUpperCase()+A.slice(1,-1);i.prototype[n]=function(s,B,C){if(t!=="mixed"&&this.type!=="mixed"&&t!==this.type)return!1;if(arguments.length===1)return C=s,Tt(!0,this,t,C);if(arguments.length===2){s=""+s,C=B;let w=this._nodes.get(s);if(typeof w>"u")throw new F(`Graph.${n}: could not find the "${s}" node in the graph.`);return Xe(!0,this.multi,t==="mixed"?this.type:t,r,w,C)}if(arguments.length===3){s=""+s,B=""+B;let w=this._nodes.get(s);if(!w)throw new F(`Graph.${n}: could not find the "${s}" source node in the graph.`);if(!this._nodes.has(B))throw new F(`Graph.${n}: could not find the "${B}" target node in the graph.`);return Ve(!0,t,this.multi,r,w,B,C)}throw new G(`Graph.${n}: too many arguments (expecting 1, 2 or 3 and got ${arguments.length}).`)};let o="some"+A[0].toUpperCase()+A.slice(1,-1);i.prototype[o]=function(){let s=Array.prototype.slice.call(arguments),B=s.pop();return s.push((w,c,f,D,h,d,P)=>B(w,c,f,D,h,d,P)),!!this[n].apply(this,s)};let g="every"+A[0].toUpperCase()+A.slice(1,-1);i.prototype[g]=function(){let s=Array.prototype.slice.call(arguments),B=s.pop();return s.push((w,c,f,D,h,d,P)=>!B(w,c,f,D,h,d,P)),!this[n].apply(this,s)}}function sn(i,e){let{name:A,type:t,direction:r}=e,n=A.slice(0,-1)+"Entries";i.prototype[n]=function(o,g){if(t!=="mixed"&&this.type!=="mixed"&&t!==this.type)return zA();if(!arguments.length)return $r(this,t);if(arguments.length===1){o=""+o;let s=this._nodes.get(o);if(!s)throw new F(`Graph.${n}: could not find the "${o}" node in the graph.`);return en(t,r,s)}if(arguments.length===2){o=""+o,g=""+g;let s=this._nodes.get(o);if(!s)throw new F(`Graph.${n}: could not find the "${o}" source node in the graph.`);if(!this._nodes.has(g))throw new F(`Graph.${n}: could not find the "${g}" target node in the graph.`);return rn(t,r,s,g)}throw new G(`Graph.${n}: too many arguments (expecting 0, 1 or 2 and got ${arguments.length}).`)}}function an(i){Xr.forEach(e=>{nn(i,e),on(i,e),gn(i,e),sn(i,e)})}var Bn=[{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 Pe(){this.A=null,this.B=null}Pe.prototype.wrap=function(i){this.A===null?this.A=i:this.B===null&&(this.B=i)};Pe.prototype.has=function(i){return this.A!==null&&i in this.A||this.B!==null&&i in this.B};function ne(i,e,A,t,r){for(let n in t){let o=t[n],g=o.source,s=o.target,B=g===A?s:g;if(e&&e.has(B.key))continue;let C=r(B.key,B.attributes);if(i&&C)return B.key}}function We(i,e,A,t,r){if(e!=="mixed"){if(e==="undirected")return ne(i,null,t,t.undirected,r);if(typeof A=="string")return ne(i,null,t,t[A],r)}let n=new Pe,o;if(e!=="undirected"){if(A!=="out"){if(o=ne(i,null,t,t.in,r),i&&o)return o;n.wrap(t.in)}if(A!=="in"){if(o=ne(i,n,t,t.out,r),i&&o)return o;n.wrap(t.out)}}if(e!=="directed"&&(o=ne(i,n,t,t.undirected,r),i&&o))return o}function Cn(i,e,A){if(i!=="mixed"){if(i==="undirected")return Object.keys(A.undirected);if(typeof e=="string")return Object.keys(A[e])}let t=[];return We(!1,i,e,A,function(r){t.push(r)}),t}function oe(i,e,A){let t=Object.keys(A),r=t.length,n=0;return{[Symbol.iterator](){return this},next(){let o=null;do{if(n>=r)return i&&i.wrap(A),{done:!0};let g=A[t[n++]],s=g.source,B=g.target;if(o=s===e?B:s,i&&i.has(o.key)){o=null;continue}}while(o===null);return{done:!1,value:{neighbor:o.key,attributes:o.attributes}}}}}function wn(i,e,A){if(i!=="mixed"){if(i==="undirected")return oe(null,A,A.undirected);if(typeof e=="string")return oe(null,A,A[e])}let t=zA(),r=new Pe;return i!=="undirected"&&(e!=="out"&&(t=vA(t,oe(r,A,A.in))),e!=="in"&&(t=vA(t,oe(r,A,A.out)))),i!=="directed"&&(t=vA(t,oe(r,A,A.undirected))),t}function cn(i,e){let{name:A,type:t,direction:r}=e;i.prototype[A]=function(n){if(t!=="mixed"&&this.type!=="mixed"&&t!==this.type)return[];n=""+n;let o=this._nodes.get(n);if(typeof o>"u")throw new F(`Graph.${A}: could not find the "${n}" node in the graph.`);return Cn(t==="mixed"?this.type:t,r,o)}}function fn(i,e){let{name:A,type:t,direction:r}=e,n="forEach"+A[0].toUpperCase()+A.slice(1,-1);i.prototype[n]=function(B,C){if(t!=="mixed"&&this.type!=="mixed"&&t!==this.type)return;B=""+B;let w=this._nodes.get(B);if(typeof w>"u")throw new F(`Graph.${n}: could not find the "${B}" node in the graph.`);We(!1,t==="mixed"?this.type:t,r,w,C)};let o="map"+A[0].toUpperCase()+A.slice(1);i.prototype[o]=function(B,C){let w=[];return this[n](B,(c,f)=>{w.push(C(c,f))}),w};let g="filter"+A[0].toUpperCase()+A.slice(1);i.prototype[g]=function(B,C){let w=[];return this[n](B,(c,f)=>{C(c,f)&&w.push(c)}),w};let s="reduce"+A[0].toUpperCase()+A.slice(1);i.prototype[s]=function(B,C,w){if(arguments.length<3)throw new G(`Graph.${s}: 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 c=w;return this[n](B,(f,D)=>{c=C(c,f,D)}),c}}function hn(i,e){let{name:A,type:t,direction:r}=e,n=A[0].toUpperCase()+A.slice(1,-1),o="find"+n;i.prototype[o]=function(B,C){if(t!=="mixed"&&this.type!=="mixed"&&t!==this.type)return;B=""+B;let w=this._nodes.get(B);if(typeof w>"u")throw new F(`Graph.${o}: could not find the "${B}" node in the graph.`);return We(!0,t==="mixed"?this.type:t,r,w,C)};let g="some"+n;i.prototype[g]=function(B,C){return!!this[o](B,C)};let s="every"+n;i.prototype[s]=function(B,C){return!this[o](B,(c,f)=>!C(c,f))}}function Qn(i,e){let{name:A,type:t,direction:r}=e,n=A.slice(0,-1)+"Entries";i.prototype[n]=function(o){if(t!=="mixed"&&this.type!=="mixed"&&t!==this.type)return zA();o=""+o;let g=this._nodes.get(o);if(typeof g>"u")throw new F(`Graph.${n}: could not find the "${o}" node in the graph.`);return wn(t==="mixed"?this.type:t,r,g)}}function Dn(i){Bn.forEach(e=>{cn(i,e),fn(i,e),hn(i,e),Qn(i,e)})}function le(i,e,A,t,r){let n=t._nodes.values(),o=t.type,g,s,B,C,w,c,f;for(;g=n.next(),g.done!==!0;){let D=!1;if(s=g.value,o!=="undirected"){C=s.out;for(B in C){w=C[B];do{if(c=w.target,D=!0,f=r(s.key,c.key,s.attributes,c.attributes,w.key,w.attributes,w.undirected),i&&f)return w;w=w.next}while(w)}}if(o!=="directed"){C=s.undirected;for(B in C)if(!(e&&s.key>B)){w=C[B];do{if(c=w.target,c.key!==B&&(c=w.source),D=!0,f=r(s.key,c.key,s.attributes,c.attributes,w.key,w.attributes,w.undirected),i&&f)return w;w=w.next}while(w)}}if(A&&!D&&(f=r(s.key,null,s.attributes,null,null,null,null),i&&f))return null}}function un(i,e){let A={key:i};return kt(e.attributes)||(A.attributes=S({},e.attributes)),A}function dn(i,e,A){let t={key:e,source:A.source.key,target:A.target.key};return kt(A.attributes)||(t.attributes=S({},A.attributes)),i==="mixed"&&A.undirected&&(t.undirected=!0),t}function En(i){if(!q(i))throw new G('Graph.import: invalid serialized node. A serialized node should be a plain object with at least a "key" property.');if(!("key"in i))throw new G("Graph.import: serialized node is missing its key.");if("attributes"in i&&(!q(i.attributes)||i.attributes===null))throw new G("Graph.import: invalid attributes. Attributes should be a plain object, null or omitted.")}function ln(i){if(!q(i))throw new G('Graph.import: invalid serialized edge. A serialized edge should be a plain object with at least a "source" & "target" property.');if(!("source"in i))throw new G("Graph.import: serialized edge is missing its source.");if(!("target"in i))throw new G("Graph.import: serialized edge is missing its target.");if("attributes"in i&&(!q(i.attributes)||i.attributes===null))throw new G("Graph.import: invalid attributes. Attributes should be a plain object, null or omitted.");if("undirected"in i&&typeof i.undirected!="boolean")throw new G("Graph.import: invalid undirectedness information. Undirected should be boolean or omitted.")}var vn=Ir(),In=new Set(["directed","undirected","mixed"]),Ht=new Set(["domain","_events","_eventsCount","_maxListeners"]),Mn=[{name:i=>`${i}Edge`,generateKey:!0},{name:i=>`${i}DirectedEdge`,generateKey:!0,type:"directed"},{name:i=>`${i}UndirectedEdge`,generateKey:!0,type:"undirected"},{name:i=>`${i}EdgeWithKey`},{name:i=>`${i}DirectedEdgeWithKey`,type:"directed"},{name:i=>`${i}UndirectedEdgeWithKey`,type:"undirected"}],Fn={allowSelfLoops:!0,multi:!1,type:"mixed"};function Gn(i,e,A){if(A&&!q(A))throw new G(`Graph.addNode: invalid attributes. Expecting an object but got "${A}"`);if(e=""+e,A=A||{},i._nodes.has(e))throw new p(`Graph.addNode: the "${e}" node already exist in the graph.`);let t=new i.NodeDataClass(e,A);return i._nodes.set(e,t),i.emit("nodeAdded",{key:e,attributes:A}),t}function xt(i,e,A){let t=new i.NodeDataClass(e,A);return i._nodes.set(e,t),i.emit("nodeAdded",{key:e,attributes:A}),t}function St(i,e,A,t,r,n,o,g){if(!t&&i.type==="undirected")throw new p(`Graph.${e}: you cannot add a directed edge to an undirected graph. Use the #.addEdge or #.addUndirectedEdge instead.`);if(t&&i.type==="directed")throw new p(`Graph.${e}: you cannot add an undirected edge to a directed graph. Use the #.addEdge or #.addDirectedEdge instead.`);if(g&&!q(g))throw new G(`Graph.${e}: invalid attributes. Expecting an object but got "${g}"`);if(n=""+n,o=""+o,g=g||{},!i.allowSelfLoops&&n===o)throw new p(`Graph.${e}: source & target are the same ("${n}"), thus creating a loop explicitly forbidden by this graph 'allowSelfLoops' option set to false.`);let s=i._nodes.get(n),B=i._nodes.get(o);if(!s)throw new F(`Graph.${e}: source node "${n}" not found.`);if(!B)throw new F(`Graph.${e}: target node "${o}" not found.`);let C={key:null,undirected:t,source:n,target:o,attributes:g};if(A)r=i._edgeKeyGenerator();else if(r=""+r,i._edges.has(r))throw new p(`Graph.${e}: the "${r}" edge already exists in the graph.`);if(!i.multi&&(t?typeof s.undirected[o]<"u":typeof s.out[o]<"u"))throw new p(`Graph.${e}: an edge linking "${n}" 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 w=new XA(t,r,s,B,g);i._edges.set(r,w);let c=n===o;return t?(s.undirectedDegree++,B.undirectedDegree++,c&&(s.undirectedLoops++,i._undirectedSelfLoopCount++)):(s.outDegree++,B.inDegree++,c&&(s.directedLoops++,i._directedSelfLoopCount++)),i.multi?w.attachMulti():w.attach(),t?i._undirectedSize++:i._directedSize++,C.key=r,i.emit("edgeAdded",C),r}function Pn(i,e,A,t,r,n,o,g,s){if(!t&&i.type==="undirected")throw new p(`Graph.${e}: you cannot merge/update a directed edge to an undirected graph. Use the #.mergeEdge/#.updateEdge or #.addUndirectedEdge instead.`);if(t&&i.type==="directed")throw new p(`Graph.${e}: you cannot merge/update an undirected edge to a directed graph. Use the #.mergeEdge/#.updateEdge or #.addDirectedEdge instead.`);if(g){if(s){if(typeof g!="function")throw new G(`Graph.${e}: invalid updater function. Expecting a function but got "${g}"`)}else if(!q(g))throw new G(`Graph.${e}: invalid attributes. Expecting an object but got "${g}"`)}n=""+n,o=""+o;let B;if(s&&(B=g,g=void 0),!i.allowSelfLoops&&n===o)throw new p(`Graph.${e}: source & target are the same ("${n}"), thus creating a loop explicitly forbidden by this graph 'allowSelfLoops' option set to false.`);let C=i._nodes.get(n),w=i._nodes.get(o),c,f;if(!A&&(c=i._edges.get(r),c)){if((c.source.key!==n||c.target.key!==o)&&(!t||c.source.key!==o||c.target.key!==n))throw new p(`Graph.${e}: inconsistency detected when attempting to merge the "${r}" edge with "${n}" source & "${o}" target vs. ("${c.source.key}", "${c.target.key}").`);f=c}if(!f&&!i.multi&&C&&(f=t?C.undirected[o]:C.out[o]),f){let v=[f.key,!1,!1,!1];if(s?!B:!g)return v;if(s){let E=f.attributes;f.attributes=B(E),i.emit("edgeAttributesUpdated",{type:"replace",key:f.key,attributes:f.attributes})}else S(f.attributes,g),i.emit("edgeAttributesUpdated",{type:"merge",key:f.key,attributes:f.attributes,data:g});return v}g=g||{},s&&B&&(g=B(g));let D={key:null,undirected:t,source:n,target:o,attributes:g};if(A)r=i._edgeKeyGenerator();else if(r=""+r,i._edges.has(r))throw new p(`Graph.${e}: the "${r}" edge already exists in the graph.`);let h=!1,d=!1;C||(C=xt(i,n,{}),h=!0,n===o&&(w=C,d=!0)),w||(w=xt(i,o,{}),d=!0),c=new XA(t,r,C,w,g),i._edges.set(r,c);let P=n===o;return t?(C.undirectedDegree++,w.undirectedDegree++,P&&(C.undirectedLoops++,i._undirectedSelfLoopCount++)):(C.outDegree++,w.inDegree++,P&&(C.directedLoops++,i._directedSelfLoopCount++)),i.multi?c.attachMulti():c.attach(),t?i._undirectedSize++:i._directedSize++,D.key=r,i.emit("edgeAdded",D),[r,!0,h,d]}function SA(i,e){i._edges.delete(e.key);let{source:A,target:t,attributes:r}=e,n=e.undirected,o=A===t;n?(A.undirectedDegree--,t.undirectedDegree--,o&&(A.undirectedLoops--,i._undirectedSelfLoopCount--)):(A.outDegree--,t.inDegree--,o&&(A.directedLoops--,i._directedSelfLoopCount--)),i.multi?e.detachMulti():e.detach(),n?i._undirectedSize--:i._directedSize--,i.emit("edgeDropped",{key:e.key,attributes:r,source:A.key,target:t.key,undirected:n})}var k=class i extends Kt.EventEmitter{constructor(e){if(super(),e=S({},Fn,e),typeof e.multi!="boolean")throw new G(`Graph.constructor: invalid 'multi' option. Expecting a boolean but got "${e.multi}".`);if(!In.has(e.type))throw new G(`Graph.constructor: invalid 'type' option. Should be one of "mixed", "directed" or "undirected" but got "${e.type}".`);if(typeof e.allowSelfLoops!="boolean")throw new G(`Graph.constructor: invalid 'allowSelfLoops' option. Expecting a boolean but got "${e.allowSelfLoops}".`);let A=e.type==="mixed"?Jt:e.type==="directed"?Nt:Ut;aA(this,"NodeDataClass",A);let t="geid_"+vn()+"_",r=0,n=()=>{let o;do o=t+r++;while(this._edges.has(o));return o};aA(this,"_attributes",{}),aA(this,"_nodes",new Map),aA(this,"_edges",new Map),aA(this,"_directedSize",0),aA(this,"_undirectedSize",0),aA(this,"_directedSelfLoopCount",0),aA(this,"_undirectedSelfLoopCount",0),aA(this,"_edgeKeyGenerator",n),aA(this,"_options",e),Ht.forEach(o=>aA(this,o,this[o])),QA(this,"order",()=>this._nodes.size),QA(this,"size",()=>this._edges.size),QA(this,"directedSize",()=>this._directedSize),QA(this,"undirectedSize",()=>this._undirectedSize),QA(this,"selfLoopCount",()=>this._directedSelfLoopCount+this._undirectedSelfLoopCount),QA(this,"directedSelfLoopCount",()=>this._directedSelfLoopCount),QA(this,"undirectedSelfLoopCount",()=>this._undirectedSelfLoopCount),QA(this,"multi",this._options.multi),QA(this,"type",this._options.type),QA(this,"allowSelfLoops",this._options.allowSelfLoops),QA(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,A){if(this.type==="undirected")return!1;if(arguments.length===1){let t=""+e,r=this._edges.get(t);return!!r&&!r.undirected}else if(arguments.length===2){e=""+e,A=""+A;let t=this._nodes.get(e);return t?t.out.hasOwnProperty(A):!1}throw new G(`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,A){if(this.type==="directed")return!1;if(arguments.length===1){let t=""+e,r=this._edges.get(t);return!!r&&r.undirected}else if(arguments.length===2){e=""+e,A=""+A;let t=this._nodes.get(e);return t?t.undirected.hasOwnProperty(A):!1}throw new G(`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,A){if(arguments.length===1){let t=""+e;return this._edges.has(t)}else if(arguments.length===2){e=""+e,A=""+A;let t=this._nodes.get(e);return t?typeof t.out<"u"&&t.out.hasOwnProperty(A)||typeof t.undirected<"u"&&t.undirected.hasOwnProperty(A):!1}throw new G(`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,A){if(this.type==="undirected")return;if(e=""+e,A=""+A,this.multi)throw new p("Graph.directedEdge: this method is irrelevant with multigraphs since there might be multiple edges between source & target. See #.directedEdges instead.");let t=this._nodes.get(e);if(!t)throw new F(`Graph.directedEdge: could not find the "${e}" source node in the graph.`);if(!this._nodes.has(A))throw new F(`Graph.directedEdge: could not find the "${A}" target node in the graph.`);let r=t.out&&t.out[A]||void 0;if(r)return r.key}undirectedEdge(e,A){if(this.type==="directed")return;if(e=""+e,A=""+A,this.multi)throw new p("Graph.undirectedEdge: this method is irrelevant with multigraphs since there might be multiple edges between source & target. See #.undirectedEdges instead.");let t=this._nodes.get(e);if(!t)throw new F(`Graph.undirectedEdge: could not find the "${e}" source node in the graph.`);if(!this._nodes.has(A))throw new F(`Graph.undirectedEdge: could not find the "${A}" target node in the graph.`);let r=t.undirected&&t.undirected[A]||void 0;if(r)return r.key}edge(e,A){if(this.multi)throw new p("Graph.edge: this method is irrelevant with multigraphs since there might be multiple edges between source & target. See #.edges instead.");e=""+e,A=""+A;let t=this._nodes.get(e);if(!t)throw new F(`Graph.edge: could not find the "${e}" source node in the graph.`);if(!this._nodes.has(A))throw new F(`Graph.edge: could not find the "${A}" target node in the graph.`);let r=t.out&&t.out[A]||t.undirected&&t.undirected[A]||void 0;if(r)return r.key}areDirectedNeighbors(e,A){e=""+e,A=""+A;let t=this._nodes.get(e);if(!t)throw new F(`Graph.areDirectedNeighbors: could not find the "${e}" node in the graph.`);return this.type==="undirected"?!1:A in t.in||A in t.out}areOutNeighbors(e,A){e=""+e,A=""+A;let t=this._nodes.get(e);if(!t)throw new F(`Graph.areOutNeighbors: could not find the "${e}" node in the graph.`);return this.type==="undirected"?!1:A in t.out}areInNeighbors(e,A){e=""+e,A=""+A;let t=this._nodes.get(e);if(!t)throw new F(`Graph.areInNeighbors: could not find the "${e}" node in the graph.`);return this.type==="undirected"?!1:A in t.in}areUndirectedNeighbors(e,A){e=""+e,A=""+A;let t=this._nodes.get(e);if(!t)throw new F(`Graph.areUndirectedNeighbors: could not find the "${e}" node in the graph.`);return this.type==="directed"?!1:A in t.undirected}areNeighbors(e,A){e=""+e,A=""+A;let t=this._nodes.get(e);if(!t)throw new F(`Graph.areNeighbors: could not find the "${e}" node in the graph.`);return this.type!=="undirected"&&(A in t.in||A in t.out)||this.type!=="directed"&&A in t.undirected}areInboundNeighbors(e,A){e=""+e,A=""+A;let t=this._nodes.get(e);if(!t)throw new F(`Graph.areInboundNeighbors: could not find the "${e}" node in the graph.`);return this.type!=="undirected"&&A in t.in||this.type!=="directed"&&A in t.undirected}areOutboundNeighbors(e,A){e=""+e,A=""+A;let t=this._nodes.get(e);if(!t)throw new F(`Graph.areOutboundNeighbors: could not find the "${e}" node in the graph.`);return this.type!=="undirected"&&A in t.out||this.type!=="directed"&&A in t.undirected}inDegree(e){e=""+e;let A=this._nodes.get(e);if(!A)throw new F(`Graph.inDegree: could not find the "${e}" node in the graph.`);return this.type==="undirected"?0:A.inDegree}outDegree(e){e=""+e;let A=this._nodes.get(e);if(!A)throw new F(`Graph.outDegree: could not find the "${e}" node in the graph.`);return this.type==="undirected"?0:A.outDegree}directedDegree(e){e=""+e;let A=this._nodes.get(e);if(!A)throw new F(`Graph.directedDegree: could not find the "${e}" node in the graph.`);return this.type==="undirected"?0:A.inDegree+A.outDegree}undirectedDegree(e){e=""+e;let A=this._nodes.get(e);if(!A)throw new F(`Graph.undirectedDegree: could not find the "${e}" node in the graph.`);return this.type==="directed"?0:A.undirectedDegree}inboundDegree(e){e=""+e;let A=this._nodes.get(e);if(!A)throw new F(`Graph.inboundDegree: could not find the "${e}" node in the graph.`);let t=0;return this.type!=="directed"&&(t+=A.undirectedDegree),this.type!=="undirected"&&(t+=A.inDegree),t}outboundDegree(e){e=""+e;let A=this._nodes.get(e);if(!A)throw new F(`Graph.outboundDegree: could not find the "${e}" node in the graph.`);let t=0;return this.type!=="directed"&&(t+=A.undirectedDegree),this.type!=="undirected"&&(t+=A.outDegree),t}degree(e){e=""+e;let A=this._nodes.get(e);if(!A)throw new F(`Graph.degree: could not find the "${e}" node in the graph.`);let t=0;return this.type!=="directed"&&(t+=A.undirectedDegree),this.type!=="undirected"&&(t+=A.inDegree+A.outDegree),t}inDegreeWithoutSelfLoops(e){e=""+e;let A=this._nodes.get(e);if(!A)throw new F(`Graph.inDegreeWithoutSelfLoops: could not find the "${e}" node in the graph.`);return this.type==="undirected"?0:A.inDegree-A.directedLoops}outDegreeWithoutSelfLoops(e){e=""+e;let A=this._nodes.get(e);if(!A)throw new F(`Graph.outDegreeWithoutSelfLoops: could not find the "${e}" node in the graph.`);return this.type==="undirected"?0:A.outDegree-A.directedLoops}directedDegreeWithoutSelfLoops(e){e=""+e;let A=this._nodes.get(e);if(!A)throw new F(`Graph.directedDegreeWithoutSelfLoops: could not find the "${e}" node in the graph.`);return this.type==="undirected"?0:A.inDegree+A.outDegree-A.directedLoops*2}undirectedDegreeWithoutSelfLoops(e){e=""+e;let A=this._nodes.get(e);if(!A)throw new F(`Graph.undirectedDegreeWithoutSelfLoops: could not find the "${e}" node in the graph.`);return this.type==="directed"?0:A.undirectedDegree-A.undirectedLoops*2}inboundDegreeWithoutSelfLoops(e){e=""+e;let A=this._nodes.get(e);if(!A)throw new F(`Graph.inboundDegreeWithoutSelfLoops: could not find the "${e}" node in the graph.`);let t=0,r=0;return this.type!=="directed"&&(t+=A.undirectedDegree,r+=A.undirectedLoops*2),this.type!=="undirected"&&(t+=A.inDegree,r+=A.directedLoops),t-r}outboundDegreeWithoutSelfLoops(e){e=""+e;let A=this._nodes.get(e);if(!A)throw new F(`Graph.outboundDegreeWithoutSelfLoops: could not find the "${e}" node in the graph.`);let t=0,r=0;return this.type!=="directed"&&(t+=A.undirectedDegree,r+=A.undirectedLoops*2),this.type!=="undirected"&&(t+=A.outDegree,r+=A.directedLoops),t-r}degreeWithoutSelfLoops(e){e=""+e;let A=this._nodes.get(e);if(!A)throw new F(`Graph.degreeWithoutSelfLoops: could not find the "${e}" node in the graph.`);let t=0,r=0;return this.type!=="directed"&&(t+=A.undirectedDegree,r+=A.undirectedLoops*2),this.type!=="undirected"&&(t+=A.inDegree+A.outDegree,r+=A.directedLoops*2),t-r}source(e){e=""+e;let A=this._edges.get(e);if(!A)throw new F(`Graph.source: could not find the "${e}" edge in the graph.`);return A.source.key}target(e){e=""+e;let A=this._edges.get(e);if(!A)throw new F(`Graph.target: could not find the "${e}" edge in the graph.`);return A.target.key}extremities(e){e=""+e;let A=this._edges.get(e);if(!A)throw new F(`Graph.extremities: could not find the "${e}" edge in the graph.`);return[A.source.key,A.target.key]}opposite(e,A){e=""+e,A=""+A;let t=this._edges.get(A);if(!t)throw new F(`Graph.opposite: could not find the "${A}" edge in the graph.`);let r=t.source.key,n=t.target.key;if(e===r)return n;if(e===n)return r;throw new F(`Graph.opposite: the "${e}" node is not attached to the "${A}" edge (${r}, ${n}).`)}hasExtremity(e,A){e=""+e,A=""+A;let t=this._edges.get(e);if(!t)throw new F(`Graph.hasExtremity: could not find the "${e}" edge in the graph.`);return t.source.key===A||t.target.key===A}isUndirected(e){e=""+e;let A=this._edges.get(e);if(!A)throw new F(`Graph.isUndirected: could not find the "${e}" edge in the graph.`);return A.undirected}isDirected(e){e=""+e;let A=this._edges.get(e);if(!A)throw new F(`Graph.isDirected: could not find the "${e}" edge in the graph.`);return!A.undirected}isSelfLoop(e){e=""+e;let A=this._edges.get(e);if(!A)throw new F(`Graph.isSelfLoop: could not find the "${e}" edge in the graph.`);return A.source===A.target}addNode(e,A){return Gn(this,e,A).key}mergeNode(e,A){if(A&&!q(A))throw new G(`Graph.mergeNode: invalid attributes. Expecting an object but got "${A}"`);e=""+e,A=A||{};let t=this._nodes.get(e);return t?(A&&(S(t.attributes,A),this.emit("nodeAttributesUpdated",{type:"merge",key:e,attributes:t.attributes,data:A})),[e,!1]):(t=new this.NodeDataClass(e,A),this._nodes.set(e,t),this.emit("nodeAdded",{key:e,attributes:A}),[e,!0])}updateNode(e,A){if(A&&typeof A!="function")throw new G(`Graph.updateNode: invalid updater function. Expecting a function but got "${A}"`);e=""+e;let t=this._nodes.get(e);if(t){if(A){let n=t.attributes;t.attributes=A(n),this.emit("nodeAttributesUpdated",{type:"replace",key:e,attributes:t.attributes})}return[e,!1]}let r=A?A({}):{};return t=new this.NodeDataClass(e,r),this._nodes.set(e,t),this.emit("nodeAdded",{key:e,attributes:r}),[e,!0]}dropNode(e){e=""+e;let A=this._nodes.get(e);if(!A)throw new F(`Graph.dropNode: could not find the "${e}" node in the graph.`);let t;if(this.type!=="undirected"){for(let r in A.out){t=A.out[r];do SA(this,t),t=t.next;while(t)}for(let r in A.in){t=A.in[r];do SA(this,t),t=t.next;while(t)}}if(this.type!=="directed")for(let r in A.undirected){t=A.undirected[r];do SA(this,t),t=t.next;while(t)}this._nodes.delete(e),this.emit("nodeDropped",{key:e,attributes:A.attributes})}dropEdge(e){let A;if(arguments.length>1){let t=""+arguments[0],r=""+arguments[1];if(A=BA(this,t,r,this.type),!A)throw new F(`Graph.dropEdge: could not find the "${t}" -> "${r}" edge in the graph.`)}else if(e=""+e,A=this._edges.get(e),!A)throw new F(`Graph.dropEdge: could not find the "${e}" edge in the graph.`);return SA(this,A),this}dropDirectedEdge(e,A){if(arguments.length<2)throw new p("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 p("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,A=""+A;let t=BA(this,e,A,"directed");if(!t)throw new F(`Graph.dropDirectedEdge: could not find a "${e}" -> "${A}" edge in the graph.`);return SA(this,t),this}dropUndirectedEdge(e,A){if(arguments.length<2)throw new p("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 p("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 t=BA(this,e,A,"undirected");if(!t)throw new F(`Graph.dropUndirectedEdge: could not find a "${e}" -> "${A}" edge in the graph.`);return SA(this,t),this}clear(){this._edges.clear(),this._nodes.clear(),this._resetInstanceCounters(),this.emit("cleared")}clearEdges(){let e=this._nodes.values(),A;for(;A=e.next(),A.done!==!0;)A.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,A){return this._attributes[e]=A,this.emit("attributesUpdated",{type:"set",attributes:this._attributes,name:e}),this}updateAttribute(e,A){if(typeof A!="function")throw new G("Graph.updateAttribute: updater should be a function.");let t=this._attributes[e];return this._attributes[e]=A(t),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(!q(e))throw new G("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(!q(e))throw new G("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 G("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,A){if(typeof e!="function")throw new G("Graph.updateEachNodeAttributes: expecting an updater function.");if(A&&!bt(A))throw new G("Graph.updateEachNodeAttributes: invalid hints. Expecting an object having the following shape: {attributes?: [string]}");let t=this._nodes.values(),r,n;for(;r=t.next(),r.done!==!0;)n=r.value,n.attributes=e(n.key,n.attributes);this.emit("eachNodeAttributesUpdated",{hints:A||null})}updateEachEdgeAttributes(e,A){if(typeof e!="function")throw new G("Graph.updateEachEdgeAttributes: expecting an updater function.");if(A&&!bt(A))throw new G("Graph.updateEachEdgeAttributes: invalid hints. Expecting an object having the following shape: {attributes?: [string]}");let t=this._edges.values(),r,n,o,g;for(;r=t.next(),r.done!==!0;)n=r.value,o=n.source,g=n.target,n.attributes=e(n.key,n.attributes,o.key,g.key,o.attributes,g.attributes,n.undirected);this.emit("eachEdgeAttributesUpdated",{hints:A||null})}forEachAdjacencyEntry(e){if(typeof e!="function")throw new G("Graph.forEachAdjacencyEntry: expecting a callback.");le(!1,!1,!1,this,e)}forEachAdjacencyEntryWithOrphans(e){if(typeof e!="function")throw new G("Graph.forEachAdjacencyEntryWithOrphans: expecting a callback.");le(!1,!1,!0,this,e)}forEachAssymetricAdjacencyEntry(e){if(typeof e!="function")throw new G("Graph.forEachAssymetricAdjacencyEntry: expecting a callback.");le(!1,!0,!1,this,e)}forEachAssymetricAdjacencyEntryWithOrphans(e){if(typeof e!="function")throw new G("Graph.forEachAssymetricAdjacencyEntryWithOrphans: expecting a callback.");le(!1,!0,!0,this,e)}nodes(){return Array.from(this._nodes.keys())}forEachNode(e){if(typeof e!="function")throw new G("Graph.forEachNode: expecting a callback.");let A=this._nodes.values(),t,r;for(;t=A.next(),t.done!==!0;)r=t.value,e(r.key,r.attributes)}findNode(e){if(typeof e!="function")throw new G("Graph.findNode: expecting a callback.");let A=this._nodes.values(),t,r;for(;t=A.next(),t.done!==!0;)if(r=t.value,e(r.key,r.attributes))return r.key}mapNodes(e){if(typeof e!="function")throw new G("Graph.mapNode: expecting a callback.");let A=this._nodes.values(),t,r,n=new Array(this.order),o=0;for(;t=A.next(),t.done!==!0;)r=t.value,n[o++]=e(r.key,r.attributes);return n}someNode(e){if(typeof e!="function")throw new G("Graph.someNode: expecting a callback.");let A=this._nodes.values(),t,r;for(;t=A.next(),t.done!==!0;)if(r=t.value,e(r.key,r.attributes))return!0;return!1}everyNode(e){if(typeof e!="function")throw new G("Graph.everyNode: expecting a callback.");let A=this._nodes.values(),t,r;for(;t=A.next(),t.done!==!0;)if(r=t.value,!e(r.key,r.attributes))return!1;return!0}filterNodes(e){if(typeof e!="function")throw new G("Graph.filterNodes: expecting a callback.");let A=this._nodes.values(),t,r,n=[];for(;t=A.next(),t.done!==!0;)r=t.value,e(r.key,r.attributes)&&n.push(r.key);return n}reduceNodes(e,A){if(typeof e!="function")throw new G("Graph.reduceNodes: expecting a callback.");if(arguments.length<2)throw new G("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 t=A,r=this._nodes.values(),n,o;for(;n=r.next(),n.done!==!0;)o=n.value,t=e(t,o.key,o.attributes);return t}nodeEntries(){let e=this._nodes.values();return{[Symbol.iterator](){return this},next(){let A=e.next();if(A.done)return A;let t=A.value;return{value:{node:t.key,attributes:t.attributes},done:!1}}}}export(){let e=new Array(this._nodes.size),A=0;this._nodes.forEach((r,n)=>{e[A++]=un(n,r)});let t=new Array(this._edges.size);return A=0,this._edges.forEach((r,n)=>{t[A++]=dn(this.type,n,r)}),{options:{type:this.type,multi:this.multi,allowSelfLoops:this.allowSelfLoops},attributes:this.getAttributes(),nodes:e,edges:t}}import(e,A=!1){if(e instanceof i)return e.forEachNode((s,B)=>{A?this.mergeNode(s,B):this.addNode(s,B)}),e.forEachEdge((s,B,C,w,c,f,D)=>{A?D?this.mergeUndirectedEdgeWithKey(s,C,w,B):this.mergeDirectedEdgeWithKey(s,C,w,B):D?this.addUndirectedEdgeWithKey(s,C,w,B):this.addDirectedEdgeWithKey(s,C,w,B)}),this;if(!q(e))throw new G("Graph.import: invalid argument. Expecting a serialized graph or, alternatively, a Graph instance.");if(e.attributes){if(!q(e.attributes))throw new G("Graph.import: invalid attributes. Expecting a plain object.");A?this.mergeAttributes(e.attributes):this.replaceAttributes(e.attributes)}let t,r,n,o,g;if(e.nodes){if(n=e.nodes,!Array.isArray(n))throw new G("Graph.import: invalid nodes. Expecting an array.");for(t=0,r=n.length;t<r;t++){o=n[t],En(o);let{key:s,attributes:B}=o;A?this.mergeNode(s,B):this.addNode(s,B)}}if(e.edges){let s=!1;if(this.type==="undirected"&&(s=!0),n=e.edges,!Array.isArray(n))throw new G("Graph.import: invalid edges. Expecting an array.");for(t=0,r=n.length;t<r;t++){g=n[t],ln(g);let{source:B,target:C,attributes:w,undirected:c=s}=g,f;"key"in g?(f=A?c?this.mergeUndirectedEdgeWithKey:this.mergeDirectedEdgeWithKey:c?this.addUndirectedEdgeWithKey:this.addDirectedEdgeWithKey,f.call(this,g.key,B,C,w)):(f=A?c?this.mergeUndirectedEdge:this.mergeDirectedEdge:c?this.addUndirectedEdge:this.addDirectedEdge,f.call(this,B,C,w))}}return this}nullCopy(e){let A=new i(S({},this._options,e));return A.replaceAttributes(S({},this.getAttributes())),A}emptyCopy(e){let A=this.nullCopy(e);return this._nodes.forEach((t,r)=>{let n=S({},t.attributes);t=new A.NodeDataClass(r,n),A._nodes.set(r,t)}),A}copy(e){if(e=e||{},typeof e.type=="string"&&e.type!==this.type&&e.type!=="mixed")throw new p(`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 p("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 p("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 A=this.emptyCopy(e),t=this._edges.values(),r,n;for(;r=t.next(),r.done!==!0;)n=r.value,St(A,"copy",!1,n.undirected,n.key,n.source.key,n.target.key,S({},n.attributes));return A}toJSON(){return this.export()}toString(){return"[object Graph]"}inspect(){let e={};this._nodes.forEach((n,o)=>{e[o]=n.attributes});let A={},t={};this._edges.forEach((n,o)=>{let g=n.undirected?"--":"->",s="",B=n.source.key,C=n.target.key,w;n.undirected&&B>C&&(w=B,B=C,C=w);let c=`(${B})${g}(${C})`;o.startsWith("geid_")?this.multi&&(typeof t[c]>"u"?t[c]=0:t[c]++,s+=`${t[c]}. `):s+=`[${o}]: `,s+=c,A[s]=n.attributes});let r={};for(let n in this)this.hasOwnProperty(n)&&!Ht.has(n)&&typeof this[n]!="function"&&typeof n!="symbol"&&(r[n]=this[n]);return r.attributes=this._attributes,r.nodes=e,r.edges=A,aA(r,"constructor",this.constructor),r}};typeof Symbol<"u"&&(k.prototype[Symbol.for("nodejs.util.inspect.custom")]=k.prototype.inspect);Mn.forEach(i=>{["add","merge","update"].forEach(e=>{let A=i.name(e),t=e==="add"?St:Pn;i.generateKey?k.prototype[A]=function(r,n,o){return t(this,A,!0,(i.type||this.type)==="undirected",null,r,n,o,e==="update")}:k.prototype[A]=function(r,n,o,g){return t(this,A,!1,(i.type||this.type)==="undirected",r,n,o,g,e==="update")}})});xr(k);zr(k);an(k);Dn(k);var ve=class extends k{constructor(e){let A=S({type:"directed"},e);if("multi"in A&&A.multi!==!1)throw new G("DirectedGraph.from: inconsistent indication that the graph should be multi in given options!");if(A.type!=="directed")throw new G('DirectedGraph.from: inconsistent "'+A.type+'" type in given options!');super(A)}},Ie=class extends k{constructor(e){let A=S({type:"undirected"},e);if("multi"in A&&A.multi!==!1)throw new G("UndirectedGraph.from: inconsistent indication that the graph should be multi in given options!");if(A.type!=="undirected")throw new G('UndirectedGraph.from: inconsistent "'+A.type+'" type in given options!');super(A)}},Me=class extends k{constructor(e){let A=S({multi:!0},e);if("multi"in A&&A.multi!==!0)throw new G("MultiGraph.from: inconsistent indication that the graph should be simple in given options!");super(A)}},Fe=class extends k{constructor(e){let A=S({type:"directed",multi:!0},e);if("multi"in A&&A.multi!==!0)throw new G("MultiDirectedGraph.from: inconsistent indication that the graph should be simple in given options!");if(A.type!=="directed")throw new G('MultiDirectedGraph.from: inconsistent "'+A.type+'" type in given options!');super(A)}},Ge=class extends k{constructor(e){let A=S({type:"undirected",multi:!0},e);if("multi"in A&&A.multi!==!0)throw new G("MultiUndirectedGraph.from: inconsistent indication that the graph should be simple in given options!");if(A.type!=="undirected")throw new G('MultiUndirectedGraph.from: inconsistent "'+A.type+'" type in given options!');super(A)}};function VA(i){i.from=function(e,A){let t=S({},e.options,A),r=new i(t);return r.import(e),r}}VA(k);VA(ve);VA(Ie);VA(Me);VA(Fe);VA(Ge);k.Graph=k;k.DirectedGraph=ve;k.UndirectedGraph=Ie;k.MultiGraph=Me;k.MultiDirectedGraph=Fe;k.MultiUndirectedGraph=Ge;k.InvalidArgumentsGraphError=G;k.NotFoundGraphError=F;k.UsageGraphError=p;function mn(i,e){if(typeof i!="object"||!i)return i;var A=i[Symbol.toPrimitive];if(A!==void 0){var t=A.call(i,e||"default");if(typeof t!="object")return t;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(i)}function JA(i){var e=mn(i,"string");return typeof e=="symbol"?e:e+""}function z(i,e){if(!(i instanceof e))throw new TypeError("Cannot call a class as a function")}function zt(i,e){for(var A=0;A<e.length;A++){var t=e[A];t.enumerable=t.enumerable||!1,t.configurable=!0,"value"in t&&(t.writable=!0),Object.defineProperty(i,JA(t.key),t)}}function X(i,e,A){return e&&zt(i.prototype,e),A&&zt(i,A),Object.defineProperty(i,"prototype",{writable:!1}),i}function kA(i){return kA=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},kA(i)}function Xt(){try{var i=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch{}return(Xt=function(){return!!i})()}function Yn(i){if(i===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return i}function yn(i,e){if(e&&(typeof e=="object"||typeof e=="function"))return e;if(e!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return Yn(i)}function AA(i,e,A){return e=kA(e),yn(i,Xt()?Reflect.construct(e,A||[],kA(i).constructor):e.apply(i,A))}function qe(i,e){return qe=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(A,t){return A.__proto__=t,A},qe(i,e)}function eA(i,e){if(typeof e!="function"&&e!==null)throw new TypeError("Super expression must either be null or a function");i.prototype=Object.create(e&&e.prototype,{constructor:{value:i,writable:!0,configurable:!0}}),Object.defineProperty(i,"prototype",{writable:!1}),e&&qe(i,e)}function pn(i){if(Array.isArray(i))return i}function Ln(i,e){var A=i==null?null:typeof Symbol<"u"&&i[Symbol.iterator]||i["@@iterator"];if(A!=null){var t,r,n,o,g=[],s=!0,B=!1;try{if(n=(A=A.call(i)).next,e===0){if(Object(A)!==A)return;s=!1}else for(;!(s=(t=n.call(A)).done)&&(g.push(t.value),g.length!==e);s=!0);}catch(C){B=!0,r=C}finally{try{if(!s&&A.return!=null&&(o=A.return(),Object(o)!==o))return}finally{if(B)throw r}}return g}}function me(i,e){(e==null||e>i.length)&&(e=i.length);for(var A=0,t=Array(e);A<e;A++)t[A]=i[A];return t}function At(i,e){if(i){if(typeof i=="string")return me(i,e);var A={}.toString.call(i).slice(8,-1);return A==="Object"&&i.constructor&&(A=i.constructor.name),A==="Map"||A==="Set"?Array.from(i):A==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(A)?me(i,e):void 0}}function bn(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
|
|
2
2
|
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function YA(i,e){return pn(i)||Ln(i,e)||At(i,e)||bn()}var Ze={black:"#000000",silver:"#C0C0C0",gray:"#808080",grey:"#808080",white:"#FFFFFF",maroon:"#800000",red:"#FF0000",purple:"#800080",fuchsia:"#FF00FF",green:"#008000",lime:"#00FF00",olive:"#808000",yellow:"#FFFF00",navy:"#000080",blue:"#0000FF",teal:"#008080",aqua:"#00FFFF",darkblue:"#00008B",mediumblue:"#0000CD",darkgreen:"#006400",darkcyan:"#008B8B",deepskyblue:"#00BFFF",darkturquoise:"#00CED1",mediumspringgreen:"#00FA9A",springgreen:"#00FF7F",cyan:"#00FFFF",midnightblue:"#191970",dodgerblue:"#1E90FF",lightseagreen:"#20B2AA",forestgreen:"#228B22",seagreen:"#2E8B57",darkslategray:"#2F4F4F",darkslategrey:"#2F4F4F",limegreen:"#32CD32",mediumseagreen:"#3CB371",turquoise:"#40E0D0",royalblue:"#4169E1",steelblue:"#4682B4",darkslateblue:"#483D8B",mediumturquoise:"#48D1CC",indigo:"#4B0082",darkolivegreen:"#556B2F",cadetblue:"#5F9EA0",cornflowerblue:"#6495ED",rebeccapurple:"#663399",mediumaquamarine:"#66CDAA",dimgray:"#696969",dimgrey:"#696969",slateblue:"#6A5ACD",olivedrab:"#6B8E23",slategray:"#708090",slategrey:"#708090",lightslategray:"#778899",lightslategrey:"#778899",mediumslateblue:"#7B68EE",lawngreen:"#7CFC00",chartreuse:"#7FFF00",aquamarine:"#7FFFD4",skyblue:"#87CEEB",lightskyblue:"#87CEFA",blueviolet:"#8A2BE2",darkred:"#8B0000",darkmagenta:"#8B008B",saddlebrown:"#8B4513",darkseagreen:"#8FBC8F",lightgreen:"#90EE90",mediumpurple:"#9370DB",darkviolet:"#9400D3",palegreen:"#98FB98",darkorchid:"#9932CC",yellowgreen:"#9ACD32",sienna:"#A0522D",brown:"#A52A2A",darkgray:"#A9A9A9",darkgrey:"#A9A9A9",lightblue:"#ADD8E6",greenyellow:"#ADFF2F",paleturquoise:"#AFEEEE",lightsteelblue:"#B0C4DE",powderblue:"#B0E0E6",firebrick:"#B22222",darkgoldenrod:"#B8860B",mediumorchid:"#BA55D3",rosybrown:"#BC8F8F",darkkhaki:"#BDB76B",mediumvioletred:"#C71585",indianred:"#CD5C5C",peru:"#CD853F",chocolate:"#D2691E",tan:"#D2B48C",lightgray:"#D3D3D3",lightgrey:"#D3D3D3",thistle:"#D8BFD8",orchid:"#DA70D6",goldenrod:"#DAA520",palevioletred:"#DB7093",crimson:"#DC143C",gainsboro:"#DCDCDC",plum:"#DDA0DD",burlywood:"#DEB887",lightcyan:"#E0FFFF",lavender:"#E6E6FA",darksalmon:"#E9967A",violet:"#EE82EE",palegoldenrod:"#EEE8AA",lightcoral:"#F08080",khaki:"#F0E68C",aliceblue:"#F0F8FF",honeydew:"#F0FFF0",azure:"#F0FFFF",sandybrown:"#F4A460",wheat:"#F5DEB3",beige:"#F5F5DC",whitesmoke:"#F5F5F5",mintcream:"#F5FFFA",ghostwhite:"#F8F8FF",salmon:"#FA8072",antiquewhite:"#FAEBD7",linen:"#FAF0E6",lightgoldenrodyellow:"#FAFAD2",oldlace:"#FDF5E6",magenta:"#FF00FF",deeppink:"#FF1493",orangered:"#FF4500",tomato:"#FF6347",hotpink:"#FF69B4",coral:"#FF7F50",darkorange:"#FF8C00",lightsalmon:"#FFA07A",orange:"#FFA500",lightpink:"#FFB6C1",pink:"#FFC0CB",gold:"#FFD700",peachpuff:"#FFDAB9",navajowhite:"#FFDEAD",moccasin:"#FFE4B5",bisque:"#FFE4C4",mistyrose:"#FFE4E1",blanchedalmond:"#FFEBCD",papayawhip:"#FFEFD5",lavenderblush:"#FFF0F5",seashell:"#FFF5EE",cornsilk:"#FFF8DC",lemonchiffon:"#FFFACD",floralwhite:"#FFFAF0",snow:"#FFFAFA",lightyellow:"#FFFFE0",ivory:"#FFFFF0"};var Vt=new Int8Array(4),_e=new Int32Array(Vt.buffer,0,1),Hn=new Float32Array(Vt.buffer,0,1),xn=/^\s*rgba?\s*\(/,Kn=/^\s*rgba?\s*\(\s*([0-9]*)\s*,\s*([0-9]*)\s*,\s*([0-9]*)(?:\s*,\s*(.*)?)?\)\s*$/;function kn(i){var e=0,A=0,t=0,r=1;if(i[0]==="#")i.length===4?(e=parseInt(i.charAt(1)+i.charAt(1),16),A=parseInt(i.charAt(2)+i.charAt(2),16),t=parseInt(i.charAt(3)+i.charAt(3),16)):(e=parseInt(i.charAt(1)+i.charAt(2),16),A=parseInt(i.charAt(3)+i.charAt(4),16),t=parseInt(i.charAt(5)+i.charAt(6),16)),i.length===9&&(r=parseInt(i.charAt(7)+i.charAt(8),16)/255);else if(xn.test(i)){var n=i.match(Kn);n&&(e=+n[1],A=+n[2],t=+n[3],n[4]&&(r=+n[4]))}return{r:e,g:A,b:t,a:r}}var WA={};for(se in Ze)WA[se]=qA(Ze[se]),WA[Ze[se]]=WA[se];var se;function Wt(i,e,A,t,r){return _e[0]=t<<24|A<<16|e<<8|i,r&&(_e[0]=_e[0]&4278190079),Hn[0]}function qA(i){if(i=i.toLowerCase(),typeof WA[i]<"u")return WA[i];var e=kn(i),A=e.r,t=e.g,r=e.b,n=e.a;n=n*255|0;var o=Wt(A,t,r,n,!0);return WA[i]=o,o}var $e={};function et(i){if(typeof $e[i]<"u")return $e[i];var e=(i&16711680)>>>16,A=(i&65280)>>>8,t=i&255,r=255,n=Wt(e,A,t,r,!0);return $e[i]=n,n}function tt(i,e,A,t){return A+(e<<8)+(i<<16)}function it(i,e,A,t,r,n){var o=Math.floor(A/n*r),g=Math.floor(i.drawingBufferHeight/n-t/n*r),s=new Uint8Array(4);i.bindFramebuffer(i.FRAMEBUFFER,e),i.readPixels(o,g,1,1,i.RGBA,i.UNSIGNED_BYTE,s);var B=YA(s,4),C=B[0],w=B[1],c=B[2],f=B[3];return[C,w,c,f]}function l(i,e,A){return(e=JA(e))in i?Object.defineProperty(i,e,{value:A,enumerable:!0,configurable:!0,writable:!0}):i[e]=A,i}function qt(i,e){var A=Object.keys(i);if(Object.getOwnPropertySymbols){var t=Object.getOwnPropertySymbols(i);e&&(t=t.filter(function(r){return Object.getOwnPropertyDescriptor(i,r).enumerable})),A.push.apply(A,t)}return A}function y(i){for(var e=1;e<arguments.length;e++){var A=arguments[e]!=null?arguments[e]:{};e%2?qt(Object(A),!0).forEach(function(t){l(i,t,A[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(i,Object.getOwnPropertyDescriptors(A)):qt(Object(A)).forEach(function(t){Object.defineProperty(i,t,Object.getOwnPropertyDescriptor(A,t))})}return i}function Jn(i,e){for(;!{}.hasOwnProperty.call(i,e)&&(i=kA(i))!==null;);return i}function ot(){return ot=typeof Reflect<"u"&&Reflect.get?Reflect.get.bind():function(i,e,A){var t=Jn(i,e);if(t){var r=Object.getOwnPropertyDescriptor(t,e);return r.get?r.get.call(arguments.length<3?i:A):r.value}},ot.apply(null,arguments)}function ii(i,e,A,t){var r=ot(kA(1&t?i.prototype:i),e,A);return 2&t&&typeof r=="function"?function(n){return r.apply(A,n)}:r}function Nn(i){return i.normalized?1:i.size}function rt(i){var e=0;return i.forEach(function(A){return e+=Nn(A)}),e}function ri(i,e,A){var t=i==="VERTEX"?e.VERTEX_SHADER:e.FRAGMENT_SHADER,r=e.createShader(t);if(r===null)throw new Error("loadShader: error while creating the shader");e.shaderSource(r,A),e.compileShader(r);var n=e.getShaderParameter(r,e.COMPILE_STATUS);if(!n){var o=e.getShaderInfoLog(r);throw e.deleteShader(r),new Error(`loadShader: error while compiling the shader:
|
|
3
3
|
`.concat(o,`
|
|
4
|
-
`).concat(A))}return r}function Un(i,e){return ri("VERTEX",i,e)}function Rn(i,e){return ri("FRAGMENT",i,e)}function On(i,e){var A=i.createProgram();if(A===null)throw new Error("loadProgram: error while creating the program.");var t,r;for(t=0,r=e.length;t<r;t++)i.attachShader(A,e[t]);i.linkProgram(A);var n=i.getProgramParameter(A,i.LINK_STATUS);if(!n)throw i.deleteProgram(A),new Error("loadProgram: error while linking the program.
|
|
4
|
+
`).concat(A))}return r}function Un(i,e){return ri("VERTEX",i,e)}function Rn(i,e){return ri("FRAGMENT",i,e)}function On(i,e){var A=i.createProgram();if(A===null)throw new Error("loadProgram: error while creating the program.");var t,r;for(t=0,r=e.length;t<r;t++)i.attachShader(A,e[t]);i.linkProgram(A);var n=i.getProgramParameter(A,i.LINK_STATUS);if(!n){var o=i.getProgramInfoLog(A);throw i.deleteProgram(A),new Error("loadProgram: error while linking the program: ".concat(o))}return A}function Zt(i){var e=i.gl,A=i.buffer,t=i.program,r=i.vertexShader,n=i.fragmentShader;e.deleteShader(r),e.deleteShader(n),e.deleteProgram(t),e.deleteBuffer(A)}var _t=`#define PICKING_MODE
|
|
5
5
|
`,jn=l(l(l(l(l(l(l(l({},WebGL2RenderingContext.BOOL,1),WebGL2RenderingContext.BYTE,1),WebGL2RenderingContext.UNSIGNED_BYTE,1),WebGL2RenderingContext.SHORT,2),WebGL2RenderingContext.UNSIGNED_SHORT,2),WebGL2RenderingContext.INT,4),WebGL2RenderingContext.UNSIGNED_INT,4),WebGL2RenderingContext.FLOAT,4);var ni=(function(){function i(e,A,t){z(this,i),l(this,"array",new Float32Array),l(this,"constantArray",new Float32Array),l(this,"capacity",0),l(this,"verticesCount",0);var r=this.getDefinition();if(this.VERTICES=r.VERTICES,this.VERTEX_SHADER_SOURCE=r.VERTEX_SHADER_SOURCE,this.FRAGMENT_SHADER_SOURCE=r.FRAGMENT_SHADER_SOURCE,this.UNIFORMS=r.UNIFORMS,this.ATTRIBUTES=r.ATTRIBUTES,this.METHOD=r.METHOD,this.CONSTANT_ATTRIBUTES="CONSTANT_ATTRIBUTES"in r?r.CONSTANT_ATTRIBUTES:[],this.CONSTANT_DATA="CONSTANT_DATA"in r?r.CONSTANT_DATA:[],this.isInstanced="CONSTANT_ATTRIBUTES"in r,this.ATTRIBUTES_ITEMS_COUNT=rt(this.ATTRIBUTES),this.STRIDE=this.VERTICES*this.ATTRIBUTES_ITEMS_COUNT,this.renderer=t,this.normalProgram=this.getProgramInfo("normal",e,r.VERTEX_SHADER_SOURCE,r.FRAGMENT_SHADER_SOURCE,null),this.pickProgram=A?this.getProgramInfo("pick",e,_t+r.VERTEX_SHADER_SOURCE,_t+r.FRAGMENT_SHADER_SOURCE,A):null,this.isInstanced){var n=rt(this.CONSTANT_ATTRIBUTES);if(this.CONSTANT_DATA.length!==this.VERTICES)throw new Error("Program: error while getting constant data (expected ".concat(this.VERTICES," items, received ").concat(this.CONSTANT_DATA.length," instead)"));this.constantArray=new Float32Array(this.CONSTANT_DATA.length*n);for(var o=0;o<this.CONSTANT_DATA.length;o++){var g=this.CONSTANT_DATA[o];if(g.length!==n)throw new Error("Program: error while getting constant data (one vector has ".concat(g.length," items instead of ").concat(n,")"));for(var s=0;s<g.length;s++)this.constantArray[o*n+s]=g[s]}this.STRIDE=this.ATTRIBUTES_ITEMS_COUNT}}return X(i,[{key:"kill",value:function(){Zt(this.normalProgram),this.pickProgram&&(Zt(this.pickProgram),this.pickProgram=null)}},{key:"getProgramInfo",value:function(A,t,r,n,o){var g=this.getDefinition(),s=t.createBuffer();if(s===null)throw new Error("Program: error while creating the WebGL buffer.");var B=Un(t,r),C=Rn(t,n),w=On(t,[B,C]),c={};g.UNIFORMS.forEach(function(h){var d=t.getUniformLocation(w,h);d&&(c[h]=d)});var f={};g.ATTRIBUTES.forEach(function(h){f[h.name]=t.getAttribLocation(w,h.name)});var D;if("CONSTANT_ATTRIBUTES"in g&&(g.CONSTANT_ATTRIBUTES.forEach(function(h){f[h.name]=t.getAttribLocation(w,h.name)}),D=t.createBuffer(),D===null))throw new Error("Program: error while creating the WebGL constant buffer.");return{name:A,program:w,gl:t,frameBuffer:o,buffer:s,constantBuffer:D||{},uniformLocations:c,attributeLocations:f,isPicking:A==="pick",vertexShader:B,fragmentShader:C}}},{key:"bindProgram",value:function(A){var t=this,r=0,n=A.gl,o=A.buffer;this.isInstanced?(n.bindBuffer(n.ARRAY_BUFFER,A.constantBuffer),r=0,this.CONSTANT_ATTRIBUTES.forEach(function(g){return r+=t.bindAttribute(g,A,r,!1)}),n.bufferData(n.ARRAY_BUFFER,this.constantArray,n.STATIC_DRAW),n.bindBuffer(n.ARRAY_BUFFER,A.buffer),r=0,this.ATTRIBUTES.forEach(function(g){return r+=t.bindAttribute(g,A,r,!0)}),n.bufferData(n.ARRAY_BUFFER,this.array,n.DYNAMIC_DRAW)):(n.bindBuffer(n.ARRAY_BUFFER,o),r=0,this.ATTRIBUTES.forEach(function(g){return r+=t.bindAttribute(g,A,r)}),n.bufferData(n.ARRAY_BUFFER,this.array,n.DYNAMIC_DRAW)),n.bindBuffer(n.ARRAY_BUFFER,null)}},{key:"unbindProgram",value:function(A){var t=this;this.isInstanced?(this.CONSTANT_ATTRIBUTES.forEach(function(r){return t.unbindAttribute(r,A,!1)}),this.ATTRIBUTES.forEach(function(r){return t.unbindAttribute(r,A,!0)})):this.ATTRIBUTES.forEach(function(r){return t.unbindAttribute(r,A)})}},{key:"bindAttribute",value:function(A,t,r,n){var o=jn[A.type];if(typeof o!="number")throw new Error('Program.bind: yet unsupported attribute type "'.concat(A.type,'"'));var g=t.attributeLocations[A.name],s=t.gl;if(g!==-1){s.enableVertexAttribArray(g);var B=this.isInstanced?(n?this.ATTRIBUTES_ITEMS_COUNT:rt(this.CONSTANT_ATTRIBUTES))*Float32Array.BYTES_PER_ELEMENT:this.ATTRIBUTES_ITEMS_COUNT*Float32Array.BYTES_PER_ELEMENT;if(s.vertexAttribPointer(g,A.size,A.type,A.normalized||!1,B,r),this.isInstanced&&n)if(s instanceof WebGL2RenderingContext)s.vertexAttribDivisor(g,1);else{var C=s.getExtension("ANGLE_instanced_arrays");C&&C.vertexAttribDivisorANGLE(g,1)}}return A.size*o}},{key:"unbindAttribute",value:function(A,t,r){var n=t.attributeLocations[A.name],o=t.gl;if(n!==-1&&(o.disableVertexAttribArray(n),this.isInstanced&&r))if(o instanceof WebGL2RenderingContext)o.vertexAttribDivisor(n,0);else{var g=o.getExtension("ANGLE_instanced_arrays");g&&g.vertexAttribDivisorANGLE(n,0)}}},{key:"reallocate",value:function(A){A!==this.capacity&&(this.capacity=A,this.verticesCount=this.VERTICES*A,this.array=new Float32Array(this.isInstanced?this.capacity*this.ATTRIBUTES_ITEMS_COUNT:this.verticesCount*this.ATTRIBUTES_ITEMS_COUNT))}},{key:"hasNothingToRender",value:function(){return this.verticesCount===0}},{key:"renderProgram",value:function(A,t){var r=t.gl,n=t.program;r.enable(r.BLEND),r.useProgram(n),this.setUniforms(A,t),this.drawWebGL(this.METHOD,t)}},{key:"render",value:function(A){this.hasNothingToRender()||(this.pickProgram&&(this.pickProgram.gl.viewport(0,0,A.width*A.pixelRatio/A.downSizingRatio,A.height*A.pixelRatio/A.downSizingRatio),this.bindProgram(this.pickProgram),this.renderProgram(y(y({},A),{},{pixelRatio:A.pixelRatio/A.downSizingRatio}),this.pickProgram),this.unbindProgram(this.pickProgram)),this.normalProgram.gl.viewport(0,0,A.width*A.pixelRatio,A.height*A.pixelRatio),this.bindProgram(this.normalProgram),this.renderProgram(A,this.normalProgram),this.unbindProgram(this.normalProgram))}},{key:"drawWebGL",value:function(A,t){var r=t.gl,n=t.frameBuffer;if(r.bindFramebuffer(r.FRAMEBUFFER,n),!this.isInstanced)r.drawArrays(A,0,this.verticesCount);else if(r instanceof WebGL2RenderingContext)r.drawArraysInstanced(A,0,this.VERTICES,this.capacity);else{var o=r.getExtension("ANGLE_instanced_arrays");o&&o.drawArraysInstancedANGLE(A,0,this.VERTICES,this.capacity)}}}])})();var Tn=(function(i){function e(){return z(this,e),AA(this,e,arguments)}return eA(e,i),X(e,[{key:"kill",value:function(){ii(e,"kill",this,3)([])}},{key:"process",value:function(t,r,n){var o=r*this.STRIDE;if(n.hidden){for(var g=o+this.STRIDE;o<g;o++)this.array[o]=0;return}return this.processVisibleItem(et(t),o,n)}}])})(ni);var gt=(function(i){function e(){var A;z(this,e);for(var t=arguments.length,r=new Array(t),n=0;n<t;n++)r[n]=arguments[n];return A=AA(this,e,[].concat(r)),l(A,"drawLabel",void 0),A}return eA(e,i),X(e,[{key:"kill",value:function(){ii(e,"kill",this,3)([])}},{key:"process",value:function(t,r,n,o,g){var s=r*this.STRIDE;if(g.hidden||n.hidden||o.hidden){for(var B=s+this.STRIDE;s<B;s++)this.array[s]=0;return}return this.processVisibleItem(et(t),s,n,o,g)}}])})(ni);function Sn(i,e){return(function(){function A(t,r,n){z(this,A),l(this,"drawLabel",e),this.programs=i.map(function(o){return new o(t,r,n)})}return X(A,[{key:"reallocate",value:function(r){this.programs.forEach(function(n){return n.reallocate(r)})}},{key:"process",value:function(r,n,o,g,s){this.programs.forEach(function(B){return B.process(r,n,o,g,s)})}},{key:"render",value:function(r){this.programs.forEach(function(n){return n.render(r)})}},{key:"kill",value:function(){this.programs.forEach(function(r){return r.kill()})}}])})()}function oi(i,e,A,t,r){var n=r.edgeLabelSize,o=r.edgeLabelFont,g=r.edgeLabelWeight,s=r.edgeLabelColor.attribute?e[r.edgeLabelColor.attribute]||r.edgeLabelColor.color||"#000":r.edgeLabelColor.color,B=e.label;if(B){i.fillStyle=s,i.font="".concat(g," ").concat(n,"px ").concat(o);var C=A.size,w=t.size,c=A.x,f=A.y,D=t.x,h=t.y,d=(c+D)/2,P=(f+h)/2,v=D-c,E=h-f,I=Math.sqrt(v*v+E*E);if(!(I<C+w)){c+=v*C/I,f+=E*C/I,D-=v*w/I,h-=E*w/I,d=(c+D)/2,P=(f+h)/2,v=D-c,E=h-f,I=Math.sqrt(v*v+E*E);var Y=i.measureText(B).width;if(Y>I){var L="\u2026";for(B=B+L,Y=i.measureText(B).width;Y>I&&B.length>1;)B=B.slice(0,-2)+L,Y=i.measureText(B).width;if(B.length<4)return}var M;v>0?E>0?M=Math.acos(v/I):M=Math.asin(E/I):E>0?M=Math.acos(v/I)+Math.PI:M=Math.asin(v/I)+Math.PI/2,i.save(),i.translate(d,P),i.rotate(M),i.fillText(B,-Y/2,e.size/2+n),i.restore()}}}function st(i,e,A){if(e.label){var t=A.labelSize,r=A.labelFont,n=A.labelWeight,o=A.labelColor.attribute?e[A.labelColor.attribute]||A.labelColor.color||"#000":A.labelColor.color;i.fillStyle=o,i.font="".concat(n," ").concat(t,"px ").concat(r),i.fillText(e.label,e.x+e.size+3,e.y+t/3)}}function gi(i,e,A){var t=A.labelSize,r=A.labelFont,n=A.labelWeight;i.font="".concat(n," ").concat(t,"px ").concat(r),i.fillStyle="#FFF",i.shadowOffsetX=0,i.shadowOffsetY=0,i.shadowBlur=8,i.shadowColor="#000";var o=2;if(typeof e.label=="string"){var g=i.measureText(e.label).width,s=Math.round(g+5),B=Math.round(t+2*o),C=Math.max(e.size,t/2)+o,w=Math.asin(B/2/C),c=Math.sqrt(Math.abs(Math.pow(C,2)-Math.pow(B/2,2)));i.beginPath(),i.moveTo(e.x+c,e.y+B/2),i.lineTo(e.x+C+s,e.y+B/2),i.lineTo(e.x+C+s,e.y-B/2),i.lineTo(e.x+c,e.y-B/2),i.arc(e.x,e.y,C,w,-w),i.closePath(),i.fill()}else i.beginPath(),i.arc(e.x,e.y,e.size+o,0,Math.PI*2),i.closePath(),i.fill();i.shadowOffsetX=0,i.shadowOffsetY=0,i.shadowBlur=0,st(i,e,A)}var zn=`
|
|
6
6
|
precision highp float;
|
|
7
7
|
|
package/dist/shared/index.js
CHANGED
|
@@ -68,6 +68,7 @@ import { isInactiveFindingLine } from "../finding/lifecycle.js";
|
|
|
68
68
|
import { invalidateDfCache } from "./search-fallback.js";
|
|
69
69
|
import { errorMessage } from "../utils.js";
|
|
70
70
|
import { logger } from "../logger.js";
|
|
71
|
+
import { formatActorAttribution, parseSourceComment } from "../content/citation.js";
|
|
71
72
|
import { beginUserFragmentBuildCache, endUserFragmentBuildCache, extractAndLinkFragments, ensureGlobalEntitiesTable, } from "./fragment-graph.js";
|
|
72
73
|
import { bootstrapSqlJs } from "./sqljs.js";
|
|
73
74
|
import { getProjectOwnershipMode, getProjectSourcePath, readProjectConfig } from "../project-config.js";
|
|
@@ -521,7 +522,10 @@ export function normalizeIndexedContent(content, type, phrenPath, maxChars) {
|
|
|
521
522
|
.replace(/<!-- phren:archive:start -->[\s\S]*?<!-- phren:archive:end -->/g, "")
|
|
522
523
|
.replace(/<details>[\s\S]*?<\/details>/gi, "")
|
|
523
524
|
.replace(/<!--\s*created:\s*.*?-->/g, "")
|
|
524
|
-
.replace(/<!--\s*source
|
|
525
|
+
.replace(/<!--\s*source:.*?-->/g, (match) => {
|
|
526
|
+
const parsed = parseSourceComment(match);
|
|
527
|
+
return formatActorAttribution(parsed?.actor, parsed?.machine);
|
|
528
|
+
})
|
|
525
529
|
.replace(/<!--\s*phren:cite\s+\{[\s\S]*?\}\s*-->/g, "");
|
|
526
530
|
normalized = resolveImports(normalized, phrenPath);
|
|
527
531
|
if (type === "task") {
|
package/dist/task/lifecycle.d.ts
CHANGED
|
@@ -18,6 +18,7 @@ export declare function finalizeTaskSession(args: {
|
|
|
18
18
|
status: "clean" | "saved-local" | "saved-pushed" | "no-upstream" | "error";
|
|
19
19
|
detail: string;
|
|
20
20
|
}): void;
|
|
21
|
+
export declare function isTransientGitFailure(detail: string): boolean;
|
|
21
22
|
/**
|
|
22
23
|
* Return the active TaskItem tracked for a session+project, if any.
|
|
23
24
|
* Used by mcp-finding.ts to link findings to active tasks.
|
package/dist/task/lifecycle.js
CHANGED
|
@@ -89,6 +89,24 @@ function clearTaskSessionState(phrenPath, sessionId) {
|
|
|
89
89
|
function getTaskMode(phrenPath) {
|
|
90
90
|
return getWorkflowPolicy(phrenPath).taskMode;
|
|
91
91
|
}
|
|
92
|
+
// Hard substance floor — applies before any intent-specific logic so that conversational
|
|
93
|
+
// fragments slipping past the noise regex (e.g. "Here's the thing", "I just clicked on to
|
|
94
|
+
// this page", "<") never become tasks even at proactivityTasks=high. A prompt clears the
|
|
95
|
+
// floor only if it has enough words AND has at least one signal: an actionable verb, a
|
|
96
|
+
// path-like fragment (./, /), a reference (#123 or a 4+ digit ticket number), a file
|
|
97
|
+
// extension, or a URL.
|
|
98
|
+
const MIN_TASK_PROMPT_WORDS = 4;
|
|
99
|
+
const MIN_TASK_PROMPT_CHARS = 12;
|
|
100
|
+
const TASK_SIGNAL_RE = /\b(?:fix|add|update|remove|delete|check|run|build|test|ship|implement|investigate|review|audit|create|change|refactor|rename|deploy|merge|migrate|wire|integrate|debug|explore|evaluate|compare|analy[sz]e|assess|consider|design|document|plan|prototype|prepare|configure|enable|disable|publish|release|rollback|verify|validate|profile|optimi[sz]e|harden|automate|backport|cleanup|cleanse|polish|tune|land)\b|[/\\][\w.\-]+|#\d+|\b\d{4,}\b|\.[a-z]{1,4}\b|https?:\/\//i;
|
|
101
|
+
function hasMinimumTaskSubstance(prompt) {
|
|
102
|
+
const trimmed = prompt.trim();
|
|
103
|
+
if (trimmed.length < MIN_TASK_PROMPT_CHARS)
|
|
104
|
+
return false;
|
|
105
|
+
const words = trimmed.split(/\s+/).filter((w) => /\w/.test(w));
|
|
106
|
+
if (words.length < MIN_TASK_PROMPT_WORDS)
|
|
107
|
+
return false;
|
|
108
|
+
return TASK_SIGNAL_RE.test(trimmed);
|
|
109
|
+
}
|
|
92
110
|
function isActionablePrompt(prompt, intent) {
|
|
93
111
|
const normalized = prompt.trim();
|
|
94
112
|
if (!normalized)
|
|
@@ -100,6 +118,10 @@ function isActionablePrompt(prompt, intent) {
|
|
|
100
118
|
return false;
|
|
101
119
|
if (RAW_MESSAGE_SIGNALS_RE.test(normalized))
|
|
102
120
|
return false;
|
|
121
|
+
// Substance floor — independent of intent / proactivity. Short utterances without
|
|
122
|
+
// any actionable signal are conversational fragments, not tasks.
|
|
123
|
+
if (!hasMinimumTaskSubstance(normalized))
|
|
124
|
+
return false;
|
|
103
125
|
if (intent === "general")
|
|
104
126
|
return ACTIONABLE_RE.test(normalized);
|
|
105
127
|
return true;
|
|
@@ -324,6 +346,16 @@ export function finalizeTaskSession(args) {
|
|
|
324
346
|
return;
|
|
325
347
|
}
|
|
326
348
|
if (args.status === "error") {
|
|
349
|
+
// Don't poison the task with transient git infrastructure failures. Common
|
|
350
|
+
// observed pattern: git add -A failing because of file locks / permissions
|
|
351
|
+
// on Windows mounts / sparse-checkout edge cases. The user's task is unrelated;
|
|
352
|
+
// promoting it to Active and marking it "Blocked: Command failed: git add -A"
|
|
353
|
+
// creates a permanent zombie that re-blocks every subsequent session.
|
|
354
|
+
if (isTransientGitFailure(args.detail)) {
|
|
355
|
+
debugLog(`task lifecycle ignored transient git failure for ${state.project}: ${args.detail}`);
|
|
356
|
+
// Keep session state intact — next clean session can complete normally.
|
|
357
|
+
return;
|
|
358
|
+
}
|
|
327
359
|
const blocked = updateTask(args.phrenPath, state.project, match, {
|
|
328
360
|
section: "active",
|
|
329
361
|
context: `Blocked: ${args.detail}`,
|
|
@@ -341,6 +373,12 @@ export function finalizeTaskSession(args) {
|
|
|
341
373
|
return;
|
|
342
374
|
}
|
|
343
375
|
}
|
|
376
|
+
const TRANSIENT_GIT_FAILURE_RE = /^Command failed:\s*git\s+(?:add|commit|push|stage|pull|fetch|stash)\b/i;
|
|
377
|
+
export function isTransientGitFailure(detail) {
|
|
378
|
+
if (!detail)
|
|
379
|
+
return false;
|
|
380
|
+
return TRANSIENT_GIT_FAILURE_RE.test(detail.trim());
|
|
381
|
+
}
|
|
344
382
|
/**
|
|
345
383
|
* Return the active TaskItem tracked for a session+project, if any.
|
|
346
384
|
* Used by mcp-finding.ts to link findings to active tasks.
|
package/dist/tools/finding.js
CHANGED
|
@@ -4,8 +4,9 @@ import * as fs from "fs";
|
|
|
4
4
|
import * as path from "path";
|
|
5
5
|
import { logger } from "../logger.js";
|
|
6
6
|
import { isValidProjectName, safeProjectPath, errorMessage } from "../utils.js";
|
|
7
|
-
import { removeFinding as removeFindingCore, removeFindings as removeFindingsCore, } from "../core/finding.js";
|
|
7
|
+
import { removeFinding as removeFindingCore, removeFindings as removeFindingsCore, applyFindingTypePrefix, } from "../core/finding.js";
|
|
8
8
|
import { debugLog, EXEC_TIMEOUT_MS, FINDING_TYPES, normalizeMemoryScope, } from "../shared.js";
|
|
9
|
+
import { getCurrentActor, getMachineName } from "../machine-identity.js";
|
|
9
10
|
import { addFindingToFile, addFindingsToFile, checkSemanticConflicts, autoMergeConflicts, } from "../shared/content.js";
|
|
10
11
|
import { jaccardTokenize, jaccardSimilarity, stripMetadata } from "../content/dedup.js";
|
|
11
12
|
import { runCustomHooks } from "../hooks.js";
|
|
@@ -103,6 +104,12 @@ async function handleAddFinding(ctx, params) {
|
|
|
103
104
|
const addFindingDenied = permissionDeniedError(phrenPath, "add_finding", project);
|
|
104
105
|
if (addFindingDenied)
|
|
105
106
|
return mcpResponse({ ok: false, error: addFindingDenied });
|
|
107
|
+
const provenance = {
|
|
108
|
+
source: "human",
|
|
109
|
+
machine: getMachineName(),
|
|
110
|
+
actor: getCurrentActor(),
|
|
111
|
+
session_id: sessionId,
|
|
112
|
+
};
|
|
106
113
|
// Team stores: use append-only journal (no FINDINGS.md mutation, no merge conflicts)
|
|
107
114
|
{
|
|
108
115
|
const storeResolved = resolveStoreForProject(ctx, params.project);
|
|
@@ -111,8 +118,8 @@ async function handleAddFinding(ctx, params) {
|
|
|
111
118
|
const findings = Array.isArray(finding) ? finding : [finding];
|
|
112
119
|
const added = [];
|
|
113
120
|
for (const f of findings) {
|
|
114
|
-
const taggedFinding =
|
|
115
|
-
const result = appendTeamJournal(phrenPath, project, taggedFinding);
|
|
121
|
+
const taggedFinding = applyFindingTypePrefix(f, findingType);
|
|
122
|
+
const result = appendTeamJournal(phrenPath, project, taggedFinding, provenance.actor, provenance.machine);
|
|
116
123
|
if (result.ok)
|
|
117
124
|
added.push(taggedFinding);
|
|
118
125
|
}
|
|
@@ -150,6 +157,7 @@ async function handleAddFinding(ctx, params) {
|
|
|
150
157
|
extraAnnotationsByFinding,
|
|
151
158
|
sessionId,
|
|
152
159
|
scope: normalizedScope,
|
|
160
|
+
provenance,
|
|
153
161
|
});
|
|
154
162
|
if (!result.ok)
|
|
155
163
|
return mcpResponse({ ok: false, error: result.error });
|
|
@@ -180,7 +188,7 @@ async function handleAddFinding(ctx, params) {
|
|
|
180
188
|
return mcpResponse({ ok: false, error: `Invalid scope: "${scope}". Use lowercase letters/numbers with '-' or '_' (max 64 chars), e.g. "researcher".` });
|
|
181
189
|
return withWriteQueue(async () => {
|
|
182
190
|
try {
|
|
183
|
-
const taggedFinding =
|
|
191
|
+
const taggedFinding = applyFindingTypePrefix(finding, findingType);
|
|
184
192
|
// Jaccard "maybe zone" scan — free, no LLM call. Return candidates so the agent decides.
|
|
185
193
|
const potentialDuplicates = findJaccardCandidates(phrenPath, project, taggedFinding);
|
|
186
194
|
const semanticConflicts = await checkSemanticConflicts(phrenPath, project, taggedFinding);
|
|
@@ -189,6 +197,7 @@ async function handleAddFinding(ctx, params) {
|
|
|
189
197
|
sessionId,
|
|
190
198
|
scope: normalizedScope,
|
|
191
199
|
extraAnnotations: semanticConflicts.checked ? semanticConflicts.annotations : undefined,
|
|
200
|
+
provenance,
|
|
192
201
|
});
|
|
193
202
|
if (!result.ok) {
|
|
194
203
|
return mcpResponse({ ok: false, error: result.error });
|
package/dist/tools/search.js
CHANGED
|
@@ -14,7 +14,7 @@ import { runCustomHooks } from "../hooks.js";
|
|
|
14
14
|
import { entryScoreKey, getQualityMultiplier, getRetentionPolicy } from "../shared/governance.js";
|
|
15
15
|
import { callLlm } from "../content/dedup.js";
|
|
16
16
|
import { rankResults, searchKnowledgeRows, applyTrustFilter, searchFederatedStores } from "../shared/retrieval.js";
|
|
17
|
-
import { parseScopeComment, parseSourceComment } from "../content/citation.js";
|
|
17
|
+
import { formatActorAttribution, parseScopeComment, parseSourceComment } from "../content/citation.js";
|
|
18
18
|
import { resolveActiveSessionScope } from "./session.js";
|
|
19
19
|
import { logger } from "../logger.js";
|
|
20
20
|
/**
|
|
@@ -668,7 +668,8 @@ async function handleGetFindings(ctx, { project, limit, include_superseded, incl
|
|
|
668
668
|
if (entry.tier === "archived")
|
|
669
669
|
metadata.push("tier=archived");
|
|
670
670
|
const idLabel = entry.stableId ? `${entry.id}|fid:${entry.stableId}` : entry.id;
|
|
671
|
-
|
|
671
|
+
const attribution = formatActorAttribution(entry.actor, entry.machine);
|
|
672
|
+
return `- [${idLabel}] ${entry.date}: ${entry.text}${attribution ? ` ${attribution}` : ""}${entry.confidence !== undefined ? ` [confidence ${entry.confidence.toFixed(2)}]` : ""}${metadata.length > 0 ? ` [${metadata.join(" ")}]` : ""}${entry.citation ? ` (${entry.citation})` : ""}`;
|
|
672
673
|
});
|
|
673
674
|
const hiddenHistoryCount = includeHistory ? 0 : historyCount;
|
|
674
675
|
const historyNote = hiddenHistoryCount > 0 ? ` (${hiddenHistoryCount} historical hidden)` : "";
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@phren/cli",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.26",
|
|
4
4
|
"description": "Knowledge layer for AI agents — CLI, MCP server, and data layer",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"bin": {
|
|
@@ -79,11 +79,11 @@
|
|
|
79
79
|
"glob": "^13.0.6",
|
|
80
80
|
"graphology": "^0.26.0",
|
|
81
81
|
"graphology-layout-forceatlas2": "^0.10.1",
|
|
82
|
-
"inquirer": "^13.4.
|
|
82
|
+
"inquirer": "^13.4.2",
|
|
83
83
|
"js-yaml": "^4.1.1",
|
|
84
|
-
"sigma": "^3.0.
|
|
84
|
+
"sigma": "^3.0.3",
|
|
85
85
|
"sql.js-fts5": "^1.4.0",
|
|
86
|
-
"zod": "^4.
|
|
86
|
+
"zod": "^4.4.2"
|
|
87
87
|
},
|
|
88
88
|
"engines": {
|
|
89
89
|
"node": ">=20.0.0"
|