@likec4/core 1.55.1 → 1.57.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.
Files changed (46) hide show
  1. package/dist/THIRD-PARTY-LICENSES.md +30 -30
  2. package/dist/_chunks/Builder.view-element.mjs +2 -2
  3. package/dist/_chunks/LikeC4Model.d.mts +2 -1
  4. package/dist/_chunks/_types.d.mts +7 -3
  5. package/dist/_chunks/_types2.d.mts +1 -1
  6. package/dist/_chunks/assignTagColors.mjs +1 -1
  7. package/dist/_chunks/index.d.mts +64 -2
  8. package/dist/_chunks/index3.d.mts +1 -1
  9. package/dist/_chunks/index4.d.mts +1 -1
  10. package/dist/_chunks/index5.d.mts +13 -2
  11. package/dist/_chunks/libs/chroma-js.mjs +15 -0
  12. package/dist/_chunks/libs/graphology-dag.d.mts +607 -0
  13. package/dist/_chunks/libs/graphology-dag.mjs +1 -1
  14. package/dist/_chunks/libs/hast-util-to-html.mjs +1 -1
  15. package/dist/_chunks/libs/mdast-util-find-and-replace.mjs +1 -1
  16. package/dist/_chunks/libs/mdast-util-from-markdown.mjs +1 -1
  17. package/dist/_chunks/libs/mdast-util-gfm.mjs +11 -11
  18. package/dist/_chunks/libs/mnemonist.d.mts +33 -33
  19. package/dist/_chunks/libs/mnemonist.mjs +1 -1
  20. package/dist/_chunks/libs/unified.mjs +1 -1
  21. package/dist/_chunks/manual-layout.mjs +1 -1
  22. package/dist/_chunks/mnemonist.d.mts +1 -1
  23. package/dist/_chunks/model.mjs +4 -4
  24. package/dist/_chunks/rolldown-runtime.mjs +1 -1
  25. package/dist/_chunks/types.mjs +1 -1
  26. package/dist/builder/index.d.mts +2 -8
  27. package/dist/builder/index.mjs +1 -1
  28. package/dist/compute-view/index.d.mts +2 -6
  29. package/dist/compute-view/index.mjs +2 -2
  30. package/dist/geometry/index.mjs +1 -1
  31. package/dist/index.d.mts +4 -5
  32. package/dist/index.mjs +1 -1
  33. package/dist/model/index.d.mts +0 -5
  34. package/dist/model/index.mjs +1 -1
  35. package/dist/styles/index.d.mts +1 -2
  36. package/dist/styles/index.mjs +1 -1
  37. package/dist/types/index.d.mts +2 -2
  38. package/dist/types/index.mjs +1 -1
  39. package/dist/utils/graphology/index.d.mts +2 -1
  40. package/dist/utils/graphology/index.mjs +1 -1
  41. package/dist/utils/index.d.mts +3 -5
  42. package/dist/utils/index.mjs +1 -1
  43. package/package.json +10 -10
  44. package/dist/_chunks/geometry.mjs +0 -1
  45. package/dist/_chunks/libs/@mantine/colors-generator.mjs +0 -15
  46. package/dist/_chunks/utils.mjs +0 -1
@@ -1 +1 @@
1
- import{r as e,t}from"../rolldown-runtime.mjs";import{a as n,i as r,o as i,r as a}from"./graphology-dag.mjs";var o=t(((e,t)=>{var n=i();function r(e){this.size=0,this.items=new Map,this.inverse=e}function a(){this.size=0,this.items=new Map,this.inverse=new r(this)}function o(){this.size=0,this.items.clear(),this.inverse.items.clear()}a.prototype.clear=o,r.prototype.clear=o;function s(e,t){if(this.items.has(e)){var n=this.items.get(e);if(n===t)return this;this.inverse.items.delete(n)}if(this.inverse.items.has(t)){var r=this.inverse.items.get(t);if(r===e)return this;this.items.delete(r)}return this.items.set(e,t),this.inverse.items.set(t,e),this.size=this.items.size,this.inverse.size=this.inverse.items.size,this}a.prototype.set=s,r.prototype.set=s;function c(e){if(this.items.has(e)){var t=this.items.get(e);return this.items.delete(e),this.inverse.items.delete(t),this.size=this.items.size,this.inverse.size=this.inverse.items.size,!0}return!1}a.prototype.delete=c,r.prototype.delete=c,[`has`,`get`,`forEach`,`keys`,`values`,`entries`].forEach(function(e){a.prototype[e]=r.prototype[e]=function(){return Map.prototype[e].apply(this.items,arguments)}}),typeof Symbol<`u`&&(a.prototype[Symbol.iterator]=a.prototype.entries,r.prototype[Symbol.iterator]=r.prototype.entries),a.prototype.inspect=function(){var e={left:this.items,right:this.inverse.items};return Object.defineProperty(e,`constructor`,{value:a,enumerable:!1}),e},typeof Symbol<`u`&&(a.prototype[Symbol.for(`nodejs.util.inspect.custom`)]=a.prototype.inspect),r.prototype.inspect=function(){var e={left:this.inverse.items,right:this.items};return Object.defineProperty(e,`constructor`,{value:r,enumerable:!1}),e},typeof Symbol<`u`&&(r.prototype[Symbol.for(`nodejs.util.inspect.custom`)]=r.prototype.inspect),a.from=function(e){var t=new a;return n(e,function(e,n){t.set(n,e)}),t},t.exports=a})),s=t(((e,t)=>{function n(e){if(typeof e!=`function`)throw Error(`mnemonist/DefaultMap.constructor: expecting a function.`);this.items=new Map,this.factory=e,this.size=0}n.prototype.clear=function(){this.items.clear(),this.size=0},n.prototype.get=function(e){var t=this.items.get(e);return t===void 0&&(t=this.factory(e,this.size),this.items.set(e,t),this.size++),t},n.prototype.peek=function(e){return this.items.get(e)},n.prototype.set=function(e,t){return this.items.set(e,t),this.size=this.items.size,this},n.prototype.has=function(e){return this.items.has(e)},n.prototype.delete=function(e){var t=this.items.delete(e);return this.size=this.items.size,t},n.prototype.forEach=function(e,t){t=arguments.length>1?t:this,this.items.forEach(e,t)},n.prototype.entries=function(){return this.items.entries()},n.prototype.keys=function(){return this.items.keys()},n.prototype.values=function(){return this.items.values()},typeof Symbol<`u`&&(n.prototype[Symbol.iterator]=n.prototype.entries),n.prototype.inspect=function(){return this.items},typeof Symbol<`u`&&(n.prototype[Symbol.for(`nodejs.util.inspect.custom`)]=n.prototype.inspect),n.autoIncrement=function(){var e=0;return function(){return e++}},t.exports=n})),c=t(((e,t)=>{function n(e){if(typeof e!=`function`)throw Error(`mnemonist/DefaultWeakMap.constructor: expecting a function.`);this.items=new WeakMap,this.factory=e}n.prototype.clear=function(){this.items=new WeakMap},n.prototype.get=function(e){var t=this.items.get(e);return t===void 0&&(t=this.factory(e),this.items.set(e,t)),t},n.prototype.peek=function(e){return this.items.get(e)},n.prototype.set=function(e,t){return this.items.set(e,t),this},n.prototype.has=function(e){return this.items.has(e)},n.prototype.delete=function(e){return this.items.delete(e)},n.prototype.inspect=function(){return this.items},typeof Symbol<`u`&&(n.prototype[Symbol.for(`nodejs.util.inspect.custom`)]=n.prototype.inspect),t.exports=n})),l=t(((e,t)=>{var r=n(),a=i();function o(){this.clear()}o.prototype.clear=function(){this.head=null,this.tail=null,this.size=0},o.prototype.first=function(){return this.head?this.head.item:void 0},o.prototype.peek=o.prototype.first,o.prototype.last=function(){return this.tail?this.tail.item:void 0},o.prototype.push=function(e){var t={item:e,next:null};return this.head?(this.tail.next=t,this.tail=t):(this.head=t,this.tail=t),this.size++,this.size},o.prototype.unshift=function(e){var t={item:e,next:null};return this.head?(this.head.next||(this.tail=this.head),t.next=this.head,this.head=t):(this.head=t,this.tail=t),this.size++,this.size},o.prototype.shift=function(){if(this.size){var e=this.head;return this.head=e.next,this.size--,e.item}},o.prototype.forEach=function(e,t){if(this.size){t=arguments.length>1?t:this;for(var n=this.head,r=0;n;)e.call(t,n.item,r,this),n=n.next,r++}},o.prototype.toArray=function(){if(!this.size)return[];for(var e=Array(this.size),t=0,n=this.size,r=this.head;t<n;t++)e[t]=r.item,r=r.next;return e},o.prototype.values=function(){var e=this.head;return new r(function(){if(!e)return{done:!0};var t=e.item;return e=e.next,{value:t,done:!1}})},o.prototype.entries=function(){var e=this.head,t=0;return new r(function(){if(!e)return{done:!0};var n=e.item;return e=e.next,t++,{value:[t-1,n],done:!1}})},typeof Symbol<`u`&&(o.prototype[Symbol.iterator]=o.prototype.values),o.prototype.toString=function(){return this.toArray().join(`,`)},o.prototype.toJSON=function(){return this.toArray()},o.prototype.inspect=function(){var e=this.toArray();return Object.defineProperty(e,`constructor`,{value:o,enumerable:!1}),e},typeof Symbol<`u`&&(o.prototype[Symbol.for(`nodejs.util.inspect.custom`)]=o.prototype.inspect),o.from=function(e){var t=new o;return a(e,function(e){t.push(e)}),t},t.exports=o})),u=t(((e,t)=>{var r=n(),a=i();function o(e){this.Container=e||Array,this.items=new Map,this.clear(),Object.defineProperty(this.items,`constructor`,{value:o,enumerable:!1})}o.prototype.clear=function(){this.size=0,this.dimension=0,this.items.clear()},o.prototype.set=function(e,t){var n=this.items.get(e),r;return n||(this.dimension++,n=new this.Container,this.items.set(e,n)),this.Container===Set?(r=n.size,n.add(t),r<n.size&&this.size++):(n.push(t),this.size++),this},o.prototype.delete=function(e){var t=this.items.get(e);return t?(this.size-=this.Container===Set?t.size:t.length,this.dimension--,this.items.delete(e),!0):!1},o.prototype.remove=function(e,t){var n=this.items.get(e),r,i;return n?this.Container===Set?(r=n.delete(t),r&&this.size--,n.size===0&&(this.items.delete(e),this.dimension--),r):(i=n.indexOf(t),i===-1?!1:(this.size--,n.length===1?(this.items.delete(e),this.dimension--,!0):(n.splice(i,1),!0))):!1},o.prototype.has=function(e){return this.items.has(e)},o.prototype.get=function(e){return this.items.get(e)},o.prototype.multiplicity=function(e){var t=this.items.get(e);return t===void 0?0:this.Container===Set?t.size:t.length},o.prototype.count=o.prototype.multiplicity,o.prototype.forEach=function(e,t){t=arguments.length>1?t:this;var n;function r(r){e.call(t,r,n)}this.items.forEach(function(e,t){n=t,e.forEach(r)})},o.prototype.forEachAssociation=function(e,t){t=arguments.length>1?t:this,this.items.forEach(e,t)},o.prototype.keys=function(){return this.items.keys()},o.prototype.values=function(){var e=this.items.values(),t=!1,n,i,a,o;return this.Container===Set?new r(function r(){if(!t){if(i=e.next(),i.done)return{done:!0};t=!0,n=i.value.values()}return i=n.next(),i.done?(t=!1,r()):{done:!1,value:i.value}}):new r(function r(){if(!t){if(i=e.next(),i.done)return{done:!0};t=!0,n=i.value,a=0,o=n.length}return a>=o?(t=!1,r()):{done:!1,value:n[a++]}})},o.prototype.entries=function(){var e=this.items.entries(),t=!1,n,i,a,o,s;return this.Container===Set?new r(function r(){if(!t){if(i=e.next(),i.done)return{done:!0};t=!0,a=i.value[0],n=i.value[1].values()}return i=n.next(),i.done?(t=!1,r()):{done:!1,value:[a,i.value]}}):new r(function r(){if(!t){if(i=e.next(),i.done)return{done:!0};t=!0,a=i.value[0],n=i.value[1],o=0,s=n.length}return o>=s?(t=!1,r()):{done:!1,value:[a,n[o++]]}})},o.prototype.containers=function(){return this.items.values()},o.prototype.associations=function(){return this.items.entries()},typeof Symbol<`u`&&(o.prototype[Symbol.iterator]=o.prototype.entries),o.prototype.inspect=function(){return this.items},typeof Symbol<`u`&&(o.prototype[Symbol.for(`nodejs.util.inspect.custom`)]=o.prototype.inspect),o.prototype.toJSON=function(){return this.items},o.from=function(e,t){var n=new o(t);return a(e,function(e,t){n.set(t,e)}),n},t.exports=o})),d=t(((e,t)=>{var r=n(),a=i();function o(){this.clear()}o.prototype.clear=function(){this.items=[],this.offset=0,this.size=0},o.prototype.enqueue=function(e){return this.items.push(e),++this.size},o.prototype.dequeue=function(){if(this.size){var e=this.items[this.offset];return++this.offset*2>=this.items.length&&(this.items=this.items.slice(this.offset),this.offset=0),this.size--,e}},o.prototype.peek=function(){if(this.size)return this.items[this.offset]},o.prototype.forEach=function(e,t){t=arguments.length>1?t:this;for(var n=this.offset,r=0,i=this.items.length;n<i;n++,r++)e.call(t,this.items[n],r,this)},o.prototype.toArray=function(){return this.items.slice(this.offset)},o.prototype.values=function(){var e=this.items,t=this.offset;return new r(function(){if(t>=e.length)return{done:!0};var n=e[t];return t++,{value:n,done:!1}})},o.prototype.entries=function(){var e=this.items,t=this.offset,n=0;return new r(function(){if(t>=e.length)return{done:!0};var r=e[t];return t++,{value:[n++,r],done:!1}})},typeof Symbol<`u`&&(o.prototype[Symbol.iterator]=o.prototype.values),o.prototype.toString=function(){return this.toArray().join(`,`)},o.prototype.toJSON=function(){return this.toArray()},o.prototype.inspect=function(){var e=this.toArray();return Object.defineProperty(e,`constructor`,{value:o,enumerable:!1}),e},typeof Symbol<`u`&&(o.prototype[Symbol.for(`nodejs.util.inspect.custom`)]=o.prototype.inspect),o.from=function(e){var t=new o;return a(e,function(e){t.enqueue(e)}),t},o.of=function(){return o.from(arguments)},t.exports=o})),f=t(((e,t)=>{var o=n(),s=i(),c=r(),l=a();function u(e,t,n){if(arguments.length<2&&(n=e,e=null,t=null),this.capacity=n,typeof this.capacity!=`number`||this.capacity<=0)throw Error(`mnemonist/lru-cache: capacity should be positive number.`);if(!isFinite(this.capacity)||Math.floor(this.capacity)!==this.capacity)throw Error(`mnemonist/lru-cache: capacity should be a finite positive integer.`);var r=c.getPointerArray(n);this.forward=new r(n),this.backward=new r(n),this.K=typeof e==`function`?new e(n):Array(n),this.V=typeof t==`function`?new t(n):Array(n),this.size=0,this.head=0,this.tail=0,this.items={}}u.prototype.clear=function(){this.size=0,this.head=0,this.tail=0,this.items={}},u.prototype.splayOnTop=function(e){var t=this.head;if(this.head===e)return this;var n=this.backward[e],r=this.forward[e];return this.tail===e?this.tail=n:this.backward[r]=n,this.forward[n]=r,this.backward[t]=e,this.head=e,this.forward[e]=t,this},u.prototype.set=function(e,t){var n=this.items[e];if(n!==void 0){this.splayOnTop(n),this.V[n]=t;return}this.size<this.capacity?n=this.size++:(n=this.tail,this.tail=this.backward[n],delete this.items[this.K[n]]),this.items[e]=n,this.K[n]=e,this.V[n]=t,this.forward[n]=this.head,this.backward[this.head]=n,this.head=n},u.prototype.setpop=function(e,t){var n=null,r=null,i=this.items[e];return i===void 0?(this.size<this.capacity?i=this.size++:(i=this.tail,this.tail=this.backward[i],n=this.V[i],r=this.K[i],delete this.items[r]),this.items[e]=i,this.K[i]=e,this.V[i]=t,this.forward[i]=this.head,this.backward[this.head]=i,this.head=i,r?{evicted:!0,key:r,value:n}:null):(this.splayOnTop(i),n=this.V[i],this.V[i]=t,{evicted:!1,key:e,value:n})},u.prototype.has=function(e){return e in this.items},u.prototype.get=function(e){var t=this.items[e];if(t!==void 0)return this.splayOnTop(t),this.V[t]},u.prototype.peek=function(e){var t=this.items[e];if(t!==void 0)return this.V[t]},u.prototype.forEach=function(e,t){t=arguments.length>1?t:this;for(var n=0,r=this.size,i=this.head,a=this.K,o=this.V,s=this.forward;n<r;)e.call(t,o[i],a[i],this),i=s[i],n++},u.prototype.keys=function(){var e=0,t=this.size,n=this.head,r=this.K,i=this.forward;return new o(function(){if(e>=t)return{done:!0};var a=r[n];return e++,e<t&&(n=i[n]),{done:!1,value:a}})},u.prototype.values=function(){var e=0,t=this.size,n=this.head,r=this.V,i=this.forward;return new o(function(){if(e>=t)return{done:!0};var a=r[n];return e++,e<t&&(n=i[n]),{done:!1,value:a}})},u.prototype.entries=function(){var e=0,t=this.size,n=this.head,r=this.K,i=this.V,a=this.forward;return new o(function(){if(e>=t)return{done:!0};var o=r[n],s=i[n];return e++,e<t&&(n=a[n]),{done:!1,value:[o,s]}})},typeof Symbol<`u`&&(u.prototype[Symbol.iterator]=u.prototype.entries),u.prototype.inspect=function(){for(var e=new Map,t=this.entries(),n;n=t.next(),!n.done;)e.set(n.value[0],n.value[1]);return Object.defineProperty(e,`constructor`,{value:u,enumerable:!1}),e},typeof Symbol<`u`&&(u.prototype[Symbol.for(`nodejs.util.inspect.custom`)]=u.prototype.inspect),u.from=function(e,t,n,r){if(arguments.length<2){if(r=l.guessLength(e),typeof r!=`number`)throw Error(`mnemonist/lru-cache.from: could not guess iterable length. Please provide desired capacity as last argument.`)}else arguments.length===2&&(r=t,t=null,n=null);var i=new u(t,n,r);return s(e,function(e,t){i.set(t,e)}),i},t.exports=u})),p=t(((e,t)=>{var n=f(),o=i(),s=r(),c=a();function l(e,t,n){if(arguments.length<2&&(n=e,e=null,t=null),this.capacity=n,typeof this.capacity!=`number`||this.capacity<=0)throw Error(`mnemonist/lru-map: capacity should be positive number.`);if(!isFinite(this.capacity)||Math.floor(this.capacity)!==this.capacity)throw Error(`mnemonist/lru-map: capacity should be a finite positive integer.`);var r=s.getPointerArray(n);this.forward=new r(n),this.backward=new r(n),this.K=typeof e==`function`?new e(n):Array(n),this.V=typeof t==`function`?new t(n):Array(n),this.size=0,this.head=0,this.tail=0,this.items=new Map}l.prototype.clear=function(){this.size=0,this.head=0,this.tail=0,this.items.clear()},l.prototype.set=function(e,t){var n=this.items.get(e);if(n!==void 0){this.splayOnTop(n),this.V[n]=t;return}this.size<this.capacity?n=this.size++:(n=this.tail,this.tail=this.backward[n],this.items.delete(this.K[n])),this.items.set(e,n),this.K[n]=e,this.V[n]=t,this.forward[n]=this.head,this.backward[this.head]=n,this.head=n},l.prototype.setpop=function(e,t){var n=null,r=null,i=this.items.get(e);return i===void 0?(this.size<this.capacity?i=this.size++:(i=this.tail,this.tail=this.backward[i],n=this.V[i],r=this.K[i],this.items.delete(r)),this.items.set(e,i),this.K[i]=e,this.V[i]=t,this.forward[i]=this.head,this.backward[this.head]=i,this.head=i,r?{evicted:!0,key:r,value:n}:null):(this.splayOnTop(i),n=this.V[i],this.V[i]=t,{evicted:!1,key:e,value:n})},l.prototype.has=function(e){return this.items.has(e)},l.prototype.get=function(e){var t=this.items.get(e);if(t!==void 0)return this.splayOnTop(t),this.V[t]},l.prototype.peek=function(e){var t=this.items.get(e);if(t!==void 0)return this.V[t]},l.prototype.splayOnTop=n.prototype.splayOnTop,l.prototype.forEach=n.prototype.forEach,l.prototype.keys=n.prototype.keys,l.prototype.values=n.prototype.values,l.prototype.entries=n.prototype.entries,typeof Symbol<`u`&&(l.prototype[Symbol.iterator]=l.prototype.entries),l.prototype.inspect=n.prototype.inspect,l.from=function(e,t,n,r){if(arguments.length<2){if(r=c.guessLength(e),typeof r!=`number`)throw Error(`mnemonist/lru-cache.from: could not guess iterable length. Please provide desired capacity as last argument.`)}else arguments.length===2&&(r=t,t=null,n=null);var i=new l(t,n,r);return o(e,function(e,t){i.set(t,e)}),i},t.exports=l})),m=t(((e,t)=>{var n=p(),o=i(),s=r(),c=a();function l(e,t,r){arguments.length<2?n.call(this,e):n.call(this,e,t,r),this.deleted=new(s.getPointerArray(this.capacity))(this.capacity),this.deletedSize=0}for(var u in n.prototype)l.prototype[u]=n.prototype[u];typeof Symbol<`u`&&(l.prototype[Symbol.iterator]=n.prototype[Symbol.iterator]),l.prototype.clear=function(){n.prototype.clear.call(this),this.deletedSize=0},l.prototype.set=function(e,t){var n=this.items.get(e);if(n!==void 0){this.splayOnTop(n),this.V[n]=t;return}this.size<this.capacity?(n=this.deletedSize>0?this.deleted[--this.deletedSize]:this.size,this.size++):(n=this.tail,this.tail=this.backward[n],this.items.delete(this.K[n])),this.items.set(e,n),this.K[n]=e,this.V[n]=t,this.forward[n]=this.head,this.backward[this.head]=n,this.head=n},l.prototype.setpop=function(e,t){var n=null,r=null,i=this.items.get(e);return i===void 0?(this.size<this.capacity?(i=this.deletedSize>0?this.deleted[--this.deletedSize]:this.size,this.size++):(i=this.tail,this.tail=this.backward[i],n=this.V[i],r=this.K[i],this.items.delete(r)),this.items.set(e,i),this.K[i]=e,this.V[i]=t,this.forward[i]=this.head,this.backward[this.head]=i,this.head=i,r?{evicted:!0,key:r,value:n}:null):(this.splayOnTop(i),n=this.V[i],this.V[i]=t,{evicted:!1,key:e,value:n})},l.prototype.delete=function(e){var t=this.items.get(e);if(t===void 0)return!1;if(this.items.delete(e),this.size===1)return this.size=0,this.head=0,this.tail=0,this.deletedSize=0,!0;var n=this.backward[t],r=this.forward[t];return this.head===t&&(this.head=r),this.tail===t&&(this.tail=n),this.forward[n]=r,this.backward[r]=n,this.size--,this.deleted[this.deletedSize++]=t,!0},l.prototype.remove=function(e,t=void 0){var n=this.items.get(e);if(n===void 0)return t;var r=this.V[n];if(this.items.delete(e),this.size===1)return this.size=0,this.head=0,this.tail=0,this.deletedSize=0,r;var i=this.backward[n],a=this.forward[n];return this.head===n&&(this.head=a),this.tail===n&&(this.tail=i),this.forward[i]=a,this.backward[a]=i,this.size--,this.deleted[this.deletedSize++]=n,r},l.from=function(e,t,n,r){if(arguments.length<2){if(r=c.guessLength(e),typeof r!=`number`)throw Error(`mnemonist/lru-map.from: could not guess iterable length. Please provide desired capacity as last argument.`)}else arguments.length===2&&(r=t,t=null,n=null);var i=new l(t,n,r);return o(e,function(e,t){i.set(t,e)}),i},t.exports=l})),h=t((e=>{e.intersection=function(){if(arguments.length<2)throw Error(`mnemonist/Set.intersection: needs at least two arguments.`);var e=new Set,t=1/0,n=null,r,i,a=arguments.length;for(i=0;i<a;i++){if(r=arguments[i],r.size===0)return e;r.size<t&&(t=r.size,n=r)}for(var o=n.values(),s,c,l,u;s=o.next(),!s.done;){for(c=s.value,l=!0,i=0;i<a;i++)if(u=arguments[i],u!==n&&!u.has(c)){l=!1;break}l&&e.add(c)}return e},e.union=function(){if(arguments.length<2)throw Error(`mnemonist/Set.union: needs at least two arguments.`);var e=new Set,t,n=arguments.length,r,i;for(t=0;t<n;t++)for(r=arguments[t].values();i=r.next(),!i.done;)e.add(i.value);return e},e.difference=function(e,t){if(!e.size)return new Set;if(!t.size)return new Set(e);for(var n=new Set,r=e.values(),i;i=r.next(),!i.done;)t.has(i.value)||n.add(i.value);return n},e.symmetricDifference=function(e,t){for(var n=new Set,r=e.values(),i;i=r.next(),!i.done;)t.has(i.value)||n.add(i.value);for(r=t.values();i=r.next(),!i.done;)e.has(i.value)||n.add(i.value);return n},e.isSubset=function(e,t){var n=e.values(),r;if(e===t)return!0;if(e.size>t.size)return!1;for(;r=n.next(),!r.done;)if(!t.has(r.value))return!1;return!0},e.isSuperset=function(t,n){return e.isSubset(n,t)},e.add=function(e,t){for(var n=t.values(),r;r=n.next(),!r.done;)e.add(r.value)},e.subtract=function(e,t){for(var n=t.values(),r;r=n.next(),!r.done;)e.delete(r.value)},e.intersect=function(e,t){for(var n=e.values(),r;r=n.next(),!r.done;)t.has(r.value)||e.delete(r.value)},e.disjunct=function(e,t){for(var n=e.values(),r,i=[];r=n.next(),!r.done;)t.has(r.value)&&i.push(r.value);for(n=t.values();r=n.next(),!r.done;)e.has(r.value)||e.add(r.value);for(var a=0,o=i.length;a<o;a++)e.delete(i[a])},e.intersectionSize=function(e,t){var n;if(e.size>t.size&&(n=e,e=t,t=n),e.size===0)return 0;if(e===t)return e.size;for(var r=e.values(),i,a=0;i=r.next(),!i.done;)t.has(i.value)&&a++;return a},e.unionSize=function(t,n){var r=e.intersectionSize(t,n);return t.size+n.size-r},e.jaccard=function(t,n){var r=e.intersectionSize(t,n);return r===0?0:r/(t.size+n.size-r)},e.overlap=function(t,n){var r=e.intersectionSize(t,n);return r===0?0:r/Math.min(t.size,n.size)}})),g=t(((e,t)=>{var r=n(),a=i();function o(){this.clear()}o.prototype.clear=function(){this.items=[],this.size=0},o.prototype.push=function(e){return this.items.push(e),++this.size},o.prototype.pop=function(){if(this.size!==0)return this.size--,this.items.pop()},o.prototype.peek=function(){return this.items[this.size-1]},o.prototype.forEach=function(e,t){t=arguments.length>1?t:this;for(var n=0,r=this.items.length;n<r;n++)e.call(t,this.items[r-n-1],n,this)},o.prototype.toArray=function(){for(var e=Array(this.size),t=this.size-1,n=this.size;n--;)e[n]=this.items[t-n];return e},o.prototype.values=function(){var e=this.items,t=e.length,n=0;return new r(function(){if(n>=t)return{done:!0};var r=e[t-n-1];return n++,{value:r,done:!1}})},o.prototype.entries=function(){var e=this.items,t=e.length,n=0;return new r(function(){if(n>=t)return{done:!0};var r=e[t-n-1];return{value:[n++,r],done:!1}})},typeof Symbol<`u`&&(o.prototype[Symbol.iterator]=o.prototype.values),o.prototype.toString=function(){return this.toArray().join(`,`)},o.prototype.toJSON=function(){return this.toArray()},o.prototype.inspect=function(){var e=this.toArray();return Object.defineProperty(e,`constructor`,{value:o,enumerable:!1}),e},typeof Symbol<`u`&&(o.prototype[Symbol.for(`nodejs.util.inspect.custom`)]=o.prototype.inspect),o.from=function(e){var t=new o;return a(e,function(e){t.push(e)}),t},o.of=function(){return o.from(arguments)},t.exports=o}));o();var _=e(s(),1),v=e(c(),1),y=e(l(),1),b=e(u(),1),x=e(d(),1),S=e(p(),1);m();var C=h(),w=e(g(),1);export{b as a,w as c,S as i,v as n,x as o,y as r,C as s,_ as t};
1
+ import{r as e,t}from"../rolldown-runtime.mjs";import{i as n,r}from"./graphology-dag.mjs";var i=t((e=>{e.intersection=function(){if(arguments.length<2)throw Error(`mnemonist/Set.intersection: needs at least two arguments.`);var e=new Set,t=1/0,n=null,r,i,a=arguments.length;for(i=0;i<a;i++){if(r=arguments[i],r.size===0)return e;r.size<t&&(t=r.size,n=r)}for(var o=n.values(),s,c,l,u;s=o.next(),!s.done;){for(c=s.value,l=!0,i=0;i<a;i++)if(u=arguments[i],u!==n&&!u.has(c)){l=!1;break}l&&e.add(c)}return e},e.union=function(){if(arguments.length<2)throw Error(`mnemonist/Set.union: needs at least two arguments.`);var e=new Set,t,n=arguments.length,r,i;for(t=0;t<n;t++)for(r=arguments[t].values();i=r.next(),!i.done;)e.add(i.value);return e},e.difference=function(e,t){if(!e.size)return new Set;if(!t.size)return new Set(e);for(var n=new Set,r=e.values(),i;i=r.next(),!i.done;)t.has(i.value)||n.add(i.value);return n},e.symmetricDifference=function(e,t){for(var n=new Set,r=e.values(),i;i=r.next(),!i.done;)t.has(i.value)||n.add(i.value);for(r=t.values();i=r.next(),!i.done;)e.has(i.value)||n.add(i.value);return n},e.isSubset=function(e,t){var n=e.values(),r;if(e===t)return!0;if(e.size>t.size)return!1;for(;r=n.next(),!r.done;)if(!t.has(r.value))return!1;return!0},e.isSuperset=function(t,n){return e.isSubset(n,t)},e.add=function(e,t){for(var n=t.values(),r;r=n.next(),!r.done;)e.add(r.value)},e.subtract=function(e,t){for(var n=t.values(),r;r=n.next(),!r.done;)e.delete(r.value)},e.intersect=function(e,t){for(var n=e.values(),r;r=n.next(),!r.done;)t.has(r.value)||e.delete(r.value)},e.disjunct=function(e,t){for(var n=e.values(),r,i=[];r=n.next(),!r.done;)t.has(r.value)&&i.push(r.value);for(n=t.values();r=n.next(),!r.done;)e.has(r.value)||e.add(r.value);for(var a=0,o=i.length;a<o;a++)e.delete(i[a])},e.intersectionSize=function(e,t){var n;if(e.size>t.size&&(n=e,e=t,t=n),e.size===0)return 0;if(e===t)return e.size;for(var r=e.values(),i,a=0;i=r.next(),!i.done;)t.has(i.value)&&a++;return a},e.unionSize=function(t,n){var r=e.intersectionSize(t,n);return t.size+n.size-r},e.jaccard=function(t,n){var r=e.intersectionSize(t,n);return r===0?0:r/(t.size+n.size-r)},e.overlap=function(t,n){var r=e.intersectionSize(t,n);return r===0?0:r/Math.min(t.size,n.size)}})),a=t((e=>{var t=function(e,t){return e<t?-1:+(e>t)},n=function(e,t){return e<t?1:e>t?-1:0};function r(e){return function(t,n){return e(n,t)}}function i(e){return e===2?function(e,t){return e[0]<t[0]?-1:e[0]>t[0]?1:e[1]<t[1]?-1:+(e[1]>t[1])}:function(t,n){for(var r=0;r<e;){if(t[r]<n[r])return-1;if(t[r]>n[r])return 1;r++}return 0}}e.DEFAULT_COMPARATOR=t,e.DEFAULT_REVERSE_COMPARATOR=n,e.reverseComparator=r,e.createTupleComparator=i})),o=t(((e,t)=>{var r=a(),i=n(),o=r.DEFAULT_COMPARATOR,s=r.reverseComparator;function c(e){if(this.clear(),this.comparator=e||o,typeof this.comparator!=`function`)throw Error(`mnemonist/FibonacciHeap.constructor: given comparator should be a function.`)}c.prototype.clear=function(){this.root=null,this.min=null,this.size=0};function l(e){return{item:e,degree:0}}function u(e,t){e.root?(t.right=e.root.right,t.left=e.root,e.root.right.left=t,e.root.right=t):e.root=t}c.prototype.push=function(e){var t=l(e);return t.left=t,t.right=t,u(this,t),(!this.min||this.comparator(t.item,this.min.item)<=0)&&(this.min=t),++this.size},c.prototype.peek=function(){return this.min?this.min.item:void 0};function d(e){for(var t=[],n=e,r=!1;!(n===e&&r);)n===e&&(r=!0),t.push(n),n=n.right;return t}function f(e,t){e.root===t&&(e.root=t.right),t.left.right=t.right,t.right.left=t.left}function p(e,t){e.child?(t.right=e.child.right,t.left=e.child,e.child.right.left=t,e.child.right=t):e.child=t}function m(e,t,n){f(e,t),t.left=t,t.right=t,p(n,t),n.degree++,t.parent=n}function h(e){var t=Array(e.size),n=d(e.root),r,i,a,o,s,c;for(r=0,i=n.length;r<i;r++){for(a=n[r],s=a.degree;t[s];)o=t[s],e.comparator(a.item,o.item)>0&&(c=a,a=o,o=c),m(e,o,a),t[s]=null,s++;t[s]=a}for(r=0;r<e.size;r++)t[r]&&e.comparator(t[r].item,e.min.item)<=0&&(e.min=t[r])}c.prototype.pop=function(){if(this.size){var e=this.min;if(e.child){var t=d(e.child),n,r,i;for(r=0,i=t.length;r<i;r++)n=t[r],u(this,n),delete n.parent}return f(this,e),e===e.right?(this.min=null,this.root=null):(this.min=e.right,h(this)),this.size--,e.item}},c.prototype.inspect=function(){var e={size:this.size};return this.min&&`item`in this.min&&(e.top=this.min.item),Object.defineProperty(e,"constructor",{value:c,enumerable:!1}),e},typeof Symbol<`u`&&(c.prototype[Symbol.for(`nodejs.util.inspect.custom`)]=c.prototype.inspect);function g(e){if(this.clear(),this.comparator=e||o,typeof this.comparator!=`function`)throw Error(`mnemonist/FibonacciHeap.constructor: given comparator should be a function.`);this.comparator=s(this.comparator)}g.prototype=c.prototype,c.from=function(e,t){var n=new c(t);return i(e,function(e){n.push(e)}),n},g.from=function(e,t){var n=new g(t);return i(e,function(e){n.push(e)}),n},c.MinFibonacciHeap=c,c.MaxFibonacciHeap=g,t.exports=c})),s=t((e=>{var t=2**8-1,n=2**16-1,r=2**32-1,i=2**7-1,a=2**15-1,o=2**31-1;e.getPointerArray=function(e){var i=e-1;if(i<=t)return Uint8Array;if(i<=n)return Uint16Array;if(i<=r)return Uint32Array;throw Error(`mnemonist: Pointer Array of size > 4294967295 is not supported.`)},e.getSignedPointerArray=function(e){var t=e-1;return t<=i?Int8Array:t<=a?Int16Array:t<=o?Int32Array:Float64Array},e.getNumberType=function(e){return e===(e|0)?Math.sign(e)===-1?e<=127&&e>=-128?Int8Array:e<=32767&&e>=-32768?Int16Array:Int32Array:e<=255?Uint8Array:e<=65535?Uint16Array:Uint32Array:Float64Array};var s={Uint8Array:1,Int8Array:2,Uint16Array:3,Int16Array:4,Uint32Array:5,Int32Array:6,Float32Array:7,Float64Array:8};e.getMinimalRepresentation=function(t,n){var r=null,i=0,a,o,c,l,u;for(l=0,u=t.length;l<u;l++)c=n?n(t[l]):t[l],o=e.getNumberType(c),a=s[o.name],a>i&&(i=a,r=o);return r},e.isTypedArray=function(e){return typeof ArrayBuffer<`u`&&ArrayBuffer.isView(e)},e.concat=function(){var e=0,t,n,r;for(t=0,r=arguments.length;t<r;t++)e+=arguments[t].length;var i=new arguments[0].constructor(e);for(t=0,n=0;t<r;t++)i.set(arguments[t],n),n+=arguments[t].length;return i},e.indices=function(t){for(var n=new(e.getPointerArray(t))(t),r=0;r<t;r++)n[r]=r;return n}})),c=t((e=>{var t=n(),r=s();function i(e){return Array.isArray(e)||r.isTypedArray(e)}function a(e){if(typeof e.length==`number`)return e.length;if(typeof e.size==`number`)return e.size}function o(e){var n=a(e),r=typeof n==`number`?Array(n):[],i=0;return t(e,function(e){r[i++]=e}),r}function c(e){var n=a(e),i=typeof n==`number`?r.getPointerArray(n):Array,o=typeof n==`number`?Array(n):[],s=typeof n==`number`?new i(n):[],c=0;return t(e,function(e){o[c]=e,s[c]=c++}),[o,s]}e.isArrayLike=i,e.guessLength=a,e.toArray=o,e.toArrayWithIndices=c})),l=t(((e,t)=>{var r=n(),i=a(),o=c(),s=i.DEFAULT_COMPARATOR,l=i.reverseComparator;function u(e,t,n,r){for(var i=t[r],a,o;r>n;){if(a=r-1>>1,o=t[a],e(i,o)<0){t[r]=o,r=a;continue}break}t[r]=i}function d(e,t,n){for(var r=t.length,i=n,a=t[n],o=2*n+1,s;o<r;)s=o+1,s<r&&e(t[o],t[s])>=0&&(o=s),t[n]=t[o],n=o,o=2*n+1;t[n]=a,u(e,t,i,n)}function f(e,t,n){t.push(n),u(e,t,0,t.length-1)}function p(e,t){var n=t.pop();if(t.length!==0){var r=t[0];return t[0]=n,d(e,t,0),r}return n}function m(e,t,n){if(t.length===0)throw Error(`mnemonist/heap.replace: cannot pop an empty heap.`);var r=t[0];return t[0]=n,d(e,t,0),r}function h(e,t,n){var r;return t.length!==0&&e(t[0],n)<0&&(r=t[0],t[0]=n,n=r,d(e,t,0)),n}function g(e,t){for(var n=t.length>>1;--n>=0;)d(e,t,n)}function _(e,t){for(var n=t.length,r=0,i=Array(n);r<n;)i[r++]=p(e,t);return i}function v(e,t,n){arguments.length===2&&(n=t,t=e,e=s);var i=l(e),a,c,u,d=1/0,f;if(t===1){if(o.isArrayLike(n)){for(a=0,c=n.length;a<c;a++)u=n[a],(d===1/0||e(u,d)<0)&&(d=u);return f=new n.constructor(1),f[0]=d,f}return r(n,function(t){(d===1/0||e(t,d)<0)&&(d=t)}),[d]}if(o.isArrayLike(n)){if(t>=n.length)return n.slice().sort(e);for(f=n.slice(0,t),g(i,f),a=t,c=n.length;a<c;a++)i(n[a],f[0])>0&&m(i,f,n[a]);return f.sort(e)}var p=o.guessLength(n);return p!==null&&p<t&&(t=p),f=Array(t),a=0,r(n,function(e){a<t?f[a]=e:(a===t&&g(i,f),i(e,f[0])>0&&m(i,f,e)),a++}),f.length>a&&(f.length=a),f.sort(e)}function y(e,t,n){arguments.length===2&&(n=t,t=e,e=s);var i=l(e),a,c,u,d=-1/0,f;if(t===1){if(o.isArrayLike(n)){for(a=0,c=n.length;a<c;a++)u=n[a],(d===-1/0||e(u,d)>0)&&(d=u);return f=new n.constructor(1),f[0]=d,f}return r(n,function(t){(d===-1/0||e(t,d)>0)&&(d=t)}),[d]}if(o.isArrayLike(n)){if(t>=n.length)return n.slice().sort(i);for(f=n.slice(0,t),g(e,f),a=t,c=n.length;a<c;a++)e(n[a],f[0])>0&&m(e,f,n[a]);return f.sort(i)}var p=o.guessLength(n);return p!==null&&p<t&&(t=p),f=Array(t),a=0,r(n,function(n){a<t?f[a]=n:(a===t&&g(e,f),e(n,f[0])>0&&m(e,f,n)),a++}),f.length>a&&(f.length=a),f.sort(i)}function b(e){if(this.clear(),this.comparator=e||s,typeof this.comparator!=`function`)throw Error(`mnemonist/Heap.constructor: given comparator should be a function.`)}b.prototype.clear=function(){this.items=[],this.size=0},b.prototype.push=function(e){return f(this.comparator,this.items,e),++this.size},b.prototype.peek=function(){return this.items[0]},b.prototype.pop=function(){return this.size!==0&&this.size--,p(this.comparator,this.items)},b.prototype.replace=function(e){return m(this.comparator,this.items,e)},b.prototype.pushpop=function(e){return h(this.comparator,this.items,e)},b.prototype.consume=function(){return this.size=0,_(this.comparator,this.items)},b.prototype.toArray=function(){return _(this.comparator,this.items.slice())},b.prototype.inspect=function(){var e=this.toArray();return Object.defineProperty(e,"constructor",{value:b,enumerable:!1}),e},typeof Symbol<`u`&&(b.prototype[Symbol.for(`nodejs.util.inspect.custom`)]=b.prototype.inspect);function x(e){if(this.clear(),this.comparator=e||s,typeof this.comparator!=`function`)throw Error(`mnemonist/MaxHeap.constructor: given comparator should be a function.`);this.comparator=l(this.comparator)}x.prototype=b.prototype,b.from=function(e,t){var n=new b(t),r=o.isArrayLike(e)?e.slice():o.toArray(e);return g(n.comparator,r),n.items=r,n.size=r.length,n},x.from=function(e,t){var n=new x(t),r=o.isArrayLike(e)?e.slice():o.toArray(e);return g(n.comparator,r),n.items=r,n.size=r.length,n},b.siftUp=d,b.siftDown=u,b.push=f,b.pop=p,b.replace=m,b.pushpop=h,b.heapify=g,b.consume=_,b.nsmallest=v,b.nlargest=y,b.MinHeap=b,b.MaxHeap=x,t.exports=b})),u=t(((e,t)=>{var n=``;function r(e,t,n){for(var r=t.length,i=[],a=r,o=-1,s,c=0,l;a--;)o=Math.max(e[t[a]+n],o);for(l=o>>24&&32||o>>16&&24||o>>8&&16||8;c<l;c+=4){for(a=16;a--;)i[a]=[];for(a=r;a--;)i[e[t[a]+n]>>c&15].push(t[a]);for(s=0;s<16;s++)for(o=i[s].length;o--;)t[++a]=i[s][o]}}function i(e,t,n,r){return e[n]-e[r]||(n%3==2?e[n+1]-e[r+1]||t[n+2]-t[r+2]:t[n+1]-t[r+1])}function a(e,t){var n=[],o=[],s=2*t/3|0,c=t-s,l=s+1>>1,u=s,d=0,f,p=[],m=[];if(t===1)return[0];for(;u--;)n[u]=(u*3>>1)+1;for(u=3;u--;)r(e,n,u);for(d=o[(n[0]/3|0)+(n[0]%3==1?0:l)]=1,u=1;u<s;u++)(e[n[u]]!==e[n[u-1]]||e[n[u]+1]!==e[n[u-1]+1]||e[n[u]+2]!==e[n[u-1]+2])&&d++,o[(n[u]/3|0)+(n[u]%3==1?0:l)]=d;if(d<s)for(o=a(o,s),u=s;u--;)n[u]=o[u]<l?o[u]*3+1:(o[u]-l)*3+2;for(u=s;u--;)p[n[u]]=u;for(p[t]=-1,p[t+1]=-2,o=t%3==1?[t-1]:[],u=0;u<s;u++)n[u]%3==1&&o.push(n[u]-1);for(r(e,o,0),u=0,d=0,f=0;u<s&&d<c;)m[f++]=i(e,p,n[u],o[d])<0?n[u++]:o[d++];for(;u<s;)m[f++]=n[u++];for(;d<c;)m[f++]=o[d++];return m}function o(e){var t=e.length,n=t%3,r=Array(t+n),i,a;if(typeof e!=`string`){var o=Object.create(null);for(a=0;a<t;a++)o[e[a]]||(o[e[a]]=!0);var s=Object.create(null),c=Object.keys(o).sort();for(a=0,i=c.length;a<i;a++)s[c[a]]=a+1;for(a=0;a<t;a++)r[a]=s[e[a]]}else for(a=0;a<t;a++)r[a]=e.charCodeAt(a);for(a=t;a<t+n;a++)r[a]=0;return r}function s(e){this.hasArbitrarySequence=typeof e!=`string`,this.string=e,this.length=e.length,this.array=a(o(e),this.length)}s.prototype.toString=function(){return this.array.join(`,`)},s.prototype.toJSON=function(){return this.array},s.prototype.inspect=function(){for(var e=Array(this.length),t=0;t<this.length;t++)e[t]=this.string.slice(this.array[t]);return Object.defineProperty(e,"constructor",{value:s,enumerable:!1}),e},typeof Symbol<`u`&&(s.prototype[Symbol.for(`nodejs.util.inspect.custom`)]=s.prototype.inspect);function c(e){if(this.hasArbitrarySequence=typeof e[0]!=`string`,this.size=e.length,this.hasArbitrarySequence){this.text=[];for(var t=0,r=this.size;t<r;t++)this.text.push.apply(this.text,e[t]),t<r-1&&this.text.push(n)}else this.text=e.join(n);this.firstLength=e[0].length,this.length=this.text.length,this.array=a(o(this.text),this.length)}c.prototype.longestCommonSubsequence=function(){var e=this.hasArbitrarySequence?[]:``,t,n,r,i,a;for(n=1;n<this.length;n++)if(i=this.array[n],a=this.array[n-1],!(i<this.firstLength&&a<this.firstLength)&&!(i>this.firstLength&&a>this.firstLength)){for(t=Math.min(this.length-i,this.length-a),r=0;r<t;r++)if(this.text[i+r]!==this.text[a+r]){t=r;break}t>e.length&&(e=this.text.slice(i,i+t))}return e},c.prototype.toString=function(){return this.array.join(`,`)},c.prototype.toJSON=function(){return this.array},c.prototype.inspect=function(){for(var e=Array(this.length),t=0;t<this.length;t++)e[t]=this.text.slice(this.array[t]);return Object.defineProperty(e,"constructor",{value:c,enumerable:!1}),e},typeof Symbol<`u`&&(c.prototype[Symbol.for(`nodejs.util.inspect.custom`)]=c.prototype.inspect),s.GeneralizedSuffixArray=c,t.exports=s})),d=t(((e,t)=>{var i=r(),a=n(),o=c(),l=s(),u=function(e){return Math.max(1,Math.ceil(e*1.5))},d=function(e){return new(l.getPointerArray(e))(e)};function f(e,t){if(arguments.length<1)throw Error(`mnemonist/vector: expecting at least a byte array constructor.`);var n=t||0,r=u,i=0,a=!1;typeof t==`object`&&(n=t.initialCapacity||0,i=t.initialLength||0,r=t.policy||r,a=t.factory===!0),this.factory=a?e:null,this.ArrayClass=e,this.length=i,this.capacity=Math.max(i,n),this.policy=r,this.array=new e(this.capacity)}f.prototype.set=function(e,t){if(this.length<e)throw Error(`Vector(`+this.ArrayClass.name+`).set: index out of bounds.`);return this.array[e]=t,this},f.prototype.get=function(e){if(!(this.length<e))return this.array[e]},f.prototype.applyPolicy=function(e){var t=this.policy(e||this.capacity);if(typeof t!=`number`||t<0)throw Error(`mnemonist/vector.applyPolicy: policy returned an invalid value (expecting a positive integer).`);if(t<=this.capacity)throw Error(`mnemonist/vector.applyPolicy: policy returned a less or equal capacity to allocate.`);return t},f.prototype.reallocate=function(e){if(e===this.capacity)return this;var t=this.array;if(e<this.length&&(this.length=e),e>this.capacity)if(this.factory===null?this.array=new this.ArrayClass(e):this.array=this.factory(e),l.isTypedArray(this.array))this.array.set(t,0);else for(var n=0,r=this.length;n<r;n++)this.array[n]=t[n];else this.array=t.slice(0,e);return this.capacity=e,this},f.prototype.grow=function(e){var t;if(typeof e==`number`){if(this.capacity>=e)return this;for(t=this.capacity;t<e;)t=this.applyPolicy(t);return this.reallocate(t),this}return t=this.applyPolicy(),this.reallocate(t),this},f.prototype.resize=function(e){return e===this.length?this:e<this.length?(this.length=e,this):(this.length=e,this.reallocate(e),this)},f.prototype.push=function(e){return this.capacity===this.length&&this.grow(),this.array[this.length++]=e,this.length},f.prototype.pop=function(){if(this.length!==0)return this.array[--this.length]},f.prototype.values=function(){var e=this.array,t=this.length,n=0;return new i(function(){if(n>=t)return{done:!0};var r=e[n];return n++,{value:r,done:!1}})},f.prototype.entries=function(){var e=this.array,t=this.length,n=0;return new i(function(){if(n>=t)return{done:!0};var r=e[n];return{value:[n++,r],done:!1}})},typeof Symbol<`u`&&(f.prototype[Symbol.iterator]=f.prototype.values),f.prototype.inspect=function(){var e=this.array.slice(0,this.length);return e.type=this.array.constructor.name,e.items=this.length,e.capacity=this.capacity,Object.defineProperty(e,"constructor",{value:f,enumerable:!1}),e},typeof Symbol<`u`&&(f.prototype[Symbol.for(`nodejs.util.inspect.custom`)]=f.prototype.inspect),f.from=function(e,t,n){if(arguments.length<3&&(n=o.guessLength(e),typeof n!=`number`))throw Error(`mnemonist/vector.from: could not guess iterable length. Please provide desired capacity as last argument.`);var r=new f(t,n);return a(e,function(e){r.push(e)}),r};function p(e){var t=function(t){f.call(this,e,t)};for(var n in f.prototype)f.prototype.hasOwnProperty(n)&&(t.prototype[n]=f.prototype[n]);return t.from=function(t,n){return f.from(t,e,n)},typeof Symbol<`u`&&(t.prototype[Symbol.iterator]=t.prototype.values),t}f.Int8Vector=p(Int8Array),f.Uint8Vector=p(Uint8Array),f.Uint8ClampedVector=p(Uint8ClampedArray),f.Int16Vector=p(Int16Array),f.Uint16Vector=p(Uint16Array),f.Int32Vector=p(Int32Array),f.Uint32Vector=p(Uint32Array),f.Float32Vector=p(Float32Array),f.Float64Vector=p(Float64Array),f.PointerVector=p(d),t.exports=f})),f=t(((e,t)=>{var r=n();function i(e){this.size=0,this.items=new Map,this.inverse=e}function a(){this.size=0,this.items=new Map,this.inverse=new i(this)}function o(){this.size=0,this.items.clear(),this.inverse.items.clear()}a.prototype.clear=o,i.prototype.clear=o;function s(e,t){if(this.items.has(e)){var n=this.items.get(e);if(n===t)return this;this.inverse.items.delete(n)}if(this.inverse.items.has(t)){var r=this.inverse.items.get(t);if(r===e)return this;this.items.delete(r)}return this.items.set(e,t),this.inverse.items.set(t,e),this.size=this.items.size,this.inverse.size=this.inverse.items.size,this}a.prototype.set=s,i.prototype.set=s;function c(e){if(this.items.has(e)){var t=this.items.get(e);return this.items.delete(e),this.inverse.items.delete(t),this.size=this.items.size,this.inverse.size=this.inverse.items.size,!0}return!1}a.prototype.delete=c,i.prototype.delete=c,[`has`,`get`,`forEach`,`keys`,`values`,`entries`].forEach(function(e){a.prototype[e]=i.prototype[e]=function(){return Map.prototype[e].apply(this.items,arguments)}}),typeof Symbol<`u`&&(a.prototype[Symbol.iterator]=a.prototype.entries,i.prototype[Symbol.iterator]=i.prototype.entries),a.prototype.inspect=function(){var e={left:this.items,right:this.inverse.items};return Object.defineProperty(e,"constructor",{value:a,enumerable:!1}),e},typeof Symbol<`u`&&(a.prototype[Symbol.for(`nodejs.util.inspect.custom`)]=a.prototype.inspect),i.prototype.inspect=function(){var e={left:this.inverse.items,right:this.items};return Object.defineProperty(e,"constructor",{value:i,enumerable:!1}),e},typeof Symbol<`u`&&(i.prototype[Symbol.for(`nodejs.util.inspect.custom`)]=i.prototype.inspect),a.from=function(e){var t=new a;return r(e,function(e,n){t.set(n,e)}),t},t.exports=a})),p=t((e=>{function t(e){return e|=e>>1,e|=e>>2,e|=e>>4,e|=e>>8,e|=e>>16,e&~(e>>1)}e.msb32=t;function n(e){return e|=e>>1,e|=e>>2,e|=e>>4,e&~(e>>1)}e.msb8=n,e.test=function(e,t){return e>>t&1},e.criticalBit8=function(e,t){return n(e^t)},e.criticalBit8Mask=function(e,t){return~n(e^t)>>>0&255},e.testCriticalBit8=function(e,t){return 1+(e|t)>>8},e.criticalBit32Mask=function(e,n){return~t(e^n)>>>0&4294967295},e.popcount=function(e){return e-=e>>1&1431655765,e=(e&858993459)+(e>>2&858993459),e=e+(e>>4)&252645135,e+=e>>8,e+=e>>16,e&127};for(var r=new Uint8Array(2**8),i=0,a=r.length;i<a;i++)r[i]=e.popcount(i);e.table8Popcount=function(e){return r[e&255]+r[e>>8&255]+r[e>>16&255]+r[e>>24&255]}})),m=t(((e,t)=>{var n=r(),i=p();function a(e){this.length=e,this.clear()}a.prototype.clear=function(){this.size=0,this.array=new Uint32Array(Math.ceil(this.length/32))},a.prototype.set=function(e,t){var n=e>>5,r=e&31,i=this.array[n],a=t===0||t===!1?this.array[n]&=~(1<<r):this.array[n]|=1<<r;return a>>>=0,a>i?this.size++:a<i&&this.size--,this},a.prototype.reset=function(e){var t=e>>5,n=e&31,r=this.array[t];return(this.array[t]&=~(1<<n))<r&&this.size--,this},a.prototype.flip=function(e){var t=e>>5,n=e&31,r=this.array[t],i=this.array[t]^=1<<n;return i>>>=0,i>r?this.size++:i<r&&this.size--,this},a.prototype.get=function(e){var t=e>>5,n=e&31;return this.array[t]>>n&1},a.prototype.test=function(e){return!!this.get(e)},a.prototype.rank=function(e){if(this.size===0)return 0;for(var t=e>>5,n=e&31,r=0,a=0;a<t;a++)r+=i.table8Popcount(this.array[a]);var o=this.array[t]&(1<<n)-1;return r+=i.table8Popcount(o),r},a.prototype.select=function(e){if(this.size===0||e>=this.length)return-1;for(var t,n=32,r=0,i=0,a=0,o=this.array.length;a<o;a++)if(t=this.array[a],t!==0){a===o-1&&(n=this.length%32||32);for(var s=0;s<n;s++,r++)if(i+=t>>s&1,i===e)return r}},a.prototype.forEach=function(e,t){t=arguments.length>1?t:this;for(var n=this.length,r,i,a=32,o=0,s=this.array.length;o<s;o++){r=this.array[o],o===s-1&&(a=n%32||32);for(var c=0;c<a;c++)i=r>>c&1,e.call(t,i,o*32+c)}},a.prototype.values=function(){var e=this.length,t=!1,r,i,a=this.array,o=a.length,s=0,c=-1,l=32;return new n(function n(){if(!t){if(s>=o)return{done:!0};s===o-1&&(l=e%32||32),r=a[s++],t=!0,c=-1}return c++,c>=l?(t=!1,n()):(i=r>>c&1,{value:i})})},a.prototype.entries=function(){var e=this.length,t=!1,r,i,a=this.array,o,s=a.length,c=0,l=-1,u=32;return new n(function n(){if(!t){if(c>=s)return{done:!0};c===s-1&&(u=e%32||32),r=a[c++],t=!0,l=-1}return l++,o=~-c*32+l,l>=u?(t=!1,n()):(i=r>>l&1,{value:[o,i]})})},typeof Symbol<`u`&&(a.prototype[Symbol.iterator]=a.prototype.values),a.prototype.inspect=function(){var e=new Uint8Array(this.length);return this.forEach(function(t,n){e[n]=t}),Object.defineProperty(e,"constructor",{value:a,enumerable:!1}),e},typeof Symbol<`u`&&(a.prototype[Symbol.for(`nodejs.util.inspect.custom`)]=a.prototype.inspect),a.prototype.toJSON=function(){return Array.from(this.array)},t.exports=a})),h=t(((e,t)=>{var n=r(),i=p(),a=function(e){return Math.max(1,Math.ceil(e*1.5))};function o(e){return new Uint32Array(Math.ceil(e/32))}function s(e){var t=e||0,n=a;typeof e==`object`&&(t=e.initialLength||e.initialCapacity||0,n=e.policy||n),this.size=0,this.length=t,this.capacity=Math.ceil(this.length/32)*32,this.policy=n,this.array=o(this.capacity)}s.prototype.set=function(e,t){if(this.length<e)throw Error(`BitVector.set: index out of bounds.`);var n=e>>5,r=e&31,i=this.array[n],a=t===0||t===!1?this.array[n]&=~(1<<r):this.array[n]|=1<<r;return a>>>=0,a>i?this.size++:a<i&&this.size--,this},s.prototype.reset=function(e){var t=e>>5,n=e&31,r=this.array[t];return(this.array[t]&=~(1<<n))<r&&this.size--,this},s.prototype.flip=function(e){var t=e>>5,n=e&31,r=this.array[t],i=this.array[t]^=1<<n;return i>>>=0,i>r?this.size++:i<r&&this.size--,this},s.prototype.applyPolicy=function(e){var t=this.policy(e||this.capacity);if(typeof t!=`number`||t<0)throw Error(`mnemonist/bit-vector.applyPolicy: policy returned an invalid value (expecting a positive integer).`);if(t<=this.capacity)throw Error(`mnemonist/bit-vector.applyPolicy: policy returned a less or equal capacity to allocate.`);return Math.ceil(t/32)*32},s.prototype.reallocate=function(e){var t=e;if(e=Math.ceil(e/32)*32,t<this.length&&(this.length=t),e===this.capacity)return this;var n=this.array,r=e/32;return r===this.array.length?this:(r>this.array.length?(this.array=new Uint32Array(r),this.array.set(n,0)):this.array=n.slice(0,r),this.capacity=e,this)},s.prototype.grow=function(e){var t;if(typeof e==`number`){if(this.capacity>=e)return this;for(t=this.capacity;t<e;)t=this.applyPolicy(t);return this.reallocate(t),this}return t=this.applyPolicy(),this.reallocate(t),this},s.prototype.resize=function(e){return e===this.length?this:e<this.length?(this.length=e,this):(this.length=e,this.reallocate(e),this)},s.prototype.push=function(e){if(this.capacity===this.length&&this.grow(),e===0||e===!1)return++this.length;this.size++;var t=this.length++,n=t>>5,r=t&31;return this.array[n]|=1<<r,this.length},s.prototype.pop=function(){if(this.length!==0){var e=--this.length,t=e>>5,n=e&31;return this.array[t]>>n&1}},s.prototype.get=function(e){if(!(this.length<e)){var t=e>>5,n=e&31;return this.array[t]>>n&1}},s.prototype.test=function(e){return this.length<e?!1:!!this.get(e)},s.prototype.rank=function(e){if(this.size===0)return 0;for(var t=e>>5,n=e&31,r=0,a=0;a<t;a++)r+=i.table8Popcount(this.array[a]);var o=this.array[t]&(1<<n)-1;return r+=i.table8Popcount(o),r},s.prototype.select=function(e){if(this.size===0||e>=this.length)return-1;for(var t,n=32,r=0,i=0,a=0,o=this.array.length;a<o;a++)if(t=this.array[a],t!==0){a===o-1&&(n=this.length%32||32);for(var s=0;s<n;s++,r++)if(i+=t>>s&1,i===e)return r}},s.prototype.forEach=function(e,t){t=arguments.length>1?t:this;for(var n=this.length,r,i,a=32,o=0,s=this.array.length;o<s;o++){r=this.array[o],o===s-1&&(a=n%32||32);for(var c=0;c<a;c++)i=r>>c&1,e.call(t,i,o*32+c)}},s.prototype.values=function(){var e=this.length,t=!1,r,i,a=this.array,o=a.length,s=0,c=-1,l=32;return new n(function n(){if(!t){if(s>=o)return{done:!0};s===o-1&&(l=e%32||32),r=a[s++],t=!0,c=-1}return c++,c>=l?(t=!1,n()):(i=r>>c&1,{value:i})})},s.prototype.entries=function(){var e=this.length,t=!1,r,i,a=this.array,o,s=a.length,c=0,l=-1,u=32;return new n(function n(){if(!t){if(c>=s)return{done:!0};c===s-1&&(u=e%32||32),r=a[c++],t=!0,l=-1}return l++,o=~-c*32+l,l>=u?(t=!1,n()):(i=r>>l&1,{value:[o,i]})})},typeof Symbol<`u`&&(s.prototype[Symbol.iterator]=s.prototype.values),s.prototype.inspect=function(){var e=new Uint8Array(this.length);return this.forEach(function(t,n){e[n]=t}),Object.defineProperty(e,"constructor",{value:s,enumerable:!1}),e},typeof Symbol<`u`&&(s.prototype[Symbol.for(`nodejs.util.inspect.custom`)]=s.prototype.inspect),s.prototype.toJSON=function(){return Array.from(this.array.slice(0,(this.length>>5)+1))},t.exports=s})),g=t(((e,t)=>{function n(e,t){return(e&65535)*t+(((e>>>16)*t&65535)<<16)&4294967295}function r(e,t){return(e&65535)+(t>>>16)+(((e>>>16)+t&65535)<<16)&4294967295}function i(e,t){return e<<t|e>>>32-t}t.exports=function e(t,a){var o=3432918353,s=461845907,c=15,l=13,u=5,d=1801774676,f=t,p,m,h;for(m=0,h=a.length-4;m<=h;m+=4)p=a[m]|a[m+1]<<8|a[m+2]<<16|a[m+3]<<24,p=n(p,o),p=i(p,c),p=n(p,s),f^=p,f=i(f,l),f=n(f,u),f=r(f,d);switch(p=0,a.length&3){case 3:p^=a[m+2]<<16;case 2:p^=a[m+1]<<8;case 1:p^=a[m],p=n(p,o),p=i(p,c),p=n(p,s),f^=p;default:}return f^=a.length,f^=f>>>16,f=n(f,2246822507),f^=f>>>13,f=n(f,3266489909),f^=f>>>16,f>>>0}})),_=t(((e,t)=>{var r=g(),i=n(),a=Math.LN2*Math.LN2,o={errorRate:.005};function s(e){var t=new Uint16Array(e.length),n,r;for(n=0,r=e.length;n<r;n++)t[n]=e.charCodeAt(n);return t}function c(e,t,n){return r(t*4221880213&4294967295,n)%(e*8)}function l(e){var t={};if(!e)throw Error(`mnemonist/BloomFilter.constructor: a BloomFilter must be created with a capacity.`);if(typeof e==`object`?t=e:t.capacity=e,typeof t.capacity!=`number`||t.capacity<=0)throw Error("mnemonist/BloomFilter.constructor: `capacity` option should be a positive integer.");if(this.capacity=t.capacity,this.errorRate=t.errorRate||o.errorRate,typeof this.errorRate!=`number`||t.errorRate<=0)throw Error("mnemonist/BloomFilter.constructor: `errorRate` option should be a positive float.");this.clear()}l.prototype.clear=function(){var e=-1/a*this.capacity*Math.log(this.errorRate)/8|0;this.hashFunctions=e*8/this.capacity*Math.LN2|0,this.data=new Uint8Array(e)},l.prototype.add=function(e){for(var t=s(e),n=0,r=this.hashFunctions;n<r;n++){var i=c(this.data.length,n,t),a=1<<(7&i);this.data[i>>3]|=a}return this},l.prototype.test=function(e){for(var t=s(e),n=0,r=this.hashFunctions;n<r;n++){var i=c(this.data.length,n,t);if(!(this.data[i>>3]&1<<(7&i)))return!1}return!0},l.prototype.toJSON=function(){return this.data},l.from=function(e,t){if(!t&&(t=e.length||e.size,typeof t!=`number`))throw Error(`BloomFilter.from: could not infer the filter's capacity. Try passing it as second argument.`);var n=new l(t);return i(e,function(e){n.add(e)}),n},t.exports=l})),v=t(((e,t)=>{var r=n();function i(e){if(typeof e!=`function`)throw Error("mnemonist/BKTree.constructor: given `distance` should be a function.");this.distance=e,this.clear()}i.prototype.add=function(e){if(!this.root)return this.root={item:e,children:{}},this.size++,this;for(var t=this.root,n;n=this.distance(e,t.item),t.children[n];)t=t.children[n];return t.children[n]={item:e,children:{}},this.size++,this},i.prototype.search=function(e,t){if(!this.root)return[];for(var n=[],r=[this.root],i,a,o,s,c;r.length;)for(i=r.pop(),o=this.distance(t,i.item),o<=e&&n.push({item:i.item,distance:o}),s=o-e,c=o+e+1;s<c;s++)a=i.children[s],a&&r.push(a);return n},i.prototype.clear=function(){this.size=0,this.root=null},i.prototype.toJSON=function(){return this.root},i.prototype.inspect=function(){for(var e=[],t=[this.root],n,r;t.length;)if(n=t.pop(),n)for(r in e.push(n.item),n.children)t.push(n.children[r]);return 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){var n=new i(t);return r(e,function(e){n.add(e)}),n},t.exports=i})),y=t(((e,t)=>{var n=c(),i=r();function a(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()}a.prototype.clear=function(){this.start=0,this.size=0},a.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},a.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},a.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]}},a.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]}},a.prototype.peekFirst=function(){if(this.size!==0)return this.items[this.start]},a.prototype.peekLast=function(){if(this.size!==0){var e=this.start+this.size-1;return e>=this.capacity&&(e-=this.capacity),this.items[e]}},a.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]},a.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)},a.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},a.prototype.values=function(){var e=this.items,t=this.capacity,n=this.size,r=this.start,a=0;return new i(function(){if(a>=n)return{done:!0};var i=e[r];return r++,a++,r===t&&(r=0),{value:i,done:!1}})},a.prototype.entries=function(){var e=this.items,t=this.capacity,n=this.size,r=this.start,a=0;return new i(function(){if(a>=n)return{done:!0};var i=e[r];return r++,r===t&&(r=0),{value:[a++,i],done:!1}})},typeof Symbol<`u`&&(a.prototype[Symbol.iterator]=a.prototype.values),a.prototype.inspect=function(){var e=this.toArray();return e.type=this.ArrayClass.name,e.capacity=this.capacity,Object.defineProperty(e,"constructor",{value:a,enumerable:!1}),e},typeof Symbol<`u`&&(a.prototype[Symbol.for(`nodejs.util.inspect.custom`)]=a.prototype.inspect),a.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 i=new a(t,r);if(n.isArrayLike(e)){var o,s;for(o=0,s=e.length;o<s;o++)i.items[o]=e[o];return i.size=s,i}return n.forEach(e,function(e){i.push(e)}),i},t.exports=a})),b=t(((e,t)=>{var n=c(),r=y();function i(e,t){if(arguments.length<2)throw Error(`mnemonist/circular-buffer: expecting an Array class and a capacity.`);if(typeof t!=`number`||t<=0)throw Error("mnemonist/circular-buffer: `capacity` should be a positive number.");this.ArrayClass=e,this.capacity=t,this.items=new e(this.capacity),this.clear()}function a(e){i.prototype[e]=r.prototype[e]}Object.keys(r.prototype).forEach(a),typeof Symbol<`u`&&Object.getOwnPropertySymbols(r.prototype).forEach(a),i.prototype.push=function(e){var t=this.start+this.size;return t>=this.capacity&&(t-=this.capacity),this.items[t]=e,this.size===this.capacity?(t++,t>=this.capacity?this.start=0:this.start=t,this.size):++this.size},i.prototype.unshift=function(e){var t=this.start-1;return this.start===0&&(t=this.capacity-1),this.items[t]=e,this.size===this.capacity?(this.start=t,this.size):(this.start=t,++this.size)},i.from=function(e,t,r){if(arguments.length<3&&(r=n.guessLength(e),typeof r!=`number`))throw Error(`mnemonist/circular-buffer.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})),x=t(((e,t)=>{function n(e){if(typeof e!=`function`)throw Error(`mnemonist/DefaultMap.constructor: expecting a function.`);this.items=new Map,this.factory=e,this.size=0}n.prototype.clear=function(){this.items.clear(),this.size=0},n.prototype.get=function(e){var t=this.items.get(e);return t===void 0&&(t=this.factory(e,this.size),this.items.set(e,t),this.size++),t},n.prototype.peek=function(e){return this.items.get(e)},n.prototype.set=function(e,t){return this.items.set(e,t),this.size=this.items.size,this},n.prototype.has=function(e){return this.items.has(e)},n.prototype.delete=function(e){var t=this.items.delete(e);return this.size=this.items.size,t},n.prototype.forEach=function(e,t){t=arguments.length>1?t:this,this.items.forEach(e,t)},n.prototype.entries=function(){return this.items.entries()},n.prototype.keys=function(){return this.items.keys()},n.prototype.values=function(){return this.items.values()},typeof Symbol<`u`&&(n.prototype[Symbol.iterator]=n.prototype.entries),n.prototype.inspect=function(){return this.items},typeof Symbol<`u`&&(n.prototype[Symbol.for(`nodejs.util.inspect.custom`)]=n.prototype.inspect),n.autoIncrement=function(){var e=0;return function(){return e++}},t.exports=n})),S=t(((e,t)=>{function n(e){if(typeof e!=`function`)throw Error(`mnemonist/DefaultWeakMap.constructor: expecting a function.`);this.items=new WeakMap,this.factory=e}n.prototype.clear=function(){this.items=new WeakMap},n.prototype.get=function(e){var t=this.items.get(e);return t===void 0&&(t=this.factory(e),this.items.set(e,t)),t},n.prototype.peek=function(e){return this.items.get(e)},n.prototype.set=function(e,t){return this.items.set(e,t),this},n.prototype.has=function(e){return this.items.has(e)},n.prototype.delete=function(e){return this.items.delete(e)},n.prototype.inspect=function(){return this.items},typeof Symbol<`u`&&(n.prototype[Symbol.for(`nodejs.util.inspect.custom`)]=n.prototype.inspect),t.exports=n})),C=t(((e,t)=>{var n=s();function r(e){var t=n.getPointerArray(e),r=n.getPointerArray(Math.log2(e));this.size=e,this.dimension=e,this.parents=new t(e),this.ranks=new r(e);for(var i=0;i<e;i++)this.parents[i]=i}r.prototype.find=function(e){for(var t=e,n,r;n=this.parents[t],t!==n;)t=n;for(;r=this.parents[e],r!==t;)this.parents[e]=t,e=r;return t},r.prototype.union=function(e,t){var n=this.find(e),r=this.find(t);if(n===r)return this;this.dimension--;var i=this.ranks[e],a=this.ranks[t];return i<a?this.parents[n]=r:i>a?this.parents[r]=n:(this.parents[r]=n,this.ranks[n]++),this},r.prototype.connected=function(e,t){return this.find(e)===this.find(t)},r.prototype.mapping=function(){for(var e=n.getPointerArray(this.dimension),t={},r=new e(this.size),i=0,a,o=0,s=this.parents.length;o<s;o++)a=this.find(o),t[a]===void 0?(r[o]=i,t[a]=i++):r[o]=t[a];return r},r.prototype.compile=function(){for(var e={},t=Array(this.dimension),n=0,r,i=0,a=this.parents.length;i<a;i++)r=this.find(i),e[r]===void 0?(t[n]=[i],e[r]=n++):t[e[r]].push(i);return t},r.prototype.inspect=function(){var e=this.compile();return Object.defineProperty(e,"constructor",{value:r,enumerable:!1}),e},typeof Symbol<`u`&&(r.prototype[Symbol.for(`nodejs.util.inspect.custom`)]=r.prototype.inspect),t.exports=r})),w=t(((e,t)=>{var n=a(),r=l(),i=n.DEFAULT_COMPARATOR,o=n.reverseComparator;function s(e,t,n,i){for(var a=n,o=i,s=t[i],c=2*i+1,l;c<a;)l=c+1,l<a&&e(t[c],t[l])>=0&&(c=l),t[i]=t[c],i=c,c=2*i+1;t[i]=s,r.siftDown(e,t,o,i)}function c(e,t,n,r){for(var i=r,a=new e(r),o,c;i>0;)o=n[--i],i!==0&&(c=n[0],n[0]=o,s(t,n,--r,0),o=c),a[i]=o;return a}function u(e,t,n){if(arguments.length===2&&(n=t,t=null),this.ArrayClass=e,this.capacity=n,this.items=new e(n),this.clear(),this.comparator=t||i,typeof n!=`number`&&n<=0)throw Error(`mnemonist/FixedReverseHeap.constructor: capacity should be a number > 0.`);if(typeof this.comparator!=`function`)throw Error(`mnemonist/FixedReverseHeap.constructor: given comparator should be a function.`);this.comparator=o(this.comparator)}u.prototype.clear=function(){this.size=0},u.prototype.push=function(e){return this.size<this.capacity?(this.items[this.size]=e,r.siftDown(this.comparator,this.items,0,this.size),this.size++):this.comparator(e,this.items[0])>0&&r.replace(this.comparator,this.items,e),this.size},u.prototype.peek=function(){return this.items[0]},u.prototype.consume=function(){var e=c(this.ArrayClass,this.comparator,this.items,this.size);return this.size=0,e},u.prototype.toArray=function(){return c(this.ArrayClass,this.comparator,this.items.slice(0,this.size),this.size)},u.prototype.inspect=function(){var e=this.toArray();return Object.defineProperty(e,"constructor",{value:u,enumerable:!1}),e},typeof Symbol<`u`&&(u.prototype[Symbol.for(`nodejs.util.inspect.custom`)]=u.prototype.inspect),t.exports=u})),T=t(((e,t)=>{var r=n(),i=function(e){return e};function a(e){if(this.items=new Map,this.clear(),Array.isArray(e)?(this.writeHashFunction=e[0],this.readHashFunction=e[1]):(this.writeHashFunction=e,this.readHashFunction=e),this.writeHashFunction||=i,this.readHashFunction||=i,typeof this.writeHashFunction!=`function`||typeof this.readHashFunction!=`function`)throw Error(`mnemonist/FuzzyMap.constructor: invalid hash function given.`)}a.prototype.clear=function(){this.items.clear(),this.size=0},a.prototype.add=function(e){var t=this.writeHashFunction(e);return this.items.set(t,e),this.size=this.items.size,this},a.prototype.set=function(e,t){return e=this.writeHashFunction(e),this.items.set(e,t),this.size=this.items.size,this},a.prototype.get=function(e){return e=this.readHashFunction(e),this.items.get(e)},a.prototype.has=function(e){return e=this.readHashFunction(e),this.items.has(e)},a.prototype.forEach=function(e,t){t=arguments.length>1?t:this,this.items.forEach(function(n){e.call(t,n,n)})},a.prototype.values=function(){return this.items.values()},typeof Symbol<`u`&&(a.prototype[Symbol.iterator]=a.prototype.values),a.prototype.inspect=function(){var e=Array.from(this.items.values());return Object.defineProperty(e,"constructor",{value:a,enumerable:!1}),e},typeof Symbol<`u`&&(a.prototype[Symbol.for(`nodejs.util.inspect.custom`)]=a.prototype.inspect),a.from=function(e,t,n){var i=new a(t);return r(e,function(e,t){n?i.set(t,e):i.add(e)}),i},t.exports=a})),E=t(((e,t)=>{var i=r(),a=n();function o(e){this.Container=e||Array,this.items=new Map,this.clear(),Object.defineProperty(this.items,"constructor",{value:o,enumerable:!1})}o.prototype.clear=function(){this.size=0,this.dimension=0,this.items.clear()},o.prototype.set=function(e,t){var n=this.items.get(e),r;return n||(this.dimension++,n=new this.Container,this.items.set(e,n)),this.Container===Set?(r=n.size,n.add(t),r<n.size&&this.size++):(n.push(t),this.size++),this},o.prototype.delete=function(e){var t=this.items.get(e);return t?(this.size-=this.Container===Set?t.size:t.length,this.dimension--,this.items.delete(e),!0):!1},o.prototype.remove=function(e,t){var n=this.items.get(e),r,i;return n?this.Container===Set?(r=n.delete(t),r&&this.size--,n.size===0&&(this.items.delete(e),this.dimension--),r):(i=n.indexOf(t),i===-1?!1:(this.size--,n.length===1?(this.items.delete(e),this.dimension--,!0):(n.splice(i,1),!0))):!1},o.prototype.has=function(e){return this.items.has(e)},o.prototype.get=function(e){return this.items.get(e)},o.prototype.multiplicity=function(e){var t=this.items.get(e);return t===void 0?0:this.Container===Set?t.size:t.length},o.prototype.count=o.prototype.multiplicity,o.prototype.forEach=function(e,t){t=arguments.length>1?t:this;var n;function r(r){e.call(t,r,n)}this.items.forEach(function(e,t){n=t,e.forEach(r)})},o.prototype.forEachAssociation=function(e,t){t=arguments.length>1?t:this,this.items.forEach(e,t)},o.prototype.keys=function(){return this.items.keys()},o.prototype.values=function(){var e=this.items.values(),t=!1,n,r,a,o;return this.Container===Set?new i(function i(){if(!t){if(r=e.next(),r.done)return{done:!0};t=!0,n=r.value.values()}return r=n.next(),r.done?(t=!1,i()):{done:!1,value:r.value}}):new i(function i(){if(!t){if(r=e.next(),r.done)return{done:!0};t=!0,n=r.value,a=0,o=n.length}return a>=o?(t=!1,i()):{done:!1,value:n[a++]}})},o.prototype.entries=function(){var e=this.items.entries(),t=!1,n,r,a,o,s;return this.Container===Set?new i(function i(){if(!t){if(r=e.next(),r.done)return{done:!0};t=!0,a=r.value[0],n=r.value[1].values()}return r=n.next(),r.done?(t=!1,i()):{done:!1,value:[a,r.value]}}):new i(function i(){if(!t){if(r=e.next(),r.done)return{done:!0};t=!0,a=r.value[0],n=r.value[1],o=0,s=n.length}return o>=s?(t=!1,i()):{done:!1,value:[a,n[o++]]}})},o.prototype.containers=function(){return this.items.values()},o.prototype.associations=function(){return this.items.entries()},typeof Symbol<`u`&&(o.prototype[Symbol.iterator]=o.prototype.entries),o.prototype.inspect=function(){return this.items},typeof Symbol<`u`&&(o.prototype[Symbol.for(`nodejs.util.inspect.custom`)]=o.prototype.inspect),o.prototype.toJSON=function(){return this.items},o.from=function(e,t){var n=new o(t);return a(e,function(e,t){n.set(t,e)}),n},t.exports=o})),D=t(((e,t)=>{var r=E(),i=n(),a=function(e){return e};function o(e,t){if(this.items=new r(t),this.clear(),Array.isArray(e)?(this.writeHashFunction=e[0],this.readHashFunction=e[1]):(this.writeHashFunction=e,this.readHashFunction=e),this.writeHashFunction||=a,this.readHashFunction||=a,typeof this.writeHashFunction!=`function`||typeof this.readHashFunction!=`function`)throw Error(`mnemonist/FuzzyMultiMap.constructor: invalid hash function given.`)}o.prototype.clear=function(){this.items.clear(),this.size=0,this.dimension=0},o.prototype.add=function(e){var t=this.writeHashFunction(e);return this.items.set(t,e),this.size=this.items.size,this.dimension=this.items.dimension,this},o.prototype.set=function(e,t){return e=this.writeHashFunction(e),this.items.set(e,t),this.size=this.items.size,this.dimension=this.items.dimension,this},o.prototype.get=function(e){return e=this.readHashFunction(e),this.items.get(e)},o.prototype.has=function(e){return e=this.readHashFunction(e),this.items.has(e)},o.prototype.forEach=function(e,t){t=arguments.length>1?t:this,this.items.forEach(function(n){e.call(t,n,n)})},o.prototype.values=function(){return this.items.values()},typeof Symbol<`u`&&(o.prototype[Symbol.iterator]=o.prototype.values),o.prototype.inspect=function(){var e=Array.from(this);return Object.defineProperty(e,"constructor",{value:o,enumerable:!1}),e},typeof Symbol<`u`&&(o.prototype[Symbol.for(`nodejs.util.inspect.custom`)]=o.prototype.inspect),o.from=function(e,t,n,r){arguments.length===3&&typeof n==`boolean`&&(r=n,n=Array);var a=new o(t,n);return i(e,function(e,t){r?a.set(t,e):a.add(e)}),a},t.exports=o})),ee=t(((e,t)=>{var n=1024;function r(e){return(e&e-1)==0}function i(e,t){if(arguments.length<1)throw Error(`mnemonist/hashed-array-tree: expecting at least a byte array constructor.`);var i=t||0,a=n,o=0;if(typeof t==`object`&&(i=t.initialCapacity||0,o=t.initialLength||0,a=t.blockSize||n),!a||!r(a))throw Error(`mnemonist/hashed-array-tree: block size should be a power of two.`);var s=Math.ceil(Math.max(o,i)/a);this.ArrayClass=e,this.length=o,this.capacity=s*a,this.blockSize=a,this.offsetMask=a-1,this.blockMask=Math.log2(a),this.blocks=Array(s);for(var c=0;c<s;c++)this.blocks[c]=new this.ArrayClass(this.blockSize)}i.prototype.set=function(e,t){if(this.length<e)throw Error(`HashedArrayTree(`+this.ArrayClass.name+`).set: index out of bounds.`);var n=e>>this.blockMask,r=e&this.offsetMask;return this.blocks[n][r]=t,this},i.prototype.get=function(e){if(!(this.length<e)){var t=e>>this.blockMask,n=e&this.offsetMask;return this.blocks[t][n]}},i.prototype.grow=function(e){if(typeof e!=`number`&&(e=this.capacity+this.blockSize),this.capacity>=e)return this;for(;this.capacity<e;)this.blocks.push(new this.ArrayClass(this.blockSize)),this.capacity+=this.blockSize;return this},i.prototype.resize=function(e){return e===this.length?this:e<this.length?(this.length=e,this):(this.length=e,this.grow(e),this)},i.prototype.push=function(e){this.capacity===this.length&&this.grow();var t=this.length,n=t>>this.blockMask,r=t&this.offsetMask;return this.blocks[n][r]=e,++this.length},i.prototype.pop=function(){if(this.length!==0)return this.blocks[this.blocks.length-1][--this.length&this.offsetMask]},i.prototype.inspect=function(){for(var e=new this.ArrayClass(this.length),t,n=0,r=this.length;n<r;n++)t=n>>this.blockMask,e[n]=this.blocks[t][n&this.offsetMask];return e.type=this.ArrayClass.name,e.items=this.length,e.capacity=this.capacity,e.blockSize=this.blockSize,Object.defineProperty(e,"constructor",{value:i,enumerable:!1}),e},typeof Symbol<`u`&&(i.prototype[Symbol.for(`nodejs.util.inspect.custom`)]=i.prototype.inspect),t.exports=i})),O=t(((e,t)=>{var n=r(),i=c();function a(e,t){if(arguments.length<2)throw Error(`mnemonist/fixed-stack: expecting an Array class and a capacity.`);if(typeof t!=`number`||t<=0)throw Error("mnemonist/fixed-stack: `capacity` should be a positive number.");this.capacity=t,this.ArrayClass=e,this.items=new this.ArrayClass(this.capacity),this.clear()}a.prototype.clear=function(){this.size=0},a.prototype.push=function(e){if(this.size===this.capacity)throw Error(`mnemonist/fixed-stack.push: stack capacity (`+this.capacity+`) exceeded!`);return this.items[this.size++]=e,this.size},a.prototype.pop=function(){if(this.size!==0)return this.items[--this.size]},a.prototype.peek=function(){return this.items[this.size-1]},a.prototype.forEach=function(e,t){t=arguments.length>1?t:this;for(var n=0,r=this.items.length;n<r;n++)e.call(t,this.items[r-n-1],n,this)},a.prototype.toArray=function(){for(var e=new this.ArrayClass(this.size),t=this.size-1,n=this.size;n--;)e[n]=this.items[t-n];return e},a.prototype.values=function(){var e=this.items,t=this.size,r=0;return new n(function(){if(r>=t)return{done:!0};var n=e[t-r-1];return r++,{value:n,done:!1}})},a.prototype.entries=function(){var e=this.items,t=this.size,r=0;return new n(function(){if(r>=t)return{done:!0};var n=e[t-r-1];return{value:[r++,n],done:!1}})},typeof Symbol<`u`&&(a.prototype[Symbol.iterator]=a.prototype.values),a.prototype.toString=function(){return this.toArray().join(`,`)},a.prototype.toJSON=function(){return this.toArray()},a.prototype.inspect=function(){var e=this.toArray();return e.type=this.ArrayClass.name,e.capacity=this.capacity,Object.defineProperty(e,"constructor",{value:a,enumerable:!1}),e},typeof Symbol<`u`&&(a.prototype[Symbol.for(`nodejs.util.inspect.custom`)]=a.prototype.inspect),a.from=function(e,t,n){if(arguments.length<3&&(n=i.guessLength(e),typeof n!=`number`))throw Error(`mnemonist/fixed-stack.from: could not guess iterable length. Please provide desired capacity as last argument.`);var r=new a(t,n);if(i.isArrayLike(e)){var o,s;for(o=0,s=e.length;o<s;o++)r.items[o]=e[o];return r.size=s,r}return i.forEach(e,function(e){r.push(e)}),r},t.exports=a})),k=t(((e,t)=>{var n=c(),r=s(),i=O();function a(e,t,n,r,i,o,s,c){var l=s+(c-s)/2|0,u=~-l,d=-~l,f=n[l];r[o]=f+1;var p=t?t(e[f]):e[f][1],m=o*2+1,h=o*2+2,g=-1/0,_=-1/0;s<=u&&(g=a(e,t,n,r,i,m,s,u)),d<=c&&(_=a(e,t,n,r,i,h,d,c));var v=Math.max(p,g,_),y=f;return v===g?y=i[r[m]-1]:v===_&&(y=i[r[h]-1]),i[f]=y,v}function o(e,t){this.size=e.length,this.intervals=e;var n=null,o=null;Array.isArray(t)&&(n=t[0],o=t[1]);var s=e.length,c=r.getPointerArray(s+1),l=new c(s),u;for(u=1;u<s;u++)l[u]=u;l.sort(function(t,r){return t=e[t],r=e[r],n?(t=n(t),r=n(r)):(t=t[0],r=r[0]),t<r?-1:+(t>r)});var d=Math.ceil(Math.log2(s+1)),f=new c(2**d-1),p=new c(s);a(e,o,l,f,p,0,0,s-1),l=null,this.height=d,this.tree=f,this.augmentations=p,this.startGetter=n,this.endGetter=o,this.stack=new i(c,this.height)}o.prototype.intervalsContainingPoint=function(e){var t=[],n=this.stack;n.clear(),n.push(0);for(var r=this.tree.length,i,a,o,s,c,l,u,d,f;n.size;)i=n.pop(),a=this.tree[i]-1,o=this.intervals[a],s=this.intervals[this.augmentations[a]],u=this.endGetter?this.endGetter(s):s[1],!(e>u)&&(d=i*2+1,d<r&&this.tree[d]!==0&&n.push(d),c=this.startGetter?this.startGetter(o):o[0],l=this.endGetter?this.endGetter(o):o[1],e>=c&&e<=l&&t.push(o),!(e<c)&&(f=i*2+2,f<r&&this.tree[f]!==0&&n.push(f)));return t},o.prototype.intervalsOverlappingInterval=function(e){var t=this.startGetter?this.startGetter(e):e[0],n=this.endGetter?this.endGetter(e):e[1],r=[],i=this.stack;i.clear(),i.push(0);for(var a=this.tree.length,o,s,c,l,u,d,f,p,m;i.size;)o=i.pop(),s=this.tree[o]-1,c=this.intervals[s],l=this.intervals[this.augmentations[s]],f=this.endGetter?this.endGetter(l):l[1],!(t>f)&&(p=o*2+1,p<a&&this.tree[p]!==0&&i.push(p),u=this.startGetter?this.startGetter(c):c[0],d=this.endGetter?this.endGetter(c):c[1],n>=u&&t<=d&&r.push(c),!(n<u)&&(m=o*2+2,m<a&&this.tree[m]!==0&&i.push(m)));return r},o.prototype.inspect=function(){var e=this.intervals.slice();return Object.defineProperty(e,"constructor",{value:o,enumerable:!1}),e},typeof Symbol<`u`&&(o.prototype[Symbol.for(`nodejs.util.inspect.custom`)]=o.prototype.inspect),o.from=function(e,t){return n.isArrayLike(e)?new o(e,t):new o(Array.from(e),t)},t.exports=o})),A=t((e=>{e.search=function(e,t,n,r){var i=0;n=n===void 0?0:n,r=r===void 0?e.length:r,r--;for(var a;n<=r;)if(i=n+r>>>1,a=e[i],a>t)r=~-i;else if(a<t)n=-~i;else return i;return-1},e.searchWithComparator=function(e,t,n){for(var r=0,i=0,a=~-t.length,o;i<=a;)if(r=i+a>>>1,o=e(t[r],n),o>0)a=~-r;else if(o<0)i=-~r;else return r;return-1},e.lowerBound=function(e,t,n,r){var i=0;for(n=n===void 0?0:n,r=r===void 0?e.length:r;n<r;)i=n+r>>>1,t<=e[i]?r=i:n=-~i;return n},e.lowerBoundWithComparator=function(e,t,n){for(var r=0,i=0,a=t.length;i<a;)r=i+a>>>1,e(n,t[r])<=0?a=r:i=-~r;return i},e.lowerBoundIndices=function(e,t,n,r,i){var a=0;for(r=r===void 0?0:r,i=i===void 0?e.length:i;r<i;)a=r+i>>>1,n<=e[t[a]]?i=a:r=-~a;return r},e.upperBound=function(e,t,n,r){var i=0;for(n=n===void 0?0:n,r=r===void 0?e.length:r;n<r;)i=n+r>>>1,t>=e[i]?n=-~i:r=i;return n},e.upperBoundWithComparator=function(e,t,n){for(var r=0,i=0,a=t.length;i<a;)r=i+a>>>1,e(n,t[r])>=0?i=-~r:a=r;return i}})),j=t((e=>{var t=s(),n=c().isArrayLike,r=A(),i=o();function a(e,n){if(e.length===0)return n.slice();if(n.length===0)return e.slice();var r;e[0]>n[0]&&(r=e,e=n,n=r);var i=e[e.length-1],a=n[0];if(i<=a)return t.isTypedArray(e)?t.concat(e,n):e.concat(n);var o=new e.constructor(e.length+n.length),s,c,l;for(s=0,c=e.length;s<c&&(l=e[s],l<=a);s++)o[s]=l;for(var u=s,d=e.length,f=0,p=n.length,m,h;u<d&&f<p;)m=e[u],h=n[f],m<=h?(o[s++]=m,u++):(o[s++]=h,f++);for(;u<d;)o[s++]=e[u++];for(;f<p;)o[s++]=n[f++];return o}function l(e,n){if(e.length===0)return n.slice();if(n.length===0)return e.slice();var r;e[0]>n[0]&&(r=e,e=n,n=r);var i=e[e.length-1],a=n[0];if(i<a)return t.isTypedArray(e)?t.concat(e,n):e.concat(n);var o=new e.constructor,s,c,l;for(s=0,c=e.length;s<c&&(l=e[s],l<a);s++)o.push(l);for(var u=s,d=e.length,f=0,p=n.length,m,h;u<d&&f<p;)m=e[u],h=n[f],m<=h?((o.length===0||o[o.length-1]!==m)&&o.push(m),u++):((o.length===0||o[o.length-1]!==h)&&o.push(h),f++);for(;u<d;)m=e[u++],(o.length===0||o[o.length-1]!==m)&&o.push(m);for(;f<p;)h=n[f++],(o.length===0||o[o.length-1]!==h)&&o.push(h);return o}e.intersectionUniqueArrays=function(e,t){if(e.length===0||t.length===0)return new e.constructor(0);var n;e[0]>t[0]&&(n=e,e=t,t=n);var i=e[e.length-1],a=t[0];if(i<a)return new e.constructor(0);for(var o=new e.constructor,s=r.lowerBound(e,a),c=e.length,l=0,u=r.upperBound(t,i),d,f;s<c&&l<u;)d=e[s],f=t[l],d<f?s=r.lowerBound(e,f,s+1):d>f?l=r.lowerBound(t,d,l+1):(o.push(d),s++,l++);return o};function u(e){var n=0,r=-1/0,o,s,c,l=[];for(s=0,c=e.length;s<c;s++)o=e[s].length,o!==0&&(l.push(e[s]),n+=o,o>r&&(r=o));if(l.length===0)return new e[0].constructor(0);if(l.length===1)return l[0].slice();if(l.length===2)return a(l[0],l[1]);e=l;var u=new e[0].constructor(n),d=new(t.getPointerArray(r))(e.length),f=new i(function(t,n){return t=e[t][d[t]],n=e[n][d[n]],t<n?-1:+(t>n)});for(s=0;s<c;s++)f.push(s);s=0;for(var p,m;f.size;)p=f.pop(),m=e[p][d[p]++],u[s++]=m,d[p]<e[p].length&&f.push(p);return u}function d(e){var n=-1/0,r,a,o,s=[];for(a=0,o=e.length;a<o;a++)r=e[a].length,r!==0&&(s.push(e[a]),r>n&&(n=r));if(s.length===0)return new e[0].constructor(0);if(s.length===1)return s[0].slice();if(s.length===2)return l(s[0],s[1]);e=s;var c=new e[0].constructor,u=new(t.getPointerArray(n))(e.length),d=new i(function(t,n){return t=e[t][u[t]],n=e[n][u[n]],t<n?-1:+(t>n)});for(a=0;a<o;a++)d.push(a);for(var f,p;d.size;)f=d.pop(),p=e[f][u[f]++],(c.length===0||c[c.length-1]!==p)&&c.push(p),u[f]<e[f].length&&d.push(f);return c}e.kWayIntersectionUniqueArrays=function(e){var t=-1/0,n=-1/0,i=1/0,a,o,s,c,l;for(c=0,l=e.length;c<l;c++){if(s=e[c].length,s===0)return[];s>t&&(t=s),a=e[c][0],o=e[c][s-1],a>n&&(n=a),o<i&&(i=o)}if(n>i)return[];if(n===i)return[n];var u,d,f=e[0],p,m,h,g,_,v,y=n;for(c=1;c<l;c++){for(u=f,d=e[c],f=[],p=0,m=r.lowerBound(d,y),h=u.length,g=d.length;p<h&&m<g;)_=u[p],v=d[m],_<v?p=r.lowerBound(u,v,p+1):_>v?m=r.lowerBound(d,_,m+1):(f.push(_),p++,m++);if(f.length===0)return f;y=f[0]}return f},e.merge=function(){if(arguments.length===2){if(n(arguments[0]))return a(arguments[0],arguments[1])}else if(n(arguments[0]))return u(arguments);return null},e.unionUnique=function(){if(arguments.length===2){if(n(arguments[0]))return l(arguments[0],arguments[1])}else if(n(arguments[0]))return d(arguments);return null},e.intersectionUnique=function(){if(arguments.length===2){if(n(arguments[0]))return e.intersectionUniqueArrays(arguments[0],arguments[1])}else if(n(arguments[0]))return e.kWayIntersectionUniqueArrays(arguments);return null}})),te=t(((e,t)=>{var i=r(),a=n(),o=j();function s(e){return e}function c(e){if(this.clear(),Array.isArray(e)?(this.documentTokenizer=e[0],this.queryTokenizer=e[1]):(this.documentTokenizer=e,this.queryTokenizer=e),this.documentTokenizer||=s,this.queryTokenizer||=s,typeof this.documentTokenizer!=`function`)throw Error(`mnemonist/InvertedIndex.constructor: document tokenizer is not a function.`);if(typeof this.queryTokenizer!=`function`)throw Error(`mnemonist/InvertedIndex.constructor: query tokenizer is not a function.`)}c.prototype.clear=function(){this.items=[],this.mapping=new Map,this.size=0,this.dimension=0},c.prototype.add=function(e){this.size++;var t=this.items.length;this.items.push(e);var n=this.documentTokenizer(e);if(!Array.isArray(n))throw Error(`mnemonist/InvertedIndex.add: tokenizer function should return an array of tokens.`);for(var r=new Set,i,a,o=0,s=n.length;o<s;o++)i=n[o],!r.has(i)&&(r.add(i),a=this.mapping.get(i),a||(a=[],this.mapping.set(i,a)),a.push(t));return this.dimension=this.mapping.size,this},c.prototype.get=function(e){if(!this.size)return[];var t=this.queryTokenizer(e);if(!Array.isArray(t))throw Error(`mnemonist/InvertedIndex.query: tokenizer function should return an array of tokens.`);if(!t.length)return[];var n=this.mapping.get(t[0]),r,i,a;if(n===void 0||n.length===0)return[];if(t.length>1)for(i=1,a=t.length;i<a;i++){if(r=this.mapping.get(t[i]),r===void 0||r.length===0)return[];n=o.intersectionUniqueArrays(n,r)}var s=Array(n.length);for(i=0,a=s.length;i<a;i++)s[i]=this.items[n[i]];return s},c.prototype.forEach=function(e,t){t=arguments.length>1?t:this;for(var n=0,r=this.documents.length;n<r;n++)e.call(t,this.documents[n],n,this)},c.prototype.documents=function(){var e=this.items,t=e.length,n=0;return new i(function(){return n>=t?{done:!0}:{value:e[n++],done:!1}})},c.prototype.tokens=function(){return this.mapping.keys()},typeof Symbol<`u`&&(c.prototype[Symbol.iterator]=c.prototype.documents),c.prototype.inspect=function(){var e=this.items.slice();return Object.defineProperty(e,"constructor",{value:c,enumerable:!1}),e},typeof Symbol<`u`&&(c.prototype[Symbol.for(`nodejs.util.inspect.custom`)]=c.prototype.inspect),c.from=function(e,t){var n=new c(t);return a(e,function(e){n.add(e)}),n},t.exports=c})),M=t((e=>{var t=new Float64Array(64),n=new Float64Array(64);function r(e,r,i){var a,o,s,c,l;for(t[0]=r,n[0]=i,o=0;o>=0;)if(s=t[o],c=n[o]-1,s<c){for(a=e[s];s<c;){for(;e[c]>=a&&s<c;)c--;for(s<c&&(e[s++]=e[c]);e[s]<=a&&s<c;)s++;s<c&&(e[c--]=e[s])}e[s]=a,t[o+1]=s+1,n[o+1]=n[o],n[o++]=s,n[o]-t[o]>n[o-1]-t[o-1]&&(l=t[o],t[o]=t[o-1],t[o-1]=l,l=n[o],n[o]=n[o-1],n[o-1]=l)}else o--;return e}e.inplaceQuickSort=r;function i(e,r,i,a){var o,s,c,l,u,d;for(t[0]=i,n[0]=a,s=0;s>=0;)if(c=t[s],l=n[s]-1,c<l){for(u=r[c],o=e[u];c<l;){for(;e[r[l]]>=o&&c<l;)l--;for(c<l&&(r[c++]=r[l]);e[r[c]]<=o&&c<l;)c++;c<l&&(r[l--]=r[c])}r[c]=u,t[s+1]=c+1,n[s+1]=n[s],n[s++]=c,n[s]-t[s]>n[s-1]-t[s-1]&&(d=t[s],t[s]=t[s-1],t[s-1]=d,d=n[s],n[s]=n[s-1],n[s-1]=d)}else s--;return r}e.inplaceQuickSortIndices=i})),ne=t(((e,t)=>{var n=c(),r=s(),i=a().createTupleComparator,o=w(),l=M().inplaceQuickSortIndices;function u(e,t,n,r){var i,a=0,o;for(i=0;i<e;i++)o=t[i][n]-r[i],a+=o*o;return a}function d(e,t){var n=t.length,i=Array(e),a=Array(n),o,s=new(r.getPointerArray(n))(n),c,l,u,d=!0;for(c=0;c<e;c++){for(o=new Float64Array(n),l=0;l<n;l++)u=t[l],o[l]=u[1][c],d&&(a[l]=u[0],s[l]=l);d=!1,i[c]=o}return{axes:i,ids:s,labels:a}}function f(e,t,n,i){for(var a=i.length,o=r.getPointerArray(a+1),s=new o(a),c=new o(a),u=new o(a),d=[[0,0,n.length,-1,0]],f,p,m,h,g,_,v,y,b=0;d.length!==0;)f=d.pop(),y=f[0],_=f[1],v=f[2],p=f[3],m=f[4],l(t[y],n,_,v),a=v-_,h=_+(a>>>1),g=n[h],s[b]=g,p>-1&&(m===0?c[p]=b+1:u[p]=b+1),y=(y+1)%e,h!==_&&h!==v-1&&d.push([y,h+1,v,b,1]),h!==_&&d.push([y,_,h,b,0]),b++;return{axes:t,labels:i,pivots:s,lefts:c,rights:u}}function p(e,t){this.dimensions=e,this.visited=0,this.axes=t.axes,this.labels=t.labels,this.pivots=t.pivots,this.lefts=t.lefts,this.rights=t.rights,this.size=this.labels.length}p.prototype.nearestNeighbor=function(e){var t=1/0,n=null,r=this.dimensions,i=this.axes,a=this.pivots,o=this.lefts,s=this.rights,c=0;function l(d,f){c++;var p=o[f],m=s[f],h=a[f],g=u(r,i,h,e);if(!(g<t&&(n=h,t=g,g===0))){var _=i[d][h]-e[d];d=(d+1)%r,_>0?p!==0&&l(d,p-1):m!==0&&l(d,m-1),_*_<t&&(_>0?m!==0&&l(d,m-1):p!==0&&l(d,p-1))}}return l(0,0),this.visited=c,this.labels[n]};var m=i(3),h=i(2);p.prototype.kNearestNeighbors=function(e,t){if(e<=0)throw Error(`mnemonist/kd-tree.kNearestNeighbors: k should be a positive number.`);if(e=Math.min(e,this.size),e===1)return[this.nearestNeighbor(t)];var n=new o(Array,m,e),r=this.dimensions,i=this.axes,a=this.pivots,s=this.lefts,c=this.rights,l=0;function d(o,f){var p=s[f],m=c[f],h=a[f],g=u(r,i,h,t);n.push([g,l++,h]);var _=t[o],v=i[o][h],y=_-v;o=(o+1)%r,_<v?p!==0&&d(o,p-1):m!==0&&d(o,m-1),(y*y<n.peek()[0]||n.size<e)&&(_<v?m!==0&&d(o,m-1):p!==0&&d(o,p-1))}d(0,0),this.visited=l;for(var f=n.consume(),p=0;p<f.length;p++)f[p]=this.labels[f[p][2]];return f},p.prototype.linearKNearestNeighbors=function(e,t){if(e<=0)throw Error(`mnemonist/kd-tree.kNearestNeighbors: k should be a positive number.`);e=Math.min(e,this.size);var n=new o(Array,h,e),r,i,a;for(r=0,i=this.size;r<i;r++)a=u(this.dimensions,this.axes,this.pivots[r],t),n.push([a,r]);var s=n.consume();for(r=0;r<s.length;r++)s[r]=this.labels[this.pivots[s[r][1]]];return s},p.prototype.inspect=function(){var e=new Map;e.dimensions=this.dimensions,Object.defineProperty(e,"constructor",{value:p,enumerable:!1});var t,n,r;for(t=0;t<this.size;t++){for(r=Array(this.dimensions),n=0;n<this.dimensions;n++)r[n]=this.axes[n][t];e.set(this.labels[t],r)}return e},typeof Symbol<`u`&&(p.prototype[Symbol.for(`nodejs.util.inspect.custom`)]=p.prototype.inspect),p.from=function(e,t){var r=d(t,n.toArray(e));return new p(t,f(t,r.axes,r.ids,r.labels))},p.fromAxes=function(e,t){t||=r.indices(e[0].length);var n=e.length;return new p(n,f(e.length,e,r.indices(t.length),t))},t.exports=p})),N=t(((e,t)=>{var i=r(),a=n();function o(){this.clear()}o.prototype.clear=function(){this.head=null,this.tail=null,this.size=0},o.prototype.first=function(){return this.head?this.head.item:void 0},o.prototype.peek=o.prototype.first,o.prototype.last=function(){return this.tail?this.tail.item:void 0},o.prototype.push=function(e){var t={item:e,next:null};return this.head?(this.tail.next=t,this.tail=t):(this.head=t,this.tail=t),this.size++,this.size},o.prototype.unshift=function(e){var t={item:e,next:null};return this.head?(this.head.next||(this.tail=this.head),t.next=this.head,this.head=t):(this.head=t,this.tail=t),this.size++,this.size},o.prototype.shift=function(){if(this.size){var e=this.head;return this.head=e.next,this.size--,e.item}},o.prototype.forEach=function(e,t){if(this.size){t=arguments.length>1?t:this;for(var n=this.head,r=0;n;)e.call(t,n.item,r,this),n=n.next,r++}},o.prototype.toArray=function(){if(!this.size)return[];for(var e=Array(this.size),t=0,n=this.size,r=this.head;t<n;t++)e[t]=r.item,r=r.next;return e},o.prototype.values=function(){var e=this.head;return new i(function(){if(!e)return{done:!0};var t=e.item;return e=e.next,{value:t,done:!1}})},o.prototype.entries=function(){var e=this.head,t=0;return new i(function(){if(!e)return{done:!0};var n=e.item;return e=e.next,t++,{value:[t-1,n],done:!1}})},typeof Symbol<`u`&&(o.prototype[Symbol.iterator]=o.prototype.values),o.prototype.toString=function(){return this.toArray().join(`,`)},o.prototype.toJSON=function(){return this.toArray()},o.prototype.inspect=function(){var e=this.toArray();return Object.defineProperty(e,"constructor",{value:o,enumerable:!1}),e},typeof Symbol<`u`&&(o.prototype[Symbol.for(`nodejs.util.inspect.custom`)]=o.prototype.inspect),o.from=function(e){var t=new o;return a(e,function(e){t.push(e)}),t},t.exports=o})),P=t(((e,t)=>{var i=r(),a=n(),o=s(),l=c();function u(e,t,n){if(arguments.length<2&&(n=e,e=null,t=null),this.capacity=n,typeof this.capacity!=`number`||this.capacity<=0)throw Error(`mnemonist/lru-cache: capacity should be positive number.`);if(!isFinite(this.capacity)||Math.floor(this.capacity)!==this.capacity)throw Error(`mnemonist/lru-cache: capacity should be a finite positive integer.`);var r=o.getPointerArray(n);this.forward=new r(n),this.backward=new r(n),this.K=typeof e==`function`?new e(n):Array(n),this.V=typeof t==`function`?new t(n):Array(n),this.size=0,this.head=0,this.tail=0,this.items={}}u.prototype.clear=function(){this.size=0,this.head=0,this.tail=0,this.items={}},u.prototype.splayOnTop=function(e){var t=this.head;if(this.head===e)return this;var n=this.backward[e],r=this.forward[e];return this.tail===e?this.tail=n:this.backward[r]=n,this.forward[n]=r,this.backward[t]=e,this.head=e,this.forward[e]=t,this},u.prototype.set=function(e,t){var n=this.items[e];if(n!==void 0){this.splayOnTop(n),this.V[n]=t;return}this.size<this.capacity?n=this.size++:(n=this.tail,this.tail=this.backward[n],delete this.items[this.K[n]]),this.items[e]=n,this.K[n]=e,this.V[n]=t,this.forward[n]=this.head,this.backward[this.head]=n,this.head=n},u.prototype.setpop=function(e,t){var n=null,r=null,i=this.items[e];return i===void 0?(this.size<this.capacity?i=this.size++:(i=this.tail,this.tail=this.backward[i],n=this.V[i],r=this.K[i],delete this.items[r]),this.items[e]=i,this.K[i]=e,this.V[i]=t,this.forward[i]=this.head,this.backward[this.head]=i,this.head=i,r?{evicted:!0,key:r,value:n}:null):(this.splayOnTop(i),n=this.V[i],this.V[i]=t,{evicted:!1,key:e,value:n})},u.prototype.has=function(e){return e in this.items},u.prototype.get=function(e){var t=this.items[e];if(t!==void 0)return this.splayOnTop(t),this.V[t]},u.prototype.peek=function(e){var t=this.items[e];if(t!==void 0)return this.V[t]},u.prototype.forEach=function(e,t){t=arguments.length>1?t:this;for(var n=0,r=this.size,i=this.head,a=this.K,o=this.V,s=this.forward;n<r;)e.call(t,o[i],a[i],this),i=s[i],n++},u.prototype.keys=function(){var e=0,t=this.size,n=this.head,r=this.K,a=this.forward;return new i(function(){if(e>=t)return{done:!0};var i=r[n];return e++,e<t&&(n=a[n]),{done:!1,value:i}})},u.prototype.values=function(){var e=0,t=this.size,n=this.head,r=this.V,a=this.forward;return new i(function(){if(e>=t)return{done:!0};var i=r[n];return e++,e<t&&(n=a[n]),{done:!1,value:i}})},u.prototype.entries=function(){var e=0,t=this.size,n=this.head,r=this.K,a=this.V,o=this.forward;return new i(function(){if(e>=t)return{done:!0};var i=r[n],s=a[n];return e++,e<t&&(n=o[n]),{done:!1,value:[i,s]}})},typeof Symbol<`u`&&(u.prototype[Symbol.iterator]=u.prototype.entries),u.prototype.inspect=function(){for(var e=new Map,t=this.entries(),n;n=t.next(),!n.done;)e.set(n.value[0],n.value[1]);return Object.defineProperty(e,"constructor",{value:u,enumerable:!1}),e},typeof Symbol<`u`&&(u.prototype[Symbol.for(`nodejs.util.inspect.custom`)]=u.prototype.inspect),u.from=function(e,t,n,r){if(arguments.length<2){if(r=l.guessLength(e),typeof r!=`number`)throw Error(`mnemonist/lru-cache.from: could not guess iterable length. Please provide desired capacity as last argument.`)}else arguments.length===2&&(r=t,t=null,n=null);var i=new u(t,n,r);return a(e,function(e,t){i.set(t,e)}),i},t.exports=u})),F=t(((e,t)=>{var r=P(),i=n(),a=s(),o=c();function l(e,t,n){arguments.length<2?r.call(this,e):r.call(this,e,t,n);var i=a.getPointerArray(this.capacity);this.deleted=new i(this.capacity),this.deletedSize=0}for(var u in r.prototype)l.prototype[u]=r.prototype[u];typeof Symbol<`u`&&(l.prototype[Symbol.iterator]=r.prototype[Symbol.iterator]),l.prototype.clear=function(){r.prototype.clear.call(this),this.deletedSize=0},l.prototype.set=function(e,t){var n=this.items[e];if(n!==void 0){this.splayOnTop(n),this.V[n]=t;return}this.size<this.capacity?(n=this.deletedSize>0?this.deleted[--this.deletedSize]:this.size,this.size++):(n=this.tail,this.tail=this.backward[n],delete this.items[this.K[n]]),this.items[e]=n,this.K[n]=e,this.V[n]=t,this.forward[n]=this.head,this.backward[this.head]=n,this.head=n},l.prototype.setpop=function(e,t){var n=null,r=null,i=this.items[e];return i===void 0?(this.size<this.capacity?(i=this.deletedSize>0?this.deleted[--this.deletedSize]:this.size,this.size++):(i=this.tail,this.tail=this.backward[i],n=this.V[i],r=this.K[i],delete this.items[r]),this.items[e]=i,this.K[i]=e,this.V[i]=t,this.forward[i]=this.head,this.backward[this.head]=i,this.head=i,r?{evicted:!0,key:r,value:n}:null):(this.splayOnTop(i),n=this.V[i],this.V[i]=t,{evicted:!1,key:e,value:n})},l.prototype.delete=function(e){var t=this.items[e];if(t===void 0)return!1;if(delete this.items[e],this.size===1)return this.size=0,this.head=0,this.tail=0,this.deletedSize=0,!0;var n=this.backward[t],r=this.forward[t];return this.head===t&&(this.head=r),this.tail===t&&(this.tail=n),this.forward[n]=r,this.backward[r]=n,this.size--,this.deleted[this.deletedSize++]=t,!0},l.prototype.remove=function(e,t=void 0){var n=this.items[e];if(n===void 0)return t;var r=this.V[n];if(delete this.items[e],this.size===1)return this.size=0,this.head=0,this.tail=0,this.deletedSize=0,r;var i=this.backward[n],a=this.forward[n];return this.head===n&&(this.head=a),this.tail===n&&(this.tail=i),this.forward[i]=a,this.backward[a]=i,this.size--,this.deleted[this.deletedSize++]=n,r},l.from=function(e,t,n,r){if(arguments.length<2){if(r=o.guessLength(e),typeof r!=`number`)throw Error(`mnemonist/lru-cache.from: could not guess iterable length. Please provide desired capacity as last argument.`)}else arguments.length===2&&(r=t,t=null,n=null);var a=new l(t,n,r);return i(e,function(e,t){a.set(t,e)}),a},t.exports=l})),I=t(((e,t)=>{var r=P(),i=n(),a=s(),o=c();function l(e,t,n){if(arguments.length<2&&(n=e,e=null,t=null),this.capacity=n,typeof this.capacity!=`number`||this.capacity<=0)throw Error(`mnemonist/lru-map: capacity should be positive number.`);if(!isFinite(this.capacity)||Math.floor(this.capacity)!==this.capacity)throw Error(`mnemonist/lru-map: capacity should be a finite positive integer.`);var r=a.getPointerArray(n);this.forward=new r(n),this.backward=new r(n),this.K=typeof e==`function`?new e(n):Array(n),this.V=typeof t==`function`?new t(n):Array(n),this.size=0,this.head=0,this.tail=0,this.items=new Map}l.prototype.clear=function(){this.size=0,this.head=0,this.tail=0,this.items.clear()},l.prototype.set=function(e,t){var n=this.items.get(e);if(n!==void 0){this.splayOnTop(n),this.V[n]=t;return}this.size<this.capacity?n=this.size++:(n=this.tail,this.tail=this.backward[n],this.items.delete(this.K[n])),this.items.set(e,n),this.K[n]=e,this.V[n]=t,this.forward[n]=this.head,this.backward[this.head]=n,this.head=n},l.prototype.setpop=function(e,t){var n=null,r=null,i=this.items.get(e);return i===void 0?(this.size<this.capacity?i=this.size++:(i=this.tail,this.tail=this.backward[i],n=this.V[i],r=this.K[i],this.items.delete(r)),this.items.set(e,i),this.K[i]=e,this.V[i]=t,this.forward[i]=this.head,this.backward[this.head]=i,this.head=i,r?{evicted:!0,key:r,value:n}:null):(this.splayOnTop(i),n=this.V[i],this.V[i]=t,{evicted:!1,key:e,value:n})},l.prototype.has=function(e){return this.items.has(e)},l.prototype.get=function(e){var t=this.items.get(e);if(t!==void 0)return this.splayOnTop(t),this.V[t]},l.prototype.peek=function(e){var t=this.items.get(e);if(t!==void 0)return this.V[t]},l.prototype.splayOnTop=r.prototype.splayOnTop,l.prototype.forEach=r.prototype.forEach,l.prototype.keys=r.prototype.keys,l.prototype.values=r.prototype.values,l.prototype.entries=r.prototype.entries,typeof Symbol<`u`&&(l.prototype[Symbol.iterator]=l.prototype.entries),l.prototype.inspect=r.prototype.inspect,l.from=function(e,t,n,r){if(arguments.length<2){if(r=o.guessLength(e),typeof r!=`number`)throw Error(`mnemonist/lru-cache.from: could not guess iterable length. Please provide desired capacity as last argument.`)}else arguments.length===2&&(r=t,t=null,n=null);var a=new l(t,n,r);return i(e,function(e,t){a.set(t,e)}),a},t.exports=l})),L=t(((e,t)=>{var r=I(),i=n(),a=s(),o=c();function l(e,t,n){arguments.length<2?r.call(this,e):r.call(this,e,t,n);var i=a.getPointerArray(this.capacity);this.deleted=new i(this.capacity),this.deletedSize=0}for(var u in r.prototype)l.prototype[u]=r.prototype[u];typeof Symbol<`u`&&(l.prototype[Symbol.iterator]=r.prototype[Symbol.iterator]),l.prototype.clear=function(){r.prototype.clear.call(this),this.deletedSize=0},l.prototype.set=function(e,t){var n=this.items.get(e);if(n!==void 0){this.splayOnTop(n),this.V[n]=t;return}this.size<this.capacity?(n=this.deletedSize>0?this.deleted[--this.deletedSize]:this.size,this.size++):(n=this.tail,this.tail=this.backward[n],this.items.delete(this.K[n])),this.items.set(e,n),this.K[n]=e,this.V[n]=t,this.forward[n]=this.head,this.backward[this.head]=n,this.head=n},l.prototype.setpop=function(e,t){var n=null,r=null,i=this.items.get(e);return i===void 0?(this.size<this.capacity?(i=this.deletedSize>0?this.deleted[--this.deletedSize]:this.size,this.size++):(i=this.tail,this.tail=this.backward[i],n=this.V[i],r=this.K[i],this.items.delete(r)),this.items.set(e,i),this.K[i]=e,this.V[i]=t,this.forward[i]=this.head,this.backward[this.head]=i,this.head=i,r?{evicted:!0,key:r,value:n}:null):(this.splayOnTop(i),n=this.V[i],this.V[i]=t,{evicted:!1,key:e,value:n})},l.prototype.delete=function(e){var t=this.items.get(e);if(t===void 0)return!1;if(this.items.delete(e),this.size===1)return this.size=0,this.head=0,this.tail=0,this.deletedSize=0,!0;var n=this.backward[t],r=this.forward[t];return this.head===t&&(this.head=r),this.tail===t&&(this.tail=n),this.forward[n]=r,this.backward[r]=n,this.size--,this.deleted[this.deletedSize++]=t,!0},l.prototype.remove=function(e,t=void 0){var n=this.items.get(e);if(n===void 0)return t;var r=this.V[n];if(this.items.delete(e),this.size===1)return this.size=0,this.head=0,this.tail=0,this.deletedSize=0,r;var i=this.backward[n],a=this.forward[n];return this.head===n&&(this.head=a),this.tail===n&&(this.tail=i),this.forward[i]=a,this.backward[a]=i,this.size--,this.deleted[this.deletedSize++]=n,r},l.from=function(e,t,n,r){if(arguments.length<2){if(r=o.guessLength(e),typeof r!=`number`)throw Error(`mnemonist/lru-map.from: could not guess iterable length. Please provide desired capacity as last argument.`)}else arguments.length===2&&(r=t,t=null,n=null);var a=new l(t,n,r);return i(e,function(e,t){a.set(t,e)}),a},t.exports=l})),R=t(((e,t)=>{var i=r(),a=n(),o=w(),s=function(e,t){return e[1]>t[1]?-1:+(e[1]<t[1])};function c(){this.items=new Map,Object.defineProperty(this.items,"constructor",{value:c,enumerable:!1}),this.clear()}c.prototype.clear=function(){this.size=0,this.dimension=0,this.items.clear()},c.prototype.add=function(e,t){if(t===0)return this;if(t<0)return this.remove(e,-t);if(t||=1,typeof t!=`number`)throw Error(`mnemonist/multi-set.add: given count should be a number.`);this.size+=t;let n=this.items.get(e);return n===void 0?this.dimension++:t+=n,this.items.set(e,t),this},c.prototype.set=function(e,t){var n;if(typeof t!=`number`)throw Error(`mnemonist/multi-set.set: given count should be a number.`);return t<=0?(n=this.items.get(e),n!==void 0&&(this.size-=n,this.dimension--),this.items.delete(e),this):(t||=1,n=this.items.get(e),typeof n==`number`?this.items.set(e,n+t):(this.dimension++,this.items.set(e,t)),this.size+=t,this)},c.prototype.has=function(e){return this.items.has(e)},c.prototype.delete=function(e){var t=this.items.get(e);return t===0?!1:(this.size-=t,this.dimension--,this.items.delete(e),!0)},c.prototype.remove=function(e,t){if(t!==0){if(t<0)return this.add(e,-t);if(t||=1,typeof t!=`number`)throw Error(`mnemonist/multi-set.remove: given count should be a number.`);var n=this.items.get(e);if(n!==void 0){var r=Math.max(0,n-t);r===0?(this.items.delete(e),this.size-=n,this.dimension--):(this.items.set(e,r),this.size-=t)}}},c.prototype.edit=function(e,t){var n=this.multiplicity(e);if(n!==0){var r=this.multiplicity(t);return this.items.set(t,n+r),this.items.delete(e),this}},c.prototype.multiplicity=function(e){var t=this.items.get(e);return t===void 0?0:t},c.prototype.get=c.prototype.multiplicity,c.prototype.count=c.prototype.multiplicity,c.prototype.frequency=function(e){return this.size===0?0:this.multiplicity(e)/this.size},c.prototype.top=function(e){if(typeof e!=`number`||e<=0)throw Error(`mnemonist/multi-set.top: n must be a number > 0.`);for(var t=new o(Array,s,e),n=this.items.entries(),r;r=n.next(),!r.done;)t.push(r.value);return t.consume()},c.prototype.forEach=function(e,t){t=arguments.length>1?t:this;var n;this.items.forEach(function(r,i){for(n=0;n<r;n++)e.call(t,i,i)})},c.prototype.forEachMultiplicity=function(e,t){t=arguments.length>1?t:this,this.items.forEach(e,t)},c.prototype.keys=function(){return this.items.keys()},c.prototype.values=function(){var e=this.items.entries(),t=!1,n,r,a,o;return new i(function i(){if(!t){if(n=e.next(),n.done)return{done:!0};t=!0,r=n.value[0],a=n.value[1],o=0}return o>=a?(t=!1,i()):(o++,{done:!1,value:r})})},c.prototype.multiplicities=function(){return this.items.entries()},typeof Symbol<`u`&&(c.prototype[Symbol.iterator]=c.prototype.values),c.prototype.inspect=function(){return this.items},typeof Symbol<`u`&&(c.prototype[Symbol.for(`nodejs.util.inspect.custom`)]=c.prototype.inspect),c.prototype.toJSON=function(){return this.items},c.from=function(e){var t=new c;return a(e,function(e){t.add(e)}),t},c.isSubset=function(e,t){var n=e.multiplicities(),r,i,a;if(e===t)return!0;if(e.dimension>t.dimension)return!1;for(;r=n.next(),!r.done;)if(i=r.value[0],a=r.value[1],t.multiplicity(i)<a)return!1;return!0},c.isSuperset=function(e,t){return c.isSubset(t,e)},t.exports=c})),z=t(((e,t)=>{var i=r(),a=n();function o(e,t,n){return((e**2-Math.abs(t-n)**2)/2|0)+e+1}function s(e,t){for(var n=0,r=0,i=t+1;r<i;r++)n+=o(e,t,r);return n}function c(e,t){return e.length>t.length?-1:e.length<t.length?1:e<t?-1:+(e>t)}function l(e,t){var n=e+1,r=t/n|0,i=r+1,a,o,s=t-r*n,c=n-s,l=Array(e+1);for(a=0;a<c;a++)l[a]=[a*r,r];var u=(a-1)*r+r;for(o=0;o<s;o++)l[a+o]=[u+o*i,i];return l}function u(e,t){var n=t.length,r=e+1,i=n/r|0,a=i+1,o,s,c,l=n-i*r,u=r-l,d=Array(e+1);for(s=0;s<u;s++)o=s*i,d[s]=t.slice(o,o+i);var f=(s-1)*i+i;for(c=0;c<l;c++)o=f+c*a,d[s+c]=t.slice(o,o+a);return d}function d(e,t,n){if(t===0)return 0;var r=n.length,i=e+1,a=r/i|0,o=a+1,s=i-(r-a*i);if(t<=s-1)return t*a;var c=t-s;return s*a+c*o}function f(e,t,n,r,i,a){var o=i-n,s=i+n,c=e-n,l=i+t-c,u=i+t+c,d=r-a;return[Math.max(0,o,l),Math.min(s,u,d)]}function p(e,t,n,r,i,a){var o=t.length,s=f(e,o-n,r,o,i,a),c=s[0],l=s[1],u=``,d=[],p,m,h;for(m=c,h=l+1;m<h;m++)p=t.slice(m,m+a),p!==u&&(d.push(p),u=p);return d}function m(e,t){if(typeof e!=`function`)throw Error("mnemonist/passjoin-index: `levenshtein` should be a function returning edit distance between two strings.");if(typeof t!=`number`||t<1)throw Error("mnemonist/passjoin-index: `k` should be a number > 0");this.levenshtein=e,this.k=t,this.clear()}m.prototype.clear=function(){this.size=0,this.strings=[],this.invertedIndices={}},m.prototype.add=function(e){var t=e.length,n=this.size;this.strings.push(e),this.size++;var r=u(this.k,e),i=this.invertedIndices[t];i===void 0&&(i={},this.invertedIndices[t]=i);var a,o,s,c,l;for(c=0,l=r.length;c<l;c++)a=r[c],s=a+c,o=i[s],o===void 0?(o=[n],i[s]=o):o.push(n);return this},m.prototype.search=function(e){var t=e.length,n=this.k,r=new Set,i,a,o,s,c,u,d,f,m,h,g,_,v,y,b;for(f=Math.max(0,t-n),m=t+n+1;f<m;f++){var x=this.invertedIndices[f];if(x!==void 0){for(d=l(n,f),h=0,g=d.length;h<g;h++)for(o=d[h][0],s=d[h][1],u=p(n,e,f,h,o,s),u.length||(u=[``]),_=0,v=u.length;_<v;_++)if(c=u[_]+h,i=x[c],i!==void 0)for(y=0,b=i.length;y<b;y++)a=this.strings[i[y]],(t<=n&&f<=n||!r.has(a)&&this.levenshtein(e,a)<=n)&&r.add(a)}}return r},m.prototype.forEach=function(e,t){t=arguments.length>1?t:this;for(var n=0,r=this.strings.length;n<r;n++)e.call(t,this.strings[n],n,this)},m.prototype.values=function(){var e=this.strings,t=e.length,n=0;return new i(function(){if(n>=t)return{done:!0};var r=e[n];return n++,{value:r,done:!1}})},typeof Symbol<`u`&&(m.prototype[Symbol.iterator]=m.prototype.values),m.prototype.inspect=function(){var e=this.strings.slice();return Object.defineProperty(e,"constructor",{value:m,enumerable:!1}),e},typeof Symbol<`u`&&(m.prototype[Symbol.for(`nodejs.util.inspect.custom`)]=m.prototype.inspect),m.from=function(e,t,n){var r=new m(t,n);return a(e,function(e){r.add(e)}),r},m.countKeys=s,m.comparator=c,m.partition=l,m.segments=u,m.segmentPos=d,m.multiMatchAwareInterval=f,m.multiMatchAwareSubstrings=p,t.exports=m})),B=t(((e,t)=>{var i=r(),a=n();function o(){this.clear()}o.prototype.clear=function(){this.items=[],this.offset=0,this.size=0},o.prototype.enqueue=function(e){return this.items.push(e),++this.size},o.prototype.dequeue=function(){if(this.size){var e=this.items[this.offset];return++this.offset*2>=this.items.length&&(this.items=this.items.slice(this.offset),this.offset=0),this.size--,e}},o.prototype.peek=function(){if(this.size)return this.items[this.offset]},o.prototype.forEach=function(e,t){t=arguments.length>1?t:this;for(var n=this.offset,r=0,i=this.items.length;n<i;n++,r++)e.call(t,this.items[n],r,this)},o.prototype.toArray=function(){return this.items.slice(this.offset)},o.prototype.values=function(){var e=this.items,t=this.offset;return new i(function(){if(t>=e.length)return{done:!0};var n=e[t];return t++,{value:n,done:!1}})},o.prototype.entries=function(){var e=this.items,t=this.offset,n=0;return new i(function(){if(t>=e.length)return{done:!0};var r=e[t];return t++,{value:[n++,r],done:!1}})},typeof Symbol<`u`&&(o.prototype[Symbol.iterator]=o.prototype.values),o.prototype.toString=function(){return this.toArray().join(`,`)},o.prototype.toJSON=function(){return this.toArray()},o.prototype.inspect=function(){var e=this.toArray();return Object.defineProperty(e,"constructor",{value:o,enumerable:!1}),e},typeof Symbol<`u`&&(o.prototype[Symbol.for(`nodejs.util.inspect.custom`)]=o.prototype.inspect),o.from=function(e){var t=new o;return a(e,function(e){t.enqueue(e)}),t},o.of=function(){return o.from(arguments)},t.exports=o})),V=t(((e,t)=>{var i=r(),a=n();function o(){this.clear()}o.prototype.clear=function(){this.items=[],this.size=0},o.prototype.push=function(e){return this.items.push(e),++this.size},o.prototype.pop=function(){if(this.size!==0)return this.size--,this.items.pop()},o.prototype.peek=function(){return this.items[this.size-1]},o.prototype.forEach=function(e,t){t=arguments.length>1?t:this;for(var n=0,r=this.items.length;n<r;n++)e.call(t,this.items[r-n-1],n,this)},o.prototype.toArray=function(){for(var e=Array(this.size),t=this.size-1,n=this.size;n--;)e[n]=this.items[t-n];return e},o.prototype.values=function(){var e=this.items,t=e.length,n=0;return new i(function(){if(n>=t)return{done:!0};var r=e[t-n-1];return n++,{value:r,done:!1}})},o.prototype.entries=function(){var e=this.items,t=e.length,n=0;return new i(function(){if(n>=t)return{done:!0};var r=e[t-n-1];return{value:[n++,r],done:!1}})},typeof Symbol<`u`&&(o.prototype[Symbol.iterator]=o.prototype.values),o.prototype.toString=function(){return this.toArray().join(`,`)},o.prototype.toJSON=function(){return this.toArray()},o.prototype.inspect=function(){var e=this.toArray();return Object.defineProperty(e,"constructor",{value:o,enumerable:!1}),e},typeof Symbol<`u`&&(o.prototype[Symbol.for(`nodejs.util.inspect.custom`)]=o.prototype.inspect),o.from=function(e){var t=new o;return a(e,function(e){t.push(e)}),t},o.of=function(){return o.from(arguments)},t.exports=o})),H=t(((e,t)=>{var n=r(),i=s().getPointerArray;function a(e){var t=i(e);this.start=0,this.size=0,this.capacity=e,this.dense=new t(e),this.sparse=new t(e)}a.prototype.clear=function(){this.start=0,this.size=0},a.prototype.has=function(e){if(this.size===0)return!1;var t=this.sparse[e];return(t<this.capacity&&t>=this.start&&t<this.start+this.size||t<(this.start+this.size)%this.capacity)&&this.dense[t]===e},a.prototype.enqueue=function(e){var t=this.sparse[e];return this.size!==0&&(t<this.capacity&&t>=this.start&&t<this.start+this.size||t<(this.start+this.size)%this.capacity)&&this.dense[t]===e?this:(t=(this.start+this.size)%this.capacity,this.dense[t]=e,this.sparse[e]=t,this.size++,this)},a.prototype.dequeue=function(){if(this.size!==0){var e=this.start;this.size--,this.start++,this.start===this.capacity&&(this.start=0);var t=this.dense[e];return this.sparse[t]=this.capacity,t}},a.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.dense[i],a,this),i++,a++,i===n&&(i=0)},a.prototype.values=function(){var e=this.dense,t=this.capacity,r=this.size,i=this.start,a=0;return new n(function(){if(a>=r)return{done:!0};var n=e[i];return i++,a++,i===t&&(i=0),{value:n,done:!1}})},typeof Symbol<`u`&&(a.prototype[Symbol.iterator]=a.prototype.values),a.prototype.inspect=function(){var e=[];return this.forEach(function(t){e.push(t)}),Object.defineProperty(e,"constructor",{value:a,enumerable:!1}),e.capacity=this.capacity,e},typeof Symbol<`u`&&(a.prototype[Symbol.for(`nodejs.util.inspect.custom`)]=a.prototype.inspect),t.exports=a})),U=t(((e,t)=>{var n=r(),i=s().getPointerArray;function a(e,t){arguments.length<2&&(t=e,e=Array);var n=i(t);this.size=0,this.length=t,this.dense=new n(t),this.sparse=new n(t),this.vals=new e(t)}a.prototype.clear=function(){this.size=0},a.prototype.has=function(e){var t=this.sparse[e];return t<this.size&&this.dense[t]===e},a.prototype.get=function(e){var t=this.sparse[e];if(t<this.size&&this.dense[t]===e)return this.vals[t]},a.prototype.set=function(e,t){var n=this.sparse[e];return n<this.size&&this.dense[n]===e?(this.vals[n]=t,this):(this.dense[this.size]=e,this.sparse[e]=this.size,this.vals[this.size]=t,this.size++,this)},a.prototype.delete=function(e){var t=this.sparse[e];return t>=this.size||this.dense[t]!==e?!1:(t=this.dense[this.size-1],this.dense[this.sparse[e]]=t,this.sparse[t]=this.sparse[e],this.size--,!0)},a.prototype.forEach=function(e,t){t=arguments.length>1?t:this;for(var n=0;n<this.size;n++)e.call(t,this.vals[n],this.dense[n])},a.prototype.keys=function(){var e=this.size,t=this.dense,r=0;return new n(function(){if(r<e){var n=t[r];return r++,{value:n}}return{done:!0}})},a.prototype.values=function(){var e=this.size,t=this.vals,r=0;return new n(function(){if(r<e){var n=t[r];return r++,{value:n}}return{done:!0}})},a.prototype.entries=function(){var e=this.size,t=this.dense,r=this.vals,i=0;return new n(function(){if(i<e){var n=[t[i],r[i]];return i++,{value:n}}return{done:!0}})},typeof Symbol<`u`&&(a.prototype[Symbol.iterator]=a.prototype.entries),a.prototype.inspect=function(){for(var e=new Map,t=0;t<this.size;t++)e.set(this.dense[t],this.vals[t]);return Object.defineProperty(e,"constructor",{value:a,enumerable:!1}),e.length=this.length,this.vals.constructor!==Array&&(e.type=this.vals.constructor.name),e},typeof Symbol<`u`&&(a.prototype[Symbol.for(`nodejs.util.inspect.custom`)]=a.prototype.inspect),t.exports=a})),W=t(((e,t)=>{var n=r(),i=s().getPointerArray;function a(e){var t=i(e);this.size=0,this.length=e,this.dense=new t(e),this.sparse=new t(e)}a.prototype.clear=function(){this.size=0},a.prototype.has=function(e){var t=this.sparse[e];return t<this.size&&this.dense[t]===e},a.prototype.add=function(e){var t=this.sparse[e];return t<this.size&&this.dense[t]===e?this:(this.dense[this.size]=e,this.sparse[e]=this.size,this.size++,this)},a.prototype.delete=function(e){var t=this.sparse[e];return t>=this.size||this.dense[t]!==e?!1:(t=this.dense[this.size-1],this.dense[this.sparse[e]]=t,this.sparse[t]=this.sparse[e],this.size--,!0)},a.prototype.forEach=function(e,t){t=arguments.length>1?t:this;for(var n,r=0;r<this.size;r++)n=this.dense[r],e.call(t,n,n)},a.prototype.values=function(){var e=this.size,t=this.dense,r=0;return new n(function(){if(r<e){var n=t[r];return r++,{value:n}}return{done:!0}})},typeof Symbol<`u`&&(a.prototype[Symbol.iterator]=a.prototype.values),a.prototype.inspect=function(){for(var e=new Set,t=0;t<this.size;t++)e.add(this.dense[t]);return Object.defineProperty(e,"constructor",{value:a,enumerable:!1}),e.length=this.length,e},typeof Symbol<`u`&&(a.prototype[Symbol.for(`nodejs.util.inspect.custom`)]=a.prototype.inspect),t.exports=a})),G=t(((e,t)=>{var r=n(),i=2,a=2,o=new Set([0,1,2]),s={0:`Returns only the top suggestion`,1:`Returns suggestions with the smallest edit distance`,2:`Returns every suggestion (no early termination)`};function c(e){var t=new Set;return typeof e==`number`&&t.add(e),{suggestions:t,count:0}}function l(e,t,n){return{term:e||``,distance:t||0,count:n||0}}function u(e,t,n,r){r||=new Set,t++;var i,a=e.length,o;if(a>1)for(o=0;o<a;o++)i=e.substring(0,o)+e.substring(o+1),r.has(i)||(r.add(i),t<n&&u(i,t,n,r));return r}function d(e,t,n,r,i,a){var o=n.suggestions.values().next().value;t<2&&n.suggestions.size>0&&e[o].length-a.length>r.length-a.length&&(n.suggestions=new Set,n.count=0),(t===2||!n.suggestions.size||e[o].length-a.length>=r.length-a.length)&&n.suggestions.add(i)}function f(e,t){var n=e.length,r=t.length,i=[[]],a=n+r,o=new Map,s,c,l;for(i[0][0]=a,s=0;s<=n;s++)i[s+1]||(i[s+1]=[]),i[s+1][1]=s,i[s+1][0]=a;for(l=0;l<=r;l++)i[1][l+1]=l,i[0][l+1]=a;var u=e+t,d;for(s=0,c=u.length;s<c;s++)d=u[s],o.has(d)||o.set(d,0);for(s=1;s<=n;s++){var f=0;for(l=1;l<=r;l++){var p=o.get(t[l-1]),m=f;e[s-1]===t[l-1]?(i[s+1][l+1]=i[s][l],f=l):i[s+1][l+1]=Math.min(i[s][l],i[s+1][l],i[s][l+1])+1,i[s+1][l+1]=Math.min(i[s+1][l+1],i[p][m]+(s-p-1)+1+(l-m-1))}o.set(e[s-1],s)}return i[n+1][r+1]}function p(e,t,n,r,i,a){var o=a.length;if(o-r>i)return[];for(var s=[a],u=new Set,d=new Set,p=[],m,h;s.length>0&&(m=s.shift(),!(n<2&&p.length>0&&o-m.length>p[0].distance));){if(h=e[m],h!==void 0){if(typeof h==`number`&&(h=c(h)),h.count>0&&!d.has(m)){d.add(m);var g=l(m,o-m.length,h.count);if(p.push(g),n<2&&o-m.length===0)break}h.suggestions.forEach(i=>{var s=t[i];if(!d.has(s)){d.add(s);var c=0;if(a!==s)if(s.length===m.length)c=o-m.length;else if(o===m.length)c=s.length-m.length;else{for(var u=0,h=0,g=s.length;u<g&&u<o&&s[u]===a[u];)u++;for(;h<g-u&&h<o&&s[g-h-1]===a[o-h-1];)h++;c=u>0||h>0?f(s.substr(u,g-u-h),a.substr(u,o-u-h)):f(s,a)}if(n<2&&p.length>0&&p[0].distance>c&&(p=[]),!(n<2&&p.length>0&&c>p[0].distance)&&c<=r){var _=e[s];_!==void 0&&p.push(l(s,c,_.count))}}})}if(o-m.length<r){if(n<2&&p.length>0&&o-m.length>=p[0].distance)continue;for(var _=0,v=m.length;_<v;_++){var y=m.substring(0,_)+m.substring(_+1);u.has(y)||(u.add(y),s.push(y))}}}return n===0?p.slice(0,1):p}function m(e){if(e||={},this.clear(),this.maxDistance=typeof e.maxDistance==`number`?e.maxDistance:i,this.verbosity=typeof e.verbosity==`number`?e.verbosity:a,typeof this.maxDistance!=`number`||this.maxDistance<=0)throw Error("mnemonist/SymSpell.constructor: invalid `maxDistance` option. Should be a integer greater than 0.");if(!o.has(this.verbosity))throw Error("mnemonist/SymSpell.constructor: invalid `verbosity` option. Should be either 0, 1 or 2.")}m.prototype.clear=function(){this.size=0,this.dictionary=Object.create(null),this.maxLength=0,this.words=[]},m.prototype.add=function(e){var t=this.dictionary[e];if(t===void 0?(t=c(),t.count++,this.dictionary[e]=t,e.length>this.maxLength&&(this.maxLength=e.length)):(typeof t==`number`&&(t=c(t),this.dictionary[e]=t),t.count++),t.count===1){var n=this.words.length;this.words.push(e),u(e,0,this.maxDistance).forEach(t=>{var r=this.dictionary[t];r===void 0?this.dictionary[t]=n:(typeof r==`number`&&(r=c(r),this.dictionary[t]=r),r.suggestions.has(n)||d(this.words,this.verbosity,r,e,n,t))})}return this.size++,this},m.prototype.search=function(e){return p(this.dictionary,this.words,this.verbosity,this.maxDistance,this.maxLength,e)},m.prototype.inspect=function(){var e=[];for(var t in e.size=this.size,e.maxDistance=this.maxDistance,e.verbosity=this.verbosity,e.behavior=s[this.verbosity],this.dictionary)typeof this.dictionary[t]==`object`&&this.dictionary[t].count&&e.push([t,this.dictionary[t].count]);return Object.defineProperty(e,"constructor",{value:m,enumerable:!1}),e},typeof Symbol<`u`&&(m.prototype[Symbol.for(`nodejs.util.inspect.custom`)]=m.prototype.inspect),m.from=function(e,t){var n=new m(t);return r(e,function(e){n.add(e)}),n},t.exports=m})),K=t(((e,t)=>{var i=n(),a=r(),o=`\0`;function s(e){this.mode=e===Array?`array`:`string`,this.clear()}s.prototype.clear=function(){this.root={},this.size=0},s.prototype.set=function(e,t){for(var n=this.root,r,i=0,a=e.length;i<a;i++)r=e[i],n=n[r]||(n[r]={});return o in n||this.size++,n[o]=t,this},s.prototype.update=function(e,t){for(var n=this.root,r,i=0,a=e.length;i<a;i++)r=e[i],n=n[r]||(n[r]={});return o in n||this.size++,n[o]=t(n[o]),this},s.prototype.get=function(e){var t=this.root,n,r,i;for(r=0,i=e.length;r<i;r++)if(n=e[r],t=t[n],t===void 0)return;if(o in t)return t[o]},s.prototype.delete=function(e){var t=this.root,n=null,r=null,i,a,s,c;for(s=0,c=e.length;s<c;s++){if(a=e[s],i=t,t=t[a],t===void 0)return!1;n===null?Object.keys(t).length<2&&(n=i,r=a):Object.keys(t).length>1&&(n=null,r=null)}return o in t?(this.size--,n?delete n[r]:delete t[o],!0):!1},s.prototype.has=function(e){for(var t=this.root,n,r=0,i=e.length;r<i;r++)if(n=e[r],t=t[n],t===void 0)return!1;return o in t},s.prototype.find=function(e){var t=typeof e==`string`,n=this.root,r=[],i,a,s;for(a=0,s=e.length;a<s;a++)if(i=e[a],n=n[i],n===void 0)return r;for(var c=[n],l=[e],u;c.length;)for(u in e=l.pop(),n=c.pop(),n){if(u===o){r.push([e,n[o]]);continue}c.push(n[u]),l.push(t?e+u:e.concat(u))}return r},s.prototype.values=function(e){var t=this.root,n=[],r,i,s;if(e){for(i=0,s=e.length;i<s;i++)if(r=e[i],t=t[r],t===void 0)return a.empty()}return n.push(t),new a(function(){for(var e,t=!1,r;n.length;){for(r in e=n.pop(),e){if(r===o){t=!0;continue}n.push(e[r])}if(t)return{done:!1,value:e[o]}}return{done:!0}})},s.prototype.prefixes=function(e){var t=this.root,n=[],r=[],i,s,c,l=this.mode===`string`;if(e){for(s=0,c=e.length;s<c;s++)if(i=e[s],t=t[i],t===void 0)return a.empty()}else e=l?``:[];return n.push(t),r.push(e),new a(function(){for(var e,t,i=!1,a;n.length;){for(a in e=n.pop(),t=r.pop(),e){if(a===o){i=!0;continue}n.push(e[a]),r.push(l?t+a:t.concat(a))}if(i)return{done:!1,value:t}}return{done:!0}})},s.prototype.keys=s.prototype.prefixes,s.prototype.entries=function(e){var t=this.root,n=[],r=[],i,s,c,l=this.mode===`string`;if(e){for(s=0,c=e.length;s<c;s++)if(i=e[s],t=t[i],t===void 0)return a.empty()}else e=l?``:[];return n.push(t),r.push(e),new a(function(){for(var e,t,i=!1,a;n.length;){for(a in e=n.pop(),t=r.pop(),e){if(a===o){i=!0;continue}n.push(e[a]),r.push(l?t+a:t.concat(a))}if(i)return{done:!1,value:[t,e[o]]}}return{done:!0}})},typeof Symbol<`u`&&(s.prototype[Symbol.iterator]=s.prototype.entries),s.prototype.inspect=function(){for(var e=Array(this.size),t=this.entries(),n,r=0;n=t.next(),!n.done;)e[r++]=n.value;return Object.defineProperty(e,"constructor",{value:s,enumerable:!1}),e},typeof Symbol<`u`&&(s.prototype[Symbol.for(`nodejs.util.inspect.custom`)]=s.prototype.inspect),s.prototype.toJSON=function(){return this.root},s.from=function(e){var t=new s;return i(e,function(e,n){t.set(n,e)}),t},s.SENTINEL=o,t.exports=s})),q=t(((e,t)=>{var r=n(),i=K(),a=`\0`;function o(e){this.mode=e===Array?`array`:`string`,this.clear()}for(var s in i.prototype)o.prototype[s]=i.prototype[s];delete o.prototype.set,delete o.prototype.get,delete o.prototype.values,delete o.prototype.entries,o.prototype.add=function(e){for(var t=this.root,n,r=0,i=e.length;r<i;r++)n=e[r],t=t[n]||(t[n]={});return a in t||this.size++,t[a]=!0,this},o.prototype.find=function(e){var t=typeof e==`string`,n=this.root,r=[],i,o,s;for(o=0,s=e.length;o<s;o++)if(i=e[o],n=n[i],n===void 0)return r;for(var c=[n],l=[e],u;c.length;)for(u in e=l.pop(),n=c.pop(),n){if(u===a){r.push(e);continue}c.push(n[u]),l.push(t?e+u:e.concat(u))}return r},typeof Symbol<`u`&&(o.prototype[Symbol.iterator]=o.prototype.keys),o.prototype.inspect=function(){for(var e=new Set,t=this.keys(),n;n=t.next(),!n.done;)e.add(n.value);return Object.defineProperty(e,"constructor",{value:o,enumerable:!1}),e},typeof Symbol<`u`&&(o.prototype[Symbol.for(`nodejs.util.inspect.custom`)]=o.prototype.inspect),o.prototype.toJSON=function(){return this.root},o.from=function(e){var t=new o;return r(e,function(e){t.add(e)}),t},o.SENTINEL=a,t.exports=o})),J=t(((e,t)=>{var n=c(),r=s(),i=M().inplaceQuickSortIndices,a=A().lowerBoundIndices,o=l(),u=r.getPointerArray;function d(e,t){return e.distance<t.distance?1:e.distance>t.distance?-1:0}function f(e,t,n){for(var r=n.length,o=u(r),s=0,c=new o(r),l=new o(r),d=new o(r),f=new Float64Array(r),p=[0,0,r],m=new Float64Array(r),h,g,_,v,y,b,x,S,C;p.length;)if(y=p.pop(),v=p.pop(),h=p.pop(),g=n[y-1],y--,C=y-v,c[h]=g,C!==0){if(C===1){x=e(t[g],t[n[v]]),f[h]=x,s++,d[h]=s,c[s]=n[v];continue}for(S=v;S<y;S++)m[n[S]]=e(t[g],t[n[S]]);i(m,n,v,y),_=v+C/2-1,x=_===(_|0)?(m[n[_]]+m[n[_+1]])/2:m[n[Math.ceil(_)]],f[h]=x,b=a(m,n,x,v,y),y-b>0&&(s++,d[h]=s,p.push(s,b,y)),b-v>0&&(s++,l[h]=s,p.push(s,v,b))}return{nodes:c,lefts:l,rights:d,mus:f}}function p(e,t){if(typeof e!=`function`)throw Error("mnemonist/VPTree.constructor: given `distance` must be a function.");if(!t)throw Error(`mnemonist/VPTree.constructor: you must provide items to the tree. A VPTree cannot be updated after its creation.`);this.distance=e,this.heap=new o(d),this.D=0;var r=n.toArrayWithIndices(t);this.items=r[0];var i=r[1];this.size=i.length;var a=f(e,this.items,i);this.nodes=a.nodes,this.lefts=a.lefts,this.rights=a.rights,this.mus=a.mus}p.prototype.nearestNeighbors=function(e,t){var n=this.heap,r=[0],i=1/0,a,o,s,c,l,u,d;for(this.D=0;r.length;)a=r.pop(),o=this.nodes[a],s=this.items[o],d=this.distance(s,t),this.D++,d<i&&(n.push({distance:d,item:s}),n.size>e&&n.pop(),n.size>=e&&(i=n.peek().distance)),c=this.lefts[a],l=this.rights[a],!(!c&&!l)&&(u=this.mus[a],d<u?(c&&d<u+i&&r.push(c),l&&d>=u-i&&r.push(l)):(l&&d>=u-i&&r.push(l),c&&d<u+i&&r.push(c)));for(var f=Array(n.size),p=n.size-1;p>=0;p--)f[p]=n.pop();return f},p.prototype.neighbors=function(e,t){var n=[],r=[0],i,a,o,s,c,l,u;for(this.D=0;r.length;)i=r.pop(),a=this.nodes[i],o=this.items[a],u=this.distance(o,t),this.D++,u<=e&&n.push({distance:u,item:o}),s=this.lefts[i],c=this.rights[i],!(!s&&!c)&&(l=this.mus[i],u<l?(s&&u<l+e&&r.push(s),c&&u>=l-e&&r.push(c)):(c&&u>=l-e&&r.push(c),s&&u<l+e&&r.push(s)));return n},p.prototype.inspect=function(){var e=this.items.slice();return Object.defineProperty(e,"constructor",{value:p,enumerable:!1}),e},typeof Symbol<`u`&&(p.prototype[Symbol.for(`nodejs.util.inspect.custom`)]=p.prototype.inspect),p.from=function(e,t){return new p(t,e)},t.exports=p})),Y=e(i(),1),X=e(o(),1),Z=e(l(),1),re=e(u(),1),Q=e(d(),1);f(),m(),h(),_(),v(),b();var ie=e(x(),1),ae=e(S(),1);y(),C(),w(),T(),D(),ee(),k(),te(),ne();var oe=e(N(),1);P(),F();var se=e(I(),1);L();var ce=e(E(),1);R(),z();var le=e(B(),1);O();var $=e(V(),1);H(),U(),W(),G(),q(),K(),J(),X.default.MinFibonacciHeap,X.default.MaxFibonacciHeap,Z.default.MinHeap,Z.default.MaxHeap,re.default.GeneralizedSuffixArray,Q.default.Uint8Vector,Q.default.Uint8ClampedVector,Q.default.Int8Vector,Q.default.Uint16Vector,Q.default.Int16Vector,Q.default.Uint32Vector,Q.default.Int32Vector,Q.default.Float32Vector,Q.default.Float64Vector,Q.default.PointerVector;export{ce as a,$ as c,se as i,ae as n,le as o,oe as r,Y as s,ie as t};
@@ -1 +1 @@
1
- import{r as e}from"../rolldown-runtime.mjs";import"./devlop.mjs";import{n as t}from"./mdast-util-from-markdown.mjs";import{t as n}from"./bail.mjs";import{t as r}from"./extend.mjs";import{t as i}from"./is-plain-obj.mjs";import{t as a}from"./trough.mjs";var o=class extends Error{constructor(e,n,r){super(),typeof n==`string`&&(r=n,n=void 0);let i=``,a={},o=!1;if(n&&(a=`line`in n&&`column`in n||`start`in n&&`end`in n?{place:n}:`type`in n?{ancestors:[n],place:n.position}:{...n}),typeof e==`string`?i=e:!a.cause&&e&&(o=!0,i=e.message,a.cause=e),!a.ruleId&&!a.source&&typeof r==`string`){let e=r.indexOf(`:`);e===-1?a.ruleId=r:(a.source=r.slice(0,e),a.ruleId=r.slice(e+1))}if(!a.place&&a.ancestors&&a.ancestors){let e=a.ancestors[a.ancestors.length-1];e&&(a.place=e.position)}let s=a.place&&`start`in a.place?a.place.start:a.place;this.ancestors=a.ancestors||void 0,this.cause=a.cause||void 0,this.column=s?s.column:void 0,this.fatal=void 0,this.file,this.message=i,this.line=s?s.line:void 0,this.name=t(a.place)||`1:1`,this.place=a.place||void 0,this.reason=this.message,this.ruleId=a.ruleId||void 0,this.source=a.source||void 0,this.stack=o&&a.cause&&typeof a.cause.stack==`string`?a.cause.stack:``,this.actual,this.expected,this.note,this.url}};o.prototype.file=``,o.prototype.name=``,o.prototype.reason=``,o.prototype.message=``,o.prototype.stack=``,o.prototype.column=void 0,o.prototype.line=void 0,o.prototype.ancestors=void 0,o.prototype.cause=void 0,o.prototype.fatal=void 0,o.prototype.place=void 0,o.prototype.ruleId=void 0,o.prototype.source=void 0;const s={basename:c,dirname:l,extname:u,join:d,sep:`/`};function c(e,t){if(t!==void 0&&typeof t!=`string`)throw TypeError(`"ext" argument must be a string`);m(e);let n=0,r=-1,i=e.length,a;if(t===void 0||t.length===0||t.length>e.length){for(;i--;)if(e.codePointAt(i)===47){if(a){n=i+1;break}}else r<0&&(a=!0,r=i+1);return r<0?``:e.slice(n,r)}if(t===e)return``;let o=-1,s=t.length-1;for(;i--;)if(e.codePointAt(i)===47){if(a){n=i+1;break}}else o<0&&(a=!0,o=i+1),s>-1&&(e.codePointAt(i)===t.codePointAt(s--)?s<0&&(r=i):(s=-1,r=o));return n===r?r=o:r<0&&(r=e.length),e.slice(n,r)}function l(e){if(m(e),e.length===0)return`.`;let t=-1,n=e.length,r;for(;--n;)if(e.codePointAt(n)===47){if(r){t=n;break}}else r||=!0;return t<0?e.codePointAt(0)===47?`/`:`.`:t===1&&e.codePointAt(0)===47?`//`:e.slice(0,t)}function u(e){m(e);let t=e.length,n=-1,r=0,i=-1,a=0,o;for(;t--;){let s=e.codePointAt(t);if(s===47){if(o){r=t+1;break}continue}n<0&&(o=!0,n=t+1),s===46?i<0?i=t:a!==1&&(a=1):i>-1&&(a=-1)}return i<0||n<0||a===0||a===1&&i===n-1&&i===r+1?``:e.slice(i,n)}function d(...e){let t=-1,n;for(;++t<e.length;)m(e[t]),e[t]&&(n=n===void 0?e[t]:n+`/`+e[t]);return n===void 0?`.`:f(n)}function f(e){m(e);let t=e.codePointAt(0)===47,n=p(e,!t);return n.length===0&&!t&&(n=`.`),n.length>0&&e.codePointAt(e.length-1)===47&&(n+=`/`),t?`/`+n:n}function p(e,t){let n=``,r=0,i=-1,a=0,o=-1,s,c;for(;++o<=e.length;){if(o<e.length)s=e.codePointAt(o);else if(s===47)break;else s=47;if(s===47){if(!(i===o-1||a===1))if(i!==o-1&&a===2){if(n.length<2||r!==2||n.codePointAt(n.length-1)!==46||n.codePointAt(n.length-2)!==46){if(n.length>2){if(c=n.lastIndexOf(`/`),c!==n.length-1){c<0?(n=``,r=0):(n=n.slice(0,c),r=n.length-1-n.lastIndexOf(`/`)),i=o,a=0;continue}}else if(n.length>0){n=``,r=0,i=o,a=0;continue}}t&&(n=n.length>0?n+`/..`:`..`,r=2)}else n.length>0?n+=`/`+e.slice(i+1,o):n=e.slice(i+1,o),r=o-i-1;i=o,a=0}else s===46&&a>-1?a++:a=-1}return n}function m(e){if(typeof e!=`string`)throw TypeError(`Path must be a string. Received `+JSON.stringify(e))}const h={cwd:g};function g(){return`/`}function _(e){return!!(typeof e==`object`&&e&&`href`in e&&e.href&&`protocol`in e&&e.protocol&&e.auth===void 0)}function v(e){if(typeof e==`string`)e=new URL(e);else if(!_(e)){let t=TypeError('The "path" argument must be of type string or an instance of URL. Received `'+e+"`");throw t.code=`ERR_INVALID_ARG_TYPE`,t}if(e.protocol!==`file:`){let e=TypeError(`The URL must be of scheme file`);throw e.code=`ERR_INVALID_URL_SCHEME`,e}return y(e)}function y(e){if(e.hostname!==``){let e=TypeError(`File URL host must be "localhost" or empty on darwin`);throw e.code=`ERR_INVALID_FILE_URL_HOST`,e}let t=e.pathname,n=-1;for(;++n<t.length;)if(t.codePointAt(n)===37&&t.codePointAt(n+1)===50){let e=t.codePointAt(n+2);if(e===70||e===102){let e=TypeError(`File URL path must not include encoded / characters`);throw e.code=`ERR_INVALID_FILE_URL_PATH`,e}}return decodeURIComponent(t)}const b=[`history`,`path`,`basename`,`stem`,`extname`,`dirname`];var x=class{constructor(e){let t;t=e?_(e)?{path:e}:typeof e==`string`||T(e)?{value:e}:e:{},this.cwd=`cwd`in t?``:h.cwd(),this.data={},this.history=[],this.messages=[],this.value,this.map,this.result,this.stored;let n=-1;for(;++n<b.length;){let e=b[n];e in t&&t[e]!==void 0&&t[e]!==null&&(this[e]=e===`history`?[...t[e]]:t[e])}let r;for(r in t)b.includes(r)||(this[r]=t[r])}get basename(){return typeof this.path==`string`?s.basename(this.path):void 0}set basename(e){C(e,`basename`),S(e,`basename`),this.path=s.join(this.dirname||``,e)}get dirname(){return typeof this.path==`string`?s.dirname(this.path):void 0}set dirname(e){w(this.basename,`dirname`),this.path=s.join(e||``,this.basename)}get extname(){return typeof this.path==`string`?s.extname(this.path):void 0}set extname(e){if(S(e,`extname`),w(this.dirname,`extname`),e){if(e.codePointAt(0)!==46)throw Error("`extname` must start with `.`");if(e.includes(`.`,1))throw Error("`extname` cannot contain multiple dots")}this.path=s.join(this.dirname,this.stem+(e||``))}get path(){return this.history[this.history.length-1]}set path(e){_(e)&&(e=v(e)),C(e,`path`),this.path!==e&&this.history.push(e)}get stem(){return typeof this.path==`string`?s.basename(this.path,this.extname):void 0}set stem(e){C(e,`stem`),S(e,`stem`),this.path=s.join(this.dirname||``,e+(this.extname||``))}fail(e,t,n){let r=this.message(e,t,n);throw r.fatal=!0,r}info(e,t,n){let r=this.message(e,t,n);return r.fatal=void 0,r}message(e,t,n){let r=new o(e,t,n);return this.path&&(r.name=this.path+`:`+r.name,r.file=this.path),r.fatal=!1,this.messages.push(r),r}toString(e){return this.value===void 0?``:typeof this.value==`string`?this.value:new TextDecoder(e||void 0).decode(this.value)}};function S(e,t){if(e&&e.includes(s.sep))throw Error("`"+t+"` cannot be a path: did not expect `"+s.sep+"`")}function C(e,t){if(!e)throw Error("`"+t+"` cannot be empty")}function w(e,t){if(!e)throw Error("Setting `"+t+"` requires `path` to be set too")}function T(e){return!!(e&&typeof e==`object`&&`byteLength`in e&&`byteOffset`in e)}const E=(function(e){let t=this.constructor.prototype,n=t[e],r=function(){return n.apply(r,arguments)};return Object.setPrototypeOf(r,t),r});var D=e(r(),1);const O={}.hasOwnProperty,k=new class e extends E{constructor(){super(`copy`),this.Compiler=void 0,this.Parser=void 0,this.attachers=[],this.compiler=void 0,this.freezeIndex=-1,this.frozen=void 0,this.namespace={},this.parser=void 0,this.transformers=a()}copy(){let t=new e,n=-1;for(;++n<this.attachers.length;){let e=this.attachers[n];t.use(...e)}return t.data((0,D.default)(!0,{},this.namespace)),t}data(e,t){return typeof e==`string`?arguments.length===2?(M(`data`,this.frozen),this.namespace[e]=t,this):O.call(this.namespace,e)&&this.namespace[e]||void 0:e?(M(`data`,this.frozen),this.namespace=e,this):this.namespace}freeze(){if(this.frozen)return this;let e=this;for(;++this.freezeIndex<this.attachers.length;){let[t,...n]=this.attachers[this.freezeIndex];if(n[0]===!1)continue;n[0]===!0&&(n[0]=void 0);let r=t.call(e,...n);typeof r==`function`&&this.transformers.use(r)}return this.frozen=!0,this.freezeIndex=1/0,this}parse(e){this.freeze();let t=F(e),n=this.parser||this.Parser;return A(`parse`,n),n(String(t),t)}process(e,t){let n=this;return this.freeze(),A(`process`,this.parser||this.Parser),j(`process`,this.compiler||this.Compiler),t?r(void 0,t):new Promise(r);function r(r,i){let a=F(e),o=n.parse(a);n.run(o,a,function(e,t,r){if(e||!t||!r)return s(e);let i=t,a=n.stringify(i,r);L(a)?r.value=a:r.result=a,s(e,r)});function s(e,n){e||!n?i(e):r?r(n):t(void 0,n)}}}processSync(e){let t=!1,r;return this.freeze(),A(`processSync`,this.parser||this.Parser),j(`processSync`,this.compiler||this.Compiler),this.process(e,i),P(`processSync`,`process`,t),r;function i(e,i){t=!0,n(e),r=i}}run(e,t,n){N(e),this.freeze();let r=this.transformers;return!n&&typeof t==`function`&&(n=t,t=void 0),n?i(void 0,n):new Promise(i);function i(i,a){let o=F(t);r.run(e,o,s);function s(t,r,o){let s=r||e;t?a(t):i?i(s):n(void 0,s,o)}}}runSync(e,t){let r=!1,i;return this.run(e,t,a),P(`runSync`,`run`,r),i;function a(e,t){n(e),i=t,r=!0}}stringify(e,t){this.freeze();let n=F(t),r=this.compiler||this.Compiler;return j(`stringify`,r),N(e),r(e,n)}use(e,...t){let n=this.attachers,r=this.namespace;if(M(`use`,this.frozen),e!=null)if(typeof e==`function`)c(e,t);else if(typeof e==`object`)Array.isArray(e)?s(e):o(e);else throw TypeError("Expected usable value, not `"+e+"`");return this;function a(e){if(typeof e==`function`)c(e,[]);else if(typeof e==`object`)if(Array.isArray(e)){let[t,...n]=e;c(t,n)}else o(e);else throw TypeError("Expected usable value, not `"+e+"`")}function o(e){if(!(`plugins`in e)&&!(`settings`in e))throw Error("Expected usable value but received an empty preset, which is probably a mistake: presets typically come with `plugins` and sometimes with `settings`, but this has neither");s(e.plugins),e.settings&&(r.settings=(0,D.default)(!0,r.settings,e.settings))}function s(e){let t=-1;if(e!=null)if(Array.isArray(e))for(;++t<e.length;){let n=e[t];a(n)}else throw TypeError("Expected a list of plugins, not `"+e+"`")}function c(e,t){let r=-1,a=-1;for(;++r<n.length;)if(n[r][0]===e){a=r;break}if(a===-1)n.push([e,...t]);else if(t.length>0){let[r,...o]=t,s=n[a][1];i(s)&&i(r)&&(r=(0,D.default)(!0,s,r)),n[a]=[e,r,...o]}}}}().freeze();function A(e,t){if(typeof t!=`function`)throw TypeError("Cannot `"+e+"` without `parser`")}function j(e,t){if(typeof t!=`function`)throw TypeError("Cannot `"+e+"` without `compiler`")}function M(e,t){if(t)throw Error("Cannot call `"+e+"` on a frozen processor.\nCreate a new processor first, by calling it: use `processor()` instead of `processor`.")}function N(e){if(!i(e)||typeof e.type!=`string`)throw TypeError("Expected node, got `"+e+"`")}function P(e,t,n){if(!n)throw Error("`"+e+"` finished async. Use `"+t+"` instead")}function F(e){return I(e)?e:new x(e)}function I(e){return!!(e&&typeof e==`object`&&`message`in e&&`messages`in e)}function L(e){return typeof e==`string`||R(e)}function R(e){return!!(e&&typeof e==`object`&&`byteLength`in e&&`byteOffset`in e)}export{k as t};
1
+ import{r as e}from"../rolldown-runtime.mjs";import"./devlop.mjs";import{n as t}from"./mdast-util-from-markdown.mjs";import{t as n}from"./bail.mjs";import{t as r}from"./extend.mjs";import{t as i}from"./is-plain-obj.mjs";import{t as a}from"./trough.mjs";var o=e(r(),1),s=class extends Error{constructor(e,n,r){super(),typeof n==`string`&&(r=n,n=void 0);let i=``,a={},o=!1;if(n&&(a=`line`in n&&`column`in n||`start`in n&&`end`in n?{place:n}:`type`in n?{ancestors:[n],place:n.position}:{...n}),typeof e==`string`?i=e:!a.cause&&e&&(o=!0,i=e.message,a.cause=e),!a.ruleId&&!a.source&&typeof r==`string`){let e=r.indexOf(`:`);e===-1?a.ruleId=r:(a.source=r.slice(0,e),a.ruleId=r.slice(e+1))}if(!a.place&&a.ancestors&&a.ancestors){let e=a.ancestors[a.ancestors.length-1];e&&(a.place=e.position)}let s=a.place&&`start`in a.place?a.place.start:a.place;this.ancestors=a.ancestors||void 0,this.cause=a.cause||void 0,this.column=s?s.column:void 0,this.fatal=void 0,this.file,this.message=i,this.line=s?s.line:void 0,this.name=t(a.place)||`1:1`,this.place=a.place||void 0,this.reason=this.message,this.ruleId=a.ruleId||void 0,this.source=a.source||void 0,this.stack=o&&a.cause&&typeof a.cause.stack==`string`?a.cause.stack:``,this.actual,this.expected,this.note,this.url}};s.prototype.file=``,s.prototype.name=``,s.prototype.reason=``,s.prototype.message=``,s.prototype.stack=``,s.prototype.column=void 0,s.prototype.line=void 0,s.prototype.ancestors=void 0,s.prototype.cause=void 0,s.prototype.fatal=void 0,s.prototype.place=void 0,s.prototype.ruleId=void 0,s.prototype.source=void 0;const c={basename:l,dirname:u,extname:d,join:f,sep:`/`};function l(e,t){if(t!==void 0&&typeof t!=`string`)throw TypeError(`"ext" argument must be a string`);h(e);let n=0,r=-1,i=e.length,a;if(t===void 0||t.length===0||t.length>e.length){for(;i--;)if(e.codePointAt(i)===47){if(a){n=i+1;break}}else r<0&&(a=!0,r=i+1);return r<0?``:e.slice(n,r)}if(t===e)return``;let o=-1,s=t.length-1;for(;i--;)if(e.codePointAt(i)===47){if(a){n=i+1;break}}else o<0&&(a=!0,o=i+1),s>-1&&(e.codePointAt(i)===t.codePointAt(s--)?s<0&&(r=i):(s=-1,r=o));return n===r?r=o:r<0&&(r=e.length),e.slice(n,r)}function u(e){if(h(e),e.length===0)return`.`;let t=-1,n=e.length,r;for(;--n;)if(e.codePointAt(n)===47){if(r){t=n;break}}else r||=!0;return t<0?e.codePointAt(0)===47?`/`:`.`:t===1&&e.codePointAt(0)===47?`//`:e.slice(0,t)}function d(e){h(e);let t=e.length,n=-1,r=0,i=-1,a=0,o;for(;t--;){let s=e.codePointAt(t);if(s===47){if(o){r=t+1;break}continue}n<0&&(o=!0,n=t+1),s===46?i<0?i=t:a!==1&&(a=1):i>-1&&(a=-1)}return i<0||n<0||a===0||a===1&&i===n-1&&i===r+1?``:e.slice(i,n)}function f(...e){let t=-1,n;for(;++t<e.length;)h(e[t]),e[t]&&(n=n===void 0?e[t]:n+`/`+e[t]);return n===void 0?`.`:p(n)}function p(e){h(e);let t=e.codePointAt(0)===47,n=m(e,!t);return n.length===0&&!t&&(n=`.`),n.length>0&&e.codePointAt(e.length-1)===47&&(n+=`/`),t?`/`+n:n}function m(e,t){let n=``,r=0,i=-1,a=0,o=-1,s,c;for(;++o<=e.length;){if(o<e.length)s=e.codePointAt(o);else if(s===47)break;else s=47;if(s===47){if(!(i===o-1||a===1))if(i!==o-1&&a===2){if(n.length<2||r!==2||n.codePointAt(n.length-1)!==46||n.codePointAt(n.length-2)!==46){if(n.length>2){if(c=n.lastIndexOf(`/`),c!==n.length-1){c<0?(n=``,r=0):(n=n.slice(0,c),r=n.length-1-n.lastIndexOf(`/`)),i=o,a=0;continue}}else if(n.length>0){n=``,r=0,i=o,a=0;continue}}t&&(n=n.length>0?n+`/..`:`..`,r=2)}else n.length>0?n+=`/`+e.slice(i+1,o):n=e.slice(i+1,o),r=o-i-1;i=o,a=0}else s===46&&a>-1?a++:a=-1}return n}function h(e){if(typeof e!=`string`)throw TypeError(`Path must be a string. Received `+JSON.stringify(e))}const g={cwd:_};function _(){return`/`}function v(e){return!!(typeof e==`object`&&e&&`href`in e&&e.href&&`protocol`in e&&e.protocol&&e.auth===void 0)}function y(e){if(typeof e==`string`)e=new URL(e);else if(!v(e)){let t=TypeError('The "path" argument must be of type string or an instance of URL. Received `'+e+"`");throw t.code=`ERR_INVALID_ARG_TYPE`,t}if(e.protocol!==`file:`){let e=TypeError(`The URL must be of scheme file`);throw e.code=`ERR_INVALID_URL_SCHEME`,e}return b(e)}function b(e){if(e.hostname!==``){let e=TypeError(`File URL host must be "localhost" or empty on darwin`);throw e.code=`ERR_INVALID_FILE_URL_HOST`,e}let t=e.pathname,n=-1;for(;++n<t.length;)if(t.codePointAt(n)===37&&t.codePointAt(n+1)===50){let e=t.codePointAt(n+2);if(e===70||e===102){let e=TypeError(`File URL path must not include encoded / characters`);throw e.code=`ERR_INVALID_FILE_URL_PATH`,e}}return decodeURIComponent(t)}const x=[`history`,`path`,`basename`,`stem`,`extname`,`dirname`];var S=class{constructor(e){let t;t=e?v(e)?{path:e}:typeof e==`string`||E(e)?{value:e}:e:{},this.cwd=`cwd`in t?``:g.cwd(),this.data={},this.history=[],this.messages=[],this.value,this.map,this.result,this.stored;let n=-1;for(;++n<x.length;){let e=x[n];e in t&&t[e]!==void 0&&t[e]!==null&&(this[e]=e===`history`?[...t[e]]:t[e])}let r;for(r in t)x.includes(r)||(this[r]=t[r])}get basename(){return typeof this.path==`string`?c.basename(this.path):void 0}set basename(e){w(e,`basename`),C(e,`basename`),this.path=c.join(this.dirname||``,e)}get dirname(){return typeof this.path==`string`?c.dirname(this.path):void 0}set dirname(e){T(this.basename,`dirname`),this.path=c.join(e||``,this.basename)}get extname(){return typeof this.path==`string`?c.extname(this.path):void 0}set extname(e){if(C(e,`extname`),T(this.dirname,`extname`),e){if(e.codePointAt(0)!==46)throw Error("`extname` must start with `.`");if(e.includes(`.`,1))throw Error("`extname` cannot contain multiple dots")}this.path=c.join(this.dirname,this.stem+(e||``))}get path(){return this.history[this.history.length-1]}set path(e){v(e)&&(e=y(e)),w(e,`path`),this.path!==e&&this.history.push(e)}get stem(){return typeof this.path==`string`?c.basename(this.path,this.extname):void 0}set stem(e){w(e,`stem`),C(e,`stem`),this.path=c.join(this.dirname||``,e+(this.extname||``))}fail(e,t,n){let r=this.message(e,t,n);throw r.fatal=!0,r}info(e,t,n){let r=this.message(e,t,n);return r.fatal=void 0,r}message(e,t,n){let r=new s(e,t,n);return this.path&&(r.name=this.path+`:`+r.name,r.file=this.path),r.fatal=!1,this.messages.push(r),r}toString(e){return this.value===void 0?``:typeof this.value==`string`?this.value:new TextDecoder(e||void 0).decode(this.value)}};function C(e,t){if(e&&e.includes(c.sep))throw Error("`"+t+"` cannot be a path: did not expect `"+c.sep+"`")}function w(e,t){if(!e)throw Error("`"+t+"` cannot be empty")}function T(e,t){if(!e)throw Error("Setting `"+t+"` requires `path` to be set too")}function E(e){return!!(e&&typeof e==`object`&&`byteLength`in e&&`byteOffset`in e)}const D=(function(e){let t=this.constructor.prototype,n=t[e],r=function(){return n.apply(r,arguments)};return Object.setPrototypeOf(r,t),r}),O={}.hasOwnProperty,k=new class e extends D{constructor(){super(`copy`),this.Compiler=void 0,this.Parser=void 0,this.attachers=[],this.compiler=void 0,this.freezeIndex=-1,this.frozen=void 0,this.namespace={},this.parser=void 0,this.transformers=a()}copy(){let t=new e,n=-1;for(;++n<this.attachers.length;){let e=this.attachers[n];t.use(...e)}return t.data((0,o.default)(!0,{},this.namespace)),t}data(e,t){return typeof e==`string`?arguments.length===2?(M(`data`,this.frozen),this.namespace[e]=t,this):O.call(this.namespace,e)&&this.namespace[e]||void 0:e?(M(`data`,this.frozen),this.namespace=e,this):this.namespace}freeze(){if(this.frozen)return this;let e=this;for(;++this.freezeIndex<this.attachers.length;){let[t,...n]=this.attachers[this.freezeIndex];if(n[0]===!1)continue;n[0]===!0&&(n[0]=void 0);let r=t.call(e,...n);typeof r==`function`&&this.transformers.use(r)}return this.frozen=!0,this.freezeIndex=1/0,this}parse(e){this.freeze();let t=F(e),n=this.parser||this.Parser;return A(`parse`,n),n(String(t),t)}process(e,t){let n=this;return this.freeze(),A(`process`,this.parser||this.Parser),j(`process`,this.compiler||this.Compiler),t?r(void 0,t):new Promise(r);function r(r,i){let a=F(e),o=n.parse(a);n.run(o,a,function(e,t,r){if(e||!t||!r)return s(e);let i=t,a=n.stringify(i,r);L(a)?r.value=a:r.result=a,s(e,r)});function s(e,n){e||!n?i(e):r?r(n):t(void 0,n)}}}processSync(e){let t=!1,r;return this.freeze(),A(`processSync`,this.parser||this.Parser),j(`processSync`,this.compiler||this.Compiler),this.process(e,i),P(`processSync`,`process`,t),r;function i(e,i){t=!0,n(e),r=i}}run(e,t,n){N(e),this.freeze();let r=this.transformers;return!n&&typeof t==`function`&&(n=t,t=void 0),n?i(void 0,n):new Promise(i);function i(i,a){let o=F(t);r.run(e,o,s);function s(t,r,o){let s=r||e;t?a(t):i?i(s):n(void 0,s,o)}}}runSync(e,t){let r=!1,i;return this.run(e,t,a),P(`runSync`,`run`,r),i;function a(e,t){n(e),i=t,r=!0}}stringify(e,t){this.freeze();let n=F(t),r=this.compiler||this.Compiler;return j(`stringify`,r),N(e),r(e,n)}use(e,...t){let n=this.attachers,r=this.namespace;if(M(`use`,this.frozen),e!=null)if(typeof e==`function`)l(e,t);else if(typeof e==`object`)Array.isArray(e)?c(e):s(e);else throw TypeError("Expected usable value, not `"+e+"`");return this;function a(e){if(typeof e==`function`)l(e,[]);else if(typeof e==`object`)if(Array.isArray(e)){let[t,...n]=e;l(t,n)}else s(e);else throw TypeError("Expected usable value, not `"+e+"`")}function s(e){if(!(`plugins`in e)&&!(`settings`in e))throw Error("Expected usable value but received an empty preset, which is probably a mistake: presets typically come with `plugins` and sometimes with `settings`, but this has neither");c(e.plugins),e.settings&&(r.settings=(0,o.default)(!0,r.settings,e.settings))}function c(e){let t=-1;if(e!=null)if(Array.isArray(e))for(;++t<e.length;){let n=e[t];a(n)}else throw TypeError("Expected a list of plugins, not `"+e+"`")}function l(e,t){let r=-1,a=-1;for(;++r<n.length;)if(n[r][0]===e){a=r;break}if(a===-1)n.push([e,...t]);else if(t.length>0){let[r,...s]=t,c=n[a][1];i(c)&&i(r)&&(r=(0,o.default)(!0,c,r)),n[a]=[e,r,...s]}}}}().freeze();function A(e,t){if(typeof t!=`function`)throw TypeError("Cannot `"+e+"` without `parser`")}function j(e,t){if(typeof t!=`function`)throw TypeError("Cannot `"+e+"` without `compiler`")}function M(e,t){if(t)throw Error("Cannot call `"+e+"` on a frozen processor.\nCreate a new processor first, by calling it: use `processor()` instead of `processor`.")}function N(e){if(!i(e)||typeof e.type!=`string`)throw TypeError("Expected node, got `"+e+"`")}function P(e,t,n){if(!n)throw Error("`"+e+"` finished async. Use `"+t+"` instead")}function F(e){return I(e)?e:new S(e)}function I(e){return!!(e&&typeof e==`object`&&`message`in e&&`messages`in e)}function L(e){return typeof e==`string`||R(e)}function R(e){return!!(e&&typeof e==`object`&&`byteLength`in e&&`byteOffset`in e)}export{k as t};
@@ -1 +1 @@
1
- import{C as e,H as t,K as n,M as r,O as i,Q as a,T as o,V as s,X as c,Y as l,_ as u,c as d,et as f,h as p,i as m,j as h,m as g}from"./libs/remeda.mjs";import{_t as _,g as v,gt as y,h as b}from"./types.mjs";import{D as x,Q as S,S as C,l as w}from"./utils.mjs";import{castDraft as T,produce as E}from"immer";function D(e,t){let{nodes:n,edges:r,hasManualLayout:i,...a}=e,o=new Map(n.map(e=>[e.id,e])),s=new Map(r.map(e=>[e.id,e])),c=t.nodes.map(e=>{let t=o.get(e.id);return t?{...t,x:e.x,y:e.y,width:e.width,height:e.height,labelBBox:e.labelBBox}:e}),l=t.edges.map(e=>{let t=s.get(e.id);return t?{...t,points:e.points,label:e.label,labelBBox:e.labelBBox,...e.controlPoints!=null&&{controlPoints:e.controlPoints}}:e}),u={...t,...a,[_]:`layouted`,bounds:t.bounds,nodes:c,edges:l};return i?u[y]=`auto`:delete u[y],u}function O(r){return f(r,l(e=>!!e.notation),t(g(`notation`)),e(p(t(g(`shape`)),e(p(t(g(`color`)),e(p(o(g(`kind`)),m())),c(),o(([e,t])=>({kinds:t,color:e})))),c(),n(([e,t])=>t.map(({color:t,kinds:n})=>({shape:e,color:t,kinds:n}))))),c(),n(([e,t])=>t.map(({shape:t,color:n,kinds:r})=>({title:e,shape:t,color:n,kinds:r}))),d(g(`shape`),g(`title`),[e=>e.kinds.length,`desc`]))}const k=(e,t)=>e===t||r(e)&&r(t)?!1:!s(e,t);function A(e,t){e.color=t.color,e.kind=t.kind,e.navigateTo=t.navigateTo??null,e.links=t.links?[...t.links]:null,e.tags=[...t.tags],r(t.style.border)?delete e.style.border:e.style.border=t.style.border,h(t.style.opacity)?e.style.opacity=t.style.opacity:delete e.style.opacity,r(t.style.multiple)?delete e.style.multiple:e.style.multiple=t.style.multiple}function j(e,t,n){if(k(t.icon??`none`,e.icon??`none`)){let a=i(e.icon)&&e.icon!==`none`;switch(!0){case a&&i(t.icon)&&t.icon!==`none`:return e.icon=t.icon,!0;case a&&(r(t.icon)||t.icon===`none`):return e.icon=`none`,!0;case!a&&i(t.icon)&&t.icon!==`none`:return n?(e.icon=t.icon,!0):!1}}return!0}function M(e,t,n){let i=!0;return k(e.style.iconColor,t.style.iconColor)&&(r(t.style.iconColor)?delete e.style.iconColor:e.style.iconColor=t.style.iconColor),k(e.style.iconSize,t.style.iconSize)&&(n?r(t.style.iconSize)?delete e.style.iconSize:e.style.iconSize=t.style.iconSize:i=!1),k(e.style.iconPosition,t.style.iconPosition)&&(n?r(t.style.iconPosition)?delete e.style.iconPosition:e.style.iconPosition=t.style.iconPosition:i=!1),i}function N(e,t){return e?`md`in t?(e.md=t.md,delete e.txt,e):(`txt`in t&&(e.txt=t.txt,delete e.md),e):t}function P(e,t,n){let i=!0;return k(e.title,t.title)&&(n?e.title=t.title:i=!1),k(e.description,t.description)&&(r(t.description)?delete e.description:n?e.description=N(e.description,t.description):i=!1),k(e.technology,t.technology)&&(r(t.technology)?delete e.technology:n?e.technology=t.technology:i=!1),i}function F(e,t,n){return e.title=t.title,r(t.description)?delete e.description:e.description=N(e.description,t.description),r(t.technology)?delete e.technology:e.technology=t.technology,!0}function I(e,t){S(e.id===t.id,`applyManualLayout: view ids do not match`),S(e._stage===`layouted`,`applyManualLayout: expected layouted view`),S(t._stage===`layouted`,`applyManualLayout: expected layouted snapshot`),S(e._layout!==`manual`,`applyManualLayout: expected auto-layouted view`);let n=new Set;e._type!==t._type&&n.add(`type-changed`);let r=L(t.nodes,e.nodes,n),i=R(t.edges,e.edges,n),o=O(r);return E(t,s=>{s.title=e.title??t.title,s.description=e.description??t.description,s.tags=e.tags?[...e.tags]:null,s.links=e.links?[...e.links]:null,s.sourcePath=e.sourcePath,s[y]=`manual`,o&&o.length>0?s.notation={nodes:o}:delete s.notation,s.nodes=T(r),s.edges=T(i),b(e)&&s._type===`dynamic`&&(s.variant=e.variant),v(e)&&s._type===`element`&&(e.viewOf?s.viewOf=e.viewOf:delete s.viewOf,e.extends?s.extends=e.extends:delete s.extends);let c=[...n];a(c,1)?s.drifts=c:(s.hash=e.hash,delete s.drifts)})}function L(e,t,n){let i=new Map(t.map(e=>[e.id,e])),o=e.map(e=>{let t=i.get(e.id);return t?(i.delete(t.id),E(e,i=>{A(i,t);let o=new Set,s=e.children.length>0,c=t.children.length>0;(k(i.modelRef,t.modelRef)||k(i.deploymentRef,t.deploymentRef))&&o.add(`modelRef-changed`),c&&!s&&o.add(`became-compound`),!c&&s&&o.add(`became-leaf`),k(i.parent,t.parent)&&o.add(`parent-changed`);let l=i.width+5>=t.width&&i.height+5>=t.height;k(i.shape,t.shape)&&(l?i.shape=t.shape:o.add(`shape-changed`)),M(i,t,l)||o.add(`label-changed`),j(i,t,l&&c===s)||o.add(`label-changed`),(s?F:P)(i,t,l)||o.add(`label-changed`),k(i.notes,t.notes)&&(r(t.notes)?delete i.notes:i.notes=N(i.notes,t.notes)),k(e.notation,t.notation)&&(i.notation=t.notation??null),s&&c&&w(new Set(e.children),new Set(t.children)).size>0&&o.add(`children-changed`);let u=[...o];a(u,1)?(n.add(`nodes-drift`),i.drifts=u):delete i.drifts})):(n.add(`nodes-removed`),{...e,drifts:[`removed`]})});return i.size>0&&n.add(`nodes-added`),o}function R(e,t,n){let i=new Map(t.map(e=>[e.id,e])),o=e.map(e=>{let t=i.get(e.id)??f(i.values(),x(t=>t.source===e.source&&t.target===e.target),C());return t&&i.delete(t.id),E(e,i=>{if(!t){i.drifts=[`removed`],n.add(`edges-removed`);return}let o=new Set,s=e.id===t.id;switch(!0){case s&&e.source==t.source&&e.target==t.target:k(i.dir??`forward`,t.dir??`forward`)&&o.add(`direction-changed`);break;case s&&e.source==t.target&&e.target==t.source:e.source!==e.target&&o.add(`direction-changed`);break;case s:e.source!=t.source&&o.add(`source-changed`),e.target!=t.target&&o.add(`target-changed`);break;default:S(e.id!=t.id,`Unexpected case in edge drift detection, ids should not match`),S(e.source==t.source,`Unexpected case in edge drift detection, sources should match`),S(e.target==t.target,`Unexpected case in edge drift detection, targets should match`),k(i.dir??`forward`,t.dir??`forward`)&&o.add(`direction-changed`);break}if(i.color=t.color,i.line=t.line,i.navigateTo=t.navigateTo??null,i.tags=t.tags?[...t.tags]:null,k(e.notes,t.notes)&&(r(e.notes)!==r(t.notes)&&o.add(`notes-changed`),i.notes=t.notes??e.notes),t.astPath?i.astPath=t.astPath:delete i.astPath,k(u(e,[`label`,`description`,`technology`,`labelBBox`]),u(t,[`label`,`description`,`technology`,`labelBBox`])))switch(!0){case t.labelBBox&&!e.labelBBox:o.add(`label-added`);break;case e.labelBBox&&!t.labelBBox:o.add(`label-removed`);break;case!!e.labelBBox&&!!t.labelBBox:t.labelBBox.width*t.labelBBox.height>(e.labelBBox.width+5)*(e.labelBBox.height+5)&&(i.labelBBox.width=Math.round(t.labelBBox.width),i.labelBBox.height=Math.round(t.labelBBox.height)),k(e.label,t.label)&&(r(t.label)!==r(e.label)&&o.add(`label-changed`),i.label=t.label??e.label),k(e.description,t.description)&&(r(t.description)!==r(e.description)&&o.add(`label-changed`),t.description&&(i.description=N(e.description,t.description))),k(e.technology,t.technology)&&(r(t.technology)!==r(e.technology)&&o.add(`label-changed`),i.technology=t.technology??e.technology??null);break;default:S(!e.labelBBox,`Unexpected case in edge labelBBox drift detection`),S(!t.labelBBox,`Unexpected case in next labelBBox drift detection`);break}let c=[...o];a(c,1)?(n.add(`edges-drift`),i.drifts=c):delete i.drifts})});return i.size>0&&n.add(`edges-added`),o}function z(e,t){let{drifts:n,...r}=I(e,t);if(!n||n.length===0)return E(e,e=>{delete e.drifts,e[y]=`auto`});let i=new Set;n.includes(`type-changed`)&&i.add(`type-changed`);let o=new Map(r.nodes.map(e=>[e.id,e])),s=new Map(r.edges.map(e=>[e.id,e])),c=e.nodes.map(e=>{let t=o.get(e.id);return t&&o.delete(t.id),E(e,e=>{if(!t){i.add(`nodes-added`),e.drifts=[`added`];return}t.drifts?(i.add(`nodes-drift`),e.drifts=[...t.drifts]):delete e.drifts})});o.size>0&&i.add(`nodes-removed`);let l=e.edges.map(e=>{let t=s.get(e.id)??f(s.values(),x(t=>t.source===e.source&&t.target===e.target),C());return t&&s.delete(t.id),E(e,e=>{if(!t){i.add(`edges-added`),e.drifts=[`added`];return}t.drifts?(i.add(`edges-drift`),e.drifts=[...t.drifts]):delete e.drifts})});s.size>0&&i.add(`edges-removed`);let u=[...i];return E(e,e=>{a(u,1)?e.drifts=u:delete e.drifts,e.nodes=T(c),e.edges=T(l),e[y]=`auto`})}export{D as i,I as n,O as r,z as t};
1
+ import{C as e,H as t,K as n,M as r,O as i,Q as a,T as o,V as s,X as c,Y as l,_ as u,c as d,et as f,h as p,i as m,j as h,m as g}from"./libs/remeda.mjs";import{Sn as _,Wt as v,Yt as y,_t as b,g as x,gt as S,h as C,jt as w}from"./types.mjs";import{castDraft as T,produce as E}from"immer";function D(e,t){let{nodes:n,edges:r,hasManualLayout:i,...a}=e,o=new Map(n.map(e=>[e.id,e])),s=new Map(r.map(e=>[e.id,e])),c=t.nodes.map(e=>{let t=o.get(e.id);return t?{...t,x:e.x,y:e.y,width:e.width,height:e.height,labelBBox:e.labelBBox}:e}),l=t.edges.map(e=>{let t=s.get(e.id);return t?{...t,points:e.points,label:e.label,labelBBox:e.labelBBox,...e.controlPoints!=null&&{controlPoints:e.controlPoints}}:e}),u={...t,...a,[b]:`layouted`,bounds:t.bounds,nodes:c,edges:l};return i?u[S]=`auto`:delete u[S],u}function O(r){return f(r,l(e=>!!e.notation),t(g(`notation`)),e(p(t(g(`shape`)),e(p(t(g(`color`)),e(p(o(g(`kind`)),m())),c(),o(([e,t])=>({kinds:t,color:e})))),c(),n(([e,t])=>t.map(({color:t,kinds:n})=>({shape:e,color:t,kinds:n}))))),c(),n(([e,t])=>t.map(({shape:t,color:n,kinds:r})=>({title:e,shape:t,color:n,kinds:r}))),d(g(`shape`),g(`title`),[e=>e.kinds.length,`desc`]))}const k=(e,t)=>e===t||r(e)&&r(t)?!1:!s(e,t);function A(e,t){e.color=t.color,e.kind=t.kind,e.navigateTo=t.navigateTo??null,e.links=t.links?[...t.links]:null,e.tags=[...t.tags],r(t.style.border)?delete e.style.border:e.style.border=t.style.border,h(t.style.opacity)?e.style.opacity=t.style.opacity:delete e.style.opacity,r(t.style.multiple)?delete e.style.multiple:e.style.multiple=t.style.multiple}function j(e,t,n){if(k(t.icon??`none`,e.icon??`none`)){let a=i(e.icon)&&e.icon!==`none`;switch(!0){case a&&i(t.icon)&&t.icon!==`none`:return e.icon=t.icon,!0;case a&&(r(t.icon)||t.icon===`none`):return e.icon=`none`,!0;case!a&&i(t.icon)&&t.icon!==`none`:return n?(e.icon=t.icon,!0):!1}}return!0}function M(e,t,n){let i=!0;return k(e.style.iconColor,t.style.iconColor)&&(r(t.style.iconColor)?delete e.style.iconColor:e.style.iconColor=t.style.iconColor),k(e.style.iconSize,t.style.iconSize)&&(n?r(t.style.iconSize)?delete e.style.iconSize:e.style.iconSize=t.style.iconSize:i=!1),k(e.style.iconPosition,t.style.iconPosition)&&(n?r(t.style.iconPosition)?delete e.style.iconPosition:e.style.iconPosition=t.style.iconPosition:i=!1),i}function N(e,t){return e?`md`in t?(e.md=t.md,delete e.txt,e):(`txt`in t&&(e.txt=t.txt,delete e.md),e):t}function P(e,t,n){let i=!0;return k(e.title,t.title)&&(n?e.title=t.title:i=!1),k(e.description,t.description)&&(r(t.description)?delete e.description:n?e.description=N(e.description,t.description):i=!1),k(e.technology,t.technology)&&(r(t.technology)?delete e.technology:n?e.technology=t.technology:i=!1),i}function F(e,t,n){return e.title=t.title,r(t.description)?delete e.description:e.description=N(e.description,t.description),r(t.technology)?delete e.technology:e.technology=t.technology,!0}function I(e,t){_(e.id===t.id,`applyManualLayout: view ids do not match`),_(e._stage===`layouted`,`applyManualLayout: expected layouted view`),_(t._stage===`layouted`,`applyManualLayout: expected layouted snapshot`),_(e._layout!==`manual`,`applyManualLayout: expected auto-layouted view`);let n=new Set;e._type!==t._type&&n.add(`type-changed`);let r=L(t.nodes,e.nodes,n),i=R(t.edges,e.edges,n),o=O(r);return E(t,s=>{s.title=e.title??t.title,s.description=e.description??t.description,s.tags=e.tags?[...e.tags]:null,s.links=e.links?[...e.links]:null,s.sourcePath=e.sourcePath,s[S]=`manual`,o&&o.length>0?s.notation={nodes:o}:delete s.notation,s.nodes=T(r),s.edges=T(i),C(e)&&s._type===`dynamic`&&(s.variant=e.variant),x(e)&&s._type===`element`&&(e.viewOf?s.viewOf=e.viewOf:delete s.viewOf,e.extends?s.extends=e.extends:delete s.extends);let c=[...n];a(c,1)?s.drifts=c:(s.hash=e.hash,delete s.drifts)})}function L(e,t,n){let i=new Map(t.map(e=>[e.id,e])),o=e.map(e=>{let t=i.get(e.id);return t?(i.delete(t.id),E(e,i=>{A(i,t);let o=new Set,s=e.children.length>0,c=t.children.length>0;(k(i.modelRef,t.modelRef)||k(i.deploymentRef,t.deploymentRef))&&o.add(`modelRef-changed`),c&&!s&&o.add(`became-compound`),!c&&s&&o.add(`became-leaf`),k(i.parent,t.parent)&&o.add(`parent-changed`);let l=i.width+5>=t.width&&i.height+5>=t.height;k(i.shape,t.shape)&&(l?i.shape=t.shape:o.add(`shape-changed`)),M(i,t,l)||o.add(`label-changed`),j(i,t,l&&c===s)||o.add(`label-changed`),(s?F:P)(i,t,l)||o.add(`label-changed`),k(i.notes,t.notes)&&(r(t.notes)?delete i.notes:i.notes=N(i.notes,t.notes)),k(e.notation,t.notation)&&(i.notation=t.notation??null),s&&c&&w(new Set(e.children),new Set(t.children)).size>0&&o.add(`children-changed`);let u=[...o];a(u,1)?(n.add(`nodes-drift`),i.drifts=u):delete i.drifts})):(n.add(`nodes-removed`),{...e,drifts:[`removed`]})});return i.size>0&&n.add(`nodes-added`),o}function R(e,t,n){let i=new Map(t.map(e=>[e.id,e])),o=e.map(e=>{let t=i.get(e.id)??f(i.values(),y(t=>t.source===e.source&&t.target===e.target),v());return t&&i.delete(t.id),E(e,i=>{if(!t){i.drifts=[`removed`],n.add(`edges-removed`);return}let o=new Set,s=e.id===t.id;switch(!0){case s&&e.source==t.source&&e.target==t.target:k(i.dir??`forward`,t.dir??`forward`)&&o.add(`direction-changed`);break;case s&&e.source==t.target&&e.target==t.source:e.source!==e.target&&o.add(`direction-changed`);break;case s:e.source!=t.source&&o.add(`source-changed`),e.target!=t.target&&o.add(`target-changed`);break;default:_(e.id!=t.id,`Unexpected case in edge drift detection, ids should not match`),_(e.source==t.source,`Unexpected case in edge drift detection, sources should match`),_(e.target==t.target,`Unexpected case in edge drift detection, targets should match`),k(i.dir??`forward`,t.dir??`forward`)&&o.add(`direction-changed`);break}if(i.color=t.color,i.line=t.line,i.navigateTo=t.navigateTo??null,i.tags=t.tags?[...t.tags]:null,k(e.notes,t.notes)&&(r(e.notes)!==r(t.notes)&&o.add(`notes-changed`),i.notes=t.notes??e.notes),t.astPath?i.astPath=t.astPath:delete i.astPath,k(u(e,[`label`,`description`,`technology`,`labelBBox`]),u(t,[`label`,`description`,`technology`,`labelBBox`])))switch(!0){case t.labelBBox&&!e.labelBBox:o.add(`label-added`);break;case e.labelBBox&&!t.labelBBox:o.add(`label-removed`);break;case!!e.labelBBox&&!!t.labelBBox:t.labelBBox.width*t.labelBBox.height>(e.labelBBox.width+5)*(e.labelBBox.height+5)&&(i.labelBBox.width=Math.round(t.labelBBox.width),i.labelBBox.height=Math.round(t.labelBBox.height)),k(e.label,t.label)&&(r(t.label)!==r(e.label)&&o.add(`label-changed`),i.label=t.label??e.label),k(e.description,t.description)&&(r(t.description)!==r(e.description)&&o.add(`label-changed`),t.description&&(i.description=N(e.description,t.description))),k(e.technology,t.technology)&&(r(t.technology)!==r(e.technology)&&o.add(`label-changed`),i.technology=t.technology??e.technology??null);break;default:_(!e.labelBBox,`Unexpected case in edge labelBBox drift detection`),_(!t.labelBBox,`Unexpected case in next labelBBox drift detection`);break}let c=[...o];a(c,1)?(n.add(`edges-drift`),i.drifts=c):delete i.drifts})});return i.size>0&&n.add(`edges-added`),o}function z(e,t){let{drifts:n,...r}=I(e,t);if(!n||n.length===0)return E(e,e=>{delete e.drifts,e[S]=`auto`});let i=new Set;n.includes(`type-changed`)&&i.add(`type-changed`);let o=new Map(r.nodes.map(e=>[e.id,e])),s=new Map(r.edges.map(e=>[e.id,e])),c=e.nodes.map(e=>{let t=o.get(e.id);return t&&o.delete(t.id),E(e,e=>{if(!t){i.add(`nodes-added`),e.drifts=[`added`];return}t.drifts?(i.add(`nodes-drift`),e.drifts=[...t.drifts]):delete e.drifts})});o.size>0&&i.add(`nodes-removed`);let l=e.edges.map(e=>{let t=s.get(e.id)??f(s.values(),y(t=>t.source===e.source&&t.target===e.target),v());return t&&s.delete(t.id),E(e,e=>{if(!t){i.add(`edges-added`),e.drifts=[`added`];return}t.drifts?(i.add(`edges-drift`),e.drifts=[...t.drifts]):delete e.drifts})});s.size>0&&i.add(`edges-removed`);let u=[...i];return E(e,e=>{a(u,1)?e.drifts=u:delete e.drifts,e.nodes=T(c),e.edges=T(l),e[S]=`auto`})}export{D as i,I as n,O as r,z as t};
@@ -1 +1 @@
1
- export { };
1
+ import "./libs/mnemonist.mjs";