@khanacademy/perseus 19.1.7 → 19.1.8
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/dist/es/index.js +227 -380
- package/dist/es/index.js.map +1 -1
- package/dist/index.js +227 -380
- package/dist/index.js.map +1 -1
- package/package.json +3 -3
package/dist/index.js
CHANGED
|
@@ -4237,22 +4237,13 @@ const InteractiveUtil = {
|
|
|
4237
4237
|
}
|
|
4238
4238
|
};
|
|
4239
4239
|
|
|
4240
|
-
var commonjsGlobal = typeof globalThis !== 'undefined' ? globalThis : typeof window !== 'undefined' ? window : typeof global !== 'undefined' ? global : typeof self !== 'undefined' ? self : {};
|
|
4241
|
-
|
|
4242
|
-
function getDefaultExportFromCjs (x) {
|
|
4243
|
-
return x && x.__esModule && Object.prototype.hasOwnProperty.call(x, 'default') ? x['default'] : x;
|
|
4244
|
-
}
|
|
4245
|
-
|
|
4246
|
-
var raphael = {exports: {}};
|
|
4247
|
-
|
|
4248
4240
|
/*!
|
|
4249
4241
|
* Raphael 1.5.2 - JavaScript Vector Library
|
|
4250
4242
|
*
|
|
4251
4243
|
* Copyright (c) 2010 Dmitry Baranovskiy (http://raphaeljs.com)
|
|
4252
4244
|
* Licensed under the MIT (http://raphaeljs.com/license.html) license.
|
|
4253
4245
|
*/
|
|
4254
|
-
|
|
4255
|
-
(function () {
|
|
4246
|
+
var Raphael$1 = (function () {
|
|
4256
4247
|
var setAttr;
|
|
4257
4248
|
if ("".trim) {
|
|
4258
4249
|
setAttr = function (node, att, value) {
|
|
@@ -8429,7 +8420,7 @@ var raphael = {exports: {}};
|
|
|
8429
8420
|
};
|
|
8430
8421
|
R.el = elproto;
|
|
8431
8422
|
R.st = Set[proto];
|
|
8432
|
-
|
|
8423
|
+
return R;
|
|
8433
8424
|
})();
|
|
8434
8425
|
|
|
8435
8426
|
/**
|
|
@@ -8717,7 +8708,7 @@ class Graphie$1 {
|
|
|
8717
8708
|
constructor(el) {
|
|
8718
8709
|
this.el = el;
|
|
8719
8710
|
$__default["default"](el).css("position", "relative");
|
|
8720
|
-
this.raphael =
|
|
8711
|
+
this.raphael = Raphael$1(el);
|
|
8721
8712
|
|
|
8722
8713
|
// For a sometimes-reproducible IE8 bug; doesn't affect SVG browsers at all
|
|
8723
8714
|
$__default["default"](el).children("div").css("position", "absolute");
|
|
@@ -9076,7 +9067,7 @@ class Graphie$1 {
|
|
|
9076
9067
|
// wrapper.setAttribute("data-graphie-type", "ellipse");
|
|
9077
9068
|
|
|
9078
9069
|
// Create Raphael canvas
|
|
9079
|
-
const localRaphael =
|
|
9070
|
+
const localRaphael = Raphael$1(wrapper, width, height);
|
|
9080
9071
|
const visibleShape = localRaphael.ellipse(width / 2, height / 2, scaledRadii[0], scaledRadii[1]);
|
|
9081
9072
|
return {
|
|
9082
9073
|
wrapper: wrapper,
|
|
@@ -9143,7 +9134,7 @@ class Graphie$1 {
|
|
|
9143
9134
|
});
|
|
9144
9135
|
|
|
9145
9136
|
// Create Raphael canvas
|
|
9146
|
-
const localRaphael =
|
|
9137
|
+
const localRaphael = Raphael$1(wrapper, width, height);
|
|
9147
9138
|
|
|
9148
9139
|
// Calculate path
|
|
9149
9140
|
const visibleShape = localRaphael.path(createPath(points));
|
|
@@ -9206,7 +9197,7 @@ class Graphie$1 {
|
|
|
9206
9197
|
});
|
|
9207
9198
|
|
|
9208
9199
|
// Create Raphael canvas
|
|
9209
|
-
const localRaphael =
|
|
9200
|
+
const localRaphael = Raphael$1(wrapper, width, height);
|
|
9210
9201
|
|
|
9211
9202
|
// Calculate path
|
|
9212
9203
|
const path = "M" + start[0] + " " + start[1] + " " + "L" + end[0] + " " + end[1];
|
|
@@ -9430,7 +9421,7 @@ class Graphie$1 {
|
|
|
9430
9421
|
postprocessDrawingResult(result) {
|
|
9431
9422
|
// Bad heuristic for recognizing Raphael elements and sets
|
|
9432
9423
|
const type = result.constructor.prototype;
|
|
9433
|
-
if (type ===
|
|
9424
|
+
if (type === Raphael$1.el || type === Raphael$1.st) {
|
|
9434
9425
|
result.attr(this.currentStyle);
|
|
9435
9426
|
if (this.currentStyle.arrows) {
|
|
9436
9427
|
result = this.addArrowheads(result);
|
|
@@ -9448,7 +9439,7 @@ class Graphie$1 {
|
|
|
9448
9439
|
}
|
|
9449
9440
|
addArrowheads(path) {
|
|
9450
9441
|
const type = path.constructor.prototype;
|
|
9451
|
-
if (type ===
|
|
9442
|
+
if (type === Raphael$1.el) {
|
|
9452
9443
|
if (path.type === "path" && typeof path.arrowheadsDrawn === "undefined") {
|
|
9453
9444
|
const w = path.attr("stroke-width");
|
|
9454
9445
|
const s = 0.6 + 0.4 * w;
|
|
@@ -9476,7 +9467,7 @@ class Graphie$1 {
|
|
|
9476
9467
|
set.push(head);
|
|
9477
9468
|
return set;
|
|
9478
9469
|
}
|
|
9479
|
-
} else if (type ===
|
|
9470
|
+
} else if (type === Raphael$1.st) {
|
|
9480
9471
|
for (let i = 0, l = path.items.length; i < l; i++) {
|
|
9481
9472
|
this.addArrowheads(path.items[i]);
|
|
9482
9473
|
}
|
|
@@ -10664,7 +10655,7 @@ ___default["default"].extend(GraphUtils.Graphie.prototype, {
|
|
|
10664
10655
|
setDrawingAreaAvailable: function () {}
|
|
10665
10656
|
}, options);
|
|
10666
10657
|
const mouselayerZIndex = 2;
|
|
10667
|
-
graph.mouselayer =
|
|
10658
|
+
graph.mouselayer = Raphael$1(graph.raphael.canvas.parentNode, graph.xpixels, graph.ypixels);
|
|
10668
10659
|
$__default["default"](graph.mouselayer.canvas).css("z-index", mouselayerZIndex);
|
|
10669
10660
|
if (options.onClick || options.onMouseDown || options.onMouseMove || options.onMouseOver || options.onMouseOut) {
|
|
10670
10661
|
const canvasClickTarget = graph.mouselayer.rect(0, 0, graph.xpixels, graph.ypixels).attr({
|
|
@@ -40597,366 +40588,222 @@ var Table$1 = {
|
|
|
40597
40588
|
isLintable: true
|
|
40598
40589
|
};
|
|
40599
40590
|
|
|
40600
|
-
var
|
|
40601
|
-
|
|
40602
|
-
|
|
40603
|
-
|
|
40604
|
-
|
|
40605
|
-
|
|
40606
|
-
|
|
40607
|
-
|
|
40608
|
-
|
|
40609
|
-
|
|
40610
|
-
|
|
40611
|
-
|
|
40612
|
-
|
|
40613
|
-
|
|
40614
|
-
|
|
40615
|
-
|
|
40616
|
-
|
|
40617
|
-
|
|
40618
|
-
|
|
40619
|
-
|
|
40620
|
-
|
|
40621
|
-
|
|
40622
|
-
|
|
40623
|
-
|
|
40624
|
-
|
|
40625
|
-
|
|
40626
|
-
|
|
40627
|
-
|
|
40628
|
-
|
|
40629
|
-
|
|
40630
|
-
|
|
40631
|
-
|
|
40632
|
-
|
|
40633
|
-
|
|
40634
|
-
|
|
40635
|
-
|
|
40636
|
-
|
|
40637
|
-
|
|
40638
|
-
|
|
40639
|
-
|
|
40640
|
-
|
|
40641
|
-
|
|
40642
|
-
|
|
40643
|
-
|
|
40644
|
-
|
|
40645
|
-
|
|
40646
|
-
|
|
40647
|
-
|
|
40648
|
-
|
|
40649
|
-
|
|
40650
|
-
|
|
40651
|
-
|
|
40652
|
-
|
|
40653
|
-
|
|
40654
|
-
|
|
40655
|
-
|
|
40656
|
-
|
|
40657
|
-
|
|
40658
|
-
|
|
40659
|
-
|
|
40660
|
-
|
|
40661
|
-
|
|
40662
|
-
|
|
40663
|
-
|
|
40664
|
-
|
|
40665
|
-
|
|
40666
|
-
|
|
40667
|
-
|
|
40668
|
-
|
|
40669
|
-
|
|
40670
|
-
|
|
40671
|
-
|
|
40672
|
-
|
|
40673
|
-
|
|
40674
|
-
|
|
40675
|
-
|
|
40676
|
-
|
|
40677
|
-
|
|
40678
|
-
|
|
40679
|
-
|
|
40680
|
-
|
|
40681
|
-
|
|
40682
|
-
|
|
40683
|
-
|
|
40684
|
-
|
|
40685
|
-
|
|
40686
|
-
|
|
40687
|
-
|
|
40688
|
-
|
|
40689
|
-
|
|
40690
|
-
|
|
40691
|
-
|
|
40692
|
-
|
|
40693
|
-
|
|
40694
|
-
|
|
40695
|
-
|
|
40696
|
-
|
|
40697
|
-
|
|
40698
|
-
|
|
40699
|
-
|
|
40700
|
-
|
|
40701
|
-
|
|
40702
|
-
|
|
40703
|
-
|
|
40704
|
-
|
|
40705
|
-
|
|
40706
|
-
|
|
40707
|
-
|
|
40708
|
-
|
|
40709
|
-
|
|
40710
|
-
|
|
40711
|
-
|
|
40712
|
-
|
|
40713
|
-
|
|
40714
|
-
|
|
40715
|
-
|
|
40716
|
-
|
|
40717
|
-
|
|
40718
|
-
|
|
40719
|
-
|
|
40720
|
-
|
|
40721
|
-
|
|
40722
|
-
|
|
40723
|
-
|
|
40724
|
-
|
|
40725
|
-
|
|
40726
|
-
|
|
40727
|
-
|
|
40728
|
-
|
|
40729
|
-
|
|
40730
|
-
|
|
40731
|
-
|
|
40732
|
-
|
|
40733
|
-
|
|
40734
|
-
|
|
40735
|
-
|
|
40736
|
-
|
|
40737
|
-
|
|
40738
|
-
|
|
40739
|
-
|
|
40740
|
-
|
|
40741
|
-
|
|
40742
|
-
|
|
40743
|
-
|
|
40744
|
-
|
|
40745
|
-
|
|
40746
|
-
|
|
40747
|
-
|
|
40748
|
-
|
|
40749
|
-
|
|
40750
|
-
|
|
40751
|
-
|
|
40752
|
-
|
|
40753
|
-
|
|
40754
|
-
|
|
40755
|
-
|
|
40756
|
-
|
|
40757
|
-
|
|
40758
|
-
|
|
40759
|
-
|
|
40760
|
-
|
|
40761
|
-
|
|
40762
|
-
|
|
40763
|
-
|
|
40764
|
-
|
|
40765
|
-
|
|
40766
|
-
|
|
40767
|
-
|
|
40768
|
-
|
|
40769
|
-
|
|
40770
|
-
|
|
40771
|
-
|
|
40772
|
-
|
|
40773
|
-
|
|
40774
|
-
|
|
40775
|
-
|
|
40776
|
-
|
|
40777
|
-
|
|
40778
|
-
|
|
40779
|
-
|
|
40780
|
-
|
|
40781
|
-
|
|
40782
|
-
|
|
40783
|
-
|
|
40784
|
-
|
|
40785
|
-
|
|
40786
|
-
|
|
40787
|
-
|
|
40788
|
-
|
|
40789
|
-
|
|
40790
|
-
|
|
40791
|
-
|
|
40792
|
-
|
|
40793
|
-
|
|
40794
|
-
|
|
40795
|
-
|
|
40796
|
-
|
|
40797
|
-
|
|
40798
|
-
|
|
40799
|
-
|
|
40800
|
-
|
|
40801
|
-
|
|
40802
|
-
|
|
40803
|
-
|
|
40804
|
-
|
|
40805
|
-
|
|
40806
|
-
|
|
40807
|
-
|
|
40808
|
-
|
|
40809
|
-
|
|
40810
|
-
|
|
40811
|
-
|
|
40812
|
-
|
|
40813
|
-
|
|
40814
|
-
|
|
40815
|
-
|
|
40816
|
-
lens.prototype.merge = function (lensArr, props) {
|
|
40817
|
-
this._wrapped = lens(this._wrapped).mod(lensArr, function (oldProps) {
|
|
40818
|
-
return merge(oldProps, props);
|
|
40819
|
-
}).freeze();
|
|
40820
|
-
return this;
|
|
40821
|
-
};
|
|
40822
|
-
|
|
40823
|
-
// Lens must have length >= 1 or there would be nothing to return
|
|
40824
|
-
lens.prototype.del = function (lensArr) {
|
|
40825
|
-
var obj = this._wrapped;
|
|
40826
|
-
var ops = dispatch(obj);
|
|
40827
|
-
if (lensArr.length === 1) {
|
|
40828
|
-
this._wrapped = ops.del(obj, lensArr[0]);
|
|
40829
|
-
} else {
|
|
40830
|
-
var monocle = lensArr[0];
|
|
40831
|
-
var shortLens = lensArr.slice(1);
|
|
40832
|
-
var newObj = clone(obj);
|
|
40833
|
-
newObj[monocle] = lens(obj[monocle]).del(shortLens).freeze();
|
|
40834
|
-
this._wrapped = newObj;
|
|
40835
|
-
}
|
|
40836
|
-
return this;
|
|
40837
|
-
};
|
|
40838
|
-
lens.prototype.set = function (lensArr, set) {
|
|
40839
|
-
return this.mod(lensArr, function () {
|
|
40840
|
-
return set;
|
|
40841
|
-
});
|
|
40842
|
-
};
|
|
40843
|
-
module.exports = lens;
|
|
40844
|
-
|
|
40845
|
-
/***/
|
|
40846
|
-
}, /* 2 */
|
|
40847
|
-
/***/function (module, exports) {
|
|
40848
|
-
var get = function (arr, monocle) {
|
|
40849
|
-
return arr[monocle];
|
|
40850
|
-
};
|
|
40851
|
-
var set = function (arr, monocle, val) {
|
|
40852
|
-
var newArr = arr.splice();
|
|
40853
|
-
newArr[monocle] = val;
|
|
40854
|
-
return newArr;
|
|
40855
|
-
};
|
|
40856
|
-
var mod = function (arr, monocle, f) {
|
|
40857
|
-
var newArr = arr.slice();
|
|
40858
|
-
newArr[monocle] = f(arr[monocle]);
|
|
40859
|
-
return newArr;
|
|
40860
|
-
};
|
|
40861
|
-
var del = function (arr, monocle) {
|
|
40862
|
-
var newArr = arr.slice();
|
|
40863
|
-
newArr.splice(monocle, 1);
|
|
40864
|
-
return newArr;
|
|
40865
|
-
};
|
|
40866
|
-
|
|
40867
|
-
/*
|
|
40868
|
-
// Lens must point to a member of an array. We'll insert into that array.
|
|
40869
|
-
lens.prototype.insertAt = function(lensArr, toInsert) {
|
|
40870
|
-
var obj = this._wrapped;
|
|
40871
|
-
|
|
40872
|
-
var arrLens = lensArr.slice(0, -1);
|
|
40873
|
-
var arr = lens(obj).get(arrLens).slice(); // slice to copy
|
|
40874
|
-
|
|
40875
|
-
var arrIdx = lensArr[lensArr.length-1];
|
|
40876
|
-
arr.splice(arrIdx, 0, toInsert);
|
|
40877
|
-
return lens(obj).set(arrLens, arr);
|
|
40878
|
-
};
|
|
40879
|
-
|
|
40880
|
-
lens.prototype.insertBefore = lens.prototype.insertAt;
|
|
40881
|
-
lens.prototype.insertAfter = function(lensArr, toInsert) {
|
|
40882
|
-
var newLens = lensArr.slice();
|
|
40883
|
-
newLens[newLens.length-1] += 1;
|
|
40884
|
-
return lens(this._wrapped).insertAt(newLens, toInsert);
|
|
40885
|
-
};
|
|
40886
|
-
*/
|
|
40887
|
-
|
|
40888
|
-
module.exports = {
|
|
40889
|
-
get: get,
|
|
40890
|
-
set: set,
|
|
40891
|
-
mod: mod,
|
|
40892
|
-
del: del
|
|
40893
|
-
};
|
|
40894
|
-
|
|
40895
|
-
/***/
|
|
40896
|
-
}, /* 3 */
|
|
40897
|
-
/***/function (module, exports, __webpack_require__) {
|
|
40898
|
-
var clone = __webpack_require__(0).clone;
|
|
40899
|
-
var get = function (obj, monocle) {
|
|
40900
|
-
return obj[monocle];
|
|
40901
|
-
};
|
|
40902
|
-
var set = function (obj, monocle, val) {
|
|
40903
|
-
var newObj = clone(obj);
|
|
40904
|
-
newObj[monocle] = val;
|
|
40905
|
-
return newObj;
|
|
40906
|
-
};
|
|
40907
|
-
var mod = function (obj, monocle, f) {
|
|
40908
|
-
var newObj = clone(obj);
|
|
40909
|
-
newObj[monocle] = f(obj[monocle]);
|
|
40910
|
-
return newObj;
|
|
40911
|
-
};
|
|
40912
|
-
var del = function (obj, monocle) {
|
|
40913
|
-
var newObj = clone(obj);
|
|
40914
|
-
delete newObj[monocle];
|
|
40915
|
-
return newObj;
|
|
40916
|
-
};
|
|
40917
|
-
module.exports = {
|
|
40918
|
-
get: get,
|
|
40919
|
-
set: set,
|
|
40920
|
-
mod: mod,
|
|
40921
|
-
del: del
|
|
40922
|
-
};
|
|
40923
|
-
|
|
40924
|
-
/***/
|
|
40925
|
-
}, /* 4 */
|
|
40926
|
-
/***/function (module, exports) {
|
|
40927
|
-
var get = function (arr, monocle) {
|
|
40928
|
-
return arr[monocle];
|
|
40929
|
-
};
|
|
40930
|
-
var set = function (arr, monocle, val) {
|
|
40931
|
-
var newArr = arr.splice();
|
|
40932
|
-
newArr[monocle] = val;
|
|
40933
|
-
return newArr;
|
|
40934
|
-
};
|
|
40935
|
-
var mod = function (arr, monocle, f) {
|
|
40936
|
-
var newArr = arr.splice();
|
|
40937
|
-
newArr[monocle] = f(arr[monocle]);
|
|
40938
|
-
return newArr;
|
|
40939
|
-
};
|
|
40940
|
-
var del = function (arr, monocle) {
|
|
40941
|
-
var newArr = arr.slice();
|
|
40942
|
-
newArr.splice(monocle);
|
|
40943
|
-
return newArr;
|
|
40944
|
-
};
|
|
40945
|
-
module.exports = {
|
|
40946
|
-
get: get,
|
|
40947
|
-
set: set,
|
|
40948
|
-
mod: mod,
|
|
40949
|
-
del: del
|
|
40950
|
-
};
|
|
40951
|
-
|
|
40952
|
-
/***/
|
|
40953
|
-
}
|
|
40954
|
-
/******/])
|
|
40955
|
-
);
|
|
40956
|
-
});
|
|
40957
|
-
} (hubble));
|
|
40958
|
-
|
|
40959
|
-
var lens = /*@__PURE__*/getDefaultExportFromCjs(hubble.exports);
|
|
40591
|
+
var isObject = function (obj) {
|
|
40592
|
+
return obj === Object(obj);
|
|
40593
|
+
};
|
|
40594
|
+
var merge = function () {
|
|
40595
|
+
var obj = {};
|
|
40596
|
+
for (var i = 0; i < arguments.length; i++) {
|
|
40597
|
+
var source = arguments[i];
|
|
40598
|
+
if (source) {
|
|
40599
|
+
for (var prop in source) {
|
|
40600
|
+
obj[prop] = source[prop];
|
|
40601
|
+
}
|
|
40602
|
+
}
|
|
40603
|
+
}
|
|
40604
|
+
return obj;
|
|
40605
|
+
};
|
|
40606
|
+
var clone = function (obj) {
|
|
40607
|
+
if (!isObject(obj)) {
|
|
40608
|
+
return obj;
|
|
40609
|
+
}
|
|
40610
|
+
return Array.isArray(obj) ? obj.slice() : merge(obj);
|
|
40611
|
+
};
|
|
40612
|
+
|
|
40613
|
+
/* TODO batch *all* mutations
|
|
40614
|
+
* idea: freeze / thaw implementations for all types
|
|
40615
|
+
* lens constructor thaws, freeze delegates to type's freeze
|
|
40616
|
+
*/
|
|
40617
|
+
|
|
40618
|
+
// equivalents, without requiring it
|
|
40619
|
+
// find the implementation to use for a given object
|
|
40620
|
+
var dispatch = function (x) {
|
|
40621
|
+
if (Array.isArray(x)) {
|
|
40622
|
+
return arr;
|
|
40623
|
+
} else if (isObject(x)) {
|
|
40624
|
+
return obj;
|
|
40625
|
+
} else if (typeof x === "string") {
|
|
40626
|
+
return str;
|
|
40627
|
+
}
|
|
40628
|
+
};
|
|
40629
|
+
|
|
40630
|
+
// This is underscore with a different name
|
|
40631
|
+
var lens = function (obj) {
|
|
40632
|
+
if (obj instanceof lens) {
|
|
40633
|
+
return obj;
|
|
40634
|
+
}
|
|
40635
|
+
if (!(this instanceof lens)) {
|
|
40636
|
+
return new lens(obj);
|
|
40637
|
+
}
|
|
40638
|
+
var ops = dispatch(obj);
|
|
40639
|
+
this._wrapped = ops.thaw ? ops.thaw(obj) : obj;
|
|
40640
|
+
};
|
|
40641
|
+
lens.prototype.freeze = function () {
|
|
40642
|
+
var obj = this._wrapped;
|
|
40643
|
+
var ops = dispatch(obj);
|
|
40644
|
+
return ops.freeze ? ops.freeze(obj) : obj;
|
|
40645
|
+
};
|
|
40646
|
+
lens.prototype.zoom = function (lensArr) {
|
|
40647
|
+
if (this._zoomStack === undefined) {
|
|
40648
|
+
this._zoomStack = [];
|
|
40649
|
+
}
|
|
40650
|
+
this._zoomStack.push({
|
|
40651
|
+
zoom: lensArr,
|
|
40652
|
+
wrapped: this._wrapped
|
|
40653
|
+
});
|
|
40654
|
+
this._wrapped = lens(this._wrapped).get(lensArr);
|
|
40655
|
+
return this;
|
|
40656
|
+
};
|
|
40657
|
+
lens.prototype.deZoom = function () {
|
|
40658
|
+
var frame = this._zoomStack.pop();
|
|
40659
|
+
this._wrapped = lens(frame.wrapped).set(frame.zoom, this._wrapped).freeze();
|
|
40660
|
+
return this;
|
|
40661
|
+
};
|
|
40662
|
+
lens.prototype.get = function (lensArr) {
|
|
40663
|
+
var obj = this._wrapped;
|
|
40664
|
+
for (var i = 0; i < lensArr.length; i++) {
|
|
40665
|
+
obj = dispatch(obj).get(obj, lensArr[i]);
|
|
40666
|
+
}
|
|
40667
|
+
return obj;
|
|
40668
|
+
};
|
|
40669
|
+
lens.prototype.mod = function (lensArr, f) {
|
|
40670
|
+
var obj = this._wrapped;
|
|
40671
|
+
var newObj = clone(obj);
|
|
40672
|
+
var ops = dispatch(obj);
|
|
40673
|
+
if (lensArr.length === 0) {
|
|
40674
|
+
this._wrapped = f(this._wrapped);
|
|
40675
|
+
} else if (lensArr.length === 1) {
|
|
40676
|
+
this._wrapped = ops.mod(newObj, lensArr[0], f);
|
|
40677
|
+
} else {
|
|
40678
|
+
var monocle = lensArr[0];
|
|
40679
|
+
var shortLens = lensArr.slice(1);
|
|
40680
|
+
|
|
40681
|
+
// newObj = ops.mod(obj[monocle], shortLens, f);
|
|
40682
|
+
|
|
40683
|
+
newObj[monocle] = lens(obj[monocle]).mod(shortLens, f).freeze();
|
|
40684
|
+
this._wrapped = newObj;
|
|
40685
|
+
}
|
|
40686
|
+
return this;
|
|
40687
|
+
};
|
|
40688
|
+
|
|
40689
|
+
// TODO - move to individual files
|
|
40690
|
+
lens.prototype.merge = function (lensArr, props) {
|
|
40691
|
+
this._wrapped = lens(this._wrapped).mod(lensArr, function (oldProps) {
|
|
40692
|
+
return merge(oldProps, props);
|
|
40693
|
+
}).freeze();
|
|
40694
|
+
return this;
|
|
40695
|
+
};
|
|
40696
|
+
|
|
40697
|
+
// Lens must have length >= 1 or there would be nothing to return
|
|
40698
|
+
lens.prototype.del = function (lensArr) {
|
|
40699
|
+
var obj = this._wrapped;
|
|
40700
|
+
var ops = dispatch(obj);
|
|
40701
|
+
if (lensArr.length === 1) {
|
|
40702
|
+
this._wrapped = ops.del(obj, lensArr[0]);
|
|
40703
|
+
} else {
|
|
40704
|
+
var monocle = lensArr[0];
|
|
40705
|
+
var shortLens = lensArr.slice(1);
|
|
40706
|
+
var newObj = clone(obj);
|
|
40707
|
+
newObj[monocle] = lens(obj[monocle]).del(shortLens).freeze();
|
|
40708
|
+
this._wrapped = newObj;
|
|
40709
|
+
}
|
|
40710
|
+
return this;
|
|
40711
|
+
};
|
|
40712
|
+
lens.prototype.set = function (lensArr, set) {
|
|
40713
|
+
return this.mod(lensArr, function () {
|
|
40714
|
+
return set;
|
|
40715
|
+
});
|
|
40716
|
+
};
|
|
40717
|
+
|
|
40718
|
+
// ARRAY FUNCTIONS
|
|
40719
|
+
|
|
40720
|
+
const arr = {
|
|
40721
|
+
get: function (arr, monocle) {
|
|
40722
|
+
return arr[monocle];
|
|
40723
|
+
},
|
|
40724
|
+
set: function (arr, monocle, val) {
|
|
40725
|
+
var newArr = arr.splice();
|
|
40726
|
+
newArr[monocle] = val;
|
|
40727
|
+
return newArr;
|
|
40728
|
+
},
|
|
40729
|
+
mod: function (arr, monocle, f) {
|
|
40730
|
+
var newArr = arr.slice();
|
|
40731
|
+
newArr[monocle] = f(arr[monocle]);
|
|
40732
|
+
return newArr;
|
|
40733
|
+
},
|
|
40734
|
+
del: function (arr, monocle) {
|
|
40735
|
+
var newArr = arr.slice();
|
|
40736
|
+
newArr.splice(monocle, 1);
|
|
40737
|
+
return newArr;
|
|
40738
|
+
}
|
|
40739
|
+
};
|
|
40740
|
+
|
|
40741
|
+
/*
|
|
40742
|
+
// Lens must point to a member of an array. We'll insert into that array.
|
|
40743
|
+
lens.prototype.insertAt = function(lensArr, toInsert) {
|
|
40744
|
+
var obj = this._wrapped;
|
|
40745
|
+
|
|
40746
|
+
var arrLens = lensArr.slice(0, -1);
|
|
40747
|
+
var arr = lens(obj).get(arrLens).slice(); // slice to copy
|
|
40748
|
+
|
|
40749
|
+
var arrIdx = lensArr[lensArr.length-1];
|
|
40750
|
+
arr.splice(arrIdx, 0, toInsert);
|
|
40751
|
+
return lens(obj).set(arrLens, arr);
|
|
40752
|
+
};
|
|
40753
|
+
|
|
40754
|
+
lens.prototype.insertBefore = lens.prototype.insertAt;
|
|
40755
|
+
lens.prototype.insertAfter = function(lensArr, toInsert) {
|
|
40756
|
+
var newLens = lensArr.slice();
|
|
40757
|
+
newLens[newLens.length-1] += 1;
|
|
40758
|
+
return lens(this._wrapped).insertAt(newLens, toInsert);
|
|
40759
|
+
};
|
|
40760
|
+
*/
|
|
40761
|
+
|
|
40762
|
+
// OBJECT FUNCTIONS
|
|
40763
|
+
|
|
40764
|
+
const obj = {
|
|
40765
|
+
get: function (obj, monocle) {
|
|
40766
|
+
return obj[monocle];
|
|
40767
|
+
},
|
|
40768
|
+
set: function (obj, monocle, val) {
|
|
40769
|
+
var newObj = clone(obj);
|
|
40770
|
+
newObj[monocle] = val;
|
|
40771
|
+
return newObj;
|
|
40772
|
+
},
|
|
40773
|
+
mod: function (obj, monocle, f) {
|
|
40774
|
+
var newObj = clone(obj);
|
|
40775
|
+
newObj[monocle] = f(obj[monocle]);
|
|
40776
|
+
return newObj;
|
|
40777
|
+
},
|
|
40778
|
+
del: function (obj, monocle) {
|
|
40779
|
+
var newObj = clone(obj);
|
|
40780
|
+
delete newObj[monocle];
|
|
40781
|
+
return newObj;
|
|
40782
|
+
}
|
|
40783
|
+
};
|
|
40784
|
+
|
|
40785
|
+
// STRING FUNCTIONS
|
|
40786
|
+
|
|
40787
|
+
const str = {
|
|
40788
|
+
get: function (arr, monocle) {
|
|
40789
|
+
return arr[monocle];
|
|
40790
|
+
},
|
|
40791
|
+
set: function (arr, monocle, val) {
|
|
40792
|
+
var newArr = arr.splice();
|
|
40793
|
+
newArr[monocle] = val;
|
|
40794
|
+
return newArr;
|
|
40795
|
+
},
|
|
40796
|
+
mod: function (arr, monocle, f) {
|
|
40797
|
+
var newArr = arr.splice();
|
|
40798
|
+
newArr[monocle] = f(arr[monocle]);
|
|
40799
|
+
return newArr;
|
|
40800
|
+
},
|
|
40801
|
+
del: function (arr, monocle) {
|
|
40802
|
+
var newArr = arr.slice();
|
|
40803
|
+
newArr.splice(monocle);
|
|
40804
|
+
return newArr;
|
|
40805
|
+
}
|
|
40806
|
+
};
|
|
40960
40807
|
|
|
40961
40808
|
/* eslint-disable eqeqeq, @typescript-eslint/no-unused-vars */
|
|
40962
40809
|
/*
|
|
@@ -41862,7 +41709,7 @@ const init = function (options) {
|
|
|
41862
41709
|
|
|
41863
41710
|
// This file is processed by a Rollup plugin (replace) to inject the production
|
|
41864
41711
|
const libName = "@khanacademy/perseus";
|
|
41865
|
-
const libVersion = "19.1.
|
|
41712
|
+
const libVersion = "19.1.8";
|
|
41866
41713
|
perseusCore.addLibraryVersionToPerseusDebug(libName, libVersion);
|
|
41867
41714
|
|
|
41868
41715
|
const apiVersion = {
|