114 lines
3.1 KiB
JavaScript
114 lines
3.1 KiB
JavaScript
// Metro module 324 (f325).
|
|
import _classCallCheck from "./_classCallCheck";
|
|
import _createClass from "./_createClass";
|
|
import Module38 from "./Module38";
|
|
let env337 = {};
|
|
const CellRenderMask = function CellRenderMask(a0) {
|
|
_classCallCheck(this, CellRenderMask);
|
|
Module38(a0 >= 0, "CellRenderMask must contain a non-negative number os cells");
|
|
this._numCells = a0;
|
|
this._regions = a0 === 0 ? [] : [{
|
|
first: 0,
|
|
last: a0 - 1,
|
|
isSpacer: true
|
|
}];
|
|
};
|
|
exports.CellRenderMask = _createClass(CellRenderMask, [{
|
|
key: "enumerateRegions",
|
|
value: function enumerateRegions() {
|
|
return this._regions;
|
|
}
|
|
}, {
|
|
key: "addCells",
|
|
value: function addCells(a0) {
|
|
const r3 = a0.first >= 0 && a0.first < this._numCells && a0.last >= -1 && a0.last < this._numCells && a0.last >= a0.first - 1;
|
|
L20: {
|
|
Module38(r3, "CellRenderMask.addCells called with invalid cell range");
|
|
if (!(a0.last < a0.first)) {
|
|
const [r13, r40] = this._findRegion(a0.first);
|
|
const [r14, r45] = this._findRegion(a0.last);
|
|
if (r40 === r45 && !r13.isSpacer) {
|
|
break L20;
|
|
}
|
|
const r12 = [];
|
|
const r47 = {
|
|
...a0,
|
|
isSpacer: false
|
|
};
|
|
if (r13.first < r47.first) {
|
|
if (r13.isSpacer) {
|
|
r12.push({
|
|
first: r13.first,
|
|
last: r47.first - 1,
|
|
isSpacer: true
|
|
});
|
|
} else {
|
|
r47.first = r13.first;
|
|
}
|
|
}
|
|
const r60 = [];
|
|
if (r14.last > r47.last) {
|
|
if (r14.isSpacer) {
|
|
r60.push({
|
|
first: r47.last + 1,
|
|
last: r14.last,
|
|
isSpacer: true
|
|
});
|
|
} else {
|
|
r47.last = r14.last;
|
|
}
|
|
}
|
|
const r71 = [...r12, r47, ...r60];
|
|
const r81 = r45 - r40 + 1;
|
|
const _regions = this._regions;
|
|
_regions.splice.apply(_regions, [r40, r81, ...r71]);
|
|
}
|
|
}
|
|
}
|
|
}, {
|
|
key: "numCells",
|
|
value: function numCells() {
|
|
return this._numCells;
|
|
}
|
|
}, {
|
|
key: "equals",
|
|
value: function equals(a0) {
|
|
return this._numCells === a0._numCells && this._regions.length === a0._regions.length && this._regions.every((_region, index) => {
|
|
const first = _region.first;
|
|
return first === a0._regions[index].first && _region.last === a0._regions[index].last && _region.isSpacer === a0._regions[index].isSpacer;
|
|
});
|
|
}
|
|
}, {
|
|
key: "_findRegion",
|
|
value: function _findRegion(a0) {
|
|
let r24, r25;
|
|
let r1 = this._regions.length - 1;
|
|
let r10 = 0;
|
|
while (r10 <= r1) {
|
|
const r18 = Math.floor((r10 + r1) / 2);
|
|
const r20 = this._regions[r18];
|
|
const first = r20.first;
|
|
const r2 = r1;
|
|
const r14 = r10;
|
|
if (a0 >= first && a0 <= r20.last) {
|
|
return [r20, r18];
|
|
}
|
|
if (a0 < r20.first) {
|
|
r24 = r18 - 1;
|
|
r25 = r14;
|
|
} else {
|
|
const last = r20.last;
|
|
r24 = r2;
|
|
r25 = r14;
|
|
if (a0 > last) {
|
|
r25 = r18 + 1;
|
|
r24 = r2;
|
|
}
|
|
}
|
|
r1 = r24;
|
|
r10 = r25;
|
|
}
|
|
Module38(false, `A region was not found containing cellIdx ${a0}`);
|
|
}
|
|
}]);
|