New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

parsegraph-extent

Package Overview
Dependencies
Maintainers
2
Versions
28
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

parsegraph-extent - npm Package Compare versions

Comparing version 1.4.16-dev to 1.4.16

884

parsegraph-extent/dist/src/index.js

@@ -1,884 +0,2 @@

(function webpackUniversalModuleDefinition(root, factory) {
if(typeof exports === 'object' && typeof module === 'object')
module.exports = factory();
else if(typeof define === 'function' && define.amd)
define([], factory);
else if(typeof exports === 'object')
exports["parsegraph_extent"] = factory();
else
root["parsegraph_extent"] = factory();
})(this, () => {
return /******/ (() => { // webpackBootstrap
/******/ var __webpack_modules__ = ({
/***/ "./src/Extent.ts":
/*!***********************!*\
!*** ./src/Extent.ts ***!
\***********************/
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
"use strict";
__webpack_require__.r(__webpack_exports__);
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
/* harmony export */ "default": () => (__WEBPACK_DEFAULT_EXPORT__)
/* harmony export */ });
/* harmony import */ var parsegraph_gettimeinmillis__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! parsegraph-gettimeinmillis */ "./node_modules/parsegraph-gettimeinmillis/dist/src/index.js");
/* harmony import */ var parsegraph_gettimeinmillis__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(parsegraph_gettimeinmillis__WEBPACK_IMPORTED_MODULE_0__);
/* harmony import */ var parsegraph_fuzzyequals__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! parsegraph-fuzzyequals */ "./node_modules/parsegraph-fuzzyequals/dist/src/index.js");
/* harmony import */ var parsegraph_fuzzyequals__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(parsegraph_fuzzyequals__WEBPACK_IMPORTED_MODULE_1__);
/* harmony import */ var _ExtentSeparator__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./ExtentSeparator */ "./src/ExtentSeparator.ts");
/* harmony import */ var _ExtentCombiner__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./ExtentCombiner */ "./src/ExtentCombiner.ts");
var DEFAULT_EXTENT_BOUNDS = 1;
var NUM_EXTENT_BOUND_COMPONENTS = 2;
var SEPARATION_TIMEOUT_MS = 10000;
var Extent = /** @class */function () {
function Extent(copy) {
if (copy !== undefined && copy._bounds) {
this._offset = copy._offset;
this._numBounds = copy._numBounds;
this._bounds = new Float32Array(copy._bounds);
this._start = copy._start;
if (copy._minSize !== null) {
this._minSize = copy._minSize;
this._maxSize = copy._maxSize;
this._totalLength = copy._totalLength;
}
} else {
this._start = 0;
this._offset = 0;
this._numBounds = 0;
this._bounds = null;
this._minSize = null;
this._maxSize = null;
this._totalLength = null;
}
}
Extent.prototype.setOffset = function (offset) {
this._offset = offset;
};
Extent.prototype.offset = function () {
return this._offset;
};
Extent.prototype.forEach = function (func, thisArg) {
if (arguments.length === 1 || thisArg === undefined) {
thisArg = this;
}
for (var i = 0; i < this._numBounds; ++i) {
func.call(thisArg, this.boundLengthAt(i), this.boundSizeAt(i), i);
}
};
Extent.prototype.clone = function () {
return new Extent(this);
};
Extent.prototype.clear = function () {
this._numBounds = 0;
this.invalidateBoundingValues();
};
Extent.prototype.numBounds = function () {
return this._numBounds;
};
Extent.prototype.hasBounds = function () {
return this.numBounds() > 0;
};
Extent.prototype.boundLengthAt = function (index) {
return this._bounds[NUM_EXTENT_BOUND_COMPONENTS * ((this._start + index) % this.boundCapacity())];
};
Extent.prototype.boundSizeAt = function (index) {
return this._bounds[NUM_EXTENT_BOUND_COMPONENTS * ((this._start + index) % this.boundCapacity()) + 1];
};
Extent.prototype.invalidateBoundingValues = function () {
this._minSize = null;
this._maxSize = null;
this._totalLength = null;
};
Extent.prototype.setBoundLengthAt = function (index, length) {
this._bounds[NUM_EXTENT_BOUND_COMPONENTS * ((this._start + index) % this.boundCapacity())] = length;
this.invalidateBoundingValues();
};
Extent.prototype.setBoundSizeAt = function (index, size) {
this._bounds[NUM_EXTENT_BOUND_COMPONENTS * ((this._start + index) % this.boundCapacity()) + 1] = size;
this.invalidateBoundingValues();
};
Extent.prototype.realloc = function (capacity) {
if (capacity < DEFAULT_EXTENT_BOUNDS) {
capacity = DEFAULT_EXTENT_BOUNDS;
}
var oldBounds = this._bounds;
var oldCap = this.boundCapacity();
if (oldCap >= capacity) {
// TODO This could shrink.
throw new Error("Cannot shrink Extent capacity");
}
// Change the capacity.
this._bounds = new Float32Array(NUM_EXTENT_BOUND_COMPONENTS * capacity);
if (oldBounds) {
if (this._start + this._numBounds > oldCap) {
var frontBounds = this._start + this._numBounds - oldCap;
// TODO See if this can be copied more efficiently, and if that matters.
for (var i = 0; i < NUM_EXTENT_BOUND_COMPONENTS * (this._numBounds - frontBounds); ++i) {
this._bounds[i] = oldBounds[this._start + i];
}
for (var i = 0; i < NUM_EXTENT_BOUND_COMPONENTS * (this._numBounds - frontBounds); ++i) {
this._bounds[this._numBounds - frontBounds + i] = oldBounds[i];
}
} else {
// Can do it in a single copy.
for (var i = 0; i < NUM_EXTENT_BOUND_COMPONENTS * this._numBounds; ++i) {
this._bounds[i] = oldBounds[this._start + i];
}
}
// console.log(oldBounds, "to", this._bounds);
}
this._start = 0;
return 0;
};
Extent.prototype.prependLS = function (length, size) {
if (isNaN(length)) {
throw new Error("Length must not be NaN");
}
if (length == 0) {
// Drop empty lengths.
return;
}
// Do not allow negative length values.
if (length < 0) {
var str = "Non-positive bound lengths are not allowed, but " + length + " was given anyway.";
throw new Error(str);
}
if (this.numBounds() > 0) {
var frontSize = this.boundSizeAt(0);
if (Number.isNaN(frontSize) && Number.isNaN(size) || frontSize === size) {
// Extent the first bound.
this.setBoundLengthAt(0, this.boundLengthAt(0) + length);
return;
}
}
if (this.boundCapacity() == this.numBounds()) {
// Completely full, so expand.
var newCap = DEFAULT_EXTENT_BOUNDS;
if (this.boundCapacity() > 0) {
newCap = 2 * this.boundCapacity();
}
this.realloc(newCap);
}
if (this._start == 0) {
this._start = this.boundCapacity() - 1;
} else {
--this._start;
}
++this._numBounds;
this.setBoundLengthAt(0, length);
this.setBoundSizeAt(0, size);
};
Extent.prototype.boundCapacity = function () {
if (!this._bounds) {
return 0;
}
return this._bounds.length / NUM_EXTENT_BOUND_COMPONENTS;
};
Extent.prototype.appendLS = function (length, size) {
if (isNaN(length)) {
throw new Error("Length must not be NaN");
}
if (length === 0) {
// Drop empty lengths.
return;
}
if (length < 0) {
var str = "Non-positive bound lengths are not allowed, but " + length + " was given anyway.";
throw new Error(str);
}
if (this.numBounds() > 0) {
var lastSize = this.boundSizeAt(this.numBounds() - 1);
if (isNaN(lastSize) && isNaN(size) || lastSize === size) {
this.setBoundLengthAt(this.numBounds() - 1, this.boundLengthAt(this.numBounds() - 1) + length);
return;
}
}
if (this.boundCapacity() == this.numBounds()) {
// Completely full, so expand.
var newCap = DEFAULT_EXTENT_BOUNDS;
if (this.boundCapacity() > 0) {
newCap = 2 * this.boundCapacity();
}
this.realloc(newCap);
}
++this._numBounds;
this.setBoundLengthAt(this.numBounds() - 1, length);
this.setBoundSizeAt(this.numBounds() - 1, size);
};
Extent.prototype.prependSL = function (size, length) {
this.prependLS(length, size);
};
Extent.prototype.appendSL = function (size, length) {
this.appendLS(length, size);
};
Extent.prototype.adjustSize = function (adjustment) {
// Adjust the size of each bound.
for (var i = 0; i < this.numBounds(); ++i) {
var size = this.boundSizeAt(i);
// Ignore empty sizes.
if (!isNaN(size)) {
this.setBoundSizeAt(i, size + adjustment);
}
}
};
Extent.prototype.simplify = function () {
var totalLength = 0;
var maxSize = NaN;
for (var i = 0; i < this.numBounds(); ++i) {
totalLength += this.boundLengthAt(i);
var size = this.boundSizeAt(i);
if (isNaN(maxSize)) {
maxSize = size;
} else if (!isNaN(size)) {
maxSize = Math.max(maxSize, size);
}
}
this.clear();
this.appendLS(totalLength, maxSize);
};
Extent.prototype.sizeAt = function (offset) {
// Do not allow negative offsets.
if (offset < 0) {
throw new Error("OFFSET_IS_NEGATIVE");
}
// Determine the bound at the given offset.
var pos = 0;
var i = 0;
while (i < this.numBounds()) {
var thisBoundLength = this.boundLengthAt(i);
if (offset <= pos + thisBoundLength) {
break;
}
pos += thisBoundLength;
++i;
}
// Return NaN if the offset is beyond the full size of this extent.
if (i == this.numBounds()) {
return NaN;
}
// Return the size at the determined bound.
return this.boundSizeAt(i);
};
Extent.prototype.combineBound = function (newBoundStart, newBoundLength, newBoundSize) {
// Create the extent to be merged.
var added = new Extent();
added.appendLS(newBoundLength, newBoundSize);
// Copy the combined result into this extent.
this.copyFrom(this.combinedExtent(added, newBoundStart));
};
Extent.prototype.copyFrom = function (from) {
this._numBounds = from._numBounds;
this._bounds = from._bounds;
from.clear();
this.invalidateBoundingValues();
};
Extent.prototype.combineExtentAndSimplify = function (given, lengthAdjustment, sizeAdjustment, scale, bv) {
if (!bv) {
bv = [null, null, null];
}
given.boundingValues(bv);
var givenLength = bv[0];
var givenMaxSize = bv[2];
this.boundingValues(bv);
var thisLength = bv[0];
var thisMaxSize = bv[2];
this.clear();
var combinedLength;
if (lengthAdjustment < 0) {
combinedLength = Math.max(thisLength - lengthAdjustment, givenLength * scale);
} else {
combinedLength = Math.max(thisLength, givenLength * scale + lengthAdjustment);
}
this.appendLS(combinedLength, Math.max(thisMaxSize, givenMaxSize * scale + sizeAdjustment));
};
Extent.prototype.combineExtent = function (given, lengthAdjustment, sizeAdjustment, scale) {
// Combine the extent into this one, creating a new extent in the process.
var result = this.combinedExtent(given, lengthAdjustment, sizeAdjustment, scale);
// Copy the combined result into this extent.
this.copyFrom(result);
};
Extent.prototype.combinedExtent = function (given, lengthAdjustment, sizeAdjustment, scale) {
if (lengthAdjustment === undefined) {
lengthAdjustment = 0;
}
if (sizeAdjustment === undefined) {
sizeAdjustment = 0;
}
if (scale === undefined) {
scale = 1.0;
}
if (lengthAdjustment < 0) {
var result = given.combinedExtent(this, -lengthAdjustment / scale, -sizeAdjustment / scale, 1 / scale);
result.scale(scale);
result.adjustSize(sizeAdjustment);
return result;
} else if (lengthAdjustment > 0) {
// We have a length adjustment.
var givenCopy = given.clone();
givenCopy.prependLS(lengthAdjustment / scale, NaN);
return this.combinedExtent(givenCopy, 0, sizeAdjustment, scale);
}
return new _ExtentCombiner__WEBPACK_IMPORTED_MODULE_3__["default"](this, given, lengthAdjustment, sizeAdjustment, scale).combine();
};
Extent.prototype.scale = function (factor) {
this.forEach(function (length, size, i) {
this.setBoundLengthAt(i, length * factor);
if (!isNaN(this.boundSizeAt(i))) {
this.setBoundSizeAt(i, size * factor);
}
}, this);
};
Extent.prototype.separation = function (given, positionAdjustment, allowAxisOverlap, givenScale, axisMinimum) {
if (positionAdjustment === undefined) {
positionAdjustment = 0;
}
if (allowAxisOverlap === undefined) {
allowAxisOverlap = true;
}
if (axisMinimum === undefined) {
axisMinimum = 0;
}
if (givenScale === undefined) {
givenScale = 1.0;
}
// console.log("Separation(positionAdjustment=" + positionAdjustment + ")");
var separator = new _ExtentSeparator__WEBPACK_IMPORTED_MODULE_2__["default"](this, given, positionAdjustment, allowAxisOverlap, givenScale);
// extentSeparation is the minimum distance to separate this extent
// from the given extent, so that they do not overlap if facing one
// another.
var extentSeparation = 0;
// Adjust this extent's iterator to account for the position adjustment.
if (positionAdjustment < 0) {
while (!separator.givenAtEnd() && separator._givenPosition + separator.givenBoundLength() <= -positionAdjustment) {
// If we don't allow axis overlap, then be sure to include these bounds
// that are being skipped.
var boundSeparation = separator.givenBoundSize();
if (!allowAxisOverlap && !isNaN(boundSeparation) && boundSeparation > extentSeparation) {
extentSeparation = boundSeparation + axisMinimum;
}
separator.incrementGivenBound();
}
} else {
// Positive positionAdjustment.
while (!separator.thisAtEnd() && separator._thisPosition + this.boundLengthAt(separator._thisBound) <= positionAdjustment) {
var boundSeparation = separator.thisBoundSize();
if (!allowAxisOverlap && !isNaN(boundSeparation) && boundSeparation > extentSeparation) {
extentSeparation = boundSeparation;
}
separator.incrementThisBound();
}
}
extentSeparation = separator.consume(extentSeparation, axisMinimum);
if (!allowAxisOverlap) {
// Calculate the separation between the remaining bounds of given and
// the separation boundary.
var startTime = parsegraph_gettimeinmillis__WEBPACK_IMPORTED_MODULE_0___default()();
while (!separator.givenAtEnd()) {
if (parsegraph_gettimeinmillis__WEBPACK_IMPORTED_MODULE_0___default()() - startTime > SEPARATION_TIMEOUT_MS) {
throw new Error("Extent separation timed out");
}
var givenSize = given.boundSizeAt(separator._givenBound);
if (!isNaN(givenSize)) {
extentSeparation = Math.max(extentSeparation, givenScale * givenSize + axisMinimum);
}
++separator._givenBound;
}
}
return extentSeparation;
};
Extent.prototype.boundingValues = function (outVal) {
if (!outVal) {
outVal = [null, null, null];
}
if (this._minSize !== null) {
outVal[0] = this._totalLength;
outVal[1] = this._minSize;
outVal[2] = this._maxSize;
return outVal;
}
var totalLength = 0;
var minSize = NaN;
var maxSize = NaN;
for (var iter = 0; iter != this.numBounds(); ++iter) {
totalLength += this.boundLengthAt(iter);
var size = this.boundSizeAt(iter);
if (isNaN(minSize)) {
minSize = size;
} else if (!isNaN(size)) {
minSize = Math.min(minSize, size);
}
if (isNaN(maxSize)) {
maxSize = size;
} else if (!isNaN(size)) {
maxSize = Math.max(maxSize, size);
}
}
outVal[0] = totalLength;
outVal[1] = minSize;
outVal[2] = maxSize;
this._minSize = minSize;
this._maxSize = maxSize;
this._totalLength = totalLength;
return outVal;
};
Extent.prototype.equals = function (other, fuzziness) {
// Exit quickly if we are comparing with ourselves.
if (this === other) {
return true;
}
// Ensure the sizes match.
if (!other || this.numBounds() != other.numBounds()) {
return false;
}
// Compare the bounds for equality.
for (var i = 0; i < this.numBounds(); ++i) {
if (!parsegraph_fuzzyequals__WEBPACK_IMPORTED_MODULE_1___default()(this.boundLengthAt(i), other.boundLengthAt(i), fuzziness)) {
return false;
}
var thisSize = this.boundSizeAt(i);
var otherSize = other.boundSizeAt(i);
if (isNaN(thisSize) && isNaN(otherSize)) {
// Both NaN.
continue;
}
// Fail if one is NaN and the other is not.
if (isNaN(thisSize) || isNaN(otherSize)) {
return false;
}
if (!parsegraph_fuzzyequals__WEBPACK_IMPORTED_MODULE_1___default()(this.boundSizeAt(i), other.boundSizeAt(i))) {
return false;
}
}
return true;
};
Extent.prototype.dump = function (message) {
if (message !== undefined) {
console.log(message);
}
var offset = 0;
for (var i = 0; i < this.numBounds(); ++i) {
console.log("" + offset + ": [length=" + this.boundLengthAt(i) + ", size=" + this.boundSizeAt(i) + "]");
offset += this.boundLengthAt(i);
}
};
Extent.prototype.toDom = function (message) {
var rv = document.createElement("table");
rv.className = "Extent";
if (message !== undefined) {
var titleRow = document.createElement("tr");
rv.appendChild(titleRow);
titleRow.appendChild(document.createElement("th"));
titleRow.lastElementChild.innerHTML = message;
titleRow.lastElementChild.colSpan = 3;
}
var headerRow = document.createElement("tr");
rv.appendChild(headerRow);
headerRow.appendChild(document.createElement("th"));
headerRow.lastElementChild.innerHTML = "Offset";
headerRow.appendChild(document.createElement("th"));
headerRow.lastElementChild.innerHTML = "Length";
headerRow.appendChild(document.createElement("th"));
headerRow.lastElementChild.innerHTML = "Size";
var offset = 0;
for (var i = 0; i < this.numBounds(); ++i) {
var boundRow = document.createElement("tr");
rv.appendChild(boundRow);
boundRow.appendChild(document.createElement("td"));
boundRow.lastElementChild.innerHTML = "" + offset;
boundRow.appendChild(document.createElement("td"));
boundRow.lastElementChild.innerHTML = "" + this.boundLengthAt(i);
boundRow.appendChild(document.createElement("td"));
boundRow.lastElementChild.innerHTML = "" + this.boundSizeAt(i);
offset += this.boundLengthAt(i);
}
return rv;
};
return Extent;
}();
/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (Extent);
/***/ }),
/***/ "./src/ExtentCombiner.ts":
/*!*******************************!*\
!*** ./src/ExtentCombiner.ts ***!
\*******************************/
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
"use strict";
__webpack_require__.r(__webpack_exports__);
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
/* harmony export */ "default": () => (__WEBPACK_DEFAULT_EXPORT__)
/* harmony export */ });
/* harmony import */ var _Extent__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./Extent */ "./src/Extent.ts");
var ExtentSeparator = /** @class */function () {
function ExtentSeparator(thisExtent, givenExtent, lengthAdjustment, sizeAdjustment, scale) {
this._thisExtent = thisExtent;
this._givenExtent = givenExtent;
this._lengthAdjustment = lengthAdjustment;
this._sizeAdjustment = sizeAdjustment;
this._scale = scale;
this.thisBound = 0;
this.thisPosition = 0;
this.givenBound = 0;
this.givenPosition = 0;
}
// Returns this bound's size
ExtentSeparator.prototype.getThisSize = function () {
if (this.thisBound >= this._thisExtent.numBounds()) {
throw new Error("Getting this bound's size past the " + "end of this extent.");
}
return this._thisExtent.boundSizeAt(this.thisBound);
};
// Returns given's bound's size
ExtentSeparator.prototype.getGivenSize = function () {
if (this.givenBound >= this._givenExtent.numBounds()) {
throw new Error("Getting given's size past the end of " + "given's extent.");
}
var rv = this._givenExtent.boundSizeAt(this.givenBound);
if (isNaN(rv)) {
return NaN;
}
return this._scale * rv + this._sizeAdjustment;
};
// Moves to this extent's next bound. true is returned as long as
// thisBound is valid.
ExtentSeparator.prototype.getThisNextBound = function () {
if (this.thisBound >= this._thisExtent.numBounds()) {
throw new Error("Getting past end of this extent.");
}
this.thisPosition += this._thisExtent.boundLengthAt(this.thisBound);
++this.thisBound;
return this.thisBound != this._thisExtent.numBounds();
};
// Increments given's iterator. true is returned as long as givenBound
// is valid.
ExtentSeparator.prototype.getGivenNextBound = function () {
if (this.givenBound >= this._givenExtent.numBounds()) {
throw new Error("Getting past end of given bound.");
}
this.givenPosition += this._scale * this._givenExtent.boundLengthAt(this.givenBound);
++this.givenBound;
return this.givenBound != this._givenExtent.numBounds();
};
ExtentSeparator.prototype.givenReach = function () {
if (this.givenBound >= this._givenExtent.numBounds()) {
return this.givenPosition;
}
return this.givenPosition + this._scale * this._givenExtent.boundLengthAt(this.givenBound);
};
ExtentSeparator.prototype.thisReach = function () {
if (this.thisBound == this._thisExtent.numBounds()) {
return this.thisPosition;
}
return this.thisPosition + this._thisExtent.boundLengthAt(this.thisBound);
};
ExtentSeparator.prototype.combine = function () {
// Create the aggregate result.
var result = new _Extent__WEBPACK_IMPORTED_MODULE_0__["default"]();
// Iterate over each bound.
// let combinedIteration = 0;
while (this.givenBound != this._givenExtent.numBounds() && this.thisBound != this._thisExtent.numBounds()) {
// console.log("Iterating over each bound.");
// console.log("This reach: " + thisReach.call(this) + ", size: " + getThisSize.call(this) + ", pos: " + thisPosition);
// console.log("Given reach: " + givenReach.call(this) + ", size: " + getGivenSize.call(this) + ", pos: " + givenPosition);
// ++combinedIteration;
var thisSize = this.getThisSize();
var givenSize = this.getGivenSize();
var newSize = void 0;
if (!isNaN(thisSize) && !isNaN(givenSize)) {
newSize = Math.max(thisSize, givenSize);
} else if (!isNaN(thisSize)) {
newSize = thisSize;
} else {
newSize = givenSize;
}
result.appendLS(Math.min(this.thisReach(), this.givenReach()) - Math.max(this.thisPosition, this.givenPosition), newSize);
if (this.thisReach() == this.givenReach()) {
// This bound ends at the same position as given's
// bound, so increment both iterators.
this.getThisNextBound();
this.getGivenNextBound();
} else if (this.thisReach() < this.givenReach()) {
// This bound ends before given's bound, so increment
// this bound's iterator.
this.getThisNextBound();
} else {
// Assert: thisReach() > givenReach()
// Given's bound ends before this bound, so increment
// given's iterator.
this.getGivenNextBound();
}
}
if (this.givenBound != this._givenExtent.numBounds()) {
// Finish off given last overlapping bound to get completely
// in sync with givens.
result.appendLS(this.givenReach() - this.thisReach(), this.getGivenSize());
while (this.getGivenNextBound()) {
// ++combinedIteration;
result.appendLS(this._scale * this._givenExtent.boundLengthAt(this.givenBound), this.getGivenSize());
}
} else if (this.thisBound != this._thisExtent.numBounds()) {
// Finish off this extent's last overlapping bound to get completely
// in sync with given's iterator.
result.appendLS(this.thisReach() - this.givenReach(), this.getThisSize());
while (this.getThisNextBound()) {
// ++combinedIteration;
result.appendLS(this._thisExtent.boundLengthAt(this.thisBound), this.getThisSize());
}
}
// console.log("Combined after " + combinedIteration + "iterations");
return result;
};
return ExtentSeparator;
}();
/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (ExtentSeparator);
/***/ }),
/***/ "./src/ExtentSeparator.ts":
/*!********************************!*\
!*** ./src/ExtentSeparator.ts ***!
\********************************/
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
"use strict";
__webpack_require__.r(__webpack_exports__);
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
/* harmony export */ "default": () => (__WEBPACK_DEFAULT_EXPORT__)
/* harmony export */ });
var ExtentSeparator = /** @class */function () {
function ExtentSeparator(thisExtent, givenExtent, positionAdjustment, allowAxisOverlap, givenScale) {
this._thisExtent = thisExtent;
this._givenExtent = givenExtent;
this._thisBound = 0;
this._givenBound = 0;
this._thisPosition = 0;
this._positionAdjustment = positionAdjustment;
this._allowAxisOverlap = allowAxisOverlap;
this._givenScale = givenScale;
// The position of given. This is in this node's space.
this._givenPosition = 0;
}
/*
* Moves the iterator for this extent to its next bound.
*
* The iterator is just a fancy counter. Both the position
* and the bound index are tracked.
*/
ExtentSeparator.prototype.incrementThisBound = function () {
this._thisPosition += this._thisExtent.boundLengthAt(this._thisBound);
++this._thisBound;
};
ExtentSeparator.prototype.givenBoundLength = function () {
return this._givenScale * this._givenExtent.boundLengthAt(this._givenBound);
};
ExtentSeparator.prototype.givenBoundSize = function () {
var rv = this._givenExtent.boundSizeAt(this._givenBound);
if (isNaN(rv)) {
return rv;
}
return this._givenScale * rv;
};
ExtentSeparator.prototype.thisBoundSize = function () {
return this._thisExtent.boundSizeAt(this._thisBound);
};
/*
* Moves the iterator for the given extent to the next bound.
*
* The iterator is just a fancy counter. Both the position
* and the bound index are tracked.
*/
ExtentSeparator.prototype.incrementGivenBound = function () {
this._givenPosition += this.givenBoundLength();
++this._givenBound;
};
ExtentSeparator.prototype.givenAtEnd = function () {
return this._givenBound == this._givenExtent.numBounds();
};
ExtentSeparator.prototype.thisAtEnd = function () {
return this._thisBound == this._thisExtent.numBounds();
};
ExtentSeparator.prototype.consume = function (extentSeparation, axisMinimum) {
// While the iterators still have bounds in both extents.
while (!this.givenAtEnd() && !this.thisAtEnd()) {
// Calculate the separation between these bounds.
// console.log("Separating");
// console.log("This bound size: " + this.boundSizeAt(this._thisBound));
// console.log("Given bound size: " + this.givenBoundSize());
var thisSize = this._thisExtent.boundSizeAt(this._thisBound);
var givenSize = this.givenBoundSize();
var boundSeparation = void 0;
if (!isNaN(thisSize) && !isNaN(givenSize)) {
boundSeparation = thisSize + givenSize;
} else if (!this._allowAxisOverlap) {
if (!isNaN(thisSize)) {
boundSeparation = thisSize + axisMinimum;
} else if (!isNaN(givenSize)) {
boundSeparation = givenSize + axisMinimum;
} else {
// Both extents are empty at this location.
boundSeparation = 0;
}
} else {
// Axis overlap is allowed.
boundSeparation = 0;
}
if (boundSeparation > extentSeparation) {
extentSeparation = boundSeparation;
// console.log("Found new separation of " + extentSeparation + ".");
}
// Increment the iterators to the next testing point.
// endComparison is a difference that indicates which bound
// ends soonest.
var endComparison = this._thisPosition + this._thisExtent.boundLengthAt(this._thisBound) - this._positionAdjustment - (this._givenPosition + this._givenScale * this._givenExtent.boundLengthAt(this._givenBound));
if (endComparison == 0) {
// This bound ends at the same position as given's bound,
// so increment both.
this.incrementGivenBound();
this.incrementThisBound();
} else if (endComparison > 0) {
// This bound ends after given's bound, so increment the
// given bound's iterator.
this.incrementGivenBound();
}
if (endComparison < 0) {
// Given's bound ends after this bound, so increment this
// bound's iterator.
this.incrementThisBound();
}
}
return extentSeparation;
};
return ExtentSeparator;
}();
/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (ExtentSeparator);
/***/ }),
/***/ "./node_modules/parsegraph-fuzzyequals/dist/src/index.js":
/*!***************************************************************!*\
!*** ./node_modules/parsegraph-fuzzyequals/dist/src/index.js ***!
\***************************************************************/
/***/ (function(module) {
!function(e,t){ true?module.exports=t():0}(this,(function(){return(()=>{"use strict";var e={d:(t,n)=>{for(var s in n)e.o(n,s)&&!e.o(t,s)&&Object.defineProperty(t,s,{enumerable:!0,get:n[s]})},o:(e,t)=>Object.prototype.hasOwnProperty.call(e,t),r:e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})}},t={};e.r(t),e.d(t,{Fuzziness:()=>n,setFuzziness:()=>o,getFuzziness:()=>u,cloneFuzziness:()=>i,default:()=>r});var n=function(){function e(e){this.setFuzziness(e)}return e.prototype.setFuzziness=function(e){this._fuzziness=e},e.prototype.getFuzziness=function(){return void 0!==this._fuzziness?this._fuzziness:s.getFuzziness()},e.prototype.resetFuzziness=function(){this.setFuzziness(void 0)},e.prototype.check=function(e,t){var n=this.getFuzziness();return n?Math.abs(Math.abs(e)-Math.abs(t))<n:e===t},e}(),s=new n(1e-6);function o(e){s.setFuzziness(e)}function u(){return s.getFuzziness()}function i(){return new n(s.getFuzziness())}function r(e,t,o){var u=s;return void 0!==o&&(u=new n(o)),u.check(e,t)}return t})()}));
/***/ }),
/***/ "./node_modules/parsegraph-gettimeinmillis/dist/src/index.js":
/*!*******************************************************************!*\
!*** ./node_modules/parsegraph-gettimeinmillis/dist/src/index.js ***!
\*******************************************************************/
/***/ (function(module) {
!function(e,t){ true?module.exports=t():0}(this,(function(){return(()=>{"use strict";var e={d:(t,o)=>{for(var r in o)e.o(o,r)&&!e.o(t,r)&&Object.defineProperty(t,r,{enumerable:!0,get:o[r]})},o:(e,t)=>Object.prototype.hasOwnProperty.call(e,t),r:e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})}},t={};function o(){return Date.now()}return e.r(t),e.d(t,{default:()=>o}),t})()}));
/***/ })
/******/ });
/************************************************************************/
/******/ // The module cache
/******/ var __webpack_module_cache__ = {};
/******/
/******/ // The require function
/******/ function __webpack_require__(moduleId) {
/******/ // Check if module is in cache
/******/ var cachedModule = __webpack_module_cache__[moduleId];
/******/ if (cachedModule !== undefined) {
/******/ return cachedModule.exports;
/******/ }
/******/ // Create a new module (and put it into the cache)
/******/ var module = __webpack_module_cache__[moduleId] = {
/******/ // no module.id needed
/******/ // no module.loaded needed
/******/ exports: {}
/******/ };
/******/
/******/ // Execute the module function
/******/ __webpack_modules__[moduleId].call(module.exports, module, module.exports, __webpack_require__);
/******/
/******/ // Return the exports of the module
/******/ return module.exports;
/******/ }
/******/
/************************************************************************/
/******/ /* webpack/runtime/compat get default export */
/******/ (() => {
/******/ // getDefaultExport function for compatibility with non-harmony modules
/******/ __webpack_require__.n = (module) => {
/******/ var getter = module && module.__esModule ?
/******/ () => (module['default']) :
/******/ () => (module);
/******/ __webpack_require__.d(getter, { a: getter });
/******/ return getter;
/******/ };
/******/ })();
/******/
/******/ /* webpack/runtime/define property getters */
/******/ (() => {
/******/ // define getter functions for harmony exports
/******/ __webpack_require__.d = (exports, definition) => {
/******/ for(var key in definition) {
/******/ if(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) {
/******/ Object.defineProperty(exports, key, { enumerable: true, get: definition[key] });
/******/ }
/******/ }
/******/ };
/******/ })();
/******/
/******/ /* webpack/runtime/hasOwnProperty shorthand */
/******/ (() => {
/******/ __webpack_require__.o = (obj, prop) => (Object.prototype.hasOwnProperty.call(obj, prop))
/******/ })();
/******/
/******/ /* webpack/runtime/make namespace object */
/******/ (() => {
/******/ // define __esModule on exports
/******/ __webpack_require__.r = (exports) => {
/******/ if(typeof Symbol !== 'undefined' && Symbol.toStringTag) {
/******/ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
/******/ }
/******/ Object.defineProperty(exports, '__esModule', { value: true });
/******/ };
/******/ })();
/******/
/************************************************************************/
var __webpack_exports__ = {};
// This entry need to be wrapped in an IIFE because it need to be in strict mode.
(() => {
"use strict";
/*!**********************!*\
!*** ./src/index.ts ***!
\**********************/
__webpack_require__.r(__webpack_exports__);
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
/* harmony export */ "ExtentCombiner": () => (/* reexport safe */ _ExtentCombiner__WEBPACK_IMPORTED_MODULE_1__["default"]),
/* harmony export */ "ExtentSeparator": () => (/* reexport safe */ _ExtentSeparator__WEBPACK_IMPORTED_MODULE_0__["default"]),
/* harmony export */ "default": () => (__WEBPACK_DEFAULT_EXPORT__)
/* harmony export */ });
/* harmony import */ var _ExtentSeparator__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./ExtentSeparator */ "./src/ExtentSeparator.ts");
/* harmony import */ var _ExtentCombiner__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./ExtentCombiner */ "./src/ExtentCombiner.ts");
/* harmony import */ var _Extent__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./Extent */ "./src/Extent.ts");
/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (_Extent__WEBPACK_IMPORTED_MODULE_2__["default"]);
})();
/******/ return __webpack_exports__;
/******/ })()
;
});
!function(t,n){"object"==typeof exports&&"object"==typeof module?module.exports=n():"function"==typeof define&&define.amd?define([],n):"object"==typeof exports?exports.parsegraph_extent=n():t.parsegraph_extent=n()}(this,(()=>(()=>{var t={465:function(t){t.exports=(()=>{"use strict";var t={d:(n,i)=>{for(var e in i)t.o(i,e)&&!t.o(n,e)&&Object.defineProperty(n,e,{enumerable:!0,get:i[e]})},o:(t,n)=>Object.prototype.hasOwnProperty.call(t,n),r:t=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})}},n={};t.r(n),t.d(n,{Fuzziness:()=>i,setFuzziness:()=>s,getFuzziness:()=>o,cloneFuzziness:()=>u,default:()=>h});var i=function(){function t(t){this.setFuzziness(t)}return t.prototype.setFuzziness=function(t){this._fuzziness=t},t.prototype.getFuzziness=function(){return void 0!==this._fuzziness?this._fuzziness:e.getFuzziness()},t.prototype.resetFuzziness=function(){this.setFuzziness(void 0)},t.prototype.check=function(t,n){var i=this.getFuzziness();return i?Math.abs(Math.abs(t)-Math.abs(n))<i:t===n},t}(),e=new i(1e-6);function s(t){e.setFuzziness(t)}function o(){return e.getFuzziness()}function u(){return new i(e.getFuzziness())}function h(t,n,s){var o=e;return void 0!==s&&(o=new i(s)),o.check(t,n)}return n})()},902:function(t){t.exports=(()=>{"use strict";var t={d:(n,i)=>{for(var e in i)t.o(i,e)&&!t.o(n,e)&&Object.defineProperty(n,e,{enumerable:!0,get:i[e]})},o:(t,n)=>Object.prototype.hasOwnProperty.call(t,n),r:t=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})}},n={};function i(){return Date.now()}return t.r(n),t.d(n,{default:()=>i}),n})()}},n={};function i(e){var s=n[e];if(void 0!==s)return s.exports;var o=n[e]={exports:{}};return t[e].call(o.exports,o,o.exports,i),o.exports}i.n=t=>{var n=t&&t.__esModule?()=>t.default:()=>t;return i.d(n,{a:n}),n},i.d=(t,n)=>{for(var e in n)i.o(n,e)&&!i.o(t,e)&&Object.defineProperty(t,e,{enumerable:!0,get:n[e]})},i.o=(t,n)=>Object.prototype.hasOwnProperty.call(t,n),i.r=t=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})};var e={};return(()=>{"use strict";i.r(e),i.d(e,{ExtentCombiner:()=>r,ExtentSeparator:()=>t,default:()=>d});const t=function(){function t(t,n,i,e,s){this._thisExtent=t,this._givenExtent=n,this._thisBound=0,this._givenBound=0,this._thisPosition=0,this._positionAdjustment=i,this._allowAxisOverlap=e,this._givenScale=s,this._givenPosition=0}return t.prototype.incrementThisBound=function(){this._thisPosition+=this._thisExtent.boundLengthAt(this._thisBound),++this._thisBound},t.prototype.givenBoundLength=function(){return this._givenScale*this._givenExtent.boundLengthAt(this._givenBound)},t.prototype.givenBoundSize=function(){var t=this._givenExtent.boundSizeAt(this._givenBound);return isNaN(t)?t:this._givenScale*t},t.prototype.thisBoundSize=function(){return this._thisExtent.boundSizeAt(this._thisBound)},t.prototype.incrementGivenBound=function(){this._givenPosition+=this.givenBoundLength(),++this._givenBound},t.prototype.givenAtEnd=function(){return this._givenBound==this._givenExtent.numBounds()},t.prototype.thisAtEnd=function(){return this._thisBound==this._thisExtent.numBounds()},t.prototype.consume=function(t,n){for(;!this.givenAtEnd()&&!this.thisAtEnd();){var i,e=this._thisExtent.boundSizeAt(this._thisBound),s=this.givenBoundSize();(i=isNaN(e)||isNaN(s)?this._allowAxisOverlap?0:isNaN(e)?isNaN(s)?0:s+n:e+n:e+s)>t&&(t=i);var o=this._thisPosition+this._thisExtent.boundLengthAt(this._thisBound)-this._positionAdjustment-(this._givenPosition+this._givenScale*this._givenExtent.boundLengthAt(this._givenBound));0==o?(this.incrementGivenBound(),this.incrementThisBound()):o>0&&this.incrementGivenBound(),o<0&&this.incrementThisBound()}return t},t}();var n=i(902),s=i.n(n),o=i(465),u=i.n(o);const h=function(){function n(t){void 0!==t&&t._bounds?(this._offset=t._offset,this._numBounds=t._numBounds,this._bounds=new Float32Array(t._bounds),this._start=t._start,null!==t._minSize&&(this._minSize=t._minSize,this._maxSize=t._maxSize,this._totalLength=t._totalLength)):(this._start=0,this._offset=0,this._numBounds=0,this._bounds=null,this._minSize=null,this._maxSize=null,this._totalLength=null)}return n.prototype.setOffset=function(t){this._offset=t},n.prototype.offset=function(){return this._offset},n.prototype.forEach=function(t,n){1!==arguments.length&&void 0!==n||(n=this);for(var i=0;i<this._numBounds;++i)t.call(n,this.boundLengthAt(i),this.boundSizeAt(i),i)},n.prototype.clone=function(){return new n(this)},n.prototype.clear=function(){this._numBounds=0,this.invalidateBoundingValues()},n.prototype.numBounds=function(){return this._numBounds},n.prototype.hasBounds=function(){return this.numBounds()>0},n.prototype.boundLengthAt=function(t){return this._bounds[(this._start+t)%this.boundCapacity()*2]},n.prototype.boundSizeAt=function(t){return this._bounds[(this._start+t)%this.boundCapacity()*2+1]},n.prototype.invalidateBoundingValues=function(){this._minSize=null,this._maxSize=null,this._totalLength=null},n.prototype.setBoundLengthAt=function(t,n){this._bounds[(this._start+t)%this.boundCapacity()*2]=n,this.invalidateBoundingValues()},n.prototype.setBoundSizeAt=function(t,n){this._bounds[(this._start+t)%this.boundCapacity()*2+1]=n,this.invalidateBoundingValues()},n.prototype.realloc=function(t){t<1&&(t=1);var n=this._bounds,i=this.boundCapacity();if(i>=t)throw new Error("Cannot shrink Extent capacity");if(this._bounds=new Float32Array(2*t),n)if(this._start+this._numBounds>i){for(var e=this._start+this._numBounds-i,s=0;s<2*(this._numBounds-e);++s)this._bounds[s]=n[this._start+s];for(s=0;s<2*(this._numBounds-e);++s)this._bounds[this._numBounds-e+s]=n[s]}else for(s=0;s<2*this._numBounds;++s)this._bounds[s]=n[this._start+s];return this._start=0,0},n.prototype.prependLS=function(t,n){if(isNaN(t))throw new Error("Length must not be NaN");if(0!=t){if(t<0)throw new Error("Non-positive bound lengths are not allowed, but "+t+" was given anyway.");if(this.numBounds()>0){var i=this.boundSizeAt(0);if(Number.isNaN(i)&&Number.isNaN(n)||i===n)return void this.setBoundLengthAt(0,this.boundLengthAt(0)+t)}if(this.boundCapacity()==this.numBounds()){var e=1;this.boundCapacity()>0&&(e=2*this.boundCapacity()),this.realloc(e)}0==this._start?this._start=this.boundCapacity()-1:--this._start,++this._numBounds,this.setBoundLengthAt(0,t),this.setBoundSizeAt(0,n)}},n.prototype.boundCapacity=function(){return this._bounds?this._bounds.length/2:0},n.prototype.appendLS=function(t,n){if(isNaN(t))throw new Error("Length must not be NaN");if(0!==t){if(t<0)throw new Error("Non-positive bound lengths are not allowed, but "+t+" was given anyway.");if(this.numBounds()>0){var i=this.boundSizeAt(this.numBounds()-1);if(isNaN(i)&&isNaN(n)||i===n)return void this.setBoundLengthAt(this.numBounds()-1,this.boundLengthAt(this.numBounds()-1)+t)}if(this.boundCapacity()==this.numBounds()){var e=1;this.boundCapacity()>0&&(e=2*this.boundCapacity()),this.realloc(e)}++this._numBounds,this.setBoundLengthAt(this.numBounds()-1,t),this.setBoundSizeAt(this.numBounds()-1,n)}},n.prototype.prependSL=function(t,n){this.prependLS(n,t)},n.prototype.appendSL=function(t,n){this.appendLS(n,t)},n.prototype.adjustSize=function(t){for(var n=0;n<this.numBounds();++n){var i=this.boundSizeAt(n);isNaN(i)||this.setBoundSizeAt(n,i+t)}},n.prototype.simplify=function(){for(var t=0,n=NaN,i=0;i<this.numBounds();++i){t+=this.boundLengthAt(i);var e=this.boundSizeAt(i);isNaN(n)?n=e:isNaN(e)||(n=Math.max(n,e))}this.clear(),this.appendLS(t,n)},n.prototype.sizeAt=function(t){if(t<0)throw new Error("OFFSET_IS_NEGATIVE");for(var n=0,i=0;i<this.numBounds();){var e=this.boundLengthAt(i);if(t<=n+e)break;n+=e,++i}return i==this.numBounds()?NaN:this.boundSizeAt(i)},n.prototype.combineBound=function(t,i,e){var s=new n;s.appendLS(i,e),this.copyFrom(this.combinedExtent(s,t))},n.prototype.copyFrom=function(t){this._numBounds=t._numBounds,this._bounds=t._bounds,t.clear(),this.invalidateBoundingValues()},n.prototype.combineExtentAndSimplify=function(t,n,i,e,s){s||(s=[null,null,null]),t.boundingValues(s);var o=s[0],u=s[2];this.boundingValues(s);var h,r=s[0],d=s[2];this.clear(),h=n<0?Math.max(r-n,o*e):Math.max(r,o*e+n),this.appendLS(h,Math.max(d,u*e+i))},n.prototype.combineExtent=function(t,n,i,e){var s=this.combinedExtent(t,n,i,e);this.copyFrom(s)},n.prototype.combinedExtent=function(t,n,i,e){if(void 0===n&&(n=0),void 0===i&&(i=0),void 0===e&&(e=1),n<0){var s=t.combinedExtent(this,-n/e,-i/e,1/e);return s.scale(e),s.adjustSize(i),s}if(n>0){var o=t.clone();return o.prependLS(n/e,NaN),this.combinedExtent(o,0,i,e)}return new r(this,t,n,i,e).combine()},n.prototype.scale=function(t){this.forEach((function(n,i,e){this.setBoundLengthAt(e,n*t),isNaN(this.boundSizeAt(e))||this.setBoundSizeAt(e,i*t)}),this)},n.prototype.separation=function(n,i,e,o,u){void 0===i&&(i=0),void 0===e&&(e=!0),void 0===u&&(u=0),void 0===o&&(o=1);var h=new t(this,n,i,e,o),r=0;if(i<0)for(;!h.givenAtEnd()&&h._givenPosition+h.givenBoundLength()<=-i;){var d=h.givenBoundSize();!e&&!isNaN(d)&&d>r&&(r=d+u),h.incrementGivenBound()}else for(;!h.thisAtEnd()&&h._thisPosition+this.boundLengthAt(h._thisBound)<=i;)d=h.thisBoundSize(),!e&&!isNaN(d)&&d>r&&(r=d),h.incrementThisBound();if(r=h.consume(r,u),!e)for(var a=s()();!h.givenAtEnd();){if(s()()-a>1e4)throw new Error("Extent separation timed out");var p=n.boundSizeAt(h._givenBound);isNaN(p)||(r=Math.max(r,o*p+u)),++h._givenBound}return r},n.prototype.boundingValues=function(t){if(t||(t=[null,null,null]),null!==this._minSize)return t[0]=this._totalLength,t[1]=this._minSize,t[2]=this._maxSize,t;for(var n=0,i=NaN,e=NaN,s=0;s!=this.numBounds();++s){n+=this.boundLengthAt(s);var o=this.boundSizeAt(s);isNaN(i)?i=o:isNaN(o)||(i=Math.min(i,o)),isNaN(e)?e=o:isNaN(o)||(e=Math.max(e,o))}return t[0]=n,t[1]=i,t[2]=e,this._minSize=i,this._maxSize=e,this._totalLength=n,t},n.prototype.equals=function(t,n){if(this===t)return!0;if(!t||this.numBounds()!=t.numBounds())return!1;for(var i=0;i<this.numBounds();++i){if(!u()(this.boundLengthAt(i),t.boundLengthAt(i),n))return!1;var e=this.boundSizeAt(i),s=t.boundSizeAt(i);if(!isNaN(e)||!isNaN(s)){if(isNaN(e)||isNaN(s))return!1;if(!u()(this.boundSizeAt(i),t.boundSizeAt(i)))return!1}}return!0},n.prototype.dump=function(t){void 0!==t&&console.log(t);for(var n=0,i=0;i<this.numBounds();++i)console.log(n+": [length="+this.boundLengthAt(i)+", size="+this.boundSizeAt(i)+"]"),n+=this.boundLengthAt(i)},n.prototype.toDom=function(t){var n=document.createElement("table");if(n.className="Extent",void 0!==t){var i=document.createElement("tr");n.appendChild(i),i.appendChild(document.createElement("th")),i.lastElementChild.innerHTML=t,i.lastElementChild.colSpan=3}var e=document.createElement("tr");n.appendChild(e),e.appendChild(document.createElement("th")),e.lastElementChild.innerHTML="Offset",e.appendChild(document.createElement("th")),e.lastElementChild.innerHTML="Length",e.appendChild(document.createElement("th")),e.lastElementChild.innerHTML="Size";for(var s=0,o=0;o<this.numBounds();++o){var u=document.createElement("tr");n.appendChild(u),u.appendChild(document.createElement("td")),u.lastElementChild.innerHTML=""+s,u.appendChild(document.createElement("td")),u.lastElementChild.innerHTML=""+this.boundLengthAt(o),u.appendChild(document.createElement("td")),u.lastElementChild.innerHTML=""+this.boundSizeAt(o),s+=this.boundLengthAt(o)}return n},n}();const r=function(){function t(t,n,i,e,s){this._thisExtent=t,this._givenExtent=n,this._lengthAdjustment=i,this._sizeAdjustment=e,this._scale=s,this.thisBound=0,this.thisPosition=0,this.givenBound=0,this.givenPosition=0}return t.prototype.getThisSize=function(){if(this.thisBound>=this._thisExtent.numBounds())throw new Error("Getting this bound's size past the end of this extent.");return this._thisExtent.boundSizeAt(this.thisBound)},t.prototype.getGivenSize=function(){if(this.givenBound>=this._givenExtent.numBounds())throw new Error("Getting given's size past the end of given's extent.");var t=this._givenExtent.boundSizeAt(this.givenBound);return isNaN(t)?NaN:this._scale*t+this._sizeAdjustment},t.prototype.getThisNextBound=function(){if(this.thisBound>=this._thisExtent.numBounds())throw new Error("Getting past end of this extent.");return this.thisPosition+=this._thisExtent.boundLengthAt(this.thisBound),++this.thisBound,this.thisBound!=this._thisExtent.numBounds()},t.prototype.getGivenNextBound=function(){if(this.givenBound>=this._givenExtent.numBounds())throw new Error("Getting past end of given bound.");return this.givenPosition+=this._scale*this._givenExtent.boundLengthAt(this.givenBound),++this.givenBound,this.givenBound!=this._givenExtent.numBounds()},t.prototype.givenReach=function(){return this.givenBound>=this._givenExtent.numBounds()?this.givenPosition:this.givenPosition+this._scale*this._givenExtent.boundLengthAt(this.givenBound)},t.prototype.thisReach=function(){return this.thisBound==this._thisExtent.numBounds()?this.thisPosition:this.thisPosition+this._thisExtent.boundLengthAt(this.thisBound)},t.prototype.combine=function(){for(var t=new h;this.givenBound!=this._givenExtent.numBounds()&&this.thisBound!=this._thisExtent.numBounds();){var n,i=this.getThisSize(),e=this.getGivenSize();n=isNaN(i)||isNaN(e)?isNaN(i)?e:i:Math.max(i,e),t.appendLS(Math.min(this.thisReach(),this.givenReach())-Math.max(this.thisPosition,this.givenPosition),n),this.thisReach()==this.givenReach()?(this.getThisNextBound(),this.getGivenNextBound()):this.thisReach()<this.givenReach()?this.getThisNextBound():this.getGivenNextBound()}if(this.givenBound!=this._givenExtent.numBounds())for(t.appendLS(this.givenReach()-this.thisReach(),this.getGivenSize());this.getGivenNextBound();)t.appendLS(this._scale*this._givenExtent.boundLengthAt(this.givenBound),this.getGivenSize());else if(this.thisBound!=this._thisExtent.numBounds())for(t.appendLS(this.thisReach()-this.givenReach(),this.getThisSize());this.getThisNextBound();)t.appendLS(this._thisExtent.boundLengthAt(this.thisBound),this.getThisSize());return t},t}(),d=h})(),e})()));
//# sourceMappingURL=index.js.map

2

parsegraph-extent/package.json
{
"name": "parsegraph-extent",
"version": "1.4.16-dev",
"version": "1.4.16",
"description": "2D geometric container",

@@ -5,0 +5,0 @@ "main": "dist/src/index.js",

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc