@vitessce/sets-utils 3.3.3 → 3.3.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.js +1733 -1711
- package/dist-tsc/index.d.ts +1 -0
- package/dist-tsc/index.js +1 -0
- package/dist-tsc/interpolate-colors.d.ts +22 -0
- package/dist-tsc/interpolate-colors.d.ts.map +1 -0
- package/dist-tsc/interpolate-colors.js +95 -0
- package/dist-tsc/interpolate-colors.test.d.ts +2 -0
- package/dist-tsc/interpolate-colors.test.d.ts.map +1 -0
- package/dist-tsc/interpolate-colors.test.js +25 -0
- package/package.json +3 -3
- package/src/index.js +3 -0
- package/src/interpolate-colors.js +116 -0
- package/src/interpolate-colors.test.js +30 -0
package/dist/index.js
CHANGED
|
@@ -9671,6 +9671,20 @@ z.object({
|
|
|
9671
9671
|
radius: z.number(),
|
|
9672
9672
|
opacity: z.number()
|
|
9673
9673
|
});
|
|
9674
|
+
const FILE_EXTENSION_JSON = "json";
|
|
9675
|
+
const MIME_TYPE_JSON = "application/json";
|
|
9676
|
+
const FILE_EXTENSION_TABULAR = "csv";
|
|
9677
|
+
const MIME_TYPE_TABULAR = "text/csv";
|
|
9678
|
+
const SEPARATOR_TABULAR = ",";
|
|
9679
|
+
const NA_VALUE_TABULAR = "NA";
|
|
9680
|
+
const SETS_DATATYPE_OBS = "obs";
|
|
9681
|
+
const HIERARCHICAL_SCHEMAS = {
|
|
9682
|
+
latestVersion: "0.1.3",
|
|
9683
|
+
schema: obsSetsSchema
|
|
9684
|
+
};
|
|
9685
|
+
const TABULAR_SCHEMAS = {
|
|
9686
|
+
schema: obsSetsTabularSchema
|
|
9687
|
+
};
|
|
9674
9688
|
var tinycolor$1 = { exports: {} };
|
|
9675
9689
|
(function(module2) {
|
|
9676
9690
|
(function(Math2) {
|
|
@@ -10585,899 +10599,1536 @@ var tinycolor$1 = { exports: {} };
|
|
|
10585
10599
|
})(tinycolor$1);
|
|
10586
10600
|
var tinycolorExports = tinycolor$1.exports;
|
|
10587
10601
|
const tinycolor = /* @__PURE__ */ getDefaultExportFromCjs(tinycolorExports);
|
|
10588
|
-
|
|
10589
|
-
|
|
10590
|
-
|
|
10591
|
-
|
|
10592
|
-
}
|
|
10593
|
-
}
|
|
10594
|
-
function customConverter(columns, f) {
|
|
10595
|
-
var object = objectConverter(columns);
|
|
10596
|
-
return function(row, i) {
|
|
10597
|
-
return f(object(row), i, columns);
|
|
10598
|
-
};
|
|
10602
|
+
function callbackOnKeyPress(event, key, callback) {
|
|
10603
|
+
if (event.key === key) {
|
|
10604
|
+
event.preventDefault();
|
|
10605
|
+
callback();
|
|
10606
|
+
}
|
|
10599
10607
|
}
|
|
10600
|
-
function
|
|
10601
|
-
|
|
10602
|
-
rows.forEach(function(row) {
|
|
10603
|
-
for (var column in row) {
|
|
10604
|
-
if (!(column in columnSet)) {
|
|
10605
|
-
columns.push(columnSet[column] = column);
|
|
10606
|
-
}
|
|
10607
|
-
}
|
|
10608
|
-
});
|
|
10609
|
-
return columns;
|
|
10608
|
+
function colorArrayToString(rgbArray2) {
|
|
10609
|
+
return tinycolor({ r: rgbArray2[0], g: rgbArray2[1], b: rgbArray2[2] }).toHexString();
|
|
10610
10610
|
}
|
|
10611
|
-
function
|
|
10612
|
-
|
|
10613
|
-
return
|
|
10611
|
+
function colorStringToArray(colorString) {
|
|
10612
|
+
const colorObj = tinycolor(colorString).toRgb();
|
|
10613
|
+
return [colorObj.r, colorObj.g, colorObj.b];
|
|
10614
10614
|
}
|
|
10615
|
-
function
|
|
10616
|
-
|
|
10615
|
+
function getLevelTooltipText(i) {
|
|
10616
|
+
if (i === 0)
|
|
10617
|
+
return "Color by hierarchy";
|
|
10618
|
+
if (i <= 2) {
|
|
10619
|
+
const subs = (j) => "sub".repeat(j);
|
|
10620
|
+
return `Color by ${subs(i - 1)}cluster`;
|
|
10621
|
+
}
|
|
10622
|
+
return `Color by cluster level ${i}`;
|
|
10617
10623
|
}
|
|
10618
|
-
function
|
|
10619
|
-
|
|
10620
|
-
|
|
10624
|
+
function isEqualOrPrefix(targetPath, testPath) {
|
|
10625
|
+
if (targetPath.length <= testPath.length) {
|
|
10626
|
+
return isEqual(targetPath, testPath.slice(0, targetPath.length));
|
|
10627
|
+
}
|
|
10628
|
+
return false;
|
|
10621
10629
|
}
|
|
10622
|
-
function
|
|
10623
|
-
|
|
10624
|
-
|
|
10625
|
-
var convert, columns, rows = parseRows(text, function(row, i) {
|
|
10626
|
-
if (convert)
|
|
10627
|
-
return convert(row, i - 1);
|
|
10628
|
-
columns = row, convert = f ? customConverter(row, f) : objectConverter(row);
|
|
10629
|
-
});
|
|
10630
|
-
rows.columns = columns || [];
|
|
10631
|
-
return rows;
|
|
10630
|
+
function tryRenamePath(targetPath, testPath, nextTargetPath) {
|
|
10631
|
+
if (isEqualOrPrefix(targetPath, testPath)) {
|
|
10632
|
+
return [...nextTargetPath, ...testPath.slice(nextTargetPath.length)];
|
|
10632
10633
|
}
|
|
10633
|
-
|
|
10634
|
-
|
|
10635
|
-
|
|
10636
|
-
|
|
10637
|
-
|
|
10638
|
-
|
|
10639
|
-
|
|
10640
|
-
|
|
10641
|
-
|
|
10642
|
-
|
|
10643
|
-
|
|
10644
|
-
var i, j = I, c;
|
|
10645
|
-
if (text.charCodeAt(j) === QUOTE) {
|
|
10646
|
-
while (I++ < N && text.charCodeAt(I) !== QUOTE || text.charCodeAt(++I) === QUOTE)
|
|
10647
|
-
;
|
|
10648
|
-
if ((i = I) >= N)
|
|
10649
|
-
eof = true;
|
|
10650
|
-
else if ((c = text.charCodeAt(I++)) === NEWLINE)
|
|
10651
|
-
eol = true;
|
|
10652
|
-
else if (c === RETURN) {
|
|
10653
|
-
eol = true;
|
|
10654
|
-
if (text.charCodeAt(I) === NEWLINE)
|
|
10655
|
-
++I;
|
|
10656
|
-
}
|
|
10657
|
-
return text.slice(j + 1, i - 1).replace(/""/g, '"');
|
|
10658
|
-
}
|
|
10659
|
-
while (I < N) {
|
|
10660
|
-
if ((c = text.charCodeAt(i = I++)) === NEWLINE)
|
|
10661
|
-
eol = true;
|
|
10662
|
-
else if (c === RETURN) {
|
|
10663
|
-
eol = true;
|
|
10664
|
-
if (text.charCodeAt(I) === NEWLINE)
|
|
10665
|
-
++I;
|
|
10666
|
-
} else if (c !== DELIMITER)
|
|
10667
|
-
continue;
|
|
10668
|
-
return text.slice(j, i);
|
|
10669
|
-
}
|
|
10670
|
-
return eof = true, text.slice(j, N);
|
|
10671
|
-
}
|
|
10672
|
-
while ((t2 = token()) !== EOF) {
|
|
10673
|
-
var row = [];
|
|
10674
|
-
while (t2 !== EOL && t2 !== EOF)
|
|
10675
|
-
row.push(t2), t2 = token();
|
|
10676
|
-
if (f && (row = f(row, n++)) == null)
|
|
10677
|
-
continue;
|
|
10678
|
-
rows.push(row);
|
|
10634
|
+
return testPath;
|
|
10635
|
+
}
|
|
10636
|
+
const PATH_SEP = "___";
|
|
10637
|
+
function pathToKey(path) {
|
|
10638
|
+
return path.join(PATH_SEP);
|
|
10639
|
+
}
|
|
10640
|
+
function getNextNumberedNodeName(nodes, prefix, suffix) {
|
|
10641
|
+
let i = 1;
|
|
10642
|
+
if (nodes) {
|
|
10643
|
+
while (nodes.find((n) => n.name.includes(`${prefix}${i}`))) {
|
|
10644
|
+
i++;
|
|
10679
10645
|
}
|
|
10680
|
-
return rows;
|
|
10681
10646
|
}
|
|
10682
|
-
|
|
10683
|
-
|
|
10684
|
-
|
|
10685
|
-
|
|
10686
|
-
|
|
10647
|
+
return `${prefix}${i}${suffix}`;
|
|
10648
|
+
}
|
|
10649
|
+
function setObsSelection(cellSelection, additionalCellSets, cellSetColor, setCellSetSelection, setAdditionalCellSets, setCellSetColor, setCellColorEncoding, prefix = "Selection ", suffix = "") {
|
|
10650
|
+
const CELL_SELECTIONS_LEVEL_ZERO_NAME = "My Selections";
|
|
10651
|
+
const selectionsLevelZeroNode = additionalCellSets == null ? void 0 : additionalCellSets.tree.find(
|
|
10652
|
+
(n) => n.name === CELL_SELECTIONS_LEVEL_ZERO_NAME
|
|
10653
|
+
);
|
|
10654
|
+
const nextAdditionalCellSets = {
|
|
10655
|
+
version: HIERARCHICAL_SCHEMAS.latestVersion,
|
|
10656
|
+
datatype: SETS_DATATYPE_OBS,
|
|
10657
|
+
tree: [...additionalCellSets ? additionalCellSets.tree : []]
|
|
10658
|
+
};
|
|
10659
|
+
const nextName = getNextNumberedNodeName(selectionsLevelZeroNode == null ? void 0 : selectionsLevelZeroNode.children, prefix, suffix);
|
|
10660
|
+
let colorIndex = 0;
|
|
10661
|
+
if (selectionsLevelZeroNode) {
|
|
10662
|
+
colorIndex = selectionsLevelZeroNode.children.length;
|
|
10663
|
+
selectionsLevelZeroNode.children.push({
|
|
10664
|
+
name: nextName,
|
|
10665
|
+
set: cellSelection.map((d) => [d, null])
|
|
10666
|
+
});
|
|
10667
|
+
} else {
|
|
10668
|
+
nextAdditionalCellSets.tree.push({
|
|
10669
|
+
name: CELL_SELECTIONS_LEVEL_ZERO_NAME,
|
|
10670
|
+
children: [
|
|
10671
|
+
{
|
|
10672
|
+
name: nextName,
|
|
10673
|
+
set: cellSelection.map((d) => [d, null])
|
|
10674
|
+
}
|
|
10675
|
+
]
|
|
10687
10676
|
});
|
|
10688
10677
|
}
|
|
10689
|
-
|
|
10690
|
-
|
|
10691
|
-
|
|
10692
|
-
|
|
10678
|
+
setAdditionalCellSets(nextAdditionalCellSets);
|
|
10679
|
+
const nextPath = ["My Selections", nextName];
|
|
10680
|
+
setCellSetColor([
|
|
10681
|
+
...cellSetColor || [],
|
|
10682
|
+
{
|
|
10683
|
+
path: nextPath,
|
|
10684
|
+
color: PALETTE[colorIndex % PALETTE.length]
|
|
10685
|
+
}
|
|
10686
|
+
]);
|
|
10687
|
+
setCellSetSelection([nextPath]);
|
|
10688
|
+
setCellColorEncoding("cellSetSelection");
|
|
10689
|
+
}
|
|
10690
|
+
function mergeObsSets(cellSets, additionalCellSets) {
|
|
10691
|
+
return {
|
|
10692
|
+
version: HIERARCHICAL_SCHEMAS.latestVersion,
|
|
10693
|
+
datatype: SETS_DATATYPE_OBS,
|
|
10694
|
+
tree: [
|
|
10695
|
+
...cellSets ? cellSets.tree : [],
|
|
10696
|
+
...additionalCellSets ? additionalCellSets.tree : []
|
|
10697
|
+
]
|
|
10698
|
+
};
|
|
10699
|
+
}
|
|
10700
|
+
function getObsInfoFromDataWithinRange(range2, data) {
|
|
10701
|
+
const [lowerBound, upperBound] = range2;
|
|
10702
|
+
const cellIds = data.filter((item) => item.value >= lowerBound && item.value <= upperBound).map((item) => item.cellId);
|
|
10703
|
+
return cellIds;
|
|
10704
|
+
}
|
|
10705
|
+
function generateKey() {
|
|
10706
|
+
return v4();
|
|
10707
|
+
}
|
|
10708
|
+
function nodeToSet(currNode) {
|
|
10709
|
+
if (!currNode) {
|
|
10710
|
+
return [];
|
|
10693
10711
|
}
|
|
10694
|
-
|
|
10695
|
-
|
|
10696
|
-
columns = inferColumns(rows);
|
|
10697
|
-
return preformatBody(rows, columns).join("\n");
|
|
10712
|
+
if (!currNode.children) {
|
|
10713
|
+
return currNode.set || [];
|
|
10698
10714
|
}
|
|
10699
|
-
|
|
10700
|
-
|
|
10715
|
+
return currNode.children.flatMap((c) => nodeToSet(c));
|
|
10716
|
+
}
|
|
10717
|
+
function nodeToHeight(currNode, level = 0) {
|
|
10718
|
+
if (!currNode.children) {
|
|
10719
|
+
return level;
|
|
10701
10720
|
}
|
|
10702
|
-
|
|
10703
|
-
|
|
10721
|
+
const newLevel = level + 1;
|
|
10722
|
+
const childrenHeights = currNode.children.map((c) => nodeToHeight(c, newLevel));
|
|
10723
|
+
return Math.max(...childrenHeights, newLevel);
|
|
10724
|
+
}
|
|
10725
|
+
function getNodeLength(currNode) {
|
|
10726
|
+
var _a;
|
|
10727
|
+
if (!currNode) {
|
|
10728
|
+
return 0;
|
|
10704
10729
|
}
|
|
10705
|
-
|
|
10706
|
-
return
|
|
10730
|
+
if (!currNode.children) {
|
|
10731
|
+
return ((_a = currNode.set) == null ? void 0 : _a.length) || 0;
|
|
10707
10732
|
}
|
|
10708
|
-
return
|
|
10709
|
-
parse: parse2,
|
|
10710
|
-
parseRows,
|
|
10711
|
-
format,
|
|
10712
|
-
formatBody,
|
|
10713
|
-
formatRows,
|
|
10714
|
-
formatRow,
|
|
10715
|
-
formatValue
|
|
10716
|
-
};
|
|
10733
|
+
return currNode.children.reduce((acc, curr) => acc + getNodeLength(curr), 0);
|
|
10717
10734
|
}
|
|
10718
|
-
|
|
10719
|
-
|
|
10720
|
-
(
|
|
10721
|
-
|
|
10722
|
-
|
|
10723
|
-
var domain;
|
|
10724
|
-
function EventHandlers() {
|
|
10725
|
-
}
|
|
10726
|
-
EventHandlers.prototype = /* @__PURE__ */ Object.create(null);
|
|
10727
|
-
function EventEmitter() {
|
|
10728
|
-
EventEmitter.init.call(this);
|
|
10735
|
+
function nodeFindNodeByNamePath(node, path, currLevelIndex) {
|
|
10736
|
+
const currNodeName = path[currLevelIndex];
|
|
10737
|
+
if (node.name === currNodeName) {
|
|
10738
|
+
if (currLevelIndex === path.length - 1) {
|
|
10739
|
+
return node;
|
|
10729
10740
|
}
|
|
10730
|
-
|
|
10731
|
-
|
|
10732
|
-
|
|
10733
|
-
|
|
10734
|
-
EventEmitter.prototype._maxListeners = void 0;
|
|
10735
|
-
EventEmitter.defaultMaxListeners = 10;
|
|
10736
|
-
EventEmitter.init = function() {
|
|
10737
|
-
this.domain = null;
|
|
10738
|
-
if (EventEmitter.usingDomains) {
|
|
10739
|
-
if (domain.active)
|
|
10740
|
-
;
|
|
10741
|
-
}
|
|
10742
|
-
if (!this._events || this._events === Object.getPrototypeOf(this)._events) {
|
|
10743
|
-
this._events = new EventHandlers();
|
|
10744
|
-
this._eventsCount = 0;
|
|
10741
|
+
if (node.children) {
|
|
10742
|
+
const foundNodes = node.children.map((child) => nodeFindNodeByNamePath(child, path, currLevelIndex + 1)).filter(Boolean);
|
|
10743
|
+
if (foundNodes.length === 1) {
|
|
10744
|
+
return foundNodes[0];
|
|
10745
10745
|
}
|
|
10746
|
-
|
|
10746
|
+
}
|
|
10747
|
+
}
|
|
10748
|
+
return null;
|
|
10749
|
+
}
|
|
10750
|
+
function treeFindNodeByNamePath(currTree, targetNamePath) {
|
|
10751
|
+
const foundNodes = currTree.tree.map((levelZeroNode) => nodeFindNodeByNamePath(levelZeroNode, targetNamePath, 0)).filter(Boolean);
|
|
10752
|
+
if (foundNodes.length === 1) {
|
|
10753
|
+
return foundNodes[0];
|
|
10754
|
+
}
|
|
10755
|
+
return null;
|
|
10756
|
+
}
|
|
10757
|
+
function nodeTransform(node, predicate, transform, transformedPaths, currPath) {
|
|
10758
|
+
let newPath;
|
|
10759
|
+
if (!currPath) {
|
|
10760
|
+
newPath = [node.name];
|
|
10761
|
+
} else {
|
|
10762
|
+
newPath = [...currPath];
|
|
10763
|
+
}
|
|
10764
|
+
if (predicate(node, newPath)) {
|
|
10765
|
+
transformedPaths.push(newPath);
|
|
10766
|
+
return transform(node, newPath);
|
|
10767
|
+
}
|
|
10768
|
+
if (node.children) {
|
|
10769
|
+
return {
|
|
10770
|
+
...node,
|
|
10771
|
+
children: node.children.map(
|
|
10772
|
+
(child) => nodeTransform(
|
|
10773
|
+
child,
|
|
10774
|
+
predicate,
|
|
10775
|
+
transform,
|
|
10776
|
+
transformedPaths,
|
|
10777
|
+
newPath.concat([child.name])
|
|
10778
|
+
)
|
|
10779
|
+
)
|
|
10747
10780
|
};
|
|
10748
|
-
|
|
10749
|
-
|
|
10750
|
-
|
|
10751
|
-
|
|
10752
|
-
|
|
10781
|
+
}
|
|
10782
|
+
return node;
|
|
10783
|
+
}
|
|
10784
|
+
function nodeTransformAll(node, predicate, transform, transformedPaths, currPath) {
|
|
10785
|
+
let newPath;
|
|
10786
|
+
if (!currPath) {
|
|
10787
|
+
newPath = [node.name];
|
|
10788
|
+
} else {
|
|
10789
|
+
newPath = [...currPath];
|
|
10790
|
+
}
|
|
10791
|
+
let newNode = node;
|
|
10792
|
+
if (predicate(node, newPath)) {
|
|
10793
|
+
transformedPaths.push(newPath);
|
|
10794
|
+
newNode = transform(node, newPath);
|
|
10795
|
+
}
|
|
10796
|
+
if (node.children) {
|
|
10797
|
+
return {
|
|
10798
|
+
...newNode,
|
|
10799
|
+
children: newNode.children.map(
|
|
10800
|
+
(child) => nodeTransformAll(
|
|
10801
|
+
child,
|
|
10802
|
+
predicate,
|
|
10803
|
+
transform,
|
|
10804
|
+
transformedPaths,
|
|
10805
|
+
newPath.concat([child.name])
|
|
10806
|
+
)
|
|
10807
|
+
)
|
|
10753
10808
|
};
|
|
10754
|
-
|
|
10755
|
-
|
|
10756
|
-
|
|
10757
|
-
|
|
10809
|
+
}
|
|
10810
|
+
return newNode;
|
|
10811
|
+
}
|
|
10812
|
+
function nodeAppendChild(currNode, newChild) {
|
|
10813
|
+
return {
|
|
10814
|
+
...currNode,
|
|
10815
|
+
children: [...currNode.children, newChild]
|
|
10816
|
+
};
|
|
10817
|
+
}
|
|
10818
|
+
function nodePrependChild(currNode, newChild) {
|
|
10819
|
+
return {
|
|
10820
|
+
...currNode,
|
|
10821
|
+
children: [newChild, ...currNode.children]
|
|
10822
|
+
};
|
|
10823
|
+
}
|
|
10824
|
+
function nodeInsertChild(currNode, newChild, insertIndex) {
|
|
10825
|
+
const newChildren = Array.from(currNode.children);
|
|
10826
|
+
newChildren.splice(insertIndex, 0, newChild);
|
|
10827
|
+
return {
|
|
10828
|
+
...currNode,
|
|
10829
|
+
children: newChildren
|
|
10830
|
+
};
|
|
10831
|
+
}
|
|
10832
|
+
function treeToUnion(currTree, checkedPaths) {
|
|
10833
|
+
const nodes = checkedPaths.map((path) => treeFindNodeByNamePath(currTree, path));
|
|
10834
|
+
const nodeSets = nodes.map((node) => nodeToSet(node).map(([cellId]) => cellId));
|
|
10835
|
+
return nodeSets.reduce((a, h) => a.concat(h.filter((hEl) => !a.includes(hEl))), nodeSets[0] || []);
|
|
10836
|
+
}
|
|
10837
|
+
function treeToIntersection(currTree, checkedPaths) {
|
|
10838
|
+
const nodes = checkedPaths.map((path) => treeFindNodeByNamePath(currTree, path));
|
|
10839
|
+
const nodeSets = nodes.map((node) => nodeToSet(node).map(([cellId]) => cellId));
|
|
10840
|
+
return nodeSets.reduce((a, h) => h.filter((hEl) => a.includes(hEl)), nodeSets[0] || []);
|
|
10841
|
+
}
|
|
10842
|
+
function treeToComplement(currTree, checkedPaths, items) {
|
|
10843
|
+
const primaryUnion = treeToUnion(currTree, checkedPaths);
|
|
10844
|
+
return items.filter((el) => !primaryUnion.includes(el));
|
|
10845
|
+
}
|
|
10846
|
+
function nodeToLevelDescendantNamePaths(node, level, prevPath, stopEarly = false) {
|
|
10847
|
+
if (!node.children) {
|
|
10848
|
+
if (!stopEarly) {
|
|
10849
|
+
return null;
|
|
10758
10850
|
}
|
|
10759
|
-
|
|
10760
|
-
|
|
10851
|
+
return [[...prevPath, node.name]];
|
|
10852
|
+
}
|
|
10853
|
+
if (level === 0) {
|
|
10854
|
+
return [[...prevPath, node.name]];
|
|
10855
|
+
}
|
|
10856
|
+
return node.children.flatMap((c) => nodeToLevelDescendantNamePaths(c, level - 1, [...prevPath, node.name], stopEarly)).filter(Boolean);
|
|
10857
|
+
}
|
|
10858
|
+
function treeExport(currTree, datatype) {
|
|
10859
|
+
return {
|
|
10860
|
+
version: HIERARCHICAL_SCHEMAS.latestVersion,
|
|
10861
|
+
datatype,
|
|
10862
|
+
tree: currTree.tree
|
|
10863
|
+
};
|
|
10864
|
+
}
|
|
10865
|
+
function treeExportLevelZeroNode(currTree, nodePath, datatype, cellSetColors, theme) {
|
|
10866
|
+
const node = treeFindNodeByNamePath(currTree, nodePath);
|
|
10867
|
+
const nodeWithColors = nodeTransformAll(node, () => true, (n, nPath) => {
|
|
10868
|
+
var _a;
|
|
10869
|
+
const nodeColor = ((_a = cellSetColors == null ? void 0 : cellSetColors.find((c) => isEqual(c.path, nPath))) == null ? void 0 : _a.color) ?? getDefaultColor(theme);
|
|
10870
|
+
return {
|
|
10871
|
+
...n,
|
|
10872
|
+
color: nodeColor.slice(0, 3)
|
|
10761
10873
|
};
|
|
10762
|
-
|
|
10763
|
-
|
|
10764
|
-
|
|
10765
|
-
|
|
10766
|
-
|
|
10767
|
-
|
|
10768
|
-
|
|
10769
|
-
|
|
10770
|
-
|
|
10874
|
+
}, []);
|
|
10875
|
+
const treeWithOneLevelZeroNode = {
|
|
10876
|
+
...currTree,
|
|
10877
|
+
tree: [nodeWithColors]
|
|
10878
|
+
};
|
|
10879
|
+
return {
|
|
10880
|
+
treeToExport: treeExport(treeWithOneLevelZeroNode, datatype),
|
|
10881
|
+
nodeName: node.name
|
|
10882
|
+
};
|
|
10883
|
+
}
|
|
10884
|
+
function treeExportSet(currTree, nodePath) {
|
|
10885
|
+
const node = treeFindNodeByNamePath(currTree, nodePath);
|
|
10886
|
+
return { setToExport: nodeToSet(node), nodeName: node.name };
|
|
10887
|
+
}
|
|
10888
|
+
function treeInitialize(datatype) {
|
|
10889
|
+
return {
|
|
10890
|
+
version: HIERARCHICAL_SCHEMAS.latestVersion,
|
|
10891
|
+
datatype,
|
|
10892
|
+
tree: []
|
|
10893
|
+
};
|
|
10894
|
+
}
|
|
10895
|
+
function nodeToRenderProps(node, path, cellSetColor) {
|
|
10896
|
+
var _a;
|
|
10897
|
+
const level = path.length - 1;
|
|
10898
|
+
return {
|
|
10899
|
+
title: node.name,
|
|
10900
|
+
nodeKey: pathToKey(path),
|
|
10901
|
+
path,
|
|
10902
|
+
size: getNodeLength(node),
|
|
10903
|
+
color: (_a = cellSetColor == null ? void 0 : cellSetColor.find((d) => isEqual(d.path, path))) == null ? void 0 : _a.color,
|
|
10904
|
+
level,
|
|
10905
|
+
isLeaf: (!node.children || node.children.length === 0) && Boolean(node.set),
|
|
10906
|
+
height: nodeToHeight(node)
|
|
10907
|
+
};
|
|
10908
|
+
}
|
|
10909
|
+
function colorMixWithUncertainty(originalColor, p, mixingColor = [128, 128, 128]) {
|
|
10910
|
+
return [
|
|
10911
|
+
(originalColor[0] - mixingColor[0]) * p + mixingColor[0],
|
|
10912
|
+
(originalColor[1] - mixingColor[1]) * p + mixingColor[1],
|
|
10913
|
+
(originalColor[2] - mixingColor[2]) * p + mixingColor[2]
|
|
10914
|
+
];
|
|
10915
|
+
}
|
|
10916
|
+
function treeToCellColorsBySetNames(currTree, selectedNamePaths, cellSetColor, theme) {
|
|
10917
|
+
let cellColorsArray = [];
|
|
10918
|
+
selectedNamePaths.forEach((setNamePath) => {
|
|
10919
|
+
var _a;
|
|
10920
|
+
const node = treeFindNodeByNamePath(currTree, setNamePath);
|
|
10921
|
+
if (node) {
|
|
10922
|
+
const nodeSet = nodeToSet(node);
|
|
10923
|
+
const nodeColor = ((_a = cellSetColor == null ? void 0 : cellSetColor.find((d) => isEqual(d.path, setNamePath))) == null ? void 0 : _a.color) || getDefaultColor(theme);
|
|
10924
|
+
cellColorsArray = [
|
|
10925
|
+
...cellColorsArray,
|
|
10926
|
+
...nodeSet.map(([cellId, prob]) => [
|
|
10927
|
+
cellId,
|
|
10928
|
+
isNil(prob) ? nodeColor : colorMixWithUncertainty(nodeColor, prob)
|
|
10929
|
+
])
|
|
10930
|
+
];
|
|
10771
10931
|
}
|
|
10772
|
-
|
|
10773
|
-
|
|
10774
|
-
|
|
10775
|
-
|
|
10776
|
-
|
|
10777
|
-
|
|
10778
|
-
|
|
10779
|
-
|
|
10780
|
-
|
|
10932
|
+
});
|
|
10933
|
+
return new Map(cellColorsArray);
|
|
10934
|
+
}
|
|
10935
|
+
function treeToCellSetColorIndicesBySetNames(currTree, selectedNamePaths, cellSetColor) {
|
|
10936
|
+
let cellColorsArray = [];
|
|
10937
|
+
selectedNamePaths == null ? void 0 : selectedNamePaths.forEach((setNamePath) => {
|
|
10938
|
+
const node = treeFindNodeByNamePath(currTree, setNamePath);
|
|
10939
|
+
if (node) {
|
|
10940
|
+
const nodeSet = nodeToSet(node);
|
|
10941
|
+
const nodeColorIndex = cellSetColor == null ? void 0 : cellSetColor.findIndex((d) => isEqual(d.path, setNamePath));
|
|
10942
|
+
cellColorsArray = [
|
|
10943
|
+
...cellColorsArray,
|
|
10944
|
+
...nodeSet.map(([cellId]) => [
|
|
10945
|
+
cellId,
|
|
10946
|
+
nodeColorIndex
|
|
10947
|
+
])
|
|
10948
|
+
];
|
|
10781
10949
|
}
|
|
10782
|
-
|
|
10783
|
-
|
|
10784
|
-
|
|
10785
|
-
|
|
10786
|
-
|
|
10787
|
-
|
|
10788
|
-
|
|
10789
|
-
|
|
10790
|
-
|
|
10950
|
+
});
|
|
10951
|
+
return new Map(cellColorsArray);
|
|
10952
|
+
}
|
|
10953
|
+
function treeToObjectsBySetNames(currTree, selectedNamePaths, setColor, theme) {
|
|
10954
|
+
var _a;
|
|
10955
|
+
let cellsArray = [];
|
|
10956
|
+
for (let i = 0; i < selectedNamePaths.length; i += 1) {
|
|
10957
|
+
const setNamePath = selectedNamePaths[i];
|
|
10958
|
+
const node = treeFindNodeByNamePath(currTree, setNamePath);
|
|
10959
|
+
if (node) {
|
|
10960
|
+
const nodeSet = nodeToSet(node);
|
|
10961
|
+
const nodeColor = ((_a = setColor == null ? void 0 : setColor.find((d) => isEqual(d.path, setNamePath))) == null ? void 0 : _a.color) || getDefaultColor(theme);
|
|
10962
|
+
cellsArray = cellsArray.concat(nodeSet.map(([cellId]) => ({
|
|
10963
|
+
obsId: cellId,
|
|
10964
|
+
name: node.name,
|
|
10965
|
+
color: nodeColor
|
|
10966
|
+
})));
|
|
10791
10967
|
}
|
|
10792
|
-
|
|
10793
|
-
|
|
10794
|
-
|
|
10795
|
-
|
|
10796
|
-
|
|
10797
|
-
|
|
10798
|
-
|
|
10799
|
-
|
|
10968
|
+
}
|
|
10969
|
+
return cellsArray;
|
|
10970
|
+
}
|
|
10971
|
+
function treeToCellPolygonsBySetNames(currTree, obsIndex, obsEmbedding, selectedNamePaths, cellSetColor, theme) {
|
|
10972
|
+
const obsIndexMap = new Map(obsIndex.map((key, i) => [key, i]));
|
|
10973
|
+
const cellSetPolygons = [];
|
|
10974
|
+
selectedNamePaths.forEach((setNamePath) => {
|
|
10975
|
+
var _a;
|
|
10976
|
+
const node = treeFindNodeByNamePath(currTree, setNamePath);
|
|
10977
|
+
if (node) {
|
|
10978
|
+
const nodeSet = nodeToSet(node);
|
|
10979
|
+
const nodeColor = ((_a = cellSetColor == null ? void 0 : cellSetColor.find((d) => isEqual(d.path, setNamePath))) == null ? void 0 : _a.color) || getDefaultColor(theme);
|
|
10980
|
+
const cellPositions = nodeSet.map(([cellId]) => {
|
|
10981
|
+
const cellIdx = obsIndexMap.get(cellId);
|
|
10982
|
+
return [
|
|
10983
|
+
obsEmbedding.data[0][cellIdx],
|
|
10984
|
+
-obsEmbedding.data[1][cellIdx]
|
|
10985
|
+
];
|
|
10986
|
+
}).filter((cell) => cell.every((i) => typeof i === "number"));
|
|
10987
|
+
if (cellPositions.length > 2) {
|
|
10988
|
+
const points = featureCollection(
|
|
10989
|
+
cellPositions.map(point)
|
|
10990
|
+
);
|
|
10991
|
+
const concavity = Infinity;
|
|
10992
|
+
const hullCoords = concaveman$1(cellPositions, concavity);
|
|
10993
|
+
if (hullCoords) {
|
|
10994
|
+
const centroidCoords = centroid(points).geometry.coordinates;
|
|
10995
|
+
cellSetPolygons.push({
|
|
10996
|
+
path: setNamePath,
|
|
10997
|
+
name: setNamePath[setNamePath.length - 1],
|
|
10998
|
+
hull: hullCoords,
|
|
10999
|
+
color: nodeColor,
|
|
11000
|
+
centroid: centroidCoords
|
|
11001
|
+
});
|
|
11002
|
+
}
|
|
10800
11003
|
}
|
|
10801
11004
|
}
|
|
10802
|
-
|
|
10803
|
-
|
|
10804
|
-
|
|
10805
|
-
|
|
10806
|
-
|
|
10807
|
-
|
|
10808
|
-
|
|
10809
|
-
|
|
11005
|
+
});
|
|
11006
|
+
return cellSetPolygons;
|
|
11007
|
+
}
|
|
11008
|
+
function treeToSetSizesBySetNames(currTree, allNamePaths, selectedNamePaths, setColor, theme) {
|
|
11009
|
+
const sizes = [];
|
|
11010
|
+
const contains = (path, paths) => paths.some((p) => isEqual(p, path));
|
|
11011
|
+
allNamePaths.forEach((clusterPath) => {
|
|
11012
|
+
var _a;
|
|
11013
|
+
const node = treeFindNodeByNamePath(currTree, clusterPath);
|
|
11014
|
+
if (node) {
|
|
11015
|
+
const nodeSet = nodeToSet(node);
|
|
11016
|
+
const nodeColor = ((_a = setColor == null ? void 0 : setColor.find((d) => isEqual(d.path, clusterPath))) == null ? void 0 : _a.color) || getDefaultColor(theme);
|
|
11017
|
+
const nodeProps = {
|
|
11018
|
+
key: generateKey(),
|
|
11019
|
+
name: node.name,
|
|
11020
|
+
size: nodeSet.length,
|
|
11021
|
+
color: nodeColor,
|
|
11022
|
+
setNamePath: clusterPath,
|
|
11023
|
+
// used by the CellSetSizesPlot to determine if the bar should be grayed out
|
|
11024
|
+
isGrayedOut: true
|
|
11025
|
+
};
|
|
11026
|
+
if (contains(clusterPath, selectedNamePaths)) {
|
|
11027
|
+
nodeProps.isGrayedOut = false;
|
|
10810
11028
|
}
|
|
11029
|
+
sizes.push(nodeProps);
|
|
10811
11030
|
}
|
|
10812
|
-
|
|
10813
|
-
|
|
10814
|
-
|
|
10815
|
-
|
|
10816
|
-
|
|
10817
|
-
|
|
10818
|
-
|
|
10819
|
-
|
|
10820
|
-
|
|
10821
|
-
|
|
10822
|
-
|
|
10823
|
-
|
|
10824
|
-
|
|
10825
|
-
|
|
10826
|
-
|
|
10827
|
-
|
|
10828
|
-
|
|
10829
|
-
|
|
10830
|
-
|
|
10831
|
-
|
|
10832
|
-
|
|
10833
|
-
|
|
10834
|
-
|
|
10835
|
-
|
|
10836
|
-
|
|
10837
|
-
|
|
10838
|
-
|
|
10839
|
-
|
|
10840
|
-
if (!handler)
|
|
10841
|
-
return false;
|
|
10842
|
-
var isFn = typeof handler === "function";
|
|
10843
|
-
len = arguments.length;
|
|
10844
|
-
switch (len) {
|
|
10845
|
-
case 1:
|
|
10846
|
-
emitNone(handler, isFn, this);
|
|
10847
|
-
break;
|
|
10848
|
-
case 2:
|
|
10849
|
-
emitOne(handler, isFn, this, arguments[1]);
|
|
10850
|
-
break;
|
|
10851
|
-
case 3:
|
|
10852
|
-
emitTwo(handler, isFn, this, arguments[1], arguments[2]);
|
|
10853
|
-
break;
|
|
10854
|
-
case 4:
|
|
10855
|
-
emitThree(handler, isFn, this, arguments[1], arguments[2], arguments[3]);
|
|
10856
|
-
break;
|
|
10857
|
-
default:
|
|
10858
|
-
args = new Array(len - 1);
|
|
10859
|
-
for (i = 1; i < len; i++)
|
|
10860
|
-
args[i - 1] = arguments[i];
|
|
10861
|
-
emitMany(handler, isFn, this, args);
|
|
10862
|
-
}
|
|
10863
|
-
return true;
|
|
10864
|
-
};
|
|
10865
|
-
function _addListener(target, type2, listener, prepend) {
|
|
10866
|
-
var m;
|
|
10867
|
-
var events;
|
|
10868
|
-
var existing;
|
|
10869
|
-
if (typeof listener !== "function")
|
|
10870
|
-
throw new TypeError('"listener" argument must be a function');
|
|
10871
|
-
events = target._events;
|
|
10872
|
-
if (!events) {
|
|
10873
|
-
events = target._events = new EventHandlers();
|
|
10874
|
-
target._eventsCount = 0;
|
|
10875
|
-
} else {
|
|
10876
|
-
if (events.newListener) {
|
|
10877
|
-
target.emit(
|
|
10878
|
-
"newListener",
|
|
10879
|
-
type2,
|
|
10880
|
-
listener.listener ? listener.listener : listener
|
|
10881
|
-
);
|
|
10882
|
-
events = target._events;
|
|
10883
|
-
}
|
|
10884
|
-
existing = events[type2];
|
|
10885
|
-
}
|
|
10886
|
-
if (!existing) {
|
|
10887
|
-
existing = events[type2] = listener;
|
|
10888
|
-
++target._eventsCount;
|
|
10889
|
-
} else {
|
|
10890
|
-
if (typeof existing === "function") {
|
|
10891
|
-
existing = events[type2] = prepend ? [listener, existing] : [existing, listener];
|
|
10892
|
-
} else {
|
|
10893
|
-
if (prepend) {
|
|
10894
|
-
existing.unshift(listener);
|
|
10895
|
-
} else {
|
|
10896
|
-
existing.push(listener);
|
|
10897
|
-
}
|
|
10898
|
-
}
|
|
10899
|
-
if (!existing.warned) {
|
|
10900
|
-
m = $getMaxListeners(target);
|
|
10901
|
-
if (m && m > 0 && existing.length > m) {
|
|
10902
|
-
existing.warned = true;
|
|
10903
|
-
var w = new Error("Possible EventEmitter memory leak detected. " + existing.length + " " + type2 + " listeners added. Use emitter.setMaxListeners() to increase limit");
|
|
10904
|
-
w.name = "MaxListenersExceededWarning";
|
|
10905
|
-
w.emitter = target;
|
|
10906
|
-
w.type = type2;
|
|
10907
|
-
w.count = existing.length;
|
|
10908
|
-
emitWarning(w);
|
|
10909
|
-
}
|
|
11031
|
+
});
|
|
11032
|
+
return sizes;
|
|
11033
|
+
}
|
|
11034
|
+
function filterNode(node, prevPath, filterPath) {
|
|
11035
|
+
if (isEqual([...prevPath, node.name], filterPath)) {
|
|
11036
|
+
return null;
|
|
11037
|
+
}
|
|
11038
|
+
if (!node.children) {
|
|
11039
|
+
return node;
|
|
11040
|
+
}
|
|
11041
|
+
return {
|
|
11042
|
+
...node,
|
|
11043
|
+
children: node.children.map(
|
|
11044
|
+
(c) => filterNode(c, [...prevPath, node.name], filterPath)
|
|
11045
|
+
).filter(Boolean)
|
|
11046
|
+
};
|
|
11047
|
+
}
|
|
11048
|
+
function treeToExpectedCheckedLevel(currTree, checkedPaths) {
|
|
11049
|
+
let result = null;
|
|
11050
|
+
if (currTree) {
|
|
11051
|
+
currTree.tree.forEach((lzn) => {
|
|
11052
|
+
const levelZeroPath = [lzn.name];
|
|
11053
|
+
const height = nodeToHeight(lzn);
|
|
11054
|
+
range$2(height).forEach((i) => {
|
|
11055
|
+
const levelIndex = i + 1;
|
|
11056
|
+
const levelNodePaths = nodeToLevelDescendantNamePaths(lzn, levelIndex, [], true);
|
|
11057
|
+
if (isEqual(levelNodePaths, checkedPaths)) {
|
|
11058
|
+
result = { levelZeroPath, levelIndex };
|
|
10910
11059
|
}
|
|
10911
|
-
}
|
|
10912
|
-
|
|
11060
|
+
});
|
|
11061
|
+
});
|
|
11062
|
+
}
|
|
11063
|
+
return result;
|
|
11064
|
+
}
|
|
11065
|
+
function treesConflict(cellSets, testCellSets) {
|
|
11066
|
+
const paths = [];
|
|
11067
|
+
const testPaths = [];
|
|
11068
|
+
let hasConflict = false;
|
|
11069
|
+
function getPaths2(node, prevPath) {
|
|
11070
|
+
paths.push([...prevPath, node.name]);
|
|
11071
|
+
if (node.children) {
|
|
11072
|
+
node.children.forEach((c) => getPaths2(c, [...prevPath, node.name]));
|
|
10913
11073
|
}
|
|
10914
|
-
|
|
10915
|
-
|
|
11074
|
+
}
|
|
11075
|
+
cellSets.tree.forEach((lzn) => getPaths2(lzn, []));
|
|
11076
|
+
function getTestPaths(node, prevPath) {
|
|
11077
|
+
testPaths.push([...prevPath, node.name]);
|
|
11078
|
+
if (node.children) {
|
|
11079
|
+
node.children.forEach((c) => getPaths2(c, [...prevPath, node.name]));
|
|
10916
11080
|
}
|
|
10917
|
-
|
|
10918
|
-
|
|
10919
|
-
|
|
10920
|
-
|
|
10921
|
-
|
|
10922
|
-
return _addListener(this, type2, listener, true);
|
|
10923
|
-
};
|
|
10924
|
-
function _onceWrap(target, type2, listener) {
|
|
10925
|
-
var fired = false;
|
|
10926
|
-
function g() {
|
|
10927
|
-
target.removeListener(type2, g);
|
|
10928
|
-
if (!fired) {
|
|
10929
|
-
fired = true;
|
|
10930
|
-
listener.apply(target, arguments);
|
|
10931
|
-
}
|
|
10932
|
-
}
|
|
10933
|
-
g.listener = listener;
|
|
10934
|
-
return g;
|
|
11081
|
+
}
|
|
11082
|
+
testCellSets.tree.forEach((lzn) => getTestPaths(lzn, []));
|
|
11083
|
+
testPaths.forEach((testPath) => {
|
|
11084
|
+
if (paths.find((p) => isEqual(p, testPath))) {
|
|
11085
|
+
hasConflict = true;
|
|
10935
11086
|
}
|
|
10936
|
-
|
|
10937
|
-
|
|
10938
|
-
|
|
10939
|
-
|
|
10940
|
-
|
|
10941
|
-
|
|
10942
|
-
|
|
10943
|
-
|
|
10944
|
-
|
|
10945
|
-
|
|
10946
|
-
|
|
10947
|
-
|
|
10948
|
-
|
|
10949
|
-
|
|
10950
|
-
|
|
10951
|
-
|
|
10952
|
-
|
|
10953
|
-
|
|
10954
|
-
|
|
10955
|
-
|
|
10956
|
-
|
|
10957
|
-
|
|
10958
|
-
|
|
10959
|
-
|
|
10960
|
-
|
|
10961
|
-
|
|
10962
|
-
|
|
10963
|
-
|
|
10964
|
-
|
|
10965
|
-
|
|
10966
|
-
|
|
10967
|
-
|
|
10968
|
-
|
|
10969
|
-
|
|
10970
|
-
|
|
10971
|
-
|
|
10972
|
-
|
|
10973
|
-
|
|
10974
|
-
|
|
10975
|
-
|
|
10976
|
-
|
|
10977
|
-
|
|
10978
|
-
|
|
10979
|
-
|
|
10980
|
-
|
|
10981
|
-
|
|
10982
|
-
|
|
10983
|
-
|
|
11087
|
+
});
|
|
11088
|
+
return hasConflict;
|
|
11089
|
+
}
|
|
11090
|
+
function initializeCellSetColor(cellSets, cellSetColor) {
|
|
11091
|
+
const nextCellSetColor = [...cellSetColor || []];
|
|
11092
|
+
const nodeCountPerTreePerLevel = cellSets.tree.map((tree) => Array.from({
|
|
11093
|
+
length: nodeToHeight(tree) + 1
|
|
11094
|
+
// Need to add one because its an array.
|
|
11095
|
+
}).fill(0));
|
|
11096
|
+
function processNode(node, prevPath, hierarchyLevel, treeIndex) {
|
|
11097
|
+
const index = nodeCountPerTreePerLevel[treeIndex][hierarchyLevel];
|
|
11098
|
+
const nodePath = [...prevPath, node.name];
|
|
11099
|
+
const nodeColor = nextCellSetColor.find((d) => isEqual(d.path, nodePath));
|
|
11100
|
+
if (!nodeColor) {
|
|
11101
|
+
const nodeColorArray = node.color ? node.color : PALETTE[index % PALETTE.length];
|
|
11102
|
+
nextCellSetColor.push({
|
|
11103
|
+
path: nodePath,
|
|
11104
|
+
color: nodeColorArray
|
|
11105
|
+
});
|
|
11106
|
+
}
|
|
11107
|
+
nodeCountPerTreePerLevel[treeIndex][hierarchyLevel] += 1;
|
|
11108
|
+
if (node.children) {
|
|
11109
|
+
node.children.forEach((c) => processNode(c, nodePath, hierarchyLevel + 1, treeIndex));
|
|
11110
|
+
}
|
|
11111
|
+
}
|
|
11112
|
+
cellSets.tree.forEach((lzn, treeIndex) => processNode(lzn, [], 0, treeIndex));
|
|
11113
|
+
return nextCellSetColor;
|
|
11114
|
+
}
|
|
11115
|
+
function getCellSetPolygons(params) {
|
|
11116
|
+
const {
|
|
11117
|
+
obsIndex,
|
|
11118
|
+
obsEmbedding,
|
|
11119
|
+
cellSets,
|
|
11120
|
+
cellSetSelection,
|
|
11121
|
+
cellSetColor,
|
|
11122
|
+
theme
|
|
11123
|
+
} = params;
|
|
11124
|
+
if (cellSetSelection && cellSetSelection.length > 0 && cellSets && obsIndex && obsEmbedding) {
|
|
11125
|
+
return treeToCellPolygonsBySetNames(
|
|
11126
|
+
cellSets,
|
|
11127
|
+
obsIndex,
|
|
11128
|
+
obsEmbedding,
|
|
11129
|
+
cellSetSelection,
|
|
11130
|
+
cellSetColor,
|
|
11131
|
+
theme
|
|
11132
|
+
);
|
|
11133
|
+
}
|
|
11134
|
+
return [];
|
|
11135
|
+
}
|
|
11136
|
+
function treeToMembershipMap(currTree) {
|
|
11137
|
+
const result = /* @__PURE__ */ new Map();
|
|
11138
|
+
if (currTree) {
|
|
11139
|
+
currTree.tree.forEach((lzn) => {
|
|
11140
|
+
const height = nodeToHeight(lzn);
|
|
11141
|
+
range$2(height).forEach((i) => {
|
|
11142
|
+
const levelIndex = i + 1;
|
|
11143
|
+
const levelNodePaths = nodeToLevelDescendantNamePaths(lzn, levelIndex, [], true);
|
|
11144
|
+
levelNodePaths.forEach((setNamePath) => {
|
|
11145
|
+
const node = treeFindNodeByNamePath(currTree, setNamePath);
|
|
11146
|
+
if (node && !node.children) {
|
|
11147
|
+
const nodeSet = nodeToSet(node);
|
|
11148
|
+
nodeSet.forEach(([obsId]) => {
|
|
11149
|
+
if (result.has(obsId)) {
|
|
11150
|
+
result.get(obsId).push(setNamePath);
|
|
11151
|
+
} else {
|
|
11152
|
+
result.set(obsId, [setNamePath]);
|
|
11153
|
+
}
|
|
11154
|
+
});
|
|
10984
11155
|
}
|
|
10985
|
-
}
|
|
10986
|
-
|
|
10987
|
-
|
|
10988
|
-
|
|
10989
|
-
|
|
11156
|
+
});
|
|
11157
|
+
});
|
|
11158
|
+
});
|
|
11159
|
+
}
|
|
11160
|
+
return result;
|
|
11161
|
+
}
|
|
11162
|
+
function getPaths(node, currentPath = [], paths = []) {
|
|
11163
|
+
if (node.children) {
|
|
11164
|
+
node.children.forEach((child) => {
|
|
11165
|
+
const newPath = [...currentPath, child.name];
|
|
11166
|
+
paths.push(newPath);
|
|
11167
|
+
getPaths(child, newPath, paths);
|
|
11168
|
+
});
|
|
11169
|
+
}
|
|
11170
|
+
return paths;
|
|
11171
|
+
}
|
|
11172
|
+
function findLongestPath(arrOfPaths, path, isSubset) {
|
|
11173
|
+
if (Array.isArray(arrOfPaths)) {
|
|
11174
|
+
let longest = null;
|
|
11175
|
+
let longestLength = 0;
|
|
11176
|
+
arrOfPaths.forEach((subArray) => {
|
|
11177
|
+
const matchCount = subArray.filter((v, i) => v === path[i]).length;
|
|
11178
|
+
if (matchCount === (isSubset ? subArray.length : path.length) && subArray.length > longestLength) {
|
|
11179
|
+
longest = subArray;
|
|
11180
|
+
longestLength = subArray.length;
|
|
10990
11181
|
}
|
|
10991
|
-
|
|
10992
|
-
|
|
10993
|
-
|
|
10994
|
-
|
|
10995
|
-
|
|
10996
|
-
|
|
10997
|
-
|
|
10998
|
-
|
|
10999
|
-
|
|
11000
|
-
|
|
11001
|
-
|
|
11002
|
-
|
|
11003
|
-
|
|
11004
|
-
|
|
11005
|
-
|
|
11006
|
-
|
|
11007
|
-
|
|
11008
|
-
|
|
11182
|
+
});
|
|
11183
|
+
if (longestLength > 0) {
|
|
11184
|
+
return longest;
|
|
11185
|
+
}
|
|
11186
|
+
if (isSubset) {
|
|
11187
|
+
return [];
|
|
11188
|
+
}
|
|
11189
|
+
}
|
|
11190
|
+
return [];
|
|
11191
|
+
}
|
|
11192
|
+
function findLongestCommonPath(arrOfPaths, cellSetSelection) {
|
|
11193
|
+
let maxCount = 0;
|
|
11194
|
+
let commonPath = [];
|
|
11195
|
+
cellSetSelection.forEach((currentCellSet) => {
|
|
11196
|
+
const longestPath = findLongestPath(arrOfPaths, currentCellSet, false);
|
|
11197
|
+
if (longestPath.length > maxCount) {
|
|
11198
|
+
maxCount = longestPath.length;
|
|
11199
|
+
commonPath = currentCellSet;
|
|
11200
|
+
}
|
|
11201
|
+
});
|
|
11202
|
+
return commonPath;
|
|
11203
|
+
}
|
|
11204
|
+
function filterPathsByExpansionAndSelection(mergedCellSets, hierarchy, cellSetExpansion, cellSetSelection) {
|
|
11205
|
+
const paths = getPaths({ children: mergedCellSets.tree });
|
|
11206
|
+
const contains = (allPaths, path) => allPaths == null ? void 0 : allPaths.some((p) => isEqual(p, path));
|
|
11207
|
+
return paths.filter((clusterPath) => {
|
|
11208
|
+
if (contains(cellSetExpansion, clusterPath))
|
|
11209
|
+
return false;
|
|
11210
|
+
if (!contains(cellSetSelection, clusterPath)) {
|
|
11211
|
+
if (findLongestPath(cellSetSelection, clusterPath, false).length > clusterPath.length) {
|
|
11212
|
+
return false;
|
|
11009
11213
|
}
|
|
11010
|
-
if (
|
|
11011
|
-
|
|
11012
|
-
|
|
11013
|
-
|
|
11014
|
-
|
|
11015
|
-
|
|
11016
|
-
this.removeAllListeners(key);
|
|
11214
|
+
if (cellSetExpansion) {
|
|
11215
|
+
if (cellSetExpansion.length === 0 && clusterPath.length > 2)
|
|
11216
|
+
return false;
|
|
11217
|
+
const longestSubset = findLongestPath(cellSetExpansion, clusterPath, true);
|
|
11218
|
+
if (cellSetExpansion.length > 0 && longestSubset.length + 1 < clusterPath.length) {
|
|
11219
|
+
return false;
|
|
11017
11220
|
}
|
|
11018
|
-
this.removeAllListeners("removeListener");
|
|
11019
|
-
this._events = new EventHandlers();
|
|
11020
|
-
this._eventsCount = 0;
|
|
11021
|
-
return this;
|
|
11022
|
-
}
|
|
11023
|
-
listeners = events[type2];
|
|
11024
|
-
if (typeof listeners === "function") {
|
|
11025
|
-
this.removeListener(type2, listeners);
|
|
11026
|
-
} else if (listeners) {
|
|
11027
|
-
do {
|
|
11028
|
-
this.removeListener(type2, listeners[listeners.length - 1]);
|
|
11029
|
-
} while (listeners[0]);
|
|
11030
|
-
}
|
|
11031
|
-
return this;
|
|
11032
|
-
};
|
|
11033
|
-
EventEmitter.prototype.listeners = function listeners(type2) {
|
|
11034
|
-
var evlistener;
|
|
11035
|
-
var ret;
|
|
11036
|
-
var events = this._events;
|
|
11037
|
-
if (!events)
|
|
11038
|
-
ret = [];
|
|
11039
|
-
else {
|
|
11040
|
-
evlistener = events[type2];
|
|
11041
|
-
if (!evlistener)
|
|
11042
|
-
ret = [];
|
|
11043
|
-
else if (typeof evlistener === "function")
|
|
11044
|
-
ret = [evlistener.listener || evlistener];
|
|
11045
|
-
else
|
|
11046
|
-
ret = unwrapListeners(evlistener);
|
|
11047
11221
|
}
|
|
11048
|
-
|
|
11049
|
-
|
|
11050
|
-
|
|
11051
|
-
|
|
11052
|
-
|
|
11053
|
-
|
|
11054
|
-
|
|
11222
|
+
}
|
|
11223
|
+
return clusterPath[0] === hierarchy[0];
|
|
11224
|
+
});
|
|
11225
|
+
}
|
|
11226
|
+
function findChangedHierarchy(prevSelectedPaths, currSelectedPaths) {
|
|
11227
|
+
const unselectedPaths = prevSelectedPaths.filter(
|
|
11228
|
+
(prevPath) => !currSelectedPaths.find((currPath) => isEqual(currPath, prevPath))
|
|
11229
|
+
);
|
|
11230
|
+
const newlySelectedPaths = currSelectedPaths.filter(
|
|
11231
|
+
(currPath) => !prevSelectedPaths.find((prevPath) => isEqual(currPath, prevPath))
|
|
11232
|
+
);
|
|
11233
|
+
if (unselectedPaths.length === 0 && newlySelectedPaths.length === 0) {
|
|
11234
|
+
return null;
|
|
11235
|
+
}
|
|
11236
|
+
const changedPath = newlySelectedPaths.length > 0 ? newlySelectedPaths[0] : unselectedPaths[0];
|
|
11237
|
+
return changedPath.slice(0, -1);
|
|
11238
|
+
}
|
|
11239
|
+
var EOL = {}, EOF = {}, QUOTE = 34, NEWLINE = 10, RETURN = 13;
|
|
11240
|
+
function objectConverter(columns) {
|
|
11241
|
+
return new Function("d", "return {" + columns.map(function(name, i) {
|
|
11242
|
+
return JSON.stringify(name) + ": d[" + i + '] || ""';
|
|
11243
|
+
}).join(",") + "}");
|
|
11244
|
+
}
|
|
11245
|
+
function customConverter(columns, f) {
|
|
11246
|
+
var object = objectConverter(columns);
|
|
11247
|
+
return function(row, i) {
|
|
11248
|
+
return f(object(row), i, columns);
|
|
11249
|
+
};
|
|
11250
|
+
}
|
|
11251
|
+
function inferColumns(rows) {
|
|
11252
|
+
var columnSet = /* @__PURE__ */ Object.create(null), columns = [];
|
|
11253
|
+
rows.forEach(function(row) {
|
|
11254
|
+
for (var column in row) {
|
|
11255
|
+
if (!(column in columnSet)) {
|
|
11256
|
+
columns.push(columnSet[column] = column);
|
|
11055
11257
|
}
|
|
11056
|
-
}
|
|
11057
|
-
|
|
11058
|
-
|
|
11059
|
-
|
|
11060
|
-
|
|
11061
|
-
|
|
11062
|
-
|
|
11063
|
-
|
|
11064
|
-
|
|
11065
|
-
|
|
11258
|
+
}
|
|
11259
|
+
});
|
|
11260
|
+
return columns;
|
|
11261
|
+
}
|
|
11262
|
+
function pad(value, width) {
|
|
11263
|
+
var s = value + "", length = s.length;
|
|
11264
|
+
return length < width ? new Array(width - length + 1).join(0) + s : s;
|
|
11265
|
+
}
|
|
11266
|
+
function formatYear(year) {
|
|
11267
|
+
return year < 0 ? "-" + pad(-year, 6) : year > 9999 ? "+" + pad(year, 6) : pad(year, 4);
|
|
11268
|
+
}
|
|
11269
|
+
function formatDate(date) {
|
|
11270
|
+
var hours = date.getUTCHours(), minutes = date.getUTCMinutes(), seconds = date.getUTCSeconds(), milliseconds = date.getUTCMilliseconds();
|
|
11271
|
+
return isNaN(date) ? "Invalid Date" : formatYear(date.getUTCFullYear()) + "-" + pad(date.getUTCMonth() + 1, 2) + "-" + pad(date.getUTCDate(), 2) + (milliseconds ? "T" + pad(hours, 2) + ":" + pad(minutes, 2) + ":" + pad(seconds, 2) + "." + pad(milliseconds, 3) + "Z" : seconds ? "T" + pad(hours, 2) + ":" + pad(minutes, 2) + ":" + pad(seconds, 2) + "Z" : minutes || hours ? "T" + pad(hours, 2) + ":" + pad(minutes, 2) + "Z" : "");
|
|
11272
|
+
}
|
|
11273
|
+
function dsvFormat(delimiter) {
|
|
11274
|
+
var reFormat = new RegExp('["' + delimiter + "\n\r]"), DELIMITER = delimiter.charCodeAt(0);
|
|
11275
|
+
function parse2(text, f) {
|
|
11276
|
+
var convert, columns, rows = parseRows(text, function(row, i) {
|
|
11277
|
+
if (convert)
|
|
11278
|
+
return convert(row, i - 1);
|
|
11279
|
+
columns = row, convert = f ? customConverter(row, f) : objectConverter(row);
|
|
11280
|
+
});
|
|
11281
|
+
rows.columns = columns || [];
|
|
11282
|
+
return rows;
|
|
11283
|
+
}
|
|
11284
|
+
function parseRows(text, f) {
|
|
11285
|
+
var rows = [], N = text.length, I = 0, n = 0, t2, eof = N <= 0, eol = false;
|
|
11286
|
+
if (text.charCodeAt(N - 1) === NEWLINE)
|
|
11287
|
+
--N;
|
|
11288
|
+
if (text.charCodeAt(N - 1) === RETURN)
|
|
11289
|
+
--N;
|
|
11290
|
+
function token() {
|
|
11291
|
+
if (eof)
|
|
11292
|
+
return EOF;
|
|
11293
|
+
if (eol)
|
|
11294
|
+
return eol = false, EOL;
|
|
11295
|
+
var i, j = I, c;
|
|
11296
|
+
if (text.charCodeAt(j) === QUOTE) {
|
|
11297
|
+
while (I++ < N && text.charCodeAt(I) !== QUOTE || text.charCodeAt(++I) === QUOTE)
|
|
11298
|
+
;
|
|
11299
|
+
if ((i = I) >= N)
|
|
11300
|
+
eof = true;
|
|
11301
|
+
else if ((c = text.charCodeAt(I++)) === NEWLINE)
|
|
11302
|
+
eol = true;
|
|
11303
|
+
else if (c === RETURN) {
|
|
11304
|
+
eol = true;
|
|
11305
|
+
if (text.charCodeAt(I) === NEWLINE)
|
|
11306
|
+
++I;
|
|
11066
11307
|
}
|
|
11308
|
+
return text.slice(j + 1, i - 1).replace(/""/g, '"');
|
|
11067
11309
|
}
|
|
11068
|
-
|
|
11310
|
+
while (I < N) {
|
|
11311
|
+
if ((c = text.charCodeAt(i = I++)) === NEWLINE)
|
|
11312
|
+
eol = true;
|
|
11313
|
+
else if (c === RETURN) {
|
|
11314
|
+
eol = true;
|
|
11315
|
+
if (text.charCodeAt(I) === NEWLINE)
|
|
11316
|
+
++I;
|
|
11317
|
+
} else if (c !== DELIMITER)
|
|
11318
|
+
continue;
|
|
11319
|
+
return text.slice(j, i);
|
|
11320
|
+
}
|
|
11321
|
+
return eof = true, text.slice(j, N);
|
|
11069
11322
|
}
|
|
11070
|
-
|
|
11071
|
-
|
|
11072
|
-
|
|
11073
|
-
|
|
11074
|
-
|
|
11075
|
-
|
|
11076
|
-
|
|
11323
|
+
while ((t2 = token()) !== EOF) {
|
|
11324
|
+
var row = [];
|
|
11325
|
+
while (t2 !== EOL && t2 !== EOF)
|
|
11326
|
+
row.push(t2), t2 = token();
|
|
11327
|
+
if (f && (row = f(row, n++)) == null)
|
|
11328
|
+
continue;
|
|
11329
|
+
rows.push(row);
|
|
11077
11330
|
}
|
|
11078
|
-
|
|
11079
|
-
|
|
11080
|
-
|
|
11081
|
-
|
|
11082
|
-
return
|
|
11331
|
+
return rows;
|
|
11332
|
+
}
|
|
11333
|
+
function preformatBody(rows, columns) {
|
|
11334
|
+
return rows.map(function(row) {
|
|
11335
|
+
return columns.map(function(column) {
|
|
11336
|
+
return formatValue(row[column]);
|
|
11337
|
+
}).join(delimiter);
|
|
11338
|
+
});
|
|
11339
|
+
}
|
|
11340
|
+
function format(rows, columns) {
|
|
11341
|
+
if (columns == null)
|
|
11342
|
+
columns = inferColumns(rows);
|
|
11343
|
+
return [columns.map(formatValue).join(delimiter)].concat(preformatBody(rows, columns)).join("\n");
|
|
11344
|
+
}
|
|
11345
|
+
function formatBody(rows, columns) {
|
|
11346
|
+
if (columns == null)
|
|
11347
|
+
columns = inferColumns(rows);
|
|
11348
|
+
return preformatBody(rows, columns).join("\n");
|
|
11349
|
+
}
|
|
11350
|
+
function formatRows(rows) {
|
|
11351
|
+
return rows.map(formatRow).join("\n");
|
|
11352
|
+
}
|
|
11353
|
+
function formatRow(row) {
|
|
11354
|
+
return row.map(formatValue).join(delimiter);
|
|
11355
|
+
}
|
|
11356
|
+
function formatValue(value) {
|
|
11357
|
+
return value == null ? "" : value instanceof Date ? formatDate(value) : reFormat.test(value += "") ? '"' + value.replace(/"/g, '""') + '"' : value;
|
|
11358
|
+
}
|
|
11359
|
+
return {
|
|
11360
|
+
parse: parse2,
|
|
11361
|
+
parseRows,
|
|
11362
|
+
format,
|
|
11363
|
+
formatBody,
|
|
11364
|
+
formatRows,
|
|
11365
|
+
formatRow,
|
|
11366
|
+
formatValue
|
|
11367
|
+
};
|
|
11368
|
+
}
|
|
11369
|
+
var json2csv_umd = { exports: {} };
|
|
11370
|
+
(function(module2, exports2) {
|
|
11371
|
+
(function(global2, factory) {
|
|
11372
|
+
factory(exports2);
|
|
11373
|
+
})(commonjsGlobal, function(exports3) {
|
|
11374
|
+
var domain;
|
|
11375
|
+
function EventHandlers() {
|
|
11083
11376
|
}
|
|
11084
|
-
|
|
11085
|
-
|
|
11086
|
-
|
|
11087
|
-
ret[i] = arr[i].listener || arr[i];
|
|
11088
|
-
}
|
|
11089
|
-
return ret;
|
|
11377
|
+
EventHandlers.prototype = /* @__PURE__ */ Object.create(null);
|
|
11378
|
+
function EventEmitter() {
|
|
11379
|
+
EventEmitter.init.call(this);
|
|
11090
11380
|
}
|
|
11091
|
-
|
|
11092
|
-
|
|
11093
|
-
|
|
11094
|
-
|
|
11095
|
-
|
|
11096
|
-
|
|
11097
|
-
|
|
11098
|
-
|
|
11099
|
-
|
|
11100
|
-
|
|
11101
|
-
|
|
11381
|
+
EventEmitter.EventEmitter = EventEmitter;
|
|
11382
|
+
EventEmitter.usingDomains = false;
|
|
11383
|
+
EventEmitter.prototype.domain = void 0;
|
|
11384
|
+
EventEmitter.prototype._events = void 0;
|
|
11385
|
+
EventEmitter.prototype._maxListeners = void 0;
|
|
11386
|
+
EventEmitter.defaultMaxListeners = 10;
|
|
11387
|
+
EventEmitter.init = function() {
|
|
11388
|
+
this.domain = null;
|
|
11389
|
+
if (EventEmitter.usingDomains) {
|
|
11390
|
+
if (domain.active)
|
|
11391
|
+
;
|
|
11102
11392
|
}
|
|
11103
|
-
|
|
11104
|
-
|
|
11393
|
+
if (!this._events || this._events === Object.getPrototypeOf(this)._events) {
|
|
11394
|
+
this._events = new EventHandlers();
|
|
11395
|
+
this._eventsCount = 0;
|
|
11396
|
+
}
|
|
11397
|
+
this._maxListeners = this._maxListeners || void 0;
|
|
11398
|
+
};
|
|
11399
|
+
EventEmitter.prototype.setMaxListeners = function setMaxListeners(n) {
|
|
11400
|
+
if (typeof n !== "number" || n < 0 || isNaN(n))
|
|
11401
|
+
throw new TypeError('"n" argument must be a positive number');
|
|
11402
|
+
this._maxListeners = n;
|
|
11403
|
+
return this;
|
|
11404
|
+
};
|
|
11405
|
+
function $getMaxListeners(that) {
|
|
11406
|
+
if (that._maxListeners === void 0)
|
|
11407
|
+
return EventEmitter.defaultMaxListeners;
|
|
11408
|
+
return that._maxListeners;
|
|
11105
11409
|
}
|
|
11106
|
-
function
|
|
11107
|
-
|
|
11108
|
-
|
|
11410
|
+
EventEmitter.prototype.getMaxListeners = function getMaxListeners() {
|
|
11411
|
+
return $getMaxListeners(this);
|
|
11412
|
+
};
|
|
11413
|
+
function emitNone(handler, isFn, self2) {
|
|
11414
|
+
if (isFn)
|
|
11415
|
+
handler.call(self2);
|
|
11416
|
+
else {
|
|
11417
|
+
var len = handler.length;
|
|
11418
|
+
var listeners = arrayClone(handler, len);
|
|
11419
|
+
for (var i = 0; i < len; ++i)
|
|
11420
|
+
listeners[i].call(self2);
|
|
11109
11421
|
}
|
|
11110
|
-
|
|
11111
|
-
|
|
11112
|
-
if (
|
|
11113
|
-
|
|
11422
|
+
}
|
|
11423
|
+
function emitOne(handler, isFn, self2, arg1) {
|
|
11424
|
+
if (isFn)
|
|
11425
|
+
handler.call(self2, arg1);
|
|
11426
|
+
else {
|
|
11427
|
+
var len = handler.length;
|
|
11428
|
+
var listeners = arrayClone(handler, len);
|
|
11429
|
+
for (var i = 0; i < len; ++i)
|
|
11430
|
+
listeners[i].call(self2, arg1);
|
|
11114
11431
|
}
|
|
11115
|
-
placeHolders = b64[len - 2] === "=" ? 2 : b64[len - 1] === "=" ? 1 : 0;
|
|
11116
|
-
arr = new Arr(len * 3 / 4 - placeHolders);
|
|
11117
|
-
l = placeHolders > 0 ? len - 4 : len;
|
|
11118
|
-
var L = 0;
|
|
11119
|
-
for (i = 0, j = 0; i < l; i += 4, j += 3) {
|
|
11120
|
-
tmp = revLookup[b64.charCodeAt(i)] << 18 | revLookup[b64.charCodeAt(i + 1)] << 12 | revLookup[b64.charCodeAt(i + 2)] << 6 | revLookup[b64.charCodeAt(i + 3)];
|
|
11121
|
-
arr[L++] = tmp >> 16 & 255;
|
|
11122
|
-
arr[L++] = tmp >> 8 & 255;
|
|
11123
|
-
arr[L++] = tmp & 255;
|
|
11124
|
-
}
|
|
11125
|
-
if (placeHolders === 2) {
|
|
11126
|
-
tmp = revLookup[b64.charCodeAt(i)] << 2 | revLookup[b64.charCodeAt(i + 1)] >> 4;
|
|
11127
|
-
arr[L++] = tmp & 255;
|
|
11128
|
-
} else if (placeHolders === 1) {
|
|
11129
|
-
tmp = revLookup[b64.charCodeAt(i)] << 10 | revLookup[b64.charCodeAt(i + 1)] << 4 | revLookup[b64.charCodeAt(i + 2)] >> 2;
|
|
11130
|
-
arr[L++] = tmp >> 8 & 255;
|
|
11131
|
-
arr[L++] = tmp & 255;
|
|
11132
|
-
}
|
|
11133
|
-
return arr;
|
|
11134
11432
|
}
|
|
11135
|
-
function
|
|
11136
|
-
|
|
11137
|
-
|
|
11138
|
-
|
|
11139
|
-
|
|
11140
|
-
|
|
11141
|
-
|
|
11142
|
-
|
|
11143
|
-
output.push(tripletToBase64(tmp));
|
|
11433
|
+
function emitTwo(handler, isFn, self2, arg1, arg2) {
|
|
11434
|
+
if (isFn)
|
|
11435
|
+
handler.call(self2, arg1, arg2);
|
|
11436
|
+
else {
|
|
11437
|
+
var len = handler.length;
|
|
11438
|
+
var listeners = arrayClone(handler, len);
|
|
11439
|
+
for (var i = 0; i < len; ++i)
|
|
11440
|
+
listeners[i].call(self2, arg1, arg2);
|
|
11144
11441
|
}
|
|
11145
|
-
return output.join("");
|
|
11146
11442
|
}
|
|
11147
|
-
function
|
|
11148
|
-
if (
|
|
11149
|
-
|
|
11150
|
-
|
|
11151
|
-
|
|
11152
|
-
|
|
11153
|
-
|
|
11154
|
-
|
|
11155
|
-
var parts = [];
|
|
11156
|
-
var maxChunkLength = 16383;
|
|
11157
|
-
for (var i = 0, len2 = len - extraBytes; i < len2; i += maxChunkLength) {
|
|
11158
|
-
parts.push(encodeChunk(uint8, i, i + maxChunkLength > len2 ? len2 : i + maxChunkLength));
|
|
11159
|
-
}
|
|
11160
|
-
if (extraBytes === 1) {
|
|
11161
|
-
tmp = uint8[len - 1];
|
|
11162
|
-
output += lookup[tmp >> 2];
|
|
11163
|
-
output += lookup[tmp << 4 & 63];
|
|
11164
|
-
output += "==";
|
|
11165
|
-
} else if (extraBytes === 2) {
|
|
11166
|
-
tmp = (uint8[len - 2] << 8) + uint8[len - 1];
|
|
11167
|
-
output += lookup[tmp >> 10];
|
|
11168
|
-
output += lookup[tmp >> 4 & 63];
|
|
11169
|
-
output += lookup[tmp << 2 & 63];
|
|
11170
|
-
output += "=";
|
|
11443
|
+
function emitThree(handler, isFn, self2, arg1, arg2, arg3) {
|
|
11444
|
+
if (isFn)
|
|
11445
|
+
handler.call(self2, arg1, arg2, arg3);
|
|
11446
|
+
else {
|
|
11447
|
+
var len = handler.length;
|
|
11448
|
+
var listeners = arrayClone(handler, len);
|
|
11449
|
+
for (var i = 0; i < len; ++i)
|
|
11450
|
+
listeners[i].call(self2, arg1, arg2, arg3);
|
|
11171
11451
|
}
|
|
11172
|
-
parts.push(output);
|
|
11173
|
-
return parts.join("");
|
|
11174
11452
|
}
|
|
11175
|
-
function
|
|
11176
|
-
|
|
11177
|
-
|
|
11178
|
-
|
|
11179
|
-
|
|
11180
|
-
|
|
11181
|
-
|
|
11182
|
-
|
|
11183
|
-
var s = buffer[offset + i];
|
|
11184
|
-
i += d;
|
|
11185
|
-
e = s & (1 << -nBits) - 1;
|
|
11186
|
-
s >>= -nBits;
|
|
11187
|
-
nBits += eLen;
|
|
11188
|
-
for (; nBits > 0; e = e * 256 + buffer[offset + i], i += d, nBits -= 8) {
|
|
11189
|
-
}
|
|
11190
|
-
m = e & (1 << -nBits) - 1;
|
|
11191
|
-
e >>= -nBits;
|
|
11192
|
-
nBits += mLen;
|
|
11193
|
-
for (; nBits > 0; m = m * 256 + buffer[offset + i], i += d, nBits -= 8) {
|
|
11194
|
-
}
|
|
11195
|
-
if (e === 0) {
|
|
11196
|
-
e = 1 - eBias;
|
|
11197
|
-
} else if (e === eMax) {
|
|
11198
|
-
return m ? NaN : (s ? -1 : 1) * Infinity;
|
|
11199
|
-
} else {
|
|
11200
|
-
m = m + Math.pow(2, mLen);
|
|
11201
|
-
e = e - eBias;
|
|
11453
|
+
function emitMany(handler, isFn, self2, args) {
|
|
11454
|
+
if (isFn)
|
|
11455
|
+
handler.apply(self2, args);
|
|
11456
|
+
else {
|
|
11457
|
+
var len = handler.length;
|
|
11458
|
+
var listeners = arrayClone(handler, len);
|
|
11459
|
+
for (var i = 0; i < len; ++i)
|
|
11460
|
+
listeners[i].apply(self2, args);
|
|
11202
11461
|
}
|
|
11203
|
-
return (s ? -1 : 1) * m * Math.pow(2, e - mLen);
|
|
11204
11462
|
}
|
|
11205
|
-
function
|
|
11206
|
-
var
|
|
11207
|
-
var
|
|
11208
|
-
|
|
11209
|
-
|
|
11210
|
-
|
|
11211
|
-
|
|
11212
|
-
|
|
11213
|
-
|
|
11214
|
-
|
|
11215
|
-
|
|
11216
|
-
|
|
11217
|
-
|
|
11218
|
-
|
|
11219
|
-
|
|
11220
|
-
|
|
11221
|
-
|
|
11222
|
-
|
|
11223
|
-
}
|
|
11224
|
-
|
|
11225
|
-
value += rt / c;
|
|
11226
|
-
} else {
|
|
11227
|
-
value += rt * Math.pow(2, 1 - eBias);
|
|
11228
|
-
}
|
|
11229
|
-
if (value * c >= 2) {
|
|
11230
|
-
e++;
|
|
11231
|
-
c /= 2;
|
|
11232
|
-
}
|
|
11233
|
-
if (e + eBias >= eMax) {
|
|
11234
|
-
m = 0;
|
|
11235
|
-
e = eMax;
|
|
11236
|
-
} else if (e + eBias >= 1) {
|
|
11237
|
-
m = (value * c - 1) * Math.pow(2, mLen);
|
|
11238
|
-
e = e + eBias;
|
|
11463
|
+
EventEmitter.prototype.emit = function emit(type2) {
|
|
11464
|
+
var er, handler, len, args, i, events, domain2;
|
|
11465
|
+
var doError = type2 === "error";
|
|
11466
|
+
events = this._events;
|
|
11467
|
+
if (events)
|
|
11468
|
+
doError = doError && events.error == null;
|
|
11469
|
+
else if (!doError)
|
|
11470
|
+
return false;
|
|
11471
|
+
domain2 = this.domain;
|
|
11472
|
+
if (doError) {
|
|
11473
|
+
er = arguments[1];
|
|
11474
|
+
if (domain2) {
|
|
11475
|
+
if (!er)
|
|
11476
|
+
er = new Error('Uncaught, unspecified "error" event');
|
|
11477
|
+
er.domainEmitter = this;
|
|
11478
|
+
er.domain = domain2;
|
|
11479
|
+
er.domainThrown = false;
|
|
11480
|
+
domain2.emit("error", er);
|
|
11481
|
+
} else if (er instanceof Error) {
|
|
11482
|
+
throw er;
|
|
11239
11483
|
} else {
|
|
11240
|
-
|
|
11241
|
-
|
|
11484
|
+
var err = new Error('Uncaught, unspecified "error" event. (' + er + ")");
|
|
11485
|
+
err.context = er;
|
|
11486
|
+
throw err;
|
|
11242
11487
|
}
|
|
11488
|
+
return false;
|
|
11243
11489
|
}
|
|
11244
|
-
|
|
11245
|
-
|
|
11246
|
-
|
|
11247
|
-
|
|
11248
|
-
|
|
11490
|
+
handler = events[type2];
|
|
11491
|
+
if (!handler)
|
|
11492
|
+
return false;
|
|
11493
|
+
var isFn = typeof handler === "function";
|
|
11494
|
+
len = arguments.length;
|
|
11495
|
+
switch (len) {
|
|
11496
|
+
case 1:
|
|
11497
|
+
emitNone(handler, isFn, this);
|
|
11498
|
+
break;
|
|
11499
|
+
case 2:
|
|
11500
|
+
emitOne(handler, isFn, this, arguments[1]);
|
|
11501
|
+
break;
|
|
11502
|
+
case 3:
|
|
11503
|
+
emitTwo(handler, isFn, this, arguments[1], arguments[2]);
|
|
11504
|
+
break;
|
|
11505
|
+
case 4:
|
|
11506
|
+
emitThree(handler, isFn, this, arguments[1], arguments[2], arguments[3]);
|
|
11507
|
+
break;
|
|
11508
|
+
default:
|
|
11509
|
+
args = new Array(len - 1);
|
|
11510
|
+
for (i = 1; i < len; i++)
|
|
11511
|
+
args[i - 1] = arguments[i];
|
|
11512
|
+
emitMany(handler, isFn, this, args);
|
|
11249
11513
|
}
|
|
11250
|
-
|
|
11251
|
-
}
|
|
11252
|
-
var toString = {}.toString;
|
|
11253
|
-
var isArray2 = Array.isArray || function(arr) {
|
|
11254
|
-
return toString.call(arr) == "[object Array]";
|
|
11514
|
+
return true;
|
|
11255
11515
|
};
|
|
11256
|
-
|
|
11257
|
-
|
|
11258
|
-
|
|
11259
|
-
|
|
11260
|
-
|
|
11261
|
-
|
|
11262
|
-
|
|
11263
|
-
|
|
11516
|
+
function _addListener(target, type2, listener, prepend) {
|
|
11517
|
+
var m;
|
|
11518
|
+
var events;
|
|
11519
|
+
var existing;
|
|
11520
|
+
if (typeof listener !== "function")
|
|
11521
|
+
throw new TypeError('"listener" argument must be a function');
|
|
11522
|
+
events = target._events;
|
|
11523
|
+
if (!events) {
|
|
11524
|
+
events = target._events = new EventHandlers();
|
|
11525
|
+
target._eventsCount = 0;
|
|
11526
|
+
} else {
|
|
11527
|
+
if (events.newListener) {
|
|
11528
|
+
target.emit(
|
|
11529
|
+
"newListener",
|
|
11530
|
+
type2,
|
|
11531
|
+
listener.listener ? listener.listener : listener
|
|
11532
|
+
);
|
|
11533
|
+
events = target._events;
|
|
11534
|
+
}
|
|
11535
|
+
existing = events[type2];
|
|
11264
11536
|
}
|
|
11265
|
-
if (
|
|
11266
|
-
|
|
11267
|
-
|
|
11537
|
+
if (!existing) {
|
|
11538
|
+
existing = events[type2] = listener;
|
|
11539
|
+
++target._eventsCount;
|
|
11268
11540
|
} else {
|
|
11269
|
-
if (
|
|
11270
|
-
|
|
11541
|
+
if (typeof existing === "function") {
|
|
11542
|
+
existing = events[type2] = prepend ? [listener, existing] : [existing, listener];
|
|
11543
|
+
} else {
|
|
11544
|
+
if (prepend) {
|
|
11545
|
+
existing.unshift(listener);
|
|
11546
|
+
} else {
|
|
11547
|
+
existing.push(listener);
|
|
11548
|
+
}
|
|
11549
|
+
}
|
|
11550
|
+
if (!existing.warned) {
|
|
11551
|
+
m = $getMaxListeners(target);
|
|
11552
|
+
if (m && m > 0 && existing.length > m) {
|
|
11553
|
+
existing.warned = true;
|
|
11554
|
+
var w = new Error("Possible EventEmitter memory leak detected. " + existing.length + " " + type2 + " listeners added. Use emitter.setMaxListeners() to increase limit");
|
|
11555
|
+
w.name = "MaxListenersExceededWarning";
|
|
11556
|
+
w.emitter = target;
|
|
11557
|
+
w.type = type2;
|
|
11558
|
+
w.count = existing.length;
|
|
11559
|
+
emitWarning(w);
|
|
11560
|
+
}
|
|
11271
11561
|
}
|
|
11272
|
-
that.length = length;
|
|
11273
11562
|
}
|
|
11274
|
-
return
|
|
11563
|
+
return target;
|
|
11275
11564
|
}
|
|
11276
|
-
function
|
|
11277
|
-
|
|
11278
|
-
|
|
11279
|
-
|
|
11280
|
-
|
|
11281
|
-
|
|
11282
|
-
|
|
11283
|
-
|
|
11284
|
-
|
|
11565
|
+
function emitWarning(e) {
|
|
11566
|
+
typeof console.warn === "function" ? console.warn(e) : console.log(e);
|
|
11567
|
+
}
|
|
11568
|
+
EventEmitter.prototype.addListener = function addListener(type2, listener) {
|
|
11569
|
+
return _addListener(this, type2, listener, false);
|
|
11570
|
+
};
|
|
11571
|
+
EventEmitter.prototype.on = EventEmitter.prototype.addListener;
|
|
11572
|
+
EventEmitter.prototype.prependListener = function prependListener2(type2, listener) {
|
|
11573
|
+
return _addListener(this, type2, listener, true);
|
|
11574
|
+
};
|
|
11575
|
+
function _onceWrap(target, type2, listener) {
|
|
11576
|
+
var fired = false;
|
|
11577
|
+
function g() {
|
|
11578
|
+
target.removeListener(type2, g);
|
|
11579
|
+
if (!fired) {
|
|
11580
|
+
fired = true;
|
|
11581
|
+
listener.apply(target, arguments);
|
|
11285
11582
|
}
|
|
11286
|
-
return allocUnsafe2(this, arg);
|
|
11287
11583
|
}
|
|
11288
|
-
|
|
11584
|
+
g.listener = listener;
|
|
11585
|
+
return g;
|
|
11289
11586
|
}
|
|
11290
|
-
|
|
11291
|
-
|
|
11292
|
-
|
|
11293
|
-
|
|
11587
|
+
EventEmitter.prototype.once = function once(type2, listener) {
|
|
11588
|
+
if (typeof listener !== "function")
|
|
11589
|
+
throw new TypeError('"listener" argument must be a function');
|
|
11590
|
+
this.on(type2, _onceWrap(this, type2, listener));
|
|
11591
|
+
return this;
|
|
11294
11592
|
};
|
|
11295
|
-
function
|
|
11296
|
-
if (typeof
|
|
11297
|
-
throw new TypeError('"
|
|
11593
|
+
EventEmitter.prototype.prependOnceListener = function prependOnceListener(type2, listener) {
|
|
11594
|
+
if (typeof listener !== "function")
|
|
11595
|
+
throw new TypeError('"listener" argument must be a function');
|
|
11596
|
+
this.prependListener(type2, _onceWrap(this, type2, listener));
|
|
11597
|
+
return this;
|
|
11598
|
+
};
|
|
11599
|
+
EventEmitter.prototype.removeListener = function removeListener(type2, listener) {
|
|
11600
|
+
var list, events, position, i, originalListener;
|
|
11601
|
+
if (typeof listener !== "function")
|
|
11602
|
+
throw new TypeError('"listener" argument must be a function');
|
|
11603
|
+
events = this._events;
|
|
11604
|
+
if (!events)
|
|
11605
|
+
return this;
|
|
11606
|
+
list = events[type2];
|
|
11607
|
+
if (!list)
|
|
11608
|
+
return this;
|
|
11609
|
+
if (list === listener || list.listener && list.listener === listener) {
|
|
11610
|
+
if (--this._eventsCount === 0)
|
|
11611
|
+
this._events = new EventHandlers();
|
|
11612
|
+
else {
|
|
11613
|
+
delete events[type2];
|
|
11614
|
+
if (events.removeListener)
|
|
11615
|
+
this.emit("removeListener", type2, list.listener || listener);
|
|
11616
|
+
}
|
|
11617
|
+
} else if (typeof list !== "function") {
|
|
11618
|
+
position = -1;
|
|
11619
|
+
for (i = list.length; i-- > 0; ) {
|
|
11620
|
+
if (list[i] === listener || list[i].listener && list[i].listener === listener) {
|
|
11621
|
+
originalListener = list[i].listener;
|
|
11622
|
+
position = i;
|
|
11623
|
+
break;
|
|
11624
|
+
}
|
|
11625
|
+
}
|
|
11626
|
+
if (position < 0)
|
|
11627
|
+
return this;
|
|
11628
|
+
if (list.length === 1) {
|
|
11629
|
+
list[0] = void 0;
|
|
11630
|
+
if (--this._eventsCount === 0) {
|
|
11631
|
+
this._events = new EventHandlers();
|
|
11632
|
+
return this;
|
|
11633
|
+
} else {
|
|
11634
|
+
delete events[type2];
|
|
11635
|
+
}
|
|
11636
|
+
} else {
|
|
11637
|
+
spliceOne(list, position);
|
|
11638
|
+
}
|
|
11639
|
+
if (events.removeListener)
|
|
11640
|
+
this.emit("removeListener", type2, originalListener || listener);
|
|
11298
11641
|
}
|
|
11299
|
-
|
|
11300
|
-
|
|
11642
|
+
return this;
|
|
11643
|
+
};
|
|
11644
|
+
EventEmitter.prototype.removeAllListeners = function removeAllListeners(type2) {
|
|
11645
|
+
var listeners, events;
|
|
11646
|
+
events = this._events;
|
|
11647
|
+
if (!events)
|
|
11648
|
+
return this;
|
|
11649
|
+
if (!events.removeListener) {
|
|
11650
|
+
if (arguments.length === 0) {
|
|
11651
|
+
this._events = new EventHandlers();
|
|
11652
|
+
this._eventsCount = 0;
|
|
11653
|
+
} else if (events[type2]) {
|
|
11654
|
+
if (--this._eventsCount === 0)
|
|
11655
|
+
this._events = new EventHandlers();
|
|
11656
|
+
else
|
|
11657
|
+
delete events[type2];
|
|
11658
|
+
}
|
|
11659
|
+
return this;
|
|
11301
11660
|
}
|
|
11302
|
-
if (
|
|
11303
|
-
|
|
11661
|
+
if (arguments.length === 0) {
|
|
11662
|
+
var keys3 = Object.keys(events);
|
|
11663
|
+
for (var i = 0, key; i < keys3.length; ++i) {
|
|
11664
|
+
key = keys3[i];
|
|
11665
|
+
if (key === "removeListener")
|
|
11666
|
+
continue;
|
|
11667
|
+
this.removeAllListeners(key);
|
|
11668
|
+
}
|
|
11669
|
+
this.removeAllListeners("removeListener");
|
|
11670
|
+
this._events = new EventHandlers();
|
|
11671
|
+
this._eventsCount = 0;
|
|
11672
|
+
return this;
|
|
11304
11673
|
}
|
|
11305
|
-
|
|
11306
|
-
|
|
11307
|
-
|
|
11308
|
-
|
|
11309
|
-
|
|
11310
|
-
|
|
11311
|
-
|
|
11312
|
-
Buffer2.__proto__ = Uint8Array;
|
|
11313
|
-
}
|
|
11314
|
-
function assertSize(size) {
|
|
11315
|
-
if (typeof size !== "number") {
|
|
11316
|
-
throw new TypeError('"size" argument must be a number');
|
|
11317
|
-
} else if (size < 0) {
|
|
11318
|
-
throw new RangeError('"size" argument must not be negative');
|
|
11674
|
+
listeners = events[type2];
|
|
11675
|
+
if (typeof listeners === "function") {
|
|
11676
|
+
this.removeListener(type2, listeners);
|
|
11677
|
+
} else if (listeners) {
|
|
11678
|
+
do {
|
|
11679
|
+
this.removeListener(type2, listeners[listeners.length - 1]);
|
|
11680
|
+
} while (listeners[0]);
|
|
11319
11681
|
}
|
|
11320
|
-
|
|
11321
|
-
|
|
11322
|
-
|
|
11323
|
-
|
|
11324
|
-
|
|
11682
|
+
return this;
|
|
11683
|
+
};
|
|
11684
|
+
EventEmitter.prototype.listeners = function listeners(type2) {
|
|
11685
|
+
var evlistener;
|
|
11686
|
+
var ret;
|
|
11687
|
+
var events = this._events;
|
|
11688
|
+
if (!events)
|
|
11689
|
+
ret = [];
|
|
11690
|
+
else {
|
|
11691
|
+
evlistener = events[type2];
|
|
11692
|
+
if (!evlistener)
|
|
11693
|
+
ret = [];
|
|
11694
|
+
else if (typeof evlistener === "function")
|
|
11695
|
+
ret = [evlistener.listener || evlistener];
|
|
11696
|
+
else
|
|
11697
|
+
ret = unwrapListeners(evlistener);
|
|
11325
11698
|
}
|
|
11326
|
-
|
|
11327
|
-
|
|
11699
|
+
return ret;
|
|
11700
|
+
};
|
|
11701
|
+
EventEmitter.listenerCount = function(emitter, type2) {
|
|
11702
|
+
if (typeof emitter.listenerCount === "function") {
|
|
11703
|
+
return emitter.listenerCount(type2);
|
|
11704
|
+
} else {
|
|
11705
|
+
return listenerCount.call(emitter, type2);
|
|
11328
11706
|
}
|
|
11329
|
-
return createBuffer(that, size);
|
|
11330
|
-
}
|
|
11331
|
-
Buffer2.alloc = function(size, fill, encoding) {
|
|
11332
|
-
return alloc(null, size, fill, encoding);
|
|
11333
11707
|
};
|
|
11334
|
-
|
|
11335
|
-
|
|
11336
|
-
|
|
11337
|
-
if (
|
|
11338
|
-
|
|
11339
|
-
|
|
11708
|
+
EventEmitter.prototype.listenerCount = listenerCount;
|
|
11709
|
+
function listenerCount(type2) {
|
|
11710
|
+
var events = this._events;
|
|
11711
|
+
if (events) {
|
|
11712
|
+
var evlistener = events[type2];
|
|
11713
|
+
if (typeof evlistener === "function") {
|
|
11714
|
+
return 1;
|
|
11715
|
+
} else if (evlistener) {
|
|
11716
|
+
return evlistener.length;
|
|
11340
11717
|
}
|
|
11341
11718
|
}
|
|
11342
|
-
return
|
|
11719
|
+
return 0;
|
|
11343
11720
|
}
|
|
11344
|
-
|
|
11345
|
-
return
|
|
11346
|
-
};
|
|
11347
|
-
Buffer2.allocUnsafeSlow = function(size) {
|
|
11348
|
-
return allocUnsafe2(null, size);
|
|
11721
|
+
EventEmitter.prototype.eventNames = function eventNames() {
|
|
11722
|
+
return this._eventsCount > 0 ? Reflect.ownKeys(this._events) : [];
|
|
11349
11723
|
};
|
|
11350
|
-
function
|
|
11351
|
-
|
|
11352
|
-
|
|
11353
|
-
|
|
11354
|
-
|
|
11355
|
-
|
|
11356
|
-
|
|
11357
|
-
|
|
11358
|
-
|
|
11359
|
-
|
|
11360
|
-
|
|
11361
|
-
|
|
11724
|
+
function spliceOne(list, index) {
|
|
11725
|
+
for (var i = index, k = i + 1, n = list.length; k < n; i += 1, k += 1)
|
|
11726
|
+
list[i] = list[k];
|
|
11727
|
+
list.pop();
|
|
11728
|
+
}
|
|
11729
|
+
function arrayClone(arr, i) {
|
|
11730
|
+
var copy = new Array(i);
|
|
11731
|
+
while (i--)
|
|
11732
|
+
copy[i] = arr[i];
|
|
11733
|
+
return copy;
|
|
11734
|
+
}
|
|
11735
|
+
function unwrapListeners(arr) {
|
|
11736
|
+
var ret = new Array(arr.length);
|
|
11737
|
+
for (var i = 0; i < ret.length; ++i) {
|
|
11738
|
+
ret[i] = arr[i].listener || arr[i];
|
|
11362
11739
|
}
|
|
11363
|
-
return
|
|
11740
|
+
return ret;
|
|
11364
11741
|
}
|
|
11365
|
-
|
|
11366
|
-
|
|
11367
|
-
|
|
11368
|
-
|
|
11369
|
-
|
|
11742
|
+
var global$1 = typeof commonjsGlobal !== "undefined" ? commonjsGlobal : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {};
|
|
11743
|
+
var lookup = [];
|
|
11744
|
+
var revLookup = [];
|
|
11745
|
+
var Arr = typeof Uint8Array !== "undefined" ? Uint8Array : Array;
|
|
11746
|
+
var inited = false;
|
|
11747
|
+
function init() {
|
|
11748
|
+
inited = true;
|
|
11749
|
+
var code = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";
|
|
11750
|
+
for (var i = 0, len = code.length; i < len; ++i) {
|
|
11751
|
+
lookup[i] = code[i];
|
|
11752
|
+
revLookup[code.charCodeAt(i)] = i;
|
|
11370
11753
|
}
|
|
11371
|
-
|
|
11754
|
+
revLookup["-".charCodeAt(0)] = 62;
|
|
11755
|
+
revLookup["_".charCodeAt(0)] = 63;
|
|
11372
11756
|
}
|
|
11373
|
-
function
|
|
11374
|
-
|
|
11375
|
-
|
|
11376
|
-
throw new RangeError("'offset' is out of bounds");
|
|
11757
|
+
function toByteArray(b64) {
|
|
11758
|
+
if (!inited) {
|
|
11759
|
+
init();
|
|
11377
11760
|
}
|
|
11378
|
-
|
|
11379
|
-
|
|
11761
|
+
var i, j, l, tmp, placeHolders, arr;
|
|
11762
|
+
var len = b64.length;
|
|
11763
|
+
if (len % 4 > 0) {
|
|
11764
|
+
throw new Error("Invalid string. Length must be a multiple of 4");
|
|
11380
11765
|
}
|
|
11381
|
-
|
|
11382
|
-
|
|
11383
|
-
|
|
11384
|
-
|
|
11385
|
-
|
|
11386
|
-
|
|
11766
|
+
placeHolders = b64[len - 2] === "=" ? 2 : b64[len - 1] === "=" ? 1 : 0;
|
|
11767
|
+
arr = new Arr(len * 3 / 4 - placeHolders);
|
|
11768
|
+
l = placeHolders > 0 ? len - 4 : len;
|
|
11769
|
+
var L = 0;
|
|
11770
|
+
for (i = 0, j = 0; i < l; i += 4, j += 3) {
|
|
11771
|
+
tmp = revLookup[b64.charCodeAt(i)] << 18 | revLookup[b64.charCodeAt(i + 1)] << 12 | revLookup[b64.charCodeAt(i + 2)] << 6 | revLookup[b64.charCodeAt(i + 3)];
|
|
11772
|
+
arr[L++] = tmp >> 16 & 255;
|
|
11773
|
+
arr[L++] = tmp >> 8 & 255;
|
|
11774
|
+
arr[L++] = tmp & 255;
|
|
11387
11775
|
}
|
|
11388
|
-
if (
|
|
11389
|
-
|
|
11390
|
-
|
|
11776
|
+
if (placeHolders === 2) {
|
|
11777
|
+
tmp = revLookup[b64.charCodeAt(i)] << 2 | revLookup[b64.charCodeAt(i + 1)] >> 4;
|
|
11778
|
+
arr[L++] = tmp & 255;
|
|
11779
|
+
} else if (placeHolders === 1) {
|
|
11780
|
+
tmp = revLookup[b64.charCodeAt(i)] << 10 | revLookup[b64.charCodeAt(i + 1)] << 4 | revLookup[b64.charCodeAt(i + 2)] >> 2;
|
|
11781
|
+
arr[L++] = tmp >> 8 & 255;
|
|
11782
|
+
arr[L++] = tmp & 255;
|
|
11783
|
+
}
|
|
11784
|
+
return arr;
|
|
11785
|
+
}
|
|
11786
|
+
function tripletToBase64(num) {
|
|
11787
|
+
return lookup[num >> 18 & 63] + lookup[num >> 12 & 63] + lookup[num >> 6 & 63] + lookup[num & 63];
|
|
11788
|
+
}
|
|
11789
|
+
function encodeChunk(uint8, start, end) {
|
|
11790
|
+
var tmp;
|
|
11791
|
+
var output = [];
|
|
11792
|
+
for (var i = start; i < end; i += 3) {
|
|
11793
|
+
tmp = (uint8[i] << 16) + (uint8[i + 1] << 8) + uint8[i + 2];
|
|
11794
|
+
output.push(tripletToBase64(tmp));
|
|
11795
|
+
}
|
|
11796
|
+
return output.join("");
|
|
11797
|
+
}
|
|
11798
|
+
function fromByteArray(uint8) {
|
|
11799
|
+
if (!inited) {
|
|
11800
|
+
init();
|
|
11801
|
+
}
|
|
11802
|
+
var tmp;
|
|
11803
|
+
var len = uint8.length;
|
|
11804
|
+
var extraBytes = len % 3;
|
|
11805
|
+
var output = "";
|
|
11806
|
+
var parts = [];
|
|
11807
|
+
var maxChunkLength = 16383;
|
|
11808
|
+
for (var i = 0, len2 = len - extraBytes; i < len2; i += maxChunkLength) {
|
|
11809
|
+
parts.push(encodeChunk(uint8, i, i + maxChunkLength > len2 ? len2 : i + maxChunkLength));
|
|
11810
|
+
}
|
|
11811
|
+
if (extraBytes === 1) {
|
|
11812
|
+
tmp = uint8[len - 1];
|
|
11813
|
+
output += lookup[tmp >> 2];
|
|
11814
|
+
output += lookup[tmp << 4 & 63];
|
|
11815
|
+
output += "==";
|
|
11816
|
+
} else if (extraBytes === 2) {
|
|
11817
|
+
tmp = (uint8[len - 2] << 8) + uint8[len - 1];
|
|
11818
|
+
output += lookup[tmp >> 10];
|
|
11819
|
+
output += lookup[tmp >> 4 & 63];
|
|
11820
|
+
output += lookup[tmp << 2 & 63];
|
|
11821
|
+
output += "=";
|
|
11822
|
+
}
|
|
11823
|
+
parts.push(output);
|
|
11824
|
+
return parts.join("");
|
|
11825
|
+
}
|
|
11826
|
+
function read(buffer, offset, isLE, mLen, nBytes) {
|
|
11827
|
+
var e, m;
|
|
11828
|
+
var eLen = nBytes * 8 - mLen - 1;
|
|
11829
|
+
var eMax = (1 << eLen) - 1;
|
|
11830
|
+
var eBias = eMax >> 1;
|
|
11831
|
+
var nBits = -7;
|
|
11832
|
+
var i = isLE ? nBytes - 1 : 0;
|
|
11833
|
+
var d = isLE ? -1 : 1;
|
|
11834
|
+
var s = buffer[offset + i];
|
|
11835
|
+
i += d;
|
|
11836
|
+
e = s & (1 << -nBits) - 1;
|
|
11837
|
+
s >>= -nBits;
|
|
11838
|
+
nBits += eLen;
|
|
11839
|
+
for (; nBits > 0; e = e * 256 + buffer[offset + i], i += d, nBits -= 8) {
|
|
11840
|
+
}
|
|
11841
|
+
m = e & (1 << -nBits) - 1;
|
|
11842
|
+
e >>= -nBits;
|
|
11843
|
+
nBits += mLen;
|
|
11844
|
+
for (; nBits > 0; m = m * 256 + buffer[offset + i], i += d, nBits -= 8) {
|
|
11845
|
+
}
|
|
11846
|
+
if (e === 0) {
|
|
11847
|
+
e = 1 - eBias;
|
|
11848
|
+
} else if (e === eMax) {
|
|
11849
|
+
return m ? NaN : (s ? -1 : 1) * Infinity;
|
|
11391
11850
|
} else {
|
|
11392
|
-
|
|
11851
|
+
m = m + Math.pow(2, mLen);
|
|
11852
|
+
e = e - eBias;
|
|
11393
11853
|
}
|
|
11394
|
-
return
|
|
11854
|
+
return (s ? -1 : 1) * m * Math.pow(2, e - mLen);
|
|
11395
11855
|
}
|
|
11396
|
-
function
|
|
11397
|
-
|
|
11398
|
-
|
|
11399
|
-
|
|
11400
|
-
|
|
11401
|
-
|
|
11856
|
+
function write(buffer, value, offset, isLE, mLen, nBytes) {
|
|
11857
|
+
var e, m, c;
|
|
11858
|
+
var eLen = nBytes * 8 - mLen - 1;
|
|
11859
|
+
var eMax = (1 << eLen) - 1;
|
|
11860
|
+
var eBias = eMax >> 1;
|
|
11861
|
+
var rt = mLen === 23 ? Math.pow(2, -24) - Math.pow(2, -77) : 0;
|
|
11862
|
+
var i = isLE ? 0 : nBytes - 1;
|
|
11863
|
+
var d = isLE ? 1 : -1;
|
|
11864
|
+
var s = value < 0 || value === 0 && 1 / value < 0 ? 1 : 0;
|
|
11865
|
+
value = Math.abs(value);
|
|
11866
|
+
if (isNaN(value) || value === Infinity) {
|
|
11867
|
+
m = isNaN(value) ? 1 : 0;
|
|
11868
|
+
e = eMax;
|
|
11869
|
+
} else {
|
|
11870
|
+
e = Math.floor(Math.log(value) / Math.LN2);
|
|
11871
|
+
if (value * (c = Math.pow(2, -e)) < 1) {
|
|
11872
|
+
e--;
|
|
11873
|
+
c *= 2;
|
|
11402
11874
|
}
|
|
11403
|
-
|
|
11404
|
-
|
|
11405
|
-
|
|
11406
|
-
|
|
11407
|
-
if (typeof ArrayBuffer !== "undefined" && obj.buffer instanceof ArrayBuffer || "length" in obj) {
|
|
11408
|
-
if (typeof obj.length !== "number" || isnan(obj.length)) {
|
|
11409
|
-
return createBuffer(that, 0);
|
|
11410
|
-
}
|
|
11411
|
-
return fromArrayLike(that, obj);
|
|
11875
|
+
if (e + eBias >= 1) {
|
|
11876
|
+
value += rt / c;
|
|
11877
|
+
} else {
|
|
11878
|
+
value += rt * Math.pow(2, 1 - eBias);
|
|
11412
11879
|
}
|
|
11413
|
-
if (
|
|
11414
|
-
|
|
11880
|
+
if (value * c >= 2) {
|
|
11881
|
+
e++;
|
|
11882
|
+
c /= 2;
|
|
11883
|
+
}
|
|
11884
|
+
if (e + eBias >= eMax) {
|
|
11885
|
+
m = 0;
|
|
11886
|
+
e = eMax;
|
|
11887
|
+
} else if (e + eBias >= 1) {
|
|
11888
|
+
m = (value * c - 1) * Math.pow(2, mLen);
|
|
11889
|
+
e = e + eBias;
|
|
11890
|
+
} else {
|
|
11891
|
+
m = value * Math.pow(2, eBias - 1) * Math.pow(2, mLen);
|
|
11892
|
+
e = 0;
|
|
11415
11893
|
}
|
|
11416
11894
|
}
|
|
11417
|
-
|
|
11418
|
-
}
|
|
11419
|
-
function checked(length) {
|
|
11420
|
-
if (length >= kMaxLength()) {
|
|
11421
|
-
throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x" + kMaxLength().toString(16) + " bytes");
|
|
11895
|
+
for (; mLen >= 8; buffer[offset + i] = m & 255, i += d, m /= 256, mLen -= 8) {
|
|
11422
11896
|
}
|
|
11423
|
-
|
|
11897
|
+
e = e << mLen | m;
|
|
11898
|
+
eLen += mLen;
|
|
11899
|
+
for (; eLen > 0; buffer[offset + i] = e & 255, i += d, e /= 256, eLen -= 8) {
|
|
11900
|
+
}
|
|
11901
|
+
buffer[offset + i - d] |= s * 128;
|
|
11424
11902
|
}
|
|
11425
|
-
|
|
11426
|
-
function
|
|
11427
|
-
return
|
|
11903
|
+
var toString = {}.toString;
|
|
11904
|
+
var isArray2 = Array.isArray || function(arr) {
|
|
11905
|
+
return toString.call(arr) == "[object Array]";
|
|
11906
|
+
};
|
|
11907
|
+
var INSPECT_MAX_BYTES = 50;
|
|
11908
|
+
Buffer2.TYPED_ARRAY_SUPPORT = global$1.TYPED_ARRAY_SUPPORT !== void 0 ? global$1.TYPED_ARRAY_SUPPORT : true;
|
|
11909
|
+
function kMaxLength() {
|
|
11910
|
+
return Buffer2.TYPED_ARRAY_SUPPORT ? 2147483647 : 1073741823;
|
|
11428
11911
|
}
|
|
11429
|
-
|
|
11430
|
-
if (
|
|
11431
|
-
throw new
|
|
11912
|
+
function createBuffer(that, length) {
|
|
11913
|
+
if (kMaxLength() < length) {
|
|
11914
|
+
throw new RangeError("Invalid typed array length");
|
|
11432
11915
|
}
|
|
11433
|
-
if (
|
|
11434
|
-
|
|
11435
|
-
|
|
11436
|
-
|
|
11437
|
-
|
|
11438
|
-
|
|
11439
|
-
x = a[i];
|
|
11440
|
-
y = b[i];
|
|
11441
|
-
break;
|
|
11916
|
+
if (Buffer2.TYPED_ARRAY_SUPPORT) {
|
|
11917
|
+
that = new Uint8Array(length);
|
|
11918
|
+
that.__proto__ = Buffer2.prototype;
|
|
11919
|
+
} else {
|
|
11920
|
+
if (that === null) {
|
|
11921
|
+
that = new Buffer2(length);
|
|
11442
11922
|
}
|
|
11923
|
+
that.length = length;
|
|
11443
11924
|
}
|
|
11444
|
-
|
|
11445
|
-
|
|
11446
|
-
|
|
11447
|
-
|
|
11448
|
-
|
|
11449
|
-
|
|
11450
|
-
|
|
11451
|
-
|
|
11452
|
-
|
|
11453
|
-
|
|
11454
|
-
|
|
11455
|
-
|
|
11456
|
-
|
|
11457
|
-
case "binary":
|
|
11458
|
-
case "base64":
|
|
11459
|
-
case "ucs2":
|
|
11460
|
-
case "ucs-2":
|
|
11461
|
-
case "utf16le":
|
|
11462
|
-
case "utf-16le":
|
|
11463
|
-
return true;
|
|
11464
|
-
default:
|
|
11465
|
-
return false;
|
|
11925
|
+
return that;
|
|
11926
|
+
}
|
|
11927
|
+
function Buffer2(arg, encodingOrOffset, length) {
|
|
11928
|
+
if (!Buffer2.TYPED_ARRAY_SUPPORT && !(this instanceof Buffer2)) {
|
|
11929
|
+
return new Buffer2(arg, encodingOrOffset, length);
|
|
11930
|
+
}
|
|
11931
|
+
if (typeof arg === "number") {
|
|
11932
|
+
if (typeof encodingOrOffset === "string") {
|
|
11933
|
+
throw new Error(
|
|
11934
|
+
"If encoding is specified then the first argument must be a string"
|
|
11935
|
+
);
|
|
11936
|
+
}
|
|
11937
|
+
return allocUnsafe2(this, arg);
|
|
11466
11938
|
}
|
|
11939
|
+
return from(this, arg, encodingOrOffset, length);
|
|
11940
|
+
}
|
|
11941
|
+
Buffer2.poolSize = 8192;
|
|
11942
|
+
Buffer2._augment = function(arr) {
|
|
11943
|
+
arr.__proto__ = Buffer2.prototype;
|
|
11944
|
+
return arr;
|
|
11467
11945
|
};
|
|
11468
|
-
|
|
11469
|
-
if (
|
|
11470
|
-
throw new TypeError('"
|
|
11946
|
+
function from(that, value, encodingOrOffset, length) {
|
|
11947
|
+
if (typeof value === "number") {
|
|
11948
|
+
throw new TypeError('"value" argument must not be a number');
|
|
11471
11949
|
}
|
|
11472
|
-
if (
|
|
11473
|
-
return
|
|
11950
|
+
if (typeof ArrayBuffer !== "undefined" && value instanceof ArrayBuffer) {
|
|
11951
|
+
return fromArrayBuffer(that, value, encodingOrOffset, length);
|
|
11474
11952
|
}
|
|
11475
|
-
|
|
11476
|
-
|
|
11477
|
-
|
|
11478
|
-
|
|
11479
|
-
|
|
11480
|
-
|
|
11953
|
+
if (typeof value === "string") {
|
|
11954
|
+
return fromString(that, value, encodingOrOffset);
|
|
11955
|
+
}
|
|
11956
|
+
return fromObject(that, value);
|
|
11957
|
+
}
|
|
11958
|
+
Buffer2.from = function(value, encodingOrOffset, length) {
|
|
11959
|
+
return from(null, value, encodingOrOffset, length);
|
|
11960
|
+
};
|
|
11961
|
+
if (Buffer2.TYPED_ARRAY_SUPPORT) {
|
|
11962
|
+
Buffer2.prototype.__proto__ = Uint8Array.prototype;
|
|
11963
|
+
Buffer2.__proto__ = Uint8Array;
|
|
11964
|
+
}
|
|
11965
|
+
function assertSize(size) {
|
|
11966
|
+
if (typeof size !== "number") {
|
|
11967
|
+
throw new TypeError('"size" argument must be a number');
|
|
11968
|
+
} else if (size < 0) {
|
|
11969
|
+
throw new RangeError('"size" argument must not be negative');
|
|
11970
|
+
}
|
|
11971
|
+
}
|
|
11972
|
+
function alloc(that, size, fill, encoding) {
|
|
11973
|
+
assertSize(size);
|
|
11974
|
+
if (size <= 0) {
|
|
11975
|
+
return createBuffer(that, size);
|
|
11976
|
+
}
|
|
11977
|
+
if (fill !== void 0) {
|
|
11978
|
+
return typeof encoding === "string" ? createBuffer(that, size).fill(fill, encoding) : createBuffer(that, size).fill(fill);
|
|
11979
|
+
}
|
|
11980
|
+
return createBuffer(that, size);
|
|
11981
|
+
}
|
|
11982
|
+
Buffer2.alloc = function(size, fill, encoding) {
|
|
11983
|
+
return alloc(null, size, fill, encoding);
|
|
11984
|
+
};
|
|
11985
|
+
function allocUnsafe2(that, size) {
|
|
11986
|
+
assertSize(size);
|
|
11987
|
+
that = createBuffer(that, size < 0 ? 0 : checked(size) | 0);
|
|
11988
|
+
if (!Buffer2.TYPED_ARRAY_SUPPORT) {
|
|
11989
|
+
for (var i = 0; i < size; ++i) {
|
|
11990
|
+
that[i] = 0;
|
|
11991
|
+
}
|
|
11992
|
+
}
|
|
11993
|
+
return that;
|
|
11994
|
+
}
|
|
11995
|
+
Buffer2.allocUnsafe = function(size) {
|
|
11996
|
+
return allocUnsafe2(null, size);
|
|
11997
|
+
};
|
|
11998
|
+
Buffer2.allocUnsafeSlow = function(size) {
|
|
11999
|
+
return allocUnsafe2(null, size);
|
|
12000
|
+
};
|
|
12001
|
+
function fromString(that, string, encoding) {
|
|
12002
|
+
if (typeof encoding !== "string" || encoding === "") {
|
|
12003
|
+
encoding = "utf8";
|
|
12004
|
+
}
|
|
12005
|
+
if (!Buffer2.isEncoding(encoding)) {
|
|
12006
|
+
throw new TypeError('"encoding" must be a valid string encoding');
|
|
12007
|
+
}
|
|
12008
|
+
var length = byteLength(string, encoding) | 0;
|
|
12009
|
+
that = createBuffer(that, length);
|
|
12010
|
+
var actual = that.write(string, encoding);
|
|
12011
|
+
if (actual !== length) {
|
|
12012
|
+
that = that.slice(0, actual);
|
|
12013
|
+
}
|
|
12014
|
+
return that;
|
|
12015
|
+
}
|
|
12016
|
+
function fromArrayLike(that, array) {
|
|
12017
|
+
var length = array.length < 0 ? 0 : checked(array.length) | 0;
|
|
12018
|
+
that = createBuffer(that, length);
|
|
12019
|
+
for (var i = 0; i < length; i += 1) {
|
|
12020
|
+
that[i] = array[i] & 255;
|
|
12021
|
+
}
|
|
12022
|
+
return that;
|
|
12023
|
+
}
|
|
12024
|
+
function fromArrayBuffer(that, array, byteOffset, length) {
|
|
12025
|
+
array.byteLength;
|
|
12026
|
+
if (byteOffset < 0 || array.byteLength < byteOffset) {
|
|
12027
|
+
throw new RangeError("'offset' is out of bounds");
|
|
12028
|
+
}
|
|
12029
|
+
if (array.byteLength < byteOffset + (length || 0)) {
|
|
12030
|
+
throw new RangeError("'length' is out of bounds");
|
|
12031
|
+
}
|
|
12032
|
+
if (byteOffset === void 0 && length === void 0) {
|
|
12033
|
+
array = new Uint8Array(array);
|
|
12034
|
+
} else if (length === void 0) {
|
|
12035
|
+
array = new Uint8Array(array, byteOffset);
|
|
12036
|
+
} else {
|
|
12037
|
+
array = new Uint8Array(array, byteOffset, length);
|
|
12038
|
+
}
|
|
12039
|
+
if (Buffer2.TYPED_ARRAY_SUPPORT) {
|
|
12040
|
+
that = array;
|
|
12041
|
+
that.__proto__ = Buffer2.prototype;
|
|
12042
|
+
} else {
|
|
12043
|
+
that = fromArrayLike(that, array);
|
|
12044
|
+
}
|
|
12045
|
+
return that;
|
|
12046
|
+
}
|
|
12047
|
+
function fromObject(that, obj) {
|
|
12048
|
+
if (internalIsBuffer(obj)) {
|
|
12049
|
+
var len = checked(obj.length) | 0;
|
|
12050
|
+
that = createBuffer(that, len);
|
|
12051
|
+
if (that.length === 0) {
|
|
12052
|
+
return that;
|
|
12053
|
+
}
|
|
12054
|
+
obj.copy(that, 0, 0, len);
|
|
12055
|
+
return that;
|
|
12056
|
+
}
|
|
12057
|
+
if (obj) {
|
|
12058
|
+
if (typeof ArrayBuffer !== "undefined" && obj.buffer instanceof ArrayBuffer || "length" in obj) {
|
|
12059
|
+
if (typeof obj.length !== "number" || isnan(obj.length)) {
|
|
12060
|
+
return createBuffer(that, 0);
|
|
12061
|
+
}
|
|
12062
|
+
return fromArrayLike(that, obj);
|
|
12063
|
+
}
|
|
12064
|
+
if (obj.type === "Buffer" && isArray2(obj.data)) {
|
|
12065
|
+
return fromArrayLike(that, obj.data);
|
|
12066
|
+
}
|
|
12067
|
+
}
|
|
12068
|
+
throw new TypeError("First argument must be a string, Buffer, ArrayBuffer, Array, or array-like object.");
|
|
12069
|
+
}
|
|
12070
|
+
function checked(length) {
|
|
12071
|
+
if (length >= kMaxLength()) {
|
|
12072
|
+
throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x" + kMaxLength().toString(16) + " bytes");
|
|
12073
|
+
}
|
|
12074
|
+
return length | 0;
|
|
12075
|
+
}
|
|
12076
|
+
Buffer2.isBuffer = isBuffer2;
|
|
12077
|
+
function internalIsBuffer(b) {
|
|
12078
|
+
return !!(b != null && b._isBuffer);
|
|
12079
|
+
}
|
|
12080
|
+
Buffer2.compare = function compare2(a, b) {
|
|
12081
|
+
if (!internalIsBuffer(a) || !internalIsBuffer(b)) {
|
|
12082
|
+
throw new TypeError("Arguments must be Buffers");
|
|
12083
|
+
}
|
|
12084
|
+
if (a === b)
|
|
12085
|
+
return 0;
|
|
12086
|
+
var x = a.length;
|
|
12087
|
+
var y = b.length;
|
|
12088
|
+
for (var i = 0, len = Math.min(x, y); i < len; ++i) {
|
|
12089
|
+
if (a[i] !== b[i]) {
|
|
12090
|
+
x = a[i];
|
|
12091
|
+
y = b[i];
|
|
12092
|
+
break;
|
|
12093
|
+
}
|
|
12094
|
+
}
|
|
12095
|
+
if (x < y)
|
|
12096
|
+
return -1;
|
|
12097
|
+
if (y < x)
|
|
12098
|
+
return 1;
|
|
12099
|
+
return 0;
|
|
12100
|
+
};
|
|
12101
|
+
Buffer2.isEncoding = function isEncoding(encoding) {
|
|
12102
|
+
switch (String(encoding).toLowerCase()) {
|
|
12103
|
+
case "hex":
|
|
12104
|
+
case "utf8":
|
|
12105
|
+
case "utf-8":
|
|
12106
|
+
case "ascii":
|
|
12107
|
+
case "latin1":
|
|
12108
|
+
case "binary":
|
|
12109
|
+
case "base64":
|
|
12110
|
+
case "ucs2":
|
|
12111
|
+
case "ucs-2":
|
|
12112
|
+
case "utf16le":
|
|
12113
|
+
case "utf-16le":
|
|
12114
|
+
return true;
|
|
12115
|
+
default:
|
|
12116
|
+
return false;
|
|
12117
|
+
}
|
|
12118
|
+
};
|
|
12119
|
+
Buffer2.concat = function concat(list, length) {
|
|
12120
|
+
if (!isArray2(list)) {
|
|
12121
|
+
throw new TypeError('"list" argument must be an Array of Buffers');
|
|
12122
|
+
}
|
|
12123
|
+
if (list.length === 0) {
|
|
12124
|
+
return Buffer2.alloc(0);
|
|
12125
|
+
}
|
|
12126
|
+
var i;
|
|
12127
|
+
if (length === void 0) {
|
|
12128
|
+
length = 0;
|
|
12129
|
+
for (i = 0; i < list.length; ++i) {
|
|
12130
|
+
length += list[i].length;
|
|
12131
|
+
}
|
|
11481
12132
|
}
|
|
11482
12133
|
var buffer = Buffer2.allocUnsafe(length);
|
|
11483
12134
|
var pos = 0;
|
|
@@ -16038,942 +16689,203 @@ var json2csv_umd = { exports: {} };
|
|
|
16038
16689
|
processedData.forEach(function(row) {
|
|
16039
16690
|
var line = _this2.processRow(row, _this2.opts);
|
|
16040
16691
|
if (line === void 0)
|
|
16041
|
-
return;
|
|
16042
|
-
_this2.emit("line", line);
|
|
16043
|
-
_this2.push(_this2._hasWritten ? _this2.opts.eol + line : line);
|
|
16044
|
-
_this2._hasWritten = true;
|
|
16045
|
-
});
|
|
16046
|
-
}
|
|
16047
|
-
}]);
|
|
16048
|
-
return JSON2CSVTransform2;
|
|
16049
|
-
}(Transform$1);
|
|
16050
|
-
var JSON2CSVTransform_1 = JSON2CSVTransform;
|
|
16051
|
-
var Transform$2 = Stream.Transform;
|
|
16052
|
-
var fastJoin$3 = utils.fastJoin;
|
|
16053
|
-
var JSON2CSVAsyncParser = /* @__PURE__ */ function() {
|
|
16054
|
-
function JSON2CSVAsyncParser2(opts2, transformOpts) {
|
|
16055
|
-
_classCallCheck(this, JSON2CSVAsyncParser2);
|
|
16056
|
-
this.input = new Transform$2(transformOpts);
|
|
16057
|
-
this.input._read = function() {
|
|
16058
|
-
};
|
|
16059
|
-
this.transform = new JSON2CSVTransform_1(opts2, transformOpts);
|
|
16060
|
-
this.processor = this.input.pipe(this.transform);
|
|
16061
|
-
}
|
|
16062
|
-
_createClass(JSON2CSVAsyncParser2, [{
|
|
16063
|
-
key: "fromInput",
|
|
16064
|
-
value: function fromInput(input) {
|
|
16065
|
-
if (this._input) {
|
|
16066
|
-
throw new Error("Async parser already has an input.");
|
|
16067
|
-
}
|
|
16068
|
-
this._input = input;
|
|
16069
|
-
this.input = this._input.pipe(this.processor);
|
|
16070
|
-
return this;
|
|
16071
|
-
}
|
|
16072
|
-
}, {
|
|
16073
|
-
key: "throughTransform",
|
|
16074
|
-
value: function throughTransform(transform) {
|
|
16075
|
-
if (this._output) {
|
|
16076
|
-
throw new Error("Can't add transforms once an output has been added.");
|
|
16077
|
-
}
|
|
16078
|
-
this.processor = this.processor.pipe(transform);
|
|
16079
|
-
return this;
|
|
16080
|
-
}
|
|
16081
|
-
}, {
|
|
16082
|
-
key: "toOutput",
|
|
16083
|
-
value: function toOutput(output) {
|
|
16084
|
-
if (this._output) {
|
|
16085
|
-
throw new Error("Async parser already has an output.");
|
|
16086
|
-
}
|
|
16087
|
-
this._output = output;
|
|
16088
|
-
this.processor = this.processor.pipe(output);
|
|
16089
|
-
return this;
|
|
16090
|
-
}
|
|
16091
|
-
}, {
|
|
16092
|
-
key: "promise",
|
|
16093
|
-
value: function promise() {
|
|
16094
|
-
var _this = this;
|
|
16095
|
-
var returnCSV = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : true;
|
|
16096
|
-
return new Promise(function(resolve, reject) {
|
|
16097
|
-
if (!returnCSV) {
|
|
16098
|
-
_this.processor.on("finish", function() {
|
|
16099
|
-
return resolve();
|
|
16100
|
-
}).on("error", function(err) {
|
|
16101
|
-
return reject(err);
|
|
16102
|
-
});
|
|
16103
|
-
return;
|
|
16104
|
-
}
|
|
16105
|
-
var csvBuffer = [];
|
|
16106
|
-
_this.processor.on("data", function(chunk) {
|
|
16107
|
-
return csvBuffer.push(chunk.toString());
|
|
16108
|
-
}).on("finish", function() {
|
|
16109
|
-
return resolve(fastJoin$3(csvBuffer, ""));
|
|
16110
|
-
}).on("error", function(err) {
|
|
16111
|
-
return reject(err);
|
|
16112
|
-
});
|
|
16113
|
-
});
|
|
16114
|
-
}
|
|
16115
|
-
}]);
|
|
16116
|
-
return JSON2CSVAsyncParser2;
|
|
16117
|
-
}();
|
|
16118
|
-
var JSON2CSVAsyncParser_1 = JSON2CSVAsyncParser;
|
|
16119
|
-
function flatten() {
|
|
16120
|
-
var _ref = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : {}, _ref$objects = _ref.objects, objects = _ref$objects === void 0 ? true : _ref$objects, _ref$arrays = _ref.arrays, arrays = _ref$arrays === void 0 ? false : _ref$arrays, _ref$separator = _ref.separator, separator = _ref$separator === void 0 ? "." : _ref$separator;
|
|
16121
|
-
function step(obj, flatDataRow, currentPath) {
|
|
16122
|
-
Object.keys(obj).forEach(function(key) {
|
|
16123
|
-
var newPath = currentPath ? "".concat(currentPath).concat(separator).concat(key) : key;
|
|
16124
|
-
var value = obj[key];
|
|
16125
|
-
if (objects && _typeof(value) === "object" && value !== null && !Array.isArray(value) && Object.prototype.toString.call(value.toJSON) !== "[object Function]" && Object.keys(value).length) {
|
|
16126
|
-
step(value, flatDataRow, newPath);
|
|
16127
|
-
return;
|
|
16128
|
-
}
|
|
16129
|
-
if (arrays && Array.isArray(value)) {
|
|
16130
|
-
step(value, flatDataRow, newPath);
|
|
16131
|
-
return;
|
|
16132
|
-
}
|
|
16133
|
-
flatDataRow[newPath] = value;
|
|
16134
|
-
});
|
|
16135
|
-
return flatDataRow;
|
|
16136
|
-
}
|
|
16137
|
-
return function(dataRow) {
|
|
16138
|
-
return step(dataRow, {});
|
|
16139
|
-
};
|
|
16140
|
-
}
|
|
16141
|
-
var flatten_1 = flatten;
|
|
16142
|
-
var setProp$1 = utils.setProp, unsetProp$1 = utils.unsetProp, flattenReducer$3 = utils.flattenReducer;
|
|
16143
|
-
function getUnwindablePaths(obj, currentPath) {
|
|
16144
|
-
return Object.keys(obj).reduce(function(unwindablePaths, key) {
|
|
16145
|
-
var newPath = currentPath ? "".concat(currentPath, ".").concat(key) : key;
|
|
16146
|
-
var value = obj[key];
|
|
16147
|
-
if (_typeof(value) === "object" && value !== null && !Array.isArray(value) && Object.prototype.toString.call(value.toJSON) !== "[object Function]" && Object.keys(value).length) {
|
|
16148
|
-
unwindablePaths = unwindablePaths.concat(getUnwindablePaths(value, newPath));
|
|
16149
|
-
} else if (Array.isArray(value)) {
|
|
16150
|
-
unwindablePaths.push(newPath);
|
|
16151
|
-
unwindablePaths = unwindablePaths.concat(value.map(function(arrObj) {
|
|
16152
|
-
return getUnwindablePaths(arrObj, newPath);
|
|
16153
|
-
}).reduce(flattenReducer$3, []).filter(function(item, index, arr) {
|
|
16154
|
-
return arr.indexOf(item) !== index;
|
|
16155
|
-
}));
|
|
16156
|
-
}
|
|
16157
|
-
return unwindablePaths;
|
|
16158
|
-
}, []);
|
|
16159
|
-
}
|
|
16160
|
-
function unwind() {
|
|
16161
|
-
var _ref = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : {}, _ref$paths = _ref.paths, paths = _ref$paths === void 0 ? void 0 : _ref$paths, _ref$blankOut = _ref.blankOut, blankOut = _ref$blankOut === void 0 ? false : _ref$blankOut;
|
|
16162
|
-
function unwindReducer(rows, unwindPath) {
|
|
16163
|
-
return rows.map(function(row) {
|
|
16164
|
-
var unwindArray = lodash_get(row, unwindPath);
|
|
16165
|
-
if (!Array.isArray(unwindArray)) {
|
|
16166
|
-
return row;
|
|
16167
|
-
}
|
|
16168
|
-
if (!unwindArray.length) {
|
|
16169
|
-
return unsetProp$1(row, unwindPath);
|
|
16170
|
-
}
|
|
16171
|
-
return unwindArray.map(function(unwindRow, index) {
|
|
16172
|
-
var clonedRow = blankOut && index > 0 ? {} : row;
|
|
16173
|
-
return setProp$1(clonedRow, unwindPath, unwindRow);
|
|
16174
|
-
});
|
|
16175
|
-
}).reduce(flattenReducer$3, []);
|
|
16176
|
-
}
|
|
16177
|
-
paths = Array.isArray(paths) ? paths : paths ? [paths] : void 0;
|
|
16178
|
-
return function(dataRow) {
|
|
16179
|
-
return (paths || getUnwindablePaths(dataRow)).reduce(unwindReducer, [dataRow]);
|
|
16180
|
-
};
|
|
16181
|
-
}
|
|
16182
|
-
var unwind_1 = unwind;
|
|
16183
|
-
var Readable$1 = Stream.Readable;
|
|
16184
|
-
var Parser$1 = JSON2CSVParser_1;
|
|
16185
|
-
var AsyncParser = JSON2CSVAsyncParser_1;
|
|
16186
|
-
var Transform$3 = JSON2CSVTransform_1;
|
|
16187
|
-
var parse2 = function parse3(data, opts2) {
|
|
16188
|
-
return new JSON2CSVParser_1(opts2).parse(data);
|
|
16189
|
-
};
|
|
16190
|
-
var parseAsync = function parseAsync2(data, opts2, transformOpts) {
|
|
16191
|
-
try {
|
|
16192
|
-
if (!(data instanceof Readable$1)) {
|
|
16193
|
-
transformOpts = Object.assign({}, transformOpts, {
|
|
16194
|
-
objectMode: true
|
|
16195
|
-
});
|
|
16196
|
-
}
|
|
16197
|
-
var asyncParser = new JSON2CSVAsyncParser_1(opts2, transformOpts);
|
|
16198
|
-
var promise = asyncParser.promise();
|
|
16199
|
-
if (Array.isArray(data)) {
|
|
16200
|
-
data.forEach(function(item) {
|
|
16201
|
-
return asyncParser.input.push(item);
|
|
16202
|
-
});
|
|
16203
|
-
asyncParser.input.push(null);
|
|
16204
|
-
} else if (data instanceof Readable$1) {
|
|
16205
|
-
asyncParser.fromInput(data);
|
|
16206
|
-
} else {
|
|
16207
|
-
asyncParser.input.push(data);
|
|
16208
|
-
asyncParser.input.push(null);
|
|
16209
|
-
}
|
|
16210
|
-
return promise;
|
|
16211
|
-
} catch (err) {
|
|
16212
|
-
return Promise.reject(err);
|
|
16213
|
-
}
|
|
16214
|
-
};
|
|
16215
|
-
var transforms = {
|
|
16216
|
-
flatten: flatten_1,
|
|
16217
|
-
unwind: unwind_1
|
|
16218
|
-
};
|
|
16219
|
-
var json2csv = {
|
|
16220
|
-
Parser: Parser$1,
|
|
16221
|
-
AsyncParser,
|
|
16222
|
-
Transform: Transform$3,
|
|
16223
|
-
parse: parse2,
|
|
16224
|
-
parseAsync,
|
|
16225
|
-
transforms
|
|
16226
|
-
};
|
|
16227
|
-
exports3.AsyncParser = AsyncParser;
|
|
16228
|
-
exports3.Parser = Parser$1;
|
|
16229
|
-
exports3.Transform = Transform$3;
|
|
16230
|
-
exports3.default = json2csv;
|
|
16231
|
-
exports3.parse = parse2;
|
|
16232
|
-
exports3.parseAsync = parseAsync;
|
|
16233
|
-
exports3.transforms = transforms;
|
|
16234
|
-
Object.defineProperty(exports3, "__esModule", { value: true });
|
|
16235
|
-
});
|
|
16236
|
-
})(json2csv_umd, json2csv_umd.exports);
|
|
16237
|
-
var json2csv_umdExports = json2csv_umd.exports;
|
|
16238
|
-
class InternMap extends Map {
|
|
16239
|
-
constructor(entries, key = keyof) {
|
|
16240
|
-
super();
|
|
16241
|
-
Object.defineProperties(this, { _intern: { value: /* @__PURE__ */ new Map() }, _key: { value: key } });
|
|
16242
|
-
if (entries != null)
|
|
16243
|
-
for (const [key2, value] of entries)
|
|
16244
|
-
this.set(key2, value);
|
|
16245
|
-
}
|
|
16246
|
-
get(key) {
|
|
16247
|
-
return super.get(intern_get(this, key));
|
|
16248
|
-
}
|
|
16249
|
-
has(key) {
|
|
16250
|
-
return super.has(intern_get(this, key));
|
|
16251
|
-
}
|
|
16252
|
-
set(key, value) {
|
|
16253
|
-
return super.set(intern_set(this, key), value);
|
|
16254
|
-
}
|
|
16255
|
-
delete(key) {
|
|
16256
|
-
return super.delete(intern_delete(this, key));
|
|
16257
|
-
}
|
|
16258
|
-
}
|
|
16259
|
-
function intern_get({ _intern, _key }, value) {
|
|
16260
|
-
const key = _key(value);
|
|
16261
|
-
return _intern.has(key) ? _intern.get(key) : value;
|
|
16262
|
-
}
|
|
16263
|
-
function intern_set({ _intern, _key }, value) {
|
|
16264
|
-
const key = _key(value);
|
|
16265
|
-
if (_intern.has(key))
|
|
16266
|
-
return _intern.get(key);
|
|
16267
|
-
_intern.set(key, value);
|
|
16268
|
-
return value;
|
|
16269
|
-
}
|
|
16270
|
-
function intern_delete({ _intern, _key }, value) {
|
|
16271
|
-
const key = _key(value);
|
|
16272
|
-
if (_intern.has(key)) {
|
|
16273
|
-
value = _intern.get(key);
|
|
16274
|
-
_intern.delete(key);
|
|
16275
|
-
}
|
|
16276
|
-
return value;
|
|
16277
|
-
}
|
|
16278
|
-
function keyof(value) {
|
|
16279
|
-
return value !== null && typeof value === "object" ? value.valueOf() : value;
|
|
16280
|
-
}
|
|
16281
|
-
const schemeRdBu = [[103, 0, 31], [178, 24, 43], [214, 96, 77], [244, 165, 130], [253, 219, 199], [247, 247, 247], [209, 229, 240], [146, 197, 222], [67, 147, 195], [33, 102, 172], [5, 48, 97]];
|
|
16282
|
-
const schemePlasma = [[13, 8, 135], [16, 7, 136], [19, 7, 137], [22, 7, 138], [25, 6, 140], [27, 6, 141], [29, 6, 142], [32, 6, 143], [34, 6, 144], [36, 6, 145], [38, 5, 145], [40, 5, 146], [42, 5, 147], [44, 5, 148], [46, 5, 149], [47, 5, 150], [49, 5, 151], [51, 5, 151], [53, 4, 152], [55, 4, 153], [56, 4, 154], [58, 4, 154], [60, 4, 155], [62, 4, 156], [63, 4, 156], [65, 4, 157], [67, 3, 158], [68, 3, 158], [70, 3, 159], [72, 3, 159], [73, 3, 160], [75, 3, 161], [76, 2, 161], [78, 2, 162], [80, 2, 162], [81, 2, 163], [83, 2, 163], [85, 2, 164], [86, 1, 164], [88, 1, 164], [89, 1, 165], [91, 1, 165], [92, 1, 166], [94, 1, 166], [96, 1, 166], [97, 0, 167], [99, 0, 167], [100, 0, 167], [102, 0, 167], [103, 0, 168], [105, 0, 168], [106, 0, 168], [108, 0, 168], [110, 0, 168], [111, 0, 168], [113, 0, 168], [114, 1, 168], [116, 1, 168], [117, 1, 168], [119, 1, 168], [120, 1, 168], [122, 2, 168], [123, 2, 168], [125, 3, 168], [126, 3, 168], [128, 4, 168], [129, 4, 167], [131, 5, 167], [132, 5, 167], [134, 6, 166], [135, 7, 166], [136, 8, 166], [138, 9, 165], [139, 10, 165], [141, 11, 165], [142, 12, 164], [143, 13, 164], [145, 14, 163], [146, 15, 163], [148, 16, 162], [149, 17, 161], [150, 19, 161], [152, 20, 160], [153, 21, 159], [154, 22, 159], [156, 23, 158], [157, 24, 157], [158, 25, 157], [160, 26, 156], [161, 27, 155], [162, 29, 154], [163, 30, 154], [165, 31, 153], [166, 32, 152], [167, 33, 151], [168, 34, 150], [170, 35, 149], [171, 36, 148], [172, 38, 148], [173, 39, 147], [174, 40, 146], [176, 41, 145], [177, 42, 144], [178, 43, 143], [179, 44, 142], [180, 46, 141], [181, 47, 140], [182, 48, 139], [183, 49, 138], [184, 50, 137], [186, 51, 136], [187, 52, 136], [188, 53, 135], [189, 55, 134], [190, 56, 133], [191, 57, 132], [192, 58, 131], [193, 59, 130], [194, 60, 129], [195, 61, 128], [196, 62, 127], [197, 64, 126], [198, 65, 125], [199, 66, 124], [200, 67, 123], [201, 68, 122], [202, 69, 122], [203, 70, 121], [204, 71, 120], [204, 73, 119], [205, 74, 118], [206, 75, 117], [207, 76, 116], [208, 77, 115], [209, 78, 114], [210, 79, 113], [211, 81, 113], [212, 82, 112], [213, 83, 111], [213, 84, 110], [214, 85, 109], [215, 86, 108], [216, 87, 107], [217, 88, 106], [218, 90, 106], [218, 91, 105], [219, 92, 104], [220, 93, 103], [221, 94, 102], [222, 95, 101], [222, 97, 100], [223, 98, 99], [224, 99, 99], [225, 100, 98], [226, 101, 97], [226, 102, 96], [227, 104, 95], [228, 105, 94], [229, 106, 93], [229, 107, 93], [230, 108, 92], [231, 110, 91], [231, 111, 90], [232, 112, 89], [233, 113, 88], [233, 114, 87], [234, 116, 87], [235, 117, 86], [235, 118, 85], [236, 119, 84], [237, 121, 83], [237, 122, 82], [238, 123, 81], [239, 124, 81], [239, 126, 80], [240, 127, 79], [240, 128, 78], [241, 129, 77], [241, 131, 76], [242, 132, 75], [243, 133, 75], [243, 135, 74], [244, 136, 73], [244, 137, 72], [245, 139, 71], [245, 140, 70], [246, 141, 69], [246, 143, 68], [247, 144, 68], [247, 145, 67], [247, 147, 66], [248, 148, 65], [248, 149, 64], [249, 151, 63], [249, 152, 62], [249, 154, 62], [250, 155, 61], [250, 156, 60], [250, 158, 59], [251, 159, 58], [251, 161, 57], [251, 162, 56], [252, 163, 56], [252, 165, 55], [252, 166, 54], [252, 168, 53], [252, 169, 52], [253, 171, 51], [253, 172, 51], [253, 174, 50], [253, 175, 49], [253, 177, 48], [253, 178, 47], [253, 180, 47], [253, 181, 46], [254, 183, 45], [254, 184, 44], [254, 186, 44], [254, 187, 43], [254, 189, 42], [254, 190, 42], [254, 192, 41], [253, 194, 41], [253, 195, 40], [253, 197, 39], [253, 198, 39], [253, 200, 39], [253, 202, 38], [253, 203, 38], [252, 205, 37], [252, 206, 37], [252, 208, 37], [252, 210, 37], [251, 211, 36], [251, 213, 36], [251, 215, 36], [250, 216, 36], [250, 218, 36], [249, 220, 36], [249, 221, 37], [248, 223, 37], [248, 225, 37], [247, 226, 37], [247, 228, 37], [246, 230, 38], [246, 232, 38], [245, 233, 38], [245, 235, 39], [244, 237, 39], [243, 238, 39], [243, 240, 39], [242, 242, 39], [241, 244, 38], [241, 245, 37], [240, 247, 36], [240, 249, 33]];
|
|
16283
|
-
function rgbSpline(spline) {
|
|
16284
|
-
return (colors) => {
|
|
16285
|
-
const n = colors.length;
|
|
16286
|
-
const r = new Array(n);
|
|
16287
|
-
const g = new Array(n);
|
|
16288
|
-
const b = new Array(n);
|
|
16289
|
-
let i;
|
|
16290
|
-
let color;
|
|
16291
|
-
for (i = 0; i < n; ++i) {
|
|
16292
|
-
color = [colors[i][0], colors[i][1], colors[i][2]];
|
|
16293
|
-
r[i] = color[0] || 0;
|
|
16294
|
-
g[i] = color[1] || 0;
|
|
16295
|
-
b[i] = color[2] || 0;
|
|
16296
|
-
}
|
|
16297
|
-
const rFunc = spline(r);
|
|
16298
|
-
const gFunc = spline(g);
|
|
16299
|
-
const bFunc = spline(b);
|
|
16300
|
-
return (t2) => [rFunc(t2), gFunc(t2), bFunc(t2)];
|
|
16301
|
-
};
|
|
16302
|
-
}
|
|
16303
|
-
function basis(values) {
|
|
16304
|
-
function innerBasis(t1, v0, v1, v2, v3) {
|
|
16305
|
-
const t2 = t1 * t1;
|
|
16306
|
-
const t3 = t2 * t1;
|
|
16307
|
-
return ((1 - 3 * t1 + 3 * t2 - t3) * v0 + (4 - 6 * t2 + 3 * t3) * v1 + (1 + 3 * t1 + 3 * t2 - 3 * t3) * v2 + t3 * v3) / 6;
|
|
16308
|
-
}
|
|
16309
|
-
const n = values.length - 1;
|
|
16310
|
-
return (t2) => {
|
|
16311
|
-
const i = t2 <= 0 ? t2 = 0 : t2 >= 1 ? (t2 = 1, n - 1) : Math.floor(t2 * n);
|
|
16312
|
-
const v1 = values[i];
|
|
16313
|
-
const v2 = values[i + 1];
|
|
16314
|
-
const v0 = i > 0 ? values[i - 1] : 2 * v1 - v2;
|
|
16315
|
-
const v3 = i < n - 1 ? values[i + 2] : 2 * v2 - v1;
|
|
16316
|
-
return innerBasis((t2 - i / n) * n, v0, v1, v2, v3);
|
|
16317
|
-
};
|
|
16318
|
-
}
|
|
16319
|
-
const interpolateRgbBasis = rgbSpline(basis);
|
|
16320
|
-
function interpolateSequentialMulti(range2) {
|
|
16321
|
-
const n = range2.length;
|
|
16322
|
-
return (t2) => range2[Math.max(0, Math.min(n - 1, Math.floor(t2 * n)))];
|
|
16323
|
-
}
|
|
16324
|
-
interpolateRgbBasis(schemeRdBu);
|
|
16325
|
-
interpolateSequentialMulti(schemePlasma);
|
|
16326
|
-
const FILE_EXTENSION_JSON = "json";
|
|
16327
|
-
const MIME_TYPE_JSON = "application/json";
|
|
16328
|
-
const FILE_EXTENSION_TABULAR = "csv";
|
|
16329
|
-
const MIME_TYPE_TABULAR = "text/csv";
|
|
16330
|
-
const SEPARATOR_TABULAR = ",";
|
|
16331
|
-
const NA_VALUE_TABULAR = "NA";
|
|
16332
|
-
const SETS_DATATYPE_OBS = "obs";
|
|
16333
|
-
const HIERARCHICAL_SCHEMAS = {
|
|
16334
|
-
latestVersion: "0.1.3",
|
|
16335
|
-
schema: obsSetsSchema
|
|
16336
|
-
};
|
|
16337
|
-
const TABULAR_SCHEMAS = {
|
|
16338
|
-
schema: obsSetsTabularSchema
|
|
16339
|
-
};
|
|
16340
|
-
function callbackOnKeyPress(event, key, callback) {
|
|
16341
|
-
if (event.key === key) {
|
|
16342
|
-
event.preventDefault();
|
|
16343
|
-
callback();
|
|
16344
|
-
}
|
|
16345
|
-
}
|
|
16346
|
-
function colorArrayToString(rgbArray2) {
|
|
16347
|
-
return tinycolor({ r: rgbArray2[0], g: rgbArray2[1], b: rgbArray2[2] }).toHexString();
|
|
16348
|
-
}
|
|
16349
|
-
function colorStringToArray(colorString) {
|
|
16350
|
-
const colorObj = tinycolor(colorString).toRgb();
|
|
16351
|
-
return [colorObj.r, colorObj.g, colorObj.b];
|
|
16352
|
-
}
|
|
16353
|
-
function getLevelTooltipText(i) {
|
|
16354
|
-
if (i === 0)
|
|
16355
|
-
return "Color by hierarchy";
|
|
16356
|
-
if (i <= 2) {
|
|
16357
|
-
const subs = (j) => "sub".repeat(j);
|
|
16358
|
-
return `Color by ${subs(i - 1)}cluster`;
|
|
16359
|
-
}
|
|
16360
|
-
return `Color by cluster level ${i}`;
|
|
16361
|
-
}
|
|
16362
|
-
function isEqualOrPrefix(targetPath, testPath) {
|
|
16363
|
-
if (targetPath.length <= testPath.length) {
|
|
16364
|
-
return isEqual(targetPath, testPath.slice(0, targetPath.length));
|
|
16365
|
-
}
|
|
16366
|
-
return false;
|
|
16367
|
-
}
|
|
16368
|
-
function tryRenamePath(targetPath, testPath, nextTargetPath) {
|
|
16369
|
-
if (isEqualOrPrefix(targetPath, testPath)) {
|
|
16370
|
-
return [...nextTargetPath, ...testPath.slice(nextTargetPath.length)];
|
|
16371
|
-
}
|
|
16372
|
-
return testPath;
|
|
16373
|
-
}
|
|
16374
|
-
const PATH_SEP = "___";
|
|
16375
|
-
function pathToKey(path) {
|
|
16376
|
-
return path.join(PATH_SEP);
|
|
16377
|
-
}
|
|
16378
|
-
function getNextNumberedNodeName(nodes, prefix, suffix) {
|
|
16379
|
-
let i = 1;
|
|
16380
|
-
if (nodes) {
|
|
16381
|
-
while (nodes.find((n) => n.name.includes(`${prefix}${i}`))) {
|
|
16382
|
-
i++;
|
|
16383
|
-
}
|
|
16384
|
-
}
|
|
16385
|
-
return `${prefix}${i}${suffix}`;
|
|
16386
|
-
}
|
|
16387
|
-
function setObsSelection(cellSelection, additionalCellSets, cellSetColor, setCellSetSelection, setAdditionalCellSets, setCellSetColor, setCellColorEncoding, prefix = "Selection ", suffix = "") {
|
|
16388
|
-
const CELL_SELECTIONS_LEVEL_ZERO_NAME = "My Selections";
|
|
16389
|
-
const selectionsLevelZeroNode = additionalCellSets == null ? void 0 : additionalCellSets.tree.find(
|
|
16390
|
-
(n) => n.name === CELL_SELECTIONS_LEVEL_ZERO_NAME
|
|
16391
|
-
);
|
|
16392
|
-
const nextAdditionalCellSets = {
|
|
16393
|
-
version: HIERARCHICAL_SCHEMAS.latestVersion,
|
|
16394
|
-
datatype: SETS_DATATYPE_OBS,
|
|
16395
|
-
tree: [...additionalCellSets ? additionalCellSets.tree : []]
|
|
16396
|
-
};
|
|
16397
|
-
const nextName = getNextNumberedNodeName(selectionsLevelZeroNode == null ? void 0 : selectionsLevelZeroNode.children, prefix, suffix);
|
|
16398
|
-
let colorIndex = 0;
|
|
16399
|
-
if (selectionsLevelZeroNode) {
|
|
16400
|
-
colorIndex = selectionsLevelZeroNode.children.length;
|
|
16401
|
-
selectionsLevelZeroNode.children.push({
|
|
16402
|
-
name: nextName,
|
|
16403
|
-
set: cellSelection.map((d) => [d, null])
|
|
16404
|
-
});
|
|
16405
|
-
} else {
|
|
16406
|
-
nextAdditionalCellSets.tree.push({
|
|
16407
|
-
name: CELL_SELECTIONS_LEVEL_ZERO_NAME,
|
|
16408
|
-
children: [
|
|
16409
|
-
{
|
|
16410
|
-
name: nextName,
|
|
16411
|
-
set: cellSelection.map((d) => [d, null])
|
|
16412
|
-
}
|
|
16413
|
-
]
|
|
16414
|
-
});
|
|
16415
|
-
}
|
|
16416
|
-
setAdditionalCellSets(nextAdditionalCellSets);
|
|
16417
|
-
const nextPath = ["My Selections", nextName];
|
|
16418
|
-
setCellSetColor([
|
|
16419
|
-
...cellSetColor || [],
|
|
16420
|
-
{
|
|
16421
|
-
path: nextPath,
|
|
16422
|
-
color: PALETTE[colorIndex % PALETTE.length]
|
|
16423
|
-
}
|
|
16424
|
-
]);
|
|
16425
|
-
setCellSetSelection([nextPath]);
|
|
16426
|
-
setCellColorEncoding("cellSetSelection");
|
|
16427
|
-
}
|
|
16428
|
-
function mergeObsSets(cellSets, additionalCellSets) {
|
|
16429
|
-
return {
|
|
16430
|
-
version: HIERARCHICAL_SCHEMAS.latestVersion,
|
|
16431
|
-
datatype: SETS_DATATYPE_OBS,
|
|
16432
|
-
tree: [
|
|
16433
|
-
...cellSets ? cellSets.tree : [],
|
|
16434
|
-
...additionalCellSets ? additionalCellSets.tree : []
|
|
16435
|
-
]
|
|
16436
|
-
};
|
|
16437
|
-
}
|
|
16438
|
-
function getObsInfoFromDataWithinRange(range2, data) {
|
|
16439
|
-
const [lowerBound, upperBound] = range2;
|
|
16440
|
-
const cellIds = data.filter((item) => item.value >= lowerBound && item.value <= upperBound).map((item) => item.cellId);
|
|
16441
|
-
return cellIds;
|
|
16442
|
-
}
|
|
16443
|
-
function generateKey() {
|
|
16444
|
-
return v4();
|
|
16445
|
-
}
|
|
16446
|
-
function nodeToSet(currNode) {
|
|
16447
|
-
if (!currNode) {
|
|
16448
|
-
return [];
|
|
16449
|
-
}
|
|
16450
|
-
if (!currNode.children) {
|
|
16451
|
-
return currNode.set || [];
|
|
16452
|
-
}
|
|
16453
|
-
return currNode.children.flatMap((c) => nodeToSet(c));
|
|
16454
|
-
}
|
|
16455
|
-
function nodeToHeight(currNode, level = 0) {
|
|
16456
|
-
if (!currNode.children) {
|
|
16457
|
-
return level;
|
|
16458
|
-
}
|
|
16459
|
-
const newLevel = level + 1;
|
|
16460
|
-
const childrenHeights = currNode.children.map((c) => nodeToHeight(c, newLevel));
|
|
16461
|
-
return Math.max(...childrenHeights, newLevel);
|
|
16462
|
-
}
|
|
16463
|
-
function getNodeLength(currNode) {
|
|
16464
|
-
var _a;
|
|
16465
|
-
if (!currNode) {
|
|
16466
|
-
return 0;
|
|
16467
|
-
}
|
|
16468
|
-
if (!currNode.children) {
|
|
16469
|
-
return ((_a = currNode.set) == null ? void 0 : _a.length) || 0;
|
|
16470
|
-
}
|
|
16471
|
-
return currNode.children.reduce((acc, curr) => acc + getNodeLength(curr), 0);
|
|
16472
|
-
}
|
|
16473
|
-
function nodeFindNodeByNamePath(node, path, currLevelIndex) {
|
|
16474
|
-
const currNodeName = path[currLevelIndex];
|
|
16475
|
-
if (node.name === currNodeName) {
|
|
16476
|
-
if (currLevelIndex === path.length - 1) {
|
|
16477
|
-
return node;
|
|
16478
|
-
}
|
|
16479
|
-
if (node.children) {
|
|
16480
|
-
const foundNodes = node.children.map((child) => nodeFindNodeByNamePath(child, path, currLevelIndex + 1)).filter(Boolean);
|
|
16481
|
-
if (foundNodes.length === 1) {
|
|
16482
|
-
return foundNodes[0];
|
|
16483
|
-
}
|
|
16484
|
-
}
|
|
16485
|
-
}
|
|
16486
|
-
return null;
|
|
16487
|
-
}
|
|
16488
|
-
function treeFindNodeByNamePath(currTree, targetNamePath) {
|
|
16489
|
-
const foundNodes = currTree.tree.map((levelZeroNode) => nodeFindNodeByNamePath(levelZeroNode, targetNamePath, 0)).filter(Boolean);
|
|
16490
|
-
if (foundNodes.length === 1) {
|
|
16491
|
-
return foundNodes[0];
|
|
16492
|
-
}
|
|
16493
|
-
return null;
|
|
16494
|
-
}
|
|
16495
|
-
function nodeTransform(node, predicate, transform, transformedPaths, currPath) {
|
|
16496
|
-
let newPath;
|
|
16497
|
-
if (!currPath) {
|
|
16498
|
-
newPath = [node.name];
|
|
16499
|
-
} else {
|
|
16500
|
-
newPath = [...currPath];
|
|
16501
|
-
}
|
|
16502
|
-
if (predicate(node, newPath)) {
|
|
16503
|
-
transformedPaths.push(newPath);
|
|
16504
|
-
return transform(node, newPath);
|
|
16505
|
-
}
|
|
16506
|
-
if (node.children) {
|
|
16507
|
-
return {
|
|
16508
|
-
...node,
|
|
16509
|
-
children: node.children.map(
|
|
16510
|
-
(child) => nodeTransform(
|
|
16511
|
-
child,
|
|
16512
|
-
predicate,
|
|
16513
|
-
transform,
|
|
16514
|
-
transformedPaths,
|
|
16515
|
-
newPath.concat([child.name])
|
|
16516
|
-
)
|
|
16517
|
-
)
|
|
16518
|
-
};
|
|
16519
|
-
}
|
|
16520
|
-
return node;
|
|
16521
|
-
}
|
|
16522
|
-
function nodeTransformAll(node, predicate, transform, transformedPaths, currPath) {
|
|
16523
|
-
let newPath;
|
|
16524
|
-
if (!currPath) {
|
|
16525
|
-
newPath = [node.name];
|
|
16526
|
-
} else {
|
|
16527
|
-
newPath = [...currPath];
|
|
16528
|
-
}
|
|
16529
|
-
let newNode = node;
|
|
16530
|
-
if (predicate(node, newPath)) {
|
|
16531
|
-
transformedPaths.push(newPath);
|
|
16532
|
-
newNode = transform(node, newPath);
|
|
16533
|
-
}
|
|
16534
|
-
if (node.children) {
|
|
16535
|
-
return {
|
|
16536
|
-
...newNode,
|
|
16537
|
-
children: newNode.children.map(
|
|
16538
|
-
(child) => nodeTransformAll(
|
|
16539
|
-
child,
|
|
16540
|
-
predicate,
|
|
16541
|
-
transform,
|
|
16542
|
-
transformedPaths,
|
|
16543
|
-
newPath.concat([child.name])
|
|
16544
|
-
)
|
|
16545
|
-
)
|
|
16546
|
-
};
|
|
16547
|
-
}
|
|
16548
|
-
return newNode;
|
|
16549
|
-
}
|
|
16550
|
-
function nodeAppendChild(currNode, newChild) {
|
|
16551
|
-
return {
|
|
16552
|
-
...currNode,
|
|
16553
|
-
children: [...currNode.children, newChild]
|
|
16554
|
-
};
|
|
16555
|
-
}
|
|
16556
|
-
function nodePrependChild(currNode, newChild) {
|
|
16557
|
-
return {
|
|
16558
|
-
...currNode,
|
|
16559
|
-
children: [newChild, ...currNode.children]
|
|
16560
|
-
};
|
|
16561
|
-
}
|
|
16562
|
-
function nodeInsertChild(currNode, newChild, insertIndex) {
|
|
16563
|
-
const newChildren = Array.from(currNode.children);
|
|
16564
|
-
newChildren.splice(insertIndex, 0, newChild);
|
|
16565
|
-
return {
|
|
16566
|
-
...currNode,
|
|
16567
|
-
children: newChildren
|
|
16568
|
-
};
|
|
16569
|
-
}
|
|
16570
|
-
function treeToUnion(currTree, checkedPaths) {
|
|
16571
|
-
const nodes = checkedPaths.map((path) => treeFindNodeByNamePath(currTree, path));
|
|
16572
|
-
const nodeSets = nodes.map((node) => nodeToSet(node).map(([cellId]) => cellId));
|
|
16573
|
-
return nodeSets.reduce((a, h) => a.concat(h.filter((hEl) => !a.includes(hEl))), nodeSets[0] || []);
|
|
16574
|
-
}
|
|
16575
|
-
function treeToIntersection(currTree, checkedPaths) {
|
|
16576
|
-
const nodes = checkedPaths.map((path) => treeFindNodeByNamePath(currTree, path));
|
|
16577
|
-
const nodeSets = nodes.map((node) => nodeToSet(node).map(([cellId]) => cellId));
|
|
16578
|
-
return nodeSets.reduce((a, h) => h.filter((hEl) => a.includes(hEl)), nodeSets[0] || []);
|
|
16579
|
-
}
|
|
16580
|
-
function treeToComplement(currTree, checkedPaths, items) {
|
|
16581
|
-
const primaryUnion = treeToUnion(currTree, checkedPaths);
|
|
16582
|
-
return items.filter((el) => !primaryUnion.includes(el));
|
|
16583
|
-
}
|
|
16584
|
-
function nodeToLevelDescendantNamePaths(node, level, prevPath, stopEarly = false) {
|
|
16585
|
-
if (!node.children) {
|
|
16586
|
-
if (!stopEarly) {
|
|
16587
|
-
return null;
|
|
16588
|
-
}
|
|
16589
|
-
return [[...prevPath, node.name]];
|
|
16590
|
-
}
|
|
16591
|
-
if (level === 0) {
|
|
16592
|
-
return [[...prevPath, node.name]];
|
|
16593
|
-
}
|
|
16594
|
-
return node.children.flatMap((c) => nodeToLevelDescendantNamePaths(c, level - 1, [...prevPath, node.name], stopEarly)).filter(Boolean);
|
|
16595
|
-
}
|
|
16596
|
-
function treeExport(currTree, datatype) {
|
|
16597
|
-
return {
|
|
16598
|
-
version: HIERARCHICAL_SCHEMAS.latestVersion,
|
|
16599
|
-
datatype,
|
|
16600
|
-
tree: currTree.tree
|
|
16601
|
-
};
|
|
16602
|
-
}
|
|
16603
|
-
function treeExportLevelZeroNode(currTree, nodePath, datatype, cellSetColors, theme) {
|
|
16604
|
-
const node = treeFindNodeByNamePath(currTree, nodePath);
|
|
16605
|
-
const nodeWithColors = nodeTransformAll(node, () => true, (n, nPath) => {
|
|
16606
|
-
var _a;
|
|
16607
|
-
const nodeColor = ((_a = cellSetColors == null ? void 0 : cellSetColors.find((c) => isEqual(c.path, nPath))) == null ? void 0 : _a.color) ?? getDefaultColor(theme);
|
|
16608
|
-
return {
|
|
16609
|
-
...n,
|
|
16610
|
-
color: nodeColor.slice(0, 3)
|
|
16611
|
-
};
|
|
16612
|
-
}, []);
|
|
16613
|
-
const treeWithOneLevelZeroNode = {
|
|
16614
|
-
...currTree,
|
|
16615
|
-
tree: [nodeWithColors]
|
|
16616
|
-
};
|
|
16617
|
-
return {
|
|
16618
|
-
treeToExport: treeExport(treeWithOneLevelZeroNode, datatype),
|
|
16619
|
-
nodeName: node.name
|
|
16620
|
-
};
|
|
16621
|
-
}
|
|
16622
|
-
function treeExportSet(currTree, nodePath) {
|
|
16623
|
-
const node = treeFindNodeByNamePath(currTree, nodePath);
|
|
16624
|
-
return { setToExport: nodeToSet(node), nodeName: node.name };
|
|
16625
|
-
}
|
|
16626
|
-
function treeInitialize(datatype) {
|
|
16627
|
-
return {
|
|
16628
|
-
version: HIERARCHICAL_SCHEMAS.latestVersion,
|
|
16629
|
-
datatype,
|
|
16630
|
-
tree: []
|
|
16631
|
-
};
|
|
16632
|
-
}
|
|
16633
|
-
function nodeToRenderProps(node, path, cellSetColor) {
|
|
16634
|
-
var _a;
|
|
16635
|
-
const level = path.length - 1;
|
|
16636
|
-
return {
|
|
16637
|
-
title: node.name,
|
|
16638
|
-
nodeKey: pathToKey(path),
|
|
16639
|
-
path,
|
|
16640
|
-
size: getNodeLength(node),
|
|
16641
|
-
color: (_a = cellSetColor == null ? void 0 : cellSetColor.find((d) => isEqual(d.path, path))) == null ? void 0 : _a.color,
|
|
16642
|
-
level,
|
|
16643
|
-
isLeaf: (!node.children || node.children.length === 0) && Boolean(node.set),
|
|
16644
|
-
height: nodeToHeight(node)
|
|
16645
|
-
};
|
|
16646
|
-
}
|
|
16647
|
-
function colorMixWithUncertainty(originalColor, p, mixingColor = [128, 128, 128]) {
|
|
16648
|
-
return [
|
|
16649
|
-
(originalColor[0] - mixingColor[0]) * p + mixingColor[0],
|
|
16650
|
-
(originalColor[1] - mixingColor[1]) * p + mixingColor[1],
|
|
16651
|
-
(originalColor[2] - mixingColor[2]) * p + mixingColor[2]
|
|
16652
|
-
];
|
|
16653
|
-
}
|
|
16654
|
-
function treeToCellColorsBySetNames(currTree, selectedNamePaths, cellSetColor, theme) {
|
|
16655
|
-
let cellColorsArray = [];
|
|
16656
|
-
selectedNamePaths.forEach((setNamePath) => {
|
|
16657
|
-
var _a;
|
|
16658
|
-
const node = treeFindNodeByNamePath(currTree, setNamePath);
|
|
16659
|
-
if (node) {
|
|
16660
|
-
const nodeSet = nodeToSet(node);
|
|
16661
|
-
const nodeColor = ((_a = cellSetColor == null ? void 0 : cellSetColor.find((d) => isEqual(d.path, setNamePath))) == null ? void 0 : _a.color) || getDefaultColor(theme);
|
|
16662
|
-
cellColorsArray = [
|
|
16663
|
-
...cellColorsArray,
|
|
16664
|
-
...nodeSet.map(([cellId, prob]) => [
|
|
16665
|
-
cellId,
|
|
16666
|
-
isNil(prob) ? nodeColor : colorMixWithUncertainty(nodeColor, prob)
|
|
16667
|
-
])
|
|
16668
|
-
];
|
|
16669
|
-
}
|
|
16670
|
-
});
|
|
16671
|
-
return new Map(cellColorsArray);
|
|
16672
|
-
}
|
|
16673
|
-
function treeToCellSetColorIndicesBySetNames(currTree, selectedNamePaths, cellSetColor) {
|
|
16674
|
-
let cellColorsArray = [];
|
|
16675
|
-
selectedNamePaths == null ? void 0 : selectedNamePaths.forEach((setNamePath) => {
|
|
16676
|
-
const node = treeFindNodeByNamePath(currTree, setNamePath);
|
|
16677
|
-
if (node) {
|
|
16678
|
-
const nodeSet = nodeToSet(node);
|
|
16679
|
-
const nodeColorIndex = cellSetColor == null ? void 0 : cellSetColor.findIndex((d) => isEqual(d.path, setNamePath));
|
|
16680
|
-
cellColorsArray = [
|
|
16681
|
-
...cellColorsArray,
|
|
16682
|
-
...nodeSet.map(([cellId]) => [
|
|
16683
|
-
cellId,
|
|
16684
|
-
nodeColorIndex
|
|
16685
|
-
])
|
|
16686
|
-
];
|
|
16687
|
-
}
|
|
16688
|
-
});
|
|
16689
|
-
return new Map(cellColorsArray);
|
|
16690
|
-
}
|
|
16691
|
-
function treeToObjectsBySetNames(currTree, selectedNamePaths, setColor, theme) {
|
|
16692
|
-
var _a;
|
|
16693
|
-
let cellsArray = [];
|
|
16694
|
-
for (let i = 0; i < selectedNamePaths.length; i += 1) {
|
|
16695
|
-
const setNamePath = selectedNamePaths[i];
|
|
16696
|
-
const node = treeFindNodeByNamePath(currTree, setNamePath);
|
|
16697
|
-
if (node) {
|
|
16698
|
-
const nodeSet = nodeToSet(node);
|
|
16699
|
-
const nodeColor = ((_a = setColor == null ? void 0 : setColor.find((d) => isEqual(d.path, setNamePath))) == null ? void 0 : _a.color) || getDefaultColor(theme);
|
|
16700
|
-
cellsArray = cellsArray.concat(nodeSet.map(([cellId]) => ({
|
|
16701
|
-
obsId: cellId,
|
|
16702
|
-
name: node.name,
|
|
16703
|
-
color: nodeColor
|
|
16704
|
-
})));
|
|
16705
|
-
}
|
|
16706
|
-
}
|
|
16707
|
-
return cellsArray;
|
|
16708
|
-
}
|
|
16709
|
-
function treeToCellPolygonsBySetNames(currTree, obsIndex, obsEmbedding, selectedNamePaths, cellSetColor, theme) {
|
|
16710
|
-
const obsIndexMap = new Map(obsIndex.map((key, i) => [key, i]));
|
|
16711
|
-
const cellSetPolygons = [];
|
|
16712
|
-
selectedNamePaths.forEach((setNamePath) => {
|
|
16713
|
-
var _a;
|
|
16714
|
-
const node = treeFindNodeByNamePath(currTree, setNamePath);
|
|
16715
|
-
if (node) {
|
|
16716
|
-
const nodeSet = nodeToSet(node);
|
|
16717
|
-
const nodeColor = ((_a = cellSetColor == null ? void 0 : cellSetColor.find((d) => isEqual(d.path, setNamePath))) == null ? void 0 : _a.color) || getDefaultColor(theme);
|
|
16718
|
-
const cellPositions = nodeSet.map(([cellId]) => {
|
|
16719
|
-
const cellIdx = obsIndexMap.get(cellId);
|
|
16720
|
-
return [
|
|
16721
|
-
obsEmbedding.data[0][cellIdx],
|
|
16722
|
-
-obsEmbedding.data[1][cellIdx]
|
|
16723
|
-
];
|
|
16724
|
-
}).filter((cell) => cell.every((i) => typeof i === "number"));
|
|
16725
|
-
if (cellPositions.length > 2) {
|
|
16726
|
-
const points = featureCollection(
|
|
16727
|
-
cellPositions.map(point)
|
|
16728
|
-
);
|
|
16729
|
-
const concavity = Infinity;
|
|
16730
|
-
const hullCoords = concaveman$1(cellPositions, concavity);
|
|
16731
|
-
if (hullCoords) {
|
|
16732
|
-
const centroidCoords = centroid(points).geometry.coordinates;
|
|
16733
|
-
cellSetPolygons.push({
|
|
16734
|
-
path: setNamePath,
|
|
16735
|
-
name: setNamePath[setNamePath.length - 1],
|
|
16736
|
-
hull: hullCoords,
|
|
16737
|
-
color: nodeColor,
|
|
16738
|
-
centroid: centroidCoords
|
|
16692
|
+
return;
|
|
16693
|
+
_this2.emit("line", line);
|
|
16694
|
+
_this2.push(_this2._hasWritten ? _this2.opts.eol + line : line);
|
|
16695
|
+
_this2._hasWritten = true;
|
|
16739
16696
|
});
|
|
16740
16697
|
}
|
|
16698
|
+
}]);
|
|
16699
|
+
return JSON2CSVTransform2;
|
|
16700
|
+
}(Transform$1);
|
|
16701
|
+
var JSON2CSVTransform_1 = JSON2CSVTransform;
|
|
16702
|
+
var Transform$2 = Stream.Transform;
|
|
16703
|
+
var fastJoin$3 = utils.fastJoin;
|
|
16704
|
+
var JSON2CSVAsyncParser = /* @__PURE__ */ function() {
|
|
16705
|
+
function JSON2CSVAsyncParser2(opts2, transformOpts) {
|
|
16706
|
+
_classCallCheck(this, JSON2CSVAsyncParser2);
|
|
16707
|
+
this.input = new Transform$2(transformOpts);
|
|
16708
|
+
this.input._read = function() {
|
|
16709
|
+
};
|
|
16710
|
+
this.transform = new JSON2CSVTransform_1(opts2, transformOpts);
|
|
16711
|
+
this.processor = this.input.pipe(this.transform);
|
|
16741
16712
|
}
|
|
16742
|
-
|
|
16743
|
-
|
|
16744
|
-
|
|
16745
|
-
|
|
16746
|
-
|
|
16747
|
-
|
|
16748
|
-
|
|
16749
|
-
|
|
16750
|
-
|
|
16751
|
-
const node = treeFindNodeByNamePath(currTree, clusterPath);
|
|
16752
|
-
if (node) {
|
|
16753
|
-
const nodeSet = nodeToSet(node);
|
|
16754
|
-
const nodeColor = ((_a = setColor == null ? void 0 : setColor.find((d) => isEqual(d.path, clusterPath))) == null ? void 0 : _a.color) || getDefaultColor(theme);
|
|
16755
|
-
const nodeProps = {
|
|
16756
|
-
key: generateKey(),
|
|
16757
|
-
name: node.name,
|
|
16758
|
-
size: nodeSet.length,
|
|
16759
|
-
color: nodeColor,
|
|
16760
|
-
setNamePath: clusterPath,
|
|
16761
|
-
// used by the CellSetSizesPlot to determine if the bar should be grayed out
|
|
16762
|
-
isGrayedOut: true
|
|
16763
|
-
};
|
|
16764
|
-
if (contains(clusterPath, selectedNamePaths)) {
|
|
16765
|
-
nodeProps.isGrayedOut = false;
|
|
16766
|
-
}
|
|
16767
|
-
sizes.push(nodeProps);
|
|
16768
|
-
}
|
|
16769
|
-
});
|
|
16770
|
-
return sizes;
|
|
16771
|
-
}
|
|
16772
|
-
function filterNode(node, prevPath, filterPath) {
|
|
16773
|
-
if (isEqual([...prevPath, node.name], filterPath)) {
|
|
16774
|
-
return null;
|
|
16775
|
-
}
|
|
16776
|
-
if (!node.children) {
|
|
16777
|
-
return node;
|
|
16778
|
-
}
|
|
16779
|
-
return {
|
|
16780
|
-
...node,
|
|
16781
|
-
children: node.children.map(
|
|
16782
|
-
(c) => filterNode(c, [...prevPath, node.name], filterPath)
|
|
16783
|
-
).filter(Boolean)
|
|
16784
|
-
};
|
|
16785
|
-
}
|
|
16786
|
-
function treeToExpectedCheckedLevel(currTree, checkedPaths) {
|
|
16787
|
-
let result = null;
|
|
16788
|
-
if (currTree) {
|
|
16789
|
-
currTree.tree.forEach((lzn) => {
|
|
16790
|
-
const levelZeroPath = [lzn.name];
|
|
16791
|
-
const height = nodeToHeight(lzn);
|
|
16792
|
-
range$2(height).forEach((i) => {
|
|
16793
|
-
const levelIndex = i + 1;
|
|
16794
|
-
const levelNodePaths = nodeToLevelDescendantNamePaths(lzn, levelIndex, [], true);
|
|
16795
|
-
if (isEqual(levelNodePaths, checkedPaths)) {
|
|
16796
|
-
result = { levelZeroPath, levelIndex };
|
|
16713
|
+
_createClass(JSON2CSVAsyncParser2, [{
|
|
16714
|
+
key: "fromInput",
|
|
16715
|
+
value: function fromInput(input) {
|
|
16716
|
+
if (this._input) {
|
|
16717
|
+
throw new Error("Async parser already has an input.");
|
|
16718
|
+
}
|
|
16719
|
+
this._input = input;
|
|
16720
|
+
this.input = this._input.pipe(this.processor);
|
|
16721
|
+
return this;
|
|
16797
16722
|
}
|
|
16798
|
-
}
|
|
16799
|
-
|
|
16800
|
-
|
|
16801
|
-
|
|
16802
|
-
|
|
16803
|
-
|
|
16804
|
-
|
|
16805
|
-
|
|
16806
|
-
|
|
16807
|
-
|
|
16808
|
-
|
|
16809
|
-
|
|
16810
|
-
|
|
16811
|
-
|
|
16812
|
-
|
|
16813
|
-
|
|
16814
|
-
|
|
16815
|
-
|
|
16816
|
-
|
|
16817
|
-
|
|
16818
|
-
|
|
16819
|
-
|
|
16820
|
-
|
|
16821
|
-
|
|
16822
|
-
|
|
16823
|
-
|
|
16824
|
-
|
|
16825
|
-
|
|
16826
|
-
|
|
16827
|
-
|
|
16828
|
-
|
|
16829
|
-
|
|
16830
|
-
|
|
16831
|
-
|
|
16832
|
-
|
|
16833
|
-
|
|
16834
|
-
|
|
16835
|
-
|
|
16836
|
-
|
|
16837
|
-
|
|
16838
|
-
if (!nodeColor) {
|
|
16839
|
-
const nodeColorArray = node.color ? node.color : PALETTE[index % PALETTE.length];
|
|
16840
|
-
nextCellSetColor.push({
|
|
16841
|
-
path: nodePath,
|
|
16842
|
-
color: nodeColorArray
|
|
16843
|
-
});
|
|
16844
|
-
}
|
|
16845
|
-
nodeCountPerTreePerLevel[treeIndex][hierarchyLevel] += 1;
|
|
16846
|
-
if (node.children) {
|
|
16847
|
-
node.children.forEach((c) => processNode(c, nodePath, hierarchyLevel + 1, treeIndex));
|
|
16848
|
-
}
|
|
16849
|
-
}
|
|
16850
|
-
cellSets.tree.forEach((lzn, treeIndex) => processNode(lzn, [], 0, treeIndex));
|
|
16851
|
-
return nextCellSetColor;
|
|
16852
|
-
}
|
|
16853
|
-
function getCellSetPolygons(params) {
|
|
16854
|
-
const {
|
|
16855
|
-
obsIndex,
|
|
16856
|
-
obsEmbedding,
|
|
16857
|
-
cellSets,
|
|
16858
|
-
cellSetSelection,
|
|
16859
|
-
cellSetColor,
|
|
16860
|
-
theme
|
|
16861
|
-
} = params;
|
|
16862
|
-
if (cellSetSelection && cellSetSelection.length > 0 && cellSets && obsIndex && obsEmbedding) {
|
|
16863
|
-
return treeToCellPolygonsBySetNames(
|
|
16864
|
-
cellSets,
|
|
16865
|
-
obsIndex,
|
|
16866
|
-
obsEmbedding,
|
|
16867
|
-
cellSetSelection,
|
|
16868
|
-
cellSetColor,
|
|
16869
|
-
theme
|
|
16870
|
-
);
|
|
16871
|
-
}
|
|
16872
|
-
return [];
|
|
16873
|
-
}
|
|
16874
|
-
function treeToMembershipMap(currTree) {
|
|
16875
|
-
const result = /* @__PURE__ */ new Map();
|
|
16876
|
-
if (currTree) {
|
|
16877
|
-
currTree.tree.forEach((lzn) => {
|
|
16878
|
-
const height = nodeToHeight(lzn);
|
|
16879
|
-
range$2(height).forEach((i) => {
|
|
16880
|
-
const levelIndex = i + 1;
|
|
16881
|
-
const levelNodePaths = nodeToLevelDescendantNamePaths(lzn, levelIndex, [], true);
|
|
16882
|
-
levelNodePaths.forEach((setNamePath) => {
|
|
16883
|
-
const node = treeFindNodeByNamePath(currTree, setNamePath);
|
|
16884
|
-
if (node && !node.children) {
|
|
16885
|
-
const nodeSet = nodeToSet(node);
|
|
16886
|
-
nodeSet.forEach(([obsId]) => {
|
|
16887
|
-
if (result.has(obsId)) {
|
|
16888
|
-
result.get(obsId).push(setNamePath);
|
|
16889
|
-
} else {
|
|
16890
|
-
result.set(obsId, [setNamePath]);
|
|
16891
|
-
}
|
|
16723
|
+
}, {
|
|
16724
|
+
key: "throughTransform",
|
|
16725
|
+
value: function throughTransform(transform) {
|
|
16726
|
+
if (this._output) {
|
|
16727
|
+
throw new Error("Can't add transforms once an output has been added.");
|
|
16728
|
+
}
|
|
16729
|
+
this.processor = this.processor.pipe(transform);
|
|
16730
|
+
return this;
|
|
16731
|
+
}
|
|
16732
|
+
}, {
|
|
16733
|
+
key: "toOutput",
|
|
16734
|
+
value: function toOutput(output) {
|
|
16735
|
+
if (this._output) {
|
|
16736
|
+
throw new Error("Async parser already has an output.");
|
|
16737
|
+
}
|
|
16738
|
+
this._output = output;
|
|
16739
|
+
this.processor = this.processor.pipe(output);
|
|
16740
|
+
return this;
|
|
16741
|
+
}
|
|
16742
|
+
}, {
|
|
16743
|
+
key: "promise",
|
|
16744
|
+
value: function promise() {
|
|
16745
|
+
var _this = this;
|
|
16746
|
+
var returnCSV = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : true;
|
|
16747
|
+
return new Promise(function(resolve, reject) {
|
|
16748
|
+
if (!returnCSV) {
|
|
16749
|
+
_this.processor.on("finish", function() {
|
|
16750
|
+
return resolve();
|
|
16751
|
+
}).on("error", function(err) {
|
|
16752
|
+
return reject(err);
|
|
16753
|
+
});
|
|
16754
|
+
return;
|
|
16755
|
+
}
|
|
16756
|
+
var csvBuffer = [];
|
|
16757
|
+
_this.processor.on("data", function(chunk) {
|
|
16758
|
+
return csvBuffer.push(chunk.toString());
|
|
16759
|
+
}).on("finish", function() {
|
|
16760
|
+
return resolve(fastJoin$3(csvBuffer, ""));
|
|
16761
|
+
}).on("error", function(err) {
|
|
16762
|
+
return reject(err);
|
|
16892
16763
|
});
|
|
16764
|
+
});
|
|
16765
|
+
}
|
|
16766
|
+
}]);
|
|
16767
|
+
return JSON2CSVAsyncParser2;
|
|
16768
|
+
}();
|
|
16769
|
+
var JSON2CSVAsyncParser_1 = JSON2CSVAsyncParser;
|
|
16770
|
+
function flatten() {
|
|
16771
|
+
var _ref = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : {}, _ref$objects = _ref.objects, objects = _ref$objects === void 0 ? true : _ref$objects, _ref$arrays = _ref.arrays, arrays = _ref$arrays === void 0 ? false : _ref$arrays, _ref$separator = _ref.separator, separator = _ref$separator === void 0 ? "." : _ref$separator;
|
|
16772
|
+
function step(obj, flatDataRow, currentPath) {
|
|
16773
|
+
Object.keys(obj).forEach(function(key) {
|
|
16774
|
+
var newPath = currentPath ? "".concat(currentPath).concat(separator).concat(key) : key;
|
|
16775
|
+
var value = obj[key];
|
|
16776
|
+
if (objects && _typeof(value) === "object" && value !== null && !Array.isArray(value) && Object.prototype.toString.call(value.toJSON) !== "[object Function]" && Object.keys(value).length) {
|
|
16777
|
+
step(value, flatDataRow, newPath);
|
|
16778
|
+
return;
|
|
16893
16779
|
}
|
|
16894
|
-
|
|
16895
|
-
|
|
16896
|
-
|
|
16897
|
-
|
|
16898
|
-
|
|
16899
|
-
}
|
|
16900
|
-
|
|
16901
|
-
if (node.children) {
|
|
16902
|
-
node.children.forEach((child) => {
|
|
16903
|
-
const newPath = [...currentPath, child.name];
|
|
16904
|
-
paths.push(newPath);
|
|
16905
|
-
getPaths(child, newPath, paths);
|
|
16906
|
-
});
|
|
16907
|
-
}
|
|
16908
|
-
return paths;
|
|
16909
|
-
}
|
|
16910
|
-
function findLongestPath(arrOfPaths, path, isSubset) {
|
|
16911
|
-
if (Array.isArray(arrOfPaths)) {
|
|
16912
|
-
let longest = null;
|
|
16913
|
-
let longestLength = 0;
|
|
16914
|
-
arrOfPaths.forEach((subArray) => {
|
|
16915
|
-
const matchCount = subArray.filter((v, i) => v === path[i]).length;
|
|
16916
|
-
if (matchCount === (isSubset ? subArray.length : path.length) && subArray.length > longestLength) {
|
|
16917
|
-
longest = subArray;
|
|
16918
|
-
longestLength = subArray.length;
|
|
16780
|
+
if (arrays && Array.isArray(value)) {
|
|
16781
|
+
step(value, flatDataRow, newPath);
|
|
16782
|
+
return;
|
|
16783
|
+
}
|
|
16784
|
+
flatDataRow[newPath] = value;
|
|
16785
|
+
});
|
|
16786
|
+
return flatDataRow;
|
|
16919
16787
|
}
|
|
16920
|
-
|
|
16921
|
-
|
|
16922
|
-
|
|
16923
|
-
}
|
|
16924
|
-
if (isSubset) {
|
|
16925
|
-
return [];
|
|
16788
|
+
return function(dataRow) {
|
|
16789
|
+
return step(dataRow, {});
|
|
16790
|
+
};
|
|
16926
16791
|
}
|
|
16927
|
-
|
|
16928
|
-
|
|
16929
|
-
|
|
16930
|
-
|
|
16931
|
-
|
|
16932
|
-
|
|
16933
|
-
|
|
16934
|
-
|
|
16935
|
-
|
|
16936
|
-
|
|
16937
|
-
|
|
16792
|
+
var flatten_1 = flatten;
|
|
16793
|
+
var setProp$1 = utils.setProp, unsetProp$1 = utils.unsetProp, flattenReducer$3 = utils.flattenReducer;
|
|
16794
|
+
function getUnwindablePaths(obj, currentPath) {
|
|
16795
|
+
return Object.keys(obj).reduce(function(unwindablePaths, key) {
|
|
16796
|
+
var newPath = currentPath ? "".concat(currentPath, ".").concat(key) : key;
|
|
16797
|
+
var value = obj[key];
|
|
16798
|
+
if (_typeof(value) === "object" && value !== null && !Array.isArray(value) && Object.prototype.toString.call(value.toJSON) !== "[object Function]" && Object.keys(value).length) {
|
|
16799
|
+
unwindablePaths = unwindablePaths.concat(getUnwindablePaths(value, newPath));
|
|
16800
|
+
} else if (Array.isArray(value)) {
|
|
16801
|
+
unwindablePaths.push(newPath);
|
|
16802
|
+
unwindablePaths = unwindablePaths.concat(value.map(function(arrObj) {
|
|
16803
|
+
return getUnwindablePaths(arrObj, newPath);
|
|
16804
|
+
}).reduce(flattenReducer$3, []).filter(function(item, index, arr) {
|
|
16805
|
+
return arr.indexOf(item) !== index;
|
|
16806
|
+
}));
|
|
16807
|
+
}
|
|
16808
|
+
return unwindablePaths;
|
|
16809
|
+
}, []);
|
|
16938
16810
|
}
|
|
16939
|
-
|
|
16940
|
-
|
|
16941
|
-
|
|
16942
|
-
|
|
16943
|
-
|
|
16944
|
-
|
|
16945
|
-
|
|
16946
|
-
|
|
16947
|
-
|
|
16948
|
-
|
|
16949
|
-
|
|
16950
|
-
|
|
16811
|
+
function unwind() {
|
|
16812
|
+
var _ref = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : {}, _ref$paths = _ref.paths, paths = _ref$paths === void 0 ? void 0 : _ref$paths, _ref$blankOut = _ref.blankOut, blankOut = _ref$blankOut === void 0 ? false : _ref$blankOut;
|
|
16813
|
+
function unwindReducer(rows, unwindPath) {
|
|
16814
|
+
return rows.map(function(row) {
|
|
16815
|
+
var unwindArray = lodash_get(row, unwindPath);
|
|
16816
|
+
if (!Array.isArray(unwindArray)) {
|
|
16817
|
+
return row;
|
|
16818
|
+
}
|
|
16819
|
+
if (!unwindArray.length) {
|
|
16820
|
+
return unsetProp$1(row, unwindPath);
|
|
16821
|
+
}
|
|
16822
|
+
return unwindArray.map(function(unwindRow, index) {
|
|
16823
|
+
var clonedRow = blankOut && index > 0 ? {} : row;
|
|
16824
|
+
return setProp$1(clonedRow, unwindPath, unwindRow);
|
|
16825
|
+
});
|
|
16826
|
+
}).reduce(flattenReducer$3, []);
|
|
16951
16827
|
}
|
|
16952
|
-
|
|
16953
|
-
|
|
16954
|
-
|
|
16955
|
-
|
|
16956
|
-
|
|
16957
|
-
|
|
16828
|
+
paths = Array.isArray(paths) ? paths : paths ? [paths] : void 0;
|
|
16829
|
+
return function(dataRow) {
|
|
16830
|
+
return (paths || getUnwindablePaths(dataRow)).reduce(unwindReducer, [dataRow]);
|
|
16831
|
+
};
|
|
16832
|
+
}
|
|
16833
|
+
var unwind_1 = unwind;
|
|
16834
|
+
var Readable$1 = Stream.Readable;
|
|
16835
|
+
var Parser$1 = JSON2CSVParser_1;
|
|
16836
|
+
var AsyncParser = JSON2CSVAsyncParser_1;
|
|
16837
|
+
var Transform$3 = JSON2CSVTransform_1;
|
|
16838
|
+
var parse2 = function parse3(data, opts2) {
|
|
16839
|
+
return new JSON2CSVParser_1(opts2).parse(data);
|
|
16840
|
+
};
|
|
16841
|
+
var parseAsync = function parseAsync2(data, opts2, transformOpts) {
|
|
16842
|
+
try {
|
|
16843
|
+
if (!(data instanceof Readable$1)) {
|
|
16844
|
+
transformOpts = Object.assign({}, transformOpts, {
|
|
16845
|
+
objectMode: true
|
|
16846
|
+
});
|
|
16847
|
+
}
|
|
16848
|
+
var asyncParser = new JSON2CSVAsyncParser_1(opts2, transformOpts);
|
|
16849
|
+
var promise = asyncParser.promise();
|
|
16850
|
+
if (Array.isArray(data)) {
|
|
16851
|
+
data.forEach(function(item) {
|
|
16852
|
+
return asyncParser.input.push(item);
|
|
16853
|
+
});
|
|
16854
|
+
asyncParser.input.push(null);
|
|
16855
|
+
} else if (data instanceof Readable$1) {
|
|
16856
|
+
asyncParser.fromInput(data);
|
|
16857
|
+
} else {
|
|
16858
|
+
asyncParser.input.push(data);
|
|
16859
|
+
asyncParser.input.push(null);
|
|
16958
16860
|
}
|
|
16861
|
+
return promise;
|
|
16862
|
+
} catch (err) {
|
|
16863
|
+
return Promise.reject(err);
|
|
16959
16864
|
}
|
|
16960
|
-
}
|
|
16961
|
-
|
|
16865
|
+
};
|
|
16866
|
+
var transforms = {
|
|
16867
|
+
flatten: flatten_1,
|
|
16868
|
+
unwind: unwind_1
|
|
16869
|
+
};
|
|
16870
|
+
var json2csv = {
|
|
16871
|
+
Parser: Parser$1,
|
|
16872
|
+
AsyncParser,
|
|
16873
|
+
Transform: Transform$3,
|
|
16874
|
+
parse: parse2,
|
|
16875
|
+
parseAsync,
|
|
16876
|
+
transforms
|
|
16877
|
+
};
|
|
16878
|
+
exports3.AsyncParser = AsyncParser;
|
|
16879
|
+
exports3.Parser = Parser$1;
|
|
16880
|
+
exports3.Transform = Transform$3;
|
|
16881
|
+
exports3.default = json2csv;
|
|
16882
|
+
exports3.parse = parse2;
|
|
16883
|
+
exports3.parseAsync = parseAsync;
|
|
16884
|
+
exports3.transforms = transforms;
|
|
16885
|
+
Object.defineProperty(exports3, "__esModule", { value: true });
|
|
16962
16886
|
});
|
|
16963
|
-
}
|
|
16964
|
-
|
|
16965
|
-
const unselectedPaths = prevSelectedPaths.filter(
|
|
16966
|
-
(prevPath) => !currSelectedPaths.find((currPath) => isEqual(currPath, prevPath))
|
|
16967
|
-
);
|
|
16968
|
-
const newlySelectedPaths = currSelectedPaths.filter(
|
|
16969
|
-
(currPath) => !prevSelectedPaths.find((prevPath) => isEqual(currPath, prevPath))
|
|
16970
|
-
);
|
|
16971
|
-
if (unselectedPaths.length === 0 && newlySelectedPaths.length === 0) {
|
|
16972
|
-
return null;
|
|
16973
|
-
}
|
|
16974
|
-
const changedPath = newlySelectedPaths.length > 0 ? newlySelectedPaths[0] : unselectedPaths[0];
|
|
16975
|
-
return changedPath.slice(0, -1);
|
|
16976
|
-
}
|
|
16887
|
+
})(json2csv_umd, json2csv_umd.exports);
|
|
16888
|
+
var json2csv_umdExports = json2csv_umd.exports;
|
|
16977
16889
|
function tryUpgradeTreeToLatestSchema(currTree, datatype) {
|
|
16978
16890
|
const zodSchema = HIERARCHICAL_SCHEMAS.schema;
|
|
16979
16891
|
const latestSchemaVersion = HIERARCHICAL_SCHEMAS.latestVersion;
|
|
@@ -17073,6 +16985,49 @@ function downloadForUser(dataString, fileName) {
|
|
|
17073
16985
|
downloadAnchorNode.click();
|
|
17074
16986
|
downloadAnchorNode.remove();
|
|
17075
16987
|
}
|
|
16988
|
+
class InternMap extends Map {
|
|
16989
|
+
constructor(entries, key = keyof) {
|
|
16990
|
+
super();
|
|
16991
|
+
Object.defineProperties(this, { _intern: { value: /* @__PURE__ */ new Map() }, _key: { value: key } });
|
|
16992
|
+
if (entries != null)
|
|
16993
|
+
for (const [key2, value] of entries)
|
|
16994
|
+
this.set(key2, value);
|
|
16995
|
+
}
|
|
16996
|
+
get(key) {
|
|
16997
|
+
return super.get(intern_get(this, key));
|
|
16998
|
+
}
|
|
16999
|
+
has(key) {
|
|
17000
|
+
return super.has(intern_get(this, key));
|
|
17001
|
+
}
|
|
17002
|
+
set(key, value) {
|
|
17003
|
+
return super.set(intern_set(this, key), value);
|
|
17004
|
+
}
|
|
17005
|
+
delete(key) {
|
|
17006
|
+
return super.delete(intern_delete(this, key));
|
|
17007
|
+
}
|
|
17008
|
+
}
|
|
17009
|
+
function intern_get({ _intern, _key }, value) {
|
|
17010
|
+
const key = _key(value);
|
|
17011
|
+
return _intern.has(key) ? _intern.get(key) : value;
|
|
17012
|
+
}
|
|
17013
|
+
function intern_set({ _intern, _key }, value) {
|
|
17014
|
+
const key = _key(value);
|
|
17015
|
+
if (_intern.has(key))
|
|
17016
|
+
return _intern.get(key);
|
|
17017
|
+
_intern.set(key, value);
|
|
17018
|
+
return value;
|
|
17019
|
+
}
|
|
17020
|
+
function intern_delete({ _intern, _key }, value) {
|
|
17021
|
+
const key = _key(value);
|
|
17022
|
+
if (_intern.has(key)) {
|
|
17023
|
+
value = _intern.get(key);
|
|
17024
|
+
_intern.delete(key);
|
|
17025
|
+
}
|
|
17026
|
+
return value;
|
|
17027
|
+
}
|
|
17028
|
+
function keyof(value) {
|
|
17029
|
+
return value !== null && typeof value === "object" ? value.valueOf() : value;
|
|
17030
|
+
}
|
|
17076
17031
|
function dataToCellSetsTree(data, options) {
|
|
17077
17032
|
const [cellNames, cellSets, cellSetScores] = data;
|
|
17078
17033
|
const cellSetsTree = treeInitialize(SETS_DATATYPE_OBS);
|
|
@@ -17145,6 +17100,72 @@ function dataToCellSetsTree(data, options) {
|
|
|
17145
17100
|
});
|
|
17146
17101
|
return cellSetsTree;
|
|
17147
17102
|
}
|
|
17103
|
+
const schemeRdBu = [[103, 0, 31], [178, 24, 43], [214, 96, 77], [244, 165, 130], [253, 219, 199], [247, 247, 247], [209, 229, 240], [146, 197, 222], [67, 147, 195], [33, 102, 172], [5, 48, 97]];
|
|
17104
|
+
const schemePlasma = [[13, 8, 135], [16, 7, 136], [19, 7, 137], [22, 7, 138], [25, 6, 140], [27, 6, 141], [29, 6, 142], [32, 6, 143], [34, 6, 144], [36, 6, 145], [38, 5, 145], [40, 5, 146], [42, 5, 147], [44, 5, 148], [46, 5, 149], [47, 5, 150], [49, 5, 151], [51, 5, 151], [53, 4, 152], [55, 4, 153], [56, 4, 154], [58, 4, 154], [60, 4, 155], [62, 4, 156], [63, 4, 156], [65, 4, 157], [67, 3, 158], [68, 3, 158], [70, 3, 159], [72, 3, 159], [73, 3, 160], [75, 3, 161], [76, 2, 161], [78, 2, 162], [80, 2, 162], [81, 2, 163], [83, 2, 163], [85, 2, 164], [86, 1, 164], [88, 1, 164], [89, 1, 165], [91, 1, 165], [92, 1, 166], [94, 1, 166], [96, 1, 166], [97, 0, 167], [99, 0, 167], [100, 0, 167], [102, 0, 167], [103, 0, 168], [105, 0, 168], [106, 0, 168], [108, 0, 168], [110, 0, 168], [111, 0, 168], [113, 0, 168], [114, 1, 168], [116, 1, 168], [117, 1, 168], [119, 1, 168], [120, 1, 168], [122, 2, 168], [123, 2, 168], [125, 3, 168], [126, 3, 168], [128, 4, 168], [129, 4, 167], [131, 5, 167], [132, 5, 167], [134, 6, 166], [135, 7, 166], [136, 8, 166], [138, 9, 165], [139, 10, 165], [141, 11, 165], [142, 12, 164], [143, 13, 164], [145, 14, 163], [146, 15, 163], [148, 16, 162], [149, 17, 161], [150, 19, 161], [152, 20, 160], [153, 21, 159], [154, 22, 159], [156, 23, 158], [157, 24, 157], [158, 25, 157], [160, 26, 156], [161, 27, 155], [162, 29, 154], [163, 30, 154], [165, 31, 153], [166, 32, 152], [167, 33, 151], [168, 34, 150], [170, 35, 149], [171, 36, 148], [172, 38, 148], [173, 39, 147], [174, 40, 146], [176, 41, 145], [177, 42, 144], [178, 43, 143], [179, 44, 142], [180, 46, 141], [181, 47, 140], [182, 48, 139], [183, 49, 138], [184, 50, 137], [186, 51, 136], [187, 52, 136], [188, 53, 135], [189, 55, 134], [190, 56, 133], [191, 57, 132], [192, 58, 131], [193, 59, 130], [194, 60, 129], [195, 61, 128], [196, 62, 127], [197, 64, 126], [198, 65, 125], [199, 66, 124], [200, 67, 123], [201, 68, 122], [202, 69, 122], [203, 70, 121], [204, 71, 120], [204, 73, 119], [205, 74, 118], [206, 75, 117], [207, 76, 116], [208, 77, 115], [209, 78, 114], [210, 79, 113], [211, 81, 113], [212, 82, 112], [213, 83, 111], [213, 84, 110], [214, 85, 109], [215, 86, 108], [216, 87, 107], [217, 88, 106], [218, 90, 106], [218, 91, 105], [219, 92, 104], [220, 93, 103], [221, 94, 102], [222, 95, 101], [222, 97, 100], [223, 98, 99], [224, 99, 99], [225, 100, 98], [226, 101, 97], [226, 102, 96], [227, 104, 95], [228, 105, 94], [229, 106, 93], [229, 107, 93], [230, 108, 92], [231, 110, 91], [231, 111, 90], [232, 112, 89], [233, 113, 88], [233, 114, 87], [234, 116, 87], [235, 117, 86], [235, 118, 85], [236, 119, 84], [237, 121, 83], [237, 122, 82], [238, 123, 81], [239, 124, 81], [239, 126, 80], [240, 127, 79], [240, 128, 78], [241, 129, 77], [241, 131, 76], [242, 132, 75], [243, 133, 75], [243, 135, 74], [244, 136, 73], [244, 137, 72], [245, 139, 71], [245, 140, 70], [246, 141, 69], [246, 143, 68], [247, 144, 68], [247, 145, 67], [247, 147, 66], [248, 148, 65], [248, 149, 64], [249, 151, 63], [249, 152, 62], [249, 154, 62], [250, 155, 61], [250, 156, 60], [250, 158, 59], [251, 159, 58], [251, 161, 57], [251, 162, 56], [252, 163, 56], [252, 165, 55], [252, 166, 54], [252, 168, 53], [252, 169, 52], [253, 171, 51], [253, 172, 51], [253, 174, 50], [253, 175, 49], [253, 177, 48], [253, 178, 47], [253, 180, 47], [253, 181, 46], [254, 183, 45], [254, 184, 44], [254, 186, 44], [254, 187, 43], [254, 189, 42], [254, 190, 42], [254, 192, 41], [253, 194, 41], [253, 195, 40], [253, 197, 39], [253, 198, 39], [253, 200, 39], [253, 202, 38], [253, 203, 38], [252, 205, 37], [252, 206, 37], [252, 208, 37], [252, 210, 37], [251, 211, 36], [251, 213, 36], [251, 215, 36], [250, 216, 36], [250, 218, 36], [249, 220, 36], [249, 221, 37], [248, 223, 37], [248, 225, 37], [247, 226, 37], [247, 228, 37], [246, 230, 38], [246, 232, 38], [245, 233, 38], [245, 235, 39], [244, 237, 39], [243, 238, 39], [243, 240, 39], [242, 242, 39], [241, 244, 38], [241, 245, 37], [240, 247, 36], [240, 249, 33]];
|
|
17105
|
+
function rgbSpline(spline) {
|
|
17106
|
+
return (colors) => {
|
|
17107
|
+
const n = colors.length;
|
|
17108
|
+
const r = new Array(n);
|
|
17109
|
+
const g = new Array(n);
|
|
17110
|
+
const b = new Array(n);
|
|
17111
|
+
let i;
|
|
17112
|
+
let color;
|
|
17113
|
+
for (i = 0; i < n; ++i) {
|
|
17114
|
+
color = [colors[i][0], colors[i][1], colors[i][2]];
|
|
17115
|
+
r[i] = color[0] || 0;
|
|
17116
|
+
g[i] = color[1] || 0;
|
|
17117
|
+
b[i] = color[2] || 0;
|
|
17118
|
+
}
|
|
17119
|
+
const rFunc = spline(r);
|
|
17120
|
+
const gFunc = spline(g);
|
|
17121
|
+
const bFunc = spline(b);
|
|
17122
|
+
return (t2) => [rFunc(t2), gFunc(t2), bFunc(t2)];
|
|
17123
|
+
};
|
|
17124
|
+
}
|
|
17125
|
+
function basis(values) {
|
|
17126
|
+
function innerBasis(t1, v0, v1, v2, v3) {
|
|
17127
|
+
const t2 = t1 * t1;
|
|
17128
|
+
const t3 = t2 * t1;
|
|
17129
|
+
return ((1 - 3 * t1 + 3 * t2 - t3) * v0 + (4 - 6 * t2 + 3 * t3) * v1 + (1 + 3 * t1 + 3 * t2 - 3 * t3) * v2 + t3 * v3) / 6;
|
|
17130
|
+
}
|
|
17131
|
+
const n = values.length - 1;
|
|
17132
|
+
return (t2) => {
|
|
17133
|
+
const i = t2 <= 0 ? t2 = 0 : t2 >= 1 ? (t2 = 1, n - 1) : Math.floor(t2 * n);
|
|
17134
|
+
const v1 = values[i];
|
|
17135
|
+
const v2 = values[i + 1];
|
|
17136
|
+
const v0 = i > 0 ? values[i - 1] : 2 * v1 - v2;
|
|
17137
|
+
const v3 = i < n - 1 ? values[i + 2] : 2 * v2 - v1;
|
|
17138
|
+
return innerBasis((t2 - i / n) * n, v0, v1, v2, v3);
|
|
17139
|
+
};
|
|
17140
|
+
}
|
|
17141
|
+
const interpolateRgbBasis = rgbSpline(basis);
|
|
17142
|
+
function interpolateSequentialMulti(range2) {
|
|
17143
|
+
const n = range2.length;
|
|
17144
|
+
return (t2) => range2[Math.max(0, Math.min(n - 1, Math.floor(t2 * n)))];
|
|
17145
|
+
}
|
|
17146
|
+
interpolateRgbBasis(schemeRdBu);
|
|
17147
|
+
interpolateSequentialMulti(schemePlasma);
|
|
17148
|
+
function getCellColors(params) {
|
|
17149
|
+
const {
|
|
17150
|
+
cellSets,
|
|
17151
|
+
cellSetSelection,
|
|
17152
|
+
cellSetColor,
|
|
17153
|
+
obsIndex,
|
|
17154
|
+
theme
|
|
17155
|
+
} = params;
|
|
17156
|
+
if (cellSetSelection && cellSets) {
|
|
17157
|
+
return treeToCellColorsBySetNames(
|
|
17158
|
+
cellSets,
|
|
17159
|
+
cellSetSelection,
|
|
17160
|
+
cellSetColor,
|
|
17161
|
+
theme
|
|
17162
|
+
);
|
|
17163
|
+
}
|
|
17164
|
+
if (obsIndex && theme) {
|
|
17165
|
+
return new Map(obsIndex.map((o) => [o, getDefaultColor(theme)]));
|
|
17166
|
+
}
|
|
17167
|
+
return /* @__PURE__ */ new Map();
|
|
17168
|
+
}
|
|
17148
17169
|
export {
|
|
17149
17170
|
FILE_EXTENSION_JSON,
|
|
17150
17171
|
FILE_EXTENSION_TABULAR,
|
|
@@ -17160,6 +17181,7 @@ export {
|
|
|
17160
17181
|
filterPathsByExpansionAndSelection,
|
|
17161
17182
|
findChangedHierarchy,
|
|
17162
17183
|
findLongestCommonPath,
|
|
17184
|
+
getCellColors,
|
|
17163
17185
|
getCellSetPolygons,
|
|
17164
17186
|
getLevelTooltipText,
|
|
17165
17187
|
getNextNumberedNodeName,
|