@hpcc-js/util 3.4.6 → 3.5.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js CHANGED
@@ -1,2 +1,2 @@
1
- var t,e,r,s,n=Object.defineProperty,i=(t,e)=>n(t,"name",{value:e,configurable:!0});const o="@hpcc-js/util",a="3.4.6",h="3.19.2";function c(t,e){if(null==t)throw new TypeError('"o" is null or not defined');const r=t.length>>>0;if("function"!=typeof e)throw new TypeError("predicate must be a function");const s=arguments[1];let n=0;for(;n<r;){const r=t[n];if(e.call(s,r,n))return r;n++}}function u(t,e){const r={update:[],exit:[],enter:[...e]};for(const s of t){const t=r.enter.indexOf(s);t>=0?(r.update.push(s),r.enter.splice(t,1)):r.exit.push(s)}return r}function d(t,e,r,s=(t,e)=>e){const n={update:[],exit:[],enter:[]};if(t===e)return n.update=t,n;const i={};e.forEach(t=>{i[r(t)]=t});for(const o of t){const t=r(o),e=i[t];void 0!==e?(delete i[t],n.update.push(s(o,e))):n.exit.push(o)}for(const o in i)n.enter.push(i[o]);return n}function l(t,e){for(;t.length<e;)t="0"+t;return t}function p(t,e){if(0===e.length)return t;for(let r=0;r<e.length;++r){t=(t<<5)-t+e.charCodeAt(r),t|=0}return t<0?-2*t:t}function g(t,e,r){return"function"==typeof e.hashSum?e.hashSum():Object.keys(e).sort().reduce((t,s)=>_(t,e[s],s,r),t)}function _(t,e,r,s){const n=p(p(p(t,r),f(e)),typeof e);return null===e?p(n,"null"):void 0===e?p(n,"undefined"):"object"==typeof e?-1!==s.indexOf(e)?p(n,"[Circular]"+r):(s.push(e),g(n,e,s)):p(n,e.toString())}function f(t){return Object.prototype.toString.call(t)}function v(t){return l(_(0,t,"",[]).toString(16),8)}i(c,"find"),i(u,"compare"),i(d,"compare2"),i(l,"pad"),i(p,"fold"),i(g,"foldObject"),i(_,"foldValue"),i(f,"toString"),i(v,"hashSum");const b=class _Cache{_cache={};_calcID;static hash(...t){return v({...t})}constructor(t){this._calcID=t}has(t){return this._calcID(t)in this._cache}set(t){return this._cache[this._calcID(t)]=t,t}get(t,e){const r=this._cache[this._calcID(t)];return r||(e?this.set(e()):null)}};i(b,"Cache");let E=b;const x=class _AsyncCache{_cache={};_calcID;static hash(...t){return v({...t})}constructor(t){this._calcID=t}has(t){return this._calcID(t)in this._cache}set(t,e){return this._cache[this._calcID(t)]=e,e}get(t,e){const r=this._cache[this._calcID(t)];return r||(e?this.set(t,e()):Promise.resolve(null))}};i(x,"AsyncCache");let m=x;function w(t,e){const r={};return(...s)=>{const n=v(s);return r[n]||(r[n]={clockStart:Date.now(),promise:t(...s).then(t=>(void 0===e?r[n]=null:setTimeout(()=>{r[n]=null},Math.max(e-(Date.now()-r[n].clockStart),0)),t)).catch(t=>{throw r[n]=null,t})}),r[n].promise}}function M(t,e){let r;const s=new Promise((e,s)=>{r=setTimeout(()=>{clearTimeout(r),s("Timed out in "+t+"ms.")},t)});return Promise.race([e,s]).then(t=>(clearTimeout(r),t)).catch(t=>{throw clearTimeout(r),t})}i(w,"debounce"),i(M,"promiseTimeout");const S=class _AsyncOrderedQueue{_q=[];isTop(t){return this._q[0]===t}push(t){const e=t.then(t=>this.isTop(e)?(this._q.shift(),t):new Promise((r,s)=>{const n=setInterval(()=>{this.isTop(e)&&(clearInterval(n),this._q.shift(),r(t))},20)}));return this._q.push(e),e}};i(S,"AsyncOrderedQueue");let y=S;function O(t){return new Promise(e=>{setTimeout(()=>e(),t)})}i(O,"sleep");const V=class _Dictionary{store={};constructor(t){if(t)for(const e in t)this.set(e,t[e])}set(t,e){const r=this.store[t];return this.store[t]=e,r}get(t){return this.store[t]}has(t){return void 0!==this.store[t]}remove(t){delete this.store[t]}keys(){const t=[];for(const e in this.store)t.push(e);return t}values(){const t=[];for(const e in this.store)t.push(this.store[e]);return t}};i(V,"Dictionary");let I=V;const D=class _DictionaryNoCase extends I{constructor(t){super(t)}set(t,e){return super.set(t.toLowerCase(),e)}get(t){return super.get(t.toLowerCase())}has(t){return super.has(t.toLowerCase())}remove(t){return super.remove(t.toLowerCase())}};i(D,"DictionaryNoCase");let k=D;function T(t){if(!t)return 0;if(!isNaN(Number(t)))return Number(t);const e=t.indexOf("ns");if(-1!==e)return parseFloat(t.substr(0,e))/1e9;const r=t.indexOf("ms");if(-1!==r)return parseFloat(t.substr(0,r))/1e3;const s=t.indexOf("s");if(-1!==s&&-1===t.indexOf("days"))return parseFloat(t.substr(0,s));const n=t.split(" days "),i=n.length>1?parseFloat(n[0]):0;let o=0;const a=(n.length>1?n[1]:n[0]).split(":").reverse();for(let h=0;h<a.length;++h)o+=parseFloat(a[h])*Math.pow(60,h);return 24*i*60*60+o}i(T,"espTime2Seconds");let F=(i(t=class{_graph;parent;props={};constructor(t,e){this._graph=t,this.parent=e}},"GraphItem"),t),$=(i(e=class extends F{subgraphs=[];vertices=[];edges=[];_;constructor(t,e,r){super(t,e),e&&e._addSubgraph(this),this._=r}remove(t=!0){this._graph.removeSubgraph(this,t)}createSubgraph(t){return this._graph.createSubgraph(this,t)}_addSubgraph(t){if(this.subgraphs.indexOf(t)>=0)throw new Error("Subgraph already exists");this.subgraphs.push(t)}_removeSubgraph(t){const e=this.subgraphs.indexOf(t);if(e<0)throw new Error("Subgraph does not exist");this.subgraphs.splice(e,1)}removeAllSubgraphs(){for(let t=this.subgraphs.length-1;t>=0;--t)this._graph.removeSubgraph(this.subgraphs[t],!0)}createVertex(t){return this._graph.createVertex(this,t)}_addVertex(t){if(this.vertices.indexOf(t)>=0)throw new Error("Vertex already exists");this.vertices.push(t)}_removeVertex(t){const e=this.vertices.indexOf(t);if(e<0)throw new Error("Vertex does not exist");this.vertices.splice(e,1)}removeAllVertices(){for(let t=this.vertices.length-1;t>=0;--t)this._graph.removeVertex(this.vertices[t],!0)}createEdge(t,e,r){return this._graph.createEdge(this,t,e,r)}_addEdge(t){if(this.edges.indexOf(t)>=0)throw new Error("Edge already exists");this.edges.push(t)}_removeEdge(t){const e=this.edges.indexOf(t);if(e<0)throw new Error("Edge does not exist");this.edges.splice(e,1)}_add(t){t instanceof e?this._addSubgraph(t):t instanceof C?this._addVertex(t):this._addEdge(t)}},"Subgraph"),e),C=(i(r=class extends F{inEdges=[];outEdges=[];get edges(){return[...this.inEdges,...this.outEdges]}_;constructor(t,e,r){super(t,e),e._addVertex(this),this._=r}remove(t=!0,e){return this._graph.removeVertex(this,t,e)}addInEdge(t){this.inEdges.push(t)}removeInEdge(t){const e=this.inEdges.indexOf(t);if(e<0)throw new Error("In edge does not exist");this.inEdges.splice(e,1)}addOutEdge(t){this.outEdges.push(t)}removeOutEdge(t){const e=this.outEdges.indexOf(t);if(e<0)throw new Error("Out edge does not exist");this.outEdges.splice(e,1)}},"Vertex"),r),A=(i(s=class extends F{source;target;_;constructor(t,e,r,s,n){if(super(t,e),!r)throw new Error("Missing source vertex");if(!s)throw new Error("Missing target vertex");e._addEdge(this),this.source=r,this.source.addOutEdge(this),this.target=s,this.target.addInEdge(this),this._=n}remove(){this._graph.removeEdge(this)}},"Edge"),s);const L=class _Graph{root;_allSubgraphs=[];_allSubgraphsMap={};_allVertices=[];_allVerticesMap={};_allEdges=[];_allEdgesMap={};idOf;constructor(t=t=>""+t._,e){this.root=new $(this,null,e),this.idOf=t}createSubgraph(t,e){const r=new $(this,t||this.root,e);return this._allSubgraphs.push(r),this._allSubgraphsMap[this.idOf(r)]=r,r}removeSubgraph(t,e=!0){const r=this._allSubgraphs.indexOf(t);if(r<0)throw new Error("Subgraph does not exist");this._allSubgraphs.splice(r,1),delete this._allSubgraphsMap[this.idOf(t)],t.parent&&t.parent._removeSubgraph(t),t.edges.forEach(r=>e?this.removeEdge(r):t.parent._addEdge(r)),t.vertices.forEach(r=>e?this.removeVertex(r,e):t.parent._addVertex(r)),t.subgraphs.forEach(r=>e?this.removeSubgraph(r,e):t.parent._addSubgraph(r))}get subgraphs(){return this._allSubgraphs}subgraph(t){return this._allSubgraphsMap[t]}createVertex(t,e){const r=new C(this,t,e);return this._allVertices.push(r),this._allVerticesMap[this.idOf(r)]=r,r}removeVertex(t,e=!0,r){const s=this._allVertices.indexOf(t);if(s<0)throw new Error("Vertex does not exist");this._allVertices.splice(s,1),delete this._allVerticesMap[this.idOf(t)],t.parent&&t.parent._removeVertex(t),e||t.inEdges.forEach(e=>{t.outEdges.forEach(t=>{this.createEdge(this.root,e.source,t.target,r?r(e.source._,t.target._):void 0)})}),t.inEdges.forEach(t=>this.removeEdge(t)),t.outEdges.forEach(t=>this.removeEdge(t))}get vertices(){return this._allVertices}vertex(t){return this._allVerticesMap[t]}createEdge(t,e,r,s){const n=new A(this,t,e,r,s);return this._allEdges.push(n),this._allEdgesMap[this.idOf(n)]=n,n}removeEdge(t){const e=this._allEdges.indexOf(t);if(e<0)throw new Error("Edge does not exist");this._allEdges.splice(e,1),delete this._allEdgesMap[this.idOf(t)],t.parent&&t.parent._removeEdge(t),t.source.removeOutEdge(t),t.target.removeInEdge(t)}get edges(){return this._allEdges}edge(t){return this._allEdgesMap[t]}_walk(t,e){for(const r of t.subgraphs)switch(e(r)){case"abort":return!0;case"stepover":break;default:if(this._walk(r,e))return!0}for(const r of t.vertices)if("abort"===e(r))return!0}walk(t){this._walk(this.root,t);for(const e of this._allEdges)if("abort"===t(e))return!0}clone(){const t=new(0,this.constructor)(this.idOf,this.root._),e=N();return e.put(this.root,t.root),this.walk(t=>{const r=e.get(t.parent);if(t instanceof $)e.put(t,r.createSubgraph(t._));else if(t instanceof C)e.put(t,r.createVertex(t._));else if(t instanceof A){const s=e.get(t.source),n=e.get(t.target);r.createEdge(s,n,t._)}}),t}};i(L,"Graph");let P=L;function N(){const t=[],e=[];return{put(r,s){const n=t.indexOf(r);-1===n?(t.push(r),e.push(s)):e[n]=s},get:r=>e[t.indexOf(r)]}}i(N,"ObjMap");const j=class _GraphItem{_graph;_;id(){return this._graph.id(this._)}constructor(t,e){this._graph=t,this._=e}};i(j,"GraphItem");let q=j;const X=class _ChildGraphItem extends q{_parent;constructor(t,e){super(t,e)}clearParent(){return this._parent&&(this._parent.removeChild(this),delete this._parent),this}parent(t){return 0===arguments.length?this._parent:(this._parent!==t&&(this._parent&&this._parent.removeChild(this),this._parent=t,this._parent&&this._parent.addChild(this)),this)}};i(X,"ChildGraphItem");let G=X;const H=class _Subgraph extends G{_children=[];constructor(t,e){super(t,e)}children(){return this._children}addChild(t){this._children.push(t)}removeChild(t){this._children=this._children.filter(e=>e.id!==t.id)}};i(H,"Subgraph");let B=H;const R=class _Vertex extends G{_inEdges=[];_outEdges=[];constructor(t,e){super(t,e)}edges(){return[...this._inEdges,...this._outEdges]}edgeCount(){return this._outEdges.length+this._inEdges.length}inEdges(){return this._inEdges}addInEdge(t){this._inEdges.push(t)}removeInEdge(t){this._inEdges=this._inEdges.filter(e=>e._.id!==t)}outEdges(){return this._outEdges}addOutEdge(t){this._outEdges.push(t)}removeOutEdge(t){this._outEdges=this._outEdges.filter(e=>e._.id!==t)}};i(R,"Vertex");let U=R;const z=class _Edge extends G{_source;_target;constructor(t,e,r,s){super(t,e),this._source=r,this._target=s}};i(z,"Edge");let W=z;const J=class _Graph2{_directed;_subgraphMap={};_vertexMap={};_edgeMap={};constructor(t=!0){this._directed=t}clear(){return this._subgraphMap={},this._vertexMap={},this._edgeMap={},this}clearParents(){for(const t in this._subgraphMap)this._subgraphMap[t].clearParent();for(const t in this._vertexMap)this._vertexMap[t].clearParent();return this}isDirected(){return this._directed}_idFunc=/* @__PURE__ */i(t=>"function"==typeof t.id?t.id():t.id,"_idFunc");idFunc(t){return this._idFunc=t,this}_sourceFunc=/* @__PURE__ */i(t=>"function"==typeof t.source?t.source():t.source,"_sourceFunc");sourceFunc(t){return this._sourceFunc=t,this}_targetFunc=/* @__PURE__ */i(t=>"function"==typeof t.target?t.target():t.target,"_targetFunc");targetFunc(t){return this._targetFunc=t,this}_updateFunc=/* @__PURE__ */i((t,e)=>e,"_updateFunc");updateFunc(t){return this._updateFunc=t,this}id(t){return this._idFunc(t)}type(t){return this.subgraphExists(t)?"S":this.vertexExists(t)?"V":this.edgeExists(t)?"E":""}isSubgraph(t){return this.subgraphExists(this.id(t))}isVertex(t){return this.vertexExists(this.id(t))}isEdge(t){return this.edgeExists(this.id(t))}allItems(){return[...this.allSubgraphs(),...this.allVertices(),...this.allEdges()]}item(t){return this.subgraphExists(t)?this.subgraph(t):this.vertexExists(t)?this.vertex(t):this.edgeExists(t)?this.edge(t):void 0}itemExists(t){return this.edgeExists(t)||this.vertexExists(t)||this.subgraphExists(t)}allSubgraphs(){const t=[];for(const e in this._subgraphMap)t.push(this._subgraphMap[e]._);return t}subgraphs(){const t=[];for(const e in this._subgraphMap)void 0===this._subgraphMap[e].parent()&&t.push(this._subgraphMap[e]._);return t}subgraphExists(t){return!!this._subgraphMap[t]}subgraph(t){return this._subgraphMap[t]._}subgraphSubgraphs(t){return this._subgraphMap[t].children().filter(t=>this.isSubgraph(t._)).map(t=>t._)}subgraphVertices(t){return this._subgraphMap[t].children().filter(t=>this.isVertex(t._)).map(t=>t._)}subgraphEdges(t){return this._subgraphMap[t].children().filter(t=>this.isEdge(t._)).map(t=>t._)}addSubgraph(t,e){const r=this._idFunc(t);if(this._subgraphMap[r])throw new Error(`Subgraph '${r}' already exists.`);const s=new B(this,t);if(e){const t=this._idFunc(e);if(!this._subgraphMap[t])throw new Error(`Subgraph '${t}' does not exist.`);s.parent(this._subgraphMap[t])}return this._subgraphMap[r]=s,this}mergeSubgraphs(t=[]){const e=d(this.allSubgraphs(),t,t=>this._idFunc(t),this._updateFunc);return e.exit.forEach(t=>this.removeSubgraph(this._idFunc(t))),e.enter.forEach(t=>this.addSubgraph(t)),e.update.forEach(t=>this.updateSubgraph(t)),this}updateSubgraph(t){const e=this._idFunc(t),r=this._subgraphMap[e];if(!r)throw new Error(`Subgraph '${e}' does not exist.`);return r._=t,this}removeSubgraph(t,e=!0){const r=this._subgraphMap[t];if(!r)throw new Error(`Subgraph '${t}' does not exist.`);return r.children().forEach(t=>{e?t.parent(r.parent()):t instanceof B?this.removeSubgraph(t.id()):this.removeVertex(t.id())}),delete this._subgraphMap[t],this}subgraphParent(t,e){const r=this._subgraphMap[t];if(!r)throw new Error(`Subgraph '${t}' does not exist.`);if(void 0===e){const t=r.parent();return t?t._:void 0}const s=this._subgraphMap[e];if(!s)throw new Error(`Vertex parent '${s}' does not exist.`);return r.parent(s),this}allVertices(){const t=[];for(const e in this._vertexMap)t.push(this._vertexMap[e]._);return t}vertices(){const t=[];for(const e in this._vertexMap)void 0===this._vertexMap[e].parent()&&t.push(this._vertexMap[e]._);return t}vertexExists(t){return!!this._vertexMap[t]}vertex(t){return this._vertexMap[t]._}allEdges(){const t=[];for(const e in this._edgeMap)t.push(this._edgeMap[e]._);return t}edges(){const t=[];for(const e in this._edgeMap)void 0===this._edgeMap[e].parent()&&t.push(this._edgeMap[e]._);return t}vertexEdges(t){return this._vertexMap[t].edges().map(t=>t._)}inEdges(t){return this._vertexMap[t].inEdges().map(t=>t._)}outEdges(t){return this._vertexMap[t].outEdges().map(t=>t._)}_neighbors(t){return[...this._vertexMap[t].outEdges().map(t=>t._target),...this._vertexMap[t].inEdges().map(t=>t._source)]}neighbors(t){return this._neighbors(t).map(t=>t._)}singleNeighbors(t){return this._neighbors(t).filter(t=>1===t.edgeCount()).map(t=>t._)}addVertex(t,e){const r=this._idFunc(t);if(this._vertexMap[r])throw new Error(`Vertex '${r}' already exists.`);const s=new U(this,t);if(e){const t=this._idFunc(e);if(!this.subgraphExists(t))throw new Error(`Subgraph '${t}' does not exist.`);s.parent(this._subgraphMap[t])}return this._vertexMap[r]=s,this}mergeVertices(t){const e=d(this.allVertices(),t,t=>this._idFunc(t),this._updateFunc);return e.exit.forEach(t=>this.removeVertex(this._idFunc(t))),e.enter.forEach(t=>this.addVertex(t)),e.update.forEach(t=>this.updateVertex(t)),this}updateVertex(t){const e=this._idFunc(t),r=this._vertexMap[e];if(!r)throw new Error(`Vertex '${e}' does not exist.`);return r._=t,this}removeVertex(t){const e=this._vertexMap[t];if(!e)throw new Error(`Vertex '${t}' does not exist.`);return e.edges().forEach(t=>{this.removeEdge(t.id())}),delete this._vertexMap[t],this}vertexParent(t,e){const r=this._vertexMap[t];if(!r)throw new Error(`Vertex '${t}' does not exist.`);if(void 0===e){const t=r.parent();return t?t._:void 0}const s=this._subgraphMap[e];if(!s)throw new Error(`Vertex parent '${s}' does not exist.`);return r.parent(s),this}edgeExists(t){return!!this._edgeMap[t]}edge(t){return this._edgeMap[t]._}addEdge(t,e){const r=this._idFunc(t),s=this._sourceFunc(t),n=this._targetFunc(t);if(this._edgeMap[r])throw new Error(`Edge '${r}' already exists.`);if(!this.vertexExists(s))throw new Error(`Edge Source '${s}' does not exist.`);if(!this.vertexExists(n))throw new Error(`Edge Target '${n}' does not exist.`);const i=new W(this,t,this._vertexMap[s],this._vertexMap[n]);if(e){const t=this._idFunc(e);if(!this.subgraphExists(t))throw new Error(`Subgraph '${t}' does not exist.`);i.parent(this._subgraphMap[t])}return this._edgeMap[r]=i,this._vertexMap[s].addOutEdge(i),this._vertexMap[n].addInEdge(i),this}mergeEdges(t){const e=d(this.allEdges(),t,t=>this._idFunc(t),this._updateFunc);return e.exit.forEach(t=>this.removeEdge(this._idFunc(t))),e.enter.forEach(t=>this.addEdge(t)),e.update.forEach(t=>this.updateEdge(t)),this}updateEdge(t){const e=this._idFunc(t),r=this._edgeMap[e];if(!r)throw new Error(`Edge '${e}' does not exist.`);const s=r._source.id(),n=this._sourceFunc(t);s!==n&&(this._vertexMap[s]?.removeOutEdge(e),this._vertexMap[n]?.addOutEdge(r));const i=r._target.id(),o=this._targetFunc(t);return i!==o&&(this._vertexMap[i]?.removeInEdge(e),this._vertexMap[o]?.addInEdge(r)),r._=t,r._source=this._vertexMap[n],r._target=this._vertexMap[o],this}removeEdge(t){const e=this._edgeMap[t];if(!e)throw new Error(`Edge '${t}' does not exist.`);const r=this._idFunc(e._source._);if(!this.vertexExists(r))throw new Error(`Edge Source'${r}' does not exist.`);this._vertexMap[r].removeOutEdge(t);const s=this._idFunc(e._target._);if(!this.vertexExists(s))throw new Error(`Edge Target'${s}' does not exist.`);return this._vertexMap[s].removeInEdge(t),delete this._edgeMap[t],this}_hwalk(t,e){return t instanceof B?e("subgraph",t._,t.children().map(t=>this._hwalk(t,e))):e("vertex",t._)}hierarchy(t){const e=[];for(const r in this._subgraphMap){const s=this._subgraphMap[r];void 0===s.parent()&&e.push(this._hwalk(s,t))}for(const r in this._vertexMap){const s=this._vertexMap[r];void 0===s.parent()&&e.push(this._hwalk(s,t))}return e}dijkstra(t,e){const r=this.allEdges(),s=new Y,n={},o={},a={};function h(t,e){let r=1/0,s=null;return t.forEach(t=>{e[t]<r&&(r=e[t],s=t)}),s}i(h,"vertex_with_min_dist");for(let i=0;i<r.length;i++){const t=this._sourceFunc(r[i]),e=this._targetFunc(r[i]),n=1;s.add(t),s.add(e),o[t]=1/0,o[e]=1/0,void 0===a[t]&&(a[t]={}),void 0===a[e]&&(a[e]={}),a[t][e]=n,a[e][t]=n}for(o[t]=0;s.size;){const t=h(s,o);if(null===t)break;const r=Object.keys(a[t]).filter(t=>s.has(t));if(s.delete(t),t===e)break;for(const e of r){const r=o[t]+a[t][e];r<o[e]&&(o[e]=r,n[e]=t)}}let c=e;const u=[c];let d=0;for(;void 0!==n[c];)u.unshift(n[c]),d+=a[c][n[c]],c=n[c];return{ids:u,len:d}}sort(t){const e=[],r={},s=/* @__PURE__ */i((t,n=[])=>{const i=t.id();r[i]||(r[i]=!0,n.push(t),t.outEdges().forEach(t=>{n.indexOf(t._target)<0&&s(t._target,[...n])}),e.unshift(t._))},"visit");if(t)s(this._vertexMap[t]);else for(const n in this._vertexMap)s(this._vertexMap[n]);return e}};i(J,"Graph2");let Q=J;const K=class _Set{_content=[];get size(){return this._content.length}has(t){return this._content.indexOf(t)>=0}add(t){this.has(t)||this._content.push(t)}delete(t){const e=this._content.indexOf(t);e>=0&&this._content.splice(e,1)}forEach(t){this._content.forEach(t)}};i(K,"Set");let Y=K;const Z=Array.isArray,tt=Object.keys,et=Object.prototype.hasOwnProperty;function rt(t,e,r=!1){if(t===e)return!0;if(t&&e){if("object"==typeof t&&"object"==typeof e){const s=Z(t),n=Z(e);let i,o,a;if(s&&n){if(o=t.length,o!==e.length)return console.warn(`lengths not equal: ${o} !== ${e.length}`),!1;for(i=o;0!==i--;)if(!rt(t[i],e[i],r))return!1;return!0}if(s!==n)return console.warn(`arrays not equal: ${s} !== ${n}`),!1;const h=t instanceof Date,c=e instanceof Date;if(h!==c)return console.warn(`dates not equal: ${h} !== ${c}`),!1;if(h&&c){const r=t.getTime()===e.getTime();return r||console.warn(`dates not equal: ${t.getTime()} !== ${e.getTime()}`),r}const u=t instanceof RegExp,d=e instanceof RegExp;if(u!==d)return console.warn(`regexps not equal: ${u} !== ${d}`),!1;if(u&&d){const r=t.toString()===e.toString();return r||console.warn(`regexps not equal: ${t.toString()} !== ${e.toString()}`),r}const l=tt(t);if(o=l.length,o!==tt(e).length)return console.warn(`key lengths not equal: ${o} !== ${tt(e).length}`),!1;for(i=o;0!==i--;)if(!et.call(e,l[i]))return console.warn(`${l[i]} in a but not b`),!1;for(i=o;0!==i--;)if(a=l[i],!rt(t[a],e[a],r))return!1;return!0}if(!r&&"function"==typeof t&&"function"==typeof e){const r=t.toString()===e.toString();return r||console.warn(`functions not equal: ${t.toString()} !== ${e.toString()}`),r}}const s=t!=t&&e!=e;return s||console.warn(`values not equal: ${t} !== ${e}`),s}function st(t,e,r=!1){if(t===e)return!0;if(t&&e){if("object"==typeof t&&"object"==typeof e){const s=Z(t),n=Z(e);let i,o,a;if(s&&n){if(o=t.length,o!==e.length)return!1;for(i=o;0!==i--;)if(!st(t[i],e[i],r))return!1;return!0}if(s!==n)return!1;const h=t instanceof Date,c=e instanceof Date;if(h!==c)return!1;if(h&&c)return t.getTime()===e.getTime();const u=t instanceof RegExp,d=e instanceof RegExp;if(u!==d)return!1;if(u&&d)return t.toString()===e.toString();const l=tt(t);if(o=l.length,o!==tt(e).length)return!1;for(i=o;0!==i--;)if(!et.call(e,l[i]))return!1;for(i=o;0!==i--;)if(a=l[i],!st(t[a],e[a],r))return!1;return!0}if(!r&&"function"==typeof t&&"function"==typeof e)return t.toString()===e.toString()}return t!=t&&e!=e}function nt(t,e,r=!1){return st(t,e,r)?t:e}i(rt,"verboseDeepEquals"),i(st,"deepEquals"),i(nt,"update");const it="undefined"!=typeof globalThis?globalThis:window,ot="undefined"!=typeof window&&it===window,at="undefined"!=typeof process&&null!=process.versions&&null!=process.versions.node,ht=at&&null!=process.env&&(null!=process.env.TRAVIS||null!=process.env.GITHUB_ACTIONS||null!=process.env.CI);function ct(t){const e=document.scripts||[];for(let r=document.scripts.length-1;r>=0;--r){const s=e[r];if(s.src){const e=s.src.indexOf(t);if(e>=0)return s.src.substring(0,e)}}return""}i(ct,"getScriptSrc");const ut=class _Stack{stack=[];push(t){return this.stack.push(t),t}pop(){return this.stack.pop()}top(){return this.stack.length?this.stack[this.stack.length-1]:void 0}depth(){return this.stack.length}};i(ut,"Stack");let dt=ut;var lt=/* @__PURE__ */(t=>(t[t.debug=0]="debug",t[t.info=1]="info",t[t.notice=2]="notice",t[t.warning=3]="warning",t[t.error=4]="error",t[t.critical=5]="critical",t[t.alert=6]="alert",t[t.emergency=7]="emergency",t))(lt||{});const pt={debug:"cyan",info:"green",notice:"grey",warning:"blue",error:"red",critical:"magenta",alert:"magenta",emergency:"magenta"},gt=class _ConsoleWriter{write(t,e,r,s){at?console.log(`[${t}] ${lt[e].toUpperCase()} ${r}: ${s}`):console.log(`[${t}] %c${lt[e].toUpperCase()}%c ${r}: ${s}`,`color:${pt[lt[e]]}`,"")}};i(gt,"ConsoleWriter");let _t=gt;const ft=class _Logging{_levelStack=new dt;_level=1;_filter="";_writer=new _t;static Instance(){return this._instance||(this._instance=new this)}constructor(){}stringify(t){const e=[];return JSON.stringify(t,function(t,r){if("object"==typeof r&&null!==r){if(-1!==e.indexOf(r))return;e.push(r)}return r},2)}writer(t){return void 0===t?this._writer:(this._writer=t,this)}log(t,e,r){if(t<this._level)return;if(this._filter&&this._filter!==e)return;const s=/* @__PURE__ */(new Date).toISOString();this._writer.rawWrite?this._writer.rawWrite(s,t,e,r):("string"!=typeof r&&(r=this.stringify(r)),this._writer.write&&this._writer.write(s,t,e,r))}debug(t,e){this.log(0,t,e)}info(t,e){this.log(1,t,e)}notice(t,e){this.log(2,t,e)}warning(t,e){this.log(3,t,e)}error(t,e){this.log(4,t,e)}critical(t,e){this.log(5,t,e)}alert(t,e){this.log(6,t,e)}emergency(t,e){this.log(7,t,e)}level(t){return void 0===t?this._level:(this._level=t,this)}pushLevel(t){return this._levelStack.push(this._level),this._level=t,this}popLevel(){return this._level=this._levelStack.pop(),this}filter(t){return void 0===t?this._filter:(this._filter=t,this)}};var vt,bt;i(ft,"Logging"),((t,e,r)=>{e in t?n(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r})(ft,"symbol"!=typeof(vt="_instance")?vt+"":vt,bt);let Et=ft;const xt=Et.Instance(),mt=class _ScopedLogging{_scopeID;constructor(t){this._scopeID=t}debug(t){xt.debug(this._scopeID,t)}info(t){xt.info(this._scopeID,t)}notice(t){xt.notice(this._scopeID,t)}warning(t){xt.warning(this._scopeID,t)}error(t){xt.error(this._scopeID,t)}critical(t){xt.critical(this._scopeID,t)}alert(t){xt.alert(this._scopeID,t)}emergency(t){xt.emergency(this._scopeID,t)}pushLevel(t){return xt.pushLevel(t),this}popLevel(){return xt.popLevel(),this}};i(mt,"ScopedLogging");let wt=mt;function Mt(t,e=!1){return e&&xt.filter(t),new wt(t)}function St(t){return t*(Math.PI/180)}function yt(t){return t*(180/Math.PI)}function Ot(t,e){return{x:t*Math.cos(e),y:t*Math.sin(e)}}function Vt(t,e){return{r:Math.sqrt(t*t+e*e),theta:Math.atan2(e,t)}}function It(t,e=-Math.PI,r=Math.PI){return kt(t,e,r)}function Dt(t,e=-180,r=180){return kt(t,e,r)}function kt(t,e,r){const s=r-e,n=t-e;return n-Math.floor(n/s)*s+e}function Tt(t,e){if(void 0!==t&&void 0!==e){for(const r of t.split(".")){if(!e.hasOwnProperty(r))return;e=e[r]}return e}}function Ft(t,e){return void 0!==Tt(t,e)}function $t(t,e){const r={};for(const s in e){if(!e.hasOwnProperty(s))continue;if("__proto__"===s||"constructor"===s)continue;let n=e[s];n instanceof Array||"object"==typeof n&&(n=Ct(t[s],n)),s in t&&(t[s]===n||s in r&&r[s]===n)||(t[s]=n)}return t}function Ct(t={},...e){if("object"!=typeof t)throw new Error(`Destination "${t}" must be an object.`);for(const r of e)$t(t,r);return t}function At(t={},...e){return Ct(t,...e)}function Lt(t){const e=[];return JSON.stringify(t,function(t,r){if("object"==typeof r&&null!==r){if(-1!==e.indexOf(r))return;e.push(r)}return r})}function Pt(t){return void 0!==Array.isArray?Array.isArray(t):"[object Array]"===Object.prototype.toString.call(t)}function Nt(t){const e=t.split("_"),r=e[1].split(".");return{module:`@hpcc-js/${e[0]}`,file:r[0],class:r[1]||r[0]}}i(Mt,"scopedLogger"),i(St,"degreesToRadians"),i(yt,"radiansToDegrees"),i(Ot,"polarToCartesian"),i(Vt,"cartesianToPolar"),i(It,"normalizeRadians"),i(Dt,"normalizeDegrees"),i(kt,"normalize"),i(Tt,"inner"),i(Ft,"exists"),i($t,"_mixin"),i(Ct,"deepMixin"),i(At,"deepMixinT"),i(Lt,"safeStringify"),i(Pt,"isArray"),i(Nt,"classID2Meta");const jt=class _ObserverHandle{eventTarget;eventID;callback;constructor(t,e,r){this.eventTarget=t,this.eventID=e,this.callback=r}release(){this.eventTarget.removeObserver(this.eventID,this.callback)}unwatch(){this.release()}};i(jt,"ObserverHandle");let qt=jt;const Xt=class _Observable{_eventObservers={};constructor(...t){}addObserver(t,e){let r=this._eventObservers[t];return r||(r=[],this._eventObservers[t]=r),r.push(e),new qt(this,t,e)}removeObserver(t,e){const r=this._eventObservers[t];if(r)for(let s=r.length-1;s>=0;--s)r[s]===e&&r.splice(s,1);return this}dispatchEvent(t,...e){const r=this._eventObservers[t];if(r)for(const s of r)s(...e);return this}_hasObserver(t){const e=this._eventObservers[t];for(const r in e)if(e[r])return!0;return!1}hasObserver(t){if(void 0!==t)return this._hasObserver(t);for(const e in this._eventObservers)if(this._hasObserver(e))return!0;return!1}};i(Xt,"Observable");let Gt,Ht=Xt;!function(){if(it.requestAnimationFrame)Gt=it.requestAnimationFrame;else{let t=0;Gt=/* @__PURE__ */i(function(e){const r=/* @__PURE__ */(new Date).getTime(),s=Math.max(0,16-(r-t)),n=setTimeout(()=>e(r+s),s);return t=r+s,n},"requestAnimationFrame")}}();const Bt=class _Message{get canConflate(){return!1}conflate(t){return!1}void(){return!1}};i(Bt,"Message");let Rt=Bt;const Ut=class _Dispatch{_observerID=0;_observers=[];_messageBuffer=[];_rafHandle=void 0;constructor(){}observers(){return this._observers}messages(){const t=[];return this._messageBuffer.forEach(e=>{t.some(t=>t.canConflate&&t.conflate(e))||t.push(e)}),t}dispatchAll(){this._rafHandle=void 0,this.dispatch(this.messages()),this.flush()}dispatch(t){0!==t.length&&this.observers().forEach(e=>{const r=t.filter(t=>!t.void()&&(void 0===e.type||t instanceof e.type));r.length&&e.callback(r)})}hasObserver(){return this._observers.length>0}flush(){this._messageBuffer=[]}send(t){this.hasObserver()&&this.dispatch([t])}post(t){this.hasObserver()&&(this._messageBuffer.push(t),void 0===this._rafHandle&&(this._rafHandle=Gt(()=>this.dispatchAll())))}attach(t,e){const r=this,s=++this._observerID;return this._observers.push({id:s,type:e,callback:t}),{release(){r._observers=r._observers.filter(t=>t.id!==s)},unwatch(){this.release()}}}};i(Ut,"Dispatch");let zt=Ut;const Wt=class _XMLNode{name="";$={};_children=[];content="";constructor(t){this.name=t}appendAttribute(t,e){this.$[t]=e}appendContent(t){this.content+=t}appendChild(t){this._children.push(t)}children(t){return void 0===t?this._children:this._children.filter(e=>e.name===t)}};i(Wt,"XMLNode");let Jt=Wt;const Qt=class _SAXStackParser{root;stack=new dt;constructor(){}walkDoc(t){const e=this._startXMLNode(t);if(t.attributes)for(let r=0;r<t.attributes.length;++r){const e=t.attributes.item(r);this.attributes(e.nodeName,e.nodeValue)}if(this.startXMLNode(e),t.childNodes)for(let r=0;r<t.childNodes.length;++r){const e=t.childNodes.item(r);e.nodeType===e.TEXT_NODE?this.characters(e.nodeValue):this.walkDoc(e)}this.endXMLNode(this.stack.pop())}_startXMLNode(t){const e=new Jt(t.nodeName);return this.stack.depth()?this.stack.top().appendChild(e):this.root=e,this.stack.push(e)}parse(t){const e=(new DOMParser).parseFromString(t,"application/xml");this.startDocument(),this.walkDoc(e),this.endDocument()}startDocument(){}endDocument(){}startXMLNode(t){}endXMLNode(t){}attributes(t,e){this.stack.top().appendAttribute(t,e)}characters(t){this.stack.top().appendContent(t)}};i(Qt,"SAXStackParser");let Kt=Qt;const Yt=class _XML2JSONParser extends Kt{startXMLNode(t){super.startXMLNode(t),t.name}endXMLNode(t){t.name,super.endXMLNode(t)}};i(Yt,"XML2JSONParser");let Zt=Yt;function te(t){const e=new Zt;return e.parse(t),e.root}i(te,"xml2json");const ee=class _PropChangedMessage extends Rt{constructor(t,e,r){super(),this.property=t,this.newValue=e,this.oldValue=r}get canConflate(){return!0}conflate(t){return this.property===t.property&&(this.newValue=t.newValue,!0)}void(){return st(this.newValue,this.oldValue)}};i(ee,"PropChangedMessage");let re=ee;const se=class _StateObject{_espState={};_dispatch=new zt;_monitorHandle;_monitorTickCount=0;clear(t){this._espState={},void 0!==t&&this.set(t),this._monitorTickCount=0}get(t,e){return void 0===t?this._espState:this.has(t)?this._espState[t]:e}set(t,e){if("string"==typeof t)return this.setSingle(t,e);this.setAll(t)}setSingle(t,e){const r=this._espState[t];this._espState[t]=e,this._dispatch.post(new re(t,e,r))}setAll(t){for(const e in t)t.hasOwnProperty(e)&&this.setSingle(e,t[e])}has(t){return void 0!==this._espState[t]}addObserver(t,e,r){if(this.isCallback(e)){if("changed"!==t)throw new Error("Invalid eventID: "+t);return this._dispatch.attach(t=>{e(t.map(t=>({id:t.property,oldValue:t.oldValue,newValue:t.newValue})))})}if("propChanged"!==t)throw new Error("Invalid eventID: "+t);return this._dispatch.attach(t=>{const s=t.filter(t=>t.property===e);if(s.length){s.length>1&&console.warn("Should only be 1 message?");const t=s[s.length-1];r({id:t.property,oldValue:t.oldValue,newValue:t.newValue})}})}on(t,e,r){return this.addObserver(t,e,r),this}isCallback(t){return"function"==typeof t}hasEventListener(){return this._dispatch.hasObserver()}async refresh(t=!1){return await Promise.resolve(),this}_monitor(){this._monitorHandle?this._monitorTickCount=0:this._monitorHandle=setTimeout(()=>{(this.hasEventListener()?this.refresh():Promise.resolve()).then(()=>{this._monitor()}),delete this._monitorHandle},this._monitorTimeoutDuration())}_monitorTimeoutDuration(){return++this._monitorTickCount,this._monitorTickCount<=1?0:3e4}watch(t,e=!0){if("function"!=typeof t)throw new Error("Invalid Callback");e&&setTimeout(()=>{const e=this.get(),r=[];for(const t in e)e.hasOwnProperty(e)&&r.push({id:t,newValue:e[t],oldValue:void 0});t(r)},0);const r=this.addObserver("changed",t);return this._monitor(),r}};i(se,"StateObject");let ne=se;function ie(t,e){if("string"!=typeof e)return t;if(0===e.length)return t;for(;0===t.indexOf(e);)t=t.substring(1);for(;oe(t,e);)t=t.substring(0,t.length-1);return t}function oe(t,e,r){const s=t.toString();("number"!=typeof r||!isFinite(r)||Math.floor(r)!==r||r>s.length)&&(r=s.length),r-=e.length;const n=s.lastIndexOf(e,r);return-1!==n&&n===r}function ae(...t){const e=t.reduce((t,e)=>(t.length>0&&(e=e.replace(/^\//,"")),e=e.replace(/\/$/,""),[...t,...e.split("/")]),[]),r=[];for(const s of e)"."!==s&&(".."!==s?r.push(s):r.pop());return r.join("/")}function he(t){return ae(t,"..")}i(ie,"trim"),i(oe,"endsWith"),i(ae,"join"),i(he,"dirname");const ce="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";function ue(t){if("undefined"!=typeof TextEncoder)return(new TextEncoder).encode(t);const e=encodeURIComponent(t),r=[];for(let s=0;s<e.length;++s)"%"===e[s]?(r.push(parseInt(e.substring(s+1,s+3),16)),s+=2):r.push(e.charCodeAt(s));return Uint8Array.from(r)}function de(t){let e="";for(let r=0;r<t.length;r+=3){const s=t[r],n=r+1<t.length,i=r+2<t.length,o=n?t[r+1]:0,a=i?t[r+2]:0;e+=ce[s>>2],e+=ce[(3&s)<<4|o>>4],e+=n?ce[(15&o)<<2|a>>6]:"=",e+=i?ce[63&a]:"="}return e}function le(t=""){const e=null==t?"":String(t),r=globalThis?.Buffer;return r?.from?r.from(e,"utf8").toString("base64"):de(ue(e))}i(ue,"toUTF8Bytes"),i(de,"bytesToBase64"),i(le,"utf8ToBase64");export{m as AsyncCache,y as AsyncOrderedQueue,h as BUILD_VERSION,E as Cache,I as Dictionary,k as DictionaryNoCase,zt as Dispatch,A as Edge,P as Graph,Q as Graph2,F as GraphItem,lt as Level,Et as Logging,Rt as Message,Ht as Observable,o as PKG_NAME,a as PKG_VERSION,Kt as SAXStackParser,wt as ScopedLogging,dt as Stack,ne as StateObject,$ as Subgraph,C as Vertex,Jt as XMLNode,Vt as cartesianToPolar,Nt as classID2Meta,u as compare,d as compare2,w as debounce,st as deepEquals,Ct as deepMixin,At as deepMixinT,St as degreesToRadians,he as dirname,oe as endsWith,T as espTime2Seconds,Ft as exists,c as find,ct as getScriptSrc,v as hashSum,Tt as inner,Pt as isArray,ot as isBrowser,ht as isCI,at as isNode,ae as join,xt as logger,kt as normalize,Dt as normalizeDegrees,It as normalizeRadians,Ot as polarToCartesian,M as promiseTimeout,yt as radiansToDegrees,it as root,Lt as safeStringify,Mt as scopedLogger,O as sleep,ie as trim,nt as update,le as utf8ToBase64,rt as verboseDeepEquals,te as xml2json};
1
+ var t,e,r,s,n=Object.defineProperty,i=(t,e)=>n(t,"name",{value:e,configurable:!0});const o="@hpcc-js/util",a="3.5.0",h="3.21.0";function c(t,e){if(null==t)throw new TypeError('"o" is null or not defined');const r=t.length>>>0;if("function"!=typeof e)throw new TypeError("predicate must be a function");const s=arguments[1];let n=0;for(;n<r;){const r=t[n];if(e.call(s,r,n))return r;n++}}function u(t,e){const r={update:[],exit:[],enter:[...e]};for(const s of t){const t=r.enter.indexOf(s);t>=0?(r.update.push(s),r.enter.splice(t,1)):r.exit.push(s)}return r}function d(t,e,r,s=(t,e)=>e){const n={update:[],exit:[],enter:[]};if(t===e)return n.update=t,n;const i={};e.forEach(t=>{i[r(t)]=t});for(const o of t){const t=r(o),e=i[t];void 0!==e?(delete i[t],n.update.push(s(o,e))):n.exit.push(o)}for(const o in i)n.enter.push(i[o]);return n}function l(t,e){for(;t.length<e;)t="0"+t;return t}function p(t,e){if(0===e.length)return t;for(let r=0;r<e.length;++r){t=(t<<5)-t+e.charCodeAt(r),t|=0}return t<0?-2*t:t}function g(t,e,r){return"function"==typeof e.hashSum?e.hashSum():Object.keys(e).sort().reduce((t,s)=>_(t,e[s],s,r),t)}function _(t,e,r,s){const n=p(p(p(t,r),f(e)),typeof e);return null===e?p(n,"null"):void 0===e?p(n,"undefined"):"object"==typeof e?-1!==s.indexOf(e)?p(n,"[Circular]"+r):(s.push(e),g(n,e,s)):p(n,e.toString())}function f(t){return Object.prototype.toString.call(t)}function v(t){return l(_(0,t,"",[]).toString(16),8)}i(c,"find"),i(u,"compare"),i(d,"compare2"),i(l,"pad"),i(p,"fold"),i(g,"foldObject"),i(_,"foldValue"),i(f,"toString"),i(v,"hashSum");const b=class _Cache{_cache={};_calcID;static hash(...t){return v({...t})}constructor(t){this._calcID=t}has(t){return this._calcID(t)in this._cache}set(t){return this._cache[this._calcID(t)]=t,t}get(t,e){const r=this._cache[this._calcID(t)];return r||(e?this.set(e()):null)}};i(b,"Cache");let E=b;const x=class _AsyncCache{_cache={};_calcID;static hash(...t){return v({...t})}constructor(t){this._calcID=t}has(t){return this._calcID(t)in this._cache}set(t,e){return this._cache[this._calcID(t)]=e,e}get(t,e){const r=this._cache[this._calcID(t)];return r||(e?this.set(t,e()):Promise.resolve(null))}};i(x,"AsyncCache");let m=x;function w(t,e){const r={};return(...s)=>{const n=v(s);return r[n]||(r[n]={clockStart:Date.now(),promise:t(...s).then(t=>(void 0===e?r[n]=null:setTimeout(()=>{r[n]=null},Math.max(e-(Date.now()-r[n].clockStart),0)),t)).catch(t=>{throw r[n]=null,t})}),r[n].promise}}function M(t,e){let r;const s=new Promise((e,s)=>{r=setTimeout(()=>{clearTimeout(r),s("Timed out in "+t+"ms.")},t)});return Promise.race([e,s]).then(t=>(clearTimeout(r),t)).catch(t=>{throw clearTimeout(r),t})}i(w,"debounce"),i(M,"promiseTimeout");const S=class _AsyncOrderedQueue{_q=[];isTop(t){return this._q[0]===t}push(t){const e=t.then(t=>this.isTop(e)?(this._q.shift(),t):new Promise((r,s)=>{const n=setInterval(()=>{this.isTop(e)&&(clearInterval(n),this._q.shift(),r(t))},20)}));return this._q.push(e),e}};i(S,"AsyncOrderedQueue");let y=S;function O(t){return new Promise(e=>{setTimeout(()=>e(),t)})}i(O,"sleep");const V=class _Dictionary{store={};constructor(t){if(t)for(const e in t)this.set(e,t[e])}set(t,e){const r=this.store[t];return this.store[t]=e,r}get(t){return this.store[t]}has(t){return void 0!==this.store[t]}remove(t){delete this.store[t]}keys(){const t=[];for(const e in this.store)t.push(e);return t}values(){const t=[];for(const e in this.store)t.push(this.store[e]);return t}};i(V,"Dictionary");let I=V;const D=class _DictionaryNoCase extends I{constructor(t){super(t)}set(t,e){return super.set(t.toLowerCase(),e)}get(t){return super.get(t.toLowerCase())}has(t){return super.has(t.toLowerCase())}remove(t){return super.remove(t.toLowerCase())}};i(D,"DictionaryNoCase");let k=D;function T(t){if(!t)return 0;if(!isNaN(Number(t)))return Number(t);const e=t.indexOf("ns");if(-1!==e)return parseFloat(t.substr(0,e))/1e9;const r=t.indexOf("ms");if(-1!==r)return parseFloat(t.substr(0,r))/1e3;const s=t.indexOf("s");if(-1!==s&&-1===t.indexOf("days"))return parseFloat(t.substr(0,s));const n=t.split(" days "),i=n.length>1?parseFloat(n[0]):0;let o=0;const a=(n.length>1?n[1]:n[0]).split(":").reverse();for(let h=0;h<a.length;++h)o+=parseFloat(a[h])*Math.pow(60,h);return 24*i*60*60+o}i(T,"espTime2Seconds");let F=(i(t=class{_graph;parent;props={};constructor(t,e){this._graph=t,this.parent=e}},"GraphItem"),t),$=(i(e=class extends F{subgraphs=[];vertices=[];edges=[];_;constructor(t,e,r){super(t,e),e&&e._addSubgraph(this),this._=r}remove(t=!0){this._graph.removeSubgraph(this,t)}createSubgraph(t){return this._graph.createSubgraph(this,t)}_addSubgraph(t){if(this.subgraphs.indexOf(t)>=0)throw new Error("Subgraph already exists");this.subgraphs.push(t)}_removeSubgraph(t){const e=this.subgraphs.indexOf(t);if(e<0)throw new Error("Subgraph does not exist");this.subgraphs.splice(e,1)}removeAllSubgraphs(){for(let t=this.subgraphs.length-1;t>=0;--t)this._graph.removeSubgraph(this.subgraphs[t],!0)}createVertex(t){return this._graph.createVertex(this,t)}_addVertex(t){if(this.vertices.indexOf(t)>=0)throw new Error("Vertex already exists");this.vertices.push(t)}_removeVertex(t){const e=this.vertices.indexOf(t);if(e<0)throw new Error("Vertex does not exist");this.vertices.splice(e,1)}removeAllVertices(){for(let t=this.vertices.length-1;t>=0;--t)this._graph.removeVertex(this.vertices[t],!0)}createEdge(t,e,r){return this._graph.createEdge(this,t,e,r)}_addEdge(t){if(this.edges.indexOf(t)>=0)throw new Error("Edge already exists");this.edges.push(t)}_removeEdge(t){const e=this.edges.indexOf(t);if(e<0)throw new Error("Edge does not exist");this.edges.splice(e,1)}_add(t){t instanceof e?this._addSubgraph(t):t instanceof C?this._addVertex(t):this._addEdge(t)}},"Subgraph"),e),C=(i(r=class extends F{inEdges=[];outEdges=[];get edges(){return[...this.inEdges,...this.outEdges]}_;constructor(t,e,r){super(t,e),e._addVertex(this),this._=r}remove(t=!0,e){return this._graph.removeVertex(this,t,e)}addInEdge(t){this.inEdges.push(t)}removeInEdge(t){const e=this.inEdges.indexOf(t);if(e<0)throw new Error("In edge does not exist");this.inEdges.splice(e,1)}addOutEdge(t){this.outEdges.push(t)}removeOutEdge(t){const e=this.outEdges.indexOf(t);if(e<0)throw new Error("Out edge does not exist");this.outEdges.splice(e,1)}},"Vertex"),r),A=(i(s=class extends F{source;target;_;constructor(t,e,r,s,n){if(super(t,e),!r)throw new Error("Missing source vertex");if(!s)throw new Error("Missing target vertex");e._addEdge(this),this.source=r,this.source.addOutEdge(this),this.target=s,this.target.addInEdge(this),this._=n}remove(){this._graph.removeEdge(this)}},"Edge"),s);const L=class _Graph{root;_allSubgraphs=[];_allSubgraphsMap={};_allVertices=[];_allVerticesMap={};_allEdges=[];_allEdgesMap={};idOf;constructor(t=t=>""+t._,e){this.root=new $(this,null,e),this.idOf=t}createSubgraph(t,e){const r=new $(this,t||this.root,e);return this._allSubgraphs.push(r),this._allSubgraphsMap[this.idOf(r)]=r,r}removeSubgraph(t,e=!0){const r=this._allSubgraphs.indexOf(t);if(r<0)throw new Error("Subgraph does not exist");this._allSubgraphs.splice(r,1),delete this._allSubgraphsMap[this.idOf(t)],t.parent&&t.parent._removeSubgraph(t),t.edges.forEach(r=>e?this.removeEdge(r):t.parent._addEdge(r)),t.vertices.forEach(r=>e?this.removeVertex(r,e):t.parent._addVertex(r)),t.subgraphs.forEach(r=>e?this.removeSubgraph(r,e):t.parent._addSubgraph(r))}get subgraphs(){return this._allSubgraphs}subgraph(t){return this._allSubgraphsMap[t]}createVertex(t,e){const r=new C(this,t,e);return this._allVertices.push(r),this._allVerticesMap[this.idOf(r)]=r,r}removeVertex(t,e=!0,r){const s=this._allVertices.indexOf(t);if(s<0)throw new Error("Vertex does not exist");this._allVertices.splice(s,1),delete this._allVerticesMap[this.idOf(t)],t.parent&&t.parent._removeVertex(t),e||t.inEdges.forEach(e=>{t.outEdges.forEach(t=>{this.createEdge(this.root,e.source,t.target,r?r(e.source._,t.target._):void 0)})}),t.inEdges.forEach(t=>this.removeEdge(t)),t.outEdges.forEach(t=>this.removeEdge(t))}get vertices(){return this._allVertices}vertex(t){return this._allVerticesMap[t]}createEdge(t,e,r,s){const n=new A(this,t,e,r,s);return this._allEdges.push(n),this._allEdgesMap[this.idOf(n)]=n,n}removeEdge(t){const e=this._allEdges.indexOf(t);if(e<0)throw new Error("Edge does not exist");this._allEdges.splice(e,1),delete this._allEdgesMap[this.idOf(t)],t.parent&&t.parent._removeEdge(t),t.source.removeOutEdge(t),t.target.removeInEdge(t)}get edges(){return this._allEdges}edge(t){return this._allEdgesMap[t]}_walk(t,e){for(const r of t.subgraphs)switch(e(r)){case"abort":return!0;case"stepover":break;default:if(this._walk(r,e))return!0}for(const r of t.vertices)if("abort"===e(r))return!0}walk(t){this._walk(this.root,t);for(const e of this._allEdges)if("abort"===t(e))return!0}clone(){const t=new(0,this.constructor)(this.idOf,this.root._),e=N();return e.put(this.root,t.root),this.walk(t=>{const r=e.get(t.parent);if(t instanceof $)e.put(t,r.createSubgraph(t._));else if(t instanceof C)e.put(t,r.createVertex(t._));else if(t instanceof A){const s=e.get(t.source),n=e.get(t.target);r.createEdge(s,n,t._)}}),t}};i(L,"Graph");let P=L;function N(){const t=[],e=[];return{put(r,s){const n=t.indexOf(r);-1===n?(t.push(r),e.push(s)):e[n]=s},get:r=>e[t.indexOf(r)]}}i(N,"ObjMap");const j=class _GraphItem{_graph;_;id(){return this._graph.id(this._)}constructor(t,e){this._graph=t,this._=e}};i(j,"GraphItem");let q=j;const X=class _ChildGraphItem extends q{_parent;constructor(t,e){super(t,e)}clearParent(){return this._parent&&(this._parent.removeChild(this),delete this._parent),this}parent(t){return 0===arguments.length?this._parent:(this._parent!==t&&(this._parent&&this._parent.removeChild(this),this._parent=t,this._parent&&this._parent.addChild(this)),this)}};i(X,"ChildGraphItem");let G=X;const H=class _Subgraph extends G{_children=[];constructor(t,e){super(t,e)}children(){return this._children}addChild(t){this._children.push(t)}removeChild(t){this._children=this._children.filter(e=>e.id!==t.id)}};i(H,"Subgraph");let B=H;const R=class _Vertex extends G{_inEdges=[];_outEdges=[];constructor(t,e){super(t,e)}edges(){return[...this._inEdges,...this._outEdges]}edgeCount(){return this._outEdges.length+this._inEdges.length}inEdges(){return this._inEdges}addInEdge(t){this._inEdges.push(t)}removeInEdge(t){this._inEdges=this._inEdges.filter(e=>e._.id!==t)}outEdges(){return this._outEdges}addOutEdge(t){this._outEdges.push(t)}removeOutEdge(t){this._outEdges=this._outEdges.filter(e=>e._.id!==t)}};i(R,"Vertex");let U=R;const z=class _Edge extends G{_source;_target;constructor(t,e,r,s){super(t,e),this._source=r,this._target=s}};i(z,"Edge");let W=z;const J=class _Graph2{_directed;_subgraphMap={};_vertexMap={};_edgeMap={};constructor(t=!0){this._directed=t}clear(){return this._subgraphMap={},this._vertexMap={},this._edgeMap={},this}clearParents(){for(const t in this._subgraphMap)this._subgraphMap[t].clearParent();for(const t in this._vertexMap)this._vertexMap[t].clearParent();return this}isDirected(){return this._directed}_idFunc=/* @__PURE__ */i(t=>"function"==typeof t.id?t.id():t.id,"_idFunc");idFunc(t){return this._idFunc=t,this}_sourceFunc=/* @__PURE__ */i(t=>"function"==typeof t.source?t.source():t.source,"_sourceFunc");sourceFunc(t){return this._sourceFunc=t,this}_targetFunc=/* @__PURE__ */i(t=>"function"==typeof t.target?t.target():t.target,"_targetFunc");targetFunc(t){return this._targetFunc=t,this}_updateFunc=/* @__PURE__ */i((t,e)=>e,"_updateFunc");updateFunc(t){return this._updateFunc=t,this}id(t){return this._idFunc(t)}type(t){return this.subgraphExists(t)?"S":this.vertexExists(t)?"V":this.edgeExists(t)?"E":""}isSubgraph(t){return this.subgraphExists(this.id(t))}isVertex(t){return this.vertexExists(this.id(t))}isEdge(t){return this.edgeExists(this.id(t))}allItems(){return[...this.allSubgraphs(),...this.allVertices(),...this.allEdges()]}item(t){return this.subgraphExists(t)?this.subgraph(t):this.vertexExists(t)?this.vertex(t):this.edgeExists(t)?this.edge(t):void 0}itemExists(t){return this.edgeExists(t)||this.vertexExists(t)||this.subgraphExists(t)}allSubgraphs(){const t=[];for(const e in this._subgraphMap)t.push(this._subgraphMap[e]._);return t}subgraphs(){const t=[];for(const e in this._subgraphMap)void 0===this._subgraphMap[e].parent()&&t.push(this._subgraphMap[e]._);return t}subgraphExists(t){return!!this._subgraphMap[t]}subgraph(t){return this._subgraphMap[t]._}subgraphSubgraphs(t){return this._subgraphMap[t].children().filter(t=>this.isSubgraph(t._)).map(t=>t._)}subgraphVertices(t){return this._subgraphMap[t].children().filter(t=>this.isVertex(t._)).map(t=>t._)}subgraphEdges(t){return this._subgraphMap[t].children().filter(t=>this.isEdge(t._)).map(t=>t._)}addSubgraph(t,e){const r=this._idFunc(t);if(this._subgraphMap[r])throw new Error(`Subgraph '${r}' already exists.`);const s=new B(this,t);if(e){const t=this._idFunc(e);if(!this._subgraphMap[t])throw new Error(`Subgraph '${t}' does not exist.`);s.parent(this._subgraphMap[t])}return this._subgraphMap[r]=s,this}mergeSubgraphs(t=[]){const e=d(this.allSubgraphs(),t,t=>this._idFunc(t),this._updateFunc);return e.exit.forEach(t=>this.removeSubgraph(this._idFunc(t))),e.enter.forEach(t=>this.addSubgraph(t)),e.update.forEach(t=>this.updateSubgraph(t)),this}updateSubgraph(t){const e=this._idFunc(t),r=this._subgraphMap[e];if(!r)throw new Error(`Subgraph '${e}' does not exist.`);return r._=t,this}removeSubgraph(t,e=!0){const r=this._subgraphMap[t];if(!r)throw new Error(`Subgraph '${t}' does not exist.`);return r.children().forEach(t=>{e?t.parent(r.parent()):t instanceof B?this.removeSubgraph(t.id()):this.removeVertex(t.id())}),delete this._subgraphMap[t],this}subgraphParent(t,e){const r=this._subgraphMap[t];if(!r)throw new Error(`Subgraph '${t}' does not exist.`);if(void 0===e){const t=r.parent();return t?t._:void 0}const s=this._subgraphMap[e];if(!s)throw new Error(`Vertex parent '${s}' does not exist.`);return r.parent(s),this}allVertices(){const t=[];for(const e in this._vertexMap)t.push(this._vertexMap[e]._);return t}vertices(){const t=[];for(const e in this._vertexMap)void 0===this._vertexMap[e].parent()&&t.push(this._vertexMap[e]._);return t}vertexExists(t){return!!this._vertexMap[t]}vertex(t){return this._vertexMap[t]._}allEdges(){const t=[];for(const e in this._edgeMap)t.push(this._edgeMap[e]._);return t}edges(){const t=[];for(const e in this._edgeMap)void 0===this._edgeMap[e].parent()&&t.push(this._edgeMap[e]._);return t}vertexEdges(t){return this._vertexMap[t].edges().map(t=>t._)}inEdges(t){return this._vertexMap[t].inEdges().map(t=>t._)}outEdges(t){return this._vertexMap[t].outEdges().map(t=>t._)}_neighbors(t){return[...this._vertexMap[t].outEdges().map(t=>t._target),...this._vertexMap[t].inEdges().map(t=>t._source)]}neighbors(t){return this._neighbors(t).map(t=>t._)}singleNeighbors(t){return this._neighbors(t).filter(t=>1===t.edgeCount()).map(t=>t._)}addVertex(t,e){const r=this._idFunc(t);if(this._vertexMap[r])throw new Error(`Vertex '${r}' already exists.`);const s=new U(this,t);if(e){const t=this._idFunc(e);if(!this.subgraphExists(t))throw new Error(`Subgraph '${t}' does not exist.`);s.parent(this._subgraphMap[t])}return this._vertexMap[r]=s,this}mergeVertices(t){const e=d(this.allVertices(),t,t=>this._idFunc(t),this._updateFunc);return e.exit.forEach(t=>this.removeVertex(this._idFunc(t))),e.enter.forEach(t=>this.addVertex(t)),e.update.forEach(t=>this.updateVertex(t)),this}updateVertex(t){const e=this._idFunc(t),r=this._vertexMap[e];if(!r)throw new Error(`Vertex '${e}' does not exist.`);return r._=t,this}removeVertex(t){const e=this._vertexMap[t];if(!e)throw new Error(`Vertex '${t}' does not exist.`);return e.edges().forEach(t=>{this.removeEdge(t.id())}),delete this._vertexMap[t],this}vertexParent(t,e){const r=this._vertexMap[t];if(!r)throw new Error(`Vertex '${t}' does not exist.`);if(void 0===e){const t=r.parent();return t?t._:void 0}const s=this._subgraphMap[e];if(!s)throw new Error(`Vertex parent '${s}' does not exist.`);return r.parent(s),this}edgeExists(t){return!!this._edgeMap[t]}edge(t){return this._edgeMap[t]._}addEdge(t,e){const r=this._idFunc(t),s=this._sourceFunc(t),n=this._targetFunc(t);if(this._edgeMap[r])throw new Error(`Edge '${r}' already exists.`);if(!this.vertexExists(s))throw new Error(`Edge Source '${s}' does not exist.`);if(!this.vertexExists(n))throw new Error(`Edge Target '${n}' does not exist.`);const i=new W(this,t,this._vertexMap[s],this._vertexMap[n]);if(e){const t=this._idFunc(e);if(!this.subgraphExists(t))throw new Error(`Subgraph '${t}' does not exist.`);i.parent(this._subgraphMap[t])}return this._edgeMap[r]=i,this._vertexMap[s].addOutEdge(i),this._vertexMap[n].addInEdge(i),this}mergeEdges(t){const e=d(this.allEdges(),t,t=>this._idFunc(t),this._updateFunc);return e.exit.forEach(t=>this.removeEdge(this._idFunc(t))),e.enter.forEach(t=>this.addEdge(t)),e.update.forEach(t=>this.updateEdge(t)),this}updateEdge(t){const e=this._idFunc(t),r=this._edgeMap[e];if(!r)throw new Error(`Edge '${e}' does not exist.`);const s=r._source.id(),n=this._sourceFunc(t);s!==n&&(this._vertexMap[s]?.removeOutEdge(e),this._vertexMap[n]?.addOutEdge(r));const i=r._target.id(),o=this._targetFunc(t);return i!==o&&(this._vertexMap[i]?.removeInEdge(e),this._vertexMap[o]?.addInEdge(r)),r._=t,r._source=this._vertexMap[n],r._target=this._vertexMap[o],this}removeEdge(t){const e=this._edgeMap[t];if(!e)throw new Error(`Edge '${t}' does not exist.`);const r=this._idFunc(e._source._);if(!this.vertexExists(r))throw new Error(`Edge Source'${r}' does not exist.`);this._vertexMap[r].removeOutEdge(t);const s=this._idFunc(e._target._);if(!this.vertexExists(s))throw new Error(`Edge Target'${s}' does not exist.`);return this._vertexMap[s].removeInEdge(t),delete this._edgeMap[t],this}_hwalk(t,e){return t instanceof B?e("subgraph",t._,t.children().map(t=>this._hwalk(t,e))):e("vertex",t._)}hierarchy(t){const e=[];for(const r in this._subgraphMap){const s=this._subgraphMap[r];void 0===s.parent()&&e.push(this._hwalk(s,t))}for(const r in this._vertexMap){const s=this._vertexMap[r];void 0===s.parent()&&e.push(this._hwalk(s,t))}return e}dijkstra(t,e){const r=this.allEdges(),s=new Y,n={},o={},a={};function h(t,e){let r=1/0,s=null;return t.forEach(t=>{e[t]<r&&(r=e[t],s=t)}),s}i(h,"vertex_with_min_dist");for(let i=0;i<r.length;i++){const t=this._sourceFunc(r[i]),e=this._targetFunc(r[i]),n=1;s.add(t),s.add(e),o[t]=1/0,o[e]=1/0,void 0===a[t]&&(a[t]={}),void 0===a[e]&&(a[e]={}),a[t][e]=n,a[e][t]=n}for(o[t]=0;s.size;){const t=h(s,o);if(null===t)break;const r=Object.keys(a[t]).filter(t=>s.has(t));if(s.delete(t),t===e)break;for(const e of r){const r=o[t]+a[t][e];r<o[e]&&(o[e]=r,n[e]=t)}}let c=e;const u=[c];let d=0;for(;void 0!==n[c];)u.unshift(n[c]),d+=a[c][n[c]],c=n[c];return{ids:u,len:d}}sort(t){const e=[],r={},s=/* @__PURE__ */i((t,n=[])=>{const i=t.id();r[i]||(r[i]=!0,n.push(t),t.outEdges().forEach(t=>{n.indexOf(t._target)<0&&s(t._target,[...n])}),e.unshift(t._))},"visit");if(t)s(this._vertexMap[t]);else for(const n in this._vertexMap)s(this._vertexMap[n]);return e}};i(J,"Graph2");let Q=J;const K=class _Set{_content=[];get size(){return this._content.length}has(t){return this._content.indexOf(t)>=0}add(t){this.has(t)||this._content.push(t)}delete(t){const e=this._content.indexOf(t);e>=0&&this._content.splice(e,1)}forEach(t){this._content.forEach(t)}};i(K,"Set");let Y=K;const Z=Array.isArray,tt=Object.keys,et=Object.prototype.hasOwnProperty;function rt(t,e,r=!1){if(t===e)return!0;if(t&&e){if("object"==typeof t&&"object"==typeof e){const s=Z(t),n=Z(e);let i,o,a;if(s&&n){if(o=t.length,o!==e.length)return console.warn(`lengths not equal: ${o} !== ${e.length}`),!1;for(i=o;0!==i--;)if(!rt(t[i],e[i],r))return!1;return!0}if(s!==n)return console.warn(`arrays not equal: ${s} !== ${n}`),!1;const h=t instanceof Date,c=e instanceof Date;if(h!==c)return console.warn(`dates not equal: ${h} !== ${c}`),!1;if(h&&c){const r=t.getTime()===e.getTime();return r||console.warn(`dates not equal: ${t.getTime()} !== ${e.getTime()}`),r}const u=t instanceof RegExp,d=e instanceof RegExp;if(u!==d)return console.warn(`regexps not equal: ${u} !== ${d}`),!1;if(u&&d){const r=t.toString()===e.toString();return r||console.warn(`regexps not equal: ${t.toString()} !== ${e.toString()}`),r}const l=tt(t);if(o=l.length,o!==tt(e).length)return console.warn(`key lengths not equal: ${o} !== ${tt(e).length}`),!1;for(i=o;0!==i--;)if(!et.call(e,l[i]))return console.warn(`${l[i]} in a but not b`),!1;for(i=o;0!==i--;)if(a=l[i],!rt(t[a],e[a],r))return!1;return!0}if(!r&&"function"==typeof t&&"function"==typeof e){const r=t.toString()===e.toString();return r||console.warn(`functions not equal: ${t.toString()} !== ${e.toString()}`),r}}const s=t!=t&&e!=e;return s||console.warn(`values not equal: ${t} !== ${e}`),s}function st(t,e,r=!1){if(t===e)return!0;if(t&&e){if("object"==typeof t&&"object"==typeof e){const s=Z(t),n=Z(e);let i,o,a;if(s&&n){if(o=t.length,o!==e.length)return!1;for(i=o;0!==i--;)if(!st(t[i],e[i],r))return!1;return!0}if(s!==n)return!1;const h=t instanceof Date,c=e instanceof Date;if(h!==c)return!1;if(h&&c)return t.getTime()===e.getTime();const u=t instanceof RegExp,d=e instanceof RegExp;if(u!==d)return!1;if(u&&d)return t.toString()===e.toString();const l=tt(t);if(o=l.length,o!==tt(e).length)return!1;for(i=o;0!==i--;)if(!et.call(e,l[i]))return!1;for(i=o;0!==i--;)if(a=l[i],!st(t[a],e[a],r))return!1;return!0}if(!r&&"function"==typeof t&&"function"==typeof e)return t.toString()===e.toString()}return t!=t&&e!=e}function nt(t,e,r=!1){return st(t,e,r)?t:e}i(rt,"verboseDeepEquals"),i(st,"deepEquals"),i(nt,"update");const it="undefined"!=typeof globalThis?globalThis:window,ot="undefined"!=typeof window&&it===window,at="undefined"!=typeof process&&null!=process.versions&&null!=process.versions.node,ht=at&&null!=process.env&&(null!=process.env.TRAVIS||null!=process.env.GITHUB_ACTIONS||null!=process.env.CI);function ct(t){const e=document.scripts||[];for(let r=document.scripts.length-1;r>=0;--r){const s=e[r];if(s.src){const e=s.src.indexOf(t);if(e>=0)return s.src.substring(0,e)}}return""}i(ct,"getScriptSrc");const ut=class _Stack{stack=[];push(t){return this.stack.push(t),t}pop(){return this.stack.pop()}top(){return this.stack.length?this.stack[this.stack.length-1]:void 0}depth(){return this.stack.length}};i(ut,"Stack");let dt=ut;var lt=/* @__PURE__ */(t=>(t[t.debug=0]="debug",t[t.info=1]="info",t[t.notice=2]="notice",t[t.warning=3]="warning",t[t.error=4]="error",t[t.critical=5]="critical",t[t.alert=6]="alert",t[t.emergency=7]="emergency",t))(lt||{});const pt={debug:"cyan",info:"green",notice:"grey",warning:"blue",error:"red",critical:"magenta",alert:"magenta",emergency:"magenta"},gt=class _ConsoleWriter{write(t,e,r,s){at?console.log(`[${t}] ${lt[e].toUpperCase()} ${r}: ${s}`):console.log(`[${t}] %c${lt[e].toUpperCase()}%c ${r}: ${s}`,`color:${pt[lt[e]]}`,"")}};i(gt,"ConsoleWriter");let _t=gt;const ft=class _Logging{_levelStack=new dt;_level=1;_filter="";_writer=new _t;static Instance(){return this._instance||(this._instance=new this)}constructor(){}stringify(t){const e=[];return JSON.stringify(t,function(t,r){if("object"==typeof r&&null!==r){if(-1!==e.indexOf(r))return;e.push(r)}return r},2)}writer(t){return void 0===t?this._writer:(this._writer=t,this)}log(t,e,r){if(t<this._level)return;if(this._filter&&this._filter!==e)return;const s=/* @__PURE__ */(new Date).toISOString();this._writer.rawWrite?this._writer.rawWrite(s,t,e,r):("string"!=typeof r&&(r=this.stringify(r)),this._writer.write&&this._writer.write(s,t,e,r))}debug(t,e){this.log(0,t,e)}info(t,e){this.log(1,t,e)}notice(t,e){this.log(2,t,e)}warning(t,e){this.log(3,t,e)}error(t,e){this.log(4,t,e)}critical(t,e){this.log(5,t,e)}alert(t,e){this.log(6,t,e)}emergency(t,e){this.log(7,t,e)}level(t){return void 0===t?this._level:(this._level=t,this)}pushLevel(t){return this._levelStack.push(this._level),this._level=t,this}popLevel(){return this._level=this._levelStack.pop(),this}filter(t){return void 0===t?this._filter:(this._filter=t,this)}};var vt,bt;i(ft,"Logging"),((t,e,r)=>{e in t?n(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r})(ft,"symbol"!=typeof(vt="_instance")?vt+"":vt,bt);let Et=ft;const xt=Et.Instance(),mt=class _ScopedLogging{_scopeID;constructor(t){this._scopeID=t}debug(t){xt.debug(this._scopeID,t)}info(t){xt.info(this._scopeID,t)}notice(t){xt.notice(this._scopeID,t)}warning(t){xt.warning(this._scopeID,t)}error(t){xt.error(this._scopeID,t)}critical(t){xt.critical(this._scopeID,t)}alert(t){xt.alert(this._scopeID,t)}emergency(t){xt.emergency(this._scopeID,t)}pushLevel(t){return xt.pushLevel(t),this}popLevel(){return xt.popLevel(),this}};i(mt,"ScopedLogging");let wt=mt;function Mt(t,e=!1){return e&&xt.filter(t),new wt(t)}function St(t){return t*(Math.PI/180)}function yt(t){return t*(180/Math.PI)}function Ot(t,e){return{x:t*Math.cos(e),y:t*Math.sin(e)}}function Vt(t,e){return{r:Math.sqrt(t*t+e*e),theta:Math.atan2(e,t)}}function It(t,e=-Math.PI,r=Math.PI){return kt(t,e,r)}function Dt(t,e=-180,r=180){return kt(t,e,r)}function kt(t,e,r){const s=r-e,n=t-e;return n-Math.floor(n/s)*s+e}function Tt(t,e){if(void 0!==t&&void 0!==e){for(const r of t.split(".")){if(!e.hasOwnProperty(r))return;e=e[r]}return e}}function Ft(t,e){return void 0!==Tt(t,e)}function $t(t,e){const r={};for(const s in e){if(!e.hasOwnProperty(s))continue;if("__proto__"===s||"constructor"===s)continue;let n=e[s];n instanceof Array||"object"==typeof n&&(n=Ct(t[s],n)),s in t&&(t[s]===n||s in r&&r[s]===n)||(t[s]=n)}return t}function Ct(t={},...e){if("object"!=typeof t)throw new Error(`Destination "${t}" must be an object.`);for(const r of e)$t(t,r);return t}function At(t={},...e){return Ct(t,...e)}function Lt(t){const e=[];return JSON.stringify(t,function(t,r){if("object"==typeof r&&null!==r){if(-1!==e.indexOf(r))return;e.push(r)}return r})}function Pt(t){return void 0!==Array.isArray?Array.isArray(t):"[object Array]"===Object.prototype.toString.call(t)}function Nt(t){const e=t.split("_"),r=e[1].split(".");return{module:`@hpcc-js/${e[0]}`,file:r[0],class:r[1]||r[0]}}i(Mt,"scopedLogger"),i(St,"degreesToRadians"),i(yt,"radiansToDegrees"),i(Ot,"polarToCartesian"),i(Vt,"cartesianToPolar"),i(It,"normalizeRadians"),i(Dt,"normalizeDegrees"),i(kt,"normalize"),i(Tt,"inner"),i(Ft,"exists"),i($t,"_mixin"),i(Ct,"deepMixin"),i(At,"deepMixinT"),i(Lt,"safeStringify"),i(Pt,"isArray"),i(Nt,"classID2Meta");const jt=class _ObserverHandle{eventTarget;eventID;callback;constructor(t,e,r){this.eventTarget=t,this.eventID=e,this.callback=r}release(){this.eventTarget.removeObserver(this.eventID,this.callback)}unwatch(){this.release()}};i(jt,"ObserverHandle");let qt=jt;const Xt=class _Observable{_eventObservers={};constructor(...t){}addObserver(t,e){let r=this._eventObservers[t];return r||(r=[],this._eventObservers[t]=r),r.push(e),new qt(this,t,e)}removeObserver(t,e){const r=this._eventObservers[t];if(r)for(let s=r.length-1;s>=0;--s)r[s]===e&&r.splice(s,1);return this}dispatchEvent(t,...e){const r=this._eventObservers[t];if(r)for(const s of r)s(...e);return this}_hasObserver(t){const e=this._eventObservers[t];for(const r in e)if(e[r])return!0;return!1}hasObserver(t){if(void 0!==t)return this._hasObserver(t);for(const e in this._eventObservers)if(this._hasObserver(e))return!0;return!1}};i(Xt,"Observable");let Gt,Ht=Xt;!function(){if(it.requestAnimationFrame)Gt=it.requestAnimationFrame;else{let t=0;Gt=/* @__PURE__ */i(function(e){const r=/* @__PURE__ */(new Date).getTime(),s=Math.max(0,16-(r-t)),n=setTimeout(()=>e(r+s),s);return t=r+s,n},"requestAnimationFrame")}}();const Bt=class _Message{get canConflate(){return!1}conflate(t){return!1}void(){return!1}};i(Bt,"Message");let Rt=Bt;const Ut=class _Dispatch{_observerID=0;_observers=[];_messageBuffer=[];_rafHandle=void 0;constructor(){}observers(){return this._observers}messages(){const t=[];return this._messageBuffer.forEach(e=>{t.some(t=>t.canConflate&&t.conflate(e))||t.push(e)}),t}dispatchAll(){this._rafHandle=void 0,this.dispatch(this.messages()),this.flush()}dispatch(t){0!==t.length&&this.observers().forEach(e=>{const r=t.filter(t=>!t.void()&&(void 0===e.type||t instanceof e.type));r.length&&e.callback(r)})}hasObserver(){return this._observers.length>0}flush(){this._messageBuffer=[]}send(t){this.hasObserver()&&this.dispatch([t])}post(t){this.hasObserver()&&(this._messageBuffer.push(t),void 0===this._rafHandle&&(this._rafHandle=Gt(()=>this.dispatchAll())))}attach(t,e){const r=this,s=++this._observerID;return this._observers.push({id:s,type:e,callback:t}),{release(){r._observers=r._observers.filter(t=>t.id!==s)},unwatch(){this.release()}}}};i(Ut,"Dispatch");let zt=Ut;const Wt=class _XMLNode{name="";$={};_children=[];content="";constructor(t){this.name=t}appendAttribute(t,e){this.$[t]=e}appendContent(t){this.content+=t}appendChild(t){this._children.push(t)}children(t){return void 0===t?this._children:this._children.filter(e=>e.name===t)}};i(Wt,"XMLNode");let Jt=Wt;const Qt=class _SAXStackParser{root;stack=new dt;constructor(){}walkDoc(t){const e=this._startXMLNode(t);if(t.attributes)for(let r=0;r<t.attributes.length;++r){const e=t.attributes.item(r);this.attributes(e.nodeName,e.nodeValue)}if(this.startXMLNode(e),t.childNodes)for(let r=0;r<t.childNodes.length;++r){const e=t.childNodes.item(r);e.nodeType===e.TEXT_NODE?this.characters(e.nodeValue):this.walkDoc(e)}this.endXMLNode(this.stack.pop())}_startXMLNode(t){const e=new Jt(t.nodeName);return this.stack.depth()?this.stack.top().appendChild(e):this.root=e,this.stack.push(e)}parse(t){const e=(new DOMParser).parseFromString(t,"application/xml");this.startDocument(),this.walkDoc(e),this.endDocument()}startDocument(){}endDocument(){}startXMLNode(t){}endXMLNode(t){}attributes(t,e){this.stack.top().appendAttribute(t,e)}characters(t){this.stack.top().appendContent(t)}};i(Qt,"SAXStackParser");let Kt=Qt;const Yt=class _XML2JSONParser extends Kt{startXMLNode(t){super.startXMLNode(t),t.name}endXMLNode(t){t.name,super.endXMLNode(t)}};i(Yt,"XML2JSONParser");let Zt=Yt;function te(t){const e=new Zt;return e.parse(t),e.root}i(te,"xml2json");const ee=class _PropChangedMessage extends Rt{constructor(t,e,r){super(),this.property=t,this.newValue=e,this.oldValue=r}get canConflate(){return!0}conflate(t){return this.property===t.property&&(this.newValue=t.newValue,!0)}void(){return st(this.newValue,this.oldValue)}};i(ee,"PropChangedMessage");let re=ee;const se=class _StateObject{_espState={};_dispatch=new zt;_monitorHandle;_monitorTickCount=0;clear(t){this._espState={},void 0!==t&&this.set(t),this._monitorTickCount=0}get(t,e){return void 0===t?this._espState:this.has(t)?this._espState[t]:e}set(t,e){if("string"==typeof t)return this.setSingle(t,e);this.setAll(t)}setSingle(t,e){const r=this._espState[t];this._espState[t]=e,this._dispatch.post(new re(t,e,r))}setAll(t){for(const e in t)t.hasOwnProperty(e)&&this.setSingle(e,t[e])}has(t){return void 0!==this._espState[t]}addObserver(t,e,r){if(this.isCallback(e)){if("changed"!==t)throw new Error("Invalid eventID: "+t);return this._dispatch.attach(t=>{e(t.map(t=>({id:t.property,oldValue:t.oldValue,newValue:t.newValue})))})}if("propChanged"!==t)throw new Error("Invalid eventID: "+t);return this._dispatch.attach(t=>{const s=t.filter(t=>t.property===e);if(s.length){s.length>1&&console.warn("Should only be 1 message?");const t=s[s.length-1];r({id:t.property,oldValue:t.oldValue,newValue:t.newValue})}})}on(t,e,r){return this.addObserver(t,e,r),this}isCallback(t){return"function"==typeof t}hasEventListener(){return this._dispatch.hasObserver()}async refresh(t=!1){return await Promise.resolve(),this}_monitor(){this._monitorHandle?this._monitorTickCount=0:this._monitorHandle=setTimeout(()=>{(this.hasEventListener()?this.refresh():Promise.resolve()).then(()=>{this._monitor()}),delete this._monitorHandle},this._monitorTimeoutDuration())}_monitorTimeoutDuration(){return++this._monitorTickCount,this._monitorTickCount<=1?0:3e4}watch(t,e=!0){if("function"!=typeof t)throw new Error("Invalid Callback");e&&setTimeout(()=>{const e=this.get(),r=[];for(const t in e)e.hasOwnProperty(e)&&r.push({id:t,newValue:e[t],oldValue:void 0});t(r)},0);const r=this.addObserver("changed",t);return this._monitor(),r}};i(se,"StateObject");let ne=se;function ie(t,e){if("string"!=typeof e)return t;if(0===e.length)return t;for(;0===t.indexOf(e);)t=t.substring(1);for(;oe(t,e);)t=t.substring(0,t.length-1);return t}function oe(t,e,r){const s=t.toString();("number"!=typeof r||!isFinite(r)||Math.floor(r)!==r||r>s.length)&&(r=s.length),r-=e.length;const n=s.lastIndexOf(e,r);return-1!==n&&n===r}function ae(...t){const e=t.reduce((t,e)=>(t.length>0&&(e=e.replace(/^\//,"")),e=e.replace(/\/$/,""),[...t,...e.split("/")]),[]),r=[];for(const s of e)"."!==s&&(".."!==s?r.push(s):r.pop());return r.join("/")}function he(t){return ae(t,"..")}i(ie,"trim"),i(oe,"endsWith"),i(ae,"join"),i(he,"dirname");const ce="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";function ue(t){if("undefined"!=typeof TextEncoder)return(new TextEncoder).encode(t);const e=encodeURIComponent(t),r=[];for(let s=0;s<e.length;++s)"%"===e[s]?(r.push(parseInt(e.substring(s+1,s+3),16)),s+=2):r.push(e.charCodeAt(s));return Uint8Array.from(r)}function de(t){let e="";for(let r=0;r<t.length;r+=3){const s=t[r],n=r+1<t.length,i=r+2<t.length,o=n?t[r+1]:0,a=i?t[r+2]:0;e+=ce[s>>2],e+=ce[(3&s)<<4|o>>4],e+=n?ce[(15&o)<<2|a>>6]:"=",e+=i?ce[63&a]:"="}return e}function le(t=""){const e=null==t?"":String(t),r=globalThis?.Buffer;return r?.from?r.from(e,"utf8").toString("base64"):de(ue(e))}i(ue,"toUTF8Bytes"),i(de,"bytesToBase64"),i(le,"utf8ToBase64");export{m as AsyncCache,y as AsyncOrderedQueue,h as BUILD_VERSION,E as Cache,I as Dictionary,k as DictionaryNoCase,zt as Dispatch,A as Edge,P as Graph,Q as Graph2,F as GraphItem,lt as Level,Et as Logging,Rt as Message,Ht as Observable,o as PKG_NAME,a as PKG_VERSION,Kt as SAXStackParser,wt as ScopedLogging,dt as Stack,ne as StateObject,$ as Subgraph,C as Vertex,Jt as XMLNode,Vt as cartesianToPolar,Nt as classID2Meta,u as compare,d as compare2,w as debounce,st as deepEquals,Ct as deepMixin,At as deepMixinT,St as degreesToRadians,he as dirname,oe as endsWith,T as espTime2Seconds,Ft as exists,c as find,ct as getScriptSrc,v as hashSum,Tt as inner,Pt as isArray,ot as isBrowser,ht as isCI,at as isNode,ae as join,xt as logger,kt as normalize,Dt as normalizeDegrees,It as normalizeRadians,Ot as polarToCartesian,M as promiseTimeout,yt as radiansToDegrees,it as root,Lt as safeStringify,Mt as scopedLogger,O as sleep,ie as trim,nt as update,le as utf8ToBase64,rt as verboseDeepEquals,te as xml2json};
2
2
  //# sourceMappingURL=index.js.map