HomeDashboard/.venv/lib/python3.12/site-packages/nicegui/elements/mermaid/dist/chunk-ZN7TASNU-DDZ3ESNM.js
2026-01-03 14:54:18 +01:00

3 lines
5.9 KiB
JavaScript
Raw Permalink Blame History

This file contains invisible Unicode characters

This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

import{k as e,e as t,Z as s,s as i,m as r,X as n,R as h}from"./chunk-5ZJXQJOJ-BQpwB-Bn.js";import{m as o,aX as d,aZ as a,a_ as u}from"./index-Bd_j0xvv.js";var _="\0",l=class{static{o(this,"Graph")}constructor(e={}){this._isDirected=!Object.prototype.hasOwnProperty.call(e,"directed")||e.directed,this._isMultigraph=!!Object.prototype.hasOwnProperty.call(e,"multigraph")&&e.multigraph,this._isCompound=!!Object.prototype.hasOwnProperty.call(e,"compound")&&e.compound,this._label=void 0,this._defaultNodeLabelFn=d(void 0),this._defaultEdgeLabelFn=d(void 0),this._nodes={},this._isCompound&&(this._parent={},this._children={},this._children[_]={}),this._in={},this._preds={},this._out={},this._sucs={},this._edgeObjs={},this._edgeLabels={}}isDirected(){return this._isDirected}isMultigraph(){return this._isMultigraph}isCompound(){return this._isCompound}setGraph(e){return this._label=e,this}graph(){return this._label}setDefaultNodeLabel(e){return a(e)||(e=d(e)),this._defaultNodeLabelFn=e,this}nodeCount(){return this._nodeCount}nodes(){return e(this._nodes)}sources(){var e=this;return t(this.nodes(),function(t){return u(e._in[t])})}sinks(){var e=this;return t(this.nodes(),function(t){return u(e._out[t])})}setNodes(e,t){var i=arguments,r=this;return s(e,function(e){i.length>1?r.setNode(e,t):r.setNode(e)}),this}setNode(e,t){return Object.prototype.hasOwnProperty.call(this._nodes,e)?(arguments.length>1&&(this._nodes[e]=t),this):(this._nodes[e]=arguments.length>1?t:this._defaultNodeLabelFn(e),this._isCompound&&(this._parent[e]=_,this._children[e]={},this._children[_][e]=!0),this._in[e]={},this._preds[e]={},this._out[e]={},this._sucs[e]={},++this._nodeCount,this)}node(e){return this._nodes[e]}hasNode(e){return Object.prototype.hasOwnProperty.call(this._nodes,e)}removeNode(t){if(Object.prototype.hasOwnProperty.call(this._nodes,t)){var i=o(e=>this.removeEdge(this._edgeObjs[e]),"removeEdge");delete this._nodes[t],this._isCompound&&(this._removeFromParentsChildList(t),delete this._parent[t],s(this.children(t),e=>{this.setParent(e)}),delete this._children[t]),s(e(this._in[t]),i),delete this._in[t],delete this._preds[t],s(e(this._out[t]),i),delete this._out[t],delete this._sucs[t],--this._nodeCount}return this}setParent(e,t){if(!this._isCompound)throw new Error("Cannot set parent in a non-compound graph");if(i(t))t=_;else{for(var s=t+="";!i(s);s=this.parent(s))if(s===e)throw new Error("Setting "+t+" as parent of "+e+" would create a cycle");this.setNode(t)}return this.setNode(e),this._removeFromParentsChildList(e),this._parent[e]=t,this._children[t][e]=!0,this}_removeFromParentsChildList(e){delete this._children[this._parent[e]][e]}parent(e){if(this._isCompound){var t=this._parent[e];if(t!==_)return t}}children(t){if(i(t)&&(t=_),this._isCompound){var s=this._children[t];if(s)return e(s)}else{if(t===_)return this.nodes();if(this.hasNode(t))return[]}}predecessors(t){var s=this._preds[t];if(s)return e(s)}successors(t){var s=this._sucs[t];if(s)return e(s)}neighbors(e){var t=this.predecessors(e);if(t)return r(t,this.successors(e))}isLeaf(e){return 0===(this.isDirected()?this.successors(e):this.neighbors(e)).length}filterNodes(e){var t=new this.constructor({directed:this._isDirected,multigraph:this._isMultigraph,compound:this._isCompound});t.setGraph(this.graph());var i=this;s(this._nodes,function(s,i){e(i)&&t.setNode(i,s)}),s(this._edgeObjs,function(e){t.hasNode(e.v)&&t.hasNode(e.w)&&t.setEdge(e,i.edge(e))});var r={};function n(e){var s=i.parent(e);return void 0===s||t.hasNode(s)?(r[e]=s,s):s in r?r[s]:n(s)}return o(n,"findParent"),this._isCompound&&s(t.nodes(),function(e){t.setParent(e,n(e))}),t}setDefaultEdgeLabel(e){return a(e)||(e=d(e)),this._defaultEdgeLabelFn=e,this}edgeCount(){return this._edgeCount}edges(){return n(this._edgeObjs)}setPath(e,t){var s=this,i=arguments;return h(e,function(e,r){return i.length>1?s.setEdge(e,r,t):s.setEdge(e,r),r}),this}setEdge(){var e,t,s,r,n=!1,h=arguments[0];"object"==typeof h&&null!==h&&"v"in h?(e=h.v,t=h.w,s=h.name,2===arguments.length&&(r=arguments[1],n=!0)):(e=h,t=arguments[1],s=arguments[3],arguments.length>2&&(r=arguments[2],n=!0)),e=""+e,t=""+t,i(s)||(s=""+s);var o=g(this._isDirected,e,t,s);if(Object.prototype.hasOwnProperty.call(this._edgeLabels,o))return n&&(this._edgeLabels[o]=r),this;if(!i(s)&&!this._isMultigraph)throw new Error("Cannot set a named edge when isMultigraph = false");this.setNode(e),this.setNode(t),this._edgeLabels[o]=n?r:this._defaultEdgeLabelFn(e,t,s);var d=f(this._isDirected,e,t,s);return e=d.v,t=d.w,Object.freeze(d),this._edgeObjs[o]=d,c(this._preds[t],e),c(this._sucs[e],t),this._in[t][o]=d,this._out[e][o]=d,this._edgeCount++,this}edge(e,t,s){var i=1===arguments.length?v(this._isDirected,arguments[0]):g(this._isDirected,e,t,s);return this._edgeLabels[i]}hasEdge(e,t,s){var i=1===arguments.length?v(this._isDirected,arguments[0]):g(this._isDirected,e,t,s);return Object.prototype.hasOwnProperty.call(this._edgeLabels,i)}removeEdge(e,t,s){var i=1===arguments.length?v(this._isDirected,arguments[0]):g(this._isDirected,e,t,s),r=this._edgeObjs[i];return r&&(e=r.v,t=r.w,delete this._edgeLabels[i],delete this._edgeObjs[i],p(this._preds[t],e),p(this._sucs[e],t),delete this._in[t][i],delete this._out[e][i],this._edgeCount--),this}inEdges(e,s){var i=this._in[e];if(i){var r=n(i);return s?t(r,function(e){return e.v===s}):r}}outEdges(e,s){var i=this._out[e];if(i){var r=n(i);return s?t(r,function(e){return e.w===s}):r}}nodeEdges(e,t){var s=this.inEdges(e,t);if(s)return s.concat(this.outEdges(e,t))}};function c(e,t){e[t]?e[t]++:e[t]=1}function p(e,t){--e[t]||delete e[t]}function g(e,t,s,r){var n=""+t,h=""+s;if(!e&&n>h){var o=n;n=h,h=o}return n+""+h+""+(i(r)?"\0":r)}function f(e,t,s,i){var r=""+t,n=""+s;if(!e&&r>n){var h=r;r=n,n=h}var o={v:r,w:n};return i&&(o.name=i),o}function v(e,t){return g(e,t.v,t.w,t.name)}l.prototype._nodeCount=0,l.prototype._edgeCount=0,o(c,"incrementOrInitEntry"),o(p,"decrementOrRemoveEntry"),o(g,"edgeArgsToId"),o(f,"edgeArgsToObj"),o(v,"edgeObjToId");export{l as m};
//# sourceMappingURL=chunk-ZN7TASNU-DDZ3ESNM.js.map