@dbt-tools/web 0.6.2 → 0.7.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.
@@ -0,0 +1,64 @@
1
+ (function(){var e=(e,t)=>()=>(t||(e((t={exports:{}}).exports,t),e=null),t.exports),t=e(((e,t)=>{var n=typeof Reflect==`object`?Reflect:null,r=n&&typeof n.apply==`function`?n.apply:function(e,t,n){return Function.prototype.apply.call(e,t,n)},i=n&&typeof n.ownKeys==`function`?n.ownKeys:Object.getOwnPropertySymbols?function(e){return Object.getOwnPropertyNames(e).concat(Object.getOwnPropertySymbols(e))}:function(e){return Object.getOwnPropertyNames(e)};function a(e){console&&console.warn&&console.warn(e)}var o=Number.isNaN||function(e){return e!==e};function s(){s.init.call(this)}t.exports=s,t.exports.once=te,s.EventEmitter=s,s.prototype._events=void 0,s.prototype._eventsCount=0,s.prototype._maxListeners=void 0;var c=10;function l(e){if(typeof e!=`function`)throw TypeError(`The "listener" argument must be of type Function. Received type `+typeof e)}Object.defineProperty(s,"defaultMaxListeners",{enumerable:!0,get:function(){return c},set:function(e){if(typeof e!=`number`||e<0||o(e))throw RangeError(`The value of "defaultMaxListeners" is out of range. It must be a non-negative number. Received `+e+`.`);c=e}}),s.init=function(){(this._events===void 0||this._events===Object.getPrototypeOf(this)._events)&&(this._events=Object.create(null),this._eventsCount=0),this._maxListeners=this._maxListeners||void 0},s.prototype.setMaxListeners=function(e){if(typeof e!=`number`||e<0||o(e))throw RangeError(`The value of "n" is out of range. It must be a non-negative number. Received `+e+`.`);return this._maxListeners=e,this};function u(e){return e._maxListeners===void 0?s.defaultMaxListeners:e._maxListeners}s.prototype.getMaxListeners=function(){return u(this)},s.prototype.emit=function(e){for(var t=[],n=1;n<arguments.length;n++)t.push(arguments[n]);var i=e===`error`,a=this._events;if(a!==void 0)i&&=a.error===void 0;else if(!i)return!1;if(i){var o;if(t.length>0&&(o=t[0]),o instanceof Error)throw o;var s=Error(`Unhandled error.`+(o?` (`+o.message+`)`:``));throw s.context=o,s}var c=a[e];if(c===void 0)return!1;if(typeof c==`function`)r(c,this,t);else for(var l=c.length,u=g(c,l),n=0;n<l;++n)r(u[n],this,t);return!0};function d(e,t,n,r){var i,o,s;if(l(n),o=e._events,o===void 0?(o=e._events=Object.create(null),e._eventsCount=0):(o.newListener!==void 0&&(e.emit(`newListener`,t,n.listener?n.listener:n),o=e._events),s=o[t]),s===void 0)s=o[t]=n,++e._eventsCount;else if(typeof s==`function`?s=o[t]=r?[n,s]:[s,n]:r?s.unshift(n):s.push(n),i=u(e),i>0&&s.length>i&&!s.warned){s.warned=!0;var c=Error(`Possible EventEmitter memory leak detected. `+s.length+` `+String(t)+` listeners added. Use emitter.setMaxListeners() to increase limit`);c.name=`MaxListenersExceededWarning`,c.emitter=e,c.type=t,c.count=s.length,a(c)}return e}s.prototype.addListener=function(e,t){return d(this,e,t,!1)},s.prototype.on=s.prototype.addListener,s.prototype.prependListener=function(e,t){return d(this,e,t,!0)};function f(){if(!this.fired)return this.target.removeListener(this.type,this.wrapFn),this.fired=!0,arguments.length===0?this.listener.call(this.target):this.listener.apply(this.target,arguments)}function p(e,t,n){var r={fired:!1,wrapFn:void 0,target:e,type:t,listener:n},i=f.bind(r);return i.listener=n,r.wrapFn=i,i}s.prototype.once=function(e,t){return l(t),this.on(e,p(this,e,t)),this},s.prototype.prependOnceListener=function(e,t){return l(t),this.prependListener(e,p(this,e,t)),this},s.prototype.removeListener=function(e,t){var n,r,i,a,o;if(l(t),r=this._events,r===void 0||(n=r[e],n===void 0))return this;if(n===t||n.listener===t)--this._eventsCount===0?this._events=Object.create(null):(delete r[e],r.removeListener&&this.emit(`removeListener`,e,n.listener||t));else if(typeof n!=`function`){for(i=-1,a=n.length-1;a>=0;a--)if(n[a]===t||n[a].listener===t){o=n[a].listener,i=a;break}if(i<0)return this;i===0?n.shift():_(n,i),n.length===1&&(r[e]=n[0]),r.removeListener!==void 0&&this.emit(`removeListener`,e,o||t)}return this},s.prototype.off=s.prototype.removeListener,s.prototype.removeAllListeners=function(e){var t,n=this._events,r;if(n===void 0)return this;if(n.removeListener===void 0)return arguments.length===0?(this._events=Object.create(null),this._eventsCount=0):n[e]!==void 0&&(--this._eventsCount===0?this._events=Object.create(null):delete n[e]),this;if(arguments.length===0){var i=Object.keys(n),a;for(r=0;r<i.length;++r)a=i[r],a!==`removeListener`&&this.removeAllListeners(a);return this.removeAllListeners(`removeListener`),this._events=Object.create(null),this._eventsCount=0,this}if(t=n[e],typeof t==`function`)this.removeListener(e,t);else if(t!==void 0)for(r=t.length-1;r>=0;r--)this.removeListener(e,t[r]);return this};function m(e,t,n){var r=e._events;if(r===void 0)return[];var i=r[t];return i===void 0?[]:typeof i==`function`?n?[i.listener||i]:[i]:n?ee(i):g(i,i.length)}s.prototype.listeners=function(e){return m(this,e,!0)},s.prototype.rawListeners=function(e){return m(this,e,!1)},s.listenerCount=function(e,t){return typeof e.listenerCount==`function`?e.listenerCount(t):h.call(e,t)},s.prototype.listenerCount=h;function h(e){var t=this._events;if(t!==void 0){var n=t[e];if(typeof n==`function`)return 1;if(n!==void 0)return n.length}return 0}s.prototype.eventNames=function(){return this._eventsCount>0?i(this._events):[]};function g(e,t){for(var n=Array(t),r=0;r<t;++r)n[r]=e[r];return n}function _(e,t){for(;t+1<e.length;t++)e[t]=e[t+1];e.pop()}function ee(e){for(var t=Array(e.length),n=0;n<t.length;++n)t[n]=e[n].listener||e[n];return t}function te(e,t){return new Promise(function(n,r){function i(n){e.removeListener(t,a),r(n)}function a(){typeof e.removeListener==`function`&&e.removeListener(`error`,i),n([].slice.call(arguments))}y(e,t,a,{once:!0}),t!==`error`&&v(e,i,{once:!0})})}function v(e,t,n){typeof e.on==`function`&&y(e,`error`,t,n)}function y(e,t,n,r){if(typeof e.on==`function`)r.once?e.once(t,n):e.on(t,n);else if(typeof e.addEventListener==`function`)e.addEventListener(t,function i(a){r.once&&e.removeEventListener(t,i),n(a)});else throw TypeError(`The "emitter" argument must be of type EventEmitter. Received type `+typeof e)}}))();function n(){let e=arguments[0];for(let t=1,n=arguments.length;t<n;t++)if(arguments[t])for(let n in arguments[t])e[n]=arguments[t][n];return e}let r=n;typeof Object.assign==`function`&&(r=Object.assign);function i(e,t,n,r){let i=e._nodes.get(t),a=null;return i&&(a=r===`mixed`?i.out&&i.out[n]||i.undirected&&i.undirected[n]:r===`directed`?i.out&&i.out[n]:i.undirected&&i.undirected[n]),a}function a(e){return typeof e==`object`&&!!e}function o(e){let t;for(t in e)return!1;return!0}function s(e,t,n){Object.defineProperty(e,t,{enumerable:!1,configurable:!1,writable:!0,value:n})}function c(e,t,n){let r={enumerable:!0,configurable:!0};typeof n==`function`?r.get=n:(r.value=n,r.writable=!1),Object.defineProperty(e,t,r)}function l(e){return!(!a(e)||e.attributes&&!Array.isArray(e.attributes))}function u(){let e=Math.floor(Math.random()*256)&255;return()=>e++}function d(){let e=arguments,t=null,n=-1;return{[Symbol.iterator](){return this},next(){let r=null;do{if(t===null){if(n++,n>=e.length)return{done:!0};t=e[n][Symbol.iterator]()}if(r=t.next(),r.done){t=null;continue}break}while(!0);return r}}}function f(){return{[Symbol.iterator](){return this},next(){return{done:!0}}}}var p=class extends Error{constructor(e){super(),this.name=`GraphError`,this.message=e}},m=class e extends p{constructor(t){super(t),this.name=`InvalidArgumentsGraphError`,typeof Error.captureStackTrace==`function`&&Error.captureStackTrace(this,e.prototype.constructor)}},h=class e extends p{constructor(t){super(t),this.name=`NotFoundGraphError`,typeof Error.captureStackTrace==`function`&&Error.captureStackTrace(this,e.prototype.constructor)}},g=class e extends p{constructor(t){super(t),this.name=`UsageGraphError`,typeof Error.captureStackTrace==`function`&&Error.captureStackTrace(this,e.prototype.constructor)}};function _(e,t){this.key=e,this.attributes=t,this.clear()}_.prototype.clear=function(){this.inDegree=0,this.outDegree=0,this.undirectedDegree=0,this.undirectedLoops=0,this.directedLoops=0,this.in={},this.out={},this.undirected={}};function ee(e,t){this.key=e,this.attributes=t,this.clear()}ee.prototype.clear=function(){this.inDegree=0,this.outDegree=0,this.directedLoops=0,this.in={},this.out={}};function te(e,t){this.key=e,this.attributes=t,this.clear()}te.prototype.clear=function(){this.undirectedDegree=0,this.undirectedLoops=0,this.undirected={}};function v(e,t,n,r,i){this.key=t,this.attributes=i,this.undirected=e,this.source=n,this.target=r}v.prototype.attach=function(){let e=`out`,t=`in`;this.undirected&&(e=t=`undirected`);let n=this.source.key,r=this.target.key;this.source[e][r]=this,!(this.undirected&&n===r)&&(this.target[t][n]=this)},v.prototype.attachMulti=function(){let e=`out`,t=`in`,n=this.source.key,r=this.target.key;this.undirected&&(e=t=`undirected`);let i=this.source[e],a=i[r];if(a===void 0){i[r]=this,this.undirected&&n===r||(this.target[t][n]=this);return}a.previous=this,this.next=a,i[r]=this,this.target[t][n]=this},v.prototype.detach=function(){let e=this.source.key,t=this.target.key,n=`out`,r=`in`;this.undirected&&(n=r=`undirected`),delete this.source[n][t],delete this.target[r][e]},v.prototype.detachMulti=function(){let e=this.source.key,t=this.target.key,n=`out`,r=`in`;this.undirected&&(n=r=`undirected`),this.previous===void 0?this.next===void 0?(delete this.source[n][t],delete this.target[r][e]):(this.next.previous=void 0,this.source[n][t]=this.next,this.target[r][e]=this.next):(this.previous.next=this.next,this.next!==void 0&&(this.next.previous=this.previous))};function y(e,t,n,r,i,a,o){let s,c,l,u;if(r=``+r,n===0){if(s=e._nodes.get(r),!s)throw new h(`Graph.${t}: could not find the "${r}" node in the graph.`);l=i,u=a}else if(n===3){if(i=``+i,c=e._edges.get(i),!c)throw new h(`Graph.${t}: could not find the "${i}" edge in the graph.`);let n=c.source.key,d=c.target.key;if(r===n)s=c.target;else if(r===d)s=c.source;else throw new h(`Graph.${t}: the "${r}" node is not attached to the "${i}" edge (${n}, ${d}).`);l=a,u=o}else{if(c=e._edges.get(r),!c)throw new h(`Graph.${t}: could not find the "${r}" edge in the graph.`);s=n===1?c.source:c.target,l=i,u=a}return[s,l,u]}function ne(e,t,n){e.prototype[t]=function(e,r,i){let[a,o]=y(this,t,n,e,r,i);return a.attributes[o]}}function re(e,t,n){e.prototype[t]=function(e,r){let[i]=y(this,t,n,e,r);return i.attributes}}function ie(e,t,n){e.prototype[t]=function(e,r,i){let[a,o]=y(this,t,n,e,r,i);return a.attributes.hasOwnProperty(o)}}function ae(e,t,n){e.prototype[t]=function(e,r,i,a){let[o,s,c]=y(this,t,n,e,r,i,a);return o.attributes[s]=c,this.emit(`nodeAttributesUpdated`,{key:o.key,type:`set`,attributes:o.attributes,name:s}),this}}function oe(e,t,n){e.prototype[t]=function(e,r,i,a){let[o,s,c]=y(this,t,n,e,r,i,a);if(typeof c!=`function`)throw new m(`Graph.${t}: updater should be a function.`);let l=o.attributes;return l[s]=c(l[s]),this.emit(`nodeAttributesUpdated`,{key:o.key,type:`set`,attributes:o.attributes,name:s}),this}}function se(e,t,n){e.prototype[t]=function(e,r,i){let[a,o]=y(this,t,n,e,r,i);return delete a.attributes[o],this.emit(`nodeAttributesUpdated`,{key:a.key,type:`remove`,attributes:a.attributes,name:o}),this}}function ce(e,t,n){e.prototype[t]=function(e,r,i){let[o,s]=y(this,t,n,e,r,i);if(!a(s))throw new m(`Graph.${t}: provided attributes are not a plain object.`);return o.attributes=s,this.emit(`nodeAttributesUpdated`,{key:o.key,type:`replace`,attributes:o.attributes}),this}}function le(e,t,n){e.prototype[t]=function(e,i,o){let[s,c]=y(this,t,n,e,i,o);if(!a(c))throw new m(`Graph.${t}: provided attributes are not a plain object.`);return r(s.attributes,c),this.emit(`nodeAttributesUpdated`,{key:s.key,type:`merge`,attributes:s.attributes,data:c}),this}}function ue(e,t,n){e.prototype[t]=function(e,r,i){let[a,o]=y(this,t,n,e,r,i);if(typeof o!=`function`)throw new m(`Graph.${t}: provided updater is not a function.`);return a.attributes=o(a.attributes),this.emit(`nodeAttributesUpdated`,{key:a.key,type:`update`,attributes:a.attributes}),this}}let de=[{name:e=>`get${e}Attribute`,attacher:ne},{name:e=>`get${e}Attributes`,attacher:re},{name:e=>`has${e}Attribute`,attacher:ie},{name:e=>`set${e}Attribute`,attacher:ae},{name:e=>`update${e}Attribute`,attacher:oe},{name:e=>`remove${e}Attribute`,attacher:se},{name:e=>`replace${e}Attributes`,attacher:ce},{name:e=>`merge${e}Attributes`,attacher:le},{name:e=>`update${e}Attributes`,attacher:ue}];function fe(e){de.forEach(function({name:t,attacher:n}){n(e,t(`Node`),0),n(e,t(`Source`),1),n(e,t(`Target`),2),n(e,t(`Opposite`),3)})}function pe(e,t,n){e.prototype[t]=function(e,r){let a;if(this.type!==`mixed`&&n!==`mixed`&&n!==this.type)throw new g(`Graph.${t}: cannot find this type of edges in your ${this.type} graph.`);if(arguments.length>2){if(this.multi)throw new g(`Graph.${t}: cannot use a {source,target} combo when asking about an edge's attributes in a MultiGraph since we cannot infer the one you want information about.`);let o=``+e,s=``+r;if(r=arguments[2],a=i(this,o,s,n),!a)throw new h(`Graph.${t}: could not find an edge for the given path ("${o}" - "${s}").`)}else{if(n!==`mixed`)throw new g(`Graph.${t}: calling this method with only a key (vs. a source and target) does not make sense since an edge with this key could have the other type.`);if(e=``+e,a=this._edges.get(e),!a)throw new h(`Graph.${t}: could not find the "${e}" edge in the graph.`)}return a.attributes[r]}}function me(e,t,n){e.prototype[t]=function(e){let r;if(this.type!==`mixed`&&n!==`mixed`&&n!==this.type)throw new g(`Graph.${t}: cannot find this type of edges in your ${this.type} graph.`);if(arguments.length>1){if(this.multi)throw new g(`Graph.${t}: cannot use a {source,target} combo when asking about an edge's attributes in a MultiGraph since we cannot infer the one you want information about.`);let a=``+e,o=``+arguments[1];if(r=i(this,a,o,n),!r)throw new h(`Graph.${t}: could not find an edge for the given path ("${a}" - "${o}").`)}else{if(n!==`mixed`)throw new g(`Graph.${t}: calling this method with only a key (vs. a source and target) does not make sense since an edge with this key could have the other type.`);if(e=``+e,r=this._edges.get(e),!r)throw new h(`Graph.${t}: could not find the "${e}" edge in the graph.`)}return r.attributes}}function he(e,t,n){e.prototype[t]=function(e,r){let a;if(this.type!==`mixed`&&n!==`mixed`&&n!==this.type)throw new g(`Graph.${t}: cannot find this type of edges in your ${this.type} graph.`);if(arguments.length>2){if(this.multi)throw new g(`Graph.${t}: cannot use a {source,target} combo when asking about an edge's attributes in a MultiGraph since we cannot infer the one you want information about.`);let o=``+e,s=``+r;if(r=arguments[2],a=i(this,o,s,n),!a)throw new h(`Graph.${t}: could not find an edge for the given path ("${o}" - "${s}").`)}else{if(n!==`mixed`)throw new g(`Graph.${t}: calling this method with only a key (vs. a source and target) does not make sense since an edge with this key could have the other type.`);if(e=``+e,a=this._edges.get(e),!a)throw new h(`Graph.${t}: could not find the "${e}" edge in the graph.`)}return a.attributes.hasOwnProperty(r)}}function ge(e,t,n){e.prototype[t]=function(e,r,a){let o;if(this.type!==`mixed`&&n!==`mixed`&&n!==this.type)throw new g(`Graph.${t}: cannot find this type of edges in your ${this.type} graph.`);if(arguments.length>3){if(this.multi)throw new g(`Graph.${t}: cannot use a {source,target} combo when asking about an edge's attributes in a MultiGraph since we cannot infer the one you want information about.`);let s=``+e,c=``+r;if(r=arguments[2],a=arguments[3],o=i(this,s,c,n),!o)throw new h(`Graph.${t}: could not find an edge for the given path ("${s}" - "${c}").`)}else{if(n!==`mixed`)throw new g(`Graph.${t}: calling this method with only a key (vs. a source and target) does not make sense since an edge with this key could have the other type.`);if(e=``+e,o=this._edges.get(e),!o)throw new h(`Graph.${t}: could not find the "${e}" edge in the graph.`)}return o.attributes[r]=a,this.emit(`edgeAttributesUpdated`,{key:o.key,type:`set`,attributes:o.attributes,name:r}),this}}function _e(e,t,n){e.prototype[t]=function(e,r,a){let o;if(this.type!==`mixed`&&n!==`mixed`&&n!==this.type)throw new g(`Graph.${t}: cannot find this type of edges in your ${this.type} graph.`);if(arguments.length>3){if(this.multi)throw new g(`Graph.${t}: cannot use a {source,target} combo when asking about an edge's attributes in a MultiGraph since we cannot infer the one you want information about.`);let s=``+e,c=``+r;if(r=arguments[2],a=arguments[3],o=i(this,s,c,n),!o)throw new h(`Graph.${t}: could not find an edge for the given path ("${s}" - "${c}").`)}else{if(n!==`mixed`)throw new g(`Graph.${t}: calling this method with only a key (vs. a source and target) does not make sense since an edge with this key could have the other type.`);if(e=``+e,o=this._edges.get(e),!o)throw new h(`Graph.${t}: could not find the "${e}" edge in the graph.`)}if(typeof a!=`function`)throw new m(`Graph.${t}: updater should be a function.`);return o.attributes[r]=a(o.attributes[r]),this.emit(`edgeAttributesUpdated`,{key:o.key,type:`set`,attributes:o.attributes,name:r}),this}}function ve(e,t,n){e.prototype[t]=function(e,r){let a;if(this.type!==`mixed`&&n!==`mixed`&&n!==this.type)throw new g(`Graph.${t}: cannot find this type of edges in your ${this.type} graph.`);if(arguments.length>2){if(this.multi)throw new g(`Graph.${t}: cannot use a {source,target} combo when asking about an edge's attributes in a MultiGraph since we cannot infer the one you want information about.`);let o=``+e,s=``+r;if(r=arguments[2],a=i(this,o,s,n),!a)throw new h(`Graph.${t}: could not find an edge for the given path ("${o}" - "${s}").`)}else{if(n!==`mixed`)throw new g(`Graph.${t}: calling this method with only a key (vs. a source and target) does not make sense since an edge with this key could have the other type.`);if(e=``+e,a=this._edges.get(e),!a)throw new h(`Graph.${t}: could not find the "${e}" edge in the graph.`)}return delete a.attributes[r],this.emit(`edgeAttributesUpdated`,{key:a.key,type:`remove`,attributes:a.attributes,name:r}),this}}function ye(e,t,n){e.prototype[t]=function(e,r){let o;if(this.type!==`mixed`&&n!==`mixed`&&n!==this.type)throw new g(`Graph.${t}: cannot find this type of edges in your ${this.type} graph.`);if(arguments.length>2){if(this.multi)throw new g(`Graph.${t}: cannot use a {source,target} combo when asking about an edge's attributes in a MultiGraph since we cannot infer the one you want information about.`);let a=``+e,s=``+r;if(r=arguments[2],o=i(this,a,s,n),!o)throw new h(`Graph.${t}: could not find an edge for the given path ("${a}" - "${s}").`)}else{if(n!==`mixed`)throw new g(`Graph.${t}: calling this method with only a key (vs. a source and target) does not make sense since an edge with this key could have the other type.`);if(e=``+e,o=this._edges.get(e),!o)throw new h(`Graph.${t}: could not find the "${e}" edge in the graph.`)}if(!a(r))throw new m(`Graph.${t}: provided attributes are not a plain object.`);return o.attributes=r,this.emit(`edgeAttributesUpdated`,{key:o.key,type:`replace`,attributes:o.attributes}),this}}function be(e,t,n){e.prototype[t]=function(e,o){let s;if(this.type!==`mixed`&&n!==`mixed`&&n!==this.type)throw new g(`Graph.${t}: cannot find this type of edges in your ${this.type} graph.`);if(arguments.length>2){if(this.multi)throw new g(`Graph.${t}: cannot use a {source,target} combo when asking about an edge's attributes in a MultiGraph since we cannot infer the one you want information about.`);let r=``+e,a=``+o;if(o=arguments[2],s=i(this,r,a,n),!s)throw new h(`Graph.${t}: could not find an edge for the given path ("${r}" - "${a}").`)}else{if(n!==`mixed`)throw new g(`Graph.${t}: calling this method with only a key (vs. a source and target) does not make sense since an edge with this key could have the other type.`);if(e=``+e,s=this._edges.get(e),!s)throw new h(`Graph.${t}: could not find the "${e}" edge in the graph.`)}if(!a(o))throw new m(`Graph.${t}: provided attributes are not a plain object.`);return r(s.attributes,o),this.emit(`edgeAttributesUpdated`,{key:s.key,type:`merge`,attributes:s.attributes,data:o}),this}}function xe(e,t,n){e.prototype[t]=function(e,r){let a;if(this.type!==`mixed`&&n!==`mixed`&&n!==this.type)throw new g(`Graph.${t}: cannot find this type of edges in your ${this.type} graph.`);if(arguments.length>2){if(this.multi)throw new g(`Graph.${t}: cannot use a {source,target} combo when asking about an edge's attributes in a MultiGraph since we cannot infer the one you want information about.`);let o=``+e,s=``+r;if(r=arguments[2],a=i(this,o,s,n),!a)throw new h(`Graph.${t}: could not find an edge for the given path ("${o}" - "${s}").`)}else{if(n!==`mixed`)throw new g(`Graph.${t}: calling this method with only a key (vs. a source and target) does not make sense since an edge with this key could have the other type.`);if(e=``+e,a=this._edges.get(e),!a)throw new h(`Graph.${t}: could not find the "${e}" edge in the graph.`)}if(typeof r!=`function`)throw new m(`Graph.${t}: provided updater is not a function.`);return a.attributes=r(a.attributes),this.emit(`edgeAttributesUpdated`,{key:a.key,type:`update`,attributes:a.attributes}),this}}let Se=[{name:e=>`get${e}Attribute`,attacher:pe},{name:e=>`get${e}Attributes`,attacher:me},{name:e=>`has${e}Attribute`,attacher:he},{name:e=>`set${e}Attribute`,attacher:ge},{name:e=>`update${e}Attribute`,attacher:_e},{name:e=>`remove${e}Attribute`,attacher:ve},{name:e=>`replace${e}Attributes`,attacher:ye},{name:e=>`merge${e}Attributes`,attacher:be},{name:e=>`update${e}Attributes`,attacher:xe}];function Ce(e){Se.forEach(function({name:t,attacher:n}){n(e,t(`Edge`),`mixed`),n(e,t(`DirectedEdge`),`directed`),n(e,t(`UndirectedEdge`),`undirected`)})}let we=[{name:`edges`,type:`mixed`},{name:`inEdges`,type:`directed`,direction:`in`},{name:`outEdges`,type:`directed`,direction:`out`},{name:`inboundEdges`,type:`mixed`,direction:`in`},{name:`outboundEdges`,type:`mixed`,direction:`out`},{name:`directedEdges`,type:`directed`},{name:`undirectedEdges`,type:`undirected`}];function Te(e,t,n,r){let i=!1;for(let a in t){if(a===r)continue;let o=t[a];if(i=n(o.key,o.attributes,o.source.key,o.target.key,o.source.attributes,o.target.attributes,o.undirected),e&&i)return o.key}}function Ee(e,t,n,r){let i,a,o,s=!1;for(let c in t)if(c!==r){i=t[c];do{if(a=i.source,o=i.target,s=n(i.key,i.attributes,a.key,o.key,a.attributes,o.attributes,i.undirected),e&&s)return i.key;i=i.next}while(i!==void 0)}}function De(e,t){let n=Object.keys(e),r=n.length,i,a=0;return{[Symbol.iterator](){return this},next(){do if(i)i=i.next;else{if(a>=r)return{done:!0};let o=n[a++];if(o===t){i=void 0;continue}i=e[o]}while(!i);return{done:!1,value:{edge:i.key,attributes:i.attributes,source:i.source.key,target:i.target.key,sourceAttributes:i.source.attributes,targetAttributes:i.target.attributes,undirected:i.undirected}}}}}function Oe(e,t,n,r){let i=t[n];if(!i)return;let a=i.source,o=i.target;if(r(i.key,i.attributes,a.key,o.key,a.attributes,o.attributes,i.undirected)&&e)return i.key}function ke(e,t,n,r){let i=t[n];if(!i)return;let a=!1;do{if(a=r(i.key,i.attributes,i.source.key,i.target.key,i.source.attributes,i.target.attributes,i.undirected),e&&a)return i.key;i=i.next}while(i!==void 0)}function Ae(e,t){let n=e[t];if(n.next!==void 0)return{[Symbol.iterator](){return this},next(){if(!n)return{done:!0};let e={edge:n.key,attributes:n.attributes,source:n.source.key,target:n.target.key,sourceAttributes:n.source.attributes,targetAttributes:n.target.attributes,undirected:n.undirected};return n=n.next,{done:!1,value:e}}};let r=!1;return{[Symbol.iterator](){return this},next(){return r===!0?{done:!0}:(r=!0,{done:!1,value:{edge:n.key,attributes:n.attributes,source:n.source.key,target:n.target.key,sourceAttributes:n.source.attributes,targetAttributes:n.target.attributes,undirected:n.undirected}})}}}function je(e,t){if(e.size===0)return[];if(t===`mixed`||t===e.type)return Array.from(e._edges.keys());let n=t===`undirected`?e.undirectedSize:e.directedSize,r=Array(n),i=t===`undirected`,a=e._edges.values(),o=0,s,c;for(;s=a.next(),s.done!==!0;)c=s.value,c.undirected===i&&(r[o++]=c.key);return r}function Me(e,t,n,r){if(t.size===0)return;let i=n!==`mixed`&&n!==t.type,a=n===`undirected`,o,s,c=!1,l=t._edges.values();for(;o=l.next(),o.done!==!0;){if(s=o.value,i&&s.undirected!==a)continue;let{key:t,attributes:n,source:l,target:u}=s;if(c=r(t,n,l.key,u.key,l.attributes,u.attributes,s.undirected),e&&c)return t}}function Ne(e,t){if(e.size===0)return f();let n=t!==`mixed`&&t!==e.type,r=t===`undirected`,i=e._edges.values();return{[Symbol.iterator](){return this},next(){let e,t;for(;;){if(e=i.next(),e.done)return e;if(t=e.value,!(n&&t.undirected!==r))break}return{value:{edge:t.key,attributes:t.attributes,source:t.source.key,target:t.target.key,sourceAttributes:t.source.attributes,targetAttributes:t.target.attributes,undirected:t.undirected},done:!1}}}}function Pe(e,t,n,r,i,a){let o=t?Ee:Te,s;if(n!==`undirected`&&(r!==`out`&&(s=o(e,i.in,a),e&&s)||r!==`in`&&(s=o(e,i.out,a,r?void 0:i.key),e&&s))||n!==`directed`&&(s=o(e,i.undirected,a),e&&s))return s}function Fe(e,t,n,r){let i=[];return Pe(!1,e,t,n,r,function(e){i.push(e)}),i}function Ie(e,t,n){let r=f();return e!==`undirected`&&(t!==`out`&&n.in!==void 0&&(r=d(r,De(n.in))),t!==`in`&&n.out!==void 0&&(r=d(r,De(n.out,t?void 0:n.key)))),e!==`directed`&&n.undirected!==void 0&&(r=d(r,De(n.undirected))),r}function Le(e,t,n,r,i,a,o){let s=n?ke:Oe,c;if(t!==`undirected`&&(i.in!==void 0&&r!==`out`&&(c=s(e,i.in,a,o),e&&c)||i.out!==void 0&&r!==`in`&&(r||i.key!==a)&&(c=s(e,i.out,a,o),e&&c))||t!==`directed`&&i.undirected!==void 0&&(c=s(e,i.undirected,a,o),e&&c))return c}function Re(e,t,n,r,i){let a=[];return Le(!1,e,t,n,r,i,function(e){a.push(e)}),a}function ze(e,t,n,r){let i=f();return e!==`undirected`&&(n.in!==void 0&&t!==`out`&&r in n.in&&(i=d(i,Ae(n.in,r))),n.out!==void 0&&t!==`in`&&r in n.out&&(t||n.key!==r)&&(i=d(i,Ae(n.out,r)))),e!==`directed`&&n.undirected!==void 0&&r in n.undirected&&(i=d(i,Ae(n.undirected,r))),i}function Be(e,t){let{name:n,type:r,direction:i}=t;e.prototype[n]=function(e,t){if(r!==`mixed`&&this.type!==`mixed`&&r!==this.type)return[];if(!arguments.length)return je(this,r);if(arguments.length===1){e=``+e;let t=this._nodes.get(e);if(t===void 0)throw new h(`Graph.${n}: could not find the "${e}" node in the graph.`);return Fe(this.multi,r===`mixed`?this.type:r,i,t)}if(arguments.length===2){e=``+e,t=``+t;let a=this._nodes.get(e);if(!a)throw new h(`Graph.${n}: could not find the "${e}" source node in the graph.`);if(!this._nodes.has(t))throw new h(`Graph.${n}: could not find the "${t}" target node in the graph.`);return Re(r,this.multi,i,a,t)}throw new m(`Graph.${n}: too many arguments (expecting 0, 1 or 2 and got ${arguments.length}).`)}}function Ve(e,t){let{name:n,type:r,direction:i}=t,a=`forEach`+n[0].toUpperCase()+n.slice(1,-1);e.prototype[a]=function(e,t,n){if(r===`mixed`||this.type===`mixed`||r===this.type){if(arguments.length===1)return n=e,Me(!1,this,r,n);if(arguments.length===2){e=``+e,n=t;let o=this._nodes.get(e);if(o===void 0)throw new h(`Graph.${a}: could not find the "${e}" node in the graph.`);return Pe(!1,this.multi,r===`mixed`?this.type:r,i,o,n)}if(arguments.length===3){e=``+e,t=``+t;let o=this._nodes.get(e);if(!o)throw new h(`Graph.${a}: could not find the "${e}" source node in the graph.`);if(!this._nodes.has(t))throw new h(`Graph.${a}: could not find the "${t}" target node in the graph.`);return Le(!1,r,this.multi,i,o,t,n)}throw new m(`Graph.${a}: too many arguments (expecting 1, 2 or 3 and got ${arguments.length}).`)}};let o=`map`+n[0].toUpperCase()+n.slice(1);e.prototype[o]=function(){let e=Array.prototype.slice.call(arguments),t=e.pop(),n;if(e.length===0){let i=0;r!==`directed`&&(i+=this.undirectedSize),r!==`undirected`&&(i+=this.directedSize),n=Array(i);let a=0;e.push((e,r,i,o,s,c,l)=>{n[a++]=t(e,r,i,o,s,c,l)})}else n=[],e.push((e,r,i,a,o,s,c)=>{n.push(t(e,r,i,a,o,s,c))});return this[a].apply(this,e),n};let s=`filter`+n[0].toUpperCase()+n.slice(1);e.prototype[s]=function(){let e=Array.prototype.slice.call(arguments),t=e.pop(),n=[];return e.push((e,r,i,a,o,s,c)=>{t(e,r,i,a,o,s,c)&&n.push(e)}),this[a].apply(this,e),n};let c=`reduce`+n[0].toUpperCase()+n.slice(1);e.prototype[c]=function(){let e=Array.prototype.slice.call(arguments);if(e.length<2||e.length>4)throw new m(`Graph.${c}: invalid number of arguments (expecting 2, 3 or 4 and got ${e.length}).`);if(typeof e[e.length-1]==`function`&&typeof e[e.length-2]!=`function`)throw new m(`Graph.${c}: missing initial value. You must provide it because the callback takes more than one argument and we cannot infer the initial value from the first iteration, as you could with a simple array.`);let t,n;e.length===2?(t=e[0],n=e[1],e=[]):e.length===3?(t=e[1],n=e[2],e=[e[0]]):e.length===4&&(t=e[2],n=e[3],e=[e[0],e[1]]);let r=n;return e.push((e,n,i,a,o,s,c)=>{r=t(r,e,n,i,a,o,s,c)}),this[a].apply(this,e),r}}function He(e,t){let{name:n,type:r,direction:i}=t,a=`find`+n[0].toUpperCase()+n.slice(1,-1);e.prototype[a]=function(e,t,n){if(r!==`mixed`&&this.type!==`mixed`&&r!==this.type)return!1;if(arguments.length===1)return n=e,Me(!0,this,r,n);if(arguments.length===2){e=``+e,n=t;let o=this._nodes.get(e);if(o===void 0)throw new h(`Graph.${a}: could not find the "${e}" node in the graph.`);return Pe(!0,this.multi,r===`mixed`?this.type:r,i,o,n)}if(arguments.length===3){e=``+e,t=``+t;let o=this._nodes.get(e);if(!o)throw new h(`Graph.${a}: could not find the "${e}" source node in the graph.`);if(!this._nodes.has(t))throw new h(`Graph.${a}: could not find the "${t}" target node in the graph.`);return Le(!0,r,this.multi,i,o,t,n)}throw new m(`Graph.${a}: too many arguments (expecting 1, 2 or 3 and got ${arguments.length}).`)};let o=`some`+n[0].toUpperCase()+n.slice(1,-1);e.prototype[o]=function(){let e=Array.prototype.slice.call(arguments),t=e.pop();return e.push((e,n,r,i,a,o,s)=>t(e,n,r,i,a,o,s)),!!this[a].apply(this,e)};let s=`every`+n[0].toUpperCase()+n.slice(1,-1);e.prototype[s]=function(){let e=Array.prototype.slice.call(arguments),t=e.pop();return e.push((e,n,r,i,a,o,s)=>!t(e,n,r,i,a,o,s)),!this[a].apply(this,e)}}function Ue(e,t){let{name:n,type:r,direction:i}=t,a=n.slice(0,-1)+`Entries`;e.prototype[a]=function(e,t){if(r!==`mixed`&&this.type!==`mixed`&&r!==this.type)return f();if(!arguments.length)return Ne(this,r);if(arguments.length===1){e=``+e;let t=this._nodes.get(e);if(!t)throw new h(`Graph.${a}: could not find the "${e}" node in the graph.`);return Ie(r,i,t)}if(arguments.length===2){e=``+e,t=``+t;let n=this._nodes.get(e);if(!n)throw new h(`Graph.${a}: could not find the "${e}" source node in the graph.`);if(!this._nodes.has(t))throw new h(`Graph.${a}: could not find the "${t}" target node in the graph.`);return ze(r,i,n,t)}throw new m(`Graph.${a}: too many arguments (expecting 0, 1 or 2 and got ${arguments.length}).`)}}function We(e){we.forEach(t=>{Be(e,t),Ve(e,t),He(e,t),Ue(e,t)})}let Ge=[{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 Ke(){this.A=null,this.B=null}Ke.prototype.wrap=function(e){this.A===null?this.A=e:this.B===null&&(this.B=e)},Ke.prototype.has=function(e){return this.A!==null&&e in this.A||this.B!==null&&e in this.B};function b(e,t,n,r,i){for(let a in r){let o=r[a],s=o.source,c=o.target,l=s===n?c:s;if(t&&t.has(l.key))continue;let u=i(l.key,l.attributes);if(e&&u)return l.key}}function qe(e,t,n,r,i){if(t!==`mixed`){if(t===`undirected`)return b(e,null,r,r.undirected,i);if(typeof n==`string`)return b(e,null,r,r[n],i)}let a=new Ke,o;if(t!==`undirected`){if(n!==`out`){if(o=b(e,null,r,r.in,i),e&&o)return o;a.wrap(r.in)}if(n!==`in`){if(o=b(e,a,r,r.out,i),e&&o)return o;a.wrap(r.out)}}if(t!==`directed`&&(o=b(e,a,r,r.undirected,i),e&&o))return o}function Je(e,t,n){if(e!==`mixed`){if(e===`undirected`)return Object.keys(n.undirected);if(typeof t==`string`)return Object.keys(n[t])}let r=[];return qe(!1,e,t,n,function(e){r.push(e)}),r}function Ye(e,t,n){let r=Object.keys(n),i=r.length,a=0;return{[Symbol.iterator](){return this},next(){let o=null;do{if(a>=i)return e&&e.wrap(n),{done:!0};let s=n[r[a++]],c=s.source,l=s.target;if(o=c===t?l:c,e&&e.has(o.key)){o=null;continue}}while(o===null);return{done:!1,value:{neighbor:o.key,attributes:o.attributes}}}}}function Xe(e,t,n){if(e!==`mixed`){if(e===`undirected`)return Ye(null,n,n.undirected);if(typeof t==`string`)return Ye(null,n,n[t])}let r=f(),i=new Ke;return e!==`undirected`&&(t!==`out`&&(r=d(r,Ye(i,n,n.in))),t!==`in`&&(r=d(r,Ye(i,n,n.out)))),e!==`directed`&&(r=d(r,Ye(i,n,n.undirected))),r}function Ze(e,t){let{name:n,type:r,direction:i}=t;e.prototype[n]=function(e){if(r!==`mixed`&&this.type!==`mixed`&&r!==this.type)return[];e=``+e;let t=this._nodes.get(e);if(t===void 0)throw new h(`Graph.${n}: could not find the "${e}" node in the graph.`);return Je(r===`mixed`?this.type:r,i,t)}}function Qe(e,t){let{name:n,type:r,direction:i}=t,a=`forEach`+n[0].toUpperCase()+n.slice(1,-1);e.prototype[a]=function(e,t){if(r!==`mixed`&&this.type!==`mixed`&&r!==this.type)return;e=``+e;let n=this._nodes.get(e);if(n===void 0)throw new h(`Graph.${a}: could not find the "${e}" node in the graph.`);qe(!1,r===`mixed`?this.type:r,i,n,t)};let o=`map`+n[0].toUpperCase()+n.slice(1);e.prototype[o]=function(e,t){let n=[];return this[a](e,(e,r)=>{n.push(t(e,r))}),n};let s=`filter`+n[0].toUpperCase()+n.slice(1);e.prototype[s]=function(e,t){let n=[];return this[a](e,(e,r)=>{t(e,r)&&n.push(e)}),n};let c=`reduce`+n[0].toUpperCase()+n.slice(1);e.prototype[c]=function(e,t,n){if(arguments.length<3)throw new m(`Graph.${c}: missing initial value. You must provide it because the callback takes more than one argument and we cannot infer the initial value from the first iteration, as you could with a simple array.`);let r=n;return this[a](e,(e,n)=>{r=t(r,e,n)}),r}}function $e(e,t){let{name:n,type:r,direction:i}=t,a=n[0].toUpperCase()+n.slice(1,-1),o=`find`+a;e.prototype[o]=function(e,t){if(r!==`mixed`&&this.type!==`mixed`&&r!==this.type)return;e=``+e;let n=this._nodes.get(e);if(n===void 0)throw new h(`Graph.${o}: could not find the "${e}" node in the graph.`);return qe(!0,r===`mixed`?this.type:r,i,n,t)};let s=`some`+a;e.prototype[s]=function(e,t){return!!this[o](e,t)};let c=`every`+a;e.prototype[c]=function(e,t){return!this[o](e,(e,n)=>!t(e,n))}}function et(e,t){let{name:n,type:r,direction:i}=t,a=n.slice(0,-1)+`Entries`;e.prototype[a]=function(e){if(r!==`mixed`&&this.type!==`mixed`&&r!==this.type)return f();e=``+e;let t=this._nodes.get(e);if(t===void 0)throw new h(`Graph.${a}: could not find the "${e}" node in the graph.`);return Xe(r===`mixed`?this.type:r,i,t)}}function tt(e){Ge.forEach(t=>{Ze(e,t),Qe(e,t),$e(e,t),et(e,t)})}function nt(e,t,n,r,i){let a=r._nodes.values(),o=r.type,s,c,l,u,d,f,p;for(;s=a.next(),s.done!==!0;){let r=!1;if(c=s.value,o!==`undirected`)for(l in u=c.out,u){d=u[l];do{if(f=d.target,r=!0,p=i(c.key,f.key,c.attributes,f.attributes,d.key,d.attributes,d.undirected),e&&p)return d;d=d.next}while(d)}if(o!==`directed`){for(l in u=c.undirected,u)if(!(t&&c.key>l)){d=u[l];do{if(f=d.target,f.key!==l&&(f=d.source),r=!0,p=i(c.key,f.key,c.attributes,f.attributes,d.key,d.attributes,d.undirected),e&&p)return d;d=d.next}while(d)}}if(n&&!r&&(p=i(c.key,null,c.attributes,null,null,null,null),e&&p))return null}}function rt(e,t){let n={key:e};return o(t.attributes)||(n.attributes=r({},t.attributes)),n}function it(e,t,n){let i={key:t,source:n.source.key,target:n.target.key};return o(n.attributes)||(i.attributes=r({},n.attributes)),e===`mixed`&&n.undirected&&(i.undirected=!0),i}function at(e){if(!a(e))throw new m(`Graph.import: invalid serialized node. A serialized node should be a plain object with at least a "key" property.`);if(!(`key`in e))throw new m(`Graph.import: serialized node is missing its key.`);if(`attributes`in e&&(!a(e.attributes)||e.attributes===null))throw new m(`Graph.import: invalid attributes. Attributes should be a plain object, null or omitted.`)}function ot(e){if(!a(e))throw new m(`Graph.import: invalid serialized edge. A serialized edge should be a plain object with at least a "source" & "target" property.`);if(!(`source`in e))throw new m(`Graph.import: serialized edge is missing its source.`);if(!(`target`in e))throw new m(`Graph.import: serialized edge is missing its target.`);if(`attributes`in e&&(!a(e.attributes)||e.attributes===null))throw new m(`Graph.import: invalid attributes. Attributes should be a plain object, null or omitted.`);if(`undirected`in e&&typeof e.undirected!=`boolean`)throw new m(`Graph.import: invalid undirectedness information. Undirected should be boolean or omitted.`)}let st=u(),ct=new Set([`directed`,`undirected`,`mixed`]),lt=new Set([`domain`,`_events`,`_eventsCount`,`_maxListeners`]),ut=[{name:e=>`${e}Edge`,generateKey:!0},{name:e=>`${e}DirectedEdge`,generateKey:!0,type:`directed`},{name:e=>`${e}UndirectedEdge`,generateKey:!0,type:`undirected`},{name:e=>`${e}EdgeWithKey`},{name:e=>`${e}DirectedEdgeWithKey`,type:`directed`},{name:e=>`${e}UndirectedEdgeWithKey`,type:`undirected`}],dt={allowSelfLoops:!0,multi:!1,type:`mixed`};function ft(e,t,n){if(n&&!a(n))throw new m(`Graph.addNode: invalid attributes. Expecting an object but got "${n}"`);if(t=``+t,n||={},e._nodes.has(t))throw new g(`Graph.addNode: the "${t}" node already exist in the graph.`);let r=new e.NodeDataClass(t,n);return e._nodes.set(t,r),e.emit(`nodeAdded`,{key:t,attributes:n}),r}function pt(e,t,n){let r=new e.NodeDataClass(t,n);return e._nodes.set(t,r),e.emit(`nodeAdded`,{key:t,attributes:n}),r}function mt(e,t,n,r,i,o,s,c){if(!r&&e.type===`undirected`)throw new g(`Graph.${t}: you cannot add a directed edge to an undirected graph. Use the #.addEdge or #.addUndirectedEdge instead.`);if(r&&e.type===`directed`)throw new g(`Graph.${t}: you cannot add an undirected edge to a directed graph. Use the #.addEdge or #.addDirectedEdge instead.`);if(c&&!a(c))throw new m(`Graph.${t}: invalid attributes. Expecting an object but got "${c}"`);if(o=``+o,s=``+s,c||={},!e.allowSelfLoops&&o===s)throw new g(`Graph.${t}: source & target are the same ("${o}"), thus creating a loop explicitly forbidden by this graph 'allowSelfLoops' option set to false.`);let l=e._nodes.get(o),u=e._nodes.get(s);if(!l)throw new h(`Graph.${t}: source node "${o}" not found.`);if(!u)throw new h(`Graph.${t}: target node "${s}" not found.`);let d={key:null,undirected:r,source:o,target:s,attributes:c};if(n)i=e._edgeKeyGenerator();else if(i=``+i,e._edges.has(i))throw new g(`Graph.${t}: the "${i}" edge already exists in the graph.`);if(!e.multi&&(r?l.undirected[s]!==void 0:l.out[s]!==void 0))throw new g(`Graph.${t}: an edge linking "${o}" to "${s}" already exists. If you really want to add multiple edges linking those nodes, you should create a multi graph by using the 'multi' option.`);let f=new v(r,i,l,u,c);e._edges.set(i,f);let p=o===s;return r?(l.undirectedDegree++,u.undirectedDegree++,p&&(l.undirectedLoops++,e._undirectedSelfLoopCount++)):(l.outDegree++,u.inDegree++,p&&(l.directedLoops++,e._directedSelfLoopCount++)),e.multi?f.attachMulti():f.attach(),r?e._undirectedSize++:e._directedSize++,d.key=i,e.emit(`edgeAdded`,d),i}function ht(e,t,n,i,o,s,c,l,u){if(!i&&e.type===`undirected`)throw new g(`Graph.${t}: you cannot merge/update a directed edge to an undirected graph. Use the #.mergeEdge/#.updateEdge or #.addUndirectedEdge instead.`);if(i&&e.type===`directed`)throw new g(`Graph.${t}: you cannot merge/update an undirected edge to a directed graph. Use the #.mergeEdge/#.updateEdge or #.addDirectedEdge instead.`);if(l){if(u){if(typeof l!=`function`)throw new m(`Graph.${t}: invalid updater function. Expecting a function but got "${l}"`)}else if(!a(l))throw new m(`Graph.${t}: invalid attributes. Expecting an object but got "${l}"`)}s=``+s,c=``+c;let d;if(u&&(d=l,l=void 0),!e.allowSelfLoops&&s===c)throw new g(`Graph.${t}: source & target are the same ("${s}"), thus creating a loop explicitly forbidden by this graph 'allowSelfLoops' option set to false.`);let f=e._nodes.get(s),p=e._nodes.get(c),h,_;if(!n&&(h=e._edges.get(o),h)){if((h.source.key!==s||h.target.key!==c)&&(!i||h.source.key!==c||h.target.key!==s))throw new g(`Graph.${t}: inconsistency detected when attempting to merge the "${o}" edge with "${s}" source & "${c}" target vs. ("${h.source.key}", "${h.target.key}").`);_=h}if(!_&&!e.multi&&f&&(_=i?f.undirected[c]:f.out[c]),_){let t=[_.key,!1,!1,!1];if(u?!d:!l)return t;if(u){let t=_.attributes;_.attributes=d(t),e.emit(`edgeAttributesUpdated`,{type:`replace`,key:_.key,attributes:_.attributes})}else r(_.attributes,l),e.emit(`edgeAttributesUpdated`,{type:`merge`,key:_.key,attributes:_.attributes,data:l});return t}l||={},u&&d&&(l=d(l));let ee={key:null,undirected:i,source:s,target:c,attributes:l};if(n)o=e._edgeKeyGenerator();else if(o=``+o,e._edges.has(o))throw new g(`Graph.${t}: the "${o}" edge already exists in the graph.`);let te=!1,y=!1;f||(f=pt(e,s,{}),te=!0,s===c&&(p=f,y=!0)),p||(p=pt(e,c,{}),y=!0),h=new v(i,o,f,p,l),e._edges.set(o,h);let ne=s===c;return i?(f.undirectedDegree++,p.undirectedDegree++,ne&&(f.undirectedLoops++,e._undirectedSelfLoopCount++)):(f.outDegree++,p.inDegree++,ne&&(f.directedLoops++,e._directedSelfLoopCount++)),e.multi?h.attachMulti():h.attach(),i?e._undirectedSize++:e._directedSize++,ee.key=o,e.emit(`edgeAdded`,ee),[o,!0,te,y]}function x(e,t){e._edges.delete(t.key);let{source:n,target:r,attributes:i}=t,a=t.undirected,o=n===r;a?(n.undirectedDegree--,r.undirectedDegree--,o&&(n.undirectedLoops--,e._undirectedSelfLoopCount--)):(n.outDegree--,r.inDegree--,o&&(n.directedLoops--,e._directedSelfLoopCount--)),e.multi?t.detachMulti():t.detach(),a?e._undirectedSize--:e._directedSize--,e.emit(`edgeDropped`,{key:t.key,attributes:i,source:n.key,target:r.key,undirected:a})}var S=class e extends t.EventEmitter{constructor(e){if(super(),e=r({},dt,e),typeof e.multi!=`boolean`)throw new m(`Graph.constructor: invalid 'multi' option. Expecting a boolean but got "${e.multi}".`);if(!ct.has(e.type))throw new m(`Graph.constructor: invalid 'type' option. Should be one of "mixed", "directed" or "undirected" but got "${e.type}".`);if(typeof e.allowSelfLoops!=`boolean`)throw new m(`Graph.constructor: invalid 'allowSelfLoops' option. Expecting a boolean but got "${e.allowSelfLoops}".`);let t=e.type===`mixed`?_:e.type===`directed`?ee:te;s(this,`NodeDataClass`,t);let n=`geid_`+st()+`_`,i=0;s(this,`_attributes`,{}),s(this,`_nodes`,new Map),s(this,`_edges`,new Map),s(this,`_directedSize`,0),s(this,`_undirectedSize`,0),s(this,`_directedSelfLoopCount`,0),s(this,`_undirectedSelfLoopCount`,0),s(this,`_edgeKeyGenerator`,()=>{let e;do e=n+i++;while(this._edges.has(e));return e}),s(this,`_options`,e),lt.forEach(e=>s(this,e,this[e])),c(this,`order`,()=>this._nodes.size),c(this,`size`,()=>this._edges.size),c(this,`directedSize`,()=>this._directedSize),c(this,`undirectedSize`,()=>this._undirectedSize),c(this,`selfLoopCount`,()=>this._directedSelfLoopCount+this._undirectedSelfLoopCount),c(this,`directedSelfLoopCount`,()=>this._directedSelfLoopCount),c(this,`undirectedSelfLoopCount`,()=>this._undirectedSelfLoopCount),c(this,`multi`,this._options.multi),c(this,`type`,this._options.type),c(this,`allowSelfLoops`,this._options.allowSelfLoops),c(this,`implementation`,()=>`graphology`)}_resetInstanceCounters(){this._directedSize=0,this._undirectedSize=0,this._directedSelfLoopCount=0,this._undirectedSelfLoopCount=0}hasNode(e){return this._nodes.has(``+e)}hasDirectedEdge(e,t){if(this.type===`undirected`)return!1;if(arguments.length===1){let t=``+e,n=this._edges.get(t);return!!n&&!n.undirected}if(arguments.length===2){e=``+e,t=``+t;let n=this._nodes.get(e);return n?n.out.hasOwnProperty(t):!1}throw new m(`Graph.hasDirectedEdge: invalid arity (${arguments.length}, instead of 1 or 2). You can either ask for an edge id or for the existence of an edge between a source & a target.`)}hasUndirectedEdge(e,t){if(this.type===`directed`)return!1;if(arguments.length===1){let t=``+e,n=this._edges.get(t);return!!n&&n.undirected}if(arguments.length===2){e=``+e,t=``+t;let n=this._nodes.get(e);return n?n.undirected.hasOwnProperty(t):!1}throw new m(`Graph.hasDirectedEdge: invalid arity (${arguments.length}, instead of 1 or 2). You can either ask for an edge id or for the existence of an edge between a source & a target.`)}hasEdge(e,t){if(arguments.length===1){let t=``+e;return this._edges.has(t)}if(arguments.length===2){e=``+e,t=``+t;let n=this._nodes.get(e);return n?n.out!==void 0&&n.out.hasOwnProperty(t)||n.undirected!==void 0&&n.undirected.hasOwnProperty(t):!1}throw new m(`Graph.hasEdge: invalid arity (${arguments.length}, instead of 1 or 2). You can either ask for an edge id or for the existence of an edge between a source & a target.`)}directedEdge(e,t){if(this.type===`undirected`)return;if(e=``+e,t=``+t,this.multi)throw new g(`Graph.directedEdge: this method is irrelevant with multigraphs since there might be multiple edges between source & target. See #.directedEdges instead.`);let n=this._nodes.get(e);if(!n)throw new h(`Graph.directedEdge: could not find the "${e}" source node in the graph.`);if(!this._nodes.has(t))throw new h(`Graph.directedEdge: could not find the "${t}" target node in the graph.`);let r=n.out&&n.out[t]||void 0;if(r)return r.key}undirectedEdge(e,t){if(this.type===`directed`)return;if(e=``+e,t=``+t,this.multi)throw new g(`Graph.undirectedEdge: this method is irrelevant with multigraphs since there might be multiple edges between source & target. See #.undirectedEdges instead.`);let n=this._nodes.get(e);if(!n)throw new h(`Graph.undirectedEdge: could not find the "${e}" source node in the graph.`);if(!this._nodes.has(t))throw new h(`Graph.undirectedEdge: could not find the "${t}" target node in the graph.`);let r=n.undirected&&n.undirected[t]||void 0;if(r)return r.key}edge(e,t){if(this.multi)throw new g(`Graph.edge: this method is irrelevant with multigraphs since there might be multiple edges between source & target. See #.edges instead.`);e=``+e,t=``+t;let n=this._nodes.get(e);if(!n)throw new h(`Graph.edge: could not find the "${e}" source node in the graph.`);if(!this._nodes.has(t))throw new h(`Graph.edge: could not find the "${t}" target node in the graph.`);let r=n.out&&n.out[t]||n.undirected&&n.undirected[t]||void 0;if(r)return r.key}areDirectedNeighbors(e,t){e=``+e,t=``+t;let n=this._nodes.get(e);if(!n)throw new h(`Graph.areDirectedNeighbors: could not find the "${e}" node in the graph.`);return this.type===`undirected`?!1:t in n.in||t in n.out}areOutNeighbors(e,t){e=``+e,t=``+t;let n=this._nodes.get(e);if(!n)throw new h(`Graph.areOutNeighbors: could not find the "${e}" node in the graph.`);return this.type!==`undirected`&&t in n.out}areInNeighbors(e,t){e=``+e,t=``+t;let n=this._nodes.get(e);if(!n)throw new h(`Graph.areInNeighbors: could not find the "${e}" node in the graph.`);return this.type!==`undirected`&&t in n.in}areUndirectedNeighbors(e,t){e=``+e,t=``+t;let n=this._nodes.get(e);if(!n)throw new h(`Graph.areUndirectedNeighbors: could not find the "${e}" node in the graph.`);return this.type!==`directed`&&t in n.undirected}areNeighbors(e,t){e=``+e,t=``+t;let n=this._nodes.get(e);if(!n)throw new h(`Graph.areNeighbors: could not find the "${e}" node in the graph.`);return this.type!==`undirected`&&(t in n.in||t in n.out)||this.type!==`directed`&&t in n.undirected}areInboundNeighbors(e,t){e=``+e,t=``+t;let n=this._nodes.get(e);if(!n)throw new h(`Graph.areInboundNeighbors: could not find the "${e}" node in the graph.`);return this.type!==`undirected`&&t in n.in||this.type!==`directed`&&t in n.undirected}areOutboundNeighbors(e,t){e=``+e,t=``+t;let n=this._nodes.get(e);if(!n)throw new h(`Graph.areOutboundNeighbors: could not find the "${e}" node in the graph.`);return this.type!==`undirected`&&t in n.out||this.type!==`directed`&&t in n.undirected}inDegree(e){e=``+e;let t=this._nodes.get(e);if(!t)throw new h(`Graph.inDegree: could not find the "${e}" node in the graph.`);return this.type===`undirected`?0:t.inDegree}outDegree(e){e=``+e;let t=this._nodes.get(e);if(!t)throw new h(`Graph.outDegree: could not find the "${e}" node in the graph.`);return this.type===`undirected`?0:t.outDegree}directedDegree(e){e=``+e;let t=this._nodes.get(e);if(!t)throw new h(`Graph.directedDegree: could not find the "${e}" node in the graph.`);return this.type===`undirected`?0:t.inDegree+t.outDegree}undirectedDegree(e){e=``+e;let t=this._nodes.get(e);if(!t)throw new h(`Graph.undirectedDegree: could not find the "${e}" node in the graph.`);return this.type===`directed`?0:t.undirectedDegree}inboundDegree(e){e=``+e;let t=this._nodes.get(e);if(!t)throw new h(`Graph.inboundDegree: could not find the "${e}" node in the graph.`);let n=0;return this.type!==`directed`&&(n+=t.undirectedDegree),this.type!==`undirected`&&(n+=t.inDegree),n}outboundDegree(e){e=``+e;let t=this._nodes.get(e);if(!t)throw new h(`Graph.outboundDegree: could not find the "${e}" node in the graph.`);let n=0;return this.type!==`directed`&&(n+=t.undirectedDegree),this.type!==`undirected`&&(n+=t.outDegree),n}degree(e){e=``+e;let t=this._nodes.get(e);if(!t)throw new h(`Graph.degree: could not find the "${e}" node in the graph.`);let n=0;return this.type!==`directed`&&(n+=t.undirectedDegree),this.type!==`undirected`&&(n+=t.inDegree+t.outDegree),n}inDegreeWithoutSelfLoops(e){e=``+e;let t=this._nodes.get(e);if(!t)throw new h(`Graph.inDegreeWithoutSelfLoops: could not find the "${e}" node in the graph.`);return this.type===`undirected`?0:t.inDegree-t.directedLoops}outDegreeWithoutSelfLoops(e){e=``+e;let t=this._nodes.get(e);if(!t)throw new h(`Graph.outDegreeWithoutSelfLoops: could not find the "${e}" node in the graph.`);return this.type===`undirected`?0:t.outDegree-t.directedLoops}directedDegreeWithoutSelfLoops(e){e=``+e;let t=this._nodes.get(e);if(!t)throw new h(`Graph.directedDegreeWithoutSelfLoops: could not find the "${e}" node in the graph.`);return this.type===`undirected`?0:t.inDegree+t.outDegree-t.directedLoops*2}undirectedDegreeWithoutSelfLoops(e){e=``+e;let t=this._nodes.get(e);if(!t)throw new h(`Graph.undirectedDegreeWithoutSelfLoops: could not find the "${e}" node in the graph.`);return this.type===`directed`?0:t.undirectedDegree-t.undirectedLoops*2}inboundDegreeWithoutSelfLoops(e){e=``+e;let t=this._nodes.get(e);if(!t)throw new h(`Graph.inboundDegreeWithoutSelfLoops: could not find the "${e}" node in the graph.`);let n=0,r=0;return this.type!==`directed`&&(n+=t.undirectedDegree,r+=t.undirectedLoops*2),this.type!==`undirected`&&(n+=t.inDegree,r+=t.directedLoops),n-r}outboundDegreeWithoutSelfLoops(e){e=``+e;let t=this._nodes.get(e);if(!t)throw new h(`Graph.outboundDegreeWithoutSelfLoops: could not find the "${e}" node in the graph.`);let n=0,r=0;return this.type!==`directed`&&(n+=t.undirectedDegree,r+=t.undirectedLoops*2),this.type!==`undirected`&&(n+=t.outDegree,r+=t.directedLoops),n-r}degreeWithoutSelfLoops(e){e=``+e;let t=this._nodes.get(e);if(!t)throw new h(`Graph.degreeWithoutSelfLoops: could not find the "${e}" node in the graph.`);let n=0,r=0;return this.type!==`directed`&&(n+=t.undirectedDegree,r+=t.undirectedLoops*2),this.type!==`undirected`&&(n+=t.inDegree+t.outDegree,r+=t.directedLoops*2),n-r}source(e){e=``+e;let t=this._edges.get(e);if(!t)throw new h(`Graph.source: could not find the "${e}" edge in the graph.`);return t.source.key}target(e){e=``+e;let t=this._edges.get(e);if(!t)throw new h(`Graph.target: could not find the "${e}" edge in the graph.`);return t.target.key}extremities(e){e=``+e;let t=this._edges.get(e);if(!t)throw new h(`Graph.extremities: could not find the "${e}" edge in the graph.`);return[t.source.key,t.target.key]}opposite(e,t){e=``+e,t=``+t;let n=this._edges.get(t);if(!n)throw new h(`Graph.opposite: could not find the "${t}" edge in the graph.`);let r=n.source.key,i=n.target.key;if(e===r)return i;if(e===i)return r;throw new h(`Graph.opposite: the "${e}" node is not attached to the "${t}" edge (${r}, ${i}).`)}hasExtremity(e,t){e=``+e,t=``+t;let n=this._edges.get(e);if(!n)throw new h(`Graph.hasExtremity: could not find the "${e}" edge in the graph.`);return n.source.key===t||n.target.key===t}isUndirected(e){e=``+e;let t=this._edges.get(e);if(!t)throw new h(`Graph.isUndirected: could not find the "${e}" edge in the graph.`);return t.undirected}isDirected(e){e=``+e;let t=this._edges.get(e);if(!t)throw new h(`Graph.isDirected: could not find the "${e}" edge in the graph.`);return!t.undirected}isSelfLoop(e){e=``+e;let t=this._edges.get(e);if(!t)throw new h(`Graph.isSelfLoop: could not find the "${e}" edge in the graph.`);return t.source===t.target}addNode(e,t){return ft(this,e,t).key}mergeNode(e,t){if(t&&!a(t))throw new m(`Graph.mergeNode: invalid attributes. Expecting an object but got "${t}"`);e=``+e,t||={};let n=this._nodes.get(e);return n?(t&&(r(n.attributes,t),this.emit(`nodeAttributesUpdated`,{type:`merge`,key:e,attributes:n.attributes,data:t})),[e,!1]):(n=new this.NodeDataClass(e,t),this._nodes.set(e,n),this.emit(`nodeAdded`,{key:e,attributes:t}),[e,!0])}updateNode(e,t){if(t&&typeof t!=`function`)throw new m(`Graph.updateNode: invalid updater function. Expecting a function but got "${t}"`);e=``+e;let n=this._nodes.get(e);if(n){if(t){let r=n.attributes;n.attributes=t(r),this.emit(`nodeAttributesUpdated`,{type:`replace`,key:e,attributes:n.attributes})}return[e,!1]}let r=t?t({}):{};return n=new this.NodeDataClass(e,r),this._nodes.set(e,n),this.emit(`nodeAdded`,{key:e,attributes:r}),[e,!0]}dropNode(e){e=``+e;let t=this._nodes.get(e);if(!t)throw new h(`Graph.dropNode: could not find the "${e}" node in the graph.`);let n;if(this.type!==`undirected`){for(let e in t.out){n=t.out[e];do x(this,n),n=n.next;while(n)}for(let e in t.in){n=t.in[e];do x(this,n),n=n.next;while(n)}}if(this.type!==`directed`)for(let e in t.undirected){n=t.undirected[e];do x(this,n),n=n.next;while(n)}this._nodes.delete(e),this.emit(`nodeDropped`,{key:e,attributes:t.attributes})}dropEdge(e){let t;if(arguments.length>1){let e=``+arguments[0],n=``+arguments[1];if(t=i(this,e,n,this.type),!t)throw new h(`Graph.dropEdge: could not find the "${e}" -> "${n}" edge in the graph.`)}else if(e=``+e,t=this._edges.get(e),!t)throw new h(`Graph.dropEdge: could not find the "${e}" edge in the graph.`);return x(this,t),this}dropDirectedEdge(e,t){if(arguments.length<2)throw new g(`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 g(`Graph.dropDirectedEdge: cannot use a {source,target} combo when dropping an edge in a MultiGraph since we cannot infer the one you want to delete as there could be multiple ones.`);e=``+e,t=``+t;let n=i(this,e,t,`directed`);if(!n)throw new h(`Graph.dropDirectedEdge: could not find a "${e}" -> "${t}" edge in the graph.`);return x(this,n),this}dropUndirectedEdge(e,t){if(arguments.length<2)throw new g(`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 g(`Graph.dropUndirectedEdge: cannot use a {source,target} combo when dropping an edge in a MultiGraph since we cannot infer the one you want to delete as there could be multiple ones.`);let n=i(this,e,t,`undirected`);if(!n)throw new h(`Graph.dropUndirectedEdge: could not find a "${e}" -> "${t}" edge in the graph.`);return x(this,n),this}clear(){this._edges.clear(),this._nodes.clear(),this._resetInstanceCounters(),this.emit(`cleared`)}clearEdges(){let e=this._nodes.values(),t;for(;t=e.next(),t.done!==!0;)t.value.clear();this._edges.clear(),this._resetInstanceCounters(),this.emit(`edgesCleared`)}getAttribute(e){return this._attributes[e]}getAttributes(){return this._attributes}hasAttribute(e){return this._attributes.hasOwnProperty(e)}setAttribute(e,t){return this._attributes[e]=t,this.emit(`attributesUpdated`,{type:`set`,attributes:this._attributes,name:e}),this}updateAttribute(e,t){if(typeof t!=`function`)throw new m(`Graph.updateAttribute: updater should be a function.`);let n=this._attributes[e];return this._attributes[e]=t(n),this.emit(`attributesUpdated`,{type:`set`,attributes:this._attributes,name:e}),this}removeAttribute(e){return delete this._attributes[e],this.emit(`attributesUpdated`,{type:`remove`,attributes:this._attributes,name:e}),this}replaceAttributes(e){if(!a(e))throw new m(`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(!a(e))throw new m(`Graph.mergeAttributes: provided attributes are not a plain object.`);return r(this._attributes,e),this.emit(`attributesUpdated`,{type:`merge`,attributes:this._attributes,data:e}),this}updateAttributes(e){if(typeof e!=`function`)throw new m(`Graph.updateAttributes: provided updater is not a function.`);return this._attributes=e(this._attributes),this.emit(`attributesUpdated`,{type:`update`,attributes:this._attributes}),this}updateEachNodeAttributes(e,t){if(typeof e!=`function`)throw new m(`Graph.updateEachNodeAttributes: expecting an updater function.`);if(t&&!l(t))throw new m(`Graph.updateEachNodeAttributes: invalid hints. Expecting an object having the following shape: {attributes?: [string]}`);let n=this._nodes.values(),r,i;for(;r=n.next(),r.done!==!0;)i=r.value,i.attributes=e(i.key,i.attributes);this.emit(`eachNodeAttributesUpdated`,{hints:t||null})}updateEachEdgeAttributes(e,t){if(typeof e!=`function`)throw new m(`Graph.updateEachEdgeAttributes: expecting an updater function.`);if(t&&!l(t))throw new m(`Graph.updateEachEdgeAttributes: invalid hints. Expecting an object having the following shape: {attributes?: [string]}`);let n=this._edges.values(),r,i,a,o;for(;r=n.next(),r.done!==!0;)i=r.value,a=i.source,o=i.target,i.attributes=e(i.key,i.attributes,a.key,o.key,a.attributes,o.attributes,i.undirected);this.emit(`eachEdgeAttributesUpdated`,{hints:t||null})}forEachAdjacencyEntry(e){if(typeof e!=`function`)throw new m(`Graph.forEachAdjacencyEntry: expecting a callback.`);nt(!1,!1,!1,this,e)}forEachAdjacencyEntryWithOrphans(e){if(typeof e!=`function`)throw new m(`Graph.forEachAdjacencyEntryWithOrphans: expecting a callback.`);nt(!1,!1,!0,this,e)}forEachAssymetricAdjacencyEntry(e){if(typeof e!=`function`)throw new m(`Graph.forEachAssymetricAdjacencyEntry: expecting a callback.`);nt(!1,!0,!1,this,e)}forEachAssymetricAdjacencyEntryWithOrphans(e){if(typeof e!=`function`)throw new m(`Graph.forEachAssymetricAdjacencyEntryWithOrphans: expecting a callback.`);nt(!1,!0,!0,this,e)}nodes(){return Array.from(this._nodes.keys())}forEachNode(e){if(typeof e!=`function`)throw new m(`Graph.forEachNode: expecting a callback.`);let t=this._nodes.values(),n,r;for(;n=t.next(),n.done!==!0;)r=n.value,e(r.key,r.attributes)}findNode(e){if(typeof e!=`function`)throw new m(`Graph.findNode: expecting a callback.`);let t=this._nodes.values(),n,r;for(;n=t.next(),n.done!==!0;)if(r=n.value,e(r.key,r.attributes))return r.key}mapNodes(e){if(typeof e!=`function`)throw new m(`Graph.mapNode: expecting a callback.`);let t=this._nodes.values(),n,r,i=Array(this.order),a=0;for(;n=t.next(),n.done!==!0;)r=n.value,i[a++]=e(r.key,r.attributes);return i}someNode(e){if(typeof e!=`function`)throw new m(`Graph.someNode: expecting a callback.`);let t=this._nodes.values(),n,r;for(;n=t.next(),n.done!==!0;)if(r=n.value,e(r.key,r.attributes))return!0;return!1}everyNode(e){if(typeof e!=`function`)throw new m(`Graph.everyNode: expecting a callback.`);let t=this._nodes.values(),n,r;for(;n=t.next(),n.done!==!0;)if(r=n.value,!e(r.key,r.attributes))return!1;return!0}filterNodes(e){if(typeof e!=`function`)throw new m(`Graph.filterNodes: expecting a callback.`);let t=this._nodes.values(),n,r,i=[];for(;n=t.next(),n.done!==!0;)r=n.value,e(r.key,r.attributes)&&i.push(r.key);return i}reduceNodes(e,t){if(typeof e!=`function`)throw new m(`Graph.reduceNodes: expecting a callback.`);if(arguments.length<2)throw new m(`Graph.reduceNodes: missing initial value. You must provide it because the callback takes more than one argument and we cannot infer the initial value from the first iteration, as you could with a simple array.`);let n=t,r=this._nodes.values(),i,a;for(;i=r.next(),i.done!==!0;)a=i.value,n=e(n,a.key,a.attributes);return n}nodeEntries(){let e=this._nodes.values();return{[Symbol.iterator](){return this},next(){let t=e.next();if(t.done)return t;let n=t.value;return{value:{node:n.key,attributes:n.attributes},done:!1}}}}export(){let e=Array(this._nodes.size),t=0;this._nodes.forEach((n,r)=>{e[t++]=rt(r,n)});let n=Array(this._edges.size);return t=0,this._edges.forEach((e,r)=>{n[t++]=it(this.type,r,e)}),{options:{type:this.type,multi:this.multi,allowSelfLoops:this.allowSelfLoops},attributes:this.getAttributes(),nodes:e,edges:n}}import(t,n=!1){if(t instanceof e)return t.forEachNode((e,t)=>{n?this.mergeNode(e,t):this.addNode(e,t)}),t.forEachEdge((e,t,r,i,a,o,s)=>{n?s?this.mergeUndirectedEdgeWithKey(e,r,i,t):this.mergeDirectedEdgeWithKey(e,r,i,t):s?this.addUndirectedEdgeWithKey(e,r,i,t):this.addDirectedEdgeWithKey(e,r,i,t)}),this;if(!a(t))throw new m(`Graph.import: invalid argument. Expecting a serialized graph or, alternatively, a Graph instance.`);if(t.attributes){if(!a(t.attributes))throw new m(`Graph.import: invalid attributes. Expecting a plain object.`);n?this.mergeAttributes(t.attributes):this.replaceAttributes(t.attributes)}let r,i,o,s,c;if(t.nodes){if(o=t.nodes,!Array.isArray(o))throw new m(`Graph.import: invalid nodes. Expecting an array.`);for(r=0,i=o.length;r<i;r++){s=o[r],at(s);let{key:e,attributes:t}=s;n?this.mergeNode(e,t):this.addNode(e,t)}}if(t.edges){let e=!1;if(this.type===`undirected`&&(e=!0),o=t.edges,!Array.isArray(o))throw new m(`Graph.import: invalid edges. Expecting an array.`);for(r=0,i=o.length;r<i;r++){c=o[r],ot(c);let{source:t,target:i,attributes:a,undirected:s=e}=c,l;`key`in c?(l=n?s?this.mergeUndirectedEdgeWithKey:this.mergeDirectedEdgeWithKey:s?this.addUndirectedEdgeWithKey:this.addDirectedEdgeWithKey,l.call(this,c.key,t,i,a)):(l=n?s?this.mergeUndirectedEdge:this.mergeDirectedEdge:s?this.addUndirectedEdge:this.addDirectedEdge,l.call(this,t,i,a))}}return this}nullCopy(t){let n=new e(r({},this._options,t));return n.replaceAttributes(r({},this.getAttributes())),n}emptyCopy(e){let t=this.nullCopy(e);return this._nodes.forEach((e,n)=>{let i=r({},e.attributes);e=new t.NodeDataClass(n,i),t._nodes.set(n,e)}),t}copy(e){if(e||={},typeof e.type==`string`&&e.type!==this.type&&e.type!==`mixed`)throw new g(`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 g(`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 g(`Graph.copy: cannot create an incompatible copy from a graph allowing self loops to one that does not because this would mean losing information about the current graph.`);let t=this.emptyCopy(e),n=this._edges.values(),i,a;for(;i=n.next(),i.done!==!0;)a=i.value,mt(t,`copy`,!1,a.undirected,a.key,a.source.key,a.target.key,r({},a.attributes));return t}toJSON(){return this.export()}toString(){return`[object Graph]`}inspect(){let e={};this._nodes.forEach((t,n)=>{e[n]=t.attributes});let t={},n={};this._edges.forEach((e,r)=>{let i=e.undirected?`--`:`->`,a=``,o=e.source.key,s=e.target.key,c;e.undirected&&o>s&&(c=o,o=s,s=c);let l=`(${o})${i}(${s})`;r.startsWith(`geid_`)?this.multi&&(n[l]===void 0?n[l]=0:n[l]++,a+=`${n[l]}. `):a+=`[${r}]: `,a+=l,t[a]=e.attributes});let r={};for(let e in this)this.hasOwnProperty(e)&&!lt.has(e)&&typeof this[e]!=`function`&&typeof e!=`symbol`&&(r[e]=this[e]);return r.attributes=this._attributes,r.nodes=e,r.edges=t,s(r,`constructor`,this.constructor),r}};typeof Symbol<`u`&&(S.prototype[Symbol.for(`nodejs.util.inspect.custom`)]=S.prototype.inspect),ut.forEach(e=>{[`add`,`merge`,`update`].forEach(t=>{let n=e.name(t),r=t===`add`?mt:ht;e.generateKey?S.prototype[n]=function(i,a,o){return r(this,n,!0,(e.type||this.type)===`undirected`,null,i,a,o,t===`update`)}:S.prototype[n]=function(i,a,o,s){return r(this,n,!1,(e.type||this.type)===`undirected`,i,a,o,s,t===`update`)}})}),fe(S),Ce(S),We(S),tt(S);var gt=class extends S{constructor(e){let t=r({type:`directed`},e);if(`multi`in t&&t.multi!==!1)throw new m(`DirectedGraph.from: inconsistent indication that the graph should be multi in given options!`);if(t.type!==`directed`)throw new m(`DirectedGraph.from: inconsistent "`+t.type+`" type in given options!`);super(t)}},_t=class extends S{constructor(e){let t=r({type:`undirected`},e);if(`multi`in t&&t.multi!==!1)throw new m(`UndirectedGraph.from: inconsistent indication that the graph should be multi in given options!`);if(t.type!==`undirected`)throw new m(`UndirectedGraph.from: inconsistent "`+t.type+`" type in given options!`);super(t)}},vt=class extends S{constructor(e){let t=r({multi:!0},e);if(`multi`in t&&t.multi!==!0)throw new m(`MultiGraph.from: inconsistent indication that the graph should be simple in given options!`);super(t)}},yt=class extends S{constructor(e){let t=r({type:`directed`,multi:!0},e);if(`multi`in t&&t.multi!==!0)throw new m(`MultiDirectedGraph.from: inconsistent indication that the graph should be simple in given options!`);if(t.type!==`directed`)throw new m(`MultiDirectedGraph.from: inconsistent "`+t.type+`" type in given options!`);super(t)}},bt=class extends S{constructor(e){let t=r({type:`undirected`,multi:!0},e);if(`multi`in t&&t.multi!==!0)throw new m(`MultiUndirectedGraph.from: inconsistent indication that the graph should be simple in given options!`);if(t.type!==`undirected`)throw new m(`MultiUndirectedGraph.from: inconsistent "`+t.type+`" type in given options!`);super(t)}};function C(e){e.from=function(t,n){let i=new e(r({},t.options,n));return i.import(t),i}}C(S),C(gt),C(_t),C(vt),C(yt),C(bt),S.Graph=S,S.DirectedGraph=gt,S.UndirectedGraph=_t,S.MultiGraph=vt,S.MultiDirectedGraph=yt,S.MultiUndirectedGraph=bt,S.InvalidArgumentsGraphError=m,S.NotFoundGraphError=h,S.UsageGraphError=g;var xt=e(((e,t)=>{t.exports=function(e){return typeof e==`object`&&!!e&&typeof e.addUndirectedEdgeWithKey==`function`&&typeof e.dropNode==`function`&&typeof e.multi==`boolean`}})),St=e(((e,t)=>{let n=xt();t.exports=function(e){if(!n(e))throw Error(`graphology-dag/has-cycle: the given graph is not a valid graphology instance.`);if(e.size===0)return!1;if(e.selfLoopCount!==0)return!0;let t={},r=[];function i(e){let n=t[e];if(n===void 0)r.push(e);else if(n===0)return!0;return!1}return e.someNode(n=>{if(t[n]===1)return!1;for(r.push(n);r.length!==0;){let n=r[r.length-1],a=t[n];if(a!==0){if(t[n]=0,e.someOutboundNeighbor(n,i))return!0}else a===0&&(r.pop(),t[n]=1)}return!1})}})),Ct=e(((e,t)=>{let n=xt();t.exports=function(e,t,r){if(!n(e))throw Error(`graphology-dag/will-create-cycle: the given graph is not a valid graphology instance.`);if(t=``+t,r=``+r,t===r)return!0;if(!e.hasNode(t)||!e.hasNode(r)||e.hasDirectedEdge(t,r))return!1;if(e.hasDirectedEdge(r,t))return!0;let i=e.outNeighbors(r);function a(e){i.push(e)}for(;i.length!==0;){let n=i.pop();if(n===t)return!0;e.forEachOutNeighbor(n,a)}return!1}})),wt=e((e=>{e.ARRAY_BUFFER_SUPPORT=typeof ArrayBuffer<`u`,e.SYMBOL_SUPPORT=typeof Symbol<`u`})),Tt=e(((e,t)=>{var n=wt(),r=n.ARRAY_BUFFER_SUPPORT,i=n.SYMBOL_SUPPORT;t.exports=function(e,t){var n,a,o,s,c;if(!e)throw Error(`obliterator/forEach: invalid iterable.`);if(typeof t!=`function`)throw Error(`obliterator/forEach: expecting a callback.`);if(Array.isArray(e)||r&&ArrayBuffer.isView(e)||typeof e==`string`||e.toString()===`[object Arguments]`){for(o=0,s=e.length;o<s;o++)t(e[o],o);return}if(typeof e.forEach==`function`){e.forEach(t);return}if(i&&Symbol.iterator in e&&typeof e.next!=`function`&&(e=e[Symbol.iterator]()),typeof e.next==`function`){for(n=e,o=0;c=n.next(),c.done!==!0;)t(c.value,o),o++;return}for(a in e)e.hasOwnProperty(a)&&t(e[a],a)}})),Et=e((e=>{var t=2**16-1,n=2**32-1,r=127,i=2**15-1,a=2**31-1;e.getPointerArray=function(e){var r=e-1;if(r<=255)return Uint8Array;if(r<=t)return Uint16Array;if(r<=n)return Uint32Array;throw Error(`mnemonist: Pointer Array of size > 4294967295 is not supported.`)},e.getSignedPointerArray=function(e){var t=e-1;return t<=r?Int8Array:t<=i?Int16Array:t<=a?Int32Array:Float64Array},e.getNumberType=function(e){return e===(e|0)?Math.sign(e)===-1?e<=127&&e>=-128?Int8Array:e<=32767&&e>=-32768?Int16Array:Int32Array:e<=255?Uint8Array:e<=65535?Uint16Array:Uint32Array:Float64Array};var o={Uint8Array:1,Int8Array:2,Uint16Array:3,Int16Array:4,Uint32Array:5,Int32Array:6,Float32Array:7,Float64Array:8};e.getMinimalRepresentation=function(t,n){var r=null,i=0,a,s,c,l,u;for(l=0,u=t.length;l<u;l++)c=n?n(t[l]):t[l],s=e.getNumberType(c),a=o[s.name],a>i&&(i=a,r=s);return r},e.isTypedArray=function(e){return typeof ArrayBuffer<`u`&&ArrayBuffer.isView(e)},e.concat=function(){var e=0,t,n,r;for(t=0,r=arguments.length;t<r;t++)e+=arguments[t].length;var i=new arguments[0].constructor(e);for(t=0,n=0;t<r;t++)i.set(arguments[t],n),n+=arguments[t].length;return i},e.indices=function(t){for(var n=new(e.getPointerArray(t))(t),r=0;r<t;r++)n[r]=r;return n}})),Dt=e((e=>{var t=Tt(),n=Et();function r(e){return Array.isArray(e)||n.isTypedArray(e)}function i(e){if(typeof e.length==`number`)return e.length;if(typeof e.size==`number`)return e.size}function a(e){var n=i(e),r=typeof n==`number`?Array(n):[],a=0;return t(e,function(e){r[a++]=e}),r}function o(e){var r=i(e),a=typeof r==`number`?n.getPointerArray(r):Array,o=typeof r==`number`?Array(r):[],s=typeof r==`number`?new a(r):[],c=0;return t(e,function(e){o[c]=e,s[c]=c++}),[o,s]}e.isArrayLike=r,e.guessLength=i,e.toArray=a,e.toArrayWithIndices=o})),Ot=e(((e,t)=>{function n(e){if(typeof e!=`function`)throw Error(`obliterator/iterator: expecting a function!`);this.next=e}typeof Symbol<`u`&&(n.prototype[Symbol.iterator]=function(){return this}),n.of=function(){var e=arguments,t=e.length,r=0;return new n(function(){return r>=t?{done:!0}:{done:!1,value:e[r++]}})},n.empty=function(){return new n(function(){return{done:!0}})},n.fromSequence=function(e){var t=0,r=e.length;return new n(function(){return t>=r?{done:!0}:{done:!1,value:e[t++]}})},n.is=function(e){return e instanceof n||typeof e==`object`&&!!e&&typeof e.next==`function`},t.exports=n})),kt=e(((e,t)=>{var n=Dt(),r=Ot();function i(e,t){if(arguments.length<2)throw Error(`mnemonist/fixed-deque: expecting an Array class and a capacity.`);if(typeof t!=`number`||t<=0)throw Error("mnemonist/fixed-deque: `capacity` should be a positive number.");this.ArrayClass=e,this.capacity=t,this.items=new e(this.capacity),this.clear()}i.prototype.clear=function(){this.start=0,this.size=0},i.prototype.push=function(e){if(this.size===this.capacity)throw Error(`mnemonist/fixed-deque.push: deque capacity (`+this.capacity+`) exceeded!`);var t=this.start+this.size;return t>=this.capacity&&(t-=this.capacity),this.items[t]=e,++this.size},i.prototype.unshift=function(e){if(this.size===this.capacity)throw Error(`mnemonist/fixed-deque.unshift: deque capacity (`+this.capacity+`) exceeded!`);var t=this.start-1;return this.start===0&&(t=this.capacity-1),this.items[t]=e,this.start=t,++this.size},i.prototype.pop=function(){if(this.size!==0){this.size--;var e=this.start+this.size;return e>=this.capacity&&(e-=this.capacity),this.items[e]}},i.prototype.shift=function(){if(this.size!==0){var e=this.start;return this.size--,this.start++,this.start===this.capacity&&(this.start=0),this.items[e]}},i.prototype.peekFirst=function(){if(this.size!==0)return this.items[this.start]},i.prototype.peekLast=function(){if(this.size!==0){var e=this.start+this.size-1;return e>=this.capacity&&(e-=this.capacity),this.items[e]}},i.prototype.get=function(e){if(!(this.size===0||e>=this.capacity))return e=this.start+e,e>=this.capacity&&(e-=this.capacity),this.items[e]},i.prototype.forEach=function(e,t){t=arguments.length>1?t:this;for(var n=this.capacity,r=this.size,i=this.start,a=0;a<r;)e.call(t,this.items[i],a,this),i++,a++,i===n&&(i=0)},i.prototype.toArray=function(){var e=this.start+this.size;if(e<this.capacity)return this.items.slice(this.start,e);for(var t=new this.ArrayClass(this.size),n=this.capacity,r=this.size,i=this.start,a=0;a<r;)t[a]=this.items[i],i++,a++,i===n&&(i=0);return t},i.prototype.values=function(){var e=this.items,t=this.capacity,n=this.size,i=this.start,a=0;return new r(function(){if(a>=n)return{done:!0};var r=e[i];return i++,a++,i===t&&(i=0),{value:r,done:!1}})},i.prototype.entries=function(){var e=this.items,t=this.capacity,n=this.size,i=this.start,a=0;return new r(function(){if(a>=n)return{done:!0};var r=e[i];return i++,i===t&&(i=0),{value:[a++,r],done:!1}})},typeof Symbol<`u`&&(i.prototype[Symbol.iterator]=i.prototype.values),i.prototype.inspect=function(){var e=this.toArray();return e.type=this.ArrayClass.name,e.capacity=this.capacity,Object.defineProperty(e,"constructor",{value:i,enumerable:!1}),e},typeof Symbol<`u`&&(i.prototype[Symbol.for(`nodejs.util.inspect.custom`)]=i.prototype.inspect),i.from=function(e,t,r){if(arguments.length<3&&(r=n.guessLength(e),typeof r!=`number`))throw Error(`mnemonist/fixed-deque.from: could not guess iterable length. Please provide desired capacity as last argument.`);var a=new i(t,r);if(n.isArrayLike(e)){var o,s;for(o=0,s=e.length;o<s;o++)a.items[o]=e[o];return a.size=s,a}return n.forEach(e,function(e){a.push(e)}),a},t.exports=i})),At=e((e=>{let t=xt(),n=kt();function r(e,t){let n=0;return e.forEachInNeighbor(t,()=>{n++}),n}function i(e,i){if(!t(e))throw Error(`graphology-dag/topological-sort: the given graph is not a valid graphology instance.`);if(e.type===`undirected`||e.undirectedSize!==0)throw Error(`graphology-dag/topological-sort: cannot work if graph is not directed.`);if(e.order===0)return;let a=new n(Array,e.order),o={},s=0;e.forEachNode((t,n)=>{let i=e.multi?r(e,t):e.inDegree(t);i===0?a.push([t,n,0]):(o[t]=i,s+=i)});let c=0;function l(e,t){let n=--o[e];s--,n===0&&a.push([e,t,c+1]),o[e]=n}for(;a.size!==0;){let[t,n,r]=a.shift();c=r,i(t,n,r),e.forEachOutNeighbor(t,l)}if(s!==0)throw Error(`graphology-dag/topological-sort: given graph is not acyclic.`)}function a(e){if(!t(e))throw Error(`graphology-dag/topological-sort: the given graph is not a valid graphology instance.`);let n=Array(e.order),r=0;return i(e,e=>{n[r++]=e}),n}function o(e,n){if(!t(e))throw Error(`graphology-dag/topological-generations: the given graph is not a valid graphology instance.`);if(e.order===0)return;let r=0,a=[];i(e,(e,t,i)=>{i>r&&(n(a),r=i,a=[]),a.push(e)}),n(a)}function s(e){if(!t(e))throw Error(`graphology-dag/topological-generations: the given graph is not a valid graphology instance.`);let n=[];return o(e,e=>{n.push(e)}),n}e.topologicalSort=a,e.forEachNodeInTopologicalOrder=i,e.topologicalGenerations=s,e.forEachTopologicalGeneration=o}));e((e=>{e.hasCycle=St(),e.willCreateCycle=Ct();let t=At();e.forEachNodeInTopologicalOrder=t.forEachNodeInTopologicalOrder,e.topologicalSort=t.topologicalSort,e.topologicalGenerations=t.topologicalGenerations,e.forEachTopologicalGeneration=t.forEachTopologicalGeneration}))();function jt(e,t){if(Object.prototype.hasOwnProperty.call(e,t))return Object.getOwnPropertyDescriptor(e,t)?.value}function w(e,t){let n=jt(e,t);if(typeof n==`number`&&Number.isFinite(n))return n;if(typeof n==`string`&&n.trim()!==``){let e=Number(n);if(Number.isFinite(e))return e}}function T(e,t){let n=jt(e,t);if(typeof n==`string`&&n.trim()!==``)return n}function E(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function Mt(e){if(!E(e))return{};let t=w(e,`bytes_processed`),n=w(e,`bytes_billed`),r=w(e,`slot_ms`),i=w(e,`rows_affected`),a=T(e,`code`),o=T(e,`_message`),s=T(e,`query_id`)??T(e,`job_id`),c=T(e,`project_id`),l=T(e,`location`);return{...t===void 0?{}:{bytesProcessed:t},...n===void 0?{}:{bytesBilled:n},...r===void 0?{}:{slotMs:r},...i===void 0?{}:{rowsAffected:i},...a===void 0?{}:{adapterCode:a},...o===void 0?{}:{adapterMessage:o},...s===void 0?{}:{queryId:s},...c===void 0?{}:{projectId:c},...l===void 0?{}:{location:l}}}function D(e,t){if(!E(e))return{rawKeys:[]};let n=Object.keys(e).filter(e=>typeof e==`string`);return{...Mt(e),...t,rawKeys:n}}let Nt={name:`generic`,parse(e){return D(e,{})}},Pt={name:`athena`,parse(e){if(!E(e))return{rawKeys:[]};let t=w(e,`data_scanned_in_bytes`);return D(e,{...t===void 0?{}:{bytesProcessed:t}})},canParse(e){return E(e)?`data_scanned_in_bytes`in e:!1}},Ft={name:`bigquery`,parse(e){if(!E(e))return{rawKeys:[]};let t=w(e,`bytes_processed`),n=w(e,`bytes_billed`),r=w(e,`slot_ms`),i=T(e,`project_id`),a=T(e,`location`),o=T(e,`query_id`)??T(e,`job_id`);return D(e,{...t===void 0?{}:{bytesProcessed:t},...n===void 0?{}:{bytesBilled:n},...r===void 0?{}:{slotMs:r},...o===void 0?{}:{queryId:o},...i===void 0?{}:{projectId:i},...a===void 0?{}:{location:a}})},canParse(e){return E(e)?`bytes_processed`in e||`bytes_billed`in e||`slot_ms`in e||`job_id`in e||`location`in e:!1}},It={name:`postgres`,parse(e){return D(e,{})}},Lt={name:`redshift`,parse(e){return D(e,{})}},Rt={name:`snowflake`,parse(e){if(!E(e))return{rawKeys:[]};let t=w(e,`rows_inserted`),n=w(e,`rows_deleted`),r=w(e,`rows_updated`),i=w(e,`rows_duplicates`);return D(e,{...t===void 0?{}:{rowsInserted:t},...n===void 0?{}:{rowsDeleted:n},...r===void 0?{}:{rowsUpdated:r},...i===void 0?{}:{rowsDuplicated:i}})},canParse(e){return E(e)?`rows_inserted`in e||`rows_deleted`in e||`rows_updated`in e||`rows_duplicates`in e:!1}},zt=new Map([[`athena`,Pt],[`bigquery`,Ft],[`postgres`,It],[`redshift`,Lt],[`snowflake`,Rt],[`spark`,{name:`spark`,parse(e){return D(e,{})}}]]),Bt=[Ft,Rt,Pt];new class{selectParser(e,t){if(e&&typeof e==`string`){let n=e.toLowerCase().trim(),r=zt.get(n);if(r&&(!r.canParse||r.canParse(t)))return r}for(let e of Bt)if(e.canParse&&e.canParse(t))return e;return Nt}},new Map([`bytes_processed`,`bytes_billed`,`slot_ms`,`rows_affected`,`rows_inserted`,`rows_updated`,`rows_deleted`,`rows_duplicated`].map(e=>[`${e}_desc`,e]));let Vt=[{key:`queryId`,label:`Query ID`,shortLabel:`Query ID`,kind:`string`,humanSortKey:`query_id`},{key:`adapterCode`,label:`Adapter code`,shortLabel:`Code`,kind:`string`,humanSortKey:`adapter_code`},{key:`adapterMessage`,label:`Adapter message`,shortLabel:`Message`,kind:`string`,humanSortKey:`adapter_message`},{key:`bytesProcessed`,label:`Bytes processed`,shortLabel:`Bytes processed`,kind:`number`,humanSortKey:`bytes_processed`,summaryTotalKey:`totalBytesProcessed`},{key:`bytesBilled`,label:`Bytes billed`,shortLabel:`Bytes billed`,kind:`number`,humanSortKey:`bytes_billed`,summaryTotalKey:`totalBytesBilled`},{key:`slotMs`,label:`Slot ms`,shortLabel:`Slot ms`,kind:`number`,humanSortKey:`slot_ms`,summaryTotalKey:`totalSlotMs`},{key:`rowsAffected`,label:`Rows affected`,shortLabel:`Rows`,kind:`number`,humanSortKey:`rows_affected`,summaryTotalKey:`totalRowsAffected`},{key:`projectId`,label:`Project ID`,shortLabel:`Project`,kind:`string`,humanSortKey:`project_id`},{key:`location`,label:`Location`,shortLabel:`Location`,kind:`string`,humanSortKey:`location`},{key:`rowsInserted`,label:`Rows inserted`,shortLabel:`Inserted`,kind:`number`,humanSortKey:`rows_inserted`,summaryTotalKey:`totalRowsInserted`},{key:`rowsUpdated`,label:`Rows updated`,shortLabel:`Updated`,kind:`number`,humanSortKey:`rows_updated`,summaryTotalKey:`totalRowsUpdated`},{key:`rowsDeleted`,label:`Rows deleted`,shortLabel:`Deleted`,kind:`number`,humanSortKey:`rows_deleted`,summaryTotalKey:`totalRowsDeleted`},{key:`rowsDuplicated`,label:`Rows duplicated`,shortLabel:`Duplicated`,kind:`number`,humanSortKey:`rows_duplicated`,summaryTotalKey:`totalRowsDuplicated`}];function Ht(e,t){if(e!=null)return jt(e,t)}function Ut(e,t){return t===void 0?`—`:e.kind===`number`&&typeof t==`number`?t.toLocaleString(`en-US`):String(t)}function Wt(e){return Vt.filter(t=>e.some(e=>Ht(e,t.key)!==void 0))}var Gt;function O(e,t,n){function r(n,r){if(n._zod||Object.defineProperty(n,"_zod",{value:{def:r,constr:o,traits:new Set},enumerable:!1}),n._zod.traits.has(e))return;n._zod.traits.add(e),t(n,r);let i=o.prototype,a=Object.keys(i);for(let e=0;e<a.length;e++){let t=a[e];t in n||(n[t]=i[t].bind(n))}}let i=n?.Parent??Object;class a extends i{}Object.defineProperty(a,"name",{value:e});function o(e){var t;let i=n?.Parent?new a:this;r(i,e),(t=i._zod).deferred??(t.deferred=[]);for(let e of i._zod.deferred)e();return i}return Object.defineProperty(o,"init",{value:r}),Object.defineProperty(o,Symbol.hasInstance,{value:t=>n?.Parent&&t instanceof n.Parent?!0:t?._zod?.traits?.has(e)}),Object.defineProperty(o,"name",{value:e}),o}var k=class extends Error{constructor(){super(`Encountered Promise during synchronous parse. Use .parseAsync() instead.`)}},Kt=class extends Error{constructor(e){super(`Encountered unidirectional transform during encode: ${e}`),this.name=`ZodEncodeError`}};(Gt=globalThis).__zod_globalConfig??(Gt.__zod_globalConfig={});let qt=globalThis.__zod_globalConfig;function A(e){return e&&Object.assign(qt,e),qt}function Jt(e){let t=Object.values(e).filter(e=>typeof e==`number`);return Object.entries(e).filter(([e,n])=>t.indexOf(+e)===-1).map(([e,t])=>t)}function Yt(e,t){return typeof t==`bigint`?t.toString():t}function Xt(e){return{get value(){{let t=e();return Object.defineProperty(this,"value",{value:t}),t}}}}function Zt(e){return e==null}function Qt(e){let t=+!!e.startsWith(`^`),n=e.endsWith(`$`)?e.length-1:e.length;return e.slice(t,n)}function $t(e,t){let n=e/t,r=Math.round(n),i=2**-52*Math.max(Math.abs(n),1);return Math.abs(n-r)<i?0:n-r}let en=Symbol(`evaluating`);function j(e,t,n){let r;Object.defineProperty(e,t,{get(){if(r!==en)return r===void 0&&(r=en,r=n()),r},set(n){Object.defineProperty(e,t,{value:n})},configurable:!0})}function M(e,t,n){Object.defineProperty(e,t,{value:n,writable:!0,enumerable:!0,configurable:!0})}function N(...e){let t={};for(let n of e){let e=Object.getOwnPropertyDescriptors(n);Object.assign(t,e)}return Object.defineProperties({},t)}function tn(e){return JSON.stringify(e)}function nn(e){return e.toLowerCase().trim().replace(/[^\w\s-]/g,``).replace(/[\s_-]+/g,`-`).replace(/^-+|-+$/g,``)}let rn=`captureStackTrace`in Error?Error.captureStackTrace:(...e)=>{};function an(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}let on=Xt(()=>{if(qt.jitless||typeof navigator<`u`&&navigator?.userAgent?.includes(`Cloudflare`))return!1;try{return Function(``),!0}catch{return!1}});function P(e){if(an(e)===!1)return!1;let t=e.constructor;if(t===void 0||typeof t!=`function`)return!0;let n=t.prototype;return an(n)!==!1&&Object.prototype.hasOwnProperty.call(n,`isPrototypeOf`)!==!1}function sn(e){return P(e)?{...e}:Array.isArray(e)?[...e]:e instanceof Map?new Map(e):e instanceof Set?new Set(e):e}let cn=new Set([`string`,`number`,`symbol`]);function ln(e){return e.replace(/[.*+?^${}()|[\]\\]/g,`\\$&`)}function F(e,t,n){let r=new e._zod.constr(t??e._zod.def);return(!t||n?.parent)&&(r._zod.parent=e),r}function I(e){let t=e;if(!t)return{};if(typeof t==`string`)return{error:()=>t};if(t?.message!==void 0){if(t?.error!==void 0)throw Error("Cannot specify both `message` and `error` params");t.error=t.message}return delete t.message,typeof t.error==`string`?{...t,error:()=>t.error}:t}function un(e){return Object.keys(e).filter(t=>e[t]._zod.optin===`optional`&&e[t]._zod.optout===`optional`)}let dn={safeint:[-(2**53-1),2**53-1],int32:[-2147483648,2147483647],uint32:[0,4294967295],float32:[-34028234663852886e22,34028234663852886e22],float64:[-Number.MAX_VALUE,Number.MAX_VALUE]};function fn(e,t){let n=e._zod.def,r=n.checks;if(r&&r.length>0)throw Error(`.pick() cannot be used on object schemas containing refinements`);return F(e,N(e._zod.def,{get shape(){let e={};for(let r in t){if(!(r in n.shape))throw Error(`Unrecognized key: "${r}"`);t[r]&&(e[r]=n.shape[r])}return M(this,`shape`,e),e},checks:[]}))}function pn(e,t){let n=e._zod.def,r=n.checks;if(r&&r.length>0)throw Error(`.omit() cannot be used on object schemas containing refinements`);return F(e,N(e._zod.def,{get shape(){let r={...e._zod.def.shape};for(let e in t){if(!(e in n.shape))throw Error(`Unrecognized key: "${e}"`);t[e]&&delete r[e]}return M(this,`shape`,r),r},checks:[]}))}function mn(e,t){if(!P(t))throw Error(`Invalid input to extend: expected a plain object`);let n=e._zod.def.checks;if(n&&n.length>0){let n=e._zod.def.shape;for(let e in t)if(Object.getOwnPropertyDescriptor(n,e)!==void 0)throw Error("Cannot overwrite keys on object schemas containing refinements. Use `.safeExtend()` instead.")}return F(e,N(e._zod.def,{get shape(){let n={...e._zod.def.shape,...t};return M(this,`shape`,n),n}}))}function hn(e,t){if(!P(t))throw Error(`Invalid input to safeExtend: expected a plain object`);return F(e,N(e._zod.def,{get shape(){let n={...e._zod.def.shape,...t};return M(this,`shape`,n),n}}))}function gn(e,t){if(e._zod.def.checks?.length)throw Error(`.merge() cannot be used on object schemas containing refinements. Use .safeExtend() instead.`);return F(e,N(e._zod.def,{get shape(){let n={...e._zod.def.shape,...t._zod.def.shape};return M(this,`shape`,n),n},get catchall(){return t._zod.def.catchall},checks:t._zod.def.checks??[]}))}function _n(e,t,n){let r=t._zod.def.checks;if(r&&r.length>0)throw Error(`.partial() cannot be used on object schemas containing refinements`);return F(t,N(t._zod.def,{get shape(){let r=t._zod.def.shape,i={...r};if(n)for(let t in n){if(!(t in r))throw Error(`Unrecognized key: "${t}"`);n[t]&&(i[t]=e?new e({type:`optional`,innerType:r[t]}):r[t])}else for(let t in r)i[t]=e?new e({type:`optional`,innerType:r[t]}):r[t];return M(this,`shape`,i),i},checks:[]}))}function vn(e,t,n){return F(t,N(t._zod.def,{get shape(){let r=t._zod.def.shape,i={...r};if(n)for(let t in n){if(!(t in i))throw Error(`Unrecognized key: "${t}"`);n[t]&&(i[t]=new e({type:`nonoptional`,innerType:r[t]}))}else for(let t in r)i[t]=new e({type:`nonoptional`,innerType:r[t]});return M(this,`shape`,i),i}}))}function L(e,t=0){if(e.aborted===!0)return!0;for(let n=t;n<e.issues.length;n++)if(e.issues[n]?.continue!==!0)return!0;return!1}function yn(e,t=0){if(e.aborted===!0)return!0;for(let n=t;n<e.issues.length;n++)if(e.issues[n]?.continue===!1)return!0;return!1}function bn(e,t){return t.map(t=>{var n;return(n=t).path??(n.path=[]),t.path.unshift(e),t})}function xn(e){return typeof e==`string`?e:e?.message}function R(e,t,n){let r=e.message?e.message:xn(e.inst?._zod.def?.error?.(e))??xn(t?.error?.(e))??xn(n.customError?.(e))??xn(n.localeError?.(e))??`Invalid input`,{inst:i,continue:a,input:o,...s}=e;return s.path??=[],s.message=r,t?.reportInput&&(s.input=o),s}function Sn(e){return Array.isArray(e)?`array`:typeof e==`string`?`string`:`unknown`}function z(...e){let[t,n,r]=e;return typeof t==`string`?{message:t,code:`custom`,input:n,inst:r}:{...t}}let Cn=(e,t)=>{e.name=`$ZodError`,Object.defineProperty(e,"_zod",{value:e._zod,enumerable:!1}),Object.defineProperty(e,"issues",{value:t,enumerable:!1}),e.message=JSON.stringify(t,Yt,2),Object.defineProperty(e,"toString",{value:()=>e.message,enumerable:!1})},wn=O(`$ZodError`,Cn),Tn=O(`$ZodError`,Cn,{Parent:Error});function En(e,t=e=>e.message){let n={},r=[];for(let i of e.issues)i.path.length>0?(n[i.path[0]]=n[i.path[0]]||[],n[i.path[0]].push(t(i))):r.push(t(i));return{formErrors:r,fieldErrors:n}}function Dn(e,t=e=>e.message){let n={_errors:[]},r=(e,i=[])=>{for(let a of e.issues)if(a.code===`invalid_union`&&a.errors.length)a.errors.map(e=>r({issues:e},[...i,...a.path]));else if(a.code===`invalid_key`)r({issues:a.issues},[...i,...a.path]);else if(a.code===`invalid_element`)r({issues:a.issues},[...i,...a.path]);else{let e=[...i,...a.path];if(e.length===0)n._errors.push(t(a));else{let r=n,i=0;for(;i<e.length;){let n=e[i];i===e.length-1?(r[n]=r[n]||{_errors:[]},r[n]._errors.push(t(a))):r[n]=r[n]||{_errors:[]},r=r[n],i++}}}};return r(e),n}let On=e=>(t,n,r,i)=>{let a=r?{...r,async:!1}:{async:!1},o=t._zod.run({value:n,issues:[]},a);if(o instanceof Promise)throw new k;if(o.issues.length){let t=new((i?.Err)??e)(o.issues.map(e=>R(e,a,A())));throw rn(t,i?.callee),t}return o.value},kn=e=>async(t,n,r,i)=>{let a=r?{...r,async:!0}:{async:!0},o=t._zod.run({value:n,issues:[]},a);if(o instanceof Promise&&(o=await o),o.issues.length){let t=new((i?.Err)??e)(o.issues.map(e=>R(e,a,A())));throw rn(t,i?.callee),t}return o.value},An=e=>(t,n,r)=>{let i=r?{...r,async:!1}:{async:!1},a=t._zod.run({value:n,issues:[]},i);if(a instanceof Promise)throw new k;return a.issues.length?{success:!1,error:new(e??wn)(a.issues.map(e=>R(e,i,A())))}:{success:!0,data:a.value}},jn=An(Tn),Mn=e=>async(t,n,r)=>{let i=r?{...r,async:!0}:{async:!0},a=t._zod.run({value:n,issues:[]},i);return a instanceof Promise&&(a=await a),a.issues.length?{success:!1,error:new e(a.issues.map(e=>R(e,i,A())))}:{success:!0,data:a.value}},Nn=Mn(Tn),Pn=e=>(t,n,r)=>{let i=r?{...r,direction:`backward`}:{direction:`backward`};return On(e)(t,n,i)},Fn=e=>(t,n,r)=>On(e)(t,n,r),In=e=>async(t,n,r)=>{let i=r?{...r,direction:`backward`}:{direction:`backward`};return kn(e)(t,n,i)},Ln=e=>async(t,n,r)=>kn(e)(t,n,r),Rn=e=>(t,n,r)=>{let i=r?{...r,direction:`backward`}:{direction:`backward`};return An(e)(t,n,i)},zn=e=>(t,n,r)=>An(e)(t,n,r),Bn=e=>async(t,n,r)=>{let i=r?{...r,direction:`backward`}:{direction:`backward`};return Mn(e)(t,n,i)},Vn=e=>async(t,n,r)=>Mn(e)(t,n,r),Hn=/^[cC][0-9a-z]{6,}$/,Un=/^[0-9a-z]+$/,Wn=/^[0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{26}$/,Gn=/^[0-9a-vA-V]{20}$/,Kn=/^[A-Za-z0-9]{27}$/,qn=/^[a-zA-Z0-9_-]{21}$/,Jn=/^P(?:(\d+W)|(?!.*W)(?=\d|T\d)(\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+([.,]\d+)?S)?)?)$/,Yn=/^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12})$/,Xn=e=>e?RegExp(`^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-${e}[0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12})$`):/^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$/,Zn=/^(?!\.)(?!.*\.\.)([A-Za-z0-9_'+\-\.]*)[A-Za-z0-9_+-]@([A-Za-z0-9][A-Za-z0-9\-]*\.)+[A-Za-z]{2,}$/;function Qn(){return RegExp(`^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$`,`u`)}let $n=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])$/,er=/^(([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:))$/,tr=/^((25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\/([0-9]|[1-2][0-9]|3[0-2])$/,nr=/^(([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}|::|([0-9a-fA-F]{1,4})?::([0-9a-fA-F]{1,4}:?){0,6})\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/,rr=/^$|^(?:[0-9a-zA-Z+/]{4})*(?:(?:[0-9a-zA-Z+/]{2}==)|(?:[0-9a-zA-Z+/]{3}=))?$/,ir=/^[A-Za-z0-9_-]*$/,ar=/^https?$/,or=/^\+[1-9]\d{6,14}$/,sr=`(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))`,cr=RegExp(`^${sr}$`);function lr(e){let t=`(?:[01]\\d|2[0-3]):[0-5]\\d`;return typeof e.precision==`number`?e.precision===-1?`${t}`:e.precision===0?`${t}:[0-5]\\d`:`${t}:[0-5]\\d\\.\\d{${e.precision}}`:`${t}(?::[0-5]\\d(?:\\.\\d+)?)?`}function ur(e){return RegExp(`^${lr(e)}$`)}function dr(e){let t=lr({precision:e.precision}),n=[`Z`];e.local&&n.push(``),e.offset&&n.push(`([+-](?:[01]\\d|2[0-3]):[0-5]\\d)`);let r=`${t}(?:${n.join(`|`)})`;return RegExp(`^${sr}T(?:${r})$`)}let fr=e=>{let t=e?`[\\s\\S]{${e?.minimum??0},${e?.maximum??``}}`:`[\\s\\S]*`;return RegExp(`^${t}$`)},pr=/^-?\d+$/,mr=/^-?\d+(?:\.\d+)?$/,hr=/^[^A-Z]*$/,gr=/^[^a-z]*$/,B=O(`$ZodCheck`,(e,t)=>{var n;e._zod??={},e._zod.def=t,(n=e._zod).onattach??(n.onattach=[])}),_r={number:`number`,bigint:`bigint`,object:`date`},vr=O(`$ZodCheckLessThan`,(e,t)=>{B.init(e,t);let n=_r[typeof t.value];e._zod.onattach.push(e=>{let n=e._zod.bag,r=(t.inclusive?n.maximum:n.exclusiveMaximum)??1/0;t.value<r&&(t.inclusive?n.maximum=t.value:n.exclusiveMaximum=t.value)}),e._zod.check=r=>{(t.inclusive?r.value<=t.value:r.value<t.value)||r.issues.push({origin:n,code:`too_big`,maximum:typeof t.value==`object`?t.value.getTime():t.value,input:r.value,inclusive:t.inclusive,inst:e,continue:!t.abort})}}),yr=O(`$ZodCheckGreaterThan`,(e,t)=>{B.init(e,t);let n=_r[typeof t.value];e._zod.onattach.push(e=>{let n=e._zod.bag,r=(t.inclusive?n.minimum:n.exclusiveMinimum)??-1/0;t.value>r&&(t.inclusive?n.minimum=t.value:n.exclusiveMinimum=t.value)}),e._zod.check=r=>{(t.inclusive?r.value>=t.value:r.value>t.value)||r.issues.push({origin:n,code:`too_small`,minimum:typeof t.value==`object`?t.value.getTime():t.value,input:r.value,inclusive:t.inclusive,inst:e,continue:!t.abort})}}),br=O(`$ZodCheckMultipleOf`,(e,t)=>{B.init(e,t),e._zod.onattach.push(e=>{var n;(n=e._zod.bag).multipleOf??(n.multipleOf=t.value)}),e._zod.check=n=>{if(typeof n.value!=typeof t.value)throw Error(`Cannot mix number and bigint in multiple_of check.`);(typeof n.value==`bigint`?n.value%t.value===BigInt(0):$t(n.value,t.value)===0)||n.issues.push({origin:typeof n.value,code:`not_multiple_of`,divisor:t.value,input:n.value,inst:e,continue:!t.abort})}}),xr=O(`$ZodCheckNumberFormat`,(e,t)=>{B.init(e,t),t.format=t.format||`float64`;let n=t.format?.includes(`int`),r=n?`int`:`number`,[i,a]=dn[t.format];e._zod.onattach.push(e=>{let r=e._zod.bag;r.format=t.format,r.minimum=i,r.maximum=a,n&&(r.pattern=pr)}),e._zod.check=o=>{let s=o.value;if(n){if(!Number.isInteger(s)){o.issues.push({expected:r,format:t.format,code:`invalid_type`,continue:!1,input:s,inst:e});return}if(!Number.isSafeInteger(s)){s>0?o.issues.push({input:s,code:`too_big`,maximum:2**53-1,note:`Integers must be within the safe integer range.`,inst:e,origin:r,inclusive:!0,continue:!t.abort}):o.issues.push({input:s,code:`too_small`,minimum:-(2**53-1),note:`Integers must be within the safe integer range.`,inst:e,origin:r,inclusive:!0,continue:!t.abort});return}}s<i&&o.issues.push({origin:`number`,input:s,code:`too_small`,minimum:i,inclusive:!0,inst:e,continue:!t.abort}),s>a&&o.issues.push({origin:`number`,input:s,code:`too_big`,maximum:a,inclusive:!0,inst:e,continue:!t.abort})}}),Sr=O(`$ZodCheckMaxLength`,(e,t)=>{var n;B.init(e,t),(n=e._zod.def).when??(n.when=e=>{let t=e.value;return!Zt(t)&&t.length!==void 0}),e._zod.onattach.push(e=>{let n=e._zod.bag.maximum??1/0;t.maximum<n&&(e._zod.bag.maximum=t.maximum)}),e._zod.check=n=>{let r=n.value;if(r.length<=t.maximum)return;let i=Sn(r);n.issues.push({origin:i,code:`too_big`,maximum:t.maximum,inclusive:!0,input:r,inst:e,continue:!t.abort})}}),Cr=O(`$ZodCheckMinLength`,(e,t)=>{var n;B.init(e,t),(n=e._zod.def).when??(n.when=e=>{let t=e.value;return!Zt(t)&&t.length!==void 0}),e._zod.onattach.push(e=>{let n=e._zod.bag.minimum??-1/0;t.minimum>n&&(e._zod.bag.minimum=t.minimum)}),e._zod.check=n=>{let r=n.value;if(r.length>=t.minimum)return;let i=Sn(r);n.issues.push({origin:i,code:`too_small`,minimum:t.minimum,inclusive:!0,input:r,inst:e,continue:!t.abort})}}),wr=O(`$ZodCheckLengthEquals`,(e,t)=>{var n;B.init(e,t),(n=e._zod.def).when??(n.when=e=>{let t=e.value;return!Zt(t)&&t.length!==void 0}),e._zod.onattach.push(e=>{let n=e._zod.bag;n.minimum=t.length,n.maximum=t.length,n.length=t.length}),e._zod.check=n=>{let r=n.value,i=r.length;if(i===t.length)return;let a=Sn(r),o=i>t.length;n.issues.push({origin:a,...o?{code:`too_big`,maximum:t.length}:{code:`too_small`,minimum:t.length},inclusive:!0,exact:!0,input:n.value,inst:e,continue:!t.abort})}}),Tr=O(`$ZodCheckStringFormat`,(e,t)=>{var n,r;B.init(e,t),e._zod.onattach.push(e=>{let n=e._zod.bag;n.format=t.format,t.pattern&&(n.patterns??=new Set,n.patterns.add(t.pattern))}),t.pattern?(n=e._zod).check??(n.check=n=>{t.pattern.lastIndex=0,!t.pattern.test(n.value)&&n.issues.push({origin:`string`,code:`invalid_format`,format:t.format,input:n.value,...t.pattern?{pattern:t.pattern.toString()}:{},inst:e,continue:!t.abort})}):(r=e._zod).check??(r.check=()=>{})}),Er=O(`$ZodCheckRegex`,(e,t)=>{Tr.init(e,t),e._zod.check=n=>{t.pattern.lastIndex=0,!t.pattern.test(n.value)&&n.issues.push({origin:`string`,code:`invalid_format`,format:`regex`,input:n.value,pattern:t.pattern.toString(),inst:e,continue:!t.abort})}}),Dr=O(`$ZodCheckLowerCase`,(e,t)=>{t.pattern??=hr,Tr.init(e,t)}),Or=O(`$ZodCheckUpperCase`,(e,t)=>{t.pattern??=gr,Tr.init(e,t)}),kr=O(`$ZodCheckIncludes`,(e,t)=>{B.init(e,t);let n=ln(t.includes),r=new RegExp(typeof t.position==`number`?`^.{${t.position}}${n}`:n);t.pattern=r,e._zod.onattach.push(e=>{let t=e._zod.bag;t.patterns??=new Set,t.patterns.add(r)}),e._zod.check=n=>{n.value.includes(t.includes,t.position)||n.issues.push({origin:`string`,code:`invalid_format`,format:`includes`,includes:t.includes,input:n.value,inst:e,continue:!t.abort})}}),Ar=O(`$ZodCheckStartsWith`,(e,t)=>{B.init(e,t);let n=RegExp(`^${ln(t.prefix)}.*`);t.pattern??=n,e._zod.onattach.push(e=>{let t=e._zod.bag;t.patterns??=new Set,t.patterns.add(n)}),e._zod.check=n=>{n.value.startsWith(t.prefix)||n.issues.push({origin:`string`,code:`invalid_format`,format:`starts_with`,prefix:t.prefix,input:n.value,inst:e,continue:!t.abort})}}),jr=O(`$ZodCheckEndsWith`,(e,t)=>{B.init(e,t);let n=RegExp(`.*${ln(t.suffix)}$`);t.pattern??=n,e._zod.onattach.push(e=>{let t=e._zod.bag;t.patterns??=new Set,t.patterns.add(n)}),e._zod.check=n=>{n.value.endsWith(t.suffix)||n.issues.push({origin:`string`,code:`invalid_format`,format:`ends_with`,suffix:t.suffix,input:n.value,inst:e,continue:!t.abort})}}),Mr=O(`$ZodCheckOverwrite`,(e,t)=>{B.init(e,t),e._zod.check=e=>{e.value=t.tx(e.value)}});var Nr=class{constructor(e=[]){this.content=[],this.indent=0,this&&(this.args=e)}indented(e){this.indent+=1,e(this),--this.indent}write(e){if(typeof e==`function`){e(this,{execution:`sync`}),e(this,{execution:`async`});return}let t=e.split(`
2
+ `).filter(e=>e),n=Math.min(...t.map(e=>e.length-e.trimStart().length)),r=t.map(e=>e.slice(n)).map(e=>` `.repeat(this.indent*2)+e);for(let e of r)this.content.push(e)}compile(){let e=Function,t=this?.args,n=[...(this?.content??[``]).map(e=>` ${e}`)];return new e(...t,n.join(`
3
+ `))}};let Pr={major:4,minor:4,patch:3},V=O(`$ZodType`,(e,t)=>{var n;e??={},e._zod.def=t,e._zod.bag=e._zod.bag||{},e._zod.version=Pr;let r=[...e._zod.def.checks??[]];e._zod.traits.has(`$ZodCheck`)&&r.unshift(e);for(let t of r)for(let n of t._zod.onattach)n(e);if(r.length===0)(n=e._zod).deferred??(n.deferred=[]),e._zod.deferred?.push(()=>{e._zod.run=e._zod.parse});else{let t=(e,t,n)=>{let r=L(e),i;for(let a of t){if(a._zod.def.when){if(yn(e)||!a._zod.def.when(e))continue}else if(r)continue;let t=e.issues.length,o=a._zod.check(e);if(o instanceof Promise&&n?.async===!1)throw new k;if(i||o instanceof Promise)i=(i??Promise.resolve()).then(async()=>{await o,e.issues.length!==t&&(r||=L(e,t))});else{if(e.issues.length===t)continue;r||=L(e,t)}}return i?i.then(()=>e):e},n=(n,i,a)=>{if(L(n))return n.aborted=!0,n;let o=t(i,r,a);if(o instanceof Promise){if(a.async===!1)throw new k;return o.then(t=>e._zod.parse(t,a))}return e._zod.parse(o,a)};e._zod.run=(i,a)=>{if(a.skipChecks)return e._zod.parse(i,a);if(a.direction===`backward`){let t=e._zod.parse({value:i.value,issues:[]},{...a,skipChecks:!0});return t instanceof Promise?t.then(e=>n(e,i,a)):n(t,i,a)}let o=e._zod.parse(i,a);if(o instanceof Promise){if(a.async===!1)throw new k;return o.then(e=>t(e,r,a))}return t(o,r,a)}}j(e,`~standard`,()=>({validate:t=>{try{let n=jn(e,t);return n.success?{value:n.data}:{issues:n.error?.issues}}catch{return Nn(e,t).then(e=>e.success?{value:e.data}:{issues:e.error?.issues})}},vendor:`zod`,version:1}))}),Fr=O(`$ZodString`,(e,t)=>{V.init(e,t),e._zod.pattern=[...e?._zod.bag?.patterns??[]].pop()??fr(e._zod.bag),e._zod.parse=(n,r)=>{if(t.coerce)try{n.value=String(n.value)}catch{}return typeof n.value==`string`||n.issues.push({expected:`string`,code:`invalid_type`,input:n.value,inst:e}),n}}),H=O(`$ZodStringFormat`,(e,t)=>{Tr.init(e,t),Fr.init(e,t)}),Ir=O(`$ZodGUID`,(e,t)=>{t.pattern??=Yn,H.init(e,t)}),Lr=O(`$ZodUUID`,(e,t)=>{if(t.version){let e={v1:1,v2:2,v3:3,v4:4,v5:5,v6:6,v7:7,v8:8}[t.version];if(e===void 0)throw Error(`Invalid UUID version: "${t.version}"`);t.pattern??=Xn(e)}else t.pattern??=Xn();H.init(e,t)}),Rr=O(`$ZodEmail`,(e,t)=>{t.pattern??=Zn,H.init(e,t)}),zr=O(`$ZodURL`,(e,t)=>{H.init(e,t),e._zod.check=n=>{try{let r=n.value.trim();if(!t.normalize&&t.protocol?.source===ar.source&&!/^https?:\/\//i.test(r)){n.issues.push({code:`invalid_format`,format:`url`,note:`Invalid URL format`,input:n.value,inst:e,continue:!t.abort});return}let i=new URL(r);t.hostname&&(t.hostname.lastIndex=0,t.hostname.test(i.hostname)||n.issues.push({code:`invalid_format`,format:`url`,note:`Invalid hostname`,pattern:t.hostname.source,input:n.value,inst:e,continue:!t.abort})),t.protocol&&(t.protocol.lastIndex=0,t.protocol.test(i.protocol.endsWith(`:`)?i.protocol.slice(0,-1):i.protocol)||n.issues.push({code:`invalid_format`,format:`url`,note:`Invalid protocol`,pattern:t.protocol.source,input:n.value,inst:e,continue:!t.abort})),n.value=t.normalize?i.href:r;return}catch{n.issues.push({code:`invalid_format`,format:`url`,input:n.value,inst:e,continue:!t.abort})}}}),Br=O(`$ZodEmoji`,(e,t)=>{t.pattern??=Qn(),H.init(e,t)}),Vr=O(`$ZodNanoID`,(e,t)=>{t.pattern??=qn,H.init(e,t)}),Hr=O(`$ZodCUID`,(e,t)=>{t.pattern??=Hn,H.init(e,t)}),Ur=O(`$ZodCUID2`,(e,t)=>{t.pattern??=Un,H.init(e,t)}),Wr=O(`$ZodULID`,(e,t)=>{t.pattern??=Wn,H.init(e,t)}),Gr=O(`$ZodXID`,(e,t)=>{t.pattern??=Gn,H.init(e,t)}),Kr=O(`$ZodKSUID`,(e,t)=>{t.pattern??=Kn,H.init(e,t)}),qr=O(`$ZodISODateTime`,(e,t)=>{t.pattern??=dr(t),H.init(e,t)}),Jr=O(`$ZodISODate`,(e,t)=>{t.pattern??=cr,H.init(e,t)}),Yr=O(`$ZodISOTime`,(e,t)=>{t.pattern??=ur(t),H.init(e,t)}),Xr=O(`$ZodISODuration`,(e,t)=>{t.pattern??=Jn,H.init(e,t)}),Zr=O(`$ZodIPv4`,(e,t)=>{t.pattern??=$n,H.init(e,t),e._zod.bag.format=`ipv4`}),Qr=O(`$ZodIPv6`,(e,t)=>{t.pattern??=er,H.init(e,t),e._zod.bag.format=`ipv6`,e._zod.check=n=>{try{new URL(`http://[${n.value}]`)}catch{n.issues.push({code:`invalid_format`,format:`ipv6`,input:n.value,inst:e,continue:!t.abort})}}}),$r=O(`$ZodCIDRv4`,(e,t)=>{t.pattern??=tr,H.init(e,t)}),ei=O(`$ZodCIDRv6`,(e,t)=>{t.pattern??=nr,H.init(e,t),e._zod.check=n=>{let r=n.value.split(`/`);try{if(r.length!==2)throw Error();let[e,t]=r;if(!t)throw Error();let n=Number(t);if(`${n}`!==t||n<0||n>128)throw Error();new URL(`http://[${e}]`)}catch{n.issues.push({code:`invalid_format`,format:`cidrv6`,input:n.value,inst:e,continue:!t.abort})}}});function ti(e){if(e===``)return!0;if(/\s/.test(e)||e.length%4!=0)return!1;try{return atob(e),!0}catch{return!1}}let ni=O(`$ZodBase64`,(e,t)=>{t.pattern??=rr,H.init(e,t),e._zod.bag.contentEncoding=`base64`,e._zod.check=n=>{ti(n.value)||n.issues.push({code:`invalid_format`,format:`base64`,input:n.value,inst:e,continue:!t.abort})}});function ri(e){if(!ir.test(e))return!1;let t=e.replace(/[-_]/g,e=>e===`-`?`+`:`/`);return ti(t.padEnd(Math.ceil(t.length/4)*4,`=`))}let ii=O(`$ZodBase64URL`,(e,t)=>{t.pattern??=ir,H.init(e,t),e._zod.bag.contentEncoding=`base64url`,e._zod.check=n=>{ri(n.value)||n.issues.push({code:`invalid_format`,format:`base64url`,input:n.value,inst:e,continue:!t.abort})}}),ai=O(`$ZodE164`,(e,t)=>{t.pattern??=or,H.init(e,t)});function oi(e,t=null){try{let n=e.split(`.`);if(n.length!==3)return!1;let[r]=n;if(!r)return!1;let i=JSON.parse(atob(r));return!(`typ`in i&&i?.typ!==`JWT`||!i.alg||t&&(!(`alg`in i)||i.alg!==t))}catch{return!1}}let si=O(`$ZodJWT`,(e,t)=>{H.init(e,t),e._zod.check=n=>{oi(n.value,t.alg)||n.issues.push({code:`invalid_format`,format:`jwt`,input:n.value,inst:e,continue:!t.abort})}}),ci=O(`$ZodNumber`,(e,t)=>{V.init(e,t),e._zod.pattern=e._zod.bag.pattern??mr,e._zod.parse=(n,r)=>{if(t.coerce)try{n.value=Number(n.value)}catch{}let i=n.value;if(typeof i==`number`&&!Number.isNaN(i)&&Number.isFinite(i))return n;let a=typeof i==`number`?Number.isNaN(i)?`NaN`:Number.isFinite(i)?void 0:`Infinity`:void 0;return n.issues.push({expected:`number`,code:`invalid_type`,input:i,inst:e,...a?{received:a}:{}}),n}}),li=O(`$ZodNumberFormat`,(e,t)=>{xr.init(e,t),ci.init(e,t)}),ui=O(`$ZodUnknown`,(e,t)=>{V.init(e,t),e._zod.parse=e=>e}),di=O(`$ZodNever`,(e,t)=>{V.init(e,t),e._zod.parse=(t,n)=>(t.issues.push({expected:`never`,code:`invalid_type`,input:t.value,inst:e}),t)});function fi(e,t,n){e.issues.length&&t.issues.push(...bn(n,e.issues)),t.value[n]=e.value}let pi=O(`$ZodArray`,(e,t)=>{V.init(e,t),e._zod.parse=(n,r)=>{let i=n.value;if(!Array.isArray(i))return n.issues.push({expected:`array`,code:`invalid_type`,input:i,inst:e}),n;n.value=Array(i.length);let a=[];for(let e=0;e<i.length;e++){let o=i[e],s=t.element._zod.run({value:o,issues:[]},r);s instanceof Promise?a.push(s.then(t=>fi(t,n,e))):fi(s,n,e)}return a.length?Promise.all(a).then(()=>n):n}});function mi(e,t,n,r,i,a){let o=n in r;if(e.issues.length){if(i&&a&&!o)return;t.issues.push(...bn(n,e.issues))}if(!o&&!i){e.issues.length||t.issues.push({code:`invalid_type`,expected:`nonoptional`,input:void 0,path:[n]});return}e.value===void 0?o&&(t.value[n]=void 0):t.value[n]=e.value}function hi(e){let t=Object.keys(e.shape);for(let n of t)if(!e.shape?.[n]?._zod?.traits?.has(`$ZodType`))throw Error(`Invalid element at key "${n}": expected a Zod schema`);let n=un(e.shape);return{...e,keys:t,keySet:new Set(t),numKeys:t.length,optionalKeys:new Set(n)}}function gi(e,t,n,r,i,a){let o=[],s=i.keySet,c=i.catchall._zod,l=c.def.type,u=c.optin===`optional`,d=c.optout===`optional`;for(let i in t){if(i===`__proto__`||s.has(i))continue;if(l===`never`){o.push(i);continue}let a=c.run({value:t[i],issues:[]},r);a instanceof Promise?e.push(a.then(e=>mi(e,n,i,t,u,d))):mi(a,n,i,t,u,d)}return o.length&&n.issues.push({code:`unrecognized_keys`,keys:o,input:t,inst:a}),e.length?Promise.all(e).then(()=>n):n}let _i=O(`$ZodObject`,(e,t)=>{if(V.init(e,t),!Object.getOwnPropertyDescriptor(t,`shape`)?.get){let e=t.shape;Object.defineProperty(t,"shape",{get:()=>{let n={...e};return Object.defineProperty(t,"shape",{value:n}),n}})}let n=Xt(()=>hi(t));j(e._zod,`propValues`,()=>{let e=t.shape,n={};for(let t in e){let r=e[t]._zod;if(r.values){n[t]??(n[t]=new Set);for(let e of r.values)n[t].add(e)}}return n});let r=an,i=t.catchall,a;e._zod.parse=(t,o)=>{a??=n.value;let s=t.value;if(!r(s))return t.issues.push({expected:`object`,code:`invalid_type`,input:s,inst:e}),t;t.value={};let c=[],l=a.shape;for(let e of a.keys){let n=l[e],r=n._zod.optin===`optional`,i=n._zod.optout===`optional`,a=n._zod.run({value:s[e],issues:[]},o);a instanceof Promise?c.push(a.then(n=>mi(n,t,e,s,r,i))):mi(a,t,e,s,r,i)}return i?gi(c,s,t,o,n.value,e):c.length?Promise.all(c).then(()=>t):t}}),vi=O(`$ZodObjectJIT`,(e,t)=>{_i.init(e,t);let n=e._zod.parse,r=Xt(()=>hi(t)),i=e=>{let t=new Nr([`shape`,`payload`,`ctx`]),n=r.value,i=e=>{let t=tn(e);return`shape[${t}]._zod.run({ value: input[${t}], issues: [] }, ctx)`};t.write(`const input = payload.value;`);let a=Object.create(null),o=0;for(let e of n.keys)a[e]=`key_${o++}`;t.write(`const newResult = {};`);for(let r of n.keys){let n=a[r],o=tn(r),s=e[r],c=s?._zod?.optin===`optional`,l=s?._zod?.optout===`optional`;t.write(`const ${n} = ${i(r)};`),c&&l?t.write(`
4
+ if (${n}.issues.length) {
5
+ if (${o} in input) {
6
+ payload.issues = payload.issues.concat(${n}.issues.map(iss => ({
7
+ ...iss,
8
+ path: iss.path ? [${o}, ...iss.path] : [${o}]
9
+ })));
10
+ }
11
+ }
12
+
13
+ if (${n}.value === undefined) {
14
+ if (${o} in input) {
15
+ newResult[${o}] = undefined;
16
+ }
17
+ } else {
18
+ newResult[${o}] = ${n}.value;
19
+ }
20
+
21
+ `):c?t.write(`
22
+ if (${n}.issues.length) {
23
+ payload.issues = payload.issues.concat(${n}.issues.map(iss => ({
24
+ ...iss,
25
+ path: iss.path ? [${o}, ...iss.path] : [${o}]
26
+ })));
27
+ }
28
+
29
+ if (${n}.value === undefined) {
30
+ if (${o} in input) {
31
+ newResult[${o}] = undefined;
32
+ }
33
+ } else {
34
+ newResult[${o}] = ${n}.value;
35
+ }
36
+
37
+ `):t.write(`
38
+ const ${n}_present = ${o} in input;
39
+ if (${n}.issues.length) {
40
+ payload.issues = payload.issues.concat(${n}.issues.map(iss => ({
41
+ ...iss,
42
+ path: iss.path ? [${o}, ...iss.path] : [${o}]
43
+ })));
44
+ }
45
+ if (!${n}_present && !${n}.issues.length) {
46
+ payload.issues.push({
47
+ code: "invalid_type",
48
+ expected: "nonoptional",
49
+ input: undefined,
50
+ path: [${o}]
51
+ });
52
+ }
53
+
54
+ if (${n}_present) {
55
+ if (${n}.value === undefined) {
56
+ newResult[${o}] = undefined;
57
+ } else {
58
+ newResult[${o}] = ${n}.value;
59
+ }
60
+ }
61
+
62
+ `)}t.write(`payload.value = newResult;`),t.write(`return payload;`);let s=t.compile();return(t,n)=>s(e,t,n)},a,o=an,s=!qt.jitless,c=s&&on.value,l=t.catchall,u;e._zod.parse=(d,f)=>{u??=r.value;let p=d.value;return o(p)?s&&c&&f?.async===!1&&f.jitless!==!0?(a||=i(t.shape),d=a(d,f),l?gi([],p,d,f,u,e):d):n(d,f):(d.issues.push({expected:`object`,code:`invalid_type`,input:p,inst:e}),d)}});function yi(e,t,n,r){for(let n of e)if(n.issues.length===0)return t.value=n.value,t;let i=e.filter(e=>!L(e));return i.length===1?(t.value=i[0].value,i[0]):(t.issues.push({code:`invalid_union`,input:t.value,inst:n,errors:e.map(e=>e.issues.map(e=>R(e,r,A())))}),t)}let bi=O(`$ZodUnion`,(e,t)=>{V.init(e,t),j(e._zod,`optin`,()=>t.options.some(e=>e._zod.optin===`optional`)?`optional`:void 0),j(e._zod,`optout`,()=>t.options.some(e=>e._zod.optout===`optional`)?`optional`:void 0),j(e._zod,`values`,()=>{if(t.options.every(e=>e._zod.values))return new Set(t.options.flatMap(e=>Array.from(e._zod.values)))}),j(e._zod,`pattern`,()=>{if(t.options.every(e=>e._zod.pattern)){let e=t.options.map(e=>e._zod.pattern);return RegExp(`^(${e.map(e=>Qt(e.source)).join(`|`)})$`)}});let n=t.options.length===1?t.options[0]._zod.run:null;e._zod.parse=(r,i)=>{if(n)return n(r,i);let a=!1,o=[];for(let e of t.options){let t=e._zod.run({value:r.value,issues:[]},i);if(t instanceof Promise)o.push(t),a=!0;else{if(t.issues.length===0)return t;o.push(t)}}return a?Promise.all(o).then(t=>yi(t,r,e,i)):yi(o,r,e,i)}}),xi=O(`$ZodIntersection`,(e,t)=>{V.init(e,t),e._zod.parse=(e,n)=>{let r=e.value,i=t.left._zod.run({value:r,issues:[]},n),a=t.right._zod.run({value:r,issues:[]},n);return i instanceof Promise||a instanceof Promise?Promise.all([i,a]).then(([t,n])=>Ci(e,t,n)):Ci(e,i,a)}});function Si(e,t){if(e===t||e instanceof Date&&t instanceof Date&&+e==+t)return{valid:!0,data:e};if(P(e)&&P(t)){let n=Object.keys(t),r=Object.keys(e).filter(e=>n.indexOf(e)!==-1),i={...e,...t};for(let n of r){let r=Si(e[n],t[n]);if(!r.valid)return{valid:!1,mergeErrorPath:[n,...r.mergeErrorPath]};i[n]=r.data}return{valid:!0,data:i}}if(Array.isArray(e)&&Array.isArray(t)){if(e.length!==t.length)return{valid:!1,mergeErrorPath:[]};let n=[];for(let r=0;r<e.length;r++){let i=e[r],a=t[r],o=Si(i,a);if(!o.valid)return{valid:!1,mergeErrorPath:[r,...o.mergeErrorPath]};n.push(o.data)}return{valid:!0,data:n}}return{valid:!1,mergeErrorPath:[]}}function Ci(e,t,n){let r=new Map,i;for(let n of t.issues)if(n.code===`unrecognized_keys`){i??=n;for(let e of n.keys)r.has(e)||r.set(e,{}),r.get(e).l=!0}else e.issues.push(n);for(let t of n.issues)if(t.code===`unrecognized_keys`)for(let e of t.keys)r.has(e)||r.set(e,{}),r.get(e).r=!0;else e.issues.push(t);let a=[...r].filter(([,e])=>e.l&&e.r).map(([e])=>e);if(a.length&&i&&e.issues.push({...i,keys:a}),L(e))return e;let o=Si(t.value,n.value);if(!o.valid)throw Error(`Unmergable intersection. Error path: ${JSON.stringify(o.mergeErrorPath)}`);return e.value=o.data,e}let wi=O(`$ZodEnum`,(e,t)=>{V.init(e,t);let n=Jt(t.entries),r=new Set(n);e._zod.values=r,e._zod.pattern=RegExp(`^(${n.filter(e=>cn.has(typeof e)).map(e=>typeof e==`string`?ln(e):e.toString()).join(`|`)})$`),e._zod.parse=(t,i)=>{let a=t.value;return r.has(a)||t.issues.push({code:`invalid_value`,values:n,input:a,inst:e}),t}}),Ti=O(`$ZodTransform`,(e,t)=>{V.init(e,t),e._zod.optin=`optional`,e._zod.parse=(n,r)=>{if(r.direction===`backward`)throw new Kt(e.constructor.name);let i=t.transform(n.value,n);if(r.async)return(i instanceof Promise?i:Promise.resolve(i)).then(e=>(n.value=e,n.fallback=!0,n));if(i instanceof Promise)throw new k;return n.value=i,n.fallback=!0,n}});function Ei(e,t){return t===void 0&&(e.issues.length||e.fallback)?{issues:[],value:void 0}:e}let Di=O(`$ZodOptional`,(e,t)=>{V.init(e,t),e._zod.optin=`optional`,e._zod.optout=`optional`,j(e._zod,`values`,()=>t.innerType._zod.values?new Set([...t.innerType._zod.values,void 0]):void 0),j(e._zod,`pattern`,()=>{let e=t.innerType._zod.pattern;return e?RegExp(`^(${Qt(e.source)})?$`):void 0}),e._zod.parse=(e,n)=>{if(t.innerType._zod.optin===`optional`){let r=e.value,i=t.innerType._zod.run(e,n);return i instanceof Promise?i.then(e=>Ei(e,r)):Ei(i,r)}return e.value===void 0?e:t.innerType._zod.run(e,n)}}),Oi=O(`$ZodExactOptional`,(e,t)=>{Di.init(e,t),j(e._zod,`values`,()=>t.innerType._zod.values),j(e._zod,`pattern`,()=>t.innerType._zod.pattern),e._zod.parse=(e,n)=>t.innerType._zod.run(e,n)}),ki=O(`$ZodNullable`,(e,t)=>{V.init(e,t),j(e._zod,`optin`,()=>t.innerType._zod.optin),j(e._zod,`optout`,()=>t.innerType._zod.optout),j(e._zod,`pattern`,()=>{let e=t.innerType._zod.pattern;return e?RegExp(`^(${Qt(e.source)}|null)$`):void 0}),j(e._zod,`values`,()=>t.innerType._zod.values?new Set([...t.innerType._zod.values,null]):void 0),e._zod.parse=(e,n)=>e.value===null?e:t.innerType._zod.run(e,n)}),Ai=O(`$ZodDefault`,(e,t)=>{V.init(e,t),e._zod.optin=`optional`,j(e._zod,`values`,()=>t.innerType._zod.values),e._zod.parse=(e,n)=>{if(n.direction===`backward`)return t.innerType._zod.run(e,n);if(e.value===void 0)return e.value=t.defaultValue,e;let r=t.innerType._zod.run(e,n);return r instanceof Promise?r.then(e=>ji(e,t)):ji(r,t)}});function ji(e,t){return e.value===void 0&&(e.value=t.defaultValue),e}let Mi=O(`$ZodPrefault`,(e,t)=>{V.init(e,t),e._zod.optin=`optional`,j(e._zod,`values`,()=>t.innerType._zod.values),e._zod.parse=(e,n)=>(n.direction===`backward`||e.value===void 0&&(e.value=t.defaultValue),t.innerType._zod.run(e,n))}),Ni=O(`$ZodNonOptional`,(e,t)=>{V.init(e,t),j(e._zod,`values`,()=>{let e=t.innerType._zod.values;return e?new Set([...e].filter(e=>e!==void 0)):void 0}),e._zod.parse=(n,r)=>{let i=t.innerType._zod.run(n,r);return i instanceof Promise?i.then(t=>Pi(t,e)):Pi(i,e)}});function Pi(e,t){return!e.issues.length&&e.value===void 0&&e.issues.push({code:`invalid_type`,expected:`nonoptional`,input:e.value,inst:t}),e}let Fi=O(`$ZodCatch`,(e,t)=>{V.init(e,t),e._zod.optin=`optional`,j(e._zod,`optout`,()=>t.innerType._zod.optout),j(e._zod,`values`,()=>t.innerType._zod.values),e._zod.parse=(e,n)=>{if(n.direction===`backward`)return t.innerType._zod.run(e,n);let r=t.innerType._zod.run(e,n);return r instanceof Promise?r.then(r=>(e.value=r.value,r.issues.length&&(e.value=t.catchValue({...e,error:{issues:r.issues.map(e=>R(e,n,A()))},input:e.value}),e.issues=[],e.fallback=!0),e)):(e.value=r.value,r.issues.length&&(e.value=t.catchValue({...e,error:{issues:r.issues.map(e=>R(e,n,A()))},input:e.value}),e.issues=[],e.fallback=!0),e)}}),Ii=O(`$ZodPipe`,(e,t)=>{V.init(e,t),j(e._zod,`values`,()=>t.in._zod.values),j(e._zod,`optin`,()=>t.in._zod.optin),j(e._zod,`optout`,()=>t.out._zod.optout),j(e._zod,`propValues`,()=>t.in._zod.propValues),e._zod.parse=(e,n)=>{if(n.direction===`backward`){let r=t.out._zod.run(e,n);return r instanceof Promise?r.then(e=>Li(e,t.in,n)):Li(r,t.in,n)}let r=t.in._zod.run(e,n);return r instanceof Promise?r.then(e=>Li(e,t.out,n)):Li(r,t.out,n)}});function Li(e,t,n){return e.issues.length?(e.aborted=!0,e):t._zod.run({value:e.value,issues:e.issues,fallback:e.fallback},n)}let Ri=O(`$ZodReadonly`,(e,t)=>{V.init(e,t),j(e._zod,`propValues`,()=>t.innerType._zod.propValues),j(e._zod,`values`,()=>t.innerType._zod.values),j(e._zod,`optin`,()=>t.innerType?._zod?.optin),j(e._zod,`optout`,()=>t.innerType?._zod?.optout),e._zod.parse=(e,n)=>{if(n.direction===`backward`)return t.innerType._zod.run(e,n);let r=t.innerType._zod.run(e,n);return r instanceof Promise?r.then(zi):zi(r)}});function zi(e){return e.value=Object.freeze(e.value),e}let Bi=O(`$ZodCustom`,(e,t)=>{B.init(e,t),V.init(e,t),e._zod.parse=(e,t)=>e,e._zod.check=n=>{let r=n.value,i=t.fn(r);if(i instanceof Promise)return i.then(t=>Vi(t,n,r,e));Vi(i,n,r,e)}});function Vi(e,t,n,r){if(!e){let e={code:`custom`,input:n,inst:r,path:[...r._zod.def.path??[]],continue:!r._zod.def.abort};r._zod.def.params&&(e.params=r._zod.def.params),t.issues.push(z(e))}}var Hi,Ui=class{constructor(){this._map=new WeakMap,this._idmap=new Map}add(e,...t){let n=t[0];return this._map.set(e,n),n&&typeof n==`object`&&`id`in n&&this._idmap.set(n.id,e),this}clear(){return this._map=new WeakMap,this._idmap=new Map,this}remove(e){let t=this._map.get(e);return t&&typeof t==`object`&&`id`in t&&this._idmap.delete(t.id),this._map.delete(e),this}get(e){let t=e._zod.parent;if(t){let n={...this.get(t)??{}};delete n.id;let r={...n,...this._map.get(e)};return Object.keys(r).length?r:void 0}return this._map.get(e)}has(e){return this._map.has(e)}};function Wi(){return new Ui}(Hi=globalThis).__zod_globalRegistry??(Hi.__zod_globalRegistry=Wi());let U=globalThis.__zod_globalRegistry;function Gi(e,t){return new e({type:`string`,...I(t)})}function Ki(e,t){return new e({type:`string`,format:`email`,check:`string_format`,abort:!1,...I(t)})}function qi(e,t){return new e({type:`string`,format:`guid`,check:`string_format`,abort:!1,...I(t)})}function Ji(e,t){return new e({type:`string`,format:`uuid`,check:`string_format`,abort:!1,...I(t)})}function Yi(e,t){return new e({type:`string`,format:`uuid`,check:`string_format`,abort:!1,version:`v4`,...I(t)})}function Xi(e,t){return new e({type:`string`,format:`uuid`,check:`string_format`,abort:!1,version:`v6`,...I(t)})}function Zi(e,t){return new e({type:`string`,format:`uuid`,check:`string_format`,abort:!1,version:`v7`,...I(t)})}function Qi(e,t){return new e({type:`string`,format:`url`,check:`string_format`,abort:!1,...I(t)})}function $i(e,t){return new e({type:`string`,format:`emoji`,check:`string_format`,abort:!1,...I(t)})}function ea(e,t){return new e({type:`string`,format:`nanoid`,check:`string_format`,abort:!1,...I(t)})}function ta(e,t){return new e({type:`string`,format:`cuid`,check:`string_format`,abort:!1,...I(t)})}function na(e,t){return new e({type:`string`,format:`cuid2`,check:`string_format`,abort:!1,...I(t)})}function ra(e,t){return new e({type:`string`,format:`ulid`,check:`string_format`,abort:!1,...I(t)})}function ia(e,t){return new e({type:`string`,format:`xid`,check:`string_format`,abort:!1,...I(t)})}function aa(e,t){return new e({type:`string`,format:`ksuid`,check:`string_format`,abort:!1,...I(t)})}function oa(e,t){return new e({type:`string`,format:`ipv4`,check:`string_format`,abort:!1,...I(t)})}function sa(e,t){return new e({type:`string`,format:`ipv6`,check:`string_format`,abort:!1,...I(t)})}function ca(e,t){return new e({type:`string`,format:`cidrv4`,check:`string_format`,abort:!1,...I(t)})}function la(e,t){return new e({type:`string`,format:`cidrv6`,check:`string_format`,abort:!1,...I(t)})}function ua(e,t){return new e({type:`string`,format:`base64`,check:`string_format`,abort:!1,...I(t)})}function da(e,t){return new e({type:`string`,format:`base64url`,check:`string_format`,abort:!1,...I(t)})}function fa(e,t){return new e({type:`string`,format:`e164`,check:`string_format`,abort:!1,...I(t)})}function pa(e,t){return new e({type:`string`,format:`jwt`,check:`string_format`,abort:!1,...I(t)})}function ma(e,t){return new e({type:`string`,format:`datetime`,check:`string_format`,offset:!1,local:!1,precision:null,...I(t)})}function ha(e,t){return new e({type:`string`,format:`date`,check:`string_format`,...I(t)})}function ga(e,t){return new e({type:`string`,format:`time`,check:`string_format`,precision:null,...I(t)})}function _a(e,t){return new e({type:`string`,format:`duration`,check:`string_format`,...I(t)})}function va(e,t){return new e({type:`number`,checks:[],...I(t)})}function ya(e,t){return new e({type:`number`,check:`number_format`,abort:!1,format:`safeint`,...I(t)})}function ba(e){return new e({type:`unknown`})}function xa(e,t){return new e({type:`never`,...I(t)})}function Sa(e,t){return new vr({check:`less_than`,...I(t),value:e,inclusive:!1})}function Ca(e,t){return new vr({check:`less_than`,...I(t),value:e,inclusive:!0})}function wa(e,t){return new yr({check:`greater_than`,...I(t),value:e,inclusive:!1})}function Ta(e,t){return new yr({check:`greater_than`,...I(t),value:e,inclusive:!0})}function Ea(e,t){return new br({check:`multiple_of`,...I(t),value:e})}function Da(e,t){return new Sr({check:`max_length`,...I(t),maximum:e})}function Oa(e,t){return new Cr({check:`min_length`,...I(t),minimum:e})}function ka(e,t){return new wr({check:`length_equals`,...I(t),length:e})}function Aa(e,t){return new Er({check:`string_format`,format:`regex`,...I(t),pattern:e})}function ja(e){return new Dr({check:`string_format`,format:`lowercase`,...I(e)})}function Ma(e){return new Or({check:`string_format`,format:`uppercase`,...I(e)})}function Na(e,t){return new kr({check:`string_format`,format:`includes`,...I(t),includes:e})}function Pa(e,t){return new Ar({check:`string_format`,format:`starts_with`,...I(t),prefix:e})}function Fa(e,t){return new jr({check:`string_format`,format:`ends_with`,...I(t),suffix:e})}function W(e){return new Mr({check:`overwrite`,tx:e})}function Ia(e){return W(t=>t.normalize(e))}function La(){return W(e=>e.trim())}function Ra(){return W(e=>e.toLowerCase())}function za(){return W(e=>e.toUpperCase())}function Ba(){return W(e=>nn(e))}function Va(e,t,n){return new e({type:`array`,element:t,...I(n)})}function Ha(e,t,n){return new e({type:`custom`,check:`custom`,fn:t,...I(n)})}function Ua(e,t){let n=Wa(t=>(t.addIssue=e=>{if(typeof e==`string`)t.issues.push(z(e,t.value,n._zod.def));else{let r=e;r.fatal&&(r.continue=!1),r.code??=`custom`,r.input??=t.value,r.inst??=n,r.continue??=!n._zod.def.abort,t.issues.push(z(r))}},e(t.value,t)),t);return n}function Wa(e,t){let n=new B({check:`custom`,...I(t)});return n._zod.check=e,n}function Ga(e){let t=e?.target??`draft-2020-12`;return t===`draft-4`&&(t=`draft-04`),t===`draft-7`&&(t=`draft-07`),{processors:e.processors??{},metadataRegistry:e?.metadata??U,target:t,unrepresentable:e?.unrepresentable??`throw`,override:e?.override??(()=>{}),io:e?.io??`output`,counter:0,seen:new Map,cycles:e?.cycles??`ref`,reused:e?.reused??`inline`,external:e?.external??void 0}}function G(e,t,n={path:[],schemaPath:[]}){var r;let i=e._zod.def,a=t.seen.get(e);if(a)return a.count++,n.schemaPath.includes(e)&&(a.cycle=n.path),a.schema;let o={schema:{},count:1,cycle:void 0,path:n.path};t.seen.set(e,o);let s=e._zod.toJSONSchema?.();if(s)o.schema=s;else{let r={...n,schemaPath:[...n.schemaPath,e],path:n.path};if(e._zod.processJSONSchema)e._zod.processJSONSchema(t,o.schema,r);else{let n=o.schema,a=t.processors[i.type];if(!a)throw Error(`[toJSONSchema]: Non-representable type encountered: ${i.type}`);a(e,t,n,r)}let a=e._zod.parent;a&&(o.ref||=a,G(a,t,r),t.seen.get(a).isParent=!0)}let c=t.metadataRegistry.get(e);return c&&Object.assign(o.schema,c),t.io===`input`&&K(e)&&(delete o.schema.examples,delete o.schema.default),t.io===`input`&&`_prefault`in o.schema&&((r=o.schema).default??(r.default=o.schema._prefault)),delete o.schema._prefault,t.seen.get(e).schema}function Ka(e,t){let n=e.seen.get(t);if(!n)throw Error(`Unprocessed schema. This is a bug in Zod.`);let r=new Map;for(let t of e.seen.entries()){let n=e.metadataRegistry.get(t[0])?.id;if(n){let e=r.get(n);if(e&&e!==t[0])throw Error(`Duplicate schema id "${n}" detected during JSON Schema conversion. Two different schemas cannot share the same id when converted together.`);r.set(n,t[0])}}let i=t=>{let r=e.target===`draft-2020-12`?`$defs`:`definitions`;if(e.external){let n=e.external.registry.get(t[0])?.id,i=e.external.uri??(e=>e);if(n)return{ref:i(n)};let a=t[1].defId??t[1].schema.id??`schema${e.counter++}`;return t[1].defId=a,{defId:a,ref:`${i(`__shared`)}#/${r}/${a}`}}if(t[1]===n)return{ref:`#`};let i=`#/${r}/`,a=t[1].schema.id??`__schema${e.counter++}`;return{defId:a,ref:i+a}},a=e=>{if(e[1].schema.$ref)return;let t=e[1],{ref:n,defId:r}=i(e);t.def={...t.schema},r&&(t.defId=r);let a=t.schema;for(let e in a)delete a[e];a.$ref=n};if(e.cycles===`throw`)for(let t of e.seen.entries()){let e=t[1];if(e.cycle)throw Error(`Cycle detected: #/${e.cycle?.join(`/`)}/<root>
63
+
64
+ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.`)}for(let n of e.seen.entries()){let r=n[1];if(t===n[0]){a(n);continue}if(e.external){let r=e.external.registry.get(n[0])?.id;if(t!==n[0]&&r){a(n);continue}}if(e.metadataRegistry.get(n[0])?.id){a(n);continue}if(r.cycle){a(n);continue}if(r.count>1&&e.reused===`ref`){a(n);continue}}}function qa(e,t){let n=e.seen.get(t);if(!n)throw Error(`Unprocessed schema. This is a bug in Zod.`);let r=t=>{let n=e.seen.get(t);if(n.ref===null)return;let i=n.def??n.schema,a={...i},o=n.ref;if(n.ref=null,o){r(o);let n=e.seen.get(o),s=n.schema;if(s.$ref&&(e.target===`draft-07`||e.target===`draft-04`||e.target===`openapi-3.0`)?(i.allOf=i.allOf??[],i.allOf.push(s)):Object.assign(i,s),Object.assign(i,a),t._zod.parent===o)for(let e in i)e!==`$ref`&&e!==`allOf`&&(e in a||delete i[e]);if(s.$ref&&n.def)for(let e in i)e!==`$ref`&&e!==`allOf`&&e in n.def&&JSON.stringify(i[e])===JSON.stringify(n.def[e])&&delete i[e]}let s=t._zod.parent;if(s&&s!==o){r(s);let t=e.seen.get(s);if(t?.schema.$ref&&(i.$ref=t.schema.$ref,t.def))for(let e in i)e!==`$ref`&&e!==`allOf`&&e in t.def&&JSON.stringify(i[e])===JSON.stringify(t.def[e])&&delete i[e]}e.override({zodSchema:t,jsonSchema:i,path:n.path??[]})};for(let t of[...e.seen.entries()].reverse())r(t[0]);let i={};if(e.target===`draft-2020-12`?i.$schema=`https://json-schema.org/draft/2020-12/schema`:e.target===`draft-07`?i.$schema=`http://json-schema.org/draft-07/schema#`:e.target===`draft-04`?i.$schema=`http://json-schema.org/draft-04/schema#`:e.target,e.external?.uri){let n=e.external.registry.get(t)?.id;if(!n)throw Error("Schema is missing an `id` property");i.$id=e.external.uri(n)}Object.assign(i,n.def??n.schema);let a=e.metadataRegistry.get(t)?.id;a!==void 0&&i.id===a&&delete i.id;let o=e.external?.defs??{};for(let t of e.seen.entries()){let e=t[1];e.def&&e.defId&&(e.def.id===e.defId&&delete e.def.id,o[e.defId]=e.def)}e.external||Object.keys(o).length>0&&(e.target===`draft-2020-12`?i.$defs=o:i.definitions=o);try{let n=JSON.parse(JSON.stringify(i));return Object.defineProperty(n,"~standard",{value:{...t[`~standard`],jsonSchema:{input:Ya(t,`input`,e.processors),output:Ya(t,`output`,e.processors)}},enumerable:!1,writable:!1}),n}catch{throw Error(`Error converting schema to JSON.`)}}function K(e,t){let n=t??{seen:new Set};if(n.seen.has(e))return!1;n.seen.add(e);let r=e._zod.def;if(r.type===`transform`)return!0;if(r.type===`array`)return K(r.element,n);if(r.type===`set`)return K(r.valueType,n);if(r.type===`lazy`)return K(r.getter(),n);if(r.type===`promise`||r.type===`optional`||r.type===`nonoptional`||r.type===`nullable`||r.type===`readonly`||r.type==="default"||r.type===`prefault`)return K(r.innerType,n);if(r.type===`intersection`)return K(r.left,n)||K(r.right,n);if(r.type===`record`||r.type===`map`)return K(r.keyType,n)||K(r.valueType,n);if(r.type===`pipe`)return e._zod.traits.has(`$ZodCodec`)?!0:K(r.in,n)||K(r.out,n);if(r.type===`object`){for(let e in r.shape)if(K(r.shape[e],n))return!0;return!1}if(r.type===`union`){for(let e of r.options)if(K(e,n))return!0;return!1}if(r.type===`tuple`){for(let e of r.items)if(K(e,n))return!0;return!!(r.rest&&K(r.rest,n))}return!1}let Ja=(e,t={})=>n=>{let r=Ga({...n,processors:t});return G(e,r),Ka(r,e),qa(r,e)},Ya=(e,t,n={})=>r=>{let{libraryOptions:i,target:a}=r??{},o=Ga({...i??{},target:a,io:t,processors:n});return G(e,o),Ka(o,e),qa(o,e)},Xa={guid:`uuid`,url:`uri`,datetime:`date-time`,json_string:`json-string`,regex:``},Za=(e,t,n,r)=>{let i=n;i.type=`string`;let{minimum:a,maximum:o,format:s,patterns:c,contentEncoding:l}=e._zod.bag;if(typeof a==`number`&&(i.minLength=a),typeof o==`number`&&(i.maxLength=o),s&&(i.format=Xa[s]??s,i.format===``&&delete i.format,s===`time`&&delete i.format),l&&(i.contentEncoding=l),c&&c.size>0){let e=[...c];e.length===1?i.pattern=e[0].source:e.length>1&&(i.allOf=[...e.map(e=>({...t.target===`draft-07`||t.target===`draft-04`||t.target===`openapi-3.0`?{type:`string`}:{},pattern:e.source}))])}},Qa=(e,t,n,r)=>{let i=n,{minimum:a,maximum:o,format:s,multipleOf:c,exclusiveMaximum:l,exclusiveMinimum:u}=e._zod.bag;i.type=typeof s==`string`&&s.includes(`int`)?`integer`:`number`;let d=typeof u==`number`&&u>=(a??-1/0),f=typeof l==`number`&&l<=(o??1/0),p=t.target===`draft-04`||t.target===`openapi-3.0`;d?p?(i.minimum=u,i.exclusiveMinimum=!0):i.exclusiveMinimum=u:typeof a==`number`&&(i.minimum=a),f?p?(i.maximum=l,i.exclusiveMaximum=!0):i.exclusiveMaximum=l:typeof o==`number`&&(i.maximum=o),typeof c==`number`&&(i.multipleOf=c)},$a=(e,t,n,r)=>{n.not={}},eo=(e,t,n,r)=>{let i=e._zod.def,a=Jt(i.entries);a.every(e=>typeof e==`number`)&&(n.type=`number`),a.every(e=>typeof e==`string`)&&(n.type=`string`),n.enum=a},to=(e,t,n,r)=>{if(t.unrepresentable===`throw`)throw Error(`Custom types cannot be represented in JSON Schema`)},no=(e,t,n,r)=>{if(t.unrepresentable===`throw`)throw Error(`Transforms cannot be represented in JSON Schema`)},ro=(e,t,n,r)=>{let i=n,a=e._zod.def,{minimum:o,maximum:s}=e._zod.bag;typeof o==`number`&&(i.minItems=o),typeof s==`number`&&(i.maxItems=s),i.type=`array`,i.items=G(a.element,t,{...r,path:[...r.path,`items`]})},io=(e,t,n,r)=>{let i=n,a=e._zod.def;i.type=`object`,i.properties={};let o=a.shape;for(let e in o)i.properties[e]=G(o[e],t,{...r,path:[...r.path,`properties`,e]});let s=new Set(Object.keys(o)),c=new Set([...s].filter(e=>{let n=a.shape[e]._zod;return t.io===`input`?n.optin===void 0:n.optout===void 0}));c.size>0&&(i.required=Array.from(c)),a.catchall?._zod.def.type===`never`?i.additionalProperties=!1:a.catchall?a.catchall&&(i.additionalProperties=G(a.catchall,t,{...r,path:[...r.path,`additionalProperties`]})):t.io===`output`&&(i.additionalProperties=!1)},ao=(e,t,n,r)=>{let i=e._zod.def,a=i.inclusive===!1,o=i.options.map((e,n)=>G(e,t,{...r,path:[...r.path,a?`oneOf`:`anyOf`,n]}));a?n.oneOf=o:n.anyOf=o},oo=(e,t,n,r)=>{let i=e._zod.def,a=G(i.left,t,{...r,path:[...r.path,`allOf`,0]}),o=G(i.right,t,{...r,path:[...r.path,`allOf`,1]}),s=e=>`allOf`in e&&Object.keys(e).length===1;n.allOf=[...s(a)?a.allOf:[a],...s(o)?o.allOf:[o]]},so=(e,t,n,r)=>{let i=e._zod.def,a=G(i.innerType,t,r),o=t.seen.get(e);t.target===`openapi-3.0`?(o.ref=i.innerType,n.nullable=!0):n.anyOf=[a,{type:`null`}]},co=(e,t,n,r)=>{let i=e._zod.def;G(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType},lo=(e,t,n,r)=>{let i=e._zod.def;G(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType,n.default=JSON.parse(JSON.stringify(i.defaultValue))},uo=(e,t,n,r)=>{let i=e._zod.def;G(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType,t.io===`input`&&(n._prefault=JSON.parse(JSON.stringify(i.defaultValue)))},fo=(e,t,n,r)=>{let i=e._zod.def;G(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType;let o;try{o=i.catchValue(void 0)}catch{throw Error(`Dynamic catch values are not supported in JSON Schema`)}n.default=o},po=(e,t,n,r)=>{let i=e._zod.def,a=i.in._zod.traits.has(`$ZodTransform`),o=t.io===`input`?a?i.out:i.in:i.out;G(o,t,r);let s=t.seen.get(e);s.ref=o},mo=(e,t,n,r)=>{let i=e._zod.def;G(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType,n.readOnly=!0},ho=(e,t,n,r)=>{let i=e._zod.def;G(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType},go=O(`ZodISODateTime`,(e,t)=>{qr.init(e,t),Y.init(e,t)});function _o(e){return ma(go,e)}let vo=O(`ZodISODate`,(e,t)=>{Jr.init(e,t),Y.init(e,t)});function yo(e){return ha(vo,e)}let bo=O(`ZodISOTime`,(e,t)=>{Yr.init(e,t),Y.init(e,t)});function xo(e){return ga(bo,e)}let So=O(`ZodISODuration`,(e,t)=>{Xr.init(e,t),Y.init(e,t)});function Co(e){return _a(So,e)}let q=O(`ZodError`,(e,t)=>{wn.init(e,t),e.name=`ZodError`,Object.defineProperties(e,{format:{value:t=>Dn(e,t)},flatten:{value:t=>En(e,t)},addIssue:{value:t=>{e.issues.push(t),e.message=JSON.stringify(e.issues,Yt,2)}},addIssues:{value:t=>{e.issues.push(...t),e.message=JSON.stringify(e.issues,Yt,2)}},isEmpty:{get(){return e.issues.length===0}}})},{Parent:Error}),wo=On(q),To=kn(q),Eo=An(q),Do=Mn(q),Oo=Pn(q),ko=Fn(q),Ao=In(q),jo=Ln(q),Mo=Rn(q),No=zn(q),Po=Bn(q),Fo=Vn(q),Io=new WeakMap;function Lo(e,t,n){let r=Object.getPrototypeOf(e),i=Io.get(r);if(i||(i=new Set,Io.set(r,i)),!i.has(t)){i.add(t);for(let e in n){let t=n[e];Object.defineProperty(r,e,{configurable:!0,enumerable:!1,get(){let n=t.bind(this);return Object.defineProperty(this,e,{configurable:!0,writable:!0,enumerable:!0,value:n}),n},set(t){Object.defineProperty(this,e,{configurable:!0,writable:!0,enumerable:!0,value:t})}})}}}let J=O(`ZodType`,(e,t)=>(V.init(e,t),Object.assign(e[`~standard`],{jsonSchema:{input:Ya(e,`input`),output:Ya(e,`output`)}}),e.toJSONSchema=Ja(e,{}),e.def=t,e.type=t.type,Object.defineProperty(e,"_def",{value:t}),e.parse=(t,n)=>wo(e,t,n,{callee:e.parse}),e.safeParse=(t,n)=>Eo(e,t,n),e.parseAsync=async(t,n)=>To(e,t,n,{callee:e.parseAsync}),e.safeParseAsync=async(t,n)=>Do(e,t,n),e.spa=e.safeParseAsync,e.encode=(t,n)=>Oo(e,t,n),e.decode=(t,n)=>ko(e,t,n),e.encodeAsync=async(t,n)=>Ao(e,t,n),e.decodeAsync=async(t,n)=>jo(e,t,n),e.safeEncode=(t,n)=>Mo(e,t,n),e.safeDecode=(t,n)=>No(e,t,n),e.safeEncodeAsync=async(t,n)=>Po(e,t,n),e.safeDecodeAsync=async(t,n)=>Fo(e,t,n),Lo(e,`ZodType`,{check(...e){let t=this.def;return this.clone(N(t,{checks:[...t.checks??[],...e.map(e=>typeof e==`function`?{_zod:{check:e,def:{check:`custom`},onattach:[]}}:e)]}),{parent:!0})},with(...e){return this.check(...e)},clone(e,t){return F(this,e,t)},brand(){return this},register(e,t){return e.add(this,t),this},refine(e,t){return this.check(Gs(e,t))},superRefine(e,t){return this.check(Ks(e,t))},overwrite(e){return this.check(W(e))},optional(){return Ds(this)},exactOptional(){return ks(this)},nullable(){return js(this)},nullish(){return Ds(js(this))},nonoptional(e){return Ls(this,e)},array(){return hs(this)},or(e){return ys([this,e])},and(e){return xs(this,e)},transform(e){return Vs(this,Ts(e))},default(e){return Ns(this,e)},prefault(e){return Fs(this,e)},catch(e){return zs(this,e)},pipe(e){return Vs(this,e)},readonly(){return Us(this)},describe(e){let t=this.clone();return U.add(t,{description:e}),t},meta(...e){if(e.length===0)return U.get(this);let t=this.clone();return U.add(t,e[0]),t},isOptional(){return this.safeParse(void 0).success},isNullable(){return this.safeParse(null).success},apply(e){return e(this)}}),Object.defineProperty(e,"description",{get(){return U.get(e)?.description},configurable:!0}),e)),Ro=O(`_ZodString`,(e,t)=>{Fr.init(e,t),J.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Za(e,t,n,r);let n=e._zod.bag;e.format=n.format??null,e.minLength=n.minimum??null,e.maxLength=n.maximum??null,Lo(e,`_ZodString`,{regex(...e){return this.check(Aa(...e))},includes(...e){return this.check(Na(...e))},startsWith(...e){return this.check(Pa(...e))},endsWith(...e){return this.check(Fa(...e))},min(...e){return this.check(Oa(...e))},max(...e){return this.check(Da(...e))},length(...e){return this.check(ka(...e))},nonempty(...e){return this.check(Oa(1,...e))},lowercase(e){return this.check(ja(e))},uppercase(e){return this.check(Ma(e))},trim(){return this.check(La())},normalize(...e){return this.check(Ia(...e))},toLowerCase(){return this.check(Ra())},toUpperCase(){return this.check(za())},slugify(){return this.check(Ba())}})}),zo=O(`ZodString`,(e,t)=>{Fr.init(e,t),Ro.init(e,t),e.email=t=>e.check(Ki(Vo,t)),e.url=t=>e.check(Qi(Wo,t)),e.jwt=t=>e.check(pa(as,t)),e.emoji=t=>e.check($i(Go,t)),e.guid=t=>e.check(qi(Ho,t)),e.uuid=t=>e.check(Ji(Uo,t)),e.uuidv4=t=>e.check(Yi(Uo,t)),e.uuidv6=t=>e.check(Xi(Uo,t)),e.uuidv7=t=>e.check(Zi(Uo,t)),e.nanoid=t=>e.check(ea(Ko,t)),e.guid=t=>e.check(qi(Ho,t)),e.cuid=t=>e.check(ta(qo,t)),e.cuid2=t=>e.check(na(Jo,t)),e.ulid=t=>e.check(ra(Yo,t)),e.base64=t=>e.check(ua(ns,t)),e.base64url=t=>e.check(da(rs,t)),e.xid=t=>e.check(ia(Xo,t)),e.ksuid=t=>e.check(aa(Zo,t)),e.ipv4=t=>e.check(oa(Qo,t)),e.ipv6=t=>e.check(sa($o,t)),e.cidrv4=t=>e.check(ca(es,t)),e.cidrv6=t=>e.check(la(ts,t)),e.e164=t=>e.check(fa(is,t)),e.datetime=t=>e.check(_o(t)),e.date=t=>e.check(yo(t)),e.time=t=>e.check(xo(t)),e.duration=t=>e.check(Co(t))});function Bo(e){return Gi(zo,e)}let Y=O(`ZodStringFormat`,(e,t)=>{H.init(e,t),Ro.init(e,t)}),Vo=O(`ZodEmail`,(e,t)=>{Rr.init(e,t),Y.init(e,t)}),Ho=O(`ZodGUID`,(e,t)=>{Ir.init(e,t),Y.init(e,t)}),Uo=O(`ZodUUID`,(e,t)=>{Lr.init(e,t),Y.init(e,t)}),Wo=O(`ZodURL`,(e,t)=>{zr.init(e,t),Y.init(e,t)}),Go=O(`ZodEmoji`,(e,t)=>{Br.init(e,t),Y.init(e,t)}),Ko=O(`ZodNanoID`,(e,t)=>{Vr.init(e,t),Y.init(e,t)}),qo=O(`ZodCUID`,(e,t)=>{Hr.init(e,t),Y.init(e,t)}),Jo=O(`ZodCUID2`,(e,t)=>{Ur.init(e,t),Y.init(e,t)}),Yo=O(`ZodULID`,(e,t)=>{Wr.init(e,t),Y.init(e,t)}),Xo=O(`ZodXID`,(e,t)=>{Gr.init(e,t),Y.init(e,t)}),Zo=O(`ZodKSUID`,(e,t)=>{Kr.init(e,t),Y.init(e,t)}),Qo=O(`ZodIPv4`,(e,t)=>{Zr.init(e,t),Y.init(e,t)}),$o=O(`ZodIPv6`,(e,t)=>{Qr.init(e,t),Y.init(e,t)}),es=O(`ZodCIDRv4`,(e,t)=>{$r.init(e,t),Y.init(e,t)}),ts=O(`ZodCIDRv6`,(e,t)=>{ei.init(e,t),Y.init(e,t)}),ns=O(`ZodBase64`,(e,t)=>{ni.init(e,t),Y.init(e,t)}),rs=O(`ZodBase64URL`,(e,t)=>{ii.init(e,t),Y.init(e,t)}),is=O(`ZodE164`,(e,t)=>{ai.init(e,t),Y.init(e,t)}),as=O(`ZodJWT`,(e,t)=>{si.init(e,t),Y.init(e,t)}),os=O(`ZodNumber`,(e,t)=>{ci.init(e,t),J.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Qa(e,t,n,r),Lo(e,`ZodNumber`,{gt(e,t){return this.check(wa(e,t))},gte(e,t){return this.check(Ta(e,t))},min(e,t){return this.check(Ta(e,t))},lt(e,t){return this.check(Sa(e,t))},lte(e,t){return this.check(Ca(e,t))},max(e,t){return this.check(Ca(e,t))},int(e){return this.check(ls(e))},safe(e){return this.check(ls(e))},positive(e){return this.check(wa(0,e))},nonnegative(e){return this.check(Ta(0,e))},negative(e){return this.check(Sa(0,e))},nonpositive(e){return this.check(Ca(0,e))},multipleOf(e,t){return this.check(Ea(e,t))},step(e,t){return this.check(Ea(e,t))},finite(){return this}});let n=e._zod.bag;e.minValue=Math.max(n.minimum??-1/0,n.exclusiveMinimum??-1/0)??null,e.maxValue=Math.min(n.maximum??1/0,n.exclusiveMaximum??1/0)??null,e.isInt=(n.format??``).includes(`int`)||Number.isSafeInteger(n.multipleOf??.5),e.isFinite=!0,e.format=n.format??null});function ss(e){return va(os,e)}let cs=O(`ZodNumberFormat`,(e,t)=>{li.init(e,t),os.init(e,t)});function ls(e){return ya(cs,e)}let us=O(`ZodUnknown`,(e,t)=>{ui.init(e,t),J.init(e,t),e._zod.processJSONSchema=(e,t,n)=>void 0});function ds(){return ba(us)}let fs=O(`ZodNever`,(e,t)=>{di.init(e,t),J.init(e,t),e._zod.processJSONSchema=(t,n,r)=>$a(e,t,n,r)});function ps(e){return xa(fs,e)}let ms=O(`ZodArray`,(e,t)=>{pi.init(e,t),J.init(e,t),e._zod.processJSONSchema=(t,n,r)=>ro(e,t,n,r),e.element=t.element,Lo(e,`ZodArray`,{min(e,t){return this.check(Oa(e,t))},nonempty(e){return this.check(Oa(1,e))},max(e,t){return this.check(Da(e,t))},length(e,t){return this.check(ka(e,t))},unwrap(){return this.element}})});function hs(e,t){return Va(ms,e,t)}let gs=O(`ZodObject`,(e,t)=>{vi.init(e,t),J.init(e,t),e._zod.processJSONSchema=(t,n,r)=>io(e,t,n,r),j(e,`shape`,()=>t.shape),Lo(e,`ZodObject`,{keyof(){return Cs(Object.keys(this._zod.def.shape))},catchall(e){return this.clone({...this._zod.def,catchall:e})},passthrough(){return this.clone({...this._zod.def,catchall:ds()})},loose(){return this.clone({...this._zod.def,catchall:ds()})},strict(){return this.clone({...this._zod.def,catchall:ps()})},strip(){return this.clone({...this._zod.def,catchall:void 0})},extend(e){return mn(this,e)},safeExtend(e){return hn(this,e)},merge(e){return gn(this,e)},pick(e){return fn(this,e)},omit(e){return pn(this,e)},partial(...e){return _n(Es,this,e[0])},required(...e){return vn(Is,this,e[0])}})});function _s(e,t){let n={type:`object`,shape:e??{},...I(t)};return new gs(n)}let vs=O(`ZodUnion`,(e,t)=>{bi.init(e,t),J.init(e,t),e._zod.processJSONSchema=(t,n,r)=>ao(e,t,n,r),e.options=t.options});function ys(e,t){return new vs({type:`union`,options:e,...I(t)})}let bs=O(`ZodIntersection`,(e,t)=>{xi.init(e,t),J.init(e,t),e._zod.processJSONSchema=(t,n,r)=>oo(e,t,n,r)});function xs(e,t){return new bs({type:`intersection`,left:e,right:t})}let Ss=O(`ZodEnum`,(e,t)=>{wi.init(e,t),J.init(e,t),e._zod.processJSONSchema=(t,n,r)=>eo(e,t,n,r),e.enum=t.entries,e.options=Object.values(t.entries);let n=new Set(Object.keys(t.entries));e.extract=(e,r)=>{let i={};for(let r of e)if(n.has(r))i[r]=t.entries[r];else throw Error(`Key ${r} not found in enum`);return new Ss({...t,checks:[],...I(r),entries:i})},e.exclude=(e,r)=>{let i={...t.entries};for(let t of e)if(n.has(t))delete i[t];else throw Error(`Key ${t} not found in enum`);return new Ss({...t,checks:[],...I(r),entries:i})}});function Cs(e,t){let n=Array.isArray(e)?Object.fromEntries(e.map(e=>[e,e])):e;return new Ss({type:`enum`,entries:n,...I(t)})}let ws=O(`ZodTransform`,(e,t)=>{Ti.init(e,t),J.init(e,t),e._zod.processJSONSchema=(t,n,r)=>no(e,t,n,r),e._zod.parse=(n,r)=>{if(r.direction===`backward`)throw new Kt(e.constructor.name);n.addIssue=r=>{if(typeof r==`string`)n.issues.push(z(r,n.value,t));else{let t=r;t.fatal&&(t.continue=!1),t.code??=`custom`,t.input??=n.value,t.inst??=e,n.issues.push(z(t))}};let i=t.transform(n.value,n);return i instanceof Promise?i.then(e=>(n.value=e,n.fallback=!0,n)):(n.value=i,n.fallback=!0,n)}});function Ts(e){return new ws({type:`transform`,transform:e})}let Es=O(`ZodOptional`,(e,t)=>{Di.init(e,t),J.init(e,t),e._zod.processJSONSchema=(t,n,r)=>ho(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function Ds(e){return new Es({type:`optional`,innerType:e})}let Os=O(`ZodExactOptional`,(e,t)=>{Oi.init(e,t),J.init(e,t),e._zod.processJSONSchema=(t,n,r)=>ho(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function ks(e){return new Os({type:`optional`,innerType:e})}let As=O(`ZodNullable`,(e,t)=>{ki.init(e,t),J.init(e,t),e._zod.processJSONSchema=(t,n,r)=>so(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function js(e){return new As({type:`nullable`,innerType:e})}let Ms=O(`ZodDefault`,(e,t)=>{Ai.init(e,t),J.init(e,t),e._zod.processJSONSchema=(t,n,r)=>lo(e,t,n,r),e.unwrap=()=>e._zod.def.innerType,e.removeDefault=e.unwrap});function Ns(e,t){return new Ms({type:`default`,innerType:e,get defaultValue(){return typeof t==`function`?t():sn(t)}})}let Ps=O(`ZodPrefault`,(e,t)=>{Mi.init(e,t),J.init(e,t),e._zod.processJSONSchema=(t,n,r)=>uo(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function Fs(e,t){return new Ps({type:`prefault`,innerType:e,get defaultValue(){return typeof t==`function`?t():sn(t)}})}let Is=O(`ZodNonOptional`,(e,t)=>{Ni.init(e,t),J.init(e,t),e._zod.processJSONSchema=(t,n,r)=>co(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function Ls(e,t){return new Is({type:`nonoptional`,innerType:e,...I(t)})}let Rs=O(`ZodCatch`,(e,t)=>{Fi.init(e,t),J.init(e,t),e._zod.processJSONSchema=(t,n,r)=>fo(e,t,n,r),e.unwrap=()=>e._zod.def.innerType,e.removeCatch=e.unwrap});function zs(e,t){return new Rs({type:`catch`,innerType:e,catchValue:typeof t==`function`?t:()=>t})}let Bs=O(`ZodPipe`,(e,t)=>{Ii.init(e,t),J.init(e,t),e._zod.processJSONSchema=(t,n,r)=>po(e,t,n,r),e.in=t.in,e.out=t.out});function Vs(e,t){return new Bs({type:`pipe`,in:e,out:t})}let Hs=O(`ZodReadonly`,(e,t)=>{Ri.init(e,t),J.init(e,t),e._zod.processJSONSchema=(t,n,r)=>mo(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function Us(e){return new Hs({type:`readonly`,innerType:e})}let Ws=O(`ZodCustom`,(e,t)=>{Bi.init(e,t),J.init(e,t),e._zod.processJSONSchema=(t,n,r)=>to(e,t,n,r)});function Gs(e,t={}){return Ha(Ws,e,t)}function Ks(e,t){return Ua(e,t)}_s({query:Bo().optional(),type:Bo().optional(),package:Bo().optional(),tag:Bo().optional(),path:Bo().optional(),limit:ss().int().min(1).max(200).optional(),offset:ss().int().min(0).optional()});let X={accent:`#635BFF`,text:`#171C28`,textSoft:`#6B7385`,bg:`#F6F7FB`,bgSoft:`#FFFFFF`,borderDefault:`#D7DCE7`,borderSubtle:`#E6E9F0`,slate:`#64748B`,rose:`#C0352B`,mint:`#0F8A4B`,amber:`#A56315`},Z={accent:`#8A7CFF`,text:`#F3F6FC`,textSoft:`#98A3BC`,bg:`#0D1120`,bgSoft:`#151A2E`,borderDefault:`#313A58`,borderSubtle:`#262E47`,slate:`#8690AA`,rose:`#FF8D86`,mint:`#59D38C`,amber:`#F5B95C`};X.mint,X.rose,X.slate,X.rose,X.mint,X.rose,X.amber,X.slate,Z.mint,Z.rose,Z.slate,Z.rose,Z.mint,Z.rose,Z.amber,Z.slate,X.text,X.textSoft,X.slate,X.accent,Z.text,Z.textSoft,Z.slate,Z.accent;let qs=new Set([`model`,`seed`,`snapshot`,`source`,`source_freshness`,`test`,`unit_test`,`metric`,`semantic_model`]),Js=new Set([`test`,`unit_test`]);[...qs].filter(e=>!Js.has(e)).sort((e,t)=>e.localeCompare(t));function Ys(e){return e.slice(8)}function Xs(e){return e.startsWith(`adapter:`)}function Zs(e,t){let n=Wt([e.adapterMetrics]).find(e=>e.key===t),r=n?Ht(e.adapterMetrics,n.key):void 0;if(n!=null&&r!==void 0)return{displayValue:Ut(n,r),sortValue:typeof r==`number`||typeof r==`string`?r:void 0,isScalar:!0}}function Qs(e){if(Xs(e))return`desc`;switch(e){case`attention`:case`duration`:case`start`:return`desc`;default:return`asc`}}function $s(e,t){return t===`all`?!0:t===`issues`?e.statusTone===`danger`||e.statusTone===`warning`:e.statusTone===t}function ec(){return{all:0,positive:0,warning:0,danger:0}}function tc(){return{all:0,models:0,tests:0,seeds:0,snapshots:0,operations:0,healthy:0,warnings:0,errors:0,issues:0}}function nc(e){let t=[...(e.adapterResponseFields??[]).flatMap(e=>[e.key,e.displayValue]),...e.adapterMetrics?[e.adapterMetrics.queryId??``,e.adapterMetrics.adapterCode??``,e.adapterMetrics.adapterMessage??``,e.adapterMetrics.projectId??``,e.adapterMetrics.location??``,e.adapterMetrics.rawKeys.join(` `)]:[]],n=e.semantics,r=n?[n.materialization,n.rawMaterialization??``,n.incrementalStrategy??``,n.relationName??``]:[];return[e.name,e.resourceType,e.packageName,e.path??``,e.uniqueId,e.status,e.threadId??``,...r,...t].join(` `).toLowerCase()}function rc(e){return e.trim().toLowerCase()}function ic(e,t){return $s(e,t)}function ac(e){return Js.has(e.resourceType)?`tests`:e.resourceType===`seed`?`seeds`:e.resourceType===`snapshot`?`snapshots`:e.resourceType===`operation`||e.resourceType===`sql_operation`||e.resourceType===`macro`?`operations`:`models`}function oc(e,t){return t===`all`||ac(e)===t}function sc(e,t){return t===`all`?!0:t===`fast`?e.executionTime<1:t===`medium`?e.executionTime>=1&&e.executionTime<5:e.executionTime>=5}let cc={danger:0,warning:1,positive:2,skipped:3,neutral:4};function lc(e,t){let n=cc[e.statusTone]-cc[t.statusTone];return n===0?t.executionTime-e.executionTime:n}function uc(e,t){let n=e===void 0,r=t===void 0;return n&&r?0:n?1:r?-1:typeof e==`number`&&typeof t==`number`?e-t:String(e).localeCompare(String(t),void 0,{numeric:!0,sensitivity:`base`})}function Q(e,t){return t===`asc`?e:-e}function dc(e,t,n,r,i){let a=e.localeCompare(t);return a===0?n.name.localeCompare(r.name):Q(a,i)}function fc(e,t,n,r){if(!Xs(n))return Q(lc(e,t),r);let i=Ys(n),a=Zs(e,i),o=Zs(t,i);return!a?.isScalar&&!o?.isScalar?0:a?.isScalar?o?.isScalar?Q(uc(a.sortValue,o.sortValue),r):-1:1}function pc(e,t,n,r){switch(n){case`duration`:return Q(e.executionTime-t.executionTime,r);case`name`:return Q(e.name.localeCompare(t.name),r);case`status`:return Q(e.status.localeCompare(t.status),r);case`start`:return Q((e.start??0)-(t.start??0),r);case`materialization`:return dc(e.semantics?.materialization??`unknown`,t.semantics?.materialization??`unknown`,e,t,r);case`resourceType`:return dc(e.resourceType,t.resourceType,e,t,r);case`thread`:return dc(e.threadId??``,t.threadId??``,e,t,r);case`attention`:return Q(lc(e,t),r);default:return fc(e,t,n,r)}}function mc(e){let t=ec(),n=tc(),r=new Map,i=new Map;t.all=e.length,n.all=e.length;for(let a of e){let{row:e}=a;e.statusTone===`positive`?(t.positive+=1,n.healthy+=1):e.statusTone===`warning`?(t.warning+=1,n.warnings+=1,n.issues+=1):e.statusTone===`danger`&&(t.danger+=1,n.errors+=1,n.issues+=1),n[ac(e)]+=1,r.set(e.resourceType,(r.get(e.resourceType)??0)+1),e.threadId&&i.set(e.threadId,(i.get(e.threadId)??0)+1)}return{status:t,facets:n,resourceTypes:Object.fromEntries(r),threadIds:Object.fromEntries(i)}}function hc(e){let t=e.map(e=>({row:e,searchText:nc(e)}));return{entries:t,summary:mc(t)}}function gc(e,t){let n=rc(t.query),r=new Set(t.resourceTypes),i=new Set(t.materializationKinds),a=new Set(t.threadIds),o=e.entries.filter(e=>{let{row:o}=e;if(!oc(o,t.kind)||!ic(o,t.status)||n!==``&&!e.searchText.includes(n)||r.size>0&&!r.has(o.resourceType))return!1;if(i.size>0){let e=o.semantics?.materialization??`unknown`;if(!i.has(e))return!1}return!(a.size>0&&!a.has(o.threadId??``)||!sc(o,t.durationBand))}),s=t.sortBy??`attention`,c=t.sortDirection??Qs(s);return[...o].sort((e,t)=>pc(e.row,t.row,s,c))}function _c(e){let t=e.origin;if(t===``||t===`null`)return!0;try{return t===globalThis.location.origin}catch{return!1}}let vc=null,yc=null,$=[];function bc(e){self.postMessage({type:`error`,message:e})}self.onmessage=e=>{if(!_c(e))return;let t=e.data;if(t.type===`init`){vc=hc(t.rows),yc=null,$=[],self.postMessage({type:`ready`,summary:vc.summary});return}if(vc==null){bc(`Results worker queried before initialization.`);return}let n=[t.kind,t.status,t.query.trim().toLowerCase(),t.resourceTypes.sort().join(`,`),t.materializationKinds.sort().join(`,`),t.threadIds.sort().join(`,`),t.durationBand,t.sortBy,t.sortDirection].join(`::`);n!==yc&&($=gc(vc,{kind:t.kind,status:t.status,query:t.query,resourceTypes:t.resourceTypes,materializationKinds:t.materializationKinds,threadIds:t.threadIds,durationBand:t.durationBand,sortBy:t.sortBy,sortDirection:t.sortDirection}),yc=n);let r=$.slice(0,t.limit);self.postMessage({type:`query-result`,requestId:t.requestId,rows:r.map(e=>e.row),totalMatches:$.length,summary:{status:{all:$.length,positive:$.filter(e=>e.row.statusTone===`positive`).length,warning:$.filter(e=>e.row.statusTone===`warning`).length,danger:$.filter(e=>e.row.statusTone===`danger`).length},facets:{all:$.length,models:$.filter(e=>{let t=e.row.resourceType;return t!==`test`&&t!==`unit_test`&&t!==`seed`&&t!==`snapshot`&&t!==`operation`&&t!==`sql_operation`&&t!==`macro`}).length,tests:$.filter(e=>e.row.resourceType===`test`||e.row.resourceType===`unit_test`).length,seeds:$.filter(e=>e.row.resourceType===`seed`).length,snapshots:$.filter(e=>e.row.resourceType===`snapshot`).length,operations:$.filter(e=>[`operation`,`sql_operation`,`macro`].includes(e.row.resourceType)).length,healthy:$.filter(e=>e.row.statusTone===`positive`).length,warnings:$.filter(e=>e.row.statusTone===`warning`).length,errors:$.filter(e=>e.row.statusTone===`danger`).length,issues:$.filter(e=>e.row.statusTone===`danger`||e.row.statusTone===`warning`).length},resourceTypes:Object.fromEntries(Object.entries(r.reduce((e,t)=>(e[t.row.resourceType]=(e[t.row.resourceType]??0)+1,e),{}))),threadIds:Object.fromEntries(Object.entries(r.reduce((e,t)=>(t.row.threadId&&(e[t.row.threadId]=(e[t.row.threadId]??0)+1),e),{})))}})}})();
@@ -0,0 +1 @@
1
+ var e=Object.create,t=Object.defineProperty,n=Object.getOwnPropertyDescriptor,r=Object.getOwnPropertyNames,i=Object.getPrototypeOf,a=Object.prototype.hasOwnProperty,o=(e,t)=>()=>(t||(e((t={exports:{}}).exports,t),e=null),t.exports),s=(e,n)=>{let r={};for(var i in e)t(r,i,{get:e[i],enumerable:!0});return n||t(r,Symbol.toStringTag,{value:`Module`}),r},c=(e,i,o,s)=>{if(i&&typeof i==`object`||typeof i==`function`)for(var c=r(i),l=0,u=c.length,d;l<u;l++)d=c[l],!a.call(e,d)&&d!==o&&t(e,d,{get:(e=>i[e]).bind(null,d),enumerable:!(s=n(i,d))||s.enumerable});return e},l=(n,r,o)=>(o=n==null?{}:e(i(n)),c(r||!n||!n.__esModule||!a.call(n,`default`)?t(o,`default`,{value:n,enumerable:!0}):o,n));export{s as n,l as r,o as t};
@@ -0,0 +1,4 @@
1
+ import{r as e}from"./rolldown-runtime-hePW80VL.js";import{i as t,r as n}from"./react-vendor-BwlCKk7e.js";var r=e(t(),1),i=n();function a(e,t,n){let r=n.initialDeps??[],i,a=!0;function o(){let o;n.key&&n.debug?.call(n)&&(o=Date.now());let s=e();if(!(s.length!==r.length||s.some((e,t)=>r[t]!==e)))return i;r=s;let c;if(n.key&&n.debug?.call(n)&&(c=Date.now()),i=t(...s),n.key&&n.debug?.call(n)){let e=Math.round((Date.now()-o)*100)/100,t=Math.round((Date.now()-c)*100)/100,r=t/16,i=(e,t)=>{for(e=String(e);e.length<t;)e=` `+e;return e};console.info(`%c⏱ ${i(t,5)} /${i(e,5)} ms`,`
2
+ font-size: .6rem;
3
+ font-weight: bold;
4
+ color: hsl(${Math.max(0,Math.min(120-120*r,120))}deg 100% 31%);`,n?.key)}return n?.onChange&&!(a&&n.skipInitialOnChange)&&n.onChange(i),a=!1,i}return o.updateDeps=e=>{r=e},o}function o(e,t){if(e===void 0)throw Error(`Unexpected undefined${t?`: ${t}`:``}`);return e}var s=(e,t)=>Math.abs(e-t)<1.01,c=(e,t,n)=>{let r;return function(...i){e.clearTimeout(r),r=e.setTimeout(()=>t.apply(this,i),n)}},l=e=>{let{offsetWidth:t,offsetHeight:n}=e;return{width:t,height:n}},u=e=>e,d=e=>{let t=Math.max(e.startIndex-e.overscan,0),n=Math.min(e.endIndex+e.overscan,e.count-1),r=[];for(let e=t;e<=n;e++)r.push(e);return r},f=(e,t)=>{let n=e.scrollElement;if(!n)return;let r=e.targetWindow;if(!r)return;let i=e=>{let{width:n,height:r}=e;t({width:Math.round(n),height:Math.round(r)})};if(i(l(n)),!r.ResizeObserver)return()=>{};let a=new r.ResizeObserver(t=>{let r=()=>{let e=t[0];if(e?.borderBoxSize){let t=e.borderBoxSize[0];if(t){i({width:t.inlineSize,height:t.blockSize});return}}i(l(n))};e.options.useAnimationFrameWithResizeObserver?requestAnimationFrame(r):r()});return a.observe(n,{box:`border-box`}),()=>{a.unobserve(n)}},p={passive:!0},m=typeof window>`u`||`onscrollend`in window,h=(e,t)=>{let n=e.scrollElement;if(!n)return;let r=e.targetWindow;if(!r)return;let i=0,a=e.options.useScrollendEvent&&m?()=>void 0:c(r,()=>{t(i,!1)},e.options.isScrollingResetDelay),o=r=>()=>{let{horizontal:o,isRtl:s}=e.options;i=o?n.scrollLeft*(s&&-1||1):n.scrollTop,a(),t(i,r)},s=o(!0),l=o(!1);n.addEventListener(`scroll`,s,p);let u=e.options.useScrollendEvent&&m;return u&&n.addEventListener(`scrollend`,l,p),()=>{n.removeEventListener(`scroll`,s),u&&n.removeEventListener(`scrollend`,l)}},g=(e,t,n)=>{if(t?.borderBoxSize){let e=t.borderBoxSize[0];if(e)return Math.round(e[n.options.horizontal?`inlineSize`:`blockSize`])}return e[n.options.horizontal?`offsetWidth`:`offsetHeight`]},_=(e,{adjustments:t=0,behavior:n},r)=>{var i,a;let o=e+t;(a=(i=r.scrollElement)?.scrollTo)==null||a.call(i,{[r.options.horizontal?`left`:`top`]:o,behavior:n})},v=class{constructor(e){this.unsubs=[],this.scrollElement=null,this.targetWindow=null,this.isScrolling=!1,this.scrollState=null,this.measurementsCache=[],this.itemSizeCache=new Map,this.laneAssignments=new Map,this.pendingMeasuredCacheIndexes=[],this.prevLanes=void 0,this.lanesChangedFlag=!1,this.lanesSettling=!1,this.scrollRect=null,this.scrollOffset=null,this.scrollDirection=null,this.scrollAdjustments=0,this.elementsCache=new Map,this.now=()=>{var e;return((e=this.targetWindow?.performance)?.now)?.call(e)??Date.now()},this.observer=(()=>{let e=null,t=()=>e||(!this.targetWindow||!this.targetWindow.ResizeObserver?null:e=new this.targetWindow.ResizeObserver(e=>{e.forEach(e=>{let t=()=>{let t=e.target,n=this.indexFromElement(t);if(!t.isConnected){this.observer.unobserve(t);return}this.shouldMeasureDuringScroll(n)&&this.resizeItem(n,this.options.measureElement(t,e,this))};this.options.useAnimationFrameWithResizeObserver?requestAnimationFrame(t):t()})}));return{disconnect:()=>{var n;(n=t())==null||n.disconnect(),e=null},observe:e=>t()?.observe(e,{box:`border-box`}),unobserve:e=>t()?.unobserve(e)}})(),this.range=null,this.setOptions=e=>{Object.entries(e).forEach(([t,n])=>{n===void 0&&delete e[t]}),this.options={debug:!1,initialOffset:0,overscan:1,paddingStart:0,paddingEnd:0,scrollPaddingStart:0,scrollPaddingEnd:0,horizontal:!1,getItemKey:u,rangeExtractor:d,onChange:()=>{},measureElement:g,initialRect:{width:0,height:0},scrollMargin:0,gap:0,indexAttribute:`data-index`,initialMeasurementsCache:[],lanes:1,isScrollingResetDelay:150,enabled:!0,isRtl:!1,useScrollendEvent:!1,useAnimationFrameWithResizeObserver:!1,laneAssignmentMode:`estimate`,...e}},this.notify=e=>{var t,n;(n=(t=this.options).onChange)==null||n.call(t,this,e)},this.maybeNotify=a(()=>(this.calculateRange(),[this.isScrolling,this.range?this.range.startIndex:null,this.range?this.range.endIndex:null]),e=>{this.notify(e)},{key:!1,debug:()=>this.options.debug,initialDeps:[this.isScrolling,this.range?this.range.startIndex:null,this.range?this.range.endIndex:null]}),this.cleanup=()=>{this.unsubs.filter(Boolean).forEach(e=>e()),this.unsubs=[],this.observer.disconnect(),this.rafId!=null&&this.targetWindow&&(this.targetWindow.cancelAnimationFrame(this.rafId),this.rafId=null),this.scrollState=null,this.scrollElement=null,this.targetWindow=null},this._didMount=()=>()=>{this.cleanup()},this._willUpdate=()=>{let e=this.options.enabled?this.options.getScrollElement():null;if(this.scrollElement!==e){if(this.cleanup(),!e){this.maybeNotify();return}this.scrollElement=e,this.targetWindow=this.scrollElement&&`ownerDocument`in this.scrollElement?this.scrollElement.ownerDocument.defaultView:this.scrollElement?.window??null,this.elementsCache.forEach(e=>{this.observer.observe(e)}),this.unsubs.push(this.options.observeElementRect(this,e=>{this.scrollRect=e,this.maybeNotify()})),this.unsubs.push(this.options.observeElementOffset(this,(e,t)=>{this.scrollAdjustments=0,this.scrollDirection=t?this.getScrollOffset()<e?`forward`:`backward`:null,this.scrollOffset=e,this.isScrolling=t,this.scrollState&&this.scheduleScrollReconcile(),this.maybeNotify()})),this._scrollToOffset(this.getScrollOffset(),{adjustments:void 0,behavior:void 0})}},this.rafId=null,this.getSize=()=>this.options.enabled?(this.scrollRect=this.scrollRect??this.options.initialRect,this.scrollRect[this.options.horizontal?`width`:`height`]):(this.scrollRect=null,0),this.getScrollOffset=()=>this.options.enabled?(this.scrollOffset=this.scrollOffset??(typeof this.options.initialOffset==`function`?this.options.initialOffset():this.options.initialOffset),this.scrollOffset):(this.scrollOffset=null,0),this.getFurthestMeasurement=(e,t)=>{let n=new Map,r=new Map;for(let i=t-1;i>=0;i--){let t=e[i];if(n.has(t.lane))continue;let a=r.get(t.lane);if(a==null||t.end>a.end?r.set(t.lane,t):t.end<a.end&&n.set(t.lane,!0),n.size===this.options.lanes)break}return r.size===this.options.lanes?Array.from(r.values()).sort((e,t)=>e.end===t.end?e.index-t.index:e.end-t.end)[0]:void 0},this.getMeasurementOptions=a(()=>[this.options.count,this.options.paddingStart,this.options.scrollMargin,this.options.getItemKey,this.options.enabled,this.options.lanes,this.options.laneAssignmentMode],(e,t,n,r,i,a,o)=>(this.prevLanes!==void 0&&this.prevLanes!==a&&(this.lanesChangedFlag=!0),this.prevLanes=a,this.pendingMeasuredCacheIndexes=[],{count:e,paddingStart:t,scrollMargin:n,getItemKey:r,enabled:i,lanes:a,laneAssignmentMode:o}),{key:!1}),this.getMeasurements=a(()=>[this.getMeasurementOptions(),this.itemSizeCache],({count:e,paddingStart:t,scrollMargin:n,getItemKey:r,enabled:i,lanes:a,laneAssignmentMode:o},s)=>{if(!i)return this.measurementsCache=[],this.itemSizeCache.clear(),this.laneAssignments.clear(),[];if(this.laneAssignments.size>e)for(let t of this.laneAssignments.keys())t>=e&&this.laneAssignments.delete(t);this.lanesChangedFlag&&(this.lanesChangedFlag=!1,this.lanesSettling=!0,this.measurementsCache=[],this.itemSizeCache.clear(),this.laneAssignments.clear(),this.pendingMeasuredCacheIndexes=[]),this.measurementsCache.length===0&&!this.lanesSettling&&(this.measurementsCache=this.options.initialMeasurementsCache,this.measurementsCache.forEach(e=>{this.itemSizeCache.set(e.key,e.size)}));let c=this.lanesSettling?0:this.pendingMeasuredCacheIndexes.length>0?Math.min(...this.pendingMeasuredCacheIndexes):0;this.pendingMeasuredCacheIndexes=[],this.lanesSettling&&this.measurementsCache.length===e&&(this.lanesSettling=!1);let l=this.measurementsCache.slice(0,c),u=Array(a).fill(void 0);for(let e=0;e<c;e++){let t=l[e];t&&(u[t.lane]=e)}for(let i=c;i<e;i++){let e=r(i),a=this.laneAssignments.get(i),c,d,f=o===`estimate`||s.has(e);if(a!==void 0&&this.options.lanes>1){c=a;let e=u[c],r=e===void 0?void 0:l[e];d=r?r.end+this.options.gap:t+n}else{let e=this.options.lanes===1?l[i-1]:this.getFurthestMeasurement(l,i);d=e?e.end+this.options.gap:t+n,c=e?e.lane:i%this.options.lanes,this.options.lanes>1&&f&&this.laneAssignments.set(i,c)}let p=s.get(e),m=typeof p==`number`?p:this.options.estimateSize(i),h=d+m;l[i]={index:i,start:d,size:m,end:h,key:e,lane:c},u[c]=i}return this.measurementsCache=l,l},{key:!1,debug:()=>this.options.debug}),this.calculateRange=a(()=>[this.getMeasurements(),this.getSize(),this.getScrollOffset(),this.options.lanes],(e,t,n,r)=>this.range=e.length>0&&t>0?b({measurements:e,outerSize:t,scrollOffset:n,lanes:r}):null,{key:!1,debug:()=>this.options.debug}),this.getVirtualIndexes=a(()=>{let e=null,t=null,n=this.calculateRange();return n&&(e=n.startIndex,t=n.endIndex),this.maybeNotify.updateDeps([this.isScrolling,e,t]),[this.options.rangeExtractor,this.options.overscan,this.options.count,e,t]},(e,t,n,r,i)=>r===null||i===null?[]:e({startIndex:r,endIndex:i,overscan:t,count:n}),{key:!1,debug:()=>this.options.debug}),this.indexFromElement=e=>{let t=this.options.indexAttribute,n=e.getAttribute(t);return n?parseInt(n,10):(console.warn(`Missing attribute name '${t}={index}' on measured element.`),-1)},this.shouldMeasureDuringScroll=e=>{if(!this.scrollState||this.scrollState.behavior!==`smooth`)return!0;let t=this.scrollState.index??this.getVirtualItemForOffset(this.scrollState.lastTargetOffset)?.index;if(t!==void 0&&this.range){let n=Math.max(this.options.overscan,Math.ceil((this.range.endIndex-this.range.startIndex)/2)),r=Math.max(0,t-n),i=Math.min(this.options.count-1,t+n);return e>=r&&e<=i}return!0},this.measureElement=e=>{if(!e){this.elementsCache.forEach((e,t)=>{e.isConnected||(this.observer.unobserve(e),this.elementsCache.delete(t))});return}let t=this.indexFromElement(e),n=this.options.getItemKey(t),r=this.elementsCache.get(n);r!==e&&(r&&this.observer.unobserve(r),this.observer.observe(e),this.elementsCache.set(n,e)),(!this.isScrolling||this.scrollState)&&this.shouldMeasureDuringScroll(t)&&this.resizeItem(t,this.options.measureElement(e,void 0,this))},this.resizeItem=(e,t)=>{let n=this.measurementsCache[e];if(!n)return;let r=t-(this.itemSizeCache.get(n.key)??n.size);r!==0&&(this.scrollState?.behavior!==`smooth`&&(this.shouldAdjustScrollPositionOnItemSizeChange===void 0?n.start<this.getScrollOffset()+this.scrollAdjustments:this.shouldAdjustScrollPositionOnItemSizeChange(n,r,this))&&this._scrollToOffset(this.getScrollOffset(),{adjustments:this.scrollAdjustments+=r,behavior:void 0}),this.pendingMeasuredCacheIndexes.push(n.index),this.itemSizeCache=new Map(this.itemSizeCache.set(n.key,t)),this.notify(!1))},this.getVirtualItems=a(()=>[this.getVirtualIndexes(),this.getMeasurements()],(e,t)=>{let n=[];for(let r=0,i=e.length;r<i;r++){let i=t[e[r]];n.push(i)}return n},{key:!1,debug:()=>this.options.debug}),this.getVirtualItemForOffset=e=>{let t=this.getMeasurements();if(t.length!==0)return o(t[y(0,t.length-1,e=>o(t[e]).start,e)])},this.getMaxScrollOffset=()=>{if(!this.scrollElement)return 0;if(`scrollHeight`in this.scrollElement)return this.options.horizontal?this.scrollElement.scrollWidth-this.scrollElement.clientWidth:this.scrollElement.scrollHeight-this.scrollElement.clientHeight;{let e=this.scrollElement.document.documentElement;return this.options.horizontal?e.scrollWidth-this.scrollElement.innerWidth:e.scrollHeight-this.scrollElement.innerHeight}},this.getOffsetForAlignment=(e,t,n=0)=>{if(!this.scrollElement)return 0;let r=this.getSize(),i=this.getScrollOffset();t===`auto`&&(t=e>=i+r?`end`:`start`),t===`center`?e+=(n-r)/2:t===`end`&&(e-=r);let a=this.getMaxScrollOffset();return Math.max(Math.min(a,e),0)},this.getOffsetForIndex=(e,t=`auto`)=>{e=Math.max(0,Math.min(e,this.options.count-1));let n=this.getSize(),r=this.getScrollOffset(),i=this.measurementsCache[e];if(!i)return;if(t===`auto`){if(i.end>=r+n-this.options.scrollPaddingEnd)t=`end`;else if(i.start<=r+this.options.scrollPaddingStart)t=`start`;else return[r,t]}if(t===`end`&&e===this.options.count-1)return[this.getMaxScrollOffset(),t];let a=t===`end`?i.end+this.options.scrollPaddingEnd:i.start-this.options.scrollPaddingStart;return[this.getOffsetForAlignment(a,t,i.size),t]},this.scrollToOffset=(e,{align:t=`start`,behavior:n=`auto`}={})=>{let r=this.getOffsetForAlignment(e,t),i=this.now();this.scrollState={index:null,align:t,behavior:n,startedAt:i,lastTargetOffset:r,stableFrames:0},this._scrollToOffset(r,{adjustments:void 0,behavior:n}),this.scheduleScrollReconcile()},this.scrollToIndex=(e,{align:t=`auto`,behavior:n=`auto`}={})=>{e=Math.max(0,Math.min(e,this.options.count-1));let r=this.getOffsetForIndex(e,t);if(!r)return;let[i,a]=r,o=this.now();this.scrollState={index:e,align:a,behavior:n,startedAt:o,lastTargetOffset:i,stableFrames:0},this._scrollToOffset(i,{adjustments:void 0,behavior:n}),this.scheduleScrollReconcile()},this.scrollBy=(e,{behavior:t=`auto`}={})=>{let n=this.getScrollOffset()+e,r=this.now();this.scrollState={index:null,align:`start`,behavior:t,startedAt:r,lastTargetOffset:n,stableFrames:0},this._scrollToOffset(n,{adjustments:void 0,behavior:t}),this.scheduleScrollReconcile()},this.getTotalSize=()=>{let e=this.getMeasurements(),t;if(e.length===0)t=this.options.paddingStart;else if(this.options.lanes===1)t=e[e.length-1]?.end??0;else{let n=Array(this.options.lanes).fill(null),r=e.length-1;for(;r>=0&&n.some(e=>e===null);){let t=e[r];n[t.lane]===null&&(n[t.lane]=t.end),r--}t=Math.max(...n.filter(e=>e!==null))}return Math.max(t-this.options.scrollMargin+this.options.paddingEnd,0)},this._scrollToOffset=(e,{adjustments:t,behavior:n})=>{this.options.scrollToFn(e,{behavior:n,adjustments:t},this)},this.measure=()=>{this.itemSizeCache=new Map,this.laneAssignments=new Map,this.notify(!1)},this.setOptions(e)}scheduleScrollReconcile(){if(!this.targetWindow){this.scrollState=null;return}this.rafId??=this.targetWindow.requestAnimationFrame(()=>{this.rafId=null,this.reconcileScroll()})}reconcileScroll(){if(!this.scrollState||!this.scrollElement)return;if(this.now()-this.scrollState.startedAt>5e3){this.scrollState=null;return}let e=this.scrollState.index==null?void 0:this.getOffsetForIndex(this.scrollState.index,this.scrollState.align),t=e?e[0]:this.scrollState.lastTargetOffset,n=t!==this.scrollState.lastTargetOffset;if(!n&&s(t,this.getScrollOffset())){if(this.scrollState.stableFrames++,this.scrollState.stableFrames>=1){this.scrollState=null;return}}else this.scrollState.stableFrames=0,n&&(this.scrollState.lastTargetOffset=t,this.scrollState.behavior=`auto`,this._scrollToOffset(t,{adjustments:void 0,behavior:`auto`}));this.scheduleScrollReconcile()}},y=(e,t,n,r)=>{for(;e<=t;){let i=(e+t)/2|0,a=n(i);if(a<r)e=i+1;else if(a>r)t=i-1;else return i}return e>0?e-1:0};function b({measurements:e,outerSize:t,scrollOffset:n,lanes:r}){let i=e.length-1,a=t=>e[t].start;if(e.length<=r)return{startIndex:0,endIndex:i};let o=y(0,i,a,n),s=o;if(r===1)for(;s<i&&e[s].end<n+t;)s++;else if(r>1){let a=Array(r).fill(0);for(;s<i&&a.some(e=>e<n+t);){let t=e[s];a[t.lane]=t.end,s++}let c=Array(r).fill(n+t);for(;o>=0&&c.some(e=>e>=n);){let t=e[o];c[t.lane]=t.start,o--}o=Math.max(0,o-o%r),s=Math.min(i,s+(r-1-s%r))}return{startIndex:o,endIndex:s}}var x=typeof document<`u`?r.useLayoutEffect:r.useEffect;function S({useFlushSync:e=!0,...t}){let n=r.useReducer(()=>({}),{})[1],a={...t,onChange:(r,a)=>{var o;e&&a?(0,i.flushSync)(n):n(),(o=t.onChange)==null||o.call(t,r,a)}},[o]=r.useState(()=>new v(a));return o.setOptions(a),x(()=>o._didMount(),[]),x(()=>o._willUpdate()),o}function C(e){return S({observeElementRect:f,observeElementOffset:h,scrollToFn:_,...e})}export{C as t};
package/dist/index.html CHANGED
@@ -11,10 +11,10 @@
11
11
  href="https://fonts.googleapis.com/css2?family=IBM+Plex+Sans:wght@400;500;600;700&family=IBM+Plex+Mono:wght@400;500&family=Space+Grotesk:wght@500;600;700&display=swap"
12
12
  rel="stylesheet"
13
13
  />
14
- <script type="module" crossorigin src="/assets/index-DRBtWycK.js"></script>
15
- <link rel="modulepreload" crossorigin href="/assets/rolldown-runtime-Dw2cE7zH.js">
16
- <link rel="modulepreload" crossorigin href="/assets/react-vendor-DBiqvVPF.js">
17
- <link rel="modulepreload" crossorigin href="/assets/tanstack-virtual-vendor-BfMyFx37.js">
14
+ <script type="module" crossorigin src="/assets/index-CxeISj08.js"></script>
15
+ <link rel="modulepreload" crossorigin href="/assets/rolldown-runtime-hePW80VL.js">
16
+ <link rel="modulepreload" crossorigin href="/assets/react-vendor-BwlCKk7e.js">
17
+ <link rel="modulepreload" crossorigin href="/assets/tanstack-virtual-vendor-tYq3m8C_.js">
18
18
  <link rel="stylesheet" crossorigin href="/assets/index-CwTPzuXv.css">
19
19
  </head>
20
20
  <body>