data-structure-typed 1.21.2 → 1.21.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +14 -17
- package/dist/bundle.js +1 -1
- package/dist/data-structures/binary-tree/abstract-binary-tree.d.ts +3 -3
- package/dist/data-structures/binary-tree/abstract-binary-tree.js +1 -1
- package/dist/data-structures/binary-tree/avl-tree.d.ts +2 -2
- package/dist/data-structures/binary-tree/binary-tree.d.ts +2 -2
- package/dist/data-structures/binary-tree/bst.d.ts +3 -3
- package/dist/data-structures/binary-tree/bst.js +1 -1
- package/dist/data-structures/binary-tree/rb-tree.d.ts +2 -2
- package/dist/data-structures/binary-tree/rb-tree.js +1 -1
- package/dist/data-structures/binary-tree/segment-tree.d.ts +1 -1
- package/dist/data-structures/binary-tree/tree-multiset.d.ts +3 -3
- package/dist/data-structures/binary-tree/tree-multiset.js +1 -1
- package/dist/data-structures/graph/abstract-graph.d.ts +8 -8
- package/dist/data-structures/graph/abstract-graph.js +6 -6
- package/dist/data-structures/graph/directed-graph.d.ts +2 -2
- package/dist/data-structures/graph/map-graph.d.ts +1 -1
- package/dist/data-structures/graph/undirected-graph.d.ts +2 -2
- package/dist/data-structures/heap/heap.d.ts +1 -1
- package/dist/data-structures/heap/heap.js +1 -1
- package/dist/data-structures/heap/max-heap.d.ts +1 -1
- package/dist/data-structures/heap/min-heap.d.ts +1 -1
- package/dist/data-structures/index.d.ts +0 -2
- package/dist/data-structures/index.js +0 -2
- package/dist/data-structures/matrix/navigator.d.ts +1 -1
- package/dist/data-structures/priority-queue/max-priority-queue.d.ts +1 -1
- package/dist/data-structures/priority-queue/min-priority-queue.d.ts +1 -1
- package/dist/data-structures/priority-queue/priority-queue.d.ts +1 -1
- package/dist/index.d.ts +2 -0
- package/dist/index.js +2 -0
- package/dist/{data-structures/interfaces → interfaces}/abstract-binary-tree.d.ts +1 -1
- package/dist/{data-structures/interfaces → interfaces}/avl-tree.d.ts +1 -1
- package/dist/{data-structures/interfaces → interfaces}/binary-tree.d.ts +1 -1
- package/dist/{data-structures/interfaces → interfaces}/bst.d.ts +1 -1
- package/dist/{data-structures/interfaces → interfaces}/rb-tree.d.ts +1 -1
- package/dist/{data-structures/interfaces → interfaces}/tree-multiset.d.ts +1 -1
- package/dist/{data-structures/types → types/data-structures}/abstract-binary-tree.d.ts +1 -1
- package/dist/{data-structures/types → types/data-structures}/avl-tree.d.ts +1 -1
- package/dist/{data-structures/types → types/data-structures}/binary-tree.d.ts +1 -1
- package/dist/{data-structures/types → types/data-structures}/bst.d.ts +1 -1
- package/dist/{data-structures/types → types/data-structures}/index.d.ts +0 -1
- package/dist/{data-structures/types → types/data-structures}/index.js +0 -1
- package/dist/{data-structures/types → types/data-structures}/rb-tree.d.ts +1 -1
- package/dist/{data-structures/types → types/data-structures}/tree-multiset.d.ts +1 -1
- package/dist/types/index.d.ts +3 -0
- package/dist/types/index.js +19 -0
- package/dist/utils/index.d.ts +0 -2
- package/dist/utils/index.js +0 -2
- package/dist/utils/utils.d.ts +1 -1
- package/package.json +21 -24
- package/.dependency-cruiser.js +0 -449
- package/dist/utils/validate-type.d.ts +0 -45
- package/dist/utils/validate-type.js +0 -58
- package/jest.config.js +0 -5
- package/rename_clear_files.sh +0 -29
- package/tsconfig.json +0 -38
- package/webpack.config.js +0 -27
- /package/dist/{data-structures/interfaces → interfaces}/abstract-binary-tree.js +0 -0
- /package/dist/{data-structures/interfaces → interfaces}/abstract-graph.d.ts +0 -0
- /package/dist/{data-structures/interfaces → interfaces}/abstract-graph.js +0 -0
- /package/dist/{data-structures/interfaces → interfaces}/avl-tree.js +0 -0
- /package/dist/{data-structures/interfaces → interfaces}/binary-tree.js +0 -0
- /package/dist/{data-structures/interfaces → interfaces}/bst.js +0 -0
- /package/dist/{data-structures/interfaces → interfaces}/directed-graph.d.ts +0 -0
- /package/dist/{data-structures/interfaces → interfaces}/directed-graph.js +0 -0
- /package/dist/{data-structures/interfaces → interfaces}/doubly-linked-list.d.ts +0 -0
- /package/dist/{data-structures/interfaces → interfaces}/doubly-linked-list.js +0 -0
- /package/dist/{data-structures/interfaces → interfaces}/heap.d.ts +0 -0
- /package/dist/{data-structures/interfaces → interfaces}/heap.js +0 -0
- /package/dist/{data-structures/interfaces → interfaces}/index.d.ts +0 -0
- /package/dist/{data-structures/interfaces → interfaces}/index.js +0 -0
- /package/dist/{data-structures/interfaces → interfaces}/navigator.d.ts +0 -0
- /package/dist/{data-structures/interfaces → interfaces}/navigator.js +0 -0
- /package/dist/{data-structures/interfaces → interfaces}/priority-queue.d.ts +0 -0
- /package/dist/{data-structures/interfaces → interfaces}/priority-queue.js +0 -0
- /package/dist/{data-structures/interfaces → interfaces}/rb-tree.js +0 -0
- /package/dist/{data-structures/interfaces → interfaces}/segment-tree.d.ts +0 -0
- /package/dist/{data-structures/interfaces → interfaces}/segment-tree.js +0 -0
- /package/dist/{data-structures/interfaces → interfaces}/singly-linked-list.d.ts +0 -0
- /package/dist/{data-structures/interfaces → interfaces}/singly-linked-list.js +0 -0
- /package/dist/{data-structures/interfaces → interfaces}/tree-multiset.js +0 -0
- /package/dist/{data-structures/interfaces → interfaces}/undirected-graph.d.ts +0 -0
- /package/dist/{data-structures/interfaces → interfaces}/undirected-graph.js +0 -0
- /package/dist/{data-structures/types → types/data-structures}/abstract-binary-tree.js +0 -0
- /package/dist/{data-structures/types → types/data-structures}/abstract-graph.d.ts +0 -0
- /package/dist/{data-structures/types → types/data-structures}/abstract-graph.js +0 -0
- /package/dist/{data-structures/types → types/data-structures}/avl-tree.js +0 -0
- /package/dist/{data-structures/types → types/data-structures}/binary-tree.js +0 -0
- /package/dist/{data-structures/types → types/data-structures}/bst.js +0 -0
- /package/dist/{data-structures/types → types/data-structures}/directed-graph.d.ts +0 -0
- /package/dist/{data-structures/types → types/data-structures}/directed-graph.js +0 -0
- /package/dist/{data-structures/types → types/data-structures}/doubly-linked-list.d.ts +0 -0
- /package/dist/{data-structures/types → types/data-structures}/doubly-linked-list.js +0 -0
- /package/dist/{data-structures/types → types/data-structures}/heap.d.ts +0 -0
- /package/dist/{data-structures/types → types/data-structures}/heap.js +0 -0
- /package/dist/{data-structures/types → types/data-structures}/map-graph.d.ts +0 -0
- /package/dist/{data-structures/types → types/data-structures}/map-graph.js +0 -0
- /package/dist/{data-structures/types → types/data-structures}/navigator.d.ts +0 -0
- /package/dist/{data-structures/types → types/data-structures}/navigator.js +0 -0
- /package/dist/{data-structures/types → types/data-structures}/priority-queue.d.ts +0 -0
- /package/dist/{data-structures/types → types/data-structures}/priority-queue.js +0 -0
- /package/dist/{data-structures/types → types/data-structures}/rb-tree.js +0 -0
- /package/dist/{data-structures/types → types/data-structures}/segment-tree.d.ts +0 -0
- /package/dist/{data-structures/types → types/data-structures}/segment-tree.js +0 -0
- /package/dist/{data-structures/types → types/data-structures}/singly-linked-list.d.ts +0 -0
- /package/dist/{data-structures/types → types/data-structures}/singly-linked-list.js +0 -0
- /package/dist/{data-structures/types → types/data-structures}/tree-multiset.js +0 -0
- /package/dist/{data-structures/types → types}/helpers.d.ts +0 -0
- /package/dist/{data-structures/types → types}/helpers.js +0 -0
- /package/dist/{utils/types → types/utils}/index.d.ts +0 -0
- /package/dist/{utils/types → types/utils}/index.js +0 -0
- /package/dist/{utils/types → types/utils}/utils.d.ts +0 -0
- /package/dist/{utils/types → types/utils}/utils.js +0 -0
- /package/dist/{utils/types → types/utils}/validate-type.d.ts +0 -0
- /package/dist/{utils/types → types/utils}/validate-type.js +0 -0
package/dist/bundle.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/*! For license information please see bundle.js.LICENSE.txt */
|
|
2
|
-
(()=>{"use strict";var e={1925:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.AaTree=void 0,t.AaTree=class{}},6279:(e,t,s)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.AbstractBinaryTree=t.AbstractBinaryTreeNode=void 0;const r=s(5928),i=s(9011);class n{constructor(e,t){this._height=0,this._id=e,this._val=t}get id(){return this._id}set id(e){this._id=e}get val(){return this._val}set val(e){this._val=e}get left(){return this._left}set left(e){e&&(e.parent=this),this._left=e}get right(){return this._right}set right(e){e&&(e.parent=this),this._right=e}get parent(){return this._parent}set parent(e){this._parent=e}get height(){return this._height}set height(e){this._height=e}get familyPosition(){const e=this;return e.parent?e.parent.left===e?e.left||e.right?i.FamilyPosition.ROOT_LEFT:i.FamilyPosition.LEFT:e.parent.right===e?e.left||e.right?i.FamilyPosition.ROOT_RIGHT:i.FamilyPosition.RIGHT:i.FamilyPosition.MAL_NODE:e.left||e.right?i.FamilyPosition.ROOT:i.FamilyPosition.ISOLATED}}t.AbstractBinaryTreeNode=n,t.AbstractBinaryTree=class{constructor(e){if(this._root=null,this._size=0,this._loopType=i.LoopType.ITERATIVE,this._visitedId=[],this._visitedVal=[],this._visitedNode=[],this._visitedLeftSum=[],void 0!==e){const{loopType:t=i.LoopType.ITERATIVE}=e;this._loopType=t}this.clear()}get root(){return this._root}get size(){return this._size}get loopType(){return this._loopType}get visitedId(){return this._visitedId}get visitedVal(){return this._visitedVal}get visitedNode(){return this._visitedNode}get visitedLeftSum(){return this._visitedLeftSum}swapLocation(e,t){const{id:s,val:r,height:i}=t,n=this.createNode(s,r);return n&&(n.height=i,t.id=e.id,t.val=e.val,t.height=e.height,e.id=n.id,e.val=n.val,e.height=n.height),t}clear(){this._root=null,this._size=0,this._clearResults()}isEmpty(){return 0===this.size}add(e,t){let s,r;if(null===e)r=null;else if("number"==typeof e)r=this.createNode(e,t);else{if(!(e instanceof n))return;r=e}const i=e?this.get(e,"id"):void 0;return this.root?i?(i.val=t,s=i):s=((e,t)=>{const s=[e];for(;s.length>0;){const e=s.shift();if(!e)return;{if(t&&e.id===t.id)return;const r=this._addTo(t,e);if(void 0!==r)return r;e.left&&s.push(e.left),e.right&&s.push(e.right)}}})(this.root,r):(this._setRoot(r),null!==r?this._setSize(1):this._setSize(0),s=this.root),s}addMany(e,t){var s;const r=[],i=new Map;for(const t of e)i.set(t,(null!==(s=i.get(t))&&void 0!==s?s:0)+1);for(let s=0;s<e.length;s++){const o=e[s];if(i.has(o)){if(o instanceof n){r.push(this.add(o.id,o.val));continue}if(null===o){r.push(this.add(null));continue}const e=null==t?void 0:t[s];r.push(this.add(o,e)),i.delete(o)}}return r}fill(e,t){return this.clear(),e.length===this.addMany(e,t).length}remove(e,t){const s=[];if(!this.root)return s;const r="number"==typeof e?this.get(e):e;if(!r)return s;const n=(null==r?void 0:r.parent)?r.parent:null;let o=null,a=r;if(r.left){const e=r.left?this.getRightMost(r.left):null;if(e){const t=e.parent;a=this.swapLocation(r,e),t&&(t.right===e?t.right=e.left:t.left=e.left,o=t)}}else if(n){const{familyPosition:e}=r;e===i.FamilyPosition.LEFT||e===i.FamilyPosition.ROOT_LEFT?n.left=r.right:e!==i.FamilyPosition.RIGHT&&e!==i.FamilyPosition.ROOT_RIGHT||(n.right=r.right),o=n}else void 0!==r.right&&this._setRoot(r.right);return this._setSize(this.size-1),s.push({deleted:a,needBalanced:o}),s}getDepth(e){"number"==typeof e&&(e=this.get(e,"id"));let t=0;for(;null==e?void 0:e.parent;)t++,e=e.parent;return t}getHeight(e){if("number"==typeof(e=null!=e?e:this.root)&&(e=this.get(e,"id")),!e)return-1;if(this._loopType===i.LoopType.RECURSIVE){const t=e=>{if(!e)return-1;const s=t(e.left),r=t(e.right);return Math.max(s,r)+1};return t(e)}{if(!e)return-1;const t=[{node:e,depth:0}];let s=0;for(;t.length>0;){const{node:e,depth:r}=t.pop();e.left&&t.push({node:e.left,depth:r+1}),e.right&&t.push({node:e.right,depth:r+1}),s=Math.max(s,r)}return s}}getMinHeight(e){var t,s,r;if(!(e=e||this.root))return-1;if(this._loopType===i.LoopType.RECURSIVE){const t=e=>{if(!e)return 0;if(!e.left&&!e.right)return 0;const s=t(e.left),r=t(e.right);return Math.min(s,r)+1};return t(e)}{const i=[];let n=e,o=null;const a=new Map;for(;i.length>0||n;)if(n)i.push(n),n=n.left;else if(n=i[i.length-1],n.right&&o!==n.right)n=n.right;else if(n=i.pop(),n){const e=n.left&&null!==(t=a.get(n.left))&&void 0!==t?t:-1,r=n.right&&null!==(s=a.get(n.right))&&void 0!==s?s:-1;a.set(n,1+Math.min(e,r)),o=n,n=null}return null!==(r=a.get(e))&&void 0!==r?r:-1}}isPerfectlyBalanced(e){return this.getMinHeight(e)+1>=this.getHeight(e)}getNodes(e,t,s){if(!this.root)return[];t=null!=t?t:"id";const r=[];if(this.loopType===i.LoopType.RECURSIVE){const i=n=>{this._pushByPropertyNameStopOrNot(n,r,e,t,s)||(n.left||n.right)&&(n.left&&i(n.left),n.right&&i(n.right))};i(this.root)}else{const i=[this.root];for(;i.length>0;){const n=i.shift();if(n){if(this._pushByPropertyNameStopOrNot(n,r,e,t,s))return r;n.left&&i.push(n.left),n.right&&i.push(n.right)}}}return r}has(e,t){return t=null!=t?t:"id",this.getNodes(e,t).length>0}get(e,t){var s;return t=null!=t?t:"id",null!==(s=this.getNodes(e,t,!0)[0])&&void 0!==s?s:null}getPathToRoot(e){const t=[];for(;e.parent;)t.unshift(e),e=e.parent;return t.unshift(e),t}getLeftMost(e){if("number"==typeof e&&(e=this.get(e,"id")),!(e=null!=e?e:this.root))return e;if(this._loopType===i.LoopType.RECURSIVE){const t=e=>e.left?t(e.left):e;return t(e)}{const t=(0,r.trampoline)((e=>e.left?t.cont(e.left):e));return t(e)}}getRightMost(e){if(!(e=null!=e?e:this.root))return e;if(this._loopType===i.LoopType.RECURSIVE){const t=e=>e.right?t(e.right):e;return t(e)}{const t=(0,r.trampoline)((e=>e.right?t.cont(e.right):e));return t(e)}}isSubtreeBST(e){if(!e)return!0;if(this._loopType===i.LoopType.RECURSIVE){const t=(e,s,r)=>!e||!(e.id<=s||e.id>=r)&&t(e.left,s,e.id)&&t(e.right,e.id,r);return t(e,Number.MIN_SAFE_INTEGER,Number.MAX_SAFE_INTEGER)}{const t=[];let s=Number.MIN_SAFE_INTEGER,r=e;for(;r||t.length>0;){for(;r;)t.push(r),r=r.left;if(r=t.pop(),!r||s>=r.id)return!1;s=r.id,r=r.right}return!0}}isBST(){return this.isSubtreeBST(this.root)}getSubTreeSize(e){let t=0;if(!e)return t;if(this._loopType===i.LoopType.RECURSIVE){const s=e=>{t++,e.left&&s(e.left),e.right&&s(e.right)};return s(e),t}{const s=[e];for(;s.length>0;){const e=s.pop();t++,e.right&&s.push(e.right),e.left&&s.push(e.left)}return t}}subTreeSum(e,t){if(t=null!=t?t:"id","number"==typeof e&&(e=this.get(e,"id")),!e)return 0;let s=0;const r=e=>{let s;switch(t){case"id":default:s=e.id;break;case"val":s="number"==typeof e.val?e.val:0}return s};if(this._loopType===i.LoopType.RECURSIVE){const t=e=>{s+=r(e),e.left&&t(e.left),e.right&&t(e.right)};t(e)}else{const t=[e];for(;t.length>0;){const e=t.pop();s+=r(e),e.right&&t.push(e.right),e.left&&t.push(e.left)}}return s}subTreeAdd(e,t,s){if(s=null!=s?s:"id","number"==typeof e&&(e=this.get(e,"id")),!e)return!1;const r=e=>{e.id+=t};if(this._loopType===i.LoopType.RECURSIVE){const t=e=>{r(e),e.left&&t(e.left),e.right&&t(e.right)};t(e)}else{const t=[e];for(;t.length>0;){const e=t.pop();r(e),e.right&&t.push(e.right),e.left&&t.push(e.left)}}return!0}BFS(e){e=null!=e?e:"id",this._clearResults();const t=[this.root];for(;0!==t.length;){const s=t.shift();s&&(this._accumulatedByPropertyName(s,e),null!==(null==s?void 0:s.left)&&t.push(s.left),null!==(null==s?void 0:s.right)&&t.push(s.right))}return this._getResultByPropertyName(e)}DFS(e,t){e=null!=e?e:"in",t=null!=t?t:"id",this._clearResults();const s=r=>{switch(e){case"in":r.left&&s(r.left),this._accumulatedByPropertyName(r,t),r.right&&s(r.right);break;case"pre":this._accumulatedByPropertyName(r,t),r.left&&s(r.left),r.right&&s(r.right);break;case"post":r.left&&s(r.left),r.right&&s(r.right),this._accumulatedByPropertyName(r,t)}};return this.root&&s(this.root),this._getResultByPropertyName(t)}DFSIterative(e,t){if(e=e||"in",t=t||"id",this._clearResults(),!this.root)return this._getResultByPropertyName(t);const s=[{opt:0,node:this.root}];for(;s.length>0;){const r=s.pop();if(r&&r.node)if(1===r.opt)this._accumulatedByPropertyName(r.node,t);else switch(e){case"in":default:s.push({opt:0,node:r.node.right}),s.push({opt:1,node:r.node}),s.push({opt:0,node:r.node.left});break;case"pre":s.push({opt:0,node:r.node.right}),s.push({opt:0,node:r.node.left}),s.push({opt:1,node:r.node});break;case"post":s.push({opt:1,node:r.node}),s.push({opt:0,node:r.node.right}),s.push({opt:0,node:r.node.left})}}return this._getResultByPropertyName(t)}levelIterative(e,t){if(t=t||"id",!(e=e||this.root))return[];this._clearResults();const s=[e];for(;s.length>0;){const e=s.shift();e&&(this._accumulatedByPropertyName(e,t),e.left&&s.push(e.left),e.right&&s.push(e.right))}return this._getResultByPropertyName(t)}listLevels(e,t){if(t=t||"id",!(e=e||this.root))return[];const s=[],r=(e,r)=>{switch(t){case"id":default:s[r].push(e.id);break;case"val":s[r].push(e.val);break;case"node":s[r].push(e)}};if(this.loopType===i.LoopType.RECURSIVE){const t=(e,i)=>{s[i]||(s[i]=[]),r(e,i),e.left&&t(e.left,i+1),e.right&&t(e.right,i+1)};t(e,0)}else{const t=[[e,0]];for(;t.length>0;){const e=t.pop(),[i,n]=e;s[n]||(s[n]=[]),r(i,n),i.right&&t.push([i.right,n+1]),i.left&&t.push([i.left,n+1])}}return s}getPredecessor(e){if(e.left){let t=e.left;for(;!t||t.right&&t.right!==e;)t&&(t=t.right);return t}return e}morris(e,t){if(null===this.root)return[];e=e||"in",t=t||"id",this._clearResults();let s=this.root;const r=e=>{let t=null,s=null;for(;e;)s=e.right,e.right=t,t=e,e=s;return t},i=e=>{const s=r(e);let i=s;for(;i;)this._accumulatedByPropertyName(i,t),i=i.right;r(s)};switch(e){case"in":for(;s;){if(s.left){const e=this.getPredecessor(s);if(!e.right){e.right=s,s=s.left;continue}e.right=null}this._accumulatedByPropertyName(s,t),s=s.right}break;case"pre":for(;s;){if(s.left){const e=this.getPredecessor(s);if(!e.right){e.right=s,this._accumulatedByPropertyName(s,t),s=s.left;continue}e.right=null}else this._accumulatedByPropertyName(s,t);s=s.right}break;case"post":for(;s;){if(s.left){const e=this.getPredecessor(s);if(null===e.right){e.right=s,s=s.left;continue}e.right=null,i(s.left)}s=s.right}i(this.root)}return this._getResultByPropertyName(t)}_addTo(e,t){return t?void 0===t.left?(t.left=e,e&&this._setSize(this.size+1),t.left):void 0===t.right?(t.right=e,e&&this._setSize(this.size+1),t.right):void 0:void 0}_setLoopType(e){this._loopType=e}_setVisitedId(e){this._visitedId=e}_setVisitedVal(e){this._visitedVal=e}_setVisitedNode(e){this._visitedNode=e}_setVisitedLeftSum(e){this._visitedLeftSum=e}_setRoot(e){e&&(e.parent=void 0),this._root=e}_setSize(e){this._size=e}_clearResults(){this._visitedId=[],this._visitedVal=[],this._visitedNode=[],this._visitedLeftSum=[]}_pushByPropertyNameStopOrNot(e,t,s,r,i){switch(r){case"id":default:if(e.id===s)return t.push(e),!!i;break;case"val":if(e.val===s)return t.push(e),!!i}}_accumulatedByPropertyName(e,t){switch(t=null!=t?t:"id"){case"id":default:this._visitedId.push(e.id);break;case"val":this._visitedVal.push(e.val);break;case"node":this._visitedNode.push(e)}}_getResultByPropertyName(e){switch(e=null!=e?e:"id"){case"id":default:return this._visitedId;case"val":return this._visitedVal;case"node":return this._visitedNode}}}},9993:(e,t,s)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.AVLTree=t.AVLTreeNode=void 0;const r=s(761);class i extends r.BSTNode{constructor(e,t){super(e,t)}}t.AVLTreeNode=i;class n extends r.BST{constructor(e){super(e)}createNode(e,t){return new i(e,t)}add(e,t){const s=super.add(e,t);return s&&this.balancePath(s),s}remove(e,t){const s=super.remove(e,t);for(const{needBalanced:e}of s)e&&this.balancePath(e);return s}balanceFactor(e){return e.right?e.left?e.right.height-e.left.height:+e.height:-e.height}updateHeight(e){if(e.left||e.right)if(e.left)e.right?e.height=1+Math.max(e.right.height,e.left.height):e.height=1+e.left.height;else{const t=e.right?e.right.height:0;e.height=1+t}else e.height=0}balancePath(e){const t=this.getPathToRoot(e);for(let e=t.length-1;e>=0;e--){const s=t[e];switch(this.updateHeight(s),this.balanceFactor(s)){case-2:s&&s.left&&(this.balanceFactor(s.left)<=0?this.balanceLL(s):this.balanceLR(s));break;case 2:s&&s.right&&(this.balanceFactor(s.right)>=0?this.balanceRR(s):this.balanceRL(s))}}}balanceLL(e){const t=e.parent,s=e.left;e.parent=s,s&&s.right&&(s.right.parent=e),s&&(s.parent=t),e===this.root?s&&this._setRoot(s):(null==t?void 0:t.left)===e?t.left=s:t&&(t.right=s),s&&(e.left=s.right,s.right=e),this.updateHeight(e),s&&this.updateHeight(s)}balanceLR(e){const t=e.parent,s=e.left;let r=null;s&&(r=s.right),e&&(e.parent=r),s&&(s.parent=r),r&&(r.left&&(r.left.parent=s),r.right&&(r.right.parent=e),r.parent=t),e===this.root?r&&this._setRoot(r):t&&(t.left===e?t.left=r:t.right=r),r&&(e.left=r.right,s&&(s.right=r.left),r.left=s,r.right=e),this.updateHeight(e),s&&this.updateHeight(s),r&&this.updateHeight(r)}balanceRR(e){const t=e.parent,s=e.right;e.parent=s,s&&(s.left&&(s.left.parent=e),s.parent=t),e===this.root?s&&this._setRoot(s):t&&(t.left===e?t.left=s:t.right=s),s&&(e.right=s.left,s.left=e),this.updateHeight(e),s&&this.updateHeight(s)}balanceRL(e){const t=e.parent,s=e.right;let r=null;s&&(r=s.left),e.parent=r,s&&(s.parent=r),r&&(r.left&&(r.left.parent=e),r.right&&(r.right.parent=s),r.parent=t),e===this.root?r&&this._setRoot(r):t&&(t.left===e?t.left=r:t.right=r),r&&(e.right=r.left),s&&r&&(s.left=r.right),r&&(r.left=e),r&&(r.right=s),this.updateHeight(e),s&&this.updateHeight(s),r&&this.updateHeight(r)}}t.AVLTree=n},479:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.BTree=void 0,t.BTree=class{}},9649:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.BinaryIndexedTree=void 0;class s{constructor(e){this._sumTree=new Array(e+1).fill(0)}get sumTree(){return this._sumTree}static lowBit(e){return e&-e}update(e,t){for(;e<this._sumTree.length;)this._sumTree[e]+=t,e+=s.lowBit(e)}getPrefixSum(e){let t=0;for(;e>0;)t+=this._sumTree[e],e-=s.lowBit(e);return t}getRangeSum(e,t){if(!(0<=e&&e<=t&&t<=this._sumTree.length))throw"Index out of bounds";return this.getPrefixSum(t)-this.getPrefixSum(e)}_setSumTree(e){this._sumTree=e}}t.BinaryIndexedTree=s},8021:(e,t,s)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.BinaryTree=t.BinaryTreeNode=void 0;const r=s(6279);class i extends r.AbstractBinaryTreeNode{constructor(e,t){super(e,t)}}t.BinaryTreeNode=i;class n extends r.AbstractBinaryTree{constructor(e){super(e)}createNode(e,t){return new i(e,t)}}t.BinaryTree=n},761:(e,t,s)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.BST=t.BSTNode=void 0;const r=s(9011),i=s(8021);class n extends i.BinaryTreeNode{constructor(e,t){super(e,t)}}t.BSTNode=n;class o extends i.BinaryTree{constructor(e){if(super(e),this._comparator=(e,t)=>e-t,void 0!==e){const{comparator:t}=e;void 0!==t&&(this._comparator=t)}}createNode(e,t){return new n(e,t)}add(e,t){let s=null;const i=this.createNode(e,t);if(null===this.root)this._setRoot(i),this._setSize(this.size+1),s=this.root;else{let t=this.root,n=!0;for(;n;)null!==t&&null!==i?this._compare(t.id,e)===r.CP.eq?(i&&(t.val=i.val),n=!1,s=t):this._compare(t.id,e)===r.CP.gt?void 0===t.left?(i&&(i.parent=t),t.left=i,this._setSize(this.size+1),n=!1,s=t.left):t.left&&(t=t.left):this._compare(t.id,e)===r.CP.lt&&(void 0===t.right?(i&&(i.parent=t),t.right=i,this._setSize(this.size+1),n=!1,s=t.right):t.right&&(t=t.right)):n=!1}return s}get(e,t){var s;return t=null!=t?t:"id",null!==(s=this.getNodes(e,t,!0)[0])&&void 0!==s?s:null}lastKey(){var e,t,s,i,n,o;return this._compare(0,1)===r.CP.lt?null!==(t=null===(e=this.getRightMost())||void 0===e?void 0:e.id)&&void 0!==t?t:0:this._compare(0,1)===r.CP.gt?null!==(i=null===(s=this.getLeftMost())||void 0===s?void 0:s.id)&&void 0!==i?i:0:null!==(o=null===(n=this.getRightMost())||void 0===n?void 0:n.id)&&void 0!==o?o:0}getNodes(e,t,s){if(t=null!=t?t:"id",!this.root)return[];const i=[];if(this.loopType===r.LoopType.RECURSIVE){const n=o=>{this._pushByPropertyNameStopOrNot(o,i,e,t,s)||(o.left||o.right)&&("id"===t?(this._compare(o.id,e)===r.CP.gt&&o.left&&n(o.left),this._compare(o.id,e)===r.CP.lt&&o.right&&n(o.right)):(o.left&&n(o.left),o.right&&n(o.right)))};n(this.root)}else{const n=[this.root];for(;n.length>0;){const o=n.shift();if(o){if(this._pushByPropertyNameStopOrNot(o,i,e,t,s))return i;"id"===t?(this._compare(o.id,e)===r.CP.gt&&o.left&&n.push(o.left),this._compare(o.id,e)===r.CP.lt&&o.right&&n.push(o.right)):(o.left&&n.push(o.left),o.right&&n.push(o.right))}}}return i}lesserSum(e,t){if(t=null!=t?t:"id","number"==typeof e&&(e=this.get(e,"id")),!e)return 0;if(!this.root)return 0;const s=e.id,i=e=>{let t;return t=e.id,t};let n=0;if(this.loopType===r.LoopType.RECURSIVE){const e=o=>{const a=this._compare(o.id,s);if(a!==r.CP.eq)if(a===r.CP.lt){if(o.left&&(n+=this.subTreeSum(o.left,t)),n+=i(o),!o.right)return;e(o.right)}else{if(!o.left)return;e(o.left)}else o.right&&(n+=this.subTreeSum(o.right,t))};e(this.root)}else{const e=[this.root];for(;e.length>0;){const o=e.shift();if(o){const a=this._compare(o.id,s);if(a===r.CP.eq)return o.right&&(n+=this.subTreeSum(o.right,t)),n;if(a===r.CP.lt){if(o.left&&(n+=this.subTreeSum(o.left,t)),n+=i(o),!o.right)return n;e.push(o.right)}else{if(!o.left)return n;e.push(o.left)}}}}return n}allGreaterNodesAdd(e,t,s){if(s=null!=s?s:"id","number"==typeof e&&(e=this.get(e,"id")),!e)return!1;const i=e.id;if(!this.root)return!1;const n=e=>{e.id+=t};if(this.loopType===r.LoopType.RECURSIVE){const e=t=>{this._compare(t.id,i)===r.CP.gt&&n(t),(t.left||t.right)&&(t.left&&this._compare(t.left.id,i)===r.CP.gt&&e(t.left),t.right&&this._compare(t.right.id,i)===r.CP.gt&&e(t.right))};return e(this.root),!0}{const e=[this.root];for(;e.length>0;){const t=e.shift();t&&(this._compare(t.id,i)===r.CP.gt&&n(t),t.left&&this._compare(t.left.id,i)===r.CP.gt&&e.push(t.left),t.right&&this._compare(t.right.id,i)===r.CP.gt&&e.push(t.right))}return!0}}perfectlyBalance(){const e=this.DFS("in","node"),t=e.length;if(this.clear(),e.length<1)return!1;if(this.loopType===r.LoopType.RECURSIVE){const s=(t,r)=>{if(t>r)return;const i=t+Math.floor((r-t)/2),n=e[i];this.add(n.id,n.val),s(t,i-1),s(i+1,r)};return s(0,t-1),!0}{const s=[[0,t-1]];for(;s.length>0;){const t=s.pop();if(t){const[r,i]=t;if(r<=i){const t=r+Math.floor((i-r)/2),n=e[t];this.add(n.id,n.val),s.push([t+1,i]),s.push([r,t-1])}}}return!0}}isAVLBalanced(){var e,t;if(!this.root)return!0;let s=!0;if(this.loopType===r.LoopType.RECURSIVE){const e=t=>{if(!t)return 0;const r=e(t.left),i=e(t.right);return Math.abs(r-i)>1&&(s=!1),Math.max(r,i)+1};e(this.root)}else{const s=[];let r=this.root,i=null;const n=new Map;for(;s.length>0||r;)if(r)s.push(r),r=r.left;else if(r=s[s.length-1],r.right&&i!==r.right)r=r.right;else if(r=s.pop(),r){const s=r.left&&null!==(e=n.get(r.left))&&void 0!==e?e:-1,o=r.right&&null!==(t=n.get(r.right))&&void 0!==t?t:-1;if(Math.abs(s-o)>1)return!1;n.set(r,1+Math.max(s,o)),i=r,r=null}}return s}_compare(e,t){const s=this._comparator(e,t);return s>0?r.CP.gt:s<0?r.CP.lt:r.CP.eq}}t.BST=o},255:function(e,t,s){var r=this&&this.__createBinding||(Object.create?function(e,t,s,r){void 0===r&&(r=s);var i=Object.getOwnPropertyDescriptor(t,s);i&&!("get"in i?!t.__esModule:i.writable||i.configurable)||(i={enumerable:!0,get:function(){return t[s]}}),Object.defineProperty(e,r,i)}:function(e,t,s,r){void 0===r&&(r=s),e[r]=t[s]}),i=this&&this.__exportStar||function(e,t){for(var s in e)"default"===s||Object.prototype.hasOwnProperty.call(t,s)||r(t,e,s)};Object.defineProperty(t,"__esModule",{value:!0}),i(s(6279),t),i(s(8021),t),i(s(761),t),i(s(9649),t),i(s(8207),t),i(s(9993),t),i(s(479),t),i(s(1259),t),i(s(1564),t),i(s(1925),t),i(s(2570),t),i(s(7159),t)},1259:(e,t,s)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.RBTree=t.RBTreeNode=void 0;const r=s(9011),i=s(761);class n extends i.BSTNode{constructor(e,t,s=r.RBColor.RED){super(e,t),this._color=s}get color(){return this._color}set color(e){this._color=e}}t.RBTreeNode=n;class o extends i.BST{constructor(e){super(e)}createNode(e,t){return new n(e,t,r.RBColor.RED)}insert(e,t){}leftRotate(e){}rightRotate(e){}insertFixup(e){}deleteFixup(e){}transplant(e,t){}}t.RBTree=o},8207:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.SegmentTree=t.SegmentTreeNode=void 0;class s{constructor(e,t,s,r){this._start=0,this._end=0,this._val=null,this._sum=0,this._left=null,this._right=null,this._start=e,this._end=t,this._sum=s,this._val=r||null}get start(){return this._start}set start(e){this._start=e}get end(){return this._end}set end(e){this._end=e}get val(){return this._val}set val(e){this._val=e}get sum(){return this._sum}set sum(e){this._sum=e}get left(){return this._left}set left(e){this._left=e}get right(){return this._right}set right(e){this._right=e}}t.SegmentTreeNode=s,t.SegmentTree=class{constructor(e,t,s){this._values=[],this._start=0,t=t||0,s=s||e.length-1,this._values=e,this._start=t,this._end=s,this._root=this.build(t,s)}get values(){return this._values}get start(){return this._start}get end(){return this._end}get root(){return this._root}build(e,t){if(e===t)return new s(e,t,this._values[e]);const r=e+Math.floor((t-e)/2),i=this.build(e,r),n=this.build(r+1,t),o=new s(e,t,i.sum+n.sum);return o.left=i,o.right=n,o}updateNode(e,t,s){const r=this.root||null;if(!r)return;const i=(e,t,s,r)=>{e.start!==e.end||e.start!==t?(t<=e.start+Math.floor((e.end-e.start)/2)?e.left&&i(e.left,t,s,r):e.right&&i(e.right,t,s,r),e.left&&e.right&&(e.sum=e.left.sum+e.right.sum)):e.sum=s};i(r,e,t)}querySumByRange(e,t){const s=this.root||null;if(!s)return 0;const r=(e,t,s)=>{if(e.start===t&&e.end===s)return e.sum;const i=e.start+Math.floor((e.end-e.start)/2);return s<=i?e.left?r(e.left,t,s):NaN:t>i?e.right?r(e.right,t,s):NaN:e.left&&e.right?r(e.left,t,i)+r(e.right,i+1,s):NaN};return r(s,e,t)}_setValues(e){this._values=e}_setStart(e){this._start=e}_setEnd(e){this._end=e}_setRoot(e){this._root=e}}},1564:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.SplayTree=void 0,t.SplayTree=class{}},2570:(e,t,s)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.TreeMultiset=t.TreeMultisetNode=void 0;const r=s(9011),i=s(9993);class n extends i.AVLTreeNode{constructor(e,t,s=1){super(e,t),this._count=s}get count(){return this._count}set count(e){this._count=e}}t.TreeMultisetNode=n;class o extends i.AVLTree{constructor(e){super(Object.assign({},e)),this._count=0}get count(){return this._count}createNode(e,t,s){return new n(e,t,s)}swapLocation(e,t){const{id:s,val:r,count:i,height:n}=t,o=this.createNode(s,r,i);return o&&(o.height=n,t.id=e.id,t.val=e.val,t.count=e.count,t.height=e.height,e.id=o.id,e.val=o.val,e.count=o.count,e.height=o.height),t}add(e,t,s){let i,o;if(s=null!=s?s:1,o=e instanceof n?this.createNode(e.id,e.val,e.count):null===e?null:this.createNode(e,t,s),this.root){let e=this.root,t=!0;for(;t;)e?o&&(this._compare(e.id,o.id)===r.CP.eq?(e.val=o.val,e.count+=o.count,this._setCount(this.count+o.count),t=!1,i=e):this._compare(e.id,o.id)===r.CP.gt?void 0===e.left?(e.left=o,this._setSize(this.size+1),this._setCount(this.count+o.count),t=!1,i=e.left):e.left&&(e=e.left):this._compare(e.id,o.id)===r.CP.lt&&(void 0===e.right?(e.right=o,this._setSize(this.size+1),this._setCount(this.count+o.count),t=!1,i=e.right):e.right&&(e=e.right))):t=!1}else this._setRoot(o),this._setSize(this.size+1),o&&this._setCount(this.count+o.count),i=this.root;return i&&this.balancePath(i),i}_addTo(e,t){return t?void 0===t.left?(t.left=e,null!==e&&(this._setSize(this.size+1),this._setCount(this.count+e.count)),t.left):void 0===t.right?(t.right=e,null!==e&&(this._setSize(this.size+1),this._setCount(this.count+e.count)),t.right):void 0:void 0}addMany(e,t){var s;const r=[],i=new Map;for(const t of e)i.set(t,(null!==(s=i.get(t))&&void 0!==s?s:0)+1);for(let s=0;s<e.length;s++){const o=e[s];if(i.has(o)){if(o instanceof n){r.push(this.add(o.id,o.val,o.count));continue}if(null===o){r.push(this.add(NaN,null,0));continue}const e=null==t?void 0:t[s],a=i.get(o);r.push(this.add(o,e,a)),i.delete(o)}}return r}perfectlyBalance(){const e=this.DFS("in","node"),t=e.length;if(e.length<1)return!1;if(this.clear(),this.loopType===r.LoopType.RECURSIVE){const s=(t,r)=>{if(t>r)return;const i=t+Math.floor((r-t)/2),n=e[i];this.add(n.id,n.val,n.count),s(t,i-1),s(i+1,r)};return s(0,t-1),!0}{const s=[[0,t-1]];for(;s.length>0;){const t=s.pop();if(t){const[r,i]=t;if(r<=i){const t=r+Math.floor((i-r)/2),n=e[t];this.add(n.id,n.val,n.count),s.push([t+1,i]),s.push([r,t-1])}}}return!0}}remove(e,t){const s=[];if(!this.root)return s;const i=this.get(e);if(!i)return s;const n=(null==i?void 0:i.parent)?i.parent:null;let o=null,a=i;if(i.count>1&&!t)i.count--,this._setCount(this.count-1);else{if(i.left){const e=i.left?this.getRightMost(i.left):null;if(e){const t=e.parent;a=this.swapLocation(i,e),t&&(t.right===e?t.right=e.left:t.left=e.left,o=t)}}else if(n){const{familyPosition:e}=i;e===r.FamilyPosition.LEFT||e===r.FamilyPosition.ROOT_LEFT?n.left=i.right:e!==r.FamilyPosition.RIGHT&&e!==r.FamilyPosition.ROOT_RIGHT||(n.right=i.right),o=n}else void 0!==i.right&&this._setRoot(i.right);this._setSize(this.size-1),this._setCount(this.count-a.count)}return s.push({deleted:a,needBalanced:o}),o&&this.balancePath(o),s}getSubTreeCount(e){const t=[0,0];if(!e)return t;if(this.loopType===r.LoopType.RECURSIVE){const s=e=>{t[0]++,t[1]+=e.count,e.left&&s(e.left),e.right&&s(e.right)};return s(e),t}{const s=[e];for(;s.length>0;){const e=s.pop();t[0]++,t[1]+=e.count,e.right&&s.push(e.right),e.left&&s.push(e.left)}return t}}subTreeSumCount(e){if("number"==typeof e&&(e=this.get(e,"id")),!e)return 0;let t=0;if(this.loopType===r.LoopType.RECURSIVE){const s=e=>{t+=e.count,e.left&&s(e.left),e.right&&s(e.right)};s(e)}else{const s=[e];for(;s.length>0;){const e=s.pop();t+=e.count,e.right&&s.push(e.right),e.left&&s.push(e.left)}}return t}subTreeAddCount(e,t){if("number"==typeof e&&(e=this.get(e,"id")),!e)return!1;const s=e=>{e.count+=t,this._setCount(this.count+t)};if(this.loopType===r.LoopType.RECURSIVE){const t=e=>{s(e),e.left&&t(e.left),e.right&&t(e.right)};t(e)}else{const t=[e];for(;t.length>0;){const e=t.pop();s(e),e.right&&t.push(e.right),e.left&&t.push(e.left)}}return!0}getNodesByCount(e,t){if(!this.root)return[];const s=[];if(this.loopType===r.LoopType.RECURSIVE){const r=i=>{i.count===e&&(s.push(i),t)||(i.left||i.right)&&(i.left&&r(i.left),i.right&&r(i.right))};r(this.root)}else{const r=[this.root];for(;r.length>0;){const i=r.shift();if(i){if(i.count===e&&(s.push(i),t))return s;i.left&&r.push(i.left),i.right&&r.push(i.right)}}}return s}BFSCount(){return super.BFS("node").map((e=>e.count))}listLevelsCount(e){return super.listLevels(e,"node").map((e=>e.map((e=>e.count))))}morrisCount(e){return e=e||"in",super.morris(e,"node").map((e=>e.count))}DFSIterativeCount(e,t){return e=null!=e?e:"in",super.DFSIterative(e,"node").map((e=>e.count))}DFSCount(e,t){return e=null!=e?e:"in",super.DFS(e,"node").map((e=>e.count))}lesserSumCount(e){if("number"==typeof e&&(e=this.get(e,"id")),!e)return 0;if(!this.root)return 0;const t=e.id;let s=0;if(this.loopType===r.LoopType.RECURSIVE){const e=i=>{const n=this._compare(i.id,t);if(n!==r.CP.eq)if(n===r.CP.lt){if(i.left&&(s+=this.subTreeSumCount(i.left)),s+=i.count,!i.right)return;e(i.right)}else{if(!i.left)return;e(i.left)}else i.right&&(s+=this.subTreeSumCount(i.right))};e(this.root)}else{const e=[this.root];for(;e.length>0;){const i=e.shift();if(i){const n=this._compare(i.id,t);if(n===r.CP.eq)return i.right&&(s+=this.subTreeSumCount(i.right)),s;if(n===r.CP.lt){if(i.left&&(s+=this.subTreeSumCount(i.left)),s+=i.count,!i.right)return s;e.push(i.right)}else{if(!i.left)return s;e.push(i.left)}}}}return s}allGreaterNodesAddCount(e,t){if("number"==typeof e&&(e=this.get(e,"id")),!e)return!1;const s=e.id;if(!this.root)return!1;if(this.loopType===r.LoopType.RECURSIVE){const e=i=>{this._compare(i.id,s)===r.CP.gt&&(i.count+=t),(i.left||i.right)&&(i.left&&this._compare(i.left.id,s)===r.CP.gt&&e(i.left),i.right&&this._compare(i.right.id,s)===r.CP.gt&&e(i.right))};return e(this.root),!0}{const e=[this.root];for(;e.length>0;){const i=e.shift();i&&(this._compare(i.id,s)===r.CP.gt&&(i.count+=t),i.left&&this._compare(i.left.id,s)===r.CP.gt&&e.push(i.left),i.right&&this._compare(i.right.id,s)===r.CP.gt&&e.push(i.right))}return!0}}clear(){super.clear(),this._setCount(0)}_setCount(e){this._count=e}}t.TreeMultiset=o},7159:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.TwoThreeTree=void 0,t.TwoThreeTree=class{}},618:(e,t,s)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.AbstractGraph=t.AbstractEdge=t.AbstractVertex=void 0;const r=s(5928),i=s(7641);class n{constructor(e,t){this._id=e,this._val=t}get id(){return this._id}set id(e){this._id=e}get val(){return this._val}set val(e){this._val=e}}t.AbstractVertex=n;class o{constructor(e,t){this._weight=void 0!==e?e:1,this._val=t,this._hashCode=(0,r.uuidV4)()}get val(){return this._val}set val(e){this._val=e}get weight(){return this._weight}set weight(e){this._weight=e}get hashCode(){return this._hashCode}_setHashCode(e){this._hashCode=e}}t.AbstractEdge=o,t.AbstractGraph=class{constructor(){this._vertices=new Map}get vertices(){return this._vertices}getVertex(e){return this._vertices.get(e)||null}hasVertex(e){return this._vertices.has(this._getVertexId(e))}addVertex(e,t){if(e instanceof n)return this._addVertexOnly(e);{const s=this.createVertex(e,t);return this._addVertexOnly(s)}}removeVertex(e){const t=this._getVertexId(e);return this._vertices.delete(t)}removeAllVertices(e){const t=[];for(const s of e)t.push(this.removeVertex(s));return t.length>0}hasEdge(e,t){return!!this.getEdge(e,t)}addEdge(e,t,s,r){if(e instanceof o)return this._addEdgeOnly(e);if(t instanceof n||"string"==typeof t||"number"==typeof t){if(!this.hasVertex(e)||!this.hasVertex(t))return!1;e instanceof n&&(e=e.id),t instanceof n&&(t=t.id);const i=this.createEdge(e,t,s,r);return this._addEdgeOnly(i)}throw new Error("dest must be a Vertex or vertex id while srcOrEdge is an Edge")}setEdgeWeight(e,t,s){const r=this.getEdge(e,t);return!!r&&(r.weight=s,!0)}getAllPathsBetween(e,t){const s=[],i=this._getVertex(e),n=this._getVertex(t);if(!i||!n)return[];const o=(e,t,n,a)=>{n.set(e,!0),e===t&&s.push([i,...a]);const d=this.getNeighbors(e);for(const e of d)n.get(e)||(a.push(e),o(e,t,n,a),(0,r.arrayRemove)(a,(t=>t===e)));n.set(e,!1)};return o(i,n,new Map,[]),s}getPathSumWeight(e){var t;let s=0;for(let r=0;r<e.length;r++)s+=(null===(t=this.getEdge(e[r],e[r+1]))||void 0===t?void 0:t.weight)||0;return s}getMinCostBetween(e,t,s){if(void 0===s&&(s=!1),s){const s=this.getAllPathsBetween(e,t);let r=1/0;for(const e of s)r=Math.min(this.getPathSumWeight(e),r);return r}{const s=this._getVertex(t),r=this._getVertex(e);if(!r||!s)return null;const i=new Map,n=[r];i.set(r,!0);let o=0;for(;n.length>0;){for(let e=0;e<n.length;e++){const e=n.shift();if(e===s)return o;if(void 0!==e){const t=this.getNeighbors(e);for(const e of t)i.has(e)||(i.set(e,!0),n.push(e))}}o++}return null}}getMinPathBetween(e,t,s){if(void 0===s&&(s=!1),s){const s=this.getAllPathsBetween(e,t);let r=1/0,i=-1,n=0;for(const e of s){const t=this.getPathSumWeight(e);t<r&&(r=t,i=n),n++}return s[i]||null}{let s=[];const i=this._getVertex(e),n=this._getVertex(t);if(!i||!n)return[];const o=(e,t,n,a)=>{if(n.set(e,!0),e===t)return void(s=[i,...a]);const d=this.getNeighbors(e);for(const e of d)n.get(e)||(a.push(e),o(e,t,n,a),(0,r.arrayRemove)(a,(t=>t===e)));n.set(e,!1)};return o(i,n,new Map,[]),s}}dijkstraWithoutHeap(e,t,s,r){void 0===s&&(s=!1),void 0===r&&(r=!1),void 0===t&&(t=null);let i=1/0,o=null,a=[];const d=[],u=this._vertices,l=new Map,h=new Set,c=new Map,p=this._getVertex(e),f=t?this._getVertex(t):null;if(!p)return null;for(const e of u){const t=e[1];t instanceof n&&l.set(t,1/0)}l.set(p,0),c.set(p,null);const _=()=>{let e=1/0,t=null;for(const[s,r]of l)h.has(s)||r<e&&(e=r,t=s);return t},g=e=>{for(const t of u){const s=t[1];if(s instanceof n){const r=[s];let i=c.get(s);for(;i;)r.push(i),i=c.get(i);const n=r.reverse();t[1]===e&&(a=n),d.push(n)}}};for(let e=1;e<u.size;e++){const e=_();if(e){if(h.add(e),f&&f===e)return s&&(i=l.get(f)||1/0),r&&g(f),{distMap:l,preMap:c,seen:h,paths:d,minDist:i,minPath:a};const t=this.getNeighbors(e);for(const s of t)if(!h.has(s)){const t=this.getEdge(e,s);if(t){const r=l.get(e),i=l.get(s);void 0!==r&&void 0!==i&&t.weight+r<i&&(l.set(s,t.weight+r),c.set(s,e))}}}}return s&&l.forEach(((e,t)=>{t!==p&&e<i&&(i=e,r&&(o=t))})),r&&g(o),{distMap:l,preMap:c,seen:h,paths:d,minDist:i,minPath:a}}dijkstra(e,t,s,r){var o;void 0===s&&(s=!1),void 0===r&&(r=!1),void 0===t&&(t=null);let a=1/0,d=null,u=[];const l=[],h=this._vertices,c=new Map,p=new Set,f=new Map,_=this._getVertex(e),g=t?this._getVertex(t):null;if(!_)return null;for(const e of h){const t=e[1];t instanceof n&&c.set(t,1/0)}const m=new i.PriorityQueue({comparator:(e,t)=>e.id-t.id});m.add({id:0,val:_}),c.set(_,0),f.set(_,null);const v=e=>{for(const t of h){const s=t[1];if(s instanceof n){const r=[s];let i=f.get(s);for(;i;)r.push(i),i=f.get(i);const n=r.reverse();t[1]===e&&(u=n),l.push(n)}}};for(;m.size>0;){const e=m.poll(),t=null==e?void 0:e.id,i=null==e?void 0:e.val;if(void 0!==t&&i){if(p.add(i),g&&g===i)return s&&(a=c.get(g)||1/0),r&&v(g),{distMap:c,preMap:f,seen:p,paths:l,minDist:a,minPath:u};const e=this.getNeighbors(i);for(const s of e)if(!p.has(s)){const e=null===(o=this.getEdge(i,s))||void 0===o?void 0:o.weight;if("number"==typeof e){const r=c.get(s);r&&t+e<r&&(m.add({id:t+e,val:s}),f.set(s,i),c.set(s,t+e))}}}}return s&&c.forEach(((e,t)=>{t!==_&&e<a&&(a=e,r&&(d=t))})),r&&v(d),{distMap:c,preMap:f,seen:p,paths:l,minDist:a,minPath:u}}bellmanFord(e,t,s,r){void 0===s&&(s=!1),void 0===r&&(r=!1);const i=this._getVertex(e),o=[],a=new Map,d=new Map;let u,l=1/0,h=[];if(t&&(u=!1),!i)return{hasNegativeCycle:u,distMap:a,preMap:d,paths:o,min:l,minPath:h};const c=this._vertices,p=c.size,f=this.edgeSet(),_=f.length;this._vertices.forEach((e=>{a.set(e,1/0)})),a.set(i,0);for(let e=1;e<p;++e)for(let e=0;e<_;++e){const t=this.getEndsOfEdge(f[e]);if(t){const[s,i]=t,n=f[e].weight,o=a.get(s),u=a.get(i);void 0!==o&&void 0!==u&&a.get(s)!==1/0&&o+n<u&&(a.set(i,o+n),r&&d.set(i,s))}}let g=null;if(s&&a.forEach(((e,t)=>{t!==i&&e<l&&(l=e,r&&(g=t))})),r)for(const e of c){const t=e[1];if(t instanceof n){const s=[t];let r=d.get(t);for(;void 0!==r;)s.push(r),r=d.get(r);const i=s.reverse();e[1]===g&&(h=i),o.push(i)}}for(let e=0;e<_;++e){const t=this.getEndsOfEdge(f[e]);if(t){const[s]=t,r=f[e].weight,i=a.get(s);i&&i!==1/0&&i+r<i&&(u=!0)}}return{hasNegativeCycle:u,distMap:a,preMap:d,paths:o,min:l,minPath:h}}floyd(){var e;const t=[...this._vertices],s=t.length,r=[],i=[];for(let e=0;e<s;e++){r[e]=[],i[e]=[];for(let t=0;t<s;t++)i[e][t]=null}for(let i=0;i<s;i++)for(let n=0;n<s;n++)r[i][n]=(null===(e=this.getEdge(t[i][1],t[n][1]))||void 0===e?void 0:e.weight)||1/0;for(let e=0;e<s;e++)for(let n=0;n<s;n++)for(let o=0;o<s;o++)r[n][o]>r[n][e]+r[e][o]&&(r[n][o]=r[n][e]+r[e][o],i[n][o]=t[e][1]);return{costs:r,predecessor:i}}tarjan(e,t,s,r){const i=!1;void 0===e&&(e=i),void 0===t&&(t=i),void 0===s&&(s=i),void 0===r&&(r=i);const n=new Map,o=new Map,a=this._vertices;a.forEach((e=>{n.set(e,-1),o.set(e,1/0)}));const[d]=a.values(),u=[],l=[];let h=0;const c=(s,r)=>{h++,n.set(s,h),o.set(s,h);const i=this.getNeighbors(s);let a=0;for(const h of i)if(h!==r){-1===n.get(h)&&(a++,c(h,s));const r=o.get(h),i=o.get(s);void 0!==i&&void 0!==r&&o.set(s,Math.min(i,r));const p=n.get(s);if(void 0!==r&&void 0!==p&&(e&&(s===d&&a>=2||s!==d&&r>=p)&&u.push(s),t&&r>p)){const e=this.getEdge(s,h);e&&l.push(e)}}};c(d,null);let p=new Map;const f=()=>{const e=new Map;return o.forEach(((t,s)=>{var r;e.has(t)?null===(r=e.get(t))||void 0===r||r.push(s):e.set(t,[s])})),e};s&&(p=f());const _=new Map;if(r){let e=new Map;e.size<1&&(e=f()),e.forEach(((e,t)=>{e.length>1&&_.set(t,e)}))}return{dfnMap:n,lowMap:o,bridges:l,articulationPoints:u,SCCs:p,cycles:_}}_addVertexOnly(e){return!this.hasVertex(e)&&(this._vertices.set(e.id,e),!0)}_getVertex(e){const t=this._getVertexId(e);return this._vertices.get(t)||null}_getVertexId(e){return e instanceof n?e.id:e}_setVertices(e){this._vertices=e}}},4693:(e,t,s)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.DirectedGraph=t.DirectedEdge=t.DirectedVertex=void 0;const r=s(5928),i=s(618);class n extends i.AbstractVertex{constructor(e,t){super(e,t)}}t.DirectedVertex=n;class o extends i.AbstractEdge{constructor(e,t,s,r){super(s,r),this._src=e,this._dest=t}get src(){return this._src}set src(e){this._src=e}get dest(){return this._dest}set dest(e){this._dest=e}}t.DirectedEdge=o;class a extends i.AbstractGraph{constructor(){super(),this._outEdgeMap=new Map,this._inEdgeMap=new Map}get outEdgeMap(){return this._outEdgeMap}get inEdgeMap(){return this._inEdgeMap}createVertex(e,t){return new n(e,null!=t?t:e)}createEdge(e,t,s,r){return new o(e,t,null!=s?s:1,r)}getEdge(e,t){let s=[];if(null!==e&&null!==t){const r=this._getVertex(e),i=this._getVertex(t);if(r&&i){const e=this._outEdgeMap.get(r);e&&(s=e.filter((e=>e.dest===i.id)))}}return s[0]||null}removeEdgeSrcToDest(e,t){const s=this._getVertex(e),i=this._getVertex(t);let n=null;if(!s||!i)return null;const o=this._outEdgeMap.get(s);o&&(0,r.arrayRemove)(o,(e=>e.dest===i.id));const a=this._inEdgeMap.get(i);return a&&(n=(0,r.arrayRemove)(a,(e=>e.src===s.id))[0]||null),n}removeEdge(e){let t=null;const s=this._getVertex(e.src),i=this._getVertex(e.dest);if(s&&i){const e=this._outEdgeMap.get(s);e&&e.length>0&&(0,r.arrayRemove)(e,(e=>e.src===s.id));const n=this._inEdgeMap.get(i);n&&n.length>0&&(t=(0,r.arrayRemove)(n,(e=>e.dest===i.id))[0])}return t}removeEdgesBetween(e,t){const s=[];if(e&&t){const r=this.removeEdgeSrcToDest(e,t),i=this.removeEdgeSrcToDest(t,e);r&&s.push(r),i&&s.push(i)}return s}incomingEdgesOf(e){const t=this._getVertex(e);return t&&this.inEdgeMap.get(t)||[]}outgoingEdgesOf(e){const t=this._getVertex(e);return t&&this._outEdgeMap.get(t)||[]}degreeOf(e){return this.outDegreeOf(e)+this.inDegreeOf(e)}inDegreeOf(e){return this.incomingEdgesOf(e).length}outDegreeOf(e){return this.outgoingEdgesOf(e).length}edgesOf(e){return[...this.outgoingEdgesOf(e),...this.incomingEdgesOf(e)]}getEdgeSrc(e){return this._getVertex(e.src)}getEdgeDest(e){return this._getVertex(e.dest)}getDestinations(e){if(null===e)return[];const t=[],s=this.outgoingEdgesOf(e);for(const e of s){const s=this.getEdgeDest(e);s&&t.push(s)}return t}topologicalSort(e){e=null!=e?e:"id";const t=new Map;for(const e of this.vertices)t.set(e[1],0);let s=[],r=!1;const i=e=>{t.set(e,1);const n=this.getDestinations(e);for(const e of n){const s=t.get(e);0===s?i(e):1===s&&(r=!0)}t.set(e,2),s.push(e)};for(const e of this.vertices)0===t.get(e[1])&&i(e[1]);return r?null:("id"===e&&(s=s.map((e=>e instanceof n?e.id:e))),s.reverse())}edgeSet(){let e=[];return this._outEdgeMap.forEach((t=>{e=[...e,...t]})),e}getNeighbors(e){const t=[],s=this._getVertex(e);if(s){const e=this.outgoingEdgesOf(s);for(const s of e){const e=this._getVertex(s.dest);e&&t.push(e)}}return t}getEndsOfEdge(e){if(!this.hasEdge(e.src,e.dest))return null;const t=this._getVertex(e.src),s=this._getVertex(e.dest);return t&&s?[t,s]:null}_addEdgeOnly(e){if(!this.hasVertex(e.src)||!this.hasVertex(e.dest))return!1;const t=this._getVertex(e.src),s=this._getVertex(e.dest);if(t&&s){const r=this._outEdgeMap.get(t);r?r.push(e):this._outEdgeMap.set(t,[e]);const i=this._inEdgeMap.get(s);return i?i.push(e):this._inEdgeMap.set(s,[e]),!0}return!1}_setOutEdgeMap(e){this._outEdgeMap=e}_setInEdgeMap(e){this._inEdgeMap=e}}t.DirectedGraph=a},8079:function(e,t,s){var r=this&&this.__createBinding||(Object.create?function(e,t,s,r){void 0===r&&(r=s);var i=Object.getOwnPropertyDescriptor(t,s);i&&!("get"in i?!t.__esModule:i.writable||i.configurable)||(i={enumerable:!0,get:function(){return t[s]}}),Object.defineProperty(e,r,i)}:function(e,t,s,r){void 0===r&&(r=s),e[r]=t[s]}),i=this&&this.__exportStar||function(e,t){for(var s in e)"default"===s||Object.prototype.hasOwnProperty.call(t,s)||r(t,e,s)};Object.defineProperty(t,"__esModule",{value:!0}),i(s(618),t),i(s(4693),t),i(s(5237),t),i(s(5309),t)},5309:(e,t,s)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.MapGraph=t.MapEdge=t.MapVertex=void 0;const r=s(4693);class i extends r.DirectedVertex{constructor(e,t,s,r){super(e,r),this._lat=t,this._long=s}get lat(){return this._lat}set lat(e){this._lat=e}get long(){return this._long}set long(e){this._long=e}}t.MapVertex=i;class n extends r.DirectedEdge{constructor(e,t,s,r){super(e,t,s,r)}}t.MapEdge=n;class o extends r.DirectedGraph{constructor(e,t){super(),this._origin=[0,0],this._origin=e,this._bottomRight=t}get origin(){return this._origin}set origin(e){this._origin=e}get bottomRight(){return this._bottomRight}set bottomRight(e){this._bottomRight=e}createVertex(e,t,s=this.origin[0],r=this.origin[1]){return new i(e,s,r,t)}createEdge(e,t,s,r){return new n(e,t,s,r)}}t.MapGraph=o},5237:(e,t,s)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.UndirectedGraph=t.UndirectedEdge=t.UndirectedVertex=void 0;const r=s(5928),i=s(618);class n extends i.AbstractVertex{constructor(e,t){super(e,t)}}t.UndirectedVertex=n;class o extends i.AbstractEdge{constructor(e,t,s,r){super(s,r),this._vertices=[e,t]}get vertices(){return this._vertices}set vertices(e){this._vertices=e}}t.UndirectedEdge=o;class a extends i.AbstractGraph{constructor(){super(),this._edges=new Map}get edges(){return this._edges}createVertex(e,t){return new n(e,null!=t?t:e)}createEdge(e,t,s,r){return new o(e,t,null!=s?s:1,r)}getEdge(e,t){var s;let r=[];if(null!==e&&null!==t){const i=this._getVertex(e),n=this._getVertex(t);i&&n&&(r=null===(s=this._edges.get(i))||void 0===s?void 0:s.filter((e=>e.vertices.includes(n.id))))}return r&&r[0]||null}removeEdgeBetween(e,t){const s=this._getVertex(e),i=this._getVertex(t);if(!s||!i)return null;const n=this._edges.get(s);let o=null;n&&(o=(0,r.arrayRemove)(n,(e=>e.vertices.includes(i.id)))[0]||null);const a=this._edges.get(i);return a&&(0,r.arrayRemove)(a,(e=>e.vertices.includes(s.id))),o}removeEdge(e){return this.removeEdgeBetween(e.vertices[0],e.vertices[1])}degreeOf(e){var t;const s=this._getVertex(e);return s&&(null===(t=this._edges.get(s))||void 0===t?void 0:t.length)||0}edgesOf(e){const t=this._getVertex(e);return t&&this._edges.get(t)||[]}edgeSet(){const e=new Set;return this._edges.forEach((t=>{t.forEach((t=>{e.add(t)}))})),[...e]}getNeighbors(e){const t=[],s=this._getVertex(e);if(s){const e=this.edgesOf(s);for(const r of e){const e=this._getVertex(r.vertices.filter((e=>e!==s.id))[0]);e&&t.push(e)}}return t}getEndsOfEdge(e){if(!this.hasEdge(e.vertices[0],e.vertices[1]))return null;const t=this._getVertex(e.vertices[0]),s=this._getVertex(e.vertices[1]);return t&&s?[t,s]:null}_addEdgeOnly(e){for(const t of e.vertices){const s=this._getVertex(t);if(null===s)return!1;if(s){const t=this._edges.get(s);t?t.push(e):this._edges.set(s,[e])}}return!0}_setEdges(e){this._edges=e}}t.UndirectedGraph=a},2808:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.CoordinateMap=void 0;class s extends Map{constructor(e){super(),this._joint="_",void 0!==e&&(this._joint=e)}get joint(){return this._joint}has(e){return super.has(e.join(this._joint))}set(e,t){return super.set(e.join(this._joint),t)}get(e){return super.get(e.join(this._joint))}delete(e){return super.delete(e.join(this._joint))}_setJoint(e){this._joint=e}}t.CoordinateMap=s},2130:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.CoordinateSet=void 0;class s extends Set{constructor(e){super(),this._joint="_",void 0!==e&&(this._joint=e)}get joint(){return this._joint}has(e){return super.has(e.join(this._joint))}add(e){return super.add(e.join(this._joint))}delete(e){return super.delete(e.join(this._joint))}_setJoint(e){this._joint=e}}t.CoordinateSet=s},5946:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.HashTable=void 0,t.HashTable=class{}},6841:function(e,t,s){var r=this&&this.__createBinding||(Object.create?function(e,t,s,r){void 0===r&&(r=s);var i=Object.getOwnPropertyDescriptor(t,s);i&&!("get"in i?!t.__esModule:i.writable||i.configurable)||(i={enumerable:!0,get:function(){return t[s]}}),Object.defineProperty(e,r,i)}:function(e,t,s,r){void 0===r&&(r=s),e[r]=t[s]}),i=this&&this.__exportStar||function(e,t){for(var s in e)"default"===s||Object.prototype.hasOwnProperty.call(t,s)||r(t,e,s)};Object.defineProperty(t,"__esModule",{value:!0}),i(s(5946),t),i(s(2808),t),i(s(2130),t),i(s(8328),t),i(s(7665),t),i(s(8107),t)},8328:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.Pair=void 0,t.Pair=class{}},7665:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.TreeMap=void 0,t.TreeMap=class{}},8107:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.TreeSet=void 0,t.TreeSet=class{}},8049:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.Heap=t.HeapItem=void 0;class s{constructor(e=NaN,t=null){this._val=t,this._priority=e}get priority(){return this._priority}set priority(e){this._priority=e}get val(){return this._val}set val(e){this._val=e}}t.HeapItem=s,t.Heap=class{constructor(e){if(e){const{priorityExtractor:t}=e;if(void 0!==t&&"function"!=typeof t)throw new Error(".constructor expects a valid priority function");this._priorityExtractor=t||(e=>+e)}else this._priorityExtractor=e=>+e}get pq(){return this._pq}get priorityExtractor(){return this._priorityExtractor}get size(){return this._pq.size}isEmpty(){return this._pq.size<1}peek(e){e=null!=e&&e;const t=this._pq.peek();return e?t:null==t?void 0:t.val}peekLast(e){e=null!=e&&e;const t=this._pq.leaf();return e?t:null==t?void 0:t.val}add(e,t){return t=void 0===t?e:t,this._pq.add(new s(e,t)),this}poll(e){e=null!=e&&e;const t=this._pq.poll();return t?e?t:t.val:null}has(e){return e instanceof s?this.pq.getNodes().includes(e):-1!==this.pq.getNodes().findIndex((t=>t.val===e))}toArray(e){e=null!=e&&e;const t=this._pq.toArray();return e?t:t.map((e=>e.val))}sort(e){e=null!=e&&e;const t=this._pq.sort();return e?t:t.map((e=>e.val))}clear(){this._pq.clear()}}},7888:function(e,t,s){var r=this&&this.__createBinding||(Object.create?function(e,t,s,r){void 0===r&&(r=s);var i=Object.getOwnPropertyDescriptor(t,s);i&&!("get"in i?!t.__esModule:i.writable||i.configurable)||(i={enumerable:!0,get:function(){return t[s]}}),Object.defineProperty(e,r,i)}:function(e,t,s,r){void 0===r&&(r=s),e[r]=t[s]}),i=this&&this.__exportStar||function(e,t){for(var s in e)"default"===s||Object.prototype.hasOwnProperty.call(t,s)||r(t,e,s)};Object.defineProperty(t,"__esModule",{value:!0}),i(s(7112),t),i(s(1269),t),i(s(8049),t)},7112:(e,t,s)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.MaxHeap=void 0;const r=s(8049),i=s(7641);class n extends r.Heap{constructor(e){super(e),this._pq=new i.PriorityQueue({comparator:(e,t)=>t.priority-e.priority})}}t.MaxHeap=n},1269:(e,t,s)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.MinHeap=void 0;const r=s(8049),i=s(7641);class n extends r.Heap{constructor(e){super(e),this._pq=new i.PriorityQueue({comparator:(e,t)=>e.priority-t.priority})}}t.MinHeap=n},4866:function(e,t,s){var r=this&&this.__createBinding||(Object.create?function(e,t,s,r){void 0===r&&(r=s);var i=Object.getOwnPropertyDescriptor(t,s);i&&!("get"in i?!t.__esModule:i.writable||i.configurable)||(i={enumerable:!0,get:function(){return t[s]}}),Object.defineProperty(e,r,i)}:function(e,t,s,r){void 0===r&&(r=s),e[r]=t[s]}),i=this&&this.__exportStar||function(e,t){for(var s in e)"default"===s||Object.prototype.hasOwnProperty.call(t,s)||r(t,e,s)};Object.defineProperty(t,"__esModule",{value:!0}),i(s(6841),t),i(s(2324),t),i(s(9509),t),i(s(2627),t),i(s(8079),t),i(s(255),t),i(s(8456),t),i(s(7888),t),i(s(7641),t),i(s(7619),t),i(s(3543),t),i(s(341),t),i(s(9011),t)},4833:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0})},98:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0})},8250:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0})},748:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0})},5355:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0})},9489:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0})},1918:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0})},6053:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0})},341:function(e,t,s){var r=this&&this.__createBinding||(Object.create?function(e,t,s,r){void 0===r&&(r=s);var i=Object.getOwnPropertyDescriptor(t,s);i&&!("get"in i?!t.__esModule:i.writable||i.configurable)||(i={enumerable:!0,get:function(){return t[s]}}),Object.defineProperty(e,r,i)}:function(e,t,s,r){void 0===r&&(r=s),e[r]=t[s]}),i=this&&this.__exportStar||function(e,t){for(var s in e)"default"===s||Object.prototype.hasOwnProperty.call(t,s)||r(t,e,s)};Object.defineProperty(t,"__esModule",{value:!0}),i(s(4833),t),i(s(98),t),i(s(8250),t),i(s(748),t),i(s(5355),t),i(s(9489),t),i(s(1918),t),i(s(6053),t),i(s(1979),t),i(s(2337),t),i(s(4533),t),i(s(7319),t),i(s(4327),t),i(s(2175),t),i(s(6947),t)},1979:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0})},2337:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0})},4533:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0})},7319:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0})},4327:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0})},2175:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0})},6947:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0})},2198:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.DoublyLinkedList=t.DoublyLinkedListNode=void 0;class s{constructor(e){this._val=e,this._next=null,this._prev=null}get val(){return this._val}set val(e){this._val=e}get next(){return this._next}set next(e){this._next=e}get prev(){return this._prev}set prev(e){this._prev=e}}t.DoublyLinkedListNode=s;class r{constructor(){this._head=null,this._tail=null,this._length=0}get head(){return this._head}set head(e){this._head=e}get tail(){return this._tail}set tail(e){this._tail=e}get length(){return this._length}static fromArray(e){const t=new r;for(const s of e)t.push(s);return t}push(e){const t=new s(e);this.head?(t.prev=this.tail,this.tail.next=t,this.tail=t):(this.head=t,this.tail=t),this._length++}pop(){if(!this.tail)return null;const e=this.tail;return this.head===this.tail?(this.head=null,this.tail=null):(this.tail=e.prev,this.tail.next=null),this._length--,e.val}shift(){if(!this.head)return null;const e=this.head;return this.head===this.tail?(this.head=null,this.tail=null):(this.head=e.next,this.head.prev=null),this._length--,e.val}unshift(e){const t=new s(e);this.head?(t.next=this.head,this.head.prev=t,this.head=t):(this.head=t,this.tail=t),this._length++}getAt(e){if(e<0||e>=this.length)return null;let t=this.head;for(let s=0;s<e;s++)t=t.next;return t.val}getNodeAt(e){if(e<0||e>=this.length)return null;let t=this.head;for(let s=0;s<e;s++)t=t.next;return t}findNode(e){let t=this.head;for(;t;){if(t.val===e)return t;t=t.next}return null}insertAt(e,t){if(e<0||e>this.length)return!1;if(0===e)return this.unshift(t),!0;if(e===this.length)return this.push(t),!0;const r=new s(t),i=this.getNodeAt(e-1),n=i.next;return r.prev=i,r.next=n,i.next=r,n.prev=r,this._length++,!0}deleteAt(e){if(e<0||e>=this.length)return null;if(0===e)return this.shift();if(e===this.length-1)return this.pop();const t=this.getNodeAt(e),s=t.prev,r=t.next;return s.next=r,r.prev=s,this._length--,t.val}delete(e){let t;if(t=e instanceof s?e:this.findNode(e),t){if(t===this.head)this.shift();else if(t===this.tail)this.pop();else{const e=t.prev,s=t.next;e.next=s,s.prev=e,this._length--}return!0}return!1}toArray(){const e=[];let t=this.head;for(;t;)e.push(t.val),t=t.next;return e}clear(){this._head=null,this._tail=null,this._length=0}find(e){let t=this.head;for(;t;){if(e(t.val))return t.val;t=t.next}return null}indexOf(e){let t=0,s=this.head;for(;s;){if(s.val===e)return t;t++,s=s.next}return-1}findLast(e){let t=this.tail;for(;t;){if(e(t.val))return t.val;t=t.prev}return null}toArrayReverse(){const e=[];let t=this.tail;for(;t;)e.push(t.val),t=t.prev;return e}reverse(){let e=this.head;for([this.head,this.tail]=[this.tail,this.head];e;){const t=e.next;[e.prev,e.next]=[e.next,e.prev],e=t}}forEach(e){let t=this.head,s=0;for(;t;)e(t.val,s),t=t.next,s++}map(e){const t=new r;let s=this.head;for(;s;)t.push(e(s.val)),s=s.next;return t}filter(e){const t=new r;let s=this.head;for(;s;)e(s.val)&&t.push(s.val),s=s.next;return t}reduce(e,t){let s=t,r=this.head;for(;r;)s=e(s,r.val),r=r.next;return s}insertAfter(e,t){let r;if(r=e instanceof s?e:this.findNode(e),r){const e=new s(t);return e.next=r.next,r.next&&(r.next.prev=e),e.prev=r,r.next=e,r===this.tail&&(this.tail=e),this._length++,!0}return!1}insertBefore(e,t){let r;if(r=e instanceof s?e:this.findNode(e),r){const e=new s(t);return e.prev=r.prev,r.prev&&(r.prev.next=e),e.next=r,r.prev=e,r===this.head&&(this.head=e),this._length++,!0}return!1}}t.DoublyLinkedList=r},2324:function(e,t,s){var r=this&&this.__createBinding||(Object.create?function(e,t,s,r){void 0===r&&(r=s);var i=Object.getOwnPropertyDescriptor(t,s);i&&!("get"in i?!t.__esModule:i.writable||i.configurable)||(i={enumerable:!0,get:function(){return t[s]}}),Object.defineProperty(e,r,i)}:function(e,t,s,r){void 0===r&&(r=s),e[r]=t[s]}),i=this&&this.__exportStar||function(e,t){for(var s in e)"default"===s||Object.prototype.hasOwnProperty.call(t,s)||r(t,e,s)};Object.defineProperty(t,"__esModule",{value:!0}),i(s(8549),t),i(s(2198),t),i(s(5435),t)},8549:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.SinglyLinkedList=t.SinglyLinkedListNode=void 0;class s{constructor(e){this._val=e,this._next=null}get val(){return this._val}set val(e){this._val=e}get next(){return this._next}set next(e){this._next=e}}t.SinglyLinkedListNode=s;class r{constructor(){this._head=null,this._tail=null,this._length=0}get head(){return this._head}set head(e){this._head=e}get tail(){return this._tail}set tail(e){this._tail=e}get length(){return this._length}static fromArray(e){const t=new r;for(const s of e)t.push(s);return t}getLength(){return this._length}push(e){const t=new s(e);this.head?(this.tail.next=t,this.tail=t):(this.head=t,this.tail=t),this._length++}pop(){if(!this.head)return null;if(this.head===this.tail){const e=this.head.val;return this.head=null,this.tail=null,this._length--,e}let e=this.head;for(;e.next!==this.tail;)e=e.next;const t=this.tail.val;return e.next=null,this.tail=e,this._length--,t}shift(){if(!this.head)return null;const e=this.head;return this.head=this.head.next,this._length--,e.val}unshift(e){const t=new s(e);this.head?(t.next=this.head,this.head=t):(this.head=t,this.tail=t),this._length++}getAt(e){if(e<0||e>=this.length)return null;let t=this.head;for(let s=0;s<e;s++)t=t.next;return t.val}getNodeAt(e){let t=this.head;for(let s=0;s<e;s++)t=t.next;return t}deleteAt(e){if(e<0||e>=this.length)return null;if(0===e)return this.shift();if(e===this.length-1)return this.pop();const t=this.getNodeAt(e-1),s=t.next;return t.next=s.next,this._length--,s.val}delete(e){let t;t=e instanceof s?e.val:e;let r=this.head,i=null;for(;r;){if(r.val===t)return null===i?(this.head=r.next,r===this.tail&&(this.tail=null)):(i.next=r.next,r===this.tail&&(this.tail=i)),this._length--,!0;i=r,r=r.next}return!1}insertAt(e,t){if(e<0||e>this.length)return!1;if(0===e)return this.unshift(t),!0;if(e===this.length)return this.push(t),!0;const r=new s(t),i=this.getNodeAt(e-1);return r.next=i.next,i.next=r,this._length++,!0}isEmpty(){return 0===this.length}clear(){this._head=null,this._tail=null,this._length=0}toArray(){const e=[];let t=this.head;for(;t;)e.push(t.val),t=t.next;return e}reverse(){if(!this.head||this.head===this.tail)return;let e=null,t=this.head,s=null;for(;t;)s=t.next,t.next=e,e=t,t=s;[this.head,this.tail]=[this.tail,this.head]}find(e){let t=this.head;for(;t;){if(e(t.val))return t.val;t=t.next}return null}indexOf(e){let t=0,s=this.head;for(;s;){if(s.val===e)return t;t++,s=s.next}return-1}findNode(e){let t=this.head;for(;t;){if(t.val===e)return t;t=t.next}return null}insertBefore(e,t){if(!this.head)return!1;let r;if(r=e instanceof s?e.val:e,this.head.val===r)return this.unshift(t),!0;let i=this.head;for(;i.next;){if(i.next.val===r){const e=new s(t);return e.next=i.next,i.next=e,this._length++,!0}i=i.next}return!1}insertAfter(e,t){let r;if(r=e instanceof s?e:this.findNode(e),r){const e=new s(t);return e.next=r.next,r.next=e,r===this.tail&&(this.tail=e),this._length++,!0}return!1}countOccurrences(e){let t=0,s=this.head;for(;s;)s.val===e&&t++,s=s.next;return t}}t.SinglyLinkedList=r},5435:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.SkipLinkedList=void 0,t.SkipLinkedList=class{}},7619:function(e,t,s){var r=this&&this.__createBinding||(Object.create?function(e,t,s,r){void 0===r&&(r=s);var i=Object.getOwnPropertyDescriptor(t,s);i&&!("get"in i?!t.__esModule:i.writable||i.configurable)||(i={enumerable:!0,get:function(){return t[s]}}),Object.defineProperty(e,r,i)}:function(e,t,s,r){void 0===r&&(r=s),e[r]=t[s]}),i=this&&this.__exportStar||function(e,t){for(var s in e)"default"===s||Object.prototype.hasOwnProperty.call(t,s)||r(t,e,s)};Object.defineProperty(t,"__esModule",{value:!0}),i(s(4824),t),i(s(6090),t),i(s(8723),t),i(s(6690),t)},4824:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.MatrixNTI2D=void 0,t.MatrixNTI2D=class{constructor(e){const{row:t,col:s,initialVal:r}=e;this._matrix=new Array(t).fill(void 0).map((()=>new Array(s).fill(r||0)))}toArray(){return this._matrix}}},8723:function(e,t,s){var r=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0}),t.Matrix2D=void 0;const i=r(s(6090));class n{constructor(e){void 0===e?this._matrix=n.identity:e instanceof i.default?(this._matrix=n.identity,this._matrix[0][0]=e.x,this._matrix[1][0]=e.y,this._matrix[2][0]=e.w):this._matrix=e}static get empty(){return[[],[],[]]}static get identity(){return[[1,0,0],[0,1,0],[0,0,1]]}get m(){return this._matrix}get toVector(){return new i.default(this._matrix[0][0],this._matrix[1][0])}static add(e,t){const s=n.empty;for(let r=0;r<3;r++)for(let i=0;i<3;i++)s[r][i]=e.m[r][i]+t.m[r][i];return new n(s)}static subtract(e,t){const s=n.empty;for(let r=0;r<3;r++)for(let i=0;i<3;i++)s[r][i]=e.m[r][i]-t.m[r][i];return new n(s)}static multiply(e,t){const s=n.empty;for(let r=0;r<3;r++)for(let i=0;i<3;i++){s[r][i]=0;for(let n=0;n<3;n++)s[r][i]+=e.m[r][n]*t.m[n][i]}return new n(s)}static multiplyByValue(e,t){const s=n.empty;for(let r=0;r<3;r++)for(let i=0;i<3;i++)s[r][i]=e.m[r][i]*t;return new n(s)}static multiplyByVector(e,t){return n.multiply(e,new n(t)).toVector}static view(e,t){const s=e/2,r=t/2,i=Math.cos(Math.PI);return new n([[1,0,s],[0,1*i,r],[0,0,1]])}static scale(e){return n.multiplyByValue(new n,e)}static rotate(e){const t=Math.cos(e),s=Math.sin(e);return new n([[t,-s,0],[s,t,0],[0,0,1]])}static translate(e){return new n([[1,0,e.x],[0,1,e.y],[0,0,e.w]])}}t.Matrix2D=n,t.default=n},6690:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.Navigator=t.Character=void 0;class s{constructor(e,t){this.direction=e,this.turn=()=>new s(t[e],t)}}t.Character=s,t.Navigator=class{constructor({matrix:e,turning:t,onMove:r,init:{cur:i,charDir:n,VISITED:o}}){this._matrix=e,this._cur=i,this._character=new s(n,t),this.onMove=r,this.onMove&&this.onMove(this._cur),this._VISITED=o,this._matrix[this._cur[0]][this._cur[1]]=this._VISITED}start(){for(;this.check(this._character.direction)||this.check(this._character.turn().direction);){const{direction:e}=this._character;this.check(e)?this.move(e):this.check(this._character.turn().direction)&&(this._character=this._character.turn())}}check(e){let t,s;const r=this._matrix,[i,n]=this._cur;switch(e){case"up":if(s=r[i-1],!s)return!1;t=s[n];break;case"right":t=r[i][n+1];break;case"down":if(s=r[i+1],!s)return!1;t=s[n];break;case"left":t=r[i][n-1]}return void 0!==t&&t!==this._VISITED}move(e){switch(e){case"up":this._cur[0]--;break;case"right":this._cur[1]++;break;case"down":this._cur[0]++;break;case"left":this._cur[1]--}const[t,s]=this._cur;this._matrix[t][s]=this._VISITED,this.onMove&&this.onMove(this._cur)}}},6090:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.Vector2D=void 0;class s{constructor(e=0,t=0,s=1){this.x=e,this.y=t,this.w=s}get isZero(){return 0===this.x&&0===this.y}get length(){return Math.sqrt(this.x*this.x+this.y*this.y)}get lengthSq(){return this.x*this.x+this.y*this.y}get rounded(){return new s(Math.round(this.x),Math.round(this.y))}static add(e,t){return new s(e.x+t.x,e.y+t.y)}static subtract(e,t){return new s(e.x-t.x,e.y-t.y)}static subtractValue(e,t){return new s(e.x-t,e.y-t)}static multiply(e,t){return new s(e.x*t,e.y*t)}static divide(e,t){return new s(e.x/t,e.y/t)}static equals(e,t){return e.x===t.x&&e.y===t.y}static equalsRounded(e,t,r=12){const i=s.abs(s.subtract(e,t));return i.x<r&&i.y<r}static normalize(e){const t=e.length;return t>2220446049250313e-31?s.divide(e,t):e}static truncate(e,t){return e.length>t?s.multiply(s.normalize(e),t):e}static perp(e){return new s(-e.y,e.x)}static reverse(e){return new s(-e.x,-e.y)}static abs(e){return new s(Math.abs(e.x),Math.abs(e.y))}static dot(e,t){return e.x*t.x+e.y*t.y}static distance(e,t){const s=t.y-e.y,r=t.x-e.x;return Math.sqrt(s*s+r*r)}static distanceSq(e,t){const s=t.y-e.y,r=t.x-e.x;return s*s+r*r}static sign(e,t){return e.y*t.x>e.x*t.y?-1:1}static angle(e){const t=new s(0,-1),r=Math.acos(s.dot(e,t)/(e.length*t.length));return 1===s.sign(e,t)?2*Math.PI-r:r}static random(e,t){const r=Math.floor(Math.random()*e-e/2),i=Math.floor(Math.random()*t-t/2);return new s(r,i)}zero(){this.x=0,this.y=0}}t.Vector2D=s,t.default=s},7641:function(e,t,s){var r=this&&this.__createBinding||(Object.create?function(e,t,s,r){void 0===r&&(r=s);var i=Object.getOwnPropertyDescriptor(t,s);i&&!("get"in i?!t.__esModule:i.writable||i.configurable)||(i={enumerable:!0,get:function(){return t[s]}}),Object.defineProperty(e,r,i)}:function(e,t,s,r){void 0===r&&(r=s),e[r]=t[s]}),i=this&&this.__exportStar||function(e,t){for(var s in e)"default"===s||Object.prototype.hasOwnProperty.call(t,s)||r(t,e,s)};Object.defineProperty(t,"__esModule",{value:!0}),i(s(3491),t),i(s(7016),t),i(s(7021),t)},7021:(e,t,s)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.MaxPriorityQueue=void 0;const r=s(3491);class i extends r.PriorityQueue{constructor(e){super(Object.assign(Object.assign({},e),{comparator:(null==e?void 0:e.comparator)?e.comparator:(e,t)=>t-e}))}static heapify(e){const t=new i(Object.assign(Object.assign({},e),{comparator:(null==e?void 0:e.comparator)?e.comparator:(e,t)=>t-e}));return t._fix(),t}}t.MaxPriorityQueue=i},7016:(e,t,s)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.MinPriorityQueue=void 0;const r=s(3491);class i extends r.PriorityQueue{constructor(e){super(Object.assign(Object.assign({},e),{comparator:(null==e?void 0:e.comparator)?e.comparator:(e,t)=>e-t}))}static heapify(e){const t=new i(Object.assign(Object.assign({},e),{comparator:(null==e?void 0:e.comparator)?e.comparator:(e,t)=>e-t}));return t._fix(),t}}t.MinPriorityQueue=i},3491:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.PriorityQueue=void 0;class s{constructor(e){this._nodes=[],this._comparator=(e,t)=>e-t;const{nodes:t,comparator:s,isFix:r=!0}=e;this._comparator=s,t&&Array.isArray(t)&&t.length>0&&(this._nodes=[...t],r&&this._fix())}get nodes(){return this._nodes}get size(){return this.nodes.length}static heapify(e){const t=new s(e);return t._fix(),t}static isPriorityQueueified(e){return new s(Object.assign(Object.assign({},e),{isFix:!1})).isValid()}getNodes(){return this._nodes}add(e){this.nodes.push(e),this._heapifyUp(this.size-1)}has(e){return this.nodes.includes(e)}peek(){return this.size?this.nodes[0]:null}poll(){var e,t;let s=null;return this.size>1?(this._swap(0,this.nodes.length-1),s=null!==(e=this.nodes.pop())&&void 0!==e?e:null,this._heapifyDown(0)):1===this.size&&(s=null!==(t=this.nodes.pop())&&void 0!==t?t:null),s}leaf(){var e;return null!==(e=this.nodes[this.size-1])&&void 0!==e?e:null}isEmpty(){return 0===this.size}clear(){this._setNodes([])}toArray(){return[...this.nodes]}clone(){return new s({nodes:this.nodes,comparator:this._comparator})}isValid(){for(let e=0;e<this.nodes.length;e++){const t=this._getLeft(e),s=this._getRight(e);if(this._isValidIndex(t)&&!this._compare(t,e))return!1;if(this._isValidIndex(s)&&!this._compare(s,e))return!1}return!0}sort(){const e=[];for(;0!==this.size;){const t=this.poll();t&&e.push(t)}return e}DFS(e){const t=[],s=r=>{var i,n,o;const a=this._getLeft(r),d=this._getRight(r);switch(e){case"in":this._isValidIndex(a)&&s(a),t.push(null!==(i=this.nodes[r])&&void 0!==i?i:null),this._isValidIndex(d)&&s(d);break;case"pre":t.push(null!==(n=this.nodes[r])&&void 0!==n?n:null),this._isValidIndex(a)&&s(a),this._isValidIndex(d)&&s(d);break;case"post":this._isValidIndex(a)&&s(a),this._isValidIndex(d)&&s(d),t.push(null!==(o=this.nodes[r])&&void 0!==o?o:null)}};return this._isValidIndex(0)&&s(0),t}_setNodes(e){this._nodes=e}_compare(e,t){return this._comparator(this.nodes[e],this.nodes[t])>0}_swap(e,t){const s=this.nodes[e];this.nodes[e]=this.nodes[t],this.nodes[t]=s}_isValidIndex(e){return e>-1&&e<this.nodes.length}_getParent(e){return Math.floor((e-1)/2)}_getLeft(e){return 2*e+1}_getRight(e){return 2*e+2}_getComparedChild(e){let t=e;const s=this._getLeft(e),r=this._getRight(e);return s<this.size&&this._compare(t,s)&&(t=s),r<this.size&&this._compare(t,r)&&(t=r),t}_heapifyUp(e){for(;e>0&&this._compare(this._getParent(e),e);){const t=this._getParent(e);this._swap(e,t),e=t}}_heapifyDown(e){let t=this._getComparedChild(e);for(;this._compare(e,t);)this._swap(t,e),e=t,t=this._getComparedChild(e)}_fix(){for(let e=Math.floor(this.size/2);e>-1;e--)this._heapifyDown(e)}}t.PriorityQueue=s},7569:(e,t,s)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.ArrayDeque=t.ObjectDeque=t.Deque=void 0;const r=s(2324);class i extends r.DoublyLinkedList{}t.Deque=i,t.ObjectDeque=class{constructor(e){this._nodes={},this._capacity=Number.MAX_SAFE_INTEGER,this._first=-1,this._last=-1,this._size=0,void 0!==e&&(this._capacity=e)}get nodes(){return this._nodes}get capacity(){return this._capacity}set capacity(e){this._capacity=e}get first(){return this._first}set first(e){this._first=e}get last(){return this._last}set last(e){this._last=e}get size(){return this._size}addFirst(e){if(0===this._size){const e=Math.floor(this._capacity/2);this._first=e,this._last=e}else this._first--;this._nodes[this._first]=e,this._size++}addLast(e){if(0===this._size){const e=Math.floor(this._capacity/2);this._first=e,this._last=e}else this._last++;this._nodes[this._last]=e,this._size++}pollFirst(){if(!this._size)return;const e=this.peekFirst();return delete this._nodes[this._first],this._first++,this._size--,e}peekFirst(){if(this._size)return this._nodes[this._first]}pollLast(){if(!this._size)return;const e=this.peekLast();return delete this._nodes[this._last],this._last--,this._size--,e}peekLast(){if(this._size)return this._nodes[this._last]}get(e){return this._nodes[this._first+e]||null}isEmpty(){return this._size<=0}_seNodes(e){this._nodes=e}_setSize(e){this._size=e}},t.ArrayDeque=class{constructor(){this._nodes=[]}get size(){return this._nodes.length}addLast(e){return this._nodes.push(e)}pollLast(){var e;return null!==(e=this._nodes.pop())&&void 0!==e?e:null}pollFirst(){var e;return null!==(e=this._nodes.shift())&&void 0!==e?e:null}addFirst(e){return this._nodes.unshift(e)}peekFirst(){var e;return null!==(e=this._nodes[0])&&void 0!==e?e:null}peekLast(){var e;return null!==(e=this._nodes[this._nodes.length-1])&&void 0!==e?e:null}get(e){var t;return null!==(t=this._nodes[e])&&void 0!==t?t:null}set(e,t){return this._nodes[e]=t}insert(e,t){return this._nodes.splice(e,0,t)}remove(e){return this._nodes.splice(e,1)}isEmpty(){return 0===this._nodes.length}}},2627:function(e,t,s){var r=this&&this.__createBinding||(Object.create?function(e,t,s,r){void 0===r&&(r=s);var i=Object.getOwnPropertyDescriptor(t,s);i&&!("get"in i?!t.__esModule:i.writable||i.configurable)||(i={enumerable:!0,get:function(){return t[s]}}),Object.defineProperty(e,r,i)}:function(e,t,s,r){void 0===r&&(r=s),e[r]=t[s]}),i=this&&this.__exportStar||function(e,t){for(var s in e)"default"===s||Object.prototype.hasOwnProperty.call(t,s)||r(t,e,s)};Object.defineProperty(t,"__esModule",{value:!0}),i(s(3295),t),i(s(7569),t)},3295:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.Queue=void 0;class s{constructor(e){this._nodes=e||[],this._offset=0}static fromArray(e){return new s(e)}add(e){return this._nodes.push(e),this}poll(){if(0===this.size())return null;const e=this.peek();return this._offset+=1,2*this._offset<this._nodes.length||(this._nodes=this._nodes.slice(this._offset),this._offset=0),e}peek(){return this.size()>0?this._nodes[this._offset]:null}peekLast(){return this.size()>0?this._nodes[this._nodes.length-1]:null}size(){return this._nodes.length-this._offset}isEmpty(){return 0===this.size()}toArray(){return this._nodes.slice(this._offset)}clear(){this._nodes=[],this._offset=0}clone(){return new s(this._nodes.slice(this._offset))}}t.Queue=s},9509:function(e,t,s){var r=this&&this.__createBinding||(Object.create?function(e,t,s,r){void 0===r&&(r=s);var i=Object.getOwnPropertyDescriptor(t,s);i&&!("get"in i?!t.__esModule:i.writable||i.configurable)||(i={enumerable:!0,get:function(){return t[s]}}),Object.defineProperty(e,r,i)}:function(e,t,s,r){void 0===r&&(r=s),e[r]=t[s]}),i=this&&this.__exportStar||function(e,t){for(var s in e)"default"===s||Object.prototype.hasOwnProperty.call(t,s)||r(t,e,s)};Object.defineProperty(t,"__esModule",{value:!0}),i(s(6006),t)},6006:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.Stack=void 0;class s{constructor(e){this._elements=Array.isArray(e)?e:[]}static fromArray(e){return new s(e)}isEmpty(){return 0===this._elements.length}size(){return this._elements.length}peek(){return this.isEmpty()?null:this._elements[this._elements.length-1]}push(e){return this._elements.push(e),this}pop(){return this.isEmpty()?null:this._elements.pop()||null}toArray(){return this._elements.slice()}clear(){this._elements=[]}clone(){return new s(this._elements.slice())}}t.Stack=s},8456:function(e,t,s){var r=this&&this.__createBinding||(Object.create?function(e,t,s,r){void 0===r&&(r=s);var i=Object.getOwnPropertyDescriptor(t,s);i&&!("get"in i?!t.__esModule:i.writable||i.configurable)||(i={enumerable:!0,get:function(){return t[s]}}),Object.defineProperty(e,r,i)}:function(e,t,s,r){void 0===r&&(r=s),e[r]=t[s]}),i=this&&this.__exportStar||function(e,t){for(var s in e)"default"===s||Object.prototype.hasOwnProperty.call(t,s)||r(t,e,s)};Object.defineProperty(t,"__esModule",{value:!0}),i(s(301),t)},301:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.TreeNode=void 0;class s{constructor(e,t,s){this._id=e,this._value=t||void 0,this._children=s||[]}get id(){return this._id}set id(e){this._id=e}get value(){return this._value}set value(e){this._value=e}get children(){return this._children}set children(e){this._children=e}addChildren(e){this.children||(this.children=[]),e instanceof s?this.children.push(e):this.children=this.children.concat(e)}getHeight(){const e=this;let t=1;if(e){const s=(e,r)=>{r>t&&(t=r);const{children:i}=e;if(i)for(let e=0,t=i.length;e<t;e++)s(i[e],r+1)};s(e,1)}return t}}t.TreeNode=s},3543:function(e,t,s){var r=this&&this.__createBinding||(Object.create?function(e,t,s,r){void 0===r&&(r=s);var i=Object.getOwnPropertyDescriptor(t,s);i&&!("get"in i?!t.__esModule:i.writable||i.configurable)||(i={enumerable:!0,get:function(){return t[s]}}),Object.defineProperty(e,r,i)}:function(e,t,s,r){void 0===r&&(r=s),e[r]=t[s]}),i=this&&this.__exportStar||function(e,t){for(var s in e)"default"===s||Object.prototype.hasOwnProperty.call(t,s)||r(t,e,s)};Object.defineProperty(t,"__esModule",{value:!0}),i(s(2952),t)},2952:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.Trie=t.TrieNode=void 0;class s{constructor(e){this._val=e,this._isEnd=!1,this._children=new Map}get val(){return this._val}set val(e){this._val=e}get children(){return this._children}set children(e){this._children=e}get isEnd(){return this._isEnd}set isEnd(e){this._isEnd=e}}t.TrieNode=s,t.Trie=class{constructor(e){if(this._root=new s(""),e)for(const t of e)this.add(t)}get root(){return this._root}set root(e){this._root=e}add(e){let t=this._root;for(const r of e){let e=t.children.get(r);e||(e=new s(r),t.children.set(r,e)),t=e}return t.isEnd=!0,!0}has(e){let t=this._root;for(const s of e){const e=t.children.get(s);if(!e)return!1;t=e}return t.isEnd}remove(e){let t=!1;const s=(r,i)=>{const n=e[i],o=r.children.get(n);return!!o&&(i===e.length-1?!!o.isEnd&&(o.children.size>0?o.isEnd=!1:r.children.delete(n),t=!0,!0):!(!s(o,i+1)||r.isEnd||0!==o.children.size||(r.children.delete(n),0)))};return s(this.root,0),t}isAbsPrefix(e){let t=this._root;for(const s of e){const e=t.children.get(s);if(!e)return!1;t=e}return!t.isEnd}isPrefix(e){let t=this._root;for(const s of e){const e=t.children.get(s);if(!e)return!1;t=e}return!0}isCommonPrefix(e){let t="";const s=r=>{t+=r.val,t!==e&&(r.isEnd||r&&r.children&&1===r.children.size&&s(Array.from(r.children.values())[0]))};return s(this._root),t===e}getLongestCommonPrefix(){let e="";const t=s=>{e+=s.val,s.isEnd||s&&s.children&&1===s.children.size&&t(Array.from(s.children.values())[0])};return t(this._root),e}getAll(e=""){const t=[];let s=this._root;if(e)for(const t of e){const e=s.children.get(t);e&&(s=e)}return function e(s,r){for(const t of s.children.keys()){const i=s.children.get(t);void 0!==i&&e(i,r.concat(t))}s.isEnd&&t.push(r)}(s,e),t}}},2351:(e,t)=>{var s,r;Object.defineProperty(t,"__esModule",{value:!0}),t.FamilyPosition=t.LoopType=void 0,(r=t.LoopType||(t.LoopType={})).ITERATIVE="ITERATIVE",r.RECURSIVE="RECURSIVE",(s=t.FamilyPosition||(t.FamilyPosition={})).ROOT="ROOT",s.LEFT="LEFT",s.RIGHT="RIGHT",s.ROOT_LEFT="ROOT_LEFT",s.ROOT_RIGHT="ROOT_RIGHT",s.ISOLATED="ISOLATED",s.MAL_NODE="MAL_NODE"},6835:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0})},7327:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0})},7749:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0})},4357:(e,t)=>{var s;Object.defineProperty(t,"__esModule",{value:!0}),t.CP=void 0,(s=t.CP||(t.CP={})).lt="lt",s.eq="eq",s.gt="gt"},3429:(e,t)=>{var s;Object.defineProperty(t,"__esModule",{value:!0}),t.TopologicalProperty=void 0,(s=t.TopologicalProperty||(t.TopologicalProperty={})).VAL="VAL",s.NODE="NODE",s.ID="ID"},7882:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0})},1787:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0})},5453:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0})},9011:function(e,t,s){var r=this&&this.__createBinding||(Object.create?function(e,t,s,r){void 0===r&&(r=s);var i=Object.getOwnPropertyDescriptor(t,s);i&&!("get"in i?!t.__esModule:i.writable||i.configurable)||(i={enumerable:!0,get:function(){return t[s]}}),Object.defineProperty(e,r,i)}:function(e,t,s,r){void 0===r&&(r=s),e[r]=t[s]}),i=this&&this.__exportStar||function(e,t){for(var s in e)"default"===s||Object.prototype.hasOwnProperty.call(t,s)||r(t,e,s)};Object.defineProperty(t,"__esModule",{value:!0}),i(s(7749),t),i(s(4357),t),i(s(7327),t),i(s(7406),t),i(s(826),t),i(s(6835),t),i(s(5816),t),i(s(2351),t),i(s(5048),t),i(s(3429),t),i(s(575),t),i(s(1787),t),i(s(4567),t),i(s(7882),t),i(s(4752),t),i(s(5453),t)},5816:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0})},4752:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0})},575:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0})},5048:(e,t)=>{var s;Object.defineProperty(t,"__esModule",{value:!0}),t.RBColor=void 0,(s=t.RBColor||(t.RBColor={})).RED="RED",s.BLACK="BLACK"},7406:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0})},4567:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0})},826:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0})},3607:function(e,t,s){var r=this&&this.__createBinding||(Object.create?function(e,t,s,r){void 0===r&&(r=s);var i=Object.getOwnPropertyDescriptor(t,s);i&&!("get"in i?!t.__esModule:i.writable||i.configurable)||(i={enumerable:!0,get:function(){return t[s]}}),Object.defineProperty(e,r,i)}:function(e,t,s,r){void 0===r&&(r=s),e[r]=t[s]}),i=this&&this.__exportStar||function(e,t){for(var s in e)"default"===s||Object.prototype.hasOwnProperty.call(t,s)||r(t,e,s)};Object.defineProperty(t,"__esModule",{value:!0}),i(s(4866),t),i(s(5928),t)},5928:function(e,t,s){var r=this&&this.__createBinding||(Object.create?function(e,t,s,r){void 0===r&&(r=s);var i=Object.getOwnPropertyDescriptor(t,s);i&&!("get"in i?!t.__esModule:i.writable||i.configurable)||(i={enumerable:!0,get:function(){return t[s]}}),Object.defineProperty(e,r,i)}:function(e,t,s,r){void 0===r&&(r=s),e[r]=t[s]}),i=this&&this.__exportStar||function(e,t){for(var s in e)"default"===s||Object.prototype.hasOwnProperty.call(t,s)||r(t,e,s)};Object.defineProperty(t,"__esModule",{value:!0}),i(s(974),t),i(s(3202),t),i(s(8802),t)},3202:function(e,t,s){var r=this&&this.__createBinding||(Object.create?function(e,t,s,r){void 0===r&&(r=s);var i=Object.getOwnPropertyDescriptor(t,s);i&&!("get"in i?!t.__esModule:i.writable||i.configurable)||(i={enumerable:!0,get:function(){return t[s]}}),Object.defineProperty(e,r,i)}:function(e,t,s,r){void 0===r&&(r=s),e[r]=t[s]}),i=this&&this.__exportStar||function(e,t){for(var s in e)"default"===s||Object.prototype.hasOwnProperty.call(t,s)||r(t,e,s)};Object.defineProperty(t,"__esModule",{value:!0}),i(s(9738),t),i(s(3527),t)},9738:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0})},3527:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0})},974:function(e,t){var s=this&&this.__awaiter||function(e,t,s,r){return new(s||(s=Promise))((function(i,n){function o(e){try{d(r.next(e))}catch(e){n(e)}}function a(e){try{d(r.throw(e))}catch(e){n(e)}}function d(e){var t;e.done?i(e.value):(t=e.value,t instanceof s?t:new s((function(e){e(t)}))).then(o,a)}d((r=r.apply(e,t||[])).next())}))};Object.defineProperty(t,"__esModule",{value:!0}),t.trampolineAsync=t.trampoline=t.toThunk=t.isThunk=t.THUNK_SYMBOL=t.arrayRemove=t.uuidV4=void 0,t.uuidV4=function(){return"xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx".replace(/[x]/g,(function(e){const t=16*Math.random()|0;return("x"==e?t:3&t|8).toString(16)}))},t.arrayRemove=function(e,t){let s=-1,r=e?e.length:0;const i=[];for(;++s<r;){const n=e[s];t(n,s,e)&&(i.push(n),Array.prototype.splice.call(e,s--,1),r--)}return i},t.THUNK_SYMBOL=Symbol("thunk"),t.isThunk=e=>"function"==typeof e&&e.__THUNK__===t.THUNK_SYMBOL,t.toThunk=e=>{const s=()=>e();return s.__THUNK__=t.THUNK_SYMBOL,s},t.trampoline=e=>Object.assign(((...s)=>{let r=e(...s);for(;(0,t.isThunk)(r)&&"function"==typeof r;)r=r();return r}),{cont:(...s)=>(0,t.toThunk)((()=>e(...s)))}),t.trampolineAsync=e=>Object.assign(((...r)=>s(void 0,void 0,void 0,(function*(){let s=yield e(...r);for(;(0,t.isThunk)(s)&&"function"==typeof s;)s=yield s();return s}))),{cont:(...s)=>(0,t.toThunk)((()=>e(...s)))})},8802:(e,t,s)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.isNumber=t.isObjectWithNumberId=t.isObjectWithNonNumberId=t.isObjectWithoutId=t.isNonNumberNonObjectButDefined=t.parseBySchema=t.binaryTreeNodeValWithId=t.objectWithNumberIdSchema=t.objectWithNonNumberIdSchema=t.keyValueObjectWithIdSchema=t.objectWithoutIdSchema=t.keyValueObjectSchema=t.nonNumberNonObjectButDefinedSchema=void 0;const r=s(8754);function i(e,t){try{return e.parse(t),!0}catch(e){return!1}}t.nonNumberNonObjectButDefinedSchema=r.z.union([r.z.string(),r.z.boolean(),r.z.any()]).nullable(),t.keyValueObjectSchema=r.z.record(r.z.unknown()),t.objectWithoutIdSchema=t.keyValueObjectSchema.refine((e=>!("id"in e)),{message:"Object cannot contain the 'id' field"}),t.keyValueObjectWithIdSchema=r.z.record(r.z.any()).and(r.z.object({id:r.z.union([r.z.string(),r.z.number(),r.z.any()])})),t.objectWithNonNumberIdSchema=r.z.record(r.z.any()).and(r.z.object({id:r.z.union([r.z.string(),r.z.boolean(),r.z.any(),r.z.any(),r.z.undefined()]).nullable()})),t.objectWithNumberIdSchema=r.z.record(r.z.any()).and(r.z.object({id:r.z.number()})),t.binaryTreeNodeValWithId=r.z.union([t.nonNumberNonObjectButDefinedSchema,t.objectWithoutIdSchema,t.objectWithNonNumberIdSchema,t.objectWithNumberIdSchema]),t.parseBySchema=i,t.isNonNumberNonObjectButDefined=function(e){return i(t.nonNumberNonObjectButDefinedSchema,e)},t.isObjectWithoutId=function(e){return i(t.objectWithoutIdSchema,e)},t.isObjectWithNonNumberId=function(e){return i(t.objectWithNonNumberIdSchema,e)},t.isObjectWithNumberId=function(e){return i(t.objectWithNonNumberIdSchema,e)},t.isNumber=function(e){return"number"==typeof e}},8280:(e,t,s)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.ZodError=t.quotelessJson=t.ZodIssueCode=void 0;const r=s(9110);t.ZodIssueCode=r.util.arrayToEnum(["invalid_type","invalid_literal","custom","invalid_union","invalid_union_discriminator","invalid_enum_value","unrecognized_keys","invalid_arguments","invalid_return_type","invalid_date","invalid_string","too_small","too_big","invalid_intersection_types","not_multiple_of","not_finite"]),t.quotelessJson=e=>JSON.stringify(e,null,2).replace(/"([^"]+)":/g,"$1:");class i extends Error{constructor(e){super(),this.issues=[],this.addIssue=e=>{this.issues=[...this.issues,e]},this.addIssues=(e=[])=>{this.issues=[...this.issues,...e]};const t=new.target.prototype;Object.setPrototypeOf?Object.setPrototypeOf(this,t):this.__proto__=t,this.name="ZodError",this.issues=e}get errors(){return this.issues}format(e){const t=e||function(e){return e.message},s={_errors:[]},r=e=>{for(const i of e.issues)if("invalid_union"===i.code)i.unionErrors.map(r);else if("invalid_return_type"===i.code)r(i.returnTypeError);else if("invalid_arguments"===i.code)r(i.argumentsError);else if(0===i.path.length)s._errors.push(t(i));else{let e=s,r=0;for(;r<i.path.length;){const s=i.path[r];r===i.path.length-1?(e[s]=e[s]||{_errors:[]},e[s]._errors.push(t(i))):e[s]=e[s]||{_errors:[]},e=e[s],r++}}};return r(this),s}toString(){return this.message}get message(){return JSON.stringify(this.issues,r.util.jsonStringifyReplacer,2)}get isEmpty(){return 0===this.issues.length}flatten(e=(e=>e.message)){const t={},s=[];for(const r of this.issues)r.path.length>0?(t[r.path[0]]=t[r.path[0]]||[],t[r.path[0]].push(e(r))):s.push(e(r));return{formErrors:s,fieldErrors:t}}get formErrors(){return this.flatten()}}t.ZodError=i,i.create=e=>new i(e)},6996:function(e,t,s){var r=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0}),t.getErrorMap=t.setErrorMap=t.defaultErrorMap=void 0;const i=r(s(9349));t.defaultErrorMap=i.default;let n=i.default;t.setErrorMap=function(e){n=e},t.getErrorMap=function(){return n}},6349:function(e,t,s){var r=this&&this.__createBinding||(Object.create?function(e,t,s,r){void 0===r&&(r=s),Object.defineProperty(e,r,{enumerable:!0,get:function(){return t[s]}})}:function(e,t,s,r){void 0===r&&(r=s),e[r]=t[s]}),i=this&&this.__exportStar||function(e,t){for(var s in e)"default"===s||Object.prototype.hasOwnProperty.call(t,s)||r(t,e,s)};Object.defineProperty(t,"__esModule",{value:!0}),i(s(6996),t),i(s(3187),t),i(s(116),t),i(s(9110),t),i(s(5433),t),i(s(8280),t)},8762:(e,t)=>{var s;Object.defineProperty(t,"__esModule",{value:!0}),t.errorUtil=void 0,(s=t.errorUtil||(t.errorUtil={})).errToObj=e=>"string"==typeof e?{message:e}:e||{},s.toString=e=>"string"==typeof e?e:null==e?void 0:e.message},3187:function(e,t,s){var r=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0}),t.isAsync=t.isValid=t.isDirty=t.isAborted=t.OK=t.DIRTY=t.INVALID=t.ParseStatus=t.addIssueToContext=t.EMPTY_PATH=t.makeIssue=void 0;const i=s(6996),n=r(s(9349));t.makeIssue=e=>{const{data:t,path:s,errorMaps:r,issueData:i}=e,n=[...s,...i.path||[]],o={...i,path:n};let a="";const d=r.filter((e=>!!e)).slice().reverse();for(const e of d)a=e(o,{data:t,defaultError:a}).message;return{...i,path:n,message:i.message||a}},t.EMPTY_PATH=[],t.addIssueToContext=function(e,s){const r=(0,t.makeIssue)({issueData:s,data:e.data,path:e.path,errorMaps:[e.common.contextualErrorMap,e.schemaErrorMap,(0,i.getErrorMap)(),n.default].filter((e=>!!e))});e.common.issues.push(r)};class o{constructor(){this.value="valid"}dirty(){"valid"===this.value&&(this.value="dirty")}abort(){"aborted"!==this.value&&(this.value="aborted")}static mergeArray(e,s){const r=[];for(const i of s){if("aborted"===i.status)return t.INVALID;"dirty"===i.status&&e.dirty(),r.push(i.value)}return{status:e.value,value:r}}static async mergeObjectAsync(e,t){const s=[];for(const e of t)s.push({key:await e.key,value:await e.value});return o.mergeObjectSync(e,s)}static mergeObjectSync(e,s){const r={};for(const i of s){const{key:s,value:n}=i;if("aborted"===s.status)return t.INVALID;if("aborted"===n.status)return t.INVALID;"dirty"===s.status&&e.dirty(),"dirty"===n.status&&e.dirty(),"__proto__"===s.value||void 0===n.value&&!i.alwaysSet||(r[s.value]=n.value)}return{status:e.value,value:r}}}t.ParseStatus=o,t.INVALID=Object.freeze({status:"aborted"}),t.DIRTY=e=>({status:"dirty",value:e}),t.OK=e=>({status:"valid",value:e}),t.isAborted=e=>"aborted"===e.status,t.isDirty=e=>"dirty"===e.status,t.isValid=e=>"valid"===e.status,t.isAsync=e=>"undefined"!=typeof Promise&&e instanceof Promise},116:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0})},9110:(e,t)=>{var s;Object.defineProperty(t,"__esModule",{value:!0}),t.getParsedType=t.ZodParsedType=t.objectUtil=t.util=void 0,function(e){e.assertEqual=e=>e,e.assertIs=function(e){},e.assertNever=function(e){throw new Error},e.arrayToEnum=e=>{const t={};for(const s of e)t[s]=s;return t},e.getValidEnumValues=t=>{const s=e.objectKeys(t).filter((e=>"number"!=typeof t[t[e]])),r={};for(const e of s)r[e]=t[e];return e.objectValues(r)},e.objectValues=t=>e.objectKeys(t).map((function(e){return t[e]})),e.objectKeys="function"==typeof Object.keys?e=>Object.keys(e):e=>{const t=[];for(const s in e)Object.prototype.hasOwnProperty.call(e,s)&&t.push(s);return t},e.find=(e,t)=>{for(const s of e)if(t(s))return s},e.isInteger="function"==typeof Number.isInteger?e=>Number.isInteger(e):e=>"number"==typeof e&&isFinite(e)&&Math.floor(e)===e,e.joinValues=function(e,t=" | "){return e.map((e=>"string"==typeof e?`'${e}'`:e)).join(t)},e.jsonStringifyReplacer=(e,t)=>"bigint"==typeof t?t.toString():t}(s=t.util||(t.util={})),(t.objectUtil||(t.objectUtil={})).mergeShapes=(e,t)=>({...e,...t}),t.ZodParsedType=s.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]),t.getParsedType=e=>{switch(typeof e){case"undefined":return t.ZodParsedType.undefined;case"string":return t.ZodParsedType.string;case"number":return isNaN(e)?t.ZodParsedType.nan:t.ZodParsedType.number;case"boolean":return t.ZodParsedType.boolean;case"function":return t.ZodParsedType.function;case"bigint":return t.ZodParsedType.bigint;case"symbol":return t.ZodParsedType.symbol;case"object":return Array.isArray(e)?t.ZodParsedType.array:null===e?t.ZodParsedType.null:e.then&&"function"==typeof e.then&&e.catch&&"function"==typeof e.catch?t.ZodParsedType.promise:"undefined"!=typeof Map&&e instanceof Map?t.ZodParsedType.map:"undefined"!=typeof Set&&e instanceof Set?t.ZodParsedType.set:"undefined"!=typeof Date&&e instanceof Date?t.ZodParsedType.date:t.ZodParsedType.object;default:return t.ZodParsedType.unknown}}},8754:function(e,t,s){var r=this&&this.__createBinding||(Object.create?function(e,t,s,r){void 0===r&&(r=s),Object.defineProperty(e,r,{enumerable:!0,get:function(){return t[s]}})}:function(e,t,s,r){void 0===r&&(r=s),e[r]=t[s]}),i=this&&this.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),n=this&&this.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var s in e)"default"!==s&&Object.prototype.hasOwnProperty.call(e,s)&&r(t,e,s);return i(t,e),t},o=this&&this.__exportStar||function(e,t){for(var s in e)"default"===s||Object.prototype.hasOwnProperty.call(t,s)||r(t,e,s)};Object.defineProperty(t,"__esModule",{value:!0}),t.z=void 0;const a=n(s(6349));t.z=a,o(s(6349),t),t.default=a},9349:(e,t,s)=>{Object.defineProperty(t,"__esModule",{value:!0});const r=s(9110),i=s(8280);t.default=(e,t)=>{let s;switch(e.code){case i.ZodIssueCode.invalid_type:s=e.received===r.ZodParsedType.undefined?"Required":`Expected ${e.expected}, received ${e.received}`;break;case i.ZodIssueCode.invalid_literal:s=`Invalid literal value, expected ${JSON.stringify(e.expected,r.util.jsonStringifyReplacer)}`;break;case i.ZodIssueCode.unrecognized_keys:s=`Unrecognized key(s) in object: ${r.util.joinValues(e.keys,", ")}`;break;case i.ZodIssueCode.invalid_union:s="Invalid input";break;case i.ZodIssueCode.invalid_union_discriminator:s=`Invalid discriminator value. Expected ${r.util.joinValues(e.options)}`;break;case i.ZodIssueCode.invalid_enum_value:s=`Invalid enum value. Expected ${r.util.joinValues(e.options)}, received '${e.received}'`;break;case i.ZodIssueCode.invalid_arguments:s="Invalid function arguments";break;case i.ZodIssueCode.invalid_return_type:s="Invalid function return type";break;case i.ZodIssueCode.invalid_date:s="Invalid date";break;case i.ZodIssueCode.invalid_string:"object"==typeof e.validation?"includes"in e.validation?(s=`Invalid input: must include "${e.validation.includes}"`,"number"==typeof e.validation.position&&(s=`${s} at one or more positions greater than or equal to ${e.validation.position}`)):"startsWith"in e.validation?s=`Invalid input: must start with "${e.validation.startsWith}"`:"endsWith"in e.validation?s=`Invalid input: must end with "${e.validation.endsWith}"`:r.util.assertNever(e.validation):s="regex"!==e.validation?`Invalid ${e.validation}`:"Invalid";break;case i.ZodIssueCode.too_small:s="array"===e.type?`Array must contain ${e.exact?"exactly":e.inclusive?"at least":"more than"} ${e.minimum} element(s)`:"string"===e.type?`String must contain ${e.exact?"exactly":e.inclusive?"at least":"over"} ${e.minimum} character(s)`:"number"===e.type?`Number must be ${e.exact?"exactly equal to ":e.inclusive?"greater than or equal to ":"greater than "}${e.minimum}`:"date"===e.type?`Date must be ${e.exact?"exactly equal to ":e.inclusive?"greater than or equal to ":"greater than "}${new Date(Number(e.minimum))}`:"Invalid input";break;case i.ZodIssueCode.too_big:s="array"===e.type?`Array must contain ${e.exact?"exactly":e.inclusive?"at most":"less than"} ${e.maximum} element(s)`:"string"===e.type?`String must contain ${e.exact?"exactly":e.inclusive?"at most":"under"} ${e.maximum} character(s)`:"number"===e.type?`Number must be ${e.exact?"exactly":e.inclusive?"less than or equal to":"less than"} ${e.maximum}`:"bigint"===e.type?`BigInt must be ${e.exact?"exactly":e.inclusive?"less than or equal to":"less than"} ${e.maximum}`:"date"===e.type?`Date must be ${e.exact?"exactly":e.inclusive?"smaller than or equal to":"smaller than"} ${new Date(Number(e.maximum))}`:"Invalid input";break;case i.ZodIssueCode.custom:s="Invalid input";break;case i.ZodIssueCode.invalid_intersection_types:s="Intersection results could not be merged";break;case i.ZodIssueCode.not_multiple_of:s=`Number must be a multiple of ${e.multipleOf}`;break;case i.ZodIssueCode.not_finite:s="Number must be finite";break;default:s=t.defaultError,r.util.assertNever(e)}return{message:s}}},5433:(e,t,s)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.date=t.boolean=t.bigint=t.array=t.any=t.coerce=t.ZodFirstPartyTypeKind=t.late=t.ZodSchema=t.Schema=t.custom=t.ZodReadonly=t.ZodPipeline=t.ZodBranded=t.BRAND=t.ZodNaN=t.ZodCatch=t.ZodDefault=t.ZodNullable=t.ZodOptional=t.ZodTransformer=t.ZodEffects=t.ZodPromise=t.ZodNativeEnum=t.ZodEnum=t.ZodLiteral=t.ZodLazy=t.ZodFunction=t.ZodSet=t.ZodMap=t.ZodRecord=t.ZodTuple=t.ZodIntersection=t.ZodDiscriminatedUnion=t.ZodUnion=t.ZodObject=t.ZodArray=t.ZodVoid=t.ZodNever=t.ZodUnknown=t.ZodAny=t.ZodNull=t.ZodUndefined=t.ZodSymbol=t.ZodDate=t.ZodBoolean=t.ZodBigInt=t.ZodNumber=t.ZodString=t.ZodType=void 0,t.NEVER=t.void=t.unknown=t.union=t.undefined=t.tuple=t.transformer=t.symbol=t.string=t.strictObject=t.set=t.record=t.promise=t.preprocess=t.pipeline=t.ostring=t.optional=t.onumber=t.oboolean=t.object=t.number=t.nullable=t.null=t.never=t.nativeEnum=t.nan=t.map=t.literal=t.lazy=t.intersection=t.instanceof=t.function=t.enum=t.effect=t.discriminatedUnion=void 0;const r=s(6996),i=s(8762),n=s(3187),o=s(9110),a=s(8280);class d{constructor(e,t,s,r){this._cachedPath=[],this.parent=e,this.data=t,this._path=s,this._key=r}get path(){return this._cachedPath.length||(this._key instanceof Array?this._cachedPath.push(...this._path,...this._key):this._cachedPath.push(...this._path,this._key)),this._cachedPath}}const u=(e,t)=>{if((0,n.isValid)(t))return{success:!0,data:t.value};if(!e.common.issues.length)throw new Error("Validation failed but no issues detected.");return{success:!1,get error(){if(this._error)return this._error;const t=new a.ZodError(e.common.issues);return this._error=t,this._error}}};function l(e){if(!e)return{};const{errorMap:t,invalid_type_error:s,required_error:r,description:i}=e;if(t&&(s||r))throw new Error('Can\'t use "invalid_type_error" or "required_error" in conjunction with custom error map.');return t?{errorMap:t,description:i}:{errorMap:(e,t)=>"invalid_type"!==e.code?{message:t.defaultError}:void 0===t.data?{message:null!=r?r:t.defaultError}:{message:null!=s?s:t.defaultError},description:i}}class h{constructor(e){this.spa=this.safeParseAsync,this._def=e,this.parse=this.parse.bind(this),this.safeParse=this.safeParse.bind(this),this.parseAsync=this.parseAsync.bind(this),this.safeParseAsync=this.safeParseAsync.bind(this),this.spa=this.spa.bind(this),this.refine=this.refine.bind(this),this.refinement=this.refinement.bind(this),this.superRefine=this.superRefine.bind(this),this.optional=this.optional.bind(this),this.nullable=this.nullable.bind(this),this.nullish=this.nullish.bind(this),this.array=this.array.bind(this),this.promise=this.promise.bind(this),this.or=this.or.bind(this),this.and=this.and.bind(this),this.transform=this.transform.bind(this),this.brand=this.brand.bind(this),this.default=this.default.bind(this),this.catch=this.catch.bind(this),this.describe=this.describe.bind(this),this.pipe=this.pipe.bind(this),this.readonly=this.readonly.bind(this),this.isNullable=this.isNullable.bind(this),this.isOptional=this.isOptional.bind(this)}get description(){return this._def.description}_getType(e){return(0,o.getParsedType)(e.data)}_getOrReturnCtx(e,t){return t||{common:e.parent.common,data:e.data,parsedType:(0,o.getParsedType)(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}_processInputParams(e){return{status:new n.ParseStatus,ctx:{common:e.parent.common,data:e.data,parsedType:(0,o.getParsedType)(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}}_parseSync(e){const t=this._parse(e);if((0,n.isAsync)(t))throw new Error("Synchronous parse encountered promise.");return t}_parseAsync(e){const t=this._parse(e);return Promise.resolve(t)}parse(e,t){const s=this.safeParse(e,t);if(s.success)return s.data;throw s.error}safeParse(e,t){var s;const r={common:{issues:[],async:null!==(s=null==t?void 0:t.async)&&void 0!==s&&s,contextualErrorMap:null==t?void 0:t.errorMap},path:(null==t?void 0:t.path)||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:(0,o.getParsedType)(e)},i=this._parseSync({data:e,path:r.path,parent:r});return u(r,i)}async parseAsync(e,t){const s=await this.safeParseAsync(e,t);if(s.success)return s.data;throw s.error}async safeParseAsync(e,t){const s={common:{issues:[],contextualErrorMap:null==t?void 0:t.errorMap,async:!0},path:(null==t?void 0:t.path)||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:(0,o.getParsedType)(e)},r=this._parse({data:e,path:s.path,parent:s}),i=await((0,n.isAsync)(r)?r:Promise.resolve(r));return u(s,i)}refine(e,t){const s=e=>"string"==typeof t||void 0===t?{message:t}:"function"==typeof t?t(e):t;return this._refinement(((t,r)=>{const i=e(t),n=()=>r.addIssue({code:a.ZodIssueCode.custom,...s(t)});return"undefined"!=typeof Promise&&i instanceof Promise?i.then((e=>!!e||(n(),!1))):!!i||(n(),!1)}))}refinement(e,t){return this._refinement(((s,r)=>!!e(s)||(r.addIssue("function"==typeof t?t(s,r):t),!1)))}_refinement(e){return new J({schema:this,typeName:ae.ZodEffects,effect:{type:"refinement",refinement:e}})}superRefine(e){return this._refinement(e)}optional(){return X.create(this,this._def)}nullable(){return ee.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return k.create(this,this._def)}promise(){return Y.create(this,this._def)}or(e){return R.create([this,e],this._def)}and(e){return z.create(this,e,this._def)}transform(e){return new J({...l(this._def),schema:this,typeName:ae.ZodEffects,effect:{type:"transform",transform:e}})}default(e){const t="function"==typeof e?e:()=>e;return new te({...l(this._def),innerType:this,defaultValue:t,typeName:ae.ZodDefault})}brand(){return new ie({typeName:ae.ZodBranded,type:this,...l(this._def)})}catch(e){const t="function"==typeof e?e:()=>e;return new se({...l(this._def),innerType:this,catchValue:t,typeName:ae.ZodCatch})}describe(e){return new(0,this.constructor)({...this._def,description:e})}pipe(e){return ne.create(this,e)}readonly(){return oe.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}}t.ZodType=h,t.Schema=h,t.ZodSchema=h;const c=/^c[^\s-]{8,}$/i,p=/^[a-z][a-z0-9]*$/,f=/[0-9A-HJKMNP-TV-Z]{26}/,_=/^[0-9a-fA-F]{8}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{12}$/i,g=/^([A-Z0-9_+-]+\.?)*[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i,m=/^(\p{Extended_Pictographic}|\p{Emoji_Component})+$/u,v=/^(((25[0-5])|(2[0-4][0-9])|(1[0-9]{2})|([0-9]{1,2}))\.){3}((25[0-5])|(2[0-4][0-9])|(1[0-9]{2})|([0-9]{1,2}))$/,y=/^(([a-f0-9]{1,4}:){7}|::([a-f0-9]{1,4}:){0,6}|([a-f0-9]{1,4}:){1}:([a-f0-9]{1,4}:){0,5}|([a-f0-9]{1,4}:){2}:([a-f0-9]{1,4}:){0,4}|([a-f0-9]{1,4}:){3}:([a-f0-9]{1,4}:){0,3}|([a-f0-9]{1,4}:){4}:([a-f0-9]{1,4}:){0,2}|([a-f0-9]{1,4}:){5}:([a-f0-9]{1,4}:){0,1})([a-f0-9]{1,4}|(((25[0-5])|(2[0-4][0-9])|(1[0-9]{2})|([0-9]{1,2}))\.){3}((25[0-5])|(2[0-4][0-9])|(1[0-9]{2})|([0-9]{1,2})))$/;class b extends h{constructor(){super(...arguments),this._regex=(e,t,s)=>this.refinement((t=>e.test(t)),{validation:t,code:a.ZodIssueCode.invalid_string,...i.errorUtil.errToObj(s)}),this.nonempty=e=>this.min(1,i.errorUtil.errToObj(e)),this.trim=()=>new b({...this._def,checks:[...this._def.checks,{kind:"trim"}]}),this.toLowerCase=()=>new b({...this._def,checks:[...this._def.checks,{kind:"toLowerCase"}]}),this.toUpperCase=()=>new b({...this._def,checks:[...this._def.checks,{kind:"toUpperCase"}]})}_parse(e){if(this._def.coerce&&(e.data=String(e.data)),this._getType(e)!==o.ZodParsedType.string){const t=this._getOrReturnCtx(e);return(0,n.addIssueToContext)(t,{code:a.ZodIssueCode.invalid_type,expected:o.ZodParsedType.string,received:t.parsedType}),n.INVALID}const t=new n.ParseStatus;let s;for(const u of this._def.checks)if("min"===u.kind)e.data.length<u.value&&(s=this._getOrReturnCtx(e,s),(0,n.addIssueToContext)(s,{code:a.ZodIssueCode.too_small,minimum:u.value,type:"string",inclusive:!0,exact:!1,message:u.message}),t.dirty());else if("max"===u.kind)e.data.length>u.value&&(s=this._getOrReturnCtx(e,s),(0,n.addIssueToContext)(s,{code:a.ZodIssueCode.too_big,maximum:u.value,type:"string",inclusive:!0,exact:!1,message:u.message}),t.dirty());else if("length"===u.kind){const r=e.data.length>u.value,i=e.data.length<u.value;(r||i)&&(s=this._getOrReturnCtx(e,s),r?(0,n.addIssueToContext)(s,{code:a.ZodIssueCode.too_big,maximum:u.value,type:"string",inclusive:!0,exact:!0,message:u.message}):i&&(0,n.addIssueToContext)(s,{code:a.ZodIssueCode.too_small,minimum:u.value,type:"string",inclusive:!0,exact:!0,message:u.message}),t.dirty())}else if("email"===u.kind)g.test(e.data)||(s=this._getOrReturnCtx(e,s),(0,n.addIssueToContext)(s,{validation:"email",code:a.ZodIssueCode.invalid_string,message:u.message}),t.dirty());else if("emoji"===u.kind)m.test(e.data)||(s=this._getOrReturnCtx(e,s),(0,n.addIssueToContext)(s,{validation:"emoji",code:a.ZodIssueCode.invalid_string,message:u.message}),t.dirty());else if("uuid"===u.kind)_.test(e.data)||(s=this._getOrReturnCtx(e,s),(0,n.addIssueToContext)(s,{validation:"uuid",code:a.ZodIssueCode.invalid_string,message:u.message}),t.dirty());else if("cuid"===u.kind)c.test(e.data)||(s=this._getOrReturnCtx(e,s),(0,n.addIssueToContext)(s,{validation:"cuid",code:a.ZodIssueCode.invalid_string,message:u.message}),t.dirty());else if("cuid2"===u.kind)p.test(e.data)||(s=this._getOrReturnCtx(e,s),(0,n.addIssueToContext)(s,{validation:"cuid2",code:a.ZodIssueCode.invalid_string,message:u.message}),t.dirty());else if("ulid"===u.kind)f.test(e.data)||(s=this._getOrReturnCtx(e,s),(0,n.addIssueToContext)(s,{validation:"ulid",code:a.ZodIssueCode.invalid_string,message:u.message}),t.dirty());else if("url"===u.kind)try{new URL(e.data)}catch(r){s=this._getOrReturnCtx(e,s),(0,n.addIssueToContext)(s,{validation:"url",code:a.ZodIssueCode.invalid_string,message:u.message}),t.dirty()}else"regex"===u.kind?(u.regex.lastIndex=0,u.regex.test(e.data)||(s=this._getOrReturnCtx(e,s),(0,n.addIssueToContext)(s,{validation:"regex",code:a.ZodIssueCode.invalid_string,message:u.message}),t.dirty())):"trim"===u.kind?e.data=e.data.trim():"includes"===u.kind?e.data.includes(u.value,u.position)||(s=this._getOrReturnCtx(e,s),(0,n.addIssueToContext)(s,{code:a.ZodIssueCode.invalid_string,validation:{includes:u.value,position:u.position},message:u.message}),t.dirty()):"toLowerCase"===u.kind?e.data=e.data.toLowerCase():"toUpperCase"===u.kind?e.data=e.data.toUpperCase():"startsWith"===u.kind?e.data.startsWith(u.value)||(s=this._getOrReturnCtx(e,s),(0,n.addIssueToContext)(s,{code:a.ZodIssueCode.invalid_string,validation:{startsWith:u.value},message:u.message}),t.dirty()):"endsWith"===u.kind?e.data.endsWith(u.value)||(s=this._getOrReturnCtx(e,s),(0,n.addIssueToContext)(s,{code:a.ZodIssueCode.invalid_string,validation:{endsWith:u.value},message:u.message}),t.dirty()):"datetime"===u.kind?((d=u).precision?d.offset?new RegExp(`^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}\\.\\d{${d.precision}}(([+-]\\d{2}(:?\\d{2})?)|Z)$`):new RegExp(`^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}\\.\\d{${d.precision}}Z$`):0===d.precision?d.offset?new RegExp("^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}(([+-]\\d{2}(:?\\d{2})?)|Z)$"):new RegExp("^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}Z$"):d.offset?new RegExp("^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}(\\.\\d+)?(([+-]\\d{2}(:?\\d{2})?)|Z)$"):new RegExp("^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}(\\.\\d+)?Z$")).test(e.data)||(s=this._getOrReturnCtx(e,s),(0,n.addIssueToContext)(s,{code:a.ZodIssueCode.invalid_string,validation:"datetime",message:u.message}),t.dirty()):"ip"===u.kind?(r=e.data,("v4"!==(i=u.version)&&i||!v.test(r))&&("v6"!==i&&i||!y.test(r))&&(s=this._getOrReturnCtx(e,s),(0,n.addIssueToContext)(s,{validation:"ip",code:a.ZodIssueCode.invalid_string,message:u.message}),t.dirty())):o.util.assertNever(u);var r,i,d;return{status:t.value,value:e.data}}_addCheck(e){return new b({...this._def,checks:[...this._def.checks,e]})}email(e){return this._addCheck({kind:"email",...i.errorUtil.errToObj(e)})}url(e){return this._addCheck({kind:"url",...i.errorUtil.errToObj(e)})}emoji(e){return this._addCheck({kind:"emoji",...i.errorUtil.errToObj(e)})}uuid(e){return this._addCheck({kind:"uuid",...i.errorUtil.errToObj(e)})}cuid(e){return this._addCheck({kind:"cuid",...i.errorUtil.errToObj(e)})}cuid2(e){return this._addCheck({kind:"cuid2",...i.errorUtil.errToObj(e)})}ulid(e){return this._addCheck({kind:"ulid",...i.errorUtil.errToObj(e)})}ip(e){return this._addCheck({kind:"ip",...i.errorUtil.errToObj(e)})}datetime(e){var t;return"string"==typeof e?this._addCheck({kind:"datetime",precision:null,offset:!1,message:e}):this._addCheck({kind:"datetime",precision:void 0===(null==e?void 0:e.precision)?null:null==e?void 0:e.precision,offset:null!==(t=null==e?void 0:e.offset)&&void 0!==t&&t,...i.errorUtil.errToObj(null==e?void 0:e.message)})}regex(e,t){return this._addCheck({kind:"regex",regex:e,...i.errorUtil.errToObj(t)})}includes(e,t){return this._addCheck({kind:"includes",value:e,position:null==t?void 0:t.position,...i.errorUtil.errToObj(null==t?void 0:t.message)})}startsWith(e,t){return this._addCheck({kind:"startsWith",value:e,...i.errorUtil.errToObj(t)})}endsWith(e,t){return this._addCheck({kind:"endsWith",value:e,...i.errorUtil.errToObj(t)})}min(e,t){return this._addCheck({kind:"min",value:e,...i.errorUtil.errToObj(t)})}max(e,t){return this._addCheck({kind:"max",value:e,...i.errorUtil.errToObj(t)})}length(e,t){return this._addCheck({kind:"length",value:e,...i.errorUtil.errToObj(t)})}get isDatetime(){return!!this._def.checks.find((e=>"datetime"===e.kind))}get isEmail(){return!!this._def.checks.find((e=>"email"===e.kind))}get isURL(){return!!this._def.checks.find((e=>"url"===e.kind))}get isEmoji(){return!!this._def.checks.find((e=>"emoji"===e.kind))}get isUUID(){return!!this._def.checks.find((e=>"uuid"===e.kind))}get isCUID(){return!!this._def.checks.find((e=>"cuid"===e.kind))}get isCUID2(){return!!this._def.checks.find((e=>"cuid2"===e.kind))}get isULID(){return!!this._def.checks.find((e=>"ulid"===e.kind))}get isIP(){return!!this._def.checks.find((e=>"ip"===e.kind))}get minLength(){let e=null;for(const t of this._def.checks)"min"===t.kind&&(null===e||t.value>e)&&(e=t.value);return e}get maxLength(){let e=null;for(const t of this._def.checks)"max"===t.kind&&(null===e||t.value<e)&&(e=t.value);return e}}function x(e,t){const s=(e.toString().split(".")[1]||"").length,r=(t.toString().split(".")[1]||"").length,i=s>r?s:r;return parseInt(e.toFixed(i).replace(".",""))%parseInt(t.toFixed(i).replace(".",""))/Math.pow(10,i)}t.ZodString=b,b.create=e=>{var t;return new b({checks:[],typeName:ae.ZodString,coerce:null!==(t=null==e?void 0:e.coerce)&&void 0!==t&&t,...l(e)})};class T extends h{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte,this.step=this.multipleOf}_parse(e){if(this._def.coerce&&(e.data=Number(e.data)),this._getType(e)!==o.ZodParsedType.number){const t=this._getOrReturnCtx(e);return(0,n.addIssueToContext)(t,{code:a.ZodIssueCode.invalid_type,expected:o.ZodParsedType.number,received:t.parsedType}),n.INVALID}let t;const s=new n.ParseStatus;for(const r of this._def.checks)"int"===r.kind?o.util.isInteger(e.data)||(t=this._getOrReturnCtx(e,t),(0,n.addIssueToContext)(t,{code:a.ZodIssueCode.invalid_type,expected:"integer",received:"float",message:r.message}),s.dirty()):"min"===r.kind?(r.inclusive?e.data<r.value:e.data<=r.value)&&(t=this._getOrReturnCtx(e,t),(0,n.addIssueToContext)(t,{code:a.ZodIssueCode.too_small,minimum:r.value,type:"number",inclusive:r.inclusive,exact:!1,message:r.message}),s.dirty()):"max"===r.kind?(r.inclusive?e.data>r.value:e.data>=r.value)&&(t=this._getOrReturnCtx(e,t),(0,n.addIssueToContext)(t,{code:a.ZodIssueCode.too_big,maximum:r.value,type:"number",inclusive:r.inclusive,exact:!1,message:r.message}),s.dirty()):"multipleOf"===r.kind?0!==x(e.data,r.value)&&(t=this._getOrReturnCtx(e,t),(0,n.addIssueToContext)(t,{code:a.ZodIssueCode.not_multiple_of,multipleOf:r.value,message:r.message}),s.dirty()):"finite"===r.kind?Number.isFinite(e.data)||(t=this._getOrReturnCtx(e,t),(0,n.addIssueToContext)(t,{code:a.ZodIssueCode.not_finite,message:r.message}),s.dirty()):o.util.assertNever(r);return{status:s.value,value:e.data}}gte(e,t){return this.setLimit("min",e,!0,i.errorUtil.toString(t))}gt(e,t){return this.setLimit("min",e,!1,i.errorUtil.toString(t))}lte(e,t){return this.setLimit("max",e,!0,i.errorUtil.toString(t))}lt(e,t){return this.setLimit("max",e,!1,i.errorUtil.toString(t))}setLimit(e,t,s,r){return new T({...this._def,checks:[...this._def.checks,{kind:e,value:t,inclusive:s,message:i.errorUtil.toString(r)}]})}_addCheck(e){return new T({...this._def,checks:[...this._def.checks,e]})}int(e){return this._addCheck({kind:"int",message:i.errorUtil.toString(e)})}positive(e){return this._addCheck({kind:"min",value:0,inclusive:!1,message:i.errorUtil.toString(e)})}negative(e){return this._addCheck({kind:"max",value:0,inclusive:!1,message:i.errorUtil.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:0,inclusive:!0,message:i.errorUtil.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:0,inclusive:!0,message:i.errorUtil.toString(e)})}multipleOf(e,t){return this._addCheck({kind:"multipleOf",value:e,message:i.errorUtil.toString(t)})}finite(e){return this._addCheck({kind:"finite",message:i.errorUtil.toString(e)})}safe(e){return this._addCheck({kind:"min",inclusive:!0,value:Number.MIN_SAFE_INTEGER,message:i.errorUtil.toString(e)})._addCheck({kind:"max",inclusive:!0,value:Number.MAX_SAFE_INTEGER,message:i.errorUtil.toString(e)})}get minValue(){let e=null;for(const t of this._def.checks)"min"===t.kind&&(null===e||t.value>e)&&(e=t.value);return e}get maxValue(){let e=null;for(const t of this._def.checks)"max"===t.kind&&(null===e||t.value<e)&&(e=t.value);return e}get isInt(){return!!this._def.checks.find((e=>"int"===e.kind||"multipleOf"===e.kind&&o.util.isInteger(e.value)))}get isFinite(){let e=null,t=null;for(const s of this._def.checks){if("finite"===s.kind||"int"===s.kind||"multipleOf"===s.kind)return!0;"min"===s.kind?(null===t||s.value>t)&&(t=s.value):"max"===s.kind&&(null===e||s.value<e)&&(e=s.value)}return Number.isFinite(t)&&Number.isFinite(e)}}t.ZodNumber=T,T.create=e=>new T({checks:[],typeName:ae.ZodNumber,coerce:(null==e?void 0:e.coerce)||!1,...l(e)});class P extends h{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte}_parse(e){if(this._def.coerce&&(e.data=BigInt(e.data)),this._getType(e)!==o.ZodParsedType.bigint){const t=this._getOrReturnCtx(e);return(0,n.addIssueToContext)(t,{code:a.ZodIssueCode.invalid_type,expected:o.ZodParsedType.bigint,received:t.parsedType}),n.INVALID}let t;const s=new n.ParseStatus;for(const r of this._def.checks)"min"===r.kind?(r.inclusive?e.data<r.value:e.data<=r.value)&&(t=this._getOrReturnCtx(e,t),(0,n.addIssueToContext)(t,{code:a.ZodIssueCode.too_small,type:"bigint",minimum:r.value,inclusive:r.inclusive,message:r.message}),s.dirty()):"max"===r.kind?(r.inclusive?e.data>r.value:e.data>=r.value)&&(t=this._getOrReturnCtx(e,t),(0,n.addIssueToContext)(t,{code:a.ZodIssueCode.too_big,type:"bigint",maximum:r.value,inclusive:r.inclusive,message:r.message}),s.dirty()):"multipleOf"===r.kind?e.data%r.value!==BigInt(0)&&(t=this._getOrReturnCtx(e,t),(0,n.addIssueToContext)(t,{code:a.ZodIssueCode.not_multiple_of,multipleOf:r.value,message:r.message}),s.dirty()):o.util.assertNever(r);return{status:s.value,value:e.data}}gte(e,t){return this.setLimit("min",e,!0,i.errorUtil.toString(t))}gt(e,t){return this.setLimit("min",e,!1,i.errorUtil.toString(t))}lte(e,t){return this.setLimit("max",e,!0,i.errorUtil.toString(t))}lt(e,t){return this.setLimit("max",e,!1,i.errorUtil.toString(t))}setLimit(e,t,s,r){return new P({...this._def,checks:[...this._def.checks,{kind:e,value:t,inclusive:s,message:i.errorUtil.toString(r)}]})}_addCheck(e){return new P({...this._def,checks:[...this._def.checks,e]})}positive(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!1,message:i.errorUtil.toString(e)})}negative(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!1,message:i.errorUtil.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!0,message:i.errorUtil.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!0,message:i.errorUtil.toString(e)})}multipleOf(e,t){return this._addCheck({kind:"multipleOf",value:e,message:i.errorUtil.toString(t)})}get minValue(){let e=null;for(const t of this._def.checks)"min"===t.kind&&(null===e||t.value>e)&&(e=t.value);return e}get maxValue(){let e=null;for(const t of this._def.checks)"max"===t.kind&&(null===e||t.value<e)&&(e=t.value);return e}}t.ZodBigInt=P,P.create=e=>{var t;return new P({checks:[],typeName:ae.ZodBigInt,coerce:null!==(t=null==e?void 0:e.coerce)&&void 0!==t&&t,...l(e)})};class O extends h{_parse(e){if(this._def.coerce&&(e.data=Boolean(e.data)),this._getType(e)!==o.ZodParsedType.boolean){const t=this._getOrReturnCtx(e);return(0,n.addIssueToContext)(t,{code:a.ZodIssueCode.invalid_type,expected:o.ZodParsedType.boolean,received:t.parsedType}),n.INVALID}return(0,n.OK)(e.data)}}t.ZodBoolean=O,O.create=e=>new O({typeName:ae.ZodBoolean,coerce:(null==e?void 0:e.coerce)||!1,...l(e)});class I extends h{_parse(e){if(this._def.coerce&&(e.data=new Date(e.data)),this._getType(e)!==o.ZodParsedType.date){const t=this._getOrReturnCtx(e);return(0,n.addIssueToContext)(t,{code:a.ZodIssueCode.invalid_type,expected:o.ZodParsedType.date,received:t.parsedType}),n.INVALID}if(isNaN(e.data.getTime())){const t=this._getOrReturnCtx(e);return(0,n.addIssueToContext)(t,{code:a.ZodIssueCode.invalid_date}),n.INVALID}const t=new n.ParseStatus;let s;for(const r of this._def.checks)"min"===r.kind?e.data.getTime()<r.value&&(s=this._getOrReturnCtx(e,s),(0,n.addIssueToContext)(s,{code:a.ZodIssueCode.too_small,message:r.message,inclusive:!0,exact:!1,minimum:r.value,type:"date"}),t.dirty()):"max"===r.kind?e.data.getTime()>r.value&&(s=this._getOrReturnCtx(e,s),(0,n.addIssueToContext)(s,{code:a.ZodIssueCode.too_big,message:r.message,inclusive:!0,exact:!1,maximum:r.value,type:"date"}),t.dirty()):o.util.assertNever(r);return{status:t.value,value:new Date(e.data.getTime())}}_addCheck(e){return new I({...this._def,checks:[...this._def.checks,e]})}min(e,t){return this._addCheck({kind:"min",value:e.getTime(),message:i.errorUtil.toString(t)})}max(e,t){return this._addCheck({kind:"max",value:e.getTime(),message:i.errorUtil.toString(t)})}get minDate(){let e=null;for(const t of this._def.checks)"min"===t.kind&&(null===e||t.value>e)&&(e=t.value);return null!=e?new Date(e):null}get maxDate(){let e=null;for(const t of this._def.checks)"max"===t.kind&&(null===e||t.value<e)&&(e=t.value);return null!=e?new Date(e):null}}t.ZodDate=I,I.create=e=>new I({checks:[],coerce:(null==e?void 0:e.coerce)||!1,typeName:ae.ZodDate,...l(e)});class w extends h{_parse(e){if(this._getType(e)!==o.ZodParsedType.symbol){const t=this._getOrReturnCtx(e);return(0,n.addIssueToContext)(t,{code:a.ZodIssueCode.invalid_type,expected:o.ZodParsedType.symbol,received:t.parsedType}),n.INVALID}return(0,n.OK)(e.data)}}t.ZodSymbol=w,w.create=e=>new w({typeName:ae.ZodSymbol,...l(e)});class Z extends h{_parse(e){if(this._getType(e)!==o.ZodParsedType.undefined){const t=this._getOrReturnCtx(e);return(0,n.addIssueToContext)(t,{code:a.ZodIssueCode.invalid_type,expected:o.ZodParsedType.undefined,received:t.parsedType}),n.INVALID}return(0,n.OK)(e.data)}}t.ZodUndefined=Z,Z.create=e=>new Z({typeName:ae.ZodUndefined,...l(e)});class C extends h{_parse(e){if(this._getType(e)!==o.ZodParsedType.null){const t=this._getOrReturnCtx(e);return(0,n.addIssueToContext)(t,{code:a.ZodIssueCode.invalid_type,expected:o.ZodParsedType.null,received:t.parsedType}),n.INVALID}return(0,n.OK)(e.data)}}t.ZodNull=C,C.create=e=>new C({typeName:ae.ZodNull,...l(e)});class j extends h{constructor(){super(...arguments),this._any=!0}_parse(e){return(0,n.OK)(e.data)}}t.ZodAny=j,j.create=e=>new j({typeName:ae.ZodAny,...l(e)});class N extends h{constructor(){super(...arguments),this._unknown=!0}_parse(e){return(0,n.OK)(e.data)}}t.ZodUnknown=N,N.create=e=>new N({typeName:ae.ZodUnknown,...l(e)});class M extends h{_parse(e){const t=this._getOrReturnCtx(e);return(0,n.addIssueToContext)(t,{code:a.ZodIssueCode.invalid_type,expected:o.ZodParsedType.never,received:t.parsedType}),n.INVALID}}t.ZodNever=M,M.create=e=>new M({typeName:ae.ZodNever,...l(e)});class E extends h{_parse(e){if(this._getType(e)!==o.ZodParsedType.undefined){const t=this._getOrReturnCtx(e);return(0,n.addIssueToContext)(t,{code:a.ZodIssueCode.invalid_type,expected:o.ZodParsedType.void,received:t.parsedType}),n.INVALID}return(0,n.OK)(e.data)}}t.ZodVoid=E,E.create=e=>new E({typeName:ae.ZodVoid,...l(e)});class k extends h{_parse(e){const{ctx:t,status:s}=this._processInputParams(e),r=this._def;if(t.parsedType!==o.ZodParsedType.array)return(0,n.addIssueToContext)(t,{code:a.ZodIssueCode.invalid_type,expected:o.ZodParsedType.array,received:t.parsedType}),n.INVALID;if(null!==r.exactLength){const e=t.data.length>r.exactLength.value,i=t.data.length<r.exactLength.value;(e||i)&&((0,n.addIssueToContext)(t,{code:e?a.ZodIssueCode.too_big:a.ZodIssueCode.too_small,minimum:i?r.exactLength.value:void 0,maximum:e?r.exactLength.value:void 0,type:"array",inclusive:!0,exact:!0,message:r.exactLength.message}),s.dirty())}if(null!==r.minLength&&t.data.length<r.minLength.value&&((0,n.addIssueToContext)(t,{code:a.ZodIssueCode.too_small,minimum:r.minLength.value,type:"array",inclusive:!0,exact:!1,message:r.minLength.message}),s.dirty()),null!==r.maxLength&&t.data.length>r.maxLength.value&&((0,n.addIssueToContext)(t,{code:a.ZodIssueCode.too_big,maximum:r.maxLength.value,type:"array",inclusive:!0,exact:!1,message:r.maxLength.message}),s.dirty()),t.common.async)return Promise.all([...t.data].map(((e,s)=>r.type._parseAsync(new d(t,e,t.path,s))))).then((e=>n.ParseStatus.mergeArray(s,e)));const i=[...t.data].map(((e,s)=>r.type._parseSync(new d(t,e,t.path,s))));return n.ParseStatus.mergeArray(s,i)}get element(){return this._def.type}min(e,t){return new k({...this._def,minLength:{value:e,message:i.errorUtil.toString(t)}})}max(e,t){return new k({...this._def,maxLength:{value:e,message:i.errorUtil.toString(t)}})}length(e,t){return new k({...this._def,exactLength:{value:e,message:i.errorUtil.toString(t)}})}nonempty(e){return this.min(1,e)}}function S(e){if(e instanceof V){const t={};for(const s in e.shape){const r=e.shape[s];t[s]=X.create(S(r))}return new V({...e._def,shape:()=>t})}return e instanceof k?new k({...e._def,type:S(e.element)}):e instanceof X?X.create(S(e.unwrap())):e instanceof ee?ee.create(S(e.unwrap())):e instanceof B?B.create(e.items.map((e=>S(e)))):e}t.ZodArray=k,k.create=(e,t)=>new k({type:e,minLength:null,maxLength:null,exactLength:null,typeName:ae.ZodArray,...l(t)});class V extends h{constructor(){super(...arguments),this._cached=null,this.nonstrict=this.passthrough,this.augment=this.extend}_getCached(){if(null!==this._cached)return this._cached;const e=this._def.shape(),t=o.util.objectKeys(e);return this._cached={shape:e,keys:t}}_parse(e){if(this._getType(e)!==o.ZodParsedType.object){const t=this._getOrReturnCtx(e);return(0,n.addIssueToContext)(t,{code:a.ZodIssueCode.invalid_type,expected:o.ZodParsedType.object,received:t.parsedType}),n.INVALID}const{status:t,ctx:s}=this._processInputParams(e),{shape:r,keys:i}=this._getCached(),u=[];if(!(this._def.catchall instanceof M&&"strip"===this._def.unknownKeys))for(const e in s.data)i.includes(e)||u.push(e);const l=[];for(const e of i){const t=r[e],i=s.data[e];l.push({key:{status:"valid",value:e},value:t._parse(new d(s,i,s.path,e)),alwaysSet:e in s.data})}if(this._def.catchall instanceof M){const e=this._def.unknownKeys;if("passthrough"===e)for(const e of u)l.push({key:{status:"valid",value:e},value:{status:"valid",value:s.data[e]}});else if("strict"===e)u.length>0&&((0,n.addIssueToContext)(s,{code:a.ZodIssueCode.unrecognized_keys,keys:u}),t.dirty());else if("strip"!==e)throw new Error("Internal ZodObject error: invalid unknownKeys value.")}else{const e=this._def.catchall;for(const t of u){const r=s.data[t];l.push({key:{status:"valid",value:t},value:e._parse(new d(s,r,s.path,t)),alwaysSet:t in s.data})}}return s.common.async?Promise.resolve().then((async()=>{const e=[];for(const t of l){const s=await t.key;e.push({key:s,value:await t.value,alwaysSet:t.alwaysSet})}return e})).then((e=>n.ParseStatus.mergeObjectSync(t,e))):n.ParseStatus.mergeObjectSync(t,l)}get shape(){return this._def.shape()}strict(e){return i.errorUtil.errToObj,new V({...this._def,unknownKeys:"strict",...void 0!==e?{errorMap:(t,s)=>{var r,n,o,a;const d=null!==(o=null===(n=(r=this._def).errorMap)||void 0===n?void 0:n.call(r,t,s).message)&&void 0!==o?o:s.defaultError;return"unrecognized_keys"===t.code?{message:null!==(a=i.errorUtil.errToObj(e).message)&&void 0!==a?a:d}:{message:d}}}:{}})}strip(){return new V({...this._def,unknownKeys:"strip"})}passthrough(){return new V({...this._def,unknownKeys:"passthrough"})}extend(e){return new V({...this._def,shape:()=>({...this._def.shape(),...e})})}merge(e){return new V({unknownKeys:e._def.unknownKeys,catchall:e._def.catchall,shape:()=>({...this._def.shape(),...e._def.shape()}),typeName:ae.ZodObject})}setKey(e,t){return this.augment({[e]:t})}catchall(e){return new V({...this._def,catchall:e})}pick(e){const t={};return o.util.objectKeys(e).forEach((s=>{e[s]&&this.shape[s]&&(t[s]=this.shape[s])})),new V({...this._def,shape:()=>t})}omit(e){const t={};return o.util.objectKeys(this.shape).forEach((s=>{e[s]||(t[s]=this.shape[s])})),new V({...this._def,shape:()=>t})}deepPartial(){return S(this)}partial(e){const t={};return o.util.objectKeys(this.shape).forEach((s=>{const r=this.shape[s];e&&!e[s]?t[s]=r:t[s]=r.optional()})),new V({...this._def,shape:()=>t})}required(e){const t={};return o.util.objectKeys(this.shape).forEach((s=>{if(e&&!e[s])t[s]=this.shape[s];else{let e=this.shape[s];for(;e instanceof X;)e=e._def.innerType;t[s]=e}})),new V({...this._def,shape:()=>t})}keyof(){return W(o.util.objectKeys(this.shape))}}t.ZodObject=V,V.create=(e,t)=>new V({shape:()=>e,unknownKeys:"strip",catchall:M.create(),typeName:ae.ZodObject,...l(t)}),V.strictCreate=(e,t)=>new V({shape:()=>e,unknownKeys:"strict",catchall:M.create(),typeName:ae.ZodObject,...l(t)}),V.lazycreate=(e,t)=>new V({shape:e,unknownKeys:"strip",catchall:M.create(),typeName:ae.ZodObject,...l(t)});class R extends h{_parse(e){const{ctx:t}=this._processInputParams(e),s=this._def.options;if(t.common.async)return Promise.all(s.map((async e=>{const s={...t,common:{...t.common,issues:[]},parent:null};return{result:await e._parseAsync({data:t.data,path:t.path,parent:s}),ctx:s}}))).then((function(e){for(const t of e)if("valid"===t.result.status)return t.result;for(const s of e)if("dirty"===s.result.status)return t.common.issues.push(...s.ctx.common.issues),s.result;const s=e.map((e=>new a.ZodError(e.ctx.common.issues)));return(0,n.addIssueToContext)(t,{code:a.ZodIssueCode.invalid_union,unionErrors:s}),n.INVALID}));{let e;const r=[];for(const i of s){const s={...t,common:{...t.common,issues:[]},parent:null},n=i._parseSync({data:t.data,path:t.path,parent:s});if("valid"===n.status)return n;"dirty"!==n.status||e||(e={result:n,ctx:s}),s.common.issues.length&&r.push(s.common.issues)}if(e)return t.common.issues.push(...e.ctx.common.issues),e.result;const i=r.map((e=>new a.ZodError(e)));return(0,n.addIssueToContext)(t,{code:a.ZodIssueCode.invalid_union,unionErrors:i}),n.INVALID}}get options(){return this._def.options}}t.ZodUnion=R,R.create=(e,t)=>new R({options:e,typeName:ae.ZodUnion,...l(t)});const A=e=>e instanceof K?A(e.schema):e instanceof J?A(e.innerType()):e instanceof H?[e.value]:e instanceof G?e.options:e instanceof Q?Object.keys(e.enum):e instanceof te?A(e._def.innerType):e instanceof Z?[void 0]:e instanceof C?[null]:null;class L extends h{_parse(e){const{ctx:t}=this._processInputParams(e);if(t.parsedType!==o.ZodParsedType.object)return(0,n.addIssueToContext)(t,{code:a.ZodIssueCode.invalid_type,expected:o.ZodParsedType.object,received:t.parsedType}),n.INVALID;const s=this.discriminator,r=t.data[s],i=this.optionsMap.get(r);return i?t.common.async?i._parseAsync({data:t.data,path:t.path,parent:t}):i._parseSync({data:t.data,path:t.path,parent:t}):((0,n.addIssueToContext)(t,{code:a.ZodIssueCode.invalid_union_discriminator,options:Array.from(this.optionsMap.keys()),path:[s]}),n.INVALID)}get discriminator(){return this._def.discriminator}get options(){return this._def.options}get optionsMap(){return this._def.optionsMap}static create(e,t,s){const r=new Map;for(const s of t){const t=A(s.shape[e]);if(!t)throw new Error(`A discriminator value for key \`${e}\` could not be extracted from all schema options`);for(const i of t){if(r.has(i))throw new Error(`Discriminator property ${String(e)} has duplicate value ${String(i)}`);r.set(i,s)}}return new L({typeName:ae.ZodDiscriminatedUnion,discriminator:e,options:t,optionsMap:r,...l(s)})}}function D(e,t){const s=(0,o.getParsedType)(e),r=(0,o.getParsedType)(t);if(e===t)return{valid:!0,data:e};if(s===o.ZodParsedType.object&&r===o.ZodParsedType.object){const s=o.util.objectKeys(t),r=o.util.objectKeys(e).filter((e=>-1!==s.indexOf(e))),i={...e,...t};for(const s of r){const r=D(e[s],t[s]);if(!r.valid)return{valid:!1};i[s]=r.data}return{valid:!0,data:i}}if(s===o.ZodParsedType.array&&r===o.ZodParsedType.array){if(e.length!==t.length)return{valid:!1};const s=[];for(let r=0;r<e.length;r++){const i=D(e[r],t[r]);if(!i.valid)return{valid:!1};s.push(i.data)}return{valid:!0,data:s}}return s===o.ZodParsedType.date&&r===o.ZodParsedType.date&&+e==+t?{valid:!0,data:e}:{valid:!1}}t.ZodDiscriminatedUnion=L;class z extends h{_parse(e){const{status:t,ctx:s}=this._processInputParams(e),r=(e,r)=>{if((0,n.isAborted)(e)||(0,n.isAborted)(r))return n.INVALID;const i=D(e.value,r.value);return i.valid?(((0,n.isDirty)(e)||(0,n.isDirty)(r))&&t.dirty(),{status:t.value,value:i.data}):((0,n.addIssueToContext)(s,{code:a.ZodIssueCode.invalid_intersection_types}),n.INVALID)};return s.common.async?Promise.all([this._def.left._parseAsync({data:s.data,path:s.path,parent:s}),this._def.right._parseAsync({data:s.data,path:s.path,parent:s})]).then((([e,t])=>r(e,t))):r(this._def.left._parseSync({data:s.data,path:s.path,parent:s}),this._def.right._parseSync({data:s.data,path:s.path,parent:s}))}}t.ZodIntersection=z,z.create=(e,t,s)=>new z({left:e,right:t,typeName:ae.ZodIntersection,...l(s)});class B extends h{_parse(e){const{status:t,ctx:s}=this._processInputParams(e);if(s.parsedType!==o.ZodParsedType.array)return(0,n.addIssueToContext)(s,{code:a.ZodIssueCode.invalid_type,expected:o.ZodParsedType.array,received:s.parsedType}),n.INVALID;if(s.data.length<this._def.items.length)return(0,n.addIssueToContext)(s,{code:a.ZodIssueCode.too_small,minimum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),n.INVALID;!this._def.rest&&s.data.length>this._def.items.length&&((0,n.addIssueToContext)(s,{code:a.ZodIssueCode.too_big,maximum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),t.dirty());const r=[...s.data].map(((e,t)=>{const r=this._def.items[t]||this._def.rest;return r?r._parse(new d(s,e,s.path,t)):null})).filter((e=>!!e));return s.common.async?Promise.all(r).then((e=>n.ParseStatus.mergeArray(t,e))):n.ParseStatus.mergeArray(t,r)}get items(){return this._def.items}rest(e){return new B({...this._def,rest:e})}}t.ZodTuple=B,B.create=(e,t)=>{if(!Array.isArray(e))throw new Error("You must pass an array of schemas to z.tuple([ ... ])");return new B({items:e,typeName:ae.ZodTuple,rest:null,...l(t)})};class U extends h{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){const{status:t,ctx:s}=this._processInputParams(e);if(s.parsedType!==o.ZodParsedType.object)return(0,n.addIssueToContext)(s,{code:a.ZodIssueCode.invalid_type,expected:o.ZodParsedType.object,received:s.parsedType}),n.INVALID;const r=[],i=this._def.keyType,u=this._def.valueType;for(const e in s.data)r.push({key:i._parse(new d(s,e,s.path,e)),value:u._parse(new d(s,s.data[e],s.path,e))});return s.common.async?n.ParseStatus.mergeObjectAsync(t,r):n.ParseStatus.mergeObjectSync(t,r)}get element(){return this._def.valueType}static create(e,t,s){return new U(t instanceof h?{keyType:e,valueType:t,typeName:ae.ZodRecord,...l(s)}:{keyType:b.create(),valueType:e,typeName:ae.ZodRecord,...l(t)})}}t.ZodRecord=U;class F extends h{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){const{status:t,ctx:s}=this._processInputParams(e);if(s.parsedType!==o.ZodParsedType.map)return(0,n.addIssueToContext)(s,{code:a.ZodIssueCode.invalid_type,expected:o.ZodParsedType.map,received:s.parsedType}),n.INVALID;const r=this._def.keyType,i=this._def.valueType,u=[...s.data.entries()].map((([e,t],n)=>({key:r._parse(new d(s,e,s.path,[n,"key"])),value:i._parse(new d(s,t,s.path,[n,"value"]))})));if(s.common.async){const e=new Map;return Promise.resolve().then((async()=>{for(const s of u){const r=await s.key,i=await s.value;if("aborted"===r.status||"aborted"===i.status)return n.INVALID;"dirty"!==r.status&&"dirty"!==i.status||t.dirty(),e.set(r.value,i.value)}return{status:t.value,value:e}}))}{const e=new Map;for(const s of u){const r=s.key,i=s.value;if("aborted"===r.status||"aborted"===i.status)return n.INVALID;"dirty"!==r.status&&"dirty"!==i.status||t.dirty(),e.set(r.value,i.value)}return{status:t.value,value:e}}}}t.ZodMap=F,F.create=(e,t,s)=>new F({valueType:t,keyType:e,typeName:ae.ZodMap,...l(s)});class $ extends h{_parse(e){const{status:t,ctx:s}=this._processInputParams(e);if(s.parsedType!==o.ZodParsedType.set)return(0,n.addIssueToContext)(s,{code:a.ZodIssueCode.invalid_type,expected:o.ZodParsedType.set,received:s.parsedType}),n.INVALID;const r=this._def;null!==r.minSize&&s.data.size<r.minSize.value&&((0,n.addIssueToContext)(s,{code:a.ZodIssueCode.too_small,minimum:r.minSize.value,type:"set",inclusive:!0,exact:!1,message:r.minSize.message}),t.dirty()),null!==r.maxSize&&s.data.size>r.maxSize.value&&((0,n.addIssueToContext)(s,{code:a.ZodIssueCode.too_big,maximum:r.maxSize.value,type:"set",inclusive:!0,exact:!1,message:r.maxSize.message}),t.dirty());const i=this._def.valueType;function u(e){const s=new Set;for(const r of e){if("aborted"===r.status)return n.INVALID;"dirty"===r.status&&t.dirty(),s.add(r.value)}return{status:t.value,value:s}}const l=[...s.data.values()].map(((e,t)=>i._parse(new d(s,e,s.path,t))));return s.common.async?Promise.all(l).then((e=>u(e))):u(l)}min(e,t){return new $({...this._def,minSize:{value:e,message:i.errorUtil.toString(t)}})}max(e,t){return new $({...this._def,maxSize:{value:e,message:i.errorUtil.toString(t)}})}size(e,t){return this.min(e,t).max(e,t)}nonempty(e){return this.min(1,e)}}t.ZodSet=$,$.create=(e,t)=>new $({valueType:e,minSize:null,maxSize:null,typeName:ae.ZodSet,...l(t)});class q extends h{constructor(){super(...arguments),this.validate=this.implement}_parse(e){const{ctx:t}=this._processInputParams(e);if(t.parsedType!==o.ZodParsedType.function)return(0,n.addIssueToContext)(t,{code:a.ZodIssueCode.invalid_type,expected:o.ZodParsedType.function,received:t.parsedType}),n.INVALID;function s(e,s){return(0,n.makeIssue)({data:e,path:t.path,errorMaps:[t.common.contextualErrorMap,t.schemaErrorMap,(0,r.getErrorMap)(),r.defaultErrorMap].filter((e=>!!e)),issueData:{code:a.ZodIssueCode.invalid_arguments,argumentsError:s}})}function i(e,s){return(0,n.makeIssue)({data:e,path:t.path,errorMaps:[t.common.contextualErrorMap,t.schemaErrorMap,(0,r.getErrorMap)(),r.defaultErrorMap].filter((e=>!!e)),issueData:{code:a.ZodIssueCode.invalid_return_type,returnTypeError:s}})}const d={errorMap:t.common.contextualErrorMap},u=t.data;if(this._def.returns instanceof Y){const e=this;return(0,n.OK)((async function(...t){const r=new a.ZodError([]),n=await e._def.args.parseAsync(t,d).catch((e=>{throw r.addIssue(s(t,e)),r})),o=await Reflect.apply(u,this,n);return await e._def.returns._def.type.parseAsync(o,d).catch((e=>{throw r.addIssue(i(o,e)),r}))}))}{const e=this;return(0,n.OK)((function(...t){const r=e._def.args.safeParse(t,d);if(!r.success)throw new a.ZodError([s(t,r.error)]);const n=Reflect.apply(u,this,r.data),o=e._def.returns.safeParse(n,d);if(!o.success)throw new a.ZodError([i(n,o.error)]);return o.data}))}}parameters(){return this._def.args}returnType(){return this._def.returns}args(...e){return new q({...this._def,args:B.create(e).rest(N.create())})}returns(e){return new q({...this._def,returns:e})}implement(e){return this.parse(e)}strictImplement(e){return this.parse(e)}static create(e,t,s){return new q({args:e||B.create([]).rest(N.create()),returns:t||N.create(),typeName:ae.ZodFunction,...l(s)})}}t.ZodFunction=q;class K extends h{get schema(){return this._def.getter()}_parse(e){const{ctx:t}=this._processInputParams(e);return this._def.getter()._parse({data:t.data,path:t.path,parent:t})}}t.ZodLazy=K,K.create=(e,t)=>new K({getter:e,typeName:ae.ZodLazy,...l(t)});class H extends h{_parse(e){if(e.data!==this._def.value){const t=this._getOrReturnCtx(e);return(0,n.addIssueToContext)(t,{received:t.data,code:a.ZodIssueCode.invalid_literal,expected:this._def.value}),n.INVALID}return{status:"valid",value:e.data}}get value(){return this._def.value}}function W(e,t){return new G({values:e,typeName:ae.ZodEnum,...l(t)})}t.ZodLiteral=H,H.create=(e,t)=>new H({value:e,typeName:ae.ZodLiteral,...l(t)});class G extends h{_parse(e){if("string"!=typeof e.data){const t=this._getOrReturnCtx(e),s=this._def.values;return(0,n.addIssueToContext)(t,{expected:o.util.joinValues(s),received:t.parsedType,code:a.ZodIssueCode.invalid_type}),n.INVALID}if(-1===this._def.values.indexOf(e.data)){const t=this._getOrReturnCtx(e),s=this._def.values;return(0,n.addIssueToContext)(t,{received:t.data,code:a.ZodIssueCode.invalid_enum_value,options:s}),n.INVALID}return(0,n.OK)(e.data)}get options(){return this._def.values}get enum(){const e={};for(const t of this._def.values)e[t]=t;return e}get Values(){const e={};for(const t of this._def.values)e[t]=t;return e}get Enum(){const e={};for(const t of this._def.values)e[t]=t;return e}extract(e){return G.create(e)}exclude(e){return G.create(this.options.filter((t=>!e.includes(t))))}}t.ZodEnum=G,G.create=W;class Q extends h{_parse(e){const t=o.util.getValidEnumValues(this._def.values),s=this._getOrReturnCtx(e);if(s.parsedType!==o.ZodParsedType.string&&s.parsedType!==o.ZodParsedType.number){const e=o.util.objectValues(t);return(0,n.addIssueToContext)(s,{expected:o.util.joinValues(e),received:s.parsedType,code:a.ZodIssueCode.invalid_type}),n.INVALID}if(-1===t.indexOf(e.data)){const e=o.util.objectValues(t);return(0,n.addIssueToContext)(s,{received:s.data,code:a.ZodIssueCode.invalid_enum_value,options:e}),n.INVALID}return(0,n.OK)(e.data)}get enum(){return this._def.values}}t.ZodNativeEnum=Q,Q.create=(e,t)=>new Q({values:e,typeName:ae.ZodNativeEnum,...l(t)});class Y extends h{unwrap(){return this._def.type}_parse(e){const{ctx:t}=this._processInputParams(e);if(t.parsedType!==o.ZodParsedType.promise&&!1===t.common.async)return(0,n.addIssueToContext)(t,{code:a.ZodIssueCode.invalid_type,expected:o.ZodParsedType.promise,received:t.parsedType}),n.INVALID;const s=t.parsedType===o.ZodParsedType.promise?t.data:Promise.resolve(t.data);return(0,n.OK)(s.then((e=>this._def.type.parseAsync(e,{path:t.path,errorMap:t.common.contextualErrorMap}))))}}t.ZodPromise=Y,Y.create=(e,t)=>new Y({type:e,typeName:ae.ZodPromise,...l(t)});class J extends h{innerType(){return this._def.schema}sourceType(){return this._def.schema._def.typeName===ae.ZodEffects?this._def.schema.sourceType():this._def.schema}_parse(e){const{status:t,ctx:s}=this._processInputParams(e),r=this._def.effect||null,i={addIssue:e=>{(0,n.addIssueToContext)(s,e),e.fatal?t.abort():t.dirty()},get path(){return s.path}};if(i.addIssue=i.addIssue.bind(i),"preprocess"===r.type){const e=r.transform(s.data,i);return s.common.issues.length?{status:"dirty",value:s.data}:s.common.async?Promise.resolve(e).then((e=>this._def.schema._parseAsync({data:e,path:s.path,parent:s}))):this._def.schema._parseSync({data:e,path:s.path,parent:s})}if("refinement"===r.type){const e=e=>{const t=r.refinement(e,i);if(s.common.async)return Promise.resolve(t);if(t instanceof Promise)throw new Error("Async refinement encountered during synchronous parse operation. Use .parseAsync instead.");return e};if(!1===s.common.async){const r=this._def.schema._parseSync({data:s.data,path:s.path,parent:s});return"aborted"===r.status?n.INVALID:("dirty"===r.status&&t.dirty(),e(r.value),{status:t.value,value:r.value})}return this._def.schema._parseAsync({data:s.data,path:s.path,parent:s}).then((s=>"aborted"===s.status?n.INVALID:("dirty"===s.status&&t.dirty(),e(s.value).then((()=>({status:t.value,value:s.value}))))))}if("transform"===r.type){if(!1===s.common.async){const e=this._def.schema._parseSync({data:s.data,path:s.path,parent:s});if(!(0,n.isValid)(e))return e;const o=r.transform(e.value,i);if(o instanceof Promise)throw new Error("Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.");return{status:t.value,value:o}}return this._def.schema._parseAsync({data:s.data,path:s.path,parent:s}).then((e=>(0,n.isValid)(e)?Promise.resolve(r.transform(e.value,i)).then((e=>({status:t.value,value:e}))):e))}o.util.assertNever(r)}}t.ZodEffects=J,t.ZodTransformer=J,J.create=(e,t,s)=>new J({schema:e,typeName:ae.ZodEffects,effect:t,...l(s)}),J.createWithPreprocess=(e,t,s)=>new J({schema:t,effect:{type:"preprocess",transform:e},typeName:ae.ZodEffects,...l(s)});class X extends h{_parse(e){return this._getType(e)===o.ZodParsedType.undefined?(0,n.OK)(void 0):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}}t.ZodOptional=X,X.create=(e,t)=>new X({innerType:e,typeName:ae.ZodOptional,...l(t)});class ee extends h{_parse(e){return this._getType(e)===o.ZodParsedType.null?(0,n.OK)(null):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}}t.ZodNullable=ee,ee.create=(e,t)=>new ee({innerType:e,typeName:ae.ZodNullable,...l(t)});class te extends h{_parse(e){const{ctx:t}=this._processInputParams(e);let s=t.data;return t.parsedType===o.ZodParsedType.undefined&&(s=this._def.defaultValue()),this._def.innerType._parse({data:s,path:t.path,parent:t})}removeDefault(){return this._def.innerType}}t.ZodDefault=te,te.create=(e,t)=>new te({innerType:e,typeName:ae.ZodDefault,defaultValue:"function"==typeof t.default?t.default:()=>t.default,...l(t)});class se extends h{_parse(e){const{ctx:t}=this._processInputParams(e),s={...t,common:{...t.common,issues:[]}},r=this._def.innerType._parse({data:s.data,path:s.path,parent:{...s}});return(0,n.isAsync)(r)?r.then((e=>({status:"valid",value:"valid"===e.status?e.value:this._def.catchValue({get error(){return new a.ZodError(s.common.issues)},input:s.data})}))):{status:"valid",value:"valid"===r.status?r.value:this._def.catchValue({get error(){return new a.ZodError(s.common.issues)},input:s.data})}}removeCatch(){return this._def.innerType}}t.ZodCatch=se,se.create=(e,t)=>new se({innerType:e,typeName:ae.ZodCatch,catchValue:"function"==typeof t.catch?t.catch:()=>t.catch,...l(t)});class re extends h{_parse(e){if(this._getType(e)!==o.ZodParsedType.nan){const t=this._getOrReturnCtx(e);return(0,n.addIssueToContext)(t,{code:a.ZodIssueCode.invalid_type,expected:o.ZodParsedType.nan,received:t.parsedType}),n.INVALID}return{status:"valid",value:e.data}}}t.ZodNaN=re,re.create=e=>new re({typeName:ae.ZodNaN,...l(e)}),t.BRAND=Symbol("zod_brand");class ie extends h{_parse(e){const{ctx:t}=this._processInputParams(e),s=t.data;return this._def.type._parse({data:s,path:t.path,parent:t})}unwrap(){return this._def.type}}t.ZodBranded=ie;class ne extends h{_parse(e){const{status:t,ctx:s}=this._processInputParams(e);if(s.common.async)return(async()=>{const e=await this._def.in._parseAsync({data:s.data,path:s.path,parent:s});return"aborted"===e.status?n.INVALID:"dirty"===e.status?(t.dirty(),(0,n.DIRTY)(e.value)):this._def.out._parseAsync({data:e.value,path:s.path,parent:s})})();{const e=this._def.in._parseSync({data:s.data,path:s.path,parent:s});return"aborted"===e.status?n.INVALID:"dirty"===e.status?(t.dirty(),{status:"dirty",value:e.value}):this._def.out._parseSync({data:e.value,path:s.path,parent:s})}}static create(e,t){return new ne({in:e,out:t,typeName:ae.ZodPipeline})}}t.ZodPipeline=ne;class oe extends h{_parse(e){const t=this._def.innerType._parse(e);return(0,n.isValid)(t)&&(t.value=Object.freeze(t.value)),t}}var ae;t.ZodReadonly=oe,oe.create=(e,t)=>new oe({innerType:e,typeName:ae.ZodReadonly,...l(t)}),t.custom=(e,t={},s)=>e?j.create().superRefine(((r,i)=>{var n,o;if(!e(r)){const e="function"==typeof t?t(r):"string"==typeof t?{message:t}:t,a=null===(o=null!==(n=e.fatal)&&void 0!==n?n:s)||void 0===o||o,d="string"==typeof e?{message:e}:e;i.addIssue({code:"custom",...d,fatal:a})}})):j.create(),t.late={object:V.lazycreate},function(e){e.ZodString="ZodString",e.ZodNumber="ZodNumber",e.ZodNaN="ZodNaN",e.ZodBigInt="ZodBigInt",e.ZodBoolean="ZodBoolean",e.ZodDate="ZodDate",e.ZodSymbol="ZodSymbol",e.ZodUndefined="ZodUndefined",e.ZodNull="ZodNull",e.ZodAny="ZodAny",e.ZodUnknown="ZodUnknown",e.ZodNever="ZodNever",e.ZodVoid="ZodVoid",e.ZodArray="ZodArray",e.ZodObject="ZodObject",e.ZodUnion="ZodUnion",e.ZodDiscriminatedUnion="ZodDiscriminatedUnion",e.ZodIntersection="ZodIntersection",e.ZodTuple="ZodTuple",e.ZodRecord="ZodRecord",e.ZodMap="ZodMap",e.ZodSet="ZodSet",e.ZodFunction="ZodFunction",e.ZodLazy="ZodLazy",e.ZodLiteral="ZodLiteral",e.ZodEnum="ZodEnum",e.ZodEffects="ZodEffects",e.ZodNativeEnum="ZodNativeEnum",e.ZodOptional="ZodOptional",e.ZodNullable="ZodNullable",e.ZodDefault="ZodDefault",e.ZodCatch="ZodCatch",e.ZodPromise="ZodPromise",e.ZodBranded="ZodBranded",e.ZodPipeline="ZodPipeline",e.ZodReadonly="ZodReadonly"}(ae=t.ZodFirstPartyTypeKind||(t.ZodFirstPartyTypeKind={})),t.instanceof=(e,s={message:`Input not instance of ${e.name}`})=>(0,t.custom)((t=>t instanceof e),s);const de=b.create;t.string=de;const ue=T.create;t.number=ue;const le=re.create;t.nan=le;const he=P.create;t.bigint=he;const ce=O.create;t.boolean=ce;const pe=I.create;t.date=pe;const fe=w.create;t.symbol=fe;const _e=Z.create;t.undefined=_e;const ge=C.create;t.null=ge;const me=j.create;t.any=me;const ve=N.create;t.unknown=ve;const ye=M.create;t.never=ye;const be=E.create;t.void=be;const xe=k.create;t.array=xe;const Te=V.create;t.object=Te;const Pe=V.strictCreate;t.strictObject=Pe;const Oe=R.create;t.union=Oe;const Ie=L.create;t.discriminatedUnion=Ie;const we=z.create;t.intersection=we;const Ze=B.create;t.tuple=Ze;const Ce=U.create;t.record=Ce;const je=F.create;t.map=je;const Ne=$.create;t.set=Ne;const Me=q.create;t.function=Me;const Ee=K.create;t.lazy=Ee;const ke=H.create;t.literal=ke;const Se=G.create;t.enum=Se;const Ve=Q.create;t.nativeEnum=Ve;const Re=Y.create;t.promise=Re;const Ae=J.create;t.effect=Ae,t.transformer=Ae;const Le=X.create;t.optional=Le;const De=ee.create;t.nullable=De;const ze=J.createWithPreprocess;t.preprocess=ze;const Be=ne.create;t.pipeline=Be,t.ostring=()=>de().optional(),t.onumber=()=>ue().optional(),t.oboolean=()=>ce().optional(),t.coerce={string:e=>b.create({...e,coerce:!0}),number:e=>T.create({...e,coerce:!0}),boolean:e=>O.create({...e,coerce:!0}),bigint:e=>P.create({...e,coerce:!0}),date:e=>I.create({...e,coerce:!0})},t.NEVER=n.INVALID}},t={},s=function s(r){var i=t[r];if(void 0!==i)return i.exports;var n=t[r]={exports:{}};return e[r].call(n.exports,n,n.exports,s),n.exports}(3607);window.dataStructureTyped=s})();
|
|
2
|
+
(()=>{"use strict";var t={1925:(t,e)=>{Object.defineProperty(e,"__esModule",{value:!0}),e.AaTree=void 0,e.AaTree=class{}},6279:(t,e,i)=>{Object.defineProperty(e,"__esModule",{value:!0}),e.AbstractBinaryTree=e.AbstractBinaryTreeNode=void 0;const r=i(5928),s=i(1230);class n{constructor(t,e){this._height=0,this._id=t,this._val=e}get id(){return this._id}set id(t){this._id=t}get val(){return this._val}set val(t){this._val=t}get left(){return this._left}set left(t){t&&(t.parent=this),this._left=t}get right(){return this._right}set right(t){t&&(t.parent=this),this._right=t}get parent(){return this._parent}set parent(t){this._parent=t}get height(){return this._height}set height(t){this._height=t}get familyPosition(){const t=this;return t.parent?t.parent.left===t?t.left||t.right?s.FamilyPosition.ROOT_LEFT:s.FamilyPosition.LEFT:t.parent.right===t?t.left||t.right?s.FamilyPosition.ROOT_RIGHT:s.FamilyPosition.RIGHT:s.FamilyPosition.MAL_NODE:t.left||t.right?s.FamilyPosition.ROOT:s.FamilyPosition.ISOLATED}}e.AbstractBinaryTreeNode=n,e.AbstractBinaryTree=class{constructor(t){if(this._root=null,this._size=0,this._loopType=s.LoopType.ITERATIVE,this._visitedId=[],this._visitedVal=[],this._visitedNode=[],this._visitedLeftSum=[],void 0!==t){const{loopType:e=s.LoopType.ITERATIVE}=t;this._loopType=e}this.clear()}get root(){return this._root}get size(){return this._size}get loopType(){return this._loopType}get visitedId(){return this._visitedId}get visitedVal(){return this._visitedVal}get visitedNode(){return this._visitedNode}get visitedLeftSum(){return this._visitedLeftSum}swapLocation(t,e){const{id:i,val:r,height:s}=e,n=this.createNode(i,r);return n&&(n.height=s,e.id=t.id,e.val=t.val,e.height=t.height,t.id=n.id,t.val=n.val,t.height=n.height),e}clear(){this._root=null,this._size=0,this._clearResults()}isEmpty(){return 0===this.size}add(t,e){let i,r;if(null===t)r=null;else if("number"==typeof t)r=this.createNode(t,e);else{if(!(t instanceof n))return;r=t}const s=t?this.get(t,"id"):void 0;return this.root?s?(s.val=e,i=s):i=((t,e)=>{const i=[t];for(;i.length>0;){const t=i.shift();if(!t)return;{if(e&&t.id===e.id)return;const r=this._addTo(e,t);if(void 0!==r)return r;t.left&&i.push(t.left),t.right&&i.push(t.right)}}})(this.root,r):(this._setRoot(r),null!==r?this._setSize(1):this._setSize(0),i=this.root),i}addMany(t,e){var i;const r=[],s=new Map;for(const e of t)s.set(e,(null!==(i=s.get(e))&&void 0!==i?i:0)+1);for(let i=0;i<t.length;i++){const o=t[i];if(s.has(o)){if(o instanceof n){r.push(this.add(o.id,o.val));continue}if(null===o){r.push(this.add(null));continue}const t=null==e?void 0:e[i];r.push(this.add(o,t)),s.delete(o)}}return r}fill(t,e){return this.clear(),t.length===this.addMany(t,e).length}remove(t,e){const i=[];if(!this.root)return i;const r="number"==typeof t?this.get(t):t;if(!r)return i;const n=(null==r?void 0:r.parent)?r.parent:null;let o=null,h=r;if(r.left){const t=r.left?this.getRightMost(r.left):null;if(t){const e=t.parent;h=this.swapLocation(r,t),e&&(e.right===t?e.right=t.left:e.left=t.left,o=e)}}else if(n){const{familyPosition:t}=r;t===s.FamilyPosition.LEFT||t===s.FamilyPosition.ROOT_LEFT?n.left=r.right:t!==s.FamilyPosition.RIGHT&&t!==s.FamilyPosition.ROOT_RIGHT||(n.right=r.right),o=n}else void 0!==r.right&&this._setRoot(r.right);return this._setSize(this.size-1),i.push({deleted:h,needBalanced:o}),i}getDepth(t){"number"==typeof t&&(t=this.get(t,"id"));let e=0;for(;null==t?void 0:t.parent;)e++,t=t.parent;return e}getHeight(t){if("number"==typeof(t=null!=t?t:this.root)&&(t=this.get(t,"id")),!t)return-1;if(this._loopType===s.LoopType.RECURSIVE){const e=t=>{if(!t)return-1;const i=e(t.left),r=e(t.right);return Math.max(i,r)+1};return e(t)}{if(!t)return-1;const e=[{node:t,depth:0}];let i=0;for(;e.length>0;){const{node:t,depth:r}=e.pop();t.left&&e.push({node:t.left,depth:r+1}),t.right&&e.push({node:t.right,depth:r+1}),i=Math.max(i,r)}return i}}getMinHeight(t){var e,i,r;if(!(t=t||this.root))return-1;if(this._loopType===s.LoopType.RECURSIVE){const e=t=>{if(!t)return 0;if(!t.left&&!t.right)return 0;const i=e(t.left),r=e(t.right);return Math.min(i,r)+1};return e(t)}{const s=[];let n=t,o=null;const h=new Map;for(;s.length>0||n;)if(n)s.push(n),n=n.left;else if(n=s[s.length-1],n.right&&o!==n.right)n=n.right;else if(n=s.pop(),n){const t=n.left&&null!==(e=h.get(n.left))&&void 0!==e?e:-1,r=n.right&&null!==(i=h.get(n.right))&&void 0!==i?i:-1;h.set(n,1+Math.min(t,r)),o=n,n=null}return null!==(r=h.get(t))&&void 0!==r?r:-1}}isPerfectlyBalanced(t){return this.getMinHeight(t)+1>=this.getHeight(t)}getNodes(t,e,i){if(!this.root)return[];e=null!=e?e:"id";const r=[];if(this.loopType===s.LoopType.RECURSIVE){const s=n=>{this._pushByPropertyNameStopOrNot(n,r,t,e,i)||(n.left||n.right)&&(n.left&&s(n.left),n.right&&s(n.right))};s(this.root)}else{const s=[this.root];for(;s.length>0;){const n=s.shift();if(n){if(this._pushByPropertyNameStopOrNot(n,r,t,e,i))return r;n.left&&s.push(n.left),n.right&&s.push(n.right)}}}return r}has(t,e){return e=null!=e?e:"id",this.getNodes(t,e).length>0}get(t,e){var i;return e=null!=e?e:"id",null!==(i=this.getNodes(t,e,!0)[0])&&void 0!==i?i:null}getPathToRoot(t){const e=[];for(;t.parent;)e.unshift(t),t=t.parent;return e.unshift(t),e}getLeftMost(t){if("number"==typeof t&&(t=this.get(t,"id")),!(t=null!=t?t:this.root))return t;if(this._loopType===s.LoopType.RECURSIVE){const e=t=>t.left?e(t.left):t;return e(t)}{const e=(0,r.trampoline)((t=>t.left?e.cont(t.left):t));return e(t)}}getRightMost(t){if(!(t=null!=t?t:this.root))return t;if(this._loopType===s.LoopType.RECURSIVE){const e=t=>t.right?e(t.right):t;return e(t)}{const e=(0,r.trampoline)((t=>t.right?e.cont(t.right):t));return e(t)}}isSubtreeBST(t){if(!t)return!0;if(this._loopType===s.LoopType.RECURSIVE){const e=(t,i,r)=>!t||!(t.id<=i||t.id>=r)&&e(t.left,i,t.id)&&e(t.right,t.id,r);return e(t,Number.MIN_SAFE_INTEGER,Number.MAX_SAFE_INTEGER)}{const e=[];let i=Number.MIN_SAFE_INTEGER,r=t;for(;r||e.length>0;){for(;r;)e.push(r),r=r.left;if(r=e.pop(),!r||i>=r.id)return!1;i=r.id,r=r.right}return!0}}isBST(){return this.isSubtreeBST(this.root)}getSubTreeSize(t){let e=0;if(!t)return e;if(this._loopType===s.LoopType.RECURSIVE){const i=t=>{e++,t.left&&i(t.left),t.right&&i(t.right)};return i(t),e}{const i=[t];for(;i.length>0;){const t=i.pop();e++,t.right&&i.push(t.right),t.left&&i.push(t.left)}return e}}subTreeSum(t,e){if(e=null!=e?e:"id","number"==typeof t&&(t=this.get(t,"id")),!t)return 0;let i=0;const r=t=>{let i;switch(e){case"id":default:i=t.id;break;case"val":i="number"==typeof t.val?t.val:0}return i};if(this._loopType===s.LoopType.RECURSIVE){const e=t=>{i+=r(t),t.left&&e(t.left),t.right&&e(t.right)};e(t)}else{const e=[t];for(;e.length>0;){const t=e.pop();i+=r(t),t.right&&e.push(t.right),t.left&&e.push(t.left)}}return i}subTreeAdd(t,e,i){if(i=null!=i?i:"id","number"==typeof t&&(t=this.get(t,"id")),!t)return!1;const r=t=>{t.id+=e};if(this._loopType===s.LoopType.RECURSIVE){const e=t=>{r(t),t.left&&e(t.left),t.right&&e(t.right)};e(t)}else{const e=[t];for(;e.length>0;){const t=e.pop();r(t),t.right&&e.push(t.right),t.left&&e.push(t.left)}}return!0}BFS(t){t=null!=t?t:"id",this._clearResults();const e=[this.root];for(;0!==e.length;){const i=e.shift();i&&(this._accumulatedByPropertyName(i,t),null!==(null==i?void 0:i.left)&&e.push(i.left),null!==(null==i?void 0:i.right)&&e.push(i.right))}return this._getResultByPropertyName(t)}DFS(t,e){t=null!=t?t:"in",e=null!=e?e:"id",this._clearResults();const i=r=>{switch(t){case"in":r.left&&i(r.left),this._accumulatedByPropertyName(r,e),r.right&&i(r.right);break;case"pre":this._accumulatedByPropertyName(r,e),r.left&&i(r.left),r.right&&i(r.right);break;case"post":r.left&&i(r.left),r.right&&i(r.right),this._accumulatedByPropertyName(r,e)}};return this.root&&i(this.root),this._getResultByPropertyName(e)}DFSIterative(t,e){if(t=t||"in",e=e||"id",this._clearResults(),!this.root)return this._getResultByPropertyName(e);const i=[{opt:0,node:this.root}];for(;i.length>0;){const r=i.pop();if(r&&r.node)if(1===r.opt)this._accumulatedByPropertyName(r.node,e);else switch(t){case"in":default:i.push({opt:0,node:r.node.right}),i.push({opt:1,node:r.node}),i.push({opt:0,node:r.node.left});break;case"pre":i.push({opt:0,node:r.node.right}),i.push({opt:0,node:r.node.left}),i.push({opt:1,node:r.node});break;case"post":i.push({opt:1,node:r.node}),i.push({opt:0,node:r.node.right}),i.push({opt:0,node:r.node.left})}}return this._getResultByPropertyName(e)}levelIterative(t,e){if(e=e||"id",!(t=t||this.root))return[];this._clearResults();const i=[t];for(;i.length>0;){const t=i.shift();t&&(this._accumulatedByPropertyName(t,e),t.left&&i.push(t.left),t.right&&i.push(t.right))}return this._getResultByPropertyName(e)}listLevels(t,e){if(e=e||"id",!(t=t||this.root))return[];const i=[],r=(t,r)=>{switch(e){case"id":default:i[r].push(t.id);break;case"val":i[r].push(t.val);break;case"node":i[r].push(t)}};if(this.loopType===s.LoopType.RECURSIVE){const e=(t,s)=>{i[s]||(i[s]=[]),r(t,s),t.left&&e(t.left,s+1),t.right&&e(t.right,s+1)};e(t,0)}else{const e=[[t,0]];for(;e.length>0;){const t=e.pop(),[s,n]=t;i[n]||(i[n]=[]),r(s,n),s.right&&e.push([s.right,n+1]),s.left&&e.push([s.left,n+1])}}return i}getPredecessor(t){if(t.left){let e=t.left;for(;!e||e.right&&e.right!==t;)e&&(e=e.right);return e}return t}morris(t,e){if(null===this.root)return[];t=t||"in",e=e||"id",this._clearResults();let i=this.root;const r=t=>{let e=null,i=null;for(;t;)i=t.right,t.right=e,e=t,t=i;return e},s=t=>{const i=r(t);let s=i;for(;s;)this._accumulatedByPropertyName(s,e),s=s.right;r(i)};switch(t){case"in":for(;i;){if(i.left){const t=this.getPredecessor(i);if(!t.right){t.right=i,i=i.left;continue}t.right=null}this._accumulatedByPropertyName(i,e),i=i.right}break;case"pre":for(;i;){if(i.left){const t=this.getPredecessor(i);if(!t.right){t.right=i,this._accumulatedByPropertyName(i,e),i=i.left;continue}t.right=null}else this._accumulatedByPropertyName(i,e);i=i.right}break;case"post":for(;i;){if(i.left){const t=this.getPredecessor(i);if(null===t.right){t.right=i,i=i.left;continue}t.right=null,s(i.left)}i=i.right}s(this.root)}return this._getResultByPropertyName(e)}_addTo(t,e){return e?void 0===e.left?(e.left=t,t&&this._setSize(this.size+1),e.left):void 0===e.right?(e.right=t,t&&this._setSize(this.size+1),e.right):void 0:void 0}_setLoopType(t){this._loopType=t}_setVisitedId(t){this._visitedId=t}_setVisitedVal(t){this._visitedVal=t}_setVisitedNode(t){this._visitedNode=t}_setVisitedLeftSum(t){this._visitedLeftSum=t}_setRoot(t){t&&(t.parent=void 0),this._root=t}_setSize(t){this._size=t}_clearResults(){this._visitedId=[],this._visitedVal=[],this._visitedNode=[],this._visitedLeftSum=[]}_pushByPropertyNameStopOrNot(t,e,i,r,s){switch(r){case"id":default:if(t.id===i)return e.push(t),!!s;break;case"val":if(t.val===i)return e.push(t),!!s}}_accumulatedByPropertyName(t,e){switch(e=null!=e?e:"id"){case"id":default:this._visitedId.push(t.id);break;case"val":this._visitedVal.push(t.val);break;case"node":this._visitedNode.push(t)}}_getResultByPropertyName(t){switch(t=null!=t?t:"id"){case"id":default:return this._visitedId;case"val":return this._visitedVal;case"node":return this._visitedNode}}}},9993:(t,e,i)=>{Object.defineProperty(e,"__esModule",{value:!0}),e.AVLTree=e.AVLTreeNode=void 0;const r=i(761);class s extends r.BSTNode{constructor(t,e){super(t,e)}}e.AVLTreeNode=s;class n extends r.BST{constructor(t){super(t)}createNode(t,e){return new s(t,e)}add(t,e){const i=super.add(t,e);return i&&this.balancePath(i),i}remove(t,e){const i=super.remove(t,e);for(const{needBalanced:t}of i)t&&this.balancePath(t);return i}balanceFactor(t){return t.right?t.left?t.right.height-t.left.height:+t.height:-t.height}updateHeight(t){if(t.left||t.right)if(t.left)t.right?t.height=1+Math.max(t.right.height,t.left.height):t.height=1+t.left.height;else{const e=t.right?t.right.height:0;t.height=1+e}else t.height=0}balancePath(t){const e=this.getPathToRoot(t);for(let t=e.length-1;t>=0;t--){const i=e[t];switch(this.updateHeight(i),this.balanceFactor(i)){case-2:i&&i.left&&(this.balanceFactor(i.left)<=0?this.balanceLL(i):this.balanceLR(i));break;case 2:i&&i.right&&(this.balanceFactor(i.right)>=0?this.balanceRR(i):this.balanceRL(i))}}}balanceLL(t){const e=t.parent,i=t.left;t.parent=i,i&&i.right&&(i.right.parent=t),i&&(i.parent=e),t===this.root?i&&this._setRoot(i):(null==e?void 0:e.left)===t?e.left=i:e&&(e.right=i),i&&(t.left=i.right,i.right=t),this.updateHeight(t),i&&this.updateHeight(i)}balanceLR(t){const e=t.parent,i=t.left;let r=null;i&&(r=i.right),t&&(t.parent=r),i&&(i.parent=r),r&&(r.left&&(r.left.parent=i),r.right&&(r.right.parent=t),r.parent=e),t===this.root?r&&this._setRoot(r):e&&(e.left===t?e.left=r:e.right=r),r&&(t.left=r.right,i&&(i.right=r.left),r.left=i,r.right=t),this.updateHeight(t),i&&this.updateHeight(i),r&&this.updateHeight(r)}balanceRR(t){const e=t.parent,i=t.right;t.parent=i,i&&(i.left&&(i.left.parent=t),i.parent=e),t===this.root?i&&this._setRoot(i):e&&(e.left===t?e.left=i:e.right=i),i&&(t.right=i.left,i.left=t),this.updateHeight(t),i&&this.updateHeight(i)}balanceRL(t){const e=t.parent,i=t.right;let r=null;i&&(r=i.left),t.parent=r,i&&(i.parent=r),r&&(r.left&&(r.left.parent=t),r.right&&(r.right.parent=i),r.parent=e),t===this.root?r&&this._setRoot(r):e&&(e.left===t?e.left=r:e.right=r),r&&(t.right=r.left),i&&r&&(i.left=r.right),r&&(r.left=t),r&&(r.right=i),this.updateHeight(t),i&&this.updateHeight(i),r&&this.updateHeight(r)}}e.AVLTree=n},479:(t,e)=>{Object.defineProperty(e,"__esModule",{value:!0}),e.BTree=void 0,e.BTree=class{}},9649:(t,e)=>{Object.defineProperty(e,"__esModule",{value:!0}),e.BinaryIndexedTree=void 0;class i{constructor(t){this._sumTree=new Array(t+1).fill(0)}get sumTree(){return this._sumTree}static lowBit(t){return t&-t}update(t,e){for(;t<this._sumTree.length;)this._sumTree[t]+=e,t+=i.lowBit(t)}getPrefixSum(t){let e=0;for(;t>0;)e+=this._sumTree[t],t-=i.lowBit(t);return e}getRangeSum(t,e){if(!(0<=t&&t<=e&&e<=this._sumTree.length))throw"Index out of bounds";return this.getPrefixSum(e)-this.getPrefixSum(t)}_setSumTree(t){this._sumTree=t}}e.BinaryIndexedTree=i},8021:(t,e,i)=>{Object.defineProperty(e,"__esModule",{value:!0}),e.BinaryTree=e.BinaryTreeNode=void 0;const r=i(6279);class s extends r.AbstractBinaryTreeNode{constructor(t,e){super(t,e)}}e.BinaryTreeNode=s;class n extends r.AbstractBinaryTree{constructor(t){super(t)}createNode(t,e){return new s(t,e)}}e.BinaryTree=n},761:(t,e,i)=>{Object.defineProperty(e,"__esModule",{value:!0}),e.BST=e.BSTNode=void 0;const r=i(1230),s=i(8021);class n extends s.BinaryTreeNode{constructor(t,e){super(t,e)}}e.BSTNode=n;class o extends s.BinaryTree{constructor(t){if(super(t),this._comparator=(t,e)=>t-e,void 0!==t){const{comparator:e}=t;void 0!==e&&(this._comparator=e)}}createNode(t,e){return new n(t,e)}add(t,e){let i=null;const s=this.createNode(t,e);if(null===this.root)this._setRoot(s),this._setSize(this.size+1),i=this.root;else{let e=this.root,n=!0;for(;n;)null!==e&&null!==s?this._compare(e.id,t)===r.CP.eq?(s&&(e.val=s.val),n=!1,i=e):this._compare(e.id,t)===r.CP.gt?void 0===e.left?(s&&(s.parent=e),e.left=s,this._setSize(this.size+1),n=!1,i=e.left):e.left&&(e=e.left):this._compare(e.id,t)===r.CP.lt&&(void 0===e.right?(s&&(s.parent=e),e.right=s,this._setSize(this.size+1),n=!1,i=e.right):e.right&&(e=e.right)):n=!1}return i}get(t,e){var i;return e=null!=e?e:"id",null!==(i=this.getNodes(t,e,!0)[0])&&void 0!==i?i:null}lastKey(){var t,e,i,s,n,o;return this._compare(0,1)===r.CP.lt?null!==(e=null===(t=this.getRightMost())||void 0===t?void 0:t.id)&&void 0!==e?e:0:this._compare(0,1)===r.CP.gt?null!==(s=null===(i=this.getLeftMost())||void 0===i?void 0:i.id)&&void 0!==s?s:0:null!==(o=null===(n=this.getRightMost())||void 0===n?void 0:n.id)&&void 0!==o?o:0}getNodes(t,e,i){if(e=null!=e?e:"id",!this.root)return[];const s=[];if(this.loopType===r.LoopType.RECURSIVE){const n=o=>{this._pushByPropertyNameStopOrNot(o,s,t,e,i)||(o.left||o.right)&&("id"===e?(this._compare(o.id,t)===r.CP.gt&&o.left&&n(o.left),this._compare(o.id,t)===r.CP.lt&&o.right&&n(o.right)):(o.left&&n(o.left),o.right&&n(o.right)))};n(this.root)}else{const n=[this.root];for(;n.length>0;){const o=n.shift();if(o){if(this._pushByPropertyNameStopOrNot(o,s,t,e,i))return s;"id"===e?(this._compare(o.id,t)===r.CP.gt&&o.left&&n.push(o.left),this._compare(o.id,t)===r.CP.lt&&o.right&&n.push(o.right)):(o.left&&n.push(o.left),o.right&&n.push(o.right))}}}return s}lesserSum(t,e){if(e=null!=e?e:"id","number"==typeof t&&(t=this.get(t,"id")),!t)return 0;if(!this.root)return 0;const i=t.id,s=t=>{let e;return e=t.id,e};let n=0;if(this.loopType===r.LoopType.RECURSIVE){const t=o=>{const h=this._compare(o.id,i);if(h!==r.CP.eq)if(h===r.CP.lt){if(o.left&&(n+=this.subTreeSum(o.left,e)),n+=s(o),!o.right)return;t(o.right)}else{if(!o.left)return;t(o.left)}else o.right&&(n+=this.subTreeSum(o.right,e))};t(this.root)}else{const t=[this.root];for(;t.length>0;){const o=t.shift();if(o){const h=this._compare(o.id,i);if(h===r.CP.eq)return o.right&&(n+=this.subTreeSum(o.right,e)),n;if(h===r.CP.lt){if(o.left&&(n+=this.subTreeSum(o.left,e)),n+=s(o),!o.right)return n;t.push(o.right)}else{if(!o.left)return n;t.push(o.left)}}}}return n}allGreaterNodesAdd(t,e,i){if(i=null!=i?i:"id","number"==typeof t&&(t=this.get(t,"id")),!t)return!1;const s=t.id;if(!this.root)return!1;const n=t=>{t.id+=e};if(this.loopType===r.LoopType.RECURSIVE){const t=e=>{this._compare(e.id,s)===r.CP.gt&&n(e),(e.left||e.right)&&(e.left&&this._compare(e.left.id,s)===r.CP.gt&&t(e.left),e.right&&this._compare(e.right.id,s)===r.CP.gt&&t(e.right))};return t(this.root),!0}{const t=[this.root];for(;t.length>0;){const e=t.shift();e&&(this._compare(e.id,s)===r.CP.gt&&n(e),e.left&&this._compare(e.left.id,s)===r.CP.gt&&t.push(e.left),e.right&&this._compare(e.right.id,s)===r.CP.gt&&t.push(e.right))}return!0}}perfectlyBalance(){const t=this.DFS("in","node"),e=t.length;if(this.clear(),t.length<1)return!1;if(this.loopType===r.LoopType.RECURSIVE){const i=(e,r)=>{if(e>r)return;const s=e+Math.floor((r-e)/2),n=t[s];this.add(n.id,n.val),i(e,s-1),i(s+1,r)};return i(0,e-1),!0}{const i=[[0,e-1]];for(;i.length>0;){const e=i.pop();if(e){const[r,s]=e;if(r<=s){const e=r+Math.floor((s-r)/2),n=t[e];this.add(n.id,n.val),i.push([e+1,s]),i.push([r,e-1])}}}return!0}}isAVLBalanced(){var t,e;if(!this.root)return!0;let i=!0;if(this.loopType===r.LoopType.RECURSIVE){const t=e=>{if(!e)return 0;const r=t(e.left),s=t(e.right);return Math.abs(r-s)>1&&(i=!1),Math.max(r,s)+1};t(this.root)}else{const i=[];let r=this.root,s=null;const n=new Map;for(;i.length>0||r;)if(r)i.push(r),r=r.left;else if(r=i[i.length-1],r.right&&s!==r.right)r=r.right;else if(r=i.pop(),r){const i=r.left&&null!==(t=n.get(r.left))&&void 0!==t?t:-1,o=r.right&&null!==(e=n.get(r.right))&&void 0!==e?e:-1;if(Math.abs(i-o)>1)return!1;n.set(r,1+Math.max(i,o)),s=r,r=null}}return i}_compare(t,e){const i=this._comparator(t,e);return i>0?r.CP.gt:i<0?r.CP.lt:r.CP.eq}}e.BST=o},255:function(t,e,i){var r=this&&this.__createBinding||(Object.create?function(t,e,i,r){void 0===r&&(r=i);var s=Object.getOwnPropertyDescriptor(e,i);s&&!("get"in s?!e.__esModule:s.writable||s.configurable)||(s={enumerable:!0,get:function(){return e[i]}}),Object.defineProperty(t,r,s)}:function(t,e,i,r){void 0===r&&(r=i),t[r]=e[i]}),s=this&&this.__exportStar||function(t,e){for(var i in t)"default"===i||Object.prototype.hasOwnProperty.call(e,i)||r(e,t,i)};Object.defineProperty(e,"__esModule",{value:!0}),s(i(6279),e),s(i(8021),e),s(i(761),e),s(i(9649),e),s(i(8207),e),s(i(9993),e),s(i(479),e),s(i(1259),e),s(i(1564),e),s(i(1925),e),s(i(2570),e),s(i(7159),e)},1259:(t,e,i)=>{Object.defineProperty(e,"__esModule",{value:!0}),e.RBTree=e.RBTreeNode=void 0;const r=i(1230),s=i(761);class n extends s.BSTNode{constructor(t,e,i=r.RBColor.RED){super(t,e),this._color=i}get color(){return this._color}set color(t){this._color=t}}e.RBTreeNode=n;class o extends s.BST{constructor(t){super(t)}createNode(t,e){return new n(t,e,r.RBColor.RED)}insert(t,e){}leftRotate(t){}rightRotate(t){}insertFixup(t){}deleteFixup(t){}transplant(t,e){}}e.RBTree=o},8207:(t,e)=>{Object.defineProperty(e,"__esModule",{value:!0}),e.SegmentTree=e.SegmentTreeNode=void 0;class i{constructor(t,e,i,r){this._start=0,this._end=0,this._val=null,this._sum=0,this._left=null,this._right=null,this._start=t,this._end=e,this._sum=i,this._val=r||null}get start(){return this._start}set start(t){this._start=t}get end(){return this._end}set end(t){this._end=t}get val(){return this._val}set val(t){this._val=t}get sum(){return this._sum}set sum(t){this._sum=t}get left(){return this._left}set left(t){this._left=t}get right(){return this._right}set right(t){this._right=t}}e.SegmentTreeNode=i,e.SegmentTree=class{constructor(t,e,i){this._values=[],this._start=0,e=e||0,i=i||t.length-1,this._values=t,this._start=e,this._end=i,this._root=this.build(e,i)}get values(){return this._values}get start(){return this._start}get end(){return this._end}get root(){return this._root}build(t,e){if(t===e)return new i(t,e,this._values[t]);const r=t+Math.floor((e-t)/2),s=this.build(t,r),n=this.build(r+1,e),o=new i(t,e,s.sum+n.sum);return o.left=s,o.right=n,o}updateNode(t,e,i){const r=this.root||null;if(!r)return;const s=(t,e,i,r)=>{t.start!==t.end||t.start!==e?(e<=t.start+Math.floor((t.end-t.start)/2)?t.left&&s(t.left,e,i,r):t.right&&s(t.right,e,i,r),t.left&&t.right&&(t.sum=t.left.sum+t.right.sum)):t.sum=i};s(r,t,e)}querySumByRange(t,e){const i=this.root||null;if(!i)return 0;const r=(t,e,i)=>{if(t.start===e&&t.end===i)return t.sum;const s=t.start+Math.floor((t.end-t.start)/2);return i<=s?t.left?r(t.left,e,i):NaN:e>s?t.right?r(t.right,e,i):NaN:t.left&&t.right?r(t.left,e,s)+r(t.right,s+1,i):NaN};return r(i,t,e)}_setValues(t){this._values=t}_setStart(t){this._start=t}_setEnd(t){this._end=t}_setRoot(t){this._root=t}}},1564:(t,e)=>{Object.defineProperty(e,"__esModule",{value:!0}),e.SplayTree=void 0,e.SplayTree=class{}},2570:(t,e,i)=>{Object.defineProperty(e,"__esModule",{value:!0}),e.TreeMultiset=e.TreeMultisetNode=void 0;const r=i(1230),s=i(9993);class n extends s.AVLTreeNode{constructor(t,e,i=1){super(t,e),this._count=i}get count(){return this._count}set count(t){this._count=t}}e.TreeMultisetNode=n;class o extends s.AVLTree{constructor(t){super(Object.assign({},t)),this._count=0}get count(){return this._count}createNode(t,e,i){return new n(t,e,i)}swapLocation(t,e){const{id:i,val:r,count:s,height:n}=e,o=this.createNode(i,r,s);return o&&(o.height=n,e.id=t.id,e.val=t.val,e.count=t.count,e.height=t.height,t.id=o.id,t.val=o.val,t.count=o.count,t.height=o.height),e}add(t,e,i){let s,o;if(i=null!=i?i:1,o=t instanceof n?this.createNode(t.id,t.val,t.count):null===t?null:this.createNode(t,e,i),this.root){let t=this.root,e=!0;for(;e;)t?o&&(this._compare(t.id,o.id)===r.CP.eq?(t.val=o.val,t.count+=o.count,this._setCount(this.count+o.count),e=!1,s=t):this._compare(t.id,o.id)===r.CP.gt?void 0===t.left?(t.left=o,this._setSize(this.size+1),this._setCount(this.count+o.count),e=!1,s=t.left):t.left&&(t=t.left):this._compare(t.id,o.id)===r.CP.lt&&(void 0===t.right?(t.right=o,this._setSize(this.size+1),this._setCount(this.count+o.count),e=!1,s=t.right):t.right&&(t=t.right))):e=!1}else this._setRoot(o),this._setSize(this.size+1),o&&this._setCount(this.count+o.count),s=this.root;return s&&this.balancePath(s),s}_addTo(t,e){return e?void 0===e.left?(e.left=t,null!==t&&(this._setSize(this.size+1),this._setCount(this.count+t.count)),e.left):void 0===e.right?(e.right=t,null!==t&&(this._setSize(this.size+1),this._setCount(this.count+t.count)),e.right):void 0:void 0}addMany(t,e){var i;const r=[],s=new Map;for(const e of t)s.set(e,(null!==(i=s.get(e))&&void 0!==i?i:0)+1);for(let i=0;i<t.length;i++){const o=t[i];if(s.has(o)){if(o instanceof n){r.push(this.add(o.id,o.val,o.count));continue}if(null===o){r.push(this.add(NaN,null,0));continue}const t=null==e?void 0:e[i],h=s.get(o);r.push(this.add(o,t,h)),s.delete(o)}}return r}perfectlyBalance(){const t=this.DFS("in","node"),e=t.length;if(t.length<1)return!1;if(this.clear(),this.loopType===r.LoopType.RECURSIVE){const i=(e,r)=>{if(e>r)return;const s=e+Math.floor((r-e)/2),n=t[s];this.add(n.id,n.val,n.count),i(e,s-1),i(s+1,r)};return i(0,e-1),!0}{const i=[[0,e-1]];for(;i.length>0;){const e=i.pop();if(e){const[r,s]=e;if(r<=s){const e=r+Math.floor((s-r)/2),n=t[e];this.add(n.id,n.val,n.count),i.push([e+1,s]),i.push([r,e-1])}}}return!0}}remove(t,e){const i=[];if(!this.root)return i;const s=this.get(t);if(!s)return i;const n=(null==s?void 0:s.parent)?s.parent:null;let o=null,h=s;if(s.count>1&&!e)s.count--,this._setCount(this.count-1);else{if(s.left){const t=s.left?this.getRightMost(s.left):null;if(t){const e=t.parent;h=this.swapLocation(s,t),e&&(e.right===t?e.right=t.left:e.left=t.left,o=e)}}else if(n){const{familyPosition:t}=s;t===r.FamilyPosition.LEFT||t===r.FamilyPosition.ROOT_LEFT?n.left=s.right:t!==r.FamilyPosition.RIGHT&&t!==r.FamilyPosition.ROOT_RIGHT||(n.right=s.right),o=n}else void 0!==s.right&&this._setRoot(s.right);this._setSize(this.size-1),this._setCount(this.count-h.count)}return i.push({deleted:h,needBalanced:o}),o&&this.balancePath(o),i}getSubTreeCount(t){const e=[0,0];if(!t)return e;if(this.loopType===r.LoopType.RECURSIVE){const i=t=>{e[0]++,e[1]+=t.count,t.left&&i(t.left),t.right&&i(t.right)};return i(t),e}{const i=[t];for(;i.length>0;){const t=i.pop();e[0]++,e[1]+=t.count,t.right&&i.push(t.right),t.left&&i.push(t.left)}return e}}subTreeSumCount(t){if("number"==typeof t&&(t=this.get(t,"id")),!t)return 0;let e=0;if(this.loopType===r.LoopType.RECURSIVE){const i=t=>{e+=t.count,t.left&&i(t.left),t.right&&i(t.right)};i(t)}else{const i=[t];for(;i.length>0;){const t=i.pop();e+=t.count,t.right&&i.push(t.right),t.left&&i.push(t.left)}}return e}subTreeAddCount(t,e){if("number"==typeof t&&(t=this.get(t,"id")),!t)return!1;const i=t=>{t.count+=e,this._setCount(this.count+e)};if(this.loopType===r.LoopType.RECURSIVE){const e=t=>{i(t),t.left&&e(t.left),t.right&&e(t.right)};e(t)}else{const e=[t];for(;e.length>0;){const t=e.pop();i(t),t.right&&e.push(t.right),t.left&&e.push(t.left)}}return!0}getNodesByCount(t,e){if(!this.root)return[];const i=[];if(this.loopType===r.LoopType.RECURSIVE){const r=s=>{s.count===t&&(i.push(s),e)||(s.left||s.right)&&(s.left&&r(s.left),s.right&&r(s.right))};r(this.root)}else{const r=[this.root];for(;r.length>0;){const s=r.shift();if(s){if(s.count===t&&(i.push(s),e))return i;s.left&&r.push(s.left),s.right&&r.push(s.right)}}}return i}BFSCount(){return super.BFS("node").map((t=>t.count))}listLevelsCount(t){return super.listLevels(t,"node").map((t=>t.map((t=>t.count))))}morrisCount(t){return t=t||"in",super.morris(t,"node").map((t=>t.count))}DFSIterativeCount(t,e){return t=null!=t?t:"in",super.DFSIterative(t,"node").map((t=>t.count))}DFSCount(t,e){return t=null!=t?t:"in",super.DFS(t,"node").map((t=>t.count))}lesserSumCount(t){if("number"==typeof t&&(t=this.get(t,"id")),!t)return 0;if(!this.root)return 0;const e=t.id;let i=0;if(this.loopType===r.LoopType.RECURSIVE){const t=s=>{const n=this._compare(s.id,e);if(n!==r.CP.eq)if(n===r.CP.lt){if(s.left&&(i+=this.subTreeSumCount(s.left)),i+=s.count,!s.right)return;t(s.right)}else{if(!s.left)return;t(s.left)}else s.right&&(i+=this.subTreeSumCount(s.right))};t(this.root)}else{const t=[this.root];for(;t.length>0;){const s=t.shift();if(s){const n=this._compare(s.id,e);if(n===r.CP.eq)return s.right&&(i+=this.subTreeSumCount(s.right)),i;if(n===r.CP.lt){if(s.left&&(i+=this.subTreeSumCount(s.left)),i+=s.count,!s.right)return i;t.push(s.right)}else{if(!s.left)return i;t.push(s.left)}}}}return i}allGreaterNodesAddCount(t,e){if("number"==typeof t&&(t=this.get(t,"id")),!t)return!1;const i=t.id;if(!this.root)return!1;if(this.loopType===r.LoopType.RECURSIVE){const t=s=>{this._compare(s.id,i)===r.CP.gt&&(s.count+=e),(s.left||s.right)&&(s.left&&this._compare(s.left.id,i)===r.CP.gt&&t(s.left),s.right&&this._compare(s.right.id,i)===r.CP.gt&&t(s.right))};return t(this.root),!0}{const t=[this.root];for(;t.length>0;){const s=t.shift();s&&(this._compare(s.id,i)===r.CP.gt&&(s.count+=e),s.left&&this._compare(s.left.id,i)===r.CP.gt&&t.push(s.left),s.right&&this._compare(s.right.id,i)===r.CP.gt&&t.push(s.right))}return!0}}clear(){super.clear(),this._setCount(0)}_setCount(t){this._count=t}}e.TreeMultiset=o},7159:(t,e)=>{Object.defineProperty(e,"__esModule",{value:!0}),e.TwoThreeTree=void 0,e.TwoThreeTree=class{}},618:(t,e,i)=>{Object.defineProperty(e,"__esModule",{value:!0}),e.AbstractGraph=e.AbstractEdge=e.AbstractVertex=void 0;const r=i(5928),s=i(7641);class n{constructor(t,e){this._id=t,this._val=e}get id(){return this._id}set id(t){this._id=t}get val(){return this._val}set val(t){this._val=t}}e.AbstractVertex=n;class o{constructor(t,e){this._weight=void 0!==t?t:1,this._val=e,this._hashCode=(0,r.uuidV4)()}get val(){return this._val}set val(t){this._val=t}get weight(){return this._weight}set weight(t){this._weight=t}get hashCode(){return this._hashCode}_setHashCode(t){this._hashCode=t}}e.AbstractEdge=o,e.AbstractGraph=class{constructor(){this._vertices=new Map}get vertices(){return this._vertices}getVertex(t){return this._vertices.get(t)||null}hasVertex(t){return this._vertices.has(this._getVertexId(t))}addVertex(t,e){if(t instanceof n)return this._addVertexOnly(t);{const i=this.createVertex(t,e);return this._addVertexOnly(i)}}removeVertex(t){const e=this._getVertexId(t);return this._vertices.delete(e)}removeAllVertices(t){const e=[];for(const i of t)e.push(this.removeVertex(i));return e.length>0}hasEdge(t,e){return!!this.getEdge(t,e)}addEdge(t,e,i,r){if(t instanceof o)return this._addEdgeOnly(t);if(e instanceof n||"string"==typeof e||"number"==typeof e){if(!this.hasVertex(t)||!this.hasVertex(e))return!1;t instanceof n&&(t=t.id),e instanceof n&&(e=e.id);const s=this.createEdge(t,e,i,r);return this._addEdgeOnly(s)}throw new Error("dest must be a Vertex or vertex id while srcOrEdge is an Edge")}setEdgeWeight(t,e,i){const r=this.getEdge(t,e);return!!r&&(r.weight=i,!0)}getAllPathsBetween(t,e){const i=[],s=this._getVertex(t),n=this._getVertex(e);if(!s||!n)return[];const o=(t,e,n,h)=>{n.set(t,!0),t===e&&i.push([s,...h]);const l=this.getNeighbors(t);for(const t of l)n.get(t)||(h.push(t),o(t,e,n,h),(0,r.arrayRemove)(h,(e=>e===t)));n.set(t,!1)};return o(s,n,new Map,[]),i}getPathSumWeight(t){var e;let i=0;for(let r=0;r<t.length;r++)i+=(null===(e=this.getEdge(t[r],t[r+1]))||void 0===e?void 0:e.weight)||0;return i}getMinCostBetween(t,e,i){if(void 0===i&&(i=!1),i){const i=this.getAllPathsBetween(t,e);let r=1/0;for(const t of i)r=Math.min(this.getPathSumWeight(t),r);return r}{const i=this._getVertex(e),r=this._getVertex(t);if(!r||!i)return null;const s=new Map,n=[r];s.set(r,!0);let o=0;for(;n.length>0;){for(let t=0;t<n.length;t++){const t=n.shift();if(t===i)return o;if(void 0!==t){const e=this.getNeighbors(t);for(const t of e)s.has(t)||(s.set(t,!0),n.push(t))}}o++}return null}}getMinPathBetween(t,e,i){if(void 0===i&&(i=!1),i){const i=this.getAllPathsBetween(t,e);let r=1/0,s=-1,n=0;for(const t of i){const e=this.getPathSumWeight(t);e<r&&(r=e,s=n),n++}return i[s]||null}{let i=[];const s=this._getVertex(t),n=this._getVertex(e);if(!s||!n)return[];const o=(t,e,n,h)=>{if(n.set(t,!0),t===e)return void(i=[s,...h]);const l=this.getNeighbors(t);for(const t of l)n.get(t)||(h.push(t),o(t,e,n,h),(0,r.arrayRemove)(h,(e=>e===t)));n.set(t,!1)};return o(s,n,new Map,[]),i}}dijkstraWithoutHeap(t,e,i,r){void 0===i&&(i=!1),void 0===r&&(r=!1),void 0===e&&(e=null);let s=1/0,o=null,h=[];const l=[],u=this._vertices,a=new Map,c=new Set,d=new Map,f=this._getVertex(t),p=e?this._getVertex(e):null;if(!f)return null;for(const t of u){const e=t[1];e instanceof n&&a.set(e,1/0)}a.set(f,0),d.set(f,null);const _=()=>{let t=1/0,e=null;for(const[i,r]of a)c.has(i)||r<t&&(t=r,e=i);return e},g=t=>{for(const e of u){const i=e[1];if(i instanceof n){const r=[i];let s=d.get(i);for(;s;)r.push(s),s=d.get(s);const n=r.reverse();e[1]===t&&(h=n),l.push(n)}}};for(let t=1;t<u.size;t++){const t=_();if(t){if(c.add(t),p&&p===t)return i&&(s=a.get(p)||1/0),r&&g(p),{distMap:a,preMap:d,seen:c,paths:l,minDist:s,minPath:h};const e=this.getNeighbors(t);for(const i of e)if(!c.has(i)){const e=this.getEdge(t,i);if(e){const r=a.get(t),s=a.get(i);void 0!==r&&void 0!==s&&e.weight+r<s&&(a.set(i,e.weight+r),d.set(i,t))}}}}return i&&a.forEach(((t,e)=>{e!==f&&t<s&&(s=t,r&&(o=e))})),r&&g(o),{distMap:a,preMap:d,seen:c,paths:l,minDist:s,minPath:h}}dijkstra(t,e,i,r){var o;void 0===i&&(i=!1),void 0===r&&(r=!1),void 0===e&&(e=null);let h=1/0,l=null,u=[];const a=[],c=this._vertices,d=new Map,f=new Set,p=new Map,_=this._getVertex(t),g=e?this._getVertex(e):null;if(!_)return null;for(const t of c){const e=t[1];e instanceof n&&d.set(e,1/0)}const v=new s.PriorityQueue({comparator:(t,e)=>t.id-e.id});v.add({id:0,val:_}),d.set(_,0),p.set(_,null);const y=t=>{for(const e of c){const i=e[1];if(i instanceof n){const r=[i];let s=p.get(i);for(;s;)r.push(s),s=p.get(s);const n=r.reverse();e[1]===t&&(u=n),a.push(n)}}};for(;v.size>0;){const t=v.poll(),e=null==t?void 0:t.id,s=null==t?void 0:t.val;if(void 0!==e&&s){if(f.add(s),g&&g===s)return i&&(h=d.get(g)||1/0),r&&y(g),{distMap:d,preMap:p,seen:f,paths:a,minDist:h,minPath:u};const t=this.getNeighbors(s);for(const i of t)if(!f.has(i)){const t=null===(o=this.getEdge(s,i))||void 0===o?void 0:o.weight;if("number"==typeof t){const r=d.get(i);r&&e+t<r&&(v.add({id:e+t,val:i}),p.set(i,s),d.set(i,e+t))}}}}return i&&d.forEach(((t,e)=>{e!==_&&t<h&&(h=t,r&&(l=e))})),r&&y(l),{distMap:d,preMap:p,seen:f,paths:a,minDist:h,minPath:u}}bellmanFord(t,e,i,r){void 0===i&&(i=!1),void 0===r&&(r=!1);const s=this._getVertex(t),o=[],h=new Map,l=new Map;let u,a=1/0,c=[];if(e&&(u=!1),!s)return{hasNegativeCycle:u,distMap:h,preMap:l,paths:o,min:a,minPath:c};const d=this._vertices,f=d.size,p=this.edgeSet(),_=p.length;this._vertices.forEach((t=>{h.set(t,1/0)})),h.set(s,0);for(let t=1;t<f;++t)for(let t=0;t<_;++t){const e=this.getEndsOfEdge(p[t]);if(e){const[i,s]=e,n=p[t].weight,o=h.get(i),u=h.get(s);void 0!==o&&void 0!==u&&h.get(i)!==1/0&&o+n<u&&(h.set(s,o+n),r&&l.set(s,i))}}let g=null;if(i&&h.forEach(((t,e)=>{e!==s&&t<a&&(a=t,r&&(g=e))})),r)for(const t of d){const e=t[1];if(e instanceof n){const i=[e];let r=l.get(e);for(;void 0!==r;)i.push(r),r=l.get(r);const s=i.reverse();t[1]===g&&(c=s),o.push(s)}}for(let t=0;t<_;++t){const e=this.getEndsOfEdge(p[t]);if(e){const[i]=e,r=p[t].weight,s=h.get(i);s&&s!==1/0&&s+r<s&&(u=!0)}}return{hasNegativeCycle:u,distMap:h,preMap:l,paths:o,min:a,minPath:c}}floyd(){var t;const e=[...this._vertices],i=e.length,r=[],s=[];for(let t=0;t<i;t++){r[t]=[],s[t]=[];for(let e=0;e<i;e++)s[t][e]=null}for(let s=0;s<i;s++)for(let n=0;n<i;n++)r[s][n]=(null===(t=this.getEdge(e[s][1],e[n][1]))||void 0===t?void 0:t.weight)||1/0;for(let t=0;t<i;t++)for(let n=0;n<i;n++)for(let o=0;o<i;o++)r[n][o]>r[n][t]+r[t][o]&&(r[n][o]=r[n][t]+r[t][o],s[n][o]=e[t][1]);return{costs:r,predecessor:s}}tarjan(t,e,i,r){const s=!1;void 0===t&&(t=s),void 0===e&&(e=s),void 0===i&&(i=s),void 0===r&&(r=s);const n=new Map,o=new Map,h=this._vertices;h.forEach((t=>{n.set(t,-1),o.set(t,1/0)}));const[l]=h.values(),u=[],a=[];let c=0;const d=(i,r)=>{c++,n.set(i,c),o.set(i,c);const s=this.getNeighbors(i);let h=0;for(const c of s)if(c!==r){-1===n.get(c)&&(h++,d(c,i));const r=o.get(c),s=o.get(i);void 0!==s&&void 0!==r&&o.set(i,Math.min(s,r));const f=n.get(i);if(void 0!==r&&void 0!==f&&(t&&(i===l&&h>=2||i!==l&&r>=f)&&u.push(i),e&&r>f)){const t=this.getEdge(i,c);t&&a.push(t)}}};d(l,null);let f=new Map;const p=()=>{const t=new Map;return o.forEach(((e,i)=>{var r;t.has(e)?null===(r=t.get(e))||void 0===r||r.push(i):t.set(e,[i])})),t};i&&(f=p());const _=new Map;if(r){let t=new Map;t.size<1&&(t=p()),t.forEach(((t,e)=>{t.length>1&&_.set(e,t)}))}return{dfnMap:n,lowMap:o,bridges:a,articulationPoints:u,SCCs:f,cycles:_}}_addVertexOnly(t){return!this.hasVertex(t)&&(this._vertices.set(t.id,t),!0)}_getVertex(t){const e=this._getVertexId(t);return this._vertices.get(e)||null}_getVertexId(t){return t instanceof n?t.id:t}_setVertices(t){this._vertices=t}}},4693:(t,e,i)=>{Object.defineProperty(e,"__esModule",{value:!0}),e.DirectedGraph=e.DirectedEdge=e.DirectedVertex=void 0;const r=i(5928),s=i(618);class n extends s.AbstractVertex{constructor(t,e){super(t,e)}}e.DirectedVertex=n;class o extends s.AbstractEdge{constructor(t,e,i,r){super(i,r),this._src=t,this._dest=e}get src(){return this._src}set src(t){this._src=t}get dest(){return this._dest}set dest(t){this._dest=t}}e.DirectedEdge=o;class h extends s.AbstractGraph{constructor(){super(),this._outEdgeMap=new Map,this._inEdgeMap=new Map}get outEdgeMap(){return this._outEdgeMap}get inEdgeMap(){return this._inEdgeMap}createVertex(t,e){return new n(t,null!=e?e:t)}createEdge(t,e,i,r){return new o(t,e,null!=i?i:1,r)}getEdge(t,e){let i=[];if(null!==t&&null!==e){const r=this._getVertex(t),s=this._getVertex(e);if(r&&s){const t=this._outEdgeMap.get(r);t&&(i=t.filter((t=>t.dest===s.id)))}}return i[0]||null}removeEdgeSrcToDest(t,e){const i=this._getVertex(t),s=this._getVertex(e);let n=null;if(!i||!s)return null;const o=this._outEdgeMap.get(i);o&&(0,r.arrayRemove)(o,(t=>t.dest===s.id));const h=this._inEdgeMap.get(s);return h&&(n=(0,r.arrayRemove)(h,(t=>t.src===i.id))[0]||null),n}removeEdge(t){let e=null;const i=this._getVertex(t.src),s=this._getVertex(t.dest);if(i&&s){const t=this._outEdgeMap.get(i);t&&t.length>0&&(0,r.arrayRemove)(t,(t=>t.src===i.id));const n=this._inEdgeMap.get(s);n&&n.length>0&&(e=(0,r.arrayRemove)(n,(t=>t.dest===s.id))[0])}return e}removeEdgesBetween(t,e){const i=[];if(t&&e){const r=this.removeEdgeSrcToDest(t,e),s=this.removeEdgeSrcToDest(e,t);r&&i.push(r),s&&i.push(s)}return i}incomingEdgesOf(t){const e=this._getVertex(t);return e&&this.inEdgeMap.get(e)||[]}outgoingEdgesOf(t){const e=this._getVertex(t);return e&&this._outEdgeMap.get(e)||[]}degreeOf(t){return this.outDegreeOf(t)+this.inDegreeOf(t)}inDegreeOf(t){return this.incomingEdgesOf(t).length}outDegreeOf(t){return this.outgoingEdgesOf(t).length}edgesOf(t){return[...this.outgoingEdgesOf(t),...this.incomingEdgesOf(t)]}getEdgeSrc(t){return this._getVertex(t.src)}getEdgeDest(t){return this._getVertex(t.dest)}getDestinations(t){if(null===t)return[];const e=[],i=this.outgoingEdgesOf(t);for(const t of i){const i=this.getEdgeDest(t);i&&e.push(i)}return e}topologicalSort(t){t=null!=t?t:"id";const e=new Map;for(const t of this.vertices)e.set(t[1],0);let i=[],r=!1;const s=t=>{e.set(t,1);const n=this.getDestinations(t);for(const t of n){const i=e.get(t);0===i?s(t):1===i&&(r=!0)}e.set(t,2),i.push(t)};for(const t of this.vertices)0===e.get(t[1])&&s(t[1]);return r?null:("id"===t&&(i=i.map((t=>t instanceof n?t.id:t))),i.reverse())}edgeSet(){let t=[];return this._outEdgeMap.forEach((e=>{t=[...t,...e]})),t}getNeighbors(t){const e=[],i=this._getVertex(t);if(i){const t=this.outgoingEdgesOf(i);for(const i of t){const t=this._getVertex(i.dest);t&&e.push(t)}}return e}getEndsOfEdge(t){if(!this.hasEdge(t.src,t.dest))return null;const e=this._getVertex(t.src),i=this._getVertex(t.dest);return e&&i?[e,i]:null}_addEdgeOnly(t){if(!this.hasVertex(t.src)||!this.hasVertex(t.dest))return!1;const e=this._getVertex(t.src),i=this._getVertex(t.dest);if(e&&i){const r=this._outEdgeMap.get(e);r?r.push(t):this._outEdgeMap.set(e,[t]);const s=this._inEdgeMap.get(i);return s?s.push(t):this._inEdgeMap.set(i,[t]),!0}return!1}_setOutEdgeMap(t){this._outEdgeMap=t}_setInEdgeMap(t){this._inEdgeMap=t}}e.DirectedGraph=h},8079:function(t,e,i){var r=this&&this.__createBinding||(Object.create?function(t,e,i,r){void 0===r&&(r=i);var s=Object.getOwnPropertyDescriptor(e,i);s&&!("get"in s?!e.__esModule:s.writable||s.configurable)||(s={enumerable:!0,get:function(){return e[i]}}),Object.defineProperty(t,r,s)}:function(t,e,i,r){void 0===r&&(r=i),t[r]=e[i]}),s=this&&this.__exportStar||function(t,e){for(var i in t)"default"===i||Object.prototype.hasOwnProperty.call(e,i)||r(e,t,i)};Object.defineProperty(e,"__esModule",{value:!0}),s(i(618),e),s(i(4693),e),s(i(5237),e),s(i(5309),e)},5309:(t,e,i)=>{Object.defineProperty(e,"__esModule",{value:!0}),e.MapGraph=e.MapEdge=e.MapVertex=void 0;const r=i(4693);class s extends r.DirectedVertex{constructor(t,e,i,r){super(t,r),this._lat=e,this._long=i}get lat(){return this._lat}set lat(t){this._lat=t}get long(){return this._long}set long(t){this._long=t}}e.MapVertex=s;class n extends r.DirectedEdge{constructor(t,e,i,r){super(t,e,i,r)}}e.MapEdge=n;class o extends r.DirectedGraph{constructor(t,e){super(),this._origin=[0,0],this._origin=t,this._bottomRight=e}get origin(){return this._origin}set origin(t){this._origin=t}get bottomRight(){return this._bottomRight}set bottomRight(t){this._bottomRight=t}createVertex(t,e,i=this.origin[0],r=this.origin[1]){return new s(t,i,r,e)}createEdge(t,e,i,r){return new n(t,e,i,r)}}e.MapGraph=o},5237:(t,e,i)=>{Object.defineProperty(e,"__esModule",{value:!0}),e.UndirectedGraph=e.UndirectedEdge=e.UndirectedVertex=void 0;const r=i(5928),s=i(618);class n extends s.AbstractVertex{constructor(t,e){super(t,e)}}e.UndirectedVertex=n;class o extends s.AbstractEdge{constructor(t,e,i,r){super(i,r),this._vertices=[t,e]}get vertices(){return this._vertices}set vertices(t){this._vertices=t}}e.UndirectedEdge=o;class h extends s.AbstractGraph{constructor(){super(),this._edges=new Map}get edges(){return this._edges}createVertex(t,e){return new n(t,null!=e?e:t)}createEdge(t,e,i,r){return new o(t,e,null!=i?i:1,r)}getEdge(t,e){var i;let r=[];if(null!==t&&null!==e){const s=this._getVertex(t),n=this._getVertex(e);s&&n&&(r=null===(i=this._edges.get(s))||void 0===i?void 0:i.filter((t=>t.vertices.includes(n.id))))}return r&&r[0]||null}removeEdgeBetween(t,e){const i=this._getVertex(t),s=this._getVertex(e);if(!i||!s)return null;const n=this._edges.get(i);let o=null;n&&(o=(0,r.arrayRemove)(n,(t=>t.vertices.includes(s.id)))[0]||null);const h=this._edges.get(s);return h&&(0,r.arrayRemove)(h,(t=>t.vertices.includes(i.id))),o}removeEdge(t){return this.removeEdgeBetween(t.vertices[0],t.vertices[1])}degreeOf(t){var e;const i=this._getVertex(t);return i&&(null===(e=this._edges.get(i))||void 0===e?void 0:e.length)||0}edgesOf(t){const e=this._getVertex(t);return e&&this._edges.get(e)||[]}edgeSet(){const t=new Set;return this._edges.forEach((e=>{e.forEach((e=>{t.add(e)}))})),[...t]}getNeighbors(t){const e=[],i=this._getVertex(t);if(i){const t=this.edgesOf(i);for(const r of t){const t=this._getVertex(r.vertices.filter((t=>t!==i.id))[0]);t&&e.push(t)}}return e}getEndsOfEdge(t){if(!this.hasEdge(t.vertices[0],t.vertices[1]))return null;const e=this._getVertex(t.vertices[0]),i=this._getVertex(t.vertices[1]);return e&&i?[e,i]:null}_addEdgeOnly(t){for(const e of t.vertices){const i=this._getVertex(e);if(null===i)return!1;if(i){const e=this._edges.get(i);e?e.push(t):this._edges.set(i,[t])}}return!0}_setEdges(t){this._edges=t}}e.UndirectedGraph=h},2808:(t,e)=>{Object.defineProperty(e,"__esModule",{value:!0}),e.CoordinateMap=void 0;class i extends Map{constructor(t){super(),this._joint="_",void 0!==t&&(this._joint=t)}get joint(){return this._joint}has(t){return super.has(t.join(this._joint))}set(t,e){return super.set(t.join(this._joint),e)}get(t){return super.get(t.join(this._joint))}delete(t){return super.delete(t.join(this._joint))}_setJoint(t){this._joint=t}}e.CoordinateMap=i},2130:(t,e)=>{Object.defineProperty(e,"__esModule",{value:!0}),e.CoordinateSet=void 0;class i extends Set{constructor(t){super(),this._joint="_",void 0!==t&&(this._joint=t)}get joint(){return this._joint}has(t){return super.has(t.join(this._joint))}add(t){return super.add(t.join(this._joint))}delete(t){return super.delete(t.join(this._joint))}_setJoint(t){this._joint=t}}e.CoordinateSet=i},5946:(t,e)=>{Object.defineProperty(e,"__esModule",{value:!0}),e.HashTable=void 0,e.HashTable=class{}},6841:function(t,e,i){var r=this&&this.__createBinding||(Object.create?function(t,e,i,r){void 0===r&&(r=i);var s=Object.getOwnPropertyDescriptor(e,i);s&&!("get"in s?!e.__esModule:s.writable||s.configurable)||(s={enumerable:!0,get:function(){return e[i]}}),Object.defineProperty(t,r,s)}:function(t,e,i,r){void 0===r&&(r=i),t[r]=e[i]}),s=this&&this.__exportStar||function(t,e){for(var i in t)"default"===i||Object.prototype.hasOwnProperty.call(e,i)||r(e,t,i)};Object.defineProperty(e,"__esModule",{value:!0}),s(i(5946),e),s(i(2808),e),s(i(2130),e),s(i(8328),e),s(i(7665),e),s(i(8107),e)},8328:(t,e)=>{Object.defineProperty(e,"__esModule",{value:!0}),e.Pair=void 0,e.Pair=class{}},7665:(t,e)=>{Object.defineProperty(e,"__esModule",{value:!0}),e.TreeMap=void 0,e.TreeMap=class{}},8107:(t,e)=>{Object.defineProperty(e,"__esModule",{value:!0}),e.TreeSet=void 0,e.TreeSet=class{}},8049:(t,e)=>{Object.defineProperty(e,"__esModule",{value:!0}),e.Heap=e.HeapItem=void 0;class i{constructor(t=Number.MAX_SAFE_INTEGER,e=null){this._val=e,this._priority=t}get priority(){return this._priority}set priority(t){this._priority=t}get val(){return this._val}set val(t){this._val=t}}e.HeapItem=i,e.Heap=class{constructor(t){if(t){const{priorityExtractor:e}=t;if(void 0!==e&&"function"!=typeof e)throw new Error(".constructor expects a valid priority function");this._priorityExtractor=e||(t=>+t)}else this._priorityExtractor=t=>+t}get pq(){return this._pq}get priorityExtractor(){return this._priorityExtractor}get size(){return this._pq.size}isEmpty(){return this._pq.size<1}peek(t){t=null!=t&&t;const e=this._pq.peek();return t?e:null==e?void 0:e.val}peekLast(t){t=null!=t&&t;const e=this._pq.leaf();return t?e:null==e?void 0:e.val}add(t,e){return e=void 0===e?t:e,this._pq.add(new i(t,e)),this}poll(t){t=null!=t&&t;const e=this._pq.poll();return e?t?e:e.val:null}has(t){return t instanceof i?this.pq.getNodes().includes(t):-1!==this.pq.getNodes().findIndex((e=>e.val===t))}toArray(t){t=null!=t&&t;const e=this._pq.toArray();return t?e:e.map((t=>t.val))}sort(t){t=null!=t&&t;const e=this._pq.sort();return t?e:e.map((t=>t.val))}clear(){this._pq.clear()}}},7888:function(t,e,i){var r=this&&this.__createBinding||(Object.create?function(t,e,i,r){void 0===r&&(r=i);var s=Object.getOwnPropertyDescriptor(e,i);s&&!("get"in s?!e.__esModule:s.writable||s.configurable)||(s={enumerable:!0,get:function(){return e[i]}}),Object.defineProperty(t,r,s)}:function(t,e,i,r){void 0===r&&(r=i),t[r]=e[i]}),s=this&&this.__exportStar||function(t,e){for(var i in t)"default"===i||Object.prototype.hasOwnProperty.call(e,i)||r(e,t,i)};Object.defineProperty(e,"__esModule",{value:!0}),s(i(7112),e),s(i(1269),e),s(i(8049),e)},7112:(t,e,i)=>{Object.defineProperty(e,"__esModule",{value:!0}),e.MaxHeap=void 0;const r=i(8049),s=i(7641);class n extends r.Heap{constructor(t){super(t),this._pq=new s.PriorityQueue({comparator:(t,e)=>e.priority-t.priority})}}e.MaxHeap=n},1269:(t,e,i)=>{Object.defineProperty(e,"__esModule",{value:!0}),e.MinHeap=void 0;const r=i(8049),s=i(7641);class n extends r.Heap{constructor(t){super(t),this._pq=new s.PriorityQueue({comparator:(t,e)=>t.priority-e.priority})}}e.MinHeap=n},4866:function(t,e,i){var r=this&&this.__createBinding||(Object.create?function(t,e,i,r){void 0===r&&(r=i);var s=Object.getOwnPropertyDescriptor(e,i);s&&!("get"in s?!e.__esModule:s.writable||s.configurable)||(s={enumerable:!0,get:function(){return e[i]}}),Object.defineProperty(t,r,s)}:function(t,e,i,r){void 0===r&&(r=i),t[r]=e[i]}),s=this&&this.__exportStar||function(t,e){for(var i in t)"default"===i||Object.prototype.hasOwnProperty.call(e,i)||r(e,t,i)};Object.defineProperty(e,"__esModule",{value:!0}),s(i(6841),e),s(i(2324),e),s(i(9509),e),s(i(2627),e),s(i(8079),e),s(i(255),e),s(i(8456),e),s(i(7888),e),s(i(7641),e),s(i(7619),e),s(i(3543),e)},2198:(t,e)=>{Object.defineProperty(e,"__esModule",{value:!0}),e.DoublyLinkedList=e.DoublyLinkedListNode=void 0;class i{constructor(t){this._val=t,this._next=null,this._prev=null}get val(){return this._val}set val(t){this._val=t}get next(){return this._next}set next(t){this._next=t}get prev(){return this._prev}set prev(t){this._prev=t}}e.DoublyLinkedListNode=i;class r{constructor(){this._head=null,this._tail=null,this._length=0}get head(){return this._head}set head(t){this._head=t}get tail(){return this._tail}set tail(t){this._tail=t}get length(){return this._length}static fromArray(t){const e=new r;for(const i of t)e.push(i);return e}push(t){const e=new i(t);this.head?(e.prev=this.tail,this.tail.next=e,this.tail=e):(this.head=e,this.tail=e),this._length++}pop(){if(!this.tail)return null;const t=this.tail;return this.head===this.tail?(this.head=null,this.tail=null):(this.tail=t.prev,this.tail.next=null),this._length--,t.val}shift(){if(!this.head)return null;const t=this.head;return this.head===this.tail?(this.head=null,this.tail=null):(this.head=t.next,this.head.prev=null),this._length--,t.val}unshift(t){const e=new i(t);this.head?(e.next=this.head,this.head.prev=e,this.head=e):(this.head=e,this.tail=e),this._length++}getAt(t){if(t<0||t>=this.length)return null;let e=this.head;for(let i=0;i<t;i++)e=e.next;return e.val}getNodeAt(t){if(t<0||t>=this.length)return null;let e=this.head;for(let i=0;i<t;i++)e=e.next;return e}findNode(t){let e=this.head;for(;e;){if(e.val===t)return e;e=e.next}return null}insertAt(t,e){if(t<0||t>this.length)return!1;if(0===t)return this.unshift(e),!0;if(t===this.length)return this.push(e),!0;const r=new i(e),s=this.getNodeAt(t-1),n=s.next;return r.prev=s,r.next=n,s.next=r,n.prev=r,this._length++,!0}deleteAt(t){if(t<0||t>=this.length)return null;if(0===t)return this.shift();if(t===this.length-1)return this.pop();const e=this.getNodeAt(t),i=e.prev,r=e.next;return i.next=r,r.prev=i,this._length--,e.val}delete(t){let e;if(e=t instanceof i?t:this.findNode(t),e){if(e===this.head)this.shift();else if(e===this.tail)this.pop();else{const t=e.prev,i=e.next;t.next=i,i.prev=t,this._length--}return!0}return!1}toArray(){const t=[];let e=this.head;for(;e;)t.push(e.val),e=e.next;return t}clear(){this._head=null,this._tail=null,this._length=0}find(t){let e=this.head;for(;e;){if(t(e.val))return e.val;e=e.next}return null}indexOf(t){let e=0,i=this.head;for(;i;){if(i.val===t)return e;e++,i=i.next}return-1}findLast(t){let e=this.tail;for(;e;){if(t(e.val))return e.val;e=e.prev}return null}toArrayReverse(){const t=[];let e=this.tail;for(;e;)t.push(e.val),e=e.prev;return t}reverse(){let t=this.head;for([this.head,this.tail]=[this.tail,this.head];t;){const e=t.next;[t.prev,t.next]=[t.next,t.prev],t=e}}forEach(t){let e=this.head,i=0;for(;e;)t(e.val,i),e=e.next,i++}map(t){const e=new r;let i=this.head;for(;i;)e.push(t(i.val)),i=i.next;return e}filter(t){const e=new r;let i=this.head;for(;i;)t(i.val)&&e.push(i.val),i=i.next;return e}reduce(t,e){let i=e,r=this.head;for(;r;)i=t(i,r.val),r=r.next;return i}insertAfter(t,e){let r;if(r=t instanceof i?t:this.findNode(t),r){const t=new i(e);return t.next=r.next,r.next&&(r.next.prev=t),t.prev=r,r.next=t,r===this.tail&&(this.tail=t),this._length++,!0}return!1}insertBefore(t,e){let r;if(r=t instanceof i?t:this.findNode(t),r){const t=new i(e);return t.prev=r.prev,r.prev&&(r.prev.next=t),t.next=r,r.prev=t,r===this.head&&(this.head=t),this._length++,!0}return!1}}e.DoublyLinkedList=r},2324:function(t,e,i){var r=this&&this.__createBinding||(Object.create?function(t,e,i,r){void 0===r&&(r=i);var s=Object.getOwnPropertyDescriptor(e,i);s&&!("get"in s?!e.__esModule:s.writable||s.configurable)||(s={enumerable:!0,get:function(){return e[i]}}),Object.defineProperty(t,r,s)}:function(t,e,i,r){void 0===r&&(r=i),t[r]=e[i]}),s=this&&this.__exportStar||function(t,e){for(var i in t)"default"===i||Object.prototype.hasOwnProperty.call(e,i)||r(e,t,i)};Object.defineProperty(e,"__esModule",{value:!0}),s(i(8549),e),s(i(2198),e),s(i(5435),e)},8549:(t,e)=>{Object.defineProperty(e,"__esModule",{value:!0}),e.SinglyLinkedList=e.SinglyLinkedListNode=void 0;class i{constructor(t){this._val=t,this._next=null}get val(){return this._val}set val(t){this._val=t}get next(){return this._next}set next(t){this._next=t}}e.SinglyLinkedListNode=i;class r{constructor(){this._head=null,this._tail=null,this._length=0}get head(){return this._head}set head(t){this._head=t}get tail(){return this._tail}set tail(t){this._tail=t}get length(){return this._length}static fromArray(t){const e=new r;for(const i of t)e.push(i);return e}getLength(){return this._length}push(t){const e=new i(t);this.head?(this.tail.next=e,this.tail=e):(this.head=e,this.tail=e),this._length++}pop(){if(!this.head)return null;if(this.head===this.tail){const t=this.head.val;return this.head=null,this.tail=null,this._length--,t}let t=this.head;for(;t.next!==this.tail;)t=t.next;const e=this.tail.val;return t.next=null,this.tail=t,this._length--,e}shift(){if(!this.head)return null;const t=this.head;return this.head=this.head.next,this._length--,t.val}unshift(t){const e=new i(t);this.head?(e.next=this.head,this.head=e):(this.head=e,this.tail=e),this._length++}getAt(t){if(t<0||t>=this.length)return null;let e=this.head;for(let i=0;i<t;i++)e=e.next;return e.val}getNodeAt(t){let e=this.head;for(let i=0;i<t;i++)e=e.next;return e}deleteAt(t){if(t<0||t>=this.length)return null;if(0===t)return this.shift();if(t===this.length-1)return this.pop();const e=this.getNodeAt(t-1),i=e.next;return e.next=i.next,this._length--,i.val}delete(t){let e;e=t instanceof i?t.val:t;let r=this.head,s=null;for(;r;){if(r.val===e)return null===s?(this.head=r.next,r===this.tail&&(this.tail=null)):(s.next=r.next,r===this.tail&&(this.tail=s)),this._length--,!0;s=r,r=r.next}return!1}insertAt(t,e){if(t<0||t>this.length)return!1;if(0===t)return this.unshift(e),!0;if(t===this.length)return this.push(e),!0;const r=new i(e),s=this.getNodeAt(t-1);return r.next=s.next,s.next=r,this._length++,!0}isEmpty(){return 0===this.length}clear(){this._head=null,this._tail=null,this._length=0}toArray(){const t=[];let e=this.head;for(;e;)t.push(e.val),e=e.next;return t}reverse(){if(!this.head||this.head===this.tail)return;let t=null,e=this.head,i=null;for(;e;)i=e.next,e.next=t,t=e,e=i;[this.head,this.tail]=[this.tail,this.head]}find(t){let e=this.head;for(;e;){if(t(e.val))return e.val;e=e.next}return null}indexOf(t){let e=0,i=this.head;for(;i;){if(i.val===t)return e;e++,i=i.next}return-1}findNode(t){let e=this.head;for(;e;){if(e.val===t)return e;e=e.next}return null}insertBefore(t,e){if(!this.head)return!1;let r;if(r=t instanceof i?t.val:t,this.head.val===r)return this.unshift(e),!0;let s=this.head;for(;s.next;){if(s.next.val===r){const t=new i(e);return t.next=s.next,s.next=t,this._length++,!0}s=s.next}return!1}insertAfter(t,e){let r;if(r=t instanceof i?t:this.findNode(t),r){const t=new i(e);return t.next=r.next,r.next=t,r===this.tail&&(this.tail=t),this._length++,!0}return!1}countOccurrences(t){let e=0,i=this.head;for(;i;)i.val===t&&e++,i=i.next;return e}}e.SinglyLinkedList=r},5435:(t,e)=>{Object.defineProperty(e,"__esModule",{value:!0}),e.SkipLinkedList=void 0,e.SkipLinkedList=class{}},7619:function(t,e,i){var r=this&&this.__createBinding||(Object.create?function(t,e,i,r){void 0===r&&(r=i);var s=Object.getOwnPropertyDescriptor(e,i);s&&!("get"in s?!e.__esModule:s.writable||s.configurable)||(s={enumerable:!0,get:function(){return e[i]}}),Object.defineProperty(t,r,s)}:function(t,e,i,r){void 0===r&&(r=i),t[r]=e[i]}),s=this&&this.__exportStar||function(t,e){for(var i in t)"default"===i||Object.prototype.hasOwnProperty.call(e,i)||r(e,t,i)};Object.defineProperty(e,"__esModule",{value:!0}),s(i(4824),e),s(i(6090),e),s(i(8723),e),s(i(6690),e)},4824:(t,e)=>{Object.defineProperty(e,"__esModule",{value:!0}),e.MatrixNTI2D=void 0,e.MatrixNTI2D=class{constructor(t){const{row:e,col:i,initialVal:r}=t;this._matrix=new Array(e).fill(void 0).map((()=>new Array(i).fill(r||0)))}toArray(){return this._matrix}}},8723:function(t,e,i){var r=this&&this.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(e,"__esModule",{value:!0}),e.Matrix2D=void 0;const s=r(i(6090));class n{constructor(t){void 0===t?this._matrix=n.identity:t instanceof s.default?(this._matrix=n.identity,this._matrix[0][0]=t.x,this._matrix[1][0]=t.y,this._matrix[2][0]=t.w):this._matrix=t}static get empty(){return[[],[],[]]}static get identity(){return[[1,0,0],[0,1,0],[0,0,1]]}get m(){return this._matrix}get toVector(){return new s.default(this._matrix[0][0],this._matrix[1][0])}static add(t,e){const i=n.empty;for(let r=0;r<3;r++)for(let s=0;s<3;s++)i[r][s]=t.m[r][s]+e.m[r][s];return new n(i)}static subtract(t,e){const i=n.empty;for(let r=0;r<3;r++)for(let s=0;s<3;s++)i[r][s]=t.m[r][s]-e.m[r][s];return new n(i)}static multiply(t,e){const i=n.empty;for(let r=0;r<3;r++)for(let s=0;s<3;s++){i[r][s]=0;for(let n=0;n<3;n++)i[r][s]+=t.m[r][n]*e.m[n][s]}return new n(i)}static multiplyByValue(t,e){const i=n.empty;for(let r=0;r<3;r++)for(let s=0;s<3;s++)i[r][s]=t.m[r][s]*e;return new n(i)}static multiplyByVector(t,e){return n.multiply(t,new n(e)).toVector}static view(t,e){const i=t/2,r=e/2,s=Math.cos(Math.PI);return new n([[1,0,i],[0,1*s,r],[0,0,1]])}static scale(t){return n.multiplyByValue(new n,t)}static rotate(t){const e=Math.cos(t),i=Math.sin(t);return new n([[e,-i,0],[i,e,0],[0,0,1]])}static translate(t){return new n([[1,0,t.x],[0,1,t.y],[0,0,t.w]])}}e.Matrix2D=n,e.default=n},6690:(t,e)=>{Object.defineProperty(e,"__esModule",{value:!0}),e.Navigator=e.Character=void 0;class i{constructor(t,e){this.direction=t,this.turn=()=>new i(e[t],e)}}e.Character=i,e.Navigator=class{constructor({matrix:t,turning:e,onMove:r,init:{cur:s,charDir:n,VISITED:o}}){this._matrix=t,this._cur=s,this._character=new i(n,e),this.onMove=r,this.onMove&&this.onMove(this._cur),this._VISITED=o,this._matrix[this._cur[0]][this._cur[1]]=this._VISITED}start(){for(;this.check(this._character.direction)||this.check(this._character.turn().direction);){const{direction:t}=this._character;this.check(t)?this.move(t):this.check(this._character.turn().direction)&&(this._character=this._character.turn())}}check(t){let e,i;const r=this._matrix,[s,n]=this._cur;switch(t){case"up":if(i=r[s-1],!i)return!1;e=i[n];break;case"right":e=r[s][n+1];break;case"down":if(i=r[s+1],!i)return!1;e=i[n];break;case"left":e=r[s][n-1]}return void 0!==e&&e!==this._VISITED}move(t){switch(t){case"up":this._cur[0]--;break;case"right":this._cur[1]++;break;case"down":this._cur[0]++;break;case"left":this._cur[1]--}const[e,i]=this._cur;this._matrix[e][i]=this._VISITED,this.onMove&&this.onMove(this._cur)}}},6090:(t,e)=>{Object.defineProperty(e,"__esModule",{value:!0}),e.Vector2D=void 0;class i{constructor(t=0,e=0,i=1){this.x=t,this.y=e,this.w=i}get isZero(){return 0===this.x&&0===this.y}get length(){return Math.sqrt(this.x*this.x+this.y*this.y)}get lengthSq(){return this.x*this.x+this.y*this.y}get rounded(){return new i(Math.round(this.x),Math.round(this.y))}static add(t,e){return new i(t.x+e.x,t.y+e.y)}static subtract(t,e){return new i(t.x-e.x,t.y-e.y)}static subtractValue(t,e){return new i(t.x-e,t.y-e)}static multiply(t,e){return new i(t.x*e,t.y*e)}static divide(t,e){return new i(t.x/e,t.y/e)}static equals(t,e){return t.x===e.x&&t.y===e.y}static equalsRounded(t,e,r=12){const s=i.abs(i.subtract(t,e));return s.x<r&&s.y<r}static normalize(t){const e=t.length;return e>2220446049250313e-31?i.divide(t,e):t}static truncate(t,e){return t.length>e?i.multiply(i.normalize(t),e):t}static perp(t){return new i(-t.y,t.x)}static reverse(t){return new i(-t.x,-t.y)}static abs(t){return new i(Math.abs(t.x),Math.abs(t.y))}static dot(t,e){return t.x*e.x+t.y*e.y}static distance(t,e){const i=e.y-t.y,r=e.x-t.x;return Math.sqrt(i*i+r*r)}static distanceSq(t,e){const i=e.y-t.y,r=e.x-t.x;return i*i+r*r}static sign(t,e){return t.y*e.x>t.x*e.y?-1:1}static angle(t){const e=new i(0,-1),r=Math.acos(i.dot(t,e)/(t.length*e.length));return 1===i.sign(t,e)?2*Math.PI-r:r}static random(t,e){const r=Math.floor(Math.random()*t-t/2),s=Math.floor(Math.random()*e-e/2);return new i(r,s)}zero(){this.x=0,this.y=0}}e.Vector2D=i,e.default=i},7641:function(t,e,i){var r=this&&this.__createBinding||(Object.create?function(t,e,i,r){void 0===r&&(r=i);var s=Object.getOwnPropertyDescriptor(e,i);s&&!("get"in s?!e.__esModule:s.writable||s.configurable)||(s={enumerable:!0,get:function(){return e[i]}}),Object.defineProperty(t,r,s)}:function(t,e,i,r){void 0===r&&(r=i),t[r]=e[i]}),s=this&&this.__exportStar||function(t,e){for(var i in t)"default"===i||Object.prototype.hasOwnProperty.call(e,i)||r(e,t,i)};Object.defineProperty(e,"__esModule",{value:!0}),s(i(3491),e),s(i(7016),e),s(i(7021),e)},7021:(t,e,i)=>{Object.defineProperty(e,"__esModule",{value:!0}),e.MaxPriorityQueue=void 0;const r=i(3491);class s extends r.PriorityQueue{constructor(t){super(Object.assign(Object.assign({},t),{comparator:(null==t?void 0:t.comparator)?t.comparator:(t,e)=>e-t}))}static heapify(t){const e=new s(Object.assign(Object.assign({},t),{comparator:(null==t?void 0:t.comparator)?t.comparator:(t,e)=>e-t}));return e._fix(),e}}e.MaxPriorityQueue=s},7016:(t,e,i)=>{Object.defineProperty(e,"__esModule",{value:!0}),e.MinPriorityQueue=void 0;const r=i(3491);class s extends r.PriorityQueue{constructor(t){super(Object.assign(Object.assign({},t),{comparator:(null==t?void 0:t.comparator)?t.comparator:(t,e)=>t-e}))}static heapify(t){const e=new s(Object.assign(Object.assign({},t),{comparator:(null==t?void 0:t.comparator)?t.comparator:(t,e)=>t-e}));return e._fix(),e}}e.MinPriorityQueue=s},3491:(t,e)=>{Object.defineProperty(e,"__esModule",{value:!0}),e.PriorityQueue=void 0;class i{constructor(t){this._nodes=[],this._comparator=(t,e)=>t-e;const{nodes:e,comparator:i,isFix:r=!0}=t;this._comparator=i,e&&Array.isArray(e)&&e.length>0&&(this._nodes=[...e],r&&this._fix())}get nodes(){return this._nodes}get size(){return this.nodes.length}static heapify(t){const e=new i(t);return e._fix(),e}static isPriorityQueueified(t){return new i(Object.assign(Object.assign({},t),{isFix:!1})).isValid()}getNodes(){return this._nodes}add(t){this.nodes.push(t),this._heapifyUp(this.size-1)}has(t){return this.nodes.includes(t)}peek(){return this.size?this.nodes[0]:null}poll(){var t,e;let i=null;return this.size>1?(this._swap(0,this.nodes.length-1),i=null!==(t=this.nodes.pop())&&void 0!==t?t:null,this._heapifyDown(0)):1===this.size&&(i=null!==(e=this.nodes.pop())&&void 0!==e?e:null),i}leaf(){var t;return null!==(t=this.nodes[this.size-1])&&void 0!==t?t:null}isEmpty(){return 0===this.size}clear(){this._setNodes([])}toArray(){return[...this.nodes]}clone(){return new i({nodes:this.nodes,comparator:this._comparator})}isValid(){for(let t=0;t<this.nodes.length;t++){const e=this._getLeft(t),i=this._getRight(t);if(this._isValidIndex(e)&&!this._compare(e,t))return!1;if(this._isValidIndex(i)&&!this._compare(i,t))return!1}return!0}sort(){const t=[];for(;0!==this.size;){const e=this.poll();e&&t.push(e)}return t}DFS(t){const e=[],i=r=>{var s,n,o;const h=this._getLeft(r),l=this._getRight(r);switch(t){case"in":this._isValidIndex(h)&&i(h),e.push(null!==(s=this.nodes[r])&&void 0!==s?s:null),this._isValidIndex(l)&&i(l);break;case"pre":e.push(null!==(n=this.nodes[r])&&void 0!==n?n:null),this._isValidIndex(h)&&i(h),this._isValidIndex(l)&&i(l);break;case"post":this._isValidIndex(h)&&i(h),this._isValidIndex(l)&&i(l),e.push(null!==(o=this.nodes[r])&&void 0!==o?o:null)}};return this._isValidIndex(0)&&i(0),e}_setNodes(t){this._nodes=t}_compare(t,e){return this._comparator(this.nodes[t],this.nodes[e])>0}_swap(t,e){const i=this.nodes[t];this.nodes[t]=this.nodes[e],this.nodes[e]=i}_isValidIndex(t){return t>-1&&t<this.nodes.length}_getParent(t){return Math.floor((t-1)/2)}_getLeft(t){return 2*t+1}_getRight(t){return 2*t+2}_getComparedChild(t){let e=t;const i=this._getLeft(t),r=this._getRight(t);return i<this.size&&this._compare(e,i)&&(e=i),r<this.size&&this._compare(e,r)&&(e=r),e}_heapifyUp(t){for(;t>0&&this._compare(this._getParent(t),t);){const e=this._getParent(t);this._swap(t,e),t=e}}_heapifyDown(t){let e=this._getComparedChild(t);for(;this._compare(t,e);)this._swap(e,t),t=e,e=this._getComparedChild(t)}_fix(){for(let t=Math.floor(this.size/2);t>-1;t--)this._heapifyDown(t)}}e.PriorityQueue=i},7569:(t,e,i)=>{Object.defineProperty(e,"__esModule",{value:!0}),e.ArrayDeque=e.ObjectDeque=e.Deque=void 0;const r=i(2324);class s extends r.DoublyLinkedList{}e.Deque=s,e.ObjectDeque=class{constructor(t){this._nodes={},this._capacity=Number.MAX_SAFE_INTEGER,this._first=-1,this._last=-1,this._size=0,void 0!==t&&(this._capacity=t)}get nodes(){return this._nodes}get capacity(){return this._capacity}set capacity(t){this._capacity=t}get first(){return this._first}set first(t){this._first=t}get last(){return this._last}set last(t){this._last=t}get size(){return this._size}addFirst(t){if(0===this._size){const t=Math.floor(this._capacity/2);this._first=t,this._last=t}else this._first--;this._nodes[this._first]=t,this._size++}addLast(t){if(0===this._size){const t=Math.floor(this._capacity/2);this._first=t,this._last=t}else this._last++;this._nodes[this._last]=t,this._size++}pollFirst(){if(!this._size)return;const t=this.peekFirst();return delete this._nodes[this._first],this._first++,this._size--,t}peekFirst(){if(this._size)return this._nodes[this._first]}pollLast(){if(!this._size)return;const t=this.peekLast();return delete this._nodes[this._last],this._last--,this._size--,t}peekLast(){if(this._size)return this._nodes[this._last]}get(t){return this._nodes[this._first+t]||null}isEmpty(){return this._size<=0}_seNodes(t){this._nodes=t}_setSize(t){this._size=t}},e.ArrayDeque=class{constructor(){this._nodes=[]}get size(){return this._nodes.length}addLast(t){return this._nodes.push(t)}pollLast(){var t;return null!==(t=this._nodes.pop())&&void 0!==t?t:null}pollFirst(){var t;return null!==(t=this._nodes.shift())&&void 0!==t?t:null}addFirst(t){return this._nodes.unshift(t)}peekFirst(){var t;return null!==(t=this._nodes[0])&&void 0!==t?t:null}peekLast(){var t;return null!==(t=this._nodes[this._nodes.length-1])&&void 0!==t?t:null}get(t){var e;return null!==(e=this._nodes[t])&&void 0!==e?e:null}set(t,e){return this._nodes[t]=e}insert(t,e){return this._nodes.splice(t,0,e)}remove(t){return this._nodes.splice(t,1)}isEmpty(){return 0===this._nodes.length}}},2627:function(t,e,i){var r=this&&this.__createBinding||(Object.create?function(t,e,i,r){void 0===r&&(r=i);var s=Object.getOwnPropertyDescriptor(e,i);s&&!("get"in s?!e.__esModule:s.writable||s.configurable)||(s={enumerable:!0,get:function(){return e[i]}}),Object.defineProperty(t,r,s)}:function(t,e,i,r){void 0===r&&(r=i),t[r]=e[i]}),s=this&&this.__exportStar||function(t,e){for(var i in t)"default"===i||Object.prototype.hasOwnProperty.call(e,i)||r(e,t,i)};Object.defineProperty(e,"__esModule",{value:!0}),s(i(3295),e),s(i(7569),e)},3295:(t,e)=>{Object.defineProperty(e,"__esModule",{value:!0}),e.Queue=void 0;class i{constructor(t){this._nodes=t||[],this._offset=0}static fromArray(t){return new i(t)}add(t){return this._nodes.push(t),this}poll(){if(0===this.size())return null;const t=this.peek();return this._offset+=1,2*this._offset<this._nodes.length||(this._nodes=this._nodes.slice(this._offset),this._offset=0),t}peek(){return this.size()>0?this._nodes[this._offset]:null}peekLast(){return this.size()>0?this._nodes[this._nodes.length-1]:null}size(){return this._nodes.length-this._offset}isEmpty(){return 0===this.size()}toArray(){return this._nodes.slice(this._offset)}clear(){this._nodes=[],this._offset=0}clone(){return new i(this._nodes.slice(this._offset))}}e.Queue=i},9509:function(t,e,i){var r=this&&this.__createBinding||(Object.create?function(t,e,i,r){void 0===r&&(r=i);var s=Object.getOwnPropertyDescriptor(e,i);s&&!("get"in s?!e.__esModule:s.writable||s.configurable)||(s={enumerable:!0,get:function(){return e[i]}}),Object.defineProperty(t,r,s)}:function(t,e,i,r){void 0===r&&(r=i),t[r]=e[i]}),s=this&&this.__exportStar||function(t,e){for(var i in t)"default"===i||Object.prototype.hasOwnProperty.call(e,i)||r(e,t,i)};Object.defineProperty(e,"__esModule",{value:!0}),s(i(6006),e)},6006:(t,e)=>{Object.defineProperty(e,"__esModule",{value:!0}),e.Stack=void 0;class i{constructor(t){this._elements=Array.isArray(t)?t:[]}static fromArray(t){return new i(t)}isEmpty(){return 0===this._elements.length}size(){return this._elements.length}peek(){return this.isEmpty()?null:this._elements[this._elements.length-1]}push(t){return this._elements.push(t),this}pop(){return this.isEmpty()?null:this._elements.pop()||null}toArray(){return this._elements.slice()}clear(){this._elements=[]}clone(){return new i(this._elements.slice())}}e.Stack=i},8456:function(t,e,i){var r=this&&this.__createBinding||(Object.create?function(t,e,i,r){void 0===r&&(r=i);var s=Object.getOwnPropertyDescriptor(e,i);s&&!("get"in s?!e.__esModule:s.writable||s.configurable)||(s={enumerable:!0,get:function(){return e[i]}}),Object.defineProperty(t,r,s)}:function(t,e,i,r){void 0===r&&(r=i),t[r]=e[i]}),s=this&&this.__exportStar||function(t,e){for(var i in t)"default"===i||Object.prototype.hasOwnProperty.call(e,i)||r(e,t,i)};Object.defineProperty(e,"__esModule",{value:!0}),s(i(301),e)},301:(t,e)=>{Object.defineProperty(e,"__esModule",{value:!0}),e.TreeNode=void 0;class i{constructor(t,e,i){this._id=t,this._value=e||void 0,this._children=i||[]}get id(){return this._id}set id(t){this._id=t}get value(){return this._value}set value(t){this._value=t}get children(){return this._children}set children(t){this._children=t}addChildren(t){this.children||(this.children=[]),t instanceof i?this.children.push(t):this.children=this.children.concat(t)}getHeight(){const t=this;let e=1;if(t){const i=(t,r)=>{r>e&&(e=r);const{children:s}=t;if(s)for(let t=0,e=s.length;t<e;t++)i(s[t],r+1)};i(t,1)}return e}}e.TreeNode=i},3543:function(t,e,i){var r=this&&this.__createBinding||(Object.create?function(t,e,i,r){void 0===r&&(r=i);var s=Object.getOwnPropertyDescriptor(e,i);s&&!("get"in s?!e.__esModule:s.writable||s.configurable)||(s={enumerable:!0,get:function(){return e[i]}}),Object.defineProperty(t,r,s)}:function(t,e,i,r){void 0===r&&(r=i),t[r]=e[i]}),s=this&&this.__exportStar||function(t,e){for(var i in t)"default"===i||Object.prototype.hasOwnProperty.call(e,i)||r(e,t,i)};Object.defineProperty(e,"__esModule",{value:!0}),s(i(2952),e)},2952:(t,e)=>{Object.defineProperty(e,"__esModule",{value:!0}),e.Trie=e.TrieNode=void 0;class i{constructor(t){this._val=t,this._isEnd=!1,this._children=new Map}get val(){return this._val}set val(t){this._val=t}get children(){return this._children}set children(t){this._children=t}get isEnd(){return this._isEnd}set isEnd(t){this._isEnd=t}}e.TrieNode=i,e.Trie=class{constructor(t){if(this._root=new i(""),t)for(const e of t)this.add(e)}get root(){return this._root}set root(t){this._root=t}add(t){let e=this._root;for(const r of t){let t=e.children.get(r);t||(t=new i(r),e.children.set(r,t)),e=t}return e.isEnd=!0,!0}has(t){let e=this._root;for(const i of t){const t=e.children.get(i);if(!t)return!1;e=t}return e.isEnd}remove(t){let e=!1;const i=(r,s)=>{const n=t[s],o=r.children.get(n);return!!o&&(s===t.length-1?!!o.isEnd&&(o.children.size>0?o.isEnd=!1:r.children.delete(n),e=!0,!0):!(!i(o,s+1)||r.isEnd||0!==o.children.size||(r.children.delete(n),0)))};return i(this.root,0),e}isAbsPrefix(t){let e=this._root;for(const i of t){const t=e.children.get(i);if(!t)return!1;e=t}return!e.isEnd}isPrefix(t){let e=this._root;for(const i of t){const t=e.children.get(i);if(!t)return!1;e=t}return!0}isCommonPrefix(t){let e="";const i=r=>{e+=r.val,e!==t&&(r.isEnd||r&&r.children&&1===r.children.size&&i(Array.from(r.children.values())[0]))};return i(this._root),e===t}getLongestCommonPrefix(){let t="";const e=i=>{t+=i.val,i.isEnd||i&&i.children&&1===i.children.size&&e(Array.from(i.children.values())[0])};return e(this._root),t}getAll(t=""){const e=[];let i=this._root;if(t)for(const e of t){const t=i.children.get(e);t&&(i=t)}return function t(i,r){for(const e of i.children.keys()){const s=i.children.get(e);void 0!==s&&t(s,r.concat(e))}i.isEnd&&e.push(r)}(i,t),e}}},3607:function(t,e,i){var r=this&&this.__createBinding||(Object.create?function(t,e,i,r){void 0===r&&(r=i);var s=Object.getOwnPropertyDescriptor(e,i);s&&!("get"in s?!e.__esModule:s.writable||s.configurable)||(s={enumerable:!0,get:function(){return e[i]}}),Object.defineProperty(t,r,s)}:function(t,e,i,r){void 0===r&&(r=i),t[r]=e[i]}),s=this&&this.__exportStar||function(t,e){for(var i in t)"default"===i||Object.prototype.hasOwnProperty.call(e,i)||r(e,t,i)};Object.defineProperty(e,"__esModule",{value:!0}),s(i(4866),e),s(i(5928),e),s(i(1247),e),s(i(1230),e)},8709:(t,e)=>{Object.defineProperty(e,"__esModule",{value:!0})},1278:(t,e)=>{Object.defineProperty(e,"__esModule",{value:!0})},31:(t,e)=>{Object.defineProperty(e,"__esModule",{value:!0})},3108:(t,e)=>{Object.defineProperty(e,"__esModule",{value:!0})},257:(t,e)=>{Object.defineProperty(e,"__esModule",{value:!0})},1265:(t,e)=>{Object.defineProperty(e,"__esModule",{value:!0})},4477:(t,e)=>{Object.defineProperty(e,"__esModule",{value:!0})},2338:(t,e)=>{Object.defineProperty(e,"__esModule",{value:!0})},1247:function(t,e,i){var r=this&&this.__createBinding||(Object.create?function(t,e,i,r){void 0===r&&(r=i);var s=Object.getOwnPropertyDescriptor(e,i);s&&!("get"in s?!e.__esModule:s.writable||s.configurable)||(s={enumerable:!0,get:function(){return e[i]}}),Object.defineProperty(t,r,s)}:function(t,e,i,r){void 0===r&&(r=i),t[r]=e[i]}),s=this&&this.__exportStar||function(t,e){for(var i in t)"default"===i||Object.prototype.hasOwnProperty.call(e,i)||r(e,t,i)};Object.defineProperty(e,"__esModule",{value:!0}),s(i(8709),e),s(i(1278),e),s(i(31),e),s(i(3108),e),s(i(257),e),s(i(1265),e),s(i(4477),e),s(i(2338),e),s(i(8447),e),s(i(5785),e),s(i(7906),e),s(i(8759),e),s(i(2354),e),s(i(1515),e),s(i(9355),e)},8447:(t,e)=>{Object.defineProperty(e,"__esModule",{value:!0})},5785:(t,e)=>{Object.defineProperty(e,"__esModule",{value:!0})},7906:(t,e)=>{Object.defineProperty(e,"__esModule",{value:!0})},8759:(t,e)=>{Object.defineProperty(e,"__esModule",{value:!0})},2354:(t,e)=>{Object.defineProperty(e,"__esModule",{value:!0})},1515:(t,e)=>{Object.defineProperty(e,"__esModule",{value:!0})},9355:(t,e)=>{Object.defineProperty(e,"__esModule",{value:!0})},5177:(t,e)=>{var i,r;Object.defineProperty(e,"__esModule",{value:!0}),e.FamilyPosition=e.LoopType=void 0,(r=e.LoopType||(e.LoopType={})).ITERATIVE="ITERATIVE",r.RECURSIVE="RECURSIVE",(i=e.FamilyPosition||(e.FamilyPosition={})).ROOT="ROOT",i.LEFT="LEFT",i.RIGHT="RIGHT",i.ROOT_LEFT="ROOT_LEFT",i.ROOT_RIGHT="ROOT_RIGHT",i.ISOLATED="ISOLATED",i.MAL_NODE="MAL_NODE"},4086:(t,e)=>{Object.defineProperty(e,"__esModule",{value:!0})},6603:(t,e)=>{Object.defineProperty(e,"__esModule",{value:!0})},2697:(t,e)=>{Object.defineProperty(e,"__esModule",{value:!0})},8222:(t,e)=>{var i;Object.defineProperty(e,"__esModule",{value:!0}),e.CP=void 0,(i=e.CP||(e.CP={})).lt="lt",i.eq="eq",i.gt="gt"},9388:(t,e)=>{var i;Object.defineProperty(e,"__esModule",{value:!0}),e.TopologicalProperty=void 0,(i=e.TopologicalProperty||(e.TopologicalProperty={})).VAL="VAL",i.NODE="NODE",i.ID="ID"},2835:(t,e)=>{Object.defineProperty(e,"__esModule",{value:!0})},8839:(t,e)=>{Object.defineProperty(e,"__esModule",{value:!0})},8720:function(t,e,i){var r=this&&this.__createBinding||(Object.create?function(t,e,i,r){void 0===r&&(r=i);var s=Object.getOwnPropertyDescriptor(e,i);s&&!("get"in s?!e.__esModule:s.writable||s.configurable)||(s={enumerable:!0,get:function(){return e[i]}}),Object.defineProperty(t,r,s)}:function(t,e,i,r){void 0===r&&(r=i),t[r]=e[i]}),s=this&&this.__exportStar||function(t,e){for(var i in t)"default"===i||Object.prototype.hasOwnProperty.call(e,i)||r(e,t,i)};Object.defineProperty(e,"__esModule",{value:!0}),s(i(2697),e),s(i(8222),e),s(i(6603),e),s(i(8542),e),s(i(3360),e),s(i(4086),e),s(i(6896),e),s(i(5177),e),s(i(1001),e),s(i(9388),e),s(i(1307),e),s(i(8839),e),s(i(6954),e),s(i(2835),e),s(i(4716),e)},6896:(t,e)=>{Object.defineProperty(e,"__esModule",{value:!0})},4716:(t,e)=>{Object.defineProperty(e,"__esModule",{value:!0})},1307:(t,e)=>{Object.defineProperty(e,"__esModule",{value:!0})},1001:(t,e)=>{var i;Object.defineProperty(e,"__esModule",{value:!0}),e.RBColor=void 0,(i=e.RBColor||(e.RBColor={})).RED="RED",i.BLACK="BLACK"},8542:(t,e)=>{Object.defineProperty(e,"__esModule",{value:!0})},6954:(t,e)=>{Object.defineProperty(e,"__esModule",{value:!0})},3360:(t,e)=>{Object.defineProperty(e,"__esModule",{value:!0})},5268:(t,e)=>{Object.defineProperty(e,"__esModule",{value:!0})},1230:function(t,e,i){var r=this&&this.__createBinding||(Object.create?function(t,e,i,r){void 0===r&&(r=i);var s=Object.getOwnPropertyDescriptor(e,i);s&&!("get"in s?!e.__esModule:s.writable||s.configurable)||(s={enumerable:!0,get:function(){return e[i]}}),Object.defineProperty(t,r,s)}:function(t,e,i,r){void 0===r&&(r=i),t[r]=e[i]}),s=this&&this.__exportStar||function(t,e){for(var i in t)"default"===i||Object.prototype.hasOwnProperty.call(e,i)||r(e,t,i)};Object.defineProperty(e,"__esModule",{value:!0}),s(i(8720),e),s(i(5268),e),s(i(9963),e)},9963:function(t,e,i){var r=this&&this.__createBinding||(Object.create?function(t,e,i,r){void 0===r&&(r=i);var s=Object.getOwnPropertyDescriptor(e,i);s&&!("get"in s?!e.__esModule:s.writable||s.configurable)||(s={enumerable:!0,get:function(){return e[i]}}),Object.defineProperty(t,r,s)}:function(t,e,i,r){void 0===r&&(r=i),t[r]=e[i]}),s=this&&this.__exportStar||function(t,e){for(var i in t)"default"===i||Object.prototype.hasOwnProperty.call(e,i)||r(e,t,i)};Object.defineProperty(e,"__esModule",{value:!0}),s(i(6016),e),s(i(6706),e)},6016:(t,e)=>{Object.defineProperty(e,"__esModule",{value:!0})},6706:(t,e)=>{Object.defineProperty(e,"__esModule",{value:!0})},5928:function(t,e,i){var r=this&&this.__createBinding||(Object.create?function(t,e,i,r){void 0===r&&(r=i);var s=Object.getOwnPropertyDescriptor(e,i);s&&!("get"in s?!e.__esModule:s.writable||s.configurable)||(s={enumerable:!0,get:function(){return e[i]}}),Object.defineProperty(t,r,s)}:function(t,e,i,r){void 0===r&&(r=i),t[r]=e[i]}),s=this&&this.__exportStar||function(t,e){for(var i in t)"default"===i||Object.prototype.hasOwnProperty.call(e,i)||r(e,t,i)};Object.defineProperty(e,"__esModule",{value:!0}),s(i(974),e)},974:function(t,e){var i=this&&this.__awaiter||function(t,e,i,r){return new(i||(i=Promise))((function(s,n){function o(t){try{l(r.next(t))}catch(t){n(t)}}function h(t){try{l(r.throw(t))}catch(t){n(t)}}function l(t){var e;t.done?s(t.value):(e=t.value,e instanceof i?e:new i((function(t){t(e)}))).then(o,h)}l((r=r.apply(t,e||[])).next())}))};Object.defineProperty(e,"__esModule",{value:!0}),e.trampolineAsync=e.trampoline=e.toThunk=e.isThunk=e.THUNK_SYMBOL=e.arrayRemove=e.uuidV4=void 0,e.uuidV4=function(){return"xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx".replace(/[x]/g,(function(t){const e=16*Math.random()|0;return("x"==t?e:3&e|8).toString(16)}))},e.arrayRemove=function(t,e){let i=-1,r=t?t.length:0;const s=[];for(;++i<r;){const n=t[i];e(n,i,t)&&(s.push(n),Array.prototype.splice.call(t,i--,1),r--)}return s},e.THUNK_SYMBOL=Symbol("thunk"),e.isThunk=t=>"function"==typeof t&&t.__THUNK__===e.THUNK_SYMBOL,e.toThunk=t=>{const i=()=>t();return i.__THUNK__=e.THUNK_SYMBOL,i},e.trampoline=t=>Object.assign(((...i)=>{let r=t(...i);for(;(0,e.isThunk)(r)&&"function"==typeof r;)r=r();return r}),{cont:(...i)=>(0,e.toThunk)((()=>t(...i)))}),e.trampolineAsync=t=>Object.assign(((...r)=>i(void 0,void 0,void 0,(function*(){let i=yield t(...r);for(;(0,e.isThunk)(i)&&"function"==typeof i;)i=yield i();return i}))),{cont:(...i)=>(0,e.toThunk)((()=>t(...i)))})}},e={},i=function i(r){var s=e[r];if(void 0!==s)return s.exports;var n=e[r]={exports:{}};return t[r].call(n.exports,n,n.exports,i),n.exports}(3607);window.dataStructureTyped=i})();
|
|
@@ -5,9 +5,9 @@
|
|
|
5
5
|
* @copyright Copyright (c) 2022 Tyler Zeng <zrwusa@gmail.com>
|
|
6
6
|
* @license MIT License
|
|
7
7
|
*/
|
|
8
|
-
import type { AbstractBinaryTreeNodeNested, AbstractBinaryTreeNodeProperties, BinaryTreeDeletedResult, BinaryTreeNodeId, BinaryTreeNodePropertyName, DFSOrderPattern, NodeOrPropertyName } from '
|
|
9
|
-
import { AbstractBinaryTreeOptions, FamilyPosition, LoopType } from '
|
|
10
|
-
import { IAbstractBinaryTree, IAbstractBinaryTreeNode } from '
|
|
8
|
+
import type { AbstractBinaryTreeNodeNested, AbstractBinaryTreeNodeProperties, BinaryTreeDeletedResult, BinaryTreeNodeId, BinaryTreeNodePropertyName, DFSOrderPattern, NodeOrPropertyName } from '../../types';
|
|
9
|
+
import { AbstractBinaryTreeOptions, FamilyPosition, LoopType } from '../../types';
|
|
10
|
+
import { IAbstractBinaryTree, IAbstractBinaryTreeNode } from '../../interfaces';
|
|
11
11
|
export declare abstract class AbstractBinaryTreeNode<T = any, NEIGHBOR extends AbstractBinaryTreeNode<T, NEIGHBOR> = AbstractBinaryTreeNodeNested<T>> implements IAbstractBinaryTreeNode<T, NEIGHBOR> {
|
|
12
12
|
/**
|
|
13
13
|
* The constructor function initializes a BinaryTreeNode object with an id and an optional value.
|
|
@@ -9,7 +9,7 @@
|
|
|
9
9
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
10
10
|
exports.AbstractBinaryTree = exports.AbstractBinaryTreeNode = void 0;
|
|
11
11
|
const utils_1 = require("../../utils");
|
|
12
|
-
const types_1 = require("
|
|
12
|
+
const types_1 = require("../../types");
|
|
13
13
|
class AbstractBinaryTreeNode {
|
|
14
14
|
/**
|
|
15
15
|
* The constructor function initializes a BinaryTreeNode object with an id and an optional value.
|
|
@@ -6,8 +6,8 @@
|
|
|
6
6
|
* @license MIT License
|
|
7
7
|
*/
|
|
8
8
|
import { BST, BSTNode } from './bst';
|
|
9
|
-
import type { AVLTreeNodeNested, AVLTreeOptions, BinaryTreeDeletedResult, BinaryTreeNodeId } from '
|
|
10
|
-
import { IAVLTree, IAVLTreeNode } from '
|
|
9
|
+
import type { AVLTreeNodeNested, AVLTreeOptions, BinaryTreeDeletedResult, BinaryTreeNodeId } from '../../types';
|
|
10
|
+
import { IAVLTree, IAVLTreeNode } from '../../interfaces';
|
|
11
11
|
export declare class AVLTreeNode<T = any, NEIGHBOR extends AVLTreeNode<T, NEIGHBOR> = AVLTreeNodeNested<T>> extends BSTNode<T, NEIGHBOR> implements IAVLTreeNode<T, NEIGHBOR> {
|
|
12
12
|
constructor(id: BinaryTreeNodeId, val?: T);
|
|
13
13
|
}
|