UNPKG

repoweaver

Version:

A GitHub App that skillfully weaves multiple templates together to create and update repositories with intelligent merge strategies

1 lines 11.4 kB
{"ast":null,"code":"import _objectSpread from \"@babel/runtime/helpers/objectSpread2\";\nimport invariant from 'fbjs/lib/invariant';\nexport class CellRenderMask {\n constructor(numCells) {\n invariant(numCells >= 0, 'CellRenderMask must contain a non-negative number os cells');\n this._numCells = numCells;\n if (numCells === 0) {\n this._regions = [];\n } else {\n this._regions = [{\n first: 0,\n last: numCells - 1,\n isSpacer: true\n }];\n }\n }\n enumerateRegions() {\n return this._regions;\n }\n addCells(cells) {\n invariant(cells.first >= 0 && cells.first < this._numCells && cells.last >= -1 && cells.last < this._numCells && cells.last >= cells.first - 1, 'CellRenderMask.addCells called with invalid cell range');\n if (cells.last < cells.first) {\n return;\n }\n var _this$_findRegion = this._findRegion(cells.first),\n firstIntersect = _this$_findRegion[0],\n firstIntersectIdx = _this$_findRegion[1];\n var _this$_findRegion2 = this._findRegion(cells.last),\n lastIntersect = _this$_findRegion2[0],\n lastIntersectIdx = _this$_findRegion2[1];\n if (firstIntersectIdx === lastIntersectIdx && !firstIntersect.isSpacer) {\n return;\n }\n var newLeadRegion = [];\n var newTailRegion = [];\n var newMainRegion = _objectSpread(_objectSpread({}, cells), {}, {\n isSpacer: false\n });\n if (firstIntersect.first < newMainRegion.first) {\n if (firstIntersect.isSpacer) {\n newLeadRegion.push({\n first: firstIntersect.first,\n last: newMainRegion.first - 1,\n isSpacer: true\n });\n } else {\n newMainRegion.first = firstIntersect.first;\n }\n }\n if (lastIntersect.last > newMainRegion.last) {\n if (lastIntersect.isSpacer) {\n newTailRegion.push({\n first: newMainRegion.last + 1,\n last: lastIntersect.last,\n isSpacer: true\n });\n } else {\n newMainRegion.last = lastIntersect.last;\n }\n }\n var replacementRegions = [...newLeadRegion, newMainRegion, ...newTailRegion];\n var numRegionsToDelete = lastIntersectIdx - firstIntersectIdx + 1;\n this._regions.splice(firstIntersectIdx, numRegionsToDelete, ...replacementRegions);\n }\n numCells() {\n return this._numCells;\n }\n equals(other) {\n return this._numCells === other._numCells && this._regions.length === other._regions.length && this._regions.every((region, i) => region.first === other._regions[i].first && region.last === other._regions[i].last && region.isSpacer === other._regions[i].isSpacer);\n }\n _findRegion(cellIdx) {\n var firstIdx = 0;\n var lastIdx = this._regions.length - 1;\n while (firstIdx <= lastIdx) {\n var middleIdx = Math.floor((firstIdx + lastIdx) / 2);\n var middleRegion = this._regions[middleIdx];\n if (cellIdx >= middleRegion.first && cellIdx <= middleRegion.last) {\n return [middleRegion, middleIdx];\n } else if (cellIdx < middleRegion.first) {\n lastIdx = middleIdx - 1;\n } else if (cellIdx > middleRegion.last) {\n firstIdx = middleIdx + 1;\n }\n }\n invariant(false, \"A region was not found containing cellIdx \" + cellIdx);\n }\n}","map":{"version":3,"names":["_objectSpread","invariant","CellRenderMask","constructor","numCells","_numCells","_regions","first","last","isSpacer","enumerateRegions","addCells","cells","_this$_findRegion","_findRegion","firstIntersect","firstIntersectIdx","_this$_findRegion2","lastIntersect","lastIntersectIdx","newLeadRegion","newTailRegion","newMainRegion","push","replacementRegions","numRegionsToDelete","splice","equals","other","length","every","region","i","cellIdx","firstIdx","lastIdx","middleIdx","Math","floor","middleRegion"],"sources":["/Users/pmouli/Documents/GitHub.nosync/boots-strapper/mobile/node_modules/react-native-web/dist/vendor/react-native/VirtualizedList/CellRenderMask.js"],"sourcesContent":["import _objectSpread from \"@babel/runtime/helpers/objectSpread2\";\n/**\n * Copyright (c) Meta Platforms, Inc. and affiliates.\n *\n * This source code is licensed under the MIT license found in the\n * LICENSE file in the root directory of this source tree.\n *\n * \n * @format\n */\n\nimport invariant from 'fbjs/lib/invariant';\nexport class CellRenderMask {\n constructor(numCells) {\n invariant(numCells >= 0, 'CellRenderMask must contain a non-negative number os cells');\n this._numCells = numCells;\n if (numCells === 0) {\n this._regions = [];\n } else {\n this._regions = [{\n first: 0,\n last: numCells - 1,\n isSpacer: true\n }];\n }\n }\n enumerateRegions() {\n return this._regions;\n }\n addCells(cells) {\n invariant(cells.first >= 0 && cells.first < this._numCells && cells.last >= -1 && cells.last < this._numCells && cells.last >= cells.first - 1, 'CellRenderMask.addCells called with invalid cell range');\n\n // VirtualizedList uses inclusive ranges, where zero-count states are\n // possible. E.g. [0, -1] for no cells, starting at 0.\n if (cells.last < cells.first) {\n return;\n }\n var _this$_findRegion = this._findRegion(cells.first),\n firstIntersect = _this$_findRegion[0],\n firstIntersectIdx = _this$_findRegion[1];\n var _this$_findRegion2 = this._findRegion(cells.last),\n lastIntersect = _this$_findRegion2[0],\n lastIntersectIdx = _this$_findRegion2[1];\n\n // Fast-path if the cells to add are already all present in the mask. We\n // will otherwise need to do some mutation.\n if (firstIntersectIdx === lastIntersectIdx && !firstIntersect.isSpacer) {\n return;\n }\n\n // We need to replace the existing covered regions with 1-3 new regions\n // depending whether we need to split spacers out of overlapping regions.\n var newLeadRegion = [];\n var newTailRegion = [];\n var newMainRegion = _objectSpread(_objectSpread({}, cells), {}, {\n isSpacer: false\n });\n if (firstIntersect.first < newMainRegion.first) {\n if (firstIntersect.isSpacer) {\n newLeadRegion.push({\n first: firstIntersect.first,\n last: newMainRegion.first - 1,\n isSpacer: true\n });\n } else {\n newMainRegion.first = firstIntersect.first;\n }\n }\n if (lastIntersect.last > newMainRegion.last) {\n if (lastIntersect.isSpacer) {\n newTailRegion.push({\n first: newMainRegion.last + 1,\n last: lastIntersect.last,\n isSpacer: true\n });\n } else {\n newMainRegion.last = lastIntersect.last;\n }\n }\n var replacementRegions = [...newLeadRegion, newMainRegion, ...newTailRegion];\n var numRegionsToDelete = lastIntersectIdx - firstIntersectIdx + 1;\n this._regions.splice(firstIntersectIdx, numRegionsToDelete, ...replacementRegions);\n }\n numCells() {\n return this._numCells;\n }\n equals(other) {\n return this._numCells === other._numCells && this._regions.length === other._regions.length && this._regions.every((region, i) => region.first === other._regions[i].first && region.last === other._regions[i].last && region.isSpacer === other._regions[i].isSpacer);\n }\n _findRegion(cellIdx) {\n var firstIdx = 0;\n var lastIdx = this._regions.length - 1;\n while (firstIdx <= lastIdx) {\n var middleIdx = Math.floor((firstIdx + lastIdx) / 2);\n var middleRegion = this._regions[middleIdx];\n if (cellIdx >= middleRegion.first && cellIdx <= middleRegion.last) {\n return [middleRegion, middleIdx];\n } else if (cellIdx < middleRegion.first) {\n lastIdx = middleIdx - 1;\n } else if (cellIdx > middleRegion.last) {\n firstIdx = middleIdx + 1;\n }\n }\n invariant(false, \"A region was not found containing cellIdx \" + cellIdx);\n }\n}"],"mappings":"AAAA,OAAOA,aAAa,MAAM,sCAAsC;AAWhE,OAAOC,SAAS,MAAM,oBAAoB;AAC1C,OAAO,MAAMC,cAAc,CAAC;EAC1BC,WAAWA,CAACC,QAAQ,EAAE;IACpBH,SAAS,CAACG,QAAQ,IAAI,CAAC,EAAE,4DAA4D,CAAC;IACtF,IAAI,CAACC,SAAS,GAAGD,QAAQ;IACzB,IAAIA,QAAQ,KAAK,CAAC,EAAE;MAClB,IAAI,CAACE,QAAQ,GAAG,EAAE;IACpB,CAAC,MAAM;MACL,IAAI,CAACA,QAAQ,GAAG,CAAC;QACfC,KAAK,EAAE,CAAC;QACRC,IAAI,EAAEJ,QAAQ,GAAG,CAAC;QAClBK,QAAQ,EAAE;MACZ,CAAC,CAAC;IACJ;EACF;EACAC,gBAAgBA,CAAA,EAAG;IACjB,OAAO,IAAI,CAACJ,QAAQ;EACtB;EACAK,QAAQA,CAACC,KAAK,EAAE;IACdX,SAAS,CAACW,KAAK,CAACL,KAAK,IAAI,CAAC,IAAIK,KAAK,CAACL,KAAK,GAAG,IAAI,CAACF,SAAS,IAAIO,KAAK,CAACJ,IAAI,IAAI,CAAC,CAAC,IAAII,KAAK,CAACJ,IAAI,GAAG,IAAI,CAACH,SAAS,IAAIO,KAAK,CAACJ,IAAI,IAAII,KAAK,CAACL,KAAK,GAAG,CAAC,EAAE,wDAAwD,CAAC;IAIzM,IAAIK,KAAK,CAACJ,IAAI,GAAGI,KAAK,CAACL,KA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