diff --git a/.editorconfig b/.editorconfig new file mode 100644 index 0000000..1aea015 --- /dev/null +++ b/.editorconfig @@ -0,0 +1,14 @@ +# EditorConfig: http://editorconfig.org + +root = true + +[*] +indent_style = tab +end_of_line = lf +charset = utf-8 +trim_trailing_whitespace = true +insert_final_newline = true + +[*.md,yml] +indent_style = space +indent_size = 2 diff --git a/.prettierignore b/.prettierignore index 12008a4..c2d7688 100644 --- a/.prettierignore +++ b/.prettierignore @@ -1,4 +1,3 @@ tmp/ -es/ +dist/ /coverage -lib/ diff --git a/.prettierrc.cjs b/.prettierrc.js similarity index 58% rename from .prettierrc.cjs rename to .prettierrc.js index 3a535ed..6d2059f 100644 --- a/.prettierrc.cjs +++ b/.prettierrc.js @@ -1,4 +1,4 @@ -module.exports = { +export default { useTabs: true, semi: false, singleQuote: true, @@ -7,5 +7,5 @@ module.exports = { printWidth: 120, arrowParens: 'avoid', - overrides: [{files: '*.md', options: {tabWidth: 2, useTabs: false}}], + overrides: [{files: ['*.md', '*.yml'], options: {useTabs: false, tabWidth: 2}}], } diff --git a/README.md b/README.md index 3fd7394..4649e94 100644 --- a/README.md +++ b/README.md @@ -13,12 +13,13 @@ compiler). ## Index -- [Getting started](#getting-started) +- [Install](#install) +- [Usage](#usage) - [Documentation](#documentation) - [Benchmarks](#benchmarks) - [Tests](#tests) -## Getting started +## Install Install using NPM: @@ -26,18 +27,7 @@ Install using NPM: npm install @lume/kiwi ``` -then either load `kiwi` as a global variable using a script tag, - -```html - - -``` - -or import it into your ES Module script: +then import it into your project: ```js import * as kiwi from '@lume/kiwi' @@ -47,6 +37,23 @@ console.log(kiwi) // ...use kiwi... ``` +If you have a plain web app with no build, or a non-browser JS runtime that also +supports import maps like Deno, you'll need to add `@lume/kiwi` to your +`importmap` script so that the browser knows where to import kiwi from. F.e. +something like this: + +```html + +``` + +## Usage + The following example creates a solver which automatically calculates a width based on some constraints: ```js @@ -84,6 +91,24 @@ To run the benchmark locally using nodejs, _clone or download this repository_ a npm install npm run bench +Statically serve the project, f.e. `npx five-server .` which opens a new browser +tab, then visit `/bench/index.html` to verify that the benchmark also runs in a +browser. + +Sample result output: + +``` +----- Running creation benchmark... +Cassowary.js x 2,597 ops/sec ±1.56% (93 runs sampled) +kiwi x 26,243 ops/sec ±1.34% (91 runs sampled) +kiwi new API x 20,840 ops/sec ±7.19% (80 runs sampled) +Fastest is kiwi (± 10.11x faster) +----- Running solving benchmark... +Cassowary.js x 260,002 ops/sec ±2.62% (89 runs sampled) +kiwi x 595,455 ops/sec ±1.74% (89 runs sampled) +Fastest is kiwi (± 2.29x faster) +``` + ## Tests To run the tests in the browser, [just visit this page](https://rawgit.com/IjzerenHein/kiwi/master/test/index.html). @@ -93,16 +118,20 @@ To run the tests locally using nodejs, _clone or download this repository_ and e npm install npm run build && npm run test +Start a static server, f.e. `npx five-server .` which opens a new browser tab, +and visit `/test/index.html` to verify that tests also pass in a browser. + ## Contribute -If you like this project and want to support it, show some love -and give it a star. +If you like this project and want to support it, show some love and give it a +star, try it and report any bugs, write new feature ideas, or even +open a pull request! ## License © 2013 Nucleic Development Team © 2021 Joseph Orbegoso Pea (http://github.com/trusktr) -© 2021 LUME +© 2021 Lume [![License](https://img.shields.io/badge/license-BDS%203--clause-brightgreen)]() diff --git a/bench/index.html b/bench/index.html index 0050022..d8de00d 100644 --- a/bench/index.html +++ b/bench/index.html @@ -2,6 +2,13 @@ Benchmark Tests +

@@ -13,7 +20,8 @@
 			type="text/javascript"
 			src="https://rawcdn.githack.com/slightlyoff/cassowary.js/68f82a0a9c365701a1cba8d929c5c7be097cd716/bin/c.min.js"
 		>
-		
-		
+		
 	
 
diff --git a/bench/main.cjs b/bench/main.js
similarity index 94%
rename from bench/main.cjs
rename to bench/main.js
index 91b46a1..507795d 100644
--- a/bench/main.cjs
+++ b/bench/main.js
@@ -1,21 +1,15 @@
 /*global module:false*/
 /*eslint strict:false, quotes: [2, "single"] */
 
-var assert = typeof window === 'undefined' ? require('assert') : window.chai.assert
-var _ = typeof window === 'undefined' ? require('lodash') : window._
-var Platform = typeof window === 'undefined' ? require('platform') : window.Platform
-var Benchmark = typeof window === 'undefined' ? require('benchmark') : window.Benchmark
-var c = typeof window === 'undefined' ? require('cassowary') : window.c // cassowary
-
-var getKiwi = () => {
-	return new Promise(resolve => {
-		typeof window === 'undefined' ? resolve(import('../es/kiwi.js')) : resolve(window.kiwi)
-	})
-}
+var assert = typeof window === 'undefined' ? (await import('assert')).default : window.chai.assert
+var _ = typeof window === 'undefined' ? (await import('lodash')).default : window._
+var Platform = typeof window === 'undefined' ? (await import('platform')).default : window.Platform
+var Benchmark = typeof window === 'undefined' ? (await import('benchmark')).default : window.Benchmark
+var c = typeof window === 'undefined' ? (await import('cassowary')).default : window.c // cassowary
 
 main()
 async function main() {
-	const kiwi = await getKiwi()
+	const kiwi = await import('@lume/kiwi')
 
 	var logElement
 	function log(message) {
@@ -28,7 +22,7 @@ async function main() {
 
 	function createKiwiSolver() {
 		var solver = new kiwi.Solver()
-		var strength = new kiwi.Strength.create(0, 900, 1000)
+		var strength = kiwi.Strength.create(0, 900, 1000)
 
 		// super-view
 		var superView = {
@@ -177,7 +171,7 @@ async function main() {
 
 	function createKiwiSolverNewAPI() {
 		var solver = new kiwi.Solver()
-		var strength = new kiwi.Strength.create(0, 900, 1000)
+		var strength = kiwi.Strength.create(0, 900, 1000)
 
 		// super-view
 		var superView = {
diff --git a/es/constraint.d.ts b/dist/constraint.d.ts
similarity index 100%
rename from es/constraint.d.ts
rename to dist/constraint.d.ts
diff --git a/es/constraint.d.ts.map b/dist/constraint.d.ts.map
similarity index 100%
rename from es/constraint.d.ts.map
rename to dist/constraint.d.ts.map
diff --git a/es/constraint.js b/dist/constraint.js
similarity index 78%
rename from es/constraint.js
rename to dist/constraint.js
index b12d73c..538ce7c 100644
--- a/es/constraint.js
+++ b/dist/constraint.js
@@ -29,10 +29,8 @@ export var Operator;
  * @param {Expression} [rhs] Right hand side of the expression.
  * @param {Number} [strength=Strength.required] The strength of the constraint.
  */
-var Constraint = /** @class */ (function () {
-    function Constraint(expression, operator, rhs, strength) {
-        if (strength === void 0) { strength = Strength.required; }
-        this._id = CnId++;
+export class Constraint {
+    constructor(expression, operator, rhs, strength = Strength.required) {
         this._operator = operator;
         this._strength = Strength.clip(strength);
         if (rhs === undefined && expression instanceof Expression) {
@@ -46,41 +44,43 @@ var Constraint = /** @class */ (function () {
      * Returns the unique id number of the constraint.
      * @private
      */
-    Constraint.prototype.id = function () {
+    id() {
         return this._id;
-    };
+    }
     /**
      * Returns the expression of the constraint.
      *
      * @return {Expression} expression
      */
-    Constraint.prototype.expression = function () {
+    expression() {
         return this._expression;
-    };
+    }
     /**
      * Returns the relational operator of the constraint.
      *
      * @return {Operator} linear constraint operator
      */
-    Constraint.prototype.op = function () {
+    op() {
         return this._operator;
-    };
+    }
     /**
      * Returns the strength of the constraint.
      *
      * @return {Number} strength
      */
-    Constraint.prototype.strength = function () {
+    strength() {
         return this._strength;
-    };
-    Constraint.prototype.toString = function () {
+    }
+    toString() {
         return (this._expression.toString() + ' ' + ['<=', '>=', '='][this._operator] + ' 0 (' + this._strength.toString() + ')');
-    };
-    return Constraint;
-}());
-export { Constraint };
+    }
+    _expression;
+    _operator;
+    _strength;
+    _id = CnId++;
+}
 /**
  * The internal constraint id counter.
  * @private
  */
-var CnId = 0;
+let CnId = 0;
diff --git a/es/expression.d.ts b/dist/expression.d.ts
similarity index 100%
rename from es/expression.d.ts
rename to dist/expression.d.ts
diff --git a/es/expression.d.ts.map b/dist/expression.d.ts.map
similarity index 100%
rename from es/expression.d.ts.map
rename to dist/expression.d.ts.map
diff --git a/es/expression.js b/dist/expression.js
similarity index 72%
rename from es/expression.js
rename to dist/expression.js
index 725bd4c..05a6f6f 100644
--- a/es/expression.js
+++ b/dist/expression.js
@@ -15,9 +15,9 @@ import { Variable } from './variable.js';
  * @class
  * @param {...(number|Variable|Expression|Array)} args
  */
-var Expression = /** @class */ (function () {
-    function Expression() {
-        var parsed = parseArgs(arguments);
+export class Expression {
+    constructor() {
+        let parsed = parseArgs(arguments);
         this._terms = parsed.terms;
         this._constant = parsed.constant;
     }
@@ -27,30 +27,30 @@ var Expression = /** @class */ (function () {
      * This *must* be treated as const.
      * @private
      */
-    Expression.prototype.terms = function () {
+    terms() {
         return this._terms;
-    };
+    }
     /**
      * Returns the constant of the expression.
      * @private
      */
-    Expression.prototype.constant = function () {
+    constant() {
         return this._constant;
-    };
+    }
     /**
      * Returns the computed value of the expression.
      *
      * @private
      * @return {Number} computed value of the expression
      */
-    Expression.prototype.value = function () {
-        var result = this._constant;
-        for (var i = 0, n = this._terms.size(); i < n; i++) {
-            var pair = this._terms.itemAt(i);
+    value() {
+        let result = this._constant;
+        for (let i = 0, n = this._terms.size(); i < n; i++) {
+            let pair = this._terms.itemAt(i);
             result += pair.first.value() * pair.second;
         }
         return result;
-    };
+    }
     /**
      * Creates a new Expression by adding a number, variable or expression
      * to the expression.
@@ -58,9 +58,9 @@ var Expression = /** @class */ (function () {
      * @param {Number|Variable|Expression} value Value to add.
      * @return {Expression} expression
      */
-    Expression.prototype.plus = function (value) {
+    plus(value) {
         return new Expression(this, value);
-    };
+    }
     /**
      * Creates a new Expression by substracting a number, variable or expression
      * from the expression.
@@ -68,32 +68,32 @@ var Expression = /** @class */ (function () {
      * @param {Number|Variable|Expression} value Value to substract.
      * @return {Expression} expression
      */
-    Expression.prototype.minus = function (value) {
+    minus(value) {
         return new Expression(this, typeof value === 'number' ? -value : [-1, value]);
-    };
+    }
     /**
      * Creates a new Expression by multiplying with a fixed number.
      *
      * @param {Number} coefficient Coefficient to multiply with.
      * @return {Expression} expression
      */
-    Expression.prototype.multiply = function (coefficient) {
+    multiply(coefficient) {
         return new Expression([coefficient, this]);
-    };
+    }
     /**
      * Creates a new Expression by dividing with a fixed number.
      *
      * @param {Number} coefficient Coefficient to divide by.
      * @return {Expression} expression
      */
-    Expression.prototype.divide = function (coefficient) {
+    divide(coefficient) {
         return new Expression([1 / coefficient, this]);
-    };
-    Expression.prototype.isConstant = function () {
+    }
+    isConstant() {
         return this._terms.size() == 0;
-    };
-    Expression.prototype.toString = function () {
-        var result = this._terms.array
+    }
+    toString() {
+        let result = this._terms.array
             .map(function (pair) {
             return pair.second + '*' + pair.first.toString();
         })
@@ -103,20 +103,20 @@ var Expression = /** @class */ (function () {
         }
         result += this._constant;
         return result;
-    };
-    return Expression;
-}());
-export { Expression };
+    }
+    _terms;
+    _constant;
+}
 /**
  * An internal argument parsing function.
  * @private
  */
 function parseArgs(args) {
-    var constant = 0.0;
-    var factory = function () { return 0.0; };
-    var terms = createMap();
-    for (var i = 0, n = args.length; i < n; ++i) {
-        var item = args[i];
+    let constant = 0.0;
+    let factory = () => 0.0;
+    let terms = createMap();
+    for (let i = 0, n = args.length; i < n; ++i) {
+        let item = args[i];
         if (typeof item === 'number') {
             constant += item;
         }
@@ -125,9 +125,9 @@ function parseArgs(args) {
         }
         else if (item instanceof Expression) {
             constant += item.constant();
-            var terms2 = item.terms();
-            for (var j = 0, k = terms2.size(); j < k; j++) {
-                var termPair = terms2.itemAt(j);
+            let terms2 = item.terms();
+            for (let j = 0, k = terms2.size(); j < k; j++) {
+                let termPair = terms2.itemAt(j);
                 terms.setDefault(termPair.first, factory).second += termPair.second;
             }
         }
@@ -135,8 +135,8 @@ function parseArgs(args) {
             if (item.length !== 2) {
                 throw new Error('array must have length 2');
             }
-            var value = item[0];
-            var value2 = item[1];
+            let value = item[0];
+            let value2 = item[1];
             if (typeof value !== 'number') {
                 throw new Error('array item 0 must be a number');
             }
@@ -145,9 +145,9 @@ function parseArgs(args) {
             }
             else if (value2 instanceof Expression) {
                 constant += value2.constant() * value;
-                var terms2 = value2.terms();
-                for (var j = 0, k = terms2.size(); j < k; j++) {
-                    var termPair = terms2.itemAt(j);
+                let terms2 = value2.terms();
+                for (let j = 0, k = terms2.size(); j < k; j++) {
+                    let termPair = terms2.itemAt(j);
                     terms.setDefault(termPair.first, factory).second += termPair.second * value;
                 }
             }
@@ -159,5 +159,5 @@ function parseArgs(args) {
             throw new Error('invalid Expression argument: ' + item);
         }
     }
-    return { terms: terms, constant: constant };
+    return { terms, constant };
 }
diff --git a/es/kiwi.d.ts b/dist/kiwi.d.ts
similarity index 100%
rename from es/kiwi.d.ts
rename to dist/kiwi.d.ts
diff --git a/es/kiwi.d.ts.map b/dist/kiwi.d.ts.map
similarity index 100%
rename from es/kiwi.d.ts.map
rename to dist/kiwi.d.ts.map
diff --git a/es/kiwi.js b/dist/kiwi.js
similarity index 100%
rename from es/kiwi.js
rename to dist/kiwi.js
diff --git a/es/maptype.d.ts b/dist/maptype.d.ts
similarity index 100%
rename from es/maptype.d.ts
rename to dist/maptype.d.ts
diff --git a/es/maptype.d.ts.map b/dist/maptype.d.ts.map
similarity index 100%
rename from es/maptype.d.ts.map
rename to dist/maptype.d.ts.map
diff --git a/es/maptype.js b/dist/maptype.js
similarity index 68%
rename from es/maptype.js
rename to dist/maptype.js
index e9b58d8..825f91c 100644
--- a/es/maptype.js
+++ b/dist/maptype.js
@@ -1,48 +1,46 @@
 export function createMap() {
     return new IndexedMap();
 }
-var IndexedMap = /** @class */ (function () {
-    function IndexedMap() {
-        this.index = {};
-        this.array = [];
-    }
+class IndexedMap {
+    index = {};
+    array = [];
     /**
      * Returns the number of items in the array.
      */
-    IndexedMap.prototype.size = function () {
+    size() {
         return this.array.length;
-    };
+    }
     /**
      * Returns true if the array is empty.
      */
-    IndexedMap.prototype.empty = function () {
+    empty() {
         return this.array.length === 0;
-    };
+    }
     /**
      * Returns the item at the given array index.
      *
      * @param index The integer index of the desired item.
      */
-    IndexedMap.prototype.itemAt = function (index) {
+    itemAt(index) {
         return this.array[index];
-    };
+    }
     /**
      * Returns true if the key is in the array, false otherwise.
      *
      * @param key The key to locate in the array.
      */
-    IndexedMap.prototype.contains = function (key) {
+    contains(key) {
         return this.index[key.id()] !== undefined;
-    };
+    }
     /**
      * Returns the pair associated with the given key, or undefined.
      *
      * @param key The key to locate in the array.
      */
-    IndexedMap.prototype.find = function (key) {
-        var i = this.index[key.id()];
+    find(key) {
+        const i = this.index[key.id()];
         return i === undefined ? undefined : this.array[i];
-    };
+    }
     /**
      * Returns the pair associated with the key if it exists.
      *
@@ -52,10 +50,10 @@ var IndexedMap = /** @class */ (function () {
      * @param key The key to locate in the array.
      * @param factory The function which creates the default value.
      */
-    IndexedMap.prototype.setDefault = function (key, factory) {
-        var i = this.index[key.id()];
+    setDefault(key, factory) {
+        const i = this.index[key.id()];
         if (i === undefined) {
-            var pair = new Pair(key, factory());
+            const pair = new Pair(key, factory());
             this.index[key.id()] = this.array.length;
             this.array.push(pair);
             return pair;
@@ -63,7 +61,7 @@ var IndexedMap = /** @class */ (function () {
         else {
             return this.array[i];
         }
-    };
+    }
     /**
      * Insert the pair into the array and return the pair.
      *
@@ -72,9 +70,9 @@ var IndexedMap = /** @class */ (function () {
      * @param key The key portion of the pair.
      * @param value The value portion of the pair.
      */
-    IndexedMap.prototype.insert = function (key, value) {
-        var pair = new Pair(key, value);
-        var i = this.index[key.id()];
+    insert(key, value) {
+        const pair = new Pair(key, value);
+        const i = this.index[key.id()];
         if (i === undefined) {
             this.index[key.id()] = this.array.length;
             this.array.push(pair);
@@ -83,61 +81,61 @@ var IndexedMap = /** @class */ (function () {
             this.array[i] = pair;
         }
         return pair;
-    };
+    }
     /**
      * Removes and returns the pair for the given key, or undefined.
      *
      * @param key The key to remove from the map.
      */
-    IndexedMap.prototype.erase = function (key) {
-        var i = this.index[key.id()];
+    erase(key) {
+        const i = this.index[key.id()];
         if (i === undefined) {
             return undefined;
         }
         this.index[key.id()] = undefined;
-        var pair = this.array[i];
-        var last = this.array.pop();
+        const pair = this.array[i];
+        const last = this.array.pop();
         if (pair !== last) {
             this.array[i] = last;
             this.index[last.first.id()] = i;
         }
         return pair;
-    };
+    }
     /**
      * Create a copy of this associative array.
      */
-    IndexedMap.prototype.copy = function () {
-        var copy = new IndexedMap();
-        for (var i = 0; i < this.array.length; i++) {
-            var pair = this.array[i].copy();
+    copy() {
+        const copy = new IndexedMap();
+        for (let i = 0; i < this.array.length; i++) {
+            const pair = this.array[i].copy();
             copy.array[i] = pair;
             copy.index[pair.first.id()] = i;
         }
         return copy;
-    };
-    return IndexedMap;
-}());
+    }
+}
 /**
  * A class which defines a generic pair object.
  * @private
  */
 // tslint:disable: max-classes-per-file
-var Pair = /** @class */ (function () {
+class Pair {
+    first;
+    second;
     /**
      * Construct a new Pair object.
      *
      * @param first The first item of the pair.
      * @param second The second item of the pair.
      */
-    function Pair(first, second) {
+    constructor(first, second) {
         this.first = first;
         this.second = second;
     }
     /**
      * Create a copy of the pair.
      */
-    Pair.prototype.copy = function () {
+    copy() {
         return new Pair(this.first, this.second);
-    };
-    return Pair;
-}());
+    }
+}
diff --git a/es/solver.d.ts b/dist/solver.d.ts
similarity index 100%
rename from es/solver.d.ts
rename to dist/solver.d.ts
diff --git a/es/solver.d.ts.map b/dist/solver.d.ts.map
similarity index 100%
rename from es/solver.d.ts.map
rename to dist/solver.d.ts.map
diff --git a/es/solver.js b/dist/solver.js
similarity index 70%
rename from es/solver.js
rename to dist/solver.js
index 8f7dcfc..02419da 100644
--- a/es/solver.js
+++ b/dist/solver.js
@@ -7,25 +7,16 @@ import { Strength } from './strength.js';
  *
  * @class
  */
-var Solver = /** @class */ (function () {
+export class Solver {
+    /**
+     * @type {number} - The max number of solver iterations before an error
+     * is thrown, in order to prevent infinite iteration. Default: `10,000`.
+     */
+    maxIterations = 1000;
     /**
      * Construct a new Solver.
      */
-    function Solver() {
-        /**
-         * @type {number} - The max number of solver iterations before an error
-         * is thrown, in order to prevent infinite iteration. Default: `10,000`.
-         */
-        this.maxIterations = 1000;
-        this._cnMap = createCnMap();
-        this._rowMap = createRowMap();
-        this._varMap = createVarMap();
-        this._editMap = createEditMap();
-        this._infeasibleRows = [];
-        this._objective = new Row();
-        this._artificial = null;
-        this._idTick = 0;
-    }
+    constructor() { }
     /**
      * Creates and add a constraint to the solver.
      *
@@ -34,19 +25,18 @@ var Solver = /** @class */ (function () {
      * @param {Expression|Variable|Number} rhs Right hand side of the expression
      * @param {Number} [strength=Strength.required] Strength
      */
-    Solver.prototype.createConstraint = function (lhs, operator, rhs, strength) {
-        if (strength === void 0) { strength = Strength.required; }
-        var cn = new Constraint(lhs, operator, rhs, strength);
+    createConstraint(lhs, operator, rhs, strength = Strength.required) {
+        let cn = new Constraint(lhs, operator, rhs, strength);
         this.addConstraint(cn);
         return cn;
-    };
+    }
     /**
      * Add a constraint to the solver.
      *
      * @param {Constraint} constraint Constraint to add to the solver
      */
-    Solver.prototype.addConstraint = function (constraint) {
-        var cnPair = this._cnMap.find(constraint);
+    addConstraint(constraint) {
+        let cnPair = this._cnMap.find(constraint);
         if (cnPair !== undefined) {
             throw new Error('duplicate constraint');
         }
@@ -56,10 +46,10 @@ var Solver = /** @class */ (function () {
         // Since its likely that those variables will be used in other
         // constraints and since exceptional conditions are uncommon,
         // i'm not too worried about aggressive cleanup of the var map.
-        var data = this._createRow(constraint);
-        var row = data.row;
-        var tag = data.tag;
-        var subject = this._chooseSubject(row, tag);
+        let data = this._createRow(constraint);
+        let row = data.row;
+        let tag = data.tag;
+        let subject = this._chooseSubject(row, tag);
         // If chooseSubject couldnt find a valid entering symbol, one
         // last option is available if the entire row is composed of
         // dummy variables. If the constant of the row is zero, then
@@ -92,14 +82,14 @@ var Solver = /** @class */ (function () {
         // aggregate work due to a smaller average system size. It
         // also ensures the solver remains in a consistent state.
         this._optimize(this._objective);
-    };
+    }
     /**
      * Remove a constraint from the solver.
      *
      * @param {Constraint} constraint Constraint to remove from the solver
      */
-    Solver.prototype.removeConstraint = function (constraint) {
-        var cnPair = this._cnMap.erase(constraint);
+    removeConstraint(constraint) {
+        let cnPair = this._cnMap.erase(constraint);
         if (cnPair === undefined) {
             throw new Error('unknown constraint');
         }
@@ -109,10 +99,10 @@ var Solver = /** @class */ (function () {
         this._removeConstraintEffects(constraint, cnPair.second);
         // If the marker is basic, simply drop the row. Otherwise,
         // pivot the marker into the basis and then drop the row.
-        var marker = cnPair.second.marker;
-        var rowPair = this._rowMap.erase(marker);
+        let marker = cnPair.second.marker;
+        let rowPair = this._rowMap.erase(marker);
         if (rowPair === undefined) {
-            var leaving = this._getMarkerLeavingSymbol(marker);
+            let leaving = this._getMarkerLeavingSymbol(marker);
             if (leaving.type() === SymbolType.Invalid) {
                 throw new Error('failed to find leaving row');
             }
@@ -124,24 +114,24 @@ var Solver = /** @class */ (function () {
         // solver remains consistent. It makes the solver api easier to
         // use at a small tradeoff for speed.
         this._optimize(this._objective);
-    };
+    }
     /**
      * Test whether the solver contains the constraint.
      *
      * @param {Constraint} constraint Constraint to test for
      * @return {Bool} true or false
      */
-    Solver.prototype.hasConstraint = function (constraint) {
+    hasConstraint(constraint) {
         return this._cnMap.contains(constraint);
-    };
+    }
     /**
      * Add an edit variable to the solver.
      *
      * @param {Variable} variable Edit variable to add to the solver
      * @param {Number} strength Strength, should be less than `Strength.required`
      */
-    Solver.prototype.addEditVariable = function (variable, strength) {
-        var editPair = this._editMap.find(variable);
+    addEditVariable(variable, strength) {
+        let editPair = this._editMap.find(variable);
         if (editPair !== undefined) {
             throw new Error('duplicate edit variable');
         }
@@ -149,52 +139,52 @@ var Solver = /** @class */ (function () {
         if (strength === Strength.required) {
             throw new Error('bad required strength');
         }
-        var expr = new Expression(variable);
-        var cn = new Constraint(expr, Operator.Eq, undefined, strength);
+        let expr = new Expression(variable);
+        let cn = new Constraint(expr, Operator.Eq, undefined, strength);
         this.addConstraint(cn);
-        var tag = this._cnMap.find(cn).second;
-        var info = { tag: tag, constraint: cn, constant: 0.0 };
+        let tag = this._cnMap.find(cn).second;
+        let info = { tag, constraint: cn, constant: 0.0 };
         this._editMap.insert(variable, info);
-    };
+    }
     /**
      * Remove an edit variable from the solver.
      *
      * @param {Variable} variable Edit variable to remove from the solver
      */
-    Solver.prototype.removeEditVariable = function (variable) {
-        var editPair = this._editMap.erase(variable);
+    removeEditVariable(variable) {
+        let editPair = this._editMap.erase(variable);
         if (editPair === undefined) {
             throw new Error('unknown edit variable');
         }
         this.removeConstraint(editPair.second.constraint);
-    };
+    }
     /**
      * Test whether the solver contains the edit variable.
      *
      * @param {Variable} variable Edit variable to test for
      * @return {Bool} true or false
      */
-    Solver.prototype.hasEditVariable = function (variable) {
+    hasEditVariable(variable) {
         return this._editMap.contains(variable);
-    };
+    }
     /**
      * Suggest the value of an edit variable.
      *
      * @param {Variable} variable Edit variable to suggest a value for
      * @param {Number} value Suggested value
      */
-    Solver.prototype.suggestValue = function (variable, value) {
-        var editPair = this._editMap.find(variable);
+    suggestValue(variable, value) {
+        let editPair = this._editMap.find(variable);
         if (editPair === undefined) {
             throw new Error('unknown edit variable');
         }
-        var rows = this._rowMap;
-        var info = editPair.second;
-        var delta = value - info.constant;
+        let rows = this._rowMap;
+        let info = editPair.second;
+        let delta = value - info.constant;
         info.constant = value;
         // Check first if the positive error variable is basic.
-        var marker = info.tag.marker;
-        var rowPair = rows.find(marker);
+        let marker = info.tag.marker;
+        let rowPair = rows.find(marker);
         if (rowPair !== undefined) {
             if (rowPair.second.add(-delta) < 0.0) {
                 this._infeasibleRows.push(marker);
@@ -203,7 +193,7 @@ var Solver = /** @class */ (function () {
             return;
         }
         // Check next if the negative error variable is basic.
-        var other = info.tag.other;
+        let other = info.tag.other;
         rowPair = rows.find(other);
         if (rowPair !== undefined) {
             if (rowPair.second.add(delta) < 0.0) {
@@ -213,25 +203,25 @@ var Solver = /** @class */ (function () {
             return;
         }
         // Otherwise update each row where the error variables exist.
-        for (var i = 0, n = rows.size(); i < n; ++i) {
-            var rowPair_1 = rows.itemAt(i);
-            var row = rowPair_1.second;
-            var coeff = row.coefficientFor(marker);
-            if (coeff !== 0.0 && row.add(delta * coeff) < 0.0 && rowPair_1.first.type() !== SymbolType.External) {
-                this._infeasibleRows.push(rowPair_1.first);
+        for (let i = 0, n = rows.size(); i < n; ++i) {
+            let rowPair = rows.itemAt(i);
+            let row = rowPair.second;
+            let coeff = row.coefficientFor(marker);
+            if (coeff !== 0.0 && row.add(delta * coeff) < 0.0 && rowPair.first.type() !== SymbolType.External) {
+                this._infeasibleRows.push(rowPair.first);
             }
         }
         this._dualOptimize();
-    };
+    }
     /**
      * Update the values of the variables.
      */
-    Solver.prototype.updateVariables = function () {
-        var vars = this._varMap;
-        var rows = this._rowMap;
-        for (var i = 0, n = vars.size(); i < n; ++i) {
-            var pair = vars.itemAt(i);
-            var rowPair = rows.find(pair.second);
+    updateVariables() {
+        let vars = this._varMap;
+        let rows = this._rowMap;
+        for (let i = 0, n = vars.size(); i < n; ++i) {
+            let pair = vars.itemAt(i);
+            let rowPair = rows.find(pair.second);
             if (rowPair !== undefined) {
                 pair.first.setValue(rowPair.second.constant());
             }
@@ -239,18 +229,17 @@ var Solver = /** @class */ (function () {
                 pair.first.setValue(0.0);
             }
         }
-    };
+    }
     /**
      * Get the symbol for the given variable.
      *
      * If a symbol does not exist for the variable, one will be created.
      * @private
      */
-    Solver.prototype._getVarSymbol = function (variable) {
-        var _this = this;
-        var factory = function () { return _this._makeSymbol(SymbolType.External); };
+    _getVarSymbol(variable) {
+        let factory = () => this._makeSymbol(SymbolType.External);
         return this._varMap.setDefault(variable, factory).second;
-    };
+    }
     /**
      * Create a new Row object for the given constraint.
      *
@@ -268,16 +257,16 @@ var Solver = /** @class */ (function () {
      * Returns the created Row and the tag for tracking the constraint.
      * @private
      */
-    Solver.prototype._createRow = function (constraint) {
-        var expr = constraint.expression();
-        var row = new Row(expr.constant());
+    _createRow(constraint) {
+        let expr = constraint.expression();
+        let row = new Row(expr.constant());
         // Substitute the current basic variables into the row.
-        var terms = expr.terms();
-        for (var i = 0, n = terms.size(); i < n; ++i) {
-            var termPair = terms.itemAt(i);
+        let terms = expr.terms();
+        for (let i = 0, n = terms.size(); i < n; ++i) {
+            let termPair = terms.itemAt(i);
             if (!nearZero(termPair.second)) {
-                var symbol = this._getVarSymbol(termPair.first);
-                var basicPair = this._rowMap.find(symbol);
+                let symbol = this._getVarSymbol(termPair.first);
+                let basicPair = this._rowMap.find(symbol);
                 if (basicPair !== undefined) {
                     row.insertRow(basicPair.second, termPair.second);
                 }
@@ -287,18 +276,18 @@ var Solver = /** @class */ (function () {
             }
         }
         // Add the necessary slack, error, and dummy variables.
-        var objective = this._objective;
-        var strength = constraint.strength();
-        var tag = { marker: INVALID_SYMBOL, other: INVALID_SYMBOL };
+        let objective = this._objective;
+        let strength = constraint.strength();
+        let tag = { marker: INVALID_SYMBOL, other: INVALID_SYMBOL };
         switch (constraint.op()) {
             case Operator.Le:
             case Operator.Ge: {
-                var coeff = constraint.op() === Operator.Le ? 1.0 : -1.0;
-                var slack = this._makeSymbol(SymbolType.Slack);
+                let coeff = constraint.op() === Operator.Le ? 1.0 : -1.0;
+                let slack = this._makeSymbol(SymbolType.Slack);
                 tag.marker = slack;
                 row.insertSymbol(slack, coeff);
                 if (strength < Strength.required) {
-                    var error = this._makeSymbol(SymbolType.Error);
+                    let error = this._makeSymbol(SymbolType.Error);
                     tag.other = error;
                     row.insertSymbol(error, -coeff);
                     objective.insertSymbol(error, strength);
@@ -307,8 +296,8 @@ var Solver = /** @class */ (function () {
             }
             case Operator.Eq: {
                 if (strength < Strength.required) {
-                    var errplus = this._makeSymbol(SymbolType.Error);
-                    var errminus = this._makeSymbol(SymbolType.Error);
+                    let errplus = this._makeSymbol(SymbolType.Error);
+                    let errminus = this._makeSymbol(SymbolType.Error);
                     tag.marker = errplus;
                     tag.other = errminus;
                     row.insertSymbol(errplus, -1.0); // v = eplus - eminus
@@ -317,7 +306,7 @@ var Solver = /** @class */ (function () {
                     objective.insertSymbol(errminus, strength);
                 }
                 else {
-                    var dummy = this._makeSymbol(SymbolType.Dummy);
+                    let dummy = this._makeSymbol(SymbolType.Dummy);
                     tag.marker = dummy;
                     row.insertSymbol(dummy);
                 }
@@ -328,8 +317,8 @@ var Solver = /** @class */ (function () {
         if (row.constant() < 0.0) {
             row.reverseSign();
         }
-        return { row: row, tag: tag };
-    };
+        return { row, tag };
+    }
     /**
      * Choose the subject for solving for the row.
      *
@@ -346,15 +335,15 @@ var Solver = /** @class */ (function () {
      *
      * @private
      */
-    Solver.prototype._chooseSubject = function (row, tag) {
-        var cells = row.cells();
-        for (var i = 0, n = cells.size(); i < n; ++i) {
-            var pair = cells.itemAt(i);
+    _chooseSubject(row, tag) {
+        let cells = row.cells();
+        for (let i = 0, n = cells.size(); i < n; ++i) {
+            let pair = cells.itemAt(i);
             if (pair.first.type() === SymbolType.External) {
                 return pair.first;
             }
         }
-        var type = tag.marker.type();
+        let type = tag.marker.type();
         if (type === SymbolType.Slack || type === SymbolType.Error) {
             if (row.coefficientFor(tag.marker) < 0.0) {
                 return tag.marker;
@@ -367,7 +356,7 @@ var Solver = /** @class */ (function () {
             }
         }
         return INVALID_SYMBOL;
-    };
+    }
     /**
      * Add the row to the tableau using an artificial variable.
      *
@@ -375,25 +364,25 @@ var Solver = /** @class */ (function () {
      *
      * @private
      */
-    Solver.prototype._addWithArtificialVariable = function (row) {
+    _addWithArtificialVariable(row) {
         // Create and add the artificial variable to the tableau.
-        var art = this._makeSymbol(SymbolType.Slack);
+        let art = this._makeSymbol(SymbolType.Slack);
         this._rowMap.insert(art, row.copy());
         this._artificial = row.copy();
         // Optimize the artificial objective. This is successful
         // only if the artificial objective is optimized to zero.
         this._optimize(this._artificial);
-        var success = nearZero(this._artificial.constant());
+        let success = nearZero(this._artificial.constant());
         this._artificial = null;
         // If the artificial variable is basic, pivot the row so that
         // it becomes non-basic. If the row is constant, exit early.
-        var pair = this._rowMap.erase(art);
+        let pair = this._rowMap.erase(art);
         if (pair !== undefined) {
-            var basicRow = pair.second;
+            let basicRow = pair.second;
             if (basicRow.isConstant()) {
                 return success;
             }
-            var entering = this._anyPivotableSymbol(basicRow);
+            let entering = this._anyPivotableSymbol(basicRow);
             if (entering.type() === SymbolType.Invalid) {
                 return false; // unsatisfiable (will this ever happen?)
             }
@@ -402,13 +391,13 @@ var Solver = /** @class */ (function () {
             this._rowMap.insert(entering, basicRow);
         }
         // Remove the artificial variable from the tableau.
-        var rows = this._rowMap;
-        for (var i = 0, n = rows.size(); i < n; ++i) {
+        let rows = this._rowMap;
+        for (let i = 0, n = rows.size(); i < n; ++i) {
             rows.itemAt(i).second.removeSymbol(art);
         }
         this._objective.removeSymbol(art);
         return success;
-    };
+    }
     /**
      * Substitute the parametric symbol with the given row.
      *
@@ -417,10 +406,10 @@ var Solver = /** @class */ (function () {
      *
      * @private
      */
-    Solver.prototype._substitute = function (symbol, row) {
-        var rows = this._rowMap;
-        for (var i = 0, n = rows.size(); i < n; ++i) {
-            var pair = rows.itemAt(i);
+    _substitute(symbol, row) {
+        let rows = this._rowMap;
+        for (let i = 0, n = rows.size(); i < n; ++i) {
+            let pair = rows.itemAt(i);
             pair.second.substitute(symbol, row);
             if (pair.second.constant() < 0.0 && pair.first.type() !== SymbolType.External) {
                 this._infeasibleRows.push(pair.first);
@@ -430,7 +419,7 @@ var Solver = /** @class */ (function () {
         if (this._artificial) {
             this._artificial.substitute(symbol, row);
         }
-    };
+    }
     /**
      * Optimize the system for the given objective function.
      *
@@ -439,26 +428,26 @@ var Solver = /** @class */ (function () {
      *
      * @private
      */
-    Solver.prototype._optimize = function (objective) {
-        var iterations = 0;
+    _optimize(objective) {
+        let iterations = 0;
         while (iterations < this.maxIterations) {
-            var entering = this._getEnteringSymbol(objective);
+            let entering = this._getEnteringSymbol(objective);
             if (entering.type() === SymbolType.Invalid) {
                 return;
             }
-            var leaving = this._getLeavingSymbol(entering);
+            let leaving = this._getLeavingSymbol(entering);
             if (leaving.type() === SymbolType.Invalid) {
                 throw new Error('the objective is unbounded');
             }
             // pivot the entering symbol into the basis
-            var row = this._rowMap.erase(leaving).second;
+            let row = this._rowMap.erase(leaving).second;
             row.solveForEx(leaving, entering);
             this._substitute(entering, row);
             this._rowMap.insert(entering, row);
             iterations++;
         }
         throw new Error('solver iterations exceeded');
-    };
+    }
     /**
      * Optimize the system using the dual of the simplex method.
      *
@@ -469,26 +458,26 @@ var Solver = /** @class */ (function () {
      *
      * @private
      */
-    Solver.prototype._dualOptimize = function () {
-        var rows = this._rowMap;
-        var infeasible = this._infeasibleRows;
+    _dualOptimize() {
+        let rows = this._rowMap;
+        let infeasible = this._infeasibleRows;
         while (infeasible.length !== 0) {
-            var leaving = infeasible.pop();
-            var pair = rows.find(leaving);
+            let leaving = infeasible.pop();
+            let pair = rows.find(leaving);
             if (pair !== undefined && pair.second.constant() < 0.0) {
-                var entering = this._getDualEnteringSymbol(pair.second);
+                let entering = this._getDualEnteringSymbol(pair.second);
                 if (entering.type() === SymbolType.Invalid) {
                     throw new Error('dual optimize failed');
                 }
                 // pivot the entering symbol into the basis
-                var row = pair.second;
+                let row = pair.second;
                 rows.erase(leaving);
                 row.solveForEx(leaving, entering);
                 this._substitute(entering, row);
                 rows.insert(entering, row);
             }
         }
-    };
+    }
     /**
      * Compute the entering variable for a pivot operation.
      *
@@ -499,17 +488,17 @@ var Solver = /** @class */ (function () {
      *
      * @private
      */
-    Solver.prototype._getEnteringSymbol = function (objective) {
-        var cells = objective.cells();
-        for (var i = 0, n = cells.size(); i < n; ++i) {
-            var pair = cells.itemAt(i);
-            var symbol = pair.first;
+    _getEnteringSymbol(objective) {
+        let cells = objective.cells();
+        for (let i = 0, n = cells.size(); i < n; ++i) {
+            let pair = cells.itemAt(i);
+            let symbol = pair.first;
             if (pair.second < 0.0 && symbol.type() !== SymbolType.Dummy) {
                 return symbol;
             }
         }
         return INVALID_SYMBOL;
-    };
+    }
     /**
      * Compute the entering symbol for the dual optimize operation.
      *
@@ -521,17 +510,17 @@ var Solver = /** @class */ (function () {
      *
      * @private
      */
-    Solver.prototype._getDualEnteringSymbol = function (row) {
-        var ratio = Number.MAX_VALUE;
-        var entering = INVALID_SYMBOL;
-        var cells = row.cells();
-        for (var i = 0, n = cells.size(); i < n; ++i) {
-            var pair = cells.itemAt(i);
-            var symbol = pair.first;
-            var c = pair.second;
+    _getDualEnteringSymbol(row) {
+        let ratio = Number.MAX_VALUE;
+        let entering = INVALID_SYMBOL;
+        let cells = row.cells();
+        for (let i = 0, n = cells.size(); i < n; ++i) {
+            let pair = cells.itemAt(i);
+            let symbol = pair.first;
+            let c = pair.second;
             if (c > 0.0 && symbol.type() !== SymbolType.Dummy) {
-                var coeff = this._objective.coefficientFor(symbol);
-                var r = coeff / c;
+                let coeff = this._objective.coefficientFor(symbol);
+                let r = coeff / c;
                 if (r < ratio) {
                     ratio = r;
                     entering = symbol;
@@ -539,7 +528,7 @@ var Solver = /** @class */ (function () {
             }
         }
         return entering;
-    };
+    }
     /**
      * Compute the symbol for pivot exit row.
      *
@@ -550,18 +539,18 @@ var Solver = /** @class */ (function () {
      *
      * @private
      */
-    Solver.prototype._getLeavingSymbol = function (entering) {
-        var ratio = Number.MAX_VALUE;
-        var found = INVALID_SYMBOL;
-        var rows = this._rowMap;
-        for (var i = 0, n = rows.size(); i < n; ++i) {
-            var pair = rows.itemAt(i);
-            var symbol = pair.first;
+    _getLeavingSymbol(entering) {
+        let ratio = Number.MAX_VALUE;
+        let found = INVALID_SYMBOL;
+        let rows = this._rowMap;
+        for (let i = 0, n = rows.size(); i < n; ++i) {
+            let pair = rows.itemAt(i);
+            let symbol = pair.first;
             if (symbol.type() !== SymbolType.External) {
-                var row = pair.second;
-                var temp = row.coefficientFor(entering);
+                let row = pair.second;
+                let temp = row.coefficientFor(entering);
                 if (temp < 0.0) {
-                    var temp_ratio = -row.constant() / temp;
+                    let temp_ratio = -row.constant() / temp;
                     if (temp_ratio < ratio) {
                         ratio = temp_ratio;
                         found = symbol;
@@ -570,7 +559,7 @@ var Solver = /** @class */ (function () {
             }
         }
         return found;
-    };
+    }
     /**
      * Compute the leaving symbol for a marker variable.
      *
@@ -592,35 +581,35 @@ var Solver = /** @class */ (function () {
      *
      * @private
      */
-    Solver.prototype._getMarkerLeavingSymbol = function (marker) {
-        var dmax = Number.MAX_VALUE;
-        var r1 = dmax;
-        var r2 = dmax;
-        var invalid = INVALID_SYMBOL;
-        var first = invalid;
-        var second = invalid;
-        var third = invalid;
-        var rows = this._rowMap;
-        for (var i = 0, n = rows.size(); i < n; ++i) {
-            var pair = rows.itemAt(i);
-            var row = pair.second;
-            var c = row.coefficientFor(marker);
+    _getMarkerLeavingSymbol(marker) {
+        let dmax = Number.MAX_VALUE;
+        let r1 = dmax;
+        let r2 = dmax;
+        let invalid = INVALID_SYMBOL;
+        let first = invalid;
+        let second = invalid;
+        let third = invalid;
+        let rows = this._rowMap;
+        for (let i = 0, n = rows.size(); i < n; ++i) {
+            let pair = rows.itemAt(i);
+            let row = pair.second;
+            let c = row.coefficientFor(marker);
             if (c === 0.0) {
                 continue;
             }
-            var symbol = pair.first;
+            let symbol = pair.first;
             if (symbol.type() === SymbolType.External) {
                 third = symbol;
             }
             else if (c < 0.0) {
-                var r = -row.constant() / c;
+                let r = -row.constant() / c;
                 if (r < r1) {
                     r1 = r;
                     first = symbol;
                 }
             }
             else {
-                var r = row.constant() / c;
+                let r = row.constant() / c;
                 if (r < r2) {
                     r2 = r;
                     second = symbol;
@@ -634,34 +623,34 @@ var Solver = /** @class */ (function () {
             return second;
         }
         return third;
-    };
+    }
     /**
      * Remove the effects of a constraint on the objective function.
      *
      * @private
      */
-    Solver.prototype._removeConstraintEffects = function (cn, tag) {
+    _removeConstraintEffects(cn, tag) {
         if (tag.marker.type() === SymbolType.Error) {
             this._removeMarkerEffects(tag.marker, cn.strength());
         }
         if (tag.other.type() === SymbolType.Error) {
             this._removeMarkerEffects(tag.other, cn.strength());
         }
-    };
+    }
     /**
      * Remove the effects of an error marker on the objective function.
      *
      * @private
      */
-    Solver.prototype._removeMarkerEffects = function (marker, strength) {
-        var pair = this._rowMap.find(marker);
+    _removeMarkerEffects(marker, strength) {
+        let pair = this._rowMap.find(marker);
         if (pair !== undefined) {
             this._objective.insertRow(pair.second, -strength);
         }
         else {
             this._objective.insertSymbol(marker, -strength);
         }
-    };
+    }
     /**
      * Get the first Slack or Error symbol in the row.
      *
@@ -669,34 +658,40 @@ var Solver = /** @class */ (function () {
      *
      * @private
      */
-    Solver.prototype._anyPivotableSymbol = function (row) {
-        var cells = row.cells();
-        for (var i = 0, n = cells.size(); i < n; ++i) {
-            var pair = cells.itemAt(i);
-            var type = pair.first.type();
+    _anyPivotableSymbol(row) {
+        let cells = row.cells();
+        for (let i = 0, n = cells.size(); i < n; ++i) {
+            let pair = cells.itemAt(i);
+            let type = pair.first.type();
             if (type === SymbolType.Slack || type === SymbolType.Error) {
                 return pair.first;
             }
         }
         return INVALID_SYMBOL;
-    };
+    }
     /**
      * Returns a new Symbol of the given type.
      *
      * @private
      */
-    Solver.prototype._makeSymbol = function (type) {
+    _makeSymbol(type) {
         return new Symbol(type, this._idTick++);
-    };
-    return Solver;
-}());
-export { Solver };
+    }
+    _cnMap = createCnMap();
+    _rowMap = createRowMap();
+    _varMap = createVarMap();
+    _editMap = createEditMap();
+    _infeasibleRows = [];
+    _objective = new Row();
+    _artificial = null;
+    _idTick = 0;
+}
 /**
  * Test whether a value is approximately zero.
  * @private
  */
 function nearZero(value) {
-    var eps = 1.0e-8;
+    let eps = 1.0e-8;
     return value < 0.0 ? -value < eps : value < eps;
 }
 /**
@@ -743,96 +738,95 @@ var SymbolType;
  * An internal class representing a symbol in the solver.
  * @private
  */
-var Symbol = /** @class */ (function () {
+class Symbol {
     /**
      * Construct a new Symbol
      *
      * @param [type] The type of the symbol.
      * @param [id] The unique id number of the symbol.
      */
-    function Symbol(type, id) {
+    constructor(type, id) {
         this._id = id;
         this._type = type;
     }
     /**
      * Returns the unique id number of the symbol.
      */
-    Symbol.prototype.id = function () {
+    id() {
         return this._id;
-    };
+    }
     /**
      * Returns the type of the symbol.
      */
-    Symbol.prototype.type = function () {
+    type() {
         return this._type;
-    };
-    return Symbol;
-}());
+    }
+    _id;
+    _type;
+}
 /**
  * A static invalid symbol
  * @private
  */
-var INVALID_SYMBOL = new Symbol(SymbolType.Invalid, -1);
+let INVALID_SYMBOL = new Symbol(SymbolType.Invalid, -1);
 /**
  * An internal row class used by the solver.
  * @private
  */
-var Row = /** @class */ (function () {
+class Row {
     /**
      * Construct a new Row.
      */
-    function Row(constant) {
-        if (constant === void 0) { constant = 0.0; }
-        this._cellMap = createMap();
+    constructor(constant = 0.0) {
         this._constant = constant;
     }
     /**
      * Returns the mapping of symbols to coefficients.
      */
-    Row.prototype.cells = function () {
+    cells() {
         return this._cellMap;
-    };
+    }
     /**
      * Returns the constant for the row.
      */
-    Row.prototype.constant = function () {
+    constant() {
         return this._constant;
-    };
+    }
     /**
      * Returns true if the row is a constant value.
      */
-    Row.prototype.isConstant = function () {
+    isConstant() {
         return this._cellMap.empty();
-    };
+    }
     /**
      * Returns true if the Row has all dummy symbols.
      */
-    Row.prototype.allDummies = function () {
-        var cells = this._cellMap;
-        for (var i = 0, n = cells.size(); i < n; ++i) {
-            var pair = cells.itemAt(i);
+    allDummies() {
+        let cells = this._cellMap;
+        for (let i = 0, n = cells.size(); i < n; ++i) {
+            let pair = cells.itemAt(i);
             if (pair.first.type() !== SymbolType.Dummy) {
                 return false;
             }
         }
         return true;
-    };
+    }
     /**
      * Create a copy of the row.
      */
-    Row.prototype.copy = function () {
-        var theCopy = new Row(this._constant);
+    copy() {
+        let theCopy = new Row(this._constant);
         theCopy._cellMap = this._cellMap.copy();
         return theCopy;
-    };
+    }
     /**
      * Add a constant value to the row constant.
      *
      * Returns the new value of the constant.
      */
-    Row.prototype.add = function (value) {
+    add(value) {
         return (this._constant += value);
-    };
+    }
     /**
      * Insert the symbol into the row with the given coefficient.
      *
@@ -840,13 +834,12 @@ var Row = /** @class */ (function () {
      * will be added to the existing coefficient. If the resulting
      * coefficient is zero, the symbol will be removed from the row.
      */
-    Row.prototype.insertSymbol = function (symbol, coefficient) {
-        if (coefficient === void 0) { coefficient = 1.0; }
-        var pair = this._cellMap.setDefault(symbol, function () { return 0.0; });
+    insertSymbol(symbol, coefficient = 1.0) {
+        let pair = this._cellMap.setDefault(symbol, () => 0.0);
         if (nearZero((pair.second += coefficient))) {
             this._cellMap.erase(symbol);
         }
-    };
+    }
     /**
      * Insert a row into this row with a given coefficient.
      *
@@ -855,32 +848,31 @@ var Row = /** @class */ (function () {
      * cell with a resulting coefficient of zero will be removed
      * from the row.
      */
-    Row.prototype.insertRow = function (other, coefficient) {
-        if (coefficient === void 0) { coefficient = 1.0; }
+    insertRow(other, coefficient = 1.0) {
         this._constant += other._constant * coefficient;
-        var cells = other._cellMap;
-        for (var i = 0, n = cells.size(); i < n; ++i) {
-            var pair = cells.itemAt(i);
+        let cells = other._cellMap;
+        for (let i = 0, n = cells.size(); i < n; ++i) {
+            let pair = cells.itemAt(i);
             this.insertSymbol(pair.first, pair.second * coefficient);
         }
-    };
+    }
     /**
      * Remove a symbol from the row.
      */
-    Row.prototype.removeSymbol = function (symbol) {
+    removeSymbol(symbol) {
         this._cellMap.erase(symbol);
-    };
+    }
     /**
      * Reverse the sign of the constant and cells in the row.
      */
-    Row.prototype.reverseSign = function () {
+    reverseSign() {
         this._constant = -this._constant;
-        var cells = this._cellMap;
-        for (var i = 0, n = cells.size(); i < n; ++i) {
-            var pair = cells.itemAt(i);
+        let cells = this._cellMap;
+        for (let i = 0, n = cells.size(); i < n; ++i) {
+            let pair = cells.itemAt(i);
             pair.second = -pair.second;
         }
-    };
+    }
     /**
      * Solve the row for the given symbol.
      *
@@ -893,15 +885,15 @@ var Row = /** @class */ (function () {
      *
      * The given symbol *must* exist in the row.
      */
-    Row.prototype.solveFor = function (symbol) {
-        var cells = this._cellMap;
-        var pair = cells.erase(symbol);
-        var coeff = -1.0 / pair.second;
+    solveFor(symbol) {
+        let cells = this._cellMap;
+        let pair = cells.erase(symbol);
+        let coeff = -1.0 / pair.second;
         this._constant *= coeff;
-        for (var i = 0, n = cells.size(); i < n; ++i) {
+        for (let i = 0, n = cells.size(); i < n; ++i) {
             cells.itemAt(i).second *= coeff;
         }
-    };
+    }
     /**
      * Solve the row for the given symbols.
      *
@@ -914,17 +906,17 @@ var Row = /** @class */ (function () {
      * The lhs symbol *must not* exist in the row, and the rhs
      * symbol must* exist in the row.
      */
-    Row.prototype.solveForEx = function (lhs, rhs) {
+    solveForEx(lhs, rhs) {
         this.insertSymbol(lhs, -1.0);
         this.solveFor(rhs);
-    };
+    }
     /**
      * Returns the coefficient for the given symbol.
      */
-    Row.prototype.coefficientFor = function (symbol) {
-        var pair = this._cellMap.find(symbol);
+    coefficientFor(symbol) {
+        let pair = this._cellMap.find(symbol);
         return pair !== undefined ? pair.second : 0.0;
-    };
+    }
     /**
      * Substitute a symbol with the data from another row.
      *
@@ -934,11 +926,12 @@ var Row = /** @class */ (function () {
      *
      * If the symbol does not exist in the row, this is a no-op.
      */
-    Row.prototype.substitute = function (symbol, row) {
-        var pair = this._cellMap.erase(symbol);
+    substitute(symbol, row) {
+        let pair = this._cellMap.erase(symbol);
         if (pair !== undefined) {
             this.insertRow(row, pair.second);
         }
-    };
-    return Row;
-}());
+    }
+    _cellMap = createMap();
+    _constant;
+}
diff --git a/es/strength.d.ts b/dist/strength.d.ts
similarity index 100%
rename from es/strength.d.ts
rename to dist/strength.d.ts
diff --git a/es/strength.d.ts.map b/dist/strength.d.ts.map
similarity index 100%
rename from es/strength.d.ts.map
rename to dist/strength.d.ts.map
diff --git a/es/strength.js b/dist/strength.js
similarity index 61%
rename from es/strength.js
rename to dist/strength.js
index ebde726..f2d2180 100644
--- a/es/strength.js
+++ b/dist/strength.js
@@ -1,9 +1,7 @@
 /**
  * @class Strength
  */
-var Strength = /** @class */ (function () {
-    function Strength() {
-    }
+export class Strength {
     /**
      * Create a new symbolic strength.
      *
@@ -13,37 +11,34 @@ var Strength = /** @class */ (function () {
      * @param [w] weight
      * @return strength
      */
-    Strength.create = function (a, b, c, w) {
-        if (w === void 0) { w = 1.0; }
-        var result = 0.0;
+    static create(a, b, c, w = 1.0) {
+        let result = 0.0;
         result += Math.max(0.0, Math.min(1000.0, a * w)) * 1000000.0;
         result += Math.max(0.0, Math.min(1000.0, b * w)) * 1000.0;
         result += Math.max(0.0, Math.min(1000.0, c * w));
         return result;
-    };
-    /**
-     * Clip a symbolic strength to the allowed min and max.
-     * @private
-     */
-    Strength.clip = function (value) {
-        return Math.max(0.0, Math.min(Strength.required, value));
-    };
+    }
     /**
      * The 'required' symbolic strength.
      */
-    Strength.required = Strength.create(1000.0, 1000.0, 1000.0);
+    static required = Strength.create(1000.0, 1000.0, 1000.0);
     /**
      * The 'strong' symbolic strength.
      */
-    Strength.strong = Strength.create(1.0, 0.0, 0.0);
+    static strong = Strength.create(1.0, 0.0, 0.0);
     /**
      * The 'medium' symbolic strength.
      */
-    Strength.medium = Strength.create(0.0, 1.0, 0.0);
+    static medium = Strength.create(0.0, 1.0, 0.0);
     /**
      * The 'weak' symbolic strength.
      */
-    Strength.weak = Strength.create(0.0, 0.0, 1.0);
-    return Strength;
-}());
-export { Strength };
+    static weak = Strength.create(0.0, 0.0, 1.0);
+    /**
+     * Clip a symbolic strength to the allowed min and max.
+     * @private
+     */
+    static clip(value) {
+        return Math.max(0.0, Math.min(Strength.required, value));
+    }
+}
diff --git a/es/variable.d.ts b/dist/variable.d.ts
similarity index 100%
rename from es/variable.d.ts
rename to dist/variable.d.ts
diff --git a/es/variable.d.ts.map b/dist/variable.d.ts.map
similarity index 100%
rename from es/variable.d.ts.map
rename to dist/variable.d.ts.map
diff --git a/es/variable.js b/dist/variable.js
similarity index 70%
rename from es/variable.js
rename to dist/variable.js
index 06c137b..0406b80 100644
--- a/es/variable.js
+++ b/dist/variable.js
@@ -5,66 +5,62 @@ import { Expression } from './expression.js';
  * @class
  * @param {String} [name=""] The name to associated with the variable.
  */
-var Variable = /** @class */ (function () {
-    function Variable(name) {
-        if (name === void 0) { name = ''; }
-        this._value = 0.0;
-        this._context = null;
-        this._id = VarId++;
+export class Variable {
+    constructor(name = '') {
         this._name = name;
     }
     /**
      * Returns the unique id number of the variable.
      * @private
      */
-    Variable.prototype.id = function () {
+    id() {
         return this._id;
-    };
+    }
     /**
      * Returns the name of the variable.
      *
      * @return {String} name of the variable
      */
-    Variable.prototype.name = function () {
+    name() {
         return this._name;
-    };
+    }
     /**
      * Set the name of the variable.
      *
      * @param {String} name Name of the variable
      */
-    Variable.prototype.setName = function (name) {
+    setName(name) {
         this._name = name;
-    };
+    }
     /**
      * Returns the user context object of the variable.
      * @private
      */
-    Variable.prototype.context = function () {
+    context() {
         return this._context;
-    };
+    }
     /**
      * Set the user context object of the variable.
      * @private
      */
-    Variable.prototype.setContext = function (context) {
+    setContext(context) {
         this._context = context;
-    };
+    }
     /**
      * Returns the value of the variable.
      *
      * @return {Number} Calculated value
      */
-    Variable.prototype.value = function () {
+    value() {
         return this._value;
-    };
+    }
     /**
      * Set the value of the variable.
      * @private
      */
-    Variable.prototype.setValue = function (value) {
+    setValue(value) {
         this._value = value;
-    };
+    }
     /**
      * Creates a new Expression by adding a number, variable or expression
      * to the variable.
@@ -72,9 +68,9 @@ var Variable = /** @class */ (function () {
      * @param {Number|Variable|Expression} value Value to add.
      * @return {Expression} expression
      */
-    Variable.prototype.plus = function (value) {
+    plus(value) {
         return new Expression(this, value);
-    };
+    }
     /**
      * Creates a new Expression by substracting a number, variable or expression
      * from the variable.
@@ -82,45 +78,47 @@ var Variable = /** @class */ (function () {
      * @param {Number|Variable|Expression} value Value to substract.
      * @return {Expression} expression
      */
-    Variable.prototype.minus = function (value) {
+    minus(value) {
         return new Expression(this, typeof value === 'number' ? -value : [-1, value]);
-    };
+    }
     /**
      * Creates a new Expression by multiplying with a fixed number.
      *
      * @param {Number} coefficient Coefficient to multiply with.
      * @return {Expression} expression
      */
-    Variable.prototype.multiply = function (coefficient) {
+    multiply(coefficient) {
         return new Expression([coefficient, this]);
-    };
+    }
     /**
      * Creates a new Expression by dividing with a fixed number.
      *
      * @param {Number} coefficient Coefficient to divide by.
      * @return {Expression} expression
      */
-    Variable.prototype.divide = function (coefficient) {
+    divide(coefficient) {
         return new Expression([1 / coefficient, this]);
-    };
+    }
     /**
      * Returns the JSON representation of the variable.
      * @private
      */
-    Variable.prototype.toJSON = function () {
+    toJSON() {
         return {
             name: this._name,
             value: this._value,
         };
-    };
-    Variable.prototype.toString = function () {
+    }
+    toString() {
         return this._context + '[' + this._name + ':' + this._value + ']';
-    };
-    return Variable;
-}());
-export { Variable };
+    }
+    _name;
+    _value = 0.0;
+    _context = null;
+    _id = VarId++;
+}
 /**
  * The internal variable id counter.
  * @private
  */
-var VarId = 0;
+let VarId = 0;
diff --git a/docs/Kiwi.md b/docs/Kiwi.md
index 6738b1e..5add837 100644
--- a/docs/Kiwi.md
+++ b/docs/Kiwi.md
@@ -59,11 +59,13 @@ console.assert(centerX.value() === 250)
     - [.multiply(coefficient)](#module_@lume/kiwi..Expression+multiply) ⇒ Expression
     - [.divide(coefficient)](#module_@lume/kiwi..Expression+divide) ⇒ Expression
   - [~Strength](#module_@lume/kiwi..Strength)
-    - [.required](#module_@lume/kiwi..Strength.required)
-    - [.strong](#module_@lume/kiwi..Strength.strong)
-    - [.medium](#module_@lume/kiwi..Strength.medium)
-    - [.weak](#module_@lume/kiwi..Strength.weak)
-    - [.create(a, b, c, [w])](#module_@lume/kiwi..Strength.create) ⇒
+    - _instance_
+      - [.required](#module_@lume/kiwi..Strength+required)
+      - [.strong](#module_@lume/kiwi..Strength+strong)
+      - [.medium](#module_@lume/kiwi..Strength+medium)
+      - [.weak](#module_@lume/kiwi..Strength+weak)
+    - _static_
+      - [.create(a, b, c, [w])](#module_@lume/kiwi..Strength.create) ⇒
   - [~Constraint](#module_@lume/kiwi..Constraint)
     - [new Constraint(expression, operator, [rhs], [strength])](#new_module_@lume/kiwi..Constraint_new)
     - [.expression()](#module_@lume/kiwi..Constraint+expression) ⇒ Expression
@@ -285,40 +287,42 @@ Creates a new Expression by dividing with a fixed number.
 **Kind**: inner class of [@lume/kiwi](#module_@lume/kiwi)
 
 - [~Strength](#module_@lume/kiwi..Strength)
-  - [.required](#module_@lume/kiwi..Strength.required)
-  - [.strong](#module_@lume/kiwi..Strength.strong)
-  - [.medium](#module_@lume/kiwi..Strength.medium)
-  - [.weak](#module_@lume/kiwi..Strength.weak)
-  - [.create(a, b, c, [w])](#module_@lume/kiwi..Strength.create) ⇒
+  - _instance_
+    - [.required](#module_@lume/kiwi..Strength+required)
+    - [.strong](#module_@lume/kiwi..Strength+strong)
+    - [.medium](#module_@lume/kiwi..Strength+medium)
+    - [.weak](#module_@lume/kiwi..Strength+weak)
+  - _static_
+    - [.create(a, b, c, [w])](#module_@lume/kiwi..Strength.create) ⇒
 
-
+
 
-### Strength.required
+### strength.required
 
 The 'required' symbolic strength.
 
-**Kind**: static property of [Strength](#module_@lume/kiwi..Strength)  
-
+**Kind**: instance property of [Strength](#module_@lume/kiwi..Strength)  
+
 
-### Strength.strong
+### strength.strong
 
 The 'strong' symbolic strength.
 
-**Kind**: static property of [Strength](#module_@lume/kiwi..Strength)  
-
+**Kind**: instance property of [Strength](#module_@lume/kiwi..Strength)  
+
 
-### Strength.medium
+### strength.medium
 
 The 'medium' symbolic strength.
 
-**Kind**: static property of [Strength](#module_@lume/kiwi..Strength)  
-
+**Kind**: instance property of [Strength](#module_@lume/kiwi..Strength)  
+
 
-### Strength.weak
+### strength.weak
 
 The 'weak' symbolic strength.
 
-**Kind**: static property of [Strength](#module_@lume/kiwi..Strength)  
+**Kind**: instance property of [Strength](#module_@lume/kiwi..Strength)  
 
 
 ### Strength.create(a, b, c, [w]) ⇒
diff --git a/index.html b/example/index.html
similarity index 81%
rename from index.html
rename to example/index.html
index 27b32c8..cf8e7ed 100644
--- a/index.html
+++ b/example/index.html
@@ -1,8 +1,19 @@
 
 
 	
-		
-		
+	
+	
+		
-		Sample
-	
-	
+
 		
 	
 
diff --git a/lib/kiwi.js b/lib/kiwi.js
deleted file mode 100644
index a9e1fea..0000000
--- a/lib/kiwi.js
+++ /dev/null
@@ -1,1558 +0,0 @@
-
-/*-----------------------------------------------------------------------------
-| Copyright (c) 2014-2019, Nucleic Development Team & H. Rutjes & Lume.
-|
-| Distributed under the terms of the Modified BSD License.
-|
-| The full license is in the file COPYING.txt, distributed with this software.
------------------------------------------------------------------------------*/
-
-/**
- * Lume Kiwi is an efficient implementation of the Cassowary constraint solving
- * algorithm, based on the seminal Cassowary paper.
- * It is *not* a refactoring or port of the original C++ solver, but
- * has been designed from the ground up to be lightweight and fast.
- *
- * **Example**
- *
- * ```javascript
- * import * as kiwi from '@lume/kiwi';
- *
- * // Create a solver
- * const solver = new kiwi.Solver();
- *
- * // Adjust the max number of solver iterations before an error is thrown if
- * // more is needed. Default is 10,000.
- * solver.maxIterations = 20000;
- *
- * // Create and add some editable variables
- * const left = new kiwi.Variable();
- * const width = new kiwi.Variable();
- * solver.addEditVariable(left, kiwi.Strength.strong);
- * solver.addEditVariable(width, kiwi.Strength.strong);
- *
- * // Create a variable calculated through a constraint
- * const centerX = new kiwi.Variable();
- * const expr = new kiwi.Expression([-1, centerX], left, [0.5, width]);
- * solver.addConstraint(new kiwi.Constraint(expr, kiwi.Operator.Eq, kiwi.Strength.required));
- *
- * // Suggest some values to the solver
- * solver.suggestValue(left, 0);
- * solver.suggestValue(width, 500);
- *
- * // Lets solve the problem!
- * solver.updateVariables();
- *
- * console.assert(centerX.value() === 250);
- * ```
- *
- * ## API Documentation
- * @module @lume/kiwi
- */
-
-(function (global, factory) {
-    typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports) :
-    typeof define === 'function' && define.amd ? define(['exports'], factory) :
-    (global = global || self, factory(global.kiwi = {}));
-}(this, function (exports) { 'use strict';
-
-    function createMap() {
-        return new IndexedMap();
-    }
-    var IndexedMap = /** @class */ (function () {
-        function IndexedMap() {
-            this.index = {};
-            this.array = [];
-        }
-        /**
-         * Returns the number of items in the array.
-         */
-        IndexedMap.prototype.size = function () {
-            return this.array.length;
-        };
-        /**
-         * Returns true if the array is empty.
-         */
-        IndexedMap.prototype.empty = function () {
-            return this.array.length === 0;
-        };
-        /**
-         * Returns the item at the given array index.
-         *
-         * @param index The integer index of the desired item.
-         */
-        IndexedMap.prototype.itemAt = function (index) {
-            return this.array[index];
-        };
-        /**
-         * Returns true if the key is in the array, false otherwise.
-         *
-         * @param key The key to locate in the array.
-         */
-        IndexedMap.prototype.contains = function (key) {
-            return this.index[key.id()] !== undefined;
-        };
-        /**
-         * Returns the pair associated with the given key, or undefined.
-         *
-         * @param key The key to locate in the array.
-         */
-        IndexedMap.prototype.find = function (key) {
-            var i = this.index[key.id()];
-            return i === undefined ? undefined : this.array[i];
-        };
-        /**
-         * Returns the pair associated with the key if it exists.
-         *
-         * If the key does not exist, a new pair will be created and
-         * inserted using the value created by the given factory.
-         *
-         * @param key The key to locate in the array.
-         * @param factory The function which creates the default value.
-         */
-        IndexedMap.prototype.setDefault = function (key, factory) {
-            var i = this.index[key.id()];
-            if (i === undefined) {
-                var pair = new Pair(key, factory());
-                this.index[key.id()] = this.array.length;
-                this.array.push(pair);
-                return pair;
-            }
-            else {
-                return this.array[i];
-            }
-        };
-        /**
-         * Insert the pair into the array and return the pair.
-         *
-         * This will overwrite any existing entry in the array.
-         *
-         * @param key The key portion of the pair.
-         * @param value The value portion of the pair.
-         */
-        IndexedMap.prototype.insert = function (key, value) {
-            var pair = new Pair(key, value);
-            var i = this.index[key.id()];
-            if (i === undefined) {
-                this.index[key.id()] = this.array.length;
-                this.array.push(pair);
-            }
-            else {
-                this.array[i] = pair;
-            }
-            return pair;
-        };
-        /**
-         * Removes and returns the pair for the given key, or undefined.
-         *
-         * @param key The key to remove from the map.
-         */
-        IndexedMap.prototype.erase = function (key) {
-            var i = this.index[key.id()];
-            if (i === undefined) {
-                return undefined;
-            }
-            this.index[key.id()] = undefined;
-            var pair = this.array[i];
-            var last = this.array.pop();
-            if (pair !== last) {
-                this.array[i] = last;
-                this.index[last.first.id()] = i;
-            }
-            return pair;
-        };
-        /**
-         * Create a copy of this associative array.
-         */
-        IndexedMap.prototype.copy = function () {
-            var copy = new IndexedMap();
-            for (var i = 0; i < this.array.length; i++) {
-                var pair = this.array[i].copy();
-                copy.array[i] = pair;
-                copy.index[pair.first.id()] = i;
-            }
-            return copy;
-        };
-        return IndexedMap;
-    }());
-    /**
-     * A class which defines a generic pair object.
-     * @private
-     */
-    // tslint:disable: max-classes-per-file
-    var Pair = /** @class */ (function () {
-        /**
-         * Construct a new Pair object.
-         *
-         * @param first The first item of the pair.
-         * @param second The second item of the pair.
-         */
-        function Pair(first, second) {
-            this.first = first;
-            this.second = second;
-        }
-        /**
-         * Create a copy of the pair.
-         */
-        Pair.prototype.copy = function () {
-            return new Pair(this.first, this.second);
-        };
-        return Pair;
-    }());
-
-    /**
-     * The primary user constraint variable.
-     *
-     * @class
-     * @param {String} [name=""] The name to associated with the variable.
-     */
-    var Variable = /** @class */ (function () {
-        function Variable(name) {
-            if (name === void 0) { name = ''; }
-            this._value = 0.0;
-            this._context = null;
-            this._id = VarId++;
-            this._name = name;
-        }
-        /**
-         * Returns the unique id number of the variable.
-         * @private
-         */
-        Variable.prototype.id = function () {
-            return this._id;
-        };
-        /**
-         * Returns the name of the variable.
-         *
-         * @return {String} name of the variable
-         */
-        Variable.prototype.name = function () {
-            return this._name;
-        };
-        /**
-         * Set the name of the variable.
-         *
-         * @param {String} name Name of the variable
-         */
-        Variable.prototype.setName = function (name) {
-            this._name = name;
-        };
-        /**
-         * Returns the user context object of the variable.
-         * @private
-         */
-        Variable.prototype.context = function () {
-            return this._context;
-        };
-        /**
-         * Set the user context object of the variable.
-         * @private
-         */
-        Variable.prototype.setContext = function (context) {
-            this._context = context;
-        };
-        /**
-         * Returns the value of the variable.
-         *
-         * @return {Number} Calculated value
-         */
-        Variable.prototype.value = function () {
-            return this._value;
-        };
-        /**
-         * Set the value of the variable.
-         * @private
-         */
-        Variable.prototype.setValue = function (value) {
-            this._value = value;
-        };
-        /**
-         * Creates a new Expression by adding a number, variable or expression
-         * to the variable.
-         *
-         * @param {Number|Variable|Expression} value Value to add.
-         * @return {Expression} expression
-         */
-        Variable.prototype.plus = function (value) {
-            return new Expression(this, value);
-        };
-        /**
-         * Creates a new Expression by substracting a number, variable or expression
-         * from the variable.
-         *
-         * @param {Number|Variable|Expression} value Value to substract.
-         * @return {Expression} expression
-         */
-        Variable.prototype.minus = function (value) {
-            return new Expression(this, typeof value === 'number' ? -value : [-1, value]);
-        };
-        /**
-         * Creates a new Expression by multiplying with a fixed number.
-         *
-         * @param {Number} coefficient Coefficient to multiply with.
-         * @return {Expression} expression
-         */
-        Variable.prototype.multiply = function (coefficient) {
-            return new Expression([coefficient, this]);
-        };
-        /**
-         * Creates a new Expression by dividing with a fixed number.
-         *
-         * @param {Number} coefficient Coefficient to divide by.
-         * @return {Expression} expression
-         */
-        Variable.prototype.divide = function (coefficient) {
-            return new Expression([1 / coefficient, this]);
-        };
-        /**
-         * Returns the JSON representation of the variable.
-         * @private
-         */
-        Variable.prototype.toJSON = function () {
-            return {
-                name: this._name,
-                value: this._value,
-            };
-        };
-        Variable.prototype.toString = function () {
-            return this._context + '[' + this._name + ':' + this._value + ']';
-        };
-        return Variable;
-    }());
-    /**
-     * The internal variable id counter.
-     * @private
-     */
-    var VarId = 0;
-
-    /**
-     * An expression of variable terms and a constant.
-     *
-     * The constructor accepts an arbitrary number of parameters,
-     * each of which must be one of the following types:
-     *  - number
-     *  - Variable
-     *  - Expression
-     *  - 2-tuple of [number, Variable|Expression]
-     *
-     * The parameters are summed. The tuples are multiplied.
-     *
-     * @class
-     * @param {...(number|Variable|Expression|Array)} args
-     */
-    var Expression = /** @class */ (function () {
-        function Expression() {
-            var parsed = parseArgs(arguments);
-            this._terms = parsed.terms;
-            this._constant = parsed.constant;
-        }
-        /**
-         * Returns the mapping of terms in the expression.
-         *
-         * This *must* be treated as const.
-         * @private
-         */
-        Expression.prototype.terms = function () {
-            return this._terms;
-        };
-        /**
-         * Returns the constant of the expression.
-         * @private
-         */
-        Expression.prototype.constant = function () {
-            return this._constant;
-        };
-        /**
-         * Returns the computed value of the expression.
-         *
-         * @private
-         * @return {Number} computed value of the expression
-         */
-        Expression.prototype.value = function () {
-            var result = this._constant;
-            for (var i = 0, n = this._terms.size(); i < n; i++) {
-                var pair = this._terms.itemAt(i);
-                result += pair.first.value() * pair.second;
-            }
-            return result;
-        };
-        /**
-         * Creates a new Expression by adding a number, variable or expression
-         * to the expression.
-         *
-         * @param {Number|Variable|Expression} value Value to add.
-         * @return {Expression} expression
-         */
-        Expression.prototype.plus = function (value) {
-            return new Expression(this, value);
-        };
-        /**
-         * Creates a new Expression by substracting a number, variable or expression
-         * from the expression.
-         *
-         * @param {Number|Variable|Expression} value Value to substract.
-         * @return {Expression} expression
-         */
-        Expression.prototype.minus = function (value) {
-            return new Expression(this, typeof value === 'number' ? -value : [-1, value]);
-        };
-        /**
-         * Creates a new Expression by multiplying with a fixed number.
-         *
-         * @param {Number} coefficient Coefficient to multiply with.
-         * @return {Expression} expression
-         */
-        Expression.prototype.multiply = function (coefficient) {
-            return new Expression([coefficient, this]);
-        };
-        /**
-         * Creates a new Expression by dividing with a fixed number.
-         *
-         * @param {Number} coefficient Coefficient to divide by.
-         * @return {Expression} expression
-         */
-        Expression.prototype.divide = function (coefficient) {
-            return new Expression([1 / coefficient, this]);
-        };
-        Expression.prototype.isConstant = function () {
-            return this._terms.size() == 0;
-        };
-        Expression.prototype.toString = function () {
-            var result = this._terms.array
-                .map(function (pair) {
-                return pair.second + '*' + pair.first.toString();
-            })
-                .join(' + ');
-            if (!this.isConstant() && this._constant !== 0) {
-                result += ' + ';
-            }
-            result += this._constant;
-            return result;
-        };
-        return Expression;
-    }());
-    /**
-     * An internal argument parsing function.
-     * @private
-     */
-    function parseArgs(args) {
-        var constant = 0.0;
-        var factory = function () { return 0.0; };
-        var terms = createMap();
-        for (var i = 0, n = args.length; i < n; ++i) {
-            var item = args[i];
-            if (typeof item === 'number') {
-                constant += item;
-            }
-            else if (item instanceof Variable) {
-                terms.setDefault(item, factory).second += 1.0;
-            }
-            else if (item instanceof Expression) {
-                constant += item.constant();
-                var terms2 = item.terms();
-                for (var j = 0, k = terms2.size(); j < k; j++) {
-                    var termPair = terms2.itemAt(j);
-                    terms.setDefault(termPair.first, factory).second += termPair.second;
-                }
-            }
-            else if (item instanceof Array) {
-                if (item.length !== 2) {
-                    throw new Error('array must have length 2');
-                }
-                var value = item[0];
-                var value2 = item[1];
-                if (typeof value !== 'number') {
-                    throw new Error('array item 0 must be a number');
-                }
-                if (value2 instanceof Variable) {
-                    terms.setDefault(value2, factory).second += value;
-                }
-                else if (value2 instanceof Expression) {
-                    constant += value2.constant() * value;
-                    var terms2 = value2.terms();
-                    for (var j = 0, k = terms2.size(); j < k; j++) {
-                        var termPair = terms2.itemAt(j);
-                        terms.setDefault(termPair.first, factory).second += termPair.second * value;
-                    }
-                }
-                else {
-                    throw new Error('array item 1 must be a variable or expression');
-                }
-            }
-            else {
-                throw new Error('invalid Expression argument: ' + item);
-            }
-        }
-        return { terms: terms, constant: constant };
-    }
-
-    /**
-     * @class Strength
-     */
-    var Strength = /** @class */ (function () {
-        function Strength() {
-        }
-        /**
-         * Create a new symbolic strength.
-         *
-         * @param a strong
-         * @param b medium
-         * @param c weak
-         * @param [w] weight
-         * @return strength
-         */
-        Strength.create = function (a, b, c, w) {
-            if (w === void 0) { w = 1.0; }
-            var result = 0.0;
-            result += Math.max(0.0, Math.min(1000.0, a * w)) * 1000000.0;
-            result += Math.max(0.0, Math.min(1000.0, b * w)) * 1000.0;
-            result += Math.max(0.0, Math.min(1000.0, c * w));
-            return result;
-        };
-        /**
-         * Clip a symbolic strength to the allowed min and max.
-         * @private
-         */
-        Strength.clip = function (value) {
-            return Math.max(0.0, Math.min(Strength.required, value));
-        };
-        /**
-         * The 'required' symbolic strength.
-         */
-        Strength.required = Strength.create(1000.0, 1000.0, 1000.0);
-        /**
-         * The 'strong' symbolic strength.
-         */
-        Strength.strong = Strength.create(1.0, 0.0, 0.0);
-        /**
-         * The 'medium' symbolic strength.
-         */
-        Strength.medium = Strength.create(0.0, 1.0, 0.0);
-        /**
-         * The 'weak' symbolic strength.
-         */
-        Strength.weak = Strength.create(0.0, 0.0, 1.0);
-        return Strength;
-    }());
-
-    (function (Operator) {
-        Operator[Operator["Le"] = 0] = "Le";
-        Operator[Operator["Ge"] = 1] = "Ge";
-        Operator[Operator["Eq"] = 2] = "Eq";
-    })(exports.Operator || (exports.Operator = {}));
-    /**
-     * A linear constraint equation.
-     *
-     * A constraint equation is composed of an expression, an operator,
-     * and a strength. The RHS of the equation is implicitly zero.
-     *
-     * @class
-     * @param {Expression} expression The constraint expression (LHS).
-     * @param {Operator} operator The equation operator.
-     * @param {Expression} [rhs] Right hand side of the expression.
-     * @param {Number} [strength=Strength.required] The strength of the constraint.
-     */
-    var Constraint = /** @class */ (function () {
-        function Constraint(expression, operator, rhs, strength) {
-            if (strength === void 0) { strength = Strength.required; }
-            this._id = CnId++;
-            this._operator = operator;
-            this._strength = Strength.clip(strength);
-            if (rhs === undefined && expression instanceof Expression) {
-                this._expression = expression;
-            }
-            else {
-                this._expression = expression.minus(rhs);
-            }
-        }
-        /**
-         * Returns the unique id number of the constraint.
-         * @private
-         */
-        Constraint.prototype.id = function () {
-            return this._id;
-        };
-        /**
-         * Returns the expression of the constraint.
-         *
-         * @return {Expression} expression
-         */
-        Constraint.prototype.expression = function () {
-            return this._expression;
-        };
-        /**
-         * Returns the relational operator of the constraint.
-         *
-         * @return {Operator} linear constraint operator
-         */
-        Constraint.prototype.op = function () {
-            return this._operator;
-        };
-        /**
-         * Returns the strength of the constraint.
-         *
-         * @return {Number} strength
-         */
-        Constraint.prototype.strength = function () {
-            return this._strength;
-        };
-        Constraint.prototype.toString = function () {
-            return (this._expression.toString() + ' ' + ['<=', '>=', '='][this._operator] + ' 0 (' + this._strength.toString() + ')');
-        };
-        return Constraint;
-    }());
-    /**
-     * The internal constraint id counter.
-     * @private
-     */
-    var CnId = 0;
-
-    /**
-     * The constraint solver class.
-     *
-     * @class
-     */
-    var Solver = /** @class */ (function () {
-        /**
-         * Construct a new Solver.
-         */
-        function Solver() {
-            /**
-             * @type {number} - The max number of solver iterations before an error
-             * is thrown, in order to prevent infinite iteration. Default: `10,000`.
-             */
-            this.maxIterations = 1000;
-            this._cnMap = createCnMap();
-            this._rowMap = createRowMap();
-            this._varMap = createVarMap();
-            this._editMap = createEditMap();
-            this._infeasibleRows = [];
-            this._objective = new Row();
-            this._artificial = null;
-            this._idTick = 0;
-        }
-        /**
-         * Creates and add a constraint to the solver.
-         *
-         * @param {Expression|Variable} lhs Left hand side of the expression
-         * @param {Operator} operator Operator
-         * @param {Expression|Variable|Number} rhs Right hand side of the expression
-         * @param {Number} [strength=Strength.required] Strength
-         */
-        Solver.prototype.createConstraint = function (lhs, operator, rhs, strength) {
-            if (strength === void 0) { strength = Strength.required; }
-            var cn = new Constraint(lhs, operator, rhs, strength);
-            this.addConstraint(cn);
-            return cn;
-        };
-        /**
-         * Add a constraint to the solver.
-         *
-         * @param {Constraint} constraint Constraint to add to the solver
-         */
-        Solver.prototype.addConstraint = function (constraint) {
-            var cnPair = this._cnMap.find(constraint);
-            if (cnPair !== undefined) {
-                throw new Error('duplicate constraint');
-            }
-            // Creating a row causes symbols to be reserved for the variables
-            // in the constraint. If this method exits with an exception,
-            // then its possible those variables will linger in the var map.
-            // Since its likely that those variables will be used in other
-            // constraints and since exceptional conditions are uncommon,
-            // i'm not too worried about aggressive cleanup of the var map.
-            var data = this._createRow(constraint);
-            var row = data.row;
-            var tag = data.tag;
-            var subject = this._chooseSubject(row, tag);
-            // If chooseSubject couldnt find a valid entering symbol, one
-            // last option is available if the entire row is composed of
-            // dummy variables. If the constant of the row is zero, then
-            // this represents redundant constraints and the new dummy
-            // marker can enter the basis. If the constant is non-zero,
-            // then it represents an unsatisfiable constraint.
-            if (subject.type() === SymbolType.Invalid && row.allDummies()) {
-                if (!nearZero(row.constant())) {
-                    throw new Error('unsatisfiable constraint');
-                }
-                else {
-                    subject = tag.marker;
-                }
-            }
-            // If an entering symbol still isn't found, then the row must
-            // be added using an artificial variable. If that fails, then
-            // the row represents an unsatisfiable constraint.
-            if (subject.type() === SymbolType.Invalid) {
-                if (!this._addWithArtificialVariable(row)) {
-                    throw new Error('unsatisfiable constraint');
-                }
-            }
-            else {
-                row.solveFor(subject);
-                this._substitute(subject, row);
-                this._rowMap.insert(subject, row);
-            }
-            this._cnMap.insert(constraint, tag);
-            // Optimizing after each constraint is added performs less
-            // aggregate work due to a smaller average system size. It
-            // also ensures the solver remains in a consistent state.
-            this._optimize(this._objective);
-        };
-        /**
-         * Remove a constraint from the solver.
-         *
-         * @param {Constraint} constraint Constraint to remove from the solver
-         */
-        Solver.prototype.removeConstraint = function (constraint) {
-            var cnPair = this._cnMap.erase(constraint);
-            if (cnPair === undefined) {
-                throw new Error('unknown constraint');
-            }
-            // Remove the error effects from the objective function
-            // *before* pivoting, or substitutions into the objective
-            // will lead to incorrect solver results.
-            this._removeConstraintEffects(constraint, cnPair.second);
-            // If the marker is basic, simply drop the row. Otherwise,
-            // pivot the marker into the basis and then drop the row.
-            var marker = cnPair.second.marker;
-            var rowPair = this._rowMap.erase(marker);
-            if (rowPair === undefined) {
-                var leaving = this._getMarkerLeavingSymbol(marker);
-                if (leaving.type() === SymbolType.Invalid) {
-                    throw new Error('failed to find leaving row');
-                }
-                rowPair = this._rowMap.erase(leaving);
-                rowPair.second.solveForEx(leaving, marker);
-                this._substitute(marker, rowPair.second);
-            }
-            // Optimizing after each constraint is removed ensures that the
-            // solver remains consistent. It makes the solver api easier to
-            // use at a small tradeoff for speed.
-            this._optimize(this._objective);
-        };
-        /**
-         * Test whether the solver contains the constraint.
-         *
-         * @param {Constraint} constraint Constraint to test for
-         * @return {Bool} true or false
-         */
-        Solver.prototype.hasConstraint = function (constraint) {
-            return this._cnMap.contains(constraint);
-        };
-        /**
-         * Add an edit variable to the solver.
-         *
-         * @param {Variable} variable Edit variable to add to the solver
-         * @param {Number} strength Strength, should be less than `Strength.required`
-         */
-        Solver.prototype.addEditVariable = function (variable, strength) {
-            var editPair = this._editMap.find(variable);
-            if (editPair !== undefined) {
-                throw new Error('duplicate edit variable');
-            }
-            strength = Strength.clip(strength);
-            if (strength === Strength.required) {
-                throw new Error('bad required strength');
-            }
-            var expr = new Expression(variable);
-            var cn = new Constraint(expr, exports.Operator.Eq, undefined, strength);
-            this.addConstraint(cn);
-            var tag = this._cnMap.find(cn).second;
-            var info = { tag: tag, constraint: cn, constant: 0.0 };
-            this._editMap.insert(variable, info);
-        };
-        /**
-         * Remove an edit variable from the solver.
-         *
-         * @param {Variable} variable Edit variable to remove from the solver
-         */
-        Solver.prototype.removeEditVariable = function (variable) {
-            var editPair = this._editMap.erase(variable);
-            if (editPair === undefined) {
-                throw new Error('unknown edit variable');
-            }
-            this.removeConstraint(editPair.second.constraint);
-        };
-        /**
-         * Test whether the solver contains the edit variable.
-         *
-         * @param {Variable} variable Edit variable to test for
-         * @return {Bool} true or false
-         */
-        Solver.prototype.hasEditVariable = function (variable) {
-            return this._editMap.contains(variable);
-        };
-        /**
-         * Suggest the value of an edit variable.
-         *
-         * @param {Variable} variable Edit variable to suggest a value for
-         * @param {Number} value Suggested value
-         */
-        Solver.prototype.suggestValue = function (variable, value) {
-            var editPair = this._editMap.find(variable);
-            if (editPair === undefined) {
-                throw new Error('unknown edit variable');
-            }
-            var rows = this._rowMap;
-            var info = editPair.second;
-            var delta = value - info.constant;
-            info.constant = value;
-            // Check first if the positive error variable is basic.
-            var marker = info.tag.marker;
-            var rowPair = rows.find(marker);
-            if (rowPair !== undefined) {
-                if (rowPair.second.add(-delta) < 0.0) {
-                    this._infeasibleRows.push(marker);
-                }
-                this._dualOptimize();
-                return;
-            }
-            // Check next if the negative error variable is basic.
-            var other = info.tag.other;
-            rowPair = rows.find(other);
-            if (rowPair !== undefined) {
-                if (rowPair.second.add(delta) < 0.0) {
-                    this._infeasibleRows.push(other);
-                }
-                this._dualOptimize();
-                return;
-            }
-            // Otherwise update each row where the error variables exist.
-            for (var i = 0, n = rows.size(); i < n; ++i) {
-                var rowPair_1 = rows.itemAt(i);
-                var row = rowPair_1.second;
-                var coeff = row.coefficientFor(marker);
-                if (coeff !== 0.0 && row.add(delta * coeff) < 0.0 && rowPair_1.first.type() !== SymbolType.External) {
-                    this._infeasibleRows.push(rowPair_1.first);
-                }
-            }
-            this._dualOptimize();
-        };
-        /**
-         * Update the values of the variables.
-         */
-        Solver.prototype.updateVariables = function () {
-            var vars = this._varMap;
-            var rows = this._rowMap;
-            for (var i = 0, n = vars.size(); i < n; ++i) {
-                var pair = vars.itemAt(i);
-                var rowPair = rows.find(pair.second);
-                if (rowPair !== undefined) {
-                    pair.first.setValue(rowPair.second.constant());
-                }
-                else {
-                    pair.first.setValue(0.0);
-                }
-            }
-        };
-        /**
-         * Get the symbol for the given variable.
-         *
-         * If a symbol does not exist for the variable, one will be created.
-         * @private
-         */
-        Solver.prototype._getVarSymbol = function (variable) {
-            var _this = this;
-            var factory = function () { return _this._makeSymbol(SymbolType.External); };
-            return this._varMap.setDefault(variable, factory).second;
-        };
-        /**
-         * Create a new Row object for the given constraint.
-         *
-         * The terms in the constraint will be converted to cells in the row.
-         * Any term in the constraint with a coefficient of zero is ignored.
-         * This method uses the `_getVarSymbol` method to get the symbol for
-         * the variables added to the row. If the symbol for a given cell
-         * variable is basic, the cell variable will be substituted with the
-         * basic row.
-         *
-         * The necessary slack and error variables will be added to the row.
-         * If the constant for the row is negative, the sign for the row
-         * will be inverted so the constant becomes positive.
-         *
-         * Returns the created Row and the tag for tracking the constraint.
-         * @private
-         */
-        Solver.prototype._createRow = function (constraint) {
-            var expr = constraint.expression();
-            var row = new Row(expr.constant());
-            // Substitute the current basic variables into the row.
-            var terms = expr.terms();
-            for (var i = 0, n = terms.size(); i < n; ++i) {
-                var termPair = terms.itemAt(i);
-                if (!nearZero(termPair.second)) {
-                    var symbol = this._getVarSymbol(termPair.first);
-                    var basicPair = this._rowMap.find(symbol);
-                    if (basicPair !== undefined) {
-                        row.insertRow(basicPair.second, termPair.second);
-                    }
-                    else {
-                        row.insertSymbol(symbol, termPair.second);
-                    }
-                }
-            }
-            // Add the necessary slack, error, and dummy variables.
-            var objective = this._objective;
-            var strength = constraint.strength();
-            var tag = { marker: INVALID_SYMBOL, other: INVALID_SYMBOL };
-            switch (constraint.op()) {
-                case exports.Operator.Le:
-                case exports.Operator.Ge: {
-                    var coeff = constraint.op() === exports.Operator.Le ? 1.0 : -1.0;
-                    var slack = this._makeSymbol(SymbolType.Slack);
-                    tag.marker = slack;
-                    row.insertSymbol(slack, coeff);
-                    if (strength < Strength.required) {
-                        var error = this._makeSymbol(SymbolType.Error);
-                        tag.other = error;
-                        row.insertSymbol(error, -coeff);
-                        objective.insertSymbol(error, strength);
-                    }
-                    break;
-                }
-                case exports.Operator.Eq: {
-                    if (strength < Strength.required) {
-                        var errplus = this._makeSymbol(SymbolType.Error);
-                        var errminus = this._makeSymbol(SymbolType.Error);
-                        tag.marker = errplus;
-                        tag.other = errminus;
-                        row.insertSymbol(errplus, -1.0); // v = eplus - eminus
-                        row.insertSymbol(errminus, 1.0); // v - eplus + eminus = 0
-                        objective.insertSymbol(errplus, strength);
-                        objective.insertSymbol(errminus, strength);
-                    }
-                    else {
-                        var dummy = this._makeSymbol(SymbolType.Dummy);
-                        tag.marker = dummy;
-                        row.insertSymbol(dummy);
-                    }
-                    break;
-                }
-            }
-            // Ensure the row has a positive constant.
-            if (row.constant() < 0.0) {
-                row.reverseSign();
-            }
-            return { row: row, tag: tag };
-        };
-        /**
-         * Choose the subject for solving for the row.
-         *
-         * This method will choose the best subject for using as the solve
-         * target for the row. An invalid symbol will be returned if there
-         * is no valid target.
-         *
-         * The symbols are chosen according to the following precedence:
-         *
-         * 1) The first symbol representing an external variable.
-         * 2) A negative slack or error tag variable.
-         *
-         * If a subject cannot be found, an invalid symbol will be returned.
-         *
-         * @private
-         */
-        Solver.prototype._chooseSubject = function (row, tag) {
-            var cells = row.cells();
-            for (var i = 0, n = cells.size(); i < n; ++i) {
-                var pair = cells.itemAt(i);
-                if (pair.first.type() === SymbolType.External) {
-                    return pair.first;
-                }
-            }
-            var type = tag.marker.type();
-            if (type === SymbolType.Slack || type === SymbolType.Error) {
-                if (row.coefficientFor(tag.marker) < 0.0) {
-                    return tag.marker;
-                }
-            }
-            type = tag.other.type();
-            if (type === SymbolType.Slack || type === SymbolType.Error) {
-                if (row.coefficientFor(tag.other) < 0.0) {
-                    return tag.other;
-                }
-            }
-            return INVALID_SYMBOL;
-        };
-        /**
-         * Add the row to the tableau using an artificial variable.
-         *
-         * This will return false if the constraint cannot be satisfied.
-         *
-         * @private
-         */
-        Solver.prototype._addWithArtificialVariable = function (row) {
-            // Create and add the artificial variable to the tableau.
-            var art = this._makeSymbol(SymbolType.Slack);
-            this._rowMap.insert(art, row.copy());
-            this._artificial = row.copy();
-            // Optimize the artificial objective. This is successful
-            // only if the artificial objective is optimized to zero.
-            this._optimize(this._artificial);
-            var success = nearZero(this._artificial.constant());
-            this._artificial = null;
-            // If the artificial variable is basic, pivot the row so that
-            // it becomes non-basic. If the row is constant, exit early.
-            var pair = this._rowMap.erase(art);
-            if (pair !== undefined) {
-                var basicRow = pair.second;
-                if (basicRow.isConstant()) {
-                    return success;
-                }
-                var entering = this._anyPivotableSymbol(basicRow);
-                if (entering.type() === SymbolType.Invalid) {
-                    return false; // unsatisfiable (will this ever happen?)
-                }
-                basicRow.solveForEx(art, entering);
-                this._substitute(entering, basicRow);
-                this._rowMap.insert(entering, basicRow);
-            }
-            // Remove the artificial variable from the tableau.
-            var rows = this._rowMap;
-            for (var i = 0, n = rows.size(); i < n; ++i) {
-                rows.itemAt(i).second.removeSymbol(art);
-            }
-            this._objective.removeSymbol(art);
-            return success;
-        };
-        /**
-         * Substitute the parametric symbol with the given row.
-         *
-         * This method will substitute all instances of the parametric symbol
-         * in the tableau and the objective function with the given row.
-         *
-         * @private
-         */
-        Solver.prototype._substitute = function (symbol, row) {
-            var rows = this._rowMap;
-            for (var i = 0, n = rows.size(); i < n; ++i) {
-                var pair = rows.itemAt(i);
-                pair.second.substitute(symbol, row);
-                if (pair.second.constant() < 0.0 && pair.first.type() !== SymbolType.External) {
-                    this._infeasibleRows.push(pair.first);
-                }
-            }
-            this._objective.substitute(symbol, row);
-            if (this._artificial) {
-                this._artificial.substitute(symbol, row);
-            }
-        };
-        /**
-         * Optimize the system for the given objective function.
-         *
-         * This method performs iterations of Phase 2 of the simplex method
-         * until the objective function reaches a minimum.
-         *
-         * @private
-         */
-        Solver.prototype._optimize = function (objective) {
-            var iterations = 0;
-            while (iterations < this.maxIterations) {
-                var entering = this._getEnteringSymbol(objective);
-                if (entering.type() === SymbolType.Invalid) {
-                    return;
-                }
-                var leaving = this._getLeavingSymbol(entering);
-                if (leaving.type() === SymbolType.Invalid) {
-                    throw new Error('the objective is unbounded');
-                }
-                // pivot the entering symbol into the basis
-                var row = this._rowMap.erase(leaving).second;
-                row.solveForEx(leaving, entering);
-                this._substitute(entering, row);
-                this._rowMap.insert(entering, row);
-                iterations++;
-            }
-            throw new Error('solver iterations exceeded');
-        };
-        /**
-         * Optimize the system using the dual of the simplex method.
-         *
-         * The current state of the system should be such that the objective
-         * function is optimal, but not feasible. This method will perform
-         * an iteration of the dual simplex method to make the solution both
-         * optimal and feasible.
-         *
-         * @private
-         */
-        Solver.prototype._dualOptimize = function () {
-            var rows = this._rowMap;
-            var infeasible = this._infeasibleRows;
-            while (infeasible.length !== 0) {
-                var leaving = infeasible.pop();
-                var pair = rows.find(leaving);
-                if (pair !== undefined && pair.second.constant() < 0.0) {
-                    var entering = this._getDualEnteringSymbol(pair.second);
-                    if (entering.type() === SymbolType.Invalid) {
-                        throw new Error('dual optimize failed');
-                    }
-                    // pivot the entering symbol into the basis
-                    var row = pair.second;
-                    rows.erase(leaving);
-                    row.solveForEx(leaving, entering);
-                    this._substitute(entering, row);
-                    rows.insert(entering, row);
-                }
-            }
-        };
-        /**
-         * Compute the entering variable for a pivot operation.
-         *
-         * This method will return first symbol in the objective function which
-         * is non-dummy and has a coefficient less than zero. If no symbol meets
-         * the criteria, it means the objective function is at a minimum, and an
-         * invalid symbol is returned.
-         *
-         * @private
-         */
-        Solver.prototype._getEnteringSymbol = function (objective) {
-            var cells = objective.cells();
-            for (var i = 0, n = cells.size(); i < n; ++i) {
-                var pair = cells.itemAt(i);
-                var symbol = pair.first;
-                if (pair.second < 0.0 && symbol.type() !== SymbolType.Dummy) {
-                    return symbol;
-                }
-            }
-            return INVALID_SYMBOL;
-        };
-        /**
-         * Compute the entering symbol for the dual optimize operation.
-         *
-         * This method will return the symbol in the row which has a positive
-         * coefficient and yields the minimum ratio for its respective symbol
-         * in the objective function. The provided row *must* be infeasible.
-         * If no symbol is found which meats the criteria, an invalid symbol
-         * is returned.
-         *
-         * @private
-         */
-        Solver.prototype._getDualEnteringSymbol = function (row) {
-            var ratio = Number.MAX_VALUE;
-            var entering = INVALID_SYMBOL;
-            var cells = row.cells();
-            for (var i = 0, n = cells.size(); i < n; ++i) {
-                var pair = cells.itemAt(i);
-                var symbol = pair.first;
-                var c = pair.second;
-                if (c > 0.0 && symbol.type() !== SymbolType.Dummy) {
-                    var coeff = this._objective.coefficientFor(symbol);
-                    var r = coeff / c;
-                    if (r < ratio) {
-                        ratio = r;
-                        entering = symbol;
-                    }
-                }
-            }
-            return entering;
-        };
-        /**
-         * Compute the symbol for pivot exit row.
-         *
-         * This method will return the symbol for the exit row in the row
-         * map. If no appropriate exit symbol is found, an invalid symbol
-         * will be returned. This indicates that the objective function is
-         * unbounded.
-         *
-         * @private
-         */
-        Solver.prototype._getLeavingSymbol = function (entering) {
-            var ratio = Number.MAX_VALUE;
-            var found = INVALID_SYMBOL;
-            var rows = this._rowMap;
-            for (var i = 0, n = rows.size(); i < n; ++i) {
-                var pair = rows.itemAt(i);
-                var symbol = pair.first;
-                if (symbol.type() !== SymbolType.External) {
-                    var row = pair.second;
-                    var temp = row.coefficientFor(entering);
-                    if (temp < 0.0) {
-                        var temp_ratio = -row.constant() / temp;
-                        if (temp_ratio < ratio) {
-                            ratio = temp_ratio;
-                            found = symbol;
-                        }
-                    }
-                }
-            }
-            return found;
-        };
-        /**
-         * Compute the leaving symbol for a marker variable.
-         *
-         * This method will return a symbol corresponding to a basic row
-         * which holds the given marker variable. The row will be chosen
-         * according to the following precedence:
-         *
-         * 1) The row with a restricted basic varible and a negative coefficient
-         *    for the marker with the smallest ratio of -constant / coefficient.
-         *
-         * 2) The row with a restricted basic variable and the smallest ratio
-         *    of constant / coefficient.
-         *
-         * 3) The last unrestricted row which contains the marker.
-         *
-         * If the marker does not exist in any row, an invalid symbol will be
-         * returned. This indicates an internal solver error since the marker
-         * *should* exist somewhere in the tableau.
-         *
-         * @private
-         */
-        Solver.prototype._getMarkerLeavingSymbol = function (marker) {
-            var dmax = Number.MAX_VALUE;
-            var r1 = dmax;
-            var r2 = dmax;
-            var invalid = INVALID_SYMBOL;
-            var first = invalid;
-            var second = invalid;
-            var third = invalid;
-            var rows = this._rowMap;
-            for (var i = 0, n = rows.size(); i < n; ++i) {
-                var pair = rows.itemAt(i);
-                var row = pair.second;
-                var c = row.coefficientFor(marker);
-                if (c === 0.0) {
-                    continue;
-                }
-                var symbol = pair.first;
-                if (symbol.type() === SymbolType.External) {
-                    third = symbol;
-                }
-                else if (c < 0.0) {
-                    var r = -row.constant() / c;
-                    if (r < r1) {
-                        r1 = r;
-                        first = symbol;
-                    }
-                }
-                else {
-                    var r = row.constant() / c;
-                    if (r < r2) {
-                        r2 = r;
-                        second = symbol;
-                    }
-                }
-            }
-            if (first !== invalid) {
-                return first;
-            }
-            if (second !== invalid) {
-                return second;
-            }
-            return third;
-        };
-        /**
-         * Remove the effects of a constraint on the objective function.
-         *
-         * @private
-         */
-        Solver.prototype._removeConstraintEffects = function (cn, tag) {
-            if (tag.marker.type() === SymbolType.Error) {
-                this._removeMarkerEffects(tag.marker, cn.strength());
-            }
-            if (tag.other.type() === SymbolType.Error) {
-                this._removeMarkerEffects(tag.other, cn.strength());
-            }
-        };
-        /**
-         * Remove the effects of an error marker on the objective function.
-         *
-         * @private
-         */
-        Solver.prototype._removeMarkerEffects = function (marker, strength) {
-            var pair = this._rowMap.find(marker);
-            if (pair !== undefined) {
-                this._objective.insertRow(pair.second, -strength);
-            }
-            else {
-                this._objective.insertSymbol(marker, -strength);
-            }
-        };
-        /**
-         * Get the first Slack or Error symbol in the row.
-         *
-         * If no such symbol is present, an invalid symbol will be returned.
-         *
-         * @private
-         */
-        Solver.prototype._anyPivotableSymbol = function (row) {
-            var cells = row.cells();
-            for (var i = 0, n = cells.size(); i < n; ++i) {
-                var pair = cells.itemAt(i);
-                var type = pair.first.type();
-                if (type === SymbolType.Slack || type === SymbolType.Error) {
-                    return pair.first;
-                }
-            }
-            return INVALID_SYMBOL;
-        };
-        /**
-         * Returns a new Symbol of the given type.
-         *
-         * @private
-         */
-        Solver.prototype._makeSymbol = function (type) {
-            return new Symbol(type, this._idTick++);
-        };
-        return Solver;
-    }());
-    /**
-     * Test whether a value is approximately zero.
-     * @private
-     */
-    function nearZero(value) {
-        var eps = 1.0e-8;
-        return value < 0.0 ? -value < eps : value < eps;
-    }
-    /**
-     * An internal function for creating a constraint map.
-     * @private
-     */
-    function createCnMap() {
-        return createMap();
-    }
-    /**
-     * An internal function for creating a row map.
-     * @private
-     */
-    function createRowMap() {
-        return createMap();
-    }
-    /**
-     * An internal function for creating a variable map.
-     * @private
-     */
-    function createVarMap() {
-        return createMap();
-    }
-    /**
-     * An internal function for creating an edit map.
-     * @private
-     */
-    function createEditMap() {
-        return createMap();
-    }
-    /**
-     * An enum defining the available symbol types.
-     * @private
-     */
-    var SymbolType;
-    (function (SymbolType) {
-        SymbolType[SymbolType["Invalid"] = 0] = "Invalid";
-        SymbolType[SymbolType["External"] = 1] = "External";
-        SymbolType[SymbolType["Slack"] = 2] = "Slack";
-        SymbolType[SymbolType["Error"] = 3] = "Error";
-        SymbolType[SymbolType["Dummy"] = 4] = "Dummy";
-    })(SymbolType || (SymbolType = {}));
-    /**
-     * An internal class representing a symbol in the solver.
-     * @private
-     */
-    var Symbol = /** @class */ (function () {
-        /**
-         * Construct a new Symbol
-         *
-         * @param [type] The type of the symbol.
-         * @param [id] The unique id number of the symbol.
-         */
-        function Symbol(type, id) {
-            this._id = id;
-            this._type = type;
-        }
-        /**
-         * Returns the unique id number of the symbol.
-         */
-        Symbol.prototype.id = function () {
-            return this._id;
-        };
-        /**
-         * Returns the type of the symbol.
-         */
-        Symbol.prototype.type = function () {
-            return this._type;
-        };
-        return Symbol;
-    }());
-    /**
-     * A static invalid symbol
-     * @private
-     */
-    var INVALID_SYMBOL = new Symbol(SymbolType.Invalid, -1);
-    /**
-     * An internal row class used by the solver.
-     * @private
-     */
-    var Row = /** @class */ (function () {
-        /**
-         * Construct a new Row.
-         */
-        function Row(constant) {
-            if (constant === void 0) { constant = 0.0; }
-            this._cellMap = createMap();
-            this._constant = constant;
-        }
-        /**
-         * Returns the mapping of symbols to coefficients.
-         */
-        Row.prototype.cells = function () {
-            return this._cellMap;
-        };
-        /**
-         * Returns the constant for the row.
-         */
-        Row.prototype.constant = function () {
-            return this._constant;
-        };
-        /**
-         * Returns true if the row is a constant value.
-         */
-        Row.prototype.isConstant = function () {
-            return this._cellMap.empty();
-        };
-        /**
-         * Returns true if the Row has all dummy symbols.
-         */
-        Row.prototype.allDummies = function () {
-            var cells = this._cellMap;
-            for (var i = 0, n = cells.size(); i < n; ++i) {
-                var pair = cells.itemAt(i);
-                if (pair.first.type() !== SymbolType.Dummy) {
-                    return false;
-                }
-            }
-            return true;
-        };
-        /**
-         * Create a copy of the row.
-         */
-        Row.prototype.copy = function () {
-            var theCopy = new Row(this._constant);
-            theCopy._cellMap = this._cellMap.copy();
-            return theCopy;
-        };
-        /**
-         * Add a constant value to the row constant.
-         *
-         * Returns the new value of the constant.
-         */
-        Row.prototype.add = function (value) {
-            return (this._constant += value);
-        };
-        /**
-         * Insert the symbol into the row with the given coefficient.
-         *
-         * If the symbol already exists in the row, the coefficient
-         * will be added to the existing coefficient. If the resulting
-         * coefficient is zero, the symbol will be removed from the row.
-         */
-        Row.prototype.insertSymbol = function (symbol, coefficient) {
-            if (coefficient === void 0) { coefficient = 1.0; }
-            var pair = this._cellMap.setDefault(symbol, function () { return 0.0; });
-            if (nearZero((pair.second += coefficient))) {
-                this._cellMap.erase(symbol);
-            }
-        };
-        /**
-         * Insert a row into this row with a given coefficient.
-         *
-         * The constant and the cells of the other row will be
-         * multiplied by the coefficient and added to this row. Any
-         * cell with a resulting coefficient of zero will be removed
-         * from the row.
-         */
-        Row.prototype.insertRow = function (other, coefficient) {
-            if (coefficient === void 0) { coefficient = 1.0; }
-            this._constant += other._constant * coefficient;
-            var cells = other._cellMap;
-            for (var i = 0, n = cells.size(); i < n; ++i) {
-                var pair = cells.itemAt(i);
-                this.insertSymbol(pair.first, pair.second * coefficient);
-            }
-        };
-        /**
-         * Remove a symbol from the row.
-         */
-        Row.prototype.removeSymbol = function (symbol) {
-            this._cellMap.erase(symbol);
-        };
-        /**
-         * Reverse the sign of the constant and cells in the row.
-         */
-        Row.prototype.reverseSign = function () {
-            this._constant = -this._constant;
-            var cells = this._cellMap;
-            for (var i = 0, n = cells.size(); i < n; ++i) {
-                var pair = cells.itemAt(i);
-                pair.second = -pair.second;
-            }
-        };
-        /**
-         * Solve the row for the given symbol.
-         *
-         * This method assumes the row is of the form
-         * a * x + b * y + c = 0 and (assuming solve for x) will modify
-         * the row to represent the right hand side of
-         * x = -b/a * y - c / a. The target symbol will be removed from
-         * the row, and the constant and other cells will be multiplied
-         * by the negative inverse of the target coefficient.
-         *
-         * The given symbol *must* exist in the row.
-         */
-        Row.prototype.solveFor = function (symbol) {
-            var cells = this._cellMap;
-            var pair = cells.erase(symbol);
-            var coeff = -1.0 / pair.second;
-            this._constant *= coeff;
-            for (var i = 0, n = cells.size(); i < n; ++i) {
-                cells.itemAt(i).second *= coeff;
-            }
-        };
-        /**
-         * Solve the row for the given symbols.
-         *
-         * This method assumes the row is of the form
-         * x = b * y + c and will solve the row such that
-         * y = x / b - c / b. The rhs symbol will be removed from the
-         * row, the lhs added, and the result divided by the negative
-         * inverse of the rhs coefficient.
-         *
-         * The lhs symbol *must not* exist in the row, and the rhs
-         * symbol must* exist in the row.
-         */
-        Row.prototype.solveForEx = function (lhs, rhs) {
-            this.insertSymbol(lhs, -1.0);
-            this.solveFor(rhs);
-        };
-        /**
-         * Returns the coefficient for the given symbol.
-         */
-        Row.prototype.coefficientFor = function (symbol) {
-            var pair = this._cellMap.find(symbol);
-            return pair !== undefined ? pair.second : 0.0;
-        };
-        /**
-         * Substitute a symbol with the data from another row.
-         *
-         * Given a row of the form a * x + b and a substitution of the
-         * form x = 3 * y + c the row will be updated to reflect the
-         * expression 3 * a * y + a * c + b.
-         *
-         * If the symbol does not exist in the row, this is a no-op.
-         */
-        Row.prototype.substitute = function (symbol, row) {
-            var pair = this._cellMap.erase(symbol);
-            if (pair !== undefined) {
-                this.insertRow(row, pair.second);
-            }
-        };
-        return Row;
-    }());
-
-    exports.Constraint = Constraint;
-    exports.Expression = Expression;
-    exports.Solver = Solver;
-    exports.Strength = Strength;
-    exports.Variable = Variable;
-
-    Object.defineProperty(exports, '__esModule', { value: true });
-
-}));
diff --git a/lib/kiwi.min.js b/lib/kiwi.min.js
deleted file mode 100644
index 38cbe72..0000000
--- a/lib/kiwi.min.js
+++ /dev/null
@@ -1,9 +0,0 @@
-
-/*-----------------------------------------------------------------------------
-| Copyright (c) 2014-2019, Nucleic Development Team & H. Rutjes & Lume.
-|
-| Distributed under the terms of the Modified BSD License.
-|
-| The full license is in the file COPYING.txt, distributed with this software.
------------------------------------------------------------------------------*/
-!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?e(exports):"function"==typeof define&&define.amd?define(["exports"],e):e((t=t||self).kiwi={})}(this,function(d){"use strict";function f(){return new t}i.prototype.size=function(){return this.array.length},i.prototype.empty=function(){return 0===this.array.length},i.prototype.itemAt=function(t){return this.array[t]},i.prototype.contains=function(t){return void 0!==this.index[t.id()]},i.prototype.find=function(t){t=this.index[t.id()];return void 0===t?void 0:this.array[t]},i.prototype.setDefault=function(t,e){var r=this.index[t.id()];return void 0===r?(e=new o(t,e()),this.index[t.id()]=this.array.length,this.array.push(e),e):this.array[r]},i.prototype.insert=function(t,e){var e=new o(t,e),r=this.index[t.id()];return void 0===r?(this.index[t.id()]=this.array.length,this.array.push(e)):this.array[r]=e,e},i.prototype.erase=function(t){var e,r=this.index[t.id()];if(void 0!==r)return this.index[t.id()]=void 0,(t=this.array[r])!==(e=this.array.pop())&&(this.array[r]=e,this.index[e.first.id()]=r),t},i.prototype.copy=function(){for(var t=new i,e=0;e=","="][this._operator]+" 0 ("+this._strength.toString()+")"};var c=p;function p(t,e,r,i){void 0===i&&(i=v.required),this._id=h++,this._operator=e,this._strength=v.clip(i),void 0===r&&t instanceof y?this._expression=t:this._expression=t.minus(r)}var _,u,h=0,m=(b.prototype.createConstraint=function(t,e,r,i){void 0===i&&(i=v.required);t=new c(t,e,r,i);return this.addConstraint(t),t},b.prototype.addConstraint=function(t){if(void 0!==this._cnMap.find(t))throw new Error("duplicate constraint");var e=this._createRow(t),r=e.row,e=e.tag,i=this._chooseSubject(r,e);if(i.type()===_.Invalid&&r.allDummies()){if(!w(r.constant()))throw new Error("unsatisfiable constraint");i=e.marker}if(i.type()===_.Invalid){if(!this._addWithArtificialVariable(r))throw new Error("unsatisfiable constraint")}else r.solveFor(i),this._substitute(i,r),this._rowMap.insert(i,r);this._cnMap.insert(t,e),this._optimize(this._objective)},b.prototype.removeConstraint=function(t){var e=this._cnMap.erase(t);if(void 0===e)throw new Error("unknown constraint");this._removeConstraintEffects(t,e.second);t=e.second.marker,e=this._rowMap.erase(t);if(void 0===e){var r=this._getMarkerLeavingSymbol(t);if(r.type()===_.Invalid)throw new Error("failed to find leaving row");(e=this._rowMap.erase(r)).second.solveForEx(r,t),this._substitute(t,e.second)}this._optimize(this._objective)},b.prototype.hasConstraint=function(t){return this._cnMap.contains(t)},b.prototype.addEditVariable=function(t,e){if(void 0!==this._editMap.find(t))throw new Error("duplicate edit variable");if((e=v.clip(e))===v.required)throw new Error("bad required strength");var r=new y(t),r=new c(r,d.Operator.Eq,void 0,e),e=(this.addConstraint(r),this._cnMap.find(r).second);this._editMap.insert(t,{tag:e,constraint:r,constant:0})},b.prototype.removeEditVariable=function(t){t=this._editMap.erase(t);if(void 0===t)throw new Error("unknown edit variable");this.removeConstraint(t.second.constraint)},b.prototype.hasEditVariable=function(t){return this._editMap.contains(t)},b.prototype.suggestValue=function(t,e){t=this._editMap.find(t);if(void 0===t)throw new Error("unknown edit variable");var r=this._rowMap,t=t.second,i=e-t.constant,o=(t.constant=e,t.tag.marker);if(void 0!==(e=r.find(o)))e.second.add(-i)<0&&this._infeasibleRows.push(o);else if(t=t.tag.other,void 0!==(e=r.find(t)))e.second.add(i)<0&&this._infeasibleRows.push(t);else for(var n=0,s=r.size();n docs/Kiwi.md && node scripts/docs-update-headings.js && prettier docs/Kiwi.md --write",
-		"bench": "node bench/main.cjs",
+		"cov": "istanbul cover ./node_modules/mocha/bin/_mocha --report lcovonly -R test/main.js",
+		"doc": "rollup -c && jsdoc2md -f tmp/kiwi.js -m none -g none > docs/Kiwi.md && node scripts/docs-update-headings.js && prettier docs/Kiwi.md --write",
+		"bench": "node bench/main.js",
 		"version": "npm run clean && npm run build && npm test && npm run bench && git add .",
 		"release:patch": "npm version patch -m 'v%s' && npm publish && git push --follow-tags",
 		"release:minor": "npm version minor -m 'v%s' && npm publish && git push --follow-tags",
diff --git a/rollup.config.js b/rollup.config.js
index 5a9c34d..a172db2 100644
--- a/rollup.config.js
+++ b/rollup.config.js
@@ -1,6 +1,4 @@
-import {uglify} from 'rollup-plugin-uglify'
-
-const license = `
+const license = /*js*/ `
 /*-----------------------------------------------------------------------------
 | Copyright (c) 2014-2019, Nucleic Development Team & H. Rutjes & Lume.
 |
@@ -11,7 +9,7 @@ const license = `
 `,
 	banner =
 		license +
-		`
+		/*js*/ `
 /**
  * Lume Kiwi is an efficient implementation of the Cassowary constraint solving
  * algorithm, based on the seminal Cassowary paper.
@@ -55,45 +53,18 @@ const license = `
  * @module @lume/kiwi
  */
 `
-
 // we generate three output formats:
-// - UMD in lib/kiwi.js
-// - minified UMD in lib/kiwi.min.js
-// - a fully ES6 version in tmp/kiwi.js, used just as the input to jsdoc2md, as we have
-//   Typescript set to down-compile the others to ES5 for max compatibility, but
-//   Typescript's ES5-polyfills confuse jsdoc2md.
+// - a fully ES6 version in tmp/kiwi.js, used just as the input to jsdoc2md.
 
-const umd = {
-	input: 'es/kiwi.js',
+const doc = {
+	input: 'dist/kiwi.js',
 	output: {
-		file: 'lib/kiwi.js',
-		format: 'umd',
 		name: 'kiwi',
 		exports: 'named',
 		banner,
-	},
-}
-const minified = {
-	...umd,
-	output: {
-		...umd.output,
-		file: 'lib/kiwi.min.js',
-	},
-	plugins: [
-		uglify({
-			output: {
-				preamble: license,
-			},
-		}),
-	],
-}
-const doc = {
-	input: 'tmp/es/kiwi.js',
-	output: {
-		...umd.output,
 		file: 'tmp/kiwi.js',
 		format: 'es',
 	},
 }
 
-export default [umd, minified, doc]
+export default [doc]
diff --git a/test/index.html b/test/index.html
index 2c13563..10302e1 100644
--- a/test/index.html
+++ b/test/index.html
@@ -3,17 +3,23 @@
 		
 		Mocha Tests
 		
+		
 	
 	
 		
- - - - diff --git a/test/main.cjs b/test/main.js similarity index 97% rename from test/main.cjs rename to test/main.js index f786a2c..d864212 100644 --- a/test/main.cjs +++ b/test/main.js @@ -1,15 +1,9 @@ /*global describe, it*/ -var assert = typeof window === 'undefined' ? require('assert') : window.chai.assert - -var getKiwi = () => { - return new Promise(resolve => { - typeof window === 'undefined' ? resolve(import('../es/kiwi.js')) : resolve(window.kiwi) - }) -} +var assert = typeof window === 'undefined' ? (await import('assert')).default : window.chai.assert describe('import kiwi', function () { it('imports kiwi', async function () { - const kiwi = await getKiwi() + const kiwi = await import('@lume/kiwi') describe('kiwi', function () { it('create Solver', function () { diff --git a/tsconfig.json b/tsconfig.json index dd3ccde..c756eca 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -1,10 +1,11 @@ { "compilerOptions": { - "target": "ES5", - "module": "es2015", + "target": "esnext", + "module": "esnext", + "newLine": "lf", //"strict": true, // aah: currently fails to build in strict mode, as previous build only specified noImplicitAny "noImplicitAny": true, - "outDir": "es", + "outDir": "dist", "declaration": true, "declarationMap": true, "types": []