flo-mat 3.0.4 → 3.0.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/browser/index.js +584 -16
- package/browser/index.min.js +1 -1
- package/node/bezier/total-curvature.d.ts +13 -1
- package/node/bezier/total-length.d.ts +13 -1
- package/node/cp-node/cp-node-fs.d.ts +12 -1
- package/node/cp-node/fs/get-distance-to-next.d.ts +12 -1
- package/node/cp-node/fs/get-mat-curve-to-next.d.ts +12 -1
- package/node/cp-node/fs/get-smoothed-speed.d.ts +12 -1
- package/node/cp-node/fs/get-speed.d.ts +12 -1
- package/node/geometry/get-bounding-box-.d.ts +13 -1
- package/node/point-on-shape/is-pos-quite-sharp-corner.d.ts +12 -1
- package/node/point-on-shape/is-pos-sharp-corner.d.ts +12 -1
- package/node/svg/get-loop-bounds.d.ts +12 -1
- package/node/svg/get-shape-bounds.d.ts +12 -1
- package/package.json +3 -3
- package/src/point-on-shape/is-pos-dull-corner.ts +1 -1
package/browser/index.js
CHANGED
|
@@ -566,6 +566,7 @@ function parseNumber(source) {
|
|
|
566
566
|
}
|
|
567
567
|
// Read the decimals.
|
|
568
568
|
if (ci < source._endIndex && source._string[ci] === ".") {
|
|
569
|
+
source._currentIndex += 1;
|
|
569
570
|
ci += 1;
|
|
570
571
|
if (ci >= source._endIndex ||
|
|
571
572
|
source._string[ci] < "0" ||
|
|
@@ -5127,29 +5128,593 @@ function totalLength(ps, maxCurviness = 0.4, gaussOrder = 16) {
|
|
|
5127
5128
|
|
|
5128
5129
|
//# sourceMappingURL=total-length.js.map
|
|
5129
5130
|
;// ./node_modules/flo-memoize/node/memoize.js
|
|
5131
|
+
function checkMapLength(map, idx, maxPrimitiveCacheLengths) {
|
|
5132
|
+
if (map.size === undefined || maxPrimitiveCacheLengths === undefined) {
|
|
5133
|
+
return;
|
|
5134
|
+
}
|
|
5135
|
+
const maxLen = maxPrimitiveCacheLengths[idx];
|
|
5136
|
+
if (map.size > maxLen && maxLen !== undefined) {
|
|
5137
|
+
// the below is to make sure we use the iterator protocol on the map
|
|
5138
|
+
// so we ensure O(1)
|
|
5139
|
+
for (const [k] of map) {
|
|
5140
|
+
map.delete(k);
|
|
5141
|
+
break;
|
|
5142
|
+
}
|
|
5143
|
+
}
|
|
5144
|
+
}
|
|
5130
5145
|
/**
|
|
5131
|
-
* Memoize
|
|
5146
|
+
* Memoize the given arity 0 function.
|
|
5147
|
+
*/
|
|
5148
|
+
function memoize0(f, maxPrimitiveCacheLengths) {
|
|
5149
|
+
let r;
|
|
5150
|
+
let executed = false;
|
|
5151
|
+
const f_ = function () {
|
|
5152
|
+
if (!executed) {
|
|
5153
|
+
r = f();
|
|
5154
|
+
executed = true;
|
|
5155
|
+
}
|
|
5156
|
+
return r;
|
|
5157
|
+
};
|
|
5158
|
+
return f_;
|
|
5159
|
+
}
|
|
5160
|
+
/**
|
|
5161
|
+
* Memoize (by reference on the input parameter) the given arity 1 function.
|
|
5132
5162
|
*
|
|
5133
|
-
* *
|
|
5134
|
-
* `WeakMap` and thus garbage collected later; this is especially important
|
|
5135
|
-
* in functional programming where a lot of garbage collection takes place;
|
|
5163
|
+
* * prefer most numerous parameters last in formal parameter list
|
|
5136
5164
|
*
|
|
5137
|
-
*
|
|
5138
|
-
*
|
|
5165
|
+
* @param f the function to memoize
|
|
5166
|
+
* @param maxPrimitiveCacheLengths optional array of maximum cache lengths for
|
|
5167
|
+
* primitive parameters in the order of the parameters of the functio; use zero
|
|
5168
|
+
* (or anything else really) for non-primitive values as they won't be used
|
|
5139
5169
|
*/
|
|
5140
|
-
function
|
|
5141
|
-
const
|
|
5142
|
-
|
|
5143
|
-
|
|
5144
|
-
|
|
5145
|
-
|
|
5146
|
-
|
|
5170
|
+
function memoize1(f, maxPrimitiveCacheLengths, logCacheMissHit = false) {
|
|
5171
|
+
const weakMapS = new WeakMap();
|
|
5172
|
+
const mapS = new Map();
|
|
5173
|
+
function getRMap(s) {
|
|
5174
|
+
const isObjS = (typeof s === "object" || typeof s === 'function') && s !== null;
|
|
5175
|
+
return isObjS ? weakMapS : mapS;
|
|
5176
|
+
}
|
|
5177
|
+
const f_ = function (s) {
|
|
5178
|
+
let r;
|
|
5179
|
+
const mS = getRMap(s);
|
|
5180
|
+
if (!mS.has(s)) {
|
|
5181
|
+
if (logCacheMissHit) {
|
|
5182
|
+
console.log('cache miss');
|
|
5183
|
+
}
|
|
5184
|
+
r = f(s);
|
|
5185
|
+
mS.set(s, r);
|
|
5186
|
+
checkMapLength(mapS, 0, maxPrimitiveCacheLengths);
|
|
5187
|
+
}
|
|
5188
|
+
else {
|
|
5189
|
+
if (logCacheMissHit) {
|
|
5190
|
+
console.log('cache hit');
|
|
5191
|
+
}
|
|
5192
|
+
r = mS.get(s);
|
|
5147
5193
|
}
|
|
5148
|
-
//console.log('cache miss');
|
|
5149
|
-
r = f(t);
|
|
5150
|
-
results.set(t, r);
|
|
5151
5194
|
return r;
|
|
5152
5195
|
};
|
|
5196
|
+
f_.mapS = mapS;
|
|
5197
|
+
f_.weakMapS = weakMapS;
|
|
5198
|
+
f_.clearCache = function () { mapS.clear(); };
|
|
5199
|
+
f_.addToCache = function (r, s) {
|
|
5200
|
+
const mS = getRMap(s);
|
|
5201
|
+
mS.set(s, r);
|
|
5202
|
+
checkMapLength(mS, 1, maxPrimitiveCacheLengths);
|
|
5203
|
+
};
|
|
5204
|
+
return f_;
|
|
5205
|
+
}
|
|
5206
|
+
/**
|
|
5207
|
+
* Memoize (by reference on the ordered input parameters) the given arity 2
|
|
5208
|
+
* function.
|
|
5209
|
+
*
|
|
5210
|
+
* * prefer most numerous parameters last in formal parameter list
|
|
5211
|
+
*
|
|
5212
|
+
* * @param cacheLengthForParam1 currently ignored but can easily be
|
|
5213
|
+
* implemented if needed
|
|
5214
|
+
*/
|
|
5215
|
+
function memoize2(f, maxPrimitiveCacheLengths) {
|
|
5216
|
+
const weakMapS = new WeakMap();
|
|
5217
|
+
const mapS = new Map();
|
|
5218
|
+
function getRMap(s, t) {
|
|
5219
|
+
const isObjS = (typeof s === "object" || typeof s === 'function') && s !== null;
|
|
5220
|
+
const isObjT = (typeof t === "object" || typeof t === 'function') && t !== null;
|
|
5221
|
+
let mS = isObjS ? weakMapS : mapS;
|
|
5222
|
+
let mmT = mS.get(s);
|
|
5223
|
+
if (mmT === undefined) {
|
|
5224
|
+
mmT = { weakMap: new WeakMap(), map: new Map() };
|
|
5225
|
+
mS.set(s, mmT);
|
|
5226
|
+
checkMapLength(mS, 0, maxPrimitiveCacheLengths);
|
|
5227
|
+
}
|
|
5228
|
+
return isObjT ? mmT.weakMap : mmT.map;
|
|
5229
|
+
}
|
|
5230
|
+
function f_(s, t) {
|
|
5231
|
+
const mT = getRMap(s, t);
|
|
5232
|
+
let r;
|
|
5233
|
+
if (!mT.has(t)) {
|
|
5234
|
+
r = f(s, t);
|
|
5235
|
+
mT.set(t, r);
|
|
5236
|
+
checkMapLength(mT, 1, maxPrimitiveCacheLengths);
|
|
5237
|
+
}
|
|
5238
|
+
else {
|
|
5239
|
+
r = mT.get(t);
|
|
5240
|
+
}
|
|
5241
|
+
return r;
|
|
5242
|
+
}
|
|
5243
|
+
f_.mapS = mapS;
|
|
5244
|
+
f_.weakMapS = weakMapS;
|
|
5245
|
+
f_.clearCache = function () { mapS.clear(); };
|
|
5246
|
+
f_.addToCache = function (r, s, t) {
|
|
5247
|
+
const mT = getRMap(s, t);
|
|
5248
|
+
mT.set(t, r);
|
|
5249
|
+
checkMapLength(mT, 1, maxPrimitiveCacheLengths);
|
|
5250
|
+
};
|
|
5251
|
+
return f_;
|
|
5252
|
+
}
|
|
5253
|
+
/**
|
|
5254
|
+
* Memoize (by reference on the ordered input parameters) the given arity 3
|
|
5255
|
+
* function.
|
|
5256
|
+
*
|
|
5257
|
+
* * prefer most numerous parameters last in formal parameter list
|
|
5258
|
+
*/
|
|
5259
|
+
function memoize3(f, maxPrimitiveCacheLengths) {
|
|
5260
|
+
const weakMapS = new WeakMap();
|
|
5261
|
+
const mapS = new Map();
|
|
5262
|
+
function getRMap(s, t, u) {
|
|
5263
|
+
const isObjS = (typeof s === "object" || typeof s === 'function') && s !== null;
|
|
5264
|
+
const isObjT = (typeof t === "object" || typeof t === 'function') && t !== null;
|
|
5265
|
+
const isObjU = (typeof u === "object" || typeof u === 'function') && u !== null;
|
|
5266
|
+
let mS = isObjS ? weakMapS : mapS;
|
|
5267
|
+
let mmT = mS.get(s);
|
|
5268
|
+
if (mmT === undefined) {
|
|
5269
|
+
mmT = { weakMap: new WeakMap(), map: new Map() };
|
|
5270
|
+
mS.set(s, mmT);
|
|
5271
|
+
checkMapLength(mS, 0, maxPrimitiveCacheLengths);
|
|
5272
|
+
}
|
|
5273
|
+
const mT = isObjT ? mmT.weakMap : mmT.map;
|
|
5274
|
+
let mmU = mT.get(t);
|
|
5275
|
+
if (mmU === undefined) {
|
|
5276
|
+
mmU = { weakMap: new WeakMap(), map: new Map() };
|
|
5277
|
+
mT.set(t, mmU);
|
|
5278
|
+
checkMapLength(mT, 1, maxPrimitiveCacheLengths);
|
|
5279
|
+
}
|
|
5280
|
+
return isObjU ? mmU.weakMap : mmU.map;
|
|
5281
|
+
}
|
|
5282
|
+
const f_ = function (s, t, u) {
|
|
5283
|
+
const mU = getRMap(s, t, u);
|
|
5284
|
+
let r;
|
|
5285
|
+
if (!mU.has(u)) {
|
|
5286
|
+
r = f(s, t, u);
|
|
5287
|
+
mU.set(u, r);
|
|
5288
|
+
checkMapLength(mU, 2, maxPrimitiveCacheLengths);
|
|
5289
|
+
}
|
|
5290
|
+
else {
|
|
5291
|
+
r = mU.get(u);
|
|
5292
|
+
}
|
|
5293
|
+
return r;
|
|
5294
|
+
};
|
|
5295
|
+
f_.mapS = mapS;
|
|
5296
|
+
f_.weakMapS = weakMapS;
|
|
5297
|
+
f_.clearCache = function () { mapS.clear(); };
|
|
5298
|
+
f_.addToCache = function (r, s, t, u) {
|
|
5299
|
+
const mU = getRMap(s, t, u);
|
|
5300
|
+
mU.set(u, r);
|
|
5301
|
+
checkMapLength(mU, 2, maxPrimitiveCacheLengths);
|
|
5302
|
+
};
|
|
5303
|
+
return f_;
|
|
5304
|
+
}
|
|
5305
|
+
/**
|
|
5306
|
+
* Memoize (by reference on the ordered input parameters) the given arity 4
|
|
5307
|
+
* function.
|
|
5308
|
+
*
|
|
5309
|
+
* * prefer most numerous parameters last in formal parameter list
|
|
5310
|
+
*/
|
|
5311
|
+
function memoize4(f, maxPrimitiveCacheLengths, logCacheMissHit = false) {
|
|
5312
|
+
const weakMapS = new WeakMap();
|
|
5313
|
+
const mapS = new Map();
|
|
5314
|
+
function getRMap(s, t, u, v) {
|
|
5315
|
+
const isObjS = (typeof s === "object" || typeof s === 'function') && s !== null;
|
|
5316
|
+
const isObjT = (typeof t === "object" || typeof t === 'function') && t !== null;
|
|
5317
|
+
const isObjU = (typeof u === "object" || typeof u === 'function') && u !== null;
|
|
5318
|
+
const isObjV = (typeof v === "object" || typeof v === 'function') && v !== null;
|
|
5319
|
+
let mS = isObjS
|
|
5320
|
+
? weakMapS
|
|
5321
|
+
: mapS;
|
|
5322
|
+
let mmT = mS.get(s);
|
|
5323
|
+
if (mmT === undefined) {
|
|
5324
|
+
mmT = { weakMap: new WeakMap(), map: new Map() };
|
|
5325
|
+
mS.set(s, mmT);
|
|
5326
|
+
checkMapLength(mS, 0, maxPrimitiveCacheLengths);
|
|
5327
|
+
}
|
|
5328
|
+
const mT = isObjT ? mmT.weakMap : mmT.map;
|
|
5329
|
+
let mmU = mT.get(t);
|
|
5330
|
+
if (mmU === undefined) {
|
|
5331
|
+
mmU = { weakMap: new WeakMap(), map: new Map() };
|
|
5332
|
+
mT.set(t, mmU);
|
|
5333
|
+
checkMapLength(mT, 1, maxPrimitiveCacheLengths);
|
|
5334
|
+
}
|
|
5335
|
+
const mU = isObjU ? mmU.weakMap : mmU.map;
|
|
5336
|
+
let mmV = mU.get(u);
|
|
5337
|
+
if (mmV === undefined) {
|
|
5338
|
+
mmV = { weakMap: new WeakMap(), map: new Map() };
|
|
5339
|
+
mU.set(u, mmV);
|
|
5340
|
+
checkMapLength(mU, 2, maxPrimitiveCacheLengths);
|
|
5341
|
+
}
|
|
5342
|
+
return isObjV ? mmV.weakMap : mmV.map;
|
|
5343
|
+
}
|
|
5344
|
+
const f_ = function (s, t, u, v) {
|
|
5345
|
+
const mV = getRMap(s, t, u, v);
|
|
5346
|
+
let r;
|
|
5347
|
+
if (!mV.has(v)) {
|
|
5348
|
+
if (logCacheMissHit) {
|
|
5349
|
+
console.log('cache miss');
|
|
5350
|
+
}
|
|
5351
|
+
r = f(s, t, u, v);
|
|
5352
|
+
mV.set(v, r);
|
|
5353
|
+
checkMapLength(mV, 3, maxPrimitiveCacheLengths);
|
|
5354
|
+
}
|
|
5355
|
+
else {
|
|
5356
|
+
if (logCacheMissHit) {
|
|
5357
|
+
console.log('cache hit');
|
|
5358
|
+
}
|
|
5359
|
+
r = mV.get(v);
|
|
5360
|
+
}
|
|
5361
|
+
return r;
|
|
5362
|
+
};
|
|
5363
|
+
f_.mapS = mapS;
|
|
5364
|
+
f_.weakMapS = weakMapS;
|
|
5365
|
+
f_.clearCache = function () { mapS.clear(); };
|
|
5366
|
+
f_.addToCache = function (r, s, t, u, v) {
|
|
5367
|
+
const mV = getRMap(s, t, u, v);
|
|
5368
|
+
mV.set(v, r);
|
|
5369
|
+
checkMapLength(mV, 3, maxPrimitiveCacheLengths);
|
|
5370
|
+
};
|
|
5371
|
+
return f_;
|
|
5372
|
+
}
|
|
5373
|
+
/**
|
|
5374
|
+
* Memoize (by reference on the ordered input parameters) the given arity 5
|
|
5375
|
+
* function.
|
|
5376
|
+
*
|
|
5377
|
+
* * prefer most numerous parameters last in formal parameter list
|
|
5378
|
+
*/
|
|
5379
|
+
function memoize5(f, maxPrimitiveCacheLengths) {
|
|
5380
|
+
const weakMapS = new WeakMap();
|
|
5381
|
+
const mapS = new Map();
|
|
5382
|
+
function getRMap(s, t, u, v, w) {
|
|
5383
|
+
const isObjS = (typeof s === "object" || typeof s === 'function') && s !== null;
|
|
5384
|
+
const isObjT = (typeof t === "object" || typeof t === 'function') && t !== null;
|
|
5385
|
+
const isObjU = (typeof u === "object" || typeof u === 'function') && u !== null;
|
|
5386
|
+
const isObjV = (typeof v === "object" || typeof v === 'function') && v !== null;
|
|
5387
|
+
const isObjW = (typeof w === "object" || typeof w === 'function') && w !== null;
|
|
5388
|
+
let mS = isObjS ? weakMapS : mapS;
|
|
5389
|
+
let mmT = mS.get(s);
|
|
5390
|
+
if (mmT === undefined) {
|
|
5391
|
+
mmT = { weakMap: new WeakMap(), map: new Map() };
|
|
5392
|
+
mS.set(s, mmT);
|
|
5393
|
+
checkMapLength(mS, 0, maxPrimitiveCacheLengths);
|
|
5394
|
+
}
|
|
5395
|
+
const mT = isObjT ? mmT.weakMap : mmT.map;
|
|
5396
|
+
let mmU = mT.get(t);
|
|
5397
|
+
if (mmU === undefined) {
|
|
5398
|
+
mmU = { weakMap: new WeakMap(), map: new Map() };
|
|
5399
|
+
mT.set(t, mmU);
|
|
5400
|
+
checkMapLength(mT, 1, maxPrimitiveCacheLengths);
|
|
5401
|
+
}
|
|
5402
|
+
const mU = isObjU ? mmU.weakMap : mmU.map;
|
|
5403
|
+
let mmV = mU.get(u);
|
|
5404
|
+
if (mmV === undefined) {
|
|
5405
|
+
mmV = { weakMap: new WeakMap(), map: new Map() };
|
|
5406
|
+
mU.set(u, mmV);
|
|
5407
|
+
checkMapLength(mU, 2, maxPrimitiveCacheLengths);
|
|
5408
|
+
}
|
|
5409
|
+
const mV = isObjV ? mmV.weakMap : mmV.map;
|
|
5410
|
+
let mmW = mV.get(v);
|
|
5411
|
+
if (mmW === undefined) {
|
|
5412
|
+
mmW = { weakMap: new WeakMap(), map: new Map() };
|
|
5413
|
+
mV.set(v, mmW);
|
|
5414
|
+
checkMapLength(mV, 3, maxPrimitiveCacheLengths);
|
|
5415
|
+
}
|
|
5416
|
+
return isObjW ? mmW.weakMap : mmW.map;
|
|
5417
|
+
}
|
|
5418
|
+
const f_ = function (s, t, u, v, w) {
|
|
5419
|
+
const mW = getRMap(s, t, u, v, w);
|
|
5420
|
+
let r;
|
|
5421
|
+
if (!mW.has(w)) {
|
|
5422
|
+
r = f(s, t, u, v, w);
|
|
5423
|
+
mW.set(w, r);
|
|
5424
|
+
checkMapLength(mW, 4, maxPrimitiveCacheLengths);
|
|
5425
|
+
}
|
|
5426
|
+
else {
|
|
5427
|
+
r = mW.get(w);
|
|
5428
|
+
}
|
|
5429
|
+
return r;
|
|
5430
|
+
};
|
|
5431
|
+
f_.mapS = mapS;
|
|
5432
|
+
f_.weakMapS = weakMapS;
|
|
5433
|
+
f_.clearCache = function () { mapS.clear(); };
|
|
5434
|
+
f_.addToCache = function (r, s, t, u, v, w) {
|
|
5435
|
+
const mW = getRMap(s, t, u, v, w);
|
|
5436
|
+
mW.set(w, r);
|
|
5437
|
+
checkMapLength(mW, 4, maxPrimitiveCacheLengths);
|
|
5438
|
+
};
|
|
5439
|
+
return f_;
|
|
5440
|
+
}
|
|
5441
|
+
/**
|
|
5442
|
+
* Memoize (by reference on the ordered input parameters) the given arity 6
|
|
5443
|
+
* function.
|
|
5444
|
+
*
|
|
5445
|
+
* * prefer most numerous parameters last in formal parameter list
|
|
5446
|
+
*/
|
|
5447
|
+
function memoize6(f, maxPrimitiveCacheLengths) {
|
|
5448
|
+
const weakMapS = new WeakMap();
|
|
5449
|
+
const mapS = new Map();
|
|
5450
|
+
function getRMap(s, t, u, v, w, x) {
|
|
5451
|
+
const isObjS = (typeof s === "object" || typeof s === 'function') && s !== null;
|
|
5452
|
+
const isObjT = (typeof t === "object" || typeof t === 'function') && t !== null;
|
|
5453
|
+
const isObjU = (typeof u === "object" || typeof u === 'function') && u !== null;
|
|
5454
|
+
const isObjV = (typeof v === "object" || typeof v === 'function') && v !== null;
|
|
5455
|
+
const isObjW = (typeof w === "object" || typeof w === 'function') && w !== null;
|
|
5456
|
+
const isObjX = (typeof x === "object" || typeof x === 'function') && x !== null;
|
|
5457
|
+
let mS = isObjS ? weakMapS : mapS;
|
|
5458
|
+
let mmT = mS.get(s);
|
|
5459
|
+
if (mmT === undefined) {
|
|
5460
|
+
mmT = { weakMap: new WeakMap(), map: new Map() };
|
|
5461
|
+
mS.set(s, mmT);
|
|
5462
|
+
checkMapLength(mS, 0, maxPrimitiveCacheLengths);
|
|
5463
|
+
}
|
|
5464
|
+
const mT = isObjT ? mmT.weakMap : mmT.map;
|
|
5465
|
+
let mmU = mT.get(t);
|
|
5466
|
+
if (mmU === undefined) {
|
|
5467
|
+
mmU = { weakMap: new WeakMap(), map: new Map() };
|
|
5468
|
+
mT.set(t, mmU);
|
|
5469
|
+
checkMapLength(mT, 1, maxPrimitiveCacheLengths);
|
|
5470
|
+
}
|
|
5471
|
+
const mU = isObjU ? mmU.weakMap : mmU.map;
|
|
5472
|
+
let mmV = mU.get(u);
|
|
5473
|
+
if (mmV === undefined) {
|
|
5474
|
+
mmV = { weakMap: new WeakMap(), map: new Map() };
|
|
5475
|
+
mU.set(u, mmV);
|
|
5476
|
+
checkMapLength(mU, 2, maxPrimitiveCacheLengths);
|
|
5477
|
+
}
|
|
5478
|
+
const mV = isObjV ? mmV.weakMap : mmV.map;
|
|
5479
|
+
let mmW = mV.get(v);
|
|
5480
|
+
if (mmW === undefined) {
|
|
5481
|
+
mmW = { weakMap: new WeakMap(), map: new Map() };
|
|
5482
|
+
mV.set(v, mmW);
|
|
5483
|
+
checkMapLength(mV, 3, maxPrimitiveCacheLengths);
|
|
5484
|
+
}
|
|
5485
|
+
const mW = isObjW ? mmW.weakMap : mmW.map;
|
|
5486
|
+
let mmX = mW.get(w);
|
|
5487
|
+
if (mmX === undefined) {
|
|
5488
|
+
mmX = { weakMap: new WeakMap(), map: new Map() };
|
|
5489
|
+
mW.set(w, mmX);
|
|
5490
|
+
checkMapLength(mW, 4, maxPrimitiveCacheLengths);
|
|
5491
|
+
}
|
|
5492
|
+
return isObjX ? mmX.weakMap : mmX.map;
|
|
5493
|
+
}
|
|
5494
|
+
const f_ = function (s, t, u, v, w, x) {
|
|
5495
|
+
const mX = getRMap(s, t, u, v, w, x);
|
|
5496
|
+
let r;
|
|
5497
|
+
if (!mX.has(x)) {
|
|
5498
|
+
r = f(s, t, u, v, w, x);
|
|
5499
|
+
mX.set(x, r);
|
|
5500
|
+
checkMapLength(mX, 5, maxPrimitiveCacheLengths);
|
|
5501
|
+
}
|
|
5502
|
+
else {
|
|
5503
|
+
r = mX.get(x);
|
|
5504
|
+
}
|
|
5505
|
+
return r;
|
|
5506
|
+
};
|
|
5507
|
+
f_.mapS = mapS;
|
|
5508
|
+
f_.weakMapS = weakMapS;
|
|
5509
|
+
f_.clearCache = function () { mapS.clear(); };
|
|
5510
|
+
f_.addToCache = function (r, s, t, u, v, w, x) {
|
|
5511
|
+
const mX = getRMap(s, t, u, v, w, x);
|
|
5512
|
+
mX.set(x, r);
|
|
5513
|
+
checkMapLength(mX, 5, maxPrimitiveCacheLengths);
|
|
5514
|
+
};
|
|
5515
|
+
return f_;
|
|
5516
|
+
}
|
|
5517
|
+
/**
|
|
5518
|
+
* Memoize (by reference on the ordered input parameters) the given arity 7
|
|
5519
|
+
* function.
|
|
5520
|
+
*
|
|
5521
|
+
* * prefer most numerous parameters last in formal parameter list
|
|
5522
|
+
*/
|
|
5523
|
+
function memoize7(f, maxPrimitiveCacheLengths) {
|
|
5524
|
+
const weakMapS = new WeakMap();
|
|
5525
|
+
const mapS = new Map();
|
|
5526
|
+
function getRMap(s, t, u, v, w, x, y) {
|
|
5527
|
+
const isObjS = (typeof s === "object" || typeof s === 'function') && s !== null;
|
|
5528
|
+
const isObjT = (typeof t === "object" || typeof t === 'function') && t !== null;
|
|
5529
|
+
const isObjU = (typeof u === "object" || typeof u === 'function') && u !== null;
|
|
5530
|
+
const isObjV = (typeof v === "object" || typeof v === 'function') && v !== null;
|
|
5531
|
+
const isObjW = (typeof w === "object" || typeof w === 'function') && w !== null;
|
|
5532
|
+
const isObjX = (typeof x === "object" || typeof x === 'function') && x !== null;
|
|
5533
|
+
const isObjY = (typeof y === "object" || typeof y === 'function') && y !== null;
|
|
5534
|
+
let mS = isObjS ? weakMapS : mapS;
|
|
5535
|
+
let mmT = mS.get(s);
|
|
5536
|
+
if (mmT === undefined) {
|
|
5537
|
+
mmT = { weakMap: new WeakMap(), map: new Map() };
|
|
5538
|
+
mS.set(s, mmT);
|
|
5539
|
+
checkMapLength(mS, 0, maxPrimitiveCacheLengths);
|
|
5540
|
+
}
|
|
5541
|
+
const mT = isObjT ? mmT.weakMap : mmT.map;
|
|
5542
|
+
let mmU = mT.get(t);
|
|
5543
|
+
if (mmU === undefined) {
|
|
5544
|
+
mmU = { weakMap: new WeakMap(), map: new Map() };
|
|
5545
|
+
mT.set(t, mmU);
|
|
5546
|
+
checkMapLength(mT, 1, maxPrimitiveCacheLengths);
|
|
5547
|
+
}
|
|
5548
|
+
const mU = isObjU ? mmU.weakMap : mmU.map;
|
|
5549
|
+
let mmV = mU.get(u);
|
|
5550
|
+
if (mmV === undefined) {
|
|
5551
|
+
mmV = { weakMap: new WeakMap(), map: new Map() };
|
|
5552
|
+
mU.set(u, mmV);
|
|
5553
|
+
checkMapLength(mU, 2, maxPrimitiveCacheLengths);
|
|
5554
|
+
}
|
|
5555
|
+
const mV = isObjV ? mmV.weakMap : mmV.map;
|
|
5556
|
+
let mmW = mV.get(v);
|
|
5557
|
+
if (mmW === undefined) {
|
|
5558
|
+
mmW = { weakMap: new WeakMap(), map: new Map() };
|
|
5559
|
+
mV.set(v, mmW);
|
|
5560
|
+
checkMapLength(mV, 3, maxPrimitiveCacheLengths);
|
|
5561
|
+
}
|
|
5562
|
+
const mW = isObjW ? mmW.weakMap : mmW.map;
|
|
5563
|
+
let mmX = mW.get(w);
|
|
5564
|
+
if (mmX === undefined) {
|
|
5565
|
+
mmX = { weakMap: new WeakMap(), map: new Map() };
|
|
5566
|
+
mW.set(w, mmX);
|
|
5567
|
+
checkMapLength(mW, 4, maxPrimitiveCacheLengths);
|
|
5568
|
+
}
|
|
5569
|
+
const mX = isObjX ? mmX.weakMap : mmX.map;
|
|
5570
|
+
let mmY = mX.get(x);
|
|
5571
|
+
if (mmY === undefined) {
|
|
5572
|
+
mmY = { weakMap: new WeakMap(), map: new Map() };
|
|
5573
|
+
mX.set(x, mmY);
|
|
5574
|
+
checkMapLength(mX, 5, maxPrimitiveCacheLengths);
|
|
5575
|
+
}
|
|
5576
|
+
return isObjY ? mmY.weakMap : mmY.map;
|
|
5577
|
+
}
|
|
5578
|
+
const f_ = function (s, t, u, v, w, x, y) {
|
|
5579
|
+
const mY = getRMap(s, t, u, v, w, x, y);
|
|
5580
|
+
let r;
|
|
5581
|
+
if (!mY.has(y)) {
|
|
5582
|
+
r = f(s, t, u, v, w, x, y);
|
|
5583
|
+
mY.set(y, r);
|
|
5584
|
+
checkMapLength(mY, 6, maxPrimitiveCacheLengths);
|
|
5585
|
+
}
|
|
5586
|
+
else {
|
|
5587
|
+
r = mY.get(y);
|
|
5588
|
+
}
|
|
5589
|
+
return r;
|
|
5590
|
+
};
|
|
5591
|
+
f_.mapS = mapS;
|
|
5592
|
+
f_.weakMapS = weakMapS;
|
|
5593
|
+
f_.clearCache = function () { mapS.clear(); };
|
|
5594
|
+
f_.addToCache = function (r, s, t, u, v, w, x, y) {
|
|
5595
|
+
const mY = getRMap(s, t, u, v, w, x, y);
|
|
5596
|
+
mY.set(y, r);
|
|
5597
|
+
checkMapLength(mY, 6, maxPrimitiveCacheLengths);
|
|
5598
|
+
};
|
|
5599
|
+
return f_;
|
|
5600
|
+
}
|
|
5601
|
+
/**
|
|
5602
|
+
* Memoize (by reference on the ordered input parameters) the given arity 8
|
|
5603
|
+
* function.
|
|
5604
|
+
*
|
|
5605
|
+
* * prefer most numerous parameters last in formal parameter list
|
|
5606
|
+
*/
|
|
5607
|
+
function memoize8(f, maxPrimitiveCacheLengths) {
|
|
5608
|
+
const weakMapS = new WeakMap();
|
|
5609
|
+
const mapS = new Map();
|
|
5610
|
+
function getRMap(s, t, u, v, w, x, y, z) {
|
|
5611
|
+
const isObjS = (typeof s === "object" || typeof s === 'function') && s !== null;
|
|
5612
|
+
const isObjT = (typeof t === "object" || typeof t === 'function') && t !== null;
|
|
5613
|
+
const isObjU = (typeof u === "object" || typeof u === 'function') && u !== null;
|
|
5614
|
+
const isObjV = (typeof v === "object" || typeof v === 'function') && v !== null;
|
|
5615
|
+
const isObjW = (typeof w === "object" || typeof w === 'function') && w !== null;
|
|
5616
|
+
const isObjX = (typeof x === "object" || typeof x === 'function') && x !== null;
|
|
5617
|
+
const isObjY = (typeof y === "object" || typeof y === 'function') && y !== null;
|
|
5618
|
+
const isObjZ = (typeof z === "object" || typeof z === 'function') && z !== null;
|
|
5619
|
+
let mS = isObjS ? weakMapS : mapS;
|
|
5620
|
+
let mmT = mS.get(s);
|
|
5621
|
+
if (mmT === undefined) {
|
|
5622
|
+
mmT = { weakMap: new WeakMap(), map: new Map() };
|
|
5623
|
+
mS.set(s, mmT);
|
|
5624
|
+
checkMapLength(mS, 0, maxPrimitiveCacheLengths);
|
|
5625
|
+
}
|
|
5626
|
+
const mT = isObjT ? mmT.weakMap : mmT.map;
|
|
5627
|
+
let mmU = mT.get(t);
|
|
5628
|
+
if (mmU === undefined) {
|
|
5629
|
+
mmU = { weakMap: new WeakMap(), map: new Map() };
|
|
5630
|
+
mT.set(t, mmU);
|
|
5631
|
+
checkMapLength(mT, 1, maxPrimitiveCacheLengths);
|
|
5632
|
+
}
|
|
5633
|
+
const mU = isObjU ? mmU.weakMap : mmU.map;
|
|
5634
|
+
let mmV = mU.get(u);
|
|
5635
|
+
if (mmV === undefined) {
|
|
5636
|
+
mmV = { weakMap: new WeakMap(), map: new Map() };
|
|
5637
|
+
mU.set(u, mmV);
|
|
5638
|
+
checkMapLength(mU, 2, maxPrimitiveCacheLengths);
|
|
5639
|
+
}
|
|
5640
|
+
const mV = isObjV ? mmV.weakMap : mmV.map;
|
|
5641
|
+
let mmW = mV.get(v);
|
|
5642
|
+
if (mmW === undefined) {
|
|
5643
|
+
mmW = { weakMap: new WeakMap(), map: new Map() };
|
|
5644
|
+
mV.set(v, mmW);
|
|
5645
|
+
checkMapLength(mV, 3, maxPrimitiveCacheLengths);
|
|
5646
|
+
}
|
|
5647
|
+
const mW = isObjW ? mmW.weakMap : mmW.map;
|
|
5648
|
+
let mmX = mW.get(w);
|
|
5649
|
+
if (mmX === undefined) {
|
|
5650
|
+
mmX = { weakMap: new WeakMap(), map: new Map() };
|
|
5651
|
+
mW.set(w, mmX);
|
|
5652
|
+
checkMapLength(mW, 4, maxPrimitiveCacheLengths);
|
|
5653
|
+
}
|
|
5654
|
+
const mX = isObjX ? mmX.weakMap : mmX.map;
|
|
5655
|
+
let mmY = mX.get(x);
|
|
5656
|
+
if (mmY === undefined) {
|
|
5657
|
+
mmY = { weakMap: new WeakMap(), map: new Map() };
|
|
5658
|
+
mX.set(x, mmY);
|
|
5659
|
+
checkMapLength(mX, 5, maxPrimitiveCacheLengths);
|
|
5660
|
+
}
|
|
5661
|
+
const mY = isObjY ? mmY.weakMap : mmY.map;
|
|
5662
|
+
let mmZ = mY.get(y);
|
|
5663
|
+
if (mmZ === undefined) {
|
|
5664
|
+
mmZ = { weakMap: new WeakMap(), map: new Map() };
|
|
5665
|
+
mY.set(y, mmZ);
|
|
5666
|
+
checkMapLength(mY, 6, maxPrimitiveCacheLengths);
|
|
5667
|
+
}
|
|
5668
|
+
return isObjZ ? mmZ.weakMap : mmZ.map;
|
|
5669
|
+
}
|
|
5670
|
+
const f_ = function (s, t, u, v, w, x, y, z) {
|
|
5671
|
+
const mZ = getRMap(s, t, u, v, w, x, y, z);
|
|
5672
|
+
let r;
|
|
5673
|
+
if (!mZ.has(z)) {
|
|
5674
|
+
r = f(s, t, u, v, w, x, y, z);
|
|
5675
|
+
mZ.set(z, r);
|
|
5676
|
+
checkMapLength(mZ, 7, maxPrimitiveCacheLengths);
|
|
5677
|
+
}
|
|
5678
|
+
else {
|
|
5679
|
+
r = mZ.get(z);
|
|
5680
|
+
}
|
|
5681
|
+
return r;
|
|
5682
|
+
};
|
|
5683
|
+
f_.mapS = mapS;
|
|
5684
|
+
f_.weakMapS = weakMapS;
|
|
5685
|
+
f_.clearCache = function () { mapS.clear(); };
|
|
5686
|
+
f_.addToCache = function (r, s, t, u, v, w, x, y, z) {
|
|
5687
|
+
const mZ = getRMap(s, t, u, v, w, x, y, z);
|
|
5688
|
+
mZ.set(z, r);
|
|
5689
|
+
checkMapLength(mZ, 7, maxPrimitiveCacheLengths);
|
|
5690
|
+
};
|
|
5691
|
+
return f_;
|
|
5692
|
+
}
|
|
5693
|
+
const memoizeN = [
|
|
5694
|
+
memoize0,
|
|
5695
|
+
memoize1, memoize2, memoize3, memoize4,
|
|
5696
|
+
memoize5, memoize6, memoize7, memoize8
|
|
5697
|
+
];
|
|
5698
|
+
/**
|
|
5699
|
+
* Memoize (by reference on the ordered input parameters) the given function
|
|
5700
|
+
* up to arity 8.
|
|
5701
|
+
*
|
|
5702
|
+
* * prefer most numerous parameters last in formal parameter list
|
|
5703
|
+
*
|
|
5704
|
+
* @param f the function to memoize
|
|
5705
|
+
* @param maxPrimitiveCacheLengths if not `undefined` then the size of caching
|
|
5706
|
+
* maps having primitive values is limited to this value (in which case it is
|
|
5707
|
+
* a Map (not a WeakMap)). The value corresponds to the index of the function
|
|
5708
|
+
* parameter, starting from 0.
|
|
5709
|
+
*/
|
|
5710
|
+
function memoize(f, maxPrimitiveCacheLengths, logCacheMissHit = false) {
|
|
5711
|
+
const len = f.length;
|
|
5712
|
+
if (len > 8) {
|
|
5713
|
+
throw new Error('A maximum of 8 formal parameters are supported');
|
|
5714
|
+
}
|
|
5715
|
+
const memoize_ = memoizeN[len];
|
|
5716
|
+
//@ts-ignore
|
|
5717
|
+
return memoize_(f, maxPrimitiveCacheLengths, logCacheMissHit);
|
|
5153
5718
|
}
|
|
5154
5719
|
|
|
5155
5720
|
//# sourceMappingURL=memoize.js.map
|
|
@@ -18206,6 +18771,7 @@ function getInOutsViaSides(container, ioIdx) {
|
|
|
18206
18771
|
//# sourceMappingURL=get-in-outs-via-sides.js.map
|
|
18207
18772
|
;// ./node_modules/flo-boolean/node/containers/get-container-in-outs/get-container-in-outs.js
|
|
18208
18773
|
|
|
18774
|
+
// import { getInOutsViaCrossing } from "./get-in-outs-via-crossing/get-in-outs-via-crossing.js";
|
|
18209
18775
|
/**
|
|
18210
18776
|
* * **warning** ioIdx will be modified by this function
|
|
18211
18777
|
*
|
|
@@ -22092,7 +22658,9 @@ function filterContainers(containers) {
|
|
|
22092
22658
|
|
|
22093
22659
|
|
|
22094
22660
|
|
|
22661
|
+
// import { compareInOut } from './get-container-in-outs/get-in-outs-via-sides/compare-in-out.js';
|
|
22095
22662
|
|
|
22663
|
+
// import { orderInOuts } from './order-in-outs.js';
|
|
22096
22664
|
/**
|
|
22097
22665
|
*
|
|
22098
22666
|
* @param containerDim
|